coinley-pay 0.36.0 → 0.38.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-D8aL6ChX.js → CoinleyPayment-DMr1ZEvF.js} +204 -51
- package/dist/{appKitEVM-eozvDNUh.js → appKitEVM-42vzguiC.js} +2 -2
- package/dist/{appKitSolana-C1LLrCaN.js → appKitSolana-UWbFPNMg.js} +2 -2
- package/dist/coinley-vanilla.min.js +825 -825
- package/dist/{index-CGvin1NX.js → index-BwFSgFVP.js} +3 -3
- package/dist/{index-QlVbEn4w.js → index-Bzc4Jq86.js} +3 -3
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +10 -10
- package/dist/style.css +1 -1
- package/package.json +2 -2
|
@@ -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-Bzc4Jq86.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-UWbFPNMg.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-42vzguiC.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-UWbFPNMg.js");
|
|
21279
21279
|
console.log("✅ Module loaded, initializing...");
|
|
21280
21280
|
const modal = await initializeAppKitSolana(solanaWallet);
|
|
21281
21281
|
console.log("✅ AppKit Solana initialized successfully");
|
|
@@ -23345,7 +23345,9 @@ const CoinleyPaymentInternal = ({
|
|
|
23345
23345
|
const [ccError, setCcError] = useState(null);
|
|
23346
23346
|
const [ccGenerating, setCcGenerating] = useState(false);
|
|
23347
23347
|
const [ccManualCheckStatus, setCcManualCheckStatus] = useState("idle");
|
|
23348
|
+
const [transferNoticeModal, setTransferNoticeModal] = useState(null);
|
|
23348
23349
|
const ccSucceeded = useRef(false);
|
|
23350
|
+
const ccStatusPollInFlight = useRef(false);
|
|
23349
23351
|
const [networkSearch, setNetworkSearch] = useState("");
|
|
23350
23352
|
const [walletNetworkSearch, setWalletNetworkSearch] = useState("");
|
|
23351
23353
|
const [openCheckoutDropdown, setOpenCheckoutDropdown] = useState(null);
|
|
@@ -23475,6 +23477,11 @@ const CoinleyPaymentInternal = ({
|
|
|
23475
23477
|
setIsBridgePayment,
|
|
23476
23478
|
setBridgeDestination
|
|
23477
23479
|
} = paymentFlow;
|
|
23480
|
+
const activeTransferPaymentId = (paymentData == null ? void 0 : paymentData.id) || (ccResult == null ? void 0 : ccResult.id) || (ccResult == null ? void 0 : ccResult.paymentId);
|
|
23481
|
+
const activeTransferDepositAddress = (paymentData == null ? void 0 : paymentData.depositAddress) || (ccResult == null ? void 0 : ccResult.relayDepositAddress) || (ccResult == null ? void 0 : ccResult.depositAddress);
|
|
23482
|
+
const showTransferNoticeModal = useCallback((message, title = "Transfer not detected yet") => {
|
|
23483
|
+
setTransferNoticeModal({ title, message });
|
|
23484
|
+
}, []);
|
|
23478
23485
|
const merchantReceiveNetworks = (merchantNetworks == null ? void 0 : merchantNetworks.length) ? merchantNetworks : networks;
|
|
23479
23486
|
const isMerchantReceiveNetwork = useCallback((network) => {
|
|
23480
23487
|
var _a2;
|
|
@@ -23530,10 +23537,10 @@ const CoinleyPaymentInternal = ({
|
|
|
23530
23537
|
sweepTxHash: (payment == null ? void 0 : payment.sweepTxHash) ?? (prev == null ? void 0 : prev.sweepTxHash)
|
|
23531
23538
|
}));
|
|
23532
23539
|
}, [resolvePaymentTransactionHash, setPaymentData]);
|
|
23533
|
-
const getUnderpaymentRecoveryStorageKey = useCallback((paymentId =
|
|
23540
|
+
const getUnderpaymentRecoveryStorageKey = useCallback((paymentId = activeTransferPaymentId) => {
|
|
23534
23541
|
return paymentId ? `${UNDERPAYMENT_RECOVERY_STORAGE_PREFIX}${paymentId}` : null;
|
|
23535
|
-
}, [
|
|
23536
|
-
const clearUnderpaymentRecovery = useCallback((paymentId =
|
|
23542
|
+
}, [activeTransferPaymentId]);
|
|
23543
|
+
const clearUnderpaymentRecovery = useCallback((paymentId = activeTransferPaymentId) => {
|
|
23537
23544
|
const storageKey = getUnderpaymentRecoveryStorageKey(paymentId);
|
|
23538
23545
|
if (!storageKey || typeof window === "undefined" || !window.localStorage) return;
|
|
23539
23546
|
try {
|
|
@@ -23541,8 +23548,8 @@ const CoinleyPaymentInternal = ({
|
|
|
23541
23548
|
} catch (error2) {
|
|
23542
23549
|
console.warn("[UnderpaymentRecovery] Failed to clear recovery state:", error2.message);
|
|
23543
23550
|
}
|
|
23544
|
-
}, [
|
|
23545
|
-
const readUnderpaymentRecovery = useCallback((paymentId =
|
|
23551
|
+
}, [activeTransferPaymentId, getUnderpaymentRecoveryStorageKey]);
|
|
23552
|
+
const readUnderpaymentRecovery = useCallback((paymentId = activeTransferPaymentId) => {
|
|
23546
23553
|
const storageKey = getUnderpaymentRecoveryStorageKey(paymentId);
|
|
23547
23554
|
if (!storageKey || typeof window === "undefined" || !window.localStorage) return null;
|
|
23548
23555
|
try {
|
|
@@ -23561,14 +23568,15 @@ const CoinleyPaymentInternal = ({
|
|
|
23561
23568
|
console.warn("[UnderpaymentRecovery] Failed to read recovery state:", error2.message);
|
|
23562
23569
|
return null;
|
|
23563
23570
|
}
|
|
23564
|
-
}, [
|
|
23571
|
+
}, [activeTransferPaymentId, getUnderpaymentRecoveryStorageKey]);
|
|
23565
23572
|
const writeUnderpaymentRecovery = useCallback((choice, view = choice, infoOverride = underpaymentInfo) => {
|
|
23566
|
-
const
|
|
23573
|
+
const paymentId = activeTransferPaymentId;
|
|
23574
|
+
const storageKey = getUnderpaymentRecoveryStorageKey(paymentId);
|
|
23567
23575
|
if (!storageKey || typeof window === "undefined" || !window.localStorage) return;
|
|
23568
23576
|
if (choice !== "offset" && choice !== "refund") return;
|
|
23569
23577
|
try {
|
|
23570
23578
|
window.localStorage.setItem(storageKey, JSON.stringify({
|
|
23571
|
-
paymentId
|
|
23579
|
+
paymentId,
|
|
23572
23580
|
choice,
|
|
23573
23581
|
view: view === "refund" ? "refund" : "offset",
|
|
23574
23582
|
expectedAmount: infoOverride == null ? void 0 : infoOverride.expectedAmount,
|
|
@@ -23582,7 +23590,7 @@ const CoinleyPaymentInternal = ({
|
|
|
23582
23590
|
} catch (error2) {
|
|
23583
23591
|
console.warn("[UnderpaymentRecovery] Failed to persist recovery state:", error2.message);
|
|
23584
23592
|
}
|
|
23585
|
-
}, [
|
|
23593
|
+
}, [activeTransferPaymentId, getUnderpaymentRecoveryStorageKey, underpaymentInfo]);
|
|
23586
23594
|
const normalizeUnderpaymentInfo = useCallback((payment = {}) => {
|
|
23587
23595
|
const raw = payment.underpayment || payment.underpaymentDetails || payment.shortPayment || payment.partialPayment || null;
|
|
23588
23596
|
const statusText = String(payment.status || payment.depositStatus || (raw == null ? void 0 : raw.status) || "").toLowerCase();
|
|
@@ -23649,6 +23657,24 @@ const CoinleyPaymentInternal = ({
|
|
|
23649
23657
|
refundNetworkLabel: (selectedNetwork == null ? void 0 : selectedNetwork.displayName) || (selectedNetwork == null ? void 0 : selectedNetwork.name) || (selectedNetwork == null ? void 0 : selectedNetwork.shortName)
|
|
23650
23658
|
});
|
|
23651
23659
|
}, [activateUnderpaymentFlow, paymentAmount, selectedNetwork, selectedToken]);
|
|
23660
|
+
const activateUnderpaymentFromCrossChainStatus = useCallback((statusResult = {}) => {
|
|
23661
|
+
const relay = statusResult.relay || {};
|
|
23662
|
+
const rawPayment = statusResult.payment || statusResult;
|
|
23663
|
+
const underpayment = statusResult.underpayment || statusResult.underpaymentDetails || rawPayment.underpayment || rawPayment.underpaymentDetails || null;
|
|
23664
|
+
return activateUnderpaymentFlow({
|
|
23665
|
+
...rawPayment,
|
|
23666
|
+
id: rawPayment.id || statusResult.paymentId || (ccResult == null ? void 0 : ccResult.id),
|
|
23667
|
+
depositAddress: rawPayment.depositAddress || relay.depositAddress || (ccResult == null ? void 0 : ccResult.relayDepositAddress),
|
|
23668
|
+
status: rawPayment.status || statusResult.status,
|
|
23669
|
+
paymentState: rawPayment.paymentState || statusResult.paymentState,
|
|
23670
|
+
amount: (underpayment == null ? void 0 : underpayment.expectedAmount) ?? rawPayment.expectedAmount ?? rawPayment.amount ?? statusResult.expectedAmount ?? statusResult.amount,
|
|
23671
|
+
amountReceived: (underpayment == null ? void 0 : underpayment.receivedAmount) ?? (underpayment == null ? void 0 : underpayment.amountReceived) ?? rawPayment.amountReceived ?? statusResult.amountReceived,
|
|
23672
|
+
amountRemaining: (underpayment == null ? void 0 : underpayment.shortfallAmount) ?? (underpayment == null ? void 0 : underpayment.remainingAmount) ?? rawPayment.amountRemaining ?? statusResult.amountRemaining,
|
|
23673
|
+
currency: (underpayment == null ? void 0 : underpayment.tokenSymbol) || (underpayment == null ? void 0 : underpayment.currency) || rawPayment.currency || statusResult.currency || (ccOriginToken == null ? void 0 : ccOriginToken.symbol),
|
|
23674
|
+
refundNetworkLabel: (underpayment == null ? void 0 : underpayment.refundNetworkLabel) || rawPayment.refundNetworkLabel || ccChainName(relay.originChainId || (ccResult == null ? void 0 : ccResult.originChainId) || ccOriginChainId),
|
|
23675
|
+
underpayment
|
|
23676
|
+
});
|
|
23677
|
+
}, [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]);
|
|
23652
23678
|
const selectedNetworkIsSolana = (selectedNetwork == null ? void 0 : selectedNetwork.chainType) === "solana" || (selectedNetwork == null ? void 0 : selectedNetwork.shortName) === "solana";
|
|
23653
23679
|
const sourceNeedsMerchantBridge = Boolean(
|
|
23654
23680
|
selectedNetwork && !selectedNetworkIsSolana && !isMerchantReceiveNetwork(selectedNetwork)
|
|
@@ -25095,13 +25121,16 @@ const CoinleyPaymentInternal = ({
|
|
|
25095
25121
|
try {
|
|
25096
25122
|
const status = await paymentFlow.api.getCrossChainStatus(ccResult.id);
|
|
25097
25123
|
setCcPhase(status.phase);
|
|
25098
|
-
if ((status
|
|
25124
|
+
if (activateUnderpaymentFromCrossChainStatus(status)) {
|
|
25125
|
+
setCcManualCheckStatus(null);
|
|
25126
|
+
} else if ((status.phase === "received" || status.phase === "settled") && !ccSucceeded.current) {
|
|
25099
25127
|
ccSucceeded.current = true;
|
|
25100
25128
|
onSuccess == null ? void 0 : onSuccess(status);
|
|
25101
25129
|
} else if (status.phase === "failed") {
|
|
25102
25130
|
setCcManualCheckStatus("failed");
|
|
25103
25131
|
} else {
|
|
25104
25132
|
setCcManualCheckStatus("not_found");
|
|
25133
|
+
showTransferNoticeModal("We have not detected your transfer yet. It can take a few moments to appear on-chain, and we will keep checking automatically.");
|
|
25105
25134
|
}
|
|
25106
25135
|
} catch (error2) {
|
|
25107
25136
|
setCcError(error2.message || "Could not check this payment yet. Please try again.");
|
|
@@ -25112,15 +25141,21 @@ const CoinleyPaymentInternal = ({
|
|
|
25112
25141
|
if (!(ccResult == null ? void 0 : ccResult.id)) return;
|
|
25113
25142
|
let cancelled = false;
|
|
25114
25143
|
const tick = async () => {
|
|
25144
|
+
if (ccStatusPollInFlight.current) return;
|
|
25145
|
+
ccStatusPollInFlight.current = true;
|
|
25115
25146
|
try {
|
|
25116
25147
|
const s = await paymentFlow.api.getCrossChainStatus(ccResult.id);
|
|
25117
25148
|
if (cancelled) return;
|
|
25118
25149
|
setCcPhase(s.phase);
|
|
25119
|
-
if ((s
|
|
25150
|
+
if (activateUnderpaymentFromCrossChainStatus(s)) {
|
|
25151
|
+
setCcManualCheckStatus(null);
|
|
25152
|
+
} else if ((s.phase === "received" || s.phase === "settled") && !ccSucceeded.current) {
|
|
25120
25153
|
ccSucceeded.current = true;
|
|
25121
25154
|
onSuccess == null ? void 0 : onSuccess(s);
|
|
25122
25155
|
}
|
|
25123
25156
|
} catch {
|
|
25157
|
+
} finally {
|
|
25158
|
+
ccStatusPollInFlight.current = false;
|
|
25124
25159
|
}
|
|
25125
25160
|
};
|
|
25126
25161
|
tick();
|
|
@@ -25129,7 +25164,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25129
25164
|
cancelled = true;
|
|
25130
25165
|
clearInterval(t);
|
|
25131
25166
|
};
|
|
25132
|
-
}, [ccResult == null ? void 0 : ccResult.id, paymentFlow.api
|
|
25167
|
+
}, [activateUnderpaymentFromCrossChainStatus, ccResult == null ? void 0 : ccResult.id, onSuccess, paymentFlow.api]);
|
|
25133
25168
|
const handleGenerateTransferAddress = async () => {
|
|
25134
25169
|
if (isConverting) {
|
|
25135
25170
|
setError("Please wait for currency conversion to complete");
|
|
@@ -25969,18 +26004,18 @@ const CoinleyPaymentInternal = ({
|
|
|
25969
26004
|
const handleRefundRequestSubmit = useCallback(async () => {
|
|
25970
26005
|
var _a2;
|
|
25971
26006
|
const trimmedAddress = refundAddress.trim();
|
|
25972
|
-
if (!trimmedAddress || !
|
|
26007
|
+
if (!trimmedAddress || !activeTransferPaymentId || refundRequestStatus === "submitting") return;
|
|
25973
26008
|
setRefundRequestStatus("submitting");
|
|
25974
26009
|
setRefundRequestMessage("");
|
|
25975
26010
|
setManualCheckStatus(null);
|
|
25976
|
-
clearUnderpaymentRecovery(
|
|
26011
|
+
clearUnderpaymentRecovery(activeTransferPaymentId);
|
|
25977
26012
|
const refundPayload = {
|
|
25978
|
-
paymentId:
|
|
26013
|
+
paymentId: activeTransferPaymentId,
|
|
25979
26014
|
refundAddress: trimmedAddress,
|
|
25980
26015
|
amountReceived: underpaymentInfo == null ? void 0 : underpaymentInfo.receivedAmount,
|
|
25981
26016
|
amountRemaining: underpaymentInfo == null ? void 0 : underpaymentInfo.shortfallAmount,
|
|
25982
|
-
network: selectedNetwork == null ? void 0 : selectedNetwork.shortName,
|
|
25983
|
-
currency: selectedToken == null ? void 0 : selectedToken.symbol
|
|
26017
|
+
network: (selectedNetwork == null ? void 0 : selectedNetwork.shortName) || (ccOriginChainId ? ccChainName(ccOriginChainId) : void 0),
|
|
26018
|
+
currency: (selectedToken == null ? void 0 : selectedToken.symbol) || (ccOriginToken == null ? void 0 : ccOriginToken.symbol)
|
|
25984
26019
|
};
|
|
25985
26020
|
if (typeof (config == null ? void 0 : config.onRefundRequest) === "function") {
|
|
25986
26021
|
config.onRefundRequest(refundPayload);
|
|
@@ -25991,7 +26026,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25991
26026
|
}));
|
|
25992
26027
|
}
|
|
25993
26028
|
try {
|
|
25994
|
-
const result = await paymentFlow.api.requestDepositRefund(
|
|
26029
|
+
const result = await paymentFlow.api.requestDepositRefund(activeTransferPaymentId, trimmedAddress);
|
|
25995
26030
|
const refundStatus = ((_a2 = result == null ? void 0 : result.payment) == null ? void 0 : _a2.refundStatus) || "pending";
|
|
25996
26031
|
setRefundRequestSubmitted(true);
|
|
25997
26032
|
setRefundRequestStatus(refundStatus === "refunded" ? "refunded" : "pending");
|
|
@@ -26004,7 +26039,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26004
26039
|
setRefundRequestStatus("error");
|
|
26005
26040
|
setRefundRequestMessage(error2.message || "Failed to submit refund request. Please try again.");
|
|
26006
26041
|
}
|
|
26007
|
-
}, [
|
|
26042
|
+
}, [activeTransferPaymentId, 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, underpaymentInfo]);
|
|
26008
26043
|
const handleDepositManualCheck = useCallback(async () => {
|
|
26009
26044
|
if (manualCheckStatus === "checking" || !(paymentData == null ? void 0 : paymentData.id)) return;
|
|
26010
26045
|
setManualCheckStatus("checking");
|
|
@@ -26049,17 +26084,19 @@ const CoinleyPaymentInternal = ({
|
|
|
26049
26084
|
}
|
|
26050
26085
|
}
|
|
26051
26086
|
setManualCheckStatus("not_found");
|
|
26087
|
+
showTransferNoticeModal("We have not detected your transfer yet. It can take a few moments to appear on-chain, and we will keep checking automatically.");
|
|
26052
26088
|
manualCheckTimeout.current = setTimeout(() => {
|
|
26053
26089
|
setManualCheckStatus(null);
|
|
26054
26090
|
}, 1e4);
|
|
26055
26091
|
} catch (error2) {
|
|
26056
26092
|
console.warn("[ManualCheck] Error:", error2.message);
|
|
26057
26093
|
setManualCheckStatus("not_found");
|
|
26094
|
+
showTransferNoticeModal("We have not detected your transfer yet. It can take a few moments to appear on-chain, and we will keep checking automatically.");
|
|
26058
26095
|
manualCheckTimeout.current = setTimeout(() => {
|
|
26059
26096
|
setManualCheckStatus(null);
|
|
26060
26097
|
}, 1e4);
|
|
26061
26098
|
}
|
|
26062
|
-
}, [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]);
|
|
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]);
|
|
26063
26100
|
if (!isOpen) return null;
|
|
26064
26101
|
if (currentStep === PAYMENT_STEPS.PROCESSING) {
|
|
26065
26102
|
return /* @__PURE__ */ jsxs("div", { id: SDK_ROOT_ID, className: `${SDK_ROOT_CLASS} fixed inset-0 z-50`, style: { fontFamily: FONT_FAMILY }, children: [
|
|
@@ -26193,6 +26230,99 @@ const CoinleyPaymentInternal = ({
|
|
|
26193
26230
|
] }),
|
|
26194
26231
|
title && description && /* @__PURE__ */ jsx("p", { className: "pl-6 text-xs leading-5 text-[#B54708]", children: description })
|
|
26195
26232
|
] });
|
|
26233
|
+
const renderUnderpaymentOptionCard = ({ choice, icon, title, description }) => {
|
|
26234
|
+
const selected = underpaymentChoice === choice;
|
|
26235
|
+
return /* @__PURE__ */ jsxs(
|
|
26236
|
+
"button",
|
|
26237
|
+
{
|
|
26238
|
+
type: "button",
|
|
26239
|
+
onClick: () => {
|
|
26240
|
+
setUnderpaymentChoice(choice);
|
|
26241
|
+
setRefundRequestSubmitted(false);
|
|
26242
|
+
setRefundRequestStatus(null);
|
|
26243
|
+
setRefundRequestMessage("");
|
|
26244
|
+
},
|
|
26245
|
+
className: `relative flex min-h-[112px] flex-col items-start rounded-xl border p-3 text-left transition-colors ${selected ? "border-[#8B5CF6] bg-[#F4EEFF]" : "border-[#ECEEF2] bg-white hover:border-[#D7C5FF]"}`,
|
|
26246
|
+
children: [
|
|
26247
|
+
selected && /* @__PURE__ */ jsx("span", { className: "absolute right-[-7px] top-[-9px] flex h-5 w-5 items-center justify-center rounded-full border border-[#8B5CF6] bg-white text-[#7042D2]", children: /* @__PURE__ */ jsx("svg", { className: "h-3.5 w-3.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" }) }) }),
|
|
26248
|
+
/* @__PURE__ */ jsx("div", { className: "mb-3 flex h-6 w-6 items-center justify-center text-[#111827]", children: icon }),
|
|
26249
|
+
/* @__PURE__ */ jsx("p", { className: "mb-1 text-sm font-semibold text-[#111827]", children: title }),
|
|
26250
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs leading-4 text-[#A3A5AC]", children: description })
|
|
26251
|
+
]
|
|
26252
|
+
}
|
|
26253
|
+
);
|
|
26254
|
+
};
|
|
26255
|
+
const renderUnderpaymentChoicePanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
|
|
26256
|
+
renderUnderpaymentWarning(
|
|
26257
|
+
"Amount received is less than expected",
|
|
26258
|
+
`We received $${formatAmount(underpaymentInfo.receivedAmount || 0)} but expected $${formatAmount(underpaymentInfo.expectedAmount || paymentAmount || 0)}. Your transaction is on hold, please choose how to proceed.`
|
|
26259
|
+
),
|
|
26260
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-5 grid grid-cols-1 gap-2 min-[380px]:grid-cols-2", children: [
|
|
26261
|
+
renderUnderpaymentOptionCard({
|
|
26262
|
+
choice: "offset",
|
|
26263
|
+
title: "Send offset",
|
|
26264
|
+
description: underpaymentChoice === "offset" ? "Top up the shortfall and complete this transfer with extended time" : "Top up the shortfall with extended time",
|
|
26265
|
+
icon: /* @__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: 1.8, d: "M4 4v6h6M20 20v-6h-6M5.5 15.5A7 7 0 0017.7 18M18.5 8.5A7 7 0 006.3 6" }) })
|
|
26266
|
+
}),
|
|
26267
|
+
renderUnderpaymentOptionCard({
|
|
26268
|
+
choice: "refund",
|
|
26269
|
+
title: "Cancel & refund",
|
|
26270
|
+
description: "Cancel my transaction so i get refunded",
|
|
26271
|
+
icon: /* @__PURE__ */ jsxs("svg", { className: "h-6 w-6", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
|
|
26272
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9", strokeWidth: 1.8 }),
|
|
26273
|
+
/* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.8, d: "M9 9l6 6m0-6l-6 6" })
|
|
26274
|
+
] })
|
|
26275
|
+
})
|
|
26276
|
+
] })
|
|
26277
|
+
] });
|
|
26278
|
+
const renderUnderpaymentOffsetPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
|
|
26279
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-5 flex items-start gap-3", children: [
|
|
26280
|
+
/* @__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("div", { className: "h-6 w-6 animate-spin rounded-full border-2 border-[#E5E7EB] border-t-[#7042D2]" }) }) }),
|
|
26281
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 pt-1", children: [
|
|
26282
|
+
/* @__PURE__ */ jsx("p", { className: "mb-2 text-xs font-medium text-[#1F2430]", children: "Same Wallet address" }),
|
|
26283
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-h-[58px] items-center gap-2 rounded-xl border border-[#EEF0F4] bg-[#FAFAFB] px-3 py-2", children: [
|
|
26284
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 break-all text-sm leading-5 text-[#1F2430]", children: activeTransferDepositAddress }),
|
|
26285
|
+
/* @__PURE__ */ jsx(
|
|
26286
|
+
"button",
|
|
26287
|
+
{
|
|
26288
|
+
onClick: () => copyToClipboard(activeTransferDepositAddress, "depositAddress"),
|
|
26289
|
+
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"}`,
|
|
26290
|
+
"aria-label": "Copy wallet address",
|
|
26291
|
+
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" }) })
|
|
26292
|
+
}
|
|
26293
|
+
)
|
|
26294
|
+
] })
|
|
26295
|
+
] })
|
|
26296
|
+
] }),
|
|
26297
|
+
renderUnderpaymentWarning(
|
|
26298
|
+
"Important!",
|
|
26299
|
+
"This is the same wallet address for your underpaid transaction. Send only the remaining offset amount, and make sure to add network fees on top of it."
|
|
26300
|
+
)
|
|
26301
|
+
] });
|
|
26302
|
+
const renderUnderpaymentRefundPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
|
|
26303
|
+
renderUnderpaymentWarning(
|
|
26304
|
+
`Refund of $${formatAmount(underpaymentInfo.receivedAmount || 0)} ${underpaymentInfo.tokenSymbol}`,
|
|
26305
|
+
`Provide a ${underpaymentInfo.tokenSymbol} wallet address on the same network (${underpaymentInfo.refundNetworkLabel}) to receive your refund. Network fees will be deducted.`
|
|
26306
|
+
),
|
|
26307
|
+
/* @__PURE__ */ jsxs("label", { className: "mb-2 block text-xs font-medium text-[#111827]", children: [
|
|
26308
|
+
"Your ",
|
|
26309
|
+
underpaymentInfo.tokenSymbol,
|
|
26310
|
+
" (",
|
|
26311
|
+
underpaymentInfo.refundNetworkLabel,
|
|
26312
|
+
") receiving wallet address"
|
|
26313
|
+
] }),
|
|
26314
|
+
/* @__PURE__ */ jsx(
|
|
26315
|
+
"input",
|
|
26316
|
+
{
|
|
26317
|
+
type: "text",
|
|
26318
|
+
value: refundAddress,
|
|
26319
|
+
onChange: (event) => setRefundAddress(event.target.value),
|
|
26320
|
+
placeholder: "Paste your wallet address here",
|
|
26321
|
+
className: "mb-5 h-11 w-full rounded-xl border border-[#E4E6EB] bg-white px-3 text-sm text-[#1F2430] outline-none transition-colors placeholder:text-[#8B8E98] focus:border-[#B49AF0]"
|
|
26322
|
+
}
|
|
26323
|
+
),
|
|
26324
|
+
refundRequestMessage && /* @__PURE__ */ jsx("p", { className: `mt-2 text-center text-xs leading-5 ${refundRequestStatus === "error" ? "text-red-600" : "text-[#8B8E98]"}`, children: refundRequestMessage })
|
|
26325
|
+
] });
|
|
26196
26326
|
networks.filter((network) => {
|
|
26197
26327
|
const chainId = parseInt(network.chainId);
|
|
26198
26328
|
const supportedChains = [8453, 56, 42161, 137, 10, 43114, 143, 59144, 534352, 130];
|
|
@@ -26738,14 +26868,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26738
26868
|
disabled: !ccOriginToken || ccGenerating || isConverting
|
|
26739
26869
|
});
|
|
26740
26870
|
}
|
|
26741
|
-
if (
|
|
26742
|
-
return renderFooterPrimaryButton({
|
|
26743
|
-
label: ccManualCheckStatus === "checking" ? "Checking for your payment..." : "I've made transfer",
|
|
26744
|
-
onClick: handleCrossChainManualCheck,
|
|
26745
|
-
disabled: ccManualCheckStatus === "checking" || ccPhase === "received" || ccPhase === "settled"
|
|
26746
|
-
});
|
|
26747
|
-
}
|
|
26748
|
-
if (activeTab === PAYMENT_TABS.TRANSFER && selectedNetwork && selectedToken && (paymentData == null ? void 0 : paymentData.depositAddress) && underpaymentInfo) {
|
|
26871
|
+
if (activeTab === PAYMENT_TABS.TRANSFER && activeTransferDepositAddress && underpaymentInfo) {
|
|
26749
26872
|
if (underpaymentView === "choice") {
|
|
26750
26873
|
return renderFooterPrimaryButton({
|
|
26751
26874
|
label: "Continue",
|
|
@@ -26755,9 +26878,9 @@ const CoinleyPaymentInternal = ({
|
|
|
26755
26878
|
}
|
|
26756
26879
|
if (underpaymentView === "offset") {
|
|
26757
26880
|
return renderFooterPrimaryButton({
|
|
26758
|
-
label: manualCheckStatus === "checking" ? "Checking for your payment..." : "I've made transfer",
|
|
26759
|
-
onClick: handleDepositManualCheck,
|
|
26760
|
-
disabled: manualCheckStatus === "checking"
|
|
26881
|
+
label: manualCheckStatus === "checking" || ccManualCheckStatus === "checking" ? "Checking for your payment..." : "I've made transfer",
|
|
26882
|
+
onClick: ccResult ? handleCrossChainManualCheck : handleDepositManualCheck,
|
|
26883
|
+
disabled: manualCheckStatus === "checking" || ccManualCheckStatus === "checking"
|
|
26761
26884
|
});
|
|
26762
26885
|
}
|
|
26763
26886
|
if (underpaymentView === "refund") {
|
|
@@ -26768,6 +26891,13 @@ const CoinleyPaymentInternal = ({
|
|
|
26768
26891
|
});
|
|
26769
26892
|
}
|
|
26770
26893
|
}
|
|
26894
|
+
if (isCrossChainTransferAddressView) {
|
|
26895
|
+
return renderFooterPrimaryButton({
|
|
26896
|
+
label: ccManualCheckStatus === "checking" ? "Checking for your payment..." : "I've made transfer",
|
|
26897
|
+
onClick: handleCrossChainManualCheck,
|
|
26898
|
+
disabled: ccManualCheckStatus === "checking" || ccPhase === "received" || ccPhase === "settled"
|
|
26899
|
+
});
|
|
26900
|
+
}
|
|
26771
26901
|
if (activeTab === PAYMENT_TABS.TRANSFER && selectedNetwork && selectedToken && (paymentData == null ? void 0 : paymentData.depositAddress) && !(expirationTime == null ? void 0 : expirationTime.expired)) {
|
|
26772
26902
|
return renderFooterPrimaryButton({
|
|
26773
26903
|
label: manualCheckStatus === "checking" ? "Checking for your payment..." : manualCheckStatus === "not_found" ? "Check again" : "I've made this transfer",
|
|
@@ -26834,6 +26964,23 @@ const CoinleyPaymentInternal = ({
|
|
|
26834
26964
|
/* @__PURE__ */ jsx("p", { className: `${isTightWalletView ? "mt-1" : isCompactCheckoutView ? "mt-2" : "mt-3"} text-xs text-[#A9ABB2]`, children: "Powered by Stablezact" })
|
|
26835
26965
|
] });
|
|
26836
26966
|
};
|
|
26967
|
+
const renderTransferNoticeModal = () => {
|
|
26968
|
+
if (!transferNoticeModal) return null;
|
|
26969
|
+
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: [
|
|
26970
|
+
/* @__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" }) }) }),
|
|
26971
|
+
/* @__PURE__ */ jsx("h3", { className: "mb-2 text-base font-semibold text-[#111827]", children: transferNoticeModal.title }),
|
|
26972
|
+
/* @__PURE__ */ jsx("p", { className: "mb-5 text-sm leading-5 text-[#6B7280]", children: transferNoticeModal.message }),
|
|
26973
|
+
/* @__PURE__ */ jsx(
|
|
26974
|
+
"button",
|
|
26975
|
+
{
|
|
26976
|
+
type: "button",
|
|
26977
|
+
onClick: () => setTransferNoticeModal(null),
|
|
26978
|
+
className: "h-11 w-full rounded-xl bg-[#7042D2] px-4 text-sm font-semibold text-white transition-colors hover:bg-[#5b34b1]",
|
|
26979
|
+
children: "Got it"
|
|
26980
|
+
}
|
|
26981
|
+
)
|
|
26982
|
+
] }) });
|
|
26983
|
+
};
|
|
26837
26984
|
const renderTabContent = () => {
|
|
26838
26985
|
var _a2, _b, _c, _d;
|
|
26839
26986
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -27160,20 +27307,25 @@ const CoinleyPaymentInternal = ({
|
|
|
27160
27307
|
] })
|
|
27161
27308
|
] })
|
|
27162
27309
|
] }),
|
|
27163
|
-
|
|
27164
|
-
"
|
|
27165
|
-
|
|
27166
|
-
|
|
27167
|
-
|
|
27168
|
-
|
|
27169
|
-
|
|
27170
|
-
|
|
27171
|
-
|
|
27172
|
-
/* @__PURE__ */ jsxs("
|
|
27173
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
27174
|
-
|
|
27175
|
-
] }),
|
|
27176
|
-
|
|
27310
|
+
underpaymentInfo ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27311
|
+
underpaymentView === "choice" && renderUnderpaymentChoicePanel(),
|
|
27312
|
+
underpaymentView === "offset" && renderUnderpaymentOffsetPanel(),
|
|
27313
|
+
underpaymentView === "refund" && renderUnderpaymentRefundPanel()
|
|
27314
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27315
|
+
renderUnderpaymentWarning(
|
|
27316
|
+
"Important!",
|
|
27317
|
+
"Use this wallet address for this transfer only. Send from the selected network and include enough native token for network fees."
|
|
27318
|
+
),
|
|
27319
|
+
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 text-xs font-medium text-green-600", children: [
|
|
27320
|
+
/* @__PURE__ */ jsx("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-green-500" }),
|
|
27321
|
+
"Payment received"
|
|
27322
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 text-xs text-[#A3A5AC]", children: [
|
|
27323
|
+
/* @__PURE__ */ jsxs("span", { className: "relative flex h-2 w-2", children: [
|
|
27324
|
+
/* @__PURE__ */ jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75" }),
|
|
27325
|
+
/* @__PURE__ */ jsx("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-green-500" })
|
|
27326
|
+
] }),
|
|
27327
|
+
"Checking automatically every few seconds..."
|
|
27328
|
+
] })
|
|
27177
27329
|
] })
|
|
27178
27330
|
] })
|
|
27179
27331
|
] }),
|
|
@@ -27308,7 +27460,8 @@ const CoinleyPaymentInternal = ({
|
|
|
27308
27460
|
/* @__PURE__ */ jsx("div", { className: `min-h-0 flex-1 ${isCheckoutDropdownOpen ? "overflow-visible" : "overflow-y-auto coinley-scroll"} pb-1`, children: renderTabContent() }),
|
|
27309
27461
|
renderCheckoutFooter()
|
|
27310
27462
|
] })
|
|
27311
|
-
] }) })
|
|
27463
|
+
] }) }),
|
|
27464
|
+
renderTransferNoticeModal()
|
|
27312
27465
|
] });
|
|
27313
27466
|
};
|
|
27314
27467
|
const CoinleyPayment = (props) => {
|
|
@@ -27345,4 +27498,4 @@ export {
|
|
|
27345
27498
|
isFeatureEnabled as i,
|
|
27346
27499
|
logo as l
|
|
27347
27500
|
};
|
|
27348
|
-
//# sourceMappingURL=CoinleyPayment-
|
|
27501
|
+
//# sourceMappingURL=CoinleyPayment-DMr1ZEvF.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-DMr1ZEvF.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-42vzguiC.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-DMr1ZEvF.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-UWbFPNMg.js.map
|