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