@unifold/connect-react 0.1.68-beta.2 → 0.1.69

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
@@ -1144,7 +1144,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
1144
1144
  });
1145
1145
 
1146
1146
  // src/provider.tsx
1147
- import React38, { useState as useState39, useCallback as useCallback13, useMemo as useMemo18, useEffect as useEffect40 } from "react";
1147
+ import React38, { useState as useState39, useCallback as useCallback14, useMemo as useMemo19, useEffect as useEffect40 } from "react";
1148
1148
 
1149
1149
  // ../react-provider/dist/index.mjs
1150
1150
  import { createContext, useContext, useState, useEffect, useMemo, useRef } from "react";
@@ -1216,9 +1216,9 @@ import {
1216
1216
  useState as useState40,
1217
1217
  useEffect as useEffect34,
1218
1218
  useLayoutEffect as useLayoutEffect22,
1219
- useCallback as useCallback82,
1220
- useRef as useRef122,
1221
- useMemo as useMemo13
1219
+ useCallback as useCallback10,
1220
+ useRef as useRef132,
1221
+ useMemo as useMemo14
1222
1222
  } from "react";
1223
1223
 
1224
1224
  // ../../node_modules/.pnpm/lucide-react@0.454.0_react@19.2.3/node_modules/lucide-react/dist/esm/createLucideIcon.js
@@ -6136,7 +6136,9 @@ import { jsx as jsx17 } from "react/jsx-runtime";
6136
6136
  import * as React211 from "react";
6137
6137
  import { jsx as jsx23, jsxs as jsxs4 } from "react/jsx-runtime";
6138
6138
  import { jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
6139
+ import * as React52 from "react";
6139
6140
  import { useState as useState102, useEffect as useEffect62, useRef as useRef22 } from "react";
6141
+ import { useQuery as useQuery3 } from "@tanstack/react-query";
6140
6142
 
6141
6143
  // ../core/dist/index.mjs
6142
6144
  import { useQuery } from "@tanstack/react-query";
@@ -6430,6 +6432,27 @@ async function getFiatCurrencies(publishableKey) {
6430
6432
  }
6431
6433
  return response.json();
6432
6434
  }
6435
+ async function getFiatExchangeRates(options = {}, publishableKey) {
6436
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
6437
+ validatePublishableKey(pk);
6438
+ const params = new URLSearchParams();
6439
+ if (options.currencies && options.currencies.length > 0) {
6440
+ params.set("currencies", options.currencies.join(","));
6441
+ }
6442
+ const queryString = params.toString();
6443
+ const url = `${API_BASE_URL}/v1/public/exchange_rates/fiat_currencies${queryString ? `?${queryString}` : ""}`;
6444
+ const response = await fetch(url, {
6445
+ method: "GET",
6446
+ headers: {
6447
+ accept: "application/json",
6448
+ "x-publishable-key": pk
6449
+ }
6450
+ });
6451
+ if (!response.ok) {
6452
+ throw new Error(`Failed to fetch fiat exchange rates: ${response.statusText}`);
6453
+ }
6454
+ return response.json();
6455
+ }
6433
6456
  async function getOnrampQuotes(request, publishableKey) {
6434
6457
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
6435
6458
  validatePublishableKey(pk);
@@ -7111,6 +7134,7 @@ async function stripeGetDefaultToken(params, publishableKey) {
7111
7134
  chain_type: params.chainType
7112
7135
  });
7113
7136
  if (params.countryCode) query.append("country_code", params.countryCode);
