Commit 50806e6
committed
feat(ramp): add Headless Host + quote-first startHeadlessBuy (Phase 5)
Introduces the Headless Host screen as the stable stack base for the
Unified Buy v2 headless flow and switches `startHeadlessBuy` to a
quote-first signature so external consumers drive the flow without
seeding the RampsController.
- New `Routes.RAMP.HEADLESS_HOST` registered inside the Unified Buy v2
inner stack (`TokenListRoutes`) so `useTransakRouting` resets land on
the Host instead of BuildQuote.
- `useHeadlessBuy.startHeadlessBuy({ quote, ... })` derives the
`ContinueWithQuoteContext` from the supplied quote, creates a session
in the registry, and navigates into the v2 stack via the proper
nested-screen descriptor (TOKEN_SELECTION → MainRoutes → HEADLESS_HOST).
- Single-active-session policy: starting a new session
auto-`closeSession`s the previous one with `consumer_cancelled`.
- `HeadlessHost` orchestrates: on focus it picks up the session, calls
`continueWithQuote` exactly once (guarded by `hasContinuedRef` +
`session.status` so the OTP/auth loop's re-focuses don't re-trigger),
and surfaces `nativeFlowError` from `OtpCode` as
`onError({ code: 'AUTH_FAILED' })`.
- Native flow screens (`EnterEmail`, `OtpCode`, `VerifyIdentity`) now
thread `headlessSessionId` so `useTransakRouting` can be parameterized
with `baseRoute = HEADLESS_HOST`.
- Playground UI: per-quote "Start headless buy" buttons (standalone
start button removed); tapping replaces any active session.
- BuildQuote `headlessSessionId` param marked `@deprecated` — the
headless flow no longer routes through BuildQuote.
Tests: 64 passing across `useHeadlessBuy`, `useContinueWithQuote`,
`useTransakRouting`, `HeadlessHost`, and `HeadlessPlayground`.1 parent eec13f3 commit 50806e6
23 files changed
Lines changed: 1650 additions & 319 deletions
File tree
- app
- components/UI/Ramp
- Views
- BuildQuote
- HeadlessHost
- HeadlessPlayground
- NativeFlow
- headless
- hooks
- locales/languages
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
105 | 105 | | |
106 | | - | |
107 | | - | |
| 106 | + | |
108 | 107 | | |
109 | 108 | | |
110 | 109 | | |
| |||
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
0 commit comments