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

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 (295) 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 +21 -10
  8. package/dist/deposit/compound/index.js +1 -1
  9. package/dist/deposit/widgets/index.d.ts +6 -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 +206 -20
  22. package/dist/flows/deposit/driver/types.d.ts +106 -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 +202 -66
  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/shared/onrampError.js +1 -0
  30. package/dist/flows/deposit/widgets/amount-entry/AmountEntry.js +1 -1
  31. package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
  32. package/dist/flows/deposit/widgets/deposit/compound/Deposit.d.ts +5 -5
  33. package/dist/flows/deposit/widgets/deposit/compound/components/Guards.js +1 -1
  34. package/dist/flows/deposit/widgets/deposit/compound/components/Methods.d.ts +1 -2
  35. package/dist/flows/deposit/widgets/deposit/compound/components/RailPicker.js +1 -1
  36. package/dist/flows/deposit/widgets/deposit/compound/types.d.ts +9 -9
  37. package/dist/flows/deposit/widgets/error-state/ErrorState.js +1 -1
  38. package/dist/flows/deposit/widgets/onramp-amount-entry/OnrampAmountEntry.d.ts +68 -0
  39. package/dist/flows/deposit/widgets/onramp-amount-entry/OnrampAmountEntry.js +1 -0
  40. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.d.ts +66 -0
  41. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.js +1 -0
  42. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.slots.d.ts +21 -0
  43. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.slots.js +1 -0
  44. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.styles.js +1 -0
  45. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/CurrencyChip.d.ts +12 -0
  46. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/CurrencyChip.js +1 -0
  47. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/HeroLabel.d.ts +13 -0
  48. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/HeroLabel.js +1 -0
  49. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/ProviderCard.d.ts +12 -0
  50. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/ProviderCard.js +1 -0
  51. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/ReceiveChip.d.ts +14 -0
  52. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/ReceiveChip.js +1 -0
  53. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/context.d.ts +14 -0
  54. package/dist/flows/deposit/widgets/{cash-amount-entry → onramp-amount-entry}/compound/context.js +1 -1
  55. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/index.d.ts +4 -0
  56. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/index.js +1 -0
  57. package/dist/flows/deposit/widgets/onramp-amount-entry/compound/types.d.ts +40 -0
  58. package/dist/flows/deposit/widgets/onramp-amount-entry/index.d.ts +1 -0
  59. package/dist/flows/deposit/widgets/onramp-amount-entry/index.js +1 -0
  60. package/dist/flows/deposit/widgets/onramp-confirm/OnrampConfirm.d.ts +52 -0
  61. package/dist/flows/deposit/widgets/onramp-confirm/OnrampConfirm.js +1 -0
  62. package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.d.ts +44 -0
  63. package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.js +1 -0
  64. package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.slots.d.ts +31 -0
  65. package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.slots.js +1 -0
  66. package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.styles.js +1 -0
  67. package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Body.d.ts +16 -0
  68. package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Body.js +1 -0
  69. package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Disclaimer.d.ts +21 -0
  70. package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Disclaimer.js +1 -0
  71. package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Header.d.ts +15 -0
  72. package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Header.js +1 -0
  73. package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Summary.d.ts +15 -0
  74. package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Summary.js +1 -0
  75. package/dist/flows/deposit/widgets/onramp-confirm/compound/context.d.ts +46 -0
  76. package/dist/flows/deposit/widgets/{cash-confirm → onramp-confirm}/compound/context.js +1 -1
  77. package/dist/flows/deposit/widgets/onramp-confirm/compound/index.d.ts +4 -0
  78. package/dist/flows/deposit/widgets/onramp-confirm/compound/index.js +1 -0
  79. package/dist/flows/deposit/widgets/onramp-confirm/compound/types.d.ts +67 -0
  80. package/dist/flows/deposit/widgets/onramp-confirm/index.d.ts +1 -0
  81. package/dist/flows/deposit/widgets/onramp-confirm/index.js +1 -0
  82. package/dist/flows/deposit/widgets/onramp-currency-picker/OnrampCurrencyPicker.d.ts +39 -0
  83. package/dist/flows/deposit/widgets/onramp-currency-picker/OnrampCurrencyPicker.js +1 -0
  84. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/OnrampCurrencyPicker.d.ts +37 -0
  85. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/OnrampCurrencyPicker.js +1 -0
  86. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/OnrampCurrencyPicker.slots.d.ts +17 -0
  87. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/OnrampCurrencyPicker.slots.js +1 -0
  88. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/OnrampCurrencyPicker.styles.js +1 -0
  89. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/Body.d.ts +6 -0
  90. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/Body.js +1 -0
  91. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/CurrencyRow.d.ts +12 -0
  92. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/CurrencyRow.js +1 -0
  93. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/Empty.js +1 -0
  94. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/Header.d.ts +10 -0
  95. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/Header.js +1 -0
  96. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/Search.d.ts +6 -0
  97. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/Search.js +1 -0
  98. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/context.js +1 -0
  99. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/index.d.ts +3 -0
  100. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/index.js +1 -0
  101. package/dist/flows/deposit/widgets/onramp-currency-picker/compound/types.d.ts +48 -0
  102. package/dist/flows/deposit/widgets/onramp-currency-picker/index.d.ts +1 -0
  103. package/dist/flows/deposit/widgets/onramp-currency-picker/index.js +1 -0
  104. package/dist/flows/deposit/widgets/onramp-payment-pending/OnrampPaymentPending.d.ts +50 -0
  105. package/dist/flows/deposit/widgets/onramp-payment-pending/OnrampPaymentPending.js +1 -0
  106. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.d.ts +68 -0
  107. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.js +1 -0
  108. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.slots.d.ts +17 -0
  109. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.slots.js +1 -0
  110. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/components/Flow.d.ts +13 -0
  111. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/components/Flow.js +1 -0
  112. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/components/Flow.styles.js +1 -0
  113. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/components/ReopenButton.d.ts +11 -0
  114. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/components/ReopenButton.js +1 -0
  115. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/context.d.ts +32 -0
  116. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/context.js +1 -0
  117. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/index.d.ts +3 -0
  118. package/dist/flows/deposit/widgets/onramp-payment-pending/compound/index.js +1 -0
  119. package/dist/flows/deposit/widgets/onramp-payment-pending/index.d.ts +1 -0
  120. package/dist/flows/deposit/widgets/onramp-payment-pending/index.js +1 -0
  121. package/dist/flows/deposit/widgets/onramp-provider-picker/OnrampProviderPicker.d.ts +38 -0
  122. package/dist/flows/deposit/widgets/onramp-provider-picker/OnrampProviderPicker.js +1 -0
  123. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/OnrampProviderPicker.d.ts +35 -0
  124. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/OnrampProviderPicker.js +1 -0
  125. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/OnrampProviderPicker.slots.d.ts +19 -0
  126. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/OnrampProviderPicker.slots.js +1 -0
  127. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/OnrampProviderPicker.styles.js +1 -0
  128. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/components/Body.d.ts +6 -0
  129. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/components/Body.js +1 -0
  130. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/components/Header.d.ts +10 -0
  131. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/components/Header.js +1 -0
  132. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/components/ProviderRow.d.ts +15 -0
  133. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/components/ProviderRow.js +1 -0
  134. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/context.js +1 -0
  135. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/index.d.ts +3 -0
  136. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/index.js +1 -0
  137. package/dist/flows/deposit/widgets/onramp-provider-picker/compound/types.d.ts +50 -0
  138. package/dist/flows/deposit/widgets/onramp-provider-picker/index.d.ts +1 -0
  139. package/dist/flows/deposit/widgets/onramp-provider-picker/index.js +1 -0
  140. package/dist/flows/deposit/widgets/success-state/SuccessState.js +1 -1
  141. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.js +1 -1
  142. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.js +1 -1
  143. package/dist/format/index.d.ts +2 -1
  144. package/dist/format/index.js +1 -1
  145. package/dist/i18n/locales/ar.js +1 -1
  146. package/dist/i18n/locales/es.js +1 -1
  147. package/dist/i18n/locales/source-keys.d.ts +1 -1
  148. package/dist/icons/index.d.ts +4 -8
  149. package/dist/icons/index.js +1 -1
  150. package/dist/index.d.ts +3 -4
  151. package/dist/index.js +1 -1
  152. package/dist/package.js +1 -1
  153. package/dist/shared/attribution/Attribution.js +1 -1
  154. package/dist/shared/attribution/Attribution.styles.js +1 -1
  155. package/dist/shared/dialog/Frame.js +1 -1
  156. package/dist/shared/format/formatFiat.d.ts +31 -0
  157. package/dist/shared/format/formatFiat.js +1 -0
  158. package/dist/shared/icons/BellIcon.d.ts +7 -0
  159. package/dist/shared/icons/BellIcon.js +1 -0
  160. package/dist/shared/icons/BitcoinIcon.d.ts +5 -8
  161. package/dist/shared/icons/BitcoinIcon.js +1 -1
  162. package/dist/shared/icons/CardIcon.d.ts +3 -3
  163. package/dist/shared/icons/DirhamSignIcon.d.ts +16 -0
  164. package/dist/shared/icons/DirhamSignIcon.js +1 -0
  165. package/dist/shared/icons/SearchIcon.d.ts +7 -0
  166. package/dist/shared/icons/SearchIcon.js +1 -0
  167. package/dist/shared/orchestrator/index.js +1 -1
  168. package/dist/shared/orchestrator/useOnrampSessionWatcher.js +1 -0
  169. package/dist/shared/ui/AmountInput/useAutoShrinkFontSize.js +1 -1
  170. package/dist/shared/ui/Checkbox/Checkbox.d.ts +47 -0
  171. package/dist/shared/ui/Checkbox/Checkbox.js +1 -0
  172. package/dist/shared/ui/Checkbox/Checkbox.slots.d.ts +12 -0
  173. package/dist/shared/ui/Checkbox/Checkbox.slots.js +1 -0
  174. package/dist/shared/ui/Checkbox/Checkbox.styles.js +1 -0
  175. package/dist/shared/ui/Checkbox/index.d.ts +2 -0
  176. package/dist/shared/ui/Checkbox/index.js +1 -0
  177. package/dist/shared/ui/CurrencyGlyph/CurrencyGlyph.d.ts +36 -0
  178. package/dist/shared/ui/CurrencyGlyph/CurrencyGlyph.js +1 -0
  179. package/dist/shared/ui/CurrencyGlyph/CurrencyGlyph.slots.d.ts +12 -0
  180. package/dist/shared/ui/CurrencyGlyph/CurrencyGlyph.slots.js +1 -0
  181. package/dist/shared/ui/CurrencyGlyph/CurrencyGlyph.styles.js +1 -0
  182. package/dist/shared/ui/CurrencyGlyph/flags.js +1 -0
  183. package/dist/shared/ui/CurrencyGlyph/index.d.ts +2 -0
  184. package/dist/shared/ui/CurrencyGlyph/index.js +1 -0
  185. package/dist/shared/ui/DisclosureRow/DisclosureRow.d.ts +56 -0
  186. package/dist/shared/ui/DisclosureRow/DisclosureRow.js +1 -0
  187. package/dist/shared/ui/DisclosureRow/DisclosureRow.slots.d.ts +8 -0
  188. package/dist/shared/ui/DisclosureRow/DisclosureRow.slots.js +1 -0
  189. package/dist/shared/ui/DisclosureRow/DisclosureRow.styles.js +1 -0
  190. package/dist/shared/ui/DisclosureRow/index.d.ts +2 -0
  191. package/dist/shared/ui/DisclosureRow/index.js +1 -0
  192. package/dist/shared/ui/FiatSymbol/FiatAmount.d.ts +32 -0
  193. package/dist/shared/ui/FiatSymbol/FiatAmount.js +1 -0
  194. package/dist/shared/ui/FiatSymbol/FiatSymbol.d.ts +30 -0
  195. package/dist/shared/ui/FiatSymbol/FiatSymbol.js +1 -0
  196. package/dist/shared/ui/FiatSymbol/index.d.ts +2 -0
  197. package/dist/shared/ui/FiatSymbol/index.js +1 -0
  198. package/dist/shared/ui/Tabs/Tabs.d.ts +2 -2
  199. package/dist/shared/utils/logos/resolveLogoSrc.js +1 -1
  200. package/dist/shared/widgets/activity/compound/ActivityDetail.js +1 -1
  201. package/dist/shared/widgets/amount-entry/compound/AmountEntry.js +1 -1
  202. package/dist/shared/widgets/amount-entry/compound/AmountEntry.styles.js +1 -1
  203. package/dist/shared/widgets/amount-entry/compound/components/Footer.js +1 -1
  204. package/dist/shared/widgets/amount-entry/compound/components/Hero/Hero.d.ts +2 -1
  205. package/dist/shared/widgets/amount-entry/compound/components/Hero/Hero.js +1 -1
  206. package/dist/shared/widgets/amount-entry/compound/components/Hero/StaticBand.js +1 -1
  207. package/dist/shared/widgets/amount-entry/compound/types.d.ts +16 -0
  208. package/dist/shared/widgets/confirm-transfer/compound/components/Breakdown.js +1 -1
  209. package/dist/shared/widgets/error-state/compound/ErrorState.styles.js +1 -1
  210. package/dist/shared/widgets/error-state/compound/components/MoreDetails.d.ts +3 -3
  211. package/dist/shared/widgets/error-state/compound/components/MoreDetails.js +1 -1
  212. package/dist/shared/widgets/success-state/compound/SuccessState.styles.js +1 -1
  213. package/dist/shared/widgets/success-state/compound/components/MoreDetails.d.ts +2 -3
  214. package/dist/shared/widgets/success-state/compound/components/MoreDetails.js +1 -1
  215. package/dist/stridge/StridgeProvider.d.ts +0 -10
  216. package/dist/stridge/StridgeProvider.js +1 -1
  217. package/dist/stridge/stubs.js +1 -1
  218. package/dist/styles/index.css +118 -40
  219. package/dist/types.d.ts +3 -3
  220. package/dist/ui/index.d.ts +9 -1
  221. package/dist/ui/index.js +1 -1
  222. package/dist/version.js +1 -1
  223. package/dist/withdraw/compound/index.js +1 -1
  224. package/package.json +1 -1
  225. package/dist/flows/deposit/bindings/DepositBindings.d.ts +0 -87
  226. package/dist/flows/deposit/bindings/DepositBindings.js +0 -1
  227. package/dist/flows/deposit/bindings/index.d.ts +0 -1
  228. package/dist/flows/deposit/bindings/index.js +0 -1
  229. package/dist/flows/deposit/shared/cash.d.ts +0 -20
  230. package/dist/flows/deposit/shared/cash.js +0 -1
  231. package/dist/flows/deposit/widgets/cash-amount-entry/CashAmountEntry.d.ts +0 -71
  232. package/dist/flows/deposit/widgets/cash-amount-entry/CashAmountEntry.js +0 -1
  233. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.d.ts +0 -69
  234. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.js +0 -1
  235. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.slots.d.ts +0 -16
  236. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.slots.js +0 -1
  237. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.styles.js +0 -1
  238. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/HeroLabel.d.ts +0 -13
  239. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/HeroLabel.js +0 -1
  240. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/MethodChip.d.ts +0 -18
  241. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/MethodChip.js +0 -1
  242. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/ReceiveChip.d.ts +0 -14
  243. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/ReceiveChip.js +0 -1
  244. package/dist/flows/deposit/widgets/cash-amount-entry/compound/index.d.ts +0 -3
  245. package/dist/flows/deposit/widgets/cash-amount-entry/compound/index.js +0 -1
  246. package/dist/flows/deposit/widgets/cash-amount-entry/compound/types.d.ts +0 -42
  247. package/dist/flows/deposit/widgets/cash-amount-entry/index.d.ts +0 -1
  248. package/dist/flows/deposit/widgets/cash-amount-entry/index.js +0 -1
  249. package/dist/flows/deposit/widgets/cash-confirm/CashConfirm.d.ts +0 -63
  250. package/dist/flows/deposit/widgets/cash-confirm/CashConfirm.js +0 -1
  251. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.d.ts +0 -54
  252. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.js +0 -1
  253. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.slots.d.ts +0 -33
  254. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.slots.js +0 -1
  255. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.styles.js +0 -1
  256. package/dist/flows/deposit/widgets/cash-confirm/compound/cashConfirmDimensions.js +0 -1
  257. package/dist/flows/deposit/widgets/cash-confirm/compound/components/ApplePayBody.d.ts +0 -15
  258. package/dist/flows/deposit/widgets/cash-confirm/compound/components/ApplePayBody.js +0 -1
  259. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Body.d.ts +0 -22
  260. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Body.js +0 -1
  261. package/dist/flows/deposit/widgets/cash-confirm/compound/components/BodyLabel.js +0 -1
  262. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardBody.d.ts +0 -16
  263. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardBody.js +0 -1
  264. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.icons.js +0 -1
  265. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.js +0 -1
  266. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.keys.js +0 -1
  267. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.state.js +0 -1
  268. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.styles.js +0 -1
  269. package/dist/flows/deposit/widgets/cash-confirm/compound/components/GooglePayBody.d.ts +0 -16
  270. package/dist/flows/deposit/widgets/cash-confirm/compound/components/GooglePayBody.js +0 -1
  271. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Header.d.ts +0 -21
  272. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Header.js +0 -1
  273. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Summary.d.ts +0 -17
  274. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Summary.js +0 -1
  275. package/dist/flows/deposit/widgets/cash-confirm/compound/components/cardFormat.js +0 -1
  276. package/dist/flows/deposit/widgets/cash-confirm/compound/index.d.ts +0 -3
  277. package/dist/flows/deposit/widgets/cash-confirm/compound/index.js +0 -1
  278. package/dist/flows/deposit/widgets/cash-confirm/compound/types.d.ts +0 -66
  279. package/dist/flows/deposit/widgets/cash-confirm/index.d.ts +0 -1
  280. package/dist/flows/deposit/widgets/cash-confirm/index.js +0 -1
  281. package/dist/flows/deposit/widgets/cash-confirm/mocks.js +0 -1
  282. package/dist/shared/icons/AmexIcon.d.ts +0 -14
  283. package/dist/shared/icons/AmexIcon.js +0 -1
  284. package/dist/shared/icons/ApplePayIcon.d.ts +0 -15
  285. package/dist/shared/icons/ApplePayIcon.js +0 -1
  286. package/dist/shared/icons/CashIcon.d.ts +0 -16
  287. package/dist/shared/icons/CashIcon.js +0 -1
  288. package/dist/shared/icons/DiscoverIcon.d.ts +0 -14
  289. package/dist/shared/icons/DiscoverIcon.js +0 -1
  290. package/dist/shared/icons/GooglePayIcon.d.ts +0 -15
  291. package/dist/shared/icons/GooglePayIcon.js +0 -1
  292. package/dist/shared/icons/MastercardIcon.d.ts +0 -16
  293. package/dist/shared/icons/MastercardIcon.js +0 -1
  294. package/dist/shared/icons/VisaIcon.d.ts +0 -15
  295. package/dist/shared/icons/VisaIcon.js +0 -1
