@b3dotfun/sdk 0.1.68-alpha.1 → 0.1.68-alpha.10

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 (229) hide show
  1. package/dist/cjs/anyspend/platform/client.d.ts +35 -0
  2. package/dist/cjs/anyspend/platform/client.js +158 -0
  3. package/dist/cjs/anyspend/platform/errors.d.ts +38 -0
  4. package/dist/cjs/anyspend/platform/errors.js +77 -0
  5. package/dist/cjs/anyspend/platform/index.d.ts +87 -0
  6. package/dist/cjs/anyspend/platform/index.js +85 -0
  7. package/dist/cjs/anyspend/platform/resources/analytics.d.ts +7 -0
  8. package/dist/cjs/anyspend/platform/resources/analytics.js +12 -0
  9. package/dist/cjs/anyspend/platform/resources/checkout-sessions.d.ts +17 -0
  10. package/dist/cjs/anyspend/platform/resources/checkout-sessions.js +27 -0
  11. package/dist/cjs/anyspend/platform/resources/customers.d.ts +19 -0
  12. package/dist/cjs/anyspend/platform/resources/customers.js +34 -0
  13. package/dist/cjs/anyspend/platform/resources/discount-codes.d.ts +29 -0
  14. package/dist/cjs/anyspend/platform/resources/discount-codes.js +31 -0
  15. package/dist/cjs/anyspend/platform/resources/events.d.ts +14 -0
  16. package/dist/cjs/anyspend/platform/resources/events.js +16 -0
  17. package/dist/cjs/anyspend/platform/resources/notifications.d.ts +18 -0
  18. package/dist/cjs/anyspend/platform/resources/notifications.js +27 -0
  19. package/dist/cjs/anyspend/platform/resources/organization.d.ts +17 -0
  20. package/dist/cjs/anyspend/platform/resources/organization.js +15 -0
  21. package/dist/cjs/anyspend/platform/resources/payment-links.d.ts +21 -0
  22. package/dist/cjs/anyspend/platform/resources/payment-links.js +49 -0
  23. package/dist/cjs/anyspend/platform/resources/products.d.ts +27 -0
  24. package/dist/cjs/anyspend/platform/resources/products.js +31 -0
  25. package/dist/cjs/anyspend/platform/resources/transactions.d.ts +11 -0
  26. package/dist/cjs/anyspend/platform/resources/transactions.js +25 -0
  27. package/dist/cjs/anyspend/platform/resources/webhooks.d.ts +14 -0
  28. package/dist/cjs/anyspend/platform/resources/webhooks.js +33 -0
  29. package/dist/cjs/anyspend/platform/resources/widgets.d.ts +38 -0
  30. package/dist/cjs/anyspend/platform/resources/widgets.js +31 -0
  31. package/dist/cjs/anyspend/platform/types.d.ts +478 -0
  32. package/dist/cjs/anyspend/platform/types.js +5 -0
  33. package/dist/cjs/anyspend/platform/utils/idempotency.d.ts +4 -0
  34. package/dist/cjs/anyspend/platform/utils/idempotency.js +17 -0
  35. package/dist/cjs/anyspend/platform/utils/pagination.d.ts +12 -0
  36. package/dist/cjs/anyspend/platform/utils/pagination.js +22 -0
  37. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +5 -1
  38. package/dist/cjs/anyspend/react/components/AnySpend.js +123 -12
  39. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +12 -6
  40. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +55 -8
  41. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
  42. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +2 -2
  43. package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
  44. package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -2
  45. package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +1 -1
  46. package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +3 -1
  47. package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +46 -16
  48. package/dist/cjs/anyspend/react/components/checkout/KycGate.d.ts +11 -0
  49. package/dist/cjs/anyspend/react/components/checkout/KycGate.js +203 -0
  50. package/dist/cjs/anyspend/react/components/checkout/VariablePricingInput.d.ts +17 -0
  51. package/dist/cjs/anyspend/react/components/checkout/VariablePricingInput.js +145 -0
  52. package/dist/cjs/anyspend/react/components/index.d.ts +1 -1
  53. package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
  54. package/dist/cjs/anyspend/react/hooks/index.js +1 -0
  55. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +13 -0
  56. package/dist/cjs/anyspend/react/hooks/useKycStatus.d.ts +47 -0
  57. package/dist/cjs/anyspend/react/hooks/useKycStatus.js +124 -0
  58. package/dist/cjs/anyspend/services/anyspend.d.ts +3 -1
  59. package/dist/cjs/anyspend/services/anyspend.js +2 -1
  60. package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -1
  61. package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +3 -3
  62. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
  63. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -5
  64. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
  65. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -1
  66. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +21 -24
  67. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
  68. package/dist/cjs/global-account/react/hooks/useAuth.js +1 -1
  69. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +3 -1
  70. package/dist/cjs/global-account/react/hooks/useAuthentication.js +82 -24
  71. package/dist/cjs/global-account/react/hooks/useGetAllTWSigners.js +2 -1
  72. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
  73. package/dist/cjs/global-account/react/stores/useModalStore.js +2 -0
  74. package/dist/cjs/global-account/react/utils/createWagmiConfig.d.ts +18 -0
  75. package/dist/cjs/global-account/react/utils/createWagmiConfig.js +17 -0
  76. package/dist/esm/anyspend/platform/client.d.ts +35 -0
  77. package/dist/esm/anyspend/platform/client.js +153 -0
  78. package/dist/esm/anyspend/platform/errors.d.ts +38 -0
  79. package/dist/esm/anyspend/platform/errors.js +67 -0
  80. package/dist/esm/anyspend/platform/index.d.ts +87 -0
  81. package/dist/esm/anyspend/platform/index.js +75 -0
  82. package/dist/esm/anyspend/platform/resources/analytics.d.ts +7 -0
  83. package/dist/esm/anyspend/platform/resources/analytics.js +8 -0
  84. package/dist/esm/anyspend/platform/resources/checkout-sessions.d.ts +17 -0
  85. package/dist/esm/anyspend/platform/resources/checkout-sessions.js +23 -0
  86. package/dist/esm/anyspend/platform/resources/customers.d.ts +19 -0
  87. package/dist/esm/anyspend/platform/resources/customers.js +30 -0
  88. package/dist/esm/anyspend/platform/resources/discount-codes.d.ts +29 -0
  89. package/dist/esm/anyspend/platform/resources/discount-codes.js +27 -0
  90. package/dist/esm/anyspend/platform/resources/events.d.ts +14 -0
  91. package/dist/esm/anyspend/platform/resources/events.js +12 -0
  92. package/dist/esm/anyspend/platform/resources/notifications.d.ts +18 -0
  93. package/dist/esm/anyspend/platform/resources/notifications.js +23 -0
  94. package/dist/esm/anyspend/platform/resources/organization.d.ts +17 -0
  95. package/dist/esm/anyspend/platform/resources/organization.js +11 -0
  96. package/dist/esm/anyspend/platform/resources/payment-links.d.ts +21 -0
  97. package/dist/esm/anyspend/platform/resources/payment-links.js +45 -0
  98. package/dist/esm/anyspend/platform/resources/products.d.ts +27 -0
  99. package/dist/esm/anyspend/platform/resources/products.js +27 -0
  100. package/dist/esm/anyspend/platform/resources/transactions.d.ts +11 -0
  101. package/dist/esm/anyspend/platform/resources/transactions.js +21 -0
  102. package/dist/esm/anyspend/platform/resources/webhooks.d.ts +14 -0
  103. package/dist/esm/anyspend/platform/resources/webhooks.js +29 -0
  104. package/dist/esm/anyspend/platform/resources/widgets.d.ts +38 -0
  105. package/dist/esm/anyspend/platform/resources/widgets.js +27 -0
  106. package/dist/esm/anyspend/platform/types.d.ts +478 -0
  107. package/dist/esm/anyspend/platform/types.js +4 -0
  108. package/dist/esm/anyspend/platform/utils/idempotency.d.ts +4 -0
  109. package/dist/esm/anyspend/platform/utils/idempotency.js +14 -0
  110. package/dist/esm/anyspend/platform/utils/pagination.d.ts +12 -0
  111. package/dist/esm/anyspend/platform/utils/pagination.js +19 -0
  112. package/dist/esm/anyspend/react/components/AnySpend.d.ts +5 -1
  113. package/dist/esm/anyspend/react/components/AnySpend.js +124 -13
  114. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +12 -6
  115. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +55 -8
  116. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
  117. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +2 -2
  118. package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
  119. package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -2
  120. package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +1 -1
  121. package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +3 -1
  122. package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +48 -18
  123. package/dist/esm/anyspend/react/components/checkout/KycGate.d.ts +11 -0
  124. package/dist/esm/anyspend/react/components/checkout/KycGate.js +167 -0
  125. package/dist/esm/anyspend/react/components/checkout/VariablePricingInput.d.ts +17 -0
  126. package/dist/esm/anyspend/react/components/checkout/VariablePricingInput.js +142 -0
  127. package/dist/esm/anyspend/react/components/index.d.ts +1 -1
  128. package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
  129. package/dist/esm/anyspend/react/hooks/index.js +1 -0
  130. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +13 -0
  131. package/dist/esm/anyspend/react/hooks/useKycStatus.d.ts +47 -0
  132. package/dist/esm/anyspend/react/hooks/useKycStatus.js +117 -0
  133. package/dist/esm/anyspend/services/anyspend.d.ts +3 -1
  134. package/dist/esm/anyspend/services/anyspend.js +2 -1
  135. package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -1
  136. package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +3 -3
  137. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +1 -1
  138. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -5
  139. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
  140. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -1
  141. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +21 -24
  142. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
  143. package/dist/esm/global-account/react/hooks/useAuth.js +2 -2
  144. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +3 -1
  145. package/dist/esm/global-account/react/hooks/useAuthentication.js +82 -24
  146. package/dist/esm/global-account/react/hooks/useGetAllTWSigners.js +2 -1
  147. package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
  148. package/dist/esm/global-account/react/stores/useModalStore.js +2 -0
  149. package/dist/esm/global-account/react/utils/createWagmiConfig.d.ts +18 -0
  150. package/dist/esm/global-account/react/utils/createWagmiConfig.js +16 -0
  151. package/dist/styles/index.css +1 -1
  152. package/dist/types/anyspend/platform/client.d.ts +35 -0
  153. package/dist/types/anyspend/platform/errors.d.ts +38 -0
  154. package/dist/types/anyspend/platform/index.d.ts +87 -0
  155. package/dist/types/anyspend/platform/resources/analytics.d.ts +7 -0
  156. package/dist/types/anyspend/platform/resources/checkout-sessions.d.ts +17 -0
  157. package/dist/types/anyspend/platform/resources/customers.d.ts +19 -0
  158. package/dist/types/anyspend/platform/resources/discount-codes.d.ts +29 -0
  159. package/dist/types/anyspend/platform/resources/events.d.ts +14 -0
  160. package/dist/types/anyspend/platform/resources/notifications.d.ts +18 -0
  161. package/dist/types/anyspend/platform/resources/organization.d.ts +17 -0
  162. package/dist/types/anyspend/platform/resources/payment-links.d.ts +21 -0
  163. package/dist/types/anyspend/platform/resources/products.d.ts +27 -0
  164. package/dist/types/anyspend/platform/resources/transactions.d.ts +11 -0
  165. package/dist/types/anyspend/platform/resources/webhooks.d.ts +14 -0
  166. package/dist/types/anyspend/platform/resources/widgets.d.ts +38 -0
  167. package/dist/types/anyspend/platform/types.d.ts +478 -0
  168. package/dist/types/anyspend/platform/utils/idempotency.d.ts +4 -0
  169. package/dist/types/anyspend/platform/utils/pagination.d.ts +12 -0
  170. package/dist/types/anyspend/react/components/AnySpend.d.ts +5 -1
  171. package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +12 -6
  172. package/dist/types/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
  173. package/dist/types/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
  174. package/dist/types/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +3 -1
  175. package/dist/types/anyspend/react/components/checkout/KycGate.d.ts +11 -0
  176. package/dist/types/anyspend/react/components/checkout/VariablePricingInput.d.ts +17 -0
  177. package/dist/types/anyspend/react/components/index.d.ts +1 -1
  178. package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
  179. package/dist/types/anyspend/react/hooks/useKycStatus.d.ts +47 -0
  180. package/dist/types/anyspend/services/anyspend.d.ts +3 -1
  181. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -1
  182. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +3 -1
  183. package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
  184. package/dist/types/global-account/react/utils/createWagmiConfig.d.ts +18 -0
  185. package/package.json +7 -1
  186. package/src/anyspend/docs/checkout-sessions.md +20 -3
  187. package/src/anyspend/platform/client.ts +198 -0
  188. package/src/anyspend/platform/errors.ts +92 -0
  189. package/src/anyspend/platform/index.ts +129 -0
  190. package/src/anyspend/platform/resources/analytics.ts +10 -0
  191. package/src/anyspend/platform/resources/checkout-sessions.ts +36 -0
  192. package/src/anyspend/platform/resources/customers.ts +54 -0
  193. package/src/anyspend/platform/resources/discount-codes.ts +63 -0
  194. package/src/anyspend/platform/resources/events.ts +22 -0
  195. package/src/anyspend/platform/resources/notifications.ts +37 -0
  196. package/src/anyspend/platform/resources/organization.ts +24 -0
  197. package/src/anyspend/platform/resources/payment-links.ts +74 -0
  198. package/src/anyspend/platform/resources/products.ts +59 -0
  199. package/src/anyspend/platform/resources/transactions.ts +33 -0
  200. package/src/anyspend/platform/resources/webhooks.ts +47 -0
  201. package/src/anyspend/platform/resources/widgets.ts +63 -0
  202. package/src/anyspend/platform/types.ts +532 -0
  203. package/src/anyspend/platform/utils/idempotency.ts +15 -0
  204. package/src/anyspend/platform/utils/pagination.ts +32 -0
  205. package/src/anyspend/react/components/AnySpend.tsx +148 -14
  206. package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +77 -18
  207. package/src/anyspend/react/components/checkout/AnySpendCheckoutTrigger.tsx +4 -0
  208. package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +4 -0
  209. package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +4 -13
  210. package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +81 -17
  211. package/src/anyspend/react/components/checkout/KycGate.tsx +387 -0
  212. package/src/anyspend/react/components/checkout/VariablePricingInput.tsx +247 -0
  213. package/src/anyspend/react/components/index.ts +1 -0
  214. package/src/anyspend/react/hooks/index.ts +1 -0
  215. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +14 -0
  216. package/src/anyspend/react/hooks/useKycStatus.ts +150 -0
  217. package/src/anyspend/services/anyspend.ts +4 -0
  218. package/src/global-account/react/components/B3DynamicModal.tsx +0 -2
  219. package/src/global-account/react/components/ManageAccount/BottomNavigation.tsx +7 -7
  220. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +1 -1
  221. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +13 -5
  222. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +1 -1
  223. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +35 -25
  224. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +1 -1
  225. package/src/global-account/react/hooks/useAuth.ts +2 -2
  226. package/src/global-account/react/hooks/useAuthentication.ts +80 -27
  227. package/src/global-account/react/hooks/useGetAllTWSigners.tsx +2 -1
  228. package/src/global-account/react/stores/useModalStore.ts +6 -0
  229. package/src/global-account/react/utils/createWagmiConfig.tsx +18 -0
