fix(ramps): show login-with-email action in unified buy v2 BasicInfo#31580
fix(ramps): show login-with-email action in unified buy v2 BasicInfo#31580amitabh94 wants to merge 9 commits into
Conversation
Unified buy v2 receives TransakApiError objects from ramps-controller, so error code 2020 was never detected and the logout CTA stayed hidden. Parse both controller and legacy Axios error shapes and preserve quote params when routing back to Enter Email after logout. Co-authored-by: Cursor <cursoragent@cursor.com>
|
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. |
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
|
Tracks TRAM-3654 — Unified Buy v2: show login-with-email action for Transak phone-already-registered error. |
|
Coordination
|
Wire @metamask-previews/ramps-controller@14.2.0-preview-69b6829ad and use isTransakPhoneRegisteredError/getTransakApiMessage from core #9135 instead of the local parseTransakApiError helper. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Pushed preview wiring: |
Use @metamask-previews/ramps-controller@14.2.0-preview-b92250061 directly in dependencies instead of previewBuilds so yarn install --immutable resolves correctly in CI. Co-authored-by: Cursor <cursoragent@cursor.com>
…etaMask#9135) ## Explanation Unified Buy v2 (and other `@metamask/ramps-controller` consumers) need to detect specific Transak API failures from `TransakApiError` — for example error code `2020` when a phone number is already registered to a different email. Today, mobile duplicated string literals and ad-hoc `instanceof` / Axios-shaped parsing because ramps-controller only exported `TransakApiError` itself, not reusable helpers or known codes. This PR adds shared Transak error codes and small type guards/helpers so consumers can branch on `errorCode` and read `apiMessage` consistently: - `TRANSAK_ERROR_CODES` (`ORDER_EXISTS: '4005'`, `PHONE_ALREADY_REGISTERED: '2020'`) and `TransakErrorCode` - `isTransakApiError`, `getTransakErrorCode`, `getTransakApiMessage`, `isTransakErrorCode`, `isTransakPhoneRegisteredError` `TransakService` now uses `TRANSAK_ERROR_CODES.ORDER_EXISTS` instead of a private `'4005'` constant so order-exists retry logic and public exports stay aligned. No breaking changes. Changelog updated under `@metamask/ramps-controller` Unreleased. ## References - [TRAM-3654](https://consensyssoftware.atlassian.net/browse/TRAM-3654) — Unified Buy v2: show login-with-email action for Transak phone-already-registered error - Mobile consumer: [MetaMask/metamask-mobile#31580](MetaMask/metamask-mobile#31580) — depends on this release before dropping local error parsing ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them _(N/A — additive exports only)_ [TRAM-3654]: https://consensyssoftware.atlassian.net/browse/TRAM-3654?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --------- Co-authored-by: Cursor <cursoragent@cursor.com>
Replace preview pin now that core #9135 shipped in @metamask/ramps-controller@14.3.0. Co-authored-by: Cursor <cursoragent@cursor.com>
Collapse transaction-pay-controller's stale ^14.1.1 resolution so the tree uses a single @metamask/ramps-controller@14.3.0 instance. Co-authored-by: Cursor <cursoragent@cursor.com>
Align transitive ^28.1.x resolutions with ramps-controller@14.3.0's ^28.2.0 requirement so the tree uses a single profile-sync-controller instance. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@copilot resolve the merge conflicts in this pull request |
Head branch was pushed to by a user without write access
Resolved. The conflicts were in
All 26 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #31580 +/- ##
=======================================
Coverage 83.27% 83.27%
=======================================
Files 5842 5843 +1
Lines 153510 153510
Branches 36220 36220
=======================================
+ Hits 127829 127832 +3
+ Misses 16916 16909 -7
- Partials 8765 8769 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|



Description
Unified Buy v2 (
NativeFlow/BasicInfo) submits personal details via@metamask/ramps-controller, which throwsTransakApiErrorwith top-levelerrorCodeandapiMessage. The screen was still checking a legacy Axios response shape, so Transak error code2020(phone already registered) was never detected and the Log in with email logout CTA stayed hidden.This PR:
isTransakPhoneRegisteredErrorand reads the user-facing message viagetTransakApiMessagefrom@metamask/ramps-controller(MetaMask/core#9135).@metamask/ramps-controllerto^14.3.0(core chore: Update dependabot.yml to use new team label #9135 shipped in 14.3.0).Deposit v1 already handled
2020via the legacy SDK/Axios path (#22183); this aligns UB2 with the controller error model.Changelog
CHANGELOG entry: null
Related issues
Fixes: TRAM-3654
Manual testing steps
Unit tests:
yarn jest app/components/UI/Ramp/Views/NativeFlow/BasicInfo.test.tsxRC QA: TestFlight build 5530 from
fix/ub2-transak-phone-registered-logout(RC workflow run 27652822118).Screenshots/Recordings
N/A — pending QA on RC TestFlight build 5530. Will attach before/after recordings once verified.
Before
ScreenRecording_06-15-2026.15-54-19_1.MP4
N/A
After
ScreenRecording_06-18-2026.14-10-51_1.MP4
N/A
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
Changes buy-flow error handling and post-logout navigation in ramps KYC; scoped to one screen but affects recovery when phone conflicts with another Transak account.
Overview
Unified Buy v2 BasicInfo now treats Transak failures from
@metamask/ramps-controllercorrectly instead of reading a legacy Axiosresponse.data.errorshape. Phone already registered (error2020) is detected withisTransakPhoneRegisteredError, and copy comes fromgetTransakApiMessage, so the Log in with email banner action can appear when the phone is tied to another account.After logout, navigation always goes through
createV2EnterEmailNavDetailswith quote fields (amount,currency,assetId, optionalheadlessSessionId) so users can re-auth and continue the buy.@metamask/ramps-controlleris bumped to ^14.3.0; unit tests useTransakApiErrorand assert the logout button and post-logout navigation.Reviewed by Cursor Bugbot for commit 8c57e51. Bugbot is set up for automated code reviews on this repo. Configure here.