@unifold/ui-web 0.1.63 → 0.1.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -43579,6 +43579,40 @@ async function getAddressBalances(address, chainType, publishableKey) {
43579
43579
  const data = await response.json();
43580
43580
  return data;
43581
43581
  }
43582
+ async function getExternalWallets(publishableKey) {
43583
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43584
+ validatePublishableKey(pk);
43585
+ const response = await fetch(`${API_BASE_URL}/v1/public/external_wallets`, {
43586
+ method: "GET",
43587
+ headers: {
43588
+ accept: "application/json",
43589
+ "x-publishable-key": pk
43590
+ }
43591
+ });
43592
+ if (!response.ok) {
43593
+ throw new Error(`Failed to fetch external wallets: ${response.statusText}`);
43594
+ }
43595
+ const data = await response.json();
43596
+ return data;
43597
+ }
43598
+ async function getWalletMobileDeepLink(wallet, depositAddresses, publishableKey) {
43599
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43600
+ validatePublishableKey(pk);
43601
+ const response = await fetch(`${API_BASE_URL}/v1/public/external_wallets/mobile_deeplink`, {
43602
+ method: "POST",
43603
+ headers: {
43604
+ "Content-Type": "application/json",
43605
+ accept: "application/json",
43606
+ "x-publishable-key": pk
43607
+ },
43608
+ body: JSON.stringify({ wallet, deposit_addresses: depositAddresses })
43609
+ });
43610
+ if (!response.ok) {
43611
+ throw new Error(`Failed to generate wallet deep link: ${response.statusText}`);
43612
+ }
43613
+ const data = await response.json();
43614
+ return data;
43615
+ }
43582
43616
  async function getAddressBalance(address, chainType, chainId, tokenAddress, publishableKey) {
43583
43617
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43584
43618
  validatePublishableKey(pk);
@@ -50549,6 +50583,36 @@ function ThemeProvider({
50549
50583
  );
50550
50584
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ThemeContext.Provider, { value: contextValue, children });
50551
50585
  }
