@unifold/ui-react 0.1.68-beta.2 → 0.1.68

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
@@ -465,6 +465,7 @@ var DialogContent = React3.forwardRef(({ className, style, children, omitOverlay
465
465
  className: cn(
466
466
  portalContainer ? "uf-absolute" : "uf-fixed",
467
467
  "uf-bottom-0 uf-left-0 uf-right-0 uf-top-0 uf-z-50 uf-grid uf-w-full uf-max-w-full uf-h-full",
468
+ "focus:uf-outline-none focus-visible:uf-outline-none",
468
469
  !portalContainer && "sm:uf-left-[50%] sm:uf-top-[50%] sm:uf-bottom-auto sm:uf-right-auto sm:uf-translate-x-[-50%] sm:uf-translate-y-[-50%] sm:uf-h-auto",
469
470
  "uf-border uf-bg-background",
470
471
  omitOverlayEmbed ? "uf-gap-0 uf-p-0" : "uf-gap-4 uf-p-6 uf-shadow-lg uf-duration-200",
@@ -480,6 +481,14 @@ var DialogContent = React3.forwardRef(({ className, style, children, omitOverlay
480
481
  ),
481
482
  style: {
482
483
  "--uf-container-radius": `${components.container.borderRadius}px`,
484
+ // Radix traps focus and, when the focused control unmounts during an
485
+ // in-modal screen transition, moves focus onto this container. Modern
486
+ // browsers paint the default focus ring via `:focus-visible`, which
487
+ // flashes a highlight around the whole modal until focus settles on
488
+ // the next screen. Suppress it inline so it works regardless of the
489
+ // Tailwind build (the container is a programmatic focus target, not an
490
+ // interactive control, so it should never show a focus ring).
491
+ outline: "none",
483
492
  ...portalContainer ? { display: "flex", flexDirection: "column" } : {},
484
493
  ...style
485
494
  },
@@ -12975,10 +12984,16 @@ function PayWithStripeLink({
12975
12984
  return /* @__PURE__ */ jsxs41(
12976
12985
  "div",
12977
12986
  {
12978
- className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-max-h-[70vh]",
12987
+ className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-overflow-x-hidden uf-max-h-[70vh]",
12979
12988
  style: { backgroundColor: colors2.background },
12980
12989
  children: [
12981
- /* @__PURE__ */ jsx44("div", { ref: paymentMountRef, className: "uf-w-full uf-flex-1 uf-overflow-y-auto" }),
12990
+ /* @__PURE__ */ jsx44(
12991
+ "div",
12992
+ {
12993
+ ref: paymentMountRef,
12994
+ className: "uf-w-full uf-flex-1 uf-overflow-y-auto uf-overflow-x-hidden"
12995
+ }
12996
+ ),
12982
12997
  !stripePaymentUIReady && /* @__PURE__ */ jsx44("div", { className: "uf-flex uf-items-center uf-justify-center uf-py-8", children: /* @__PURE__ */ jsx44(Loader25, { className: "uf-w-8 uf-h-8 uf-animate-spin", style: { color: colors2.primary } }) }),
12983
12998
  error && /* @__PURE__ */ jsx44(
12984
12999
  "div",
@@ -12996,7 +13011,7 @@ function PayWithStripeLink({
12996
13011
  return /* @__PURE__ */ jsxs41(
12997
13012
  "div",
12998
13013
  {
12999
- className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-max-h-[70vh]",
13014
+ className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-overflow-x-hidden uf-max-h-[70vh]",
13000
13015
  style: { backgroundColor: colors2.background },
13001
13016
  children: [
13002
13017
  displayPaymentTokens.length === 0 && !loading && /* @__PURE__ */ jsx44("div", { className: "uf-px-1 uf-mb-3 uf-text-center", children: /* @__PURE__ */ jsx44(
@@ -14129,21 +14144,34 @@ import {
14129
14144
  } from "@unifold/core";
14130
14145
 
14131
14146
  // src/hooks/use-project-config.ts
14132
- import { useQuery as useQuery8 } from "@tanstack/react-query";
14147
+ import { useQuery as useQuery8, keepPreviousData } from "@tanstack/react-query";
14133
14148
  import { getProjectConfig } from "@unifold/core";
14134
14149
  function useProjectConfig({
14135
14150
  publishableKey,
14136
- enabled = true
14151
+ enabled = true,
14152
+ countryCode,
14153
+ subdivisionCode
14137
14154
  }) {
14138
- const { data: projectConfig, isLoading } = useQuery8({
14139
- queryKey: ["unifold", "projectConfig", publishableKey],
14140
- queryFn: () => getProjectConfig(publishableKey),
14155
+ const {
14156
+ data: projectConfig,
14157
+ isLoading,
14158
+ error
14159
+ } = useQuery8({
14160
+ // Country is part of the key so a region change refetches the region-aware
14161
+ // config. Omitted when undefined so callers that don't pass a country keep
14162
+ // sharing the base cache entry.
14163
+ queryKey: countryCode ? ["unifold", "projectConfig", publishableKey, countryCode, subdivisionCode ?? null] : ["unifold", "projectConfig", publishableKey],
14164
+ queryFn: () => getProjectConfig(publishableKey, countryCode ? { countryCode, subdivisionCode } : void 0),
14141
14165
  enabled,
14166
+ // Keep the previous (e.g. no-country) config visible while the region-aware
14167
+ // config refetches after the country resolves, so unrelated config-driven
14168
+ // UI doesn't flash back to defaults.
14169
+ placeholderData: keepPreviousData,
14142
14170
  staleTime: 1e3 * 60 * 30,
14143
14171
  refetchOnMount: true,
14144
14172
  refetchOnWindowFocus: true
14145
14173
  });
14146
- return { projectConfig, isLoading };
14174
+ return { projectConfig, isLoading, error: error ?? null };
14147
14175
  }
14148
14176
 
14149
14177
  // src/hooks/use-supported-deposit-tokens.ts
@@ -16219,50 +16247,29 @@ import {
16219
16247
  } from "@unifold/core";
16220
16248
 
16221
16249
  // src/hooks/use-allowed-country.ts
16222
- import { useQuery as useQuery13 } from "@tanstack/react-query";
16223
- import {
16224
- getIpAddress as getIpAddress2,
16225
- getProjectConfig as getProjectConfig2
16226
- } from "@unifold/core";
16227
16250
  function useAllowedCountry(publishableKey) {
16251
+ const { userIpInfo, isLoading: isIpLoading, error: ipError } = useUserIp();
16228
16252
  const {
16229
- data: ipData,
16230
- isLoading: isIpLoading,
16231
- error: ipError
16232
- } = useQuery13({
16233
- queryKey: ["unifold", "ipAddress"],
16234
- queryFn: () => getIpAddress2(),
16235
- refetchOnMount: false,
16236
- refetchOnReconnect: true,
16237
- refetchOnWindowFocus: false,
16238
- staleTime: 1e3 * 60 * 60,
16239
- // 1 hour
16240
- gcTime: 1e3 * 60 * 60 * 24
16241
- // 24 hours
16242
- });
16243
- const {
16244
- data: configData,
16253
+ projectConfig,
16245
16254
  isLoading: isConfigLoading,
16246
16255
  error: configError
16247
- } = useQuery13({
16248
- queryKey: ["unifold", "projectConfig", publishableKey],
16249
- queryFn: () => getProjectConfig2(publishableKey),
16250
- refetchOnMount: false,
16251
- refetchOnReconnect: true,
16252
- refetchOnWindowFocus: false,
16253
- staleTime: 1e3 * 60 * 5,
16254
- // 5 minutes
16255
- gcTime: 1e3 * 60 * 60
16256
- // 1 hour
16256
+ } = useProjectConfig({
16257
+ publishableKey,
16258
+ // Wait for the IP so we issue a single country-aware config request rather
16259
+ // than a country-less fetch followed by a country-aware refetch. Shares the
16260
+ // query key with DepositModal's useProjectConfig, so they dedupe.
16261
+ enabled: !isIpLoading,
16262
+ countryCode: userIpInfo?.alpha2,
16263
+ subdivisionCode: userIpInfo?.subdivisionCode ?? void 0
16257
16264
  });
16258
16265
  const isLoading = isIpLoading || isConfigLoading;
16259
16266
  const error = ipError || configError || null;
16267
+ const userSubdivision = userIpInfo?.subdivisionCode || userIpInfo?.state || "";
16260
16268
  let isAllowed = null;
16261
- if (ipData && configData) {
16262
- const blockedCodes = configData.blocked_country_codes || [];
16263
- const blockedSubdivisions = configData.blocked_country_subdivisions || [];
16264
- const userCountryUpper = ipData.alpha2.toUpperCase();
16265
- const userSubdivision = ipData.subdivision_code || ipData.state || "";
16269
+ if (userIpInfo && projectConfig) {
16270
+ const blockedCodes = projectConfig.blocked_country_codes || [];
16271
+ const blockedSubdivisions = projectConfig.blocked_country_subdivisions || [];
16272
+ const userCountryUpper = userIpInfo.alpha2.toUpperCase();
16266
16273
  const userSubdivisionUpper = userSubdivision.toUpperCase();
16267
16274
  const isCountryBlocked = blockedCodes.some((code) => code.toUpperCase() === userCountryUpper);
16268
16275
  const isSubdivisionBlocked = blockedSubdivisions.some((entry) => {
@@ -16271,19 +16278,18 @@ function useAllowedCountry(publishableKey) {
16271
16278
  });
16272
16279
  isAllowed = !isCountryBlocked && !isSubdivisionBlocked;
16273
16280
  }
16274
- const subdivisionCode = ipData?.subdivision_code || ipData?.state || "" || null;
16275
16281
  return {
16276
16282
  isAllowed,
16277
- alpha2: ipData?.alpha2 ?? null,
16278
- country: ipData?.country ?? null,
16279
- subdivisionCode,
16283
+ alpha2: userIpInfo?.alpha2 ?? null,
16284
+ country: userIpInfo?.country ?? null,
16285
+ subdivisionCode: userSubdivision || null,
16280
16286
  isLoading,
16281
16287
  error
16282
16288
  };
16283
16289
  }
16284
16290
 
16285
16291
  // src/hooks/use-address-validation.ts
16286
- import { useQuery as useQuery14 } from "@tanstack/react-query";
16292
+ import { useQuery as useQuery13 } from "@tanstack/react-query";
16287
16293
  import {
16288
16294
  verifyRecipientAddress
16289
16295
  } from "@unifold/core";
@@ -16297,7 +16303,7 @@ function useAddressValidation({
16297
16303
  refetchOnMount = false
16298
16304
  }) {
16299
16305
  const shouldValidate = enabled && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
16300
- const { data, isLoading, error } = useQuery14({
16306
+ const { data, isLoading, error } = useQuery13({
16301
16307
  queryKey: [
16302
16308
  "unifold",
16303
16309
  "addressValidation",
@@ -17659,7 +17665,7 @@ import {
17659
17665
  } from "@unifold/core";
17660
17666
 
17661
17667
  // src/hooks/use-hypercore-activation.ts
17662
- import { useQuery as useQuery15 } from "@tanstack/react-query";
17668
+ import { useQuery as useQuery14 } from "@tanstack/react-query";
17663
17669
  import { checkHypercoreActivation } from "@unifold/core";
17664
17670
 
17665
17671
  // src/lib/constants.ts
@@ -17678,7 +17684,7 @@ function useHypercoreActivation(params) {
17678
17684
  const recipient = recipientAddress?.trim() ?? "";
17679
17685
  const source = sourceAddress?.trim() ?? "";
17680
17686
  const hasAddresses = !!recipient && !!source;
17681
- const { data, isLoading } = useQuery15({
17687
+ const { data, isLoading } = useQuery14({
17682
17688
  queryKey: ["unifold", "hypercoreActivation", source, recipient, publishableKey],
17683
17689
  queryFn: () => checkHypercoreActivation(
17684
17690
  {
@@ -19207,7 +19213,7 @@ async function sendHypercoreEvmTransfer(params) {
19207
19213
  }
19208
19214
 
19209
19215
  // src/hooks/use-deposit-quote.ts
19210
- import { useQuery as useQuery16 } from "@tanstack/react-query";
19216
+ import { useQuery as useQuery15 } from "@tanstack/react-query";
19211
19217
  import { getDepositQuote } from "@unifold/core";
19212
19218
  function useDepositQuote(params) {
19213
19219
  const {
@@ -19234,7 +19240,7 @@ function useDepositQuote(params) {
19234
19240
  ...adjustForSlippage ? { adjust_for_slippage: true } : {},
19235
19241
  ...stablecoinParity ? { stablecoin_parity: true } : {}
19236
19242
  };
19237
- return useQuery16({
19243
+ return useQuery15({
19238
19244
  queryKey: [
19239
19245
  "unifold",
19240
19246
  "depositQuote",
@@ -19262,13 +19268,13 @@ function useDepositQuote(params) {
19262
19268
  }
19263
19269
 
19264
19270
  // src/hooks/use-external-wallets.ts
19265
- import { useQuery as useQuery17 } from "@tanstack/react-query";
19271
+ import { useQuery as useQuery16 } from "@tanstack/react-query";
19266
19272
  import { getExternalWallets } from "@unifold/core";
19267
19273
  function useExternalWallets({
19268
19274
  publishableKey,
19269
19275
  enabled = true
19270
19276
  }) {
19271
- const { data: wallets = [], isLoading } = useQuery17({
19277
+ const { data: wallets = [], isLoading } = useQuery16({
19272
19278
  queryKey: ["unifold", "external-wallets", publishableKey],
19273
19279
  queryFn: () => getExternalWallets(publishableKey).then((res) => res.data),
19274
19280
  enabled: enabled && !!publishableKey,
@@ -21401,116 +21407,131 @@ function WalletConnect({
21401
21407
  ] });
21402
21408
  }
21403
21409
  if (view === "select_wallet") {
21404
- return /* @__PURE__ */ jsxs56("div", { style: viewTransitionStyle, children: [
21405
- /* @__PURE__ */ jsx62(
21406
- DepositHeader,
21410
+ return (
21411
+ // Mobile: flex column that fills the full-height sheet so the wallet list
21412
+ // scrolls and the footer pins to the bottom. Desktop (sm:): content-sized.
21413
+ /* @__PURE__ */ jsxs56(
21414
+ "div",
21407
21415
  {
21408
- title: "Connect Wallet",
21409
- showBack: canGoBack,
21410
- onBack: handleBack,
21411
- onClose
21412
- }
21413
- ),
21414
- /* @__PURE__ */ jsxs56("div", { className: "uf-pb-4", children: [
21415
- /* @__PURE__ */ jsx62(
21416
- "p",
21417
- {
21418
- className: "uf-text-sm uf-text-center uf-pb-4",
21419
- style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
21420
- children: isMobile ? "Open this page in your wallet's app to connect" : "Select a wallet to connect"
21421
- }
21422
- ),
21423
- /* @__PURE__ */ jsx62("div", { className: "uf-space-y-2", style: { maxHeight: 330, overflowY: "auto" }, children: availableWallets.map((wallet) => {
21424
- const walletPlatformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
21425
- const showOpenInApp = isMobile && !wallet.isInstalled && wallet.supportsMobileBrowse !== false && walletPlatformAllowed;
21426
- const isPending = pendingMobileWallet?.id === wallet.id;
21427
- return /* @__PURE__ */ jsxs56(
21428
- "button",
21429
- {
21430
- onClick: () => void handleWalletClick(wallet),
21431
- disabled: isWalletConnecting || !!pendingMobileWallet,
21432
- className: "uf-w-full uf-transition-colors uf-p-3 uf-flex uf-items-center uf-justify-between hover:uf-opacity-90 disabled:uf-opacity-50",
21433
- style: {
21434
- backgroundColor: components.card.backgroundColor,
21435
- borderRadius: components.card.borderRadius,
21436
- border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
21437
- },
21438
- children: [
21439
- /* @__PURE__ */ jsxs56("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
21440
- WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ jsx62(
21441
- WalletIconWithNetwork,
21442
- {
21443
- WalletIcon: WALLET_ICONS3[wallet.id],
21444
- networks: wallet.networks,
21445
- size: 40,
21446
- className: "uf-rounded-lg"
21447
- }
21448
- ) : /* @__PURE__ */ jsx62("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
21449
- /* @__PURE__ */ jsxs56("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
21450
- /* @__PURE__ */ jsx62(
21451
- "div",
21452
- {
21453
- className: "uf-text-sm uf-font-medium",
21454
- style: { color: components.card.titleColor, fontFamily: fonts.medium },
21455
- children: wallet.name
21456
- }
21457
- ),
21458
- wallet.id === recentWalletId && /* @__PURE__ */ jsx62(
21459
- "span",
21460
- {
21461
- className: "uf-text-xs uf-px-2 uf-py-0.5 uf-rounded-full",
21462
- style: {
21463
- backgroundColor: colors2.primary + "20",
21464
- color: colors2.primary,
21465
- fontFamily: fonts.medium
21466
- },
21467
- children: "Last used"
21468
- }
21469
- )
21470
- ] })
21471
- ] }),
21472
- isPending ? /* @__PURE__ */ jsx62(
21473
- Loader210,
21474
- {
21475
- className: "uf-w-4 uf-h-4 uf-animate-spin",
21476
- style: { color: colors2.primary }
21477
- }
21478
- ) : wallet.isInstalled ? /* @__PURE__ */ jsx62(
21479
- "span",
21416
+ style: viewTransitionStyle,
21417
+ className: "uf-flex uf-min-h-0 uf-flex-1 uf-flex-col sm:uf-block",
21418
+ children: [
21419
+ /* @__PURE__ */ jsx62(
21420
+ DepositHeader,
21421
+ {
21422
+ title: "Connect Wallet",
21423
+ showBack: canGoBack,
21424
+ onBack: handleBack,
21425
+ onClose
21426
+ }
21427
+ ),
21428
+ /* @__PURE__ */ jsxs56("div", { className: "uf-pb-4 uf-flex uf-min-h-0 uf-flex-1 uf-flex-col sm:uf-block", children: [
21429
+ /* @__PURE__ */ jsx62(
21430
+ "p",
21431
+ {
21432
+ className: "uf-text-sm uf-text-center uf-pb-4",
21433
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
21434
+ children: isMobile ? "Open this page in your wallet's app to connect" : "Select a wallet to connect"
21435
+ }
21436
+ ),
21437
+ /* @__PURE__ */ jsx62("div", { className: "uf-space-y-2 uf-min-h-0 uf-flex-1 uf-overflow-y-auto sm:uf-flex-none sm:uf-max-h-[330px] [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: availableWallets.filter((wallet) => {
21438
+ if (!isMobile || wallet.isInstalled) return true;
21439
+ const platformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
21440
+ return wallet.supportsMobileBrowse !== false && platformAllowed;
21441
+ }).map((wallet) => {
21442
+ const walletPlatformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
21443
+ const showOpenInApp = isMobile && !wallet.isInstalled && wallet.supportsMobileBrowse !== false && walletPlatformAllowed;
21444
+ const isPending = pendingMobileWallet?.id === wallet.id;
21445
+ return /* @__PURE__ */ jsxs56(
21446
+ "button",
21480
21447
  {
21481
- className: "uf-text-xs uf-px-2 uf-py-1 uf-rounded-full",
21448
+ onClick: () => void handleWalletClick(wallet),
21449
+ disabled: isWalletConnecting || !!pendingMobileWallet,
21450
+ className: "uf-w-full uf-transition-colors uf-p-3 uf-flex uf-items-center uf-justify-between hover:uf-opacity-90 disabled:uf-opacity-50",
21482
21451
  style: {
21483
- backgroundColor: colors2.primary + "20",
21484
- color: colors2.primary,
21485
- fontFamily: fonts.medium
21452
+ backgroundColor: components.card.backgroundColor,
21453
+ borderRadius: components.card.borderRadius,
21454
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
21486
21455
  },
21487
- children: "Detected"
21488
- }
21489
- ) : /* @__PURE__ */ jsxs56("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
21490
- /* @__PURE__ */ jsx62(
21491
- "span",
21492
- {
21493
- className: "uf-text-xs",
21494
- style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
21495
- children: showOpenInApp ? "Open" : "Install"
21496
- }
21497
- ),
21498
- /* @__PURE__ */ jsx62(
21499
- ExternalLink4,
21500
- {
21501
- className: "uf-w-3 uf-h-3",
21502
- style: { color: colors2.foregroundMuted }
21503
- }
21504
- )
21505
- ] })
21506
- ]
21507
- },
21508
- wallet.id
21509
- );
21510
- }) }),
21511
- walletError && /* @__PURE__ */ jsx62("div", { className: "uf-text-center uf-text-sm uf-mt-4 uf-px-4", style: { color: "#ef4444" }, children: walletError })
21512
- ] })
21513
- ] });
21456
+ children: [
21457
+ /* @__PURE__ */ jsxs56("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
21458
+ WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ jsx62(
21459
+ WalletIconWithNetwork,
21460
+ {
21461
+ WalletIcon: WALLET_ICONS3[wallet.id],
21462
+ networks: wallet.networks,
21463
+ size: 40,
21464
+ className: "uf-rounded-lg"
21465
+ }
21466
+ ) : /* @__PURE__ */ jsx62("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
21467
+ /* @__PURE__ */ jsxs56("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
21468
+ /* @__PURE__ */ jsx62(
21469
+ "div",
21470
+ {
21471
+ className: "uf-text-sm uf-font-medium",
21472
+ style: { color: components.card.titleColor, fontFamily: fonts.medium },
21473
+ children: wallet.name
21474
+ }
21475
+ ),
21476
+ wallet.id === recentWalletId && /* @__PURE__ */ jsx62(
21477
+ "span",
21478
+ {
21479
+ className: "uf-text-xs uf-px-2 uf-py-0.5 uf-rounded-full",
21480
+ style: {
21481
+ backgroundColor: colors2.primary + "20",
21482
+ color: colors2.primary,
21483
+ fontFamily: fonts.medium
21484
+ },
21485
+ children: "Last used"
21486
+ }
21487
+ )
21488
+ ] })
21489
+ ] }),
21490
+ isPending ? /* @__PURE__ */ jsx62(
21491
+ Loader210,
21492
+ {
21493
+ className: "uf-w-4 uf-h-4 uf-animate-spin",
21494
+ style: { color: colors2.primary }
21495
+ }
21496
+ ) : wallet.isInstalled ? /* @__PURE__ */ jsx62(
21497
+ "span",
21498
+ {
21499
+ className: "uf-text-xs uf-px-2 uf-py-1 uf-rounded-full",
21500
+ style: {
21501
+ backgroundColor: colors2.primary + "20",
21502
+ color: colors2.primary,
21503
+ fontFamily: fonts.medium
21504
+ },
21505
+ children: "Detected"
21506
+ }
21507
+ ) : /* @__PURE__ */ jsxs56("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
21508
+ /* @__PURE__ */ jsx62(
21509
+ "span",
21510
+ {
21511
+ className: "uf-text-xs",
21512
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
21513
+ children: showOpenInApp ? "Open" : "Install"
21514
+ }
21515
+ ),
21516
+ /* @__PURE__ */ jsx62(
21517
+ ExternalLink4,
21518
+ {
21519
+ className: "uf-w-3 uf-h-3",
21520
+ style: { color: colors2.foregroundMuted }
21521
+ }
21522
+ )
21523
+ ] })
21524
+ ]
21525
+ },
21526
+ wallet.id
21527
+ );
21528
+ }) }),
21529
+ walletError && /* @__PURE__ */ jsx62("div", { className: "uf-text-center uf-text-sm uf-mt-4 uf-px-4", style: { color: "#ef4444" }, children: walletError })
21530
+ ] })
21531
+ ]
21532
+ }
21533
+ )
21534
+ );
21514
21535
  }
21515
21536
  const preConnectAccent = selectedWalletDef ? getWalletBrandColor(selectedWalletDef.id, mode) : void 0;
21516
21537
  const preConnectFg = preConnectAccent ? getContrastingTextColor(preConnectAccent) : void 0;
@@ -21902,7 +21923,9 @@ function DepositModal({
21902
21923
  applePayTitle = "Pay with Apple Pay",
21903
21924
  applePaySubTitle = "Instant",
21904
21925
  enableBankTransfer,
21905
- enableStripeLink = false,
21926
+ // No default: left undefined so the backend `stripe_link.enabled` can govern
21927
+ // (via the `??` chain in showStripeLink) once a dashboard toggle exists.
21928
+ enableStripeLink,
21906
21929
  userEmail,
21907
21930
  hideDepositFlowInfo = false,
21908
21931
  hideDisplayDescription = false,
@@ -21983,14 +22006,18 @@ function DepositModal({
21983
22006
  const [allExecutions, setAllExecutions] = useState40([]);
21984
22007
  const [selectedExecution, setSelectedExecution] = useState40(null);
21985
22008
  const [depositExecutions, setDepositExecutions] = useState40([]);
22009
+ const { userIpInfo, isLoading: isLoadingIp } = useUserIp();
21986
22010
  const { projectConfig } = useProjectConfig({
21987
22011
  publishableKey,
21988
- enabled: open
22012
+ enabled: open && !isLoadingIp,
22013
+ countryCode: userIpInfo?.alpha2,
22014
+ subdivisionCode: userIpInfo?.subdivisionCode ?? void 0
21989
22015
  });
21990
22016
  const showTransferCrypto = enableTransferCrypto ?? projectConfig?.transfer_crypto?.enabled ?? true;
21991
22017
  const showConnectWallet = enableConnectWallet ?? projectConfig?.connect_wallet?.enabled ?? true;
21992
22018
  const showPayWithExchange = enablePayWithExchange ?? projectConfig?.pay_with_exchange?.enabled ?? true;
21993
22019
  const showFiatOnramp = !projectConfig?.fiat_onramp?.is_hidden && (enableFiatOnramp ?? projectConfig?.fiat_onramp?.enabled ?? true);
22020
+ const showStripeLink = !projectConfig?.stripe_link?.is_hidden && (enableStripeLink ?? projectConfig?.stripe_link?.enabled ?? false);
21994
22021
  const showConnectExchange = enableConnectExchange ?? projectConfig?.connect_exchange?.enabled ?? true;
21995
22022
  const showCashApp = enableCashApp ?? projectConfig?.cash_app?.enabled ?? true;
21996
22023
  const showApplePay = enableApplePay ?? projectConfig?.apple_pay?.enabled ?? true;
@@ -22136,7 +22163,6 @@ function DepositModal({
22136
22163
  publishableKey,
22137
22164
  enabled: open && showPayWithExchange
22138
22165
  });
22139
- const { userIpInfo, isLoading: isLoadingIp } = useUserIp();
22140
22166
  const { providers: bankTransferProviders, isLoading: bankTransferProvidersLoading } = useBankTransferProviders({
22141
22167
  publishableKey,
22142
22168
  enabled: open && !!userIpInfo?.alpha2,
@@ -22314,6 +22340,12 @@ function DepositModal({
22314
22340
  const [cashAppView, setCashAppView] = useState40("amount");
22315
22341
  const [stripeLinkStep, setStripeLinkStep] = useState40("amount");
22316
22342
  const stripeLinkBackRef = useRef12(null);
22343
+ useEffect34(() => {
22344
+ if (view === "stripe_link" && !showStripeLink && effectiveInitialScreen === "main") {
22345
+ setView("main");
22346
+ setStripeLinkStep("amount");
22347
+ }
22348
+ }, [view, showStripeLink, effectiveInitialScreen]);
22317
22349
  const [cashAppAmount, setCashAppAmount] = useState40("");
22318
22350
  const [applePayView, setApplePayView] = useState40("email_input");
22319
22351
  const applePayHandleRef = useRef12(null);
@@ -22538,7 +22570,7 @@ function DepositModal({
22538
22570
  },
22539
22571
  "cashapp"
22540
22572
  ) : null;
22541
- const stripeLinkMenuButton = enableStripeLink ? /* @__PURE__ */ jsx63(
22573
+ const stripeLinkMenuButton = showStripeLink ? /* @__PURE__ */ jsx63(
22542
22574
  StripeLinkButton,
22543
22575
  {
22544
22576
  onClick: () => setView("stripe_link"),
@@ -22586,11 +22618,13 @@ function DepositModal({
22586
22618
  connectExchangeMenuButton
22587
22619
  ].filter(Boolean);
22588
22620
  const cashMenuButtons = [
22621
+ // Stripe "Pay with Link" is intentionally listed first so it always sits
22622
+ // above "Deposit with Card".
22623
+ stripeLinkMenuButton,
22589
22624
  depositWithCardMenuButton,
22590
22625
  applePayMenuButton,
22591
22626
  cashAppMenuButton,
22592
- bankTransferMenuButton,
22593
- stripeLinkMenuButton
22627
+ bankTransferMenuButton
22594
22628
  ].filter(Boolean);
22595
22629
  const depositTabs = [
22596
22630
  { id: "crypto", label: "Use Crypto", icon: Bitcoin, buttons: cryptoMenuButtons },
@@ -22685,13 +22719,13 @@ function DepositModal({
22685
22719
  const stackedOptions = [
22686
22720
  transferCryptoMenuButton,
22687
22721
  connectWalletMenuButton,
22722
+ stripeLinkMenuButton,
22688
22723
  depositWithCardMenuButton,
22689
22724
  applePayMenuButton,
22690
22725
  payWithExchangeMenuButton,
22691
22726
  connectExchangeMenuButton,
22692
22727
  cashAppMenuButton,
22693
22728
  bankTransferMenuButton,
22694
- stripeLinkMenuButton,
22695
22729
  depositTrackerMenuButton
22696
22730
  ].filter(Boolean);
22697
22731
  return renderScrollableOptions(stackedOptions);
@@ -22707,410 +22741,452 @@ function DepositModal({
22707
22741
  {
22708
22742
  ref: hideOverlay ? containerCallbackRef : void 0,
22709
22743
  hideOverlay,
22710
- className: `sm:uf-max-w-[400px] uf-border-secondary uf-text-foreground uf-gap-0 [&>button]:uf-hidden ${hideOverlay ? `uf-p-6 uf-overflow-hidden ${themeClass}` : `uf-p-0 uf-overflow-visible ${view === "main" ? "!uf-top-auto !uf-h-auto !uf-max-h-[85vh] sm:!uf-max-h-none sm:!uf-top-[50%]" : "!uf-top-0 !uf-h-full sm:!uf-h-auto sm:!uf-top-[50%]"} ${themeClass}`}`,
22744
+ className: `sm:uf-max-w-[400px] uf-border-secondary uf-text-foreground uf-gap-0 [&>button]:uf-hidden ${hideOverlay ? `uf-p-6 uf-overflow-hidden ${themeClass}` : `uf-p-0 uf-overflow-visible ${view === "main" ? "!uf-top-auto !uf-h-auto !uf-max-h-[85vh] sm:!uf-max-h-none sm:!uf-top-[50%]" : "!uf-top-0 !uf-h-full sm:!uf-h-auto sm:!uf-top-[50%]"} ${// wallet_connect fills the full-height mobile sheet. DialogContent
22745
+ // is a grid, and its single auto row only *grows* to fill free
22746
+ // space (align-content: stretch) — it never shrinks below content,
22747
+ // so a long wallet list would balloon the row past the viewport and
22748
+ // push the footer off-screen instead of scrolling. Clamp the row to
22749
+ // the modal height with minmax(0,1fr) so the inner overflow-y-auto
22750
+ // list scrolls with the footer pinned. Reset to content-sized on
22751
+ // desktop (sm:) where the modal is auto-height and centered.
22752
+ view === "wallet_connect" ? "[grid-template-rows:minmax(0,1fr)] sm:[grid-template-rows:none]" : ""} ${themeClass}`}`,
22711
22753
  style: { backgroundColor: colors2.background },
22712
22754
  onPointerDownOutside: (e) => e.preventDefault(),
22713
22755
  onInteractOutside: (e) => e.preventDefault(),
22714
22756
  children: [
22715
22757
  /* @__PURE__ */ jsx63(DialogTitle, { className: "uf-sr-only", children: modalTitle || "Deposit" }),
22716
- /* @__PURE__ */ jsx63(ThemeStyleInjector, { children: view === "main" ? /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-min-h-0 uf-max-h-full", children: [
22717
- /* @__PURE__ */ jsx63("div", { className: "uf-flex-shrink-0", children: /* @__PURE__ */ jsx63(
22718
- DepositHeader,
22719
- {
22720
- title: modalTitle || "Deposit",
22721
- showClose: !hideOverlay,
22722
- onClose: handleClose,
22723
- showBalance: showBalanceHeader,
22724
- balanceAddress: recipientAddress,
22725
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
22726
- balanceChainId: destinationChainId,
22727
- balanceTokenAddress: destinationTokenAddress,
22728
- projectName: projectConfig?.project_name,
22729
- publishableKey
22730
- }
22731
- ) }),
22732
- renderMainMenuBody(),
22733
- /* @__PURE__ */ jsx63("div", { className: "uf-flex-shrink-0", children: depositPoweredByFooter })
22734
- ] }) : view === "transfer" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
22735
- /* @__PURE__ */ jsx63(
22736
- DepositHeader,
22737
- {
22738
- title: transferCryptoTitle,
22739
- showBack: showBackTransfer,
22740
- onBack: handleBack,
22741
- onClose: handleClose,
22742
- showBalance: showBalanceHeader,
22743
- balanceAddress: recipientAddress,
22744
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
22745
- balanceChainId: destinationChainId,
22746
- balanceTokenAddress: destinationTokenAddress,
22747
- projectName: projectConfig?.project_name,
22748
- publishableKey
22749
- }
22750
- ),
22751
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
22752
- standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ jsx63("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ jsx63(
22753
- TransferCryptoSingleInput,
22754
- {
22755
- userId,
22756
- publishableKey,
22757
- recipientAddress,
22758
- destinationChainType,
22759
- destinationChainId,
22760
- destinationTokenAddress,
22761
- defaultSourceChainType,
22762
- defaultSourceChainId,
22763
- defaultSourceTokenAddress,
22764
- defaultSourceSymbol,
22765
- depositConfirmationMode,
22766
- onExecutionsChange: setDepositExecutions,
22767
- onDepositSuccess: onDepositSuccessFor("transfer"),
22768
- onDepositError: onDepositErrorFor("transfer"),
22769
- wallets
22770
- }
22771
- ) : /* @__PURE__ */ jsx63(
22772
- TransferCryptoDoubleInput,
22773
- {
22774
- userId,
22775
- publishableKey,
22776
- recipientAddress,
22777
- destinationChainType,
22778
- destinationChainId,
22779
- destinationTokenAddress,
22780
- defaultSourceChainType,
22781
- defaultSourceChainId,
22782
- defaultSourceTokenAddress,
22783
- defaultSourceSymbol,
22784
- depositConfirmationMode,
22785
- onExecutionsChange: setDepositExecutions,
22786
- onDepositSuccess: onDepositSuccessFor("transfer"),
22787
- onDepositError: onDepositErrorFor("transfer"),
22788
- wallets
22789
- }
22790
- ),
22791
- depositPoweredByFooter
22792
- ] })
22793
- ] }) : view === "tracker" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
22794
- /* @__PURE__ */ jsx63(
22795
- DepositHeader,
22796
- {
22797
- title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
22798
- showBack: showBackTracker,
22799
- onBack: handleBack,
22800
- onClose: handleClose
22801
- }
22802
- ),
22803
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
22804
- /* @__PURE__ */ jsx63("div", { className: "uf-h-[460px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: selectedExecution ? /* @__PURE__ */ jsx63(DepositDetailContent, { execution: selectedExecution }) : /* @__PURE__ */ jsx63("div", { className: "uf-space-y-2 uf-pb-8", children: allExecutions.length === 0 ? /* @__PURE__ */ jsx63("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ jsx63(
22805
- "div",
22806
- {
22807
- className: "uf-text-sm",
22808
- style: {
22809
- color: components.container.subtitleColor,
22810
- fontFamily: fonts.regular
22811
- },
22812
- children: "No deposits yet"
22813
- }
22814
- ) }) : allExecutions.map((execution) => /* @__PURE__ */ jsx63(
22815
- DepositExecutionItem,
22816
- {
22817
- execution,
22818
- onClick: () => setSelectedExecution(execution)
22819
- },
22820
- execution.id
22821
- )) }) }),
22822
- depositPoweredByFooter
22823
- ] })
22824
- ] }) : view === "card" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
22825
- /* @__PURE__ */ jsx63(
22826
- DepositHeader,
22827
- {
22828
- title: cardView === "quotes" ? t8.quotes : depositWithCardTitle,
22829
- showBack: showBackCard,
22830
- onBack: handleBack,
22831
- onClose: handleClose,
22832
- badge: cardView === "quotes" ? { count: quotesCount } : void 0,
22833
- showBalance: showBalanceHeader,
22834
- balanceAddress: recipientAddress,
22835
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
22836
- balanceChainId: destinationChainId,
22837
- balanceTokenAddress: destinationTokenAddress,
22838
- projectName: projectConfig?.project_name,
22839
- publishableKey
22840
- }
22841
- ),
22842
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
22843
- standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ jsx63("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : !showFiatOnramp ? (
22844
- // Fiat on-ramp resolved hidden/disabled after a direct open
22845
- // (e.g. platform `is_hidden` for a Stripe Link-only project).
22846
- // Show a geo-restriction screen rather than the card UI so the
22847
- // hard-hide is honoured without a flash of "Pay with Card".
22848
- /* @__PURE__ */ jsx63(GeoRestrictionScreen, { methodName: "Card" })
22849
- ) : /* @__PURE__ */ jsx63(
22850
- BuyWithCard,
22851
- {
22852
- userId,
22853
- publishableKey,
22854
- view: cardView,
22855
- onViewChange: handleCardViewChange,
22856
- destinationTokenSymbol,
22857
- recipientAddress,
22858
- destinationChainType,
22859
- destinationChainId,
22860
- destinationTokenAddress,
22861
- onDepositSuccess: onDepositSuccessFor("card"),
22862
- onDepositError: onDepositErrorFor("card"),
22863
- onEvent,
22864
- themeClass,
22865
- wallets,
22866
- assetCdnUrl: projectConfig?.asset_cdn_url,
22867
- hideDepositFlowInfo,
22868
- hideDisplayDescription
22869
- }
22870
- ),
22871
- depositPoweredByFooter
22872
- ] })
22873
- ] }) : view === "exchange" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
22874
- /* @__PURE__ */ jsx63(
22875
- DepositHeader,
22876
- {
22877
- title: payWithExchangeTitle,
22878
- showBack: exchangeView === "pending" || sessionOpenedFromMenu,
22879
- onBack: handleBack,
22880
- onClose: handleClose
22881
- }
22882
- ),
22883
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
22884
- /* @__PURE__ */ jsx63(
22885
- PayWithExchange,
22886
- {
22887
- userId,
22888
- publishableKey,
22889
- exchanges,
22890
- view: exchangeView,
22891
- onViewChange: setExchangeView,
22892
- destinationTokenSymbol,
22893
- recipientAddress,
22894
- destinationChainType,
22895
- destinationChainId,
22896
- destinationTokenAddress,
22897
- onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
22898
- onDepositError: onDepositErrorFor("pay_with_exchange"),
22899
- wallets,
22900
- defaultToken: defaultToken ?? null
22901
- }
22902
- ),
22903
- depositPoweredByFooter
22904
- ] })
22905
- ] }) : view === "coinbase_connect" ? /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
22906
- /* @__PURE__ */ jsx63(
22907
- CoinbaseConnect,
22908
- {
22909
- publishableKey,
22910
- userId,
22911
- wallets,
22912
- recipientAddress,
22913
- destinationTokenAddress: destinationTokenAddress ?? "",
22914
- destinationChainId: destinationChainId ?? "",
22915
- destinationChainType: destinationChainType ?? "",
22916
- onDepositSuccess: onDepositSuccessFor("exchange_connect"),
22917
- onDepositError: onDepositErrorFor("exchange_connect"),
22918
- onTransferError: (error) => {
22919
- onDepositErrorFor("exchange_connect")?.({
22920
- message: error.message,
22921
- error
22922
- });
22923
- },
22924
- onBack: handleBack,
22925
- onClose: handleClose,
22926
- onDisconnect: handleExchangeDisconnect,
22927
- skipToHoldings: coinbaseSkipToHoldings,
22928
- canGoBack: sessionOpenedFromMenu,
22929
- onExecutionsChange: setDepositExecutions,
22930
- defaultSourceChainType,
22931
- defaultSourceChainId,
22932
- defaultSourceTokenAddress,
22933
- defaultSourceSymbol
22934
- }
22935
- ),
22936
- depositPoweredByFooter
22937
- ] }) : view === "wallet_connect" ? /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
22938
- /* @__PURE__ */ jsx63(
22939
- WalletConnect,
22940
- {
22941
- walletInfo: browserWalletInfo ?? void 0,
22942
- depositWallet: browserWalletInfo?.depositWallet ?? void 0,
22943
- wallets,
22944
- userId,
22945
- publishableKey,
22946
- assetCdnUrl: projectConfig?.asset_cdn_url,
22947
- projectName: projectConfig?.project_name,
22948
- onError: (error) => {
22949
- onDepositErrorFor("wallet_connect")?.({
22950
- message: error.message,
22951
- error
22952
- });
22953
- },
22954
- onDepositSuccess: onDepositSuccessFor("wallet_connect"),
22955
- onDepositError: onDepositErrorFor("wallet_connect"),
22956
- amountQuickSelect: browserWalletAmountQuickSelect,
22957
- onWalletDisconnect: handleWalletDisconnect,
22958
- onWalletConnected: (info, dw) => {
22959
- setBrowserWalletInfo({ ...info, depositWallet: dw });
22960
- setStoredWalletState(info.type);
22961
- setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
22962
- },
22963
- onBack: handleBack,
22964
- onClose: handleClose,
22965
- defaultSourceChainType,
22966
- defaultSourceChainId,
22967
- defaultSourceTokenAddress,
22968
- defaultSourceSymbol,
22969
- canGoBack: sessionOpenedFromMenu,
22970
- depositWalletsLoading: walletsLoading
22971
- }
22972
- ),
22973
- depositPoweredByFooter
22974
- ] }) : view === "bank_transfer" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
22975
- /* @__PURE__ */ jsx63(
22976
- DepositHeader,
22977
- {
22978
- title: t8.bankTransfer.title,
22979
- showBack: bankTransferView !== "providers" || sessionOpenedFromMenu,
22980
- onBack: handleBack,
22981
- onClose: handleClose
22982
- }
22983
- ),
22984
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
22985
- bankTransferProvidersLoading ? /* @__PURE__ */ jsx63(SkeletonButton, { variant: "with-icons" }) : !hasEnabledBankTransferProvider ? /* @__PURE__ */ jsx63(GeoRestrictionScreen, { methodName: "Bank Transfer" }) : /* @__PURE__ */ jsx63(
22986
- BankTransfer,
22987
- {
22988
- userId,
22989
- publishableKey,
22990
- view: bankTransferView,
22991
- onViewChange: setBankTransferView,
22992
- recipientAddress,
22993
- destinationChainType,
22994
- destinationChainId,
22995
- destinationTokenAddress,
22996
- destinationTokenSymbol,
22997
- wallets,
22998
- defaultToken: defaultToken ?? null,
22999
- assetCdnUrl: projectConfig?.asset_cdn_url,
23000
- onEvent,
23001
- onDepositSuccess,
23002
- onDepositError
23003
- }
23004
- ),
23005
- depositPoweredByFooter
23006
- ] })
23007
- ] }) : view === "stripe_link" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
23008
- /* @__PURE__ */ jsx63(
23009
- DepositHeader,
23010
- {
23011
- title: "Deposit with Link",
23012
- showBack: stripeLinkStep !== "checkout" && stripeLinkStep !== "success",
23013
- onBack: handleBack,
23014
- showClose: stripeLinkStep !== "checkout",
23015
- onClose: handleClose
23016
- }
23017
- ),
23018
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
23019
- /* @__PURE__ */ jsx63(
23020
- PayWithStripeLink,
23021
- {
23022
- userId,
23023
- publishableKey,
23024
- recipientAddress,
23025
- destinationChainType,
23026
- destinationChainId,
23027
- destinationTokenAddress,
23028
- wallets,
23029
- email: userEmail,
23030
- iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/link.svg` : void 0,
23031
- step: stripeLinkStep,
23032
- onStepChange: setStripeLinkStep,
23033
- backHandlerRef: stripeLinkBackRef,
23034
- onDepositSuccess,
23035
- onDepositError
23036
- }
23037
- ),
23038
- depositPoweredByFooter
23039
- ] })
23040
- ] }) : view === "cashapp" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
23041
- /* @__PURE__ */ jsx63(
23042
- DepositHeader,
23043
- {
23044
- title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
23045
- showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
23046
- onBack: handleBack,
23047
- onClose: handleClose
23048
- }
23049
- ),
23050
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
23051
- /* @__PURE__ */ jsx63(
23052
- PayWithCashApp,
23053
- {
23054
- userId,
23055
- publishableKey,
23056
- recipientAddress,
23057
- destinationChainType,
23058
- destinationChainId,
23059
- destinationTokenAddress,
23060
- cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
23061
- view: cashAppView,
23062
- onViewChange: setCashAppView,
23063
- onAmountChange: setCashAppAmount,
23064
- onEvent,
23065
- onDepositSuccess: onDepositSuccessFor("cashapp"),
23066
- onDepositError: onDepositErrorFor("cashapp"),
23067
- wallets
23068
- }
23069
- ),
23070
- depositPoweredByFooter
23071
- ] })
23072
- ] }) : view === "apple_pay" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
23073
- /* @__PURE__ */ jsx63(
23074
- DepositHeader,
23075
- {
23076
- title: applePayHeaderTitle,
23077
- showBack: applePayShowBack,
23078
- onBack: () => {
23079
- const handled = applePayHandleRef.current?.requestBack() ?? false;
23080
- if (!handled) handleBack();
23081
- },
23082
- onClose: handleClose
23083
- }
23084
- ),
23085
- /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
23086
- applePayProvidersLoading ? /* @__PURE__ */ jsx63(SkeletonButton, { variant: "with-icons" }) : !hasEnabledApplePayProvider ? /* @__PURE__ */ jsx63(GeoRestrictionScreen, { methodName: "Apple Pay" }) : /* @__PURE__ */ jsx63(
23087
- BuyWithApplePay,
23088
- {
23089
- ref: applePayHandleRef,
23090
- userId,
23091
- publishableKey,
23092
- destinationChainType,
23093
- destinationChainId,
23094
- destinationTokenAddress,
23095
- userEmail,
23096
- wallets,
23097
- onViewChange: setApplePayView,
23098
- onEvent,
23099
- onDepositSuccess: onDepositSuccessFor("apple_pay"),
23100
- onDepositError: onDepositErrorFor("apple_pay"),
23101
- exitLabel: sessionOpenedFromMenu ? "Return" : "Close",
23102
- onExit: () => {
23103
- if (sessionOpenedFromMenu) {
23104
- setView("main");
23105
- } else {
23106
- handleClose();
22758
+ /* @__PURE__ */ jsx63(
22759
+ ThemeStyleInjector,
22760
+ {
22761
+ className: view === "wallet_connect" ? "uf-flex uf-min-h-0 uf-flex-col" : void 0,
22762
+ children: view === "main" ? /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-min-h-0 uf-max-h-full", children: [
22763
+ /* @__PURE__ */ jsx63("div", { className: "uf-flex-shrink-0", children: /* @__PURE__ */ jsx63(
22764
+ DepositHeader,
22765
+ {
22766
+ title: modalTitle || "Deposit",
22767
+ showClose: !hideOverlay,
22768
+ onClose: handleClose,
22769
+ showBalance: showBalanceHeader,
22770
+ balanceAddress: recipientAddress,
22771
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
22772
+ balanceChainId: destinationChainId,
22773
+ balanceTokenAddress: destinationTokenAddress,
22774
+ projectName: projectConfig?.project_name,
22775
+ publishableKey
22776
+ }
22777
+ ) }),
22778
+ renderMainMenuBody(),
22779
+ /* @__PURE__ */ jsx63("div", { className: "uf-flex-shrink-0", children: depositPoweredByFooter })
22780
+ ] }) : view === "transfer" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
22781
+ /* @__PURE__ */ jsx63(
22782
+ DepositHeader,
22783
+ {
22784
+ title: transferCryptoTitle,
22785
+ showBack: showBackTransfer,
22786
+ onBack: handleBack,
22787
+ onClose: handleClose,
22788
+ showBalance: showBalanceHeader,
22789
+ balanceAddress: recipientAddress,
22790
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
22791
+ balanceChainId: destinationChainId,
22792
+ balanceTokenAddress: destinationTokenAddress,
22793
+ projectName: projectConfig?.project_name,
22794
+ publishableKey
22795
+ }
22796
+ ),
22797
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
22798
+ standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ jsx63("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ jsx63(
22799
+ TransferCryptoSingleInput,
22800
+ {
22801
+ userId,
22802
+ publishableKey,
22803
+ recipientAddress,
22804
+ destinationChainType,
22805
+ destinationChainId,
22806
+ destinationTokenAddress,
22807
+ defaultSourceChainType,
22808
+ defaultSourceChainId,
22809
+ defaultSourceTokenAddress,
22810
+ defaultSourceSymbol,
22811
+ depositConfirmationMode,
22812
+ onExecutionsChange: setDepositExecutions,
22813
+ onDepositSuccess: onDepositSuccessFor("transfer"),
22814
+ onDepositError: onDepositErrorFor("transfer"),
22815
+ wallets
22816
+ }
22817
+ ) : /* @__PURE__ */ jsx63(
22818
+ TransferCryptoDoubleInput,
22819
+ {
22820
+ userId,
22821
+ publishableKey,
22822
+ recipientAddress,
22823
+ destinationChainType,
22824
+ destinationChainId,
22825
+ destinationTokenAddress,
22826
+ defaultSourceChainType,
22827
+ defaultSourceChainId,
22828
+ defaultSourceTokenAddress,
22829
+ defaultSourceSymbol,
22830
+ depositConfirmationMode,
22831
+ onExecutionsChange: setDepositExecutions,
22832
+ onDepositSuccess: onDepositSuccessFor("transfer"),
22833
+ onDepositError: onDepositErrorFor("transfer"),
22834
+ wallets
23107
22835
  }
22836
+ ),
22837
+ depositPoweredByFooter
22838
+ ] })
22839
+ ] }) : view === "tracker" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
22840
+ /* @__PURE__ */ jsx63(
22841
+ DepositHeader,
22842
+ {
22843
+ title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
22844
+ showBack: showBackTracker,
22845
+ onBack: handleBack,
22846
+ onClose: handleClose
23108
22847
  }
23109
- }
23110
- ),
23111
- depositPoweredByFooter
23112
- ] })
23113
- ] }) : null })
22848
+ ),
22849
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
22850
+ /* @__PURE__ */ jsx63("div", { className: "uf-h-[460px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: selectedExecution ? /* @__PURE__ */ jsx63(DepositDetailContent, { execution: selectedExecution }) : /* @__PURE__ */ jsx63("div", { className: "uf-space-y-2 uf-pb-8", children: allExecutions.length === 0 ? /* @__PURE__ */ jsx63("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ jsx63(
22851
+ "div",
22852
+ {
22853
+ className: "uf-text-sm",
22854
+ style: {
22855
+ color: components.container.subtitleColor,
22856
+ fontFamily: fonts.regular
22857
+ },
22858
+ children: "No deposits yet"
22859
+ }
22860
+ ) }) : allExecutions.map((execution) => /* @__PURE__ */ jsx63(
22861
+ DepositExecutionItem,
22862
+ {
22863
+ execution,
22864
+ onClick: () => setSelectedExecution(execution)
22865
+ },
22866
+ execution.id
22867
+ )) }) }),
22868
+ depositPoweredByFooter
22869
+ ] })
22870
+ ] }) : view === "card" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
22871
+ /* @__PURE__ */ jsx63(
22872
+ DepositHeader,
22873
+ {
22874
+ title: cardView === "quotes" ? t8.quotes : depositWithCardTitle,
22875
+ showBack: showBackCard,
22876
+ onBack: handleBack,
22877
+ onClose: handleClose,
22878
+ badge: cardView === "quotes" ? { count: quotesCount } : void 0,
22879
+ showBalance: showBalanceHeader,
22880
+ balanceAddress: recipientAddress,
22881
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
22882
+ balanceChainId: destinationChainId,
22883
+ balanceTokenAddress: destinationTokenAddress,
22884
+ projectName: projectConfig?.project_name,
22885
+ publishableKey
22886
+ }
22887
+ ),
22888
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
22889
+ standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ jsx63("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : !showFiatOnramp ? (
22890
+ // Fiat on-ramp resolved hidden/disabled after a direct open
22891
+ // (e.g. platform `is_hidden` for a Stripe Link-only project).
22892
+ // Show a geo-restriction screen rather than the card UI so the
22893
+ // hard-hide is honoured without a flash of "Pay with Card".
22894
+ /* @__PURE__ */ jsx63(GeoRestrictionScreen, { methodName: "Card" })
22895
+ ) : /* @__PURE__ */ jsx63(
22896
+ BuyWithCard,
22897
+ {
22898
+ userId,
22899
+ publishableKey,
22900
+ view: cardView,
22901
+ onViewChange: handleCardViewChange,
22902
+ destinationTokenSymbol,
22903
+ recipientAddress,
22904
+ destinationChainType,
22905
+ destinationChainId,
22906
+ destinationTokenAddress,
22907
+ onDepositSuccess: onDepositSuccessFor("card"),
22908
+ onDepositError: onDepositErrorFor("card"),
22909
+ onEvent,
22910
+ themeClass,
22911
+ wallets,
22912
+ assetCdnUrl: projectConfig?.asset_cdn_url,
22913
+ hideDepositFlowInfo,
22914
+ hideDisplayDescription
22915
+ }
22916
+ ),
22917
+ depositPoweredByFooter
22918
+ ] })
22919
+ ] }) : view === "exchange" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
22920
+ /* @__PURE__ */ jsx63(
22921
+ DepositHeader,
22922
+ {
22923
+ title: payWithExchangeTitle,
22924
+ showBack: exchangeView === "pending" || sessionOpenedFromMenu,
22925
+ onBack: handleBack,
22926
+ onClose: handleClose
22927
+ }
22928
+ ),
22929
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
22930
+ /* @__PURE__ */ jsx63(
22931
+ PayWithExchange,
22932
+ {
22933
+ userId,
22934
+ publishableKey,
22935
+ exchanges,
22936
+ view: exchangeView,
22937
+ onViewChange: setExchangeView,
22938
+ destinationTokenSymbol,
22939
+ recipientAddress,
22940
+ destinationChainType,
22941
+ destinationChainId,
22942
+ destinationTokenAddress,
22943
+ onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
22944
+ onDepositError: onDepositErrorFor("pay_with_exchange"),
22945
+ wallets,
22946
+ defaultToken: defaultToken ?? null
22947
+ }
22948
+ ),
22949
+ depositPoweredByFooter
22950
+ ] })
22951
+ ] }) : view === "coinbase_connect" ? /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
22952
+ /* @__PURE__ */ jsx63(
22953
+ CoinbaseConnect,
22954
+ {
22955
+ publishableKey,
22956
+ userId,
22957
+ wallets,
22958
+ recipientAddress,
22959
+ destinationTokenAddress: destinationTokenAddress ?? "",
22960
+ destinationChainId: destinationChainId ?? "",
22961
+ destinationChainType: destinationChainType ?? "",
22962
+ onDepositSuccess: onDepositSuccessFor("exchange_connect"),
22963
+ onDepositError: onDepositErrorFor("exchange_connect"),
22964
+ onTransferError: (error) => {
22965
+ onDepositErrorFor("exchange_connect")?.({
22966
+ message: error.message,
22967
+ error
22968
+ });
22969
+ },
22970
+ onBack: handleBack,
22971
+ onClose: handleClose,
22972
+ onDisconnect: handleExchangeDisconnect,
22973
+ skipToHoldings: coinbaseSkipToHoldings,
22974
+ canGoBack: sessionOpenedFromMenu,
22975
+ onExecutionsChange: setDepositExecutions,
22976
+ defaultSourceChainType,
22977
+ defaultSourceChainId,
22978
+ defaultSourceTokenAddress,
22979
+ defaultSourceSymbol
22980
+ }
22981
+ ),
22982
+ depositPoweredByFooter
22983
+ ] }) : view === "wallet_connect" ? (
22984
+ // Mobile: flex-fill the full-height dialog body so the wallet list
22985
+ // can grow and scroll, with the footer pinned to the bottom.
22986
+ // Desktop (sm:): stays content-sized.
22987
+ /* @__PURE__ */ jsxs57(
22988
+ "div",
22989
+ {
22990
+ className: "uf-flex uf-flex-col uf-gap-1.5 uf-min-h-0 uf-flex-1 sm:uf-flex-none",
22991
+ children: [
22992
+ /* @__PURE__ */ jsx63(
22993
+ WalletConnect,
22994
+ {
22995
+ walletInfo: browserWalletInfo ?? void 0,
22996
+ depositWallet: browserWalletInfo?.depositWallet ?? void 0,
22997
+ wallets,
22998
+ userId,
22999
+ publishableKey,
23000
+ assetCdnUrl: projectConfig?.asset_cdn_url,
23001
+ projectName: projectConfig?.project_name,
23002
+ onError: (error) => {
23003
+ onDepositErrorFor("wallet_connect")?.({
23004
+ message: error.message,
23005
+ error
23006
+ });
23007
+ },
23008
+ onDepositSuccess: onDepositSuccessFor("wallet_connect"),
23009
+ onDepositError: onDepositErrorFor("wallet_connect"),
23010
+ amountQuickSelect: browserWalletAmountQuickSelect,
23011
+ onWalletDisconnect: handleWalletDisconnect,
23012
+ onWalletConnected: (info, dw) => {
23013
+ setBrowserWalletInfo({ ...info, depositWallet: dw });
23014
+ setStoredWalletState(info.type);
23015
+ setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
23016
+ },
23017
+ onBack: handleBack,
23018
+ onClose: handleClose,
23019
+ defaultSourceChainType,
23020
+ defaultSourceChainId,
23021
+ defaultSourceTokenAddress,
23022
+ defaultSourceSymbol,
23023
+ canGoBack: sessionOpenedFromMenu,
23024
+ depositWalletsLoading: walletsLoading
23025
+ }
23026
+ ),
23027
+ depositPoweredByFooter
23028
+ ]
23029
+ }
23030
+ )
23031
+ ) : view === "bank_transfer" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
23032
+ /* @__PURE__ */ jsx63(
23033
+ DepositHeader,
23034
+ {
23035
+ title: t8.bankTransfer.title,
23036
+ showBack: bankTransferView !== "providers" || sessionOpenedFromMenu,
23037
+ onBack: handleBack,
23038
+ onClose: handleClose
23039
+ }
23040
+ ),
23041
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
23042
+ bankTransferProvidersLoading ? /* @__PURE__ */ jsx63(SkeletonButton, { variant: "with-icons" }) : !hasEnabledBankTransferProvider ? /* @__PURE__ */ jsx63(GeoRestrictionScreen, { methodName: "Bank Transfer" }) : /* @__PURE__ */ jsx63(
23043
+ BankTransfer,
23044
+ {
23045
+ userId,
23046
+ publishableKey,
23047
+ view: bankTransferView,
23048
+ onViewChange: setBankTransferView,
23049
+ recipientAddress,
23050
+ destinationChainType,
23051
+ destinationChainId,
23052
+ destinationTokenAddress,
23053
+ destinationTokenSymbol,
23054
+ wallets,
23055
+ defaultToken: defaultToken ?? null,
23056
+ assetCdnUrl: projectConfig?.asset_cdn_url,
23057
+ onEvent,
23058
+ onDepositSuccess,
23059
+ onDepositError
23060
+ }
23061
+ ),
23062
+ depositPoweredByFooter
23063
+ ] })
23064
+ ] }) : view === "stripe_link" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
23065
+ /* @__PURE__ */ jsx63(
23066
+ DepositHeader,
23067
+ {
23068
+ title: "Deposit with Link",
23069
+ showBack: stripeLinkStep !== "checkout" && stripeLinkStep !== "success",
23070
+ onBack: handleBack,
23071
+ showClose: stripeLinkStep !== "checkout",
23072
+ onClose: handleClose
23073
+ }
23074
+ ),
23075
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
23076
+ isLoadingIp ? (
23077
+ // Hold the geo decision until IP resolves so we don't mount
23078
+ // PayWithStripeLink (which kicks off config/OAuth work) for a
23079
+ // deep-link user who turns out to be outside the US.
23080
+ /* @__PURE__ */ jsx63(SkeletonButton, { variant: "with-icons" })
23081
+ ) : !showStripeLink ? (
23082
+ // Stripe Link's crypto on-ramp is US-only. On a direct open
23083
+ // (initialScreen="stripe_link") the row isn't in a menu to
23084
+ // fall back to, so show a geo-restriction screen rather than
23085
+ // the Link UI.
23086
+ /* @__PURE__ */ jsx63(
23087
+ GeoRestrictionScreen,
23088
+ {
23089
+ methodName: t8.stripeLink.title,
23090
+ message: "Pay with Link is only available in the US."
23091
+ }
23092
+ )
23093
+ ) : /* @__PURE__ */ jsx63(
23094
+ PayWithStripeLink,
23095
+ {
23096
+ userId,
23097
+ publishableKey,
23098
+ recipientAddress,
23099
+ destinationChainType,
23100
+ destinationChainId,
23101
+ destinationTokenAddress,
23102
+ wallets,
23103
+ email: userEmail,
23104
+ iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/link.svg` : void 0,
23105
+ step: stripeLinkStep,
23106
+ onStepChange: setStripeLinkStep,
23107
+ backHandlerRef: stripeLinkBackRef,
23108
+ onDepositSuccess,
23109
+ onDepositError
23110
+ }
23111
+ ),
23112
+ depositPoweredByFooter
23113
+ ] })
23114
+ ] }) : view === "cashapp" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
23115
+ /* @__PURE__ */ jsx63(
23116
+ DepositHeader,
23117
+ {
23118
+ title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
23119
+ showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
23120
+ onBack: handleBack,
23121
+ onClose: handleClose
23122
+ }
23123
+ ),
23124
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
23125
+ /* @__PURE__ */ jsx63(
23126
+ PayWithCashApp,
23127
+ {
23128
+ userId,
23129
+ publishableKey,
23130
+ recipientAddress,
23131
+ destinationChainType,
23132
+ destinationChainId,
23133
+ destinationTokenAddress,
23134
+ cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
23135
+ view: cashAppView,
23136
+ onViewChange: setCashAppView,
23137
+ onAmountChange: setCashAppAmount,
23138
+ onEvent,
23139
+ onDepositSuccess: onDepositSuccessFor("cashapp"),
23140
+ onDepositError: onDepositErrorFor("cashapp"),
23141
+ wallets
23142
+ }
23143
+ ),
23144
+ depositPoweredByFooter
23145
+ ] })
23146
+ ] }) : view === "apple_pay" ? /* @__PURE__ */ jsxs57(Fragment14, { children: [
23147
+ /* @__PURE__ */ jsx63(
23148
+ DepositHeader,
23149
+ {
23150
+ title: applePayHeaderTitle,
23151
+ showBack: applePayShowBack,
23152
+ onBack: () => {
23153
+ const handled = applePayHandleRef.current?.requestBack() ?? false;
23154
+ if (!handled) handleBack();
23155
+ },
23156
+ onClose: handleClose
23157
+ }
23158
+ ),
23159
+ /* @__PURE__ */ jsxs57("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
23160
+ applePayProvidersLoading ? /* @__PURE__ */ jsx63(SkeletonButton, { variant: "with-icons" }) : !hasEnabledApplePayProvider ? /* @__PURE__ */ jsx63(GeoRestrictionScreen, { methodName: "Apple Pay" }) : /* @__PURE__ */ jsx63(
23161
+ BuyWithApplePay,
23162
+ {
23163
+ ref: applePayHandleRef,
23164
+ userId,
23165
+ publishableKey,
23166
+ destinationChainType,
23167
+ destinationChainId,
23168
+ destinationTokenAddress,
23169
+ userEmail,
23170
+ wallets,
23171
+ onViewChange: setApplePayView,
23172
+ onEvent,
23173
+ onDepositSuccess: onDepositSuccessFor("apple_pay"),
23174
+ onDepositError: onDepositErrorFor("apple_pay"),
23175
+ exitLabel: sessionOpenedFromMenu ? "Return" : "Close",
23176
+ onExit: () => {
23177
+ if (sessionOpenedFromMenu) {
23178
+ setView("main");
23179
+ } else {
23180
+ handleClose();
23181
+ }
23182
+ }
23183
+ }
23184
+ ),
23185
+ depositPoweredByFooter
23186
+ ] })
23187
+ ] }) : null
23188
+ }
23189
+ )
23114
23190
  ]
