coinley-pay 0.37.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.
@@ -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-CIjLjC1o.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-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-CHe_HukM.js");
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-BCaK3hpo.js");
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-CHe_HukM.js");
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,6 +23345,7 @@ 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);
23349
23350
  const ccStatusPollInFlight = useRef(false);
23350
23351
  const [networkSearch, setNetworkSearch] = useState("");
@@ -23478,6 +23479,9 @@ const CoinleyPaymentInternal = ({
23478
23479
  } = paymentFlow;
23479
23480
  const activeTransferPaymentId = (paymentData == null ? void 0 : paymentData.id) || (ccResult == null ? void 0 : ccResult.id) || (ccResult == null ? void 0 : ccResult.paymentId);
23480
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
+ }, []);
23481
23485
  const merchantReceiveNetworks = (merchantNetworks == null ? void 0 : merchantNetworks.length) ? merchantNetworks : networks;
23482
23486
  const isMerchantReceiveNetwork = useCallback((network) => {
23483
23487
  var _a2;
@@ -25126,6 +25130,7 @@ const CoinleyPaymentInternal = ({
25126
25130
  setCcManualCheckStatus("failed");
25127
25131
  } else {
25128
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.");
25129
25134
  }
25130
25135
  } catch (error2) {
25131
25136
  setCcError(error2.message || "Could not check this payment yet. Please try again.");
@@ -26079,17 +26084,19 @@ const CoinleyPaymentInternal = ({
26079
26084
  }
26080
26085
  }
26081
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.");
26082
26088
  manualCheckTimeout.current = setTimeout(() => {
26083
26089
  setManualCheckStatus(null);
26084
26090
  }, 1e4);
26085
26091
  } catch (error2) {
26086
26092
  console.warn("[ManualCheck] Error:", error2.message);
26087
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.");
26088
26095
  manualCheckTimeout.current = setTimeout(() => {
26089
26096
  setManualCheckStatus(null);
26090
26097
  }, 1e4);
26091
26098
  }
26092
- }, [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]);
26093
26100
  if (!isOpen) return null;
26094
26101
  if (currentStep === PAYMENT_STEPS.PROCESSING) {
26095
26102
  return /* @__PURE__ */ jsxs("div", { id: SDK_ROOT_ID, className: `${SDK_ROOT_CLASS} fixed inset-0 z-50`, style: { fontFamily: FONT_FAMILY }, children: [
@@ -26290,8 +26297,7 @@ const CoinleyPaymentInternal = ({
26290
26297
  renderUnderpaymentWarning(
26291
26298
  "Important!",
26292
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."
26293
- ),
26294
- (manualCheckStatus === "not_found" || ccManualCheckStatus === "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." }) })
26300
+ )
26295
26301
  ] });
26296
26302
  const renderUnderpaymentRefundPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
26297
26303
  renderUnderpaymentWarning(
@@ -26958,6 +26964,23 @@ const CoinleyPaymentInternal = ({
26958
26964
  /* @__PURE__ */ jsx("p", { className: `${isTightWalletView ? "mt-1" : isCompactCheckoutView ? "mt-2" : "mt-3"} text-xs text-[#A9ABB2]`, children: "Powered by Stablezact" })
26959
26965
  ] });
26960
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
+ };
26961
26984
  const renderTabContent = () => {
26962
26985
  var _a2, _b, _c, _d;
26963
26986
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -27293,7 +27316,6 @@ const CoinleyPaymentInternal = ({
27293
27316
  "Important!",
27294
27317
  "Use this wallet address for this transfer only. Send from the selected network and include enough native token for network fees."
27295
27318
  ),
27296
- ccManualCheckStatus === "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 your transfer yet. It can take a few moments to appear on-chain, and we will keep checking automatically." }) }),
27297
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: [
27298
27320
  /* @__PURE__ */ jsx("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-green-500" }),
27299
27321
  "Payment received"
@@ -27438,7 +27460,8 @@ const CoinleyPaymentInternal = ({
27438
27460
  /* @__PURE__ */ jsx("div", { className: `min-h-0 flex-1 ${isCheckoutDropdownOpen ? "overflow-visible" : "overflow-y-auto coinley-scroll"} pb-1`, children: renderTabContent() }),
27439
27461
  renderCheckoutFooter()
27440
27462
  ] })
27441
- ] }) })
27463
+ ] }) }),
27464
+ renderTransferNoticeModal()
27442
27465
  ] });
27443
27466
  };
27444
27467
  const CoinleyPayment = (props) => {
@@ -27475,4 +27498,4 @@ export {
27475
27498
  isFeatureEnabled as i,
27476
27499
  logo as l
27477
27500
  };
27478
- //# sourceMappingURL=CoinleyPayment-CckYt7S9.js.map
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-CckYt7S9.js";
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-BCaK3hpo.js.map
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-CckYt7S9.js";
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-CHe_HukM.js.map
245
+ //# sourceMappingURL=appKitSolana-UWbFPNMg.js.map