coinley-checkout 0.8.3 → 0.8.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.
@@ -18329,11 +18329,7 @@ const WALLET_TYPES = {
18329
18329
  METAMASK: "metamask",
18330
18330
  TRONLINK: "tronlink",
18331
18331
  TRUST_WALLET: "trustwallet",
18332
- LUTE: "lute",
18333
- PERA: "pera",
18334
- ALGOSIGNER: "algosigner",
18335
- DEFLY: "defly",
18336
- EXODUS: "exodus"
18332
+ LUTE: "lute"
18337
18333
  };
18338
18334
  const NETWORK_TYPES = {
18339
18335
  ETHEREUM: "ethereum",
@@ -18451,59 +18447,59 @@ const NETWORK_WALLET_MAP = {
18451
18447
  [NETWORK_TYPES.ETHEREUM]: [WALLET_TYPES.METAMASK, WALLET_TYPES.TRUST_WALLET],
18452
18448
  [NETWORK_TYPES.BSC]: [WALLET_TYPES.METAMASK, WALLET_TYPES.TRUST_WALLET],
18453
18449
  [NETWORK_TYPES.TRON]: [WALLET_TYPES.TRONLINK],
18454
- [NETWORK_TYPES.ALGORAND]: [WALLET_TYPES.PERA, WALLET_TYPES.ALGOSIGNER, WALLET_TYPES.DEFLY, WALLET_TYPES.LUTE, WALLET_TYPES.EXODUS]
18450
+ [NETWORK_TYPES.ALGORAND]: [WALLET_TYPES.LUTE]
18455
18451
  };
18456
18452
  const getWalletInstallUrl = (walletType) => {
18457
18453
  const urls = {
18458
18454
  [WALLET_TYPES.METAMASK]: "https://metamask.io/download/",
18459
18455
  [WALLET_TYPES.TRONLINK]: "https://www.tronlink.org/download/",
18460
18456
  [WALLET_TYPES.TRUST_WALLET]: "https://trustwallet.com/download/",
18461
- [WALLET_TYPES.LUTE]: "https://lute.app/download/",
18462
- [WALLET_TYPES.PERA]: "https://perawallet.app/",
18463
- [WALLET_TYPES.ALGOSIGNER]: "https://chrome.google.com/webstore/detail/algosigner/kmmolakhbgdlpkjkcjkebenjheonagdm",
18464
- [WALLET_TYPES.DEFLY]: "https://defly.app/",
18465
- [WALLET_TYPES.EXODUS]: "https://www.exodus.com/download/"
18457
+ [WALLET_TYPES.LUTE]: "https://lute.app/download/"
18466
18458
  };
18467
18459
  return urls[walletType] || "";
18468
18460
  };
18469
- const detectAlgorandWallets = () => {
18470
- var _a2, _b, _c, _d, _e, _f;
18461
+ const detectLuteWallet = () => {
18471
18462
  if (typeof window === "undefined")
18472
- return {};
18473
- const algorandWallets = {};
18474
- algorandWallets[WALLET_TYPES.PERA] = Boolean(
18475
- window.PeraWallet || ((_a2 = window.algorand) == null ? void 0 : _a2.pera) || window.pera || document.querySelector('[data-wallet="pera"]')
18476
- );
18477
- algorandWallets[WALLET_TYPES.ALGOSIGNER] = Boolean(window.AlgoSigner);
18478
- algorandWallets[WALLET_TYPES.DEFLY] = Boolean(
18479
- window.DeflyWallet || window.defly || ((_b = window.algorand) == null ? void 0 : _b.defly)
18480
- );
18481
- algorandWallets[WALLET_TYPES.LUTE] = Boolean(
18482
- window.lute || window.luteWallet || ((_c = window.algorand) == null ? void 0 : _c.lute)
18483
- );
18484
- algorandWallets[WALLET_TYPES.EXODUS] = Boolean(
18485
- ((_d = window.exodus) == null ? void 0 : _d.algorand) || window.exodus && window.exodus.algorand
18486
- );
18487
- console.log("=== ALGORAND WALLETS DETECTION ===");
18488
- console.log("Pera (PeraWallet):", Boolean(window.PeraWallet));
18489
- console.log("Pera (algorand.pera):", Boolean((_e = window.algorand) == null ? void 0 : _e.pera));
18490
- console.log("Pera (window.pera):", Boolean(window.pera));
18491
- console.log("AlgoSigner:", Boolean(window.AlgoSigner));
18492
- console.log("Defly (DeflyWallet):", Boolean(window.DeflyWallet));
18493
- console.log("Defly (window.defly):", Boolean(window.defly));
18494
- console.log("Lute (window.lute):", Boolean(window.lute));
18495
- console.log("Exodus Algorand:", Boolean((_f = window.exodus) == null ? void 0 : _f.algorand));
18496
- console.log("Final detection results:", algorandWallets);
18497
- console.log("=== END ALGORAND DETECTION ===");
18498
- return algorandWallets;
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
+ });
18499
18486
  };
