@b3dotfun/sdk 0.0.13 → 0.0.14-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 (76) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpendFingerprintWrapper.d.ts +17 -0
  2. package/dist/cjs/anyspend/react/components/AnySpendFingerprintWrapper.js +40 -0
  3. package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.d.ts +1 -1
  4. package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +9 -4
  5. package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +6 -9
  6. package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
  7. package/dist/cjs/anyspend/react/components/index.js +15 -0
  8. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +1 -1
  9. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +6 -1
  10. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -1
  11. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +14 -2
  12. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +14 -2
  13. package/dist/cjs/anyspend/react/hooks/useCoinbaseOnrampOptions.d.ts +2 -1
  14. package/dist/cjs/anyspend/react/hooks/useCoinbaseOnrampOptions.js +4 -4
  15. package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.d.ts +1 -1
  16. package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.js +10 -3
  17. package/dist/cjs/anyspend/react/hooks/useStripeSupport.d.ts +2 -1
  18. package/dist/cjs/anyspend/react/hooks/useStripeSupport.js +4 -4
  19. package/dist/cjs/anyspend/react/providers/StripeRedirectHandler.js +0 -3
  20. package/dist/cjs/anyspend/services/anyspend.d.ts +6 -4
  21. package/dist/cjs/anyspend/services/anyspend.js +14 -4
  22. package/dist/cjs/anyspend/types/fingerprint.d.ts +14 -0
  23. package/dist/cjs/anyspend/types/fingerprint.js +6 -0
  24. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
  25. package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +0 -1
  26. package/dist/esm/anyspend/react/components/AnySpendFingerprintWrapper.d.ts +17 -0
  27. package/dist/esm/anyspend/react/components/AnySpendFingerprintWrapper.js +36 -0
  28. package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.d.ts +1 -1
  29. package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +9 -4
  30. package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +6 -9
  31. package/dist/esm/anyspend/react/components/index.d.ts +1 -0
  32. package/dist/esm/anyspend/react/components/index.js +1 -0
  33. package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +1 -1
  34. package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +6 -1
  35. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -1
  36. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +14 -2
  37. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +14 -2
  38. package/dist/esm/anyspend/react/hooks/useCoinbaseOnrampOptions.d.ts +2 -1
  39. package/dist/esm/anyspend/react/hooks/useCoinbaseOnrampOptions.js +4 -4
  40. package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.d.ts +1 -1
  41. package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.js +10 -3
  42. package/dist/esm/anyspend/react/hooks/useStripeSupport.d.ts +2 -1
  43. package/dist/esm/anyspend/react/hooks/useStripeSupport.js +4 -4
  44. package/dist/esm/anyspend/react/providers/StripeRedirectHandler.js +0 -3
  45. package/dist/esm/anyspend/services/anyspend.d.ts +6 -4
  46. package/dist/esm/anyspend/services/anyspend.js +14 -4
  47. package/dist/esm/anyspend/types/fingerprint.d.ts +14 -0
  48. package/dist/esm/anyspend/types/fingerprint.js +5 -0
  49. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
  50. package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +0 -1
  51. package/dist/types/anyspend/react/components/AnySpendFingerprintWrapper.d.ts +17 -0
  52. package/dist/types/anyspend/react/components/common/PanelOnrampPayment.d.ts +1 -1
  53. package/dist/types/anyspend/react/components/index.d.ts +1 -0
  54. package/dist/types/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +1 -1
  55. package/dist/types/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -1
  56. package/dist/types/anyspend/react/hooks/useCoinbaseOnrampOptions.d.ts +2 -1
  57. package/dist/types/anyspend/react/hooks/useGeoOnrampOptions.d.ts +1 -1
  58. package/dist/types/anyspend/react/hooks/useStripeSupport.d.ts +2 -1
  59. package/dist/types/anyspend/services/anyspend.d.ts +6 -4
  60. package/dist/types/anyspend/types/fingerprint.d.ts +14 -0
  61. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
  62. package/package.json +26 -25
  63. package/src/anyspend/react/components/AnySpendFingerprintWrapper.tsx +60 -0
  64. package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +38 -24
  65. package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +13 -16
  66. package/src/anyspend/react/components/index.ts +1 -0
  67. package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +11 -1
  68. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +18 -3
  69. package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +16 -3
  70. package/src/anyspend/react/hooks/useCoinbaseOnrampOptions.ts +10 -4
  71. package/src/anyspend/react/hooks/useGeoOnrampOptions.ts +15 -4
  72. package/src/anyspend/react/hooks/useStripeSupport.ts +11 -4
  73. package/src/anyspend/react/providers/StripeRedirectHandler.tsx +0 -4
  74. package/src/anyspend/services/anyspend.ts +21 -2
  75. package/src/anyspend/types/fingerprint.ts +15 -0
  76. package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +0 -1
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from "react";
2
+ interface FingerprintConfig {
3
+ apiKey: string;
4
+ endpoint?: string;
5
+ scriptUrlPattern?: string;
6
+ }
7
+ interface AnySpendFingerprintWrapperProps {
8
+ children: ReactNode;
9
+ fingerprint?: FingerprintConfig;
10
+ }
11
+ /**
12
+ * Internal wrapper that only initializes FingerprintJS when AnySpend components are actually used.
13
+ * This prevents unnecessary fingerprinting of users who don't interact with AnySpend.
14
+ */
15
+ export declare function AnySpendFingerprintWrapper({ children, fingerprint }: AnySpendFingerprintWrapperProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function getFingerprintConfig(): FingerprintConfig | undefined;
17
+ export {};
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AnySpendFingerprintWrapper = AnySpendFingerprintWrapper;
4
+ exports.getFingerprintConfig = getFingerprintConfig;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const fingerprintjs_pro_react_1 = require("@fingerprintjs/fingerprintjs-pro-react");
7
+ /**
8
+ * Internal wrapper that only initializes FingerprintJS when AnySpend components are actually used.
9
+ * This prevents unnecessary fingerprinting of users who don't interact with AnySpend.
10
+ */
11
+ function AnySpendFingerprintWrapper({ children, fingerprint }) {
12
+ // If no fingerprint config is provided, render children without fingerprinting
13
+ if (!fingerprint?.apiKey) {
14
+ console.warn("No Fingerprint API key provided. Fingerprinting will be disabled.");
15
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
16
+ }
17
+ // Ensure endpoint has https:// prefix
18
+ const endpoint = fingerprint.endpoint && !fingerprint.endpoint.startsWith("http")
19
+ ? `https://${fingerprint.endpoint}`
20
+ : fingerprint.endpoint;
21
+ return ((0, jsx_runtime_1.jsx)(fingerprintjs_pro_react_1.FpjsProvider, { loadOptions: {
22
+ apiKey: fingerprint.apiKey,
23
+ endpoint: endpoint ? [endpoint, fingerprintjs_pro_react_1.FingerprintJSPro.defaultEndpoint] : undefined,
24
+ scriptUrlPattern: fingerprint.scriptUrlPattern
25
+ ? [fingerprint.scriptUrlPattern, fingerprintjs_pro_react_1.FingerprintJSPro.defaultScriptUrlPattern]
26
+ : undefined,
27
+ }, children: children }));
28
+ }
29
+ // Helper function to get fingerprint config from environment variables
30
+ function getFingerprintConfig() {
31
+ const apiKey = process.env.NEXT_PUBLIC_FINGERPRINT_API_KEY;
32
+ if (!apiKey) {
33
+ return undefined;
34
+ }
35
+ return {
36
+ apiKey,
37
+ endpoint: process.env.NEXT_PUBLIC_FINGERPRINT_ENDPOINT,
38
+ scriptUrlPattern: process.env.NEXT_PUBLIC_FINGERPRINT_SCRIPT_URL,
39
+ };
40
+ }
@@ -26,5 +26,5 @@ interface PanelOnrampPaymentProps {
26
26
  recipientEnsName?: string;
27
27
  recipientImageUrl?: string;
28
28
  }
29
- export declare function PanelOnrampPayment({ srcAmountOnRamp, recipientAddress, isMainnet, isBuyMode, destinationTokenChainId, destinationTokenAddress, selectedDstChainId, selectedDstToken, anyspendQuote, globalAddress, onOrderCreated, onBack, orderType, nft, tournament, payload, recipientEnsName, recipientImageUrl, }: PanelOnrampPaymentProps): import("react/jsx-runtime").JSX.Element;
29
+ export declare function PanelOnrampPayment(props: PanelOnrampPaymentProps): import("react/jsx-runtime").JSX.Element;
30
30
  export {};
@@ -13,9 +13,13 @@ const invariant_1 = __importDefault(require("invariant"));
13
13
  const lucide_react_1 = require("lucide-react");
14
14
  const react_3 = require("react");
15
15
  const sonner_1 = require("sonner");
16
- function PanelOnrampPayment({ srcAmountOnRamp,
17
- // recipientName,
18
- recipientAddress, isMainnet, isBuyMode, destinationTokenChainId, destinationTokenAddress, selectedDstChainId, selectedDstToken, anyspendQuote, globalAddress, onOrderCreated, onBack, orderType, nft, tournament, payload, recipientEnsName, recipientImageUrl, }) {
16
+ const AnySpendFingerprintWrapper_1 = require("../AnySpendFingerprintWrapper");
17
+ function PanelOnrampPayment(props) {
18
+ const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
19
+ return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(PanelOnrampPaymentInner, { ...props }) }));
20
+ }
21
+ function PanelOnrampPaymentInner(props) {
22
+ const { srcAmountOnRamp, recipientAddress, isMainnet, isBuyMode, destinationTokenChainId, destinationTokenAddress, selectedDstChainId, selectedDstToken, anyspendQuote, globalAddress, onOrderCreated, onBack, orderType, nft, tournament, payload, recipientEnsName, recipientImageUrl, } = props;
19
23
  // Use a stable amount for geo onramp options to prevent unnecessary refetches
20
24
  const [stableAmountForGeo, setStableAmountForGeo] = (0, react_3.useState)(srcAmountOnRamp);
21
25
  const hasInitialized = (0, react_3.useRef)(false);
@@ -27,6 +31,7 @@ recipientAddress, isMainnet, isBuyMode, destinationTokenChainId, destinationToke
27
31
  }