50586
+ function AccentColorOverride({
50587
+ accentColor,
50588
+ accentForeground,
50589
+ children
50590
+ }) {
50591
+ const parent = useTheme();
50592
+ const value = React37.useMemo(() => {
50593
+ if (!accentColor) return parent;
50594
+ const foreground = accentForeground ?? parent.colors.primaryForeground;
50595
+ const nextColors = {
50596
+ ...parent.colors,
50597
+ primary: accentColor,
50598
+ primaryForeground: foreground
50599
+ };
50600
+ const nextComponents = {
50601
+ ...parent.components,
50602
+ button: {
50603
+ ...parent.components.button,
50604
+ primaryBackground: accentColor,
50605
+ primaryText: foreground
50606
+ },
50607
+ card: {
50608
+ ...parent.components.card,
50609
+ iconBackgroundColor: `${accentColor}26`
50610
+ }
50611
+ };
50612
+ return { ...parent, colors: nextColors, components: nextComponents };
50613
+ }, [parent, accentColor, accentForeground]);
50614
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ThemeContext.Provider, { value, children });
50615
+ }
50552
50616
  function useTheme() {
50553
50617
  const context = React37.useContext(ThemeContext);
50554
50618
  if (!context) {
@@ -51600,6 +51664,7 @@ function useDepositPolling({
51600
51664
  clientSecret,
51601
51665
  depositConfirmationMode = "auto_ui",
51602
51666
  depositWalletId,
51667
+ depositWalletIds,
51603
51668
  enabled = true,
51604
51669
  immediateDirectPolling = false,
51605
51670
  onDepositSuccess,
@@ -51745,21 +51810,25 @@ function useDepositPolling({
51745
51810
  setIsPolling(false);
51746
51811
  };
51747
51812
  }, [userId, publishableKey, clientSecret, enabled]);
51813
+ const pollWalletIdsKey = depositWalletIds && depositWalletIds.length > 0 ? Array.from(new Set(depositWalletIds.filter(Boolean))).join(",") : depositWalletId || "";
51748
51814
  (0, import_react10.useEffect)(() => {
51749
- if (!pollingEnabled || !depositWalletId) return;
51815
+ if (!pollingEnabled || !pollWalletIdsKey) return;
51816
+ const ids = pollWalletIdsKey.split(",").filter(Boolean);
51750
51817
  const triggerPoll = async () => {
51751
- try {
51752
- await pollDirectExecutions(
51753
- { deposit_wallet_id: depositWalletId },
51754
- publishableKey
51755
- );
51756
- } catch {
51757
- }
51818
+ await Promise.all(
51819
+ ids.map(
51820
+ (id) => pollDirectExecutions(
51821
+ { deposit_wallet_id: id },
51822
+ publishableKey
51823
+ ).catch(() => {
51824
+ })
51825
+ )
51826
+ );
51758
51827
  };
51759
51828
  triggerPoll();
51760
51829
  const interval = setInterval(triggerPoll, POLL_ENDPOINT_INTERVAL_MS);
51761
51830
  return () => clearInterval(interval);
51762
- }, [pollingEnabled, depositWalletId, publishableKey]);
51831
+ }, [pollingEnabled, pollWalletIdsKey, publishableKey]);
51763
51832
  const handleIveDeposited = () => {
51764
51833
  setPollingEnabled(true);
51765
51834
  setShowWaitingUi(true);
@@ -52948,6 +53017,7 @@ function BuyWithCard({
52948
53017
  if (!selectedProvider) return "0.000000";
52949
53018
  return selectedProvider.destination_amount.toFixed(6);
52950
53019
  };
53020
+ const canOpenProviderSelector = !quotesLoading && quotes.length > 1;
52951
53021
  const selectedCurrencyData = fiatCurrencies.find(
52952
53022
  (c) => c.currency_code.toLowerCase() === currency.toLowerCase()
52953
53023
  );
@@ -53133,9 +53203,12 @@ function BuyWithCard({
53133
53203
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
53134
53204
  "button",
53135
53205
  {
53136
- onClick: () => handleViewChange("quotes"),
53206
+ onClick: () => {
53207
+ if (canOpenProviderSelector) handleViewChange("quotes");
53208
+ },
53137
53209
  disabled: quotesLoading || quotes.length === 0,
53138
- className: "uf-w-full hover:uf-bg-accent uf-transition-colors uf-p-4 uf-group disabled:uf-opacity-50 disabled:uf-cursor-not-allowed",
53210
+ "aria-disabled": !canOpenProviderSelector,
53211
+ className: `uf-w-full uf-transition-colors uf-p-4 uf-group disabled:uf-opacity-50 disabled:uf-cursor-not-allowed ${canOpenProviderSelector ? "hover:uf-bg-accent uf-cursor-pointer" : "uf-cursor-default"}`,
53139
53212
  style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` },
53140
53213
  children: quotesLoading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "uf-text-left uf-w-full uf-animate-pulse", children: [
53141
53214
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -53162,7 +53235,7 @@ function BuyWithCard({
53162
53235
  )
53163
53236
  ] })
53164
53237
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "uf-w-full uf-text-left", children: [
53165
- isAutoSelected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
53238
+ isAutoSelected && canOpenProviderSelector && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
53166
53239
  "div",
53167
53240
  {
53168
53241
  className: "uf-text-xs uf-font-normal uf-mb-2",
@@ -53198,7 +53271,7 @@ function BuyWithCard({
53198
53271
  ),
53199
53272
  selectedProvider.low_kyc === false && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "uf-text-[10px] uf-text-muted-foreground uf-font-normal", children: "No document upload" }) })
53200
53273
  ] }),
53201
- quotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
53274
+ canOpenProviderSelector && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
53202
53275
  ChevronRight,
53203
53276
  {
53204
53277
  className: "uf-w-4 uf-h-4 group-hover:uf-text-foreground uf-transition-colors uf-flex-shrink-0",
@@ -62174,6 +62247,60 @@ function useDepositQuote(params) {
62174
62247
  retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 5e3)
62175
62248
  });
62176
62249
  }
62250
+ function useExternalWallets({
62251
+ publishableKey,
62252
+ enabled = true
62253
+ }) {
62254
+ const { data: wallets = [], isLoading } = useQuery({
62255
+ queryKey: ["unifold", "external-wallets", publishableKey],
62256
+ queryFn: () => getExternalWallets(publishableKey).then((res) => res.data),
62257
+ enabled: enabled && !!publishableKey,
62258
+ staleTime: 1e3 * 60 * 30,
62259
+ refetchOnMount: false,
62260
+ refetchOnWindowFocus: false
62261
+ });
62262
+ return { wallets, isLoading };
62263
+ }
62264
+ var WALLET_BRAND_COLORS = {
62265
+ phantom: "#AB9FF2",
62266
+ metamask: "#F6851B",
62267
+ coinbase: "#0052FF",
62268
+ trust: "#3375BB",
62269
+ rainbow: "#5B6CFF",
62270
+ rabby: "#7084FF",
62271
+ okx: "#000000"
62272
+ };
62273
+ function normalizeWalletId(type) {
62274
+ return type.replace(/-(ethereum|solana)$/i, "").toLowerCase();
62275
+ }
62276
+ function getWalletBrandColor(type, mode = "dark") {
62277
+ if (!type) return void 0;
62278
+ const id = normalizeWalletId(type);
62279
+ const color = WALLET_BRAND_COLORS[id];
62280
+ if (!color) return void 0;
62281
+ if (id === "okx") return mode === "dark" ? "#FFFFFF" : "#111111";
62282
+ return color;
62283
+ }
62284
+ function getContrastingTextColor(hex) {
62285
+ const c = hex.replace("#", "");
62286
+ if (c.length !== 6) return "#FFFFFF";
62287
+ const r2 = parseInt(c.slice(0, 2), 16);
62288
+ const g = parseInt(c.slice(2, 4), 16);
62289
+ const b = parseInt(c.slice(4, 6), 16);
62290
+ const luminance = (0.299 * r2 + 0.587 * g + 0.114 * b) / 255;
62291
+ return luminance > 0.6 ? "#13111C" : "#FFFFFF";
62292
+ }
62293
+ function isMobileDevice() {
62294
+ if (typeof navigator === "undefined") return false;
62295
+ return /android|iphone|ipad|ipod|mobile/i.test(navigator.userAgent);
62296
+ }
62297
+ function getMobilePlatform() {
62298
+ if (typeof navigator === "undefined") return null;
62299
+ const ua = navigator.userAgent;
62300
+ if (/iphone|ipad|ipod/i.test(ua)) return "ios";
62301
+ if (/android/i.test(ua)) return "android";
62302
+ return null;
62303
+ }
62177
62304
  var WALLET_ICONS = {
62178
62305
  metamask: MetamaskIcon,
62179
62306
  phantom: PhantomIcon,
@@ -63179,18 +63306,33 @@ var WALLET_ICONS3 = {
63179
63306
  backpack: BackpackIcon,
63180
63307
  glow: GlowIcon
63181
63308
  };
63182
- var WALLET_DEFINITIONS = [
63183
- { id: "phantom", name: "Phantom", networks: ["ethereum", "solana"], installUrl: "https://phantom.app/" },
63184
- { id: "coinbase", name: "Coinbase Wallet", networks: ["ethereum", "solana"], installUrl: "https://www.coinbase.com/wallet" },
63185
- { id: "trust", name: "Trust Wallet", networks: ["ethereum", "solana"], installUrl: "https://trustwallet.com/" },
63186
- { id: "metamask", name: "MetaMask", networks: ["ethereum"], installUrl: "https://metamask.io/download/" },
63187
- { id: "rainbow", name: "Rainbow", networks: ["ethereum"], installUrl: "https://rainbow.me/" },
63188
- { id: "rabby", name: "Rabby", networks: ["ethereum"], installUrl: "https://rabby.io/" },
63189
- { id: "okx", name: "OKX Wallet", networks: ["ethereum"], installUrl: "https://www.okx.com/web3" },
63190
- { id: "solflare", name: "Solflare", networks: ["solana"], installUrl: "https://solflare.com/" },
63191
- { id: "backpack", name: "Backpack", networks: ["solana"], installUrl: "https://backpack.app/" },
63192
- { id: "glow", name: "Glow", networks: ["solana"], installUrl: "https://glow.app/" }
63309
+ var FALLBACK_WALLET_DEFINITIONS = [
63310
+ { id: "phantom", name: "Phantom", networks: ["ethereum", "solana"], installUrl: "https://phantom.app/", supportsMobileBrowse: true },
63311
+ { id: "coinbase", name: "Coinbase Wallet", networks: ["ethereum", "solana"], installUrl: "https://www.coinbase.com/wallet", supportsMobileBrowse: true },
63312
+ { id: "trust", name: "Trust Wallet", networks: ["ethereum", "solana"], installUrl: "https://trustwallet.com/", supportsMobileBrowse: true },
63313
+ { id: "metamask", name: "MetaMask", networks: ["ethereum"], installUrl: "https://metamask.io/download/", supportsMobileBrowse: true },
63314
+ { id: "rainbow", name: "Rainbow", networks: ["ethereum"], installUrl: "https://rainbow.me/", supportsMobileBrowse: true },
63315
+ { id: "rabby", name: "Rabby", networks: ["ethereum"], installUrl: "https://apps.apple.com/app/rabby-wallet/id6450663781", supportsMobileBrowse: true },
63316
+ { id: "okx", name: "OKX Wallet", networks: ["ethereum"], installUrl: "https://www.okx.com/web3", supportsMobileBrowse: true, mobileBrowsePlatforms: ["ios"] }
63193
63317
  ];
63318
+ function getMobileInstallUrl(walletId, defaultUrl) {
63319
+ if (!isMobileDevice()) return defaultUrl;
63320
+ const ua = typeof navigator !== "undefined" ? navigator.userAgent : "";
63321
+ const isIOS = /iPhone|iPad|iPod/i.test(ua);
63322
+ const stores = {
63323
+ rabby: {
63324
+ ios: "https://apps.apple.com/app/rabby-wallet/id6450663781",
63325
+ android: "https://play.google.com/store/apps/details?id=com.debank.rabbymobile"
63326
+ },
63327
+ glow: {
63328
+ ios: "https://apps.apple.com/us/app/glow-solana-wallet/id1599584512",
63329
+ android: "https://play.google.com/store/apps/details?id=com.luma.wallet.prod"
63330
+ }
63331
+ };
63332
+ const entry = stores[walletId];
63333
+ if (!entry) return defaultUrl;
63334
+ return isIOS ? entry.ios : entry.android;
63335
+ }
63194
63336
  function normalizeTokenAddress(address) {
63195
63337
  const normalized = (address ?? "").toLowerCase();
63196
63338
  if (normalized === "" || normalized === "native" || normalized === "0x0000000000000000000000000000000000000000") {
@@ -63226,7 +63368,7 @@ function getLegacyEvmProviders() {
63226
63368
  okxEthereum: win.okxwallet
63227
63369
  };
63228
63370
  }
63229
- function detectAvailableWallets(filterChainType) {
63371
+ function detectAvailableWallets(definitions, filterChainType) {
63230
63372
  const solProviders = getSolanaProviders();
63231
63373
  const legacyEvm = getLegacyEvmProviders();
63232
63374
  const eip6963List = getEip6963Providers();
@@ -63252,7 +63394,7 @@ function detectAvailableWallets(filterChainType) {
63252
63394
  return false;
63253
63395
  }
63254
63396
  });
63255
- return WALLET_DEFINITIONS.filter((w) => !filterChainType || w.networks.includes(filterChainType)).map((wallet) => {
63397
+ return definitions.filter((w) => !filterChainType || w.networks.includes(filterChainType)).map((wallet) => {
63256
63398
  let isInstalled = false;
63257
63399
  const detectedNetworks = [];
63258
63400
  switch (wallet.id) {
@@ -63356,7 +63498,7 @@ function WalletConnect({
63356
63498
  depositWalletsLoading = false,
63357
63499
  onExecutionsChange
63358
63500
  }) {
63359
- const { colors: colors2, fonts, components } = useTheme();
63501
+ const { colors: colors2, fonts, components, mode } = useTheme();
63360
63502
  const walletProvidedAtMount = React302.useRef(!!initialWalletInfo && !!initialDepositWallet);
63361
63503
  const [activeWalletInfo, setActiveWalletInfo] = React302.useState(initialWalletInfo ?? null);
63362
63504
  const [activeDepositWallet, setActiveDepositWallet] = React302.useState(initialDepositWallet ?? null);
@@ -63380,7 +63522,37 @@ function WalletConnect({
63380
63522
  setEip6963ProviderCount(providers.length);
63381
63523
  });
63382
63524
  }, []);
63383
- const availableWallets = React302.useMemo(() => detectAvailableWallets(), [eip6963ProviderCount]);
63525
+ const { wallets: backendWallets } = useExternalWallets({ publishableKey });
63526
+ const walletDefinitions = React302.useMemo(
63527
+ () => backendWallets.length > 0 ? backendWallets.map((w) => ({
63528
+ id: w.id,
63529
+ name: w.name,
63530
+ networks: w.chain_types,
63531
+ installUrl: w.install_url,
63532
+ supportsMobileBrowse: w.supports_mobile_browse,
63533
+ mobileBrowsePlatforms: w.mobile_browse_platforms ?? null
63534
+ })) : FALLBACK_WALLET_DEFINITIONS,
63535
+ [backendWallets]
63536
+ );
63537
+ const availableWallets = React302.useMemo(
63538
+ () => detectAvailableWallets(walletDefinitions),
63539
+ [walletDefinitions, eip6963ProviderCount]
63540
+ );
63541
+ const [isMobile, setIsMobile] = React302.useState(false);
63542
+ React302.useEffect(() => {
63543
+ setIsMobile(isMobileDevice());
63544
+ }, []);
63545
+ const mobileDepositAddresses = React302.useMemo(
63546
+ () => (depositWallets ?? []).map((w) => ({ chain_type: w.chain_type, address: w.address })),
63547
+ [depositWallets]
63548
+ );
63549
+ const mobileDepositWalletIds = React302.useMemo(
63550
+ () => (depositWallets ?? []).filter((w) => w.chain_type === "ethereum" || w.chain_type === "solana").map((w) => w.id),
63551
+ [depositWallets]
63552
+ );
63553
+ const [mobileRedirect, setMobileRedirect] = React302.useState(null);
63554
+ const [pendingMobileWallet, setPendingMobileWallet] = React302.useState(null);
63555
+ const [awaitingMobileDeposit, setAwaitingMobileDeposit] = React302.useState(false);
63384
63556
  React302.useEffect(() => {
63385
63557
  if (!standalone || autoResolved || detectingWallet) return;
63386
63558
  if (!detectedWallet) {
@@ -63439,9 +63611,36 @@ function WalletConnect({
63439
63611
  transform: isTransitioning ? "translateY(4px)" : "translateY(0)",
63440
63612
  transition: "opacity 150ms ease, transform 150ms ease"
63441
63613
  };
63442
- const handleWalletClick = (wallet) => {
63614
+ const openMobileWalletBrowse = async (wallet, depositAddresses) => {
63615
+ try {
63616
+ const res = await getWalletMobileDeepLink(
63617
+ wallet.id,
63618
+ depositAddresses,
63619
+ publishableKey
63620
+ );
63621
+ if (res.deeplink) {
63622
+ setMobileRedirect({ walletId: wallet.id, walletName: wallet.name, deeplink: res.deeplink });
63623
+ setAwaitingMobileDeposit(true);
63624
+ transitionTo("mobile_redirect");
63625
+ window.location.href = res.deeplink;
63626
+ return true;
63627
+ }
63628
+ } catch {
63629
+ }
63630
+ return false;
63631
+ };
63632
+ const handleWalletClick = async (wallet) => {
63443
63633
  if (!wallet.isInstalled) {
63444
- window.open(wallet.installUrl, "_blank", "noopener,noreferrer");
63634
+ const platform2 = getMobilePlatform();
63635
+ const platformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(platform2 ?? "");
63636
+ if (isMobileDevice() && wallet.supportsMobileBrowse !== false && platformAllowed) {
63637
+ if (mobileDepositAddresses.length === 0) {
63638
+ setPendingMobileWallet(wallet);
63639
+ return;
63640
+ }
63641
+ if (await openMobileWalletBrowse(wallet, mobileDepositAddresses)) return;
63642
+ }
63643
+ window.open(getMobileInstallUrl(wallet.id, wallet.installUrl), "_blank", "noopener,noreferrer");
63445
63644
  return;
63446
63645
  }
63447
63646
  setSelectedWalletDef(wallet);
@@ -63457,6 +63656,27 @@ function WalletConnect({
63457
63656
  if (!selectedWalletDef) return;
63458
63657
  handleConnectWallet(selectedWalletDef, network);
63459
63658
  };
63659
+ React302.useEffect(() => {
63660
+ if (!pendingMobileWallet) return;
63661
+ if (mobileDepositAddresses.length > 0) {
63662
+ const wallet = pendingMobileWallet;
63663
+ setPendingMobileWallet(null);
63664
+ void (async () => {
63665
+ if (!await openMobileWalletBrowse(wallet, mobileDepositAddresses)) {
63666
+ window.open(getMobileInstallUrl(wallet.id, wallet.installUrl), "_blank", "noopener,noreferrer");
63667
+ }
63668
+ })();
63669
+ return;
63670
+ }
63671
+ const timeout = setTimeout(() => {
63672
+ setPendingMobileWallet((current) => {
63673
+ if (!current) return null;
63674
+ window.open(getMobileInstallUrl(current.id, current.installUrl), "_blank", "noopener,noreferrer");
63675
+ return null;
63676
+ });
63677
+ }, 8e3);
63678
+ return () => clearTimeout(timeout);
63679
+ }, [pendingMobileWallet, mobileDepositAddresses]);
63460
63680
  const handleConnectWallet = async (wallet, network) => {
63461
63681
  setConnectingNetwork(network);
63462
63682
  transitionTo("connecting");
@@ -63601,14 +63821,32 @@ function WalletConnect({
63601
63821
  userId,
63602
63822
  publishableKey,
63603
63823
  clientSecret,
63824
+ // In-tab flow: poll the single connected deposit wallet.
63604
63825
  depositWalletId: activeDepositWallet?.id ?? "",
63605
- enabled: hasSignedTransaction && !!activeDepositWallet,
63826
+ // Mobile redirect flow: the deposit chain isn't known up front, so /poll every
63827
+ // chain's deposit wallet. Detection still happens via the single /query by
63828
+ // external_user_id, which already spans all chains.
63829
+ depositWalletIds: awaitingMobileDeposit ? mobileDepositWalletIds : void 0,
63830
+ enabled: hasSignedTransaction && !!activeDepositWallet || awaitingMobileDeposit,
63606
63831
  onDepositSuccess,
63607
63832
  onDepositError
63608
63833
  });
63609
63834
  React302.useEffect(() => {
63610
63835
  onExecutionsChange?.(depositExecutions);
63611
63836
  }, [depositExecutions, onExecutionsChange]);
63837
+ const latestDepositExecution = React302.useMemo(() => {
63838
+ if (depositExecutions.length === 0) return null;
63839
+ return [...depositExecutions].sort((a, b) => {
63840
+ const ta = a.created_at ? new Date(a.created_at).getTime() : 0;
63841
+ const tb = b.created_at ? new Date(b.created_at).getTime() : 0;
63842
+ return tb - ta;
63843
+ })[0];
63844
+ }, [depositExecutions]);
63845
+ React302.useEffect(() => {
63846
+ if (awaitingMobileDeposit && latestDepositExecution && (viewRef.current === "mobile_redirect" || viewRef.current === "connecting")) {
63847
+ transitionTo("mobile_deposit_status");
63848
+ }
63849
+ }, [awaitingMobileDeposit, latestDepositExecution, transitionTo]);
63612
63850
  React302.useEffect(() => {
63613
63851
  if (!prefillAmountUsd || !tokenChainDetails || view !== "enter_amount") return;
63614
63852
  const minDeposit = tokenChainDetails.minimum_deposit_amount_usd || 0;
@@ -63739,6 +63977,16 @@ function WalletConnect({
63739
63977
  setSelectedWalletDef(null);
63740
63978
  setConnectingNetwork(null);
63741
63979
  break;
63980
+ case "mobile_redirect":
63981
+ transitionTo("select_wallet");
63982
+ setMobileRedirect(null);
63983
+ setAwaitingMobileDeposit(false);
63984
+ break;
63985
+ case "mobile_deposit_status":
63986
+ transitionTo("select_wallet");
63987
+ setMobileRedirect(null);
63988
+ setAwaitingMobileDeposit(false);
63989
+ break;
63742
63990
  case "select_token":
63743
63991
  if (walletProvidedAtMount.current) parentOnBack?.();
63744
63992
  else transitionTo("select_wallet");
@@ -63924,33 +64172,40 @@ function WalletConnect({
63924
64172
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: viewTransitionStyle, children: [
63925
64173
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DepositHeader, { title: "Connect Wallet", showBack: canGoBack, onBack: handleBack, onClose }),
63926
64174
  /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-pb-4", children: [
63927
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "uf-text-sm uf-text-center uf-pb-4", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: "Select a wallet to connect" }),
63928
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-space-y-2", style: { maxHeight: 330, overflowY: "auto" }, children: availableWallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
63929
- "button",
63930
- {
63931
- onClick: () => handleWalletClick(wallet),
63932
- disabled: isWalletConnecting,
63933
- className: "uf-w-full uf-transition-colors uf-p-3 uf-flex uf-items-center uf-justify-between hover:uf-opacity-90 disabled:uf-opacity-50",
63934
- style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` },
63935
- children: [
63936
- /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
63937
- WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(WalletIconWithNetwork, { WalletIcon: WALLET_ICONS3[wallet.id], networks: wallet.networks, size: 40, className: "uf-rounded-lg" }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
63938
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-text-sm uf-font-medium", style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: wallet.name })
63939
- ] }),
63940
- wallet.isInstalled ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "uf-text-xs uf-px-2 uf-py-1 uf-rounded-full", style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium }, children: "Detected" }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
63941
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: "Install" }),
63942
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ExternalLink, { className: "uf-w-3 uf-h-3", style: { color: colors2.foregroundMuted } })
63943
- ] })
63944
- ]
63945
- },
63946
- wallet.id
63947
- )) }),
64175
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "uf-text-sm uf-text-center uf-pb-4", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: isMobile ? "Open this page in your wallet's app to connect" : "Select a wallet to connect" }),
64176
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-space-y-2", style: { maxHeight: 330, overflowY: "auto" }, children: availableWallets.map((wallet) => {
64177
+ const walletPlatformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
64178
+ const showOpenInApp = isMobile && !wallet.isInstalled && wallet.supportsMobileBrowse !== false && walletPlatformAllowed;
64179
+ const isPending = pendingMobileWallet?.id === wallet.id;
64180
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
64181
+ "button",
64182
+ {
64183
+ onClick: () => void handleWalletClick(wallet),
64184
+ disabled: isWalletConnecting || !!pendingMobileWallet,
64185
+ className: "uf-w-full uf-transition-colors uf-p-3 uf-flex uf-items-center uf-justify-between hover:uf-opacity-90 disabled:uf-opacity-50",
64186
+ style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` },
64187
+ children: [
64188
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
64189
+ WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(WalletIconWithNetwork, { WalletIcon: WALLET_ICONS3[wallet.id], networks: wallet.networks, size: 40, className: "uf-rounded-lg" }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
64190
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-text-sm uf-font-medium", style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: wallet.name })
64191
+ ] }),
64192
+ isPending ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin", style: { color: colors2.primary } }) : wallet.isInstalled ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "uf-text-xs uf-px-2 uf-py-1 uf-rounded-full", style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium }, children: "Detected" }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
64193
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: showOpenInApp ? "Open" : "Install" }),
64194
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ExternalLink, { className: "uf-w-3 uf-h-3", style: { color: colors2.foregroundMuted } })
64195
+ ] })
64196
+ ]
64197
+ },
64198
+ wallet.id
64199
+ );
64200
+ }) }),
63948
64201
  walletError && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-text-center uf-text-sm uf-mt-4 uf-px-4", style: { color: "#ef4444" }, children: walletError })
63949
64202
  ] })
63950
64203
  ] });
63951
64204
  }
64205
+ const preConnectAccent = selectedWalletDef ? getWalletBrandColor(selectedWalletDef.id, mode) : void 0;
64206
+ const preConnectFg = preConnectAccent ? getContrastingTextColor(preConnectAccent) : void 0;
63952
64207
  if (view === "select_network" && selectedWalletDef) {
63953
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: viewTransitionStyle, children: [
64208
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: viewTransitionStyle, children: [
63954
64209
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DepositHeader, { title: "Select Network", showBack: true, onBack: handleBack, onClose }),
63955
64210
  /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-pb-4", children: [
63956
64211
  /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-pb-4", children: [
@@ -63980,10 +64235,10 @@ function WalletConnect({
63980
64235
  )) }),
63981
64236
  walletError && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-text-center uf-text-sm uf-mt-4 uf-px-4", style: { color: "#ef4444" }, children: walletError })
63982
64237
  ] })
63983
- ] });
64238
+ ] }) });
63984
64239
  }
63985
64240
  if (view === "connecting") {
63986
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: viewTransitionStyle, children: [
64241
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: viewTransitionStyle, children: [
63987
64242
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DepositHeader, { title: "Connecting...", showBack: true, onBack: handleBack, onClose }),
63988
64243
  /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-16", children: [
63989
64244
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(LoaderCircle, { className: "uf-w-12 uf-h-12 uf-animate-spin uf-mb-4", style: { color: colors2.primary } }),
@@ -63994,24 +64249,132 @@ function WalletConnect({
63994
64249
  ] }),
63995
64250
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-text-sm uf-mt-2", style: { color: colors2.foregroundMuted }, children: "Please approve the connection in your wallet" })
63996
64251
  ] })
63997
- ] });
64252
+ ] }) });
64253
+ }
64254
+ if (view === "mobile_redirect" && mobileRedirect) {
64255
+ const Icon22 = WALLET_ICONS3[mobileRedirect.walletId];
64256
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: viewTransitionStyle, children: [
64257
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DepositHeader, { title: mobileRedirect.walletName, showBack: true, onBack: handleBack, onClose }),
64258
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-px-6 uf-py-10", children: [
64259
+ Icon22 ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Icon22, { size: 64, className: "uf-rounded-2xl uf-mb-5" }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-w-16 uf-h-16 uf-rounded-2xl uf-bg-gray-500 uf-mb-5" }),
64260
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
64261
+ "div",
64262
+ {
64263
+ className: "uf-text-base uf-font-medium uf-text-center uf-mb-1",
64264
+ style: { color: colors2.foreground, fontFamily: fonts.medium },
64265
+ children: [
64266
+ "Continue in ",
64267
+ mobileRedirect.walletName
64268
+ ]
64269
+ }
64270
+ ),
64271
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
64272
+ "div",
64273
+ {
64274
+ className: "uf-text-sm uf-text-center uf-mb-6",
64275
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
64276
+ children: [
64277
+ "Complete your deposit in the ",
64278
+ mobileRedirect.walletName,
64279
+ " app"
64280
+ ]
64281
+ }
64282
+ ),
64283
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
64284
+ "button",
64285
+ {
64286
+ type: "button",
64287
+ onClick: () => {
64288
+ window.location.href = mobileRedirect.deeplink;
64289
+ },
64290
+ className: "uf-w-full uf-transition-colors uf-p-3.5 uf-flex uf-items-center uf-justify-center uf-gap-2 hover:uf-opacity-90",
64291
+ style: {
64292
+ backgroundColor: components.card.backgroundColor,
64293
+ borderRadius: components.card.borderRadius,
64294
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`,
64295
+ color: components.card.titleColor,
64296
+ fontFamily: fonts.medium
64297
+ },
64298
+ children: [
64299
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ExternalLink, { className: "uf-w-4 uf-h-4", style: { color: components.card.iconColor } }),
64300
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "uf-text-sm uf-font-medium", children: [
64301
+ "Open in ",
64302
+ mobileRedirect.walletName
64303
+ ] })
64304
+ ]
64305
+ }
64306
+ ),
64307
+ awaitingMobileDeposit && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-center uf-gap-2 uf-mt-6", children: [
64308
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
64309
+ LoaderCircle,
64310
+ {
64311
+ className: "uf-w-4 uf-h-4 uf-animate-spin",
64312
+ style: { color: colors2.foregroundMuted }
64313
+ }
64314
+ ),
64315
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
64316
+ "span",
64317
+ {
64318
+ className: "uf-text-sm",
64319
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
64320
+ children: "Checking for deposit..."
64321
+ }
64322
+ )
64323
+ ] })
64324
+ ] })
64325
+ ] }) });
64326
+ }
64327
+ if (view === "mobile_deposit_status" && latestDepositExecution) {
64328
+ const isComplete = latestDepositExecution.status === ExecutionStatus.SUCCEEDED;
64329
+ const isFailed = latestDepositExecution.status === ExecutionStatus.FAILED;
64330
+ const title = isComplete ? "Payment Complete" : isFailed ? "Payment Failed" : "Payment Processing";
64331
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: viewTransitionStyle, children: [
64332
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
64333
+ DepositHeader,
64334
+ {
64335
+ title,
64336
+ showBack: false,
64337
+ onClose: isComplete && onDone ? onDone : onClose
64338
+ }
64339
+ ),
64340
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DepositDetailContent, { execution: latestDepositExecution }),
64341
+ isComplete && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-flex uf-gap-2 uf-px-2 uf-pt-4 uf-pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
64342
+ "button",
64343
+ {
64344
+ type: "button",
64345
+ onClick: onDone ? onDone : onNewDeposit ? onNewDeposit : onClose ?? (() => {
64346
+ }),
64347
+ className: "uf-flex-1 uf-py-4 uf-text-sm uf-font-medium uf-transition-opacity hover:uf-opacity-80",
64348
+ style: {
64349
+ backgroundColor: colors2.primary,
64350
+ color: colors2.primaryForeground,
64351
+ fontFamily: fonts.medium,
64352
+ borderRadius: components.button.borderRadius,
64353
+ border: `${components.button.borderWidth}px solid ${components.button.borderColor}`
64354
+ },
64355
+ children: "Done"
64356
+ }
64357
+ ) })
64358
+ ] }) });
63998
64359
  }
