coinley-pay 0.60.0 → 0.62.0

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.
@@ -6,7 +6,7 @@ import { useState, useRef, useEffect, useCallback, useMemo } from "react";
6
6
  import ReactDOM, { createPortal } from "react-dom";
7
7
  import { useConnect, useAccount, useSwitchChain, useSendTransaction, useWaitForTransactionReceipt, WagmiProvider, useDisconnect } from "wagmi";
8
8
  import { QueryClientProvider, QueryClient } from "@tanstack/react-query";
9
- import { s as sdkAnalytics, c as clarityAnalytics, d as dist, a as Buffer2, B as Buffer$1, g as getCurrencyInfo, p as prefetchRates, i as isSupportedCurrency, b as convertToUSD, f as formatCurrency } from "./index-bVSNOcZr.js";
9
+ import { s as sdkAnalytics, c as clarityAnalytics, d as dist, a as Buffer2, B as Buffer$1, g as getCurrencyInfo, p as prefetchRates, i as isSupportedCurrency, b as convertToUSD, f as formatCurrency } from "./index-EVIUXV4Y.js";
10
10
  import { createConfig, fallback, http, getAccount as getAccount$1, getWalletClient, simulateContract, writeContract, readContract, waitForTransactionReceipt, estimateFeesPerGas as estimateFeesPerGas$1 } from "@wagmi/core";
11
11
  import { injected, metaMask, coinbaseWallet, walletConnect } from "@wagmi/connectors";
12
12
  import { defineChain as defineChain$1, erc20Abi, http as http$1, createPublicClient, fallback as fallback$1 } from "viem";