28
32
  }, [srcAmountOnRamp]);
29
33
  const { geoData, coinbaseOnrampOptions, coinbaseAvailablePaymentMethods, isStripeOnrampSupported, isStripeWeb2Supported, isLoading: isLoadingGeoOnramp, } = (0, react_1.useGeoOnrampOptions)(isMainnet, stableAmountForGeo);
34
+ const isLoading = isLoadingGeoOnramp;
30
35
  const { createOrder, isCreatingOrder } = (0, react_1.useAnyspendCreateOnrampOrder)({
31
36
  onSuccess: data => {
32
37
  const orderId = data.data.id;
@@ -110,7 +115,7 @@ recipientAddress, isMainnet, isBuyMode, destinationTokenChainId, destinationToke
110
115
  ? "Receive NFT at"
111
116
  : orderType === "join_tournament"
112
117
  ? "Join for"
113
- : "Recipient" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [recipientImageUrl && ((0, jsx_runtime_1.jsx)("img", { src: recipientImageUrl, alt: recipientImageUrl, className: "bg-b3-react-foreground size-7 rounded-full object-cover opacity-100" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-end gap-1", children: [recipientEnsName && (0, jsx_runtime_1.jsxs)("span", { className: "text-b3-react-foreground/80", children: ["@", recipientEnsName] }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-react-foreground/80", children: (0, centerTruncate_1.default)(recipientAddress) })] })] })] })), (0, jsx_runtime_1.jsx)("div", { className: "border-b3-react-border border-t pt-3", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-b3-react-foreground font-semibold", children: "Amount" }), (0, jsx_runtime_1.jsxs)("p", { className: "text-b3-react-foreground hover:text-b3-react-foreground/80 cursor-pointer text-xl font-semibold transition-colors", onClick: onBack, children: ["$", parseFloat(srcAmountOnRamp).toFixed(2)] })] }) })] })] }), isCreatingOrder ? ((0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background border-b3-react-border flex items-center justify-center gap-3 rounded-lg border p-6", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70", children: "Creating onramp order..." })] })) : isLoadingGeoOnramp ? ((0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background border-b3-react-border flex items-center justify-center gap-3 rounded-lg border p-6", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70", children: "Loading payment options..." })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-3 flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-lg font-semibold", children: "Payment method" }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-1", children: coinbaseAvailablePaymentMethods.length > 0 &&
118
+ : "Recipient" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [recipientImageUrl && ((0, jsx_runtime_1.jsx)("img", { src: recipientImageUrl, alt: recipientImageUrl, className: "bg-b3-react-foreground size-7 rounded-full object-cover opacity-100" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-end gap-1", children: [recipientEnsName && (0, jsx_runtime_1.jsxs)("span", { className: "text-b3-react-foreground/80", children: ["@", recipientEnsName] }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-react-foreground/80", children: (0, centerTruncate_1.default)(recipientAddress) })] })] })] })), (0, jsx_runtime_1.jsx)("div", { className: "border-b3-react-border border-t pt-3", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-b3-react-foreground font-semibold", children: "Amount" }), (0, jsx_runtime_1.jsxs)("p", { className: "text-b3-react-foreground hover:text-b3-react-foreground/80 cursor-pointer text-xl font-semibold transition-colors", onClick: onBack, children: ["$", parseFloat(srcAmountOnRamp).toFixed(2)] })] }) })] })] }), isCreatingOrder ? ((0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background border-b3-react-border flex items-center justify-center gap-3 rounded-lg border p-6", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70", children: "Creating onramp order..." })] })) : isLoading ? ((0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background border-b3-react-border flex items-center justify-center gap-3 rounded-lg border p-6", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70", children: "Loading payment options..." })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-3 flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-lg font-semibold", children: "Payment method" }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-1", children: coinbaseAvailablePaymentMethods.length > 0 &&
114
119
  (() => {
115
120
  const hasCard = coinbaseAvailablePaymentMethods.some(m => m.id === "CARD");
116
121
  const hasApplePay = coinbaseAvailablePaymentMethods.some(m => m.id === "APPLE_PAY");
@@ -14,11 +14,13 @@ const react_stripe_js_1 = require("@stripe/react-stripe-js");
14
14
  const stripe_js_1 = require("@stripe/stripe-js");
15
15
  const lucide_react_1 = require("lucide-react");
16
16
  const react_3 = require("react");
17
+ const AnySpendFingerprintWrapper_1 = require("../AnySpendFingerprintWrapper");
17
18
  const HowItWorks_1 = __importDefault(require("./HowItWorks"));
18
19
  const PaymentMethodIcons_1 = __importDefault(require("./PaymentMethodIcons"));
19
20
  const stripePromise = (0, stripe_js_1.loadStripe)(constants_1.STRIPE_CONFIG.publishableKey);
20
21
  function PaymentStripeWeb2({ isMainnet, order, onPaymentSuccess }) {
21
22
  const { theme } = (0, react_2.useB3)();
23
+ const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
22
24
  const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } = (0, react_1.useStripeClientSecret)(isMainnet, order.stripePaymentIntentId);
23
25
  if (isLoadingStripeClientSecret) {
24
26
  return (0, jsx_runtime_1.jsx)(StripeLoadingState, {});
@@ -26,10 +28,10 @@ function PaymentStripeWeb2({ isMainnet, order, onPaymentSuccess }) {
26
28
  if (stripeClientSecretError) {
27
29
  return (0, jsx_runtime_1.jsx)(StripeErrorState, { error: stripeClientSecretError.message });
28
30
  }
29
- return ((0, jsx_runtime_1.jsx)(react_stripe_js_1.Elements, { stripe: stripePromise, options: {
30
- clientSecret: clientSecret || undefined,
31
- appearance: { theme: theme === "light" ? "stripe" : "night" },
32
- }, children: (0, jsx_runtime_1.jsx)(StripePaymentForm, { order: order, clientSecret: clientSecret, onPaymentSuccess: onPaymentSuccess }) }));
31
+ return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(react_stripe_js_1.Elements, { stripe: stripePromise, options: {
32
+ clientSecret: clientSecret || undefined,
33
+ appearance: { theme: theme === "light" ? "stripe" : "night" },
34
+ }, children: (0, jsx_runtime_1.jsx)(StripePaymentForm, { order: order, clientSecret: clientSecret, onPaymentSuccess: onPaymentSuccess }) }) }));
33
35
  }
34
36
  function StripeLoadingState() {
35
37
  return ((0, jsx_runtime_1.jsx)("div", { className: "relative my-8 flex w-full flex-1 flex-col items-center justify-center", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-on-surface-1 flex w-full flex-col items-center justify-center gap-4 rounded-2xl p-8", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-brand/20 flex h-16 w-16 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("div", { className: "text-as-brand h-8 w-8 animate-spin rounded-full border-2 border-current border-t-transparent" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "text-as-primary/70 text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-lg font-medium", children: "Initializing payment" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 mt-2 text-sm", children: "Setting up secure payment form..." })] })] }) }));
