Commit bfb9e9f
chore(runway): cherry-pick feat(card): cp-7.64.0 Onboarding and Metal Card flow fixes (#25538)
- feat(card): cp-7.64.0 Onboarding and Metal Card flow fixes (#25473)
<!--
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**
This PR includes multiple improvements and bug fixes for the Card
feature:
### Sign Up Flow Improvements
- **Removed confirm password field**: Simplified the sign up form by
removing the redundant password confirmation step
- **Added password visibility toggle**: Users can now show/hide their
password using an eye icon
- **Reordered form fields**: Country selector is now displayed first,
followed by email and password
- **Updated copy**: Changed "Apply now" button text to "Setup now" and
updated password description
### DaimoPay Environment Toggle
- **Added experimental setting**: New toggle in Experimental Settings to
switch between DaimoPay demo and production environments (only visible
in non-production builds)
- **Refactored environment detection**: `getDaimoEnvironment` now
accepts a parameter instead of checking `__DEV__`
- **Fixed payment flow**: Payment polling now uses `orderId` instead of
`payId` for correct status tracking
- **Improved payment completion handling**: Removed premature navigation
on `paymentCompleted` WebView event - now relies on polling to confirm
actual completion
### Card Home Fixes
- **Fixed manage card options visibility**: Added `needsSetup` condition
to hide manage card, metal card order, and travel options when user
hasn't completed card setup
- **Fixed balance display for non-US locales**: Fixed an issue where
fiat balance was displaying 100x the correct value (e.g., $55 instead of
$0.55) for locales that use comma as decimal separator (Brazilian
Portuguese, German, etc.)
### Token Balance Fixes
- **Fixed potential balance mismatch**: Changed `useTokensWithBalance`
from index-based array lookup to address-based Map lookup to prevent
balance mismatches when tokens are filtered
### Spending Limit Screen Fix
- **Fixed asset selection flickering**: Resolved an issue where
selecting a different asset from the AssetSelectionBottomSheet would
immediately revert to the original asset
### Other Changes
- **PersonalDetails**: Removed fallback for nationality field (no longer
uses `countryOfResidence` as fallback)
- **CardSDK**: Added `location` parameter to `getRegistrationStatus`
method
- **Types**: Added `requestId` to `CreateOrderResponse` and `STARTED` to
`OrderStatus`
## **Changelog**
CHANGELOG entry: Improved Card sign up flow by removing confirm password
field and adding password visibility toggle. Fixed balance display for
non-US locales, fixed asset selection flickering on Spending Limit
screen, and fixed manage card options visibility for users who haven't
completed setup.
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: Card sign up flow
Scenario: User signs up for card
Given user opens the Card sign up screen
When user views the form
Then country selector should be displayed first
And email field should be displayed second
And password field should be displayed third
And there should be no confirm password field
And password field should have a visibility toggle icon
Feature: Card balance display with locale formatting
Scenario: User views correct balance with Brazilian locale
Given user has device set to Brazilian Portuguese locale
And user has 0.55 USDC in their wallet
When user navigates to Card Home
Then balance should display as "US$ 0,55" (not "US$ 55,00")
Feature: Spending limit asset selection
Scenario: User changes asset on spending limit screen
Given user is on the Spending Limit screen with USDC selected
When user taps "Other" to select a different asset
And user selects USDT from the asset selection bottom sheet
Then USDT should remain selected (not revert to USDC)
Feature: Card Home manage options visibility
Scenario: User sees manage options only after setup
Given user has not completed card setup (needs delegation)
When user views Card Home
Then "Manage Card", "Order Metal Card", and "Travel" options should be hidden
Feature: DaimoPay environment toggle (non-production only)
Scenario: Developer toggles DaimoPay demo mode
Given user is on a non-production build
And user navigates to Settings > Experimental
When user toggles "Use DaimoPay demo environment"
Then DaimoPay should use the demo environment for payments
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
First case: Demo disabled. The order fails because a payment was already
completed.
Second case: Demo enabled. The demo flow starts successfully.
https://github.com/user-attachments/assets/3093aae7-276d-4351-ae8f-aee70d412f9d
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/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-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] 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]
> **Medium Risk**
> Medium risk due to changes across Card onboarding, DaimoPay payment
creation/polling/navigation, and Redux state used to select environments
and locations; could affect checkout completion and onboarding flows if
miswired.
>
> **Overview**
> Improves Card onboarding UX by **removing the confirm-password
field**, reordering the Sign Up form (country → email → password),
adding **password visibility toggles** (Sign Up + Login), updating
onboarding copy, and disabling app auto-lock while the onboarding
navigator is mounted.
>
> Refactors DaimoPay to support a **demo/production toggle** (new
`card.isDaimoDemo` + Experimental Settings switch shown only in
non-production builds) and to **poll by `orderId`** in production (while
demo navigates immediately). This threads `orderId` through
`ReviewOrder` → `DaimoPayModal`, updates `DaimoPayService` to return `{
payId, orderId }` (with `requestId` support), and tightens event/origin
handling.
>
> Fixes a few Card flow issues: hides manage-card actions until setup is
complete, parses locale-formatted fiat strings correctly when deriving
balances, prevents spending-limit token selection from being overwritten
after returning from the bottom sheet, removes nationality fallback in
`PersonalDetails`, and passes `userCardLocation` into
`CardSDK.getRegistrationStatus`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
32d224d. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
[7c2216d](7c2216d)
Co-authored-by: Bruno Nascimento <brunonascimentodev@gmail.com>1 parent 6554660 commit bfb9e9f
30 files changed
Lines changed: 819 additions & 535 deletions
File tree
- app
- components
- UI/Card
- Views
- CardAuthentication
- __snapshots__
- CardHome
- ReviewOrder
- components
- DaimoPayModal
- Onboarding
- hooks
- routes
- sdk
- services
- util
- Views/Settings/ExperimentalSettings
- core/redux/slices/card
- locales/languages
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
246 | 284 | | |
247 | 285 | | |
248 | 286 | | |
| |||
Lines changed: 21 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
11 | 10 | | |
12 | 11 | | |
13 | | - | |
| 12 | + | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| |||
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
33 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| 54 | + | |
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
| |||
187 | 190 | | |
188 | 191 | | |
189 | 192 | | |
| 193 | + | |
190 | 194 | | |
191 | 195 | | |
192 | 196 | | |
| |||
432 | 436 | | |
433 | 437 | | |
434 | 438 | | |
435 | | - | |
| 439 | + | |
436 | 440 | | |
437 | 441 | | |
438 | 442 | | |
439 | 443 | | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
440 | 455 | | |
441 | 456 | | |
442 | 457 | | |
| |||
449 | 464 | | |
450 | 465 | | |
451 | 466 | | |
| 467 | + | |
452 | 468 | | |
453 | 469 | | |
454 | 470 | | |
| |||
Lines changed: 36 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
505 | | - | |
506 | 505 | | |
507 | | - | |
508 | 506 | | |
509 | 507 | | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
514 | 516 | | |
515 | | - | |
516 | 517 | | |
517 | 518 | | |
518 | 519 | | |
| |||
837 | 838 | | |
838 | 839 | | |
839 | 840 | | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
840 | 869 | | |
841 | 870 | | |
842 | 871 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1116 | 1116 | | |
1117 | 1117 | | |
1118 | 1118 | | |
1119 | | - | |
1120 | | - | |
1121 | | - | |
1122 | | - | |
1123 | | - | |
1124 | | - | |
1125 | | - | |
1126 | | - | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
1130 | | - | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
1131 | 1124 | | |
1132 | | - | |
1133 | | - | |
1134 | | - | |
| 1125 | + | |
1135 | 1126 | | |
1136 | | - | |
| 1127 | + | |
1137 | 1128 | | |
1138 | | - | |
1139 | | - | |
1140 | | - | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
1141 | 1132 | | |
1142 | | - | |
1143 | | - | |
1144 | | - | |
1145 | | - | |
1146 | | - | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
1147 | 1145 | | |
1148 | | - | |
1149 | | - | |
1150 | | - | |
1151 | | - | |
1152 | | - | |
1153 | | - | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
1154 | 1157 | | |
1155 | 1158 | | |
1156 | 1159 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
52 | 57 | | |
53 | 58 | | |
54 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
54 | | - | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| |||
135 | 137 | | |
136 | 138 | | |
137 | 139 | | |
| 140 | + | |
138 | 141 | | |
139 | 142 | | |
140 | 143 | | |
141 | 144 | | |
142 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
143 | 150 | | |
144 | 151 | | |
145 | 152 | | |
| |||
149 | 156 | | |
150 | 157 | | |
151 | 158 | | |
152 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
153 | 167 | | |
154 | 168 | | |
155 | 169 | | |
| |||
0 commit comments