Commit eedc67b
authored
feat(MUSD-739): hide Metal card outside US (#29735)
## **Description**
Money Home's `MoneyMetaMaskCard` upsell currently shows two card rows
(Virtual at 1% cashback, Metal at 3% cashback) to every user. The Metal
card is only available to US users today, so this PR adds geolocation
gating: the Metal card row is only rendered when the Ramps-detected
geolocation positively resolves to `US`. Loading, unknown (`undefined`),
and non-US country codes all fail closed and render only the Virtual
card row.
While here, both "Get now" buttons now route through the canonical
`metamask://card-onboarding` deeplink (via `handleDeeplink`) instead of
`navigation.navigate(Routes.CARD.ROOT)`, matching the upsell entry point
used elsewhere (e.g. `EarnRewardsPreview`).
`MoneyMetaMaskCard` accepts a new `showMetalCard` prop (default `false`)
so the view layer keeps ownership of the geolocation read; the component
stays a dumb presentational primitive. `MoneyHomeView` reads
`getDetectedGeolocation` from `app/reducers/fiatOrders` and normalizes
it the same way `useMusdConversionEligibility` does
(`?.toUpperCase().split('-')[0] === 'US'`).
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes: MUSD-739
## **Manual testing steps**
```gherkin
Feature: Metal card geolocation gating in Money Home
Scenario: US user sees both Virtual and Metal card rows
Given the user's Ramps geolocation has resolved to "US"
When the user opens the Money home screen and scrolls to the MetaMask Card section in upsell mode
Then the Virtual card row (1% cashback) is visible
And the Metal card row (3% cashback) is visible
Scenario: Non-US user sees only the Virtual card row
Given the user's Ramps geolocation has resolved to "GB" (or any non-US code)
When the user opens the Money home screen and scrolls to the MetaMask Card section in upsell mode
Then the Virtual card row (1% cashback) is visible
And the Metal card row is not rendered
Scenario: Unknown / loading geolocation hides the Metal card row
Given the Ramps geolocation has not yet resolved (undefined)
When the user opens the Money home screen and scrolls to the MetaMask Card section in upsell mode
Then only the Virtual card row is visible
Scenario: Get now button opens the card-onboarding deeplink
Given the MetaMask Card upsell section is visible
When the user taps the "Get now" button on either the Virtual or Metal card row
Then the metamask://card-onboarding deeplink is dispatched
```
## **Screenshots/Recordings**
### **Before**
### **After**
## **Pre-merge author checklist**
- [ ] 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).
- [ ] I've completed the PR template to the best of my ability
- [ ] I've included tests if applicable
- [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] 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.
#### Performance checks (if applicable)
- [ ] I've tested on Android
- [ ] I've tested with a power user scenario
- [ ] I've instrumented key operations with Sentry traces for production
performance metrics
## **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]
> **Low Risk**
> Low risk UI change that conditionally hides the Metal card upsell row
based on the existing ramps geolocation selector; main risk is incorrect
geolocation normalization causing the Metal row to appear/disappear
unexpectedly.
>
> **Overview**
> Money Home now **hides the Metal card upsell row outside the US** by
reading `getDetectedGeolocation` and passing a new `showMetalCard` flag
into `MoneyMetaMaskCard` (US and US sub-regions like `US-CA` only;
`undefined`/non-US fail closed).
>
> `MoneyMetaMaskCard` is updated to accept `showMetalCard` (default
`false`) and only render the Metal row when enabled, with tests expanded
to cover the new gating and MoneyHomeView integration.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
616aab6. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent aac019d commit eedc67b
4 files changed
Lines changed: 149 additions & 15 deletions
File tree
- app/components/UI/Money
- Views/MoneyHomeView
- components/MoneyMetaMaskCard
Lines changed: 86 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
88 | 94 | | |
| 95 | + | |
89 | 96 | | |
90 | 97 | | |
91 | 98 | | |
| |||
134 | 141 | | |
135 | 142 | | |
136 | 143 | | |
| 144 | + | |
137 | 145 | | |
138 | 146 | | |
139 | 147 | | |
| |||
592 | 600 | | |
593 | 601 | | |
594 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
595 | 681 | | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| 77 | + | |
| 78 | + | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| |||
296 | 299 | | |
297 | 300 | | |
298 | 301 | | |
| 302 | + | |
299 | 303 | | |
300 | 304 | | |
301 | 305 | | |
| |||
Lines changed: 43 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
51 | 74 | | |
52 | 75 | | |
53 | | - | |
| 76 | + | |
54 | 77 | | |
55 | 78 | | |
56 | | - | |
57 | 79 | | |
58 | | - | |
| 80 | + | |
59 | 81 | | |
60 | 82 | | |
61 | 83 | | |
| |||
64 | 86 | | |
65 | 87 | | |
66 | 88 | | |
67 | | - | |
| 89 | + | |
68 | 90 | | |
69 | 91 | | |
70 | 92 | | |
| |||
174 | 196 | | |
175 | 197 | | |
176 | 198 | | |
177 | | - | |
| 199 | + | |
178 | 200 | | |
179 | | - | |
| 201 | + | |
180 | 202 | | |
181 | 203 | | |
182 | 204 | | |
| |||
187 | 209 | | |
188 | 210 | | |
189 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
190 | 225 | | |
191 | 226 | | |
192 | 227 | | |
| |||
Lines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
37 | 43 | | |
38 | 44 | | |
39 | 45 | | |
| |||
166 | 172 | | |
167 | 173 | | |
168 | 174 | | |
| 175 | + | |
169 | 176 | | |
170 | 177 | | |
171 | 178 | | |
| |||
200 | 207 | | |
201 | 208 | | |
202 | 209 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
210 | 219 | | |
211 | 220 | | |
212 | 221 | | |
| |||
0 commit comments