@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.
- package/dist/KitProvider.d.ts +0 -21
- package/dist/KitProvider.js +1 -1
- package/dist/_internal/deposit/driver/index.d.ts +3 -3
- package/dist/_internal/drivers/stridge-mock/index.d.ts +3 -2
- package/dist/_internal/drivers/stridge-mock/index.js +1 -1
- package/dist/activity/compound/index.js +1 -1
- package/dist/deposit/compound/index.d.ts +21 -10
- package/dist/deposit/compound/index.js +1 -1
- package/dist/deposit/widgets/index.d.ts +6 -3
- package/dist/deposit/widgets/index.js +1 -1
- package/dist/drivers/stridge/createStridgeDepositDriver.js +1 -1
- package/dist/drivers/stridge-mock/checkoutChannel.d.ts +31 -0
- package/dist/drivers/stridge-mock/checkoutChannel.js +1 -0
- package/dist/drivers/stridge-mock/createStridgeMockDriver.d.ts +28 -0
- package/dist/drivers/stridge-mock/createStridgeMockDriver.js +1 -1
- package/dist/drivers/stridge-mock/fixtures.d.ts +6 -2
- package/dist/drivers/stridge-mock/fixtures.js +1 -1
- package/dist/drivers/stridge-mock/triggers.d.ts +12 -0
- package/dist/events/emit/useDepositEmissions.js +1 -1
- package/dist/flows/deposit/dialog/DepositDialog.js +1 -1
- package/dist/flows/deposit/driver/payloads.d.ts +206 -20
- package/dist/flows/deposit/driver/types.d.ts +106 -10
- package/dist/flows/deposit/orchestrator/controller.js +1 -1
- package/dist/flows/deposit/orchestrator/index.d.ts +1 -1
- package/dist/flows/deposit/orchestrator/reducer.js +1 -1
- package/dist/flows/deposit/orchestrator/types.d.ts +202 -66
- package/dist/flows/deposit/shared/checkoutPopup.js +1 -0
- package/dist/flows/deposit/shared/onramp.js +1 -0
- package/dist/flows/deposit/shared/onrampError.js +1 -0
- package/dist/flows/deposit/widgets/amount-entry/AmountEntry.js +1 -1
- package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/Deposit.d.ts +5 -5
- package/dist/flows/deposit/widgets/deposit/compound/components/Guards.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/components/Methods.d.ts +1 -2
- package/dist/flows/deposit/widgets/deposit/compound/components/RailPicker.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/types.d.ts +9 -9
- package/dist/flows/deposit/widgets/error-state/ErrorState.js +1 -1
- package/dist/flows/deposit/widgets/onramp-amount-entry/OnrampAmountEntry.d.ts +68 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/OnrampAmountEntry.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.d.ts +66 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.slots.d.ts +21 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.slots.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.styles.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/CurrencyChip.d.ts +12 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/CurrencyChip.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/HeroLabel.d.ts +13 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/HeroLabel.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/ProviderCard.d.ts +12 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/ProviderCard.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/ReceiveChip.d.ts +14 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/ReceiveChip.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/context.d.ts +14 -0
- package/dist/flows/deposit/widgets/{cash-amount-entry → onramp-amount-entry}/compound/context.js +1 -1
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/index.d.ts +4 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/index.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/types.d.ts +40 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/index.d.ts +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/index.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/OnrampConfirm.d.ts +52 -0
- package/dist/flows/deposit/widgets/onramp-confirm/OnrampConfirm.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.d.ts +44 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.slots.d.ts +31 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.slots.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.styles.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Body.d.ts +16 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Body.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Disclaimer.d.ts +21 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Disclaimer.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Header.d.ts +15 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Header.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Summary.d.ts +15 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Summary.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/context.d.ts +46 -0
- package/dist/flows/deposit/widgets/{cash-confirm → onramp-confirm}/compound/context.js +1 -1
- package/dist/flows/deposit/widgets/onramp-confirm/compound/index.d.ts +4 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/index.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/types.d.ts +67 -0
- package/dist/flows/deposit/widgets/onramp-confirm/index.d.ts +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/index.js +1 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/OnrampCurrencyPicker.d.ts +39 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/OnrampCurrencyPicker.js +1 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/OnrampCurrencyPicker.d.ts +37 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/OnrampCurrencyPicker.js +1 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/OnrampCurrencyPicker.slots.d.ts +17 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/OnrampCurrencyPicker.slots.js +1 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/OnrampCurrencyPicker.styles.js +1 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/Body.d.ts +6 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/Body.js +1 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/CurrencyRow.d.ts +12 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/CurrencyRow.js +1 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/Empty.js +1 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/Header.d.ts +10 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/Header.js +1 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/Search.d.ts +6 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/components/Search.js +1 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/context.js +1 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/index.d.ts +3 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/index.js +1 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/compound/types.d.ts +48 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/index.d.ts +1 -0
- package/dist/flows/deposit/widgets/onramp-currency-picker/index.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/OnrampPaymentPending.d.ts +50 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/OnrampPaymentPending.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.d.ts +68 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.slots.d.ts +17 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.slots.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/components/Flow.d.ts +13 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/components/Flow.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/components/Flow.styles.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/components/ReopenButton.d.ts +11 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/components/ReopenButton.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/context.d.ts +32 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/context.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/index.d.ts +3 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/index.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/index.d.ts +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/index.js +1 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/OnrampProviderPicker.d.ts +38 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/OnrampProviderPicker.js +1 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/OnrampProviderPicker.d.ts +35 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/OnrampProviderPicker.js +1 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/OnrampProviderPicker.slots.d.ts +19 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/OnrampProviderPicker.slots.js +1 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/OnrampProviderPicker.styles.js +1 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/components/Body.d.ts +6 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/components/Body.js +1 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/components/Header.d.ts +10 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/components/Header.js +1 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/components/ProviderRow.d.ts +15 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/components/ProviderRow.js +1 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/context.js +1 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/index.d.ts +3 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/index.js +1 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/compound/types.d.ts +50 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/index.d.ts +1 -0
- package/dist/flows/deposit/widgets/onramp-provider-picker/index.js +1 -0
- package/dist/flows/deposit/widgets/success-state/SuccessState.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.js +1 -1
- package/dist/format/index.d.ts +2 -1
- package/dist/format/index.js +1 -1
- package/dist/i18n/locales/ar.js +1 -1
- package/dist/i18n/locales/es.js +1 -1
- package/dist/i18n/locales/source-keys.d.ts +1 -1
- package/dist/icons/index.d.ts +4 -8
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +1 -1
- package/dist/package.js +1 -1
- package/dist/shared/attribution/Attribution.js +1 -1
- package/dist/shared/attribution/Attribution.styles.js +1 -1
- package/dist/shared/dialog/Frame.js +1 -1
- package/dist/shared/format/formatFiat.d.ts +31 -0
- package/dist/shared/format/formatFiat.js +1 -0
- package/dist/shared/icons/BellIcon.d.ts +7 -0
- package/dist/shared/icons/BellIcon.js +1 -0
- package/dist/shared/icons/BitcoinIcon.d.ts +5 -8
- package/dist/shared/icons/BitcoinIcon.js +1 -1
- package/dist/shared/icons/CardIcon.d.ts +3 -3
- package/dist/shared/icons/DirhamSignIcon.d.ts +16 -0
- package/dist/shared/icons/DirhamSignIcon.js +1 -0
- package/dist/shared/icons/SearchIcon.d.ts +7 -0
- package/dist/shared/icons/SearchIcon.js +1 -0
- package/dist/shared/orchestrator/index.js +1 -1
- package/dist/shared/orchestrator/useOnrampSessionWatcher.js +1 -0
- package/dist/shared/ui/AmountInput/useAutoShrinkFontSize.js +1 -1
- package/dist/shared/ui/Checkbox/Checkbox.d.ts +47 -0
- package/dist/shared/ui/Checkbox/Checkbox.js +1 -0
- package/dist/shared/ui/Checkbox/Checkbox.slots.d.ts +12 -0
- package/dist/shared/ui/Checkbox/Checkbox.slots.js +1 -0
- package/dist/shared/ui/Checkbox/Checkbox.styles.js +1 -0
- package/dist/shared/ui/Checkbox/index.d.ts +2 -0
- package/dist/shared/ui/Checkbox/index.js +1 -0
- package/dist/shared/ui/CurrencyGlyph/CurrencyGlyph.d.ts +36 -0
- package/dist/shared/ui/CurrencyGlyph/CurrencyGlyph.js +1 -0
- package/dist/shared/ui/CurrencyGlyph/CurrencyGlyph.slots.d.ts +12 -0
- package/dist/shared/ui/CurrencyGlyph/CurrencyGlyph.slots.js +1 -0
- package/dist/shared/ui/CurrencyGlyph/CurrencyGlyph.styles.js +1 -0
- package/dist/shared/ui/CurrencyGlyph/flags.js +1 -0
- package/dist/shared/ui/CurrencyGlyph/index.d.ts +2 -0
- package/dist/shared/ui/CurrencyGlyph/index.js +1 -0
- package/dist/shared/ui/DisclosureRow/DisclosureRow.d.ts +56 -0
- package/dist/shared/ui/DisclosureRow/DisclosureRow.js +1 -0
- package/dist/shared/ui/DisclosureRow/DisclosureRow.slots.d.ts +8 -0
- package/dist/shared/ui/DisclosureRow/DisclosureRow.slots.js +1 -0
- package/dist/shared/ui/DisclosureRow/DisclosureRow.styles.js +1 -0
- package/dist/shared/ui/DisclosureRow/index.d.ts +2 -0
- package/dist/shared/ui/DisclosureRow/index.js +1 -0
- package/dist/shared/ui/FiatSymbol/FiatAmount.d.ts +32 -0
- package/dist/shared/ui/FiatSymbol/FiatAmount.js +1 -0
- package/dist/shared/ui/FiatSymbol/FiatSymbol.d.ts +30 -0
- package/dist/shared/ui/FiatSymbol/FiatSymbol.js +1 -0
- package/dist/shared/ui/FiatSymbol/index.d.ts +2 -0
- package/dist/shared/ui/FiatSymbol/index.js +1 -0
- package/dist/shared/ui/Tabs/Tabs.d.ts +2 -2
- package/dist/shared/utils/logos/resolveLogoSrc.js +1 -1
- package/dist/shared/widgets/activity/compound/ActivityDetail.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.styles.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/components/Footer.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/components/Hero/Hero.d.ts +2 -1
- package/dist/shared/widgets/amount-entry/compound/components/Hero/Hero.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/components/Hero/StaticBand.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/types.d.ts +16 -0
- package/dist/shared/widgets/confirm-transfer/compound/components/Breakdown.js +1 -1
- package/dist/shared/widgets/error-state/compound/ErrorState.styles.js +1 -1
- package/dist/shared/widgets/error-state/compound/components/MoreDetails.d.ts +3 -3
- package/dist/shared/widgets/error-state/compound/components/MoreDetails.js +1 -1
- package/dist/shared/widgets/success-state/compound/SuccessState.styles.js +1 -1
- package/dist/shared/widgets/success-state/compound/components/MoreDetails.d.ts +2 -3
- package/dist/shared/widgets/success-state/compound/components/MoreDetails.js +1 -1
- package/dist/stridge/StridgeProvider.d.ts +0 -10
- package/dist/stridge/StridgeProvider.js +1 -1
- package/dist/stridge/stubs.js +1 -1
- package/dist/styles/index.css +118 -40
- package/dist/types.d.ts +3 -3
- package/dist/ui/index.d.ts +9 -1
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/dist/withdraw/compound/index.js +1 -1
- package/package.json +1 -1
- package/dist/flows/deposit/bindings/DepositBindings.d.ts +0 -87
- package/dist/flows/deposit/bindings/DepositBindings.js +0 -1
- package/dist/flows/deposit/bindings/index.d.ts +0 -1
- package/dist/flows/deposit/bindings/index.js +0 -1
- package/dist/flows/deposit/shared/cash.d.ts +0 -20
- package/dist/flows/deposit/shared/cash.js +0 -1
- package/dist/flows/deposit/widgets/cash-amount-entry/CashAmountEntry.d.ts +0 -71
- package/dist/flows/deposit/widgets/cash-amount-entry/CashAmountEntry.js +0 -1
- package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.d.ts +0 -69
- package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.js +0 -1
- package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.slots.d.ts +0 -16
- package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.slots.js +0 -1
- package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.styles.js +0 -1
- package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/HeroLabel.d.ts +0 -13
- package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/HeroLabel.js +0 -1
- package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/MethodChip.d.ts +0 -18
- package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/MethodChip.js +0 -1
- package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/ReceiveChip.d.ts +0 -14
- package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/ReceiveChip.js +0 -1
- package/dist/flows/deposit/widgets/cash-amount-entry/compound/index.d.ts +0 -3
- package/dist/flows/deposit/widgets/cash-amount-entry/compound/index.js +0 -1
- package/dist/flows/deposit/widgets/cash-amount-entry/compound/types.d.ts +0 -42
- package/dist/flows/deposit/widgets/cash-amount-entry/index.d.ts +0 -1
- package/dist/flows/deposit/widgets/cash-amount-entry/index.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/CashConfirm.d.ts +0 -63
- package/dist/flows/deposit/widgets/cash-confirm/CashConfirm.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.d.ts +0 -54
- package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.slots.d.ts +0 -33
- package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.slots.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.styles.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/cashConfirmDimensions.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/ApplePayBody.d.ts +0 -15
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/ApplePayBody.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/Body.d.ts +0 -22
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/Body.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/BodyLabel.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardBody.d.ts +0 -16
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardBody.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.icons.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.keys.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.state.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.styles.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/GooglePayBody.d.ts +0 -16
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/GooglePayBody.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/Header.d.ts +0 -21
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/Header.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/Summary.d.ts +0 -17
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/Summary.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/components/cardFormat.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/index.d.ts +0 -3
- package/dist/flows/deposit/widgets/cash-confirm/compound/index.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/compound/types.d.ts +0 -66
- package/dist/flows/deposit/widgets/cash-confirm/index.d.ts +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/index.js +0 -1
- package/dist/flows/deposit/widgets/cash-confirm/mocks.js +0 -1
- package/dist/shared/icons/AmexIcon.d.ts +0 -14
- package/dist/shared/icons/AmexIcon.js +0 -1
- package/dist/shared/icons/ApplePayIcon.d.ts +0 -15
- package/dist/shared/icons/ApplePayIcon.js +0 -1
- package/dist/shared/icons/CashIcon.d.ts +0 -16
- package/dist/shared/icons/CashIcon.js +0 -1
- package/dist/shared/icons/DiscoverIcon.d.ts +0 -14
- package/dist/shared/icons/DiscoverIcon.js +0 -1
- package/dist/shared/icons/GooglePayIcon.d.ts +0 -15
- package/dist/shared/icons/GooglePayIcon.js +0 -1
- package/dist/shared/icons/MastercardIcon.d.ts +0 -16
- package/dist/shared/icons/MastercardIcon.js +0 -1
- package/dist/shared/icons/VisaIcon.d.ts +0 -15
- 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 {
|
|
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
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
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
|
-
*
|
|
59
|
-
*
|
|
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. `
|
|
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
|
-
|
|
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
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
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
|
|
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: "
|
|
182
|
+
name: "onrampAmountEntry";
|
|
191
183
|
ctx: {
|
|
192
|
-
method: "
|
|
193
|
-
cashMethod: CashMethodId;
|
|
184
|
+
method: "onramp";
|
|
194
185
|
backTarget: "closed" | "deposit";
|
|
195
186
|
/**
|
|
196
|
-
* Optional initial amount, restored when the user backs out of `
|
|
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: "
|
|
244
|
+
name: "onrampPaymentPending";
|
|
204
245
|
ctx: {
|
|
205
|
-
method: "
|
|
206
|
-
cashMethod: CashMethodId;
|
|
246
|
+
method: "onramp";
|
|
207
247
|
amount: number;
|
|
208
|
-
|
|
209
|
-
|
|
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
|
-
|
|
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
|
|
246
|
-
* widget renders from the driver's `settlement`
|
|
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: "
|
|
305
|
-
|
|
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: "
|
|
371
|
+
type: "ONRAMP_AMOUNT_CONFIRMED";
|
|
308
372
|
amount: number;
|
|
309
373
|
} | {
|
|
310
|
-
|
|
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 `
|
|
441
|
-
* method
|
|
442
|
-
*
|
|
443
|
-
|
|
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
|
-
|
|
578
|
+
selectOnrampCurrency(currency: string): void;
|
|
579
|
+
/** Opens the provider picker from `onrampAmountEntry` (`ONRAMP_PROVIDER_PICKER_OPENED`). */
|
|
580
|
+
openOnrampProviderPicker(): void;
|
|
446
581
|
/**
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
*
|
|
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
|
-
|
|
587
|
+
selectOnrampProvider(providerId: string): void;
|
|
452
588
|
/**
|
|
453
|
-
* Flips `
|
|
454
|
-
*
|
|
455
|
-
*
|
|
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
|
-
|
|
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 {
|
|
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{
|
|
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{
|
|
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 (
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
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`,`
|
|
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};
|