@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.mjs CHANGED
@@ -43566,6 +43566,40 @@ async function getAddressBalances(address, chainType, publishableKey) {
43566
43566
  const data = await response.json();
43567
43567
  return data;
43568
43568
  }
43569
+ async function getExternalWallets(publishableKey) {
43570
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43571
+ validatePublishableKey(pk);
43572
+ const response = await fetch(`${API_BASE_URL}/v1/public/external_wallets`, {
43573
+ method: "GET",
43574
+ headers: {
43575
+ accept: "application/json",
43576
+ "x-publishable-key": pk
43577
+ }
43578
+ });
43579
+ if (!response.ok) {
43580
+ throw new Error(`Failed to fetch external wallets: ${response.statusText}`);
43581
+ }
43582
+ const data = await response.json();
43583
+ return data;
43584
+ }
43585
+ async function getWalletMobileDeepLink(wallet, depositAddresses, publishableKey) {
43586
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43587
+ validatePublishableKey(pk);
43588
+ const response = await fetch(`${API_BASE_URL}/v1/public/external_wallets/mobile_deeplink`, {
43589
+ method: "POST",
43590
+ headers: {
43591
+ "Content-Type": "application/json",
43592
+ accept: "application/json",
43593
+ "x-publishable-key": pk
43594
+ },
43595
+ body: JSON.stringify({ wallet, deposit_addresses: depositAddresses })
43596
+ });
43597
+ if (!response.ok) {
43598
+ throw new Error(`Failed to generate wallet deep link: ${response.statusText}`);
43599
+ }
43600
+ const data = await response.json();
43601
+ return data;
43602
+ }
43569
43603
  async function getAddressBalance(address, chainType, chainId, tokenAddress, publishableKey) {
43570
43604
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43571
43605
  validatePublishableKey(pk);
@@ -50536,6 +50570,36 @@ function ThemeProvider({
50536
50570
  );
50537
50571
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ThemeContext.Provider, { value: contextValue, children });
50538
50572
  }
