coinley-pay 0.36.0 → 0.37.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.
@@ -5,7 +5,7 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
5
5
  import { useState, useRef, useEffect, useCallback, useMemo } from "react";
6
6
  import { useConnect, useAccount, useSwitchChain, useSendTransaction, useWaitForTransactionReceipt, WagmiProvider, useDisconnect } from "wagmi";
7
7
  import { QueryClientProvider, QueryClient } from "@tanstack/react-query";
8
- 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-QlVbEn4w.js";
8
+ 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-CIjLjC1o.js";
9
9
  import { createConfig, fallback, http, getAccount as getAccount$1, getWalletClient, simulateContract, writeContract, readContract, waitForTransactionReceipt, estimateFeesPerGas as estimateFeesPerGas$1 } from "@wagmi/core";
10
10
  import { injected, metaMask, coinbaseWallet, walletConnect } from "@wagmi/connectors";
11
11
  import { defineChain as defineChain$1, erc20Abi, http as http$1, createPublicClient, fallback as fallback$1 } from "viem";
@@ -21150,7 +21150,7 @@ const WalletSelector = ({
21150
21150
  try {
21151
21151
  setAppKitError(null);
21152
21152
  setWalletConnectAddress(solanaAccountState.address);
21153
- const { createWalletConnectAdapter } = await import("./appKitSolana-C1LLrCaN.js");
21153
+ const { createWalletConnectAdapter } = await import("./appKitSolana-CHe_HukM.js");
21154
21154
  const adapter = createWalletConnectAdapter(solanaAccountState.address);
21155
21155
  await solanaWallet.connectWalletConnect(adapter, solanaAccountState.address);
21156
21156
  console.log("✅ WalletConnect synced with SDK");
@@ -21255,7 +21255,7 @@ const WalletSelector = ({
21255
21255
  setAppKitLoading(true);
21256
21256
  setAppKitError(null);
21257
21257
  try {
21258
- const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-eozvDNUh.js");
21258
+ const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-BCaK3hpo.js");
21259
21259
  await initializeAppKitEVM(wagmiConfig);
21260
21260
  await openAppKitModal();
21261
21261
  } catch (error) {
@@ -21275,7 +21275,7 @@ const WalletSelector = ({
21275
21275
  setAppKitError(null);
21276
21276
  try {
21277
21277
  console.log("📦 Loading AppKit Solana module...");
21278
- const { initializeAppKitSolana } = await import("./appKitSolana-C1LLrCaN.js");
21278
+ const { initializeAppKitSolana } = await import("./appKitSolana-CHe_HukM.js");
21279
21279
  console.log("✅ Module loaded, initializing...");
21280
21280
  const modal = await initializeAppKitSolana(solanaWallet);
21281
21281
  console.log("✅ AppKit Solana initialized successfully");
@@ -23346,6 +23346,7 @@ const CoinleyPaymentInternal = ({
23346
23346
  const [ccGenerating, setCcGenerating] = useState(false);
23347
23347
  const [ccManualCheckStatus, setCcManualCheckStatus] = useState("idle");
23348
23348
  const ccSucceeded = useRef(false);
23349
+ const ccStatusPollInFlight = useRef(false);
23349
23350
  const [networkSearch, setNetworkSearch] = useState("");
23350
23351
  const [walletNetworkSearch, setWalletNetworkSearch] = useState("");
23351
23352
  const [openCheckoutDropdown, setOpenCheckoutDropdown] = useState(null);
@@ -23475,6 +23476,8 @@ const CoinleyPaymentInternal = ({
23475
23476
  setIsBridgePayment,
23476
23477
  setBridgeDestination
23477
23478
  } = paymentFlow;
23479
+ const activeTransferPaymentId = (paymentData == null ? void 0 : paymentData.id) || (ccResult == null ? void 0 : ccResult.id) || (ccResult == null ? void 0 : ccResult.paymentId);
23480
+ const activeTransferDepositAddress = (paymentData == null ? void 0 : paymentData.depositAddress) || (ccResult == null ? void 0 : ccResult.relayDepositAddress) || (ccResult == null ? void 0 : ccResult.depositAddress);
23478
23481
  const merchantReceiveNetworks = (merchantNetworks == null ? void 0 : merchantNetworks.length) ? merchantNetworks : networks;
23479
23482
  const isMerchantReceiveNetwork = useCallback((network) => {
23480
23483
  var _a2;
@@ -23530,10 +23533,10 @@ const CoinleyPaymentInternal = ({
23530
23533
  sweepTxHash: (payment == null ? void 0 : payment.sweepTxHash) ?? (prev == null ? void 0 : prev.sweepTxHash)
23531
23534
  }));
23532
23535
  }, [resolvePaymentTransactionHash, setPaymentData]);
23533
- const getUnderpaymentRecoveryStorageKey = useCallback((paymentId = paymentData == null ? void 0 : paymentData.id) => {
23536
+ const getUnderpaymentRecoveryStorageKey = useCallback((paymentId = activeTransferPaymentId) => {
23534
23537
  return paymentId ? `${UNDERPAYMENT_RECOVERY_STORAGE_PREFIX}${paymentId}` : null;
23535
- }, [paymentData == null ? void 0 : paymentData.id]);
23536
- const clearUnderpaymentRecovery = useCallback((paymentId = paymentData == null ? void 0 : paymentData.id) => {
23538
+ }, [activeTransferPaymentId]);
23539
+ const clearUnderpaymentRecovery = useCallback((paymentId = activeTransferPaymentId) => {
23537
23540
  const storageKey = getUnderpaymentRecoveryStorageKey(paymentId);
23538
23541
  if (!storageKey || typeof window === "undefined" || !window.localStorage) return;
23539
23542
  try {
@@ -23541,8 +23544,8 @@ const CoinleyPaymentInternal = ({
23541
23544
  } catch (error2) {
23542
23545
  console.warn("[UnderpaymentRecovery] Failed to clear recovery state:", error2.message);
23543
23546
  }
23544
- }, [getUnderpaymentRecoveryStorageKey, paymentData == null ? void 0 : paymentData.id]);
23545
- const readUnderpaymentRecovery = useCallback((paymentId = paymentData == null ? void 0 : paymentData.id) => {
23547
+ }, [activeTransferPaymentId, getUnderpaymentRecoveryStorageKey]);
23548
+ const readUnderpaymentRecovery = useCallback((paymentId = activeTransferPaymentId) => {
23546
23549
  const storageKey = getUnderpaymentRecoveryStorageKey(paymentId);
23547
23550
  if (!storageKey || typeof window === "undefined" || !window.localStorage) return null;
23548
23551
  try {
@@ -23561,14 +23564,15 @@ const CoinleyPaymentInternal = ({
23561
23564
  console.warn("[UnderpaymentRecovery] Failed to read recovery state:", error2.message);
23562
23565
  return null;
23563
23566
  }
23564
- }, [getUnderpaymentRecoveryStorageKey, paymentData == null ? void 0 : paymentData.id]);
23567
+ }, [activeTransferPaymentId, getUnderpaymentRecoveryStorageKey]);
23565
23568
  const writeUnderpaymentRecovery = useCallback((choice, view = choice, infoOverride = underpaymentInfo) => {
23566
- const storageKey = getUnderpaymentRecoveryStorageKey(paymentData == null ? void 0 : paymentData.id);
23569
+ const paymentId = activeTransferPaymentId;
23570
+ const storageKey = getUnderpaymentRecoveryStorageKey(paymentId);
23567
23571
  if (!storageKey || typeof window === "undefined" || !window.localStorage) return;
23568
23572
  if (choice !== "offset" && choice !== "refund") return;
23569
23573
  try {
23570
23574
  window.localStorage.setItem(storageKey, JSON.stringify({
23571
- paymentId: paymentData.id,
23575
+ paymentId,
23572
23576
  choice,
23573
23577
  view: view === "refund" ? "refund" : "offset",
23574
23578
  expectedAmount: infoOverride == null ? void 0 : infoOverride.expectedAmount,
@@ -23582,7 +23586,7 @@ const CoinleyPaymentInternal = ({
23582
23586
  } catch (error2) {
23583
23587
  console.warn("[UnderpaymentRecovery] Failed to persist recovery state:", error2.message);
23584
23588
  }
23585
- }, [getUnderpaymentRecoveryStorageKey, paymentData == null ? void 0 : paymentData.id, underpaymentInfo]);
23589
+ }, [activeTransferPaymentId, getUnderpaymentRecoveryStorageKey, underpaymentInfo]);
23586
23590
  const normalizeUnderpaymentInfo = useCallback((payment = {}) => {
23587
23591
  const raw = payment.underpayment || payment.underpaymentDetails || payment.shortPayment || payment.partialPayment || null;
23588
23592
  const statusText = String(payment.status || payment.depositStatus || (raw == null ? void 0 : raw.status) || "").toLowerCase();
@@ -23649,6 +23653,24 @@ const CoinleyPaymentInternal = ({
23649
23653
  refundNetworkLabel: (selectedNetwork == null ? void 0 : selectedNetwork.displayName) || (selectedNetwork == null ? void 0 : selectedNetwork.name) || (selectedNetwork == null ? void 0 : selectedNetwork.shortName)
23650
23654
  });
23651
23655
  }, [activateUnderpaymentFlow, paymentAmount, selectedNetwork, selectedToken]);
23656
+ const activateUnderpaymentFromCrossChainStatus = useCallback((statusResult = {}) => {
23657
+ const relay = statusResult.relay || {};
23658
+ const rawPayment = statusResult.payment || statusResult;
23659
+ const underpayment = statusResult.underpayment || statusResult.underpaymentDetails || rawPayment.underpayment || rawPayment.underpaymentDetails || null;
23660
+ return activateUnderpaymentFlow({
23661
+ ...rawPayment,
23662
+ id: rawPayment.id || statusResult.paymentId || (ccResult == null ? void 0 : ccResult.id),
23663
+ depositAddress: rawPayment.depositAddress || relay.depositAddress || (ccResult == null ? void 0 : ccResult.relayDepositAddress),
23664
+ status: rawPayment.status || statusResult.status,
23665
+ paymentState: rawPayment.paymentState || statusResult.paymentState,
23666
+ amount: (underpayment == null ? void 0 : underpayment.expectedAmount) ?? rawPayment.expectedAmount ?? rawPayment.amount ?? statusResult.expectedAmount ?? statusResult.amount,
23667
+ amountReceived: (underpayment == null ? void 0 : underpayment.receivedAmount) ?? (underpayment == null ? void 0 : underpayment.amountReceived) ?? rawPayment.amountReceived ?? statusResult.amountReceived,
23668
+ amountRemaining: (underpayment == null ? void 0 : underpayment.shortfallAmount) ?? (underpayment == null ? void 0 : underpayment.remainingAmount) ?? rawPayment.amountRemaining ?? statusResult.amountRemaining,
23669
+ currency: (underpayment == null ? void 0 : underpayment.tokenSymbol) || (underpayment == null ? void 0 : underpayment.currency) || rawPayment.currency || statusResult.currency || (ccOriginToken == null ? void 0 : ccOriginToken.symbol),
23670
+ refundNetworkLabel: (underpayment == null ? void 0 : underpayment.refundNetworkLabel) || rawPayment.refundNetworkLabel || ccChainName(relay.originChainId || (ccResult == null ? void 0 : ccResult.originChainId) || ccOriginChainId),
23671
+ underpayment
23672
+ });
23673
+ }, [activateUnderpaymentFlow, ccOriginChainId, ccOriginToken == null ? void 0 : ccOriginToken.symbol, ccResult == null ? void 0 : ccResult.id, ccResult == null ? void 0 : ccResult.originChainId, ccResult == null ? void 0 : ccResult.relayDepositAddress]);
23652
23674
  const selectedNetworkIsSolana = (selectedNetwork == null ? void 0 : selectedNetwork.chainType) === "solana" || (selectedNetwork == null ? void 0 : selectedNetwork.shortName) === "solana";
23653
23675
  const sourceNeedsMerchantBridge = Boolean(
23654
23676
  selectedNetwork && !selectedNetworkIsSolana && !isMerchantReceiveNetwork(selectedNetwork)
@@ -25095,7 +25117,9 @@ const CoinleyPaymentInternal = ({
25095
25117
  try {
25096
25118
  const status = await paymentFlow.api.getCrossChainStatus(ccResult.id);
25097
25119
  setCcPhase(status.phase);
25098
- if ((status.phase === "received" || status.phase === "settled") && !ccSucceeded.current) {
25120
+ if (activateUnderpaymentFromCrossChainStatus(status)) {
25121
+ setCcManualCheckStatus(null);
25122
+ } else if ((status.phase === "received" || status.phase === "settled") && !ccSucceeded.current) {
25099
25123
  ccSucceeded.current = true;
25100
25124
  onSuccess == null ? void 0 : onSuccess(status);
25101
25125
  } else if (status.phase === "failed") {
@@ -25112,15 +25136,21 @@ const CoinleyPaymentInternal = ({
25112
25136
  if (!(ccResult == null ? void 0 : ccResult.id)) return;
25113
25137
  let cancelled = false;
25114
25138
  const tick = async () => {
25139
+ if (ccStatusPollInFlight.current) return;
25140
+ ccStatusPollInFlight.current = true;
25115
25141
  try {
25116
25142
  const s = await paymentFlow.api.getCrossChainStatus(ccResult.id);
25117
25143
  if (cancelled) return;
25118
25144
  setCcPhase(s.phase);
25119
- if ((s.phase === "received" || s.phase === "settled") && !ccSucceeded.current) {
25145
+ if (activateUnderpaymentFromCrossChainStatus(s)) {
25146
+ setCcManualCheckStatus(null);
25147
+ } else if ((s.phase === "received" || s.phase === "settled") && !ccSucceeded.current) {
25120
25148
  ccSucceeded.current = true;
25121
25149
  onSuccess == null ? void 0 : onSuccess(s);
25122
25150
  }
25123
25151
  } catch {
25152
+ } finally {
25153
+ ccStatusPollInFlight.current = false;
25124
25154
  }
25125
25155
  };
25126
25156
  tick();
@@ -25129,7 +25159,7 @@ const CoinleyPaymentInternal = ({
25129
25159
  cancelled = true;
25130
25160
  clearInterval(t);
25131
25161
  };
25132
- }, [ccResult == null ? void 0 : ccResult.id, paymentFlow.api, onSuccess]);
25162
+ }, [activateUnderpaymentFromCrossChainStatus, ccResult == null ? void 0 : ccResult.id, onSuccess, paymentFlow.api]);
25133
25163
  const handleGenerateTransferAddress = async () => {
25134
25164
  if (isConverting) {
25135
25165
  setError("Please wait for currency conversion to complete");
@@ -25969,18 +25999,18 @@ const CoinleyPaymentInternal = ({
25969
25999
  const handleRefundRequestSubmit = useCallback(async () => {
25970
26000
  var _a2;
25971
26001
  const trimmedAddress = refundAddress.trim();
25972
- if (!trimmedAddress || !(paymentData == null ? void 0 : paymentData.id) || refundRequestStatus === "submitting") return;
26002
+ if (!trimmedAddress || !activeTransferPaymentId || refundRequestStatus === "submitting") return;
25973
26003
  setRefundRequestStatus("submitting");
25974
26004
  setRefundRequestMessage("");
25975
26005
  setManualCheckStatus(null);
25976
- clearUnderpaymentRecovery(paymentData == null ? void 0 : paymentData.id);
26006
+ clearUnderpaymentRecovery(activeTransferPaymentId);
25977
26007
  const refundPayload = {
25978
- paymentId: paymentData == null ? void 0 : paymentData.id,
26008
+ paymentId: activeTransferPaymentId,
25979
26009
  refundAddress: trimmedAddress,
25980
26010
  amountReceived: underpaymentInfo == null ? void 0 : underpaymentInfo.receivedAmount,
25981
26011
  amountRemaining: underpaymentInfo == null ? void 0 : underpaymentInfo.shortfallAmount,
25982
- network: selectedNetwork == null ? void 0 : selectedNetwork.shortName,
25983
- currency: selectedToken == null ? void 0 : selectedToken.symbol
26012
+ network: (selectedNetwork == null ? void 0 : selectedNetwork.shortName) || (ccOriginChainId ? ccChainName(ccOriginChainId) : void 0),
26013
+ currency: (selectedToken == null ? void 0 : selectedToken.symbol) || (ccOriginToken == null ? void 0 : ccOriginToken.symbol)
25984
26014
  };
25985
26015
  if (typeof (config == null ? void 0 : config.onRefundRequest) === "function") {
25986
26016
  config.onRefundRequest(refundPayload);
@@ -25991,7 +26021,7 @@ const CoinleyPaymentInternal = ({
25991
26021
  }));
25992
26022
  }
25993
26023
  try {
25994
- const result = await paymentFlow.api.requestDepositRefund(paymentData.id, trimmedAddress);
26024
+ const result = await paymentFlow.api.requestDepositRefund(activeTransferPaymentId, trimmedAddress);
25995
26025
  const refundStatus = ((_a2 = result == null ? void 0 : result.payment) == null ? void 0 : _a2.refundStatus) || "pending";
25996
26026
  setRefundRequestSubmitted(true);
25997
26027
  setRefundRequestStatus(refundStatus === "refunded" ? "refunded" : "pending");
@@ -26004,7 +26034,7 @@ const CoinleyPaymentInternal = ({
26004
26034
  setRefundRequestStatus("error");
26005
26035
  setRefundRequestMessage(error2.message || "Failed to submit refund request. Please try again.");
26006
26036
  }
26007
- }, [clearUnderpaymentRecovery, config, refundAddress, refundRequestStatus, paymentData == null ? void 0 : paymentData.id, paymentFlow.api, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo]);
26037
+ }, [activeTransferPaymentId, ccOriginChainId, ccOriginToken == null ? void 0 : ccOriginToken.symbol, clearUnderpaymentRecovery, config, refundAddress, refundRequestStatus, paymentFlow.api, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo]);
26008
26038
  const handleDepositManualCheck = useCallback(async () => {
26009
26039
  if (manualCheckStatus === "checking" || !(paymentData == null ? void 0 : paymentData.id)) return;
26010
26040
  setManualCheckStatus("checking");
@@ -26193,6 +26223,100 @@ const CoinleyPaymentInternal = ({
26193
26223
  ] }),
26194
26224
  title && description && /* @__PURE__ */ jsx("p", { className: "pl-6 text-xs leading-5 text-[#B54708]", children: description })
26195
26225
  ] });
26226
+ const renderUnderpaymentOptionCard = ({ choice, icon, title, description }) => {
26227
+ const selected = underpaymentChoice === choice;
26228
+ return /* @__PURE__ */ jsxs(
26229
+ "button",
26230
+ {
26231
+ type: "button",
26232
+ onClick: () => {
26233
+ setUnderpaymentChoice(choice);
26234
+ setRefundRequestSubmitted(false);
26235
+ setRefundRequestStatus(null);
26236
+ setRefundRequestMessage("");
26237
+ },
26238
+ className: `relative flex min-h-[112px] flex-col items-start rounded-xl border p-3 text-left transition-colors ${selected ? "border-[#8B5CF6] bg-[#F4EEFF]" : "border-[#ECEEF2] bg-white hover:border-[#D7C5FF]"}`,
26239
+ children: [
26240
+ selected && /* @__PURE__ */ jsx("span", { className: "absolute right-[-7px] top-[-9px] flex h-5 w-5 items-center justify-center rounded-full border border-[#8B5CF6] bg-white text-[#7042D2]", children: /* @__PURE__ */ jsx("svg", { className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) }) }),
26241
+ /* @__PURE__ */ jsx("div", { className: "mb-3 flex h-6 w-6 items-center justify-center text-[#111827]", children: icon }),
26242
+ /* @__PURE__ */ jsx("p", { className: "mb-1 text-sm font-semibold text-[#111827]", children: title }),
26243
+ /* @__PURE__ */ jsx("p", { className: "text-xs leading-4 text-[#A3A5AC]", children: description })
26244
+ ]
26245
+ }
26246
+ );
26247
+ };
26248
+ const renderUnderpaymentChoicePanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
26249
+ renderUnderpaymentWarning(
26250
+ "Amount received is less than expected",
26251
+ `We received $${formatAmount(underpaymentInfo.receivedAmount || 0)} but expected $${formatAmount(underpaymentInfo.expectedAmount || paymentAmount || 0)}. Your transaction is on hold, please choose how to proceed.`
26252
+ ),
26253
+ /* @__PURE__ */ jsxs("div", { className: "mb-5 grid grid-cols-1 gap-2 min-[380px]:grid-cols-2", children: [
26254
+ renderUnderpaymentOptionCard({
26255
+ choice: "offset",
26256
+ title: "Send offset",
26257
+ description: underpaymentChoice === "offset" ? "Top up the shortfall and complete this transfer with extended time" : "Top up the shortfall with extended time",
26258
+ icon: /* @__PURE__ */ jsx("svg", { className: "h-6 w-6", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.8, d: "M4 4v6h6M20 20v-6h-6M5.5 15.5A7 7 0 0017.7 18M18.5 8.5A7 7 0 006.3 6" }) })
26259
+ }),
26260
+ renderUnderpaymentOptionCard({
26261
+ choice: "refund",
26262
+ title: "Cancel & refund",
26263
+ description: "Cancel my transaction so i get refunded",
26264
+ icon: /* @__PURE__ */ jsxs("svg", { className: "h-6 w-6", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
26265
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9", strokeWidth: 1.8 }),
26266
+ /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.8, d: "M9 9l6 6m0-6l-6 6" })
26267
+ ] })
26268
+ })
26269
+ ] })
26270
+ ] });
26271
+ const renderUnderpaymentOffsetPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
26272
+ /* @__PURE__ */ jsxs("div", { className: "mb-5 flex items-start gap-3", children: [
26273
+ /* @__PURE__ */ jsx("div", { className: "h-[92px] w-[92px] flex-shrink-0 bg-white", children: (ccResult ? ccQrCode : depositQrCode) ? /* @__PURE__ */ jsx("img", { src: ccResult ? ccQrCode : depositQrCode, alt: "Deposit Address QR Code", className: "h-full w-full" }) : /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center rounded-lg bg-gray-100", children: /* @__PURE__ */ jsx("div", { className: "h-6 w-6 animate-spin rounded-full border-2 border-[#E5E7EB] border-t-[#7042D2]" }) }) }),
26274
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 pt-1", children: [
26275
+ /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs font-medium text-[#1F2430]", children: "Same Wallet address" }),
26276
+ /* @__PURE__ */ jsxs("div", { className: "flex min-h-[58px] items-center gap-2 rounded-xl border border-[#EEF0F4] bg-[#FAFAFB] px-3 py-2", children: [
26277
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 break-all text-sm leading-5 text-[#1F2430]", children: activeTransferDepositAddress }),
26278
+ /* @__PURE__ */ jsx(
26279
+ "button",
26280
+ {
26281
+ onClick: () => copyToClipboard(activeTransferDepositAddress, "depositAddress"),
26282
+ className: `flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg transition-colors ${copiedField === "depositAddress" ? "bg-green-100 text-green-600" : "text-[#7042D2] hover:bg-purple-50"}`,
26283
+ "aria-label": "Copy wallet address",
26284
+ children: copiedField === "depositAddress" ? /* @__PURE__ */ jsx("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }) : /* @__PURE__ */ jsx("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" }) })
26285
+ }
26286
+ )
26287
+ ] })
26288
+ ] })
26289
+ ] }),
26290
+ renderUnderpaymentWarning(
26291
+ "Important!",
26292
+ "This is the same wallet address for your underpaid transaction. Send only the remaining offset amount, and make sure to add network fees on top of it."
26293
+ ),
26294
+ (manualCheckStatus === "not_found" || ccManualCheckStatus === "not_found") && /* @__PURE__ */ jsx("div", { className: "mb-3 rounded-xl border border-amber-200 bg-amber-50 p-3", children: /* @__PURE__ */ jsx("p", { className: "text-sm leading-5 text-amber-700", children: "We have not detected the offset yet. It can take a few moments to appear on-chain, and we will keep checking automatically." }) })
26295
+ ] });
26296
+ const renderUnderpaymentRefundPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
26297
+ renderUnderpaymentWarning(
26298
+ `Refund of $${formatAmount(underpaymentInfo.receivedAmount || 0)} ${underpaymentInfo.tokenSymbol}`,
26299
+ `Provide a ${underpaymentInfo.tokenSymbol} wallet address on the same network (${underpaymentInfo.refundNetworkLabel}) to receive your refund. Network fees will be deducted.`
26300
+ ),
26301
+ /* @__PURE__ */ jsxs("label", { className: "mb-2 block text-xs font-medium text-[#111827]", children: [
26302
+ "Your ",
26303
+ underpaymentInfo.tokenSymbol,
26304
+ " (",
26305
+ underpaymentInfo.refundNetworkLabel,
26306
+ ") receiving wallet address"
26307
+ ] }),
26308
+ /* @__PURE__ */ jsx(
26309
+ "input",
26310
+ {
26311
+ type: "text",
26312
+ value: refundAddress,
26313
+ onChange: (event) => setRefundAddress(event.target.value),
26314
+ placeholder: "Paste your wallet address here",
26315
+ className: "mb-5 h-11 w-full rounded-xl border border-[#E4E6EB] bg-white px-3 text-sm text-[#1F2430] outline-none transition-colors placeholder:text-[#8B8E98] focus:border-[#B49AF0]"
26316
+ }
26317
+ ),
26318
+ refundRequestMessage && /* @__PURE__ */ jsx("p", { className: `mt-2 text-center text-xs leading-5 ${refundRequestStatus === "error" ? "text-red-600" : "text-[#8B8E98]"}`, children: refundRequestMessage })
26319
+ ] });
26196
26320
  networks.filter((network) => {
26197
26321
  const chainId = parseInt(network.chainId);
26198
26322
  const supportedChains = [8453, 56, 42161, 137, 10, 43114, 143, 59144, 534352, 130];
@@ -26738,14 +26862,7 @@ const CoinleyPaymentInternal = ({
26738
26862
  disabled: !ccOriginToken || ccGenerating || isConverting
26739
26863
  });
26740
26864
  }
26741
- if (isCrossChainTransferAddressView) {
26742
- return renderFooterPrimaryButton({
26743
- label: ccManualCheckStatus === "checking" ? "Checking for your payment..." : "I've made transfer",
26744
- onClick: handleCrossChainManualCheck,
26745
- disabled: ccManualCheckStatus === "checking" || ccPhase === "received" || ccPhase === "settled"
26746
- });
26747
- }
26748
- if (activeTab === PAYMENT_TABS.TRANSFER && selectedNetwork && selectedToken && (paymentData == null ? void 0 : paymentData.depositAddress) && underpaymentInfo) {
26865
+ if (activeTab === PAYMENT_TABS.TRANSFER && activeTransferDepositAddress && underpaymentInfo) {
26749
26866
  if (underpaymentView === "choice") {
26750
26867
  return renderFooterPrimaryButton({
26751
26868
  label: "Continue",
@@ -26755,9 +26872,9 @@ const CoinleyPaymentInternal = ({
26755
26872
  }
26756
26873
  if (underpaymentView === "offset") {
26757
26874
  return renderFooterPrimaryButton({
26758
- label: manualCheckStatus === "checking" ? "Checking for your payment..." : "I've made transfer",
26759
- onClick: handleDepositManualCheck,
26760
- disabled: manualCheckStatus === "checking"
26875
+ label: manualCheckStatus === "checking" || ccManualCheckStatus === "checking" ? "Checking for your payment..." : "I've made transfer",
26876
+ onClick: ccResult ? handleCrossChainManualCheck : handleDepositManualCheck,
26877
+ disabled: manualCheckStatus === "checking" || ccManualCheckStatus === "checking"
26761
26878
  });
26762
26879
  }
26763
26880
  if (underpaymentView === "refund") {
@@ -26768,6 +26885,13 @@ const CoinleyPaymentInternal = ({
26768
26885
  });
26769
26886
  }
26770
26887
  }
26888
+ if (isCrossChainTransferAddressView) {
26889
+ return renderFooterPrimaryButton({
26890
+ label: ccManualCheckStatus === "checking" ? "Checking for your payment..." : "I've made transfer",
26891
+ onClick: handleCrossChainManualCheck,
26892
+ disabled: ccManualCheckStatus === "checking" || ccPhase === "received" || ccPhase === "settled"
26893
+ });
26894
+ }
26771
26895
  if (activeTab === PAYMENT_TABS.TRANSFER && selectedNetwork && selectedToken && (paymentData == null ? void 0 : paymentData.depositAddress) && !(expirationTime == null ? void 0 : expirationTime.expired)) {
26772
26896
  return renderFooterPrimaryButton({
26773
26897
  label: manualCheckStatus === "checking" ? "Checking for your payment..." : manualCheckStatus === "not_found" ? "Check again" : "I've made this transfer",
@@ -27160,20 +27284,26 @@ const CoinleyPaymentInternal = ({
27160
27284
  ] })
27161
27285
  ] })
27162
27286
  ] }),
27163
- renderUnderpaymentWarning(
27164
- "Important!",
27165
- "Use this wallet address for this transfer only. Send from the selected network and include enough native token for network fees."
27166
- ),
27167
- ccManualCheckStatus === "not_found" && /* @__PURE__ */ jsx("div", { className: "mb-3 rounded-xl border border-amber-200 bg-amber-50 p-3", children: /* @__PURE__ */ jsx("p", { className: "text-sm leading-5 text-amber-700", children: "We have not detected your transfer yet. It can take a few moments to appear on-chain, and we will keep checking automatically." }) }),
27168
- ccPhase === "failed" ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-center text-xs font-medium text-red-600", children: "Payment failed — please try again" }) : ccPhase === "received" || ccPhase === "settled" ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 text-xs font-medium text-green-600", children: [
27169
- /* @__PURE__ */ jsx("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-green-500" }),
27170
- "Payment received"
27171
- ] }) : /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 text-xs text-[#A3A5AC]", children: [
27172
- /* @__PURE__ */ jsxs("span", { className: "relative flex h-2 w-2", children: [
27173
- /* @__PURE__ */ jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75" }),
27174
- /* @__PURE__ */ jsx("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-green-500" })
27175
- ] }),
27176
- "Checking automatically every few seconds..."
27287
+ underpaymentInfo ? /* @__PURE__ */ jsxs(Fragment, { children: [
27288
+ underpaymentView === "choice" && renderUnderpaymentChoicePanel(),
27289
+ underpaymentView === "offset" && renderUnderpaymentOffsetPanel(),
27290
+ underpaymentView === "refund" && renderUnderpaymentRefundPanel()
27291
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
27292
+ renderUnderpaymentWarning(
27293
+ "Important!",
27294
+ "Use this wallet address for this transfer only. Send from the selected network and include enough native token for network fees."
27295
+ ),
27296
+ ccManualCheckStatus === "not_found" && /* @__PURE__ */ jsx("div", { className: "mb-3 rounded-xl border border-amber-200 bg-amber-50 p-3", children: /* @__PURE__ */ jsx("p", { className: "text-sm leading-5 text-amber-700", children: "We have not detected your transfer yet. It can take a few moments to appear on-chain, and we will keep checking automatically." }) }),
27297
+ ccPhase === "failed" ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-center text-xs font-medium text-red-600", children: "Payment failed — please try again" }) : ccPhase === "received" || ccPhase === "settled" ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 text-xs font-medium text-green-600", children: [
27298
+ /* @__PURE__ */ jsx("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-green-500" }),
27299
+ "Payment received"
27300
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 text-xs text-[#A3A5AC]", children: [
27301
+ /* @__PURE__ */ jsxs("span", { className: "relative flex h-2 w-2", children: [
27302
+ /* @__PURE__ */ jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75" }),
27303
+ /* @__PURE__ */ jsx("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-green-500" })
27304
+ ] }),
27305
+ "Checking automatically every few seconds..."
27306
+ ] })
27177
27307
  ] })
27178
27308
  ] })
27179
27309
  ] }),
@@ -27345,4 +27475,4 @@ export {
27345
27475
  isFeatureEnabled as i,
27346
27476
  logo as l
27347
27477
  };
27348
- //# sourceMappingURL=CoinleyPayment-D8aL6ChX.js.map
27478
+ //# sourceMappingURL=CoinleyPayment-CckYt7S9.js.map
@@ -1,4 +1,4 @@
1
- import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID, l as logo } from "./CoinleyPayment-D8aL6ChX.js";
1
+ import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID, l as logo } from "./CoinleyPayment-CckYt7S9.js";
2
2
  let appKitInstance = null;
3
3
  let isInitializing = false;
4
4
  let initializationPromise = null;
@@ -112,4 +112,4 @@ export {
112
112
  initializeAppKitEVM,
113
113
  openAppKitModal
114
114
  };
115
- //# sourceMappingURL=appKitEVM-eozvDNUh.js.map
115
+ //# sourceMappingURL=appKitEVM-BCaK3hpo.js.map
@@ -1,4 +1,4 @@
1
- import { F as FEATURES, l as logo, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-D8aL6ChX.js";
1
+ import { F as FEATURES, l as logo, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-CckYt7S9.js";
2
2
  let appKitInstance = null;
3
3
  let isInitializing = false;
4
4
  let initializationPromise = null;
@@ -242,4 +242,4 @@ export {
242
242
  disconnectWalletConnect,
243
243
  initializeAppKitSolana
244
244
  };
245
- //# sourceMappingURL=appKitSolana-C1LLrCaN.js.map
245
+ //# sourceMappingURL=appKitSolana-CHe_HukM.js.map