@@ -37,6 +37,8 @@ const FiatPaymentMethod_1 = require("./common/FiatPaymentMethod");
37
37
  const GasIndicator_1 = require("./common/GasIndicator");
38
38
  const OrderDetails_1 = require("./common/OrderDetails");
39
39
  const OrderHistory_1 = require("./common/OrderHistory");
40
+ const KycGate_1 = require("./checkout/KycGate");
41
+ const LoginStep_1 = require("../../../global-account/react/components/SignInWithB3/steps/LoginStep");
40
42
  const PanelOnramp_1 = require("./common/PanelOnramp");
41
43
  const PanelOnrampPayment_1 = require("./common/PanelOnrampPayment");
42
44
  const PointsDetailPanel_1 = require("./common/PointsDetailPanel");
@@ -57,19 +59,28 @@ var PanelView;
57
59
  PanelView[PanelView["POINTS_DETAIL"] = 8] = "POINTS_DETAIL";
58
60
  PanelView[PanelView["FEE_DETAIL"] = 9] = "FEE_DETAIL";
59
61
  PanelView[PanelView["DIRECT_TRANSFER_SUCCESS"] = 10] = "DIRECT_TRANSFER_SUCCESS";
62
+ PanelView[PanelView["FIAT_KYC"] = 11] = "FIAT_KYC";
63
+ PanelView[PanelView["FIAT_AUTH"] = 12] = "FIAT_AUTH";
60
64
  })(PanelView || (exports.PanelView = PanelView = {}));
61
65
  const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
62
66
  function AnySpend(props) {
63
67
  const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
64
68
  return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendCustomizationContext_1.AnySpendCustomizationProvider, { slots: props.slots, content: props.content, theme: props.theme, children: (0, jsx_runtime_1.jsx)(AnySpendInner, { ...props }) }) }));
65
69
  }