63999
64360
  if (!hasWallet) return null;
64361
+ const walletAccent = getWalletBrandColor(walletInfo.type, mode);
64362
+ const walletAccentForeground = walletAccent ? getContrastingTextColor(walletAccent) : void 0;
64000
64363
  if (view === "select_token") {
64001
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(SelectTokenView, { walletInfo, projectName, assetCdnUrl, balances, isLoading, error, selectedBalance, totalBalanceUsd, onTokenSelect: handleTokenSelect, onContinue: handleContinueToAmount, onBack: handleBack, onClose: onClose ?? (() => {
64002
- }), onDisconnectWallet: onWalletDisconnect ? () => void handleDisconnect() : void 0, isDisconnectingWallet, checkoutAmountUsd, checkoutReceivedUsd }) });
64364
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(SelectTokenView, { walletInfo, projectName, assetCdnUrl, balances, isLoading, error, selectedBalance, totalBalanceUsd, onTokenSelect: handleTokenSelect, onContinue: handleContinueToAmount, onBack: handleBack, onClose: onClose ?? (() => {
64365
+ }), onDisconnectWallet: onWalletDisconnect ? () => void handleDisconnect() : void 0, isDisconnectingWallet, checkoutAmountUsd, checkoutReceivedUsd }) }) });
64003
64366
  }
