coinley-pay 0.28.0 → 0.30.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-Bql8B8cV.js → CoinleyPayment-BUCxlaSN.js} +126 -27
- package/dist/{appKitEVM-BcM7Ftoe.js → appKitEVM--OanO4zO.js} +2 -2
- package/dist/{appKitSolana-BWdEszCH.js → appKitSolana-CNQLFPw3.js} +2 -2
- package/dist/coinley-vanilla.min.js +1 -1
- package/dist/{index-Dqu16xBs.js → index-DXIE_oad.js} +3 -3
- package/dist/{index-B6XL-PMy.js → index-EgEF0eVy.js} +3 -3
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +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-EgEF0eVy.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";
|
|
@@ -21121,7 +21121,7 @@ const WalletSelector = ({
|
|
|
21121
21121
|
try {
|
|
21122
21122
|
setAppKitError(null);
|
|
21123
21123
|
setWalletConnectAddress(solanaAccountState.address);
|
|
21124
|
-
const { createWalletConnectAdapter } = await import("./appKitSolana-
|
|
21124
|
+
const { createWalletConnectAdapter } = await import("./appKitSolana-CNQLFPw3.js");
|
|
21125
21125
|
const adapter = createWalletConnectAdapter(solanaAccountState.address);
|
|
21126
21126
|
await solanaWallet.connectWalletConnect(adapter, solanaAccountState.address);
|
|
21127
21127
|
console.log("✅ WalletConnect synced with SDK");
|
|
@@ -21226,7 +21226,7 @@ const WalletSelector = ({
|
|
|
21226
21226
|
setAppKitLoading(true);
|
|
21227
21227
|
setAppKitError(null);
|
|
21228
21228
|
try {
|
|
21229
|
-
const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM
|
|
21229
|
+
const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM--OanO4zO.js");
|
|
21230
21230
|
await initializeAppKitEVM(wagmiConfig);
|
|
21231
21231
|
await openAppKitModal();
|
|
21232
21232
|
} catch (error) {
|
|
@@ -21246,7 +21246,7 @@ const WalletSelector = ({
|
|
|
21246
21246
|
setAppKitError(null);
|
|
21247
21247
|
try {
|
|
21248
21248
|
console.log("📦 Loading AppKit Solana module...");
|
|
21249
|
-
const { initializeAppKitSolana } = await import("./appKitSolana-
|
|
21249
|
+
const { initializeAppKitSolana } = await import("./appKitSolana-CNQLFPw3.js");
|
|
21250
21250
|
console.log("✅ Module loaded, initializing...");
|
|
21251
21251
|
const modal = await initializeAppKitSolana(solanaWallet);
|
|
21252
21252
|
console.log("✅ AppKit Solana initialized successfully");
|
|
@@ -23107,6 +23107,8 @@ const injectCoinleyFonts = () => {
|
|
|
23107
23107
|
document.head.appendChild(style);
|
|
23108
23108
|
};
|
|
23109
23109
|
const CHECKOUT_BUILD = "checkout-2026-04-22b-route-destination-trials";
|
|
23110
|
+
const UNDERPAYMENT_RECOVERY_STORAGE_PREFIX = "coinley_underpayment_recovery:";
|
|
23111
|
+
const UNDERPAYMENT_RECOVERY_TTL_MS = 2 * 60 * 60 * 1e3;
|
|
23110
23112
|
const normalizeEvmAddress = (value) => {
|
|
23111
23113
|
if (typeof value !== "string") return null;
|
|
23112
23114
|
const trimmed = value.trim();
|
|
@@ -23427,6 +23429,59 @@ const CoinleyPaymentInternal = ({
|
|
|
23427
23429
|
const hasCommittedTransaction = Boolean(
|
|
23428
23430
|
currentTransactionHash || (solanaTransaction == null ? void 0 : solanaTransaction.txSignature) || (paymentData == null ? void 0 : paymentData.transactionHash)
|
|
23429
23431
|
);
|
|
23432
|
+
const getUnderpaymentRecoveryStorageKey = useCallback((paymentId = paymentData == null ? void 0 : paymentData.id) => {
|
|
23433
|
+
return paymentId ? `${UNDERPAYMENT_RECOVERY_STORAGE_PREFIX}${paymentId}` : null;
|
|
23434
|
+
}, [paymentData == null ? void 0 : paymentData.id]);
|
|
23435
|
+
const clearUnderpaymentRecovery = useCallback((paymentId = paymentData == null ? void 0 : paymentData.id) => {
|
|
23436
|
+
const storageKey = getUnderpaymentRecoveryStorageKey(paymentId);
|
|
23437
|
+
if (!storageKey || typeof window === "undefined" || !window.localStorage) return;
|
|
23438
|
+
try {
|
|
23439
|
+
window.localStorage.removeItem(storageKey);
|
|
23440
|
+
} catch (error2) {
|
|
23441
|
+
console.warn("[UnderpaymentRecovery] Failed to clear recovery state:", error2.message);
|
|
23442
|
+
}
|
|
23443
|
+
}, [getUnderpaymentRecoveryStorageKey, paymentData == null ? void 0 : paymentData.id]);
|
|
23444
|
+
const readUnderpaymentRecovery = useCallback((paymentId = paymentData == null ? void 0 : paymentData.id) => {
|
|
23445
|
+
const storageKey = getUnderpaymentRecoveryStorageKey(paymentId);
|
|
23446
|
+
if (!storageKey || typeof window === "undefined" || !window.localStorage) return null;
|
|
23447
|
+
try {
|
|
23448
|
+
const stored = window.localStorage.getItem(storageKey);
|
|
23449
|
+
if (!stored) return null;
|
|
23450
|
+
const parsed = JSON.parse(stored);
|
|
23451
|
+
const isExpired = !(parsed == null ? void 0 : parsed.timestamp) || Date.now() - parsed.timestamp > UNDERPAYMENT_RECOVERY_TTL_MS;
|
|
23452
|
+
const isSamePayment = (parsed == null ? void 0 : parsed.paymentId) === paymentId;
|
|
23453
|
+
const isValidChoice = (parsed == null ? void 0 : parsed.choice) === "offset" || (parsed == null ? void 0 : parsed.choice) === "refund";
|
|
23454
|
+
if (isExpired || !isSamePayment || !isValidChoice) {
|
|
23455
|
+
window.localStorage.removeItem(storageKey);
|
|
23456
|
+
return null;
|
|
23457
|
+
}
|
|
23458
|
+
return parsed;
|
|
23459
|
+
} catch (error2) {
|
|
23460
|
+
console.warn("[UnderpaymentRecovery] Failed to read recovery state:", error2.message);
|
|
23461
|
+
return null;
|
|
23462
|
+
}
|
|
23463
|
+
}, [getUnderpaymentRecoveryStorageKey, paymentData == null ? void 0 : paymentData.id]);
|
|
23464
|
+
const writeUnderpaymentRecovery = useCallback((choice, view = choice, infoOverride = underpaymentInfo) => {
|
|
23465
|
+
const storageKey = getUnderpaymentRecoveryStorageKey(paymentData == null ? void 0 : paymentData.id);
|
|
23466
|
+
if (!storageKey || typeof window === "undefined" || !window.localStorage) return;
|
|
23467
|
+
if (choice !== "offset" && choice !== "refund") return;
|
|
23468
|
+
try {
|
|
23469
|
+
window.localStorage.setItem(storageKey, JSON.stringify({
|
|
23470
|
+
paymentId: paymentData.id,
|
|
23471
|
+
choice,
|
|
23472
|
+
view: view === "refund" ? "refund" : "offset",
|
|
23473
|
+
expectedAmount: infoOverride == null ? void 0 : infoOverride.expectedAmount,
|
|
23474
|
+
receivedAmount: infoOverride == null ? void 0 : infoOverride.receivedAmount,
|
|
23475
|
+
shortfallAmount: infoOverride == null ? void 0 : infoOverride.shortfallAmount,
|
|
23476
|
+
tokenSymbol: infoOverride == null ? void 0 : infoOverride.tokenSymbol,
|
|
23477
|
+
refundNetworkLabel: infoOverride == null ? void 0 : infoOverride.refundNetworkLabel,
|
|
23478
|
+
paymentState: infoOverride == null ? void 0 : infoOverride.paymentState,
|
|
23479
|
+
timestamp: Date.now()
|
|
23480
|
+
}));
|
|
23481
|
+
} catch (error2) {
|
|
23482
|
+
console.warn("[UnderpaymentRecovery] Failed to persist recovery state:", error2.message);
|
|
23483
|
+
}
|
|
23484
|
+
}, [getUnderpaymentRecoveryStorageKey, paymentData == null ? void 0 : paymentData.id, underpaymentInfo]);
|
|
23430
23485
|
const normalizeUnderpaymentInfo = useCallback((payment = {}) => {
|
|
23431
23486
|
const raw = payment.underpayment || payment.underpaymentDetails || payment.shortPayment || payment.partialPayment || null;
|
|
23432
23487
|
const statusText = String(payment.status || payment.depositStatus || (raw == null ? void 0 : raw.status) || "").toLowerCase();
|
|
@@ -23460,13 +23515,21 @@ const CoinleyPaymentInternal = ({
|
|
|
23460
23515
|
const activateUnderpaymentFlow = useCallback((payment) => {
|
|
23461
23516
|
const normalized = normalizeUnderpaymentInfo(payment);
|
|
23462
23517
|
if (!normalized) return false;
|
|
23518
|
+
const recoveryState = readUnderpaymentRecovery((payment == null ? void 0 : payment.id) || (paymentData == null ? void 0 : paymentData.id));
|
|
23519
|
+
const recoveryChoice = (recoveryState == null ? void 0 : recoveryState.choice) === "offset" || (recoveryState == null ? void 0 : recoveryState.choice) === "refund" ? recoveryState.choice : null;
|
|
23520
|
+
const recoveryView = recoveryChoice ? (recoveryState == null ? void 0 : recoveryState.view) === "refund" ? "refund" : "offset" : null;
|
|
23463
23521
|
setUnderpaymentInfo(normalized);
|
|
23464
|
-
setUnderpaymentChoice(
|
|
23465
|
-
setUnderpaymentView(
|
|
23522
|
+
setUnderpaymentChoice((currentChoice) => currentChoice || recoveryChoice);
|
|
23523
|
+
setUnderpaymentView((currentView) => {
|
|
23524
|
+
if (currentView && currentView !== "choice") {
|
|
23525
|
+
return currentView;
|
|
23526
|
+
}
|
|
23527
|
+
return recoveryView || "choice";
|
|
23528
|
+
});
|
|
23466
23529
|
setManualCheckStatus(null);
|
|
23467
|
-
setRefundRequestSubmitted(false);
|
|
23530
|
+
setRefundRequestSubmitted((submitted) => recoveryChoice === "refund" ? submitted : false);
|
|
23468
23531
|
return true;
|
|
23469
|
-
}, [normalizeUnderpaymentInfo]);
|
|
23532
|
+
}, [normalizeUnderpaymentInfo, paymentData == null ? void 0 : paymentData.id, readUnderpaymentRecovery]);
|
|
23470
23533
|
const activateUnderpaymentFromDepositBalance = useCallback((balanceResult) => {
|
|
23471
23534
|
const received = Number((balanceResult == null ? void 0 : balanceResult.balance) ?? (balanceResult == null ? void 0 : balanceResult.balanceFormatted) ?? 0);
|
|
23472
23535
|
const expected = Number((balanceResult == null ? void 0 : balanceResult.expectedAmount) ?? paymentAmount ?? 0);
|
|
@@ -23935,15 +23998,11 @@ const CoinleyPaymentInternal = ({
|
|
|
23935
23998
|
try {
|
|
23936
23999
|
const statusResult = await paymentFlow.api.getDepositStatus(paymentData.id);
|
|
23937
24000
|
if (statusResult.success && statusResult.payment) {
|
|
23938
|
-
if (activateUnderpaymentFlow(statusResult.payment)) {
|
|
23939
|
-
clearInterval(pollInterval);
|
|
23940
|
-
setCurrentStep(PAYMENT_STEPS.CONFIRM);
|
|
23941
|
-
return;
|
|
23942
|
-
}
|
|
23943
24001
|
const status = statusResult.payment.status;
|
|
23944
24002
|
const txHash = statusResult.payment.depositTxHash || statusResult.payment.sweepTxHash || statusResult.payment.transactionHash;
|
|
23945
24003
|
if ((status === "completed" || status === "swept") && txHash) {
|
|
23946
24004
|
clearInterval(pollInterval);
|
|
24005
|
+
clearUnderpaymentRecovery(paymentData.id);
|
|
23947
24006
|
setProcessingStatusMessage("");
|
|
23948
24007
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
23949
24008
|
sdkAnalytics.trackPaymentSuccess(
|
|
@@ -23970,8 +24029,15 @@ const CoinleyPaymentInternal = ({
|
|
|
23970
24029
|
paymentDetails: statusResult.payment
|
|
23971
24030
|
});
|
|
23972
24031
|
}
|
|
24032
|
+
return;
|
|
24033
|
+
}
|
|
24034
|
+
if (activateUnderpaymentFlow(statusResult.payment)) {
|
|
24035
|
+
clearInterval(pollInterval);
|
|
24036
|
+
setCurrentStep(PAYMENT_STEPS.CONFIRM);
|
|
24037
|
+
return;
|
|
23973
24038
|
} else if (status === "failed" || status === "sweep_failed") {
|
|
23974
24039
|
clearInterval(pollInterval);
|
|
24040
|
+
clearUnderpaymentRecovery(paymentData.id);
|
|
23975
24041
|
setProcessingStatusMessage("");
|
|
23976
24042
|
sdkAnalytics.trackPaymentFailed(
|
|
23977
24043
|
paymentData.id,
|
|
@@ -23996,7 +24062,7 @@ const CoinleyPaymentInternal = ({
|
|
|
23996
24062
|
}
|
|
23997
24063
|
}, 5e3);
|
|
23998
24064
|
return () => clearInterval(pollInterval);
|
|
23999
|
-
}, [currentStep, paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, selectedNetwork, selectedToken, onSuccess, activateUnderpaymentFlow]);
|
|
24065
|
+
}, [currentStep, paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, selectedNetwork, selectedToken, onSuccess, activateUnderpaymentFlow, clearUnderpaymentRecovery]);
|
|
24000
24066
|
useEffect(() => {
|
|
24001
24067
|
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);
|
|
24002
24068
|
if (!shouldPoll) {
|
|
@@ -25524,15 +25590,12 @@ const CoinleyPaymentInternal = ({
|
|
|
25524
25590
|
try {
|
|
25525
25591
|
const statusResult = await paymentFlow.api.getDepositStatus(paymentData.id);
|
|
25526
25592
|
if (statusResult.success && statusResult.payment) {
|
|
25527
|
-
if (activateUnderpaymentFlow(statusResult.payment)) {
|
|
25528
|
-
clearInterval(pollInterval);
|
|
25529
|
-
return;
|
|
25530
|
-
}
|
|
25531
25593
|
const status = statusResult.payment.status;
|
|
25532
25594
|
const txHash = statusResult.payment.depositTxHash || statusResult.payment.sweepTxHash || statusResult.payment.transactionHash;
|
|
25533
25595
|
if ((status === "completed" || status === "swept") && txHash) {
|
|
25534
25596
|
console.log("✅ Auto-detected: Deposit payment completed!");
|
|
25535
25597
|
clearInterval(pollInterval);
|
|
25598
|
+
clearUnderpaymentRecovery(paymentData.id);
|
|
25536
25599
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
25537
25600
|
sdkAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
|
|
25538
25601
|
clarityAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
|
|
@@ -25546,12 +25609,19 @@ const CoinleyPaymentInternal = ({
|
|
|
25546
25609
|
paymentDetails: statusResult.payment
|
|
25547
25610
|
});
|
|
25548
25611
|
}
|
|
25612
|
+
return;
|
|
25613
|
+
}
|
|
25614
|
+
if (activateUnderpaymentFlow(statusResult.payment)) {
|
|
25615
|
+
clearInterval(pollInterval);
|
|
25616
|
+
return;
|
|
25549
25617
|
} else if (status === "processing" || statusResult.payment.depositDetectedAt) {
|
|
25550
25618
|
console.log("⏳ Auto-detected: Deposit received, processing...");
|
|
25551
25619
|
clearInterval(pollInterval);
|
|
25620
|
+
clearUnderpaymentRecovery(paymentData.id);
|
|
25552
25621
|
setCurrentStep(PAYMENT_STEPS.PROCESSING);
|
|
25553
25622
|
} else if (status === "failed" || status === "expired") {
|
|
25554
25623
|
clearInterval(pollInterval);
|
|
25624
|
+
clearUnderpaymentRecovery(paymentData.id);
|
|
25555
25625
|
setError("Payment failed or expired. Please try again.");
|
|
25556
25626
|
}
|
|
25557
25627
|
}
|
|
@@ -25563,7 +25633,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25563
25633
|
console.log("🛑 Stopping deposit auto-detection polling");
|
|
25564
25634
|
clearInterval(pollInterval);
|
|
25565
25635
|
};
|
|
25566
|
-
}, [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]);
|
|
25636
|
+
}, [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]);
|
|
25567
25637
|
useEffect(() => {
|
|
25568
25638
|
return () => {
|
|
25569
25639
|
if (manualCheckTimeout.current) {
|
|
@@ -25572,17 +25642,40 @@ const CoinleyPaymentInternal = ({
|
|
|
25572
25642
|
};
|
|
25573
25643
|
}, []);
|
|
25574
25644
|
useEffect(() => {
|
|
25645
|
+
const recoveryState = readUnderpaymentRecovery(paymentData == null ? void 0 : paymentData.id);
|
|
25646
|
+
if (recoveryState && recoveryState.shortfallAmount && (recoveryState.choice === "offset" || recoveryState.choice === "refund")) {
|
|
25647
|
+
setUnderpaymentInfo({
|
|
25648
|
+
expectedAmount: recoveryState.expectedAmount,
|
|
25649
|
+
receivedAmount: recoveryState.receivedAmount,
|
|
25650
|
+
shortfallAmount: recoveryState.shortfallAmount,
|
|
25651
|
+
tokenSymbol: recoveryState.tokenSymbol || (selectedToken == null ? void 0 : selectedToken.symbol) || "Token",
|
|
25652
|
+
refundNetworkLabel: recoveryState.refundNetworkLabel || (selectedNetwork == null ? void 0 : selectedNetwork.displayName) || (selectedNetwork == null ? void 0 : selectedNetwork.name) || (selectedNetwork == null ? void 0 : selectedNetwork.shortName) || "selected network",
|
|
25653
|
+
paymentState: recoveryState.paymentState || "underpaid"
|
|
25654
|
+
});
|
|
25655
|
+
setUnderpaymentChoice(recoveryState.choice);
|
|
25656
|
+
setUnderpaymentView(recoveryState.view === "refund" ? "refund" : "offset");
|
|
25657
|
+
setManualCheckStatus(null);
|
|
25658
|
+
setRefundRequestSubmitted(false);
|
|
25659
|
+
return;
|
|
25660
|
+
}
|
|
25575
25661
|
setUnderpaymentInfo(null);
|
|
25576
25662
|
setUnderpaymentChoice(null);
|
|
25577
25663
|
setUnderpaymentView("choice");
|
|
25578
25664
|
setRefundAddress("");
|
|
25579
25665
|
setRefundRequestSubmitted(false);
|
|
25580
|
-
}, [paymentData == null ? void 0 : paymentData.id]);
|
|
25666
|
+
}, [paymentData == null ? void 0 : paymentData.id, readUnderpaymentRecovery, selectedNetwork, selectedToken]);
|
|
25667
|
+
useEffect(() => {
|
|
25668
|
+
if (!(paymentData == null ? void 0 : paymentData.id) || !underpaymentInfo || !underpaymentChoice || underpaymentView === "choice") {
|
|
25669
|
+
return;
|
|
25670
|
+
}
|
|
25671
|
+
writeUnderpaymentRecovery(underpaymentChoice, underpaymentView, underpaymentInfo);
|
|
25672
|
+
}, [paymentData == null ? void 0 : paymentData.id, underpaymentInfo, underpaymentChoice, underpaymentView, writeUnderpaymentRecovery]);
|
|
25581
25673
|
const handleRefundRequestSubmit = useCallback(() => {
|
|
25582
25674
|
const trimmedAddress = refundAddress.trim();
|
|
25583
25675
|
if (!trimmedAddress) return;
|
|
25584
25676
|
setRefundRequestSubmitted(true);
|
|
25585
25677
|
setManualCheckStatus(null);
|
|
25678
|
+
clearUnderpaymentRecovery(paymentData == null ? void 0 : paymentData.id);
|
|
25586
25679
|
const refundPayload = {
|
|
25587
25680
|
paymentId: paymentData == null ? void 0 : paymentData.id,
|
|
25588
25681
|
refundAddress: trimmedAddress,
|
|
@@ -25599,20 +25692,18 @@ const CoinleyPaymentInternal = ({
|
|
|
25599
25692
|
detail: refundPayload
|
|
25600
25693
|
}));
|
|
25601
25694
|
}
|
|
25602
|
-
}, [config, refundAddress, paymentData == null ? void 0 : paymentData.id, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo]);
|
|
25695
|
+
}, [clearUnderpaymentRecovery, config, refundAddress, paymentData == null ? void 0 : paymentData.id, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo]);
|
|
25603
25696
|
const handleDepositManualCheck = useCallback(async () => {
|
|
25604
25697
|
if (manualCheckStatus === "checking" || !(paymentData == null ? void 0 : paymentData.id)) return;
|
|
25605
25698
|
setManualCheckStatus("checking");
|
|
25606
25699
|
try {
|
|
25607
25700
|
const statusResult = await paymentFlow.api.getDepositStatus(paymentData.id);
|
|
25608
25701
|
if (statusResult.success && statusResult.payment) {
|
|
25609
|
-
if (activateUnderpaymentFlow(statusResult.payment)) {
|
|
25610
|
-
return;
|
|
25611
|
-
}
|
|
25612
25702
|
const status = statusResult.payment.status;
|
|
25613
25703
|
const txHash = statusResult.payment.depositTxHash || statusResult.payment.sweepTxHash || statusResult.payment.transactionHash;
|
|
25614
25704
|
if ((status === "completed" || status === "swept") && txHash) {
|
|
25615
25705
|
setManualCheckStatus(null);
|
|
25706
|
+
clearUnderpaymentRecovery(paymentData.id);
|
|
25616
25707
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
25617
25708
|
sdkAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
|
|
25618
25709
|
clarityAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
|
|
@@ -25628,8 +25719,12 @@ const CoinleyPaymentInternal = ({
|
|
|
25628
25719
|
}
|
|
25629
25720
|
return;
|
|
25630
25721
|
}
|
|
25722
|
+
if (activateUnderpaymentFlow(statusResult.payment)) {
|
|
25723
|
+
return;
|
|
25724
|
+
}
|
|
25631
25725
|
if (status === "processing" || statusResult.payment.depositDetectedAt) {
|
|
25632
25726
|
setManualCheckStatus(null);
|
|
25727
|
+
clearUnderpaymentRecovery(paymentData.id);
|
|
25633
25728
|
setCurrentStep(PAYMENT_STEPS.PROCESSING);
|
|
25634
25729
|
return;
|
|
25635
25730
|
}
|
|
@@ -25651,7 +25746,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25651
25746
|
setManualCheckStatus(null);
|
|
25652
25747
|
}, 1e4);
|
|
25653
25748
|
}
|
|
25654
|
-
}, [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]);
|
|
25749
|
+
}, [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]);
|
|
25655
25750
|
if (!isOpen) return null;
|
|
25656
25751
|
if (currentStep === PAYMENT_STEPS.PROCESSING) {
|
|
25657
25752
|
return /* @__PURE__ */ jsxs("div", { id: SDK_ROOT_ID, className: `${SDK_ROOT_CLASS} fixed inset-0 z-50`, style: { fontFamily: FONT_FAMILY }, children: [
|
|
@@ -25832,11 +25927,13 @@ const CoinleyPaymentInternal = ({
|
|
|
25832
25927
|
disabled: !underpaymentChoice,
|
|
25833
25928
|
onClick: () => {
|
|
25834
25929
|
setRefundRequestSubmitted(false);
|
|
25930
|
+
const nextView = underpaymentChoice === "refund" ? "refund" : "offset";
|
|
25931
|
+
writeUnderpaymentRecovery(underpaymentChoice, nextView, underpaymentInfo);
|
|
25835
25932
|
if (underpaymentChoice === "offset") {
|
|
25836
25933
|
modalOpenedAtRef.current = Date.now();
|
|
25837
25934
|
setTimeRemaining(paymentTimeoutMs);
|
|
25838
25935
|
}
|
|
25839
|
-
setUnderpaymentView(
|
|
25936
|
+
setUnderpaymentView(nextView);
|
|
25840
25937
|
},
|
|
25841
25938
|
className: `h-11 w-full rounded-xl px-4 text-sm font-semibold text-white transition-colors ${underpaymentChoice ? "bg-[#7042D2] hover:bg-[#5b34b1]" : "cursor-not-allowed bg-[#B59AE9]"}`,
|
|
25842
25939
|
children: "Continue"
|
|
@@ -25866,6 +25963,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25866
25963
|
null,
|
|
25867
25964
|
"Send only the offset amount to the same address. Make sure to add network fees on top of this amount."
|
|
25868
25965
|
),
|
|
25966
|
+
manualCheckStatus === "not_found" && /* @__PURE__ */ jsx("div", { className: "mb-3 rounded-xl border border-amber-200 bg-amber-50 p-3", children: /* @__PURE__ */ jsx("p", { className: "text-sm leading-5 text-amber-700", children: "We have not detected the offset yet. It can take a few moments to appear on-chain, and we will keep checking automatically." }) }),
|
|
25869
25967
|
/* @__PURE__ */ jsx(
|
|
25870
25968
|
"button",
|
|
25871
25969
|
{
|
|
@@ -26906,6 +27004,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26906
27004
|
setUnderpaymentView("choice");
|
|
26907
27005
|
return;
|
|
26908
27006
|
}
|
|
27007
|
+
clearUnderpaymentRecovery(paymentData == null ? void 0 : paymentData.id);
|
|
26909
27008
|
setPaymentData((prev) => {
|
|
26910
27009
|
if (!prev) return prev;
|
|
26911
27010
|
return {
|
|
@@ -27016,4 +27115,4 @@ export {
|
|
|
27016
27115
|
isFeatureEnabled as i,
|
|
27017
27116
|
logo as l
|
|
27018
27117
|
};
|
|
27019
|
-
//# sourceMappingURL=CoinleyPayment-
|
|
27118
|
+
//# sourceMappingURL=CoinleyPayment-BUCxlaSN.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-BUCxlaSN.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--OanO4zO.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-BUCxlaSN.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-CNQLFPw3.js.map
|