66
- function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, }) {
70
+ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, kycEnabled = false, }) {
67
71
  const { slots, content } = (0, AnySpendCustomizationContext_1.useAnySpendCustomization)();
68
72
  const searchParams = (0, react_2.useSearchParamsSSR)();
69
73
  const router = (0, react_2.useRouter)();
70
74
  const { partnerId } = (0, react_2.useB3Config)();
71
75
  const setB3ModalContentType = (0, react_2.useModalStore)(state => state.setB3ModalContentType);
72
76
  const setB3ModalOpen = (0, react_2.useModalStore)(state => state.setB3ModalOpen);
77
+ const { isAuthenticated } = (0, react_2.useAuth)();
78
+ // KYC approval is tracked per-session so we only prompt the wallet
79
+ // signature when the user actually clicks Buy, not on panel mount.
80
+ // useRef so handleFiatOrder can read the updated value synchronously
81
+ // in the same frame that onStatusResolved sets it (setState is async).
82
+ // When kycEnabled is false (default), pre-approve so the KYC gate is skipped.
83
+ const kycApprovedRef = (0, react_4.useRef)(!kycEnabled);
73
84
  // Determine if we're in "buy mode" based on whether destination token props are provided
74
85
  const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
75
86
  // Add refs to track URL state
@@ -79,7 +90,17 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
79
90
  const animationDirection = (0, react_4.useRef)(null);
80
91
  // Track previous panel for proper back navigation
81
92
  const previousPanel = (0, react_4.useRef)(PanelView.MAIN);
82
- const [activeTab, setActiveTab] = (0, react_4.useState)(defaultActiveTab);
93
+ const [activeTab, setActiveTab] = (0, react_4.useState)(() => {
94
+ if (typeof window !== "undefined") {
95
+ const stored = sessionStorage.getItem("anyspend_active_tab");
96
+ if (stored === "crypto" || stored === "fiat")
97
+ return stored;
98
+ }
99
+ return defaultActiveTab;
100
+ });
101
+ (0, react_4.useEffect)(() => {
102
+ sessionStorage.setItem("anyspend_active_tab", activeTab);
103
+ }, [activeTab]);
83
104
  const [orderId, setOrderId] = (0, react_4.useState)(loadOrder);
84
105
  const [directTransferTxHash, setDirectTransferTxHash] = (0, react_4.useState)();
85
106
  const { orderAndTransactions: oat, getOrderAndTransactionsError } = (0, react_1.useAnyspendOrderAndTransactions)(orderId);
@@ -100,9 +121,19 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
100
121
  const [customRecipients, setCustomRecipients] = (0, react_4.useState)([]);
101
122
  // Payment method state with dual-state system (auto + explicit user selection)
102
123
  const { cryptoPaymentMethod, setCryptoPaymentMethod, selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod, effectiveCryptoPaymentMethod, resetPaymentMethods, } = (0, useCryptoPaymentMethodState_1.useCryptoPaymentMethodState)();
103
- const [selectedFiatPaymentMethod, setSelectedFiatPaymentMethod] = (0, react_4.useState)(FiatPaymentMethod_1.FiatPaymentMethod.NONE);
124
+ const [selectedFiatPaymentMethod, setSelectedFiatPaymentMethod] = (0, react_4.useState)(() => {
125
+ if (typeof window !== "undefined") {
126
+ const stored = sessionStorage.getItem("anyspend_fiat_method");
127
+ if (stored && Object.values(FiatPaymentMethod_1.FiatPaymentMethod).includes(stored))
128
+ return stored;
129
+ }
130
+ return FiatPaymentMethod_1.FiatPaymentMethod.NONE;
131
+ });
104
132
  // const [newRecipientAddress, setNewRecipientAddress] = useState("");
105
133
  // const recipientInputRef = useRef<HTMLInputElement>(null);
134
+ (0, react_4.useEffect)(() => {
135
+ sessionStorage.setItem("anyspend_fiat_method", selectedFiatPaymentMethod);
136
+ }, [selectedFiatPaymentMethod]);
106
137
  // Get initial chain IDs from URL or defaults
107
138
  const initialSrcChainId = sourceChainId || parseInt(searchParams.get("fromChainId") || "0") || chains_1.mainnet.id;
108
139
  const initialDstChainId = parseInt(searchParams.get("toChainId") || "0") || (isBuyMode ? destinationTokenChainId : chains_1.base.id);
@@ -119,10 +150,27 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
119
150
  const [selectedSrcToken, setSelectedSrcToken] = (0, react_4.useState)(effectiveSrcToken);
120
151
  const { data: srcTokenMetadata } = (0, react_2.useTokenData)(selectedSrcToken?.chainId, selectedSrcToken?.address);
121
152
  const [srcAmount, setSrcAmount] = (0, react_4.useState)(searchParams.get("fromAmount") || "0");
122
- // State for onramp amount
123
- const [srcAmountOnRamp, setSrcAmountOnRamp] = (0, react_4.useState)(searchParams.get("fromAmount") || "5");
124
- // State for destination chain/token selection
125
- const [selectedDstChainId, setSelectedDstChainId] = (0, react_4.useState)(initialDstChainId);
153
+ // State for onramp amount — persisted in sessionStorage so it survives Persona KYC roundtrip
154
+ const [srcAmountOnRamp, setSrcAmountOnRamp] = (0, react_4.useState)(() => {
155
+ if (typeof window !== "undefined") {
156
+ const stored = sessionStorage.getItem("anyspend_fiat_amount");
157
+ if (stored)
158
+ return stored;
159
+ }
160
+ return searchParams.get("fromAmount") || "5";
161
+ });
162
+ (0, react_4.useEffect)(() => {
163
+ sessionStorage.setItem("anyspend_fiat_amount", srcAmountOnRamp);
164
+ }, [srcAmountOnRamp]);
165
+ // State for destination chain/token selection (sync effects come after state declarations below) — persisted in sessionStorage for Persona KYC roundtrip
166
+ const [selectedDstChainId, setSelectedDstChainId] = (0, react_4.useState)(() => {
167
+ if (!isBuyMode && typeof window !== "undefined") {
168
+ const stored = sessionStorage.getItem("anyspend_dst_chain_id");
169
+ if (stored)
170
+ return parseInt(stored, 10);
171
+ }
172
+ return initialDstChainId;
173
+ });
126
174
  // Helper to check if address is Hyperliquid USDC (supports both 34-char and 42-char formats)
127
175
  const isHyperliquidUSDCAddress = (address) => (0, anyspend_1.eqci)(address, anyspend_1.HYPERLIQUID_USDC_ADDRESS) || (0, anyspend_1.eqci)(address, anyspend_1.ZERO_ADDRESS);
128
176
  const defaultDstToken = isBuyMode
@@ -142,9 +190,29 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
142
190
  defaultToken: defaultDstToken,
143
191
  prefix: "to",
144
192
  });
145
- const [selectedDstToken, setSelectedDstToken] = (0, react_4.useState)(isBuyMode ? defaultDstToken : dstTokenFromUrl);
193
+ const [selectedDstToken, setSelectedDstToken] = (0, react_4.useState)(() => {
194
+ if (!isBuyMode && typeof window !== "undefined") {
195
+ const stored = sessionStorage.getItem("anyspend_dst_token");
196
+ if (stored) {
197
+ try {
198
+ return JSON.parse(stored);
199
+ }
200
+ catch { }
201
+ }
202
+ }
203
+ return isBuyMode ? defaultDstToken : dstTokenFromUrl;
204
+ });
146
205
  const { data: dstTokenMetadata } = (0, react_2.useTokenData)(selectedDstToken?.chainId, selectedDstToken?.address);
147
206
  const [dstAmount, setDstAmount] = (0, react_4.useState)(searchParams.get("toAmount") || "");
207
+ // Sync dst chain/token to sessionStorage so they survive Persona KYC roundtrip
208
+ (0, react_4.useEffect)(() => {
209
+ if (!isBuyMode)
210
+ sessionStorage.setItem("anyspend_dst_chain_id", selectedDstChainId.toString());
211
+ }, [selectedDstChainId, isBuyMode]);
212
+ (0, react_4.useEffect)(() => {
213
+ if (!isBuyMode)
214
+ sessionStorage.setItem("anyspend_dst_token", JSON.stringify(selectedDstToken));
215
+ }, [selectedDstToken, isBuyMode]);
148
216
  const [isSrcInputDirty, setIsSrcInputDirty] = (0, react_4.useState)(true);
149
217
  // Add refs to track if we've applied metadata
150
218
  const appliedSrcMetadataRef = (0, react_4.useRef)(false);
@@ -497,6 +565,16 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
497
565
  }, [anyspendQuote, isSrcInputDirty, destinationTokenAmount]);
498
566
  // Call onSuccess when order is executed
499
567
  (0, useOnOrderSuccess_1.useOnOrderSuccess)({ orderData: oat, orderId, onSuccess });
568
+ // Clear all persisted selection state once an order is submitted — next open starts fresh
569
+ (0, react_4.useEffect)(() => {
570
+ if (orderId) {
571
+ sessionStorage.removeItem("anyspend_fiat_amount");
572
+ sessionStorage.removeItem("anyspend_active_tab");
573
+ sessionStorage.removeItem("anyspend_fiat_method");
574
+ sessionStorage.removeItem("anyspend_dst_chain_id");
575
+ sessionStorage.removeItem("anyspend_dst_token");
576
+ }
577
+ }, [orderId]);
500
578
  const { createOrder, isCreatingOrder } = (0, react_1.useAnyspendCreateOrder)({
501
579
  onSuccess: data => {
502
580
  const orderId = data.data.id;
@@ -577,8 +655,8 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
577
655
  if (selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.NONE) {
578
656
  return { text: "Select payment method", disable: false, error: false, loading: false };
579
657
  }
580
- // If payment method is selected, show "Buy"
581
- return { text: "Buy", disable: false, error: false, loading: false };
658
+ // If payment method is selected, show "Continue"
659
+ return { text: "Continue", disable: false, error: false, loading: false };
582
660
  }
583
661
  if (activeTab === "crypto") {
584
662
  // For crypto: check payment method first, then recipient
@@ -599,7 +677,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
599
677
  return { text: "Continue to payment", disable: false, error: false, loading: false };
600
678
  }
601
679
  }
602
- return { text: "Buy", disable: false, error: false, loading: false };
680
+ return { text: "Continue", disable: false, error: false, loading: false };
603
681
  }, [
604
682
  activeInputAmountInWei,
605
683
  isSameChainSameToken,
@@ -761,7 +839,20 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
761
839
  paymentMethodString = "";
762
840
  }
