@voyage_ai/v402-web-ts 0.3.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -100,17 +100,21 @@ __export(wallet_exports, {
100
100
  clearAllWalletAddresses: () => clearAllWalletAddresses,
101
101
  clearWalletDisconnection: () => clearWalletDisconnection,
102
102
  formatAddress: () => formatAddress,
103
+ getAllConnectedWalletIds: () => getAllConnectedWalletIds,
103
104
  getAllWalletAddresses: () => getAllWalletAddresses,
104
105
  getCachedWalletAddress: () => getCachedWalletAddress,
105
106
  getConnectedNetworkType: () => getConnectedNetworkType,
107
+ getConnectedWalletId: () => getConnectedWalletId,
106
108
  getWalletDisplayName: () => getWalletDisplayName,
107
109
  getWalletInstallUrl: () => getWalletInstallUrl,
108
110
  getWalletProvider: () => getWalletProvider,
109
111
  isWalletInstalled: () => isWalletInstalled,
110
112
  isWalletManuallyDisconnected: () => isWalletManuallyDisconnected,
111
113
  markWalletDisconnected: () => markWalletDisconnected,
114
+ removeConnectedWalletId: () => removeConnectedWalletId,
112
115
  removeWalletAddress: () => removeWalletAddress,
113
116
  saveConnectedNetworkType: () => saveConnectedNetworkType,
117
+ saveConnectedWalletId: () => saveConnectedWalletId,
114
118
  saveWalletAddress: () => saveWalletAddress
115
119
  });
116
120
  function isWalletInstalled(networkType) {
@@ -263,7 +267,39 @@ function clearAllWalletAddresses() {
263
267
  localStorage.removeItem(WALLET_ADDRESSES_KEY);
264
268
  }
265
269
  }
