coinley-checkout 0.7.2 → 0.7.4
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.
@@ -18458,25 +18458,78 @@ const getWalletInstallUrl = (walletType) => {
|
|
18458
18458
|
};
|
18459
18459
|
return urls[walletType] || "";
|
18460
18460
|
};
|
18461
|
+
const detectLuteWallet = () => {
|
18462
|
+
if (typeof window === "undefined")
|
18463
|
+
return false;
|
18464
|
+
const luteDetectionMethods = [
|
18465
|
+
// Check for window.lute
|
18466
|
+
() => window.lute !== void 0,
|
18467
|
+
// Check for window.algorand (some Algorand wallets use this)
|
18468
|
+
() => window.algorand !== void 0,
|
18469
|
+
// Check for AlgoSigner (alternative Algorand wallet)
|
18470
|
+
() => window.AlgoSigner !== void 0,
|
18471
|
+
// Check for specific Lute wallet identifiers
|
18472
|
+
() => window.luteWallet !== void 0,
|
18473
|
+
// Check for wallet extension in DOM
|
18474
|
+
() => document.querySelector('[data-wallet="lute"]') !== null,
|
18475
|
+
// Check if Lute is injected via content script
|
18476
|
+
() => window.postMessage && document.documentElement.getAttribute("data-lute-extension") === "true"
|
18477
|
+
];
|
18478
|
+
return luteDetectionMethods.some((method) => {
|
18479
|
+
try {
|
18480
|
+
return method();
|
18481
|
+
} catch (error) {
|
18482
|
+
console.warn("Lute detection method failed:", error);
|
18483
|
+
return false;
|
18484
|
+
}
|
18485
|
+
});
|
18486
|
+
};
|
18461
18487
|
const detectWallets = () => {
|
18462
18488
|
const availableWallets = {
|
18463
|
-
[WALLET_TYPES.METAMASK]: typeof window !== "undefined" && window.ethereum !== void 0,
|
18489
|
+
[WALLET_TYPES.METAMASK]: typeof window !== "undefined" && window.ethereum !== void 0 && window.ethereum.isMetaMask,
|
18464
18490
|
[WALLET_TYPES.TRONLINK]: typeof window !== "undefined" && window.tronWeb !== void 0,
|
18465
18491
|
[WALLET_TYPES.TRUST_WALLET]: typeof window !== "undefined" && window.ethereum !== void 0 && window.ethereum.isTrust === true,
|
18466
|
-
[WALLET_TYPES.LUTE]:
|
18492
|
+
[WALLET_TYPES.LUTE]: detectLuteWallet()
|
18467
18493
|
};
|
18494
|
+
if (typeof window !== "undefined") {
|
18495
|
+
console.log("=== LUTE WALLET DETECTION DEBUG ===");
|
18496
|
+
console.log("window.lute:", Boolean(window.lute));
|
18497
|
+
console.log("window.algorand:", Boolean(window.algorand));
|
18498
|
+
console.log("window.AlgoSigner:", Boolean(window.AlgoSigner));
|
18499
|
+
console.log("window.luteWallet:", Boolean(window.luteWallet));
|
18500
|
+
console.log("Lute detected overall:", availableWallets[WALLET_TYPES.LUTE]);
|
18501
|
+
console.log("=== END LUTE DETECTION DEBUG ===");
|
18502
|
+
}
|
18468
18503
|
return availableWallets;
|
18469
18504
|
};
|
18470
|
-
const detectWalletsWithRetry = (maxRetries =
|
18505
|
+
const detectWalletsWithRetry = (maxRetries = 5, delay = 1e3) => __async(void 0, null, function* () {
|
18471
18506
|
let retries = 0;
|
18472
18507
|
let wallets = detectWallets();
|
18473
|
-
|
18474
|
-
while (!hasAnyWallet && retries < maxRetries) {
|
18475
|
-
console.log(`No wallets detected, retrying (${retries + 1}/${maxRetries})...`);
|
18476
|
-
yield new Promise((resolve) => setTimeout(resolve, delay));
|
18508
|
+
while (retries < maxRetries) {
|
18477
18509
|
wallets = detectWallets();
|
18510
|
+
const hasAnyWallet = Object.values(wallets).some((v) => v === true);
|
18511
|
+
if (hasAnyWallet || retries >= maxRetries - 1) {
|
18512
|
+
break;
|
18513
|
+
}
|
18514
|
+
console.log(`Wallet detection attempt ${retries + 1}/${maxRetries}...`);
|
18515
|
+
console.log("Current detection results:", wallets);
|
18516
|
+
yield new Promise((resolve) => setTimeout(resolve, delay));
|
18478
18517
|
retries++;
|
18479
18518
|
}
|
18519
|
+
if (!wallets[WALLET_TYPES.LUTE]) {
|
18520
|
+
console.log("Performing extended Lute wallet detection...");
|
18521
|
+
if (typeof window !== "undefined") {
|
18522
|
+
try {
|
18523
|
+
const event = new CustomEvent("lute-wallet-detect", { detail: { source: "coinley-sdk" } });
|
18524
|
+
window.dispatchEvent(event);
|
18525
|
+
yield new Promise((resolve) => setTimeout(resolve, 500));
|
18526
|
+
wallets[WALLET_TYPES.LUTE] = detectLuteWallet();
|
18527
|
+
} catch (error) {
|
18528
|
+
console.warn("Extended Lute detection failed:", error);
|
18529
|
+
}
|
18530
|
+
}
|
18531
|
+
}
|
18532
|
+
console.log("Final wallet detection results:", wallets);
|
18480
18533
|
return wallets;
|
18481
18534
|
});
|
18482
18535
|
const debugWalletEnvironment = () => {
|
@@ -18485,6 +18538,8 @@ const debugWalletEnvironment = () => {
|
|
18485
18538
|
console.log("ethereum:", typeof window !== "undefined" ? Boolean(window.ethereum) : "Not in browser");
|
18486
18539
|
console.log("tronWeb:", typeof window !== "undefined" ? Boolean(window.tronWeb) : "Not in browser");
|
18487
18540
|
console.log("lute:", typeof window !== "undefined" ? Boolean(window.lute) : "Not in browser");
|
18541
|
+
console.log("algorand:", typeof window !== "undefined" ? Boolean(window.algorand) : "Not in browser");
|
18542
|
+
console.log("AlgoSigner:", typeof window !== "undefined" ? Boolean(window.AlgoSigner) : "Not in browser");
|
18488
18543
|
if (typeof window !== "undefined" && window.ethereum) {
|
18489
18544
|
console.log("ethereum details:", {
|
18490
18545
|
isTrust: window.ethereum.isTrust,
|
@@ -18499,8 +18554,16 @@ const debugWalletEnvironment = () => {
|
|
18499
18554
|
defaultAddress: window.tronWeb.defaultAddress
|
18500
18555
|
});
|
18501
18556
|
}
|
18557
|
+
if (typeof window !== "undefined") {
|
18558
|
+
console.log("All window wallet properties:");
|
18559
|
+
const walletProps = Object.keys(window).filter(
|
18560
|
+
(key) => key.toLowerCase().includes("lute") || key.toLowerCase().includes("algo") || key.toLowerCase().includes("wallet")
|
18561
|
+
);
|
18562
|
+
console.log("Potential wallet properties:", walletProps);
|
18563
|
+
}
|
18502
18564
|
const wallets = detectWallets();
|
18503
18565
|
console.log("Detected wallets:", wallets);
|
18566
|
+
console.log("=== END WALLET ENVIRONMENT DEBUG ===");
|
18504
18567
|
};
|
18505
18568
|
const connectMetamaskWallet = () => __async(void 0, null, function* () {
|
18506
18569
|
console.log("Connecting to MetaMask wallet...");
|
@@ -18621,27 +18684,72 @@ const connectTronlinkWallet = () => __async(void 0, null, function* () {
|
|
18621
18684
|
}
|
18622
18685
|
});
|
18623
18686
|
const connectLuteWallet = () => __async(void 0, null, function* () {
|
18687
|
+
var _a2;
|
18624
18688
|
console.log("Connecting to Lute wallet...");
|
18625
|
-
|
18626
|
-
|
18627
|
-
|
18628
|
-
|
18689
|
+
let walletProvider = null;
|
18690
|
+
let walletName = "";
|
18691
|
+
if (window.lute) {
|
18692
|
+
walletProvider = window.lute;
|
18693
|
+
walletName = "Lute";
|
18694
|
+
} else if (window.algorand) {
|
18695
|
+
walletProvider = window.algorand;
|
18696
|
+
walletName = "Algorand Provider";
|
18697
|
+
} else if (window.AlgoSigner) {
|
18698
|
+
walletProvider = window.AlgoSigner;
|
18699
|
+
walletName = "AlgoSigner";
|
18700
|
+
} else if (window.luteWallet) {
|
18701
|
+
walletProvider = window.luteWallet;
|
18702
|
+
walletName = "Lute Wallet";
|
18703
|
+
}
|
18704
|
+
if (!walletProvider) {
|
18705
|
+
console.error("No Algorand wallet detected.");
|
18706
|
+
console.log("Available window properties:", Object.keys(window).filter(
|
18707
|
+
(key) => key.toLowerCase().includes("lute") || key.toLowerCase().includes("algo") || key.toLowerCase().includes("wallet")
|
18708
|
+
));
|
18709
|
+
throw new Error("Lute wallet not detected. Please install Lute extension or another Algorand wallet.");
|
18710
|
+
}
|
18711
|
+
console.log(`Found ${walletName} wallet provider:`, walletProvider);
|
18629
18712
|
try {
|
18630
|
-
|
18713
|
+
let address = null;
|
18714
|
+
if (walletProvider.connect) {
|
18715
|
+
console.log("Using connect() method...");
|
18716
|
+
const result = yield walletProvider.connect();
|
18717
|
+
address = result.address || result;
|
18718
|
+
} else if (walletProvider.enable) {
|
18719
|
+
console.log("Using enable() method...");
|
18720
|
+
const accounts = yield walletProvider.enable();
|
18721
|
+
address = accounts[0] || accounts;
|
18722
|
+
} else if (walletProvider.requestAccounts) {
|
18723
|
+
console.log("Using requestAccounts() method...");
|
18724
|
+
const accounts = yield walletProvider.requestAccounts();
|
18725
|
+
address = accounts[0];
|
18726
|
+
} else if (walletProvider.connect && walletName === "AlgoSigner") {
|
18727
|
+
console.log("Using AlgoSigner connect...");
|
18728
|
+
yield walletProvider.connect();
|
18729
|
+
const accounts = yield walletProvider.accounts({ ledger: "MainNet" });
|
18730
|
+
address = (_a2 = accounts[0]) == null ? void 0 : _a2.address;
|
18731
|
+
}
|
18631
18732
|
if (!address) {
|
18632
|
-
throw new Error(
|
18733
|
+
throw new Error(`No address returned from ${walletName}. Please unlock your wallet and try again.`);
|
18633
18734
|
}
|
18634
|
-
console.log(
|
18735
|
+
console.log(`Connected to ${walletName} wallet:`, address);
|
18635
18736
|
return {
|
18636
18737
|
walletType: WALLET_TYPES.LUTE,
|
18637
18738
|
address,
|
18638
|
-
provider:
|
18739
|
+
provider: walletProvider,
|
18639
18740
|
network: NETWORK_TYPES.ALGORAND,
|
18640
|
-
isConnected: true
|
18741
|
+
isConnected: true,
|
18742
|
+
walletName
|
18641
18743
|
};
|
18642
18744
|
} catch (error) {
|
18643
|
-
console.error(
|
18644
|
-
|
18745
|
+
console.error(`Error connecting to ${walletName}:`, error);
|
18746
|
+
if (error.message && error.message.includes("User rejected")) {
|
18747
|
+
throw new Error("Connection rejected by user. Please approve the connection in your wallet.");
|
18748
|
+
} else if (error.message && error.message.includes("locked")) {
|
18749
|
+
throw new Error("Wallet is locked. Please unlock your wallet and try again.");
|
18750
|
+
} else {
|
18751
|
+
throw new Error(`Failed to connect to ${walletName}: ${error.message || "Unknown error"}`);
|
18752
|
+
}
|
18645
18753
|
}
|
18646
18754
|
});
|
18647
18755
|
const connectWallet = (walletType) => __async(void 0, null, function* () {
|
@@ -18716,16 +18824,31 @@ const sendNativeTransaction = (walletConnection, toAddress, amount) => __async(v
|
|
18716
18824
|
);
|
18717
18825
|
break;
|
18718
18826
|
case WALLET_TYPES.LUTE:
|
18719
|
-
const
|
18827
|
+
const algorandProvider = walletConnection.provider;
|
18720
18828
|
const microAlgos = Math.floor(parseFloat(amount) * 1e6);
|
18721
18829
|
console.log("Sending Algos:", {
|
18722
18830
|
to: toAddress,
|
18723
|
-
amount: microAlgos
|
18724
|
-
|
18725
|
-
transaction = yield lute.sendPayment({
|
18726
|
-
recipient: toAddress,
|
18727
|
-
amount: microAlgos
|
18831
|
+
amount: microAlgos,
|
18832
|
+
walletName: walletConnection.walletName
|
18728
18833
|
});
|
18834
|
+
if (algorandProvider.sendPayment) {
|
18835
|
+
transaction = yield algorandProvider.sendPayment({
|
18836
|
+
recipient: toAddress,
|
18837
|
+
amount: microAlgos
|
18838
|
+
});
|
18839
|
+
} else if (algorandProvider.signTransaction) {
|
18840
|
+
const txn = {
|
18841
|
+
to: toAddress,
|
18842
|
+
fee: 1e3,
|
18843
|
+
amount: microAlgos,
|
18844
|
+
firstRound: 1e3,
|
18845
|
+
lastRound: 2e3,
|
18846
|
+
type: "pay"
|
18847
|
+
};
|
18848
|
+
transaction = yield algorandProvider.signTransaction(txn);
|
18849
|
+
} else {
|
18850
|
+
throw new Error(`Unsupported Algorand wallet API for ${walletConnection.walletName}`);
|
18851
|
+
}
|
18729
18852
|
break;
|
18730
18853
|
default:
|
18731
18854
|
throw new Error(`Unsupported wallet type: ${walletConnection.walletType}`);
|
@@ -18911,7 +19034,7 @@ const sendAlgorandAssetTransaction = (walletConnection, tokenConfig, toAddress,
|
|
18911
19034
|
if (!walletConnection || !walletConnection.provider) {
|
18912
19035
|
throw new Error("Algorand wallet not connected");
|
18913
19036
|
}
|
18914
|
-
const
|
19037
|
+
const algorandProvider = walletConnection.provider;
|
18915
19038
|
if (!tokenConfig || !tokenConfig.assetId) {
|
18916
19039
|
throw new Error("Invalid token configuration - missing assetId");
|
18917
19040
|
}
|
@@ -18920,20 +19043,42 @@ const sendAlgorandAssetTransaction = (walletConnection, tokenConfig, toAddress,
|
|
18920
19043
|
const tokenDecimals = parseInt(decimals);
|
18921
19044
|
const assetAmount = Math.floor(tokenAmount * Math.pow(10, tokenDecimals));
|
18922
19045
|
console.log(`Sending ${tokenAmount} ${symbol} (${assetAmount} base units) to ${toAddress}`);
|
19046
|
+
console.log(`Using wallet: ${walletConnection.walletName || "Unknown"}`);
|
18923
19047
|
try {
|
18924
|
-
|
18925
|
-
|
18926
|
-
|
18927
|
-
|
18928
|
-
|
19048
|
+
let transaction;
|
19049
|
+
if (algorandProvider.sendAssetTransfer) {
|
19050
|
+
console.log("Using sendAssetTransfer method...");
|
19051
|
+
transaction = yield algorandProvider.sendAssetTransfer({
|
19052
|
+
recipient: toAddress,
|
19053
|
+
assetId,
|
19054
|
+
amount: assetAmount
|
19055
|
+
});
|
19056
|
+
} else if (algorandProvider.signTransaction) {
|
19057
|
+
console.log("Using signTransaction method for asset transfer...");
|
19058
|
+
const txn = {
|
19059
|
+
type: "axfer",
|
19060
|
+
from: walletConnection.address,
|
19061
|
+
to: toAddress,
|
19062
|
+
amount: assetAmount,
|
19063
|
+
assetIndex: assetId,
|
19064
|
+
fee: 1e3,
|
19065
|
+
firstRound: 1e3,
|
19066
|
+
lastRound: 2e3
|
19067
|
+
};
|
19068
|
+
transaction = yield algorandProvider.signTransaction(txn);
|
19069
|
+
} else {
|
19070
|
+
throw new Error(`Unsupported Algorand wallet API for asset transfers in ${walletConnection.walletName || "this wallet"}`);
|
19071
|
+
}
|
18929
19072
|
console.log("Algorand asset transaction sent:", transaction);
|
18930
|
-
return transaction.txId;
|
19073
|
+
return transaction.txId || transaction.txID || transaction;
|
18931
19074
|
} catch (error) {
|
18932
19075
|
console.error("Algorand asset transaction error:", error);
|
18933
19076
|
if (error.message && error.message.includes("rejected")) {
|
18934
19077
|
throw new Error("Transaction rejected by user");
|
18935
19078
|
} else if (error.message && error.message.includes("balance")) {
|
18936
19079
|
throw new Error("Insufficient asset balance");
|
19080
|
+
} else if (error.message && error.message.includes("opted")) {
|
19081
|
+
throw new Error("Account not opted in to this asset. Please opt in first.");
|
18937
19082
|
} else {
|
18938
19083
|
throw error;
|
18939
19084
|
}
|
@@ -21118,12 +21263,13 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
|
|
21118
21263
|
"button",
|
21119
21264
|
{
|
21120
21265
|
onClick: () => handleSelectPaymentMethod(method),
|
21121
|
-
className: `group
|
21122
|
-
|
21123
|
-
|
21266
|
+
className: `group flex items-center justify-between w-full px-2 py-2 rounded-2xl border text-left transition-all duration-200 font-medium text-base
|
21267
|
+
${isSelected ? "bg-[#E9DDFC] border-transparent shadow-none" : "bg-white border-gray-200 hover:bg-[#F6F2FF] hover:border-[#E9DDFC]"}
|
21268
|
+
`,
|
21269
|
+
style: { minHeight: "56px", padding: "0.5rem" },
|
21124
21270
|
children: [
|
21125
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("
|
21126
|
-
typeof method.logo === "function" ? /* @__PURE__ */ jsxRuntimeExports.jsx(method.logo, { size: 24 }) : /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: method.logo, alt: method.name, className: "h-
|
21271
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-x-2", children: [
|
21272
|
+
typeof method.logo === "function" ? /* @__PURE__ */ jsxRuntimeExports.jsx(method.logo, { size: 24 }) : /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: method.logo, alt: method.name, className: "h-4 w-4" }),
|
21127
21273
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-medium text-sm text-gray-900", children: [
|
21128
21274
|
method.description,
|
21129
21275
|
" (",
|
@@ -21131,12 +21277,20 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
|
|
21131
21277
|
")"
|
21132
21278
|
] })
|
21133
21279
|
] }),
|
21134
|
-
isSelected && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex items-center justify-center w-
|
21280
|
+
isSelected && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2 flex items-center justify-center w-6 h-6 rounded-full bg-[#7042D2]", children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M4 8.5L7 11.5L12 6.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
|
21135
21281
|
]
|
21136
21282
|
},
|
21137
21283
|
`${method.id}-${method.network}`
|
21138
21284
|
);
|
21139
|
-
}) })
|
21285
|
+
}) }),
|
21286
|
+
availableMethods.length > 4 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21287
|
+
"button",
|
21288
|
+
{
|
21289
|
+
onClick: () => setShowMore(!showMore),
|
21290
|
+
className: `w-full py-2 px-4 rounded-lg text-sm font-medium transition-colors ${theme2 === "dark" ? "bg-gray-700 text-gray-300 hover:bg-gray-600" : "bg-gray-100 text-gray-600 hover:bg-gray-200"}`,
|
21291
|
+
children: showMore ? "Show Less" : `Show More (${availableMethods.length - 4} more)`
|
21292
|
+
}
|
21293
|
+
)
|
21140
21294
|
] }),
|
21141
21295
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `p-3 rounded-lg text-sm mb-6 ${theme2 === "dark" ? "bg-gray-800 text-gray-300" : "bg-gray-50 text-gray-600"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
21142
21296
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-2 h-2 rounded-full mr-2 ${availableWallets[getRequiredWallet(selectedNetwork)] ? "bg-green-500" : "bg-red-500"}` }),
|
@@ -21233,261 +21387,251 @@ const CoinleyModal = ({
|
|
21233
21387
|
};
|
21234
21388
|
if (!isOpen)
|
21235
21389
|
return null;
|
21236
|
-
return /* @__PURE__ */ jsxRuntimeExports.
|
21237
|
-
|
21238
|
-
|
21239
|
-
|
21240
|
-
|
21241
|
-
|
21242
|
-
|
21243
|
-
|
21244
|
-
|
21245
|
-
|
21246
|
-
|
21247
|
-
|
21248
|
-
|
21249
|
-
|
21250
|
-
|
21251
|
-
|
21252
|
-
|
21253
|
-
|
21254
|
-
|
21255
|
-
|
21256
|
-
|
21257
|
-
|
21258
|
-
|
21390
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed inset-0 z-50 overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
21391
|
+
"div",
|
21392
|
+
{
|
21393
|
+
className: "coinley-modal relative py-6 px-2 w-full max-w-md mx-auto shadow-xl bg-gray-100 rounded-3xl",
|
21394
|
+
children: [
|
21395
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-white flex justify-between items-center mb-6 mr-3 ml-3 py-4 px-2 rounded-full", children: [
|
21396
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 flex items-center gap-2 px-4", children: [
|
21397
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: logo, className: "w-auto h-auto", alt: "Coinley Logo" }),
|
21398
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-lg font-semibold text-gray-800", children: "Payment Details" })
|
21399
|
+
] }),
|
21400
|
+
step !== "success" && step !== "processing" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21401
|
+
"button",
|
21402
|
+
{
|
21403
|
+
onClick: onClose,
|
21404
|
+
className: "text-gray-500 hover:text-gray-700 focus:outline-none",
|
21405
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 mr-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
21406
|
+
}
|
21407
|
+
)
|
21408
|
+
] }),
|
21409
|
+
payment && step !== "success" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-6", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center", children: [
|
21410
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-600", children: "Total amount" }),
|
21411
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "coinley-amount-display text-2xl md:text-4xl lg:text-6xl font-bold text-[#7042D2] mt-2 leading-tight tracking-tight", children: [
|
21412
|
+
"$",
|
21413
|
+
formatAmount(payment.totalAmount || payment.amount)
|
21414
|
+
] }),
|
21415
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-600 mt-4", children: "Payment to:" }),
|
21416
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "coinley-merchant-name text-base font-semibold mt-1 flex gap-2 items-center", children: [
|
21417
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M15.3 7.50065L15.8 10.0007H4.2L4.7 7.50065H15.3ZM16.6667 3.33398H3.33333V5.00065H16.6667V3.33398ZM16.6667 5.83398H3.33333L2.5 10.0007V11.6673H3.33333V16.6673H11.6667V11.6673H15V16.6673H16.6667V11.6673H17.5V10.0007L16.6667 5.83398ZM5 15.0007V11.6673H10V15.0007H5Z", fill: "#7042D2" }) }),
|
21418
|
+
merchantName
|
21419
|
+
] })
|
21420
|
+
] }) }),
|
21421
|
+
step === "select-currency" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pb-6 pt-6 px-6 bg-white rounded-t-2xl blockchain-network", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21422
|
+
PaymentMethods,
|
21423
|
+
{
|
21424
|
+
onSelect: onPaymentMethodSelect,
|
21425
|
+
selected: selectedPaymentMethod,
|
21426
|
+
theme: theme2,
|
21427
|
+
supportedNetworks
|
21428
|
+
}
|
21429
|
+
) }),
|
21430
|
+
step === "confirm" && selectedPaymentMethod && payment && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21431
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4 rounded-lg mb-4 bg-gray-100", children: [
|
21432
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-medium mb-2 text-gray-800", children: "Payment Details" }),
|
21433
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
21434
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21435
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Currency:" }),
|
21436
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: selectedPaymentMethod.currency })
|
21437
|
+
] }),
|
21438
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21439
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Network:" }),
|
21440
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: getNetworkDisplayName(selectedPaymentMethod.network) })
|
21441
|
+
] }),
|
21442
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21443
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Fee:" }),
|
21444
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "1.75%" })
|
21445
|
+
] })
|
21446
|
+
] })
|
21447
|
+
] }),
|
21448
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex border-b border-gray-200", children: [
|
21449
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21450
|
+
"button",
|
21451
|
+
{
|
21452
|
+
onClick: () => setPaymentType("wallet"),
|
21453
|
+
className: `py-2 px-4 text-sm font-medium ${paymentType === "wallet" ? "border-b-2 border-purple-600 text-purple-600" : "text-gray-500 hover:text-gray-700"}`,
|
21454
|
+
children: "Connect Wallet"
|
21455
|
+
}
|
21456
|
+
),
|
21457
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21259
21458
|
"button",
|
21260
21459
|
{
|
21261
|
-
onClick:
|
21262
|
-
className: "text-gray-500 hover:text-gray-700
|
21263
|
-
children:
|
21460
|
+
onClick: () => setPaymentType("qrcode"),
|
21461
|
+
className: `py-2 px-4 text-sm font-medium ${paymentType === "qrcode" ? "border-b-2 border-purple-600 text-purple-600" : "text-gray-500 hover:text-gray-700"}`,
|
21462
|
+
children: "QR Code"
|
21264
21463
|
}
|
21265
21464
|
)
|
21266
|
-
] }),
|
21267
|
-
payment && step !== "success" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-6", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center", children: [
|
21268
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-600", children: "Total amount" }),
|
21269
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-[50px] md:text-[60px] lg:text-[70px] font-bold leading-[100%] tracking-[0] text-center text-[#7042D2] mt-2", children: [
|
21270
|
-
"$",
|
21271
|
-
formatAmount(payment.totalAmount || payment.amount)
|
21272
|
-
] }),
|
21273
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-600 mt-4", children: "Payment to:" }),
|
21274
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "coinley-merchant-name text-base font-semibold mt-1 flex items-center justify-center gap-2", children: [
|
21275
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: "16", height: "14", viewBox: "0 0 16 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M13.3 4.50065L13.8 7.00065H2.2L2.7 4.50065H13.3ZM14.6667 0.333984H1.33333V2.00065H14.6667V0.333984ZM14.6667 2.83398H1.33333L0.5 7.00065V8.66732H1.33333V13.6673H9.66667V8.66732H13V13.6673H14.6667V8.66732H15.5V7.00065L14.6667 2.83398ZM3 12.0007V8.66732H8V12.0007H3Z", fill: "#7042D2" }) }),
|
21276
|
-
merchantName
|
21277
|
-
] })
|
21278
21465
|
] }) }),
|
21279
|
-
|
21280
|
-
|
21281
|
-
|
21466
|
+
testMode ? (
|
21467
|
+
// Test mode payment option
|
21468
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 rounded-lg mb-4 bg-blue-50", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
21469
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-purple-600 rounded-full p-2 mr-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-white", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }) }),
|
21470
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21471
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium text-gray-800", children: "Test Mode Payment" }),
|
21472
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-600", children: 'Click "Pay Now" to simulate a successful payment' })
|
21473
|
+
] })
|
21474
|
+
] }) })
|
21475
|
+
) : paymentType === "qrcode" ? (
|
21476
|
+
// QR Code payment option
|
21477
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21478
|
+
QRCode,
|
21282
21479
|
{
|
21283
|
-
|
21284
|
-
|
21285
|
-
|
21286
|
-
|
21480
|
+
walletAddress: getWalletAddressForNetwork(),
|
21481
|
+
amount: payment.totalAmount || payment.amount,
|
21482
|
+
currency: selectedPaymentMethod.currency,
|
21483
|
+
network: selectedPaymentMethod.network,
|
21484
|
+
theme: theme2
|
21287
21485
|
}
|
21288
|
-
) })
|
21289
|
-
|
21290
|
-
|
21291
|
-
|
21292
|
-
" -
|
21293
|
-
|
21294
|
-
] }) }) })
|
21295
|
-
] }),
|
21296
|
-
step === "confirm" && selectedPaymentMethod && payment && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21297
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4 rounded-lg mb-4 bg-gray-100", children: [
|
21298
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-medium mb-2 text-gray-800", children: "Payment Details" }),
|
21299
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
21300
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21301
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Currency:" }),
|
21302
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: selectedPaymentMethod.currency })
|
21303
|
-
] }),
|
21304
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21305
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Network:" }),
|
21306
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: getNetworkDisplayName(selectedPaymentMethod.network) })
|
21307
|
-
] }),
|
21308
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21309
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Fee:" }),
|
21310
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "1.75%" })
|
21311
|
-
] })
|
21312
|
-
] })
|
21313
|
-
] }),
|
21314
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex border-b border-gray-200", children: [
|
21315
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21316
|
-
"button",
|
21317
|
-
{
|
21318
|
-
onClick: () => setPaymentType("wallet"),
|
21319
|
-
className: `py-2 px-4 text-sm font-medium ${paymentType === "wallet" ? "border-b-2 border-purple-600 text-purple-600" : "text-gray-500 hover:text-gray-700"}`,
|
21320
|
-
children: "Connect Wallet"
|
21321
|
-
}
|
21322
|
-
),
|
21323
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21324
|
-
"button",
|
21325
|
-
{
|
21326
|
-
onClick: () => setPaymentType("qrcode"),
|
21327
|
-
className: `py-2 px-4 text-sm font-medium ${paymentType === "qrcode" ? "border-b-2 border-purple-600 text-purple-600" : "text-gray-500 hover:text-gray-700"}`,
|
21328
|
-
children: "QR Code"
|
21329
|
-
}
|
21330
|
-
)
|
21331
|
-
] }) }),
|
21332
|
-
testMode ? (
|
21333
|
-
// Test mode payment option
|
21334
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 rounded-lg mb-4 bg-blue-50", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
21335
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-purple-600 rounded-full p-2 mr-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-white", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }) }),
|
21486
|
+
) })
|
21487
|
+
) : (
|
21488
|
+
// Wallet connection option
|
21489
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3 mb-4", children: [
|
21490
|
+
supportedWallets.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 rounded-lg bg-yellow-50", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
21491
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-yellow-500 mr-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }),
|
21336
21492
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21337
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium text-gray-800", children: "
|
21338
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
21493
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium text-gray-800", children: "No Compatible Wallets" }),
|
21494
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-gray-600", children: [
|
21495
|
+
"No wallets detected for ",
|
21496
|
+
getNetworkDisplayName(selectedPaymentMethod.network),
|
21497
|
+
" network"
|
21498
|
+
] })
|
21339
21499
|
] })
|
21340
|
-
] }) })
|
21341
|
-
|
21342
|
-
|
21343
|
-
|
21344
|
-
|
21345
|
-
|
21346
|
-
|
21347
|
-
|
21348
|
-
|
21349
|
-
|
21350
|
-
|
21351
|
-
|
21352
|
-
|
21353
|
-
) : (
|
21354
|
-
// Wallet connection option
|
21355
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3 mb-4", children: [
|
21356
|
-
supportedWallets.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 rounded-lg bg-yellow-50", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
21357
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-yellow-500 mr-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }),
|
21500
|
+
] }) }) : supportedWallets.map((walletType) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 rounded-lg bg-blue-50", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
21501
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
21502
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21503
|
+
"img",
|
21504
|
+
{
|
21505
|
+
src: getWalletIcon(walletType),
|
21506
|
+
alt: getWalletDisplayName(walletType),
|
21507
|
+
className: "w-8 h-8 mr-3",
|
21508
|
+
onError: (e) => {
|
21509
|
+
e.target.style.display = "none";
|
21510
|
+
}
|
21511
|
+
}
|
21512
|
+
),
|
21358
21513
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21359
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium text-gray-800", children:
|
21514
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium text-gray-800", children: getWalletDisplayName(walletType) }),
|
21360
21515
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-gray-600", children: [
|
21361
|
-
"
|
21362
|
-
|
21363
|
-
" network"
|
21516
|
+
"Pay with ",
|
21517
|
+
getWalletDisplayName(walletType)
|
21364
21518
|
] })
|
21365
21519
|
] })
|
21366
|
-
] })
|
21367
|
-
|
21368
|
-
|
21369
|
-
|
21370
|
-
|
21371
|
-
|
21372
|
-
|
21373
|
-
|
21374
|
-
|
21375
|
-
|
21376
|
-
|
21377
|
-
|
21378
|
-
|
21379
|
-
|
21380
|
-
|
21381
|
-
|
21382
|
-
|
21383
|
-
|
21384
|
-
|
21385
|
-
|
21386
|
-
|
21387
|
-
|
21388
|
-
|
21389
|
-
|
21390
|
-
|
21391
|
-
"
|
21392
|
-
|
21393
|
-
|
21394
|
-
|
21395
|
-
|
21396
|
-
|
21397
|
-
|
21398
|
-
children: "Connect"
|
21399
|
-
}
|
21400
|
-
)
|
21401
|
-
] }) }, walletType)),
|
21402
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: Object.entries(availableWallets).filter(([walletType, isAvailable]) => !isAvailable).map(([walletType]) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 rounded-lg bg-gray-50", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
21403
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
|
21404
|
-
getWalletDisplayName(walletType),
|
21405
|
-
" not detected"
|
21406
|
-
] }),
|
21407
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21408
|
-
"a",
|
21409
|
-
{
|
21410
|
-
href: getWalletInstallUrl(walletType),
|
21411
|
-
target: "_blank",
|
21412
|
-
rel: "noopener noreferrer",
|
21413
|
-
className: "text-sm text-purple-600 hover:underline",
|
21414
|
-
children: "Install"
|
21415
|
-
}
|
21416
|
-
)
|
21417
|
-
] }) }, walletType)) })
|
21418
|
-
] })
|
21419
|
-
),
|
21420
|
-
error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 rounded-lg bg-red-50 mb-4 text-red-600 text-sm", children: error }),
|
21421
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-3 mb-3", children: [
|
21422
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21423
|
-
"button",
|
21424
|
-
{
|
21425
|
-
type: "button",
|
21426
|
-
onClick: onBack,
|
21427
|
-
className: "w-full py-2 px-4 bg-gray-200 hover:bg-gray-300 text-purple-600 font-medium rounded-md",
|
21428
|
-
children: "Back"
|
21429
|
-
}
|
21430
|
-
),
|
21431
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21432
|
-
"button",
|
21433
|
-
{
|
21434
|
-
type: "button",
|
21435
|
-
onClick: () => onPayment(paymentType === "qrcode"),
|
21436
|
-
className: "coinley-button-primary w-full py-2 px-4 font-medium rounded-md",
|
21437
|
-
disabled: !testMode && paymentType === "wallet" && !walletConnection,
|
21438
|
-
children: paymentType === "qrcode" ? "I have sent the payment" : "Pay Now"
|
21439
|
-
}
|
21440
|
-
)
|
21520
|
+
] }),
|
21521
|
+
(walletConnection == null ? void 0 : walletConnection.walletType) === walletType ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-2", children: [
|
21522
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }),
|
21523
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-green-600", children: "Connected" })
|
21524
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21525
|
+
"button",
|
21526
|
+
{
|
21527
|
+
onClick: () => {
|
21528
|
+
console.log("Connect wallet button clicked for:", walletType);
|
21529
|
+
onConnectWallet(walletType);
|
21530
|
+
},
|
21531
|
+
className: "coinley-button-primary py-2 px-4 font-medium rounded-md text-sm",
|
21532
|
+
children: "Connect"
|
21533
|
+
}
|
21534
|
+
)
|
21535
|
+
] }) }, walletType)),
|
21536
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: Object.entries(availableWallets).filter(([walletType, isAvailable]) => !isAvailable).map(([walletType]) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 rounded-lg bg-gray-50", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
21537
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
|
21538
|
+
getWalletDisplayName(walletType),
|
21539
|
+
" not detected"
|
21540
|
+
] }),
|
21541
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21542
|
+
"a",
|
21543
|
+
{
|
21544
|
+
href: getWalletInstallUrl(walletType),
|
21545
|
+
target: "_blank",
|
21546
|
+
rel: "noopener noreferrer",
|
21547
|
+
className: "text-sm text-purple-600 hover:underline",
|
21548
|
+
children: "Install"
|
21549
|
+
}
|
21550
|
+
)
|
21551
|
+
] }) }, walletType)) })
|
21441
21552
|
] })
|
21442
|
-
] }),
|
21443
|
-
step === "processing" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21444
|
-
PaymentStatus,
|
21445
|
-
{
|
21446
|
-
status: "processing",
|
21447
|
-
theme: theme2,
|
21448
|
-
message: "Processing your payment...",
|
21449
|
-
processingStartTime,
|
21450
|
-
paymentNetwork: paymentNetwork || (selectedPaymentMethod == null ? void 0 : selectedPaymentMethod.network),
|
21451
|
-
transactionHash
|
21452
|
-
}
|
21453
|
-
),
|
21454
|
-
step === "success" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21455
|
-
PaymentStatus,
|
21456
|
-
{
|
21457
|
-
status: "success",
|
21458
|
-
theme: theme2,
|
21459
|
-
message: "Payment successful!",
|
21460
|
-
payment,
|
21461
|
-
transactionHash,
|
21462
|
-
selectedPaymentMethod,
|
21463
|
-
merchantName,
|
21464
|
-
onClose: handleSuccessClose,
|
21465
|
-
pendingBackendConfirmation
|
21466
|
-
}
|
21467
21553
|
),
|
21468
|
-
|
21554
|
+
error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 rounded-lg bg-red-50 mb-4 text-red-600 text-sm", children: error }),
|
21555
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-3 mb-3", children: [
|
21469
21556
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21470
|
-
|
21557
|
+
"button",
|
21471
21558
|
{
|
21472
|
-
|
21473
|
-
|
21474
|
-
|
21559
|
+
type: "button",
|
21560
|
+
onClick: onBack,
|
21561
|
+
className: "w-full py-2 px-4 bg-gray-200 hover:bg-gray-300 text-purple-600 font-medium rounded-md",
|
21562
|
+
children: "Back"
|
21475
21563
|
}
|
21476
21564
|
),
|
21477
21565
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21478
21566
|
"button",
|
21479
21567
|
{
|
21480
21568
|
type: "button",
|
21481
|
-
onClick:
|
21482
|
-
className: "
|
21483
|
-
|
21569
|
+
onClick: () => onPayment(paymentType === "qrcode"),
|
21570
|
+
className: "coinley-button-primary w-full py-2 px-4 font-medium rounded-md",
|
21571
|
+
disabled: !testMode && paymentType === "wallet" && !walletConnection,
|
21572
|
+
children: paymentType === "qrcode" ? "I have sent the payment" : "Pay Now"
|
21484
21573
|
}
|
21485
21574
|
)
|
21486
21575
|
] })
|
21576
|
+
] }),
|
21577
|
+
step === "processing" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21578
|
+
PaymentStatus,
|
21579
|
+
{
|
21580
|
+
status: "processing",
|
21581
|
+
theme: theme2,
|
21582
|
+
message: "Processing your payment...",
|
21583
|
+
processingStartTime,
|
21584
|
+
paymentNetwork: paymentNetwork || (selectedPaymentMethod == null ? void 0 : selectedPaymentMethod.network),
|
21585
|
+
transactionHash
|
21586
|
+
}
|
21587
|
+
),
|
21588
|
+
step === "success" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21589
|
+
PaymentStatus,
|
21590
|
+
{
|
21591
|
+
status: "success",
|
21592
|
+
theme: theme2,
|
21593
|
+
message: "Payment successful!",
|
21594
|
+
payment,
|
21595
|
+
transactionHash,
|
21596
|
+
selectedPaymentMethod,
|
21597
|
+
merchantName,
|
21598
|
+
onClose: handleSuccessClose,
|
21599
|
+
pendingBackendConfirmation
|
21600
|
+
}
|
21601
|
+
),
|
21602
|
+
step === "error" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21603
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21604
|
+
PaymentStatus,
|
21605
|
+
{
|
21606
|
+
status: "error",
|
21607
|
+
theme: theme2,
|
21608
|
+
message: error || "An error occurred while processing your payment."
|
21609
|
+
}
|
21610
|
+
),
|
21611
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21612
|
+
"button",
|
21613
|
+
{
|
21614
|
+
type: "button",
|
21615
|
+
onClick: onBack,
|
21616
|
+
className: "mt-4 w-full py-2 px-4 bg-gray-200 hover:bg-gray-300 text-gray-800 font-medium rounded-md",
|
21617
|
+
children: "Try Again"
|
21618
|
+
}
|
21619
|
+
)
|
21620
|
+
] }),
|
21621
|
+
step !== "success" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center text-xs text-gray-500 flex items-center justify-center gap-1 py-6 bg-white rounded-b-[12px] ", children: [
|
21622
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [
|
21623
|
+
"Powered by ",
|
21624
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600", children: "Coinley" }),
|
21625
|
+
" - Secure Cryptocurrency Payments"
|
21626
|
+
] }),
|
21627
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { className: "inline w-4 h-4 text-green-500 ml-1", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: [
|
21628
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2", fill: "none" }),
|
21629
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M9 12l2 2 4-4", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
21630
|
+
] })
|
21487
21631
|
] })
|
21488
|
-
|
21489
|
-
|
21490
|
-
|
21632
|
+
]
|
21633
|
+
}
|
21634
|
+
) }) });
|
21491
21635
|
};
|
21492
21636
|
const CoinleyCheckout = forwardRef(({
|
21493
21637
|
apiKey,
|