23115
23191
  }
23116
23192
  )
@@ -23123,12 +23199,12 @@ import { useState as useState41, useEffect as useEffect35, useLayoutEffect as us
23123
23199
  import { AlertTriangle as AlertTriangle4, ChevronRight as ChevronRight19 } from "lucide-react";
23124
23200
 
23125
23201
  // src/hooks/use-payment-intent.ts
23126
- import { useQuery as useQuery18 } from "@tanstack/react-query";
23202
+ import { useQuery as useQuery17 } from "@tanstack/react-query";
23127
23203
  import { retrievePaymentIntent } from "@unifold/core";
23128
23204
  var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["succeeded", "expired", "refunded", "canceled"]);
23129
23205
  function usePaymentIntent(params) {
23130
23206
  const { clientSecret, publishableKey, enabled = true, pollingInterval = 3e3 } = params;
23131
- return useQuery18({
23207
+ return useQuery17({
23132
23208
  queryKey: ["unifold", "paymentIntent", clientSecret, publishableKey],
23133
23209
  queryFn: () => retrievePaymentIntent(clientSecret, publishableKey),
23134
23210
  enabled: enabled && !!clientSecret && !!publishableKey,
@@ -23564,253 +23640,275 @@ function CheckoutModal({
23564
23640
  return /* @__PURE__ */ jsx64(PortalContainerProvider, { value: null, children: /* @__PURE__ */ jsx64(Dialog, { open, onOpenChange: handleClose, modal: true, children: /* @__PURE__ */ jsx64(
23565
23641
  DialogContent,
23566
23642
  {
23567
- className: `sm:uf-max-w-[400px] uf-border-secondary uf-text-foreground uf-gap-0 [&>button]:uf-hidden uf-p-0 uf-overflow-visible ${view === "main" ? "!uf-top-auto !uf-h-auto !uf-max-h-[60vh] sm:!uf-max-h-none sm:!uf-top-[50%]" : "!uf-top-0 !uf-h-full sm:!uf-h-auto sm:!uf-top-[50%]"} ${themeClass}`,
23643
+ className: `sm:uf-max-w-[400px] uf-border-secondary uf-text-foreground uf-gap-0 [&>button]:uf-hidden uf-p-0 uf-overflow-visible ${view === "main" ? "!uf-top-auto !uf-h-auto !uf-max-h-[60vh] sm:!uf-max-h-none sm:!uf-top-[50%]" : "!uf-top-0 !uf-h-full sm:!uf-h-auto sm:!uf-top-[50%]"} ${// wallet_connect fills the full-height mobile sheet. DialogContent is a
23644
+ // grid whose single auto row only grows to fill free space and never
23645
+ // shrinks below content, so a long wallet list would balloon the row
23646
+ // past the viewport and push the footer off-screen. Clamp the row to
23647
+ // the modal height with minmax(0,1fr) so the inner overflow-y-auto list
23648
+ // scrolls with the footer pinned. Reset to content-sized on desktop.
23649
+ view === "wallet_connect" ? "[grid-template-rows:minmax(0,1fr)] sm:[grid-template-rows:none]" : ""} ${themeClass}`,
23568
23650
  style: { backgroundColor: colors2.background },
23569
23651
  onPointerDownOutside: (e) => e.preventDefault(),
23570
23652
  onInteractOutside: (e) => e.preventDefault(),
23571
- children: /* @__PURE__ */ jsx64(ThemeStyleInjector, { children: view === "main" ? /* @__PURE__ */ jsxs58(Fragment15, { children: [
23572
- /* @__PURE__ */ jsx64(DepositHeader, { title: modalTitle || "Checkout", showClose: true, onClose: handleClose }),
23573
- /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
23574
- piLoading ? /* @__PURE__ */ jsxs58("div", { className: "uf-space-y-3", children: [
23575
- /* @__PURE__ */ jsx64(
23576
- "div",
23577
- {
23578
- className: "uf-rounded-xl uf-p-4 uf-animate-pulse",
23579
- style: {
23580
- backgroundColor: components.card.backgroundColor,
23581
- borderRadius: components.card.borderRadius,
23582
- border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
23583
- },
23584
- children: /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-items-center uf-gap-2", children: [
23585
- /* @__PURE__ */ jsx64(
23586
- "div",
23653
+ children: /* @__PURE__ */ jsx64(
23654
+ ThemeStyleInjector,
23655
+ {
23656
+ className: view === "wallet_connect" ? "uf-flex uf-min-h-0 uf-flex-col" : void 0,
23657
+ children: view === "main" ? /* @__PURE__ */ jsxs58(Fragment15, { children: [
23658
+ /* @__PURE__ */ jsx64(DepositHeader, { title: modalTitle || "Checkout", showClose: true, onClose: handleClose }),
23659
+ /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
23660
+ piLoading ? /* @__PURE__ */ jsxs58("div", { className: "uf-space-y-3", children: [
23661
+ /* @__PURE__ */ jsx64(
23662
+ "div",
23663
+ {
23664
+ className: "uf-rounded-xl uf-p-4 uf-animate-pulse",
23665
+ style: {
23666
+ backgroundColor: components.card.backgroundColor,
23667
+ borderRadius: components.card.borderRadius,
23668
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
23669
+ },
23670
+ children: /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-items-center uf-gap-2", children: [
23671
+ /* @__PURE__ */ jsx64(
23672
+ "div",
23673
+ {
23674
+ className: "uf-h-8 uf-w-24 uf-rounded",
23675
+ style: {
23676
+ backgroundColor: components.card.borderColor
23677
+ }
23678
+ }
23679
+ ),
23680
+ /* @__PURE__ */ jsx64(
23681
+ "div",
23682
+ {
23683
+ className: "uf-h-4 uf-w-16 uf-rounded",
23684
+ style: {
23685
+ backgroundColor: components.card.borderColor
23686
+ }
23687
+ }
23688
+ )
23689
+ ] })
23690
+ }
23691
+ ),
23692
+ /* @__PURE__ */ jsx64(SkeletonButton2, {}),
23693
+ /* @__PURE__ */ jsx64(SkeletonButton2, {})
23694
+ ] }) : piError ? /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
23695
+ /* @__PURE__ */ jsx64("div", { className: "uf-w-16 uf-h-16 uf-rounded-full uf-bg-muted uf-flex uf-items-center uf-justify-center uf-mb-4", children: /* @__PURE__ */ jsx64(AlertTriangle4, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
23696
+ /* @__PURE__ */ jsx64(
23697
+ "h3",
23698
+ {
23699
+ className: "uf-text-lg uf-font-semibold uf-mb-2",
23700
+ style: {
23701
+ color: colors2.foreground,
23702
+ fontFamily: fonts.semibold
23703
+ },
23704
+ children: "Unable to Load Checkout"
23705
+ }
23706
+ ),
23707
+ /* @__PURE__ */ jsx64(
23708
+ "p",
23709
+ {
23710
+ className: "uf-text-sm uf-max-w-[280px]",
23711
+ style: {
23712
+ color: colors2.foregroundMuted,
23713
+ fontFamily: fonts.regular
23714
+ },
23715
+ children: piError instanceof Error ? piError.message : "Something went wrong. Please try again."
23716
+ }
23717
+ )
23718
+ ] }) : paymentIntent ? /* @__PURE__ */ jsxs58("div", { className: "uf-space-y-3", children: [
23719
+ progressSection,
23720
+ (paymentIntent.status === "requires_payment" || paymentIntent.status === "processing") && /* @__PURE__ */ jsxs58(Fragment15, { children: [
23721
+ showTransferCrypto && /* @__PURE__ */ jsx64(
23722
+ TransferCryptoButton,
23587
23723
  {
23588
- className: "uf-h-8 uf-w-24 uf-rounded",
23589
- style: {
23590
- backgroundColor: components.card.borderColor
23591
- }
23724
+ onClick: () => {
23725
+ lastCheckoutMethodRef.current = "transfer";
23726
+ setView("transfer");
23727
+ },
23728
+ title: i18n.checkoutModal.transferCrypto.title,
23729
+ subtitle: i18n.checkoutModal.transferCrypto.subtitle,
23730
+ featuredTokens: projectConfig?.transfer_crypto.networks
23592
23731
  }
23593
23732
  ),
23594
- /* @__PURE__ */ jsx64(
23595
- "div",
23733
+ showConnectWallet && /* @__PURE__ */ jsx64(
23734
+ BrowserWalletButton,
23596
23735
  {
23597
- className: "uf-h-4 uf-w-16 uf-rounded",
23598
- style: {
23599
- backgroundColor: components.card.borderColor
23600
- }
23736
+ onClick: handleBrowserWalletClick,
23737
+ onConnectClick: handleWalletConnectClick,
23738
+ onDisconnect: handleWalletDisconnect,
23739
+ chainType: browserWalletChainType,
23740
+ publishableKey,
23741
+ featuredWallets: projectConfig?.connect_wallet?.wallets,
23742
+ subtitle: i18n.checkoutModal.browserWallet.subtitle
23601
23743
  }
23602
23744
  )
23603
23745
  ] })
23604
- }
23605
- ),
23606
- /* @__PURE__ */ jsx64(SkeletonButton2, {}),
23607
- /* @__PURE__ */ jsx64(SkeletonButton2, {})
23608
- ] }) : piError ? /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
23609
- /* @__PURE__ */ jsx64("div", { className: "uf-w-16 uf-h-16 uf-rounded-full uf-bg-muted uf-flex uf-items-center uf-justify-center uf-mb-4", children: /* @__PURE__ */ jsx64(AlertTriangle4, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
23746
+ ] }) : null,
23747
+ poweredByFooter
23748
+ ] })
23749
+ ] }) : view === "transfer" ? /* @__PURE__ */ jsxs58(Fragment15, { children: [
23610
23750
  /* @__PURE__ */ jsx64(
23611
- "h3",
23751
+ DepositHeader,
23612
23752
  {
23613
- className: "uf-text-lg uf-font-semibold uf-mb-2",
23614
- style: {
23615
- color: colors2.foreground,
23616
- fontFamily: fonts.semibold
23617
- },
23618
- children: "Unable to Load Checkout"
23753
+ title: modalTitle || "Checkout",
23754
+ showBack: true,
23755
+ onBack: handleBack,
23756
+ onClose: handleClose
23619
23757
  }
23620
23758
  ),
23621
- /* @__PURE__ */ jsx64(
23622
- "p",
23623
- {
23624
- className: "uf-text-sm uf-max-w-[280px]",
23625
- style: {
23626
- color: colors2.foregroundMuted,
23627
- fontFamily: fonts.regular
23628
- },
23629
- children: piError instanceof Error ? piError.message : "Something went wrong. Please try again."
23630
- }
23631
- )
23632
- ] }) : paymentIntent ? /* @__PURE__ */ jsxs58("div", { className: "uf-space-y-3", children: [
23633
- progressSection,
23634
- (paymentIntent.status === "requires_payment" || paymentIntent.status === "processing") && /* @__PURE__ */ jsxs58(Fragment15, { children: [
23635
- showTransferCrypto && /* @__PURE__ */ jsx64(
23636
- TransferCryptoButton,
23637
- {
23638
- onClick: () => {
23639
- lastCheckoutMethodRef.current = "transfer";
23640
- setView("transfer");
23641
- },
23642
- title: i18n.checkoutModal.transferCrypto.title,
23643
- subtitle: i18n.checkoutModal.transferCrypto.subtitle,
23644
- featuredTokens: projectConfig?.transfer_crypto.networks
23645
- }
23646
- ),
23647
- showConnectWallet && /* @__PURE__ */ jsx64(
23648
- BrowserWalletButton,
23649
- {
23650
- onClick: handleBrowserWalletClick,
23651
- onConnectClick: handleWalletConnectClick,
23652
- onDisconnect: handleWalletDisconnect,
23653
- chainType: browserWalletChainType,
23654
- publishableKey,
23655
- featuredWallets: projectConfig?.connect_wallet?.wallets,
23656
- subtitle: i18n.checkoutModal.browserWallet.subtitle
23657
- }
23658
- )
23659
- ] })
23660
- ] }) : null,
23661
- poweredByFooter
23662
- ] })
23663
- ] }) : view === "transfer" ? /* @__PURE__ */ jsxs58(Fragment15, { children: [
23664
- /* @__PURE__ */ jsx64(
23665
- DepositHeader,
23666
- {
23667
- title: modalTitle || "Checkout",
23668
- showBack: true,
23669
- onBack: handleBack,
23670
- onClose: handleClose
23671
- }
23672
- ),
23673
- /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
23674
- paymentIntent ? /* @__PURE__ */ jsxs58(Fragment15, { children: [
23675
- (() => {
23676
- const receivedUsd = parseFloat(
23677
- paymentIntent.destination_amount_received_usd || paymentIntent.amount_received_usd
23678
- );
23679
- const totalUsd = parseFloat(
23680
- paymentIntent.destination_amount_usd || paymentIntent.amount_usd
23681
- );
23682
- const pct = totalUsd > 0 ? Math.min(receivedUsd / totalUsd * 100, 100) : 0;
23683
- return /* @__PURE__ */ jsxs58("div", { className: "uf-space-y-2", children: [
23684
- /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-items-center uf-justify-between", children: [
23685
- /* @__PURE__ */ jsx64(
23686
- "span",
23687
- {
23688
- className: "uf-text-xs",
23689
- style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
23690
- children: "Received"
23691
- }
23692
- ),
23693
- /* @__PURE__ */ jsxs58(
23694
- "span",
23695
- {
23696
- className: "uf-text-xs",
23697
- style: { color: colors2.foreground, fontFamily: fonts.medium },
23698
- children: [
23699
- "$",
23700
- receivedUsd.toFixed(2),
23701
- " / $",
23702
- totalUsd.toFixed(2)
23703
- ]
23704
- }
23705
- )
23706
- ] }),
23707
- /* @__PURE__ */ jsx64(
23708
- "div",
23709
- {
23710
- className: "uf-w-full uf-h-1.5 uf-rounded-full uf-overflow-hidden",
23711
- style: { backgroundColor: colors2.border },
23712
- children: /* @__PURE__ */ jsx64(
23759
+ /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
23760
+ paymentIntent ? /* @__PURE__ */ jsxs58(Fragment15, { children: [
23761
+ (() => {
23762
+ const receivedUsd = parseFloat(
23763
+ paymentIntent.destination_amount_received_usd || paymentIntent.amount_received_usd
23764
+ );
23765
+ const totalUsd = parseFloat(
23766
+ paymentIntent.destination_amount_usd || paymentIntent.amount_usd
23767
+ );
23768
+ const pct = totalUsd > 0 ? Math.min(receivedUsd / totalUsd * 100, 100) : 0;
23769
+ return /* @__PURE__ */ jsxs58("div", { className: "uf-space-y-2", children: [
23770
+ /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-items-center uf-justify-between", children: [
23771
+ /* @__PURE__ */ jsx64(
23772
+ "span",
23773
+ {
23774
+ className: "uf-text-xs",
23775
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
23776
+ children: "Received"
23777
+ }
23778
+ ),
23779
+ /* @__PURE__ */ jsxs58(
23780
+ "span",
23781
+ {
23782
+ className: "uf-text-xs",
23783
+ style: { color: colors2.foreground, fontFamily: fonts.medium },
23784
+ children: [
23785
+ "$",
23786
+ receivedUsd.toFixed(2),
23787
+ " / $",
23788
+ totalUsd.toFixed(2)
23789
+ ]
23790
+ }
23791
+ )
23792
+ ] }),
23793
+ /* @__PURE__ */ jsx64(
23713
23794
  "div",
23714
23795
  {
23715
- className: "uf-h-full uf-rounded-full uf-transition-all uf-duration-500",
23716
- style: {
23717
- width: `${pct}%`,
23718
- backgroundColor: paymentIntent.status === "succeeded" ? "rgb(34, 197, 94)" : colors2.primary
23719
- }
23796
+ className: "uf-w-full uf-h-1.5 uf-rounded-full uf-overflow-hidden",
23797
+ style: { backgroundColor: colors2.border },
23798
+ children: /* @__PURE__ */ jsx64(
23799
+ "div",
23800
+ {
23801
+ className: "uf-h-full uf-rounded-full uf-transition-all uf-duration-500",
23802
+ style: {
23803
+ width: `${pct}%`,
23804
+ backgroundColor: paymentIntent.status === "succeeded" ? "rgb(34, 197, 94)" : colors2.primary
23805
+ }
23806
+ }
23807
+ )
23720
23808
  }
23721
23809
  )
23810
+ ] });
23811
+ })(),
23812
+ /* @__PURE__ */ jsx64(
23813
+ TransferCryptoSingleInput,
23814
+ {
23815
+ userId: paymentIntent.user_id || "",
23816
+ publishableKey,
23817
+ clientSecret,
23818
+ recipientAddress: paymentIntent.recipient_address,
23819
+ destinationChainType: paymentIntent.destination_chain_type,
23820
+ destinationChainId: paymentIntent.destination_chain_id,
23821
+ destinationTokenAddress: paymentIntent.destination_token_address,
23822
+ defaultSourceChainType,
23823
+ defaultSourceChainId,
23824
+ defaultSourceTokenAddress,
23825
+ defaultSourceSymbol,
23826
+ depositConfirmationMode: "auto_ui",
23827
+ wallets,
23828
+ onSourceTokenChange: setSelectedSource,
23829
+ persistCheckingIndicator: true,
23830
+ productType: "payment",
23831
+ checkoutQuote: effectiveCheckoutQuote,
23832
+ isCheckoutQuoteLoading: isQuoteLoading || isQuoteFetching
23722
23833
  }
23723
23834
  )
23724
- ] });
23725
- })(),
23726
- /* @__PURE__ */ jsx64(
23727
- TransferCryptoSingleInput,
23835
+ ] }) : /* @__PURE__ */ jsx64(SkeletonButton2, {}),
23836
+ poweredByFooter
23837
+ ] })
23838
+ ] }) : view === "wallet_connect" && paymentIntent ? (
23839
+ // Mobile: flex-fill the full-height sheet so the wallet list grows and
23840
+ // scrolls with the footer pinned. Desktop (sm:): content-sized.
23841
+ /* @__PURE__ */ jsxs58(
23842
+ "div",
23728
23843
  {
23729
- userId: paymentIntent.user_id || "",
23730
- publishableKey,
23731
- clientSecret,
23732
- recipientAddress: paymentIntent.recipient_address,
23733
- destinationChainType: paymentIntent.destination_chain_type,
23734
- destinationChainId: paymentIntent.destination_chain_id,
23735
- destinationTokenAddress: paymentIntent.destination_token_address,
23736
- defaultSourceChainType,
23737
- defaultSourceChainId,
23738
- defaultSourceTokenAddress,
23739
- defaultSourceSymbol,
23740
- depositConfirmationMode: "auto_ui",
23741
- wallets,
23742
- onSourceTokenChange: setSelectedSource,
23743
- persistCheckingIndicator: true,
23744
- productType: "payment",
23745
- checkoutQuote: effectiveCheckoutQuote,
23746
- isCheckoutQuoteLoading: isQuoteLoading || isQuoteFetching
23844
+ className: "uf-flex uf-flex-col uf-gap-1.5 uf-min-h-0 uf-flex-1 sm:uf-flex-none",
23845
+ children: [
23846
+ /* @__PURE__ */ jsx64(
23847
+ WalletConnect,
23848
+ {
23849
+ walletInfo: browserWalletInfo ?? void 0,
23850
+ depositWallet: browserWalletInfo?.depositWallet ?? void 0,
23851
+ wallets,
23852
+ userId: paymentIntent.user_id || "",
23853
+ publishableKey,
23854
+ clientSecret,
23855
+ prefillAmountUsd: remainingAmountUsd,
23856
+ checkoutAmountUsd: paymentIntent.amount_usd,
23857
+ checkoutReceivedUsd: paymentIntent.amount_received_usd,
23858
+ checkoutDestination: {
23859
+ chainType: paymentIntent.destination_chain_type,
23860
+ chainId: paymentIntent.destination_chain_id,
23861
+ tokenAddress: paymentIntent.destination_token_address,
23862
+ decimals: paymentIntent.destination_token_decimals ?? 6
23863
+ },
23864
+ productType: "payment",
23865
+ stablecoinParity: paymentIntent.stablecoin_parity ?? false,
23866
+ checkoutRemainingBaseUnits: (() => {
23867
+ const remaining = BigInt(paymentIntent.amount) - BigInt(paymentIntent.amount_received);
23868
+ return remaining > 0n ? remaining.toString() : "0";
23869
+ })(),
23870
+ onSuccess: (_txHash) => {
23871
+ emitCheckoutSuccess(
23872
+ {
23873
+ paymentIntentId: paymentIntent.id,
23874
+ status: "processing",
23875
+ paymentIntent
23876
+ },
23877
+ "wallet_connect"
23878
+ );
23879
+ },
23880
+ onError: (error) => {
23881
+ onCheckoutError?.({
23882
+ message: error.message,
23883
+ error,
23884
+ method: "wallet_connect"
23885
+ });
23886
+ },
23887
+ onWalletDisconnect: handleWalletDisconnect,
23888
+ onWalletConnected: (info, dw) => {
23889
+ setBrowserWalletInfo({ ...info, depositWallet: dw });
23890
+ setStoredWalletState(info.type);
23891
+ setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
23892
+ lastCheckoutMethodRef.current = "wallet_connect";
23893
+ },
23894
+ onNewDeposit: () => setView("main"),
23895
+ onDone: () => setView("main"),
23896
+ paymentIntentStatus: paymentIntent.status,
23897
+ onBack: handleBack,
23898
+ onClose: handleClose,
23899
+ defaultSourceChainType,
23900
+ defaultSourceChainId,
23901
+ defaultSourceTokenAddress,
23902
+ defaultSourceSymbol
23903
+ }
23904
+ ),
23905
+ poweredByFooter
23906
+ ]
23747
23907
  }
23748
23908
  )
23749
- ] }) : /* @__PURE__ */ jsx64(SkeletonButton2, {}),
23750
- poweredByFooter
23751
- ] })
23752
- ] }) : view === "wallet_connect" && paymentIntent ? /* @__PURE__ */ jsxs58("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
23753
- /* @__PURE__ */ jsx64(
23754
- WalletConnect,
23755
- {
23756
- walletInfo: browserWalletInfo ?? void 0,
23757
- depositWallet: browserWalletInfo?.depositWallet ?? void 0,
23758
- wallets,
23759
- userId: paymentIntent.user_id || "",
23760
- publishableKey,
23761
- clientSecret,
23762
- prefillAmountUsd: remainingAmountUsd,
23763
- checkoutAmountUsd: paymentIntent.amount_usd,
23764
- checkoutReceivedUsd: paymentIntent.amount_received_usd,
23765
- checkoutDestination: {
23766
- chainType: paymentIntent.destination_chain_type,
23767
- chainId: paymentIntent.destination_chain_id,
23768
- tokenAddress: paymentIntent.destination_token_address,
23769
- decimals: paymentIntent.destination_token_decimals ?? 6
23770
- },
23771
- productType: "payment",
23772
- stablecoinParity: paymentIntent.stablecoin_parity ?? false,
23773
- checkoutRemainingBaseUnits: (() => {
23774
- const remaining = BigInt(paymentIntent.amount) - BigInt(paymentIntent.amount_received);
23775
- return remaining > 0n ? remaining.toString() : "0";
23776
- })(),
23777
- onSuccess: (_txHash) => {
23778
- emitCheckoutSuccess(
23779
- {
23780
- paymentIntentId: paymentIntent.id,
23781
- status: "processing",
23782
- paymentIntent
23783
- },
23784
- "wallet_connect"
23785
- );
23786
- },
23787
- onError: (error) => {
23788
- onCheckoutError?.({
23789
- message: error.message,
23790
- error,
23791
- method: "wallet_connect"
23792
- });
23793
- },
23794
- onWalletDisconnect: handleWalletDisconnect,
23795
- onWalletConnected: (info, dw) => {
23796
- setBrowserWalletInfo({ ...info, depositWallet: dw });
23797
- setStoredWalletState(info.type);
23798
- setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
23799
- lastCheckoutMethodRef.current = "wallet_connect";
23800
- },
23801
- onNewDeposit: () => setView("main"),
23802
- onDone: () => setView("main"),
23803
- paymentIntentStatus: paymentIntent.status,
23804
- onBack: handleBack,
23805
- onClose: handleClose,
23806
- defaultSourceChainType,
23807
- defaultSourceChainId,
23808
- defaultSourceTokenAddress,
23809
- defaultSourceSymbol
23810
- }
23811
- ),
23812
- poweredByFooter
23813
- ] }) : null })
23909
+ ) : null
23910
+ }
23911
+ )
23814
23912
  }
