@stridge/kit 0.1.0-alpha.60 → 0.1.0-alpha.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/dist/KitProvider.d.ts +0 -21
  2. package/dist/KitProvider.js +1 -1
  3. package/dist/_internal/deposit/driver/index.d.ts +3 -3
  4. package/dist/_internal/drivers/stridge-mock/index.d.ts +3 -2
  5. package/dist/_internal/drivers/stridge-mock/index.js +1 -1
  6. package/dist/activity/compound/index.js +1 -1
  7. package/dist/deposit/compound/index.d.ts +13 -10
  8. package/dist/deposit/compound/index.js +1 -1
  9. package/dist/deposit/widgets/index.d.ts +4 -3
  10. package/dist/deposit/widgets/index.js +1 -1
  11. package/dist/drivers/stridge/createStridgeDepositDriver.js +1 -1
  12. package/dist/drivers/stridge-mock/checkoutChannel.d.ts +31 -0
  13. package/dist/drivers/stridge-mock/checkoutChannel.js +1 -0
  14. package/dist/drivers/stridge-mock/createStridgeMockDriver.d.ts +28 -0
  15. package/dist/drivers/stridge-mock/createStridgeMockDriver.js +1 -1
  16. package/dist/drivers/stridge-mock/fixtures.d.ts +6 -2
  17. package/dist/drivers/stridge-mock/fixtures.js +1 -1
  18. package/dist/drivers/stridge-mock/triggers.d.ts +12 -0
  19. package/dist/events/emit/useDepositEmissions.js +1 -1
  20. package/dist/flows/deposit/dialog/DepositDialog.js +1 -1
  21. package/dist/flows/deposit/driver/payloads.d.ts +77 -20
  22. package/dist/flows/deposit/driver/types.d.ts +64 -10
  23. package/dist/flows/deposit/orchestrator/controller.js +1 -1
  24. package/dist/flows/deposit/orchestrator/index.d.ts +1 -1
  25. package/dist/flows/deposit/orchestrator/reducer.js +1 -1
  26. package/dist/flows/deposit/orchestrator/types.d.ts +102 -59
  27. package/dist/flows/deposit/shared/checkoutPopup.js +1 -0
  28. package/dist/flows/deposit/shared/onramp.js +1 -0
  29. package/dist/flows/deposit/widgets/amount-entry/AmountEntry.js +1 -1
  30. package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
  31. package/dist/flows/deposit/widgets/deposit/compound/Deposit.d.ts +5 -5
  32. package/dist/flows/deposit/widgets/deposit/compound/components/Guards.js +1 -1
  33. package/dist/flows/deposit/widgets/deposit/compound/components/Methods.d.ts +1 -2
  34. package/dist/flows/deposit/widgets/deposit/compound/components/RailPicker.js +1 -1
  35. package/dist/flows/deposit/widgets/deposit/compound/types.d.ts +9 -9
  36. package/dist/flows/deposit/widgets/error-state/ErrorState.js +1 -1
  37. package/dist/flows/deposit/widgets/onramp-amount-entry/OnrampAmountEntry.d.ts +64 -0
  38. package/dist/flows/deposit/widgets/onramp-amount-entry/OnrampAmountEntry.js +1 -0
  39. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.d.ts +62 -0
  40. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.js +1 -0
  41. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.slots.d.ts +14 -0
  42. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.slots.js +1 -0
  43. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.styles.js +1 -0
  44. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/HeroLabel.d.ts +13 -0
  45. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/HeroLabel.js +1 -0
  46. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/ReceiveChip.d.ts +14 -0
  47. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/ReceiveChip.js +1 -0
  48. package/dist/flows/deposit/widgets/{cash-amount-entry → onramp-amount-entry}/compound/context.js +1 -1
  49. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/index.d.ts +3 -0
  50. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/index.js +1 -0
  51. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/types.d.ts +29 -0
  52. package/dist/flows/deposit/widgets/onramp-amount-entry/index.d.ts +1 -0
  53. package/dist/flows/deposit/widgets/onramp-amount-entry/index.js +1 -0
  54. package/dist/flows/deposit/widgets/onramp-confirm/OnrampConfirm.d.ts +50 -0
  55. package/dist/flows/deposit/widgets/onramp-confirm/OnrampConfirm.js +1 -0
  56. package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.d.ts +42 -0
  57. package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.js +1 -0
  58. package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.slots.d.ts +24 -0
  59. package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.slots.js +1 -0
  60. package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.styles.js +1 -0
  61. package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Body.d.ts +16 -0
  62. package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Body.js +1 -0
  63. package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Header.d.ts +15 -0
  64. package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Header.js +1 -0
  65. package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Summary.d.ts +15 -0
  66. package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Summary.js +1 -0
  67. package/dist/flows/deposit/widgets/onramp-confirm/compound/context.d.ts +25 -0
  68. package/dist/flows/deposit/widgets/{cash-confirm → onramp-confirm}/compound/context.js +1 -1
  69. package/dist/flows/deposit/widgets/onramp-confirm/compound/index.d.ts +4 -0
  70. package/dist/flows/deposit/widgets/onramp-confirm/compound/index.js +1 -0
  71. package/dist/flows/deposit/widgets/onramp-confirm/compound/types.d.ts +62 -0
  72. package/dist/flows/deposit/widgets/onramp-confirm/index.d.ts +1 -0
  73. package/dist/flows/deposit/widgets/onramp-confirm/index.js +1 -0
  74. package/dist/flows/deposit/widgets/onramp-payment-pending/OnrampPaymentPending.d.ts +48 -0
  75. package/dist/flows/deposit/widgets/onramp-payment-pending/OnrampPaymentPending.js +1 -0
  76. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.d.ts +63 -0
  77. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.js +1 -0
  78. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.slots.d.ts +14 -0
  79. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.slots.js +1 -0
  80. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/components/ReopenButton.d.ts +11 -0
  81. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/components/ReopenButton.js +1 -0
  82. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/context.js +1 -0
  83. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/index.d.ts +2 -0
  84. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/index.js +1 -0
  85. package/dist/flows/deposit/widgets/onramp-payment-pending/index.d.ts +1 -0
  86. package/dist/flows/deposit/widgets/onramp-payment-pending/index.js +1 -0
  87. package/dist/flows/deposit/widgets/success-state/SuccessState.js +1 -1
  88. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.js +1 -1
  89. package/dist/i18n/locales/ar.js +1 -1
  90. package/dist/i18n/locales/es.js +1 -1
  91. package/dist/i18n/locales/source-keys.d.ts +1 -1
  92. package/dist/icons/index.d.ts +1 -8
  93. package/dist/icons/index.js +1 -1
  94. package/dist/index.d.ts +3 -4
  95. package/dist/index.js +1 -1
  96. package/dist/package.js +1 -1
  97. package/dist/shared/icons/BitcoinIcon.d.ts +5 -8
  98. package/dist/shared/icons/BitcoinIcon.js +1 -1
  99. package/dist/shared/icons/CardIcon.d.ts +3 -3
  100. package/dist/shared/orchestrator/index.js +1 -1
  101. package/dist/shared/orchestrator/useOnrampSessionWatcher.js +1 -0
  102. package/dist/shared/ui/Tabs/Tabs.d.ts +2 -2
  103. package/dist/shared/widgets/activity/compound/ActivityDetail.js +1 -1
  104. package/dist/shared/widgets/amount-entry/compound/AmountEntry.js +1 -1
  105. package/dist/shared/widgets/amount-entry/compound/components/Footer.js +1 -1
  106. package/dist/shared/widgets/amount-entry/compound/types.d.ts +6 -0
  107. package/dist/stridge/StridgeProvider.d.ts +0 -10
  108. package/dist/stridge/StridgeProvider.js +1 -1
  109. package/dist/stridge/stubs.js +1 -1
  110. package/dist/styles/index.css +4 -44
  111. package/dist/types.d.ts +3 -3
  112. package/dist/version.js +1 -1
  113. package/dist/withdraw/compound/index.js +1 -1
  114. package/package.json +1 -1
  115. package/dist/flows/deposit/bindings/DepositBindings.d.ts +0 -87
  116. package/dist/flows/deposit/bindings/DepositBindings.js +0 -1
  117. package/dist/flows/deposit/bindings/index.d.ts +0 -1
  118. package/dist/flows/deposit/bindings/index.js +0 -1
  119. package/dist/flows/deposit/shared/cash.d.ts +0 -20
  120. package/dist/flows/deposit/shared/cash.js +0 -1
  121. package/dist/flows/deposit/widgets/cash-amount-entry/CashAmountEntry.d.ts +0 -71
  122. package/dist/flows/deposit/widgets/cash-amount-entry/CashAmountEntry.js +0 -1
  123. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.d.ts +0 -69
  124. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.js +0 -1
  125. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.slots.d.ts +0 -16
  126. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.slots.js +0 -1
  127. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.styles.js +0 -1
  128. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/HeroLabel.d.ts +0 -13
  129. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/HeroLabel.js +0 -1
  130. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/MethodChip.d.ts +0 -18
  131. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/MethodChip.js +0 -1
  132. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/ReceiveChip.d.ts +0 -14
  133. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/ReceiveChip.js +0 -1
  134. package/dist/flows/deposit/widgets/cash-amount-entry/compound/index.d.ts +0 -3
  135. package/dist/flows/deposit/widgets/cash-amount-entry/compound/index.js +0 -1
  136. package/dist/flows/deposit/widgets/cash-amount-entry/compound/types.d.ts +0 -42
  137. package/dist/flows/deposit/widgets/cash-amount-entry/index.d.ts +0 -1
  138. package/dist/flows/deposit/widgets/cash-amount-entry/index.js +0 -1
  139. package/dist/flows/deposit/widgets/cash-confirm/CashConfirm.d.ts +0 -63
  140. package/dist/flows/deposit/widgets/cash-confirm/CashConfirm.js +0 -1
  141. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.d.ts +0 -54
  142. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.js +0 -1
  143. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.slots.d.ts +0 -33
  144. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.slots.js +0 -1
  145. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.styles.js +0 -1
  146. package/dist/flows/deposit/widgets/cash-confirm/compound/cashConfirmDimensions.js +0 -1
  147. package/dist/flows/deposit/widgets/cash-confirm/compound/components/ApplePayBody.d.ts +0 -15
  148. package/dist/flows/deposit/widgets/cash-confirm/compound/components/ApplePayBody.js +0 -1
  149. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Body.d.ts +0 -22
  150. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Body.js +0 -1
  151. package/dist/flows/deposit/widgets/cash-confirm/compound/components/BodyLabel.js +0 -1
  152. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardBody.d.ts +0 -16
  153. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardBody.js +0 -1
  154. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.icons.js +0 -1
  155. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.js +0 -1
  156. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.keys.js +0 -1
  157. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.state.js +0 -1
  158. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.styles.js +0 -1
  159. package/dist/flows/deposit/widgets/cash-confirm/compound/components/GooglePayBody.d.ts +0 -16
  160. package/dist/flows/deposit/widgets/cash-confirm/compound/components/GooglePayBody.js +0 -1
  161. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Header.d.ts +0 -21
  162. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Header.js +0 -1
  163. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Summary.d.ts +0 -17
  164. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Summary.js +0 -1
  165. package/dist/flows/deposit/widgets/cash-confirm/compound/components/cardFormat.js +0 -1
  166. package/dist/flows/deposit/widgets/cash-confirm/compound/index.d.ts +0 -3
  167. package/dist/flows/deposit/widgets/cash-confirm/compound/index.js +0 -1
  168. package/dist/flows/deposit/widgets/cash-confirm/compound/types.d.ts +0 -66
  169. package/dist/flows/deposit/widgets/cash-confirm/index.d.ts +0 -1
  170. package/dist/flows/deposit/widgets/cash-confirm/index.js +0 -1
  171. package/dist/flows/deposit/widgets/cash-confirm/mocks.js +0 -1
  172. package/dist/shared/icons/AmexIcon.d.ts +0 -14
  173. package/dist/shared/icons/AmexIcon.js +0 -1
  174. package/dist/shared/icons/ApplePayIcon.d.ts +0 -15
  175. package/dist/shared/icons/ApplePayIcon.js +0 -1
  176. package/dist/shared/icons/CashIcon.d.ts +0 -16
  177. package/dist/shared/icons/CashIcon.js +0 -1
  178. package/dist/shared/icons/DiscoverIcon.d.ts +0 -14
  179. package/dist/shared/icons/DiscoverIcon.js +0 -1
  180. package/dist/shared/icons/GooglePayIcon.d.ts +0 -15
  181. package/dist/shared/icons/GooglePayIcon.js +0 -1
  182. package/dist/shared/icons/MastercardIcon.d.ts +0 -16
  183. package/dist/shared/icons/MastercardIcon.js +0 -1
  184. package/dist/shared/icons/VisaIcon.d.ts +0 -15
  185. package/dist/shared/icons/VisaIcon.js +0 -1
