coinley-pay 0.57.0 → 0.58.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-CvhX-WMY.js → CoinleyPayment-CzdU_Qtr.js} +86 -15
- package/dist/{appKitEVM-BAdtRD8N.js → appKitEVM-CB-nBf-9.js} +2 -2
- package/dist/{appKitSolana-PRcbceg-.js → appKitSolana-CyvPAMFC.js} +2 -2
- package/dist/coinley-vanilla.min.js +1 -1
- package/dist/{index-M3kJQHOT.js → index-CGI_tFbK.js} +3 -3
- package/dist/{index-BEoyCZfx.js → index-DmmbHcNZ.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-CGI_tFbK.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";
|
|
@@ -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-CyvPAMFC.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-CB-nBf-9.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-CyvPAMFC.js");
|
|
21255
21255
|
console.log("✅ Module loaded, initializing...");
|
|
21256
21256
|
const modal = await initializeAppKitSolana(solanaWallet);
|
|
21257
21257
|
console.log("✅ AppKit Solana initialized successfully");
|
|
@@ -23319,6 +23319,7 @@ const CoinleyPaymentInternal = ({
|
|
|
23319
23319
|
const [ccGenerating, setCcGenerating] = useState(false);
|
|
23320
23320
|
const [ccManualCheckStatus, setCcManualCheckStatus] = useState("idle");
|
|
23321
23321
|
const [ccRefundPendingInfo, setCcRefundPendingInfo] = useState(null);
|
|
23322
|
+
const [ccSuccessDetails, setCcSuccessDetails] = useState(null);
|
|
23322
23323
|
const ccSucceeded = useRef(false);
|
|
23323
23324
|
const ccStatusPollInFlight = useRef(false);
|
|
23324
23325
|
const ccSourcesRetryTimer = useRef(null);
|
|
@@ -23526,6 +23527,69 @@ const CoinleyPaymentInternal = ({
|
|
|
23526
23527
|
const resolvePaymentTransactionHash = useCallback((payment) => {
|
|
23527
23528
|
return (payment == null ? void 0 : payment.depositTxHash) || (payment == null ? void 0 : payment.sweepTxHash) || (payment == null ? void 0 : payment.transactionHash) || null;
|
|
23528
23529
|
}, []);
|
|
23530
|
+
const resolveCrossChainTransactionHash = useCallback((status) => {
|
|
23531
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
23532
|
+
return (status == null ? void 0 : status.fillTxHash) || (status == null ? void 0 : status.transactionHash) || ((_a2 = status == null ? void 0 : status.payment) == null ? void 0 : _a2.fillTxHash) || ((_b = status == null ? void 0 : status.payment) == null ? void 0 : _b.transactionHash) || ((_c = status == null ? void 0 : status.payment) == null ? void 0 : _c.depositTxHash) || ((_d = status == null ? void 0 : status.relay) == null ? void 0 : _d.fillTxHash) || ((_e = status == null ? void 0 : status.relay) == null ? void 0 : _e.transactionHash) || ((_f = status == null ? void 0 : status.relay) == null ? void 0 : _f.requestId) || null;
|
|
23533
|
+
}, []);
|
|
23534
|
+
const getNetworkForChainId = useCallback((chainId) => {
|
|
23535
|
+
const normalizedChainId = Number(chainId);
|
|
23536
|
+
if (!Number.isFinite(normalizedChainId)) return selectedNetwork;
|
|
23537
|
+
const candidates = [
|
|
23538
|
+
...merchantReceiveNetworks,
|
|
23539
|
+
...networks,
|
|
23540
|
+
...ccSources
|
|
23541
|
+
];
|
|
23542
|
+
const match = candidates.find((network) => Number(network == null ? void 0 : network.chainId) === normalizedChainId);
|
|
23543
|
+
if (match) return match;
|
|
23544
|
+
const shortNames = {
|
|
23545
|
+
1: "ethereum",
|
|
23546
|
+
56: "bsc",
|
|
23547
|
+
137: "polygon",
|
|
23548
|
+
8453: "base",
|
|
23549
|
+
42161: "arbitrum",
|
|
23550
|
+
10: "optimism",
|
|
23551
|
+
43114: "avalanche",
|
|
23552
|
+
42220: "celo",
|
|
23553
|
+
59144: "linea",
|
|
23554
|
+
534352: "scroll",
|
|
23555
|
+
130: "unichain",
|
|
23556
|
+
143: "monad"
|
|
23557
|
+
};
|
|
23558
|
+
return {
|
|
23559
|
+
id: `chain-${normalizedChainId}`,
|
|
23560
|
+
chainId: normalizedChainId,
|
|
23561
|
+
name: ccChainName(normalizedChainId),
|
|
23562
|
+
shortName: shortNames[normalizedChainId] || `chain-${normalizedChainId}`
|
|
23563
|
+
};
|
|
23564
|
+
}, [ccSources, merchantReceiveNetworks, networks, selectedNetwork]);
|
|
23565
|
+
const captureCrossChainSuccessDetails = useCallback((status) => {
|
|
23566
|
+
var _a2, _b, _c, _d;
|
|
23567
|
+
const transactionHash = resolveCrossChainTransactionHash(status);
|
|
23568
|
+
const relay = (status == null ? void 0 : status.relay) || {};
|
|
23569
|
+
const destinationChainId = relay.destinationChainId || relay.targetChainId;
|
|
23570
|
+
const successNetwork = getNetworkForChainId(destinationChainId || (selectedNetwork == null ? void 0 : selectedNetwork.chainId));
|
|
23571
|
+
const amount = Number(
|
|
23572
|
+
(config == null ? void 0 : config.amount) ?? paymentAmount ?? (status == null ? void 0 : status.amount) ?? ((_a2 = status == null ? void 0 : status.payment) == null ? void 0 : _a2.amount) ?? 0
|
|
23573
|
+
);
|
|
23574
|
+
const successPayment = {
|
|
23575
|
+
...paymentData || {},
|
|
23576
|
+
...(status == null ? void 0 : status.payment) || {},
|
|
23577
|
+
id: (status == null ? void 0 : status.paymentId) || ((_b = status == null ? void 0 : status.payment) == null ? void 0 : _b.id) || (paymentData == null ? void 0 : paymentData.id) || (ccResult == null ? void 0 : ccResult.id),
|
|
23578
|
+
amount,
|
|
23579
|
+
totalAmount: amount,
|
|
23580
|
+
amountUSD: amount,
|
|
23581
|
+
totalAmountUSD: amount,
|
|
23582
|
+
transactionHash,
|
|
23583
|
+
fillTxHash: (status == null ? void 0 : status.fillTxHash) || ((_c = status == null ? void 0 : status.payment) == null ? void 0 : _c.fillTxHash) || null,
|
|
23584
|
+
depositTxHash: (status == null ? void 0 : status.depositTxHash) || ((_d = status == null ? void 0 : status.payment) == null ? void 0 : _d.depositTxHash) || (paymentData == null ? void 0 : paymentData.depositTxHash) || null
|
|
23585
|
+
};
|
|
23586
|
+
setCcSuccessDetails({
|
|
23587
|
+
payment: successPayment,
|
|
23588
|
+
transactionHash,
|
|
23589
|
+
network: successNetwork
|
|
23590
|
+
});
|
|
23591
|
+
setPaymentData(successPayment);
|
|
23592
|
+
}, [ccResult == null ? void 0 : ccResult.id, config == null ? void 0 : config.amount, getNetworkForChainId, paymentAmount, paymentData, resolveCrossChainTransactionHash, selectedNetwork == null ? void 0 : selectedNetwork.chainId]);
|
|
23529
23593
|
const persistSuccessfulPaymentHash = useCallback((payment, txHash) => {
|
|
23530
23594
|
const resolvedTxHash = txHash || resolvePaymentTransactionHash(payment);
|
|
23531
23595
|
if (!resolvedTxHash) return;
|
|
@@ -24143,11 +24207,13 @@ const CoinleyPaymentInternal = ({
|
|
|
24143
24207
|
});
|
|
24144
24208
|
return;
|
|
24145
24209
|
}
|
|
24146
|
-
|
|
24210
|
+
const bridgePaymentInProgress = Boolean(ccResult && ["bridging", "received", "settled"].includes(ccPhase));
|
|
24211
|
+
if (hasCommittedTransaction || transactionStep === "settlement_pending" || bridgePaymentInProgress) {
|
|
24147
24212
|
console.warn("[CheckoutTimer] Timeout reached after transaction commit; keeping payment in processing state.", {
|
|
24148
24213
|
paymentId: paymentData == null ? void 0 : paymentData.id,
|
|
24149
24214
|
transactionStep,
|
|
24150
|
-
hasCommittedTransaction
|
|
24215
|
+
hasCommittedTransaction,
|
|
24216
|
+
ccPhase
|
|
24151
24217
|
});
|
|
24152
24218
|
setProcessingStatusMessage(
|
|
24153
24219
|
"Payment sent. Settlement is still being confirmed. Do not send another payment for this order."
|
|
@@ -24185,7 +24251,7 @@ const CoinleyPaymentInternal = ({
|
|
|
24185
24251
|
}
|
|
24186
24252
|
onClose();
|
|
24187
24253
|
}
|
|
24188
|
-
}, [currentStep, hasCommittedTransaction, onClose, onError, paymentData == null ? void 0 : paymentData.id, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, config == null ? void 0 : config.amount, config == null ? void 0 : config.callbackUrl, timeRemaining, transactionStep, refundRequestSubmitted, refundRequestStatus]);
|
|
24254
|
+
}, [ccPhase, ccResult, currentStep, hasCommittedTransaction, onClose, onError, paymentData == null ? void 0 : paymentData.id, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, config == null ? void 0 : config.amount, config == null ? void 0 : config.callbackUrl, timeRemaining, transactionStep, refundRequestSubmitted, refundRequestStatus]);
|
|
24189
24255
|
const formatCountdown = useCallback((ms) => {
|
|
24190
24256
|
if (ms <= 0) return "00:00";
|
|
24191
24257
|
const totalSeconds = Math.floor(ms / 1e3);
|
|
@@ -24384,6 +24450,7 @@ const CoinleyPaymentInternal = ({
|
|
|
24384
24450
|
setMobileWalletRedirecting(null);
|
|
24385
24451
|
setRecoveryLoadingAction(null);
|
|
24386
24452
|
setRecoveryLoadingStatus(null);
|
|
24453
|
+
setCcSuccessDetails(null);
|
|
24387
24454
|
if (recoveryLoadingTimeout.current) {
|
|
24388
24455
|
clearTimeout(recoveryLoadingTimeout.current);
|
|
24389
24456
|
recoveryLoadingTimeout.current = null;
|
|
@@ -25242,6 +25309,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25242
25309
|
snapshot: buildSelectionSnapshot(originNetwork, originToken, address, solanaWallet == null ? void 0 : solanaWallet.publicKey)
|
|
25243
25310
|
});
|
|
25244
25311
|
setCcError(null);
|
|
25312
|
+
setCcSuccessDetails(null);
|
|
25245
25313
|
setCcGenerating(true);
|
|
25246
25314
|
setCcOriginChainId(String(originChainId));
|
|
25247
25315
|
setCcOriginToken(originToken);
|
|
@@ -25387,6 +25455,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25387
25455
|
ccSucceeded.current = true;
|
|
25388
25456
|
setCcRefundPendingInfo(null);
|
|
25389
25457
|
setCcManualCheckStatus(null);
|
|
25458
|
+
captureCrossChainSuccessDetails(status);
|
|
25390
25459
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
25391
25460
|
onSuccess == null ? void 0 : onSuccess(status);
|
|
25392
25461
|
});
|
|
@@ -25448,6 +25517,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25448
25517
|
ccSucceeded.current = true;
|
|
25449
25518
|
setCcRefundPendingInfo(null);
|
|
25450
25519
|
setCcManualCheckStatus(null);
|
|
25520
|
+
captureCrossChainSuccessDetails(s);
|
|
25451
25521
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
25452
25522
|
onSuccess == null ? void 0 : onSuccess(s);
|
|
25453
25523
|
}
|
|
@@ -25462,7 +25532,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25462
25532
|
cancelled = true;
|
|
25463
25533
|
clearInterval(t);
|
|
25464
25534
|
};
|
|
25465
|
-
}, [activateUnderpaymentFromCrossChainStatus, captureRefundSuccessDetails, ccResult == null ? void 0 : ccResult.id, clearUnderpaymentRecovery, clearUnderpaymentUiState, getCrossChainRefundPendingStatus, holdRecoveryLoading, onSuccess, paymentFlow.api, refundAddress]);
|
|
25535
|
+
}, [activateUnderpaymentFromCrossChainStatus, captureCrossChainSuccessDetails, captureRefundSuccessDetails, ccResult == null ? void 0 : ccResult.id, clearUnderpaymentRecovery, clearUnderpaymentUiState, getCrossChainRefundPendingStatus, holdRecoveryLoading, onSuccess, paymentFlow.api, refundAddress]);
|
|
25466
25536
|
const handleGenerateTransferAddress = async () => {
|
|
25467
25537
|
if (isConverting) {
|
|
25468
25538
|
setError("Please wait for currency conversion to complete");
|
|
@@ -26677,10 +26747,10 @@ const CoinleyPaymentInternal = ({
|
|
|
26677
26747
|
status: "success",
|
|
26678
26748
|
message: "Payment completed successfully!",
|
|
26679
26749
|
theme,
|
|
26680
|
-
payment: paymentData,
|
|
26681
|
-
transactionHash: isSolana ? solanaTransaction.txSignature || (paymentData == null ? void 0 : paymentData.transactionHash) : currentTransactionHash || (paymentData == null ? void 0 : paymentData.transactionHash),
|
|
26750
|
+
payment: (ccSuccessDetails == null ? void 0 : ccSuccessDetails.payment) || paymentData,
|
|
26751
|
+
transactionHash: (ccSuccessDetails == null ? void 0 : ccSuccessDetails.transactionHash) || (isSolana ? solanaTransaction.txSignature || (paymentData == null ? void 0 : paymentData.transactionHash) : currentTransactionHash || (paymentData == null ? void 0 : paymentData.transactionHash)),
|
|
26682
26752
|
selectedPaymentMethod: selectedToken,
|
|
26683
|
-
selectedNetwork,
|
|
26753
|
+
selectedNetwork: (ccSuccessDetails == null ? void 0 : ccSuccessDetails.network) || selectedNetwork,
|
|
26684
26754
|
merchantName: (config == null ? void 0 : config.merchantName) || "Merchant",
|
|
26685
26755
|
onClose
|
|
26686
26756
|
}
|
|
@@ -27953,9 +28023,10 @@ const CoinleyPaymentInternal = ({
|
|
|
27953
28023
|
"Important!",
|
|
27954
28024
|
`Send exactly ${ccResult.amountToSendFormatted || ccResult.amountToSend} ${(ccOriginToken == null ? void 0 : ccOriginToken.symbol) || (selectedToken == null ? void 0 : selectedToken.symbol) || ccResult.originCurrency || ""} on ${ccChainName(ccResult.originChainId || ccOriginChainId)} to this wallet address. Include enough native token for network fees.`
|
|
27955
28025
|
),
|
|
27956
|
-
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
|
|
27957
|
-
/* @__PURE__ */ jsx("
|
|
27958
|
-
"Payment received"
|
|
28026
|
+
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 flex-col items-center justify-center gap-2 rounded-lg bg-[#FAFAFB] px-3 py-4 text-center", children: [
|
|
28027
|
+
/* @__PURE__ */ jsx("img", { src: stablezactLoading, alt: "Processing payment", className: "h-14 w-20 object-contain" }),
|
|
28028
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-[#111827]", children: "Payment received. Processing bridge..." }),
|
|
28029
|
+
/* @__PURE__ */ jsx("p", { className: "text-[11px] leading-4 text-[#9EA0A8]", children: "Keep this screen open until the payment successful screen appears." })
|
|
27959
28030
|
] }) : /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 text-xs text-[#A3A5AC]", children: [
|
|
27960
28031
|
/* @__PURE__ */ jsx("img", { src: stablezactLoading, alt: "", className: "h-5 w-6 object-contain" }),
|
|
27961
28032
|
"Checking automatically every few seconds..."
|
|
@@ -28132,4 +28203,4 @@ export {
|
|
|
28132
28203
|
chainTransports as c,
|
|
28133
28204
|
isFeatureEnabled as i
|
|
28134
28205
|
};
|
|
28135
|
-
//# sourceMappingURL=CoinleyPayment-
|
|
28206
|
+
//# sourceMappingURL=CoinleyPayment-CzdU_Qtr.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-CzdU_Qtr.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-CB-nBf-9.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-CzdU_Qtr.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-CyvPAMFC.js.map
|