266
- var WALLET_DISCONNECTED_KEY, WALLET_DISCONNECTED_NETWORKS_KEY, CONNECTED_NETWORK_TYPE_KEY, WALLET_ADDRESSES_KEY;
270
+ function getAllConnectedWalletIds() {
271
+ if (typeof window === "undefined") {
272
+ return {};
273
+ }
274
+ try {
275
+ const cached = localStorage.getItem(CONNECTED_WALLET_IDS_KEY);
276
+ return cached ? JSON.parse(cached) : {};
277
+ } catch (error) {
278
+ console.error("Failed to parse connected wallet IDs:", error);
279
+ return {};
280
+ }
281
+ }
282
+ function saveConnectedWalletId(networkType, walletId) {
283
+ if (typeof window === "undefined") {
284
+ return;
285
+ }
286
+ const walletIds = getAllConnectedWalletIds();
287
+ walletIds[networkType] = walletId;
288
+ localStorage.setItem(CONNECTED_WALLET_IDS_KEY, JSON.stringify(walletIds));
289
+ }
290
+ function getConnectedWalletId(networkType) {
291
+ const walletIds = getAllConnectedWalletIds();
292
+ return walletIds[networkType] || null;
293
+ }
294
+ function removeConnectedWalletId(networkType) {
295
+ if (typeof window === "undefined") {
296
+ return;
297
+ }
298
+ const walletIds = getAllConnectedWalletIds();
299
+ delete walletIds[networkType];
300
+ localStorage.setItem(CONNECTED_WALLET_IDS_KEY, JSON.stringify(walletIds));
301
+ }
302
+ var WALLET_DISCONNECTED_KEY, WALLET_DISCONNECTED_NETWORKS_KEY, CONNECTED_NETWORK_TYPE_KEY, WALLET_ADDRESSES_KEY, CONNECTED_WALLET_IDS_KEY;
267
303
  var init_wallet = __esm({
268
304
  "src/utils/wallet.ts"() {
269
305
  "use strict";
@@ -271,6 +307,7 @@ var init_wallet = __esm({
271
307
  WALLET_DISCONNECTED_NETWORKS_KEY = "wallet_disconnected_networks";
272
308
  CONNECTED_NETWORK_TYPE_KEY = "connected_network_type";
273
309
  WALLET_ADDRESSES_KEY = "wallet_addresses_cache";
310
+ CONNECTED_WALLET_IDS_KEY = "connected_wallet_ids";
274
311
  }
275
312
  });
276
313
 
@@ -287,13 +324,13 @@ init_wallet();
287
324
  init_wallet();
288
325
  async function connectWallet(networkType, forceSelect = false) {
289
326
  if (typeof window === "undefined") {
290
- throw new Error("\u8BF7\u5728\u6D4F\u89C8\u5668\u73AF\u5883\u4E2D\u4F7F\u7528");
327
+ throw new Error("Please use in browser environment");
291
328
  }
292
329
  let address;
293
330
  switch (networkType) {
294
331
  case "evm" /* EVM */: {
295
332
  if (!window.ethereum) {
296
- throw new Error("\u8BF7\u5B89\u88C5 MetaMask \u6216\u5176\u4ED6\u4EE5\u592A\u574A\u94B1\u5305");
333
+ throw new Error("Please install MetaMask or another Ethereum wallet");
297
334
  }
298
335
  const ethereum = window.ethereum;
299
336
  if (forceSelect) {
@@ -311,7 +348,7 @@ async function connectWallet(networkType, forceSelect = false) {
311
348
  }
312
349
  } catch (err) {
313
350
  if (err.code === 4001) {
314
- throw new Error("\u7528\u6237\u53D6\u6D88\u4E86\u94B1\u5305\u8FDE\u63A5");
351
+ throw new Error("User cancelled wallet connection");
315
352
  }
316
353
  console.warn("wallet_requestPermissions failed, falling back to eth_requestAccounts");
317
354
  }
@@ -321,7 +358,7 @@ async function connectWallet(networkType, forceSelect = false) {
321
358
  params: []
322
359
  });
323
360
  if (!accounts || accounts.length === 0) {
324
- throw new Error("\u672A\u80FD\u83B7\u53D6\u5230\u94B1\u5305\u5730\u5740");
361
+ throw new Error("Failed to get wallet address");
325
362
  }
326
363
  address = accounts[0];
327
364
  break;
@@ -335,7 +372,7 @@ async function connectWallet(networkType, forceSelect = false) {
335
372
  solana = solflare;
336
373
  }
337
374
  if (!solana) {
338
- throw new Error("\u8BF7\u5B89\u88C5 Phantom \u6216\u5176\u4ED6 Solana \u94B1\u5305");
375
+ throw new Error("Please install Phantom or another Solana wallet");
339
376
  }
340
377
  if (forceSelect) {
341
378
  try {
@@ -361,7 +398,7 @@ async function connectWallet(networkType, forceSelect = false) {
361
398
  break;
362
399
  }
363
400
  default:
364
- throw new Error("\u4E0D\u652F\u6301\u7684\u7F51\u7EDC\u7C7B\u578B");
401
+ throw new Error("Unsupported network type");
365
402
  }
366
403
  clearWalletDisconnection(networkType);
367
404
  saveConnectedNetworkType(networkType);
@@ -399,8 +436,8 @@ async function disconnectWallet(networkType, clearAll = false) {
399
436
  await disconnectAllSolanaWallets();
400
437
  break;
401
438
  }
402
- // EVM 钱包(如 MetaMask)没有真正的 disconnect API
403
- // 只清除本地状态,下次连接时会重新请求权限
439
+ // EVM wallets (like MetaMask) don't have a real disconnect API
440
+ // Only clear local state, will request permissions again on next connection
404
441
  case "evm" /* EVM */:
405
442
  default:
406
443
  break;
@@ -431,36 +468,32 @@ async function getCurrentWallet(networkType) {
431
468
  return null;
432
469
  }
433
470
  const cachedAddress = getCachedWalletAddress(type);
434
- try {
435
- let currentAddress = null;
436
- switch (type) {
437
- case "evm" /* EVM */: {
438
- if (!window.ethereum) return cachedAddress;
471
+ if (type === "evm" /* EVM */) {
472
+ if (cachedAddress) {
473
+ return cachedAddress;
474
+ }
475
+ if (window.ethereum) {
476
+ try {
439
477
  const accounts = await window.ethereum.request({
440
478
  method: "eth_accounts",
441
479
  params: []
442
480
  });
443
- currentAddress = accounts && accounts.length > 0 ? accounts[0] : null;
444
- break;
445
- }
446
- case "solana" /* SOLANA */:
447
- case "svm" /* SVM */: {
448
- const solana = window.solana;
449
- if (!solana || !solana.isConnected) return cachedAddress;
450
- currentAddress = solana.publicKey?.toString() || null;
451
- break;
481
+ return accounts && accounts.length > 0 ? accounts[0] : null;
482
+ } catch (error) {
483
+ console.error("Failed to get EVM accounts:", error);
484
+ return null;
452
485
  }
453
- default:
454
- return cachedAddress;
455
486
  }
456
- if (currentAddress && currentAddress !== cachedAddress) {
457
- saveWalletAddress(type, currentAddress);
487
+ return null;
488
+ }
489
+ if (type === "solana" /* SOLANA */ || type === "svm" /* SVM */) {
490
+ const solana = window.solana;
491
+ if (!solana || !solana.isConnected) {
492
+ return cachedAddress;
458
493
  }
459
- return currentAddress || cachedAddress;
460
- } catch (error) {
461
- console.error("Failed to get current wallet:", error);
462
- return cachedAddress;
494
+ return solana.publicKey?.toString() || cachedAddress;
463
495
  }
496
+ return cachedAddress;
464
497
  }
465
498
  function onAccountsChanged(callback) {
466
499
  if (typeof window === "undefined" || !window.ethereum) {
@@ -524,6 +557,7 @@ async function switchNetwork(networkType) {
524
557
  }
525
558
 
526
559
  // src/utils/wallet-discovery.ts
560
+ init_wallet();
527
561
  var SOLANA_WALLETS = [
528
562
  {
529
563
  id: "phantom",
@@ -669,22 +703,26 @@ function getWalletsForNetwork(networkType) {
669
703
  return [];
670
704
  }
671
705
  }
706
+ function getWalletByName(name, networkType) {
707
+ const wallets = getWalletsForNetwork(networkType);
708
+ return wallets.find((w) => w.name === name) || null;
709
+ }
672
710
  async function connectEVMWallet(wallet) {
673
711
  if (!wallet.provider) {
674
- throw new Error(`\u94B1\u5305 ${wallet.name} \u4E0D\u53EF\u7528`);
712
+ throw new Error(`Wallet ${wallet.name} is not available`);
675
713
  }
676
714
  const accounts = await wallet.provider.request({
677
715
  method: "eth_requestAccounts",
678
716
  params: []
679
717
  });
680
718
  if (!accounts || accounts.length === 0) {
681
- throw new Error("\u672A\u80FD\u83B7\u53D6\u5230\u94B1\u5305\u5730\u5740");
719
+ throw new Error("Failed to get wallet address");
682
720
  }
683
721
  return accounts[0];
684
722
  }
685
723
  async function connectSolanaWallet(wallet) {
686
724
  if (!wallet.provider) {
687
- throw new Error(`\u94B1\u5305 ${wallet.name} \u4E0D\u53EF\u7528`);
725
+ throw new Error(`Wallet ${wallet.name} is not available`);
688
726
  }
689
727
  if (wallet.provider.isConnected) {
690
728
  try {
@@ -707,21 +745,41 @@ async function connectToWallet(wallet) {
707
745
  address = await connectSolanaWallet(wallet);
708
746
  break;
709
747
  default:
710
- throw new Error("\u4E0D\u652F\u6301\u7684\u7F51\u7EDC\u7C7B\u578B");
748
+ throw new Error("Unsupported network type");
711
749
  }
712
750
  currentConnectedWallet = wallet;
751
+ saveConnectedWalletId(wallet.networkType, wallet.name);
713
752
  return address;
714
753
  }
715
754
  function setCurrentConnectedWallet(wallet) {
716
755
  currentConnectedWallet = wallet;
717
756
  }
718
- function clearConnectedWallet() {
757
+ function clearConnectedWallet(networkType) {
758
+ if (networkType) {
759
+ removeConnectedWalletId(networkType);
760
+ }
719
761
  currentConnectedWallet = null;
720
762
  }
763
+ function restoreConnectedWallet(networkType) {
764
+ const savedWalletName = getConnectedWalletId(networkType);
765
+ if (!savedWalletName) return null;
766
+ const wallet = getWalletByName(savedWalletName, networkType);
767
+ if (wallet) {
768
+ currentConnectedWallet = wallet;
769
+ console.log(`\u2705 Restored wallet provider: ${wallet.name}`);
770
+ return wallet;
771
+ }
772
+ console.warn(`\u26A0\uFE0F Could not find wallet with name: ${savedWalletName}`);
773
+ return null;
774
+ }
721
775
  function getWalletProviderForPayment(networkType) {
722
776
  if (currentConnectedWallet && currentConnectedWallet.networkType === networkType) {
723
777
  return currentConnectedWallet.provider;
724
778
  }
779
+ const restoredWallet = restoreConnectedWallet(networkType);
780
+ if (restoredWallet) {
781
+ return restoredWallet.provider;
782
+ }
725
783
  if (typeof window === "undefined") return null;
726
784
  switch (networkType) {
727
785
  case "evm" /* EVM */:
@@ -1221,7 +1279,7 @@ function getSupportedNetworkTypes(paymentRequirements) {
1221
1279
  });
1222
1280
  return Array.from(networkTypes);
1223
1281
  }
1224
- async function makePayment(networkType, merchantId, endpoint = PROD_BACK_URL, additionalParams) {
1282
+ async function makePayment(networkType, merchantId, endpoint = PROD_BACK_URL, additionalParams, expectedAddress) {
1225
1283
  const fullEndpoint = `${endpoint}/${merchantId}`;
1226
1284
  let response;
1227
1285
  const requestInit = additionalParams && Object.keys(additionalParams).length > 0 ? {
@@ -1233,11 +1291,19 @@ async function makePayment(networkType, merchantId, endpoint = PROD_BACK_URL, ad
1233
1291
  if (networkType === "solana" /* SOLANA */ || networkType === "svm" /* SVM */) {
1234
1292
  const solana = getWalletProviderForPayment(networkType);
1235
1293
  if (!solana) {
1236
- throw new Error("\u8BF7\u5148\u8FDE\u63A5 Solana \u94B1\u5305");
1294
+ throw new Error("Please connect your Solana wallet first.");
1237
1295
  }
1238
1296
  if (!solana.isConnected) {
1239
1297
  await solana.connect();
1240
1298
  }
1299
+ if (expectedAddress && solana.publicKey) {
1300
+ const currentAddress = solana.publicKey.toString();
1301
+ if (currentAddress !== expectedAddress) {
1302
+ throw new Error(
1303
+ `Wallet account mismatch: the current wallet account is ${currentAddress.slice(0, 8)}...\uFF0CBut the desired account is ${expectedAddress.slice(0, 8)}.... Please switch to the correct account in your wallet.`
1304
+ );
1305
+ }
1306
+ }
1241
1307
  response = await handleSvmPayment(fullEndpoint, {
1242
1308
  wallet: solana,
1243
1309
  network: "solana"
@@ -1246,12 +1312,18 @@ async function makePayment(networkType, merchantId, endpoint = PROD_BACK_URL, ad
1246
1312
  } else if (networkType === "evm" /* EVM */) {
1247
1313
  const ethereum = getWalletProviderForPayment(networkType);
1248
1314
  if (!ethereum) {
1249
- throw new Error("\u8BF7\u5148\u8FDE\u63A5 EVM \u94B1\u5305");
1315
+ throw new Error("Please connect the EVM wallet first");
1250
1316
  }
1251
1317
  const provider = new ethers2.BrowserProvider(ethereum);
1252
1318
  const signer = await provider.getSigner();
1319
+ const currentAddress = await signer.getAddress();
1320
+ if (expectedAddress && currentAddress.toLowerCase() !== expectedAddress.toLowerCase()) {
1321
+ throw new Error(
1322
+ `Wallet account mismatch: the current wallet account is ${currentAddress.slice(0, 8)}...\uFF0CBut the desired account is ${expectedAddress.slice(0, 8)}.... Please switch to the correct account in your wallet.`
1323
+ );
1324
+ }
1253
1325
  const wallet = {
1254
- address: await signer.getAddress(),
1326
+ address: currentAddress,
1255
1327
  signTypedData: async (domain, types, message2) => {
1256
1328
  return await signer.signTypedData(domain, types, message2);
1257
1329
  },
@@ -1274,7 +1346,7 @@ async function makePayment(networkType, merchantId, endpoint = PROD_BACK_URL, ad
1274
1346
  // Will use backend's network configuration
1275
1347
  }, requestInit);
1276
1348
  } else {
1277
- throw new Error(`\u4E0D\u652F\u6301\u7684\u7F51\u7EDC\u7C7B\u578B: ${networkType}`);
1349
+ throw new Error(`Unsupported network types: ${networkType}`);
1278
1350
  }
1279
1351
  return response;
1280
1352
  }
@@ -1617,7 +1689,7 @@ var WalletStore = class {
1617
1689
  // Disconnect wallet
1618
1690
  async disconnect() {
1619
1691
  const currentNetwork = this.state.networkType;
1620
- clearConnectedWallet();
1692
+ clearConnectedWallet(currentNetwork || void 0);
1621
1693
  if (currentNetwork) {
1622
1694
  try {
1623
1695
  await disconnectWallet(currentNetwork);
@@ -1776,12 +1848,83 @@ function usePaymentInfo(merchantId, endpoint = PROD_BACK_URL, additionalParams)
1776
1848
  };
1777
1849
  }
1778
1850
 
1779
- // src/react/components/WalletConnect.tsx
1780
- import React2, { useState as useState4 } from "react";
1851
+ // src/react/hooks/useToast.tsx
1852
+ import React2, { useCallback as useCallback2, useRef, useState as useState3 } from "react";
1781
1853
 
1782
- // src/react/components/WalletSelectModal.tsx
1783
- import React, { useEffect as useEffect3, useState as useState3 } from "react";
1854
+ // src/react/components/ui/Toast.tsx
1855
+ import React, { useEffect as useEffect3 } from "react";
1784
1856
  import { createPortal } from "react-dom";
1857
+ var Toast = ({ message: message2, type, onClose }) => {
1858
+ useEffect3(() => {
1859
+ const timer = setTimeout(onClose, 3e3);
1860
+ return () => clearTimeout(timer);
1861
+ }, [onClose]);
1862
+ const bgColor = type === "success" ? "#22c55e" : type === "error" ? "#ef4444" : "#3b82f6";
1863
+ const icon = type === "success" ? "\u2713" : type === "error" ? "\u2717" : "\u2139";
1864
+ return createPortal(
1865
+ /* @__PURE__ */ React.createElement(
1866
+ "div",
1867
+ {
1868
+ className: "fixed top-4 right-4 z-[99999] animate-slide-in-right",
1869
+ style: {
1870
+ animation: "slideInRight 0.3s ease-out"
1871
+ }
1872
+ },
1873
+ /* @__PURE__ */ React.createElement(
1874
+ "div",
1875
+ {
1876
+ className: "flex items-center gap-3 px-4 py-3 rounded-lg shadow-lg text-white font-mono text-sm",
1877
+ style: { backgroundColor: bgColor, minWidth: "280px" }
1878
+ },
1879
+ /* @__PURE__ */ React.createElement("span", { className: "text-lg" }, icon),
1880
+ /* @__PURE__ */ React.createElement("span", { className: "flex-1" }, message2),
1881
+ /* @__PURE__ */ React.createElement(
1882
+ "button",
1883
+ {
1884
+ onClick: onClose,
1885
+ className: "text-white/80 hover:text-white transition-colors"
1886
+ },
1887
+ "\xD7"
1888
+ )
1889
+ )
1890
+ ),
1891
+ document.body
1892
+ );
1893
+ };
1894
+
1895
+ // src/react/hooks/useToast.tsx
1896
+ var useToast = () => {
1897
+ const [toasts, setToasts] = useState3([]);
1898
+ const toastIdRef = useRef(0);
1899
+ const showToast = useCallback2((message2, type) => {
1900
+ const id = ++toastIdRef.current;
1901
+ setToasts((prev) => [...prev, { id, message: message2, type }]);
1902
+ }, []);
1903
+ const removeToast = useCallback2((id) => {
1904
+ setToasts((prev) => prev.filter((t) => t.id !== id));
1905
+ }, []);
1906
+ const ToastContainer = () => /* @__PURE__ */ React2.createElement(React2.Fragment, null, toasts.map((toast, index) => /* @__PURE__ */ React2.createElement(
1907
+ "div",
1908
+ {
1909
+ key: toast.id,
1910
+ style: { top: `${16 + index * 60}px` },
1911
+ className: "fixed right-4 z-[99999]"
1912
+ },
1913
+ React2.createElement(Toast, {
1914
+ message: toast.message,
1915
+ type: toast.type,
1916
+ onClose: () => removeToast(toast.id)
1917
+ })
1918
+ )));
1919
+ return { showToast, ToastContainer };
1920
+ };
1921
+
1922
+ // src/react/components/wallet/WalletConnect.tsx
1923
+ import React4, { useState as useState5 } from "react";
1924
+
1925
+ // src/react/components/wallet/WalletSelectModal.tsx
1926
+ import React3, { useEffect as useEffect4, useState as useState4 } from "react";
1927
+ import { createPortal as createPortal2 } from "react-dom";
1785
1928
  var overlayStyle = {
1786
1929
  position: "fixed",
1787
1930
  top: 0,
@@ -1919,8 +2062,8 @@ function WalletItem({
1919
2062
  onSelect,
1920
2063
  onHover
1921
2064
  }) {
1922
- const [iconError, setIconError] = useState3(false);
1923
- return /* @__PURE__ */ React.createElement(
2065
+ const [iconError, setIconError] = useState4(false);
2066
+ return /* @__PURE__ */ React3.createElement(
1924
2067
  "div",
1925
2068
  {
1926
2069
  style: getWalletItemStyle(isHovered),
@@ -1928,7 +2071,7 @@ function WalletItem({
1928
2071
  onMouseEnter: () => onHover(true),
1929
2072
  onMouseLeave: () => onHover(false)
1930
2073
  },
1931
- wallet.icon && !iconError ? /* @__PURE__ */ React.createElement(
2074
+ wallet.icon && !iconError ? /* @__PURE__ */ React3.createElement(
1932
2075
  "img",
1933
2076
  {
1934
2077
  src: wallet.icon,
@@ -1936,8 +2079,8 @@ function WalletItem({
1936
2079
  style: walletIconStyle,
1937
2080
  onError: () => setIconError(true)
1938
2081
  }
1939
- ) : /* @__PURE__ */ React.createElement("div", { style: getWalletIconPlaceholderStyle(wallet.name) }, wallet.name.charAt(0).toUpperCase()),
1940
- /* @__PURE__ */ React.createElement("span", { style: walletNameStyle }, wallet.name)
2082
+ ) : /* @__PURE__ */ React3.createElement("div", { style: getWalletIconPlaceholderStyle(wallet.name) }, wallet.name.charAt(0).toUpperCase()),
2083
+ /* @__PURE__ */ React3.createElement("span", { style: walletNameStyle }, wallet.name)
1941
2084
  );
1942
2085
  }
1943
2086
  function WalletSelectModal({
@@ -1946,14 +2089,14 @@ function WalletSelectModal({
1946
2089
  onSelect,
1947
2090
  onClose
1948
2091
  }) {
1949
- const [wallets, setWallets] = useState3([]);
1950
- const [hoveredWallet, setHoveredWallet] = useState3(null);
1951
- const [mounted, setMounted] = useState3(false);
1952
- useEffect3(() => {
2092
+ const [wallets, setWallets] = useState4([]);
2093
+ const [hoveredWallet, setHoveredWallet] = useState4(null);
2094
+ const [mounted, setMounted] = useState4(false);
2095
+ useEffect4(() => {
1953
2096
  setMounted(true);
1954
2097
  return () => setMounted(false);
1955
2098
  }, []);
1956
- useEffect3(() => {
2099
+ useEffect4(() => {
1957
2100
  if (!isOpen) return;
1958
2101
  initEVMWalletDiscovery();
1959
2102
  const updateWallets = () => {
@@ -1974,7 +2117,7 @@ function WalletSelectModal({
1974
2117
  }
1975
2118
  };
1976
2119
  const networkName = getNetworkDisplayName(networkType);
1977
- const modalContent = /* @__PURE__ */ React.createElement("div", { style: overlayStyle, onClick: handleOverlayClick }, /* @__PURE__ */ React.createElement("div", { style: modalStyle }, /* @__PURE__ */ React.createElement("div", { style: headerStyle }, /* @__PURE__ */ React.createElement("h3", { style: titleStyle }, "Select Wallet"), /* @__PURE__ */ React.createElement("button", { style: closeButtonStyle, onClick: onClose }, "\xD7")), /* @__PURE__ */ React.createElement("p", { style: subtitleStyle }, "Connect a ", networkName, " wallet"), wallets.length > 0 ? /* @__PURE__ */ React.createElement("div", { style: walletListStyle }, wallets.map((wallet) => /* @__PURE__ */ React.createElement(
2120
+ const modalContent = /* @__PURE__ */ React3.createElement("div", { style: overlayStyle, onClick: handleOverlayClick }, /* @__PURE__ */ React3.createElement("div", { style: modalStyle }, /* @__PURE__ */ React3.createElement("div", { style: headerStyle }, /* @__PURE__ */ React3.createElement("h3", { style: titleStyle }, "Select Wallet"), /* @__PURE__ */ React3.createElement("button", { style: closeButtonStyle, onClick: onClose }, "\xD7")), /* @__PURE__ */ React3.createElement("p", { style: subtitleStyle }, "Connect a ", networkName, " wallet"), wallets.length > 0 ? /* @__PURE__ */ React3.createElement("div", { style: walletListStyle }, wallets.map((wallet) => /* @__PURE__ */ React3.createElement(
1978
2121
  WalletItem,
1979
2122
  {
1980
2123
  key: wallet.id,
@@ -1983,9 +2126,9 @@ function WalletSelectModal({
1983
2126
  onSelect: () => onSelect(wallet),
1984
2127
  onHover: (hovered) => setHoveredWallet(hovered ? wallet.id : null)
1985
2128
  }
1986
- ))) : /* @__PURE__ */ React.createElement("div", { style: emptyStateStyle }, /* @__PURE__ */ React.createElement("p", { style: emptyTitleStyle }, "No wallets found"), /* @__PURE__ */ React.createElement("p", { style: emptyDescStyle }, "Please install a ", networkName, " wallet extension."))));
2129
+ ))) : /* @__PURE__ */ React3.createElement("div", { style: emptyStateStyle }, /* @__PURE__ */ React3.createElement("p", { style: emptyTitleStyle }, "No wallets found"), /* @__PURE__ */ React3.createElement("p", { style: emptyDescStyle }, "Please install a ", networkName, " wallet extension."))));
1987
2130
  if (typeof document !== "undefined") {
1988
- return createPortal(modalContent, document.body);
2131
+ return createPortal2(modalContent, document.body);
1989
2132
  }
1990
2133
  return modalContent;
1991
2134
  }
@@ -2157,7 +2300,7 @@ var getErrorStyle = () => {
2157
2300
  };
2158
2301
  };
2159
2302
 
2160
- // src/react/components/WalletConnect.tsx
2303
+ // src/react/components/wallet/WalletConnect.tsx
2161
2304
  function WalletConnect({
2162
2305
  supportedNetworks = ["solana" /* SOLANA */, "evm" /* EVM */],
2163
2306
  className = "",
@@ -2166,9 +2309,9 @@ function WalletConnect({
2166
2309
  showSwitchWallet = true
2167
2310
  }) {
2168
2311
  const { address, networkType, isConnecting, error, connectWithWallet, disconnect } = useWallet();
2169
- const [hoveredButton, setHoveredButton] = useState4(null);
2170
- const [walletSelectOpen, setWalletSelectOpen] = useState4(false);
2171
- const [selectedNetworkType, setSelectedNetworkType] = useState4(null);
2312
+ const [hoveredButton, setHoveredButton] = useState5(null);
2313
+ const [walletSelectOpen, setWalletSelectOpen] = useState5(false);
2314
+ const [selectedNetworkType, setSelectedNetworkType] = useState5(null);
2172
2315
  const handleOpenWalletSelect = (network) => {
2173
2316
  setSelectedNetworkType(network);
2174
2317
  setWalletSelectOpen(true);
@@ -2190,7 +2333,7 @@ function WalletConnect({
2190
2333
  setWalletSelectOpen(true);
2191
2334
  }
2192
2335
  };
2193
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("div", { style: { ...containerStyle, ...className ? {} : {} }, className }, !address ? /* @__PURE__ */ React2.createElement("div", { style: getSectionStyle() }, /* @__PURE__ */ React2.createElement("h3", { style: getTitleStyle() }, "Connect Wallet"), supportedNetworks.length === 0 ? /* @__PURE__ */ React2.createElement("p", { style: getHintStyle() }, "Please install a supported wallet extension") : /* @__PURE__ */ React2.createElement("div", { style: buttonsContainerStyle }, supportedNetworks.map((network) => /* @__PURE__ */ React2.createElement("div", { key: network, style: walletOptionStyle }, /* @__PURE__ */ React2.createElement(
2336
+ return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement("div", { style: { ...containerStyle, ...className ? {} : {} }, className }, !address ? /* @__PURE__ */ React4.createElement("div", { style: getSectionStyle() }, /* @__PURE__ */ React4.createElement("h3", { style: getTitleStyle() }, "Connect Wallet"), supportedNetworks.length === 0 ? /* @__PURE__ */ React4.createElement("p", { style: getHintStyle() }, "Please install a supported wallet extension") : /* @__PURE__ */ React4.createElement("div", { style: buttonsContainerStyle }, supportedNetworks.map((network) => /* @__PURE__ */ React4.createElement("div", { key: network, style: walletOptionStyle }, /* @__PURE__ */ React4.createElement(
2194
2337
  "button",
2195
2338
  {
2196
2339
  style: getConnectButtonStyle(isConnecting, hoveredButton === network),
@@ -2200,7 +2343,7 @@ function WalletConnect({
2200
2343
  onMouseLeave: () => setHoveredButton(null)
2201
2344
  },
2202
2345
  isConnecting ? "Connecting..." : getNetworkDisplayName(network)
2203
- )))), error && /* @__PURE__ */ React2.createElement("p", { style: getErrorStyle() }, error), /* @__PURE__ */ React2.createElement("p", { style: getHintStyle() }, "Select a network to see available wallets")) : /* @__PURE__ */ React2.createElement("div", { style: getSectionStyle() }, /* @__PURE__ */ React2.createElement("div", { style: walletAddressStyle }, /* @__PURE__ */ React2.createElement("span", { style: getLabelStyle() }, "Connected ", networkType && `(${getNetworkDisplayName(networkType)})`), /* @__PURE__ */ React2.createElement("span", { style: getAddressStyle() }, formatAddress(address))), /* @__PURE__ */ React2.createElement("div", { style: walletActionsStyle }, showSwitchWallet && /* @__PURE__ */ React2.createElement(
2346
+ )))), error && /* @__PURE__ */ React4.createElement("p", { style: getErrorStyle() }, error), /* @__PURE__ */ React4.createElement("p", { style: getHintStyle() }, "Select a network to see available wallets")) : /* @__PURE__ */ React4.createElement("div", { style: getSectionStyle() }, /* @__PURE__ */ React4.createElement("div", { style: walletAddressStyle }, /* @__PURE__ */ React4.createElement("span", { style: getLabelStyle() }, "Connected ", networkType && `(${getNetworkDisplayName(networkType)})`), /* @__PURE__ */ React4.createElement("span", { style: getAddressStyle() }, formatAddress(address))), /* @__PURE__ */ React4.createElement("div", { style: walletActionsStyle }, showSwitchWallet && /* @__PURE__ */ React4.createElement(
2204
2347
  "button",
2205
2348
  {
2206
2349
  style: getConnectButtonStyle(isConnecting, hoveredButton === "switch"),
@@ -2210,7 +2353,7 @@ function WalletConnect({
2210
2353
  onMouseLeave: () => setHoveredButton(null)
2211
2354
  },
2212
2355
  isConnecting ? "Switching..." : "Switch Wallet"
2213
- ), /* @__PURE__ */ React2.createElement(
2356
+ ), /* @__PURE__ */ React4.createElement(
2214
2357
  "button",
2215
2358
  {
2216
2359
  style: getDisconnectButtonStyle(hoveredButton === "disconnect"),
@@ -2219,7 +2362,7 @@ function WalletConnect({
2219
2362
  onMouseLeave: () => setHoveredButton(null)
2220
2363
  },
2221
2364
  "Disconnect"
2222
- )), /* @__PURE__ */ React2.createElement("p", { style: getHintStyle() }, 'Click "Switch Wallet" to change wallet or account'))), selectedNetworkType && /* @__PURE__ */ React2.createElement(
2365
+ )), /* @__PURE__ */ React4.createElement("p", { style: getHintStyle() }, 'Click "Switch Wallet" to change wallet or account'))), selectedNetworkType && /* @__PURE__ */ React4.createElement(
2223
2366
  WalletSelectModal,
2224
2367
  {
2225
2368
  isOpen: walletSelectOpen,
@@ -2230,8 +2373,8 @@ function WalletConnect({
2230
2373
  ));
2231
2374
  }
2232
2375
 
2233
- // src/react/components/V402Checkout.tsx
2234
- import React4, { useEffect as useEffect4, useState as useState5 } from "react";
2376
+ // src/react/components/checkout/V402Checkout.tsx
2377
+ import React6, { useEffect as useEffect5, useState as useState6 } from "react";
2235
2378
  import { Button, Card, Divider, message, Spin, Tooltip, Typography } from "antd";
2236
2379
  import {
2237
2380
  DisconnectOutlined,
@@ -2244,9 +2387,9 @@ import {
2244
2387
  init_common();
2245
2388
 
2246
2389
  // src/react/utils/CryptoIcons.tsx
2247
- import React3 from "react";
2390
+ import React5 from "react";
2248
2391
  var SolanaIcon = ({ width = 16, height = 16, className, style }) => {
2249
- return /* @__PURE__ */ React3.createElement(
2392
+ return /* @__PURE__ */ React5.createElement(
2250
2393
  "svg",
2251
2394
  {
2252
2395
  xmlns: "http://www.w3.org/2000/svg",
@@ -2256,14 +2399,14 @@ var SolanaIcon = ({ width = 16, height = 16, className, style }) => {
2256
2399
  className,
2257
2400
  style
2258
2401
  },
2259
- /* @__PURE__ */ React3.createElement("desc", null, "Solana SOL Fill Streamline Icon: https://streamlinehq.com"),
2260
- /* @__PURE__ */ React3.createElement("g", { fill: "none", fillRule: "evenodd" }, /* @__PURE__ */ React3.createElement(
2402
+ /* @__PURE__ */ React5.createElement("desc", null, "Solana SOL Fill Streamline Icon: https://streamlinehq.com"),
2403
+ /* @__PURE__ */ React5.createElement("g", { fill: "none", fillRule: "evenodd" }, /* @__PURE__ */ React5.createElement(
2261
2404
  "path",
2262
2405
  {
2263
2406
  d: "M16 0v16H0V0h16ZM8.395333333333333 15.505333333333333l-0.007333333333333332 0.0013333333333333333 -0.047333333333333324 0.023333333333333334 -0.013333333333333332 0.0026666666666666666 -0.009333333333333332 -0.0026666666666666666 -0.047333333333333324 -0.023333333333333334c-0.006666666666666666 -0.0026666666666666666 -0.012666666666666666 -0.0006666666666666666 -0.016 0.003333333333333333l-0.0026666666666666666 0.006666666666666666 -0.011333333333333334 0.2853333333333333 0.003333333333333333 0.013333333333333332 0.006666666666666666 0.008666666666666666 0.06933333333333333 0.049333333333333326 0.009999999999999998 0.0026666666666666666 0.008 -0.0026666666666666666 0.06933333333333333 -0.049333333333333326 0.008 -0.010666666666666666 0.0026666666666666666 -0.011333333333333334 -0.011333333333333334 -0.2846666666666666c-0.0013333333333333333 -0.006666666666666666 -0.005999999999999999 -0.011333333333333334 -0.011333333333333334 -0.011999999999999999Zm0.17666666666666667 -0.07533333333333334 -0.008666666666666666 0.0013333333333333333 -0.12333333333333332 0.062 -0.006666666666666666 0.006666666666666666 -0.002 0.007333333333333332 0.011999999999999999 0.2866666666666666 0.003333333333333333 0.008 0.005333333333333333 0.004666666666666666 0.134 0.062c0.008 0.0026666666666666666 0.015333333333333332 0 0.019333333333333334 -0.005333333333333333l0.0026666666666666666 -0.009333333333333332 -0.02266666666666667 -0.4093333333333333c-0.002 -0.008 -0.006666666666666666 -0.013333333333333332 -0.013333333333333332 -0.014666666666666665Zm-0.4766666666666666 0.0013333333333333333a0.015333333333333332 0.015333333333333332 0 0 0 -0.018 0.004l-0.004 0.009333333333333332 -0.02266666666666667 0.4093333333333333c0 0.008 0.004666666666666666 0.013333333333333332 0.011333333333333334 0.016l0.009999999999999998 -0.0013333333333333333 0.134 -0.062 0.006666666666666666 -0.005333333333333333 0.0026666666666666666 -0.007333333333333332 0.011333333333333334 -0.2866666666666666 -0.002 -0.008 -0.006666666666666666 -0.006666666666666666 -0.12266666666666666 -0.06133333333333333Z",
2264
2407
  strokeWidth: "0.6667"
2265
2408
  }
2266
- ), /* @__PURE__ */ React3.createElement(
2409
+ ), /* @__PURE__ */ React5.createElement(
2267
2410
  "path",
2268
2411
  {
2269
2412
  fill: "#000000",
@@ -2274,7 +2417,7 @@ var SolanaIcon = ({ width = 16, height = 16, className, style }) => {
2274
2417
  );
2275
2418
  };
2276
2419
  var BaseIcon = ({ width = 24, height = 24, className, style }) => {
2277
- return /* @__PURE__ */ React3.createElement(
2420
+ return /* @__PURE__ */ React5.createElement(
2278
2421
  "svg",
2279
2422
  {
2280
2423
  xmlns: "http://www.w3.org/2000/svg",
@@ -2288,8 +2431,8 @@ var BaseIcon = ({ width = 24, height = 24, className, style }) => {
2288
2431
  className,
2289
2432
  style
2290
2433
  },
2291
- /* @__PURE__ */ React3.createElement("desc", null, "Brand Coinbase Streamline Icon: https://streamlinehq.com"),
2292
- /* @__PURE__ */ React3.createElement(
2434
+ /* @__PURE__ */ React5.createElement("desc", null, "Brand Coinbase Streamline Icon: https://streamlinehq.com"),
2435
+ /* @__PURE__ */ React5.createElement(
2293
2436
  "path",
2294
2437
  {
2295
2438
  d: "M12.95 22c-4.503 0 -8.445 -3.04 -9.61 -7.413 -1.165 -4.373 0.737 -8.988 4.638 -11.25a9.906 9.906 0 0 1 12.008 1.598l-3.335 3.367a5.185 5.185 0 0 0 -7.354 0.013 5.252 5.252 0 0 0 0 7.393 5.185 5.185 0 0 0 7.354 0.013L20 19.088A9.887 9.887 0 0 1 12.95 22z",
@@ -2309,7 +2452,7 @@ var getNetworkIcon = (network) => {
2309
2452
  return BaseIcon;
2310
2453
  };
2311
2454
 
2312
- // src/react/components/V402Checkout.tsx
2455
+ // src/react/components/checkout/V402Checkout.tsx
2313
2456
  var { Title, Text } = Typography;
2314
2457
  var notify = {
2315
2458
  success: (title, msg) => {
@@ -2347,14 +2490,14 @@ function V402Checkout({
2347
2490
  { autoSwitch: !!targetNetwork, switchOnMount: true }
2348
2491
  );
2349
2492
  const { isProcessing, setIsProcessing, result, setResult, error, setError } = usePayment();
2350
- const [paymentDetails, setPaymentDetails] = useState5(null);
2493
+ const [paymentDetails, setPaymentDetails] = useState6(null);
2351
2494
  const handleDisconnect = () => {
2352
2495
  disconnect();
2353
2496
  setResult(null);
2354
2497
  setError(null);
2355
2498
  notify.info("Wallet Disconnected", "Your wallet has been disconnected successfully.");
2356
2499
  };
2357
- useEffect4(() => {
2500
+ useEffect5(() => {
2358
2501
  if (paymentInfo && paymentInfo.length > 0) {
2359
2502
  const firstPayment = paymentInfo[0];
2360
2503
  const rawAmount = firstPayment.maxAmountRequired?.toString() || "0";
@@ -2369,7 +2512,7 @@ function V402Checkout({
2369
2512
  });
2370
2513
  }
2371
2514
  }, [paymentInfo]);
2372
- useEffect4(() => {
2515
+ useEffect5(() => {
2373
2516
  if (targetNetwork && !fetchingPaymentInfo && ensureNetwork) {
2374
2517
  ensureNetwork(targetNetwork).catch((err) => {
2375
2518
  console.error("Failed to ensure network:", err);
@@ -2385,7 +2528,7 @@ function V402Checkout({
2385
2528
  setError(null);
2386
2529
  setIsProcessing(true);
2387
2530
  try {
2388
- const response = await makePayment(networkType, checkoutId, endpoint, additionalParams);
2531
+ const response = await makePayment(networkType, checkoutId, endpoint, additionalParams, address || void 0);
2389
2532
  const data = await response.json();
2390
2533
  setResult(data);
2391
2534
  notify.success("Payment Successful!", "Your payment has been processed successfully.");
@@ -2409,12 +2552,12 @@ function V402Checkout({
2409
2552
  const networkColor = paymentDetails ? getNetworkColor(paymentDetails.network) : "#8c8c8c";
2410
2553
  const loadingColor = "#8c8c8c";
2411
2554
  const hasInvalidCheckoutId = !fetchingPaymentInfo && (!paymentInfo || paymentInfo.length === 0);
2412
- return /* @__PURE__ */ React4.createElement(
2555
+ return /* @__PURE__ */ React6.createElement(
2413
2556
  "div",
2414
2557
  {
2415
2558
  className: isModal ? "bg-white" : "h-screen bg-white flex items-center justify-center p-4 overflow-hidden"
2416
2559
  },
2417
- /* @__PURE__ */ React4.createElement(
2560
+ /* @__PURE__ */ React6.createElement(
2418
2561
  "div",
2419
2562
  {
2420
2563
  className: "flex gap-4 items-center justify-center",
@@ -2424,7 +2567,7 @@ function V402Checkout({
2424
2567
  width: "100%"
2425
2568
  }
2426
2569
  },
2427
- /* @__PURE__ */ React4.createElement(
2570
+ /* @__PURE__ */ React6.createElement(
2428
2571
  Card,
2429
2572
  {
2430
2573
  className: "flex-shrink-0",
@@ -2440,7 +2583,7 @@ function V402Checkout({
2440
2583
  },
2441
2584
  styles: { body: { padding: isModal ? "0px" : "32px 24px" } }
2442
2585
  },
2443
- /* @__PURE__ */ React4.createElement("div", { className: "flex items-center gap-3 mb-4" }, /* @__PURE__ */ React4.createElement(
2586
+ /* @__PURE__ */ React6.createElement("div", { className: "flex items-center gap-3 mb-4" }, /* @__PURE__ */ React6.createElement(
2444
2587
  "div",
2445
2588
  {
2446
2589
  className: "w-12 h-12 rounded-xl flex items-center justify-center",
@@ -2449,22 +2592,22 @@ function V402Checkout({
2449
2592
  transition: "background 0.3s ease"
2450
2593
  }
2451
2594
  },
2452
- hasInvalidCheckoutId ? /* @__PURE__ */ React4.createElement("span", { style: { fontSize: "20px", color: "white", fontWeight: "bold" } }, "\u2717") : paymentDetails && NetworkIcon ? /* @__PURE__ */ React4.createElement(NetworkIcon, { width: 24, height: 24 }) : /* @__PURE__ */ React4.createElement(LoadingOutlined, { style: { fontSize: "20px", color: "white" }, spin: true })
2453
- ), /* @__PURE__ */ React4.createElement("div", { className: "flex-1" }, /* @__PURE__ */ React4.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React4.createElement(Title, { level: 4, style: { margin: 0, fontSize: "18px", fontWeight: 600 } }, title || "Echo Payment OnVoyage"), !hasInvalidCheckoutId && /* @__PURE__ */ React4.createElement(
2595
+ hasInvalidCheckoutId ? /* @__PURE__ */ React6.createElement("span", { style: { fontSize: "20px", color: "white", fontWeight: "bold" } }, "\u2717") : paymentDetails && NetworkIcon ? /* @__PURE__ */ React6.createElement(NetworkIcon, { width: 24, height: 24 }) : /* @__PURE__ */ React6.createElement(LoadingOutlined, { style: { fontSize: "20px", color: "white" }, spin: true })
2596
+ ), /* @__PURE__ */ React6.createElement("div", { className: "flex-1" }, /* @__PURE__ */ React6.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React6.createElement(Title, { level: 4, style: { margin: 0, fontSize: "18px", fontWeight: 600 } }, title || "Echo Payment OnVoyage"), !hasInvalidCheckoutId && /* @__PURE__ */ React6.createElement(
2454
2597
  Tooltip,
2455
2598
  {
2456
2599
  title: tooltipText,
2457
2600
  placement: "top"
2458
2601
  },
2459
- /* @__PURE__ */ React4.createElement(
2602
+ /* @__PURE__ */ React6.createElement(
2460
2603
  InfoCircleOutlined,
2461
2604
  {
2462
2605
  style: { fontSize: "14px", color: "#8c8c8c", cursor: "help" }
2463
2606
  }
2464
2607
  )
2465
- )), /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, subtitle))),
2466
- /* @__PURE__ */ React4.createElement("div", { className: "text-center mb-5" }, /* @__PURE__ */ React4.createElement("div", { className: "inline-flex items-center justify-center w-12 h-12 rounded-full bg-gray-50 mb-3" }, /* @__PURE__ */ React4.createElement(LockOutlined, { style: { fontSize: "20px", color: "#595959" } })), /* @__PURE__ */ React4.createElement(Title, { level: 3, style: { margin: "0 0 6px 0", fontSize: "20px", fontWeight: 600 } }, "Payment Required"), /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Pay ", paymentDetails ? `$${paymentDetails.amount} ${paymentDetails.currency}` : "the required amount", " to access")),
2467
- hasInvalidCheckoutId && /* @__PURE__ */ React4.createElement("div", { className: "text-center py-6" }, /* @__PURE__ */ React4.createElement(
2608
+ )), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, subtitle))),
2609
+ /* @__PURE__ */ React6.createElement("div", { className: "text-center mb-5" }, /* @__PURE__ */ React6.createElement("div", { className: "inline-flex items-center justify-center w-12 h-12 rounded-full bg-gray-50 mb-3" }, /* @__PURE__ */ React6.createElement(LockOutlined, { style: { fontSize: "20px", color: "#595959" } })), /* @__PURE__ */ React6.createElement(Title, { level: 3, style: { margin: "0 0 6px 0", fontSize: "20px", fontWeight: 600 } }, "Payment Required"), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Pay ", paymentDetails ? `$${paymentDetails.amount} ${paymentDetails.currency}` : "the required amount", " to access")),
2610
+ hasInvalidCheckoutId && /* @__PURE__ */ React6.createElement("div", { className: "text-center py-6" }, /* @__PURE__ */ React6.createElement(
2468
2611
  "div",
2469
2612
  {
2470
2613
  className: "inline-flex items-center justify-center w-16 h-16 rounded-full mb-4",
@@ -2473,15 +2616,15 @@ function V402Checkout({
2473
2616
  boxShadow: "0 4px 20px rgba(239, 68, 68, 0.3)"
2474
2617
  }
2475
2618
  },
2476
- /* @__PURE__ */ React4.createElement("span", { style: { fontSize: "32px", color: "white" } }, "!")
2477
- ), /* @__PURE__ */ React4.createElement(
2619
+ /* @__PURE__ */ React6.createElement("span", { style: { fontSize: "32px", color: "white" } }, "!")
2620
+ ), /* @__PURE__ */ React6.createElement(
2478
2621
  Title,
2479
2622
  {
2480
2623
  level: 4,
2481
2624
  style: { margin: "0 0 12px 0", fontSize: "18px", fontWeight: 600, color: "#262626" }
2482
2625
  },
2483
2626
  "Invalid Checkout ID"
2484
- ), /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "14px", color: "#8c8c8c", display: "block", marginBottom: "16px" } }, "The checkout ID you provided is invalid or has expired."), /* @__PURE__ */ React4.createElement(
2627
+ ), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "14px", color: "#8c8c8c", display: "block", marginBottom: "16px" } }, "The checkout ID you provided is invalid or has expired."), /* @__PURE__ */ React6.createElement(
2485
2628
  "div",
2486
2629
  {
2487
2630
  style: {
@@ -2492,33 +2635,33 @@ function V402Checkout({
2492
2635
  marginTop: "16px"
2493
2636
  }
2494
2637
  },
2495
- /* @__PURE__ */ React4.createElement(Text, { style: {
2638
+ /* @__PURE__ */ React6.createElement(Text, { style: {
2496
2639
  fontSize: "13px",
2497
2640
  color: "#dc2626",
2498
2641
  lineHeight: "1.6",
2499
2642
  fontWeight: 500
2500
2643
  } }, "Failed to load payment information. Please check your checkout ID.")
2501
2644
  )),
2502
- !hasInvalidCheckoutId && fetchingPaymentInfo && /* @__PURE__ */ React4.createElement("div", { className: "text-center py-6" }, /* @__PURE__ */ React4.createElement(Text, { style: { color: "#8c8c8c" } }, "Loading payment information...")),
2503
- !hasInvalidCheckoutId && !fetchingPaymentInfo && !address && /* @__PURE__ */ React4.createElement("div", null, /* @__PURE__ */ React4.createElement(WalletConnect, { supportedNetworks })),
2504
- !hasInvalidCheckoutId && address && /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(
2645
+ !hasInvalidCheckoutId && fetchingPaymentInfo && /* @__PURE__ */ React6.createElement("div", { className: "text-center py-6" }, /* @__PURE__ */ React6.createElement(Text, { style: { color: "#8c8c8c" } }, "Loading payment information...")),
2646
+ !hasInvalidCheckoutId && !fetchingPaymentInfo && !address && /* @__PURE__ */ React6.createElement("div", null, /* @__PURE__ */ React6.createElement(WalletConnect, { supportedNetworks })),
2647
+ !hasInvalidCheckoutId && address && /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
2505
2648
  "div",
2506
2649
  {
2507
2650
  className: "bg-gray-50 rounded-lg p-3 mb-4",
2508
2651
  style: { border: "1px solid #f0f0f0" }
2509
2652
  },
2510
- /* @__PURE__ */ React4.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React4.createElement("div", { className: "flex items-center gap-3 flex-1" }, /* @__PURE__ */ React4.createElement(
2653
+ /* @__PURE__ */ React6.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React6.createElement("div", { className: "flex items-center gap-3 flex-1" }, /* @__PURE__ */ React6.createElement(
2511
2654
  "div",
2512
2655
  {
2513
2656
  className: "w-10 h-10 rounded-full bg-black flex items-center justify-center text-white text-sm font-semibold"
2514
2657
  },
2515
2658
  address.slice(0, 2).toUpperCase()
2516
- ), /* @__PURE__ */ React4.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React4.createElement(Text, { style: {
2659
+ ), /* @__PURE__ */ React6.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React6.createElement(Text, { style: {
2517
2660
  display: "block",
2518
2661
  fontSize: "12px",
2519
2662
  color: "#8c8c8c",
2520
2663
  marginBottom: "2px"
2521
- } }, "Connected Wallet"), /* @__PURE__ */ React4.createElement(
2664
+ } }, "Connected Wallet"), /* @__PURE__ */ React6.createElement(
2522
2665
  Text,
2523
2666
  {
2524
2667
  style: {
@@ -2528,17 +2671,17 @@ function V402Checkout({
2528
2671
  }
2529
2672
  },
2530
2673
  formatAddress(address)
2531
- ))), /* @__PURE__ */ React4.createElement(
2674
+ ))), /* @__PURE__ */ React6.createElement(
2532
2675
  Button,
2533
2676
  {
2534
2677
  type: "text",
2535
2678
  size: "small",
2536
- icon: /* @__PURE__ */ React4.createElement(DisconnectOutlined, null),
2679
+ icon: /* @__PURE__ */ React6.createElement(DisconnectOutlined, null),
2537
2680
  onClick: handleDisconnect,
2538
2681
  style: { color: "#ff4d4f" }
2539
2682
  }
2540
2683
  ))
2541
- ), paymentDetails && /* @__PURE__ */ React4.createElement("div", { className: "bg-gray-50 rounded-lg p-3 mb-4", style: { border: "1px solid #f0f0f0" } }, /* @__PURE__ */ React4.createElement("div", { className: "flex justify-between items-center mb-2" }, /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Payment Amount"), /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "18px", fontWeight: 600 } }, "$", paymentDetails.amount)), /* @__PURE__ */ React4.createElement(Divider, { style: { margin: "6px 0" } }), /* @__PURE__ */ React4.createElement("div", { className: "flex justify-between items-center mb-2" }, /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Currency"), /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "14px", fontWeight: 500 } }, paymentDetails.currency)), /* @__PURE__ */ React4.createElement(Divider, { style: { margin: "6px 0" } }), /* @__PURE__ */ React4.createElement("div", { className: "flex justify-between items-center mb-2" }, /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Network"), /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "14px", fontWeight: 500 } }, paymentDetails.network)), /* @__PURE__ */ React4.createElement(Divider, { style: { margin: "6px 0" } }), /* @__PURE__ */ React4.createElement("div", { className: "flex justify-between items-start" }, /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Wallet Address"), /* @__PURE__ */ React4.createElement(Text, { style: {
2684
+ ), paymentDetails && /* @__PURE__ */ React6.createElement("div", { className: "bg-gray-50 rounded-lg p-3 mb-4", style: { border: "1px solid #f0f0f0" } }, /* @__PURE__ */ React6.createElement("div", { className: "flex justify-between items-center mb-2" }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Payment Amount"), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "18px", fontWeight: 600 } }, "$", paymentDetails.amount)), /* @__PURE__ */ React6.createElement(Divider, { style: { margin: "6px 0" } }), /* @__PURE__ */ React6.createElement("div", { className: "flex justify-between items-center mb-2" }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Currency"), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "14px", fontWeight: 500 } }, paymentDetails.currency)), /* @__PURE__ */ React6.createElement(Divider, { style: { margin: "6px 0" } }), /* @__PURE__ */ React6.createElement("div", { className: "flex justify-between items-center mb-2" }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Network"), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "14px", fontWeight: 500 } }, paymentDetails.network)), /* @__PURE__ */ React6.createElement(Divider, { style: { margin: "6px 0" } }), /* @__PURE__ */ React6.createElement("div", { className: "flex justify-between items-start" }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Wallet Address"), /* @__PURE__ */ React6.createElement(Text, { style: {
2542
2685
  fontSize: "11px",
2543
2686
  fontWeight: 500,
2544
2687
  fontFamily: "Monaco, monospace",
@@ -2546,15 +2689,15 @@ function V402Checkout({
2546
2689
  textAlign: "right",
2547
2690
  maxWidth: "60%",
2548
2691
  lineHeight: 1.4
2549
- } }, address))), /* @__PURE__ */ React4.createElement(
2692
+ } }, address))), /* @__PURE__ */ React6.createElement(
2550
2693
  "div",
2551
2694
  {
2552
2695
  className: "flex items-center justify-center gap-2 mb-3 p-2 rounded-lg",
2553
2696
  style: { background: "#f6ffed", border: "1px solid #d9f7be" }
2554
2697
  },
2555
- /* @__PURE__ */ React4.createElement(SafetyOutlined, { style: { color: "#52c41a", fontSize: "13px" } }),
2556
- /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "12px", color: "#52c41a", fontWeight: 500 } }, "Secure payment powered by v402pay")
2557
- ), /* @__PURE__ */ React4.createElement(
2698
+ /* @__PURE__ */ React6.createElement(SafetyOutlined, { style: { color: "#52c41a", fontSize: "13px" } }),
2699
+ /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "12px", color: "#52c41a", fontWeight: 500 } }, "Secure payment powered by v402pay")
2700
+ ), /* @__PURE__ */ React6.createElement(
2558
2701
  Button,
2559
2702
  {
2560
2703
  type: "primary",
@@ -2576,7 +2719,7 @@ function V402Checkout({
2576
2719
  }
2577
2720
  },
2578
2721
  isProcessing ? "Processing..." : !paymentDetails ? "Loading..." : `Pay $${paymentDetails.amount} ${paymentDetails.currency}`
2579
- ), /* @__PURE__ */ React4.createElement("div", { className: "text-center" }, /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Don't have USDC?", " "), /* @__PURE__ */ React4.createElement(
2722
+ ), /* @__PURE__ */ React6.createElement("div", { className: "text-center" }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Don't have USDC?", " "), /* @__PURE__ */ React6.createElement(
2580
2723
  "a",
2581
2724
  {
2582
2725
  href: "https://faucet.circle.com/",
@@ -2585,26 +2728,26 @@ function V402Checkout({
2585
2728
  className: "text-blue-600 hover:text-blue-700 text-sm font-medium inline-flex items-center gap-1"
2586
2729
  },
2587
2730
  "Get it here ",
2588
- /* @__PURE__ */ React4.createElement(LinkOutlined, { style: { fontSize: "12px" } })
2589
- )), isModal && result && /* @__PURE__ */ React4.createElement(
2731
+ /* @__PURE__ */ React6.createElement(LinkOutlined, { style: { fontSize: "12px" } })
2732
+ )), isModal && result && /* @__PURE__ */ React6.createElement(
2590
2733
  "div",
2591
2734
  {
2592
2735
  className: "mt-4 p-4 rounded-lg",
2593
2736
  style: { background: "#f6ffed", border: "1px solid #b7eb8f" }
2594
2737
  },
2595
- /* @__PURE__ */ React4.createElement("div", { className: "text-center" }, /* @__PURE__ */ React4.createElement("span", { style: { fontSize: "20px" } }, "\u2713"), /* @__PURE__ */ React4.createElement(Text, { style: {
2738
+ /* @__PURE__ */ React6.createElement("div", { className: "text-center" }, /* @__PURE__ */ React6.createElement("span", { style: { fontSize: "20px" } }, "\u2713"), /* @__PURE__ */ React6.createElement(Text, { style: {
2596
2739
  fontSize: "14px",
2597
2740
  color: "#52c41a",
2598
2741
  fontWeight: 600,
2599
2742
  marginLeft: "8px"
2600
2743
  } }, "Payment Successful!"))
2601
- ), isModal && error && /* @__PURE__ */ React4.createElement(
2744
+ ), isModal && error && /* @__PURE__ */ React6.createElement(
2602
2745
  "div",
2603
2746
  {
2604
2747
  className: "mt-4 p-4 rounded-lg",
2605
2748
  style: { background: "#fff2f0", border: "1px solid #ffccc7" }
2606
2749
  },
2607
- /* @__PURE__ */ React4.createElement("div", { className: "text-center mb-3" }, /* @__PURE__ */ React4.createElement("span", { style: { fontSize: "20px" } }, "\u2717"), /* @__PURE__ */ React4.createElement(Text, { style: {
2750
+ /* @__PURE__ */ React6.createElement("div", { className: "text-center mb-3" }, /* @__PURE__ */ React6.createElement("span", { style: { fontSize: "20px" } }, "\u2717"), /* @__PURE__ */ React6.createElement(Text, { style: {
2608
2751
  fontSize: "14px",
2609
2752
  color: "#ff4d4f",
2610
2753
  fontWeight: 600,
@@ -2612,7 +2755,7 @@ function V402Checkout({
2612
2755
  display: "block",
2613
2756
  marginTop: "4px"
2614
2757
  } }, "Payment Failed")),
2615
- /* @__PURE__ */ React4.createElement(Text, { style: {
2758
+ /* @__PURE__ */ React6.createElement(Text, { style: {
2616
2759
  fontSize: "13px",
2617
2760
  color: "#ff4d4f",
2618
2761
  display: "block",
@@ -2620,11 +2763,11 @@ function V402Checkout({
2620
2763
  } }, error)
2621
2764
  ))
2622
2765
  ),
2623
- !isModal && (isProcessing || result || error) && /* @__PURE__ */ React4.createElement(
2766
+ !isModal && (isProcessing || result || error) && /* @__PURE__ */ React6.createElement(
2624
2767
  Card,
2625
2768
  {
2626
- title: /* @__PURE__ */ React4.createElement("div", { className: "flex items-center gap-2" }, isProcessing && !result && !error ? /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(LoadingOutlined, { style: { color: "#14b8a6", fontSize: "16px" } }), /* @__PURE__ */ React4.createElement(Text, { strong: true, style: { fontSize: "16px", color: "#262626" } }, "Processing Payment")) : result ? /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement("span", { style: { color: "#52c41a", fontSize: "18px" } }, "\u2713"), /* @__PURE__ */ React4.createElement(Text, { strong: true, style: { fontSize: "16px", color: "#262626" } }, "Payment Successful")) : /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement("span", { style: { color: "#ff4d4f", fontSize: "18px" } }, "\u2717"), /* @__PURE__ */ React4.createElement(Text, { strong: true, style: { fontSize: "16px", color: "#262626" } }, "Payment Failed"))),
2627
- extra: !isProcessing && /* @__PURE__ */ React4.createElement(
2769
+ title: /* @__PURE__ */ React6.createElement("div", { className: "flex items-center gap-2" }, isProcessing && !result && !error ? /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(LoadingOutlined, { style: { color: "#14b8a6", fontSize: "16px" } }), /* @__PURE__ */ React6.createElement(Text, { strong: true, style: { fontSize: "16px", color: "#262626" } }, "Processing Payment")) : result ? /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement("span", { style: { color: "#52c41a", fontSize: "18px" } }, "\u2713"), /* @__PURE__ */ React6.createElement(Text, { strong: true, style: { fontSize: "16px", color: "#262626" } }, "Payment Successful")) : /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement("span", { style: { color: "#ff4d4f", fontSize: "18px" } }, "\u2717"), /* @__PURE__ */ React6.createElement(Text, { strong: true, style: { fontSize: "16px", color: "#262626" } }, "Payment Failed"))),
2770
+ extra: !isProcessing && /* @__PURE__ */ React6.createElement(
2628
2771
  Button,
2629
2772
  {
2630
2773
  type: "text",
@@ -2652,7 +2795,7 @@ function V402Checkout({
2652
2795
  }
2653
2796
  }
2654
2797
  },
2655
- isProcessing && !result && !error && /* @__PURE__ */ React4.createElement("div", { className: "text-center py-10" }, /* @__PURE__ */ React4.createElement("div", { className: "relative inline-block" }, /* @__PURE__ */ React4.createElement(
2798
+ isProcessing && !result && !error && /* @__PURE__ */ React6.createElement("div", { className: "text-center py-10" }, /* @__PURE__ */ React6.createElement("div", { className: "relative inline-block" }, /* @__PURE__ */ React6.createElement(
2656
2799
  "div",
2657
2800
  {
2658
2801
  className: "absolute inset-0 rounded-full blur-xl opacity-40",
@@ -2661,12 +2804,12 @@ function V402Checkout({
2661
2804
  animation: "pulse 2s ease-in-out infinite"
2662
2805
  }
2663
2806
  }
2664
- ), /* @__PURE__ */ React4.createElement(
2807
+ ), /* @__PURE__ */ React6.createElement(
2665
2808
  Spin,
2666
2809
  {
2667
- indicator: /* @__PURE__ */ React4.createElement(LoadingOutlined, { style: { fontSize: 56, color: "#14b8a6" } })
2810
+ indicator: /* @__PURE__ */ React6.createElement(LoadingOutlined, { style: { fontSize: 56, color: "#14b8a6" } })
2668
2811
  }
2669
- )), /* @__PURE__ */ React4.createElement("div", { className: "mt-6" }, /* @__PURE__ */ React4.createElement(Text, { strong: true, style: { fontSize: "18px", color: "#262626", letterSpacing: "-0.02em" } }, "Verifying Payment")), /* @__PURE__ */ React4.createElement("div", { className: "mt-2 mb-6" }, /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "14px", color: "#8c8c8c", lineHeight: "1.6" } }, "Please wait while we confirm your transaction")), /* @__PURE__ */ React4.createElement(
2812
+ )), /* @__PURE__ */ React6.createElement("div", { className: "mt-6" }, /* @__PURE__ */ React6.createElement(Text, { strong: true, style: { fontSize: "18px", color: "#262626", letterSpacing: "-0.02em" } }, "Verifying Payment")), /* @__PURE__ */ React6.createElement("div", { className: "mt-2 mb-6" }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "14px", color: "#8c8c8c", lineHeight: "1.6" } }, "Please wait while we confirm your transaction")), /* @__PURE__ */ React6.createElement(
2670
2813
  "div",
2671
2814
  {
2672
2815
  className: "mt-4 p-4 rounded-xl",
@@ -2675,9 +2818,9 @@ function V402Checkout({
2675
2818
  border: "1px solid #ccfbf1"
2676
2819
  }
2677
2820
  },
2678
- /* @__PURE__ */ React4.createElement("div", { className: "flex items-center justify-center gap-2" }, /* @__PURE__ */ React4.createElement("span", { style: { fontSize: "16px" } }, "\u23F1\uFE0F"), /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "13px", color: "#0f766e", fontWeight: 500 } }, "This may take a few moments"))
2821
+ /* @__PURE__ */ React6.createElement("div", { className: "flex items-center justify-center gap-2" }, /* @__PURE__ */ React6.createElement("span", { style: { fontSize: "16px" } }, "\u23F1\uFE0F"), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#0f766e", fontWeight: 500 } }, "This may take a few moments"))
2679
2822
  )),
2680
- result && /* @__PURE__ */ React4.createElement("div", null, /* @__PURE__ */ React4.createElement("div", { className: "text-center mb-6" }, /* @__PURE__ */ React4.createElement(
2823
+ result && /* @__PURE__ */ React6.createElement("div", null, /* @__PURE__ */ React6.createElement("div", { className: "text-center mb-6" }, /* @__PURE__ */ React6.createElement(
2681
2824
  "div",
2682
2825
  {
2683
2826
  className: "inline-flex items-center justify-center w-16 h-16 rounded-full mb-4",
@@ -2686,13 +2829,13 @@ function V402Checkout({
2686
2829
  boxShadow: "0 4px 20px rgba(16, 185, 129, 0.3)"
2687
2830
  }
2688
2831
  },
2689
- /* @__PURE__ */ React4.createElement("span", { style: { fontSize: "32px", color: "white" } }, "\u2713")
2690
- ), /* @__PURE__ */ React4.createElement("div", null, /* @__PURE__ */ React4.createElement(Text, { strong: true, style: {
2832
+ /* @__PURE__ */ React6.createElement("span", { style: { fontSize: "32px", color: "white" } }, "\u2713")
2833
+ ), /* @__PURE__ */ React6.createElement("div", null, /* @__PURE__ */ React6.createElement(Text, { strong: true, style: {
2691
2834
  fontSize: "20px",
2692
2835
  color: "#262626",
2693
2836
  display: "block",
2694
2837
  marginBottom: "8px"
2695
- } }, "Payment Successful!"), /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "14px", color: "#8c8c8c" } }, "Your transaction has been confirmed"))), /* @__PURE__ */ React4.createElement(Divider, { style: { margin: "20px 0", borderColor: "#f0f0f0" } }, /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "12px", color: "#8c8c8c", fontWeight: 500 } }, "RESPONSE DATA")), /* @__PURE__ */ React4.createElement(
2838
+ } }, "Payment Successful!"), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "14px", color: "#8c8c8c" } }, "Your transaction has been confirmed"))), /* @__PURE__ */ React6.createElement(Divider, { style: { margin: "20px 0", borderColor: "#f0f0f0" } }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "12px", color: "#8c8c8c", fontWeight: 500 } }, "RESPONSE DATA")), /* @__PURE__ */ React6.createElement(
2696
2839
  "pre",
2697
2840
  {
2698
2841
  style: {
@@ -2712,7 +2855,7 @@ function V402Checkout({
2712
2855
  },
2713
2856
  JSON.stringify(result, null, 2)
2714
2857
  )),
2715
- error && /* @__PURE__ */ React4.createElement("div", null, /* @__PURE__ */ React4.createElement("div", { className: "text-center mb-6" }, /* @__PURE__ */ React4.createElement(
2858
+ error && /* @__PURE__ */ React6.createElement("div", null, /* @__PURE__ */ React6.createElement("div", { className: "text-center mb-6" }, /* @__PURE__ */ React6.createElement(
2716
2859
  "div",
2717
2860
  {
2718
2861
  className: "inline-flex items-center justify-center w-16 h-16 rounded-full mb-4",
@@ -2721,13 +2864,13 @@ function V402Checkout({
2721
2864
  boxShadow: "0 4px 20px rgba(239, 68, 68, 0.3)"
2722
2865
  }
2723
2866
  },
2724
- /* @__PURE__ */ React4.createElement("span", { style: { fontSize: "32px", color: "white" } }, "\u2717")
2725
- ), /* @__PURE__ */ React4.createElement("div", null, /* @__PURE__ */ React4.createElement(Text, { strong: true, style: {
2867
+ /* @__PURE__ */ React6.createElement("span", { style: { fontSize: "32px", color: "white" } }, "\u2717")
2868
+ ), /* @__PURE__ */ React6.createElement("div", null, /* @__PURE__ */ React6.createElement(Text, { strong: true, style: {
2726
2869
  fontSize: "20px",
2727
2870
  color: "#262626",
2728
2871
  display: "block",
2729
2872
  marginBottom: "8px"
2730
- } }, "Payment Failed"), /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "14px", color: "#8c8c8c" } }, "Something went wrong with your transaction"))), /* @__PURE__ */ React4.createElement(Divider, { style: { margin: "20px 0", borderColor: "#f0f0f0" } }, /* @__PURE__ */ React4.createElement(Text, { style: { fontSize: "12px", color: "#8c8c8c", fontWeight: 500 } }, "ERROR DETAILS")), /* @__PURE__ */ React4.createElement(
2873
+ } }, "Payment Failed"), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "14px", color: "#8c8c8c" } }, "Something went wrong with your transaction"))), /* @__PURE__ */ React6.createElement(Divider, { style: { margin: "20px 0", borderColor: "#f0f0f0" } }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "12px", color: "#8c8c8c", fontWeight: 500 } }, "ERROR DETAILS")), /* @__PURE__ */ React6.createElement(
2731
2874
  "div",
2732
2875
  {
2733
2876
  style: {
@@ -2737,13 +2880,13 @@ function V402Checkout({
2737
2880
  border: "1px solid #fee2e2"
2738
2881
  }
2739
2882
  },
2740
- /* @__PURE__ */ React4.createElement(Text, { style: {
2883
+ /* @__PURE__ */ React6.createElement(Text, { style: {
2741
2884
  fontSize: "14px",
2742
2885
  color: "#dc2626",
2743
2886
  lineHeight: "1.6",
2744
2887
  fontWeight: 500
2745
2888
  } }, error)
2746
- ), /* @__PURE__ */ React4.createElement("div", { className: "mt-4 text-center" }, /* @__PURE__ */ React4.createElement(
2889
+ ), /* @__PURE__ */ React6.createElement("div", { className: "mt-4 text-center" }, /* @__PURE__ */ React6.createElement(
2747
2890
  Button,
2748
2891
  {
2749
2892
  size: "large",
@@ -2764,7 +2907,7 @@ function V402Checkout({
2764
2907
  )))
2765
2908
  )
2766
2909
  ),
2767
- /* @__PURE__ */ React4.createElement("style", { dangerouslySetInnerHTML: {
2910
+ /* @__PURE__ */ React6.createElement("style", { dangerouslySetInnerHTML: {
2768
2911
  __html: `
2769
2912
  @keyframes slideInRight {
2770
2913
  from {
@@ -2791,13 +2934,698 @@ function V402Checkout({
2791
2934
  } })
2792
2935
  );
2793
2936
  }
2937
+
2938
+ // src/react/components/checkout/V402CheckoutV2.tsx
2939
+ import React11, { useEffect as useEffect7, useState as useState8 } from "react";
2940
+ init_common();
2941
+
2942
+ // src/react/styles/animations.tsx
2943
+ import React7 from "react";
2944
+ var checkoutAnimations = `
2945
+ @keyframes spin {
2946
+ from { transform: rotate(0deg); }
2947
+ to { transform: rotate(360deg); }
2948
+ }
2949
+
2950
+ @keyframes receiptShake {
2951
+ 0%, 100% { transform: rotate(-0.3deg); }
2952
+ 50% { transform: rotate(0.3deg); }
2953
+ }
2954
+
2955
+ @keyframes slideInRight {
2956
+ from {
2957
+ opacity: 0;
2958
+ transform: translateX(100px);
2959
+ }
2960
+ to {
2961
+ opacity: 1;
2962
+ transform: translateX(0);
2963
+ }
2964
+ }
2965
+
2966
+ @keyframes pulse {
2967
+ 0%, 100% { opacity: 1; }
2968
+ 50% { opacity: 0.4; }
2969
+ }
2970
+ `;
2971
+ var AnimationStyles = () => /* @__PURE__ */ React7.createElement("style", { dangerouslySetInnerHTML: { __html: checkoutAnimations } });
2972
+
2973
+ // src/react/components/checkout/Receipt.tsx
2974
+ import React8, { useEffect as useEffect6, useState as useState7 } from "react";
2975
+ var Receipt = ({
2976
+ isLoading,
2977
+ isVisible,
2978
+ result,
2979
+ error,
2980
+ paymentDetails,
2981
+ address,
2982
+ onClose,
2983
+ primaryColor,
2984
+ receiptTitle,
2985
+ tempReceiptId
2986
+ }) => {
2987
+ const [animationState, setAnimationState] = useState7("hidden");
2988
+ useEffect6(() => {
2989
+ if (isLoading) {
2990
+ setAnimationState("printing");
2991
+ } else if (isVisible && (result || error)) {
2992
+ setAnimationState("visible");
2993
+ const timer = setTimeout(() => setAnimationState("bounce"), 50);
2994
+ return () => clearTimeout(timer);
2995
+ } else if (!isVisible) {
2996
+ setAnimationState("hidden");
2997
+ }
2998
+ }, [isLoading, isVisible, result, error]);
2999
+ useEffect6(() => {
3000
+ if (animationState === "bounce") {
3001
+ const timer = setTimeout(() => setAnimationState("visible"), 150);
3002
+ return () => clearTimeout(timer);
3003
+ }
3004
+ }, [animationState]);
3005
+ const now = /* @__PURE__ */ new Date();
3006
+ const dateStr = `${String(now.getMonth() + 1).padStart(2, "0")}/${String(now.getDate()).padStart(2, "0")}/${String(now.getFullYear()).slice(-2)}`;
3007
+ const timeStr = `${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}`;
3008
+ const receiptId = result?.transactionHash ? result.transactionHash.slice(-8).toUpperCase() : tempReceiptId;
3009
+ const getAnimationStyles = () => {
3010
+ const baseTransition = animationState === "bounce" ? "all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1)" : "all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1)";
3011
+ switch (animationState) {
3012
+ case "hidden":
3013
+ return {
3014
+ opacity: 0,
3015
+ transform: "translateY(50px)",
3016
+ marginBottom: 0,
3017
+ transition: baseTransition
3018
+ };
3019
+ case "printing":
3020
+ return {
3021
+ opacity: 1,
3022
+ transform: "translateY(0)",
3023
+ marginBottom: "-4px",
3024
+ // 负边距让小票贴着机器,还没撕开的感觉
3025
+ animation: "receiptShake 0.12s ease-in-out infinite",
3026
+ transition: baseTransition
3027
+ };
3028
+ case "visible":
3029
+ return {
3030
+ opacity: 1,
3031
+ transform: "translateY(0)",
3032
+ marginBottom: "8px",
3033
+ transition: baseTransition
3034
+ };
3035
+ case "bounce":
3036
+ return {
3037
+ opacity: 1,
3038
+ transform: "translateY(-8px)",
3039
+ marginBottom: "8px",
3040
+ transition: baseTransition
3041
+ };
3042
+ default:
3043
+ return {};
3044
+ }
3045
+ };
3046
+ const getContentStyles = () => {
3047
+ const baseTransition = "all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1)";
3048
+ switch (animationState) {
3049
+ case "hidden":
3050
+ return {
3051
+ maxHeight: 0,
3052
+ overflow: "hidden",
3053
+ transition: baseTransition
3054
+ };
3055
+ case "printing":
3056
+ return {
3057
+ maxHeight: "80px",
3058
+ overflow: "hidden",
3059
+ transition: baseTransition
3060
+ };
3061
+ case "visible":
3062
+ case "bounce":
3063
+ return {
3064
+ maxHeight: "600px",
3065
+ overflow: "visible",
3066
+ transition: baseTransition
3067
+ };
3068
+ default:
3069
+ return {};
3070
+ }
3071
+ };
3072
+ if (animationState === "hidden" && !isLoading) return null;
3073
+ return /* @__PURE__ */ React8.createElement(
3074
+ "div",
3075
+ {
3076
+ className: "w-full flex justify-center",
3077
+ style: getAnimationStyles()
3078
+ },
3079
+ /* @__PURE__ */ React8.createElement(
3080
+ "div",
3081
+ {
3082
+ className: "relative bg-white shadow-2xl",
3083
+ style: {
3084
+ width: "75%",
3085
+ maxWidth: "280px",
3086
+ backgroundImage: `
3087
+ repeating-linear-gradient(
3088
+ 0deg,
3089
+ transparent,
3090
+ transparent 1px,
3091
+ rgba(0,0,0,0.02) 1px,
3092
+ rgba(0,0,0,0.02) 2px
3093
+ )
3094
+ `
3095
+ }
3096
+ },
3097
+ /* @__PURE__ */ React8.createElement(
3098
+ "div",
3099
+ {
3100
+ className: "absolute top-0 left-0 right-0",
3101
+ style: {
3102
+ height: "8px",
3103
+ transform: "translateY(-100%)",
3104
+ background: `radial-gradient(circle at 50% 100%, white 5px, transparent 5px)`,
3105
+ backgroundSize: "12px 8px",
3106
+ backgroundPosition: "6px 0",
3107
+ backgroundRepeat: "repeat-x"
3108
+ }
3109
+ }
3110
+ ),
3111
+ /* @__PURE__ */ React8.createElement(
3112
+ "div",
3113
+ {
3114
+ className: "absolute left-0 right-0 bg-white",
3115
+ style: {
3116
+ height: "4px",
3117
+ top: "-4px"
3118
+ }
3119
+ }
3120
+ ),
3121
+ !isLoading && /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
3122
+ "div",
3123
+ {
3124
+ className: "absolute bottom-0 left-0 right-0",
3125
+ style: {
3126
+ height: "8px",
3127
+ transform: "translateY(100%)",
3128
+ background: `radial-gradient(circle at 50% 0%, white 5px, transparent 5px)`,
3129
+ backgroundSize: "12px 8px",
3130
+ backgroundPosition: "6px 0",
3131
+ backgroundRepeat: "repeat-x"
3132
+ }
3133
+ }
3134
+ ), /* @__PURE__ */ React8.createElement(
3135
+ "div",
3136
+ {
3137
+ className: "absolute left-0 right-0 bg-white",
3138
+ style: {
3139
+ height: "4px",
3140
+ bottom: "-4px"
3141
+ }
3142
+ }
3143
+ )),
3144
+ !isLoading && (result || error) && /* @__PURE__ */ React8.createElement(
3145
+ "button",
3146
+ {
3147
+ onClick: onClose,
3148
+ className: "absolute top-3 right-3 text-gray-300 hover:text-gray-500 transition-colors bg-transparent border-none outline-none p-0 cursor-pointer",
3149
+ style: { background: "none", border: "none" }
3150
+ },
3151
+ /* @__PURE__ */ React8.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }, /* @__PURE__ */ React8.createElement("path", { d: "M18 6L6 18M6 6l12 12" }))
3152
+ ),
3153
+ /* @__PURE__ */ React8.createElement("div", { className: "p-4 font-mono text-sm", style: getContentStyles() }, /* @__PURE__ */ React8.createElement("div", { className: "text-center mb-3" }, /* @__PURE__ */ React8.createElement("div", { className: "text-base font-bold tracking-wider text-gray-800" }, receiptTitle), /* @__PURE__ */ React8.createElement("div", { className: "flex justify-between text-xs text-gray-500 mt-1" }, /* @__PURE__ */ React8.createElement("span", null, "ID: ", receiptId), /* @__PURE__ */ React8.createElement("span", null, dateStr, " ", timeStr))), /* @__PURE__ */ React8.createElement("div", { className: "border-t border-dashed border-gray-300 my-2" }), /* @__PURE__ */ React8.createElement(
3154
+ "div",
3155
+ {
3156
+ className: "max-h-64 overflow-y-auto pr-1",
3157
+ style: {
3158
+ scrollbarWidth: "thin",
3159
+ scrollbarColor: "#d1d5db transparent"
3160
+ }
3161
+ },
3162
+ isLoading ? /* @__PURE__ */ React8.createElement(LoadingContent, { primaryColor }) : error ? /* @__PURE__ */ React8.createElement(ErrorContent, { error }) : result ? /* @__PURE__ */ React8.createElement(
3163
+ SuccessContent,
3164
+ {
3165
+ result,
3166
+ paymentDetails,
3167
+ address,
3168
+ primaryColor
3169
+ }
3170
+ ) : null
3171
+ ), /* @__PURE__ */ React8.createElement("div", { className: "border-t border-dashed border-gray-300 my-2" }), /* @__PURE__ */ React8.createElement(Barcode, null), /* @__PURE__ */ React8.createElement("div", { className: "text-center text-xs text-gray-400 mt-1 tracking-widest" }, "POWERED BY", " ", /* @__PURE__ */ React8.createElement(
3172
+ "a",
3173
+ {
3174
+ href: "https://v402pay.onvoyage.ai",
3175
+ target: "_blank",
3176
+ rel: "noopener noreferrer",
3177
+ className: "text-gray-500 hover:text-gray-700 underline transition-colors"
3178
+ },
3179
+ "V402PAY"
3180
+ )))
3181
+ )
3182
+ );
3183
+ };
3184
+ var LoadingContent = ({ primaryColor }) => /* @__PURE__ */ React8.createElement("div", { className: "text-center py-4" }, /* @__PURE__ */ React8.createElement(
3185
+ "div",
3186
+ {
3187
+ className: "inline-block w-8 h-8 border-2 border-gray-200 rounded-full mb-2",
3188
+ style: {
3189
+ borderTopColor: primaryColor,
3190
+ animation: "spin 0.8s linear infinite"
3191
+ }
3192
+ }
3193
+ ), /* @__PURE__ */ React8.createElement("div", { className: "text-gray-700 font-semibold text-sm" }, "Processing..."), /* @__PURE__ */ React8.createElement("div", { className: "text-gray-400 text-xs mt-1" }, "Please wait"));
3194
+ var ErrorContent = ({ error }) => /* @__PURE__ */ React8.createElement("div", { className: "text-center py-3" }, /* @__PURE__ */ React8.createElement("div", { className: "text-red-500 text-2xl mb-2" }, "\u2717"), /* @__PURE__ */ React8.createElement("div", { className: "text-red-600 font-semibold mb-1 text-sm" }, "FAILED"), /* @__PURE__ */ React8.createElement("div", { className: "text-red-500 text-xs break-words px-2" }, error));
3195
+ var SuccessContent = ({
3196
+ result,
3197
+ paymentDetails,
3198
+ address,
3199
+ primaryColor
3200
+ }) => {
3201
+ const [copied, setCopied] = useState7(false);
3202
+ const handleCopy = async () => {
3203
+ try {
3204
+ await navigator.clipboard.writeText(JSON.stringify(result, null, 2));
3205
+ setCopied(true);
3206
+ setTimeout(() => setCopied(false), 2e3);
3207
+ } catch (err) {
3208
+ console.error("Failed to copy:", err);
3209
+ }
3210
+ };
3211
+ return /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement("div", { className: "text-center mb-2" }, /* @__PURE__ */ React8.createElement("div", { className: "text-2xl mb-1", style: { color: primaryColor } }, "\u2713"), /* @__PURE__ */ React8.createElement("div", { className: "font-semibold text-sm", style: { color: primaryColor } }, "SUCCESS")), /* @__PURE__ */ React8.createElement("div", { className: "space-y-1 text-xs" }, paymentDetails && /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ React8.createElement("span", { className: "text-gray-500" }, "Amount:"), /* @__PURE__ */ React8.createElement("span", { className: "font-semibold" }, "$", paymentDetails.amount, " ", paymentDetails.currency)), /* @__PURE__ */ React8.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ React8.createElement("span", { className: "text-gray-500" }, "Network:"), /* @__PURE__ */ React8.createElement("span", { className: "font-semibold" }, paymentDetails.network))), address && /* @__PURE__ */ React8.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ React8.createElement("span", { className: "text-gray-500" }, "From:"), /* @__PURE__ */ React8.createElement("span", { className: "font-semibold" }, formatAddress(address))), result.transactionHash && /* @__PURE__ */ React8.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ React8.createElement("span", { className: "text-gray-500" }, "TX:"), /* @__PURE__ */ React8.createElement("span", { className: "font-semibold" }, formatAddress(result.transactionHash)))), /* @__PURE__ */ React8.createElement("div", { className: "border-t border-dashed border-gray-300 my-2" }), /* @__PURE__ */ React8.createElement("div", { className: "text-xs" }, /* @__PURE__ */ React8.createElement("div", { className: "flex justify-between items-center mb-1" }, /* @__PURE__ */ React8.createElement("span", { className: "text-gray-500" }, "Response:"), /* @__PURE__ */ React8.createElement(
3212
+ "button",
3213
+ {
3214
+ onClick: handleCopy,
3215
+ className: "text-gray-300 hover:text-gray-500 transition-colors flex items-center gap-1 bg-transparent border-none outline-none p-0 cursor-pointer",
3216
+ style: { background: "none", border: "none" }
3217
+ },
3218
+ copied ? /* @__PURE__ */ React8.createElement("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }, /* @__PURE__ */ React8.createElement("path", { d: "M20 6L9 17l-5-5" })) : /* @__PURE__ */ React8.createElement("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }, /* @__PURE__ */ React8.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }), /* @__PURE__ */ React8.createElement("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" }))
3219
+ )), /* @__PURE__ */ React8.createElement(
3220
+ "pre",
3221
+ {
3222
+ className: "bg-gray-50 p-2 rounded text-xs overflow-auto whitespace-pre-wrap break-words",
3223
+ style: { maxHeight: "80px", fontSize: "10px" }
3224
+ },
3225
+ JSON.stringify(result, null, 2)
3226
+ )));
3227
+ };
3228
+ var Barcode = () => {
3229
+ const pattern = [2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1];
3230
+ const heights = [10, 12, 11, 13, 10, 14, 11, 12, 13, 10, 11, 14, 12, 10, 13, 11, 12, 14, 10, 11];
3231
+ return /* @__PURE__ */ React8.createElement("div", { className: "flex items-center justify-center gap-0.5 h-4 opacity-60" }, pattern.map((width, i) => /* @__PURE__ */ React8.createElement(
3232
+ "div",
3233
+ {
3234
+ key: i,
3235
+ className: "bg-gray-800",
3236
+ style: {
3237
+ width: `${width}px`,
3238
+ height: `${heights[i]}px`
3239
+ }
3240
+ }
3241
+ )));
3242
+ };
3243
+
3244
+ // src/react/components/checkout/TerminalScreen.tsx
3245
+ import React9 from "react";
3246
+ var TerminalScreen = ({
3247
+ title,
3248
+ tooltipText,
3249
+ hasInvalidCheckoutId,
3250
+ fetchingPaymentInfo,
3251
+ address,
3252
+ paymentDetails,
3253
+ screenText,
3254
+ supportedNetworks
3255
+ }) => {
3256
+ return /* @__PURE__ */ React9.createElement(
3257
+ "div",
3258
+ {
3259
+ className: "rounded-xl p-3 mb-3",
3260
+ style: {
3261
+ backgroundColor: "#0a1a0a",
3262
+ boxShadow: "inset 0 3px 16px rgba(0,0,0,0.5)",
3263
+ border: "3px solid rgba(0,0,0,0.3)"
3264
+ }
3265
+ },
3266
+ /* @__PURE__ */ React9.createElement("div", { className: "flex justify-between items-center mb-2" }, /* @__PURE__ */ React9.createElement("div", { className: "flex items-center gap-1.5 flex-1 min-w-0" }, /* @__PURE__ */ React9.createElement("div", { className: "w-2.5 h-2.5 rounded border border-green-700 flex-shrink-0" }), title ? /* @__PURE__ */ React9.createElement(
3267
+ "span",
3268
+ {
3269
+ className: "text-xs font-mono",
3270
+ style: { color: "#22c55e80" },
3271
+ title
3272
+ },
3273
+ title.length > 26 ? `${title.slice(0, 13)}...${title.slice(-13)}` : title
3274
+ ) : /* @__PURE__ */ React9.createElement("span", { className: "text-xs font-mono", style: { color: "#22c55e80" } }, "CHECKOUT")), /* @__PURE__ */ React9.createElement(
3275
+ "div",
3276
+ {
3277
+ className: "flex gap-0.5 flex-shrink-0 cursor-help",
3278
+ title: tooltipText
3279
+ },
3280
+ /* @__PURE__ */ React9.createElement(
3281
+ "div",
3282
+ {
3283
+ className: "w-1 h-1.5 rounded-sm",
3284
+ style: { backgroundColor: address ? "#22c55e80" : "#22c55e30" }
3285
+ }
3286
+ ),
3287
+ /* @__PURE__ */ React9.createElement(
3288
+ "div",
3289
+ {
3290
+ className: "w-1 h-1.5 rounded-sm",
3291
+ style: { backgroundColor: address ? "#22c55e80" : "#22c55e30" }
3292
+ }
3293
+ ),
3294
+ /* @__PURE__ */ React9.createElement("div", { className: "w-1 h-1.5 rounded-sm", style: { backgroundColor: "#22c55e80" } })
3295
+ )),
3296
+ /* @__PURE__ */ React9.createElement("div", { className: "min-h-[120px]" }, hasInvalidCheckoutId ? /* @__PURE__ */ React9.createElement(InvalidIdContent, null) : fetchingPaymentInfo ? /* @__PURE__ */ React9.createElement(LoadingContent2, null) : !address ? /* @__PURE__ */ React9.createElement(ConnectWalletContent, { supportedNetworks }) : /* @__PURE__ */ React9.createElement(
3297
+ PaymentInfoContent,
3298
+ {
3299
+ screenText,
3300
+ paymentDetails,
3301
+ address
3302
+ }
3303
+ ))
3304
+ );
3305
+ };
3306
+ var InvalidIdContent = () => /* @__PURE__ */ React9.createElement("div", { className: "text-center py-3" }, /* @__PURE__ */ React9.createElement("div", { className: "text-red-500 text-xl mb-1" }, "\u2717"), /* @__PURE__ */ React9.createElement("div", { className: "text-red-500 font-mono text-sm mb-1" }, "INVALID ID"), /* @__PURE__ */ React9.createElement("div", { className: "text-red-400 font-mono text-xs" }, "Check your checkout ID"));
3307
+ var LoadingContent2 = () => /* @__PURE__ */ React9.createElement("div", { className: "text-center py-4" }, /* @__PURE__ */ React9.createElement(
3308
+ "div",
3309
+ {
3310
+ className: "inline-block w-5 h-5 border-2 rounded-full mb-2",
3311
+ style: {
3312
+ borderColor: "#22c55e40",
3313
+ borderTopColor: "#22c55e",
3314
+ animation: "spin 1s linear infinite"
3315
+ }
3316
+ }
3317
+ ), /* @__PURE__ */ React9.createElement("div", { className: "font-mono text-sm", style: { color: "#22c55e" } }, "LOADING..."));
3318
+ var ConnectWalletContent = ({ supportedNetworks }) => /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement(
3319
+ "div",
3320
+ {
3321
+ className: "font-mono text-base mb-3 tracking-wider",
3322
+ style: { color: "#f97316", textShadow: "0 0 10px #f9731640" }
3323
+ },
3324
+ "CONNECT WALLET..."
3325
+ ), /* @__PURE__ */ React9.createElement(WalletConnect, { supportedNetworks, showSwitchWallet: false }));
3326
+ var PaymentInfoContent = ({
3327
+ screenText,
3328
+ paymentDetails,
3329
+ address
3330
+ }) => /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement(
3331
+ "div",
3332
+ {
3333
+ className: "font-mono text-base mb-3 tracking-wider",
3334
+ style: { color: "#f97316", textShadow: "0 0 10px #f9731640" }
3335
+ },
3336
+ screenText
3337
+ ), paymentDetails && /* @__PURE__ */ React9.createElement("div", { className: "text-xs font-mono" }, /* @__PURE__ */ React9.createElement("div", { className: "grid grid-cols-2 gap-1.5 mb-1.5" }, /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("div", { style: { color: "#22c55e60" } }, "AMOUNT"), /* @__PURE__ */ React9.createElement("div", { style: { color: "#22c55e" } }, "$", paymentDetails.amount)), /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("div", { style: { color: "#22c55e60" } }, "CURRENCY"), /* @__PURE__ */ React9.createElement("div", { style: { color: "#22c55e" } }, paymentDetails.currency))), /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("div", { style: { color: "#22c55e60" } }, "WALLET"), /* @__PURE__ */ React9.createElement("div", { style: { color: "#22c55e", wordBreak: "break-all" } }, address))));
3338
+
3339
+ // src/react/components/checkout/TerminalButtons.tsx
3340
+ import React10 from "react";
3341
+ var TerminalButtons = ({
3342
+ address,
3343
+ showReceipt,
3344
+ isProcessing,
3345
+ paymentDetails,
3346
+ hasInvalidCheckoutId,
3347
+ onDisconnect,
3348
+ onClearReceipt,
3349
+ onPayment
3350
+ }) => {
3351
+ const isPayDisabled = isProcessing || !paymentDetails || !address || hasInvalidCheckoutId;
3352
+ return /* @__PURE__ */ React10.createElement("div", { className: "flex items-center justify-between px-1" }, /* @__PURE__ */ React10.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React10.createElement(
3353
+ CircleButton,
3354
+ {
3355
+ onClick: () => address && onDisconnect(),
3356
+ disabled: !address,
3357
+ title: "Disconnect",
3358
+ size: "small"
3359
+ },
3360
+ /* @__PURE__ */ React10.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "white", strokeWidth: "2" }, /* @__PURE__ */ React10.createElement("path", { d: "M18 6L6 18M6 6l12 12" }))
3361
+ ), /* @__PURE__ */ React10.createElement(
3362
+ CircleButton,
3363
+ {
3364
+ onClick: onClearReceipt,
3365
+ disabled: !showReceipt || isProcessing,
3366
+ title: "Clear",
3367
+ size: "small"
3368
+ },
3369
+ /* @__PURE__ */ React10.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "white", strokeWidth: "2" }, /* @__PURE__ */ React10.createElement("path", { d: "M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2m3 0v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6h14z" }))
3370
+ )), /* @__PURE__ */ React10.createElement("div", { className: "flex flex-col gap-0.5 opacity-40" }, /* @__PURE__ */ React10.createElement("div", { className: "w-6 h-0.5 rounded", style: { backgroundColor: "rgba(0,0,0,0.3)" } }), /* @__PURE__ */ React10.createElement("div", { className: "w-6 h-0.5 rounded", style: { backgroundColor: "rgba(0,0,0,0.3)" } }), /* @__PURE__ */ React10.createElement("div", { className: "w-6 h-0.5 rounded", style: { backgroundColor: "rgba(0,0,0,0.3)" } })), /* @__PURE__ */ React10.createElement(
3371
+ "button",
3372
+ {
3373
+ onClick: onPayment,
3374
+ disabled: isPayDisabled,
3375
+ className: "px-5 py-2.5 rounded-xl font-bold text-white flex items-center gap-2 transition-all active:scale-95",
3376
+ style: {
3377
+ backgroundColor: isPayDisabled ? "#9ca3af" : "#ea580c",
3378
+ boxShadow: isPayDisabled ? "none" : "0 4px 12px rgba(234,88,12,0.4), inset 0 -2px 4px rgba(0,0,0,0.2)",
3379
+ cursor: isPayDisabled ? "not-allowed" : "pointer"
3380
+ }
3381
+ },
3382
+ isProcessing ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(
3383
+ "div",
3384
+ {
3385
+ className: "w-4 h-4 border-2 border-white/30 border-t-white rounded-full",
3386
+ style: { animation: "spin 0.8s linear infinite" }
3387
+ }
3388
+ ), /* @__PURE__ */ React10.createElement("span", { className: "font-mono tracking-wider text-sm" }, "PAYING...")) : /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("span", { className: "font-mono tracking-wider text-sm" }, "PAY"), /* @__PURE__ */ React10.createElement(
3389
+ "svg",
3390
+ {
3391
+ width: "18",
3392
+ height: "18",
3393
+ viewBox: "0 0 24 24",
3394
+ fill: "none",
3395
+ stroke: "currentColor",
3396
+ strokeWidth: "2"
3397
+ },
3398
+ /* @__PURE__ */ React10.createElement("path", { d: "M12 2v20M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6" })
3399
+ ))
3400
+ ));
3401
+ };
3402
+ var CircleButton = ({ onClick, disabled, title, size = "normal", children }) => {
3403
+ const sizeClass = size === "small" ? "w-10 h-10" : "w-12 h-12";
3404
+ return /* @__PURE__ */ React10.createElement(
3405
+ "button",
3406
+ {
3407
+ onClick,
3408
+ disabled,
3409
+ className: `${sizeClass} rounded-full flex items-center justify-center transition-transform active:scale-95`,
3410
+ style: {
3411
+ backgroundColor: "#374151",
3412
+ boxShadow: "inset 0 -2px 4px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2)",
3413
+ opacity: disabled ? 0.5 : 1
3414
+ },
3415
+ title
3416
+ },
3417
+ children
3418
+ );
3419
+ };
3420
+
3421
+ // src/react/components/checkout/V402CheckoutV2.tsx
3422
+ var generateRandomId = () => {
3423
+ const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
3424
+ return Array.from({ length: 8 }, () => chars[Math.floor(Math.random() * chars.length)]).join("");
3425
+ };
3426
+ function V402CheckoutV2({
3427
+ checkoutId,
3428
+ headerInfo = {},
3429
+ primaryColor = "#84cc16",
3430
+ isModal = false,
3431
+ onPaymentComplete,
3432
+ additionalParams = {},
3433
+ expectedNetwork
3434
+ }) {
3435
+ const {
3436
+ title = "V402Pay Checkout",
3437
+ brandName = "V402PAY",
3438
+ receiptTitle = "V402 PAYMENT",
3439
+ tooltipText = "V402Pay - Accept Crypto Payments Easier"
3440
+ } = headerInfo;
3441
+ const endpoint = PROD_BACK_URL;
3442
+ const {
3443
+ supportedNetworks,
3444
+ isLoading: fetchingPaymentInfo,
3445
+ paymentInfo
3446
+ } = usePaymentInfo(checkoutId, endpoint, additionalParams);
3447
+ const targetNetwork = expectedNetwork || supportedNetworks[0];
3448
+ const { address, networkType, disconnect, ensureNetwork } = usePageNetwork(
3449
+ targetNetwork,
3450
+ { autoSwitch: !!targetNetwork, switchOnMount: true }
3451
+ );
3452
+ const { isProcessing, setIsProcessing, result, setResult, error, setError } = usePayment();
3453
+ const [paymentDetails, setPaymentDetails] = useState8(null);
3454
+ const [showReceipt, setShowReceipt] = useState8(false);
3455
+ const [tempReceiptId, setTempReceiptId] = useState8(() => generateRandomId());
3456
+ const handleDisconnect = () => {
3457
+ disconnect();
3458
+ setResult(null);
3459
+ setError(null);
3460
+ setShowReceipt(false);
3461
+ };
3462
+ const handlePayment = async () => {
3463
+ if (!networkType) return;
3464
+ setTempReceiptId(generateRandomId());
3465
+ setResult(null);
3466
+ setError(null);
3467
+ setIsProcessing(true);
3468
+ setShowReceipt(true);
3469
+ try {
3470
+ const response = await makePayment(networkType, checkoutId, endpoint, additionalParams, address || void 0);
3471
+ const data = await response.json();
3472
+ setResult(data);
3473
+ if (onPaymentComplete) {
3474
+ onPaymentComplete(data);
3475
+ }
3476
+ } catch (err) {
3477
+ setError(err.message || "Payment failed");
3478
+ } finally {
3479
+ setIsProcessing(false);
3480
+ }
3481
+ };
3482
+ const handleCloseReceipt = () => {
3483
+ setShowReceipt(false);
3484
+ setResult(null);
3485
+ setError(null);
3486
+ };
3487
+ useEffect7(() => {
3488
+ if (paymentInfo && paymentInfo.length > 0) {
3489
+ const firstPayment = paymentInfo[0];
3490
+ const rawAmount = firstPayment.maxAmountRequired?.toString() || "0";
3491
+ const decimals = 6;
3492
+ const humanReadableAmount = (Number(rawAmount) / Math.pow(10, decimals)).toFixed(2);
3493
+ const network = firstPayment.network || "Unknown";
3494
+ const currency = "USDC";
3495
+ setPaymentDetails({ amount: humanReadableAmount, currency, network });
3496
+ }
3497
+ }, [paymentInfo]);
3498
+ useEffect7(() => {
3499
+ if (targetNetwork && !fetchingPaymentInfo && ensureNetwork) {
3500
+ ensureNetwork(targetNetwork).catch((err) => {
3501
+ console.error("Failed to ensure network:", err);
3502
+ });
3503
+ }
3504
+ }, [targetNetwork, fetchingPaymentInfo]);
3505
+ useEffect7(() => {
3506
+ if (isProcessing || result || error) {
3507
+ setShowReceipt(true);
3508
+ }
3509
+ }, [isProcessing, result, error]);
3510
+ const hasInvalidCheckoutId = !fetchingPaymentInfo && (!paymentInfo || paymentInfo.length === 0);
3511
+ const NetworkIcon = paymentDetails ? getNetworkIcon(paymentDetails.network) : null;
3512
+ const screenText = paymentDetails ? `PAY $${paymentDetails.amount} ${paymentDetails.currency}` : "AWAITING...";
3513
+ const getStatusText = () => {
3514
+ if (hasInvalidCheckoutId) return "ERROR";
3515
+ if (fetchingPaymentInfo) return "LOADING";
3516
+ if (!address) return "CONNECT";
3517
+ if (isProcessing) return "PAYING";
3518
+ return "READY";
3519
+ };
3520
+ return /* @__PURE__ */ React11.createElement("div", { className: isModal ? "bg-transparent" : "min-h-screen bg-gray-100 flex items-center justify-center p-4" }, /* @__PURE__ */ React11.createElement(
3521
+ "div",
3522
+ {
3523
+ className: "flex flex-col items-center",
3524
+ style: { width: isModal ? "100%" : "380px", maxWidth: "100%" }
3525
+ },
3526
+ /* @__PURE__ */ React11.createElement(
3527
+ Receipt,
3528
+ {
3529
+ isLoading: isProcessing,
3530
+ isVisible: showReceipt,
3531
+ result,
3532
+ error,
3533
+ paymentDetails,
3534
+ address,
3535
+ onClose: handleCloseReceipt,
3536
+ primaryColor,
3537
+ receiptTitle,
3538
+ tempReceiptId
3539
+ }
3540
+ ),
3541
+ /* @__PURE__ */ React11.createElement(
3542
+ "div",
3543
+ {
3544
+ className: "relative rounded-2xl p-3 shadow-2xl w-full",
3545
+ style: {
3546
+ backgroundColor: primaryColor,
3547
+ boxShadow: `0 16px 48px -8px ${primaryColor}66, 0 8px 24px -4px rgba(0,0,0,0.3);padding-bottom: 0px`
3548
+ }
3549
+ },
3550
+ /* @__PURE__ */ React11.createElement(
3551
+ "div",
3552
+ {
3553
+ className: "absolute top-0 left-1/2 -translate-x-1/2 w-1/3 h-2.5 rounded-b-lg",
3554
+ style: { backgroundColor: "rgba(0,0,0,0.4)" }
3555
+ }
3556
+ ),
3557
+ /* @__PURE__ */ React11.createElement("div", { className: "flex justify-between items-center mb-2 mt-1 px-1" }, /* @__PURE__ */ React11.createElement("div", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ React11.createElement(
3558
+ "div",
3559
+ {
3560
+ className: "w-2 h-2 rounded-full",
3561
+ style: {
3562
+ backgroundColor: address ? "#22c55e" : "#ef4444",
3563
+ animation: "pulse 2s ease-in-out infinite"
3564
+ }
3565
+ }
3566
+ ), /* @__PURE__ */ React11.createElement(
3567
+ "span",
3568
+ {
3569
+ className: "text-xs font-mono font-bold tracking-wider",
3570
+ style: { color: "rgba(0,0,0,0.7)" }
3571
+ },
3572
+ getStatusText()
3573
+ )), /* @__PURE__ */ React11.createElement("div", { className: "flex items-center gap-1.5" }, paymentDetails && NetworkIcon && /* @__PURE__ */ React11.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ React11.createElement(NetworkIcon, { width: 12, height: 12, style: { color: "rgba(0,0,0,0.7)" } }), /* @__PURE__ */ React11.createElement("span", { className: "text-xs font-mono font-bold", style: { color: "rgba(0,0,0,0.7)" } }, paymentDetails.network)))),
3574
+ /* @__PURE__ */ React11.createElement(
3575
+ TerminalScreen,
3576
+ {
3577
+ title,
3578
+ tooltipText,
3579
+ hasInvalidCheckoutId,
3580
+ fetchingPaymentInfo,
3581
+ address,
3582
+ paymentDetails,
3583
+ screenText,
3584
+ supportedNetworks
3585
+ }
3586
+ ),
3587
+ /* @__PURE__ */ React11.createElement(
3588
+ TerminalButtons,
3589
+ {
3590
+ address,
3591
+ showReceipt,
3592
+ isProcessing,
3593
+ paymentDetails,
3594
+ hasInvalidCheckoutId,
3595
+ onDisconnect: handleDisconnect,
3596
+ onClearReceipt: handleCloseReceipt,
3597
+ onPayment: handlePayment
3598
+ }
3599
+ ),
3600
+ brandName && /* @__PURE__ */ React11.createElement("div", { className: "text-center mt-0 mb-0" }, /* @__PURE__ */ React11.createElement(
3601
+ "div",
3602
+ {
3603
+ className: "inline-block px-2 py-0.5 rounded text-[10px] font-mono font-bold tracking-[0.2em]",
3604
+ style: {
3605
+ backgroundColor: "#1a1a1a",
3606
+ color: "#9acd32",
3607
+ boxShadow: "inset 0 1px 3px rgba(0,0,0,0.8), 0 1px 0 rgba(255,255,255,0.1)",
3608
+ border: "1px solid rgba(0,0,0,0.5)",
3609
+ textShadow: "0 0 4px #9acd3280"
3610
+ }
3611
+ },
3612
+ brandName
3613
+ ))
3614
+ )
3615
+ ), /* @__PURE__ */ React11.createElement(AnimationStyles, null));
3616
+ }
2794
3617
  export {
3618
+ AnimationStyles,
3619
+ Toast,
2795
3620
  V402Checkout,
3621
+ V402CheckoutV2,
2796
3622
  WalletConnect,
2797
3623
  WalletSelectModal,
3624
+ checkoutAnimations,
2798
3625
  usePageNetwork,
2799
3626
  usePayment,
2800
3627
  usePaymentInfo,
3628
+ useToast,
2801
3629
  useWallet
2802
3630
  };
2803
3631
  //# sourceMappingURL=index.mjs.map