@@ -7,15 +7,7 @@ import { FailureInfo } from "../../../shared/orchestrator/types.js";
7
7
  * (asset → amount → confirm → process), `transfer` enters Path B
8
8
  * (transfer-crypto → process).
9
9
  */
10
- type DepositMethod = "wallet" | "transfer";
11
- /**
12
- * Cash-rail method id. Mirrors the keys on `CashMethodsPayload` (`card` / `applePay` / `googlePay`)
13
- * so the picker tile, the chosen-method chip, and the FSM ctx all share one vocabulary. Routed
14
- * through its own `CASH_METHOD_SELECTED` reducer event (separate from `DEPOSIT_METHOD_SELECTED`)
15
- * because the cash rail lands in a method-specific amount-entry surface today and per-method
16
- * confirm forms tomorrow.
17
- */
18
- type CashMethodId = "card" | "applePay" | "googlePay";
10
+ type DepositMethod = "wallet" | "transfer" | "onramp";
19
11
  /**
20
12
  * Host-supplied disable lever for a single payment method on the deposit-method picker. The host
21
13
  * decides eligibility — the kit ships no per-host inference (embedded vs. external wallet,
@@ -47,9 +39,9 @@ interface DepositMethodConfig {
47
39
  */
48
40
  interface DepositRailConfig {
49
41
  /**
50
- * Opt-IN gate for the rail. The cash rail is hidden by default — hosts that want
51
- * the `Use Cash` tab in their picker must set `enabled: true` and have a driver that
52
- * surfaces the matching entity (e.g. `cashMethods`). Crypto-only integrators upgrade
42
+ * Opt-IN gate for the rail. The onramp rail is hidden by default — hosts that want
43
+ * the "Cash" tab in their picker must set `enabled: true` and have a driver that
44
+ * surfaces the matching entity (e.g. `onrampMethods`). Crypto-only integrators upgrade
53
45
  * transparently because the default is `enabled !== true`. Set explicitly to `false`
54
46
  * is equivalent to leaving it unset.
55
47
  */
@@ -65,22 +57,13 @@ interface DepositRailConfig {
65
57
  /**
66
58
  * Per-method host configuration for the deposit picker. Omitting a method (or the whole object)
67
59
  * keeps default behavior; supply `{ disabled: true, disabledHint: "…" }` to mark an option as
68
- * unavailable for the current user. `cashRail` is a rail-level toggle — see
60
+ * unavailable for the current user. `onrampRail` is a rail-level toggle — see
69
61
  * {@link DepositRailConfig}.
70
- *
71
- * Cash-method keys (`card`, `applePay`, `googlePay`) are additive flat keys that mirror the
72
- * crypto methods' shape so existing integrators upgrade without touching their config. A future
73
- * version may restructure to nested-by-rail (`{ crypto: { wallet, transfer }, cash: { … } }`);
74
- * that restructure is a breaking-change PR and is intentionally deferred until cash methods
75
- * stabilize.
76
62
  */
77
63
  interface DepositMethodsConfig {
78
64
  wallet?: DepositMethodConfig;
79
65
  transfer?: DepositMethodConfig;
80
- card?: DepositMethodConfig;
81
- applePay?: DepositMethodConfig;
82
- googlePay?: DepositMethodConfig;
83
- cashRail?: DepositRailConfig;
66
+ onrampRail?: DepositRailConfig;
84
67
  }
85
68
  /**
86
69
  * Confirm-deposit phase sub-union. Drives the confirm-deposit widget's hero / footer chrome.
@@ -102,15 +85,21 @@ type ConfirmDepositPhase = {
102
85
  recoverFrom: "quote" | "submission";
103
86
  };
104
87
  /**
105
- * Cash-confirm phase sub-union. Drives the per-method cash confirm widget's body slot — `loading`
106
- * paints the skeleton placeholder, `ready` renders the filled card form / QR / pay button. Phase
107
- * is pure navigation; the actual card data / QR payload / pay button content lives in the widget's
108
- * mocks today and will surface through a future `cashConfirm` driver entity.
88
+ * Onramp-confirm phase sub-union. Drives the onramp confirm widget's CTA chrome — `loading` paints
89
+ * the quote skeleton while `requestOnrampQuote` resolves, `ready` renders the priced summary + the
90
+ * "Continue to payment" CTA, `creating` shows the spinner while `createOnrampSession` runs and the
91
+ * checkout tab opens, and `failed` surfaces an inline retry. Phase is pure navigation; the quote
92
+ * payload comes from the driver's `onrampQuote` entity.
109
93
  */
110
- type CashConfirmPhase = {
94
+ type OnrampConfirmPhase = {
111
95
  kind: "loading";
112
96
  } | {
113
97
  kind: "ready";
98
+ } | {
99
+ kind: "creating";
100
+ } | {
101
+ kind: "failed";
102
+ failure: FailureInfo;
114
103
  };
115
104
  /**
116
105
  * Where `ERROR_TRY_AGAIN` lands. Encoded once at error-entry time so retry is deterministic.
@@ -123,6 +112,12 @@ type RetryTargetSpec = {
123
112
  } | {
124
113
  kind: "transferCrypto";
125
114
  backTarget: "closed" | "deposit";
115
+ } | {
116
+ /**
117
+ * Onramp ("Cash") retry — `ERROR_TRY_AGAIN` routes the user back to
118
+ * `onrampAmountEntry` so they can re-enter an amount and create a fresh checkout session.
119
+ */
120
+ kind: "onrampAmountEntry";
126
121
  } | {
127
122
  /**
128
123
  * No re-runnable target — used when `ERROR_TRY_AGAIN` should route the user back to the
@@ -187,26 +182,33 @@ type DepositState = {
187
182
  backTarget: "closed" | "assetPicker";
188
183
  };
189
184
  } | {
190
- name: "cashAmountEntry";
185
+ name: "onrampAmountEntry";
191
186
  ctx: {
192
- method: "cash";
193
- cashMethod: CashMethodId;
187
+ method: "onramp";
194
188
  backTarget: "closed" | "deposit";
195
189
  /**
196
- * Optional initial amount, restored when the user backs out of `cashConfirm` so the
190
+ * Optional initial amount, restored when the user backs out of `onrampConfirm` so the
197
191
  * fiat band keeps the value they entered before continuing. Absent on first entry
198
192
  * (the widget falls back to the first preset).
199
193
  */
200
194
  amount?: number;
201
195
  };
202
196
  } | {
203
- name: "cashConfirm";
197
+ name: "onrampConfirm";
204
198
  ctx: {
205
- method: "cash";
206
- cashMethod: CashMethodId;
199
+ method: "onramp";
207
200
  amount: number;
208
- phase: CashConfirmPhase;
209
- backTarget: "cashAmountEntry";
201
+ phase: OnrampConfirmPhase;
202
+ backTarget: "onrampAmountEntry";
203
+ };
204
+ } | {
205
+ name: "onrampPaymentPending";
206
+ ctx: {
207
+ method: "onramp";
208
+ amount: number;
209
+ sessionId: string;
210
+ checkoutUrl: string;
211
+ backTarget: "onrampConfirm";
210
212
  };
211
213
  } | {
212
214
  name: "confirmDeposit";
@@ -234,7 +236,13 @@ type DepositState = {
234
236
  name: "success";
235
237
  ctx: {
236
238
  method: DepositMethod;
237
- tx: TxRef;
239
+ /**
240
+ * Source-chain broadcast tx for crypto deposits. Optional because the onramp branch
241
+ * has no on-chain tx of its own at terminal time — it reads the completed
242
+ * `onrampSession` entity instead and carries {@link sessionId}.
243
+ */
244
+ tx?: TxRef; /** Onramp checkout session id — set only when `method === "onramp"`. */
245
+ sessionId?: string;
238
246
  };
239
247
  } | {
240
248
  name: "error";
@@ -242,11 +250,13 @@ type DepositState = {
242
250
  retryTarget: RetryTargetSpec;
243
251
  /**
244
252
  * Set for non-settlement failures (quote / submission rejections that escalate via
245
- * the orchestrated `error` arm). Settlement failures leave this `undefined` — the
246
- * widget renders from the driver's `settlement` entity (`kind: "failed"`) instead.
253
+ * the orchestrated `error` arm, and onramp session failures). Crypto settlement
254
+ * failures leave this `undefined` — the widget renders from the driver's `settlement`
255
+ * entity (`kind: "failed"`) instead.
247
256
  */
248
257
  failure?: FailureInfo; /** Source-chain tx hash when the error followed a successful broadcast. */
249
- tx?: TxRef;
258
+ tx?: TxRef; /** Onramp checkout session id — set only when the failure came from the onramp rail. */
259
+ sessionId?: string;
250
260
  };
251
261
  } | {
252
262
  /**
@@ -301,13 +311,39 @@ type GatewayEvent = {
301
311
  type: "DEPOSIT_METHOD_SELECTED";
302
312
  method: DepositMethod;
303
313
  } | {
304
- type: "CASH_METHOD_SELECTED";
305
- cashMethod: CashMethodId;
314
+ type: "ONRAMP_SELECTED";
315
+ } | {
316
+ /**
317
+ * Live fiat amount the user is typing on `onrampAmountEntry`, mirrored into `ctx.amount`
318
+ * so the controller's debounced quote effect can fetch a fresh `onrampQuote` for the
319
+ * on-screen breakdown. `null` while the field is empty (no quote fires). Distinct from
320
+ * {@link GatewayEvent} `ONRAMP_AMOUNT_CONFIRMED`, which commits the amount and advances
321
+ * the FSM to `onrampConfirm`.
322
+ */
323
+ type: "ONRAMP_AMOUNT_CHANGED";
324
+ amount: number | null;
306
325
  } | {
307
- type: "CASH_AMOUNT_CONFIRMED";
326
+ type: "ONRAMP_AMOUNT_CONFIRMED";
308
327
  amount: number;
309
328
  } | {
310
- type: "CASH_METHOD_READY";
329
+ type: "ONRAMP_QUOTE_RESOLVED";
330
+ } | {
331
+ type: "ONRAMP_QUOTE_FAILED";
332
+ failure: FailureInfo;
333
+ } | {
334
+ type: "ONRAMP_CONFIRMED";
335
+ } | {
336
+ type: "ONRAMP_SESSION_CREATED";
337
+ sessionId: string;
338
+ checkoutUrl: string;
339
+ } | {
340
+ type: "ONRAMP_SESSION_COMPLETED";
341
+ } | {
342
+ type: "ONRAMP_SESSION_EXPIRED";
343
+ failure?: FailureInfo;
344
+ } | {
345
+ type: "ONRAMP_SESSION_FAILED";
346
+ failure: FailureInfo;
311
347
  } | {
312
348
  type: "ASSET_CONFIRMED";
313
349
  asset: BalanceItemPayload;
@@ -437,24 +473,31 @@ interface DepositController {
437
473
  interface DepositActions {
438
474
  selectMethod(method: DepositMethod): void;
439
475
  /**
440
- * Promotes the FSM from `deposit` (method picker) into `cashAmountEntry` for the chosen cash
441
- * method. Distinct from {@link selectMethod} because cash methods route to a method-specific
442
- * surface today (and per-method confirm forms tomorrow), while {@link selectMethod} stays
443
- * scoped to the crypto rail's two methods.
476
+ * Promotes the FSM from `deposit` (method picker) into `onrampAmountEntry`. The onramp rail is
477
+ * single-method (the hosted-checkout provider collects the payment instrument), so this takes
478
+ * no argument selecting "Cash" goes straight to amount entry.
479
+ */
480
+ selectOnramp(): void;
481
+ /**
482
+ * Mirrors the live fiat amount the user is typing on `onrampAmountEntry` into the FSM's
483
+ * `ctx.amount`. The controller's debounced quote effect keys off that value to fetch a fresh
484
+ * `onrampQuote` for the on-screen breakdown — without this sync the amount-entry screen would
485
+ * never quote (the field's local state is invisible to the controller). Pass `null` when the
486
+ * field is cleared. No FSM transition; `onrampAmountEntry` stays current.
444
487
  */
445
- selectCashMethod(cashMethod: CashMethodId): void;
488
+ setOnrampAmount(amount: number | null): void;
446
489
  /**
447
- * Promotes the FSM from `cashAmountEntry` into `cashConfirm{loading}` carrying the entered
448
- * fiat amount. The cash-confirm widget mounts in its loading state, schedules its own
449
- * `cashMethodReady` dispatch after the mock load delay, and re-renders with the filled body.
490
+ * Promotes the FSM from `onrampAmountEntry` into `onrampConfirm{loading}` carrying the entered
491
+ * fiat amount. The controller's quote effect resolves the `onrampQuote` entity and the bridge
492
+ * flips the phase to `ready`.
450
493
  */
451
- confirmCashAmount(amount: number): void;
494
+ confirmOnrampAmount(amount: number): void;
452
495
  /**
453
- * Flips `cashConfirm{loading}` → `cashConfirm{ready}`. Dispatched by the cash-confirm widget
454
- * itself once its mock loading timer elapses. Real card-form / Apple Pay / Google Pay
455
- * lifecycles will replace this with bindings-driven signals.
496
+ * Flips `onrampConfirm{ready}` → `onrampConfirm{creating}`. The controller's session effect
497
+ * calls `createOnrampSession`, opens the hosted checkout in a new tab, and dispatches
498
+ * `ONRAMP_SESSION_CREATED` to advance to `onrampPaymentPending`.
456
499
  */
457
- cashMethodReady(): void;
500
+ confirmOnramp(): void;
458
501
  confirmAsset(asset: BalanceItemPayload): void;
459
502
  confirmAmount(amount: number): void;
460
503
  confirmDeposit(): void;
@@ -484,4 +527,4 @@ interface DepositActions {
484
527
  selectSettlement(settlementId: string): void;
485
528
  }
486
529
  //#endregion
487
- export { CashConfirmPhase, CashMethodId, ConfirmDepositPhase, DepositActions, DepositController, DepositMethod, DepositMethodConfig, DepositMethodsConfig, DepositRailConfig, DepositState, DepositStateName, GatewayEvent, OpenInput, ResolvedOpenInput, RetryTargetSpec };
530
+ export { ConfirmDepositPhase, DepositActions, DepositController, DepositMethod, DepositMethodConfig, DepositMethodsConfig, DepositRailConfig, DepositState, DepositStateName, GatewayEvent, OnrampConfirmPhase, OpenInput, ResolvedOpenInput, RetryTargetSpec };
@@ -0,0 +1 @@
1
+ function e(e){if(typeof window>`u`)return;let t;try{t=new URL(e,window.location.href)}catch{return}if(t.protocol!==`http:`&&t.protocol!==`https:`)return;let n=window.screenLeft??0,r=window.screenTop??0,i=window.outerWidth||window.innerWidth||460,a=window.outerHeight||window.innerHeight||760,o=Math.max(0,n+(i-460)/2),s=Math.max(0,r+(a-760)/2),c=`popup=yes,width=460,height=760,left=${Math.round(o)},top=${Math.round(s)},noopener,noreferrer`;window.open(e,`_blank`,c)}export{e as openCheckoutPopup};
@@ -0,0 +1 @@
1
+ const e=[{value:200,label:`$200`},{value:500,label:`$500`},{value:1e3,label:`$1k`},{value:2e3,label:`$2k`}];export{e as ONRAMP_AMOUNT_PRESETS};
@@ -1 +1 @@
1
- "use client";import{useOptionalActivityDriverInstance as e}from"../../../activity/driver/context.js";import{useKitI18n as t}from"../../../../shared/i18n/useKitI18n.js";import{Trans as n}from"../../../../shared/i18n/Trans.js";import{useLingui as r}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositSnapshot as i}from"../../driver/context.js";import{useDepositActions as a,useDepositEffectiveState as ee}from"../../orchestrator/controller.js";import{formatTokenAmount as o}from"../../../../shared/format/formatTokenAmount.js";import{useKitEmitter as s}from"../../../../events/emit/useKitEmitter.js";import"../../../../events/emit/index.js";import{DialogShell as c}from"../../../../shared/dialog/DialogShell.js";import{AmountEntry as l}from"../../../../shared/widgets/amount-entry/compound/AmountEntry.js";import"../../../../shared/widgets/amount-entry/compound/index.js";import{ActivityTrigger as u}from"../../../../shared/widgets/activity/ActivityTrigger.js";import"../../../../shared/widgets/activity/index.js";import{toAssetDescriptor as d}from"../../../../shared/widgets/asset-descriptor.js";import{effectiveMaxUsd as f,resolveFooterIntent as te}from"./footerIntent.js";import{useEffect as p,useRef as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";const y=[{value:`25`,label:`25%`},{value:`50`,label:`50%`},{value:`75`,label:`75%`},{value:`max`,label:`Max`}];function b({children:n,...c}){let b=i(),C=ee(),{confirmAmount:w,back:T,openActivity:E}=a(),D=e()!==null,{_:O}=r(),k=t(),A=b.target,j=A.status===`ready`||A.status===`stale`?A.payload:void 0,M=C.name===`amountEntry`?C.ctx.asset:void 0,N=M?.amountUsd?.value??0,P=j?.minAmountUsd?.value,F=j?.minAmountUsd?.formatted,I=j?.maxAmountUsd?.value,L=j?.maxAmountUsd?.formatted,R=f(N,I),z=M?.priceUsd,[B,V]=h(P??null),[H,U]=h(),W=s(),G=e=>{W({type:`deposit.amount.changed`,flow:`deposit`,tier:`ui`,payload:{raw:e===null?``:String(e),numeric:e}})},K=m(void 0),q=M?`${M.eip155Id??``}:${M.address??``}`:void 0;p(()=>{q&&K.current!==q&&(K.current=q,typeof P==`number`&&(V(P),U(void 0)))},[q,P]);let J=e=>{U(e);let t=e===`max`?1:Number.parseInt(e,10)/100;if(Number.isFinite(t)){let n=R*t;V(n),G(n),e===`max`&&W({type:`deposit.max.clicked`,flow:`deposit`,tier:`ui`,payload:{}})}},Y=e=>{V(e),U(void 0),G(e)},X=te({amount:B,...P===void 0?{}:{minAmountUsd:P},...I===void 0?{}:{maxAmountUsd:I},walletBalanceUsd:N}),Z=()=>{if(X===`aboveBalance`||X===`aboveCap`){V(R),U(`max`);return}if(X===`belowMin`&&typeof P==`number`){V(P),U(void 0);return}B!==null&&w(z&&z>0?B/z:B)};if(C.name!==`amountEntry`||!M||!j)return null;let Q=C.ctx.backTarget===`closed`?void 0:T,ne=d(M)??{symbol:M.symbol},re=d(j)??{symbol:j.symbol},ie=`${o((B??0)/1,k,{maxDecimals:5})} ${j.symbol}`,$=x(X,{updateOrder:O({id:`bOZXx5`,message:`Update order`}),depositMax:O({id:`9cCjMJ`,message:`Deposit max balance`})}),ae=S(X,L,F);return _(l,{...c,amount:B,sendToken:ne,receiveToken:re,max:R,...P===void 0?{}:{min:P},onAmountChange:Y,...Q?{onBack:Q}:{},subLineAmount:ie,presets:y,...H===void 0?{}:{activePreset:H},onPresetSelect:J,...$===void 0?{}:{footerLabel:$},onContinue:Z,notice:ae,...D?{headerTrailing:_(u,{onOpen:E})}:{},children:n??v(g,{children:[_(l.Header,{}),v(l.Body,{children:[_(l.Hero,{}),_(l.Pills,{}),_(l.Flow,{}),_(l.Notice,{})]}),_(l.Footer,{})]})})}function x(e,t){if(e===`aboveCap`||e===`belowMin`)return t.updateOrder;if(e===`aboveBalance`)return t.depositMax}function S(e,t,r){if(e===`aboveCap`&&t)return _(n,{id:`-I_tc5`,message:`Max {formattedCap}`,values:{formattedCap:t}});if(e===`aboveBalance`)return _(n,{id:`znqB4T`,message:`Insufficient balance`});if(e===`belowMin`&&r)return _(n,{id:`3eKjkO`,message:`{formattedMin} minimum deposit`,values:{formattedMin:r}})}function C({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return _(c,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:_(b,{...i})})}(function(e){e.Dialog=C,e.Header=l.Header,e.Body=l.Body,e.Hero=l.Hero,e.Pills=l.Pills,e.Flow=l.Flow,e.Footer=l.Footer,e.Notice=l.Notice})(b||={});export{b as AmountEntry};
1
+ "use client";import{useOptionalActivityDriverInstance as e}from"../../../activity/driver/context.js";import{useKitI18n as t}from"../../../../shared/i18n/useKitI18n.js";import{Trans as n}from"../../../../shared/i18n/Trans.js";import{useLingui as r}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositSnapshot as i}from"../../driver/context.js";import{useDepositActions as a,useDepositEffectiveState as ee}from"../../orchestrator/controller.js";import{formatTokenAmount as o}from"../../../../shared/format/formatTokenAmount.js";import{useKitEmitter as s}from"../../../../events/emit/useKitEmitter.js";import"../../../../events/emit/index.js";import{DialogShell as c}from"../../../../shared/dialog/DialogShell.js";import{ActivityTrigger as l}from"../../../../shared/widgets/activity/ActivityTrigger.js";import"../../../../shared/widgets/activity/index.js";import{AmountEntry as u}from"../../../../shared/widgets/amount-entry/compound/AmountEntry.js";import"../../../../shared/widgets/amount-entry/compound/index.js";import{toAssetDescriptor as d}from"../../../../shared/widgets/asset-descriptor.js";import{effectiveMaxUsd as f,resolveFooterIntent as te}from"./footerIntent.js";import{useEffect as p,useRef as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";const y=[{value:`25`,label:`25%`},{value:`50`,label:`50%`},{value:`75`,label:`75%`},{value:`max`,label:`Max`}];function b({children:n,...c}){let b=i(),C=ee(),{confirmAmount:w,back:T,openActivity:E}=a(),D=e()!==null,{_:O}=r(),k=t(),A=b.target,j=A.status===`ready`||A.status===`stale`?A.payload:void 0,M=C.name===`amountEntry`?C.ctx.asset:void 0,N=M?.amountUsd?.value??0,P=j?.minAmountUsd?.value,F=j?.minAmountUsd?.formatted,I=j?.maxAmountUsd?.value,L=j?.maxAmountUsd?.formatted,R=f(N,I),z=M?.priceUsd,[B,V]=h(P??null),[H,U]=h(),W=s(),G=e=>{W({type:`deposit.amount.changed`,flow:`deposit`,tier:`ui`,payload:{raw:e===null?``:String(e),numeric:e}})},K=m(void 0),q=M?`${M.eip155Id??``}:${M.address??``}`:void 0;p(()=>{q&&K.current!==q&&(K.current=q,typeof P==`number`&&(V(P),U(void 0)))},[q,P]);let J=e=>{U(e);let t=e===`max`?1:Number.parseInt(e,10)/100;if(Number.isFinite(t)){let n=R*t;V(n),G(n),e===`max`&&W({type:`deposit.max.clicked`,flow:`deposit`,tier:`ui`,payload:{}})}},Y=e=>{V(e),U(void 0),G(e)},X=te({amount:B,...P===void 0?{}:{minAmountUsd:P},...I===void 0?{}:{maxAmountUsd:I},walletBalanceUsd:N}),Z=()=>{if(X===`aboveBalance`||X===`aboveCap`){V(R),U(`max`);return}if(X===`belowMin`&&typeof P==`number`){V(P),U(void 0);return}B!==null&&w(z&&z>0?B/z:B)};if(C.name!==`amountEntry`||!M||!j)return null;let Q=C.ctx.backTarget===`closed`?void 0:T,ne=d(M)??{symbol:M.symbol},re=d(j)??{symbol:j.symbol},ie=`${o((B??0)/1,k,{maxDecimals:5})} ${j.symbol}`,$=x(X,{updateOrder:O({id:`bOZXx5`,message:`Update order`}),depositMax:O({id:`9cCjMJ`,message:`Deposit max balance`})}),ae=S(X,L,F);return _(u,{...c,amount:B,sendToken:ne,receiveToken:re,max:R,...P===void 0?{}:{min:P},onAmountChange:Y,...Q?{onBack:Q}:{},subLineAmount:ie,presets:y,...H===void 0?{}:{activePreset:H},onPresetSelect:J,...$===void 0?{}:{footerLabel:$},onContinue:Z,notice:ae,...D?{headerTrailing:_(l,{onOpen:E})}:{},children:n??v(g,{children:[_(u.Header,{}),v(u.Body,{children:[_(u.Hero,{}),_(u.Pills,{}),_(u.Flow,{}),_(u.Notice,{})]}),_(u.Footer,{})]})})}function x(e,t){if(e===`aboveCap`||e===`belowMin`)return t.updateOrder;if(e===`aboveBalance`)return t.depositMax}function S(e,t,r){if(e===`aboveCap`&&t)return _(n,{id:`-I_tc5`,message:`Max {formattedCap}`,values:{formattedCap:t}});if(e===`aboveBalance`)return _(n,{id:`znqB4T`,message:`Insufficient balance`});if(e===`belowMin`&&r)return _(n,{id:`3eKjkO`,message:`{formattedMin} minimum deposit`,values:{formattedMin:r}})}function C({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return _(c,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:_(b,{...i})})}(function(e){e.Dialog=C,e.Header=u.Header,e.Body=u.Body,e.Hero=u.Hero,e.Pills=u.Pills,e.Flow=u.Flow,e.Footer=u.Footer,e.Notice=u.Notice})(b||={});export{b as AmountEntry};
@@ -1 +1 @@
1
- "use client";import{useOptionalKitStorage as e}from"../../../../storage/context.js";import"../../../../storage/index.js";import{useLingui as t}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositSnapshot as n}from"../../driver/context.js";import{useCashRailUnlocked as r,useDepositActions as i,useDepositEffectiveState as a,useDepositMethodsConfig as o,useEnabledRails as s}from"../../orchestrator/controller.js";import{ApplePayIcon as c}from"../../../../shared/icons/ApplePayIcon.js";import{BitcoinIcon as l}from"../../../../shared/icons/BitcoinIcon.js";import{CardIcon as ee}from"../../../../shared/icons/CardIcon.js";import{CashIcon as u}from"../../../../shared/icons/CashIcon.js";import{GooglePayIcon as d}from"../../../../shared/icons/GooglePayIcon.js";import{QrCodeIcon as te}from"../../../../shared/icons/QrCodeIcon.js";import{WalletIcon as ne}from"../../../../shared/icons/WalletIcon.js";import"../../../../icons/index.js";import{DialogShell as f}from"../../../../shared/dialog/DialogShell.js";import{Image as p}from"../../../../shared/ui/Image/Image.js";import{Skeleton as re}from"../../../../shared/ui/Skeleton/Skeleton.js";import"../../../../shared/ui/Skeleton/index.js";import{TokenLogo as m}from"../../../../shared/ui/TokenLogo/TokenLogo.js";import"../../../../shared/ui/TokenLogo/index.js";import"../../../../ui/index.js";import{Deposit as h}from"./compound/Deposit.js";import"./compound/index.js";import{useMemo as g}from"react";import{Fragment as ie,jsx as _,jsxs as v}from"react/jsx-runtime";const y={width:18,height:18,"aria-hidden":!0},ae={card:`card`,"apple-pay":`applePay`,"google-pay":`googlePay`},b=`deposit.last-rail`;function x({children:f,...p}){let m=n(),x=a().name,{selectMethod:S,selectCashMethod:C}=i(),w=o(),T=r(),E=e(),{_:D}=t(),O=m.wallet,k=O.status===`ready`||O.status===`stale`?O.payload:void 0,A=k!==void 0,j=m.brand,M=j.status===`ready`||j.status===`stale`?j.payload:void 0,N=m.addresses,P=N.status===`ready`||N.status===`stale`?N.payload:[],F=m.balances.status===`error`,I=!k?.balanceTotalUsd?.formatted&&!F,L=!!m.brand,R=M?.name?D({id:`ogD_nm`,message:`Deposit to {0}`,values:{0:M.name}}):void 0,z=g(()=>oe(P),[P]),B=w?.wallet,V=w?.transfer,H=w?.card,U=w?.applePay,W=w?.googlePay,G=w?.cashRail?.enabled===!0,K=m.cashMethods,q=K?.status,J=q===`ready`||q===`stale`?K?.payload:void 0,Y=T&&G&&J!==void 0,se=g(()=>{let e=!A||I,t=B?.disabled??!1,n=e||t,r=t?B?.disabledHint:void 0,i=(()=>{if(t)return r;if(!A)return D({id:`5AApJw`,message:`Connect a wallet to continue`});if(k?.balanceTotalUsd?.formatted)return k.balanceTotalUsd.formatted;if(!F)return _(re,{width:56,height:12})})(),a=[{id:`wallet`,title:D({id:`sb9Y58`,message:`Wallet`}),icon:_(ne,{...y}),...k&&!t?{titleAdornment:k.address.formatted}:{},...i===void 0?{}:{meta:i},recommended:!0,disabled:n,onSelect:n?void 0:()=>S(`wallet`)}];if(L){let e=V?.disabled??!1,t=e?V?.disabledHint:void 0,n=e?t:[D({id:`qtoOYG`,message:`No limit`}),D({id:`D79cZK`,message:`Instant`})];a.push({id:`transfer`,title:D({id:`3dqPLT`,message:`Transfer Crypto`}),icon:_(te,{...y}),...n===void 0?{}:{meta:n},...z?{trailing:z}:{},disabled:e,onSelect:e?void 0:()=>S(`transfer`)})}return a},[k,F,I,A,L,z,B,V,S,D]),X=g(()=>{let e=(e,n)=>{if(e!==void 0)return e;if(!n)return;let r=[];n.limit?.formatted&&r.push(D({id:`jtKSW-`,message:`{0} limit`,values:{0:n.limit.formatted}}));let i=t(n.processingTime);return i&&r.push(i),r.length>0?r:void 0},t=e=>{if(e)return e.value===0?D({id:`D79cZK`,message:`Instant`}):e.formatted||void 0},n=(t,n,r,i,a)=>{let o=i?.disabled??!1,s=e(o?i?.disabledHint:void 0,a);return{id:t,title:n,icon:r,...s===void 0?{}:{meta:s},metaEmphasis:`uniform`,disabled:o,onSelect:o?void 0:()=>C(ae[t])}};return{card:n(`card`,D({id:`kryGs-`,message:`Card`}),_(ee,{...y}),H,J?.card),applePay:n(`apple-pay`,D({id:`6ws9A3`,message:`Apple Pay`}),_(c,{...y}),U,J?.applePay),googlePay:n(`google-pay`,D({id:`ybKOj4`,message:`Google Pay`}),_(d,{...y}),W,J?.googlePay)}},[H,U,W,J,C,D]),Z=s(g(()=>{let e=[{value:`crypto`,label:D({id:`CS69m9`,message:`Use Crypto`}),icon:_(l,{width:12,height:12,"aria-hidden":!0})}];return Y&&e.push({value:`cash`,label:D({id:`LSs4cd`,message:`Use Cash`}),icon:_(u,{width:12,height:12,"aria-hidden":!0})}),e},[D,Y]));if(x!==`deposit`)return null;let Q={crypto:_(h.Methods,{}),cash:v(h.Methods,{children:[_(h.MethodSection,{label:D({id:`y1ypMV`,message:`Most popular`}),children:_(h.Method,{...X.card})}),v(h.MethodSection,{label:D({id:`xOUCt3`,message:`Other options`}),children:[_(h.Method,{...X.applePay}),_(h.Method,{...X.googlePay})]})]})},[$]=Z,ce=E?.get(b)??null,le=Z.find(e=>e.value===ce)?.value??$?.value,ue=v(ie,{children:[_(h.Header,{}),_(h.Body,{children:Z.length>=2?_(h.RailPicker,{defaultValue:le,rails:Z,onValueChange:e=>E?.set(b,e),children:Z.map(e=>_(h.Rail,{value:e.value,children:Q[e.value]},e.value))}):Q[$?.value??`crypto`]})]});return _(h,{...p,...R?{title:R}:{},methods:se,children:f??ue})}function oe(e){if(e.length!==0)return _(p.Group,{max:4,overflow:Math.max(0,e.length-4),size:`md`,children:e.map(e=>_(m,{isNative:!0,symbol:e.networkName,...e.eip155Id?{chainId:Number(e.eip155Id)}:{},...e.chainLogoUrl?{logoUrl:e.chainLogoUrl}:{},hideChainBadge:!0},e.eip155Id??e.networkName))})}function S({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return _(f,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:_(x,{...i})})}(function(e){e.Dialog=S,e.Header=h.Header,e.Body=h.Body,e.Methods=h.Methods,e.Method=h.Method,e.MethodSection=h.MethodSection,e.Steps=h.Steps,e.Step=h.Step,e.RailPicker=h.RailPicker,e.Rail=h.Rail})(x||={});export{x as Deposit};
1
+ "use client";import{useOptionalKitStorage as e}from"../../../../storage/context.js";import"../../../../storage/index.js";import{useLingui as t}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositSnapshot as n}from"../../driver/context.js";import{useDepositActions as r,useDepositEffectiveState as i,useDepositMethodsConfig as a,useEnabledRails as o}from"../../orchestrator/controller.js";import{BitcoinIcon as s}from"../../../../shared/icons/BitcoinIcon.js";import{CardIcon as c}from"../../../../shared/icons/CardIcon.js";import{QrCodeIcon as l}from"../../../../shared/icons/QrCodeIcon.js";import{WalletIcon as u}from"../../../../shared/icons/WalletIcon.js";import"../../../../icons/index.js";import{DialogShell as d}from"../../../../shared/dialog/DialogShell.js";import{Image as f}from"../../../../shared/ui/Image/Image.js";import{Skeleton as p}from"../../../../shared/ui/Skeleton/Skeleton.js";import"../../../../shared/ui/Skeleton/index.js";import{TokenLogo as m}from"../../../../shared/ui/TokenLogo/TokenLogo.js";import"../../../../shared/ui/TokenLogo/index.js";import"../../../../ui/index.js";import{Deposit as h}from"./compound/Deposit.js";import"./compound/index.js";import{useMemo as g}from"react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";const b={width:18,height:18,"aria-hidden":!0},x=`deposit.last-rail`;function S({children:d,...f}){let m=n(),S=i().name,{selectMethod:w,selectOnramp:T}=r(),E=a(),D=e(),{_:O}=t(),k=m.wallet,A=k.status===`ready`||k.status===`stale`?k.payload:void 0,j=A!==void 0,M=m.brand,N=M.status===`ready`||M.status===`stale`?M.payload:void 0,P=m.addresses,F=P.status===`ready`||P.status===`stale`?P.payload:[],I=m.balances.status===`error`,L=!A?.balanceTotalUsd?.formatted&&!I,R=!!m.brand,z=N?.name?O({id:`ogD_nm`,message:`Deposit to {0}`,values:{0:N.name}}):void 0,B=g(()=>C(F),[F]),V=E?.wallet,H=E?.transfer,U=E?.onrampRail?.enabled===!0,W=m.onrampMethods,G=W?.status,K=G===`ready`||G===`stale`?W?.payload:void 0,q=U&&K!==void 0,J=g(()=>{let e=!j||L,t=V?.disabled??!1,n=e||t,r=t?V?.disabledHint:void 0,i=(()=>{if(t)return r;if(!j)return O({id:`5AApJw`,message:`Connect a wallet to continue`});if(A?.balanceTotalUsd?.formatted)return A.balanceTotalUsd.formatted;if(!I)return v(p,{width:56,height:12})})(),a=[{id:`wallet`,title:O({id:`sb9Y58`,message:`Wallet`}),icon:v(u,{...b}),...A&&!t?{titleAdornment:A.address.formatted}:{},...i===void 0?{}:{meta:i},recommended:!0,disabled:n,onSelect:n?void 0:()=>w(`wallet`)}];if(R){let e=H?.disabled??!1,t=e?H?.disabledHint:void 0,n=e?t:[O({id:`qtoOYG`,message:`No limit`}),O({id:`D79cZK`,message:`Instant`})];a.push({id:`transfer`,title:O({id:`3dqPLT`,message:`Transfer Crypto`}),icon:v(l,{...b}),...n===void 0?{}:{meta:n},...B?{trailing:B}:{},disabled:e,onSelect:e?void 0:()=>w(`transfer`)})}return a},[A,I,L,j,R,B,V,H,w,O]),Y=g(()=>{let e=(()=>{if(!K)return;let e=[];K.limit?.formatted&&e.push(O({id:`jtKSW-`,message:`{0} limit`,values:{0:K.limit.formatted}}));let t=K.processingTime;if(t){let n=t.value===0?O({id:`D79cZK`,message:`Instant`}):t.formatted||void 0;n&&e.push(n)}return e.length>0?e:void 0})();return{id:`onramp`,title:O({id:`_rHUhS`,message:`Cash`}),icon:v(c,{...b}),...e===void 0?{}:{meta:e},metaEmphasis:`uniform`,onSelect:()=>T()}},[K,T,O]),X=o(g(()=>{let e=[{value:`crypto`,label:O({id:`0TEl46`,message:`Crypto`}),icon:v(s,{width:12,height:12,"aria-hidden":!0})}];return q&&e.push({value:`onramp`,label:O({id:`_rHUhS`,message:`Cash`}),icon:v(c,{width:12,height:12,"aria-hidden":!0})}),e},[O,q]));if(S!==`deposit`)return null;let Z={crypto:v(h.Methods,{}),onramp:v(h.Methods,{children:v(h.Method,{...Y})})},[Q]=X,$=D?.get(x)??null,ee=X.find(e=>e.value===$)?.value??Q?.value,te=y(_,{children:[v(h.Header,{}),v(h.Body,{children:X.length>=2?v(h.RailPicker,{defaultValue:ee,rails:X,onValueChange:e=>D?.set(x,e),children:X.map(e=>v(h.Rail,{value:e.value,children:Z[e.value]},e.value))}):Z[Q?.value??`crypto`]})]});return v(h,{...f,...z?{title:z}:{},methods:J,children:d??te})}function C(e){if(e.length!==0)return v(f.Group,{max:4,overflow:Math.max(0,e.length-4),size:`md`,children:e.map(e=>v(m,{isNative:!0,symbol:e.networkName,...e.eip155Id?{chainId:Number(e.eip155Id)}:{},...e.chainLogoUrl?{logoUrl:e.chainLogoUrl}:{},hideChainBadge:!0},e.eip155Id??e.networkName))})}function w({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return v(d,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:v(S,{...i})})}(function(e){e.Dialog=w,e.Header=h.Header,e.Body=h.Body,e.Methods=h.Methods,e.Method=h.Method,e.MethodSection=h.MethodSection,e.Steps=h.Steps,e.Step=h.Step,e.RailPicker=h.RailPicker,e.Rail=h.Rail})(S||={});export{S as Deposit};
@@ -68,11 +68,11 @@ declare namespace Deposit {
68
68
  const Methods: typeof DepositMethods;
69
69
  const Method: typeof DepositMethod;
70
70
  /**
71
- * Labelled cluster of methods within a single rail (Paper artboard
72
- * `1IIA-0` partitions the cash picker into "Most popular" and
73
- * "Other options"). Detected by `Deposit.Methods` via element identity;
74
- * when present the parent skips its own label + tile-group and each
75
- * section owns its label and roving-focus group.
71
+ * Labelled cluster of methods within a single rail (e.g. partitioning a
72
+ * rail's methods into "Most popular" and "Other options"). Detected by
73
+ * `Deposit.Methods` via element identity; when present the parent skips its
74
+ * own label + tile-group and each section owns its label and roving-focus
75
+ * group.
76
76
  */
77
77
  const MethodSection: typeof DepositMethodSection;
78
78
  const Dialog: typeof DepositDialog;
@@ -1 +1 @@
1
- "use client";import{useDepositSnapshot as e}from"../../../../driver/context.js";import{useDepositEffectiveState as t}from"../../../../orchestrator/controller.js";import{useDepositOwnerContext as n}from"../../../../../../stridge/depositOwner.js";import{DepositBootstrapErrorState as r}from"../../../../dialog/DepositBootstrapErrorState.js";import{WalletRequiredState as i}from"../../../../dialog/WalletRequiredState.js";import{LoadingState as a}from"../../../../../../shared/dialog/LoadingState.js";import{Fragment as o,jsx as s}from"react/jsx-runtime";const c=new Set([`deposit`,`assetPicker`,`amountEntry`,`cashAmountEntry`,`cashConfirm`,`confirmDeposit`,`transferCrypto`]);function l({children:l}){let u=t(),d=e(),f=n(),p=c.has(u.name);return f!==null&&!f.resolved&&p?s(i,{}):d.target.status===`error`&&p?s(r,{}):(d.target.status===`loading`||d.target.status===`idle`)&&p?s(a,{slot:`deposit`}):s(o,{children:l})}export{l as DepositGuards};
1
+ "use client";import{useDepositSnapshot as e}from"../../../../driver/context.js";import{useDepositEffectiveState as t}from"../../../../orchestrator/controller.js";import{useDepositOwnerContext as n}from"../../../../../../stridge/depositOwner.js";import{DepositBootstrapErrorState as r}from"../../../../dialog/DepositBootstrapErrorState.js";import{WalletRequiredState as i}from"../../../../dialog/WalletRequiredState.js";import{LoadingState as a}from"../../../../../../shared/dialog/LoadingState.js";import{Fragment as o,jsx as s}from"react/jsx-runtime";const c=new Set([`deposit`,`assetPicker`,`amountEntry`,`onrampAmountEntry`,`onrampConfirm`,`confirmDeposit`,`transferCrypto`]);function l({children:l}){let u=t(),d=e(),f=n(),p=c.has(u.name);return f!==null&&!f.resolved&&p?s(i,{}):d.target.status===`error`&&p?s(r,{}):(d.target.status===`loading`||d.target.status===`idle`)&&p?s(a,{slot:`deposit`}):s(o,{children:l})}export{l as DepositGuards};
@@ -14,8 +14,7 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
14
14
  * - **Sectioned**: when at least one `<Deposit.MethodSection>` child is
15
15
  * detected, the outer label and tile-group are skipped — each section
16
16
  * owns its own label and roving-focus group so arrow-key navigation
17
- * stays contained inside a single section (the Paper artboard `1IIA-0`
18
- * cash picker shape).
17
+ * stays contained inside a single section (the sectioned picker shape).
19
18
  *
20
19
  * No `value` is supplied to the tile group — each row's click navigates to
21
20
  * the next step rather than toggling a pressed state, so the group is purely
@@ -1 +1 @@
1
- "use client";import{StepTransition as e}from"../../../../../../shared/dialog/StepTransition.js";import{Tabs as t}from"../../../../../../shared/ui/Tabs/Tabs.js";import"../../../../../../shared/ui/Tabs/index.js";import{DEPOSIT_SLOTS as n}from"../Deposit.slots.js";import{styles as r}from"../Deposit.styles.js";import{DepositRail as i}from"./Rail.js";import{Children as a,isValidElement as o,useId as s,useMemo as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import*as f from"@stylexjs/stylex";function p(e,t){let n=null;return a.forEach(e,e=>{n===null&&o(e)&&e.type===i&&e.props.value===t&&(n=e.props.children)}),n}function m(e){return e.rails.length===0?null:u(h,{...e})}m.displayName=`Deposit.RailPicker`;function h({defaultValue:i,value:a,onValueChange:o,rails:m,variant:h=`default`,children:g}){let[_]=m;if(!_)return null;let[v,y]=l(i??_.value),b=a!==void 0,x=b?a:v,S=s(),C=e=>{e!==`crypto`&&e!==`cash`||(b||y(e),o?.(e))},w=c(()=>p(g,x),[g,x]);return d(t.Root,{"data-stridge-slot":n.railPicker,value:x,onValueChange:C,...f.props(r.railPicker),children:[u(`div`,{...f.props(r.railList),children:d(t.List,{"data-stridge-slot":n.railList,variant:h,...f.props(r.railListInner),children:[m.map(e=>u(t.Tab,{id:`${S}-${e.value}`,"data-stridge-slot":n.railTab,"data-rail":e.value,value:e.value,disabled:e.disabled,render:(t,n)=>d(`button`,{type:`button`,...t,children:[e.icon?u(`span`,{"data-active":n.active?``:void 0,...f.props(r.railTabBadge),children:e.icon}):null,e.label]})},e.value)),u(t.Indicator,{})]})}),u(e,{stateKey:x,children:u(`div`,{role:`tabpanel`,"aria-labelledby":`${S}-${x}`,"data-stridge-slot":n.rail,"data-rail":x,children:w})})]})}export{m as DepositRailPicker};
1
+ "use client";import{StepTransition as e}from"../../../../../../shared/dialog/StepTransition.js";import{Tabs as t}from"../../../../../../shared/ui/Tabs/Tabs.js";import"../../../../../../shared/ui/Tabs/index.js";import{DEPOSIT_SLOTS as n}from"../Deposit.slots.js";import{styles as r}from"../Deposit.styles.js";import{DepositRail as i}from"./Rail.js";import{Children as a,isValidElement as o,useId as s,useMemo as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import*as f from"@stylexjs/stylex";function p(e,t){let n=null;return a.forEach(e,e=>{n===null&&o(e)&&e.type===i&&e.props.value===t&&(n=e.props.children)}),n}function m(e){return e.rails.length===0?null:u(h,{...e})}m.displayName=`Deposit.RailPicker`;function h({defaultValue:i,value:a,onValueChange:o,rails:m,variant:h=`default`,children:g}){let[_]=m;if(!_)return null;let[v,y]=l(i??_.value),b=a!==void 0,x=b?a:v,S=s(),C=e=>{e!==`crypto`&&e!==`onramp`||(b||y(e),o?.(e))},w=c(()=>p(g,x),[g,x]);return d(t.Root,{"data-stridge-slot":n.railPicker,value:x,onValueChange:C,...f.props(r.railPicker),children:[u(`div`,{...f.props(r.railList),children:d(t.List,{"data-stridge-slot":n.railList,variant:h,...f.props(r.railListInner),children:[m.map(e=>u(t.Tab,{id:`${S}-${e.value}`,"data-stridge-slot":n.railTab,"data-rail":e.value,value:e.value,disabled:e.disabled,render:(t,n)=>d(`button`,{type:`button`,...t,children:[e.icon?u(`span`,{"data-active":n.active?``:void 0,...f.props(r.railTabBadge),children:e.icon}):null,e.label]})},e.value)),u(t.Indicator,{})]})}),u(e,{stateKey:x,children:u(`div`,{role:`tabpanel`,"aria-labelledby":`${S}-${x}`,"data-stridge-slot":n.rail,"data-rail":x,children:w})})]})}export{m as DepositRailPicker};
@@ -29,7 +29,7 @@ interface DepositMethodOption {
29
29
  * default) renders the first segment at `medium` weight with full-foreground
30
30
  * colour and subdues the rest — the wallet and transfer-crypto tiles.
31
31
  * `"uniform"` renders every segment at `medium` weight with subdued colour —
32
- * the cash method tiles. Ignored when `meta` is a single node.
32
+ * the onramp method tile. Ignored when `meta` is a single node.
33
33
  */
34
34
  metaEmphasis?: "lead" | "uniform";
35
35
  /** Icon rendered inside the 36×36 slot on the left of the row. */
@@ -139,9 +139,9 @@ interface DepositMethodProps extends DepositMethodOption {
139
139
  }
140
140
  /**
141
141
  * Method section part props. A `<Deposit.MethodSection>` is a labelled cluster
142
- * of methods within a single rail — Paper artboard `1IIA-0` partitions the
143
- * cash picker into "Most popular" (Card) and "Other options" (Apple Pay /
144
- * Google Pay). Sections live in the JSX composition rather than on the method
142
+ * of methods within a single rail — used to partition a rail's methods into
143
+ * named groups ("Most popular" / "Other options"). Sections live in the JSX
144
+ * composition rather than on the method
145
145
  * data shape, so moving a method between sections, swapping a label per
146
146
  * locale, or dropping a section entirely never touches `DepositMethodInput`
147
147
  * or the orchestrator. Each section owns its own roving-focus
@@ -166,15 +166,15 @@ interface DepositMethodSectionProps {
166
166
  /**
167
167
  * Payment rail discriminator. The first-step picker is partitioned by rail,
168
168
  * then by method within the active rail. Crypto rail hosts the existing
169
- * wallet / transfer methods; cash rail will host bank / card / cash-pickup
170
- * methods once they ship.
169
+ * wallet / transfer methods; the onramp rail hosts the single "Cash"
170
+ * method.
171
171
  *
172
172
  * Lives in the compound layer while it is UI-only. Promotes to
173
173
  * `orchestrator/types.ts` the first time the FSM needs to branch on rail
174
- * (e.g. when a cash method dispatches a different reducer event than
174
+ * (e.g. when the onramp method dispatches a different reducer event than
175
175
  * `selectMethod`).
176
176
  */
177
- type DepositRail = "crypto" | "cash";
177
+ type DepositRail = "crypto" | "onramp";
178
178
  /**
179
179
  * A single rail tab — the label rendered in the `Deposit.RailPicker` tab
180
180
  * strip plus the value that maps to a `Deposit.Rail` panel.
@@ -209,7 +209,7 @@ interface DepositRailPickerProps {
209
209
  onValueChange?: (rail: DepositRail) => void;
210
210
  /**
211
211
  * Rail tabs rendered in the strip. Order in the array determines visual order.
212
- * The kit ships `crypto` and `cash` today; consumers pick the subset they want
212
+ * The kit ships `crypto` and `onramp` today; consumers pick the subset they want
213
213
  * to surface based on host capabilities.
214
214
  */
215
215
  rails: readonly DepositRailDescriptor[];
@@ -1 +1 @@
1
- "use client";import{useLingui as e}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useFailureReasonForKind as t}from"../../../../shared/orchestrator/failureReason.js";import"../../../../shared/orchestrator/index.js";import{useDepositSnapshot as n}from"../../driver/context.js";import{useDepositActions as r,useDepositEffectiveState as i}from"../../orchestrator/controller.js";import{DialogShell as a}from"../../../../shared/dialog/DialogShell.js";import{ErrorState as o}from"../../../../shared/widgets/error-state/compound/ErrorState.js";import"../../../../shared/widgets/error-state/compound/index.js";import{toAssetDescriptor as s}from"../../../../shared/widgets/asset-descriptor.js";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";function d({children:a,...d}){let f=n(),p=i(),{tryAgain:m}=r(),{_:h}=e(),g=t();if(p.name!==`error`)return null;let _=f.settlement,v=_.status===`ready`&&_.payload.kind===`failed`?_.payload:void 0,y=p.name===`error`?p.ctx.failure:void 0,b=h({id:`i-4Fbp`,message:`Deposit failed`}),x=v?g(v.failureKind):y?.reason;if(!v)return l(o,{...d,headline:b,...x?{reason:x}:{},onTryAgain:m,children:a??u(c,{children:[l(o.Header,{}),l(o.Body,{children:l(o.Hero,{})}),l(o.Actions,{})]})});let S=v,C={...S.sourceWallet.name===void 0?{}:{name:S.sourceWallet.name},address:S.sourceWallet.address.formatted,...S.sourceWallet.explorerUrl?{explorerUrl:S.sourceWallet.explorerUrl}:{}},w={...S.destination.name===void 0?{}:{name:S.destination.name},address:S.destination.address.formatted},T=s(S.creditedAsset)??{symbol:S.creditedAsset.symbol},E={hash:S.txHash.formatted,...S.txExplorerUrl?{explorerUrl:S.txExplorerUrl}:{}};return l(o,{...d,headline:b,...x?{reason:x}:{},sourceWallet:C,destination:w,receiveAmount:S.receiveAmount.formatted,receiveAsset:T,depositTx:E,submittedAt:S.submittedAt.formatted,failedAt:S.failedAt.formatted,onTryAgain:m,children:a??u(c,{children:[l(o.Header,{}),u(o.Body,{children:[l(o.Hero,{}),u(o.Details,{children:[l(o.FillStatusRow,{}),l(o.SourceRow,{}),l(o.DestinationRow,{}),l(o.YouReceiveRow,{}),u(o.MoreDetails,{children:[l(o.DepositTxRow,{}),l(o.SubmittedAtRow,{}),l(o.FailedAtRow,{})]})]}),l(o.HelpInfo,{})]}),l(o.Actions,{})]})})}function f({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return l(a,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:l(d,{...i})})}(function(e){e.Dialog=f,e.Header=o.Header,e.Body=o.Body,e.Hero=o.Hero,e.Details=o.Details,e.FillStatusRow=o.FillStatusRow,e.SourceRow=o.SourceRow,e.DestinationRow=o.DestinationRow,e.YouReceiveRow=o.YouReceiveRow,e.MoreDetails=o.MoreDetails,e.DepositTxRow=o.DepositTxRow,e.SubmittedAtRow=o.SubmittedAtRow,e.FailedAtRow=o.FailedAtRow,e.HelpInfo=o.HelpInfo,e.Actions=o.Actions})(d||={});export{d as ErrorState};
1
+ "use client";import{useLingui as e}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useFailureReasonForKind as t}from"../../../../shared/orchestrator/failureReason.js";import"../../../../shared/orchestrator/index.js";import{useDepositSnapshot as n}from"../../driver/context.js";import{useDepositActions as r,useDepositEffectiveState as i}from"../../orchestrator/controller.js";import{DialogShell as a}from"../../../../shared/dialog/DialogShell.js";import{ErrorState as o}from"../../../../shared/widgets/error-state/compound/ErrorState.js";import"../../../../shared/widgets/error-state/compound/index.js";import{toAssetDescriptor as s}from"../../../../shared/widgets/asset-descriptor.js";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";const d={declined:{headline:{id:`mn0HrT`,message:`Payment declined`},reason:{id:`UDBU3S`,message:`Your payment was declined. Try a different card or amount.`}},cancelled:{headline:{id:`0VFO13`,message:`Payment cancelled`},reason:{id:`5R2524`,message:`You cancelled the payment before it completed.`}},refunded:{headline:{id:`hPpyl6`,message:`Payment refunded`},reason:{id:`3ytoeI`,message:`This payment was refunded. No crypto was delivered.`}},timeout:{headline:{id:`S7anoa`,message:`Payment timed out`},reason:{id:`Z1fsV0`,message:`The checkout window expired before payment completed.`}},generic:{headline:{id:`NzshpK`,message:`Purchase failed`},reason:{id:`X_Y-Ev`,message:`Something went wrong with your purchase. Please try again.`}}};function f(e,t){let n=e?.toLowerCase()??``,r=`generic`;n.includes(`declin`)?r=`declined`:n.includes(`cancel`)?r=`cancelled`:n.includes(`refund`)?r=`refunded`:(n.includes(`timeout`)||n.includes(`expire`))&&(r=`timeout`);let i=d[r];return{headline:t._(i.headline),reason:t._(i.reason)}}function p({children:a,...d}){let p=n(),m=i(),{tryAgain:h}=r(),{_:g,i18n:_}=e(),v=t();if(m.name!==`error`)return null;if(m.ctx.sessionId!==void 0){let e=p.onrampSession,{headline:t,reason:n}=f((e?.status===`ready`||e?.status===`stale`?e.payload:void 0)?.failureCode??m.ctx.failure?.code,_);return l(o,{...d,headline:t,reason:n,onTryAgain:h,children:a??u(c,{children:[l(o.Header,{}),l(o.Body,{children:l(o.Hero,{})}),l(o.Actions,{})]})})}let y=p.settlement,b=y.status===`ready`&&y.payload.kind===`failed`?y.payload:void 0,x=m.name===`error`?m.ctx.failure:void 0,S=g({id:`i-4Fbp`,message:`Deposit failed`}),C=b?v(b.failureKind):x?.reason;if(!b)return l(o,{...d,headline:S,...C?{reason:C}:{},onTryAgain:h,children:a??u(c,{children:[l(o.Header,{}),l(o.Body,{children:l(o.Hero,{})}),l(o.Actions,{})]})});let w=b,T={...w.sourceWallet.name===void 0?{}:{name:w.sourceWallet.name},address:w.sourceWallet.address.formatted,...w.sourceWallet.explorerUrl?{explorerUrl:w.sourceWallet.explorerUrl}:{}},E={...w.destination.name===void 0?{}:{name:w.destination.name},address:w.destination.address.formatted},D=s(w.creditedAsset)??{symbol:w.creditedAsset.symbol},O={hash:w.txHash.formatted,...w.txExplorerUrl?{explorerUrl:w.txExplorerUrl}:{}};return l(o,{...d,headline:S,...C?{reason:C}:{},sourceWallet:T,destination:E,receiveAmount:w.receiveAmount.formatted,receiveAsset:D,depositTx:O,submittedAt:w.submittedAt.formatted,failedAt:w.failedAt.formatted,onTryAgain:h,children:a??u(c,{children:[l(o.Header,{}),u(o.Body,{children:[l(o.Hero,{}),u(o.Details,{children:[l(o.FillStatusRow,{}),l(o.SourceRow,{}),l(o.DestinationRow,{}),l(o.YouReceiveRow,{}),u(o.MoreDetails,{children:[l(o.DepositTxRow,{}),l(o.SubmittedAtRow,{}),l(o.FailedAtRow,{})]})]}),l(o.HelpInfo,{})]}),l(o.Actions,{})]})})}function m({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return l(a,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:l(p,{...i})})}(function(e){e.Dialog=m,e.Header=o.Header,e.Body=o.Body,e.Hero=o.Hero,e.Details=o.Details,e.FillStatusRow=o.FillStatusRow,e.SourceRow=o.SourceRow,e.DestinationRow=o.DestinationRow,e.YouReceiveRow=o.YouReceiveRow,e.MoreDetails=o.MoreDetails,e.DepositTxRow=o.DepositTxRow,e.SubmittedAtRow=o.SubmittedAtRow,e.FailedAtRow=o.FailedAtRow,e.HelpInfo=o.HelpInfo,e.Actions=o.Actions})(p||={});export{p as ErrorState};
@@ -0,0 +1,64 @@
1
+ import { DialogShellControls } from "../../../../shared/dialog/DialogShell.js";
2
+ import { AmountEntryBodyProps } from "../../../../shared/widgets/amount-entry/compound/types.js";
3
+ import { AmountEntryHeader } from "../../../../shared/widgets/amount-entry/compound/components/Header.js";
4
+ import { AmountEntryDetails, AmountEntryDetailsRow } from "../../../../shared/widgets/amount-entry/compound/components/Details.js";
5
+ import { AmountEntryFlow } from "../../../../shared/widgets/amount-entry/compound/components/Flow.js";
6
+ import { AmountEntryFooter } from "../../../../shared/widgets/amount-entry/compound/components/Footer.js";
7
+ import { AmountEntryHero } from "../../../../shared/widgets/amount-entry/compound/components/Hero/Hero.js";
8
+ import { AmountEntryNotice } from "../../../../shared/widgets/amount-entry/compound/components/Notice.js";
9
+ import { AmountEntryPills } from "../../../../shared/widgets/amount-entry/compound/components/Pills.js";
10
+ import { OnrampAmountEntryHeroLabel } from "./compound/components/HeroLabel.js";
11
+ import { OnrampAmountEntryReceiveChip } from "./compound/components/ReceiveChip.js";
12
+ import { ComponentProps, ReactNode } from "react";
13
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
14
+
15
+ //#region src/flows/deposit/widgets/onramp-amount-entry/OnrampAmountEntry.d.ts
16
+ interface OnrampAmountEntryOwnProps {
17
+ /**
18
+ * Optional custom composition. When omitted, the canonical default composition renders —
19
+ * `<Header />` + `<Body>` with YOU PAY label + Hero (Receive chip subLine) + fiat-absolute
20
+ * Pills + Details breakdown + `<Footer />`. Pass children to interleave your own elements
21
+ * between compound parts or replace the composition entirely.
22
+ */
23
+ children?: ReactNode;
24
+ }
25
+ /**
26
+ * Orchestrated `OnrampAmountEntry` widget — the screen between the "Cash" rail and the
27
+ * onramp confirm screen. Reads the entered fiat amount from the FSM's `onrampAmountEntry.ctx`, the
28
+ * limit from the driver's `onrampMethods` entity, and the live fee/receive breakdown from the
29
+ * driver's `onrampQuote` entity (refreshed by the controller's debounced quote effect). Renders
30
+ * nothing on any other FSM state.
31
+ */
32
+ declare function OnrampAmountEntry({
33
+ children,
34
+ ...props
35
+ }: ComponentProps<"div"> & OnrampAmountEntryOwnProps): _$react_jsx_runtime0.JSX.Element | null;
36
+ declare function OnrampAmountEntryDialog({
37
+ open,
38
+ defaultOpen,
39
+ onOpenChange,
40
+ trigger,
41
+ ...rootProps
42
+ }: OnrampAmountEntry.DialogProps): _$react_jsx_runtime0.JSX.Element;
43
+ declare namespace OnrampAmountEntry {
44
+ type Props = ComponentProps<"div"> & OnrampAmountEntryOwnProps;
45
+ type DialogProps = Props & DialogShellControls;
46
+ const Dialog: typeof OnrampAmountEntryDialog;
47
+ /**
48
+ * Compound sub-parts aliased on the orchestrated widget so consumers can compose without
49
+ * importing the headless compound separately.
50
+ */
51
+ const HeroLabel: typeof OnrampAmountEntryHeroLabel;
52
+ const ReceiveChip: typeof OnrampAmountEntryReceiveChip;
53
+ const Header: typeof AmountEntryHeader;
54
+ const Body: (props: AmountEntryBodyProps) => _$react_jsx_runtime0.JSX.Element;
55
+ const Hero: typeof AmountEntryHero;
56
+ const Pills: typeof AmountEntryPills;
57
+ const Flow: typeof AmountEntryFlow;
58
+ const Footer: typeof AmountEntryFooter;
59
+ const Notice: typeof AmountEntryNotice;
60
+ const Details: typeof AmountEntryDetails;
61
+ const DetailsRow: typeof AmountEntryDetailsRow;
62
+ }
63
+ //#endregion
64
+ export { OnrampAmountEntry };
@@ -0,0 +1 @@
1
+ "use client";import{Trans as e}from"../../../../shared/i18n/Trans.js";import{useLingui as t}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositSnapshot as n}from"../../driver/context.js";import{useDepositActions as r,useDepositEffectiveState as i}from"../../orchestrator/controller.js";import{DialogShell as a}from"../../../../shared/dialog/DialogShell.js";import{OnrampAmountEntry as o}from"./compound/OnrampAmountEntry.js";import"./compound/index.js";import{ONRAMP_AMOUNT_PRESETS as s}from"../../shared/onramp.js";import{useEffect as c,useMemo as l,useState as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";const m={symbol:`USDC`,chainId:1,address:`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`};function h({children:a,...h}){let g=n(),_=i(),{back:v,confirmOnrampAmount:y,setOnrampAmount:b}=r(),{_:x}=t(),S=_.name===`onrampAmountEntry`?_.ctx.amount:void 0,C=g.onrampMethods,w=C?.status===`ready`||C?.status===`stale`?C.payload:void 0,T=w?.limit?.value,E=w?.limit?.formatted,D=g.onrampQuote,O=D?.status===`ready`||D?.status===`stale`?D.payload:void 0,k=D==null||D.status===`idle`||D.status===`loading`,A=s[0]?.value??0,j=S??A,[M,N]=u(j),[P,F]=u(()=>{let e=s.find(e=>e.value===j);return e?String(e.value):void 0}),I=l(()=>s.map(e=>({value:String(e.value),label:e.label})),[]);c(()=>{b(M)},[M,b]);let L=e=>{let t=Number.parseInt(e,10);Number.isFinite(t)&&(N(t),F(e))},R=e=>{N(e),F(void 0)},z=T===0,B=()=>{if(!z){if(typeof T==`number`&&M!==null&&M>T){N(T),F(void 0);return}M===null||M<=0||y(M)}};if(_.name!==`onrampAmountEntry`)return null;let V=!z&&typeof T==`number`&&M!==null&&M>T,H=z?f(e,{id:`EzZNDI`,message:`Buy-with-card isn't available for your region`}):V&&E?f(e,{id:`GXkBas`,message:`Max {formattedLimit}`,values:{formattedLimit:E}}):void 0,U=V?x({id:`wkskq5`,message:`Use max`}):void 0,W=O?{symbol:O.receiveAsset.symbol,chainId:O.receiveAsset.chainId,address:O.receiveAsset.address,isNative:O.receiveAsset.isNative,...O.receiveAsset.assetLogoUrl?{logoUrl:O.receiveAsset.assetLogoUrl}:{}}:m,G=O?.receiveAmount.formatted??``,K=_.ctx.backTarget===`closed`?void 0:v;return f(o,{...h,formattedReceive:G,onrampReceiveToken:W,quoteLoading:k,amount:M,sendToken:{symbol:`USD`},receiveToken:W,...typeof T==`number`&&T>0?{max:T}:{},headerTitle:x({id:`kj3M8S`,message:`Deposit`}),currencySymbol:`$`,onAmountChange:R,...K?{onBack:K}:{},presets:I,...P===void 0?{}:{activePreset:P},onPresetSelect:L,...U===void 0?{}:{footerLabel:U},...z?{}:{onContinue:B},ctaDisabled:k,notice:H,children:a??p(d,{children:[f(o.Header,{}),p(o.Body,{children:[f(o.HeroLabel,{children:f(e,{id:`VAxOSg`,message:`You pay`})}),f(o.Hero,{}),f(o.Pills,{}),p(o.Details,{children:[f(o.DetailsRow,{label:f(e,{id:`hehnjM`,message:`Amount`}),children:O?O.amountUsd.formatted:``}),f(o.DetailsRow,{label:f(e,{id:`vepIdX`,message:`Crypto price`}),children:O?f(e,{id:`eUbBqz`,message:`1 {0} = {1}`,values:{0:O.receiveAsset.symbol,1:O.rate.formatted}}):``}),f(o.DetailsRow,{label:f(e,{id:`QFwptY`,message:`Processing fee`}),info:f(e,{id:`A-C4hO`,message:`The processing fee covers the cost of processing your payment through the hosted checkout provider.`}),children:O?.processingFeeUsd?`− ${O.processingFeeUsd.formatted}`:``}),f(o.DetailsRow,{label:f(e,{id:`y62Dys`,message:`Network fee`}),info:f(e,{id:`f-nEg4`,message:`The network fee is paid to miners and validators of the blockchain to make sure the transaction is processed and confirmed.`}),children:O?.networkFeeUsd?`− ${O.networkFeeUsd.formatted}`:``})]})]}),f(o.Footer,{children:f(o.Notice,{})})]})})}function g({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return f(a,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:f(h,{...i})})}(function(e){e.Dialog=g,e.HeroLabel=o.HeroLabel,e.ReceiveChip=o.ReceiveChip,e.Header=o.Header,e.Body=o.Body,e.Hero=o.Hero,e.Pills=o.Pills,e.Flow=o.Flow,e.Footer=o.Footer,e.Notice=o.Notice,e.Details=o.Details,e.DetailsRow=o.DetailsRow})(h||={});export{h as OnrampAmountEntry};
@@ -0,0 +1,62 @@
1
+ import { AmountEntryBodyProps } from "../../../../../shared/widgets/amount-entry/compound/types.js";
2
+ import { AmountEntryHeader } from "../../../../../shared/widgets/amount-entry/compound/components/Header.js";
3
+ import { AmountEntryDetails, AmountEntryDetailsRow } from "../../../../../shared/widgets/amount-entry/compound/components/Details.js";
4
+ import { AmountEntryFlow } from "../../../../../shared/widgets/amount-entry/compound/components/Flow.js";
5
+ import { AmountEntryFooter } from "../../../../../shared/widgets/amount-entry/compound/components/Footer.js";
6
+ import { AmountEntryHero } from "../../../../../shared/widgets/amount-entry/compound/components/Hero/Hero.js";
7
+ import { AmountEntryNotice } from "../../../../../shared/widgets/amount-entry/compound/components/Notice.js";
8
+ import { AmountEntryPills } from "../../../../../shared/widgets/amount-entry/compound/components/Pills.js";
9
+ import { OnrampAmountEntryDialogProps, OnrampAmountEntryHeroLabelProps, OnrampAmountEntryProps } from "./types.js";
10
+ import { OnrampAmountEntryHeroLabel } from "./components/HeroLabel.js";
11
+ import { OnrampAmountEntryReceiveChip } from "./components/ReceiveChip.js";
12
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
13
+
14
+ //#region src/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.d.ts
15
+ /**
16
+ * Root of the OnrampAmountEntry compound. Wraps the shared {@link AmountEntryCompound} and provides
17
+ * onramp-flow-specific context (formattedReceive, receiveToken, loading) to the onramp-flow-internal
18
+ * sub-parts (`HeroLabel`, `ReceiveChip`) so children render without prop-drilling from the host.
19
+ *
20
+ * Defaults the `subLine` slot to a `<OnrampAmountEntry.ReceiveChip />` when the host doesn't provide
21
+ * one explicitly — that's the canonical composition. Pass `subLine={…}` to override.
22
+ *
23
+ * Parts:
24
+ * - {@link OnrampAmountEntry.HeroLabel}
25
+ * - {@link OnrampAmountEntry.ReceiveChip}
26
+ *
27
+ * The AmountEntry compound parts (`Header`, `Body`, `Hero`, `Pills`, `Details`, `DetailsRow`,
28
+ * `Notice`, `Footer`) are re-exposed off the namespace too so consumers can compose the full tree
29
+ * without importing two compounds.
30
+ *
31
+ * Dialog form: {@link OnrampAmountEntry.Dialog} pre-composes the widget into a dialog shell.
32
+ */
33
+ declare function OnrampAmountEntry(props: OnrampAmountEntryProps): _$react_jsx_runtime0.JSX.Element;
34
+ declare function OnrampAmountEntryDialog({
35
+ open,
36
+ defaultOpen,
37
+ onOpenChange,
38
+ trigger,
39
+ children,
40
+ ...rootProps
41
+ }: OnrampAmountEntryDialogProps): _$react_jsx_runtime0.JSX.Element;
42
+ declare namespace OnrampAmountEntry {
43
+ type Props = OnrampAmountEntryProps;
44
+ type HeroLabelProps = OnrampAmountEntryHeroLabelProps;
45
+ type DialogProps = OnrampAmountEntryDialogProps;
46
+ /** Onramp-flow-specific sub-parts. */
47
+ const HeroLabel: typeof OnrampAmountEntryHeroLabel;
48
+ const ReceiveChip: typeof OnrampAmountEntryReceiveChip;
49
+ /** AmountEntry compound parts re-exposed for one-stop composition. */
50
+ const Header: typeof AmountEntryHeader;
51
+ const Body: (props: AmountEntryBodyProps) => _$react_jsx_runtime0.JSX.Element;
52
+ const Hero: typeof AmountEntryHero;
53
+ const Pills: typeof AmountEntryPills;
54
+ const Flow: typeof AmountEntryFlow;
55
+ const Footer: typeof AmountEntryFooter;
56
+ const Notice: typeof AmountEntryNotice;
57
+ const Details: typeof AmountEntryDetails;
58
+ const DetailsRow: typeof AmountEntryDetailsRow;
59
+ const Dialog: typeof OnrampAmountEntryDialog;
60
+ }
61
+ //#endregion
62
+ export { OnrampAmountEntry };
@@ -0,0 +1 @@
1
+ "use client";import{DialogShell as e}from"../../../../../shared/dialog/DialogShell.js";import{AmountEntry as t}from"../../../../../shared/widgets/amount-entry/compound/AmountEntry.js";import"../../../../../shared/widgets/amount-entry/compound/index.js";import{OnrampAmountEntryHeroLabel as n}from"./components/HeroLabel.js";import{OnrampAmountEntryContext as r}from"./context.js";import{OnrampAmountEntryReceiveChip as i}from"./components/ReceiveChip.js";import{useMemo as a}from"react";import{jsx as o}from"react/jsx-runtime";const s=o(i,{});function c(e){let{formattedReceive:n,onrampReceiveToken:i,quoteLoading:c=!1,subLine:l,children:u,...d}=e;return o(r,{value:a(()=>({formattedReceive:n,receiveToken:i,loading:c}),[n,i,c]),children:o(t,{...d,subLine:l??s,children:u})})}function l({open:t,defaultOpen:n,onOpenChange:r,trigger:i,children:a,...s}){return o(e,{open:t,defaultOpen:n,onOpenChange:r,trigger:i,children:o(c,{...s,children:a})})}(function(e){e.HeroLabel=n,e.ReceiveChip=i,e.Header=t.Header,e.Body=t.Body,e.Hero=t.Hero,e.Pills=t.Pills,e.Flow=t.Flow,e.Footer=t.Footer,e.Notice=t.Notice,e.Details=t.Details,e.DetailsRow=t.DetailsRow,e.Dialog=l})(c||={});export{c as OnrampAmountEntry};
@@ -0,0 +1,14 @@
1
+ //#region src/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.slots.d.ts
2
+ /**
3
+ * `data-stridge-slot` constants for the onramp-amount-entry widget's onramp-flow-internal sub-parts
4
+ * (hero label, receive chip). The amount-input chrome itself stamps the shared `AMOUNT_ENTRY_SLOTS`
5
+ * from `#/shared/widgets/amount-entry`; this file only covers the onramp additions.
6
+ */
7
+ declare const ONRAMP_AMOUNT_ENTRY_SLOTS: {
8
+ readonly root: "onramp-amount-entry";
9
+ readonly heroLabel: "onramp-amount-entry-hero-label";
10
+ readonly receiveChip: "onramp-amount-entry-receive-chip";
11
+ };
12
+ type OnrampAmountEntrySlot = (typeof ONRAMP_AMOUNT_ENTRY_SLOTS)[keyof typeof ONRAMP_AMOUNT_ENTRY_SLOTS];
13
+ //#endregion
14
+ export { ONRAMP_AMOUNT_ENTRY_SLOTS, OnrampAmountEntrySlot };