@b3dotfun/sdk 0.1.66-alpha.1 → 0.1.66-alpha.2

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 (121) hide show
  1. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +50 -0
  2. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +30 -0
  3. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +47 -0
  4. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +45 -0
  5. package/dist/cjs/anyspend/react/components/checkout/CartItemRow.d.ts +8 -0
  6. package/dist/cjs/anyspend/react/components/checkout/CartItemRow.js +9 -0
  7. package/dist/cjs/anyspend/react/components/checkout/CartSummary.d.ts +8 -0
  8. package/dist/cjs/anyspend/react/components/checkout/CartSummary.js +9 -0
  9. package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +12 -0
  10. package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.js +19 -0
  11. package/dist/cjs/anyspend/react/components/checkout/CheckoutLayout.d.ts +10 -0
  12. package/dist/cjs/anyspend/react/components/checkout/CheckoutLayout.js +25 -0
  13. package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +20 -0
  14. package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +45 -0
  15. package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.d.ts +10 -0
  16. package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.js +11 -0
  17. package/dist/cjs/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +16 -0
  18. package/dist/cjs/anyspend/react/components/checkout/CoinbaseCheckoutPanel.js +27 -0
  19. package/dist/cjs/anyspend/react/components/checkout/CryptoCheckoutPanel.d.ts +33 -0
  20. package/dist/cjs/anyspend/react/components/checkout/CryptoCheckoutPanel.js +317 -0
  21. package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +16 -0
  22. package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +233 -0
  23. package/dist/cjs/anyspend/react/components/checkout/PoweredByBranding.d.ts +8 -0
  24. package/dist/cjs/anyspend/react/components/checkout/PoweredByBranding.js +9 -0
  25. package/dist/cjs/anyspend/react/components/checkout/QRCheckoutPanel.d.ts +17 -0
  26. package/dist/cjs/anyspend/react/components/checkout/QRCheckoutPanel.js +148 -0
  27. package/dist/cjs/anyspend/react/components/index.d.ts +5 -1
  28. package/dist/cjs/anyspend/react/components/index.js +6 -1
  29. package/dist/cjs/anyspend/react/components/types/classes.d.ts +32 -0
  30. package/dist/cjs/global-account/react/components/B3DynamicModal.js +5 -1
  31. package/dist/cjs/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  32. package/dist/cjs/global-account/react/components/ui/command.d.ts +7 -7
  33. package/dist/cjs/global-account/react/hooks/useAuth.d.ts +1 -1
  34. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
  35. package/dist/cjs/global-account/react/hooks/useUser.d.ts +1 -1
  36. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
  37. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +53 -1
  38. package/dist/cjs/shared/constants/chains/b3Chain.d.ts +2 -2
  39. package/dist/cjs/shared/constants/chains/supported.d.ts +3 -3
  40. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +50 -0
  41. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +27 -0
  42. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +47 -0
  43. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +42 -0
  44. package/dist/esm/anyspend/react/components/checkout/CartItemRow.d.ts +8 -0
  45. package/dist/esm/anyspend/react/components/checkout/CartItemRow.js +6 -0
  46. package/dist/esm/anyspend/react/components/checkout/CartSummary.d.ts +8 -0
  47. package/dist/esm/anyspend/react/components/checkout/CartSummary.js +6 -0
  48. package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +12 -0
  49. package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.js +16 -0
  50. package/dist/esm/anyspend/react/components/checkout/CheckoutLayout.d.ts +10 -0
  51. package/dist/esm/anyspend/react/components/checkout/CheckoutLayout.js +22 -0
  52. package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +20 -0
  53. package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +42 -0
  54. package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.d.ts +10 -0
  55. package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.js +8 -0
  56. package/dist/esm/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +16 -0
  57. package/dist/esm/anyspend/react/components/checkout/CoinbaseCheckoutPanel.js +24 -0
  58. package/dist/esm/anyspend/react/components/checkout/CryptoCheckoutPanel.d.ts +33 -0
  59. package/dist/esm/anyspend/react/components/checkout/CryptoCheckoutPanel.js +313 -0
  60. package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +16 -0
  61. package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +230 -0
  62. package/dist/esm/anyspend/react/components/checkout/PoweredByBranding.d.ts +8 -0
  63. package/dist/esm/anyspend/react/components/checkout/PoweredByBranding.js +6 -0
  64. package/dist/esm/anyspend/react/components/checkout/QRCheckoutPanel.d.ts +17 -0
  65. package/dist/esm/anyspend/react/components/checkout/QRCheckoutPanel.js +145 -0
  66. package/dist/esm/anyspend/react/components/index.d.ts +5 -1
  67. package/dist/esm/anyspend/react/components/index.js +3 -0
  68. package/dist/esm/anyspend/react/components/types/classes.d.ts +32 -0
  69. package/dist/esm/global-account/react/components/B3DynamicModal.js +5 -1
  70. package/dist/esm/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  71. package/dist/esm/global-account/react/components/ui/command.d.ts +7 -7
  72. package/dist/esm/global-account/react/hooks/useAuth.d.ts +1 -1
  73. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
  74. package/dist/esm/global-account/react/hooks/useUser.d.ts +1 -1
  75. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
  76. package/dist/esm/global-account/react/stores/useModalStore.d.ts +53 -1
  77. package/dist/esm/shared/constants/chains/b3Chain.d.ts +2 -2
  78. package/dist/esm/shared/constants/chains/supported.d.ts +3 -3
  79. package/dist/styles/index.css +1 -1
  80. package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +50 -0
  81. package/dist/types/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +47 -0
  82. package/dist/types/anyspend/react/components/checkout/CartItemRow.d.ts +8 -0
  83. package/dist/types/anyspend/react/components/checkout/CartSummary.d.ts +8 -0
  84. package/dist/types/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +12 -0
  85. package/dist/types/anyspend/react/components/checkout/CheckoutLayout.d.ts +10 -0
  86. package/dist/types/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +20 -0
  87. package/dist/types/anyspend/react/components/checkout/CheckoutSuccess.d.ts +10 -0
  88. package/dist/types/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +16 -0
  89. package/dist/types/anyspend/react/components/checkout/CryptoCheckoutPanel.d.ts +33 -0
  90. package/dist/types/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +16 -0
  91. package/dist/types/anyspend/react/components/checkout/PoweredByBranding.d.ts +8 -0
  92. package/dist/types/anyspend/react/components/checkout/QRCheckoutPanel.d.ts +17 -0
  93. package/dist/types/anyspend/react/components/index.d.ts +5 -1
  94. package/dist/types/anyspend/react/components/types/classes.d.ts +32 -0
  95. package/dist/types/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  96. package/dist/types/global-account/react/components/ui/command.d.ts +7 -7
  97. package/dist/types/global-account/react/hooks/useAuth.d.ts +1 -1
  98. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
  99. package/dist/types/global-account/react/hooks/useUser.d.ts +1 -1
  100. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
  101. package/dist/types/global-account/react/stores/useModalStore.d.ts +53 -1
  102. package/dist/types/shared/constants/chains/b3Chain.d.ts +2 -2
  103. package/dist/types/shared/constants/chains/supported.d.ts +3 -3
  104. package/package.json +1 -1
  105. package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +127 -0
  106. package/src/anyspend/react/components/checkout/AnySpendCheckoutTrigger.tsx +166 -0
  107. package/src/anyspend/react/components/checkout/CartItemRow.tsx +43 -0
  108. package/src/anyspend/react/components/checkout/CartSummary.tsx +23 -0
  109. package/src/anyspend/react/components/checkout/CheckoutCartPanel.tsx +60 -0
  110. package/src/anyspend/react/components/checkout/CheckoutLayout.tsx +72 -0
  111. package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +320 -0
  112. package/src/anyspend/react/components/checkout/CheckoutSuccess.tsx +91 -0
  113. package/src/anyspend/react/components/checkout/CoinbaseCheckoutPanel.tsx +90 -0
  114. package/src/anyspend/react/components/checkout/CryptoCheckoutPanel.tsx +643 -0
  115. package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +568 -0
  116. package/src/anyspend/react/components/checkout/PoweredByBranding.tsx +32 -0
  117. package/src/anyspend/react/components/checkout/QRCheckoutPanel.tsx +320 -0
  118. package/src/anyspend/react/components/index.ts +7 -0
  119. package/src/anyspend/react/components/types/classes.ts +48 -0
  120. package/src/global-account/react/components/B3DynamicModal.tsx +5 -0
  121. package/src/global-account/react/stores/useModalStore.ts +52 -1