64004
64367
  if (view === "enter_amount" && selectedToken && selectedBalance) {
64005
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(EnterAmountView, { walletInfo, selectedBalance, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, inputUsdNum, maxUsdAmount, isValidAmount, error, onAmountChange: setAmountUsd, onMaxClick: handleMaxClick, onReview: handleReview, onBack: handleBack, onClose: onClose ?? (() => {
64006
- }), quickSelectMode: amountQuickSelect, checkoutAmountUsd, checkoutReceivedUsd }) });
64368
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(EnterAmountView, { walletInfo, selectedBalance, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, inputUsdNum, maxUsdAmount, isValidAmount, error, onAmountChange: setAmountUsd, onMaxClick: handleMaxClick, onReview: handleReview, onBack: handleBack, onClose: onClose ?? (() => {
64369
+ }), quickSelectMode: amountQuickSelect, checkoutAmountUsd, checkoutReceivedUsd }) }) });
64007
64370
  }
64008
64371
  if (view === "review" && selectedToken) {
64009
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ReviewView, { walletInfo, recipientAddress, assetCdnUrl, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, loadingTokenDetails, showTransactionDetails, isConfirming, error, onToggleDetails: () => setShowTransactionDetails(!showTransactionDetails), onConfirm: handleConfirm, onBack: handleBack, onClose: onClose ?? (() => {
64010
- }) }) });
64372
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ReviewView, { walletInfo, recipientAddress, assetCdnUrl, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, loadingTokenDetails, showTransactionDetails, isConfirming, error, onToggleDetails: () => setShowTransactionDetails(!showTransactionDetails), onConfirm: handleConfirm, onBack: handleBack, onClose: onClose ?? (() => {
64373
+ }) }) }) });
64011
64374
  }
