@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,612 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
useAnyspendCreateOnrampOrder,
|
|
5
|
+
useAnyspendQuote,
|
|
6
|
+
useGeoOnrampOptions,
|
|
7
|
+
useStripeClientSecret,
|
|
8
|
+
} from "@b3dotfun/sdk/anyspend/react";
|
|
9
|
+
import { USDC_BASE } from "@b3dotfun/sdk/anyspend/constants";
|
|
10
|
+
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
11
|
+
import { formatUnits } from "@b3dotfun/sdk/shared/utils/number";
|
|
12
|
+
import { getStripePromise } from "@b3dotfun/sdk/shared/utils/payment.utils";
|
|
13
|
+
import { ShinyButton, TextShimmer, useB3Config, useTokenData } from "@b3dotfun/sdk/global-account/react";
|
|
14
|
+
import { AddressElement, Elements, PaymentElement, useElements, useStripe } from "@stripe/react-stripe-js";
|
|
15
|
+
import type { PaymentIntentResult, StripePaymentElementOptions } from "@stripe/stripe-js";
|
|
16
|
+
import { Loader2, Lock } from "lucide-react";
|
|
17
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
18
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
19
|
+
import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
|
|
20
|
+
|
|
21
|
+
interface FiatCheckoutPanelProps {
|
|
22
|
+
recipientAddress: string;
|
|
23
|
+
destinationTokenAddress: string;
|
|
24
|
+
destinationTokenChainId: number;
|
|
25
|
+
totalAmount: string;
|
|
26
|
+
themeColor?: string;
|
|
27
|
+
/** @deprecated Use onOrderCreated instead. Kept for backward compatibility. */
|
|
28
|
+
onSuccess?: (result: { txHash?: string; orderId?: string }) => void;
|
|
29
|
+
/** Called when payment is confirmed — triggers lifecycle tracking in parent */
|
|
30
|
+
onOrderCreated?: (orderId: string) => void;
|
|
31
|
+
onError?: (error: Error) => void;
|
|
32
|
+
callbackMetadata?: Record<string, unknown>;
|
|
33
|
+
classes?: AnySpendCheckoutClasses;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function FiatCheckoutPanel({
|
|
37
|
+
recipientAddress,
|
|
38
|
+
destinationTokenAddress,
|
|
39
|
+
destinationTokenChainId,
|
|
40
|
+
totalAmount,
|
|
41
|
+
themeColor,
|
|
42
|
+
onSuccess,
|
|
43
|
+
onOrderCreated,
|
|
44
|
+
onError,
|
|
45
|
+
callbackMetadata,
|
|
46
|
+
classes,
|
|
47
|
+
}: FiatCheckoutPanelProps) {
|
|
48
|
+
// Stable refs for callback props to avoid re-triggering effects
|
|
49
|
+
const onErrorRef = useRef(onError);
|
|
50
|
+
onErrorRef.current = onError;
|
|
51
|
+
|
|
52
|
+
const { data: tokenData } = useTokenData(destinationTokenChainId, destinationTokenAddress);
|
|
53
|
+
const { theme, stripePublishableKey } = useB3Config();
|
|
54
|
+
|
|
55
|
+
// Clean decimal string for API calls (no commas, no subscripts)
|
|
56
|
+
const formattedAmount = useMemo(() => {
|
|
57
|
+
const decimals = tokenData?.decimals || 18;
|
|
58
|
+
return formatUnits(BigInt(totalAmount).toString(), decimals);
|
|
59
|
+
}, [totalAmount, tokenData]);
|
|
60
|
+
|
|
61
|
+
// Determine if destination token is a stablecoin (amount ≈ USD)
|
|
62
|
+
const isStablecoin = useMemo(() => {
|
|
63
|
+
return [
|
|
64
|
+
"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC Base
|
|
65
|
+
"0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT Ethereum
|
|
66
|
+
].some(addr => addr.toLowerCase() === destinationTokenAddress.toLowerCase());
|
|
67
|
+
}, [destinationTokenAddress]);
|
|
68
|
+
|
|
69
|
+
// Get USD equivalent via quote for non-stablecoin tokens
|
|
70
|
+
const { anyspendQuote, isLoadingAnyspendQuote } = useAnyspendQuote({
|
|
71
|
+
type: "swap",
|
|
72
|
+
srcChain: 8453, // Base (USDC source)
|
|
73
|
+
dstChain: destinationTokenChainId,
|
|
74
|
+
srcTokenAddress: USDC_BASE.address,
|
|
75
|
+
dstTokenAddress: destinationTokenAddress,
|
|
76
|
+
tradeType: "EXACT_OUTPUT",
|
|
77
|
+
amount: totalAmount,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// USD amount to charge: direct for stablecoins, quote-derived for others.
|
|
81
|
+
// Rounded to 2 decimals so minor quote fluctuations don't retrigger the Stripe support check.
|
|
82
|
+
const usdAmount = useMemo(() => {
|
|
83
|
+
if (isStablecoin) return formattedAmount;
|
|
84
|
+
if (!anyspendQuote?.data?.currencyIn?.amount) return null;
|
|
85
|
+
const raw = formatUnits(anyspendQuote.data.currencyIn.amount, USDC_BASE.decimals);
|
|
86
|
+
return parseFloat(raw).toFixed(2);
|
|
87
|
+
}, [isStablecoin, formattedAmount, anyspendQuote]);
|
|
88
|
+
|
|
89
|
+
// Debug: log computed values for Stripe flow diagnostics
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
console.log("@@fiat-checkout:debug", {
|
|
92
|
+
totalAmount,
|
|
93
|
+
formattedAmount,
|
|
94
|
+
isStablecoin,
|
|
95
|
+
isLoadingAnyspendQuote,
|
|
96
|
+
quoteAmount: anyspendQuote?.data?.currencyIn?.amount,
|
|
97
|
+
usdAmount,
|
|
98
|
+
});
|
|
99
|
+
}, [totalAmount, formattedAmount, isStablecoin, isLoadingAnyspendQuote, anyspendQuote, usdAmount]);
|
|
100
|
+
|
|
101
|
+
const {
|
|
102
|
+
geoData,
|
|
103
|
+
stripeOnrampSupport,
|
|
104
|
+
stripeWeb2Support,
|
|
105
|
+
isLoading: isLoadingGeo,
|
|
106
|
+
} = useGeoOnrampOptions(usdAmount || "0");
|
|
107
|
+
|
|
108
|
+
// Order state
|
|
109
|
+
const [orderId, setOrderId] = useState<string | null>(null);
|
|
110
|
+
const [stripePaymentIntentId, setStripePaymentIntentId] = useState<string | null>(null);
|
|
111
|
+
const [orderError, setOrderError] = useState<string | null>(null);
|
|
112
|
+
const orderCreatedRef = useRef(false);
|
|
113
|
+
|
|
114
|
+
const { createOrder, isCreatingOrder } = useAnyspendCreateOnrampOrder({
|
|
115
|
+
onSuccess: data => {
|
|
116
|
+
const id = data.data?.id;
|
|
117
|
+
const intentId = data.data?.stripePaymentIntentId;
|
|
118
|
+
if (id && intentId) {
|
|
119
|
+
setOrderId(id);
|
|
120
|
+
setStripePaymentIntentId(intentId);
|
|
121
|
+
} else {
|
|
122
|
+
setOrderError("Failed to initialize payment. Please try again.");
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
onError: (error: Error) => {
|
|
126
|
+
setOrderError(error.message || "Failed to create payment order.");
|
|
127
|
+
onErrorRef.current?.(error);
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// Auto-create onramp order when Stripe Web2 is supported and all data is ready
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
if (
|
|
134
|
+
!isLoadingGeo &&
|
|
135
|
+
(!isStablecoin ? !isLoadingAnyspendQuote : true) &&
|
|
136
|
+
usdAmount &&
|
|
137
|
+
parseFloat(usdAmount) > 0 &&
|
|
138
|
+
stripeWeb2Support?.isSupport &&
|
|
139
|
+
!orderCreatedRef.current &&
|
|
140
|
+
!orderId &&
|
|
141
|
+
!isCreatingOrder &&
|
|
142
|
+
!orderError &&
|
|
143
|
+
tokenData &&
|
|
144
|
+
recipientAddress
|
|
145
|
+
) {
|
|
146
|
+
orderCreatedRef.current = true;
|
|
147
|
+
|
|
148
|
+
const dstToken = {
|
|
149
|
+
address: destinationTokenAddress,
|
|
150
|
+
chainId: destinationTokenChainId,
|
|
151
|
+
decimals: tokenData.decimals || 18,
|
|
152
|
+
symbol: tokenData.symbol || "",
|
|
153
|
+
name: tokenData.name || "",
|
|
154
|
+
metadata: {
|
|
155
|
+
logoURI: tokenData.logoURI || "",
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
createOrder({
|
|
160
|
+
recipientAddress,
|
|
161
|
+
orderType: "swap",
|
|
162
|
+
dstChain: destinationTokenChainId,
|
|
163
|
+
dstToken,
|
|
164
|
+
srcFiatAmount: usdAmount,
|
|
165
|
+
onramp: {
|
|
166
|
+
vendor: "stripe-web2",
|
|
167
|
+
paymentMethod: "",
|
|
168
|
+
country: geoData?.country || "US",
|
|
169
|
+
redirectUrl: window.location.origin,
|
|
170
|
+
},
|
|
171
|
+
expectedDstAmount: totalAmount,
|
|
172
|
+
callbackMetadata,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}, [
|
|
176
|
+
isLoadingGeo,
|
|
177
|
+
isStablecoin,
|
|
178
|
+
isLoadingAnyspendQuote,
|
|
179
|
+
usdAmount,
|
|
180
|
+
stripeWeb2Support,
|
|
181
|
+
orderId,
|
|
182
|
+
isCreatingOrder,
|
|
183
|
+
orderError,
|
|
184
|
+
tokenData,
|
|
185
|
+
recipientAddress,
|
|
186
|
+
destinationTokenAddress,
|
|
187
|
+
destinationTokenChainId,
|
|
188
|
+
totalAmount,
|
|
189
|
+
geoData,
|
|
190
|
+
callbackMetadata,
|
|
191
|
+
createOrder,
|
|
192
|
+
]);
|
|
193
|
+
|
|
194
|
+
// Loading geo/stripe support check (and quote for non-stablecoins)
|
|
195
|
+
if (isLoadingGeo || (!isStablecoin && isLoadingAnyspendQuote)) {
|
|
196
|
+
return (
|
|
197
|
+
<motion.div
|
|
198
|
+
initial={{ opacity: 0 }}
|
|
199
|
+
animate={{ opacity: 1 }}
|
|
200
|
+
transition={{ duration: 0.2, ease: "easeOut" }}
|
|
201
|
+
className={cn("anyspend-fiat-loading flex flex-col items-center gap-3 py-6", classes?.fiatPanel)}
|
|
202
|
+
>
|
|
203
|
+
<Loader2 className="h-5 w-5 animate-spin text-gray-400" />
|
|
204
|
+
<TextShimmer duration={1.5} className="text-sm">
|
|
205
|
+
Loading payment form...
|
|
206
|
+
</TextShimmer>
|
|
207
|
+
</motion.div>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const hasStripeWeb2 = stripeWeb2Support && stripeWeb2Support.isSupport;
|
|
212
|
+
const hasStripeRedirect = !!stripeOnrampSupport;
|
|
213
|
+
|
|
214
|
+
// Not available in region
|
|
215
|
+
if (!hasStripeWeb2 && !hasStripeRedirect) {
|
|
216
|
+
return (
|
|
217
|
+
<motion.div
|
|
218
|
+
initial={{ opacity: 0, y: 8 }}
|
|
219
|
+
animate={{ opacity: 1, y: 0 }}
|
|
220
|
+
transition={{ duration: 0.25, ease: "easeOut" }}
|
|
221
|
+
className={cn("anyspend-fiat-unavailable py-4 text-center", classes?.fiatPanel)}
|
|
222
|
+
>
|
|
223
|
+
<p className="text-sm text-gray-500 dark:text-gray-400">
|
|
224
|
+
Card payments are not available in your region for this amount.
|
|
225
|
+
</p>
|
|
226
|
+
</motion.div>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Order creation error - show with retry
|
|
231
|
+
if (orderError) {
|
|
232
|
+
return (
|
|
233
|
+
<motion.div
|
|
234
|
+
initial={{ opacity: 0, y: 8 }}
|
|
235
|
+
animate={{ opacity: 1, y: 0 }}
|
|
236
|
+
transition={{ duration: 0.25, ease: "easeOut" }}
|
|
237
|
+
className={cn("anyspend-fiat-error flex flex-col items-center gap-3 py-4", classes?.fiatPanel)}
|
|
238
|
+
>
|
|
239
|
+
<p className="text-sm text-red-500">{orderError}</p>
|
|
240
|
+
<button
|
|
241
|
+
onClick={() => {
|
|
242
|
+
setOrderError(null);
|
|
243
|
+
orderCreatedRef.current = false;
|
|
244
|
+
}}
|
|
245
|
+
className="anyspend-fiat-retry text-sm font-medium text-blue-600 hover:text-blue-700 dark:text-blue-400"
|
|
246
|
+
>
|
|
247
|
+
Try again
|
|
248
|
+
</button>
|
|
249
|
+
</motion.div>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Creating order / waiting for PaymentIntent
|
|
254
|
+
if (hasStripeWeb2 && (isCreatingOrder || !stripePaymentIntentId)) {
|
|
255
|
+
return (
|
|
256
|
+
<motion.div
|
|
257
|
+
initial={{ opacity: 0 }}
|
|
258
|
+
animate={{ opacity: 1 }}
|
|
259
|
+
transition={{ duration: 0.2, ease: "easeOut" }}
|
|
260
|
+
className={cn("anyspend-fiat-initializing flex flex-col items-center gap-3 py-6", classes?.fiatPanel)}
|
|
261
|
+
>
|
|
262
|
+
<Loader2 className="h-5 w-5 animate-spin text-gray-400" />
|
|
263
|
+
<TextShimmer duration={1.5} className="text-sm">
|
|
264
|
+
Initializing secure payment...
|
|
265
|
+
</TextShimmer>
|
|
266
|
+
</motion.div>
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// Stripe Web2 embedded form
|
|
271
|
+
if (hasStripeWeb2 && stripePaymentIntentId && orderId) {
|
|
272
|
+
return (
|
|
273
|
+
<motion.div
|
|
274
|
+
initial={{ opacity: 0, y: 10 }}
|
|
275
|
+
animate={{ opacity: 1, y: 0 }}
|
|
276
|
+
transition={{ duration: 0.3, ease: "easeOut" }}
|
|
277
|
+
className={cn("anyspend-fiat-stripe flex flex-col gap-3", classes?.fiatPanel)}
|
|
278
|
+
>
|
|
279
|
+
{usdAmount && (
|
|
280
|
+
<div className="anyspend-fiat-summary rounded-lg border border-gray-200 px-4 py-3 dark:border-gray-700">
|
|
281
|
+
<div className="flex items-center justify-between text-sm">
|
|
282
|
+
<span className="text-gray-500 dark:text-gray-400">Total</span>
|
|
283
|
+
<span className="font-medium text-gray-900 dark:text-white">${parseFloat(usdAmount).toFixed(2)}</span>
|
|
284
|
+
</div>
|
|
285
|
+
{!isStablecoin && tokenData && (
|
|
286
|
+
<div className="mt-1 flex items-center justify-between text-xs text-gray-400 dark:text-gray-500">
|
|
287
|
+
<span>
|
|
288
|
+
{formattedAmount} {tokenData.symbol}
|
|
289
|
+
</span>
|
|
290
|
+
<span>incl. fees</span>
|
|
291
|
+
</div>
|
|
292
|
+
)}
|
|
293
|
+
</div>
|
|
294
|
+
)}
|
|
295
|
+
<StripeCheckout
|
|
296
|
+
stripePaymentIntentId={stripePaymentIntentId}
|
|
297
|
+
stripePublishableKey={stripePublishableKey}
|
|
298
|
+
theme={theme}
|
|
299
|
+
themeColor={themeColor}
|
|
300
|
+
orderId={orderId}
|
|
301
|
+
onSuccess={onSuccess}
|
|
302
|
+
onOrderCreated={onOrderCreated}
|
|
303
|
+
onError={onError}
|
|
304
|
+
classes={classes}
|
|
305
|
+
/>
|
|
306
|
+
</motion.div>
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// TODO: Dead code — Stripe onramp is disabled at backend (isStripeOnrampSupported hardcoded false).
|
|
311
|
+
// Remove this block or implement onClick if Stripe onramp is re-enabled.
|
|
312
|
+
return (
|
|
313
|
+
<div className={cn("anyspend-fiat-redirect flex flex-col gap-3 py-2", classes?.fiatPanel)}>
|
|
314
|
+
<p className="text-sm text-gray-600 dark:text-gray-400">
|
|
315
|
+
You'll be redirected to Stripe to complete your payment securely.
|
|
316
|
+
</p>
|
|
317
|
+
<ShinyButton
|
|
318
|
+
accentColor={themeColor || "hsl(var(--as-brand))"}
|
|
319
|
+
className="anyspend-fiat-redirect-btn w-full"
|
|
320
|
+
textClassName="text-white"
|
|
321
|
+
>
|
|
322
|
+
<span className="flex items-center justify-center gap-2">
|
|
323
|
+
<Lock className="h-3.5 w-3.5" />
|
|
324
|
+
Pay with Card
|
|
325
|
+
</span>
|
|
326
|
+
</ShinyButton>
|
|
327
|
+
<p className="anyspend-fiat-secured flex items-center justify-center gap-1 text-xs text-gray-400">
|
|
328
|
+
<Lock className="h-3 w-3" />
|
|
329
|
+
Secured by Stripe
|
|
330
|
+
</p>
|
|
331
|
+
</div>
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// -------------------------------------------------------------------
|
|
336
|
+
// Stripe Elements wrapper - fetches client secret, renders Elements
|
|
337
|
+
// -------------------------------------------------------------------
|
|
338
|
+
|
|
339
|
+
interface StripeCheckoutProps {
|
|
340
|
+
stripePaymentIntentId: string;
|
|
341
|
+
stripePublishableKey?: string | null;
|
|
342
|
+
theme?: string;
|
|
343
|
+
themeColor?: string;
|
|
344
|
+
orderId: string;
|
|
345
|
+
onSuccess?: (result: { txHash?: string; orderId?: string }) => void;
|
|
346
|
+
onOrderCreated?: (orderId: string) => void;
|
|
347
|
+
onError?: (error: Error) => void;
|
|
348
|
+
classes?: AnySpendCheckoutClasses;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function StripeCheckout({
|
|
352
|
+
stripePaymentIntentId,
|
|
353
|
+
stripePublishableKey,
|
|
354
|
+
theme,
|
|
355
|
+
themeColor,
|
|
356
|
+
orderId,
|
|
357
|
+
onSuccess,
|
|
358
|
+
onOrderCreated,
|
|
359
|
+
onError,
|
|
360
|
+
classes,
|
|
361
|
+
}: StripeCheckoutProps) {
|
|
362
|
+
const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } =
|
|
363
|
+
useStripeClientSecret(stripePaymentIntentId);
|
|
364
|
+
|
|
365
|
+
if (isLoadingStripeClientSecret) {
|
|
366
|
+
return (
|
|
367
|
+
<motion.div
|
|
368
|
+
initial={{ opacity: 0 }}
|
|
369
|
+
animate={{ opacity: 1 }}
|
|
370
|
+
transition={{ duration: 0.2, ease: "easeOut" }}
|
|
371
|
+
className="anyspend-stripe-loading flex flex-col items-center gap-3 py-6"
|
|
372
|
+
>
|
|
373
|
+
<Loader2 className="h-5 w-5 animate-spin text-gray-400" />
|
|
374
|
+
<TextShimmer duration={1.5} className="text-sm">
|
|
375
|
+
Loading payment form...
|
|
376
|
+
</TextShimmer>
|
|
377
|
+
</motion.div>
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (stripeClientSecretError || !clientSecret) {
|
|
382
|
+
return (
|
|
383
|
+
<motion.div
|
|
384
|
+
initial={{ opacity: 0, y: 8 }}
|
|
385
|
+
animate={{ opacity: 1, y: 0 }}
|
|
386
|
+
transition={{ duration: 0.25, ease: "easeOut" }}
|
|
387
|
+
className="anyspend-stripe-error py-4 text-center"
|
|
388
|
+
>
|
|
389
|
+
<p className="text-sm text-red-500">
|
|
390
|
+
{stripeClientSecretError?.message || "Failed to load payment form. Please try again."}
|
|
391
|
+
</p>
|
|
392
|
+
</motion.div>
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
return (
|
|
397
|
+
<Elements
|
|
398
|
+
stripe={getStripePromise(stripePublishableKey)}
|
|
399
|
+
options={{
|
|
400
|
+
clientSecret,
|
|
401
|
+
appearance: {
|
|
402
|
+
theme: theme === "light" ? "stripe" : "night",
|
|
403
|
+
variables: {
|
|
404
|
+
borderRadius: "8px",
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
}}
|
|
408
|
+
>
|
|
409
|
+
<StripeCheckoutForm
|
|
410
|
+
themeColor={themeColor}
|
|
411
|
+
orderId={orderId}
|
|
412
|
+
onSuccess={onSuccess}
|
|
413
|
+
onOrderCreated={onOrderCreated}
|
|
414
|
+
onError={onError}
|
|
415
|
+
classes={classes}
|
|
416
|
+
/>
|
|
417
|
+
</Elements>
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// -------------------------------------------------------------------
|
|
422
|
+
// Inner form component (inside Elements context)
|
|
423
|
+
// -------------------------------------------------------------------
|
|
424
|
+
|
|
425
|
+
interface StripeCheckoutFormProps {
|
|
426
|
+
themeColor?: string;
|
|
427
|
+
orderId: string;
|
|
428
|
+
onSuccess?: (result: { txHash?: string; orderId?: string }) => void;
|
|
429
|
+
onOrderCreated?: (orderId: string) => void;
|
|
430
|
+
onError?: (error: Error) => void;
|
|
431
|
+
classes?: AnySpendCheckoutClasses;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
function StripeCheckoutForm({
|
|
435
|
+
themeColor,
|
|
436
|
+
orderId,
|
|
437
|
+
onSuccess,
|
|
438
|
+
onOrderCreated,
|
|
439
|
+
onError,
|
|
440
|
+
classes,
|
|
441
|
+
}: StripeCheckoutFormProps) {
|
|
442
|
+
const stripe = useStripe();
|
|
443
|
+
const elements = useElements();
|
|
444
|
+
|
|
445
|
+
const [loading, setLoading] = useState(false);
|
|
446
|
+
const [message, setMessage] = useState<string | null>(null);
|
|
447
|
+
const [stripeReady, setStripeReady] = useState(false);
|
|
448
|
+
const [showAddressElement, setShowAddressElement] = useState(false);
|
|
449
|
+
|
|
450
|
+
useEffect(() => {
|
|
451
|
+
if (stripe && elements) {
|
|
452
|
+
setStripeReady(true);
|
|
453
|
+
}
|
|
454
|
+
}, [stripe, elements]);
|
|
455
|
+
|
|
456
|
+
const handlePaymentElementChange = useCallback((event: any) => {
|
|
457
|
+
setShowAddressElement(event.value?.type === "card");
|
|
458
|
+
}, []);
|
|
459
|
+
|
|
460
|
+
const handleSubmit = async (e: React.FormEvent) => {
|
|
461
|
+
e.preventDefault();
|
|
462
|
+
|
|
463
|
+
if (!stripe || !elements) {
|
|
464
|
+
setMessage("Payment system is not ready. Please wait.");
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
setLoading(true);
|
|
469
|
+
setMessage(null);
|
|
470
|
+
|
|
471
|
+
try {
|
|
472
|
+
const result = (await stripe.confirmPayment({
|
|
473
|
+
elements,
|
|
474
|
+
redirect: "if_required",
|
|
475
|
+
})) as PaymentIntentResult;
|
|
476
|
+
|
|
477
|
+
if (result.error) {
|
|
478
|
+
console.error("@@checkout-stripe:error:", JSON.stringify(result.error, null, 2));
|
|
479
|
+
setMessage(result.error.message || "Payment failed. Please try again.");
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
console.log("@@checkout-stripe:success:", JSON.stringify({ orderId }, null, 2));
|
|
484
|
+
// Payment succeeded — notify parent to show order lifecycle tracking
|
|
485
|
+
onOrderCreated?.(orderId);
|
|
486
|
+
// Also fire legacy callback for backward compatibility
|
|
487
|
+
onSuccess?.({ orderId, txHash: undefined });
|
|
488
|
+
} catch (error: any) {
|
|
489
|
+
const errorMessage = error?.message || "Payment failed. Please try again.";
|
|
490
|
+
setMessage(errorMessage);
|
|
491
|
+
const errorObj = error instanceof Error ? error : new Error(errorMessage);
|
|
492
|
+
onError?.(errorObj);
|
|
493
|
+
} finally {
|
|
494
|
+
setLoading(false);
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
const stripeElementOptions: StripePaymentElementOptions = {
|
|
499
|
+
layout: "tabs" as const,
|
|
500
|
+
fields: {
|
|
501
|
+
billingDetails: "auto" as const,
|
|
502
|
+
},
|
|
503
|
+
wallets: {
|
|
504
|
+
applePay: "auto" as const,
|
|
505
|
+
googlePay: "auto" as const,
|
|
506
|
+
},
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
if (!stripeReady) {
|
|
510
|
+
return (
|
|
511
|
+
<motion.div
|
|
512
|
+
initial={{ opacity: 0 }}
|
|
513
|
+
animate={{ opacity: 1 }}
|
|
514
|
+
transition={{ duration: 0.2, ease: "easeOut" }}
|
|
515
|
+
className="anyspend-stripe-loading flex flex-col items-center gap-3 py-6"
|
|
516
|
+
>
|
|
517
|
+
<Loader2 className="h-5 w-5 animate-spin text-gray-400" />
|
|
518
|
+
<TextShimmer duration={1.5} className="text-sm">
|
|
519
|
+
Loading payment form...
|
|
520
|
+
</TextShimmer>
|
|
521
|
+
</motion.div>
|
|
522
|
+
);
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
return (
|
|
526
|
+
<motion.form
|
|
527
|
+
initial={{ opacity: 0, y: 10 }}
|
|
528
|
+
animate={{ opacity: 1, y: 0 }}
|
|
529
|
+
transition={{ duration: 0.3, ease: "easeOut" }}
|
|
530
|
+
onSubmit={handleSubmit}
|
|
531
|
+
className="anyspend-stripe-form flex flex-col gap-4"
|
|
532
|
+
>
|
|
533
|
+
<div className="anyspend-stripe-payment-element">
|
|
534
|
+
<PaymentElement onChange={handlePaymentElementChange} options={stripeElementOptions} />
|
|
535
|
+
</div>
|
|
536
|
+
|
|
537
|
+
<AnimatePresence initial={false}>
|
|
538
|
+
{showAddressElement && (
|
|
539
|
+
<motion.div
|
|
540
|
+
key="address-element"
|
|
541
|
+
initial={{ height: 0, opacity: 0 }}
|
|
542
|
+
animate={{ height: "auto", opacity: 1 }}
|
|
543
|
+
exit={{ height: 0, opacity: 0 }}
|
|
544
|
+
transition={{ duration: 0.25, ease: "easeOut" }}
|
|
545
|
+
style={{ overflow: "hidden" }}
|
|
546
|
+
className="anyspend-stripe-address-element"
|
|
547
|
+
>
|
|
548
|
+
<AddressElement
|
|
549
|
+
options={{
|
|
550
|
+
mode: "billing",
|
|
551
|
+
fields: {
|
|
552
|
+
phone: "always",
|
|
553
|
+
},
|
|
554
|
+
display: {
|
|
555
|
+
name: "split",
|
|
556
|
+
},
|
|
557
|
+
validation: {
|
|
558
|
+
phone: {
|
|
559
|
+
required: "always",
|
|
560
|
+
},
|
|
561
|
+
},
|
|
562
|
+
}}
|
|
563
|
+
/>
|
|
564
|
+
</motion.div>
|
|
565
|
+
)}
|
|
566
|
+
</AnimatePresence>
|
|
567
|
+
|
|
568
|
+
{/* Error message */}
|
|
569
|
+
<AnimatePresence initial={false}>
|
|
570
|
+
{message && (
|
|
571
|
+
<motion.div
|
|
572
|
+
key="stripe-error"
|
|
573
|
+
initial={{ opacity: 0, height: 0 }}
|
|
574
|
+
animate={{ opacity: 1, height: "auto" }}
|
|
575
|
+
exit={{ opacity: 0, height: 0 }}
|
|
576
|
+
transition={{ duration: 0.2, ease: "easeOut" }}
|
|
577
|
+
style={{ overflow: "hidden" }}
|
|
578
|
+
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"
|
|
579
|
+
>
|
|
580
|
+
<p className="text-sm text-red-600 dark:text-red-400">{message}</p>
|
|
581
|
+
</motion.div>
|
|
582
|
+
)}
|
|
583
|
+
</AnimatePresence>
|
|
584
|
+
|
|
585
|
+
{/* Submit button */}
|
|
586
|
+
<ShinyButton
|
|
587
|
+
type="submit"
|
|
588
|
+
accentColor={themeColor || "hsl(var(--as-brand))"}
|
|
589
|
+
disabled={!stripe || !elements || loading}
|
|
590
|
+
className={cn("anyspend-stripe-submit w-full", classes?.payButton)}
|
|
591
|
+
textClassName="text-white"
|
|
592
|
+
>
|
|
593
|
+
{loading ? (
|
|
594
|
+
<span className="flex items-center justify-center gap-2">
|
|
595
|
+
<Loader2 className="h-4 w-4 animate-spin" />
|
|
596
|
+
Processing...
|
|
597
|
+
</span>
|
|
598
|
+
) : (
|
|
599
|
+
<span className="flex items-center justify-center gap-2">
|
|
600
|
+
<Lock className="h-3.5 w-3.5" />
|
|
601
|
+
Complete Payment
|
|
602
|
+
</span>
|
|
603
|
+
)}
|
|
604
|
+
</ShinyButton>
|
|
605
|
+
|
|
606
|
+
<p className="anyspend-fiat-secured flex items-center justify-center gap-1 text-xs text-gray-400">
|
|
607
|
+
<Lock className="h-3 w-3" />
|
|
608
|
+
Secured by Stripe
|
|
609
|
+
</p>
|
|
610
|
+
</motion.form>
|
|
611
|
+
);
|
|
612
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
|
+
import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
|
|
5
|
+
|
|
6
|
+
interface PoweredByBrandingProps {
|
|
7
|
+
organizationName?: string;
|
|
8
|
+
organizationLogo?: string;
|
|
9
|
+
classes?: AnySpendCheckoutClasses;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function PoweredByBranding({ organizationName, organizationLogo, classes }: PoweredByBrandingProps) {
|
|
13
|
+
return (
|
|
14
|
+
<div className={cn("flex items-center justify-between pt-4", classes?.poweredBy)}>
|
|
15
|
+
{organizationLogo || organizationName ? (
|
|
16
|
+
<div className="flex items-center gap-2">
|
|
17
|
+
{organizationLogo && (
|
|
18
|
+
<img src={organizationLogo} alt={organizationName || "Organization"} className="h-5 w-5 rounded-full" />
|
|
19
|
+
)}
|
|
20
|
+
{organizationName && (
|
|
21
|
+
<span className="text-xs font-medium text-gray-600 dark:text-gray-400">{organizationName}</span>
|
|
22
|
+
)}
|
|
23
|
+
</div>
|
|
24
|
+
) : (
|
|
25
|
+
<div />
|
|
26
|
+
)}
|
|
27
|
+
<span className="flex items-center gap-1.5 text-xs text-gray-400 opacity-40 dark:text-gray-500">
|
|
28
|
+
powered by{" "}
|
|
29
|
+
<img
|
|
30
|
+
src="https://cdn.b3.fun/anyspend-logo-brand.svg"
|
|
31
|
+
alt="AnySpend"
|
|
32
|
+
className="inline-block h-3.5 dark:hidden"
|
|
33
|
+
/>
|
|
34
|
+
<img
|
|
35
|
+
src="https://cdn.b3.fun/anyspend-logo-brand-dark.svg"
|
|
36
|
+
alt="AnySpend"
|
|
37
|
+
className="hidden h-3.5 dark:inline-block"
|
|
38
|
+
/>
|
|
39
|
+
</span>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|