23815
23913
  ) }) });
23816
23914
  }
@@ -23820,12 +23918,12 @@ import { useState as useState45, useEffect as useEffect39, useLayoutEffect as us
23820
23918
  import { AlertTriangle as AlertTriangle6, ChevronRight as ChevronRight21, Clock as Clock6 } from "lucide-react";
23821
23919
 
23822
23920
  // src/hooks/use-supported-destination-tokens.ts
23823
- import { useQuery as useQuery19 } from "@tanstack/react-query";
23921
+ import { useQuery as useQuery18 } from "@tanstack/react-query";
23824
23922
  import {
23825
23923
  getSupportedDestinationTokens
23826
23924
  } from "@unifold/core";
23827
23925
  function useSupportedDestinationTokens(publishableKey, enabled = true) {
23828
- return useQuery19({
23926
+ return useQuery18({
23829
23927
  queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
23830
23928
  queryFn: () => getSupportedDestinationTokens(publishableKey),
23831
23929
  staleTime: 1e3 * 60 * 5,
@@ -23854,7 +23952,7 @@ function useDefaultDestinationToken({
23854
23952
  }
23855
23953
 
23856
23954
  // src/hooks/use-source-token-validation.ts
23857
- import { useQuery as useQuery20 } from "@tanstack/react-query";
23955
+ import { useQuery as useQuery19 } from "@tanstack/react-query";
23858
23956
  import { getSupportedDepositTokens as getSupportedDepositTokens3 } from "@unifold/core";
23859
23957
  function useSourceTokenValidation(params) {
23860
23958
  const {
@@ -23866,7 +23964,7 @@ function useSourceTokenValidation(params) {
23866
23964
  enabled = true
23867
23965
  } = params;
23868
23966
  const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
23869
- return useQuery20({
23967
+ return useQuery19({
23870
23968
  queryKey: [
23871
23969
  "unifold",
23872
23970
  "sourceTokenValidation",
@@ -23914,12 +24012,12 @@ function useSourceTokenValidation(params) {
23914
24012
  }
23915
24013
 
23916
24014
  // src/hooks/use-address-balance.ts
23917
- import { useQuery as useQuery21 } from "@tanstack/react-query";
24015
+ import { useQuery as useQuery20 } from "@tanstack/react-query";
23918
24016
  import { getAddressBalance as getAddressBalance2 } from "@unifold/core";
23919
24017
  function useAddressBalance(params) {
23920
24018
  const { address, chainType, chainId, tokenAddress, publishableKey, enabled = true } = params;
23921
24019
  const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
23922
- return useQuery21({
24020
+ return useQuery20({
23923
24021
  queryKey: [
23924
24022
  "unifold",
23925
24023
  "addressBalance",
@@ -23975,11 +24073,11 @@ function useAddressBalance(params) {
23975
24073
  }
23976
24074
 
23977
24075
  // src/hooks/use-executions.ts
23978
- import { useQuery as useQuery22 } from "@tanstack/react-query";
24076
+ import { useQuery as useQuery21 } from "@tanstack/react-query";
23979
24077
  import { queryExecutions as queryExecutions4, ActionType as ActionType4 } from "@unifold/core";
23980
24078
  function useExecutions(userId, publishableKey, options) {
23981
24079
  const actionType = options?.actionType ?? ActionType4.Deposit;
23982
- return useQuery22({
24080
+ return useQuery21({
23983
24081
  queryKey: ["unifold", "executions", actionType, userId, publishableKey],
23984
24082
  queryFn: () => queryExecutions4(userId, publishableKey, actionType),
23985
24083
  enabled: (options?.enabled ?? true) && !!userId,
@@ -24328,7 +24426,7 @@ import {
24328
24426
  } from "@unifold/core";
24329
24427
 
24330
24428
  // src/hooks/use-verify-recipient-address.ts
24331
- import { useQuery as useQuery23 } from "@tanstack/react-query";
24429
+ import { useQuery as useQuery22 } from "@tanstack/react-query";
24332
24430
  import { verifyRecipientAddress as verifyRecipientAddress2 } from "@unifold/core";
24333
24431
  function useVerifyRecipientAddress(params) {
24334
24432
  const {
@@ -24341,7 +24439,7 @@ function useVerifyRecipientAddress(params) {
24341
24439
  } = params;
24342
24440
  const trimmedAddress = recipientAddress?.trim() || "";
24343
24441
  const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
24344
- return useQuery23({
24442
+ return useQuery22({
24345
24443
  queryKey: [
24346
24444
  "unifold",
24347
24445
  "verifyRecipientAddress",
@@ -24592,7 +24690,7 @@ import { useMemo as useMemo15 } from "react";
24592
24690
  import { ActionType as ActionType6 } from "@unifold/core";
24593
24691
 
24594
24692
  // src/hooks/use-get-deposit-address.ts
24595
- import { useQuery as useQuery24 } from "@tanstack/react-query";
24693
+ import { useQuery as useQuery23 } from "@tanstack/react-query";
24596
24694
  import { getDepositAddress } from "@unifold/core";
24597
24695
  function useGetDepositAddress(params) {
24598
24696
  const {
@@ -24606,7 +24704,7 @@ function useGetDepositAddress(params) {
24606
24704
  enabled = true
24607
24705
  } = params;
24608
24706
  const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
24609
- return useQuery24({
24707
+ return useQuery23({
24610
24708
  queryKey: [
24611
24709
  "unifold",
24612
24710
  "getDepositAddress",