763
841
  else if (paymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE_WEB2) {
764
- // Stripe embedded payment form
842
+ // Stripe embedded payment form requires authentication + KYC
843
+ // Read from store directly to avoid stale closure when called from onLoginSuccess callback
844
+ const currentlyAuthenticated = react_2.useAuthStore.getState().isAuthenticated;
845
+ if (!currentlyAuthenticated) {
846
+ navigateToPanel(PanelView.FIAT_AUTH, "forward");
847
+ return;
848
+ }
849
+ if (!kycApprovedRef.current) {
850
+ // Navigate to KYC gate. KycGate shows an explicit "Continue to Verify"
851
+ // CTA and pre-signs from that user-gesture context before enabling
852
+ // the useKycStatus query — so no surprise signature popup here.
853
+ navigateToPanel(PanelView.FIAT_KYC, "forward");
854
+ return;
855
+ }
765
856
  if (!stripeWeb2Support.isSupport) {
766
857
  react_2.toast.error("Pay with Card not available");
767
858
  return;
@@ -870,6 +961,14 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
870
961
  window.removeEventListener("popstate", handlePopState);
871
962
  };
872
963
  }, [activePanel, navigateBack]);
964
+ // When auth completes while on the FIAT_AUTH panel, navigate back and retry the order
965
+ (0, react_4.useEffect)(() => {
966
+ if (isAuthenticated && activePanel === PanelView.FIAT_AUTH) {
967
+ navigateBack();
968
+ handleFiatOrder(selectedFiatPaymentMethod);
969
+ }
970
+ // eslint-disable-next-line react-hooks/exhaustive-deps
971
+ }, [isAuthenticated]);
873
972
  const historyView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto flex w-[560px] max-w-full flex-col items-center", children: (0, jsx_runtime_1.jsx)(OrderHistory_1.OrderHistory, { mode: mode, onBack: navigateBack, onSelectOrder: onSelectOrder }) }));
874
973
  const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full p-5", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onPaymentMethodChange: method => {
875
974
  // When user explicitly changes payment method, set it as selected
@@ -1004,6 +1103,16 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
1004
1103
  setDirectTransferTxHash(undefined);
1005
1104
  setB3ModalOpen(false);
1006
1105
  }, className: "bg-as-brand hover:bg-as-brand/90 w-full text-white", children: resolvedReturnLabel || "Done" })) })] }));
1106
+ const kycView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto flex w-full max-w-[460px] flex-col gap-4 px-5 pt-5", children: (0, jsx_runtime_1.jsx)(KycGate_1.KycGate, { enabled: activePanel === PanelView.FIAT_KYC, onStatusResolved: approved => {
1107
+ if (approved) {
1108
+ kycApprovedRef.current = true;
1109
+ navigateBack();
1110
+ handleFiatOrder(selectedFiatPaymentMethod);
1111
+ }
1112
+ } }) }));
1113
+ const authView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-full max-w-[460px]", children: (0, jsx_runtime_1.jsx)(LoginStep_1.LoginStep, { chain: baseChain, onSuccess: async () => {
1114
+ // isAuthenticated will be true at this point — the useEffect below handles navigation
1115
+ } }) }));
1007
1116
  // Add tabs to the main component when no order is loaded
1008
1117
  return ((0, jsx_runtime_1.jsx)(react_2.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className: classes?.container ||
1009
1118
  (0, cn_1.cn)("anyspend-container font-inter mx-auto w-full max-w-[460px]", mode === "page" &&
@@ -1037,5 +1146,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
1037
1146
  (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: pointsDetailView }, "points-detail-view"),
1038
1147
  (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: feeDetailView }, "fee-detail-view"),
1039
1148
  (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: directTransferSuccessView }, "direct-transfer-success-view"),
1149
+ (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: kycView }, "fiat-kyc-view"),
1150
+ (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: authView }, "fiat-auth-view"),
1040
1151
  ] }) }) }));
1041
1152
  }
@@ -1,10 +1,12 @@
1
1
  import { type ReactNode } from "react";
2
- import { type PaymentMethod } from "./CheckoutPaymentPanel";
3
- export type { AnySpendCheckoutClasses } from "../types/classes";
2
+ import type { AddressData, CheckoutFormComponentProps, CheckoutFormSchema, DiscountResult, ShippingOption } from "../../../types/forms";
4
3
  import type { AnySpendCheckoutClasses } from "../types/classes";
5
4
  import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "../types/customization";
6
- import type { CheckoutFormSchema, CheckoutFormComponentProps, ShippingOption, DiscountResult, AddressData } from "../../../types/forms";
7
- export type { CheckoutFormSchema, CheckoutFormComponentProps, ShippingOption, DiscountResult, AddressData };
5
+ import { type PaymentMethod } from "./CheckoutPaymentPanel";
6
+ import { type VariablePricingConfig } from "./VariablePricingInput";
7
+ export type { AnySpendCheckoutClasses } from "../types/classes";
8
+ export type { VariablePricingConfig } from "./VariablePricingInput";
9
+ export type { AddressData, CheckoutFormComponentProps, CheckoutFormSchema, DiscountResult, ShippingOption };
8
10
  export interface CheckoutItem {
9
11
  id?: string;
10
12
  name: string;
@@ -33,7 +35,7 @@ export interface AnySpendCheckoutProps {
33
35
  destinationTokenAddress: string;
34
36
  /** The destination chain ID */
35
37
  destinationTokenChainId: number;
36
- /** Line items */
38
+ /** Line items. When `variablePricing.enabled` is true, pass a single placeholder item (e.g. amount "0") — the user-entered amount overrides the total. */
37
39
  items: CheckoutItem[];
38
40
  /** Override computed total */
39
41
  totalAmount?: string;
@@ -113,7 +115,11 @@ export interface AnySpendCheckoutProps {
113
115
  onDiscountApplied?: (result: DiscountResult) => void;
114
116
  /** Async function to validate a discount code. Returns DiscountResult. */
115
117
  validateDiscount?: (code: string) => Promise<DiscountResult>;
118
+ /** Variable pricing / name your price config. When enabled, user enters amount before payment. */
119
+ variablePricing?: VariablePricingConfig;
116
120
  /** When true, fees are added on top of the amount (payer pays more, receiver gets exact amount) */
117
121
  feeOnTop?: boolean;
122
+ /** When true, identity verification (KYC) is required before card payment. Defaults to false. */
123
+ kycEnabled?: boolean;
118
124
  }
119
- export declare function AnySpendCheckout({ mode, recipientAddress, destinationTokenAddress, destinationTokenChainId, items, totalAmount: totalAmountOverride, organizationName, organizationLogo, themeColor, buttonText, checkoutSessionId, onSuccess, onError, returnUrl, returnLabel, classes, footer, defaultPaymentMethod, senderAddress, slots, content, theme, showPoints, showOrderId, shipping: shippingProp, tax, discount: discountProp, summaryLines, formSchema, formComponent, onFormSubmit, shippingOptions, collectShippingAddress, onShippingChange: onShippingChangeProp, enableDiscountCode, onDiscountApplied: onDiscountAppliedProp, validateDiscount, feeOnTop, }: AnySpendCheckoutProps): import("react/jsx-runtime").JSX.Element;
125
+ export declare function AnySpendCheckout({ mode, recipientAddress, destinationTokenAddress, destinationTokenChainId, items, totalAmount: totalAmountOverride, organizationName, organizationLogo, themeColor, buttonText, checkoutSessionId, onSuccess, onError, returnUrl, returnLabel, classes, footer, defaultPaymentMethod, senderAddress, slots, content, theme, showPoints, showOrderId, shipping: shippingProp, tax, discount: discountProp, summaryLines, formSchema, formComponent, onFormSubmit, shippingOptions, collectShippingAddress, onShippingChange: onShippingChangeProp, enableDiscountCode, onDiscountApplied: onDiscountAppliedProp, validateDiscount, variablePricing, feeOnTop, kycEnabled, }: AnySpendCheckoutProps): import("react/jsx-runtime").JSX.Element;
@@ -3,17 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.AnySpendCheckout = AnySpendCheckout;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("../../../../global-account/react");
7
6
  const constants_1 = require("../../../../anyspend/constants");
7
+ const react_1 = require("../../../../global-account/react");
8
8
  const number_1 = require("../../../../shared/utils/number");
9
9
  const react_2 = require("react");
10
10
  const useAnyspendQuote_1 = require("../../hooks/useAnyspendQuote");
11
11
  const AnySpendFingerprintWrapper_1 = require("../AnySpendFingerprintWrapper");
12
+ const AnySpendCustomizationContext_1 = require("../context/AnySpendCustomizationContext");
12
13
  const CheckoutCartPanel_1 = require("./CheckoutCartPanel");
13
14
  const CheckoutFormPanel_1 = require("./CheckoutFormPanel");
14
15
  const CheckoutLayout_1 = require("./CheckoutLayout");
15
16
  const CheckoutPaymentPanel_1 = require("./CheckoutPaymentPanel");
16
- const AnySpendCustomizationContext_1 = require("../context/AnySpendCustomizationContext");
17
+ const VariablePricingInput_1 = require("./VariablePricingInput");
17
18
  const emptyAddress = { street: "", city: "", state: "", zip: "", country: "" };
18
19
  function AnySpendCheckout({ mode = "page", recipientAddress, destinationTokenAddress, destinationTokenChainId, items, totalAmount: totalAmountOverride, organizationName, organizationLogo, themeColor, buttonText = "Pay", checkoutSessionId, onSuccess, onError, returnUrl, returnLabel, classes, footer, defaultPaymentMethod, senderAddress, slots, content, theme, showPoints, showOrderId, shipping: shippingProp, tax, discount: discountProp, summaryLines,
19
20
  // New form props
@@ -21,7 +22,13 @@ formSchema, formComponent, onFormSubmit,
21
22
  // New shipping props
22
23
  shippingOptions, collectShippingAddress, onShippingChange: onShippingChangeProp,
23
24
  // New discount props
24
- enableDiscountCode, onDiscountApplied: onDiscountAppliedProp, validateDiscount, feeOnTop, }) {
25
+ enableDiscountCode, onDiscountApplied: onDiscountAppliedProp, validateDiscount,
26
+ // Variable pricing
27
+ variablePricing, feeOnTop, kycEnabled = false, }) {
28
+ // ===== Variable pricing state =====
29
+ const [variablePricingAmount, setVariablePricingAmount] = (0, react_2.useState)("0");
30
+ const isVariablePricingActive = variablePricing?.enabled === true;
31
+ const isVariablePricingValid = isVariablePricingActive ? variablePricingAmount !== "0" : true;
25
32
  // ===== Form state =====
26
33
  const [formData, setFormData] = (0, react_2.useState)({});
27
34
  const [selectedShipping, setSelectedShipping] = (0, react_2.useState)(null);
@@ -66,7 +73,25 @@ enableDiscountCode, onDiscountApplied: onDiscountAppliedProp, validateDiscount,
66
73
  return undefined;
67
74
  }, [appliedDiscount, discountProp]);
