coinley-checkout 0.1.5 → 0.1.6

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,4 +1,5 @@
1
- import require$$0, { createContext, useContext, useState, useEffect, lazy, forwardRef, useImperativeHandle } from "react";
1
+ import require$$0, { createContext, useContext, useState, useEffect, forwardRef, useImperativeHandle } from "react";
2
+ const styles = "";
2
3
  var jsxRuntime = { exports: {} };
3
4
  var reactJsxRuntime_production_min = {};
4
5
  /**
@@ -1146,163 +1147,58 @@ const CoinleyProvider = ({
1146
1147
  };
1147
1148
  return /* @__PURE__ */ jsxRuntimeExports.jsx(CoinleyContext.Provider, { value, children });
1148
1149
  };
1149
- const isMetaMaskInstalled = () => {
1150
- return typeof window !== "undefined" && typeof window.ethereum !== "undefined";
1151
- };
1152
- const connectWallet = async () => {
1153
- if (!isMetaMaskInstalled()) {
1154
- throw new Error("MetaMask is not installed");
1155
- }
1156
- try {
1157
- const accounts = await window.ethereum.request({ method: "eth_requestAccounts" });
1158
- return accounts;
1159
- } catch (error) {
1160
- console.error("Error connecting to wallet:", error);
1161
- throw error;
1162
- }
1163
- };
1164
- const getAccounts = async () => {
1165
- if (!isMetaMaskInstalled()) {
1166
- throw new Error("MetaMask is not installed");
1167
- }
1168
- try {
1169
- const accounts = await window.ethereum.request({ method: "eth_accounts" });
1170
- return accounts;
1171
- } catch (error) {
1172
- console.error("Error getting accounts:", error);
1173
- throw error;
1174
- }
1175
- };
1176
- const getChainId = async () => {
1177
- if (!isMetaMaskInstalled()) {
1178
- throw new Error("MetaMask is not installed");
1179
- }
1180
- try {
1181
- const chainId = await window.ethereum.request({ method: "eth_chainId" });
1182
- return chainId;
1183
- } catch (error) {
1184
- console.error("Error getting chain ID:", error);
1185
- throw error;
1186
- }
1187
- };
1188
- const sendTransaction = async (txParams) => {
1189
- if (!isMetaMaskInstalled()) {
1190
- throw new Error("MetaMask is not installed");
1191
- }
1192
- try {
1193
- const txHash = await window.ethereum.request({
1194
- method: "eth_sendTransaction",
1195
- params: [txParams]
1196
- });
1197
- return txHash;
1198
- } catch (error) {
1199
- console.error("Error sending transaction:", error);
1200
- throw error;
1201
- }
1202
- };
1203
- const sendToken = async (tokenAddress, toAddress, amount) => {
1204
- if (!isMetaMaskInstalled()) {
1205
- throw new Error("MetaMask is not installed");
1206
- }
1207
- try {
1208
- const accounts = await window.ethereum.request({ method: "eth_requestAccounts" });
1209
- const fromAddress = accounts[0];
1210
- const transferFunctionSignature = "0xa9059cbb";
1211
- const paddedToAddress = toAddress.slice(2).padStart(64, "0");
1212
- const paddedAmount = amount.toString(16).padStart(64, "0");
1213
- const data = `${transferFunctionSignature}${paddedToAddress}${paddedAmount}`;
1214
- const txParams = {
1215
- from: fromAddress,
1216
- to: tokenAddress,
1217
- data
1218
- };
1219
- const txHash = await window.ethereum.request({
1220
- method: "eth_sendTransaction",
1221
- params: [txParams]
1222
- });
1223
- return txHash;
1224
- } catch (error) {
1225
- console.error("Error sending token:", error);
1226
- throw error;
1227
- }
1228
- };
1229
- const isWalletConnected = async () => {
1230
- try {
1231
- const accounts = await getAccounts();
1232
- return accounts.length > 0;
1233
- } catch (error) {
1234
- return false;
1235
- }
1236
- };
1237
- const getNetworkName = (chainId) => {
1238
- const networks = {
1239
- "0x1": "Ethereum Mainnet",
1240
- "0x3": "Ropsten Testnet",
1241
- "0x4": "Rinkeby Testnet",
1242
- "0x5": "Goerli Testnet",
1243
- "0x2a": "Kovan Testnet",
1244
- "0x38": "Binance Smart Chain",
1245
- "0x89": "Polygon",
1246
- "0xa86a": "Avalanche"
1247
- };
1248
- return networks[chainId] || `Unknown Network (${chainId})`;
1249
- };
1250
- const getTokenBalance = async (tokenAddress, userAddress) => {
1251
- if (!isMetaMaskInstalled()) {
1252
- throw new Error("MetaMask is not installed");
1253
- }
1254
- try {
1255
- const balanceOfSignature = "0x70a08231";
1256
- const paddedAddress = userAddress.slice(2).padStart(64, "0");
1257
- const data = `${balanceOfSignature}${paddedAddress}`;
1258
- const balance = await window.ethereum.request({
1259
- method: "eth_call",
1260
- params: [
1261
- {
1262
- to: tokenAddress,
1263
- data
1264
- },
1265
- "latest"
1150
+ const QRCode = ({ walletAddress, amount, currency, theme = "light" }) => {
1151
+ const qrPlaceholder = /* @__PURE__ */ jsxRuntimeExports.jsxs(
1152
+ "div",
1153
+ {
1154
+ style: {
1155
+ width: "200px",
1156
+ height: "200px",
1157
+ backgroundColor: theme === "dark" ? "#374151" : "#f3f4f6",
1158
+ display: "flex",
1159
+ alignItems: "center",
1160
+ justifyContent: "center",
1161
+ color: theme === "dark" ? "white" : "black",
1162
+ fontWeight: "bold",
1163
+ border: `1px solid ${theme === "dark" ? "#4b5563" : "#e5e7eb"}`,
1164
+ margin: "0 auto"
1165
+ },
1166
+ children: [
1167
+ currency,
1168
+ " Payment QR"
1266
1169
  ]
1267
- });
1268
- return parseInt(balance, 16).toString();
1269
- } catch (error) {
1270
- console.error("Error getting token balance:", error);
1271
- throw error;
1272
- }
1273
- };
1274
- const TOKEN_ADDRESSES = {
1275
- USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
1276
- USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
1277
- DAI: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
1278
- WETH: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
1279
- WBTC: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"
1280
- };
1281
- const QRCode$1 = ({ walletAddress, amount, currency, theme = "light" }) => {
1170
+ }
1171
+ );
1282
1172
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center", children: [
1283
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `p-4 rounded-lg ${theme === "dark" ? "bg-gray-700" : "bg-white"} mb-3`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { width: "200px", height: "200px", backgroundColor: "#f0f0f0", display: "flex", alignItems: "center", justifyContent: "center" }, children: [
1284
- "QR Code: ",
1285
- currency
1286
- ] }) }),
1287
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-sm", children: "Scan with your wallet app to pay" }),
1173
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `p-4 rounded-lg ${theme === "dark" ? "bg-gray-700" : "bg-white"} mb-3`, children: qrPlaceholder }),
1174
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `text-center text-sm ${theme === "dark" ? "text-gray-300" : "text-gray-700"}`, children: "Scan with your wallet app to pay" }),
1288
1175
  walletAddress && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-3 w-full", children: [
