coinley-pay 0.17.0 → 0.19.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-DWGoIei3.js → CoinleyPayment-DK-cf2Vl.js} +37 -16
- package/dist/{appKitEVM-CH55u3Is.js → appKitEVM-DNxsUg-8.js} +2 -2
- package/dist/{appKitSolana-jtnvPa0Y.js → appKitSolana-fo6vF0_g.js} +2 -2
- package/dist/coinley-vanilla.min.js +576 -576
- package/dist/{index-ArVDuAUY.js → index-BCVqFOuo.js} +3 -3
- package/dist/{index-knR8SxKc.js → index-z0MvwxcY.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-BCVqFOuo.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";
|
|
@@ -3616,6 +3616,11 @@ const useTransactionHandling = (paymentData, selectedToken, selectedNetwork, add
|
|
|
3616
3616
|
const { isLoading: isConfirming, isSuccess: isConfirmed } = useWaitForTransactionReceipt({
|
|
3617
3617
|
hash: txHash
|
|
3618
3618
|
});
|
|
3619
|
+
const finalizePaymentInBackground = (transactionHash, activePaymentData) => {
|
|
3620
|
+
processFinalPayment(transactionHash, activePaymentData, { background: true }).catch((error) => {
|
|
3621
|
+
console.error("[processFinalPayment] Background finalization failed:", error);
|
|
3622
|
+
});
|
|
3623
|
+
};
|
|
3619
3624
|
const executePaymentTransaction = async (paymentOverride = null) => {
|
|
3620
3625
|
var _a, _b;
|
|
3621
3626
|
const activePaymentData = paymentOverride || paymentData;
|
|
@@ -3724,7 +3729,7 @@ const useTransactionHandling = (paymentData, selectedToken, selectedNetwork, add
|
|
|
3724
3729
|
setTransactionStep("splitPayment");
|
|
3725
3730
|
const splitPaymentHash2 = await executeSplitPayment();
|
|
3726
3731
|
if (splitPaymentHash2) {
|
|
3727
|
-
|
|
3732
|
+
finalizePaymentInBackground(splitPaymentHash2, activePaymentData);
|
|
3728
3733
|
}
|
|
3729
3734
|
return splitPaymentHash2;
|
|
3730
3735
|
}
|
|
@@ -3792,7 +3797,7 @@ const useTransactionHandling = (paymentData, selectedToken, selectedNetwork, add
|
|
|
3792
3797
|
}
|
|
3793
3798
|
const splitPaymentHash = await executeSplitPayment();
|
|
3794
3799
|
if (splitPaymentHash) {
|
|
3795
|
-
|
|
3800
|
+
finalizePaymentInBackground(splitPaymentHash, activePaymentData);
|
|
3796
3801
|
}
|
|
3797
3802
|
return splitPaymentHash;
|
|
3798
3803
|
} catch (error) {
|
|
@@ -3898,11 +3903,14 @@ const useTransactionHandling = (paymentData, selectedToken, selectedNetwork, add
|
|
|
3898
3903
|
throw error;
|
|
3899
3904
|
}
|
|
3900
3905
|
};
|
|
3901
|
-
const processFinalPayment = async (transactionHash, paymentOverride = null) => {
|
|
3906
|
+
const processFinalPayment = async (transactionHash, paymentOverride = null, options = {}) => {
|
|
3902
3907
|
var _a;
|
|
3903
3908
|
const activePaymentData = paymentOverride || paymentData;
|
|
3909
|
+
const runInBackground = (options == null ? void 0 : options.background) === true;
|
|
3904
3910
|
try {
|
|
3905
|
-
|
|
3911
|
+
if (!runInBackground) {
|
|
3912
|
+
setTransactionStep("processing");
|
|
3913
|
+
}
|
|
3906
3914
|
console.log("🔄 [processFinalPayment] Starting payment finalization...");
|
|
3907
3915
|
if (approveTransactionHash && transactionHash === approveTransactionHash) {
|
|
3908
3916
|
console.error("🛑 [processFinalPayment] BLOCKED: Attempted to send approve hash to backend!", {
|
|
@@ -3914,8 +3922,10 @@ const useTransactionHandling = (paymentData, selectedToken, selectedNetwork, add
|
|
|
3914
3922
|
if (!api || !api.processPayment) {
|
|
3915
3923
|
throw new Error("API instance not available or missing processPayment method");
|
|
3916
3924
|
}
|
|
3917
|
-
|
|
3918
|
-
|
|
3925
|
+
if (!runInBackground) {
|
|
3926
|
+
console.log("⏳ [processFinalPayment] Waiting 4s for blockchain indexers to sync...");
|
|
3927
|
+
await new Promise((resolve) => setTimeout(resolve, 4e3));
|
|
3928
|
+
}
|
|
3919
3929
|
const maxProcessRetries = 3;
|
|
3920
3930
|
let lastProcessError = null;
|
|
3921
3931
|
for (let processAttempt = 0; processAttempt < maxProcessRetries; processAttempt++) {
|
|
@@ -3934,7 +3944,9 @@ const useTransactionHandling = (paymentData, selectedToken, selectedNetwork, add
|
|
|
3934
3944
|
);
|
|
3935
3945
|
if (processResult && processResult.success !== false) {
|
|
3936
3946
|
console.log("✅ [processFinalPayment] API.processPayment succeeded:", processResult);
|
|
3937
|
-
|
|
3947
|
+
if (!runInBackground) {
|
|
3948
|
+
setTransactionStep("success");
|
|
3949
|
+
}
|
|
3938
3950
|
sdkAnalytics.trackPaymentSuccess(
|
|
3939
3951
|
activePaymentData.id,
|
|
3940
3952
|
activePaymentData.amount,
|
|
@@ -3982,8 +3994,10 @@ const useTransactionHandling = (paymentData, selectedToken, selectedNetwork, add
|
|
|
3982
3994
|
console.error("❌ [processFinalPayment] Formatted error log:", errorLog);
|
|
3983
3995
|
const friendlyError = parseUserFriendlyError(error);
|
|
3984
3996
|
console.error("❌ [processFinalPayment] User-friendly error:", friendlyError);
|
|
3985
|
-
|
|
3986
|
-
|
|
3997
|
+
if (!runInBackground) {
|
|
3998
|
+
setTransactionError(friendlyError);
|
|
3999
|
+
setTransactionStep("error");
|
|
4000
|
+
}
|
|
3987
4001
|
sdkAnalytics.trackPaymentFailed(
|
|
3988
4002
|
activePaymentData == null ? void 0 : activePaymentData.id,
|
|
3989
4003
|
activePaymentData == null ? void 0 : activePaymentData.amount,
|
|
@@ -21106,7 +21120,7 @@ const WalletSelector = ({
|
|
|
21106
21120
|
try {
|
|
21107
21121
|
setAppKitError(null);
|
|
21108
21122
|
setWalletConnectAddress(solanaAccountState.address);
|
|
21109
|
-
const { createWalletConnectAdapter } = await import("./appKitSolana-
|
|
21123
|
+
const { createWalletConnectAdapter } = await import("./appKitSolana-fo6vF0_g.js");
|
|
21110
21124
|
const adapter = createWalletConnectAdapter(solanaAccountState.address);
|
|
21111
21125
|
await solanaWallet.connectWalletConnect(adapter, solanaAccountState.address);
|
|
21112
21126
|
console.log("✅ WalletConnect synced with SDK");
|
|
@@ -21211,7 +21225,7 @@ const WalletSelector = ({
|
|
|
21211
21225
|
setAppKitLoading(true);
|
|
21212
21226
|
setAppKitError(null);
|
|
21213
21227
|
try {
|
|
21214
|
-
const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-
|
|
21228
|
+
const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-DNxsUg-8.js");
|
|
21215
21229
|
await initializeAppKitEVM(wagmiConfig);
|
|
21216
21230
|
await openAppKitModal();
|
|
21217
21231
|
} catch (error) {
|
|
@@ -21231,7 +21245,7 @@ const WalletSelector = ({
|
|
|
21231
21245
|
setAppKitError(null);
|
|
21232
21246
|
try {
|
|
21233
21247
|
console.log("📦 Loading AppKit Solana module...");
|
|
21234
|
-
const { initializeAppKitSolana } = await import("./appKitSolana-
|
|
21248
|
+
const { initializeAppKitSolana } = await import("./appKitSolana-fo6vF0_g.js");
|
|
21235
21249
|
console.log("✅ Module loaded, initializing...");
|
|
21236
21250
|
const modal = await initializeAppKitSolana(solanaWallet);
|
|
21237
21251
|
console.log("✅ AppKit Solana initialized successfully");
|
|
@@ -26880,6 +26894,7 @@ const CoinleyPaymentInternal = ({
|
|
|
26880
26894
|
const isTransferAddressGenerated = activeTab === PAYMENT_TABS.TRANSFER && selectedNetwork && selectedToken && (paymentData == null ? void 0 : paymentData.depositAddress);
|
|
26881
26895
|
const isWalletReadyForPayment = isWalletExtensionReadyView;
|
|
26882
26896
|
const isWalletBackHeaderView = activeTab === PAYMENT_TABS.WALLET && showWalletConfirm;
|
|
26897
|
+
const isWalletTokenSelectionView = activeTab === PAYMENT_TABS.WALLET && selectedNetwork && !selectedToken && !showWalletConfirm && !(showMobileWalletPicker && isMobile);
|
|
26883
26898
|
const isQrPaymentActiveView = activeTab === PAYMENT_TABS.QR && qrWalletChoiceConfirmed;
|
|
26884
26899
|
const handleTransferAddressBack = async () => {
|
|
26885
26900
|
setPaymentData((prev) => {
|
|
@@ -26900,6 +26915,12 @@ const CoinleyPaymentInternal = ({
|
|
|
26900
26915
|
setSelectedToken(null);
|
|
26901
26916
|
setPaymentData(null);
|
|
26902
26917
|
};
|
|
26918
|
+
const handleWalletTokenSelectionBack = () => {
|
|
26919
|
+
setSelectedNetwork(null);
|
|
26920
|
+
setSelectedToken(null);
|
|
26921
|
+
setPaymentData(null);
|
|
26922
|
+
setWalletNetworkSearch("");
|
|
26923
|
+
};
|
|
26903
26924
|
const handleQrBack = () => {
|
|
26904
26925
|
setPaymentData(null);
|
|
26905
26926
|
setQrCodeDataUrl("");
|
|
@@ -26920,10 +26941,10 @@ const CoinleyPaymentInternal = ({
|
|
|
26920
26941
|
isMobile && /* @__PURE__ */ jsx("div", { className: "flex justify-center pt-3 pb-1 flex-shrink-0", children: /* @__PURE__ */ jsx("div", { className: "w-10 h-1 bg-gray-300 rounded-full" }) }),
|
|
26921
26942
|
/* @__PURE__ */ jsxs("div", { className: `flex min-h-0 flex-1 flex-col px-4 ${isTightWalletView ? "pb-2 pt-3" : "pb-4 pt-4"}`, children: [
|
|
26922
26943
|
/* @__PURE__ */ jsxs("div", { className: `${isTightWalletView ? "mb-3" : "mb-5"} flex items-center justify-between`, children: [
|
|
26923
|
-
isTransferAddressGenerated || isWalletReadyForPayment || isQrPaymentActiveView || isWalletBackHeaderView ? /* @__PURE__ */ jsx(
|
|
26944
|
+
isTransferAddressGenerated || isWalletReadyForPayment || isQrPaymentActiveView || isWalletBackHeaderView || isWalletTokenSelectionView ? /* @__PURE__ */ jsx(
|
|
26924
26945
|
"button",
|
|
26925
26946
|
{
|
|
26926
|
-
onClick: isTransferAddressGenerated ? handleTransferAddressBack : isQrPaymentActiveView ? handleQrBack : handleWalletReadyBack,
|
|
26947
|
+
onClick: isTransferAddressGenerated ? handleTransferAddressBack : isQrPaymentActiveView ? handleQrBack : isWalletTokenSelectionView ? handleWalletTokenSelectionBack : handleWalletReadyBack,
|
|
26927
26948
|
className: `${isTightWalletView ? "h-8 w-8" : "h-9 w-9"} flex items-center justify-center rounded-full border border-[#E5E7EB] text-[#111827] transition-colors hover:bg-gray-50`,
|
|
26928
26949
|
"aria-label": "Go back",
|
|
26929
26950
|
children: /* @__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: "M15 19l-7-7 7-7" }) })
|
|
@@ -26981,4 +27002,4 @@ export {
|
|
|
26981
27002
|
isFeatureEnabled as i,
|
|
26982
27003
|
logo as l
|
|
26983
27004
|
};
|
|
26984
|
-
//# sourceMappingURL=CoinleyPayment-
|
|
27005
|
+
//# sourceMappingURL=CoinleyPayment-DK-cf2Vl.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-DK-cf2Vl.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-DNxsUg-8.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-DK-cf2Vl.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-fo6vF0_g.js.map
|