@@ -21126,7 +21126,7 @@ const WalletSelector = ({
21126
21126
  try {
21127
21127
  setAppKitError(null);
21128
21128
  setWalletConnectAddress(solanaAccountState.address);
21129
- const { createWalletConnectAdapter } = await import("./appKitSolana-BeXOnse3.js");
21129
+ const { createWalletConnectAdapter } = await import("./appKitSolana-Qc2Ml_-f.js");
21130
21130
  const adapter = createWalletConnectAdapter(solanaAccountState.address);
21131
21131
  await solanaWallet.connectWalletConnect(adapter, solanaAccountState.address);
21132
21132
  console.log("✅ WalletConnect synced with SDK");
@@ -21231,7 +21231,7 @@ const WalletSelector = ({
21231
21231
  setAppKitLoading(true);
21232
21232
  setAppKitError(null);
21233
21233
  try {
21234
- const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-rZ-uPbNm.js");
21234
+ const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-Dsu3B87G.js");
21235
21235
  await initializeAppKitEVM(wagmiConfig);
21236
21236
  await openAppKitModal();
21237
21237
  } catch (error) {
@@ -21251,7 +21251,7 @@ const WalletSelector = ({
21251
21251
  setAppKitError(null);
21252
21252
  try {
21253
21253
  console.log("📦 Loading AppKit Solana module...");
21254
- const { initializeAppKitSolana } = await import("./appKitSolana-BeXOnse3.js");
21254
+ const { initializeAppKitSolana } = await import("./appKitSolana-Qc2Ml_-f.js");
21255
21255
  console.log("✅ Module loaded, initializing...");
21256
21256
  const modal = await initializeAppKitSolana(solanaWallet);
21257
21257
  console.log("✅ AppKit Solana initialized successfully");
@@ -23128,6 +23128,29 @@ const injectCoinleyFonts = () => {
23128
23128
  `;
23129
23129
  document.head.appendChild(style);
23130
23130
  };
23131
+ const FIVE_MINUTES_MS = 5 * 60 * 1e3;
23132
+ const TEN_MINUTES_MS = 10 * 60 * 1e3;
23133
+ const getRefundPendingGuidance = (elapsedMs = 0) => {
23134
+ if (elapsedMs >= TEN_MINUTES_MS) {
23135
+ return {
23136
+ title: "Refund is taking longer than expected",
23137
+ description: "Your refund is still being processed. You can safely close this window while we continue in the background.",
23138
+ eta: "Most refunds arrive within 15 minutes. If yours does not, check again later or contact support with your payment ID."
23139
+ };
23140
+ }
23141
+ if (elapsedMs >= FIVE_MINUTES_MS) {
23142
+ return {
23143
+ title: "Refund is still being processed",
23144
+ description: "Your refund request has been accepted and is still processing. You do not need to keep this window open.",
23145
+ eta: "Most refunds at this stage arrive within about 10 minutes."
23146
+ };
23147
+ }
23148
+ return {
23149
+ title: "Refund request received",
23150
+ description: "Your refund is being processed automatically. You can safely close this window.",
23151
+ eta: "Most refunds arrive within about 5 minutes."
23152
+ };
23153
+ };
23131
23154
  const CHECKOUT_BUILD = "checkout-2026-04-22b-route-destination-trials";
23132
23155
  const UNDERPAYMENT_RECOVERY_STORAGE_PREFIX = "coinley_underpayment_recovery:";
23133
23156
  const UNDERPAYMENT_RECOVERY_TTL_MS = 2 * 60 * 60 * 1e3;
@@ -23335,6 +23358,7 @@ const CoinleyPaymentInternal = ({
23335
23358
  const [depositQrCode, setDepositQrCode] = useState("");
23336
23359
  const [preferredWallet, setPreferredWallet] = useState("metamask");
23337
23360
  const [qrWalletChoiceConfirmed, setQrWalletChoiceConfirmed] = useState(false);
23361
+ const [qrSelectedWalletId, setQrSelectedWalletId] = useState(null);
23338
23362
  const [selectedWalletOptionId, setSelectedWalletOptionId] = useState("");
23339
23363
  const [isMobile, setIsMobile] = useState(false);
23340
23364
  const [mobilePaymentStarted, setMobilePaymentStarted] = useState(() => {
@@ -23360,6 +23384,7 @@ const CoinleyPaymentInternal = ({
23360
23384
  const manualCheckTimeout = useRef(null);
23361
23385
  const recoveryLoadingStartedAt = useRef(0);
23362
23386
  const recoveryLoadingTimeout = useRef(null);
23387
+ const refundPendingStartedAt = useRef(0);
23363
23388
  const [copiedField, setCopiedField] = useState(null);
23364
23389
  const [expirationTime, setExpirationTime] = useState(null);
23365
23390
  const STANDARD_PAYMENT_TIMEOUT_MS = 15 * 60 * 1e3;
@@ -25221,8 +25246,10 @@ const CoinleyPaymentInternal = ({
25221
25246
  resetWalletTokens();
25222
25247
  setPaymentData(null);
25223
25248
  setError("");
25249
+ setCcError(null);
25224
25250
  setQrCodeDataUrl("");
25225
25251
  setQrWalletChoiceConfirmed(false);
25252
+ setQrSelectedWalletId(null);
25226
25253
  setCcResult(null);
25227
25254
  setCcQrCode("");
25228
25255
  setCcPhase("idle");
@@ -25248,8 +25275,10 @@ const CoinleyPaymentInternal = ({
25248
25275
  (_a2 = transactionHandling.resetTransaction) == null ? void 0 : _a2.call(transactionHandling);
25249
25276
  setPaymentData(null);
25250
25277
  setError("");
25278
+ setCcError(null);
25251
25279
  setQrCodeDataUrl("");
25252
25280
  setQrWalletChoiceConfirmed(false);
25281
+ setQrSelectedWalletId(null);
25253
25282
  setSelectedToken(token);
25254
25283
  setCcOriginToken((selectedNetwork == null ? void 0 : selectedNetwork.isCrossChainSource) ? token : null);
25255
25284
  createNewAttempt("token-selected", {
@@ -25372,6 +25401,7 @@ const CoinleyPaymentInternal = ({
25372
25401
  setRecoveryLoadingStatus({ action, ...status });
25373
25402
  });
25374
25403
  }, [runAfterRecoveryMinimum]);
25404
+ const getRefundPendingElapsedMs = useCallback(() => refundPendingStartedAt.current ? Math.max(Date.now() - refundPendingStartedAt.current, 0) : 0, []);
25375
25405
  const getOffsetWaitingStatus = useCallback((overrides = {}) => {
25376
25406
  const shortfallLabel = underpaymentInfo ? `${formatAmount(underpaymentInfo.shortfallAmount || underpaymentInfo.amountRemaining || 0)} ${underpaymentInfo.tokenSymbol || (selectedToken == null ? void 0 : selectedToken.symbol) || ""}`.trim() : "the remaining amount";
25377
25407
  const networkLabel = (underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel) || (selectedNetwork == null ? void 0 : selectedNetwork.name) || (selectedNetwork == null ? void 0 : selectedNetwork.shortName) || "the selected network";
@@ -25382,24 +25412,27 @@ const CoinleyPaymentInternal = ({
25382
25412
  ...overrides
25383
25413
  };
25384
25414
  }, [selectedNetwork == null ? void 0 : selectedNetwork.name, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo]);
25385
- const getRefundPendingStatus = useCallback(() => ({
25386
- title: "Refund request received",
25387
- description: "We will process it automatically.",
25388
- detail: `Refunding the received ${(underpaymentInfo == null ? void 0 : underpaymentInfo.tokenSymbol) || (selectedToken == null ? void 0 : selectedToken.symbol) || "tokens"} on ${(underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel) || (selectedNetwork == null ? void 0 : selectedNetwork.name) || (selectedNetwork == null ? void 0 : selectedNetwork.shortName) || "the selected network"}.`
25389
- }), [selectedNetwork == null ? void 0 : selectedNetwork.name, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel, underpaymentInfo == null ? void 0 : underpaymentInfo.tokenSymbol]);
25415
+ const getRefundPendingStatus = useCallback(() => {
25416
+ const guidance = getRefundPendingGuidance(getRefundPendingElapsedMs());
25417
+ return {
25418
+ ...guidance,
25419
+ detail: `${guidance.eta} Refunding the received ${(underpaymentInfo == null ? void 0 : underpaymentInfo.tokenSymbol) || (selectedToken == null ? void 0 : selectedToken.symbol) || "tokens"} on ${(underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel) || (selectedNetwork == null ? void 0 : selectedNetwork.name) || (selectedNetwork == null ? void 0 : selectedNetwork.shortName) || "the selected network"}.`
25420
+ };
25421
+ }, [getRefundPendingElapsedMs, selectedNetwork == null ? void 0 : selectedNetwork.name, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel, underpaymentInfo == null ? void 0 : underpaymentInfo.tokenSymbol]);
25390
25422
  const getCrossChainRefundPendingStatus = useCallback((status = ccRefundPendingInfo) => {
25391
25423
  var _a2, _b, _c, _d;
25392
25424
  const details = (status == null ? void 0 : status.refundPendingDetails) || {};
25393
25425
  const tokenSymbol = ((_a2 = status == null ? void 0 : status.underpayment) == null ? void 0 : _a2.tokenSymbol) || ((_b = status == null ? void 0 : status.underpayment) == null ? void 0 : _b.currency) || (underpaymentInfo == null ? void 0 : underpaymentInfo.tokenSymbol) || (ccOriginToken == null ? void 0 : ccOriginToken.symbol) || (selectedToken == null ? void 0 : selectedToken.symbol) || "tokens";
25394
25426
  const networkLabel = ((_c = status == null ? void 0 : status.underpayment) == null ? void 0 : _c.refundNetworkLabel) || (underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel) || ccChainName(((_d = status == null ? void 0 : status.relay) == null ? void 0 : _d.originChainId) || (ccResult == null ? void 0 : ccResult.originChainId) || ccOriginChainId);
25395
25427
  const refundAddressLabel = (status == null ? void 0 : status.refundRecipient) || refundAddress.trim();
25428
+ const guidance = getRefundPendingGuidance(getRefundPendingElapsedMs());
25396
25429
  const available = details.available && details.available !== "0.0" ? ` Relay has returned ${details.available} ${tokenSymbol}.` : "";
25397
25430
  return {
25398
- title: "Waiting for Relay refund",
25399
- description: "Relay is returning the underpaid funds before Coinley can send your refund.",
25400
- detail: `We will keep checking automatically and refund ${tokenSymbol} on ${networkLabel}${refundAddressLabel ? ` to ${truncateAddress(refundAddressLabel)}` : ""}.${available}`
25431
+ title: guidance.title,
25432
+ description: guidance.description,
25433
+ detail: `${guidance.eta} Refund will be sent as ${tokenSymbol} on ${networkLabel}${refundAddressLabel ? ` to ${truncateAddress(refundAddressLabel)}` : ""}.${available}`
25401
25434
  };
25402
- }, [ccOriginChainId, ccOriginToken == null ? void 0 : ccOriginToken.symbol, ccRefundPendingInfo, ccResult == null ? void 0 : ccResult.originChainId, refundAddress, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel, underpaymentInfo == null ? void 0 : underpaymentInfo.tokenSymbol]);
25435
+ }, [ccOriginChainId, ccOriginToken == null ? void 0 : ccOriginToken.symbol, ccRefundPendingInfo, ccResult == null ? void 0 : ccResult.originChainId, getRefundPendingElapsedMs, refundAddress, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel, underpaymentInfo == null ? void 0 : underpaymentInfo.tokenSymbol]);
25403
25436
  useEffect(() => () => {
25404
25437
  if (recoveryLoadingTimeout.current) {
25405
25438
  clearTimeout(recoveryLoadingTimeout.current);
@@ -25414,6 +25447,7 @@ const CoinleyPaymentInternal = ({
25414
25447
  const status = await paymentFlow.api.getCrossChainStatus(ccResult.id);
25415
25448
  setCcPhase(status.phase);
25416
25449
  if (status.refundStatus === "refunded") {
25450
+ refundPendingStartedAt.current = 0;
25417
25451
  finishRecoveryLoading(() => {
25418
25452
  setCcRefundPendingInfo(null);
25419
25453
  ccSucceeded.current = true;
@@ -25424,6 +25458,7 @@ const CoinleyPaymentInternal = ({
25424
25458
  setCurrentStep(PAYMENT_STEPS.SUCCESS);
25425
25459
  });
25426
25460
  } else if (status.refundStatus === "pending") {
25461
+ refundPendingStartedAt.current = refundPendingStartedAt.current || Date.now();
25427
25462
  activateUnderpaymentFromCrossChainStatus(status);
25428
25463
  setCcRefundPendingInfo(status);
25429
25464
  setRefundRequestSubmitted(true);
@@ -25493,6 +25528,7 @@ const CoinleyPaymentInternal = ({
25493
25528
  if (cancelled) return;
25494
25529
  setCcPhase(s.phase);
25495
25530
  if (s.refundStatus === "refunded") {
25531
+ refundPendingStartedAt.current = 0;
25496
25532
  ccSucceeded.current = true;
25497
25533
  setCcRefundPendingInfo(null);
25498
25534
  setRefundRequestStatus("refunded");
@@ -25501,6 +25537,7 @@ const CoinleyPaymentInternal = ({
25501
25537
  clearUnderpaymentRecovery(s.paymentId || ccResult.id);
25502
25538
  setCurrentStep(PAYMENT_STEPS.SUCCESS);
25503
25539
  } else if (s.refundStatus === "pending") {
25540
+ refundPendingStartedAt.current = refundPendingStartedAt.current || Date.now();
25504
25541
  activateUnderpaymentFromCrossChainStatus(s);
25505
25542
  setCcRefundPendingInfo(s);
25506
25543
  setRefundRequestSubmitted(true);
@@ -26352,6 +26389,7 @@ const CoinleyPaymentInternal = ({
26352
26389
  setUnderpaymentChoice(recoveryState.choice);
26353
26390
  setUnderpaymentView(recoveryState.view === "refund" ? "refund" : "offset");
26354
26391
  setManualCheckStatus(null);
26392
+ refundPendingStartedAt.current = 0;
26355
26393
  setRefundRequestSubmitted(false);
26356
26394
  setRefundRequestStatus(null);
26357
26395
  setRefundRequestMessage("");
@@ -26361,6 +26399,7 @@ const CoinleyPaymentInternal = ({
26361
26399
  setUnderpaymentChoice(null);
26362
26400
  setUnderpaymentView("choice");
26363
26401
  setRefundAddress("");
26402
+ refundPendingStartedAt.current = 0;
26364
26403
  setRefundRequestSubmitted(false);
26365
26404
  setRefundRequestStatus(null);
26366
26405
  setRefundRequestMessage("");
@@ -26376,10 +26415,17 @@ const CoinleyPaymentInternal = ({
26376
26415
  const trimmedAddress = refundAddress.trim();
26377
26416
  if (!trimmedAddress || !activeTransferPaymentId || refundRequestStatus === "submitting") return;
26378
26417
  startRecoveryLoading("refund");
26418
+ refundPendingStartedAt.current = Date.now();
26379
26419
  setRefundRequestStatus("submitting");
26380
26420
  setRefundRequestMessage("");
26381
26421
  setManualCheckStatus(null);
26382
26422
  clearUnderpaymentRecovery(activeTransferPaymentId);
26423
+ holdRecoveryLoading("refund", ccResult ? getCrossChainRefundPendingStatus({
26424
+ refundStatus: "pending",
26425
+ refundRecipient: trimmedAddress,
26426
+ underpayment: underpaymentInfo,
26427
+ relay: { originChainId: ccResult.originChainId || ccOriginChainId }
26428
+ }) : getRefundPendingStatus());
26383
26429
  const refundPayload = {
26384
26430
  paymentId: activeTransferPaymentId,
26385
26431
  refundAddress: trimmedAddress,
@@ -26402,6 +26448,7 @@ const CoinleyPaymentInternal = ({
26402
26448
  setRefundRequestSubmitted(true);
26403
26449
  setRefundRequestStatus(refundStatus === "refunded" ? "refunded" : "pending");
26404
26450
  if (refundStatus === "refunded") {
26451
+ refundPendingStartedAt.current = 0;
26405
26452
  finishRecoveryLoading(() => {
26406
26453
  var _a3;
26407
26454
  setRefundRequestMessage("");
@@ -26410,6 +26457,7 @@ const CoinleyPaymentInternal = ({
26410
26457
  setCurrentStep(PAYMENT_STEPS.SUCCESS);
26411
26458
  });
26412
26459
  } else {
26460
+ refundPendingStartedAt.current = refundPendingStartedAt.current || Date.now();
26413
26461
  setRefundRequestMessage("");
26414
26462
  if (ccResult) {
26415
26463
  const pendingStatus = {
@@ -26427,6 +26475,7 @@ const CoinleyPaymentInternal = ({
26427
26475
  }
26428
26476
  }
26429
26477
  } catch (error2) {
26478
+ refundPendingStartedAt.current = 0;
26430
26479
  console.warn("[RefundRequest] Error:", error2.message);
26431
26480
  finishRecoveryLoading(() => {
26432
26481
  setRefundRequestSubmitted(false);
@@ -26822,16 +26871,16 @@ const CoinleyPaymentInternal = ({
26822
26871
  const renderMethodTabs = () => /* @__PURE__ */ jsxs("div", { className: isTightWalletView ? "mb-2" : isCompactCheckoutView ? "mb-3" : "mb-4", children: [
26823
26872
  /* @__PURE__ */ jsx("p", { className: `text-xs text-[#9EA0A8] ${isTightWalletView ? "mb-1" : "mb-2"}`, children: "Payment methods" }),
26824
26873
  /* @__PURE__ */ jsx("div", { className: "flex overflow-hidden rounded-xl bg-[#F6F6F7] p-1", children: [
26825
- { tab: PAYMENT_TABS.TRANSFER, label: "Transfer to address" },
26826
- { tab: PAYMENT_TABS.QR, label: "QR Code" },
26827
- { tab: PAYMENT_TABS.WALLET, label: "Wallet Extension" }
26874
+ { tab: PAYMENT_TABS.TRANSFER, label: "Transfer to address", mobileLabel: "Transfer" },
26875
+ { tab: PAYMENT_TABS.QR, label: "QR Code", mobileLabel: "QR Code" },
26876
+ { tab: PAYMENT_TABS.WALLET, label: "Wallet Extension", mobileLabel: "Wallet Extension" }
26828
26877
  ].map((method) => /* @__PURE__ */ jsx(
26829
26878
  "button",
26830
26879
  {
26831
26880
  type: "button",
26832
26881
  onClick: () => isMobile ? handleMobileTabSelect(method.tab) : setActiveTab(method.tab),
26833
- className: `min-w-0 ${isTightWalletView ? "h-7 px-2 text-[13px]" : "h-9 px-2.5 text-sm"} rounded-lg transition-colors whitespace-nowrap ${method.tab === PAYMENT_TABS.TRANSFER ? "flex-[1.35]" : "flex-1"} ${activeTab === method.tab ? "bg-white text-[#5B2EEA] shadow-[0_1px_3px_rgba(31,36,48,0.08)]" : "text-[#535865] hover:text-[#1F2430]"}`,
26834
- children: method.label
26882
+ className: `min-w-0 truncate ${isTightWalletView ? "h-7 px-2 text-[13px]" : "h-9 px-2.5 text-sm"} rounded-lg transition-colors whitespace-nowrap ${method.tab === PAYMENT_TABS.TRANSFER ? "flex-[1.35]" : "flex-1"} ${activeTab === method.tab ? "bg-white text-[#5B2EEA] shadow-[0_1px_3px_rgba(31,36,48,0.08)]" : "text-[#535865] hover:text-[#1F2430]"}`,
26883
+ children: isMobile ? method.mobileLabel : method.label
26835
26884
  },
26836
26885
  method.tab
26837
26886
  )) })
@@ -26970,7 +27019,7 @@ const CoinleyPaymentInternal = ({
26970
27019
  const knownChain = ALCHEMY_EVM_CHAINS.find((chain) => Number(chain.id) === chainId);
26971
27020
  return {
26972
27021
  id: `cross-chain-${chainId}`,
26973
- name: (knownChain == null ? void 0 : knownChain.displayName) || ccChainName(chainId),
27022
+ name: (knownChain == null ? void 0 : knownChain.displayName) || source.name || ccChainName(chainId),
26974
27023
  shortName: (knownChain == null ? void 0 : knownChain.shortName) || `chain-${chainId}`,
26975
27024
  chainId,
26976
27025
  chainType: "evm",
@@ -27112,7 +27161,8 @@ const CoinleyPaymentInternal = ({
27112
27161
  const token = availableTokens.find((item) => item.id === tokenId);
27113
27162
  if (token) handleTokenSelect(token);
27114
27163
  }
27115
- })
27164
+ }),
27165
+ ccError && /* @__PURE__ */ jsx("div", { className: "mt-3 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs font-medium text-red-600", children: ccError })
27116
27166
  ] });
27117
27167
  const renderWalletExtensionSetupPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
27118
27168
  !selectedNetwork && renderWalletNetworkPickerPanel(),
@@ -27127,6 +27177,7 @@ const CoinleyPaymentInternal = ({
27127
27177
  ];
27128
27178
  const handleQrWalletSelect = async (walletId) => {
27129
27179
  setPreferredWallet(walletId);
27180
+ setQrSelectedWalletId(walletId);
27130
27181
  setError(null);
27131
27182
  setQrCodeDataUrl("");
27132
27183
  setQrWalletChoiceConfirmed(false);
@@ -27149,6 +27200,7 @@ const CoinleyPaymentInternal = ({
27149
27200
  await createPaymentAndGenerateQR(network, token, walletId);
27150
27201
  } catch (err) {
27151
27202
  setQrWalletChoiceConfirmed(false);
27203
+ setQrSelectedWalletId(null);
27152
27204
  setError((err == null ? void 0 : err.message) || "Unable to generate QR code. Please try again.");
27153
27205
  }
27154
27206
  };
@@ -27360,9 +27412,9 @@ const CoinleyPaymentInternal = ({
27360
27412
  type: "button",
27361
27413
  onClick: () => handleQrWalletSelect(wallet.id),
27362
27414
  disabled: !selectedNetwork || !selectedToken || qrLoading || isConverting,
27363
- className: `relative flex h-[76px] min-w-0 flex-col items-start justify-between rounded-lg border bg-[#FAFAFB] px-2.5 py-3 text-left transition-colors ${preferredWallet === wallet.id ? "border-[#7042D2] bg-[#FBF8FF]" : "border-[#EEF0F4] hover:border-[#C9B8F6]"} disabled:cursor-not-allowed disabled:opacity-60`,
27415
+ className: `relative flex h-[76px] min-w-0 flex-col items-start justify-between rounded-lg border bg-[#FAFAFB] px-2.5 py-3 text-left transition-colors ${qrSelectedWalletId === wallet.id ? "border-[#7042D2] bg-[#FBF8FF]" : "border-[#EEF0F4] hover:border-[#C9B8F6]"} disabled:cursor-not-allowed disabled:opacity-60`,
27364
27416
  children: [
27365
- preferredWallet === wallet.id && qrWalletChoiceConfirmed && /* @__PURE__ */ jsx("span", { className: "absolute right-[-5px] top-[-6px] flex h-4 w-4 items-center justify-center rounded-full border border-[#7042D2] bg-white text-[#7042D2]", children: /* @__PURE__ */ jsx("svg", { className: "h-2.5 w-2.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M5 13l4 4L19 7" }) }) }),
27417
+ qrSelectedWalletId === wallet.id && qrWalletChoiceConfirmed && /* @__PURE__ */ jsx("span", { className: "absolute right-[-5px] top-[-6px] flex h-4 w-4 items-center justify-center rounded-full border border-[#7042D2] bg-white text-[#7042D2]", children: /* @__PURE__ */ jsx("svg", { className: "h-2.5 w-2.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M5 13l4 4L19 7" }) }) }),
27366
27418
  /* @__PURE__ */ jsx(
27367
27419
  "img",
27368
27420
  {
@@ -27383,7 +27435,7 @@ const CoinleyPaymentInternal = ({
27383
27435
  /* @__PURE__ */ jsx("img", { src: stablezactLoading, alt: "", className: "h-5 w-6 object-contain" }),
27384
27436
  "Generating QR code..."
27385
27437
  ] }),
27386
- /* @__PURE__ */ jsx("p", { className: "text-xs leading-5 text-[#9EA0A8]", children: "Simply select a wallet app to generate the QR code then input the amount, and transfer your funds" })
27438
+ qrWalletChoiceConfirmed ? renderQrPaymentPanel() : !qrLoading && /* @__PURE__ */ jsx("p", { className: "text-xs leading-5 text-[#9EA0A8]", children: "Simply select a wallet app to generate the QR code then input the amount, and transfer your funds" })
27387
27439
  ] });
27388
27440
  const renderQrPaymentPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
27389
27441
  /* @__PURE__ */ jsxs("div", { className: "mb-4 flex flex-col gap-3 min-[380px]:flex-row min-[380px]:items-start", children: [
@@ -27511,6 +27563,7 @@ const CoinleyPaymentInternal = ({
27511
27563
  );
27512
27564
  const handleUnderpaymentChoiceContinue = () => {
27513
27565
  if (!underpaymentChoice) return;
27566
+ refundPendingStartedAt.current = 0;
27514
27567
  setRefundRequestSubmitted(false);
27515
27568
  const nextView = underpaymentChoice === "refund" ? "refund" : "offset";
27516
27569
  writeUnderpaymentRecovery(underpaymentChoice, nextView, underpaymentInfo);
@@ -27651,6 +27704,14 @@ const CoinleyPaymentInternal = ({
27651
27704
  disabled: loading || isConverting || walletOptionsForSelectedNetwork.length === 0 || isSwapOrBridgeFlow && (relayBridge.bridgeStatus === "quoting" || (selectedToken == null ? void 0 : selectedToken.routeStatus) === "unsupported")
27652
27705
  });
27653
27706
  }
27707
+ if (activeTab === PAYMENT_TABS.QR && !qrWalletChoiceConfirmed) {
27708
+ return renderFooterPrimaryButton({
27709
+ label: qrLoading ? "Generating QR code..." : "Continue",
27710
+ onClick: () => {
27711
+ },
27712
+ disabled: true
27713
+ });
27714
+ }
27654
27715
  return null;
27655
27716
  };
27656
27717
  const renderCheckoutFooter = () => {
@@ -27941,7 +28002,7 @@ const CoinleyPaymentInternal = ({
27941
28002
  ) }),
27942
28003
  isSwapOrBridgeFlow && (selectedToken == null ? void 0 : selectedToken.routeStatus) === "unsupported" && /* @__PURE__ */ jsx("div", { className: "mb-2 rounded-lg border border-red-200 bg-red-50 p-2 text-xs text-red-700", children: UNSUPPORTED_ROUTE_MESSAGE })
27943
28004
  ] }),
27944
- activeTab === PAYMENT_TABS.QR && /* @__PURE__ */ jsx(Fragment, { children: qrWalletChoiceConfirmed ? renderQrPaymentPanel() : renderQrWalletChoicePanel() }),
28005
+ activeTab === PAYMENT_TABS.QR && /* @__PURE__ */ jsx(Fragment, { children: renderQrWalletChoicePanel() }),
27945
28006
  activeTab === PAYMENT_TABS.TRANSFER && /* @__PURE__ */ jsxs(Fragment, { children: [
27946
28007
  isCrossChainTransferSetupView && /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
27947
28008
  renderCheckoutSelect({
@@ -27949,8 +28010,8 @@ const CoinleyPaymentInternal = ({
27949
28010
  label: "Select a Network",
27950
28011
  value: ccOriginChainId,
27951
28012
  placeholder: "Select a network",
27952
- options: ccSources.map((s) => ({ id: String(s.chainId), chainId: s.chainId })),
27953
- getLabel: (o) => ccChainName(o.chainId),
28013
+ options: ccSources.map((s) => ({ id: String(s.chainId), chainId: s.chainId, name: s.name })),
28014
+ getLabel: (o) => o.name || ccChainName(o.chainId),
27954
28015
  getIcon: (o) => ccChainIcon(o.chainId),
27955
28016
  compact: true,
27956
28017
  elevated: true,
@@ -27958,6 +28019,7 @@ const CoinleyPaymentInternal = ({
27958
28019
  onChange: (chainId) => {
27959
28020
  setCcOriginChainId(chainId);
27960
28021
  setCcOriginToken(null);
28022
+ setCcError(null);
27961
28023
  }
27962
28024
  }),
27963
28025
  renderCheckoutSelect({
@@ -28112,6 +28174,7 @@ const CoinleyPaymentInternal = ({
28112
28174
  setUnderpaymentChoice(null);
28113
28175
  setUnderpaymentView("choice");
28114
28176
  setRefundAddress("");
28177
+ refundPendingStartedAt.current = 0;
28115
28178
  setRefundRequestSubmitted(false);
28116
28179
  setRefundRequestStatus(null);
28117
28180
  setRefundRequestMessage("");
@@ -28132,6 +28195,7 @@ const CoinleyPaymentInternal = ({
28132
28195
  setPaymentData(null);
28133
28196
  setQrCodeDataUrl("");
28134
28197
  setQrWalletChoiceConfirmed(false);
28198
+ setQrSelectedWalletId(null);
28135
28199
  };
28136
28200
  const isCheckoutDropdownOpen = [
28137
28201
  "transfer-network",
@@ -28214,4 +28278,4 @@ export {
28214
28278
  chainTransports as c,
28215
28279
  isFeatureEnabled as i
28216
28280
  };
28217
- //# sourceMappingURL=CoinleyPayment-BTrq3zIS.js.map
28281
+ //# sourceMappingURL=CoinleyPayment-CkjhX3Ry.js.map
@@ -1,4 +1,4 @@
1
- import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-BTrq3zIS.js";
1
+ import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-CkjhX3Ry.js";
2
2
  const logo = "https://coinley.io/logo.png";
3
3
  let appKitInstance = null;
4
4
  let isInitializing = false;
@@ -113,4 +113,4 @@ export {
113
113
  initializeAppKitEVM,
114
114
  openAppKitModal
115
115
  };
116
- //# sourceMappingURL=appKitEVM-rZ-uPbNm.js.map
116
+ //# sourceMappingURL=appKitEVM-Dsu3B87G.js.map
@@ -1,4 +1,4 @@
1
- import { F as FEATURES, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-BTrq3zIS.js";
1
+ import { F as FEATURES, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-CkjhX3Ry.js";
2
2
  const logo = "https://coinley.io/logo.png";
3
3
  let appKitInstance = null;
4
4
  let isInitializing = false;
@@ -243,4 +243,4 @@ export {
243
243
  disconnectWalletConnect,
244
244
  initializeAppKitSolana
245
245
  };
246
- //# sourceMappingURL=appKitSolana-BeXOnse3.js.map
246
+ //# sourceMappingURL=appKitSolana-Qc2Ml_-f.js.map