64012
64375
  if (view === "confirming") {
64013
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ConfirmingView, { isConfirming, onClose: onClose ?? (() => {
64014
- }), executions: depositExecutions, isPolling, onNewDeposit, onDone, paymentIntentStatus, amountReceivedUsd: checkoutReceivedUsd, amountReceivedUsdAtSubmission: receivedUsdAtSubmission }) });
64376
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ConfirmingView, { isConfirming, onClose: onClose ?? (() => {
64377
+ }), executions: depositExecutions, isPolling, onNewDeposit, onDone, paymentIntentStatus, amountReceivedUsd: checkoutReceivedUsd, amountReceivedUsdAtSubmission: receivedUsdAtSubmission }) }) });
64015
64378
  }
64016
64379
  return null;
64017
64380
  }
@@ -64123,7 +64486,6 @@ function DepositModal({
64123
64486
  const [allExecutions, setAllExecutions] = (0, import_react3.useState)([]);
64124
64487
  const [selectedExecution, setSelectedExecution] = (0, import_react3.useState)(null);
64125
64488
  const [depositExecutions, setDepositExecutions] = (0, import_react3.useState)([]);
64126
- const isMobileView = useIsMobileViewport();
64127
64489
  const { projectConfig } = useProjectConfig({
64128
64490
  publishableKey,
64129
64491
  enabled: open
@@ -64519,7 +64881,7 @@ function DepositModal({
64519
64881
  open: hideOverlay || open,
64520
64882
  onOpenChange: hideOverlay ? void 0 : handleClose,
64521
64883
  modal: !hideOverlay,
64522
- children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64884
+ children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
64523
64885
  DialogContent2,
64524
64886
  {
64525
64887
  ref: hideOverlay ? containerCallbackRef : void 0,
@@ -64528,386 +64890,389 @@ function DepositModal({
64528
64890
  style: { backgroundColor: colors2.background },
64529
64891
  onPointerDownOutside: (e) => e.preventDefault(),
64530
64892
  onInteractOutside: (e) => e.preventDefault(),
64531
- children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ThemeStyleInjector, { children: view === "main" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64532
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64533
- DepositHeader,
64534
- {
64535
- title: modalTitle || "Deposit",
64536
- showClose: !hideOverlay,
64537
- onClose: handleClose,
64538
- showBalance: showBalanceHeader,
64539
- balanceAddress: recipientAddress,
64540
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
64541
- balanceChainId: destinationChainId,
64542
- balanceTokenAddress: destinationTokenAddress,
64543
- projectName: projectConfig?.project_name,
64544
- publishableKey
64545
- }
64546
- ),
64547
- /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64548
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-space-y-3", children: depositPrerequisiteBody ?? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64549
- showTransferCrypto && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64550
- TransferCryptoButton,
64551
- {
64552
- onClick: () => setView("transfer"),
64553
- title: transferCryptoTitle,
64554
- subtitle: t7.transferCrypto.subtitle,
64555
- featuredTokens: projectConfig?.transfer_crypto.networks
64556
- }
64557
- ),
64558
- showConnectWallet && !isMobileView && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64559
- BrowserWalletButton,
64893
+ children: [
64894
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DialogTitle2, { className: "uf-sr-only", children: modalTitle || "Deposit" }),
64895
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ThemeStyleInjector, { children: view === "main" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64896
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64897
+ DepositHeader,
64898
+ {
64899
+ title: modalTitle || "Deposit",
64900
+ showClose: !hideOverlay,
64901
+ onClose: handleClose,
64902
+ showBalance: showBalanceHeader,
64903
+ balanceAddress: recipientAddress,
64904
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
64905
+ balanceChainId: destinationChainId,
64906
+ balanceTokenAddress: destinationTokenAddress,
64907
+ projectName: projectConfig?.project_name,
64908
+ publishableKey
64909
+ }
64910
+ ),
64911
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64912
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-space-y-3", children: depositPrerequisiteBody ?? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64913
+ showTransferCrypto && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64914
+ TransferCryptoButton,
64915
+ {
64916
+ onClick: () => setView("transfer"),
64917
+ title: transferCryptoTitle,
64918
+ subtitle: t7.transferCrypto.subtitle,
64919
+ featuredTokens: projectConfig?.transfer_crypto.networks
64920
+ }
64921
+ ),
64922
+ showConnectWallet && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64923
+ BrowserWalletButton,
64924
+ {
64925
+ onClick: handleBrowserWalletClick,
64926
+ onConnectClick: handleWalletConnectClick,
64927
+ onDisconnect: handleWalletDisconnect,
64928
+ chainType: browserWalletChainType,
64929
+ publishableKey,
64930
+ featuredWallets: projectConfig?.connect_wallet?.wallets
64931
+ }
64932
+ ),
64933
+ showFiatOnramp && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64934
+ DepositWithCardButton,
64935
+ {
64936
+ onClick: () => setView("card"),
64937
+ title: depositWithCardTitle,
64938
+ subtitle: t7.depositWithCard.subtitle,
64939
+ paymentNetworks: projectConfig?.payment_networks.networks
64940
+ }
64941
+ ),
64942
+ showPayWithExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64943
+ PayWithExchangeButton,
64944
+ {
64945
+ onClick: () => setView("exchange"),
64946
+ title: payWithExchangeTitle,
64947
+ subtitle: t7.payWithExchange.subtitle,
64948
+ exchanges,
64949
+ loading: exchangesLoading
64950
+ }
64951
+ ),
64952
+ showConnectExchange && connectedExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64953
+ ConnectExchangeButton,
64954
+ {
64955
+ onClick: () => {
64956
+ setCoinbaseSkipToHoldings(true);
64957
+ setView("coinbase_connect");
64958
+ },
64959
+ onDisconnect: handleExchangeDisconnect,
64960
+ title: i18n2.connectExchange.title,
64961
+ subtitle: i18n2.connectExchange.subtitle,
64962
+ exchanges: integrationExchanges,
64963
+ connectedExchange
64964
+ }
64965
+ ),
64966
+ showConnectExchange && !connectedExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64967
+ ConnectExchangeButton,
64968
+ {
64969
+ onClick: () => {
64970
+ setCoinbaseSkipToHoldings(false);
64971
+ setView("coinbase_connect");
64972
+ },
64973
+ title: i18n2.connectExchange.title,
64974
+ subtitle: i18n2.connectExchange.subtitle,
64975
+ exchanges: integrationExchanges
64976
+ }
64977
+ ),
64978
+ showCashApp && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64979
+ CashAppButton,
64980
+ {
64981
+ onClick: () => setView("cashapp"),
64982
+ title: "Pay with Cash App",
64983
+ subtitle: "Deposit via Cash App",
64984
+ iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0
64985
+ }
64986
+ ),
64987
+ showDepositTracker && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64988
+ DepositTrackerButton,
64989
+ {
64990
+ onClick: () => {
64991
+ setAllExecutions(depositExecutions);
64992
+ setView("tracker");
64993
+ },
64994
+ title: depositTrackerTitle,
64995
+ subtitle: depositTrackerSubTitle,
64996
+ badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
64997
+ }
64998
+ )
64999
+ ] }) }),
65000
+ depositPoweredByFooter
65001
+ ] })
65002
+ ] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
65003
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65004
+ DepositHeader,
65005
+ {
65006
+ title: transferCryptoTitle,
65007
+ showBack: showBackTransfer,
65008
+ onBack: handleBack,
65009
+ onClose: handleClose,
65010
+ showBalance: showBalanceHeader,
65011
+ balanceAddress: recipientAddress,
65012
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
65013
+ balanceChainId: destinationChainId,
65014
+ balanceTokenAddress: destinationTokenAddress,
65015
+ projectName: projectConfig?.project_name,
65016
+ publishableKey
65017
+ }
65018
+ ),
65019
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65020
+ standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65021
+ TransferCryptoSingleInput,
64560
65022
  {
64561
- onClick: handleBrowserWalletClick,
64562
- onConnectClick: handleWalletConnectClick,
64563
- onDisconnect: handleWalletDisconnect,
64564
- chainType: browserWalletChainType,
65023
+ userId,
64565
65024
  publishableKey,
64566
- featuredWallets: projectConfig?.connect_wallet?.wallets
65025
+ recipientAddress,
65026
+ destinationChainType,
65027
+ destinationChainId,
65028
+ destinationTokenAddress,
65029
+ defaultSourceChainType,
65030
+ defaultSourceChainId,
65031
+ defaultSourceTokenAddress,
65032
+ defaultSourceSymbol,
65033
+ depositConfirmationMode,
65034
+ onExecutionsChange: setDepositExecutions,
65035
+ onDepositSuccess,
65036
+ onDepositError,
65037
+ wallets
64567
65038
  }