7137
+ if (params.subdivisionCode) query.append("subdivision_code", params.subdivisionCode);
7114
7138
  const response = await fetch(
7115
7139
  `${API_BASE_URL}${HEADLESS_STRIPE_BASE}/default_token?${query.toString()}`,
7116
7140
  {
@@ -7768,34 +7792,34 @@ import { jsx as jsx92, jsxs as jsxs8 } from "react/jsx-runtime";
7768
7792
  import { Fragment as Fragment23, jsx as jsx102, jsxs as jsxs9 } from "react/jsx-runtime";
7769
7793
  import { jsx as jsx112 } from "react/jsx-runtime";
7770
7794
  import { jsx as jsx122, jsxs as jsxs10 } from "react/jsx-runtime";
7771
- import * as React52 from "react";
7772
- import { useCallback as useCallback10, useEffect as useEffect72, useMemo as useMemo32, useRef as useRef32, useState as useState112 } from "react";
7773
- import { useQuery as useQuery3 } from "@tanstack/react-query";
7774
- import { useMemo as useMemo22 } from "react";
7795
+ import * as React62 from "react";
7796
+ import { useCallback as useCallback22, useEffect as useEffect72, useMemo as useMemo42, useRef as useRef32, useState as useState112 } from "react";
7775
7797
  import { useQuery as useQuery4 } from "@tanstack/react-query";
7798
+ import { useMemo as useMemo32 } from "react";
7776
7799
  import { useQuery as useQuery5 } from "@tanstack/react-query";
7800
+ import { useQuery as useQuery6 } from "@tanstack/react-query";
7777
7801
  import { Fragment as Fragment42, jsx as jsx132, jsxs as jsxs11 } from "react/jsx-runtime";
7778
7802
  import { useState as useState122 } from "react";
7779
7803
  import { jsx as jsx142, jsxs as jsxs12 } from "react/jsx-runtime";
7780
- import { useState as useState152, useEffect as useEffect102, useCallback as useCallback22 } from "react";
7804
+ import { useState as useState152, useEffect as useEffect102, useCallback as useCallback32 } from "react";
7781
7805
  var import_qr_code_styling = __toESM(require_qr_code_styling(), 1);
7782
- import { useEffect as useEffect82, useRef as useRef42, useState as useState132, useMemo as useMemo42 } from "react";
7806
+ import { useEffect as useEffect82, useRef as useRef42, useState as useState132, useMemo as useMemo52 } from "react";
7783
7807
  import { jsx as jsx152, jsxs as jsxs13 } from "react/jsx-runtime";
7784
7808
  import { useState as useState142, useEffect as useEffect92 } from "react";
7785
- import { useQuery as useQuery6 } from "@tanstack/react-query";
7786
- import { Fragment as Fragment52, jsx as jsx162, jsxs as jsxs14 } from "react/jsx-runtime";
7787
- import { useEffect as useEffect112, useMemo as useMemo52, useState as useState162 } from "react";
7788
7809
  import { useQuery as useQuery7 } from "@tanstack/react-query";
7810
+ import { Fragment as Fragment52, jsx as jsx162, jsxs as jsxs14 } from "react/jsx-runtime";
7811
+ import { useCallback as useCallback42, useEffect as useEffect112, useMemo as useMemo62, useRef as useRef52, useState as useState162 } from "react";
7812
+ import { useQuery as useQuery8 } from "@tanstack/react-query";
7789
7813
  import { jsx as jsx172, jsxs as jsxs15 } from "react/jsx-runtime";
7790
7814
  import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
7791
- import * as React62 from "react";
7792
- import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
7793
7815
  import * as React72 from "react";
7794
- import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
7816
+ import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
7795
7817
  import * as React82 from "react";
7818
+ import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
7819
+ import * as React92 from "react";
7796
7820
  import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
7821
+ import * as React112 from "react";
7797
7822
  import * as React102 from "react";
7798
- import * as React92 from "react";
7799
7823
 
7800
7824
  // ../../node_modules/.pnpm/@radix-ui+react-slot@1.2.4_@types+react@19.2.9_react@19.2.3/node_modules/@radix-ui/react-slot/dist/index.mjs
7801
7825
  import * as React25 from "react";
@@ -7943,15 +7967,15 @@ var cva = (base, config) => (props) => {
7943
7967
  // ../ui-react/dist/index.mjs
7944
7968
  import { jsx as jsx222 } from "react/jsx-runtime";
7945
7969
  import { jsx as jsx232, jsxs as jsxs20 } from "react/jsx-runtime";
7946
- import * as React112 from "react";
7947
- import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
7948
7970
  import * as React122 from "react";
7949
- import { jsx as jsx25, jsxs as jsxs222 } from "react/jsx-runtime";
7971
+ import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
7950
7972
  import * as React132 from "react";
7951
- import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
7973
+ import { jsx as jsx25, jsxs as jsxs222 } from "react/jsx-runtime";
7952
7974
  import * as React142 from "react";
7975
+ import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
7976
+ import * as React152 from "react";
7953
7977
  import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
7954
- import * as React282 from "react";
7978
+ import * as React292 from "react";
7955
7979
 
7956
7980
  // ../../node_modules/.pnpm/mipd@0.0.7_typescript@5.9.3/node_modules/mipd/dist/esm/utils.js
7957
7981
  function requestProviders(listener) {
@@ -8008,55 +8032,54 @@ function createStore() {
8008
8032
  }
8009
8033
 
8010
8034
  // ../ui-react/dist/index.mjs
8011
- import * as React152 from "react";
8012
8035
  import * as React162 from "react";
8013
- import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
8014
8036
  import * as React172 from "react";
8015
- import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
8037
+ import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
8016
8038
  import * as React182 from "react";
8017
- import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
8039
+ import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
8018
8040
  import * as React192 from "react";
8019
- import { jsx as jsx31, jsxs as jsxs28 } from "react/jsx-runtime";
8041
+ import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
8020
8042
  import * as React202 from "react";
8021
- import { jsx as jsx322, jsxs as jsxs29 } from "react/jsx-runtime";
8043
+ import { jsx as jsx31, jsxs as jsxs28 } from "react/jsx-runtime";
8022
8044
  import * as React212 from "react";
8023
- import { jsx as jsx33, jsxs as jsxs30 } from "react/jsx-runtime";
8045
+ import { jsx as jsx322, jsxs as jsxs29 } from "react/jsx-runtime";
8024
8046
  import * as React222 from "react";
8025
- import { jsx as jsx34, jsxs as jsxs31 } from "react/jsx-runtime";
8047
+ import { jsx as jsx33, jsxs as jsxs30 } from "react/jsx-runtime";
8026
8048
  import * as React232 from "react";
8027
- import { jsx as jsx35, jsxs as jsxs322 } from "react/jsx-runtime";
8049
+ import { jsx as jsx34, jsxs as jsxs31 } from "react/jsx-runtime";
8028
8050
  import * as React242 from "react";
8029
- import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
8051
+ import { jsx as jsx35, jsxs as jsxs322 } from "react/jsx-runtime";
8030
8052
  import * as React252 from "react";
8031
- import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
8053
+ import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
8032
8054
  import * as React262 from "react";
8033
- import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
8055
+ import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
8034
8056
  import * as React272 from "react";
8057
+ import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
8058
+ import * as React282 from "react";
8035
8059
  import { jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
8036
8060
  import { jsx as jsx40, jsxs as jsxs37 } from "react/jsx-runtime";
8037
8061
  import { jsx as jsx41, jsxs as jsxs38 } from "react/jsx-runtime";
8038
- import * as React292 from "react";
8062
+ import * as React302 from "react";
8039
8063
  import { jsx as jsx422, jsxs as jsxs39 } from "react/jsx-runtime";
8040
- import { useState as useState292, useEffect as useEffect242, useCallback as useCallback42, useRef as useRef82 } from "react";
8064
+ import { useState as useState292, useEffect as useEffect242, useCallback as useCallback62, useRef as useRef92 } from "react";
8041
8065
  import { jsx as jsx43, jsxs as jsxs40 } from "react/jsx-runtime";
8042
- import { useState as useState282, useEffect as useEffect232, useRef as useRef72, useCallback as useCallback32 } from "react";
8066
+ import { useState as useState282, useEffect as useEffect232, useRef as useRef82, useCallback as useCallback52 } from "react";
8043
8067
  import { Fragment as Fragment62, jsx as jsx44, jsxs as jsxs41 } from "react/jsx-runtime";
8044
- import { useState as useState30, useEffect as useEffect252, useCallback as useCallback52, useMemo as useMemo72, useRef as useRef92 } from "react";
8045
- import { useQuery as useQuery8 } from "@tanstack/react-query";
8046
- import { useQuery as useQuery9 } from "@tanstack/react-query";
8068
+ import { useState as useState30, useEffect as useEffect252, useCallback as useCallback72, useMemo as useMemo82, useRef as useRef102 } from "react";
8069
+ import { useQuery as useQuery9, keepPreviousData } from "@tanstack/react-query";
8047
8070
  import { useQuery as useQuery10 } from "@tanstack/react-query";
8048
- import { Fragment as Fragment72, jsx as jsx45, jsxs as jsxs422 } from "react/jsx-runtime";
8049
8071
  import { useQuery as useQuery11 } from "@tanstack/react-query";
8072
+ import { Fragment as Fragment72, jsx as jsx45, jsxs as jsxs422 } from "react/jsx-runtime";
8050
8073
  import { useQuery as useQuery12 } from "@tanstack/react-query";
8051
8074
  import { useQuery as useQuery13 } from "@tanstack/react-query";
8052
8075
  import { useQuery as useQuery14 } from "@tanstack/react-query";
8053
- import { useState as useState36, useEffect as useEffect302, useMemo as useMemo102 } from "react";
8076
+ import { useState as useState36, useEffect as useEffect302, useMemo as useMemo112 } from "react";
8054
8077
  import { useEffect as useEffect272, useState as useState31 } from "react";
8055
- import * as React312 from "react";
8078
+ import * as React322 from "react";
8056
8079
  import { jsx as jsx46 } from "react/jsx-runtime";
8057
8080
  import { jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
8058
8081
  import { Fragment as Fragment82, jsx as jsx48, jsxs as jsxs44 } from "react/jsx-runtime";
8059
- import { useState as useState322, useMemo as useMemo92, useEffect as useEffect282 } from "react";
8082
+ import { useState as useState322, useMemo as useMemo102, useEffect as useEffect282 } from "react";
8060
8083
 
8061
8084
  // ../../node_modules/.pnpm/fuse.js@7.4.0/node_modules/fuse.js/dist/fuse.mjs
8062
8085
  function isArray(value) {
@@ -10058,11 +10081,11 @@ Fuse.use = function(...plugins) {
10058
10081
 
10059
10082
  // ../ui-react/dist/index.mjs
10060
10083
  import { jsx as jsx49, jsxs as jsxs45 } from "react/jsx-runtime";
10061
- import { useState as useState33, useEffect as useEffect292, useRef as useRef102 } from "react";
10084
+ import { useState as useState33, useEffect as useEffect292, useRef as useRef112 } from "react";
10062
10085
  import { jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
10063
10086
  import { Fragment as Fragment92, jsx as jsx51, jsxs as jsxs47 } from "react/jsx-runtime";
10064
10087
  import { useState as useState34 } from "react";
10065
- import * as React322 from "react";
10088
+ import * as React332 from "react";
10066
10089
 
10067
10090
  // ../../node_modules/.pnpm/@radix-ui+react-tooltip@1.2.8_@types+react-dom@19.2.3_@types+react@19.2.9__@types+react@19.2._udyjcec5g7ve3mpsxbgla63vgi/node_modules/@radix-ui/react-tooltip/dist/index.mjs
10068
10091
  import * as React31 from "react";
@@ -12803,8 +12826,8 @@ import { jsx as jsx522 } from "react/jsx-runtime";
12803
12826
  import { useQuery as useQuery15 } from "@tanstack/react-query";
12804
12827
  import { jsx as jsx53, jsxs as jsxs48 } from "react/jsx-runtime";
12805
12828
  import { Fragment as Fragment10, jsx as jsx54, jsxs as jsxs49 } from "react/jsx-runtime";
12806
- import { useState as useState37, useEffect as useEffect312, useMemo as useMemo112 } from "react";
12807
- import * as React332 from "react";
12829
+ import { useState as useState37, useEffect as useEffect312, useMemo as useMemo122 } from "react";
12830
+ import * as React342 from "react";
12808
12831
 
12809
12832
  // ../../node_modules/.pnpm/@radix-ui+react-select@2.2.6_@types+react-dom@19.2.3_@types+react@19.2.9__@types+react@19.2.9_cot3leusltbsophitaz3dgdqdm/node_modules/@radix-ui/react-select/dist/index.mjs
12810
12833
  import * as React35 from "react";
@@ -14041,7 +14064,7 @@ var Separator = SelectSeparator;
14041
14064
  // ../ui-react/dist/index.mjs
14042
14065
  import { jsx as jsx55, jsxs as jsxs50 } from "react/jsx-runtime";
14043
14066
  import { jsx as jsx56, jsxs as jsxs51 } from "react/jsx-runtime";
14044
- import * as React342 from "react";
14067
+ import * as React352 from "react";
14045
14068
  import { useQuery as useQuery16 } from "@tanstack/react-query";
14046
14069
  import { useQuery as useQuery17 } from "@tanstack/react-query";
14047
14070
  import { jsx as jsx57 } from "react/jsx-runtime";
@@ -14052,26 +14075,26 @@ import { useEffect as useEffect322, useState as useState382 } from "react";
14052
14075
  import { Fragment as Fragment13, jsx as jsx61, jsxs as jsxs55 } from "react/jsx-runtime";
14053
14076
  import { jsx as jsx622, jsxs as jsxs56 } from "react/jsx-runtime";
14054
14077
  import { Fragment as Fragment14, jsx as jsx63, jsxs as jsxs57 } from "react/jsx-runtime";
14055
- import { useState as useState41, useEffect as useEffect35, useLayoutEffect as useLayoutEffect32, useCallback as useCallback92, useRef as useRef132, useMemo as useMemo142 } from "react";
14078
+ import { useState as useState41, useEffect as useEffect35, useLayoutEffect as useLayoutEffect32, useCallback as useCallback112, useRef as useRef142, useMemo as useMemo152 } from "react";
14056
14079
  import { useQuery as useQuery18 } from "@tanstack/react-query";
14057
14080
  import { Fragment as Fragment15, jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
14058
- import { useState as useState45, useEffect as useEffect39, useLayoutEffect as useLayoutEffect42, useCallback as useCallback112, useRef as useRef152 } from "react";
14081
+ import { useState as useState45, useEffect as useEffect39, useLayoutEffect as useLayoutEffect42, useCallback as useCallback132, useRef as useRef162 } from "react";
14059
14082
  import { useQuery as useQuery19 } from "@tanstack/react-query";
14060
14083
  import { useQuery as useQuery20 } from "@tanstack/react-query";
14061
14084
  import { useQuery as useQuery21 } from "@tanstack/react-query";
14062
14085
  import { useQuery as useQuery222 } from "@tanstack/react-query";
14063
- import { useState as useState42, useEffect as useEffect36, useRef as useRef142 } from "react";
14086
+ import { useState as useState42, useEffect as useEffect36, useRef as useRef152 } from "react";
14064
14087
  import { jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
14065
- import { useState as useState43, useCallback as useCallback102, useMemo as useMemo16, useEffect as useEffect37 } from "react";
14088
+ import { useState as useState43, useCallback as useCallback122, useMemo as useMemo17, useEffect as useEffect37 } from "react";
14066
14089
  import { useQuery as useQuery23 } from "@tanstack/react-query";
14067
- import { useMemo as useMemo15 } from "react";
14090
+ import { useMemo as useMemo16 } from "react";
14068
14091
  import { useQuery as useQuery24 } from "@tanstack/react-query";
14069
14092
  import { Fragment as Fragment16, jsx as jsx66, jsxs as jsxs60 } from "react/jsx-runtime";
14070
14093
  import { jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
14071
14094
  import { useState as useState44, useEffect as useEffect38 } from "react";
14072
14095
  import { Fragment as Fragment17, jsx as jsx68, jsxs as jsxs62 } from "react/jsx-runtime";
14073
14096
  import { Fragment as Fragment18, jsx as jsx69, jsxs as jsxs63 } from "react/jsx-runtime";
14074
- import { useState as useState46, useMemo as useMemo17 } from "react";
14097
+ import { useState as useState46, useMemo as useMemo18 } from "react";
14075
14098
  import { jsx as jsx70, jsxs as jsxs64 } from "react/jsx-runtime";
14076
14099
  function cn(...inputs) {
14077
14100
  return twMerge(clsx(inputs));
@@ -14502,6 +14525,7 @@ var DialogContent2 = React36.forwardRef(({ className, style, children, omitOverl
14502
14525
  className: cn(
14503
14526
  portalContainer ? "uf-absolute" : "uf-fixed",
14504
14527
  "uf-bottom-0 uf-left-0 uf-right-0 uf-top-0 uf-z-50 uf-grid uf-w-full uf-max-w-full uf-h-full",
14528
+ "focus:uf-outline-none focus-visible:uf-outline-none",
14505
14529
  !portalContainer && "sm:uf-left-[50%] sm:uf-top-[50%] sm:uf-bottom-auto sm:uf-right-auto sm:uf-translate-x-[-50%] sm:uf-translate-y-[-50%] sm:uf-h-auto",
14506
14530
  "uf-border uf-bg-background",
14507
14531
  omitOverlayEmbed ? "uf-gap-0 uf-p-0" : "uf-gap-4 uf-p-6 uf-shadow-lg uf-duration-200",
@@ -14517,6 +14541,14 @@ var DialogContent2 = React36.forwardRef(({ className, style, children, omitOverl
14517
14541
  ),
14518
14542
  style: {
14519
14543
  "--uf-container-radius": `${components.container.borderRadius}px`,
14544
+ // Radix traps focus and, when the focused control unmounts during an
14545
+ // in-modal screen transition, moves focus onto this container. Modern
14546
+ // browsers paint the default focus ring via `:focus-visible`, which
14547
+ // flashes a highlight around the whole modal until focus settles on
14548
+ // the next screen. Suppress it inline so it works regardless of the
14549
+ // Tailwind build (the container is a programmatic focus target, not an
14550
+ // interactive control, so it should never show a focus ring).
14551
+ outline: "none",
14520
14552
  ...portalContainer ? { display: "flex", flexDirection: "column" } : {},
14521
14553
  ...style
14522
14554
  },
@@ -16514,13 +16546,25 @@ function BuyWithCard({
16514
16546
  wallets: externalWallets,
16515
16547
  assetCdnUrl,
16516
16548
  hideDepositFlowInfo = false,
16517
- hideDisplayDescription = false
16549
+ hideDisplayDescription = false,
16550
+ prefilledAmountUsd
16518
16551
  }) {
16519
16552
  const { colors: colors2, fonts, components } = useTheme();
16520
- const [amount, setAmount] = useState102("");
16553
+ const cleanedPrefilledAmountUsd = React52.useMemo(() => {
16554
+ if (!prefilledAmountUsd) return "";
16555
+ return prefilledAmountUsd.replace(/[^0-9.]/g, "");
16556
+ }, [prefilledAmountUsd]);
16557
+ const parsedPrefilledAmountUsd = React52.useMemo(() => {
16558
+ const parsed = parseFloat(cleanedPrefilledAmountUsd);
16559
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
16560
+ }, [cleanedPrefilledAmountUsd]);
16561
+ const shouldAutoConvertPrefilledRef = useRef22(!!cleanedPrefilledAmountUsd);
16562
+ const [amount, setAmount] = useState102(() => cleanedPrefilledAmountUsd);
16521
16563
  const [currency, setCurrency] = useState102("usd");
16522
16564
  const [hasManualCurrencySelection, setHasManualCurrencySelection] = useState102(false);
16523
- const [hasManualAmountEntry, setHasManualAmountEntry] = useState102(false);
16565
+ const [hasManualAmountEntry, setHasManualAmountEntry] = useState102(
16566
+ () => !!cleanedPrefilledAmountUsd
16567
+ );
16524
16568
  const [showCurrencyModal, setShowCurrencyModal] = useState102(false);
16525
16569
  const [quotes, setQuotes] = useState102([]);
16526
16570
  const [quotesLoading, setQuotesLoading] = useState102(false);
@@ -16577,6 +16621,71 @@ function BuyWithCard({
16577
16621
  const [preferredCurrencyCodes, setPreferredCurrencyCodes] = useState102([]);
16578
16622
  const [currenciesLoading, setCurrenciesLoading] = useState102(true);
16579
16623
  const [destinationToken, setDestinationToken] = useState102(null);
16624
+ useEffect62(() => {
16625
+ const hasPrefilledAmount = !!cleanedPrefilledAmountUsd;
16626
+ shouldAutoConvertPrefilledRef.current = hasPrefilledAmount;
16627
+ if (!hasPrefilledAmount) return;
16628
+ setAmount(cleanedPrefilledAmountUsd);
16629
+ setHasManualAmountEntry(true);
16630
+ }, [cleanedPrefilledAmountUsd]);
16631
+ const { data: fiatExchangeRatesResponse, isLoading: isFiatExchangeRatesLoading } = useQuery3({
16632
+ queryKey: ["fiat-exchange-rates", publishableKey],
16633
+ staleTime: 3e4,
16634
+ refetchInterval: 3e4,
16635
+ queryFn: async () => {
16636
+ try {
16637
+ return await getFiatExchangeRates({}, publishableKey);
16638
+ } catch (error) {
16639
+ console.error("Error fetching fiat exchange rates:", error);
16640
+ return { base_currency: "usd", rates: {} };
16641
+ }
16642
+ }
16643
+ });
16644
+ const fiatExchangeRates = fiatExchangeRatesResponse?.rates ?? {};
16645
+ const convertAmountBetweenCurrencies = React52.useCallback(
16646
+ (rawAmount, fromCurrencyCode, toCurrencyCode) => {
16647
+ const parsedAmount = parseFloat(rawAmount);
16648
+ if (!Number.isFinite(parsedAmount) || parsedAmount <= 0) return null;
16649
+ const fromCode = fromCurrencyCode.toLowerCase();
16650
+ const toCode = toCurrencyCode.toLowerCase();
16651
+ const fromRate = fromCode === "usd" ? 1 : fiatExchangeRates[fromCode];
16652
+ const toRate = toCode === "usd" ? 1 : fiatExchangeRates[toCode];
16653
+ if (!Number.isFinite(fromRate) || fromRate <= 0) return null;
16654
+ if (!Number.isFinite(toRate) || toRate <= 0) return null;
16655
+ const usdAmount = parsedAmount / fromRate;
16656
+ return parseFloat((usdAmount * toRate).toFixed(2)).toString();
16657
+ },
16658
+ [fiatExchangeRates]
16659
+ );
16660
+ const getConvertedPrefilledAmount = React52.useCallback(
16661
+ (targetCurrencyCode) => {
16662
+ if (!parsedPrefilledAmountUsd) return null;
16663
+ const normalizedTargetCurrency = targetCurrencyCode.toLowerCase();
16664
+ const rate = normalizedTargetCurrency === "usd" ? 1 : fiatExchangeRates[normalizedTargetCurrency];
16665
+ if (!Number.isFinite(rate) || rate <= 0) return null;
16666
+ return parseFloat((parsedPrefilledAmountUsd * rate).toFixed(2)).toString();
16667
+ },
16668
+ [parsedPrefilledAmountUsd, fiatExchangeRates]
16669
+ );
16670
+ useEffect62(() => {
16671
+ if (!cleanedPrefilledAmountUsd || !shouldAutoConvertPrefilledRef.current) return;
16672
+ const convertedAmount = getConvertedPrefilledAmount(currency);
16673
+ if (!convertedAmount) {
16674
+ if (isFiatExchangeRatesLoading) return;
16675
+ const targetCurrency = currency.toLowerCase();
16676
+ if (targetCurrency !== "usd") {
16677
+ setCurrency("usd");
16678
+ }
16679
+ return;
16680
+ }
16681
+ setAmount(convertedAmount);
16682
+ setHasManualAmountEntry(true);
16683
+ }, [
16684
+ cleanedPrefilledAmountUsd,
16685
+ currency,
16686
+ getConvertedPrefilledAmount,
16687
+ isFiatExchangeRatesLoading
16688
+ ]);
16580
16689
  const depositWalletId = defaultToken ? getWalletByChainType(wallets, defaultToken.destination_token_metadata.chain_type)?.id : void 0;
16581
16690
  const { executions, isPolling, showWaitingUi } = useDepositPolling({
16582
16691
  userId,
@@ -16607,6 +16716,7 @@ function BuyWithCard({
16607
16716
  }, [publishableKey]);
16608
16717
  useEffect62(() => {
16609
16718
  if (hasManualCurrencySelection) return;
16719
+ if (hasManualAmountEntry && !shouldAutoConvertPrefilledRef.current) return;
16610
16720
  if (fiatCurrencies.length === 0 || !userIpInfo?.alpha2) return;
16611
16721
  const userCountryCode = userIpInfo.alpha2;
16612
16722
  const matchingCurrency = fiatCurrencies.find((c) => c.country_codes.includes(userCountryCode));
@@ -16625,7 +16735,15 @@ function BuyWithCard({
16625
16735
  const prevCurrencyRef = useRef22(null);
16626
16736
  useEffect62(() => {
16627
16737
  if (fiatCurrencies.length === 0) return;
16738
+ if (shouldAutoConvertPrefilledRef.current) {
16739
+ prevCurrencyRef.current = currency;
16740
+ return;
16741
+ }
16628
16742
  if (prevCurrencyRef.current !== null && prevCurrencyRef.current !== currency) {
16743
+ if (hasManualAmountEntry) {
16744
+ prevCurrencyRef.current = currency;
16745
+ return;
16746
+ }
16629
16747
  const currentCurrency = fiatCurrencies.find(
16630
16748
  (c) => c.currency_code.toLowerCase() === currency.toLowerCase()
16631
16749
  );
@@ -16634,7 +16752,7 @@ function BuyWithCard({
16634
16752
  }
16635
16753
  }
16636
16754
  prevCurrencyRef.current = currency;
16637
- }, [currency]);
16755
+ }, [currency, fiatCurrencies, hasManualAmountEntry]);
16638
16756
  useEffect62(() => {
16639
16757
  async function fetchDestinationToken() {
16640
16758
  try {
@@ -16811,6 +16929,7 @@ function BuyWithCard({
16811
16929
  return () => clearInterval(timer);
16812
16930
  }, [quotes.length, amount]);
16813
16931
  const handleAmountChange = (value) => {
16932
+ shouldAutoConvertPrefilledRef.current = false;
16814
16933
  if (value === "") {
16815
16934
  setAmount(value);
16816
16935
  setHasManualAmountEntry(true);
@@ -16824,6 +16943,7 @@ function BuyWithCard({
16824
16943
  }
16825
16944
  };
16826
16945
  const handleQuickAmount = (quickAmount) => {
16946
+ shouldAutoConvertPrefilledRef.current = false;
16827
16947
  setAmount(quickAmount.toString());
16828
16948
  setHasManualAmountEntry(true);
16829
16949
  };
@@ -17427,8 +17547,43 @@ function BuyWithCard({
17427
17547
  preferredCurrencyCodes,
17428
17548
  selectedCurrency: currency,
17429
17549
  onSelectCurrency: (currencyCode) => {
17430
- setCurrency(currencyCode.toLowerCase());
17550
+ const nextCurrency = currencyCode.toLowerCase();
17551
+ if (nextCurrency === currency.toLowerCase()) {
17552
+ setHasManualCurrencySelection(true);
17553
+ return;
17554
+ }
17555
+ const currentCurrency = currency;
17431
17556
  setHasManualCurrencySelection(true);
17557
+ if (shouldAutoConvertPrefilledRef.current) {
17558
+ const convertedAmount = getConvertedPrefilledAmount(nextCurrency);
17559
+ if (convertedAmount) {
17560
+ setCurrency(nextCurrency);
17561
+ setAmount(convertedAmount);
17562
+ setHasManualAmountEntry(true);
17563
+ } else {
17564
+ if (isFiatExchangeRatesLoading) return;
17565
+ const fallbackUsdAmount = getConvertedPrefilledAmount("usd");
17566
+ setCurrency("usd");
17567
+ if (fallbackUsdAmount) {
17568
+ setAmount(fallbackUsdAmount);
17569
+ setHasManualAmountEntry(true);
17570
+ }
17571
+ }
17572
+ return;
17573
+ }
17574
+ if (hasManualAmountEntry && amount) {
17575
+ const convertedAmount = convertAmountBetweenCurrencies(
17576
+ amount,
17577
+ currentCurrency,
17578
+ nextCurrency
17579
+ );
17580
+ if (convertedAmount) {
17581
+ setCurrency(nextCurrency);
17582
+ setAmount(convertedAmount);
17583
+ }
17584
+ return;
17585
+ }
17586
+ setCurrency(nextCurrency);
17432
17587
  },
17433
17588
  themeClass
17434
17589
  }
@@ -17481,7 +17636,7 @@ function useCoinbaseLegalAgreements({
17481
17636
  publishableKey,
17482
17637
  enabled = true
17483
17638
  }) {
17484
- return useQuery3({
17639
+ return useQuery4({
17485
17640
  queryKey: ["unifold", "coinbaseLegalAgreements", publishableKey],
17486
17641
  queryFn: () => getCoinbaseLegalAgreements(publishableKey),
17487
17642
  enabled: enabled && !!publishableKey,
@@ -17499,7 +17654,7 @@ function useApplePayLimits({
17499
17654
  enabled = true
17500
17655
  }) {
17501
17656
  const phoneValid = US_E164_REGEX.test(phone);
17502
- return useQuery4({
17657
+ return useQuery5({
17503
17658
  queryKey: ["unifold", "applePayLimits", phone, publishableKey],
17504
17659
  queryFn: ({ signal }) => getCoinbaseApplePayLimits(phone, publishableKey, signal),
17505
17660
  enabled: enabled && phoneValid && !!publishableKey,
@@ -17538,7 +17693,7 @@ function useApplePayInitialScreen({
17538
17693
  sessionPhoneVerified,
17539
17694
  isWaiting
17540
17695
  }) {
17541
- const initialStoredSession = useMemo22(() => getStoredApplePaySession(userId), [userId]);
17696
+ const initialStoredSession = useMemo32(() => getStoredApplePaySession(userId), [userId]);
17542
17697
  const phoneVerified = PHONE_REGEX.test(normalizedPhone) && (sessionPhoneVerified || initialStoredSession?.phone === normalizedPhone && !!initialStoredSession?.phoneVerifiedAt);
17543
17698
  const {
17544
17699
  data: applePayLimits,
@@ -17549,7 +17704,7 @@ function useApplePayInitialScreen({
17549
17704
  publishableKey,
17550
17705
  enabled: phoneVerified
17551
17706
  });
17552
- const action = useMemo22(() => {
17707
+ const action = useMemo32(() => {
17553
17708
  if (isWaiting || applePayLimitsLoading) return { kind: "pending" };
17554
17709
  const stored = initialStoredSession;
17555
17710
  const hasUserEmail = !!userEmail && EMAIL_REGEX.test(userEmail);
@@ -17599,7 +17754,7 @@ function useDefaultOnrampToken({
17599
17754
  isLoading,
17600
17755
  isError,
17601
17756
  error
17602
- } = useQuery5({
17757
+ } = useQuery6({
17603
17758
  queryKey: [
17604
17759
  "unifold",
17605
17760
  "defaultOnrampToken",
@@ -17673,7 +17828,7 @@ function parseCoinbasePostMessage(raw) {
17673
17828
  } : void 0
17674
17829
  };
17675
17830
  }
17676
- var BuyWithApplePay = React52.forwardRef(
17831
+ var BuyWithApplePay = React62.forwardRef(
17677
17832
  function BuyWithApplePay2({
17678
17833
  userId,
17679
17834
  publishableKey,
@@ -17744,7 +17899,7 @@ var BuyWithApplePay = React52.forwardRef(
17744
17899
  countryCode: userIpInfo?.alpha2,
17745
17900
  subdivisionCode: userIpInfo?.subdivisionCode ?? void 0
17746
17901
  });
17747
- const depositWallet = useMemo32(() => {
17902
+ const depositWallet = useMemo42(() => {
17748
17903
  const routingChainType = defaultToken?.destination_token_metadata?.chain_type;
17749
17904
  if (!routingChainType) return void 0;
17750
17905
  return getWalletByChainType(depositWallets ?? [], routingChainType);
@@ -17832,7 +17987,7 @@ var BuyWithApplePay = React52.forwardRef(
17832
17987
  popupRef.current = null;
17833
17988
  };
17834
17989
  }, []);
17835
- React52.useImperativeHandle(
17990
+ React62.useImperativeHandle(
17836
17991
  ref,
17837
17992
  () => ({
17838
17993
  requestBack: () => {
@@ -17874,9 +18029,9 @@ var BuyWithApplePay = React52.forwardRef(
17874
18029
  }),
17875
18030
  [view, emailLocked]
17876
18031
  );
17877
- const normalizedPhone = useMemo32(() => formatPhoneInput(phoneInput), [phoneInput]);
18032
+ const normalizedPhone = useMemo42(() => formatPhoneInput(phoneInput), [phoneInput]);
17878
18033
  const isContactValid = EMAIL_REGEX2.test(email) && PHONE_REGEX2.test(normalizedPhone);
17879
- const storeApplePaySession = useCallback10(
18034
+ const storeApplePaySession = useCallback22(
17880
18035
  (patch = {}) => {
17881
18036
  const session = {
17882
18037
  email,
@@ -17888,7 +18043,7 @@ var BuyWithApplePay = React52.forwardRef(
17888
18043
  },
17889
18044
  [email, normalizedPhone, userId]
17890
18045
  );
17891
- const createSessionAndSendOtp = useCallback10(async () => {
18046
+ const createSessionAndSendOtp = useCallback22(async () => {
17892
18047
  setView("submitting_session");
17893
18048
  setErrorMessage("");
17894
18049
  try {
@@ -17916,7 +18071,7 @@ var BuyWithApplePay = React52.forwardRef(
17916
18071
  setView("phone_input");
17917
18072
  }
17918
18073
  }, [email, normalizedPhone, publishableKey, storeApplePaySession]);
17919
- const clearUpgradeFields = useCallback10(() => {
18074
+ const clearUpgradeFields = useCallback22(() => {
17920
18075
  setSsnLast4("");
17921
18076
  setDobInput("");
17922
18077
  }, []);
@@ -17928,7 +18083,7 @@ var BuyWithApplePay = React52.forwardRef(
17928
18083
  sessionPhoneVerified: verificationSession?.phone?.status === "verified",
17929
18084
  isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
17930
18085
  });
17931
- const pollLimitUpgradeStatus = useCallback10(
18086
+ const pollLimitUpgradeStatus = useCallback22(
17932
18087
  async (signal) => {
17933
18088
  const POLL_INTERVAL_MS4 = 1500;
17934
18089
  const POLL_TIMEOUT_MS = 3e4;
@@ -17990,7 +18145,7 @@ var BuyWithApplePay = React52.forwardRef(
17990
18145
  clearUpgradeFields
17991
18146
  ]
17992
18147
  );
17993
- const startUpgradePolling = useCallback10(async () => {
18148
+ const startUpgradePolling = useCallback22(async () => {
17994
18149
  upgradeFlowAbortRef.current?.abort();
17995
18150
  const controller = new AbortController();
17996
18151
  upgradeFlowAbortRef.current = controller;
@@ -18002,7 +18157,7 @@ var BuyWithApplePay = React52.forwardRef(
18002
18157
  }
18003
18158
  }
18004
18159
  }, [pollLimitUpgradeStatus]);
18005
- const applyLimitRouting = useCallback10(
18160
+ const applyLimitRouting = useCallback22(
18006
18161
  (nextView, status) => {
18007
18162
  if (nextView === "limit_upgrade_form" && status === "resubmit") {
18008
18163
  setLimitUpgradeError(
@@ -18039,11 +18194,11 @@ var BuyWithApplePay = React52.forwardRef(
18039
18194
  break;
18040
18195
  }
18041
18196
  }, [initialAction, applyLimitRouting, createSessionAndSendOtp]);
18042
- const startVerification = useCallback10(async () => {
18197
+ const startVerification = useCallback22(async () => {
18043
18198
  if (!isContactValid) return;
18044
18199
  await createSessionAndSendOtp();
18045
18200
  }, [isContactValid, createSessionAndSendOtp]);
18046
- const submitLimitUpgrade = useCallback10(async () => {
18201
+ const submitLimitUpgrade = useCallback22(async () => {
18047
18202
  if (upgradeSubmitting) return;
18048
18203
  try {
18049
18204
  const dob = parseDobInput(dobInput);
@@ -18093,7 +18248,7 @@ var BuyWithApplePay = React52.forwardRef(
18093
18248
  startUpgradePolling,
18094
18249
  clearUpgradeFields
18095
18250
  ]);
18096
- const submitPhoneOtp = useCallback10(async () => {
18251
+ const submitPhoneOtp = useCallback22(async () => {
18097
18252
  if (!verificationSession || !clientSecret || phoneCode.length !== 6) return;
18098
18253
  if (otpSubmitting) return;
18099
18254
  setOtpError(null);
@@ -18161,7 +18316,7 @@ var BuyWithApplePay = React52.forwardRef(
18161
18316
  getViewForLimitStatus,
18162
18317
  applyLimitRouting
18163
18318
  ]);
18164
- const prepareSession = useCallback10(
18319
+ const prepareSession = useCallback22(
18165
18320
  async (token, amt) => {
18166
18321
  setErrorMessage("");
18167
18322
  if (!destinationChainType || !destinationChainId) {
@@ -19142,7 +19297,7 @@ function LegalDisclaimer({ legalAgreements, loading }) {
19142
19297
  children: [
19143
19298
  "By continuing, you agree to Coinbase's",
19144
19299
  " ",
19145
- agreements.map((a, idx, arr) => /* @__PURE__ */ jsxs11(React52.Fragment, { children: [
19300
+ agreements.map((a, idx, arr) => /* @__PURE__ */ jsxs11(React62.Fragment, { children: [
19146
19301
  /* @__PURE__ */ jsx132(
19147
19302
  "a",
19148
19303
  {
@@ -19458,7 +19613,7 @@ function QRCodeSkeleton({ size: size4 = 180, darkMode = false }) {
19458
19613
  const spacing = size4 / gridCount;
19459
19614
  const fillColor = darkMode ? "rgba(255,255,255,0.10)" : "rgba(0,0,0,0.08)";
19460
19615
  const cornerColor = darkMode ? "rgba(255,255,255,0.14)" : "rgba(0,0,0,0.12)";
19461
- const dots = useMemo42(() => {
19616
+ const dots = useMemo52(() => {
19462
19617
  const result = [];
19463
19618
  const cornerSize = 7;
19464
19619
  const centerStart = Math.floor(gridCount / 2) - 2;
@@ -19558,7 +19713,7 @@ function useIsMobileViewport() {
19558
19713
  return isMobile;
19559
19714
  }
19560
19715
  function useCashAppLimits({ publishableKey, currency = "usd" }) {
19561
- return useQuery6({
19716
+ return useQuery7({
19562
19717
  queryKey: ["unifold", "cashAppLimits", currency, publishableKey],
19563
19718
  queryFn: () => getCashAppLimits(currency, publishableKey),
19564
19719
  enabled: !!publishableKey,
@@ -19571,6 +19726,7 @@ var POLL_INTERVAL_MS2 = 5e3;
19571
19726
  var FALLBACK_MIN_USD = 5;
19572
19727
  var SUGGESTED_AMOUNTS = [25, 50, 100];
19573
19728
  var t3 = i18n2.depositModal.cashApp;
19729
+ var sanitizePrefilledUsd = (value) => value?.replace(/[^0-9.]/g, "") ?? "";
19574
19730
  function PayWithCashApp({
19575
19731
  userId,
19576
19732
  publishableKey,
@@ -19585,6 +19741,7 @@ function PayWithCashApp({
19585
19741
  onEvent,
19586
19742
  onDepositSuccess,
19587
19743
  onDepositError,
19744
+ prefilledAmountUsd,
19588
19745
  wallets = []
19589
19746
  }) {
19590
19747
  const { colors: colors2, fonts, components } = useTheme();
@@ -19600,14 +19757,14 @@ function PayWithCashApp({
19600
19757
  const { data: limits, isLoading: limitsLoading } = useCashAppLimits({ publishableKey });
19601
19758
  const minUsd = limits?.minimum_amount ?? FALLBACK_MIN_USD;
19602
19759
  const maxUsd = limits?.maximum_amount ?? null;
19603
- const [amount, setAmount] = useState152("");
19760
+ const [amount, setAmount] = useState152(() => sanitizePrefilledUsd(prefilledAmountUsd));
19604
19761
  const [loading, setLoading] = useState152(false);
19605
19762
  const [session, setSession] = useState152(null);
19606
19763
  const [status, setStatus] = useState152("pending");
19607
19764
  const [error, setError] = useState152(null);
19608
19765
  const [copied, setCopied] = useState152(false);
19609
19766
  const [view, setViewInternal] = useState152(controlledView ?? "amount");
19610
- const setView = useCallback22(
19767
+ const setView = useCallback32(
19611
19768
  (v) => {
19612
19769
  setViewInternal(v);
19613
19770
  onViewChange?.(v);
@@ -19637,7 +19794,7 @@ function PayWithCashApp({
19637
19794
  onDepositSuccess,
19638
19795
  onDepositError
19639
19796
  });
19640
- const handleAmountChange = useCallback22(
19797
+ const handleAmountChange = useCallback32(
19641
19798
  (raw) => {
19642
19799
  const cleaned = raw.replace(/[^0-9.]/g, "");
19643
19800
  const parts = cleaned.split(".");
@@ -19649,7 +19806,7 @@ function PayWithCashApp({
19649
19806
  },
19650
19807
  [onAmountChange]
19651
19808
  );
19652
- const handleCreateSession = useCallback22(async () => {
19809
+ const handleCreateSession = useCallback32(async () => {
19653
19810
  if (!amount || !recipientAddress || !destinationChainType || !destinationChainId || !destinationTokenAddress) {
19654
19811
  setError("Missing required fields");
19655
19812
  return;
@@ -19723,6 +19880,13 @@ function PayWithCashApp({
19723
19880
  return () => clearInterval(interval);
19724
19881
  }, [session, view, status, publishableKey, onDepositSuccess, onDepositError]);
19725
19882
  const [softExpired, setSoftExpired] = useState152(false);
19883
+ useEffect102(() => {
19884
+ if (!prefilledAmountUsd) return;
19885
+ const cleaned = sanitizePrefilledUsd(prefilledAmountUsd);
19886
+ if (!cleaned) return;
19887
+ setAmount(cleaned);
19888
+ onAmountChange?.(cleaned);
19889
+ }, [prefilledAmountUsd, onAmountChange]);
19726
19890
  useEffect102(() => {
19727
19891
  if (!session?.expires_at || view !== "payment") return;
19728
19892
  const expiresMs = new Date(session.expires_at).getTime();
@@ -19737,12 +19901,12 @@ function PayWithCashApp({
19737
19901
  const interval = setInterval(tick, 1e3);
19738
19902
  return () => clearInterval(interval);
19739
19903
  }, [session, view, status]);
19740
- const handleCopy = useCallback22(async (text) => {
19904
+ const handleCopy = useCallback32(async (text) => {
19741
19905
  await navigator.clipboard.writeText(text);
19742
19906
  setCopied(true);
19743
19907
  setTimeout(() => setCopied(false), 2e3);
19744
19908
  }, []);
19745
- const handleRecreate = useCallback22(() => {
19909
+ const handleRecreate = useCallback32(() => {
19746
19910
  setSession(null);
19747
19911
  setStatus("pending");
19748
19912
  setError(null);
@@ -20077,7 +20241,7 @@ function useBankTransferProviders({
20077
20241
  countryCode
20078
20242
  }) {
20079
20243
  const normalizedCountry = countryCode?.toUpperCase();
20080
- const { data: providers, isLoading } = useQuery7({
20244
+ const { data: providers, isLoading } = useQuery8({
20081
20245
  queryKey: ["unifold", "bankTransferProviders", publishableKey, normalizedCountry ?? null],
20082
20246
  queryFn: () => getBankTransferProviders(publishableKey, { countryCode: normalizedCountry }),
20083
20247
  enabled,
@@ -20115,7 +20279,8 @@ function BankTransfer({
20115
20279
  assetCdnUrl,
20116
20280
  onDepositSuccess,
20117
20281
  onEvent,
20118
- onDepositError
20282
+ onDepositError,
20283
+ prefilledAmountUsd
20119
20284
  }) {
20120
20285
  const { colors: colors2, fonts, components } = useTheme();
20121
20286
  const [internalView, setInternalView] = useState162("providers");
@@ -20125,6 +20290,10 @@ function BankTransfer({
20125
20290
  const [requestBase, setRequestBase] = useState162(null);
20126
20291
  const [activeRequest, setActiveRequest] = useState162(null);
20127
20292
  const [amount, setAmount] = useState162("");
20293
+ const [fiatExchangeRates, setFiatExchangeRates] = useState162({
20294
+ usd: 1
20295
+ });
20296
+ const providerSelectionRequestIdRef = useRef52(0);
20128
20297
  const currentView = externalView ?? internalView;
20129
20298
  const setView = (v) => {
20130
20299
  setInternalView(v);
@@ -20149,7 +20318,7 @@ function BankTransfer({
20149
20318
  countryCode: userIpInfo?.alpha2
20150
20319
  });
20151
20320
  const providers = providersResponse?.data ?? [];
20152
- const pollingWalletId = useMemo52(() => {
20321
+ const pollingWalletId = useMemo62(() => {
20153
20322
  if (!defaultToken) return void 0;
20154
20323
  return getWalletByChainType(
20155
20324
  wallets,
@@ -20170,11 +20339,42 @@ function BankTransfer({
20170
20339
  const currencySymbol = getCurrencySymbol2(sourceCurrency);
20171
20340
  const parsedAmount = parseFloat(amount);
20172
20341
  const amountValid = !!amount && Number.isFinite(parsedAmount) && parsedAmount >= MIN_AMOUNT;
20173
- const displayTokenSymbol = useMemo52(
20342
+ const displayTokenSymbol = useMemo62(
20174
20343
  () => destinationTokenSymbol?.toUpperCase() ?? defaultToken?.destination_token_metadata?.symbol?.toUpperCase() ?? defaultToken?.destination_currency?.toUpperCase() ?? "USDC",
20175
20344
  [destinationTokenSymbol, defaultToken]
20176
20345
  );
20177
- const handleProviderClick = (provider) => {
20346
+ const resolvePrefilledSourceAmount = useCallback42(
20347
+ async (sourceCurrencyCode) => {
20348
+ const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
20349
+ if (!cleanedPrefilled) return "";
20350
+ const prefilledUsd = parseFloat(cleanedPrefilled);
20351
+ if (!Number.isFinite(prefilledUsd) || prefilledUsd <= 0) return "";
20352
+ const sourceCurrency2 = sourceCurrencyCode.toLowerCase();
20353
+ let rate = sourceCurrency2 === "usd" ? 1 : fiatExchangeRates[sourceCurrency2];
20354
+ if ((!rate || rate <= 0) && sourceCurrency2 !== "usd") {
20355
+ try {
20356
+ const response = await getFiatExchangeRates({}, publishableKey);
20357
+ if (response?.rates) {
20358
+ setFiatExchangeRates((prev) => ({
20359
+ ...prev,
20360
+ ...response.rates,
20361
+ usd: 1
20362
+ }));
20363
+ }
20364
+ const fetchedRate = response.rates?.[sourceCurrency2];
20365
+ if (Number.isFinite(fetchedRate) && fetchedRate > 0) {
20366
+ rate = fetchedRate;
20367
+ }
20368
+ } catch (error) {
20369
+ console.error("Error fetching fiat exchange rates for bank transfer:", error);
20370
+ }
20371
+ }
20372
+ if (!rate || rate <= 0) return sourceCurrency2 === "usd" ? cleanedPrefilled : "";
20373
+ return parseFloat((prefilledUsd * rate).toFixed(2)).toString();
20374
+ },
20375
+ [fiatExchangeRates, prefilledAmountUsd, publishableKey]
20376
+ );
20377
+ const handleProviderClick = async (provider) => {
20178
20378
  if (!provider.enabled) return;
20179
20379
  setSessionError(null);
20180
20380
  if (!defaultToken) {
@@ -20193,6 +20393,7 @@ function BankTransfer({
20193
20393
  });
20194
20394
  return;
20195
20395
  }
20396
+ const requestId = ++providerSelectionRequestIdRef.current;
20196
20397
  setRequestBase({
20197
20398
  service_provider: provider.service_provider,
20198
20399
  country_code: (userIpInfo?.alpha2 || "DE").toUpperCase(),
@@ -20206,7 +20407,10 @@ function BankTransfer({
20206
20407
  payment_method: provider.payment_methods[0]
20207
20408
  });
20208
20409
  setActiveProvider(provider);
20209
- setAmount("100");
20410
+ const convertedPrefilled = await resolvePrefilledSourceAmount(provider.source_currency);
20411
+ if (requestId !== providerSelectionRequestIdRef.current) return;
20412
+ const hasPrefilledAmount = !!prefilledAmountUsd?.replace(/[^0-9.]/g, "");
20413
+ setAmount(hasPrefilledAmount ? convertedPrefilled : "100");
20210
20414
  setView("amount");
20211
20415
  };
20212
20416
  const handleAmountChange = (value) => {
@@ -20304,7 +20508,7 @@ function BankTransfer({
20304
20508
  return /* @__PURE__ */ jsxs15(
20305
20509
  "button",
20306
20510
  {
20307
- onClick: () => handleProviderClick(provider),
20511
+ onClick: () => void handleProviderClick(provider),
20308
20512
  onMouseEnter: () => !disabled && setHoveredId(provider.service_provider),
20309
20513
  onMouseLeave: () => setHoveredId(null),
20310
20514
  disabled,
@@ -20873,9 +21077,9 @@ function TransferCryptoButton({
20873
21077
  featuredTokens
20874
21078
  }) {
20875
21079
  const { colors: colors2, fonts, components } = useTheme();
20876
- const [isHovered, setIsHovered] = React62.useState(false);
20877
- const [isTouchDevice, setIsTouchDevice] = React62.useState(false);
20878
- React62.useEffect(() => {
21080
+ const [isHovered, setIsHovered] = React72.useState(false);
21081
+ const [isTouchDevice, setIsTouchDevice] = React72.useState(false);
21082
+ React72.useEffect(() => {
20879
21083
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
20880
21084
  }, []);
20881
21085
  const sortedTokens = featuredTokens ? [...featuredTokens].sort((a, b) => a.position - b.position) : [];
@@ -20955,9 +21159,9 @@ function DepositWithCardButton({
20955
21159
  paymentNetworks
20956
21160
  }) {
20957
21161
  const { colors: colors2, fonts, components } = useTheme();
20958
- const [isHovered, setIsHovered] = React72.useState(false);
20959
- const [isTouchDevice, setIsTouchDevice] = React72.useState(false);
20960
- React72.useEffect(() => {
21162
+ const [isHovered, setIsHovered] = React82.useState(false);
21163
+ const [isTouchDevice, setIsTouchDevice] = React82.useState(false);
21164
+ React82.useEffect(() => {
20961
21165
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
20962
21166
  }, []);
20963
21167
  return /* @__PURE__ */ jsxs18(
@@ -21036,9 +21240,9 @@ function PayWithExchangeButton({
21036
21240
  loading = false
21037
21241
  }) {
21038
21242
  const { colors: colors2, fonts, components } = useTheme();
21039
- const [isHovered, setIsHovered] = React82.useState(false);
21040
- const [isTouchDevice, setIsTouchDevice] = React82.useState(false);
21041
- React82.useEffect(() => {
21243
+ const [isHovered, setIsHovered] = React92.useState(false);
21244
+ const [isTouchDevice, setIsTouchDevice] = React92.useState(false);
21245
+ React92.useEffect(() => {
21042
21246
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
21043
21247
  }, []);
21044
21248
  if (loading) {
@@ -21140,11 +21344,11 @@ var buttonVariants = cva(
21140
21344
  }
21141
21345
  }
21142
21346
  );
21143
- var Button = React92.forwardRef(
21347
+ var Button = React102.forwardRef(
21144
21348
  ({ className, variant, size: size4, asChild = false, style, ...props }, ref) => {
21145
21349
  const Comp = asChild ? Slot2 : "button";
21146
21350
  const { components, fonts } = useTheme();
21147
- const themeStyle = React92.useMemo(() => {
21351
+ const themeStyle = React102.useMemo(() => {
21148
21352
  const baseStyle = { ...style };
21149
21353
  if (variant === "default" || !variant) {
21150
21354
  baseStyle.backgroundColor = components.button.primaryBackground;
@@ -21179,9 +21383,9 @@ function ConnectExchangeButton({
21179
21383
  connectedExchange
21180
21384
  }) {
21181
21385
  const { colors: colors2, fonts, components } = useTheme();
21182
- const [isHovered, setIsHovered] = React102.useState(false);
21183
- const [isTouchDevice, setIsTouchDevice] = React102.useState(false);
21184
- React102.useEffect(() => {
21386
+ const [isHovered, setIsHovered] = React112.useState(false);
21387
+ const [isTouchDevice, setIsTouchDevice] = React112.useState(false);
21388
+ React112.useEffect(() => {
21185
21389
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
21186
21390
  }, []);
21187
21391
  const isConnected = connectedExchange != null;
@@ -21326,9 +21530,9 @@ function DepositTrackerButton({
21326
21530
  badge
21327
21531
  }) {
21328
21532
  const { colors: colors2, fonts, components } = useTheme();
21329
- const [isHovered, setIsHovered] = React112.useState(false);
21330
- const [isTouchDevice, setIsTouchDevice] = React112.useState(false);
21331
- React112.useEffect(() => {
21533
+ const [isHovered, setIsHovered] = React122.useState(false);
21534
+ const [isTouchDevice, setIsTouchDevice] = React122.useState(false);
21535
+ React122.useEffect(() => {
21332
21536
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
21333
21537
  }, []);
21334
21538
  return /* @__PURE__ */ jsxs21(
@@ -21399,9 +21603,9 @@ function DepositTrackerButton({
21399
21603
  }
21400
21604
  function CashAppButton({ onClick, title, subtitle, iconUrl }) {
21401
21605
  const { colors: colors2, fonts, components } = useTheme();
21402
- const [isHovered, setIsHovered] = React122.useState(false);
21403
- const [isTouchDevice, setIsTouchDevice] = React122.useState(false);
21404
- React122.useEffect(() => {
21606
+ const [isHovered, setIsHovered] = React132.useState(false);
21607
+ const [isTouchDevice, setIsTouchDevice] = React132.useState(false);
21608
+ React132.useEffect(() => {
21405
21609
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
21406
21610
  }, []);
21407
21611
  return /* @__PURE__ */ jsxs222(
@@ -21485,9 +21689,9 @@ function AppleLogo({ className, style }) {
21485
21689
  }
21486
21690
  function ApplePayButton({ onClick, title, subtitle }) {
21487
21691
  const { colors: colors2, fonts, components } = useTheme();
21488
- const [isHovered, setIsHovered] = React132.useState(false);
21489
- const [isTouchDevice, setIsTouchDevice] = React132.useState(false);
21490
- React132.useEffect(() => {
21692
+ const [isHovered, setIsHovered] = React142.useState(false);
21693
+ const [isTouchDevice, setIsTouchDevice] = React142.useState(false);
21694
+ React142.useEffect(() => {
21491
21695
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
21492
21696
  }, []);
21493
21697
  return /* @__PURE__ */ jsxs23(
@@ -21549,9 +21753,9 @@ function BankTransferButton({
21549
21753
  comingSoon = false
21550
21754
  }) {
21551
21755
  const { colors: colors2, fonts, components } = useTheme();
21552
- const [isHovered, setIsHovered] = React142.useState(false);
21553
- const [isTouchDevice, setIsTouchDevice] = React142.useState(false);
21554
- React142.useEffect(() => {
21756
+ const [isHovered, setIsHovered] = React152.useState(false);
21757
+ const [isTouchDevice, setIsTouchDevice] = React152.useState(false);
21758
+ React152.useEffect(() => {
21555
21759
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
21556
21760
  }, []);
21557
21761
  return /* @__PURE__ */ jsxs24(
@@ -21800,18 +22004,18 @@ async function detectConnectedBrowserWallet(chainType) {
21800
22004
  }
21801
22005
  function useDetectedBrowserWallet(opts = {}) {
21802
22006
  const { chainType, enabled = true, onDisconnect } = opts;
21803
- const [wallet, setWallet] = React152.useState(null);
21804
- const [isLoading, setIsLoading] = React152.useState(enabled);
21805
- const [eip6963ProviderCount, setEip6963ProviderCount] = React152.useState(0);
21806
- const onDisconnectRef = React152.useRef(onDisconnect);
22007
+ const [wallet, setWallet] = React162.useState(null);
22008
+ const [isLoading, setIsLoading] = React162.useState(enabled);
22009
+ const [eip6963ProviderCount, setEip6963ProviderCount] = React162.useState(0);
22010
+ const onDisconnectRef = React162.useRef(onDisconnect);
21807
22011
  onDisconnectRef.current = onDisconnect;
21808
- React152.useEffect(() => {
22012
+ React162.useEffect(() => {
21809
22013
  const store = getEip6963Store();
21810
22014
  if (!store) return;
21811
22015
  setEip6963ProviderCount(store.getProviders().length);
21812
22016
  return store.subscribe((providers) => setEip6963ProviderCount(providers.length));
21813
22017
  }, []);
21814
- React152.useEffect(() => {
22018
+ React162.useEffect(() => {
21815
22019
  if (!enabled) {
21816
22020
  setWallet(null);
21817
22021
  setIsLoading(false);
@@ -21952,7 +22156,7 @@ async function disconnectInjectedBrowserWallet(wallet) {
21952
22156
  );
21953
22157
  }
21954
22158
  function MetamaskIcon({ size: size4 = 24, className, variant = "color" }) {
21955
- const id = React162.useId();
22159
+ const id = React172.useId();
21956
22160
  if (variant === "light" || variant === "dark") {
21957
22161
  return /* @__PURE__ */ jsxs25(
21958
22162
  "svg",
@@ -22073,7 +22277,7 @@ function MetamaskIcon({ size: size4 = 24, className, variant = "color" }) {
22073
22277
  );
22074
22278
  }
22075
22279
  function PhantomIcon({ size: size4 = 24, className, variant = "color" }) {
22076
- const id = React172.useId();
22280
+ const id = React182.useId();
22077
22281
  if (variant === "light") {
22078
22282
  return /* @__PURE__ */ jsx29(
22079
22283
  "svg",
@@ -22140,7 +22344,7 @@ function PhantomIcon({ size: size4 = 24, className, variant = "color" }) {
22140
22344
  );
22141
22345
  }
22142
22346
  function CoinbaseIcon({ size: size4 = 24, className, variant = "color" }) {
22143
- const id = React182.useId();
22347
+ const id = React192.useId();
22144
22348
  if (variant === "light") {
22145
22349
  return /* @__PURE__ */ jsxs27(
22146
22350
  "svg",
@@ -22220,7 +22424,7 @@ function CoinbaseIcon({ size: size4 = 24, className, variant = "color" }) {
22220
22424
  );
22221
22425
  }
22222
22426
  function RabbyIcon({ size: size4 = 24, className, variant = "color" }) {
22223
- const id = React192.useId();
22427
+ const id = React202.useId();
22224
22428
  if (variant === "light") {
22225
22429
  return /* @__PURE__ */ jsxs28(
22226
22430
  "svg",
@@ -22567,7 +22771,7 @@ function RabbyIcon({ size: size4 = 24, className, variant = "color" }) {
22567
22771
  );
22568
22772
  }
22569
22773
  function RainbowIcon({ size: size4 = 24, className, variant = "color" }) {
22570
- const id = React202.useId();
22774
+ const id = React212.useId();
22571
22775
  if (variant === "light") {
22572
22776
  return /* @__PURE__ */ jsxs29(
22573
22777
  "svg",
@@ -22981,7 +23185,7 @@ function RainbowIcon({ size: size4 = 24, className, variant = "color" }) {
22981
23185
  );
22982
23186
  }
22983
23187
  function TrustIcon({ size: size4 = 24, className, variant = "color" }) {
22984
- const id = React212.useId();
23188
+ const id = React222.useId();
22985
23189
  if (variant === "light") {
22986
23190
  return /* @__PURE__ */ jsx33(
22987
23191
  "svg",
@@ -23064,7 +23268,7 @@ function TrustIcon({ size: size4 = 24, className, variant = "color" }) {
23064
23268
  );
23065
23269
  }
23066
23270
  function OkxIcon({ size: size4 = 24, className, variant = "color" }) {
23067
- const id = React222.useId();
23271
+ const id = React232.useId();
23068
23272
  if (variant === "light") {
23069
23273
  return /* @__PURE__ */ jsx34(
23070
23274
  "svg",
@@ -23119,7 +23323,7 @@ function OkxIcon({ size: size4 = 24, className, variant = "color" }) {
23119
23323
  );
23120
23324
  }
23121
23325
  function GlowIcon({ size: size4 = 24, className, variant = "color" }) {
23122
- const id = React232.useId();
23326
+ const id = React242.useId();
23123
23327
  if (variant === "light") {
23124
23328
  return /* @__PURE__ */ jsx35(
23125
23329
  "svg",
@@ -23220,7 +23424,7 @@ function GlowIcon({ size: size4 = 24, className, variant = "color" }) {
23220
23424
  );
23221
23425
  }
23222
23426
  function BackpackIcon({ size: size4 = 24, className, variant = "color" }) {
23223
- const id = React242.useId();
23427
+ const id = React252.useId();
23224
23428
  if (variant === "light") {
23225
23429
  return /* @__PURE__ */ jsx36(
23226
23430
  "svg",
@@ -23293,7 +23497,7 @@ function BackpackIcon({ size: size4 = 24, className, variant = "color" }) {
23293
23497
  );
23294
23498
  }
23295
23499
  function SolflareIcon({ size: size4 = 24, className, variant = "color" }) {
23296
- const id = React252.useId();
23500
+ const id = React262.useId();
23297
23501
  if (variant === "light") {
23298
23502
  return /* @__PURE__ */ jsx37(
23299
23503
  "svg",
@@ -23360,7 +23564,7 @@ function SolflareIcon({ size: size4 = 24, className, variant = "color" }) {
23360
23564
  );
23361
23565
  }
23362
23566
  function EthereumIcon({ size: size4 = 24, className, variant = "color" }) {
23363
- const id = React262.useId();
23567
+ const id = React272.useId();
23364
23568
  if (variant === "light") {
23365
23569
  return /* @__PURE__ */ jsxs35(
23366
23570
  "svg",
@@ -23484,7 +23688,7 @@ function EthereumIcon({ size: size4 = 24, className, variant = "color" }) {
23484
23688
  );
23485
23689
  }
23486
23690
  function SolanaIcon({ size: size4 = 24, className, variant = "color" }) {
23487
- const id = React272.useId();
23691
+ const id = React282.useId();
23488
23692
  if (variant === "light") {
23489
23693
  return /* @__PURE__ */ jsx39(
23490
23694
  "svg",
@@ -23729,19 +23933,19 @@ function BrowserWalletButton({
23729
23933
  subtitle = i18n2.depositModal.browserWallet.subtitle
23730
23934
  }) {
23731
23935
  const { colors: colors2, fonts, components } = useTheme();
23732
- const [isHovered, setIsHovered] = React282.useState(false);
23733
- const [isTouchDevice, setIsTouchDevice] = React282.useState(false);
23936
+ const [isHovered, setIsHovered] = React292.useState(false);
23937
+ const [isTouchDevice, setIsTouchDevice] = React292.useState(false);
23734
23938
  const { wallet, isLoading, setWallet } = useDetectedBrowserWallet({ chainType, onDisconnect });
23735
- const [isConnecting, setIsConnecting] = React282.useState(false);
23736
- const [balanceText, setBalanceText] = React282.useState(null);
23737
- const [isLoadingBalance, setIsLoadingBalance] = React282.useState(false);
23738
- const [isDisconnecting, setIsDisconnecting] = React282.useState(false);
23739
- const onDisconnectRef = React282.useRef(onDisconnect);
23939
+ const [isConnecting, setIsConnecting] = React292.useState(false);
23940
+ const [balanceText, setBalanceText] = React292.useState(null);
23941
+ const [isLoadingBalance, setIsLoadingBalance] = React292.useState(false);
23942
+ const [isDisconnecting, setIsDisconnecting] = React292.useState(false);
23943
+ const onDisconnectRef = React292.useRef(onDisconnect);
23740
23944
  onDisconnectRef.current = onDisconnect;
23741
- React282.useEffect(() => {
23945
+ React292.useEffect(() => {
23742
23946
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
23743
23947
  }, []);
23744
- React282.useEffect(() => {
23948
+ React292.useEffect(() => {
23745
23949
  if (!wallet || !publishableKey) {
23746
23950
  setBalanceText(null);
23747
23951
  return;
@@ -23868,7 +24072,7 @@ function BrowserWalletButton({
23868
24072
  border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
23869
24073
  };
23870
24074
  const sortedWallets = featuredWallets ? [...featuredWallets].sort((a, b) => a.position - b.position) : [];
23871
- const walletIconBlock = wallet ? WALLET_ICON_COMPONENTS[wallet.icon] ? React282.createElement(WALLET_ICON_COMPONENTS[wallet.icon], {
24075
+ const walletIconBlock = wallet ? WALLET_ICON_COMPONENTS[wallet.icon] ? React292.createElement(WALLET_ICON_COMPONENTS[wallet.icon], {
23872
24076
  size: 36,
23873
24077
  className: "uf-rounded-lg",
23874
24078
  variant: "color"
@@ -24019,9 +24223,9 @@ function StripeLinkButton({
24019
24223
  iconUrl
24020
24224
  }) {
24021
24225
  const { colors: colors2, fonts, components } = useTheme();
24022
- const [isHovered, setIsHovered] = React292.useState(false);
24023
- const [isTouchDevice, setIsTouchDevice] = React292.useState(false);
24024
- React292.useEffect(() => {
24226
+ const [isHovered, setIsHovered] = React302.useState(false);
24227
+ const [isTouchDevice, setIsTouchDevice] = React302.useState(false);
24228
+ React302.useEffect(() => {
24025
24229
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
24026
24230
  }, []);
24027
24231
  return /* @__PURE__ */ jsxs39(
@@ -24294,12 +24498,12 @@ function useStripeOnramp(stripePublishableKey, isDark = false) {
24294
24498
  const [coordinator, setCoordinator] = useState282(null);
24295
24499
  const [isLoading, setIsLoading] = useState282(false);
24296
24500
  const [error, setError] = useState282(null);
24297
- const coordinatorRef = useRef72(null);
24298
- const coordinatorThemeRef = useRef72(null);
24299
- const initPromiseRef = useRef72(null);
24300
- const isDarkRef = useRef72(isDark);
24501
+ const coordinatorRef = useRef82(null);
24502
+ const coordinatorThemeRef = useRef82(null);
24503
+ const initPromiseRef = useRef82(null);
24504
+ const isDarkRef = useRef82(isDark);
24301
24505
  isDarkRef.current = isDark;
24302
- const initialize = useCallback32(() => {
24506
+ const initialize = useCallback52(() => {
24303
24507
  if (coordinatorRef.current) return Promise.resolve(coordinatorRef.current);
24304
24508
  if (initPromiseRef.current) return initPromiseRef.current;
24305
24509
  if (!stripePublishableKey) return Promise.resolve(null);
@@ -24507,6 +24711,8 @@ function PayWithStripeLink({
24507
24711
  destinationChainType,
24508
24712
  destinationChainId,
24509
24713
  destinationTokenAddress,
24714
+ countryCode,
24715
+ subdivisionCode,
24510
24716
  wallets: externalWallets,
24511
24717
  email: emailProp,
24512
24718
  iconUrl,
@@ -24518,14 +24724,14 @@ function PayWithStripeLink({
24518
24724
  }) {
24519
24725
  const { colors: colors2, fonts, components, isDark } = useTheme();
24520
24726
  const [step, setStepInternal] = useState292(controlledStep ?? "amount");
24521
- const setStep = useCallback42(
24727
+ const setStep = useCallback62(
24522
24728
  (s) => {
24523
24729
  setStepInternal(s);
24524
24730
  onStepChange?.(s);
24525
24731
  },
24526
24732
  [onStepChange]
24527
24733
  );
24528
- const stepRef = useRef82(step);
24734
+ const stepRef = useRef92(step);
24529
24735
  stepRef.current = step;
24530
24736
  useEffect242(() => {
24531
24737
  if (controlledStep && controlledStep !== step) {
@@ -24616,20 +24822,20 @@ function PayWithStripeLink({
24616
24822
  const [restoring, setRestoring] = useState292(true);
24617
24823
  const [errorReturnStep, setErrorReturnStep] = useState292("email");
24618
24824
  const [authIntentId, setAuthIntentId] = useState292(null);
24619
- const sdkAuthenticatedRef = useRef82(false);
24620
- const everAuthenticatedRef = useRef82(false);
24621
- const reauthReturnStepRef = useRef82(null);
24622
- const attemptedWalletReauthRef = useRef82(false);
24623
- const pendingAddPaymentRef = useRef82(false);
24624
- const autoOpenedAddPaymentRef = useRef82(false);
24625
- const checkoutGenRef = useRef82(0);
24825
+ const sdkAuthenticatedRef = useRef92(false);
24826
+ const everAuthenticatedRef = useRef92(false);
24827
+ const reauthReturnStepRef = useRef92(null);
24828
+ const attemptedWalletReauthRef = useRef92(false);
24829
+ const pendingAddPaymentRef = useRef92(false);
24830
+ const autoOpenedAddPaymentRef = useRef92(false);
24831
+ const checkoutGenRef = useRef92(0);
24626
24832
  const [stripePaymentUIReady, setStripePaymentUIReady] = useState292(false);
24627
24833
  const [oauthToken, setOauthToken] = useState292(null);
24628
24834
  const [refreshTokenValue, setRefreshTokenValue] = useState292(null);
24629
24835
  const [customerId, setCustomerId] = useState292(null);
24630
- const accessTokenRef = useRef82("");
24631
- const refreshTokenRef = useRef82("");
24632
- const persistSession = useCallback42(
24836
+ const accessTokenRef = useRef92("");
24837
+ const refreshTokenRef = useRef92("");
24838
+ const persistSession = useCallback62(
24633
24839
  (cid, token, refresh, expiresIn, loginEmail) => {
24634
24840
  accessTokenRef.current = token;
24635
24841
  refreshTokenRef.current = refresh;
@@ -24643,8 +24849,8 @@ function PayWithStripeLink({
24643
24849
  },
24644
24850
  [userId, email]
24645
24851
  );
24646
- const refreshInFlightRef = useRef82(null);
24647
- const tryRefreshToken = useCallback42(async () => {
24852
+ const refreshInFlightRef = useRef92(null);
24853
+ const tryRefreshToken = useCallback62(async () => {
24648
24854
  if (refreshInFlightRef.current) return refreshInFlightRef.current;
24649
24855
  const rt = refreshTokenRef.current;
24650
24856
  if (!rt) return null;
@@ -24674,7 +24880,7 @@ function PayWithStripeLink({
24674
24880
  refreshInFlightRef.current = doRefresh();
24675
24881
  return refreshInFlightRef.current;
24676
24882
  }, [publishableKey, customerId, persistSession, userId]);
24677
- const withTokenRefresh = useCallback42(
24883
+ const withTokenRefresh = useCallback62(
24678
24884
  async (fn) => {
24679
24885
  const token = accessTokenRef.current;
24680
24886
  if (!token) {
@@ -24836,8 +25042,8 @@ function PayWithStripeLink({
24836
25042
  );
24837
25043
  const [selectedPaymentToken, setSelectedPaymentToken] = useState292(null);
24838
25044
  const [paymentDisplay, setPaymentDisplay] = useState292(null);
24839
- const selectedTokenSingleUseRef = useRef82(false);
24840
- const selectPaymentToken = useCallback42(
25045
+ const selectedTokenSingleUseRef = useRef92(false);
25046
+ const selectPaymentToken = useCallback62(
24841
25047
  (token) => {
24842
25048
  selectedTokenSingleUseRef.current = !!token.singleUse;
24843
25049
  setSelectedPaymentToken(token.id);
@@ -24849,7 +25055,7 @@ function PayWithStripeLink({
24849
25055
  },
24850
25056
  [customerId]
24851
25057
  );
24852
- const clearSelectedPaymentToken = useCallback42(() => {
25058
+ const clearSelectedPaymentToken = useCallback62(() => {
24853
25059
  selectedTokenSingleUseRef.current = false;
24854
25060
  const persisted = customerId ? getStoredSelectedToken(customerId) : null;
24855
25061
  if (persisted && !persisted.singleUse) {
@@ -24901,7 +25107,9 @@ function PayWithStripeLink({
24901
25107
  {
24902
25108
  tokenAddress: destinationTokenAddress,
24903
25109
  chainId: destinationChainId,
24904
- chainType: destinationChainType
25110
+ chainType: destinationChainType,
25111
+ countryCode,
25112
+ subdivisionCode
24905
25113
  },
24906
25114
  publishableKey
24907
25115
  ).then((token) => {
@@ -24920,10 +25128,17 @@ function PayWithStripeLink({
24920
25128
  return () => {
24921
25129
  cancelled = true;
24922
25130
  };
24923
- }, [publishableKey, destinationTokenAddress, destinationChainId, destinationChainType]);
25131
+ }, [
25132
+ publishableKey,
25133
+ destinationTokenAddress,
25134
+ destinationChainId,
25135
+ destinationChainType,
25136
+ countryCode,
25137
+ subdivisionCode
25138
+ ]);
24924
25139
  const destinationCurrency = stripeDestCurrency;
24925
- const authInnerRef = useRef82(null);
24926
- const paymentInnerRef = useRef82(null);
25140
+ const authInnerRef = useRef92(null);
25141
+ const paymentInnerRef = useRef92(null);
24927
25142
  const [authReady, setAuthReady] = useState292(false);
24928
25143
  if (typeof document !== "undefined" && !authInnerRef.current) {
24929
25144
  authInnerRef.current = document.createElement("div");
@@ -24931,12 +25146,12 @@ function PayWithStripeLink({
24931
25146
  if (typeof document !== "undefined" && !paymentInnerRef.current) {
24932
25147
  paymentInnerRef.current = document.createElement("div");
24933
25148
  }
24934
- const authMountRef = useCallback42((node) => {
25149
+ const authMountRef = useCallback62((node) => {
24935
25150
  if (node && !node.contains(authInnerRef.current)) {
24936
25151
  node.appendChild(authInnerRef.current);
24937
25152
  }
24938
25153
  }, []);
24939
- const paymentMountRef = useCallback42((node) => {
25154
+ const paymentMountRef = useCallback62((node) => {
24940
25155
  if (node && !node.contains(paymentInnerRef.current)) {
24941
25156
  node.appendChild(paymentInnerRef.current);
24942
25157
  }
@@ -24987,8 +25202,8 @@ function PayWithStripeLink({
24987
25202
  });
24988
25203
  const [confirmedSessionId, setConfirmedSessionId] = useState292(null);
24989
25204
  const [sessionStatus, setSessionStatus] = useState292(null);
24990
- const handledTerminalSessionRef = useRef82(null);
24991
- const executionReconciledSessionRef = useRef82(null);
25205
+ const handledTerminalSessionRef = useRef92(null);
25206
+ const executionReconciledSessionRef = useRef92(null);
24992
25207
  const hasExecution = executions.length > 0;
24993
25208
  const isSessionFulfilled = sessionStatus === STRIPE_SESSION_STATUS.FULFILLMENT_COMPLETE || hasExecution;
24994
25209
  const isSessionFailed = !hasExecution && (sessionStatus === STRIPE_SESSION_STATUS.REJECTED || sessionStatus === STRIPE_SESSION_STATUS.EXPIRED);
@@ -25106,7 +25321,7 @@ function PayWithStripeLink({
25106
25321
  sdkAuthenticatedRef.current = false;
25107
25322
  attemptedWalletReauthRef.current = false;
25108
25323
  }, [coordinator]);
25109
- const handleAuthInterrupted = useCallback42(
25324
+ const handleAuthInterrupted = useCallback62(
25110
25325
  (message) => {
25111
25326
  const alreadySignedIn = !!accessTokenRef.current;
25112
25327
  if (alreadySignedIn || emailProp) {
@@ -25119,7 +25334,7 @@ function PayWithStripeLink({
25119
25334
  },
25120
25335
  [emailProp, setStep]
25121
25336
  );
25122
- const reauthenticateSdk = useCallback42(async () => {
25337
+ const reauthenticateSdk = useCallback62(async () => {
25123
25338
  const current = stepRef.current;
25124
25339
  const preAuthSteps = ["email", "register", "auth"];
25125
25340
  reauthReturnStepRef.current = preAuthSteps.includes(current) ? null : current;
@@ -25818,14 +26033,14 @@ function PayWithStripeLink({
25818
26033
  };
25819
26034
  const [quote, setQuote] = useState292(null);
25820
26035
  const [quoteLoading, setQuoteLoading] = useState292(false);
25821
- const quoteTimerRef = useRef82(null);
26036
+ const quoteTimerRef = useRef92(null);
25822
26037
  const [sessionForCheckout, setSessionForCheckoutState] = useState292(null);
25823
- const sessionForCheckoutRef = useRef82(sessionForCheckout);
26038
+ const sessionForCheckoutRef = useRef92(sessionForCheckout);
25824
26039
  const setSessionForCheckout = (s) => {
25825
26040
  sessionForCheckoutRef.current = s;
25826
26041
  setSessionForCheckoutState(s);
25827
26042
  };
25828
- const loadAndSelectPreferredToken = useCallback42(async () => {
26043
+ const loadAndSelectPreferredToken = useCallback62(async () => {
25829
26044
  if (!customerId) return;
25830
26045
  try {
25831
26046
  const existing = await withTokenRefresh(
@@ -25855,7 +26070,7 @@ function PayWithStripeLink({
25855
26070
  };
25856
26071
  const [quoteError, setQuoteError] = useState292(null);
25857
26072
  const [quoteNonce, setQuoteNonce] = useState292(0);
25858
- const quoteNonceAtReviewRef = useRef82(quoteNonce);
26073
+ const quoteNonceAtReviewRef = useRef92(quoteNonce);
25859
26074
  const [purchaseLimit, setPurchaseLimit] = useState292(null);
25860
26075
  const [limitReachedAmount, setLimitReachedAmount] = useState292(null);
25861
26076
  const [requiredStepUp, setRequiredStepUp] = useState292(null);
@@ -26633,10 +26848,16 @@ function PayWithStripeLink({
26633
26848
  return /* @__PURE__ */ jsxs41(
26634
26849
  "div",
26635
26850
  {
26636
- className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-max-h-[70vh]",
26851
+ className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-overflow-x-hidden uf-max-h-[70vh]",
26637
26852
  style: { backgroundColor: colors2.background },
26638
26853
  children: [
26639
- /* @__PURE__ */ jsx44("div", { ref: paymentMountRef, className: "uf-w-full uf-flex-1 uf-overflow-y-auto" }),
26854
+ /* @__PURE__ */ jsx44(
26855
+ "div",
26856
+ {
26857
+ ref: paymentMountRef,
26858
+ className: "uf-w-full uf-flex-1 uf-overflow-y-auto uf-overflow-x-hidden"
26859
+ }
26860
+ ),
26640
26861
  !stripePaymentUIReady && /* @__PURE__ */ jsx44("div", { className: "uf-flex uf-items-center uf-justify-center uf-py-8", children: /* @__PURE__ */ jsx44(LoaderCircle, { className: "uf-w-8 uf-h-8 uf-animate-spin", style: { color: colors2.primary } }) }),
26641
26862
  error && /* @__PURE__ */ jsx44(
26642
26863
  "div",
@@ -26654,7 +26875,7 @@ function PayWithStripeLink({
26654
26875
  return /* @__PURE__ */ jsxs41(
26655
26876
  "div",
26656
26877
  {
26657
- className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-max-h-[70vh]",
26878
+ className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-overflow-x-hidden uf-max-h-[70vh]",
26658
26879
  style: { backgroundColor: colors2.background },
26659
26880
  children: [
26660
26881
  displayPaymentTokens.length === 0 && !loading && /* @__PURE__ */ jsx44("div", { className: "uf-px-1 uf-mb-3 uf-text-center", children: /* @__PURE__ */ jsx44(
@@ -27764,17 +27985,30 @@ function PayWithStripeLink({
27764
27985
  }
27765
27986
  function useProjectConfig({
27766
27987
  publishableKey,
27767
- enabled = true
27988
+ enabled = true,
27989
+ countryCode,
27990
+ subdivisionCode
27768
27991
  }) {
27769
- const { data: projectConfig, isLoading } = useQuery8({
27770
- queryKey: ["unifold", "projectConfig", publishableKey],
27771
- queryFn: () => getProjectConfig(publishableKey),
27992
+ const {
27993
+ data: projectConfig,
27994
+ isLoading,
27995
+ error
27996
+ } = useQuery9({
27997
+ // Country is part of the key so a region change refetches the region-aware
27998
+ // config. Omitted when undefined so callers that don't pass a country keep
27999
+ // sharing the base cache entry.
28000
+ queryKey: countryCode ? ["unifold", "projectConfig", publishableKey, countryCode, subdivisionCode ?? null] : ["unifold", "projectConfig", publishableKey],
28001
+ queryFn: () => getProjectConfig(publishableKey, countryCode ? { countryCode, subdivisionCode } : void 0),
27772
28002
  enabled,
28003
+ // Keep the previous (e.g. no-country) config visible while the region-aware
28004
+ // config refetches after the country resolves, so unrelated config-driven
28005
+ // UI doesn't flash back to defaults.
28006
+ placeholderData: keepPreviousData,
27773
28007
  staleTime: 1e3 * 60 * 30,
27774
28008
  refetchOnMount: true,
27775
28009
  refetchOnWindowFocus: true
27776
28010
  });
27777
- return { projectConfig, isLoading };
28011
+ return { projectConfig, isLoading, error: error ?? null };
27778
28012
  }
27779
28013
  function useSupportedDepositTokens(publishableKey, options) {
27780
28014
  const hasDestination = options?.destination_token_address && options?.destination_chain_id && options?.destination_chain_type;
@@ -27787,7 +28021,7 @@ function useSupportedDepositTokens(publishableKey, options) {
27787
28021
  ...options?.product_type ? { product_type: options.product_type } : {}
27788
28022
  };
27789
28023
  const hasFilteredOptions = Object.keys(filteredOptions).length > 0;
27790
- return useQuery9({
28024
+ return useQuery10({
27791
28025
  queryKey: [
27792
28026
  "unifold",
27793
28027
  "supportedDepositTokens",
@@ -27811,7 +28045,7 @@ function useIntegrationTransferDefaultToken({
27811
28045
  publishableKey,
27812
28046
  enabled = true
27813
28047
  }) {
27814
- return useQuery10({
28048
+ return useQuery11({
27815
28049
  queryKey: [
27816
28050
  "unifold",
27817
28051
  "integrationTransferDefaultToken",
@@ -27877,7 +28111,8 @@ function CoinbaseConnect({
27877
28111
  defaultSourceChainType,
27878
28112
  defaultSourceChainId,
27879
28113
  defaultSourceTokenAddress,
27880
- defaultSourceSymbol
28114
+ defaultSourceSymbol,
28115
+ prefilledAmountUsd
27881
28116
  }) {
27882
28117
  const { colors: colors2, fonts, components } = useTheme();
27883
28118
  const { projectConfig } = useProjectConfig({ publishableKey });
@@ -27887,12 +28122,12 @@ function CoinbaseConnect({
27887
28122
  destination_chain_id: destinationChainId,
27888
28123
  destination_chain_type: destinationChainType
27889
28124
  });
27890
- const supportedSymbols = useMemo72(() => {
28125
+ const supportedSymbols = useMemo82(() => {
27891
28126
  const set = /* @__PURE__ */ new Set();
27892
28127
  supportedTokensData?.data.forEach((token) => set.add(token.symbol.toLowerCase()));
27893
28128
  return set;
27894
28129
  }, [supportedTokensData]);
27895
- const stablecoinSymbols = useMemo72(() => {
28130
+ const stablecoinSymbols = useMemo82(() => {
27896
28131
  const set = /* @__PURE__ */ new Set();
27897
28132
  supportedTokensData?.data.forEach((token) => {
27898
28133
  if (token.is_stablecoin) set.add(token.symbol.toLowerCase());
@@ -27925,12 +28160,12 @@ function CoinbaseConnect({
27925
28160
  const [transferDepositWalletId, setTransferDepositWalletId] = useState30(
27926
28161
  void 0
27927
28162
  );
27928
- const exchangeSupportedCurrencies = useMemo72(() => {
28163
+ const exchangeSupportedCurrencies = useMemo82(() => {
27929
28164
  const set = /* @__PURE__ */ new Set();
27930
28165
  selectedExchange?.supported_currencies.forEach((c) => set.add(c.toLowerCase()));
27931
28166
  return set;
27932
28167
  }, [selectedExchange]);
27933
- const defaultTokenParams = useMemo72(
28168
+ const defaultTokenParams = useMemo82(
27934
28169
  () => selectedAsset ? {
27935
28170
  integration_provider: IntegrationProvider.COINBASE,
27936
28171
  source_currency: selectedAsset.currency.toLowerCase(),
@@ -27953,7 +28188,7 @@ function CoinbaseConnect({
27953
28188
  params: defaultTokenParams,
27954
28189
  publishableKey
27955
28190
  });
27956
- const defaultSourceCurrency = useMemo72(
28191
+ const defaultSourceCurrency = useMemo82(
27957
28192
  () => resolveDefaultSourceSymbol(supportedTokensData?.data, {
27958
28193
  defaultSourceChainType,
27959
28194
  defaultSourceChainId,
@@ -27968,7 +28203,7 @@ function CoinbaseConnect({
27968
28203
  defaultSourceSymbol
27969
28204
  ]
27970
28205
  );
27971
- const sortedHoldings = useMemo72(() => {
28206
+ const sortedHoldings = useMemo82(() => {
27972
28207
  const supported = [];
27973
28208
  const unsupported = [];
27974
28209
  holdings.forEach((account) => {
@@ -27988,7 +28223,7 @@ function CoinbaseConnect({
27988
28223
  }
27989
28224
  return [...supported, ...unsupported];
27990
28225
  }, [holdings, supportedSymbols, exchangeSupportedCurrencies, defaultSourceCurrency]);
27991
- const selectedHoldingIsSupported = useMemo72(() => {
28226
+ const selectedHoldingIsSupported = useMemo82(() => {
27992
28227
  if (!selectedHolding) return false;
27993
28228
  const currencyLower = selectedHolding.currency.toLowerCase();
27994
28229
  return (supportedSymbols.size === 0 || supportedSymbols.has(currencyLower)) && (exchangeSupportedCurrencies.size === 0 || exchangeSupportedCurrencies.has(currencyLower));
@@ -28032,10 +28267,10 @@ function CoinbaseConnect({
28032
28267
  useEffect252(() => {
28033
28268
  onExecutionsChange?.(depositExecutions);
28034
28269
  }, [depositExecutions, onExecutionsChange]);
28035
- const pollRef = useRef92(null);
28036
- const popupRef = useRef92(null);
28037
- const viewRef = useRef92(initialView);
28038
- const transitionTo = useCallback52((nextView) => {
28270
+ const pollRef = useRef102(null);
28271
+ const popupRef = useRef102(null);
28272
+ const viewRef = useRef102(initialView);
28273
+ const transitionTo = useCallback72((nextView) => {
28039
28274
  if (nextView === viewRef.current) return;
28040
28275
  setIsTransitioning(true);
28041
28276
  setTimeout(() => {
@@ -28045,7 +28280,7 @@ function CoinbaseConnect({
28045
28280
  setIsTransitioning(false);
28046
28281
  }, 150);
28047
28282
  }, []);
28048
- const tryRefreshToken = useCallback52(
28283
+ const tryRefreshToken = useCallback72(
28049
28284
  async (currentToken) => {
28050
28285
  try {
28051
28286
  const result = await refreshIntegrationToken(currentToken, publishableKey);
@@ -28083,7 +28318,7 @@ function CoinbaseConnect({
28083
28318
  }
28084
28319
  }
28085
28320
  }, []);
28086
- const loadHoldings = useCallback52(
28321
+ const loadHoldings = useCallback72(
28087
28322
  async (token) => {
28088
28323
  setIsLoading(true);
28089
28324
  try {
@@ -28135,7 +28370,7 @@ function CoinbaseConnect({
28135
28370
  if (pollRef.current) clearInterval(pollRef.current);
28136
28371
  };
28137
28372
  }, []);
28138
- const minDepositUsd = useMemo72(() => {
28373
+ const minDepositUsd = useMemo82(() => {
28139
28374
  if (!selectedAsset || !defaultTokenData) return 0;
28140
28375
  const supportedToken = supportedTokensData?.data.find(
28141
28376
  (t14) => t14.symbol.toLowerCase() === selectedAsset.currency.toLowerCase()
@@ -28146,7 +28381,7 @@ function CoinbaseConnect({
28146
28381
  );
28147
28382
  return matchingChain?.minimum_deposit_amount_usd ?? Math.min(...supportedToken.chains.map((c) => c.minimum_deposit_amount_usd));
28148
28383
  }, [selectedAsset, supportedTokensData, defaultTokenData]);
28149
- const estimatedProcessingTime = useMemo72(() => {
28384
+ const estimatedProcessingTime = useMemo82(() => {
28150
28385
  if (!selectedAsset || !defaultTokenData) return null;
28151
28386
  const supportedToken = supportedTokensData?.data.find(
28152
28387
  (t14) => t14.symbol.toLowerCase() === selectedAsset.currency.toLowerCase()
@@ -28200,7 +28435,8 @@ function CoinbaseConnect({
28200
28435
  };
28201
28436
  const handleSelectAsset = (asset) => {
28202
28437
  setSelectedAsset(asset);
28203
- setSendAmount("");
28438
+ const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
28439
+ setSendAmount(cleanedPrefilled);
28204
28440
  transitionTo("enter_amount");
28205
28441
  };
28206
28442
  const handleCreateTransfer = async () => {
@@ -29788,7 +30024,7 @@ function useExchanges({
29788
30024
  publishableKey,
29789
30025
  enabled = true
29790
30026
  }) {
29791
- const { data: exchanges = [], isLoading } = useQuery11({
30027
+ const { data: exchanges = [], isLoading } = useQuery12({
29792
30028
  queryKey: ["unifold", "exchanges", publishableKey],
29793
30029
  queryFn: () => getExchanges(void 0, publishableKey).then((res) => res.data),
29794
30030
  enabled,
@@ -29802,7 +30038,7 @@ function useApplePayProviders({
29802
30038
  publishableKey,
29803
30039
  enabled = true
29804
30040
  }) {
29805
- const { data: providers, isLoading } = useQuery12({
30041
+ const { data: providers, isLoading } = useQuery13({
29806
30042
  queryKey: ["unifold", "applePayProviders", publishableKey],
29807
30043
  queryFn: () => getApplePayProviders(publishableKey),
29808
30044
  enabled,
@@ -29813,44 +30049,28 @@ function useApplePayProviders({
29813
30049
  return { providers, isLoading };
29814
30050
  }
29815
30051
  function useAllowedCountry(publishableKey) {
30052
+ const { userIpInfo, isLoading: isIpLoading, error: ipError } = useUserIp2();
29816
30053
  const {
29817
- data: ipData,
29818
- isLoading: isIpLoading,
29819
- error: ipError
29820
- } = useQuery13({
29821
- queryKey: ["unifold", "ipAddress"],
29822
- queryFn: () => getIpAddress(),
29823
- refetchOnMount: false,
29824
- refetchOnReconnect: true,
29825
- refetchOnWindowFocus: false,
29826
- staleTime: 1e3 * 60 * 60,
29827
- // 1 hour
29828
- gcTime: 1e3 * 60 * 60 * 24
29829
- // 24 hours
29830
- });
29831
- const {
29832
- data: configData,
30054
+ projectConfig,
29833
30055
  isLoading: isConfigLoading,
29834
30056
  error: configError
29835
- } = useQuery13({
29836
- queryKey: ["unifold", "projectConfig", publishableKey],
29837
- queryFn: () => getProjectConfig(publishableKey),
29838
- refetchOnMount: false,
29839
- refetchOnReconnect: true,
29840
- refetchOnWindowFocus: false,
29841
- staleTime: 1e3 * 60 * 5,
29842
- // 5 minutes
29843
- gcTime: 1e3 * 60 * 60
29844
- // 1 hour
30057
+ } = useProjectConfig({
30058
+ publishableKey,
30059
+ // Wait for the IP so we issue a single country-aware config request rather
30060
+ // than a country-less fetch followed by a country-aware refetch. Shares the
30061
+ // query key with DepositModal's useProjectConfig, so they dedupe.
30062
+ enabled: !isIpLoading,
30063
+ countryCode: userIpInfo?.alpha2,
30064
+ subdivisionCode: userIpInfo?.subdivisionCode ?? void 0
29845
30065
  });
29846
30066
  const isLoading = isIpLoading || isConfigLoading;
29847
30067
  const error = ipError || configError || null;
30068
+ const userSubdivision = userIpInfo?.subdivisionCode || userIpInfo?.state || "";
29848
30069
  let isAllowed = null;
29849
- if (ipData && configData) {
29850
- const blockedCodes = configData.blocked_country_codes || [];
29851
- const blockedSubdivisions = configData.blocked_country_subdivisions || [];
29852
- const userCountryUpper = ipData.alpha2.toUpperCase();
29853
- const userSubdivision = ipData.subdivision_code || ipData.state || "";
30070
+ if (userIpInfo && projectConfig) {
30071
+ const blockedCodes = projectConfig.blocked_country_codes || [];
30072
+ const blockedSubdivisions = projectConfig.blocked_country_subdivisions || [];
30073
+ const userCountryUpper = userIpInfo.alpha2.toUpperCase();
29854
30074
  const userSubdivisionUpper = userSubdivision.toUpperCase();
29855
30075
  const isCountryBlocked = blockedCodes.some((code) => code.toUpperCase() === userCountryUpper);
29856
30076
  const isSubdivisionBlocked = blockedSubdivisions.some((entry) => {
@@ -29859,12 +30079,11 @@ function useAllowedCountry(publishableKey) {
29859
30079
  });
29860
30080
  isAllowed = !isCountryBlocked && !isSubdivisionBlocked;
29861
30081
  }
29862
- const subdivisionCode = ipData?.subdivision_code || ipData?.state || "" || null;
29863
30082
  return {
29864
30083
  isAllowed,
29865
- alpha2: ipData?.alpha2 ?? null,
29866
- country: ipData?.country ?? null,
29867
- subdivisionCode,
30084
+ alpha2: userIpInfo?.alpha2 ?? null,
30085
+ country: userIpInfo?.country ?? null,
30086
+ subdivisionCode: userSubdivision || null,
29868
30087
  isLoading,
29869
30088
  error
29870
30089
  };
@@ -29928,7 +30147,7 @@ function ThemeStyleInjector({
29928
30147
  className
29929
30148
  }) {
29930
30149
  const { colors: colors2, fonts, mode } = useTheme();
29931
- const cssVars = React312.useMemo(() => {
30150
+ const cssVars = React322.useMemo(() => {
29932
30151
  const hexToHSL = (hex) => {
29933
30152
  hex = hex.replace("#", "");
29934
30153
  const r2 = parseInt(hex.slice(0, 2), 16) / 255;
@@ -29988,7 +30207,7 @@ function ThemeStyleInjector({
29988
30207
  ...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
29989
30208
  };
29990
30209
  }, [colors2, fonts.regular]);
29991
- React312.useEffect(() => {
30210
+ React322.useEffect(() => {
29992
30211
  if (typeof document === "undefined") return;
29993
30212
  if (fonts.regular) {
29994
30213
  document.documentElement.style.setProperty("--uf-font-family", fonts.regular);
@@ -30316,7 +30535,7 @@ function TokenSelectorSheet({
30316
30535
  useEffect282(() => {
30317
30536
  setRecentTokens(getRecentTokens());
30318
30537
  }, []);
30319
- const allOptions = useMemo92(() => {
30538
+ const allOptions = useMemo102(() => {
30320
30539
  const options = [];
30321
30540
  tokens.forEach((token) => {
30322
30541
  token.chains.forEach((chain) => {
@@ -30325,7 +30544,7 @@ function TokenSelectorSheet({
30325
30544
  });
30326
30545
  return options;
30327
30546
  }, [tokens]);
30328
- const quickSelectOptions = useMemo92(() => {
30547
+ const quickSelectOptions = useMemo102(() => {
30329
30548
  const result = [];
30330
30549
  const seen = /* @__PURE__ */ new Set();
30331
30550
  const addOption = (symbol, chainType, chainId, isRecent) => {
@@ -30357,7 +30576,7 @@ function TokenSelectorSheet({
30357
30576
  });
30358
30577
  setRecentTokens(updated);
30359
30578
  };
30360
- const fuse = useMemo92(
30579
+ const fuse = useMemo102(
30361
30580
  () => new Fuse(allOptions, {
30362
30581
  keys: [
30363
30582
  { name: "token.symbol", weight: 2 },
@@ -30370,7 +30589,7 @@ function TokenSelectorSheet({
30370
30589
  }),
30371
30590
  [allOptions]
30372
30591
  );
30373
- const filteredOptions = useMemo92(() => {
30592
+ const filteredOptions = useMemo102(() => {
30374
30593
  if (!searchQuery.trim()) return allOptions;
30375
30594
  const query = searchQuery.trim();
30376
30595
  const results = fuse.search(query);
@@ -30797,7 +31016,7 @@ function useDefaultToken({
30797
31016
  const [token, setToken] = useState33(null);
30798
31017
  const [chain, setChain] = useState33(null);
30799
31018
  const [initialSelectionDone, setInitialSelectionDone] = useState33(false);
30800
- const appliedDefaultsRef = useRef102("");
31019
+ const appliedDefaultsRef = useRef112("");
30801
31020
  useEffect292(() => {
30802
31021
  if (!tokens.length) return;
30803
31022
  const defaultsKey = `${defaultTokenAddress ?? ""}|${defaultSymbol ?? ""}|${defaultChainType ?? ""}|${defaultChainId ?? ""}`;
@@ -31133,14 +31352,14 @@ function useCopyAddress() {
31133
31352
  return { copied, handleCopy };
31134
31353
  }
31135
31354
  var TooltipProvider2 = Provider;
31136
- var TooltipContext = React322.createContext({
31355
+ var TooltipContext = React332.createContext({
31137
31356
  open: false,
31138
31357
  onOpenChange: () => {
31139
31358
  }
31140
31359
  });
31141
- var TooltipTrigger2 = React322.forwardRef(({ onClick, ...props }, ref) => {
31142
- const { open, onOpenChange } = React322.useContext(TooltipContext);
31143
- const handleClick = React322.useCallback(
31360
+ var TooltipTrigger2 = React332.forwardRef(({ onClick, ...props }, ref) => {
31361
+ const { open, onOpenChange } = React332.useContext(TooltipContext);
31362
+ const handleClick = React332.useCallback(
31144
31363
  (e) => {
31145
31364
  onOpenChange(!open);
31146
31365
  onClick?.(e);
@@ -31150,7 +31369,7 @@ var TooltipTrigger2 = React322.forwardRef(({ onClick, ...props }, ref) => {
31150
31369
  return /* @__PURE__ */ jsx522(Trigger, { ref, onClick: handleClick, ...props });
31151
31370
  });
31152
31371
  TooltipTrigger2.displayName = Trigger.displayName;
31153
- var TooltipContent2 = React322.forwardRef(({ className, sideOffset = 4, ...props }, ref) => {
31372
+ var TooltipContent2 = React332.forwardRef(({ className, sideOffset = 4, ...props }, ref) => {
31154
31373
  const { themeClass, colors: colors2 } = useTheme();
31155
31374
  return /* @__PURE__ */ jsx522(Portal3, { children: /* @__PURE__ */ jsx522(
31156
31375
  Content22,
@@ -31260,6 +31479,7 @@ function TransferCryptoSingleInput({
31260
31479
  onDepositError,
31261
31480
  wallets: externalWallets,
31262
31481
  onSourceTokenChange,
31482
+ prefilledAmountUsd,
31263
31483
  checkoutQuote,
31264
31484
  isCheckoutQuoteLoading = false,
31265
31485
  persistCheckingIndicator = false,
@@ -31307,7 +31527,7 @@ function TransferCryptoSingleInput({
31307
31527
  const wallets = externalWallets?.length ? externalWallets : depositAddressResponse?.data ?? [];
31308
31528
  const loading = externalWallets?.length ? false : walletsLoading;
31309
31529
  const error = walletsError?.message ?? null;
31310
- const allAvailableChains = useMemo102(() => {
31530
+ const allAvailableChains = useMemo112(() => {
31311
31531
  const chainsMap = /* @__PURE__ */ new Map();
31312
31532
  supportedTokens.forEach((t13) => {
31313
31533
  t13.chains.forEach((c) => {
@@ -31403,6 +31623,22 @@ function TransferCryptoSingleInput({
31403
31623
  const maxSlippage = currentChainFromBackend?.max_slippage_percent ?? 0.25;
31404
31624
  const processingTime = currentChainFromBackend?.estimated_processing_time ?? null;
31405
31625
  const minDepositUsd = currentChainFromBackend?.minimum_deposit_amount_usd ?? 3;
31626
+ const parsedPrefilledUsd = useMemo112(() => {
31627
+ const value = parseFloat(prefilledAmountUsd ?? "");
31628
+ return Number.isFinite(value) && value > 0 ? value : null;
31629
+ }, [prefilledAmountUsd]);
31630
+ const effectivePrefilledUsd = useMemo112(() => {
31631
+ if (parsedPrefilledUsd === null) return null;
31632
+ return Math.max(parsedPrefilledUsd, minDepositUsd);
31633
+ }, [parsedPrefilledUsd, minDepositUsd]);
31634
+ const prefillDisplay = useMemo112(() => {
31635
+ if (effectivePrefilledUsd === null) return null;
31636
+ const usdLabel = `$${effectivePrefilledUsd.toFixed(2)}`;
31637
+ if (selectedToken?.is_stablecoin) {
31638
+ return `${effectivePrefilledUsd.toFixed(2)} ${selectedToken.symbol} (${usdLabel})`;
31639
+ }
31640
+ return `${usdLabel} USD`;
31641
+ }, [effectivePrefilledUsd, selectedToken]);
31406
31642
  return /* @__PURE__ */ jsx54(TooltipProvider2, { delayDuration: 0, skipDelayDuration: 0, children: /* @__PURE__ */ jsxs49(
31407
31643
  "div",
31408
31644
  {
@@ -31529,7 +31765,7 @@ function TransferCryptoSingleInput({
31529
31765
  /* @__PURE__ */ jsx54("span", { children: "Retrying automatically every 5 seconds..." })
31530
31766
  ] })
31531
31767
  ] }),
31532
- (checkoutQuote || isCheckoutQuoteLoading) && /* @__PURE__ */ jsxs49(
31768
+ (checkoutQuote || isCheckoutQuoteLoading || prefillDisplay) && /* @__PURE__ */ jsxs49(
31533
31769
  "div",
31534
31770
  {
31535
31771
  className: "uf-rounded-xl uf-px-3 uf-py-2 uf-flex uf-items-center uf-justify-between",
@@ -31573,6 +31809,13 @@ function TransferCryptoSingleInput({
31573
31809
  )
31574
31810
  ]
31575
31811
  }
31812
+ ) : prefillDisplay ? /* @__PURE__ */ jsx54(
31813
+ "span",
31814
+ {
31815
+ className: "uf-text-sm uf-font-semibold",
31816
+ style: { color: components.card.titleColor, fontFamily: fonts.semibold },
31817
+ children: prefillDisplay
31818
+ }
31576
31819
  ) : /* @__PURE__ */ jsx54(
31577
31820
  "div",
31578
31821
  {
@@ -31902,7 +32145,7 @@ function TransferCryptoSingleInput({
31902
32145
  }
31903
32146
  var Select2 = Root23;
31904
32147
  var SelectValue2 = Value;
31905
- var SelectTrigger2 = React332.forwardRef(({ className, style, children, ...props }, ref) => {
32148
+ var SelectTrigger2 = React342.forwardRef(({ className, style, children, ...props }, ref) => {
31906
32149
  const { components } = useTheme();
31907
32150
  return /* @__PURE__ */ jsxs50(
31908
32151
  Trigger2,
@@ -31926,7 +32169,7 @@ var SelectTrigger2 = React332.forwardRef(({ className, style, children, ...props
31926
32169
  );
31927
32170
  });
31928
32171
  SelectTrigger2.displayName = Trigger2.displayName;
31929
- var SelectScrollUpButton2 = React332.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
32172
+ var SelectScrollUpButton2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
31930
32173
  ScrollUpButton,
31931
32174
  {
31932
32175
  ref,
@@ -31936,7 +32179,7 @@ var SelectScrollUpButton2 = React332.forwardRef(({ className, ...props }, ref) =
31936
32179
  }
31937
32180
  ));
31938
32181
  SelectScrollUpButton2.displayName = ScrollUpButton.displayName;
31939
- var SelectScrollDownButton2 = React332.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
32182
+ var SelectScrollDownButton2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
31940
32183
  ScrollDownButton,
31941
32184
  {
31942
32185
  ref,
@@ -31946,7 +32189,7 @@ var SelectScrollDownButton2 = React332.forwardRef(({ className, ...props }, ref)
31946
32189
  }
31947
32190
  ));
31948
32191
  SelectScrollDownButton2.displayName = ScrollDownButton.displayName;
31949
- var SelectContent2 = React332.forwardRef(({ className, style, children, position = "popper", ...props }, ref) => {
32192
+ var SelectContent2 = React342.forwardRef(({ className, style, children, position = "popper", ...props }, ref) => {
31950
32193
  const { themeClass, colors: colors2, components } = useTheme();
31951
32194
  return /* @__PURE__ */ jsx55(Portal4, { children: /* @__PURE__ */ jsxs50(
31952
32195
  Content23,
@@ -31984,7 +32227,7 @@ var SelectContent2 = React332.forwardRef(({ className, style, children, position
31984
32227
  ) });
31985
32228
  });
31986
32229
  SelectContent2.displayName = Content23.displayName;
31987
- var SelectLabel2 = React332.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
32230
+ var SelectLabel2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
31988
32231
  Label,
31989
32232
  {
31990
32233
  ref,
@@ -31993,7 +32236,7 @@ var SelectLabel2 = React332.forwardRef(({ className, ...props }, ref) => /* @__P
31993
32236
  }
31994
32237
  ));
31995
32238
  SelectLabel2.displayName = Label.displayName;
31996
- var SelectItem2 = React332.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs50(
32239
+ var SelectItem2 = React342.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs50(
31997
32240
  Item,
31998
32241
  {
31999
32242
  ref,
@@ -32009,7 +32252,7 @@ var SelectItem2 = React332.forwardRef(({ className, children, ...props }, ref) =
32009
32252
  }
32010
32253
  ));
32011
32254
  SelectItem2.displayName = Item.displayName;
32012
- var SelectSeparator2 = React332.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
32255
+ var SelectSeparator2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
32013
32256
  Separator,
32014
32257
  {
32015
32258
  ref,
@@ -32037,6 +32280,7 @@ function TransferCryptoDoubleInput({
32037
32280
  defaultSourceChainId,
32038
32281
  defaultSourceTokenAddress,
32039
32282
  defaultSourceSymbol,
32283
+ prefilledAmountUsd,
32040
32284
  depositConfirmationMode = "auto_ui",
32041
32285
  onExecutionsChange,
32042
32286
  onDepositSuccess,
@@ -32083,7 +32327,7 @@ function TransferCryptoDoubleInput({
32083
32327
  const wallets = externalWallets?.length ? externalWallets : depositAddressResponse?.data ?? [];
32084
32328
  const loading = externalWallets?.length ? false : walletsLoading;
32085
32329
  const error = walletsError?.message ?? null;
32086
- const allAvailableChains = useMemo112(() => {
32330
+ const allAvailableChains = useMemo122(() => {
32087
32331
  const chainsMap = /* @__PURE__ */ new Map();
32088
32332
  supportedTokens.forEach((t13) => {
32089
32333
  t13.chains.forEach((c) => {
@@ -32161,6 +32405,22 @@ function TransferCryptoDoubleInput({
32161
32405
  const maxSlippage = currentChainFromBackend?.max_slippage_percent ?? 0.25;
32162
32406
  const processingTime = currentChainFromBackend?.estimated_processing_time ?? null;
32163
32407
  const minDepositUsd = currentChainFromBackend?.minimum_deposit_amount_usd ?? 3;
32408
+ const parsedPrefilledUsd = useMemo122(() => {
32409
+ const value = parseFloat(prefilledAmountUsd ?? "");
32410
+ return Number.isFinite(value) && value > 0 ? value : null;
32411
+ }, [prefilledAmountUsd]);
32412
+ const effectivePrefilledUsd = useMemo122(() => {
32413
+ if (parsedPrefilledUsd === null) return null;
32414
+ return Math.max(parsedPrefilledUsd, minDepositUsd);
32415
+ }, [parsedPrefilledUsd, minDepositUsd]);
32416
+ const prefillDisplay = useMemo122(() => {
32417
+ if (effectivePrefilledUsd === null) return null;
32418
+ const usdLabel = `$${effectivePrefilledUsd.toFixed(2)}`;
32419
+ if (selectedToken?.is_stablecoin) {
32420
+ return `${effectivePrefilledUsd.toFixed(2)} ${selectedToken.symbol} (${usdLabel})`;
32421
+ }
32422
+ return `${usdLabel} USD`;
32423
+ }, [effectivePrefilledUsd, selectedToken]);
32164
32424
  const renderTokenItem = (tokenData) => {
32165
32425
  return /* @__PURE__ */ jsxs51("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
32166
32426
  /* @__PURE__ */ jsx56(
@@ -32341,6 +32601,35 @@ function TransferCryptoDoubleInput({
32341
32601
  /* @__PURE__ */ jsx56("span", { children: "Retrying automatically every 5 seconds..." })
32342
32602
  ] })
32343
32603
  ] }),
32604
+ prefillDisplay && /* @__PURE__ */ jsxs51(
32605
+ "div",
32606
+ {
32607
+ className: "uf-rounded-xl uf-px-3 uf-py-2 uf-flex uf-items-center uf-justify-between",
32608
+ style: {
32609
+ backgroundColor: components.card.backgroundColor,
32610
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`,
32611
+ borderRadius: components.card.borderRadius
32612
+ },
32613
+ children: [
32614
+ /* @__PURE__ */ jsx56(
32615
+ "span",
32616
+ {
32617
+ className: "uf-text-xs",
32618
+ style: { color: components.card.subtitleColor, fontFamily: fonts.regular },
32619
+ children: "You send"
32620
+ }
32621
+ ),
32622
+ /* @__PURE__ */ jsx56(
32623
+ "span",
32624
+ {
32625
+ className: "uf-text-sm uf-font-semibold",
32626
+ style: { color: components.card.titleColor, fontFamily: fonts.semibold },
32627
+ children: prefillDisplay
32628
+ }
32629
+ )
32630
+ ]
32631
+ }
32632
+ ),
32344
32633
  /* @__PURE__ */ jsxs51("div", { className: "uf-flex uf-flex-col uf-items-center uf-pt-2", children: [
32345
32634
  /* @__PURE__ */ jsx56(
32346
32635
  "div",
@@ -33928,7 +34217,7 @@ function WalletConnect({
33928
34217
  amountQuickSelect = "percentage",
33929
34218
  onWalletDisconnect,
33930
34219
  onWalletConnected,
33931
- prefillAmountUsd,
34220
+ prefilledAmountUsd,
33932
34221
  checkoutAmountUsd,
33933
34222
  checkoutReceivedUsd,
33934
34223
  onNewDeposit,
@@ -33950,28 +34239,28 @@ function WalletConnect({
33950
34239
  onExecutionsChange
33951
34240
  }) {
33952
34241
  const { colors: colors2, fonts, components, mode } = useTheme();
33953
- const walletProvidedAtMount = React342.useRef(!!initialWalletInfo && !!initialDepositWallet);
33954
- const [activeWalletInfo, setActiveWalletInfo] = React342.useState(
34242
+ const walletProvidedAtMount = React352.useRef(!!initialWalletInfo && !!initialDepositWallet);
34243
+ const [activeWalletInfo, setActiveWalletInfo] = React352.useState(
33955
34244
  initialWalletInfo ?? null
33956
34245
  );
33957
- const [activeDepositWallet, setActiveDepositWallet] = React342.useState(
34246
+ const [activeDepositWallet, setActiveDepositWallet] = React352.useState(
33958
34247
  initialDepositWallet ?? null
33959
34248
  );
33960
34249
  const initialView = initialWalletInfo && initialDepositWallet ? "select_token" : "select_wallet";
33961
- const [view, setView] = React342.useState(initialView);
33962
- const [isTransitioning, setIsTransitioning] = React342.useState(false);
33963
- const viewRef = React342.useRef(initialView);
34250
+ const [view, setView] = React352.useState(initialView);
34251
+ const [isTransitioning, setIsTransitioning] = React352.useState(false);
34252
+ const viewRef = React352.useRef(initialView);
33964
34253
  const standalone = !canGoBack && !walletProvidedAtMount.current;
33965
34254
  const { wallet: detectedWallet, isLoading: detectingWallet } = useDetectedBrowserWallet({
33966
34255
  enabled: standalone
33967
34256
  });
33968
- const [autoResolved, setAutoResolved] = React342.useState(false);
33969
- const [selectedWalletDef, setSelectedWalletDef] = React342.useState(null);
33970
- const [connectingNetwork, setConnectingNetwork] = React342.useState(null);
33971
- const [walletError, setWalletError] = React342.useState(null);
33972
- const [isWalletConnecting, setIsWalletConnecting] = React342.useState(false);
33973
- const [eip6963ProviderCount, setEip6963ProviderCount] = React342.useState(0);
33974
- React342.useEffect(() => {
34257
+ const [autoResolved, setAutoResolved] = React352.useState(false);
34258
+ const [selectedWalletDef, setSelectedWalletDef] = React352.useState(null);
34259
+ const [connectingNetwork, setConnectingNetwork] = React352.useState(null);
34260
+ const [walletError, setWalletError] = React352.useState(null);
34261
+ const [isWalletConnecting, setIsWalletConnecting] = React352.useState(false);
34262
+ const [eip6963ProviderCount, setEip6963ProviderCount] = React352.useState(0);
34263
+ React352.useEffect(() => {
33975
34264
  const store = getEip6963Store();
33976
34265
  if (!store) return;
33977
34266
  setEip6963ProviderCount(store.getProviders().length);
@@ -33980,7 +34269,7 @@ function WalletConnect({
33980
34269
  });
33981
34270
  }, []);
33982
34271
  const { wallets: backendWallets } = useExternalWallets({ publishableKey });
33983
- const walletDefinitions = React342.useMemo(
34272
+ const walletDefinitions = React352.useMemo(
33984
34273
  () => backendWallets.length > 0 ? backendWallets.map((w) => ({
33985
34274
  id: w.id,
33986
34275
  name: w.name,
@@ -33991,32 +34280,32 @@ function WalletConnect({
33991
34280
  })) : FALLBACK_WALLET_DEFINITIONS,
33992
34281
  [backendWallets]
33993
34282
  );
33994
- const [recentWalletId, setRecentWalletIdState] = React342.useState(getLastOpenedWallet);
33995
- React342.useEffect(() => {
34283
+ const [recentWalletId, setRecentWalletIdState] = React352.useState(getLastOpenedWallet);
34284
+ React352.useEffect(() => {
33996
34285
  if (view === "select_wallet") {
33997
34286
  setRecentWalletIdState(getLastOpenedWallet());
33998
34287
  }
33999
34288
  }, [view]);
34000
- const availableWallets = React342.useMemo(
34289
+ const availableWallets = React352.useMemo(
34001
34290
  () => detectAvailableWallets(walletDefinitions, recentWalletId),
34002
34291
  [walletDefinitions, eip6963ProviderCount, recentWalletId]
34003
34292
  );
34004
- const [isMobile, setIsMobile] = React342.useState(false);
34005
- React342.useEffect(() => {
34293
+ const [isMobile, setIsMobile] = React352.useState(false);
34294
+ React352.useEffect(() => {
34006
34295
  setIsMobile(isMobileDevice());
34007
34296
  }, []);
34008
- const mobileDepositAddresses = React342.useMemo(
34297
+ const mobileDepositAddresses = React352.useMemo(
34009
34298
  () => (depositWallets ?? []).map((w) => ({ chain_type: w.chain_type, address: w.address })),
34010
34299
  [depositWallets]
34011
34300
  );
34012
- const mobileDepositWalletIds = React342.useMemo(
34301
+ const mobileDepositWalletIds = React352.useMemo(
34013
34302
  () => (depositWallets ?? []).filter((w) => w.chain_type === "ethereum" || w.chain_type === "solana").map((w) => w.id),
34014
34303
  [depositWallets]
34015
34304
  );
34016
- const [mobileRedirect, setMobileRedirect] = React342.useState(null);
34017
- const [pendingMobileWallet, setPendingMobileWallet] = React342.useState(null);
34018
- const [awaitingMobileDeposit, setAwaitingMobileDeposit] = React342.useState(false);
34019
- React342.useEffect(() => {
34305
+ const [mobileRedirect, setMobileRedirect] = React352.useState(null);
34306
+ const [pendingMobileWallet, setPendingMobileWallet] = React352.useState(null);
34307
+ const [awaitingMobileDeposit, setAwaitingMobileDeposit] = React352.useState(false);
34308
+ React352.useEffect(() => {
34020
34309
  if (!standalone || autoResolved || detectingWallet) return;
34021
34310
  if (!detectedWallet) {
34022
34311
  setAutoResolved(true);
@@ -34042,32 +34331,36 @@ function WalletConnect({
34042
34331
  depositWallets,
34043
34332
  depositWalletsLoading
34044
34333
  ]);
34045
- React342.useEffect(() => {
34334
+ React352.useEffect(() => {
34046
34335
  if (!standalone || autoResolved) return;
34047
34336
  const t13 = setTimeout(() => setAutoResolved(true), 5e3);
34048
34337
  return () => clearTimeout(t13);
34049
34338
  }, [standalone, autoResolved]);
34050
- const [balances, setBalances] = React342.useState([]);
34051
- const [isLoading, setIsLoading] = React342.useState(false);
34052
- const [selectedBalance, setSelectedBalance] = React342.useState(null);
34053
- const [totalBalanceUsd, setTotalBalanceUsd] = React342.useState(null);
34054
- const [error, setError] = React342.useState(null);
34055
- const [isDisconnectingWallet, setIsDisconnectingWallet] = React342.useState(false);
34056
- const [amountUsd, setAmountUsd] = React342.useState(prefillAmountUsd ?? "");
34057
- const [isConfirming, setIsConfirming] = React342.useState(false);
34058
- const [hasSignedTransaction, setHasSignedTransaction] = React342.useState(false);
34059
- const [tokenChainDetails, setTokenChainDetails] = React342.useState(null);
34060
- const [loadingTokenDetails, setLoadingTokenDetails] = React342.useState(false);
34061
- const [showTransactionDetails, setShowTransactionDetails] = React342.useState(false);
34062
- const [receivedUsdAtSubmission, setReceivedUsdAtSubmission] = React342.useState(null);
34339
+ const [balances, setBalances] = React352.useState([]);
34340
+ const [isLoading, setIsLoading] = React352.useState(false);
34341
+ const [selectedBalance, setSelectedBalance] = React352.useState(null);
34342
+ const [totalBalanceUsd, setTotalBalanceUsd] = React352.useState(null);
34343
+ const [error, setError] = React352.useState(null);
34344
+ const [isDisconnectingWallet, setIsDisconnectingWallet] = React352.useState(false);
34345
+ const [amountUsd, setAmountUsd] = React352.useState(prefilledAmountUsd ?? "");
34346
+ const [isConfirming, setIsConfirming] = React352.useState(false);
34347
+ const [hasSignedTransaction, setHasSignedTransaction] = React352.useState(false);
34348
+ const [tokenChainDetails, setTokenChainDetails] = React352.useState(null);
34349
+ const [loadingTokenDetails, setLoadingTokenDetails] = React352.useState(false);
34350
+ const [showTransactionDetails, setShowTransactionDetails] = React352.useState(false);
34351
+ const [receivedUsdAtSubmission, setReceivedUsdAtSubmission] = React352.useState(null);
34063
34352
  const walletInfo = activeWalletInfo;
34064
34353
  const depositWallet = activeDepositWallet;
34065
34354
  const hasWallet = !!activeWalletInfo && !!activeDepositWallet;
34355
+ React352.useEffect(() => {
34356
+ const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
34357
+ setAmountUsd(cleanedPrefilled);
34358
+ }, [prefilledAmountUsd]);
34066
34359
  const chainType = activeDepositWallet?.chain_type ?? "ethereum";
34067
34360
  const recipientAddress = activeDepositWallet?.address ?? "";
34068
34361
  const isCheckoutMode = !!checkoutAmountUsd;
34069
34362
  const supportedChainType = chainType === "algorand" || chainType === "xrpl" || chainType === "cardano" || chainType === "n1" ? "ethereum" : chainType;
34070
- const transitionTo = React342.useCallback((nextView) => {
34363
+ const transitionTo = React352.useCallback((nextView) => {
34071
34364
  if (nextView === viewRef.current) return;
34072
34365
  setIsTransitioning(true);
34073
34366
  setTimeout(() => {
@@ -34132,7 +34425,7 @@ function WalletConnect({
34132
34425
  if (!selectedWalletDef) return;
34133
34426
  handleConnectWallet(selectedWalletDef, network);
34134
34427
  };
34135
- React342.useEffect(() => {
34428
+ React352.useEffect(() => {
34136
34429
  if (!pendingMobileWallet) return;
34137
34430
  if (mobileDepositAddresses.length > 0) {
34138
34431
  const wallet = pendingMobileWallet;
@@ -34296,7 +34589,7 @@ function WalletConnect({
34296
34589
  publishableKey,
34297
34590
  enabled: !!activeWalletInfo && !!recipientAddress
34298
34591
  });
34299
- const effectiveDestinationAmount = React342.useMemo(() => {
34592
+ const effectiveDestinationAmount = React352.useMemo(() => {
34300
34593
  if (!checkoutRemainingBaseUnits || checkoutRemainingBaseUnits === "0") return "0";
34301
34594
  if (!checkoutAmountUsd) return checkoutRemainingBaseUnits;
34302
34595
  const remaining = BigInt(checkoutRemainingBaseUnits);
@@ -34324,7 +34617,7 @@ function WalletConnect({
34324
34617
  stablecoinParity,
34325
34618
  enabled: isCheckoutMode && !!selectedToken && !!checkoutDestination && effectiveDestinationAmount !== "0"
34326
34619
  });
34327
- const activeCheckoutQuote = React342.useMemo(() => {
34620
+ const activeCheckoutQuote = React352.useMemo(() => {
34328
34621
  if (!isCheckoutMode) return null;
34329
34622
  if (walletCheckoutQuote)
34330
34623
  return {
@@ -34354,10 +34647,10 @@ function WalletConnect({
34354
34647
  onDepositSuccess,
34355
34648
  onDepositError
34356
34649
  });
34357
- React342.useEffect(() => {
34650
+ React352.useEffect(() => {
34358
34651
  onExecutionsChange?.(depositExecutions);
34359
34652
  }, [depositExecutions, onExecutionsChange]);
34360
- const latestDepositExecution = React342.useMemo(() => {
34653
+ const latestDepositExecution = React352.useMemo(() => {
34361
34654
  if (depositExecutions.length === 0) return null;
34362
34655
  return [...depositExecutions].sort((a, b) => {
34363
34656
  const ta = a.created_at ? new Date(a.created_at).getTime() : 0;
@@ -34365,21 +34658,21 @@ function WalletConnect({
34365
34658
  return tb - ta;
34366
34659
  })[0];
34367
34660
  }, [depositExecutions]);
34368
- React342.useEffect(() => {
34661
+ React352.useEffect(() => {
34369
34662
  if (awaitingMobileDeposit && latestDepositExecution && (viewRef.current === "mobile_redirect" || viewRef.current === "connecting")) {
34370
34663
  transitionTo("mobile_deposit_status");
34371
34664
  }
34372
34665
  }, [awaitingMobileDeposit, latestDepositExecution, transitionTo]);
34373
- React342.useEffect(() => {
34374
- if (!prefillAmountUsd || !tokenChainDetails || view !== "enter_amount") return;
34666
+ React352.useEffect(() => {
34667
+ if (!isCheckoutMode || !tokenChainDetails || view !== "enter_amount") return;
34375
34668
  const minDeposit = tokenChainDetails.minimum_deposit_amount_usd || 0;
34376
34669
  const currentAmount = parseFloat(amountUsd) || 0;
34377
34670
  if (currentAmount > 0 && currentAmount < minDeposit) setAmountUsd(minDeposit.toFixed(2));
34378
- }, [tokenChainDetails, view, prefillAmountUsd]);
34379
- React342.useEffect(() => {
34671
+ }, [isCheckoutMode, tokenChainDetails, view, amountUsd]);
34672
+ React352.useEffect(() => {
34380
34673
  if (view === "review") setShowTransactionDetails(false);
34381
34674
  }, [view]);
34382
- React342.useEffect(() => {
34675
+ React352.useEffect(() => {
34383
34676
  if (view !== "enter_amount" && view !== "review" || !selectedBalance || !activeDepositWallet)
34384
34677
  return;
34385
34678
  let cancelled = false;
@@ -34416,7 +34709,7 @@ function WalletConnect({
34416
34709
  cancelled = true;
34417
34710
  };
34418
34711
  }, [view, selectedBalance, publishableKey, activeDepositWallet]);
34419
- React342.useEffect(() => {
34712
+ React352.useEffect(() => {
34420
34713
  if (!activeWalletInfo || !activeDepositWallet) return;
34421
34714
  let cancelled = false;
34422
34715
  setIsLoading(true);
@@ -34481,21 +34774,21 @@ function WalletConnect({
34481
34774
  defaultSourceTokenAddress,
34482
34775
  defaultSourceSymbol
34483
34776
  ]);
34484
- const usdToTokenRate = React342.useMemo(() => {
34777
+ const usdToTokenRate = React352.useMemo(() => {
34485
34778
  if (!selectedBalance || !selectedBalance.amount_usd || !selectedToken) return 0;
34486
34779
  const balanceAmount = Number(selectedBalance.amount) / 10 ** selectedToken.decimals;
34487
34780
  const balanceUsd = parseFloat(selectedBalance.amount_usd);
34488
34781
  if (balanceAmount === 0 || balanceUsd === 0) return 0;
34489
34782
  return balanceAmount / balanceUsd;
34490
34783
  }, [selectedBalance, selectedToken]);
34491
- const tokenAmount = React342.useMemo(() => {
34784
+ const tokenAmount = React352.useMemo(() => {
34492
34785
  if (isCheckoutMode && activeCheckoutQuote && selectedToken)
34493
34786
  return Number(activeCheckoutQuote.sourceAmount) / 10 ** activeCheckoutQuote.sourceTokenDecimals;
34494
34787
  const usdNum = parseFloat(amountUsd) || 0;
34495
34788
  if (usdNum === 0 || usdToTokenRate === 0) return 0;
34496
34789
  return usdNum * usdToTokenRate;
34497
34790
  }, [amountUsd, usdToTokenRate, isCheckoutMode, activeCheckoutQuote, selectedToken]);
34498
- React342.useEffect(() => {
34791
+ React352.useEffect(() => {
34499
34792
  if (isCheckoutMode && activeCheckoutQuote?.sourceAmountUsd && view === "enter_amount")
34500
34793
  setAmountUsd(activeCheckoutQuote.sourceAmountUsd);
34501
34794
  }, [isCheckoutMode, activeCheckoutQuote, view]);
@@ -34504,7 +34797,7 @@ function WalletConnect({
34504
34797
  const inputUsdNum = parseFloat(amountUsd) || 0;
34505
34798
  const minDepositUsd = tokenChainDetails?.minimum_deposit_amount_usd || 0;
34506
34799
  const isValidAmount = isCheckoutMode && activeCheckoutQuote ? tokenAmount > 0 && tokenAmount <= maxTokenAmount : inputUsdNum > 0 && inputUsdNum <= maxUsdAmount && inputUsdNum >= minDepositUsd;
34507
- const formattedTokenAmount = React342.useMemo(() => {
34800
+ const formattedTokenAmount = React352.useMemo(() => {
34508
34801
  if (tokenAmount === 0 || !selectedToken) return null;
34509
34802
  return `${tokenAmount.toFixed(6)} ${selectedToken.symbol}`.replace(/\.?0+$/, "");
34510
34803
  }, [tokenAmount, selectedToken]);
@@ -34537,7 +34830,7 @@ function WalletConnect({
34537
34830
  break;
34538
34831
  case "enter_amount":
34539
34832
  transitionTo("select_token");
34540
- setAmountUsd(prefillAmountUsd ?? "");
34833
+ setAmountUsd(prefilledAmountUsd ?? "");
34541
34834
  setTokenChainDetails(null);
34542
34835
  break;
34543
34836
  case "review":
@@ -34569,7 +34862,7 @@ function WalletConnect({
34569
34862
  setSelectedBalance(null);
34570
34863
  setBalances([]);
34571
34864
  setTotalBalanceUsd(null);
34572
- setAmountUsd(prefillAmountUsd ?? "");
34865
+ setAmountUsd(prefilledAmountUsd ?? "");
34573
34866
  setError(null);
34574
34867
  };
34575
34868
  if (standalone) {
@@ -34814,116 +35107,131 @@ function WalletConnect({
34814
35107
  ] });
34815
35108
  }
34816
35109
  if (view === "select_wallet") {
34817
- return /* @__PURE__ */ jsxs56("div", { style: viewTransitionStyle, children: [
34818
- /* @__PURE__ */ jsx622(
34819
- DepositHeader,
35110
+ return (
35111
+ // Mobile: flex column that fills the full-height sheet so the wallet list
35112
+ // scrolls and the footer pins to the bottom. Desktop (sm:): content-sized.
35113
+ /* @__PURE__ */ jsxs56(
35114
+ "div",
34820
35115
  {
34821
- title: "Connect Wallet",
34822
- showBack: canGoBack,
34823
- onBack: handleBack,
34824
- onClose
34825
- }
34826
- ),
34827
- /* @__PURE__ */ jsxs56("div", { className: "uf-pb-4", children: [
34828
- /* @__PURE__ */ jsx622(
34829
- "p",
34830
- {
34831
- className: "uf-text-sm uf-text-center uf-pb-4",
34832
- style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
34833
- children: isMobile ? "Open this page in your wallet's app to connect" : "Select a wallet to connect"
34834
- }
34835
- ),
34836
- /* @__PURE__ */ jsx622("div", { className: "uf-space-y-2", style: { maxHeight: 330, overflowY: "auto" }, children: availableWallets.map((wallet) => {
34837
- const walletPlatformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
34838
- const showOpenInApp = isMobile && !wallet.isInstalled && wallet.supportsMobileBrowse !== false && walletPlatformAllowed;
34839
- const isPending = pendingMobileWallet?.id === wallet.id;
34840
- return /* @__PURE__ */ jsxs56(
34841
- "button",
34842
- {
34843
- onClick: () => void handleWalletClick(wallet),
34844
- disabled: isWalletConnecting || !!pendingMobileWallet,
34845
- 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",
34846
- style: {
34847
- backgroundColor: components.card.backgroundColor,
34848
- borderRadius: components.card.borderRadius,
34849
- border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
34850
- },
34851
- children: [
34852
- /* @__PURE__ */ jsxs56("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
34853
- WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ jsx622(
34854
- WalletIconWithNetwork,
34855
- {
34856
- WalletIcon: WALLET_ICONS3[wallet.id],
34857
- networks: wallet.networks,
34858
- size: 40,
34859
- className: "uf-rounded-lg"
34860
- }
34861
- ) : /* @__PURE__ */ jsx622("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
34862
- /* @__PURE__ */ jsxs56("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
34863
- /* @__PURE__ */ jsx622(
34864
- "div",
34865
- {
34866
- className: "uf-text-sm uf-font-medium",
34867
- style: { color: components.card.titleColor, fontFamily: fonts.medium },
34868
- children: wallet.name
34869
- }
34870
- ),
34871
- wallet.id === recentWalletId && /* @__PURE__ */ jsx622(
34872
- "span",
34873
- {
34874
- className: "uf-text-xs uf-px-2 uf-py-0.5 uf-rounded-full",
34875
- style: {
34876
- backgroundColor: colors2.primary + "20",
34877
- color: colors2.primary,
34878
- fontFamily: fonts.medium
34879
- },
34880
- children: "Last used"
34881
- }
34882
- )
34883
- ] })
34884
- ] }),
34885
- isPending ? /* @__PURE__ */ jsx622(
34886
- LoaderCircle,
34887
- {
34888
- className: "uf-w-4 uf-h-4 uf-animate-spin",
34889
- style: { color: colors2.primary }
34890
- }
34891
- ) : wallet.isInstalled ? /* @__PURE__ */ jsx622(
34892
- "span",
35116
+ style: viewTransitionStyle,
35117
+ className: "uf-flex uf-min-h-0 uf-flex-1 uf-flex-col sm:uf-block",
35118
+ children: [
35119
+ /* @__PURE__ */ jsx622(
35120
+ DepositHeader,
35121
+ {
35122
+ title: "Connect Wallet",
35123
+ showBack: canGoBack,
35124
+ onBack: handleBack,
35125
+ onClose
35126
+ }
35127
+ ),
35128
+ /* @__PURE__ */ jsxs56("div", { className: "uf-pb-4 uf-flex uf-min-h-0 uf-flex-1 uf-flex-col sm:uf-block", children: [
35129
+ /* @__PURE__ */ jsx622(
35130
+ "p",
35131
+ {
35132
+ className: "uf-text-sm uf-text-center uf-pb-4",
35133
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
35134
+ children: isMobile ? "Open this page in your wallet's app to connect" : "Select a wallet to connect"
35135
+ }
35136
+ ),
35137
+ /* @__PURE__ */ jsx622("div", { className: "uf-space-y-2 uf-min-h-0 uf-flex-1 uf-overflow-y-auto sm:uf-flex-none sm:uf-max-h-[330px] [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: availableWallets.filter((wallet) => {
35138
+ if (!isMobile || wallet.isInstalled) return true;
35139
+ const platformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
35140
+ return wallet.supportsMobileBrowse !== false && platformAllowed;
35141
+ }).map((wallet) => {
35142
+ const walletPlatformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
35143
+ const showOpenInApp = isMobile && !wallet.isInstalled && wallet.supportsMobileBrowse !== false && walletPlatformAllowed;
35144
+ const isPending = pendingMobileWallet?.id === wallet.id;
35145
+ return /* @__PURE__ */ jsxs56(
35146
+ "button",
34893
35147
  {
34894
- className: "uf-text-xs uf-px-2 uf-py-1 uf-rounded-full",
35148
+ onClick: () => void handleWalletClick(wallet),
35149
+ disabled: isWalletConnecting || !!pendingMobileWallet,
35150
+ 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",
34895
35151
  style: {
34896
- backgroundColor: colors2.primary + "20",
34897
- color: colors2.primary,
34898
- fontFamily: fonts.medium
35152
+ backgroundColor: components.card.backgroundColor,
35153
+ borderRadius: components.card.borderRadius,
35154
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
34899
35155
  },
34900
- children: "Detected"
34901
- }
34902
- ) : /* @__PURE__ */ jsxs56("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
34903
- /* @__PURE__ */ jsx622(
34904
- "span",
34905
- {
34906
- className: "uf-text-xs",
34907
- style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
34908
- children: showOpenInApp ? "Open" : "Install"
34909
- }
34910
- ),
34911
- /* @__PURE__ */ jsx622(
34912
- ExternalLink,
34913
- {
34914
- className: "uf-w-3 uf-h-3",
34915
- style: { color: colors2.foregroundMuted }
34916
- }
34917
- )
34918
- ] })
34919
- ]
34920
- },
34921
- wallet.id
34922
- );
34923
- }) }),
34924
- walletError && /* @__PURE__ */ jsx622("div", { className: "uf-text-center uf-text-sm uf-mt-4 uf-px-4", style: { color: "#ef4444" }, children: walletError })
34925
- ] })
34926
- ] });
35156
+ children: [
35157
+ /* @__PURE__ */ jsxs56("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
35158
+ WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ jsx622(
35159
+ WalletIconWithNetwork,
35160
+ {
35161
+ WalletIcon: WALLET_ICONS3[wallet.id],
35162
+ networks: wallet.networks,
35163
+ size: 40,
35164
+ className: "uf-rounded-lg"
35165
+ }
35166
+ ) : /* @__PURE__ */ jsx622("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
35167
+ /* @__PURE__ */ jsxs56("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
35168
+ /* @__PURE__ */ jsx622(
35169
+ "div",
35170
+ {
35171
+ className: "uf-text-sm uf-font-medium",
35172
+ style: { color: components.card.titleColor, fontFamily: fonts.medium },
35173
+ children: wallet.name
35174
+ }
35175
+ ),
35176
+ wallet.id === recentWalletId && /* @__PURE__ */ jsx622(
35177
+ "span",
35178
+ {
35179
+ className: "uf-text-xs uf-px-2 uf-py-0.5 uf-rounded-full",
35180
+ style: {
35181
+ backgroundColor: colors2.primary + "20",
35182
+ color: colors2.primary,
35183
+ fontFamily: fonts.medium
35184
+ },
35185
+ children: "Last used"
35186
+ }
35187
+ )
35188
+ ] })
35189
+ ] }),
35190
+ isPending ? /* @__PURE__ */ jsx622(
35191
+ LoaderCircle,
35192
+ {
35193
+ className: "uf-w-4 uf-h-4 uf-animate-spin",
35194
+ style: { color: colors2.primary }
35195
+ }
35196
+ ) : wallet.isInstalled ? /* @__PURE__ */ jsx622(
35197
+ "span",
35198
+ {
35199
+ className: "uf-text-xs uf-px-2 uf-py-1 uf-rounded-full",
35200
+ style: {
35201
+ backgroundColor: colors2.primary + "20",
35202
+ color: colors2.primary,
35203
+ fontFamily: fonts.medium
35204
+ },
35205
+ children: "Detected"
35206
+ }
35207
+ ) : /* @__PURE__ */ jsxs56("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
35208
+ /* @__PURE__ */ jsx622(
35209
+ "span",
35210
+ {
35211
+ className: "uf-text-xs",
35212
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
35213
+ children: showOpenInApp ? "Open" : "Install"
35214
+ }
35215
+ ),
35216
+ /* @__PURE__ */ jsx622(
35217
+ ExternalLink,
35218
+ {
35219
+ className: "uf-w-3 uf-h-3",
35220
+ style: { color: colors2.foregroundMuted }
35221
+ }
35222
+ )
35223
+ ] })
35224
+ ]
35225
+ },
35226
+ wallet.id
35227
+ );
35228
+ }) }),
35229
+ walletError && /* @__PURE__ */ jsx622("div", { className: "uf-text-center uf-text-sm uf-mt-4 uf-px-4", style: { color: "#ef4444" }, children: walletError })
35230
+ ] })
35231
+ ]
35232
+ }
35233
+ )
35234
+ );
34927
35235
  }
34928
35236
  const preConnectAccent = selectedWalletDef ? getWalletBrandColor(selectedWalletDef.id, mode) : void 0;
34929
35237
  const preConnectFg = preConnectAccent ? getContrastingTextColor(preConnectAccent) : void 0;
@@ -35278,6 +35586,15 @@ function SkeletonButton({ variant = "default" }) {
35278
35586
  ] });
35279
35587
  }
35280
35588
  var t8 = i18n2.depositModal;
35589
+ function normalizePrefilledUsdAmount(value) {
35590
+ if (!value) return void 0;
35591
+ const cleaned = value.replace(/[^0-9.]/g, "");
35592
+ if (!cleaned) return void 0;
35593
+ const normalizedNumeric = cleaned.replace(/(\..*)\./g, "$1");
35594
+ const parsed = parseFloat(normalizedNumeric);
35595
+ if (!Number.isFinite(parsed) || parsed <= 0) return void 0;
35596
+ return parseFloat(parsed.toFixed(2)).toString();
35597
+ }
35281
35598
  function depositTabForScreen(screen) {
35282
35599
  return screen === "card" || screen === "cashapp" || screen === "bank_transfer" || screen === "stripe_link" || screen === "apple_pay" ? "cash" : "crypto";
35283
35600
  }
@@ -35297,6 +35614,7 @@ function DepositModal({
35297
35614
  defaultSourceChainId,
35298
35615
  defaultSourceTokenAddress,
35299
35616
  defaultSourceSymbol,
35617
+ prefilledAmountUsd,
35300
35618
  hideDepositTracker,
35301
35619
  showBalanceHeader = false,
35302
35620
  transferInputVariant = "double_input",
@@ -35312,7 +35630,9 @@ function DepositModal({
35312
35630
  applePayTitle = "Pay with Apple Pay",
35313
35631
  applePaySubTitle = "Instant",
35314
35632
  enableBankTransfer,
35315
- enableStripeLink = false,
35633
+ // No default: left undefined so the backend `stripe_link.enabled` can govern
35634
+ // (via the `??` chain in showStripeLink) once a dashboard toggle exists.
35635
+ enableStripeLink,
35316
35636
  userEmail,
35317
35637
  hideDepositFlowInfo = false,
35318
35638
  hideDisplayDescription = false,
@@ -35330,7 +35650,11 @@ function DepositModal({
35330
35650
  depositTrackerSubTitle = t8.depositTracker.subtitle
35331
35651
  }) {
35332
35652
  const { colors: colors2, fonts, components } = useTheme();
35333
- const onDepositSuccessFor = useCallback82(
35653
+ const normalizedPrefilledAmountUsd = useMemo14(
35654
+ () => normalizePrefilledUsdAmount(prefilledAmountUsd),
35655
+ [prefilledAmountUsd]
35656
+ );
35657
+ const onDepositSuccessFor = useCallback10(
35334
35658
  (method) => onDepositSuccess || onEvent ? (data) => {
35335
35659
  const payload = { ...data, method };
35336
35660
  onDepositSuccess?.(payload);
@@ -35343,11 +35667,11 @@ function DepositModal({
35343
35667
  } : void 0,
35344
35668
  [onDepositSuccess, onEvent]
35345
35669
  );
35346
- const onDepositErrorFor = useCallback82(
35670
+ const onDepositErrorFor = useCallback10(
35347
35671
  (method) => onDepositError ? (error) => onDepositError({ ...error, method }) : void 0,
35348
35672
  [onDepositError]
35349
35673
  );
35350
- const effectiveInitialScreen = useMemo13(() => {
35674
+ const effectiveInitialScreen = useMemo14(() => {
35351
35675
  const s = initialScreen ?? "main";
35352
35676
  if (s === "tracker" && hideDepositTracker === true) return "main";
35353
35677
  if (s === "cashapp" && enableCashApp === false) return "main";
@@ -35373,7 +35697,7 @@ function DepositModal({
35373
35697
  enableStripeLink
35374
35698
  ]);
35375
35699
  const [containerEl, setContainerEl] = useState40(null);
35376
- const containerCallbackRef = useCallback82((el) => {
35700
+ const containerCallbackRef = useCallback10((el) => {
35377
35701
  setContainerEl(el);
35378
35702
  }, []);
35379
35703
  const [view, setView] = useState40(effectiveInitialScreen);
@@ -35382,7 +35706,7 @@ function DepositModal({
35382
35706
  const [depositTab, setDepositTab] = useState40(
35383
35707
  () => depositTabForScreen(effectiveInitialScreen)
35384
35708
  );
35385
- const resetViewTimeoutRef = useRef122(null);
35709
+ const resetViewTimeoutRef = useRef132(null);
35386
35710
  const [cardView, setCardView] = useState40("amount");
35387
35711
  const [exchangeView, setExchangeView] = useState40("providers");
35388
35712
  const [browserWalletModalOpen, setBrowserWalletModalOpen] = useState40(false);
@@ -35393,14 +35717,18 @@ function DepositModal({
35393
35717
  const [allExecutions, setAllExecutions] = useState40([]);
35394
35718
  const [selectedExecution, setSelectedExecution] = useState40(null);
35395
35719
  const [depositExecutions, setDepositExecutions] = useState40([]);
35720
+ const { userIpInfo, isLoading: isLoadingIp } = useUserIp2();
35396
35721
  const { projectConfig } = useProjectConfig({
35397
35722
  publishableKey,
35398
- enabled: open
35723
+ enabled: open && !isLoadingIp,
35724
+ countryCode: userIpInfo?.alpha2,
35725
+ subdivisionCode: userIpInfo?.subdivisionCode ?? void 0
35399
35726
  });
35400
35727
  const showTransferCrypto = enableTransferCrypto ?? projectConfig?.transfer_crypto?.enabled ?? true;
35401
35728
  const showConnectWallet = enableConnectWallet ?? projectConfig?.connect_wallet?.enabled ?? true;
35402
35729
  const showPayWithExchange = enablePayWithExchange ?? projectConfig?.pay_with_exchange?.enabled ?? true;
35403
35730
  const showFiatOnramp = !projectConfig?.fiat_onramp?.is_hidden && (enableFiatOnramp ?? projectConfig?.fiat_onramp?.enabled ?? true);
35731
+ const showStripeLink = !projectConfig?.stripe_link?.is_hidden && (enableStripeLink ?? projectConfig?.stripe_link?.enabled ?? false);
35404
35732
  const showConnectExchange = enableConnectExchange ?? projectConfig?.connect_exchange?.enabled ?? true;
35405
35733
  const showCashApp = enableCashApp ?? projectConfig?.cash_app?.enabled ?? true;
35406
35734
  const showApplePay = enableApplePay ?? projectConfig?.apple_pay?.enabled ?? true;
@@ -35546,7 +35874,6 @@ function DepositModal({
35546
35874
  publishableKey,
35547
35875
  enabled: open && showPayWithExchange
35548
35876
  });
35549
- const { userIpInfo, isLoading: isLoadingIp } = useUserIp2();
35550
35877
  const { providers: bankTransferProviders, isLoading: bankTransferProvidersLoading } = useBankTransferProviders({
35551
35878
  publishableKey,
35552
35879
  enabled: open && !!userIpInfo?.alpha2,
@@ -35723,10 +36050,16 @@ function DepositModal({
35723
36050
  );
35724
36051
  const [cashAppView, setCashAppView] = useState40("amount");
35725
36052
  const [stripeLinkStep, setStripeLinkStep] = useState40("amount");
35726
- const stripeLinkBackRef = useRef122(null);
36053
+ const stripeLinkBackRef = useRef132(null);
36054
+ useEffect34(() => {
36055
+ if (view === "stripe_link" && !showStripeLink && effectiveInitialScreen === "main") {
36056
+ setView("main");
36057
+ setStripeLinkStep("amount");
36058
+ }
36059
+ }, [view, showStripeLink, effectiveInitialScreen]);
35727
36060
  const [cashAppAmount, setCashAppAmount] = useState40("");
35728
36061
  const [applePayView, setApplePayView] = useState40("email_input");
35729
- const applePayHandleRef = useRef122(null);
36062
+ const applePayHandleRef = useRef132(null);
35730
36063
  const applePayHeaderTitle = (() => {
35731
36064
  switch (applePayView) {
35732
36065
  case "email_input":
@@ -35948,7 +36281,7 @@ function DepositModal({
35948
36281
  },
35949
36282
  "cashapp"
35950
36283
  ) : null;
35951
- const stripeLinkMenuButton = enableStripeLink ? /* @__PURE__ */ jsx63(
36284
+ const stripeLinkMenuButton = showStripeLink ? /* @__PURE__ */ jsx63(
35952
36285
  StripeLinkButton,
35953
36286
  {
35954
36287
  onClick: () => setView("stripe_link"),
@@ -35996,11 +36329,13 @@ function DepositModal({
35996
36329
  connectExchangeMenuButton
35997
36330
  ].filter(Boolean);
35998
36331
  const cashMenuButtons = [
36332
+ // Stripe "Pay with Link" is intentionally listed first so it always sits
36333
+ // above "Deposit with Card".
36334
+ stripeLinkMenuButton,
35999
36335
  depositWithCardMenuButton,
36000
36336
  applePayMenuButton,
36001
36337
  cashAppMenuButton,
36002
- bankTransferMenuButton,
36003
- stripeLinkMenuButton
36338
+ bankTransferMenuButton
36004
36339
  ].filter(Boolean);
36005
36340
  const depositTabs = [
36006
36341
  { id: "crypto", label: "Use Crypto", icon: Bitcoin, buttons: cryptoMenuButtons },
@@ -36095,13 +36430,13 @@ function DepositModal({
36095
36430
  const stackedOptions = [
36096
36431
  transferCryptoMenuButton,
36097
36432
  connectWalletMenuButton,
36433
+ stripeLinkMenuButton,
36098
36434
  depositWithCardMenuButton,
36099
36435
  applePayMenuButton,
36100
36436
  payWithExchangeMenuButton,
36101
36437
  connectExchangeMenuButton,
36102
36438
  cashAppMenuButton,
36103
36439
  bankTransferMenuButton,
36104
- stripeLinkMenuButton,
36105
36440
  depositTrackerMenuButton
36106
36441
  ].filter(Boolean);
36107
36442
  return renderScrollableOptions(stackedOptions);
@@ -36117,410 +36452,461 @@ function DepositModal({
36117
36452
  {
36118
36453
  ref: hideOverlay ? containerCallbackRef : void 0,
36119
36454
  hideOverlay,
36120
- className: `sm:uf-max-w-[400px] uf-border-secondary uf-text-foreground uf-gap-0 [&>button]:uf-hidden ${hideOverlay ? `uf-p-6 uf-overflow-hidden ${themeClass}` : `uf-p-0 uf-overflow-visible ${view === "main" ? "!uf-top-auto !uf-h-auto !uf-max-h-[85vh] sm:!uf-max-h-none sm:!uf-top-[50%]" : "!uf-top-0 !uf-h-full sm:!uf-h-auto sm:!uf-top-[50%]"} ${themeClass}`}`,
36455
+ className: `sm:uf-max-w-[400px] uf-border-secondary uf-text-foreground uf-gap-0 [&>button]:uf-hidden ${hideOverlay ? `uf-p-6 uf-overflow-hidden ${themeClass}` : `uf-p-0 uf-overflow-visible ${view === "main" ? "!uf-top-auto !uf-h-auto !uf-max-h-[85vh] sm:!uf-max-h-none sm:!uf-top-[50%]" : "!uf-top-0 !uf-h-full sm:!uf-h-auto sm:!uf-top-[50%]"} ${// wallet_connect fills the full-height mobile sheet. DialogContent
36456
+ // is a grid, and its single auto row only *grows* to fill free
36457
+ // space (align-content: stretch) — it never shrinks below content,
36458
+ // so a long wallet list would balloon the row past the viewport and
36459
+ // push the footer off-screen instead of scrolling. Clamp the row to
36460
+ // the modal height with minmax(0,1fr) so the inner overflow-y-auto
36461
+ // list scrolls with the footer pinned. Reset to content-sized on
36462
+ // desktop (sm:) where the modal is auto-height and centered.
36463
+ view === "wallet_connect" ? "[grid-template-rows:minmax(0,1fr)] sm:[grid-template-rows:none]" : ""} ${themeClass}`}`,
36121
36464
  style: { backgroundColor: colors2.background },
36122
36465
  onPointerDownOutside: (e) => e.preventDefault(),
36123
36466
  onInteractOutside: (e) => e.preventDefault(),
36124
36467
  children: [
36125
36468
  /* @__PURE__ */ jsx63(DialogTitle2, { className: "uf-sr-only", children: modalTitle || "Deposit" }),
36126
- /* @__PURE__ */ jsx63(ThemeStyleInjector, { children: view === "main" ? /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-min-h-0 uf-max-h-full", children: [
36127
- /* @__PURE__ */ jsx63("div", { className: "uf-flex-shrink-0", children: /* @__PURE__ */ jsx63(
36128
- DepositHeader,
36129
- {
36130
- title: modalTitle || "Deposit",
36131
- showClose: !hideOverlay,
36132
- onClose: handleClose,
36133
- showBalance: showBalanceHeader,
36134
- balanceAddress: recipientAddress,
36135
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
36136
- balanceChainId: destinationChainId,
36137
- balanceTokenAddress: destinationTokenAddress,
36138
- projectName: projectConfig?.project_name,
36139
- publishableKey
36140
- }
36141
- ) }),
36142
- renderMainMenuBody(),
36143
- /* @__PURE__ */ jsx63("div", { className: "uf-flex-shrink-0", children: depositPoweredByFooter })
36144
- ] }) : view === "transfer" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36145
- /* @__PURE__ */ jsx63(
36146
- DepositHeader,
36147
- {
36148
- title: transferCryptoTitle,
36149
- showBack: showBackTransfer,
36150
- onBack: handleBack,
36151
- onClose: handleClose,
36152
- showBalance: showBalanceHeader,
36153
- balanceAddress: recipientAddress,
36154
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
36155
- balanceChainId: destinationChainId,
36156
- balanceTokenAddress: destinationTokenAddress,
36157
- projectName: projectConfig?.project_name,
36158
- publishableKey
36159
- }
36160
- ),
36161
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36162
- standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ jsx63("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ jsx63(
36163
- TransferCryptoSingleInput,
36164
- {
36165
- userId,
36166
- publishableKey,
36167
- recipientAddress,
36168
- destinationChainType,
36169
- destinationChainId,
36170
- destinationTokenAddress,
36171
- defaultSourceChainType,
36172
- defaultSourceChainId,
36173
- defaultSourceTokenAddress,
36174
- defaultSourceSymbol,
36175
- depositConfirmationMode,
36176
- onExecutionsChange: setDepositExecutions,
36177
- onDepositSuccess: onDepositSuccessFor("transfer"),
36178
- onDepositError: onDepositErrorFor("transfer"),
36179
- wallets
36180
- }
36181
- ) : /* @__PURE__ */ jsx63(
36182
- TransferCryptoDoubleInput,
36183
- {
36184
- userId,
36185
- publishableKey,
36186
- recipientAddress,
36187
- destinationChainType,
36188
- destinationChainId,
36189
- destinationTokenAddress,
36190
- defaultSourceChainType,
36191
- defaultSourceChainId,
36192
- defaultSourceTokenAddress,
36193
- defaultSourceSymbol,
36194
- depositConfirmationMode,
36195
- onExecutionsChange: setDepositExecutions,
36196
- onDepositSuccess: onDepositSuccessFor("transfer"),
36197
- onDepositError: onDepositErrorFor("transfer"),
36198
- wallets
36199
- }
36200
- ),
36201
- depositPoweredByFooter
36202
- ] })
36203
- ] }) : view === "tracker" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36204
- /* @__PURE__ */ jsx63(
36205
- DepositHeader,
36206
- {
36207
- title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
36208
- showBack: showBackTracker,
36209
- onBack: handleBack,
36210
- onClose: handleClose
36211
- }
36212
- ),
36213
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36214
- /* @__PURE__ */ jsx63("div", { className: "uf-h-[460px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: selectedExecution ? /* @__PURE__ */ jsx63(DepositDetailContent, { execution: selectedExecution }) : /* @__PURE__ */ jsx63("div", { className: "uf-space-y-2 uf-pb-8", children: allExecutions.length === 0 ? /* @__PURE__ */ jsx63("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ jsx63(
36215
- "div",
36216
- {
36217
- className: "uf-text-sm",
36218
- style: {
36219
- color: components.container.subtitleColor,
36220
- fontFamily: fonts.regular
36221
- },
36222
- children: "No deposits yet"
36223
- }
36224
- ) }) : allExecutions.map((execution) => /* @__PURE__ */ jsx63(
36225
- DepositExecutionItem,
36226
- {
36227
- execution,
36228
- onClick: () => setSelectedExecution(execution)
36229
- },
36230
- execution.id
36231
- )) }) }),
36232
- depositPoweredByFooter
36233
- ] })
36234
- ] }) : view === "card" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36235
- /* @__PURE__ */ jsx63(
36236
- DepositHeader,
36237
- {
36238
- title: cardView === "quotes" ? t8.quotes : depositWithCardTitle,
36239
- showBack: showBackCard,
36240
- onBack: handleBack,
36241
- onClose: handleClose,
36242
- badge: cardView === "quotes" ? { count: quotesCount } : void 0,
36243
- showBalance: showBalanceHeader,
36244
- balanceAddress: recipientAddress,
36245
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
36246
- balanceChainId: destinationChainId,
36247
- balanceTokenAddress: destinationTokenAddress,
36248
- projectName: projectConfig?.project_name,
36249
- publishableKey
36250
- }
36251
- ),
36252
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36253
- standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ jsx63("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : !showFiatOnramp ? (
36254
- // Fiat on-ramp resolved hidden/disabled after a direct open
36255
- // (e.g. platform `is_hidden` for a Stripe Link-only project).
36256
- // Show a geo-restriction screen rather than the card UI so the
36257
- // hard-hide is honoured without a flash of "Pay with Card".
36258
- /* @__PURE__ */ jsx63(GeoRestrictionScreen, { methodName: "Card" })
36259
- ) : /* @__PURE__ */ jsx63(
36260
- BuyWithCard,
36261
- {
36262
- userId,
36263
- publishableKey,
36264
- view: cardView,
36265
- onViewChange: handleCardViewChange,
36266
- destinationTokenSymbol,
36267
- recipientAddress,
36268
- destinationChainType,
36269
- destinationChainId,
36270
- destinationTokenAddress,
36271
- onDepositSuccess: onDepositSuccessFor("card"),
36272
- onDepositError: onDepositErrorFor("card"),
36273
- onEvent,
36274
- themeClass,
36275
- wallets,
36276
- assetCdnUrl: projectConfig?.asset_cdn_url,
36277
- hideDepositFlowInfo,
36278
- hideDisplayDescription
36279
- }
36280
- ),
36281
- depositPoweredByFooter
36282
- ] })
36283
- ] }) : view === "exchange" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36284
- /* @__PURE__ */ jsx63(
36285
- DepositHeader,
36286
- {
36287
- title: payWithExchangeTitle,
36288
- showBack: exchangeView === "pending" || sessionOpenedFromMenu,
36289
- onBack: handleBack,
36290
- onClose: handleClose
36291
- }
36292
- ),
36293
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36294
- /* @__PURE__ */ jsx63(
36295
- PayWithExchange,
36296
- {
36297
- userId,
36298
- publishableKey,
36299
- exchanges,
36300
- view: exchangeView,
36301
- onViewChange: setExchangeView,
36302
- destinationTokenSymbol,
36303
- recipientAddress,
36304
- destinationChainType,
36305
- destinationChainId,
36306
- destinationTokenAddress,
36307
- onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
36308
- onDepositError: onDepositErrorFor("pay_with_exchange"),
36309
- wallets,
36310
- defaultToken: defaultToken ?? null
36311
- }
36312
- ),
36313
- depositPoweredByFooter
36314
- ] })
36315
- ] }) : view === "coinbase_connect" ? /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36316
- /* @__PURE__ */ jsx63(
36317
- CoinbaseConnect,
36318
- {
36319
- publishableKey,
36320
- userId,
36321
- wallets,
36322
- recipientAddress,
36323
- destinationTokenAddress: destinationTokenAddress ?? "",
36324
- destinationChainId: destinationChainId ?? "",
36325
- destinationChainType: destinationChainType ?? "",
36326
- onDepositSuccess: onDepositSuccessFor("exchange_connect"),
36327
- onDepositError: onDepositErrorFor("exchange_connect"),
36328
- onTransferError: (error) => {
36329
- onDepositErrorFor("exchange_connect")?.({
36330
- message: error.message,
36331
- error
36332
- });
36333
- },
36334
- onBack: handleBack,
36335
- onClose: handleClose,
36336
- onDisconnect: handleExchangeDisconnect,
36337
- skipToHoldings: coinbaseSkipToHoldings,
36338
- canGoBack: sessionOpenedFromMenu,
36339
- onExecutionsChange: setDepositExecutions,
36340
- defaultSourceChainType,
36341
- defaultSourceChainId,
36342
- defaultSourceTokenAddress,
36343
- defaultSourceSymbol
36344
- }
36345
- ),
36346
- depositPoweredByFooter
36347
- ] }) : view === "wallet_connect" ? /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36348
- /* @__PURE__ */ jsx63(
36349
- WalletConnect,
36350
- {
36351
- walletInfo: browserWalletInfo ?? void 0,
36352
- depositWallet: browserWalletInfo?.depositWallet ?? void 0,
36353
- wallets,
36354
- userId,
36355
- publishableKey,
36356
- assetCdnUrl: projectConfig?.asset_cdn_url,
36357
- projectName: projectConfig?.project_name,
36358
- onError: (error) => {
36359
- onDepositErrorFor("wallet_connect")?.({
36360
- message: error.message,
36361
- error
36362
- });
36363
- },
36364
- onDepositSuccess: onDepositSuccessFor("wallet_connect"),
36365
- onDepositError: onDepositErrorFor("wallet_connect"),
36366
- amountQuickSelect: browserWalletAmountQuickSelect,
36367
- onWalletDisconnect: handleWalletDisconnect,
36368
- onWalletConnected: (info, dw) => {
36369
- setBrowserWalletInfo({ ...info, depositWallet: dw });
36370
- setStoredWalletState(info.type);
36371
- setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
36372
- },
36373
- onBack: handleBack,
36374
- onClose: handleClose,
36375
- defaultSourceChainType,
36376
- defaultSourceChainId,
36377
- defaultSourceTokenAddress,
36378
- defaultSourceSymbol,
36379
- canGoBack: sessionOpenedFromMenu,
36380
- depositWalletsLoading: walletsLoading
36381
- }
36382
- ),
36383
- depositPoweredByFooter
36384
- ] }) : view === "bank_transfer" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36385
- /* @__PURE__ */ jsx63(
36386
- DepositHeader,
36387
- {
36388
- title: t8.bankTransfer.title,
36389
- showBack: bankTransferView !== "providers" || sessionOpenedFromMenu,
36390
- onBack: handleBack,
36391
- onClose: handleClose
36392
- }
36393
- ),
36394
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36395
- bankTransferProvidersLoading ? /* @__PURE__ */ jsx63(SkeletonButton, { variant: "with-icons" }) : !hasEnabledBankTransferProvider ? /* @__PURE__ */ jsx63(GeoRestrictionScreen, { methodName: "Bank Transfer" }) : /* @__PURE__ */ jsx63(
36396
- BankTransfer,
36397
- {
36398
- userId,
36399
- publishableKey,
36400
- view: bankTransferView,
36401
- onViewChange: setBankTransferView,
36402
- recipientAddress,
36403
- destinationChainType,
36404
- destinationChainId,
36405
- destinationTokenAddress,
36406
- destinationTokenSymbol,
36407
- wallets,
36408
- defaultToken: defaultToken ?? null,
36409
- assetCdnUrl: projectConfig?.asset_cdn_url,
36410
- onEvent,
36411
- onDepositSuccess,
36412
- onDepositError
36413
- }
36414
- ),
36415
- depositPoweredByFooter
36416
- ] })
36417
- ] }) : view === "stripe_link" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36418
- /* @__PURE__ */ jsx63(
36419
- DepositHeader,
36420
- {
36421
- title: "Deposit with Link",
36422
- showBack: stripeLinkStep !== "checkout" && stripeLinkStep !== "success",
36423
- onBack: handleBack,
36424
- showClose: stripeLinkStep !== "checkout",
36425
- onClose: handleClose
36426
- }
36427
- ),
36428
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36429
- /* @__PURE__ */ jsx63(
36430
- PayWithStripeLink,
36431
- {
36432
- userId,
36433
- publishableKey,
36434
- recipientAddress,
36435
- destinationChainType,
36436
- destinationChainId,
36437
- destinationTokenAddress,
36438
- wallets,
36439
- email: userEmail,
36440
- iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/link.svg` : void 0,
36441
- step: stripeLinkStep,
36442
- onStepChange: setStripeLinkStep,
36443
- backHandlerRef: stripeLinkBackRef,
36444
- onDepositSuccess,
36445
- onDepositError
36446
- }
36447
- ),
36448
- depositPoweredByFooter
36449
- ] })
36450
- ] }) : view === "cashapp" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36451
- /* @__PURE__ */ jsx63(
36452
- DepositHeader,
36453
- {
36454
- title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
36455
- showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
36456
- onBack: handleBack,
36457
- onClose: handleClose
36458
- }
36459
- ),
36460
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36461
- /* @__PURE__ */ jsx63(
36462
- PayWithCashApp,
36463
- {
36464
- userId,
36465
- publishableKey,
36466
- recipientAddress,
36467
- destinationChainType,
36468
- destinationChainId,
36469
- destinationTokenAddress,
36470
- cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
36471
- view: cashAppView,
36472
- onViewChange: setCashAppView,
36473
- onAmountChange: setCashAppAmount,
36474
- onEvent,
36475
- onDepositSuccess: onDepositSuccessFor("cashapp"),
36476
- onDepositError: onDepositErrorFor("cashapp"),
36477
- wallets
36478
- }
36479
- ),
36480
- depositPoweredByFooter
36481
- ] })
36482
- ] }) : view === "apple_pay" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36483
- /* @__PURE__ */ jsx63(
36484
- DepositHeader,
36485
- {
36486
- title: applePayHeaderTitle,
36487
- showBack: applePayShowBack,
36488
- onBack: () => {
36489
- const handled = applePayHandleRef.current?.requestBack() ?? false;
36490
- if (!handled) handleBack();
36491
- },
36492
- onClose: handleClose
36493
- }
36494
- ),
36495
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36496
- applePayProvidersLoading ? /* @__PURE__ */ jsx63(SkeletonButton, { variant: "with-icons" }) : !hasEnabledApplePayProvider ? /* @__PURE__ */ jsx63(GeoRestrictionScreen, { methodName: "Apple Pay" }) : /* @__PURE__ */ jsx63(
36497
- BuyWithApplePay,
36498
- {
36499
- ref: applePayHandleRef,
36500
- userId,
36501
- publishableKey,
36502
- destinationChainType,
36503
- destinationChainId,
36504
- destinationTokenAddress,
36505
- userEmail,
36506
- wallets,
36507
- onViewChange: setApplePayView,
36508
- onEvent,
36509
- onDepositSuccess: onDepositSuccessFor("apple_pay"),
36510
- onDepositError: onDepositErrorFor("apple_pay"),
36511
- exitLabel: sessionOpenedFromMenu ? "Return" : "Close",
36512
- onExit: () => {
36513
- if (sessionOpenedFromMenu) {
36514
- setView("main");
36515
- } else {
36516
- handleClose();
36469
+ /* @__PURE__ */ jsx63(
36470
+ ThemeStyleInjector,
36471
+ {
36472
+ className: view === "wallet_connect" ? "uf-flex uf-min-h-0 uf-flex-col" : void 0,
36473
+ children: view === "main" ? /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-min-h-0 uf-max-h-full", children: [
36474
+ /* @__PURE__ */ jsx63("div", { className: "uf-flex-shrink-0", children: /* @__PURE__ */ jsx63(
36475
+ DepositHeader,
36476
+ {
36477
+ title: modalTitle || "Deposit",
36478
+ showClose: !hideOverlay,
36479
+ onClose: handleClose,
36480
+ showBalance: showBalanceHeader,
36481
+ balanceAddress: recipientAddress,
36482
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
36483
+ balanceChainId: destinationChainId,
36484
+ balanceTokenAddress: destinationTokenAddress,
36485
+ projectName: projectConfig?.project_name,
36486
+ publishableKey
36487
+ }
36488
+ ) }),
36489
+ renderMainMenuBody(),
36490
+ /* @__PURE__ */ jsx63("div", { className: "uf-flex-shrink-0", children: depositPoweredByFooter })
36491
+ ] }) : view === "transfer" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36492
+ /* @__PURE__ */ jsx63(
36493
+ DepositHeader,
36494
+ {
36495
+ title: transferCryptoTitle,
36496
+ showBack: showBackTransfer,
36497
+ onBack: handleBack,
36498
+ onClose: handleClose,
36499
+ showBalance: showBalanceHeader,
36500
+ balanceAddress: recipientAddress,
36501
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
36502
+ balanceChainId: destinationChainId,
36503
+ balanceTokenAddress: destinationTokenAddress,
36504
+ projectName: projectConfig?.project_name,
36505
+ publishableKey
36506
+ }
36507
+ ),
36508
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36509
+ standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ jsx63("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ jsx63(
36510
+ TransferCryptoSingleInput,
36511
+ {
36512
+ userId,
36513
+ publishableKey,
36514
+ recipientAddress,
36515
+ destinationChainType,
36516
+ destinationChainId,
36517
+ destinationTokenAddress,
36518
+ defaultSourceChainType,
36519
+ defaultSourceChainId,
36520
+ defaultSourceTokenAddress,
36521
+ defaultSourceSymbol,
36522
+ prefilledAmountUsd: normalizedPrefilledAmountUsd,
36523
+ depositConfirmationMode,
36524
+ onExecutionsChange: setDepositExecutions,
36525
+ onDepositSuccess: onDepositSuccessFor("transfer"),
36526
+ onDepositError: onDepositErrorFor("transfer"),
36527
+ wallets
36528
+ }
36529
+ ) : /* @__PURE__ */ jsx63(
36530
+ TransferCryptoDoubleInput,
36531
+ {
36532
+ userId,
36533
+ publishableKey,
36534
+ recipientAddress,
36535
+ destinationChainType,
36536
+ destinationChainId,
36537
+ destinationTokenAddress,
36538
+ defaultSourceChainType,
36539
+ defaultSourceChainId,
36540
+ defaultSourceTokenAddress,
36541
+ defaultSourceSymbol,
36542
+ prefilledAmountUsd: normalizedPrefilledAmountUsd,
36543
+ depositConfirmationMode,
36544
+ onExecutionsChange: setDepositExecutions,
36545
+ onDepositSuccess: onDepositSuccessFor("transfer"),
36546
+ onDepositError: onDepositErrorFor("transfer"),
36547
+ wallets
36517
36548
  }
36549
+ ),
36550
+ depositPoweredByFooter
36551
+ ] })
36552
+ ] }) : view === "tracker" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36553
+ /* @__PURE__ */ jsx63(
36554
+ DepositHeader,
36555
+ {
36556
+ title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
36557
+ showBack: showBackTracker,
36558
+ onBack: handleBack,
36559
+ onClose: handleClose
36518
36560
  }
36519
- }
36520
- ),
36521
- depositPoweredByFooter
36522
- ] })
36523
- ] }) : null })
36561
+ ),
36562
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36563
+ /* @__PURE__ */ jsx63("div", { className: "uf-h-[460px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: selectedExecution ? /* @__PURE__ */ jsx63(DepositDetailContent, { execution: selectedExecution }) : /* @__PURE__ */ jsx63("div", { className: "uf-space-y-2 uf-pb-8", children: allExecutions.length === 0 ? /* @__PURE__ */ jsx63("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ jsx63(
36564
+ "div",
36565
+ {
36566
+ className: "uf-text-sm",
36567
+ style: {
36568
+ color: components.container.subtitleColor,
36569
+ fontFamily: fonts.regular
36570
+ },
36571
+ children: "No deposits yet"
36572
+ }
36573
+ ) }) : allExecutions.map((execution) => /* @__PURE__ */ jsx63(
36574
+ DepositExecutionItem,
36575
+ {
36576
+ execution,
36577
+ onClick: () => setSelectedExecution(execution)
36578
+ },
36579
+ execution.id
36580
+ )) }) }),
36581
+ depositPoweredByFooter
36582
+ ] })
36583
+ ] }) : view === "card" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36584
+ /* @__PURE__ */ jsx63(
36585
+ DepositHeader,
36586
+ {
36587
+ title: cardView === "quotes" ? t8.quotes : depositWithCardTitle,
36588
+ showBack: showBackCard,
36589
+ onBack: handleBack,
36590
+ onClose: handleClose,
36591
+ badge: cardView === "quotes" ? { count: quotesCount } : void 0,
36592
+ showBalance: showBalanceHeader,
36593
+ balanceAddress: recipientAddress,
36594
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
36595
+ balanceChainId: destinationChainId,
36596
+ balanceTokenAddress: destinationTokenAddress,
36597
+ projectName: projectConfig?.project_name,
36598
+ publishableKey
36599
+ }
36600
+ ),
36601
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36602
+ standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ jsx63("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : !showFiatOnramp ? (
36603
+ // Fiat on-ramp resolved hidden/disabled after a direct open
36604
+ // (e.g. platform `is_hidden` for a Stripe Link-only project).
36605
+ // Show a geo-restriction screen rather than the card UI so the
36606
+ // hard-hide is honoured without a flash of "Pay with Card".
36607
+ /* @__PURE__ */ jsx63(GeoRestrictionScreen, { methodName: "Card" })
36608
+ ) : /* @__PURE__ */ jsx63(
36609
+ BuyWithCard,
36610
+ {
36611
+ userId,
36612
+ publishableKey,
36613
+ view: cardView,
36614
+ onViewChange: handleCardViewChange,
36615
+ destinationTokenSymbol,
36616
+ recipientAddress,
36617
+ destinationChainType,
36618
+ destinationChainId,
36619
+ destinationTokenAddress,
36620
+ onDepositSuccess: onDepositSuccessFor("card"),
36621
+ onDepositError: onDepositErrorFor("card"),
36622
+ onEvent,
36623
+ themeClass,
36624
+ wallets,
36625
+ assetCdnUrl: projectConfig?.asset_cdn_url,
36626
+ hideDepositFlowInfo,
36627
+ hideDisplayDescription,
36628
+ prefilledAmountUsd: normalizedPrefilledAmountUsd
36629
+ }
36630
+ ),
36631
+ depositPoweredByFooter
36632
+ ] })
36633
+ ] }) : view === "exchange" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36634
+ /* @__PURE__ */ jsx63(
36635
+ DepositHeader,
36636
+ {
36637
+ title: payWithExchangeTitle,
36638
+ showBack: exchangeView === "pending" || sessionOpenedFromMenu,
36639
+ onBack: handleBack,
36640
+ onClose: handleClose
36641
+ }
36642
+ ),
36643
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36644
+ /* @__PURE__ */ jsx63(
36645
+ PayWithExchange,
36646
+ {
36647
+ userId,
36648
+ publishableKey,
36649
+ exchanges,
36650
+ view: exchangeView,
36651
+ onViewChange: setExchangeView,
36652
+ destinationTokenSymbol,
36653
+ recipientAddress,
36654
+ destinationChainType,
36655
+ destinationChainId,
36656
+ destinationTokenAddress,
36657
+ onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
36658
+ onDepositError: onDepositErrorFor("pay_with_exchange"),
36659
+ wallets,
36660
+ defaultToken: defaultToken ?? null
36661
+ }
36662
+ ),
36663
+ depositPoweredByFooter
36664
+ ] })
36665
+ ] }) : view === "coinbase_connect" ? /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36666
+ /* @__PURE__ */ jsx63(
36667
+ CoinbaseConnect,
36668
+ {
36669
+ publishableKey,
36670
+ userId,
36671
+ wallets,
36672
+ recipientAddress,
36673
+ destinationTokenAddress: destinationTokenAddress ?? "",
36674
+ destinationChainId: destinationChainId ?? "",
36675
+ destinationChainType: destinationChainType ?? "",
36676
+ onDepositSuccess: onDepositSuccessFor("exchange_connect"),
36677
+ onDepositError: onDepositErrorFor("exchange_connect"),
36678
+ onTransferError: (error) => {
36679
+ onDepositErrorFor("exchange_connect")?.({
36680
+ message: error.message,
36681
+ error
36682
+ });
36683
+ },
36684
+ onBack: handleBack,
36685
+ onClose: handleClose,
36686
+ onDisconnect: handleExchangeDisconnect,
36687
+ skipToHoldings: coinbaseSkipToHoldings,
36688
+ canGoBack: sessionOpenedFromMenu,
36689
+ onExecutionsChange: setDepositExecutions,
36690
+ defaultSourceChainType,
36691
+ defaultSourceChainId,
36692
+ defaultSourceTokenAddress,
36693
+ defaultSourceSymbol,
36694
+ prefilledAmountUsd: normalizedPrefilledAmountUsd
36695
+ }
36696
+ ),
36697
+ depositPoweredByFooter
36698
+ ] }) : view === "wallet_connect" ? (
36699
+ // Mobile: flex-fill the full-height dialog body so the wallet list
36700
+ // can grow and scroll, with the footer pinned to the bottom.
36701
+ // Desktop (sm:): stays content-sized.
36702
+ /* @__PURE__ */ jsxs57(
36703
+ "div",
36704
+ {
36705
+ className: "uf-flex uf-flex-col uf-gap-1.5 uf-min-h-0 uf-flex-1 sm:uf-flex-none",
36706
+ children: [
36707
+ /* @__PURE__ */ jsx63(
36708
+ WalletConnect,
36709
+ {
36710
+ walletInfo: browserWalletInfo ?? void 0,
36711
+ depositWallet: browserWalletInfo?.depositWallet ?? void 0,
36712
+ wallets,
36713
+ userId,
36714
+ publishableKey,
36715
+ assetCdnUrl: projectConfig?.asset_cdn_url,
36716
+ projectName: projectConfig?.project_name,
36717
+ onError: (error) => {
36718
+ onDepositErrorFor("wallet_connect")?.({
36719
+ message: error.message,
36720
+ error
36721
+ });
36722
+ },
36723
+ onDepositSuccess: onDepositSuccessFor("wallet_connect"),
36724
+ onDepositError: onDepositErrorFor("wallet_connect"),
36725
+ amountQuickSelect: browserWalletAmountQuickSelect,
36726
+ prefilledAmountUsd: normalizedPrefilledAmountUsd,
36727
+ onWalletDisconnect: handleWalletDisconnect,
36728
+ onWalletConnected: (info, dw) => {
36729
+ setBrowserWalletInfo({ ...info, depositWallet: dw });
36730
+ setStoredWalletState(info.type);
36731
+ setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
36732
+ },
36733
+ onBack: handleBack,
36734
+ onClose: handleClose,
36735
+ defaultSourceChainType,
36736
+ defaultSourceChainId,
36737
+ defaultSourceTokenAddress,
36738
+ defaultSourceSymbol,
36739
+ canGoBack: sessionOpenedFromMenu,
36740
+ depositWalletsLoading: walletsLoading
36741
+ }
36742
+ ),
36743
+ depositPoweredByFooter
36744
+ ]
36745
+ }
36746
+ )
36747
+ ) : view === "bank_transfer" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36748
+ /* @__PURE__ */ jsx63(
36749
+ DepositHeader,
36750
+ {
36751
+ title: t8.bankTransfer.title,
36752
+ showBack: bankTransferView !== "providers" || sessionOpenedFromMenu,
36753
+ onBack: handleBack,
36754
+ onClose: handleClose
36755
+ }
36756
+ ),
36757
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36758
+ bankTransferProvidersLoading ? /* @__PURE__ */ jsx63(SkeletonButton, { variant: "with-icons" }) : !hasEnabledBankTransferProvider ? /* @__PURE__ */ jsx63(GeoRestrictionScreen, { methodName: "Bank Transfer" }) : /* @__PURE__ */ jsx63(
36759
+ BankTransfer,
36760
+ {
36761
+ userId,
36762
+ publishableKey,
36763
+ view: bankTransferView,
36764
+ onViewChange: setBankTransferView,
36765
+ recipientAddress,
36766
+ destinationChainType,
36767
+ destinationChainId,
36768
+ destinationTokenAddress,
36769
+ destinationTokenSymbol,
36770
+ wallets,
36771
+ defaultToken: defaultToken ?? null,
36772
+ assetCdnUrl: projectConfig?.asset_cdn_url,
36773
+ onEvent,
36774
+ onDepositSuccess,
36775
+ onDepositError,
36776
+ prefilledAmountUsd: normalizedPrefilledAmountUsd
36777
+ }
36778
+ ),
36779
+ depositPoweredByFooter
36780
+ ] })
36781
+ ] }) : view === "stripe_link" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36782
+ /* @__PURE__ */ jsx63(
36783
+ DepositHeader,
36784
+ {
36785
+ title: "Deposit with Link",
36786
+ showBack: stripeLinkStep !== "checkout" && stripeLinkStep !== "success",
36787
+ onBack: handleBack,
36788
+ showClose: stripeLinkStep !== "checkout" && stripeLinkStep !== "auth",
36789
+ onClose: handleClose
36790
+ }
36791
+ ),
36792
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36793
+ isLoadingIp ? (
36794
+ // Hold the geo decision until IP resolves so we don't mount
36795
+ // PayWithStripeLink (which kicks off config/OAuth work) for a
36796
+ // deep-link user who turns out to be outside the US.
36797
+ /* @__PURE__ */ jsx63(SkeletonButton, { variant: "with-icons" })
36798
+ ) : !showStripeLink ? (
36799
+ // Stripe Link's crypto on-ramp is US-only. On a direct open
36800
+ // (initialScreen="stripe_link") the row isn't in a menu to
36801
+ // fall back to, so show a geo-restriction screen rather than
36802
+ // the Link UI.
36803
+ /* @__PURE__ */ jsx63(
36804
+ GeoRestrictionScreen,
36805
+ {
36806
+ methodName: t8.stripeLink.title,
36807
+ message: "Pay with Link is only available in the US."
36808
+ }
36809
+ )
36810
+ ) : /* @__PURE__ */ jsx63(
36811
+ PayWithStripeLink,
36812
+ {
36813
+ userId,
36814
+ publishableKey,
36815
+ recipientAddress,
36816
+ destinationChainType,
36817
+ destinationChainId,
36818
+ destinationTokenAddress,
36819
+ countryCode: userIpInfo?.alpha2,
36820
+ subdivisionCode: userIpInfo?.subdivisionCode ?? void 0,
36821
+ wallets,
36822
+ email: userEmail,
36823
+ iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/link.svg` : void 0,
36824
+ step: stripeLinkStep,
36825
+ onStepChange: setStripeLinkStep,
36826
+ backHandlerRef: stripeLinkBackRef,
36827
+ onDepositSuccess,
36828
+ onDepositError
36829
+ }
36830
+ ),
36831
+ depositPoweredByFooter
36832
+ ] })
36833
+ ] }) : view === "cashapp" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36834
+ /* @__PURE__ */ jsx63(
36835
+ DepositHeader,
36836
+ {
36837
+ title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
36838
+ showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
36839
+ onBack: handleBack,
36840
+ onClose: handleClose
36841
+ }
36842
+ ),
36843
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36844
+ /* @__PURE__ */ jsx63(
36845
+ PayWithCashApp,
36846
+ {
36847
+ userId,
36848
+ publishableKey,
36849
+ recipientAddress,
36850
+ destinationChainType,
36851
+ destinationChainId,
36852
+ destinationTokenAddress,
36853
+ cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
36854
+ view: cashAppView,
36855
+ onViewChange: setCashAppView,
36856
+ onAmountChange: setCashAppAmount,
36857
+ onEvent,
36858
+ onDepositSuccess: onDepositSuccessFor("cashapp"),
36859
+ onDepositError: onDepositErrorFor("cashapp"),
36860
+ prefilledAmountUsd: normalizedPrefilledAmountUsd,
36861
+ wallets
36862
+ }
36863
+ ),
36864
+ depositPoweredByFooter
36865
+ ] })
36866
+ ] }) : view === "apple_pay" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
36867
+ /* @__PURE__ */ jsx63(
36868
+ DepositHeader,
36869
+ {
36870
+ title: applePayHeaderTitle,
36871
+ showBack: applePayShowBack,
36872
+ onBack: () => {
36873
+ const handled = applePayHandleRef.current?.requestBack() ?? false;
36874
+ if (!handled) handleBack();
36875
+ },
36876
+ onClose: handleClose
36877
+ }
36878
+ ),
36879
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36880
+ applePayProvidersLoading ? /* @__PURE__ */ jsx63(SkeletonButton, { variant: "with-icons" }) : !hasEnabledApplePayProvider ? /* @__PURE__ */ jsx63(GeoRestrictionScreen, { methodName: "Apple Pay" }) : /* @__PURE__ */ jsx63(
36881
+ BuyWithApplePay,
36882
+ {
36883
+ ref: applePayHandleRef,
36884
+ userId,
36885
+ publishableKey,
36886
+ destinationChainType,
36887
+ destinationChainId,
36888
+ destinationTokenAddress,
36889
+ userEmail,
36890
+ wallets,
36891
+ onViewChange: setApplePayView,
36892
+ onEvent,
36893
+ onDepositSuccess: onDepositSuccessFor("apple_pay"),
36894
+ onDepositError: onDepositErrorFor("apple_pay"),
36895
+ exitLabel: sessionOpenedFromMenu ? "Return" : "Close",
36896
+ onExit: () => {
36897
+ if (sessionOpenedFromMenu) {
36898
+ setView("main");
36899
+ } else {
36900
+ handleClose();
36901
+ }
36902
+ }
36903
+ }
36904
+ ),
36905
+ depositPoweredByFooter
36906
+ ] })
36907
+ ] }) : null
36908
+ }
36909
+ )
36524
36910
  ]
36525
36911
  }
36526
36912
  )
@@ -36613,11 +36999,11 @@ function CheckoutModal({
36613
36999
  }) {
36614
37000
  const { colors: colors2, fonts, components } = useTheme();
36615
37001
  const [view, setView] = useState41("main");
36616
- const resetViewTimeoutRef = useRef132(null);
37002
+ const resetViewTimeoutRef = useRef142(null);
36617
37003
  const [browserWalletInfo, setBrowserWalletInfo] = useState41(null);
36618
37004
  const [browserWalletChainType, setBrowserWalletChainType] = useState41(() => getStoredWalletState()?.chainType);
36619
- const lastCheckoutMethodRef = useRef132(void 0);
36620
- const emitCheckoutSuccess = useCallback92(
37005
+ const lastCheckoutMethodRef = useRef142(void 0);
37006
+ const emitCheckoutSuccess = useCallback112(
36621
37007
  (data, method) => {
36622
37008
  const isSucceeded = data.status === "succeeded";
36623
37009
  const richIntent = isSucceeded && data.paymentIntent ? mapToCheckoutPaymentIntent(data.paymentIntent) : void 0;
@@ -36680,7 +37066,7 @@ function CheckoutModal({
36680
37066
  setView("main");
36681
37067
  }
36682
37068
  }, [showConnectWallet, showTransferCrypto, view]);
36683
- const prevStatusRef = useRef132(null);
37069
+ const prevStatusRef = useRef142(null);
36684
37070
  useEffect35(() => {
36685
37071
  if (!paymentIntent) return;
36686
37072
  const prev = prevStatusRef.current;
@@ -36699,11 +37085,11 @@ function CheckoutModal({
36699
37085
  );
36700
37086
  }
36701
37087
  }, [emitCheckoutSuccess, paymentIntent, view]);
36702
- const wallets = useMemo142(() => {
37088
+ const wallets = useMemo152(() => {
36703
37089
  if (!paymentIntent) return [];
36704
37090
  return mapDepositAddressesToWallets(paymentIntent.deposit_addresses, paymentIntent);
36705
37091
  }, [paymentIntent]);
36706
- const formatCryptoAmount = useMemo142(() => {
37092
+ const formatCryptoAmount = useMemo152(() => {
36707
37093
  if (!paymentIntent) return (_) => "";
36708
37094
  const decimals = paymentIntent.destination_token_decimals ?? 6;
36709
37095
  const symbol = paymentIntent.currency.toUpperCase();
@@ -36713,7 +37099,7 @@ function CheckoutModal({
36713
37099
  return `${formatted} ${symbol}`;
36714
37100
  };
36715
37101
  }, [paymentIntent]);
36716
- const remainingAmountUsd = useMemo142(() => {
37102
+ const remainingAmountUsd = useMemo152(() => {
36717
37103
  if (!paymentIntent) return void 0;
36718
37104
  const total = parseFloat(paymentIntent.destination_amount_usd || paymentIntent.amount_usd);
36719
37105
  const received = parseFloat(
@@ -36725,7 +37111,7 @@ function CheckoutModal({
36725
37111
  return remaining > 0 ? remaining.toFixed(2) : "0.00";
36726
37112
  }, [paymentIntent]);
36727
37113
  const [selectedSource, setSelectedSource] = useState41(null);
36728
- const remainingDestinationAmount = useMemo142(() => {
37114
+ const remainingDestinationAmount = useMemo152(() => {
36729
37115
  if (!paymentIntent) return "0";
36730
37116
  const remaining = BigInt(paymentIntent.destination_amount) - BigInt(paymentIntent.destination_amount_received);
36731
37117
  return remaining > 0n ? remaining.toString() : "0";
@@ -36747,7 +37133,7 @@ function CheckoutModal({
36747
37133
  stablecoinParity: paymentIntent?.stablecoin_parity ?? false,
36748
37134
  enabled: open && view === "transfer" && !!paymentIntent && !!selectedSource && remainingDestinationAmount !== "0"
36749
37135
  });
36750
- const effectiveCheckoutQuote = useMemo142(() => {
37136
+ const effectiveCheckoutQuote = useMemo152(() => {
36751
37137
  if (!sourceQuote || !selectedSource) return null;
36752
37138
  const baseQuote = {
36753
37139
  sourceAmount: sourceQuote.source_amount,
@@ -36768,7 +37154,7 @@ function CheckoutModal({
36768
37154
  sourceAmountUsd: minUsd.toFixed(2)
36769
37155
  };
36770
37156
  }, [sourceQuote, selectedSource]);
36771
- const handleBrowserWalletClick = useCallback92(
37157
+ const handleBrowserWalletClick = useCallback112(
36772
37158
  (walletInfo) => {
36773
37159
  const walletChainType = walletInfo.type === "phantom-solana" || walletInfo.type === "solflare" || walletInfo.type === "backpack" || walletInfo.type === "glow" ? "solana" : "ethereum";
36774
37160
  setStoredWalletState(walletInfo.type);
@@ -36791,19 +37177,19 @@ function CheckoutModal({
36791
37177
  },
36792
37178
  [wallets, onCheckoutError]
36793
37179
  );
36794
- const handleWalletConnectClick = useCallback92(() => {
37180
+ const handleWalletConnectClick = useCallback112(() => {
36795
37181
  setBrowserWalletInfo(null);
36796
37182
  lastCheckoutMethodRef.current = "wallet_connect";
36797
37183
  setView("wallet_connect");
36798
37184
  }, []);
36799
- const handleWalletDisconnect = useCallback92(() => {
37185
+ const handleWalletDisconnect = useCallback112(() => {
36800
37186
  setUserDisconnectedWallet(true);
36801
37187
  clearStoredWalletState();
36802
37188
  setBrowserWalletChainType(void 0);
36803
37189
  setBrowserWalletInfo(null);
36804
37190
  setView("main");
36805
37191
  }, []);
36806
- const handleClose = useCallback92(() => {
37192
+ const handleClose = useCallback112(() => {
36807
37193
  onOpenChange(false);
36808
37194
  if (resetViewTimeoutRef.current) {
36809
37195
  clearTimeout(resetViewTimeoutRef.current);
@@ -36833,7 +37219,7 @@ function CheckoutModal({
36833
37219
  },
36834
37220
  []
36835
37221
  );
36836
- const handleBack = useCallback92(() => {
37222
+ const handleBack = useCallback112(() => {
36837
37223
  setView("main");
36838
37224
  }, []);
36839
37225
  const poweredByFooter = /* @__PURE__ */ jsx64("div", { className: "uf-pt-3", children: /* @__PURE__ */ jsx64(
@@ -36959,253 +37345,275 @@ function CheckoutModal({
36959
37345
  return /* @__PURE__ */ jsx64(PortalContainerProvider, { value: null, children: /* @__PURE__ */ jsx64(Dialog2, { open, onOpenChange: handleClose, modal: true, children: /* @__PURE__ */ jsx64(
36960
37346
  DialogContent2,
36961
37347
  {
36962
- className: `sm:uf-max-w-[400px] uf-border-secondary uf-text-foreground uf-gap-0 [&>button]:uf-hidden uf-p-0 uf-overflow-visible ${view === "main" ? "!uf-top-auto !uf-h-auto !uf-max-h-[60vh] sm:!uf-max-h-none sm:!uf-top-[50%]" : "!uf-top-0 !uf-h-full sm:!uf-h-auto sm:!uf-top-[50%]"} ${themeClass}`,
37348
+ className: `sm:uf-max-w-[400px] uf-border-secondary uf-text-foreground uf-gap-0 [&>button]:uf-hidden uf-p-0 uf-overflow-visible ${view === "main" ? "!uf-top-auto !uf-h-auto !uf-max-h-[60vh] sm:!uf-max-h-none sm:!uf-top-[50%]" : "!uf-top-0 !uf-h-full sm:!uf-h-auto sm:!uf-top-[50%]"} ${// wallet_connect fills the full-height mobile sheet. DialogContent is a
37349
+ // grid whose single auto row only grows to fill free space and never
37350
+ // shrinks below content, so a long wallet list would balloon the row
37351
+ // past the viewport and push the footer off-screen. Clamp the row to
37352
+ // the modal height with minmax(0,1fr) so the inner overflow-y-auto list
37353
+ // scrolls with the footer pinned. Reset to content-sized on desktop.
37354
+ view === "wallet_connect" ? "[grid-template-rows:minmax(0,1fr)] sm:[grid-template-rows:none]" : ""} ${themeClass}`,
36963
37355
  style: { backgroundColor: colors2.background },
36964
37356
  onPointerDownOutside: (e) => e.preventDefault(),
36965
37357
  onInteractOutside: (e) => e.preventDefault(),
36966
- children: /* @__PURE__ */ jsx64(ThemeStyleInjector, { children: view === "main" ? /* @__PURE__ */ jsxs58(Fragment15, { children: [
36967
- /* @__PURE__ */ jsx64(DepositHeader, { title: modalTitle || "Checkout", showClose: true, onClose: handleClose }),
36968
- /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36969
- piLoading ? /* @__PURE__ */ jsxs58("div", { className: "uf-space-y-3", children: [
36970
- /* @__PURE__ */ jsx64(
36971
- "div",
36972
- {
36973
- className: "uf-rounded-xl uf-p-4 uf-animate-pulse",
36974
- style: {
36975
- backgroundColor: components.card.backgroundColor,
36976
- borderRadius: components.card.borderRadius,
36977
- border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
36978
- },
36979
- children: /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-items-center uf-gap-2", children: [
36980
- /* @__PURE__ */ jsx64(
36981
- "div",
37358
+ children: /* @__PURE__ */ jsx64(
37359
+ ThemeStyleInjector,
37360
+ {
37361
+ className: view === "wallet_connect" ? "uf-flex uf-min-h-0 uf-flex-col" : void 0,
37362
+ children: view === "main" ? /* @__PURE__ */ jsxs58(Fragment15, { children: [
37363
+ /* @__PURE__ */ jsx64(DepositHeader, { title: modalTitle || "Checkout", showClose: true, onClose: handleClose }),
37364
+ /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
37365
+ piLoading ? /* @__PURE__ */ jsxs58("div", { className: "uf-space-y-3", children: [
37366
+ /* @__PURE__ */ jsx64(
37367
+ "div",
37368
+ {
37369
+ className: "uf-rounded-xl uf-p-4 uf-animate-pulse",
37370
+ style: {
37371
+ backgroundColor: components.card.backgroundColor,
37372
+ borderRadius: components.card.borderRadius,
37373
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
37374
+ },
37375
+ children: /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-items-center uf-gap-2", children: [
37376
+ /* @__PURE__ */ jsx64(
37377
+ "div",
37378
+ {
37379
+ className: "uf-h-8 uf-w-24 uf-rounded",
37380
+ style: {
37381
+ backgroundColor: components.card.borderColor
37382
+ }
37383
+ }
37384
+ ),
37385
+ /* @__PURE__ */ jsx64(
37386
+ "div",
37387
+ {
37388
+ className: "uf-h-4 uf-w-16 uf-rounded",
37389
+ style: {
37390
+ backgroundColor: components.card.borderColor
37391
+ }
37392
+ }
37393
+ )
37394
+ ] })
37395
+ }
37396
+ ),
37397
+ /* @__PURE__ */ jsx64(SkeletonButton2, {}),
37398
+ /* @__PURE__ */ jsx64(SkeletonButton2, {})
37399
+ ] }) : piError ? /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
37400
+ /* @__PURE__ */ jsx64("div", { className: "uf-w-16 uf-h-16 uf-rounded-full uf-bg-muted uf-flex uf-items-center uf-justify-center uf-mb-4", children: /* @__PURE__ */ jsx64(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
37401
+ /* @__PURE__ */ jsx64(
37402
+ "h3",
37403
+ {
37404
+ className: "uf-text-lg uf-font-semibold uf-mb-2",
37405
+ style: {
37406
+ color: colors2.foreground,
37407
+ fontFamily: fonts.semibold
37408
+ },
37409
+ children: "Unable to Load Checkout"
37410
+ }
37411
+ ),
37412
+ /* @__PURE__ */ jsx64(
37413
+ "p",
37414
+ {
37415
+ className: "uf-text-sm uf-max-w-[280px]",
37416
+ style: {
37417
+ color: colors2.foregroundMuted,
37418
+ fontFamily: fonts.regular
37419
+ },
37420
+ children: piError instanceof Error ? piError.message : "Something went wrong. Please try again."
37421
+ }
37422
+ )
37423
+ ] }) : paymentIntent ? /* @__PURE__ */ jsxs58("div", { className: "uf-space-y-3", children: [
37424
+ progressSection,
37425
+ (paymentIntent.status === "requires_payment" || paymentIntent.status === "processing") && /* @__PURE__ */ jsxs58(Fragment15, { children: [
37426
+ showTransferCrypto && /* @__PURE__ */ jsx64(
37427
+ TransferCryptoButton,
36982
37428
  {
36983
- className: "uf-h-8 uf-w-24 uf-rounded",
36984
- style: {
36985
- backgroundColor: components.card.borderColor
36986
- }
37429
+ onClick: () => {
37430
+ lastCheckoutMethodRef.current = "transfer";
37431
+ setView("transfer");
37432
+ },
37433
+ title: i18n2.checkoutModal.transferCrypto.title,
37434
+ subtitle: i18n2.checkoutModal.transferCrypto.subtitle,
37435
+ featuredTokens: projectConfig?.transfer_crypto.networks
36987
37436
  }
36988
37437
  ),
36989
- /* @__PURE__ */ jsx64(
36990
- "div",
37438
+ showConnectWallet && /* @__PURE__ */ jsx64(
37439
+ BrowserWalletButton,
36991
37440
  {
36992
- className: "uf-h-4 uf-w-16 uf-rounded",
36993
- style: {
36994
- backgroundColor: components.card.borderColor
36995
- }
37441
+ onClick: handleBrowserWalletClick,
37442
+ onConnectClick: handleWalletConnectClick,
37443
+ onDisconnect: handleWalletDisconnect,
37444
+ chainType: browserWalletChainType,
37445
+ publishableKey,
37446
+ featuredWallets: projectConfig?.connect_wallet?.wallets,
37447
+ subtitle: i18n2.checkoutModal.browserWallet.subtitle
36996
37448
  }
36997
37449
  )
36998
37450
  ] })
36999
- }
37000
- ),
37001
- /* @__PURE__ */ jsx64(SkeletonButton2, {}),
37002
- /* @__PURE__ */ jsx64(SkeletonButton2, {})
37003
- ] }) : piError ? /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
37004
- /* @__PURE__ */ jsx64("div", { className: "uf-w-16 uf-h-16 uf-rounded-full uf-bg-muted uf-flex uf-items-center uf-justify-center uf-mb-4", children: /* @__PURE__ */ jsx64(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
37451
+ ] }) : null,
37452
+ poweredByFooter
37453
+ ] })
37454
+ ] }) : view === "transfer" ? /* @__PURE__ */ jsxs58(Fragment15, { children: [
37005
37455
  /* @__PURE__ */ jsx64(
37006
- "h3",
37456
+ DepositHeader,
37007
37457
  {
37008
- className: "uf-text-lg uf-font-semibold uf-mb-2",
37009
- style: {
37010
- color: colors2.foreground,
37011
- fontFamily: fonts.semibold
37012
- },
37013
- children: "Unable to Load Checkout"
37458
+ title: modalTitle || "Checkout",
37459
+ showBack: true,
37460
+ onBack: handleBack,
37461
+ onClose: handleClose
37014
37462
  }
37015
37463
  ),
37016
- /* @__PURE__ */ jsx64(
37017
- "p",
37018
- {
37019
- className: "uf-text-sm uf-max-w-[280px]",
37020
- style: {
37021
- color: colors2.foregroundMuted,
37022
- fontFamily: fonts.regular
37023
- },
37024
- children: piError instanceof Error ? piError.message : "Something went wrong. Please try again."
37025
- }
37026
- )
37027
- ] }) : paymentIntent ? /* @__PURE__ */ jsxs58("div", { className: "uf-space-y-3", children: [
37028
- progressSection,
37029
- (paymentIntent.status === "requires_payment" || paymentIntent.status === "processing") && /* @__PURE__ */ jsxs58(Fragment15, { children: [
37030
- showTransferCrypto && /* @__PURE__ */ jsx64(
37031
- TransferCryptoButton,
37032
- {
37033
- onClick: () => {
37034
- lastCheckoutMethodRef.current = "transfer";
37035
- setView("transfer");
37036
- },
37037
- title: i18n2.checkoutModal.transferCrypto.title,
37038
- subtitle: i18n2.checkoutModal.transferCrypto.subtitle,
37039
- featuredTokens: projectConfig?.transfer_crypto.networks
37040
- }
37041
- ),
37042
- showConnectWallet && /* @__PURE__ */ jsx64(
37043
- BrowserWalletButton,
37044
- {
37045
- onClick: handleBrowserWalletClick,
37046
- onConnectClick: handleWalletConnectClick,
37047
- onDisconnect: handleWalletDisconnect,
37048
- chainType: browserWalletChainType,
37049
- publishableKey,
37050
- featuredWallets: projectConfig?.connect_wallet?.wallets,
37051
- subtitle: i18n2.checkoutModal.browserWallet.subtitle
37052
- }
37053
- )
37054
- ] })
37055
- ] }) : null,
37056
- poweredByFooter
37057
- ] })
37058
- ] }) : view === "transfer" ? /* @__PURE__ */ jsxs58(Fragment15, { children: [
37059
- /* @__PURE__ */ jsx64(
37060
- DepositHeader,
37061
- {
37062
- title: modalTitle || "Checkout",
37063
- showBack: true,
37064
- onBack: handleBack,
37065
- onClose: handleClose
37066
- }
37067
- ),
37068
- /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
37069
- paymentIntent ? /* @__PURE__ */ jsxs58(Fragment15, { children: [
37070
- (() => {
37071
- const receivedUsd = parseFloat(
37072
- paymentIntent.destination_amount_received_usd || paymentIntent.amount_received_usd
37073
- );
37074
- const totalUsd = parseFloat(
37075
- paymentIntent.destination_amount_usd || paymentIntent.amount_usd
37076
- );
37077
- const pct = totalUsd > 0 ? Math.min(receivedUsd / totalUsd * 100, 100) : 0;
37078
- return /* @__PURE__ */ jsxs58("div", { className: "uf-space-y-2", children: [
37079
- /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-items-center uf-justify-between", children: [
37080
- /* @__PURE__ */ jsx64(
37081
- "span",
37082
- {
37083
- className: "uf-text-xs",
37084
- style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
37085
- children: "Received"
37086
- }
37087
- ),
37088
- /* @__PURE__ */ jsxs58(
37089
- "span",
37090
- {
37091
- className: "uf-text-xs",
37092
- style: { color: colors2.foreground, fontFamily: fonts.medium },
37093
- children: [
37094
- "$",
37095
- receivedUsd.toFixed(2),
37096
- " / $",
37097
- totalUsd.toFixed(2)
37098
- ]
37099
- }
37100
- )
37101
- ] }),
37102
- /* @__PURE__ */ jsx64(
37103
- "div",
37104
- {
37105
- className: "uf-w-full uf-h-1.5 uf-rounded-full uf-overflow-hidden",
37106
- style: { backgroundColor: colors2.border },
37107
- children: /* @__PURE__ */ jsx64(
37464
+ /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
37465
+ paymentIntent ? /* @__PURE__ */ jsxs58(Fragment15, { children: [
37466
+ (() => {
37467
+ const receivedUsd = parseFloat(
37468
+ paymentIntent.destination_amount_received_usd || paymentIntent.amount_received_usd
37469
+ );
37470
+ const totalUsd = parseFloat(
37471
+ paymentIntent.destination_amount_usd || paymentIntent.amount_usd
37472
+ );
37473
+ const pct = totalUsd > 0 ? Math.min(receivedUsd / totalUsd * 100, 100) : 0;
37474
+ return /* @__PURE__ */ jsxs58("div", { className: "uf-space-y-2", children: [
37475
+ /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-items-center uf-justify-between", children: [
37476
+ /* @__PURE__ */ jsx64(
37477
+ "span",
37478
+ {
37479
+ className: "uf-text-xs",
37480
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
37481
+ children: "Received"
37482
+ }
37483
+ ),
37484
+ /* @__PURE__ */ jsxs58(
37485
+ "span",
37486
+ {
37487
+ className: "uf-text-xs",
37488
+ style: { color: colors2.foreground, fontFamily: fonts.medium },
37489
+ children: [
37490
+ "$",
37491
+ receivedUsd.toFixed(2),
37492
+ " / $",
37493
+ totalUsd.toFixed(2)
37494
+ ]
37495
+ }
37496
+ )
37497
+ ] }),
37498
+ /* @__PURE__ */ jsx64(
37108
37499
  "div",
37109
37500
  {
37110
- className: "uf-h-full uf-rounded-full uf-transition-all uf-duration-500",
37111
- style: {
37112
- width: `${pct}%`,
37113
- backgroundColor: paymentIntent.status === "succeeded" ? "rgb(34, 197, 94)" : colors2.primary
37114
- }
37501
+ className: "uf-w-full uf-h-1.5 uf-rounded-full uf-overflow-hidden",
37502
+ style: { backgroundColor: colors2.border },
37503
+ children: /* @__PURE__ */ jsx64(
37504
+ "div",
37505
+ {
37506
+ className: "uf-h-full uf-rounded-full uf-transition-all uf-duration-500",
37507
+ style: {
37508
+ width: `${pct}%`,
37509
+ backgroundColor: paymentIntent.status === "succeeded" ? "rgb(34, 197, 94)" : colors2.primary
37510
+ }
37511
+ }
37512
+ )
37115
37513
  }
37116
37514
  )
37515
+ ] });
37516
+ })(),
37517
+ /* @__PURE__ */ jsx64(
37518
+ TransferCryptoSingleInput,
37519
+ {
37520
+ userId: paymentIntent.user_id || "",
37521
+ publishableKey,
37522
+ clientSecret,
37523
+ recipientAddress: paymentIntent.recipient_address,
37524
+ destinationChainType: paymentIntent.destination_chain_type,
37525
+ destinationChainId: paymentIntent.destination_chain_id,
37526
+ destinationTokenAddress: paymentIntent.destination_token_address,
37527
+ defaultSourceChainType,
37528
+ defaultSourceChainId,
37529
+ defaultSourceTokenAddress,
37530
+ defaultSourceSymbol,
37531
+ depositConfirmationMode: "auto_ui",
37532
+ wallets,
37533
+ onSourceTokenChange: setSelectedSource,
37534
+ persistCheckingIndicator: true,
37535
+ productType: "payment",
37536
+ checkoutQuote: effectiveCheckoutQuote,
37537
+ isCheckoutQuoteLoading: isQuoteLoading || isQuoteFetching
37117
37538
  }
37118
37539
  )
37119
- ] });
37120
- })(),
37121
- /* @__PURE__ */ jsx64(
37122
- TransferCryptoSingleInput,
37540
+ ] }) : /* @__PURE__ */ jsx64(SkeletonButton2, {}),
37541
+ poweredByFooter
37542
+ ] })
37543
+ ] }) : view === "wallet_connect" && paymentIntent ? (
37544
+ // Mobile: flex-fill the full-height sheet so the wallet list grows and
37545
+ // scrolls with the footer pinned. Desktop (sm:): content-sized.
37546
+ /* @__PURE__ */ jsxs58(
37547
+ "div",
37123
37548
  {
37124
- userId: paymentIntent.user_id || "",
37125
- publishableKey,
37126
- clientSecret,
37127
- recipientAddress: paymentIntent.recipient_address,
37128
- destinationChainType: paymentIntent.destination_chain_type,
37129
- destinationChainId: paymentIntent.destination_chain_id,
37130
- destinationTokenAddress: paymentIntent.destination_token_address,
37131
- defaultSourceChainType,
37132
- defaultSourceChainId,
37133
- defaultSourceTokenAddress,
37134
- defaultSourceSymbol,
37135
- depositConfirmationMode: "auto_ui",
37136
- wallets,
37137
- onSourceTokenChange: setSelectedSource,
37138
- persistCheckingIndicator: true,
37139
- productType: "payment",
37140
- checkoutQuote: effectiveCheckoutQuote,
37141
- isCheckoutQuoteLoading: isQuoteLoading || isQuoteFetching
37549
+ className: "uf-flex uf-flex-col uf-gap-1.5 uf-min-h-0 uf-flex-1 sm:uf-flex-none",
37550
+ children: [
37551
+ /* @__PURE__ */ jsx64(
37552
+ WalletConnect,
37553
+ {
37554
+ walletInfo: browserWalletInfo ?? void 0,
37555
+ depositWallet: browserWalletInfo?.depositWallet ?? void 0,
37556
+ wallets,
37557
+ userId: paymentIntent.user_id || "",
37558
+ publishableKey,
37559
+ clientSecret,
37560
+ prefilledAmountUsd: remainingAmountUsd,
37561
+ checkoutAmountUsd: paymentIntent.amount_usd,
37562
+ checkoutReceivedUsd: paymentIntent.amount_received_usd,
37563
+ checkoutDestination: {
37564
+ chainType: paymentIntent.destination_chain_type,
37565
+ chainId: paymentIntent.destination_chain_id,
37566
+ tokenAddress: paymentIntent.destination_token_address,
37567
+ decimals: paymentIntent.destination_token_decimals ?? 6
37568
+ },
37569
+ productType: "payment",
37570
+ stablecoinParity: paymentIntent.stablecoin_parity ?? false,
37571
+ checkoutRemainingBaseUnits: (() => {
37572
+ const remaining = BigInt(paymentIntent.amount) - BigInt(paymentIntent.amount_received);
37573
+ return remaining > 0n ? remaining.toString() : "0";
37574
+ })(),
37575
+ onSuccess: (_txHash) => {
37576
+ emitCheckoutSuccess(
37577
+ {
37578
+ paymentIntentId: paymentIntent.id,
37579
+ status: "processing",
37580
+ paymentIntent
37581
+ },
37582
+ "wallet_connect"
37583
+ );
37584
+ },
37585
+ onError: (error) => {
37586
+ onCheckoutError?.({
37587
+ message: error.message,
37588
+ error,
37589
+ method: "wallet_connect"
37590
+ });
37591
+ },
37592
+ onWalletDisconnect: handleWalletDisconnect,
37593
+ onWalletConnected: (info, dw) => {
37594
+ setBrowserWalletInfo({ ...info, depositWallet: dw });
37595
+ setStoredWalletState(info.type);
37596
+ setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
37597
+ lastCheckoutMethodRef.current = "wallet_connect";
37598
+ },
37599
+ onNewDeposit: () => setView("main"),
37600
+ onDone: () => setView("main"),
37601
+ paymentIntentStatus: paymentIntent.status,
37602
+ onBack: handleBack,
37603
+ onClose: handleClose,
37604
+ defaultSourceChainType,
37605
+ defaultSourceChainId,
37606
+ defaultSourceTokenAddress,
37607
+ defaultSourceSymbol
37608
+ }
37609
+ ),
37610
+ poweredByFooter
37611
+ ]
37142
37612
  }
37143
37613
  )
37144
- ] }) : /* @__PURE__ */ jsx64(SkeletonButton2, {}),
37145
- poweredByFooter
37146
- ] })
37147
- ] }) : view === "wallet_connect" && paymentIntent ? /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
37148
- /* @__PURE__ */ jsx64(
37149
- WalletConnect,
37150
- {
37151
- walletInfo: browserWalletInfo ?? void 0,
37152
- depositWallet: browserWalletInfo?.depositWallet ?? void 0,
37153
- wallets,
37154
- userId: paymentIntent.user_id || "",
37155
- publishableKey,
37156
- clientSecret,
37157
- prefillAmountUsd: remainingAmountUsd,
37158
- checkoutAmountUsd: paymentIntent.amount_usd,
37159
- checkoutReceivedUsd: paymentIntent.amount_received_usd,
37160
- checkoutDestination: {
37161
- chainType: paymentIntent.destination_chain_type,
37162
- chainId: paymentIntent.destination_chain_id,
37163
- tokenAddress: paymentIntent.destination_token_address,
37164
- decimals: paymentIntent.destination_token_decimals ?? 6
37165
- },
37166
- productType: "payment",
37167
- stablecoinParity: paymentIntent.stablecoin_parity ?? false,
37168
- checkoutRemainingBaseUnits: (() => {
37169
- const remaining = BigInt(paymentIntent.amount) - BigInt(paymentIntent.amount_received);
37170
- return remaining > 0n ? remaining.toString() : "0";
37171
- })(),
37172
- onSuccess: (_txHash) => {
37173
- emitCheckoutSuccess(
37174
- {
37175
- paymentIntentId: paymentIntent.id,
37176
- status: "processing",
37177
- paymentIntent
37178
- },
37179
- "wallet_connect"
37180
- );
37181
- },
37182
- onError: (error) => {
37183
- onCheckoutError?.({
37184
- message: error.message,
37185
- error,
37186
- method: "wallet_connect"
37187
- });
37188
- },
37189
- onWalletDisconnect: handleWalletDisconnect,
37190
- onWalletConnected: (info, dw) => {
37191
- setBrowserWalletInfo({ ...info, depositWallet: dw });
37192
- setStoredWalletState(info.type);
37193
- setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
37194
- lastCheckoutMethodRef.current = "wallet_connect";
37195
- },
37196
- onNewDeposit: () => setView("main"),
37197
- onDone: () => setView("main"),
37198
- paymentIntentStatus: paymentIntent.status,
37199
- onBack: handleBack,
37200
- onClose: handleClose,
37201
- defaultSourceChainType,
37202
- defaultSourceChainId,
37203
- defaultSourceTokenAddress,
37204
- defaultSourceSymbol
37205
- }
37206
- ),
37207
- poweredByFooter
37208
- ] }) : null })
37614
+ ) : null
37615
+ }
37616
+ )
37209
37617
  }
37210
37618
  ) }) });
37211
37619
  }
@@ -37398,11 +37806,11 @@ function useWithdrawPolling({
37398
37806
  });
37399
37807
  const [executions, setExecutions] = useState42([]);
37400
37808
  const [isPolling, setIsPolling] = useState42(false);
37401
- const enabledAtRef = useRef142(/* @__PURE__ */ new Date());
37402
- const trackedRef = useRef142(/* @__PURE__ */ new Map());
37403
- const prevEnabledRef = useRef142(false);
37404
- const onSuccessRef = useRef142(onWithdrawSuccess);
37405
- const onErrorRef = useRef142(onWithdrawError);
37809
+ const enabledAtRef = useRef152(/* @__PURE__ */ new Date());
37810
+ const trackedRef = useRef152(/* @__PURE__ */ new Map());
37811
+ const prevEnabledRef = useRef152(false);
37812
+ const onSuccessRef = useRef152(onWithdrawSuccess);
37813
+ const onErrorRef = useRef152(onWithdrawError);
37406
37814
  useEffect36(() => {
37407
37815
  onSuccessRef.current = onWithdrawSuccess;
37408
37816
  }, [onWithdrawSuccess]);
@@ -37782,7 +38190,7 @@ function useHypercoreWithdrawActivation(params) {
37782
38190
  actionType: ActionType.Withdraw,
37783
38191
  enabled: enabled && isHypercore(sourceChainId)
37784
38192
  });
37785
- const depositWalletAddress = useMemo15(() => {
38193
+ const depositWalletAddress = useMemo16(() => {
37786
38194
  const wallets = depositWalletLookup.data?.data ?? [];
37787
38195
  return wallets.find((w) => w.chain_type === sourceChainType)?.address;
37788
38196
  }, [depositWalletLookup.data, sourceChainType]);
@@ -37901,7 +38309,7 @@ function WithdrawForm({
37901
38309
  enabled: debouncedAddress.length > 5 && !!selectedChain
37902
38310
  });
37903
38311
  const isDebouncing = trimmedAddress !== debouncedAddress;
37904
- const addressError = useMemo16(() => {
38312
+ const addressError = useMemo17(() => {
37905
38313
  if (!trimmedAddress || trimmedAddress.length <= 5) return null;
37906
38314
  if (isDebouncing || isVerifyingAddress) return null;
37907
38315
  if (verifyError) return t10.invalidAddress;
@@ -37935,33 +38343,33 @@ function WithdrawForm({
37935
38343
  destinationTokenAddress: selectedChain?.token_address,
37936
38344
  enabled: isAddressValid
37937
38345
  });
37938
- const exchangeRate = useMemo16(() => {
38346
+ const exchangeRate = useMemo17(() => {
37939
38347
  if (!balanceData?.exchangeRate) return 0;
37940
38348
  return parseFloat(balanceData.exchangeRate);
37941
38349
  }, [balanceData]);
37942
- const balanceCrypto = useMemo16(() => {
38350
+ const balanceCrypto = useMemo17(() => {
37943
38351
  if (!balanceData?.balanceHuman) return 0;
37944
38352
  return parseFloat(balanceData.balanceHuman);
37945
38353
  }, [balanceData]);
37946
- const balanceUsdNum = useMemo16(() => {
38354
+ const balanceUsdNum = useMemo17(() => {
37947
38355
  if (!balanceData?.balanceUsd) return 0;
37948
38356
  return parseFloat(balanceData.balanceUsd);
37949
38357
  }, [balanceData]);
37950
38358
  const tokenSymbol = sourceTokenSymbol || balanceData?.symbol || "TOKEN";
37951
38359
  const sourceDecimals = balanceData?.decimals ?? 6;
37952
- const cryptoAmountFromInput = useMemo16(() => {
38360
+ const cryptoAmountFromInput = useMemo17(() => {
37953
38361
  const val = parseFloat(amount);
37954
38362
  if (!val || val <= 0) return 0;
37955
38363
  if (inputUnit === "crypto") return val;
37956
38364
  return exchangeRate > 0 ? val / exchangeRate : 0;
37957
38365
  }, [amount, inputUnit, exchangeRate]);
37958
- const fiatAmountFromInput = useMemo16(() => {
38366
+ const fiatAmountFromInput = useMemo17(() => {
37959
38367
  const val = parseFloat(amount);
37960
38368
  if (!val || val <= 0) return 0;
37961
38369
  if (inputUnit === "fiat") return val;
37962
38370
  return val * exchangeRate;
37963
38371
  }, [amount, inputUnit, exchangeRate]);
37964
- const convertedDisplay = useMemo16(() => {
38372
+ const convertedDisplay = useMemo17(() => {
37965
38373
  if (!amount || parseFloat(amount) <= 0) return null;
37966
38374
  if (inputUnit === "crypto") {
37967
38375
  return `$${fiatAmountFromInput.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
@@ -37980,7 +38388,7 @@ function WithdrawForm({
37980
38388
  isMaxed,
37981
38389
  isStablecoin
37982
38390
  ]);
37983
- const balanceDisplay = useMemo16(() => {
38391
+ const balanceDisplay = useMemo17(() => {
37984
38392
  if (isLoadingBalance || !balanceData) return null;
37985
38393
  if (inputUnit === "crypto") {
37986
38394
  const displayDecimals = isStablecoin ? 2 : 6;
@@ -38003,7 +38411,7 @@ function WithdrawForm({
38003
38411
  tokenSymbol,
38004
38412
  isStablecoin
38005
38413
  ]);
38006
- const handleSwitchUnit = useCallback102(() => {
38414
+ const handleSwitchUnit = useCallback122(() => {
38007
38415
  if (isMaxed && balanceData) {
38008
38416
  if (inputUnit === "crypto") {
38009
38417
  setAmount((Math.round(balanceUsdNum * 100) / 100).toFixed(2));
@@ -38030,7 +38438,7 @@ function WithdrawForm({
38030
38438
  setInputUnit("crypto");
38031
38439
  }
38032
38440
  }, [amount, inputUnit, exchangeRate, sourceDecimals, isMaxed, balanceData, balanceUsdNum]);
38033
- const handleMaxClick = useCallback102(() => {
38441
+ const handleMaxClick = useCallback122(() => {
38034
38442
  if (inputUnit === "crypto") {
38035
38443
  if (balanceCrypto <= 0) return;
38036
38444
  setAmount(balanceData?.balanceHuman ?? "0");
@@ -38044,7 +38452,7 @@ function WithdrawForm({
38044
38452
  const isBelowMinimum = minimumWithdrawAmountUsd !== null && fiatAmountFromInput > 0 && Math.round(fiatAmountFromInput * 100) / 100 < minimumWithdrawAmountUsd;
38045
38453
  const isOverBalance = inputUnit === "crypto" ? cryptoAmountFromInput > 0 && balanceCrypto > 0 && cryptoAmountFromInput > balanceCrypto : fiatAmountFromInput > 0 && balanceUsdNum > 0 && Math.round(fiatAmountFromInput * 100) / 100 > Math.round(balanceUsdNum * 100) / 100;
38046
38454
  const isFormValid = trimmedAddress.length > 0 && amount.trim().length > 0 && cryptoAmountFromInput > 0 && isAddressValid && !isBelowMinimum && !isOverBalance && !isBalanceBelowMinimum && !!balanceData;
38047
- const handleWithdraw = useCallback102(async () => {
38455
+ const handleWithdraw = useCallback122(async () => {
38048
38456
  if (!selectedToken || !selectedChain) return;
38049
38457
  if (!isFormValid) return;
38050
38458
  setIsSubmitting(true);
@@ -38817,7 +39225,7 @@ function WithdrawModal({
38817
39225
  theme = "dark",
38818
39226
  hideOverlay = false
38819
39227
  }) {
38820
- const onWithdrawSuccessFor = useCallback112(
39228
+ const onWithdrawSuccessFor = useCallback132(
38821
39229
  (data) => {
38822
39230
  onWithdrawSuccess?.(data);
38823
39231
  if (data.execution) {
@@ -38828,7 +39236,7 @@ function WithdrawModal({
38828
39236
  );
38829
39237
  const { colors: colors2, fonts, components } = useTheme();
38830
39238
  const [containerEl, setContainerEl] = useState45(null);
38831
- const containerCallbackRef = useCallback112((el) => {
39239
+ const containerCallbackRef = useCallback132((el) => {
38832
39240
  setContainerEl(el);
38833
39241
  }, []);
38834
39242
  const [resolvedTheme, setResolvedTheme] = useState45(
@@ -38901,7 +39309,7 @@ function WithdrawModal({
38901
39309
  refetchInterval: view === "tracker" || view === "detail" ? 5e3 : 15e3
38902
39310
  });
38903
39311
  const allWithdrawals = allWithdrawalsData?.data ?? [];
38904
- const handleDepositWalletCreation = useCallback112(
39312
+ const handleDepositWalletCreation = useCallback132(
38905
39313
  async (params) => {
38906
39314
  const { data: wallets } = await createDepositAddress(
38907
39315
  {
@@ -38924,12 +39332,12 @@ function WithdrawModal({
38924
39332
  },
38925
39333
  [externalUserId, publishableKey, sourceChainType]
38926
39334
  );
38927
- const handleWithdrawSubmitted = useCallback112((txInfo) => {
39335
+ const handleWithdrawSubmitted = useCallback132((txInfo) => {
38928
39336
  setSubmittedTxInfo(txInfo);
38929
39337
  setView("confirming");
38930
39338
  }, []);
38931
- const resetViewTimeoutRef = useRef152(null);
38932
- const handleClose = useCallback112(() => {
39339
+ const resetViewTimeoutRef = useRef162(null);
39340
+ const handleClose = useCallback132(() => {
38933
39341
  onOpenChange(false);
38934
39342
  if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
38935
39343
  resetViewTimeoutRef.current = setTimeout(() => {
@@ -38957,13 +39365,13 @@ function WithdrawModal({
38957
39365
  },
38958
39366
  []
38959
39367
  );
38960
- const handleTokenSymbolChange = useCallback112(
39368
+ const handleTokenSymbolChange = useCallback132(
38961
39369
  (symbol) => {
38962
39370
  setSelectedTokenSymbol(symbol);
38963
39371
  },
38964
39372
  [setSelectedTokenSymbol]
38965
39373
  );
38966
- const handleChainKeyChange = useCallback112(
39374
+ const handleChainKeyChange = useCallback132(
38967
39375
  (chainKey) => {
38968
39376
  setSelectedChainKey(chainKey);
38969
39377
  },
@@ -39195,7 +39603,7 @@ function UnifoldProvider2({
39195
39603
  withdrawConfigRef.current = withdrawConfig;
39196
39604
  const withdrawCloseTimeoutRef = React38.useRef(null);
39197
39605
  const withdrawCloseGuardRef = React38.useRef(false);
39198
- const beginDeposit = useCallback13((config2) => {
39606
+ const beginDeposit = useCallback14((config2) => {
39199
39607
  if (closeTimeoutRef.current) {
39200
39608
  clearTimeout(closeTimeoutRef.current);
39201
39609
  closeTimeoutRef.current = null;
@@ -39230,7 +39638,7 @@ function UnifoldProvider2({
39230
39638
  setIsOpen(true);
39231
39639
  return promise;
39232
39640
  }, []);
39233
- const closeDeposit = useCallback13(() => {
39641
+ const closeDeposit = useCallback14(() => {
39234
39642
  if (closeGuardRef.current) {
39235
39643
  return;
39236
39644
  }
@@ -39252,7 +39660,7 @@ function UnifoldProvider2({
39252
39660
  closeTimeoutRef.current = null;
39253
39661
  }, 200);
39254
39662
  }, []);
39255
- const handleDepositSuccess = useCallback13(
39663
+ const handleDepositSuccess = useCallback14(
39256
39664
  (data) => {
39257
39665
  if (depositConfig?.onSuccess) {
39258
39666
  depositConfig.onSuccess(data);
@@ -39264,7 +39672,7 @@ function UnifoldProvider2({
39264
39672
  },
39265
39673
  [depositConfig]
39266
39674
  );
39267
- const handleDepositError = useCallback13(
39675
+ const handleDepositError = useCallback14(
39268
39676
  (error) => {
39269
39677
  console.error("[UnifoldProvider] Deposit error:", error);
39270
39678
  if (depositConfig?.onError) {
@@ -39282,7 +39690,7 @@ function UnifoldProvider2({
39282
39690
  checkoutConfigRef.current = checkoutConfig;
39283
39691
  const checkoutCloseTimeoutRef = React38.useRef(null);
39284
39692
  const checkoutCloseGuardRef = React38.useRef(false);
39285
- const beginCheckout = useCallback13((config2) => {
39693
+ const beginCheckout = useCallback14((config2) => {
39286
39694
  if (checkoutCloseTimeoutRef.current) {
39287
39695
  clearTimeout(checkoutCloseTimeoutRef.current);
39288
39696
  checkoutCloseTimeoutRef.current = null;
@@ -39307,7 +39715,7 @@ function UnifoldProvider2({
39307
39715
  setIsCheckoutOpen(true);
39308
39716
  return promise;
39309
39717
  }, []);
39310
- const closeCheckout = useCallback13(() => {
39718
+ const closeCheckout = useCallback14(() => {
39311
39719
  if (checkoutCloseGuardRef.current) {
39312
39720
  return;
39313
39721
  }
@@ -39329,7 +39737,7 @@ function UnifoldProvider2({
39329
39737
  checkoutCloseTimeoutRef.current = null;
39330
39738
  }, 200);
39331
39739
  }, []);
39332
- const handleCheckoutSuccess = useCallback13(
39740
+ const handleCheckoutSuccess = useCallback14(
39333
39741
  (data) => {
39334
39742
  if (checkoutConfig?.onSuccess) {
39335
39743
  checkoutConfig.onSuccess(data);
@@ -39341,7 +39749,7 @@ function UnifoldProvider2({
39341
39749
  },
39342
39750
  [checkoutConfig]
39343
39751
  );
39344
- const handleCheckoutError = useCallback13(
39752
+ const handleCheckoutError = useCallback14(
39345
39753
  (error) => {
39346
39754
  console.error("[UnifoldProvider] Checkout error:", error);
39347
39755
  if (checkoutConfig?.onError) {
@@ -39354,7 +39762,7 @@ function UnifoldProvider2({
39354
39762
  },
39355
39763
  [checkoutConfig]
39356
39764
  );
39357
- const beginWithdraw = useCallback13((config2) => {
39765
+ const beginWithdraw = useCallback14((config2) => {
39358
39766
  if (withdrawCloseTimeoutRef.current) {
39359
39767
  clearTimeout(withdrawCloseTimeoutRef.current);
39360
39768
  withdrawCloseTimeoutRef.current = null;
@@ -39379,7 +39787,7 @@ function UnifoldProvider2({
39379
39787
  setIsWithdrawOpen(true);
39380
39788
  return promise;
39381
39789
  }, []);
39382
- const closeWithdraw = useCallback13(() => {
39790
+ const closeWithdraw = useCallback14(() => {
39383
39791
  if (withdrawCloseGuardRef.current) {
39384
39792
  return;
39385
39793
  }
@@ -39401,7 +39809,7 @@ function UnifoldProvider2({
39401
39809
  withdrawCloseTimeoutRef.current = null;
39402
39810
  }, 200);
39403
39811
  }, []);
39404
- const handleWithdrawSuccess = useCallback13((data) => {
39812
+ const handleWithdrawSuccess = useCallback14((data) => {
39405
39813
  if (withdrawConfigRef.current?.onSuccess) {
39406
39814
  withdrawConfigRef.current.onSuccess(data);
39407
39815
  }
@@ -39410,7 +39818,7 @@ function UnifoldProvider2({
39410
39818
  withdrawPromiseRef.current = null;
39411
39819
  }
39412
39820
  }, []);
39413
- const handleWithdrawError = useCallback13((error) => {
39821
+ const handleWithdrawError = useCallback14((error) => {
39414
39822
  console.error("[UnifoldProvider] Withdraw error:", error);
39415
39823
  if (withdrawConfigRef.current?.onError) {
39416
39824
  withdrawConfigRef.current.onError(error);
@@ -39420,7 +39828,7 @@ function UnifoldProvider2({
39420
39828
  withdrawPromiseRef.current = null;
39421
39829
  }
39422
39830
  }, []);
39423
- const contextValue = useMemo18(
39831
+ const contextValue = useMemo19(
39424
39832
  () => ({
39425
39833
  beginDeposit,
39426
39834
  closeDeposit,
@@ -39515,6 +39923,7 @@ function UnifoldProvider2({
39515
39923
  defaultSourceChainId: depositConfig.defaultSourceChainId,
39516
39924
  defaultSourceTokenAddress: depositConfig.defaultSourceTokenAddress,
39517
39925
  defaultSourceSymbol: depositConfig.defaultSourceSymbol,
39926
+ prefilledAmountUsd: depositConfig.prefilledAmountUsd,
39518
39927
  userEmail: depositConfig.user?.email,
39519
39928
  depositConfirmationMode: depositConfig.depositConfirmationMode ?? "auto_ui",
39520
39929
  hideDepositTracker: config?.hideDepositTracker,