@unifold/ui-web 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
@@ -37103,6 +37103,7 @@ var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
37103
37103
  var React211 = __toESM(require_react(), 1);
37104
37104
  var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
37105
37105
  var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
37106
+ var React522 = __toESM(require_react(), 1);
37106
37107
  var import_react7 = __toESM(require_react(), 1);
37107
37108
  var import_react8 = __toESM(require_react(), 1);
37108
37109
  var import_react9 = __toESM(require_react(), 1);
@@ -37121,7 +37122,7 @@ var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
37121
37122
  var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
37122
37123
  var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
37123
37124
  var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
37124
- var React522 = __toESM(require_react(), 1);
37125
+ var React622 = __toESM(require_react(), 1);
37125
37126
  var import_react15 = __toESM(require_react(), 1);
37126
37127
  var import_react16 = __toESM(require_react(), 1);
37127
37128
  var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
@@ -37135,55 +37136,55 @@ var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
37135
37136
  var import_react21 = __toESM(require_react(), 1);
37136
37137
  var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
37137
37138
  var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
37138
- var React622 = __toESM(require_react(), 1);
37139
- var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
37140
37139
  var React72 = __toESM(require_react(), 1);
37141
- var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
37140
+ var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
37142
37141
  var React82 = __toESM(require_react(), 1);
37142
+ var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
37143
+ var React92 = __toESM(require_react(), 1);
37143
37144
  var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
37145
+ var React112 = __toESM(require_react(), 1);
37144
37146
  var React102 = __toESM(require_react(), 1);
37145
- var React92 = __toESM(require_react(), 1);
37146
37147
  var React25 = __toESM(require_react(), 1);
37147
37148
  var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
37148
37149
  var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
37149
37150
  var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
37150
- var React112 = __toESM(require_react(), 1);
37151
- var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
37152
37151
  var React122 = __toESM(require_react(), 1);
37153
- var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
37152
+ var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
37154
37153
  var React132 = __toESM(require_react(), 1);
37155
- var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
37154
+ var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
37156
37155
  var React142 = __toESM(require_react(), 1);
37157
- var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
37158
- var React282 = __toESM(require_react(), 1);
37156
+ var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
37159
37157
  var React152 = __toESM(require_react(), 1);
37158
+ var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
37159
+ var React292 = __toESM(require_react(), 1);
37160
37160
  var React162 = __toESM(require_react(), 1);
37161
- var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
37162
37161
  var React172 = __toESM(require_react(), 1);
37163
- var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
37162
+ var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
37164
37163
  var React182 = __toESM(require_react(), 1);
37165
- var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
37164
+ var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
37166
37165
  var React192 = __toESM(require_react(), 1);
37167
- var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
37166
+ var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
37168
37167
  var React202 = __toESM(require_react(), 1);
37169
- var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
37168
+ var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
37170
37169
  var React212 = __toESM(require_react(), 1);
37171
- var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
37170
+ var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
37172
37171
  var React2222 = __toESM(require_react(), 1);
37173
- var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
37172
+ var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
37174
37173
  var React232 = __toESM(require_react(), 1);
37175
- var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
37174
+ var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
37176
37175
  var React242 = __toESM(require_react(), 1);
37177
- var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
37176
+ var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
37178
37177
  var React252 = __toESM(require_react(), 1);
37179
- var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
37178
+ var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
37180
37179
  var React262 = __toESM(require_react(), 1);
37181
- var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
37180
+ var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
37182
37181
  var React272 = __toESM(require_react(), 1);
37182
+ var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
37183
+ var React282 = __toESM(require_react(), 1);
37183
37184
  var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
37184
37185
  var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
37185
37186
  var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
37186
- var React292 = __toESM(require_react(), 1);
37187
+ var React302 = __toESM(require_react(), 1);
37187
37188
  var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
37188
37189
  var import_react22 = __toESM(require_react(), 1);
37189
37190
  var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
@@ -37193,7 +37194,7 @@ var import_react24 = __toESM(require_react(), 1);
37193
37194
  var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
37194
37195
  var import_react25 = __toESM(require_react(), 1);
37195
37196
  var import_react26 = __toESM(require_react(), 1);
37196
- var React312 = __toESM(require_react(), 1);
37197
+ var React322 = __toESM(require_react(), 1);
37197
37198
  var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
37198
37199
  var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
37199
37200
  var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
@@ -37203,7 +37204,7 @@ var import_react28 = __toESM(require_react(), 1);
37203
37204
  var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1);
37204
37205
  var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1);
37205
37206
  var import_react29 = __toESM(require_react(), 1);
37206
- var React322 = __toESM(require_react(), 1);
37207
+ var React332 = __toESM(require_react(), 1);
37207
37208
  var React31 = __toESM(require_react(), 1);
37208
37209
  var React29 = __toESM(require_react(), 1);
37209
37210
  var React26 = __toESM(require_react(), 1);
@@ -37220,7 +37221,7 @@ var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1);
37220
37221
  var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
37221
37222
  var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
37222
37223
  var import_react31 = __toESM(require_react(), 1);
37223
- var React332 = __toESM(require_react(), 1);
37224
+ var React342 = __toESM(require_react(), 1);
37224
37225
  var React35 = __toESM(require_react(), 1);
37225
37226
  var ReactDOM4 = __toESM(require_react_dom(), 1);
37226
37227
  var import_react32 = __toESM(require_react(), 1);
@@ -37233,7 +37234,7 @@ var React34 = __toESM(require_react(), 1);
37233
37234
  var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
37234
37235
  var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
37235
37236
  var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1);
37236
- var React342 = __toESM(require_react(), 1);
37237
+ var React352 = __toESM(require_react(), 1);
37237
37238
  var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
37238
37239
  var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
37239
37240
  var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1);
@@ -38399,7 +38400,10 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38399
38400
  })()));
38400
38401
  }
38401
38402
  });
38402
- var UnifoldContext = (0, import_react2.createContext)(null);
38403
+ var UNIFOLD_CONTEXT_KEY = /* @__PURE__ */ Symbol.for("unifold.react-provider.context");
38404
+ var globalRef = globalThis;
38405
+ var UnifoldContext = globalRef[UNIFOLD_CONTEXT_KEY] ?? (0, import_react2.createContext)(null);
38406
+ globalRef[UNIFOLD_CONTEXT_KEY] = UnifoldContext;
38403
38407
  var createQueryClient = () => new QueryClient({
38404
38408
  defaultOptions: {
38405
38409
  queries: {
@@ -43159,6 +43163,9 @@ var getDefaultConfig = () => {
43159
43163
  };
43160
43164
  };
43161
43165
  var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
43166
+ var __defProp22 = Object.defineProperty;
43167
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp22(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
43168
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
43162
43169
  function formatStablecoinAmount(baseUnits, decimals) {
43163
43170
  const raw = Number(baseUnits) / 10 ** decimals;
43164
43171
  const floored = Math.floor(raw * 100) / 100;
@@ -43249,6 +43256,16 @@ var ActionType = /* @__PURE__ */ ((ActionType2) => {
43249
43256
  ActionType2["Withdraw"] = "withdraw";
43250
43257
  return ActionType2;
43251
43258
  })(ActionType || {});
43259
+ var DepositAddressValidationError = class extends Error {
43260
+ constructor(message) {
43261
+ super(message);
43262
+ __publicField(this, "isDepositAddressValidationError", true);
43263
+ this.name = "DepositAddressValidationError";
43264
+ }
43265
+ };
43266
+ function isDepositAddressValidationError(error) {
43267
+ return error instanceof Error && error.isDepositAddressValidationError === true;
43268
+ }
43252
43269
  async function createDepositAddress(overrides, publishableKey) {
43253
43270
  if (!overrides?.external_user_id) {
43254
43271
  throw new Error("external_user_id is required");
@@ -43276,6 +43293,13 @@ async function createDepositAddress(overrides, publishableKey) {
43276
43293
  body: JSON.stringify(payload)
43277
43294
  });
43278
43295
  if (!response.ok) {
43296
+ if (response.status === 400) {
43297
+ const body = await response.json().catch(() => null);
43298
+ if (body?.error_type === "validation_error") {
43299
+ const firstError = Array.isArray(body.details?.errors) ? body.details?.errors[0] : void 0;
43300
+ throw new DepositAddressValidationError(firstError ?? "Invalid recipient address");
43301
+ }
43302
+ }
43279
43303
  throw new Error(`Failed to create EOA: ${response.statusText}`);
43280
43304
  }
43281
43305
  return response.json();
@@ -43445,6 +43469,27 @@ async function getFiatCurrencies(publishableKey) {
43445
43469
  }
43446
43470
  return response.json();
43447
43471
  }
43472
+ async function getFiatExchangeRates(options2 = {}, publishableKey) {
43473
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43474
+ validatePublishableKey(pk);
43475
+ const params = new URLSearchParams();
43476
+ if (options2.currencies && options2.currencies.length > 0) {
43477
+ params.set("currencies", options2.currencies.join(","));
43478
+ }
43479
+ const queryString = params.toString();
43480
+ const url = `${API_BASE_URL}/v1/public/exchange_rates/fiat_currencies${queryString ? `?${queryString}` : ""}`;
43481
+ const response = await fetch(url, {
43482
+ method: "GET",
43483
+ headers: {
43484
+ accept: "application/json",
43485
+ "x-publishable-key": pk
43486
+ }
43487
+ });
43488
+ if (!response.ok) {
43489
+ throw new Error(`Failed to fetch fiat exchange rates: ${response.statusText}`);
43490
+ }
43491
+ return response.json();
43492
+ }
43448
43493
  async function getOnrampQuotes(request, publishableKey) {
43449
43494
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43450
43495
  validatePublishableKey(pk);
@@ -43593,6 +43638,21 @@ async function getProjectConfig(publishableKey, options2) {
43593
43638
  const data = await response.json();
43594
43639
  return data;
43595
43640
  }
43641
+ async function getPublicIncident(publishableKey) {
43642
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43643
+ validatePublishableKey(pk);
43644
+ const response = await fetch(`${API_BASE_URL}/v1/public/projects/incident`, {
43645
+ method: "GET",
43646
+ headers: {
43647
+ accept: "application/json",
43648
+ "x-publishable-key": pk
43649
+ }
43650
+ });
43651
+ if (!response.ok) {
43652
+ throw new Error(`Failed to fetch public incident: ${response.statusText}`);
43653
+ }
43654
+ return response.json();
43655
+ }
43596
43656
  async function getIpAddress() {
43597
43657
  const response = await fetch(`${API_BASE_URL}/v1/public/ip_address`, {
43598
43658
  method: "GET",
@@ -43648,7 +43708,7 @@ async function getExternalWallets(publishableKey) {
43648
43708
  const data = await response.json();
43649
43709
  return data;
43650
43710
  }
43651
- async function getWalletMobileDeepLink(wallet, depositAddresses, publishableKey) {
43711
+ async function getWalletMobileDeepLink(wallet, depositAddresses, publishableKey, amountUsd) {
43652
43712
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43653
43713
  validatePublishableKey(pk);
43654
43714
  const response = await fetch(`${API_BASE_URL}/v1/public/external_wallets/mobile_deeplink`, {
@@ -43658,7 +43718,11 @@ async function getWalletMobileDeepLink(wallet, depositAddresses, publishableKey)
43658
43718
  accept: "application/json",
43659
43719
  "x-publishable-key": pk
43660
43720
  },
43661
- body: JSON.stringify({ wallet, deposit_addresses: depositAddresses })
43721
+ body: JSON.stringify({
43722
+ wallet,
43723
+ deposit_addresses: depositAddresses,
43724
+ ...amountUsd ? { amount_usd: amountUsd } : {}
43725
+ })
43662
43726
  });
43663
43727
  if (!response.ok) {
43664
43728
  throw new Error(`Failed to generate wallet deep link: ${response.statusText}`);
@@ -43703,6 +43767,15 @@ async function verifyRecipientAddress(request, publishableKey) {
43703
43767
  body: JSON.stringify(request)
43704
43768
  });
43705
43769
  if (!response.ok) {
43770
+ const body = await response.json().catch(() => null);
43771
+ if (response.status === 400 && body?.error_type === "validation_error") {
43772
+ const firstError = Array.isArray(body.details?.errors) ? body.details?.errors[0] : void 0;
43773
+ return {
43774
+ valid: false,
43775
+ failure_code: "validation_error",
43776
+ message: firstError ?? "Invalid recipient address"
43777
+ };
43778
+ }
43706
43779
  throw new Error(`Failed to verify recipient address: ${response.statusText}`);
43707
43780
  }
43708
43781
  return response.json();
@@ -44109,6 +44182,7 @@ async function stripeGetDefaultToken(params, publishableKey) {
44109
44182
  chain_type: params.chainType
44110
44183
  });
44111
44184
  if (params.countryCode) query.append("country_code", params.countryCode);
44185
+ if (params.subdivisionCode) query.append("subdivision_code", params.subdivisionCode);
44112
44186
  const response = await fetch(
44113
44187
  `${API_BASE_URL}${HEADLESS_STRIPE_BASE}/default_token?${query.toString()}`,
44114
44188
  {
@@ -51293,7 +51367,13 @@ function useDepositAddress(params) {
51293
51367
  // 24 hours in cache
51294
51368
  refetchOnMount: false,
51295
51369
  refetchOnWindowFocus: false,
51296
- retry: 3,
51370
+ // Don't retry recipient-address validation errors — they're deterministic
51371
+ // (a 400 won't succeed on retry) and we want to surface the invalid-address
51372
+ // screen immediately rather than after 3 backoff attempts.
51373
+ retry: (failureCount, error) => {
51374
+ if (isDepositAddressValidationError(error)) return false;
51375
+ return failureCount < 3;
51376
+ },
51297
51377
  retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 1e4)
51298
51378
  // 1s, 2s, 4s (max 10s)
51299
51379
  });
@@ -51501,7 +51581,8 @@ function DepositHeader({
51501
51581
  balanceChainId,
51502
51582
  balanceTokenAddress,
51503
51583
  projectName,
51504
- publishableKey
51584
+ publishableKey,
51585
+ incident
51505
51586
  }) {
51506
51587
  const { colors: colors2, fonts, components } = useTheme();
51507
51588
  const [balance, setBalance] = (0, import_react10.useState)(null);
@@ -51599,19 +51680,64 @@ function DepositHeader({
51599
51680
  balanceTokenAddress,
51600
51681
  publishableKey
51601
51682
  ]);
51602
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between uf-pb-6", children: [
51603
- showBack ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51604
- "button",
51605
- {
51606
- onClick: onBack,
51607
- className: "hover:uf-bg-secondary uf-rounded-lg uf-p-1 uf-transition-colors",
51608
- style: { color: components.header.buttonColor },
51609
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ArrowLeft, { className: "uf-w-5 uf-h-5" })
51610
- }
51611
- ) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uf-w-5 uf-h-5 uf-invisible" }),
51612
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center", children: [
51613
- badge ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
51614
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51683
+ const incidentMessages = incident?.messages ?? [];
51684
+ const showIncident = incident?.enabled && incidentMessages.length > 0;
51685
+ const incidentSeverity = incident?.severity ?? "degraded";
51686
+ const incidentSeverityLabel = incidentSeverity === "outage" ? "Outage" : incidentSeverity === "info" ? "Info" : "Degraded service";
51687
+ const incidentStyles = incidentSeverity === "outage" ? {
51688
+ bg: "rgba(239, 68, 68, 0.12)",
51689
+ border: "rgba(239, 68, 68, 0.35)",
51690
+ text: "#fca5a5",
51691
+ link: "#fca5a5"
51692
+ } : incidentSeverity === "info" ? {
51693
+ bg: "rgba(59, 130, 246, 0.12)",
51694
+ border: "rgba(59, 130, 246, 0.35)",
51695
+ text: "#93c5fd",
51696
+ link: "#93c5fd"
51697
+ } : {
51698
+ bg: "rgba(245, 158, 11, 0.12)",
51699
+ border: "rgba(245, 158, 11, 0.35)",
51700
+ text: "#fcd34d",
51701
+ link: "#fcd34d"
51702
+ };
51703
+ const IncidentIcon = incidentSeverity === "info" ? Info : TriangleAlert;
51704
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
51705
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between uf-pb-6", children: [
51706
+ showBack ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51707
+ "button",
51708
+ {
51709
+ onClick: onBack,
51710
+ className: "hover:uf-bg-secondary uf-rounded-lg uf-p-1 uf-transition-colors",
51711
+ style: { color: components.header.buttonColor },
51712
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ArrowLeft, { className: "uf-w-5 uf-h-5" })
51713
+ }
51714
+ ) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uf-w-5 uf-h-5 uf-invisible" }),
51715
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center", children: [
51716
+ badge ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
51717
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51718
+ DialogTitle2,
51719
+ {
51720
+ className: "uf-text-center uf-text-base",
51721
+ style: {
51722
+ color: components.header.titleColor,
51723
+ fontFamily: fonts.medium
51724
+ },
51725
+ children: title
51726
+ }
51727
+ ),
51728
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51729
+ "div",
51730
+ {
51731
+ className: "uf-px-2 uf-py-0.5 uf-rounded-full uf-text-[10px]",
51732
+ style: {
51733
+ backgroundColor: colors2.card,
51734
+ color: colors2.foregroundMuted,
51735
+ fontFamily: fonts.regular
51736
+ },
51737
+ children: badge.count
51738
+ }
51739
+ )
51740
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51615
51741
  DialogTitle2,
51616
51742
  {
51617
51743
  className: "uf-text-center uf-text-base",
@@ -51622,61 +51748,91 @@ function DepositHeader({
51622
51748
  children: title
51623
51749
  }
51624
51750
  ),
51625
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51751
+ subtitle ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51626
51752
  "div",
51627
51753
  {
51628
- className: "uf-px-2 uf-py-0.5 uf-rounded-full uf-text-[10px]",
51754
+ className: "uf-text-xs uf-mt-1",
51629
51755
  style: {
51630
- backgroundColor: colors2.card,
51631
51756
  color: colors2.foregroundMuted,
51632
51757
  fontFamily: fonts.regular
51633
51758
  },
51634
- children: badge.count
51759
+ children: subtitle
51635
51760
  }
51636
- )
51637
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51638
- DialogTitle2,
51639
- {
51640
- className: "uf-text-center uf-text-base",
51641
- style: {
51642
- color: components.header.titleColor,
51643
- fontFamily: fonts.medium
51644
- },
51645
- children: title
51646
- }
51647
- ),
51648
- subtitle ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51649
- "div",
51650
- {
51651
- className: "uf-text-xs uf-mt-1",
51652
- style: {
51653
- color: colors2.foregroundMuted,
51654
- fontFamily: fonts.regular
51655
- },
51656
- children: subtitle
51657
- }
51658
- ) : showBalanceBlock ? isLoadingBalance && showBalanceSkeleton ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uf-h-3 uf-w-32 uf-bg-muted uf-rounded uf-animate-pulse uf-mt-1" }) : balance ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51659
- "div",
51761
+ ) : showBalanceBlock ? isLoadingBalance && showBalanceSkeleton ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uf-h-3 uf-w-32 uf-bg-muted uf-rounded uf-animate-pulse uf-mt-1" }) : balance ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51762
+ "div",
51763
+ {
51764
+ className: "uf-text-xs uf-mt-1",
51765
+ style: {
51766
+ color: colors2.foregroundMuted,
51767
+ fontFamily: fonts.regular
51768
+ },
51769
+ children: formatBalanceDisplay(balance, projectName)
51770
+ }
51771
+ ) : null : null
51772
+ ] }),
51773
+ showClose ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51774
+ "button",
51660
51775
  {
51661
- className: "uf-text-xs uf-mt-1",
51662
- style: {
51663
- color: colors2.foregroundMuted,
51664
- fontFamily: fonts.regular
51665
- },
51666
- children: formatBalanceDisplay(balance, projectName)
51776
+ onClick: onClose,
51777
+ className: "hover:uf-bg-secondary uf-rounded-lg uf-p-1 uf-transition-colors",
51778
+ style: { color: components.header.buttonColor },
51779
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(X, { className: "uf-w-5 uf-h-5" })
51667
51780
  }