68
75
  // Compute total from items + adjustments (including dynamic shipping/discount)
76
+ // Variable pricing overrides the total when active
69
77
  const computedTotal = (0, react_2.useMemo)(() => {
78
+ if (isVariablePricingActive && variablePricingAmount !== "0") {
79
+ let total = (0, number_1.safeBigInt)(variablePricingAmount);
80
+ if (effectiveShipping?.amount)
81
+ total += (0, number_1.safeBigInt)(effectiveShipping.amount);
82
+ const taxAmt = typeof tax === "string" ? tax : tax?.amount;
83
+ if (taxAmt)
84
+ total += (0, number_1.safeBigInt)(taxAmt);
85
+ if (effectiveDiscount?.amount)
86
+ total -= (0, number_1.safeBigInt)(effectiveDiscount.amount);
87
+ if (summaryLines) {
88
+ for (const line of summaryLines)
89
+ total += (0, number_1.safeBigInt)(line.amount);
90
+ }
91
+ if (total < BigInt(0))
92
+ total = BigInt(0);
93
+ return total.toString();
94
+ }
70
95
  if (totalAmountOverride)
71
96
  return totalAmountOverride;
72
97
  let total = BigInt(0);
@@ -87,7 +112,16 @@ enableDiscountCode, onDiscountApplied: onDiscountAppliedProp, validateDiscount,
87
112
  if (total < BigInt(0))
88
113
  total = BigInt(0);
89
114
  return total.toString();
90
- }, [items, totalAmountOverride, effectiveShipping, tax, effectiveDiscount, summaryLines]);
115
+ }, [
116
+ items,
117
+ totalAmountOverride,
118
+ effectiveShipping,
119
+ tax,
120
+ effectiveDiscount,
121
+ summaryLines,
122
+ isVariablePricingActive,
123
+ variablePricingAmount,
124
+ ]);
91
125
  // Get destination token metadata
92
126
  const { data: tokenData } = (0, react_1.useTokenData)(destinationTokenChainId, destinationTokenAddress);
93
127
  const tokenSymbol = tokenData?.symbol || "";
@@ -139,14 +173,27 @@ enableDiscountCode, onDiscountApplied: onDiscountAppliedProp, validateDiscount,
139
173
  meta.customerName = formData.name;
140
174
  if (checkoutSessionId)
141
175
  meta.checkoutSessionId = checkoutSessionId;
176
+ if (isVariablePricingActive && variablePricingAmount !== "0") {
177
+ meta.variablePricingAmount = variablePricingAmount;
178
+ }
142
179
  return Object.keys(meta).length > 0 ? meta : undefined;
143
- }, [formData, selectedShipping, shippingAddress, appliedDiscount, checkoutSessionId]);
144
- // Check if required form fields are filled
180
+ }, [
181
+ formData,
182
+ selectedShipping,
183
+ shippingAddress,
184
+ appliedDiscount,
185
+ checkoutSessionId,
186
+ isVariablePricingActive,
187
+ variablePricingAmount,
188
+ ]);
189
+ // Check if required form fields are filled and variable pricing is valid
145
190
  const isFormValid = (0, react_2.useMemo)(() => {
191
+ if (!isVariablePricingValid)
192
+ return false;
146
193
  if (!formSchema)
147
194
  return true;
148
195
  return formSchema.fields.filter(f => f.required).every(f => formData[f.id] != null && formData[f.id] !== "");
149
- }, [formSchema, formData]);
196
+ }, [formSchema, formData, isVariablePricingValid]);
150
197
  // Check if we have a form panel to show
151
198
  const hasFormContent = (formSchema && formSchema.fields.length > 0) ||
152
199
  formComponent ||
@@ -154,5 +201,5 @@ enableDiscountCode, onDiscountApplied: onDiscountAppliedProp, validateDiscount,
154
201
  (shippingOptions && shippingOptions.length > 0) ||
155
202
  collectShippingAddress ||
156
203
  enableDiscountCode;
