@b3dotfun/sdk 0.1.66 → 0.1.68
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/cjs/anyspend/react/components/AnySpend.d.ts +9 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +40 -11
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +6 -1
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +9 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +16 -14
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +9 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +40 -10
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +10 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +5 -4
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendTournament.d.ts +11 -0
- package/dist/cjs/anyspend/react/components/AnySpendTournament.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/AddressForm.d.ts +9 -0
- package/dist/cjs/anyspend/react/components/checkout/AddressForm.js +14 -0
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +117 -0
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +158 -0
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +81 -0
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +61 -0
- package/dist/cjs/anyspend/react/components/checkout/CartItemRow.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/checkout/CartItemRow.js +9 -0
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.d.ts +30 -0
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.js +20 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +32 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.js +27 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormField.d.ts +10 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormField.js +31 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +39 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.js +75 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutLayout.d.ts +10 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutLayout.js +13 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutOrderStatus.d.ts +28 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutOrderStatus.js +65 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +31 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +64 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.d.ts +10 -0
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.js +31 -0
- package/dist/cjs/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +20 -0
- package/dist/cjs/anyspend/react/components/checkout/CoinbaseCheckoutPanel.js +170 -0
- package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.d.ts +23 -0
- package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +324 -0
- package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.d.ts +12 -0
- package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.js +62 -0
- package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +20 -0
- package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +269 -0
- package/dist/cjs/anyspend/react/components/checkout/PoweredByBranding.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/checkout/PoweredByBranding.js +9 -0
- package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.d.ts +11 -0
- package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.js +20 -0
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +19 -5
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +1 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethodDisplay.js +1 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +4 -4
- package/dist/cjs/anyspend/react/components/common/OrderStatus.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +93 -19
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +4 -4
- package/dist/cjs/anyspend/react/components/common/PaySection.js +1 -1
- package/dist/cjs/anyspend/react/components/common/StepProgress.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/common/StepProgress.js +6 -11
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +1 -1
- package/dist/cjs/anyspend/react/components/common/TransferResultScreen.js +5 -1
- package/dist/cjs/anyspend/react/components/context/AnySpendCustomizationContext.d.ts +16 -0
- package/dist/cjs/anyspend/react/components/context/AnySpendCustomizationContext.js +92 -0
- package/dist/cjs/anyspend/react/components/icons/AnimatedCheckmark.d.ts +23 -0
- package/dist/cjs/anyspend/react/components/icons/AnimatedCheckmark.js +71 -0
- package/dist/cjs/anyspend/react/components/index.d.ts +8 -1
- package/dist/cjs/anyspend/react/components/index.js +10 -1
- package/dist/cjs/anyspend/react/components/types/classes.d.ts +50 -0
- package/dist/cjs/anyspend/react/components/types/customization.d.ts +75 -0
- package/dist/cjs/anyspend/react/components/types/customization.js +2 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +8 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +8 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +15 -3
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +3 -2
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +9 -2
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -0
- package/dist/cjs/anyspend/services/anyspend.d.ts +1 -0
- package/dist/cjs/anyspend/services/anyspend.js +17 -2
- package/dist/cjs/anyspend/types/forms.d.ts +92 -0
- package/dist/cjs/anyspend/types/forms.js +8 -0
- package/dist/cjs/anyspend/utils/format.js +12 -3
- package/dist/cjs/app.shared.js +8 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +9 -3
- package/dist/cjs/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
- package/dist/cjs/global-account/react/components/ui/command.d.ts +7 -7
- package/dist/cjs/global-account/react/components/ui/dialog.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ui/dialog.js +2 -2
- package/dist/cjs/global-account/react/components/ui/drawer.d.ts +3 -1
- package/dist/cjs/global-account/react/components/ui/drawer.js +1 -1
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +4 -4
- package/dist/cjs/global-account/react/hooks/useUser.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +53 -1
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/cjs/shared/constants/chains/supported.d.ts +3 -3
- package/dist/cjs/shared/utils/number.d.ts +5 -0
- package/dist/cjs/shared/utils/number.js +13 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +9 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +41 -12
- package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +6 -1
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +9 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +16 -14
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +9 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +42 -12
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +10 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +5 -4
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendTournament.d.ts +11 -0
- package/dist/esm/anyspend/react/components/AnySpendTournament.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.d.ts +5 -1
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/AddressForm.d.ts +9 -0
- package/dist/esm/anyspend/react/components/checkout/AddressForm.js +11 -0
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +117 -0
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +155 -0
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +81 -0
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +58 -0
- package/dist/esm/anyspend/react/components/checkout/CartItemRow.d.ts +8 -0
- package/dist/esm/anyspend/react/components/checkout/CartItemRow.js +6 -0
- package/dist/esm/anyspend/react/components/checkout/CartSummary.d.ts +30 -0
- package/dist/esm/anyspend/react/components/checkout/CartSummary.js +17 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +32 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.js +24 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormField.d.ts +10 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormField.js +28 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +39 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.js +72 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutLayout.d.ts +10 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutLayout.js +10 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutOrderStatus.d.ts +28 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutOrderStatus.js +62 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +31 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +61 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.d.ts +10 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.js +28 -0
- package/dist/esm/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +20 -0
- package/dist/esm/anyspend/react/components/checkout/CoinbaseCheckoutPanel.js +167 -0
- package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.d.ts +23 -0
- package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +321 -0
- package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.d.ts +12 -0
- package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.js +59 -0
- package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +20 -0
- package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +266 -0
- package/dist/esm/anyspend/react/components/checkout/PoweredByBranding.d.ts +8 -0
- package/dist/esm/anyspend/react/components/checkout/PoweredByBranding.js +6 -0
- package/dist/esm/anyspend/react/components/checkout/ShippingSelector.d.ts +11 -0
- package/dist/esm/anyspend/react/components/checkout/ShippingSelector.js +17 -0
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +19 -5
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +1 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethodDisplay.js +1 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +1 -1
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +4 -4
- package/dist/esm/anyspend/react/components/common/OrderStatus.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +96 -22
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +4 -4
- package/dist/esm/anyspend/react/components/common/PaySection.js +1 -1
- package/dist/esm/anyspend/react/components/common/StepProgress.d.ts +5 -1
- package/dist/esm/anyspend/react/components/common/StepProgress.js +6 -11
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +1 -1
- package/dist/esm/anyspend/react/components/common/TransferResultScreen.js +7 -3
- package/dist/esm/anyspend/react/components/context/AnySpendCustomizationContext.d.ts +16 -0
- package/dist/esm/anyspend/react/components/context/AnySpendCustomizationContext.js +88 -0
- package/dist/esm/anyspend/react/components/icons/AnimatedCheckmark.d.ts +23 -0
- package/dist/esm/anyspend/react/components/icons/AnimatedCheckmark.js +68 -0
- package/dist/esm/anyspend/react/components/index.d.ts +8 -1
- package/dist/esm/anyspend/react/components/index.js +5 -0
- package/dist/esm/anyspend/react/components/types/classes.d.ts +50 -0
- package/dist/esm/anyspend/react/components/types/customization.d.ts +75 -0
- package/dist/esm/anyspend/react/components/types/customization.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +8 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +8 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +15 -3
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +3 -2
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +9 -2
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -0
- package/dist/esm/anyspend/services/anyspend.d.ts +1 -0
- package/dist/esm/anyspend/services/anyspend.js +17 -2
- package/dist/esm/anyspend/types/forms.d.ts +92 -0
- package/dist/esm/anyspend/types/forms.js +7 -0
- package/dist/esm/anyspend/utils/format.js +12 -3
- package/dist/esm/app.shared.js +8 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +9 -3
- package/dist/esm/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
- package/dist/esm/global-account/react/components/ui/command.d.ts +7 -7
- package/dist/esm/global-account/react/components/ui/dialog.d.ts +2 -0
- package/dist/esm/global-account/react/components/ui/dialog.js +2 -2
- package/dist/esm/global-account/react/components/ui/drawer.d.ts +3 -1
- package/dist/esm/global-account/react/components/ui/drawer.js +1 -1
- package/dist/esm/global-account/react/hooks/useAuth.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +4 -4
- package/dist/esm/global-account/react/hooks/useUser.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +53 -1
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/esm/shared/constants/chains/supported.d.ts +3 -3
- package/dist/esm/shared/utils/number.d.ts +5 -0
- package/dist/esm/shared/utils/number.js +12 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +9 -0
- package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +6 -1
- package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +9 -0
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +9 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +10 -1
- package/dist/types/anyspend/react/components/AnySpendDepositUpside.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendStakeB3.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendTournament.d.ts +11 -0
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnyspendSignatureMint.d.ts +5 -1
- package/dist/types/anyspend/react/components/checkout/AddressForm.d.ts +9 -0
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +117 -0
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +81 -0
- package/dist/types/anyspend/react/components/checkout/CartItemRow.d.ts +8 -0
- package/dist/types/anyspend/react/components/checkout/CartSummary.d.ts +30 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +32 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutFormField.d.ts +10 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +39 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutLayout.d.ts +10 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutOrderStatus.d.ts +28 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +31 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutSuccess.d.ts +10 -0
- package/dist/types/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +20 -0
- package/dist/types/anyspend/react/components/checkout/CryptoPayPanel.d.ts +23 -0
- package/dist/types/anyspend/react/components/checkout/DiscountCodeInput.d.ts +12 -0
- package/dist/types/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +20 -0
- package/dist/types/anyspend/react/components/checkout/PoweredByBranding.d.ts +8 -0
- package/dist/types/anyspend/react/components/checkout/ShippingSelector.d.ts +11 -0
- package/dist/types/anyspend/react/components/common/OrderStatus.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/StepProgress.d.ts +5 -1
- package/dist/types/anyspend/react/components/context/AnySpendCustomizationContext.d.ts +16 -0
- package/dist/types/anyspend/react/components/icons/AnimatedCheckmark.d.ts +23 -0
- package/dist/types/anyspend/react/components/index.d.ts +8 -1
- package/dist/types/anyspend/react/components/types/classes.d.ts +50 -0
- package/dist/types/anyspend/react/components/types/customization.d.ts +75 -0
- package/dist/types/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +8 -2
- package/dist/types/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +8 -2
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +15 -3
- package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +9 -2
- package/dist/types/anyspend/services/anyspend.d.ts +1 -0
- package/dist/types/anyspend/types/forms.d.ts +92 -0
- package/dist/types/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
- package/dist/types/global-account/react/components/ui/command.d.ts +7 -7
- package/dist/types/global-account/react/components/ui/dialog.d.ts +2 -0
- package/dist/types/global-account/react/components/ui/drawer.d.ts +3 -1
- package/dist/types/global-account/react/hooks/useAuth.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +4 -4
- package/dist/types/global-account/react/hooks/useUser.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +53 -1
- package/dist/types/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/types/shared/constants/chains/supported.d.ts +3 -3
- package/dist/types/shared/utils/number.d.ts +5 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +84 -37
- package/src/anyspend/react/components/AnySpendBondKit.tsx +12 -1
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +14 -0
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +10 -0
- package/src/anyspend/react/components/AnySpendCustom.tsx +38 -20
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +82 -35
- package/src/anyspend/react/components/AnySpendDeposit.tsx +24 -2
- package/src/anyspend/react/components/AnySpendDepositUpside.tsx +14 -0
- package/src/anyspend/react/components/AnySpendNFT.tsx +14 -0
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +14 -0
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +14 -0
- package/src/anyspend/react/components/AnySpendStakeUpside.tsx +14 -0
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +14 -0
- package/src/anyspend/react/components/AnySpendTournament.tsx +19 -0
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +14 -0
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +10 -0
- package/src/anyspend/react/components/checkout/AddressForm.tsx +98 -0
- package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +398 -0
- package/src/anyspend/react/components/checkout/AnySpendCheckoutTrigger.tsx +221 -0
- package/src/anyspend/react/components/checkout/CartItemRow.tsx +58 -0
- package/src/anyspend/react/components/checkout/CartSummary.tsx +158 -0
- package/src/anyspend/react/components/checkout/CheckoutCartPanel.tsx +98 -0
- package/src/anyspend/react/components/checkout/CheckoutFormField.tsx +129 -0
- package/src/anyspend/react/components/checkout/CheckoutFormPanel.tsx +241 -0
- package/src/anyspend/react/components/checkout/CheckoutLayout.tsx +52 -0
- package/src/anyspend/react/components/checkout/CheckoutOrderStatus.tsx +224 -0
- package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +341 -0
- package/src/anyspend/react/components/checkout/CheckoutSuccess.tsx +110 -0
- package/src/anyspend/react/components/checkout/CoinbaseCheckoutPanel.tsx +279 -0
- package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +630 -0
- package/src/anyspend/react/components/checkout/DiscountCodeInput.tsx +127 -0
- package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +612 -0
- package/src/anyspend/react/components/checkout/PoweredByBranding.tsx +42 -0
- package/src/anyspend/react/components/checkout/ShippingSelector.tsx +73 -0
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +29 -7
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +1 -1
- package/src/anyspend/react/components/common/CryptoPaymentMethodDisplay.tsx +1 -1
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +2 -2
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +5 -5
- package/src/anyspend/react/components/common/OrderStatus.tsx +140 -34
- package/src/anyspend/react/components/common/PanelOnramp.tsx +9 -9
- package/src/anyspend/react/components/common/PaySection.tsx +1 -1
- package/src/anyspend/react/components/common/StepProgress.tsx +40 -52
- package/src/anyspend/react/components/common/TokenBalance.tsx +0 -12
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +1 -9
- package/src/anyspend/react/components/common/TransferResultScreen.tsx +19 -11
- package/src/anyspend/react/components/context/AnySpendCustomizationContext.tsx +124 -0
- package/src/anyspend/react/components/icons/AnimatedCheckmark.tsx +119 -0
- package/src/anyspend/react/components/index.ts +33 -0
- package/src/anyspend/react/components/types/classes.ts +70 -0
- package/src/anyspend/react/components/types/customization.ts +99 -0
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +3 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +3 -2
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +5 -1
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +5 -2
- package/src/anyspend/services/anyspend.ts +19 -2
- package/src/anyspend/types/forms.ts +97 -0
- package/src/anyspend/utils/format.ts +12 -3
- package/src/app.shared.ts +11 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +13 -4
- package/src/global-account/react/components/ui/dialog.tsx +17 -8
- package/src/global-account/react/components/ui/drawer.tsx +2 -2
- package/src/global-account/react/stores/useModalStore.ts +52 -1
- package/src/shared/utils/number.ts +12 -0
- package/src/styles/index.css +48 -2
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useAnyspendCreateOnrampOrder, useAnyspendQuote, useGeoOnrampOptions, useStripeClientSecret, } from "../../../../anyspend/react/index.js";
|
|
4
|
+
import { USDC_BASE } from "../../../../anyspend/constants/index.js";
|
|
5
|
+
import { cn } from "../../../../shared/utils/cn.js";
|
|
6
|
+
import { formatUnits } from "../../../../shared/utils/number.js";
|
|
7
|
+
import { getStripePromise } from "../../../../shared/utils/payment.utils.js";
|
|
8
|
+
import { ShinyButton, TextShimmer, useB3Config, useTokenData } from "../../../../global-account/react/index.js";
|
|
9
|
+
import { AddressElement, Elements, PaymentElement, useElements, useStripe } from "@stripe/react-stripe-js";
|
|
10
|
+
import { Loader2, Lock } from "lucide-react";
|
|
11
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
12
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
13
|
+
export function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onOrderCreated, onError, callbackMetadata, classes, }) {
|
|
14
|
+
// Stable refs for callback props to avoid re-triggering effects
|
|
15
|
+
const onErrorRef = useRef(onError);
|
|
16
|
+
onErrorRef.current = onError;
|
|
17
|
+
const { data: tokenData } = useTokenData(destinationTokenChainId, destinationTokenAddress);
|
|
18
|
+
const { theme, stripePublishableKey } = useB3Config();
|
|
19
|
+
// Clean decimal string for API calls (no commas, no subscripts)
|
|
20
|
+
const formattedAmount = useMemo(() => {
|
|
21
|
+
const decimals = tokenData?.decimals || 18;
|
|
22
|
+
return formatUnits(BigInt(totalAmount).toString(), decimals);
|
|
23
|
+
}, [totalAmount, tokenData]);
|
|
24
|
+
// Determine if destination token is a stablecoin (amount ≈ USD)
|
|
25
|
+
const isStablecoin = useMemo(() => {
|
|
26
|
+
return [
|
|
27
|
+
"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC Base
|
|
28
|
+
"0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT Ethereum
|
|
29
|
+
].some(addr => addr.toLowerCase() === destinationTokenAddress.toLowerCase());
|
|
30
|
+
}, [destinationTokenAddress]);
|
|
31
|
+
// Get USD equivalent via quote for non-stablecoin tokens
|
|
32
|
+
const { anyspendQuote, isLoadingAnyspendQuote } = useAnyspendQuote({
|
|
33
|
+
type: "swap",
|
|
34
|
+
srcChain: 8453, // Base (USDC source)
|
|
35
|
+
dstChain: destinationTokenChainId,
|
|
36
|
+
srcTokenAddress: USDC_BASE.address,
|
|
37
|
+
dstTokenAddress: destinationTokenAddress,
|
|
38
|
+
tradeType: "EXACT_OUTPUT",
|
|
39
|
+
amount: totalAmount,
|
|
40
|
+
});
|
|
41
|
+
// USD amount to charge: direct for stablecoins, quote-derived for others.
|
|
42
|
+
// Rounded to 2 decimals so minor quote fluctuations don't retrigger the Stripe support check.
|
|
43
|
+
const usdAmount = useMemo(() => {
|
|
44
|
+
if (isStablecoin)
|
|
45
|
+
return formattedAmount;
|
|
46
|
+
if (!anyspendQuote?.data?.currencyIn?.amount)
|
|
47
|
+
return null;
|
|
48
|
+
const raw = formatUnits(anyspendQuote.data.currencyIn.amount, USDC_BASE.decimals);
|
|
49
|
+
return parseFloat(raw).toFixed(2);
|
|
50
|
+
}, [isStablecoin, formattedAmount, anyspendQuote]);
|
|
51
|
+
// Debug: log computed values for Stripe flow diagnostics
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
console.log("@@fiat-checkout:debug", {
|
|
54
|
+
totalAmount,
|
|
55
|
+
formattedAmount,
|
|
56
|
+
isStablecoin,
|
|
57
|
+
isLoadingAnyspendQuote,
|
|
58
|
+
quoteAmount: anyspendQuote?.data?.currencyIn?.amount,
|
|
59
|
+
usdAmount,
|
|
60
|
+
});
|
|
61
|
+
}, [totalAmount, formattedAmount, isStablecoin, isLoadingAnyspendQuote, anyspendQuote, usdAmount]);
|
|
62
|
+
const { geoData, stripeOnrampSupport, stripeWeb2Support, isLoading: isLoadingGeo, } = useGeoOnrampOptions(usdAmount || "0");
|
|
63
|
+
// Order state
|
|
64
|
+
const [orderId, setOrderId] = useState(null);
|
|
65
|
+
const [stripePaymentIntentId, setStripePaymentIntentId] = useState(null);
|
|
66
|
+
const [orderError, setOrderError] = useState(null);
|
|
67
|
+
const orderCreatedRef = useRef(false);
|
|
68
|
+
const { createOrder, isCreatingOrder } = useAnyspendCreateOnrampOrder({
|
|
69
|
+
onSuccess: data => {
|
|
70
|
+
const id = data.data?.id;
|
|
71
|
+
const intentId = data.data?.stripePaymentIntentId;
|
|
72
|
+
if (id && intentId) {
|
|
73
|
+
setOrderId(id);
|
|
74
|
+
setStripePaymentIntentId(intentId);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
setOrderError("Failed to initialize payment. Please try again.");
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
onError: (error) => {
|
|
81
|
+
setOrderError(error.message || "Failed to create payment order.");
|
|
82
|
+
onErrorRef.current?.(error);
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
// Auto-create onramp order when Stripe Web2 is supported and all data is ready
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (!isLoadingGeo &&
|
|
88
|
+
(!isStablecoin ? !isLoadingAnyspendQuote : true) &&
|
|
89
|
+
usdAmount &&
|
|
90
|
+
parseFloat(usdAmount) > 0 &&
|
|
91
|
+
stripeWeb2Support?.isSupport &&
|
|
92
|
+
!orderCreatedRef.current &&
|
|
93
|
+
!orderId &&
|
|
94
|
+
!isCreatingOrder &&
|
|
95
|
+
!orderError &&
|
|
96
|
+
tokenData &&
|
|
97
|
+
recipientAddress) {
|
|
98
|
+
orderCreatedRef.current = true;
|
|
99
|
+
const dstToken = {
|
|
100
|
+
address: destinationTokenAddress,
|
|
101
|
+
chainId: destinationTokenChainId,
|
|
102
|
+
decimals: tokenData.decimals || 18,
|
|
103
|
+
symbol: tokenData.symbol || "",
|
|
104
|
+
name: tokenData.name || "",
|
|
105
|
+
metadata: {
|
|
106
|
+
logoURI: tokenData.logoURI || "",
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
createOrder({
|
|
110
|
+
recipientAddress,
|
|
111
|
+
orderType: "swap",
|
|
112
|
+
dstChain: destinationTokenChainId,
|
|
113
|
+
dstToken,
|
|
114
|
+
srcFiatAmount: usdAmount,
|
|
115
|
+
onramp: {
|
|
116
|
+
vendor: "stripe-web2",
|
|
117
|
+
paymentMethod: "",
|
|
118
|
+
country: geoData?.country || "US",
|
|
119
|
+
redirectUrl: window.location.origin,
|
|
120
|
+
},
|
|
121
|
+
expectedDstAmount: totalAmount,
|
|
122
|
+
callbackMetadata,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}, [
|
|
126
|
+
isLoadingGeo,
|
|
127
|
+
isStablecoin,
|
|
128
|
+
isLoadingAnyspendQuote,
|
|
129
|
+
usdAmount,
|
|
130
|
+
stripeWeb2Support,
|
|
131
|
+
orderId,
|
|
132
|
+
isCreatingOrder,
|
|
133
|
+
orderError,
|
|
134
|
+
tokenData,
|
|
135
|
+
recipientAddress,
|
|
136
|
+
destinationTokenAddress,
|
|
137
|
+
destinationTokenChainId,
|
|
138
|
+
totalAmount,
|
|
139
|
+
geoData,
|
|
140
|
+
callbackMetadata,
|
|
141
|
+
createOrder,
|
|
142
|
+
]);
|
|
143
|
+
// Loading geo/stripe support check (and quote for non-stablecoins)
|
|
144
|
+
if (isLoadingGeo || (!isStablecoin && isLoadingAnyspendQuote)) {
|
|
145
|
+
return (_jsxs(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.2, ease: "easeOut" }, className: cn("anyspend-fiat-loading flex flex-col items-center gap-3 py-6", classes?.fiatPanel), children: [_jsx(Loader2, { className: "h-5 w-5 animate-spin text-gray-400" }), _jsx(TextShimmer, { duration: 1.5, className: "text-sm", children: "Loading payment form..." })] }));
|
|
146
|
+
}
|
|
147
|
+
const hasStripeWeb2 = stripeWeb2Support && stripeWeb2Support.isSupport;
|
|
148
|
+
const hasStripeRedirect = !!stripeOnrampSupport;
|
|
149
|
+
// Not available in region
|
|
150
|
+
if (!hasStripeWeb2 && !hasStripeRedirect) {
|
|
151
|
+
return (_jsx(motion.div, { initial: { opacity: 0, y: 8 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.25, ease: "easeOut" }, className: cn("anyspend-fiat-unavailable py-4 text-center", classes?.fiatPanel), children: _jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Card payments are not available in your region for this amount." }) }));
|
|
152
|
+
}
|
|
153
|
+
// Order creation error - show with retry
|
|
154
|
+
if (orderError) {
|
|
155
|
+
return (_jsxs(motion.div, { initial: { opacity: 0, y: 8 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.25, ease: "easeOut" }, className: cn("anyspend-fiat-error flex flex-col items-center gap-3 py-4", classes?.fiatPanel), children: [_jsx("p", { className: "text-sm text-red-500", children: orderError }), _jsx("button", { onClick: () => {
|
|
156
|
+
setOrderError(null);
|
|
157
|
+
orderCreatedRef.current = false;
|
|
158
|
+
}, className: "anyspend-fiat-retry text-sm font-medium text-blue-600 hover:text-blue-700 dark:text-blue-400", children: "Try again" })] }));
|
|
159
|
+
}
|
|
160
|
+
// Creating order / waiting for PaymentIntent
|
|
161
|
+
if (hasStripeWeb2 && (isCreatingOrder || !stripePaymentIntentId)) {
|
|
162
|
+
return (_jsxs(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.2, ease: "easeOut" }, className: cn("anyspend-fiat-initializing flex flex-col items-center gap-3 py-6", classes?.fiatPanel), children: [_jsx(Loader2, { className: "h-5 w-5 animate-spin text-gray-400" }), _jsx(TextShimmer, { duration: 1.5, className: "text-sm", children: "Initializing secure payment..." })] }));
|
|
163
|
+
}
|
|
164
|
+
// Stripe Web2 embedded form
|
|
165
|
+
if (hasStripeWeb2 && stripePaymentIntentId && orderId) {
|
|
166
|
+
return (_jsxs(motion.div, { initial: { opacity: 0, y: 10 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3, ease: "easeOut" }, className: cn("anyspend-fiat-stripe flex flex-col gap-3", classes?.fiatPanel), children: [usdAmount && (_jsxs("div", { className: "anyspend-fiat-summary rounded-lg border border-gray-200 px-4 py-3 dark:border-gray-700", children: [_jsxs("div", { className: "flex items-center justify-between text-sm", children: [_jsx("span", { className: "text-gray-500 dark:text-gray-400", children: "Total" }), _jsxs("span", { className: "font-medium text-gray-900 dark:text-white", children: ["$", parseFloat(usdAmount).toFixed(2)] })] }), !isStablecoin && tokenData && (_jsxs("div", { className: "mt-1 flex items-center justify-between text-xs text-gray-400 dark:text-gray-500", children: [_jsxs("span", { children: [formattedAmount, " ", tokenData.symbol] }), _jsx("span", { children: "incl. fees" })] }))] })), _jsx(StripeCheckout, { stripePaymentIntentId: stripePaymentIntentId, stripePublishableKey: stripePublishableKey, theme: theme, themeColor: themeColor, orderId: orderId, onSuccess: onSuccess, onOrderCreated: onOrderCreated, onError: onError, classes: classes })] }));
|
|
167
|
+
}
|
|
168
|
+
// TODO: Dead code — Stripe onramp is disabled at backend (isStripeOnrampSupported hardcoded false).
|
|
169
|
+
// Remove this block or implement onClick if Stripe onramp is re-enabled.
|
|
170
|
+
return (_jsxs("div", { className: cn("anyspend-fiat-redirect flex flex-col gap-3 py-2", classes?.fiatPanel), children: [_jsx("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "You'll be redirected to Stripe to complete your payment securely." }), _jsx(ShinyButton, { accentColor: themeColor || "hsl(var(--as-brand))", className: "anyspend-fiat-redirect-btn w-full", textClassName: "text-white", children: _jsxs("span", { className: "flex items-center justify-center gap-2", children: [_jsx(Lock, { className: "h-3.5 w-3.5" }), "Pay with Card"] }) }), _jsxs("p", { className: "anyspend-fiat-secured flex items-center justify-center gap-1 text-xs text-gray-400", children: [_jsx(Lock, { className: "h-3 w-3" }), "Secured by Stripe"] })] }));
|
|
171
|
+
}
|
|
172
|
+
function StripeCheckout({ stripePaymentIntentId, stripePublishableKey, theme, themeColor, orderId, onSuccess, onOrderCreated, onError, classes, }) {
|
|
173
|
+
const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } = useStripeClientSecret(stripePaymentIntentId);
|
|
174
|
+
if (isLoadingStripeClientSecret) {
|
|
175
|
+
return (_jsxs(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.2, ease: "easeOut" }, className: "anyspend-stripe-loading flex flex-col items-center gap-3 py-6", children: [_jsx(Loader2, { className: "h-5 w-5 animate-spin text-gray-400" }), _jsx(TextShimmer, { duration: 1.5, className: "text-sm", children: "Loading payment form..." })] }));
|
|
176
|
+
}
|
|
177
|
+
if (stripeClientSecretError || !clientSecret) {
|
|
178
|
+
return (_jsx(motion.div, { initial: { opacity: 0, y: 8 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.25, ease: "easeOut" }, className: "anyspend-stripe-error py-4 text-center", children: _jsx("p", { className: "text-sm text-red-500", children: stripeClientSecretError?.message || "Failed to load payment form. Please try again." }) }));
|
|
179
|
+
}
|
|
180
|
+
return (_jsx(Elements, { stripe: getStripePromise(stripePublishableKey), options: {
|
|
181
|
+
clientSecret,
|
|
182
|
+
appearance: {
|
|
183
|
+
theme: theme === "light" ? "stripe" : "night",
|
|
184
|
+
variables: {
|
|
185
|
+
borderRadius: "8px",
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
}, children: _jsx(StripeCheckoutForm, { themeColor: themeColor, orderId: orderId, onSuccess: onSuccess, onOrderCreated: onOrderCreated, onError: onError, classes: classes }) }));
|
|
189
|
+
}
|
|
190
|
+
function StripeCheckoutForm({ themeColor, orderId, onSuccess, onOrderCreated, onError, classes, }) {
|
|
191
|
+
const stripe = useStripe();
|
|
192
|
+
const elements = useElements();
|
|
193
|
+
const [loading, setLoading] = useState(false);
|
|
194
|
+
const [message, setMessage] = useState(null);
|
|
195
|
+
const [stripeReady, setStripeReady] = useState(false);
|
|
196
|
+
const [showAddressElement, setShowAddressElement] = useState(false);
|
|
197
|
+
useEffect(() => {
|
|
198
|
+
if (stripe && elements) {
|
|
199
|
+
setStripeReady(true);
|
|
200
|
+
}
|
|
201
|
+
}, [stripe, elements]);
|
|
202
|
+
const handlePaymentElementChange = useCallback((event) => {
|
|
203
|
+
setShowAddressElement(event.value?.type === "card");
|
|
204
|
+
}, []);
|
|
205
|
+
const handleSubmit = async (e) => {
|
|
206
|
+
e.preventDefault();
|
|
207
|
+
if (!stripe || !elements) {
|
|
208
|
+
setMessage("Payment system is not ready. Please wait.");
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
setLoading(true);
|
|
212
|
+
setMessage(null);
|
|
213
|
+
try {
|
|
214
|
+
const result = (await stripe.confirmPayment({
|
|
215
|
+
elements,
|
|
216
|
+
redirect: "if_required",
|
|
217
|
+
}));
|
|
218
|
+
if (result.error) {
|
|
219
|
+
console.error("@@checkout-stripe:error:", JSON.stringify(result.error, null, 2));
|
|
220
|
+
setMessage(result.error.message || "Payment failed. Please try again.");
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
console.log("@@checkout-stripe:success:", JSON.stringify({ orderId }, null, 2));
|
|
224
|
+
// Payment succeeded — notify parent to show order lifecycle tracking
|
|
225
|
+
onOrderCreated?.(orderId);
|
|
226
|
+
// Also fire legacy callback for backward compatibility
|
|
227
|
+
onSuccess?.({ orderId, txHash: undefined });
|
|
228
|
+
}
|
|
229
|
+
catch (error) {
|
|
230
|
+
const errorMessage = error?.message || "Payment failed. Please try again.";
|
|
231
|
+
setMessage(errorMessage);
|
|
232
|
+
const errorObj = error instanceof Error ? error : new Error(errorMessage);
|
|
233
|
+
onError?.(errorObj);
|
|
234
|
+
}
|
|
235
|
+
finally {
|
|
236
|
+
setLoading(false);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
const stripeElementOptions = {
|
|
240
|
+
layout: "tabs",
|
|
241
|
+
fields: {
|
|
242
|
+
billingDetails: "auto",
|
|
243
|
+
},
|
|
244
|
+
wallets: {
|
|
245
|
+
applePay: "auto",
|
|
246
|
+
googlePay: "auto",
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
if (!stripeReady) {
|
|
250
|
+
return (_jsxs(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.2, ease: "easeOut" }, className: "anyspend-stripe-loading flex flex-col items-center gap-3 py-6", children: [_jsx(Loader2, { className: "h-5 w-5 animate-spin text-gray-400" }), _jsx(TextShimmer, { duration: 1.5, className: "text-sm", children: "Loading payment form..." })] }));
|
|
251
|
+
}
|
|
252
|
+
return (_jsxs(motion.form, { initial: { opacity: 0, y: 10 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3, ease: "easeOut" }, onSubmit: handleSubmit, className: "anyspend-stripe-form flex flex-col gap-4", children: [_jsx("div", { className: "anyspend-stripe-payment-element", children: _jsx(PaymentElement, { onChange: handlePaymentElementChange, options: stripeElementOptions }) }), _jsx(AnimatePresence, { initial: false, children: showAddressElement && (_jsx(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.25, ease: "easeOut" }, style: { overflow: "hidden" }, className: "anyspend-stripe-address-element", children: _jsx(AddressElement, { options: {
|
|
253
|
+
mode: "billing",
|
|
254
|
+
fields: {
|
|
255
|
+
phone: "always",
|
|
256
|
+
},
|
|
257
|
+
display: {
|
|
258
|
+
name: "split",
|
|
259
|
+
},
|
|
260
|
+
validation: {
|
|
261
|
+
phone: {
|
|
262
|
+
required: "always",
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
} }) }, "address-element")) }), _jsx(AnimatePresence, { initial: false, children: message && (_jsx(motion.div, { initial: { opacity: 0, height: 0 }, animate: { opacity: 1, height: "auto" }, exit: { opacity: 0, height: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, className: "anyspend-stripe-error rounded-lg border border-red-200 bg-red-50 px-3 py-2 dark:border-red-800 dark:bg-red-900/20", children: _jsx("p", { className: "text-sm text-red-600 dark:text-red-400", children: message }) }, "stripe-error")) }), _jsx(ShinyButton, { type: "submit", accentColor: themeColor || "hsl(var(--as-brand))", disabled: !stripe || !elements || loading, className: cn("anyspend-stripe-submit w-full", classes?.payButton), textClassName: "text-white", children: loading ? (_jsxs("span", { className: "flex items-center justify-center gap-2", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), "Processing..."] })) : (_jsxs("span", { className: "flex items-center justify-center gap-2", children: [_jsx(Lock, { className: "h-3.5 w-3.5" }), "Complete Payment"] })) }), _jsxs("p", { className: "anyspend-fiat-secured flex items-center justify-center gap-1 text-xs text-gray-400", children: [_jsx(Lock, { className: "h-3 w-3" }), "Secured by Stripe"] })] }));
|
|
266
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
|
|
2
|
+
interface PoweredByBrandingProps {
|
|
3
|
+
organizationName?: string;
|
|
4
|
+
organizationLogo?: string;
|
|
5
|
+
classes?: AnySpendCheckoutClasses;
|
|
6
|
+
}
|
|
7
|
+
export declare function PoweredByBranding({ organizationName, organizationLogo, classes }: PoweredByBrandingProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../../../shared/utils/cn.js";
|
|
4
|
+
export function PoweredByBranding({ organizationName, organizationLogo, classes }) {
|
|
5
|
+
return (_jsxs("div", { className: cn("flex items-center justify-between pt-4", classes?.poweredBy), children: [organizationLogo || organizationName ? (_jsxs("div", { className: "flex items-center gap-2", children: [organizationLogo && (_jsx("img", { src: organizationLogo, alt: organizationName || "Organization", className: "h-5 w-5 rounded-full" })), organizationName && (_jsx("span", { className: "text-xs font-medium text-gray-600 dark:text-gray-400", children: organizationName }))] })) : (_jsx("div", {})), _jsxs("span", { className: "flex items-center gap-1.5 text-xs text-gray-400 opacity-40 dark:text-gray-500", children: ["powered by", " ", _jsx("img", { src: "https://cdn.b3.fun/anyspend-logo-brand.svg", alt: "AnySpend", className: "inline-block h-3.5 dark:hidden" }), _jsx("img", { src: "https://cdn.b3.fun/anyspend-logo-brand-dark.svg", alt: "AnySpend", className: "hidden h-3.5 dark:inline-block" })] })] }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ShippingOption } from "../../../types/forms";
|
|
2
|
+
interface ShippingSelectorProps {
|
|
3
|
+
options: ShippingOption[];
|
|
4
|
+
selectedId: string | null;
|
|
5
|
+
onSelect: (option: ShippingOption) => void;
|
|
6
|
+
tokenSymbol?: string;
|
|
7
|
+
tokenDecimals?: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function ShippingSelector({ options, selectedId, onSelect, tokenSymbol, tokenDecimals, className, }: ShippingSelectorProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../../../shared/utils/cn.js";
|
|
4
|
+
import { formatTokenAmount, safeBigInt } from "../../../../shared/utils/number.js";
|
|
5
|
+
function formatAmount(amount, decimals, symbol) {
|
|
6
|
+
const bi = safeBigInt(amount);
|
|
7
|
+
if (bi === BigInt(0))
|
|
8
|
+
return "Free";
|
|
9
|
+
return `${formatTokenAmount(bi, decimals)} ${symbol}`;
|
|
10
|
+
}
|
|
11
|
+
export function ShippingSelector({ options, selectedId, onSelect, tokenSymbol = "", tokenDecimals = 6, className, }) {
|
|
12
|
+
if (options.length === 0)
|
|
13
|
+
return null;
|
|
14
|
+
return (_jsxs("div", { className: cn("anyspend-shipping-selector space-y-2", className), children: [_jsx("div", { className: "anyspend-shipping-title text-sm font-semibold text-gray-900 dark:text-gray-100", children: "Shipping" }), _jsx("div", { className: "anyspend-shipping-options space-y-2", children: options.map(option => (_jsxs("label", { className: cn("anyspend-shipping-option flex cursor-pointer items-center justify-between rounded-lg border p-3 transition-colors", selectedId === option.id
|
|
15
|
+
? "anyspend-shipping-option-selected border-blue-500 bg-blue-50 dark:border-blue-400 dark:bg-blue-900/20"
|
|
16
|
+
: "border-gray-200 bg-white hover:border-gray-300 dark:border-neutral-600 dark:bg-neutral-800 dark:hover:border-neutral-500"), children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("input", { type: "radio", name: "shipping", checked: selectedId === option.id, onChange: () => onSelect(option), className: "h-4 w-4 border-gray-300 text-blue-500 focus:ring-blue-500" }), _jsxs("div", { children: [_jsx("div", { className: "anyspend-shipping-option-name text-sm font-medium text-gray-900 dark:text-gray-100", children: option.name }), (option.description || option.estimated_days) && (_jsx("div", { className: "anyspend-shipping-option-detail text-xs text-gray-500 dark:text-gray-400", children: option.description || (option.estimated_days && `${option.estimated_days}`) }))] })] }), _jsx("div", { className: "anyspend-shipping-option-price text-sm font-medium text-gray-900 dark:text-gray-100", children: formatAmount(option.amount, tokenDecimals, tokenSymbol) })] }, option.id))) })] }));
|
|
17
|
+
}
|
|
@@ -6,6 +6,7 @@ import centerTruncate from "../../../../shared/utils/centerTruncate.js";
|
|
|
6
6
|
import { formatTokenAmount } from "../../../../shared/utils/number.js";
|
|
7
7
|
import { motion } from "framer-motion";
|
|
8
8
|
import { ChevronRight, Loader2 } from "lucide-react";
|
|
9
|
+
import { useAnySpendCustomization } from "../context/AnySpendCustomizationContext.js";
|
|
9
10
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod.js";
|
|
10
11
|
import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible.js";
|
|
11
12
|
import { PaymentMethodSwitch } from "./PaymentMethodSwitch.js";
|
|
@@ -16,6 +17,7 @@ export default function ConnectWalletPayment({ order, onPayment, txLoading, isSw
|
|
|
16
17
|
const connectedEvmAddress = cryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
17
18
|
? connectedSmartWallet?.getAccount()?.address
|
|
18
19
|
: connectedEOAWallet?.getAccount()?.address;
|
|
20
|
+
const { slots } = useAnySpendCustomization();
|
|
19
21
|
const srcToken = order.metadata.srcToken;
|
|
20
22
|
const dstToken = order.metadata.dstToken;
|
|
21
23
|
const expectedDstAmount = order.type === "mint_nft" ||
|
|
@@ -28,11 +30,23 @@ export default function ConnectWalletPayment({ order, onPayment, txLoading, isSw
|
|
|
28
30
|
if (!srcToken || !dstToken) {
|
|
29
31
|
return _jsx("div", { children: "Loading..." });
|
|
30
32
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
const paymentLabel = order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
34
|
+
? "Pay from Phantom Wallet"
|
|
35
|
+
: cryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
36
|
+
? "Pay from Global Account"
|
|
37
|
+
: "Pay from Connected Wallet";
|
|
38
|
+
const connectedAddress = order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
39
|
+
? phantomWalletAddress
|
|
40
|
+
: connectedEvmAddress;
|
|
41
|
+
if (slots.connectWalletButton) {
|
|
42
|
+
return (_jsx("div", { className: "flex w-full flex-col items-center gap-6", children: slots.connectWalletButton({
|
|
43
|
+
onPayment,
|
|
44
|
+
txLoading,
|
|
45
|
+
connectedAddress: connectedAddress || undefined,
|
|
46
|
+
paymentLabel,
|
|
47
|
+
}) }));
|
|
48
|
+
}
|
|
49
|
+
return (_jsx("div", { className: "flex w-full flex-col items-center gap-6", children: _jsxs(motion.div, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { delay: 0.5 }, className: "flex w-full flex-col items-center gap-2", children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-5/6 max-w-[400px] items-center gap-2 sm:px-0", disabled: txLoading || isSwitchingOrExecuting, onClick: onPayment, children: txLoading ? (_jsxs(_Fragment, { children: ["Transaction Pending", _jsx(Loader2, { className: "ml-2 h-5 w-5 animate-spin" })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "whitespace-nowrap pl-4 text-lg md:text-sm", children: paymentLabel }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) }), _jsxs("span", { className: "label-style text-as-primary/50 text-xs", children: ["Connected to:", " ", order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
36
50
|
? centerTruncate(phantomWalletAddress, 6)
|
|
37
51
|
: centerTruncate(connectedEvmAddress || "")] }), _jsx(PaymentMethodSwitch, { currentMethod: cryptoPaymentMethod, onMethodChange: onPaymentMethodChange }), _jsx("div", { className: "mt-4", children: _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }) })] }) }));
|
|
38
52
|
}
|
|
@@ -40,7 +40,7 @@ export function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, se
|
|
|
40
40
|
}, [selectedSrcToken.address, selectedSrcToken.chainId]);
|
|
41
41
|
return (_jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: classes?.container ||
|
|
42
42
|
"pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: classes?.label || "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: ["Pay", !isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }))] }), _jsx("button", { className: classes?.paymentMethodButton ||
|
|
43
|
-
"text-as-
|
|
43
|
+
"text-as-tertiary flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none", onClick: onSelectCryptoPaymentMethod, children: _jsx(CryptoPaymentMethodDisplay, { paymentMethod: selectedCryptoPaymentMethod, connectedAddress: walletAddress, connectedName: connectedName }) })] }), _jsx("div", { className: classes?.inputContainer, children: _jsx(OrderTokenAmount, { address: walletAddress, context: "from", inputValue: srcAmount, onChangeInput: value => {
|
|
44
44
|
setIsSrcInputDirty(true);
|
|
45
45
|
setSrcAmount(value);
|
|
46
46
|
}, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken, onTokenSelect: onTokenSelect }) }), _jsxs("div", { className: classes?.balanceRow || "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: formatDisplayNumber(anyspendQuote?.data?.currencyIn?.amountUsd, {
|
|
@@ -12,7 +12,7 @@ import { CryptoPaymentMethodType } from "./CryptoPaymentMethod.js";
|
|
|
12
12
|
*/
|
|
13
13
|
export function CryptoPaymentMethodDisplay({ paymentMethod, connectedAddress, connectedName, }) {
|
|
14
14
|
if (paymentMethod === CryptoPaymentMethodType.CONNECT_WALLET) {
|
|
15
|
-
return (_jsxs(_Fragment, { children: [connectedAddress ? (_jsx("span", { className: "text-as-
|
|
15
|
+
return (_jsxs(_Fragment, { children: [connectedAddress ? (_jsx("span", { className: "text-as-tertiary whitespace-nowrap", children: connectedName ? formatUsername(connectedName) : shortenAddress(connectedAddress) })) : (_jsx("span", { className: "whitespace-nowrap", children: "Connect wallet" })), _jsx(ChevronRight, { className: "h-4 w-4 shrink-0" })] }));
|
|
16
16
|
}
|
|
17
17
|
if (paymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET) {
|
|
18
18
|
return (_jsxs(_Fragment, { children: [_jsx("span", { className: "whitespace-nowrap", children: "Global Account" }), _jsx(ChevronRight, { className: "h-4 w-4 shrink-0" })] }));
|
|
@@ -9,7 +9,7 @@ import { OrderTokenAmount } from "./OrderTokenAmount.js";
|
|
|
9
9
|
import { PointsBadge } from "./PointsBadge.js";
|
|
10
10
|
export function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, effectiveRecipientAddress, recipientName, customRecipientLabel, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, disableAmountInput, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, classes, }) {
|
|
11
11
|
return (_jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: classes?.container ||
|
|
12
|
-
"receive-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("div", { className: classes?.label || "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: [isDepositMode ? "Deposit" : "Receive", isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }))] }), effectiveRecipientAddress ? (_jsx("button", { className: classes?.recipientButton || "text-as-
|
|
12
|
+
"receive-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("div", { className: classes?.label || "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: [isDepositMode ? "Deposit" : "Receive", isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }))] }), effectiveRecipientAddress ? (_jsx("button", { className: classes?.recipientButton || "text-as-tertiary flex h-7 items-center gap-2 rounded-lg", onClick: onSelectRecipient, children: _jsxs(_Fragment, { children: [_jsx("span", { className: classes?.recipientValue || "text-as-tertiary flex items-center gap-1 text-sm", children: customRecipientLabel ||
|
|
13
13
|
(recipientName ? formatUsername(recipientName) : shortenAddress(effectiveRecipientAddress || "")) }), _jsx(ChevronRight, { className: "h-4 w-4" })] }) })) : (_jsx("button", { className: classes?.recipientButton || "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: onSelectRecipient, children: _jsx("div", { className: "text-sm font-medium", children: "Select recipient" }) }))] }), isBuyMode || isDepositMode ? (
|
|
14
14
|
// Fixed destination token display for buy mode and deposit mode
|
|
15
15
|
_jsxs("div", { className: classes?.inputContainer || "flex items-center justify-between", children: [_jsx("div", { className: classes?.input || "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), _jsxs("div", { className: classes?.tokenSelector ||
|
|
@@ -21,12 +21,12 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({ o
|
|
|
21
21
|
? "0"
|
|
22
22
|
: order.type === "custom" || order.type === "deposit_first"
|
|
23
23
|
? order.payload.amount?.toString() || "0"
|
|
24
|
-
: order.payload.expectedDstAmount
|
|
24
|
+
: order.payload.expectedDstAmount?.toString() || "0";
|
|
25
25
|
const finalFormattedExpectedDstAmount = formattedExpectedDstAmount || formatTokenAmount(BigInt(expectedDstAmount), dstToken.decimals);
|
|
26
26
|
return (_jsx("div", { className: cn(classes?.container ||
|
|
27
|
-
"order-details-collapsible bg-as-surface-secondary border-as-border-secondary rounded-xl border px-4 py-2", className), children: showOrderDetails ? (_jsx(motion.div, { className: "order-details-expanded w-full", initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsxs("div", { className: "order-details-content flex w-full flex-col items-center gap-3 whitespace-nowrap py-2 text-sm", children: [_jsxs("div", { className: "order-details-recipient-section flex w-full justify-between gap-4", children: [_jsx("div", { className: "order-details-recipient-label text-as-
|
|
27
|
+
"order-details-collapsible bg-as-surface-secondary border-as-border-secondary rounded-xl border px-4 py-2", className), children: showOrderDetails ? (_jsx(motion.div, { className: "order-details-expanded w-full", initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsxs("div", { className: "order-details-content flex w-full flex-col items-center gap-3 whitespace-nowrap py-2 text-sm", children: [_jsxs("div", { className: "order-details-recipient-section flex w-full justify-between gap-4", children: [_jsx("div", { className: "order-details-recipient-label text-as-tertiary", children: "Recipient" }), _jsxs("div", { className: "order-details-recipient-info flex flex-col items-end gap-1", children: [recipientName && (_jsx("div", { className: "order-details-recipient-name text-as-primary font-semibold", children: recipientName })), _jsx(CopyToClipboard, { text: order.recipientAddress, onCopy: () => {
|
|
28
28
|
toast.success("Copied recipient address to clipboard");
|
|
29
|
-
}, children: _jsxs("div", { className: "order-details-recipient-address text-as-primary flex items-center gap-2", children: [centerTruncate(order.recipientAddress, 10), _jsx(Copy, { className: "order-details-recipient-copy-icon text-as-primary/50 hover:text-as-primary h-4 w-4 cursor-pointer transition-all duration-200" })] }) })] })] }), _jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-expected-section flex w-full items-start justify-between gap-2", children: [_jsx("div", { className: "order-details-expected-label text-as-
|
|
29
|
+
}, children: _jsxs("div", { className: "order-details-recipient-address text-as-primary flex items-center gap-2", children: [centerTruncate(order.recipientAddress, 10), _jsx(Copy, { className: "order-details-recipient-copy-icon text-as-primary/50 hover:text-as-primary h-4 w-4 cursor-pointer transition-all duration-200" })] }) })] })] }), _jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-expected-section flex w-full items-start justify-between gap-2", children: [_jsx("div", { className: "order-details-expected-label text-as-tertiary shrink-0", children: order.type === "swap" ||
|
|
30
30
|
order.type === "deposit_first" ||
|
|
31
31
|
order.type === "mint_nft" ||
|
|
32
32
|
order.type === "hype_duel"
|
|
@@ -39,5 +39,5 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({ o
|
|
|
39
39
|
? order.metadata.action
|
|
40
40
|
? capitalizeFirstLetter(order.metadata.action)
|
|
41
41
|
: "Contract execution"
|
|
42
|
-
: "" }), _jsxs("div", { className: "order-details-expected-value flex flex-wrap items-center justify-end gap-2", children: [order.type === "swap" || order.type === "deposit_first" ? (_jsx("span", { className: "order-details-amount-text", children: `~${finalFormattedExpectedDstAmount} ${dstToken.symbol}` })) : order.type === "mint_nft" ? (_jsxs("div", { className: "order-details-nft-info flex items-center gap-2", children: [_jsx("img", { src: nft?.imageUrl, alt: nft?.name || "NFT", className: "order-details-nft-image h-5 w-5" }), _jsx("div", { className: "order-details-nft-name", children: nft?.name || "NFT" })] })) : order.type === "join_tournament" || order.type === "fund_tournament" ? (_jsxs("div", { className: "order-details-tournament-info flex items-center gap-2", children: [_jsx("img", { src: tournament?.imageUrl, alt: tournament?.name || "Tournament", className: "order-details-tournament-image h-5 w-5" }), _jsx("div", { className: "order-details-tournament-name", children: tournament?.name || "Tournament" })] })) : order.type === "hype_duel" ? (_jsx("div", { className: "order-details-hype-info flex items-center gap-2", children: _jsxs("div", { className: "order-details-hype-amount", children: [formatTokenAmount(BigInt(order.payload.expectedDstAmount), dstToken.decimals), " HYPE"] }) })) : order.type === "custom" || order.type === "custom_exact_in" ? (_jsx("span", { className: "order-details-amount-text", children: `~${finalFormattedExpectedDstAmount} ${dstToken.symbol}` })) : null, _jsxs("div", { className: "order-details-chain-info text-as-primary/50 flex items-center gap-2", children: [_jsxs("span", { className: "order-details-chain-text", children: ["on ", order.dstChain !== b3.id && getChainName(order.dstChain)] }), _jsx("img", { src: ALL_CHAINS[order.dstChain].logoUrl, alt: getChainName(order.dstChain), className: cn("order-details-chain-logo h-3", order.dstChain !== b3.id && "w-3 rounded-full", order.dstChain === b3.id && "h-4") })] })] })] }), points !== undefined && points !== null && (_jsxs(_Fragment, { children: [_jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-points-section flex w-full justify-between gap-4", children: [_jsx("div", { className: "order-details-points-label text-as-
|
|
42
|
+
: "" }), _jsxs("div", { className: "order-details-expected-value flex flex-wrap items-center justify-end gap-2", children: [order.type === "swap" || order.type === "deposit_first" ? (_jsx("span", { className: "order-details-amount-text", children: `~${finalFormattedExpectedDstAmount} ${dstToken.symbol}` })) : order.type === "mint_nft" ? (_jsxs("div", { className: "order-details-nft-info flex items-center gap-2", children: [_jsx("img", { src: nft?.imageUrl, alt: nft?.name || "NFT", className: "order-details-nft-image h-5 w-5" }), _jsx("div", { className: "order-details-nft-name", children: nft?.name || "NFT" })] })) : order.type === "join_tournament" || order.type === "fund_tournament" ? (_jsxs("div", { className: "order-details-tournament-info flex items-center gap-2", children: [_jsx("img", { src: tournament?.imageUrl, alt: tournament?.name || "Tournament", className: "order-details-tournament-image h-5 w-5" }), _jsx("div", { className: "order-details-tournament-name", children: tournament?.name || "Tournament" })] })) : order.type === "hype_duel" ? (_jsx("div", { className: "order-details-hype-info flex items-center gap-2", children: _jsxs("div", { className: "order-details-hype-amount", children: [formatTokenAmount(BigInt(order.payload.expectedDstAmount), dstToken.decimals), " HYPE"] }) })) : order.type === "custom" || order.type === "custom_exact_in" ? (_jsx("span", { className: "order-details-amount-text", children: `~${finalFormattedExpectedDstAmount} ${dstToken.symbol}` })) : null, _jsxs("div", { className: "order-details-chain-info text-as-primary/50 flex items-center gap-2", children: [_jsxs("span", { className: "order-details-chain-text", children: ["on ", order.dstChain !== b3.id && getChainName(order.dstChain)] }), _jsx("img", { src: ALL_CHAINS[order.dstChain].logoUrl, alt: getChainName(order.dstChain), className: cn("order-details-chain-logo h-3", order.dstChain !== b3.id && "w-3 rounded-full", order.dstChain === b3.id && "h-4") })] })] })] }), points !== undefined && points !== null && (_jsxs(_Fragment, { children: [_jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-points-section flex w-full justify-between gap-4", children: [_jsx("div", { className: "order-details-points-label text-as-tertiary", children: "Points" }), _jsxs("div", { className: "order-details-points-value text-as-brand font-semibold", children: ["+", formatNumber(points), " pts"] })] })] })), _jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-id-total-section flex w-full justify-between gap-4", children: [_jsx("div", { className: "order-details-id-total-label text-as-tertiary", children: showTotal ? "Total (included fee)" : "Order ID" }), _jsx("div", { className: "order-details-id-total-value text-as-primary overflow-hidden text-ellipsis whitespace-nowrap", children: showTotal && totalAmount ? totalAmount : order.id })] })] }) })) : (_jsxs("div", { className: "order-details-collapsed flex w-full items-center", children: [_jsx("div", { className: "order-details-collapsed-divider divider w-full" }), _jsx("button", { className: "order-details-collapsed-button whitespace-nowrap text-sm", onClick: () => setShowOrderDetails(true), children: "Order Details" }), _jsx(ChevronDown, { className: "order-details-collapsed-chevron text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" }), _jsx("div", { className: "order-details-collapsed-divider divider w-full" })] })) }));
|
|
43
43
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { components } from "../../../../anyspend/types/api";
|
|
2
|
+
import React from "react";
|
|
2
3
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
3
|
-
export declare const OrderStatus:
|
|
4
|
+
export declare const OrderStatus: React.NamedExoticComponent<{
|
|
4
5
|
order: components["schemas"]["Order"];
|
|
5
6
|
selectedCryptoPaymentMethod?: CryptoPaymentMethodType;
|
|
6
7
|
}>;
|
|
@@ -1,39 +1,113 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { getStatusDisplay } from "../../../../anyspend/index.js";
|
|
3
3
|
import { useSearchParams } from "../../../../shared/react/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import { memo } from "react";
|
|
4
|
+
import { Clock, Loader2, RotateCcw, X } from "lucide-react";
|
|
5
|
+
import { memo, useEffect, useRef } from "react";
|
|
6
|
+
import { useAnySpendCustomization } from "../context/AnySpendCustomizationContext.js";
|
|
7
|
+
import { AnimatedCheckmark } from "../icons/AnimatedCheckmark.js";
|
|
6
8
|
import { StepProgress } from "./StepProgress.js";
|
|
9
|
+
/** Map order status to its step index in the StepProgress. -1 = not a step state. */
|
|
10
|
+
function getStepIndex(status) {
|
|
11
|
+
if (["waiting_stripe_payment", "scanning_deposit_transaction"].includes(status))
|
|
12
|
+
return 0;
|
|
13
|
+
if (["quoting_after_deposit", "sending_token_from_vault", "relay", "executing"].includes(status))
|
|
14
|
+
return 1;
|
|
15
|
+
return -1;
|
|
16
|
+
}
|
|
7
17
|
export const OrderStatus = memo(function OrderStatus({ order, selectedCryptoPaymentMethod, }) {
|
|
8
|
-
const
|
|
9
|
-
const {
|
|
18
|
+
const { text: defaultText, description: defaultDescription } = getStatusDisplay(order);
|
|
19
|
+
const { content, slots } = useAnySpendCustomization();
|
|
10
20
|
const searchParams = useSearchParams();
|
|
11
21
|
const cryptoPaymentMethod = selectedCryptoPaymentMethod || searchParams.get("cryptoPaymentMethod");
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
const currentStepIndex = getStepIndex(order.status);
|
|
23
|
+
const prevStepIndexRef = useRef(currentStepIndex);
|
|
24
|
+
const shouldAnimateCheck = currentStepIndex > prevStepIndexRef.current;
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
prevStepIndexRef.current = currentStepIndex;
|
|
27
|
+
}, [currentStepIndex]);
|
|
28
|
+
// Resolve content overrides based on order status
|
|
29
|
+
let text = defaultText;
|
|
30
|
+
let description = defaultDescription;
|
|
31
|
+
if (order.status === "executed") {
|
|
32
|
+
if (content.successTitle && typeof content.successTitle === "string")
|
|
33
|
+
text = content.successTitle;
|
|
34
|
+
if (content.successDescription)
|
|
35
|
+
description = content.successDescription;
|
|
36
|
+
}
|
|
37
|
+
else if (order.status === "failure") {
|
|
38
|
+
if (content.failureTitle && typeof content.failureTitle === "string")
|
|
39
|
+
text = content.failureTitle;
|
|
40
|
+
if (content.failureDescription)
|
|
41
|
+
description = content.failureDescription;
|
|
42
|
+
}
|
|
43
|
+
else if (order.status === "expired") {
|
|
44
|
+
if (content.expiredTitle && typeof content.expiredTitle === "string")
|
|
45
|
+
text = content.expiredTitle;
|
|
46
|
+
if (content.expiredDescription)
|
|
47
|
+
description = content.expiredDescription;
|
|
48
|
+
}
|
|
49
|
+
else if (order.status === "refunded") {
|
|
50
|
+
if (content.refundedTitle && typeof content.refundedTitle === "string")
|
|
51
|
+
text = content.refundedTitle;
|
|
52
|
+
if (content.refundedDescription)
|
|
53
|
+
description = content.refundedDescription;
|
|
54
|
+
}
|
|
55
|
+
else if (content.processingTitle || content.processingDescription) {
|
|
56
|
+
if (content.processingTitle && typeof content.processingTitle === "string")
|
|
57
|
+
text = content.processingTitle;
|
|
58
|
+
if (content.processingDescription)
|
|
59
|
+
description = content.processingDescription;
|
|
60
|
+
}
|
|
14
61
|
const paymentSteps = [
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
title: text,
|
|
18
|
-
description: description,
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: 2,
|
|
22
|
-
title: text,
|
|
23
|
-
description: description,
|
|
24
|
-
},
|
|
62
|
+
{ id: 1, title: text, description: typeof description === "string" ? description : defaultDescription || "" },
|
|
63
|
+
{ id: 2, title: text, description: typeof description === "string" ? description : defaultDescription || "" },
|
|
25
64
|
];
|
|
26
|
-
if (
|
|
27
|
-
// hide step if order is scanning_deposit_transaction and crypto payment method is transfer_crypto
|
|
65
|
+
if (currentStepIndex === 0) {
|
|
28
66
|
if (!(order.status === "scanning_deposit_transaction" && cryptoPaymentMethod === "transfer_crypto")) {
|
|
29
67
|
return _jsx(StepProgress, { steps: paymentSteps, currentStepIndex: 0 });
|
|
30
68
|
}
|
|
31
69
|
}
|
|
32
|
-
if (
|
|
33
|
-
return _jsx(StepProgress, { steps: paymentSteps, currentStepIndex: 1 });
|
|
70
|
+
if (currentStepIndex === 1) {
|
|
71
|
+
return _jsx(StepProgress, { steps: paymentSteps, currentStepIndex: 1, animateCompletedSteps: shouldAnimateCheck });
|
|
72
|
+
}
|
|
73
|
+
if (order.status === "refunding") {
|
|
74
|
+
return (_jsx("div", { className: "flex items-center justify-center gap-2", children: _jsxs("div", { className: "flex flex-col items-center", children: [_jsx("div", { className: "flex h-12 w-12 items-center justify-center rounded-full bg-amber-500/15", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-amber-500" }) }), _jsx("h2", { className: "text-as-primary mt-4 text-xl font-semibold", children: text }), _jsx("div", { className: "text-as-tertiary mt-1 text-center text-sm", children: description })] }) }));
|
|
34
75
|
}
|
|
35
76
|
if (selectedCryptoPaymentMethod === "transfer_crypto" && order.status === "scanning_deposit_transaction") {
|
|
36
77
|
return null;
|
|
37
78
|
}
|
|
38
|
-
|
|
79
|
+
if (order.status === "executed") {
|
|
80
|
+
return (_jsx("div", { className: "flex items-center justify-center gap-2", children: _jsxs("div", { className: "flex flex-col items-center", children: [_jsx(AnimatedCheckmark, { className: "h-14 w-14" }), _jsx("h2", { className: "text-as-primary mt-4 text-xl font-semibold", children: content.successTitle || text }), _jsx("div", { className: "text-as-tertiary mt-1 text-center text-sm", children: content.successDescription || description })] }) }));
|
|
81
|
+
}
|
|
82
|
+
if (order.status === "expired") {
|
|
83
|
+
if (slots.errorScreen) {
|
|
84
|
+
return (_jsx(_Fragment, { children: slots.errorScreen({
|
|
85
|
+
title: text,
|
|
86
|
+
description: typeof description === "string" ? description : defaultDescription || "",
|
|
87
|
+
errorType: "expired",
|
|
88
|
+
orderId: order.id,
|
|
89
|
+
}) }));
|
|
90
|
+
}
|
|
91
|
+
return (_jsx("div", { className: "flex items-center justify-center gap-2", children: _jsxs("div", { className: "flex flex-col items-center", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-amber-500/15", children: _jsx(Clock, { className: "h-5 w-5 text-amber-500" }) }), _jsx("h2", { className: "text-as-primary mt-4 text-xl font-semibold", children: text }), _jsx("div", { className: "text-as-tertiary mt-1 text-center text-sm", children: description })] }) }));
|
|
92
|
+
}
|
|
93
|
+
if (order.status === "refunded") {
|
|
94
|
+
if (slots.errorScreen) {
|
|
95
|
+
return (_jsx(_Fragment, { children: slots.errorScreen({
|
|
96
|
+
title: text,
|
|
97
|
+
description: typeof description === "string" ? description : defaultDescription || "",
|
|
98
|
+
errorType: "refunded",
|
|
99
|
+
orderId: order.id,
|
|
100
|
+
}) }));
|
|
101
|
+
}
|
|
102
|
+
return (_jsx("div", { className: "flex items-center justify-center gap-2", children: _jsxs("div", { className: "flex flex-col items-center", children: [_jsx("div", { className: "bg-as-surface-secondary flex h-10 w-10 items-center justify-center rounded-full", children: _jsx(RotateCcw, { className: "text-as-secondary h-5 w-5" }) }), _jsx("h2", { className: "text-as-primary mt-4 text-xl font-semibold", children: text }), _jsx("div", { className: "text-as-tertiary mt-1 text-center text-sm", children: description })] }) }));
|
|
103
|
+
}
|
|
104
|
+
if (slots.errorScreen) {
|
|
105
|
+
return (_jsx(_Fragment, { children: slots.errorScreen({
|
|
106
|
+
title: text,
|
|
107
|
+
description: typeof description === "string" ? description : defaultDescription || "",
|
|
108
|
+
errorType: "failure",
|
|
109
|
+
orderId: order.id,
|
|
110
|
+
}) }));
|
|
111
|
+
}
|
|
112
|
+
return (_jsx("div", { className: "flex items-center justify-center gap-2", children: _jsxs("div", { className: "flex flex-col items-center", children: [_jsx("div", { className: "bg-as-error-secondary flex h-10 w-10 items-center justify-center rounded-full", children: _jsx(X, { className: "text-as-content-icon-error h-5 w-5" }) }), _jsx("h2", { className: "text-as-primary mt-4 text-xl font-semibold", children: text }), _jsx("div", { className: "text-as-tertiary mt-1 text-center text-sm", style: { whiteSpace: "normal" }, children: description })] }) }));
|
|
39
113
|
});
|