coinley-pay 0.38.0 → 0.40.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-DMr1ZEvF.js → CoinleyPayment-Fe-W3OyQ.js} +239 -15
- package/dist/{appKitEVM-42vzguiC.js → appKitEVM-3_yg517i.js} +2 -2
- package/dist/{appKitSolana-UWbFPNMg.js → appKitSolana-DeOCxv7e.js} +2 -2
- package/dist/coinley-vanilla.min.js +641 -641
- package/dist/{index-BwFSgFVP.js → index-ChxLziO7.js} +3 -3
- package/dist/{index-Bzc4Jq86.js → index-JTjDQGRR.js} +3 -3
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +8 -8
- 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-JTjDQGRR.js";
|
|
9
9
|
import { createConfig, fallback, http, getAccount as getAccount$1, getWalletClient, simulateContract, writeContract, readContract, waitForTransactionReceipt, estimateFeesPerGas as estimateFeesPerGas$1 } from "@wagmi/core";
|
|
10
10
|
import { injected, metaMask, coinbaseWallet, walletConnect } from "@wagmi/connectors";
|
|
11
11
|
import { defineChain as defineChain$1, erc20Abi, http as http$1, createPublicClient, fallback as fallback$1 } from "viem";
|
|
@@ -21150,7 +21150,7 @@ const WalletSelector = ({
|
|
|
21150
21150
|
try {
|
|
21151
21151
|
setAppKitError(null);
|
|
21152
21152
|
setWalletConnectAddress(solanaAccountState.address);
|
|
21153
|
-
const { createWalletConnectAdapter } = await import("./appKitSolana-
|
|
21153
|
+
const { createWalletConnectAdapter } = await import("./appKitSolana-DeOCxv7e.js");
|
|
21154
21154
|
const adapter = createWalletConnectAdapter(solanaAccountState.address);
|
|
21155
21155
|
await solanaWallet.connectWalletConnect(adapter, solanaAccountState.address);
|
|
21156
21156
|
console.log("✅ WalletConnect synced with SDK");
|
|
@@ -21255,7 +21255,7 @@ const WalletSelector = ({
|
|
|
21255
21255
|
setAppKitLoading(true);
|
|
21256
21256
|
setAppKitError(null);
|
|
21257
21257
|
try {
|
|
21258
|
-
const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-
|
|
21258
|
+
const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-3_yg517i.js");
|
|
21259
21259
|
await initializeAppKitEVM(wagmiConfig);
|
|
21260
21260
|
await openAppKitModal();
|
|
21261
21261
|
} catch (error) {
|
|
@@ -21275,7 +21275,7 @@ const WalletSelector = ({
|
|
|
21275
21275
|
setAppKitError(null);
|
|
21276
21276
|
try {
|
|
21277
21277
|
console.log("📦 Loading AppKit Solana module...");
|
|
21278
|
-
const { initializeAppKitSolana } = await import("./appKitSolana-
|
|
21278
|
+
const { initializeAppKitSolana } = await import("./appKitSolana-DeOCxv7e.js");
|
|
21279
21279
|
console.log("✅ Module loaded, initializing...");
|
|
21280
21280
|
const modal = await initializeAppKitSolana(solanaWallet);
|
|
21281
21281
|
console.log("✅ AppKit Solana initialized successfully");
|
|
@@ -23377,6 +23377,7 @@ const CoinleyPaymentInternal = ({
|
|
|
23377
23377
|
const [refundRequestSubmitted, setRefundRequestSubmitted] = useState(false);
|
|
23378
23378
|
const [refundRequestStatus, setRefundRequestStatus] = useState(null);
|
|
23379
23379
|
const [refundRequestMessage, setRefundRequestMessage] = useState("");
|
|
23380
|
+
const [offsetSuccessDetails, setOffsetSuccessDetails] = useState(null);
|
|
23380
23381
|
const manualCheckTimeout = useRef(null);
|
|
23381
23382
|
const [copiedField, setCopiedField] = useState(null);
|
|
23382
23383
|
const [expirationTime, setExpirationTime] = useState(null);
|
|
@@ -23537,6 +23538,53 @@ const CoinleyPaymentInternal = ({
|
|
|
23537
23538
|
sweepTxHash: (payment == null ? void 0 : payment.sweepTxHash) ?? (prev == null ? void 0 : prev.sweepTxHash)
|
|
23538
23539
|
}));
|
|
23539
23540
|
}, [resolvePaymentTransactionHash, setPaymentData]);
|
|
23541
|
+
const getExplorerDetails = useCallback((network) => {
|
|
23542
|
+
const key = String((network == null ? void 0 : network.shortName) || (network == null ? void 0 : network.type) || (network == null ? void 0 : network.id) || (network == null ? void 0 : network.name) || "").toLowerCase();
|
|
23543
|
+
const chainId = Number(network == null ? void 0 : network.chainId);
|
|
23544
|
+
const explorers = {
|
|
23545
|
+
ethereum: { name: "Etherscan", url: "https://etherscan.io" },
|
|
23546
|
+
eth: { name: "Etherscan", url: "https://etherscan.io" },
|
|
23547
|
+
bsc: { name: "BscScan", url: "https://bscscan.com" },
|
|
23548
|
+
"bnb chain": { name: "BscScan", url: "https://bscscan.com" },
|
|
23549
|
+
polygon: { name: "PolygonScan", url: "https://polygonscan.com" },
|
|
23550
|
+
base: { name: "BaseScan", url: "https://basescan.org" },
|
|
23551
|
+
arbitrum: { name: "Arbiscan", url: "https://arbiscan.io" },
|
|
23552
|
+
optimism: { name: "Optimistic Etherscan", url: "https://optimistic.etherscan.io" },
|
|
23553
|
+
avalanche: { name: "SnowTrace", url: "https://snowtrace.io" },
|
|
23554
|
+
linea: { name: "LineaScan", url: "https://lineascan.build" },
|
|
23555
|
+
scroll: { name: "ScrollScan", url: "https://scrollscan.com" },
|
|
23556
|
+
unichain: { name: "Uniscan", url: "https://uniscan.xyz" },
|
|
23557
|
+
monad: { name: "Monad Explorer", url: "https://testnet.monadexplorer.com" }
|
|
23558
|
+
};
|
|
23559
|
+
const chainExplorers = {
|
|
23560
|
+
1: explorers.ethereum,
|
|
23561
|
+
56: explorers.bsc,
|
|
23562
|
+
137: explorers.polygon,
|
|
23563
|
+
8453: explorers.base,
|
|
23564
|
+
42161: explorers.arbitrum,
|
|
23565
|
+
10: explorers.optimism,
|
|
23566
|
+
43114: explorers.avalanche,
|
|
23567
|
+
59144: explorers.linea,
|
|
23568
|
+
534352: explorers.scroll,
|
|
23569
|
+
130: explorers.unichain,
|
|
23570
|
+
143: explorers.monad
|
|
23571
|
+
};
|
|
23572
|
+
return chainExplorers[chainId] || explorers[key] || { name: "Explorer", url: null };
|
|
23573
|
+
}, []);
|
|
23574
|
+
const getOffsetSuccessNetworkName = useCallback((network) => (network == null ? void 0 : network.displayName) || (network == null ? void 0 : network.name) || ((network == null ? void 0 : network.shortName) ? network.shortName.toUpperCase() : "Network"), []);
|
|
23575
|
+
const captureOffsetSuccessDetails = useCallback((payment, txHash) => {
|
|
23576
|
+
if (!(underpaymentInfo && underpaymentChoice === "offset")) return;
|
|
23577
|
+
const explorer = getExplorerDetails(selectedNetwork);
|
|
23578
|
+
setOffsetSuccessDetails({
|
|
23579
|
+
amount: underpaymentInfo.shortfallAmount || (payment == null ? void 0 : payment.amountRemaining) || (payment == null ? void 0 : payment.amount) || (config == null ? void 0 : config.amount) || 0,
|
|
23580
|
+
merchantName: (config == null ? void 0 : config.merchantName) || "Merchant",
|
|
23581
|
+
networkName: getOffsetSuccessNetworkName(selectedNetwork),
|
|
23582
|
+
tokenSymbol: underpaymentInfo.tokenSymbol || (selectedToken == null ? void 0 : selectedToken.symbol) || (payment == null ? void 0 : payment.currency) || "Token",
|
|
23583
|
+
transactionHash: txHash || resolvePaymentTransactionHash(payment),
|
|
23584
|
+
explorerName: explorer.name,
|
|
23585
|
+
explorerUrl: explorer.url && (txHash || resolvePaymentTransactionHash(payment)) ? `${explorer.url}/tx/${txHash || resolvePaymentTransactionHash(payment)}` : null
|
|
23586
|
+
});
|
|
23587
|
+
}, [config == null ? void 0 : config.amount, config == null ? void 0 : config.merchantName, getExplorerDetails, getOffsetSuccessNetworkName, resolvePaymentTransactionHash, selectedNetwork, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentChoice, underpaymentInfo]);
|
|
23540
23588
|
const getUnderpaymentRecoveryStorageKey = useCallback((paymentId = activeTransferPaymentId) => {
|
|
23541
23589
|
return paymentId ? `${UNDERPAYMENT_RECOVERY_STORAGE_PREFIX}${paymentId}` : null;
|
|
23542
23590
|
}, [activeTransferPaymentId]);
|
|
@@ -23675,6 +23723,17 @@ const CoinleyPaymentInternal = ({
|
|
|
23675
23723
|
underpayment
|
|
23676
23724
|
});
|
|
23677
23725
|
}, [activateUnderpaymentFlow, ccOriginChainId, ccOriginToken == null ? void 0 : ccOriginToken.symbol, ccResult == null ? void 0 : ccResult.id, ccResult == null ? void 0 : ccResult.originChainId, ccResult == null ? void 0 : ccResult.relayDepositAddress]);
|
|
23726
|
+
const clearUnderpaymentUiState = useCallback((paymentId) => {
|
|
23727
|
+
setUnderpaymentInfo(null);
|
|
23728
|
+
setUnderpaymentChoice(null);
|
|
23729
|
+
setUnderpaymentView("choice");
|
|
23730
|
+
setManualCheckStatus(null);
|
|
23731
|
+
setCcManualCheckStatus(null);
|
|
23732
|
+
clearUnderpaymentRecovery(paymentId || activeTransferPaymentId);
|
|
23733
|
+
}, [activeTransferPaymentId, clearUnderpaymentRecovery]);
|
|
23734
|
+
useEffect(() => {
|
|
23735
|
+
setOffsetSuccessDetails(null);
|
|
23736
|
+
}, [paymentData == null ? void 0 : paymentData.id]);
|
|
23678
23737
|
const selectedNetworkIsSolana = (selectedNetwork == null ? void 0 : selectedNetwork.chainType) === "solana" || (selectedNetwork == null ? void 0 : selectedNetwork.shortName) === "solana";
|
|
23679
23738
|
const sourceNeedsMerchantBridge = Boolean(
|
|
23680
23739
|
selectedNetwork && !selectedNetworkIsSolana && !isMerchantReceiveNetwork(selectedNetwork)
|
|
@@ -24140,6 +24199,7 @@ const CoinleyPaymentInternal = ({
|
|
|
24140
24199
|
const txHash = resolvePaymentTransactionHash(statusResult.payment);
|
|
24141
24200
|
if ((status === "completed" || status === "swept") && txHash) {
|
|
24142
24201
|
clearInterval(pollInterval);
|
|
24202
|
+
captureOffsetSuccessDetails(statusResult.payment, txHash);
|
|
24143
24203
|
clearUnderpaymentRecovery(paymentData.id);
|
|
24144
24204
|
setProcessingStatusMessage("");
|
|
24145
24205
|
persistSuccessfulPaymentHash(statusResult.payment, txHash);
|
|
@@ -24201,7 +24261,7 @@ const CoinleyPaymentInternal = ({
|
|
|
24201
24261
|
}
|
|
24202
24262
|
}, 5e3);
|
|
24203
24263
|
return () => clearInterval(pollInterval);
|
|
24204
|
-
}, [currentStep, paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, selectedNetwork, selectedToken, onSuccess, activateUnderpaymentFlow, clearUnderpaymentRecovery, resolvePaymentTransactionHash, persistSuccessfulPaymentHash]);
|
|
24264
|
+
}, [currentStep, paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, selectedNetwork, selectedToken, onSuccess, activateUnderpaymentFlow, captureOffsetSuccessDetails, clearUnderpaymentRecovery, resolvePaymentTransactionHash, persistSuccessfulPaymentHash]);
|
|
24205
24265
|
useEffect(() => {
|
|
24206
24266
|
const shouldPoll = (paymentData == null ? void 0 : paymentData.id) && (activeTab === PAYMENT_TABS.QR || activeTab === PAYMENT_TABS.TRANSFER) && currentStep === PAYMENT_STEPS.CONFIRM && !verifyingPayment && paymentType !== PAYMENT_TYPES.DEPOSIT && !(paymentData == null ? void 0 : paymentData.isDepositPayment) && !(paymentData == null ? void 0 : paymentData.depositAddress);
|
|
24207
24267
|
if (!shouldPoll) {
|
|
@@ -25123,6 +25183,9 @@ const CoinleyPaymentInternal = ({
|
|
|
25123
25183
|
setCcPhase(status.phase);
|
|
25124
25184
|
if (activateUnderpaymentFromCrossChainStatus(status)) {
|
|
25125
25185
|
setCcManualCheckStatus(null);
|
|
25186
|
+
} else if (status.phase === "bridging") {
|
|
25187
|
+
clearUnderpaymentUiState(status.paymentId || ccResult.id);
|
|
25188
|
+
showTransferNoticeModal("We have detected your transfer and are waiting for the bridge to complete. We will keep checking automatically.", "Transfer detected");
|
|
25126
25189
|
} else if ((status.phase === "received" || status.phase === "settled") && !ccSucceeded.current) {
|
|
25127
25190
|
ccSucceeded.current = true;
|
|
25128
25191
|
onSuccess == null ? void 0 : onSuccess(status);
|
|
@@ -25149,6 +25212,8 @@ const CoinleyPaymentInternal = ({
|
|
|
25149
25212
|
setCcPhase(s.phase);
|
|
25150
25213
|
if (activateUnderpaymentFromCrossChainStatus(s)) {
|
|
25151
25214
|
setCcManualCheckStatus(null);
|
|
25215
|
+
} else if (s.phase === "bridging") {
|
|
25216
|
+
clearUnderpaymentUiState(s.paymentId || ccResult.id);
|
|
25152
25217
|
} else if ((s.phase === "received" || s.phase === "settled") && !ccSucceeded.current) {
|
|
25153
25218
|
ccSucceeded.current = true;
|
|
25154
25219
|
onSuccess == null ? void 0 : onSuccess(s);
|
|
@@ -25164,7 +25229,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25164
25229
|
cancelled = true;
|
|
25165
25230
|
clearInterval(t);
|
|
25166
25231
|
};
|
|
25167
|
-
}, [activateUnderpaymentFromCrossChainStatus, ccResult == null ? void 0 : ccResult.id, onSuccess, paymentFlow.api]);
|
|
25232
|
+
}, [activateUnderpaymentFromCrossChainStatus, ccResult == null ? void 0 : ccResult.id, clearUnderpaymentUiState, onSuccess, paymentFlow.api]);
|
|
25168
25233
|
const handleGenerateTransferAddress = async () => {
|
|
25169
25234
|
if (isConverting) {
|
|
25170
25235
|
setError("Please wait for currency conversion to complete");
|
|
@@ -25921,6 +25986,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25921
25986
|
if ((status === "completed" || status === "swept") && txHash) {
|
|
25922
25987
|
console.log("✅ Auto-detected: Deposit payment completed!");
|
|
25923
25988
|
clearInterval(pollInterval);
|
|
25989
|
+
captureOffsetSuccessDetails(statusResult.payment, txHash);
|
|
25924
25990
|
clearUnderpaymentRecovery(paymentData.id);
|
|
25925
25991
|
persistSuccessfulPaymentHash(statusResult.payment, txHash);
|
|
25926
25992
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
@@ -25960,7 +26026,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25960
26026
|
console.log("🛑 Stopping deposit auto-detection polling");
|
|
25961
26027
|
clearInterval(pollInterval);
|
|
25962
26028
|
};
|
|
25963
|
-
}, [paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, paymentType, currentStep, verifyingPayment, expirationTime == null ? void 0 : expirationTime.expired, selectedNetwork, selectedToken, onSuccess, paymentFlow.api, activateUnderpaymentFlow, clearUnderpaymentRecovery, resolvePaymentTransactionHash, persistSuccessfulPaymentHash]);
|
|
26029
|
+
}, [paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, paymentType, currentStep, verifyingPayment, expirationTime == null ? void 0 : expirationTime.expired, selectedNetwork, selectedToken, onSuccess, paymentFlow.api, activateUnderpaymentFlow, captureOffsetSuccessDetails, clearUnderpaymentRecovery, resolvePaymentTransactionHash, persistSuccessfulPaymentHash]);
|
|
25964
26030
|
useEffect(() => {
|
|
25965
26031
|
return () => {
|
|
25966
26032
|
if (manualCheckTimeout.current) {
|
|
@@ -26050,6 +26116,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26050
26116
|
const txHash = resolvePaymentTransactionHash(statusResult.payment);
|
|
26051
26117
|
if ((status === "completed" || status === "swept") && txHash) {
|
|
26052
26118
|
setManualCheckStatus(null);
|
|
26119
|
+
captureOffsetSuccessDetails(statusResult.payment, txHash);
|
|
26053
26120
|
clearUnderpaymentRecovery(paymentData.id);
|
|
26054
26121
|
persistSuccessfulPaymentHash(statusResult.payment, txHash);
|
|
26055
26122
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
@@ -26096,7 +26163,11 @@ const CoinleyPaymentInternal = ({
|
|
|
26096
26163
|
setManualCheckStatus(null);
|
|
26097
26164
|
}, 1e4);
|
|
26098
26165
|
}
|
|
26099
|
-
}, [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, clearUnderpaymentRecovery, resolvePaymentTransactionHash, persistSuccessfulPaymentHash, showTransferNoticeModal]);
|
|
26166
|
+
}, [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]);
|
|
26167
|
+
const truncateTransactionId = (hash) => {
|
|
26168
|
+
if (!hash) return "";
|
|
26169
|
+
return `${hash.slice(0, 7)}...${hash.slice(-8)}`;
|
|
26170
|
+
};
|
|
26100
26171
|
if (!isOpen) return null;
|
|
26101
26172
|
if (currentStep === PAYMENT_STEPS.PROCESSING) {
|
|
26102
26173
|
return /* @__PURE__ */ jsxs("div", { id: SDK_ROOT_ID, className: `${SDK_ROOT_CLASS} fixed inset-0 z-50`, style: { fontFamily: FONT_FAMILY }, children: [
|
|
@@ -26140,6 +26211,90 @@ const CoinleyPaymentInternal = ({
|
|
|
26140
26211
|
] });
|
|
26141
26212
|
}
|
|
26142
26213
|
if (currentStep === PAYMENT_STEPS.SUCCESS) {
|
|
26214
|
+
if (offsetSuccessDetails) {
|
|
26215
|
+
return /* @__PURE__ */ jsxs("div", { id: SDK_ROOT_ID, className: `${SDK_ROOT_CLASS} fixed inset-0 z-50`, style: { fontFamily: FONT_FAMILY }, children: [
|
|
26216
|
+
/* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50" }),
|
|
26217
|
+
/* @__PURE__ */ jsx("div", { className: isMobile ? "fixed inset-0 flex items-end" : "fixed inset-0 flex items-center justify-center p-4", style: { zIndex: 51 }, children: /* @__PURE__ */ jsxs("div", { className: isMobile ? "coinley-mobile-sheet relative flex w-full max-h-[92dvh] flex-col overflow-hidden rounded-t-[24px] bg-white px-4 pb-4 pt-8 animate-slide-up-sheet" : "relative flex h-auto min-h-[554px] w-[450px] max-w-[calc(100vw-32px)] flex-col overflow-hidden rounded-[28px] bg-white px-4 pb-4 pt-8", children: [
|
|
26218
|
+
/* @__PURE__ */ jsx(
|
|
26219
|
+
"button",
|
|
26220
|
+
{
|
|
26221
|
+
type: "button",
|
|
26222
|
+
onClick: onClose,
|
|
26223
|
+
className: "absolute right-4 top-5 flex h-8 w-8 items-center justify-center rounded-full text-[#111827] transition-colors hover:bg-gray-100",
|
|
26224
|
+
"aria-label": "Close payment modal",
|
|
26225
|
+
children: /* @__PURE__ */ jsx("svg", { className: "h-5 w-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
26226
|
+
}
|
|
26227
|
+
),
|
|
26228
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col pt-[68px]", children: [
|
|
26229
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-9 text-center", children: [
|
|
26230
|
+
/* @__PURE__ */ jsx("div", { className: "mx-auto mb-3 flex h-16 w-16 items-center justify-center rounded-full bg-[#D9F8E6]", children: /* @__PURE__ */ jsx("div", { className: "flex h-11 w-11 items-center justify-center rounded-full bg-[#08C65A] text-white", children: /* @__PURE__ */ jsx("svg", { className: "h-5 w-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) }) }) }),
|
|
26231
|
+
/* @__PURE__ */ jsx("h3", { className: "mb-2 text-base font-medium text-black", children: "Offset Successful" }),
|
|
26232
|
+
/* @__PURE__ */ jsxs("p", { className: "text-base text-[#A9ABB2]", children: [
|
|
26233
|
+
/* @__PURE__ */ jsxs("span", { className: "font-semibold text-black", children: [
|
|
26234
|
+
"$",
|
|
26235
|
+
formatAmount(offsetSuccessDetails.amount || 0)
|
|
26236
|
+
] }),
|
|
26237
|
+
" ",
|
|
26238
|
+
"sent to ",
|
|
26239
|
+
offsetSuccessDetails.merchantName
|
|
26240
|
+
] })
|
|
26241
|
+
] }),
|
|
26242
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-9 space-y-0", children: [
|
|
26243
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
26244
|
+
/* @__PURE__ */ jsx("p", { className: "mb-1.5 text-xs text-[#4B5563]", children: "Transaction ID" }),
|
|
26245
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-11 items-center justify-between rounded-lg border border-[#EEF0F4] bg-[#FAFAFB] px-3", children: [
|
|
26246
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-sm font-semibold text-black", children: truncateTransactionId(offsetSuccessDetails.transactionHash) }),
|
|
26247
|
+
/* @__PURE__ */ jsx(
|
|
26248
|
+
"button",
|
|
26249
|
+
{
|
|
26250
|
+
type: "button",
|
|
26251
|
+
onClick: () => copyToClipboard(offsetSuccessDetails.transactionHash, "offsetSuccessTx"),
|
|
26252
|
+
className: "ml-3 flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-[#111827] transition-colors hover:bg-gray-100",
|
|
26253
|
+
"aria-label": "Copy transaction ID",
|
|
26254
|
+
children: copiedField === "offsetSuccessTx" ? /* @__PURE__ */ jsx("svg", { className: "h-4 w-4 text-[#08C65A]", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.2, d: "M5 13l4 4L19 7" }) }) : /* @__PURE__ */ jsxs("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
|
|
26255
|
+
/* @__PURE__ */ jsx("rect", { x: "8", y: "7", width: "10", height: "13", rx: "2", strokeWidth: "1.7" }),
|
|
26256
|
+
/* @__PURE__ */ jsx("path", { d: "M6 17H5a2 2 0 01-2-2V5a2 2 0 012-2h8a2 2 0 012 2v1", strokeWidth: "1.7", strokeLinecap: "round" })
|
|
26257
|
+
] })
|
|
26258
|
+
}
|
|
26259
|
+
)
|
|
26260
|
+
] })
|
|
26261
|
+
] }),
|
|
26262
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b border-[#EEF0F4] py-3", children: [
|
|
26263
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-[#A9ABB2]", children: "Network" }),
|
|
26264
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-black", children: offsetSuccessDetails.networkName })
|
|
26265
|
+
] }),
|
|
26266
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between py-3", children: [
|
|
26267
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-[#A9ABB2]", children: "Token" }),
|
|
26268
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-black", children: offsetSuccessDetails.tokenSymbol })
|
|
26269
|
+
] }),
|
|
26270
|
+
offsetSuccessDetails.explorerUrl && /* @__PURE__ */ jsxs(
|
|
26271
|
+
"a",
|
|
26272
|
+
{
|
|
26273
|
+
href: offsetSuccessDetails.explorerUrl,
|
|
26274
|
+
target: "_blank",
|
|
26275
|
+
rel: "noopener noreferrer",
|
|
26276
|
+
className: "mt-1 flex h-11 w-full items-center justify-center gap-2 rounded-lg border border-[#BFA7FF] text-sm font-medium text-[#7042D2] transition-colors hover:bg-[#F7F2FF]",
|
|
26277
|
+
children: [
|
|
26278
|
+
"View on ",
|
|
26279
|
+
offsetSuccessDetails.explorerName,
|
|
26280
|
+
/* @__PURE__ */ jsx("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.8, d: "M7 17L17 7M10 7h7v7" }) })
|
|
26281
|
+
]
|
|
26282
|
+
}
|
|
26283
|
+
)
|
|
26284
|
+
] }),
|
|
26285
|
+
/* @__PURE__ */ jsx(
|
|
26286
|
+
"button",
|
|
26287
|
+
{
|
|
26288
|
+
type: "button",
|
|
26289
|
+
onClick: onClose,
|
|
26290
|
+
className: "mt-auto h-12 w-full rounded-lg bg-[#7042D2] px-4 text-sm font-semibold text-white transition-colors hover:bg-[#5b34b1]",
|
|
26291
|
+
children: "Close"
|
|
26292
|
+
}
|
|
26293
|
+
)
|
|
26294
|
+
] })
|
|
26295
|
+
] }) })
|
|
26296
|
+
] });
|
|
26297
|
+
}
|
|
26143
26298
|
return /* @__PURE__ */ jsxs("div", { id: SDK_ROOT_ID, className: `${SDK_ROOT_CLASS} fixed inset-0 z-50`, style: { fontFamily: FONT_FAMILY }, children: [
|
|
26144
26299
|
/* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50" }),
|
|
26145
26300
|
/* @__PURE__ */ jsx("div", { className: isMobile ? "fixed inset-0 flex items-end" : "fixed inset-0 flex items-center justify-center p-4", style: { zIndex: 51 }, children: /* @__PURE__ */ jsx("div", { className: isMobile ? "coinley-mobile-sheet relative flex w-full max-h-[92dvh] flex-col overflow-hidden rounded-t-[24px] bg-white px-4 pb-5 pt-5 animate-slide-up-sheet" : "relative flex h-[640px] max-h-[calc(100vh-32px)] min-h-0 w-[450px] max-w-[calc(100vw-32px)] flex-col overflow-hidden rounded-[28px] bg-white px-4 pb-5 pt-5", children: /* @__PURE__ */ jsx(
|
|
@@ -26159,7 +26314,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26159
26314
|
] });
|
|
26160
26315
|
}
|
|
26161
26316
|
const paymentAmountLabel = isConverting ? "..." : `$${formatAmount(paymentAmount || (config == null ? void 0 : config.amount) || 0)}`;
|
|
26162
|
-
const underpaymentOffsetAmountLabel = underpaymentInfo ?
|
|
26317
|
+
const underpaymentOffsetAmountLabel = underpaymentInfo ? `${formatAmount(underpaymentInfo.shortfallAmount || 0)} ${underpaymentInfo.tokenSymbol || (selectedToken == null ? void 0 : selectedToken.symbol) || ""}`.trim() : paymentAmountLabel;
|
|
26163
26318
|
const summaryPaymentAmountLabel = underpaymentInfo && (underpaymentView === "offset" || underpaymentView === "refund") ? underpaymentOffsetAmountLabel : paymentAmountLabel;
|
|
26164
26319
|
const getTokenDisplaySymbol = (token) => (token == null ? void 0 : token.symbol) || (token == null ? void 0 : token.tokenSymbol) || (token == null ? void 0 : token.currency) || (token == null ? void 0 : token.ticker) || (token == null ? void 0 : token.name) || "Token";
|
|
26165
26320
|
const getLogoFallbackUrl = (label = "?", background = "7042D2") => {
|
|
@@ -26178,7 +26333,12 @@ const CoinleyPaymentInternal = ({
|
|
|
26178
26333
|
};
|
|
26179
26334
|
const getNetworkDisplayName = (network) => (network == null ? void 0 : network.name) || (network == null ? void 0 : network.displayName) || (network == null ? void 0 : network.shortName) || "Network";
|
|
26180
26335
|
const getNetworkDisplayLogo = (network) => (network == null ? void 0 : network.logo) || (network == null ? void 0 : network.logoURI) || (network == null ? void 0 : network.icon) || getNetworkLogoUrl(network) || getFallbackNetworkLogoUrl(getNetworkDisplayName(network));
|
|
26181
|
-
const
|
|
26336
|
+
const hasDirectTransferNetworks = networks.some((network) => {
|
|
26337
|
+
const chainId = parseInt(network.chainId);
|
|
26338
|
+
const supportedChains = [8453, 56, 42161, 137, 10, 43114, 143, 59144, 534352, 130];
|
|
26339
|
+
return supportedChains.includes(chainId);
|
|
26340
|
+
});
|
|
26341
|
+
const isCrossChainTransferSetupView = activeTab === PAYMENT_TABS.TRANSFER && !ccResult && !(paymentData == null ? void 0 : paymentData.depositAddress) && !hasDirectTransferNetworks;
|
|
26182
26342
|
const isCrossChainTransferAddressView = activeTab === PAYMENT_TABS.TRANSFER && !!ccResult;
|
|
26183
26343
|
const isTransferSetupView = activeTab === PAYMENT_TABS.TRANSFER && !ccResult && (!selectedNetwork || !selectedToken || !(paymentData == null ? void 0 : paymentData.depositAddress));
|
|
26184
26344
|
const isQrSetupView = activeTab === PAYMENT_TABS.QR && (!selectedNetwork || !selectedToken || !paymentData || (paymentData == null ? void 0 : paymentData.isDepositPayment));
|
|
@@ -26296,7 +26456,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26296
26456
|
] }),
|
|
26297
26457
|
renderUnderpaymentWarning(
|
|
26298
26458
|
"Important!",
|
|
26299
|
-
|
|
26459
|
+
`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.`
|
|
26300
26460
|
)
|
|
26301
26461
|
] });
|
|
26302
26462
|
const renderUnderpaymentRefundPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
|
|
@@ -26323,7 +26483,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26323
26483
|
),
|
|
26324
26484
|
refundRequestMessage && /* @__PURE__ */ jsx("p", { className: `mt-2 text-center text-xs leading-5 ${refundRequestStatus === "error" ? "text-red-600" : "text-[#8B8E98]"}`, children: refundRequestMessage })
|
|
26325
26485
|
] });
|
|
26326
|
-
networks.filter((network) => {
|
|
26486
|
+
const transferNetworks = networks.filter((network) => {
|
|
26327
26487
|
const chainId = parseInt(network.chainId);
|
|
26328
26488
|
const supportedChains = [8453, 56, 42161, 137, 10, 43114, 143, 59144, 534352, 130];
|
|
26329
26489
|
return supportedChains.includes(chainId);
|
|
@@ -26427,6 +26587,41 @@ const CoinleyPaymentInternal = ({
|
|
|
26427
26587
|
] })
|
|
26428
26588
|
] });
|
|
26429
26589
|
};
|
|
26590
|
+
const renderTransferSetupPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
|
|
26591
|
+
renderCheckoutSelect({
|
|
26592
|
+
id: "transfer-network",
|
|
26593
|
+
label: "Select a Network",
|
|
26594
|
+
value: selectedNetwork == null ? void 0 : selectedNetwork.id,
|
|
26595
|
+
placeholder: "Select a network",
|
|
26596
|
+
options: transferNetworks,
|
|
26597
|
+
getLabel: (network) => getNetworkDisplayName(network),
|
|
26598
|
+
getIcon: (network) => getNetworkDisplayLogo(network),
|
|
26599
|
+
compact: true,
|
|
26600
|
+
elevated: true,
|
|
26601
|
+
maxVisibleItems: 4,
|
|
26602
|
+
onChange: (networkId) => {
|
|
26603
|
+
const network = transferNetworks.find((item) => item.id === networkId);
|
|
26604
|
+
if (network) handleNetworkSelect(network);
|
|
26605
|
+
}
|
|
26606
|
+
}),
|
|
26607
|
+
renderCheckoutSelect({
|
|
26608
|
+
id: "transfer-token",
|
|
26609
|
+
label: "Pick a Token",
|
|
26610
|
+
value: selectedToken == null ? void 0 : selectedToken.id,
|
|
26611
|
+
placeholder: selectedNetwork ? "Select a token" : "Select a token",
|
|
26612
|
+
disabled: !selectedNetwork || availableTokens.length === 0,
|
|
26613
|
+
options: availableTokens,
|
|
26614
|
+
getLabel: (token) => getTokenDisplaySymbol(token),
|
|
26615
|
+
getIcon: (token) => getTokenDisplayLogo(token),
|
|
26616
|
+
compact: true,
|
|
26617
|
+
elevated: true,
|
|
26618
|
+
maxVisibleItems: 2,
|
|
26619
|
+
onChange: (tokenId) => {
|
|
26620
|
+
const token = availableTokens.find((item) => item.id === tokenId);
|
|
26621
|
+
if (token) handleTokenSelect(token);
|
|
26622
|
+
}
|
|
26623
|
+
})
|
|
26624
|
+
] });
|
|
26430
26625
|
const renderWalletExtensionSetupPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
|
|
26431
26626
|
!selectedNetwork && renderWalletNetworkPickerPanel(),
|
|
26432
26627
|
selectedNetwork && !selectedToken && renderWalletTokenPickerPanel(),
|
|
@@ -27256,7 +27451,7 @@ const CoinleyPaymentInternal = ({
|
|
|
27256
27451
|
] }),
|
|
27257
27452
|
activeTab === PAYMENT_TABS.QR && /* @__PURE__ */ jsx(Fragment, { children: qrWalletChoiceConfirmed ? renderQrPaymentPanel() : renderQrWalletChoicePanel() }),
|
|
27258
27453
|
activeTab === PAYMENT_TABS.TRANSFER && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27259
|
-
|
|
27454
|
+
isCrossChainTransferSetupView && /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
|
|
27260
27455
|
renderCheckoutSelect({
|
|
27261
27456
|
id: "cross-chain-network",
|
|
27262
27457
|
label: "Select a Network",
|
|
@@ -27288,8 +27483,37 @@ const CoinleyPaymentInternal = ({
|
|
|
27288
27483
|
}),
|
|
27289
27484
|
ccError && /* @__PURE__ */ jsx("div", { className: "mb-3 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs font-medium text-red-600", children: ccError })
|
|
27290
27485
|
] }),
|
|
27486
|
+
!isCrossChainTransferSetupView && !ccResult && !(paymentData == null ? void 0 : paymentData.depositAddress) && renderTransferSetupPanel(),
|
|
27487
|
+
!ccResult && (paymentData == null ? void 0 : paymentData.depositAddress) && /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
|
|
27488
|
+
!underpaymentInfo && /* @__PURE__ */ jsxs("div", { className: "mb-5 flex items-center gap-4", children: [
|
|
27489
|
+
/* @__PURE__ */ jsx("div", { className: "h-[92px] w-[92px] flex-shrink-0 bg-white", children: depositQrCode ? /* @__PURE__ */ jsx("img", { src: depositQrCode, alt: "Deposit Address QR Code", className: "h-full w-full" }) : /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center rounded-lg bg-gray-100", children: /* @__PURE__ */ jsx("div", { className: "h-6 w-6 animate-spin rounded-full border-2 border-[#E5E7EB] border-t-[#7042D2]" }) }) }),
|
|
27490
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
27491
|
+
/* @__PURE__ */ jsx("p", { className: "mb-2 text-xs font-medium text-[#1F2430]", children: "Wallet address" }),
|
|
27492
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-h-[60px] items-center gap-2 rounded-xl border border-[#EEF0F4] bg-[#FAFAFB] px-3 py-2", children: [
|
|
27493
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 break-all text-sm leading-5 text-[#1F2430]", children: paymentData.depositAddress }),
|
|
27494
|
+
/* @__PURE__ */ jsx(
|
|
27495
|
+
"button",
|
|
27496
|
+
{
|
|
27497
|
+
onClick: () => copyToClipboard(paymentData.depositAddress, "depositAddress"),
|
|
27498
|
+
className: `flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg transition-colors ${copiedField === "depositAddress" ? "bg-green-100 text-green-600" : "text-[#7042D2] hover:bg-purple-50"}`,
|
|
27499
|
+
"aria-label": "Copy wallet address",
|
|
27500
|
+
children: copiedField === "depositAddress" ? /* @__PURE__ */ jsx("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }) : /* @__PURE__ */ jsx("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" }) })
|
|
27501
|
+
}
|
|
27502
|
+
)
|
|
27503
|
+
] })
|
|
27504
|
+
] })
|
|
27505
|
+
] }),
|
|
27506
|
+
underpaymentInfo ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27507
|
+
underpaymentView === "choice" && renderUnderpaymentChoicePanel(),
|
|
27508
|
+
underpaymentView === "offset" && renderUnderpaymentOffsetPanel(),
|
|
27509
|
+
underpaymentView === "refund" && renderUnderpaymentRefundPanel()
|
|
27510
|
+
] }) : /* @__PURE__ */ jsx(Fragment, { children: renderUnderpaymentWarning(
|
|
27511
|
+
"Important!",
|
|
27512
|
+
"Use this wallet address for this transfer only. Send from the selected network and include enough native token for network fees."
|
|
27513
|
+
) })
|
|
27514
|
+
] }),
|
|
27291
27515
|
ccResult && /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
|
|
27292
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-5 flex items-center gap-4", children: [
|
|
27516
|
+
!underpaymentInfo && /* @__PURE__ */ jsxs("div", { className: "mb-5 flex items-center gap-4", children: [
|
|
27293
27517
|
/* @__PURE__ */ jsx("div", { className: "h-[92px] w-[92px] flex-shrink-0 bg-white", children: ccQrCode ? /* @__PURE__ */ jsx("img", { src: ccQrCode, alt: "Payment Address QR Code", className: "h-full w-full" }) : /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center rounded-lg bg-gray-100", children: /* @__PURE__ */ jsx("div", { className: "h-6 w-6 animate-spin rounded-full border-2 border-[#E5E7EB] border-t-[#7042D2]" }) }) }),
|
|
27294
27518
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
27295
27519
|
/* @__PURE__ */ jsx("p", { className: "mb-2 text-xs font-medium text-[#1F2430]", children: "Wallet address" }),
|
|
@@ -27498,4 +27722,4 @@ export {
|
|
|
27498
27722
|
isFeatureEnabled as i,
|
|
27499
27723
|
logo as l
|
|
27500
27724
|
};
|
|
27501
|
-
//# sourceMappingURL=CoinleyPayment-
|
|
27725
|
+
//# sourceMappingURL=CoinleyPayment-Fe-W3OyQ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID, l as logo } from "./CoinleyPayment-
|
|
1
|
+
import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID, l as logo } from "./CoinleyPayment-Fe-W3OyQ.js";
|
|
2
2
|
let appKitInstance = null;
|
|
3
3
|
let isInitializing = false;
|
|
4
4
|
let initializationPromise = null;
|
|
@@ -112,4 +112,4 @@ export {
|
|
|
112
112
|
initializeAppKitEVM,
|
|
113
113
|
openAppKitModal
|
|
114
114
|
};
|
|
115
|
-
//# sourceMappingURL=appKitEVM-
|
|
115
|
+
//# sourceMappingURL=appKitEVM-3_yg517i.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FEATURES, l as logo, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-
|
|
1
|
+
import { F as FEATURES, l as logo, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-Fe-W3OyQ.js";
|
|
2
2
|
let appKitInstance = null;
|
|
3
3
|
let isInitializing = false;
|
|
4
4
|
let initializationPromise = null;
|
|
@@ -242,4 +242,4 @@ export {
|
|
|
242
242
|
disconnectWalletConnect,
|
|
243
243
|
initializeAppKitSolana
|
|
244
244
|
};
|
|
245
|
-
//# sourceMappingURL=appKitSolana-
|
|
245
|
+
//# sourceMappingURL=appKitSolana-DeOCxv7e.js.map
|