157
- return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprint, children: (0, jsx_runtime_1.jsx)(AnySpendCustomizationContext_1.AnySpendCustomizationProvider, { slots: slots, content: content, theme: theme, children: (0, jsx_runtime_1.jsx)(CheckoutLayout_1.CheckoutLayout, { mode: mode, paymentPanel: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [hasFormContent && ((0, jsx_runtime_1.jsxs)("div", { className: "mb-6", children: [(0, jsx_runtime_1.jsx)(CheckoutFormPanel_1.CheckoutFormPanel, { formSchema: formSchema, formComponent: formComponent, shippingOptions: shippingOptions, collectShippingAddress: collectShippingAddress, enableDiscountCode: enableDiscountCode, validateDiscount: validateDiscount, tokenSymbol: tokenSymbol, tokenDecimals: tokenDecimals, classes: classes, formData: formData, onFormDataChange: handleFormDataChange, selectedShipping: selectedShipping, onShippingChange: handleShippingChange, appliedDiscount: appliedDiscount, onDiscountApplied: handleDiscountApplied, onDiscountRemoved: handleDiscountRemoved, shippingAddress: shippingAddress, onShippingAddressChange: setShippingAddress, checkoutFormSlot: slots?.checkoutForm }), (0, jsx_runtime_1.jsx)("div", { className: "mt-6 border-t border-gray-200 dark:border-neutral-700" })] })), (0, jsx_runtime_1.jsx)(CheckoutPaymentPanel_1.CheckoutPaymentPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: computedTotal, buttonText: buttonText, themeColor: themeColor, returnUrl: returnUrl, returnLabel: returnLabel, onSuccess: onSuccess, onError: onError, classes: classes, defaultPaymentMethod: defaultPaymentMethod, senderAddress: senderAddress, showPoints: showPoints, showOrderId: showOrderId, callbackMetadata: checkoutFormMetadata, isFormValid: isFormValid, feeOnTop: feeOnTop })] }), cartPanel: (0, jsx_runtime_1.jsx)(CheckoutCartPanel_1.CheckoutCartPanel, { items: items, totalAmount: computedTotal, tokenSymbol: tokenSymbol, tokenDecimals: tokenDecimals, organizationName: organizationName, organizationLogo: organizationLogo, classes: classes, footer: footer, shipping: effectiveShipping, tax: typeof tax === "string" ? { amount: tax } : tax, discount: effectiveDiscount, summaryLines: summaryLines, usdEquivalent: usdEquivalent }), classes: classes }) }) }));
204
+ return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprint, children: (0, jsx_runtime_1.jsx)(AnySpendCustomizationContext_1.AnySpendCustomizationProvider, { slots: slots, content: content, theme: theme, children: (0, jsx_runtime_1.jsx)(CheckoutLayout_1.CheckoutLayout, { mode: mode, paymentPanel: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isVariablePricingActive && tokenData && variablePricing && ((0, jsx_runtime_1.jsx)(VariablePricingInput_1.VariablePricingInput, { config: variablePricing, tokenDecimals: tokenDecimals, tokenSymbol: tokenSymbol, themeColor: themeColor, onChange: setVariablePricingAmount })), hasFormContent && ((0, jsx_runtime_1.jsxs)("div", { className: "mb-6", children: [(0, jsx_runtime_1.jsx)(CheckoutFormPanel_1.CheckoutFormPanel, { formSchema: formSchema, formComponent: formComponent, shippingOptions: shippingOptions, collectShippingAddress: collectShippingAddress, enableDiscountCode: enableDiscountCode, validateDiscount: validateDiscount, tokenSymbol: tokenSymbol, tokenDecimals: tokenDecimals, classes: classes, formData: formData, onFormDataChange: handleFormDataChange, selectedShipping: selectedShipping, onShippingChange: handleShippingChange, appliedDiscount: appliedDiscount, onDiscountApplied: handleDiscountApplied, onDiscountRemoved: handleDiscountRemoved, shippingAddress: shippingAddress, onShippingAddressChange: setShippingAddress, checkoutFormSlot: slots?.checkoutForm }), (0, jsx_runtime_1.jsx)("div", { className: "mt-6 border-t border-gray-200 dark:border-neutral-700" })] })), (0, jsx_runtime_1.jsx)(CheckoutPaymentPanel_1.CheckoutPaymentPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: computedTotal, buttonText: buttonText, themeColor: themeColor, returnUrl: returnUrl, returnLabel: returnLabel, onSuccess: onSuccess, onError: onError, classes: classes, defaultPaymentMethod: defaultPaymentMethod, senderAddress: senderAddress, showPoints: showPoints, showOrderId: showOrderId, callbackMetadata: checkoutFormMetadata, isFormValid: isFormValid, feeOnTop: feeOnTop, kycEnabled: kycEnabled })] }), cartPanel: (0, jsx_runtime_1.jsx)(CheckoutCartPanel_1.CheckoutCartPanel, { items: items, totalAmount: computedTotal, tokenSymbol: tokenSymbol, tokenDecimals: tokenDecimals, organizationName: organizationName, organizationLogo: organizationLogo, classes: classes, footer: footer, shipping: effectiveShipping, tax: typeof tax === "string" ? { amount: tax } : tax, discount: effectiveDiscount, summaryLines: summaryLines, usdEquivalent: usdEquivalent }), classes: classes }) }) }));
158
205
  }
@@ -77,5 +77,7 @@ export interface AnySpendCheckoutTriggerProps {
77
77
  };
78
78
  /** Additional summary line items (fees, tips, etc.) */
79
79
  summaryLines?: CheckoutSummaryLine[];
80
+ /** When true, identity verification (KYC) is required before card payment. Defaults to false. */
81
+ kycEnabled?: boolean;
80
82
  }
