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