@voyage_ai/v402-web-ts 1.0.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,315 +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
- getAllConnectedWalletIds: () => getAllConnectedWalletIds,
104
- getAllWalletAddresses: () => getAllWalletAddresses,
105
- getCachedWalletAddress: () => getCachedWalletAddress,
106
- getConnectedNetworkType: () => getConnectedNetworkType,
107
- getConnectedWalletId: () => getConnectedWalletId,
108
- getWalletDisplayName: () => getWalletDisplayName,
109
- getWalletInstallUrl: () => getWalletInstallUrl,
110
- getWalletProvider: () => getWalletProvider,
111
- isWalletInstalled: () => isWalletInstalled,
112
- isWalletManuallyDisconnected: () => isWalletManuallyDisconnected,
113
- markWalletDisconnected: () => markWalletDisconnected,
114
- removeConnectedWalletId: () => removeConnectedWalletId,
115
- removeWalletAddress: () => removeWalletAddress,
116
- saveConnectedNetworkType: () => saveConnectedNetworkType,
117
- saveConnectedWalletId: () => saveConnectedWalletId,
118
- saveWalletAddress: () => saveWalletAddress
119
- });
120
- function isWalletInstalled(networkType) {
121
- if (typeof window === "undefined") {
122
- return false;
123
- }
124
- switch (networkType) {
125
- case "evm" /* EVM */:
126
- return !!window.ethereum;
127
- case "solana" /* SOLANA */:
128
- case "svm" /* SVM */:
129
- return !!window.solana || !!window.phantom;
130
- default:
131
- return false;
132
- }
133
- }
134
- function getWalletProvider(networkType) {
135
- if (typeof window === "undefined") {
136
- return null;
137
- }
138
- switch (networkType) {
139
- case "evm" /* EVM */:
140
- return window.ethereum;
141
- case "solana" /* SOLANA */:
142
- case "svm" /* SVM */:
143
- return window.solana || window.phantom;
144
- default:
145
- return null;
146
- }
147
- }
148
- function formatAddress(address) {
149
- if (!address || address.length < 10) {
150
- return address;
151
- }
152
- return `${address.slice(0, 6)}...${address.slice(-4)}`;
153
- }
154
- function getDisconnectedNetworks() {
155
- if (typeof window === "undefined") {
156
- return {};
157
- }
158
- try {
159
- const cached = localStorage.getItem(WALLET_DISCONNECTED_NETWORKS_KEY);
160
- return cached ? JSON.parse(cached) : {};
161
- } catch (error) {
162
- return {};
163
- }
164
- }
165
- function markWalletDisconnected(networkType) {
166
- if (typeof window !== "undefined") {
167
- if (networkType) {
168
- const disconnected = getDisconnectedNetworks();
169
- disconnected[networkType] = true;
170
- localStorage.setItem(WALLET_DISCONNECTED_NETWORKS_KEY, JSON.stringify(disconnected));
171
- } else {
172
- localStorage.setItem(WALLET_DISCONNECTED_KEY, "true");
173
- localStorage.removeItem(CONNECTED_NETWORK_TYPE_KEY);
174
- }
175
- }
176
- }
177
- function clearWalletDisconnection(networkType) {
178
- if (typeof window !== "undefined") {
179
- if (networkType) {
180
- const disconnected = getDisconnectedNetworks();
181
- delete disconnected[networkType];
182
- localStorage.setItem(WALLET_DISCONNECTED_NETWORKS_KEY, JSON.stringify(disconnected));
183
- } else {
184
- localStorage.removeItem(WALLET_DISCONNECTED_KEY);
185
- }
186
- }
187
- }
188
- function isWalletManuallyDisconnected(networkType) {
189
- if (typeof window === "undefined") {
190
- return false;
191
- }
192
- if (networkType) {
193
- const disconnected = getDisconnectedNetworks();
194
- return disconnected[networkType] === true;
195
- } else {
196
- return localStorage.getItem(WALLET_DISCONNECTED_KEY) === "true";
197
- }
198
- }
199
- function saveConnectedNetworkType(networkType) {
200
- if (typeof window !== "undefined") {
201
- localStorage.setItem(CONNECTED_NETWORK_TYPE_KEY, networkType);
202
- }
203
- }
204
- function getConnectedNetworkType() {
205
- if (typeof window === "undefined") {
206
- return null;
207
- }
208
- const type = localStorage.getItem(CONNECTED_NETWORK_TYPE_KEY);
209
- return type || null;
210
- }
211
- function getWalletInstallUrl(networkType) {
212
- switch (networkType) {
213
- case "evm" /* EVM */:
214
- return "https://metamask.io/download/";
215
- case "solana" /* SOLANA */:
216
- case "svm" /* SVM */:
217
- return "https://phantom.app/download";
218
- default:
219
- return "#";
220
- }
221
- }
222
- function getWalletDisplayName(networkType) {
223
- switch (networkType) {
224
- case "evm" /* EVM */:
225
- return "MetaMask";
226
- case "solana" /* SOLANA */:
227
- case "svm" /* SVM */:
228
- return "Phantom";
229
- default:
230
- return "Unknown Wallet";
231
- }
232
- }
233
- function getAllWalletAddresses() {
234
- if (typeof window === "undefined") {
235
- return {};
236
- }
237
- try {
238
- const cached = localStorage.getItem(WALLET_ADDRESSES_KEY);
239
- return cached ? JSON.parse(cached) : {};
240
- } catch (error) {
241
- console.error("Failed to parse wallet addresses cache:", error);
242
- return {};
243
- }
244
- }
245
- function saveWalletAddress(networkType, address) {
246
- if (typeof window === "undefined") {
247
- return;
248
- }
249
- const addresses = getAllWalletAddresses();
250
- addresses[networkType] = address;
251
- localStorage.setItem(WALLET_ADDRESSES_KEY, JSON.stringify(addresses));
252
- }
253
- function getCachedWalletAddress(networkType) {
254
- const addresses = getAllWalletAddresses();
255
- return addresses[networkType] || null;
256
- }
257
- function removeWalletAddress(networkType) {
258
- if (typeof window === "undefined") {
259
- return;
260
- }
261
- const addresses = getAllWalletAddresses();
262
- delete addresses[networkType];
263
- localStorage.setItem(WALLET_ADDRESSES_KEY, JSON.stringify(addresses));
264
- }
265
- function clearAllWalletAddresses() {
266
- if (typeof window !== "undefined") {
267
- localStorage.removeItem(WALLET_ADDRESSES_KEY);
268
- }
269
- }
270
- function getAllConnectedWalletIds() {
271
- if (typeof window === "undefined") {
272
- return {};
273
- }
274
- try {
275
- const cached = localStorage.getItem(CONNECTED_WALLET_IDS_KEY);
276
- return cached ? JSON.parse(cached) : {};
277
- } catch (error) {
278
- console.error("Failed to parse connected wallet IDs:", error);
279
- return {};
280
- }
281
- }
282
- function saveConnectedWalletId(networkType, walletId) {
283
- if (typeof window === "undefined") {
284
- return;
285
- }
286
- const walletIds = getAllConnectedWalletIds();
287
- walletIds[networkType] = walletId;
288
- localStorage.setItem(CONNECTED_WALLET_IDS_KEY, JSON.stringify(walletIds));
289
- }
290
- function getConnectedWalletId(networkType) {
291
- const walletIds = getAllConnectedWalletIds();
292
- return walletIds[networkType] || null;
293
- }
294
- function removeConnectedWalletId(networkType) {
295
- if (typeof window === "undefined") {
296
- return;
297
- }
298
- const walletIds = getAllConnectedWalletIds();
299
- delete walletIds[networkType];
300
- localStorage.setItem(CONNECTED_WALLET_IDS_KEY, JSON.stringify(walletIds));
301
- }
302
- var WALLET_DISCONNECTED_KEY, WALLET_DISCONNECTED_NETWORKS_KEY, CONNECTED_NETWORK_TYPE_KEY, WALLET_ADDRESSES_KEY, CONNECTED_WALLET_IDS_KEY;
303
- var init_wallet = __esm({
304
- "src/utils/wallet.ts"() {
305
- "use strict";
306
- WALLET_DISCONNECTED_KEY = "wallet_manually_disconnected";
307
- WALLET_DISCONNECTED_NETWORKS_KEY = "wallet_disconnected_networks";
308
- CONNECTED_NETWORK_TYPE_KEY = "connected_network_type";
309
- WALLET_ADDRESSES_KEY = "wallet_addresses_cache";
310
- CONNECTED_WALLET_IDS_KEY = "connected_wallet_ids";
311
- }
312
- });
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";
313
27
 
314
28
  // src/react/index.ts
315
29
  import "./styles.css";
@@ -487,11 +201,7 @@ async function getCurrentWallet(networkType) {
487
201
  return null;
488
202
  }
489
203
  if (type === "solana" /* SOLANA */ || type === "svm" /* SVM */) {
490
- const solana = window.solana;
491
- if (!solana || !solana.isConnected) {
492
- return cachedAddress;
493
- }
494
- return solana.publicKey?.toString() || cachedAddress;
204
+ return cachedAddress;
495
205
  }
496
206
  return cachedAddress;
497
207
  }
@@ -556,245 +266,6 @@ async function switchNetwork(networkType) {
556
266
  return null;
557
267
  }
558
268
 