50573
+ function AccentColorOverride({
50574
+ accentColor,
50575
+ accentForeground,
50576
+ children
50577
+ }) {
50578
+ const parent = useTheme();
50579
+ const value = React37.useMemo(() => {
50580
+ if (!accentColor) return parent;
50581
+ const foreground = accentForeground ?? parent.colors.primaryForeground;
50582
+ const nextColors = {
50583
+ ...parent.colors,
50584
+ primary: accentColor,
50585
+ primaryForeground: foreground
50586
+ };
50587
+ const nextComponents = {
50588
+ ...parent.components,
50589
+ button: {
50590
+ ...parent.components.button,
50591
+ primaryBackground: accentColor,
50592
+ primaryText: foreground
50593
+ },
50594
+ card: {
50595
+ ...parent.components.card,
50596
+ iconBackgroundColor: `${accentColor}26`
50597
+ }
50598
+ };
50599
+ return { ...parent, colors: nextColors, components: nextComponents };
50600
+ }, [parent, accentColor, accentForeground]);
50601
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ThemeContext.Provider, { value, children });
50602
+ }
50539
50603
  function useTheme() {
50540
50604
  const context = React37.useContext(ThemeContext);
50541
50605
  if (!context) {
@@ -51587,6 +51651,7 @@ function useDepositPolling({
51587
51651
  clientSecret,
51588
51652
  depositConfirmationMode = "auto_ui",
51589
51653
  depositWalletId,
51654
+ depositWalletIds,
51590
51655
  enabled = true,
51591
51656
  immediateDirectPolling = false,
51592
51657
  onDepositSuccess,
@@ -51732,21 +51797,25 @@ function useDepositPolling({
51732
51797
  setIsPolling(false);
51733
51798
  };
51734
51799
  }, [userId, publishableKey, clientSecret, enabled]);
51800
+ const pollWalletIdsKey = depositWalletIds && depositWalletIds.length > 0 ? Array.from(new Set(depositWalletIds.filter(Boolean))).join(",") : depositWalletId || "";
51735
51801
  (0, import_react10.useEffect)(() => {
51736
- if (!pollingEnabled || !depositWalletId) return;
51802
+ if (!pollingEnabled || !pollWalletIdsKey) return;
51803
+ const ids = pollWalletIdsKey.split(",").filter(Boolean);
51737
51804
  const triggerPoll = async () => {
51738
- try {
51739
- await pollDirectExecutions(
51740
- { deposit_wallet_id: depositWalletId },
51741
- publishableKey
51742
- );
51743
- } catch {
51744
- }
51805
+ await Promise.all(
51806
+ ids.map(
51807
+ (id) => pollDirectExecutions(
51808
+ { deposit_wallet_id: id },
51809
+ publishableKey
51810
+ ).catch(() => {
51811
+ })
51812
+ )
51813
+ );
51745
51814
  };
51746
51815
  triggerPoll();
51747
51816
  const interval = setInterval(triggerPoll, POLL_ENDPOINT_INTERVAL_MS);
51748
51817
  return () => clearInterval(interval);
51749
- }, [pollingEnabled, depositWalletId, publishableKey]);
51818
+ }, [pollingEnabled, pollWalletIdsKey, publishableKey]);
51750
51819
  const handleIveDeposited = () => {
51751
51820
  setPollingEnabled(true);
51752
51821
  setShowWaitingUi(true);
@@ -52935,6 +53004,7 @@ function BuyWithCard({
52935
53004
  if (!selectedProvider) return "0.000000";
52936
53005
  return selectedProvider.destination_amount.toFixed(6);
52937
53006
  };
53007
+ const canOpenProviderSelector = !quotesLoading && quotes.length > 1;
52938
53008
  const selectedCurrencyData = fiatCurrencies.find(
52939
53009
  (c) => c.currency_code.toLowerCase() === currency.toLowerCase()
52940
53010
  );
@@ -53120,9 +53190,12 @@ function BuyWithCard({
53120
53190
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
53121
53191
  "button",
53122
53192
  {
53123
- onClick: () => handleViewChange("quotes"),
53193
+ onClick: () => {
53194
+ if (canOpenProviderSelector) handleViewChange("quotes");
53195
+ },
53124
53196
  disabled: quotesLoading || quotes.length === 0,
53125
- 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",
53197
+ "aria-disabled": !canOpenProviderSelector,
53198
+ 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"}`,
53126
53199
  style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` },
53127
53200
  children: quotesLoading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "uf-text-left uf-w-full uf-animate-pulse", children: [
53128
53201
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -53149,7 +53222,7 @@ function BuyWithCard({
53149
53222
  )
53150
53223
  ] })
53151
53224
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "uf-w-full uf-text-left", children: [
53152
- isAutoSelected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
53225
+ isAutoSelected && canOpenProviderSelector && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
53153
53226
  "div",
53154
53227
  {
53155
53228
  className: "uf-text-xs uf-font-normal uf-mb-2",
@@ -53185,7 +53258,7 @@ function BuyWithCard({
53185
53258
  ),
53186
53259
  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" }) })
53187
53260
  ] }),
53188
- quotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
53261
+ canOpenProviderSelector && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
53189
53262
  ChevronRight,
53190
53263
  {
53191
53264
  className: "uf-w-4 uf-h-4 group-hover:uf-text-foreground uf-transition-colors uf-flex-shrink-0",
@@ -62161,6 +62234,60 @@ function useDepositQuote(params) {
62161
62234
  retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 5e3)
62162
62235
  });
62163
62236
  }
62237
+ function useExternalWallets({
62238
+ publishableKey,
62239
+ enabled = true
62240
+ }) {
62241
+ const { data: wallets = [], isLoading } = useQuery({
62242
+ queryKey: ["unifold", "external-wallets", publishableKey],
62243
+ queryFn: () => getExternalWallets(publishableKey).then((res) => res.data),
62244
+ enabled: enabled && !!publishableKey,
62245
+ staleTime: 1e3 * 60 * 30,
62246
+ refetchOnMount: false,
62247
+ refetchOnWindowFocus: false
62248
+ });
62249
+ return { wallets, isLoading };
62250
+ }
62251
+ var WALLET_BRAND_COLORS = {
62252
+ phantom: "#AB9FF2",
62253
+ metamask: "#F6851B",
62254
+ coinbase: "#0052FF",
62255
+ trust: "#3375BB",
62256
+ rainbow: "#5B6CFF",
62257
+ rabby: "#7084FF",
62258
+ okx: "#000000"
62259
+ };
62260
+ function normalizeWalletId(type) {
62261
+ return type.replace(/-(ethereum|solana)$/i, "").toLowerCase();
62262
+ }
62263
+ function getWalletBrandColor(type, mode = "dark") {
62264
+ if (!type) return void 0;
62265
+ const id = normalizeWalletId(type);
62266
+ const color = WALLET_BRAND_COLORS[id];
62267
+ if (!color) return void 0;
62268
+ if (id === "okx") return mode === "dark" ? "#FFFFFF" : "#111111";
62269
+ return color;
62270
+ }
62271
+ function getContrastingTextColor(hex) {
62272
+ const c = hex.replace("#", "");
62273
+ if (c.length !== 6) return "#FFFFFF";
62274
+ const r2 = parseInt(c.slice(0, 2), 16);
62275
+ const g = parseInt(c.slice(2, 4), 16);
62276
+ const b = parseInt(c.slice(4, 6), 16);
62277
+ const luminance = (0.299 * r2 + 0.587 * g + 0.114 * b) / 255;
62278
+ return luminance > 0.6 ? "#13111C" : "#FFFFFF";
62279
+ }
62280
+ function isMobileDevice() {
62281
+ if (typeof navigator === "undefined") return false;
62282
+ return /android|iphone|ipad|ipod|mobile/i.test(navigator.userAgent);
62283
+ }
62284
+ function getMobilePlatform() {
62285
+ if (typeof navigator === "undefined") return null;
62286
+ const ua = navigator.userAgent;
62287
+ if (/iphone|ipad|ipod/i.test(ua)) return "ios";
62288
+ if (/android/i.test(ua)) return "android";
62289
+ return null;
62290
+ }
62164
62291
  var WALLET_ICONS = {
62165
62292
  metamask: MetamaskIcon,
62166
62293
  phantom: PhantomIcon,
@@ -63166,18 +63293,33 @@ var WALLET_ICONS3 = {
63166
63293
  backpack: BackpackIcon,
63167
63294
  glow: GlowIcon
63168
63295
  };
63169
- var WALLET_DEFINITIONS = [
63170
- { id: "phantom", name: "Phantom", networks: ["ethereum", "solana"], installUrl: "https://phantom.app/" },
63171
- { id: "coinbase", name: "Coinbase Wallet", networks: ["ethereum", "solana"], installUrl: "https://www.coinbase.com/wallet" },
63172
- { id: "trust", name: "Trust Wallet", networks: ["ethereum", "solana"], installUrl: "https://trustwallet.com/" },
63173
- { id: "metamask", name: "MetaMask", networks: ["ethereum"], installUrl: "https://metamask.io/download/" },
63174
- { id: "rainbow", name: "Rainbow", networks: ["ethereum"], installUrl: "https://rainbow.me/" },
63175
- { id: "rabby", name: "Rabby", networks: ["ethereum"], installUrl: "https://rabby.io/" },
63176
- { id: "okx", name: "OKX Wallet", networks: ["ethereum"], installUrl: "https://www.okx.com/web3" },
63177
- { id: "solflare", name: "Solflare", networks: ["solana"], installUrl: "https://solflare.com/" },
63178
- { id: "backpack", name: "Backpack", networks: ["solana"], installUrl: "https://backpack.app/" },
63179
- { id: "glow", name: "Glow", networks: ["solana"], installUrl: "https://glow.app/" }
63296
+ var FALLBACK_WALLET_DEFINITIONS = [
63297
+ { id: "phantom", name: "Phantom", networks: ["ethereum", "solana"], installUrl: "https://phantom.app/", supportsMobileBrowse: true },
63298
+ { id: "coinbase", name: "Coinbase Wallet", networks: ["ethereum", "solana"], installUrl: "https://www.coinbase.com/wallet", supportsMobileBrowse: true },
63299
+ { id: "trust", name: "Trust Wallet", networks: ["ethereum", "solana"], installUrl: "https://trustwallet.com/", supportsMobileBrowse: true },
63300
+ { id: "metamask", name: "MetaMask", networks: ["ethereum"], installUrl: "https://metamask.io/download/", supportsMobileBrowse: true },
63301
+ { id: "rainbow", name: "Rainbow", networks: ["ethereum"], installUrl: "https://rainbow.me/", supportsMobileBrowse: true },
63302
+ { id: "rabby", name: "Rabby", networks: ["ethereum"], installUrl: "https://apps.apple.com/app/rabby-wallet/id6450663781", supportsMobileBrowse: true },
63303
+ { id: "okx", name: "OKX Wallet", networks: ["ethereum"], installUrl: "https://www.okx.com/web3", supportsMobileBrowse: true, mobileBrowsePlatforms: ["ios"] }
63180
63304
  ];
63305
+ function getMobileInstallUrl(walletId, defaultUrl) {
63306
+ if (!isMobileDevice()) return defaultUrl;
63307
+ const ua = typeof navigator !== "undefined" ? navigator.userAgent : "";
63308
+ const isIOS = /iPhone|iPad|iPod/i.test(ua);
63309
+ const stores = {
63310
+ rabby: {
63311
+ ios: "https://apps.apple.com/app/rabby-wallet/id6450663781",
63312
+ android: "https://play.google.com/store/apps/details?id=com.debank.rabbymobile"
63313
+ },
63314
+ glow: {
63315
+ ios: "https://apps.apple.com/us/app/glow-solana-wallet/id1599584512",
63316
+ android: "https://play.google.com/store/apps/details?id=com.luma.wallet.prod"
63317
+ }
63318
+ };
63319
+ const entry = stores[walletId];
63320
+ if (!entry) return defaultUrl;
63321
+ return isIOS ? entry.ios : entry.android;
63322
+ }
63181
63323
  function normalizeTokenAddress(address) {
63182
63324
  const normalized = (address ?? "").toLowerCase();
63183
63325
  if (normalized === "" || normalized === "native" || normalized === "0x0000000000000000000000000000000000000000") {
@@ -63213,7 +63355,7 @@ function getLegacyEvmProviders() {
63213
63355
  okxEthereum: win.okxwallet
63214
63356
  };
63215
63357
  }
63216
- function detectAvailableWallets(filterChainType) {
63358
+ function detectAvailableWallets(definitions, filterChainType) {
63217
63359
  const solProviders = getSolanaProviders();
63218
63360
  const legacyEvm = getLegacyEvmProviders();
63219
63361
  const eip6963List = getEip6963Providers();
@@ -63239,7 +63381,7 @@ function detectAvailableWallets(filterChainType) {
63239
63381
  return false;
63240
63382
  }
63241
63383
  });
63242
- return WALLET_DEFINITIONS.filter((w) => !filterChainType || w.networks.includes(filterChainType)).map((wallet) => {
63384
+ return definitions.filter((w) => !filterChainType || w.networks.includes(filterChainType)).map((wallet) => {
63243
63385
  let isInstalled = false;
63244
63386
  const detectedNetworks = [];
63245
63387
  switch (wallet.id) {
@@ -63343,7 +63485,7 @@ function WalletConnect({
63343
63485
  depositWalletsLoading = false,
63344
63486
  onExecutionsChange
63345
63487
  }) {
63346
- const { colors: colors2, fonts, components } = useTheme();
63488
+ const { colors: colors2, fonts, components, mode } = useTheme();
63347
63489
  const walletProvidedAtMount = React302.useRef(!!initialWalletInfo && !!initialDepositWallet);
63348
63490
  const [activeWalletInfo, setActiveWalletInfo] = React302.useState(initialWalletInfo ?? null);
63349
63491
  const [activeDepositWallet, setActiveDepositWallet] = React302.useState(initialDepositWallet ?? null);
@@ -63367,7 +63509,37 @@ function WalletConnect({
63367
63509
  setEip6963ProviderCount(providers.length);
63368
63510
  });
63369
63511
  }, []);
63370
- const availableWallets = React302.useMemo(() => detectAvailableWallets(), [eip6963ProviderCount]);
63512
+ const { wallets: backendWallets } = useExternalWallets({ publishableKey });
63513
+ const walletDefinitions = React302.useMemo(
63514
+ () => backendWallets.length > 0 ? backendWallets.map((w) => ({
63515
+ id: w.id,
63516
+ name: w.name,
63517
+ networks: w.chain_types,
63518
+ installUrl: w.install_url,
63519
+ supportsMobileBrowse: w.supports_mobile_browse,
63520
+ mobileBrowsePlatforms: w.mobile_browse_platforms ?? null
63521
+ })) : FALLBACK_WALLET_DEFINITIONS,
63522
+ [backendWallets]
63523
+ );
63524
+ const availableWallets = React302.useMemo(
63525
+ () => detectAvailableWallets(walletDefinitions),
63526
+ [walletDefinitions, eip6963ProviderCount]
63527
+ );
63528
+ const [isMobile, setIsMobile] = React302.useState(false);
63529
+ React302.useEffect(() => {
63530
+ setIsMobile(isMobileDevice());
63531
+ }, []);
63532
+ const mobileDepositAddresses = React302.useMemo(
63533
+ () => (depositWallets ?? []).map((w) => ({ chain_type: w.chain_type, address: w.address })),
63534
+ [depositWallets]
63535
+ );
63536
+ const mobileDepositWalletIds = React302.useMemo(
63537
+ () => (depositWallets ?? []).filter((w) => w.chain_type === "ethereum" || w.chain_type === "solana").map((w) => w.id),
63538
+ [depositWallets]
63539
+ );
63540
+ const [mobileRedirect, setMobileRedirect] = React302.useState(null);
63541
+ const [pendingMobileWallet, setPendingMobileWallet] = React302.useState(null);
63542
+ const [awaitingMobileDeposit, setAwaitingMobileDeposit] = React302.useState(false);
63371
63543
  React302.useEffect(() => {
63372
63544
  if (!standalone || autoResolved || detectingWallet) return;
63373
63545
  if (!detectedWallet) {
@@ -63426,9 +63598,36 @@ function WalletConnect({
63426
63598
  transform: isTransitioning ? "translateY(4px)" : "translateY(0)",
63427
63599
  transition: "opacity 150ms ease, transform 150ms ease"
63428
63600
  };
63429
- const handleWalletClick = (wallet) => {
63601
+ const openMobileWalletBrowse = async (wallet, depositAddresses) => {
63602
+ try {
63603
+ const res = await getWalletMobileDeepLink(
63604
+ wallet.id,
63605
+ depositAddresses,
63606
+ publishableKey
63607
+ );
63608
+ if (res.deeplink) {
63609
+ setMobileRedirect({ walletId: wallet.id, walletName: wallet.name, deeplink: res.deeplink });
63610
+ setAwaitingMobileDeposit(true);
63611
+ transitionTo("mobile_redirect");
63612
+ window.location.href = res.deeplink;
63613
+ return true;
63614
+ }
63615
+ } catch {
63616
+ }
63617
+ return false;
63618
+ };
63619
+ const handleWalletClick = async (wallet) => {
63430
63620
  if (!wallet.isInstalled) {
63431
- window.open(wallet.installUrl, "_blank", "noopener,noreferrer");
63621
+ const platform2 = getMobilePlatform();
63622
+ const platformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(platform2 ?? "");
63623
+ if (isMobileDevice() && wallet.supportsMobileBrowse !== false && platformAllowed) {
63624
+ if (mobileDepositAddresses.length === 0) {
63625
+ setPendingMobileWallet(wallet);
63626
+ return;
63627
+ }
63628
+ if (await openMobileWalletBrowse(wallet, mobileDepositAddresses)) return;
63629
+ }
63630
+ window.open(getMobileInstallUrl(wallet.id, wallet.installUrl), "_blank", "noopener,noreferrer");
63432
63631
  return;
63433
63632
  }
63434
63633
  setSelectedWalletDef(wallet);
@@ -63444,6 +63643,27 @@ function WalletConnect({
63444
63643
  if (!selectedWalletDef) return;
63445
63644
  handleConnectWallet(selectedWalletDef, network);
63446
63645
  };
63646
+ React302.useEffect(() => {
63647
+ if (!pendingMobileWallet) return;
63648
+ if (mobileDepositAddresses.length > 0) {
63649
+ const wallet = pendingMobileWallet;
63650
+ setPendingMobileWallet(null);
63651
+ void (async () => {
63652
+ if (!await openMobileWalletBrowse(wallet, mobileDepositAddresses)) {
63653
+ window.open(getMobileInstallUrl(wallet.id, wallet.installUrl), "_blank", "noopener,noreferrer");
63654
+ }
63655
+ })();
63656
+ return;
63657
+ }
63658
+ const timeout = setTimeout(() => {
63659
+ setPendingMobileWallet((current) => {
63660
+ if (!current) return null;
63661
+ window.open(getMobileInstallUrl(current.id, current.installUrl), "_blank", "noopener,noreferrer");
63662
+ return null;
63663
+ });
63664
+ }, 8e3);
63665
+ return () => clearTimeout(timeout);
63666
+ }, [pendingMobileWallet, mobileDepositAddresses]);
63447
63667
  const handleConnectWallet = async (wallet, network) => {
63448
63668
  setConnectingNetwork(network);
63449
63669
  transitionTo("connecting");
@@ -63588,14 +63808,32 @@ function WalletConnect({
63588
63808
  userId,
63589
63809
  publishableKey,
63590
63810
  clientSecret,
63811
+ // In-tab flow: poll the single connected deposit wallet.
63591
63812
  depositWalletId: activeDepositWallet?.id ?? "",
63592
- enabled: hasSignedTransaction && !!activeDepositWallet,
63813
+ // Mobile redirect flow: the deposit chain isn't known up front, so /poll every
63814
+ // chain's deposit wallet. Detection still happens via the single /query by
63815
+ // external_user_id, which already spans all chains.
63816
+ depositWalletIds: awaitingMobileDeposit ? mobileDepositWalletIds : void 0,
63817
+ enabled: hasSignedTransaction && !!activeDepositWallet || awaitingMobileDeposit,
63593
63818
  onDepositSuccess,
63594
63819
  onDepositError
63595
63820
  });
63596
63821
  React302.useEffect(() => {
63597
63822
  onExecutionsChange?.(depositExecutions);
63598
63823
  }, [depositExecutions, onExecutionsChange]);
63824
+ const latestDepositExecution = React302.useMemo(() => {
63825
+ if (depositExecutions.length === 0) return null;
63826
+ return [...depositExecutions].sort((a, b) => {
63827
+ const ta = a.created_at ? new Date(a.created_at).getTime() : 0;
63828
+ const tb = b.created_at ? new Date(b.created_at).getTime() : 0;
63829
+ return tb - ta;
63830
+ })[0];
63831
+ }, [depositExecutions]);
63832
+ React302.useEffect(() => {
63833
+ if (awaitingMobileDeposit && latestDepositExecution && (viewRef.current === "mobile_redirect" || viewRef.current === "connecting")) {
63834
+ transitionTo("mobile_deposit_status");
63835
+ }
63836
+ }, [awaitingMobileDeposit, latestDepositExecution, transitionTo]);
63599
63837
  React302.useEffect(() => {
63600
63838
  if (!prefillAmountUsd || !tokenChainDetails || view !== "enter_amount") return;
63601
63839
  const minDeposit = tokenChainDetails.minimum_deposit_amount_usd || 0;
@@ -63726,6 +63964,16 @@ function WalletConnect({
63726
63964
  setSelectedWalletDef(null);
63727
63965
  setConnectingNetwork(null);
63728
63966
  break;
63967
+ case "mobile_redirect":
63968
+ transitionTo("select_wallet");
63969
+ setMobileRedirect(null);
63970
+ setAwaitingMobileDeposit(false);
63971
+ break;
63972
+ case "mobile_deposit_status":
63973
+ transitionTo("select_wallet");
63974
+ setMobileRedirect(null);
63975
+ setAwaitingMobileDeposit(false);
63976
+ break;
63729
63977
  case "select_token":
63730
63978
  if (walletProvidedAtMount.current) parentOnBack?.();
63731
63979
  else transitionTo("select_wallet");
@@ -63911,33 +64159,40 @@ function WalletConnect({
63911
64159
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: viewTransitionStyle, children: [
63912
64160
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DepositHeader, { title: "Connect Wallet", showBack: canGoBack, onBack: handleBack, onClose }),
63913
64161
  /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-pb-4", children: [
63914
- /* @__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" }),
63915
- /* @__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)(
63916
- "button",
63917
- {
63918
- onClick: () => handleWalletClick(wallet),
63919
- disabled: isWalletConnecting,
63920
- 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",
63921
- style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` },
63922
- children: [
63923
- /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
63924
- 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" }),
63925
- /* @__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 })
63926
- ] }),
63927
- 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: [
63928
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: "Install" }),
63929
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ExternalLink, { className: "uf-w-3 uf-h-3", style: { color: colors2.foregroundMuted } })
63930
- ] })
63931
- ]
63932
- },
63933
- wallet.id
63934
- )) }),
64162
+ /* @__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" }),
64163
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-space-y-2", style: { maxHeight: 330, overflowY: "auto" }, children: availableWallets.map((wallet) => {
64164
+ const walletPlatformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
64165
+ const showOpenInApp = isMobile && !wallet.isInstalled && wallet.supportsMobileBrowse !== false && walletPlatformAllowed;
64166
+ const isPending = pendingMobileWallet?.id === wallet.id;
64167
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
64168
+ "button",
64169
+ {
64170
+ onClick: () => void handleWalletClick(wallet),
64171
+ disabled: isWalletConnecting || !!pendingMobileWallet,
64172
+ 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",
64173
+ style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` },
64174
+ children: [
64175
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
64176
+ 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" }),
64177
+ /* @__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 })
64178
+ ] }),
64179
+ 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: [
64180
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: showOpenInApp ? "Open" : "Install" }),
64181
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ExternalLink, { className: "uf-w-3 uf-h-3", style: { color: colors2.foregroundMuted } })
64182
+ ] })
64183
+ ]
64184
+ },
64185
+ wallet.id
64186
+ );
64187
+ }) }),
63935
64188
  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 })
63936
64189
  ] })
63937
64190
  ] });
63938
64191
  }
64192
+ const preConnectAccent = selectedWalletDef ? getWalletBrandColor(selectedWalletDef.id, mode) : void 0;
64193
+ const preConnectFg = preConnectAccent ? getContrastingTextColor(preConnectAccent) : void 0;
63939
64194
  if (view === "select_network" && selectedWalletDef) {
63940
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: viewTransitionStyle, children: [
64195
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: viewTransitionStyle, children: [
63941
64196
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DepositHeader, { title: "Select Network", showBack: true, onBack: handleBack, onClose }),
63942
64197
  /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-pb-4", children: [
63943
64198
  /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-pb-4", children: [
@@ -63967,10 +64222,10 @@ function WalletConnect({
63967
64222
  )) }),
63968
64223
  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 })
63969
64224
  ] })
63970
- ] });
64225
+ ] }) });
63971
64226
  }
63972
64227
  if (view === "connecting") {
63973
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: viewTransitionStyle, children: [
64228
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: viewTransitionStyle, children: [
63974
64229
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DepositHeader, { title: "Connecting...", showBack: true, onBack: handleBack, onClose }),
63975
64230
  /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-16", children: [
63976
64231
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(LoaderCircle, { className: "uf-w-12 uf-h-12 uf-animate-spin uf-mb-4", style: { color: colors2.primary } }),
@@ -63981,24 +64236,132 @@ function WalletConnect({
63981
64236
  ] }),
63982
64237
  /* @__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" })
63983
64238
  ] })
63984
- ] });
64239
+ ] }) });
64240
+ }
64241
+ if (view === "mobile_redirect" && mobileRedirect) {
64242
+ const Icon22 = WALLET_ICONS3[mobileRedirect.walletId];
64243
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: viewTransitionStyle, children: [
64244
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DepositHeader, { title: mobileRedirect.walletName, showBack: true, onBack: handleBack, onClose }),
64245
+ /* @__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: [
64246
+ 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" }),
64247
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
64248
+ "div",
64249
+ {
64250
+ className: "uf-text-base uf-font-medium uf-text-center uf-mb-1",
64251
+ style: { color: colors2.foreground, fontFamily: fonts.medium },
64252
+ children: [
64253
+ "Continue in ",
64254
+ mobileRedirect.walletName
64255
+ ]
64256
+ }
64257
+ ),
64258
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
64259
+ "div",
64260
+ {
64261
+ className: "uf-text-sm uf-text-center uf-mb-6",
64262
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
64263
+ children: [
64264
+ "Complete your deposit in the ",
64265
+ mobileRedirect.walletName,
64266
+ " app"
64267
+ ]
64268
+ }
64269
+ ),
64270
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
64271
+ "button",
64272
+ {
64273
+ type: "button",
64274
+ onClick: () => {
64275
+ window.location.href = mobileRedirect.deeplink;
64276
+ },
64277
+ 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",
64278
+ style: {
64279
+ backgroundColor: components.card.backgroundColor,
64280
+ borderRadius: components.card.borderRadius,
64281
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`,
64282
+ color: components.card.titleColor,
64283
+ fontFamily: fonts.medium
64284
+ },
64285
+ children: [
64286
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ExternalLink, { className: "uf-w-4 uf-h-4", style: { color: components.card.iconColor } }),
64287
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "uf-text-sm uf-font-medium", children: [
64288
+ "Open in ",
64289
+ mobileRedirect.walletName
64290
+ ] })
64291
+ ]
64292
+ }
64293
+ ),
64294
+ awaitingMobileDeposit && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-center uf-gap-2 uf-mt-6", children: [
64295
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
64296
+ LoaderCircle,
64297
+ {
64298
+ className: "uf-w-4 uf-h-4 uf-animate-spin",
64299
+ style: { color: colors2.foregroundMuted }
64300
+ }
64301
+ ),
64302
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
64303
+ "span",
64304
+ {
64305
+ className: "uf-text-sm",
64306
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
64307
+ children: "Checking for deposit..."
64308
+ }
64309
+ )
64310
+ ] })
64311
+ ] })
64312
+ ] }) });
64313
+ }
64314
+ if (view === "mobile_deposit_status" && latestDepositExecution) {
64315
+ const isComplete = latestDepositExecution.status === ExecutionStatus.SUCCEEDED;
64316
+ const isFailed = latestDepositExecution.status === ExecutionStatus.FAILED;
64317
+ const title = isComplete ? "Payment Complete" : isFailed ? "Payment Failed" : "Payment Processing";
64318
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: viewTransitionStyle, children: [
64319
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
64320
+ DepositHeader,
64321
+ {
64322
+ title,
64323
+ showBack: false,
64324
+ onClose: isComplete && onDone ? onDone : onClose
64325
+ }
64326
+ ),
64327
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DepositDetailContent, { execution: latestDepositExecution }),
64328
+ 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)(
64329
+ "button",
64330
+ {
64331
+ type: "button",
64332
+ onClick: onDone ? onDone : onNewDeposit ? onNewDeposit : onClose ?? (() => {
64333
+ }),
64334
+ className: "uf-flex-1 uf-py-4 uf-text-sm uf-font-medium uf-transition-opacity hover:uf-opacity-80",
64335
+ style: {
64336
+ backgroundColor: colors2.primary,
64337
+ color: colors2.primaryForeground,
64338
+ fontFamily: fonts.medium,
64339
+ borderRadius: components.button.borderRadius,
64340
+ border: `${components.button.borderWidth}px solid ${components.button.borderColor}`
64341
+ },
64342
+ children: "Done"
64343
+ }
64344
+ ) })
64345
+ ] }) });
63985
64346
  }
63986
64347
  if (!hasWallet) return null;
64348
+ const walletAccent = getWalletBrandColor(walletInfo.type, mode);
64349
+ const walletAccentForeground = walletAccent ? getContrastingTextColor(walletAccent) : void 0;
63987
64350
  if (view === "select_token") {
63988
- 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 ?? (() => {
63989
- }), onDisconnectWallet: onWalletDisconnect ? () => void handleDisconnect() : void 0, isDisconnectingWallet, checkoutAmountUsd, checkoutReceivedUsd }) });
64351
+ 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 ?? (() => {
64352
+ }), onDisconnectWallet: onWalletDisconnect ? () => void handleDisconnect() : void 0, isDisconnectingWallet, checkoutAmountUsd, checkoutReceivedUsd }) }) });
63990
64353
  }
63991
64354
  if (view === "enter_amount" && selectedToken && selectedBalance) {
63992
- 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 ?? (() => {
63993
- }), quickSelectMode: amountQuickSelect, checkoutAmountUsd, checkoutReceivedUsd }) });
64355
+ 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 ?? (() => {
64356
+ }), quickSelectMode: amountQuickSelect, checkoutAmountUsd, checkoutReceivedUsd }) }) });
63994
64357
  }
63995
64358
  if (view === "review" && selectedToken) {
63996
- 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 ?? (() => {
63997
- }) }) });
64359
+ 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 ?? (() => {
64360
+ }) }) }) });
63998
64361
  }
63999
64362
  if (view === "confirming") {
64000
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ConfirmingView, { isConfirming, onClose: onClose ?? (() => {
64001
- }), executions: depositExecutions, isPolling, onNewDeposit, onDone, paymentIntentStatus, amountReceivedUsd: checkoutReceivedUsd, amountReceivedUsdAtSubmission: receivedUsdAtSubmission }) });
64363
+ 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 ?? (() => {
64364
+ }), executions: depositExecutions, isPolling, onNewDeposit, onDone, paymentIntentStatus, amountReceivedUsd: checkoutReceivedUsd, amountReceivedUsdAtSubmission: receivedUsdAtSubmission }) }) });
64002
64365
  }
64003
64366
  return null;
64004
64367
  }
@@ -64110,7 +64473,6 @@ function DepositModal({
64110
64473
  const [allExecutions, setAllExecutions] = (0, import_react3.useState)([]);
64111
64474
  const [selectedExecution, setSelectedExecution] = (0, import_react3.useState)(null);
64112
64475
  const [depositExecutions, setDepositExecutions] = (0, import_react3.useState)([]);
64113
- const isMobileView = useIsMobileViewport();
64114
64476
  const { projectConfig } = useProjectConfig({
64115
64477
  publishableKey,
64116
64478
  enabled: open
@@ -64506,7 +64868,7 @@ function DepositModal({
64506
64868
  open: hideOverlay || open,
64507
64869
  onOpenChange: hideOverlay ? void 0 : handleClose,
64508
64870
  modal: !hideOverlay,
64509
- children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64871
+ children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
64510
64872
  DialogContent2,
64511
64873
  {
64512
64874
  ref: hideOverlay ? containerCallbackRef : void 0,
@@ -64515,386 +64877,389 @@ function DepositModal({
64515
64877
  style: { backgroundColor: colors2.background },
64516
64878
  onPointerDownOutside: (e) => e.preventDefault(),
64517
64879
  onInteractOutside: (e) => e.preventDefault(),
64518
- children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ThemeStyleInjector, { children: view === "main" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64519
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64520
- DepositHeader,
64521
- {
64522
- title: modalTitle || "Deposit",
64523
- showClose: !hideOverlay,
64524
- onClose: handleClose,
64525
- showBalance: showBalanceHeader,
64526
- balanceAddress: recipientAddress,
64527
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
64528
- balanceChainId: destinationChainId,
64529
- balanceTokenAddress: destinationTokenAddress,
64530
- projectName: projectConfig?.project_name,
64531
- publishableKey
64532
- }
64533
- ),
64534
- /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64535
- /* @__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: [
64536
- showTransferCrypto && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64537
- TransferCryptoButton,
64538
- {
64539
- onClick: () => setView("transfer"),
64540
- title: transferCryptoTitle,
64541
- subtitle: t7.transferCrypto.subtitle,
64542
- featuredTokens: projectConfig?.transfer_crypto.networks
64543
- }
64544
- ),
64545
- showConnectWallet && !isMobileView && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64546
- BrowserWalletButton,
64880
+ children: [
64881
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DialogTitle2, { className: "uf-sr-only", children: modalTitle || "Deposit" }),
64882
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ThemeStyleInjector, { children: view === "main" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64883
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64884
+ DepositHeader,
64885
+ {
64886
+ title: modalTitle || "Deposit",
64887
+ showClose: !hideOverlay,
64888
+ onClose: handleClose,
64889
+ showBalance: showBalanceHeader,
64890
+ balanceAddress: recipientAddress,
64891
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
64892
+ balanceChainId: destinationChainId,
64893
+ balanceTokenAddress: destinationTokenAddress,
64894
+ projectName: projectConfig?.project_name,
64895
+ publishableKey
64896
+ }
64897
+ ),
64898
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64899
+ /* @__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: [
64900
+ showTransferCrypto && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64901
+ TransferCryptoButton,
64902
+ {
64903
+ onClick: () => setView("transfer"),
64904
+ title: transferCryptoTitle,
64905
+ subtitle: t7.transferCrypto.subtitle,
64906
+ featuredTokens: projectConfig?.transfer_crypto.networks
64907
+ }
64908
+ ),
64909
+ showConnectWallet && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64910
+ BrowserWalletButton,
64911
+ {
64912
+ onClick: handleBrowserWalletClick,
64913
+ onConnectClick: handleWalletConnectClick,
64914
+ onDisconnect: handleWalletDisconnect,
64915
+ chainType: browserWalletChainType,
64916
+ publishableKey,
64917
+ featuredWallets: projectConfig?.connect_wallet?.wallets
64918
+ }
64919
+ ),
64920
+ showFiatOnramp && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64921
+ DepositWithCardButton,
64922
+ {
64923
+ onClick: () => setView("card"),
64924
+ title: depositWithCardTitle,
64925
+ subtitle: t7.depositWithCard.subtitle,
64926
+ paymentNetworks: projectConfig?.payment_networks.networks
64927
+ }
64928
+ ),
64929
+ showPayWithExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64930
+ PayWithExchangeButton,
64931
+ {
64932
+ onClick: () => setView("exchange"),
64933
+ title: payWithExchangeTitle,
64934
+ subtitle: t7.payWithExchange.subtitle,
64935
+ exchanges,
64936
+ loading: exchangesLoading
64937
+ }
64938
+ ),
64939
+ showConnectExchange && connectedExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64940
+ ConnectExchangeButton,
64941
+ {
64942
+ onClick: () => {
64943
+ setCoinbaseSkipToHoldings(true);
64944
+ setView("coinbase_connect");
64945
+ },
64946
+ onDisconnect: handleExchangeDisconnect,
64947
+ title: i18n2.connectExchange.title,
64948
+ subtitle: i18n2.connectExchange.subtitle,
64949
+ exchanges: integrationExchanges,
64950
+ connectedExchange
64951
+ }
64952
+ ),
64953
+ showConnectExchange && !connectedExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64954
+ ConnectExchangeButton,
64955
+ {
64956
+ onClick: () => {
64957
+ setCoinbaseSkipToHoldings(false);
64958
+ setView("coinbase_connect");
64959
+ },
64960
+ title: i18n2.connectExchange.title,
64961
+ subtitle: i18n2.connectExchange.subtitle,
64962
+ exchanges: integrationExchanges
64963
+ }
64964
+ ),
64965
+ showCashApp && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64966
+ CashAppButton,
64967
+ {
64968
+ onClick: () => setView("cashapp"),
64969
+ title: "Pay with Cash App",
64970
+ subtitle: "Deposit via Cash App",
64971
+ iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0
64972
+ }
64973
+ ),
64974
+ showDepositTracker && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64975
+ DepositTrackerButton,
64976
+ {
64977
+ onClick: () => {
64978
+ setAllExecutions(depositExecutions);
64979
+ setView("tracker");
64980
+ },
64981
+ title: depositTrackerTitle,
64982
+ subtitle: depositTrackerSubTitle,
64983
+ badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
64984
+ }
64985
+ )
64986
+ ] }) }),
64987
+ depositPoweredByFooter
64988
+ ] })
64989
+ ] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64990
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64991
+ DepositHeader,
64992
+ {
64993
+ title: transferCryptoTitle,
64994
+ showBack: showBackTransfer,
64995
+ onBack: handleBack,
64996
+ onClose: handleClose,
64997
+ showBalance: showBalanceHeader,
64998
+ balanceAddress: recipientAddress,
64999
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
65000
+ balanceChainId: destinationChainId,
65001
+ balanceTokenAddress: destinationTokenAddress,
65002
+ projectName: projectConfig?.project_name,
65003
+ publishableKey
65004
+ }
65005
+ ),
65006
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65007
+ 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)(
65008
+ TransferCryptoSingleInput,
64547
65009
  {
64548
- onClick: handleBrowserWalletClick,
64549
- onConnectClick: handleWalletConnectClick,
64550
- onDisconnect: handleWalletDisconnect,
64551
- chainType: browserWalletChainType,
65010
+ userId,
64552
65011
  publishableKey,
64553
- featuredWallets: projectConfig?.connect_wallet?.wallets
65012
+ recipientAddress,
65013
+ destinationChainType,
65014
+ destinationChainId,
65015
+ destinationTokenAddress,
65016
+ defaultSourceChainType,
65017
+ defaultSourceChainId,
65018
+ defaultSourceTokenAddress,
65019
+ defaultSourceSymbol,
65020
+ depositConfirmationMode,
65021
+ onExecutionsChange: setDepositExecutions,
65022
+ onDepositSuccess,
65023
+ onDepositError,
65024
+ wallets
64554
65025
  }
64555
- ),
64556
- showFiatOnramp && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64557
- DepositWithCardButton,
65026
+ ) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65027
+ TransferCryptoDoubleInput,
64558
65028
  {
64559
- onClick: () => setView("card"),
64560
- title: depositWithCardTitle,
64561
- subtitle: t7.depositWithCard.subtitle,
64562
- paymentNetworks: projectConfig?.payment_networks.networks
65029
+ userId,
65030
+ publishableKey,
65031
+ recipientAddress,
65032
+ destinationChainType,
65033
+ destinationChainId,
65034
+ destinationTokenAddress,
65035
+ defaultSourceChainType,
65036
+ defaultSourceChainId,
65037
+ defaultSourceTokenAddress,
65038
+ defaultSourceSymbol,
65039
+ depositConfirmationMode,
65040
+ onExecutionsChange: setDepositExecutions,
65041
+ onDepositSuccess,
65042
+ onDepositError,
65043
+ wallets
64563
65044
  }
64564
65045
  ),
64565
- showPayWithExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64566
- PayWithExchangeButton,
65046
+ depositPoweredByFooter
65047
+ ] })
65048
+ ] }) : view === "tracker" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
65049
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65050
+ DepositHeader,
65051
+ {
65052
+ title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
65053
+ showBack: showBackTracker,
65054
+ onBack: handleBack,
65055
+ onClose: handleClose
65056
+ }
65057
+ ),
65058
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65059
+ /* @__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)(
65060
+ "div",
64567
65061
  {
64568
- onClick: () => setView("exchange"),
64569
- title: payWithExchangeTitle,
64570
- subtitle: t7.payWithExchange.subtitle,
64571
- exchanges,
64572
- loading: exchangesLoading
65062
+ className: "uf-text-sm",
65063
+ style: { color: components.container.subtitleColor, fontFamily: fonts.regular },
65064
+ children: "No deposits yet"
64573
65065
  }
64574
- ),
64575
- showConnectExchange && connectedExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64576
- ConnectExchangeButton,
65066
+ ) }) : allExecutions.map((execution) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65067
+ DepositExecutionItem,
64577
65068
  {
64578
- onClick: () => {
64579
- setCoinbaseSkipToHoldings(true);
64580
- setView("coinbase_connect");
64581
- },
64582
- onDisconnect: handleExchangeDisconnect,
64583
- title: i18n2.connectExchange.title,
64584
- subtitle: i18n2.connectExchange.subtitle,
64585
- exchanges: integrationExchanges,
64586
- connectedExchange
64587
- }
64588
- ),
64589
- showConnectExchange && !connectedExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64590
- ConnectExchangeButton,
65069
+ execution,
65070
+ onClick: () => setSelectedExecution(execution)
65071
+ },
65072
+ execution.id
65073
+ )) }) }),
65074
+ depositPoweredByFooter
65075
+ ] })
65076
+ ] }) : view === "card" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
65077
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65078
+ DepositHeader,
65079
+ {
65080
+ title: cardView === "quotes" ? t7.quotes : depositWithCardTitle,
65081
+ showBack: showBackCard,
65082
+ onBack: handleBack,
65083
+ onClose: handleClose,
65084
+ badge: cardView === "quotes" ? { count: quotesCount } : void 0,
65085
+ showBalance: showBalanceHeader,
65086
+ balanceAddress: recipientAddress,
65087
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
65088
+ balanceChainId: destinationChainId,
65089
+ balanceTokenAddress: destinationTokenAddress,
65090
+ projectName: projectConfig?.project_name,
65091
+ publishableKey
65092
+ }
65093
+ ),
65094
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65095
+ 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)(
65096
+ BuyWithCard,
64591
65097
  {
64592
- onClick: () => {
64593
- setCoinbaseSkipToHoldings(false);
64594
- setView("coinbase_connect");
64595
- },
64596
- title: i18n2.connectExchange.title,
64597
- subtitle: i18n2.connectExchange.subtitle,
64598
- exchanges: integrationExchanges
65098
+ userId,
65099
+ publishableKey,
65100
+ view: cardView,
65101
+ onViewChange: handleCardViewChange,
65102
+ destinationTokenSymbol,
65103
+ recipientAddress,
65104
+ destinationChainType,
65105
+ destinationChainId,
65106
+ destinationTokenAddress,
65107
+ onDepositSuccess,
65108
+ onDepositError,
65109
+ onEvent,
65110
+ themeClass,
65111
+ wallets,
65112
+ assetCdnUrl: projectConfig?.asset_cdn_url,
65113
+ hideDepositFlowInfo,
65114
+ hideDisplayDescription
64599
65115
  }
64600
65116
  ),
64601
- showCashApp && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64602
- CashAppButton,
65117
+ depositPoweredByFooter
65118
+ ] })
65119
+ ] }) : view === "exchange" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
65120
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65121
+ DepositHeader,
65122
+ {
65123
+ title: payWithExchangeTitle,
65124
+ showBack: exchangeView === "pending" || sessionOpenedFromMenu,
65125
+ onBack: handleBack,
65126
+ onClose: handleClose
65127
+ }
65128
+ ),
65129
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65130
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65131
+ PayWithExchange,
64603
65132
  {
64604
- onClick: () => setView("cashapp"),
64605
- title: "Pay with Cash App",
64606
- subtitle: "Deposit via Cash App",
64607
- iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0
65133
+ userId,
65134
+ publishableKey,
65135
+ exchanges,
65136
+ view: exchangeView,
65137
+ onViewChange: setExchangeView,
65138
+ destinationTokenSymbol,
65139
+ recipientAddress,
65140
+ destinationChainType,
65141
+ destinationChainId,
65142
+ destinationTokenAddress,
65143
+ onDepositSuccess,
65144
+ onDepositError,
65145
+ wallets,
65146
+ defaultToken: defaultToken ?? null
64608
65147
  }
64609
65148
  ),
64610
- showDepositTracker && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64611
- DepositTrackerButton,
64612
- {
64613
- onClick: () => {
64614
- setAllExecutions(depositExecutions);
64615
- setView("tracker");
64616
- },
64617
- title: depositTrackerTitle,
64618
- subtitle: depositTrackerSubTitle,
64619
- badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
64620
- }
64621
- )
64622
- ] }) }),
64623
- depositPoweredByFooter
64624
- ] })
64625
- ] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64626
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64627
- DepositHeader,
64628
- {
64629
- title: transferCryptoTitle,
64630
- showBack: showBackTransfer,
64631
- onBack: handleBack,
64632
- onClose: handleClose,
64633
- showBalance: showBalanceHeader,
64634
- balanceAddress: recipientAddress,
64635
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
64636
- balanceChainId: destinationChainId,
64637
- balanceTokenAddress: destinationTokenAddress,
64638
- projectName: projectConfig?.project_name,
64639
- publishableKey
64640
- }
64641
- ),
64642
- /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64643
- 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)(
64644
- TransferCryptoSingleInput,
65149
+ depositPoweredByFooter
65150
+ ] })
65151
+ ] }) : view === "coinbase_connect" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65152
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65153
+ CoinbaseConnect,
64645
65154
  {
64646
- userId,
64647
65155
  publishableKey,
64648
- recipientAddress,
64649
- destinationChainType,
64650
- destinationChainId,
64651
- destinationTokenAddress,
64652
- defaultSourceChainType,
64653
- defaultSourceChainId,
64654
- defaultSourceTokenAddress,
64655
- defaultSourceSymbol,
64656
- depositConfirmationMode,
64657
- onExecutionsChange: setDepositExecutions,
64658
- onDepositSuccess,
64659
- onDepositError,
64660
- wallets
64661
- }
64662
- ) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64663
- TransferCryptoDoubleInput,
64664
- {
64665
65156
  userId,
64666
- publishableKey,
65157
+ wallets,
64667
65158
  recipientAddress,
64668
- destinationChainType,
64669
- destinationChainId,
64670
- destinationTokenAddress,
65159
+ destinationTokenAddress: destinationTokenAddress ?? "",
65160
+ destinationChainId: destinationChainId ?? "",
65161
+ destinationChainType: destinationChainType ?? "",
65162
+ onTransferSuccess: (result) => {
65163
+ onDepositSuccess?.({
65164
+ message: "Transfer completed via Coinbase Connect",
65165
+ transaction: result
65166
+ });
65167
+ },
65168
+ onTransferError: (error) => {
65169
+ onDepositError?.({
65170
+ message: error.message,
65171
+ error
65172
+ });
65173
+ },
65174
+ onBack: handleBack,
65175
+ onClose: handleClose,
65176
+ onDisconnect: handleExchangeDisconnect,
65177
+ skipToHoldings: coinbaseSkipToHoldings,
65178
+ canGoBack: sessionOpenedFromMenu,
65179
+ onExecutionsChange: setDepositExecutions,
64671
65180
  defaultSourceChainType,
64672
65181
  defaultSourceChainId,
64673
65182
  defaultSourceTokenAddress,
64674
- defaultSourceSymbol,
64675
- depositConfirmationMode,
64676
- onExecutionsChange: setDepositExecutions,
64677
- onDepositSuccess,
64678
- onDepositError,
64679
- wallets
65183
+ defaultSourceSymbol
64680
65184
  }
64681
65185
  ),
64682
65186
  depositPoweredByFooter
64683
- ] })
64684
- ] }) : view === "tracker" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64685
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64686
- DepositHeader,
64687
- {
64688
- title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
64689
- showBack: showBackTracker,
64690
- onBack: handleBack,
64691
- onClose: handleClose
64692
- }
64693
- ),
64694
- /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64695
- /* @__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)(
64696
- "div",
64697
- {
64698
- className: "uf-text-sm",
64699
- style: { color: components.container.subtitleColor, fontFamily: fonts.regular },
64700
- children: "No deposits yet"
64701
- }
64702
- ) }) : allExecutions.map((execution) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64703
- DepositExecutionItem,
64704
- {
64705
- execution,
64706
- onClick: () => setSelectedExecution(execution)
64707
- },
64708
- execution.id
64709
- )) }) }),
64710
- depositPoweredByFooter
64711
- ] })
64712
- ] }) : view === "card" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64713
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64714
- DepositHeader,
64715
- {
64716
- title: cardView === "quotes" ? t7.quotes : depositWithCardTitle,
64717
- showBack: showBackCard,
64718
- onBack: handleBack,
64719
- onClose: handleClose,
64720
- badge: cardView === "quotes" ? { count: quotesCount } : void 0,
64721
- showBalance: showBalanceHeader,
64722
- balanceAddress: recipientAddress,
64723
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
64724
- balanceChainId: destinationChainId,
64725
- balanceTokenAddress: destinationTokenAddress,
64726
- projectName: projectConfig?.project_name,
64727
- publishableKey
64728
- }
64729
- ),
64730
- /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64731
- 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)(
64732
- BuyWithCard,
64733
- {
64734
- userId,
64735
- publishableKey,
64736
- view: cardView,
64737
- onViewChange: handleCardViewChange,
64738
- destinationTokenSymbol,
64739
- recipientAddress,
64740
- destinationChainType,
64741
- destinationChainId,
64742
- destinationTokenAddress,
64743
- onDepositSuccess,
64744
- onDepositError,
64745
- onEvent,
64746
- themeClass,
64747
- wallets,
64748
- assetCdnUrl: projectConfig?.asset_cdn_url,
64749
- hideDepositFlowInfo,
64750
- hideDisplayDescription
64751
- }
64752
- ),
64753
- depositPoweredByFooter
64754
- ] })
64755
- ] }) : view === "exchange" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64756
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64757
- DepositHeader,
64758
- {
64759
- title: payWithExchangeTitle,
64760
- showBack: exchangeView === "pending" || sessionOpenedFromMenu,
64761
- onBack: handleBack,
64762
- onClose: handleClose
64763
- }
64764
- ),
64765
- /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65187
+ ] }) : view === "wallet_connect" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64766
65188
  /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64767
- PayWithExchange,
65189
+ WalletConnect,
64768
65190
  {
65191
+ walletInfo: browserWalletInfo ?? void 0,
65192
+ depositWallet: browserWalletInfo?.depositWallet ?? void 0,
65193
+ wallets,
64769
65194
  userId,
64770
65195
  publishableKey,
64771
- exchanges,
64772
- view: exchangeView,
64773
- onViewChange: setExchangeView,
64774
- destinationTokenSymbol,
64775
- recipientAddress,
64776
- destinationChainType,
64777
- destinationChainId,
64778
- destinationTokenAddress,
65196
+ assetCdnUrl: projectConfig?.asset_cdn_url,
65197
+ projectName: projectConfig?.project_name,
65198
+ onSuccess: (txHash) => {
65199
+ onDepositSuccess?.({
65200
+ message: "Transaction sent successfully",
65201
+ transaction: { txHash }
65202
+ });
65203
+ },
65204
+ onError: (error) => {
65205
+ onDepositError?.({
65206
+ message: error.message,
65207
+ error
65208
+ });
65209
+ },
64779
65210
  onDepositSuccess,
64780
65211
  onDepositError,
64781
- wallets,
64782
- defaultToken: defaultToken ?? null
65212
+ amountQuickSelect: browserWalletAmountQuickSelect,
65213
+ onWalletDisconnect: handleWalletDisconnect,
65214
+ onWalletConnected: (info, dw) => {
65215
+ setBrowserWalletInfo({ ...info, depositWallet: dw });
65216
+ setStoredWalletState(info.type);
65217
+ setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
65218
+ },
65219
+ onBack: handleBack,
65220
+ onClose: handleClose,
65221
+ defaultSourceChainType,
65222
+ defaultSourceChainId,
65223
+ defaultSourceTokenAddress,
65224
+ defaultSourceSymbol,
65225
+ canGoBack: sessionOpenedFromMenu,
65226
+ depositWalletsLoading: walletsLoading
64783
65227
  }
64784
65228
  ),
64785
65229
  depositPoweredByFooter
64786
- ] })
64787
- ] }) : view === "coinbase_connect" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64788
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64789
- CoinbaseConnect,
64790
- {
64791
- publishableKey,
64792
- userId,
64793
- wallets,
64794
- recipientAddress,
64795
- destinationTokenAddress: destinationTokenAddress ?? "",
64796
- destinationChainId: destinationChainId ?? "",
64797
- destinationChainType: destinationChainType ?? "",
64798
- onTransferSuccess: (result) => {
64799
- onDepositSuccess?.({
64800
- message: "Transfer completed via Coinbase Connect",
64801
- transaction: result
64802
- });
64803
- },
64804
- onTransferError: (error) => {
64805
- onDepositError?.({
64806
- message: error.message,
64807
- error
64808
- });
64809
- },
64810
- onBack: handleBack,
64811
- onClose: handleClose,
64812
- onDisconnect: handleExchangeDisconnect,
64813
- skipToHoldings: coinbaseSkipToHoldings,
64814
- canGoBack: sessionOpenedFromMenu,
64815
- onExecutionsChange: setDepositExecutions,
64816
- defaultSourceChainType,
64817
- defaultSourceChainId,
64818
- defaultSourceTokenAddress,
64819
- defaultSourceSymbol
64820
- }
64821
- ),
64822
- depositPoweredByFooter
64823
- ] }) : view === "wallet_connect" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64824
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64825
- WalletConnect,
64826
- {
64827
- walletInfo: browserWalletInfo ?? void 0,
64828
- depositWallet: browserWalletInfo?.depositWallet ?? void 0,
64829
- wallets,
64830
- userId,
64831
- publishableKey,
64832
- assetCdnUrl: projectConfig?.asset_cdn_url,
64833
- projectName: projectConfig?.project_name,
64834
- onSuccess: (txHash) => {
64835
- onDepositSuccess?.({
64836
- message: "Transaction sent successfully",
64837
- transaction: { txHash }
64838
- });
64839
- },
64840
- onError: (error) => {
64841
- onDepositError?.({
64842
- message: error.message,
64843
- error
64844
- });
64845
- },
64846
- onDepositSuccess,
64847
- onDepositError,
64848
- amountQuickSelect: browserWalletAmountQuickSelect,
64849
- onWalletDisconnect: handleWalletDisconnect,
64850
- onWalletConnected: (info, dw) => {
64851
- setBrowserWalletInfo({ ...info, depositWallet: dw });
64852
- setStoredWalletState(info.type);
64853
- setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
64854
- },
64855
- onBack: handleBack,
64856
- onClose: handleClose,
64857
- defaultSourceChainType,
64858
- defaultSourceChainId,
64859
- defaultSourceTokenAddress,
64860
- defaultSourceSymbol,
64861
- canGoBack: sessionOpenedFromMenu,
64862
- depositWalletsLoading: walletsLoading
64863
- }
64864
- ),
64865
- depositPoweredByFooter
64866
- ] }) : view === "cashapp" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64867
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64868
- DepositHeader,
64869
- {
64870
- title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
64871
- showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
64872
- onBack: handleBack,
64873
- onClose: handleClose
64874
- }
64875
- ),
64876
- /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65230
+ ] }) : view === "cashapp" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64877
65231
  /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64878
- PayWithCashApp,
65232
+ DepositHeader,
64879
65233
  {
64880
- userId,
64881
- publishableKey,
64882
- recipientAddress,
64883
- destinationChainType,
64884
- destinationChainId,
64885
- destinationTokenAddress,
64886
- cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
64887
- view: cashAppView,
64888
- onViewChange: setCashAppView,
64889
- onAmountChange: setCashAppAmount,
64890
- onEvent,
64891
- onDepositSuccess,
64892
- onDepositError
65234
+ title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
65235
+ showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
65236
+ onBack: handleBack,
65237
+ onClose: handleClose
64893
65238
  }
64894
65239
  ),
64895
- depositPoweredByFooter
64896
- ] })
64897
- ] }) : null })
65240
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
65241
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65242
+ PayWithCashApp,
65243
+ {
65244
+ userId,
65245
+ publishableKey,
65246
+ recipientAddress,
65247
+ destinationChainType,
65248
+ destinationChainId,
65249
+ destinationTokenAddress,
65250
+ cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
65251
+ view: cashAppView,
65252
+ onViewChange: setCashAppView,
65253
+ onAmountChange: setCashAppAmount,
65254
+ onEvent,
65255
+ onDepositSuccess,
65256
+ onDepositError
65257
+ }
65258
+ ),
65259
+ depositPoweredByFooter
65260
+ ] })
65261
+ ] }) : null })
65262
+ ]
64898
65263
  }
64899
65264
  )
64900
65265
  }
@@ -64979,7 +65344,6 @@ function CheckoutModal({
64979
65344
  const [browserWalletInfo, setBrowserWalletInfo] = (0, import_react29.useState)(null);
64980
65345
  const [walletSelectionModalOpen, setWalletSelectionModalOpen] = (0, import_react29.useState)(false);
64981
65346
  const [browserWalletChainType, setBrowserWalletChainType] = (0, import_react29.useState)(() => getStoredWalletState()?.chainType);
64982
- const isMobileView = useIsMobileViewport();
64983
65347
  const [resolvedTheme, setResolvedTheme] = (0, import_react29.useState)(
64984
65348
  theme === "auto" ? "dark" : theme
64985
65349
  );
@@ -65405,7 +65769,7 @@ function CheckoutModal({
65405
65769
  featuredTokens: projectConfig?.transfer_crypto.networks
65406
65770
  }
65407
65771
  ),
65408
- showConnectWallet && !isMobileView && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
65772
+ showConnectWallet && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
65409
65773
  BrowserWalletButton,
65410
65774
  {
65411
65775
  onClick: handleBrowserWalletClick,
@@ -67311,6 +67675,16 @@ function UnifoldProvider2({
67311
67675
  });
67312
67676
  promise.catch(() => {
67313
67677
  });
67678
+ if (!config2.recipientAddress) {
67679
+ const error = {
67680
+ message: "beginDeposit requires a `recipientAddress`.",
67681
+ code: "MISSING_RECIPIENT"
67682
+ };
67683
+ console.error(`[UnifoldProvider] ${error.message}`);
67684
+ depositPromiseRef.current.reject(error);
67685
+ depositPromiseRef.current = null;
67686
+ return promise;
67687
+ }
67314
67688
  setDepositConfig(config2);
67315
67689
  setIsOpen(true);
67316
67690
  return promise;