You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(ramp): bypass order-processing redirect in headless flows (Phase 6)
When a headless buy session is active, the post-checkout success paths
now hand the orderId to the consumer's `onOrderCreated` callback,
close the session via `closeSession(..., { reason: 'completed' })`,
and unwind the ramp stack via `navigation.getParent()?.pop()` instead
of resetting to `RAMPS_ORDER_DETAILS`. The `showV2OrderToast` surface
is also suppressed for headless flows — the consumer drives its own
notification UI.
Two paths are wired:
- Aggregator / widget: v2 `Checkout.tsx` intercepts the widget
callback URL. When `params.headlessSessionId` resolves to a live
session, the success branch fires the callback + closes the session
+ pops the parent stack. `addOrder` and `protectWalletModalVisible`
still fire so Redux state stays consistent. Non-headless behavior
is unchanged.
- Native (Transak): `useTransakRouting.ts` extracts
`headlessSessionId` from `config.baseRouteParams` (the Host
already threads it through via Phase 4b's parameterization) and
applies the same branching in `navigateToOrderProcessingCallback`.
`handleNavigationStateChange`'s toast is suppressed when the
session is live; `addOrder` + `trackEvent` keep running so Redux
state and analytics parity are preserved.
`useContinueWithQuote.ts` threads `ctx.headlessSessionId` into
`createCheckoutNavDetails` so the v2 Checkout screen can see it.
Consumer `onOrderCreated` errors are caught and logged so a
consumer-side bug can never break the flow — the session is closed
and the stack popped regardless.
Tests: new `headless session flow` describe blocks in
`Checkout.test.tsx` (+187 lines, 5 cases) and
`useTransakRouting.test.ts` (+219 lines, 4 cases) cover the live
session, missing-session fallback, consumer error swallow, and the
absent-headlessSessionId path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: app/components/UI/Ramp/headless/PLAN.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@
13
13
-[x]**Phase 4c** — Make `useContinueWithQuote` headless-ready — extend `ContinueWithQuoteContext` with optional overrides so callers without controller state (the Host) can drive it from a `Quote`
14
14
-[x]**Phase 5 (revised)** — Quote-first headless start path — `startHeadlessBuy({ quote, redirectUrl? })` creates a session carrying the quote, navigates to Headless Host, Host calls `continueWithQuote(quote, ctx)` and re-orchestrates after auth loops
15
15
-[ ]**Phase 5b (deferred)** — `startHeadlessBuy({ assetId, amount, paymentMethodId, providerId? })` "open BuildQuote / Host fetches quotes" mode — picked up after the quote-first path is stable
16
-
-[]**Phase 6** — Bypass order-processing redirect in Transak/aggregator routing when headless; fire `onOrderCreated` and end session
16
+
-[x]**Phase 6** — Bypass order-processing redirect in Transak/aggregator routing when headless; fire `onOrderCreated` and end session
17
17
-[ ]**Phase 7** — Extract UI-coupled error/limit surfacing; route errors through `onError` as typed `HeadlessBuyError`
0 commit comments