@@ -1 +1 @@
1
- "use client";import{useOptionalActivityDriverInstance as e}from"../../activity/driver/context.js";import{useLingui as t}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{toFailure as n}from"../../../shared/orchestrator/toFailure.js";import{useDriverSettlementListener as r}from"../../../shared/orchestrator/useDriverSettlementListener.js";import{useEffectiveState as i}from"../../../shared/orchestrator/useEffectiveState.js";import{isUserRejectionFailure as a}from"../../../shared/orchestrator/userRejection.js";import{useSettlementWatcher as o}from"../../../shared/orchestrator/useSettlementWatcher.js";import"../../../shared/orchestrator/index.js";import{useDepositDriverInstance as s}from"../driver/context.js";import{initialState as c,reducer as l}from"./reducer.js";import{resolveAssetById as u}from"./resolveAssetById.js";import{createContext as d,use as f,useCallback as p,useEffect as m,useMemo as h,useReducer as g,useRef as _}from"react";import{jsx as v}from"react/jsx-runtime";const y={id:`ELhVSL`,message:`Failed to submit deposit.`},b={id:`Ej5HL9`,message:`Signature declined. Please try again.`},x=d(null);x.displayName=`GatewayControllerStateContext`;const S=d(null);S.displayName=`GatewayControllerStableContext`;function C(){let e=f(x),t=f(S);if(!e||!t)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return{...e,...t}}function w(){let e=f(S);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e}function T(){return f(S)}const E=d(void 0);E.displayName=`DepositMethodsConfigContext`;function D(){return f(E)}const O=d(!1);O.displayName=`CashRailUnlockedContext`;function k(){return f(O)}function A(e){let t=D();return h(()=>t?e.filter(e=>e.value===`cash`?t.cashRail?.disabled!==!0:!0):e,[e,t])}function j(){let e=f(x);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e.state}function M(){let e=f(x);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e.effectiveState}function N(){return w().actions}function P({methodsConfig:t,cashRailUnlocked:n=!1,children:r}){let a=s(),o=e(),[u,d]=g(l,c),f=I(u,d,a,o);L(u,d,a),R(u,d,a,o);let p=i(u),m=F(u,d,a,f,t);return v(E,{value:t,children:v(O,{value:n,children:v(S,{value:h(()=>({dispatch:d,controller:m,actions:f}),[d,m,f]),children:v(x,{value:h(()=>({state:u,effectiveState:p}),[u,p]),children:r})})})})}function F(e,t,n,r,i){let a=_(n);a.current=n;let o=_(i);o.current=i;let s=p(e=>{if(!e)return a.current.arm(),t({type:`OPEN`,input:void 0}),!0;if(o.current?.[e.method]?.disabled)return!1;if(e.method===`transfer`)return a.current.arm(),t({type:`OPEN`,input:{method:`transfer`}}),!0;if(e.method===`wallet`&&e.assetId!==void 0){let n=u(a.current.getSnapshot(),e.assetId);return a.current.arm(),n?(t({type:`OPEN`,input:{method:`wallet`,asset:n}}),!0):(t({type:`OPEN`,input:{method:`wallet`}}),!0)}return a.current.arm(),t({type:`OPEN`,input:{method:`wallet`}}),!0},[t]),c=p(()=>{t({type:`CLOSE`})},[t]);return h(()=>({open:s,close:c,actions:r}),[s,c,r])}function I(e,r,i,o){let s=_(e);s.current=e;let c=_(i);c.current=i;let l=_(o);l.current=o;let u=_(r);u.current=r;let{i18n:d}=t(),f=_(d);f.current=d;let m=p((e,t)=>{let r=c.current,i=new AbortController,o=B(e,t);r.submitDeposit(o,i.signal).then(e=>{if(!i.signal.aborted){try{r.invalidateBalances?.()}catch{}try{l.current?.invalidateActivity?.()}catch{}u.current({type:`DEPOSIT_SUBMITTED`,tx:e})}}).catch(e=>{if(i.signal.aborted)return;let t=n(e,f.current._(y));if(a(t)){u.current({type:`DEPOSIT_SIGNATURE_DECLINED`,notice:f.current._(b)});return}u.current({type:`DEPOSIT_SUBMISSION_FAILED`,failure:t})})},[]),g=p(e=>{u.current({type:`DEPOSIT_METHOD_SELECTED`,method:e})},[]),v=p(e=>{u.current({type:`CASH_METHOD_SELECTED`,cashMethod:e})},[]),x=p(e=>{u.current({type:`CASH_AMOUNT_CONFIRMED`,amount:e})},[]),S=p(()=>{u.current({type:`CASH_METHOD_READY`})},[]),C=p(e=>{u.current({type:`ASSET_CONFIRMED`,asset:e})},[]),w=p(e=>{s.current.name===`amountEntry`&&u.current({type:`AMOUNT_CONFIRMED`,amount:e})},[]),T=p(()=>{let e=s.current;if(e.name!==`confirmDeposit`)return;let t=e.ctx.phase;if(t.kind===`failed`){u.current({type:`QUOTE_RETRY`});return}if(t.kind!==`ready`)return;let{asset:n,amount:r}=e.ctx;u.current({type:`DEPOSIT_CONFIRMED`}),m(n,r)},[m]),E=p(()=>{u.current({type:`BACK`})},[]),D=p(()=>{u.current({type:`CLOSE`})},[]),O=p(()=>{u.current({type:`SUCCESS_DONE`})},[]),k=p(()=>{u.current({type:`ERROR_TRY_AGAIN`})},[]),A=p((e,t)=>{u.current({type:`RESUME_TO_PROCESSING`,method:e,tx:t})},[]),j=p((e,t)=>{u.current({type:`RESUME_TO_SUCCESS`,method:e,tx:t})},[]),M=p(e=>{u.current({type:`RESUME_TO_ERROR`,...e?{tx:e}:{}})},[]),N=p(()=>{if(l.current==null){process.env.NODE_ENV!==`production`&&console.warn("[@stridge/kit] useDepositActions().openActivity() was called but no activity driver is mounted. Wrap the host with `<KitProvider activity={…}>` (or `<StridgeProvider>` with any flow enabled) to enable the activity surface.");return}let e=s.current;e.name!==`deposit`&&e.name!==`assetPicker`&&e.name!==`amountEntry`&&e.name!==`transferCrypto`||u.current({type:`OPEN_ACTIVITY`})},[]),P=p(e=>{u.current({type:`SELECT_SETTLEMENT`,settlementId:e})},[]);return h(()=>({selectMethod:g,selectCashMethod:v,confirmCashAmount:x,cashMethodReady:S,confirmAsset:C,confirmAmount:w,confirmDeposit:T,back:E,close:D,successDone:O,tryAgain:k,resumeToProcessing:A,resumeToSuccess:j,resumeToError:M,openActivity:N,selectSettlement:P}),[g,v,x,S,C,w,T,E,D,O,k,A,j,M,N,P])}function L(e,t,r){m(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`loading`&&e.ctx.phase.kind!==`regenerating`)return;let i=new AbortController,a=z(e.ctx.asset,e.ctx.amount);return r.requestQuote(a,i.signal).catch(e=>{i.signal.aborted||t({type:`QUOTE_FAILED`,failure:n(e,`Failed to fetch quote.`)})}),()=>i.abort()},[e.name,e.name===`confirmDeposit`?e.ctx.phase.kind:void 0,e.name===`confirmDeposit`?e.ctx.asset:void 0,e.name===`confirmDeposit`?e.ctx.amount:void 0,r,t]),m(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`ready`)return;let n=e.ctx.phase.quoteExpiresAt,r=Math.max(0,n-Date.now()),i=setTimeout(()=>{t({type:`QUOTE_EXPIRED`})},r);return()=>clearTimeout(i)},[e.name,e.name===`confirmDeposit`&&e.ctx.phase.kind===`ready`?e.ctx.phase.quoteExpiresAt:void 0,t])}function R(e,t,n,i){let a=_(i);a.current=i;let s=e.name===`processing`?e.ctx.tx:void 0;o(n,s?{tx:s}:void 0,s?.hash),m(()=>{if(e.name!==`transferCrypto`||!n.watchSourceTx)return;let t=new AbortController,r;return n.watchSourceTx({},e=>{if(!t.signal.aborted&&!r){r=new AbortController,n.watchSettlement({tx:e},()=>{},r.signal);try{a.current?.invalidateActivity?.()}catch{}}},t.signal),()=>{t.abort(),r?.abort()}},[e.name,n]);let c=e.name===`activityList`||e.name===`activityDetail`;m(()=>{if(!c||!i)return;let e=new AbortController;return i.watchActivity(e.signal),()=>e.abort()},[c,i]),m(()=>{if(e.name===`closed`||e.name===`transferCrypto`||e.name===`processing`||c||!n.fetchActiveSettlement)return;let t=new AbortController,r,i,a=!1,o=async()=>{try{let e=await n.fetchActiveSettlement({},t.signal);if(a)return;if(e&&!r&&e.payload.kind===`pending`){let t=e.payload.txHash?.value;t&&(r=new AbortController,n.watchSettlement({tx:{hash:t}},()=>{},r.signal))}}catch{}a||(i=setTimeout(o,5e3))};return o(),()=>{a=!0,t.abort(),r?.abort(),i&&clearTimeout(i)}},[e.name,c,n]);let l=_(e);l.current=e,r(n,e=>{if(e===`pending`||e===`succeeded`||e===`failed`)try{n.invalidateBalances?.()}catch{}l.current.name===`processing`&&(e===`succeeded`?t({type:`PROCESSING_SUCCEEDED`}):e===`failed`&&t({type:`PROCESSING_FAILED`}))});let u=_(null);m(()=>{let e=()=>{let e=n.getSnapshot(),r=l.current,i=e.quote;i.status!==u.current&&(u.current=i.status,i.status===`ready`&&r.name===`confirmDeposit`?(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_RESOLVED`,expiresAt:i.payload.expiresAt}):i.status===`error`&&r.name===`confirmDeposit`&&(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_FAILED`,failure:{reason:i.error.message,code:i.error.name,cause:i.error}}))},r=n.subscribe(e);return e(),r},[n,t])}function z(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build quote input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceTokenSymbol:e.symbol,sourceIsNative:e.isNative,amount:t,...e.priceUsd===void 0?{}:{sourcePriceUsd:e.priceUsd}}}function B(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build submit input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceIsNative:e.isNative,amount:t}}export{P as GatewayController,k as useCashRailUnlocked,C as useControllerContext,N as useDepositActions,M as useDepositEffectiveState,D as useDepositMethodsConfig,j as useDepositState,A as useEnabledRails,T as useOptionalStableControllerContext,w as useStableControllerContext};
1
+ "use client";import{useOptionalActivityDriverInstance as e}from"../../activity/driver/context.js";import{useLingui as t}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{toFailure as n}from"../../../shared/orchestrator/toFailure.js";import{useDriverSettlementListener as r}from"../../../shared/orchestrator/useDriverSettlementListener.js";import{useEffectiveState as i}from"../../../shared/orchestrator/useEffectiveState.js";import{useOnrampSessionWatcher as a}from"../../../shared/orchestrator/useOnrampSessionWatcher.js";import{isUserRejectionFailure as o}from"../../../shared/orchestrator/userRejection.js";import{useSettlementWatcher as s}from"../../../shared/orchestrator/useSettlementWatcher.js";import"../../../shared/orchestrator/index.js";import{useDepositDriverInstance as c}from"../driver/context.js";import{openCheckoutPopup as l}from"../shared/checkoutPopup.js";import{initialState as u,reducer as d}from"./reducer.js";import{resolveAssetById as f}from"./resolveAssetById.js";import{createContext as p,use as m,useCallback as h,useEffect as g,useMemo as _,useReducer as v,useRef as y}from"react";import{jsx as b}from"react/jsx-runtime";const x={id:`ELhVSL`,message:`Failed to submit deposit.`},S={id:`Ej5HL9`,message:`Signature declined. Please try again.`},C={id:`Z0UMar`,message:`Failed to fetch quote.`},w={id:`9d3cBd`,message:`Failed to open the payment window. Please try again.`},T=p(null);T.displayName=`GatewayControllerStateContext`;const E=p(null);E.displayName=`GatewayControllerStableContext`;function D(){let e=m(T),t=m(E);if(!e||!t)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return{...e,...t}}function O(){let e=m(E);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e}function k(){return m(E)}const A=p(void 0);A.displayName=`DepositMethodsConfigContext`;function j(){return m(A)}function M(e){let t=j();return _(()=>t?e.filter(e=>e.value===`onramp`?t.onrampRail?.disabled!==!0:!0):e,[e,t])}function N(){let e=m(T);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e.state}function P(){let e=m(T);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e.effectiveState}function F(){return O().actions}function I({methodsConfig:t,children:n}){let r=c(),a=e(),[o,s]=v(d,u),l=R(o,s,r,a);z(o,s,r),B(o,s,r,a);let f=i(o),p=L(o,s,r,l,t);return b(A,{value:t,children:b(E,{value:_(()=>({dispatch:s,controller:p,actions:l}),[s,p,l]),children:b(T,{value:_(()=>({state:o,effectiveState:f}),[o,f]),children:n})})})}function L(e,t,n,r,i){let a=y(n);a.current=n;let o=y(i);o.current=i;let s=h(e=>{if(!e)return a.current.arm(),t({type:`OPEN`,input:void 0}),!0;if(e.method===`onramp`){let n=o.current?.onrampRail;return n?.enabled===!1||n?.disabled===!0?!1:(a.current.arm(),t({type:`OPEN`,input:{method:`onramp`,...e.amount===void 0?{}:{amount:e.amount},...e.currency===void 0?{}:{currency:e.currency}}}),!0)}if(o.current?.[e.method]?.disabled)return!1;if(e.method===`transfer`)return a.current.arm(),t({type:`OPEN`,input:{method:`transfer`}}),!0;if(e.method===`wallet`&&e.assetId!==void 0){let n=f(a.current.getSnapshot(),e.assetId);return a.current.arm(),n?(t({type:`OPEN`,input:{method:`wallet`,asset:n}}),!0):(t({type:`OPEN`,input:{method:`wallet`}}),!0)}return a.current.arm(),t({type:`OPEN`,input:{method:`wallet`}}),!0},[t]),c=h(()=>{t({type:`CLOSE`})},[t]);return _(()=>({open:s,close:c,actions:r}),[s,c,r])}function R(e,r,i,a){let s=y(e);s.current=e;let c=y(i);c.current=i;let l=y(a);l.current=a;let u=y(r);u.current=r;let{i18n:d}=t(),f=y(d);f.current=d;let p=h((e,t)=>{let r=c.current,i=new AbortController,a=H(e,t);r.submitDeposit(a,i.signal).then(e=>{if(!i.signal.aborted){try{r.invalidateBalances?.()}catch{}try{l.current?.invalidateActivity?.()}catch{}u.current({type:`DEPOSIT_SUBMITTED`,tx:e})}}).catch(e=>{if(i.signal.aborted)return;let t=n(e,f.current._(x));if(o(t)){u.current({type:`DEPOSIT_SIGNATURE_DECLINED`,notice:f.current._(S)});return}u.current({type:`DEPOSIT_SUBMISSION_FAILED`,failure:t})})},[]),m=h(e=>{u.current({type:`DEPOSIT_METHOD_SELECTED`,method:e})},[]),g=h(()=>{u.current({type:`ONRAMP_SELECTED`})},[]),v=h(e=>{s.current.name===`onrampAmountEntry`&&u.current({type:`ONRAMP_AMOUNT_CHANGED`,amount:e})},[]),b=h(e=>{u.current({type:`ONRAMP_AMOUNT_CONFIRMED`,amount:e})},[]),C=h(()=>{s.current.name===`onrampAmountEntry`&&u.current({type:`ONRAMP_CURRENCY_PICKER_OPENED`})},[]),w=h(e=>{let t=s.current.name;t!==`onrampCurrencyPicker`&&t!==`onrampAmountEntry`||u.current({type:`ONRAMP_CURRENCY_SELECTED`,currency:e})},[]),T=h(()=>{s.current.name===`onrampAmountEntry`&&u.current({type:`ONRAMP_PROVIDER_PICKER_OPENED`})},[]),E=h(e=>{s.current.name===`onrampProviderPicker`&&u.current({type:`ONRAMP_PROVIDER_SELECTED`,providerId:e})},[]),D=h(()=>{let e=s.current;if(e.name!==`onrampConfirm`)return;let t=e.ctx.phase;t.kind!==`ready`&&t.kind!==`failed`||u.current({type:`ONRAMP_CONFIRMED`})},[]),O=h(e=>{u.current({type:`ASSET_CONFIRMED`,asset:e})},[]),k=h(e=>{s.current.name===`amountEntry`&&u.current({type:`AMOUNT_CONFIRMED`,amount:e})},[]),A=h(()=>{let e=s.current;if(e.name!==`confirmDeposit`)return;let t=e.ctx.phase;if(t.kind===`failed`){u.current({type:`QUOTE_RETRY`});return}if(t.kind!==`ready`)return;let{asset:n,amount:r}=e.ctx;u.current({type:`DEPOSIT_CONFIRMED`}),p(n,r)},[p]),j=h(()=>{u.current({type:`BACK`})},[]),M=h(()=>{u.current({type:`CLOSE`})},[]),N=h(()=>{u.current({type:`SUCCESS_DONE`})},[]),P=h(()=>{u.current({type:`ERROR_TRY_AGAIN`})},[]),F=h((e,t)=>{u.current({type:`RESUME_TO_PROCESSING`,method:e,tx:t})},[]),I=h((e,t)=>{u.current({type:`RESUME_TO_SUCCESS`,method:e,tx:t})},[]),L=h(e=>{u.current({type:`RESUME_TO_ERROR`,...e?{tx:e}:{}})},[]),R=h(()=>{if(l.current==null){process.env.NODE_ENV!==`production`&&console.warn("[@stridge/kit] useDepositActions().openActivity() was called but no activity driver is mounted. Wrap the host with `<KitProvider activity={…}>` (or `<StridgeProvider>` with any flow enabled) to enable the activity surface.");return}let e=s.current;e.name!==`deposit`&&e.name!==`assetPicker`&&e.name!==`amountEntry`&&e.name!==`transferCrypto`||u.current({type:`OPEN_ACTIVITY`})},[]),z=h(e=>{u.current({type:`SELECT_SETTLEMENT`,settlementId:e})},[]);return _(()=>({selectMethod:m,selectOnramp:g,setOnrampAmount:v,confirmOnrampAmount:b,openOnrampCurrencyPicker:C,selectOnrampCurrency:w,openOnrampProviderPicker:T,selectOnrampProvider:E,confirmOnramp:D,confirmAsset:O,confirmAmount:k,confirmDeposit:A,back:j,close:M,successDone:N,tryAgain:P,resumeToProcessing:F,resumeToSuccess:I,resumeToError:L,openActivity:R,selectSettlement:z}),[m,g,v,b,C,w,T,E,D,O,k,A,j,M,N,P,F,I,L,R,z])}function z(e,r,i){let{i18n:a}=t(),o=y(a);o.current=a;let s=y(null),c=e.name===`onrampAmountEntry`?e.ctx.amount:void 0,u=e.name===`onrampAmountEntry`?e.ctx.currency:void 0;g(()=>{if(e.name!==`onrampAmountEntry`||!i.requestOnrampQuote)return;let t=c;if(t==null||!Number.isFinite(t)||t<=0)return;let n=u??`USD`,r=`${t}|${n}`,a=i.getSnapshot?.().onrampQuote;if(r===s.current&&(a?.status===`ready`||a?.status===`stale`))return;let o=new AbortController,l=setTimeout(()=>{s.current=r,i.requestOnrampQuote?.({amount:t,currency:n},o.signal).catch(()=>{})},400);return()=>{clearTimeout(l),o.abort()}},[e.name,c,u,i]);let d=e.name===`onrampAmountEntry`||e.name===`onrampCurrencyPicker`||e.name===`onrampProviderPicker`||e.name===`onrampConfirm`;g(()=>{if(!d)return;let e=new AbortController;return i.requestOnrampMethods?.(e.signal).catch(()=>{}),i.requestOnrampCurrencies?.(e.signal).catch(()=>{}),i.requestOnrampProviders?.(e.signal).catch(()=>{}),()=>e.abort()},[d,i]);let f=e.name===`onrampConfirm`&&e.ctx.phase.kind===`loading`,p=e.name===`onrampConfirm`?e.ctx.amount:void 0,m=e.name===`onrampConfirm`?e.ctx.currency:void 0;g(()=>{if(!f||!i.requestOnrampQuote||p==null)return;let e=new AbortController;return i.requestOnrampQuote({amount:p,currency:m??`USD`},e.signal).catch(t=>{e.signal.aborted||r({type:`ONRAMP_QUOTE_FAILED`,failure:n(t,o.current._(C))})}),()=>e.abort()},[f,p,m,i,r]);let h=e.name===`onrampConfirm`&&e.ctx.phase.kind===`creating`,_=e.name===`onrampConfirm`?e.ctx.amount:void 0,v=e.name===`onrampConfirm`?e.ctx.currency:void 0;g(()=>{if(!h||_==null)return;if(!i.createOnrampSession){r({type:`ONRAMP_SESSION_FAILED`,failure:{reason:o.current._(w)}});return}let e=new AbortController;return i.createOnrampSession({amount:_,currency:v??`USD`},e.signal).then(t=>{if(!e.signal.aborted){if(!t.checkoutUrl){r({type:`ONRAMP_SESSION_FAILED`,failure:{reason:o.current._(w)}});return}l(t.checkoutUrl),r({type:`ONRAMP_SESSION_CREATED`,sessionId:t.sessionId,checkoutUrl:t.checkoutUrl})}}).catch(t=>{e.signal.aborted||r({type:`ONRAMP_SESSION_FAILED`,failure:n(t,o.current._(w))})}),()=>e.abort()},[h,_,i,r]),g(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`loading`&&e.ctx.phase.kind!==`regenerating`)return;let t=new AbortController,a=V(e.ctx.asset,e.ctx.amount);return i.requestQuote(a,t.signal).catch(e=>{t.signal.aborted||r({type:`QUOTE_FAILED`,failure:n(e,`Failed to fetch quote.`)})}),()=>t.abort()},[e.name,e.name===`confirmDeposit`?e.ctx.phase.kind:void 0,e.name===`confirmDeposit`?e.ctx.asset:void 0,e.name===`confirmDeposit`?e.ctx.amount:void 0,i,r]),g(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`ready`)return;let t=e.ctx.phase.quoteExpiresAt,n=Math.max(0,t-Date.now()),i=setTimeout(()=>{r({type:`QUOTE_EXPIRED`})},n);return()=>clearTimeout(i)},[e.name,e.name===`confirmDeposit`&&e.ctx.phase.kind===`ready`?e.ctx.phase.quoteExpiresAt:void 0,r])}function B(e,t,n,i){let o=y(i);o.current=i;let c=e.name===`processing`?e.ctx.tx:void 0;s(n,c?{tx:c}:void 0,c?.hash);let l=e.name===`onrampPaymentPending`?e.ctx.sessionId:void 0;a(n,l?{sessionId:l}:void 0,l),g(()=>{if(e.name!==`transferCrypto`||!n.watchSourceTx)return;let t=new AbortController,r;return n.watchSourceTx({},e=>{if(!t.signal.aborted&&!r){r=new AbortController,n.watchSettlement({tx:e},()=>{},r.signal);try{o.current?.invalidateActivity?.()}catch{}}},t.signal),()=>{t.abort(),r?.abort()}},[e.name,n]);let u=e.name===`activityList`||e.name===`activityDetail`;g(()=>{if(!u||!i)return;let e=new AbortController;return i.watchActivity(e.signal),()=>e.abort()},[u,i]),g(()=>{if(e.name===`closed`||e.name===`transferCrypto`||e.name===`processing`||u||!n.fetchActiveSettlement)return;let t=new AbortController,r,i,a=!1,o=async()=>{try{let e=await n.fetchActiveSettlement({},t.signal);if(a)return;if(e&&!r&&e.payload.kind===`pending`){let t=e.payload.txHash?.value;t&&(r=new AbortController,n.watchSettlement({tx:{hash:t}},()=>{},r.signal))}}catch{}a||(i=setTimeout(o,5e3))};return o(),()=>{a=!0,t.abort(),r?.abort(),i&&clearTimeout(i)}},[e.name,u,n]);let d=y(e);d.current=e,r(n,e=>{if(e===`pending`||e===`succeeded`||e===`failed`)try{n.invalidateBalances?.()}catch{}d.current.name===`processing`&&(e===`succeeded`?t({type:`PROCESSING_SUCCEEDED`}):e===`failed`&&t({type:`PROCESSING_FAILED`}))});let f=y(null);g(()=>{let e=()=>{let e=n.getSnapshot(),r=d.current,i=e.quote;i.status!==f.current&&(f.current=i.status,i.status===`ready`&&r.name===`confirmDeposit`?(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_RESOLVED`,expiresAt:i.payload.expiresAt}):i.status===`error`&&r.name===`confirmDeposit`&&(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_FAILED`,failure:{reason:i.error.message,code:i.error.name,cause:i.error}}))},r=n.subscribe(e);return e(),r},[n,t]);let p=y(null);g(()=>{let e=()=>{let e=n.getSnapshot(),r=d.current,i=e.onrampQuote,a=i?.status??`idle`;a!==p.current&&(p.current=a,!(r.name!==`onrampConfirm`||r.ctx.phase.kind!==`loading`)&&(a===`ready`||a===`stale`?t({type:`ONRAMP_QUOTE_RESOLVED`}):a===`error`&&i?.status===`error`&&t({type:`ONRAMP_QUOTE_FAILED`,failure:{reason:i.error.message,code:i.error.name,cause:i.error}})))},r=n.subscribe(e);return e(),r},[n,t]);let m=y(null);g(()=>{let e=()=>{let e=n.getSnapshot(),r=d.current,i=e.onrampSession,a=i?.status===`ready`||i?.status===`stale`?i.payload.state:i?.status??`idle`;if(a!==m.current&&(m.current=a,r.name===`onrampPaymentPending`)){if(a===`SESSION_COMPLETED`)t({type:`ONRAMP_SESSION_COMPLETED`});else if(a===`SESSION_EXPIRED`)t({type:`ONRAMP_SESSION_EXPIRED`});else if(a===`SESSION_FAILED`){let e=i?.status===`ready`||i?.status===`stale`?i.payload.failureCode:void 0;t({type:`ONRAMP_SESSION_FAILED`,failure:{reason:e??`Payment failed.`,...e?{code:e}:{}}})}}},r=n.subscribe(e);return e(),r},[n,t])}function V(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build quote input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceTokenSymbol:e.symbol,sourceIsNative:e.isNative,amount:t,...e.priceUsd===void 0?{}:{sourcePriceUsd:e.priceUsd}}}function H(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build submit input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceIsNative:e.isNative,amount:t}}export{I as GatewayController,D as useControllerContext,F as useDepositActions,P as useDepositEffectiveState,j as useDepositMethodsConfig,N as useDepositState,M as useEnabledRails,k as useOptionalStableControllerContext,O as useStableControllerContext};
@@ -1,5 +1,5 @@
1
1
  import { FailureInfo } from "../../../shared/orchestrator/types.js";