559
- // src/utils/wallet-discovery.ts
560
- init_wallet();
561
- var SOLANA_WALLETS = [
562
- {
563
- id: "phantom",
564
- name: "Phantom",
565
- // Phantom official icon
566
- icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iMjYiIGZpbGw9IiNBQjlGRjIiLz4KPHBhdGggZD0iTTExMC41IDY0QzExMC41IDg5Ljk1NjggODkuMjAxIDExMSA2My41IDExMUg0MS41QzM2LjI1MzMgMTExIDMyIDEwNi43NDcgMzIgMTAxLjVWNTQuNUMzMiAzMS4wMjggNTEuMDI4IDEyIDc0LjUgMTJDOTcuOTcyIDEyIDExNyAzMS4wMjggMTE3IDU0LjVWNTUuNUMxMTcgNTguNTM3NiAxMTQuNTM4IDYxIDExMS41IDYxSDEwOS41QzEwNi40NjIgNjEgMTA0IDYzLjQ2MjQgMTA0IDY2LjVWNjhDMTA0IDcxLjg2NiAxMDcuMTM0IDc1IDExMSA3NUgxMTEuNUMxMTQuNTM4IDc1IDExNyA3Mi41Mzc2IDExNyA2OS41VjY0SDExMC41WiIgZmlsbD0idXJsKCNwYWludDBfbGluZWFyXzEyOF8xMjgpIi8+CjxwYXRoIGQ9Ik00OC41IDY3QzUxLjUzNzYgNjcgNTQgNjQuNTM3NiA1NCA2MS41QzU0IDU4LjQ2MjQgNTEuNTM3NiA1NiA0OC41IDU2QzQ1LjQ2MjQgNTYgNDMgNTguNDYyNCA0MyA2MS41QzQzIDY0LjUzNzYgNDUuNDYyNCA2NyA0OC41IDY3WiIgZmlsbD0iIzFCMUIxQiIvPgo8cGF0aCBkPSJNNzMuNSA2N0M3Ni41Mzc2IDY3IDc5IDY0LjUzNzYgNzkgNjEuNUM3OSA1OC40NjI0IDc2LjUzNzYgNTYgNzMuNSA1NkM3MC40NjI0IDU2IDY4IDU4LjQ2MjQgNjggNjEuNUM2OCA2NC41Mzc2IDcwLjQ2MjQgNjcgNzMuNSA2N1oiIGZpbGw9IiMxQjFCMUIiLz4KPGRlZnM+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhcl8xMjhfMTI4IiB4MT0iMTE3IiB5MT0iMTIiIHgyPSIxMTciIHkyPSIxMTEiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0ZGRkZGRiIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGRkZGRkYiIHN0b3Atb3BhY2l0eT0iMC44MiIvPgo8L2xpbmVhckdyYWRpZW50Pgo8L2RlZnM+Cjwvc3ZnPg==",
567
- detect: () => window.phantom?.solana
568
- },
569
- {
570
- id: "solflare",
571
- name: "Solflare",
572
- // Solflare icon
573
- icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iMjYiIGZpbGw9IiNGQzZEMDEiLz4KPHBhdGggZD0iTTk2IDY0TDY0IDMyTDMyIDY0TDY0IDk2TDk2IDY0WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+",
574
- detect: () => window.solflare
575
- },
576
- {
577
- id: "backpack",
578
- name: "Backpack",
579
- // Backpack icon (red coral color)
580
- icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iMjYiIGZpbGw9IiNFMzM0MzAiLz4KPHBhdGggZD0iTTQwIDQ4SDg4VjgwQzg4IDg4LjgzNjYgODAuODM2NiA5NiA3MiA5Nkg1NkM0Ny4xNjM0IDk2IDQwIDg4LjgzNjYgNDAgODBWNDhaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNNTIgMzJINzZWNDhINTJWMzJaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4=",
581
- detect: () => window.backpack
582
- },
583
- {
584
- id: "okx-solana",
585
- name: "OKX Wallet",
586
- // OKX icon
587
- icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iMjYiIGZpbGw9ImJsYWNrIi8+CjxyZWN0IHg9IjI0IiB5PSIyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiByeD0iNCIgZmlsbD0id2hpdGUiLz4KPHJlY3QgeD0iNTIiIHk9IjI0IiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHJ4PSI0IiBmaWxsPSJ3aGl0ZSIvPgo8cmVjdCB4PSI4MCIgeT0iMjQiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgcng9IjQiIGZpbGw9IndoaXRlIi8+CjxyZWN0IHg9IjI0IiB5PSI1MiIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiByeD0iNCIgZmlsbD0id2hpdGUiLz4KPHJlY3QgeD0iODAiIHk9IjUyIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHJ4PSI0IiBmaWxsPSJ3aGl0ZSIvPgo8cmVjdCB4PSIyNCIgeT0iODAiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgcng9IjQiIGZpbGw9IndoaXRlIi8+CjxyZWN0IHg9IjUyIiB5PSI4MCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiByeD0iNCIgZmlsbD0id2hpdGUiLz4KPHJlY3QgeD0iODAiIHk9IjgwIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHJ4PSI0IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4=",
588
- detect: () => window.okxwallet?.solana
589
- },
590
- {
591
- id: "coinbase-solana",
592
- name: "Coinbase Wallet",
593
- // Coinbase icon (blue)
594
- icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iMjYiIGZpbGw9IiMwMDUyRkYiLz4KPGNpcmNsZSBjeD0iNjQiIGN5PSI2NCIgcj0iMzYiIGZpbGw9IndoaXRlIi8+CjxyZWN0IHg9IjQ4IiB5PSI1NiIgd2lkdGg9IjMyIiBoZWlnaHQ9IjE2IiByeD0iNCIgZmlsbD0iIzAwNTJGRiIvPgo8L3N2Zz4=",
595
- detect: () => window.coinbaseSolana
596
- },
597
- {
598
- id: "trust-solana",
599
- name: "Trust Wallet",
600
- // Trust Wallet icon
601
- icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iMjYiIGZpbGw9IiMwNTAwRkYiLz4KPHBhdGggZD0iTTY0IDI0QzY0IDI0IDk2IDQwIDk2IDY0Qzk2IDg4IDY0IDEwNCA2NCAxMDRDNjQgMTA0IDMyIDg4IDMyIDY0QzMyIDQwIDY0IDI0IDY0IDI0WiIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSI2IiBmaWxsPSJub25lIi8+Cjwvc3ZnPg==",
602
- detect: () => window.trustwallet?.solana
603
- }
604
- ];
605
- var evmWallets = /* @__PURE__ */ new Map();
606
- var evmDiscoveryListeners = /* @__PURE__ */ new Set();
607
- var evmDiscoveryInitialized = false;
608
- var currentConnectedWallet = null;
609
- function initEVMWalletDiscovery() {
610
- if (typeof window === "undefined" || evmDiscoveryInitialized) return;
611
- evmDiscoveryInitialized = true;
612
- window.addEventListener("eip6963:announceProvider", ((event) => {
613
- const { info, provider } = event.detail;
614
- evmWallets.set(info.uuid, { info, provider });
615
- evmDiscoveryListeners.forEach((listener) => listener());
616
- }));
617
- window.dispatchEvent(new Event("eip6963:requestProvider"));
618
- }
619
- function getEVMWallets() {
620
- const wallets = [];
621
- const detectedNames = /* @__PURE__ */ new Set();
622
- evmWallets.forEach((detail, uuid) => {
623
- if (!detectedNames.has(detail.info.name)) {
624
- wallets.push({
625
- id: uuid,
626
- name: detail.info.name,
627
- icon: detail.info.icon,
628
- networkType: "evm" /* EVM */,
629
- provider: detail.provider,
630
- installed: true
631
- });
632
- detectedNames.add(detail.info.name);
633
- }
634
- });
635
- if (wallets.length === 0 && typeof window !== "undefined" && window.ethereum) {
636
- const ethereum = window.ethereum;
637
- const walletName = ethereum.isMetaMask ? "MetaMask" : ethereum.isCoinbaseWallet ? "Coinbase Wallet" : ethereum.isOkxWallet ? "OKX Wallet" : "Browser Wallet";
638
- if (!detectedNames.has(walletName)) {
639
- wallets.push({
640
- id: "injected",
641
- name: walletName,
642
- icon: "",
643
- // Will use first letter as avatar
644
- networkType: "evm" /* EVM */,
645
- provider: ethereum,
646
- installed: true
647
- });
648
- }
649
- }
650
- return wallets;
651
- }
652
- function onEVMWalletsChanged(callback) {
653
- evmDiscoveryListeners.add(callback);
654
- return () => {
655
- evmDiscoveryListeners.delete(callback);
656
- };
657
- }
658
- function getSolanaWallets() {
659
- if (typeof window === "undefined") return [];
660
- const wallets = [];
661
- const detectedProviders = /* @__PURE__ */ new Set();
662
- const detectedNames = /* @__PURE__ */ new Set();
663
- for (const wallet of SOLANA_WALLETS) {
664
- const provider = wallet.detect();
665
- if (provider && !detectedNames.has(wallet.name)) {
666
- wallets.push({
667
- id: wallet.id,
668
- name: wallet.name,
669
- icon: wallet.icon,
670
- networkType: "solana" /* SOLANA */,
671
- provider,
672
- installed: true
673
- });
674
- detectedProviders.add(provider);
675
- detectedNames.add(wallet.name);
676
- }
677
- }
678
- const windowSolana = window.solana;
679
- if (windowSolana && !detectedProviders.has(windowSolana)) {
680
- const walletName = windowSolana.isPhantom ? "Phantom" : windowSolana.isSolflare ? "Solflare" : windowSolana.isBackpack ? "Backpack" : windowSolana.walletName || "Solana Wallet";
681
- if (!detectedNames.has(walletName)) {
682
- wallets.push({
683
- id: "solana-unknown",
684
- name: walletName,
685
- icon: "",
686
- // Will use first letter as avatar
687
- networkType: "solana" /* SOLANA */,
688
- provider: windowSolana,
689
- installed: true
690
- });
691
- }
692
- }
693
- return wallets;
694
- }
695
- function getWalletsForNetwork(networkType) {
696
- switch (networkType) {
697
- case "evm" /* EVM */:
698
- return getEVMWallets();
699
- case "solana" /* SOLANA */:
700
- case "svm" /* SVM */:
701
- return getSolanaWallets();
702
- default:
703
- return [];
704
- }
705
- }
706
- function getWalletByName(name, networkType) {
707
- const wallets = getWalletsForNetwork(networkType);
708
- return wallets.find((w) => w.name === name) || null;
709
- }
710
- async function connectEVMWallet(wallet) {
711
- if (!wallet.provider) {
712
- throw new Error(`Wallet ${wallet.name} is not available`);
713
- }
714
- const accounts = await wallet.provider.request({
715
- method: "eth_requestAccounts",
716
- params: []
717
- });
718
- if (!accounts || accounts.length === 0) {
719
- throw new Error("Failed to get wallet address");
720
- }
721
- return accounts[0];
722
- }
723
- async function connectSolanaWallet(wallet) {
724
- if (!wallet.provider) {
725
- throw new Error(`Wallet ${wallet.name} is not available`);
726
- }
727
- if (wallet.provider.isConnected) {
728
- try {
729
- await wallet.provider.disconnect();
730
- } catch (err) {
731
- console.warn("Failed to disconnect before connecting:", err);
732
- }
733
- }
734
- const response = await wallet.provider.connect();
735
- return response.publicKey.toString();
736
- }
737
- async function connectToWallet(wallet) {
738
- let address;
739
- switch (wallet.networkType) {
740
- case "evm" /* EVM */:
741
- address = await connectEVMWallet(wallet);
742
- break;
743
- case "solana" /* SOLANA */:
744
- case "svm" /* SVM */:
745
- address = await connectSolanaWallet(wallet);
746
- break;
747
- default:
748
- throw new Error("Unsupported network type");
749
- }
750
- currentConnectedWallet = wallet;
751
- saveConnectedWalletId(wallet.networkType, wallet.name);
752
- return address;
753
- }
754
- function setCurrentConnectedWallet(wallet) {
755
- currentConnectedWallet = wallet;
756
- }
757
- function clearConnectedWallet(networkType) {
758
- if (networkType) {
759
- removeConnectedWalletId(networkType);
760
- }
761
- currentConnectedWallet = null;
762
- }
763
- function restoreConnectedWallet(networkType) {
764
- const savedWalletName = getConnectedWalletId(networkType);
765
- if (!savedWalletName) return null;
766
- const wallet = getWalletByName(savedWalletName, networkType);
767
- if (wallet) {
768
- currentConnectedWallet = wallet;
769
- console.log(`\u2705 Restored wallet provider: ${wallet.name}`);
770
- return wallet;
771
- }
772
- console.warn(`\u26A0\uFE0F Could not find wallet with name: ${savedWalletName}`);
773
- return null;
774
- }
775
- function getWalletProviderForPayment(networkType) {
776
- if (currentConnectedWallet && currentConnectedWallet.networkType === networkType) {
777
- return currentConnectedWallet.provider;
778
- }
779
- const restoredWallet = restoreConnectedWallet(networkType);
780
- if (restoredWallet) {
781
- return restoredWallet.provider;
782
- }
783
- if (typeof window === "undefined") return null;
784
- switch (networkType) {
785
- case "evm" /* EVM */:
786
- return window.ethereum;
787
- case "solana" /* SOLANA */:
788
- case "svm" /* SVM */:
789
- return window.phantom?.solana || window.solana;
790
- default:
791
- return null;
792
- }
793
- }
794
- if (typeof window !== "undefined") {
795
- initEVMWalletDiscovery();
796
- }
797
-
798
269
  // src/services/svm/payment-header.ts