@@ -50,7 +52,6 @@ function StripePaymentForm({ order, clientSecret, onPaymentSuccess, }) {
50
52
  (0, react_3.useEffect)(() => {
51
53
  if (stripe && elements) {
52
54
  setStripeReady(true);
53
- console.log("@@stripe-web2-payment:initialized:", JSON.stringify({ orderId: order.id }, null, 2));
54
55
  }
55
56
  }, [stripe, elements, order.id]);
56
57
  (0, react_3.useEffect)(() => {
@@ -73,7 +74,6 @@ function StripePaymentForm({ order, clientSecret, onPaymentSuccess, }) {
73
74
  // Handle payment element changes
74
75
  const handlePaymentElementChange = (event) => {
75
76
  // Show address element only for card payments
76
- console.log("@@stripe-web2-payment:payment-element-change:", JSON.stringify(event, null, 2));
77
77
  setShowAddressElement(event.value.type === "card");
78
78
  };
79
79
  const handleSubmit = async (e) => {
@@ -85,7 +85,6 @@ function StripePaymentForm({ order, clientSecret, onPaymentSuccess, }) {
85
85
  setLoading(true);
86
86
  setMessage(null);
87
87
  try {
88
- console.log("@@stripe-web2-payment:confirming-payment:", JSON.stringify({ orderId: order.id }, null, 2));
89
88
  const result = (await stripe.confirmPayment({
90
89
  elements,
91
90
  confirmParams: {
@@ -124,8 +123,6 @@ function StripePaymentForm({ order, clientSecret, onPaymentSuccess, }) {
124
123
  const url = new URL(window.location.href);
125
124
  const fromStripe = url.searchParams.get("fromStripe");
126
125
  const paymentIntent = url.searchParams.get("payment_intent");
127
- console.log("@@stripe-web2-payment:fromStripe:", fromStripe);
128
- console.log("@@stripe-web2-payment:paymentIntent:", paymentIntent);
129
126
  if (fromStripe && paymentIntent) {
130
127
  // Close the modal as we're returning from 3DS
131
128
  setB3ModalOpen(true);
@@ -2,6 +2,7 @@ export { AnySpend } from "./AnySpend";
2
2
  export { AnySpendBondKit } from "./AnySpendBondKit";
3
3
  export { AnySpendBuySpin } from "./AnySpendBuySpin";
4
4
  export { AnySpendCustom } from "./AnySpendCustom";
5
+ export * from "./AnySpendFingerprintWrapper";
5
6
  export { AnySpendNFT } from "./AnySpendNFT";
6
7
  export { AnyspendSignatureMint } from "./AnyspendSignatureMint";
7
8
  export { AnySpendStakeB3 } from "./AnySpendStakeB3";
@@ -1,4 +1,18 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
17
  exports.WebviewOnrampPayment = exports.WebviewOnrampOrderStatus = exports.TokenBalance = exports.OrderTokenAmount = exports.OrderToken = exports.OrderStatus = exports.OrderHistoryItem = exports.OrderHistory = exports.OrderDetails = exports.ChainTokenIcon = exports.AnySpendNFTButton = exports.AnySpendTournament = exports.AnySpendStakeB3 = exports.AnyspendSignatureMint = exports.AnySpendNFT = exports.AnySpendCustom = exports.AnySpendBuySpin = exports.AnySpendBondKit = exports.AnySpend = void 0;
4
18
  // Components
@@ -10,6 +24,7 @@ var AnySpendBuySpin_1 = require("./AnySpendBuySpin");
10
24
  Object.defineProperty(exports, "AnySpendBuySpin", { enumerable: true, get: function () { return AnySpendBuySpin_1.AnySpendBuySpin; } });
11
25
  var AnySpendCustom_1 = require("./AnySpendCustom");
12
26
  Object.defineProperty(exports, "AnySpendCustom", { enumerable: true, get: function () { return AnySpendCustom_1.AnySpendCustom; } });
27
+ __exportStar(require("./AnySpendFingerprintWrapper"), exports);
13
28
  var AnySpendNFT_1 = require("./AnySpendNFT");
14
29
  Object.defineProperty(exports, "AnySpendNFT", { enumerable: true, get: function () { return AnySpendNFT_1.AnySpendNFT; } });
15
30
  var AnyspendSignatureMint_1 = require("./AnyspendSignatureMint");
@@ -9,5 +9,5 @@ interface WebviewOnrampPaymentProps {
9
9
  onPaymentSuccess: (orderId: string) => void;
10
10
  userId?: string;
11
11
  }
12
- export declare function WebviewOnrampPayment({ srcAmountOnRamp, recipientAddress, destinationToken, anyspendQuote, onPaymentSuccess, userId, partnerId, }: WebviewOnrampPaymentProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function WebviewOnrampPayment(props: WebviewOnrampPaymentProps): import("react/jsx-runtime").JSX.Element;
13
13
  export {};
@@ -15,7 +15,12 @@ const lucide_react_1 = require("lucide-react");
15
15
  const react_2 = require("react");
16
16
  const sonner_1 = require("sonner");
17
17
  const viem_1 = require("viem");
18
+ const AnySpendFingerprintWrapper_1 = require("../AnySpendFingerprintWrapper");
18
19
  const stripePromise = (0, stripe_js_1.loadStripe)(anyspend_1.STRIPE_CONFIG.publishableKey);
20
+ function WebviewOnrampPayment(props) {
21
+ const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
22
+ return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(WebviewOnrampPaymentInner, { ...props }) }));
23
+ }
19
24
  // Stripe Payment Form Component
20
25
  function StripePaymentForm({ order, onPaymentSuccess, }) {
21
26
  const stripe = (0, react_stripe_js_1.useStripe)();
@@ -85,7 +90,7 @@ function StripePaymentForm({ order, onPaymentSuccess, }) {
85
90
  },
86
91
  } }) })), error && ((0, jsx_runtime_1.jsx)("div", { className: "mt-4 rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error })), (0, jsx_runtime_1.jsx)("button", { type: "submit", disabled: !stripe || isProcessing, className: "mt-6 w-full rounded-xl bg-blue-600 px-4 py-3 font-medium text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50", children: isProcessing ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-5 w-5 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Processing..." })] })) : ((0, jsx_runtime_1.jsx)("span", { children: "Complete Payment" })) })] }) }) }));