2
- import { CashConfirmPhase, CashMethodId, ConfirmDepositPhase, DepositActions, DepositController, DepositMethod, DepositMethodConfig, DepositMethodsConfig, DepositRailConfig, DepositState, DepositStateName, GatewayEvent, OpenInput, ResolvedOpenInput, RetryTargetSpec } from "./types.js";
2
+ import { ConfirmDepositPhase, DepositActions, DepositController, DepositMethod, DepositMethodConfig, DepositMethodsConfig, DepositRailConfig, DepositState, DepositStateName, GatewayEvent, OnrampConfirmPhase, OpenInput, ResolvedOpenInput, RetryTargetSpec } from "./types.js";
3
3
  import { useDepositState } from "./controller.js";
4
4
  import { STEPS_WITH_OWN_SETTLEMENT_VIEW, stepRendersSettlement } from "./steps.js";
5
5
  import { useDeposit } from "./useDeposit.js";
@@ -1 +1 @@
1
- import{createActivityReducers as e}from"../../../shared/orchestrator/createActivityReducers.js";import"../../../shared/orchestrator/index.js";import{assertNever as t}from"../../../shared/utils/assertNever.js";const n={name:`closed`},{reduceFromActivityList:r,reduceFromActivityDetail:i}=e({activityList:e=>({name:`activityList`,ctx:{backTarget:e}}),activityDetail:(e,t,n)=>({name:`activityDetail`,ctx:{settlementId:e,backTarget:t,viaList:n}}),closed:()=>({name:`closed`}),restoreFromBackTarget:e=>_(e)});function a(e,n){if(n.type===`RESUME_TO_PROCESSING`)return e.name===`closed`?e:{name:`processing`,ctx:{method:n.method,tx:n.tx,retryTargetForFailure:{kind:`fresh`}}};if(n.type===`RESUME_TO_SUCCESS`)return e.name===`closed`?e:{name:`success`,ctx:{method:n.method,tx:n.tx}};if(n.type===`RESUME_TO_ERROR`)return e.name===`closed`?e:{name:`error`,ctx:{retryTarget:{kind:`fresh`},...n.tx?{tx:n.tx}:{}}};switch(e.name){case`closed`:return o(n);case`deposit`:return s(e,n);case`assetPicker`:return c(e,n);case`amountEntry`:return l(e,n);case`cashAmountEntry`:return u(e,n);case`cashConfirm`:return d(e,n);case`confirmDeposit`:return f(e,n);case`transferCrypto`:return p(e,n);case`processing`:return m(e,n);case`success`:return h(e,n);case`error`:return g(e,n);case`activityList`:return r(e,n);case`activityDetail`:return i(e,n);default:return t(e)}}function o(e){if(e.type!==`OPEN`)return{name:`closed`};let t=e.input;return t?t.method===`transfer`?{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:`closed`}}:t.asset?{name:`amountEntry`,ctx:{method:`wallet`,asset:t.asset,backTarget:`closed`}}:{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`closed`}}:{name:`deposit`,ctx:{backTarget:`closed`}}}function s(e,t){switch(t.type){case`DEPOSIT_METHOD_SELECTED`:return t.method===`wallet`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`deposit`}}:{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:`deposit`}};case`CASH_METHOD_SELECTED`:return{name:`cashAmountEntry`,ctx:{method:`cash`,cashMethod:t.cashMethod,backTarget:`deposit`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`deposit`,backTarget:`closed`}}};case`BACK`:case`CLOSE`:return{name:`closed`};default:return e}}function c(e,t){switch(t.type){case`ASSET_CONFIRMED`:return{name:`amountEntry`,ctx:{method:`wallet`,asset:t.asset,backTarget:`assetPicker`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`assetPicker`,method:`wallet`,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function l(e,t){switch(t.type){case`AMOUNT_CONFIRMED`:return{name:`confirmDeposit`,ctx:{method:`wallet`,asset:e.ctx.asset,amount:t.amount,phase:{kind:`loading`},backTarget:`amountEntry`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`amountEntry`,method:`wallet`,asset:e.ctx.asset,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`assetPicker`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`deposit`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function u(e,t){switch(t.type){case`CASH_AMOUNT_CONFIRMED`:return{name:`cashConfirm`,ctx:{method:`cash`,cashMethod:e.ctx.cashMethod,amount:t.amount,phase:{kind:`loading`},backTarget:`cashAmountEntry`}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function d(e,t){let n=e.ctx.phase;switch(t.type){case`CASH_METHOD_READY`:return n.kind===`loading`?{...e,ctx:{...e.ctx,phase:{kind:`ready`}}}:e;case`BACK`:return{name:`cashAmountEntry`,ctx:{method:`cash`,cashMethod:e.ctx.cashMethod,backTarget:`deposit`,amount:e.ctx.amount}};case`CLOSE`:return{name:`closed`};default:return e}}function f(e,t){let n=e.ctx.phase;switch(t.type){case`QUOTE_RESOLVED`:return n.kind===`loading`||n.kind===`regenerating`?{...e,ctx:{...e.ctx,phase:{kind:`ready`,quoteExpiresAt:t.expiresAt}}}:e;case`QUOTE_FAILED`:return n.kind===`loading`||n.kind===`regenerating`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure,recoverFrom:`quote`}}}:e;case`QUOTE_RETRY`:return n.kind===`failed`?{...e,ctx:{...e.ctx,phase:{kind:`loading`}}}:e;case`QUOTE_EXPIRED`:return n.kind===`ready`?{...e,ctx:{...e.ctx,phase:{kind:`regenerating`}}}:e;case`DEPOSIT_CONFIRMED`:return n.kind===`ready`?{...e,ctx:{...e.ctx,phase:{kind:`submitting`}}}:e;case`DEPOSIT_SUBMITTED`:if(n.kind===`submitting`){let n={kind:`confirmDepositReady`,method:`wallet`,asset:e.ctx.asset,amount:e.ctx.amount};return{name:`processing`,ctx:{method:`wallet`,tx:t.tx,retryTargetForFailure:n}}}return e;case`DEPOSIT_SUBMISSION_FAILED`:return n.kind===`submitting`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure,recoverFrom:`submission`}}}:e;case`DEPOSIT_SIGNATURE_DECLINED`:return n.kind===`submitting`?{...e,ctx:{...e.ctx,phase:{kind:`regenerating`,...t.notice?{notice:t.notice}:{}}}}:e;case`BACK`:return{name:`amountEntry`,ctx:{method:`wallet`,asset:e.ctx.asset,backTarget:`assetPicker`}};case`CLOSE`:return{name:`closed`};default:return e}}function p(e,t){switch(t.type){case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`transferCrypto`,method:`transfer`,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function m(e,t){switch(t.type){case`PROCESSING_SUCCEEDED`:return{name:`success`,ctx:{method:e.ctx.method,tx:e.ctx.tx}};case`PROCESSING_FAILED`:return{name:`error`,ctx:{retryTarget:e.ctx.retryTargetForFailure,tx:e.ctx.tx}};case`CLOSE`:return{name:`closed`};default:return e}}function h(e,t){return t.type===`SUCCESS_DONE`||t.type===`CLOSE`?{name:`closed`}:e}function g(e,t){return t.type===`ERROR_TRY_AGAIN`?v(e.ctx.retryTarget):t.type===`CLOSE`?{name:`closed`}:e}function _(e){return e.kind===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:e.kind===`assetPicker`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:e.backTarget}}:e.kind===`amountEntry`?{name:`amountEntry`,ctx:{method:`wallet`,asset:e.asset,backTarget:e.backTarget}}:{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:e.backTarget}}}function v(e){return e.kind===`fresh`?{name:`deposit`,ctx:{backTarget:`closed`}}:e.kind===`transferCrypto`?{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:e.backTarget}}:{name:`confirmDeposit`,ctx:{method:`wallet`,asset:e.asset,amount:e.amount,phase:{kind:`loading`},backTarget:`amountEntry`}}}export{n as initialState,a as reducer};
1
+ import{createActivityReducers as e}from"../../../shared/orchestrator/createActivityReducers.js";import"../../../shared/orchestrator/index.js";import{assertNever as t}from"../../../shared/utils/assertNever.js";const n={name:`closed`},{reduceFromActivityList:r,reduceFromActivityDetail:i}=e({activityList:e=>({name:`activityList`,ctx:{backTarget:e}}),activityDetail:(e,t,n)=>({name:`activityDetail`,ctx:{settlementId:e,backTarget:t,viaList:n}}),closed:()=>({name:`closed`}),restoreFromBackTarget:e=>x(e)});function a(e,n){if(n.type===`RESUME_TO_PROCESSING`)return e.name===`closed`?e:{name:`processing`,ctx:{method:n.method,tx:n.tx,retryTargetForFailure:{kind:`fresh`}}};if(n.type===`RESUME_TO_SUCCESS`)return e.name===`closed`?e:{name:`success`,ctx:{method:n.method,tx:n.tx}};if(n.type===`RESUME_TO_ERROR`)return e.name===`closed`?e:{name:`error`,ctx:{retryTarget:{kind:`fresh`},...n.tx?{tx:n.tx}:{}}};switch(e.name){case`closed`:return o(n);case`deposit`:return s(e,n);case`assetPicker`:return c(e,n);case`amountEntry`:return l(e,n);case`onrampAmountEntry`:return u(e,n);case`onrampCurrencyPicker`:return f(e,n);case`onrampProviderPicker`:return p(e,n);case`onrampConfirm`:return m(e,n);case`onrampPaymentPending`:return h(e,n);case`confirmDeposit`:return g(e,n);case`transferCrypto`:return _(e,n);case`processing`:return v(e,n);case`success`:return y(e,n);case`error`:return b(e,n);case`activityList`:return r(e,n);case`activityDetail`:return i(e,n);default:return t(e)}}function o(e){if(e.type!==`OPEN`)return{name:`closed`};let t=e.input;return t?t.method===`transfer`?{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:`closed`}}:t.method===`onramp`?{name:`onrampAmountEntry`,ctx:{method:`onramp`,backTarget:`closed`,...t.amount===void 0?{}:{amount:t.amount},...t.currency===void 0?{}:{currency:t.currency}}}:t.asset?{name:`amountEntry`,ctx:{method:`wallet`,asset:t.asset,backTarget:`closed`}}:{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`closed`}}:{name:`deposit`,ctx:{backTarget:`closed`}}}function s(e,t){switch(t.type){case`DEPOSIT_METHOD_SELECTED`:return t.method===`wallet`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`deposit`}}:{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:`deposit`}};case`ONRAMP_SELECTED`:return{name:`onrampAmountEntry`,ctx:{method:`onramp`,backTarget:`deposit`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`deposit`,backTarget:`closed`}}};case`BACK`:case`CLOSE`:return{name:`closed`};default:return e}}function c(e,t){switch(t.type){case`ASSET_CONFIRMED`:return{name:`amountEntry`,ctx:{method:`wallet`,asset:t.asset,backTarget:`assetPicker`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`assetPicker`,method:`wallet`,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function l(e,t){switch(t.type){case`AMOUNT_CONFIRMED`:return{name:`confirmDeposit`,ctx:{method:`wallet`,asset:e.ctx.asset,amount:t.amount,phase:{kind:`loading`},backTarget:`amountEntry`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`amountEntry`,method:`wallet`,asset:e.ctx.asset,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`assetPicker`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`deposit`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function u(e,t){switch(t.type){case`ONRAMP_AMOUNT_CHANGED`:return t.amount===null?{...e,ctx:{...e.ctx,amount:void 0}}:{...e,ctx:{...e.ctx,amount:t.amount}};case`ONRAMP_AMOUNT_CONFIRMED`:return{name:`onrampConfirm`,ctx:{method:`onramp`,amount:t.amount,phase:{kind:`loading`},backTarget:`onrampAmountEntry`,...e.ctx.currency===void 0?{}:{currency:e.ctx.currency},...e.ctx.providerId===void 0?{}:{providerId:e.ctx.providerId}}};case`ONRAMP_CURRENCY_SELECTED`:return{...e,ctx:{...e.ctx,currency:t.currency}};case`ONRAMP_CURRENCY_PICKER_OPENED`:return{name:`onrampCurrencyPicker`,ctx:{method:`onramp`,backTarget:`onrampAmountEntry`,...e.ctx.amount===void 0?{}:{amount:e.ctx.amount},currency:e.ctx.currency??`USD`,...e.ctx.providerId===void 0?{}:{providerId:e.ctx.providerId}}};case`ONRAMP_PROVIDER_PICKER_OPENED`:return{name:`onrampProviderPicker`,ctx:{method:`onramp`,backTarget:`onrampAmountEntry`,...e.ctx.amount===void 0?{}:{amount:e.ctx.amount},currency:e.ctx.currency??`USD`,...e.ctx.providerId===void 0?{}:{providerId:e.ctx.providerId}}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function d(e,t){return{name:`onrampAmountEntry`,ctx:{method:`onramp`,backTarget:`deposit`,...e.amount===void 0?{}:{amount:e.amount},currency:t??e.currency,...e.providerId===void 0?{}:{providerId:e.providerId}}}}function f(e,t){switch(t.type){case`ONRAMP_CURRENCY_SELECTED`:return d(e.ctx,t.currency);case`BACK`:return d(e.ctx);case`CLOSE`:return{name:`closed`};default:return e}}function p(e,t){switch(t.type){case`ONRAMP_PROVIDER_SELECTED`:return{name:`onrampAmountEntry`,ctx:{method:`onramp`,backTarget:`deposit`,...e.ctx.amount===void 0?{}:{amount:e.ctx.amount},currency:e.ctx.currency,providerId:t.providerId}};case`BACK`:return d(e.ctx);case`CLOSE`:return{name:`closed`};default:return e}}function m(e,t){let n=e.ctx.phase;switch(t.type){case`ONRAMP_QUOTE_RESOLVED`:return n.kind===`loading`?{...e,ctx:{...e.ctx,phase:{kind:`ready`}}}:e;case`ONRAMP_QUOTE_FAILED`:return n.kind===`loading`||n.kind===`creating`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure}}}:e;case`ONRAMP_CONFIRMED`:return n.kind===`ready`||n.kind===`failed`?{...e,ctx:{...e.ctx,phase:{kind:`creating`}}}:e;case`ONRAMP_SESSION_CREATED`:return n.kind===`creating`?{name:`onrampPaymentPending`,ctx:{method:`onramp`,amount:e.ctx.amount,sessionId:t.sessionId,checkoutUrl:t.checkoutUrl,backTarget:`onrampConfirm`,...e.ctx.currency===void 0?{}:{currency:e.ctx.currency},...e.ctx.providerId===void 0?{}:{providerId:e.ctx.providerId}}}:e;case`ONRAMP_SESSION_FAILED`:return n.kind===`creating`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure}}}:e;case`BACK`:return{name:`onrampAmountEntry`,ctx:{method:`onramp`,backTarget:`deposit`,amount:e.ctx.amount,...e.ctx.currency===void 0?{}:{currency:e.ctx.currency},...e.ctx.providerId===void 0?{}:{providerId:e.ctx.providerId}}};case`CLOSE`:return{name:`closed`};default:return e}}function h(e,t){switch(t.type){case`ONRAMP_SESSION_COMPLETED`:return{name:`success`,ctx:{method:`onramp`,sessionId:e.ctx.sessionId}};case`ONRAMP_SESSION_EXPIRED`:return{name:`error`,ctx:{retryTarget:{kind:`onrampAmountEntry`},sessionId:e.ctx.sessionId,...t.failure?{failure:t.failure}:{}}};case`ONRAMP_SESSION_FAILED`:return{name:`error`,ctx:{retryTarget:{kind:`onrampAmountEntry`},sessionId:e.ctx.sessionId,failure:t.failure}};case`BACK`:return{name:`onrampConfirm`,ctx:{method:`onramp`,amount:e.ctx.amount,phase:{kind:`ready`},backTarget:`onrampAmountEntry`,...e.ctx.currency===void 0?{}:{currency:e.ctx.currency},...e.ctx.providerId===void 0?{}:{providerId:e.ctx.providerId}}};case`CLOSE`:return{name:`closed`};default:return e}}function g(e,t){let n=e.ctx.phase;switch(t.type){case`QUOTE_RESOLVED`:return n.kind===`loading`||n.kind===`regenerating`?{...e,ctx:{...e.ctx,phase:{kind:`ready`,quoteExpiresAt:t.expiresAt}}}:e;case`QUOTE_FAILED`:return n.kind===`loading`||n.kind===`regenerating`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure,recoverFrom:`quote`}}}:e;case`QUOTE_RETRY`:return n.kind===`failed`?{...e,ctx:{...e.ctx,phase:{kind:`loading`}}}:e;case`QUOTE_EXPIRED`:return n.kind===`ready`?{...e,ctx:{...e.ctx,phase:{kind:`regenerating`}}}:e;case`DEPOSIT_CONFIRMED`:return n.kind===`ready`?{...e,ctx:{...e.ctx,phase:{kind:`submitting`}}}:e;case`DEPOSIT_SUBMITTED`:if(n.kind===`submitting`){let n={kind:`confirmDepositReady`,method:`wallet`,asset:e.ctx.asset,amount:e.ctx.amount};return{name:`processing`,ctx:{method:`wallet`,tx:t.tx,retryTargetForFailure:n}}}return e;case`DEPOSIT_SUBMISSION_FAILED`:return n.kind===`submitting`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure,recoverFrom:`submission`}}}:e;case`DEPOSIT_SIGNATURE_DECLINED`:return n.kind===`submitting`?{...e,ctx:{...e.ctx,phase:{kind:`regenerating`,...t.notice?{notice:t.notice}:{}}}}:e;case`BACK`:return{name:`amountEntry`,ctx:{method:`wallet`,asset:e.ctx.asset,backTarget:`assetPicker`}};case`CLOSE`:return{name:`closed`};default:return e}}function _(e,t){switch(t.type){case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`transferCrypto`,method:`transfer`,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function v(e,t){switch(t.type){case`PROCESSING_SUCCEEDED`:return{name:`success`,ctx:{method:e.ctx.method,tx:e.ctx.tx}};case`PROCESSING_FAILED`:return{name:`error`,ctx:{retryTarget:e.ctx.retryTargetForFailure,tx:e.ctx.tx}};case`CLOSE`:return{name:`closed`};default:return e}}function y(e,t){return t.type===`SUCCESS_DONE`||t.type===`CLOSE`?{name:`closed`}:e}function b(e,t){return t.type===`ERROR_TRY_AGAIN`?S(e.ctx.retryTarget):t.type===`CLOSE`?{name:`closed`}:e}function x(e){return e.kind===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:e.kind===`assetPicker`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:e.backTarget}}:e.kind===`amountEntry`?{name:`amountEntry`,ctx:{method:`wallet`,asset:e.asset,backTarget:e.backTarget}}:{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:e.backTarget}}}function S(e){return e.kind===`fresh`?{name:`deposit`,ctx:{backTarget:`closed`}}:e.kind===`onrampAmountEntry`?{name:`onrampAmountEntry`,ctx:{method:`onramp`,backTarget:`deposit`}}:e.kind===`transferCrypto`?{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:e.backTarget}}:{name:`confirmDeposit`,ctx:{method:`wallet`,asset:e.asset,amount:e.amount,phase:{kind:`loading`},backTarget:`amountEntry`}}}export{n as initialState,a as reducer};
@@ -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,40 +39,28 @@ 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
53
- * transparently because the default is `enabled !== true`. Set explicitly to `false`
54
- * is equivalent to leaving it unset.
42
+ * Toggle for the rail. The onramp ("Cash") rail is shown by DEFAULT, so most hosts leave this
43
+ * unset. Crypto-only integrators (or any host without an onramp-capable driver) opt OUT by
44
+ * setting `enabled: false`. The catalog is fetched lazily on selection, so an enabled rail with
45
+ * no onramp backend simply leads to an empty Cash flow set `enabled: false` to hide it.
55
46
  */