51668
- ) : null : null
51781
+ ) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uf-w-5 uf-h-5 uf-invisible" })
51669
51782
  ] }),
51670
- showClose ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51671
- "button",
51783
+ showIncident && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51784
+ "div",
51672
51785
  {
51673
- onClick: onClose,
51674
- className: "hover:uf-bg-secondary uf-rounded-lg uf-p-1 uf-transition-colors",
51675
- style: { color: components.header.buttonColor },
51676
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(X, { className: "uf-w-5 uf-h-5" })
51786
+ className: "uf-rounded-lg uf-px-3 uf-py-2.5 uf-mb-4",
51787
+ style: {
51788
+ backgroundColor: incidentStyles.bg,
51789
+ border: `1px solid ${incidentStyles.border}`
51790
+ },
51791
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "uf-flex uf-items-start uf-gap-2.5", children: [
51792
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51793
+ IncidentIcon,
51794
+ {
51795
+ className: "uf-w-4 uf-h-4 uf-mt-0.5 uf-shrink-0",
51796
+ style: { color: incidentStyles.text }
51797
+ }
51798
+ ),
51799
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "uf-min-w-0 uf-flex-1", children: [
51800
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2 uf-mb-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51801
+ "span",
51802
+ {
51803
+ className: "uf-text-[11px] uf-leading-none uf-px-1.5 uf-py-1 uf-rounded-md",
51804
+ style: {
51805
+ color: incidentStyles.text,
51806
+ border: `1px solid ${incidentStyles.border}`,
51807
+ fontFamily: fonts.medium
51808
+ },
51809
+ children: incidentSeverityLabel
51810
+ }
51811
+ ) }),
51812
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51813
+ "div",
51814
+ {
51815
+ className: "uf-space-y-1",
51816
+ style: { color: incidentStyles.text, fontFamily: fonts.regular },
51817
+ children: incidentMessages.map((message, index2) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "uf-text-xs uf-leading-relaxed", children: message }, `${message}-${index2}`))
51818
+ }
51819
+ ),
51820
+ incident.statusPageUrl && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
51821
+ "a",
51822
+ {
51823
+ href: incident.statusPageUrl,
51824
+ target: "_blank",
51825
+ rel: "noreferrer",
51826
+ className: "uf-inline-block uf-mt-1.5 uf-text-xs uf-underline uf-underline-offset-2",
51827
+ style: { color: incidentStyles.link, fontFamily: fonts.medium },
51828
+ children: "View status"
51829
+ }
51830
+ )
51831
+ ] })
51832
+ ] })
51677
51833
  }
51678
- ) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uf-w-5 uf-h-5 uf-invisible" })
51679
- ] }) });
51834
+ )
51835
+ ] });
51680
51836
  }
