@unifold/connect-react 0.1.68 → 0.1.70-beta.1

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,13 +1144,16 @@ ${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 useCallback15, 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";
1151
1151
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
1152
1152
  import { jsx } from "react/jsx-runtime";
1153
- var UnifoldContext = createContext(null);
1153
+ var UNIFOLD_CONTEXT_KEY = /* @__PURE__ */ Symbol.for("unifold.react-provider.context");
1154
+ var globalRef = globalThis;
1155
+ var UnifoldContext = globalRef[UNIFOLD_CONTEXT_KEY] ?? createContext(null);
1156
+ globalRef[UNIFOLD_CONTEXT_KEY] = UnifoldContext;
1154
1157
  var createQueryClient = () => new QueryClient({
1155
1158
  defaultOptions: {
1156
1159
  queries: {
@@ -1216,9 +1219,9 @@ import {
1216
1219
  useState as useState40,
1217
1220
  useEffect as useEffect34,
1218
1221
  useLayoutEffect as useLayoutEffect22,
1219
- useCallback as useCallback82,
1220
- useRef as useRef122,
1221
- useMemo as useMemo13
1222
+ useCallback as useCallback11,
1223
+ useRef as useRef132,
1224
+ useMemo as useMemo14
1222
1225
  } from "react";
1223
1226
 
1224
1227
  // ../../node_modules/.pnpm/lucide-react@0.454.0_react@19.2.3/node_modules/lucide-react/dist/esm/createLucideIcon.js
@@ -6136,10 +6139,15 @@ import { jsx as jsx17 } from "react/jsx-runtime";
6136
6139
  import * as React211 from "react";
6137
6140
  import { jsx as jsx23, jsxs as jsxs4 } from "react/jsx-runtime";
6138
6141
  import { jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
6142
+ import * as React52 from "react";
6139
6143
  import { useState as useState102, useEffect as useEffect62, useRef as useRef22 } from "react";
6144
+ import { useQuery as useQuery3 } from "@tanstack/react-query";
6140
6145
 
6141
6146
  // ../core/dist/index.mjs
6142
6147
  import { useQuery } from "@tanstack/react-query";
6148
+ var __defProp2 = Object.defineProperty;
6149
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6150
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6143
6151
  function formatStablecoinAmount(baseUnits, decimals) {
6144
6152
  const raw = Number(baseUnits) / 10 ** decimals;
6145
6153
  const floored = Math.floor(raw * 100) / 100;
@@ -6233,6 +6241,16 @@ var ActionType = /* @__PURE__ */ ((ActionType2) => {
6233
6241
  ActionType2["Withdraw"] = "withdraw";
6234
6242
  return ActionType2;
6235
6243
  })(ActionType || {});
6244
+ var DepositAddressValidationError = class extends Error {
6245
+ constructor(message) {
6246
+ super(message);
6247
+ __publicField(this, "isDepositAddressValidationError", true);
6248
+ this.name = "DepositAddressValidationError";
6249
+ }
6250
+ };
6251
+ function isDepositAddressValidationError(error) {
6252
+ return error instanceof Error && error.isDepositAddressValidationError === true;
6253
+ }
6236
6254
  async function createDepositAddress(overrides, publishableKey) {
6237
6255
  if (!overrides?.external_user_id) {
6238
6256
  throw new Error("external_user_id is required");
@@ -6260,6 +6278,13 @@ async function createDepositAddress(overrides, publishableKey) {
6260
6278
  body: JSON.stringify(payload)
6261
6279
  });
6262
6280
  if (!response.ok) {
6281
+ if (response.status === 400) {
6282
+ const body = await response.json().catch(() => null);
6283
+ if (body?.error_type === "validation_error") {
6284
+ const firstError = Array.isArray(body.details?.errors) ? body.details?.errors[0] : void 0;
6285
+ throw new DepositAddressValidationError(firstError ?? "Invalid recipient address");
6286
+ }
6287
+ }
6263
6288
  throw new Error(`Failed to create EOA: ${response.statusText}`);
6264
6289
  }
6265
6290
  return response.json();
@@ -6430,6 +6455,27 @@ async function getFiatCurrencies(publishableKey) {
6430
6455
  }
6431
6456
  return response.json();
6432
6457
  }
6458
+ async function getFiatExchangeRates(options = {}, publishableKey) {
6459
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
6460
+ validatePublishableKey(pk);
6461
+ const params = new URLSearchParams();
6462
+ if (options.currencies && options.currencies.length > 0) {
6463
+ params.set("currencies", options.currencies.join(","));
6464
+ }
6465
+ const queryString = params.toString();
6466
+ const url = `${API_BASE_URL}/v1/public/exchange_rates/fiat_currencies${queryString ? `?${queryString}` : ""}`;
6467
+ const response = await fetch(url, {
6468
+ method: "GET",
6469
+ headers: {
6470
+ accept: "application/json",
6471
+ "x-publishable-key": pk
6472
+ }
6473
+ });
6474
+ if (!response.ok) {
6475
+ throw new Error(`Failed to fetch fiat exchange rates: ${response.statusText}`);
6476
+ }
6477
+ return response.json();
6478
+ }
6433
6479
  async function getOnrampQuotes(request, publishableKey) {
6434
6480
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
6435
6481
  validatePublishableKey(pk);
@@ -6595,6 +6641,21 @@ async function getProjectConfig(publishableKey, options) {
6595
6641
  const data = await response.json();
6596
6642
  return data;
6597
6643
  }
6644
+ async function getPublicIncident(publishableKey) {
6645
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
6646
+ validatePublishableKey(pk);
6647
+ const response = await fetch(`${API_BASE_URL}/v1/public/projects/incident`, {
6648
+ method: "GET",
6649
+ headers: {
6650
+ accept: "application/json",
6651
+ "x-publishable-key": pk
6652
+ }
6653
+ });
6654
+ if (!response.ok) {
6655
+ throw new Error(`Failed to fetch public incident: ${response.statusText}`);
6656
+ }
6657
+ return response.json();
6658
+ }
6598
6659
  async function getIpAddress() {
6599
6660
  const response = await fetch(`${API_BASE_URL}/v1/public/ip_address`, {
6600
6661
  method: "GET",
@@ -6650,7 +6711,7 @@ async function getExternalWallets(publishableKey) {
6650
6711
  const data = await response.json();
6651
6712
  return data;
6652
6713
  }
6653
- async function getWalletMobileDeepLink(wallet, depositAddresses, publishableKey) {
6714
+ async function getWalletMobileDeepLink(wallet, depositAddresses, publishableKey, amountUsd) {
6654
6715
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
6655
6716
  validatePublishableKey(pk);
6656
6717
  const response = await fetch(`${API_BASE_URL}/v1/public/external_wallets/mobile_deeplink`, {
@@ -6660,7 +6721,11 @@ async function getWalletMobileDeepLink(wallet, depositAddresses, publishableKey)
6660
6721
  accept: "application/json",
6661
6722
  "x-publishable-key": pk
6662
6723
  },
6663
- body: JSON.stringify({ wallet, deposit_addresses: depositAddresses })
6724
+ body: JSON.stringify({
6725
+ wallet,
6726
+ deposit_addresses: depositAddresses,
6727
+ ...amountUsd ? { amount_usd: amountUsd } : {}
6728
+ })
6664
6729
  });
6665
6730
  if (!response.ok) {
6666
6731
  throw new Error(`Failed to generate wallet deep link: ${response.statusText}`);
@@ -6705,6 +6770,15 @@ async function verifyRecipientAddress(request, publishableKey) {
6705
6770
  body: JSON.stringify(request)
6706
6771
  });
6707
6772
  if (!response.ok) {
6773
+ const body = await response.json().catch(() => null);
6774
+ if (response.status === 400 && body?.error_type === "validation_error") {
6775
+ const firstError = Array.isArray(body.details?.errors) ? body.details?.errors[0] : void 0;
6776
+ return {
6777
+ valid: false,
6778
+ failure_code: "validation_error",
6779
+ message: firstError ?? "Invalid recipient address"
6780
+ };
6781
+ }
6708
6782
  throw new Error(`Failed to verify recipient address: ${response.statusText}`);
6709
6783
  }
6710
6784
  return response.json();
@@ -7111,6 +7185,7 @@ async function stripeGetDefaultToken(params, publishableKey) {
7111
7185
  chain_type: params.chainType
7112
7186
  });
7113
7187
  if (params.countryCode) query.append("country_code", params.countryCode);
7188
+ if (params.subdivisionCode) query.append("subdivision_code", params.subdivisionCode);
7114
7189
  const response = await fetch(
7115
7190
  `${API_BASE_URL}${HEADLESS_STRIPE_BASE}/default_token?${query.toString()}`,
7116
7191
  {
@@ -7768,34 +7843,34 @@ import { jsx as jsx92, jsxs as jsxs8 } from "react/jsx-runtime";
7768
7843
  import { Fragment as Fragment23, jsx as jsx102, jsxs as jsxs9 } from "react/jsx-runtime";
7769
7844
  import { jsx as jsx112 } from "react/jsx-runtime";
7770
7845
  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";
7846
+ import * as React62 from "react";
7847
+ import { useCallback as useCallback22, useEffect as useEffect72, useMemo as useMemo42, useRef as useRef32, useState as useState112 } from "react";
7775
7848
  import { useQuery as useQuery4 } from "@tanstack/react-query";
7849
+ import { useMemo as useMemo32 } from "react";
7776
7850
  import { useQuery as useQuery5 } from "@tanstack/react-query";
7851
+ import { useQuery as useQuery6 } from "@tanstack/react-query";
7777
7852
  import { Fragment as Fragment42, jsx as jsx132, jsxs as jsxs11 } from "react/jsx-runtime";
7778
7853
  import { useState as useState122 } from "react";
7779
7854
  import { jsx as jsx142, jsxs as jsxs12 } from "react/jsx-runtime";
7780
- import { useState as useState152, useEffect as useEffect102, useCallback as useCallback22 } from "react";
7855
+ import { useState as useState152, useEffect as useEffect102, useCallback as useCallback32 } from "react";
7781
7856
  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";
7857
+ import { useEffect as useEffect82, useRef as useRef42, useState as useState132, useMemo as useMemo52 } from "react";
7783
7858
  import { jsx as jsx152, jsxs as jsxs13 } from "react/jsx-runtime";
7784
7859
  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
7860
  import { useQuery as useQuery7 } from "@tanstack/react-query";
7861
+ import { Fragment as Fragment52, jsx as jsx162, jsxs as jsxs14 } from "react/jsx-runtime";
7862
+ import { useCallback as useCallback42, useEffect as useEffect112, useMemo as useMemo62, useRef as useRef52, useState as useState162 } from "react";
7863
+ import { useQuery as useQuery8 } from "@tanstack/react-query";
7789
7864
  import { jsx as jsx172, jsxs as jsxs15 } from "react/jsx-runtime";
7790
7865
  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
7866
  import * as React72 from "react";
7794
- import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
7867
+ import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
7795
7868
  import * as React82 from "react";
7869
+ import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
7870
+ import * as React92 from "react";
7796
7871
  import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
7872
+ import * as React112 from "react";
7797
7873
  import * as React102 from "react";
7798
- import * as React92 from "react";
7799
7874
 
7800
7875
  // ../../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
7876
  import * as React25 from "react";
@@ -7943,15 +8018,15 @@ var cva = (base, config) => (props) => {
7943
8018
  // ../ui-react/dist/index.mjs
7944
8019
  import { jsx as jsx222 } from "react/jsx-runtime";
7945
8020
  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
8021
  import * as React122 from "react";
7949
- import { jsx as jsx25, jsxs as jsxs222 } from "react/jsx-runtime";
8022
+ import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
7950
8023
  import * as React132 from "react";
7951
- import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
8024
+ import { jsx as jsx25, jsxs as jsxs222 } from "react/jsx-runtime";
7952
8025
  import * as React142 from "react";
8026
+ import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
8027
+ import * as React152 from "react";
7953
8028
  import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
7954
- import * as React282 from "react";
8029
+ import * as React292 from "react";
7955
8030
 
7956
8031
  // ../../node_modules/.pnpm/mipd@0.0.7_typescript@5.9.3/node_modules/mipd/dist/esm/utils.js
7957
8032
  function requestProviders(listener) {
@@ -8008,54 +8083,55 @@ function createStore() {
8008
8083
  }
8009
8084
 
8010
8085
  // ../ui-react/dist/index.mjs
8011
- import * as React152 from "react";
8012
8086
  import * as React162 from "react";
8013
- import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
8014
8087
  import * as React172 from "react";
8015
- import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
8088
+ import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
8016
8089
  import * as React182 from "react";
8017
- import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
8090
+ import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
8018
8091
  import * as React192 from "react";
8019
- import { jsx as jsx31, jsxs as jsxs28 } from "react/jsx-runtime";
8092
+ import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
8020
8093
  import * as React202 from "react";
8021
- import { jsx as jsx322, jsxs as jsxs29 } from "react/jsx-runtime";
8094
+ import { jsx as jsx31, jsxs as jsxs28 } from "react/jsx-runtime";
8022
8095
  import * as React212 from "react";
8023
- import { jsx as jsx33, jsxs as jsxs30 } from "react/jsx-runtime";
8096
+ import { jsx as jsx322, jsxs as jsxs29 } from "react/jsx-runtime";
8024
8097
  import * as React222 from "react";
8025
- import { jsx as jsx34, jsxs as jsxs31 } from "react/jsx-runtime";
8098
+ import { jsx as jsx33, jsxs as jsxs30 } from "react/jsx-runtime";
8026
8099
  import * as React232 from "react";
8027
- import { jsx as jsx35, jsxs as jsxs322 } from "react/jsx-runtime";
8100
+ import { jsx as jsx34, jsxs as jsxs31 } from "react/jsx-runtime";
8028
8101
  import * as React242 from "react";
8029
- import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
8102
+ import { jsx as jsx35, jsxs as jsxs322 } from "react/jsx-runtime";
8030
8103
  import * as React252 from "react";
8031
- import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
8104
+ import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
8032
8105
  import * as React262 from "react";
8033
- import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
8106
+ import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
8034
8107
  import * as React272 from "react";
8108
+ import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
8109
+ import * as React282 from "react";
8035
8110
  import { jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
8036
8111
  import { jsx as jsx40, jsxs as jsxs37 } from "react/jsx-runtime";
8037
8112
  import { jsx as jsx41, jsxs as jsxs38 } from "react/jsx-runtime";
8038
- import * as React292 from "react";
8113
+ import * as React302 from "react";
8039
8114
  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";
8115
+ import { useState as useState292, useEffect as useEffect242, useCallback as useCallback62, useRef as useRef92 } from "react";
8041
8116
  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";
8117
+ import { useState as useState282, useEffect as useEffect232, useRef as useRef82, useCallback as useCallback52 } from "react";
8043
8118
  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, keepPreviousData } from "@tanstack/react-query";
8046
- import { useQuery as useQuery9 } from "@tanstack/react-query";
8119
+ import { useState as useState30, useEffect as useEffect252, useCallback as useCallback72, useMemo as useMemo82, useRef as useRef102 } from "react";
8120
+ import { useQuery as useQuery9, keepPreviousData } from "@tanstack/react-query";
8047
8121
  import { useQuery as useQuery10 } from "@tanstack/react-query";
8048
- import { Fragment as Fragment72, jsx as jsx45, jsxs as jsxs422 } from "react/jsx-runtime";
8049
8122
  import { useQuery as useQuery11 } from "@tanstack/react-query";
8123
+ import { Fragment as Fragment72, jsx as jsx45, jsxs as jsxs422 } from "react/jsx-runtime";
8050
8124
  import { useQuery as useQuery12 } from "@tanstack/react-query";
8051
8125
  import { useQuery as useQuery13 } from "@tanstack/react-query";
8052
- import { useState as useState36, useEffect as useEffect302, useMemo as useMemo102 } from "react";
8126
+ import { useQuery as useQuery14 } from "@tanstack/react-query";
8127
+ import { useQuery as useQuery15 } from "@tanstack/react-query";
8128
+ import { useState as useState36, useEffect as useEffect302, useMemo as useMemo112 } from "react";
8053
8129
  import { useEffect as useEffect272, useState as useState31 } from "react";
8054
- import * as React312 from "react";
8130
+ import * as React322 from "react";
8055
8131
  import { jsx as jsx46 } from "react/jsx-runtime";
8056
8132
  import { jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
8057
8133
  import { Fragment as Fragment82, jsx as jsx48, jsxs as jsxs44 } from "react/jsx-runtime";
8058
- import { useState as useState322, useMemo as useMemo92, useEffect as useEffect282 } from "react";
8134
+ import { useState as useState322, useMemo as useMemo102, useEffect as useEffect282 } from "react";
8059
8135
 
8060
8136
  // ../../node_modules/.pnpm/fuse.js@7.4.0/node_modules/fuse.js/dist/fuse.mjs
8061
8137
  function isArray(value) {
@@ -10057,11 +10133,11 @@ Fuse.use = function(...plugins) {
10057
10133
 
10058
10134
  // ../ui-react/dist/index.mjs
10059
10135
  import { jsx as jsx49, jsxs as jsxs45 } from "react/jsx-runtime";
10060
- import { useState as useState33, useEffect as useEffect292, useRef as useRef102 } from "react";
10136
+ import { useState as useState33, useEffect as useEffect292, useRef as useRef112, useCallback as useCallback82 } from "react";
10061
10137
  import { jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
10062
10138
  import { Fragment as Fragment92, jsx as jsx51, jsxs as jsxs47 } from "react/jsx-runtime";
10063
10139
  import { useState as useState34 } from "react";
10064
- import * as React322 from "react";
10140
+ import * as React332 from "react";
10065
10141
 
10066
10142
  // ../../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
10067
10143
  import * as React31 from "react";
@@ -12799,11 +12875,11 @@ var Content22 = TooltipContent;
12799
12875
 
12800
12876
  // ../ui-react/dist/index.mjs
12801
12877
  import { jsx as jsx522 } from "react/jsx-runtime";
12802
- import { useQuery as useQuery14 } from "@tanstack/react-query";
12878
+ import { useQuery as useQuery16 } from "@tanstack/react-query";
12803
12879
  import { jsx as jsx53, jsxs as jsxs48 } from "react/jsx-runtime";
12804
12880
  import { Fragment as Fragment10, jsx as jsx54, jsxs as jsxs49 } from "react/jsx-runtime";
12805
- import { useState as useState37, useEffect as useEffect312, useMemo as useMemo112 } from "react";
12806
- import * as React332 from "react";
12881
+ import { useState as useState37, useEffect as useEffect312, useMemo as useMemo122 } from "react";
12882
+ import * as React342 from "react";
12807
12883
 
12808
12884
  // ../../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
12809
12885
  import * as React35 from "react";
@@ -14040,9 +14116,9 @@ var Separator = SelectSeparator;
14040
14116
  // ../ui-react/dist/index.mjs
14041
14117
  import { jsx as jsx55, jsxs as jsxs50 } from "react/jsx-runtime";
14042
14118
  import { jsx as jsx56, jsxs as jsxs51 } from "react/jsx-runtime";
14043
- import * as React342 from "react";
14044
- import { useQuery as useQuery15 } from "@tanstack/react-query";
14045
- import { useQuery as useQuery16 } from "@tanstack/react-query";
14119
+ import * as React352 from "react";
14120
+ import { useQuery as useQuery17 } from "@tanstack/react-query";
14121
+ import { useQuery as useQuery18 } from "@tanstack/react-query";
14046
14122
  import { jsx as jsx57 } from "react/jsx-runtime";
14047
14123
  import { jsx as jsx58, jsxs as jsxs52 } from "react/jsx-runtime";
14048
14124
  import { Fragment as Fragment11, jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
@@ -14051,26 +14127,26 @@ import { useEffect as useEffect322, useState as useState382 } from "react";
14051
14127
  import { Fragment as Fragment13, jsx as jsx61, jsxs as jsxs55 } from "react/jsx-runtime";
14052
14128
  import { jsx as jsx622, jsxs as jsxs56 } from "react/jsx-runtime";
14053
14129
  import { Fragment as Fragment14, jsx as jsx63, jsxs as jsxs57 } from "react/jsx-runtime";
14054
- import { useState as useState41, useEffect as useEffect35, useLayoutEffect as useLayoutEffect32, useCallback as useCallback92, useRef as useRef132, useMemo as useMemo142 } from "react";
14055
- import { useQuery as useQuery17 } from "@tanstack/react-query";
14056
- import { Fragment as Fragment15, jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
14057
- import { useState as useState45, useEffect as useEffect39, useLayoutEffect as useLayoutEffect42, useCallback as useCallback112, useRef as useRef152 } from "react";
14058
- import { useQuery as useQuery18 } from "@tanstack/react-query";
14130
+ import { useState as useState41, useEffect as useEffect35, useLayoutEffect as useLayoutEffect32, useCallback as useCallback122, useRef as useRef142, useMemo as useMemo152 } from "react";
14059
14131
  import { useQuery as useQuery19 } from "@tanstack/react-query";
14132
+ import { Fragment as Fragment15, jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
14133
+ import { useState as useState45, useEffect as useEffect39, useLayoutEffect as useLayoutEffect42, useCallback as useCallback14, useRef as useRef162 } from "react";
14060
14134
  import { useQuery as useQuery20 } from "@tanstack/react-query";
14061
14135
  import { useQuery as useQuery21 } from "@tanstack/react-query";
14062
- import { useState as useState42, useEffect as useEffect36, useRef as useRef142 } from "react";
14063
- import { jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
14064
- import { useState as useState43, useCallback as useCallback102, useMemo as useMemo16, useEffect as useEffect37 } from "react";
14065
14136
  import { useQuery as useQuery222 } from "@tanstack/react-query";
14066
- import { useMemo as useMemo15 } from "react";
14067
14137
  import { useQuery as useQuery23 } from "@tanstack/react-query";
14138
+ import { useState as useState42, useEffect as useEffect36, useRef as useRef152 } from "react";
14139
+ import { jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
14140
+ import { useState as useState43, useCallback as useCallback132, useMemo as useMemo17, useEffect as useEffect37 } from "react";
14141
+ import { useQuery as useQuery24 } from "@tanstack/react-query";
14142
+ import { useMemo as useMemo16 } from "react";
14143
+ import { useQuery as useQuery25 } from "@tanstack/react-query";
14068
14144
  import { Fragment as Fragment16, jsx as jsx66, jsxs as jsxs60 } from "react/jsx-runtime";
14069
14145
  import { jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
14070
14146
  import { useState as useState44, useEffect as useEffect38 } from "react";
14071
14147
  import { Fragment as Fragment17, jsx as jsx68, jsxs as jsxs62 } from "react/jsx-runtime";
14072
14148
  import { Fragment as Fragment18, jsx as jsx69, jsxs as jsxs63 } from "react/jsx-runtime";
14073
- import { useState as useState46, useMemo as useMemo17 } from "react";
14149
+ import { useState as useState46, useMemo as useMemo18 } from "react";
14074
14150
  import { jsx as jsx70, jsxs as jsxs64 } from "react/jsx-runtime";
14075
14151
  function cn(...inputs) {
14076
14152
  return twMerge(clsx(inputs));
@@ -14653,7 +14729,13 @@ function useDepositAddress(params) {
14653
14729
  // 24 hours in cache
14654
14730
  refetchOnMount: false,
14655
14731
  refetchOnWindowFocus: false,
14656
- retry: 3,
14732
+ // Don't retry recipient-address validation errors — they're deterministic
14733
+ // (a 400 won't succeed on retry) and we want to surface the invalid-address
14734
+ // screen immediately rather than after 3 backoff attempts.
14735
+ retry: (failureCount, error) => {
14736
+ if (isDepositAddressValidationError(error)) return false;
14737
+ return failureCount < 3;
14738
+ },
14657
14739
  retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 1e4)
14658
14740
  // 1s, 2s, 4s (max 10s)
14659
14741
  });
@@ -14861,7 +14943,8 @@ function DepositHeader({
14861
14943
  balanceChainId,
14862
14944
  balanceTokenAddress,
14863
14945
  projectName,
14864
- publishableKey
14946
+ publishableKey,
14947
+ incident
14865
14948
  }) {
14866
14949
  const { colors: colors2, fonts, components } = useTheme();
14867
14950
  const [balance, setBalance] = useState32(null);
@@ -14959,19 +15042,64 @@ function DepositHeader({
14959
15042
  balanceTokenAddress,
14960
15043
  publishableKey
14961
15044
  ]);
14962
- return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsxs32("div", { className: "uf-flex uf-items-center uf-justify-between uf-pb-6", children: [
14963
- showBack ? /* @__PURE__ */ jsx42(
14964
- "button",
14965
- {
14966
- onClick: onBack,
14967
- className: "hover:uf-bg-secondary uf-rounded-lg uf-p-1 uf-transition-colors",
14968
- style: { color: components.header.buttonColor },
14969
- children: /* @__PURE__ */ jsx42(ArrowLeft, { className: "uf-w-5 uf-h-5" })
14970
- }
14971
- ) : /* @__PURE__ */ jsx42("div", { className: "uf-w-5 uf-h-5 uf-invisible" }),
14972
- /* @__PURE__ */ jsxs32("div", { className: "uf-flex uf-flex-col uf-items-center", children: [
14973
- badge ? /* @__PURE__ */ jsxs32("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
14974
- /* @__PURE__ */ jsx42(
15045
+ const incidentMessages = incident?.messages ?? [];
15046
+ const showIncident = incident?.enabled && incidentMessages.length > 0;
15047
+ const incidentSeverity = incident?.severity ?? "degraded";
15048
+ const incidentSeverityLabel = incidentSeverity === "outage" ? "Outage" : incidentSeverity === "info" ? "Info" : "Degraded service";
15049
+ const incidentStyles = incidentSeverity === "outage" ? {
15050
+ bg: "rgba(239, 68, 68, 0.12)",
15051
+ border: "rgba(239, 68, 68, 0.35)",
15052
+ text: "#fca5a5",
15053
+ link: "#fca5a5"
15054
+ } : incidentSeverity === "info" ? {
15055
+ bg: "rgba(59, 130, 246, 0.12)",
15056
+ border: "rgba(59, 130, 246, 0.35)",
15057
+ text: "#93c5fd",
15058
+ link: "#93c5fd"
15059
+ } : {
15060
+ bg: "rgba(245, 158, 11, 0.12)",
15061
+ border: "rgba(245, 158, 11, 0.35)",
15062
+ text: "#fcd34d",
15063
+ link: "#fcd34d"
15064
+ };
15065
+ const IncidentIcon = incidentSeverity === "info" ? Info : TriangleAlert;
15066
+ return /* @__PURE__ */ jsxs32("div", { children: [
15067
+ /* @__PURE__ */ jsxs32("div", { className: "uf-flex uf-items-center uf-justify-between uf-pb-6", children: [
15068
+ showBack ? /* @__PURE__ */ jsx42(
15069
+ "button",
15070
+ {
15071
+ onClick: onBack,
15072
+ className: "hover:uf-bg-secondary uf-rounded-lg uf-p-1 uf-transition-colors",
15073
+ style: { color: components.header.buttonColor },
15074
+ children: /* @__PURE__ */ jsx42(ArrowLeft, { className: "uf-w-5 uf-h-5" })
15075
+ }
15076
+ ) : /* @__PURE__ */ jsx42("div", { className: "uf-w-5 uf-h-5 uf-invisible" }),
15077
+ /* @__PURE__ */ jsxs32("div", { className: "uf-flex uf-flex-col uf-items-center", children: [
15078
+ badge ? /* @__PURE__ */ jsxs32("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
15079
+ /* @__PURE__ */ jsx42(
15080
+ DialogTitle2,
15081
+ {
15082
+ className: "uf-text-center uf-text-base",
15083
+ style: {
15084
+ color: components.header.titleColor,
15085
+ fontFamily: fonts.medium
15086
+ },
15087
+ children: title
15088
+ }
15089
+ ),
15090
+ /* @__PURE__ */ jsx42(
15091
+ "div",
15092
+ {
15093
+ className: "uf-px-2 uf-py-0.5 uf-rounded-full uf-text-[10px]",
15094
+ style: {
15095
+ backgroundColor: colors2.card,
15096
+ color: colors2.foregroundMuted,
15097
+ fontFamily: fonts.regular
15098
+ },
15099
+ children: badge.count
15100
+ }
15101
+ )
15102
+ ] }) : /* @__PURE__ */ jsx42(
14975
15103
  DialogTitle2,
14976
15104
  {
14977
15105
  className: "uf-text-center uf-text-base",
@@ -14982,61 +15110,91 @@ function DepositHeader({
14982
15110
  children: title
14983
15111
  }
14984
15112
  ),
14985
- /* @__PURE__ */ jsx42(
15113
+ subtitle ? /* @__PURE__ */ jsx42(
14986
15114
  "div",
14987
15115
  {
14988
- className: "uf-px-2 uf-py-0.5 uf-rounded-full uf-text-[10px]",
15116
+ className: "uf-text-xs uf-mt-1",
14989
15117
  style: {
14990
- backgroundColor: colors2.card,
14991
15118
  color: colors2.foregroundMuted,
14992
15119
  fontFamily: fonts.regular
14993
15120
  },
14994
- children: badge.count
15121
+ children: subtitle
14995
15122
  }
14996
- )
14997
- ] }) : /* @__PURE__ */ jsx42(
14998
- DialogTitle2,
14999
- {
15000
- className: "uf-text-center uf-text-base",
15001
- style: {
15002
- color: components.header.titleColor,
15003
- fontFamily: fonts.medium
15004
- },
15005
- children: title
15006
- }
15007
- ),
15008
- subtitle ? /* @__PURE__ */ jsx42(
15009
- "div",
15010
- {
15011
- className: "uf-text-xs uf-mt-1",
15012
- style: {
15013
- color: colors2.foregroundMuted,
15014
- fontFamily: fonts.regular
15015
- },
15016
- children: subtitle
15017
- }
15018
- ) : showBalanceBlock ? isLoadingBalance && showBalanceSkeleton ? /* @__PURE__ */ jsx42("div", { className: "uf-h-3 uf-w-32 uf-bg-muted uf-rounded uf-animate-pulse uf-mt-1" }) : balance ? /* @__PURE__ */ jsx42(
15019
- "div",
15123
+ ) : showBalanceBlock ? isLoadingBalance && showBalanceSkeleton ? /* @__PURE__ */ jsx42("div", { className: "uf-h-3 uf-w-32 uf-bg-muted uf-rounded uf-animate-pulse uf-mt-1" }) : balance ? /* @__PURE__ */ jsx42(
15124
+ "div",
15125
+ {
15126
+ className: "uf-text-xs uf-mt-1",
15127
+ style: {
15128
+ color: colors2.foregroundMuted,
15129
+ fontFamily: fonts.regular
15130
+ },
15131
+ children: formatBalanceDisplay(balance, projectName)
15132
+ }
15133
+ ) : null : null
15134
+ ] }),
15135
+ showClose ? /* @__PURE__ */ jsx42(
15136
+ "button",
15020
15137
  {
15021
- className: "uf-text-xs uf-mt-1",
15022
- style: {
15023
- color: colors2.foregroundMuted,
15024
- fontFamily: fonts.regular
15025
- },
15026
- children: formatBalanceDisplay(balance, projectName)
15138
+ onClick: onClose,
15139
+ className: "hover:uf-bg-secondary uf-rounded-lg uf-p-1 uf-transition-colors",
15140
+ style: { color: components.header.buttonColor },
15141
+ children: /* @__PURE__ */ jsx42(X, { className: "uf-w-5 uf-h-5" })
15027
15142
  }
15028
- ) : null : null
15143
+ ) : /* @__PURE__ */ jsx42("div", { className: "uf-w-5 uf-h-5 uf-invisible" })
15029
15144
  ] }),
15030
- showClose ? /* @__PURE__ */ jsx42(
15031
- "button",
15145
+ showIncident && /* @__PURE__ */ jsx42(
15146
+ "div",
15032
15147
  {
15033
- onClick: onClose,
15034
- className: "hover:uf-bg-secondary uf-rounded-lg uf-p-1 uf-transition-colors",
15035
- style: { color: components.header.buttonColor },
15036
- children: /* @__PURE__ */ jsx42(X, { className: "uf-w-5 uf-h-5" })
15148
+ className: "uf-rounded-lg uf-px-3 uf-py-2.5 uf-mb-4",
15149
+ style: {
15150
+ backgroundColor: incidentStyles.bg,
15151
+ border: `1px solid ${incidentStyles.border}`
15152
+ },
15153
+ children: /* @__PURE__ */ jsxs32("div", { className: "uf-flex uf-items-start uf-gap-2.5", children: [
15154
+ /* @__PURE__ */ jsx42(
15155
+ IncidentIcon,
15156
+ {
15157
+ className: "uf-w-4 uf-h-4 uf-mt-0.5 uf-shrink-0",
15158
+ style: { color: incidentStyles.text }
15159
+ }
15160
+ ),
15161
+ /* @__PURE__ */ jsxs32("div", { className: "uf-min-w-0 uf-flex-1", children: [
15162
+ /* @__PURE__ */ jsx42("div", { className: "uf-flex uf-items-center uf-gap-2 uf-mb-1.5", children: /* @__PURE__ */ jsx42(
15163
+ "span",
15164
+ {
15165
+ className: "uf-text-[11px] uf-leading-none uf-px-1.5 uf-py-1 uf-rounded-md",
15166
+ style: {
15167
+ color: incidentStyles.text,
15168
+ border: `1px solid ${incidentStyles.border}`,
15169
+ fontFamily: fonts.medium
15170
+ },
15171
+ children: incidentSeverityLabel
15172
+ }
15173
+ ) }),
15174
+ /* @__PURE__ */ jsx42(
15175
+ "div",
15176
+ {
15177
+ className: "uf-space-y-1",
15178
+ style: { color: incidentStyles.text, fontFamily: fonts.regular },
15179
+ children: incidentMessages.map((message, index2) => /* @__PURE__ */ jsx42("p", { className: "uf-text-xs uf-leading-relaxed", children: message }, `${message}-${index2}`))
15180
+ }
15181
+ ),
15182
+ incident.statusPageUrl && /* @__PURE__ */ jsx42(
15183
+ "a",
15184
+ {
15185
+ href: incident.statusPageUrl,
15186
+ target: "_blank",
15187
+ rel: "noreferrer",
15188
+ className: "uf-inline-block uf-mt-1.5 uf-text-xs uf-underline uf-underline-offset-2",
15189
+ style: { color: incidentStyles.link, fontFamily: fonts.medium },
15190
+ children: "View status"
15191
+ }
15192
+ )
15193
+ ] })
15194
+ ] })
15037
15195
  }
15038
- ) : /* @__PURE__ */ jsx42("div", { className: "uf-w-5 uf-h-5 uf-invisible" })
15039
- ] }) });
15196
+ )
15197
+ ] });
15040
15198
  }
15041
15199
  function CurrencyListItem({ currency, isSelected, onSelect }) {
15042
15200
  const { colors: colors2, fonts, components } = useTheme();
@@ -15356,7 +15514,8 @@ var en_default2 = {
15356
15514
  },
15357
15515
  stripeLink: {
15358
15516
  title: "Pay with Link",
15359
- subtitle: "Buy with card or bank"
15517
+ subtitle: "Buy with card or bank",
15518
+ unavailableInRegionMessage: "Pay with Link is currently unavailable in your region."
15360
15519
  },
15361
15520
  browserWallet: {
15362
15521
  title: "Connect Wallet",
@@ -16522,13 +16681,25 @@ function BuyWithCard({
16522
16681
  wallets: externalWallets,
16523
16682
  assetCdnUrl,
16524
16683
  hideDepositFlowInfo = false,
16525
- hideDisplayDescription = false
16684
+ hideDisplayDescription = false,
16685
+ prefilledAmountUsd
16526
16686
  }) {
16527
16687
  const { colors: colors2, fonts, components } = useTheme();
16528
- const [amount, setAmount] = useState102("");
16688
+ const cleanedPrefilledAmountUsd = React52.useMemo(() => {
16689
+ if (!prefilledAmountUsd) return "";
16690
+ return prefilledAmountUsd.replace(/[^0-9.]/g, "");
16691
+ }, [prefilledAmountUsd]);
16692
+ const parsedPrefilledAmountUsd = React52.useMemo(() => {
16693
+ const parsed = parseFloat(cleanedPrefilledAmountUsd);
16694
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
16695
+ }, [cleanedPrefilledAmountUsd]);
16696
+ const shouldAutoConvertPrefilledRef = useRef22(!!cleanedPrefilledAmountUsd);
16697
+ const [amount, setAmount] = useState102(() => cleanedPrefilledAmountUsd);
16529
16698
  const [currency, setCurrency] = useState102("usd");
16530
16699
  const [hasManualCurrencySelection, setHasManualCurrencySelection] = useState102(false);
16531
- const [hasManualAmountEntry, setHasManualAmountEntry] = useState102(false);
16700
+ const [hasManualAmountEntry, setHasManualAmountEntry] = useState102(
16701
+ () => !!cleanedPrefilledAmountUsd
16702
+ );
16532
16703
  const [showCurrencyModal, setShowCurrencyModal] = useState102(false);
16533
16704
  const [quotes, setQuotes] = useState102([]);
16534
16705
  const [quotesLoading, setQuotesLoading] = useState102(false);
@@ -16585,6 +16756,71 @@ function BuyWithCard({
16585
16756
  const [preferredCurrencyCodes, setPreferredCurrencyCodes] = useState102([]);
16586
16757
  const [currenciesLoading, setCurrenciesLoading] = useState102(true);
16587
16758
  const [destinationToken, setDestinationToken] = useState102(null);
16759
+ useEffect62(() => {
16760
+ const hasPrefilledAmount = !!cleanedPrefilledAmountUsd;
16761
+ shouldAutoConvertPrefilledRef.current = hasPrefilledAmount;
16762
+ if (!hasPrefilledAmount) return;
16763
+ setAmount(cleanedPrefilledAmountUsd);
16764
+ setHasManualAmountEntry(true);
16765
+ }, [cleanedPrefilledAmountUsd]);
16766
+ const { data: fiatExchangeRatesResponse, isLoading: isFiatExchangeRatesLoading } = useQuery3({
16767
+ queryKey: ["fiat-exchange-rates", publishableKey],
16768
+ staleTime: 3e4,
16769
+ refetchInterval: 3e4,
16770
+ queryFn: async () => {
16771
+ try {
16772
+ return await getFiatExchangeRates({}, publishableKey);
16773
+ } catch (error) {
16774
+ console.error("Error fetching fiat exchange rates:", error);
16775
+ return { base_currency: "usd", rates: {} };
16776
+ }
16777
+ }
16778
+ });
16779
+ const fiatExchangeRates = fiatExchangeRatesResponse?.rates ?? {};
16780
+ const convertAmountBetweenCurrencies = React52.useCallback(
16781
+ (rawAmount, fromCurrencyCode, toCurrencyCode) => {
16782
+ const parsedAmount = parseFloat(rawAmount);
16783
+ if (!Number.isFinite(parsedAmount) || parsedAmount <= 0) return null;
16784
+ const fromCode = fromCurrencyCode.toLowerCase();
16785
+ const toCode = toCurrencyCode.toLowerCase();
16786
+ const fromRate = fromCode === "usd" ? 1 : fiatExchangeRates[fromCode];
16787
+ const toRate = toCode === "usd" ? 1 : fiatExchangeRates[toCode];
16788
+ if (!Number.isFinite(fromRate) || fromRate <= 0) return null;
16789
+ if (!Number.isFinite(toRate) || toRate <= 0) return null;
16790
+ const usdAmount = parsedAmount / fromRate;
16791
+ return parseFloat((usdAmount * toRate).toFixed(2)).toString();
16792
+ },
16793
+ [fiatExchangeRates]
16794
+ );
16795
+ const getConvertedPrefilledAmount = React52.useCallback(
16796
+ (targetCurrencyCode) => {
16797
+ if (!parsedPrefilledAmountUsd) return null;
16798
+ const normalizedTargetCurrency = targetCurrencyCode.toLowerCase();
16799
+ const rate = normalizedTargetCurrency === "usd" ? 1 : fiatExchangeRates[normalizedTargetCurrency];
16800
+ if (!Number.isFinite(rate) || rate <= 0) return null;
16801
+ return parseFloat((parsedPrefilledAmountUsd * rate).toFixed(2)).toString();
16802
+ },
16803
+ [parsedPrefilledAmountUsd, fiatExchangeRates]
16804
+ );
16805
+ useEffect62(() => {
16806
+ if (!cleanedPrefilledAmountUsd || !shouldAutoConvertPrefilledRef.current) return;
16807
+ const convertedAmount = getConvertedPrefilledAmount(currency);
16808
+ if (!convertedAmount) {
16809
+ if (isFiatExchangeRatesLoading) return;
16810
+ const targetCurrency = currency.toLowerCase();
16811
+ if (targetCurrency !== "usd") {
16812
+ setCurrency("usd");
16813
+ }
16814
+ return;
16815
+ }
16816
+ setAmount(convertedAmount);
16817
+ setHasManualAmountEntry(true);
16818
+ }, [
16819
+ cleanedPrefilledAmountUsd,
16820
+ currency,
16821
+ getConvertedPrefilledAmount,
16822
+ isFiatExchangeRatesLoading
16823
+ ]);
16588
16824
  const depositWalletId = defaultToken ? getWalletByChainType(wallets, defaultToken.destination_token_metadata.chain_type)?.id : void 0;
16589
16825
  const { executions, isPolling, showWaitingUi } = useDepositPolling({
16590
16826
  userId,
@@ -16615,6 +16851,7 @@ function BuyWithCard({
16615
16851
  }, [publishableKey]);
16616
16852
  useEffect62(() => {
16617
16853
  if (hasManualCurrencySelection) return;
16854
+ if (hasManualAmountEntry && !shouldAutoConvertPrefilledRef.current) return;
16618
16855
  if (fiatCurrencies.length === 0 || !userIpInfo?.alpha2) return;
16619
16856
  const userCountryCode = userIpInfo.alpha2;
16620
16857
  const matchingCurrency = fiatCurrencies.find((c) => c.country_codes.includes(userCountryCode));
@@ -16633,7 +16870,15 @@ function BuyWithCard({
16633
16870
  const prevCurrencyRef = useRef22(null);
16634
16871
  useEffect62(() => {
16635
16872
  if (fiatCurrencies.length === 0) return;
16873
+ if (shouldAutoConvertPrefilledRef.current) {
16874
+ prevCurrencyRef.current = currency;
16875
+ return;
16876
+ }
16636
16877
  if (prevCurrencyRef.current !== null && prevCurrencyRef.current !== currency) {
16878
+ if (hasManualAmountEntry) {
16879
+ prevCurrencyRef.current = currency;
16880
+ return;
16881
+ }
16637
16882
  const currentCurrency = fiatCurrencies.find(
16638
16883
  (c) => c.currency_code.toLowerCase() === currency.toLowerCase()
16639
16884
  );
@@ -16642,7 +16887,7 @@ function BuyWithCard({
16642
16887
  }
16643
16888
  }
16644
16889
  prevCurrencyRef.current = currency;
16645
- }, [currency]);
16890
+ }, [currency, fiatCurrencies, hasManualAmountEntry]);
16646
16891
  useEffect62(() => {
16647
16892
  async function fetchDestinationToken() {
16648
16893
  try {
@@ -16819,6 +17064,7 @@ function BuyWithCard({
16819
17064
  return () => clearInterval(timer);
16820
17065
  }, [quotes.length, amount]);
16821
17066
  const handleAmountChange = (value) => {
17067
+ shouldAutoConvertPrefilledRef.current = false;
16822
17068
  if (value === "") {
16823
17069
  setAmount(value);
16824
17070
  setHasManualAmountEntry(true);
@@ -16832,6 +17078,7 @@ function BuyWithCard({
16832
17078
  }
16833
17079
  };
16834
17080
  const handleQuickAmount = (quickAmount) => {
17081
+ shouldAutoConvertPrefilledRef.current = false;
16835
17082
  setAmount(quickAmount.toString());
16836
17083
  setHasManualAmountEntry(true);
16837
17084
  };
@@ -17435,8 +17682,43 @@ function BuyWithCard({
17435
17682
  preferredCurrencyCodes,
17436
17683
  selectedCurrency: currency,
17437
17684
  onSelectCurrency: (currencyCode) => {
17438
- setCurrency(currencyCode.toLowerCase());
17685
+ const nextCurrency = currencyCode.toLowerCase();
17686
+ if (nextCurrency === currency.toLowerCase()) {
17687
+ setHasManualCurrencySelection(true);
17688
+ return;
17689
+ }
17690
+ const currentCurrency = currency;
17439
17691
  setHasManualCurrencySelection(true);
17692
+ if (shouldAutoConvertPrefilledRef.current) {
17693
+ const convertedAmount = getConvertedPrefilledAmount(nextCurrency);
17694
+ if (convertedAmount) {
17695
+ setCurrency(nextCurrency);
17696
+ setAmount(convertedAmount);
17697
+ setHasManualAmountEntry(true);
17698
+ } else {
17699
+ if (isFiatExchangeRatesLoading) return;
17700
+ const fallbackUsdAmount = getConvertedPrefilledAmount("usd");
17701
+ setCurrency("usd");
17702
+ if (fallbackUsdAmount) {
17703
+ setAmount(fallbackUsdAmount);
17704
+ setHasManualAmountEntry(true);
17705
+ }
17706
+ }
17707
+ return;
17708
+ }
17709
+ if (hasManualAmountEntry && amount) {
17710
+ const convertedAmount = convertAmountBetweenCurrencies(
17711
+ amount,
17712
+ currentCurrency,
17713
+ nextCurrency
17714
+ );
17715
+ if (convertedAmount) {
17716
+ setCurrency(nextCurrency);
17717
+ setAmount(convertedAmount);
17718
+ }
17719
+ return;
17720
+ }
17721
+ setCurrency(nextCurrency);
17440
17722
  },
17441
17723
  themeClass
17442
17724
  }
@@ -17489,7 +17771,7 @@ function useCoinbaseLegalAgreements({
17489
17771
  publishableKey,
17490
17772
  enabled = true
17491
17773
  }) {
17492
- return useQuery3({
17774
+ return useQuery4({
17493
17775
  queryKey: ["unifold", "coinbaseLegalAgreements", publishableKey],
17494
17776
  queryFn: () => getCoinbaseLegalAgreements(publishableKey),
17495
17777
  enabled: enabled && !!publishableKey,
@@ -17507,7 +17789,7 @@ function useApplePayLimits({
17507
17789
  enabled = true
17508
17790
  }) {
17509
17791
  const phoneValid = US_E164_REGEX.test(phone);
17510
- return useQuery4({
17792
+ return useQuery5({
17511
17793
  queryKey: ["unifold", "applePayLimits", phone, publishableKey],
17512
17794
  queryFn: ({ signal }) => getCoinbaseApplePayLimits(phone, publishableKey, signal),
17513
17795
  enabled: enabled && phoneValid && !!publishableKey,
@@ -17546,7 +17828,7 @@ function useApplePayInitialScreen({
17546
17828
  sessionPhoneVerified,
17547
17829
  isWaiting
17548
17830
  }) {
17549
- const initialStoredSession = useMemo22(() => getStoredApplePaySession(userId), [userId]);
17831
+ const initialStoredSession = useMemo32(() => getStoredApplePaySession(userId), [userId]);
17550
17832
  const phoneVerified = PHONE_REGEX.test(normalizedPhone) && (sessionPhoneVerified || initialStoredSession?.phone === normalizedPhone && !!initialStoredSession?.phoneVerifiedAt);
17551
17833
  const {
17552
17834
  data: applePayLimits,
@@ -17557,7 +17839,7 @@ function useApplePayInitialScreen({
17557
17839
  publishableKey,
17558
17840
  enabled: phoneVerified
17559
17841
  });
17560
- const action = useMemo22(() => {
17842
+ const action = useMemo32(() => {
17561
17843
  if (isWaiting || applePayLimitsLoading) return { kind: "pending" };
17562
17844
  const stored = initialStoredSession;
17563
17845
  const hasUserEmail = !!userEmail && EMAIL_REGEX.test(userEmail);
@@ -17607,7 +17889,7 @@ function useDefaultOnrampToken({
17607
17889
  isLoading,
17608
17890
  isError,
17609
17891
  error
17610
- } = useQuery5({
17892
+ } = useQuery6({
17611
17893
  queryKey: [
17612
17894
  "unifold",
17613
17895
  "defaultOnrampToken",
@@ -17681,7 +17963,7 @@ function parseCoinbasePostMessage(raw) {
17681
17963
  } : void 0
17682
17964
  };
17683
17965
  }
17684
- var BuyWithApplePay = React52.forwardRef(
17966
+ var BuyWithApplePay = React62.forwardRef(
17685
17967
  function BuyWithApplePay2({
17686
17968
  userId,
17687
17969
  publishableKey,
@@ -17752,7 +18034,7 @@ var BuyWithApplePay = React52.forwardRef(
17752
18034
  countryCode: userIpInfo?.alpha2,
17753
18035
  subdivisionCode: userIpInfo?.subdivisionCode ?? void 0
17754
18036
  });
17755
- const depositWallet = useMemo32(() => {
18037
+ const depositWallet = useMemo42(() => {
17756
18038
  const routingChainType = defaultToken?.destination_token_metadata?.chain_type;
17757
18039
  if (!routingChainType) return void 0;
17758
18040
  return getWalletByChainType(depositWallets ?? [], routingChainType);
@@ -17840,7 +18122,7 @@ var BuyWithApplePay = React52.forwardRef(
17840
18122
  popupRef.current = null;
17841
18123
  };
17842
18124
  }, []);
17843
- React52.useImperativeHandle(
18125
+ React62.useImperativeHandle(
17844
18126
  ref,
17845
18127
  () => ({
17846
18128
  requestBack: () => {
@@ -17882,9 +18164,9 @@ var BuyWithApplePay = React52.forwardRef(
17882
18164
  }),
17883
18165
  [view, emailLocked]
17884
18166
  );
17885
- const normalizedPhone = useMemo32(() => formatPhoneInput(phoneInput), [phoneInput]);
18167
+ const normalizedPhone = useMemo42(() => formatPhoneInput(phoneInput), [phoneInput]);
17886
18168
  const isContactValid = EMAIL_REGEX2.test(email) && PHONE_REGEX2.test(normalizedPhone);
17887
- const storeApplePaySession = useCallback10(
18169
+ const storeApplePaySession = useCallback22(
17888
18170
  (patch = {}) => {
17889
18171
  const session = {
17890
18172
  email,
@@ -17896,7 +18178,7 @@ var BuyWithApplePay = React52.forwardRef(
17896
18178
  },
17897
18179
  [email, normalizedPhone, userId]
17898
18180
  );
17899
- const createSessionAndSendOtp = useCallback10(async () => {
18181
+ const createSessionAndSendOtp = useCallback22(async () => {
17900
18182
  setView("submitting_session");
17901
18183
  setErrorMessage("");
17902
18184
  try {
@@ -17924,7 +18206,7 @@ var BuyWithApplePay = React52.forwardRef(
17924
18206
  setView("phone_input");
17925
18207
  }
17926
18208
  }, [email, normalizedPhone, publishableKey, storeApplePaySession]);
17927
- const clearUpgradeFields = useCallback10(() => {
18209
+ const clearUpgradeFields = useCallback22(() => {
17928
18210
  setSsnLast4("");
17929
18211
  setDobInput("");
17930
18212
  }, []);
@@ -17936,7 +18218,7 @@ var BuyWithApplePay = React52.forwardRef(
17936
18218
  sessionPhoneVerified: verificationSession?.phone?.status === "verified",
17937
18219
  isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
17938
18220
  });
17939
- const pollLimitUpgradeStatus = useCallback10(
18221
+ const pollLimitUpgradeStatus = useCallback22(
17940
18222
  async (signal) => {
17941
18223
  const POLL_INTERVAL_MS4 = 1500;
17942
18224
  const POLL_TIMEOUT_MS = 3e4;
@@ -17998,7 +18280,7 @@ var BuyWithApplePay = React52.forwardRef(
17998
18280
  clearUpgradeFields
17999
18281
  ]
18000
18282
  );
18001
- const startUpgradePolling = useCallback10(async () => {
18283
+ const startUpgradePolling = useCallback22(async () => {
18002
18284
  upgradeFlowAbortRef.current?.abort();
18003
18285
  const controller = new AbortController();
18004
18286
  upgradeFlowAbortRef.current = controller;
@@ -18010,7 +18292,7 @@ var BuyWithApplePay = React52.forwardRef(
18010
18292
  }
18011
18293
  }
18012
18294
  }, [pollLimitUpgradeStatus]);
18013
- const applyLimitRouting = useCallback10(
18295
+ const applyLimitRouting = useCallback22(
18014
18296
  (nextView, status) => {
18015
18297
  if (nextView === "limit_upgrade_form" && status === "resubmit") {
18016
18298
  setLimitUpgradeError(
@@ -18047,11 +18329,11 @@ var BuyWithApplePay = React52.forwardRef(
18047
18329
  break;
18048
18330
  }
18049
18331
  }, [initialAction, applyLimitRouting, createSessionAndSendOtp]);
18050
- const startVerification = useCallback10(async () => {
18332
+ const startVerification = useCallback22(async () => {
18051
18333
  if (!isContactValid) return;
18052
18334
  await createSessionAndSendOtp();
18053
18335
  }, [isContactValid, createSessionAndSendOtp]);
18054
- const submitLimitUpgrade = useCallback10(async () => {
18336
+ const submitLimitUpgrade = useCallback22(async () => {
18055
18337
  if (upgradeSubmitting) return;
18056
18338
  try {
18057
18339
  const dob = parseDobInput(dobInput);
@@ -18101,7 +18383,7 @@ var BuyWithApplePay = React52.forwardRef(
18101
18383
  startUpgradePolling,
18102
18384
  clearUpgradeFields
18103
18385
  ]);
18104
- const submitPhoneOtp = useCallback10(async () => {
18386
+ const submitPhoneOtp = useCallback22(async () => {
18105
18387
  if (!verificationSession || !clientSecret || phoneCode.length !== 6) return;
18106
18388
  if (otpSubmitting) return;
18107
18389
  setOtpError(null);
@@ -18169,7 +18451,7 @@ var BuyWithApplePay = React52.forwardRef(
18169
18451
  getViewForLimitStatus,
18170
18452
  applyLimitRouting
18171
18453
  ]);
18172
- const prepareSession = useCallback10(
18454
+ const prepareSession = useCallback22(
18173
18455
  async (token, amt) => {
18174
18456
  setErrorMessage("");
18175
18457
  if (!destinationChainType || !destinationChainId) {
@@ -19150,7 +19432,7 @@ function LegalDisclaimer({ legalAgreements, loading }) {
19150
19432
  children: [
19151
19433
  "By continuing, you agree to Coinbase's",
19152
19434
  " ",
19153
- agreements.map((a, idx, arr) => /* @__PURE__ */ jsxs11(React52.Fragment, { children: [
19435
+ agreements.map((a, idx, arr) => /* @__PURE__ */ jsxs11(React62.Fragment, { children: [
19154
19436
  /* @__PURE__ */ jsx132(
19155
19437
  "a",
19156
19438
  {
@@ -19466,7 +19748,7 @@ function QRCodeSkeleton({ size: size4 = 180, darkMode = false }) {
19466
19748
  const spacing = size4 / gridCount;
19467
19749
  const fillColor = darkMode ? "rgba(255,255,255,0.10)" : "rgba(0,0,0,0.08)";
19468
19750
  const cornerColor = darkMode ? "rgba(255,255,255,0.14)" : "rgba(0,0,0,0.12)";
19469
- const dots = useMemo42(() => {
19751
+ const dots = useMemo52(() => {
19470
19752
  const result = [];
19471
19753
  const cornerSize = 7;
19472
19754
  const centerStart = Math.floor(gridCount / 2) - 2;
@@ -19566,7 +19848,7 @@ function useIsMobileViewport() {
19566
19848
  return isMobile;
19567
19849
  }
19568
19850
  function useCashAppLimits({ publishableKey, currency = "usd" }) {
19569
- return useQuery6({
19851
+ return useQuery7({
19570
19852
  queryKey: ["unifold", "cashAppLimits", currency, publishableKey],
19571
19853
  queryFn: () => getCashAppLimits(currency, publishableKey),
19572
19854
  enabled: !!publishableKey,
@@ -19579,6 +19861,7 @@ var POLL_INTERVAL_MS2 = 5e3;
19579
19861
  var FALLBACK_MIN_USD = 5;
19580
19862
  var SUGGESTED_AMOUNTS = [25, 50, 100];
19581
19863
  var t3 = i18n2.depositModal.cashApp;
19864
+ var sanitizePrefilledUsd = (value) => value?.replace(/[^0-9.]/g, "") ?? "";
19582
19865
  function PayWithCashApp({
19583
19866
  userId,
19584
19867
  publishableKey,
@@ -19593,6 +19876,7 @@ function PayWithCashApp({
19593
19876
  onEvent,
19594
19877
  onDepositSuccess,
19595
19878
  onDepositError,
19879
+ prefilledAmountUsd,
19596
19880
  wallets = []
19597
19881
  }) {
19598
19882
  const { colors: colors2, fonts, components } = useTheme();
@@ -19608,14 +19892,14 @@ function PayWithCashApp({
19608
19892
  const { data: limits, isLoading: limitsLoading } = useCashAppLimits({ publishableKey });
19609
19893
  const minUsd = limits?.minimum_amount ?? FALLBACK_MIN_USD;
19610
19894
  const maxUsd = limits?.maximum_amount ?? null;
19611
- const [amount, setAmount] = useState152("");
19895
+ const [amount, setAmount] = useState152(() => sanitizePrefilledUsd(prefilledAmountUsd));
19612
19896
  const [loading, setLoading] = useState152(false);
19613
19897
  const [session, setSession] = useState152(null);
19614
19898
  const [status, setStatus] = useState152("pending");
19615
19899
  const [error, setError] = useState152(null);
19616
19900
  const [copied, setCopied] = useState152(false);
19617
19901
  const [view, setViewInternal] = useState152(controlledView ?? "amount");
19618
- const setView = useCallback22(
19902
+ const setView = useCallback32(
19619
19903
  (v) => {
19620
19904
  setViewInternal(v);
19621
19905
  onViewChange?.(v);
@@ -19645,7 +19929,7 @@ function PayWithCashApp({
19645
19929
  onDepositSuccess,
19646
19930
  onDepositError
19647
19931
  });
19648
- const handleAmountChange = useCallback22(
19932
+ const handleAmountChange = useCallback32(
19649
19933
  (raw) => {
19650
19934
  const cleaned = raw.replace(/[^0-9.]/g, "");
19651
19935
  const parts = cleaned.split(".");
@@ -19657,7 +19941,7 @@ function PayWithCashApp({
19657
19941
  },
19658
19942
  [onAmountChange]
19659
19943
  );
19660
- const handleCreateSession = useCallback22(async () => {
19944
+ const handleCreateSession = useCallback32(async () => {
19661
19945
  if (!amount || !recipientAddress || !destinationChainType || !destinationChainId || !destinationTokenAddress) {
19662
19946
  setError("Missing required fields");
19663
19947
  return;
@@ -19731,6 +20015,13 @@ function PayWithCashApp({
19731
20015
  return () => clearInterval(interval);
19732
20016
  }, [session, view, status, publishableKey, onDepositSuccess, onDepositError]);
19733
20017
  const [softExpired, setSoftExpired] = useState152(false);
20018
+ useEffect102(() => {
20019
+ if (!prefilledAmountUsd) return;
20020
+ const cleaned = sanitizePrefilledUsd(prefilledAmountUsd);
20021
+ if (!cleaned) return;
20022
+ setAmount(cleaned);
20023
+ onAmountChange?.(cleaned);
20024
+ }, [prefilledAmountUsd, onAmountChange]);
19734
20025
  useEffect102(() => {
19735
20026
  if (!session?.expires_at || view !== "payment") return;
19736
20027
  const expiresMs = new Date(session.expires_at).getTime();
@@ -19745,12 +20036,12 @@ function PayWithCashApp({
19745
20036
  const interval = setInterval(tick, 1e3);
19746
20037
  return () => clearInterval(interval);
19747
20038
  }, [session, view, status]);
19748
- const handleCopy = useCallback22(async (text) => {
20039
+ const handleCopy = useCallback32(async (text) => {
19749
20040
  await navigator.clipboard.writeText(text);
19750
20041
  setCopied(true);
19751
20042
  setTimeout(() => setCopied(false), 2e3);
19752
20043
  }, []);
19753
- const handleRecreate = useCallback22(() => {
20044
+ const handleRecreate = useCallback32(() => {
19754
20045
  setSession(null);
19755
20046
  setStatus("pending");
19756
20047
  setError(null);
@@ -20085,7 +20376,7 @@ function useBankTransferProviders({
20085
20376
  countryCode
20086
20377
  }) {
20087
20378
  const normalizedCountry = countryCode?.toUpperCase();
20088
- const { data: providers, isLoading } = useQuery7({
20379
+ const { data: providers, isLoading } = useQuery8({
20089
20380
  queryKey: ["unifold", "bankTransferProviders", publishableKey, normalizedCountry ?? null],
20090
20381
  queryFn: () => getBankTransferProviders(publishableKey, { countryCode: normalizedCountry }),
20091
20382
  enabled,
@@ -20123,7 +20414,8 @@ function BankTransfer({
20123
20414
  assetCdnUrl,
20124
20415
  onDepositSuccess,
20125
20416
  onEvent,
20126
- onDepositError
20417
+ onDepositError,
20418
+ prefilledAmountUsd
20127
20419
  }) {
20128
20420
  const { colors: colors2, fonts, components } = useTheme();
20129
20421
  const [internalView, setInternalView] = useState162("providers");
@@ -20133,6 +20425,10 @@ function BankTransfer({
20133
20425
  const [requestBase, setRequestBase] = useState162(null);
20134
20426
  const [activeRequest, setActiveRequest] = useState162(null);
20135
20427
  const [amount, setAmount] = useState162("");
20428
+ const [fiatExchangeRates, setFiatExchangeRates] = useState162({
20429
+ usd: 1
20430
+ });
20431
+ const providerSelectionRequestIdRef = useRef52(0);
20136
20432
  const currentView = externalView ?? internalView;
20137
20433
  const setView = (v) => {
20138
20434
  setInternalView(v);
@@ -20157,7 +20453,7 @@ function BankTransfer({
20157
20453
  countryCode: userIpInfo?.alpha2
20158
20454
  });
20159
20455
  const providers = providersResponse?.data ?? [];
20160
- const pollingWalletId = useMemo52(() => {
20456
+ const pollingWalletId = useMemo62(() => {
20161
20457
  if (!defaultToken) return void 0;
20162
20458
  return getWalletByChainType(
20163
20459
  wallets,
@@ -20178,11 +20474,42 @@ function BankTransfer({
20178
20474
  const currencySymbol = getCurrencySymbol2(sourceCurrency);
20179
20475
  const parsedAmount = parseFloat(amount);
20180
20476
  const amountValid = !!amount && Number.isFinite(parsedAmount) && parsedAmount >= MIN_AMOUNT;
20181
- const displayTokenSymbol = useMemo52(
20477
+ const displayTokenSymbol = useMemo62(
20182
20478
  () => destinationTokenSymbol?.toUpperCase() ?? defaultToken?.destination_token_metadata?.symbol?.toUpperCase() ?? defaultToken?.destination_currency?.toUpperCase() ?? "USDC",
20183
20479
  [destinationTokenSymbol, defaultToken]
20184
20480
  );
20185
- const handleProviderClick = (provider) => {
20481
+ const resolvePrefilledSourceAmount = useCallback42(
20482
+ async (sourceCurrencyCode) => {
20483
+ const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
20484
+ if (!cleanedPrefilled) return "";
20485
+ const prefilledUsd = parseFloat(cleanedPrefilled);
20486
+ if (!Number.isFinite(prefilledUsd) || prefilledUsd <= 0) return "";
20487
+ const sourceCurrency2 = sourceCurrencyCode.toLowerCase();
20488
+ let rate = sourceCurrency2 === "usd" ? 1 : fiatExchangeRates[sourceCurrency2];
20489
+ if ((!rate || rate <= 0) && sourceCurrency2 !== "usd") {
20490
+ try {
20491
+ const response = await getFiatExchangeRates({}, publishableKey);
20492
+ if (response?.rates) {
20493
+ setFiatExchangeRates((prev) => ({
20494
+ ...prev,
20495
+ ...response.rates,
20496
+ usd: 1
20497
+ }));
20498
+ }
20499
+ const fetchedRate = response.rates?.[sourceCurrency2];
20500
+ if (Number.isFinite(fetchedRate) && fetchedRate > 0) {
20501
+ rate = fetchedRate;
20502
+ }
20503
+ } catch (error) {
20504
+ console.error("Error fetching fiat exchange rates for bank transfer:", error);
20505
+ }
20506
+ }
20507
+ if (!rate || rate <= 0) return sourceCurrency2 === "usd" ? cleanedPrefilled : "";
20508
+ return parseFloat((prefilledUsd * rate).toFixed(2)).toString();
20509
+ },
20510
+ [fiatExchangeRates, prefilledAmountUsd, publishableKey]
20511
+ );
20512
+ const handleProviderClick = async (provider) => {
20186
20513
  if (!provider.enabled) return;
20187
20514
  setSessionError(null);
20188
20515
  if (!defaultToken) {
@@ -20201,6 +20528,7 @@ function BankTransfer({
20201
20528
  });
20202
20529
  return;
20203
20530
  }
20531
+ const requestId = ++providerSelectionRequestIdRef.current;
20204
20532
  setRequestBase({
20205
20533
  service_provider: provider.service_provider,
20206
20534
  country_code: (userIpInfo?.alpha2 || "DE").toUpperCase(),
@@ -20214,7 +20542,10 @@ function BankTransfer({
20214
20542
  payment_method: provider.payment_methods[0]
20215
20543
  });
20216
20544
  setActiveProvider(provider);
20217
- setAmount("100");
20545
+ const convertedPrefilled = await resolvePrefilledSourceAmount(provider.source_currency);
20546
+ if (requestId !== providerSelectionRequestIdRef.current) return;
20547
+ const hasPrefilledAmount = !!prefilledAmountUsd?.replace(/[^0-9.]/g, "");
20548
+ setAmount(hasPrefilledAmount ? convertedPrefilled : "100");
20218
20549
  setView("amount");
20219
20550
  };
20220
20551
  const handleAmountChange = (value) => {
@@ -20312,7 +20643,7 @@ function BankTransfer({
20312
20643
  return /* @__PURE__ */ jsxs15(
20313
20644
  "button",
20314
20645
  {
20315
- onClick: () => handleProviderClick(provider),
20646
+ onClick: () => void handleProviderClick(provider),
20316
20647
  onMouseEnter: () => !disabled && setHoveredId(provider.service_provider),
20317
20648
  onMouseLeave: () => setHoveredId(null),
20318
20649
  disabled,
@@ -20881,9 +21212,9 @@ function TransferCryptoButton({
20881
21212
  featuredTokens
20882
21213
  }) {
20883
21214
  const { colors: colors2, fonts, components } = useTheme();
20884
- const [isHovered, setIsHovered] = React62.useState(false);
20885
- const [isTouchDevice, setIsTouchDevice] = React62.useState(false);
20886
- React62.useEffect(() => {
21215
+ const [isHovered, setIsHovered] = React72.useState(false);
21216
+ const [isTouchDevice, setIsTouchDevice] = React72.useState(false);
21217
+ React72.useEffect(() => {
20887
21218
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
20888
21219
  }, []);
20889
21220
  const sortedTokens = featuredTokens ? [...featuredTokens].sort((a, b) => a.position - b.position) : [];
@@ -20963,9 +21294,9 @@ function DepositWithCardButton({
20963
21294
  paymentNetworks
20964
21295
  }) {
20965
21296
  const { colors: colors2, fonts, components } = useTheme();
20966
- const [isHovered, setIsHovered] = React72.useState(false);
20967
- const [isTouchDevice, setIsTouchDevice] = React72.useState(false);
20968
- React72.useEffect(() => {
21297
+ const [isHovered, setIsHovered] = React82.useState(false);
21298
+ const [isTouchDevice, setIsTouchDevice] = React82.useState(false);
21299
+ React82.useEffect(() => {
20969
21300
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
20970
21301
  }, []);
20971
21302
  return /* @__PURE__ */ jsxs18(
@@ -21044,9 +21375,9 @@ function PayWithExchangeButton({
21044
21375
  loading = false
21045
21376
  }) {
21046
21377
  const { colors: colors2, fonts, components } = useTheme();
21047
- const [isHovered, setIsHovered] = React82.useState(false);
21048
- const [isTouchDevice, setIsTouchDevice] = React82.useState(false);
21049
- React82.useEffect(() => {
21378
+ const [isHovered, setIsHovered] = React92.useState(false);
21379
+ const [isTouchDevice, setIsTouchDevice] = React92.useState(false);
21380
+ React92.useEffect(() => {
21050
21381
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
21051
21382
  }, []);
21052
21383
  if (loading) {
@@ -21148,11 +21479,11 @@ var buttonVariants = cva(
21148
21479
  }
21149
21480
  }
21150
21481
  );
21151
- var Button = React92.forwardRef(
21482
+ var Button = React102.forwardRef(
21152
21483
  ({ className, variant, size: size4, asChild = false, style, ...props }, ref) => {
21153
21484
  const Comp = asChild ? Slot2 : "button";
21154
21485
  const { components, fonts } = useTheme();
21155
- const themeStyle = React92.useMemo(() => {
21486
+ const themeStyle = React102.useMemo(() => {
21156
21487
  const baseStyle = { ...style };
21157
21488
  if (variant === "default" || !variant) {
21158
21489
  baseStyle.backgroundColor = components.button.primaryBackground;
@@ -21187,9 +21518,9 @@ function ConnectExchangeButton({
21187
21518
  connectedExchange
21188
21519
  }) {
21189
21520
  const { colors: colors2, fonts, components } = useTheme();
21190
- const [isHovered, setIsHovered] = React102.useState(false);
21191
- const [isTouchDevice, setIsTouchDevice] = React102.useState(false);
21192
- React102.useEffect(() => {
21521
+ const [isHovered, setIsHovered] = React112.useState(false);
21522
+ const [isTouchDevice, setIsTouchDevice] = React112.useState(false);
21523
+ React112.useEffect(() => {
21193
21524
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
21194
21525
  }, []);
21195
21526
  const isConnected = connectedExchange != null;
@@ -21334,9 +21665,9 @@ function DepositTrackerButton({
21334
21665
  badge
21335
21666
  }) {
21336
21667
  const { colors: colors2, fonts, components } = useTheme();
21337
- const [isHovered, setIsHovered] = React112.useState(false);
21338
- const [isTouchDevice, setIsTouchDevice] = React112.useState(false);
21339
- React112.useEffect(() => {
21668
+ const [isHovered, setIsHovered] = React122.useState(false);
21669
+ const [isTouchDevice, setIsTouchDevice] = React122.useState(false);
21670
+ React122.useEffect(() => {
21340
21671
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
21341
21672
  }, []);
21342
21673
  return /* @__PURE__ */ jsxs21(
@@ -21407,9 +21738,9 @@ function DepositTrackerButton({
21407
21738
  }
21408
21739
  function CashAppButton({ onClick, title, subtitle, iconUrl }) {
21409
21740
  const { colors: colors2, fonts, components } = useTheme();
21410
- const [isHovered, setIsHovered] = React122.useState(false);
21411
- const [isTouchDevice, setIsTouchDevice] = React122.useState(false);
21412
- React122.useEffect(() => {
21741
+ const [isHovered, setIsHovered] = React132.useState(false);
21742
+ const [isTouchDevice, setIsTouchDevice] = React132.useState(false);
21743
+ React132.useEffect(() => {
21413
21744
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
21414
21745
  }, []);
21415
21746
  return /* @__PURE__ */ jsxs222(
@@ -21491,11 +21822,11 @@ function AppleLogo({ className, style }) {
21491
21822
  }
21492
21823
  );
21493
21824
  }
21494
- function ApplePayButton({ onClick, title, subtitle }) {
21825
+ function ApplePayButton({ onClick, title, subtitle, iconUrl }) {
21495
21826
  const { colors: colors2, fonts, components } = useTheme();
21496
- const [isHovered, setIsHovered] = React132.useState(false);
21497
- const [isTouchDevice, setIsTouchDevice] = React132.useState(false);
21498
- React132.useEffect(() => {
21827
+ const [isHovered, setIsHovered] = React142.useState(false);
21828
+ const [isTouchDevice, setIsTouchDevice] = React142.useState(false);
21829
+ React142.useEffect(() => {
21499
21830
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
21500
21831
  }, []);
21501
21832
  return /* @__PURE__ */ jsxs23(
@@ -21513,7 +21844,14 @@ function ApplePayButton({ onClick, title, subtitle }) {
21513
21844
  },
21514
21845
  children: [
21515
21846
  /* @__PURE__ */ jsxs23("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
21516
- /* @__PURE__ */ jsx26("div", { className: "uf-rounded-lg uf-p-2", children: /* @__PURE__ */ jsx26(AppleLogo, { className: "uf-w-5 uf-h-5", style: { color: components.card.iconColor } }) }),
21847
+ /* @__PURE__ */ jsx26("div", { className: "uf-rounded-lg uf-overflow-hidden uf-w-9 uf-h-9 uf-flex uf-items-center uf-justify-center", children: iconUrl ? /* @__PURE__ */ jsx26("img", { src: iconUrl, alt: "Apple Pay", width: 36, height: 36, className: "uf-rounded-lg" }) : /* @__PURE__ */ jsx26(
21848
+ "div",
21849
+ {
21850
+ className: "uf-w-9 uf-h-9 uf-rounded-lg uf-flex uf-items-center uf-justify-center",
21851
+ style: { backgroundColor: "#000" },
21852
+ children: /* @__PURE__ */ jsx26(AppleLogo, { className: "uf-w-5 uf-h-5", style: { color: "#fff" } })
21853
+ }
21854
+ ) }),
21517
21855
  /* @__PURE__ */ jsxs23("div", { className: "uf-text-left", children: [
21518
21856
  /* @__PURE__ */ jsx26(
21519
21857
  "div",
@@ -21557,9 +21895,9 @@ function BankTransferButton({
21557
21895
  comingSoon = false
21558
21896
  }) {
21559
21897
  const { colors: colors2, fonts, components } = useTheme();
21560
- const [isHovered, setIsHovered] = React142.useState(false);
21561
- const [isTouchDevice, setIsTouchDevice] = React142.useState(false);
21562
- React142.useEffect(() => {
21898
+ const [isHovered, setIsHovered] = React152.useState(false);
21899
+ const [isTouchDevice, setIsTouchDevice] = React152.useState(false);
21900
+ React152.useEffect(() => {
21563
21901
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
21564
21902
  }, []);
21565
21903
  return /* @__PURE__ */ jsxs24(
@@ -21729,13 +22067,6 @@ function solanaCandidate(provider, type, name, icon) {
21729
22067
  if (provider.isConnected && provider.publicKey) {
21730
22068
  return { type, name, address: provider.publicKey.toString(), icon };
21731
22069
  }
21732
- try {
21733
- const resp = await provider.connect({ onlyIfTrusted: true });
21734
- if (resp.publicKey) {
21735
- return { type, name, address: resp.publicKey.toString(), icon };
21736
- }
21737
- } catch {
21738
- }
21739
22070
  return null;
21740
22071
  }
21741
22072
  };
@@ -21808,18 +22139,18 @@ async function detectConnectedBrowserWallet(chainType) {
21808
22139
  }
21809
22140
  function useDetectedBrowserWallet(opts = {}) {
21810
22141
  const { chainType, enabled = true, onDisconnect } = opts;
21811
- const [wallet, setWallet] = React152.useState(null);
21812
- const [isLoading, setIsLoading] = React152.useState(enabled);
21813
- const [eip6963ProviderCount, setEip6963ProviderCount] = React152.useState(0);
21814
- const onDisconnectRef = React152.useRef(onDisconnect);
22142
+ const [wallet, setWallet] = React162.useState(null);
22143
+ const [isLoading, setIsLoading] = React162.useState(enabled);
22144
+ const [eip6963ProviderCount, setEip6963ProviderCount] = React162.useState(0);
22145
+ const onDisconnectRef = React162.useRef(onDisconnect);
21815
22146
  onDisconnectRef.current = onDisconnect;
21816
- React152.useEffect(() => {
22147
+ React162.useEffect(() => {
21817
22148
  const store = getEip6963Store();
21818
22149
  if (!store) return;
21819
22150
  setEip6963ProviderCount(store.getProviders().length);
21820
22151
  return store.subscribe((providers) => setEip6963ProviderCount(providers.length));
21821
22152
  }, []);
21822
- React152.useEffect(() => {
22153
+ React162.useEffect(() => {
21823
22154
  if (!enabled) {
21824
22155
  setWallet(null);
21825
22156
  setIsLoading(false);
@@ -21959,8 +22290,180 @@ async function disconnectInjectedBrowserWallet(wallet) {
21959
22290
  collectEthereumProvidersForDisconnect(window)
21960
22291
  );
21961
22292
  }
22293
+ var STORED_TYPE_TO_EIP6963_WALLET_ID = {
22294
+ metamask: "metamask",
22295
+ "phantom-ethereum": "phantom",
22296
+ coinbase: "coinbase",
22297
+ trust: "trust",
22298
+ rainbow: "rainbow",
22299
+ rabby: "rabby",
22300
+ okx: "okx"
22301
+ };
22302
+ var EIP6963_WALLET_ID_TO_INFO = {
22303
+ metamask: { walletType: "metamask", name: "MetaMask", icon: "metamask" },
22304
+ phantom: { walletType: "phantom-ethereum", name: "Phantom", icon: "phantom" },
22305
+ coinbase: { walletType: "coinbase", name: "Coinbase Wallet", icon: "coinbase" },
22306
+ trust: { walletType: "trust", name: "Trust Wallet", icon: "trust" },
22307
+ rainbow: { walletType: "rainbow", name: "Rainbow", icon: "rainbow" },
22308
+ rabby: { walletType: "rabby", name: "Rabby", icon: "rabby" },
22309
+ okx: { walletType: "okx", name: "OKX Wallet", icon: "okx" }
22310
+ };
22311
+ var WALLET_ID_TO_WALLET_TYPE = {
22312
+ phantom: "phantom-ethereum",
22313
+ coinbase: "coinbase",
22314
+ trust: "trust",
22315
+ rainbow: "rainbow",
22316
+ rabby: "rabby",
22317
+ okx: "okx",
22318
+ metamask: "metamask"
22319
+ };
22320
+ var WALLET_TYPE_TO_WALLET_ID = {
22321
+ "phantom-ethereum": "phantom",
22322
+ coinbase: "coinbase",
22323
+ trust: "trust",
22324
+ okx: "okx",
22325
+ rainbow: "rainbow",
22326
+ rabby: "rabby",
22327
+ metamask: "metamask"
22328
+ };
22329
+ function isWalletType(value) {
22330
+ return value === "phantom-solana" || value === "phantom-ethereum" || value === "metamask" || value === "coinbase" || value === "solflare" || value === "backpack" || value === "glow" || value === "trust" || value === "rainbow" || value === "rabby" || value === "okx";
22331
+ }
22332
+ function walletIdToWalletType(walletId) {
22333
+ return WALLET_ID_TO_WALLET_TYPE[walletId] || "metamask";
22334
+ }
22335
+ function walletTypeToWalletId(walletType) {
22336
+ return WALLET_TYPE_TO_WALLET_ID[walletType] || walletType;
22337
+ }
22338
+ function getLegacyEvmProviders(win) {
22339
+ if (!win) return {};
22340
+ const anyWin = win;
22341
+ return {
22342
+ ethereum: anyWin.ethereum,
22343
+ phantomEthereum: anyWin.phantom?.ethereum,
22344
+ coinbaseEthereum: anyWin.coinbaseWalletExtension,
22345
+ trustEthereum: anyWin.trustwallet?.ethereum,
22346
+ okxEthereum: anyWin.okxwallet
22347
+ };
22348
+ }
22349
+ function getInjectedSolanaProviders(win) {
22350
+ if (!win) return {};
22351
+ const anyWin = win;
22352
+ return {
22353
+ phantomSolana: anyWin.phantom?.solana,
22354
+ solflare: anyWin.solflare,
22355
+ backpack: anyWin.backpack,
22356
+ glow: anyWin.glow,
22357
+ coinbaseSolana: anyWin.coinbaseSolana || anyWin.coinbaseWalletExtension?.solana,
22358
+ trustSolana: anyWin.trustwallet?.solana
22359
+ };
22360
+ }
22361
+ function describeEip6963Provider(wp) {
22362
+ const mapped = EIP6963_WALLET_ID_TO_INFO[wp.walletId];
22363
+ return {
22364
+ provider: wp.provider,
22365
+ walletType: mapped?.walletType ?? "metamask",
22366
+ name: mapped?.name ?? wp.info.name,
22367
+ icon: mapped?.icon ?? wp.info.icon
22368
+ };
22369
+ }
22370
+ function resolveQuickConnectEvmProvider(win) {
22371
+ const eip6963Providers = getEip6963Providers();
22372
+ if (eip6963Providers.length > 0) {
22373
+ const stored = getStoredWalletState();
22374
+ const preferredWalletId = stored?.walletType && isWalletType(stored.walletType) ? STORED_TYPE_TO_EIP6963_WALLET_ID[stored.walletType] : void 0;
22375
+ if (preferredWalletId) {
22376
+ const preferred = findProviderByWalletId(preferredWalletId);
22377
+ if (preferred) return describeEip6963Provider(preferred);
22378
+ }
22379
+ if (eip6963Providers.length === 1) {
22380
+ return describeEip6963Provider(eip6963Providers[0]);
22381
+ }
22382
+ return void 0;
22383
+ }
22384
+ const anyWin = win;
22385
+ const legacy = anyWin.phantom?.ethereum || anyWin.ethereum;
22386
+ if (!legacy) return void 0;
22387
+ const isPhantom = legacy.isPhantom;
22388
+ return {
22389
+ provider: legacy,
22390
+ walletType: isPhantom ? "phantom-ethereum" : "metamask",
22391
+ name: isPhantom ? "Phantom" : "MetaMask",
22392
+ icon: isPhantom ? "phantom" : "metamask"
22393
+ };
22394
+ }
22395
+ function resolveSolanaPublicKey(provider, response) {
22396
+ if (response?.publicKey) return { publicKey: response.publicKey };
22397
+ if (provider.publicKey) return { publicKey: provider.publicKey };
22398
+ return null;
22399
+ }
22400
+ function isUserRejectedSolanaConnectError(error) {
22401
+ if (!error || typeof error !== "object") return false;
22402
+ const maybeCode = "code" in error ? error.code : void 0;
22403
+ if (maybeCode === 4001) return true;
22404
+ const msg = "message" in error && typeof error.message === "string" ? error.message.toLowerCase() : "";
22405
+ return msg.includes("user rejected") || msg.includes("user denied") || msg.includes("rejected the request") || msg.includes("declined");
22406
+ }
22407
+ function isSolanaConnectTimeoutError(error) {
22408
+ return error instanceof Error && error.message.toLowerCase().includes("did not respond to the connection request");
22409
+ }
22410
+ async function connectSolanaProviderWithRecovery(provider, walletId, walletName) {
22411
+ if (provider.isConnected && provider.publicKey) {
22412
+ return { publicKey: provider.publicKey };
22413
+ }
22414
+ const connectOnce = () => provider.connect(walletId === "solflare" ? { onlyIfTrusted: false } : void 0);
22415
+ const withTimeout = async (ms = 2e4) => await Promise.race([
22416
+ connectOnce(),
22417
+ new Promise(
22418
+ (resolve, reject) => setTimeout(() => {
22419
+ const connected = resolveSolanaPublicKey(provider);
22420
+ if (connected) {
22421
+ resolve(connected);
22422
+ return;
22423
+ }
22424
+ reject(
22425
+ new Error(
22426
+ `${walletName} did not respond to the connection request. Please unlock the wallet and try again.`
22427
+ )
22428
+ );
22429
+ }, ms)
22430
+ )
22431
+ ]);
22432
+ if (walletId === "solflare") {
22433
+ await provider.disconnect?.().catch(() => {
22434
+ });
22435
+ }
22436
+ const connectAndResolve = async () => {
22437
+ try {
22438
+ const response = await withTimeout();
22439
+ const resolved = resolveSolanaPublicKey(provider, response);
22440
+ if (resolved) return resolved;
22441
+ await new Promise((resolve) => setTimeout(resolve, 120));
22442
+ const delayedResolved = resolveSolanaPublicKey(provider);
22443
+ if (delayedResolved) return delayedResolved;
22444
+ throw new Error(`${walletName} connected but did not expose a public key.`);
22445
+ } catch (error) {
22446
+ const connected = resolveSolanaPublicKey(provider);
22447
+ if (connected) return connected;
22448
+ throw error;
22449
+ }
22450
+ };
22451
+ try {
22452
+ return await connectAndResolve();
22453
+ } catch (err) {
22454
+ if (isUserRejectedSolanaConnectError(err)) throw err;
22455
+ if (isSolanaConnectTimeoutError(err)) throw err;
22456
+ if (walletId === "solflare") {
22457
+ await provider.disconnect?.().catch(() => {
22458
+ });
22459
+ await new Promise((resolve) => setTimeout(resolve, 150));
22460
+ return await connectAndResolve();
22461
+ }
22462
+ throw err;
22463
+ }
22464
+ }
21962
22465
  function MetamaskIcon({ size: size4 = 24, className, variant = "color" }) {
21963
- const id = React162.useId();
22466
+ const id = React172.useId();
21964
22467
  if (variant === "light" || variant === "dark") {
21965
22468
  return /* @__PURE__ */ jsxs25(
21966
22469
  "svg",
@@ -22081,7 +22584,7 @@ function MetamaskIcon({ size: size4 = 24, className, variant = "color" }) {
22081
22584
  );
22082
22585
  }
22083
22586
  function PhantomIcon({ size: size4 = 24, className, variant = "color" }) {
22084
- const id = React172.useId();
22587
+ const id = React182.useId();
22085
22588
  if (variant === "light") {
22086
22589
  return /* @__PURE__ */ jsx29(
22087
22590
  "svg",
@@ -22148,7 +22651,7 @@ function PhantomIcon({ size: size4 = 24, className, variant = "color" }) {
22148
22651
  );
22149
22652
  }
22150
22653
  function CoinbaseIcon({ size: size4 = 24, className, variant = "color" }) {
22151
- const id = React182.useId();
22654
+ const id = React192.useId();
22152
22655
  if (variant === "light") {
22153
22656
  return /* @__PURE__ */ jsxs27(
22154
22657
  "svg",
@@ -22228,7 +22731,7 @@ function CoinbaseIcon({ size: size4 = 24, className, variant = "color" }) {
22228
22731
  );
22229
22732
  }
22230
22733
  function RabbyIcon({ size: size4 = 24, className, variant = "color" }) {
22231
- const id = React192.useId();
22734
+ const id = React202.useId();
22232
22735
  if (variant === "light") {
22233
22736
  return /* @__PURE__ */ jsxs28(
22234
22737
  "svg",
@@ -22575,7 +23078,7 @@ function RabbyIcon({ size: size4 = 24, className, variant = "color" }) {
22575
23078
  );
22576
23079
  }
22577
23080
  function RainbowIcon({ size: size4 = 24, className, variant = "color" }) {
22578
- const id = React202.useId();
23081
+ const id = React212.useId();
22579
23082
  if (variant === "light") {
22580
23083
  return /* @__PURE__ */ jsxs29(
22581
23084
  "svg",
@@ -22989,7 +23492,7 @@ function RainbowIcon({ size: size4 = 24, className, variant = "color" }) {
22989
23492
  );
22990
23493
  }
22991
23494
  function TrustIcon({ size: size4 = 24, className, variant = "color" }) {
22992
- const id = React212.useId();
23495
+ const id = React222.useId();
22993
23496
  if (variant === "light") {
22994
23497
  return /* @__PURE__ */ jsx33(
22995
23498
  "svg",
@@ -23072,7 +23575,7 @@ function TrustIcon({ size: size4 = 24, className, variant = "color" }) {
23072
23575
  );
23073
23576
  }
23074
23577
  function OkxIcon({ size: size4 = 24, className, variant = "color" }) {
23075
- const id = React222.useId();
23578
+ const id = React232.useId();
23076
23579
  if (variant === "light") {
23077
23580
  return /* @__PURE__ */ jsx34(
23078
23581
  "svg",
@@ -23127,7 +23630,7 @@ function OkxIcon({ size: size4 = 24, className, variant = "color" }) {
23127
23630
  );
23128
23631
  }
23129
23632
  function GlowIcon({ size: size4 = 24, className, variant = "color" }) {
23130
- const id = React232.useId();
23633
+ const id = React242.useId();
23131
23634
  if (variant === "light") {
23132
23635
  return /* @__PURE__ */ jsx35(
23133
23636
  "svg",
@@ -23228,7 +23731,7 @@ function GlowIcon({ size: size4 = 24, className, variant = "color" }) {
23228
23731
  );
23229
23732
  }
23230
23733
  function BackpackIcon({ size: size4 = 24, className, variant = "color" }) {
23231
- const id = React242.useId();
23734
+ const id = React252.useId();
23232
23735
  if (variant === "light") {
23233
23736
  return /* @__PURE__ */ jsx36(
23234
23737
  "svg",
@@ -23301,7 +23804,7 @@ function BackpackIcon({ size: size4 = 24, className, variant = "color" }) {
23301
23804
  );
23302
23805
  }
23303
23806
  function SolflareIcon({ size: size4 = 24, className, variant = "color" }) {
23304
- const id = React252.useId();
23807
+ const id = React262.useId();
23305
23808
  if (variant === "light") {
23306
23809
  return /* @__PURE__ */ jsx37(
23307
23810
  "svg",
@@ -23368,7 +23871,7 @@ function SolflareIcon({ size: size4 = 24, className, variant = "color" }) {
23368
23871
  );
23369
23872
  }
23370
23873
  function EthereumIcon({ size: size4 = 24, className, variant = "color" }) {
23371
- const id = React262.useId();
23874
+ const id = React272.useId();
23372
23875
  if (variant === "light") {
23373
23876
  return /* @__PURE__ */ jsxs35(
23374
23877
  "svg",
@@ -23492,7 +23995,7 @@ function EthereumIcon({ size: size4 = 24, className, variant = "color" }) {
23492
23995
  );
23493
23996
  }
23494
23997
  function SolanaIcon({ size: size4 = 24, className, variant = "color" }) {
23495
- const id = React272.useId();
23998
+ const id = React282.useId();
23496
23999
  if (variant === "light") {
23497
24000
  return /* @__PURE__ */ jsx39(
23498
24001
  "svg",
@@ -23737,19 +24240,19 @@ function BrowserWalletButton({
23737
24240
  subtitle = i18n2.depositModal.browserWallet.subtitle
23738
24241
  }) {
23739
24242
  const { colors: colors2, fonts, components } = useTheme();
23740
- const [isHovered, setIsHovered] = React282.useState(false);
23741
- const [isTouchDevice, setIsTouchDevice] = React282.useState(false);
24243
+ const [isHovered, setIsHovered] = React292.useState(false);
24244
+ const [isTouchDevice, setIsTouchDevice] = React292.useState(false);
23742
24245
  const { wallet, isLoading, setWallet } = useDetectedBrowserWallet({ chainType, onDisconnect });
23743
- const [isConnecting, setIsConnecting] = React282.useState(false);
23744
- const [balanceText, setBalanceText] = React282.useState(null);
23745
- const [isLoadingBalance, setIsLoadingBalance] = React282.useState(false);
23746
- const [isDisconnecting, setIsDisconnecting] = React282.useState(false);
23747
- const onDisconnectRef = React282.useRef(onDisconnect);
24246
+ const [isConnecting, setIsConnecting] = React292.useState(false);
24247
+ const [balanceText, setBalanceText] = React292.useState(null);
24248
+ const [isLoadingBalance, setIsLoadingBalance] = React292.useState(false);
24249
+ const [isDisconnecting, setIsDisconnecting] = React292.useState(false);
24250
+ const onDisconnectRef = React292.useRef(onDisconnect);
23748
24251
  onDisconnectRef.current = onDisconnect;
23749
- React282.useEffect(() => {
24252
+ React292.useEffect(() => {
23750
24253
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
23751
24254
  }, []);
23752
- React282.useEffect(() => {
24255
+ React292.useEffect(() => {
23753
24256
  if (!wallet || !publishableKey) {
23754
24257
  setBalanceText(null);
23755
24258
  return;
@@ -23818,21 +24321,19 @@ function BrowserWalletButton({
23818
24321
  }
23819
24322
  }
23820
24323
  if (!chainType || chainType === "ethereum") {
23821
- const ethProvider = window.phantom?.ethereum || window.ethereum;
23822
- if (ethProvider) {
23823
- const accounts = await ethProvider.request({
24324
+ const resolved = resolveQuickConnectEvmProvider(window);
24325
+ if (resolved) {
24326
+ const accounts = await resolved.provider.request({
23824
24327
  method: "eth_requestAccounts"
23825
24328
  });
23826
24329
  if (accounts && accounts.length > 0) {
23827
24330
  setUserDisconnectedWallet(false);
23828
- const isPhantom = ethProvider.isPhantom;
23829
- const walletType = isPhantom ? "phantom-ethereum" : "metamask";
23830
- setStoredWalletState(walletType);
24331
+ setStoredWalletState(resolved.walletType);
23831
24332
  setWallet({
23832
- type: walletType,
23833
- name: isPhantom ? "Phantom" : "MetaMask",
24333
+ type: resolved.walletType,
24334
+ name: resolved.name,
23834
24335
  address: accounts[0],
23835
- icon: isPhantom ? "phantom" : "metamask"
24336
+ icon: resolved.icon
23836
24337
  });
23837
24338
  }
23838
24339
  }
@@ -23866,7 +24367,10 @@ function BrowserWalletButton({
23866
24367
  if (isLoading) {
23867
24368
  return null;
23868
24369
  }
23869
- const hasWalletExtension = (!chainType || chainType === "ethereum") && getEip6963Providers().length > 0 || (!chainType || chainType === "solana") && (window.phantom?.solana?.isPhantom || window.solana?.isPhantom) || (!chainType || chainType === "ethereum") && (window.phantom?.ethereum || window.ethereum);
24370
+ const eip6963EvmProviderCount = getEip6963Providers().length;
24371
+ const legacyEvmProviders = getLegacyEvmProviders(window);
24372
+ const hasLegacyEvmProvider = eip6963EvmProviderCount === 0 && !!(legacyEvmProviders.ethereum || legacyEvmProviders.phantomEthereum || legacyEvmProviders.coinbaseEthereum || legacyEvmProviders.trustEthereum || legacyEvmProviders.okxEthereum);
24373
+ const hasWalletExtension = (!chainType || chainType === "ethereum") && eip6963EvmProviderCount > 0 || (!chainType || chainType === "solana") && (window.phantom?.solana?.isPhantom || window.solana?.isPhantom) || (!chainType || chainType === "ethereum") && hasLegacyEvmProvider;
23870
24374
  if (!onConnectClick && !wallet && !hasWalletExtension) {
23871
24375
  return null;
23872
24376
  }
@@ -23876,11 +24380,25 @@ function BrowserWalletButton({
23876
24380
  border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
23877
24381
  };
23878
24382
  const sortedWallets = featuredWallets ? [...featuredWallets].sort((a, b) => a.position - b.position) : [];
23879
- const walletIconBlock = wallet ? WALLET_ICON_COMPONENTS[wallet.icon] ? React282.createElement(WALLET_ICON_COMPONENTS[wallet.icon], {
24383
+ const isImageIcon = !!wallet && (wallet.icon.startsWith("data:") || wallet.icon.startsWith("http"));
24384
+ const walletIconBlock = wallet ? WALLET_ICON_COMPONENTS[wallet.icon] ? React292.createElement(WALLET_ICON_COMPONENTS[wallet.icon], {
23880
24385
  size: 36,
23881
24386
  className: "uf-rounded-lg",
23882
24387
  variant: "color"
23883
- }) : /* @__PURE__ */ jsx41("div", { className: "uf-w-9 uf-h-9 uf-rounded-lg uf-bg-gray-500" }) : /* @__PURE__ */ jsx41("div", { className: "uf-rounded-lg uf-p-2", children: /* @__PURE__ */ jsx41(Wallet, { className: "uf-w-5 uf-h-5", style: { color: components.card.iconColor } }) });
24388
+ }) : isImageIcon ? (
24389
+ // Wallet announced via EIP-6963 with no internal icon component: render its
24390
+ // own advertised icon (`info.icon`) rather than a generic placeholder.
24391
+ /* @__PURE__ */ jsx41(
24392
+ "img",
24393
+ {
24394
+ src: wallet.icon,
24395
+ alt: wallet.name,
24396
+ width: 36,
24397
+ height: 36,
24398
+ className: "uf-rounded-lg uf-w-9 uf-h-9"
24399
+ }
24400
+ )
24401
+ ) : /* @__PURE__ */ jsx41("div", { className: "uf-w-9 uf-h-9 uf-rounded-lg uf-bg-gray-500" }) : /* @__PURE__ */ jsx41("div", { className: "uf-rounded-lg uf-p-2", children: /* @__PURE__ */ jsx41(Wallet, { className: "uf-w-5 uf-h-5", style: { color: components.card.iconColor } }) });
23884
24402
  const titleSubtitleBlock = /* @__PURE__ */ jsxs38("div", { className: "uf-text-left uf-min-w-0", children: [
23885
24403
  /* @__PURE__ */ jsx41(
23886
24404
  "div",
@@ -24027,9 +24545,9 @@ function StripeLinkButton({
24027
24545
  iconUrl
24028
24546
  }) {
24029
24547
  const { colors: colors2, fonts, components } = useTheme();
24030
- const [isHovered, setIsHovered] = React292.useState(false);
24031
- const [isTouchDevice, setIsTouchDevice] = React292.useState(false);
24032
- React292.useEffect(() => {
24548
+ const [isHovered, setIsHovered] = React302.useState(false);
24549
+ const [isTouchDevice, setIsTouchDevice] = React302.useState(false);
24550
+ React302.useEffect(() => {
24033
24551
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
24034
24552
  }, []);
24035
24553
  return /* @__PURE__ */ jsxs39(
@@ -24302,12 +24820,12 @@ function useStripeOnramp(stripePublishableKey, isDark = false) {
24302
24820
  const [coordinator, setCoordinator] = useState282(null);
24303
24821
  const [isLoading, setIsLoading] = useState282(false);
24304
24822
  const [error, setError] = useState282(null);
24305
- const coordinatorRef = useRef72(null);
24306
- const coordinatorThemeRef = useRef72(null);
24307
- const initPromiseRef = useRef72(null);
24308
- const isDarkRef = useRef72(isDark);
24823
+ const coordinatorRef = useRef82(null);
24824
+ const coordinatorThemeRef = useRef82(null);
24825
+ const initPromiseRef = useRef82(null);
24826
+ const isDarkRef = useRef82(isDark);
24309
24827
  isDarkRef.current = isDark;
24310
- const initialize = useCallback32(() => {
24828
+ const initialize = useCallback52(() => {
24311
24829
  if (coordinatorRef.current) return Promise.resolve(coordinatorRef.current);
24312
24830
  if (initPromiseRef.current) return initPromiseRef.current;
24313
24831
  if (!stripePublishableKey) return Promise.resolve(null);
@@ -24515,6 +25033,8 @@ function PayWithStripeLink({
24515
25033
  destinationChainType,
24516
25034
  destinationChainId,
24517
25035
  destinationTokenAddress,
25036
+ countryCode,
25037
+ subdivisionCode,
24518
25038
  wallets: externalWallets,
24519
25039
  email: emailProp,
24520
25040
  iconUrl,
@@ -24526,14 +25046,14 @@ function PayWithStripeLink({
24526
25046
  }) {
24527
25047
  const { colors: colors2, fonts, components, isDark } = useTheme();
24528
25048
  const [step, setStepInternal] = useState292(controlledStep ?? "amount");
24529
- const setStep = useCallback42(
25049
+ const setStep = useCallback62(
24530
25050
  (s) => {
24531
25051
  setStepInternal(s);
24532
25052
  onStepChange?.(s);
24533
25053
  },
24534
25054
  [onStepChange]
24535
25055
  );
24536
- const stepRef = useRef82(step);
25056
+ const stepRef = useRef92(step);
24537
25057
  stepRef.current = step;
24538
25058
  useEffect242(() => {
24539
25059
  if (controlledStep && controlledStep !== step) {
@@ -24624,20 +25144,20 @@ function PayWithStripeLink({
24624
25144
  const [restoring, setRestoring] = useState292(true);
24625
25145
  const [errorReturnStep, setErrorReturnStep] = useState292("email");
24626
25146
  const [authIntentId, setAuthIntentId] = useState292(null);
24627
- const sdkAuthenticatedRef = useRef82(false);
24628
- const everAuthenticatedRef = useRef82(false);
24629
- const reauthReturnStepRef = useRef82(null);
24630
- const attemptedWalletReauthRef = useRef82(false);
24631
- const pendingAddPaymentRef = useRef82(false);
24632
- const autoOpenedAddPaymentRef = useRef82(false);
24633
- const checkoutGenRef = useRef82(0);
25147
+ const sdkAuthenticatedRef = useRef92(false);
25148
+ const everAuthenticatedRef = useRef92(false);
25149
+ const reauthReturnStepRef = useRef92(null);
25150
+ const attemptedWalletReauthRef = useRef92(false);
25151
+ const pendingAddPaymentRef = useRef92(false);
25152
+ const autoOpenedAddPaymentRef = useRef92(false);
25153
+ const checkoutGenRef = useRef92(0);
24634
25154
  const [stripePaymentUIReady, setStripePaymentUIReady] = useState292(false);
24635
25155
  const [oauthToken, setOauthToken] = useState292(null);
24636
25156
  const [refreshTokenValue, setRefreshTokenValue] = useState292(null);
24637
25157
  const [customerId, setCustomerId] = useState292(null);
24638
- const accessTokenRef = useRef82("");
24639
- const refreshTokenRef = useRef82("");
24640
- const persistSession = useCallback42(
25158
+ const accessTokenRef = useRef92("");
25159
+ const refreshTokenRef = useRef92("");
25160
+ const persistSession = useCallback62(
24641
25161
  (cid, token, refresh, expiresIn, loginEmail) => {
24642
25162
  accessTokenRef.current = token;
24643
25163
  refreshTokenRef.current = refresh;
@@ -24651,8 +25171,8 @@ function PayWithStripeLink({
24651
25171
  },
24652
25172
  [userId, email]
24653
25173
  );
24654
- const refreshInFlightRef = useRef82(null);
24655
- const tryRefreshToken = useCallback42(async () => {
25174
+ const refreshInFlightRef = useRef92(null);
25175
+ const tryRefreshToken = useCallback62(async () => {
24656
25176
  if (refreshInFlightRef.current) return refreshInFlightRef.current;
24657
25177
  const rt = refreshTokenRef.current;
24658
25178
  if (!rt) return null;
@@ -24682,7 +25202,7 @@ function PayWithStripeLink({
24682
25202
  refreshInFlightRef.current = doRefresh();
24683
25203
  return refreshInFlightRef.current;
24684
25204
  }, [publishableKey, customerId, persistSession, userId]);
24685
- const withTokenRefresh = useCallback42(
25205
+ const withTokenRefresh = useCallback62(
24686
25206
  async (fn) => {
24687
25207
  const token = accessTokenRef.current;
24688
25208
  if (!token) {
@@ -24844,8 +25364,8 @@ function PayWithStripeLink({
24844
25364
  );
24845
25365
  const [selectedPaymentToken, setSelectedPaymentToken] = useState292(null);
24846
25366
  const [paymentDisplay, setPaymentDisplay] = useState292(null);
24847
- const selectedTokenSingleUseRef = useRef82(false);
24848
- const selectPaymentToken = useCallback42(
25367
+ const selectedTokenSingleUseRef = useRef92(false);
25368
+ const selectPaymentToken = useCallback62(
24849
25369
  (token) => {
24850
25370
  selectedTokenSingleUseRef.current = !!token.singleUse;
24851
25371
  setSelectedPaymentToken(token.id);
@@ -24857,7 +25377,7 @@ function PayWithStripeLink({
24857
25377
  },
24858
25378
  [customerId]
24859
25379
  );
24860
- const clearSelectedPaymentToken = useCallback42(() => {
25380
+ const clearSelectedPaymentToken = useCallback62(() => {
24861
25381
  selectedTokenSingleUseRef.current = false;
24862
25382
  const persisted = customerId ? getStoredSelectedToken(customerId) : null;
24863
25383
  if (persisted && !persisted.singleUse) {
@@ -24909,7 +25429,9 @@ function PayWithStripeLink({
24909
25429
  {
24910
25430
  tokenAddress: destinationTokenAddress,
24911
25431
  chainId: destinationChainId,
24912
- chainType: destinationChainType
25432
+ chainType: destinationChainType,
25433
+ countryCode,
25434
+ subdivisionCode
24913
25435
  },
24914
25436
  publishableKey
24915
25437
  ).then((token) => {
@@ -24928,10 +25450,17 @@ function PayWithStripeLink({
24928
25450
  return () => {
24929
25451
  cancelled = true;
24930
25452
  };
24931
- }, [publishableKey, destinationTokenAddress, destinationChainId, destinationChainType]);
25453
+ }, [
25454
+ publishableKey,
25455
+ destinationTokenAddress,
25456
+ destinationChainId,
25457
+ destinationChainType,
25458
+ countryCode,
25459
+ subdivisionCode
25460
+ ]);
24932
25461
  const destinationCurrency = stripeDestCurrency;
24933
- const authInnerRef = useRef82(null);
24934
- const paymentInnerRef = useRef82(null);
25462
+ const authInnerRef = useRef92(null);
25463
+ const paymentInnerRef = useRef92(null);
24935
25464
  const [authReady, setAuthReady] = useState292(false);
24936
25465
  if (typeof document !== "undefined" && !authInnerRef.current) {
24937
25466
  authInnerRef.current = document.createElement("div");
@@ -24939,12 +25468,12 @@ function PayWithStripeLink({
24939
25468
  if (typeof document !== "undefined" && !paymentInnerRef.current) {
24940
25469
  paymentInnerRef.current = document.createElement("div");
24941
25470
  }
24942
- const authMountRef = useCallback42((node) => {
25471
+ const authMountRef = useCallback62((node) => {
24943
25472
  if (node && !node.contains(authInnerRef.current)) {
24944
25473
  node.appendChild(authInnerRef.current);
24945
25474
  }
24946
25475
  }, []);
24947
- const paymentMountRef = useCallback42((node) => {
25476
+ const paymentMountRef = useCallback62((node) => {
24948
25477
  if (node && !node.contains(paymentInnerRef.current)) {
24949
25478
  node.appendChild(paymentInnerRef.current);
24950
25479
  }
@@ -24995,8 +25524,8 @@ function PayWithStripeLink({
24995
25524
  });
24996
25525
  const [confirmedSessionId, setConfirmedSessionId] = useState292(null);
24997
25526
  const [sessionStatus, setSessionStatus] = useState292(null);
24998
- const handledTerminalSessionRef = useRef82(null);
24999
- const executionReconciledSessionRef = useRef82(null);
25527
+ const handledTerminalSessionRef = useRef92(null);
25528
+ const executionReconciledSessionRef = useRef92(null);
25000
25529
  const hasExecution = executions.length > 0;
25001
25530
  const isSessionFulfilled = sessionStatus === STRIPE_SESSION_STATUS.FULFILLMENT_COMPLETE || hasExecution;
25002
25531
  const isSessionFailed = !hasExecution && (sessionStatus === STRIPE_SESSION_STATUS.REJECTED || sessionStatus === STRIPE_SESSION_STATUS.EXPIRED);
@@ -25114,7 +25643,7 @@ function PayWithStripeLink({
25114
25643
  sdkAuthenticatedRef.current = false;
25115
25644
  attemptedWalletReauthRef.current = false;
25116
25645
  }, [coordinator]);
25117
- const handleAuthInterrupted = useCallback42(
25646
+ const handleAuthInterrupted = useCallback62(
25118
25647
  (message) => {
25119
25648
  const alreadySignedIn = !!accessTokenRef.current;
25120
25649
  if (alreadySignedIn || emailProp) {
@@ -25127,7 +25656,7 @@ function PayWithStripeLink({
25127
25656
  },
25128
25657
  [emailProp, setStep]
25129
25658
  );
25130
- const reauthenticateSdk = useCallback42(async () => {
25659
+ const reauthenticateSdk = useCallback62(async () => {
25131
25660
  const current = stepRef.current;
25132
25661
  const preAuthSteps = ["email", "register", "auth"];
25133
25662
  reauthReturnStepRef.current = preAuthSteps.includes(current) ? null : current;
@@ -25826,14 +26355,14 @@ function PayWithStripeLink({
25826
26355
  };
25827
26356
  const [quote, setQuote] = useState292(null);
25828
26357
  const [quoteLoading, setQuoteLoading] = useState292(false);
25829
- const quoteTimerRef = useRef82(null);
26358
+ const quoteTimerRef = useRef92(null);
25830
26359
  const [sessionForCheckout, setSessionForCheckoutState] = useState292(null);
25831
- const sessionForCheckoutRef = useRef82(sessionForCheckout);
26360
+ const sessionForCheckoutRef = useRef92(sessionForCheckout);
25832
26361
  const setSessionForCheckout = (s) => {
25833
26362
  sessionForCheckoutRef.current = s;
25834
26363
  setSessionForCheckoutState(s);
25835
26364
  };
25836
- const loadAndSelectPreferredToken = useCallback42(async () => {
26365
+ const loadAndSelectPreferredToken = useCallback62(async () => {
25837
26366
  if (!customerId) return;
25838
26367
  try {
25839
26368
  const existing = await withTokenRefresh(
@@ -25863,7 +26392,7 @@ function PayWithStripeLink({
25863
26392
  };
25864
26393
  const [quoteError, setQuoteError] = useState292(null);
25865
26394
  const [quoteNonce, setQuoteNonce] = useState292(0);
25866
- const quoteNonceAtReviewRef = useRef82(quoteNonce);
26395
+ const quoteNonceAtReviewRef = useRef92(quoteNonce);
25867
26396
  const [purchaseLimit, setPurchaseLimit] = useState292(null);
25868
26397
  const [limitReachedAmount, setLimitReachedAmount] = useState292(null);
25869
26398
  const [requiredStepUp, setRequiredStepUp] = useState292(null);
@@ -27786,7 +28315,7 @@ function useProjectConfig({
27786
28315
  data: projectConfig,
27787
28316
  isLoading,
27788
28317
  error
27789
- } = useQuery8({
28318
+ } = useQuery9({
27790
28319
  // Country is part of the key so a region change refetches the region-aware
27791
28320
  // config. Omitted when undefined so callers that don't pass a country keep
27792
28321
  // sharing the base cache entry.
@@ -27814,7 +28343,7 @@ function useSupportedDepositTokens(publishableKey, options) {
27814
28343
  ...options?.product_type ? { product_type: options.product_type } : {}
27815
28344
  };
27816
28345
  const hasFilteredOptions = Object.keys(filteredOptions).length > 0;
27817
- return useQuery9({
28346
+ return useQuery10({
27818
28347
  queryKey: [
27819
28348
  "unifold",
27820
28349
  "supportedDepositTokens",
@@ -27838,7 +28367,7 @@ function useIntegrationTransferDefaultToken({
27838
28367
  publishableKey,
27839
28368
  enabled = true
27840
28369
  }) {
27841
- return useQuery10({
28370
+ return useQuery11({
27842
28371
  queryKey: [
27843
28372
  "unifold",
27844
28373
  "integrationTransferDefaultToken",
@@ -27904,7 +28433,8 @@ function CoinbaseConnect({
27904
28433
  defaultSourceChainType,
27905
28434
  defaultSourceChainId,
27906
28435
  defaultSourceTokenAddress,
27907
- defaultSourceSymbol
28436
+ defaultSourceSymbol,
28437
+ prefilledAmountUsd
27908
28438
  }) {
27909
28439
  const { colors: colors2, fonts, components } = useTheme();
27910
28440
  const { projectConfig } = useProjectConfig({ publishableKey });
@@ -27914,12 +28444,12 @@ function CoinbaseConnect({
27914
28444
  destination_chain_id: destinationChainId,
27915
28445
  destination_chain_type: destinationChainType
27916
28446
  });
27917
- const supportedSymbols = useMemo72(() => {
28447
+ const supportedSymbols = useMemo82(() => {
27918
28448
  const set = /* @__PURE__ */ new Set();
27919
28449
  supportedTokensData?.data.forEach((token) => set.add(token.symbol.toLowerCase()));
27920
28450
  return set;
27921
28451
  }, [supportedTokensData]);
27922
- const stablecoinSymbols = useMemo72(() => {
28452
+ const stablecoinSymbols = useMemo82(() => {
27923
28453
  const set = /* @__PURE__ */ new Set();
27924
28454
  supportedTokensData?.data.forEach((token) => {
27925
28455
  if (token.is_stablecoin) set.add(token.symbol.toLowerCase());
@@ -27952,12 +28482,12 @@ function CoinbaseConnect({
27952
28482
  const [transferDepositWalletId, setTransferDepositWalletId] = useState30(
27953
28483
  void 0
27954
28484
  );
27955
- const exchangeSupportedCurrencies = useMemo72(() => {
28485
+ const exchangeSupportedCurrencies = useMemo82(() => {
27956
28486
  const set = /* @__PURE__ */ new Set();
27957
28487
  selectedExchange?.supported_currencies.forEach((c) => set.add(c.toLowerCase()));
27958
28488
  return set;
27959
28489
  }, [selectedExchange]);
27960
- const defaultTokenParams = useMemo72(
28490
+ const defaultTokenParams = useMemo82(
27961
28491
  () => selectedAsset ? {
27962
28492
  integration_provider: IntegrationProvider.COINBASE,
27963
28493
  source_currency: selectedAsset.currency.toLowerCase(),
@@ -27980,7 +28510,7 @@ function CoinbaseConnect({
27980
28510
  params: defaultTokenParams,
27981
28511
  publishableKey
27982
28512
  });
27983
- const defaultSourceCurrency = useMemo72(
28513
+ const defaultSourceCurrency = useMemo82(
27984
28514
  () => resolveDefaultSourceSymbol(supportedTokensData?.data, {
27985
28515
  defaultSourceChainType,
27986
28516
  defaultSourceChainId,
@@ -27995,7 +28525,7 @@ function CoinbaseConnect({
27995
28525
  defaultSourceSymbol
27996
28526
  ]
27997
28527
  );
27998
- const sortedHoldings = useMemo72(() => {
28528
+ const sortedHoldings = useMemo82(() => {
27999
28529
  const supported = [];
28000
28530
  const unsupported = [];
28001
28531
  holdings.forEach((account) => {
@@ -28015,7 +28545,7 @@ function CoinbaseConnect({
28015
28545
  }
28016
28546
  return [...supported, ...unsupported];
28017
28547
  }, [holdings, supportedSymbols, exchangeSupportedCurrencies, defaultSourceCurrency]);
28018
- const selectedHoldingIsSupported = useMemo72(() => {
28548
+ const selectedHoldingIsSupported = useMemo82(() => {
28019
28549
  if (!selectedHolding) return false;
28020
28550
  const currencyLower = selectedHolding.currency.toLowerCase();
28021
28551
  return (supportedSymbols.size === 0 || supportedSymbols.has(currencyLower)) && (exchangeSupportedCurrencies.size === 0 || exchangeSupportedCurrencies.has(currencyLower));
@@ -28059,10 +28589,10 @@ function CoinbaseConnect({
28059
28589
  useEffect252(() => {
28060
28590
  onExecutionsChange?.(depositExecutions);
28061
28591
  }, [depositExecutions, onExecutionsChange]);
28062
- const pollRef = useRef92(null);
28063
- const popupRef = useRef92(null);
28064
- const viewRef = useRef92(initialView);
28065
- const transitionTo = useCallback52((nextView) => {
28592
+ const pollRef = useRef102(null);
28593
+ const popupRef = useRef102(null);
28594
+ const viewRef = useRef102(initialView);
28595
+ const transitionTo = useCallback72((nextView) => {
28066
28596
  if (nextView === viewRef.current) return;
28067
28597
  setIsTransitioning(true);
28068
28598
  setTimeout(() => {
@@ -28072,7 +28602,7 @@ function CoinbaseConnect({
28072
28602
  setIsTransitioning(false);
28073
28603
  }, 150);
28074
28604
  }, []);
28075
- const tryRefreshToken = useCallback52(
28605
+ const tryRefreshToken = useCallback72(
28076
28606
  async (currentToken) => {
28077
28607
  try {
28078
28608
  const result = await refreshIntegrationToken(currentToken, publishableKey);
@@ -28110,7 +28640,7 @@ function CoinbaseConnect({
28110
28640
  }
28111
28641
  }
28112
28642
  }, []);
28113
- const loadHoldings = useCallback52(
28643
+ const loadHoldings = useCallback72(
28114
28644
  async (token) => {
28115
28645
  setIsLoading(true);
28116
28646
  try {
@@ -28162,7 +28692,7 @@ function CoinbaseConnect({
28162
28692
  if (pollRef.current) clearInterval(pollRef.current);
28163
28693
  };
28164
28694
  }, []);
28165
- const minDepositUsd = useMemo72(() => {
28695
+ const minDepositUsd = useMemo82(() => {
28166
28696
  if (!selectedAsset || !defaultTokenData) return 0;
28167
28697
  const supportedToken = supportedTokensData?.data.find(
28168
28698
  (t14) => t14.symbol.toLowerCase() === selectedAsset.currency.toLowerCase()
@@ -28173,7 +28703,7 @@ function CoinbaseConnect({
28173
28703
  );
28174
28704
  return matchingChain?.minimum_deposit_amount_usd ?? Math.min(...supportedToken.chains.map((c) => c.minimum_deposit_amount_usd));
28175
28705
  }, [selectedAsset, supportedTokensData, defaultTokenData]);
28176
- const estimatedProcessingTime = useMemo72(() => {
28706
+ const estimatedProcessingTime = useMemo82(() => {
28177
28707
  if (!selectedAsset || !defaultTokenData) return null;
28178
28708
  const supportedToken = supportedTokensData?.data.find(
28179
28709
  (t14) => t14.symbol.toLowerCase() === selectedAsset.currency.toLowerCase()
@@ -28227,7 +28757,8 @@ function CoinbaseConnect({
28227
28757
  };
28228
28758
  const handleSelectAsset = (asset) => {
28229
28759
  setSelectedAsset(asset);
28230
- setSendAmount("");
28760
+ const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
28761
+ setSendAmount(cleanedPrefilled);
28231
28762
  transitionTo("enter_amount");
28232
28763
  };
28233
28764
  const handleCreateTransfer = async () => {
@@ -29815,7 +30346,7 @@ function useExchanges({
29815
30346
  publishableKey,
29816
30347
  enabled = true
29817
30348
  }) {
29818
- const { data: exchanges = [], isLoading } = useQuery11({
30349
+ const { data: exchanges = [], isLoading } = useQuery12({
29819
30350
  queryKey: ["unifold", "exchanges", publishableKey],
29820
30351
  queryFn: () => getExchanges(void 0, publishableKey).then((res) => res.data),
29821
30352
  enabled,
@@ -29825,11 +30356,29 @@ function useExchanges({
29825
30356
  });
29826
30357
  return { exchanges, isLoading };
29827
30358
  }
30359
+ function usePublicIncident({
30360
+ publishableKey,
30361
+ enabled = true
30362
+ }) {
30363
+ const {
30364
+ data: incident,
30365
+ isLoading,
30366
+ error
30367
+ } = useQuery13({
30368
+ queryKey: ["unifold", "publicIncident", publishableKey],
30369
+ queryFn: () => getPublicIncident(publishableKey),
30370
+ enabled,
30371
+ staleTime: 1e3 * 30,
30372
+ refetchInterval: 1e3 * 30,
30373
+ refetchOnWindowFocus: true
30374
+ });
30375
+ return { incident, isLoading, error: error ?? null };
30376
+ }
29828
30377
  function useApplePayProviders({
29829
30378
  publishableKey,
29830
30379
  enabled = true
29831
30380
  }) {
29832
- const { data: providers, isLoading } = useQuery12({
30381
+ const { data: providers, isLoading } = useQuery14({
29833
30382
  queryKey: ["unifold", "applePayProviders", publishableKey],
29834
30383
  queryFn: () => getApplePayProviders(publishableKey),
29835
30384
  enabled,
@@ -29889,7 +30438,7 @@ function useAddressValidation({
29889
30438
  refetchOnMount = false
29890
30439
  }) {
29891
30440
  const shouldValidate = enabled && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
29892
- const { data, isLoading, error } = useQuery13({
30441
+ const { data, isLoading, error } = useQuery15({
29893
30442
  queryKey: [
29894
30443
  "unifold",
29895
30444
  "addressValidation",
@@ -29920,6 +30469,7 @@ function useAddressValidation({
29920
30469
  return {
29921
30470
  isValid: null,
29922
30471
  failureCode: null,
30472
+ message: null,
29923
30473
  metadata: null,
29924
30474
  isLoading: false,
29925
30475
  error: null
@@ -29928,6 +30478,7 @@ function useAddressValidation({
29928
30478
  return {
29929
30479
  isValid: data?.valid ?? null,
29930
30480
  failureCode: data?.failure_code ?? null,
30481
+ message: data?.message ?? null,
29931
30482
  metadata: data?.metadata ?? null,
29932
30483
  isLoading,
29933
30484
  error: error ?? null
@@ -29938,7 +30489,7 @@ function ThemeStyleInjector({
29938
30489
  className
29939
30490
  }) {
29940
30491
  const { colors: colors2, fonts, mode } = useTheme();
29941
- const cssVars = React312.useMemo(() => {
30492
+ const cssVars = React322.useMemo(() => {
29942
30493
  const hexToHSL = (hex) => {
29943
30494
  hex = hex.replace("#", "");
29944
30495
  const r2 = parseInt(hex.slice(0, 2), 16) / 255;
@@ -29998,7 +30549,7 @@ function ThemeStyleInjector({
29998
30549
  ...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
29999
30550
  };
30000
30551
  }, [colors2, fonts.regular]);
30001
- React312.useEffect(() => {
30552
+ React322.useEffect(() => {
30002
30553
  if (typeof document === "undefined") return;
30003
30554
  if (fonts.regular) {
30004
30555
  document.documentElement.style.setProperty("--uf-font-family", fonts.regular);
@@ -30326,7 +30877,7 @@ function TokenSelectorSheet({
30326
30877
  useEffect282(() => {
30327
30878
  setRecentTokens(getRecentTokens());
30328
30879
  }, []);
30329
- const allOptions = useMemo92(() => {
30880
+ const allOptions = useMemo102(() => {
30330
30881
  const options = [];
30331
30882
  tokens.forEach((token) => {
30332
30883
  token.chains.forEach((chain) => {
@@ -30335,7 +30886,7 @@ function TokenSelectorSheet({
30335
30886
  });
30336
30887
  return options;
30337
30888
  }, [tokens]);
30338
- const quickSelectOptions = useMemo92(() => {
30889
+ const quickSelectOptions = useMemo102(() => {
30339
30890
  const result = [];
30340
30891
  const seen = /* @__PURE__ */ new Set();
30341
30892
  const addOption = (symbol, chainType, chainId, isRecent) => {
@@ -30367,7 +30918,7 @@ function TokenSelectorSheet({
30367
30918
  });
30368
30919
  setRecentTokens(updated);
30369
30920
  };
30370
- const fuse = useMemo92(
30921
+ const fuse = useMemo102(
30371
30922
  () => new Fuse(allOptions, {
30372
30923
  keys: [
30373
30924
  { name: "token.symbol", weight: 2 },
@@ -30380,7 +30931,7 @@ function TokenSelectorSheet({
30380
30931
  }),
30381
30932
  [allOptions]
30382
30933
  );
30383
- const filteredOptions = useMemo92(() => {
30934
+ const filteredOptions = useMemo102(() => {
30384
30935
  if (!searchQuery.trim()) return allOptions;
30385
30936
  const query = searchQuery.trim();
30386
30937
  const results = fuse.search(query);
@@ -30753,6 +31304,37 @@ function TokenSelectorSheet({
30753
31304
  var getChainKey = (chainId, chainType) => {
30754
31305
  return `${chainType}:${chainId}`;
30755
31306
  };
31307
+ function getStoredSelection(key) {
31308
+ if (typeof window === "undefined") return null;
31309
+ try {
31310
+ const raw = localStorage.getItem(key);
31311
+ if (!raw) return null;
31312
+ const parsed = JSON.parse(raw);
31313
+ if (parsed && typeof parsed.symbol === "string" && typeof parsed.chainType === "string" && typeof parsed.chainId === "string") {
31314
+ return parsed;
31315
+ }
31316
+ } catch {
31317
+ }
31318
+ return null;
31319
+ }
31320
+ function saveStoredSelection(key, symbol, chainType, chainId) {
31321
+ if (typeof window === "undefined") return;
31322
+ try {
31323
+ localStorage.setItem(key, JSON.stringify({ symbol, chainType, chainId }));
31324
+ } catch {
31325
+ }
31326
+ }
31327
+ function resolveFromStorage(tokens, stored) {
31328
+ for (const t13 of tokens) {
31329
+ if (t13.symbol !== stored.symbol) continue;
31330
+ const matchedChain = t13.chains.find(
31331
+ (c) => c.chain_type === stored.chainType && c.chain_id === stored.chainId
31332
+ );
31333
+ if (matchedChain) return { token: t13, chain: matchedChain };
31334
+ if (t13.chains.length > 0) return { token: t13, chain: t13.chains[0] };
31335
+ }
31336
+ return null;
31337
+ }
30756
31338
  function resolveToken(tokens, defaultChainType, defaultChainId, defaultTokenAddress, defaultSymbol) {
30757
31339
  if (!tokens.length) return null;
30758
31340
  let selectedToken;
@@ -30802,27 +31384,73 @@ function useDefaultToken({
30802
31384
  defaultChainType,
30803
31385
  defaultChainId,
30804
31386
  defaultTokenAddress,
30805
- defaultSymbol
31387
+ defaultSymbol,
31388
+ storageKey: storageKey2
30806
31389
  }) {
30807
- const [token, setToken] = useState33(null);
30808
- const [chain, setChain] = useState33(null);
31390
+ const [token, setTokenState] = useState33(null);
31391
+ const [chain, setChainState] = useState33(null);
30809
31392
  const [initialSelectionDone, setInitialSelectionDone] = useState33(false);
30810
- const appliedDefaultsRef = useRef102("");
31393
+ const appliedDefaultsRef = useRef112("");
31394
+ const tokenRef = useRef112(null);
31395
+ const chainRef = useRef112(null);
31396
+ tokenRef.current = token;
31397
+ chainRef.current = chain;
31398
+ const setToken = useCallback82(
31399
+ (newToken) => {
31400
+ tokenRef.current = newToken;
31401
+ setTokenState(newToken);
31402
+ if (storageKey2 && chainRef.current) {
31403
+ const [chainType, chainId] = chainRef.current.split(":");
31404
+ saveStoredSelection(storageKey2, newToken, chainType, chainId);
31405
+ }
31406
+ },
31407
+ [storageKey2]
31408
+ );
31409
+ const setChain = useCallback82(
31410
+ (newChain) => {
31411
+ chainRef.current = newChain;
31412
+ setChainState(newChain);
31413
+ if (storageKey2 && tokenRef.current) {
31414
+ const [chainType, chainId] = newChain.split(":");
31415
+ saveStoredSelection(storageKey2, tokenRef.current, chainType, chainId);
31416
+ }
31417
+ },
31418
+ [storageKey2]
31419
+ );
30811
31420
  useEffect292(() => {
30812
31421
  if (!tokens.length) return;
30813
31422
  const defaultsKey = `${defaultTokenAddress ?? ""}|${defaultSymbol ?? ""}|${defaultChainType ?? ""}|${defaultChainId ?? ""}`;
30814
31423
  const defaultsChanged = appliedDefaultsRef.current !== defaultsKey;
30815
31424
  if (initialSelectionDone && !defaultsChanged) return;
30816
- const result = resolveToken(
30817
- tokens,
30818
- defaultChainType,
30819
- defaultChainId,
30820
- defaultTokenAddress,
30821
- defaultSymbol
30822
- );
31425
+ const hasExplicitDefaults = defaultTokenAddress && defaultChainType && defaultChainId || defaultSymbol && defaultChainType && defaultChainId;
31426
+ let result = null;
31427
+ if (hasExplicitDefaults) {
31428
+ result = resolveToken(
31429
+ tokens,
31430
+ defaultChainType,
31431
+ defaultChainId,
31432
+ defaultTokenAddress,
31433
+ defaultSymbol
31434
+ );
31435
+ if (result) {
31436
+ const matched = defaultTokenAddress && result.chain.token_address.toLowerCase() === defaultTokenAddress.toLowerCase() && result.chain.chain_type === defaultChainType && result.chain.chain_id === defaultChainId || defaultSymbol && result.token.symbol === defaultSymbol && result.chain.chain_type === defaultChainType && result.chain.chain_id === defaultChainId;
31437
+ if (!matched) {
31438
+ result = null;
31439
+ }
31440
+ }
31441
+ }
31442
+ if (!result && storageKey2) {
31443
+ const stored = getStoredSelection(storageKey2);
31444
+ if (stored) {
31445
+ result = resolveFromStorage(tokens, stored);
31446
+ }
31447
+ }
31448
+ if (!result) {
31449
+ result = resolveToken(tokens);
31450
+ }
30823
31451
  if (result) {
30824
- setToken(result.token.symbol);
30825
- setChain(getChainKey(result.chain.chain_id, result.chain.chain_type));
31452
+ setTokenState(result.token.symbol);
31453
+ setChainState(getChainKey(result.chain.chain_id, result.chain.chain_type));
30826
31454
  appliedDefaultsRef.current = defaultsKey;
30827
31455
  setInitialSelectionDone(true);
30828
31456
  }
@@ -30832,7 +31460,8 @@ function useDefaultToken({
30832
31460
  defaultSymbol,
30833
31461
  defaultChainType,
30834
31462
  defaultChainId,
30835
- initialSelectionDone
31463
+ initialSelectionDone,
31464
+ storageKey2
30836
31465
  ]);
30837
31466
  useEffect292(() => {
30838
31467
  if (!tokens.length || !token) return;
@@ -30843,11 +31472,12 @@ function useDefaultToken({
30843
31472
  });
30844
31473
  if (!isChainAvailable) {
30845
31474
  const firstChain = currentToken.chains[0];
30846
- setChain(getChainKey(firstChain.chain_id, firstChain.chain_type));
31475
+ setChainState(getChainKey(firstChain.chain_id, firstChain.chain_type));
30847
31476
  }
30848
31477
  }, [token, tokens, chain]);
30849
31478
  return { token, chain, setToken, setChain, initialSelectionDone };
30850
31479
  }
31480
+ var STORAGE_KEY2 = "unifold_last_deposit_from_token";
30851
31481
  function useDefaultSourceToken({
30852
31482
  supportedTokens,
30853
31483
  defaultSourceChainType,
@@ -30860,7 +31490,8 @@ function useDefaultSourceToken({
30860
31490
  defaultChainType: defaultSourceChainType,
30861
31491
  defaultChainId: defaultSourceChainId,
30862
31492
  defaultTokenAddress: defaultSourceTokenAddress,
30863
- defaultSymbol: defaultSourceSymbol
31493
+ defaultSymbol: defaultSourceSymbol,
31494
+ storageKey: STORAGE_KEY2
30864
31495
  });
30865
31496
  }
30866
31497
  function DepositFooterLinks({ onGlossaryClick, leftElement }) {
@@ -31143,14 +31774,14 @@ function useCopyAddress() {
31143
31774
  return { copied, handleCopy };
31144
31775
  }
31145
31776
  var TooltipProvider2 = Provider;
31146
- var TooltipContext = React322.createContext({
31777
+ var TooltipContext = React332.createContext({
31147
31778
  open: false,
31148
31779
  onOpenChange: () => {
31149
31780
  }
31150
31781
  });
31151
- var TooltipTrigger2 = React322.forwardRef(({ onClick, ...props }, ref) => {
31152
- const { open, onOpenChange } = React322.useContext(TooltipContext);
31153
- const handleClick = React322.useCallback(
31782
+ var TooltipTrigger2 = React332.forwardRef(({ onClick, ...props }, ref) => {
31783
+ const { open, onOpenChange } = React332.useContext(TooltipContext);
31784
+ const handleClick = React332.useCallback(
31154
31785
  (e) => {
31155
31786
  onOpenChange(!open);
31156
31787
  onClick?.(e);
@@ -31160,7 +31791,7 @@ var TooltipTrigger2 = React322.forwardRef(({ onClick, ...props }, ref) => {
31160
31791
  return /* @__PURE__ */ jsx522(Trigger, { ref, onClick: handleClick, ...props });
31161
31792
  });
31162
31793
  TooltipTrigger2.displayName = Trigger.displayName;
31163
- var TooltipContent2 = React322.forwardRef(({ className, sideOffset = 4, ...props }, ref) => {
31794
+ var TooltipContent2 = React332.forwardRef(({ className, sideOffset = 4, ...props }, ref) => {
31164
31795
  const { themeClass, colors: colors2 } = useTheme();
31165
31796
  return /* @__PURE__ */ jsx522(Portal3, { children: /* @__PURE__ */ jsx522(
31166
31797
  Content22,
@@ -31191,7 +31822,7 @@ function useHypercoreActivation(params) {
31191
31822
  const recipient = recipientAddress?.trim() ?? "";
31192
31823
  const source = sourceAddress?.trim() ?? "";
31193
31824
  const hasAddresses = !!recipient && !!source;
31194
- const { data, isLoading } = useQuery14({
31825
+ const { data, isLoading } = useQuery16({
31195
31826
  queryKey: ["unifold", "hypercoreActivation", source, recipient, publishableKey],
31196
31827
  queryFn: () => checkHypercoreActivation(
31197
31828
  {
@@ -31270,6 +31901,7 @@ function TransferCryptoSingleInput({
31270
31901
  onDepositError,
31271
31902
  wallets: externalWallets,
31272
31903
  onSourceTokenChange,
31904
+ prefilledAmountUsd,
31273
31905
  checkoutQuote,
31274
31906
  isCheckoutQuoteLoading = false,
31275
31907
  persistCheckingIndicator = false,
@@ -31317,7 +31949,7 @@ function TransferCryptoSingleInput({
31317
31949
  const wallets = externalWallets?.length ? externalWallets : depositAddressResponse?.data ?? [];
31318
31950
  const loading = externalWallets?.length ? false : walletsLoading;
31319
31951
  const error = walletsError?.message ?? null;
31320
- const allAvailableChains = useMemo102(() => {
31952
+ const allAvailableChains = useMemo112(() => {
31321
31953
  const chainsMap = /* @__PURE__ */ new Map();
31322
31954
  supportedTokens.forEach((t13) => {
31323
31955
  t13.chains.forEach((c) => {
@@ -31413,6 +32045,22 @@ function TransferCryptoSingleInput({
31413
32045
  const maxSlippage = currentChainFromBackend?.max_slippage_percent ?? 0.25;
31414
32046
  const processingTime = currentChainFromBackend?.estimated_processing_time ?? null;
31415
32047
  const minDepositUsd = currentChainFromBackend?.minimum_deposit_amount_usd ?? 3;
32048
+ const parsedPrefilledUsd = useMemo112(() => {
32049
+ const value = parseFloat(prefilledAmountUsd ?? "");
32050
+ return Number.isFinite(value) && value > 0 ? value : null;
32051
+ }, [prefilledAmountUsd]);
32052
+ const effectivePrefilledUsd = useMemo112(() => {
32053
+ if (parsedPrefilledUsd === null) return null;
32054
+ return Math.max(parsedPrefilledUsd, minDepositUsd);
32055
+ }, [parsedPrefilledUsd, minDepositUsd]);
32056
+ const prefillDisplay = useMemo112(() => {
32057
+ if (effectivePrefilledUsd === null) return null;
32058
+ const usdLabel = `$${effectivePrefilledUsd.toFixed(2)}`;
32059
+ if (selectedToken?.is_stablecoin) {
32060
+ return `${effectivePrefilledUsd.toFixed(2)} ${selectedToken.symbol} (${usdLabel})`;
32061
+ }
32062
+ return `${usdLabel} USD`;
32063
+ }, [effectivePrefilledUsd, selectedToken]);
31416
32064
  return /* @__PURE__ */ jsx54(TooltipProvider2, { delayDuration: 0, skipDelayDuration: 0, children: /* @__PURE__ */ jsxs49(
31417
32065
  "div",
31418
32066
  {
@@ -31539,7 +32187,7 @@ function TransferCryptoSingleInput({
31539
32187
  /* @__PURE__ */ jsx54("span", { children: "Retrying automatically every 5 seconds..." })
31540
32188
  ] })
31541
32189
  ] }),
31542
- (checkoutQuote || isCheckoutQuoteLoading) && /* @__PURE__ */ jsxs49(
32190
+ (checkoutQuote || isCheckoutQuoteLoading || prefillDisplay) && /* @__PURE__ */ jsxs49(
31543
32191
  "div",
31544
32192
  {
31545
32193
  className: "uf-rounded-xl uf-px-3 uf-py-2 uf-flex uf-items-center uf-justify-between",
@@ -31583,6 +32231,13 @@ function TransferCryptoSingleInput({
31583
32231
  )
31584
32232
  ]
31585
32233
  }
32234
+ ) : prefillDisplay ? /* @__PURE__ */ jsx54(
32235
+ "span",
32236
+ {
32237
+ className: "uf-text-sm uf-font-semibold",
32238
+ style: { color: components.card.titleColor, fontFamily: fonts.semibold },
32239
+ children: prefillDisplay
32240
+ }
31586
32241
  ) : /* @__PURE__ */ jsx54(
31587
32242
  "div",
31588
32243
  {
@@ -31912,7 +32567,7 @@ function TransferCryptoSingleInput({
31912
32567
  }
31913
32568
  var Select2 = Root23;
31914
32569
  var SelectValue2 = Value;
31915
- var SelectTrigger2 = React332.forwardRef(({ className, style, children, ...props }, ref) => {
32570
+ var SelectTrigger2 = React342.forwardRef(({ className, style, children, ...props }, ref) => {
31916
32571
  const { components } = useTheme();
31917
32572
  return /* @__PURE__ */ jsxs50(
31918
32573
  Trigger2,
@@ -31936,7 +32591,7 @@ var SelectTrigger2 = React332.forwardRef(({ className, style, children, ...props
31936
32591
  );
31937
32592
  });
31938
32593
  SelectTrigger2.displayName = Trigger2.displayName;
31939
- var SelectScrollUpButton2 = React332.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
32594
+ var SelectScrollUpButton2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
31940
32595
  ScrollUpButton,
31941
32596
  {
31942
32597
  ref,
@@ -31946,7 +32601,7 @@ var SelectScrollUpButton2 = React332.forwardRef(({ className, ...props }, ref) =
31946
32601
  }
31947
32602
  ));
31948
32603
  SelectScrollUpButton2.displayName = ScrollUpButton.displayName;
31949
- var SelectScrollDownButton2 = React332.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
32604
+ var SelectScrollDownButton2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
31950
32605
  ScrollDownButton,
31951
32606
  {
31952
32607
  ref,
@@ -31956,7 +32611,7 @@ var SelectScrollDownButton2 = React332.forwardRef(({ className, ...props }, ref)
31956
32611
  }
31957
32612
  ));
31958
32613
  SelectScrollDownButton2.displayName = ScrollDownButton.displayName;
31959
- var SelectContent2 = React332.forwardRef(({ className, style, children, position = "popper", ...props }, ref) => {
32614
+ var SelectContent2 = React342.forwardRef(({ className, style, children, position = "popper", ...props }, ref) => {
31960
32615
  const { themeClass, colors: colors2, components } = useTheme();
31961
32616
  return /* @__PURE__ */ jsx55(Portal4, { children: /* @__PURE__ */ jsxs50(
31962
32617
  Content23,
@@ -31994,7 +32649,7 @@ var SelectContent2 = React332.forwardRef(({ className, style, children, position
31994
32649
  ) });
31995
32650
  });
31996
32651
  SelectContent2.displayName = Content23.displayName;
31997
- var SelectLabel2 = React332.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
32652
+ var SelectLabel2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
31998
32653
  Label,
31999
32654
  {
32000
32655
  ref,
@@ -32003,7 +32658,7 @@ var SelectLabel2 = React332.forwardRef(({ className, ...props }, ref) => /* @__P
32003
32658
  }
32004
32659
  ));
32005
32660
  SelectLabel2.displayName = Label.displayName;
32006
- var SelectItem2 = React332.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs50(
32661
+ var SelectItem2 = React342.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs50(
32007
32662
  Item,
32008
32663
  {
32009
32664
  ref,
@@ -32019,7 +32674,7 @@ var SelectItem2 = React332.forwardRef(({ className, children, ...props }, ref) =
32019
32674
  }
32020
32675
  ));
32021
32676
  SelectItem2.displayName = Item.displayName;
32022
- var SelectSeparator2 = React332.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
32677
+ var SelectSeparator2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
32023
32678
  Separator,
32024
32679
  {
32025
32680
  ref,
@@ -32047,6 +32702,7 @@ function TransferCryptoDoubleInput({
32047
32702
  defaultSourceChainId,
32048
32703
  defaultSourceTokenAddress,
32049
32704
  defaultSourceSymbol,
32705
+ prefilledAmountUsd,
32050
32706
  depositConfirmationMode = "auto_ui",
32051
32707
  onExecutionsChange,
32052
32708
  onDepositSuccess,
@@ -32093,7 +32749,7 @@ function TransferCryptoDoubleInput({
32093
32749
  const wallets = externalWallets?.length ? externalWallets : depositAddressResponse?.data ?? [];
32094
32750
  const loading = externalWallets?.length ? false : walletsLoading;
32095
32751
  const error = walletsError?.message ?? null;
32096
- const allAvailableChains = useMemo112(() => {
32752
+ const allAvailableChains = useMemo122(() => {
32097
32753
  const chainsMap = /* @__PURE__ */ new Map();
32098
32754
  supportedTokens.forEach((t13) => {
32099
32755
  t13.chains.forEach((c) => {
@@ -32171,6 +32827,22 @@ function TransferCryptoDoubleInput({
32171
32827
  const maxSlippage = currentChainFromBackend?.max_slippage_percent ?? 0.25;
32172
32828
  const processingTime = currentChainFromBackend?.estimated_processing_time ?? null;
32173
32829
  const minDepositUsd = currentChainFromBackend?.minimum_deposit_amount_usd ?? 3;
32830
+ const parsedPrefilledUsd = useMemo122(() => {
32831
+ const value = parseFloat(prefilledAmountUsd ?? "");
32832
+ return Number.isFinite(value) && value > 0 ? value : null;
32833
+ }, [prefilledAmountUsd]);
32834
+ const effectivePrefilledUsd = useMemo122(() => {
32835
+ if (parsedPrefilledUsd === null) return null;
32836
+ return Math.max(parsedPrefilledUsd, minDepositUsd);
32837
+ }, [parsedPrefilledUsd, minDepositUsd]);
32838
+ const prefillDisplay = useMemo122(() => {
32839
+ if (effectivePrefilledUsd === null) return null;
32840
+ const usdLabel = `$${effectivePrefilledUsd.toFixed(2)}`;
32841
+ if (selectedToken?.is_stablecoin) {
32842
+ return `${effectivePrefilledUsd.toFixed(2)} ${selectedToken.symbol} (${usdLabel})`;
32843
+ }
32844
+ return `${usdLabel} USD`;
32845
+ }, [effectivePrefilledUsd, selectedToken]);
32174
32846
  const renderTokenItem = (tokenData) => {
32175
32847
  return /* @__PURE__ */ jsxs51("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
32176
32848
  /* @__PURE__ */ jsx56(
@@ -32351,6 +33023,35 @@ function TransferCryptoDoubleInput({
32351
33023
  /* @__PURE__ */ jsx56("span", { children: "Retrying automatically every 5 seconds..." })
32352
33024
  ] })
32353
33025
  ] }),
33026
+ prefillDisplay && /* @__PURE__ */ jsxs51(
33027
+ "div",
33028
+ {
33029
+ className: "uf-rounded-xl uf-px-3 uf-py-2 uf-flex uf-items-center uf-justify-between",
33030
+ style: {
33031
+ backgroundColor: components.card.backgroundColor,
33032
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`,
33033
+ borderRadius: components.card.borderRadius
33034
+ },
33035
+ children: [
33036
+ /* @__PURE__ */ jsx56(
33037
+ "span",
33038
+ {
33039
+ className: "uf-text-xs",
33040
+ style: { color: components.card.subtitleColor, fontFamily: fonts.regular },
33041
+ children: "You send"
33042
+ }
33043
+ ),
33044
+ /* @__PURE__ */ jsx56(
33045
+ "span",
33046
+ {
33047
+ className: "uf-text-sm uf-font-semibold",
33048
+ style: { color: components.card.titleColor, fontFamily: fonts.semibold },
33049
+ children: prefillDisplay
33050
+ }
33051
+ )
33052
+ ]
33053
+ }
33054
+ ),
32354
33055
  /* @__PURE__ */ jsxs51("div", { className: "uf-flex uf-flex-col uf-items-center uf-pt-2", children: [
32355
33056
  /* @__PURE__ */ jsx56(
32356
33057
  "div",
@@ -32689,7 +33390,7 @@ function useDepositQuote(params) {
32689
33390
  ...adjustForSlippage ? { adjust_for_slippage: true } : {},
32690
33391
  ...stablecoinParity ? { stablecoin_parity: true } : {}
32691
33392
  };
32692
- return useQuery15({
33393
+ return useQuery17({
32693
33394
  queryKey: [
32694
33395
  "unifold",
32695
33396
  "depositQuote",
@@ -32719,7 +33420,7 @@ function useExternalWallets({
32719
33420
  publishableKey,
32720
33421
  enabled = true
32721
33422
  }) {
32722
- const { data: wallets = [], isLoading } = useQuery16({
33423
+ const { data: wallets = [], isLoading } = useQuery18({
32723
33424
  queryKey: ["unifold", "external-wallets", publishableKey],
32724
33425
  queryFn: () => getExternalWallets(publishableKey).then((res) => res.data),
32725
33426
  enabled: enabled && !!publishableKey,
@@ -33802,33 +34503,11 @@ function balancesRepresentSameToken(a, b) {
33802
34503
  if (!tokenA || !tokenB) return false;
33803
34504
  return tokenA.chain_type === tokenB.chain_type && tokenA.chain_id === tokenB.chain_id && normalizeTokenAddress(tokenA.token_address) === normalizeTokenAddress(tokenB.token_address);
33804
34505
  }
33805
- function getSolanaProviders() {
33806
- if (typeof window === "undefined") return {};
33807
- const win = window;
33808
- return {
33809
- phantomSolana: win.phantom?.solana,
33810
- solflare: win.solflare,
33811
- backpack: win.backpack,
33812
- glow: win.glow,
33813
- coinbaseSolana: win.coinbaseSolana || win.coinbaseWalletExtension?.solana
33814
- };
33815
- }
33816
- function getLegacyEvmProviders() {
33817
- if (typeof window === "undefined") return {};
33818
- const win = window;
33819
- return {
33820
- ethereum: win.ethereum,
33821
- phantomEthereum: win.phantom?.ethereum,
33822
- coinbaseEthereum: win.coinbaseWalletExtension,
33823
- trustEthereum: win.trustwallet?.ethereum,
33824
- okxEthereum: win.okxwallet
33825
- };
33826
- }
33827
34506
  function detectAvailableWallets(definitions, recentWalletId, filterChainType) {
33828
- const solProviders = getSolanaProviders();
33829
- const legacyEvm = getLegacyEvmProviders();
33830
- const eip6963List = getEip6963Providers();
33831
34507
  const win = typeof window !== "undefined" ? window : null;
34508
+ const solProviders = getInjectedSolanaProviders(win);
34509
+ const legacyEvm = getLegacyEvmProviders(win);
34510
+ const eip6963List = getEip6963Providers();
33832
34511
  const hasEip6963 = (walletId) => eip6963List.some((d) => {
33833
34512
  const rdns = d.info?.rdns || "";
33834
34513
  switch (walletId) {
@@ -33938,7 +34617,7 @@ function WalletConnect({
33938
34617
  amountQuickSelect = "percentage",
33939
34618
  onWalletDisconnect,
33940
34619
  onWalletConnected,
33941
- prefillAmountUsd,
34620
+ prefilledAmountUsd,
33942
34621
  checkoutAmountUsd,
33943
34622
  checkoutReceivedUsd,
33944
34623
  onNewDeposit,
@@ -33960,28 +34639,28 @@ function WalletConnect({
33960
34639
  onExecutionsChange
33961
34640
  }) {
33962
34641
  const { colors: colors2, fonts, components, mode } = useTheme();
33963
- const walletProvidedAtMount = React342.useRef(!!initialWalletInfo && !!initialDepositWallet);
33964
- const [activeWalletInfo, setActiveWalletInfo] = React342.useState(
34642
+ const walletProvidedAtMount = React352.useRef(!!initialWalletInfo && !!initialDepositWallet);
34643
+ const [activeWalletInfo, setActiveWalletInfo] = React352.useState(
33965
34644
  initialWalletInfo ?? null
33966
34645
  );
33967
- const [activeDepositWallet, setActiveDepositWallet] = React342.useState(
34646
+ const [activeDepositWallet, setActiveDepositWallet] = React352.useState(
33968
34647
  initialDepositWallet ?? null
33969
34648
  );
33970
34649
  const initialView = initialWalletInfo && initialDepositWallet ? "select_token" : "select_wallet";
33971
- const [view, setView] = React342.useState(initialView);
33972
- const [isTransitioning, setIsTransitioning] = React342.useState(false);
33973
- const viewRef = React342.useRef(initialView);
34650
+ const [view, setView] = React352.useState(initialView);
34651
+ const [isTransitioning, setIsTransitioning] = React352.useState(false);
34652
+ const viewRef = React352.useRef(initialView);
33974
34653
  const standalone = !canGoBack && !walletProvidedAtMount.current;
33975
34654
  const { wallet: detectedWallet, isLoading: detectingWallet } = useDetectedBrowserWallet({
33976
34655
  enabled: standalone
33977
34656
  });
33978
- const [autoResolved, setAutoResolved] = React342.useState(false);
33979
- const [selectedWalletDef, setSelectedWalletDef] = React342.useState(null);
33980
- const [connectingNetwork, setConnectingNetwork] = React342.useState(null);
33981
- const [walletError, setWalletError] = React342.useState(null);
33982
- const [isWalletConnecting, setIsWalletConnecting] = React342.useState(false);
33983
- const [eip6963ProviderCount, setEip6963ProviderCount] = React342.useState(0);
33984
- React342.useEffect(() => {
34657
+ const [autoResolved, setAutoResolved] = React352.useState(false);
34658
+ const [selectedWalletDef, setSelectedWalletDef] = React352.useState(null);
34659
+ const [connectingNetwork, setConnectingNetwork] = React352.useState(null);
34660
+ const [walletError, setWalletError] = React352.useState(null);
34661
+ const [isWalletConnecting, setIsWalletConnecting] = React352.useState(false);
34662
+ const [eip6963ProviderCount, setEip6963ProviderCount] = React352.useState(0);
34663
+ React352.useEffect(() => {
33985
34664
  const store = getEip6963Store();
33986
34665
  if (!store) return;
33987
34666
  setEip6963ProviderCount(store.getProviders().length);
@@ -33990,7 +34669,7 @@ function WalletConnect({
33990
34669
  });
33991
34670
  }, []);
33992
34671
  const { wallets: backendWallets } = useExternalWallets({ publishableKey });
33993
- const walletDefinitions = React342.useMemo(
34672
+ const walletDefinitions = React352.useMemo(
33994
34673
  () => backendWallets.length > 0 ? backendWallets.map((w) => ({
33995
34674
  id: w.id,
33996
34675
  name: w.name,
@@ -34001,32 +34680,32 @@ function WalletConnect({
34001
34680
  })) : FALLBACK_WALLET_DEFINITIONS,
34002
34681
  [backendWallets]
34003
34682
  );
34004
- const [recentWalletId, setRecentWalletIdState] = React342.useState(getLastOpenedWallet);
34005
- React342.useEffect(() => {
34683
+ const [recentWalletId, setRecentWalletIdState] = React352.useState(getLastOpenedWallet);
34684
+ React352.useEffect(() => {
34006
34685
  if (view === "select_wallet") {
34007
34686
  setRecentWalletIdState(getLastOpenedWallet());
34008
34687
  }
34009
34688
  }, [view]);
34010
- const availableWallets = React342.useMemo(
34689
+ const availableWallets = React352.useMemo(
34011
34690
  () => detectAvailableWallets(walletDefinitions, recentWalletId),
34012
34691
  [walletDefinitions, eip6963ProviderCount, recentWalletId]
34013
34692
  );
34014
- const [isMobile, setIsMobile] = React342.useState(false);
34015
- React342.useEffect(() => {
34693
+ const [isMobile, setIsMobile] = React352.useState(false);
34694
+ React352.useEffect(() => {
34016
34695
  setIsMobile(isMobileDevice());
34017
34696
  }, []);
34018
- const mobileDepositAddresses = React342.useMemo(
34697
+ const mobileDepositAddresses = React352.useMemo(
34019
34698
  () => (depositWallets ?? []).map((w) => ({ chain_type: w.chain_type, address: w.address })),
34020
34699
  [depositWallets]
34021
34700
  );
34022
- const mobileDepositWalletIds = React342.useMemo(
34701
+ const mobileDepositWalletIds = React352.useMemo(
34023
34702
  () => (depositWallets ?? []).filter((w) => w.chain_type === "ethereum" || w.chain_type === "solana").map((w) => w.id),
34024
34703
  [depositWallets]
34025
34704
  );
34026
- const [mobileRedirect, setMobileRedirect] = React342.useState(null);
34027
- const [pendingMobileWallet, setPendingMobileWallet] = React342.useState(null);
34028
- const [awaitingMobileDeposit, setAwaitingMobileDeposit] = React342.useState(false);
34029
- React342.useEffect(() => {
34705
+ const [mobileRedirect, setMobileRedirect] = React352.useState(null);
34706
+ const [pendingMobileWallet, setPendingMobileWallet] = React352.useState(null);
34707
+ const [awaitingMobileDeposit, setAwaitingMobileDeposit] = React352.useState(false);
34708
+ React352.useEffect(() => {
34030
34709
  if (!standalone || autoResolved || detectingWallet) return;
34031
34710
  if (!detectedWallet) {
34032
34711
  setAutoResolved(true);
@@ -34052,32 +34731,36 @@ function WalletConnect({
34052
34731
  depositWallets,
34053
34732
  depositWalletsLoading
34054
34733
  ]);
34055
- React342.useEffect(() => {
34734
+ React352.useEffect(() => {
34056
34735
  if (!standalone || autoResolved) return;
34057
34736
  const t13 = setTimeout(() => setAutoResolved(true), 5e3);
34058
34737
  return () => clearTimeout(t13);
34059
34738
  }, [standalone, autoResolved]);
34060
- const [balances, setBalances] = React342.useState([]);
34061
- const [isLoading, setIsLoading] = React342.useState(false);
34062
- const [selectedBalance, setSelectedBalance] = React342.useState(null);
34063
- const [totalBalanceUsd, setTotalBalanceUsd] = React342.useState(null);
34064
- const [error, setError] = React342.useState(null);
34065
- const [isDisconnectingWallet, setIsDisconnectingWallet] = React342.useState(false);
34066
- const [amountUsd, setAmountUsd] = React342.useState(prefillAmountUsd ?? "");
34067
- const [isConfirming, setIsConfirming] = React342.useState(false);
34068
- const [hasSignedTransaction, setHasSignedTransaction] = React342.useState(false);
34069
- const [tokenChainDetails, setTokenChainDetails] = React342.useState(null);
34070
- const [loadingTokenDetails, setLoadingTokenDetails] = React342.useState(false);
34071
- const [showTransactionDetails, setShowTransactionDetails] = React342.useState(false);
34072
- const [receivedUsdAtSubmission, setReceivedUsdAtSubmission] = React342.useState(null);
34739
+ const [balances, setBalances] = React352.useState([]);
34740
+ const [isLoading, setIsLoading] = React352.useState(false);
34741
+ const [selectedBalance, setSelectedBalance] = React352.useState(null);
34742
+ const [totalBalanceUsd, setTotalBalanceUsd] = React352.useState(null);
34743
+ const [error, setError] = React352.useState(null);
34744
+ const [isDisconnectingWallet, setIsDisconnectingWallet] = React352.useState(false);
34745
+ const [amountUsd, setAmountUsd] = React352.useState(prefilledAmountUsd ?? "");
34746
+ const [isConfirming, setIsConfirming] = React352.useState(false);
34747
+ const [hasSignedTransaction, setHasSignedTransaction] = React352.useState(false);
34748
+ const [tokenChainDetails, setTokenChainDetails] = React352.useState(null);
34749
+ const [loadingTokenDetails, setLoadingTokenDetails] = React352.useState(false);
34750
+ const [showTransactionDetails, setShowTransactionDetails] = React352.useState(false);
34751
+ const [receivedUsdAtSubmission, setReceivedUsdAtSubmission] = React352.useState(null);
34073
34752
  const walletInfo = activeWalletInfo;
34074
34753
  const depositWallet = activeDepositWallet;
34075
34754
  const hasWallet = !!activeWalletInfo && !!activeDepositWallet;
34755
+ React352.useEffect(() => {
34756
+ const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
34757
+ setAmountUsd(cleanedPrefilled);
34758
+ }, [prefilledAmountUsd]);
34076
34759
  const chainType = activeDepositWallet?.chain_type ?? "ethereum";
34077
34760
  const recipientAddress = activeDepositWallet?.address ?? "";
34078
34761
  const isCheckoutMode = !!checkoutAmountUsd;
34079
34762
  const supportedChainType = chainType === "algorand" || chainType === "xrpl" || chainType === "cardano" || chainType === "n1" ? "ethereum" : chainType;
34080
- const transitionTo = React342.useCallback((nextView) => {
34763
+ const transitionTo = React352.useCallback((nextView) => {
34081
34764
  if (nextView === viewRef.current) return;
34082
34765
  setIsTransitioning(true);
34083
34766
  setTimeout(() => {
@@ -34093,10 +34776,13 @@ function WalletConnect({
34093
34776
  };
34094
34777
  const openMobileWalletBrowse = async (wallet, depositAddresses) => {
34095
34778
  try {
34779
+ const cleanedAmountUsd = amountUsd?.replace(/[^0-9.]/g, "") ?? "";
34780
+ const forwardedAmountUsd = parseFloat(cleanedAmountUsd) > 0 ? cleanedAmountUsd : void 0;
34096
34781
  const res = await getWalletMobileDeepLink(
34097
34782
  wallet.id,
34098
34783
  depositAddresses,
34099
- publishableKey
34784
+ publishableKey,
34785
+ forwardedAmountUsd
34100
34786
  );
34101
34787
  if (res.deeplink) {
34102
34788
  setMobileRedirect({ walletId: wallet.id, walletName: wallet.name, deeplink: res.deeplink });
@@ -34142,7 +34828,7 @@ function WalletConnect({
34142
34828
  if (!selectedWalletDef) return;
34143
34829
  handleConnectWallet(selectedWalletDef, network);
34144
34830
  };
34145
- React342.useEffect(() => {
34831
+ React352.useEffect(() => {
34146
34832
  if (!pendingMobileWallet) return;
34147
34833
  if (mobileDepositAddresses.length > 0) {
34148
34834
  const wallet = pendingMobileWallet;
@@ -34185,7 +34871,7 @@ function WalletConnect({
34185
34871
  const eip6963Match = findProviderByWalletId(wallet.id);
34186
34872
  let provider = eip6963Match?.provider;
34187
34873
  if (!provider) {
34188
- const legacyEvm = getLegacyEvmProviders();
34874
+ const legacyEvm = getLegacyEvmProviders(win);
34189
34875
  switch (wallet.id) {
34190
34876
  case "metamask":
34191
34877
  if (legacyEvm.ethereum?.isMetaMask && !legacyEvm.ethereum?.isPhantom)
@@ -34217,16 +34903,7 @@ function WalletConnect({
34217
34903
  const accounts = await provider.request({ method: "eth_requestAccounts" });
34218
34904
  if (!accounts?.length) throw new Error("No accounts returned from wallet");
34219
34905
  setUserDisconnectedWallet(false);
34220
- const walletIdToType = {
34221
- phantom: "phantom-ethereum",
34222
- coinbase: "coinbase",
34223
- trust: "trust",
34224
- rainbow: "rainbow",
34225
- rabby: "rabby",
34226
- okx: "okx",
34227
- metamask: "metamask"
34228
- };
34229
- const walletType = walletIdToType[wallet.id] || "metamask";
34906
+ const walletType = walletIdToWalletType(wallet.id);
34230
34907
  setStoredWalletState(walletType);
34231
34908
  connectedInfo = {
34232
34909
  type: walletType,
@@ -34235,7 +34912,7 @@ function WalletConnect({
34235
34912
  icon: wallet.id
34236
34913
  };
34237
34914
  } else {
34238
- const solProviders = getSolanaProviders();
34915
+ const solProviders = getInjectedSolanaProviders(win);
34239
34916
  let provider;
34240
34917
  switch (wallet.id) {
34241
34918
  case "phantom":
@@ -34254,11 +34931,11 @@ function WalletConnect({
34254
34931
  provider = solProviders.coinbaseSolana || win?.coinbaseWalletExtension?.solana;
34255
34932
  break;
34256
34933
  case "trust":
34257
- provider = win?.trustwallet?.solana;
34934
+ provider = solProviders.trustSolana;
34258
34935
  break;
34259
34936
  }
34260
34937
  if (!provider) throw new Error(`${wallet.name} Solana wallet not found.`);
34261
- const response = await provider.connect();
34938
+ const response = await connectSolanaProviderWithRecovery(provider, wallet.id, wallet.name);
34262
34939
  setUserDisconnectedWallet(false);
34263
34940
  const walletType = wallet.id === "solflare" ? "solflare" : wallet.id === "backpack" ? "backpack" : wallet.id === "glow" ? "glow" : "phantom-solana";
34264
34941
  setStoredWalletState(walletType);
@@ -34306,7 +34983,7 @@ function WalletConnect({
34306
34983
  publishableKey,
34307
34984
  enabled: !!activeWalletInfo && !!recipientAddress
34308
34985
  });
34309
- const effectiveDestinationAmount = React342.useMemo(() => {
34986
+ const effectiveDestinationAmount = React352.useMemo(() => {
34310
34987
  if (!checkoutRemainingBaseUnits || checkoutRemainingBaseUnits === "0") return "0";
34311
34988
  if (!checkoutAmountUsd) return checkoutRemainingBaseUnits;
34312
34989
  const remaining = BigInt(checkoutRemainingBaseUnits);
@@ -34334,7 +35011,7 @@ function WalletConnect({
34334
35011
  stablecoinParity,
34335
35012
  enabled: isCheckoutMode && !!selectedToken && !!checkoutDestination && effectiveDestinationAmount !== "0"
34336
35013
  });
34337
- const activeCheckoutQuote = React342.useMemo(() => {
35014
+ const activeCheckoutQuote = React352.useMemo(() => {
34338
35015
  if (!isCheckoutMode) return null;
34339
35016
  if (walletCheckoutQuote)
34340
35017
  return {
@@ -34364,10 +35041,10 @@ function WalletConnect({
34364
35041
  onDepositSuccess,
34365
35042
  onDepositError
34366
35043
  });
34367
- React342.useEffect(() => {
35044
+ React352.useEffect(() => {
34368
35045
  onExecutionsChange?.(depositExecutions);
34369
35046
  }, [depositExecutions, onExecutionsChange]);
34370
- const latestDepositExecution = React342.useMemo(() => {
35047
+ const latestDepositExecution = React352.useMemo(() => {
34371
35048
  if (depositExecutions.length === 0) return null;
34372
35049
  return [...depositExecutions].sort((a, b) => {
34373
35050
  const ta = a.created_at ? new Date(a.created_at).getTime() : 0;
@@ -34375,21 +35052,21 @@ function WalletConnect({
34375
35052
  return tb - ta;
34376
35053
  })[0];
34377
35054
  }, [depositExecutions]);
34378
- React342.useEffect(() => {
35055
+ React352.useEffect(() => {
34379
35056
  if (awaitingMobileDeposit && latestDepositExecution && (viewRef.current === "mobile_redirect" || viewRef.current === "connecting")) {
34380
35057
  transitionTo("mobile_deposit_status");
34381
35058
  }
34382
35059
  }, [awaitingMobileDeposit, latestDepositExecution, transitionTo]);
34383
- React342.useEffect(() => {
34384
- if (!prefillAmountUsd || !tokenChainDetails || view !== "enter_amount") return;
35060
+ React352.useEffect(() => {
35061
+ if (!isCheckoutMode || !tokenChainDetails || view !== "enter_amount") return;
34385
35062
  const minDeposit = tokenChainDetails.minimum_deposit_amount_usd || 0;
34386
35063
  const currentAmount = parseFloat(amountUsd) || 0;
34387
35064
  if (currentAmount > 0 && currentAmount < minDeposit) setAmountUsd(minDeposit.toFixed(2));
34388
- }, [tokenChainDetails, view, prefillAmountUsd]);
34389
- React342.useEffect(() => {
35065
+ }, [isCheckoutMode, tokenChainDetails, view, amountUsd]);
35066
+ React352.useEffect(() => {
34390
35067
  if (view === "review") setShowTransactionDetails(false);
34391
35068
  }, [view]);
34392
- React342.useEffect(() => {
35069
+ React352.useEffect(() => {
34393
35070
  if (view !== "enter_amount" && view !== "review" || !selectedBalance || !activeDepositWallet)
34394
35071
  return;
34395
35072
  let cancelled = false;
@@ -34426,7 +35103,7 @@ function WalletConnect({
34426
35103
  cancelled = true;
34427
35104
  };
34428
35105
  }, [view, selectedBalance, publishableKey, activeDepositWallet]);
34429
- React342.useEffect(() => {
35106
+ React352.useEffect(() => {
34430
35107
  if (!activeWalletInfo || !activeDepositWallet) return;
34431
35108
  let cancelled = false;
34432
35109
  setIsLoading(true);
@@ -34491,21 +35168,21 @@ function WalletConnect({
34491
35168
  defaultSourceTokenAddress,
34492
35169
  defaultSourceSymbol
34493
35170
  ]);
34494
- const usdToTokenRate = React342.useMemo(() => {
35171
+ const usdToTokenRate = React352.useMemo(() => {
34495
35172
  if (!selectedBalance || !selectedBalance.amount_usd || !selectedToken) return 0;
34496
35173
  const balanceAmount = Number(selectedBalance.amount) / 10 ** selectedToken.decimals;
34497
35174
  const balanceUsd = parseFloat(selectedBalance.amount_usd);
34498
35175
  if (balanceAmount === 0 || balanceUsd === 0) return 0;
34499
35176
  return balanceAmount / balanceUsd;
34500
35177
  }, [selectedBalance, selectedToken]);
34501
- const tokenAmount = React342.useMemo(() => {
35178
+ const tokenAmount = React352.useMemo(() => {
34502
35179
  if (isCheckoutMode && activeCheckoutQuote && selectedToken)
34503
35180
  return Number(activeCheckoutQuote.sourceAmount) / 10 ** activeCheckoutQuote.sourceTokenDecimals;
34504
35181
  const usdNum = parseFloat(amountUsd) || 0;
34505
35182
  if (usdNum === 0 || usdToTokenRate === 0) return 0;
34506
35183
  return usdNum * usdToTokenRate;
34507
35184
  }, [amountUsd, usdToTokenRate, isCheckoutMode, activeCheckoutQuote, selectedToken]);
34508
- React342.useEffect(() => {
35185
+ React352.useEffect(() => {
34509
35186
  if (isCheckoutMode && activeCheckoutQuote?.sourceAmountUsd && view === "enter_amount")
34510
35187
  setAmountUsd(activeCheckoutQuote.sourceAmountUsd);
34511
35188
  }, [isCheckoutMode, activeCheckoutQuote, view]);
@@ -34514,7 +35191,7 @@ function WalletConnect({
34514
35191
  const inputUsdNum = parseFloat(amountUsd) || 0;
34515
35192
  const minDepositUsd = tokenChainDetails?.minimum_deposit_amount_usd || 0;
34516
35193
  const isValidAmount = isCheckoutMode && activeCheckoutQuote ? tokenAmount > 0 && tokenAmount <= maxTokenAmount : inputUsdNum > 0 && inputUsdNum <= maxUsdAmount && inputUsdNum >= minDepositUsd;
34517
- const formattedTokenAmount = React342.useMemo(() => {
35194
+ const formattedTokenAmount = React352.useMemo(() => {
34518
35195
  if (tokenAmount === 0 || !selectedToken) return null;
34519
35196
  return `${tokenAmount.toFixed(6)} ${selectedToken.symbol}`.replace(/\.?0+$/, "");
34520
35197
  }, [tokenAmount, selectedToken]);
@@ -34547,7 +35224,7 @@ function WalletConnect({
34547
35224
  break;
34548
35225
  case "enter_amount":
34549
35226
  transitionTo("select_token");
34550
- setAmountUsd(prefillAmountUsd ?? "");
35227
+ setAmountUsd(prefilledAmountUsd ?? "");
34551
35228
  setTokenChainDetails(null);
34552
35229
  break;
34553
35230
  case "review":
@@ -34579,7 +35256,7 @@ function WalletConnect({
34579
35256
  setSelectedBalance(null);
34580
35257
  setBalances([]);
34581
35258
  setTotalBalanceUsd(null);
34582
- setAmountUsd(prefillAmountUsd ?? "");
35259
+ setAmountUsd(prefilledAmountUsd ?? "");
34583
35260
  setError(null);
34584
35261
  };
34585
35262
  if (standalone) {
@@ -34609,16 +35286,7 @@ function WalletConnect({
34609
35286
  return (integerPart + decimalPart.padEnd(decimals, "0").slice(0, decimals)).replace(/^0+/, "") || "0";
34610
35287
  };
34611
35288
  const resolveEvmProvider = () => {
34612
- const walletIdMap = {
34613
- "phantom-ethereum": "phantom",
34614
- coinbase: "coinbase",
34615
- trust: "trust",
34616
- okx: "okx",
34617
- rainbow: "rainbow",
34618
- rabby: "rabby",
34619
- metamask: "metamask"
34620
- };
34621
- const lookupId = walletIdMap[walletInfo.type] || walletInfo.type;
35289
+ const lookupId = walletTypeToWalletId(walletInfo.type);
34622
35290
  const eip6963Match = findProviderByWalletId(lookupId);
34623
35291
  let provider = eip6963Match?.provider;
34624
35292
  if (!provider) {
@@ -35303,6 +35971,15 @@ function SkeletonButton({ variant = "default" }) {
35303
35971
  ] });
35304
35972
  }
35305
35973
  var t8 = i18n2.depositModal;
35974
+ function normalizePrefilledUsdAmount(value) {
35975
+ if (!value) return void 0;
35976
+ const cleaned = value.replace(/[^0-9.]/g, "");
35977
+ if (!cleaned) return void 0;
35978
+ const normalizedNumeric = cleaned.replace(/(\..*)\./g, "$1");
35979
+ const parsed = parseFloat(normalizedNumeric);
35980
+ if (!Number.isFinite(parsed) || parsed <= 0) return void 0;
35981
+ return parseFloat(parsed.toFixed(2)).toString();
35982
+ }
35306
35983
  function depositTabForScreen(screen) {
35307
35984
  return screen === "card" || screen === "cashapp" || screen === "bank_transfer" || screen === "stripe_link" || screen === "apple_pay" ? "cash" : "crypto";
35308
35985
  }
@@ -35322,6 +35999,7 @@ function DepositModal({
35322
35999
  defaultSourceChainId,
35323
36000
  defaultSourceTokenAddress,
35324
36001
  defaultSourceSymbol,
36002
+ prefilledAmountUsd,
35325
36003
  hideDepositTracker,
35326
36004
  showBalanceHeader = false,
35327
36005
  transferInputVariant = "double_input",
@@ -35337,6 +36015,7 @@ function DepositModal({
35337
36015
  applePayTitle = "Pay with Apple Pay",
35338
36016
  applePaySubTitle = "Instant",
35339
36017
  enableBankTransfer,
36018
+ enableIncidentBanner = false,
35340
36019
  // No default: left undefined so the backend `stripe_link.enabled` can govern
35341
36020
  // (via the `??` chain in showStripeLink) once a dashboard toggle exists.
35342
36021
  enableStripeLink,
@@ -35357,7 +36036,11 @@ function DepositModal({
35357
36036
  depositTrackerSubTitle = t8.depositTracker.subtitle
35358
36037
  }) {
35359
36038
  const { colors: colors2, fonts, components } = useTheme();
35360
- const onDepositSuccessFor = useCallback82(
36039
+ const normalizedPrefilledAmountUsd = useMemo14(
36040
+ () => normalizePrefilledUsdAmount(prefilledAmountUsd),
36041
+ [prefilledAmountUsd]
36042
+ );
36043
+ const onDepositSuccessFor = useCallback11(
35361
36044
  (method) => onDepositSuccess || onEvent ? (data) => {
35362
36045
  const payload = { ...data, method };
35363
36046
  onDepositSuccess?.(payload);
@@ -35370,15 +36053,15 @@ function DepositModal({
35370
36053
  } : void 0,
35371
36054
  [onDepositSuccess, onEvent]
35372
36055
  );
35373
- const onDepositErrorFor = useCallback82(
36056
+ const onDepositErrorFor = useCallback11(
35374
36057
  (method) => onDepositError ? (error) => onDepositError({ ...error, method }) : void 0,
35375
36058
  [onDepositError]
35376
36059
  );
35377
- const effectiveInitialScreen = useMemo13(() => {
36060
+ const effectiveInitialScreen = useMemo14(() => {
35378
36061
  const s = initialScreen ?? "main";
35379
36062
  if (s === "tracker" && hideDepositTracker === true) return "main";
35380
36063
  if (s === "cashapp" && enableCashApp === false) return "main";
35381
- if (s === "stripe_link" && !enableStripeLink) return "main";
36064
+ if (s === "stripe_link" && enableStripeLink === false) return "main";
35382
36065
  if (s === "apple_pay" && enableApplePay === false) return "main";
35383
36066
  if (s === "card" && enableFiatOnramp === false) return "main";
35384
36067
  if (s === "pay_with_exchange") return enablePayWithExchange === false ? "main" : "exchange";
@@ -35400,7 +36083,7 @@ function DepositModal({
35400
36083
  enableStripeLink
35401
36084
  ]);
35402
36085
  const [containerEl, setContainerEl] = useState40(null);
35403
- const containerCallbackRef = useCallback82((el) => {
36086
+ const containerCallbackRef = useCallback11((el) => {
35404
36087
  setContainerEl(el);
35405
36088
  }, []);
35406
36089
  const [view, setView] = useState40(effectiveInitialScreen);
@@ -35409,7 +36092,7 @@ function DepositModal({
35409
36092
  const [depositTab, setDepositTab] = useState40(
35410
36093
  () => depositTabForScreen(effectiveInitialScreen)
35411
36094
  );
35412
- const resetViewTimeoutRef = useRef122(null);
36095
+ const resetViewTimeoutRef = useRef132(null);
35413
36096
  const [cardView, setCardView] = useState40("amount");
35414
36097
  const [exchangeView, setExchangeView] = useState40("providers");
35415
36098
  const [browserWalletModalOpen, setBrowserWalletModalOpen] = useState40(false);
@@ -35437,6 +36120,16 @@ function DepositModal({
35437
36120
  const showApplePay = enableApplePay ?? projectConfig?.apple_pay?.enabled ?? true;
35438
36121
  const showBankTransfer = enableBankTransfer ?? projectConfig?.bank_transfer?.enabled ?? true;
35439
36122
  const showDepositTracker = hideDepositTracker ? false : projectConfig?.deposit_tracker?.enabled ?? true;
36123
+ const { incident: publicIncident } = usePublicIncident({
36124
+ publishableKey,
36125
+ enabled: open && enableIncidentBanner
36126
+ });
36127
+ const activeIncident = enableIncidentBanner && publicIncident?.enabled && (publicIncident.messages?.length ?? 0) > 0 ? {
36128
+ enabled: true,
36129
+ messages: publicIncident.messages,
36130
+ severity: publicIncident.severity,
36131
+ statusPageUrl: publicIncident.status_page_url
36132
+ } : void 0;
35440
36133
  const [integrationExchanges, setIntegrationExchanges] = useState40([]);
35441
36134
  useEffect34(() => {
35442
36135
  if (!showConnectExchange || !open) return;
@@ -35503,7 +36196,11 @@ function DepositModal({
35503
36196
  setConnectedExchange((prev) => prev ? { ...prev, iconUrl } : prev);
35504
36197
  }
35505
36198
  }, [integrationExchanges, connectedExchange]);
35506
- const { data: depositAddressResponse, isLoading: walletsLoading } = useDepositAddress({
36199
+ const {
36200
+ data: depositAddressResponse,
36201
+ isLoading: walletsLoading,
36202
+ error: walletsError
36203
+ } = useDepositAddress({
35507
36204
  userId,
35508
36205
  publishableKey,
35509
36206
  recipientAddress,
@@ -35636,6 +36333,7 @@ function DepositModal({
35636
36333
  const {
35637
36334
  isValid: isAddressValid,
35638
36335
  failureCode: addressFailureCode,
36336
+ message: addressFailureMessage,
35639
36337
  metadata: addressFailureMetadata,
35640
36338
  isLoading: isAddressValidationLoading
35641
36339
  } = useAddressValidation({
@@ -35649,17 +36347,31 @@ function DepositModal({
35649
36347
  refetchOnMount: "always"
35650
36348
  });
35651
36349
  const addressValidationMessages = i18n2.transferCrypto.addressValidation;
35652
- const getAddressValidationErrorMessage = (code, metadata) => {
36350
+ const getAddressValidationErrorMessage = (message, code, metadata) => {
36351
+ if (message && message.trim().length > 0) return message;
35653
36352
  if (!code) return addressValidationMessages.defaultError;
35654
36353
  const errors = addressValidationMessages.errors;
35655
36354
  const template = errors[code] ?? addressValidationMessages.defaultError;
35656
36355
  return interpolate(template, metadata);
35657
36356
  };
36357
+ const walletsRecipientError = isDepositAddressValidationError(walletsError) ? walletsError.message : null;
36358
+ const isRecipientAddressInvalid = isAddressValid === false || walletsRecipientError !== null;
36359
+ const recipientInvalidMessage = getAddressValidationErrorMessage(
36360
+ addressFailureMessage ?? walletsRecipientError,
36361
+ addressFailureCode,
36362
+ addressFailureMetadata
36363
+ );
35658
36364
  const openingScreen = effectiveInitialScreen;
35659
36365
  const sessionOpenedFromMenu = openingScreen === "main";
35660
36366
  const standaloneNeedsDepositPrereq = openingScreen !== "main" && (view === "transfer" || view === "card");
35661
36367
  let depositPrerequisiteBody;
35662
- if (isCountryLoading || isAddressValidationLoading || tokensLoading || walletsLoading || !projectConfig || // Bank-transfer row visibility depends on the country-gated providers
36368
+ if (isRecipientAddressInvalid) {
36369
+ depositPrerequisiteBody = /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
36370
+ /* @__PURE__ */ jsx63("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__ */ jsx63(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
36371
+ /* @__PURE__ */ jsx63("h3", { className: "uf-text-lg uf-font-semibold uf-text-foreground uf-mb-2", children: addressValidationMessages.unableToReceiveFunds }),
36372
+ /* @__PURE__ */ jsx63("p", { className: "uf-text-sm uf-text-muted-foreground uf-max-w-[280px]", children: recipientInvalidMessage })
36373
+ ] });
36374
+ } else if (isCountryLoading || isAddressValidationLoading || tokensLoading || walletsLoading || !projectConfig || // Bank-transfer row visibility depends on the country-gated providers
35663
36375
  // fetch — block the menu on it so the row never flashes in or out.
35664
36376
  showBankTransfer && bankTransferProvidersLoading || // Same for Apple Pay: row visibility depends on the geo/platform-gated
35665
36377
  // providers fetch — block the menu so the row doesn't pop in or out.
@@ -35681,12 +36393,6 @@ function DepositModal({
35681
36393
  /* @__PURE__ */ jsx63("h3", { className: "uf-text-lg uf-font-semibold uf-text-foreground uf-mb-2", children: "No Tokens Available" }),
35682
36394
  /* @__PURE__ */ jsx63("p", { className: "uf-text-sm uf-text-muted-foreground uf-max-w-[280px]", children: "There are no supported tokens available from your current location." })
35683
36395
  ] });
35684
- } else if (isAddressValid === false) {
35685
- depositPrerequisiteBody = /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
35686
- /* @__PURE__ */ jsx63("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__ */ jsx63(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
35687
- /* @__PURE__ */ jsx63("h3", { className: "uf-text-lg uf-font-semibold uf-text-foreground uf-mb-2", children: addressValidationMessages.unableToReceiveFunds }),
35688
- /* @__PURE__ */ jsx63("p", { className: "uf-text-sm uf-text-muted-foreground uf-max-w-[280px]", children: getAddressValidationErrorMessage(addressFailureCode, addressFailureMetadata) })
35689
- ] });
35690
36396
  } else {
35691
36397
  depositPrerequisiteBody = null;
35692
36398
  }
@@ -35753,7 +36459,7 @@ function DepositModal({
35753
36459
  );
35754
36460
  const [cashAppView, setCashAppView] = useState40("amount");
35755
36461
  const [stripeLinkStep, setStripeLinkStep] = useState40("amount");
35756
- const stripeLinkBackRef = useRef122(null);
36462
+ const stripeLinkBackRef = useRef132(null);
35757
36463
  useEffect34(() => {
35758
36464
  if (view === "stripe_link" && !showStripeLink && effectiveInitialScreen === "main") {
35759
36465
  setView("main");
@@ -35762,7 +36468,7 @@ function DepositModal({
35762
36468
  }, [view, showStripeLink, effectiveInitialScreen]);
35763
36469
  const [cashAppAmount, setCashAppAmount] = useState40("");
35764
36470
  const [applePayView, setApplePayView] = useState40("email_input");
35765
- const applePayHandleRef = useRef122(null);
36471
+ const applePayHandleRef = useRef132(null);
35766
36472
  const applePayHeaderTitle = (() => {
35767
36473
  switch (applePayView) {
35768
36474
  case "email_input":
@@ -36180,6 +36886,7 @@ function DepositModal({
36180
36886
  title: modalTitle || "Deposit",
36181
36887
  showClose: !hideOverlay,
36182
36888
  onClose: handleClose,
36889
+ incident: activeIncident,
36183
36890
  showBalance: showBalanceHeader,
36184
36891
  balanceAddress: recipientAddress,
36185
36892
  balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
@@ -36199,6 +36906,7 @@ function DepositModal({
36199
36906
  showBack: showBackTransfer,
36200
36907
  onBack: handleBack,
36201
36908
  onClose: handleClose,
36909
+ incident: activeIncident,
36202
36910
  showBalance: showBalanceHeader,
36203
36911
  balanceAddress: recipientAddress,
36204
36912
  balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
@@ -36222,6 +36930,7 @@ function DepositModal({
36222
36930
  defaultSourceChainId,
36223
36931
  defaultSourceTokenAddress,
36224
36932
  defaultSourceSymbol,
36933
+ prefilledAmountUsd: normalizedPrefilledAmountUsd,
36225
36934
  depositConfirmationMode,
36226
36935
  onExecutionsChange: setDepositExecutions,
36227
36936
  onDepositSuccess: onDepositSuccessFor("transfer"),
@@ -36241,6 +36950,7 @@ function DepositModal({
36241
36950
  defaultSourceChainId,
36242
36951
  defaultSourceTokenAddress,
36243
36952
  defaultSourceSymbol,
36953
+ prefilledAmountUsd: normalizedPrefilledAmountUsd,
36244
36954
  depositConfirmationMode,
36245
36955
  onExecutionsChange: setDepositExecutions,
36246
36956
  onDepositSuccess: onDepositSuccessFor("transfer"),
@@ -36257,7 +36967,8 @@ function DepositModal({
36257
36967
  title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
36258
36968
  showBack: showBackTracker,
36259
36969
  onBack: handleBack,
36260
- onClose: handleClose
36970
+ onClose: handleClose,
36971
+ incident: activeIncident
36261
36972
  }
36262
36973
  ),
36263
36974
  /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
@@ -36289,6 +37000,7 @@ function DepositModal({
36289
37000
  showBack: showBackCard,
36290
37001
  onBack: handleBack,
36291
37002
  onClose: handleClose,
37003
+ incident: activeIncident,
36292
37004
  badge: cardView === "quotes" ? { count: quotesCount } : void 0,
36293
37005
  showBalance: showBalanceHeader,
36294
37006
  balanceAddress: recipientAddress,
@@ -36325,7 +37037,8 @@ function DepositModal({
36325
37037
  wallets,
36326
37038
  assetCdnUrl: projectConfig?.asset_cdn_url,
36327
37039
  hideDepositFlowInfo,
36328
- hideDisplayDescription
37040
+ hideDisplayDescription,
37041
+ prefilledAmountUsd: normalizedPrefilledAmountUsd
36329
37042
  }
36330
37043
  ),
36331
37044
  depositPoweredByFooter
@@ -36337,7 +37050,8 @@ function DepositModal({
36337
37050
  title: payWithExchangeTitle,
36338
37051
  showBack: exchangeView === "pending" || sessionOpenedFromMenu,
36339
37052
  onBack: handleBack,
36340
- onClose: handleClose
37053
+ onClose: handleClose,
37054
+ incident: activeIncident
36341
37055
  }
36342
37056
  ),
36343
37057
  /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
@@ -36390,7 +37104,8 @@ function DepositModal({
36390
37104
  defaultSourceChainType,
36391
37105
  defaultSourceChainId,
36392
37106
  defaultSourceTokenAddress,
36393
- defaultSourceSymbol
37107
+ defaultSourceSymbol,
37108
+ prefilledAmountUsd: normalizedPrefilledAmountUsd
36394
37109
  }
36395
37110
  ),
36396
37111
  depositPoweredByFooter
@@ -36422,6 +37137,7 @@ function DepositModal({
36422
37137
  onDepositSuccess: onDepositSuccessFor("wallet_connect"),
36423
37138
  onDepositError: onDepositErrorFor("wallet_connect"),
36424
37139
  amountQuickSelect: browserWalletAmountQuickSelect,
37140
+ prefilledAmountUsd: normalizedPrefilledAmountUsd,
36425
37141
  onWalletDisconnect: handleWalletDisconnect,
36426
37142
  onWalletConnected: (info, dw) => {
36427
37143
  setBrowserWalletInfo({ ...info, depositWallet: dw });
@@ -36449,7 +37165,8 @@ function DepositModal({
36449
37165
  title: t8.bankTransfer.title,
36450
37166
  showBack: bankTransferView !== "providers" || sessionOpenedFromMenu,
36451
37167
  onBack: handleBack,
36452
- onClose: handleClose
37168
+ onClose: handleClose,
37169
+ incident: activeIncident
36453
37170
  }
36454
37171
  ),
36455
37172
  /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
@@ -36470,7 +37187,8 @@ function DepositModal({
36470
37187
  assetCdnUrl: projectConfig?.asset_cdn_url,
36471
37188
  onEvent,
36472
37189
  onDepositSuccess,
36473
- onDepositError
37190
+ onDepositError,
37191
+ prefilledAmountUsd: normalizedPrefilledAmountUsd
36474
37192
  }
36475
37193
  ),
36476
37194
  depositPoweredByFooter
@@ -36482,26 +37200,24 @@ function DepositModal({
36482
37200
  title: "Deposit with Link",
36483
37201
  showBack: stripeLinkStep !== "checkout" && stripeLinkStep !== "success",
36484
37202
  onBack: handleBack,
36485
- showClose: stripeLinkStep !== "checkout",
37203
+ incident: activeIncident,
37204
+ showClose: stripeLinkStep !== "checkout" && stripeLinkStep !== "auth",
36486
37205
  onClose: handleClose
36487
37206
  }
36488
37207
  ),
36489
37208
  /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
36490
37209
  isLoadingIp ? (
36491
- // Hold the geo decision until IP resolves so we don't mount
36492
- // PayWithStripeLink (which kicks off config/OAuth work) for a
36493
- // deep-link user who turns out to be outside the US.
37210
+ // Wait for location so the first config fetch is region-aware.
36494
37211
  /* @__PURE__ */ jsx63(SkeletonButton, { variant: "with-icons" })
36495
37212
  ) : !showStripeLink ? (
36496
- // Stripe Link's crypto on-ramp is US-only. On a direct open
36497
- // (initialScreen="stripe_link") the row isn't in a menu to
36498
- // fall back to, so show a geo-restriction screen rather than
36499
- // the Link UI.
37213
+ // Direct opens (initialScreen="stripe_link") have no menu row
37214
+ // to fall back to, so render an unavailable state when backend
37215
+ // config resolves Stripe Link disabled/hidden.
36500
37216
  /* @__PURE__ */ jsx63(
36501
37217
  GeoRestrictionScreen,
36502
37218
  {
36503
37219
  methodName: t8.stripeLink.title,
36504
- message: "Pay with Link is only available in the US."
37220
+ message: t8.stripeLink.unavailableInRegionMessage
36505
37221
  }
36506
37222
  )
36507
37223
  ) : /* @__PURE__ */ jsx63(
@@ -36513,6 +37229,8 @@ function DepositModal({
36513
37229
  destinationChainType,
36514
37230
  destinationChainId,
36515
37231
  destinationTokenAddress,
37232
+ countryCode: userIpInfo?.alpha2,
37233
+ subdivisionCode: userIpInfo?.subdivisionCode ?? void 0,
36516
37234
  wallets,
36517
37235
  email: userEmail,
36518
37236
  iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/link.svg` : void 0,
@@ -36532,7 +37250,8 @@ function DepositModal({
36532
37250
  title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
36533
37251
  showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
36534
37252
  onBack: handleBack,
36535
- onClose: handleClose
37253
+ onClose: handleClose,
37254
+ incident: activeIncident
36536
37255
  }
36537
37256
  ),
36538
37257
  /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
@@ -36552,6 +37271,7 @@ function DepositModal({
36552
37271
  onEvent,
36553
37272
  onDepositSuccess: onDepositSuccessFor("cashapp"),
36554
37273
  onDepositError: onDepositErrorFor("cashapp"),
37274
+ prefilledAmountUsd: normalizedPrefilledAmountUsd,
36555
37275
  wallets
36556
37276
  }
36557
37277
  ),
@@ -36567,7 +37287,8 @@ function DepositModal({
36567
37287
  const handled = applePayHandleRef.current?.requestBack() ?? false;
36568
37288
  if (!handled) handleBack();
36569
37289
  },
36570
- onClose: handleClose
37290
+ onClose: handleClose,
37291
+ incident: activeIncident
36571
37292
  }
36572
37293
  ),
36573
37294
  /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
@@ -36610,7 +37331,7 @@ function DepositModal({
36610
37331
  var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["succeeded", "expired", "refunded", "canceled"]);
36611
37332
  function usePaymentIntent(params) {
36612
37333
  const { clientSecret, publishableKey, enabled = true, pollingInterval = 3e3 } = params;
36613
- return useQuery17({
37334
+ return useQuery19({
36614
37335
  queryKey: ["unifold", "paymentIntent", clientSecret, publishableKey],
36615
37336
  queryFn: () => retrievePaymentIntent(clientSecret, publishableKey),
36616
37337
  enabled: enabled && !!clientSecret && !!publishableKey,
@@ -36682,6 +37403,7 @@ function CheckoutModal({
36682
37403
  modalTitle,
36683
37404
  enableTransferCrypto,
36684
37405
  enableConnectWallet,
37406
+ enableIncidentBanner = false,
36685
37407
  defaultSourceChainType,
36686
37408
  defaultSourceChainId,
36687
37409
  defaultSourceTokenAddress,
@@ -36693,11 +37415,11 @@ function CheckoutModal({
36693
37415
  }) {
36694
37416
  const { colors: colors2, fonts, components } = useTheme();
36695
37417
  const [view, setView] = useState41("main");
36696
- const resetViewTimeoutRef = useRef132(null);
37418
+ const resetViewTimeoutRef = useRef142(null);
36697
37419
  const [browserWalletInfo, setBrowserWalletInfo] = useState41(null);
36698
37420
  const [browserWalletChainType, setBrowserWalletChainType] = useState41(() => getStoredWalletState()?.chainType);
36699
- const lastCheckoutMethodRef = useRef132(void 0);
36700
- const emitCheckoutSuccess = useCallback92(
37421
+ const lastCheckoutMethodRef = useRef142(void 0);
37422
+ const emitCheckoutSuccess = useCallback122(
36701
37423
  (data, method) => {
36702
37424
  const isSucceeded = data.status === "succeeded";
36703
37425
  const richIntent = isSucceeded && data.paymentIntent ? mapToCheckoutPaymentIntent(data.paymentIntent) : void 0;
@@ -36753,6 +37475,16 @@ function CheckoutModal({
36753
37475
  });
36754
37476
  const showTransferCrypto = enableTransferCrypto ?? projectConfig?.transfer_crypto?.enabled ?? true;
36755
37477
  const showConnectWallet = enableConnectWallet ?? projectConfig?.connect_wallet?.enabled ?? true;
37478
+ const { incident: publicIncident } = usePublicIncident({
37479
+ publishableKey,
37480
+ enabled: open && enableIncidentBanner
37481
+ });
37482
+ const activeIncident = enableIncidentBanner && publicIncident?.enabled && (publicIncident.messages?.length ?? 0) > 0 ? {
37483
+ enabled: true,
37484
+ messages: publicIncident.messages,
37485
+ severity: publicIncident.severity,
37486
+ statusPageUrl: publicIncident.status_page_url
37487
+ } : void 0;
36756
37488
  useEffect35(() => {
36757
37489
  if (view === "transfer" && !showTransferCrypto) {
36758
37490
  setView("main");
@@ -36760,7 +37492,7 @@ function CheckoutModal({
36760
37492
  setView("main");
36761
37493
  }
36762
37494
  }, [showConnectWallet, showTransferCrypto, view]);
36763
- const prevStatusRef = useRef132(null);
37495
+ const prevStatusRef = useRef142(null);
36764
37496
  useEffect35(() => {
36765
37497
  if (!paymentIntent) return;
36766
37498
  const prev = prevStatusRef.current;
@@ -36779,11 +37511,11 @@ function CheckoutModal({
36779
37511
  );
36780
37512
  }
36781
37513
  }, [emitCheckoutSuccess, paymentIntent, view]);
36782
- const wallets = useMemo142(() => {
37514
+ const wallets = useMemo152(() => {
36783
37515
  if (!paymentIntent) return [];
36784
37516
  return mapDepositAddressesToWallets(paymentIntent.deposit_addresses, paymentIntent);
36785
37517
  }, [paymentIntent]);
36786
- const formatCryptoAmount = useMemo142(() => {
37518
+ const formatCryptoAmount = useMemo152(() => {
36787
37519
  if (!paymentIntent) return (_) => "";
36788
37520
  const decimals = paymentIntent.destination_token_decimals ?? 6;
36789
37521
  const symbol = paymentIntent.currency.toUpperCase();
@@ -36793,7 +37525,7 @@ function CheckoutModal({
36793
37525
  return `${formatted} ${symbol}`;
36794
37526
  };
36795
37527
  }, [paymentIntent]);
36796
- const remainingAmountUsd = useMemo142(() => {
37528
+ const remainingAmountUsd = useMemo152(() => {
36797
37529
  if (!paymentIntent) return void 0;
36798
37530
  const total = parseFloat(paymentIntent.destination_amount_usd || paymentIntent.amount_usd);
36799
37531
  const received = parseFloat(
@@ -36805,7 +37537,7 @@ function CheckoutModal({
36805
37537
  return remaining > 0 ? remaining.toFixed(2) : "0.00";
36806
37538
  }, [paymentIntent]);
36807
37539
  const [selectedSource, setSelectedSource] = useState41(null);
36808
- const remainingDestinationAmount = useMemo142(() => {
37540
+ const remainingDestinationAmount = useMemo152(() => {
36809
37541
  if (!paymentIntent) return "0";
36810
37542
  const remaining = BigInt(paymentIntent.destination_amount) - BigInt(paymentIntent.destination_amount_received);
36811
37543
  return remaining > 0n ? remaining.toString() : "0";
@@ -36827,7 +37559,7 @@ function CheckoutModal({
36827
37559
  stablecoinParity: paymentIntent?.stablecoin_parity ?? false,
36828
37560
  enabled: open && view === "transfer" && !!paymentIntent && !!selectedSource && remainingDestinationAmount !== "0"
36829
37561
  });
36830
- const effectiveCheckoutQuote = useMemo142(() => {
37562
+ const effectiveCheckoutQuote = useMemo152(() => {
36831
37563
  if (!sourceQuote || !selectedSource) return null;
36832
37564
  const baseQuote = {
36833
37565
  sourceAmount: sourceQuote.source_amount,
@@ -36848,7 +37580,7 @@ function CheckoutModal({
36848
37580
  sourceAmountUsd: minUsd.toFixed(2)
36849
37581
  };
36850
37582
  }, [sourceQuote, selectedSource]);
36851
- const handleBrowserWalletClick = useCallback92(
37583
+ const handleBrowserWalletClick = useCallback122(
36852
37584
  (walletInfo) => {
36853
37585
  const walletChainType = walletInfo.type === "phantom-solana" || walletInfo.type === "solflare" || walletInfo.type === "backpack" || walletInfo.type === "glow" ? "solana" : "ethereum";
36854
37586
  setStoredWalletState(walletInfo.type);
@@ -36871,19 +37603,19 @@ function CheckoutModal({
36871
37603
  },
36872
37604
  [wallets, onCheckoutError]
36873
37605
  );
36874
- const handleWalletConnectClick = useCallback92(() => {
37606
+ const handleWalletConnectClick = useCallback122(() => {
36875
37607
  setBrowserWalletInfo(null);
36876
37608
  lastCheckoutMethodRef.current = "wallet_connect";
36877
37609
  setView("wallet_connect");
36878
37610
  }, []);
36879
- const handleWalletDisconnect = useCallback92(() => {
37611
+ const handleWalletDisconnect = useCallback122(() => {
36880
37612
  setUserDisconnectedWallet(true);
36881
37613
  clearStoredWalletState();
36882
37614
  setBrowserWalletChainType(void 0);
36883
37615
  setBrowserWalletInfo(null);
36884
37616
  setView("main");
36885
37617
  }, []);
36886
- const handleClose = useCallback92(() => {
37618
+ const handleClose = useCallback122(() => {
36887
37619
  onOpenChange(false);
36888
37620
  if (resetViewTimeoutRef.current) {
36889
37621
  clearTimeout(resetViewTimeoutRef.current);
@@ -36913,7 +37645,7 @@ function CheckoutModal({
36913
37645
  },
36914
37646
  []
36915
37647
  );
36916
- const handleBack = useCallback92(() => {
37648
+ const handleBack = useCallback122(() => {
36917
37649
  setView("main");
36918
37650
  }, []);
36919
37651
  const poweredByFooter = /* @__PURE__ */ jsx64("div", { className: "uf-pt-3", children: /* @__PURE__ */ jsx64(
@@ -37054,7 +37786,15 @@ function CheckoutModal({
37054
37786
  {
37055
37787
  className: view === "wallet_connect" ? "uf-flex uf-min-h-0 uf-flex-col" : void 0,
37056
37788
  children: view === "main" ? /* @__PURE__ */ jsxs58(Fragment15, { children: [
37057
- /* @__PURE__ */ jsx64(DepositHeader, { title: modalTitle || "Checkout", showClose: true, onClose: handleClose }),
37789
+ /* @__PURE__ */ jsx64(
37790
+ DepositHeader,
37791
+ {
37792
+ title: modalTitle || "Checkout",
37793
+ showClose: true,
37794
+ onClose: handleClose,
37795
+ incident: activeIncident
37796
+ }
37797
+ ),
37058
37798
  /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
37059
37799
  piLoading ? /* @__PURE__ */ jsxs58("div", { className: "uf-space-y-3", children: [
37060
37800
  /* @__PURE__ */ jsx64(
@@ -37152,7 +37892,8 @@ function CheckoutModal({
37152
37892
  title: modalTitle || "Checkout",
37153
37893
  showBack: true,
37154
37894
  onBack: handleBack,
37155
- onClose: handleClose
37895
+ onClose: handleClose,
37896
+ incident: activeIncident
37156
37897
  }
37157
37898
  ),
37158
37899
  /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
@@ -37251,7 +37992,7 @@ function CheckoutModal({
37251
37992
  userId: paymentIntent.user_id || "",
37252
37993
  publishableKey,
37253
37994
  clientSecret,
37254
- prefillAmountUsd: remainingAmountUsd,
37995
+ prefilledAmountUsd: remainingAmountUsd,
37255
37996
  checkoutAmountUsd: paymentIntent.amount_usd,
37256
37997
  checkoutReceivedUsd: paymentIntent.amount_received_usd,
37257
37998
  checkoutDestination: {
@@ -37312,7 +38053,7 @@ function CheckoutModal({
37312
38053
  ) }) });
37313
38054
  }
37314
38055
  function useSupportedDestinationTokens(publishableKey, enabled = true) {
37315
- return useQuery18({
38056
+ return useQuery20({
37316
38057
  queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
37317
38058
  queryFn: () => getSupportedDestinationTokens(publishableKey),
37318
38059
  staleTime: 1e3 * 60 * 5,
@@ -37322,6 +38063,7 @@ function useSupportedDestinationTokens(publishableKey, enabled = true) {
37322
38063
  enabled
37323
38064
  });
37324
38065
  }
38066
+ var STORAGE_KEY3 = "unifold_last_withdraw_to_token";
37325
38067
  function useDefaultDestinationToken({
37326
38068
  destinationTokens,
37327
38069
  defaultDestinationChainType,
@@ -37334,7 +38076,8 @@ function useDefaultDestinationToken({
37334
38076
  defaultChainType: defaultDestinationChainType,
37335
38077
  defaultChainId: defaultDestinationChainId,
37336
38078
  defaultTokenAddress: defaultDestinationTokenAddress,
37337
- defaultSymbol: defaultDestinationSymbol
38079
+ defaultSymbol: defaultDestinationSymbol,
38080
+ storageKey: STORAGE_KEY3
37338
38081
  });
37339
38082
  }
37340
38083
  function useSourceTokenValidation(params) {
@@ -37347,7 +38090,7 @@ function useSourceTokenValidation(params) {
37347
38090
  enabled = true
37348
38091
  } = params;
37349
38092
  const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
37350
- return useQuery19({
38093
+ return useQuery21({
37351
38094
  queryKey: [
37352
38095
  "unifold",
37353
38096
  "sourceTokenValidation",
@@ -37396,7 +38139,7 @@ function useSourceTokenValidation(params) {
37396
38139
  function useAddressBalance(params) {
37397
38140
  const { address, chainType, chainId, tokenAddress, publishableKey, enabled = true } = params;
37398
38141
  const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
37399
- return useQuery20({
38142
+ return useQuery222({
37400
38143
  queryKey: [
37401
38144
  "unifold",
37402
38145
  "addressBalance",
@@ -37452,7 +38195,7 @@ function useAddressBalance(params) {
37452
38195
  }
37453
38196
  function useExecutions(userId, publishableKey, options) {
37454
38197
  const actionType = options?.actionType ?? ActionType.Deposit;
37455
- return useQuery21({
38198
+ return useQuery23({
37456
38199
  queryKey: ["unifold", "executions", actionType, userId, publishableKey],
37457
38200
  queryFn: () => queryExecutions(userId, publishableKey, actionType),
37458
38201
  enabled: (options?.enabled ?? true) && !!userId,
@@ -37500,11 +38243,11 @@ function useWithdrawPolling({
37500
38243
  });
37501
38244
  const [executions, setExecutions] = useState42([]);
37502
38245
  const [isPolling, setIsPolling] = useState42(false);
37503
- const enabledAtRef = useRef142(/* @__PURE__ */ new Date());
37504
- const trackedRef = useRef142(/* @__PURE__ */ new Map());
37505
- const prevEnabledRef = useRef142(false);
37506
- const onSuccessRef = useRef142(onWithdrawSuccess);
37507
- const onErrorRef = useRef142(onWithdrawError);
38246
+ const enabledAtRef = useRef152(/* @__PURE__ */ new Date());
38247
+ const trackedRef = useRef152(/* @__PURE__ */ new Map());
38248
+ const prevEnabledRef = useRef152(false);
38249
+ const onSuccessRef = useRef152(onWithdrawSuccess);
38250
+ const onErrorRef = useRef152(onWithdrawError);
37508
38251
  useEffect36(() => {
37509
38252
  onSuccessRef.current = onWithdrawSuccess;
37510
38253
  }, [onWithdrawSuccess]);
@@ -37778,7 +38521,7 @@ function useVerifyRecipientAddress(params) {
37778
38521
  } = params;
37779
38522
  const trimmedAddress = recipientAddress?.trim() || "";
37780
38523
  const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
37781
- return useQuery222({
38524
+ return useQuery24({
37782
38525
  queryKey: [
37783
38526
  "unifold",
37784
38527
  "verifyRecipientAddress",
@@ -37817,7 +38560,7 @@ function useGetDepositAddress(params) {
37817
38560
  enabled = true
37818
38561
  } = params;
37819
38562
  const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
37820
- return useQuery23({
38563
+ return useQuery25({
37821
38564
  queryKey: [
37822
38565
  "unifold",
37823
38566
  "getDepositAddress",
@@ -37884,7 +38627,7 @@ function useHypercoreWithdrawActivation(params) {
37884
38627
  actionType: ActionType.Withdraw,
37885
38628
  enabled: enabled && isHypercore(sourceChainId)
37886
38629
  });
37887
- const depositWalletAddress = useMemo15(() => {
38630
+ const depositWalletAddress = useMemo16(() => {
37888
38631
  const wallets = depositWalletLookup.data?.data ?? [];
37889
38632
  return wallets.find((w) => w.chain_type === sourceChainType)?.address;
37890
38633
  }, [depositWalletLookup.data, sourceChainType]);
@@ -38003,11 +38746,14 @@ function WithdrawForm({
38003
38746
  enabled: debouncedAddress.length > 5 && !!selectedChain
38004
38747
  });
38005
38748
  const isDebouncing = trimmedAddress !== debouncedAddress;
38006
- const addressError = useMemo16(() => {
38749
+ const addressError = useMemo17(() => {
38007
38750
  if (!trimmedAddress || trimmedAddress.length <= 5) return null;
38008
38751
  if (isDebouncing || isVerifyingAddress) return null;
38009
38752
  if (verifyError) return t10.invalidAddress;
38010
38753
  if (addressVerification && !addressVerification.valid) {
38754
+ if (addressVerification.message && addressVerification.message.trim().length > 0) {
38755
+ return addressVerification.message;
38756
+ }
38011
38757
  if (addressVerification.failure_code === "account_not_found")
38012
38758
  return `Account not found on ${selectedChain?.chain_name}`;
38013
38759
  if (addressVerification.failure_code === "not_opted_in")
@@ -38037,33 +38783,33 @@ function WithdrawForm({
38037
38783
  destinationTokenAddress: selectedChain?.token_address,
38038
38784
  enabled: isAddressValid
38039
38785
  });
38040
- const exchangeRate = useMemo16(() => {
38786
+ const exchangeRate = useMemo17(() => {
38041
38787
  if (!balanceData?.exchangeRate) return 0;
38042
38788
  return parseFloat(balanceData.exchangeRate);
38043
38789
  }, [balanceData]);
38044
- const balanceCrypto = useMemo16(() => {
38790
+ const balanceCrypto = useMemo17(() => {
38045
38791
  if (!balanceData?.balanceHuman) return 0;
38046
38792
  return parseFloat(balanceData.balanceHuman);
38047
38793
  }, [balanceData]);
38048
- const balanceUsdNum = useMemo16(() => {
38794
+ const balanceUsdNum = useMemo17(() => {
38049
38795
  if (!balanceData?.balanceUsd) return 0;
38050
38796
  return parseFloat(balanceData.balanceUsd);
38051
38797
  }, [balanceData]);
38052
38798
  const tokenSymbol = sourceTokenSymbol || balanceData?.symbol || "TOKEN";
38053
38799
  const sourceDecimals = balanceData?.decimals ?? 6;
38054
- const cryptoAmountFromInput = useMemo16(() => {
38800
+ const cryptoAmountFromInput = useMemo17(() => {
38055
38801
  const val = parseFloat(amount);
38056
38802
  if (!val || val <= 0) return 0;
38057
38803
  if (inputUnit === "crypto") return val;
38058
38804
  return exchangeRate > 0 ? val / exchangeRate : 0;
38059
38805
  }, [amount, inputUnit, exchangeRate]);
38060
- const fiatAmountFromInput = useMemo16(() => {
38806
+ const fiatAmountFromInput = useMemo17(() => {
38061
38807
  const val = parseFloat(amount);
38062
38808
  if (!val || val <= 0) return 0;
38063
38809
  if (inputUnit === "fiat") return val;
38064
38810
  return val * exchangeRate;
38065
38811
  }, [amount, inputUnit, exchangeRate]);
38066
- const convertedDisplay = useMemo16(() => {
38812
+ const convertedDisplay = useMemo17(() => {
38067
38813
  if (!amount || parseFloat(amount) <= 0) return null;
38068
38814
  if (inputUnit === "crypto") {
38069
38815
  return `$${fiatAmountFromInput.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
@@ -38082,7 +38828,7 @@ function WithdrawForm({
38082
38828
  isMaxed,
38083
38829
  isStablecoin
38084
38830
  ]);
38085
- const balanceDisplay = useMemo16(() => {
38831
+ const balanceDisplay = useMemo17(() => {
38086
38832
  if (isLoadingBalance || !balanceData) return null;
38087
38833
  if (inputUnit === "crypto") {
38088
38834
  const displayDecimals = isStablecoin ? 2 : 6;
@@ -38105,7 +38851,7 @@ function WithdrawForm({
38105
38851
  tokenSymbol,
38106
38852
  isStablecoin
38107
38853
  ]);
38108
- const handleSwitchUnit = useCallback102(() => {
38854
+ const handleSwitchUnit = useCallback132(() => {
38109
38855
  if (isMaxed && balanceData) {
38110
38856
  if (inputUnit === "crypto") {
38111
38857
  setAmount((Math.round(balanceUsdNum * 100) / 100).toFixed(2));
@@ -38132,7 +38878,7 @@ function WithdrawForm({
38132
38878
  setInputUnit("crypto");
38133
38879
  }
38134
38880
  }, [amount, inputUnit, exchangeRate, sourceDecimals, isMaxed, balanceData, balanceUsdNum]);
38135
- const handleMaxClick = useCallback102(() => {
38881
+ const handleMaxClick = useCallback132(() => {
38136
38882
  if (inputUnit === "crypto") {
38137
38883
  if (balanceCrypto <= 0) return;
38138
38884
  setAmount(balanceData?.balanceHuman ?? "0");
@@ -38146,7 +38892,7 @@ function WithdrawForm({
38146
38892
  const isBelowMinimum = minimumWithdrawAmountUsd !== null && fiatAmountFromInput > 0 && Math.round(fiatAmountFromInput * 100) / 100 < minimumWithdrawAmountUsd;
38147
38893
  const isOverBalance = inputUnit === "crypto" ? cryptoAmountFromInput > 0 && balanceCrypto > 0 && cryptoAmountFromInput > balanceCrypto : fiatAmountFromInput > 0 && balanceUsdNum > 0 && Math.round(fiatAmountFromInput * 100) / 100 > Math.round(balanceUsdNum * 100) / 100;
38148
38894
  const isFormValid = trimmedAddress.length > 0 && amount.trim().length > 0 && cryptoAmountFromInput > 0 && isAddressValid && !isBelowMinimum && !isOverBalance && !isBalanceBelowMinimum && !!balanceData;
38149
- const handleWithdraw = useCallback102(async () => {
38895
+ const handleWithdraw = useCallback132(async () => {
38150
38896
  if (!selectedToken || !selectedChain) return;
38151
38897
  if (!isFormValid) return;
38152
38898
  setIsSubmitting(true);
@@ -38919,7 +39665,7 @@ function WithdrawModal({
38919
39665
  theme = "dark",
38920
39666
  hideOverlay = false
38921
39667
  }) {
38922
- const onWithdrawSuccessFor = useCallback112(
39668
+ const onWithdrawSuccessFor = useCallback14(
38923
39669
  (data) => {
38924
39670
  onWithdrawSuccess?.(data);
38925
39671
  if (data.execution) {
@@ -38930,7 +39676,7 @@ function WithdrawModal({
38930
39676
  );
38931
39677
  const { colors: colors2, fonts, components } = useTheme();
38932
39678
  const [containerEl, setContainerEl] = useState45(null);
38933
- const containerCallbackRef = useCallback112((el) => {
39679
+ const containerCallbackRef = useCallback14((el) => {
38934
39680
  setContainerEl(el);
38935
39681
  }, []);
38936
39682
  const [resolvedTheme, setResolvedTheme] = useState45(
@@ -39003,7 +39749,7 @@ function WithdrawModal({
39003
39749
  refetchInterval: view === "tracker" || view === "detail" ? 5e3 : 15e3
39004
39750
  });
39005
39751
  const allWithdrawals = allWithdrawalsData?.data ?? [];
39006
- const handleDepositWalletCreation = useCallback112(
39752
+ const handleDepositWalletCreation = useCallback14(
39007
39753
  async (params) => {
39008
39754
  const { data: wallets } = await createDepositAddress(
39009
39755
  {
@@ -39026,12 +39772,12 @@ function WithdrawModal({
39026
39772
  },
39027
39773
  [externalUserId, publishableKey, sourceChainType]
39028
39774
  );
39029
- const handleWithdrawSubmitted = useCallback112((txInfo) => {
39775
+ const handleWithdrawSubmitted = useCallback14((txInfo) => {
39030
39776
  setSubmittedTxInfo(txInfo);
39031
39777
  setView("confirming");
39032
39778
  }, []);
39033
- const resetViewTimeoutRef = useRef152(null);
39034
- const handleClose = useCallback112(() => {
39779
+ const resetViewTimeoutRef = useRef162(null);
39780
+ const handleClose = useCallback14(() => {
39035
39781
  onOpenChange(false);
39036
39782
  if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
39037
39783
  resetViewTimeoutRef.current = setTimeout(() => {
@@ -39059,13 +39805,13 @@ function WithdrawModal({
39059
39805
  },
39060
39806
  []
39061
39807
  );
39062
- const handleTokenSymbolChange = useCallback112(
39808
+ const handleTokenSymbolChange = useCallback14(
39063
39809
  (symbol) => {
39064
39810
  setSelectedTokenSymbol(symbol);
39065
39811
  },
39066
39812
  [setSelectedTokenSymbol]
39067
39813
  );
39068
- const handleChainKeyChange = useCallback112(
39814
+ const handleChainKeyChange = useCallback14(
39069
39815
  (chainKey) => {
39070
39816
  setSelectedChainKey(chainKey);
39071
39817
  },
@@ -39267,6 +40013,7 @@ function UnifoldProvider2({
39267
40013
  const [isWithdrawOpen, setIsWithdrawOpen] = useState39(false);
39268
40014
  const [withdrawConfig, setWithdrawConfig] = useState39(null);
39269
40015
  const [resolvedTheme, setResolvedTheme] = React38.useState("dark");
40016
+ const incidentBannerEnabled = config?.notifications?.incidentBanner;
39270
40017
  useEffect40(() => {
39271
40018
  if (publishableKey) {
39272
40019
  setApiConfig({ publishableKey });
@@ -39297,7 +40044,7 @@ function UnifoldProvider2({
39297
40044
  withdrawConfigRef.current = withdrawConfig;
39298
40045
  const withdrawCloseTimeoutRef = React38.useRef(null);
39299
40046
  const withdrawCloseGuardRef = React38.useRef(false);
39300
- const beginDeposit = useCallback13((config2) => {
40047
+ const beginDeposit = useCallback15((config2) => {
39301
40048
  if (closeTimeoutRef.current) {
39302
40049
  clearTimeout(closeTimeoutRef.current);
39303
40050
  closeTimeoutRef.current = null;
@@ -39332,7 +40079,7 @@ function UnifoldProvider2({
39332
40079
  setIsOpen(true);
39333
40080
  return promise;
39334
40081
  }, []);
39335
- const closeDeposit = useCallback13(() => {
40082
+ const closeDeposit = useCallback15(() => {
39336
40083
  if (closeGuardRef.current) {
39337
40084
  return;
39338
40085
  }
@@ -39354,7 +40101,7 @@ function UnifoldProvider2({
39354
40101
  closeTimeoutRef.current = null;
39355
40102
  }, 200);
39356
40103
  }, []);
39357
- const handleDepositSuccess = useCallback13(
40104
+ const handleDepositSuccess = useCallback15(
39358
40105
  (data) => {
39359
40106
  if (depositConfig?.onSuccess) {
39360
40107
  depositConfig.onSuccess(data);
@@ -39366,7 +40113,7 @@ function UnifoldProvider2({
39366
40113
  },
39367
40114
  [depositConfig]
39368
40115
  );
39369
- const handleDepositError = useCallback13(
40116
+ const handleDepositError = useCallback15(
39370
40117
  (error) => {
39371
40118
  console.error("[UnifoldProvider] Deposit error:", error);
39372
40119
  if (depositConfig?.onError) {
@@ -39384,7 +40131,7 @@ function UnifoldProvider2({
39384
40131
  checkoutConfigRef.current = checkoutConfig;
39385
40132
  const checkoutCloseTimeoutRef = React38.useRef(null);
39386
40133
  const checkoutCloseGuardRef = React38.useRef(false);
39387
- const beginCheckout = useCallback13((config2) => {
40134
+ const beginCheckout = useCallback15((config2) => {
39388
40135
  if (checkoutCloseTimeoutRef.current) {
39389
40136
  clearTimeout(checkoutCloseTimeoutRef.current);
39390
40137
  checkoutCloseTimeoutRef.current = null;
@@ -39409,7 +40156,7 @@ function UnifoldProvider2({
39409
40156
  setIsCheckoutOpen(true);
39410
40157
  return promise;
39411
40158
  }, []);
39412
- const closeCheckout = useCallback13(() => {
40159
+ const closeCheckout = useCallback15(() => {
39413
40160
  if (checkoutCloseGuardRef.current) {
39414
40161
  return;
39415
40162
  }
@@ -39431,7 +40178,7 @@ function UnifoldProvider2({
39431
40178
  checkoutCloseTimeoutRef.current = null;
39432
40179
  }, 200);
39433
40180
  }, []);
39434
- const handleCheckoutSuccess = useCallback13(
40181
+ const handleCheckoutSuccess = useCallback15(
39435
40182
  (data) => {
39436
40183
  if (checkoutConfig?.onSuccess) {
39437
40184
  checkoutConfig.onSuccess(data);
@@ -39443,7 +40190,7 @@ function UnifoldProvider2({
39443
40190
  },
39444
40191
  [checkoutConfig]
39445
40192
  );
39446
- const handleCheckoutError = useCallback13(
40193
+ const handleCheckoutError = useCallback15(
39447
40194
  (error) => {
39448
40195
  console.error("[UnifoldProvider] Checkout error:", error);
39449
40196
  if (checkoutConfig?.onError) {
@@ -39456,7 +40203,7 @@ function UnifoldProvider2({
39456
40203
  },
39457
40204
  [checkoutConfig]
39458
40205
  );
39459
- const beginWithdraw = useCallback13((config2) => {
40206
+ const beginWithdraw = useCallback15((config2) => {
39460
40207
  if (withdrawCloseTimeoutRef.current) {
39461
40208
  clearTimeout(withdrawCloseTimeoutRef.current);
39462
40209
  withdrawCloseTimeoutRef.current = null;
@@ -39481,7 +40228,7 @@ function UnifoldProvider2({
39481
40228
  setIsWithdrawOpen(true);
39482
40229
  return promise;
39483
40230
  }, []);
39484
- const closeWithdraw = useCallback13(() => {
40231
+ const closeWithdraw = useCallback15(() => {
39485
40232
  if (withdrawCloseGuardRef.current) {
39486
40233
  return;
39487
40234
  }
@@ -39503,7 +40250,7 @@ function UnifoldProvider2({
39503
40250
  withdrawCloseTimeoutRef.current = null;
39504
40251
  }, 200);
39505
40252
  }, []);
39506
- const handleWithdrawSuccess = useCallback13((data) => {
40253
+ const handleWithdrawSuccess = useCallback15((data) => {
39507
40254
  if (withdrawConfigRef.current?.onSuccess) {
39508
40255
  withdrawConfigRef.current.onSuccess(data);
39509
40256
  }
@@ -39512,7 +40259,7 @@ function UnifoldProvider2({
39512
40259
  withdrawPromiseRef.current = null;
39513
40260
  }
39514
40261
  }, []);
39515
- const handleWithdrawError = useCallback13((error) => {
40262
+ const handleWithdrawError = useCallback15((error) => {
39516
40263
  console.error("[UnifoldProvider] Withdraw error:", error);
39517
40264
  if (withdrawConfigRef.current?.onError) {
39518
40265
  withdrawConfigRef.current.onError(error);
@@ -39522,7 +40269,7 @@ function UnifoldProvider2({
39522
40269
  withdrawPromiseRef.current = null;
39523
40270
  }
39524
40271
  }, []);
39525
- const contextValue = useMemo18(
40272
+ const contextValue = useMemo19(
39526
40273
  () => ({
39527
40274
  beginDeposit,
39528
40275
  closeDeposit,
@@ -39564,6 +40311,7 @@ function UnifoldProvider2({
39564
40311
  publishableKey,
39565
40312
  enableTransferCrypto: config?.enableTransferCrypto,
39566
40313
  enableConnectWallet: config?.enableConnectWallet,
40314
+ enableIncidentBanner: incidentBannerEnabled,
39567
40315
  defaultSourceChainType: checkoutConfig.defaultSourceChainType,
39568
40316
  defaultSourceChainId: checkoutConfig.defaultSourceChainId,
39569
40317
  defaultSourceTokenAddress: checkoutConfig.defaultSourceTokenAddress,
@@ -39617,6 +40365,7 @@ function UnifoldProvider2({
39617
40365
  defaultSourceChainId: depositConfig.defaultSourceChainId,
39618
40366
  defaultSourceTokenAddress: depositConfig.defaultSourceTokenAddress,
39619
40367
  defaultSourceSymbol: depositConfig.defaultSourceSymbol,
40368
+ prefilledAmountUsd: depositConfig.prefilledAmountUsd,
39620
40369
  userEmail: depositConfig.user?.email,
39621
40370
  depositConfirmationMode: depositConfig.depositConfirmationMode ?? "auto_ui",
39622
40371
  hideDepositTracker: config?.hideDepositTracker,
@@ -39630,6 +40379,7 @@ function UnifoldProvider2({
39630
40379
  enableConnectExchange: config?.enableConnectExchange,
39631
40380
  enableCashApp: config?.enableCashApp,
39632
40381
  enableStripeLink: config?.enableStripeLink,
40382
+ enableIncidentBanner: incidentBannerEnabled,
39633
40383
  enableApplePay: config?.enableApplePay,
39634
40384
  applePayTitle: config?.applePayTitle,
39635
40385
  applePaySubTitle: config?.applePaySubTitle,