64568
- ),
64569
- showFiatOnramp && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64570
- DepositWithCardButton,
65039
+ ) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65040
+ TransferCryptoDoubleInput,
64571
65041
  {
64572
- onClick: () => setView("card"),
64573
- title: depositWithCardTitle,
64574
- subtitle: t7.depositWithCard.subtitle,
64575
- paymentNetworks: projectConfig?.payment_networks.networks
65042
+ userId,
65043
+ publishableKey,
65044
+ recipientAddress,
65045
+ destinationChainType,
65046
+ destinationChainId,
65047
+ destinationTokenAddress,
65048
+ defaultSourceChainType,
65049
+ defaultSourceChainId,
65050
+ defaultSourceTokenAddress,
65051
+ defaultSourceSymbol,
65052
+ depositConfirmationMode,
65053
+ onExecutionsChange: setDepositExecutions,
65054
+ onDepositSuccess,
65055
+ onDepositError,
65056
+ wallets
64576
65057
  }
64577
65058
  ),
64578
- showPayWithExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64579
- PayWithExchangeButton,
65059
+ depositPoweredByFooter
65060
+ ] })
65061
+ ] }) : view === "tracker" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
65062
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65063
+ DepositHeader,
65064
+ {
65065
+ title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
65066
+ showBack: showBackTracker,
65067
+ onBack: handleBack,
65068
+ onClose: handleClose
65069
+ }
65070
+ ),
65071
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65072
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-h-[460px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DepositDetailContent, { execution: selectedExecution }) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-space-y-2 uf-pb-8", children: allExecutions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65073
+ "div",
64580
65074
  {
64581
- onClick: () => setView("exchange"),
64582
- title: payWithExchangeTitle,
64583
- subtitle: t7.payWithExchange.subtitle,
64584
- exchanges,
64585
- loading: exchangesLoading
65075
+ className: "uf-text-sm",
65076
+ style: { color: components.container.subtitleColor, fontFamily: fonts.regular },
65077
+ children: "No deposits yet"
64586
65078
  }
64587
- ),
64588
- showConnectExchange && connectedExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64589
- ConnectExchangeButton,
65079
+ ) }) : allExecutions.map((execution) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65080
+ DepositExecutionItem,
64590
65081
  {
64591
- onClick: () => {
64592
- setCoinbaseSkipToHoldings(true);
64593
- setView("coinbase_connect");
64594
- },
64595
- onDisconnect: handleExchangeDisconnect,
64596
- title: i18n2.connectExchange.title,
64597
- subtitle: i18n2.connectExchange.subtitle,
64598
- exchanges: integrationExchanges,
64599
- connectedExchange
64600
- }
64601
- ),
64602
- showConnectExchange && !connectedExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64603
- ConnectExchangeButton,
65082
+ execution,
65083
+ onClick: () => setSelectedExecution(execution)
65084
+ },
65085
+ execution.id
65086
+ )) }) }),
65087
+ depositPoweredByFooter
65088
+ ] })
65089
+ ] }) : view === "card" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
65090
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65091
+ DepositHeader,
65092
+ {
65093
+ title: cardView === "quotes" ? t7.quotes : depositWithCardTitle,
65094
+ showBack: showBackCard,
65095
+ onBack: handleBack,
65096
+ onClose: handleClose,
65097
+ badge: cardView === "quotes" ? { count: quotesCount } : void 0,
65098
+ showBalance: showBalanceHeader,
65099
+ balanceAddress: recipientAddress,
65100
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
65101
+ balanceChainId: destinationChainId,
65102
+ balanceTokenAddress: destinationTokenAddress,
65103
+ projectName: projectConfig?.project_name,
65104
+ publishableKey
65105
+ }
65106
+ ),
65107
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65108
+ standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65109
+ BuyWithCard,
64604
65110
  {
64605
- onClick: () => {
64606
- setCoinbaseSkipToHoldings(false);
64607
- setView("coinbase_connect");
64608
- },
64609
- title: i18n2.connectExchange.title,
64610
- subtitle: i18n2.connectExchange.subtitle,
64611
- exchanges: integrationExchanges
65111
+ userId,
65112
+ publishableKey,
65113
+ view: cardView,
65114
+ onViewChange: handleCardViewChange,
65115
+ destinationTokenSymbol,
65116
+ recipientAddress,
65117
+ destinationChainType,
65118
+ destinationChainId,
65119
+ destinationTokenAddress,
65120
+ onDepositSuccess,
65121
+ onDepositError,
65122
+ onEvent,
65123
+ themeClass,
65124
+ wallets,
65125
+ assetCdnUrl: projectConfig?.asset_cdn_url,
65126
+ hideDepositFlowInfo,
65127
+ hideDisplayDescription
64612
65128
  }