799
270
  import { ComputeBudgetProgram, Connection, PublicKey, TransactionMessage, VersionedTransaction } from "@solana/web3.js";
800
271
  import {
@@ -1296,8 +767,8 @@ async function makePayment(networkType, merchantId, endpoint = PROD_BACK_URL, ad
1296
767
  if (!solana.isConnected) {
1297
768
  await solana.connect();
1298
769
  }
1299
- if (expectedAddress && solana.publicKey) {
1300
- const currentAddress = solana.publicKey.toString();
770
+ const currentAddress = solana.publicKey?.toString();
771
+ if (expectedAddress && currentAddress) {
1301
772
  if (currentAddress !== expectedAddress) {
1302
773
  throw new Error(
1303
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.`
@@ -1324,8 +795,8 @@ async function makePayment(networkType, merchantId, endpoint = PROD_BACK_URL, ad
1324
795
  }
1325
796
  const wallet = {
1326
797
  address: currentAddress,
1327
- signTypedData: async (domain, types, message2) => {
1328
- return await signer.signTypedData(domain, types, message2);
798
+ signTypedData: async (domain, types, message) => {
799
+ return await signer.signTypedData(domain, types, message);
1329
800
  },
1330
801
  // Get current chain ID from wallet
1331
802
  getChainId: async () => {
@@ -1663,8 +1134,22 @@ var WalletStore = class {
1663
1134
  }
1664
1135
  this.setState({ isConnecting: true, error: null });
1665
1136
  try {
1666
- const address = await switchNetwork(type);
1137
+ let address = await switchNetwork(type);
1667
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
+ }
1668
1153
  this.setState({
1669
1154
  address,
1670
1155
  networkType: type,
@@ -1715,6 +1200,16 @@ var WalletStore = class {
1715
1200
  return;
1716
1201
  }
1717
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
+ }
1718
1213
  return;
1719
1214
  }
1720
1215
  if (this.state.networkType !== expectedNetwork) {
@@ -1854,7 +1349,7 @@ import React2, { useCallback as useCallback2, useRef, useState as useState3 } fr
1854
1349
  // src/react/components/ui/Toast.tsx
1855
1350
  import React, { useEffect as useEffect3 } from "react";
1856
1351
  import { createPortal } from "react-dom";
1857
- var Toast = ({ message: message2, type, onClose }) => {
1352
+ var Toast = ({ message, type, onClose }) => {
1858
1353
  useEffect3(() => {
1859
1354
  const timer = setTimeout(onClose, 3e3);
1860
1355
  return () => clearTimeout(timer);
@@ -1877,7 +1372,7 @@ var Toast = ({ message: message2, type, onClose }) => {
1877
1372
  style: { backgroundColor: bgColor, minWidth: "280px" }
1878
1373
  },
1879
1374
  /* @__PURE__ */ React.createElement("span", { className: "text-lg" }, icon),
1880
- /* @__PURE__ */ React.createElement("span", { className: "flex-1" }, message2),
1375
+ /* @__PURE__ */ React.createElement("span", { className: "flex-1" }, message),
1881
1376
  /* @__PURE__ */ React.createElement(
1882
1377
  "button",
1883
1378
  {
@@ -1896,9 +1391,9 @@ var Toast = ({ message: message2, type, onClose }) => {
1896
1391
  var useToast = () => {
1897
1392
  const [toasts, setToasts] = useState3([]);
1898
1393
  const toastIdRef = useRef(0);
1899
- const showToast = useCallback2((message2, type) => {
1394
+ const showToast = useCallback2((message, type) => {
1900
1395
  const id = ++toastIdRef.current;
1901
- setToasts((prev) => [...prev, { id, message: message2, type }]);
1396
+ setToasts((prev) => [...prev, { id, message, type }]);
1902
1397
  }, []);
1903
1398
  const removeToast = useCallback2((id) => {
1904
1399
  setToasts((prev) => prev.filter((t) => t.id !== id));
@@ -2373,17 +1868,8 @@ function WalletConnect({
2373
1868
  ));
2374
1869
  }
2375
1870
 
2376
- // src/react/components/checkout/V402Checkout.tsx
2377
- import React6, { useEffect as useEffect5, useState as useState6 } from "react";
2378
- import { Button, Card, Divider, message, Spin, Tooltip, Typography } from "antd";
2379
- import {
2380
- DisconnectOutlined,
2381
- InfoCircleOutlined,
2382
- LinkOutlined,
2383
- LoadingOutlined,
2384
- LockOutlined,
2385
- SafetyOutlined
2386
- } from "@ant-design/icons";
1871
+ // src/react/components/checkout/V402CheckoutV2.tsx
1872
+ import React10, { useEffect as useEffect6, useState as useState7 } from "react";
2387
1873
  init_common();
2388
1874
 
2389
1875
  // src/react/utils/CryptoIcons.tsx
@@ -2452,495 +1938,8 @@ var getNetworkIcon = (network) => {
2452
1938
  return BaseIcon;
2453
1939
  };
2454
1940
 
2455
- // src/react/components/checkout/V402Checkout.tsx
2456
- var { Title, Text } = Typography;
2457
- var notify = {
2458
- success: (title, msg) => {
2459
- message.success(`${title}: ${msg}`);
2460
- },
2461
- error: (title, msg) => {
2462
- message.error(`${title}: ${msg}`);
2463
- },
2464
- info: (title, msg) => {
2465
- message.info(`${title}: ${msg}`);
2466
- }
2467
- };
2468
- function V402Checkout({
2469
- checkoutId,
2470
- headerInfo = {},
2471
- isModal = false,
2472
- onPaymentComplete,
2473
- additionalParams = {},
2474
- expectedNetwork
2475
- }) {
2476
- const {
2477
- title = "V402Pay - Make x402Pay Easier",
2478
- subtitle = "onvoyage.ai",
2479
- tooltipText = "V402Pay - Accept Crypto Payments Easier"
2480
- } = headerInfo;
2481
- const endpoint = PROD_BACK_URL;
2482
- const {
2483
- supportedNetworks,
2484
- isLoading: fetchingPaymentInfo,
2485
- paymentInfo
2486
- } = usePaymentInfo(checkoutId, endpoint, additionalParams);
2487
- const targetNetwork = expectedNetwork || supportedNetworks[0];
2488
- const { address, networkType, disconnect, ensureNetwork } = usePageNetwork(
2489
- targetNetwork,
2490
- { autoSwitch: !!targetNetwork, switchOnMount: true }
2491
- );
2492
- const { isProcessing, setIsProcessing, result, setResult, error, setError } = usePayment();
2493
- const [paymentDetails, setPaymentDetails] = useState6(null);
2494
- const handleDisconnect = () => {
2495
- disconnect();
2496
- setResult(null);
2497
- setError(null);
2498
- notify.info("Wallet Disconnected", "Your wallet has been disconnected successfully.");
2499
- };
2500
- useEffect5(() => {
2501
- if (paymentInfo && paymentInfo.length > 0) {
2502
- const firstPayment = paymentInfo[0];
2503
- const rawAmount = firstPayment.maxAmountRequired?.toString() || "0";
2504
- const decimals = 6;
2505
- const humanReadableAmount = (Number(rawAmount) / Math.pow(10, decimals)).toFixed(2);
2506
- const network = firstPayment.network || "Unknown";
2507
- const currency = "USDC";
2508
- setPaymentDetails({
2509
- amount: humanReadableAmount,
2510
- currency,
2511
- network
2512
- });
2513
- }
2514
- }, [paymentInfo]);
2515
- useEffect5(() => {
2516
- if (targetNetwork && !fetchingPaymentInfo && ensureNetwork) {
2517
- ensureNetwork(targetNetwork).catch((err) => {
2518
- console.error("Failed to ensure network:", err);
2519
- });
2520
- }
2521
- }, [targetNetwork, fetchingPaymentInfo]);
2522
- const handlePayment = async () => {
2523
- if (!networkType) {
2524
- notify.error("Wallet Not Connected", "Please connect your wallet first.");
2525
- return;
2526
- }
2527
- setResult(null);
2528
- setError(null);
2529
- setIsProcessing(true);
2530
- try {
2531
- const response = await makePayment(networkType, checkoutId, endpoint, additionalParams, address || void 0);
2532
- const data = await response.json();
2533
- setResult(data);
2534
- notify.success("Payment Successful!", "Your payment has been processed successfully.");
2535
- if (onPaymentComplete) {
2536
- onPaymentComplete(data);
2537
- }
2538
- } catch (err) {
2539
- const errorMessage = err.message || "Payment failed";
2540
- setError(errorMessage);
2541
- notify.error("Payment Failed", errorMessage);
2542
- } finally {
2543
- setIsProcessing(false);
2544
- }
2545
- };
2546
- const getNetworkColor = (network) => {
2547
- if (network.toLowerCase().includes("solana")) return "#14F195";
2548
- if (network.toLowerCase().includes("evm") || network.toLowerCase().includes("base")) return "#0052FF";
2549
- return "#8c8c8c";
2550
- };
2551
- const NetworkIcon = paymentDetails ? getNetworkIcon(paymentDetails.network) : null;
2552
- const networkColor = paymentDetails ? getNetworkColor(paymentDetails.network) : "#8c8c8c";
2553
- const loadingColor = "#8c8c8c";
2554
- const hasInvalidCheckoutId = !fetchingPaymentInfo && (!paymentInfo || paymentInfo.length === 0);
2555
- return /* @__PURE__ */ React6.createElement(
2556
- "div",
2557
- {
2558
- className: isModal ? "bg-white" : "h-screen bg-white flex items-center justify-center p-4 overflow-hidden"
2559
- },
2560
- /* @__PURE__ */ React6.createElement(
2561
- "div",
2562
- {
2563
- className: "flex gap-4 items-center justify-center",
2564
- style: {
2565
- maxWidth: isProcessing || result || error ? "1200px" : "480px",
2566
- transition: "max-width 0.4s ease-in-out",
2567
- width: "100%"
2568
- }
2569
- },
2570
- /* @__PURE__ */ React6.createElement(
2571
- Card,
2572
- {
2573
- className: "flex-shrink-0",
2574
- style: {
2575
- border: isModal ? "none" : "1px solid #e8e8e8",
2576
- borderRadius: isModal ? "0" : "16px",
2577
- boxShadow: isModal ? "none" : "0 4px 24px rgba(0, 0, 0, 0.06)",
2578
- maxHeight: isModal ? "calc(100vh - 100px)" : "calc(100vh - 32px)",
2579
- overflow: "auto",
2580
- width: isModal ? "100%" : "480px",
2581
- transition: "all 0.4s ease-in-out",
2582
- transform: result || error ? "translateX(0)" : "translateX(0)"
2583
- },
2584
- styles: { body: { padding: isModal ? "0px" : "32px 24px" } }
2585
- },
2586
- /* @__PURE__ */ React6.createElement("div", { className: "flex items-center gap-3 mb-4" }, /* @__PURE__ */ React6.createElement(
2587
- "div",
2588
- {
2589
- className: "w-12 h-12 rounded-xl flex items-center justify-center",
2590
- style: {
2591
- background: hasInvalidCheckoutId ? "#ff4d4f" : paymentDetails ? networkColor : loadingColor,
2592
- transition: "background 0.3s ease"
2593
- }
2594
- },
2595
- hasInvalidCheckoutId ? /* @__PURE__ */ React6.createElement("span", { style: { fontSize: "20px", color: "white", fontWeight: "bold" } }, "\u2717") : paymentDetails && NetworkIcon ? /* @__PURE__ */ React6.createElement(NetworkIcon, { width: 24, height: 24 }) : /* @__PURE__ */ React6.createElement(LoadingOutlined, { style: { fontSize: "20px", color: "white" }, spin: true })
2596
- ), /* @__PURE__ */ React6.createElement("div", { className: "flex-1" }, /* @__PURE__ */ React6.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React6.createElement(Title, { level: 4, style: { margin: 0, fontSize: "18px", fontWeight: 600 } }, title || "Echo Payment OnVoyage"), !hasInvalidCheckoutId && /* @__PURE__ */ React6.createElement(
2597
- Tooltip,
2598
- {
2599
- title: tooltipText,
2600
- placement: "top"
2601
- },
2602
- /* @__PURE__ */ React6.createElement(
2603
- InfoCircleOutlined,
2604
- {
2605
- style: { fontSize: "14px", color: "#8c8c8c", cursor: "help" }
2606
- }
2607
- )
2608
- )), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, subtitle))),
2609
- /* @__PURE__ */ React6.createElement("div", { className: "text-center mb-5" }, /* @__PURE__ */ React6.createElement("div", { className: "inline-flex items-center justify-center w-12 h-12 rounded-full bg-gray-50 mb-3" }, /* @__PURE__ */ React6.createElement(LockOutlined, { style: { fontSize: "20px", color: "#595959" } })), /* @__PURE__ */ React6.createElement(Title, { level: 3, style: { margin: "0 0 6px 0", fontSize: "20px", fontWeight: 600 } }, "Payment Required"), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Pay ", paymentDetails ? `$${paymentDetails.amount} ${paymentDetails.currency}` : "the required amount", " to access")),
2610
- hasInvalidCheckoutId && /* @__PURE__ */ React6.createElement("div", { className: "text-center py-6" }, /* @__PURE__ */ React6.createElement(
2611
- "div",
2612
- {
2613
- className: "inline-flex items-center justify-center w-16 h-16 rounded-full mb-4",
2614
- style: {
2615
- background: "linear-gradient(135deg, #ef4444 0%, #f87171 100%)",
2616
- boxShadow: "0 4px 20px rgba(239, 68, 68, 0.3)"
2617
- }
2618
- },
2619
- /* @__PURE__ */ React6.createElement("span", { style: { fontSize: "32px", color: "white" } }, "!")
2620
- ), /* @__PURE__ */ React6.createElement(
2621
- Title,
2622
- {
2623
- level: 4,
2624
- style: { margin: "0 0 12px 0", fontSize: "18px", fontWeight: 600, color: "#262626" }
2625
- },
2626
- "Invalid Checkout ID"
2627
- ), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "14px", color: "#8c8c8c", display: "block", marginBottom: "16px" } }, "The checkout ID you provided is invalid or has expired."), /* @__PURE__ */ React6.createElement(
2628
- "div",
2629
- {
2630
- style: {
2631
- background: "#fef2f2",
2632
- padding: "16px",
2633
- borderRadius: "12px",
2634
- border: "1px solid #fee2e2",
2635
- marginTop: "16px"
2636
- }
2637
- },
2638
- /* @__PURE__ */ React6.createElement(Text, { style: {
2639
- fontSize: "13px",
2640
- color: "#dc2626",
2641
- lineHeight: "1.6",
2642
- fontWeight: 500
2643
- } }, "Failed to load payment information. Please check your checkout ID.")
2644
- )),
2645
- !hasInvalidCheckoutId && fetchingPaymentInfo && /* @__PURE__ */ React6.createElement("div", { className: "text-center py-6" }, /* @__PURE__ */ React6.createElement(Text, { style: { color: "#8c8c8c" } }, "Loading payment information...")),
2646
- !hasInvalidCheckoutId && !fetchingPaymentInfo && !address && /* @__PURE__ */ React6.createElement("div", null, /* @__PURE__ */ React6.createElement(WalletConnect, { supportedNetworks })),
2647
- !hasInvalidCheckoutId && address && /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
2648
- "div",
2649
- {
2650
- className: "bg-gray-50 rounded-lg p-3 mb-4",
2651
- style: { border: "1px solid #f0f0f0" }
2652
- },
2653
- /* @__PURE__ */ React6.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React6.createElement("div", { className: "flex items-center gap-3 flex-1" }, /* @__PURE__ */ React6.createElement(
2654
- "div",
2655
- {
2656
- className: "w-10 h-10 rounded-full bg-black flex items-center justify-center text-white text-sm font-semibold"
2657
- },
2658
- address.slice(0, 2).toUpperCase()
2659
- ), /* @__PURE__ */ React6.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React6.createElement(Text, { style: {
2660
- display: "block",
2661
- fontSize: "12px",
2662
- color: "#8c8c8c",
2663
- marginBottom: "2px"
2664
- } }, "Connected Wallet"), /* @__PURE__ */ React6.createElement(
2665
- Text,
2666
- {
2667
- style: {
2668
- fontSize: "13px",
2669
- fontWeight: 600,
2670
- fontFamily: "Monaco, monospace"
2671
- }
2672
- },
2673
- formatAddress(address)
2674
- ))), /* @__PURE__ */ React6.createElement(
2675
- Button,
2676
- {
2677
- type: "text",
2678
- size: "small",
2679
- icon: /* @__PURE__ */ React6.createElement(DisconnectOutlined, null),
2680
- onClick: handleDisconnect,
2681
- style: { color: "#ff4d4f" }
2682
- }
2683
- ))
2684
- ), paymentDetails && /* @__PURE__ */ React6.createElement("div", { className: "bg-gray-50 rounded-lg p-3 mb-4", style: { border: "1px solid #f0f0f0" } }, /* @__PURE__ */ React6.createElement("div", { className: "flex justify-between items-center mb-2" }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Payment Amount"), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "18px", fontWeight: 600 } }, "$", paymentDetails.amount)), /* @__PURE__ */ React6.createElement(Divider, { style: { margin: "6px 0" } }), /* @__PURE__ */ React6.createElement("div", { className: "flex justify-between items-center mb-2" }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Currency"), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "14px", fontWeight: 500 } }, paymentDetails.currency)), /* @__PURE__ */ React6.createElement(Divider, { style: { margin: "6px 0" } }), /* @__PURE__ */ React6.createElement("div", { className: "flex justify-between items-center mb-2" }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Network"), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "14px", fontWeight: 500 } }, paymentDetails.network)), /* @__PURE__ */ React6.createElement(Divider, { style: { margin: "6px 0" } }), /* @__PURE__ */ React6.createElement("div", { className: "flex justify-between items-start" }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Wallet Address"), /* @__PURE__ */ React6.createElement(Text, { style: {
2685
- fontSize: "11px",
2686
- fontWeight: 500,
2687
- fontFamily: "Monaco, monospace",
2688
- wordBreak: "break-all",
2689
- textAlign: "right",
2690
- maxWidth: "60%",
2691
- lineHeight: 1.4
2692
- } }, address))), /* @__PURE__ */ React6.createElement(
2693
- "div",
2694
- {
2695
- className: "flex items-center justify-center gap-2 mb-3 p-2 rounded-lg",
2696
- style: { background: "#f6ffed", border: "1px solid #d9f7be" }
2697
- },
2698
- /* @__PURE__ */ React6.createElement(SafetyOutlined, { style: { color: "#52c41a", fontSize: "13px" } }),
2699
- /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "12px", color: "#52c41a", fontWeight: 500 } }, "Secure payment powered by v402pay")
2700
- ), /* @__PURE__ */ React6.createElement(
2701
- Button,
2702
- {
2703
- type: "primary",
2704
- size: "large",
2705
- onClick: handlePayment,
2706
- disabled: isProcessing || !paymentDetails,
2707
- loading: isProcessing,
2708
- block: true,
2709
- style: {
2710
- height: "44px",
2711
- fontSize: "14px",
2712
- fontWeight: 600,
2713
- borderRadius: "8px",
2714
- ...!isProcessing && paymentDetails && {
2715
- background: "#1a1a1a",
2716
- borderColor: "#1a1a1a"
2717
- },
2718
- marginBottom: "10px"
2719
- }
2720
- },
2721
- isProcessing ? "Processing..." : !paymentDetails ? "Loading..." : `Pay $${paymentDetails.amount} ${paymentDetails.currency}`
2722
- ), /* @__PURE__ */ React6.createElement("div", { className: "text-center" }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#8c8c8c" } }, "Don't have USDC?", " "), /* @__PURE__ */ React6.createElement(
2723
- "a",
2724
- {
2725
- href: "https://faucet.circle.com/",
2726
- target: "_blank",
2727
- rel: "noopener noreferrer",
2728
- className: "text-blue-600 hover:text-blue-700 text-sm font-medium inline-flex items-center gap-1"
2729
- },
2730
- "Get it here ",
2731
- /* @__PURE__ */ React6.createElement(LinkOutlined, { style: { fontSize: "12px" } })
2732
- )), isModal && result && /* @__PURE__ */ React6.createElement(
2733
- "div",
2734
- {
2735
- className: "mt-4 p-4 rounded-lg",
2736
- style: { background: "#f6ffed", border: "1px solid #b7eb8f" }
2737
- },
2738
- /* @__PURE__ */ React6.createElement("div", { className: "text-center" }, /* @__PURE__ */ React6.createElement("span", { style: { fontSize: "20px" } }, "\u2713"), /* @__PURE__ */ React6.createElement(Text, { style: {
2739
- fontSize: "14px",
2740
- color: "#52c41a",
2741
- fontWeight: 600,
2742
- marginLeft: "8px"
2743
- } }, "Payment Successful!"))
2744
- ), isModal && error && /* @__PURE__ */ React6.createElement(
2745
- "div",
2746
- {
2747
- className: "mt-4 p-4 rounded-lg",
2748
- style: { background: "#fff2f0", border: "1px solid #ffccc7" }
2749
- },
2750
- /* @__PURE__ */ React6.createElement("div", { className: "text-center mb-3" }, /* @__PURE__ */ React6.createElement("span", { style: { fontSize: "20px" } }, "\u2717"), /* @__PURE__ */ React6.createElement(Text, { style: {
2751
- fontSize: "14px",
2752
- color: "#ff4d4f",
2753
- fontWeight: 600,
2754
- marginLeft: "8px",
2755
- display: "block",
2756
- marginTop: "4px"
2757
- } }, "Payment Failed")),
2758
- /* @__PURE__ */ React6.createElement(Text, { style: {
2759
- fontSize: "13px",
2760
- color: "#ff4d4f",
2761
- display: "block",
2762
- textAlign: "center"
2763
- } }, error)
2764
- ))
2765
- ),
2766
- !isModal && (isProcessing || result || error) && /* @__PURE__ */ React6.createElement(
2767
- Card,
2768
- {
2769
- title: /* @__PURE__ */ React6.createElement("div", { className: "flex items-center gap-2" }, isProcessing && !result && !error ? /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(LoadingOutlined, { style: { color: "#14b8a6", fontSize: "16px" } }), /* @__PURE__ */ React6.createElement(Text, { strong: true, style: { fontSize: "16px", color: "#262626" } }, "Processing Payment")) : result ? /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement("span", { style: { color: "#52c41a", fontSize: "18px" } }, "\u2713"), /* @__PURE__ */ React6.createElement(Text, { strong: true, style: { fontSize: "16px", color: "#262626" } }, "Payment Successful")) : /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement("span", { style: { color: "#ff4d4f", fontSize: "18px" } }, "\u2717"), /* @__PURE__ */ React6.createElement(Text, { strong: true, style: { fontSize: "16px", color: "#262626" } }, "Payment Failed"))),
2770
- extra: !isProcessing && /* @__PURE__ */ React6.createElement(
2771
- Button,
2772
- {
2773
- type: "text",
2774
- size: "small",
2775
- onClick: () => {
2776
- setResult(null);
2777
- setError(null);
2778
- }
2779
- },
2780
- "Close"
2781
- ),
2782
- style: {
2783
- border: "1px solid #e8e8e8",
2784
- borderRadius: "16px",
2785
- boxShadow: "0 4px 24px rgba(0, 0, 0, 0.06)",
2786
- maxHeight: "calc(100vh - 32px)",
2787
- width: "480px",
2788
- animation: "slideInRight 0.4s ease-out"
2789
- },
2790
- styles: {
2791
- body: {
2792
- padding: "24px",
2793
- maxHeight: "calc(100vh - 120px)",
2794
- overflow: "auto"
2795
- }
2796
- }
2797
- },
2798
- isProcessing && !result && !error && /* @__PURE__ */ React6.createElement("div", { className: "text-center py-10" }, /* @__PURE__ */ React6.createElement("div", { className: "relative inline-block" }, /* @__PURE__ */ React6.createElement(
2799
- "div",
2800
- {
2801
- className: "absolute inset-0 rounded-full blur-xl opacity-40",
2802
- style: {
2803
- background: "linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%)",
2804
- animation: "pulse 2s ease-in-out infinite"
2805
- }
2806
- }
2807
- ), /* @__PURE__ */ React6.createElement(
2808
- Spin,
2809
- {
2810
- indicator: /* @__PURE__ */ React6.createElement(LoadingOutlined, { style: { fontSize: 56, color: "#14b8a6" } })
2811
- }
2812
- )), /* @__PURE__ */ React6.createElement("div", { className: "mt-6" }, /* @__PURE__ */ React6.createElement(Text, { strong: true, style: { fontSize: "18px", color: "#262626", letterSpacing: "-0.02em" } }, "Verifying Payment")), /* @__PURE__ */ React6.createElement("div", { className: "mt-2 mb-6" }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "14px", color: "#8c8c8c", lineHeight: "1.6" } }, "Please wait while we confirm your transaction")), /* @__PURE__ */ React6.createElement(
2813
- "div",
2814
- {
2815
- className: "mt-4 p-4 rounded-xl",
2816
- style: {
2817
- background: "linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%)",
2818
- border: "1px solid #ccfbf1"
2819
- }
2820
- },
2821
- /* @__PURE__ */ React6.createElement("div", { className: "flex items-center justify-center gap-2" }, /* @__PURE__ */ React6.createElement("span", { style: { fontSize: "16px" } }, "\u23F1\uFE0F"), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "13px", color: "#0f766e", fontWeight: 500 } }, "This may take a few moments"))
2822
- )),
2823
- result && /* @__PURE__ */ React6.createElement("div", null, /* @__PURE__ */ React6.createElement("div", { className: "text-center mb-6" }, /* @__PURE__ */ React6.createElement(
2824
- "div",
2825
- {
2826
- className: "inline-flex items-center justify-center w-16 h-16 rounded-full mb-4",
2827
- style: {
2828
- background: "linear-gradient(135deg, #10b981 0%, #34d399 100%)",
2829
- boxShadow: "0 4px 20px rgba(16, 185, 129, 0.3)"
2830
- }
2831
- },
2832
- /* @__PURE__ */ React6.createElement("span", { style: { fontSize: "32px", color: "white" } }, "\u2713")
2833
- ), /* @__PURE__ */ React6.createElement("div", null, /* @__PURE__ */ React6.createElement(Text, { strong: true, style: {
2834
- fontSize: "20px",
2835
- color: "#262626",
2836
- display: "block",
2837
- marginBottom: "8px"
2838
- } }, "Payment Successful!"), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "14px", color: "#8c8c8c" } }, "Your transaction has been confirmed"))), /* @__PURE__ */ React6.createElement(Divider, { style: { margin: "20px 0", borderColor: "#f0f0f0" } }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "12px", color: "#8c8c8c", fontWeight: 500 } }, "RESPONSE DATA")), /* @__PURE__ */ React6.createElement(
2839
- "pre",
2840
- {
2841
- style: {
2842
- background: "#fafafa",
2843
- padding: "20px",
2844
- borderRadius: "12px",
2845
- fontSize: "12px",
2846
- lineHeight: "1.8",
2847
- overflow: "auto",
2848
- margin: 0,
2849
- fontFamily: "Monaco, Courier New, monospace",
2850
- whiteSpace: "pre-wrap",
2851
- wordBreak: "break-word",
2852
- border: "1px solid #e8e8e8",
2853
- color: "#262626"
2854
- }
2855
- },
2856
- JSON.stringify(result, null, 2)
2857
- )),
2858
- error && /* @__PURE__ */ React6.createElement("div", null, /* @__PURE__ */ React6.createElement("div", { className: "text-center mb-6" }, /* @__PURE__ */ React6.createElement(
2859
- "div",
2860
- {
2861
- className: "inline-flex items-center justify-center w-16 h-16 rounded-full mb-4",
2862
- style: {
2863
- background: "linear-gradient(135deg, #ef4444 0%, #f87171 100%)",
2864
- boxShadow: "0 4px 20px rgba(239, 68, 68, 0.3)"
2865
- }
2866
- },
2867
- /* @__PURE__ */ React6.createElement("span", { style: { fontSize: "32px", color: "white" } }, "\u2717")
2868
- ), /* @__PURE__ */ React6.createElement("div", null, /* @__PURE__ */ React6.createElement(Text, { strong: true, style: {
2869
- fontSize: "20px",
2870
- color: "#262626",
2871
- display: "block",
2872
- marginBottom: "8px"
2873
- } }, "Payment Failed"), /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "14px", color: "#8c8c8c" } }, "Something went wrong with your transaction"))), /* @__PURE__ */ React6.createElement(Divider, { style: { margin: "20px 0", borderColor: "#f0f0f0" } }, /* @__PURE__ */ React6.createElement(Text, { style: { fontSize: "12px", color: "#8c8c8c", fontWeight: 500 } }, "ERROR DETAILS")), /* @__PURE__ */ React6.createElement(
2874
- "div",
2875
- {
2876
- style: {
2877
- background: "#fef2f2",
2878
- padding: "20px",
2879
- borderRadius: "12px",
2880
- border: "1px solid #fee2e2"
2881
- }
2882
- },
2883
- /* @__PURE__ */ React6.createElement(Text, { style: {
2884
- fontSize: "14px",
2885
- color: "#dc2626",
2886
- lineHeight: "1.6",
2887
- fontWeight: 500
2888
- } }, error)
2889
- ), /* @__PURE__ */ React6.createElement("div", { className: "mt-4 text-center" }, /* @__PURE__ */ React6.createElement(
2890
- Button,
2891
- {
2892
- size: "large",
2893
- onClick: handlePayment,
2894
- style: {
2895
- height: "44px",
2896
- fontSize: "14px",
2897
- fontWeight: 600,
2898
- borderRadius: "8px",
2899
- background: "#1a1a1a",
2900
- borderColor: "#1a1a1a",
2901
- color: "white",
2902
- paddingLeft: "32px",
2903
- paddingRight: "32px"
2904
- }
2905
- },
2906
- "Try Again"
2907
- )))
2908
- )
2909
- ),
2910
- /* @__PURE__ */ React6.createElement("style", { dangerouslySetInnerHTML: {
2911
- __html: `
2912
- @keyframes slideInRight {
2913
- from {
2914
- opacity: 0;
2915
- transform: translateX(100px);
2916
- }
2917
- to {
2918
- opacity: 1;
2919
- transform: translateX(0);
2920
- }
2921
- }
2922
-
2923
- @keyframes pulse {
2924
- 0%, 100% {
2925
- transform: scale(1);
2926
- opacity: 0.4;
2927
- }
2928
- 50% {
2929
- transform: scale(1.1);
2930
- opacity: 0.6;
2931
- }
2932
- }
2933
- `
2934
- } })
2935
- );
2936
- }
2937
-
2938
- // src/react/components/checkout/V402CheckoutV2.tsx
2939
- import React11, { useEffect as useEffect7, useState as useState8 } from "react";
2940
- init_common();
2941
-
2942
1941
  // src/react/styles/animations.tsx
2943
- import React7 from "react";
1942
+ import React6 from "react";
2944
1943
  var checkoutAnimations = `
2945
1944
  @keyframes spin {
2946
1945
  from { transform: rotate(0deg); }
@@ -2968,10 +1967,10 @@ var checkoutAnimations = `
2968
1967
  50% { opacity: 0.4; }
2969
1968
  }
2970
1969
  `;
2971
- var AnimationStyles = () => /* @__PURE__ */ React7.createElement("style", { dangerouslySetInnerHTML: { __html: checkoutAnimations } });
1970
+ var AnimationStyles = () => /* @__PURE__ */ React6.createElement("style", { dangerouslySetInnerHTML: { __html: checkoutAnimations } });
2972
1971
 
2973
1972
  // src/react/components/checkout/Receipt.tsx
2974
- import React8, { useEffect as useEffect6, useState as useState7 } from "react";
1973
+ import React7, { useEffect as useEffect5, useState as useState6 } from "react";
2975
1974
  var Receipt = ({
2976
1975
  isLoading,
2977
1976
  isVisible,
@@ -2984,8 +1983,8 @@ var Receipt = ({
2984
1983
  receiptTitle,
2985
1984
  tempReceiptId
2986
1985
  }) => {
2987
- const [animationState, setAnimationState] = useState7("hidden");
2988
- useEffect6(() => {
1986
+ const [animationState, setAnimationState] = useState6("hidden");
1987
+ useEffect5(() => {
2989
1988
  if (isLoading) {
2990
1989
  setAnimationState("printing");
2991
1990
  } else if (isVisible && (result || error)) {
@@ -2996,7 +1995,7 @@ var Receipt = ({
2996
1995
  setAnimationState("hidden");
2997
1996
  }
2998
1997
  }, [isLoading, isVisible, result, error]);
2999
- useEffect6(() => {
1998
+ useEffect5(() => {
3000
1999
  if (animationState === "bounce") {
3001
2000
  const timer = setTimeout(() => setAnimationState("visible"), 150);
3002
2001
  return () => clearTimeout(timer);
@@ -3070,13 +2069,13 @@ var Receipt = ({
3070
2069
  }
3071
2070
  };
3072
2071
  if (animationState === "hidden" && !isLoading) return null;
3073
- return /* @__PURE__ */ React8.createElement(
2072
+ return /* @__PURE__ */ React7.createElement(
3074
2073
  "div",
3075
2074
  {
3076
2075
  className: "w-full flex justify-center",
3077
2076
  style: getAnimationStyles()
3078
2077
  },
3079
- /* @__PURE__ */ React8.createElement(
2078
+ /* @__PURE__ */ React7.createElement(
3080
2079
  "div",
3081
2080
  {
3082
2081
  className: "relative bg-white shadow-2xl",
@@ -3094,7 +2093,7 @@ var Receipt = ({
3094
2093
  `
3095
2094
  }
3096
2095
  },
3097
- /* @__PURE__ */ React8.createElement(
2096
+ /* @__PURE__ */ React7.createElement(
3098
2097
  "div",
3099
2098
  {
3100
2099
  className: "absolute top-0 left-0 right-0",
@@ -3108,7 +2107,7 @@ var Receipt = ({
3108
2107
  }
3109
2108
  }
3110
2109
  ),
3111
- /* @__PURE__ */ React8.createElement(
2110
+ /* @__PURE__ */ React7.createElement(
3112
2111
  "div",
3113
2112
  {
3114
2113
  className: "absolute left-0 right-0 bg-white",
@@ -3118,7 +2117,7 @@ var Receipt = ({
3118
2117
  }
3119
2118
  }
3120
2119
  ),
3121
- !isLoading && /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
2120
+ !isLoading && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
3122
2121
  "div",
3123
2122
  {
3124
2123
  className: "absolute bottom-0 left-0 right-0",
@@ -3131,7 +2130,7 @@ var Receipt = ({
3131
2130
  backgroundRepeat: "repeat-x"
3132
2131
  }
3133
2132
  }
3134
- ), /* @__PURE__ */ React8.createElement(
2133
+ ), /* @__PURE__ */ React7.createElement(
3135
2134
  "div",
3136
2135
  {
3137
2136
  className: "absolute left-0 right-0 bg-white",
@@ -3141,16 +2140,16 @@ var Receipt = ({
3141
2140
  }
3142
2141
  }
3143
2142
  )),
3144
- !isLoading && (result || error) && /* @__PURE__ */ React8.createElement(
2143
+ !isLoading && (result || error) && /* @__PURE__ */ React7.createElement(
3145
2144
  "button",
3146
2145
  {
3147
2146
  onClick: onClose,
3148
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",
3149
2148
  style: { background: "none", border: "none" }
3150
2149
  },
3151
- /* @__PURE__ */ React8.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }, /* @__PURE__ */ React8.createElement("path", { d: "M18 6L6 18M6 6l12 12" }))
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" }))
3152
2151
  ),
3153
- /* @__PURE__ */ React8.createElement("div", { className: "p-4 font-mono text-sm", style: getContentStyles() }, /* @__PURE__ */ React8.createElement("div", { className: "text-center mb-3" }, /* @__PURE__ */ React8.createElement("div", { className: "text-base font-bold tracking-wider text-gray-800" }, receiptTitle), /* @__PURE__ */ React8.createElement("div", { className: "flex justify-between text-xs text-gray-500 mt-1" }, /* @__PURE__ */ React8.createElement("span", null, "ID: ", receiptId), /* @__PURE__ */ React8.createElement("span", null, dateStr, " ", timeStr))), /* @__PURE__ */ React8.createElement("div", { className: "border-t border-dashed border-gray-300 my-2" }), /* @__PURE__ */ React8.createElement(
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(
3154
2153
  "div",
3155
2154
  {
3156
2155
  className: "max-h-64 overflow-y-auto pr-1",
@@ -3159,7 +2158,7 @@ var Receipt = ({
3159
2158
  scrollbarColor: "#d1d5db transparent"
3160
2159
  }
3161
2160
  },
3162
- isLoading ? /* @__PURE__ */ React8.createElement(LoadingContent, { primaryColor }) : error ? /* @__PURE__ */ React8.createElement(ErrorContent, { error }) : result ? /* @__PURE__ */ React8.createElement(
2161
+ isLoading ? /* @__PURE__ */ React7.createElement(LoadingContent, { primaryColor }) : error ? /* @__PURE__ */ React7.createElement(ErrorContent, { error }) : result ? /* @__PURE__ */ React7.createElement(
3163
2162
  SuccessContent,
3164
2163
  {
3165
2164
  result,
@@ -3168,7 +2167,7 @@ var Receipt = ({
3168
2167
  primaryColor
3169
2168
  }
3170
2169
  ) : null
3171
- ), /* @__PURE__ */ React8.createElement("div", { className: "border-t border-dashed border-gray-300 my-2" }), /* @__PURE__ */ React8.createElement(Barcode, null), /* @__PURE__ */ React8.createElement("div", { className: "text-center text-xs text-gray-400 mt-1 tracking-widest" }, "POWERED BY", " ", /* @__PURE__ */ React8.createElement(
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(
3172
2171
  "a",
3173
2172
  {
3174
2173
  href: "https://v402pay.onvoyage.ai",
@@ -3181,7 +2180,7 @@ var Receipt = ({
3181
2180
  )
3182
2181
  );
3183
2182
  };
3184
- var LoadingContent = ({ primaryColor }) => /* @__PURE__ */ React8.createElement("div", { className: "text-center py-4" }, /* @__PURE__ */ React8.createElement(
2183
+ var LoadingContent = ({ primaryColor }) => /* @__PURE__ */ React7.createElement("div", { className: "text-center py-4" }, /* @__PURE__ */ React7.createElement(
3185
2184
  "div",
3186
2185
  {
3187
2186
  className: "inline-block w-8 h-8 border-2 border-gray-200 rounded-full mb-2",
@@ -3190,15 +2189,15 @@ var LoadingContent = ({ primaryColor }) => /* @__PURE__ */ React8.createElement(
3190
2189
  animation: "spin 0.8s linear infinite"
3191
2190
  }
3192
2191
  }
3193
- ), /* @__PURE__ */ React8.createElement("div", { className: "text-gray-700 font-semibold text-sm" }, "Processing..."), /* @__PURE__ */ React8.createElement("div", { className: "text-gray-400 text-xs mt-1" }, "Please wait"));
3194
- var ErrorContent = ({ error }) => /* @__PURE__ */ React8.createElement("div", { className: "text-center py-3" }, /* @__PURE__ */ React8.createElement("div", { className: "text-red-500 text-2xl mb-2" }, "\u2717"), /* @__PURE__ */ React8.createElement("div", { className: "text-red-600 font-semibold mb-1 text-sm" }, "FAILED"), /* @__PURE__ */ React8.createElement("div", { className: "text-red-500 text-xs break-words px-2" }, error));
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));
3195
2194
  var SuccessContent = ({
3196
2195
  result,
3197
2196
  paymentDetails,
3198
2197
  address,
3199
2198
  primaryColor
3200
2199
  }) => {
3201
- const [copied, setCopied] = useState7(false);
2200
+ const [copied, setCopied] = useState6(false);
3202
2201
  const handleCopy = async () => {
3203
2202
  try {
3204
2203
  await navigator.clipboard.writeText(JSON.stringify(result, null, 2));
@@ -3208,15 +2207,15 @@ var SuccessContent = ({
3208
2207
  console.error("Failed to copy:", err);
3209
2208
  }
3210
2209
  };
3211
- return /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement("div", { className: "text-center mb-2" }, /* @__PURE__ */ React8.createElement("div", { className: "text-2xl mb-1", style: { color: primaryColor } }, "\u2713"), /* @__PURE__ */ React8.createElement("div", { className: "font-semibold text-sm", style: { color: primaryColor } }, "SUCCESS")), /* @__PURE__ */ React8.createElement("div", { className: "space-y-1 text-xs" }, paymentDetails && /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ React8.createElement("span", { className: "text-gray-500" }, "Amount:"), /* @__PURE__ */ React8.createElement("span", { className: "font-semibold" }, "$", paymentDetails.amount, " ", paymentDetails.currency)), /* @__PURE__ */ React8.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ React8.createElement("span", { className: "text-gray-500" }, "Network:"), /* @__PURE__ */ React8.createElement("span", { className: "font-semibold" }, paymentDetails.network))), address && /* @__PURE__ */ React8.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ React8.createElement("span", { className: "text-gray-500" }, "From:"), /* @__PURE__ */ React8.createElement("span", { className: "font-semibold" }, formatAddress(address))), result.transactionHash && /* @__PURE__ */ React8.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ React8.createElement("span", { className: "text-gray-500" }, "TX:"), /* @__PURE__ */ React8.createElement("span", { className: "font-semibold" }, formatAddress(result.transactionHash)))), /* @__PURE__ */ React8.createElement("div", { className: "border-t border-dashed border-gray-300 my-2" }), /* @__PURE__ */ React8.createElement("div", { className: "text-xs" }, /* @__PURE__ */ React8.createElement("div", { className: "flex justify-between items-center mb-1" }, /* @__PURE__ */ React8.createElement("span", { className: "text-gray-500" }, "Response:"), /* @__PURE__ */ React8.createElement(
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(
3212
2211
  "button",
3213
2212
  {
3214
2213
  onClick: handleCopy,
3215
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",
3216
2215
  style: { background: "none", border: "none" }
3217
2216
  },
3218
- copied ? /* @__PURE__ */ React8.createElement("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }, /* @__PURE__ */ React8.createElement("path", { d: "M20 6L9 17l-5-5" })) : /* @__PURE__ */ React8.createElement("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }, /* @__PURE__ */ React8.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }), /* @__PURE__ */ React8.createElement("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" }))
3219
- )), /* @__PURE__ */ React8.createElement(
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(
3220
2219
  "pre",
3221
2220
  {
3222
2221
  className: "bg-gray-50 p-2 rounded text-xs overflow-auto whitespace-pre-wrap break-words",
@@ -3228,7 +2227,7 @@ var SuccessContent = ({
3228
2227
  var Barcode = () => {
3229
2228
  const pattern = [2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1];
3230
2229
  const heights = [10, 12, 11, 13, 10, 14, 11, 12, 13, 10, 11, 14, 12, 10, 13, 11, 12, 14, 10, 11];
3231
- return /* @__PURE__ */ React8.createElement("div", { className: "flex items-center justify-center gap-0.5 h-4 opacity-60" }, pattern.map((width, i) => /* @__PURE__ */ React8.createElement(
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(
3232
2231
  "div",
3233
2232
  {
3234
2233
  key: i,
@@ -3242,7 +2241,7 @@ var Barcode = () => {
3242
2241
  };
3243
2242
 
3244
2243
  // src/react/components/checkout/TerminalScreen.tsx
3245
- import React9 from "react";
2244
+ import React8 from "react";
3246
2245
  var TerminalScreen = ({
3247
2246
  title,
3248
2247
  tooltipText,
@@ -3253,7 +2252,7 @@ var TerminalScreen = ({
3253
2252
  screenText,
3254
2253
  supportedNetworks
3255
2254
  }) => {
3256
- return /* @__PURE__ */ React9.createElement(
2255
+ return /* @__PURE__ */ React8.createElement(
3257
2256
  "div",
3258
2257
  {
3259
2258
  className: "rounded-xl p-3 mb-3",
@@ -3263,7 +2262,7 @@ var TerminalScreen = ({
3263
2262
  border: "3px solid rgba(0,0,0,0.3)"
3264
2263
  }
3265
2264
  },
3266
- /* @__PURE__ */ React9.createElement("div", { className: "flex justify-between items-center mb-2" }, /* @__PURE__ */ React9.createElement("div", { className: "flex items-center gap-1.5 flex-1 min-w-0" }, /* @__PURE__ */ React9.createElement("div", { className: "w-2.5 h-2.5 rounded border border-green-700 flex-shrink-0" }), title ? /* @__PURE__ */ React9.createElement(
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(
3267
2266
  "span",
3268
2267
  {
3269
2268
  className: "text-xs font-mono",
@@ -3271,29 +2270,29 @@ var TerminalScreen = ({
3271
2270
  title
3272
2271
  },
3273
2272
  title.length > 26 ? `${title.slice(0, 13)}...${title.slice(-13)}` : title
3274
- ) : /* @__PURE__ */ React9.createElement("span", { className: "text-xs font-mono", style: { color: "#22c55e80" } }, "CHECKOUT")), /* @__PURE__ */ React9.createElement(
2273
+ ) : /* @__PURE__ */ React8.createElement("span", { className: "text-xs font-mono", style: { color: "#22c55e80" } }, "CHECKOUT")), /* @__PURE__ */ React8.createElement(
3275
2274
  "div",
3276
2275
  {
3277
2276
  className: "flex gap-0.5 flex-shrink-0 cursor-help",
3278
2277
  title: tooltipText
3279
2278
  },
3280
- /* @__PURE__ */ React9.createElement(
2279
+ /* @__PURE__ */ React8.createElement(
3281
2280
  "div",
3282
2281
  {
3283
2282
  className: "w-1 h-1.5 rounded-sm",
3284
2283
  style: { backgroundColor: address ? "#22c55e80" : "#22c55e30" }
3285
2284
  }
3286
2285
  ),
3287
- /* @__PURE__ */ React9.createElement(
2286
+ /* @__PURE__ */ React8.createElement(
3288
2287
  "div",
3289
2288
  {
3290
2289
  className: "w-1 h-1.5 rounded-sm",
3291
2290
  style: { backgroundColor: address ? "#22c55e80" : "#22c55e30" }
3292
2291
  }
3293
2292
  ),
3294
- /* @__PURE__ */ React9.createElement("div", { className: "w-1 h-1.5 rounded-sm", style: { backgroundColor: "#22c55e80" } })
2293
+ /* @__PURE__ */ React8.createElement("div", { className: "w-1 h-1.5 rounded-sm", style: { backgroundColor: "#22c55e80" } })
3295
2294
  )),
3296
- /* @__PURE__ */ React9.createElement("div", { className: "min-h-[120px]" }, hasInvalidCheckoutId ? /* @__PURE__ */ React9.createElement(InvalidIdContent, null) : fetchingPaymentInfo ? /* @__PURE__ */ React9.createElement(LoadingContent2, null) : !address ? /* @__PURE__ */ React9.createElement(ConnectWalletContent, { supportedNetworks }) : /* @__PURE__ */ React9.createElement(
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(
3297
2296
  PaymentInfoContent,
3298
2297
  {
3299
2298
  screenText,
@@ -3303,8 +2302,8 @@ var TerminalScreen = ({
3303
2302
  ))
3304
2303
  );
3305
2304
  };
3306
- var InvalidIdContent = () => /* @__PURE__ */ React9.createElement("div", { className: "text-center py-3" }, /* @__PURE__ */ React9.createElement("div", { className: "text-red-500 text-xl mb-1" }, "\u2717"), /* @__PURE__ */ React9.createElement("div", { className: "text-red-500 font-mono text-sm mb-1" }, "INVALID ID"), /* @__PURE__ */ React9.createElement("div", { className: "text-red-400 font-mono text-xs" }, "Check your checkout ID"));
3307
- var LoadingContent2 = () => /* @__PURE__ */ React9.createElement("div", { className: "text-center py-4" }, /* @__PURE__ */ React9.createElement(
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(
3308
2307
  "div",
3309
2308
  {
3310
2309
  className: "inline-block w-5 h-5 border-2 rounded-full mb-2",
@@ -3314,30 +2313,30 @@ var LoadingContent2 = () => /* @__PURE__ */ React9.createElement("div", { classN
3314
2313
  animation: "spin 1s linear infinite"
3315
2314
  }
3316
2315
  }
3317
- ), /* @__PURE__ */ React9.createElement("div", { className: "font-mono text-sm", style: { color: "#22c55e" } }, "LOADING..."));
3318
- var ConnectWalletContent = ({ supportedNetworks }) => /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement(
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(
3319
2318
  "div",
3320
2319
  {
3321
2320
  className: "font-mono text-base mb-3 tracking-wider",
3322
2321
  style: { color: "#f97316", textShadow: "0 0 10px #f9731640" }
3323
2322
  },
3324
2323
  "CONNECT WALLET..."
3325
- ), /* @__PURE__ */ React9.createElement(WalletConnect, { supportedNetworks, showSwitchWallet: false }));
2324
+ ), /* @__PURE__ */ React8.createElement(WalletConnect, { supportedNetworks, showSwitchWallet: false }));
3326
2325
  var PaymentInfoContent = ({
3327
2326
  screenText,
3328
2327
  paymentDetails,
3329
2328
  address
3330
- }) => /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement(
2329
+ }) => /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement(
3331
2330
  "div",
3332
2331
  {
3333
2332
  className: "font-mono text-base mb-3 tracking-wider",
3334
2333
  style: { color: "#f97316", textShadow: "0 0 10px #f9731640" }
3335
2334
  },
3336
2335
  screenText
3337
- ), paymentDetails && /* @__PURE__ */ React9.createElement("div", { className: "text-xs font-mono" }, /* @__PURE__ */ React9.createElement("div", { className: "grid grid-cols-2 gap-1.5 mb-1.5" }, /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("div", { style: { color: "#22c55e60" } }, "AMOUNT"), /* @__PURE__ */ React9.createElement("div", { style: { color: "#22c55e" } }, "$", paymentDetails.amount)), /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("div", { style: { color: "#22c55e60" } }, "CURRENCY"), /* @__PURE__ */ React9.createElement("div", { style: { color: "#22c55e" } }, paymentDetails.currency))), /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("div", { style: { color: "#22c55e60" } }, "WALLET"), /* @__PURE__ */ React9.createElement("div", { style: { color: "#22c55e", wordBreak: "break-all" } }, address))));
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))));
3338
2337
 
3339
2338
  // src/react/components/checkout/TerminalButtons.tsx
3340
- import React10 from "react";
2339
+ import React9 from "react";
3341
2340
  var TerminalButtons = ({
3342
2341
  address,
3343
2342
  showReceipt,
@@ -3349,7 +2348,7 @@ var TerminalButtons = ({
3349
2348
  onPayment
3350
2349
  }) => {
3351
2350
  const isPayDisabled = isProcessing || !paymentDetails || !address || hasInvalidCheckoutId;
3352
- return /* @__PURE__ */ React10.createElement("div", { className: "flex items-center justify-between px-1" }, /* @__PURE__ */ React10.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React10.createElement(
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(
3353
2352
  CircleButton,
3354
2353
  {
3355
2354
  onClick: () => address && onDisconnect(),
@@ -3357,8 +2356,8 @@ var TerminalButtons = ({
3357
2356
  title: "Disconnect",
3358
2357
  size: "small"
3359
2358
  },
3360
- /* @__PURE__ */ React10.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "white", strokeWidth: "2" }, /* @__PURE__ */ React10.createElement("path", { d: "M18 6L6 18M6 6l12 12" }))
3361
- ), /* @__PURE__ */ React10.createElement(
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(
3362
2361
  CircleButton,
3363
2362
  {
3364
2363
  onClick: onClearReceipt,
@@ -3366,8 +2365,8 @@ var TerminalButtons = ({
3366
2365
  title: "Clear",
3367
2366
  size: "small"
3368
2367
  },
3369
- /* @__PURE__ */ React10.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "white", strokeWidth: "2" }, /* @__PURE__ */ React10.createElement("path", { d: "M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2m3 0v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6h14z" }))
3370
- )), /* @__PURE__ */ React10.createElement("div", { className: "flex flex-col gap-0.5 opacity-40" }, /* @__PURE__ */ React10.createElement("div", { className: "w-6 h-0.5 rounded", style: { backgroundColor: "rgba(0,0,0,0.3)" } }), /* @__PURE__ */ React10.createElement("div", { className: "w-6 h-0.5 rounded", style: { backgroundColor: "rgba(0,0,0,0.3)" } }), /* @__PURE__ */ React10.createElement("div", { className: "w-6 h-0.5 rounded", style: { backgroundColor: "rgba(0,0,0,0.3)" } })), /* @__PURE__ */ React10.createElement(
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(
3371
2370
  "button",
3372
2371
  {
3373
2372
  onClick: onPayment,
@@ -3379,13 +2378,13 @@ var TerminalButtons = ({
3379
2378
  cursor: isPayDisabled ? "not-allowed" : "pointer"
3380
2379
  }
3381
2380
  },
3382
- isProcessing ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(
2381
+ isProcessing ? /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
3383
2382
  "div",
3384
2383
  {
3385
2384
  className: "w-4 h-4 border-2 border-white/30 border-t-white rounded-full",
3386
2385
  style: { animation: "spin 0.8s linear infinite" }
3387
2386
  }
3388
- ), /* @__PURE__ */ React10.createElement("span", { className: "font-mono tracking-wider text-sm" }, "PAYING...")) : /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("span", { className: "font-mono tracking-wider text-sm" }, "PAY"), /* @__PURE__ */ React10.createElement(
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(
3389
2388
  "svg",
3390
2389
  {
3391
2390
  width: "18",
@@ -3395,13 +2394,13 @@ var TerminalButtons = ({
3395
2394
  stroke: "currentColor",
3396
2395
  strokeWidth: "2"
3397
2396
  },
3398
- /* @__PURE__ */ React10.createElement("path", { d: "M12 2v20M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6" })
2397
+ /* @__PURE__ */ React9.createElement("path", { d: "M12 2v20M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6" })
3399
2398
  ))
3400
2399
  ));
3401
2400
  };
3402
2401
  var CircleButton = ({ onClick, disabled, title, size = "normal", children }) => {
3403
2402
  const sizeClass = size === "small" ? "w-10 h-10" : "w-12 h-12";
3404
- return /* @__PURE__ */ React10.createElement(
2403
+ return /* @__PURE__ */ React9.createElement(
3405
2404
  "button",
3406
2405
  {
3407
2406
  onClick,
@@ -3450,9 +2449,9 @@ function V402CheckoutV2({
3450
2449
  { autoSwitch: !!targetNetwork, switchOnMount: true }
3451
2450
  );
3452
2451
  const { isProcessing, setIsProcessing, result, setResult, error, setError } = usePayment();
3453
- const [paymentDetails, setPaymentDetails] = useState8(null);
3454
- const [showReceipt, setShowReceipt] = useState8(false);
3455
- const [tempReceiptId, setTempReceiptId] = useState8(() => generateRandomId());
2452
+ const [paymentDetails, setPaymentDetails] = useState7(null);
2453
+ const [showReceipt, setShowReceipt] = useState7(false);
2454
+ const [tempReceiptId, setTempReceiptId] = useState7(() => generateRandomId());
3456
2455
  const handleDisconnect = () => {
3457
2456
  disconnect();
3458
2457
  setResult(null);
@@ -3484,7 +2483,7 @@ function V402CheckoutV2({
3484
2483
  setResult(null);
3485
2484
  setError(null);
3486
2485
  };
3487
- useEffect7(() => {
2486
+ useEffect6(() => {
3488
2487
  if (paymentInfo && paymentInfo.length > 0) {
3489
2488
  const firstPayment = paymentInfo[0];
3490
2489
  const rawAmount = firstPayment.maxAmountRequired?.toString() || "0";
@@ -3495,14 +2494,14 @@ function V402CheckoutV2({
3495
2494
  setPaymentDetails({ amount: humanReadableAmount, currency, network });
3496
2495
  }
3497
2496
  }, [paymentInfo]);
3498
- useEffect7(() => {
2497
+ useEffect6(() => {
3499
2498
  if (targetNetwork && !fetchingPaymentInfo && ensureNetwork) {
3500
2499
  ensureNetwork(targetNetwork).catch((err) => {
3501
2500
  console.error("Failed to ensure network:", err);
3502
2501
  });
3503
2502
  }
3504
2503
  }, [targetNetwork, fetchingPaymentInfo]);
3505
- useEffect7(() => {
2504
+ useEffect6(() => {
3506
2505
  if (isProcessing || result || error) {
3507
2506
  setShowReceipt(true);
3508
2507
  }
@@ -3517,13 +2516,13 @@ function V402CheckoutV2({
3517
2516
  if (isProcessing) return "PAYING";
3518
2517
  return "READY";
3519
2518
  };
3520
- return /* @__PURE__ */ React11.createElement("div", { className: isModal ? "bg-transparent" : "min-h-screen bg-gray-100 flex items-center justify-center p-4" }, /* @__PURE__ */ React11.createElement(
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(
3521
2520
  "div",
3522
2521
  {
3523
2522
  className: "flex flex-col items-center",
3524
2523
  style: { width: isModal ? "100%" : "380px", maxWidth: "100%" }
3525
2524
  },
3526
- /* @__PURE__ */ React11.createElement(
2525
+ /* @__PURE__ */ React10.createElement(
3527
2526
  Receipt,
3528
2527
  {
3529
2528
  isLoading: isProcessing,
@@ -3538,7 +2537,7 @@ function V402CheckoutV2({
3538
2537
  tempReceiptId
3539
2538
  }
3540
2539
  ),
3541
- /* @__PURE__ */ React11.createElement(
2540
+ /* @__PURE__ */ React10.createElement(
3542
2541
  "div",
3543
2542
  {
3544
2543
  className: "relative rounded-2xl p-3 shadow-2xl w-full",
@@ -3547,14 +2546,14 @@ function V402CheckoutV2({
3547
2546
  boxShadow: `0 16px 48px -8px ${primaryColor}66, 0 8px 24px -4px rgba(0,0,0,0.3);padding-bottom: 0px`
3548
2547
  }
3549
2548
  },
3550
- /* @__PURE__ */ React11.createElement(
2549
+ /* @__PURE__ */ React10.createElement(
3551
2550
  "div",
3552
2551
  {
3553
2552
  className: "absolute top-0 left-1/2 -translate-x-1/2 w-1/3 h-2.5 rounded-b-lg",
3554
2553
  style: { backgroundColor: "rgba(0,0,0,0.4)" }
3555
2554
  }
3556
2555
  ),
3557
- /* @__PURE__ */ React11.createElement("div", { className: "flex justify-between items-center mb-2 mt-1 px-1" }, /* @__PURE__ */ React11.createElement("div", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ React11.createElement(
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(
3558
2557
  "div",
3559
2558
  {
3560
2559
  className: "w-2 h-2 rounded-full",
@@ -3563,15 +2562,15 @@ function V402CheckoutV2({
3563
2562
  animation: "pulse 2s ease-in-out infinite"
3564
2563
  }
3565
2564
  }
3566
- ), /* @__PURE__ */ React11.createElement(
2565
+ ), /* @__PURE__ */ React10.createElement(
3567
2566
  "span",
3568
2567
  {
3569
2568
  className: "text-xs font-mono font-bold tracking-wider",
3570
2569
  style: { color: "rgba(0,0,0,0.7)" }
3571
2570
  },
3572
2571
  getStatusText()
3573
- )), /* @__PURE__ */ React11.createElement("div", { className: "flex items-center gap-1.5" }, paymentDetails && NetworkIcon && /* @__PURE__ */ React11.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ React11.createElement(NetworkIcon, { width: 12, height: 12, style: { color: "rgba(0,0,0,0.7)" } }), /* @__PURE__ */ React11.createElement("span", { className: "text-xs font-mono font-bold", style: { color: "rgba(0,0,0,0.7)" } }, paymentDetails.network)))),
3574
- /* @__PURE__ */ React11.createElement(
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(
3575
2574
  TerminalScreen,
3576
2575
  {
3577
2576
  title,
@@ -3584,7 +2583,7 @@ function V402CheckoutV2({
3584
2583
  supportedNetworks
3585
2584
  }
3586
2585
  ),
3587
- /* @__PURE__ */ React11.createElement(
2586
+ /* @__PURE__ */ React10.createElement(
3588
2587
  TerminalButtons,
3589
2588
  {
3590
2589
  address,
@@ -3597,7 +2596,7 @@ function V402CheckoutV2({
3597
2596
  onPayment: handlePayment
3598
2597
  }
3599
2598
  ),
3600
- brandName && /* @__PURE__ */ React11.createElement("div", { className: "text-center mt-0 mb-0" }, /* @__PURE__ */ React11.createElement(
2599
+ brandName && /* @__PURE__ */ React10.createElement("div", { className: "text-center mt-0 mb-0" }, /* @__PURE__ */ React10.createElement(
3601
2600
  "div",
3602
2601
  {
3603
2602
  className: "inline-block px-2 py-0.5 rounded text-[10px] font-mono font-bold tracking-[0.2em]",
@@ -3612,12 +2611,11 @@ function V402CheckoutV2({
3612
2611
  brandName
3613
2612
  ))
3614
2613
  )
3615
- ), /* @__PURE__ */ React11.createElement(AnimationStyles, null));
2614
+ ), /* @__PURE__ */ React10.createElement(AnimationStyles, null));
3616
2615
  }
3617
2616
  export {
3618
2617
  AnimationStyles,
3619
2618
  Toast,
3620
- V402Checkout,
3621
2619
  V402CheckoutV2,
3622
2620
  WalletConnect,
3623
2621
  WalletSelectModal,