@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,221 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useTokenData } from "@b3dotfun/sdk/global-account/react";
|
|
4
|
+
import { formatTokenAmount, safeBigInt } from "@b3dotfun/sdk/shared/utils/number";
|
|
5
|
+
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
6
|
+
import { type ReactNode, useMemo } from "react";
|
|
7
|
+
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "../AnySpendFingerprintWrapper";
|
|
8
|
+
import type { AnySpendCheckoutClasses } from "../types/classes";
|
|
9
|
+
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "../types/customization";
|
|
10
|
+
import { AnySpendCustomizationProvider } from "../context/AnySpendCustomizationContext";
|
|
11
|
+
import type { CheckoutItem, CheckoutSummaryLine } from "./AnySpendCheckout";
|
|
12
|
+
import { CheckoutCartPanel } from "./CheckoutCartPanel";
|
|
13
|
+
import { CheckoutPaymentPanel, type PaymentMethod } from "./CheckoutPaymentPanel";
|
|
14
|
+
import { PoweredByBranding } from "./PoweredByBranding";
|
|
15
|
+
|
|
16
|
+
export interface AnySpendCheckoutTriggerProps {
|
|
17
|
+
/** Payment recipient address (hex) */
|
|
18
|
+
recipientAddress: string;
|
|
19
|
+
/** Destination token address */
|
|
20
|
+
destinationTokenAddress: string;
|
|
21
|
+
/** Destination chain ID */
|
|
22
|
+
destinationTokenChainId: number;
|
|
23
|
+
/** Line items to display in the cart (optional — if omitted, only the payment panel is shown) */
|
|
24
|
+
items?: CheckoutItem[];
|
|
25
|
+
/** Total amount in wei — required when items are not provided */
|
|
26
|
+
totalAmount?: string;
|
|
27
|
+
/** Organization name */
|
|
28
|
+
organizationName?: string;
|
|
29
|
+
/** Organization logo URL */
|
|
30
|
+
organizationLogo?: string;
|
|
31
|
+
/** Theme color (hex) */
|
|
32
|
+
themeColor?: string;
|
|
33
|
+
/** Custom button text */
|
|
34
|
+
buttonText?: string;
|
|
35
|
+
/** Workflow ID to trigger on payment */
|
|
36
|
+
workflowId?: string;
|
|
37
|
+
/** Organization ID that owns the workflow */
|
|
38
|
+
orgId?: string;
|
|
39
|
+
/** Optional callback metadata merged into the order */
|
|
40
|
+
callbackMetadata?: {
|
|
41
|
+
/** Passed as trigger result inputs — accessible via {{root.result.inputs.*}} */
|
|
42
|
+
inputs?: Record<string, unknown>;
|
|
43
|
+
} & Record<string, unknown>;
|
|
44
|
+
/** Called on successful payment */
|
|
45
|
+
onSuccess?: (result: { txHash?: string; orderId?: string }) => void;
|
|
46
|
+
/** Called on payment error */
|
|
47
|
+
onError?: (error: Error) => void;
|
|
48
|
+
/** URL to redirect to after payment */
|
|
49
|
+
returnUrl?: string;
|
|
50
|
+
/** Label for the return button */
|
|
51
|
+
returnLabel?: string;
|
|
52
|
+
/** Custom class names */
|
|
53
|
+
classes?: AnySpendCheckoutClasses;
|
|
54
|
+
/** Display mode — set automatically when used inside B3DynamicModal */
|
|
55
|
+
mode?: "modal" | "page";
|
|
56
|
+
/** Custom footer for the order summary. Pass `null` to hide, or a ReactNode to replace the default. */
|
|
57
|
+
footer?: ReactNode | null;
|
|
58
|
+
/** Which payment method to expand initially. Defaults to none (all collapsed). */
|
|
59
|
+
defaultPaymentMethod?: PaymentMethod;
|
|
60
|
+
/** Optional sender (payer) address — pre-fills token balances in the crypto panel */
|
|
61
|
+
senderAddress?: string;
|
|
62
|
+
/** Render function overrides for replaceable UI elements */
|
|
63
|
+
slots?: AnySpendSlots;
|
|
64
|
+
/** String or ReactNode overrides for text/messages */
|
|
65
|
+
content?: AnySpendContent;
|
|
66
|
+
/** Structured color/theme configuration */
|
|
67
|
+
theme?: AnySpendTheme;
|
|
68
|
+
/** Shipping cost. String = amount in wei. Object = amount + custom label. */
|
|
69
|
+
shipping?: string | { amount: string; label?: string };
|
|
70
|
+
/** Tax amount. String = amount in wei. Object = amount + custom label + optional rate display. */
|
|
71
|
+
tax?: string | { amount: string; label?: string; rate?: string };
|
|
72
|
+
/** Discount amount (displayed as negative). String = amount in wei. Object = amount + label + optional code. */
|
|
73
|
+
discount?: string | { amount: string; label?: string; code?: string };
|
|
74
|
+
/** Additional summary line items (fees, tips, etc.) */
|
|
75
|
+
summaryLines?: CheckoutSummaryLine[];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function AnySpendCheckoutTrigger({
|
|
79
|
+
recipientAddress,
|
|
80
|
+
destinationTokenAddress,
|
|
81
|
+
destinationTokenChainId,
|
|
82
|
+
items,
|
|
83
|
+
totalAmount: totalAmountOverride,
|
|
84
|
+
organizationName,
|
|
85
|
+
organizationLogo,
|
|
86
|
+
themeColor,
|
|
87
|
+
buttonText = "Pay",
|
|
88
|
+
workflowId,
|
|
89
|
+
orgId,
|
|
90
|
+
callbackMetadata,
|
|
91
|
+
onSuccess,
|
|
92
|
+
onError,
|
|
93
|
+
returnUrl,
|
|
94
|
+
returnLabel,
|
|
95
|
+
classes,
|
|
96
|
+
footer,
|
|
97
|
+
defaultPaymentMethod,
|
|
98
|
+
senderAddress,
|
|
99
|
+
slots,
|
|
100
|
+
content,
|
|
101
|
+
theme,
|
|
102
|
+
shipping,
|
|
103
|
+
tax,
|
|
104
|
+
discount,
|
|
105
|
+
summaryLines,
|
|
106
|
+
}: AnySpendCheckoutTriggerProps) {
|
|
107
|
+
// Merge workflowId + orgId into callbackMetadata
|
|
108
|
+
const mergedMetadata = useMemo(() => {
|
|
109
|
+
if (!workflowId && !orgId && !callbackMetadata) return undefined;
|
|
110
|
+
return {
|
|
111
|
+
...(workflowId ? { workflowId } : {}),
|
|
112
|
+
...(orgId ? { orgId } : {}),
|
|
113
|
+
...callbackMetadata,
|
|
114
|
+
};
|
|
115
|
+
}, [workflowId, orgId, callbackMetadata]);
|
|
116
|
+
|
|
117
|
+
// Compute total from items + adjustments or use override
|
|
118
|
+
const computedTotal = useMemo(() => {
|
|
119
|
+
if (totalAmountOverride) return totalAmountOverride;
|
|
120
|
+
if (!items || items.length === 0) return "0";
|
|
121
|
+
let total = BigInt(0);
|
|
122
|
+
for (const item of items) {
|
|
123
|
+
total += safeBigInt(item.amount) * BigInt(item.quantity);
|
|
124
|
+
}
|
|
125
|
+
const shippingAmt = typeof shipping === "string" ? shipping : shipping?.amount;
|
|
126
|
+
if (shippingAmt) total += safeBigInt(shippingAmt);
|
|
127
|
+
const taxAmt = typeof tax === "string" ? tax : tax?.amount;
|
|
128
|
+
if (taxAmt) total += safeBigInt(taxAmt);
|
|
129
|
+
const discountAmt = typeof discount === "string" ? discount : discount?.amount;
|
|
130
|
+
if (discountAmt) total -= safeBigInt(discountAmt);
|
|
131
|
+
if (summaryLines) {
|
|
132
|
+
for (const line of summaryLines) total += safeBigInt(line.amount);
|
|
133
|
+
}
|
|
134
|
+
if (total < BigInt(0)) total = BigInt(0);
|
|
135
|
+
return total.toString();
|
|
136
|
+
}, [items, totalAmountOverride, shipping, tax, discount, summaryLines]);
|
|
137
|
+
|
|
138
|
+
// Get destination token metadata
|
|
139
|
+
const { data: tokenData } = useTokenData(destinationTokenChainId, destinationTokenAddress);
|
|
140
|
+
const tokenSymbol = tokenData?.symbol || "";
|
|
141
|
+
const tokenDecimals = tokenData?.decimals || 18;
|
|
142
|
+
|
|
143
|
+
const formattedTotal = useMemo(
|
|
144
|
+
() => formatTokenAmount(BigInt(computedTotal || "0"), tokenDecimals),
|
|
145
|
+
[computedTotal, tokenDecimals],
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
const hasItems = items && items.length > 0;
|
|
149
|
+
const fingerprint = getFingerprintConfig();
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<AnySpendFingerprintWrapper fingerprint={fingerprint}>
|
|
153
|
+
<AnySpendCustomizationProvider slots={slots} content={content} theme={theme}>
|
|
154
|
+
<div className="anyspend-checkout-trigger flex flex-col">
|
|
155
|
+
{/* Cart summary with items */}
|
|
156
|
+
{hasItems && (
|
|
157
|
+
<div className="border-b border-gray-200 p-5 dark:border-neutral-700">
|
|
158
|
+
<CheckoutCartPanel
|
|
159
|
+
items={items}
|
|
160
|
+
totalAmount={computedTotal}
|
|
161
|
+
tokenSymbol={tokenSymbol}
|
|
162
|
+
tokenDecimals={tokenDecimals}
|
|
163
|
+
organizationName={organizationName}
|
|
164
|
+
organizationLogo={organizationLogo}
|
|
165
|
+
classes={classes}
|
|
166
|
+
footer={footer}
|
|
167
|
+
shipping={typeof shipping === "string" ? { amount: shipping } : shipping}
|
|
168
|
+
tax={typeof tax === "string" ? { amount: tax } : tax}
|
|
169
|
+
discount={typeof discount === "string" ? { amount: discount } : discount}
|
|
170
|
+
summaryLines={summaryLines}
|
|
171
|
+
/>
|
|
172
|
+
</div>
|
|
173
|
+
)}
|
|
174
|
+
|
|
175
|
+
{/* Total-only header when no items */}
|
|
176
|
+
{!hasItems && (
|
|
177
|
+
<div className="border-b border-gray-200 p-5 dark:border-neutral-700">
|
|
178
|
+
<div className="flex flex-col gap-3">
|
|
179
|
+
<div className={cn("flex items-center justify-between", classes?.cartSummary)}>
|
|
180
|
+
<span className="text-base font-semibold text-gray-900 dark:text-gray-100">Total</span>
|
|
181
|
+
<span className={cn("text-base font-semibold text-gray-900 dark:text-gray-100", classes?.cartTotal)}>
|
|
182
|
+
{formattedTotal} {tokenSymbol}
|
|
183
|
+
</span>
|
|
184
|
+
</div>
|
|
185
|
+
{footer === undefined ? (
|
|
186
|
+
<PoweredByBranding
|
|
187
|
+
organizationName={organizationName}
|
|
188
|
+
organizationLogo={organizationLogo}
|
|
189
|
+
classes={classes}
|
|
190
|
+
/>
|
|
191
|
+
) : (
|
|
192
|
+
footer
|
|
193
|
+
)}
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
)}
|
|
197
|
+
|
|
198
|
+
{/* Payment methods */}
|
|
199
|
+
<div className="px-2 py-3">
|
|
200
|
+
<CheckoutPaymentPanel
|
|
201
|
+
recipientAddress={recipientAddress}
|
|
202
|
+
destinationTokenAddress={destinationTokenAddress}
|
|
203
|
+
destinationTokenChainId={destinationTokenChainId}
|
|
204
|
+
totalAmount={computedTotal}
|
|
205
|
+
buttonText={buttonText}
|
|
206
|
+
themeColor={themeColor}
|
|
207
|
+
returnUrl={returnUrl}
|
|
208
|
+
returnLabel={returnLabel}
|
|
209
|
+
onSuccess={onSuccess}
|
|
210
|
+
onError={onError}
|
|
211
|
+
callbackMetadata={mergedMetadata}
|
|
212
|
+
classes={classes}
|
|
213
|
+
defaultPaymentMethod={defaultPaymentMethod}
|
|
214
|
+
senderAddress={senderAddress}
|
|
215
|
+
/>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
</AnySpendCustomizationProvider>
|
|
219
|
+
</AnySpendFingerprintWrapper>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
|
+
import type { CheckoutItem, AnySpendCheckoutClasses } from "./AnySpendCheckout";
|
|
5
|
+
|
|
6
|
+
interface CartItemRowProps {
|
|
7
|
+
item: CheckoutItem;
|
|
8
|
+
formattedPrice: string;
|
|
9
|
+
classes?: AnySpendCheckoutClasses;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function CartItemRow({ item, formattedPrice, classes }: CartItemRowProps) {
|
|
13
|
+
return (
|
|
14
|
+
<div className={cn("flex items-start gap-3 py-3", classes?.cartItemRow)}>
|
|
15
|
+
{item.imageUrl && (
|
|
16
|
+
<div className={cn("h-14 w-14 shrink-0 overflow-hidden rounded-lg bg-gray-100", classes?.cartItemImage)}>
|
|
17
|
+
<img src={item.imageUrl} alt={item.name} className="h-full w-full object-cover" />
|
|
18
|
+
</div>
|
|
19
|
+
)}
|
|
20
|
+
<div className="flex min-w-0 flex-1 items-start justify-between">
|
|
21
|
+
<div className="min-w-0 flex-1">
|
|
22
|
+
<p className={cn("text-sm font-medium text-gray-900 dark:text-gray-100", classes?.cartItemName)}>
|
|
23
|
+
{item.name}
|
|
24
|
+
</p>
|
|
25
|
+
{item.description && (
|
|
26
|
+
<p
|
|
27
|
+
className={cn(
|
|
28
|
+
"mt-0.5 line-clamp-2 text-xs text-gray-500 dark:text-gray-400",
|
|
29
|
+
classes?.cartItemDescription,
|
|
30
|
+
)}
|
|
31
|
+
>
|
|
32
|
+
{item.description}
|
|
33
|
+
</p>
|
|
34
|
+
)}
|
|
35
|
+
{item.quantity > 1 && <p className="mt-0.5 text-xs text-gray-400 dark:text-gray-500">Qty: {item.quantity}</p>}
|
|
36
|
+
{item.metadata && Object.keys(item.metadata).length > 0 && (
|
|
37
|
+
<div className={cn("mt-1 flex flex-wrap gap-x-3 gap-y-0.5", classes?.cartItemMetadata)}>
|
|
38
|
+
{Object.entries(item.metadata).map(([key, value]) => (
|
|
39
|
+
<span
|
|
40
|
+
key={key}
|
|
41
|
+
className={cn("text-xs text-gray-400 dark:text-gray-500", classes?.cartItemMetadataLabel)}
|
|
42
|
+
>
|
|
43
|
+
{key}:{" "}
|
|
44
|
+
<span className={cn("text-gray-600 dark:text-gray-300", classes?.cartItemMetadataValue)}>
|
|
45
|
+
{value}
|
|
46
|
+
</span>
|
|
47
|
+
</span>
|
|
48
|
+
))}
|
|
49
|
+
</div>
|
|
50
|
+
)}
|
|
51
|
+
</div>
|
|
52
|
+
<p className={cn("ml-3 text-sm font-medium text-gray-900 dark:text-gray-100", classes?.cartItemPrice)}>
|
|
53
|
+
{formattedPrice}
|
|
54
|
+
</p>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
|
+
import { formatTokenAmount, safeBigInt } from "@b3dotfun/sdk/shared/utils/number";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
|
|
7
|
+
import type { CheckoutSummaryLine } from "./AnySpendCheckout";
|
|
8
|
+
|
|
9
|
+
interface CartSummaryProps {
|
|
10
|
+
/** Formatted total (final amount after all adjustments) */
|
|
11
|
+
total: string;
|
|
12
|
+
tokenSymbol?: string;
|
|
13
|
+
classes?: AnySpendCheckoutClasses;
|
|
14
|
+
/** Formatted subtotal (sum of items only — shown when adjustments exist) */
|
|
15
|
+
subtotal?: string;
|
|
16
|
+
tokenDecimals?: number;
|
|
17
|
+
shipping?: { amount: string; label?: string };
|
|
18
|
+
tax?: { amount: string; label?: string; rate?: string };
|
|
19
|
+
discount?: { amount: string; label?: string; code?: string };
|
|
20
|
+
summaryLines?: CheckoutSummaryLine[];
|
|
21
|
+
/** Formatted USD equivalent (e.g. "$5.56") — shown for non-stablecoin tokens */
|
|
22
|
+
usdEquivalent?: string | null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function CartSummary({
|
|
26
|
+
total,
|
|
27
|
+
tokenSymbol,
|
|
28
|
+
classes,
|
|
29
|
+
subtotal,
|
|
30
|
+
tokenDecimals = 18,
|
|
31
|
+
shipping,
|
|
32
|
+
tax,
|
|
33
|
+
discount,
|
|
34
|
+
summaryLines,
|
|
35
|
+
usdEquivalent,
|
|
36
|
+
}: CartSummaryProps) {
|
|
37
|
+
const hasAdjustments =
|
|
38
|
+
!!shipping?.amount || !!tax?.amount || !!discount?.amount || (summaryLines && summaryLines.length > 0);
|
|
39
|
+
|
|
40
|
+
const formattedShipping = useMemo(
|
|
41
|
+
() => (shipping?.amount ? formatTokenAmount(safeBigInt(shipping.amount), tokenDecimals) : null),
|
|
42
|
+
[shipping?.amount, tokenDecimals],
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const formattedTax = useMemo(
|
|
46
|
+
() => (tax?.amount ? formatTokenAmount(safeBigInt(tax.amount), tokenDecimals) : null),
|
|
47
|
+
[tax?.amount, tokenDecimals],
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const formattedDiscount = useMemo(
|
|
51
|
+
() => (discount?.amount ? formatTokenAmount(safeBigInt(discount.amount), tokenDecimals) : null),
|
|
52
|
+
[discount?.amount, tokenDecimals],
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const formattedSummaryLines = useMemo(
|
|
56
|
+
() =>
|
|
57
|
+
summaryLines?.map(line => ({
|
|
58
|
+
...line,
|
|
59
|
+
formattedAmount: formatTokenAmount(safeBigInt(line.amount), tokenDecimals),
|
|
60
|
+
isNegative: safeBigInt(line.amount) < BigInt(0),
|
|
61
|
+
})),
|
|
62
|
+
[summaryLines, tokenDecimals],
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div className={cn("border-t border-gray-200 pt-3 dark:border-neutral-700", classes?.cartSummary)}>
|
|
67
|
+
{/* Subtotal — only shown when adjustments exist */}
|
|
68
|
+
{hasAdjustments && subtotal && (
|
|
69
|
+
<div className={cn("flex items-center justify-between py-1", classes?.cartSubtotal)}>
|
|
70
|
+
<span className="text-sm text-gray-500 dark:text-gray-400">Subtotal</span>
|
|
71
|
+
<span className="text-sm text-gray-500 dark:text-gray-400">
|
|
72
|
+
{subtotal} {tokenSymbol}
|
|
73
|
+
</span>
|
|
74
|
+
</div>
|
|
75
|
+
)}
|
|
76
|
+
|
|
77
|
+
{/* Shipping */}
|
|
78
|
+
{formattedShipping && (
|
|
79
|
+
<div className={cn("flex items-center justify-between py-1", classes?.cartSummaryLine)}>
|
|
80
|
+
<span className={cn("text-sm text-gray-500 dark:text-gray-400", classes?.cartSummaryLineLabel)}>
|
|
81
|
+
{shipping?.label || "Shipping"}
|
|
82
|
+
</span>
|
|
83
|
+
<span className={cn("text-sm text-gray-500 dark:text-gray-400", classes?.cartSummaryLineAmount)}>
|
|
84
|
+
{formattedShipping} {tokenSymbol}
|
|
85
|
+
</span>
|
|
86
|
+
</div>
|
|
87
|
+
)}
|
|
88
|
+
|
|
89
|
+
{/* Tax */}
|
|
90
|
+
{formattedTax && (
|
|
91
|
+
<div className={cn("flex items-center justify-between py-1", classes?.cartSummaryLine)}>
|
|
92
|
+
<span className={cn("text-sm text-gray-500 dark:text-gray-400", classes?.cartSummaryLineLabel)}>
|
|
93
|
+
{tax?.label || "Tax"}
|
|
94
|
+
{tax?.rate && <span className="ml-1 text-xs text-gray-400 dark:text-gray-500">({tax.rate})</span>}
|
|
95
|
+
</span>
|
|
96
|
+
<span className={cn("text-sm text-gray-500 dark:text-gray-400", classes?.cartSummaryLineAmount)}>
|
|
97
|
+
{formattedTax} {tokenSymbol}
|
|
98
|
+
</span>
|
|
99
|
+
</div>
|
|
100
|
+
)}
|
|
101
|
+
|
|
102
|
+
{/* Discount */}
|
|
103
|
+
{formattedDiscount && (
|
|
104
|
+
<div className={cn("flex items-center justify-between py-1", classes?.cartDiscount)}>
|
|
105
|
+
<span className="text-sm text-gray-500 dark:text-gray-400">
|
|
106
|
+
{discount?.label || "Discount"}
|
|
107
|
+
{discount?.code && (
|
|
108
|
+
<span className="ml-1 rounded bg-green-50 px-1.5 py-0.5 text-xs font-medium text-green-600 dark:bg-green-900/20 dark:text-green-400">
|
|
109
|
+
{discount.code}
|
|
110
|
+
</span>
|
|
111
|
+
)}
|
|
112
|
+
</span>
|
|
113
|
+
<span className="text-sm font-medium text-green-600 dark:text-green-400">
|
|
114
|
+
-{formattedDiscount} {tokenSymbol}
|
|
115
|
+
</span>
|
|
116
|
+
</div>
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
{/* Custom summary lines */}
|
|
120
|
+
{formattedSummaryLines?.map(line => (
|
|
121
|
+
<div key={line.label} className={cn("flex items-center justify-between py-1", classes?.cartSummaryLine)}>
|
|
122
|
+
<span className={cn("text-sm text-gray-500 dark:text-gray-400", classes?.cartSummaryLineLabel)}>
|
|
123
|
+
{line.label}
|
|
124
|
+
{line.description && (
|
|
125
|
+
<span className="ml-1 text-xs text-gray-400 dark:text-gray-500">({line.description})</span>
|
|
126
|
+
)}
|
|
127
|
+
</span>
|
|
128
|
+
<span
|
|
129
|
+
className={cn(
|
|
130
|
+
"text-sm",
|
|
131
|
+
line.isNegative ? "font-medium text-green-600 dark:text-green-400" : "text-gray-500 dark:text-gray-400",
|
|
132
|
+
classes?.cartSummaryLineAmount,
|
|
133
|
+
)}
|
|
134
|
+
>
|
|
135
|
+
{line.formattedAmount} {tokenSymbol}
|
|
136
|
+
</span>
|
|
137
|
+
</div>
|
|
138
|
+
))}
|
|
139
|
+
|
|
140
|
+
{/* Total — always shown, separator when adjustments exist */}
|
|
141
|
+
<div
|
|
142
|
+
className={cn("flex flex-col", hasAdjustments && "mt-1 border-t border-gray-100 pt-2 dark:border-neutral-800")}
|
|
143
|
+
>
|
|
144
|
+
<div className="flex items-center justify-between">
|
|
145
|
+
<span className="text-base font-semibold text-gray-900 dark:text-gray-100">Total</span>
|
|
146
|
+
<span className={cn("text-base font-semibold text-gray-900 dark:text-gray-100", classes?.cartTotal)}>
|
|
147
|
+
{total} {tokenSymbol}
|
|
148
|
+
</span>
|
|
149
|
+
</div>
|
|
150
|
+
{usdEquivalent && (
|
|
151
|
+
<div className="flex justify-end">
|
|
152
|
+
<span className="text-xs text-gray-400 dark:text-gray-500">~{usdEquivalent} USD</span>
|
|
153
|
+
</div>
|
|
154
|
+
)}
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
|
+
import { formatTokenAmount, safeBigInt } from "@b3dotfun/sdk/shared/utils/number";
|
|
5
|
+
import { type ReactNode, useMemo } from "react";
|
|
6
|
+
import type { CheckoutItem, CheckoutSummaryLine, AnySpendCheckoutClasses } from "./AnySpendCheckout";
|
|
7
|
+
import { CartItemRow } from "./CartItemRow";
|
|
8
|
+
import { CartSummary } from "./CartSummary";
|
|
9
|
+
import { PoweredByBranding } from "./PoweredByBranding";
|
|
10
|
+
|
|
11
|
+
interface CheckoutCartPanelProps {
|
|
12
|
+
items: CheckoutItem[];
|
|
13
|
+
totalAmount: string;
|
|
14
|
+
tokenSymbol?: string;
|
|
15
|
+
tokenDecimals?: number;
|
|
16
|
+
organizationName?: string;
|
|
17
|
+
organizationLogo?: string;
|
|
18
|
+
classes?: AnySpendCheckoutClasses;
|
|
19
|
+
/** Custom footer. Pass `null` to hide, or a ReactNode to replace the default PoweredByBranding. */
|
|
20
|
+
footer?: ReactNode | null;
|
|
21
|
+
shipping?: { amount: string; label?: string };
|
|
22
|
+
tax?: { amount: string; label?: string; rate?: string };
|
|
23
|
+
discount?: { amount: string; label?: string; code?: string };
|
|
24
|
+
summaryLines?: CheckoutSummaryLine[];
|
|
25
|
+
/** Formatted USD equivalent (e.g. "$5.56") — shown for non-stablecoin tokens */
|
|
26
|
+
usdEquivalent?: string | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function CheckoutCartPanel({
|
|
30
|
+
items,
|
|
31
|
+
totalAmount,
|
|
32
|
+
tokenSymbol = "",
|
|
33
|
+
tokenDecimals = 18,
|
|
34
|
+
organizationName,
|
|
35
|
+
organizationLogo,
|
|
36
|
+
classes,
|
|
37
|
+
footer,
|
|
38
|
+
shipping,
|
|
39
|
+
tax,
|
|
40
|
+
discount,
|
|
41
|
+
summaryLines,
|
|
42
|
+
usdEquivalent,
|
|
43
|
+
}: CheckoutCartPanelProps) {
|
|
44
|
+
const formattedTotal = useMemo(
|
|
45
|
+
() => formatTokenAmount(safeBigInt(totalAmount), tokenDecimals),
|
|
46
|
+
[totalAmount, tokenDecimals],
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// Compute subtotal from items only (before adjustments)
|
|
50
|
+
const formattedSubtotal = useMemo(() => {
|
|
51
|
+
let subtotal = BigInt(0);
|
|
52
|
+
for (const item of items) {
|
|
53
|
+
subtotal += safeBigInt(item.amount) * BigInt(item.quantity);
|
|
54
|
+
}
|
|
55
|
+
return formatTokenAmount(subtotal, tokenDecimals);
|
|
56
|
+
}, [items, tokenDecimals]);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div className={cn("anyspend-cart-panel flex flex-col", classes?.cartPanel)}>
|
|
60
|
+
<h2
|
|
61
|
+
className={cn(
|
|
62
|
+
"anyspend-cart-title mb-4 text-lg font-semibold text-gray-900 dark:text-gray-100",
|
|
63
|
+
classes?.cartTitle,
|
|
64
|
+
)}
|
|
65
|
+
>
|
|
66
|
+
Order Summary
|
|
67
|
+
</h2>
|
|
68
|
+
|
|
69
|
+
<div className="anyspend-cart-items divide-y divide-gray-100 dark:divide-gray-800">
|
|
70
|
+
{items.map((item, index) => {
|
|
71
|
+
const itemTotal = safeBigInt(item.amount) * BigInt(item.quantity);
|
|
72
|
+
const formattedPrice = `${formatTokenAmount(itemTotal, tokenDecimals)} ${tokenSymbol}`;
|
|
73
|
+
|
|
74
|
+
return <CartItemRow key={item.id || index} item={item} formattedPrice={formattedPrice} classes={classes} />;
|
|
75
|
+
})}
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<CartSummary
|
|
79
|
+
total={formattedTotal}
|
|
80
|
+
tokenSymbol={tokenSymbol}
|
|
81
|
+
classes={classes}
|
|
82
|
+
subtotal={formattedSubtotal}
|
|
83
|
+
tokenDecimals={tokenDecimals}
|
|
84
|
+
shipping={shipping}
|
|
85
|
+
tax={tax}
|
|
86
|
+
discount={discount}
|
|
87
|
+
summaryLines={summaryLines}
|
|
88
|
+
usdEquivalent={usdEquivalent}
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
{footer === undefined ? (
|
|
92
|
+
<PoweredByBranding organizationName={organizationName} organizationLogo={organizationLogo} classes={classes} />
|
|
93
|
+
) : (
|
|
94
|
+
footer
|
|
95
|
+
)}
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
|
+
import type { CheckoutFormField as FormFieldType } from "../../../types/forms";
|
|
5
|
+
|
|
6
|
+
interface CheckoutFormFieldProps {
|
|
7
|
+
field: FormFieldType;
|
|
8
|
+
value: unknown;
|
|
9
|
+
onChange: (id: string, value: unknown) => void;
|
|
10
|
+
error?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const inputBaseClass =
|
|
15
|
+
"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";
|
|
16
|
+
|
|
17
|
+
const labelClass = "mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300";
|
|
18
|
+
|
|
19
|
+
export function CheckoutFormFieldComponent({ field, value, onChange, error, className }: CheckoutFormFieldProps) {
|
|
20
|
+
const handleChange = (val: unknown) => {
|
|
21
|
+
onChange(field.id, val);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const renderField = () => {
|
|
25
|
+
switch (field.type) {
|
|
26
|
+
case "text":
|
|
27
|
+
case "email":
|
|
28
|
+
case "phone":
|
|
29
|
+
case "number":
|
|
30
|
+
return (
|
|
31
|
+
<input
|
|
32
|
+
type={field.type === "phone" ? "tel" : field.type}
|
|
33
|
+
value={(value as string) || ""}
|
|
34
|
+
onChange={e => handleChange(e.target.value)}
|
|
35
|
+
placeholder={field.placeholder}
|
|
36
|
+
required={field.required}
|
|
37
|
+
className={cn(
|
|
38
|
+
"anyspend-form-input",
|
|
39
|
+
inputBaseClass,
|
|
40
|
+
error && "border-red-400 focus:border-red-500 focus:ring-red-500",
|
|
41
|
+
)}
|
|
42
|
+
minLength={field.validation?.minLength}
|
|
43
|
+
maxLength={field.validation?.maxLength}
|
|
44
|
+
min={field.validation?.min}
|
|
45
|
+
max={field.validation?.max}
|
|
46
|
+
pattern={field.validation?.pattern}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
case "textarea":
|
|
51
|
+
return (
|
|
52
|
+
<textarea
|
|
53
|
+
value={(value as string) || ""}
|
|
54
|
+
onChange={e => handleChange(e.target.value)}
|
|
55
|
+
placeholder={field.placeholder}
|
|
56
|
+
required={field.required}
|
|
57
|
+
rows={3}
|
|
58
|
+
className={cn(
|
|
59
|
+
"anyspend-form-textarea",
|
|
60
|
+
inputBaseClass,
|
|
61
|
+
"resize-y",
|
|
62
|
+
error && "border-red-400 focus:border-red-500 focus:ring-red-500",
|
|
63
|
+
)}
|
|
64
|
+
minLength={field.validation?.minLength}
|
|
65
|
+
maxLength={field.validation?.maxLength}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
case "select":
|
|
70
|
+
return (
|
|
71
|
+
<select
|
|
72
|
+
value={(value as string) || ""}
|
|
73
|
+
onChange={e => handleChange(e.target.value)}
|
|
74
|
+
required={field.required}
|
|
75
|
+
className={cn("anyspend-form-select", inputBaseClass, "cursor-pointer", error && "border-red-400")}
|
|
76
|
+
>
|
|
77
|
+
<option value="">{field.placeholder || "Select..."}</option>
|
|
78
|
+
{field.options?.map(opt => (
|
|
79
|
+
<option key={opt.value} value={opt.value}>
|
|
80
|
+
{opt.label}
|
|
81
|
+
</option>
|
|
82
|
+
))}
|
|
83
|
+
</select>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
case "checkbox":
|
|
87
|
+
return (
|
|
88
|
+
<label className="anyspend-form-checkbox flex cursor-pointer items-center gap-2">
|
|
89
|
+
<input
|
|
90
|
+
type="checkbox"
|
|
91
|
+
checked={!!value}
|
|
92
|
+
onChange={e => handleChange(e.target.checked)}
|
|
93
|
+
className="h-4 w-4 rounded border-gray-300 text-blue-500 focus:ring-blue-500"
|
|
94
|
+
/>
|
|
95
|
+
<span className="text-sm text-gray-700 dark:text-gray-300">{field.placeholder || field.label}</span>
|
|
96
|
+
</label>
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
default:
|
|
100
|
+
return (
|
|
101
|
+
<input
|
|
102
|
+
type="text"
|
|
103
|
+
value={(value as string) || ""}
|
|
104
|
+
onChange={e => handleChange(e.target.value)}
|
|
105
|
+
placeholder={field.placeholder}
|
|
106
|
+
required={field.required}
|
|
107
|
+
className={cn("anyspend-form-input", inputBaseClass, error && "border-red-400")}
|
|
108
|
+
/>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<div
|
|
115
|
+
className={cn("anyspend-form-field space-y-1", className)}
|
|
116
|
+
data-field-id={field.id}
|
|
117
|
+
data-field-type={field.type}
|
|
118
|
+
>
|
|
119
|
+
{field.type !== "checkbox" && (
|
|
120
|
+
<label className={cn("anyspend-form-label", labelClass)}>
|
|
121
|
+
{field.label}
|
|
122
|
+
{field.required && <span className="ml-0.5 text-red-500">*</span>}
|
|
123
|
+
</label>
|
|
124
|
+
)}
|
|
125
|
+
{renderField()}
|
|
126
|
+
{error && <p className="anyspend-form-error text-xs text-red-500">{error}</p>}
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|