@b3dotfun/sdk 0.1.66-alpha.4 → 0.1.67-alpha.0
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 +69 -2
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +134 -6
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +36 -2
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +21 -5
- package/dist/cjs/anyspend/react/components/checkout/CartItemRow.js +1 -1
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.d.ts +23 -1
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.js +13 -2
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +22 -2
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.js +12 -4
- 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.js +4 -16
- 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 +12 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +35 -16
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.js +21 -1
- package/dist/cjs/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/checkout/CoinbaseCheckoutPanel.js +147 -4
- 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 +4 -1
- package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +74 -22
- package/dist/cjs/anyspend/react/components/checkout/PoweredByBranding.js +1 -1
- 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 +4 -1
- package/dist/cjs/anyspend/react/components/index.js +5 -1
- package/dist/cjs/anyspend/react/components/types/classes.d.ts +18 -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 +8 -2
- 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/global-account/react/components/B3DynamicModal.js +4 -2
- 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/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 +69 -2
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +136 -8
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +36 -2
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +22 -6
- package/dist/esm/anyspend/react/components/checkout/CartItemRow.js +1 -1
- package/dist/esm/anyspend/react/components/checkout/CartSummary.d.ts +23 -1
- package/dist/esm/anyspend/react/components/checkout/CartSummary.js +13 -2
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +22 -2
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.js +13 -5
- 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.js +4 -16
- 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 +12 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +37 -18
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.js +23 -3
- package/dist/esm/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +4 -1
- package/dist/esm/anyspend/react/components/checkout/CoinbaseCheckoutPanel.js +151 -8
- 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 +4 -1
- package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +78 -26
- package/dist/esm/anyspend/react/components/checkout/PoweredByBranding.js +1 -1
- 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 +4 -1
- package/dist/esm/anyspend/react/components/index.js +2 -0
- package/dist/esm/anyspend/react/components/types/classes.d.ts +18 -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 +8 -2
- 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/global-account/react/components/B3DynamicModal.js +4 -2
- 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/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 +69 -2
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +36 -2
- package/dist/types/anyspend/react/components/checkout/CartSummary.d.ts +23 -1
- package/dist/types/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +22 -2
- 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/CheckoutOrderStatus.d.ts +28 -0
- package/dist/types/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +12 -1
- package/dist/types/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +4 -1
- 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 +4 -1
- 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 +4 -1
- package/dist/types/anyspend/react/components/types/classes.d.ts +18 -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 +8 -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/ui/dialog.d.ts +2 -0
- package/dist/types/global-account/react/components/ui/drawer.d.ts +3 -1
- 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 +307 -36
- package/src/anyspend/react/components/checkout/AnySpendCheckoutTrigger.tsx +108 -53
- package/src/anyspend/react/components/checkout/CartItemRow.tsx +15 -0
- package/src/anyspend/react/components/checkout/CartSummary.tsx +142 -7
- package/src/anyspend/react/components/checkout/CheckoutCartPanel.tsx +45 -7
- 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 +8 -28
- package/src/anyspend/react/components/checkout/CheckoutOrderStatus.tsx +224 -0
- package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +83 -64
- package/src/anyspend/react/components/checkout/CheckoutSuccess.tsx +35 -16
- package/src/anyspend/react/components/checkout/CoinbaseCheckoutPanel.tsx +201 -13
- 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 +130 -41
- package/src/anyspend/react/components/checkout/PoweredByBranding.tsx +12 -2
- 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 +27 -1
- package/src/anyspend/react/components/types/classes.ts +22 -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 +3 -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/global-account/react/components/B3DynamicModal.tsx +8 -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/shared/utils/number.ts +12 -0
- package/src/styles/index.css +48 -2
- package/dist/cjs/anyspend/react/components/checkout/CryptoCheckoutPanel.d.ts +0 -33
- package/dist/cjs/anyspend/react/components/checkout/CryptoCheckoutPanel.js +0 -317
- package/dist/cjs/anyspend/react/components/checkout/QRCheckoutPanel.d.ts +0 -17
- package/dist/cjs/anyspend/react/components/checkout/QRCheckoutPanel.js +0 -157
- package/dist/esm/anyspend/react/components/checkout/CryptoCheckoutPanel.d.ts +0 -33
- package/dist/esm/anyspend/react/components/checkout/CryptoCheckoutPanel.js +0 -313
- package/dist/esm/anyspend/react/components/checkout/QRCheckoutPanel.d.ts +0 -17
- package/dist/esm/anyspend/react/components/checkout/QRCheckoutPanel.js +0 -154
- package/dist/types/anyspend/react/components/checkout/CryptoCheckoutPanel.d.ts +0 -33
- package/dist/types/anyspend/react/components/checkout/QRCheckoutPanel.d.ts +0 -17
- package/src/anyspend/react/components/checkout/CryptoCheckoutPanel.tsx +0 -643
- package/src/anyspend/react/components/checkout/QRCheckoutPanel.tsx +0 -329
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext, useMemo, type ReactNode } from "react";
|
|
4
|
+
import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "../types/customization";
|
|
5
|
+
|
|
6
|
+
interface AnySpendCustomizationContextValue {
|
|
7
|
+
slots: AnySpendSlots;
|
|
8
|
+
content: AnySpendContent;
|
|
9
|
+
theme: AnySpendTheme;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const AnySpendCustomizationContext = createContext<AnySpendCustomizationContextValue>({
|
|
13
|
+
slots: {},
|
|
14
|
+
content: {},
|
|
15
|
+
theme: {},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/** Convert a hex color to HSL string (e.g. "210 50% 40%"). Supports both 3-digit (#fff) and 6-digit (#ffffff) formats. */
|
|
19
|
+
function hexToHsl(hex: string): string | null {
|
|
20
|
+
const hexStr = hex.replace(/^#/, "");
|
|
21
|
+
let r: number, g: number, b: number;
|
|
22
|
+
|
|
23
|
+
if (hexStr.length === 3) {
|
|
24
|
+
// 3-digit hex shorthand (e.g., #fff)
|
|
25
|
+
[r, g, b] = [0, 1, 2].map(i => parseInt(hexStr[i] + hexStr[i], 16) / 255);
|
|
26
|
+
} else if (hexStr.length === 6) {
|
|
27
|
+
// 6-digit hex (e.g., #ffffff)
|
|
28
|
+
[r, g, b] = [0, 2, 4].map(i => parseInt(hexStr.substring(i, i + 2), 16) / 255);
|
|
29
|
+
} else {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const max = Math.max(r, g, b);
|
|
34
|
+
const min = Math.min(r, g, b);
|
|
35
|
+
let h = 0;
|
|
36
|
+
let s = 0;
|
|
37
|
+
const l = (max + min) / 2;
|
|
38
|
+
|
|
39
|
+
if (max !== min) {
|
|
40
|
+
const d = max - min;
|
|
41
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
42
|
+
switch (max) {
|
|
43
|
+
case r:
|
|
44
|
+
h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
45
|
+
break;
|
|
46
|
+
case g:
|
|
47
|
+
h = ((b - r) / d + 2) / 6;
|
|
48
|
+
break;
|
|
49
|
+
case b:
|
|
50
|
+
h = ((r - g) / d + 4) / 6;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return `${Math.round(h * 360)} ${Math.round(s * 100)}% ${Math.round(l * 100)}%`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const CSS_VAR_MAP: Record<string, string> = {
|
|
59
|
+
primary: "--as-primary",
|
|
60
|
+
secondary: "--as-secondary",
|
|
61
|
+
tertiary: "--as-tertiary",
|
|
62
|
+
surfacePrimary: "--as-surface-primary",
|
|
63
|
+
surfaceSecondary: "--as-surface-secondary",
|
|
64
|
+
brand: "--as-brand",
|
|
65
|
+
borderPrimary: "--as-border-primary",
|
|
66
|
+
borderSecondary: "--as-border-secondary",
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export interface AnySpendCustomizationProviderProps {
|
|
70
|
+
slots?: AnySpendSlots;
|
|
71
|
+
content?: AnySpendContent;
|
|
72
|
+
theme?: AnySpendTheme;
|
|
73
|
+
children: ReactNode;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function AnySpendCustomizationProvider({ slots, content, theme, children }: AnySpendCustomizationProviderProps) {
|
|
77
|
+
const value = useMemo<AnySpendCustomizationContextValue>(
|
|
78
|
+
() => ({
|
|
79
|
+
slots: slots || {},
|
|
80
|
+
content: content || {},
|
|
81
|
+
theme: theme || {},
|
|
82
|
+
}),
|
|
83
|
+
[slots, content, theme],
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const cssVarOverrides = useMemo(() => {
|
|
87
|
+
const vars: Record<string, string> = {};
|
|
88
|
+
|
|
89
|
+
// Convert brandColor hex → HSL → --as-brand
|
|
90
|
+
if (theme?.brandColor) {
|
|
91
|
+
const hsl = hexToHsl(theme.brandColor);
|
|
92
|
+
if (hsl) vars["--as-brand"] = hsl;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Apply explicit color overrides (convert hex to HSL)
|
|
96
|
+
if (theme?.colors) {
|
|
97
|
+
for (const [key, val] of Object.entries(theme.colors)) {
|
|
98
|
+
const cssVar = CSS_VAR_MAP[key];
|
|
99
|
+
if (cssVar && val) {
|
|
100
|
+
const hsl = hexToHsl(val);
|
|
101
|
+
if (hsl) vars[cssVar] = hsl;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return vars;
|
|
107
|
+
}, [theme?.brandColor, theme?.colors]);
|
|
108
|
+
|
|
109
|
+
const hasOverrides = Object.keys(cssVarOverrides).length > 0;
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<AnySpendCustomizationContext.Provider value={value}>
|
|
113
|
+
{hasOverrides ? (
|
|
114
|
+
<div style={{ ...cssVarOverrides, display: "contents" } as React.CSSProperties}>{children}</div>
|
|
115
|
+
) : (
|
|
116
|
+
children
|
|
117
|
+
)}
|
|
118
|
+
</AnySpendCustomizationContext.Provider>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function useAnySpendCustomization(): AnySpendCustomizationContextValue {
|
|
123
|
+
return useContext(AnySpendCustomizationContext);
|
|
124
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
5
|
+
|
|
6
|
+
interface AnimatedCheckmarkProps {
|
|
7
|
+
/** Circle stroke / fill color (CSS color value) */
|
|
8
|
+
color?: string;
|
|
9
|
+
/** Checkmark stroke color (defaults to white) */
|
|
10
|
+
checkColor?: string;
|
|
11
|
+
/** Stroke width for the circle and check path */
|
|
12
|
+
strokeWidth?: number;
|
|
13
|
+
/** Tailwind or custom className to control size, e.g. "h-16 w-16" */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Animation delay in seconds */
|
|
16
|
+
delay?: number;
|
|
17
|
+
/** Render in final (post-animation) state with no animation */
|
|
18
|
+
static?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Animated checkmark SVG component.
|
|
23
|
+
* Circle draws in → checkmark draws → background fills → subtle scale bounce.
|
|
24
|
+
*
|
|
25
|
+
* Size is controlled via className (Tailwind classes like `h-10 w-10`, `h-16 w-16`, etc.).
|
|
26
|
+
* The SVG scales to fit its container via viewBox.
|
|
27
|
+
*/
|
|
28
|
+
export function AnimatedCheckmark({
|
|
29
|
+
color = "#22c55e",
|
|
30
|
+
checkColor = "#fff",
|
|
31
|
+
strokeWidth = 2,
|
|
32
|
+
className,
|
|
33
|
+
delay = 0,
|
|
34
|
+
static: isStatic = false,
|
|
35
|
+
}: AnimatedCheckmarkProps) {
|
|
36
|
+
const id = `ac-${useId().replace(/:/g, "")}`;
|
|
37
|
+
|
|
38
|
+
if (isStatic) {
|
|
39
|
+
return (
|
|
40
|
+
<svg
|
|
41
|
+
className={className}
|
|
42
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
43
|
+
viewBox="0 0 52 52"
|
|
44
|
+
style={{
|
|
45
|
+
borderRadius: "50%",
|
|
46
|
+
display: "block",
|
|
47
|
+
strokeWidth,
|
|
48
|
+
stroke: checkColor,
|
|
49
|
+
strokeMiterlimit: 10,
|
|
50
|
+
boxShadow: `inset 0px 0px 0px 100px ${color}`,
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
<circle
|
|
54
|
+
cx="26"
|
|
55
|
+
cy="26"
|
|
56
|
+
r="25"
|
|
57
|
+
fill="none"
|
|
58
|
+
style={{
|
|
59
|
+
strokeWidth,
|
|
60
|
+
strokeMiterlimit: 10,
|
|
61
|
+
stroke: color,
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
<path fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8" style={{ transformOrigin: "50% 50%" }} />
|
|
65
|
+
</svg>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<>
|
|
71
|
+
<style
|
|
72
|
+
dangerouslySetInnerHTML={{
|
|
73
|
+
__html: `
|
|
74
|
+
@keyframes ${id}-stroke {
|
|
75
|
+
100% { stroke-dashoffset: 0; }
|
|
76
|
+
}
|
|
77
|
+
@keyframes ${id}-scale {
|
|
78
|
+
0%, 100% { transform: none; }
|
|
79
|
+
50% { transform: scale3d(1.1, 1.1, 1); }
|
|
80
|
+
}
|
|
81
|
+
@keyframes ${id}-fill {
|
|
82
|
+
100% { box-shadow: inset 0px 0px 0px 100px ${color}; }
|
|
83
|
+
}
|
|
84
|
+
.${id} {
|
|
85
|
+
border-radius: 50%;
|
|
86
|
+
display: block;
|
|
87
|
+
stroke-width: ${strokeWidth};
|
|
88
|
+
stroke: ${checkColor};
|
|
89
|
+
stroke-miterlimit: 10;
|
|
90
|
+
box-shadow: inset 0px 0px 0px ${color};
|
|
91
|
+
animation:
|
|
92
|
+
${id}-fill .4s ease-in-out ${delay + 0.4}s forwards,
|
|
93
|
+
${id}-scale .3s ease-in-out ${delay + 0.9}s both;
|
|
94
|
+
}
|
|
95
|
+
.${id}__circle {
|
|
96
|
+
stroke-dasharray: 166;
|
|
97
|
+
stroke-dashoffset: 166;
|
|
98
|
+
stroke-width: ${strokeWidth};
|
|
99
|
+
stroke-miterlimit: 10;
|
|
100
|
+
stroke: ${color};
|
|
101
|
+
fill: none;
|
|
102
|
+
animation: ${id}-stroke .6s cubic-bezier(0.65, 0, 0.45, 1) ${delay}s forwards;
|
|
103
|
+
}
|
|
104
|
+
.${id}__check {
|
|
105
|
+
transform-origin: 50% 50%;
|
|
106
|
+
stroke-dasharray: 48;
|
|
107
|
+
stroke-dashoffset: 48;
|
|
108
|
+
animation: ${id}-stroke .3s cubic-bezier(0.65, 0, 0.45, 1) ${delay + 0.8}s forwards;
|
|
109
|
+
}
|
|
110
|
+
`,
|
|
111
|
+
}}
|
|
112
|
+
/>
|
|
113
|
+
<svg className={cn(id, className)} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52">
|
|
114
|
+
<circle className={`${id}__circle`} cx="26" cy="26" r="25" fill="none" />
|
|
115
|
+
<path className={`${id}__check`} fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8" />
|
|
116
|
+
</svg>
|
|
117
|
+
</>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
// Checkout
|
|
2
2
|
export { AnySpendCheckout } from "./checkout/AnySpendCheckout";
|
|
3
|
-
export type {
|
|
3
|
+
export type {
|
|
4
|
+
AnySpendCheckoutProps,
|
|
5
|
+
CheckoutItem,
|
|
6
|
+
CheckoutSummaryLine,
|
|
7
|
+
AnySpendCheckoutClasses,
|
|
8
|
+
CheckoutFormSchema,
|
|
9
|
+
CheckoutFormComponentProps,
|
|
10
|
+
ShippingOption,
|
|
11
|
+
DiscountResult,
|
|
12
|
+
AddressData,
|
|
13
|
+
} from "./checkout/AnySpendCheckout";
|
|
4
14
|
export { AnySpendCheckoutTrigger } from "./checkout/AnySpendCheckoutTrigger";
|
|
5
15
|
export type { AnySpendCheckoutTriggerProps } from "./checkout/AnySpendCheckoutTrigger";
|
|
16
|
+
export type { PaymentMethod } from "./checkout/CheckoutPaymentPanel";
|
|
6
17
|
|
|
7
18
|
// Components
|
|
8
19
|
export { AnySpend } from "./AnySpend";
|
|
@@ -30,6 +41,21 @@ export type {
|
|
|
30
41
|
QRDepositClasses,
|
|
31
42
|
RecipientSelectionClasses,
|
|
32
43
|
} from "./types/classes";
|
|
44
|
+
|
|
45
|
+
// Customization types (slots, content, theme)
|
|
46
|
+
export type {
|
|
47
|
+
ActionButtonSlotProps,
|
|
48
|
+
AnySpendContent,
|
|
49
|
+
AnySpendSlots,
|
|
50
|
+
AnySpendTheme,
|
|
51
|
+
ConnectWalletButtonSlotProps,
|
|
52
|
+
ErrorScreenSlotProps,
|
|
53
|
+
SuccessScreenSlotProps,
|
|
54
|
+
} from "./types/customization";
|
|
55
|
+
|
|
56
|
+
// Customization context (for advanced/nested usage)
|
|
57
|
+
export { AnySpendCustomizationProvider, useAnySpendCustomization } from "./context/AnySpendCustomizationContext";
|
|
58
|
+
|
|
33
59
|
export { AnySpendDepositHype, HYPE_TOKEN_DETAILS } from "./AnyspendDepositHype";
|
|
34
60
|
export { AnySpendWorkflowTrigger } from "./AnySpendWorkflowTrigger";
|
|
35
61
|
export type { AnySpendWorkflowTriggerProps } from "./AnySpendWorkflowTrigger";
|
|
@@ -490,6 +490,23 @@ export interface AnySpendCheckoutClasses {
|
|
|
490
490
|
cartItemPrice?: string;
|
|
491
491
|
cartSummary?: string;
|
|
492
492
|
cartTotal?: string;
|
|
493
|
+
cartSubtotal?: string;
|
|
494
|
+
cartSummaryLine?: string;
|
|
495
|
+
cartSummaryLineLabel?: string;
|
|
496
|
+
cartSummaryLineAmount?: string;
|
|
497
|
+
cartDiscount?: string;
|
|
498
|
+
cartItemMetadata?: string;
|
|
499
|
+
cartItemMetadataLabel?: string;
|
|
500
|
+
cartItemMetadataValue?: string;
|
|
501
|
+
|
|
502
|
+
// Form panel
|
|
503
|
+
formPanel?: string;
|
|
504
|
+
formField?: string;
|
|
505
|
+
formFieldLabel?: string;
|
|
506
|
+
formFieldInput?: string;
|
|
507
|
+
shippingSelector?: string;
|
|
508
|
+
discountInput?: string;
|
|
509
|
+
addressForm?: string;
|
|
493
510
|
|
|
494
511
|
// Branding
|
|
495
512
|
poweredBy?: string;
|
|
@@ -497,6 +514,11 @@ export interface AnySpendCheckoutClasses {
|
|
|
497
514
|
// Success
|
|
498
515
|
successPanel?: string;
|
|
499
516
|
returnButton?: string;
|
|
517
|
+
|
|
518
|
+
// Order status tracking
|
|
519
|
+
orderStatusPanel?: string;
|
|
520
|
+
retryButton?: string;
|
|
521
|
+
transactionLink?: string;
|
|
500
522
|
}
|
|
501
523
|
|
|
502
524
|
/** Combined classes for all AnySpend-related components */
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type {
|
|
3
|
+
CheckoutFormComponentProps,
|
|
4
|
+
ShippingSelectorSlotProps,
|
|
5
|
+
DiscountInputSlotProps,
|
|
6
|
+
} from "../../../types/forms";
|
|
7
|
+
|
|
8
|
+
// === SLOT PROP INTERFACES ===
|
|
9
|
+
|
|
10
|
+
export interface ActionButtonSlotProps {
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
loading: boolean;
|
|
14
|
+
text: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ConnectWalletButtonSlotProps {
|
|
18
|
+
onPayment: () => void;
|
|
19
|
+
txLoading: boolean;
|
|
20
|
+
connectedAddress?: string;
|
|
21
|
+
paymentLabel: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface SuccessScreenSlotProps {
|
|
25
|
+
title: string;
|
|
26
|
+
description: string;
|
|
27
|
+
txHash?: string;
|
|
28
|
+
orderId?: string;
|
|
29
|
+
explorerUrl?: string;
|
|
30
|
+
onDone: () => void;
|
|
31
|
+
returnUrl?: string;
|
|
32
|
+
returnLabel?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface ErrorScreenSlotProps {
|
|
36
|
+
title: string;
|
|
37
|
+
description: string;
|
|
38
|
+
errorType: "failure" | "expired" | "refunded";
|
|
39
|
+
orderId?: string;
|
|
40
|
+
onRetry?: () => void;
|
|
41
|
+
onDone?: () => void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// === SLOTS (element replacement) ===
|
|
45
|
+
|
|
46
|
+
export interface AnySpendSlots {
|
|
47
|
+
actionButton?: (props: ActionButtonSlotProps) => ReactNode;
|
|
48
|
+
connectWalletButton?: (props: ConnectWalletButtonSlotProps) => ReactNode;
|
|
49
|
+
header?: (props: { mode: "page" | "modal" }) => ReactNode;
|
|
50
|
+
footer?: ReactNode;
|
|
51
|
+
successScreen?: (props: SuccessScreenSlotProps) => ReactNode;
|
|
52
|
+
errorScreen?: (props: ErrorScreenSlotProps) => ReactNode;
|
|
53
|
+
/** Replace the entire checkout form panel with a custom component */
|
|
54
|
+
checkoutForm?: (props: CheckoutFormComponentProps) => ReactNode;
|
|
55
|
+
/** Replace the shipping method selector */
|
|
56
|
+
shippingSelector?: (props: ShippingSelectorSlotProps) => ReactNode;
|
|
57
|
+
/** Replace the discount code input */
|
|
58
|
+
discountInput?: (props: DiscountInputSlotProps) => ReactNode;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// === CONTENT (text/message overrides) ===
|
|
62
|
+
|
|
63
|
+
export interface AnySpendContent {
|
|
64
|
+
// Success states
|
|
65
|
+
successTitle?: string | ReactNode;
|
|
66
|
+
successDescription?: string | ReactNode;
|
|
67
|
+
|
|
68
|
+
// Error states
|
|
69
|
+
failureTitle?: string | ReactNode;
|
|
70
|
+
failureDescription?: string | ReactNode;
|
|
71
|
+
expiredTitle?: string | ReactNode;
|
|
72
|
+
expiredDescription?: string | ReactNode;
|
|
73
|
+
refundedTitle?: string | ReactNode;
|
|
74
|
+
refundedDescription?: string | ReactNode;
|
|
75
|
+
|
|
76
|
+
// Processing states
|
|
77
|
+
processingTitle?: string | ReactNode;
|
|
78
|
+
processingDescription?: string | ReactNode;
|
|
79
|
+
|
|
80
|
+
// Buttons
|
|
81
|
+
returnButtonLabel?: string;
|
|
82
|
+
retryButtonLabel?: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// === THEME ===
|
|
86
|
+
|
|
87
|
+
export interface AnySpendTheme {
|
|
88
|
+
brandColor?: string;
|
|
89
|
+
colors?: Partial<{
|
|
90
|
+
primary: string;
|
|
91
|
+
secondary: string;
|
|
92
|
+
tertiary: string;
|
|
93
|
+
surfacePrimary: string;
|
|
94
|
+
surfaceSecondary: string;
|
|
95
|
+
brand: string;
|
|
96
|
+
borderPrimary: string;
|
|
97
|
+
borderSecondary: string;
|
|
98
|
+
}>;
|
|
99
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { USDC_BASE } from "@b3dotfun/sdk/anyspend/constants";
|
|
2
2
|
import { anyspendService } from "@b3dotfun/sdk/anyspend/services/anyspend";
|
|
3
3
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
4
|
+
import { CreateOrderResponse } from "@b3dotfun/sdk/anyspend/types/api_req_res";
|
|
4
5
|
import { VisitorData } from "@b3dotfun/sdk/anyspend/types/fingerprint";
|
|
5
6
|
import { buildMetadata, buildPayload, normalizeAddress } from "@b3dotfun/sdk/anyspend/utils";
|
|
6
7
|
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
@@ -26,7 +27,7 @@ export type CreateOnrampOrderParams = Omit<CreateOrderParams, "srcChain" | "srcT
|
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
export type UseAnyspendCreateOnrampOrderProps = {
|
|
29
|
-
onSuccess?: (data:
|
|
30
|
+
onSuccess?: (data: CreateOrderResponse) => void;
|
|
30
31
|
onError?: (error: Error) => void;
|
|
31
32
|
};
|
|
32
33
|
|
|
@@ -124,7 +125,7 @@ export function useAnyspendCreateOnrampOrder({ onSuccess, onError }: UseAnyspend
|
|
|
124
125
|
throw error;
|
|
125
126
|
}
|
|
126
127
|
},
|
|
127
|
-
onSuccess: (data:
|
|
128
|
+
onSuccess: (data: CreateOrderResponse) => {
|
|
128
129
|
onSuccess?.(data);
|
|
129
130
|
},
|
|
130
131
|
onError: (error: Error) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { anyspendService } from "@b3dotfun/sdk/anyspend/services/anyspend";
|
|
2
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
|
+
import { CreateOrderResponse } from "@b3dotfun/sdk/anyspend/types/api_req_res";
|
|
3
4
|
import { VisitorData } from "@b3dotfun/sdk/anyspend/types/fingerprint";
|
|
4
5
|
import { buildMetadata, buildPayload, normalizeAddress } from "@b3dotfun/sdk/anyspend/utils";
|
|
5
6
|
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
@@ -26,7 +27,7 @@ export type CreateOrderParams = {
|
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
export type UseAnyspendCreateOrderProps = {
|
|
29
|
-
onSuccess?: (data:
|
|
30
|
+
onSuccess?: (data: CreateOrderResponse) => void;
|
|
30
31
|
onError?: (error: Error) => void;
|
|
31
32
|
};
|
|
32
33
|
|
|
@@ -99,7 +100,7 @@ export function useAnyspendCreateOrder({ onSuccess, onError }: UseAnyspendCreate
|
|
|
99
100
|
throw error;
|
|
100
101
|
}
|
|
101
102
|
},
|
|
102
|
-
onSuccess: (data:
|
|
103
|
+
onSuccess: (data: CreateOrderResponse) => {
|
|
103
104
|
onSuccess?.(data);
|
|
104
105
|
},
|
|
105
106
|
onError: (error: Error) => {
|
|
@@ -110,6 +110,8 @@ interface UseAnyspendFlowProps {
|
|
|
110
110
|
disableUrlParamManagement?: boolean;
|
|
111
111
|
orderType?: "hype_duel" | "custom_exact_in" | "swap";
|
|
112
112
|
customExactInConfig?: CustomExactInConfig;
|
|
113
|
+
/** Optional sender (payer) address — pre-fills token balances when the user address is known ahead of time */
|
|
114
|
+
senderAddress?: string;
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
// This hook serves for order hype_duel and custom_exact_in
|
|
@@ -127,6 +129,7 @@ export function useAnyspendFlow({
|
|
|
127
129
|
disableUrlParamManagement = false,
|
|
128
130
|
orderType = "hype_duel",
|
|
129
131
|
customExactInConfig,
|
|
132
|
+
senderAddress,
|
|
130
133
|
}: UseAnyspendFlowProps) {
|
|
131
134
|
const searchParams = useSearchParamsSSR();
|
|
132
135
|
const router = useRouter();
|
|
@@ -180,9 +183,10 @@ export function useAnyspendFlow({
|
|
|
180
183
|
const recipientName = recipientProfile.data?.name;
|
|
181
184
|
|
|
182
185
|
// Check token balance for crypto payments
|
|
186
|
+
const effectiveBalanceAddress = senderAddress || walletAddress;
|
|
183
187
|
const { rawBalance, isLoading: isBalanceLoading } = useTokenBalance({
|
|
184
188
|
token: selectedSrcToken,
|
|
185
|
-
address:
|
|
189
|
+
address: effectiveBalanceAddress,
|
|
186
190
|
});
|
|
187
191
|
|
|
188
192
|
// Check if user has enough balance
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { anyspendService } from "@b3dotfun/sdk/anyspend/services/anyspend";
|
|
2
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
|
+
import { CreateOrderResponse } from "@b3dotfun/sdk/anyspend/types/api_req_res";
|
|
3
4
|
import { VisitorData } from "@b3dotfun/sdk/anyspend/types/fingerprint";
|
|
4
5
|
import { normalizeAddress } from "@b3dotfun/sdk/anyspend/utils";
|
|
5
6
|
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
@@ -21,7 +22,7 @@ export type CreateDepositFirstOrderParams = {
|
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
export type UseCreateDepositFirstOrderProps = {
|
|
24
|
-
onSuccess?: (data:
|
|
25
|
+
onSuccess?: (data: CreateOrderResponse) => void;
|
|
25
26
|
onError?: (error: Error) => void;
|
|
26
27
|
};
|
|
27
28
|
|
|
@@ -94,7 +95,7 @@ export function useCreateDepositFirstOrder({ onSuccess, onError }: UseCreateDepo
|
|
|
94
95
|
throw error;
|
|
95
96
|
}
|
|
96
97
|
},
|
|
97
|
-
onSuccess: (data:
|
|
98
|
+
onSuccess: (data: CreateOrderResponse) => {
|
|
98
99
|
onSuccess?.(data);
|
|
99
100
|
},
|
|
100
101
|
onError: (error: Error) => {
|
|
@@ -20,7 +20,8 @@ import { VisitorData } from "../types/fingerprint";
|
|
|
20
20
|
// Service functions
|
|
21
21
|
export const anyspendService = {
|
|
22
22
|
getTokenList: async (chainId: number, query: string): Promise<components["schemas"]["Token"][]> => {
|
|
23
|
-
const
|
|
23
|
+
const params = new URLSearchParams({ limit: "100", term: query });
|
|
24
|
+
const response = await fetch(`${ANYSPEND_MAINNET_BASE_URL}/chains/${chainId}/tokens?${params.toString()}`);
|
|
24
25
|
const body: GetTokenListResponse = await response.json();
|
|
25
26
|
invariant(response.status === 200, `Failed to fetch token list for chain ${chainId}`);
|
|
26
27
|
return body.data;
|
|
@@ -123,6 +124,7 @@ export const anyspendService = {
|
|
|
123
124
|
invariant(orderId, "orderId is required");
|
|
124
125
|
const response = await fetch(`${ANYSPEND_MAINNET_BASE_URL}/orders/${orderId}`);
|
|
125
126
|
const data: GetOrderAndTxsResponse = await response.json();
|
|
127
|
+
invariant(response.status === 200, (data as any).message || `Failed to fetch order ${orderId}`);
|
|
126
128
|
return data;
|
|
127
129
|
},
|
|
128
130
|
|
|
@@ -140,6 +142,7 @@ export const anyspendService = {
|
|
|
140
142
|
}
|
|
141
143
|
const response = await fetch(`${ANYSPEND_MAINNET_BASE_URL}/orders?${params.toString()}`);
|
|
142
144
|
const data: GetOrderHistoryResponse = await response.json();
|
|
145
|
+
invariant(response.status === 200, (data as any).message || "Failed to fetch order history");
|
|
143
146
|
return data;
|
|
144
147
|
},
|
|
145
148
|
|
|
@@ -177,8 +180,22 @@ export const anyspendService = {
|
|
|
177
180
|
return data.data;
|
|
178
181
|
},
|
|
179
182
|
|
|
183
|
+
getCoinbaseOnrampUrl: async (
|
|
184
|
+
request: components["schemas"]["CoinbaseOnrampUrlRequest"],
|
|
185
|
+
): Promise<components["schemas"]["CoinbaseOnrampUrlResponse"]> => {
|
|
186
|
+
const response = await fetch(`${ANYSPEND_MAINNET_BASE_URL}/onramp/coinbase/onramp-url`, {
|
|
187
|
+
method: "POST",
|
|
188
|
+
headers: { "Content-Type": "application/json" },
|
|
189
|
+
body: JSON.stringify(request),
|
|
190
|
+
});
|
|
191
|
+
const data: components["schemas"]["CoinbaseOnrampUrlResponse"] = await response.json();
|
|
192
|
+
if (!response.ok) throw new Error((data as any).message || "Failed to get Coinbase onramp URL");
|
|
193
|
+
return data;
|
|
194
|
+
},
|
|
195
|
+
|
|
180
196
|
getStripeClientSecret: async (paymentIntentId: string): Promise<string | null> => {
|
|
181
|
-
const
|
|
197
|
+
const params = new URLSearchParams({ paymentIntentId });
|
|
198
|
+
const response = await fetch(`${ANYSPEND_MAINNET_BASE_URL}/stripe/clientSecret?${params.toString()}`);
|
|
182
199
|
const data: GetStripeClientSecret = await response.json();
|
|
183
200
|
invariant(response.status === 200, "Failed to get Stripe client secret");
|
|
184
201
|
return data.data;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkout form schema types
|
|
3
|
+
*
|
|
4
|
+
* Merchants define forms using a JSON schema to collect customer information
|
|
5
|
+
* during checkout (email, shipping address, discount codes, arbitrary fields).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export interface CheckoutFormField {
|
|
9
|
+
/** Unique field identifier */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Field type */
|
|
12
|
+
type: "text" | "email" | "phone" | "textarea" | "select" | "number" | "checkbox" | "address";
|
|
13
|
+
/** Display label */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Placeholder text */
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/** Whether the field is required. Default: false */
|
|
18
|
+
required?: boolean;
|
|
19
|
+
/** Default value */
|
|
20
|
+
defaultValue?: string;
|
|
21
|
+
/** Options for "select" type fields */
|
|
22
|
+
options?: { label: string; value: string }[];
|
|
23
|
+
/** Validation rules */
|
|
24
|
+
validation?: {
|
|
25
|
+
pattern?: string;
|
|
26
|
+
minLength?: number;
|
|
27
|
+
maxLength?: number;
|
|
28
|
+
min?: number;
|
|
29
|
+
max?: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface CheckoutFormSchema {
|
|
34
|
+
fields: CheckoutFormField[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ShippingOption {
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
/** Amount in wei */
|
|
42
|
+
amount: string;
|
|
43
|
+
/** e.g. "5-7 business days" */
|
|
44
|
+
estimated_days?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface DiscountResult {
|
|
48
|
+
valid: boolean;
|
|
49
|
+
discount_type?: "percentage" | "fixed";
|
|
50
|
+
discount_value?: string;
|
|
51
|
+
/** Computed discount amount in wei */
|
|
52
|
+
discount_amount?: string;
|
|
53
|
+
/** Final amount after discount in wei */
|
|
54
|
+
final_amount?: string;
|
|
55
|
+
error?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface AddressData {
|
|
59
|
+
street: string;
|
|
60
|
+
city: string;
|
|
61
|
+
state: string;
|
|
62
|
+
zip: string;
|
|
63
|
+
country: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Props passed to custom form components or the checkoutForm slot
|
|
68
|
+
*/
|
|
69
|
+
export interface CheckoutFormComponentProps {
|
|
70
|
+
/** Call this when the form is submitted / values change */
|
|
71
|
+
onSubmit: (data: Record<string, unknown>) => void;
|
|
72
|
+
/** Call to signal whether the form is currently valid */
|
|
73
|
+
onValidationChange: (isValid: boolean) => void;
|
|
74
|
+
/** Current form data */
|
|
75
|
+
formData: Record<string, unknown>;
|
|
76
|
+
/** Update form data */
|
|
77
|
+
setFormData: (data: Record<string, unknown>) => void;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Props for shipping selector slot
|
|
82
|
+
*/
|
|
83
|
+
export interface ShippingSelectorSlotProps {
|
|
84
|
+
options: ShippingOption[];
|
|
85
|
+
selectedId: string | null;
|
|
86
|
+
onSelect: (option: ShippingOption) => void;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Props for discount input slot
|
|
91
|
+
*/
|
|
92
|
+
export interface DiscountInputSlotProps {
|
|
93
|
+
onApply: (code: string) => Promise<DiscountResult>;
|
|
94
|
+
appliedDiscount: DiscountResult | null;
|
|
95
|
+
onRemove: () => void;
|
|
96
|
+
loading: boolean;
|
|
97
|
+
}
|