coinley-pay 0.60.0 → 0.61.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.
@@ -6,7 +6,7 @@ import { useState, useRef, useEffect, useCallback, useMemo } from "react";
6
6
  import ReactDOM, { createPortal } from "react-dom";
7
7
  import { useConnect, useAccount, useSwitchChain, useSendTransaction, useWaitForTransactionReceipt, WagmiProvider, useDisconnect } from "wagmi";
8
8
  import { QueryClientProvider, QueryClient } from "@tanstack/react-query";
9
- 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-bVSNOcZr.js";
9
+ 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-Dssajde4.js";
10
10
  import { createConfig, fallback, http, getAccount as getAccount$1, getWalletClient, simulateContract, writeContract, readContract, waitForTransactionReceipt, estimateFeesPerGas as estimateFeesPerGas$1 } from "@wagmi/core";
11
11
  import { injected, metaMask, coinbaseWallet, walletConnect } from "@wagmi/connectors";
12
12
  import { defineChain as defineChain$1, erc20Abi, http as http$1, createPublicClient, fallback as fallback$1 } from "viem";
@@ -21126,7 +21126,7 @@ const WalletSelector = ({
21126
21126
  try {
21127
21127
  setAppKitError(null);
21128
21128
  setWalletConnectAddress(solanaAccountState.address);
21129
- const { createWalletConnectAdapter } = await import("./appKitSolana-BeXOnse3.js");
21129
+ const { createWalletConnectAdapter } = await import("./appKitSolana-C_InTqyc.js");
21130
21130
  const adapter = createWalletConnectAdapter(solanaAccountState.address);
21131
21131
  await solanaWallet.connectWalletConnect(adapter, solanaAccountState.address);
21132
21132
  console.log("✅ WalletConnect synced with SDK");
@@ -21231,7 +21231,7 @@ const WalletSelector = ({
21231
21231
  setAppKitLoading(true);
21232
21232
  setAppKitError(null);
21233
21233
  try {
21234
- const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-rZ-uPbNm.js");
21234
+ const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-BzMDYdux.js");
21235
21235
  await initializeAppKitEVM(wagmiConfig);
21236
21236
  await openAppKitModal();
21237
21237
  } catch (error) {
@@ -21251,7 +21251,7 @@ const WalletSelector = ({
21251
21251
  setAppKitError(null);
21252
21252
  try {
21253
21253
  console.log("📦 Loading AppKit Solana module...");
21254
- const { initializeAppKitSolana } = await import("./appKitSolana-BeXOnse3.js");
21254
+ const { initializeAppKitSolana } = await import("./appKitSolana-C_InTqyc.js");
21255
21255
  console.log("✅ Module loaded, initializing...");
21256
21256
  const modal = await initializeAppKitSolana(solanaWallet);
21257
21257
  console.log("✅ AppKit Solana initialized successfully");
@@ -23335,6 +23335,7 @@ const CoinleyPaymentInternal = ({
23335
23335
  const [depositQrCode, setDepositQrCode] = useState("");
23336
23336
  const [preferredWallet, setPreferredWallet] = useState("metamask");
23337
23337
  const [qrWalletChoiceConfirmed, setQrWalletChoiceConfirmed] = useState(false);
23338
+ const [qrSelectedWalletId, setQrSelectedWalletId] = useState(null);
23338
23339
  const [selectedWalletOptionId, setSelectedWalletOptionId] = useState("");
23339
23340
  const [isMobile, setIsMobile] = useState(false);
23340
23341
  const [mobilePaymentStarted, setMobilePaymentStarted] = useState(() => {
@@ -25221,8 +25222,10 @@ const CoinleyPaymentInternal = ({
25221
25222
  resetWalletTokens();
25222
25223
  setPaymentData(null);
25223
25224
  setError("");
25225
+ setCcError(null);
25224
25226
  setQrCodeDataUrl("");
25225
25227
  setQrWalletChoiceConfirmed(false);
25228
+ setQrSelectedWalletId(null);
25226
25229
  setCcResult(null);
25227
25230
  setCcQrCode("");
25228
25231
  setCcPhase("idle");
@@ -25248,8 +25251,10 @@ const CoinleyPaymentInternal = ({
25248
25251
  (_a2 = transactionHandling.resetTransaction) == null ? void 0 : _a2.call(transactionHandling);
25249
25252
  setPaymentData(null);
25250
25253
  setError("");
25254
+ setCcError(null);
25251
25255
  setQrCodeDataUrl("");
25252
25256
  setQrWalletChoiceConfirmed(false);
25257
+ setQrSelectedWalletId(null);
25253
25258
  setSelectedToken(token);
25254
25259
  setCcOriginToken((selectedNetwork == null ? void 0 : selectedNetwork.isCrossChainSource) ? token : null);
25255
25260
  createNewAttempt("token-selected", {
@@ -26380,6 +26385,12 @@ const CoinleyPaymentInternal = ({
26380
26385
  setRefundRequestMessage("");
26381
26386
  setManualCheckStatus(null);
26382
26387
  clearUnderpaymentRecovery(activeTransferPaymentId);
26388
+ holdRecoveryLoading("refund", ccResult ? getCrossChainRefundPendingStatus({
26389
+ refundStatus: "pending",
26390
+ refundRecipient: trimmedAddress,
26391
+ underpayment: underpaymentInfo,
26392
+ relay: { originChainId: ccResult.originChainId || ccOriginChainId }
26393
+ }) : getRefundPendingStatus());
26383
26394
  const refundPayload = {
26384
26395
  paymentId: activeTransferPaymentId,
26385
26396
  refundAddress: trimmedAddress,
@@ -26822,16 +26833,16 @@ const CoinleyPaymentInternal = ({
26822
26833
  const renderMethodTabs = () => /* @__PURE__ */ jsxs("div", { className: isTightWalletView ? "mb-2" : isCompactCheckoutView ? "mb-3" : "mb-4", children: [
26823
26834
  /* @__PURE__ */ jsx("p", { className: `text-xs text-[#9EA0A8] ${isTightWalletView ? "mb-1" : "mb-2"}`, children: "Payment methods" }),
26824
26835
  /* @__PURE__ */ jsx("div", { className: "flex overflow-hidden rounded-xl bg-[#F6F6F7] p-1", children: [
26825
- { tab: PAYMENT_TABS.TRANSFER, label: "Transfer to address" },
26826
- { tab: PAYMENT_TABS.QR, label: "QR Code" },
26827
- { tab: PAYMENT_TABS.WALLET, label: "Wallet Extension" }
26836
+ { tab: PAYMENT_TABS.TRANSFER, label: "Transfer to address", mobileLabel: "Transfer" },
26837
+ { tab: PAYMENT_TABS.QR, label: "QR Code", mobileLabel: "QR Code" },
26838
+ { tab: PAYMENT_TABS.WALLET, label: "Wallet Extension", mobileLabel: "Wallet" }
26828
26839
  ].map((method) => /* @__PURE__ */ jsx(
26829
26840
  "button",
26830
26841
  {
26831
26842
  type: "button",
26832
26843
  onClick: () => isMobile ? handleMobileTabSelect(method.tab) : setActiveTab(method.tab),
26833
- className: `min-w-0 ${isTightWalletView ? "h-7 px-2 text-[13px]" : "h-9 px-2.5 text-sm"} rounded-lg transition-colors whitespace-nowrap ${method.tab === PAYMENT_TABS.TRANSFER ? "flex-[1.35]" : "flex-1"} ${activeTab === method.tab ? "bg-white text-[#5B2EEA] shadow-[0_1px_3px_rgba(31,36,48,0.08)]" : "text-[#535865] hover:text-[#1F2430]"}`,
26834
- children: method.label
26844
+ className: `min-w-0 truncate ${isTightWalletView ? "h-7 px-2 text-[13px]" : "h-9 px-2.5 text-sm"} rounded-lg transition-colors whitespace-nowrap ${method.tab === PAYMENT_TABS.TRANSFER ? "flex-[1.35]" : "flex-1"} ${activeTab === method.tab ? "bg-white text-[#5B2EEA] shadow-[0_1px_3px_rgba(31,36,48,0.08)]" : "text-[#535865] hover:text-[#1F2430]"}`,
26845
+ children: isMobile ? method.mobileLabel : method.label
26835
26846
  },
26836
26847
  method.tab
26837
26848
  )) })
@@ -26970,7 +26981,7 @@ const CoinleyPaymentInternal = ({
26970
26981
  const knownChain = ALCHEMY_EVM_CHAINS.find((chain) => Number(chain.id) === chainId);
26971
26982
  return {
26972
26983
  id: `cross-chain-${chainId}`,
26973
- name: (knownChain == null ? void 0 : knownChain.displayName) || ccChainName(chainId),
26984
+ name: (knownChain == null ? void 0 : knownChain.displayName) || source.name || ccChainName(chainId),
26974
26985
  shortName: (knownChain == null ? void 0 : knownChain.shortName) || `chain-${chainId}`,
26975
26986
  chainId,
26976
26987
  chainType: "evm",
@@ -27112,7 +27123,8 @@ const CoinleyPaymentInternal = ({
27112
27123
  const token = availableTokens.find((item) => item.id === tokenId);
27113
27124
  if (token) handleTokenSelect(token);
27114
27125
  }
27115
- })
27126
+ }),
27127
+ ccError && /* @__PURE__ */ jsx("div", { className: "mt-3 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs font-medium text-red-600", children: ccError })
27116
27128
  ] });
27117
27129
  const renderWalletExtensionSetupPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
27118
27130
  !selectedNetwork && renderWalletNetworkPickerPanel(),
@@ -27127,6 +27139,7 @@ const CoinleyPaymentInternal = ({
27127
27139
  ];
27128
27140
  const handleQrWalletSelect = async (walletId) => {
27129
27141
  setPreferredWallet(walletId);
27142
+ setQrSelectedWalletId(walletId);
27130
27143
  setError(null);
27131
27144
  setQrCodeDataUrl("");
27132
27145
  setQrWalletChoiceConfirmed(false);
@@ -27149,6 +27162,7 @@ const CoinleyPaymentInternal = ({
27149
27162
  await createPaymentAndGenerateQR(network, token, walletId);
27150
27163
  } catch (err) {
27151
27164
  setQrWalletChoiceConfirmed(false);
27165
+ setQrSelectedWalletId(null);
27152
27166
  setError((err == null ? void 0 : err.message) || "Unable to generate QR code. Please try again.");
27153
27167
  }
27154
27168
  };
@@ -27360,9 +27374,9 @@ const CoinleyPaymentInternal = ({
27360
27374
  type: "button",
27361
27375
  onClick: () => handleQrWalletSelect(wallet.id),
27362
27376
  disabled: !selectedNetwork || !selectedToken || qrLoading || isConverting,
27363
- className: `relative flex h-[76px] min-w-0 flex-col items-start justify-between rounded-lg border bg-[#FAFAFB] px-2.5 py-3 text-left transition-colors ${preferredWallet === wallet.id ? "border-[#7042D2] bg-[#FBF8FF]" : "border-[#EEF0F4] hover:border-[#C9B8F6]"} disabled:cursor-not-allowed disabled:opacity-60`,
27377
+ className: `relative flex h-[76px] min-w-0 flex-col items-start justify-between rounded-lg border bg-[#FAFAFB] px-2.5 py-3 text-left transition-colors ${qrSelectedWalletId === wallet.id ? "border-[#7042D2] bg-[#FBF8FF]" : "border-[#EEF0F4] hover:border-[#C9B8F6]"} disabled:cursor-not-allowed disabled:opacity-60`,
27364
27378
  children: [
27365
- preferredWallet === wallet.id && qrWalletChoiceConfirmed && /* @__PURE__ */ jsx("span", { className: "absolute right-[-5px] top-[-6px] flex h-4 w-4 items-center justify-center rounded-full border border-[#7042D2] bg-white text-[#7042D2]", children: /* @__PURE__ */ jsx("svg", { className: "h-2.5 w-2.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M5 13l4 4L19 7" }) }) }),
27379
+ qrSelectedWalletId === wallet.id && qrWalletChoiceConfirmed && /* @__PURE__ */ jsx("span", { className: "absolute right-[-5px] top-[-6px] flex h-4 w-4 items-center justify-center rounded-full border border-[#7042D2] bg-white text-[#7042D2]", children: /* @__PURE__ */ jsx("svg", { className: "h-2.5 w-2.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M5 13l4 4L19 7" }) }) }),
27366
27380
  /* @__PURE__ */ jsx(
27367
27381
  "img",
27368
27382
  {
@@ -27383,7 +27397,7 @@ const CoinleyPaymentInternal = ({
27383
27397
  /* @__PURE__ */ jsx("img", { src: stablezactLoading, alt: "", className: "h-5 w-6 object-contain" }),
27384
27398
  "Generating QR code..."
27385
27399
  ] }),
27386
- /* @__PURE__ */ jsx("p", { className: "text-xs leading-5 text-[#9EA0A8]", children: "Simply select a wallet app to generate the QR code then input the amount, and transfer your funds" })
27400
+ qrWalletChoiceConfirmed ? renderQrPaymentPanel() : !qrLoading && /* @__PURE__ */ jsx("p", { className: "text-xs leading-5 text-[#9EA0A8]", children: "Simply select a wallet app to generate the QR code then input the amount, and transfer your funds" })
27387
27401
  ] });
27388
27402
  const renderQrPaymentPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
27389
27403
  /* @__PURE__ */ jsxs("div", { className: "mb-4 flex flex-col gap-3 min-[380px]:flex-row min-[380px]:items-start", children: [
@@ -27651,6 +27665,14 @@ const CoinleyPaymentInternal = ({
27651
27665
  disabled: loading || isConverting || walletOptionsForSelectedNetwork.length === 0 || isSwapOrBridgeFlow && (relayBridge.bridgeStatus === "quoting" || (selectedToken == null ? void 0 : selectedToken.routeStatus) === "unsupported")
27652
27666
  });
27653
27667
  }
27668
+ if (activeTab === PAYMENT_TABS.QR && !qrWalletChoiceConfirmed) {
27669
+ return renderFooterPrimaryButton({
27670
+ label: qrLoading ? "Generating QR code..." : "Continue",
27671
+ onClick: () => {
27672
+ },
27673
+ disabled: true
27674
+ });
27675
+ }
27654
27676
  return null;
27655
27677
  };
27656
27678
  const renderCheckoutFooter = () => {
@@ -27941,7 +27963,7 @@ const CoinleyPaymentInternal = ({
27941
27963
  ) }),
27942
27964
  isSwapOrBridgeFlow && (selectedToken == null ? void 0 : selectedToken.routeStatus) === "unsupported" && /* @__PURE__ */ jsx("div", { className: "mb-2 rounded-lg border border-red-200 bg-red-50 p-2 text-xs text-red-700", children: UNSUPPORTED_ROUTE_MESSAGE })
27943
27965
  ] }),
27944
- activeTab === PAYMENT_TABS.QR && /* @__PURE__ */ jsx(Fragment, { children: qrWalletChoiceConfirmed ? renderQrPaymentPanel() : renderQrWalletChoicePanel() }),
27966
+ activeTab === PAYMENT_TABS.QR && /* @__PURE__ */ jsx(Fragment, { children: renderQrWalletChoicePanel() }),
27945
27967
  activeTab === PAYMENT_TABS.TRANSFER && /* @__PURE__ */ jsxs(Fragment, { children: [
27946
27968
  isCrossChainTransferSetupView && /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
27947
27969
  renderCheckoutSelect({
@@ -27949,8 +27971,8 @@ const CoinleyPaymentInternal = ({
27949
27971
  label: "Select a Network",
27950
27972
  value: ccOriginChainId,
27951
27973
  placeholder: "Select a network",
27952
- options: ccSources.map((s) => ({ id: String(s.chainId), chainId: s.chainId })),
27953
- getLabel: (o) => ccChainName(o.chainId),
27974
+ options: ccSources.map((s) => ({ id: String(s.chainId), chainId: s.chainId, name: s.name })),
27975
+ getLabel: (o) => o.name || ccChainName(o.chainId),
27954
27976
  getIcon: (o) => ccChainIcon(o.chainId),
27955
27977
  compact: true,
27956
27978
  elevated: true,
@@ -27958,6 +27980,7 @@ const CoinleyPaymentInternal = ({
27958
27980
  onChange: (chainId) => {
27959
27981
  setCcOriginChainId(chainId);
27960
27982
  setCcOriginToken(null);
27983
+ setCcError(null);
27961
27984
  }
27962
27985
  }),
27963
27986
  renderCheckoutSelect({
@@ -28132,6 +28155,7 @@ const CoinleyPaymentInternal = ({
28132
28155
  setPaymentData(null);
28133
28156
  setQrCodeDataUrl("");
28134
28157
  setQrWalletChoiceConfirmed(false);
28158
+ setQrSelectedWalletId(null);
28135
28159
  };
28136
28160
  const isCheckoutDropdownOpen = [
28137
28161
  "transfer-network",
@@ -28214,4 +28238,4 @@ export {
28214
28238
  chainTransports as c,
28215
28239
  isFeatureEnabled as i
28216
28240
  };
28217
- //# sourceMappingURL=CoinleyPayment-BTrq3zIS.js.map
28241
+ //# sourceMappingURL=CoinleyPayment-BofSrJBx.js.map
@@ -1,4 +1,4 @@
1
- import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-BTrq3zIS.js";
1
+ import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-BofSrJBx.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-rZ-uPbNm.js.map
116
+ //# sourceMappingURL=appKitEVM-BzMDYdux.js.map
@@ -1,4 +1,4 @@
1
- import { F as FEATURES, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-BTrq3zIS.js";
1
+ import { F as FEATURES, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-BofSrJBx.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-BeXOnse3.js.map
246
+ //# sourceMappingURL=appKitSolana-C_InTqyc.js.map