64613
65129
  ),
64614
- showCashApp && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64615
- CashAppButton,
65130
+ depositPoweredByFooter
65131
+ ] })
65132
+ ] }) : view === "exchange" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
65133
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65134
+ DepositHeader,
65135
+ {
65136
+ title: payWithExchangeTitle,
65137
+ showBack: exchangeView === "pending" || sessionOpenedFromMenu,
65138
+ onBack: handleBack,
65139
+ onClose: handleClose
65140
+ }
65141
+ ),
65142
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65143
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65144
+ PayWithExchange,
64616
65145
  {
64617
- onClick: () => setView("cashapp"),
64618
- title: "Pay with Cash App",
64619
- subtitle: "Deposit via Cash App",
64620
- iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0
65146
+ userId,
65147
+ publishableKey,
65148
+ exchanges,
65149
+ view: exchangeView,
65150
+ onViewChange: setExchangeView,
65151
+ destinationTokenSymbol,
65152
+ recipientAddress,
65153
+ destinationChainType,
65154
+ destinationChainId,
65155
+ destinationTokenAddress,
65156
+ onDepositSuccess,
65157
+ onDepositError,
65158
+ wallets,
65159
+ defaultToken: defaultToken ?? null
64621
65160
  }
64622
65161
  ),
64623
- showDepositTracker && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64624
- DepositTrackerButton,
64625
- {
64626
- onClick: () => {
64627
- setAllExecutions(depositExecutions);
64628
- setView("tracker");
64629
- },
64630
- title: depositTrackerTitle,
64631
- subtitle: depositTrackerSubTitle,
64632
- badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
64633
- }
64634
- )
64635
- ] }) }),
64636
- depositPoweredByFooter
64637
- ] })
64638
- ] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64639
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64640
- DepositHeader,
64641
- {
64642
- title: transferCryptoTitle,
64643
- showBack: showBackTransfer,
64644
- onBack: handleBack,
64645
- onClose: handleClose,
64646
- showBalance: showBalanceHeader,
64647
- balanceAddress: recipientAddress,
64648
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
64649
- balanceChainId: destinationChainId,
64650
- balanceTokenAddress: destinationTokenAddress,
64651
- projectName: projectConfig?.project_name,
64652
- publishableKey
64653
- }
64654
- ),
64655
- /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64656
- standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64657
- TransferCryptoSingleInput,
65162
+ depositPoweredByFooter
65163
+ ] })
65164
+ ] }) : view === "coinbase_connect" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65165
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65166
+ CoinbaseConnect,
64658
65167
  {
64659
- userId,
64660
65168
  publishableKey,
64661
- recipientAddress,
64662
- destinationChainType,
64663
- destinationChainId,
64664
- destinationTokenAddress,
64665
- defaultSourceChainType,
64666
- defaultSourceChainId,
64667
- defaultSourceTokenAddress,
64668
- defaultSourceSymbol,
64669
- depositConfirmationMode,
64670
- onExecutionsChange: setDepositExecutions,
64671
- onDepositSuccess,
64672
- onDepositError,
64673
- wallets
64674
- }
64675
- ) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64676
- TransferCryptoDoubleInput,
64677
- {
64678
65169
  userId,
64679
- publishableKey,
65170
+ wallets,
64680
65171
  recipientAddress,
64681
- destinationChainType,
64682
- destinationChainId,
64683
- destinationTokenAddress,
65172
+ destinationTokenAddress: destinationTokenAddress ?? "",
65173
+ destinationChainId: destinationChainId ?? "",
65174
+ destinationChainType: destinationChainType ?? "",
65175
+ onTransferSuccess: (result) => {
65176
+ onDepositSuccess?.({
65177
+ message: "Transfer completed via Coinbase Connect",
65178
+ transaction: result
65179
+ });
65180
+ },
65181
+ onTransferError: (error) => {
65182
+ onDepositError?.({
65183
+ message: error.message,
65184
+ error
65185
+ });
65186
+ },
65187
+ onBack: handleBack,
65188
+ onClose: handleClose,
65189
+ onDisconnect: handleExchangeDisconnect,
65190
+ skipToHoldings: coinbaseSkipToHoldings,
65191
+ canGoBack: sessionOpenedFromMenu,
65192
+ onExecutionsChange: setDepositExecutions,
64684
65193
  defaultSourceChainType,
64685
65194
  defaultSourceChainId,
64686
65195
  defaultSourceTokenAddress,
64687
- defaultSourceSymbol,
64688
- depositConfirmationMode,
64689
- onExecutionsChange: setDepositExecutions,
64690
- onDepositSuccess,
64691
- onDepositError,
64692
- wallets
65196
+ defaultSourceSymbol
64693
65197
  }
64694
65198
  ),
64695
65199
  depositPoweredByFooter
64696
- ] })
64697
- ] }) : view === "tracker" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64698
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64699
- DepositHeader,
64700
- {
64701
- title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
64702
- showBack: showBackTracker,
64703
- onBack: handleBack,
64704
- onClose: handleClose
64705
- }
64706
- ),
64707
- /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64708
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-h-[460px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DepositDetailContent, { execution: selectedExecution }) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-space-y-2 uf-pb-8", children: allExecutions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64709
- "div",
64710
- {
64711
- className: "uf-text-sm",
64712
- style: { color: components.container.subtitleColor, fontFamily: fonts.regular },
64713
- children: "No deposits yet"
64714
- }
64715
- ) }) : allExecutions.map((execution) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64716
- DepositExecutionItem,
64717
- {
64718
- execution,
64719
- onClick: () => setSelectedExecution(execution)
64720
- },
64721
- execution.id
64722
- )) }) }),
64723
- depositPoweredByFooter
64724
- ] })
64725
- ] }) : view === "card" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64726
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64727
- DepositHeader,
64728
- {
64729
- title: cardView === "quotes" ? t7.quotes : depositWithCardTitle,
64730
- showBack: showBackCard,
64731
- onBack: handleBack,
64732
- onClose: handleClose,
64733
- badge: cardView === "quotes" ? { count: quotesCount } : void 0,
64734
- showBalance: showBalanceHeader,
64735
- balanceAddress: recipientAddress,
64736
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
64737
- balanceChainId: destinationChainId,
64738
- balanceTokenAddress: destinationTokenAddress,
64739
- projectName: projectConfig?.project_name,
64740
- publishableKey
64741
- }
64742
- ),
64743
- /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64744
- standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64745
- BuyWithCard,
64746
- {
64747
- userId,
64748
- publishableKey,
64749
- view: cardView,
64750
- onViewChange: handleCardViewChange,
64751
- destinationTokenSymbol,
64752
- recipientAddress,
64753
- destinationChainType,
64754
- destinationChainId,
64755
- destinationTokenAddress,
64756
- onDepositSuccess,
64757
- onDepositError,
64758
- onEvent,
64759
- themeClass,
64760
- wallets,
64761
- assetCdnUrl: projectConfig?.asset_cdn_url,
64762
- hideDepositFlowInfo,
64763
- hideDisplayDescription
64764
- }
64765
- ),
64766
- depositPoweredByFooter
64767
- ] })
64768
- ] }) : view === "exchange" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64769
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64770
- DepositHeader,
64771
- {
64772
- title: payWithExchangeTitle,
64773
- showBack: exchangeView === "pending" || sessionOpenedFromMenu,
64774
- onBack: handleBack,
64775
- onClose: handleClose
64776
- }
64777
- ),
64778
- /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65200
+ ] }) : view === "wallet_connect" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64779
65201
  /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64780
