coinley-pay 0.30.0 → 0.32.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-BUCxlaSN.js → CoinleyPayment-kY9bEp6d.js} +89 -22
- package/dist/{appKitEVM--OanO4zO.js → appKitEVM-B0kEAmQe.js} +2 -2
- package/dist/{appKitSolana-CNQLFPw3.js → appKitSolana-DJIYi1aC.js} +2 -2
- package/dist/coinley-vanilla.min.js +2 -2
- package/dist/{index-DXIE_oad.js → index-CC_wEc1a.js} +3 -3
- package/dist/{index-EgEF0eVy.js → index-DfHDQFzN.js} +3 -3
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +2 -2
- 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-DfHDQFzN.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";
|
|
@@ -2428,6 +2428,18 @@ class SimplePaymentAPI {
|
|
|
2428
2428
|
async getDepositBalance(paymentId) {
|
|
2429
2429
|
return await this.request(`/api/deposits/balance/${paymentId}`);
|
|
2430
2430
|
}
|
|
2431
|
+
/**
|
|
2432
|
+
* Request refund for an underpaid deposit payment
|
|
2433
|
+
* @param {string} paymentId - Payment ID
|
|
2434
|
+
* @param {string} refundAddress - Customer refund wallet address
|
|
2435
|
+
* @returns {Promise<{success: boolean, payment: Object}>}
|
|
2436
|
+
*/
|
|
2437
|
+
async requestDepositRefund(paymentId, refundAddress) {
|
|
2438
|
+
return await this.request(`/api/deposits/refund-request/${paymentId}`, {
|
|
2439
|
+
method: "POST",
|
|
2440
|
+
body: JSON.stringify({ refundAddress })
|
|
2441
|
+
});
|
|
2442
|
+
}
|
|
2431
2443
|
// ==================== BRIDGE ROUTING API ====================
|
|
2432
2444
|
async getBridgeRoute(params) {
|
|
2433
2445
|
const response = await this.request("/api/bridge/quote", {
|
|
@@ -21121,7 +21133,7 @@ const WalletSelector = ({
|
|
|
21121
21133
|
try {
|
|
21122
21134
|
setAppKitError(null);
|
|
21123
21135
|
setWalletConnectAddress(solanaAccountState.address);
|
|
21124
|
-
const { createWalletConnectAdapter } = await import("./appKitSolana-
|
|
21136
|
+
const { createWalletConnectAdapter } = await import("./appKitSolana-DJIYi1aC.js");
|
|
21125
21137
|
const adapter = createWalletConnectAdapter(solanaAccountState.address);
|
|
21126
21138
|
await solanaWallet.connectWalletConnect(adapter, solanaAccountState.address);
|
|
21127
21139
|
console.log("✅ WalletConnect synced with SDK");
|
|
@@ -21226,7 +21238,7 @@ const WalletSelector = ({
|
|
|
21226
21238
|
setAppKitLoading(true);
|
|
21227
21239
|
setAppKitError(null);
|
|
21228
21240
|
try {
|
|
21229
|
-
const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM
|
|
21241
|
+
const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-B0kEAmQe.js");
|
|
21230
21242
|
await initializeAppKitEVM(wagmiConfig);
|
|
21231
21243
|
await openAppKitModal();
|
|
21232
21244
|
} catch (error) {
|
|
@@ -21246,7 +21258,7 @@ const WalletSelector = ({
|
|
|
21246
21258
|
setAppKitError(null);
|
|
21247
21259
|
try {
|
|
21248
21260
|
console.log("📦 Loading AppKit Solana module...");
|
|
21249
|
-
const { initializeAppKitSolana } = await import("./appKitSolana-
|
|
21261
|
+
const { initializeAppKitSolana } = await import("./appKitSolana-DJIYi1aC.js");
|
|
21250
21262
|
console.log("✅ Module loaded, initializing...");
|
|
21251
21263
|
const modal = await initializeAppKitSolana(solanaWallet);
|
|
21252
21264
|
console.log("✅ AppKit Solana initialized successfully");
|
|
@@ -23290,6 +23302,8 @@ const CoinleyPaymentInternal = ({
|
|
|
23290
23302
|
const [underpaymentView, setUnderpaymentView] = useState("choice");
|
|
23291
23303
|
const [refundAddress, setRefundAddress] = useState("");
|
|
23292
23304
|
const [refundRequestSubmitted, setRefundRequestSubmitted] = useState(false);
|
|
23305
|
+
const [refundRequestStatus, setRefundRequestStatus] = useState(null);
|
|
23306
|
+
const [refundRequestMessage, setRefundRequestMessage] = useState("");
|
|
23293
23307
|
const manualCheckTimeout = useRef(null);
|
|
23294
23308
|
const [copiedField, setCopiedField] = useState(null);
|
|
23295
23309
|
const [expirationTime, setExpirationTime] = useState(null);
|
|
@@ -23429,6 +23443,20 @@ const CoinleyPaymentInternal = ({
|
|
|
23429
23443
|
const hasCommittedTransaction = Boolean(
|
|
23430
23444
|
currentTransactionHash || (solanaTransaction == null ? void 0 : solanaTransaction.txSignature) || (paymentData == null ? void 0 : paymentData.transactionHash)
|
|
23431
23445
|
);
|
|
23446
|
+
const resolvePaymentTransactionHash = useCallback((payment) => {
|
|
23447
|
+
return (payment == null ? void 0 : payment.depositTxHash) || (payment == null ? void 0 : payment.sweepTxHash) || (payment == null ? void 0 : payment.transactionHash) || null;
|
|
23448
|
+
}, []);
|
|
23449
|
+
const persistSuccessfulPaymentHash = useCallback((payment, txHash) => {
|
|
23450
|
+
const resolvedTxHash = txHash || resolvePaymentTransactionHash(payment);
|
|
23451
|
+
if (!resolvedTxHash) return;
|
|
23452
|
+
setPaymentData((prev) => ({
|
|
23453
|
+
...prev || {},
|
|
23454
|
+
...payment || {},
|
|
23455
|
+
transactionHash: resolvedTxHash,
|
|
23456
|
+
depositTxHash: (payment == null ? void 0 : payment.depositTxHash) ?? (prev == null ? void 0 : prev.depositTxHash),
|
|
23457
|
+
sweepTxHash: (payment == null ? void 0 : payment.sweepTxHash) ?? (prev == null ? void 0 : prev.sweepTxHash)
|
|
23458
|
+
}));
|
|
23459
|
+
}, [resolvePaymentTransactionHash, setPaymentData]);
|
|
23432
23460
|
const getUnderpaymentRecoveryStorageKey = useCallback((paymentId = paymentData == null ? void 0 : paymentData.id) => {
|
|
23433
23461
|
return paymentId ? `${UNDERPAYMENT_RECOVERY_STORAGE_PREFIX}${paymentId}` : null;
|
|
23434
23462
|
}, [paymentData == null ? void 0 : paymentData.id]);
|
|
@@ -23528,6 +23556,8 @@ const CoinleyPaymentInternal = ({
|
|
|
23528
23556
|
});
|
|
23529
23557
|
setManualCheckStatus(null);
|
|
23530
23558
|
setRefundRequestSubmitted((submitted) => recoveryChoice === "refund" ? submitted : false);
|
|
23559
|
+
setRefundRequestStatus((status) => status);
|
|
23560
|
+
setRefundRequestMessage((message) => message);
|
|
23531
23561
|
return true;
|
|
23532
23562
|
}, [normalizeUnderpaymentInfo, paymentData == null ? void 0 : paymentData.id, readUnderpaymentRecovery]);
|
|
23533
23563
|
const activateUnderpaymentFromDepositBalance = useCallback((balanceResult) => {
|
|
@@ -23922,6 +23952,13 @@ const CoinleyPaymentInternal = ({
|
|
|
23922
23952
|
}, [paymentTimeoutMs, timeRemaining > 0]);
|
|
23923
23953
|
useEffect(() => {
|
|
23924
23954
|
if (timeRemaining === 0 && currentStep !== PAYMENT_STEPS.SUCCESS) {
|
|
23955
|
+
if (refundRequestSubmitted || refundRequestStatus === "submitting" || refundRequestStatus === "pending" || refundRequestStatus === "refunded") {
|
|
23956
|
+
console.log("[CheckoutTimer] Timeout reached after refund request; leaving refund flow open.", {
|
|
23957
|
+
paymentId: paymentData == null ? void 0 : paymentData.id,
|
|
23958
|
+
refundRequestStatus
|
|
23959
|
+
});
|
|
23960
|
+
return;
|
|
23961
|
+
}
|
|
23925
23962
|
if (hasCommittedTransaction || transactionStep === "settlement_pending") {
|
|
23926
23963
|
console.warn("[CheckoutTimer] Timeout reached after transaction commit; keeping payment in processing state.", {
|
|
23927
23964
|
paymentId: paymentData == null ? void 0 : paymentData.id,
|
|
@@ -23964,7 +24001,7 @@ const CoinleyPaymentInternal = ({
|
|
|
23964
24001
|
}
|
|
23965
24002
|
onClose();
|
|
23966
24003
|
}
|
|
23967
|
-
}, [currentStep, hasCommittedTransaction, onClose, onError, paymentData == null ? void 0 : paymentData.id, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, config == null ? void 0 : config.amount, config == null ? void 0 : config.callbackUrl, timeRemaining, transactionStep]);
|
|
24004
|
+
}, [currentStep, hasCommittedTransaction, onClose, onError, paymentData == null ? void 0 : paymentData.id, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, config == null ? void 0 : config.amount, config == null ? void 0 : config.callbackUrl, timeRemaining, transactionStep, refundRequestSubmitted, refundRequestStatus]);
|
|
23968
24005
|
const formatCountdown = useCallback((ms) => {
|
|
23969
24006
|
if (ms <= 0) return "00:00";
|
|
23970
24007
|
const totalSeconds = Math.floor(ms / 1e3);
|
|
@@ -23999,11 +24036,12 @@ const CoinleyPaymentInternal = ({
|
|
|
23999
24036
|
const statusResult = await paymentFlow.api.getDepositStatus(paymentData.id);
|
|
24000
24037
|
if (statusResult.success && statusResult.payment) {
|
|
24001
24038
|
const status = statusResult.payment.status;
|
|
24002
|
-
const txHash = statusResult.payment
|
|
24039
|
+
const txHash = resolvePaymentTransactionHash(statusResult.payment);
|
|
24003
24040
|
if ((status === "completed" || status === "swept") && txHash) {
|
|
24004
24041
|
clearInterval(pollInterval);
|
|
24005
24042
|
clearUnderpaymentRecovery(paymentData.id);
|
|
24006
24043
|
setProcessingStatusMessage("");
|
|
24044
|
+
persistSuccessfulPaymentHash(statusResult.payment, txHash);
|
|
24007
24045
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
24008
24046
|
sdkAnalytics.trackPaymentSuccess(
|
|
24009
24047
|
paymentData.id,
|
|
@@ -24062,7 +24100,7 @@ const CoinleyPaymentInternal = ({
|
|
|
24062
24100
|
}
|
|
24063
24101
|
}, 5e3);
|
|
24064
24102
|
return () => clearInterval(pollInterval);
|
|
24065
|
-
}, [currentStep, paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, selectedNetwork, selectedToken, onSuccess, activateUnderpaymentFlow, clearUnderpaymentRecovery]);
|
|
24103
|
+
}, [currentStep, paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.depositAddress, selectedNetwork, selectedToken, onSuccess, activateUnderpaymentFlow, clearUnderpaymentRecovery, resolvePaymentTransactionHash, persistSuccessfulPaymentHash]);
|
|
24066
24104
|
useEffect(() => {
|
|
24067
24105
|
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);
|
|
24068
24106
|
if (!shouldPoll) {
|
|
@@ -24078,6 +24116,7 @@ const CoinleyPaymentInternal = ({
|
|
|
24078
24116
|
if (status === "completed" || status === "success") {
|
|
24079
24117
|
console.log("✅ Auto-detected: Payment already completed");
|
|
24080
24118
|
clearInterval(pollInterval);
|
|
24119
|
+
persistSuccessfulPaymentHash(statusResult.payment, statusResult.payment.transactionHash);
|
|
24081
24120
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
24082
24121
|
sdkAnalytics.trackPaymentSuccess(
|
|
24083
24122
|
paymentData.id,
|
|
@@ -24110,8 +24149,9 @@ const CoinleyPaymentInternal = ({
|
|
|
24110
24149
|
if (verificationResult.success && verificationResult.verified) {
|
|
24111
24150
|
console.log("✅ Auto-detected: Payment verified on blockchain!");
|
|
24112
24151
|
clearInterval(pollInterval);
|
|
24113
|
-
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
24114
24152
|
const txHash = ((_a2 = verificationResult.payment) == null ? void 0 : _a2.transactionHash) || ((_b = verificationResult.onChainData) == null ? void 0 : _b.transactionHash);
|
|
24153
|
+
persistSuccessfulPaymentHash(verificationResult.payment, txHash);
|
|
24154
|
+
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
24115
24155
|
sdkAnalytics.trackPaymentSuccess(
|
|
24116
24156
|
paymentData.id,
|
|
24117
24157
|
config == null ? void 0 : config.amount,
|
|
@@ -24144,7 +24184,7 @@ const CoinleyPaymentInternal = ({
|
|
|
24144
24184
|
console.log("🛑 Stopping auto-detection polling");
|
|
24145
24185
|
clearInterval(pollInterval);
|
|
24146
24186
|
};
|
|
24147
|
-
}, [paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.isDepositPayment, paymentData == null ? void 0 : paymentData.depositAddress, activeTab, currentStep, verifyingPayment, paymentType, selectedNetwork, selectedToken, onSuccess, paymentFlow.api]);
|
|
24187
|
+
}, [paymentData == null ? void 0 : paymentData.id, paymentData == null ? void 0 : paymentData.isDepositPayment, paymentData == null ? void 0 : paymentData.depositAddress, activeTab, currentStep, verifyingPayment, paymentType, selectedNetwork, selectedToken, onSuccess, paymentFlow.api, persistSuccessfulPaymentHash]);
|
|
24148
24188
|
const resetAllTransactionState = async () => {
|
|
24149
24189
|
var _a2;
|
|
24150
24190
|
invalidateCurrentAttempt("reset-all-transaction-state");
|
|
@@ -25521,6 +25561,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25521
25561
|
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
25522
25562
|
const result = await checkPayment();
|
|
25523
25563
|
if (result.success) {
|
|
25564
|
+
persistSuccessfulPaymentHash(result.payment, result.txHash);
|
|
25524
25565
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
25525
25566
|
if (onSuccess) {
|
|
25526
25567
|
onSuccess({
|
|
@@ -25591,11 +25632,12 @@ const CoinleyPaymentInternal = ({
|
|
|
25591
25632
|
const statusResult = await paymentFlow.api.getDepositStatus(paymentData.id);
|
|
25592
25633
|
if (statusResult.success && statusResult.payment) {
|
|
25593
25634
|
const status = statusResult.payment.status;
|
|
25594
|
-
const txHash = statusResult.payment
|
|
25635
|
+
const txHash = resolvePaymentTransactionHash(statusResult.payment);
|
|
25595
25636
|
if ((status === "completed" || status === "swept") && txHash) {
|
|
25596
25637
|
console.log("✅ Auto-detected: Deposit payment completed!");
|
|
25597
25638
|
clearInterval(pollInterval);
|
|
25598
25639
|
clearUnderpaymentRecovery(paymentData.id);
|
|
25640
|
+
persistSuccessfulPaymentHash(statusResult.payment, txHash);
|
|
25599
25641
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
25600
25642
|
sdkAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
|
|
25601
25643
|
clarityAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
|
|
@@ -25633,7 +25675,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25633
25675
|
console.log("🛑 Stopping deposit auto-detection polling");
|
|
25634
25676
|
clearInterval(pollInterval);
|
|
25635
25677
|
};
|
|
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]);
|
|
25678
|
+
}, [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]);
|
|
25637
25679
|
useEffect(() => {
|
|
25638
25680
|
return () => {
|
|
25639
25681
|
if (manualCheckTimeout.current) {
|
|
@@ -25656,6 +25698,8 @@ const CoinleyPaymentInternal = ({
|
|
|
25656
25698
|
setUnderpaymentView(recoveryState.view === "refund" ? "refund" : "offset");
|
|
25657
25699
|
setManualCheckStatus(null);
|
|
25658
25700
|
setRefundRequestSubmitted(false);
|
|
25701
|
+
setRefundRequestStatus(null);
|
|
25702
|
+
setRefundRequestMessage("");
|
|
25659
25703
|
return;
|
|
25660
25704
|
}
|
|
25661
25705
|
setUnderpaymentInfo(null);
|
|
@@ -25663,6 +25707,8 @@ const CoinleyPaymentInternal = ({
|
|
|
25663
25707
|
setUnderpaymentView("choice");
|
|
25664
25708
|
setRefundAddress("");
|
|
25665
25709
|
setRefundRequestSubmitted(false);
|
|
25710
|
+
setRefundRequestStatus(null);
|
|
25711
|
+
setRefundRequestMessage("");
|
|
25666
25712
|
}, [paymentData == null ? void 0 : paymentData.id, readUnderpaymentRecovery, selectedNetwork, selectedToken]);
|
|
25667
25713
|
useEffect(() => {
|
|
25668
25714
|
if (!(paymentData == null ? void 0 : paymentData.id) || !underpaymentInfo || !underpaymentChoice || underpaymentView === "choice") {
|
|
@@ -25670,10 +25716,12 @@ const CoinleyPaymentInternal = ({
|
|
|
25670
25716
|
}
|
|
25671
25717
|
writeUnderpaymentRecovery(underpaymentChoice, underpaymentView, underpaymentInfo);
|
|
25672
25718
|
}, [paymentData == null ? void 0 : paymentData.id, underpaymentInfo, underpaymentChoice, underpaymentView, writeUnderpaymentRecovery]);
|
|
25673
|
-
const handleRefundRequestSubmit = useCallback(() => {
|
|
25719
|
+
const handleRefundRequestSubmit = useCallback(async () => {
|
|
25720
|
+
var _a2;
|
|
25674
25721
|
const trimmedAddress = refundAddress.trim();
|
|
25675
|
-
if (!trimmedAddress) return;
|
|
25676
|
-
|
|
25722
|
+
if (!trimmedAddress || !(paymentData == null ? void 0 : paymentData.id) || refundRequestStatus === "submitting") return;
|
|
25723
|
+
setRefundRequestStatus("submitting");
|
|
25724
|
+
setRefundRequestMessage("");
|
|
25677
25725
|
setManualCheckStatus(null);
|
|
25678
25726
|
clearUnderpaymentRecovery(paymentData == null ? void 0 : paymentData.id);
|
|
25679
25727
|
const refundPayload = {
|
|
@@ -25692,7 +25740,21 @@ const CoinleyPaymentInternal = ({
|
|
|
25692
25740
|
detail: refundPayload
|
|
25693
25741
|
}));
|
|
25694
25742
|
}
|
|
25695
|
-
|
|
25743
|
+
try {
|
|
25744
|
+
const result = await paymentFlow.api.requestDepositRefund(paymentData.id, trimmedAddress);
|
|
25745
|
+
const refundStatus = ((_a2 = result == null ? void 0 : result.payment) == null ? void 0 : _a2.refundStatus) || "pending";
|
|
25746
|
+
setRefundRequestSubmitted(true);
|
|
25747
|
+
setRefundRequestStatus(refundStatus === "refunded" ? "refunded" : "pending");
|
|
25748
|
+
setRefundRequestMessage(
|
|
25749
|
+
refundStatus === "refunded" ? "Refund sent successfully." : "Refund request received. We will process it automatically; if network gas is low, it may remain pending until the sweeper wallet is funded."
|
|
25750
|
+
);
|
|
25751
|
+
} catch (error2) {
|
|
25752
|
+
console.warn("[RefundRequest] Error:", error2.message);
|
|
25753
|
+
setRefundRequestSubmitted(false);
|
|
25754
|
+
setRefundRequestStatus("error");
|
|
25755
|
+
setRefundRequestMessage(error2.message || "Failed to submit refund request. Please try again.");
|
|
25756
|
+
}
|
|
25757
|
+
}, [clearUnderpaymentRecovery, config, refundAddress, refundRequestStatus, paymentData == null ? void 0 : paymentData.id, paymentFlow.api, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, underpaymentInfo]);
|
|
25696
25758
|
const handleDepositManualCheck = useCallback(async () => {
|
|
25697
25759
|
if (manualCheckStatus === "checking" || !(paymentData == null ? void 0 : paymentData.id)) return;
|
|
25698
25760
|
setManualCheckStatus("checking");
|
|
@@ -25700,10 +25762,11 @@ const CoinleyPaymentInternal = ({
|
|
|
25700
25762
|
const statusResult = await paymentFlow.api.getDepositStatus(paymentData.id);
|
|
25701
25763
|
if (statusResult.success && statusResult.payment) {
|
|
25702
25764
|
const status = statusResult.payment.status;
|
|
25703
|
-
const txHash = statusResult.payment
|
|
25765
|
+
const txHash = resolvePaymentTransactionHash(statusResult.payment);
|
|
25704
25766
|
if ((status === "completed" || status === "swept") && txHash) {
|
|
25705
25767
|
setManualCheckStatus(null);
|
|
25706
25768
|
clearUnderpaymentRecovery(paymentData.id);
|
|
25769
|
+
persistSuccessfulPaymentHash(statusResult.payment, txHash);
|
|
25707
25770
|
setCurrentStep(PAYMENT_STEPS.SUCCESS);
|
|
25708
25771
|
sdkAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
|
|
25709
25772
|
clarityAnalytics.trackPaymentSuccess(paymentData.id, config == null ? void 0 : config.amount, selectedNetwork == null ? void 0 : selectedNetwork.shortName, selectedToken == null ? void 0 : selectedToken.symbol, txHash);
|
|
@@ -25746,7 +25809,7 @@ const CoinleyPaymentInternal = ({
|
|
|
25746
25809
|
setManualCheckStatus(null);
|
|
25747
25810
|
}, 1e4);
|
|
25748
25811
|
}
|
|
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]);
|
|
25812
|
+
}, [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]);
|
|
25750
25813
|
if (!isOpen) return null;
|
|
25751
25814
|
if (currentStep === PAYMENT_STEPS.PROCESSING) {
|
|
25752
25815
|
return /* @__PURE__ */ jsxs("div", { id: SDK_ROOT_ID, className: `${SDK_ROOT_CLASS} fixed inset-0 z-50`, style: { fontFamily: FONT_FAMILY }, children: [
|
|
@@ -25887,6 +25950,8 @@ const CoinleyPaymentInternal = ({
|
|
|
25887
25950
|
onClick: () => {
|
|
25888
25951
|
setUnderpaymentChoice(choice);
|
|
25889
25952
|
setRefundRequestSubmitted(false);
|
|
25953
|
+
setRefundRequestStatus(null);
|
|
25954
|
+
setRefundRequestMessage("");
|
|
25890
25955
|
},
|
|
25891
25956
|
className: `relative flex min-h-[118px] flex-1 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]"}`,
|
|
25892
25957
|
children: [
|
|
@@ -26001,13 +26066,13 @@ const CoinleyPaymentInternal = ({
|
|
|
26001
26066
|
"button",
|
|
26002
26067
|
{
|
|
26003
26068
|
type: "button",
|
|
26004
|
-
disabled: !refundAddress.trim(),
|
|
26069
|
+
disabled: !refundAddress.trim() || refundRequestStatus === "submitting" || refundRequestStatus === "pending" || refundRequestStatus === "refunded",
|
|
26005
26070
|
onClick: handleRefundRequestSubmit,
|
|
26006
|
-
className: `h-11 w-full rounded-xl px-4 text-sm font-semibold text-white transition-colors ${refundAddress.trim() ? "bg-[#7042D2] hover:bg-[#5b34b1]" : "cursor-not-allowed bg-[#B59AE9]"}`,
|
|
26007
|
-
children: refundRequestSubmitted ? "Refund request submitted" : "Submit refund request"
|
|
26071
|
+
className: `h-11 w-full rounded-xl px-4 text-sm font-semibold text-white transition-colors ${refundAddress.trim() && refundRequestStatus !== "submitting" && refundRequestStatus !== "pending" && refundRequestStatus !== "refunded" ? "bg-[#7042D2] hover:bg-[#5b34b1]" : "cursor-not-allowed bg-[#B59AE9]"}`,
|
|
26072
|
+
children: refundRequestStatus === "submitting" ? "Submitting refund request..." : refundRequestSubmitted ? "Refund request submitted" : "Submit refund request"
|
|
26008
26073
|
}
|
|
26009
26074
|
),
|
|
26010
|
-
|
|
26075
|
+
refundRequestMessage && /* @__PURE__ */ jsx("p", { className: `mt-2 text-center text-xs leading-5 ${refundRequestStatus === "error" ? "text-red-600" : "text-[#8B8E98]"}`, children: refundRequestMessage })
|
|
26011
26076
|
] });
|
|
26012
26077
|
const transferNetworks = networks.filter((network) => {
|
|
26013
26078
|
const chainId = parseInt(network.chainId);
|
|
@@ -27021,6 +27086,8 @@ const CoinleyPaymentInternal = ({
|
|
|
27021
27086
|
setUnderpaymentView("choice");
|
|
27022
27087
|
setRefundAddress("");
|
|
27023
27088
|
setRefundRequestSubmitted(false);
|
|
27089
|
+
setRefundRequestStatus(null);
|
|
27090
|
+
setRefundRequestMessage("");
|
|
27024
27091
|
await resetAllTransactionState();
|
|
27025
27092
|
setActiveTab(PAYMENT_TABS.TRANSFER);
|
|
27026
27093
|
};
|
|
@@ -27115,4 +27182,4 @@ export {
|
|
|
27115
27182
|
isFeatureEnabled as i,
|
|
27116
27183
|
logo as l
|
|
27117
27184
|
};
|
|
27118
|
-
//# sourceMappingURL=CoinleyPayment-
|
|
27185
|
+
//# sourceMappingURL=CoinleyPayment-kY9bEp6d.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-kY9bEp6d.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-B0kEAmQe.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-kY9bEp6d.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-DJIYi1aC.js.map
|