feat(rewards): add earn rewards preview and mUSD calculator route#27684
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
|
|
||
| // Card geo check — isCardGeoLoaded flips true when loadCardholderAccounts settles | ||
| const isCardGeoLoaded = useSelector(selectCardIsLoaded); | ||
| const cardGeoLocation = useSelector(selectCardGeoLocation); |
There was a problem hiding this comment.
@Brunonascdev I think @Montoya reached out to you about rendering a card earn card here based on geo restriction same as what card is using right now.
Is what is implemented here accurate? Or do we still need a new selector like you suggested?
- Add EarnRewardsPreview component to dashboard showing geo-gated earn cards for mUSD calculator and MetaMask Card onboarding - Add MusdCalculatorView screen and register MUSD_CALCULATOR_VIEW route - Simplify CampaignsPreview to single featured campaign (active → upcoming → previous) instead of separate active tile + upcoming banner - Sort active campaigns by soonest start date in useRewardCampaigns - Export selectCardIsLoaded selector from card redux slice - Add locale strings and test selectors for earn rewards section Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The new EarnRewardsPreview import pulls in card/index.ts which transitively imports accounts.ts — that file calls createSelector with selectAccountTreeControllerState which is undefined at module-eval time in Jest's jsdom env, crashing the test suite. Add a module-level jest.mock for EarnRewardsPreview (same pattern as CampaignsPreview) to break the import chain. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… circular avatar - Add earn-musd and earn-card PNG/SVG assets extracted from Figma exports - Replace generic placeholder images with new brand assets - Card earn card: 12deg rotation + 0.75 scale for visual depth - mUSD earn card: circular inner avatar with drop shadow using theme color token Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Swap in rewards-musd-earn.png and rewards-card-earn.png from design - Remove interim SVG/PNG extractions (earn-card, earn-musd) - Images carry their own background so drop avatarBgClass, rotation, scale and circular avatar wrapper Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds dynamic card subtitle logic — cardholders or authenticated card users see 'Access your MetaMask Card benefits' instead of the default CTA. Updates tests with new selector mocks and cardholder subtitle cases. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
9708949 to
11004f7
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Why SmokeCard: The new Why SmokeWalletPlatform: The Rewards dashboard is part of the Trending tab ecosystem. The No performance tests needed: The changes are UI component additions/modifications with no significant performance-critical paths (no heavy list rendering, no new data fetching infrastructure, no startup/initialization changes). Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| ? strings('rewards.earn_rewards.card_subtitle_cardholder') | ||
| : strings('rewards.earn_rewards.card_subtitle'); | ||
|
|
||
| const isAnyGeoLoading = isGeoLoading || isCardGeoLoading; |
There was a problem hiding this comment.
Geo-blocked mUSD card flashes before geo check starts
Medium Severity
showMusdCard is derived as optinAllowedForGeo !== false, treating null (initial/undetermined) the same as true (allowed). The rewards Redux initial state has optinAllowedForGeoLoading: false and optinAllowedForGeo: null. When the card slice has already loaded (isCardGeoLoaded = true) but the rewards geo check hasn't started yet (e.g. first time entering Rewards), isAnyGeoLoading evaluates to false while showMusdCard is true. This causes the mUSD card to render for geo-blocked users (e.g. UK) until the geo check dispatches its loading flag and subsequently resolves. The loading guard doesn't cover the "not yet initiated" state because the initial loading flag is false.
There was a problem hiding this comment.
Is this true and can we fix it?
There was a problem hiding this comment.
yeah needs a fix, working on it
|
✅ E2E Fixture Validation — Schema is up to date |
|





Description
Adds the Earn Rewards section to the Rewards Dashboard and introduces a dedicated mUSD Calculator screen.
Changes
EarnRewardsPreview— new dashboard section with two geo-gated earn cards:MusdCalculatorView; hidden when geo disallows opt-in (e.g. UK)MusdCalculatorView— new screen wrappingMusdCalculatorTabwith standard header; registered asMUSD_CALCULATOR_VIEWrouteCampaignsPreview— simplified to a single "featured" campaign (priority: active → upcoming → previous) instead of separate active tile + upcoming banner; active campaigns now also sorted by soonest start dateselectCardIsLoaded— new selector exported from card redux sliceScreenshots
Checklist
Changelog
CHANGELOG entry: Added Earn Rewards preview section to the Rewards Dashboard with geo-gated mUSD calculator and MetaMask Card earn cards
🤖 Generated with Claude Code
Note
Medium Risk
Medium risk due to new navigation route and a dashboard section that gates UI/behavior on geo/card state and triggers a deeplink, which could affect user flows if selectors or loading states are incorrect.
Overview
Adds an Earn rewards preview section to the Rewards dashboard, showing geo-gated cards for the mUSD calculator and MetaMask Card (with skeleton loading, cardholder-aware copy, and deeplink navigation).
Introduces a new
MusdCalculatorViewscreen and registers it under the newRoutes.MUSD_CALCULATOR_VIEWin bothRoutesandRewardsNavigator.Simplifies
CampaignsPreviewto render a single featured campaign (active → upcoming → previous) and updatesuseRewardCampaignsto sort active campaigns by sooneststartDate, with corresponding test updates and new i18n/test selectors.Written by Cursor Bugbot for commit 11004f7. This will update automatically on new commits. Configure here.