56
47
  enabled?: boolean;
57
48
  /**
58
- * Legacy opt-OUT toggle. Kept for back-compatibility with the brief window where the
59
- * rail shipped on by default and integrators had to set this to hide it. New code
60
- * should prefer {@link DepositRailConfig.enabled}; setting `disabled: true` continues
61
- * to hide the rail regardless of `enabled`.
49
+ * Alternate opt-OUT toggle. `disabled: true` hides the rail regardless of {@link DepositRailConfig.enabled}.
50
+ * Equivalent to `enabled: false`; either one hides the "Cash" rail.
62
51
  */
63
52
  disabled?: boolean;
64
53
  }
65
54
  /**
66
55
  * Per-method host configuration for the deposit picker. Omitting a method (or the whole object)
67
56
  * 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
57
+ * unavailable for the current user. `onrampRail` is a rail-level toggle — see
69
58
  * {@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
59
  */
77
60
  interface DepositMethodsConfig {
78
61
  wallet?: DepositMethodConfig;
79
62
  transfer?: DepositMethodConfig;
80
- card?: DepositMethodConfig;
81
- applePay?: DepositMethodConfig;
82
- googlePay?: DepositMethodConfig;
83
- cashRail?: DepositRailConfig;
63
+ onrampRail?: DepositRailConfig;
84
64
  }