81
- export declare function AnySpendCheckoutTrigger({ recipientAddress, destinationTokenAddress, destinationTokenChainId, items, totalAmount: totalAmountOverride, organizationName, organizationLogo, themeColor, buttonText, workflowId, orgId, callbackMetadata, onSuccess, onError, returnUrl, returnLabel, classes, footer, defaultPaymentMethod, senderAddress, slots, content, theme, shipping, tax, discount, summaryLines, }: AnySpendCheckoutTriggerProps): import("react/jsx-runtime").JSX.Element;
83
+ export declare function AnySpendCheckoutTrigger({ recipientAddress, destinationTokenAddress, destinationTokenChainId, items, totalAmount: totalAmountOverride, organizationName, organizationLogo, themeColor, buttonText, workflowId, orgId, callbackMetadata, onSuccess, onError, returnUrl, returnLabel, classes, footer, defaultPaymentMethod, senderAddress, slots, content, theme, shipping, tax, discount, summaryLines, kycEnabled, }: AnySpendCheckoutTriggerProps): import("react/jsx-runtime").JSX.Element;
@@ -12,7 +12,7 @@ const AnySpendCustomizationContext_1 = require("../context/AnySpendCustomization
12
12
  const CheckoutCartPanel_1 = require("./CheckoutCartPanel");
13
13
  const CheckoutPaymentPanel_1 = require("./CheckoutPaymentPanel");
14
14
  const PoweredByBranding_1 = require("./PoweredByBranding");
15
- function AnySpendCheckoutTrigger({ recipientAddress, destinationTokenAddress, destinationTokenChainId, items, totalAmount: totalAmountOverride, organizationName, organizationLogo, themeColor, buttonText = "Pay", workflowId, orgId, callbackMetadata, onSuccess, onError, returnUrl, returnLabel, classes, footer, defaultPaymentMethod, senderAddress, slots, content, theme, shipping, tax, discount, summaryLines, }) {
15
+ function AnySpendCheckoutTrigger({ recipientAddress, destinationTokenAddress, destinationTokenChainId, items, totalAmount: totalAmountOverride, organizationName, organizationLogo, themeColor, buttonText = "Pay", workflowId, orgId, callbackMetadata, onSuccess, onError, returnUrl, returnLabel, classes, footer, defaultPaymentMethod, senderAddress, slots, content, theme, shipping, tax, discount, summaryLines, kycEnabled = false, }) {
16
16
  // Merge workflowId + orgId into callbackMetadata
17
17
  const mergedMetadata = (0, react_2.useMemo)(() => {
18
18
  if (!workflowId && !orgId && !callbackMetadata)
@@ -57,5 +57,5 @@ function AnySpendCheckoutTrigger({ recipientAddress, destinationTokenAddress, de
57
57
  const formattedTotal = (0, react_2.useMemo)(() => (0, number_1.formatTokenAmount)(BigInt(computedTotal || "0"), tokenDecimals), [computedTotal, tokenDecimals]);
58
58
  const hasItems = items && items.length > 0;
59
59
  const fingerprint = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
60
- return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprint, children: (0, jsx_runtime_1.jsx)(AnySpendCustomizationContext_1.AnySpendCustomizationProvider, { slots: slots, content: content, theme: theme, children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-checkout-trigger flex flex-col", children: [hasItems && ((0, jsx_runtime_1.jsx)("div", { className: "border-b border-gray-200 p-5 dark:border-neutral-700", children: (0, jsx_runtime_1.jsx)(CheckoutCartPanel_1.CheckoutCartPanel, { items: items, totalAmount: computedTotal, tokenSymbol: tokenSymbol, tokenDecimals: tokenDecimals, organizationName: organizationName, organizationLogo: organizationLogo, classes: classes, footer: footer, shipping: typeof shipping === "string" ? { amount: shipping } : shipping, tax: typeof tax === "string" ? { amount: tax } : tax, discount: typeof discount === "string" ? { amount: discount } : discount, summaryLines: summaryLines }) })), !hasItems && ((0, jsx_runtime_1.jsx)("div", { className: "border-b border-gray-200 p-5 dark:border-neutral-700", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("flex items-center justify-between", classes?.cartSummary), children: [(0, jsx_runtime_1.jsx)("span", { className: "text-base font-semibold text-gray-900 dark:text-gray-100", children: "Total" }), (0, jsx_runtime_1.jsxs)("span", { className: (0, cn_1.cn)("text-base font-semibold text-gray-900 dark:text-gray-100", classes?.cartTotal), children: [formattedTotal, " ", tokenSymbol] })] }), footer === undefined ? ((0, jsx_runtime_1.jsx)(PoweredByBranding_1.PoweredByBranding, { organizationName: organizationName, organizationLogo: organizationLogo, classes: classes })) : (footer)] }) })), (0, jsx_runtime_1.jsx)("div", { className: "px-2 py-3", children: (0, jsx_runtime_1.jsx)(CheckoutPaymentPanel_1.CheckoutPaymentPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: computedTotal, buttonText: buttonText, themeColor: themeColor, returnUrl: returnUrl, returnLabel: returnLabel, onSuccess: onSuccess, onError: onError, callbackMetadata: mergedMetadata, classes: classes, defaultPaymentMethod: defaultPaymentMethod, senderAddress: senderAddress }) })] }) }) }));
60
+ return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprint, children: (0, jsx_runtime_1.jsx)(AnySpendCustomizationContext_1.AnySpendCustomizationProvider, { slots: slots, content: content, theme: theme, children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-checkout-trigger flex flex-col", children: [hasItems && ((0, jsx_runtime_1.jsx)("div", { className: "border-b border-gray-200 p-5 dark:border-neutral-700", children: (0, jsx_runtime_1.jsx)(CheckoutCartPanel_1.CheckoutCartPanel, { items: items, totalAmount: computedTotal, tokenSymbol: tokenSymbol, tokenDecimals: tokenDecimals, organizationName: organizationName, organizationLogo: organizationLogo, classes: classes, footer: footer, shipping: typeof shipping === "string" ? { amount: shipping } : shipping, tax: typeof tax === "string" ? { amount: tax } : tax, discount: typeof discount === "string" ? { amount: discount } : discount, summaryLines: summaryLines }) })), !hasItems && ((0, jsx_runtime_1.jsx)("div", { className: "border-b border-gray-200 p-5 dark:border-neutral-700", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("flex items-center justify-between", classes?.cartSummary), children: [(0, jsx_runtime_1.jsx)("span", { className: "text-base font-semibold text-gray-900 dark:text-gray-100", children: "Total" }), (0, jsx_runtime_1.jsxs)("span", { className: (0, cn_1.cn)("text-base font-semibold text-gray-900 dark:text-gray-100", classes?.cartTotal), children: [formattedTotal, " ", tokenSymbol] })] }), footer === undefined ? ((0, jsx_runtime_1.jsx)(PoweredByBranding_1.PoweredByBranding, { organizationName: organizationName, organizationLogo: organizationLogo, classes: classes })) : (footer)] }) })), (0, jsx_runtime_1.jsx)("div", { className: "px-2 py-3", children: (0, jsx_runtime_1.jsx)(CheckoutPaymentPanel_1.CheckoutPaymentPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: computedTotal, buttonText: buttonText, themeColor: themeColor, returnUrl: returnUrl, returnLabel: returnLabel, onSuccess: onSuccess, onError: onError, callbackMetadata: mergedMetadata, classes: classes, defaultPaymentMethod: defaultPaymentMethod, senderAddress: senderAddress, kycEnabled: kycEnabled }) })] }) }) }));
61
61
  }
@@ -28,6 +28,8 @@ interface CheckoutPaymentPanelProps {
28
28
  isFormValid?: boolean;
29
29
  /** When true, fees are added on top (payer pays more, receiver gets exact amount) */
30
30
  feeOnTop?: boolean;
31
+ /** When true, identity verification (KYC) is required before card payment. Defaults to false. */
32
+ kycEnabled?: boolean;
31
33
  }
32
- export declare function CheckoutPaymentPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, buttonText, themeColor, returnUrl, returnLabel, onSuccess, onError, callbackMetadata, classes, defaultPaymentMethod, senderAddress, showPoints, showOrderId, isFormValid, feeOnTop, }: CheckoutPaymentPanelProps): import("react/jsx-runtime").JSX.Element;
34
+ export declare function CheckoutPaymentPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, buttonText, themeColor, returnUrl, returnLabel, onSuccess, onError, callbackMetadata, classes, defaultPaymentMethod, senderAddress, showPoints, showOrderId, isFormValid, feeOnTop, kycEnabled, }: CheckoutPaymentPanelProps): import("react/jsx-runtime").JSX.Element;
33
35
  export {};
@@ -29,7 +29,7 @@ function AmexLogo() {
29
29
  function CoinbaseLogo() {
30
30
  return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 24 24", style: { width: 20, height: 20 }, "aria-label": "Coinbase", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "12", fill: "#0052FF" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 4.5a7.5 7.5 0 1 0 0 15 7.5 7.5 0 0 0 0-15zm-1.8 4.8h3.6c.33 0 .6.27.6.6v4.2c0 .33-.27.6-.6.6h-3.6a.6.6 0 0 1-.6-.6V9.9c0-.33.27-.6.6-.6z", fill: "white" })] }));
31
31
  }
32
- function CheckoutPaymentPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, buttonText, themeColor, returnUrl, returnLabel, onSuccess, onError, callbackMetadata, classes, defaultPaymentMethod, senderAddress, showPoints, showOrderId, isFormValid = true, feeOnTop, }) {
32
+ function CheckoutPaymentPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, buttonText, themeColor, returnUrl, returnLabel, onSuccess, onError, callbackMetadata, classes, defaultPaymentMethod, senderAddress, showPoints, showOrderId, isFormValid = true, feeOnTop, kycEnabled = false, }) {
33
33
  const [paymentMethod, setPaymentMethod] = (0, react_2.useState)(defaultPaymentMethod ?? null);
34
34
  // Restore activeOrderId from sessionStorage (handles page refresh / Coinbase return)
35
35
  const [activeOrderId, setActiveOrderId] = (0, react_2.useState)(() => {
@@ -60,5 +60,5 @@ function CheckoutPaymentPanel({ recipientAddress, destinationTokenAddress, desti
60
60
  ? "bg-white dark:bg-neutral-900"
61
61
  : "bg-white hover:bg-gray-50 dark:bg-neutral-900 dark:hover:bg-neutral-800", classes?.paymentMethodButton);
62
62
  const expandedPanelClass = (0, cn_1.cn)("anyspend-payment-method-panel border-t border-gray-100 bg-white px-4 py-4 dark:border-neutral-800 dark:bg-neutral-900");
63
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-payment-panel flex flex-col gap-5", classes?.paymentPanel), children: [(0, jsx_runtime_1.jsx)("h2", { className: (0, cn_1.cn)("anyspend-payment-title text-lg font-semibold text-gray-900 dark:text-gray-100", classes?.paymentTitle), children: "Payment" }), !isFormValid && ((0, jsx_runtime_1.jsx)("p", { className: "text-sm text-amber-600 dark:text-amber-400", children: "Please complete the required fields above before proceeding to payment." })), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-payment-methods divide-y divide-gray-200 overflow-hidden rounded-xl border border-gray-200 dark:divide-neutral-700 dark:border-neutral-700", !isFormValid && "pointer-events-none opacity-50", classes?.paymentMethodSelector), children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-crypto", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod(paymentMethod === "crypto" ? null : "crypto"), className: accordionButtonClass(paymentMethod === "crypto"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "crypto", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Pay with crypto" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "crypto" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(CryptoPayPanel_1.CryptoPayPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, buttonText: buttonText, themeColor: themeColor, onOrderCreated: handleOrderCreated, onError: onError, callbackMetadata: callbackMetadata, classes: classes, senderAddress: senderAddress }) }) }, "crypto-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-card", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod(paymentMethod === "card" ? null : "card"), className: accordionButtonClass(paymentMethod === "card"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "card", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(lucide_react_1.CreditCard, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Credit or debit card" }), (0, jsx_runtime_1.jsxs)("div", { className: "ml-auto flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(VisaLogo, {}), (0, jsx_runtime_1.jsx)(MastercardLogo, {}), (0, jsx_runtime_1.jsx)(AmexLogo, {})] })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "card" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(FiatCheckoutPanel_1.FiatCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onOrderCreated: handleOrderCreated, onError: onError, callbackMetadata: callbackMetadata, classes: classes, feeOnTop: feeOnTop }) }) }, "card-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-coinbase", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod(paymentMethod === "coinbase" ? null : "coinbase"), className: accordionButtonClass(paymentMethod === "coinbase"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "coinbase", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(CoinbaseLogo, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Coinbase Pay" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "coinbase" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(CoinbaseCheckoutPanel_1.CoinbaseCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onOrderCreated: handleOrderCreated, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "coinbase-panel")) })] })] })] }));
63
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-payment-panel flex flex-col gap-5", classes?.paymentPanel), children: [(0, jsx_runtime_1.jsx)("h2", { className: (0, cn_1.cn)("anyspend-payment-title text-lg font-semibold text-gray-900 dark:text-gray-100", classes?.paymentTitle), children: "Payment" }), !isFormValid && ((0, jsx_runtime_1.jsx)("p", { className: "text-sm text-amber-600 dark:text-amber-400", children: "Please complete the required fields above before proceeding to payment." })), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-payment-methods divide-y divide-gray-200 overflow-hidden rounded-xl border border-gray-200 dark:divide-neutral-700 dark:border-neutral-700", !isFormValid && "pointer-events-none opacity-50", classes?.paymentMethodSelector), children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-crypto", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod(paymentMethod === "crypto" ? null : "crypto"), className: accordionButtonClass(paymentMethod === "crypto"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "crypto", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Pay with crypto" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "crypto" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(CryptoPayPanel_1.CryptoPayPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, buttonText: buttonText, themeColor: themeColor, onOrderCreated: handleOrderCreated, onError: onError, callbackMetadata: callbackMetadata, classes: classes, senderAddress: senderAddress }) }) }, "crypto-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-card", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod(paymentMethod === "card" ? null : "card"), className: accordionButtonClass(paymentMethod === "card"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "card", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(lucide_react_1.CreditCard, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Credit or debit card" }), (0, jsx_runtime_1.jsxs)("div", { className: "ml-auto flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(VisaLogo, {}), (0, jsx_runtime_1.jsx)(MastercardLogo, {}), (0, jsx_runtime_1.jsx)(AmexLogo, {})] })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "card" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(FiatCheckoutPanel_1.FiatCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onOrderCreated: handleOrderCreated, onError: onError, callbackMetadata: callbackMetadata, classes: classes, feeOnTop: feeOnTop, kycEnabled: kycEnabled }) }) }, "card-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-coinbase", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod(paymentMethod === "coinbase" ? null : "coinbase"), className: accordionButtonClass(paymentMethod === "coinbase"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "coinbase", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(CoinbaseLogo, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Coinbase Pay" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "coinbase" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(CoinbaseCheckoutPanel_1.CoinbaseCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onOrderCreated: handleOrderCreated, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "coinbase-panel")) })] })] })] }));
64
64
  }
@@ -320,5 +320,5 @@ function CryptoPayPanel({ recipientAddress, destinationTokenAddress, destination
320
320
  ? "Creating order..."
321
321
  : isSendingDeposit
322
322
  ? "Confirm in wallet..."
323
- : "Confirming transaction..."] })) : (buttonText) })), isMobile && hasWalletConnector ? ((0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => setQrExpanded(prev => !prev), className: "flex w-full items-center gap-3 py-1", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-px flex-1 bg-gray-200 dark:bg-neutral-700" }), (0, jsx_runtime_1.jsxs)("span", { className: "flex items-center gap-1 text-xs font-medium text-gray-400 dark:text-gray-500", children: [qrExpanded ? ("or send directly") : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.QrCode, { className: "h-3 w-3" }), " or send with QR code"] })), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: (0, cn_1.cn)("h-3 w-3 transition-transform", qrExpanded && "rotate-180") })] }), (0, jsx_runtime_1.jsx)("div", { className: "h-px flex-1 bg-gray-200 dark:bg-neutral-700" })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 py-1", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-px flex-1 bg-gray-200 dark:bg-neutral-700" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs font-medium text-gray-400 dark:text-gray-500", children: "or send directly" }), (0, jsx_runtime_1.jsx)("div", { className: "h-px flex-1 bg-gray-200 dark:bg-neutral-700" })] })), (0, jsx_runtime_1.jsx)(react_3.AnimatePresence, { initial: false, children: qrExpanded && ((0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.25, ease: "easeInOut" }, className: "overflow-hidden", children: isCreatingQrOrder && !globalAddress ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center py-8", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-5 w-5 animate-spin text-gray-400" }), (0, jsx_runtime_1.jsx)("span", { className: "ml-2 text-sm text-gray-500 dark:text-gray-400", children: "Creating deposit address..." })] })) : globalAddress ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "shrink-0 rounded-xl bg-white p-2.5 shadow-sm ring-1 ring-gray-100 dark:bg-white dark:ring-gray-200", children: (0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: qrValue, size: 132, level: "M", marginSize: 0 }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2.5", children: [(0, jsx_runtime_1.jsxs)("p", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: ["Send", " ", (0, jsx_runtime_1.jsxs)("span", { className: "font-semibold text-gray-900 dark:text-gray-100", children: [srcAmountFormatted, " ", selectedSrcToken?.symbol] }), " ", "on", " ", (0, jsx_runtime_1.jsxs)("span", { className: "font-semibold text-gray-900 dark:text-gray-100", children: [chainLogoUrl && ((0, jsx_runtime_1.jsx)("img", { src: chainLogoUrl, alt: "", className: "mb-px mr-0.5 inline h-3.5 w-3.5 rounded-full align-text-bottom" })), chainName] }), " ", "to:"] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleCopyAddress, className: "group flex items-start gap-1.5 rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-left transition-colors hover:border-gray-300 hover:bg-gray-100 dark:border-neutral-700 dark:bg-neutral-800/60 dark:hover:border-neutral-600 dark:hover:bg-neutral-800", children: [(0, jsx_runtime_1.jsx)("span", { className: "min-w-0 break-all font-mono text-xs leading-relaxed text-gray-800 dark:text-gray-200", children: globalAddress }), (0, jsx_runtime_1.jsx)("span", { className: "mt-0.5 shrink-0 text-gray-400 transition-colors group-hover:text-gray-600 dark:group-hover:text-gray-300", children: copied ? (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: "h-3.5 w-3.5 text-green-500" }) : (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "h-3.5 w-3.5" }) })] }), (0, jsx_runtime_1.jsxs)("p", { className: "text-xs leading-snug text-orange-500/80 dark:text-orange-400/80", children: ["Only send ", selectedSrcToken?.symbol, " on", " ", chainLogoUrl && ((0, jsx_runtime_1.jsx)("img", { src: chainLogoUrl, alt: "", className: "mr-0.5 inline h-3 w-3 rounded-full align-text-bottom" })), chainName, ". Sending other tokens or using a different network may result in loss of funds."] })] })] })) : null }, "qr-section")) })] }));
323
+ : "Confirming transaction..."] })) : (buttonText) })), isMobile && hasWalletConnector ? ((0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => setQrExpanded(prev => !prev), className: "flex w-full items-center gap-3 py-1", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-px flex-1 bg-gray-200 dark:bg-neutral-700" }), (0, jsx_runtime_1.jsxs)("span", { className: "flex items-center gap-1 text-xs font-medium text-gray-400 dark:text-gray-500", children: [qrExpanded ? ("or send directly") : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.QrCode, { className: "h-3 w-3" }), " or send with QR code"] })), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: (0, cn_1.cn)("h-3 w-3 transition-transform", qrExpanded && "rotate-180") })] }), (0, jsx_runtime_1.jsx)("div", { className: "h-px flex-1 bg-gray-200 dark:bg-neutral-700" })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 py-1", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-px flex-1 bg-gray-200 dark:bg-neutral-700" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs font-medium text-gray-400 dark:text-gray-500", children: "or send directly" }), (0, jsx_runtime_1.jsx)("div", { className: "h-px flex-1 bg-gray-200 dark:bg-neutral-700" })] })), (0, jsx_runtime_1.jsx)(react_3.AnimatePresence, { initial: false, children: qrExpanded && ((0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.25, ease: "easeInOut" }, className: "overflow-hidden", children: isCreatingQrOrder && !globalAddress ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center py-8", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-5 w-5 animate-spin text-gray-400" }), (0, jsx_runtime_1.jsx)("span", { className: "ml-2 text-sm text-gray-500 dark:text-gray-400", children: "Creating deposit address..." })] })) : globalAddress ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "shrink-0 rounded-xl bg-white p-2.5 shadow-sm ring-1 ring-gray-100 dark:bg-white dark:ring-gray-200", children: (0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: qrValue, size: 132, level: "M", marginSize: 0 }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2.5", children: [(0, jsx_runtime_1.jsxs)("p", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: ["Send", " ", (0, jsx_runtime_1.jsxs)("span", { className: "font-semibold text-gray-900 dark:text-gray-100", children: [srcAmountFormatted, " ", selectedSrcToken?.symbol] }), " ", "on", " ", (0, jsx_runtime_1.jsxs)("span", { className: "inline-flex items-center gap-1 rounded-full bg-gray-100 px-1.5 py-0.5 align-middle font-semibold text-gray-900 dark:bg-white/10 dark:text-gray-100", children: [chainLogoUrl && (0, jsx_runtime_1.jsx)("img", { src: chainLogoUrl, alt: "", className: "h-3.5 w-3.5 rounded-full" }), chainName] }), " ", "to:"] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleCopyAddress, className: "group flex items-start gap-1.5 rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-left transition-colors hover:border-gray-300 hover:bg-gray-100 dark:border-neutral-700 dark:bg-neutral-800/60 dark:hover:border-neutral-600 dark:hover:bg-neutral-800", children: [(0, jsx_runtime_1.jsx)("span", { className: "min-w-0 break-all font-mono text-xs leading-relaxed text-gray-800 dark:text-gray-200", children: globalAddress }), (0, jsx_runtime_1.jsx)("span", { className: "mt-0.5 shrink-0 text-gray-400 transition-colors group-hover:text-gray-600 dark:group-hover:text-gray-300", children: copied ? (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: "h-3.5 w-3.5 text-green-500" }) : (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "h-3.5 w-3.5" }) })] }), (0, jsx_runtime_1.jsxs)("p", { className: "text-xs leading-snug text-orange-500/80 dark:text-orange-400/80", children: ["Only send ", selectedSrcToken?.symbol, " on ", (0, jsx_runtime_1.jsx)("span", { className: "font-semibold", children: chainName }), ". Sending other tokens or using a different network may result in loss of funds."] })] })] })) : null }, "qr-section")) })] }));
324
324
  }
@@ -17,6 +17,8 @@ interface FiatCheckoutPanelProps {
17
17
  classes?: AnySpendCheckoutClasses;
18
18
  /** When true, fees are added on top (payer pays more, receiver gets exact amount) */
19
19
  feeOnTop?: boolean;
20
+ /** When true, identity verification is required before card payment. Defaults to false. */
21
+ kycEnabled?: boolean;
20
22
  }
21
- export declare function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onOrderCreated, onError, callbackMetadata, classes, feeOnTop, }: FiatCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onOrderCreated, onError, callbackMetadata, classes, feeOnTop, kycEnabled, }: FiatCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
22
24
  export {};