Commit 5cc42fe
refactor: migrate onboarding flow to TypeScript (#38253)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
[](https://codespaces.new/MetaMask/metamask-extension/pull/38253?quickstart=1)
In this PR, we migrate all JavaScript files to TypeScript in the
onboarding flow to improve type safety and code maintainability. This
conversion encompasses all components within the
ui/pages/onboarding-flow directory, including:
- Main onboarding flow orchestration and routing
- Onboarding flow switch logic
- Welcome and login screens
- Create password flow
- Recovery phrase (review, reveal, and confirm) components
- Import SRP functionality
- Privacy settings
- MetaMetrics opt-in
- Creation successful screens
- Account exist/not found flows
- Download app screen
- Associated test files and stories
Removed the pin-extension folder from onboarding-flow as it’s no longer
in use.
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: Migrated onboarding flow to TypeScript for improved
type safety and maintainability
## **Related issues**
Fixes:
## **Manual testing steps**
1. Go to this page...
2.
3.
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Convert onboarding flow to TypeScript with prop/return type fixes, add
sidepanel open-on-completion path, and refine MetaMetrics participation
handling; update routing/selectors and tests accordingly.
>
> - **Onboarding (TypeScript migration)**:
> - Convert core screens/components to TS (`create-password`,
`import-srp`, `recovery-phrase/*`, `welcome`, `privacy-settings`,
`metametrics`, `creation-successful`, `onboarding-flow`, header,
switch).
> - Replace PropTypes with typed props; add explicit handler/event
typings; minor UI prop/enum tweaks.
> - Update lazy imports and add `ui/pages/onboarding-flow/index.ts` for
routing.
> - **Side Panel Integration**:
> - Add `BrowserWithSidePanel` type and open sidepanel on completion
when enabled (`creation-successful`); set `useSidePanelAsDefault`; mark
onboarding completed via sidepanel; selector `getOpenedWithSidepanel`.
> - **MetaMetrics updates**:
> - Allow `participateInMetaMetrics` to be `boolean | null`; only set
uninstall URL after explicit choice; adjust action signature and
onboarding flows to respect null state.
> - Analytics iframe/query construction tightened; add/propagate
analytics properties typings.
> - **Routing/Selectors/State**:
> - Routes updated to consume new onboarding export; add Redux handling
for `COMPLETE_ONBOARDING_WITH_SIDEPANEL` and related selector.
> - Minor UI copy/color tweaks in app header icons.
> - **Actions/Thunks typing**:
> - Ensure onboarding thunks return `Promise<string>` where they yield
SRP; add stronger param types (e.g., ENS resolution boolean).
> - **Tests & Stories**:
> - Update tests to TS types, cast elements, mock returns, and new
props; snapshot adjustments; storybook meta typing fixes.
> - **Shared Types**:
> - Export new `sidepanel` types in `shared/types`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
71e320b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: MetaMask Bot <[email protected]>1 parent 50cc11f commit 5cc42fe
File tree
50 files changed
+546
-311
lines changed- app/scripts/controllers
- ui
- ducks/metamask
- pages
- onboarding-flow
- create-password
- __snapshots__
- creation-successful
- import-srp
- metametrics
- __snapshots__
- onboarding-app-header
- __snapshots__
- onboarding-flow-switch
- privacy-settings
- recovery-phrase
- __snapshots__
- welcome
- __snapshots__
- routes
- unlock-page
- store
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
50 files changed
+546
-311
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
885 | 885 | | |
886 | 886 | | |
887 | 887 | | |
| 888 | + | |
888 | 889 | | |
889 | 890 | | |
890 | 891 | | |
| |||
920 | 921 | | |
921 | 922 | | |
922 | 923 | | |
923 | | - | |
| 924 | + | |
924 | 925 | | |
925 | 926 | | |
926 | 927 | | |
| |||
946 | 947 | | |
947 | 948 | | |
948 | 949 | | |
949 | | - | |
| 950 | + | |
| 951 | + | |
950 | 952 | | |
951 | 953 | | |
952 | 954 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
638 | 638 | | |
639 | 639 | | |
640 | 640 | | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
0 commit comments