87
92
  }
88
- function WebviewOnrampPayment({ srcAmountOnRamp, recipientAddress, destinationToken, anyspendQuote, onPaymentSuccess, userId, partnerId, }) {
93
+ function WebviewOnrampPaymentInner({ srcAmountOnRamp, recipientAddress, destinationToken, anyspendQuote, onPaymentSuccess, userId, partnerId, }) {
89
94
  const [stableAmountForGeo, setStableAmountForGeo] = (0, react_2.useState)(srcAmountOnRamp);
90
95
  const hasInitialized = (0, react_2.useRef)(false);
91
96
  const [createdOrder, setCreatedOrder] = (0, react_2.useState)(null);
@@ -1,5 +1,5 @@
1
- import { CreateOrderParams } from "./useAnyspendCreateOrder";
2
1
  import { components } from "../../../anyspend/types/api";
2
+ import { CreateOrderParams } from "./useAnyspendCreateOrder";
3
3
  export type OnrampOptions = {
4
4
  vendor: components["schemas"]["OnrampMetadata"]["vendor"];
5
5
  paymentMethod: string;
@@ -4,6 +4,7 @@ exports.useAnyspendCreateOnrampOrder = useAnyspendCreateOnrampOrder;
4
4
  const constants_1 = require("../../../anyspend/constants");
5
5
  const anyspend_1 = require("../../../anyspend/services/anyspend");
6
6
  const utils_1 = require("../../../anyspend/utils");
7
+ const fingerprintjs_pro_react_1 = require("@fingerprintjs/fingerprintjs-pro-react");
7
8
  const react_query_1 = require("@tanstack/react-query");
8
9
  const react_1 = require("react");
9
10
  const viem_1 = require("viem");
@@ -13,6 +14,12 @@ const chains_1 = require("viem/chains");
13
14
  * Specifically handles orders that involve fiat-to-crypto onramp functionality
14
15
  */
15
16
  function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
17
+ // Get fingerprint data
18
+ const { data: fpData } = (0, fingerprintjs_pro_react_1.useVisitorData)({ extendedResult: true }, { immediate: true });
19
+ const visitorData = fpData && {
20
+ requestId: fpData.requestId,
21
+ visitorId: fpData.visitorId,
22
+ };
16
23
  const { mutate: createOrder, isPending } = (0, react_query_1.useMutation)({
17
24
  mutationFn: async (params) => {
18
25
  const { isMainnet, recipientAddress, orderType, dstChain, dstToken, srcFiatAmount, onramp, creatorAddress, expectedDstAmount, nft, tournament, payload, partnerId, } = params;
@@ -45,7 +52,9 @@ function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
45
52
  expectedDstAmount,
46
53
  nft,
47
54
  tournament,
48
- payload,
55
+ payload: {
56
+ ...payload,
57
+ },
49
58
  }),
50
59
  onramp,
51
60
  metadata: (0, utils_1.buildMetadata)(orderType, {
@@ -55,10 +64,13 @@ function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
55
64
  expectedDstAmount,
56
65
  nft,
57
66
  tournament,
58
- payload,
67
+ payload: {
68
+ ...payload,
69
+ },
59
70
  }),
60
71
  creatorAddress: creatorAddress ? (0, utils_1.normalizeAddress)(creatorAddress) : undefined,
61
72
  partnerId,
73
+ visitorData,
62
74
  });
63
75
  }
64
76
  catch (error) {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useAnyspendCreateOrder = useAnyspendCreateOrder;
4
4
  const anyspend_1 = require("../../../anyspend/services/anyspend");
5
5
  const utils_1 = require("../../../anyspend/utils");
6
+ const fingerprintjs_pro_react_1 = require("@fingerprintjs/fingerprintjs-pro-react");
6
7
  const react_query_1 = require("@tanstack/react-query");
7
8
  const react_1 = require("react");
8
9
  /**
@@ -11,6 +12,12 @@ const react_1 = require("react");
11
12
  * For onramp orders, use useAnyspendCreateOnrampOrder instead.
12
13
  */
13
14
  function useAnyspendCreateOrder({ onSuccess, onError } = {}) {
15
+ // Get fingerprint data
16
+ const { data: fpData } = (0, fingerprintjs_pro_react_1.useVisitorData)({ extendedResult: true }, { immediate: true });
17
+ const visitorData = fpData && {
18
+ requestId: fpData.requestId,
19
+ visitorId: fpData.visitorId,
20
+ };
14
21
  const { mutate: createOrder, isPending } = (0, react_query_1.useMutation)({
15
22
  mutationFn: async (params) => {
16
23
  const { isMainnet, recipientAddress, orderType, srcChain, dstChain, srcToken, dstToken, srcAmount, creatorAddress, } = params;
@@ -31,7 +38,9 @@ function useAnyspendCreateOrder({ onSuccess, onError } = {}) {
31
38
  expectedDstAmount: params.expectedDstAmount,
32
39
  nft: params.nft,
33
40
  tournament: params.tournament,
34
- payload: params.payload,
41
+ payload: {
42
+ ...params.payload,
43
+ },
35
44
  }),
36
45
  metadata: (0, utils_1.buildMetadata)(orderType, {
37
46
  orderType,
@@ -40,9 +49,12 @@ function useAnyspendCreateOrder({ onSuccess, onError } = {}) {
40
49
  expectedDstAmount: params.expectedDstAmount,
41
50
  nft: params.nft,
42
51
  tournament: params.tournament,
43
- payload: params.payload,
52
+ payload: {
53
+ ...params.payload,
54
+ },
44
55
  }),
45
56
  creatorAddress: creatorAddress ? (0, utils_1.normalizeAddress)(creatorAddress) : undefined,
57
+ visitorData,
46
58
  });
47
59
  }
48
60
  catch (error) {
@@ -1,4 +1,5 @@
1
- export declare function useCoinbaseOnrampOptions(isMainnet: boolean, country?: string): {
1
+ import { VisitorData } from "../../../anyspend/types/fingerprint";
2
+ export declare function useCoinbaseOnrampOptions(isMainnet: boolean, country?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
2
3
  coinbaseOnrampOptions: {
3
4
  paymentCurrencies: {
4
5
  id?: string;
@@ -4,11 +4,11 @@ exports.useCoinbaseOnrampOptions = useCoinbaseOnrampOptions;
4
4
  const anyspend_1 = require("../../../anyspend/services/anyspend");
5
5
  const react_query_1 = require("@tanstack/react-query");
6
6
  const react_1 = require("react");
7
- function useCoinbaseOnrampOptions(isMainnet, country) {
7
+ function useCoinbaseOnrampOptions(isMainnet, country, visitorData, isLoadingVisitorData) {
8
8
  const { data, isLoading, error, refetch } = (0, react_query_1.useQuery)({
9
- queryKey: ["getCoinbaseOnrampOptions", isMainnet, country],
10
- queryFn: () => anyspend_1.anyspendService.getCoinbaseOnrampOptions(isMainnet, country),
11
- enabled: Boolean(country),
9
+ queryKey: ["getCoinbaseOnrampOptions", isMainnet, country, visitorData],
10
+ queryFn: () => anyspend_1.anyspendService.getCoinbaseOnrampOptions(isMainnet, country, visitorData),
11
+ enabled: Boolean(country) && !isLoadingVisitorData,
12
12
  });
13
13
  return (0, react_1.useMemo)(() => ({
14
14
  coinbaseOnrampOptions: data?.data,
@@ -33,7 +33,7 @@ export declare function useGeoOnrampOptions(isMainnet: boolean, srcFiatAmount: s
33
33
  isStripeOnrampSupported: boolean;
34
34
  isStripeWeb2Supported: boolean;
35
35
  isOnrampSupported: boolean;
36
- isLoading: boolean;
36
+ isLoading: boolean | undefined;
37
37
  isLoadingGeo: boolean;
38
38
  isLoadingCoinbaseOnrampOptions: boolean;
39
39
  isLoadingStripeSupport: boolean;
@@ -1,15 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useGeoOnrampOptions = useGeoOnrampOptions;
4
+ const fingerprintjs_pro_react_1 = require("@fingerprintjs/fingerprintjs-pro-react");
4
5
  const react_1 = require("react");
5
6
  const useCoinbaseOnrampOptions_1 = require("./useCoinbaseOnrampOptions");
6
7
  const useGetGeo_1 = require("./useGetGeo");
7
8
  const useStripeSupport_1 = require("./useStripeSupport");
8
9
  function useGeoOnrampOptions(isMainnet, srcFiatAmount) {
10
+ // Get fingerprint data
11
+ const { data: fpData, isLoading: isLoadingVisitorData } = (0, fingerprintjs_pro_react_1.useVisitorData)({ extendedResult: true }, { immediate: true });
12
+ const visitorData = fpData && {
13
+ requestId: fpData.requestId,
14
+ visitorId: fpData.visitorId,
15
+ };
9
16
  // Use existing hooks
10
17
  const { geoData, loading: isLoadingGeo, error: geoError } = (0, useGetGeo_1.useGetGeo)();
11
- const { coinbaseOnrampOptions, isLoadingCoinbaseOnrampOptions, coinbaseOnrampOptionsError } = (0, useCoinbaseOnrampOptions_1.useCoinbaseOnrampOptions)(isMainnet, geoData?.country);
12
- const { isStripeOnrampSupported, isStripeWeb2Supported, isLoadingStripeSupport, stripeSupportError } = (0, useStripeSupport_1.useStripeSupport)(isMainnet, geoData?.ip || "", srcFiatAmount);
18
+ const { coinbaseOnrampOptions, isLoadingCoinbaseOnrampOptions, coinbaseOnrampOptionsError } = (0, useCoinbaseOnrampOptions_1.useCoinbaseOnrampOptions)(isMainnet, geoData?.country, visitorData);
19
+ const { isStripeOnrampSupported, isStripeWeb2Supported, isLoadingStripeSupport, stripeSupportError } = (0, useStripeSupport_1.useStripeSupport)(isMainnet, geoData?.ip || "", srcFiatAmount, visitorData);
13
20
  // Calculate available payment methods based on the amount
14
21
  const coinbaseAvailablePaymentMethods = (0, react_1.useMemo)(() => {
15
22
  if (!coinbaseOnrampOptions?.paymentCurrencies?.[0]?.limits || !srcFiatAmount)
@@ -30,7 +37,7 @@ function useGeoOnrampOptions(isMainnet, srcFiatAmount) {
30
37
  isStripeOnrampSupported,
31
38
  isStripeWeb2Supported,
32
39
  isOnrampSupported: coinbaseAvailablePaymentMethods.length > 0 || isStripeOnrampSupported || isStripeWeb2Supported,
33
- isLoading: isLoadingGeo || isLoadingCoinbaseOnrampOptions || isLoadingStripeSupport,
40
+ isLoading: isLoadingGeo || isLoadingCoinbaseOnrampOptions || isLoadingStripeSupport || isLoadingVisitorData,
34
41
  isLoadingGeo,
35
42
  isLoadingCoinbaseOnrampOptions,
36
43
  isLoadingStripeSupport,
@@ -1,4 +1,5 @@
1
- export declare function useStripeSupport(isMainnet: boolean, ipAddress: string, usdAmount?: string): {
1
+ import { VisitorData } from "../../../anyspend/types/fingerprint";
2
+ export declare function useStripeSupport(isMainnet: boolean, ipAddress: string, usdAmount?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
2
3
  isStripeOnrampSupported: boolean;
3
4
  isStripeWeb2Supported: boolean;
4
5
  isLoadingStripeSupport: boolean;
@@ -4,11 +4,11 @@ exports.useStripeSupport = useStripeSupport;
4
4
  const anyspend_1 = require("../../../anyspend/services/anyspend");
5
5
  const react_query_1 = require("@tanstack/react-query");
6
6
  const react_1 = require("react");
7
- function useStripeSupport(isMainnet, ipAddress, usdAmount) {
7
+ function useStripeSupport(isMainnet, ipAddress, usdAmount, visitorData, isLoadingVisitorData) {
8
8
  const { data, isLoading, error, refetch } = (0, react_query_1.useQuery)({
9
- queryKey: ["useStripeSupport", isMainnet, ipAddress, usdAmount],
10
- queryFn: () => anyspend_1.anyspendService.checkStripeSupport(isMainnet, ipAddress, usdAmount),
11
- enabled: !!ipAddress,
9
+ queryKey: ["useStripeSupport", isMainnet, ipAddress, usdAmount, visitorData?.requestId, visitorData?.visitorId],
10
+ queryFn: () => anyspend_1.anyspendService.checkStripeSupport(isMainnet, ipAddress, usdAmount, visitorData),
11
+ enabled: !!ipAddress && !isLoadingVisitorData,
12
12
  });
13
13
  return (0, react_1.useMemo)(() => ({
14
14
  isStripeOnrampSupported: data?.stripeOnramp || false,
@@ -19,9 +19,6 @@ function StripeRedirectHandler() {
19
19
  const fromStripe = url.searchParams.get("fromStripe");
20
20
  const paymentIntent = url.searchParams.get("payment_intent");
21
21
  const orderId = url.searchParams.get("orderId");
22
- console.log("@@stripe-web2-payment:fromStripe:", fromStripe);
23
- console.log("@@stripe-web2-payment:paymentIntent:", paymentIntent);
24
- console.log("@@stripe-web2-payment:orderId:", orderId);
25
22
  if (fromStripe && paymentIntent && orderId) {
26
23
  // Re-open the modal with the order details
27
24
  setB3ModalOpen(true);
@@ -1,11 +1,12 @@
1
1
  import { OnrampOptions } from "../../anyspend/react";
2
- import { GetCoinbaseOnrampOptionsResponse, GetOrderAndTxsResponse, GetOrderHistoryResponse, GetQuoteRequest, GetQuoteResponse } from "../types/api_req_res";
3
2
  import { components } from "../types/api";
3
+ import { GetCoinbaseOnrampOptionsResponse, GetOrderAndTxsResponse, GetOrderHistoryResponse, GetQuoteRequest, GetQuoteResponse } from "../types/api_req_res";
4
+ import { VisitorData } from "../types/fingerprint";
4
5
  export declare const anyspendService: {
5
6
  getTokenList: (isMainnet: boolean, chainId: number, query: string) => Promise<components["schemas"]["Token"][]>;
6
7
  getToken: (isMainnet: boolean, chainId: number, tokenAddress: string) => Promise<components["schemas"]["Token"]>;
7
8
  getQuote: (isMainnet: boolean, req: GetQuoteRequest) => Promise<GetQuoteResponse>;
8
- createOrder: ({ isMainnet, recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, }: {
9
+ createOrder: ({ isMainnet, recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, visitorData, }: {
9
10
  isMainnet: boolean;
10
11
  recipientAddress: string;
11
12
  type: string;
@@ -19,6 +20,7 @@ export declare const anyspendService: {
19
20
  metadata: Record<string, any>;
20
21
  creatorAddress?: string;
21
22
  partnerId?: string;
23
+ visitorData?: VisitorData;
22
24
  }) => Promise<{
23
25
  success: boolean;
24
26
  message: string;
@@ -27,8 +29,8 @@ export declare const anyspendService: {
27
29
  }>;
28
30
  getOrderAndTransactions: (isMainnet: boolean, orderId: string | undefined) => Promise<GetOrderAndTxsResponse>;
29
31
  getOrderHistory: (isMainnet: boolean, creatorAddress: string | undefined, limit?: number, offset?: number) => Promise<GetOrderHistoryResponse>;
30
- getCoinbaseOnrampOptions: (isMainnet: boolean, country: string) => Promise<GetCoinbaseOnrampOptionsResponse>;
31
- checkStripeSupport: (isMainnet: boolean, ipAddress: string, usdAmount?: string) => Promise<{
32
+ getCoinbaseOnrampOptions: (isMainnet: boolean, country: string, visitorData?: VisitorData) => Promise<GetCoinbaseOnrampOptionsResponse>;
33
+ checkStripeSupport: (isMainnet: boolean, ipAddress: string, usdAmount?: string, visitorData?: VisitorData) => Promise<{
32
34
  stripeOnramp: boolean;
33
35
  stripeWeb2: boolean;
34
36
  }>;
@@ -41,11 +41,13 @@ exports.anyspendService = {
41
41
  return data;
42
42
  },
43
43
  // Order related
44
- createOrder: async ({ isMainnet, recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, }) => {
44
+ createOrder: async ({ isMainnet, recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, visitorData, }) => {
45
45
  const response = await fetch(`${isMainnet ? constants_1.ANYSPEND_MAINNET_BASE_URL : constants_1.ANYSPEND_TESTNET_BASE_URL}/orders`, {
46
46
  method: "POST",
47
47
  headers: {
48
48
  "Content-Type": "application/json",
49
+ ...(visitorData?.requestId && { "X-Fingerprint-Request-Id": visitorData.requestId }),
50
+ ...(visitorData?.visitorId && { "X-Fingerprint-Visitor-Id": visitorData.visitorId }),
49
51
  },
50
52
  body: JSON.stringify({
51
53
  recipientAddress,
@@ -83,20 +85,28 @@ exports.anyspendService = {
83
85
  const data = await response.json();
84
86
  return data;
85
87
  },
86
- getCoinbaseOnrampOptions: async (isMainnet, country) => {
88
+ getCoinbaseOnrampOptions: async (isMainnet, country, visitorData) => {
87
89
  const params = new URLSearchParams({
88
90
  country,
91
+ // include fingerprintId and requestId in the query params
92
+ ...(visitorData?.requestId && { requestId: visitorData.requestId }),
93
+ ...(visitorData?.visitorId && { fingerprintId: visitorData.visitorId }),
89
94
  });
90
95
  const response = await fetch(`${isMainnet ? constants_1.ANYSPEND_MAINNET_BASE_URL : constants_1.ANYSPEND_TESTNET_BASE_URL}/onramp/coinbase/options?${params.toString()}`);
91
96
  const data = await response.json();
92
97
  return data;
93
98
  },
94
- checkStripeSupport: async (isMainnet, ipAddress, usdAmount) => {
99
+ checkStripeSupport: async (isMainnet, ipAddress, usdAmount, visitorData) => {
95
100
  const params = new URLSearchParams({
96
101
  ipAddress,
97
102
  usdAmount: usdAmount || "",
98
103
  });
99
- const response = await fetch(`${isMainnet ? constants_1.ANYSPEND_MAINNET_BASE_URL : constants_1.ANYSPEND_TESTNET_BASE_URL}/onramp/stripe/supported?${params.toString()}`);
104
+ const response = await fetch(`${isMainnet ? constants_1.ANYSPEND_MAINNET_BASE_URL : constants_1.ANYSPEND_TESTNET_BASE_URL}/onramp/stripe/supported?${params.toString()}`, {
105
+ headers: {
106
+ ...(visitorData?.requestId && { "X-Fingerprint-Request-Id": visitorData.requestId }),
107
+ ...(visitorData?.visitorId && { "X-Fingerprint-Visitor-Id": visitorData.visitorId }),
108
+ },
109
+ });
100
110
  const data = await response.json();
101
111
  (0, invariant_1.default)(response.status === 200, "Failed to check Stripe support");
102
112
  return data.data;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Types related to FingerprintJS integration
3
+ * We only need requestId and visitorId from the full FingerprintJS visitor data
4
+ */
5
+ export interface VisitorData {
6
+ /**
7
+ * @description The unique identifier of the request to get visitor data
8
+ */
9
+ requestId: string;
10
+ /**
11
+ * @description The unique identifier of the visitor
12
+ */
13
+ visitorId: string;
14
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Types related to FingerprintJS integration
4
+ * We only need requestId and visitorId from the full FingerprintJS visitor data
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -4,7 +4,7 @@ export declare function useAuthentication(partnerId: string, loginWithSiwe?: boo
4
4
  isAuthenticating: boolean;
5
5
  isAuthenticated: boolean;
6
6
  isReady: boolean;
7
- wallet: import("thirdweb/wallets").Wallet<`ecosystem.${string}`>;
7
+ wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
8
8
  preAuthenticate: typeof preAuthenticate;
9
9
  connect: (strategyOptions?: import("thirdweb/wallets").SingleStepAuthArgsType) => Promise<import("thirdweb/wallets").Wallet | null>;
10
10
  };
@@ -25,7 +25,6 @@ function useTokenBalancesByChain({ address, chainsIds, enabled = true, }) {
25
25
  chain: (0, b3Chain_1.viemToThirdwebChain)((0, chains_1.getChainById)(chainId)),
26
26
  });
27
27
  return {
28
- chainId,
29
28
  ...walletBalance,
30
29
  };
31
30
  })),
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from "react";
2
+ interface FingerprintConfig {
3
+ apiKey: string;
4
+ endpoint?: string;
5
+ scriptUrlPattern?: string;
6
+ }
7
+ interface AnySpendFingerprintWrapperProps {
8
+ children: ReactNode;
9
+ fingerprint?: FingerprintConfig;
10
+ }
11
+ /**
12
+ * Internal wrapper that only initializes FingerprintJS when AnySpend components are actually used.
13
+ * This prevents unnecessary fingerprinting of users who don't interact with AnySpend.
14
+ */
15
+ export declare function AnySpendFingerprintWrapper({ children, fingerprint }: AnySpendFingerprintWrapperProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function getFingerprintConfig(): FingerprintConfig | undefined;
17
+ export {};