coinley-checkout 0.4.9 → 0.5.1
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.
@@ -2236,6 +2236,17 @@ const names = [
|
|
2236
2236
|
"finney",
|
2237
2237
|
"ether"
|
2238
2238
|
];
|
2239
|
+
function formatUnits(value, unit) {
|
2240
|
+
let decimals = 18;
|
2241
|
+
if (typeof unit === "string") {
|
2242
|
+
const index = names.indexOf(unit);
|
2243
|
+
assertArgument(index >= 0, "invalid unit", "unit", unit);
|
2244
|
+
decimals = 3 * index;
|
2245
|
+
} else if (unit != null) {
|
2246
|
+
decimals = getNumber(unit, "unit");
|
2247
|
+
}
|
2248
|
+
return FixedNumber.fromValue(value, decimals, { decimals, width: 512 }).toString();
|
2249
|
+
}
|
2239
2250
|
function parseUnits$1(value, unit) {
|
2240
2251
|
assertArgument(typeof value === "string", "value must be a string", "value", value);
|
2241
2252
|
let decimals = 18;
|
@@ -18784,16 +18795,34 @@ const sendERC20Transaction = (walletConnection, tokenConfig, toAddress, amount)
|
|
18784
18795
|
const tokenDecimals = parseInt(decimals);
|
18785
18796
|
const tokenUnits = parseUnits$1(tokenAmount.toString(), tokenDecimals);
|
18786
18797
|
console.log(`Sending ${tokenAmount} ${symbol} (${tokenUnits.toString()} base units) to ${toAddress}`);
|
18798
|
+
console.log(`Token config:`, { contractAddress, decimals, symbol });
|
18787
18799
|
try {
|
18788
18800
|
const tokenContract = new Contract(
|
18789
18801
|
contractAddress,
|
18790
|
-
[
|
18802
|
+
[
|
18803
|
+
"function transfer(address to, uint256 amount) returns (bool)",
|
18804
|
+
"function balanceOf(address owner) view returns (uint256)",
|
18805
|
+
"function decimals() view returns (uint8)"
|
18806
|
+
],
|
18791
18807
|
signer
|
18792
18808
|
);
|
18809
|
+
const userAddress = yield signer.getAddress();
|
18810
|
+
const balance = yield tokenContract.balanceOf(userAddress);
|
18811
|
+
console.log(`User ${symbol} balance:`, formatUnits(balance, decimals));
|
18812
|
+
if (balance < tokenUnits) {
|
18813
|
+
throw new Error(`Insufficient ${symbol} balance. Required: ${tokenAmount}, Available: ${formatUnits(balance, decimals)}`);
|
18814
|
+
}
|
18793
18815
|
try {
|
18794
18816
|
const gasEstimate = yield tokenContract.transfer.estimateGas(toAddress, tokenUnits);
|
18795
18817
|
console.log("Gas estimate:", gasEstimate.toString());
|
18796
|
-
|
18818
|
+
let gasMultiplier;
|
18819
|
+
if (symbol === "USDC") {
|
18820
|
+
gasMultiplier = BigInt(150);
|
18821
|
+
} else if (symbol === "USDT") {
|
18822
|
+
gasMultiplier = BigInt(130);
|
18823
|
+
} else {
|
18824
|
+
gasMultiplier = BigInt(120);
|
18825
|
+
}
|
18797
18826
|
const gasLimit = gasEstimate * gasMultiplier / BigInt(100);
|
18798
18827
|
console.log("Using gas limit:", gasLimit.toString());
|
18799
18828
|
const transaction = yield tokenContract.transfer(toAddress, tokenUnits, {
|
@@ -18803,16 +18832,20 @@ const sendERC20Transaction = (walletConnection, tokenConfig, toAddress, amount)
|
|
18803
18832
|
return transaction.hash;
|
18804
18833
|
} catch (gasError) {
|
18805
18834
|
console.error("Gas estimation failed:", gasError);
|
18835
|
+
let fixedGasLimit;
|
18806
18836
|
if (symbol === "USDC") {
|
18807
|
-
|
18808
|
-
|
18809
|
-
|
18810
|
-
|
18811
|
-
|
18812
|
-
console.log("Transaction sent with fixed gas limit:", transaction);
|
18813
|
-
return transaction.hash;
|
18837
|
+
fixedGasLimit = BigInt(2e5);
|
18838
|
+
} else if (symbol === "USDT") {
|
18839
|
+
fixedGasLimit = BigInt(18e4);
|
18840
|
+
} else {
|
18841
|
+
fixedGasLimit = BigInt(15e4);
|
18814
18842
|
}
|
18815
|
-
|
18843
|
+
console.log(`Trying ${symbol} transaction with fixed gas limit:`, fixedGasLimit.toString());
|
18844
|
+
const transaction = yield tokenContract.transfer(toAddress, tokenUnits, {
|
18845
|
+
gasLimit: fixedGasLimit
|
18846
|
+
});
|
18847
|
+
console.log("Transaction sent with fixed gas limit:", transaction);
|
18848
|
+
return transaction.hash;
|
18816
18849
|
}
|
18817
18850
|
} catch (error) {
|
18818
18851
|
console.error("ERC20 transaction error:", error);
|
@@ -18820,6 +18853,8 @@ const sendERC20Transaction = (walletConnection, tokenConfig, toAddress, amount)
|
|
18820
18853
|
throw new Error("Transaction rejected by user");
|
18821
18854
|
} else if (error.message && error.message.includes("insufficient funds")) {
|
18822
18855
|
throw new Error("Insufficient funds for transaction");
|
18856
|
+
} else if (error.message && error.message.includes("Insufficient")) {
|
18857
|
+
throw error;
|
18823
18858
|
} else {
|
18824
18859
|
throw error;
|
18825
18860
|
}
|
@@ -19164,16 +19199,17 @@ var jsxRuntimeExports = jsxRuntime.exports;
|
|
19164
19199
|
const ThemeContext = createContext();
|
19165
19200
|
const useTheme = () => useContext(ThemeContext);
|
19166
19201
|
const ThemeProvider = ({ initialTheme = "light", children }) => {
|
19167
|
-
const [
|
19202
|
+
const [theme2, setTheme] = useState(initialTheme);
|
19168
19203
|
const toggleTheme = () => {
|
19169
19204
|
setTheme((prevTheme) => prevTheme === "light" ? "dark" : "light");
|
19170
19205
|
};
|
19171
19206
|
useEffect(() => {
|
19172
19207
|
document.documentElement.classList.remove("light", "dark");
|
19173
|
-
document.documentElement.classList.add(
|
19174
|
-
}, [
|
19175
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeContext.Provider, { value: { theme, setTheme, toggleTheme }, children });
|
19208
|
+
document.documentElement.classList.add(theme2);
|
19209
|
+
}, [theme2]);
|
19210
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeContext.Provider, { value: { theme: theme2, setTheme, toggleTheme }, children });
|
19176
19211
|
};
|
19212
|
+
const theme = "";
|
19177
19213
|
const CoinleyContext = createContext();
|
19178
19214
|
const useCoinley = () => useContext(CoinleyContext);
|
19179
19215
|
const CoinleyProvider = ({
|
@@ -20362,7 +20398,7 @@ const QRCode = ({
|
|
20362
20398
|
amount,
|
20363
20399
|
currency,
|
20364
20400
|
network,
|
20365
|
-
theme = "light",
|
20401
|
+
theme: theme2 = "light",
|
20366
20402
|
size = 200
|
20367
20403
|
}) => {
|
20368
20404
|
const [qrData, setQrData] = useState("");
|
@@ -20470,8 +20506,8 @@ const QRCode = ({
|
|
20470
20506
|
{
|
20471
20507
|
value: qrData,
|
20472
20508
|
size,
|
20473
|
-
bgColor:
|
20474
|
-
fgColor:
|
20509
|
+
bgColor: theme2 === "dark" ? "#374151" : "#FFFFFF",
|
20510
|
+
fgColor: theme2 === "dark" ? "#FFFFFF" : "#000000",
|
20475
20511
|
level: "H",
|
20476
20512
|
includeMargin: true
|
20477
20513
|
}
|
@@ -20551,7 +20587,7 @@ const QRCode = ({
|
|
20551
20587
|
] }) })
|
20552
20588
|
] });
|
20553
20589
|
};
|
20554
|
-
const PaymentStatus = ({ status, message, theme = "light" }) => {
|
20590
|
+
const PaymentStatus = ({ status, message, theme: theme2 = "light" }) => {
|
20555
20591
|
const renderIcon = () => {
|
20556
20592
|
switch (status) {
|
20557
20593
|
case "processing":
|
@@ -20601,24 +20637,24 @@ const PaymentStatus = ({ status, message, theme = "light" }) => {
|
|
20601
20637
|
const getMessageClasses = () => {
|
20602
20638
|
switch (status) {
|
20603
20639
|
case "processing":
|
20604
|
-
return
|
20640
|
+
return theme2 === "dark" ? "text-blue-300" : "text-blue-600";
|
20605
20641
|
case "success":
|
20606
|
-
return
|
20642
|
+
return theme2 === "dark" ? "text-green-300" : "text-green-600";
|
20607
20643
|
case "error":
|
20608
|
-
return
|
20644
|
+
return theme2 === "dark" ? "text-red-300" : "text-red-600";
|
20609
20645
|
default:
|
20610
|
-
return
|
20646
|
+
return theme2 === "dark" ? "text-gray-300" : "text-gray-600";
|
20611
20647
|
}
|
20612
20648
|
};
|
20613
20649
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
|
20614
20650
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: renderIcon() }),
|
20615
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-xl font-bold mb-2 ${
|
20651
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-xl font-bold mb-2 ${theme2 === "dark" ? "text-white" : "text-gray-900"}`, children: getStatusTitle() }),
|
20616
20652
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-center ${getMessageClasses()}`, children: message }),
|
20617
|
-
status === "processing" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mt-4 text-xs ${
|
20618
|
-
status === "success" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mt-4 p-2 rounded ${
|
20653
|
+
status === "processing" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mt-4 text-xs ${theme2 === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "This may take a few moments. Please do not close this window." }),
|
20654
|
+
status === "success" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mt-4 p-2 rounded ${theme2 === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-xs ${theme2 === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Your payment has been successfully processed. You will receive a confirmation shortly." }) })
|
20619
20655
|
] });
|
20620
20656
|
};
|
20621
|
-
const PaymentMethods = ({ onSelect, selected, theme = "light", supportedNetworks = [] }) => {
|
20657
|
+
const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supportedNetworks = [] }) => {
|
20622
20658
|
const [selectedNetwork, setSelectedNetwork] = useState(NETWORK_TYPES.ETHEREUM);
|
20623
20659
|
const [availableWallets, setAvailableWallets] = useState({});
|
20624
20660
|
const [showMore, setShowMore] = useState(false);
|
@@ -20845,15 +20881,15 @@ const PaymentMethods = ({ onSelect, selected, theme = "light", supportedNetworks
|
|
20845
20881
|
return isAvailable ? `${walletNames[wallet]} detected - Ready to pay` : `${walletNames[wallet]} required - Please install to continue`;
|
20846
20882
|
}
|
20847
20883
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
20848
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-lg font-medium mb-4 ${
|
20884
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-lg font-medium mb-4 ${theme2 === "dark" ? "text-white" : "text-gray-800"}`, children: "Select Payment Method" }),
|
20849
20885
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6", children: [
|
20850
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: `block text-sm font-medium mb-2 ${
|
20886
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: `block text-sm font-medium mb-2 ${theme2 === "dark" ? "text-white" : "text-gray-700"}`, children: "Blockchain Network" }),
|
20851
20887
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
20852
20888
|
"select",
|
20853
20889
|
{
|
20854
20890
|
value: selectedNetwork,
|
20855
20891
|
onChange: (e) => handleNetworkChange(e.target.value),
|
20856
|
-
className: `w-full p-3 rounded-lg border transition-colors ${
|
20892
|
+
className: `w-full p-3 rounded-lg border transition-colors ${theme2 === "dark" ? "bg-gray-700 border-gray-600 text-white focus:border-[#7042D2]" : "bg-white border-gray-300 text-gray-900 focus:border-[#7042D2]"} focus:outline-none focus:ring-2 focus:ring-[#7042D2] focus:ring-opacity-50`,
|
20857
20893
|
children: networks.filter((network) => supportedNetworks.length === 0 || supportedNetworks.includes(network.id)).map((network) => /* @__PURE__ */ jsxRuntimeExports.jsxs("option", { value: network.id, children: [
|
20858
20894
|
network.name,
|
20859
20895
|
" - ",
|
@@ -20863,17 +20899,17 @@ const PaymentMethods = ({ onSelect, selected, theme = "light", supportedNetworks
|
|
20863
20899
|
)
|
20864
20900
|
] }),
|
20865
20901
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4", children: [
|
20866
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: `block text-sm font-medium mb-3 ${
|
20902
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: `block text-sm font-medium mb-3 ${theme2 === "dark" ? "text-white" : "text-gray-700"}`, children: "Select Stablecoin" }),
|
20867
20903
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-3 mb-4", children: visibleMethods.map((method) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
20868
20904
|
"button",
|
20869
20905
|
{
|
20870
20906
|
onClick: () => handleSelectPaymentMethod(method),
|
20871
|
-
className: `p-4 rounded-lg transition-all duration-200 border-
|
20872
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex
|
20907
|
+
className: `p-4 rounded-lg transition-all duration-200 border-1 ${(selected == null ? void 0 : selected.currency) === method.id && (selected == null ? void 0 : selected.network) === selectedNetwork ? theme2 === "dark" ? "bg-blue-900/30 border-[#7042D2] ring-2 ring-[#7042D2] ring-opacity-50" : "bg-blue-50 border-[#7042D2] ring-2 ring-[#7042D2] ring-opacity-50" : theme2 === "dark" ? "bg-gray-700 hover:bg-gray-600 border-gray-600 hover:border-gray-500" : "bg-white hover:bg-gray-50 border-gray-200 hover:border-gray-300"}`,
|
20908
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center text-center", children: [
|
20873
20909
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 h-10 w-10 bg-white rounded-full flex items-center justify-center mb-2 shadow-sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: method.logo, alt: method.name, className: "h-6 w-6" }) }),
|
20874
20910
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
20875
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: `font-medium text-sm ${
|
20876
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-xs ${
|
20911
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: `font-medium text-sm ${theme2 === "dark" ? "text-white" : "text-gray-900"}`, children: method.name }),
|
20912
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-xs ${theme2 === "dark" ? "text-gray-300" : "text-gray-500"}`, children: method.description })
|
20877
20913
|
] }),
|
20878
20914
|
(selected == null ? void 0 : selected.currency) === method.id && (selected == null ? void 0 : selected.network) === selectedNetwork && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
20879
20915
|
"svg",
|
@@ -20900,12 +20936,12 @@ const PaymentMethods = ({ onSelect, selected, theme = "light", supportedNetworks
|
|
20900
20936
|
"button",
|
20901
20937
|
{
|
20902
20938
|
onClick: () => setShowMore(!showMore),
|
20903
|
-
className: `w-full py-2 px-4 rounded-lg text-sm font-medium transition-colors ${
|
20939
|
+
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"}`,
|
20904
20940
|
children: showMore ? "Show Less" : `Show More (${availableMethods.length - 4} more)`
|
20905
20941
|
}
|
20906
20942
|
)
|
20907
20943
|
] }),
|
20908
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `p-3 rounded-lg text-sm ${
|
20944
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `p-3 rounded-lg text-sm ${theme2 === "dark" ? "bg-gray-800 text-gray-300" : "bg-gray-50 text-gray-600"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
20909
20945
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-2 h-2 rounded-full mr-2 ${availableWallets[getRequiredWallet(selectedNetwork)] ? "bg-green-500" : "bg-red-500"}` }),
|
20910
20946
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs", children: getNetworkRequirement(selectedNetwork) })
|
20911
20947
|
] }) })
|
@@ -20922,7 +20958,7 @@ const CoinleyModal = ({
|
|
20922
20958
|
onPayment,
|
20923
20959
|
onBack,
|
20924
20960
|
error,
|
20925
|
-
theme = "light",
|
20961
|
+
theme: theme2 = "light",
|
20926
20962
|
merchantName,
|
20927
20963
|
transactionHash,
|
20928
20964
|
walletConnection,
|
@@ -20987,9 +21023,9 @@ const CoinleyModal = ({
|
|
20987
21023
|
};
|
20988
21024
|
if (!isOpen)
|
20989
21025
|
return null;
|
20990
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed inset-0 z-50 overflow-y-auto bg-black/50", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative p-6 w-full max-w-md mx-auto rounded-lg shadow-xl
|
20991
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center mb-6
|
20992
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-bold
|
21026
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed inset-0 z-50 overflow-y-auto bg-black/50", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "coinley-modal relative p-6 w-full max-w-md mx-auto rounded-lg shadow-xl", children: [
|
21027
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "coinley-header flex justify-between items-center mb-6", children: [
|
21028
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-bold", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: logo, className: "w-32", alt: "Coinley Logo" }) }) }),
|
20993
21029
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
20994
21030
|
"button",
|
20995
21031
|
{
|
@@ -20999,25 +21035,41 @@ const CoinleyModal = ({
|
|
20999
21035
|
}
|
21000
21036
|
)
|
21001
21037
|
] }),
|
21002
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "
|
21003
|
-
|
21004
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
21005
|
-
|
21006
|
-
|
21007
|
-
|
21008
|
-
|
21009
|
-
|
21010
|
-
|
21038
|
+
payment && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "coinley-payment-info mb-6", children: [
|
21039
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center mb-4", children: [
|
21040
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-600 mb-1", children: "Total Amount" }),
|
21041
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "coinley-amount-display text-3xl font-bold", children: [
|
21042
|
+
"$",
|
21043
|
+
formatAmount(payment.totalAmount || payment.amount)
|
21044
|
+
] })
|
21045
|
+
] }),
|
21046
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center mb-4", children: [
|
21047
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-600 mb-1", children: "Payment To" }),
|
21048
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "coinley-merchant-name text-lg", children: merchantName })
|
21049
|
+
] }),
|
21050
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4 text-sm", children: [
|
21051
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-white/50 px-3 py-2 rounded-lg", children: [
|
21052
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-gray-600 text-xs", children: "Original Amount" }),
|
21053
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-semibold", children: [
|
21011
21054
|
"$",
|
21012
|
-
formatAmount(payment.
|
21055
|
+
formatAmount(payment.amount)
|
21013
21056
|
] })
|
21014
21057
|
] }),
|
21015
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
21016
|
-
"
|
21017
|
-
|
21018
|
-
|
21019
|
-
|
21058
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-white/50 px-3 py-2 rounded-lg", children: [
|
21059
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-gray-600 text-xs", children: "Fee (1.75%)" }),
|
21060
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-semibold", children: [
|
21061
|
+
"$",
|
21062
|
+
formatAmount((payment.totalAmount || payment.amount) - payment.amount)
|
21063
|
+
] })
|
21064
|
+
] })
|
21020
21065
|
] }),
|
21066
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center mt-3", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-gray-500", children: [
|
21067
|
+
"Payment ID: ",
|
21068
|
+
payment.id ? payment.id.slice(0, 8) : "",
|
21069
|
+
"..."
|
21070
|
+
] }) })
|
21071
|
+
] }),
|
21072
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6", children: [
|
21021
21073
|
debug && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-2 text-right", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21022
21074
|
"button",
|
21023
21075
|
{
|
@@ -21038,7 +21090,7 @@ const CoinleyModal = ({
|
|
21038
21090
|
{
|
21039
21091
|
onSelect: onPaymentMethodSelect,
|
21040
21092
|
selected: selectedPaymentMethod,
|
21041
|
-
theme,
|
21093
|
+
theme: theme2,
|
21042
21094
|
supportedNetworks
|
21043
21095
|
}
|
21044
21096
|
),
|
@@ -21049,7 +21101,7 @@ const CoinleyModal = ({
|
|
21049
21101
|
console.log("Proceed button clicked, calling onPaymentMethodSelect");
|
21050
21102
|
onPaymentMethodSelect(selectedPaymentMethod);
|
21051
21103
|
},
|
21052
|
-
className: "w-full py-3 px-4
|
21104
|
+
className: "coinley-button-primary w-full py-3 px-4 font-medium rounded-lg transition-colors",
|
21053
21105
|
disabled: !selectedPaymentMethod,
|
21054
21106
|
children: [
|
21055
21107
|
"Proceed with ",
|
@@ -21065,15 +21117,15 @@ const CoinleyModal = ({
|
|
21065
21117
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-medium mb-2 text-gray-800", children: "Payment Details" }),
|
21066
21118
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
21067
21119
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21068
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-
|
21120
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Currency:" }),
|
21069
21121
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: selectedPaymentMethod.currency })
|
21070
21122
|
] }),
|
21071
21123
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21072
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-
|
21124
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Network:" }),
|
21073
21125
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: getNetworkDisplayName(selectedPaymentMethod.network) })
|
21074
21126
|
] }),
|
21075
21127
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21076
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-
|
21128
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Fee:" }),
|
21077
21129
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "1.75%" })
|
21078
21130
|
] })
|
21079
21131
|
] })
|
@@ -21083,7 +21135,7 @@ const CoinleyModal = ({
|
|
21083
21135
|
"button",
|
21084
21136
|
{
|
21085
21137
|
onClick: () => setPaymentType("wallet"),
|
21086
|
-
className: `py-2 px-4 text-sm font-medium ${paymentType === "wallet" ? "border-b-2 border-
|
21138
|
+
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"}`,
|
21087
21139
|
children: "Connect Wallet"
|
21088
21140
|
}
|
21089
21141
|
),
|
@@ -21091,7 +21143,7 @@ const CoinleyModal = ({
|
|
21091
21143
|
"button",
|
21092
21144
|
{
|
21093
21145
|
onClick: () => setPaymentType("qrcode"),
|
21094
|
-
className: `py-2 px-4 text-sm font-medium ${paymentType === "qrcode" ? "border-b-2 border-
|
21146
|
+
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"}`,
|
21095
21147
|
children: "QR Code"
|
21096
21148
|
}
|
21097
21149
|
)
|
@@ -21099,7 +21151,7 @@ const CoinleyModal = ({
|
|
21099
21151
|
testMode ? (
|
21100
21152
|
// Test mode payment option
|
21101
21153
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 rounded-lg mb-4 bg-blue-50", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
21102
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-
|
21154
|
+
/* @__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" }) }) }),
|
21103
21155
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21104
21156
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium text-gray-800", children: "Test Mode Payment" }),
|
21105
21157
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-600", children: 'Click "Pay Now" to simulate a successful payment' })
|
@@ -21114,7 +21166,7 @@ const CoinleyModal = ({
|
|
21114
21166
|
amount: payment.totalAmount || payment.amount,
|
21115
21167
|
currency: selectedPaymentMethod.currency,
|
21116
21168
|
network: selectedPaymentMethod.network,
|
21117
|
-
theme
|
21169
|
+
theme: theme2
|
21118
21170
|
}
|
21119
21171
|
) })
|
21120
21172
|
) : (
|
@@ -21161,7 +21213,7 @@ const CoinleyModal = ({
|
|
21161
21213
|
console.log("Connect wallet button clicked for:", walletType);
|
21162
21214
|
onConnectWallet(walletType);
|
21163
21215
|
},
|
21164
|
-
className: "py-2 px-4
|
21216
|
+
className: "coinley-button-primary py-2 px-4 font-medium rounded-md text-sm",
|
21165
21217
|
children: "Connect"
|
21166
21218
|
}
|
21167
21219
|
)
|
@@ -21177,7 +21229,7 @@ const CoinleyModal = ({
|
|
21177
21229
|
href: getWalletInstallUrl(walletType),
|
21178
21230
|
target: "_blank",
|
21179
21231
|
rel: "noopener noreferrer",
|
21180
|
-
className: "text-sm text-
|
21232
|
+
className: "text-sm text-purple-600 hover:underline",
|
21181
21233
|
children: "Install"
|
21182
21234
|
}
|
21183
21235
|
)
|
@@ -21191,7 +21243,7 @@ const CoinleyModal = ({
|
|
21191
21243
|
{
|
21192
21244
|
type: "button",
|
21193
21245
|
onClick: onBack,
|
21194
|
-
className: "w-full py-2 px-4 bg-gray-200 hover:bg-gray-300 text-
|
21246
|
+
className: "w-full py-2 px-4 bg-gray-200 hover:bg-gray-300 text-purple-600 font-medium rounded-md",
|
21195
21247
|
children: "Back"
|
21196
21248
|
}
|
21197
21249
|
),
|
@@ -21200,7 +21252,7 @@ const CoinleyModal = ({
|
|
21200
21252
|
{
|
21201
21253
|
type: "button",
|
21202
21254
|
onClick: () => onPayment(paymentType === "qrcode"),
|
21203
|
-
className: "w-full py-2 px-4
|
21255
|
+
className: "coinley-button-primary w-full py-2 px-4 font-medium rounded-md",
|
21204
21256
|
disabled: !testMode && paymentType === "wallet" && !walletConnection,
|
21205
21257
|
children: paymentType === "qrcode" ? "I have sent the payment" : "Pay Now"
|
21206
21258
|
}
|
@@ -21211,7 +21263,7 @@ const CoinleyModal = ({
|
|
21211
21263
|
PaymentStatus,
|
21212
21264
|
{
|
21213
21265
|
status: "processing",
|
21214
|
-
theme,
|
21266
|
+
theme: theme2,
|
21215
21267
|
message: "Processing your payment..."
|
21216
21268
|
}
|
21217
21269
|
),
|
@@ -21220,7 +21272,7 @@ const CoinleyModal = ({
|
|
21220
21272
|
PaymentStatus,
|
21221
21273
|
{
|
21222
21274
|
status: "success",
|
21223
|
-
theme,
|
21275
|
+
theme: theme2,
|
21224
21276
|
message: "Payment successful!"
|
21225
21277
|
}
|
21226
21278
|
),
|
@@ -21233,7 +21285,7 @@ const CoinleyModal = ({
|
|
21233
21285
|
href: `${getExplorerUrl(selectedPaymentMethod.network)}/${getExplorerPath(selectedPaymentMethod.network)}/${transactionHash}`,
|
21234
21286
|
target: "_blank",
|
21235
21287
|
rel: "noopener noreferrer",
|
21236
|
-
className: "text-xs text-
|
21288
|
+
className: "text-xs text-purple-600 mt-2 inline-block",
|
21237
21289
|
children: "View on Explorer →"
|
21238
21290
|
}
|
21239
21291
|
)
|
@@ -21244,7 +21296,7 @@ const CoinleyModal = ({
|
|
21244
21296
|
PaymentStatus,
|
21245
21297
|
{
|
21246
21298
|
status: "error",
|
21247
|
-
theme,
|
21299
|
+
theme: theme2,
|
21248
21300
|
message: error || "An error occurred while processing your payment."
|
21249
21301
|
}
|
21250
21302
|
),
|
@@ -21261,7 +21313,7 @@ const CoinleyModal = ({
|
|
21261
21313
|
] }),
|
21262
21314
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-xs text-gray-500", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [
|
21263
21315
|
"Powered by ",
|
21264
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-
|
21316
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600", children: "Coinley" }),
|
21265
21317
|
" - Secure Cryptocurrency Payments"
|
21266
21318
|
] }) })
|
21267
21319
|
] }) }) });
|
@@ -21295,7 +21347,7 @@ const CoinleyCheckout = forwardRef(({
|
|
21295
21347
|
onSuccess,
|
21296
21348
|
onError,
|
21297
21349
|
onClose,
|
21298
|
-
theme,
|
21350
|
+
theme: theme2,
|
21299
21351
|
autoOpen = false,
|
21300
21352
|
debug = false,
|
21301
21353
|
testMode = false,
|
@@ -21318,7 +21370,7 @@ const CoinleyCheckout = forwardRef(({
|
|
21318
21370
|
const effectiveApiKey = apiKey || (coinleyContext == null ? void 0 : coinleyContext.apiKey);
|
21319
21371
|
const effectiveApiSecret = apiSecret || (coinleyContext == null ? void 0 : coinleyContext.apiSecret);
|
21320
21372
|
apiUrl || (coinleyContext == null ? void 0 : coinleyContext.apiUrl);
|
21321
|
-
const effectiveTheme =
|
21373
|
+
const effectiveTheme = theme2 || contextTheme;
|
21322
21374
|
const effectiveDebug = debug || (coinleyContext == null ? void 0 : coinleyContext.debug);
|
21323
21375
|
const effectiveSupportedNetworks = supportedNetworks.length > 0 ? supportedNetworks : [NETWORK_TYPES.ETHEREUM, NETWORK_TYPES.BSC, NETWORK_TYPES.TRON, NETWORK_TYPES.ALGORAND];
|
21324
21376
|
const log = (message, data) => {
|