@voyage_ai/v402-web-ts 0.3.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,278 +1,29 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __esm = (fn, res) => function __init() {
6
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
7
- };
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
-
22
- // src/types/common.ts
23
- var PROD_BACK_URL;
24
- var init_common = __esm({
25
- "src/types/common.ts"() {
26
- "use strict";
27
- PROD_BACK_URL = true ? "https://v402pay.onvoyage.ai/api/pay" : "https://v402pay.onvoyage.ai/api/pay";
28
- }
29
- });
30
-
31
- // src/types/svm.ts
32
- import { z } from "zod";
33
- import { ExactSvmPayloadSchema } from "x402/types";
34
- var SolanaNetworkSchema, SolanaPaymentPayloadSchema;
35
- var init_svm = __esm({
36
- "src/types/svm.ts"() {
37
- "use strict";
38
- SolanaNetworkSchema = z.enum([
39
- "solana-devnet",
40
- "solana",
41
- "solana-mainnet"
42
- // Alias for mainnet
43
- ]);
44
- SolanaPaymentPayloadSchema = z.object({
45
- x402Version: z.literal(1),
46
- scheme: z.literal("exact"),
47
- network: SolanaNetworkSchema,
48
- payload: ExactSvmPayloadSchema
49
- });
50
- }
51
- });
52
-
53
- // src/types/evm.ts
54
- import { z as z2 } from "zod";
55
- import { ExactEvmPayloadSchema } from "x402/types";
56
- var EvmNetworkSchema, EvmPaymentPayloadSchema;
57
- var init_evm = __esm({
58
- "src/types/evm.ts"() {
59
- "use strict";
60
- EvmNetworkSchema = z2.enum([
61
- "ethereum",
62
- "sepolia",
63
- "base",
64
- "base-sepolia",
65
- "polygon",
66
- "arbitrum",
67
- "optimism"
68
- ]);
69
- EvmPaymentPayloadSchema = z2.object({
70
- x402Version: z2.literal(1),
71
- scheme: z2.literal("exact"),
72
- network: EvmNetworkSchema,
73
- payload: ExactEvmPayloadSchema
74
- });
75
- }
76
- });
77
-
78
- // src/types/index.ts
79
1
  import {
80
- PaymentRequirementsSchema,
81
- x402ResponseSchema,
82
- VerifyResponseSchema,
83
- SettleResponseSchema,
84
- SupportedPaymentKindSchema,
85
- SupportedPaymentKindsResponseSchema,
86
- SupportedSVMNetworks,
87
- SvmNetworkToChainId
88
- } from "x402/types";
89
- var init_types = __esm({
90
- "src/types/index.ts"() {
91
- "use strict";
92
- init_svm();
93
- init_evm();
94
- }
95
- });
96
-
97
- // src/utils/wallet.ts
98
- var wallet_exports = {};
99
- __export(wallet_exports, {
100
- clearAllWalletAddresses: () => clearAllWalletAddresses,
101
- clearWalletDisconnection: () => clearWalletDisconnection,
102
- formatAddress: () => formatAddress,
103
- getAllWalletAddresses: () => getAllWalletAddresses,
104
- getCachedWalletAddress: () => getCachedWalletAddress,
105
- getConnectedNetworkType: () => getConnectedNetworkType,
106
- getWalletDisplayName: () => getWalletDisplayName,
107
- getWalletInstallUrl: () => getWalletInstallUrl,
108
- getWalletProvider: () => getWalletProvider,
109
- isWalletInstalled: () => isWalletInstalled,
110
- isWalletManuallyDisconnected: () => isWalletManuallyDisconnected,
111
- markWalletDisconnected: () => markWalletDisconnected,
112
- removeWalletAddress: () => removeWalletAddress,
113
- saveConnectedNetworkType: () => saveConnectedNetworkType,
114
- saveWalletAddress: () => saveWalletAddress
115
- });
116
- function isWalletInstalled(networkType) {
117
- if (typeof window === "undefined") {
118
- return false;
119
- }
120
- switch (networkType) {
121
- case "evm" /* EVM */:
122
- return !!window.ethereum;
123
- case "solana" /* SOLANA */:
124
- case "svm" /* SVM */:
125
- return !!window.solana || !!window.phantom;
126
- default:
127
- return false;
128
- }
129
- }
130
- function getWalletProvider(networkType) {
131
- if (typeof window === "undefined") {
132
- return null;
133
- }
134
- switch (networkType) {
135
- case "evm" /* EVM */:
136
- return window.ethereum;
137
- case "solana" /* SOLANA */:
138
- case "svm" /* SVM */:
139
- return window.solana || window.phantom;
140
- default:
141
- return null;
142
- }
143
- }
144
- function formatAddress(address) {
145
- if (!address || address.length < 10) {
146
- return address;
147
- }
148
- return `${address.slice(0, 6)}...${address.slice(-4)}`;
149
- }
150
- function getDisconnectedNetworks() {
151
- if (typeof window === "undefined") {
152
- return {};
153
- }
154
- try {
155
- const cached = localStorage.getItem(WALLET_DISCONNECTED_NETWORKS_KEY);
156
- return cached ? JSON.parse(cached) : {};
157
- } catch (error) {
158
- return {};
159
- }
160
- }
161
- function markWalletDisconnected(networkType) {
162
- if (typeof window !== "undefined") {
163
- if (networkType) {
164
- const disconnected = getDisconnectedNetworks();
165
- disconnected[networkType] = true;
166
- localStorage.setItem(WALLET_DISCONNECTED_NETWORKS_KEY, JSON.stringify(disconnected));
167
- } else {
168
- localStorage.setItem(WALLET_DISCONNECTED_KEY, "true");
169
- localStorage.removeItem(CONNECTED_NETWORK_TYPE_KEY);
170
- }
171
- }
172
- }
173
- function clearWalletDisconnection(networkType) {
174
- if (typeof window !== "undefined") {
175
- if (networkType) {
176
- const disconnected = getDisconnectedNetworks();
177
- delete disconnected[networkType];
178
- localStorage.setItem(WALLET_DISCONNECTED_NETWORKS_KEY, JSON.stringify(disconnected));
179
- } else {
180
- localStorage.removeItem(WALLET_DISCONNECTED_KEY);
181
- }
182
- }
183
- }
184
- function isWalletManuallyDisconnected(networkType) {
185
- if (typeof window === "undefined") {
186
- return false;
187
- }
188
- if (networkType) {
189
- const disconnected = getDisconnectedNetworks();
190
- return disconnected[networkType] === true;
191
- } else {
192
- return localStorage.getItem(WALLET_DISCONNECTED_KEY) === "true";
193
- }
194
- }
195
- function saveConnectedNetworkType(networkType) {
196
- if (typeof window !== "undefined") {
197
- localStorage.setItem(CONNECTED_NETWORK_TYPE_KEY, networkType);
198
- }
199
- }
200
- function getConnectedNetworkType() {
201
- if (typeof window === "undefined") {
202
- return null;
203
- }
204
- const type = localStorage.getItem(CONNECTED_NETWORK_TYPE_KEY);
205
- return type || null;
206
- }
207
- function getWalletInstallUrl(networkType) {
208
- switch (networkType) {
209
- case "evm" /* EVM */:
210
- return "https://metamask.io/download/";
211
- case "solana" /* SOLANA */:
212
- case "svm" /* SVM */:
213
- return "https://phantom.app/download";
214
- default:
215
- return "#";
216
- }
217
- }
218
- function getWalletDisplayName(networkType) {
219
- switch (networkType) {
220
- case "evm" /* EVM */:
221
- return "MetaMask";
222
- case "solana" /* SOLANA */:
223
- case "svm" /* SVM */:
224
- return "Phantom";
225
- default:
226
- return "Unknown Wallet";
227
- }
228
- }
229
- function getAllWalletAddresses() {
230
- if (typeof window === "undefined") {
231
- return {};
232
- }
233
- try {
234
- const cached = localStorage.getItem(WALLET_ADDRESSES_KEY);
235
- return cached ? JSON.parse(cached) : {};
236
- } catch (error) {
237
- console.error("Failed to parse wallet addresses cache:", error);
238
- return {};
239
- }
240
- }
241
- function saveWalletAddress(networkType, address) {
242
- if (typeof window === "undefined") {
243
- return;
244
- }
245
- const addresses = getAllWalletAddresses();
246
- addresses[networkType] = address;
247
- localStorage.setItem(WALLET_ADDRESSES_KEY, JSON.stringify(addresses));
248
- }
249
- function getCachedWalletAddress(networkType) {
250
- const addresses = getAllWalletAddresses();
251
- return addresses[networkType] || null;
252
- }
253
- function removeWalletAddress(networkType) {
254
- if (typeof window === "undefined") {
255
- return;
256
- }
257
- const addresses = getAllWalletAddresses();
258
- delete addresses[networkType];
259
- localStorage.setItem(WALLET_ADDRESSES_KEY, JSON.stringify(addresses));
260
- }
261
- function clearAllWalletAddresses() {
262
- if (typeof window !== "undefined") {
263
- localStorage.removeItem(WALLET_ADDRESSES_KEY);
264
- }
265
- }
266
- var WALLET_DISCONNECTED_KEY, WALLET_DISCONNECTED_NETWORKS_KEY, CONNECTED_NETWORK_TYPE_KEY, WALLET_ADDRESSES_KEY;
267
- var init_wallet = __esm({
268
- "src/utils/wallet.ts"() {
269
- "use strict";
270
- WALLET_DISCONNECTED_KEY = "wallet_manually_disconnected";
271
- WALLET_DISCONNECTED_NETWORKS_KEY = "wallet_disconnected_networks";
272
- CONNECTED_NETWORK_TYPE_KEY = "connected_network_type";
273
- WALLET_ADDRESSES_KEY = "wallet_addresses_cache";
274
- }
275
- });
2
+ EvmNetworkSchema,
3
+ PROD_BACK_URL,
4
+ SolanaNetworkSchema,
5
+ __toCommonJS,
6
+ clearConnectedWallet,
7
+ clearWalletDisconnection,
8
+ connectToWallet,
9
+ formatAddress,
10
+ getCachedWalletAddress,
11
+ getConnectedNetworkType,
12
+ getWalletProviderForPayment,
13
+ getWalletsForNetwork,
14
+ initEVMWalletDiscovery,
15
+ init_common,
16
+ init_types,
17
+ init_wallet,
18
+ isWalletManuallyDisconnected,
19
+ markWalletDisconnected,
20
+ onEVMWalletsChanged,
21
+ removeWalletAddress,
22
+ saveConnectedNetworkType,
23
+ saveWalletAddress,
24
+ setCurrentConnectedWallet,
25
+ wallet_exports
26
+ } from "./chunk-WDPIFLXY.mjs";
276
27
 
277
28
  // src/react/index.ts
278
29
  import "./styles.css";
@@ -287,13 +38,13 @@ init_wallet();
287
38
  init_wallet();