- PayWithExchange,
65202
+ WalletConnect,
64781
65203
  {
65204
+ walletInfo: browserWalletInfo ?? void 0,
65205
+ depositWallet: browserWalletInfo?.depositWallet ?? void 0,
65206
+ wallets,
64782
65207
  userId,
64783
65208
  publishableKey,
64784
- exchanges,
64785
- view: exchangeView,
64786
- onViewChange: setExchangeView,
64787
- destinationTokenSymbol,
64788
- recipientAddress,
64789
- destinationChainType,
64790
- destinationChainId,
64791
- destinationTokenAddress,
65209
+ assetCdnUrl: projectConfig?.asset_cdn_url,
65210
+ projectName: projectConfig?.project_name,
65211
+ onSuccess: (txHash) => {
65212
+ onDepositSuccess?.({
65213
+ message: "Transaction sent successfully",
65214
+ transaction: { txHash }
65215
+ });
65216
+ },
65217
+ onError: (error) => {
65218
+ onDepositError?.({
65219
+ message: error.message,
65220
+ error
65221
+ });
65222
+ },
64792
65223
  onDepositSuccess,
64793
65224
  onDepositError,
64794
- wallets,
64795
- defaultToken: defaultToken ?? null
65225
+ amountQuickSelect: browserWalletAmountQuickSelect,
65226
+ onWalletDisconnect: handleWalletDisconnect,
65227
+ onWalletConnected: (info, dw) => {
65228
+ setBrowserWalletInfo({ ...info, depositWallet: dw });
65229
+ setStoredWalletState(info.type);
65230
+ setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
65231
+ },
65232
+ onBack: handleBack,
65233
+ onClose: handleClose,
65234
+ defaultSourceChainType,
65235
+ defaultSourceChainId,
65236
+ defaultSourceTokenAddress,
65237
+ defaultSourceSymbol,
65238
+ canGoBack: sessionOpenedFromMenu,
65239
+ depositWalletsLoading: walletsLoading
64796
65240
  }
64797
65241
  ),
64798
65242
  depositPoweredByFooter
64799
- ] })
64800
- ] }) : view === "coinbase_connect" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64801
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64802
- CoinbaseConnect,
64803
- {
64804
- publishableKey,
64805
- userId,
64806
- wallets,
64807
- recipientAddress,
64808
- destinationTokenAddress: destinationTokenAddress ?? "",
64809
- destinationChainId: destinationChainId ?? "",
64810
- destinationChainType: destinationChainType ?? "",
64811
- onTransferSuccess: (result) => {
64812
- onDepositSuccess?.({
64813
- message: "Transfer completed via Coinbase Connect",
64814
- transaction: result
64815
- });
64816
- },
64817
- onTransferError: (error) => {
64818
- onDepositError?.({
64819
- message: error.message,
64820
- error
64821
- });
64822
- },
64823
- onBack: handleBack,
64824
- onClose: handleClose,
64825
- onDisconnect: handleExchangeDisconnect,
64826
- skipToHoldings: coinbaseSkipToHoldings,
64827
- canGoBack: sessionOpenedFromMenu,
64828
- onExecutionsChange: setDepositExecutions,
64829
- defaultSourceChainType,
64830
- defaultSourceChainId,
64831
- defaultSourceTokenAddress,
64832
- defaultSourceSymbol
64833
- }
64834
- ),
64835
- depositPoweredByFooter
64836
- ] }) : view === "wallet_connect" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64837
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64838
- WalletConnect,
64839
- {
64840
- walletInfo: browserWalletInfo ?? void 0,
64841
- depositWallet: browserWalletInfo?.depositWallet ?? void 0,
64842
- wallets,
64843
- userId,
64844
- publishableKey,
64845
- assetCdnUrl: projectConfig?.asset_cdn_url,
64846
- projectName: projectConfig?.project_name,
64847
- onSuccess: (txHash) => {
64848
- onDepositSuccess?.({
64849
- message: "Transaction sent successfully",
64850
- transaction: { txHash }
64851
- });
64852
- },
64853
- onError: (error) => {
64854
- onDepositError?.({
64855
- message: error.message,
64856
- error
64857
- });
64858
- },
64859
- onDepositSuccess,
64860
- onDepositError,
64861
- amountQuickSelect: browserWalletAmountQuickSelect,
64862
- onWalletDisconnect: handleWalletDisconnect,
64863
- onWalletConnected: (info, dw) => {
64864
- setBrowserWalletInfo({ ...info, depositWallet: dw });
64865
- setStoredWalletState(info.type);
64866
- setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
64867
- },
64868
- onBack: handleBack,
64869
- onClose: handleClose,
64870
- defaultSourceChainType,
64871
- defaultSourceChainId,
64872
- defaultSourceTokenAddress,
64873
- defaultSourceSymbol,
64874
- canGoBack: sessionOpenedFromMenu,
64875
- depositWalletsLoading: walletsLoading
64876
- }
64877
- ),
64878
- depositPoweredByFooter
64879
- ] }) : view === "cashapp" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64880
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64881
- DepositHeader,
64882
- {
64883
- title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
64884
- showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
64885
- onBack: handleBack,
64886
- onClose: handleClose
64887
- }
64888
- ),
64889
- /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65243
+ ] }) : view === "cashapp" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64890
65244
  /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64891
- PayWithCashApp,
65245
+ DepositHeader,
64892
65246
  {
64893
- userId,
64894
- publishableKey,
64895
- recipientAddress,
64896
- destinationChainType,
64897
- destinationChainId,
64898
- destinationTokenAddress,
64899
- cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
64900
- view: cashAppView,
64901
- onViewChange: setCashAppView,
64902
- onAmountChange: setCashAppAmount,
64903
- onEvent,
64904
- onDepositSuccess,
64905
- onDepositError
65247
+ title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
65248
+ showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
65249
+ onBack: handleBack,
65250
+ onClose: handleClose
64906
65251
  }
64907
65252
  ),
64908
- depositPoweredByFooter
64909
- ] })
64910
- ] }) : null })
65253
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65254
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65255
+ PayWithCashApp,
65256
+ {
65257
+ userId,
65258
+ publishableKey,
65259
+ recipientAddress,
65260
+ destinationChainType,
65261
+ destinationChainId,
65262
+ destinationTokenAddress,
65263
+ cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
65264
+ view: cashAppView,
65265
+ onViewChange: setCashAppView,
65266
+ onAmountChange: setCashAppAmount,
65267
+ onEvent,
65268
+ onDepositSuccess,
65269
+ onDepositError
65270
+ }
65271
+ ),
65272
+ depositPoweredByFooter
65273
+ ] })
65274
+ ] }) : null })
65275
+ ]
64911
65276
  }
64912
65277
  )
64913
65278
  }
@@ -64992,7 +65357,6 @@ function CheckoutModal({
64992
65357
  const [browserWalletInfo, setBrowserWalletInfo] = (0, import_react29.useState)(null);
64993
65358
  const [walletSelectionModalOpen, setWalletSelectionModalOpen] = (0, import_react29.useState)(false);
64994
65359
  const [browserWalletChainType, setBrowserWalletChainType] = (0, import_react29.useState)(() => getStoredWalletState()?.chainType);
64995
- const isMobileView = useIsMobileViewport();
64996
65360
  const [resolvedTheme, setResolvedTheme] = (0, import_react29.useState)(
64997
65361
  theme === "auto" ? "dark" : theme
64998
65362
  );
@@ -65418,7 +65782,7 @@ function CheckoutModal({
65418
65782
  featuredTokens: projectConfig?.transfer_crypto.networks
65419
65783
  }
65420
65784
  ),
65421
- showConnectWallet && !isMobileView && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
65785
+ showConnectWallet && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
65422
65786
  BrowserWalletButton,
65423
65787
  {
65424
65788
  onClick: handleBrowserWalletClick,
@@ -67324,6 +67688,16 @@ function UnifoldProvider2({
67324
67688
  });
67325
67689
  promise.catch(() => {
67326
67690
  });
67691
+ if (!config2.recipientAddress) {
67692
+ const error = {
67693
+ message: "beginDeposit requires a `recipientAddress`.",
67694
+ code: "MISSING_RECIPIENT"
67695
+ };
67696
+ console.error(`[UnifoldProvider] ${error.message}`);
67697
+ depositPromiseRef.current.reject(error);
67698
+ depositPromiseRef.current = null;
67699
+ return promise;
67700
+ }
67327
67701
  setDepositConfig(config2);
67328
67702
  setIsOpen(true);
67329
67703
  return promise;