feat(card): handle unauthenticated case on money account linkage#30227
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:
These changes implement a new user flow: linking a Money account to a Card from the Money home screen, with proper handling of authentication state. This is squarely within the SmokeMoney test scope which covers Card home screen, Add Funds flows, and card analytics. No other feature areas (Confirmations, Swaps, Accounts, etc.) are affected by these changes. Performance Test Selection: |
|



Description
This branch improves the Money Account → Card linkage entry flow when the user is not authenticated with the Card backend.
Previous behaviour: Link-card CTAs from Money Account effectively sent unauthenticated users to Card home without completing auth or resuming linkage.
New behaviour:
moneyAccountCardTokenwhen authenticated).pendingMoneyAccountCardLinkflag, navigate into Card (CARD.ROOT→CARD.HOME→CARD.AUTHENTICATION) withshowAuthPrompt: trueand apostAuthRedirectpayload (origin for future multi-entrypoint use). After successful login,NavigationService.navigation.goBack()pops the pushedCard.ROOTso the user returns to the tab they came from (e.g. Money) without leavingCardAuthenticationon the stack or cross-navigating with a flicker. AuseEffectinuseMoneyAccountCardLinkageresumes: waits forcardHomeDataStatusto reachsuccessorerrorbefore clearing the pending flag whenmoneyAccountCardTokenis still missing (avoids clearing too early while card home data loads post-login); if delegated already, clears pending; if token is present, opens the linkage sheet and clears pending.moneyAccountLinkIntent: true(Spending-limit lock for Money as spending source remains for a follow-up branch).What changed (high level):
app/core/redux/slices/card/index.ts:pendingMoneyAccountCardLink,setPendingMoneyAccountCardLink,selectPendingMoneyAccountCardLink.useMoneyAccountCardLinkage.tsx:startLinkFlow(origin), nested navigation for auth vs onboarding, resume effect withselectCardHomeDataStatusgating.MoneyHomeView.tsx: link CTA callsstartLinkFlowwith root-level origin{ screen: Routes.MONEY.ROOT, params: { screen: Routes.MONEY.HOME } }.CardAuthentication.tsx: optional route paramspostAuthRedirect/showAuthPrompt; on successful login whenpostAuthRedirectis set,goBack()on the rootNavigationServiceinstead of resetting to Card home or navigating to Money by name.Why
moneyAccountCardTokenis unavailable until post-auth card data loads; gating oncardHomeDataStatusavoids dropping the pending flag during that window.What changed (scoped paths)
app/core/redux/slices/card/index.ts,app/core/redux/slices/card/index.test.tsapp/components/UI/Card/hooks/useMoneyAccountCardLinkage.tsx,.test.tsxapp/components/UI/Card/Views/CardAuthentication/CardAuthentication.tsx,.test.tsxapp/components/UI/Money/Views/MoneyHomeView/MoneyHomeView.tsx,.test.tsxOut of scope (intentional)
moneyAccountLinkIntentwiring beyond navigation is deferred).Changelog
CHANGELOG entry: Improved Money Account link-to-Card flow for unauthenticated cardholders (auth screen, return to origin tab without stale stack, resume linkage sheet after card data loads); added pending linkage Redux flag and onboarding navigation intent for non-cardholders.
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Modifies cross-stack navigation and linkage orchestration using a new Redux pending flag; main risk is regressions in navigation stack behavior or incorrectly resuming/clearing the pending linkage state after login.
Overview
Improves the Money Account → Card linkage entry flow for unauthenticated users by introducing a
pendingMoneyAccountCardLinkRedux flag and a newstartLinkFlow(origin)API inuseMoneyAccountCardLinkagethat routes users to Card auth/onboarding and resumes opening the Link Card sheet after authentication.Updates
CardAuthenticationto accept an optionalpostAuthRedirectparam and, on successful login, popCard.ROOTviaNavigationService.navigation.goBack()instead of resetting the inner Card stack, preserving the originating tab’s navigation state.Refactors
MoneyHomeViewlink-card CTAs to callstartLinkFlow(passing the Money home origin) and expands unit tests to cover the new branching and resume behavior, including token-resolution and data-loading edge cases.Reviewed by Cursor Bugbot for commit 34bad9c. Bugbot is set up for automated code reviews on this repo. Configure here.