coinley-pay 0.44.0 → 0.46.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.
- package/dist/{CoinleyPayment-DyKwmgOv.js → CoinleyPayment-BZZKQO96.js} +203 -90
- package/dist/{appKitEVM-UnYPliV_.js → appKitEVM-zLHXb4kV.js} +2 -2
- package/dist/{appKitSolana-CG78TZQO.js → appKitSolana-CcEv9c6h.js} +2 -2
- package/dist/coinley-vanilla.min.js +576 -576
- package/dist/{index-BxLKbwy5.js → index-BFwilphb.js} +3 -3
- package/dist/{index-BKIoJ0GG.js → index-Fh9oknzD.js} +3 -3
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -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-
|
|
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-BFwilphb.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-
|
|
21125
|
+
const { createWalletConnectAdapter } = await import("./appKitSolana-CcEv9c6h.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-
|
|
21230
|
+
const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-zLHXb4kV.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-
|
|
21250
|
+
const { initializeAppKitSolana } = await import("./appKitSolana-CcEv9c6h.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();
|
|
@@ -23317,7 +23318,6 @@ const CoinleyPaymentInternal = ({
|
|
|
23317
23318
|
const [ccError, setCcError] = useState(null);
|
|
23318
23319
|
const [ccGenerating, setCcGenerating] = useState(false);
|
|
23319
23320
|
const [ccManualCheckStatus, setCcManualCheckStatus] = useState("idle");
|
|
23320
|
-
const [transferNoticeModal, setTransferNoticeModal] = useState(null);
|
|
23321
23321
|
const ccSucceeded = useRef(false);
|
|
23322
23322
|
const ccStatusPollInFlight = useRef(false);
|
|
23323
23323
|
const [networkSearch, setNetworkSearch] = useState("");
|
|
@@ -23351,7 +23351,11 @@ const CoinleyPaymentInternal = ({
|
|
|
23351
23351
|
const [refundRequestMessage, setRefundRequestMessage] = useState("");
|
|
23352
23352
|
const [offsetSuccessDetails, setOffsetSuccessDetails] = useState(null);
|
|
23353
23353
|
const [refundSuccessDetails, setRefundSuccessDetails] = useState(null);
|
|
23354
|
+
const [recoveryLoadingAction, setRecoveryLoadingAction] = useState(null);
|
|
23355
|
+
const [recoveryLoadingStatus, setRecoveryLoadingStatus] = 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;
|
|
@@ -23453,9 +23457,6 @@ const CoinleyPaymentInternal = ({
|
|
|
23453
23457
|
} = paymentFlow;
|
|
23454
23458
|
const activeTransferPaymentId = (paymentData == null ? void 0 : paymentData.id) || (ccResult == null ? void 0 : ccResult.id) || (ccResult == null ? void 0 : ccResult.paymentId);
|
|
23455
23459
|
const activeTransferDepositAddress = (paymentData == null ? void 0 : paymentData.depositAddress) || (ccResult == null ? void 0 : ccResult.relayDepositAddress) || (ccResult == null ? void 0 : ccResult.depositAddress);
|
|
23456
|
-
const showTransferNoticeModal = useCallback((message, title = "Transfer not detected yet") => {
|
|
23457
|
-
setTransferNoticeModal({ title, message });
|
|
23458
|
-
}, []);
|
|
23459
23460
|
const merchantReceiveNetworks = (merchantNetworks == null ? void 0 : merchantNetworks.length) ? merchantNetworks : networks;
|
|
23460
23461
|
const isMerchantReceiveNetwork = useCallback((network) => {
|
|
23461
23462
|
var _a2;
|
|
@@ -23715,11 +23716,15 @@ const CoinleyPaymentInternal = ({
|
|
|
23715
23716
|
setUnderpaymentView("choice");
|
|
23716
23717
|
setManualCheckStatus(null);
|
|
23717
23718
|
setCcManualCheckStatus(null);
|
|
23719
|
+
setRecoveryLoadingAction(null);
|
|
23720
|
+
setRecoveryLoadingStatus(null);
|
|
23718
23721
|
clearUnderpaymentRecovery(paymentId || activeTransferPaymentId);
|
|
23719
23722
|
}, [activeTransferPaymentId, clearUnderpaymentRecovery]);
|
|
23720
23723
|
useEffect(() => {
|
|
23721
23724
|
setOffsetSuccessDetails(null);
|
|
23722
23725
|
setRefundSuccessDetails(null);
|
|
23726
|
+
setRecoveryLoadingAction(null);
|
|
23727
|
+
setRecoveryLoadingStatus(null);
|
|
23723
23728
|
}, [paymentData == null ? void 0 : paymentData.id]);
|
|
23724
23729
|
const selectedNetworkIsSolana = (selectedNetwork == null ? void 0 : selectedNetwork.chainType) === "solana" || (selectedNetwork == null ? void 0 : selectedNetwork.shortName) === "solana";
|
|
23725
23730
|
const sourceNeedsMerchantBridge = Boolean(
|
|
@@ -24345,6 +24350,12 @@ const CoinleyPaymentInternal = ({
|
|
|
24345
24350
|
setMobilePaymentStarted(false);
|
|
24346
24351
|
setSelectedMobileWallet(null);
|
|
24347
24352
|
setMobileWalletRedirecting(null);
|
|
24353
|
+
setRecoveryLoadingAction(null);
|
|
24354
|
+
setRecoveryLoadingStatus(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,111 @@ 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
|
+
setRecoveryLoadingStatus(null);
|
|
25183
|
+
}, []);
|
|
25184
|
+
const runAfterRecoveryMinimum = useCallback((callback) => {
|
|
25185
|
+
const elapsed = Date.now() - recoveryLoadingStartedAt.current;
|
|
25186
|
+
const delay = Math.max(RECOVERY_LOADING_MIN_MS - elapsed, 0);
|
|
25187
|
+
if (recoveryLoadingTimeout.current) {
|
|
25188
|
+
clearTimeout(recoveryLoadingTimeout.current);
|
|
25189
|
+
}
|
|
25190
|
+
recoveryLoadingTimeout.current = setTimeout(() => {
|
|
25191
|
+
recoveryLoadingTimeout.current = null;
|
|
25192
|
+
if (typeof callback === "function") {
|
|
25193
|
+
callback();
|
|
25194
|
+
}
|
|
25195
|
+
}, delay);
|
|
25196
|
+
}, []);
|
|
25197
|
+
const finishRecoveryLoading = useCallback((callback) => {
|
|
25198
|
+
runAfterRecoveryMinimum(() => {
|
|
25199
|
+
setRecoveryLoadingAction(null);
|
|
25200
|
+
setRecoveryLoadingStatus(null);
|
|
25201
|
+
if (typeof callback === "function") {
|
|
25202
|
+
callback();
|
|
25203
|
+
}
|
|
25204
|
+
});
|
|
25205
|
+
}, [runAfterRecoveryMinimum]);
|
|
25206
|
+
const holdRecoveryLoading = useCallback((action, status) => {
|
|
25207
|
+
runAfterRecoveryMinimum(() => {
|
|
25208
|
+
setRecoveryLoadingAction(action);
|
|
25209
|
+
setRecoveryLoadingStatus({ action, ...status });
|
|
25210
|
+
});
|
|
25211
|
+
}, [runAfterRecoveryMinimum]);
|
|
25212
|
+
const getOffsetWaitingStatus = useCallback((overrides = {}) => {
|
|
25213
|
+
const shortfallLabel = underpaymentInfo ? `${formatAmount(underpaymentInfo.shortfallAmount || underpaymentInfo.amountRemaining || 0)} ${underpaymentInfo.tokenSymbol || (selectedToken == null ? void 0 : selectedToken.symbol) || ""}`.trim() : "the remaining amount";
|
|
25214
|
+
const networkLabel = (underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel) || (selectedNetwork == null ? void 0 : selectedNetwork.name) || (selectedNetwork == null ? void 0 : selectedNetwork.shortName) || "the selected network";
|
|
25215
|
+
return {
|
|
25216
|
+
title: "Still checking your offset",
|
|
25217
|
+
description: "We have not detected your offset yet. Keep this screen open; we will keep checking automatically.",
|
|
25218
|
+
detail: `Waiting for ${shortfallLabel} on ${networkLabel}.`,
|
|
25219
|
+
...overrides
|
|
25220
|
+
};
|
|
25221
|
+
}, [selectedNetwork == null ? void 0 : selectedNetwork.name, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo]);
|
|
25222
|
+
const getRefundPendingStatus = useCallback(() => ({
|
|
25223
|
+
title: "Refund request received",
|
|
25224
|
+
description: "We will process it automatically.",
|
|
25225
|
+
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"}.`
|
|
25226
|
+
}), [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]);
|
|
25227
|
+
useEffect(() => () => {
|
|
25228
|
+
if (recoveryLoadingTimeout.current) {
|
|
25229
|
+
clearTimeout(recoveryLoadingTimeout.current);
|
|
25230
|
+
}
|
|
25231
|
+
}, []);
|
|
25164
25232
|
const handleCrossChainManualCheck = async () => {
|
|
25165
25233
|
if (!(ccResult == null ? void 0 : ccResult.id) || ccManualCheckStatus === "checking") return;
|
|
25234
|
+
const isOffsetRecovery = Boolean(underpaymentInfo && underpaymentView === "offset");
|
|
25166
25235
|
setCcManualCheckStatus("checking");
|
|
25167
25236
|
setCcError(null);
|
|
25168
25237
|
try {
|
|
25169
25238
|
const status = await paymentFlow.api.getCrossChainStatus(ccResult.id);
|
|
25170
25239
|
setCcPhase(status.phase);
|
|
25171
25240
|
if (activateUnderpaymentFromCrossChainStatus(status)) {
|
|
25172
|
-
|
|
25241
|
+
if (isOffsetRecovery) {
|
|
25242
|
+
setCcManualCheckStatus("not_found");
|
|
25243
|
+
holdRecoveryLoading("offset", getOffsetWaitingStatus());
|
|
25244
|
+
} else {
|
|
25245
|
+
setCcManualCheckStatus(null);
|
|
25246
|
+
}
|
|
25173
25247
|
} else if (status.phase === "bridging") {
|
|
25174
|
-
|
|
25175
|
-
|
|
25248
|
+
if (isOffsetRecovery) {
|
|
25249
|
+
holdRecoveryLoading("offset", getOffsetWaitingStatus({
|
|
25250
|
+
title: "Transfer detected",
|
|
25251
|
+
description: "We have detected your offset and are waiting for processing to complete.",
|
|
25252
|
+
detail: "We will keep checking automatically."
|
|
25253
|
+
}));
|
|
25254
|
+
} else {
|
|
25255
|
+
finishRecoveryLoading(() => {
|
|
25256
|
+
clearUnderpaymentUiState(status.paymentId || ccResult.id);
|
|
25257
|
+
setCcManualCheckStatus("idle");
|
|
25258
|
+
});
|
|
25259
|
+
}
|
|
25176
25260
|
} else if ((status.phase === "received" || status.phase === "settled") && !ccSucceeded.current) {
|
|
25177
|
-
|
|
25178
|
-
|
|
25261
|
+
finishRecoveryLoading(() => {
|
|
25262
|
+
ccSucceeded.current = true;
|
|
25263
|
+
onSuccess == null ? void 0 : onSuccess(status);
|
|
25264
|
+
});
|
|
25179
25265
|
} else if (status.phase === "failed") {
|
|
25180
|
-
|
|
25266
|
+
finishRecoveryLoading(() => {
|
|
25267
|
+
setCcManualCheckStatus("failed");
|
|
25268
|
+
});
|
|
25181
25269
|
} else {
|
|
25182
25270
|
setCcManualCheckStatus("not_found");
|
|
25183
|
-
|
|
25271
|
+
if (isOffsetRecovery) {
|
|
25272
|
+
holdRecoveryLoading("offset", getOffsetWaitingStatus());
|
|
25273
|
+
}
|
|
25184
25274
|
}
|
|
25185
25275
|
} catch (error2) {
|
|
25186
|
-
|
|
25187
|
-
|
|
25276
|
+
finishRecoveryLoading(() => {
|
|
25277
|
+
setCcError(error2.message || "Could not check this payment yet. Please try again.");
|
|
25278
|
+
setCcManualCheckStatus("idle");
|
|
25279
|
+
});
|
|
25188
25280
|
}
|
|
25189
25281
|
};
|
|
25190
25282
|
useEffect(() => {
|
|
@@ -26055,9 +26147,10 @@ const CoinleyPaymentInternal = ({
|
|
|
26055
26147
|
writeUnderpaymentRecovery(underpaymentChoice, underpaymentView, underpaymentInfo);
|
|
26056
26148
|
}, [paymentData == null ? void 0 : paymentData.id, underpaymentInfo, underpaymentChoice, underpaymentView, writeUnderpaymentRecovery]);
|
|
26057
26149
|
const handleRefundRequestSubmit = useCallback(async () => {
|
|
26058
|
-
var _a2
|
|
26150
|
+
var _a2;
|
|
26059
26151
|
const trimmedAddress = refundAddress.trim();
|
|
26060
26152
|
if (!trimmedAddress || !activeTransferPaymentId || refundRequestStatus === "submitting") return;
|
|
26153
|
+
startRecoveryLoading("refund");
|
|
26061
26154
|
setRefundRequestStatus("submitting");
|
|
26062
26155
|
setRefundRequestMessage("");
|
|
26063
26156
|
setManualCheckStatus(null);
|
|
@@ -26084,24 +26177,29 @@ const CoinleyPaymentInternal = ({
|
|
|
26084
26177
|
setRefundRequestSubmitted(true);
|
|
26085
26178
|
setRefundRequestStatus(refundStatus === "refunded" ? "refunded" : "pending");
|
|
26086
26179
|
if (refundStatus === "refunded") {
|
|
26087
|
-
|
|
26088
|
-
|
|
26089
|
-
|
|
26090
|
-
|
|
26180
|
+
finishRecoveryLoading(() => {
|
|
26181
|
+
var _a3;
|
|
26182
|
+
setRefundRequestMessage("");
|
|
26183
|
+
captureRefundSuccessDetails(result == null ? void 0 : result.payment, (_a3 = result == null ? void 0 : result.payment) == null ? void 0 : _a3.refundTxHash, trimmedAddress);
|
|
26184
|
+
clearUnderpaymentRecovery(activeTransferPaymentId);
|
|
26185
|
+
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
26186
|
+
});
|
|
26091
26187
|
} else {
|
|
26092
|
-
const refundMessage = "Refund request received. We will process it automatically.";
|
|
26093
26188
|
setRefundRequestMessage("");
|
|
26094
|
-
|
|
26189
|
+
holdRecoveryLoading("refund", getRefundPendingStatus());
|
|
26095
26190
|
}
|
|
26096
26191
|
} catch (error2) {
|
|
26097
26192
|
console.warn("[RefundRequest] Error:", error2.message);
|
|
26098
|
-
|
|
26099
|
-
|
|
26100
|
-
|
|
26193
|
+
finishRecoveryLoading(() => {
|
|
26194
|
+
setRefundRequestSubmitted(false);
|
|
26195
|
+
setRefundRequestStatus("error");
|
|
26196
|
+
setRefundRequestMessage(error2.message || "Failed to submit refund request. Please try again.");
|
|
26197
|
+
});
|
|
26101
26198
|
}
|
|
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,
|
|
26199
|
+
}, [activeTransferPaymentId, captureRefundSuccessDetails, ccOriginChainId, ccOriginToken == null ? void 0 : ccOriginToken.symbol, clearUnderpaymentRecovery, config, finishRecoveryLoading, getRefundPendingStatus, holdRecoveryLoading, refundAddress, refundRequestStatus, paymentFlow.api, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, startRecoveryLoading, underpaymentInfo]);
|
|
26103
26200
|
const handleDepositManualCheck = useCallback(async () => {
|
|
26104
26201
|
if (manualCheckStatus === "checking" || !(paymentData == null ? void 0 : paymentData.id)) return;
|
|
26202
|
+
const isOffsetRecovery = Boolean(underpaymentInfo && underpaymentView === "offset");
|
|
26105
26203
|
setManualCheckStatus("checking");
|
|
26106
26204
|
try {
|
|
26107
26205
|
const statusResult = await paymentFlow.api.getDepositStatus(paymentData.id);
|
|
@@ -26109,55 +26207,79 @@ const CoinleyPaymentInternal = ({
|
|
|
26109
26207
|
const status = statusResult.payment.status;
|
|
26110
26208
|
const txHash = resolvePaymentTransactionHash(statusResult.payment);
|
|
26111
26209
|
if ((status === "completed" || status === "swept") && txHash) {
|
|
26112
|
-
|
|
26113
|
-
|
|
26114
|
-
|
|
26115
|
-
|
|
26116
|
-
|
|
26117
|
-
|
|
26118
|
-
|
|
26119
|
-
|
|
26120
|
-
onSuccess
|
|
26121
|
-
|
|
26122
|
-
|
|
26123
|
-
|
|
26124
|
-
|
|
26125
|
-
|
|
26126
|
-
|
|
26127
|
-
|
|
26128
|
-
|
|
26210
|
+
finishRecoveryLoading(() => {
|
|
26211
|
+
setManualCheckStatus(null);
|
|
26212
|
+
captureOffsetSuccessDetails(statusResult.payment, txHash);
|
|
26213
|
+
clearUnderpaymentRecovery(paymentData.id);
|
|
26214
|
+
persistSuccessfulPaymentHash(statusResult.payment, txHash);
|
|
26215
|
+
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
26216
|
+
sdkAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
|
|
26217
|
+
clarityAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
|
|
26218
|
+
if (onSuccess) {
|
|
26219
|
+
onSuccess({
|
|
26220
|
+
paymentId: paymentData.id,
|
|
26221
|
+
transactionHash: txHash,
|
|
26222
|
+
depositAddress: statusResult.payment.depositAddress,
|
|
26223
|
+
network: selectedNetwork == null ? void 0 : selectedNetwork.shortName,
|
|
26224
|
+
currency: selectedToken == null ? void 0 : selectedToken.symbol,
|
|
26225
|
+
paymentDetails: statusResult.payment
|
|
26226
|
+
});
|
|
26227
|
+
}
|
|
26228
|
+
});
|
|
26129
26229
|
return;
|
|
26130
26230
|
}
|
|
26131
26231
|
if (activateUnderpaymentFlow(statusResult.payment)) {
|
|
26232
|
+
if (isOffsetRecovery) {
|
|
26233
|
+
setManualCheckStatus("not_found");
|
|
26234
|
+
holdRecoveryLoading("offset", getOffsetWaitingStatus());
|
|
26235
|
+
}
|
|
26132
26236
|
return;
|
|
26133
26237
|
}
|
|
26134
26238
|
if (status === "processing" || statusResult.payment.depositDetectedAt) {
|
|
26135
|
-
|
|
26136
|
-
|
|
26137
|
-
|
|
26239
|
+
finishRecoveryLoading(() => {
|
|
26240
|
+
setManualCheckStatus(null);
|
|
26241
|
+
clearUnderpaymentRecovery(paymentData.id);
|
|
26242
|
+
setCurrentStep(PAYMENT_STEPS.PROCESSING);
|
|
26243
|
+
});
|
|
26138
26244
|
return;
|
|
26139
26245
|
}
|
|
26140
26246
|
}
|
|
26141
26247
|
if (paymentData == null ? void 0 : paymentData.depositAddress) {
|
|
26142
26248
|
const balanceResult = await paymentFlow.api.getDepositBalance(paymentData.id);
|
|
26143
26249
|
if ((balanceResult == null ? void 0 : balanceResult.success) && activateUnderpaymentFromDepositBalance(balanceResult)) {
|
|
26250
|
+
if (isOffsetRecovery) {
|
|
26251
|
+
setManualCheckStatus("not_found");
|
|
26252
|
+
holdRecoveryLoading("offset", getOffsetWaitingStatus());
|
|
26253
|
+
}
|
|
26144
26254
|
return;
|
|
26145
26255
|
}
|
|
26146
26256
|
}
|
|
26147
|
-
|
|
26148
|
-
|
|
26149
|
-
|
|
26150
|
-
|
|
26151
|
-
|
|
26257
|
+
finishRecoveryLoading(() => {
|
|
26258
|
+
setManualCheckStatus("not_found");
|
|
26259
|
+
if (isOffsetRecovery) {
|
|
26260
|
+
setRecoveryLoadingAction("offset");
|
|
26261
|
+
setRecoveryLoadingStatus({ action: "offset", ...getOffsetWaitingStatus() });
|
|
26262
|
+
return;
|
|
26263
|
+
}
|
|
26264
|
+
manualCheckTimeout.current = setTimeout(() => {
|
|
26265
|
+
setManualCheckStatus(null);
|
|
26266
|
+
}, 1e4);
|
|
26267
|
+
});
|
|
26152
26268
|
} catch (error2) {
|
|
26153
26269
|
console.warn("[ManualCheck] Error:", error2.message);
|
|
26154
|
-
|
|
26155
|
-
|
|
26156
|
-
|
|
26157
|
-
|
|
26158
|
-
|
|
26270
|
+
finishRecoveryLoading(() => {
|
|
26271
|
+
setManualCheckStatus("not_found");
|
|
26272
|
+
if (isOffsetRecovery) {
|
|
26273
|
+
setRecoveryLoadingAction("offset");
|
|
26274
|
+
setRecoveryLoadingStatus({ action: "offset", ...getOffsetWaitingStatus() });
|
|
26275
|
+
return;
|
|
26276
|
+
}
|
|
26277
|
+
manualCheckTimeout.current = setTimeout(() => {
|
|
26278
|
+
setManualCheckStatus(null);
|
|
26279
|
+
}, 1e4);
|
|
26280
|
+
});
|
|
26159
26281
|
}
|
|
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,
|
|
26282
|
+
}, [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, getOffsetWaitingStatus, holdRecoveryLoading]);
|
|
26161
26283
|
const truncateAddress = (addr) => {
|
|
26162
26284
|
if (!addr) return "";
|
|
26163
26285
|
return `${addr.slice(0, 4)}......${addr.slice(-4)}`;
|
|
@@ -26535,10 +26657,10 @@ const CoinleyPaymentInternal = ({
|
|
|
26535
26657
|
/* @__PURE__ */ jsx("p", { className: "text-xs leading-5 text-[#535865]", children: detail })
|
|
26536
26658
|
] })
|
|
26537
26659
|
] });
|
|
26538
|
-
const renderUnderpaymentOffsetPanel = () =>
|
|
26539
|
-
title: "Checking your offset",
|
|
26540
|
-
description: "We are checking the blockchain for your offset payment. This usually takes a few seconds.",
|
|
26541
|
-
detail: `Waiting for the remaining ${underpaymentOffsetAmountLabel} on ${underpaymentInfo.refundNetworkLabel || getOffsetSuccessNetworkName(selectedNetwork)}.`
|
|
26660
|
+
const renderUnderpaymentOffsetPanel = () => recoveryLoadingAction === "offset" ? renderRecoveryLoadingPanel({
|
|
26661
|
+
title: (recoveryLoadingStatus == null ? void 0 : recoveryLoadingStatus.action) === "offset" ? recoveryLoadingStatus.title : "Checking your offset",
|
|
26662
|
+
description: (recoveryLoadingStatus == null ? void 0 : recoveryLoadingStatus.action) === "offset" ? recoveryLoadingStatus.description : "We are checking the blockchain for your offset payment. This usually takes a few seconds.",
|
|
26663
|
+
detail: (recoveryLoadingStatus == null ? void 0 : recoveryLoadingStatus.action) === "offset" ? recoveryLoadingStatus.detail : `Waiting for the remaining ${underpaymentOffsetAmountLabel} on ${underpaymentInfo.refundNetworkLabel || getOffsetSuccessNetworkName(selectedNetwork)}.`
|
|
26542
26664
|
}) : /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
|
|
26543
26665
|
/* @__PURE__ */ jsxs("div", { className: "mb-5 flex items-start gap-3", children: [
|
|
26544
26666
|
/* @__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" }) }) }),
|
|
@@ -26563,10 +26685,10 @@ const CoinleyPaymentInternal = ({
|
|
|
26563
26685
|
`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.`
|
|
26564
26686
|
)
|
|
26565
26687
|
] });
|
|
26566
|
-
const renderUnderpaymentRefundPanel = () =>
|
|
26567
|
-
title: "Preparing your refund",
|
|
26568
|
-
description: "We are submitting your refund request and checking whether it can be sent immediately.",
|
|
26569
|
-
detail: `Refunding the received ${underpaymentInfo.tokenSymbol} on ${underpaymentInfo.refundNetworkLabel}.`
|
|
26688
|
+
const renderUnderpaymentRefundPanel = () => recoveryLoadingAction === "refund" ? renderRecoveryLoadingPanel({
|
|
26689
|
+
title: (recoveryLoadingStatus == null ? void 0 : recoveryLoadingStatus.action) === "refund" ? recoveryLoadingStatus.title : "Preparing your refund",
|
|
26690
|
+
description: (recoveryLoadingStatus == null ? void 0 : recoveryLoadingStatus.action) === "refund" ? recoveryLoadingStatus.description : "We are submitting your refund request and checking whether it can be sent immediately.",
|
|
26691
|
+
detail: (recoveryLoadingStatus == null ? void 0 : recoveryLoadingStatus.action) === "refund" ? recoveryLoadingStatus.detail : `Refunding the received ${underpaymentInfo.tokenSymbol} on ${underpaymentInfo.refundNetworkLabel}.`
|
|
26570
26692
|
}) : /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
|
|
26571
26693
|
renderUnderpaymentWarning(
|
|
26572
26694
|
`Refund of $${formatAmount(underpaymentInfo.receivedAmount || 0)} ${underpaymentInfo.tokenSymbol}`,
|
|
@@ -27177,17 +27299,24 @@ const CoinleyPaymentInternal = ({
|
|
|
27177
27299
|
});
|
|
27178
27300
|
}
|
|
27179
27301
|
if (underpaymentView === "offset") {
|
|
27180
|
-
if (
|
|
27302
|
+
if (recoveryLoadingAction === "offset") {
|
|
27181
27303
|
return null;
|
|
27182
27304
|
}
|
|
27183
27305
|
return renderFooterPrimaryButton({
|
|
27184
27306
|
label: "I've made transfer",
|
|
27185
|
-
onClick:
|
|
27307
|
+
onClick: () => {
|
|
27308
|
+
startRecoveryLoading("offset");
|
|
27309
|
+
if (ccResult) {
|
|
27310
|
+
handleCrossChainManualCheck();
|
|
27311
|
+
} else {
|
|
27312
|
+
handleDepositManualCheck();
|
|
27313
|
+
}
|
|
27314
|
+
},
|
|
27186
27315
|
disabled: false
|
|
27187
27316
|
});
|
|
27188
27317
|
}
|
|
27189
27318
|
if (underpaymentView === "refund") {
|
|
27190
|
-
if (
|
|
27319
|
+
if (recoveryLoadingAction === "refund") {
|
|
27191
27320
|
return null;
|
|
27192
27321
|
}
|
|
27193
27322
|
return renderFooterPrimaryButton({
|
|
@@ -27270,23 +27399,6 @@ const CoinleyPaymentInternal = ({
|
|
|
27270
27399
|
/* @__PURE__ */ jsx("p", { className: `${isTightWalletView ? "mt-1" : isCompactCheckoutView ? "mt-2" : "mt-3"} text-xs text-[#A9ABB2]`, children: "Powered by Stablezact" })
|
|
27271
27400
|
] });
|
|
27272
27401
|
};
|
|
27273
|
-
const renderTransferNoticeModal = () => {
|
|
27274
|
-
if (!transferNoticeModal) return null;
|
|
27275
|
-
return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-[70] flex items-center justify-center bg-black/45 px-4", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-[340px] rounded-2xl bg-white p-5 text-center shadow-2xl", children: [
|
|
27276
|
-
/* @__PURE__ */ jsx("div", { className: "mx-auto mb-3 flex h-11 w-11 items-center justify-center rounded-full bg-amber-50 text-amber-600", children: /* @__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: 2, d: "M12 9v4m0 4h.01M12 3a9 9 0 110 18 9 9 0 010-18z" }) }) }),
|
|
27277
|
-
/* @__PURE__ */ jsx("h3", { className: "mb-2 text-base font-semibold text-[#111827]", children: transferNoticeModal.title }),
|
|
27278
|
-
/* @__PURE__ */ jsx("p", { className: "mb-5 text-sm leading-5 text-[#6B7280]", children: transferNoticeModal.message }),
|
|
27279
|
-
/* @__PURE__ */ jsx(
|
|
27280
|
-
"button",
|
|
27281
|
-
{
|
|
27282
|
-
type: "button",
|
|
27283
|
-
onClick: () => setTransferNoticeModal(null),
|
|
27284
|
-
className: "h-11 w-full rounded-xl bg-[#7042D2] px-4 text-sm font-semibold text-white transition-colors hover:bg-[#5b34b1]",
|
|
27285
|
-
children: "Got it"
|
|
27286
|
-
}
|
|
27287
|
-
)
|
|
27288
|
-
] }) });
|
|
27289
|
-
};
|
|
27290
27402
|
const renderTabContent = () => {
|
|
27291
27403
|
var _a2, _b, _c, _d;
|
|
27292
27404
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -27699,6 +27811,8 @@ const CoinleyPaymentInternal = ({
|
|
|
27699
27811
|
const isWalletTokenSelectionView = activeTab === PAYMENT_TABS.WALLET && selectedNetwork && !selectedToken && !showWalletConfirm && !(showMobileWalletPicker && isMobile);
|
|
27700
27812
|
const isQrPaymentActiveView = activeTab === PAYMENT_TABS.QR && qrWalletChoiceConfirmed;
|
|
27701
27813
|
const handleTransferAddressBack = async () => {
|
|
27814
|
+
setRecoveryLoadingAction(null);
|
|
27815
|
+
setRecoveryLoadingStatus(null);
|
|
27702
27816
|
if (underpaymentInfo && underpaymentView !== "choice") {
|
|
27703
27817
|
setUnderpaymentView("choice");
|
|
27704
27818
|
return;
|
|
@@ -27792,8 +27906,7 @@ const CoinleyPaymentInternal = ({
|
|
|
27792
27906
|
/* @__PURE__ */ jsx("div", { className: `min-h-0 flex-1 ${isCheckoutDropdownOpen ? "overflow-visible" : "overflow-y-auto coinley-scroll"} pb-1`, children: renderTabContent() }),
|
|
27793
27907
|
renderCheckoutFooter()
|
|
27794
27908
|
] })
|
|
27795
|
-
] }) })
|
|
27796
|
-
renderTransferNoticeModal()
|
|
27909
|
+
] }) })
|
|
27797
27910
|
] });
|
|
27798
27911
|
};
|
|
27799
27912
|
const CoinleyPayment = (props) => {
|
|
@@ -27829,4 +27942,4 @@ export {
|
|
|
27829
27942
|
chainTransports as c,
|
|
27830
27943
|
isFeatureEnabled as i
|
|
27831
27944
|
};
|
|
27832
|
-
//# sourceMappingURL=CoinleyPayment-
|
|
27945
|
+
//# sourceMappingURL=CoinleyPayment-BZZKQO96.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-
|
|
1
|
+
import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-BZZKQO96.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-
|
|
116
|
+
//# sourceMappingURL=appKitEVM-zLHXb4kV.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FEATURES, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-
|
|
1
|
+
import { F as FEATURES, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-BZZKQO96.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-
|
|
246
|
+
//# sourceMappingURL=appKitSolana-CcEv9c6h.js.map
|