288
39
  async function connectWallet(networkType, forceSelect = false) {
289
40
  if (typeof window === "undefined") {
290
- throw new Error("\u8BF7\u5728\u6D4F\u89C8\u5668\u73AF\u5883\u4E2D\u4F7F\u7528");
41
+ throw new Error("Please use in browser environment");
291
42
  }
292
43
  let address;
293
44
  switch (networkType) {
294
45
  case "evm" /* EVM */: {
295
46
  if (!window.ethereum) {
296
- throw new Error("\u8BF7\u5B89\u88C5 MetaMask \u6216\u5176\u4ED6\u4EE5\u592A\u574A\u94B1\u5305");
47
+ throw new Error("Please install MetaMask or another Ethereum wallet");
297
48
  }
298
49
  const ethereum = window.ethereum;
299
50
  if (forceSelect) {
@@ -311,7 +62,7 @@ async function connectWallet(networkType, forceSelect = false) {
311
62
  }
312
63
  } catch (err) {
313
64
  if (err.code === 4001) {
314
- throw new Error("\u7528\u6237\u53D6\u6D88\u4E86\u94B1\u5305\u8FDE\u63A5");
65
+ throw new Error("User cancelled wallet connection");
315
66
  }
316
67
  console.warn("wallet_requestPermissions failed, falling back to eth_requestAccounts");
317
68
  }
@@ -321,7 +72,7 @@ async function connectWallet(networkType, forceSelect = false) {
321
72
  params: []
322
73
  });
323
74
  if (!accounts || accounts.length === 0) {
324
- throw new Error("\u672A\u80FD\u83B7\u53D6\u5230\u94B1\u5305\u5730\u5740");
75
+ throw new Error("Failed to get wallet address");
325
76
  }
326
77
  address = accounts[0];
327
78
  break;
@@ -335,7 +86,7 @@ async function connectWallet(networkType, forceSelect = false) {
335
86
  solana = solflare;
336
87
  }
337
88
  if (!solana) {
338
- throw new Error("\u8BF7\u5B89\u88C5 Phantom \u6216\u5176\u4ED6 Solana \u94B1\u5305");
89
+ throw new Error("Please install Phantom or another Solana wallet");
339
90
  }
340
91
  if (forceSelect) {
341
92
  try {
@@ -361,7 +112,7 @@ async function connectWallet(networkType, forceSelect = false) {
361
112
  break;
362
113
  }
363
114
  default:
364
- throw new Error("\u4E0D\u652F\u6301\u7684\u7F51\u7EDC\u7C7B\u578B");
115
+ throw new Error("Unsupported network type");
365
116
  }
366
117
  clearWalletDisconnection(networkType);
367
118
  saveConnectedNetworkType(networkType);
@@ -399,8 +150,8 @@ async function disconnectWallet(networkType, clearAll = false) {
399
150
  await disconnectAllSolanaWallets();
400
151
  break;
401
152
  }
402
- // EVM 钱包(如 MetaMask)没有真正的 disconnect API
403
- // 只清除本地状态,下次连接时会重新请求权限
153
+ // EVM wallets (like MetaMask) don't have a real disconnect API
154
+ // Only clear local state, will request permissions again on next connection
404
155
  case "evm" /* EVM */:
405
156
  default:
406
157
  break;
@@ -431,36 +182,28 @@ async function getCurrentWallet(networkType) {
431
182
  return null;
432
183
  }
433
184
  const cachedAddress = getCachedWalletAddress(type);
434
- try {
435
- let currentAddress = null;
436
- switch (type) {
437
- case "evm" /* EVM */: {
438
- if (!window.ethereum) return cachedAddress;
185
+ if (type === "evm" /* EVM */) {
186
+ if (cachedAddress) {
187
+ return cachedAddress;
188
+ }
189
+ if (window.ethereum) {
190
+ try {
439
191
  const accounts = await window.ethereum.request({
440
192
  method: "eth_accounts",
441
193
  params: []
442
194
  });
443
- currentAddress = accounts && accounts.length > 0 ? accounts[0] : null;
444
- break;
195
+ return accounts && accounts.length > 0 ? accounts[0] : null;
196
+ } catch (error) {
197
+ console.error("Failed to get EVM accounts:", error);
198
+ return null;
445
199
  }
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;
452
- }
453
- default:
454
- return cachedAddress;
455
200
  }
456
- if (currentAddress && currentAddress !== cachedAddress) {
457
- saveWalletAddress(type, currentAddress);
458
- }
459
- return currentAddress || cachedAddress;
460
- } catch (error) {
461
- console.error("Failed to get current wallet:", error);
201
+ return null;
202
+ }
203
+ if (type === "solana" /* SOLANA */ || type === "svm" /* SVM */) {
462
204
  return cachedAddress;
463
205
  }
206
+ return cachedAddress;
464
207
  }
465
208
  function onAccountsChanged(callback) {
466
209
  if (typeof window === "undefined" || !window.ethereum) {
@@ -523,220 +266,6 @@ async function switchNetwork(networkType) {
523
266
  return null;
524
267
  }
525
268
 
526
- // src/utils/wallet-discovery.ts
527
- var SOLANA_WALLETS = [
528
- {
529
- id: "phantom",
530
- name: "Phantom",
531
- // Phantom official icon
532
- icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iMjYiIGZpbGw9IiNBQjlGRjIiLz4KPHBhdGggZD0iTTExMC41IDY0QzExMC41IDg5Ljk1NjggODkuMjAxIDExMSA2My41IDExMUg0MS41QzM2LjI1MzMgMTExIDMyIDEwNi43NDcgMzIgMTAxLjVWNTQuNUMzMiAzMS4wMjggNTEuMDI4IDEyIDc0LjUgMTJDOTcuOTcyIDEyIDExNyAzMS4wMjggMTE3IDU0LjVWNTUuNUMxMTcgNTguNTM3NiAxMTQuNTM4IDYxIDExMS41IDYxSDEwOS41QzEwNi40NjIgNjEgMTA0IDYzLjQ2MjQgMTA0IDY2LjVWNjhDMTA0IDcxLjg2NiAxMDcuMTM0IDc1IDExMSA3NUgxMTEuNUMxMTQuNTM4IDc1IDExNyA3Mi41Mzc2IDExNyA2OS41VjY0SDExMC41WiIgZmlsbD0idXJsKCNwYWludDBfbGluZWFyXzEyOF8xMjgpIi8+CjxwYXRoIGQ9Ik00OC41IDY3QzUxLjUzNzYgNjcgNTQgNjQuNTM3NiA1NCA2MS41QzU0IDU4LjQ2MjQgNTEuNTM3NiA1NiA0OC41IDU2QzQ1LjQ2MjQgNTYgNDMgNTguNDYyNCA0MyA2MS41QzQzIDY0LjUzNzYgNDUuNDYyNCA2NyA0OC41IDY3WiIgZmlsbD0iIzFCMUIxQiIvPgo8cGF0aCBkPSJNNzMuNSA2N0M3Ni41Mzc2IDY3IDc5IDY0LjUzNzYgNzkgNjEuNUM3OSA1OC40NjI0IDc2LjUzNzYgNTYgNzMuNSA1NkM3MC40NjI0IDU2IDY4IDU4LjQ2MjQgNjggNjEuNUM2OCA2NC41Mzc2IDcwLjQ2MjQgNjcgNzMuNSA2N1oiIGZpbGw9IiMxQjFCMUIiLz4KPGRlZnM+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhcl8xMjhfMTI4IiB4MT0iMTE3IiB5MT0iMTIiIHgyPSIxMTciIHkyPSIxMTEiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0ZGRkZGRiIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGRkZGRkYiIHN0b3Atb3BhY2l0eT0iMC44MiIvPgo8L2xpbmVhckdyYWRpZW50Pgo8L2RlZnM+Cjwvc3ZnPg==",
533
- detect: () => window.phantom?.solana
534
- },
535
- {
536
- id: "solflare",
537
- name: "Solflare",
538
- // Solflare icon
539
- icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iMjYiIGZpbGw9IiNGQzZEMDEiLz4KPHBhdGggZD0iTTk2IDY0TDY0IDMyTDMyIDY0TDY0IDk2TDk2IDY0WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+",
540
- detect: () => window.solflare
541
- },
542
- {
543
- id: "backpack",
544
- name: "Backpack",
545
- // Backpack icon (red coral color)
546
- icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iMjYiIGZpbGw9IiNFMzM0MzAiLz4KPHBhdGggZD0iTTQwIDQ4SDg4VjgwQzg4IDg4LjgzNjYgODAuODM2NiA5NiA3MiA5Nkg1NkM0Ny4xNjM0IDk2IDQwIDg4LjgzNjYgNDAgODBWNDhaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNNTIgMzJINzZWNDhINTJWMzJaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4=",
547
- detect: () => window.backpack
548
- },
549
- {
550
- id: "okx-solana",
551
- name: "OKX Wallet",
552
- // OKX icon
553
- icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iMjYiIGZpbGw9ImJsYWNrIi8+CjxyZWN0IHg9IjI0IiB5PSIyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiByeD0iNCIgZmlsbD0id2hpdGUiLz4KPHJlY3QgeD0iNTIiIHk9IjI0IiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHJ4PSI0IiBmaWxsPSJ3aGl0ZSIvPgo8cmVjdCB4PSI4MCIgeT0iMjQiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgcng9IjQiIGZpbGw9IndoaXRlIi8+CjxyZWN0IHg9IjI0IiB5PSI1MiIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiByeD0iNCIgZmlsbD0id2hpdGUiLz4KPHJlY3QgeD0iODAiIHk9IjUyIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHJ4PSI0IiBmaWxsPSJ3aGl0ZSIvPgo8cmVjdCB4PSIyNCIgeT0iODAiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgcng9IjQiIGZpbGw9IndoaXRlIi8+CjxyZWN0IHg9IjUyIiB5PSI4MCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiByeD0iNCIgZmlsbD0id2hpdGUiLz4KPHJlY3QgeD0iODAiIHk9IjgwIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHJ4PSI0IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4=",
554
- detect: () => window.okxwallet?.solana
555
- },
556
- {
557
- id: "coinbase-solana",
558
- name: "Coinbase Wallet",
559
- // Coinbase icon (blue)
560
- icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iMjYiIGZpbGw9IiMwMDUyRkYiLz4KPGNpcmNsZSBjeD0iNjQiIGN5PSI2NCIgcj0iMzYiIGZpbGw9IndoaXRlIi8+CjxyZWN0IHg9IjQ4IiB5PSI1NiIgd2lkdGg9IjMyIiBoZWlnaHQ9IjE2IiByeD0iNCIgZmlsbD0iIzAwNTJGRiIvPgo8L3N2Zz4=",
561
- detect: () => window.coinbaseSolana
562
- },
563
- {
564
- id: "trust-solana",
565
- name: "Trust Wallet",
566
- // Trust Wallet icon
567
- icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iMjYiIGZpbGw9IiMwNTAwRkYiLz4KPHBhdGggZD0iTTY0IDI0QzY0IDI0IDk2IDQwIDk2IDY0Qzk2IDg4IDY0IDEwNCA2NCAxMDRDNjQgMTA0IDMyIDg4IDMyIDY0QzMyIDQwIDY0IDI0IDY0IDI0WiIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSI2IiBmaWxsPSJub25lIi8+Cjwvc3ZnPg==",
568
- detect: () => window.trustwallet?.solana
569
- }
570
- ];
571
- var evmWallets = /* @__PURE__ */ new Map();
572
- var evmDiscoveryListeners = /* @__PURE__ */ new Set();
573
- var evmDiscoveryInitialized = false;
574
- var currentConnectedWallet = null;
575
- function initEVMWalletDiscovery() {
576
- if (typeof window === "undefined" || evmDiscoveryInitialized) return;
577
- evmDiscoveryInitialized = true;
578
- window.addEventListener("eip6963:announceProvider", ((event) => {
579
- const { info, provider } = event.detail;
580
- evmWallets.set(info.uuid, { info, provider });
581
- evmDiscoveryListeners.forEach((listener) => listener());
582
- }));
583
- window.dispatchEvent(new Event("eip6963:requestProvider"));
584
- }
585
- function getEVMWallets() {
586
- const wallets = [];
587
- const detectedNames = /* @__PURE__ */ new Set();
588
- evmWallets.forEach((detail, uuid) => {
589
- if (!detectedNames.has(detail.info.name)) {
590
- wallets.push({
591
- id: uuid,
592
- name: detail.info.name,
593
- icon: detail.info.icon,
594
- networkType: "evm" /* EVM */,
595
- provider: detail.provider,
596
- installed: true
597
- });
598
- detectedNames.add(detail.info.name);
599
- }
600
- });
601
- if (wallets.length === 0 && typeof window !== "undefined" && window.ethereum) {
602
- const ethereum = window.ethereum;
603
- const walletName = ethereum.isMetaMask ? "MetaMask" : ethereum.isCoinbaseWallet ? "Coinbase Wallet" : ethereum.isOkxWallet ? "OKX Wallet" : "Browser Wallet";
604
- if (!detectedNames.has(walletName)) {
605
- wallets.push({
606
- id: "injected",
607
- name: walletName,
608
- icon: "",
609
- // Will use first letter as avatar
610
- networkType: "evm" /* EVM */,
611
- provider: ethereum,
612
- installed: true
613
- });
614
- }
615
- }
616
- return wallets;
617
- }
618
- function onEVMWalletsChanged(callback) {
619
- evmDiscoveryListeners.add(callback);
620
- return () => {
621
- evmDiscoveryListeners.delete(callback);
622
- };
623
- }
624
- function getSolanaWallets() {
625
- if (typeof window === "undefined") return [];
626
- const wallets = [];
627
- const detectedProviders = /* @__PURE__ */ new Set();
628
- const detectedNames = /* @__PURE__ */ new Set();
629
- for (const wallet of SOLANA_WALLETS) {
630
- const provider = wallet.detect();
631
- if (provider && !detectedNames.has(wallet.name)) {
632
- wallets.push({
633
- id: wallet.id,
634
- name: wallet.name,
635
- icon: wallet.icon,
636
- networkType: "solana" /* SOLANA */,
637
- provider,
638
- installed: true
639
- });
640
- detectedProviders.add(provider);
641
- detectedNames.add(wallet.name);
642
- }
643
- }
644
- const windowSolana = window.solana;
645
- if (windowSolana && !detectedProviders.has(windowSolana)) {
646
- const walletName = windowSolana.isPhantom ? "Phantom" : windowSolana.isSolflare ? "Solflare" : windowSolana.isBackpack ? "Backpack" : windowSolana.walletName || "Solana Wallet";
647
- if (!detectedNames.has(walletName)) {
648
- wallets.push({
649
- id: "solana-unknown",
650
- name: walletName,
651
- icon: "",
652
- // Will use first letter as avatar
653
- networkType: "solana" /* SOLANA */,
654
- provider: windowSolana,
655
- installed: true
656
- });
657
- }
658
- }
659
- return wallets;
660
- }
661
- function getWalletsForNetwork(networkType) {
662
- switch (networkType) {
663
- case "evm" /* EVM */:
664
- return getEVMWallets();
665
- case "solana" /* SOLANA */:
666
- case "svm" /* SVM */:
667
- return getSolanaWallets();
668
- default:
669
- return [];
670
- }
671
- }
672
- async function connectEVMWallet(wallet) {
673
- if (!wallet.provider) {
674
- throw new Error(`\u94B1\u5305 ${wallet.name} \u4E0D\u53EF\u7528`);
675
- }
676
- const accounts = await wallet.provider.request({
677
- method: "eth_requestAccounts",
678
- params: []
679
- });
680
- if (!accounts || accounts.length === 0) {
681
- throw new Error("\u672A\u80FD\u83B7\u53D6\u5230\u94B1\u5305\u5730\u5740");
682
- }
683
- return accounts[0];
684
- }
685
- async function connectSolanaWallet(wallet) {
686
- if (!wallet.provider) {
687
- throw new Error(`\u94B1\u5305 ${wallet.name} \u4E0D\u53EF\u7528`);
688
- }
689
- if (wallet.provider.isConnected) {
690
- try {
691
- await wallet.provider.disconnect();
692
- } catch (err) {
693
- console.warn("Failed to disconnect before connecting:", err);
694
- }
695
- }
696
- const response = await wallet.provider.connect();
697
- return response.publicKey.toString();
698
- }
699
- async function connectToWallet(wallet) {
700
- let address;
701
- switch (wallet.networkType) {
702
- case "evm" /* EVM */:
703
- address = await connectEVMWallet(wallet);
704
- break;
705
- case "solana" /* SOLANA */:
706
- case "svm" /* SVM */:
707
- address = await connectSolanaWallet(wallet);
708
- break;
709
- default:
710
- throw new Error("\u4E0D\u652F\u6301\u7684\u7F51\u7EDC\u7C7B\u578B");
711
- }
712
- currentConnectedWallet = wallet;
713
- return address;
714
- }
715
- function setCurrentConnectedWallet(wallet) {
716
- currentConnectedWallet = wallet;
717
- }
718
- function clearConnectedWallet() {
719
- currentConnectedWallet = null;
720
- }
721
- function getWalletProviderForPayment(networkType) {
722
- if (currentConnectedWallet && currentConnectedWallet.networkType === networkType) {
723
- return currentConnectedWallet.provider;
724
- }
725
- if (typeof window === "undefined") return null;
726
- switch (networkType) {
727
- case "evm" /* EVM */:
728
- return window.ethereum;
729
- case "solana" /* SOLANA */:
730
- case "svm" /* SVM */:
731
- return window.phantom?.solana || window.solana;
732
- default:
733
- return null;
734
- }
735
- }
736
- if (typeof window !== "undefined") {
737
- initEVMWalletDiscovery();
738
- }
739
-
740
269
  // src/services/svm/payment-header.ts
741
270
  import { ComputeBudgetProgram, Connection, PublicKey, TransactionMessage, VersionedTransaction } from "@solana/web3.js";
742
271
  import {
@@ -1221,7 +750,7 @@ function getSupportedNetworkTypes(paymentRequirements) {
1221
750
  });
1222
751
  return Array.from(networkTypes);
1223
752
  }
1224
- async function makePayment(networkType, merchantId, endpoint = PROD_BACK_URL, additionalParams) {
753
+ async function makePayment(networkType, merchantId, endpoint = PROD_BACK_URL, additionalParams, expectedAddress) {
1225
754
  const fullEndpoint = `${endpoint}/${merchantId}`;
1226
755
  let response;
1227
756
  const requestInit = additionalParams && Object.keys(additionalParams).length > 0 ? {
@@ -1233,11 +762,19 @@ async function makePayment(networkType, merchantId, endpoint = PROD_BACK_URL, ad
1233
762
  if (networkType === "solana" /* SOLANA */ || networkType === "svm" /* SVM */) {
1234
763
  const solana = getWalletProviderForPayment(networkType);
1235
764
  if (!solana) {
1236
- throw new Error("\u8BF7\u5148\u8FDE\u63A5 Solana \u94B1\u5305");
765
+ throw new Error("Please connect your Solana wallet first.");
1237
766
  }
1238
767
  if (!solana.isConnected) {
1239
768
  await solana.connect();
1240
769
  }
770
+ const currentAddress = solana.publicKey?.toString();
771
+ if (expectedAddress && currentAddress) {
772
+ if (currentAddress !== expectedAddress) {
773
+ throw new Error(
774
+ `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.`
775
+ );
776
+ }
777
+ }
1241
778
  response = await handleSvmPayment(fullEndpoint, {
1242
779
  wallet: solana,
1243
780
  network: "solana"
@@ -1246,14 +783,20 @@ async function makePayment(networkType, merchantId, endpoint = PROD_BACK_URL, ad
1246
783
  } else if (networkType === "evm" /* EVM */) {
1247
784
  const ethereum = getWalletProviderForPayment(networkType);
1248
785
  if (!ethereum) {
1249
- throw new Error("\u8BF7\u5148\u8FDE\u63A5 EVM \u94B1\u5305");
786
+ throw new Error("Please connect the EVM wallet first");
1250
787
  }
1251
788
  const provider = new ethers2.BrowserProvider(ethereum);
1252
789
  const signer = await provider.getSigner();
790
+ const currentAddress = await signer.getAddress();
791
+ if (expectedAddress && currentAddress.toLowerCase() !== expectedAddress.toLowerCase()) {
792
+ throw new Error(
793
+ `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.`
794
+ );
795
+ }
1253
796
  const wallet = {
1254
- address: await signer.getAddress(),
1255
- signTypedData: async (domain, types, message2) => {
1256
- return await signer.signTypedData(domain, types, message2);
797
+ address: currentAddress,
798
+ signTypedData: async (domain, types, message) => {
799
+ return await signer.signTypedData(domain, types, message);
1257
800
  },
1258
801
  // Get current chain ID from wallet
1259
802
  getChainId: async () => {
@@ -1274,7 +817,7 @@ async function makePayment(networkType, merchantId, endpoint = PROD_BACK_URL, ad
1274
817
  // Will use backend's network configuration
1275
818
  }, requestInit);
1276
819
  } else {
1277
- throw new Error(`\u4E0D\u652F\u6301\u7684\u7F51\u7EDC\u7C7B\u578B: ${networkType}`);
820
+ throw new Error(`Unsupported network types: ${networkType}`);
1278
821
  }
1279
822
  return response;
1280
823
  }
@@ -1591,8 +1134,22 @@ var WalletStore = class {
1591
1134
  }
1592
1135
  this.setState({ isConnecting: true, error: null });
1593
1136
  try {
1594
- const address = await switchNetwork(type);
1137
+ let address = await switchNetwork(type);
1595
1138
  if (address) {
1139
+ const wallets = getWalletsForNetwork(type);
1140
+ if (wallets.length > 0) {
1141
+ const { getWalletProviderForPayment: getWalletProviderForPayment2 } = await import("./wallet-discovery-RN3DPV6V.mjs");
1142
+ const provider = getWalletProviderForPayment2(type);
1143
+ if (provider) {
1144
+ if (type === "solana" /* SOLANA */ || type === "svm" /* SVM */) {
1145
+ const providerAddress = provider.publicKey?.toString();
1146
+ if (providerAddress && providerAddress !== address) {
1147
+ address = providerAddress;
1148
+ saveWalletAddress(type, providerAddress);
1149
+ }
1150
+ }
1151
+ }
1152
+ }
1596
1153
  this.setState({
1597
1154
  address,
1598
1155
  networkType: type,
@@ -1617,7 +1174,7 @@ var WalletStore = class {
1617
1174
  // Disconnect wallet
1618
1175
  async disconnect() {
1619
1176
  const currentNetwork = this.state.networkType;
1620
- clearConnectedWallet();
1177
+ clearConnectedWallet(currentNetwork || void 0);
1621
1178
  if (currentNetwork) {
1622
1179
  try {
1623
1180
  await disconnectWallet(currentNetwork);
@@ -1643,6 +1200,16 @@ var WalletStore = class {
1643
1200
  return;
1644
1201
  }
1645
1202
  if (this.state.networkType === expectedNetwork && this.state.address) {
1203
+ const { getWalletProviderForPayment: getWalletProviderForPayment2 } = await import("./wallet-discovery-RN3DPV6V.mjs");
1204
+ const provider = getWalletProviderForPayment2(expectedNetwork);
1205
+ if (provider && (expectedNetwork === "solana" /* SOLANA */ || expectedNetwork === "svm" /* SVM */)) {
1206
+ const providerAddress = provider.publicKey?.toString();
1207
+ if (providerAddress && providerAddress !== this.state.address) {
1208
+ this.setState({ address: providerAddress });
1209
+ saveWalletAddress(expectedNetwork, providerAddress);
1210
+ return;
1211
+ }
1212
+ }
1646
1213
  return;
1647
1214
  }
1648
1215
  if (this.state.networkType !== expectedNetwork) {
@@ -1776,12 +1343,83 @@ function usePaymentInfo(merchantId, endpoint = PROD_BACK_URL, additionalParams)
1776
1343
  };
1777
1344
  }
1778
1345
 
1779
- // src/react/components/WalletConnect.tsx
1780
- import React2, { useState as useState4 } from "react";
1346
+ // src/react/hooks/useToast.tsx
1347
+ import React2, { useCallback as useCallback2, useRef, useState as useState3 } from "react";
1781
1348
 
1782
- // src/react/components/WalletSelectModal.tsx
1783
- import React, { useEffect as useEffect3, useState as useState3 } from "react";
1349
+ // src/react/components/ui/Toast.tsx
1350
+ import React, { useEffect as useEffect3 } from "react";
1784
1351
  import { createPortal } from "react-dom";
1352
+ var Toast = ({ message, type, onClose }) => {
1353
+ useEffect3(() => {
1354
+ const timer = setTimeout(onClose, 3e3);
1355
+ return () => clearTimeout(timer);
1356
+ }, [onClose]);
1357
+ const bgColor = type === "success" ? "#22c55e" : type === "error" ? "#ef4444" : "#3b82f6";
1358
+ const icon = type === "success" ? "\u2713" : type === "error" ? "\u2717" : "\u2139";
1359
+ return createPortal(
1360
+ /* @__PURE__ */ React.createElement(
1361
+ "div",
1362
+ {
1363
+ className: "fixed top-4 right-4 z-[99999] animate-slide-in-right",
1364
+ style: {
1365
+ animation: "slideInRight 0.3s ease-out"
1366
+ }
1367
+ },
1368
+ /* @__PURE__ */ React.createElement(
1369
+ "div",
1370
+ {
1371
+ className: "flex items-center gap-3 px-4 py-3 rounded-lg shadow-lg text-white font-mono text-sm",
1372
+ style: { backgroundColor: bgColor, minWidth: "280px" }
1373
+ },
1374
+ /* @__PURE__ */ React.createElement("span", { className: "text-lg" }, icon),
1375
+ /* @__PURE__ */ React.createElement("span", { className: "flex-1" }, message),
1376
+ /* @__PURE__ */ React.createElement(
1377
+ "button",
1378
+ {
1379
+ onClick: onClose,
1380
+ className: "text-white/80 hover:text-white transition-colors"
1381
+ },
1382
+ "\xD7"
1383
+ )
1384
+ )
1385
+ ),
1386
+ document.body
1387
+ );
1388
+ };
1389
+
1390
+ // src/react/hooks/useToast.tsx
1391
+ var useToast = () => {
1392
+ const [toasts, setToasts] = useState3([]);
1393
+ const toastIdRef = useRef(0);
1394
+ const showToast = useCallback2((message, type) => {
1395
+ const id = ++toastIdRef.current;
1396
+ setToasts((prev) => [...prev, { id, message, type }]);
1397
+ }, []);
1398
+ const removeToast = useCallback2((id) => {
1399
+ setToasts((prev) => prev.filter((t) => t.id !== id));
1400
+ }, []);
1401
+ const ToastContainer = () => /* @__PURE__ */ React2.createElement(React2.Fragment, null, toasts.map((toast, index) => /* @__PURE__ */ React2.createElement(
1402
+ "div",
1403
+ {
1404
+ key: toast.id,
1405
+ style: { top: `${16 + index * 60}px` },
1406
+ className: "fixed right-4 z-[99999]"
1407
+ },
1408
+ React2.createElement(Toast, {
1409
+ message: toast.message,
1410
+ type: toast.type,
1411
+ onClose: () => removeToast(toast.id)
1412
+ })
1413
+ )));
1414
+ return { showToast, ToastContainer };
1415
+ };
1416
+
1417
+ // src/react/components/wallet/WalletConnect.tsx
1418
+ import React4, { useState as useState5 } from "react";
1419
+
1420
+ // src/react/components/wallet/WalletSelectModal.tsx
1421
+ import React3, { useEffect as useEffect4, useState as useState4 } from "react";
1422
+ import { createPortal as createPortal2 } from "react-dom";
1785
1423
  var overlayStyle = {
1786
1424
  position: "fixed",
1787
1425
  top: 0,
@@ -1919,8 +1557,8 @@ function WalletItem({
1919
1557
  onSelect,
1920
1558
  onHover
1921
1559
  }) {
1922
- const [iconError, setIconError] = useState3(false);
1923
- return /* @__PURE__ */ React.createElement(
1560
+ const [iconError, setIconError] = useState4(false);
1561
+ return /* @__PURE__ */ React3.createElement(
1924
1562
  "div",
1925
1563
  {
1926
1564
  style: getWalletItemStyle(isHovered),
@@ -1928,7 +1566,7 @@ function WalletItem({
1928
1566
  onMouseEnter: () => onHover(true),
1929
1567
  onMouseLeave: () => onHover(false)
1930
1568
  },
1931
- wallet.icon && !iconError ? /* @__PURE__ */ React.createElement(
1569
+ wallet.icon && !iconError ? /* @__PURE__ */ React3.createElement(
1932
1570
  "img",
1933
1571
  {
1934
1572
  src: wallet.icon,
@@ -1936,8 +1574,8 @@ function WalletItem({
1936
1574
  style: walletIconStyle,
1937
1575
  onError: () => setIconError(true)
1938
1576
  }
1939
- ) : /* @__PURE__ */ React.createElement("div", { style: getWalletIconPlaceholderStyle(wallet.name) }, wallet.name.charAt(0).toUpperCase()),
1940
- /* @__PURE__ */ React.createElement("span", { style: walletNameStyle }, wallet.name)
1577
+ ) : /* @__PURE__ */ React3.createElement("div", { style: getWalletIconPlaceholderStyle(wallet.name) }, wallet.name.charAt(0).toUpperCase()),
1578
+ /* @__PURE__ */ React3.createElement("span", { style: walletNameStyle }, wallet.name)
1941
1579
  );
1942
1580
  }
1943
1581
  function WalletSelectModal({
@@ -1946,14 +1584,14 @@ function WalletSelectModal({
1946
1584
  onSelect,
1947
1585
  onClose
1948
1586
  }) {
1949
- const [wallets, setWallets] = useState3([]);
1950
- const [hoveredWallet, setHoveredWallet] = useState3(null);
1951
- const [mounted, setMounted] = useState3(false);
1952
- useEffect3(() => {
1587
+ const [wallets, setWallets] = useState4([]);
1588
+ const [hoveredWallet, setHoveredWallet] = useState4(null);
1589
+ const [mounted, setMounted] = useState4(false);
1590
+ useEffect4(() => {
1953
1591
  setMounted(true);
1954
1592
  return () => setMounted(false);
1955
1593
  }, []);
1956
- useEffect3(() => {
1594
+ useEffect4(() => {
1957
1595
  if (!isOpen) return;
1958
1596
  initEVMWalletDiscovery();
1959
1597
  const updateWallets = () => {
@@ -1974,7 +1612,7 @@ function WalletSelectModal({
1974
1612
  }
1975
1613
  };
1976
1614
  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(
1615
+ 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
1616
  WalletItem,
1979
1617
  {
1980
1618
  key: wallet.id,
@@ -1983,9 +1621,9 @@ function WalletSelectModal({
1983
1621
  onSelect: () => onSelect(wallet),
1984
1622
  onHover: (hovered) => setHoveredWallet(hovered ? wallet.id : null)
1985
1623
  }
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."))));
1624
+ ))) : /* @__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
1625
  if (typeof document !== "undefined") {
1988
- return createPortal(modalContent, document.body);
1626
+ return createPortal2(modalContent, document.body);
1989
1627
  }
1990
1628
  return modalContent;
1991
1629
  }
@@ -2157,7 +1795,7 @@ var getErrorStyle = () => {
2157
1795
  };
2158
1796
  };
2159
1797
 
2160
- // src/react/components/WalletConnect.tsx
1798
+ // src/react/components/wallet/WalletConnect.tsx
2161
1799
  function WalletConnect({
2162
1800
  supportedNetworks = ["solana" /* SOLANA */, "evm" /* EVM */],
2163
1801
  className = "",
@@ -2166,9 +1804,9 @@ function WalletConnect({
2166
1804
  showSwitchWallet = true
2167
1805
  }) {
2168
1806
  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);
1807
+ const [hoveredButton, setHoveredButton] = useState5(null);
1808
+ const [walletSelectOpen, setWalletSelectOpen] = useState5(false);
1809
+ const [selectedNetworkType, setSelectedNetworkType] = useState5(null);
2172
1810
  const handleOpenWalletSelect = (network) => {
2173
1811
  setSelectedNetworkType(network);
2174
1812
  setWalletSelectOpen(true);
@@ -2190,7 +1828,7 @@ function WalletConnect({
2190
1828
  setWalletSelectOpen(true);
2191
1829
  }
2192
1830
  };
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(
1831
+ 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
1832
  "button",
2195
1833
  {
2196
1834
  style: getConnectButtonStyle(isConnecting, hoveredButton === network),
@@ -2200,7 +1838,7 @@ function WalletConnect({
2200
1838
  onMouseLeave: () => setHoveredButton(null)
2201
1839
  },
2202
1840
  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(
1841
+ )))), 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
1842
  "button",
2205
1843
  {
2206
1844
  style: getConnectButtonStyle(isConnecting, hoveredButton === "switch"),
@@ -2210,7 +1848,7 @@ function WalletConnect({
2210
1848
  onMouseLeave: () => setHoveredButton(null)
2211
1849
  },
2212
1850
  isConnecting ? "Switching..." : "Switch Wallet"
2213
- ), /* @__PURE__ */ React2.createElement(
1851
+ ), /* @__PURE__ */ React4.createElement(
2214
1852
  "button",
2215
1853
  {
2216
1854
  style: getDisconnectButtonStyle(hoveredButton === "disconnect"),
@@ -2219,7 +1857,7 @@ function WalletConnect({
2219
1857
  onMouseLeave: () => setHoveredButton(null)
2220
1858
  },
2221
1859
  "Disconnect"
2222
- )), /* @__PURE__ */ React2.createElement("p", { style: getHintStyle() }, 'Click "Switch Wallet" to change wallet or account'))), selectedNetworkType && /* @__PURE__ */ React2.createElement(
1860
+ )), /* @__PURE__ */ React4.createElement("p", { style: getHintStyle() }, 'Click "Switch Wallet" to change wallet or account'))), selectedNetworkType && /* @__PURE__ */ React4.createElement(
2223
1861
  WalletSelectModal,
2224
1862
  {
2225
1863
  isOpen: walletSelectOpen,
@@ -2230,23 +1868,14 @@ function WalletConnect({
2230
1868
  ));
2231
1869
  }
2232
1870
 
2233
- // src/react/components/V402Checkout.tsx
2234
- import React4, { useEffect as useEffect4, useState as useState5 } from "react";
2235
- import { Button, Card, Divider, message, Spin, Tooltip, Typography } from "antd";
2236
- import {
2237
- DisconnectOutlined,
2238
- InfoCircleOutlined,
2239
- LinkOutlined,
2240
- LoadingOutlined,
2241
- LockOutlined,
2242
- SafetyOutlined
2243
- } from "@ant-design/icons";
1871
+ // src/react/components/checkout/V402CheckoutV2.tsx
1872
+ import React10, { useEffect as useEffect6, useState as useState7 } from "react";
2244
1873
  init_common();
2245
1874
 
2246
1875
  // src/react/utils/CryptoIcons.tsx
2247
- import React3 from "react";
1876
+ import React5 from "react";
2248
1877
  var SolanaIcon = ({ width = 16, height = 16, className, style }) => {
2249
- return /* @__PURE__ */ React3.createElement(
1878
+ return /* @__PURE__ */ React5.createElement(
2250
1879
  "svg",
2251
1880
  {
2252
1881
  xmlns: "http://www.w3.org/2000/svg",
@@ -2256,14 +1885,14 @@ var SolanaIcon = ({ width = 16, height = 16, className, style }) => {
2256
1885
  className,
2257
1886
  style
2258
1887
  },
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(
1888
+ /* @__PURE__ */ React5.createElement("desc", null, "Solana SOL Fill Streamline Icon: https://streamlinehq.com"),
1889
+ /* @__PURE__ */ React5.createElement("g", { fill: "none", fillRule: "evenodd" }, /* @__PURE__ */ React5.createElement(
2261
1890
  "path",
2262
1891
  {
2263
1892
  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
1893
  strokeWidth: "0.6667"
2265
1894
  }
2266
- ), /* @__PURE__ */ React3.createElement(
1895
+ ), /* @__PURE__ */ React5.createElement(
2267
1896
  "path",
2268
1897
  {
2269
1898
  fill: "#000000",
@@ -2274,7 +1903,7 @@ var SolanaIcon = ({ width = 16, height = 16, className, style }) => {
2274
1903
  );
2275
1904
  };
2276
1905
  var BaseIcon = ({ width = 24, height = 24, className, style }) => {
2277
- return /* @__PURE__ */ React3.createElement(
1906
+ return /* @__PURE__ */ React5.createElement(
2278
1907
  "svg",
2279
1908
  {
2280
1909
  xmlns: "http://www.w3.org/2000/svg",
@@ -2288,8 +1917,8 @@ var BaseIcon = ({ width = 24, height = 24, className, style }) => {
2288
1917
  className,
2289
1918
  style
2290
1919
  },
2291
- /* @__PURE__ */ React3.createElement("desc", null, "Brand Coinbase Streamline Icon: https://streamlinehq.com"),
2292
- /* @__PURE__ */ React3.createElement(
1920
+ /* @__PURE__ */ React5.createElement("desc", null, "Brand Coinbase Streamline Icon: https://streamlinehq.com"),
1921
+ /* @__PURE__ */ React5.createElement(
2293
1922
  "path",
2294
1923
  {
2295
1924
  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,30 +1938,503 @@ var getNetworkIcon = (network) => {
2309
1938
  return BaseIcon;
2310
1939
  };
2311
1940
 
2312
- // src/react/components/V402Checkout.tsx
2313
- var { Title, Text } = Typography;
2314
- var notify = {
2315
- success: (title, msg) => {
2316
- message.success(`${title}: ${msg}`);
1941
+ // src/react/styles/animations.tsx
1942
+ import React6 from "react";
1943
+ var checkoutAnimations = `
1944
+ @keyframes spin {
1945
+ from { transform: rotate(0deg); }
1946
+ to { transform: rotate(360deg); }
1947
+ }
1948
+
1949
+ @keyframes receiptShake {
1950
+ 0%, 100% { transform: rotate(-0.3deg); }
1951
+ 50% { transform: rotate(0.3deg); }
1952
+ }
1953
+
1954
+ @keyframes slideInRight {
1955
+ from {
1956
+ opacity: 0;
1957
+ transform: translateX(100px);
1958
+ }
1959
+ to {
1960
+ opacity: 1;
1961
+ transform: translateX(0);
1962
+ }
1963
+ }
1964
+
1965
+ @keyframes pulse {
1966
+ 0%, 100% { opacity: 1; }
1967
+ 50% { opacity: 0.4; }
1968
+ }
1969
+ `;
1970
+ var AnimationStyles = () => /* @__PURE__ */ React6.createElement("style", { dangerouslySetInnerHTML: { __html: checkoutAnimations } });
1971
+
1972
+ // src/react/components/checkout/Receipt.tsx
1973
+ import React7, { useEffect as useEffect5, useState as useState6 } from "react";
1974
+ var Receipt = ({
1975
+ isLoading,
1976
+ isVisible,
1977
+ result,
1978
+ error,
1979
+ paymentDetails,
1980
+ address,
1981
+ onClose,
1982
+ primaryColor,
1983
+ receiptTitle,
1984
+ tempReceiptId
1985
+ }) => {
1986
+ const [animationState, setAnimationState] = useState6("hidden");
1987
+ useEffect5(() => {
1988
+ if (isLoading) {
1989
+ setAnimationState("printing");
1990
+ } else if (isVisible && (result || error)) {
1991
+ setAnimationState("visible");
1992
+ const timer = setTimeout(() => setAnimationState("bounce"), 50);
1993
+ return () => clearTimeout(timer);
1994
+ } else if (!isVisible) {
1995
+ setAnimationState("hidden");
1996
+ }
1997
+ }, [isLoading, isVisible, result, error]);
1998
+ useEffect5(() => {
1999
+ if (animationState === "bounce") {
2000
+ const timer = setTimeout(() => setAnimationState("visible"), 150);
2001
+ return () => clearTimeout(timer);
2002
+ }
2003
+ }, [animationState]);
2004
+ const now = /* @__PURE__ */ new Date();
2005
+ const dateStr = `${String(now.getMonth() + 1).padStart(2, "0")}/${String(now.getDate()).padStart(2, "0")}/${String(now.getFullYear()).slice(-2)}`;
2006
+ const timeStr = `${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}`;
2007
+ const receiptId = result?.transactionHash ? result.transactionHash.slice(-8).toUpperCase() : tempReceiptId;
2008
+ const getAnimationStyles = () => {
2009
+ 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)";
2010
+ switch (animationState) {
2011
+ case "hidden":
2012
+ return {
2013
+ opacity: 0,
2014
+ transform: "translateY(50px)",
2015
+ marginBottom: 0,
2016
+ transition: baseTransition
2017
+ };
2018
+ case "printing":
2019
+ return {
2020
+ opacity: 1,
2021
+ transform: "translateY(0)",
2022
+ marginBottom: "-4px",
2023
+ // 负边距让小票贴着机器,还没撕开的感觉
2024
+ animation: "receiptShake 0.12s ease-in-out infinite",
2025
+ transition: baseTransition
2026
+ };
2027
+ case "visible":
2028
+ return {
2029
+ opacity: 1,
2030
+ transform: "translateY(0)",
2031
+ marginBottom: "8px",
2032
+ transition: baseTransition
2033
+ };
2034
+ case "bounce":
2035
+ return {
2036
+ opacity: 1,
2037
+ transform: "translateY(-8px)",
2038
+ marginBottom: "8px",
2039
+ transition: baseTransition
2040
+ };
2041
+ default:
2042
+ return {};
2043
+ }
2044
+ };
2045
+ const getContentStyles = () => {
2046
+ const baseTransition = "all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1)";
2047
+ switch (animationState) {
2048
+ case "hidden":
2049
+ return {
2050
+ maxHeight: 0,
2051
+ overflow: "hidden",
2052
+ transition: baseTransition
2053
+ };
2054
+ case "printing":
2055
+ return {
2056
+ maxHeight: "80px",
2057
+ overflow: "hidden",
2058
+ transition: baseTransition
2059
+ };
2060
+ case "visible":
2061
+ case "bounce":
2062
+ return {
2063
+ maxHeight: "600px",
2064
+ overflow: "visible",
2065
+ transition: baseTransition
2066
+ };
2067
+ default:
2068
+ return {};
2069
+ }
2070
+ };
2071
+ if (animationState === "hidden" && !isLoading) return null;
2072
+ return /* @__PURE__ */ React7.createElement(
2073
+ "div",
2074
+ {
2075
+ className: "w-full flex justify-center",
2076
+ style: getAnimationStyles()
2077
+ },
2078
+ /* @__PURE__ */ React7.createElement(
2079
+ "div",
2080
+ {
2081
+ className: "relative bg-white shadow-2xl",
2082
+ style: {
2083
+ width: "75%",
2084
+ maxWidth: "280px",
2085
+ backgroundImage: `
2086
+ repeating-linear-gradient(
2087
+ 0deg,
2088
+ transparent,
2089
+ transparent 1px,
2090
+ rgba(0,0,0,0.02) 1px,
2091
+ rgba(0,0,0,0.02) 2px
2092
+ )
2093
+ `
2094
+ }
2095
+ },
2096
+ /* @__PURE__ */ React7.createElement(
2097
+ "div",
2098
+ {
2099
+ className: "absolute top-0 left-0 right-0",
2100
+ style: {
2101
+ height: "8px",
2102
+ transform: "translateY(-100%)",
2103
+ background: `radial-gradient(circle at 50% 100%, white 5px, transparent 5px)`,
2104
+ backgroundSize: "12px 8px",
2105
+ backgroundPosition: "6px 0",
2106
+ backgroundRepeat: "repeat-x"
2107
+ }
2108
+ }
2109
+ ),
2110
+ /* @__PURE__ */ React7.createElement(
2111
+ "div",
2112
+ {
2113
+ className: "absolute left-0 right-0 bg-white",
2114
+ style: {
2115
+ height: "4px",
2116
+ top: "-4px"
2117
+ }
2118
+ }
2119
+ ),
2120
+ !isLoading && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
2121
+ "div",
2122
+ {
2123
+ className: "absolute bottom-0 left-0 right-0",
2124
+ style: {
2125
+ height: "8px",
2126
+ transform: "translateY(100%)",
2127
+ background: `radial-gradient(circle at 50% 0%, white 5px, transparent 5px)`,
2128
+ backgroundSize: "12px 8px",
2129
+ backgroundPosition: "6px 0",
2130
+ backgroundRepeat: "repeat-x"
2131
+ }
2132
+ }
2133
+ ), /* @__PURE__ */ React7.createElement(
2134
+ "div",
2135
+ {
2136
+ className: "absolute left-0 right-0 bg-white",
2137
+ style: {
2138
+ height: "4px",
2139
+ bottom: "-4px"
2140
+ }
2141
+ }
2142
+ )),
2143
+ !isLoading && (result || error) && /* @__PURE__ */ React7.createElement(
2144
+ "button",
2145
+ {
2146
+ onClick: onClose,
2147
+ 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",
2148
+ style: { background: "none", border: "none" }
2149
+ },
2150
+ /* @__PURE__ */ React7.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }, /* @__PURE__ */ React7.createElement("path", { d: "M18 6L6 18M6 6l12 12" }))
2151
+ ),
2152
+ /* @__PURE__ */ React7.createElement("div", { className: "p-4 font-mono text-sm", style: getContentStyles() }, /* @__PURE__ */ React7.createElement("div", { className: "text-center mb-3" }, /* @__PURE__ */ React7.createElement("div", { className: "text-base font-bold tracking-wider text-gray-800" }, receiptTitle), /* @__PURE__ */ React7.createElement("div", { className: "flex justify-between text-xs text-gray-500 mt-1" }, /* @__PURE__ */ React7.createElement("span", null, "ID: ", receiptId), /* @__PURE__ */ React7.createElement("span", null, dateStr, " ", timeStr))), /* @__PURE__ */ React7.createElement("div", { className: "border-t border-dashed border-gray-300 my-2" }), /* @__PURE__ */ React7.createElement(
2153
+ "div",
2154
+ {
2155
+ className: "max-h-64 overflow-y-auto pr-1",
2156
+ style: {
2157
+ scrollbarWidth: "thin",
2158
+ scrollbarColor: "#d1d5db transparent"
2159
+ }
2160
+ },
2161
+ isLoading ? /* @__PURE__ */ React7.createElement(LoadingContent, { primaryColor }) : error ? /* @__PURE__ */ React7.createElement(ErrorContent, { error }) : result ? /* @__PURE__ */ React7.createElement(
2162
+ SuccessContent,
2163
+ {
2164
+ result,
2165
+ paymentDetails,
2166
+ address,
2167
+ primaryColor
2168
+ }
2169
+ ) : null
2170
+ ), /* @__PURE__ */ React7.createElement("div", { className: "border-t border-dashed border-gray-300 my-2" }), /* @__PURE__ */ React7.createElement(Barcode, null), /* @__PURE__ */ React7.createElement("div", { className: "text-center text-xs text-gray-400 mt-1 tracking-widest" }, "POWERED BY", " ", /* @__PURE__ */ React7.createElement(
2171
+ "a",
2172
+ {
2173
+ href: "https://v402pay.onvoyage.ai",
2174
+ target: "_blank",
2175
+ rel: "noopener noreferrer",
2176
+ className: "text-gray-500 hover:text-gray-700 underline transition-colors"
2177
+ },
2178
+ "V402PAY"
2179
+ )))
2180
+ )
2181
+ );
2182
+ };
2183
+ var LoadingContent = ({ primaryColor }) => /* @__PURE__ */ React7.createElement("div", { className: "text-center py-4" }, /* @__PURE__ */ React7.createElement(
2184
+ "div",
2185
+ {
2186
+ className: "inline-block w-8 h-8 border-2 border-gray-200 rounded-full mb-2",
2187
+ style: {
2188
+ borderTopColor: primaryColor,
2189
+ animation: "spin 0.8s linear infinite"
2190
+ }
2191
+ }
2192
+ ), /* @__PURE__ */ React7.createElement("div", { className: "text-gray-700 font-semibold text-sm" }, "Processing..."), /* @__PURE__ */ React7.createElement("div", { className: "text-gray-400 text-xs mt-1" }, "Please wait"));
2193
+ var ErrorContent = ({ error }) => /* @__PURE__ */ React7.createElement("div", { className: "text-center py-3" }, /* @__PURE__ */ React7.createElement("div", { className: "text-red-500 text-2xl mb-2" }, "\u2717"), /* @__PURE__ */ React7.createElement("div", { className: "text-red-600 font-semibold mb-1 text-sm" }, "FAILED"), /* @__PURE__ */ React7.createElement("div", { className: "text-red-500 text-xs break-words px-2" }, error));
2194
+ var SuccessContent = ({
2195
+ result,
2196
+ paymentDetails,
2197
+ address,
2198
+ primaryColor
2199
+ }) => {
2200
+ const [copied, setCopied] = useState6(false);
2201
+ const handleCopy = async () => {
2202
+ try {
2203
+ await navigator.clipboard.writeText(JSON.stringify(result, null, 2));
2204
+ setCopied(true);
2205
+ setTimeout(() => setCopied(false), 2e3);
2206
+ } catch (err) {
2207
+ console.error("Failed to copy:", err);
2208
+ }
2209
+ };
2210
+ return /* @__PURE__ */ React7.createElement("div", null, /* @__PURE__ */ React7.createElement("div", { className: "text-center mb-2" }, /* @__PURE__ */ React7.createElement("div", { className: "text-2xl mb-1", style: { color: primaryColor } }, "\u2713"), /* @__PURE__ */ React7.createElement("div", { className: "font-semibold text-sm", style: { color: primaryColor } }, "SUCCESS")), /* @__PURE__ */ React7.createElement("div", { className: "space-y-1 text-xs" }, paymentDetails && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ React7.createElement("span", { className: "text-gray-500" }, "Amount:"), /* @__PURE__ */ React7.createElement("span", { className: "font-semibold" }, "$", paymentDetails.amount, " ", paymentDetails.currency)), /* @__PURE__ */ React7.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ React7.createElement("span", { className: "text-gray-500" }, "Network:"), /* @__PURE__ */ React7.createElement("span", { className: "font-semibold" }, paymentDetails.network))), address && /* @__PURE__ */ React7.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ React7.createElement("span", { className: "text-gray-500" }, "From:"), /* @__PURE__ */ React7.createElement("span", { className: "font-semibold" }, formatAddress(address))), result.transactionHash && /* @__PURE__ */ React7.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ React7.createElement("span", { className: "text-gray-500" }, "TX:"), /* @__PURE__ */ React7.createElement("span", { className: "font-semibold" }, formatAddress(result.transactionHash)))), /* @__PURE__ */ React7.createElement("div", { className: "border-t border-dashed border-gray-300 my-2" }), /* @__PURE__ */ React7.createElement("div", { className: "text-xs" }, /* @__PURE__ */ React7.createElement("div", { className: "flex justify-between items-center mb-1" }, /* @__PURE__ */ React7.createElement("span", { className: "text-gray-500" }, "Response:"), /* @__PURE__ */ React7.createElement(
2211
+ "button",
2212
+ {
2213
+ onClick: handleCopy,
2214
+ 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",
2215
+ style: { background: "none", border: "none" }
2216
+ },
2217
+ copied ? /* @__PURE__ */ React7.createElement("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }, /* @__PURE__ */ React7.createElement("path", { d: "M20 6L9 17l-5-5" })) : /* @__PURE__ */ React7.createElement("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }, /* @__PURE__ */ React7.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }), /* @__PURE__ */ React7.createElement("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" }))
2218
+ )), /* @__PURE__ */ React7.createElement(
2219
+ "pre",
2220
+ {
2221
+ className: "bg-gray-50 p-2 rounded text-xs overflow-auto whitespace-pre-wrap break-words",
2222
+ style: { maxHeight: "80px", fontSize: "10px" }
2223
+ },
2224
+ JSON.stringify(result, null, 2)
2225
+ )));
2226
+ };
2227
+ var Barcode = () => {
2228
+ const pattern = [2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1];
2229
+ const heights = [10, 12, 11, 13, 10, 14, 11, 12, 13, 10, 11, 14, 12, 10, 13, 11, 12, 14, 10, 11];
2230
+ return /* @__PURE__ */ React7.createElement("div", { className: "flex items-center justify-center gap-0.5 h-4 opacity-60" }, pattern.map((width, i) => /* @__PURE__ */ React7.createElement(
2231
+ "div",
2232
+ {
2233
+ key: i,
2234
+ className: "bg-gray-800",
2235
+ style: {
2236
+ width: `${width}px`,
2237
+ height: `${heights[i]}px`
2238
+ }
2239
+ }
2240
+ )));
2241
+ };
2242
+
2243
+ // src/react/components/checkout/TerminalScreen.tsx
2244
+ import React8 from "react";
2245
+ var TerminalScreen = ({
2246
+ title,
2247
+ tooltipText,
2248
+ hasInvalidCheckoutId,
2249
+ fetchingPaymentInfo,
2250
+ address,
2251
+ paymentDetails,
2252
+ screenText,
2253
+ supportedNetworks
2254
+ }) => {
2255
+ return /* @__PURE__ */ React8.createElement(
2256
+ "div",
2257
+ {
2258
+ className: "rounded-xl p-3 mb-3",
2259
+ style: {
2260
+ backgroundColor: "#0a1a0a",
2261
+ boxShadow: "inset 0 3px 16px rgba(0,0,0,0.5)",
2262
+ border: "3px solid rgba(0,0,0,0.3)"
2263
+ }
2264
+ },
2265
+ /* @__PURE__ */ React8.createElement("div", { className: "flex justify-between items-center mb-2" }, /* @__PURE__ */ React8.createElement("div", { className: "flex items-center gap-1.5 flex-1 min-w-0" }, /* @__PURE__ */ React8.createElement("div", { className: "w-2.5 h-2.5 rounded border border-green-700 flex-shrink-0" }), title ? /* @__PURE__ */ React8.createElement(
2266
+ "span",
2267
+ {
2268
+ className: "text-xs font-mono",
2269
+ style: { color: "#22c55e80" },
2270
+ title
2271
+ },
2272
+ title.length > 26 ? `${title.slice(0, 13)}...${title.slice(-13)}` : title
2273
+ ) : /* @__PURE__ */ React8.createElement("span", { className: "text-xs font-mono", style: { color: "#22c55e80" } }, "CHECKOUT")), /* @__PURE__ */ React8.createElement(
2274
+ "div",
2275
+ {
2276
+ className: "flex gap-0.5 flex-shrink-0 cursor-help",
2277
+ title: tooltipText
2278
+ },
2279
+ /* @__PURE__ */ React8.createElement(
2280
+ "div",
2281
+ {
2282
+ className: "w-1 h-1.5 rounded-sm",
2283
+ style: { backgroundColor: address ? "#22c55e80" : "#22c55e30" }
2284
+ }
2285
+ ),
2286
+ /* @__PURE__ */ React8.createElement(
2287
+ "div",
2288
+ {
2289
+ className: "w-1 h-1.5 rounded-sm",
2290
+ style: { backgroundColor: address ? "#22c55e80" : "#22c55e30" }
2291
+ }
2292
+ ),
2293
+ /* @__PURE__ */ React8.createElement("div", { className: "w-1 h-1.5 rounded-sm", style: { backgroundColor: "#22c55e80" } })
2294
+ )),
2295
+ /* @__PURE__ */ React8.createElement("div", { className: "min-h-[120px]" }, hasInvalidCheckoutId ? /* @__PURE__ */ React8.createElement(InvalidIdContent, null) : fetchingPaymentInfo ? /* @__PURE__ */ React8.createElement(LoadingContent2, null) : !address ? /* @__PURE__ */ React8.createElement(ConnectWalletContent, { supportedNetworks }) : /* @__PURE__ */ React8.createElement(
2296
+ PaymentInfoContent,
2297
+ {
2298
+ screenText,
2299
+ paymentDetails,
2300
+ address
2301
+ }
2302
+ ))
2303
+ );
2304
+ };
2305
+ var InvalidIdContent = () => /* @__PURE__ */ React8.createElement("div", { className: "text-center py-3" }, /* @__PURE__ */ React8.createElement("div", { className: "text-red-500 text-xl mb-1" }, "\u2717"), /* @__PURE__ */ React8.createElement("div", { className: "text-red-500 font-mono text-sm mb-1" }, "INVALID ID"), /* @__PURE__ */ React8.createElement("div", { className: "text-red-400 font-mono text-xs" }, "Check your checkout ID"));
2306
+ var LoadingContent2 = () => /* @__PURE__ */ React8.createElement("div", { className: "text-center py-4" }, /* @__PURE__ */ React8.createElement(
2307
+ "div",
2308
+ {
2309
+ className: "inline-block w-5 h-5 border-2 rounded-full mb-2",
2310
+ style: {
2311
+ borderColor: "#22c55e40",
2312
+ borderTopColor: "#22c55e",
2313
+ animation: "spin 1s linear infinite"
2314
+ }
2315
+ }
2316
+ ), /* @__PURE__ */ React8.createElement("div", { className: "font-mono text-sm", style: { color: "#22c55e" } }, "LOADING..."));
2317
+ var ConnectWalletContent = ({ supportedNetworks }) => /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement(
2318
+ "div",
2319
+ {
2320
+ className: "font-mono text-base mb-3 tracking-wider",
2321
+ style: { color: "#f97316", textShadow: "0 0 10px #f9731640" }
2317
2322
  },
2318
- error: (title, msg) => {
2319
- message.error(`${title}: ${msg}`);
2323
+ "CONNECT WALLET..."
2324
+ ), /* @__PURE__ */ React8.createElement(WalletConnect, { supportedNetworks, showSwitchWallet: false }));
2325
+ var PaymentInfoContent = ({
2326
+ screenText,
2327
+ paymentDetails,
2328
+ address
2329
+ }) => /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement(
2330
+ "div",
2331
+ {
2332
+ className: "font-mono text-base mb-3 tracking-wider",
2333
+ style: { color: "#f97316", textShadow: "0 0 10px #f9731640" }
2320
2334
  },
2321
- info: (title, msg) => {
2322
- message.info(`${title}: ${msg}`);
2323
- }
2335
+ screenText
2336
+ ), paymentDetails && /* @__PURE__ */ React8.createElement("div", { className: "text-xs font-mono" }, /* @__PURE__ */ React8.createElement("div", { className: "grid grid-cols-2 gap-1.5 mb-1.5" }, /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement("div", { style: { color: "#22c55e60" } }, "AMOUNT"), /* @__PURE__ */ React8.createElement("div", { style: { color: "#22c55e" } }, "$", paymentDetails.amount)), /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement("div", { style: { color: "#22c55e60" } }, "CURRENCY"), /* @__PURE__ */ React8.createElement("div", { style: { color: "#22c55e" } }, paymentDetails.currency))), /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement("div", { style: { color: "#22c55e60" } }, "WALLET"), /* @__PURE__ */ React8.createElement("div", { style: { color: "#22c55e", wordBreak: "break-all" } }, address))));
2337
+
2338
+ // src/react/components/checkout/TerminalButtons.tsx
2339
+ import React9 from "react";
2340
+ var TerminalButtons = ({
2341
+ address,
2342
+ showReceipt,
2343
+ isProcessing,
2344
+ paymentDetails,
2345
+ hasInvalidCheckoutId,
2346
+ onDisconnect,
2347
+ onClearReceipt,
2348
+ onPayment
2349
+ }) => {
2350
+ const isPayDisabled = isProcessing || !paymentDetails || !address || hasInvalidCheckoutId;
2351
+ return /* @__PURE__ */ React9.createElement("div", { className: "flex items-center justify-between px-1" }, /* @__PURE__ */ React9.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React9.createElement(
2352
+ CircleButton,
2353
+ {
2354
+ onClick: () => address && onDisconnect(),
2355
+ disabled: !address,
2356
+ title: "Disconnect",
2357
+ size: "small"
2358
+ },
2359
+ /* @__PURE__ */ React9.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "white", strokeWidth: "2" }, /* @__PURE__ */ React9.createElement("path", { d: "M18 6L6 18M6 6l12 12" }))
2360
+ ), /* @__PURE__ */ React9.createElement(
2361
+ CircleButton,
2362
+ {
2363
+ onClick: onClearReceipt,
2364
+ disabled: !showReceipt || isProcessing,
2365
+ title: "Clear",
2366
+ size: "small"
2367
+ },
2368
+ /* @__PURE__ */ React9.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "white", strokeWidth: "2" }, /* @__PURE__ */ React9.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" }))
2369
+ )), /* @__PURE__ */ React9.createElement("div", { className: "flex flex-col gap-0.5 opacity-40" }, /* @__PURE__ */ React9.createElement("div", { className: "w-6 h-0.5 rounded", style: { backgroundColor: "rgba(0,0,0,0.3)" } }), /* @__PURE__ */ React9.createElement("div", { className: "w-6 h-0.5 rounded", style: { backgroundColor: "rgba(0,0,0,0.3)" } }), /* @__PURE__ */ React9.createElement("div", { className: "w-6 h-0.5 rounded", style: { backgroundColor: "rgba(0,0,0,0.3)" } })), /* @__PURE__ */ React9.createElement(
2370
+ "button",
2371
+ {
2372
+ onClick: onPayment,
2373
+ disabled: isPayDisabled,
2374
+ className: "px-5 py-2.5 rounded-xl font-bold text-white flex items-center gap-2 transition-all active:scale-95",
2375
+ style: {
2376
+ backgroundColor: isPayDisabled ? "#9ca3af" : "#ea580c",
2377
+ boxShadow: isPayDisabled ? "none" : "0 4px 12px rgba(234,88,12,0.4), inset 0 -2px 4px rgba(0,0,0,0.2)",
2378
+ cursor: isPayDisabled ? "not-allowed" : "pointer"
2379
+ }
2380
+ },
2381
+ isProcessing ? /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
2382
+ "div",
2383
+ {
2384
+ className: "w-4 h-4 border-2 border-white/30 border-t-white rounded-full",
2385
+ style: { animation: "spin 0.8s linear infinite" }
2386
+ }
2387
+ ), /* @__PURE__ */ React9.createElement("span", { className: "font-mono tracking-wider text-sm" }, "PAYING...")) : /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement("span", { className: "font-mono tracking-wider text-sm" }, "PAY"), /* @__PURE__ */ React9.createElement(
2388
+ "svg",
2389
+ {
2390
+ width: "18",
2391
+ height: "18",
2392
+ viewBox: "0 0 24 24",
2393
+ fill: "none",
2394
+ stroke: "currentColor",
2395
+ strokeWidth: "2"
2396
+ },
2397
+ /* @__PURE__ */ React9.createElement("path", { d: "M12 2v20M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6" })
2398
+ ))
2399
+ ));
2400
+ };
2401
+ var CircleButton = ({ onClick, disabled, title, size = "normal", children }) => {
2402
+ const sizeClass = size === "small" ? "w-10 h-10" : "w-12 h-12";
2403
+ return /* @__PURE__ */ React9.createElement(
2404
+ "button",
2405
+ {
2406
+ onClick,
2407
+ disabled,
2408
+ className: `${sizeClass} rounded-full flex items-center justify-center transition-transform active:scale-95`,
2409
+ style: {
2410
+ backgroundColor: "#374151",
2411
+ boxShadow: "inset 0 -2px 4px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2)",
2412
+ opacity: disabled ? 0.5 : 1
2413
+ },
2414
+ title
2415
+ },
2416
+ children
2417
+ );
2418
+ };
2419
+
2420
+ // src/react/components/checkout/V402CheckoutV2.tsx
2421
+ var generateRandomId = () => {
2422
+ const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
2423
+ return Array.from({ length: 8 }, () => chars[Math.floor(Math.random() * chars.length)]).join("");
2324
2424
  };
2325
- function V402Checkout({
2425
+ function V402CheckoutV2({
2326
2426
  checkoutId,
2327
2427
  headerInfo = {},
2428
+ primaryColor = "#84cc16",
2328
2429
  isModal = false,
2329
2430
  onPaymentComplete,
2330
2431
  additionalParams = {},
2331
2432
  expectedNetwork
2332
2433
  }) {
2333
2434
  const {
2334
- title = "V402Pay - Make x402Pay Easier",
2335
- subtitle = "onvoyage.ai",
2435
+ title = "V402Pay Checkout",
2436
+ brandName = "V402PAY",
2437
+ receiptTitle = "V402 PAYMENT",
2336
2438
  tooltipText = "V402Pay - Accept Crypto Payments Easier"
2337
2439
  } = headerInfo;
2338
2440
  const endpoint = PROD_BACK_URL;
@@ -2347,457 +2449,181 @@ function V402Checkout({
2347
2449
  { autoSwitch: !!targetNetwork, switchOnMount: true }
2348
2450
  );
2349
2451
  const { isProcessing, setIsProcessing, result, setResult, error, setError } = usePayment();
2350
- const [paymentDetails, setPaymentDetails] = useState5(null);
2452
+ const [paymentDetails, setPaymentDetails] = useState7(null);
2453
+ const [showReceipt, setShowReceipt] = useState7(false);
2454
+ const [tempReceiptId, setTempReceiptId] = useState7(() => generateRandomId());
2351
2455
  const handleDisconnect = () => {
2352
2456
  disconnect();
2353
2457
  setResult(null);
2354
2458
  setError(null);
2355
- notify.info("Wallet Disconnected", "Your wallet has been disconnected successfully.");
2459
+ setShowReceipt(false);
2356
2460
  };
2357
- useEffect4(() => {
2358
- if (paymentInfo && paymentInfo.length > 0) {
2359
- const firstPayment = paymentInfo[0];
2360
- const rawAmount = firstPayment.maxAmountRequired?.toString() || "0";
2361
- const decimals = 6;
2362
- const humanReadableAmount = (Number(rawAmount) / Math.pow(10, decimals)).toFixed(2);
2363
- const network = firstPayment.network || "Unknown";
2364
- const currency = "USDC";
2365
- setPaymentDetails({
2366
- amount: humanReadableAmount,
2367
- currency,
2368
- network
2369
- });
2370
- }
2371
- }, [paymentInfo]);
2372
- useEffect4(() => {
2373
- if (targetNetwork && !fetchingPaymentInfo && ensureNetwork) {
2374
- ensureNetwork(targetNetwork).catch((err) => {
2375
- console.error("Failed to ensure network:", err);
2376
- });
2377
- }
2378
- }, [targetNetwork, fetchingPaymentInfo]);
2379
2461
  const handlePayment = async () => {
2380
- if (!networkType) {
2381
- notify.error("Wallet Not Connected", "Please connect your wallet first.");
2382
- return;
2383
- }
2462
+ if (!networkType) return;
2463
+ setTempReceiptId(generateRandomId());
2384
2464
  setResult(null);
2385
2465
  setError(null);
2386
2466
  setIsProcessing(true);
2467
+ setShowReceipt(true);
2387
2468
  try {
2388
- const response = await makePayment(networkType, checkoutId, endpoint, additionalParams);
2469
+ const response = await makePayment(networkType, checkoutId, endpoint, additionalParams, address || void 0);
2389
2470
  const data = await response.json();
2390
2471
  setResult(data);
2391
- notify.success("Payment Successful!", "Your payment has been processed successfully.");
2392
2472
  if (onPaymentComplete) {
2393
2473
  onPaymentComplete(data);
2394
2474
  }
2395
2475
  } catch (err) {
2396
- const errorMessage = err.message || "Payment failed";
2397
- setError(errorMessage);
2398
- notify.error("Payment Failed", errorMessage);
2476
+ setError(err.message || "Payment failed");
2399
2477
  } finally {
2400
2478
  setIsProcessing(false);
2401
2479
  }
2402
2480
  };
2403
- const getNetworkColor = (network) => {
2404
- if (network.toLowerCase().includes("solana")) return "#14F195";
2405
- if (network.toLowerCase().includes("evm") || network.toLowerCase().includes("base")) return "#0052FF";
2406
- return "#8c8c8c";
2481
+ const handleCloseReceipt = () => {
2482
+ setShowReceipt(false);
2483
+ setResult(null);
2484
+ setError(null);
2407
2485
  };
2408
- const NetworkIcon = paymentDetails ? getNetworkIcon(paymentDetails.network) : null;
2409
- const networkColor = paymentDetails ? getNetworkColor(paymentDetails.network) : "#8c8c8c";
2410
- const loadingColor = "#8c8c8c";
2486
+ useEffect6(() => {
2487
+ if (paymentInfo && paymentInfo.length > 0) {
2488
+ const firstPayment = paymentInfo[0];
2489
+ const rawAmount = firstPayment.maxAmountRequired?.toString() || "0";
2490
+ const decimals = 6;
2491
+ const humanReadableAmount = (Number(rawAmount) / Math.pow(10, decimals)).toFixed(2);
2492
+ const network = firstPayment.network || "Unknown";
2493
+ const currency = "USDC";
2494
+ setPaymentDetails({ amount: humanReadableAmount, currency, network });
2495
+ }
2496
+ }, [paymentInfo]);
2497
+ useEffect6(() => {
2498
+ if (targetNetwork && !fetchingPaymentInfo && ensureNetwork) {
2499
+ ensureNetwork(targetNetwork).catch((err) => {
2500
+ console.error("Failed to ensure network:", err);
2501
+ });
2502
+ }
2503
+ }, [targetNetwork, fetchingPaymentInfo]);
2504
+ useEffect6(() => {
2505
+ if (isProcessing || result || error) {
2506
+ setShowReceipt(true);
2507
+ }
2508
+ }, [isProcessing, result, error]);
2411
2509
  const hasInvalidCheckoutId = !fetchingPaymentInfo && (!paymentInfo || paymentInfo.length === 0);
2412
- return /* @__PURE__ */ React4.createElement(
2510
+ const NetworkIcon = paymentDetails ? getNetworkIcon(paymentDetails.network) : null;
2511
+ const screenText = paymentDetails ? `PAY $${paymentDetails.amount} ${paymentDetails.currency}` : "AWAITING...";
2512
+ const getStatusText = () => {
2513
+ if (hasInvalidCheckoutId) return "ERROR";
2514
+ if (fetchingPaymentInfo) return "LOADING";
2515
+ if (!address) return "CONNECT";
2516
+ if (isProcessing) return "PAYING";
2517
+ return "READY";
2518
+ };
2519
+ return /* @__PURE__ */ React10.createElement("div", { className: isModal ? "bg-transparent" : "min-h-screen bg-gray-100 flex items-center justify-center p-4" }, /* @__PURE__ */ React10.createElement(
2413
2520
  "div",
2414
2521
  {
2415
- className: isModal ? "bg-white" : "h-screen bg-white flex items-center justify-center p-4 overflow-hidden"
2522
+ className: "flex flex-col items-center",
2523
+ style: { width: isModal ? "100%" : "380px", maxWidth: "100%" }
2416
2524
  },
2417
- /* @__PURE__ */ React4.createElement(
2525
+ /* @__PURE__ */ React10.createElement(
2526
+ Receipt,
2527
+ {
2528
+ isLoading: isProcessing,
2529
+ isVisible: showReceipt,
2530
+ result,
2531
+ error,
2532
+ paymentDetails,
2533
+ address,
2534
+ onClose: handleCloseReceipt,
2535
+ primaryColor,
2536
+ receiptTitle,
2537
+ tempReceiptId
2538
+ }
2539
+ ),
2540
+ /* @__PURE__ */ React10.createElement(
2418
2541
  "div",
2419
2542
  {
2420
- className: "flex gap-4 items-center justify-center",
2543
+ className: "relative rounded-2xl p-3 shadow-2xl w-full",
2421
2544
  style: {
2422
- maxWidth: isProcessing || result || error ? "1200px" : "480px",
2423
- transition: "max-width 0.4s ease-in-out",
2424
- width: "100%"
2545
+ backgroundColor: primaryColor,
2546
+ boxShadow: `0 16px 48px -8px ${primaryColor}66, 0 8px 24px -4px rgba(0,0,0,0.3);padding-bottom: 0px`
2425
2547
  }
2426
2548
  },
2427
- /* @__PURE__ */ React4.createElement(
2428
- Card,
2549
+ /* @__PURE__ */ React10.createElement(
2550
+ "div",
2551
+ {
2552
+ className: "absolute top-0 left-1/2 -translate-x-1/2 w-1/3 h-2.5 rounded-b-lg",
2553
+ style: { backgroundColor: "rgba(0,0,0,0.4)" }
2554
+ }
2555
+ ),
2556
+ /* @__PURE__ */ React10.createElement("div", { className: "flex justify-between items-center mb-2 mt-1 px-1" }, /* @__PURE__ */ React10.createElement("div", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ React10.createElement(
2557
+ "div",
2429
2558
  {
2430
- className: "flex-shrink-0",
2559
+ className: "w-2 h-2 rounded-full",
2431
2560
  style: {
2432
- border: isModal ? "none" : "1px solid #e8e8e8",
2433
- borderRadius: isModal ? "0" : "16px",
2434
- boxShadow: isModal ? "none" : "0 4px 24px rgba(0, 0, 0, 0.06)",
2435
- maxHeight: isModal ? "calc(100vh - 100px)" : "calc(100vh - 32px)",
2436
- overflow: "auto",
2437
- width: isModal ? "100%" : "480px",
2438
- transition: "all 0.4s ease-in-out",
2439
- transform: result || error ? "translateX(0)" : "translateX(0)"
2440
- },
2441
- styles: { body: { padding: isModal ? "0px" : "32px 24px" } }
2561
+ backgroundColor: address ? "#22c55e" : "#ef4444",
2562
+ animation: "pulse 2s ease-in-out infinite"
2563
+ }
2564
+ }
2565
+ ), /* @__PURE__ */ React10.createElement(
2566
+ "span",
2567
+ {
2568
+ className: "text-xs font-mono font-bold tracking-wider",
2569
+ style: { color: "rgba(0,0,0,0.7)" }
2442
2570
  },
2443
- /* @__PURE__ */ React4.createElement("div", { className: "flex items-center gap-3 mb-4" }, /* @__PURE__ */ React4.createElement(
2444
- "div",
2445
- {
2446
- className: "w-12 h-12 rounded-xl flex items-center justify-center",
2447
- style: {
2448
- background: hasInvalidCheckoutId ? "#ff4d4f" : paymentDetails ? networkColor : loadingColor,
2449
- transition: "background 0.3s ease"
2450
- }
2451
- },
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(
2454
- Tooltip,
2455
- {
2456
- title: tooltipText,
2457
- placement: "top"
2458
- },
2459
- /* @__PURE__ */ React4.createElement(
2460
- InfoCircleOutlined,
2461
- {
2462
- style: { fontSize: "14px", color: "#8c8c8c", cursor: "help" }
2463
- }
2464
- )
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(
2468
- "div",
2469
- {
2470
- className: "inline-flex items-center justify-center w-16 h-16 rounded-full mb-4",
2471
- style: {
2472
- background: "linear-gradient(135deg, #ef4444 0%, #f87171 100%)",
2473
- boxShadow: "0 4px 20px rgba(239, 68, 68, 0.3)"
2474
- }
2475
- },
2476
- /* @__PURE__ */ React4.createElement("span", { style: { fontSize: "32px", color: "white" } }, "!")
2477
- ), /* @__PURE__ */ React4.createElement(
2478
- Title,
2479
- {
2480
- level: 4,
2481
- style: { margin: "0 0 12px 0", fontSize: "18px", fontWeight: 600, color: "#262626" }
2482
- },
2483
- "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(
2485
- "div",
2486
- {
2487
- style: {
2488
- background: "#fef2f2",
2489
- padding: "16px",
2490
- borderRadius: "12px",
2491
- border: "1px solid #fee2e2",
2492
- marginTop: "16px"
2493
- }
2494
- },
2495
- /* @__PURE__ */ React4.createElement(Text, { style: {
2496
- fontSize: "13px",
2497
- color: "#dc2626",
2498
- lineHeight: "1.6",
2499
- fontWeight: 500
2500
- } }, "Failed to load payment information. Please check your checkout ID.")
2501
- )),
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(
2505
- "div",
2506
- {
2507
- className: "bg-gray-50 rounded-lg p-3 mb-4",
2508
- style: { border: "1px solid #f0f0f0" }
2509
- },
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(
2511
- "div",
2512
- {
2513
- className: "w-10 h-10 rounded-full bg-black flex items-center justify-center text-white text-sm font-semibold"
2514
- },
2515
- address.slice(0, 2).toUpperCase()
2516
- ), /* @__PURE__ */ React4.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React4.createElement(Text, { style: {
2517
- display: "block",
2518
- fontSize: "12px",
2519
- color: "#8c8c8c",
2520
- marginBottom: "2px"
2521
- } }, "Connected Wallet"), /* @__PURE__ */ React4.createElement(
2522
- Text,
2523
- {
2524
- style: {
2525
- fontSize: "13px",
2526
- fontWeight: 600,
2527
- fontFamily: "Monaco, monospace"
2528
- }
2529
- },
2530
- formatAddress(address)
2531
- ))), /* @__PURE__ */ React4.createElement(
2532
- Button,
2533
- {
2534
- type: "text",
2535
- size: "small",
2536
- icon: /* @__PURE__ */ React4.createElement(DisconnectOutlined, null),
2537
- onClick: handleDisconnect,
2538
- style: { color: "#ff4d4f" }
2539
- }
2540
- ))
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: {
2542
- fontSize: "11px",
2543
- fontWeight: 500,
2544
- fontFamily: "Monaco, monospace",
2545
- wordBreak: "break-all",
2546
- textAlign: "right",
2547
- maxWidth: "60%",
2548
- lineHeight: 1.4
2549
- } }, address))), /* @__PURE__ */ React4.createElement(
2550
- "div",
2551
- {
2552
- className: "flex items-center justify-center gap-2 mb-3 p-2 rounded-lg",
2553
- style: { background: "#f6ffed", border: "1px solid #d9f7be" }
2554
- },
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(
2558
- Button,
2559
- {
2560
- type: "primary",
2561
- size: "large",
2562
- onClick: handlePayment,
2563
- disabled: isProcessing || !paymentDetails,
2564
- loading: isProcessing,
2565
- block: true,
2566
- style: {
2567
- height: "44px",
2568
- fontSize: "14px",
2569
- fontWeight: 600,
2570
- borderRadius: "8px",
2571
- ...!isProcessing && paymentDetails && {
2572
- background: "#1a1a1a",
2573
- borderColor: "#1a1a1a"
2574
- },
2575
- marginBottom: "10px"
2576
- }
2577
- },
2578
- 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(
2580
- "a",
2581
- {
2582
- href: "https://faucet.circle.com/",
2583
- target: "_blank",
2584
- rel: "noopener noreferrer",
2585
- className: "text-blue-600 hover:text-blue-700 text-sm font-medium inline-flex items-center gap-1"
2586
- },
2587
- "Get it here ",
2588
- /* @__PURE__ */ React4.createElement(LinkOutlined, { style: { fontSize: "12px" } })
2589
- )), isModal && result && /* @__PURE__ */ React4.createElement(
2590
- "div",
2591
- {
2592
- className: "mt-4 p-4 rounded-lg",
2593
- style: { background: "#f6ffed", border: "1px solid #b7eb8f" }
2594
- },
2595
- /* @__PURE__ */ React4.createElement("div", { className: "text-center" }, /* @__PURE__ */ React4.createElement("span", { style: { fontSize: "20px" } }, "\u2713"), /* @__PURE__ */ React4.createElement(Text, { style: {
2596
- fontSize: "14px",
2597
- color: "#52c41a",
2598
- fontWeight: 600,
2599
- marginLeft: "8px"
2600
- } }, "Payment Successful!"))
2601
- ), isModal && error && /* @__PURE__ */ React4.createElement(
2602
- "div",
2603
- {
2604
- className: "mt-4 p-4 rounded-lg",
2605
- style: { background: "#fff2f0", border: "1px solid #ffccc7" }
2606
- },
2607
- /* @__PURE__ */ React4.createElement("div", { className: "text-center mb-3" }, /* @__PURE__ */ React4.createElement("span", { style: { fontSize: "20px" } }, "\u2717"), /* @__PURE__ */ React4.createElement(Text, { style: {
2608
- fontSize: "14px",
2609
- color: "#ff4d4f",
2610
- fontWeight: 600,
2611
- marginLeft: "8px",
2612
- display: "block",
2613
- marginTop: "4px"
2614
- } }, "Payment Failed")),
2615
- /* @__PURE__ */ React4.createElement(Text, { style: {
2616
- fontSize: "13px",
2617
- color: "#ff4d4f",
2618
- display: "block",
2619
- textAlign: "center"
2620
- } }, error)
2621
- ))
2571
+ getStatusText()
2572
+ )), /* @__PURE__ */ React10.createElement("div", { className: "flex items-center gap-1.5" }, paymentDetails && NetworkIcon && /* @__PURE__ */ React10.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ React10.createElement(NetworkIcon, { width: 12, height: 12, style: { color: "rgba(0,0,0,0.7)" } }), /* @__PURE__ */ React10.createElement("span", { className: "text-xs font-mono font-bold", style: { color: "rgba(0,0,0,0.7)" } }, paymentDetails.network)))),
2573
+ /* @__PURE__ */ React10.createElement(
2574
+ TerminalScreen,
2575
+ {
2576
+ title,
2577
+ tooltipText,
2578
+ hasInvalidCheckoutId,
2579
+ fetchingPaymentInfo,
2580
+ address,
2581
+ paymentDetails,
2582
+ screenText,
2583
+ supportedNetworks
2584
+ }
2622
2585
  ),
2623
- !isModal && (isProcessing || result || error) && /* @__PURE__ */ React4.createElement(
2624
- Card,
2586
+ /* @__PURE__ */ React10.createElement(
2587
+ TerminalButtons,
2625
2588
  {
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(
2628
- Button,
2629
- {
2630
- type: "text",
2631
- size: "small",
2632
- onClick: () => {
2633
- setResult(null);
2634
- setError(null);
2635
- }
2636
- },
2637
- "Close"
2638
- ),
2589
+ address,
2590
+ showReceipt,
2591
+ isProcessing,
2592
+ paymentDetails,
2593
+ hasInvalidCheckoutId,
2594
+ onDisconnect: handleDisconnect,
2595
+ onClearReceipt: handleCloseReceipt,
2596
+ onPayment: handlePayment
2597
+ }
2598
+ ),
2599
+ brandName && /* @__PURE__ */ React10.createElement("div", { className: "text-center mt-0 mb-0" }, /* @__PURE__ */ React10.createElement(
2600
+ "div",
2601
+ {
2602
+ className: "inline-block px-2 py-0.5 rounded text-[10px] font-mono font-bold tracking-[0.2em]",
2639
2603
  style: {
2640
- border: "1px solid #e8e8e8",
2641
- borderRadius: "16px",
2642
- boxShadow: "0 4px 24px rgba(0, 0, 0, 0.06)",
2643
- maxHeight: "calc(100vh - 32px)",
2644
- width: "480px",
2645
- animation: "slideInRight 0.4s ease-out"
2646
- },
2647
- styles: {
2648
- body: {
2649
- padding: "24px",
2650
- maxHeight: "calc(100vh - 120px)",
2651
- overflow: "auto"
2652
- }
2604
+ backgroundColor: "#1a1a1a",
2605
+ color: "#9acd32",
2606
+ boxShadow: "inset 0 1px 3px rgba(0,0,0,0.8), 0 1px 0 rgba(255,255,255,0.1)",
2607
+ border: "1px solid rgba(0,0,0,0.5)",
2608
+ textShadow: "0 0 4px #9acd3280"
2653
2609
  }
2654
2610
  },
2655
- isProcessing && !result && !error && /* @__PURE__ */ React4.createElement("div", { className: "text-center py-10" }, /* @__PURE__ */ React4.createElement("div", { className: "relative inline-block" }, /* @__PURE__ */ React4.createElement(
2656
- "div",
2657
- {
2658
- className: "absolute inset-0 rounded-full blur-xl opacity-40",
2659
- style: {
2660
- background: "linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%)",
2661
- animation: "pulse 2s ease-in-out infinite"
2662
- }
2663
- }
2664
- ), /* @__PURE__ */ React4.createElement(
2665
- Spin,
2666
- {
2667
- indicator: /* @__PURE__ */ React4.createElement(LoadingOutlined, { style: { fontSize: 56, color: "#14b8a6" } })
2668
- }
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(
2670
- "div",
2671
- {
2672
- className: "mt-4 p-4 rounded-xl",
2673
- style: {
2674
- background: "linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%)",
2675
- border: "1px solid #ccfbf1"
2676
- }
2677
- },
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"))
2679
- )),
2680
- result && /* @__PURE__ */ React4.createElement("div", null, /* @__PURE__ */ React4.createElement("div", { className: "text-center mb-6" }, /* @__PURE__ */ React4.createElement(
2681
- "div",
2682
- {
2683
- className: "inline-flex items-center justify-center w-16 h-16 rounded-full mb-4",
2684
- style: {
2685
- background: "linear-gradient(135deg, #10b981 0%, #34d399 100%)",
2686
- boxShadow: "0 4px 20px rgba(16, 185, 129, 0.3)"
2687
- }
2688
- },
2689
- /* @__PURE__ */ React4.createElement("span", { style: { fontSize: "32px", color: "white" } }, "\u2713")
2690
- ), /* @__PURE__ */ React4.createElement("div", null, /* @__PURE__ */ React4.createElement(Text, { strong: true, style: {
2691
- fontSize: "20px",
2692
- color: "#262626",
2693
- display: "block",
2694
- 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(
2696
- "pre",
2697
- {
2698
- style: {
2699
- background: "#fafafa",
2700
- padding: "20px",
2701
- borderRadius: "12px",
2702
- fontSize: "12px",
2703
- lineHeight: "1.8",
2704
- overflow: "auto",
2705
- margin: 0,
2706
- fontFamily: "Monaco, Courier New, monospace",
2707
- whiteSpace: "pre-wrap",
2708
- wordBreak: "break-word",
2709
- border: "1px solid #e8e8e8",
2710
- color: "#262626"
2711
- }
2712
- },
2713
- JSON.stringify(result, null, 2)
2714
- )),
2715
- error && /* @__PURE__ */ React4.createElement("div", null, /* @__PURE__ */ React4.createElement("div", { className: "text-center mb-6" }, /* @__PURE__ */ React4.createElement(
2716
- "div",
2717
- {
2718
- className: "inline-flex items-center justify-center w-16 h-16 rounded-full mb-4",
2719
- style: {
2720
- background: "linear-gradient(135deg, #ef4444 0%, #f87171 100%)",
2721
- boxShadow: "0 4px 20px rgba(239, 68, 68, 0.3)"
2722
- }
2723
- },
2724
- /* @__PURE__ */ React4.createElement("span", { style: { fontSize: "32px", color: "white" } }, "\u2717")
2725
- ), /* @__PURE__ */ React4.createElement("div", null, /* @__PURE__ */ React4.createElement(Text, { strong: true, style: {
2726
- fontSize: "20px",
2727
- color: "#262626",
2728
- display: "block",
2729
- 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(
2731
- "div",
2732
- {
2733
- style: {
2734
- background: "#fef2f2",
2735
- padding: "20px",
2736
- borderRadius: "12px",
2737
- border: "1px solid #fee2e2"
2738
- }
2739
- },
2740
- /* @__PURE__ */ React4.createElement(Text, { style: {
2741
- fontSize: "14px",
2742
- color: "#dc2626",
2743
- lineHeight: "1.6",
2744
- fontWeight: 500
2745
- } }, error)
2746
- ), /* @__PURE__ */ React4.createElement("div", { className: "mt-4 text-center" }, /* @__PURE__ */ React4.createElement(
2747
- Button,
2748
- {
2749
- size: "large",
2750
- onClick: handlePayment,
2751
- style: {
2752
- height: "44px",
2753
- fontSize: "14px",
2754
- fontWeight: 600,
2755
- borderRadius: "8px",
2756
- background: "#1a1a1a",
2757
- borderColor: "#1a1a1a",
2758
- color: "white",
2759
- paddingLeft: "32px",
2760
- paddingRight: "32px"
2761
- }
2762
- },
2763
- "Try Again"
2764
- )))
2765
- )
2766
- ),
2767
- /* @__PURE__ */ React4.createElement("style", { dangerouslySetInnerHTML: {
2768
- __html: `
2769
- @keyframes slideInRight {
2770
- from {
2771
- opacity: 0;
2772
- transform: translateX(100px);
2773
- }
2774
- to {
2775
- opacity: 1;
2776
- transform: translateX(0);
2777
- }
2778
- }
2779
-
2780
- @keyframes pulse {
2781
- 0%, 100% {
2782
- transform: scale(1);
2783
- opacity: 0.4;
2784
- }
2785
- 50% {
2786
- transform: scale(1.1);
2787
- opacity: 0.6;
2788
- }
2789
- }
2790
- `
2791
- } })
2792
- );
2611
+ brandName
2612
+ ))
2613
+ )
2614
+ ), /* @__PURE__ */ React10.createElement(AnimationStyles, null));
2793
2615
  }
2794
2616
  export {
2795
- V402Checkout,
2617
+ AnimationStyles,
2618
+ Toast,
2619
+ V402CheckoutV2,
2796
2620
  WalletConnect,
2797
2621
  WalletSelectModal,
2622
+ checkoutAnimations,
2798
2623
  usePageNetwork,
2799
2624
  usePayment,
2800
2625
  usePaymentInfo,
2626
+ useToast,
2801
2627
  useWallet
2802
2628
  };
2803
2629
  //# sourceMappingURL=index.mjs.map