@@ -0,0 +1,50 @@
1
+ export type { AnySpendCheckoutClasses } from "../types/classes";
2
+ import type { AnySpendCheckoutClasses } from "../types/classes";
3
+ export interface CheckoutItem {
4
+ id?: string;
5
+ name: string;
6
+ description?: string;
7
+ imageUrl?: string;
8
+ /** Amount in wei (smallest unit of destination token) */
9
+ amount: string;
10
+ quantity: number;
11
+ }
12
+ export interface AnySpendCheckoutProps {
13
+ /** Display mode */
14
+ mode?: "page" | "embedded";
15
+ /** The recipient address */
16
+ recipientAddress: string;
17
+ /** The destination token address */
18
+ destinationTokenAddress: string;
19
+ /** The destination chain ID */
20
+ destinationTokenChainId: number;
21
+ /** Line items */
22
+ items: CheckoutItem[];
23
+ /** Override computed total */
24
+ totalAmount?: string;
25
+ /** Organization name */
26
+ organizationName?: string;
27
+ /** Organization logo URL */
28
+ organizationLogo?: string;
29
+ /** Theme color (hex) */
30
+ themeColor?: string;
31
+ /** Custom button text */
32
+ buttonText?: string;
33
+ /** Checkout session ID (used by pay link backend to track sessions) */
34
+ checkoutSessionId?: string;
35
+ /** Called on successful payment */
36
+ onSuccess?: (result: {
37
+ txHash?: string;
38
+ orderId?: string;
39
+ }) => void;
40
+ /** Called on payment error */
41
+ onError?: (error: Error) => void;
42
+ /** URL to redirect to after payment */
43
+ returnUrl?: string;
44
+ /** Label for the return button */
45
+ returnLabel?: string;
46
+ /** Custom class names */
47
+ classes?: AnySpendCheckoutClasses;
48
+ }
49
+ export declare function AnySpendCheckout({ mode, recipientAddress, destinationTokenAddress, destinationTokenChainId, items, totalAmount: totalAmountOverride, organizationName, organizationLogo, themeColor, buttonText, checkoutSessionId: _checkoutSessionId, // TODO: pass to payment panels for server-side session tracking
50
+ onSuccess, onError, returnUrl, returnLabel, classes, }: AnySpendCheckoutProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AnySpendCheckout = AnySpendCheckout;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("../../../../global-account/react");
7
+ const react_2 = require("react");
8
+ const AnySpendFingerprintWrapper_1 = require("../AnySpendFingerprintWrapper");
9
+ const CheckoutCartPanel_1 = require("./CheckoutCartPanel");
10
+ const CheckoutLayout_1 = require("./CheckoutLayout");
11
+ const CheckoutPaymentPanel_1 = require("./CheckoutPaymentPanel");
12
+ function AnySpendCheckout({ mode = "page", recipientAddress, destinationTokenAddress, destinationTokenChainId, items, totalAmount: totalAmountOverride, organizationName, organizationLogo, themeColor, buttonText = "Pay", checkoutSessionId: _checkoutSessionId, // TODO: pass to payment panels for server-side session tracking
13
+ onSuccess, onError, returnUrl, returnLabel, classes, }) {
14
+ // Compute total from items
15
+ const computedTotal = (0, react_2.useMemo)(() => {
16
+ if (totalAmountOverride)
17
+ return totalAmountOverride;
18
+ let total = BigInt(0);
19
+ for (const item of items) {
20
+ total += BigInt(item.amount) * BigInt(item.quantity);
21
+ }
22
+ return total.toString();
23
+ }, [items, totalAmountOverride]);
24
+ // Get destination token metadata
25
+ const { data: tokenData } = (0, react_1.useTokenData)(destinationTokenChainId, destinationTokenAddress);
26
+ const tokenSymbol = tokenData?.symbol || "";
27
+ const tokenDecimals = tokenData?.decimals || 18;
28
+ const fingerprint = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
29
+ return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprint, children: (0, jsx_runtime_1.jsx)(CheckoutLayout_1.CheckoutLayout, { mode: mode, paymentPanel: (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 }), cartPanel: (0, jsx_runtime_1.jsx)(CheckoutCartPanel_1.CheckoutCartPanel, { items: items, totalAmount: computedTotal, tokenSymbol: tokenSymbol, tokenDecimals: tokenDecimals, organizationName: organizationName, organizationLogo: organizationLogo, classes: classes }), classes: classes }) }));
30
+ }
@@ -0,0 +1,47 @@
1
+ import type { AnySpendCheckoutClasses } from "../types/classes";
2
+ import type { CheckoutItem } from "./AnySpendCheckout";
3
+ export interface AnySpendCheckoutTriggerProps {
4
+ /** Payment recipient address (hex) */
5
+ recipientAddress: string;
6
+ /** Destination token address */
7
+ destinationTokenAddress: string;
8
+ /** Destination chain ID */
9
+ destinationTokenChainId: number;
10
+ /** Line items to display in the cart (optional — if omitted, only the payment panel is shown) */
11
+ items?: CheckoutItem[];
12
+ /** Total amount in wei — required when items are not provided */
13
+ totalAmount?: string;
14
+ /** Organization name */
15
+ organizationName?: string;
16
+ /** Organization logo URL */
17
+ organizationLogo?: string;
18
+ /** Theme color (hex) */
19
+ themeColor?: string;
20
+ /** Custom button text */
21
+ buttonText?: string;
22
+ /** Workflow ID to trigger on payment */
23
+ workflowId?: string;
24
+ /** Organization ID that owns the workflow */
25
+ orgId?: string;
26
+ /** Optional callback metadata merged into the order */
27
+ callbackMetadata?: {
28
+ /** Passed as trigger result inputs — accessible via {{root.result.inputs.*}} */
29
+ inputs?: Record<string, unknown>;
30
+ } & Record<string, unknown>;
31
+ /** Called on successful payment */
32
+ onSuccess?: (result: {
33
+ txHash?: string;
34
+ orderId?: string;
35
+ }) => void;
36
+ /** Called on payment error */
37
+ onError?: (error: Error) => void;
38
+ /** URL to redirect to after payment */
39
+ returnUrl?: string;
40
+ /** Label for the return button */
41
+ returnLabel?: string;
42
+ /** Custom class names */
43
+ classes?: AnySpendCheckoutClasses;
44
+ /** Display mode — set automatically when used inside B3DynamicModal */
45
+ mode?: "modal" | "page";
46
+ }
47
+ export declare function AnySpendCheckoutTrigger({ recipientAddress, destinationTokenAddress, destinationTokenChainId, items, totalAmount: totalAmountOverride, organizationName, organizationLogo, themeColor, buttonText, workflowId, orgId, callbackMetadata, onSuccess, onError, returnUrl, returnLabel, classes, }: AnySpendCheckoutTriggerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AnySpendCheckoutTrigger = AnySpendCheckoutTrigger;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("../../../../global-account/react");
7
+ const number_1 = require("../../../../shared/utils/number");
8
+ const cn_1 = require("../../../../shared/utils/cn");
9
+ const react_2 = require("react");
10
+ const AnySpendFingerprintWrapper_1 = require("../AnySpendFingerprintWrapper");
11
+ const CheckoutCartPanel_1 = require("./CheckoutCartPanel");
12
+ const CheckoutPaymentPanel_1 = require("./CheckoutPaymentPanel");
13
+ const PoweredByBranding_1 = require("./PoweredByBranding");
14
+ function AnySpendCheckoutTrigger({ recipientAddress, destinationTokenAddress, destinationTokenChainId, items, totalAmount: totalAmountOverride, organizationName, organizationLogo, themeColor, buttonText = "Pay", workflowId, orgId, callbackMetadata, onSuccess, onError, returnUrl, returnLabel, classes, }) {
15
+ // Merge workflowId + orgId into callbackMetadata
16
+ const mergedMetadata = (0, react_2.useMemo)(() => {
17
+ if (!workflowId && !orgId && !callbackMetadata)
18
+ return undefined;
19
+ return {
20
+ ...(workflowId ? { workflowId } : {}),
21
+ ...(orgId ? { orgId } : {}),
22
+ ...callbackMetadata,
23
+ };
24
+ }, [workflowId, orgId, callbackMetadata]);
25
+ // Compute total from items or use override
26
+ const computedTotal = (0, react_2.useMemo)(() => {
27
+ if (totalAmountOverride)
28
+ return totalAmountOverride;
29
+ if (!items || items.length === 0)
30
+ return "0";
31
+ let total = BigInt(0);
32
+ for (const item of items) {
33
+ total += BigInt(item.amount) * BigInt(item.quantity);
34
+ }
35
+ return total.toString();
36
+ }, [items, totalAmountOverride]);
37
+ // Get destination token metadata
38
+ const { data: tokenData } = (0, react_1.useTokenData)(destinationTokenChainId, destinationTokenAddress);
39
+ const tokenSymbol = tokenData?.symbol || "";
40
+ const tokenDecimals = tokenData?.decimals || 18;
41
+ const formattedTotal = (0, react_2.useMemo)(() => (0, number_1.formatTokenAmount)(BigInt(computedTotal || "0"), tokenDecimals), [computedTotal, tokenDecimals]);
42
+ const hasItems = items && items.length > 0;
43
+ const fingerprint = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
44
+ return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprint, 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-gray-700", children: (0, jsx_runtime_1.jsx)(CheckoutCartPanel_1.CheckoutCartPanel, { items: items, totalAmount: computedTotal, tokenSymbol: tokenSymbol, tokenDecimals: tokenDecimals, organizationName: organizationName, organizationLogo: organizationLogo, classes: classes }) })), !hasItems && ((0, jsx_runtime_1.jsx)("div", { className: "border-b border-gray-200 p-5 dark:border-gray-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] })] }), (0, jsx_runtime_1.jsx)(PoweredByBranding_1.PoweredByBranding, { organizationName: organizationName, organizationLogo: organizationLogo, classes: classes })] }) })), (0, jsx_runtime_1.jsx)("div", { className: "p-5", 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 }) })] }) }));
45
+ }
@@ -0,0 +1,8 @@
1
+ import type { CheckoutItem, AnySpendCheckoutClasses } from "./AnySpendCheckout";
2
+ interface CartItemRowProps {
3
+ item: CheckoutItem;
4
+ formattedPrice: string;
5
+ classes?: AnySpendCheckoutClasses;
6
+ }
7
+ export declare function CartItemRow({ item, formattedPrice, classes }: CartItemRowProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CartItemRow = CartItemRow;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const cn_1 = require("../../../../shared/utils/cn");
7
+ function CartItemRow({ item, formattedPrice, classes }) {
8
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("flex items-start gap-3 py-3", classes?.cartItemRow), children: [item.imageUrl && ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("h-14 w-14 shrink-0 overflow-hidden rounded-lg bg-gray-100", classes?.cartItemImage), children: (0, jsx_runtime_1.jsx)("img", { src: item.imageUrl, alt: item.name, className: "h-full w-full object-cover" }) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex min-w-0 flex-1 items-start justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "min-w-0 flex-1", children: [(0, jsx_runtime_1.jsx)("p", { className: (0, cn_1.cn)("text-sm font-medium text-gray-900 dark:text-gray-100", classes?.cartItemName), children: item.name }), item.description && ((0, jsx_runtime_1.jsx)("p", { className: (0, cn_1.cn)("mt-0.5 line-clamp-2 text-xs text-gray-500 dark:text-gray-400", classes?.cartItemDescription), children: item.description })), item.quantity > 1 && (0, jsx_runtime_1.jsxs)("p", { className: "mt-0.5 text-xs text-gray-400 dark:text-gray-500", children: ["Qty: ", item.quantity] })] }), (0, jsx_runtime_1.jsx)("p", { className: (0, cn_1.cn)("ml-3 text-sm font-medium text-gray-900 dark:text-gray-100", classes?.cartItemPrice), children: formattedPrice })] })] }));
9
+ }
@@ -0,0 +1,8 @@
1
+ import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
2
+ interface CartSummaryProps {
3
+ total: string;
4
+ tokenSymbol?: string;
5
+ classes?: AnySpendCheckoutClasses;
6
+ }
7
+ export declare function CartSummary({ total, tokenSymbol, classes }: CartSummaryProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CartSummary = CartSummary;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const cn_1 = require("../../../../shared/utils/cn");
7
+ function CartSummary({ total, tokenSymbol, classes }) {
8
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("border-t border-gray-200 pt-3 dark:border-gray-700", classes?.cartSummary), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", 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: [total, " ", tokenSymbol] })] }) }));
9
+ }
@@ -0,0 +1,12 @@
1
+ import type { CheckoutItem, AnySpendCheckoutClasses } from "./AnySpendCheckout";
2
+ interface CheckoutCartPanelProps {
3
+ items: CheckoutItem[];
4
+ totalAmount: string;
5
+ tokenSymbol?: string;
6
+ tokenDecimals?: number;
7
+ organizationName?: string;
8
+ organizationLogo?: string;
9
+ classes?: AnySpendCheckoutClasses;
10
+ }
11
+ export declare function CheckoutCartPanel({ items, totalAmount, tokenSymbol, tokenDecimals, organizationName, organizationLogo, classes, }: CheckoutCartPanelProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CheckoutCartPanel = CheckoutCartPanel;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const cn_1 = require("../../../../shared/utils/cn");
7
+ const number_1 = require("../../../../shared/utils/number");
8
+ const react_1 = require("react");
9
+ const CartItemRow_1 = require("./CartItemRow");
10
+ const CartSummary_1 = require("./CartSummary");
11
+ const PoweredByBranding_1 = require("./PoweredByBranding");
12
+ function CheckoutCartPanel({ items, totalAmount, tokenSymbol = "", tokenDecimals = 18, organizationName, organizationLogo, classes, }) {
13
+ const formattedTotal = (0, react_1.useMemo)(() => (0, number_1.formatTokenAmount)(BigInt(totalAmount), tokenDecimals), [totalAmount, tokenDecimals]);
14
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-cart-panel flex flex-col", classes?.cartPanel), children: [(0, jsx_runtime_1.jsx)("h2", { className: (0, cn_1.cn)("anyspend-cart-title mb-4 text-lg font-semibold text-gray-900 dark:text-gray-100", classes?.cartTitle), children: "Order Summary" }), (0, jsx_runtime_1.jsx)("div", { className: "anyspend-cart-items divide-y divide-gray-100 dark:divide-gray-800", children: items.map((item, index) => {
15
+ const itemTotal = BigInt(item.amount) * BigInt(item.quantity);
16
+ const formattedPrice = `${(0, number_1.formatTokenAmount)(itemTotal, tokenDecimals)} ${tokenSymbol}`;
17
+ return (0, jsx_runtime_1.jsx)(CartItemRow_1.CartItemRow, { item: item, formattedPrice: formattedPrice, classes: classes }, item.id || index);
18
+ }) }), (0, jsx_runtime_1.jsx)(CartSummary_1.CartSummary, { total: formattedTotal, tokenSymbol: tokenSymbol, classes: classes }), (0, jsx_runtime_1.jsx)(PoweredByBranding_1.PoweredByBranding, { organizationName: organizationName, organizationLogo: organizationLogo, classes: classes })] }));
19
+ }
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from "react";
2
+ import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
3
+ interface CheckoutLayoutProps {
4
+ mode: "page" | "embedded";
5
+ paymentPanel: ReactNode;
6
+ cartPanel: ReactNode;
7
+ classes?: AnySpendCheckoutClasses;
8
+ }
9
+ export declare function CheckoutLayout({ mode, paymentPanel, cartPanel, classes }: CheckoutLayoutProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CheckoutLayout = CheckoutLayout;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const cn_1 = require("../../../../shared/utils/cn");
7
+ function CheckoutLayout({ mode, paymentPanel, cartPanel, classes }) {
8
+ const rightColumnWidth = mode === "page" ? 380 : 340;
9
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-checkout mx-auto w-full", classes?.root), style: mode === "page" ? { maxWidth: 1100, padding: "2rem 1rem" } : undefined, children: [(0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: {
10
+ __html: `
11
+ .anyspend-checkout-grid {
12
+ display: grid;
13
+ gap: 2rem;
14
+ grid-template-columns: 1fr;
15
+ }
16
+ @media (min-width: 768px) {
17
+ .anyspend-checkout-grid {
18
+ grid-template-columns: 1fr ${rightColumnWidth}px;
19
+ }
20
+ .anyspend-checkout-grid > .anyspend-payment-col { order: 1; }
21
+ .anyspend-checkout-grid > .anyspend-cart-col { order: 2; }
22
+ }
23
+ `,
24
+ } }), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-checkout-grid", classes?.layout), children: [(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-payment-col order-2", "rounded-2xl border border-gray-200 bg-white p-6 shadow-sm dark:border-gray-700 dark:bg-gray-900", classes?.paymentColumn), children: paymentPanel }), (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-cart-col order-1", "rounded-2xl border border-gray-200 bg-gray-50 p-6 dark:border-gray-700 dark:bg-gray-800/50", classes?.cartColumn), style: { position: "sticky", top: 32, alignSelf: "start" }, children: cartPanel })] })] }));
25
+ }
@@ -0,0 +1,20 @@
1
+ import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
2
+ interface CheckoutPaymentPanelProps {
3
+ recipientAddress: string;
4
+ destinationTokenAddress: string;
5
+ destinationTokenChainId: number;
6
+ totalAmount: string;
7
+ buttonText?: string;
8
+ themeColor?: string;
9
+ returnUrl?: string;
10
+ returnLabel?: string;
11
+ onSuccess?: (result: {
12
+ txHash?: string;
13
+ orderId?: string;
14
+ }) => void;
15
+ onError?: (error: Error) => void;
16
+ callbackMetadata?: Record<string, unknown>;
17
+ classes?: AnySpendCheckoutClasses;
18
+ }
19
+ export declare function CheckoutPaymentPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, buttonText, themeColor, returnUrl, returnLabel, onSuccess, onError, callbackMetadata, classes, }: CheckoutPaymentPanelProps): import("react/jsx-runtime").JSX.Element;
20
+ export {};
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CheckoutPaymentPanel = CheckoutPaymentPanel;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const cn_1 = require("../../../../shared/utils/cn");
7
+ const lucide_react_1 = require("lucide-react");
8
+ const react_1 = require("motion/react");
9
+ const react_2 = require("react");
10
+ const CheckoutSuccess_1 = require("./CheckoutSuccess");
11
+ const CoinbaseCheckoutPanel_1 = require("./CoinbaseCheckoutPanel");
12
+ const CryptoCheckoutPanel_1 = require("./CryptoCheckoutPanel");
13
+ const FiatCheckoutPanel_1 = require("./FiatCheckoutPanel");
14
+ const QRCheckoutPanel_1 = require("./QRCheckoutPanel");
15
+ function RadioCircle({ selected, themeColor }) {
16
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-full border-2 transition-colors", selected ? "border-blue-600" : "border-gray-300 dark:border-gray-600"), style: selected && themeColor ? { borderColor: themeColor } : undefined, children: selected && ((0, jsx_runtime_1.jsx)("div", { className: "h-2 w-2 rounded-full bg-blue-600", style: themeColor ? { backgroundColor: themeColor } : undefined })) }));
17
+ }
18
+ /** Card brand logos - all use consistent 32x20 viewBox */
19
+ function VisaLogo() {
20
+ return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 32 20", style: { width: 32, height: 20 }, "aria-label": "Visa", children: [(0, jsx_runtime_1.jsx)("rect", { width: "32", height: "20", rx: "3", fill: "#1A1F71" }), (0, jsx_runtime_1.jsx)("text", { x: "16", y: "13.5", textAnchor: "middle", fill: "white", fontSize: "9", fontWeight: "bold", fontFamily: "sans-serif", fontStyle: "italic", children: "VISA" })] }));
21
+ }
22
+ function MastercardLogo() {
23
+ return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 32 20", style: { width: 32, height: 20 }, "aria-label": "Mastercard", children: [(0, jsx_runtime_1.jsx)("rect", { width: "32", height: "20", rx: "3", fill: "#252525" }), (0, jsx_runtime_1.jsx)("circle", { cx: "12.5", cy: "10", r: "6", fill: "#EB001B" }), (0, jsx_runtime_1.jsx)("circle", { cx: "19.5", cy: "10", r: "6", fill: "#F79E1B" }), (0, jsx_runtime_1.jsx)("path", { d: "M16 5.6a6 6 0 0 1 0 8.8 6 6 0 0 1 0-8.8z", fill: "#FF5F00" })] }));
24
+ }
25
+ function AmexLogo() {
26
+ return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 32 20", style: { width: 32, height: 20 }, "aria-label": "Amex", children: [(0, jsx_runtime_1.jsx)("rect", { width: "32", height: "20", rx: "3", fill: "#006FCF" }), (0, jsx_runtime_1.jsx)("text", { x: "16", y: "13", textAnchor: "middle", fill: "white", fontSize: "7", fontWeight: "bold", fontFamily: "sans-serif", children: "AMEX" })] }));
27
+ }
28
+ /** Coinbase mark */
29
+ function CoinbaseLogo() {
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
+ }
32
+ function CheckoutPaymentPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, buttonText, themeColor, returnUrl, returnLabel, onSuccess, onError, callbackMetadata, classes, }) {
33
+ const [paymentMethod, setPaymentMethod] = (0, react_2.useState)("crypto");
34
+ const [paymentResult, setPaymentResult] = (0, react_2.useState)(null);
35
+ const handleSuccess = (result) => {
36
+ setPaymentResult(result);
37
+ onSuccess?.(result);
38
+ };
39
+ if (paymentResult) {
40
+ return ((0, jsx_runtime_1.jsx)(CheckoutSuccess_1.CheckoutSuccess, { txHash: paymentResult.txHash, orderId: paymentResult.orderId, returnUrl: returnUrl, returnLabel: returnLabel, classes: classes }));
41
+ }
42
+ const accordionButtonClass = (active) => (0, cn_1.cn)("anyspend-payment-method-btn flex w-full items-center gap-3 px-4 py-4 text-left transition-colors", active ? "bg-white dark:bg-gray-900" : "bg-white hover:bg-gray-50 dark:bg-gray-900 dark:hover:bg-gray-800", classes?.paymentMethodButton);
43
+ const expandedPanelClass = (0, cn_1.cn)("anyspend-payment-method-panel border-t border-gray-100 bg-white px-4 py-4 dark:border-gray-800 dark:bg-gray-900");
44
+ 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" }), (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-gray-700 dark:border-gray-700", classes?.paymentMethodSelector), children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-crypto", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod("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: "Crypto wallet" })] }), (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)(CryptoCheckoutPanel_1.CryptoCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, buttonText: buttonText, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "crypto-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-qr", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod("qr"), className: accordionButtonClass(paymentMethod === "qr"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "qr", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(lucide_react_1.QrCode, { 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: "QR code" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "qr" && ((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)(QRCheckoutPanel_1.QRCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "qr-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-card", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod("card"), className: accordionButtonClass(paymentMethod === "card"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "card", themeColor: themeColor }), (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, onSuccess: handleSuccess, onError: onError, classes: classes }) }) }, "card-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-coinbase", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod("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, onSuccess: handleSuccess, onError: onError, classes: classes }) }) }, "coinbase-panel")) })] })] })] }));
45
+ }
@@ -0,0 +1,10 @@
1
+ import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
2
+ interface CheckoutSuccessProps {
3
+ txHash?: string;
4
+ orderId?: string;
5
+ returnUrl?: string;
6
+ returnLabel?: string;
7
+ classes?: AnySpendCheckoutClasses;
8
+ }
9
+ export declare function CheckoutSuccess({ txHash, orderId, returnUrl, returnLabel, classes }: CheckoutSuccessProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CheckoutSuccess = CheckoutSuccess;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const cn_1 = require("../../../../shared/utils/cn");
7
+ const lucide_react_1 = require("lucide-react");
8
+ const react_1 = require("motion/react");
9
+ function CheckoutSuccess({ txHash, orderId, returnUrl, returnLabel, classes }) {
10
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-checkout-success flex flex-col items-center py-8 text-center", classes?.successPanel), children: [(0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { scale: 0.3, opacity: 0 }, animate: { scale: 1, opacity: 1 }, transition: { duration: 0.5, ease: "easeOut" }, className: "anyspend-success-icon mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: "h-8 w-8 text-green-600 dark:text-green-400" }) }), (0, jsx_runtime_1.jsx)(react_1.motion.h2, { initial: { opacity: 0, y: 10 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3, delay: 0.2, ease: "easeOut" }, className: "anyspend-success-title text-xl font-semibold text-gray-900 dark:text-gray-100", children: "Payment Successful" }), (0, jsx_runtime_1.jsx)(react_1.motion.p, { initial: { opacity: 0, y: 10 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3, delay: 0.35, ease: "easeOut" }, className: "anyspend-success-description mt-2 text-sm text-gray-500 dark:text-gray-400", children: "Your payment has been processed successfully." }), txHash && ((0, jsx_runtime_1.jsxs)(react_1.motion.a, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, delay: 0.5, ease: "easeOut" }, href: `https://explorer.b3.fun/tx/${txHash}`, target: "_blank", rel: "noopener noreferrer", className: "anyspend-success-tx-link mt-4 flex items-center gap-1.5 text-sm text-blue-600 hover:underline dark:text-blue-400", children: ["View Transaction", (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { className: "h-3.5 w-3.5" })] })), !txHash && orderId && ((0, jsx_runtime_1.jsxs)(react_1.motion.p, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, delay: 0.5, ease: "easeOut" }, className: "anyspend-success-order-id mt-4 text-xs text-gray-400 dark:text-gray-500", children: ["Order ID: ", orderId] })), returnUrl && ((0, jsx_runtime_1.jsx)(react_1.motion.a, { initial: { opacity: 0, y: 10 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3, delay: 0.6, ease: "easeOut" }, href: returnUrl, className: (0, cn_1.cn)("anyspend-success-return-btn mt-6 inline-flex rounded-xl px-6 py-3 text-sm font-medium transition-colors", classes?.returnButton), style: { backgroundColor: "#111827", color: "#fff" }, children: returnLabel || "Return to Store" }))] }));
11
+ }
@@ -0,0 +1,16 @@
1
+ import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
2
+ interface CoinbaseCheckoutPanelProps {
3
+ recipientAddress: string;
4
+ destinationTokenAddress: string;
5
+ destinationTokenChainId: number;
6
+ totalAmount: string;
7
+ themeColor?: string;
8
+ onSuccess?: (result: {
9
+ txHash?: string;
10
+ orderId?: string;
11
+ }) => void;
12
+ onError?: (error: Error) => void;
13
+ classes?: AnySpendCheckoutClasses;
14
+ }
15
+ export declare function CoinbaseCheckoutPanel({ destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, }: CoinbaseCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CoinbaseCheckoutPanel = CoinbaseCheckoutPanel;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("../../../../anyspend/react");
7
+ const cn_1 = require("../../../../shared/utils/cn");
8
+ const number_1 = require("../../../../shared/utils/number");
9
+ const react_2 = require("../../../../global-account/react");
10
+ const lucide_react_1 = require("lucide-react");
11
+ const react_3 = require("motion/react");
12
+ const react_4 = require("react");
13
+ function CoinbaseCheckoutPanel({ destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, }) {
14
+ const { data: tokenData } = (0, react_2.useTokenData)(destinationTokenChainId, destinationTokenAddress);
15
+ const formattedAmount = (0, react_4.useMemo)(() => {
16
+ const decimals = tokenData?.decimals || 18;
17
+ return (0, number_1.formatTokenAmount)(BigInt(totalAmount), decimals);
18
+ }, [totalAmount, tokenData]);
19
+ const { coinbaseAvailablePaymentMethods, isLoading } = (0, react_1.useGeoOnrampOptions)(formattedAmount);
20
+ if (isLoading) {
21
+ return ((0, jsx_runtime_1.jsxs)(react_3.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.2, ease: "easeOut" }, className: "anyspend-coinbase-loading flex items-center justify-center py-6", 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)(react_2.TextShimmer, { duration: 1.5, className: "ml-2 text-sm", children: "Checking availability..." })] }));
22
+ }
23
+ if (coinbaseAvailablePaymentMethods.length === 0) {
24
+ return ((0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0, y: 8 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.25, ease: "easeOut" }, className: "anyspend-coinbase-unavailable py-4 text-center", children: (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Coinbase Pay is not available in your region for this amount." }) }));
25
+ }
26
+ return ((0, jsx_runtime_1.jsxs)(react_3.motion.div, { initial: { opacity: 0, y: 10 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3, ease: "easeOut" }, className: "anyspend-coinbase-panel flex flex-col gap-3", children: [(0, jsx_runtime_1.jsx)("p", { className: "anyspend-coinbase-description text-sm text-gray-600 dark:text-gray-400", children: "Pay with your Coinbase account using debit card, bank account, or crypto balance." }), (0, jsx_runtime_1.jsx)("button", { className: (0, cn_1.cn)("anyspend-coinbase-btn w-full rounded-xl px-4 py-3 text-sm font-semibold text-white transition-all", "bg-[#0052FF] hover:bg-[#003ECF] active:scale-[0.98]"), style: themeColor ? { backgroundColor: themeColor } : undefined, children: "Continue with Coinbase" })] }));
27
+ }
@@ -0,0 +1,33 @@
1
+ import { components } from "../../../../anyspend/types/api";
2
+ import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
3
+ interface CryptoCheckoutPanelProps {
4
+ recipientAddress: string;
5
+ destinationTokenAddress: string;
6
+ destinationTokenChainId: number;
7
+ totalAmount: string;
8
+ buttonText?: string;
9
+ themeColor?: string;
10
+ onSuccess?: (result: {
11
+ txHash?: string;
12
+ orderId?: string;
13
+ }) => void;
14
+ onError?: (error: Error) => void;
15
+ callbackMetadata?: Record<string, unknown>;
16
+ classes?: AnySpendCheckoutClasses;
17
+ }
18
+ export declare function CryptoCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, buttonText, themeColor, onSuccess, onError, callbackMetadata, classes, }: CryptoCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
19
+ export interface TokenSelectorModalProps {
20
+ open: boolean;
21
+ onClose: () => void;
22
+ tokenList: components["schemas"]["Token"][] | undefined;
23
+ isLoadingTokens: boolean;
24
+ tokenSearchQuery: string;
25
+ onSearchChange: (query: string) => void;
26
+ onSelectToken: (token: components["schemas"]["Token"]) => void;
27
+ selectedToken: components["schemas"]["Token"] | null;
28
+ walletAddress?: string;
29
+ chainId: number;
30
+ onChainChange: (chainId: number) => void;
31
+ }
32
+ export declare function TokenSelectorModal({ open, onClose, tokenList, isLoadingTokens, tokenSearchQuery, onSearchChange, onSelectToken, selectedToken, walletAddress, chainId, onChainChange, }: TokenSelectorModalProps): import("react/jsx-runtime").JSX.Element;
33
+ export {};