85
65
  /**
86
66
  * Confirm-deposit phase sub-union. Drives the confirm-deposit widget's hero / footer chrome.
@@ -102,15 +82,21 @@ type ConfirmDepositPhase = {
102
82
  recoverFrom: "quote" | "submission";
103
83
  };
104
84
  /**
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.
85
+ * Onramp-confirm phase sub-union. Drives the onramp confirm widget's CTA chrome — `loading` paints
86
+ * the quote skeleton while `requestOnrampQuote` resolves, `ready` renders the priced summary + the
87
+ * "Continue to payment" CTA, `creating` shows the spinner while `createOnrampSession` runs and the
88
+ * checkout tab opens, and `failed` surfaces an inline retry. Phase is pure navigation; the quote
89
+ * payload comes from the driver's `onrampQuote` entity.
109
90
  */
110
- type CashConfirmPhase = {
91
+ type OnrampConfirmPhase = {
111
92
  kind: "loading";
112
93
  } | {
113
94
  kind: "ready";
95
+ } | {
96
+ kind: "creating";
97
+ } | {
98
+ kind: "failed";
99
+ failure: FailureInfo;
114
100
  };
115
101
  /**
116
102
  * Where `ERROR_TRY_AGAIN` lands. Encoded once at error-entry time so retry is deterministic.
@@ -123,6 +109,12 @@ type RetryTargetSpec = {
123
109
  } | {
124
110
  kind: "transferCrypto";
125
111
  backTarget: "closed" | "deposit";
112
+ } | {
113
+ /**
114
+ * Onramp ("Cash") retry — `ERROR_TRY_AGAIN` routes the user back to
115
+ * `onrampAmountEntry` so they can re-enter an amount and create a fresh checkout session.
116
+ */
117
+ kind: "onrampAmountEntry";
126
118
  } | {
127
119
  /**
128
120
  * No re-runnable target — used when `ERROR_TRY_AGAIN` should route the user back to the
@@ -187,26 +179,77 @@ type DepositState = {
187
179
  backTarget: "closed" | "assetPicker";
188
180
  };
189
181
  } | {
190
- name: "cashAmountEntry";
182
+ name: "onrampAmountEntry";
191
183
  ctx: {
192
- method: "cash";
193
- cashMethod: CashMethodId;
184
+ method: "onramp";
194
185
  backTarget: "closed" | "deposit";
195
186
  /**
196
- * Optional initial amount, restored when the user backs out of `cashConfirm` so the
187
+ * Optional initial amount, restored when the user backs out of `onrampConfirm` so the
197
188
  * fiat band keeps the value they entered before continuing. Absent on first entry
198
189
  * (the widget falls back to the first preset).
199
190
  */
200
191
  amount?: number;
192
+ /**
193
+ * Selected fiat currency (ISO-4217). Absent until the user picks one or the controller
194
+ * seeds it from `onrampCurrencies.suggested` / persisted storage; readers fall back to
195
+ * `"USD"`. Threaded into the onramp quote + session requests.
196
+ */
197
+ currency?: string;
198
+ /**
199
+ * Selected onramp provider id. Absent until the user picks one or the controller seeds
200
+ * it from `onrampProviders.activeId`; readers fall back to the active provider. Today
201
+ * only the active provider is selectable, so this is idempotent.
202
+ */
203
+ providerId?: string;
204
+ };
205
+ } | {
206
+ /**
207
+ * Searchable fiat-currency picker — reached from `onrampAmountEntry` via the currency chip.
208
+ * Carries the in-progress `amount` + `currency` so the selection (or a back-out) restores
209
+ * the amount-entry screen losslessly.
210
+ */
211
+ name: "onrampCurrencyPicker";
212
+ ctx: {
213
+ method: "onramp";
214
+ backTarget: "onrampAmountEntry";
215
+ amount?: number;
216
+ currency: string;
217
+ providerId?: string;
218
+ };
219
+ } | {
220
+ /**
221
+ * Provider picker — reached from `onrampAmountEntry` via the provider card. Built as a real
222
+ * selectable list (single live provider today, multi-ready); carries the same `amount` +
223
+ * `currency` so a selection or back-out restores amount entry losslessly.
224
+ */
225
+ name: "onrampProviderPicker";
226
+ ctx: {
227
+ method: "onramp";
228
+ backTarget: "onrampAmountEntry";
229
+ amount?: number;
230
+ currency: string;
231
+ providerId?: string;
232
+ };
233
+ } | {
234
+ name: "onrampConfirm";
235
+ ctx: {
236
+ method: "onramp";
237
+ amount: number;
238
+ phase: OnrampConfirmPhase;
239
+ backTarget: "onrampAmountEntry"; /** Selected fiat currency carried from amount entry — drives the confirm re-quote + session. */
240
+ currency?: string; /** Selected provider carried from amount entry. */
241
+ providerId?: string;
201
242
  };
202
243
  } | {
203
- name: "cashConfirm";
244
+ name: "onrampPaymentPending";
204
245
  ctx: {
205
- method: "cash";
206
- cashMethod: CashMethodId;
246
+ method: "onramp";
207
247
  amount: number;
208
- phase: CashConfirmPhase;
209
- backTarget: "cashAmountEntry";
248
+ sessionId: string;
249
+ checkoutUrl: string;
250
+ backTarget: "onrampConfirm"; /** Selected fiat currency, preserved so a back-out restores the confirm/amount screens. */
251
+ currency?: string; /** Selected provider, preserved across the back-out path. */
252
+ providerId?: string;
210
253
  };
211
254
  } | {
212
255
  name: "confirmDeposit";
@@ -234,7 +277,13 @@ type DepositState = {
234
277
  name: "success";
235
278
  ctx: {
236
279
  method: DepositMethod;
237
- tx: TxRef;
280
+ /**
281
+ * Source-chain broadcast tx for crypto deposits. Optional because the onramp branch
282
+ * has no on-chain tx of its own at terminal time — it reads the completed
283
+ * `onrampSession` entity instead and carries {@link sessionId}.
284
+ */
285
+ tx?: TxRef; /** Onramp checkout session id — set only when `method === "onramp"`. */
286
+ sessionId?: string;
238
287
  };
239
288
  } | {
240
289
  name: "error";
@@ -242,11 +291,13 @@ type DepositState = {
242
291
  retryTarget: RetryTargetSpec;
243
292
  /**
244
293
  * 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.
294
+ * the orchestrated `error` arm, and onramp session failures). Crypto settlement
295
+ * failures leave this `undefined` — the widget renders from the driver's `settlement`
296
+ * entity (`kind: "failed"`) instead.
247
297
  */
248
298
  failure?: FailureInfo; /** Source-chain tx hash when the error followed a successful broadcast. */
249
- tx?: TxRef;
299
+ tx?: TxRef; /** Onramp checkout session id — set only when the failure came from the onramp rail. */
300
+ sessionId?: string;
250
301
  };
251
302
  } | {
252
303
  /**
@@ -285,6 +336,10 @@ type ResolvedOpenInput = undefined | {
285
336
  asset?: BalanceItemPayload;
286
337
  } | {
287
338
  method: "transfer";
339
+ } | {
340
+ method: "onramp";
341
+ amount?: number;
342
+ currency?: string;
288
343
  };
289
344
  /**
290
345
  * Reducer event union. Strict discriminated; no stringly-typed transitions, no payload
@@ -301,13 +356,61 @@ type GatewayEvent = {
301
356
  type: "DEPOSIT_METHOD_SELECTED";
302
357
  method: DepositMethod;
303
358
  } | {
304
- type: "CASH_METHOD_SELECTED";
305
- cashMethod: CashMethodId;
359
+ type: "ONRAMP_SELECTED";
360
+ } | {
361
+ /**
362
+ * Live fiat amount the user is typing on `onrampAmountEntry`, mirrored into `ctx.amount`
363
+ * so the controller's debounced quote effect can fetch a fresh `onrampQuote` for the
364
+ * on-screen breakdown. `null` while the field is empty (no quote fires). Distinct from
365
+ * {@link GatewayEvent} `ONRAMP_AMOUNT_CONFIRMED`, which commits the amount and advances
366
+ * the FSM to `onrampConfirm`.
367
+ */
368
+ type: "ONRAMP_AMOUNT_CHANGED";
369
+ amount: number | null;
306
370
  } | {
307
- type: "CASH_AMOUNT_CONFIRMED";
371
+ type: "ONRAMP_AMOUNT_CONFIRMED";
308
372
  amount: number;
309
373
  } | {
310
- type: "CASH_METHOD_READY";
374
+ /**
375
+ * User tapped the currency chip on `onrampAmountEntry`. Routes to `onrampCurrencyPicker`,
376
+ * carrying the in-progress amount + currency.
377
+ */
378
+ type: "ONRAMP_CURRENCY_PICKER_OPENED";
379
+ } | {
380
+ /**
381
+ * User picked a fiat currency on `onrampCurrencyPicker`. Returns to `onrampAmountEntry`
382
+ * with the new `currency`; the controller's quote effect re-quotes in that currency.
383
+ */
384
+ type: "ONRAMP_CURRENCY_SELECTED";
385
+ currency: string;
386
+ } | {
387
+ /** User tapped the provider card on `onrampAmountEntry`. Routes to `onrampProviderPicker`. */type: "ONRAMP_PROVIDER_PICKER_OPENED";
388
+ } | {
389
+ /**
390
+ * User picked a provider on `onrampProviderPicker`. Returns to `onrampAmountEntry` with the
391
+ * selected `providerId`. Idempotent for the already-active provider.
392
+ */
393
+ type: "ONRAMP_PROVIDER_SELECTED";
394
+ providerId: string;
395
+ } | {
396
+ type: "ONRAMP_QUOTE_RESOLVED";
397
+ } | {
398
+ type: "ONRAMP_QUOTE_FAILED";
399
+ failure: FailureInfo;
400
+ } | {
401
+ type: "ONRAMP_CONFIRMED";
402
+ } | {
403
+ type: "ONRAMP_SESSION_CREATED";
404
+ sessionId: string;
405
+ checkoutUrl: string;
406
+ } | {
407
+ type: "ONRAMP_SESSION_COMPLETED";
408
+ } | {
409
+ type: "ONRAMP_SESSION_EXPIRED";
410
+ failure?: FailureInfo;
411
+ } | {
412
+ type: "ONRAMP_SESSION_FAILED";
413
+ failure: FailureInfo;
311
414
  } | {
312
415
  type: "ASSET_CONFIRMED";
313
416
  asset: BalanceItemPayload;
@@ -401,6 +504,10 @@ type OpenInput = undefined | {
401
504
  assetId?: string;
402
505
  } | {
403
506
  method: "transfer";
507
+ } | {
508
+ method: "onramp"; /** Optional fiat amount to preselect on the Cash amount-entry band (falls back to the first preset). */
509
+ amount?: number; /** Optional ISO-4217 currency to preselect (falls back to persisted / country-resolved / USD). */
510
+ currency?: string;
404
511
  };
405
512
  /**
406
513
  * Imperative controller returned by `useDeposit()`. Stable across re-renders.
@@ -414,9 +521,12 @@ interface DepositController {
414
521
  * - `open({ method: "wallet", assetId })` → `amountEntry` when `assetId` resolves, otherwise
415
522
  * falls through to `assetPicker`
416
523
  * - `open({ method: "transfer" })` → `transferCrypto`
524
+ * - `open({ method: "onramp" })` → `onrampAmountEntry` (the "Cash" flow); pass `amount` /
525
+ * `currency` to preselect the band and price the quote on entry. The driver arms and the
526
+ * onramp catalog / currency / provider fetches fire just as they would from the picker.
417
527
  *
418
528
  * Returns `false` only when the requested `method` is disabled via
419
- * {@link DepositMethodsConfig}.
529
+ * {@link DepositMethodsConfig} (for onramp, when `onrampRail.enabled === false` or `disabled`).
420
530
  *
421
531
  * For direct-entry into the activity surface, see {@link useActivity}.
422
532
  */
@@ -437,24 +547,50 @@ interface DepositController {
437
547
  interface DepositActions {
438
548
  selectMethod(method: DepositMethod): void;
439
549
  /**
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.
550
+ * Promotes the FSM from `deposit` (method picker) into `onrampAmountEntry`. The onramp rail is
551
+ * single-method (the hosted-checkout provider collects the payment instrument), so this takes
552
+ * no argument selecting "Cash" goes straight to amount entry.
553
+ */
554
+ selectOnramp(): void;
555
+ /**
556
+ * Mirrors the live fiat amount the user is typing on `onrampAmountEntry` into the FSM's
557
+ * `ctx.amount`. The controller's debounced quote effect keys off that value to fetch a fresh
558
+ * `onrampQuote` for the on-screen breakdown — without this sync the amount-entry screen would
559
+ * never quote (the field's local state is invisible to the controller). Pass `null` when the
560
+ * field is cleared. No FSM transition; `onrampAmountEntry` stays current.
561
+ */
562
+ setOnrampAmount(amount: number | null): void;
563
+ /**
564
+ * Promotes the FSM from `onrampAmountEntry` into `onrampConfirm{loading}` carrying the entered
565
+ * fiat amount. The controller's quote effect resolves the `onrampQuote` entity and the bridge
566
+ * flips the phase to `ready`.
567
+ */
568
+ confirmOnrampAmount(amount: number): void;
569
+ /**
570
+ * Opens the fiat-currency picker from `onrampAmountEntry` (`ONRAMP_CURRENCY_PICKER_OPENED`),
571
+ * carrying the in-progress amount + currency so a back-out restores the amount-entry screen.
572
+ */
573
+ openOnrampCurrencyPicker(): void;
574
+ /**
575
+ * Commits a fiat-currency selection (`ONRAMP_CURRENCY_SELECTED`): sets `ctx.currency`, returns
576
+ * to `onrampAmountEntry`, and triggers a re-quote in the new currency.
444
577
  */
445
- selectCashMethod(cashMethod: CashMethodId): void;
578
+ selectOnrampCurrency(currency: string): void;
579
+ /** Opens the provider picker from `onrampAmountEntry` (`ONRAMP_PROVIDER_PICKER_OPENED`). */
580
+ openOnrampProviderPicker(): void;
446
581
  /**
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.
582
+ * Commits a provider selection (`ONRAMP_PROVIDER_SELECTED`): sets `ctx.providerId` and returns
583
+ * to `onrampAmountEntry`. In scope now; today only the active provider is selectable
584
+ * (coming-soon rows are inert), but the action is fully wired. Selecting the already-active
585
+ * provider is a valid idempotent confirm.
450
586
  */
451
- confirmCashAmount(amount: number): void;
587
+ selectOnrampProvider(providerId: string): void;
452
588
  /**
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.
589
+ * Flips `onrampConfirm{ready}` → `onrampConfirm{creating}`. The controller's session effect
590
+ * calls `createOnrampSession`, opens the hosted checkout in a new tab, and dispatches
591
+ * `ONRAMP_SESSION_CREATED` to advance to `onrampPaymentPending`.
456
592
  */
457
- cashMethodReady(): void;
593
+ confirmOnramp(): void;
458
594
  confirmAsset(asset: BalanceItemPayload): void;
459
595
  confirmAmount(amount: number): void;
460
596
  confirmDeposit(): void;
@@ -484,4 +620,4 @@ interface DepositActions {
484
620
  selectSettlement(settlementId: string): void;
485
621
  }
486
622
  //#endregion
487
- export { CashConfirmPhase, CashMethodId, ConfirmDepositPhase, DepositActions, DepositController, DepositMethod, DepositMethodConfig, DepositMethodsConfig, DepositRailConfig, DepositState, DepositStateName, GatewayEvent, OpenInput, ResolvedOpenInput, RetryTargetSpec };
623
+ 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=`data:image/svg+xml,%3Csvg%20width%3D%22520%22%20height%3D%22470%22%20viewBox%3D%220%200%20520%20470%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22banxa-gradient%22%20x1%3D%2278.5%22%20y1%3D%22390.5%22%20x2%3D%22441.5%22%20y2%3D%2278.5%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22%230076D0%22%2F%3E%3Cstop%20offset%3D%220.42%22%20stop-color%3D%22%2300B4C6%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%2300D6BF%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M%20417%20390.5%20L%20102%20390.5%20L%2092%20386.5%20L%2082.5%20377%20L%2078.5%20367%20L%2078.5%20356%20L%2084.5%20342%20L%20226.5%2096%20L%20235%2086.5%20L%20241%2082.5%20L%20252%2078.5%20L%20268%2078.5%20L%20280%2083.5%20L%20291.5%2094%20L%20434.5%20341%20L%20440.5%20353%20L%20441.5%20359%20L%20439.5%20372%20L%20436.5%20378%20L%20429%20385.5%20Z%20M%20360.5%20331%20L%20260%20157.5%20L%20254.5%20165%20L%20159.5%20330%20L%20160%20331.5%20Z%22%20fill%3D%22url(%23banxa-gradient)%22%2F%3E%3C%2Fsvg%3E`,t=`deposit.last-currency`,n=[`USD`,`EUR`,`GBP`,`JPY`,`CNY`,`AUD`,`CAD`,`CHF`],r={USD:[100,500,1e3],EUR:[100,500,1e3],GBP:[100,500,1e3],CHF:[100,500,1e3],CAD:[100,500,1e3],AUD:[100,500,1e3],CNY:[1e3,5e3,1e4],JPY:[2e4,5e4,1e5],KRW:[2e5,5e5,1e6],AED:[500,2e3,5e3],INR:[1e4,25e3,5e4]},i=[100,500,1e3];function a(e,t){try{return new Intl.NumberFormat(`en`,{style:`currency`,currency:t,currencyDisplay:`narrowSymbol`,notation:`compact`,maximumFractionDigits:1}).format(e)}catch{return String(e)}}function o(e){return(r[e]??i).map(t=>({value:t,label:a(t,e)}))}export{e as BANXA_LOGO_DATA_URI,t as LAST_DEPOSIT_CURRENCY_KEY,n as ONRAMP_POPULAR_CURRENCIES,o as resolveOnrampPresets};
@@ -0,0 +1 @@
1
+ const e={id:`fWsBTs`,message:`Something went wrong. Please try again.`},t={id:`y1R6QS`,message:`This wallet can't receive this deposit. Try a different address.`},n={id:`a3WpTF`,message:`You already have a payment in progress. Finish or cancel it before starting another.`},r={id:`LZueaM`,message:`This purchase isn't available right now. Try a different amount or asset.`},i={id:`AmaCQf`,message:`Card payments are temporarily unavailable. Please try again later.`},a={id:`HtxAvT`,message:`This checkout is no longer available. Please start again.`},o={id:`q9raxs`,message:`This checkout has expired. Please start again.`},s={id:`hFe8Jo`,message:`We couldn't price that amount. Try a different amount.`},c={id:`7zrAuh`,message:`We couldn't start checkout. Please try again.`};function l(e){if(typeof e==`string`)return{message:e};if(e instanceof Error){let t=u(e.statusCode),n=e.message;if(!n||/^request failed/i.test(n)){let t=e.cause,r=f(t);r&&(n=r)}return t===void 0?{message:n}:{message:n,status:t}}if(e&&typeof e==`object`){let t=e,n=d(t.error)??d(t.message)??``,r=u(t.code);return r===void 0?{message:n}:{message:n,status:r}}return{message:``}}function u(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function d(e){return typeof e==`string`&&e.trim()?e:void 0}function f(e){if(!(!e||typeof e!=`object`))return d(e.error)}function p(e){let t=e.indexOf(`{`);if(t===-1)return;let n=e.slice(t).trim();if(n.endsWith(`[truncated]`))return;let r;try{r=JSON.parse(n)}catch{return}if(!r||typeof r!=`object`)return;let i=r;if(i.errors&&typeof i.errors==`object`)for(let e of Object.values(i.errors)){let t=Array.isArray(e)?e.find(e=>typeof e==`string`&&e.trim().length>0):d(e);if(t)return m(t)}let a=d(i.message);return a?m(a):void 0}function m(e){let t=e.trim().replace(/'([\d.,]+)'/g,`$1`);return/[.!?]$/.test(t)?t:`${t}.`}function h(e,l,u){let d=e.toLowerCase();if(d.includes(`business allowlist`)||d.includes(`not a registered address`)||d.includes(`belongs to a different owner`))return u._(t);if(d.includes(`another active`)||l===409)return u._(n);if(d.includes(`session expired`)||d.includes(`session has expired`))return u._(o);if(d.includes(`session not found`))return u._(a);if(d.includes(`provider is disabled`)||l===503)return u._(i);if(d.includes(`no onramp provider matches`)||d.includes(`no deposit asset matches`)||d.includes(`provider asset mapping`)||d.includes(`unknown onramp provider`))return u._(r);if(d.includes(`failed to create session`))return u._(c);if(d.includes(`failed to quote`)||d.includes(`rejected request`))return u._(s)}function g(t,n){let{message:r,status:i}=l(t);return p(r)??h(r,i,n)??n._(e)}export{g as resolveOnrampErrorMessage};
@@ -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!==!1,W=m.onrampMethods,G=W?.status,K=G===`ready`||G===`stale`?W?.payload:void 0,q=U,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:`ib77lj`,message:`Debit Card`}),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};