1289
- /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-xs mb-1", children: [
1176
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: `text-xs ${theme === "dark" ? "text-gray-400" : "text-gray-500"} mb-1`, children: [
1290
1177
  "Send ",
1291
1178
  amount,
1292
1179
  " ",
1293
1180
  currency,
1294
1181
  " to:"
1295
1182
  ] }),
1296
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs font-mono p-2 rounded overflow-auto break-all bg-gray-100", children: walletAddress })
1297
- ] })
1183
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `text-xs font-mono p-2 rounded overflow-auto break-all ${theme === "dark" ? "bg-gray-800 text-gray-300" : "bg-gray-100 text-gray-700"}`, children: walletAddress })
1184
+ ] }),
1185
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `p-3 rounded ${theme === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: [
1186
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: `text-sm font-medium mb-2 ${theme === "dark" ? "text-white" : "text-gray-800"}`, children: "Payment Instructions" }),
1187
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("ol", { className: `text-xs space-y-2 ${theme === "dark" ? "text-gray-300" : "text-gray-600"}`, children: [
1188
+ /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: "1. Open your crypto wallet app" }),
1189
+ /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: "2. Scan the QR code above" }),
1190
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
1191
+ "3. Send ",
1192
+ amount,
1193
+ " ",
1194
+ currency
1195
+ ] }),
1196
+ /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: '4. Click "Pay Now" button after sending' })
1197
+ ] })
1198
+ ] }) })
1298
1199
  ] });
1299
1200
  };
1300
- const QRCode$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1301
- __proto__: null,
1302
- default: QRCode$1
1303
- }, Symbol.toStringTag, { value: "Module" }));
1304
- const PaymentStatus = ({ status, theme = "light", message }) => {
1305
- console.log("PaymentStatus render:", { status, message });
1201
+ const PaymentStatus = ({ status, message, theme = "light" }) => {
1306
1202
  const renderIcon = () => {
1307
1203
  switch (status) {
1308
1204
  case "processing":
@@ -1370,7 +1266,6 @@ const PaymentStatus = ({ status, theme = "light", message }) => {
1370
1266
  ] });
1371
1267
  };
1372
1268
  const PaymentMethods = ({ onSelect, selected, theme = "light" }) => {
1373
- console.log("PaymentMethods render:", { selected });
1374
1269
  const paymentMethods = [
1375
1270
  {
1376
1271
  id: "USDT",
@@ -1395,16 +1290,9 @@ const PaymentMethods = ({ onSelect, selected, theme = "light" }) => {
1395
1290
  name: "SOL",
1396
1291
  description: "Solana",
1397
1292
  logo: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiI+PGcgZmlsbD0ibm9uZSI+PGNpcmNsZSBjeD0iMTYiIGN5PSIxNiIgcj0iMTYiIGZpbGw9IiM0MDNCODIiLz48cGF0aCBkPSJNMTIuNDQgMTAu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jAyLjMuMTguMy4xOHoiIGZpbGw9IiNmZmYiLz48L2c+PC9zdmc+"
1398
- },
1399
- {
1400
- id: "USDC_SOL",
1401
- name: "USDC (Solana)",
1402
- description: "USD Coin on Solana",
1403
- logo: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzJCNzVFRCIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yMS4yMDkgOS43MzlsLTIuOTQxIDIuOTQxYTMuMTMyIDMuMTMyIDAgMDAtNC41MzYgMGwtMi45NDItMi45NDFhNy42MjMgNy42MjMgMCAwMTEwLjQxOSAwek0xMC43OTEgMjIuMjYxbDIuOTQxLTIuOTQxYTMuMTMyIDMuMTMyIDAgMDA0LjUzNiAwbDIuOTQyIDIuOTQxYTcuNjIzIDcuNjIzIDAgMDEtMTAuNDE5IDB6bTExLjU3NS00LjI2MWgtNC4xNTNhMy4xMzMgMy4xMzMgMCAwMDAtNC41MzdoNC4xNTNhNy42MjEgNy42MjEgMCAwMTAgNC41Mzd6bS0xMy43OTMtNC41MzdoNC4xNTNhMy4xMzMgMy4xMzMgMCAwMDAgNC41MzdIOS42ODZhNy42MjEgNy42MjEgMCAwMTAtNC41Mzd6Ii8+PC9nPjwvc3ZnPg=="
1404
1293
  }
1405
1294
  ];
1406
1295
  const handleSelectPaymentMethod = (id) => {
1407
- console.log("Method selected:", id);
1408
1296
  onSelect(id);
1409
1297
  };
1410
1298
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
@@ -1443,8 +1331,139 @@ const PaymentMethods = ({ onSelect, selected, theme = "light" }) => {
1443
1331
  )) })
1444
1332
  ] });
1445
1333
  };
1334
+ const isMetaMaskInstalled = () => {
1335
+ return typeof window !== "undefined" && typeof window.ethereum !== "undefined";
1336
+ };
1337
+ const connectWallet = async () => {
1338
+ if (!isMetaMaskInstalled()) {
1339
+ throw new Error("MetaMask is not installed");
1340
+ }
1341
+ try {
1342
+ const accounts = await window.ethereum.request({ method: "eth_requestAccounts" });
1343
+ return accounts;
1344
+ } catch (error) {
1345
+ console.error("Error connecting to wallet:", error);
1346
+ throw error;
1347
+ }
1348
+ };
1349
+ const getAccounts = async () => {
1350
+ if (!isMetaMaskInstalled()) {
1351
+ throw new Error("MetaMask is not installed");
1352
+ }
1353
+ try {
1354
+ const accounts = await window.ethereum.request({ method: "eth_accounts" });
1355
+ return accounts;
1356
+ } catch (error) {
1357
+ console.error("Error getting accounts:", error);
1358
+ throw error;
1359
+ }
1360
+ };
1361
+ const getChainId = async () => {
1362
+ if (!isMetaMaskInstalled()) {
1363
+ throw new Error("MetaMask is not installed");
1364
+ }
1365
+ try {
1366
+ const chainId = await window.ethereum.request({ method: "eth_chainId" });
1367
+ return chainId;
1368
+ } catch (error) {
1369
+ console.error("Error getting chain ID:", error);
1370
+ throw error;
1371
+ }
1372
+ };
1373
+ const sendTransaction = async (txParams) => {
1374
+ if (!isMetaMaskInstalled()) {
1375
+ throw new Error("MetaMask is not installed");
1376
+ }
1377
+ try {
1378
+ const txHash = await window.ethereum.request({
1379
+ method: "eth_sendTransaction",
1380
+ params: [txParams]
1381
+ });
1382
+ return txHash;
1383
+ } catch (error) {
1384
+ console.error("Error sending transaction:", error);
1385
+ throw error;
1386
+ }
1387
+ };
1388
+ const sendToken = async (tokenAddress, toAddress, amount) => {
1389
+ if (!isMetaMaskInstalled()) {
1390
+ throw new Error("MetaMask is not installed");
1391
+ }
1392
+ try {
1393
+ const accounts = await window.ethereum.request({ method: "eth_requestAccounts" });
1394
+ const fromAddress = accounts[0];
1395
+ const transferFunctionSignature = "0xa9059cbb";
1396
+ const paddedToAddress = toAddress.slice(2).padStart(64, "0");
1397
+ const paddedAmount = amount.toString(16).padStart(64, "0");
1398
+ const data = `${transferFunctionSignature}${paddedToAddress}${paddedAmount}`;
1399
+ const txParams = {
1400
+ from: fromAddress,
1401
+ to: tokenAddress,
1402
+ data
1403
+ };
1404
+ const txHash = await window.ethereum.request({
1405
+ method: "eth_sendTransaction",
1406
+ params: [txParams]
1407
+ });
1408
+ return txHash;
1409
+ } catch (error) {
1410
+ console.error("Error sending token:", error);
1411
+ throw error;
1412
+ }
1413
+ };
1414
+ const isWalletConnected = async () => {
1415
+ try {
1416
+ const accounts = await getAccounts();
1417
+ return accounts.length > 0;
1418
+ } catch (error) {
1419
+ return false;
1420
+ }
1421
+ };
1422
+ const getNetworkName = (chainId) => {
1423
+ const networks = {
1424
+ "0x1": "Ethereum Mainnet",
1425
+ "0x3": "Ropsten Testnet",
1426
+ "0x4": "Rinkeby Testnet",
1427
+ "0x5": "Goerli Testnet",
1428
+ "0x2a": "Kovan Testnet",
1429
+ "0x38": "Binance Smart Chain",
1430
+ "0x89": "Polygon",
1431
+ "0xa86a": "Avalanche"
1432
+ };
1433
+ return networks[chainId] || `Unknown Network (${chainId})`;
1434
+ };
1435
+ const getTokenBalance = async (tokenAddress, userAddress) => {
1436
+ if (!isMetaMaskInstalled()) {
1437
+ throw new Error("MetaMask is not installed");
1438
+ }
1439
+ try {
1440
+ const balanceOfSignature = "0x70a08231";
1441
+ const paddedAddress = userAddress.slice(2).padStart(64, "0");
1442
+ const data = `${balanceOfSignature}${paddedAddress}`;
1443
+ const balance = await window.ethereum.request({
1444
+ method: "eth_call",
1445
+ params: [
1446
+ {
1447
+ to: tokenAddress,
1448
+ data
1449
+ },
1450
+ "latest"
1451
+ ]
1452
+ });
1453
+ return parseInt(balance, 16).toString();
1454
+ } catch (error) {
1455
+ console.error("Error getting token balance:", error);
1456
+ throw error;
1457
+ }
1458
+ };
1459
+ const TOKEN_ADDRESSES = {
1460
+ USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
1461
+ USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
1462
+ DAI: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
1463
+ WETH: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
1464
+ WBTC: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"
1465
+ };
1446
1466
  const Logo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAcCAYAAACqAXueAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAiaSURBVHgB7VrdddNIFL4zNuDAw2orQDQATgUoUABQAU4FOGcLiF0BpoI4FcQ0QLQVxAHOvqLtwDyQOBBr9rszI2n058jeBEhOvnNkS6M7o7m6c39HRA3Qf/bxLR+l9uDIR/sXHD26trjTJeoMiO6/pEuCEBuHOBQfZuxfB9mQjpnv958d9/O9W2/w6+N4StcSHV+INoQhdoVQB7ju0Q1DUwFbiN1Cw6Wt+l+EHg4vu5TXdKHWIydgmFyv//xjWWhCzOyZB5pA0xo63zSrf0vjQNvZhNPvjTB/Gf9NNwx5DZZyQIoOSn5VOYxLaRaAUkHaFotpcgqhdmG6j7Aq4LNbXfqtMQ+VUts4xkrRDq7HdMOQF3BMkT3zcez1n30yJjmOJymNsv5WyCdZx0XIvzvB59cQ7qHur1SUtP/eYKHOt4lOR3QD0XYvRuGTUX/r+A1Msm9a1ACm9isEPMYFm2kP94zPUsq3/+9H4eaMNVdJTWe7iiG301ro+PgJKHUBEhYixjGPGvRN+uFQeD5bl3l4wbMskvE98Di3vrmDMWaz8thaGcJmc1r67ICW8unOxZ1jHfL07dJ9Fb8iobXQErGpJTxUDe15kX6kfa1sHTiNEO6TMa2MTsARLRmm3YfwPLC27o/jOB5WMSnlxhuY2QHlgiZh/zcijIu+J8NiP7R/SZ+iOltmMcz7dh5o4+vONq73yvPSY09g4ndWE/QqfM67oD3M5rixs8zaCHGGeYqXhlaFpSgaWjeleAFGKdM+0dodfXiCQdU7HO/to94ZQ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UVORK5CYII=";
1447
- const QRCode = lazy(() => Promise.resolve().then(() => QRCode$2));
1448
1467
  const CoinleyModal = ({
1449
1468
  isOpen,
1450
1469
  onClose,
@@ -1545,7 +1564,7 @@ const CoinleyModal = ({
1545
1564
  ] }),
1546
1565
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs mt-1 text-right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: `${theme === "dark" ? "text-gray-400" : "text-gray-500"}`, children: [
1547
1566
  "Payment ID: ",
1548
- payment.id.slice(0, 8),
1567
+ payment.id && payment.id.slice(0, 8),
1549
1568
  "..."
1550
1569
  ] }) })
1551
1570
  ] }),
@@ -1781,32 +1800,34 @@ const CoinleyCheckout = forwardRef(({
1781
1800
  }
1782
1801
  };
1783
1802
  useEffect(() => {
1784
- const checkWalletConnection = async () => {
1785
- if (isMetaMaskInstalled()) {
1786
- try {
1787
- const accounts = await window.ethereum.request({ method: "eth_accounts" });
1788
- setWalletConnected(accounts && accounts.length > 0);
1789
- } catch (err) {
1790
- log("Error checking wallet connection:", err);
1803
+ if (typeof window !== "undefined") {
1804
+ const checkWalletConnection = async () => {
1805
+ if (isMetaMaskInstalled()) {
1806
+ try {
1807
+ const accounts = await window.ethereum.request({ method: "eth_accounts" });
1808
+ setWalletConnected(accounts && accounts.length > 0);
1809
+ } catch (err) {
1810
+ log("Error checking wallet connection:", err);
1811
+ setWalletConnected(false);
1812
+ }
1813
+ } else {
1791
1814
  setWalletConnected(false);
1792
1815
  }
1793
- } else {
1794
- setWalletConnected(false);
1795
- }
1796
- };
1797
- checkWalletConnection();
1798
- }, []);
1816
+ };
1817
+ checkWalletConnection();
1818
+ }
1819
+ }, [effectiveDebug]);
1799
1820
  useEffect(() => {
1800
- const handleAccountsChanged = (accounts) => {
1801
- setWalletConnected(accounts.length > 0);
1802
- };
1803
1821
  if (typeof window !== "undefined" && window.ethereum) {
1822
+ const handleAccountsChanged = (accounts) => {
1823
+ setWalletConnected(accounts.length > 0);
1824
+ };
1804
1825
  window.ethereum.on("accountsChanged", handleAccountsChanged);
1826
+ return () => {
1827
+ window.ethereum.removeListener("accountsChanged", handleAccountsChanged);
1828
+ };
1805
1829
  }
1806
1830
  return () => {
1807
- if (typeof window !== "undefined" && window.ethereum) {
1808
- window.ethereum.removeListener("accountsChanged", handleAccountsChanged);
1809
- }
1810
1831
  };
1811
1832
  }, []);
1812
1833
  const handleOpen = async (paymentDetails) => {
@@ -1952,14 +1973,13 @@ const CoinleyCheckout = forwardRef(({
1952
1973
  ) });
1953
1974
  });
1954
1975
  CoinleyCheckout.displayName = "CoinleyCheckout";
1955
- const styles = "";
1956
1976
  const DEFAULT_CONFIG = {
1957
1977
  apiUrl: "https://coinleyserver-production.up.railway.app",
1958
1978
  debug: false,
1959
1979
  testMode: false,
1960
1980
  theme: "light"
1961
1981
  };
1962
- const VERSION = "1.0.4";
1982
+ const VERSION = "1.0.6";
1963
1983
  export {
1964
1984
  CoinleyCheckout,
1965
1985
  CoinleyModal,
@@ -1967,7 +1987,7 @@ export {
1967
1987
  DEFAULT_CONFIG,
1968
1988
  PaymentMethods,
1969
1989
  PaymentStatus,
1970
- QRCode$1 as QRCode,
1990
+ QRCode,
1971
1991
  TOKEN_ADDRESSES,
1972
1992
  ThemeProvider,
1973
1993
  VERSION,