coinley-pay 0.33.0 → 0.35.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-y1EdvKhM.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-QlVbEn4w.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";
@@ -2470,6 +2470,23 @@ class SimplePaymentAPI {
2470
2470
  timeout: 2e4
2471
2471
  });
2472
2472
  }
2473
+ // ==================== CROSS-CHAIN (no-wallet Relay deposit address) ====================
2474
+ // Distinct from the BRIDGE ROUTING API above: this is the no-wallet flow where the
2475
+ // customer sends to a Relay-generated source-chain address that bridges to the
2476
+ // merchant's settlement chain. Backend resolves the destination.
2477
+ async getCrossChainSources() {
2478
+ const result = await this.request("/api/payments/cross-chain/sources");
2479
+ return (result == null ? void 0 : result.sources) || [];
2480
+ }
2481
+ async createCrossChainPayment(data) {
2482
+ return await this.request("/api/payments/cross-chain/create", {
2483
+ method: "POST",
2484
+ body: JSON.stringify(data)
2485
+ });
2486
+ }
2487
+ async getCrossChainStatus(paymentId) {
2488
+ return await this.request(`/api/payments/cross-chain/status/${paymentId}`);
2489
+ }
2473
2490
  /**
2474
2491
  * Check if a network supports deposit address payments
2475
2492
  * @param {number|string} chainId - Chain ID
@@ -21133,7 +21150,7 @@ const WalletSelector = ({
21133
21150
  try {
21134
21151
  setAppKitError(null);
21135
21152
  setWalletConnectAddress(solanaAccountState.address);
21136
- const { createWalletConnectAdapter } = await import("./appKitSolana-XFYOjQeJ.js");
21153
+ const { createWalletConnectAdapter } = await import("./appKitSolana-C1LLrCaN.js");
21137
21154
  const adapter = createWalletConnectAdapter(solanaAccountState.address);
21138
21155
  await solanaWallet.connectWalletConnect(adapter, solanaAccountState.address);
21139
21156
  console.log("✅ WalletConnect synced with SDK");
@@ -21238,7 +21255,7 @@ const WalletSelector = ({
21238
21255
  setAppKitLoading(true);
21239
21256
  setAppKitError(null);
21240
21257
  try {
21241
- const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-BzFOTXTT.js");
21258
+ const { initializeAppKitEVM, openAppKitModal } = await import("./appKitEVM-eozvDNUh.js");
21242
21259
  await initializeAppKitEVM(wagmiConfig);
21243
21260
  await openAppKitModal();
21244
21261
  } catch (error) {
@@ -21258,7 +21275,7 @@ const WalletSelector = ({
21258
21275
  setAppKitError(null);
21259
21276
  try {
21260
21277
  console.log("📦 Loading AppKit Solana module...");
21261
- const { initializeAppKitSolana } = await import("./appKitSolana-XFYOjQeJ.js");
21278
+ const { initializeAppKitSolana } = await import("./appKitSolana-C1LLrCaN.js");
21262
21279
  console.log("✅ Module loaded, initializing...");
21263
21280
  const modal = await initializeAppKitSolana(solanaWallet);
21264
21281
  console.log("✅ AppKit Solana initialized successfully");
@@ -22840,7 +22857,7 @@ const normalizeWalletType = (walletType) => {
22840
22857
  };
22841
22858
  const getSupportedMobileWallets = () => Object.values(MOBILE_WALLET_CONFIG);
22842
22859
  const appendHostedPaymentContext = (params, paymentData, selectedToken = null, selectedNetwork = null) => {
22843
- var _a, _b, _c, _d;
22860
+ var _a, _b, _c, _d, _e;
22844
22861
  const paymentToken = selectedToken || (paymentData == null ? void 0 : paymentData.Token) || null;
22845
22862
  const paymentNetwork = selectedNetwork || (paymentData == null ? void 0 : paymentData.Network) || null;
22846
22863
  const paymentAmount = (paymentData == null ? void 0 : paymentData.totalAmount) || (paymentData == null ? void 0 : paymentData.amount) || (paymentData == null ? void 0 : paymentData.productAmount) || null;
@@ -22851,6 +22868,9 @@ const appendHostedPaymentContext = (params, paymentData, selectedToken = null, s
22851
22868
  const tokenSymbol = (paymentToken == null ? void 0 : paymentToken.symbol) || (paymentData == null ? void 0 : paymentData.currency) || (paymentData == null ? void 0 : paymentData.token) || ((_d = paymentData == null ? void 0 : paymentData.metadata) == null ? void 0 : _d.selectedToken) || null;
22852
22869
  const tokenContract = (paymentToken == null ? void 0 : paymentToken.contractAddress) || (paymentData == null ? void 0 : paymentData.tokenContract) || (paymentData == null ? void 0 : paymentData.tokenAddress) || null;
22853
22870
  const tokenDecimals = (paymentToken == null ? void 0 : paymentToken.decimals) || (paymentData == null ? void 0 : paymentData.tokenDecimals) || null;
22871
+ const depositAddress = (paymentData == null ? void 0 : paymentData.depositAddress) || (paymentData == null ? void 0 : paymentData.deposit_address) || ((_e = paymentData == null ? void 0 : paymentData.paymentDetails) == null ? void 0 : _e.depositAddress) || null;
22872
+ const isDepositPayment = (paymentData == null ? void 0 : paymentData.isDepositPayment) || (paymentData == null ? void 0 : paymentData.depositMethod) === "deposit_address" || (paymentData == null ? void 0 : paymentData.paymentMethod) === "deposit_address" || Boolean(depositAddress);
22873
+ const bridgeContext = (paymentData == null ? void 0 : paymentData.mobileBridgeContext) || null;
22854
22874
  if (networkName) {
22855
22875
  params.set("network", networkName);
22856
22876
  }
@@ -22875,6 +22895,41 @@ const appendHostedPaymentContext = (params, paymentData, selectedToken = null, s
22875
22895
  if (amountInWei !== null && amountInWei !== void 0 && amountInWei !== "") {
22876
22896
  params.set("amountInWei", String(amountInWei));
22877
22897
  }
22898
+ if (isDepositPayment) {
22899
+ params.set("isDepositPayment", "true");
22900
+ params.set("paymentMethod", "deposit_address");
22901
+ }
22902
+ if (depositAddress) {
22903
+ params.set("depositAddress", depositAddress);
22904
+ }
22905
+ if (bridgeContext == null ? void 0 : bridgeContext.isBridgePayment) {
22906
+ params.set("isBridgePayment", "true");
22907
+ params.set("bridgeProvider", bridgeContext.provider || "lifi");
22908
+ if (bridgeContext.originChainId !== null && bridgeContext.originChainId !== void 0) {
22909
+ params.set("bridgeOriginChainId", String(bridgeContext.originChainId));
22910
+ }
22911
+ if (bridgeContext.originNetwork) {
22912
+ params.set("bridgeOriginNetwork", bridgeContext.originNetwork);
22913
+ }
22914
+ if (bridgeContext.originToken) {
22915
+ params.set("bridgeOriginToken", bridgeContext.originToken);
22916
+ }
22917
+ if (bridgeContext.originTokenSymbol) {
22918
+ params.set("bridgeOriginTokenSymbol", bridgeContext.originTokenSymbol);
22919
+ }
22920
+ if (bridgeContext.originTokenDecimals !== null && bridgeContext.originTokenDecimals !== void 0) {
22921
+ params.set("bridgeOriginTokenDecimals", String(bridgeContext.originTokenDecimals));
22922
+ }
22923
+ if (bridgeContext.destinationNetwork) {
22924
+ params.set("bridgeDestinationNetwork", bridgeContext.destinationNetwork);
22925
+ }
22926
+ if (bridgeContext.destinationTokenSymbol) {
22927
+ params.set("bridgeDestinationTokenSymbol", bridgeContext.destinationTokenSymbol);
22928
+ }
22929
+ if (bridgeContext.quoteId) {
22930
+ params.set("bridgeQuoteId", bridgeContext.quoteId);
22931
+ }
22932
+ }
22878
22933
  };
22879
22934
  const getHostedPaymentUrl = (paymentData, preferredWallet = "metamask", selectedToken = null, selectedNetwork = null, apiUrl = null) => {
22880
22935
  const paymentId = (paymentData == null ? void 0 : paymentData.id) || (paymentData == null ? void 0 : paymentData.splitterPaymentId);
@@ -23116,6 +23171,28 @@ const PAYMENT_TABS = {
23116
23171
  QR: "qr",
23117
23172
  TRANSFER: "transfer"
23118
23173
  };
23174
+ const CC_CHAIN_NAMES = {
23175
+ 1: "Ethereum",
23176
+ 10: "Optimism",
23177
+ 56: "BNB Chain",
23178
+ 137: "Polygon",
23179
+ 8453: "Base",
23180
+ 42161: "Arbitrum",
23181
+ 43114: "Avalanche",
23182
+ 59144: "Linea",
23183
+ 534352: "Scroll",
23184
+ 130: "Unichain",
23185
+ 143: "Monad",
23186
+ 324: "zkSync Era",
23187
+ 100: "Gnosis",
23188
+ 25: "Cronos",
23189
+ 146: "Sonic",
23190
+ 480: "World Chain",
23191
+ 1135: "Lisk",
23192
+ 81457: "Blast"
23193
+ };
23194
+ const ccChainName = (id) => CC_CHAIN_NAMES[Number(id)] || `Chain ${id}`;
23195
+ const ccChainIcon = (id) => `https://assets.relay.link/icons/${Number(id)}/light.png`;
23119
23196
  const CoinleyPaymentInternal = ({
23120
23197
  publicKey: publicKey2,
23121
23198
  apiKey,
@@ -23259,6 +23336,16 @@ const CoinleyPaymentInternal = ({
23259
23336
  setSelectedToken(null);
23260
23337
  };
23261
23338
  const [activeTab, setActiveTab] = useState(PAYMENT_TABS.TRANSFER);
23339
+ const [ccSources, setCcSources] = useState([]);
23340
+ const [ccOriginChainId, setCcOriginChainId] = useState("");
23341
+ const [ccOriginToken, setCcOriginToken] = useState(null);
23342
+ const [ccResult, setCcResult] = useState(null);
23343
+ const [ccQrCode, setCcQrCode] = useState("");
23344
+ const [ccPhase, setCcPhase] = useState("idle");
23345
+ const [ccError, setCcError] = useState(null);
23346
+ const [ccGenerating, setCcGenerating] = useState(false);
23347
+ const [ccManualCheckStatus, setCcManualCheckStatus] = useState("idle");
23348
+ const ccSucceeded = useRef(false);
23262
23349
  const [networkSearch, setNetworkSearch] = useState("");
23263
23350
  const [walletNetworkSearch, setWalletNetworkSearch] = useState("");
23264
23351
  const [openCheckoutDropdown, setOpenCheckoutDropdown] = useState(null);
@@ -23294,6 +23381,8 @@ const CoinleyPaymentInternal = ({
23294
23381
  const STANDARD_PAYMENT_TIMEOUT_MS = 15 * 60 * 1e3;
23295
23382
  const BRIDGE_PAYMENT_TIMEOUT_MS = 15 * 60 * 1e3;
23296
23383
  const BRIDGE_DEPOSIT_EXPIRY_SECONDS = 15 * 60;
23384
+ const MOBILE_BRIDGE_PLACEHOLDER_ADDRESS = "0x0000000000000000000000000000000000000001";
23385
+ const DEPOSIT_SUPPORTED_CHAINS = [8453, 56, 42161, 137, 10, 43114, 143, 59144, 534352, 130];
23297
23386
  const [timeRemaining, setTimeRemaining] = useState(STANDARD_PAYMENT_TIMEOUT_MS);
23298
23387
  const modalOpenedAtRef = useRef(Date.now());
23299
23388
  const [mobileStep, setMobileStep] = useState("content");
@@ -23566,6 +23655,8 @@ const CoinleyPaymentInternal = ({
23566
23655
  );
23567
23656
  const isSwapOrBridgeFlow = requiresDepositRouting(selectedNetwork, selectedToken) || sourceNeedsMerchantBridge;
23568
23657
  const paymentTimeoutMs = isSwapOrBridgeFlow ? BRIDGE_PAYMENT_TIMEOUT_MS : STANDARD_PAYMENT_TIMEOUT_MS;
23658
+ const mobileBridgeQuoteAddress = isMobile && showMobileWalletPicker && selectedMobileWallet ? MOBILE_BRIDGE_PLACEHOLDER_ADDRESS : null;
23659
+ const effectiveQuoteAddress = address || mobileBridgeQuoteAddress;
23569
23660
  useEffect(() => {
23570
23661
  if (hasCommittedTransaction) return;
23571
23662
  modalOpenedAtRef.current = Date.now();
@@ -23573,7 +23664,7 @@ const CoinleyPaymentInternal = ({
23573
23664
  }, [hasCommittedTransaction, paymentTimeoutMs, selectedNetwork == null ? void 0 : selectedNetwork.chainId, selectedToken == null ? void 0 : selectedToken.id]);
23574
23665
  const activeAttemptRef = useRef(null);
23575
23666
  const [retryEpoch, setRetryEpoch] = useState(0);
23576
- const buildSelectionSnapshot = (networkArg = selectedNetwork, tokenArg = selectedToken, addressArg = address, solanaPubkeyArg = solanaWallet == null ? void 0 : solanaWallet.publicKey) => ({
23667
+ const buildSelectionSnapshot = (networkArg = selectedNetwork, tokenArg = selectedToken, addressArg = effectiveQuoteAddress, solanaPubkeyArg = solanaWallet == null ? void 0 : solanaWallet.publicKey) => ({
23577
23668
  networkId: (networkArg == null ? void 0 : networkArg.id) ?? null,
23578
23669
  chainId: (networkArg == null ? void 0 : networkArg.chainId) ?? null,
23579
23670
  networkShortName: (networkArg == null ? void 0 : networkArg.shortName) ?? null,
@@ -24224,6 +24315,99 @@ const CoinleyPaymentInternal = ({
24224
24315
  setMobileWalletRedirecting(null);
24225
24316
  setPaymentData(null);
24226
24317
  };
24318
+ const prepareMobileWalletPayment = async () => {
24319
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
24320
+ const amountToUse = paymentAmount || parseFloat(config.amount);
24321
+ if (!amountToUse || amountToUse <= 0 || isNaN(amountToUse)) {
24322
+ throw new Error("Invalid payment amount. Please refresh and try again.");
24323
+ }
24324
+ const currentSelectionSnapshot = buildSelectionSnapshot(selectedNetwork, selectedToken, effectiveQuoteAddress, solanaWallet == null ? void 0 : solanaWallet.publicKey);
24325
+ let attempt = activeAttemptRef.current;
24326
+ if (!attempt || !snapshotsMatch(attempt.snapshot, currentSelectionSnapshot)) {
24327
+ attempt = createNewAttempt("mobile-wallet-handoff", {
24328
+ snapshot: currentSelectionSnapshot
24329
+ });
24330
+ }
24331
+ const attemptMeta = buildAttemptMeta(attempt);
24332
+ const metadata = {
24333
+ ...config.metadata,
24334
+ originalCurrency: merchantCurrency,
24335
+ originalAmount,
24336
+ exchangeRate,
24337
+ mobileWalletHandoff: true,
24338
+ preferredWallet: selectedMobileWallet,
24339
+ selectedNetwork: selectedNetwork.shortName,
24340
+ selectedToken: selectedToken.symbol,
24341
+ ...isSwapOrBridgeFlow ? {
24342
+ bridgeProvider: ((_a2 = relayBridge.bridgeQuote) == null ? void 0 : _a2.provider) || "lifi",
24343
+ bridgeOriginChainId: parseInt(selectedNetwork.chainId),
24344
+ bridgeOriginToken: selectedToken.contractAddress || selectedToken.symbol,
24345
+ bridgeOriginTokenSymbol: selectedToken.symbol,
24346
+ bridgeOriginTokenDecimals: selectedToken.decimals || 18,
24347
+ bridgeRequiresWalletExecution: true
24348
+ } : {},
24349
+ ...(selectedToken == null ? void 0 : selectedToken.isSwapToken) ? {
24350
+ swapFrom: selectedToken.symbol,
24351
+ swapProvider: ((_b = relayBridge.bridgeQuote) == null ? void 0 : _b.provider) || "lifi"
24352
+ } : {}
24353
+ };
24354
+ if (isSwapOrBridgeFlow) {
24355
+ if ((selectedToken == null ? void 0 : selectedToken.routeStatus) === "unsupported") {
24356
+ throw new Error(UNSUPPORTED_ROUTE_MESSAGE);
24357
+ }
24358
+ const selectedChainId = parseInt(selectedNetwork == null ? void 0 : selectedNetwork.chainId);
24359
+ const chainHasCreate2 = DEPOSIT_SUPPORTED_CHAINS.includes(selectedChainId);
24360
+ const sourceIsMerchantDestination = isMerchantReceiveNetwork(selectedNetwork);
24361
+ let effectiveNetwork;
24362
+ let merchantStable;
24363
+ if (selectedNetwork == null ? void 0 : selectedNetwork.isBridgeNetwork) {
24364
+ effectiveNetwork = (_c = selectedNetwork.bridgeDestination) == null ? void 0 : _c.shortName;
24365
+ merchantStable = paymentFlow.getMerchantStablecoin({ shortName: effectiveNetwork });
24366
+ } else if (chainHasCreate2 && sourceIsMerchantDestination) {
24367
+ effectiveNetwork = selectedNetwork.shortName;
24368
+ merchantStable = paymentFlow.getMerchantStablecoin(selectedNetwork);
24369
+ } else {
24370
+ const quotedDest = ((_d = relayBridge.bridgeQuote) == null ? void 0 : _d.destChainId) ? merchantReceiveNetworks.find((network) => parseInt(network.chainId) === parseInt(relayBridge.bridgeQuote.destChainId)) : null;
24371
+ const bestDest = quotedDest || getBestDestinationChain(merchantReceiveNetworks);
24372
+ effectiveNetwork = (bestDest == null ? void 0 : bestDest.shortName) || "base";
24373
+ merchantStable = paymentFlow.getMerchantStablecoin(bestDest || { shortName: "base" });
24374
+ }
24375
+ if (!effectiveNetwork) {
24376
+ throw new Error("No bridge destination is available for this mobile payment. Please try another network.");
24377
+ }
24378
+ if (!merchantStable) merchantStable = { symbol: "USDC" };
24379
+ const depositPayment = await createDepositPayment({
24380
+ ...config,
24381
+ amount: amountToUse,
24382
+ currency: merchantStable.symbol || "USDC",
24383
+ network: effectiveNetwork,
24384
+ expiresIn: BRIDGE_DEPOSIT_EXPIRY_SECONDS,
24385
+ __coinleyAttemptMeta: attemptMeta,
24386
+ metadata: {
24387
+ ...metadata,
24388
+ bridgeTo: effectiveNetwork,
24389
+ bridgeDestinationChainId: ((_e = relayBridge.bridgeQuote) == null ? void 0 : _e.destChainId) || null,
24390
+ bridgeDestinationToken: ((_f = relayBridge.bridgeQuote) == null ? void 0 : _f.destTokenAddress) || null
24391
+ }
24392
+ });
24393
+ return {
24394
+ ...depositPayment,
24395
+ mobileBridgeContext: {
24396
+ isBridgePayment: true,
24397
+ originChainId: parseInt(selectedNetwork.chainId),
24398
+ originNetwork: selectedNetwork.shortName,
24399
+ originToken: selectedToken.contractAddress || selectedToken.symbol,
24400
+ originTokenSymbol: selectedToken.symbol,
24401
+ originTokenDecimals: selectedToken.decimals || 18,
24402
+ destinationNetwork: effectiveNetwork,
24403
+ destinationTokenSymbol: merchantStable.symbol || "USDC",
24404
+ provider: ((_g = relayBridge.bridgeQuote) == null ? void 0 : _g.provider) || "lifi",
24405
+ quoteId: ((_h = relayBridge.bridgeQuote) == null ? void 0 : _h.id) || ((_i = relayBridge.bridgeQuote) == null ? void 0 : _i.quoteId) || null
24406
+ }
24407
+ };
24408
+ }
24409
+ return (paymentData == null ? void 0 : paymentData.id) ? paymentData : await createHostedPayment(selectedNetwork, selectedToken, "wallet_browser");
24410
+ };
24227
24411
  const handleMobileWalletPay = async () => {
24228
24412
  const selectedWalletMeta = mobileWalletOptions.find((wallet) => wallet.id === selectedMobileWallet);
24229
24413
  if (!selectedMobileWallet || !selectedWalletMeta) {
@@ -24234,11 +24418,15 @@ const CoinleyPaymentInternal = ({
24234
24418
  setError("Select a network and token before opening your wallet app.");
24235
24419
  return;
24236
24420
  }
24421
+ if (isConverting) {
24422
+ setError("Please wait for currency conversion to complete");
24423
+ return;
24424
+ }
24237
24425
  setError("");
24238
24426
  setPreferredWallet(selectedMobileWallet);
24239
24427
  setMobileWalletRedirecting(selectedMobileWallet);
24240
24428
  try {
24241
- const activePayment = (paymentData == null ? void 0 : paymentData.id) ? paymentData : await createHostedPayment(selectedNetwork, selectedToken, "wallet_browser");
24429
+ const activePayment = await prepareMobileWalletPayment();
24242
24430
  const opened = openPaymentPageInWallet(selectedMobileWallet, activePayment, selectedNetwork, selectedToken, apiUrl);
24243
24431
  if (!opened) {
24244
24432
  throw new Error(`Failed to open ${selectedWalletMeta.name}.`);
@@ -24504,7 +24692,7 @@ const CoinleyPaymentInternal = ({
24504
24692
  relayBridge.resetBridge();
24505
24693
  return;
24506
24694
  }
24507
- if (!selectedToken || !address && !(solanaWallet == null ? void 0 : solanaWallet.publicKey)) {
24695
+ if (!selectedToken || !effectiveQuoteAddress && !(solanaWallet == null ? void 0 : solanaWallet.publicKey)) {
24508
24696
  relayBridge.resetBridge();
24509
24697
  return;
24510
24698
  }
@@ -24520,7 +24708,6 @@ const CoinleyPaymentInternal = ({
24520
24708
  }
24521
24709
  const attemptMeta = buildAttemptMeta(attempt);
24522
24710
  if (isSwap && !isBridge) {
24523
- const DEPOSIT_SUPPORTED_CHAINS = [8453, 56, 42161, 137, 10, 43114, 143, 59144, 534352, 130];
24524
24711
  const isSolanaSwap = (selectedNetwork == null ? void 0 : selectedNetwork.shortName) === "solana" || (selectedNetwork == null ? void 0 : selectedNetwork.chainType) === "solana";
24525
24712
  const originChainId = isSolanaSwap ? RELAY_SOLANA_CHAIN_ID : parseInt(selectedNetwork.chainId);
24526
24713
  const chainHasCreate2 = DEPOSIT_SUPPORTED_CHAINS.includes(originChainId);
@@ -24547,7 +24734,7 @@ const CoinleyPaymentInternal = ({
24547
24734
  if (originTokenAddress === "native") originTokenAddress = SOLANA_TOKEN_ADDRESSES.SOL;
24548
24735
  }
24549
24736
  const PLACEHOLDER_EVM_ADDRESS = "0x0000000000000000000000000000000000000001";
24550
- const quoteRecipient = isSolanaSwap && !chainHasCreate2 ? PLACEHOLDER_EVM_ADDRESS : isSolanaSwap ? (solanaWallet == null ? void 0 : solanaWallet.publicKey) || address : address;
24737
+ const quoteRecipient = isSolanaSwap && !chainHasCreate2 ? PLACEHOLDER_EVM_ADDRESS : isSolanaSwap ? (solanaWallet == null ? void 0 : solanaWallet.publicKey) || effectiveQuoteAddress : effectiveQuoteAddress;
24551
24738
  const quoteUser = isSolanaSwap && !chainHasCreate2 ? solanaWallet == null ? void 0 : solanaWallet.publicKey : void 0;
24552
24739
  if (destinationCandidates) {
24553
24740
  getQuoteWithDestinationTrials({
@@ -24608,7 +24795,7 @@ const CoinleyPaymentInternal = ({
24608
24795
  getBridgeTokenAddress(destStableSymbol, destNetwork.bridgeTokens) || (merchantStable == null ? void 0 : merchantStable.contractAddress),
24609
24796
  destStableSymbol,
24610
24797
  amount.toString(),
24611
- address,
24798
+ effectiveQuoteAddress,
24612
24799
  selectedNetwork.bridgeTokens,
24613
24800
  destNetwork.bridgeTokens,
24614
24801
  void 0,
@@ -24629,7 +24816,7 @@ const CoinleyPaymentInternal = ({
24629
24816
  selectedToken.symbol,
24630
24817
  selectedToken.symbol,
24631
24818
  amount.toString(),
24632
- address,
24819
+ effectiveQuoteAddress,
24633
24820
  selectedNetwork.bridgeTokens,
24634
24821
  destNetwork.bridgeTokens,
24635
24822
  void 0,
@@ -24665,7 +24852,7 @@ const CoinleyPaymentInternal = ({
24665
24852
  selectedNetwork == null ? void 0 : selectedNetwork.id,
24666
24853
  selectedNetwork == null ? void 0 : selectedNetwork.shortName,
24667
24854
  selectedToken == null ? void 0 : selectedToken.id,
24668
- address,
24855
+ effectiveQuoteAddress,
24669
24856
  solanaWallet == null ? void 0 : solanaWallet.publicKey,
24670
24857
  paymentAmount,
24671
24858
  retryEpoch,
@@ -24864,6 +25051,85 @@ const CoinleyPaymentInternal = ({
24864
25051
  sdkAnalytics.trackTokenSelected(token == null ? void 0 : token.symbol, selectedNetwork == null ? void 0 : selectedNetwork.name, config == null ? void 0 : config.merchantName);
24865
25052
  clarityAnalytics.trackTokenSelected(token == null ? void 0 : token.symbol, selectedNetwork == null ? void 0 : selectedNetwork.name, config == null ? void 0 : config.merchantName);
24866
25053
  };
25054
+ useEffect(() => {
25055
+ if (activeTab !== PAYMENT_TABS.TRANSFER || ccSources.length) return;
25056
+ let cancelled = false;
25057
+ paymentFlow.api.getCrossChainSources().then((s) => {
25058
+ if (!cancelled) setCcSources(Array.isArray(s) ? s : []);
25059
+ }).catch((e) => {
25060
+ if (!cancelled) setCcError(e.message || "Failed to load chains");
25061
+ });
25062
+ return () => {
25063
+ cancelled = true;
25064
+ };
25065
+ }, [activeTab, ccSources.length, paymentFlow.api]);
25066
+ const ccOriginTokens = useMemo(() => {
25067
+ const c = ccSources.find((s) => Number(s.chainId) === Number(ccOriginChainId));
25068
+ return c ? c.tokens : [];
25069
+ }, [ccSources, ccOriginChainId]);
25070
+ const handleGenerateCrossChain = async () => {
25071
+ if (!ccOriginChainId || !ccOriginToken) return;
25072
+ setCcError(null);
25073
+ setCcGenerating(true);
25074
+ try {
25075
+ const r = await paymentFlow.api.createCrossChainPayment({
25076
+ amount: Number((config == null ? void 0 : config.amount) ?? paymentAmount),
25077
+ originChainId: Number(ccOriginChainId),
25078
+ originCurrency: ccOriginToken.address
25079
+ });
25080
+ const p = r.payment || r;
25081
+ setCcResult(p);
25082
+ setCcPhase("awaiting_deposit");
25083
+ setCcManualCheckStatus("idle");
25084
+ setCcQrCode(await QRCode.toDataURL(p.relayDepositAddress, { width: 220, margin: 1 }));
25085
+ } catch (e) {
25086
+ setCcError(e.message || "Could not generate payment address");
25087
+ } finally {
25088
+ setCcGenerating(false);
25089
+ }
25090
+ };
25091
+ const handleCrossChainManualCheck = async () => {
25092
+ if (!(ccResult == null ? void 0 : ccResult.id) || ccManualCheckStatus === "checking") return;
25093
+ setCcManualCheckStatus("checking");
25094
+ setCcError(null);
25095
+ try {
25096
+ const status = await paymentFlow.api.getCrossChainStatus(ccResult.id);
25097
+ setCcPhase(status.phase);
25098
+ if ((status.phase === "received" || status.phase === "settled") && !ccSucceeded.current) {
25099
+ ccSucceeded.current = true;
25100
+ onSuccess == null ? void 0 : onSuccess(status);
25101
+ } else if (status.phase === "failed") {
25102
+ setCcManualCheckStatus("failed");
25103
+ } else {
25104
+ setCcManualCheckStatus("not_found");
25105
+ }
25106
+ } catch (error2) {
25107
+ setCcError(error2.message || "Could not check this payment yet. Please try again.");
25108
+ setCcManualCheckStatus("idle");
25109
+ }
25110
+ };
25111
+ useEffect(() => {
25112
+ if (!(ccResult == null ? void 0 : ccResult.id)) return;
25113
+ let cancelled = false;
25114
+ const tick = async () => {
25115
+ try {
25116
+ const s = await paymentFlow.api.getCrossChainStatus(ccResult.id);
25117
+ if (cancelled) return;
25118
+ setCcPhase(s.phase);
25119
+ if ((s.phase === "received" || s.phase === "settled") && !ccSucceeded.current) {
25120
+ ccSucceeded.current = true;
25121
+ onSuccess == null ? void 0 : onSuccess(s);
25122
+ }
25123
+ } catch {
25124
+ }
25125
+ };
25126
+ tick();
25127
+ const t = setInterval(tick, 8e3);
25128
+ return () => {
25129
+ cancelled = true;
25130
+ clearInterval(t);
25131
+ };
25132
+ }, [ccResult == null ? void 0 : ccResult.id, paymentFlow.api, onSuccess]);
24867
25133
  const handleGenerateTransferAddress = async () => {
24868
25134
  if (isConverting) {
24869
25135
  setError("Please wait for currency conversion to complete");
@@ -25013,9 +25279,9 @@ const CoinleyPaymentInternal = ({
25013
25279
  if (selectedNetwork && !selectedNetwork.isBridgeNetwork && !(selectedToken == null ? void 0 : selectedToken.isSwapToken)) {
25014
25280
  console.log(`[Routing] Direct payment unsupported on ${selectedNetwork.shortName}; forcing deposit flow`);
25015
25281
  }
25016
- const DEPOSIT_SUPPORTED_CHAINS = [8453, 56, 42161, 137, 10, 43114, 143, 59144, 534352, 130];
25282
+ const DEPOSIT_SUPPORTED_CHAINS2 = [8453, 56, 42161, 137, 10, 43114, 143, 59144, 534352, 130];
25017
25283
  const selectedChainId = parseInt(selectedNetwork == null ? void 0 : selectedNetwork.chainId);
25018
- const chainHasCreate2 = DEPOSIT_SUPPORTED_CHAINS.includes(selectedChainId);
25284
+ const chainHasCreate2 = DEPOSIT_SUPPORTED_CHAINS2.includes(selectedChainId);
25019
25285
  const sourceIsMerchantDestination = isMerchantReceiveNetwork(selectedNetwork);
25020
25286
  let effectiveNetwork;
25021
25287
  let merchantStable;
@@ -25798,7 +26064,7 @@ const CoinleyPaymentInternal = ({
25798
26064
  if (currentStep === PAYMENT_STEPS.PROCESSING) {
25799
26065
  return /* @__PURE__ */ jsxs("div", { id: SDK_ROOT_ID, className: `${SDK_ROOT_CLASS} fixed inset-0 z-50`, style: { fontFamily: FONT_FAMILY }, children: [
25800
26066
  /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50", onClick: handleCancel }),
25801
- /* @__PURE__ */ jsx("div", { className: isMobile ? "fixed inset-0 flex items-end" : "fixed inset-0 flex items-center justify-center p-4", style: { zIndex: 51 }, children: /* @__PURE__ */ jsxs("div", { className: isMobile ? "relative flex w-full max-h-[92vh] flex-col overflow-hidden rounded-t-[28px] bg-white px-4 pb-5 pt-7 shadow-2xl animate-slide-up-sheet" : "relative flex h-[500px] w-[430px] flex-col overflow-hidden rounded-[28px] bg-white px-4 pb-5 pt-7 shadow-2xl", children: [
26067
+ /* @__PURE__ */ jsx("div", { className: isMobile ? "fixed inset-0 flex items-end" : "fixed inset-0 flex items-center justify-center p-4", style: { zIndex: 51 }, children: /* @__PURE__ */ jsxs("div", { className: isMobile ? "coinley-mobile-sheet relative flex w-full max-h-[92dvh] flex-col overflow-hidden rounded-t-[24px] bg-white px-4 pb-5 pt-7 shadow-2xl animate-slide-up-sheet" : "relative flex h-[500px] w-[430px] flex-col overflow-hidden rounded-[28px] bg-white px-4 pb-5 pt-7 shadow-2xl", children: [
25802
26068
  /* @__PURE__ */ jsx(
25803
26069
  "button",
25804
26070
  {
@@ -25839,7 +26105,7 @@ const CoinleyPaymentInternal = ({
25839
26105
  if (currentStep === PAYMENT_STEPS.SUCCESS) {
25840
26106
  return /* @__PURE__ */ jsxs("div", { id: SDK_ROOT_ID, className: `${SDK_ROOT_CLASS} fixed inset-0 z-50`, style: { fontFamily: FONT_FAMILY }, children: [
25841
26107
  /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50" }),
25842
- /* @__PURE__ */ jsx("div", { className: isMobile ? "fixed inset-0 flex items-end" : "fixed inset-0 flex items-center justify-center p-4", style: { zIndex: 51 }, children: /* @__PURE__ */ jsx("div", { className: isMobile ? "relative flex w-full max-h-[92vh] flex-col overflow-hidden rounded-t-[28px] bg-white px-4 pb-5 pt-5 animate-slide-up-sheet" : "relative flex h-[640px] max-h-[calc(100vh-32px)] min-h-0 w-[450px] max-w-[calc(100vw-32px)] flex-col overflow-hidden rounded-[28px] bg-white px-4 pb-5 pt-5", children: /* @__PURE__ */ jsx(
26108
+ /* @__PURE__ */ jsx("div", { className: isMobile ? "fixed inset-0 flex items-end" : "fixed inset-0 flex items-center justify-center p-4", style: { zIndex: 51 }, children: /* @__PURE__ */ jsx("div", { className: isMobile ? "coinley-mobile-sheet relative flex w-full max-h-[92dvh] flex-col overflow-hidden rounded-t-[24px] bg-white px-4 pb-5 pt-5 animate-slide-up-sheet" : "relative flex h-[640px] max-h-[calc(100vh-32px)] min-h-0 w-[450px] max-w-[calc(100vw-32px)] flex-col overflow-hidden rounded-[28px] bg-white px-4 pb-5 pt-5", children: /* @__PURE__ */ jsx(
25843
26109
  PaymentStatus,
25844
26110
  {
25845
26111
  status: "success",
@@ -25875,12 +26141,14 @@ const CoinleyPaymentInternal = ({
25875
26141
  };
25876
26142
  const getNetworkDisplayName = (network) => (network == null ? void 0 : network.name) || (network == null ? void 0 : network.displayName) || (network == null ? void 0 : network.shortName) || "Network";
25877
26143
  const getNetworkDisplayLogo = (network) => (network == null ? void 0 : network.logo) || (network == null ? void 0 : network.logoURI) || (network == null ? void 0 : network.icon) || getNetworkLogoUrl(network) || getFallbackNetworkLogoUrl(getNetworkDisplayName(network));
25878
- const isTransferSetupView = activeTab === PAYMENT_TABS.TRANSFER && (!selectedNetwork || !selectedToken || !(paymentData == null ? void 0 : paymentData.depositAddress));
26144
+ const isCrossChainTransferSetupView = activeTab === PAYMENT_TABS.TRANSFER && !ccResult;
26145
+ const isCrossChainTransferAddressView = activeTab === PAYMENT_TABS.TRANSFER && !!ccResult;
26146
+ const isTransferSetupView = activeTab === PAYMENT_TABS.TRANSFER && !ccResult && (!selectedNetwork || !selectedToken || !(paymentData == null ? void 0 : paymentData.depositAddress));
25879
26147
  const isQrSetupView = activeTab === PAYMENT_TABS.QR && (!selectedNetwork || !selectedToken || !paymentData || (paymentData == null ? void 0 : paymentData.isDepositPayment));
25880
26148
  const isWalletExtensionSetupView = activeTab === PAYMENT_TABS.WALLET && !showWalletConfirm && !(showMobileWalletPicker && isMobile) && (!connectedWalletType || !selectedNetwork || !selectedToken);
25881
26149
  const isWalletExtensionReadyView = activeTab === PAYMENT_TABS.WALLET && connectedWalletType && selectedNetwork && selectedToken && !showWalletConfirm && !(showMobileWalletPicker && isMobile);
25882
26150
  const isWalletExtensionConfirmView = activeTab === PAYMENT_TABS.WALLET && showWalletConfirm;
25883
- const isCompactCheckoutSetupView = isTransferSetupView || isQrSetupView || isWalletExtensionSetupView;
26151
+ const isCompactCheckoutSetupView = isCrossChainTransferSetupView || isTransferSetupView || isQrSetupView || isWalletExtensionSetupView;
25884
26152
  const isCompactCheckoutView = isCompactCheckoutSetupView || isWalletExtensionReadyView || isWalletExtensionConfirmView;
25885
26153
  const isTightWalletView = isWalletExtensionReadyView || isWalletExtensionConfirmView;
25886
26154
  const renderPaymentSummary = () => /* @__PURE__ */ jsxs("div", { className: isTightWalletView ? "mb-3" : isCompactCheckoutView ? "mb-6 mt-[-5px]" : "mb-8", children: [
@@ -25925,101 +26193,7 @@ const CoinleyPaymentInternal = ({
25925
26193
  ] }),
25926
26194
  title && description && /* @__PURE__ */ jsx("p", { className: "pl-6 text-xs leading-5 text-[#B54708]", children: description })
25927
26195
  ] });
25928
- const renderUnderpaymentOptionCard = ({ choice, icon, title, description }) => {
25929
- const selected = underpaymentChoice === choice;
25930
- return /* @__PURE__ */ jsxs(
25931
- "button",
25932
- {
25933
- type: "button",
25934
- onClick: () => {
25935
- setUnderpaymentChoice(choice);
25936
- setRefundRequestSubmitted(false);
25937
- setRefundRequestStatus(null);
25938
- setRefundRequestMessage("");
25939
- },
25940
- 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]"}`,
25941
- children: [
25942
- selected && /* @__PURE__ */ jsx("span", { className: "absolute right-[-7px] top-[-9px] flex h-5 w-5 items-center justify-center rounded-full border border-[#8B5CF6] bg-white text-[#7042D2]", children: /* @__PURE__ */ jsx("svg", { className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) }) }),
25943
- /* @__PURE__ */ jsx("div", { className: "mb-3 flex h-6 w-6 items-center justify-center text-[#111827]", children: icon }),
25944
- /* @__PURE__ */ jsx("p", { className: "mb-1 text-sm font-semibold text-[#111827]", children: title }),
25945
- /* @__PURE__ */ jsx("p", { className: "text-xs leading-4 text-[#A3A5AC]", children: description })
25946
- ]
25947
- }
25948
- );
25949
- };
25950
- const renderUnderpaymentChoicePanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
25951
- renderUnderpaymentWarning(
25952
- "Amount received is less than expected",
25953
- `We received $${formatAmount(underpaymentInfo.receivedAmount || 0)} but expected $${formatAmount(underpaymentInfo.expectedAmount || paymentAmount || 0)}. Your transaction is on hold, please choose how to proceed.`
25954
- ),
25955
- /* @__PURE__ */ jsxs("div", { className: "mb-5 flex gap-2", children: [
25956
- renderUnderpaymentOptionCard({
25957
- choice: "offset",
25958
- title: "Send offset",
25959
- description: underpaymentChoice === "offset" ? "Top up the shortfall and complete this transfer with extended time" : "Top up the shortfall with extended time",
25960
- icon: /* @__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: 1.8, d: "M4 4v6h6M20 20v-6h-6M5.5 15.5A7 7 0 0017.7 18M18.5 8.5A7 7 0 006.3 6" }) })
25961
- }),
25962
- renderUnderpaymentOptionCard({
25963
- choice: "refund",
25964
- title: "Cancel & refund",
25965
- description: "Cancel my transaction so i get refunded",
25966
- icon: /* @__PURE__ */ jsxs("svg", { className: "h-6 w-6", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
25967
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9", strokeWidth: 1.8 }),
25968
- /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.8, d: "M9 9l6 6m0-6l-6 6" })
25969
- ] })
25970
- })
25971
- ] })
25972
- ] });
25973
- const renderUnderpaymentOffsetPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
25974
- /* @__PURE__ */ jsxs("div", { className: "mb-5 flex items-start gap-3", children: [
25975
- /* @__PURE__ */ jsx("div", { className: "h-[92px] w-[92px] flex-shrink-0 bg-white", children: depositQrCode ? /* @__PURE__ */ jsx("img", { src: depositQrCode, alt: "Deposit Address QR Code", className: "h-full w-full" }) : /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center rounded-lg bg-gray-100", children: /* @__PURE__ */ jsx("div", { className: "h-6 w-6 animate-spin rounded-full border-2 border-[#E5E7EB] border-t-[#7042D2]" }) }) }),
25976
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 pt-1", children: [
25977
- /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs font-medium text-[#1F2430]", children: "Same Wallet address" }),
25978
- /* @__PURE__ */ jsxs("div", { className: "flex min-h-[58px] items-center gap-2 rounded-xl border border-[#EEF0F4] bg-[#FAFAFB] px-3 py-2", children: [
25979
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 break-all text-sm leading-5 text-[#1F2430]", children: paymentData.depositAddress }),
25980
- /* @__PURE__ */ jsx(
25981
- "button",
25982
- {
25983
- onClick: () => copyToClipboard(paymentData.depositAddress, "depositAddress"),
25984
- className: `flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg transition-colors ${copiedField === "depositAddress" ? "bg-green-100 text-green-600" : "text-[#7042D2] hover:bg-purple-50"}`,
25985
- "aria-label": "Copy wallet address",
25986
- children: copiedField === "depositAddress" ? /* @__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: "M5 13l4 4L19 7" }) }) : /* @__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: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" }) })
25987
- }
25988
- )
25989
- ] })
25990
- ] })
25991
- ] }),
25992
- renderUnderpaymentWarning(
25993
- null,
25994
- "Send only the offset amount to the same address. Make sure to add network fees on top of this amount."
25995
- ),
25996
- manualCheckStatus === "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." }) })
25997
- ] });
25998
- const renderUnderpaymentRefundPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
25999
- renderUnderpaymentWarning(
26000
- `Refund of $${formatAmount(underpaymentInfo.receivedAmount || 0)} ${underpaymentInfo.tokenSymbol}`,
26001
- `Provide a ${underpaymentInfo.tokenSymbol} wallet address on the same network (${underpaymentInfo.refundNetworkLabel}) to receive your refund. Network fees will be deducted.`
26002
- ),
26003
- /* @__PURE__ */ jsxs("label", { className: "mb-2 block text-xs font-medium text-[#111827]", children: [
26004
- "Your ",
26005
- underpaymentInfo.tokenSymbol,
26006
- " (",
26007
- underpaymentInfo.refundNetworkLabel,
26008
- ") receiving wallet address"
26009
- ] }),
26010
- /* @__PURE__ */ jsx(
26011
- "input",
26012
- {
26013
- type: "text",
26014
- value: refundAddress,
26015
- onChange: (event) => setRefundAddress(event.target.value),
26016
- placeholder: "Paste your wallet address here",
26017
- className: "mb-5 h-11 w-full rounded-xl border border-[#E4E6EB] bg-white px-3 text-sm text-[#1F2430] outline-none transition-colors placeholder:text-[#8B8E98] focus:border-[#B49AF0]"
26018
- }
26019
- ),
26020
- refundRequestMessage && /* @__PURE__ */ jsx("p", { className: `mt-2 text-center text-xs leading-5 ${refundRequestStatus === "error" ? "text-red-600" : "text-[#8B8E98]"}`, children: refundRequestMessage })
26021
- ] });
26022
- const transferNetworks = networks.filter((network) => {
26196
+ networks.filter((network) => {
26023
26197
  const chainId = parseInt(network.chainId);
26024
26198
  const supportedChains = [8453, 56, 42161, 137, 10, 43114, 143, 59144, 534352, 130];
26025
26199
  return supportedChains.includes(chainId);
@@ -26123,41 +26297,6 @@ const CoinleyPaymentInternal = ({
26123
26297
  ] })
26124
26298
  ] });
26125
26299
  };
26126
- const renderTransferSetupPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
26127
- renderCheckoutSelect({
26128
- id: "transfer-network",
26129
- label: "Select a Network",
26130
- value: selectedNetwork == null ? void 0 : selectedNetwork.id,
26131
- placeholder: "Select a network",
26132
- options: transferNetworks,
26133
- getLabel: (network) => getNetworkDisplayName(network),
26134
- getIcon: (network) => getNetworkDisplayLogo(network),
26135
- compact: true,
26136
- elevated: true,
26137
- maxVisibleItems: 4,
26138
- onChange: (networkId) => {
26139
- const network = transferNetworks.find((item) => item.id === networkId);
26140
- if (network) handleNetworkSelect(network);
26141
- }
26142
- }),
26143
- renderCheckoutSelect({
26144
- id: "transfer-token",
26145
- label: "Pick a Token",
26146
- value: selectedToken == null ? void 0 : selectedToken.id,
26147
- placeholder: selectedNetwork ? "Select a token" : "Select a token",
26148
- disabled: !selectedNetwork || availableTokens.length === 0,
26149
- options: availableTokens,
26150
- getLabel: (token) => getTokenDisplaySymbol(token),
26151
- getIcon: (token) => getTokenDisplayLogo(token),
26152
- compact: true,
26153
- elevated: true,
26154
- maxVisibleItems: 2,
26155
- onChange: (tokenId) => {
26156
- const token = availableTokens.find((item) => item.id === tokenId);
26157
- if (token) handleTokenSelect(token);
26158
- }
26159
- })
26160
- ] });
26161
26300
  const renderWalletExtensionSetupPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
26162
26301
  !selectedNetwork && renderWalletNetworkPickerPanel(),
26163
26302
  selectedNetwork && !selectedToken && renderWalletTokenPickerPanel(),
@@ -26216,7 +26355,7 @@ const CoinleyPaymentInternal = ({
26216
26355
  className: "h-8 w-full rounded-lg border border-[#E5E7EB] bg-white px-3 text-xs text-[#1F2430] outline-none placeholder:text-[#A9ABB2] focus:border-[#B49AF0]"
26217
26356
  }
26218
26357
  ) }),
26219
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-2", children: visibleWalletNetworkOptions.length > 0 ? visibleWalletNetworkOptions.map((network) => /* @__PURE__ */ jsxs(
26358
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-2 min-[360px]:grid-cols-2", children: visibleWalletNetworkOptions.length > 0 ? visibleWalletNetworkOptions.map((network) => /* @__PURE__ */ jsxs(
26220
26359
  "button",
26221
26360
  {
26222
26361
  type: "button",
@@ -26226,7 +26365,7 @@ const CoinleyPaymentInternal = ({
26226
26365
  setPaymentData(null);
26227
26366
  setWalletNetworkSearch("");
26228
26367
  },
26229
- className: "flex h-10 items-center gap-2 rounded-xl bg-[#FAFAFB] px-3 text-left text-sm text-[#1F2430] transition-colors hover:bg-purple-50",
26368
+ className: "flex min-h-10 items-center gap-2 rounded-xl bg-[#FAFAFB] px-3 py-2 text-left text-sm text-[#1F2430] transition-colors hover:bg-purple-50",
26230
26369
  children: [
26231
26370
  /* @__PURE__ */ jsx(
26232
26371
  "img",
@@ -26300,7 +26439,7 @@ const CoinleyPaymentInternal = ({
26300
26439
  className: "mb-2 h-8 w-full rounded-lg border border-[#E5E7EB] bg-white px-3 text-xs text-[#1F2430] outline-none placeholder:text-[#A9ABB2] focus:border-[#B49AF0]"
26301
26440
  }
26302
26441
  ),
26303
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-2", children: visibleWalletTokens.length > 0 ? visibleWalletTokens.map((token) => /* @__PURE__ */ jsxs(
26442
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-2 min-[360px]:grid-cols-2", children: visibleWalletTokens.length > 0 ? visibleWalletTokens.map((token) => /* @__PURE__ */ jsxs(
26304
26443
  "button",
26305
26444
  {
26306
26445
  type: "button",
@@ -26309,7 +26448,7 @@ const CoinleyPaymentInternal = ({
26309
26448
  setTokenSearch("");
26310
26449
  setPaymentData(null);
26311
26450
  },
26312
- className: "flex h-10 items-center gap-2 rounded-xl bg-[#FAFAFB] px-3 text-left text-sm text-[#1F2430] transition-colors hover:bg-purple-50",
26451
+ className: "flex min-h-10 items-center gap-2 rounded-xl bg-[#FAFAFB] px-3 py-2 text-left text-sm text-[#1F2430] transition-colors hover:bg-purple-50",
26313
26452
  children: [
26314
26453
  /* @__PURE__ */ jsx(
26315
26454
  "img",
@@ -26398,13 +26537,13 @@ const CoinleyPaymentInternal = ({
26398
26537
  }
26399
26538
  }),
26400
26539
  /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs font-medium text-[#1F2430]", children: "Please select your wallet app" }),
26401
- /* @__PURE__ */ jsx("div", { className: "mb-3 grid grid-cols-3 gap-1.5", children: qrWalletOptions.map((wallet) => /* @__PURE__ */ jsxs(
26540
+ /* @__PURE__ */ jsx("div", { className: "mb-3 grid grid-cols-1 gap-1.5 min-[360px]:grid-cols-3", children: qrWalletOptions.map((wallet) => /* @__PURE__ */ jsxs(
26402
26541
  "button",
26403
26542
  {
26404
26543
  type: "button",
26405
26544
  onClick: () => handleQrWalletSelect(wallet.id),
26406
26545
  disabled: !selectedNetwork || !selectedToken || qrLoading || isConverting,
26407
- className: `relative flex h-[76px] flex-col items-start justify-between rounded-lg border bg-[#FAFAFB] px-3 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`,
26546
+ className: `relative flex min-h-[64px] flex-row items-center gap-2 rounded-lg border bg-[#FAFAFB] px-3 py-3 text-left transition-colors min-[360px]:h-[76px] min-[360px]:flex-col min-[360px]:items-start min-[360px]:justify-between ${preferredWallet === wallet.id ? "border-[#7042D2] bg-[#FBF8FF]" : "border-[#EEF0F4] hover:border-[#C9B8F6]"} disabled:cursor-not-allowed disabled:opacity-60`,
26408
26547
  children: [
26409
26548
  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" }) }) }),
26410
26549
  /* @__PURE__ */ jsx(
@@ -26418,7 +26557,7 @@ const CoinleyPaymentInternal = ({
26418
26557
  }
26419
26558
  }
26420
26559
  ),
26421
- /* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium text-[#111827]", children: wallet.name })
26560
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-sm font-medium text-[#111827]", children: wallet.name })
26422
26561
  ]
26423
26562
  },
26424
26563
  wallet.id
@@ -26430,7 +26569,7 @@ const CoinleyPaymentInternal = ({
26430
26569
  /* @__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" })
26431
26570
  ] });
26432
26571
  const renderQrPaymentPanel = () => /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
26433
- /* @__PURE__ */ jsxs("div", { className: "mb-4 flex items-start gap-4", children: [
26572
+ /* @__PURE__ */ jsxs("div", { className: "mb-4 flex flex-col gap-3 min-[380px]:flex-row min-[380px]:items-start", children: [
26434
26573
  /* @__PURE__ */ jsx("div", { className: "h-[92px] w-[92px] flex-shrink-0 bg-white", children: qrCodeDataUrl ? /* @__PURE__ */ jsx("img", { src: qrCodeDataUrl, alt: "Payment QR Code", className: "h-full w-full" }) : /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center rounded-lg bg-gray-100", children: /* @__PURE__ */ jsx("div", { className: "h-6 w-6 animate-spin rounded-full border-2 border-[#E5E7EB] border-t-[#7042D2]" }) }) }),
26435
26574
  /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
26436
26575
  /* @__PURE__ */ jsx("p", { className: "mb-2 text-base font-semibold text-[#111827]", children: "Instructions" }),
@@ -26575,7 +26714,7 @@ const CoinleyPaymentInternal = ({
26575
26714
  renderFooterPrimaryButton({
26576
26715
  label: mobileWalletRedirecting === selectedMobileWallet ? `Opening ${walletName}...` : selectedMobileWallet ? `Open ${walletName}` : "Choose a Wallet",
26577
26716
  onClick: handleMobileWalletPay,
26578
- disabled: !selectedMobileWallet || !selectedNetwork || !selectedToken || mobileWalletRedirecting === selectedMobileWallet || loading || isSwapOrBridgeFlow && (relayBridge.bridgeStatus === "quoting" || (selectedToken == null ? void 0 : selectedToken.routeStatus) === "unsupported")
26717
+ disabled: !selectedMobileWallet || !selectedNetwork || !selectedToken || mobileWalletRedirecting === selectedMobileWallet || loading || isConverting || isSwapOrBridgeFlow && (relayBridge.bridgeStatus === "quoting" || (selectedToken == null ? void 0 : selectedToken.routeStatus) === "unsupported")
26579
26718
  }),
26580
26719
  renderFooterPrimaryButton({ label: "Cancel", onClick: handleCancel, variant: "secondary" }),
26581
26720
  /* @__PURE__ */ jsx(
@@ -26592,6 +26731,20 @@ const CoinleyPaymentInternal = ({
26592
26731
  )
26593
26732
  ] });
26594
26733
  }
26734
+ if (isCrossChainTransferSetupView) {
26735
+ return renderFooterPrimaryButton({
26736
+ label: ccGenerating ? "Generating Address..." : `Pay ${paymentAmountLabel}`,
26737
+ onClick: handleGenerateCrossChain,
26738
+ disabled: !ccOriginToken || ccGenerating || isConverting
26739
+ });
26740
+ }
26741
+ if (isCrossChainTransferAddressView) {
26742
+ return renderFooterPrimaryButton({
26743
+ label: ccManualCheckStatus === "checking" ? "Checking for your payment..." : "I've made transfer",
26744
+ onClick: handleCrossChainManualCheck,
26745
+ disabled: ccManualCheckStatus === "checking" || ccPhase === "received" || ccPhase === "settled"
26746
+ });
26747
+ }
26595
26748
  if (activeTab === PAYMENT_TABS.TRANSFER && selectedNetwork && selectedToken && (paymentData == null ? void 0 : paymentData.depositAddress) && underpaymentInfo) {
26596
26749
  if (underpaymentView === "choice") {
26597
26750
  return renderFooterPrimaryButton({
@@ -26602,7 +26755,7 @@ const CoinleyPaymentInternal = ({
26602
26755
  }
26603
26756
  if (underpaymentView === "offset") {
26604
26757
  return renderFooterPrimaryButton({
26605
- label: manualCheckStatus === "checking" ? "Checking for your payment..." : "I've sent the offset",
26758
+ label: manualCheckStatus === "checking" ? "Checking for your payment..." : "I've made transfer",
26606
26759
  onClick: handleDepositManualCheck,
26607
26760
  disabled: manualCheckStatus === "checking"
26608
26761
  });
@@ -26763,11 +26916,11 @@ const CoinleyPaymentInternal = ({
26763
26916
  }
26764
26917
  ),
26765
26918
  /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: selectedNetwork.name })
26766
- ] }) : /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-3", children: merchantFilteredNetworks.map((network) => /* @__PURE__ */ jsxs(
26919
+ ] }) : /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-2 min-[380px]:grid-cols-2", children: merchantFilteredNetworks.map((network) => /* @__PURE__ */ jsxs(
26767
26920
  "button",
26768
26921
  {
26769
26922
  onClick: () => handleNetworkSelect(network),
26770
- className: "flex items-center gap-3 p-3 rounded-xl border-2 border-gray-100 hover:border-[#7042D2] hover:bg-purple-50 transition-all text-left",
26923
+ className: "flex min-w-0 items-center gap-3 rounded-xl border-2 border-gray-100 p-3 text-left transition-all hover:border-[#7042D2] hover:bg-purple-50",
26771
26924
  children: [
26772
26925
  /* @__PURE__ */ jsx(
26773
26926
  "img",
@@ -26812,7 +26965,7 @@ const CoinleyPaymentInternal = ({
26812
26965
  className: "w-full mb-3 px-3 py-2 text-sm border border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-[#7042D2] focus:border-transparent"
26813
26966
  }
26814
26967
  ),
26815
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-3", children: availableTokens.filter((t) => {
26968
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-2 min-[380px]:grid-cols-2", children: availableTokens.filter((t) => {
26816
26969
  var _a3;
26817
26970
  return !tokenSearch || t.symbol.toLowerCase().includes(tokenSearch.toLowerCase()) || ((_a3 = t.name) == null ? void 0 : _a3.toLowerCase().includes(tokenSearch.toLowerCase()));
26818
26971
  }).map((token) => /* @__PURE__ */ jsxs(
@@ -26822,7 +26975,7 @@ const CoinleyPaymentInternal = ({
26822
26975
  handleTokenSelect(token);
26823
26976
  setTokenSearch("");
26824
26977
  },
26825
- className: "flex items-center gap-3 p-3 rounded-xl border-2 border-gray-100 hover:border-[#7042D2] hover:bg-purple-50 transition-all text-left",
26978
+ className: "flex min-w-0 items-center gap-3 rounded-xl border-2 border-gray-100 p-3 text-left transition-all hover:border-[#7042D2] hover:bg-purple-50",
26826
26979
  children: [
26827
26980
  /* @__PURE__ */ jsx(
26828
26981
  "img",
@@ -26956,36 +27109,73 @@ const CoinleyPaymentInternal = ({
26956
27109
  ] }),
26957
27110
  activeTab === PAYMENT_TABS.QR && /* @__PURE__ */ jsx(Fragment, { children: qrWalletChoiceConfirmed ? renderQrPaymentPanel() : renderQrWalletChoicePanel() }),
26958
27111
  activeTab === PAYMENT_TABS.TRANSFER && /* @__PURE__ */ jsxs(Fragment, { children: [
26959
- (!selectedNetwork || !selectedToken || !(paymentData == null ? void 0 : paymentData.depositAddress)) && renderTransferSetupPanel(),
26960
- selectedNetwork && selectedToken && (paymentData == null ? void 0 : paymentData.depositAddress) && (underpaymentInfo ? /* @__PURE__ */ jsx(Fragment, { children: underpaymentView === "offset" ? renderUnderpaymentOffsetPanel() : underpaymentView === "refund" ? renderUnderpaymentRefundPanel() : renderUnderpaymentChoicePanel() }) : /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
26961
- (expirationTime == null ? void 0 : expirationTime.expired) && /* @__PURE__ */ jsx("div", { className: "mb-4 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs font-medium text-red-600", children: "Timer exhausted - No transaction detected. Please generate a new address." }),
26962
- /* @__PURE__ */ jsxs("div", { className: "mb-5 flex items-start gap-3", children: [
26963
- /* @__PURE__ */ jsx("div", { className: "h-[92px] w-[92px] flex-shrink-0 bg-white", children: depositQrCode ? /* @__PURE__ */ jsx("img", { src: depositQrCode, alt: "Deposit Address QR Code", className: "h-full w-full" }) : /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center rounded-lg bg-gray-100", children: /* @__PURE__ */ jsx("div", { className: "h-6 w-6 animate-spin rounded-full border-2 border-[#E5E7EB] border-t-[#7042D2]" }) }) }),
26964
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 pt-1", children: [
27112
+ !ccResult && /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
27113
+ renderCheckoutSelect({
27114
+ id: "cross-chain-network",
27115
+ label: "Select a Network",
27116
+ value: ccOriginChainId,
27117
+ placeholder: "Select a network",
27118
+ options: ccSources.map((s) => ({ id: String(s.chainId), chainId: s.chainId })),
27119
+ getLabel: (o) => ccChainName(o.chainId),
27120
+ getIcon: (o) => ccChainIcon(o.chainId),
27121
+ compact: true,
27122
+ elevated: true,
27123
+ maxVisibleItems: 4,
27124
+ onChange: (chainId) => {
27125
+ setCcOriginChainId(chainId);
27126
+ setCcOriginToken(null);
27127
+ }
27128
+ }),
27129
+ renderCheckoutSelect({
27130
+ id: "cross-chain-token",
27131
+ label: "Pick a Token",
27132
+ value: ccOriginToken == null ? void 0 : ccOriginToken.address,
27133
+ placeholder: "Select a token",
27134
+ disabled: !ccOriginChainId || ccOriginTokens.length === 0,
27135
+ options: ccOriginTokens.map((t) => ({ id: t.address, ...t })),
27136
+ getLabel: (o) => o.symbol,
27137
+ compact: true,
27138
+ elevated: true,
27139
+ maxVisibleItems: 4,
27140
+ onChange: (address2) => setCcOriginToken(ccOriginTokens.find((t) => t.address === address2) || null)
27141
+ }),
27142
+ ccError && /* @__PURE__ */ jsx("div", { className: "mb-3 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs font-medium text-red-600", children: ccError })
27143
+ ] }),
27144
+ ccResult && /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
27145
+ /* @__PURE__ */ jsxs("div", { className: "mb-5 flex items-center gap-4", children: [
27146
+ /* @__PURE__ */ jsx("div", { className: "h-[92px] w-[92px] flex-shrink-0 bg-white", children: ccQrCode ? /* @__PURE__ */ jsx("img", { src: ccQrCode, alt: "Payment Address QR Code", className: "h-full w-full" }) : /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center rounded-lg bg-gray-100", children: /* @__PURE__ */ jsx("div", { className: "h-6 w-6 animate-spin rounded-full border-2 border-[#E5E7EB] border-t-[#7042D2]" }) }) }),
27147
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
26965
27148
  /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs font-medium text-[#1F2430]", children: "Wallet address" }),
26966
- /* @__PURE__ */ jsxs("div", { className: "flex min-h-[58px] items-center gap-2 rounded-xl border border-[#EEF0F4] bg-[#FAFAFB] px-3 py-2", children: [
26967
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 break-all text-sm leading-5 text-[#1F2430]", children: paymentData.depositAddress }),
27149
+ /* @__PURE__ */ jsxs("div", { className: "flex min-h-[60px] items-center gap-2 rounded-xl border border-[#EEF0F4] bg-[#FAFAFB] px-3 py-2", children: [
27150
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 break-all text-sm leading-5 text-[#1F2430]", children: ccResult.relayDepositAddress }),
26968
27151
  /* @__PURE__ */ jsx(
26969
27152
  "button",
26970
27153
  {
26971
- onClick: () => copyToClipboard(paymentData.depositAddress, "depositAddress"),
26972
- className: `flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg transition-colors ${copiedField === "depositAddress" ? "bg-green-100 text-green-600" : "text-[#7042D2] hover:bg-purple-50"}`,
27154
+ onClick: () => copyToClipboard(ccResult.relayDepositAddress, "ccAddress"),
27155
+ className: `flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg transition-colors ${copiedField === "ccAddress" ? "bg-green-100 text-green-600" : "text-[#7042D2] hover:bg-purple-50"}`,
26973
27156
  "aria-label": "Copy wallet address",
26974
- children: copiedField === "depositAddress" ? /* @__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: "M5 13l4 4L19 7" }) }) : /* @__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: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" }) })
27157
+ children: copiedField === "ccAddress" ? /* @__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: "M5 13l4 4L19 7" }) }) : /* @__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: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" }) })
26975
27158
  }
26976
27159
  )
26977
27160
  ] })
26978
27161
  ] })
26979
27162
  ] }),
26980
- /* @__PURE__ */ jsxs("div", { className: "mb-3 rounded-lg border border-[#F5E5B8] bg-[#FFF9E8] px-3 py-2.5", children: [
26981
- /* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center gap-2 text-[#C55A11]", children: [
26982
- /* @__PURE__ */ jsx("svg", { className: "h-4 w-4 flex-shrink-0", 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" }) }),
26983
- /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold", children: "Important!" })
27163
+ renderUnderpaymentWarning(
27164
+ "Important!",
27165
+ "Use this wallet address for this transfer only. Send from the selected network and include enough native token for network fees."
27166
+ ),
27167
+ 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." }) }),
27168
+ 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: [
27169
+ /* @__PURE__ */ jsx("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-green-500" }),
27170
+ "Payment received"
27171
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 text-xs text-[#A3A5AC]", children: [
27172
+ /* @__PURE__ */ jsxs("span", { className: "relative flex h-2 w-2", children: [
27173
+ /* @__PURE__ */ jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75" }),
27174
+ /* @__PURE__ */ jsx("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-green-500" })
26984
27175
  ] }),
26985
- /* @__PURE__ */ jsx("p", { className: "pl-6 text-xs leading-5 text-[#C55A11]", children: "We must receive the exact amount shown. If your exchange charges a withdrawal fee, add it on top of this amount before sending." })
26986
- ] }),
26987
- manualCheckStatus === "not_found" && !(expirationTime == null ? void 0 : expirationTime.expired) && /* @__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 haven't received your payment yet. It may take a few moments for the transaction to appear on the blockchain. We'll keep checking automatically." }) })
26988
- ] }))
27176
+ "Checking automatically every few seconds..."
27177
+ ] })
27178
+ ] })
26989
27179
  ] }),
26990
27180
  (error || transactionError) && /* @__PURE__ */ jsxs("div", { className: "mt-4 p-4 bg-red-50 border border-red-200 rounded-xl", children: [
26991
27181
  /* @__PURE__ */ jsx("p", { className: "text-red-800 text-sm", children: error || transactionError }),
@@ -27019,7 +27209,7 @@ const CoinleyPaymentInternal = ({
27019
27209
  )
27020
27210
  ] });
27021
27211
  };
27022
- const isTransferAddressGenerated = activeTab === PAYMENT_TABS.TRANSFER && selectedNetwork && selectedToken && (paymentData == null ? void 0 : paymentData.depositAddress);
27212
+ const isTransferAddressGenerated = activeTab === PAYMENT_TABS.TRANSFER && (selectedNetwork && selectedToken && (paymentData == null ? void 0 : paymentData.depositAddress) || ccResult);
27023
27213
  const isWalletReadyForPayment = isWalletExtensionReadyView;
27024
27214
  const isWalletBackHeaderView = activeTab === PAYMENT_TABS.WALLET && showWalletConfirm;
27025
27215
  const isWalletTokenSelectionView = activeTab === PAYMENT_TABS.WALLET && selectedNetwork && !selectedToken && !showWalletConfirm && !(showMobileWalletPicker && isMobile);
@@ -27029,6 +27219,15 @@ const CoinleyPaymentInternal = ({
27029
27219
  setUnderpaymentView("choice");
27030
27220
  return;
27031
27221
  }
27222
+ if (ccResult) {
27223
+ setCcResult(null);
27224
+ setCcQrCode("");
27225
+ setCcPhase("idle");
27226
+ setCcError(null);
27227
+ setCcManualCheckStatus("idle");
27228
+ ccSucceeded.current = false;
27229
+ return;
27230
+ }
27032
27231
  clearUnderpaymentRecovery(paymentData == null ? void 0 : paymentData.id);
27033
27232
  setPaymentData((prev) => {
27034
27233
  if (!prev) return prev;
@@ -27071,15 +27270,19 @@ const CoinleyPaymentInternal = ({
27071
27270
  "transfer-token",
27072
27271
  "qr-network",
27073
27272
  "qr-token",
27074
- "wallet-choice"
27273
+ "wallet-choice",
27274
+ "cross-chain-network",
27275
+ "cross-chain-token"
27075
27276
  ].includes(openCheckoutDropdown);
27076
27277
  return /* @__PURE__ */ jsxs("div", { id: SDK_ROOT_ID, className: `${SDK_ROOT_CLASS} fixed inset-0 z-50`, style: { fontFamily: FONT_FAMILY }, children: [
27077
27278
  /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50", onClick: handleCancel }),
27078
- /* @__PURE__ */ jsx("div", { className: isMobile ? "fixed inset-0 flex items-end" : "fixed inset-0 flex items-center justify-center p-4", style: { zIndex: 51 }, children: /* @__PURE__ */ jsxs("div", { className: isMobile ? "relative bg-white rounded-t-[28px] shadow-2xl w-full max-h-[96vh] overflow-hidden flex flex-col animate-slide-up-sheet" : `relative bg-white rounded-[28px] shadow-2xl w-[430px] ${isTransferAddressGenerated ? "h-[640px]" : "h-[600px]"} max-h-[calc(100vh-32px)] overflow-hidden flex flex-col`, children: [
27079
- /* @__PURE__ */ jsx("span", { className: `pointer-events-none absolute left-[-10px] ${isTransferAddressGenerated ? "top-[36%]" : "top-[44%]"} z-20 h-5 w-5 rounded-full bg-black/50` }),
27080
- /* @__PURE__ */ jsx("span", { className: `pointer-events-none absolute right-[-10px] ${isTransferAddressGenerated ? "top-[36%]" : "top-[44%]"} z-20 h-5 w-5 rounded-full bg-black/50` }),
27279
+ /* @__PURE__ */ jsx("div", { className: isMobile ? "fixed inset-0 flex items-end" : "fixed inset-0 flex items-center justify-center p-4", style: { zIndex: 51 }, children: /* @__PURE__ */ jsxs("div", { className: isMobile ? "coinley-mobile-sheet relative bg-white rounded-t-[24px] shadow-2xl w-full max-h-[96dvh] overflow-hidden flex flex-col animate-slide-up-sheet" : `relative bg-white rounded-[28px] shadow-2xl w-[430px] ${isTransferAddressGenerated ? "h-[640px]" : "h-[600px]"} max-h-[calc(100vh-32px)] overflow-hidden flex flex-col`, children: [
27280
+ !isMobile && /* @__PURE__ */ jsxs(Fragment, { children: [
27281
+ /* @__PURE__ */ jsx("span", { className: `pointer-events-none absolute left-[-10px] ${isTransferAddressGenerated ? "top-[36%]" : "top-[44%]"} z-20 h-5 w-5 rounded-full bg-black/50` }),
27282
+ /* @__PURE__ */ jsx("span", { className: `pointer-events-none absolute right-[-10px] ${isTransferAddressGenerated ? "top-[36%]" : "top-[44%]"} z-20 h-5 w-5 rounded-full bg-black/50` })
27283
+ ] }),
27081
27284
  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" }) }),
27082
- /* @__PURE__ */ jsxs("div", { className: `flex min-h-0 flex-1 flex-col px-4 ${isTightWalletView ? "pb-2 pt-3" : "pb-4 pt-4"}`, children: [
27285
+ /* @__PURE__ */ jsxs("div", { className: `flex min-h-0 flex-1 flex-col ${isMobile ? "px-3" : "px-4"} ${isTightWalletView ? "pb-2 pt-3" : "pb-4 pt-4"}`, children: [
27083
27286
  /* @__PURE__ */ jsxs("div", { className: `${isTightWalletView ? "mb-3" : "mb-5"} flex items-center justify-between`, children: [
27084
27287
  isTransferAddressGenerated || isWalletReadyForPayment || isQrPaymentActiveView || isWalletBackHeaderView || isWalletTokenSelectionView ? /* @__PURE__ */ jsx(
27085
27288
  "button",
@@ -27142,4 +27345,4 @@ export {
27142
27345
  isFeatureEnabled as i,
27143
27346
  logo as l
27144
27347
  };
27145
- //# sourceMappingURL=CoinleyPayment-Cmw8jI0B.js.map
27348
+ //# sourceMappingURL=CoinleyPayment-D8aL6ChX.js.map