@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
|
@@ -2,6 +2,7 @@ import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
|
2
2
|
import { normalizeAddress } from "@b3dotfun/sdk/anyspend/utils";
|
|
3
3
|
import { base } from "viem/chains";
|
|
4
4
|
import { AnySpendCustomExactIn } from "./AnySpendCustomExactIn";
|
|
5
|
+
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
|
|
5
6
|
|
|
6
7
|
const STAKE_FOR_FUNCTION_ABI = JSON.stringify([
|
|
7
8
|
{
|
|
@@ -26,6 +27,10 @@ export function AnySpendStakeUpsideExactIn({
|
|
|
26
27
|
stakingContractAddress,
|
|
27
28
|
token,
|
|
28
29
|
onSuccess,
|
|
30
|
+
senderAddress,
|
|
31
|
+
slots,
|
|
32
|
+
content,
|
|
33
|
+
theme,
|
|
29
34
|
}: {
|
|
30
35
|
loadOrder?: string;
|
|
31
36
|
mode?: "modal" | "page";
|
|
@@ -36,6 +41,11 @@ export function AnySpendStakeUpsideExactIn({
|
|
|
36
41
|
token: components["schemas"]["Token"];
|
|
37
42
|
destinationTokenAmount?: string;
|
|
38
43
|
onSuccess?: (amount: string) => void;
|
|
44
|
+
/** Optional sender (payer) address — pre-fills token balances when the user address is known ahead of time */
|
|
45
|
+
senderAddress?: string;
|
|
46
|
+
slots?: AnySpendSlots;
|
|
47
|
+
content?: AnySpendContent;
|
|
48
|
+
theme?: AnySpendTheme;
|
|
39
49
|
}) {
|
|
40
50
|
if (!recipientAddress) return null;
|
|
41
51
|
|
|
@@ -71,6 +81,10 @@ export function AnySpendStakeUpsideExactIn({
|
|
|
71
81
|
customExactInConfig={customExactInConfig}
|
|
72
82
|
header={header}
|
|
73
83
|
onSuccess={onSuccess}
|
|
84
|
+
senderAddress={senderAddress}
|
|
85
|
+
slots={slots}
|
|
86
|
+
content={content}
|
|
87
|
+
theme={theme}
|
|
74
88
|
/>
|
|
75
89
|
);
|
|
76
90
|
}
|
|
@@ -4,6 +4,7 @@ import { cn } from "@b3dotfun/sdk/shared/utils";
|
|
|
4
4
|
import { formatDisplayNumber, formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
5
5
|
import { AnimatePresence } from "motion/react";
|
|
6
6
|
import { AnySpendCustom } from "./AnySpendCustom";
|
|
7
|
+
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
|
|
7
8
|
|
|
8
9
|
type AnySpendTournamentProps =
|
|
9
10
|
| {
|
|
@@ -17,6 +18,11 @@ type AnySpendTournamentProps =
|
|
|
17
18
|
tournamentEntryToken: components["schemas"]["Token"];
|
|
18
19
|
tournamentEntryFee: string;
|
|
19
20
|
onSuccess?: () => void;
|
|
21
|
+
/** Optional sender (payer) address — pre-fills token balances when the user address is known ahead of time */
|
|
22
|
+
senderAddress?: string;
|
|
23
|
+
slots?: AnySpendSlots;
|
|
24
|
+
content?: AnySpendContent;
|
|
25
|
+
theme?: AnySpendTheme;
|
|
20
26
|
}
|
|
21
27
|
| {
|
|
22
28
|
mode?: "modal" | "page";
|
|
@@ -28,6 +34,11 @@ type AnySpendTournamentProps =
|
|
|
28
34
|
tournamentFundToken: components["schemas"]["Token"];
|
|
29
35
|
tournamentFundAmount: string;
|
|
30
36
|
onSuccess?: () => void;
|
|
37
|
+
/** Optional sender (payer) address — pre-fills token balances when the user address is known ahead of time */
|
|
38
|
+
senderAddress?: string;
|
|
39
|
+
slots?: AnySpendSlots;
|
|
40
|
+
content?: AnySpendContent;
|
|
41
|
+
theme?: AnySpendTheme;
|
|
31
42
|
};
|
|
32
43
|
|
|
33
44
|
export function AnySpendTournament(props: AnySpendTournamentProps) {
|
|
@@ -39,6 +50,10 @@ export function AnySpendTournament(props: AnySpendTournamentProps) {
|
|
|
39
50
|
tournamentContractAddress,
|
|
40
51
|
tournamentMetadata,
|
|
41
52
|
onSuccess,
|
|
53
|
+
senderAddress,
|
|
54
|
+
slots,
|
|
55
|
+
content,
|
|
56
|
+
theme,
|
|
42
57
|
} = props;
|
|
43
58
|
|
|
44
59
|
const dstToken = action === "join" ? props.tournamentEntryToken : props.tournamentFundToken;
|
|
@@ -104,6 +119,10 @@ export function AnySpendTournament(props: AnySpendTournamentProps) {
|
|
|
104
119
|
header={header}
|
|
105
120
|
onSuccess={onSuccess}
|
|
106
121
|
showRecipient={action === "join"}
|
|
122
|
+
senderAddress={senderAddress}
|
|
123
|
+
slots={slots}
|
|
124
|
+
content={content}
|
|
125
|
+
theme={theme}
|
|
107
126
|
/>
|
|
108
127
|
);
|
|
109
128
|
}
|
|
@@ -2,6 +2,7 @@ import { B3_TOKEN } from "@b3dotfun/sdk/anyspend";
|
|
|
2
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
3
|
import { base } from "viem/chains";
|
|
4
4
|
import { AnySpendCustomExactIn } from "./AnySpendCustomExactIn";
|
|
5
|
+
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
|
|
5
6
|
|
|
6
7
|
export const HYPE_TOKEN_DETAILS = {
|
|
7
8
|
SYMBOL: "HYPE",
|
|
@@ -29,6 +30,11 @@ export interface AnySpendDepositHypeProps {
|
|
|
29
30
|
returnToHomeUrl?: string;
|
|
30
31
|
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
31
32
|
customRecipientLabel?: string;
|
|
33
|
+
/** Optional sender (payer) address — pre-fills token balances when the user address is known ahead of time */
|
|
34
|
+
senderAddress?: string;
|
|
35
|
+
slots?: AnySpendSlots;
|
|
36
|
+
content?: AnySpendContent;
|
|
37
|
+
theme?: AnySpendTheme;
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
export function AnySpendDepositHype({
|
|
@@ -44,6 +50,10 @@ export function AnySpendDepositHype({
|
|
|
44
50
|
onTokenSelect,
|
|
45
51
|
customUsdInputValues,
|
|
46
52
|
preferEoa,
|
|
53
|
+
senderAddress,
|
|
54
|
+
slots,
|
|
55
|
+
content,
|
|
56
|
+
theme,
|
|
47
57
|
}: AnySpendDepositHypeProps) {
|
|
48
58
|
if (!recipientAddress) return null;
|
|
49
59
|
|
|
@@ -86,6 +96,10 @@ export function AnySpendDepositHype({
|
|
|
86
96
|
onTokenSelect={onTokenSelect}
|
|
87
97
|
customUsdInputValues={customUsdInputValues}
|
|
88
98
|
preferEoa={preferEoa}
|
|
99
|
+
senderAddress={senderAddress}
|
|
100
|
+
slots={slots}
|
|
101
|
+
content={content}
|
|
102
|
+
theme={theme}
|
|
89
103
|
/>
|
|
90
104
|
);
|
|
91
105
|
}
|
|
@@ -5,6 +5,7 @@ import { encodeFunctionData, parseEther } from "viem";
|
|
|
5
5
|
import { ABI_SIGNATURE_MINTING } from "../../abis/signatureMinting";
|
|
6
6
|
import { GenerateSigMintResponse } from "../../types/signatureMint";
|
|
7
7
|
import { AnySpendCustom } from "./AnySpendCustom";
|
|
8
|
+
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
|
|
8
9
|
|
|
9
10
|
// Helper function to determine if URL is a video
|
|
10
11
|
function isVideoURL(url: string): boolean {
|
|
@@ -47,12 +48,18 @@ export function AnyspendSignatureMint({
|
|
|
47
48
|
signatureData,
|
|
48
49
|
imageUrl,
|
|
49
50
|
onSuccess,
|
|
51
|
+
slots,
|
|
52
|
+
content,
|
|
53
|
+
theme,
|
|
50
54
|
}: {
|
|
51
55
|
loadOrder?: string;
|
|
52
56
|
mode?: "modal" | "page";
|
|
53
57
|
signatureData: GenerateSigMintResponse;
|
|
54
58
|
imageUrl?: string;
|
|
55
59
|
onSuccess?: (txHash?: string) => void;
|
|
60
|
+
slots?: AnySpendSlots;
|
|
61
|
+
content?: AnySpendContent;
|
|
62
|
+
theme?: AnySpendTheme;
|
|
56
63
|
}) {
|
|
57
64
|
// Get token data
|
|
58
65
|
const {
|
|
@@ -149,6 +156,9 @@ export function AnyspendSignatureMint({
|
|
|
149
156
|
header={header}
|
|
150
157
|
onSuccess={onSuccess}
|
|
151
158
|
showRecipient={true}
|
|
159
|
+
slots={slots}
|
|
160
|
+
content={content}
|
|
161
|
+
theme={theme}
|
|
152
162
|
/>
|
|
153
163
|
);
|
|
154
164
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
|
+
import type { AddressData } from "../../../types/forms";
|
|
5
|
+
|
|
6
|
+
interface AddressFormProps {
|
|
7
|
+
value: AddressData;
|
|
8
|
+
onChange: (address: AddressData) => void;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const inputBaseClass =
|
|
14
|
+
"w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 dark:border-neutral-600 dark:bg-neutral-800 dark:text-gray-100 dark:placeholder:text-gray-500 dark:focus:border-blue-400";
|
|
15
|
+
|
|
16
|
+
const labelClass = "mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300";
|
|
17
|
+
|
|
18
|
+
export function AddressForm({ value, onChange, required, className }: AddressFormProps) {
|
|
19
|
+
const update = (field: keyof AddressData, val: string) => {
|
|
20
|
+
onChange({ ...value, [field]: val });
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className={cn("anyspend-address-form space-y-3", className)}>
|
|
25
|
+
<div className="anyspend-address-street">
|
|
26
|
+
<label className={cn("anyspend-form-label", labelClass)}>
|
|
27
|
+
Street Address{required && <span className="ml-0.5 text-red-500">*</span>}
|
|
28
|
+
</label>
|
|
29
|
+
<input
|
|
30
|
+
type="text"
|
|
31
|
+
value={value.street || ""}
|
|
32
|
+
onChange={e => update("street", e.target.value)}
|
|
33
|
+
placeholder="123 Main Street"
|
|
34
|
+
required={required}
|
|
35
|
+
className={cn("anyspend-form-input", inputBaseClass)}
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div className="grid grid-cols-2 gap-3">
|
|
40
|
+
<div className="anyspend-address-city">
|
|
41
|
+
<label className={cn("anyspend-form-label", labelClass)}>
|
|
42
|
+
City{required && <span className="ml-0.5 text-red-500">*</span>}
|
|
43
|
+
</label>
|
|
44
|
+
<input
|
|
45
|
+
type="text"
|
|
46
|
+
value={value.city || ""}
|
|
47
|
+
onChange={e => update("city", e.target.value)}
|
|
48
|
+
placeholder="City"
|
|
49
|
+
required={required}
|
|
50
|
+
className={cn("anyspend-form-input", inputBaseClass)}
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
<div className="anyspend-address-state">
|
|
54
|
+
<label className={cn("anyspend-form-label", labelClass)}>
|
|
55
|
+
State / Province{required && <span className="ml-0.5 text-red-500">*</span>}
|
|
56
|
+
</label>
|
|
57
|
+
<input
|
|
58
|
+
type="text"
|
|
59
|
+
value={value.state || ""}
|
|
60
|
+
onChange={e => update("state", e.target.value)}
|
|
61
|
+
placeholder="State"
|
|
62
|
+
required={required}
|
|
63
|
+
className={cn("anyspend-form-input", inputBaseClass)}
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div className="grid grid-cols-2 gap-3">
|
|
69
|
+
<div className="anyspend-address-zip">
|
|
70
|
+
<label className={cn("anyspend-form-label", labelClass)}>
|
|
71
|
+
Zip / Postal Code{required && <span className="ml-0.5 text-red-500">*</span>}
|
|
72
|
+
</label>
|
|
73
|
+
<input
|
|
74
|
+
type="text"
|
|
75
|
+
value={value.zip || ""}
|
|
76
|
+
onChange={e => update("zip", e.target.value)}
|
|
77
|
+
placeholder="12345"
|
|
78
|
+
required={required}
|
|
79
|
+
className={cn("anyspend-form-input", inputBaseClass)}
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
<div className="anyspend-address-country">
|
|
83
|
+
<label className={cn("anyspend-form-label", labelClass)}>
|
|
84
|
+
Country{required && <span className="ml-0.5 text-red-500">*</span>}
|
|
85
|
+
</label>
|
|
86
|
+
<input
|
|
87
|
+
type="text"
|
|
88
|
+
value={value.country || ""}
|
|
89
|
+
onChange={e => update("country", e.target.value)}
|
|
90
|
+
placeholder="Country"
|
|
91
|
+
required={required}
|
|
92
|
+
className={cn("anyspend-form-input", inputBaseClass)}
|
|
93
|
+
/>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useTokenData } from "@b3dotfun/sdk/global-account/react";
|
|
4
|
+
import { USDC_BASE } from "@b3dotfun/sdk/anyspend/constants";
|
|
5
|
+
import { formatUnits, safeBigInt } from "@b3dotfun/sdk/shared/utils/number";
|
|
6
|
+
import { type ReactNode, useCallback, useMemo, useState } from "react";
|
|
7
|
+
import { useAnyspendQuote } from "../../hooks/useAnyspendQuote";
|
|
8
|
+
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "../AnySpendFingerprintWrapper";
|
|
9
|
+
import { CheckoutCartPanel } from "./CheckoutCartPanel";
|
|
10
|
+
import { CheckoutFormPanel } from "./CheckoutFormPanel";
|
|
11
|
+
import { CheckoutLayout } from "./CheckoutLayout";
|
|
12
|
+
import { CheckoutPaymentPanel, type PaymentMethod } from "./CheckoutPaymentPanel";
|
|
13
|
+
|
|
14
|
+
export type { AnySpendCheckoutClasses } from "../types/classes";
|
|
15
|
+
import type { AnySpendCheckoutClasses } from "../types/classes";
|
|
16
|
+
import { AnySpendCustomizationProvider } from "../context/AnySpendCustomizationContext";
|
|
17
|
+
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "../types/customization";
|
|
18
|
+
import type {
|
|
19
|
+
CheckoutFormSchema,
|
|
20
|
+
CheckoutFormComponentProps,
|
|
21
|
+
ShippingOption,
|
|
22
|
+
DiscountResult,
|
|
23
|
+
AddressData,
|
|
24
|
+
} from "../../../types/forms";
|
|
25
|
+
|
|
26
|
+
export type { CheckoutFormSchema, CheckoutFormComponentProps, ShippingOption, DiscountResult, AddressData };
|
|
27
|
+
|
|
28
|
+
export interface CheckoutItem {
|
|
29
|
+
id?: string;
|
|
30
|
+
name: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
imageUrl?: string;
|
|
33
|
+
/** Amount in wei (smallest unit of destination token) */
|
|
34
|
+
amount: string;
|
|
35
|
+
quantity: number;
|
|
36
|
+
/** Custom metadata displayed as label: value pairs (e.g., { "Size": "Large", "Color": "Blue" }) */
|
|
37
|
+
metadata?: Record<string, string>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface CheckoutSummaryLine {
|
|
41
|
+
/** Display label (e.g., "Platform Fee", "Service Charge") */
|
|
42
|
+
label: string;
|
|
43
|
+
/** Amount in token's smallest unit (wei). Negative values shown as deductions. */
|
|
44
|
+
amount: string;
|
|
45
|
+
/** Optional description or note */
|
|
46
|
+
description?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface AnySpendCheckoutProps {
|
|
50
|
+
/** Display mode */
|
|
51
|
+
mode?: "page" | "embedded";
|
|
52
|
+
/** The recipient address */
|
|
53
|
+
recipientAddress: string;
|
|
54
|
+
/** The destination token address */
|
|
55
|
+
destinationTokenAddress: string;
|
|
56
|
+
/** The destination chain ID */
|
|
57
|
+
destinationTokenChainId: number;
|
|
58
|
+
/** Line items */
|
|
59
|
+
items: CheckoutItem[];
|
|
60
|
+
/** Override computed total */
|
|
61
|
+
totalAmount?: string;
|
|
62
|
+
/** Organization name */
|
|
63
|
+
organizationName?: string;
|
|
64
|
+
/** Organization logo URL */
|
|
65
|
+
organizationLogo?: string;
|
|
66
|
+
/** Theme color (hex) */
|
|
67
|
+
themeColor?: string;
|
|
68
|
+
/** Custom button text */
|
|
69
|
+
buttonText?: string;
|
|
70
|
+
/** Checkout session ID (used by pay link backend to track sessions) */
|
|
71
|
+
checkoutSessionId?: string;
|
|
72
|
+
/** Called on successful payment */
|
|
73
|
+
onSuccess?: (result: { txHash?: string; orderId?: string }) => void;
|
|
74
|
+
/** Called on payment error */
|
|
75
|
+
onError?: (error: Error) => void;
|
|
76
|
+
/** URL to redirect to after payment */
|
|
77
|
+
returnUrl?: string;
|
|
78
|
+
/** Label for the return button */
|
|
79
|
+
returnLabel?: string;
|
|
80
|
+
/** Custom class names */
|
|
81
|
+
classes?: AnySpendCheckoutClasses;
|
|
82
|
+
/** Custom footer for the order summary. Pass `null` to hide, or a ReactNode to replace the default. */
|
|
83
|
+
footer?: ReactNode | null;
|
|
84
|
+
/** Which payment method to expand initially. Defaults to none (all collapsed). */
|
|
85
|
+
defaultPaymentMethod?: PaymentMethod;
|
|
86
|
+
/** Optional sender (payer) address — pre-fills token balances in the crypto panel */
|
|
87
|
+
senderAddress?: string;
|
|
88
|
+
/** Render function overrides for replaceable UI elements */
|
|
89
|
+
slots?: AnySpendSlots;
|
|
90
|
+
/** String or ReactNode overrides for text/messages */
|
|
91
|
+
content?: AnySpendContent;
|
|
92
|
+
/** Structured color/theme configuration */
|
|
93
|
+
theme?: AnySpendTheme;
|
|
94
|
+
/** Show the points row in the order status summary. Defaults to false. */
|
|
95
|
+
showPoints?: boolean;
|
|
96
|
+
/** Show the order ID row in the order status summary. Defaults to false. */
|
|
97
|
+
showOrderId?: boolean;
|
|
98
|
+
/** Shipping cost. String = amount in wei. Object = amount + custom label. */
|
|
99
|
+
shipping?: string | { amount: string; label?: string };
|
|
100
|
+
/** Tax amount. String = amount in wei. Object = amount + custom label + optional rate display. */
|
|
101
|
+
tax?: string | { amount: string; label?: string; rate?: string };
|
|
102
|
+
/** Discount amount (displayed as negative). String = amount in wei. Object = amount + label + optional code. */
|
|
103
|
+
discount?: string | { amount: string; label?: string; code?: string };
|
|
104
|
+
/** Additional summary line items (fees, tips, etc.) */
|
|
105
|
+
summaryLines?: CheckoutSummaryLine[];
|
|
106
|
+
|
|
107
|
+
// ===== NEW: Custom Form Props =====
|
|
108
|
+
|
|
109
|
+
/** JSON form schema defining fields to collect from the customer */
|
|
110
|
+
formSchema?: CheckoutFormSchema | null;
|
|
111
|
+
/** Custom React component to render as the checkout form */
|
|
112
|
+
formComponent?: React.ComponentType<CheckoutFormComponentProps>;
|
|
113
|
+
/** Called when form data changes */
|
|
114
|
+
onFormSubmit?: (data: Record<string, unknown>) => void;
|
|
115
|
+
|
|
116
|
+
// ===== NEW: Shipping Props =====
|
|
117
|
+
|
|
118
|
+
/** Shipping options to display */
|
|
119
|
+
shippingOptions?: ShippingOption[] | null;
|
|
120
|
+
/** Whether to collect a shipping address */
|
|
121
|
+
collectShippingAddress?: boolean;
|
|
122
|
+
/** Called when shipping option changes */
|
|
123
|
+
onShippingChange?: (option: ShippingOption) => void;
|
|
124
|
+
|
|
125
|
+
// ===== NEW: Discount Code Props =====
|
|
126
|
+
|
|
127
|
+
/** Enable discount code input */
|
|
128
|
+
enableDiscountCode?: boolean;
|
|
129
|
+
/** Called when discount is applied */
|
|
130
|
+
onDiscountApplied?: (result: DiscountResult) => void;
|
|
131
|
+
/** Async function to validate a discount code. Returns DiscountResult. */
|
|
132
|
+
validateDiscount?: (code: string) => Promise<DiscountResult>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const emptyAddress: AddressData = { street: "", city: "", state: "", zip: "", country: "" };
|
|
136
|
+
|
|
137
|
+
export function AnySpendCheckout({
|
|
138
|
+
mode = "page",
|
|
139
|
+
recipientAddress,
|
|
140
|
+
destinationTokenAddress,
|
|
141
|
+
destinationTokenChainId,
|
|
142
|
+
items,
|
|
143
|
+
totalAmount: totalAmountOverride,
|
|
144
|
+
organizationName,
|
|
145
|
+
organizationLogo,
|
|
146
|
+
themeColor,
|
|
147
|
+
buttonText = "Pay",
|
|
148
|
+
checkoutSessionId,
|
|
149
|
+
onSuccess,
|
|
150
|
+
onError,
|
|
151
|
+
returnUrl,
|
|
152
|
+
returnLabel,
|
|
153
|
+
classes,
|
|
154
|
+
footer,
|
|
155
|
+
defaultPaymentMethod,
|
|
156
|
+
senderAddress,
|
|
157
|
+
slots,
|
|
158
|
+
content,
|
|
159
|
+
theme,
|
|
160
|
+
showPoints,
|
|
161
|
+
showOrderId,
|
|
162
|
+
shipping: shippingProp,
|
|
163
|
+
tax,
|
|
164
|
+
discount: discountProp,
|
|
165
|
+
summaryLines,
|
|
166
|
+
// New form props
|
|
167
|
+
formSchema,
|
|
168
|
+
formComponent,
|
|
169
|
+
onFormSubmit,
|
|
170
|
+
// New shipping props
|
|
171
|
+
shippingOptions,
|
|
172
|
+
collectShippingAddress,
|
|
173
|
+
onShippingChange: onShippingChangeProp,
|
|
174
|
+
// New discount props
|
|
175
|
+
enableDiscountCode,
|
|
176
|
+
onDiscountApplied: onDiscountAppliedProp,
|
|
177
|
+
validateDiscount,
|
|
178
|
+
}: AnySpendCheckoutProps) {
|
|
179
|
+
// ===== Form state =====
|
|
180
|
+
const [formData, setFormData] = useState<Record<string, unknown>>({});
|
|
181
|
+
const [selectedShipping, setSelectedShipping] = useState<ShippingOption | null>(null);
|
|
182
|
+
const [appliedDiscount, setAppliedDiscount] = useState<DiscountResult | null>(null);
|
|
183
|
+
const [shippingAddress, setShippingAddress] = useState<AddressData>(emptyAddress);
|
|
184
|
+
|
|
185
|
+
const handleFormDataChange = useCallback(
|
|
186
|
+
(data: Record<string, unknown>) => {
|
|
187
|
+
setFormData(data);
|
|
188
|
+
onFormSubmit?.(data);
|
|
189
|
+
},
|
|
190
|
+
[onFormSubmit],
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
const handleShippingChange = useCallback(
|
|
194
|
+
(option: ShippingOption) => {
|
|
195
|
+
setSelectedShipping(option);
|
|
196
|
+
onShippingChangeProp?.(option);
|
|
197
|
+
},
|
|
198
|
+
[onShippingChangeProp],
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
const handleDiscountApplied = useCallback(
|
|
202
|
+
(result: DiscountResult) => {
|
|
203
|
+
setAppliedDiscount(result);
|
|
204
|
+
onDiscountAppliedProp?.(result);
|
|
205
|
+
},
|
|
206
|
+
[onDiscountAppliedProp],
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
const handleDiscountRemoved = useCallback(() => {
|
|
210
|
+
setAppliedDiscount(null);
|
|
211
|
+
}, []);
|
|
212
|
+
|
|
213
|
+
// Merge static shipping prop with dynamic shipping selection
|
|
214
|
+
const effectiveShipping = useMemo(() => {
|
|
215
|
+
if (selectedShipping) {
|
|
216
|
+
return { amount: selectedShipping.amount, label: selectedShipping.name };
|
|
217
|
+
}
|
|
218
|
+
if (shippingProp) {
|
|
219
|
+
return typeof shippingProp === "string" ? { amount: shippingProp } : shippingProp;
|
|
220
|
+
}
|
|
221
|
+
return undefined;
|
|
222
|
+
}, [selectedShipping, shippingProp]);
|
|
223
|
+
|
|
224
|
+
// Merge static discount prop with dynamic discount
|
|
225
|
+
const effectiveDiscount = useMemo(() => {
|
|
226
|
+
if (appliedDiscount?.valid && appliedDiscount.discount_amount) {
|
|
227
|
+
return {
|
|
228
|
+
amount: appliedDiscount.discount_amount,
|
|
229
|
+
label: appliedDiscount.discount_type === "percentage" ? `${appliedDiscount.discount_value}% off` : "Discount",
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
if (discountProp) {
|
|
233
|
+
return typeof discountProp === "string" ? { amount: discountProp } : discountProp;
|
|
234
|
+
}
|
|
235
|
+
return undefined;
|
|
236
|
+
}, [appliedDiscount, discountProp]);
|
|
237
|
+
|
|
238
|
+
// Compute total from items + adjustments (including dynamic shipping/discount)
|
|
239
|
+
const computedTotal = useMemo(() => {
|
|
240
|
+
if (totalAmountOverride) return totalAmountOverride;
|
|
241
|
+
let total = BigInt(0);
|
|
242
|
+
for (const item of items) {
|
|
243
|
+
total += safeBigInt(item.amount) * BigInt(item.quantity);
|
|
244
|
+
}
|
|
245
|
+
if (effectiveShipping?.amount) total += safeBigInt(effectiveShipping.amount);
|
|
246
|
+
const taxAmt = typeof tax === "string" ? tax : tax?.amount;
|
|
247
|
+
if (taxAmt) total += safeBigInt(taxAmt);
|
|
248
|
+
if (effectiveDiscount?.amount) total -= safeBigInt(effectiveDiscount.amount);
|
|
249
|
+
if (summaryLines) {
|
|
250
|
+
for (const line of summaryLines) total += safeBigInt(line.amount);
|
|
251
|
+
}
|
|
252
|
+
if (total < BigInt(0)) total = BigInt(0);
|
|
253
|
+
return total.toString();
|
|
254
|
+
}, [items, totalAmountOverride, effectiveShipping, tax, effectiveDiscount, summaryLines]);
|
|
255
|
+
|
|
256
|
+
// Get destination token metadata
|
|
257
|
+
const { data: tokenData } = useTokenData(destinationTokenChainId, destinationTokenAddress);
|
|
258
|
+
const tokenSymbol = tokenData?.symbol || "";
|
|
259
|
+
const tokenDecimals = tokenData?.decimals || 18;
|
|
260
|
+
|
|
261
|
+
// Resolve USD equivalent for non-stablecoin tokens (shown in cart summary)
|
|
262
|
+
const isStablecoin = useMemo(() => {
|
|
263
|
+
return [
|
|
264
|
+
"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC Base
|
|
265
|
+
"0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT Ethereum
|
|
266
|
+
].some(addr => addr.toLowerCase() === destinationTokenAddress.toLowerCase());
|
|
267
|
+
}, [destinationTokenAddress]);
|
|
268
|
+
|
|
269
|
+
const { anyspendQuote } = useAnyspendQuote({
|
|
270
|
+
type: "swap",
|
|
271
|
+
srcChain: 8453,
|
|
272
|
+
dstChain: destinationTokenChainId,
|
|
273
|
+
srcTokenAddress: USDC_BASE.address,
|
|
274
|
+
dstTokenAddress: destinationTokenAddress,
|
|
275
|
+
tradeType: "EXACT_OUTPUT",
|
|
276
|
+
amount: computedTotal,
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
const usdEquivalent = useMemo(() => {
|
|
280
|
+
if (isStablecoin) return null; // stablecoins already show USD-equivalent amounts
|
|
281
|
+
if (!anyspendQuote?.data?.currencyIn?.amount) return null;
|
|
282
|
+
const raw = formatUnits(anyspendQuote.data.currencyIn.amount, USDC_BASE.decimals);
|
|
283
|
+
return `$${parseFloat(raw).toFixed(2)}`;
|
|
284
|
+
}, [isStablecoin, anyspendQuote]);
|
|
285
|
+
|
|
286
|
+
const fingerprint = getFingerprintConfig();
|
|
287
|
+
|
|
288
|
+
// Build callbackMetadata to include form data with the order
|
|
289
|
+
const checkoutFormMetadata = useMemo(() => {
|
|
290
|
+
const meta: Record<string, unknown> = {};
|
|
291
|
+
if (Object.keys(formData).length > 0) meta.formData = formData;
|
|
292
|
+
if (selectedShipping) meta.shippingOptionId = selectedShipping.id;
|
|
293
|
+
if (selectedShipping) meta.shippingAmount = selectedShipping.amount;
|
|
294
|
+
if (shippingAddress.street) meta.shippingAddress = shippingAddress;
|
|
295
|
+
if (appliedDiscount?.valid) {
|
|
296
|
+
meta.discountCode = appliedDiscount.discount_value;
|
|
297
|
+
meta.discountAmount = appliedDiscount.discount_amount;
|
|
298
|
+
}
|
|
299
|
+
// Extract common fields for customer enrichment
|
|
300
|
+
if (formData.email) meta.customerEmail = formData.email;
|
|
301
|
+
if (formData.name) meta.customerName = formData.name;
|
|
302
|
+
if (checkoutSessionId) meta.checkoutSessionId = checkoutSessionId;
|
|
303
|
+
return Object.keys(meta).length > 0 ? meta : undefined;
|
|
304
|
+
}, [formData, selectedShipping, shippingAddress, appliedDiscount, checkoutSessionId]);
|
|
305
|
+
|
|
306
|
+
// Check if required form fields are filled
|
|
307
|
+
const isFormValid = useMemo(() => {
|
|
308
|
+
if (!formSchema) return true;
|
|
309
|
+
return formSchema.fields.filter(f => f.required).every(f => formData[f.id] != null && formData[f.id] !== "");
|
|
310
|
+
}, [formSchema, formData]);
|
|
311
|
+
|
|
312
|
+
// Check if we have a form panel to show
|
|
313
|
+
const hasFormContent =
|
|
314
|
+
(formSchema && formSchema.fields.length > 0) ||
|
|
315
|
+
formComponent ||
|
|
316
|
+
slots?.checkoutForm ||
|
|
317
|
+
(shippingOptions && shippingOptions.length > 0) ||
|
|
318
|
+
collectShippingAddress ||
|
|
319
|
+
enableDiscountCode;
|
|
320
|
+
|
|
321
|
+
return (
|
|
322
|
+
<AnySpendFingerprintWrapper fingerprint={fingerprint}>
|
|
323
|
+
<AnySpendCustomizationProvider slots={slots} content={content} theme={theme}>
|
|
324
|
+
<CheckoutLayout
|
|
325
|
+
mode={mode}
|
|
326
|
+
paymentPanel={
|
|
327
|
+
<>
|
|
328
|
+
{/* Form panel renders above payment panel in the left/payment column */}
|
|
329
|
+
{hasFormContent && (
|
|
330
|
+
<div className="mb-6">
|
|
331
|
+
<CheckoutFormPanel
|
|
332
|
+
formSchema={formSchema}
|
|
333
|
+
formComponent={formComponent}
|
|
334
|
+
shippingOptions={shippingOptions}
|
|
335
|
+
collectShippingAddress={collectShippingAddress}
|
|
336
|
+
enableDiscountCode={enableDiscountCode}
|
|
337
|
+
validateDiscount={validateDiscount}
|
|
338
|
+
tokenSymbol={tokenSymbol}
|
|
339
|
+
tokenDecimals={tokenDecimals}
|
|
340
|
+
classes={classes}
|
|
341
|
+
formData={formData}
|
|
342
|
+
onFormDataChange={handleFormDataChange}
|
|
343
|
+
selectedShipping={selectedShipping}
|
|
344
|
+
onShippingChange={handleShippingChange}
|
|
345
|
+
appliedDiscount={appliedDiscount}
|
|
346
|
+
onDiscountApplied={handleDiscountApplied}
|
|
347
|
+
onDiscountRemoved={handleDiscountRemoved}
|
|
348
|
+
shippingAddress={shippingAddress}
|
|
349
|
+
onShippingAddressChange={setShippingAddress}
|
|
350
|
+
checkoutFormSlot={slots?.checkoutForm}
|
|
351
|
+
/>
|
|
352
|
+
<div className="mt-6 border-t border-gray-200 dark:border-neutral-700" />
|
|
353
|
+
</div>
|
|
354
|
+
)}
|
|
355
|
+
<CheckoutPaymentPanel
|
|
356
|
+
recipientAddress={recipientAddress}
|
|
357
|
+
destinationTokenAddress={destinationTokenAddress}
|
|
358
|
+
destinationTokenChainId={destinationTokenChainId}
|
|
359
|
+
totalAmount={computedTotal}
|
|
360
|
+
buttonText={buttonText}
|
|
361
|
+
themeColor={themeColor}
|
|
362
|
+
returnUrl={returnUrl}
|
|
363
|
+
returnLabel={returnLabel}
|
|
364
|
+
onSuccess={onSuccess}
|
|
365
|
+
onError={onError}
|
|
366
|
+
classes={classes}
|
|
367
|
+
defaultPaymentMethod={defaultPaymentMethod}
|
|
368
|
+
senderAddress={senderAddress}
|
|
369
|
+
showPoints={showPoints}
|
|
370
|
+
showOrderId={showOrderId}
|
|
371
|
+
callbackMetadata={checkoutFormMetadata}
|
|
372
|
+
isFormValid={isFormValid}
|
|
373
|
+
/>
|
|
374
|
+
</>
|
|
375
|
+
}
|
|
376
|
+
cartPanel={
|
|
377
|
+
<CheckoutCartPanel
|
|
378
|
+
items={items}
|
|
379
|
+
totalAmount={computedTotal}
|
|
380
|
+
tokenSymbol={tokenSymbol}
|
|
381
|
+
tokenDecimals={tokenDecimals}
|
|
382
|
+
organizationName={organizationName}
|
|
383
|
+
organizationLogo={organizationLogo}
|
|
384
|
+
classes={classes}
|
|
385
|
+
footer={footer}
|
|
386
|
+
shipping={effectiveShipping}
|
|
387
|
+
tax={typeof tax === "string" ? { amount: tax } : tax}
|
|
388
|
+
discount={effectiveDiscount}
|
|
389
|
+
summaryLines={summaryLines}
|
|
390
|
+
usdEquivalent={usdEquivalent}
|
|
391
|
+
/>
|
|
392
|
+
}
|
|
393
|
+
classes={classes}
|
|
394
|
+
/>
|
|
395
|
+
</AnySpendCustomizationProvider>
|
|
396
|
+
</AnySpendFingerprintWrapper>
|
|
397
|
+
);
|
|
398
|
+
}
|