51681
51837
  function CurrencyListItem({ currency, isSelected, onSelect }) {
51682
51838
  const { colors: colors2, fonts, components } = useTheme();
@@ -51996,7 +52152,8 @@ var en_default2 = {
51996
52152
  },
51997
52153
  stripeLink: {
51998
52154
  title: "Pay with Link",
51999
- subtitle: "Buy with card or bank"
52155
+ subtitle: "Buy with card or bank",
52156
+ unavailableInRegionMessage: "Pay with Link is currently unavailable in your region."
52000
52157
  },
52001
52158
  browserWallet: {
52002
52159
  title: "Connect Wallet",
@@ -53162,13 +53319,25 @@ function BuyWithCard({
53162
53319
  wallets: externalWallets,
53163
53320
  assetCdnUrl,
53164
53321
  hideDepositFlowInfo = false,
53165
- hideDisplayDescription = false
53322
+ hideDisplayDescription = false,
53323
+ prefilledAmountUsd
53166
53324
  }) {
53167
53325
  const { colors: colors2, fonts, components } = useTheme();
53168
- const [amount, setAmount] = (0, import_react7.useState)("");
53326
+ const cleanedPrefilledAmountUsd = React522.useMemo(() => {
53327
+ if (!prefilledAmountUsd) return "";
53328
+ return prefilledAmountUsd.replace(/[^0-9.]/g, "");
53329
+ }, [prefilledAmountUsd]);
53330
+ const parsedPrefilledAmountUsd = React522.useMemo(() => {
53331
+ const parsed = parseFloat(cleanedPrefilledAmountUsd);
53332
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
53333
+ }, [cleanedPrefilledAmountUsd]);
53334
+ const shouldAutoConvertPrefilledRef = (0, import_react7.useRef)(!!cleanedPrefilledAmountUsd);
53335
+ const [amount, setAmount] = (0, import_react7.useState)(() => cleanedPrefilledAmountUsd);
53169
53336
  const [currency, setCurrency] = (0, import_react7.useState)("usd");
53170
53337
  const [hasManualCurrencySelection, setHasManualCurrencySelection] = (0, import_react7.useState)(false);
53171
- const [hasManualAmountEntry, setHasManualAmountEntry] = (0, import_react7.useState)(false);
53338
+ const [hasManualAmountEntry, setHasManualAmountEntry] = (0, import_react7.useState)(
53339
+ () => !!cleanedPrefilledAmountUsd
53340
+ );
53172
53341
  const [showCurrencyModal, setShowCurrencyModal] = (0, import_react7.useState)(false);
53173
53342
  const [quotes, setQuotes] = (0, import_react7.useState)([]);
53174
53343
  const [quotesLoading, setQuotesLoading] = (0, import_react7.useState)(false);
@@ -53225,6 +53394,71 @@ function BuyWithCard({
53225
53394
  const [preferredCurrencyCodes, setPreferredCurrencyCodes] = (0, import_react7.useState)([]);
53226
53395
  const [currenciesLoading, setCurrenciesLoading] = (0, import_react7.useState)(true);
53227
53396
  const [destinationToken, setDestinationToken] = (0, import_react7.useState)(null);
53397
+ (0, import_react7.useEffect)(() => {
53398
+ const hasPrefilledAmount = !!cleanedPrefilledAmountUsd;
53399
+ shouldAutoConvertPrefilledRef.current = hasPrefilledAmount;
53400
+ if (!hasPrefilledAmount) return;
53401
+ setAmount(cleanedPrefilledAmountUsd);
53402
+ setHasManualAmountEntry(true);
53403
+ }, [cleanedPrefilledAmountUsd]);
53404
+ const { data: fiatExchangeRatesResponse, isLoading: isFiatExchangeRatesLoading } = useQuery({
53405
+ queryKey: ["fiat-exchange-rates", publishableKey],
53406
+ staleTime: 3e4,
53407
+ refetchInterval: 3e4,
53408
+ queryFn: async () => {
53409
+ try {
53410
+ return await getFiatExchangeRates({}, publishableKey);
53411
+ } catch (error) {
53412
+ console.error("Error fetching fiat exchange rates:", error);
53413
+ return { base_currency: "usd", rates: {} };
53414
+ }
53415
+ }
53416
+ });
53417
+ const fiatExchangeRates = fiatExchangeRatesResponse?.rates ?? {};
53418
+ const convertAmountBetweenCurrencies = React522.useCallback(
53419
+ (rawAmount, fromCurrencyCode, toCurrencyCode) => {
53420
+ const parsedAmount = parseFloat(rawAmount);
53421
+ if (!Number.isFinite(parsedAmount) || parsedAmount <= 0) return null;
53422
+ const fromCode = fromCurrencyCode.toLowerCase();
53423
+ const toCode = toCurrencyCode.toLowerCase();
53424
+ const fromRate = fromCode === "usd" ? 1 : fiatExchangeRates[fromCode];
53425
+ const toRate = toCode === "usd" ? 1 : fiatExchangeRates[toCode];
53426
+ if (!Number.isFinite(fromRate) || fromRate <= 0) return null;
53427
+ if (!Number.isFinite(toRate) || toRate <= 0) return null;
53428
+ const usdAmount = parsedAmount / fromRate;
53429
+ return parseFloat((usdAmount * toRate).toFixed(2)).toString();
53430
+ },
53431
+ [fiatExchangeRates]
53432
+ );
53433
+ const getConvertedPrefilledAmount = React522.useCallback(
53434
+ (targetCurrencyCode) => {
53435
+ if (!parsedPrefilledAmountUsd) return null;
53436
+ const normalizedTargetCurrency = targetCurrencyCode.toLowerCase();
53437
+ const rate = normalizedTargetCurrency === "usd" ? 1 : fiatExchangeRates[normalizedTargetCurrency];
53438
+ if (!Number.isFinite(rate) || rate <= 0) return null;
53439
+ return parseFloat((parsedPrefilledAmountUsd * rate).toFixed(2)).toString();
53440
+ },
53441
+ [parsedPrefilledAmountUsd, fiatExchangeRates]
53442
+ );
53443
+ (0, import_react7.useEffect)(() => {
53444
+ if (!cleanedPrefilledAmountUsd || !shouldAutoConvertPrefilledRef.current) return;
53445
+ const convertedAmount = getConvertedPrefilledAmount(currency);
53446
+ if (!convertedAmount) {
53447
+ if (isFiatExchangeRatesLoading) return;
53448
+ const targetCurrency = currency.toLowerCase();
53449
+ if (targetCurrency !== "usd") {
53450
+ setCurrency("usd");
53451
+ }
53452
+ return;
53453
+ }
53454
+ setAmount(convertedAmount);
53455
+ setHasManualAmountEntry(true);
53456
+ }, [
53457
+ cleanedPrefilledAmountUsd,
53458
+ currency,
53459
+ getConvertedPrefilledAmount,
53460
+ isFiatExchangeRatesLoading
53461
+ ]);
53228
53462
  const depositWalletId = defaultToken ? getWalletByChainType(wallets, defaultToken.destination_token_metadata.chain_type)?.id : void 0;
53229
53463
  const { executions, isPolling, showWaitingUi } = useDepositPolling({
53230
53464
  userId,
@@ -53255,6 +53489,7 @@ function BuyWithCard({
53255
53489
  }, [publishableKey]);
53256
53490
  (0, import_react7.useEffect)(() => {
53257
53491
  if (hasManualCurrencySelection) return;
53492
+ if (hasManualAmountEntry && !shouldAutoConvertPrefilledRef.current) return;
53258
53493
  if (fiatCurrencies.length === 0 || !userIpInfo?.alpha2) return;
53259
53494
  const userCountryCode = userIpInfo.alpha2;
53260
53495
  const matchingCurrency = fiatCurrencies.find((c) => c.country_codes.includes(userCountryCode));
@@ -53273,7 +53508,15 @@ function BuyWithCard({
53273
53508
  const prevCurrencyRef = (0, import_react7.useRef)(null);
53274
53509
  (0, import_react7.useEffect)(() => {
53275
53510
  if (fiatCurrencies.length === 0) return;
53511
+ if (shouldAutoConvertPrefilledRef.current) {
53512
+ prevCurrencyRef.current = currency;
53513
+ return;
53514
+ }
53276
53515
  if (prevCurrencyRef.current !== null && prevCurrencyRef.current !== currency) {
53516
+ if (hasManualAmountEntry) {
53517
+ prevCurrencyRef.current = currency;
53518
+ return;
53519
+ }
53277
53520
  const currentCurrency = fiatCurrencies.find(
53278
53521
  (c) => c.currency_code.toLowerCase() === currency.toLowerCase()
53279
53522
  );
@@ -53282,7 +53525,7 @@ function BuyWithCard({
53282
53525
  }
53283
53526
  }
53284
53527
  prevCurrencyRef.current = currency;
53285
- }, [currency]);
53528
+ }, [currency, fiatCurrencies, hasManualAmountEntry]);
53286
53529
  (0, import_react7.useEffect)(() => {
53287
53530
  async function fetchDestinationToken() {
53288
53531
  try {
@@ -53459,6 +53702,7 @@ function BuyWithCard({
53459
53702
  return () => clearInterval(timer);
53460
53703
  }, [quotes.length, amount]);
53461
53704
  const handleAmountChange = (value) => {
53705
+ shouldAutoConvertPrefilledRef.current = false;
53462
53706
  if (value === "") {
53463
53707
  setAmount(value);
53464
53708
  setHasManualAmountEntry(true);
@@ -53472,6 +53716,7 @@ function BuyWithCard({
53472
53716
  }
53473
53717
  };
53474
53718
  const handleQuickAmount = (quickAmount) => {
53719
+ shouldAutoConvertPrefilledRef.current = false;
53475
53720
  setAmount(quickAmount.toString());
53476
53721
  setHasManualAmountEntry(true);
53477
53722
  };
@@ -54075,8 +54320,43 @@ function BuyWithCard({
54075
54320
  preferredCurrencyCodes,
54076
54321
  selectedCurrency: currency,
54077
54322
  onSelectCurrency: (currencyCode) => {
54078
- setCurrency(currencyCode.toLowerCase());
54323
+ const nextCurrency = currencyCode.toLowerCase();
54324
+ if (nextCurrency === currency.toLowerCase()) {
54325
+ setHasManualCurrencySelection(true);
54326
+ return;
54327
+ }
54328
+ const currentCurrency = currency;
54079
54329
  setHasManualCurrencySelection(true);
54330
+ if (shouldAutoConvertPrefilledRef.current) {
54331
+ const convertedAmount = getConvertedPrefilledAmount(nextCurrency);
54332
+ if (convertedAmount) {
54333
+ setCurrency(nextCurrency);
54334
+ setAmount(convertedAmount);
54335
+ setHasManualAmountEntry(true);
54336
+ } else {
54337
+ if (isFiatExchangeRatesLoading) return;
54338
+ const fallbackUsdAmount = getConvertedPrefilledAmount("usd");
54339
+ setCurrency("usd");
54340
+ if (fallbackUsdAmount) {
54341
+ setAmount(fallbackUsdAmount);
54342
+ setHasManualAmountEntry(true);
54343
+ }
54344
+ }
54345
+ return;
54346
+ }
54347
+ if (hasManualAmountEntry && amount) {
54348
+ const convertedAmount = convertAmountBetweenCurrencies(
54349
+ amount,
54350
+ currentCurrency,
54351
+ nextCurrency
54352
+ );
54353
+ if (convertedAmount) {
54354
+ setCurrency(nextCurrency);
54355
+ setAmount(convertedAmount);
54356
+ }
54357
+ return;
54358
+ }
54359
+ setCurrency(nextCurrency);
54080
54360
  },
54081
54361
  themeClass
54082
54362
  }
@@ -54321,7 +54601,7 @@ function parseCoinbasePostMessage(raw) {
54321
54601
  } : void 0
54322
54602
  };
54323
54603
  }
54324
- var BuyWithApplePay = React522.forwardRef(
54604
+ var BuyWithApplePay = React622.forwardRef(
54325
54605
  function BuyWithApplePay2({
54326
54606
  userId,
54327
54607
  publishableKey,
@@ -54480,7 +54760,7 @@ var BuyWithApplePay = React522.forwardRef(
54480
54760
  popupRef.current = null;
54481
54761
  };
54482
54762
  }, []);
54483
- React522.useImperativeHandle(
54763
+ React622.useImperativeHandle(
54484
54764
  ref,
54485
54765
  () => ({
54486
54766
  requestBack: () => {
@@ -55790,7 +56070,7 @@ function LegalDisclaimer({ legalAgreements, loading }) {
55790
56070
  children: [
55791
56071
  "By continuing, you agree to Coinbase's",
55792
56072
  " ",
55793
- agreements.map((a, idx, arr) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(React522.Fragment, { children: [
56073
+ agreements.map((a, idx, arr) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(React622.Fragment, { children: [
55794
56074
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
55795
56075
  "a",
55796
56076
  {
@@ -56219,6 +56499,7 @@ var POLL_INTERVAL_MS2 = 5e3;
56219
56499
  var FALLBACK_MIN_USD = 5;
56220
56500
  var SUGGESTED_AMOUNTS = [25, 50, 100];
56221
56501
  var t3 = i18n2.depositModal.cashApp;
56502
+ var sanitizePrefilledUsd = (value) => value?.replace(/[^0-9.]/g, "") ?? "";
56222
56503
  function PayWithCashApp({
56223
56504
  userId,
56224
56505
  publishableKey,
@@ -56233,6 +56514,7 @@ function PayWithCashApp({
56233
56514
  onEvent,
56234
56515
  onDepositSuccess,
56235
56516
  onDepositError,
56517
+ prefilledAmountUsd,
56236
56518
  wallets = []
56237
56519
  }) {
56238
56520
  const { colors: colors2, fonts, components } = useTheme();
@@ -56248,7 +56530,7 @@ function PayWithCashApp({
56248
56530
  const { data: limits, isLoading: limitsLoading } = useCashAppLimits({ publishableKey });
56249
56531
  const minUsd = limits?.minimum_amount ?? FALLBACK_MIN_USD;
56250
56532
  const maxUsd = limits?.maximum_amount ?? null;
56251
- const [amount, setAmount] = (0, import_react18.useState)("");
56533
+ const [amount, setAmount] = (0, import_react18.useState)(() => sanitizePrefilledUsd(prefilledAmountUsd));
56252
56534
  const [loading, setLoading] = (0, import_react18.useState)(false);
56253
56535
  const [session, setSession] = (0, import_react18.useState)(null);
56254
56536
  const [status, setStatus] = (0, import_react18.useState)("pending");
@@ -56371,6 +56653,13 @@ function PayWithCashApp({
56371
56653
  return () => clearInterval(interval);
56372
56654
  }, [session, view, status, publishableKey, onDepositSuccess, onDepositError]);
56373
56655
  const [softExpired, setSoftExpired] = (0, import_react18.useState)(false);
56656
+ (0, import_react18.useEffect)(() => {
56657
+ if (!prefilledAmountUsd) return;
56658
+ const cleaned = sanitizePrefilledUsd(prefilledAmountUsd);
56659
+ if (!cleaned) return;
56660
+ setAmount(cleaned);
56661
+ onAmountChange?.(cleaned);
56662
+ }, [prefilledAmountUsd, onAmountChange]);
56374
56663
  (0, import_react18.useEffect)(() => {
56375
56664
  if (!session?.expires_at || view !== "payment") return;
56376
56665
  const expiresMs = new Date(session.expires_at).getTime();
@@ -56763,7 +57052,8 @@ function BankTransfer({
56763
57052
  assetCdnUrl,
56764
57053
  onDepositSuccess,
56765
57054
  onEvent,
56766
- onDepositError
57055
+ onDepositError,
57056
+ prefilledAmountUsd
56767
57057
  }) {
56768
57058
  const { colors: colors2, fonts, components } = useTheme();
56769
57059
  const [internalView, setInternalView] = (0, import_react21.useState)("providers");
@@ -56773,6 +57063,10 @@ function BankTransfer({
56773
57063
  const [requestBase, setRequestBase] = (0, import_react21.useState)(null);
56774
57064
  const [activeRequest, setActiveRequest] = (0, import_react21.useState)(null);
56775
57065
  const [amount, setAmount] = (0, import_react21.useState)("");
57066
+ const [fiatExchangeRates, setFiatExchangeRates] = (0, import_react21.useState)({
57067
+ usd: 1
57068
+ });
57069
+ const providerSelectionRequestIdRef = (0, import_react21.useRef)(0);
56776
57070
  const currentView = externalView ?? internalView;
56777
57071
  const setView = (v) => {
56778
57072
  setInternalView(v);
@@ -56822,7 +57116,38 @@ function BankTransfer({
56822
57116
  () => destinationTokenSymbol?.toUpperCase() ?? defaultToken?.destination_token_metadata?.symbol?.toUpperCase() ?? defaultToken?.destination_currency?.toUpperCase() ?? "USDC",
56823
57117
  [destinationTokenSymbol, defaultToken]
56824
57118
  );
56825
- const handleProviderClick = (provider) => {
57119
+ const resolvePrefilledSourceAmount = (0, import_react21.useCallback)(
57120
+ async (sourceCurrencyCode) => {
57121
+ const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
57122
+ if (!cleanedPrefilled) return "";
57123
+ const prefilledUsd = parseFloat(cleanedPrefilled);
57124
+ if (!Number.isFinite(prefilledUsd) || prefilledUsd <= 0) return "";
57125
+ const sourceCurrency2 = sourceCurrencyCode.toLowerCase();
57126
+ let rate = sourceCurrency2 === "usd" ? 1 : fiatExchangeRates[sourceCurrency2];
57127
+ if ((!rate || rate <= 0) && sourceCurrency2 !== "usd") {
57128
+ try {
57129
+ const response = await getFiatExchangeRates({}, publishableKey);
57130
+ if (response?.rates) {
57131
+ setFiatExchangeRates((prev) => ({
57132
+ ...prev,
57133
+ ...response.rates,
57134
+ usd: 1
57135
+ }));
57136
+ }
57137
+ const fetchedRate = response.rates?.[sourceCurrency2];
57138
+ if (Number.isFinite(fetchedRate) && fetchedRate > 0) {
57139
+ rate = fetchedRate;
57140
+ }
57141
+ } catch (error) {
57142
+ console.error("Error fetching fiat exchange rates for bank transfer:", error);
57143
+ }
57144
+ }
57145
+ if (!rate || rate <= 0) return sourceCurrency2 === "usd" ? cleanedPrefilled : "";
57146
+ return parseFloat((prefilledUsd * rate).toFixed(2)).toString();
57147
+ },
57148
+ [fiatExchangeRates, prefilledAmountUsd, publishableKey]
57149
+ );
57150
+ const handleProviderClick = async (provider) => {
56826
57151
  if (!provider.enabled) return;
56827
57152
  setSessionError(null);
56828
57153
  if (!defaultToken) {
@@ -56841,6 +57166,7 @@ function BankTransfer({
56841
57166
  });
56842
57167
  return;
56843
57168
  }
57169
+ const requestId = ++providerSelectionRequestIdRef.current;
56844
57170
  setRequestBase({
56845
57171
  service_provider: provider.service_provider,
56846
57172
  country_code: (userIpInfo?.alpha2 || "DE").toUpperCase(),
@@ -56854,7 +57180,10 @@ function BankTransfer({
56854
57180
  payment_method: provider.payment_methods[0]
56855
57181
  });
56856
57182
  setActiveProvider(provider);
56857
- setAmount("100");
57183
+ const convertedPrefilled = await resolvePrefilledSourceAmount(provider.source_currency);
57184
+ if (requestId !== providerSelectionRequestIdRef.current) return;
57185
+ const hasPrefilledAmount = !!prefilledAmountUsd?.replace(/[^0-9.]/g, "");
57186
+ setAmount(hasPrefilledAmount ? convertedPrefilled : "100");
56858
57187
  setView("amount");
56859
57188
  };
56860
57189
  const handleAmountChange = (value) => {
@@ -56952,7 +57281,7 @@ function BankTransfer({
56952
57281
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
56953
57282
  "button",
56954
57283
  {
56955
- onClick: () => handleProviderClick(provider),
57284
+ onClick: () => void handleProviderClick(provider),
56956
57285
  onMouseEnter: () => !disabled && setHoveredId(provider.service_provider),
56957
57286
  onMouseLeave: () => setHoveredId(null),
56958
57287
  disabled,
@@ -57521,9 +57850,9 @@ function TransferCryptoButton({
57521
57850
  featuredTokens
57522
57851
  }) {
57523
57852
  const { colors: colors2, fonts, components } = useTheme();
57524
- const [isHovered, setIsHovered] = React622.useState(false);
57525
- const [isTouchDevice, setIsTouchDevice] = React622.useState(false);
57526
- React622.useEffect(() => {
57853
+ const [isHovered, setIsHovered] = React72.useState(false);
57854
+ const [isTouchDevice, setIsTouchDevice] = React72.useState(false);
57855
+ React72.useEffect(() => {
57527
57856
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
57528
57857
  }, []);
57529
57858
  const sortedTokens = featuredTokens ? [...featuredTokens].sort((a, b) => a.position - b.position) : [];
@@ -57603,9 +57932,9 @@ function DepositWithCardButton({
57603
57932
  paymentNetworks
57604
57933
  }) {
57605
57934
  const { colors: colors2, fonts, components } = useTheme();
57606
- const [isHovered, setIsHovered] = React72.useState(false);
57607
- const [isTouchDevice, setIsTouchDevice] = React72.useState(false);
57608
- React72.useEffect(() => {
57935
+ const [isHovered, setIsHovered] = React82.useState(false);
57936
+ const [isTouchDevice, setIsTouchDevice] = React82.useState(false);
57937
+ React82.useEffect(() => {
57609
57938
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
57610
57939
  }, []);
57611
57940
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
@@ -57684,9 +58013,9 @@ function PayWithExchangeButton({
57684
58013
  loading = false
57685
58014
  }) {
57686
58015
  const { colors: colors2, fonts, components } = useTheme();
57687
- const [isHovered, setIsHovered] = React82.useState(false);
57688
- const [isTouchDevice, setIsTouchDevice] = React82.useState(false);
57689
- React82.useEffect(() => {
58016
+ const [isHovered, setIsHovered] = React92.useState(false);
58017
+ const [isTouchDevice, setIsTouchDevice] = React92.useState(false);
58018
+ React92.useEffect(() => {
57690
58019
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
57691
58020
  }, []);
57692
58021
  if (loading) {
@@ -57788,11 +58117,11 @@ var buttonVariants = cva(
57788
58117
  }
57789
58118
  }
57790
58119
  );
57791
- var Button = React92.forwardRef(
58120
+ var Button = React102.forwardRef(
57792
58121
  ({ className, variant, size: size4, asChild = false, style, ...props }, ref) => {
57793
58122
  const Comp = asChild ? Slot2 : "button";
57794
58123
  const { components, fonts } = useTheme();
57795
- const themeStyle = React92.useMemo(() => {
58124
+ const themeStyle = React102.useMemo(() => {
57796
58125
  const baseStyle = { ...style };
57797
58126
  if (variant === "default" || !variant) {
57798
58127
  baseStyle.backgroundColor = components.button.primaryBackground;
@@ -57827,9 +58156,9 @@ function ConnectExchangeButton({
57827
58156
  connectedExchange
57828
58157
  }) {
57829
58158
  const { colors: colors2, fonts, components } = useTheme();
57830
- const [isHovered, setIsHovered] = React102.useState(false);
57831
- const [isTouchDevice, setIsTouchDevice] = React102.useState(false);
57832
- React102.useEffect(() => {
58159
+ const [isHovered, setIsHovered] = React112.useState(false);
58160
+ const [isTouchDevice, setIsTouchDevice] = React112.useState(false);
58161
+ React112.useEffect(() => {
57833
58162
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
57834
58163
  }, []);
57835
58164
  const isConnected = connectedExchange != null;
@@ -57974,9 +58303,9 @@ function DepositTrackerButton({
57974
58303
  badge
57975
58304
  }) {
57976
58305
  const { colors: colors2, fonts, components } = useTheme();
57977
- const [isHovered, setIsHovered] = React112.useState(false);
57978
- const [isTouchDevice, setIsTouchDevice] = React112.useState(false);
57979
- React112.useEffect(() => {
58306
+ const [isHovered, setIsHovered] = React122.useState(false);
58307
+ const [isTouchDevice, setIsTouchDevice] = React122.useState(false);
58308
+ React122.useEffect(() => {
57980
58309
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
57981
58310
  }, []);
57982
58311
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
@@ -58047,9 +58376,9 @@ function DepositTrackerButton({
58047
58376
  }
58048
58377
  function CashAppButton({ onClick, title, subtitle, iconUrl }) {
58049
58378
  const { colors: colors2, fonts, components } = useTheme();
58050
- const [isHovered, setIsHovered] = React122.useState(false);
58051
- const [isTouchDevice, setIsTouchDevice] = React122.useState(false);
58052
- React122.useEffect(() => {
58379
+ const [isHovered, setIsHovered] = React132.useState(false);
58380
+ const [isTouchDevice, setIsTouchDevice] = React132.useState(false);
58381
+ React132.useEffect(() => {
58053
58382
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
58054
58383
  }, []);
58055
58384
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
@@ -58131,11 +58460,11 @@ function AppleLogo({ className, style }) {
58131
58460
  }
58132
58461
  );
58133
58462
  }
58134
- function ApplePayButton({ onClick, title, subtitle }) {
58463
+ function ApplePayButton({ onClick, title, subtitle, iconUrl }) {
58135
58464
  const { colors: colors2, fonts, components } = useTheme();
58136
- const [isHovered, setIsHovered] = React132.useState(false);
58137
- const [isTouchDevice, setIsTouchDevice] = React132.useState(false);
58138
- React132.useEffect(() => {
58465
+ const [isHovered, setIsHovered] = React142.useState(false);
58466
+ const [isTouchDevice, setIsTouchDevice] = React142.useState(false);
58467
+ React142.useEffect(() => {
58139
58468
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
58140
58469
  }, []);
58141
58470
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
@@ -58153,7 +58482,14 @@ function ApplePayButton({ onClick, title, subtitle }) {
58153
58482
  },
58154
58483
  children: [
58155
58484
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
58156
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "uf-rounded-lg uf-p-2", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AppleLogo, { className: "uf-w-5 uf-h-5", style: { color: components.card.iconColor } }) }),
58485
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("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__ */ (0, import_jsx_runtime37.jsx)("img", { src: iconUrl, alt: "Apple Pay", width: 36, height: 36, className: "uf-rounded-lg" }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
58486
+ "div",
58487
+ {
58488
+ className: "uf-w-9 uf-h-9 uf-rounded-lg uf-flex uf-items-center uf-justify-center",
58489
+ style: { backgroundColor: "#000" },
58490
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AppleLogo, { className: "uf-w-5 uf-h-5", style: { color: "#fff" } })
58491
+ }
58492
+ ) }),
58157
58493
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "uf-text-left", children: [
58158
58494
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
58159
58495
  "div",
@@ -58197,9 +58533,9 @@ function BankTransferButton({
58197
58533
  comingSoon = false
58198
58534
  }) {
58199
58535
  const { colors: colors2, fonts, components } = useTheme();
58200
- const [isHovered, setIsHovered] = React142.useState(false);
58201
- const [isTouchDevice, setIsTouchDevice] = React142.useState(false);
58202
- React142.useEffect(() => {
58536
+ const [isHovered, setIsHovered] = React152.useState(false);
58537
+ const [isTouchDevice, setIsTouchDevice] = React152.useState(false);
58538
+ React152.useEffect(() => {
58203
58539
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
58204
58540
  }, []);
58205
58541
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
@@ -58369,13 +58705,6 @@ function solanaCandidate(provider, type, name, icon) {
58369
58705
  if (provider.isConnected && provider.publicKey) {
58370
58706
  return { type, name, address: provider.publicKey.toString(), icon };
58371
58707
  }
58372
- try {
58373
- const resp = await provider.connect({ onlyIfTrusted: true });
58374
- if (resp.publicKey) {
58375
- return { type, name, address: resp.publicKey.toString(), icon };
58376
- }
58377
- } catch {
58378
- }
58379
58708
  return null;
58380
58709
  }
58381
58710
  };
@@ -58448,18 +58777,18 @@ async function detectConnectedBrowserWallet(chainType) {
58448
58777
  }
58449
58778
  function useDetectedBrowserWallet(opts = {}) {
58450
58779
  const { chainType, enabled = true, onDisconnect } = opts;
58451
- const [wallet, setWallet] = React152.useState(null);
58452
- const [isLoading, setIsLoading] = React152.useState(enabled);
58453
- const [eip6963ProviderCount, setEip6963ProviderCount] = React152.useState(0);
58454
- const onDisconnectRef = React152.useRef(onDisconnect);
58780
+ const [wallet, setWallet] = React162.useState(null);
58781
+ const [isLoading, setIsLoading] = React162.useState(enabled);
58782
+ const [eip6963ProviderCount, setEip6963ProviderCount] = React162.useState(0);
58783
+ const onDisconnectRef = React162.useRef(onDisconnect);
58455
58784
  onDisconnectRef.current = onDisconnect;
58456
- React152.useEffect(() => {
58785
+ React162.useEffect(() => {
58457
58786
  const store = getEip6963Store();
58458
58787
  if (!store) return;
58459
58788
  setEip6963ProviderCount(store.getProviders().length);
58460
58789
  return store.subscribe((providers) => setEip6963ProviderCount(providers.length));
58461
58790
  }, []);
58462
- React152.useEffect(() => {
58791
+ React162.useEffect(() => {
58463
58792
  if (!enabled) {
58464
58793
  setWallet(null);
58465
58794
  setIsLoading(false);
@@ -58599,8 +58928,180 @@ async function disconnectInjectedBrowserWallet(wallet) {
58599
58928
  collectEthereumProvidersForDisconnect(window)
58600
58929
  );
58601
58930
  }
58931
+ var STORED_TYPE_TO_EIP6963_WALLET_ID = {
58932
+ metamask: "metamask",
58933
+ "phantom-ethereum": "phantom",
58934
+ coinbase: "coinbase",
58935
+ trust: "trust",
58936
+ rainbow: "rainbow",
58937
+ rabby: "rabby",
58938
+ okx: "okx"
58939
+ };
58940
+ var EIP6963_WALLET_ID_TO_INFO = {
58941
+ metamask: { walletType: "metamask", name: "MetaMask", icon: "metamask" },
58942
+ phantom: { walletType: "phantom-ethereum", name: "Phantom", icon: "phantom" },
58943
+ coinbase: { walletType: "coinbase", name: "Coinbase Wallet", icon: "coinbase" },
58944
+ trust: { walletType: "trust", name: "Trust Wallet", icon: "trust" },
58945
+ rainbow: { walletType: "rainbow", name: "Rainbow", icon: "rainbow" },
58946
+ rabby: { walletType: "rabby", name: "Rabby", icon: "rabby" },
58947
+ okx: { walletType: "okx", name: "OKX Wallet", icon: "okx" }
58948
+ };
58949
+ var WALLET_ID_TO_WALLET_TYPE = {
58950
+ phantom: "phantom-ethereum",
58951
+ coinbase: "coinbase",
58952
+ trust: "trust",
58953
+ rainbow: "rainbow",
58954
+ rabby: "rabby",
58955
+ okx: "okx",
58956
+ metamask: "metamask"
58957
+ };
58958
+ var WALLET_TYPE_TO_WALLET_ID = {
58959
+ "phantom-ethereum": "phantom",
58960
+ coinbase: "coinbase",
58961
+ trust: "trust",
58962
+ okx: "okx",
58963
+ rainbow: "rainbow",
58964
+ rabby: "rabby",
58965
+ metamask: "metamask"
58966
+ };
58967
+ function isWalletType(value) {
58968
+ 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";
58969
+ }
58970
+ function walletIdToWalletType(walletId) {
58971
+ return WALLET_ID_TO_WALLET_TYPE[walletId] || "metamask";
58972
+ }
58973
+ function walletTypeToWalletId(walletType) {
58974
+ return WALLET_TYPE_TO_WALLET_ID[walletType] || walletType;
58975
+ }
58976
+ function getLegacyEvmProviders(win) {
58977
+ if (!win) return {};
58978
+ const anyWin = win;
58979
+ return {
58980
+ ethereum: anyWin.ethereum,
58981
+ phantomEthereum: anyWin.phantom?.ethereum,
58982
+ coinbaseEthereum: anyWin.coinbaseWalletExtension,
58983
+ trustEthereum: anyWin.trustwallet?.ethereum,
58984
+ okxEthereum: anyWin.okxwallet
58985
+ };
58986
+ }
58987
+ function getInjectedSolanaProviders(win) {
58988
+ if (!win) return {};
58989
+ const anyWin = win;
58990
+ return {
58991
+ phantomSolana: anyWin.phantom?.solana,
58992
+ solflare: anyWin.solflare,
58993
+ backpack: anyWin.backpack,
58994
+ glow: anyWin.glow,
58995
+ coinbaseSolana: anyWin.coinbaseSolana || anyWin.coinbaseWalletExtension?.solana,
58996
+ trustSolana: anyWin.trustwallet?.solana
58997
+ };
58998
+ }
58999
+ function describeEip6963Provider(wp) {
59000
+ const mapped = EIP6963_WALLET_ID_TO_INFO[wp.walletId];
59001
+ return {
59002
+ provider: wp.provider,
59003
+ walletType: mapped?.walletType ?? "metamask",
59004
+ name: mapped?.name ?? wp.info.name,
59005
+ icon: mapped?.icon ?? wp.info.icon
59006
+ };
59007
+ }
59008
+ function resolveQuickConnectEvmProvider(win) {
59009
+ const eip6963Providers = getEip6963Providers();
59010
+ if (eip6963Providers.length > 0) {
59011
+ const stored = getStoredWalletState();
59012
+ const preferredWalletId = stored?.walletType && isWalletType(stored.walletType) ? STORED_TYPE_TO_EIP6963_WALLET_ID[stored.walletType] : void 0;
59013
+ if (preferredWalletId) {
59014
+ const preferred = findProviderByWalletId(preferredWalletId);
59015
+ if (preferred) return describeEip6963Provider(preferred);
59016
+ }
59017
+ if (eip6963Providers.length === 1) {
59018
+ return describeEip6963Provider(eip6963Providers[0]);
59019
+ }
59020
+ return void 0;
59021
+ }
59022
+ const anyWin = win;
59023
+ const legacy = anyWin.phantom?.ethereum || anyWin.ethereum;
59024
+ if (!legacy) return void 0;
59025
+ const isPhantom = legacy.isPhantom;
59026
+ return {
59027
+ provider: legacy,
59028
+ walletType: isPhantom ? "phantom-ethereum" : "metamask",
59029
+ name: isPhantom ? "Phantom" : "MetaMask",
59030
+ icon: isPhantom ? "phantom" : "metamask"
59031
+ };
59032
+ }
59033
+ function resolveSolanaPublicKey(provider, response) {
59034
+ if (response?.publicKey) return { publicKey: response.publicKey };
59035
+ if (provider.publicKey) return { publicKey: provider.publicKey };
59036
+ return null;
59037
+ }
59038
+ function isUserRejectedSolanaConnectError(error) {
59039
+ if (!error || typeof error !== "object") return false;
59040
+ const maybeCode = "code" in error ? error.code : void 0;
59041
+ if (maybeCode === 4001) return true;
59042
+ const msg = "message" in error && typeof error.message === "string" ? error.message.toLowerCase() : "";
59043
+ return msg.includes("user rejected") || msg.includes("user denied") || msg.includes("rejected the request") || msg.includes("declined");
59044
+ }
59045
+ function isSolanaConnectTimeoutError(error) {
59046
+ return error instanceof Error && error.message.toLowerCase().includes("did not respond to the connection request");
59047
+ }
59048
+ async function connectSolanaProviderWithRecovery(provider, walletId, walletName) {
59049
+ if (provider.isConnected && provider.publicKey) {
59050
+ return { publicKey: provider.publicKey };
59051
+ }
59052
+ const connectOnce = () => provider.connect(walletId === "solflare" ? { onlyIfTrusted: false } : void 0);
59053
+ const withTimeout = async (ms = 2e4) => await Promise.race([
59054
+ connectOnce(),
59055
+ new Promise(
59056
+ (resolve, reject) => setTimeout(() => {
59057
+ const connected = resolveSolanaPublicKey(provider);
59058
+ if (connected) {
59059
+ resolve(connected);
59060
+ return;
59061
+ }
59062
+ reject(
59063
+ new Error(
59064
+ `${walletName} did not respond to the connection request. Please unlock the wallet and try again.`
59065
+ )
59066
+ );
59067
+ }, ms)
59068
+ )
59069
+ ]);
59070
+ if (walletId === "solflare") {
59071
+ await provider.disconnect?.().catch(() => {
59072
+ });
59073
+ }
59074
+ const connectAndResolve = async () => {
59075
+ try {
59076
+ const response = await withTimeout();
59077
+ const resolved = resolveSolanaPublicKey(provider, response);
59078
+ if (resolved) return resolved;
59079
+ await new Promise((resolve) => setTimeout(resolve, 120));
59080
+ const delayedResolved = resolveSolanaPublicKey(provider);
59081
+ if (delayedResolved) return delayedResolved;
59082
+ throw new Error(`${walletName} connected but did not expose a public key.`);
59083
+ } catch (error) {
59084
+ const connected = resolveSolanaPublicKey(provider);
59085
+ if (connected) return connected;
59086
+ throw error;
59087
+ }
59088
+ };
59089
+ try {
59090
+ return await connectAndResolve();
59091
+ } catch (err) {
59092
+ if (isUserRejectedSolanaConnectError(err)) throw err;
59093
+ if (isSolanaConnectTimeoutError(err)) throw err;
59094
+ if (walletId === "solflare") {
59095
+ await provider.disconnect?.().catch(() => {
59096
+ });
59097
+ await new Promise((resolve) => setTimeout(resolve, 150));
59098
+ return await connectAndResolve();
59099
+ }
59100
+ throw err;
59101
+ }
59102
+ }
58602
59103
  function MetamaskIcon({ size: size4 = 24, className, variant = "color" }) {
58603
- const id = React162.useId();
59104
+ const id = React172.useId();
58604
59105
  if (variant === "light" || variant === "dark") {
58605
59106
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
58606
59107
  "svg",
@@ -58721,7 +59222,7 @@ function MetamaskIcon({ size: size4 = 24, className, variant = "color" }) {
58721
59222
  );
58722
59223
  }
58723
59224
  function PhantomIcon({ size: size4 = 24, className, variant = "color" }) {
58724
- const id = React172.useId();
59225
+ const id = React182.useId();
58725
59226
  if (variant === "light") {
58726
59227
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
58727
59228
  "svg",
@@ -58788,7 +59289,7 @@ function PhantomIcon({ size: size4 = 24, className, variant = "color" }) {
58788
59289
  );
58789
59290
  }
58790
59291
  function CoinbaseIcon({ size: size4 = 24, className, variant = "color" }) {
58791
- const id = React182.useId();
59292
+ const id = React192.useId();
58792
59293
  if (variant === "light") {
58793
59294
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
58794
59295
  "svg",
@@ -58868,7 +59369,7 @@ function CoinbaseIcon({ size: size4 = 24, className, variant = "color" }) {
58868
59369
  );
58869
59370
  }
58870
59371
  function RabbyIcon({ size: size4 = 24, className, variant = "color" }) {
58871
- const id = React192.useId();
59372
+ const id = React202.useId();
58872
59373
  if (variant === "light") {
58873
59374
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
58874
59375
  "svg",
@@ -59215,7 +59716,7 @@ function RabbyIcon({ size: size4 = 24, className, variant = "color" }) {
59215
59716
  );
59216
59717
  }
59217
59718
  function RainbowIcon({ size: size4 = 24, className, variant = "color" }) {
59218
- const id = React202.useId();
59719
+ const id = React212.useId();
59219
59720
  if (variant === "light") {
59220
59721
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
59221
59722
  "svg",
@@ -59629,7 +60130,7 @@ function RainbowIcon({ size: size4 = 24, className, variant = "color" }) {
59629
60130
  );
59630
60131
  }
59631
60132
  function TrustIcon({ size: size4 = 24, className, variant = "color" }) {
59632
- const id = React212.useId();
60133
+ const id = React2222.useId();
59633
60134
  if (variant === "light") {
59634
60135
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
59635
60136
  "svg",
@@ -59712,7 +60213,7 @@ function TrustIcon({ size: size4 = 24, className, variant = "color" }) {
59712
60213
  );
59713
60214
  }
59714
60215
  function OkxIcon({ size: size4 = 24, className, variant = "color" }) {
59715
- const id = React2222.useId();
60216
+ const id = React232.useId();
59716
60217
  if (variant === "light") {
59717
60218
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
59718
60219
  "svg",
@@ -59767,7 +60268,7 @@ function OkxIcon({ size: size4 = 24, className, variant = "color" }) {
59767
60268
  );
59768
60269
  }
59769
60270
  function GlowIcon({ size: size4 = 24, className, variant = "color" }) {
59770
- const id = React232.useId();
60271
+ const id = React242.useId();
59771
60272
  if (variant === "light") {
59772
60273
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
59773
60274
  "svg",
@@ -59868,7 +60369,7 @@ function GlowIcon({ size: size4 = 24, className, variant = "color" }) {
59868
60369
  );
59869
60370
  }
59870
60371
  function BackpackIcon({ size: size4 = 24, className, variant = "color" }) {
59871
- const id = React242.useId();
60372
+ const id = React252.useId();
59872
60373
  if (variant === "light") {
59873
60374
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
59874
60375
  "svg",
@@ -59941,7 +60442,7 @@ function BackpackIcon({ size: size4 = 24, className, variant = "color" }) {
59941
60442
  );
59942
60443
  }
59943
60444
  function SolflareIcon({ size: size4 = 24, className, variant = "color" }) {
59944
- const id = React252.useId();
60445
+ const id = React262.useId();
59945
60446
  if (variant === "light") {
59946
60447
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
59947
60448
  "svg",
@@ -60008,7 +60509,7 @@ function SolflareIcon({ size: size4 = 24, className, variant = "color" }) {
60008
60509
  );
60009
60510
  }
60010
60511
  function EthereumIcon({ size: size4 = 24, className, variant = "color" }) {
60011
- const id = React262.useId();
60512
+ const id = React272.useId();
60012
60513
  if (variant === "light") {
60013
60514
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
60014
60515
  "svg",
@@ -60132,7 +60633,7 @@ function EthereumIcon({ size: size4 = 24, className, variant = "color" }) {
60132
60633
  );
60133
60634
  }
60134
60635
  function SolanaIcon({ size: size4 = 24, className, variant = "color" }) {
60135
- const id = React272.useId();
60636
+ const id = React282.useId();
60136
60637
  if (variant === "light") {
60137
60638
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
60138
60639
  "svg",
@@ -60377,19 +60878,19 @@ function BrowserWalletButton({
60377
60878
  subtitle = i18n2.depositModal.browserWallet.subtitle
60378
60879
  }) {
60379
60880
  const { colors: colors2, fonts, components } = useTheme();
60380
- const [isHovered, setIsHovered] = React282.useState(false);
60381
- const [isTouchDevice, setIsTouchDevice] = React282.useState(false);
60881
+ const [isHovered, setIsHovered] = React292.useState(false);
60882
+ const [isTouchDevice, setIsTouchDevice] = React292.useState(false);
60382
60883
  const { wallet, isLoading, setWallet } = useDetectedBrowserWallet({ chainType, onDisconnect });
60383
- const [isConnecting, setIsConnecting] = React282.useState(false);
60384
- const [balanceText, setBalanceText] = React282.useState(null);
60385
- const [isLoadingBalance, setIsLoadingBalance] = React282.useState(false);
60386
- const [isDisconnecting, setIsDisconnecting] = React282.useState(false);
60387
- const onDisconnectRef = React282.useRef(onDisconnect);
60884
+ const [isConnecting, setIsConnecting] = React292.useState(false);
60885
+ const [balanceText, setBalanceText] = React292.useState(null);
60886
+ const [isLoadingBalance, setIsLoadingBalance] = React292.useState(false);
60887
+ const [isDisconnecting, setIsDisconnecting] = React292.useState(false);
60888
+ const onDisconnectRef = React292.useRef(onDisconnect);
60388
60889
  onDisconnectRef.current = onDisconnect;
60389
- React282.useEffect(() => {
60890
+ React292.useEffect(() => {
60390
60891
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
60391
60892
  }, []);
60392
- React282.useEffect(() => {
60893
+ React292.useEffect(() => {
60393
60894
  if (!wallet || !publishableKey) {
60394
60895
  setBalanceText(null);
60395
60896
  return;
@@ -60458,21 +60959,19 @@ function BrowserWalletButton({
60458
60959
  }
60459
60960
  }
60460
60961
  if (!chainType || chainType === "ethereum") {
60461
- const ethProvider = window.phantom?.ethereum || window.ethereum;
60462
- if (ethProvider) {
60463
- const accounts = await ethProvider.request({
60962
+ const resolved = resolveQuickConnectEvmProvider(window);
60963
+ if (resolved) {
60964
+ const accounts = await resolved.provider.request({
60464
60965
  method: "eth_requestAccounts"
60465
60966
  });
60466
60967
  if (accounts && accounts.length > 0) {
60467
60968
  setUserDisconnectedWallet(false);
60468
- const isPhantom = ethProvider.isPhantom;
60469
- const walletType = isPhantom ? "phantom-ethereum" : "metamask";
60470
- setStoredWalletState(walletType);
60969
+ setStoredWalletState(resolved.walletType);
60471
60970
  setWallet({
60472
- type: walletType,
60473
- name: isPhantom ? "Phantom" : "MetaMask",
60971
+ type: resolved.walletType,
60972
+ name: resolved.name,
60474
60973
  address: accounts[0],
60475
- icon: isPhantom ? "phantom" : "metamask"
60974
+ icon: resolved.icon
60476
60975
  });
60477
60976
  }
60478
60977
  }
@@ -60506,7 +61005,10 @@ function BrowserWalletButton({
60506
61005
  if (isLoading) {
60507
61006
  return null;
60508
61007
  }
60509
- 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);
61008
+ const eip6963EvmProviderCount = getEip6963Providers().length;
61009
+ const legacyEvmProviders = getLegacyEvmProviders(window);
61010
+ const hasLegacyEvmProvider = eip6963EvmProviderCount === 0 && !!(legacyEvmProviders.ethereum || legacyEvmProviders.phantomEthereum || legacyEvmProviders.coinbaseEthereum || legacyEvmProviders.trustEthereum || legacyEvmProviders.okxEthereum);
61011
+ const hasWalletExtension = (!chainType || chainType === "ethereum") && eip6963EvmProviderCount > 0 || (!chainType || chainType === "solana") && (window.phantom?.solana?.isPhantom || window.solana?.isPhantom) || (!chainType || chainType === "ethereum") && hasLegacyEvmProvider;
60510
61012
  if (!onConnectClick && !wallet && !hasWalletExtension) {
60511
61013
  return null;
60512
61014
  }
@@ -60516,11 +61018,25 @@ function BrowserWalletButton({
60516
61018
  border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
60517
61019
  };
60518
61020
  const sortedWallets = featuredWallets ? [...featuredWallets].sort((a, b) => a.position - b.position) : [];
60519
- const walletIconBlock = wallet ? WALLET_ICON_COMPONENTS[wallet.icon] ? React282.createElement(WALLET_ICON_COMPONENTS[wallet.icon], {
61021
+ const isImageIcon = !!wallet && (wallet.icon.startsWith("data:") || wallet.icon.startsWith("http"));
61022
+ const walletIconBlock = wallet ? WALLET_ICON_COMPONENTS[wallet.icon] ? React292.createElement(WALLET_ICON_COMPONENTS[wallet.icon], {
60520
61023
  size: 36,
60521
61024
  className: "uf-rounded-lg",
60522
61025
  variant: "color"
60523
- }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "uf-w-9 uf-h-9 uf-rounded-lg uf-bg-gray-500" }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "uf-rounded-lg uf-p-2", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Wallet, { className: "uf-w-5 uf-h-5", style: { color: components.card.iconColor } }) });
61026
+ }) : isImageIcon ? (
61027
+ // Wallet announced via EIP-6963 with no internal icon component: render its
61028
+ // own advertised icon (`info.icon`) rather than a generic placeholder.
61029
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
61030
+ "img",
61031
+ {
61032
+ src: wallet.icon,
61033
+ alt: wallet.name,
61034
+ width: 36,
61035
+ height: 36,
61036
+ className: "uf-rounded-lg uf-w-9 uf-h-9"
61037
+ }
61038
+ )
61039
+ ) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "uf-w-9 uf-h-9 uf-rounded-lg uf-bg-gray-500" }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "uf-rounded-lg uf-p-2", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Wallet, { className: "uf-w-5 uf-h-5", style: { color: components.card.iconColor } }) });
60524
61040
  const titleSubtitleBlock = /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "uf-text-left uf-min-w-0", children: [
60525
61041
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
60526
61042
  "div",
@@ -60667,9 +61183,9 @@ function StripeLinkButton({
60667
61183
  iconUrl
60668
61184
  }) {
60669
61185
  const { colors: colors2, fonts, components } = useTheme();
60670
- const [isHovered, setIsHovered] = React292.useState(false);
60671
- const [isTouchDevice, setIsTouchDevice] = React292.useState(false);
60672
- React292.useEffect(() => {
61186
+ const [isHovered, setIsHovered] = React302.useState(false);
61187
+ const [isTouchDevice, setIsTouchDevice] = React302.useState(false);
61188
+ React302.useEffect(() => {
60673
61189
  setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
60674
61190
  }, []);
60675
61191
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
@@ -61155,6 +61671,8 @@ function PayWithStripeLink({
61155
61671
  destinationChainType,
61156
61672
  destinationChainId,
61157
61673
  destinationTokenAddress,
61674
+ countryCode,
61675
+ subdivisionCode,
61158
61676
  wallets: externalWallets,
61159
61677
  email: emailProp,
61160
61678
  iconUrl,
@@ -61549,7 +62067,9 @@ function PayWithStripeLink({
61549
62067
  {
61550
62068
  tokenAddress: destinationTokenAddress,
61551
62069
  chainId: destinationChainId,
61552
- chainType: destinationChainType
62070
+ chainType: destinationChainType,
62071
+ countryCode,
62072
+ subdivisionCode
61553
62073
  },
61554
62074
  publishableKey
61555
62075
  ).then((token) => {
@@ -61568,7 +62088,14 @@ function PayWithStripeLink({
61568
62088
  return () => {
61569
62089
  cancelled = true;
61570
62090
  };
61571
- }, [publishableKey, destinationTokenAddress, destinationChainId, destinationChainType]);
62091
+ }, [
62092
+ publishableKey,
62093
+ destinationTokenAddress,
62094
+ destinationChainId,
62095
+ destinationChainType,
62096
+ countryCode,
62097
+ subdivisionCode
62098
+ ]);
61572
62099
  const destinationCurrency = stripeDestCurrency;
61573
62100
  const authInnerRef = (0, import_react22.useRef)(null);
61574
62101
  const paymentInnerRef = (0, import_react22.useRef)(null);
@@ -64544,7 +65071,8 @@ function CoinbaseConnect({
64544
65071
  defaultSourceChainType,
64545
65072
  defaultSourceChainId,
64546
65073
  defaultSourceTokenAddress,
64547
- defaultSourceSymbol
65074
+ defaultSourceSymbol,
65075
+ prefilledAmountUsd
64548
65076
  }) {
64549
65077
  const { colors: colors2, fonts, components } = useTheme();
64550
65078
  const { projectConfig } = useProjectConfig({ publishableKey });
@@ -64867,7 +65395,8 @@ function CoinbaseConnect({
64867
65395
  };
64868
65396
  const handleSelectAsset = (asset) => {
64869
65397
  setSelectedAsset(asset);
64870
- setSendAmount("");
65398
+ const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
65399
+ setSendAmount(cleanedPrefilled);
64871
65400
  transitionTo("enter_amount");
64872
65401
  };
64873
65402
  const handleCreateTransfer = async () => {
@@ -66465,6 +66994,24 @@ function useExchanges({
66465
66994
  });
66466
66995
  return { exchanges, isLoading };
66467
66996
  }
66997
+ function usePublicIncident({
66998
+ publishableKey,
66999
+ enabled = true
67000
+ }) {
67001
+ const {
67002
+ data: incident,
67003
+ isLoading,
67004
+ error
67005
+ } = useQuery({
67006
+ queryKey: ["unifold", "publicIncident", publishableKey],
67007
+ queryFn: () => getPublicIncident(publishableKey),
67008
+ enabled,
67009
+ staleTime: 1e3 * 30,
67010
+ refetchInterval: 1e3 * 30,
67011
+ refetchOnWindowFocus: true
67012
+ });
67013
+ return { incident, isLoading, error: error ?? null };
67014
+ }
66468
67015
  function useApplePayProviders({
66469
67016
  publishableKey,
66470
67017
  enabled = true
@@ -66560,6 +67107,7 @@ function useAddressValidation({
66560
67107
  return {
66561
67108
  isValid: null,
66562
67109
  failureCode: null,
67110
+ message: null,
66563
67111
  metadata: null,
66564
67112
  isLoading: false,
66565
67113
  error: null
@@ -66568,6 +67116,7 @@ function useAddressValidation({
66568
67116
  return {
66569
67117
  isValid: data?.valid ?? null,
66570
67118
  failureCode: data?.failure_code ?? null,
67119
+ message: data?.message ?? null,
66571
67120
  metadata: data?.metadata ?? null,
66572
67121
  isLoading,
66573
67122
  error: error ?? null
@@ -66578,7 +67127,7 @@ function ThemeStyleInjector({
66578
67127
  className
66579
67128
  }) {
66580
67129
  const { colors: colors2, fonts, mode } = useTheme();
66581
- const cssVars = React312.useMemo(() => {
67130
+ const cssVars = React322.useMemo(() => {
66582
67131
  const hexToHSL = (hex) => {
66583
67132
  hex = hex.replace("#", "");
66584
67133
  const r2 = parseInt(hex.slice(0, 2), 16) / 255;
@@ -66638,7 +67187,7 @@ function ThemeStyleInjector({
66638
67187
  ...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
66639
67188
  };
66640
67189
  }, [colors2, fonts.regular]);
66641
- React312.useEffect(() => {
67190
+ React322.useEffect(() => {
66642
67191
  if (typeof document === "undefined") return;
66643
67192
  if (fonts.regular) {
66644
67193
  document.documentElement.style.setProperty("--uf-font-family", fonts.regular);
@@ -67393,6 +67942,37 @@ function TokenSelectorSheet({
67393
67942
  var getChainKey = (chainId, chainType) => {
67394
67943
  return `${chainType}:${chainId}`;
67395
67944
  };
67945
+ function getStoredSelection(key) {
67946
+ if (typeof window === "undefined") return null;
67947
+ try {
67948
+ const raw = localStorage.getItem(key);
67949
+ if (!raw) return null;
67950
+ const parsed = JSON.parse(raw);
67951
+ if (parsed && typeof parsed.symbol === "string" && typeof parsed.chainType === "string" && typeof parsed.chainId === "string") {
67952
+ return parsed;
67953
+ }
67954
+ } catch {
67955
+ }
67956
+ return null;
67957
+ }
67958
+ function saveStoredSelection(key, symbol, chainType, chainId) {
67959
+ if (typeof window === "undefined") return;
67960
+ try {
67961
+ localStorage.setItem(key, JSON.stringify({ symbol, chainType, chainId }));
67962
+ } catch {
67963
+ }
67964
+ }
67965
+ function resolveFromStorage(tokens, stored) {
67966
+ for (const t13 of tokens) {
67967
+ if (t13.symbol !== stored.symbol) continue;
67968
+ const matchedChain = t13.chains.find(
67969
+ (c) => c.chain_type === stored.chainType && c.chain_id === stored.chainId
67970
+ );
67971
+ if (matchedChain) return { token: t13, chain: matchedChain };
67972
+ if (t13.chains.length > 0) return { token: t13, chain: t13.chains[0] };
67973
+ }
67974
+ return null;
67975
+ }
67396
67976
  function resolveToken(tokens, defaultChainType, defaultChainId, defaultTokenAddress, defaultSymbol) {
67397
67977
  if (!tokens.length) return null;
67398
67978
  let selectedToken;
@@ -67442,27 +68022,73 @@ function useDefaultToken({
67442
68022
  defaultChainType,
67443
68023
  defaultChainId,
67444
68024
  defaultTokenAddress,
67445
- defaultSymbol
68025
+ defaultSymbol,
68026
+ storageKey: storageKey2
67446
68027
  }) {
67447
- const [token, setToken] = (0, import_react28.useState)(null);
67448
- const [chain, setChain] = (0, import_react28.useState)(null);
68028
+ const [token, setTokenState] = (0, import_react28.useState)(null);
68029
+ const [chain, setChainState] = (0, import_react28.useState)(null);
67449
68030
  const [initialSelectionDone, setInitialSelectionDone] = (0, import_react28.useState)(false);
67450
68031
  const appliedDefaultsRef = (0, import_react28.useRef)("");
68032
+ const tokenRef = (0, import_react28.useRef)(null);
68033
+ const chainRef = (0, import_react28.useRef)(null);
68034
+ tokenRef.current = token;
68035
+ chainRef.current = chain;
68036
+ const setToken = (0, import_react28.useCallback)(
68037
+ (newToken) => {
68038
+ tokenRef.current = newToken;
68039
+ setTokenState(newToken);
68040
+ if (storageKey2 && chainRef.current) {
68041
+ const [chainType, chainId] = chainRef.current.split(":");
68042
+ saveStoredSelection(storageKey2, newToken, chainType, chainId);
68043
+ }
68044
+ },
68045
+ [storageKey2]
68046
+ );
68047
+ const setChain = (0, import_react28.useCallback)(
68048
+ (newChain) => {
68049
+ chainRef.current = newChain;
68050
+ setChainState(newChain);
68051
+ if (storageKey2 && tokenRef.current) {
68052
+ const [chainType, chainId] = newChain.split(":");
68053
+ saveStoredSelection(storageKey2, tokenRef.current, chainType, chainId);
68054
+ }
68055
+ },
68056
+ [storageKey2]
68057
+ );
67451
68058
  (0, import_react28.useEffect)(() => {
67452
68059
  if (!tokens.length) return;
67453
68060
  const defaultsKey = `${defaultTokenAddress ?? ""}|${defaultSymbol ?? ""}|${defaultChainType ?? ""}|${defaultChainId ?? ""}`;
67454
68061
  const defaultsChanged = appliedDefaultsRef.current !== defaultsKey;
67455
68062
  if (initialSelectionDone && !defaultsChanged) return;
67456
- const result = resolveToken(
67457
- tokens,
67458
- defaultChainType,
67459
- defaultChainId,
67460
- defaultTokenAddress,
67461
- defaultSymbol
67462
- );
68063
+ const hasExplicitDefaults = defaultTokenAddress && defaultChainType && defaultChainId || defaultSymbol && defaultChainType && defaultChainId;
68064
+ let result = null;
68065
+ if (hasExplicitDefaults) {
68066
+ result = resolveToken(
68067
+ tokens,
68068
+ defaultChainType,
68069
+ defaultChainId,
68070
+ defaultTokenAddress,
68071
+ defaultSymbol
68072
+ );
68073
+ if (result) {
68074
+ 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;
68075
+ if (!matched) {
68076
+ result = null;
68077
+ }
68078
+ }
68079
+ }
68080
+ if (!result && storageKey2) {
68081
+ const stored = getStoredSelection(storageKey2);
68082
+ if (stored) {
68083
+ result = resolveFromStorage(tokens, stored);
68084
+ }
68085
+ }
68086
+ if (!result) {
68087
+ result = resolveToken(tokens);
68088
+ }
67463
68089
  if (result) {
67464
- setToken(result.token.symbol);
67465
- setChain(getChainKey(result.chain.chain_id, result.chain.chain_type));
68090
+ setTokenState(result.token.symbol);
68091
+ setChainState(getChainKey(result.chain.chain_id, result.chain.chain_type));
67466
68092
  appliedDefaultsRef.current = defaultsKey;
67467
68093
  setInitialSelectionDone(true);
67468
68094
  }
@@ -67472,7 +68098,8 @@ function useDefaultToken({
67472
68098
  defaultSymbol,
67473
68099
  defaultChainType,
67474
68100
  defaultChainId,
67475
- initialSelectionDone
68101
+ initialSelectionDone,
68102
+ storageKey2
67476
68103
  ]);
67477
68104
  (0, import_react28.useEffect)(() => {
67478
68105
  if (!tokens.length || !token) return;
@@ -67483,11 +68110,12 @@ function useDefaultToken({
67483
68110
  });
67484
68111
  if (!isChainAvailable) {
67485
68112
  const firstChain = currentToken.chains[0];
67486
- setChain(getChainKey(firstChain.chain_id, firstChain.chain_type));
68113
+ setChainState(getChainKey(firstChain.chain_id, firstChain.chain_type));
67487
68114
  }
67488
68115
  }, [token, tokens, chain]);
67489
68116
  return { token, chain, setToken, setChain, initialSelectionDone };
67490
68117
  }
68118
+ var STORAGE_KEY2 = "unifold_last_deposit_from_token";
67491
68119
  function useDefaultSourceToken({
67492
68120
  supportedTokens,
67493
68121
  defaultSourceChainType,
@@ -67500,7 +68128,8 @@ function useDefaultSourceToken({
67500
68128
  defaultChainType: defaultSourceChainType,
67501
68129
  defaultChainId: defaultSourceChainId,
67502
68130
  defaultTokenAddress: defaultSourceTokenAddress,
67503
- defaultSymbol: defaultSourceSymbol
68131
+ defaultSymbol: defaultSourceSymbol,
68132
+ storageKey: STORAGE_KEY2
67504
68133
  });
67505
68134
  }
67506
68135
  function DepositFooterLinks({ onGlossaryClick, leftElement }) {
@@ -67783,14 +68412,14 @@ function useCopyAddress() {
67783
68412
  return { copied, handleCopy };
67784
68413
  }
67785
68414
  var TooltipProvider2 = Provider;
67786
- var TooltipContext = React322.createContext({
68415
+ var TooltipContext = React332.createContext({
67787
68416
  open: false,
67788
68417
  onOpenChange: () => {
67789
68418
  }
67790
68419
  });
67791
- var TooltipTrigger2 = React322.forwardRef(({ onClick, ...props }, ref) => {
67792
- const { open, onOpenChange } = React322.useContext(TooltipContext);
67793
- const handleClick = React322.useCallback(
68420
+ var TooltipTrigger2 = React332.forwardRef(({ onClick, ...props }, ref) => {
68421
+ const { open, onOpenChange } = React332.useContext(TooltipContext);
68422
+ const handleClick = React332.useCallback(
67794
68423
  (e) => {
67795
68424
  onOpenChange(!open);
67796
68425
  onClick?.(e);
@@ -67800,7 +68429,7 @@ var TooltipTrigger2 = React322.forwardRef(({ onClick, ...props }, ref) => {
67800
68429
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Trigger, { ref, onClick: handleClick, ...props });
67801
68430
  });
67802
68431
  TooltipTrigger2.displayName = Trigger.displayName;
67803
- var TooltipContent2 = React322.forwardRef(({ className, sideOffset = 4, ...props }, ref) => {
68432
+ var TooltipContent2 = React332.forwardRef(({ className, sideOffset = 4, ...props }, ref) => {
67804
68433
  const { themeClass, colors: colors2 } = useTheme();
67805
68434
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Portal3, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
67806
68435
  Content22,
@@ -67910,6 +68539,7 @@ function TransferCryptoSingleInput({
67910
68539
  onDepositError,
67911
68540
  wallets: externalWallets,
67912
68541
  onSourceTokenChange,
68542
+ prefilledAmountUsd,
67913
68543
  checkoutQuote,
67914
68544
  isCheckoutQuoteLoading = false,
67915
68545
  persistCheckingIndicator = false,
@@ -68053,6 +68683,22 @@ function TransferCryptoSingleInput({
68053
68683
  const maxSlippage = currentChainFromBackend?.max_slippage_percent ?? 0.25;
68054
68684
  const processingTime = currentChainFromBackend?.estimated_processing_time ?? null;
68055
68685
  const minDepositUsd = currentChainFromBackend?.minimum_deposit_amount_usd ?? 3;
68686
+ const parsedPrefilledUsd = (0, import_react25.useMemo)(() => {
68687
+ const value = parseFloat(prefilledAmountUsd ?? "");
68688
+ return Number.isFinite(value) && value > 0 ? value : null;
68689
+ }, [prefilledAmountUsd]);
68690
+ const effectivePrefilledUsd = (0, import_react25.useMemo)(() => {
68691
+ if (parsedPrefilledUsd === null) return null;
68692
+ return Math.max(parsedPrefilledUsd, minDepositUsd);
68693
+ }, [parsedPrefilledUsd, minDepositUsd]);
68694
+ const prefillDisplay = (0, import_react25.useMemo)(() => {
68695
+ if (effectivePrefilledUsd === null) return null;
68696
+ const usdLabel = `$${effectivePrefilledUsd.toFixed(2)}`;
68697
+ if (selectedToken?.is_stablecoin) {
68698
+ return `${effectivePrefilledUsd.toFixed(2)} ${selectedToken.symbol} (${usdLabel})`;
68699
+ }
68700
+ return `${usdLabel} USD`;
68701
+ }, [effectivePrefilledUsd, selectedToken]);
68056
68702
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(TooltipProvider2, { delayDuration: 0, skipDelayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
68057
68703
  "div",
68058
68704
  {
@@ -68179,7 +68825,7 @@ function TransferCryptoSingleInput({
68179
68825
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children: "Retrying automatically every 5 seconds..." })
68180
68826
  ] })
68181
68827
  ] }),
68182
- (checkoutQuote || isCheckoutQuoteLoading) && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
68828
+ (checkoutQuote || isCheckoutQuoteLoading || prefillDisplay) && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
68183
68829
  "div",
68184
68830
  {
68185
68831
  className: "uf-rounded-xl uf-px-3 uf-py-2 uf-flex uf-items-center uf-justify-between",
@@ -68223,6 +68869,13 @@ function TransferCryptoSingleInput({
68223
68869
  )
68224
68870
  ]
68225
68871
  }
68872
+ ) : prefillDisplay ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
68873
+ "span",
68874
+ {
68875
+ className: "uf-text-sm uf-font-semibold",
68876
+ style: { color: components.card.titleColor, fontFamily: fonts.semibold },
68877
+ children: prefillDisplay
68878
+ }
68226
68879
  ) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
68227
68880
  "div",
68228
68881
  {
@@ -68552,7 +69205,7 @@ function TransferCryptoSingleInput({
68552
69205
  }
68553
69206
  var Select2 = Root23;
68554
69207
  var SelectValue2 = Value;
68555
- var SelectTrigger2 = React332.forwardRef(({ className, style, children, ...props }, ref) => {
69208
+ var SelectTrigger2 = React342.forwardRef(({ className, style, children, ...props }, ref) => {
68556
69209
  const { components } = useTheme();
68557
69210
  return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
68558
69211
  Trigger2,
@@ -68576,7 +69229,7 @@ var SelectTrigger2 = React332.forwardRef(({ className, style, children, ...props
68576
69229
  );
68577
69230
  });
68578
69231
  SelectTrigger2.displayName = Trigger2.displayName;
68579
- var SelectScrollUpButton2 = React332.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
69232
+ var SelectScrollUpButton2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
68580
69233
  ScrollUpButton,
68581
69234
  {
68582
69235
  ref,
@@ -68586,7 +69239,7 @@ var SelectScrollUpButton2 = React332.forwardRef(({ className, ...props }, ref) =
68586
69239
  }
68587
69240
  ));
68588
69241
  SelectScrollUpButton2.displayName = ScrollUpButton.displayName;
68589
- var SelectScrollDownButton2 = React332.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
69242
+ var SelectScrollDownButton2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
68590
69243
  ScrollDownButton,
68591
69244
  {
68592
69245
  ref,
@@ -68596,7 +69249,7 @@ var SelectScrollDownButton2 = React332.forwardRef(({ className, ...props }, ref)
68596
69249
  }
68597
69250
  ));
68598
69251
  SelectScrollDownButton2.displayName = ScrollDownButton.displayName;
68599
- var SelectContent2 = React332.forwardRef(({ className, style, children, position = "popper", ...props }, ref) => {
69252
+ var SelectContent2 = React342.forwardRef(({ className, style, children, position = "popper", ...props }, ref) => {
68600
69253
  const { themeClass, colors: colors2, components } = useTheme();
68601
69254
  return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Portal4, { children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
68602
69255
  Content23,
@@ -68634,7 +69287,7 @@ var SelectContent2 = React332.forwardRef(({ className, style, children, position
68634
69287
  ) });
68635
69288
  });
68636
69289
  SelectContent2.displayName = Content23.displayName;
68637
- var SelectLabel2 = React332.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
69290
+ var SelectLabel2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
68638
69291
  Label,
68639
69292
  {
68640
69293
  ref,
@@ -68643,7 +69296,7 @@ var SelectLabel2 = React332.forwardRef(({ className, ...props }, ref) => /* @__P
68643
69296
  }
68644
69297
  ));
68645
69298
  SelectLabel2.displayName = Label.displayName;
68646
- var SelectItem2 = React332.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
69299
+ var SelectItem2 = React342.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
68647
69300
  Item,
68648
69301
  {
68649
69302
  ref,
@@ -68659,7 +69312,7 @@ var SelectItem2 = React332.forwardRef(({ className, children, ...props }, ref) =
68659
69312
  }
68660
69313
  ));
68661
69314
  SelectItem2.displayName = Item.displayName;
68662
- var SelectSeparator2 = React332.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
69315
+ var SelectSeparator2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
68663
69316
  Separator,
68664
69317
  {
68665
69318
  ref,
@@ -68687,6 +69340,7 @@ function TransferCryptoDoubleInput({
68687
69340
  defaultSourceChainId,
68688
69341
  defaultSourceTokenAddress,
68689
69342
  defaultSourceSymbol,
69343
+ prefilledAmountUsd,
68690
69344
  depositConfirmationMode = "auto_ui",
68691
69345
  onExecutionsChange,
68692
69346
  onDepositSuccess,
@@ -68811,6 +69465,22 @@ function TransferCryptoDoubleInput({
68811
69465
  const maxSlippage = currentChainFromBackend?.max_slippage_percent ?? 0.25;
68812
69466
  const processingTime = currentChainFromBackend?.estimated_processing_time ?? null;
68813
69467
  const minDepositUsd = currentChainFromBackend?.minimum_deposit_amount_usd ?? 3;
69468
+ const parsedPrefilledUsd = (0, import_react31.useMemo)(() => {
69469
+ const value = parseFloat(prefilledAmountUsd ?? "");
69470
+ return Number.isFinite(value) && value > 0 ? value : null;
69471
+ }, [prefilledAmountUsd]);
69472
+ const effectivePrefilledUsd = (0, import_react31.useMemo)(() => {
69473
+ if (parsedPrefilledUsd === null) return null;
69474
+ return Math.max(parsedPrefilledUsd, minDepositUsd);
69475
+ }, [parsedPrefilledUsd, minDepositUsd]);
69476
+ const prefillDisplay = (0, import_react31.useMemo)(() => {
69477
+ if (effectivePrefilledUsd === null) return null;
69478
+ const usdLabel = `$${effectivePrefilledUsd.toFixed(2)}`;
69479
+ if (selectedToken?.is_stablecoin) {
69480
+ return `${effectivePrefilledUsd.toFixed(2)} ${selectedToken.symbol} (${usdLabel})`;
69481
+ }
69482
+ return `${usdLabel} USD`;
69483
+ }, [effectivePrefilledUsd, selectedToken]);
68814
69484
  const renderTokenItem = (tokenData) => {
68815
69485
  return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
68816
69486
  /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
@@ -68991,6 +69661,35 @@ function TransferCryptoDoubleInput({
68991
69661
  /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { children: "Retrying automatically every 5 seconds..." })
68992
69662
  ] })
68993
69663
  ] }),
69664
+ prefillDisplay && /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
69665
+ "div",
69666
+ {
69667
+ className: "uf-rounded-xl uf-px-3 uf-py-2 uf-flex uf-items-center uf-justify-between",
69668
+ style: {
69669
+ backgroundColor: components.card.backgroundColor,
69670
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`,
69671
+ borderRadius: components.card.borderRadius
69672
+ },
69673
+ children: [
69674
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
69675
+ "span",
69676
+ {
69677
+ className: "uf-text-xs",
69678
+ style: { color: components.card.subtitleColor, fontFamily: fonts.regular },
69679
+ children: "You send"
69680
+ }
69681
+ ),
69682
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
69683
+ "span",
69684
+ {
69685
+ className: "uf-text-sm uf-font-semibold",
69686
+ style: { color: components.card.titleColor, fontFamily: fonts.semibold },
69687
+ children: prefillDisplay
69688
+ }
69689
+ )
69690
+ ]
69691
+ }
69692
+ ),
68994
69693
  /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-pt-2", children: [
68995
69694
  /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
68996
69695
  "div",
@@ -70442,33 +71141,11 @@ function balancesRepresentSameToken(a, b) {
70442
71141
  if (!tokenA || !tokenB) return false;
70443
71142
  return tokenA.chain_type === tokenB.chain_type && tokenA.chain_id === tokenB.chain_id && normalizeTokenAddress(tokenA.token_address) === normalizeTokenAddress(tokenB.token_address);
70444
71143
  }
70445
- function getSolanaProviders() {
70446
- if (typeof window === "undefined") return {};
70447
- const win = window;
70448
- return {
70449
- phantomSolana: win.phantom?.solana,
70450
- solflare: win.solflare,
70451
- backpack: win.backpack,
70452
- glow: win.glow,
70453
- coinbaseSolana: win.coinbaseSolana || win.coinbaseWalletExtension?.solana
70454
- };
70455
- }
70456
- function getLegacyEvmProviders() {
70457
- if (typeof window === "undefined") return {};
70458
- const win = window;
70459
- return {
70460
- ethereum: win.ethereum,
70461
- phantomEthereum: win.phantom?.ethereum,
70462
- coinbaseEthereum: win.coinbaseWalletExtension,
70463
- trustEthereum: win.trustwallet?.ethereum,
70464
- okxEthereum: win.okxwallet
70465
- };
70466
- }
70467
71144
  function detectAvailableWallets(definitions, recentWalletId, filterChainType) {
70468
- const solProviders = getSolanaProviders();
70469
- const legacyEvm = getLegacyEvmProviders();
70470
- const eip6963List = getEip6963Providers();
70471
71145
  const win = typeof window !== "undefined" ? window : null;
71146
+ const solProviders = getInjectedSolanaProviders(win);
71147
+ const legacyEvm = getLegacyEvmProviders(win);
71148
+ const eip6963List = getEip6963Providers();
70472
71149
  const hasEip6963 = (walletId) => eip6963List.some((d) => {
70473
71150
  const rdns = d.info?.rdns || "";
70474
71151
  switch (walletId) {
@@ -70578,7 +71255,7 @@ function WalletConnect({
70578
71255
  amountQuickSelect = "percentage",
70579
71256
  onWalletDisconnect,
70580
71257
  onWalletConnected,
70581
- prefillAmountUsd,
71258
+ prefilledAmountUsd,
70582
71259
  checkoutAmountUsd,
70583
71260
  checkoutReceivedUsd,
70584
71261
  onNewDeposit,
@@ -70600,28 +71277,28 @@ function WalletConnect({
70600
71277
  onExecutionsChange
70601
71278
  }) {
70602
71279
  const { colors: colors2, fonts, components, mode } = useTheme();
70603
- const walletProvidedAtMount = React342.useRef(!!initialWalletInfo && !!initialDepositWallet);
70604
- const [activeWalletInfo, setActiveWalletInfo] = React342.useState(
71280
+ const walletProvidedAtMount = React352.useRef(!!initialWalletInfo && !!initialDepositWallet);
71281
+ const [activeWalletInfo, setActiveWalletInfo] = React352.useState(
70605
71282
  initialWalletInfo ?? null
70606
71283
  );
70607
- const [activeDepositWallet, setActiveDepositWallet] = React342.useState(
71284
+ const [activeDepositWallet, setActiveDepositWallet] = React352.useState(
70608
71285
  initialDepositWallet ?? null
70609
71286
  );
70610
71287
  const initialView = initialWalletInfo && initialDepositWallet ? "select_token" : "select_wallet";
70611
- const [view, setView] = React342.useState(initialView);
70612
- const [isTransitioning, setIsTransitioning] = React342.useState(false);
70613
- const viewRef = React342.useRef(initialView);
71288
+ const [view, setView] = React352.useState(initialView);
71289
+ const [isTransitioning, setIsTransitioning] = React352.useState(false);
71290
+ const viewRef = React352.useRef(initialView);
70614
71291
  const standalone = !canGoBack && !walletProvidedAtMount.current;
70615
71292
  const { wallet: detectedWallet, isLoading: detectingWallet } = useDetectedBrowserWallet({
70616
71293
  enabled: standalone
70617
71294
  });
70618
- const [autoResolved, setAutoResolved] = React342.useState(false);
70619
- const [selectedWalletDef, setSelectedWalletDef] = React342.useState(null);
70620
- const [connectingNetwork, setConnectingNetwork] = React342.useState(null);
70621
- const [walletError, setWalletError] = React342.useState(null);
70622
- const [isWalletConnecting, setIsWalletConnecting] = React342.useState(false);
70623
- const [eip6963ProviderCount, setEip6963ProviderCount] = React342.useState(0);
70624
- React342.useEffect(() => {
71295
+ const [autoResolved, setAutoResolved] = React352.useState(false);
71296
+ const [selectedWalletDef, setSelectedWalletDef] = React352.useState(null);
71297
+ const [connectingNetwork, setConnectingNetwork] = React352.useState(null);
71298
+ const [walletError, setWalletError] = React352.useState(null);
71299
+ const [isWalletConnecting, setIsWalletConnecting] = React352.useState(false);
71300
+ const [eip6963ProviderCount, setEip6963ProviderCount] = React352.useState(0);
71301
+ React352.useEffect(() => {
70625
71302
  const store = getEip6963Store();
70626
71303
  if (!store) return;
70627
71304
  setEip6963ProviderCount(store.getProviders().length);
@@ -70630,7 +71307,7 @@ function WalletConnect({
70630
71307
  });
70631
71308
  }, []);
70632
71309
  const { wallets: backendWallets } = useExternalWallets({ publishableKey });
70633
- const walletDefinitions = React342.useMemo(
71310
+ const walletDefinitions = React352.useMemo(
70634
71311
  () => backendWallets.length > 0 ? backendWallets.map((w) => ({
70635
71312
  id: w.id,
70636
71313
  name: w.name,
@@ -70641,32 +71318,32 @@ function WalletConnect({
70641
71318
  })) : FALLBACK_WALLET_DEFINITIONS,
70642
71319
  [backendWallets]
70643
71320
  );
70644
- const [recentWalletId, setRecentWalletIdState] = React342.useState(getLastOpenedWallet);
70645
- React342.useEffect(() => {
71321
+ const [recentWalletId, setRecentWalletIdState] = React352.useState(getLastOpenedWallet);
71322
+ React352.useEffect(() => {
70646
71323
  if (view === "select_wallet") {
70647
71324
  setRecentWalletIdState(getLastOpenedWallet());
70648
71325
  }
70649
71326
  }, [view]);
70650
- const availableWallets = React342.useMemo(
71327
+ const availableWallets = React352.useMemo(
70651
71328
  () => detectAvailableWallets(walletDefinitions, recentWalletId),
70652
71329
  [walletDefinitions, eip6963ProviderCount, recentWalletId]
70653
71330
  );
70654
- const [isMobile, setIsMobile] = React342.useState(false);
70655
- React342.useEffect(() => {
71331
+ const [isMobile, setIsMobile] = React352.useState(false);
71332
+ React352.useEffect(() => {
70656
71333
  setIsMobile(isMobileDevice());
70657
71334
  }, []);
70658
- const mobileDepositAddresses = React342.useMemo(
71335
+ const mobileDepositAddresses = React352.useMemo(
70659
71336
  () => (depositWallets ?? []).map((w) => ({ chain_type: w.chain_type, address: w.address })),
70660
71337
  [depositWallets]
70661
71338
  );
70662
- const mobileDepositWalletIds = React342.useMemo(
71339
+ const mobileDepositWalletIds = React352.useMemo(
70663
71340
  () => (depositWallets ?? []).filter((w) => w.chain_type === "ethereum" || w.chain_type === "solana").map((w) => w.id),
70664
71341
  [depositWallets]
70665
71342
  );
70666
- const [mobileRedirect, setMobileRedirect] = React342.useState(null);
70667
- const [pendingMobileWallet, setPendingMobileWallet] = React342.useState(null);
70668
- const [awaitingMobileDeposit, setAwaitingMobileDeposit] = React342.useState(false);
70669
- React342.useEffect(() => {
71343
+ const [mobileRedirect, setMobileRedirect] = React352.useState(null);
71344
+ const [pendingMobileWallet, setPendingMobileWallet] = React352.useState(null);
71345
+ const [awaitingMobileDeposit, setAwaitingMobileDeposit] = React352.useState(false);
71346
+ React352.useEffect(() => {
70670
71347
  if (!standalone || autoResolved || detectingWallet) return;
70671
71348
  if (!detectedWallet) {
70672
71349
  setAutoResolved(true);
@@ -70692,32 +71369,36 @@ function WalletConnect({
70692
71369
  depositWallets,
70693
71370
  depositWalletsLoading
70694
71371
  ]);
70695
- React342.useEffect(() => {
71372
+ React352.useEffect(() => {
70696
71373
  if (!standalone || autoResolved) return;
70697
71374
  const t13 = setTimeout(() => setAutoResolved(true), 5e3);
70698
71375
  return () => clearTimeout(t13);
70699
71376
  }, [standalone, autoResolved]);
70700
- const [balances, setBalances] = React342.useState([]);
70701
- const [isLoading, setIsLoading] = React342.useState(false);
70702
- const [selectedBalance, setSelectedBalance] = React342.useState(null);
70703
- const [totalBalanceUsd, setTotalBalanceUsd] = React342.useState(null);
70704
- const [error, setError] = React342.useState(null);
70705
- const [isDisconnectingWallet, setIsDisconnectingWallet] = React342.useState(false);
70706
- const [amountUsd, setAmountUsd] = React342.useState(prefillAmountUsd ?? "");
70707
- const [isConfirming, setIsConfirming] = React342.useState(false);
70708
- const [hasSignedTransaction, setHasSignedTransaction] = React342.useState(false);
70709
- const [tokenChainDetails, setTokenChainDetails] = React342.useState(null);
70710
- const [loadingTokenDetails, setLoadingTokenDetails] = React342.useState(false);
70711
- const [showTransactionDetails, setShowTransactionDetails] = React342.useState(false);
70712
- const [receivedUsdAtSubmission, setReceivedUsdAtSubmission] = React342.useState(null);
71377
+ const [balances, setBalances] = React352.useState([]);
71378
+ const [isLoading, setIsLoading] = React352.useState(false);
71379
+ const [selectedBalance, setSelectedBalance] = React352.useState(null);
71380
+ const [totalBalanceUsd, setTotalBalanceUsd] = React352.useState(null);
71381
+ const [error, setError] = React352.useState(null);
71382
+ const [isDisconnectingWallet, setIsDisconnectingWallet] = React352.useState(false);
71383
+ const [amountUsd, setAmountUsd] = React352.useState(prefilledAmountUsd ?? "");
71384
+ const [isConfirming, setIsConfirming] = React352.useState(false);
71385
+ const [hasSignedTransaction, setHasSignedTransaction] = React352.useState(false);
71386
+ const [tokenChainDetails, setTokenChainDetails] = React352.useState(null);
71387
+ const [loadingTokenDetails, setLoadingTokenDetails] = React352.useState(false);
71388
+ const [showTransactionDetails, setShowTransactionDetails] = React352.useState(false);
71389
+ const [receivedUsdAtSubmission, setReceivedUsdAtSubmission] = React352.useState(null);
70713
71390
  const walletInfo = activeWalletInfo;
70714
71391
  const depositWallet = activeDepositWallet;
70715
71392
  const hasWallet = !!activeWalletInfo && !!activeDepositWallet;
71393
+ React352.useEffect(() => {
71394
+ const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
71395
+ setAmountUsd(cleanedPrefilled);
71396
+ }, [prefilledAmountUsd]);
70716
71397
  const chainType = activeDepositWallet?.chain_type ?? "ethereum";
70717
71398
  const recipientAddress = activeDepositWallet?.address ?? "";
70718
71399
  const isCheckoutMode = !!checkoutAmountUsd;
70719
71400
  const supportedChainType = chainType === "algorand" || chainType === "xrpl" || chainType === "cardano" || chainType === "n1" ? "ethereum" : chainType;
70720
- const transitionTo = React342.useCallback((nextView) => {
71401
+ const transitionTo = React352.useCallback((nextView) => {
70721
71402
  if (nextView === viewRef.current) return;
70722
71403
  setIsTransitioning(true);
70723
71404
  setTimeout(() => {
@@ -70733,10 +71414,13 @@ function WalletConnect({
70733
71414
  };
70734
71415
  const openMobileWalletBrowse = async (wallet, depositAddresses) => {
70735
71416
  try {
71417
+ const cleanedAmountUsd = amountUsd?.replace(/[^0-9.]/g, "") ?? "";
71418
+ const forwardedAmountUsd = parseFloat(cleanedAmountUsd) > 0 ? cleanedAmountUsd : void 0;
70736
71419
  const res = await getWalletMobileDeepLink(
70737
71420
  wallet.id,
70738
71421
  depositAddresses,
70739
- publishableKey
71422
+ publishableKey,
71423
+ forwardedAmountUsd
70740
71424
  );
70741
71425
  if (res.deeplink) {
70742
71426
  setMobileRedirect({ walletId: wallet.id, walletName: wallet.name, deeplink: res.deeplink });
@@ -70782,7 +71466,7 @@ function WalletConnect({
70782
71466
  if (!selectedWalletDef) return;
70783
71467
  handleConnectWallet(selectedWalletDef, network);
70784
71468
  };
70785
- React342.useEffect(() => {
71469
+ React352.useEffect(() => {
70786
71470
  if (!pendingMobileWallet) return;
70787
71471
  if (mobileDepositAddresses.length > 0) {
70788
71472
  const wallet = pendingMobileWallet;
@@ -70825,7 +71509,7 @@ function WalletConnect({
70825
71509
  const eip6963Match = findProviderByWalletId(wallet.id);
70826
71510
  let provider = eip6963Match?.provider;
70827
71511
  if (!provider) {
70828
- const legacyEvm = getLegacyEvmProviders();
71512
+ const legacyEvm = getLegacyEvmProviders(win);
70829
71513
  switch (wallet.id) {
70830
71514
  case "metamask":
70831
71515
  if (legacyEvm.ethereum?.isMetaMask && !legacyEvm.ethereum?.isPhantom)
@@ -70857,16 +71541,7 @@ function WalletConnect({
70857
71541
  const accounts = await provider.request({ method: "eth_requestAccounts" });
70858
71542
  if (!accounts?.length) throw new Error("No accounts returned from wallet");
70859
71543
  setUserDisconnectedWallet(false);
70860
- const walletIdToType = {
70861
- phantom: "phantom-ethereum",
70862
- coinbase: "coinbase",
70863
- trust: "trust",
70864
- rainbow: "rainbow",
70865
- rabby: "rabby",
70866
- okx: "okx",
70867
- metamask: "metamask"
70868
- };
70869
- const walletType = walletIdToType[wallet.id] || "metamask";
71544
+ const walletType = walletIdToWalletType(wallet.id);
70870
71545
  setStoredWalletState(walletType);
70871
71546
  connectedInfo = {
70872
71547
  type: walletType,
@@ -70875,7 +71550,7 @@ function WalletConnect({
70875
71550
  icon: wallet.id
70876
71551
  };
70877
71552
  } else {
70878
- const solProviders = getSolanaProviders();
71553
+ const solProviders = getInjectedSolanaProviders(win);
70879
71554
  let provider;
70880
71555
  switch (wallet.id) {
70881
71556
  case "phantom":
@@ -70894,11 +71569,11 @@ function WalletConnect({
70894
71569
  provider = solProviders.coinbaseSolana || win?.coinbaseWalletExtension?.solana;
70895
71570
  break;
70896
71571
  case "trust":
70897
- provider = win?.trustwallet?.solana;
71572
+ provider = solProviders.trustSolana;
70898
71573
  break;
70899
71574
  }
70900
71575
  if (!provider) throw new Error(`${wallet.name} Solana wallet not found.`);
70901
- const response = await provider.connect();
71576
+ const response = await connectSolanaProviderWithRecovery(provider, wallet.id, wallet.name);
70902
71577
  setUserDisconnectedWallet(false);
70903
71578
  const walletType = wallet.id === "solflare" ? "solflare" : wallet.id === "backpack" ? "backpack" : wallet.id === "glow" ? "glow" : "phantom-solana";
70904
71579
  setStoredWalletState(walletType);
@@ -70946,7 +71621,7 @@ function WalletConnect({
70946
71621
  publishableKey,
70947
71622
  enabled: !!activeWalletInfo && !!recipientAddress
70948
71623
  });
70949
- const effectiveDestinationAmount = React342.useMemo(() => {
71624
+ const effectiveDestinationAmount = React352.useMemo(() => {
70950
71625
  if (!checkoutRemainingBaseUnits || checkoutRemainingBaseUnits === "0") return "0";
70951
71626
  if (!checkoutAmountUsd) return checkoutRemainingBaseUnits;
70952
71627
  const remaining = BigInt(checkoutRemainingBaseUnits);
@@ -70974,7 +71649,7 @@ function WalletConnect({
70974
71649
  stablecoinParity,
70975
71650
  enabled: isCheckoutMode && !!selectedToken && !!checkoutDestination && effectiveDestinationAmount !== "0"
70976
71651
  });
70977
- const activeCheckoutQuote = React342.useMemo(() => {
71652
+ const activeCheckoutQuote = React352.useMemo(() => {
70978
71653
  if (!isCheckoutMode) return null;
70979
71654
  if (walletCheckoutQuote)
70980
71655
  return {
@@ -71004,10 +71679,10 @@ function WalletConnect({
71004
71679
  onDepositSuccess,
71005
71680
  onDepositError
71006
71681
  });
71007
- React342.useEffect(() => {
71682
+ React352.useEffect(() => {
71008
71683
  onExecutionsChange?.(depositExecutions);
71009
71684
  }, [depositExecutions, onExecutionsChange]);
71010
- const latestDepositExecution = React342.useMemo(() => {
71685
+ const latestDepositExecution = React352.useMemo(() => {
71011
71686
  if (depositExecutions.length === 0) return null;
71012
71687
  return [...depositExecutions].sort((a, b) => {
71013
71688
  const ta = a.created_at ? new Date(a.created_at).getTime() : 0;
@@ -71015,21 +71690,21 @@ function WalletConnect({
71015
71690
  return tb - ta;
71016
71691
  })[0];
71017
71692
  }, [depositExecutions]);
71018
- React342.useEffect(() => {
71693
+ React352.useEffect(() => {
71019
71694
  if (awaitingMobileDeposit && latestDepositExecution && (viewRef.current === "mobile_redirect" || viewRef.current === "connecting")) {
71020
71695
  transitionTo("mobile_deposit_status");
71021
71696
  }
71022
71697
  }, [awaitingMobileDeposit, latestDepositExecution, transitionTo]);
71023
- React342.useEffect(() => {
71024
- if (!prefillAmountUsd || !tokenChainDetails || view !== "enter_amount") return;
71698
+ React352.useEffect(() => {
71699
+ if (!isCheckoutMode || !tokenChainDetails || view !== "enter_amount") return;
71025
71700
  const minDeposit = tokenChainDetails.minimum_deposit_amount_usd || 0;
71026
71701
  const currentAmount = parseFloat(amountUsd) || 0;
71027
71702
  if (currentAmount > 0 && currentAmount < minDeposit) setAmountUsd(minDeposit.toFixed(2));
71028
- }, [tokenChainDetails, view, prefillAmountUsd]);
71029
- React342.useEffect(() => {
71703
+ }, [isCheckoutMode, tokenChainDetails, view, amountUsd]);
71704
+ React352.useEffect(() => {
71030
71705
  if (view === "review") setShowTransactionDetails(false);
71031
71706
  }, [view]);
71032
- React342.useEffect(() => {
71707
+ React352.useEffect(() => {
71033
71708
  if (view !== "enter_amount" && view !== "review" || !selectedBalance || !activeDepositWallet)
71034
71709
  return;
71035
71710
  let cancelled = false;
@@ -71066,7 +71741,7 @@ function WalletConnect({
71066
71741
  cancelled = true;
71067
71742
  };
71068
71743
  }, [view, selectedBalance, publishableKey, activeDepositWallet]);
71069
- React342.useEffect(() => {
71744
+ React352.useEffect(() => {
71070
71745
  if (!activeWalletInfo || !activeDepositWallet) return;
71071
71746
  let cancelled = false;
71072
71747
  setIsLoading(true);
@@ -71131,21 +71806,21 @@ function WalletConnect({
71131
71806
  defaultSourceTokenAddress,
71132
71807
  defaultSourceSymbol
71133
71808
  ]);
71134
- const usdToTokenRate = React342.useMemo(() => {
71809
+ const usdToTokenRate = React352.useMemo(() => {
71135
71810
  if (!selectedBalance || !selectedBalance.amount_usd || !selectedToken) return 0;
71136
71811
  const balanceAmount = Number(selectedBalance.amount) / 10 ** selectedToken.decimals;
71137
71812
  const balanceUsd = parseFloat(selectedBalance.amount_usd);
71138
71813
  if (balanceAmount === 0 || balanceUsd === 0) return 0;
71139
71814
  return balanceAmount / balanceUsd;
71140
71815
  }, [selectedBalance, selectedToken]);
71141
- const tokenAmount = React342.useMemo(() => {
71816
+ const tokenAmount = React352.useMemo(() => {
71142
71817
  if (isCheckoutMode && activeCheckoutQuote && selectedToken)
71143
71818
  return Number(activeCheckoutQuote.sourceAmount) / 10 ** activeCheckoutQuote.sourceTokenDecimals;
71144
71819
  const usdNum = parseFloat(amountUsd) || 0;
71145
71820
  if (usdNum === 0 || usdToTokenRate === 0) return 0;
71146
71821
  return usdNum * usdToTokenRate;
71147
71822
  }, [amountUsd, usdToTokenRate, isCheckoutMode, activeCheckoutQuote, selectedToken]);
71148
- React342.useEffect(() => {
71823
+ React352.useEffect(() => {
71149
71824
  if (isCheckoutMode && activeCheckoutQuote?.sourceAmountUsd && view === "enter_amount")
71150
71825
  setAmountUsd(activeCheckoutQuote.sourceAmountUsd);
71151
71826
  }, [isCheckoutMode, activeCheckoutQuote, view]);
@@ -71154,7 +71829,7 @@ function WalletConnect({
71154
71829
  const inputUsdNum = parseFloat(amountUsd) || 0;
71155
71830
  const minDepositUsd = tokenChainDetails?.minimum_deposit_amount_usd || 0;
71156
71831
  const isValidAmount = isCheckoutMode && activeCheckoutQuote ? tokenAmount > 0 && tokenAmount <= maxTokenAmount : inputUsdNum > 0 && inputUsdNum <= maxUsdAmount && inputUsdNum >= minDepositUsd;
71157
- const formattedTokenAmount = React342.useMemo(() => {
71832
+ const formattedTokenAmount = React352.useMemo(() => {
71158
71833
  if (tokenAmount === 0 || !selectedToken) return null;
71159
71834
  return `${tokenAmount.toFixed(6)} ${selectedToken.symbol}`.replace(/\.?0+$/, "");
71160
71835
  }, [tokenAmount, selectedToken]);
@@ -71187,7 +71862,7 @@ function WalletConnect({
71187
71862
  break;
71188
71863
  case "enter_amount":
71189
71864
  transitionTo("select_token");
71190
- setAmountUsd(prefillAmountUsd ?? "");
71865
+ setAmountUsd(prefilledAmountUsd ?? "");
71191
71866
  setTokenChainDetails(null);
71192
71867
  break;
71193
71868
  case "review":
@@ -71219,7 +71894,7 @@ function WalletConnect({
71219
71894
  setSelectedBalance(null);
71220
71895
  setBalances([]);
71221
71896
  setTotalBalanceUsd(null);
71222
- setAmountUsd(prefillAmountUsd ?? "");
71897
+ setAmountUsd(prefilledAmountUsd ?? "");
71223
71898
  setError(null);
71224
71899
  };
71225
71900
  if (standalone) {
@@ -71249,16 +71924,7 @@ function WalletConnect({
71249
71924
  return (integerPart + decimalPart.padEnd(decimals, "0").slice(0, decimals)).replace(/^0+/, "") || "0";
71250
71925
  };
71251
71926
  const resolveEvmProvider = () => {
71252
- const walletIdMap = {
71253
- "phantom-ethereum": "phantom",
71254
- coinbase: "coinbase",
71255
- trust: "trust",
71256
- okx: "okx",
71257
- rainbow: "rainbow",
71258
- rabby: "rabby",
71259
- metamask: "metamask"
71260
- };
71261
- const lookupId = walletIdMap[walletInfo.type] || walletInfo.type;
71927
+ const lookupId = walletTypeToWalletId(walletInfo.type);
71262
71928
  const eip6963Match = findProviderByWalletId(lookupId);
71263
71929
  let provider = eip6963Match?.provider;
71264
71930
  if (!provider) {
@@ -71943,6 +72609,15 @@ function SkeletonButton({ variant = "default" }) {
71943
72609
  ] });
71944
72610
  }
71945
72611
  var t8 = i18n2.depositModal;
72612
+ function normalizePrefilledUsdAmount(value) {
72613
+ if (!value) return void 0;
72614
+ const cleaned = value.replace(/[^0-9.]/g, "");
72615
+ if (!cleaned) return void 0;
72616
+ const normalizedNumeric = cleaned.replace(/(\..*)\./g, "$1");
72617
+ const parsed = parseFloat(normalizedNumeric);
72618
+ if (!Number.isFinite(parsed) || parsed <= 0) return void 0;
72619
+ return parseFloat(parsed.toFixed(2)).toString();
72620
+ }
71946
72621
  function depositTabForScreen(screen) {
71947
72622
  return screen === "card" || screen === "cashapp" || screen === "bank_transfer" || screen === "stripe_link" || screen === "apple_pay" ? "cash" : "crypto";
71948
72623
  }
@@ -71962,6 +72637,7 @@ function DepositModal({
71962
72637
  defaultSourceChainId,
71963
72638
  defaultSourceTokenAddress,
71964
72639
  defaultSourceSymbol,
72640
+ prefilledAmountUsd,
71965
72641
  hideDepositTracker,
71966
72642
  showBalanceHeader = false,
71967
72643
  transferInputVariant = "double_input",
@@ -71977,6 +72653,7 @@ function DepositModal({
71977
72653
  applePayTitle = "Pay with Apple Pay",
71978
72654
  applePaySubTitle = "Instant",
71979
72655
  enableBankTransfer,
72656
+ enableIncidentBanner = false,
71980
72657
  // No default: left undefined so the backend `stripe_link.enabled` can govern
71981
72658
  // (via the `??` chain in showStripeLink) once a dashboard toggle exists.
71982
72659
  enableStripeLink,
@@ -71997,6 +72674,10 @@ function DepositModal({
71997
72674
  depositTrackerSubTitle = t8.depositTracker.subtitle
71998
72675
  }) {
71999
72676
  const { colors: colors2, fonts, components } = useTheme();
72677
+ const normalizedPrefilledAmountUsd = (0, import_react3.useMemo)(
72678
+ () => normalizePrefilledUsdAmount(prefilledAmountUsd),
72679
+ [prefilledAmountUsd]
72680
+ );
72000
72681
  const onDepositSuccessFor = (0, import_react3.useCallback)(
72001
72682
  (method) => onDepositSuccess || onEvent ? (data) => {
72002
72683
  const payload = { ...data, method };
@@ -72018,7 +72699,7 @@ function DepositModal({
72018
72699
  const s = initialScreen ?? "main";
72019
72700
  if (s === "tracker" && hideDepositTracker === true) return "main";
72020
72701
  if (s === "cashapp" && enableCashApp === false) return "main";
72021
- if (s === "stripe_link" && !enableStripeLink) return "main";
72702
+ if (s === "stripe_link" && enableStripeLink === false) return "main";
72022
72703
  if (s === "apple_pay" && enableApplePay === false) return "main";
72023
72704
  if (s === "card" && enableFiatOnramp === false) return "main";
72024
72705
  if (s === "pay_with_exchange") return enablePayWithExchange === false ? "main" : "exchange";
@@ -72077,6 +72758,16 @@ function DepositModal({
72077
72758
  const showApplePay = enableApplePay ?? projectConfig?.apple_pay?.enabled ?? true;
72078
72759
  const showBankTransfer = enableBankTransfer ?? projectConfig?.bank_transfer?.enabled ?? true;
72079
72760
  const showDepositTracker = hideDepositTracker ? false : projectConfig?.deposit_tracker?.enabled ?? true;
72761
+ const { incident: publicIncident } = usePublicIncident({
72762
+ publishableKey,
72763
+ enabled: open && enableIncidentBanner
72764
+ });
72765
+ const activeIncident = enableIncidentBanner && publicIncident?.enabled && (publicIncident.messages?.length ?? 0) > 0 ? {
72766
+ enabled: true,
72767
+ messages: publicIncident.messages,
72768
+ severity: publicIncident.severity,
72769
+ statusPageUrl: publicIncident.status_page_url
72770
+ } : void 0;
72080
72771
  const [integrationExchanges, setIntegrationExchanges] = (0, import_react3.useState)([]);
72081
72772
  (0, import_react3.useEffect)(() => {
72082
72773
  if (!showConnectExchange || !open) return;
@@ -72143,7 +72834,11 @@ function DepositModal({
72143
72834
  setConnectedExchange((prev) => prev ? { ...prev, iconUrl } : prev);
72144
72835
  }
72145
72836
  }, [integrationExchanges, connectedExchange]);
72146
- const { data: depositAddressResponse, isLoading: walletsLoading } = useDepositAddress({
72837
+ const {
72838
+ data: depositAddressResponse,
72839
+ isLoading: walletsLoading,
72840
+ error: walletsError
72841
+ } = useDepositAddress({
72147
72842
  userId,
72148
72843
  publishableKey,
72149
72844
  recipientAddress,
@@ -72276,6 +72971,7 @@ function DepositModal({
72276
72971
  const {
72277
72972
  isValid: isAddressValid,
72278
72973
  failureCode: addressFailureCode,
72974
+ message: addressFailureMessage,
72279
72975
  metadata: addressFailureMetadata,
72280
72976
  isLoading: isAddressValidationLoading
72281
72977
  } = useAddressValidation({
@@ -72289,17 +72985,31 @@ function DepositModal({
72289
72985
  refetchOnMount: "always"
72290
72986
  });
72291
72987
  const addressValidationMessages = i18n2.transferCrypto.addressValidation;
72292
- const getAddressValidationErrorMessage = (code, metadata) => {
72988
+ const getAddressValidationErrorMessage = (message, code, metadata) => {
72989
+ if (message && message.trim().length > 0) return message;
72293
72990
  if (!code) return addressValidationMessages.defaultError;
72294
72991
  const errors = addressValidationMessages.errors;
72295
72992
  const template = errors[code] ?? addressValidationMessages.defaultError;
72296
72993
  return interpolate(template, metadata);
72297
72994
  };
72995
+ const walletsRecipientError = isDepositAddressValidationError(walletsError) ? walletsError.message : null;
72996
+ const isRecipientAddressInvalid = isAddressValid === false || walletsRecipientError !== null;
72997
+ const recipientInvalidMessage = getAddressValidationErrorMessage(
72998
+ addressFailureMessage ?? walletsRecipientError,
72999
+ addressFailureCode,
73000
+ addressFailureMetadata
73001
+ );
72298
73002
  const openingScreen = effectiveInitialScreen;
72299
73003
  const sessionOpenedFromMenu = openingScreen === "main";
72300
73004
  const standaloneNeedsDepositPrereq = openingScreen !== "main" && (view === "transfer" || view === "card");
72301
73005
  let depositPrerequisiteBody;
72302
- if (isCountryLoading || isAddressValidationLoading || tokensLoading || walletsLoading || !projectConfig || // Bank-transfer row visibility depends on the country-gated providers
73006
+ if (isRecipientAddressInvalid) {
73007
+ depositPrerequisiteBody = /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
73008
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("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__ */ (0, import_jsx_runtime82.jsx)(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
73009
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("h3", { className: "uf-text-lg uf-font-semibold uf-text-foreground uf-mb-2", children: addressValidationMessages.unableToReceiveFunds }),
73010
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("p", { className: "uf-text-sm uf-text-muted-foreground uf-max-w-[280px]", children: recipientInvalidMessage })
73011
+ ] });
73012
+ } else if (isCountryLoading || isAddressValidationLoading || tokensLoading || walletsLoading || !projectConfig || // Bank-transfer row visibility depends on the country-gated providers
72303
73013
  // fetch — block the menu on it so the row never flashes in or out.
72304
73014
  showBankTransfer && bankTransferProvidersLoading || // Same for Apple Pay: row visibility depends on the geo/platform-gated
72305
73015
  // providers fetch — block the menu so the row doesn't pop in or out.
@@ -72321,12 +73031,6 @@ function DepositModal({
72321
73031
  /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("h3", { className: "uf-text-lg uf-font-semibold uf-text-foreground uf-mb-2", children: "No Tokens Available" }),
72322
73032
  /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("p", { className: "uf-text-sm uf-text-muted-foreground uf-max-w-[280px]", children: "There are no supported tokens available from your current location." })
72323
73033
  ] });
72324
- } else if (isAddressValid === false) {
72325
- depositPrerequisiteBody = /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
72326
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("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__ */ (0, import_jsx_runtime82.jsx)(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
72327
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("h3", { className: "uf-text-lg uf-font-semibold uf-text-foreground uf-mb-2", children: addressValidationMessages.unableToReceiveFunds }),
72328
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("p", { className: "uf-text-sm uf-text-muted-foreground uf-max-w-[280px]", children: getAddressValidationErrorMessage(addressFailureCode, addressFailureMetadata) })
72329
- ] });
72330
73034
  } else {
72331
73035
  depositPrerequisiteBody = null;
72332
73036
  }
@@ -72820,6 +73524,7 @@ function DepositModal({
72820
73524
  title: modalTitle || "Deposit",
72821
73525
  showClose: !hideOverlay,
72822
73526
  onClose: handleClose,
73527
+ incident: activeIncident,
72823
73528
  showBalance: showBalanceHeader,
72824
73529
  balanceAddress: recipientAddress,
72825
73530
  balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
@@ -72839,6 +73544,7 @@ function DepositModal({
72839
73544
  showBack: showBackTransfer,
72840
73545
  onBack: handleBack,
72841
73546
  onClose: handleClose,
73547
+ incident: activeIncident,
72842
73548
  showBalance: showBalanceHeader,
72843
73549
  balanceAddress: recipientAddress,
72844
73550
  balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
@@ -72862,6 +73568,7 @@ function DepositModal({
72862
73568
  defaultSourceChainId,
72863
73569
  defaultSourceTokenAddress,
72864
73570
  defaultSourceSymbol,
73571
+ prefilledAmountUsd: normalizedPrefilledAmountUsd,
72865
73572
  depositConfirmationMode,
72866
73573
  onExecutionsChange: setDepositExecutions,
72867
73574
  onDepositSuccess: onDepositSuccessFor("transfer"),
@@ -72881,6 +73588,7 @@ function DepositModal({
72881
73588
  defaultSourceChainId,
72882
73589
  defaultSourceTokenAddress,
72883
73590
  defaultSourceSymbol,
73591
+ prefilledAmountUsd: normalizedPrefilledAmountUsd,
72884
73592
  depositConfirmationMode,
72885
73593
  onExecutionsChange: setDepositExecutions,
72886
73594
  onDepositSuccess: onDepositSuccessFor("transfer"),
@@ -72897,7 +73605,8 @@ function DepositModal({
72897
73605
  title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
72898
73606
  showBack: showBackTracker,
72899
73607
  onBack: handleBack,
72900
- onClose: handleClose
73608
+ onClose: handleClose,
73609
+ incident: activeIncident
72901
73610
  }
72902
73611
  ),
72903
73612
  /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
@@ -72929,6 +73638,7 @@ function DepositModal({
72929
73638
  showBack: showBackCard,
72930
73639
  onBack: handleBack,
72931
73640
  onClose: handleClose,
73641
+ incident: activeIncident,
72932
73642
  badge: cardView === "quotes" ? { count: quotesCount } : void 0,
72933
73643
  showBalance: showBalanceHeader,
72934
73644
  balanceAddress: recipientAddress,
@@ -72965,7 +73675,8 @@ function DepositModal({
72965
73675
  wallets,
72966
73676
  assetCdnUrl: projectConfig?.asset_cdn_url,
72967
73677
  hideDepositFlowInfo,
72968
- hideDisplayDescription
73678
+ hideDisplayDescription,
73679
+ prefilledAmountUsd: normalizedPrefilledAmountUsd
72969
73680
  }
72970
73681
  ),
72971
73682
  depositPoweredByFooter
@@ -72977,7 +73688,8 @@ function DepositModal({
72977
73688
  title: payWithExchangeTitle,
72978
73689
  showBack: exchangeView === "pending" || sessionOpenedFromMenu,
72979
73690
  onBack: handleBack,
72980
- onClose: handleClose
73691
+ onClose: handleClose,
73692
+ incident: activeIncident
72981
73693
  }
72982
73694
  ),
72983
73695
  /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
@@ -73030,7 +73742,8 @@ function DepositModal({
73030
73742
  defaultSourceChainType,
73031
73743
  defaultSourceChainId,
73032
73744
  defaultSourceTokenAddress,
73033
- defaultSourceSymbol
73745
+ defaultSourceSymbol,
73746
+ prefilledAmountUsd: normalizedPrefilledAmountUsd
73034
73747
  }
73035
73748
  ),
73036
73749
  depositPoweredByFooter
@@ -73062,6 +73775,7 @@ function DepositModal({
73062
73775
  onDepositSuccess: onDepositSuccessFor("wallet_connect"),
73063
73776
  onDepositError: onDepositErrorFor("wallet_connect"),
73064
73777
  amountQuickSelect: browserWalletAmountQuickSelect,
73778
+ prefilledAmountUsd: normalizedPrefilledAmountUsd,
73065
73779
  onWalletDisconnect: handleWalletDisconnect,
73066
73780
  onWalletConnected: (info, dw) => {
73067
73781
  setBrowserWalletInfo({ ...info, depositWallet: dw });
@@ -73089,7 +73803,8 @@ function DepositModal({
73089
73803
  title: t8.bankTransfer.title,
73090
73804
  showBack: bankTransferView !== "providers" || sessionOpenedFromMenu,
73091
73805
  onBack: handleBack,
73092
- onClose: handleClose
73806
+ onClose: handleClose,
73807
+ incident: activeIncident
73093
73808
  }
73094
73809
  ),
73095
73810
  /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
@@ -73110,7 +73825,8 @@ function DepositModal({
73110
73825
  assetCdnUrl: projectConfig?.asset_cdn_url,
73111
73826
  onEvent,
73112
73827
  onDepositSuccess,
73113
- onDepositError
73828
+ onDepositError,
73829
+ prefilledAmountUsd: normalizedPrefilledAmountUsd
73114
73830
  }
73115
73831
  ),
73116
73832
  depositPoweredByFooter
@@ -73122,26 +73838,24 @@ function DepositModal({
73122
73838
  title: "Deposit with Link",
73123
73839
  showBack: stripeLinkStep !== "checkout" && stripeLinkStep !== "success",
73124
73840
  onBack: handleBack,
73125
- showClose: stripeLinkStep !== "checkout",
73841
+ incident: activeIncident,
73842
+ showClose: stripeLinkStep !== "checkout" && stripeLinkStep !== "auth",
73126
73843
  onClose: handleClose
73127
73844
  }
73128
73845
  ),
73129
73846
  /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73130
73847
  isLoadingIp ? (
73131
- // Hold the geo decision until IP resolves so we don't mount
73132
- // PayWithStripeLink (which kicks off config/OAuth work) for a
73133
- // deep-link user who turns out to be outside the US.
73848
+ // Wait for location so the first config fetch is region-aware.
73134
73849
  /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(SkeletonButton, { variant: "with-icons" })
73135
73850
  ) : !showStripeLink ? (
73136
- // Stripe Link's crypto on-ramp is US-only. On a direct open
73137
- // (initialScreen="stripe_link") the row isn't in a menu to
73138
- // fall back to, so show a geo-restriction screen rather than
73139
- // the Link UI.
73851
+ // Direct opens (initialScreen="stripe_link") have no menu row
73852
+ // to fall back to, so render an unavailable state when backend
73853
+ // config resolves Stripe Link disabled/hidden.
73140
73854
  /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73141
73855
  GeoRestrictionScreen,
73142
73856
  {
73143
73857
  methodName: t8.stripeLink.title,
73144
- message: "Pay with Link is only available in the US."
73858
+ message: t8.stripeLink.unavailableInRegionMessage
73145
73859
  }
73146
73860
  )
73147
73861
  ) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
@@ -73153,6 +73867,8 @@ function DepositModal({
73153
73867
  destinationChainType,
73154
73868
  destinationChainId,
73155
73869
  destinationTokenAddress,
73870
+ countryCode: userIpInfo?.alpha2,
73871
+ subdivisionCode: userIpInfo?.subdivisionCode ?? void 0,
73156
73872
  wallets,
73157
73873
  email: userEmail,
73158
73874
  iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/link.svg` : void 0,
@@ -73172,7 +73888,8 @@ function DepositModal({
73172
73888
  title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
73173
73889
  showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
73174
73890
  onBack: handleBack,
73175
- onClose: handleClose
73891
+ onClose: handleClose,
73892
+ incident: activeIncident
73176
73893
  }
73177
73894
  ),
73178
73895
  /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
@@ -73192,6 +73909,7 @@ function DepositModal({
73192
73909
  onEvent,
73193
73910
  onDepositSuccess: onDepositSuccessFor("cashapp"),
73194
73911
  onDepositError: onDepositErrorFor("cashapp"),
73912
+ prefilledAmountUsd: normalizedPrefilledAmountUsd,
73195
73913
  wallets
73196
73914
  }
73197
73915
  ),
@@ -73207,7 +73925,8 @@ function DepositModal({
73207
73925
  const handled = applePayHandleRef.current?.requestBack() ?? false;
73208
73926
  if (!handled) handleBack();
73209
73927
  },
73210
- onClose: handleClose
73928
+ onClose: handleClose,
73929
+ incident: activeIncident
73211
73930
  }
73212
73931
  ),
73213
73932
  /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
@@ -73322,6 +74041,7 @@ function CheckoutModal({
73322
74041
  modalTitle,
73323
74042
  enableTransferCrypto,
73324
74043
  enableConnectWallet,
74044
+ enableIncidentBanner = false,
73325
74045
  defaultSourceChainType,
73326
74046
  defaultSourceChainId,
73327
74047
  defaultSourceTokenAddress,
@@ -73393,6 +74113,16 @@ function CheckoutModal({
73393
74113
  });
73394
74114
  const showTransferCrypto = enableTransferCrypto ?? projectConfig?.transfer_crypto?.enabled ?? true;
73395
74115
  const showConnectWallet = enableConnectWallet ?? projectConfig?.connect_wallet?.enabled ?? true;
74116
+ const { incident: publicIncident } = usePublicIncident({
74117
+ publishableKey,
74118
+ enabled: open && enableIncidentBanner
74119
+ });
74120
+ const activeIncident = enableIncidentBanner && publicIncident?.enabled && (publicIncident.messages?.length ?? 0) > 0 ? {
74121
+ enabled: true,
74122
+ messages: publicIncident.messages,
74123
+ severity: publicIncident.severity,
74124
+ statusPageUrl: publicIncident.status_page_url
74125
+ } : void 0;
73396
74126
  (0, import_react35.useEffect)(() => {
73397
74127
  if (view === "transfer" && !showTransferCrypto) {
73398
74128
  setView("main");
@@ -73694,7 +74424,15 @@ function CheckoutModal({
73694
74424
  {
73695
74425
  className: view === "wallet_connect" ? "uf-flex uf-min-h-0 uf-flex-col" : void 0,
73696
74426
  children: view === "main" ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
73697
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(DepositHeader, { title: modalTitle || "Checkout", showClose: true, onClose: handleClose }),
74427
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
74428
+ DepositHeader,
74429
+ {
74430
+ title: modalTitle || "Checkout",
74431
+ showClose: true,
74432
+ onClose: handleClose,
74433
+ incident: activeIncident
74434
+ }
74435
+ ),
73698
74436
  /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73699
74437
  piLoading ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-space-y-3", children: [
73700
74438
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
@@ -73792,7 +74530,8 @@ function CheckoutModal({
73792
74530
  title: modalTitle || "Checkout",
73793
74531
  showBack: true,
73794
74532
  onBack: handleBack,
73795
- onClose: handleClose
74533
+ onClose: handleClose,
74534
+ incident: activeIncident
73796
74535
  }
73797
74536
  ),
73798
74537
  /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
@@ -73891,7 +74630,7 @@ function CheckoutModal({
73891
74630
  userId: paymentIntent.user_id || "",
73892
74631
  publishableKey,
73893
74632
  clientSecret,
73894
- prefillAmountUsd: remainingAmountUsd,
74633
+ prefilledAmountUsd: remainingAmountUsd,
73895
74634
  checkoutAmountUsd: paymentIntent.amount_usd,
73896
74635
  checkoutReceivedUsd: paymentIntent.amount_received_usd,
73897
74636
  checkoutDestination: {
@@ -73962,6 +74701,7 @@ function useSupportedDestinationTokens(publishableKey, enabled = true) {
73962
74701
  enabled
73963
74702
  });
73964
74703
  }
74704
+ var STORAGE_KEY3 = "unifold_last_withdraw_to_token";
73965
74705
  function useDefaultDestinationToken({
73966
74706
  destinationTokens,
73967
74707
  defaultDestinationChainType,
@@ -73974,7 +74714,8 @@ function useDefaultDestinationToken({
73974
74714
  defaultChainType: defaultDestinationChainType,
73975
74715
  defaultChainId: defaultDestinationChainId,
73976
74716
  defaultTokenAddress: defaultDestinationTokenAddress,
73977
- defaultSymbol: defaultDestinationSymbol
74717
+ defaultSymbol: defaultDestinationSymbol,
74718
+ storageKey: STORAGE_KEY3
73978
74719
  });
73979
74720
  }
73980
74721
  function useSourceTokenValidation(params) {
@@ -74648,6 +75389,9 @@ function WithdrawForm({
74648
75389
  if (isDebouncing || isVerifyingAddress) return null;
74649
75390
  if (verifyError) return t10.invalidAddress;
74650
75391
  if (addressVerification && !addressVerification.valid) {
75392
+ if (addressVerification.message && addressVerification.message.trim().length > 0) {
75393
+ return addressVerification.message;
75394
+ }
74651
75395
  if (addressVerification.failure_code === "account_not_found")
74652
75396
  return `Account not found on ${selectedChain?.chain_name}`;
74653
75397
  if (addressVerification.failure_code === "not_opted_in")
@@ -75904,6 +76648,7 @@ function UnifoldProvider2({
75904
76648
  const [isWithdrawOpen, setIsWithdrawOpen] = (0, import_react.useState)(false);
75905
76649
  const [withdrawConfig, setWithdrawConfig] = (0, import_react.useState)(null);
75906
76650
  const [resolvedTheme, setResolvedTheme] = import_react.default.useState("dark");
76651
+ const incidentBannerEnabled = config?.notifications?.incidentBanner;
75907
76652
  (0, import_react.useEffect)(() => {
75908
76653
  if (publishableKey) {
75909
76654
  setApiConfig({ publishableKey });
@@ -76201,6 +76946,7 @@ function UnifoldProvider2({
76201
76946
  publishableKey,
76202
76947
  enableTransferCrypto: config?.enableTransferCrypto,
76203
76948
  enableConnectWallet: config?.enableConnectWallet,
76949
+ enableIncidentBanner: incidentBannerEnabled,
76204
76950
  defaultSourceChainType: checkoutConfig.defaultSourceChainType,
76205
76951
  defaultSourceChainId: checkoutConfig.defaultSourceChainId,
76206
76952
  defaultSourceTokenAddress: checkoutConfig.defaultSourceTokenAddress,
@@ -76254,6 +77000,7 @@ function UnifoldProvider2({
76254
77000
  defaultSourceChainId: depositConfig.defaultSourceChainId,
76255
77001
  defaultSourceTokenAddress: depositConfig.defaultSourceTokenAddress,
76256
77002
  defaultSourceSymbol: depositConfig.defaultSourceSymbol,
77003
+ prefilledAmountUsd: depositConfig.prefilledAmountUsd,
76257
77004
  userEmail: depositConfig.user?.email,
76258
77005
  depositConfirmationMode: depositConfig.depositConfirmationMode ?? "auto_ui",
76259
77006
  hideDepositTracker: config?.hideDepositTracker,
@@ -76267,6 +77014,7 @@ function UnifoldProvider2({
76267
77014
  enableConnectExchange: config?.enableConnectExchange,
76268
77015
  enableCashApp: config?.enableCashApp,
76269
77016
  enableStripeLink: config?.enableStripeLink,
77017
+ enableIncidentBanner: incidentBannerEnabled,
76270
77018
  enableApplePay: config?.enableApplePay,
76271
77019
  applePayTitle: config?.applePayTitle,
76272
77020
  applePaySubTitle: config?.applePaySubTitle,