feat(ramp): surface headless buy errors as data (Phase 7)#29612
Draft
saustrie-consensys wants to merge 1 commit intopoc/headless-buy-phase-6from
Draft
feat(ramp): surface headless buy errors as data (Phase 7)#29612saustrie-consensys wants to merge 1 commit intopoc/headless-buy-phase-6from
saustrie-consensys wants to merge 1 commit intopoc/headless-buy-phase-6from
Conversation
Contributor
|
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. |
Contributor
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - draft PR All E2E tests pre-selected. |
|
Contributor
|
✅ E2E Fixture Validation — Schema is up to date |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
This PR closes Phase 7 of the incremental Unified Buy (v2) headless buy plan (
app/components/UI/Ramp/headless/PLAN.md): headless consumers now receive structuredHeadlessBuyErrordata for hard failures instead of depending on Ramp UI surfaces like banners, ErrorViews, or order toasts.Reason
onOrderCreatedand bypassed the order-details redirect on success, but several failure paths were still UI-coupled. Limit failures could be wrapped into generic display errors, Checkout/WebView failures rendered local UI, and one Transak success path could still show a toast before a headless consumer regained control.What changed
HeadlessBuyErrorCode+failSession— centralizes error normalization insessionRegistry, preserving explicit error codes/details and closing the session with failed terminal semantics afteronErrorfires.HeadlessHost— usesfailSessionfor auth errors, malformed asset ids, andcontinueWithQuoterejections so the consumer receives one structuredonErrorcallback and one terminal close.useTransakRouting— preservesLimitExceededErrorasLIMIT_EXCEEDED, forwards checkout-processing failures throughonError, and suppresses the manual-bank-transfer toast path when a live headless session owns the flow.Checkout— routes callback-processing failures and primary WebView HTTP errors throughonErrorfor headless sessions, then unwinds the ramp stack instead of rendering the checkout ErrorView.BuildQuote— keeps legacy headless params from falling back to banner-only error handling if they are encountered.PLAN.md— marks Phase 7 complete.References
poc/headless-buy-phase-6). This PR's base ispoc/headless-buy-phase-6so the diff is Phase 7-only.Tests
yarn eslint app/components/UI/Ramp/headless/types.ts app/components/UI/Ramp/headless/sessionRegistry.ts app/components/UI/Ramp/headless/sessionRegistry.test.ts app/components/UI/Ramp/Views/HeadlessHost/HeadlessHost.tsx app/components/UI/Ramp/Views/HeadlessHost/HeadlessHost.test.tsx app/components/UI/Ramp/hooks/useTransakRouting.ts app/components/UI/Ramp/hooks/useTransakRouting.test.ts app/components/UI/Ramp/Views/Checkout/Checkout.tsx app/components/UI/Ramp/Views/Checkout/Checkout.test.tsx app/components/UI/Ramp/Views/BuildQuote/BuildQuote.tsxyarn jest --watchman=false app/components/UI/Ramp/headless/sessionRegistry.test.ts app/components/UI/Ramp/Views/HeadlessHost/HeadlessHost.test.tsx app/components/UI/Ramp/hooks/useTransakRouting.test.ts app/components/UI/Ramp/Views/Checkout/Checkout.test.tsx app/components/UI/Ramp/Views/BuildQuote/BuildQuote.test.tsxyarn lint:tscwas attempted, but the local run is blocked by unrelated existing type errors in SocialLeaderboard tests and controller messenger types.Changelog
CHANGELOG entry: null
Related issues
Fixes: No GitHub issue — incremental POC on branch
saustrie-consensys/headless-buy-phase-7.Continuity: #29340 (Phase 6 — headless order success callback + stack unwind). #29338 (Phase 5 — Headless Host + quote-first start).
Manual testing steps
Screenshots/Recordings
Before
N/A — Phase 7 changes error/callback plumbing only.
After
N/A — no user-facing UI changes.
Pre-merge author checklist
Performance checks (if applicable)
Pre-merge reviewer checklist