coinley-pay 0.49.0 → 0.51.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.
@@ -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-BKwDoo1D.js";
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-D5OEATPc.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";
@@ -21122,7 +21122,7 @@ const WalletSelector = ({
21122
21122
  try {
21123
21123
  setAppKitError(null);
21124
21124
  setWalletConnectAddress(solanaAccountState.address);
21125
- const { createWalletConnectAdapter } = await import("./appKitSolana-ClunNFLF.js");
21125
+ const { createWalletConnectAdapter } = await import("./appKitSolana-Bc3C3YDl.js");
21126
21126
  const adapter = createWalletConnectAdapter(solanaAccountState.address);
21127
21127
  await solanaWallet.connectWalletConnect(adapter, solanaAccountState.address);
21128
21128
  console.log("✅ WalletConnect synced with SDK");
@@ -21227,7 +21227,7 @@ const WalletSelector = ({
21227
21227
  setAppKitLoading(true);
21228
21228
  setAppKitError(null);
21229
21229
  try {
21230
- const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-Bm9fbB-H.js");
21230
+ const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-Bzcdqksa.js");
21231
21231
  await initializeAppKitEVM(wagmiConfig);
21232
21232
  await openAppKitModal();
21233
21233
  } catch (error) {
@@ -21247,7 +21247,7 @@ const WalletSelector = ({
21247
21247
  setAppKitError(null);
21248
21248
  try {
21249
21249
  console.log("📦 Loading AppKit Solana module...");
21250
- const { initializeAppKitSolana } = await import("./appKitSolana-ClunNFLF.js");
21250
+ const { initializeAppKitSolana } = await import("./appKitSolana-Bc3C3YDl.js");
21251
21251
  console.log("✅ Module loaded, initializing...");
21252
21252
  const modal = await initializeAppKitSolana(solanaWallet);
21253
21253
  console.log("✅ AppKit Solana initialized successfully");
@@ -23320,6 +23320,7 @@ const CoinleyPaymentInternal = ({
23320
23320
  const [ccManualCheckStatus, setCcManualCheckStatus] = useState("idle");
23321
23321
  const ccSucceeded = useRef(false);
23322
23322
  const ccStatusPollInFlight = useRef(false);
23323
+ const ccSourcesRetryTimer = useRef(null);
23323
23324
  const [networkSearch, setNetworkSearch] = useState("");
23324
23325
  const [walletNetworkSearch, setWalletNetworkSearch] = useState("");
23325
23326
  const [openCheckoutDropdown, setOpenCheckoutDropdown] = useState(null);
@@ -25178,15 +25179,40 @@ const CoinleyPaymentInternal = ({
25178
25179
  clarityAnalytics.trackTokenSelected(token == null ? void 0 : token.symbol, selectedNetwork == null ? void 0 : selectedNetwork.name, config == null ? void 0 : config.merchantName);
25179
25180
  };
25180
25181
  useEffect(() => {
25181
- if (activeTab !== PAYMENT_TABS.TRANSFER || ccSources.length) return;
25182
+ var _a2;
25183
+ if (ccSources.length || !((_a2 = paymentFlow.api) == null ? void 0 : _a2.getCrossChainSources)) return;
25182
25184
  let cancelled = false;
25183
- paymentFlow.api.getCrossChainSources().then((s) => {
25184
- if (!cancelled) setCcSources(Array.isArray(s) ? s : []);
25185
- }).catch((e) => {
25186
- if (!cancelled) setCcError(e.message || "Failed to load chains");
25187
- });
25185
+ const clearRetry = () => {
25186
+ if (ccSourcesRetryTimer.current) {
25187
+ clearTimeout(ccSourcesRetryTimer.current);
25188
+ ccSourcesRetryTimer.current = null;
25189
+ }
25190
+ };
25191
+ const fetchSources = async (allowRetry = false) => {
25192
+ try {
25193
+ const s = await paymentFlow.api.getCrossChainSources();
25194
+ if (cancelled) return;
25195
+ const sources = Array.isArray(s) ? s : [];
25196
+ setCcSources(sources);
25197
+ setCcError(null);
25198
+ if (sources.length === 0 && allowRetry) {
25199
+ clearRetry();
25200
+ ccSourcesRetryTimer.current = setTimeout(() => fetchSources(false), 1200);
25201
+ }
25202
+ } catch (e) {
25203
+ if (cancelled) return;
25204
+ console.warn("[CrossChainSources] Failed to load source networks:", (e == null ? void 0 : e.message) || e);
25205
+ setCcError(null);
25206
+ if (allowRetry) {
25207
+ clearRetry();
25208
+ ccSourcesRetryTimer.current = setTimeout(() => fetchSources(false), 1200);
25209
+ }
25210
+ }
25211
+ };
25212
+ fetchSources(activeTab === PAYMENT_TABS.TRANSFER);
25188
25213
  return () => {
25189
25214
  cancelled = true;
25215
+ clearRetry();
25190
25216
  };
25191
25217
  }, [activeTab, ccSources.length, paymentFlow.api]);
25192
25218
  const ccOriginTokens = useMemo(() => {
@@ -28042,4 +28068,4 @@ export {
28042
28068
  chainTransports as c,
28043
28069
  isFeatureEnabled as i
28044
28070
  };
28045
- //# sourceMappingURL=CoinleyPayment-C7JQcQGP.js.map
28071
+ //# sourceMappingURL=CoinleyPayment-BgreroDe.js.map
@@ -1,4 +1,4 @@
1
- import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-C7JQcQGP.js";
1
+ import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-BgreroDe.js";
2
2
  const logo = "https://coinley.io/logo.png";
3
3
  let appKitInstance = null;
4
4
  let isInitializing = false;
@@ -113,4 +113,4 @@ export {
113
113
  initializeAppKitEVM,
114
114
  openAppKitModal
115
115
  };
116
- //# sourceMappingURL=appKitEVM-Bm9fbB-H.js.map
116
+ //# sourceMappingURL=appKitEVM-Bzcdqksa.js.map
@@ -1,4 +1,4 @@
1
- import { F as FEATURES, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-C7JQcQGP.js";
1
+ import { F as FEATURES, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-BgreroDe.js";
2
2
  const logo = "https://coinley.io/logo.png";
3
3
  let appKitInstance = null;
4
4
  let isInitializing = false;
@@ -243,4 +243,4 @@ export {
243
243
  disconnectWalletConnect,
244
244
  initializeAppKitSolana
245
245
  };
246
- //# sourceMappingURL=appKitSolana-ClunNFLF.js.map
246
+ //# sourceMappingURL=appKitSolana-Bc3C3YDl.js.map