18500
18487
  const detectWallets = () => {
18501
- const algorandWallets = detectAlgorandWallets();
18502
- const availableWallets = __spreadValues({
18488
+ const availableWallets = {
18503
18489
  [WALLET_TYPES.METAMASK]: typeof window !== "undefined" && window.ethereum !== void 0 && window.ethereum.isMetaMask,
18504
18490
  [WALLET_TYPES.TRONLINK]: typeof window !== "undefined" && window.tronWeb !== void 0,
18505
- [WALLET_TYPES.TRUST_WALLET]: typeof window !== "undefined" && window.ethereum !== void 0 && window.ethereum.isTrust === true
18506
- }, algorandWallets);
18491
+ [WALLET_TYPES.TRUST_WALLET]: typeof window !== "undefined" && window.ethereum !== void 0 && window.ethereum.isTrust === true,
18492
+ [WALLET_TYPES.LUTE]: detectLuteWallet()
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
+ }
18507
18503
  return availableWallets;
18508
18504
  };
18509
18505
  const detectWalletsWithRetry = (maxRetries = 5, delay = 1e3) => __async(void 0, null, function* () {
@@ -18512,7 +18508,6 @@ const detectWalletsWithRetry = (maxRetries = 5, delay = 1e3) => __async(void 0,
18512
18508
  while (retries < maxRetries) {
18513
18509
  wallets = detectWallets();
18514
18510
  const hasAnyWallet = Object.values(wallets).some((v) => v === true);
18515
- [WALLET_TYPES.PERA, WALLET_TYPES.ALGOSIGNER, WALLET_TYPES.DEFLY, WALLET_TYPES.LUTE, WALLET_TYPES.EXODUS].some((wallet) => wallets[wallet]);
18516
18511
  if (hasAnyWallet || retries >= maxRetries - 1) {
18517
18512
  break;
18518
18513
  }
@@ -18521,19 +18516,16 @@ const detectWalletsWithRetry = (maxRetries = 5, delay = 1e3) => __async(void 0,
18521
18516
  yield new Promise((resolve) => setTimeout(resolve, delay));
18522
18517
  retries++;
18523
18518
  }
18524
- if (!Object.values(wallets).some((v) => v === true)) {
18525
- console.log("Performing extended Algorand wallet detection...");
18519
+ if (!wallets[WALLET_TYPES.LUTE]) {
18520
+ console.log("Performing extended Lute wallet detection...");
18526
18521
  if (typeof window !== "undefined") {
18527
18522
  try {
18528
- const events = ["algorand-wallet-detect", "pera-wallet-detect", "defly-wallet-detect"];
18529
- events.forEach((eventName) => {
18530
- const event = new CustomEvent(eventName, { detail: { source: "coinley-sdk" } });
18531
- window.dispatchEvent(event);
18532
- });
18533
- yield new Promise((resolve) => setTimeout(resolve, 1e3));
18534
- wallets = detectWallets();
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();
18535
18527
  } catch (error) {
18536
- console.warn("Extended Algorand detection failed:", error);
18528
+ console.warn("Extended Lute detection failed:", error);
18537
18529
  }
18538
18530
  }
18539
18531
  }
@@ -18541,17 +18533,13 @@ const detectWalletsWithRetry = (maxRetries = 5, delay = 1e3) => __async(void 0,
18541
18533
  return wallets;
18542
18534
  });
18543
18535
  const debugWalletEnvironment = () => {
18544
- var _a2, _b;
18536
+ var _a2;
18545
18537
  console.log("=== WALLET ENVIRONMENT DEBUG ===");
18546
18538
  console.log("ethereum:", typeof window !== "undefined" ? Boolean(window.ethereum) : "Not in browser");
18547
18539
  console.log("tronWeb:", typeof window !== "undefined" ? Boolean(window.tronWeb) : "Not in browser");
18548
- console.log("=== ALGORAND WALLETS ===");
18549
- console.log("PeraWallet:", typeof window !== "undefined" ? Boolean(window.PeraWallet) : "Not in browser");
18550
- console.log("AlgoSigner:", typeof window !== "undefined" ? Boolean(window.AlgoSigner) : "Not in browser");
18551
- console.log("DeflyWallet:", typeof window !== "undefined" ? Boolean(window.DeflyWallet) : "Not in browser");
18552
18540
  console.log("lute:", typeof window !== "undefined" ? Boolean(window.lute) : "Not in browser");
18553
- console.log("exodus.algorand:", typeof window !== "undefined" ? Boolean((_a2 = window.exodus) == null ? void 0 : _a2.algorand) : "Not in browser");
18554
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");
18555
18543
  if (typeof window !== "undefined" && window.ethereum) {
18556
18544
  console.log("ethereum details:", {
18557
18545
  isTrust: window.ethereum.isTrust,
@@ -18562,14 +18550,14 @@ const debugWalletEnvironment = () => {
18562
18550
  if (typeof window !== "undefined" && window.tronWeb) {
18563
18551
  console.log("tronWeb details:", {
18564
18552
  ready: window.tronWeb.ready,
18565
- fullNode: (_b = window.tronWeb.fullNode) == null ? void 0 : _b.host,
18553
+ fullNode: (_a2 = window.tronWeb.fullNode) == null ? void 0 : _a2.host,
18566
18554
  defaultAddress: window.tronWeb.defaultAddress
18567
18555
  });
18568
18556
  }
18569
18557
  if (typeof window !== "undefined") {
18570
18558
  console.log("All window wallet properties:");
18571
18559
  const walletProps = Object.keys(window).filter(
18572
- (key) => key.toLowerCase().includes("lute") || key.toLowerCase().includes("algo") || key.toLowerCase().includes("pera") || key.toLowerCase().includes("defly") || key.toLowerCase().includes("wallet")
18560
+ (key) => key.toLowerCase().includes("lute") || key.toLowerCase().includes("algo") || key.toLowerCase().includes("wallet")
18573
18561
  );
18574
18562
  console.log("Potential wallet properties:", walletProps);
18575
18563
  }
@@ -18695,117 +18683,58 @@ const connectTronlinkWallet = () => __async(void 0, null, function* () {
18695
18683
  throw error;
18696
18684
  }
18697
18685
  });
18698
- const connectAlgorandWallet = (walletType) => __async(void 0, null, function* () {
18699
- var _a2, _b, _c, _d, _e;
18700
- console.log(`Connecting to ${walletType} wallet...`);
18686
+ const connectLuteWallet = () => __async(void 0, null, function* () {
18687
+ var _a2;
18688
+ console.log("Connecting to Lute wallet...");
18701
18689
  let walletProvider = null;
18702
18690
  let walletName = "";
18703
- switch (walletType) {
18704
- case WALLET_TYPES.PERA:
18705
- if (window.PeraWallet) {
18706
- walletProvider = window.PeraWallet;
18707
- walletName = "Pera Wallet";
18708
- } else if ((_a2 = window.algorand) == null ? void 0 : _a2.pera) {
18709
- walletProvider = window.algorand.pera;
18710
- walletName = "Pera Wallet (algorand.pera)";
18711
- } else if (window.pera) {
18712
- walletProvider = window.pera;
18713
- walletName = "Pera Wallet (window.pera)";
18714
- }
18715
- break;
18716
- case WALLET_TYPES.ALGOSIGNER:
18717
- if (window.AlgoSigner) {
18718
- walletProvider = window.AlgoSigner;
18719
- walletName = "AlgoSigner";
18720
- }
18721
- break;
18722
- case WALLET_TYPES.DEFLY:
18723
- if (window.DeflyWallet) {
18724
- walletProvider = window.DeflyWallet;
18725
- walletName = "Defly Wallet";
18726
- } else if (window.defly) {
18727
- walletProvider = window.defly;
18728
- walletName = "Defly Wallet (window.defly)";
18729
- } else if ((_b = window.algorand) == null ? void 0 : _b.defly) {
18730
- walletProvider = window.algorand.defly;
18731
- walletName = "Defly Wallet (algorand.defly)";
18732
- }
18733
- break;
18734
- case WALLET_TYPES.LUTE:
18735
- if (window.lute) {
18736
- walletProvider = window.lute;
18737
- walletName = "Lute Wallet";
18738
- } else if (window.luteWallet) {
18739
- walletProvider = window.luteWallet;
18740
- walletName = "Lute Wallet (luteWallet)";
18741
- } else if ((_c = window.algorand) == null ? void 0 : _c.lute) {
18742
- walletProvider = window.algorand.lute;
18743
- walletName = "Lute Wallet (algorand.lute)";
18744
- }
18745
- break;
18746
- case WALLET_TYPES.EXODUS:
18747
- if ((_d = window.exodus) == null ? void 0 : _d.algorand) {
18748
- walletProvider = window.exodus.algorand;
18749
- walletName = "Exodus Wallet";
18750
- }
18751
- break;
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";
18752
18703
  }
18753
18704
  if (!walletProvider) {
18754
- console.error(`${walletType} wallet not detected.`);
18705
+ console.error("No Algorand wallet detected.");
18755
18706
  console.log("Available window properties:", Object.keys(window).filter(
18756
- (key) => key.toLowerCase().includes("pera") || key.toLowerCase().includes("algo") || key.toLowerCase().includes("defly") || key.toLowerCase().includes("lute") || key.toLowerCase().includes("exodus")
18707
+ (key) => key.toLowerCase().includes("lute") || key.toLowerCase().includes("algo") || key.toLowerCase().includes("wallet")
18757
18708
  ));
18758
- throw new Error(`${walletType} wallet not detected. Please install ${walletName || walletType} or try another Algorand wallet.`);
18709
+ throw new Error("Lute wallet not detected. Please install Lute extension or another Algorand wallet.");
18759
18710
  }
18760
18711
  console.log(`Found ${walletName} wallet provider:`, walletProvider);
18761
18712
  try {
18762
18713
  let address = null;
18763
- if (walletType === WALLET_TYPES.PERA) {
18764
- if (walletProvider.connect) {
18765
- const result = yield walletProvider.connect();
18766
- address = result.address || result[0] || result;
18767
- } else if (walletProvider.enable) {
18768
- const accounts = yield walletProvider.enable();
18769
- address = accounts[0] || accounts;
18770
- }
18771
- } else if (walletType === WALLET_TYPES.ALGOSIGNER) {
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...");
18772
18728
  yield walletProvider.connect();
18773
18729
  const accounts = yield walletProvider.accounts({ ledger: "MainNet" });
18774
- address = (_e = accounts[0]) == null ? void 0 : _e.address;
18775
- } else if (walletType === WALLET_TYPES.DEFLY) {
18776
- if (walletProvider.connect) {
18777
- const result = yield walletProvider.connect();
18778
- address = result.address || result[0] || result;
18779
- } else if (walletProvider.enable) {
18780
- const accounts = yield walletProvider.enable();
18781
- address = accounts[0] || accounts;
18782
- }
18783
- } else if (walletType === WALLET_TYPES.EXODUS) {
18784
- if (walletProvider.connect) {
18785
- const result = yield walletProvider.connect();
18786
- address = result.address || result[0] || result;
18787
- } else if (walletProvider.enable) {
18788
- const accounts = yield walletProvider.enable();
18789
- address = accounts[0] || accounts;
18790
- }
18791
- } else {
18792
- if (walletProvider.connect) {
18793
- const result = yield walletProvider.connect();
18794
- address = result.address || result[0] || result;
18795
- } else if (walletProvider.enable) {
18796
- const accounts = yield walletProvider.enable();
18797
- address = accounts[0] || accounts;
18798
- } else if (walletProvider.requestAccounts) {
18799
- const accounts = yield walletProvider.requestAccounts();
18800
- address = accounts[0];
18801
- }
18730
+ address = (_a2 = accounts[0]) == null ? void 0 : _a2.address;
18802
18731
  }
18803
18732
  if (!address) {
18804
18733
  throw new Error(`No address returned from ${walletName}. Please unlock your wallet and try again.`);
18805
18734
  }
18806
18735
  console.log(`Connected to ${walletName} wallet:`, address);
18807
18736
  return {
18808
- walletType,
18737
+ walletType: WALLET_TYPES.LUTE,
18809
18738
  address,
18810
18739
  provider: walletProvider,
18811
18740
  network: NETWORK_TYPES.ALGORAND,
@@ -18832,12 +18761,8 @@ const connectWallet = (walletType) => __async(void 0, null, function* () {
18832
18761
  return connectTronlinkWallet();
18833
18762
  case WALLET_TYPES.TRUST_WALLET:
18834
18763
  return connectTrustWallet();
18835
- case WALLET_TYPES.PERA:
18836
- case WALLET_TYPES.ALGOSIGNER:
18837
- case WALLET_TYPES.DEFLY:
18838
18764
  case WALLET_TYPES.LUTE:
18839
- case WALLET_TYPES.EXODUS:
18840
- return connectAlgorandWallet(walletType);
18765
+ return connectLuteWallet();
18841
18766
  default:
18842
18767
  throw new Error(`Unsupported wallet type: ${walletType}`);
18843
18768
  }
@@ -18975,11 +18900,7 @@ const sendTokenTransaction = (walletConnection, tokenConfig, toAddress, amount)
18975
18900
  switch (walletConnection.walletType) {
18976
18901
  case WALLET_TYPES.TRONLINK:
18977
18902
  return sendTRC20Transaction(walletConnection, tokenConfig, toAddress, amount);
18978
- case WALLET_TYPES.PERA:
18979
- case WALLET_TYPES.ALGOSIGNER:
18980
- case WALLET_TYPES.DEFLY:
18981
18903
  case WALLET_TYPES.LUTE:
18982
- case WALLET_TYPES.EXODUS:
18983
18904
  return sendAlgorandAssetTransaction(walletConnection, tokenConfig, toAddress, amount);
18984
18905
  default:
18985
18906
  return sendERC20Transaction(walletConnection, tokenConfig, toAddress, amount);
@@ -21830,65 +21751,46 @@ const CoinleyCheckout = forwardRef(({
21830
21751
  }
21831
21752
  };
21832
21753
  }, [checkingInterval]);
21833
- useEffect(() => {
21834
- if (transactionHash && pendingBackendConfirmation && paymentStatus === "loading") {
21835
- const interval = setInterval(() => __async(void 0, null, function* () {
21836
- try {
21837
- log("Checking payment status with backend...");
21838
- const processResponse = yield processPayment({
21839
- paymentId: payment.id,
21840
- transactionHash,
21841
- network: selectedPaymentMethod.network,
21842
- currency: selectedPaymentMethod.currency,
21843
- senderAddress: walletConnection == null ? void 0 : walletConnection.address,
21844
- confirmations,
21845
- check: true
21846
- // Just check status, don't process again
21847
- });
21848
- if (processResponse.status === "success") {
21849
- log("Payment confirmed by backend!");
21850
- clearInterval(interval);
21851
- setCheckingInterval(null);
21852
- setPendingBackendConfirmation(false);
21853
- setPaymentStatus("success");
21854
- }
21855
- } catch (err) {
21856
- log("Error checking payment status:", err);
21857
- }
21858
- }), 1e4);
21859
- setCheckingInterval(interval);
21860
- return () => {
21861
- clearInterval(interval);
21862
- };
21863
- }
21864
- }, [transactionHash, pendingBackendConfirmation, paymentStatus, payment, selectedPaymentMethod, walletConnection, confirmations]);
21865
21754
  const processBackendConfirmation = () => __async(void 0, null, function* () {
21866
21755
  if (!payment || !selectedPaymentMethod || !transactionHash) {
21756
+ log("Missing required data for backend confirmation:", {
21757
+ hasPayment: !!payment,
21758
+ hasPaymentMethod: !!selectedPaymentMethod,
21759
+ hasTransactionHash: !!transactionHash
21760
+ });
21867
21761
  return;
21868
21762
  }
21869
21763
  try {
21870
- log("Processing payment with backend...");
21764
+ log("Processing payment with backend...", {
21765
+ paymentId: payment.id,
21766
+ transactionHash,
21767
+ network: selectedPaymentMethod.network,
21768
+ currency: selectedPaymentMethod.currency
21769
+ });
21871
21770
  const processResponse = yield processPayment({
21872
21771
  paymentId: payment.id,
21873
21772
  transactionHash,
21874
21773
  network: selectedPaymentMethod.network,
21875
- currency: selectedPaymentMethod.currency,
21876
- senderAddress: walletConnection == null ? void 0 : walletConnection.address,
21877
- confirmations
21774
+ senderAddress: walletConnection == null ? void 0 : walletConnection.address
21878
21775
  });
21879
- log("Payment processed successfully:", processResponse);
21776
+ log("Payment processed successfully with backend:", processResponse);
21880
21777
  setPendingBackendConfirmation(false);
21778
+ setPaymentStatus("success");
21881
21779
  if (onSuccess) {
21882
21780
  log("Calling onSuccess callback...");
21883
21781
  onSuccess(payment.id, transactionHash, {
21884
21782
  network: selectedPaymentMethod.network,
21885
21783
  currency: selectedPaymentMethod.currency,
21886
- amount: payment.totalAmount || payment.amount
21784
+ amount: payment.totalAmount || payment.amount,
21785
+ processResponse
21887
21786
  });
21888
21787
  }
21889
21788
  } catch (processError) {
21890
- log("Payment processing initial attempt failed, will retry in background:", processError);
21789
+ log("Payment processing failed:", processError);
21891
21790
  setPendingBackendConfirmation(true);
21791
+ setTimeout(() => {
21792
+ processBackendConfirmation();
21793
+ }, 1e4);
21892
21794
  }
21893
21795
  });
21894
21796
  useImperativeHandle(ref, () => ({
@@ -22054,6 +21956,7 @@ const CoinleyCheckout = forwardRef(({
22054
21956
  log("Transaction hash obtained:", txHash);
22055
21957
  setTransactionHash(txHash);
22056
21958
  setStep("success");
21959
+ setPaymentStatus("success");
22057
21960
  processBackendConfirmation();
22058
21961
  } catch (err) {
22059
21962
  log("Payment error:", err);