coinley-pay 0.61.0 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CoinleyPayment-BofSrJBx.js → CoinleyPayment-CkjhX3Ry.js} +55 -15
- package/dist/{appKitEVM-BzMDYdux.js → appKitEVM-Dsu3B87G.js} +2 -2
- package/dist/{appKitSolana-C_InTqyc.js → appKitSolana-Qc2Ml_-f.js} +2 -2
- package/dist/coinley-vanilla.min.js +580 -580
- package/dist/{index-DOz8Wmjm.js → index-DT3Awo19.js} +3 -3
- package/dist/{index-Dssajde4.js → index-EVIUXV4Y.js} +3 -3
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +4 -4
- package/package.json +2 -1
|
@@ -6,7 +6,7 @@ import { useState, useRef, useEffect, useCallback, useMemo } from "react";
|
|
|
6
6
|
import ReactDOM, { createPortal } from "react-dom";
|
|
7
7
|
import { useConnect, useAccount, useSwitchChain, useSendTransaction, useWaitForTransactionReceipt, WagmiProvider, useDisconnect } from "wagmi";
|
|
8
8
|
import { QueryClientProvider, QueryClient } from "@tanstack/react-query";
|
|
9
|
-
import { s as sdkAnalytics, c as clarityAnalytics, d as dist, a as Buffer2, B as Buffer$1, g as getCurrencyInfo, p as prefetchRates, i as isSupportedCurrency, b as convertToUSD, f as formatCurrency } from "./index-
|
|
9
|
+
import { s as sdkAnalytics, c as clarityAnalytics, d as dist, a as Buffer2, B as Buffer$1, g as getCurrencyInfo, p as prefetchRates, i as isSupportedCurrency, b as convertToUSD, f as formatCurrency } from "./index-EVIUXV4Y.js";
|
|
10
10
|
import { createConfig, fallback, http, getAccount as getAccount$1, getWalletClient, simulateContract, writeContract, readContract, waitForTransactionReceipt, estimateFeesPerGas as estimateFeesPerGas$1 } from "@wagmi/core";
|
|
11
11
|
import { injected, metaMask, coinbaseWallet, walletConnect } from "@wagmi/connectors";
|
|
12
12
|
import { defineChain as defineChain$1, erc20Abi, http as http$1, createPublicClient, fallback as fallback$1 } from "viem";
|
|
@@ -21126,7 +21126,7 @@ const WalletSelector = ({
|
|
|
21126
21126
|
try {
|
|
21127
21127
|
setAppKitError(null);
|
|
21128
21128
|
setWalletConnectAddress(solanaAccountState.address);
|
|
21129
|
-
const { createWalletConnectAdapter } = await import("./appKitSolana-
|
|
21129
|
+
const { createWalletConnectAdapter } = await import("./appKitSolana-Qc2Ml_-f.js");
|
|
21130
21130
|
const adapter = createWalletConnectAdapter(solanaAccountState.address);
|
|
21131
21131
|
await solanaWallet.connectWalletConnect(adapter, solanaAccountState.address);
|
|
21132
21132
|
console.log("✅ WalletConnect synced with SDK");
|
|
@@ -21231,7 +21231,7 @@ const WalletSelector = ({
|
|
|
21231
21231
|
setAppKitLoading(true);
|
|
21232
21232
|
setAppKitError(null);
|
|
21233
21233
|
try {
|
|
21234
|
-
const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-
|
|
21234
|
+
const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-Dsu3B87G.js");
|
|
21235
21235
|
await initializeAppKitEVM(wagmiConfig);
|
|
21236
21236
|
await openAppKitModal();
|
|
21237
21237
|
} catch (error) {
|
|
@@ -21251,7 +21251,7 @@ const WalletSelector = ({
|
|
|
21251
21251
|
setAppKitError(null);
|
|
21252
21252
|
try {
|
|
21253
21253
|
console.log("📦 Loading AppKit Solana module...");
|
|
21254
|
-
const { initializeAppKitSolana } = await import("./appKitSolana-
|
|
21254
|
+
const { initializeAppKitSolana } = await import("./appKitSolana-Qc2Ml_-f.js");
|
|
21255
21255
|
console.log("✅ Module loaded, initializing...");
|
|
21256
21256
|
const modal = await initializeAppKitSolana(solanaWallet);
|
|
21257
21257
|
console.log("✅ AppKit Solana initialized successfully");
|
|
@@ -23128,6 +23128,29 @@ const injectCoinleyFonts = () => {
|
|
|
23128
23128
|
`;
|
|
23129
23129
|
document.head.appendChild(style);
|
|
23130
23130
|
};
|
|
23131
|
+
const FIVE_MINUTES_MS = 5 * 60 * 1e3;
|
|
23132
|
+
const TEN_MINUTES_MS = 10 * 60 * 1e3;
|
|
23133
|
+
const getRefundPendingGuidance = (elapsedMs = 0) => {
|
|
23134
|
+
if (elapsedMs >= TEN_MINUTES_MS) {
|
|
23135
|
+
return {
|
|
23136
|
+
title: "Refund is taking longer than expected",
|
|
23137
|
+
description: "Your refund is still being processed. You can safely close this window while we continue in the background.",
|
|
23138
|
+
eta: "Most refunds arrive within 15 minutes. If yours does not, check again later or contact support with your payment ID."
|
|
23139
|
+
};
|
|
23140
|
+
}
|
|
23141
|
+
if (elapsedMs >= FIVE_MINUTES_MS) {
|
|
23142
|
+
return {
|
|
23143
|
+
title: "Refund is still being processed",
|
|
23144
|
+
description: "Your refund request has been accepted and is still processing. You do not need to keep this window open.",
|
|
23145
|
+
eta: "Most refunds at this stage arrive within about 10 minutes."
|
|
23146
|
+
};
|
|
23147
|
+
}
|
|
23148
|
+
return {
|
|
23149
|
+
title: "Refund request received",
|
|
23150
|
+
description: "Your refund is being processed automatically. You can safely close this window.",
|
|
23151
|
+
eta: "Most refunds arrive within about 5 minutes."
|
|
23152
|
+
};
|
|
23153
|
+
};
|
|
23131
23154
|
const CHECKOUT_BUILD = "checkout-2026-04-22b-route-destination-trials";
|
|
23132
23155
|
const UNDERPAYMENT_RECOVERY_STORAGE_PREFIX = "coinley_underpayment_recovery:";
|
|
23133
23156
|
const UNDERPAYMENT_RECOVERY_TTL_MS = 2 * 60 * 60 * 1e3;
|
|
@@ -23361,6 +23384,7 @@ const CoinleyPaymentInternal = ({
|
|
|
23361
23384
|
const manualCheckTimeout = useRef(null);
|
|
23362
23385
|
const recoveryLoadingStartedAt = useRef(0);
|
|
23363
23386
|
const recoveryLoadingTimeout = useRef(null);
|
|
23387
|
+
const refundPendingStartedAt = useRef(0);
|
|
23364
23388
|
const [copiedField, setCopiedField] = useState(null);
|
|
23365
23389
|
const [expirationTime, setExpirationTime] = useState(null);
|
|
23366
23390
|
const STANDARD_PAYMENT_TIMEOUT_MS = 15 * 60 * 1e3;
|
|
@@ -25377,6 +25401,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25377
25401
|
setRecoveryLoadingStatus({ action, ...status });
|
|
25378
25402
|
});
|
|
25379
25403
|
}, [runAfterRecoveryMinimum]);
|
|
25404
|
+
const getRefundPendingElapsedMs = useCallback(() => refundPendingStartedAt.current ? Math.max(Date.now() - refundPendingStartedAt.current, 0) : 0, []);
|
|
25380
25405
|
const getOffsetWaitingStatus = useCallback((overrides = {}) => {
|
|
25381
25406
|
const shortfallLabel = underpaymentInfo ? `${formatAmount(underpaymentInfo.shortfallAmount || underpaymentInfo.amountRemaining || 0)} ${underpaymentInfo.tokenSymbol || (selectedToken == null ? void 0 : selectedToken.symbol) || ""}`.trim() : "the remaining amount";
|
|
25382
25407
|
const networkLabel = (underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel) || (selectedNetwork == null ? void 0 : selectedNetwork.name) || (selectedNetwork == null ? void 0 : selectedNetwork.shortName) || "the selected network";
|
|
@@ -25387,24 +25412,27 @@ const CoinleyPaymentInternal = ({
|
|
|
25387
25412
|
...overrides
|
|
25388
25413
|
};
|
|
25389
25414
|
}, [selectedNetwork == null ? void 0 : selectedNetwork.name, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo]);
|
|
25390
|
-
const getRefundPendingStatus = useCallback(() =>
|
|
25391
|
-
|
|
25392
|
-
|
|
25393
|
-
|
|
25394
|
-
|
|
25415
|
+
const getRefundPendingStatus = useCallback(() => {
|
|
25416
|
+
const guidance = getRefundPendingGuidance(getRefundPendingElapsedMs());
|
|
25417
|
+
return {
|
|
25418
|
+
...guidance,
|
|
25419
|
+
detail: `${guidance.eta} Refunding the received ${(underpaymentInfo == null ? void 0 : underpaymentInfo.tokenSymbol) || (selectedToken == null ? void 0 : selectedToken.symbol) || "tokens"} on ${(underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel) || (selectedNetwork == null ? void 0 : selectedNetwork.name) || (selectedNetwork == null ? void 0 : selectedNetwork.shortName) || "the selected network"}.`
|
|
25420
|
+
};
|
|
25421
|
+
}, [getRefundPendingElapsedMs, selectedNetwork == null ? void 0 : selectedNetwork.name, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel, underpaymentInfo == null ? void 0 : underpaymentInfo.tokenSymbol]);
|
|
25395
25422
|
const getCrossChainRefundPendingStatus = useCallback((status = ccRefundPendingInfo) => {
|
|
25396
25423
|
var _a2, _b, _c, _d;
|
|
25397
25424
|
const details = (status == null ? void 0 : status.refundPendingDetails) || {};
|
|
25398
25425
|
const tokenSymbol = ((_a2 = status == null ? void 0 : status.underpayment) == null ? void 0 : _a2.tokenSymbol) || ((_b = status == null ? void 0 : status.underpayment) == null ? void 0 : _b.currency) || (underpaymentInfo == null ? void 0 : underpaymentInfo.tokenSymbol) || (ccOriginToken == null ? void 0 : ccOriginToken.symbol) || (selectedToken == null ? void 0 : selectedToken.symbol) || "tokens";
|
|
25399
25426
|
const networkLabel = ((_c = status == null ? void 0 : status.underpayment) == null ? void 0 : _c.refundNetworkLabel) || (underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel) || ccChainName(((_d = status == null ? void 0 : status.relay) == null ? void 0 : _d.originChainId) || (ccResult == null ? void 0 : ccResult.originChainId) || ccOriginChainId);
|
|
25400
25427
|
const refundAddressLabel = (status == null ? void 0 : status.refundRecipient) || refundAddress.trim();
|
|
25428
|
+
const guidance = getRefundPendingGuidance(getRefundPendingElapsedMs());
|
|
25401
25429
|
const available = details.available && details.available !== "0.0" ? ` Relay has returned ${details.available} ${tokenSymbol}.` : "";
|
|
25402
25430
|
return {
|
|
25403
|
-
title:
|
|
25404
|
-
description:
|
|
25405
|
-
detail:
|
|
25431
|
+
title: guidance.title,
|
|
25432
|
+
description: guidance.description,
|
|
25433
|
+
detail: `${guidance.eta} Refund will be sent as ${tokenSymbol} on ${networkLabel}${refundAddressLabel ? ` to ${truncateAddress(refundAddressLabel)}` : ""}.${available}`
|
|
25406
25434
|
};
|
|
25407
|
-
}, [ccOriginChainId, ccOriginToken == null ? void 0 : ccOriginToken.symbol, ccRefundPendingInfo, ccResult == null ? void 0 : ccResult.originChainId, refundAddress, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel, underpaymentInfo == null ? void 0 : underpaymentInfo.tokenSymbol]);
|
|
25435
|
+
}, [ccOriginChainId, ccOriginToken == null ? void 0 : ccOriginToken.symbol, ccRefundPendingInfo, ccResult == null ? void 0 : ccResult.originChainId, getRefundPendingElapsedMs, refundAddress, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo == null ? void 0 : underpaymentInfo.refundNetworkLabel, underpaymentInfo == null ? void 0 : underpaymentInfo.tokenSymbol]);
|
|
25408
25436
|
useEffect(() => () => {
|
|
25409
25437
|
if (recoveryLoadingTimeout.current) {
|
|
25410
25438
|
clearTimeout(recoveryLoadingTimeout.current);
|
|
@@ -25419,6 +25447,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25419
25447
|
const status = await paymentFlow.api.getCrossChainStatus(ccResult.id);
|
|
25420
25448
|
setCcPhase(status.phase);
|
|
25421
25449
|
if (status.refundStatus === "refunded") {
|
|
25450
|
+
refundPendingStartedAt.current = 0;
|
|
25422
25451
|
finishRecoveryLoading(() => {
|
|
25423
25452
|
setCcRefundPendingInfo(null);
|
|
25424
25453
|
ccSucceeded.current = true;
|
|
@@ -25429,6 +25458,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25429
25458
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
25430
25459
|
});
|
|
25431
25460
|
} else if (status.refundStatus === "pending") {
|
|
25461
|
+
refundPendingStartedAt.current = refundPendingStartedAt.current || Date.now();
|
|
25432
25462
|
activateUnderpaymentFromCrossChainStatus(status);
|
|
25433
25463
|
setCcRefundPendingInfo(status);
|
|
25434
25464
|
setRefundRequestSubmitted(true);
|
|
@@ -25498,6 +25528,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25498
25528
|
if (cancelled) return;
|
|
25499
25529
|
setCcPhase(s.phase);
|
|
25500
25530
|
if (s.refundStatus === "refunded") {
|
|
25531
|
+
refundPendingStartedAt.current = 0;
|
|
25501
25532
|
ccSucceeded.current = true;
|
|
25502
25533
|
setCcRefundPendingInfo(null);
|
|
25503
25534
|
setRefundRequestStatus("refunded");
|
|
@@ -25506,6 +25537,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25506
25537
|
clearUnderpaymentRecovery(s.paymentId || ccResult.id);
|
|
25507
25538
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
25508
25539
|
} else if (s.refundStatus === "pending") {
|
|
25540
|
+
refundPendingStartedAt.current = refundPendingStartedAt.current || Date.now();
|
|
25509
25541
|
activateUnderpaymentFromCrossChainStatus(s);
|
|
25510
25542
|
setCcRefundPendingInfo(s);
|
|
25511
25543
|
setRefundRequestSubmitted(true);
|
|
@@ -26357,6 +26389,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26357
26389
|
setUnderpaymentChoice(recoveryState.choice);
|
|
26358
26390
|
setUnderpaymentView(recoveryState.view === "refund" ? "refund" : "offset");
|
|
26359
26391
|
setManualCheckStatus(null);
|
|
26392
|
+
refundPendingStartedAt.current = 0;
|
|
26360
26393
|
setRefundRequestSubmitted(false);
|
|
26361
26394
|
setRefundRequestStatus(null);
|
|
26362
26395
|
setRefundRequestMessage("");
|
|
@@ -26366,6 +26399,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26366
26399
|
setUnderpaymentChoice(null);
|
|
26367
26400
|
setUnderpaymentView("choice");
|
|
26368
26401
|
setRefundAddress("");
|
|
26402
|
+
refundPendingStartedAt.current = 0;
|
|
26369
26403
|
setRefundRequestSubmitted(false);
|
|
26370
26404
|
setRefundRequestStatus(null);
|
|
26371
26405
|
setRefundRequestMessage("");
|
|
@@ -26381,6 +26415,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26381
26415
|
const trimmedAddress = refundAddress.trim();
|
|
26382
26416
|
if (!trimmedAddress || !activeTransferPaymentId || refundRequestStatus === "submitting") return;
|
|
26383
26417
|
startRecoveryLoading("refund");
|
|
26418
|
+
refundPendingStartedAt.current = Date.now();
|
|
26384
26419
|
setRefundRequestStatus("submitting");
|
|
26385
26420
|
setRefundRequestMessage("");
|
|
26386
26421
|
setManualCheckStatus(null);
|
|
@@ -26413,6 +26448,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26413
26448
|
setRefundRequestSubmitted(true);
|
|
26414
26449
|
setRefundRequestStatus(refundStatus === "refunded" ? "refunded" : "pending");
|
|
26415
26450
|
if (refundStatus === "refunded") {
|
|
26451
|
+
refundPendingStartedAt.current = 0;
|
|
26416
26452
|
finishRecoveryLoading(() => {
|
|
26417
26453
|
var _a3;
|
|
26418
26454
|
setRefundRequestMessage("");
|
|
@@ -26421,6 +26457,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26421
26457
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
26422
26458
|
});
|
|
26423
26459
|
} else {
|
|
26460
|
+
refundPendingStartedAt.current = refundPendingStartedAt.current || Date.now();
|
|
26424
26461
|
setRefundRequestMessage("");
|
|
26425
26462
|
if (ccResult) {
|
|
26426
26463
|
const pendingStatus = {
|
|
@@ -26438,6 +26475,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26438
26475
|
}
|
|
26439
26476
|
}
|
|
26440
26477
|
} catch (error2) {
|
|
26478
|
+
refundPendingStartedAt.current = 0;
|
|
26441
26479
|
console.warn("[RefundRequest] Error:", error2.message);
|
|
26442
26480
|
finishRecoveryLoading(() => {
|
|
26443
26481
|
setRefundRequestSubmitted(false);
|
|
@@ -26835,7 +26873,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26835
26873
|
/* @__PURE__ */ jsx("div", { className: "flex overflow-hidden rounded-xl bg-[#F6F6F7] p-1", children: [
|
|
26836
26874
|
{ tab: PAYMENT_TABS.TRANSFER, label: "Transfer to address", mobileLabel: "Transfer" },
|
|
26837
26875
|
{ tab: PAYMENT_TABS.QR, label: "QR Code", mobileLabel: "QR Code" },
|
|
26838
|
-
{ tab: PAYMENT_TABS.WALLET, label: "Wallet Extension", mobileLabel: "Wallet" }
|
|
26876
|
+
{ tab: PAYMENT_TABS.WALLET, label: "Wallet Extension", mobileLabel: "Wallet Extension" }
|
|
26839
26877
|
].map((method) => /* @__PURE__ */ jsx(
|
|
26840
26878
|
"button",
|
|
26841
26879
|
{
|
|
@@ -27525,6 +27563,7 @@ const CoinleyPaymentInternal = ({
|
|
|
27525
27563
|
);
|
|
27526
27564
|
const handleUnderpaymentChoiceContinue = () => {
|
|
27527
27565
|
if (!underpaymentChoice) return;
|
|
27566
|
+
refundPendingStartedAt.current = 0;
|
|
27528
27567
|
setRefundRequestSubmitted(false);
|
|
27529
27568
|
const nextView = underpaymentChoice === "refund" ? "refund" : "offset";
|
|
27530
27569
|
writeUnderpaymentRecovery(underpaymentChoice, nextView, underpaymentInfo);
|
|
@@ -28135,6 +28174,7 @@ const CoinleyPaymentInternal = ({
|
|
|
28135
28174
|
setUnderpaymentChoice(null);
|
|
28136
28175
|
setUnderpaymentView("choice");
|
|
28137
28176
|
setRefundAddress("");
|
|
28177
|
+
refundPendingStartedAt.current = 0;
|
|
28138
28178
|
setRefundRequestSubmitted(false);
|
|
28139
28179
|
setRefundRequestStatus(null);
|
|
28140
28180
|
setRefundRequestMessage("");
|
|
@@ -28238,4 +28278,4 @@ export {
|
|
|
28238
28278
|
chainTransports as c,
|
|
28239
28279
|
isFeatureEnabled as i
|
|
28240
28280
|
};
|
|
28241
|
-
//# sourceMappingURL=CoinleyPayment-
|
|
28281
|
+
//# sourceMappingURL=CoinleyPayment-CkjhX3Ry.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-
|
|
1
|
+
import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-CkjhX3Ry.js";
|
|
2
2
|
const logo = "https://coinley.io/logo.png";
|
|
3
3
|
let appKitInstance = null;
|
|
4
4
|
let isInitializing = false;
|
|
@@ -113,4 +113,4 @@ export {
|
|
|
113
113
|
initializeAppKitEVM,
|
|
114
114
|
openAppKitModal
|
|
115
115
|
};
|
|
116
|
-
//# sourceMappingURL=appKitEVM-
|
|
116
|
+
//# sourceMappingURL=appKitEVM-Dsu3B87G.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-CkjhX3Ry.js";
|
|
2
2
|
const logo = "https://coinley.io/logo.png";
|
|
3
3
|
let appKitInstance = null;
|
|
4
4
|
let isInitializing = false;
|
|
@@ -243,4 +243,4 @@ export {
|
|
|
243
243
|
disconnectWalletConnect,
|
|
244
244
|
initializeAppKitSolana
|
|
245
245
|
};
|
|
246
|
-
//# sourceMappingURL=appKitSolana-
|
|
246
|
+
//# sourceMappingURL=appKitSolana-Qc2Ml_-f.js.map
|