coinley-pay 0.43.0 → 0.45.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-CV3EsiAj.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-CyqvsmiG.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";
@@ -21122,7 +21122,7 @@ const WalletSelector = ({
21122
21122
  try {
21123
21123
  setAppKitError(null);
21124
21124
  setWalletConnectAddress(solanaAccountState.address);
21125
- const { createWalletConnectAdapter } = await import("./appKitSolana-Bisj88pX.js");
21125
+ const { createWalletConnectAdapter } = await import("./appKitSolana-BmONG1Sf.js");
21126
21126
  const adapter = createWalletConnectAdapter(solanaAccountState.address);
21127
21127
  await solanaWallet.connectWalletConnect(adapter, solanaAccountState.address);
21128
21128
  console.log("✅ WalletConnect synced with SDK");
@@ -21227,7 +21227,7 @@ const WalletSelector = ({
21227
21227
  setAppKitLoading(true);
21228
21228
  setAppKitError(null);
21229
21229
  try {
21230
- const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-DtRSGjqO.js");
21230
+ const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-Dxo1Z_69.js");
21231
21231
  await initializeAppKitEVM(wagmiConfig);
21232
21232
  await openAppKitModal();
21233
21233
  } catch (error) {
@@ -21247,7 +21247,7 @@ const WalletSelector = ({
21247
21247
  setAppKitError(null);
21248
21248
  try {
21249
21249
  console.log("📦 Loading AppKit Solana module...");
21250
- const { initializeAppKitSolana } = await import("./appKitSolana-Bisj88pX.js");
21250
+ const { initializeAppKitSolana } = await import("./appKitSolana-BmONG1Sf.js");
21251
21251
  console.log("✅ Module loaded, initializing...");
21252
21252
  const modal = await initializeAppKitSolana(solanaWallet);
21253
21253
  console.log("✅ AppKit Solana initialized successfully");
@@ -23132,6 +23132,7 @@ const injectCoinleyFonts = () => {
23132
23132
  const CHECKOUT_BUILD = "checkout-2026-04-22b-route-destination-trials";
23133
23133
  const UNDERPAYMENT_RECOVERY_STORAGE_PREFIX = "coinley_underpayment_recovery:";
23134
23134
  const UNDERPAYMENT_RECOVERY_TTL_MS = 2 * 60 * 60 * 1e3;
23135
+ const RECOVERY_LOADING_MIN_MS = 1200;
23135
23136
  const normalizeEvmAddress = (value) => {
23136
23137
  if (typeof value !== "string") return null;
23137
23138
  const trimmed = value.trim();
@@ -23351,7 +23352,10 @@ const CoinleyPaymentInternal = ({
23351
23352
  const [refundRequestMessage, setRefundRequestMessage] = useState("");
23352
23353
  const [offsetSuccessDetails, setOffsetSuccessDetails] = useState(null);
23353
23354
  const [refundSuccessDetails, setRefundSuccessDetails] = useState(null);
23355
+ const [recoveryLoadingAction, setRecoveryLoadingAction] = useState(null);
23354
23356
  const manualCheckTimeout = useRef(null);
23357
+ const recoveryLoadingStartedAt = useRef(0);
23358
+ const recoveryLoadingTimeout = useRef(null);
23355
23359
  const [copiedField, setCopiedField] = useState(null);
23356
23360
  const [expirationTime, setExpirationTime] = useState(null);
23357
23361
  const STANDARD_PAYMENT_TIMEOUT_MS = 15 * 60 * 1e3;
@@ -23715,11 +23719,13 @@ const CoinleyPaymentInternal = ({
23715
23719
  setUnderpaymentView("choice");
23716
23720
  setManualCheckStatus(null);
23717
23721
  setCcManualCheckStatus(null);
23722
+ setRecoveryLoadingAction(null);
23718
23723
  clearUnderpaymentRecovery(paymentId || activeTransferPaymentId);
23719
23724
  }, [activeTransferPaymentId, clearUnderpaymentRecovery]);
23720
23725
  useEffect(() => {
23721
23726
  setOffsetSuccessDetails(null);
23722
23727
  setRefundSuccessDetails(null);
23728
+ setRecoveryLoadingAction(null);
23723
23729
  }, [paymentData == null ? void 0 : paymentData.id]);
23724
23730
  const selectedNetworkIsSolana = (selectedNetwork == null ? void 0 : selectedNetwork.chainType) === "solana" || (selectedNetwork == null ? void 0 : selectedNetwork.shortName) === "solana";
23725
23731
  const sourceNeedsMerchantBridge = Boolean(
@@ -24345,6 +24351,11 @@ const CoinleyPaymentInternal = ({
24345
24351
  setMobilePaymentStarted(false);
24346
24352
  setSelectedMobileWallet(null);
24347
24353
  setMobileWalletRedirecting(null);
24354
+ setRecoveryLoadingAction(null);
24355
+ if (recoveryLoadingTimeout.current) {
24356
+ clearTimeout(recoveryLoadingTimeout.current);
24357
+ recoveryLoadingTimeout.current = null;
24358
+ }
24348
24359
  if (typeof window !== "undefined" && window.sessionStorage) {
24349
24360
  sessionStorage.removeItem("coinley_mobile_payment_started");
24350
24361
  }
@@ -25161,30 +25172,77 @@ const CoinleyPaymentInternal = ({
25161
25172
  setCcGenerating(false);
25162
25173
  }
25163
25174
  };
25175
+ const startRecoveryLoading = useCallback((action) => {
25176
+ if (recoveryLoadingTimeout.current) {
25177
+ clearTimeout(recoveryLoadingTimeout.current);
25178
+ recoveryLoadingTimeout.current = null;
25179
+ }
25180
+ recoveryLoadingStartedAt.current = Date.now();
25181
+ setRecoveryLoadingAction(action);
25182
+ }, []);
25183
+ const finishRecoveryLoading = useCallback((callback) => {
25184
+ const elapsed = Date.now() - recoveryLoadingStartedAt.current;
25185
+ const delay = Math.max(RECOVERY_LOADING_MIN_MS - elapsed, 0);
25186
+ if (recoveryLoadingTimeout.current) {
25187
+ clearTimeout(recoveryLoadingTimeout.current);
25188
+ }
25189
+ recoveryLoadingTimeout.current = setTimeout(() => {
25190
+ recoveryLoadingTimeout.current = null;
25191
+ setRecoveryLoadingAction(null);
25192
+ if (typeof callback === "function") {
25193
+ callback();
25194
+ }
25195
+ }, delay);
25196
+ }, []);
25197
+ useEffect(() => () => {
25198
+ if (recoveryLoadingTimeout.current) {
25199
+ clearTimeout(recoveryLoadingTimeout.current);
25200
+ }
25201
+ }, []);
25164
25202
  const handleCrossChainManualCheck = async () => {
25165
25203
  if (!(ccResult == null ? void 0 : ccResult.id) || ccManualCheckStatus === "checking") return;
25204
+ const isOffsetRecovery = Boolean(underpaymentInfo && underpaymentView === "offset");
25166
25205
  setCcManualCheckStatus("checking");
25167
25206
  setCcError(null);
25168
25207
  try {
25169
25208
  const status = await paymentFlow.api.getCrossChainStatus(ccResult.id);
25170
25209
  setCcPhase(status.phase);
25171
25210
  if (activateUnderpaymentFromCrossChainStatus(status)) {
25172
- setCcManualCheckStatus(null);
25211
+ if (isOffsetRecovery) {
25212
+ finishRecoveryLoading(() => {
25213
+ setCcManualCheckStatus("not_found");
25214
+ showTransferNoticeModal("We have not detected your offset yet. It can take a few moments to appear on-chain, and we will keep checking automatically.");
25215
+ });
25216
+ } else {
25217
+ setCcManualCheckStatus(null);
25218
+ }
25173
25219
  } else if (status.phase === "bridging") {
25174
- clearUnderpaymentUiState(status.paymentId || ccResult.id);
25175
- showTransferNoticeModal("We have detected your transfer and are waiting for the bridge to complete. We will keep checking automatically.", "Transfer detected");
25220
+ finishRecoveryLoading(() => {
25221
+ clearUnderpaymentUiState(status.paymentId || ccResult.id);
25222
+ showTransferNoticeModal("We have detected your transfer and are waiting for the bridge to complete. We will keep checking automatically.", "Transfer detected");
25223
+ });
25176
25224
  } else if ((status.phase === "received" || status.phase === "settled") && !ccSucceeded.current) {
25177
- ccSucceeded.current = true;
25178
- onSuccess == null ? void 0 : onSuccess(status);
25225
+ finishRecoveryLoading(() => {
25226
+ ccSucceeded.current = true;
25227
+ onSuccess == null ? void 0 : onSuccess(status);
25228
+ });
25179
25229
  } else if (status.phase === "failed") {
25180
- setCcManualCheckStatus("failed");
25230
+ finishRecoveryLoading(() => {
25231
+ setCcManualCheckStatus("failed");
25232
+ });
25181
25233
  } else {
25182
- setCcManualCheckStatus("not_found");
25183
- showTransferNoticeModal("We have not detected your transfer yet. It can take a few moments to appear on-chain, and we will keep checking automatically.");
25234
+ finishRecoveryLoading(() => {
25235
+ setCcManualCheckStatus("not_found");
25236
+ showTransferNoticeModal(
25237
+ isOffsetRecovery ? "We have not detected your offset yet. It can take a few moments to appear on-chain, and we will keep checking automatically." : "We have not detected your transfer yet. It can take a few moments to appear on-chain, and we will keep checking automatically."
25238
+ );
25239
+ });
25184
25240
  }
25185
25241
  } catch (error2) {
25186
- setCcError(error2.message || "Could not check this payment yet. Please try again.");
25187
- setCcManualCheckStatus("idle");
25242
+ finishRecoveryLoading(() => {
25243
+ setCcError(error2.message || "Could not check this payment yet. Please try again.");
25244
+ setCcManualCheckStatus("idle");
25245
+ });
25188
25246
  }
25189
25247
  };
25190
25248
  useEffect(() => {
@@ -26055,9 +26113,10 @@ const CoinleyPaymentInternal = ({
26055
26113
  writeUnderpaymentRecovery(underpaymentChoice, underpaymentView, underpaymentInfo);
26056
26114
  }, [paymentData == null ? void 0 : paymentData.id, underpaymentInfo, underpaymentChoice, underpaymentView, writeUnderpaymentRecovery]);
26057
26115
  const handleRefundRequestSubmit = useCallback(async () => {
26058
- var _a2, _b;
26116
+ var _a2;
26059
26117
  const trimmedAddress = refundAddress.trim();
26060
26118
  if (!trimmedAddress || !activeTransferPaymentId || refundRequestStatus === "submitting") return;
26119
+ startRecoveryLoading("refund");
26061
26120
  setRefundRequestStatus("submitting");
26062
26121
  setRefundRequestMessage("");
26063
26122
  setManualCheckStatus(null);
@@ -26084,24 +26143,32 @@ const CoinleyPaymentInternal = ({
26084
26143
  setRefundRequestSubmitted(true);
26085
26144
  setRefundRequestStatus(refundStatus === "refunded" ? "refunded" : "pending");
26086
26145
  if (refundStatus === "refunded") {
26087
- setRefundRequestMessage("");
26088
- captureRefundSuccessDetails(result == null ? void 0 : result.payment, (_b = result == null ? void 0 : result.payment) == null ? void 0 : _b.refundTxHash, trimmedAddress);
26089
- clearUnderpaymentRecovery(activeTransferPaymentId);
26090
- setCurrentStep(PAYMENT_STEPS.SUCCESS);
26146
+ finishRecoveryLoading(() => {
26147
+ var _a3;
26148
+ setRefundRequestMessage("");
26149
+ captureRefundSuccessDetails(result == null ? void 0 : result.payment, (_a3 = result == null ? void 0 : result.payment) == null ? void 0 : _a3.refundTxHash, trimmedAddress);
26150
+ clearUnderpaymentRecovery(activeTransferPaymentId);
26151
+ setCurrentStep(PAYMENT_STEPS.SUCCESS);
26152
+ });
26091
26153
  } else {
26092
26154
  const refundMessage = "Refund request received. We will process it automatically.";
26093
- setRefundRequestMessage("");
26094
- showTransferNoticeModal(refundMessage, "Refund request received");
26155
+ finishRecoveryLoading(() => {
26156
+ setRefundRequestMessage("");
26157
+ showTransferNoticeModal(refundMessage, "Refund request received");
26158
+ });
26095
26159
  }
26096
26160
  } catch (error2) {
26097
26161
  console.warn("[RefundRequest] Error:", error2.message);
26098
- setRefundRequestSubmitted(false);
26099
- setRefundRequestStatus("error");
26100
- setRefundRequestMessage(error2.message || "Failed to submit refund request. Please try again.");
26162
+ finishRecoveryLoading(() => {
26163
+ setRefundRequestSubmitted(false);
26164
+ setRefundRequestStatus("error");
26165
+ setRefundRequestMessage(error2.message || "Failed to submit refund request. Please try again.");
26166
+ });
26101
26167
  }
26102
- }, [activeTransferPaymentId, captureRefundSuccessDetails, 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, showTransferNoticeModal, underpaymentInfo]);
26168
+ }, [activeTransferPaymentId, captureRefundSuccessDetails, ccOriginChainId, ccOriginToken == null ? void 0 : ccOriginToken.symbol, clearUnderpaymentRecovery, config, finishRecoveryLoading, refundAddress, refundRequestStatus, paymentFlow.api, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, showTransferNoticeModal, startRecoveryLoading, underpaymentInfo]);
26103
26169
  const handleDepositManualCheck = useCallback(async () => {
26104
26170
  if (manualCheckStatus === "checking" || !(paymentData == null ? void 0 : paymentData.id)) return;
26171
+ const isOffsetRecovery = Boolean(underpaymentInfo && underpaymentView === "offset");
26105
26172
  setManualCheckStatus("checking");
26106
26173
  try {
26107
26174
  const statusResult = await paymentFlow.api.getDepositStatus(paymentData.id);
@@ -26109,55 +26176,85 @@ const CoinleyPaymentInternal = ({
26109
26176
  const status = statusResult.payment.status;
26110
26177
  const txHash = resolvePaymentTransactionHash(statusResult.payment);
26111
26178
  if ((status === "completed" || status === "swept") && txHash) {
26112
- setManualCheckStatus(null);
26113
- captureOffsetSuccessDetails(statusResult.payment, txHash);
26114
- clearUnderpaymentRecovery(paymentData.id);
26115
- persistSuccessfulPaymentHash(statusResult.payment, txHash);
26116
- setCurrentStep(PAYMENT_STEPS.SUCCESS);
26117
- sdkAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
26118
- clarityAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
26119
- if (onSuccess) {
26120
- onSuccess({
26121
- paymentId: paymentData.id,
26122
- transactionHash: txHash,
26123
- depositAddress: statusResult.payment.depositAddress,
26124
- network: selectedNetwork == null ? void 0 : selectedNetwork.shortName,
26125
- currency: selectedToken == null ? void 0 : selectedToken.symbol,
26126
- paymentDetails: statusResult.payment
26127
- });
26128
- }
26179
+ finishRecoveryLoading(() => {
26180
+ setManualCheckStatus(null);
26181
+ captureOffsetSuccessDetails(statusResult.payment, txHash);
26182
+ clearUnderpaymentRecovery(paymentData.id);
26183
+ persistSuccessfulPaymentHash(statusResult.payment, txHash);
26184
+ setCurrentStep(PAYMENT_STEPS.SUCCESS);
26185
+ sdkAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
26186
+ clarityAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
26187
+ if (onSuccess) {
26188
+ onSuccess({
26189
+ paymentId: paymentData.id,
26190
+ transactionHash: txHash,
26191
+ depositAddress: statusResult.payment.depositAddress,
26192
+ network: selectedNetwork == null ? void 0 : selectedNetwork.shortName,
26193
+ currency: selectedToken == null ? void 0 : selectedToken.symbol,
26194
+ paymentDetails: statusResult.payment
26195
+ });
26196
+ }
26197
+ });
26129
26198
  return;
26130
26199
  }
26131
26200
  if (activateUnderpaymentFlow(statusResult.payment)) {
26201
+ if (isOffsetRecovery) {
26202
+ finishRecoveryLoading(() => {
26203
+ setManualCheckStatus("not_found");
26204
+ showTransferNoticeModal("We have not detected your offset yet. It can take a few moments to appear on-chain, and we will keep checking automatically.");
26205
+ manualCheckTimeout.current = setTimeout(() => {
26206
+ setManualCheckStatus(null);
26207
+ }, 1e4);
26208
+ });
26209
+ }
26132
26210
  return;
26133
26211
  }
26134
26212
  if (status === "processing" || statusResult.payment.depositDetectedAt) {
26135
- setManualCheckStatus(null);
26136
- clearUnderpaymentRecovery(paymentData.id);
26137
- setCurrentStep(PAYMENT_STEPS.PROCESSING);
26213
+ finishRecoveryLoading(() => {
26214
+ setManualCheckStatus(null);
26215
+ clearUnderpaymentRecovery(paymentData.id);
26216
+ setCurrentStep(PAYMENT_STEPS.PROCESSING);
26217
+ });
26138
26218
  return;
26139
26219
  }
26140
26220
  }
26141
26221
  if (paymentData == null ? void 0 : paymentData.depositAddress) {
26142
26222
  const balanceResult = await paymentFlow.api.getDepositBalance(paymentData.id);
26143
26223
  if ((balanceResult == null ? void 0 : balanceResult.success) && activateUnderpaymentFromDepositBalance(balanceResult)) {
26224
+ if (isOffsetRecovery) {
26225
+ finishRecoveryLoading(() => {
26226
+ setManualCheckStatus("not_found");
26227
+ showTransferNoticeModal("We have not detected your offset yet. It can take a few moments to appear on-chain, and we will keep checking automatically.");
26228
+ manualCheckTimeout.current = setTimeout(() => {
26229
+ setManualCheckStatus(null);
26230
+ }, 1e4);
26231
+ });
26232
+ }
26144
26233
  return;
26145
26234
  }
26146
26235
  }
26147
- setManualCheckStatus("not_found");
26148
- showTransferNoticeModal("We have not detected your transfer yet. It can take a few moments to appear on-chain, and we will keep checking automatically.");
26149
- manualCheckTimeout.current = setTimeout(() => {
26150
- setManualCheckStatus(null);
26151
- }, 1e4);
26236
+ finishRecoveryLoading(() => {
26237
+ setManualCheckStatus("not_found");
26238
+ showTransferNoticeModal(
26239
+ isOffsetRecovery ? "We have not detected your offset yet. It can take a few moments to appear on-chain, and we will keep checking automatically." : "We have not detected your transfer yet. It can take a few moments to appear on-chain, and we will keep checking automatically."
26240
+ );
26241
+ manualCheckTimeout.current = setTimeout(() => {
26242
+ setManualCheckStatus(null);
26243
+ }, 1e4);
26244
+ });
26152
26245
  } catch (error2) {
26153
26246
  console.warn("[ManualCheck] Error:", error2.message);
26154
- setManualCheckStatus("not_found");
26155
- showTransferNoticeModal("We have not detected your transfer yet. It can take a few moments to appear on-chain, and we will keep checking automatically.");
26156
- manualCheckTimeout.current = setTimeout(() => {
26157
- setManualCheckStatus(null);
26158
- }, 1e4);
26247
+ finishRecoveryLoading(() => {
26248
+ setManualCheckStatus("not_found");
26249
+ showTransferNoticeModal(
26250
+ isOffsetRecovery ? "We have not detected your offset yet. It can take a few moments to appear on-chain, and we will keep checking automatically." : "We have not detected your transfer yet. It can take a few moments to appear on-chain, and we will keep checking automatically."
26251
+ );
26252
+ manualCheckTimeout.current = setTimeout(() => {
26253
+ setManualCheckStatus(null);
26254
+ }, 1e4);
26255
+ });
26159
26256
  }
26160
- }, [manualCheckStatus, paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, paymentFlow.api, config == null ? void 0 : config.amount, selectedNetwork, selectedToken, onSuccess, activateUnderpaymentFlow, activateUnderpaymentFromDepositBalance, captureOffsetSuccessDetails, clearUnderpaymentRecovery, resolvePaymentTransactionHash, persistSuccessfulPaymentHash, showTransferNoticeModal]);
26257
+ }, [manualCheckStatus, paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, paymentFlow.api, config == null ? void 0 : config.amount, selectedNetwork, selectedToken, onSuccess, underpaymentInfo, underpaymentView, activateUnderpaymentFlow, activateUnderpaymentFromDepositBalance, captureOffsetSuccessDetails, clearUnderpaymentRecovery, resolvePaymentTransactionHash, persistSuccessfulPaymentHash, finishRecoveryLoading, showTransferNoticeModal]);
26161
26258
  const truncateAddress = (addr) => {
26162
26259
  if (!addr) return "";
26163
26260
  return `${addr.slice(0, 4)}......${addr.slice(-4)}`;
@@ -26520,7 +26617,26 @@ const CoinleyPaymentInternal = ({
26520
26617
  })
26521
26618
  ] })
26522
26619
  ] });
26523
- const renderUnderpaymentOffsetPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
26620
+ const renderRecoveryLoadingPanel = ({ title, description, detail }) => /* @__PURE__ */ jsxs("div", { className: "flex min-h-[292px] flex-col items-center justify-center px-3 py-4 text-center", children: [
26621
+ /* @__PURE__ */ jsxs("div", { className: "relative mb-4 flex h-28 w-40 items-center justify-center", children: [
26622
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-x-5 bottom-1 h-4 rounded-full bg-[#7042D2]/10 blur-md" }),
26623
+ /* @__PURE__ */ jsx("img", { src: stablezactLoading, alt: "Processing", className: "relative h-28 w-40 object-contain" })
26624
+ ] }),
26625
+ /* @__PURE__ */ jsx("h3", { className: "mb-2 text-lg font-semibold text-[#111827]", children: title }),
26626
+ /* @__PURE__ */ jsx("p", { className: "mx-auto max-w-[330px] text-sm leading-5 text-[#8B8E98]", children: description }),
26627
+ detail && /* @__PURE__ */ jsxs("div", { className: "mt-5 w-full rounded-xl border border-[#EEF0F4] bg-[#FAFAFB] px-3 py-3 text-left", children: [
26628
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between text-xs", children: [
26629
+ /* @__PURE__ */ jsx("span", { className: "text-[#A3A5AC]", children: "Status" }),
26630
+ /* @__PURE__ */ jsx("span", { className: "font-semibold text-[#7042D2]", children: "Processing" })
26631
+ ] }),
26632
+ /* @__PURE__ */ jsx("p", { className: "text-xs leading-5 text-[#535865]", children: detail })
26633
+ ] })
26634
+ ] });
26635
+ const renderUnderpaymentOffsetPanel = () => recoveryLoadingAction === "offset" ? renderRecoveryLoadingPanel({
26636
+ title: "Checking your offset",
26637
+ description: "We are checking the blockchain for your offset payment. This usually takes a few seconds.",
26638
+ detail: `Waiting for the remaining ${underpaymentOffsetAmountLabel} on ${underpaymentInfo.refundNetworkLabel || getOffsetSuccessNetworkName(selectedNetwork)}.`
26639
+ }) : /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
26524
26640
  /* @__PURE__ */ jsxs("div", { className: "mb-5 flex items-start gap-3", children: [
26525
26641
  /* @__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("img", { src: stablezactLoading, alt: "Loading QR code", className: "h-14 w-16 object-contain" }) }) }),
26526
26642
  /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 pt-1", children: [
@@ -26544,7 +26660,11 @@ const CoinleyPaymentInternal = ({
26544
26660
  `This is the same wallet address for your underpaid transaction. Send only the remaining offset amount (${underpaymentOffsetAmountLabel}) and keep enough native gas in your wallet for the network fee.`
26545
26661
  )
26546
26662
  ] });
26547
- const renderUnderpaymentRefundPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
26663
+ const renderUnderpaymentRefundPanel = () => recoveryLoadingAction === "refund" ? renderRecoveryLoadingPanel({
26664
+ title: "Preparing your refund",
26665
+ description: "We are submitting your refund request and checking whether it can be sent immediately.",
26666
+ detail: `Refunding the received ${underpaymentInfo.tokenSymbol} on ${underpaymentInfo.refundNetworkLabel}.`
26667
+ }) : /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
26548
26668
  renderUnderpaymentWarning(
26549
26669
  `Refund of $${formatAmount(underpaymentInfo.receivedAmount || 0)} ${underpaymentInfo.tokenSymbol}`,
26550
26670
  `Provide a ${underpaymentInfo.tokenSymbol} wallet address on the same network (${underpaymentInfo.refundNetworkLabel}) to receive your refund. Network fees will be deducted.`
@@ -27154,15 +27274,28 @@ const CoinleyPaymentInternal = ({
27154
27274
  });
27155
27275
  }
27156
27276
  if (underpaymentView === "offset") {
27277
+ if (recoveryLoadingAction === "offset") {
27278
+ return null;
27279
+ }
27157
27280
  return renderFooterPrimaryButton({
27158
- label: manualCheckStatus === "checking" || ccManualCheckStatus === "checking" ? "Checking for your payment..." : "I've made transfer",
27159
- onClick: ccResult ? handleCrossChainManualCheck : handleDepositManualCheck,
27160
- disabled: manualCheckStatus === "checking" || ccManualCheckStatus === "checking"
27281
+ label: "I've made transfer",
27282
+ onClick: () => {
27283
+ startRecoveryLoading("offset");
27284
+ if (ccResult) {
27285
+ handleCrossChainManualCheck();
27286
+ } else {
27287
+ handleDepositManualCheck();
27288
+ }
27289
+ },
27290
+ disabled: false
27161
27291
  });
27162
27292
  }
27163
27293
  if (underpaymentView === "refund") {
27294
+ if (recoveryLoadingAction === "refund") {
27295
+ return null;
27296
+ }
27164
27297
  return renderFooterPrimaryButton({
27165
- label: refundRequestStatus === "submitting" ? "Submitting refund request..." : refundRequestSubmitted ? "Refund request submitted" : "Submit refund request",
27298
+ label: refundRequestSubmitted ? "Refund request submitted" : "Submit refund request",
27166
27299
  onClick: handleRefundRequestSubmit,
27167
27300
  disabled: !refundAddress.trim() || refundRequestStatus === "submitting" || refundRequestStatus === "pending" || refundRequestStatus === "refunded"
27168
27301
  });
@@ -27670,6 +27803,7 @@ const CoinleyPaymentInternal = ({
27670
27803
  const isWalletTokenSelectionView = activeTab === PAYMENT_TABS.WALLET && selectedNetwork && !selectedToken && !showWalletConfirm && !(showMobileWalletPicker && isMobile);
27671
27804
  const isQrPaymentActiveView = activeTab === PAYMENT_TABS.QR && qrWalletChoiceConfirmed;
27672
27805
  const handleTransferAddressBack = async () => {
27806
+ setRecoveryLoadingAction(null);
27673
27807
  if (underpaymentInfo && underpaymentView !== "choice") {
27674
27808
  setUnderpaymentView("choice");
27675
27809
  return;
@@ -27800,4 +27934,4 @@ export {
27800
27934
  chainTransports as c,
27801
27935
  isFeatureEnabled as i
27802
27936
  };
27803
- //# sourceMappingURL=CoinleyPayment-B849KAFT.js.map
27937
+ //# sourceMappingURL=CoinleyPayment-CmMOW8Fu.js.map
@@ -1,4 +1,4 @@
1
- import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-B849KAFT.js";
1
+ import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-CmMOW8Fu.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-DtRSGjqO.js.map
116
+ //# sourceMappingURL=appKitEVM-Dxo1Z_69.js.map
@@ -1,4 +1,4 @@
1
- import { F as FEATURES, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-B849KAFT.js";
1
+ import { F as FEATURES, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-CmMOW8Fu.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-Bisj88pX.js.map
246
+ //# sourceMappingURL=appKitSolana-BmONG1Sf.js.map