feat(card): migrate CardHome to Controller#28564
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. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
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.
Reviewed by Cursor Bugbot for commit 3baa77b. Configure here.
|
|
✅ E2E Fixture Validation — Schema is up to date |




Description
This branch finishes the Card Home migration to
CardControllerand fixes the behavior regressions introduced while moving card auth, cardholder state, wallet data, and spending-limit flows away from the old SDK/React Query orchestration.The motivation for the change was to make
CardControllerthe source of truth for Card state, instead of splitting responsibility across the Reduxcardslice, SDK helpers, and deleted React Query hooks likeuseLoadCardData/useGetCardExternalWalletDetails.Key changes in this branch:
Card authentication and session state now come from
CardControllerCardAuthenticationusesuseCardAuth.selectIsCardAuthenticated,selectIsCardholder,selectCardholderAccounts, andselectCardUserLocation.Engine.context.CardController.Card Home was migrated to controller-backed data and split into smaller hooks/components
CardHome.tsxwas refactored heavily into focused components and hooks likeuseCardHomeActions,useCardHomeAnalytics, anduseCardProvisioning.Push provisioning was aligned with the new controller/provider architecture
Unauthenticated cardholder UX was added
Spending Limit / delegation flows broken by the migration were restored
priorityToken,allTokens,delegationSettings,externalWalletDetailsData) instead of only{ flow }.CardHomeDatanow carriesdelegationSettings.delegationContract, which fixes the"Missing token configuration"delegation failure.useSpendingLimitnow callsCardController.fetchCardHomeData()so the updated wallet/priority-token state appears automatically without requiring a manual refresh.Additional follow-up fixes and test coverage
Changelog
CHANGELOG entry: Fixed MetaMask Card authentication, unauthenticated cardholder actions, and spending limit/delegation refresh flows after the CardController migration.
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
N/A
After
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Large refactor of
CardHomedata-flow and interaction handlers to rely onCardController/new hooks, plus navigation/auth gating changes; regressions are possible in card setup, spending-limit, and sensitive actions (PIN/details/freeze). Mostly UI-layer changes but they touch session/logout behavior and several user flows.Overview
Card Home is migrated to controller-backed state and decomposed into smaller units.
CardHomenow renders fromuseCardHomeData()andCardControllerselectors/capabilities, with UI split into components likeCardAlertSection,CardActionsButtons,CardImageSection,CardBalanceDisplay,ManageCardOptions, andCardHomeFooter, plus extracted hooks for actions/analytics/provisioning.Unauthenticated cardholder UX is changed from “blocked” to “teaser” actions. Manage options (view details/PIN, freeze toggle, cashback, travel, manage card, etc.) can appear while unauthenticated but now route to
Routes.CARD.AUTHENTICATIONwithshowAuthPrompt: true; logout stays hidden.Auth + location handling is adjusted in
CardAuthentication. The screen readsshowAuthPromptfrom route params to show a new info banner (CardMessageBoxType.AuthPrompt), and location selection is now local state (selectedLocation) used during login rather than immediately callingCardController.setUserLocation.Behavioral/test updates. Tests are updated to mock
useRoute, validate new teaser/navigation behavior, switchCardHometests touseCardHomeData, align freeze with separatefreeze/unfreezemutations, update spending-limit copy expectations, and tighten analytics expectations (don’t emit without a formatted balance).Reviewed by Cursor Bugbot for commit 3baa77b. Bugbot is set up for automated code reviews on this repo. Configure here.