Commit 05850d9
chore(runway): cherry-pick feat(card): cp-7.64.0 create card-kyc-notification deep link handler (#25703)
- feat(card): cp-7.64.0 create card-kyc-notification deep link handler
(#25607)
<!--
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**
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
This PR implements a deeplink handler for Card KYC push notifications,
allowing users to be routed to the appropriate screen based on their KYC
verification status when tapping on a notification about their
verification result.
**Motivation**: When users complete their KYC verification process, they
receive push notifications about the result. Previously, there was no
handler to deep link users directly to the relevant screen based on
their verification status.
**Solution**:
- Added a new `card-kyc-notification` deeplink action that checks the
user's KYC verification state and navigates accordingly
- Handles two scenarios:
1. **Onboarding flow** (user has onboardingId): Routes to KYCFailed,
Complete (→ PersonalDetails), or KYCPending
2. **Authenticated flow** (user is already logged in): Routes to
KYCFailed, Complete (→ CardHome via SpendingLimit), or CardHome
- Updated the `Complete` screen to accept a `nextDestination` route
param for proper navigation after KYC approval
- Added logic to suppress the "keep going" modal when users are
deeplinked directly to the Complete screen
- Added `logout` method to CardSDK for proper session cleanup
- Refactored `useCardProviderAuthentication` to get location from Redux
selector instead of function parameters
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: Added deeplink handler for Card KYC push notifications
to route users to appropriate screens based on verification status
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: Card KYC Notification Deeplink Handler
Scenario: User taps KYC approved notification during onboarding
Given user is in the Card onboarding flow with a pending KYC verification
And user has an onboardingId stored in Redux
When user taps on a push notification with the card-kyc-notification deeplink
And the KYC status is VERIFIED
Then user is navigated to the Complete screen
And tapping Continue navigates to PersonalDetails
Scenario: User taps KYC approved notification when authenticated
Given user is authenticated with the Card provider
And user has completed KYC verification
When user taps on a push notification with the card-kyc-notification deeplink
And the KYC status is VERIFIED
Then user is navigated to the Complete screen
And tapping Continue navigates to SpendingLimit screen
Scenario: User taps KYC rejected notification
Given user has submitted KYC verification
When user taps on a push notification with the card-kyc-notification deeplink
And the KYC status is REJECTED
Then user is navigated to the KYCFailed screen
Scenario: User taps notification while KYC is still pending
Given user has submitted KYC verification
When user taps on a push notification with the card-kyc-notification deeplink
And the KYC status is PENDING
Then user is navigated to the KYCPending screen (onboarding) or CardHome (authenticated)
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [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**
> Adds a new deeplink entry point and changes navigation/auth state
handling, which could misroute users or regress card onboarding/auth
flows if state/params aren’t set as expected.
>
> **Overview**
> Adds a new `card-kyc-notification` universal link action that inspects
Card feature flags plus the user’s onboarding/auth state, fetches KYC
verification status (via `CardSDK`), and deep-navigates to the
appropriate Card screen (e.g., `KYC_FAILED`, `KYC_PENDING`, or
`COMPLETE` with a `nextDestination` param).
>
> Refactors Card authentication to source `location` from Redux
(`selectUserCardLocation`) rather than passing it through login/OTP
APIs, and updates UI to persist location selection in state.
>
> Improves session cleanup by introducing `CardSDK.logout()` (server
logout + always-clear local token) and wiring `logoutFromProvider()` to
call it while still clearing Redux state on failures; `CardHome` now
shows a toast when an authentication error forces logout/redirect. Also
tweaks onboarding navigation (skip “keep going” modal when deeplinked to
`COMPLETE`), adjusts close-button behavior to `reset` to Card Home, and
updates related copy/SSN helper text and tests.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
d043390. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Alejandro Machado <alejandro@macha.do>
Co-authored-by: Kevin Le Jeune <kevin.le-jeune@consensys.net>
[826b8b5](826b8b5)
Co-authored-by: Bruno Nascimento <brunonascimentodev@gmail.com>
Co-authored-by: Alejandro Machado <alejandro@macha.do>
Co-authored-by: Kevin Le Jeune <kevin.le-jeune@consensys.net>1 parent 21c4ad3 commit 05850d9
21 files changed
Lines changed: 1747 additions & 98 deletions
File tree
- app
- components/UI/Card
- Views
- CardAuthentication
- CardHome
- components/Onboarding
- hooks
- routes
- sdk
- constants
- core/DeeplinkManager/handlers/legacy
- __tests__
- locales/languages
Lines changed: 2 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
282 | 281 | | |
283 | 282 | | |
284 | 283 | | |
285 | | - | |
| 284 | + | |
286 | 285 | | |
287 | 286 | | |
288 | 287 | | |
| |||
296 | 295 | | |
297 | 296 | | |
298 | 297 | | |
299 | | - | |
300 | 298 | | |
301 | 299 | | |
302 | 300 | | |
303 | 301 | | |
304 | 302 | | |
305 | 303 | | |
306 | | - | |
| 304 | + | |
307 | 305 | | |
308 | 306 | | |
309 | 307 | | |
| |||
319 | 317 | | |
320 | 318 | | |
321 | 319 | | |
322 | | - | |
323 | 320 | | |
324 | 321 | | |
325 | 322 | | |
| |||
383 | 380 | | |
384 | 381 | | |
385 | 382 | | |
386 | | - | |
387 | 383 | | |
388 | 384 | | |
389 | 385 | | |
| |||
Lines changed: 9 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | | - | |
| 30 | + | |
32 | 31 | | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | 119 | | |
121 | 120 | | |
122 | 121 | | |
| |||
127 | 126 | | |
128 | 127 | | |
129 | 128 | | |
130 | | - | |
| 129 | + | |
131 | 130 | | |
132 | 131 | | |
133 | 132 | | |
| |||
173 | 172 | | |
174 | 173 | | |
175 | 174 | | |
176 | | - | |
177 | 175 | | |
178 | 176 | | |
179 | 177 | | |
| |||
190 | 188 | | |
191 | 189 | | |
192 | 190 | | |
193 | | - | |
194 | 191 | | |
195 | 192 | | |
196 | 193 | | |
| |||
217 | 214 | | |
218 | 215 | | |
219 | 216 | | |
220 | | - | |
221 | 217 | | |
222 | 218 | | |
223 | 219 | | |
| |||
253 | 249 | | |
254 | 250 | | |
255 | 251 | | |
256 | | - | |
257 | 252 | | |
258 | 253 | | |
259 | 254 | | |
260 | 255 | | |
261 | 256 | | |
262 | | - | |
| 257 | + | |
263 | 258 | | |
264 | 259 | | |
265 | 260 | | |
| |||
367 | 362 | | |
368 | 363 | | |
369 | 364 | | |
370 | | - | |
| 365 | + | |
371 | 366 | | |
372 | 367 | | |
373 | 368 | | |
| |||
386 | 381 | | |
387 | 382 | | |
388 | 383 | | |
389 | | - | |
| 384 | + | |
390 | 385 | | |
391 | 386 | | |
392 | 387 | | |
| |||
465 | 460 | | |
466 | 461 | | |
467 | 462 | | |
468 | | - | |
469 | 463 | | |
470 | 464 | | |
471 | 465 | | |
472 | 466 | | |
473 | 467 | | |
474 | 468 | | |
475 | 469 | | |
| 470 | + | |
| 471 | + | |
476 | 472 | | |
477 | 473 | | |
478 | 474 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2529 | 2529 | | |
2530 | 2530 | | |
2531 | 2531 | | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
| 2561 | + | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
2532 | 2569 | | |
2533 | 2570 | | |
2534 | 2571 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
763 | 763 | | |
764 | 764 | | |
765 | 765 | | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
766 | 774 | | |
767 | 775 | | |
768 | 776 | | |
| |||
776 | 784 | | |
777 | 785 | | |
778 | 786 | | |
779 | | - | |
| 787 | + | |
780 | 788 | | |
781 | 789 | | |
782 | 790 | | |
| |||
Lines changed: 127 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
| |||
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| 21 | + | |
17 | 22 | | |
18 | 23 | | |
19 | 24 | | |
| |||
217 | 222 | | |
218 | 223 | | |
219 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
220 | 230 | | |
221 | 231 | | |
222 | 232 | | |
| |||
517 | 527 | | |
518 | 528 | | |
519 | 529 | | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 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 | + | |
520 | 646 | | |
0 commit comments