@unifold/ui-web 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.js CHANGED
@@ -34701,6 +34701,9 @@ function replaceData(prevData, data, options2) {
34701
34701
  }
34702
34702
  return data;
34703
34703
  }
34704
+ function keepPreviousData(previousData) {
34705
+ return previousData;
34706
+ }
34704
34707
  function addToEnd(items, item, max2 = 0) {
34705
34708
  const newItems = [...items, item];
34706
34709
  return max2 && newItems.length > max2 ? newItems.slice(1) : newItems;
@@ -51151,6 +51154,7 @@ var DialogContent2 = React36.forwardRef(({ className, style, children, omitOverl
51151
51154
  className: cn(
51152
51155
  portalContainer ? "uf-absolute" : "uf-fixed",
51153
51156
  "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",
51157
+ "focus:uf-outline-none focus-visible:uf-outline-none",
51154
51158
  !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",
51155
51159
  "uf-border uf-bg-background",
51156
51160
  omitOverlayEmbed ? "uf-gap-0 uf-p-0" : "uf-gap-4 uf-p-6 uf-shadow-lg uf-duration-200",
@@ -51166,6 +51170,14 @@ var DialogContent2 = React36.forwardRef(({ className, style, children, omitOverl
51166
51170
  ),
51167
51171
  style: {
51168
51172
  "--uf-container-radius": `${components.container.borderRadius}px`,
51173
+ // Radix traps focus and, when the focused control unmounts during an
51174
+ // in-modal screen transition, moves focus onto this container. Modern
51175
+ // browsers paint the default focus ring via `:focus-visible`, which
51176
+ // flashes a highlight around the whole modal until focus settles on
51177
+ // the next screen. Suppress it inline so it works regardless of the
51178
+ // Tailwind build (the container is a programmatic focus target, not an
51179
+ // interactive control, so it should never show a focus ring).
51180
+ outline: "none",
51169
51181
  ...portalContainer ? { display: "flex", flexDirection: "column" } : {},
51170
51182
  ...style
51171
51183
  },
@@ -63282,10 +63294,16 @@ function PayWithStripeLink({
63282
63294
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
63283
63295
  "div",
63284
63296
  {
63285
- className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-max-h-[70vh]",
63297
+ className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-overflow-x-hidden uf-max-h-[70vh]",
63286
63298
  style: { backgroundColor: colors2.background },
63287
63299
  children: [
63288
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { ref: paymentMountRef, className: "uf-w-full uf-flex-1 uf-overflow-y-auto" }),
63300
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
63301
+ "div",
63302
+ {
63303
+ ref: paymentMountRef,
63304
+ className: "uf-w-full uf-flex-1 uf-overflow-y-auto uf-overflow-x-hidden"
63305
+ }
63306
+ ),
63289
63307
  !stripePaymentUIReady && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uf-flex uf-items-center uf-justify-center uf-py-8", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(LoaderCircle, { className: "uf-w-8 uf-h-8 uf-animate-spin", style: { color: colors2.primary } }) }),
63290
63308
  error && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
63291
63309
  "div",
@@ -63303,7 +63321,7 @@ function PayWithStripeLink({
63303
63321
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
63304
63322
  "div",
63305
63323
  {
63306
- className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-max-h-[70vh]",
63324
+ className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-overflow-x-hidden uf-max-h-[70vh]",
63307
63325
  style: { backgroundColor: colors2.background },
63308
63326
  children: [
63309
63327
  displayPaymentTokens.length === 0 && !loading && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uf-px-1 uf-mb-3 uf-text-center", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
@@ -64413,17 +64431,30 @@ function PayWithStripeLink({
64413
64431
  }
64414
64432
  function useProjectConfig({
64415
64433
  publishableKey,
64416
- enabled = true
64434
+ enabled = true,
64435
+ countryCode,
64436
+ subdivisionCode
64417
64437
  }) {
64418
- const { data: projectConfig, isLoading } = useQuery({
64419
- queryKey: ["unifold", "projectConfig", publishableKey],
64420
- queryFn: () => getProjectConfig(publishableKey),
64438
+ const {
64439
+ data: projectConfig,
64440
+ isLoading,
64441
+ error
64442
+ } = useQuery({
64443
+ // Country is part of the key so a region change refetches the region-aware
64444
+ // config. Omitted when undefined so callers that don't pass a country keep
64445
+ // sharing the base cache entry.
64446
+ queryKey: countryCode ? ["unifold", "projectConfig", publishableKey, countryCode, subdivisionCode ?? null] : ["unifold", "projectConfig", publishableKey],
64447
+ queryFn: () => getProjectConfig(publishableKey, countryCode ? { countryCode, subdivisionCode } : void 0),
64421
64448
  enabled,
64449
+ // Keep the previous (e.g. no-country) config visible while the region-aware
64450
+ // config refetches after the country resolves, so unrelated config-driven
64451
+ // UI doesn't flash back to defaults.
64452
+ placeholderData: keepPreviousData,
64422
64453
  staleTime: 1e3 * 60 * 30,
64423
64454
  refetchOnMount: true,
64424
64455
  refetchOnWindowFocus: true
64425
64456
  });
64426
- return { projectConfig, isLoading };
64457
+ return { projectConfig, isLoading, error: error ?? null };
64427
64458
  }
64428
64459
  function useSupportedDepositTokens(publishableKey, options2) {
64429
64460
  const hasDestination = options2?.destination_token_address && options2?.destination_chain_id && options2?.destination_chain_type;
@@ -66462,44 +66493,28 @@ function useApplePayProviders({
66462
66493
  return { providers, isLoading };
66463
66494
  }
66464
66495
  function useAllowedCountry(publishableKey) {
66496
+ const { userIpInfo, isLoading: isIpLoading, error: ipError } = useUserIp2();
66465
66497
  const {
66466
- data: ipData,
66467
- isLoading: isIpLoading,
66468
- error: ipError
66469
- } = useQuery({
66470
- queryKey: ["unifold", "ipAddress"],
66471
- queryFn: () => getIpAddress(),
66472
- refetchOnMount: false,
66473
- refetchOnReconnect: true,
66474
- refetchOnWindowFocus: false,
66475
- staleTime: 1e3 * 60 * 60,
66476
- // 1 hour
66477
- gcTime: 1e3 * 60 * 60 * 24
66478
- // 24 hours
66479
- });
66480
- const {
66481
- data: configData,
66498
+ projectConfig,
66482
66499
  isLoading: isConfigLoading,
66483
66500
  error: configError
66484
- } = useQuery({
66485
- queryKey: ["unifold", "projectConfig", publishableKey],
66486
- queryFn: () => getProjectConfig(publishableKey),
66487
- refetchOnMount: false,
66488
- refetchOnReconnect: true,
66489
- refetchOnWindowFocus: false,
66490
- staleTime: 1e3 * 60 * 5,
66491
- // 5 minutes
66492
- gcTime: 1e3 * 60 * 60
66493
- // 1 hour
66501
+ } = useProjectConfig({
66502
+ publishableKey,
66503
+ // Wait for the IP so we issue a single country-aware config request rather
66504
+ // than a country-less fetch followed by a country-aware refetch. Shares the
66505
+ // query key with DepositModal's useProjectConfig, so they dedupe.
66506
+ enabled: !isIpLoading,
66507
+ countryCode: userIpInfo?.alpha2,
66508
+ subdivisionCode: userIpInfo?.subdivisionCode ?? void 0
66494
66509
  });
66495
66510
  const isLoading = isIpLoading || isConfigLoading;
66496
66511
  const error = ipError || configError || null;
66512
+ const userSubdivision = userIpInfo?.subdivisionCode || userIpInfo?.state || "";
66497
66513
  let isAllowed = null;
66498
- if (ipData && configData) {
66499
- const blockedCodes = configData.blocked_country_codes || [];
66500
- const blockedSubdivisions = configData.blocked_country_subdivisions || [];
66501
- const userCountryUpper = ipData.alpha2.toUpperCase();
66502
- const userSubdivision = ipData.subdivision_code || ipData.state || "";
66514
+ if (userIpInfo && projectConfig) {
66515
+ const blockedCodes = projectConfig.blocked_country_codes || [];
66516
+ const blockedSubdivisions = projectConfig.blocked_country_subdivisions || [];
66517
+ const userCountryUpper = userIpInfo.alpha2.toUpperCase();
66503
66518
  const userSubdivisionUpper = userSubdivision.toUpperCase();
66504
66519
  const isCountryBlocked = blockedCodes.some((code) => code.toUpperCase() === userCountryUpper);
66505
66520
  const isSubdivisionBlocked = blockedSubdivisions.some((entry) => {
@@ -66508,12 +66523,11 @@ function useAllowedCountry(publishableKey) {
66508
66523
  });
66509
66524
  isAllowed = !isCountryBlocked && !isSubdivisionBlocked;
66510
66525
  }
66511
- const subdivisionCode = ipData?.subdivision_code || ipData?.state || "" || null;
66512
66526
  return {
66513
66527
  isAllowed,
66514
- alpha2: ipData?.alpha2 ?? null,
66515
- country: ipData?.country ?? null,
66516
- subdivisionCode,
66528
+ alpha2: userIpInfo?.alpha2 ?? null,
66529
+ country: userIpInfo?.country ?? null,
66530
+ subdivisionCode: userSubdivision || null,
66517
66531
  isLoading,
66518
66532
  error
66519
66533
  };
@@ -71463,116 +71477,131 @@ function WalletConnect({
71463
71477
  ] });
71464
71478
  }
71465
71479
  if (view === "select_wallet") {
71466
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { style: viewTransitionStyle, children: [
71467
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71468
- DepositHeader,
71480
+ return (
71481
+ // Mobile: flex column that fills the full-height sheet so the wallet list
71482
+ // scrolls and the footer pins to the bottom. Desktop (sm:): content-sized.
71483
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
71484
+ "div",
71469
71485
  {
71470
- title: "Connect Wallet",
71471
- showBack: canGoBack,
71472
- onBack: handleBack,
71473
- onClose
71474
- }
71475
- ),
71476
- /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "uf-pb-4", children: [
71477
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71478
- "p",
71479
- {
71480
- className: "uf-text-sm uf-text-center uf-pb-4",
71481
- style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
71482
- children: isMobile ? "Open this page in your wallet's app to connect" : "Select a wallet to connect"
71483
- }
71484
- ),
71485
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "uf-space-y-2", style: { maxHeight: 330, overflowY: "auto" }, children: availableWallets.map((wallet) => {
71486
- const walletPlatformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
71487
- const showOpenInApp = isMobile && !wallet.isInstalled && wallet.supportsMobileBrowse !== false && walletPlatformAllowed;
71488
- const isPending = pendingMobileWallet?.id === wallet.id;
71489
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
71490
- "button",
71491
- {
71492
- onClick: () => void handleWalletClick(wallet),
71493
- disabled: isWalletConnecting || !!pendingMobileWallet,
71494
- 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",
71495
- style: {
71496
- backgroundColor: components.card.backgroundColor,
71497
- borderRadius: components.card.borderRadius,
71498
- border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
71499
- },
71500
- children: [
71501
- /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
71502
- WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71503
- WalletIconWithNetwork,
71504
- {
71505
- WalletIcon: WALLET_ICONS3[wallet.id],
71506
- networks: wallet.networks,
71507
- size: 40,
71508
- className: "uf-rounded-lg"
71509
- }
71510
- ) : /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
71511
- /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
71512
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71513
- "div",
71514
- {
71515
- className: "uf-text-sm uf-font-medium",
71516
- style: { color: components.card.titleColor, fontFamily: fonts.medium },
71517
- children: wallet.name
71518
- }
71519
- ),
71520
- wallet.id === recentWalletId && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71521
- "span",
71522
- {
71523
- className: "uf-text-xs uf-px-2 uf-py-0.5 uf-rounded-full",
71524
- style: {
71525
- backgroundColor: colors2.primary + "20",
71526
- color: colors2.primary,
71527
- fontFamily: fonts.medium
71528
- },
71529
- children: "Last used"
71530
- }
71531
- )
71532
- ] })
71533
- ] }),
71534
- isPending ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71535
- LoaderCircle,
71536
- {
71537
- className: "uf-w-4 uf-h-4 uf-animate-spin",
71538
- style: { color: colors2.primary }
71539
- }
71540
- ) : wallet.isInstalled ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71541
- "span",
71486
+ style: viewTransitionStyle,
71487
+ className: "uf-flex uf-min-h-0 uf-flex-1 uf-flex-col sm:uf-block",
71488
+ children: [
71489
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71490
+ DepositHeader,
71491
+ {
71492
+ title: "Connect Wallet",
71493
+ showBack: canGoBack,
71494
+ onBack: handleBack,
71495
+ onClose
71496
+ }
71497
+ ),
71498
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "uf-pb-4 uf-flex uf-min-h-0 uf-flex-1 uf-flex-col sm:uf-block", children: [
71499
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71500
+ "p",
71501
+ {
71502
+ className: "uf-text-sm uf-text-center uf-pb-4",
71503
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
71504
+ children: isMobile ? "Open this page in your wallet's app to connect" : "Select a wallet to connect"
71505
+ }
71506
+ ),
71507
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("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) => {
71508
+ if (!isMobile || wallet.isInstalled) return true;
71509
+ const platformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
71510
+ return wallet.supportsMobileBrowse !== false && platformAllowed;
71511
+ }).map((wallet) => {
71512
+ const walletPlatformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
71513
+ const showOpenInApp = isMobile && !wallet.isInstalled && wallet.supportsMobileBrowse !== false && walletPlatformAllowed;
71514
+ const isPending = pendingMobileWallet?.id === wallet.id;
71515
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
71516
+ "button",
71542
71517
  {
71543
- className: "uf-text-xs uf-px-2 uf-py-1 uf-rounded-full",
71518
+ onClick: () => void handleWalletClick(wallet),
71519
+ disabled: isWalletConnecting || !!pendingMobileWallet,
71520
+ 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",
71544
71521
  style: {
71545
- backgroundColor: colors2.primary + "20",
71546
- color: colors2.primary,
71547
- fontFamily: fonts.medium
71522
+ backgroundColor: components.card.backgroundColor,
71523
+ borderRadius: components.card.borderRadius,
71524
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
71548
71525
  },
71549
- children: "Detected"
71550
- }
71551
- ) : /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
71552
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71553
- "span",
71554
- {
71555
- className: "uf-text-xs",
71556
- style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
71557
- children: showOpenInApp ? "Open" : "Install"
71558
- }
71559
- ),
71560
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71561
- ExternalLink,
71562
- {
71563
- className: "uf-w-3 uf-h-3",
71564
- style: { color: colors2.foregroundMuted }
71565
- }
71566
- )
71567
- ] })
71568
- ]
71569
- },
71570
- wallet.id
71571
- );
71572
- }) }),
71573
- walletError && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "uf-text-center uf-text-sm uf-mt-4 uf-px-4", style: { color: "#ef4444" }, children: walletError })
71574
- ] })
71575
- ] });
71526
+ children: [
71527
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
71528
+ WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71529
+ WalletIconWithNetwork,
71530
+ {
71531
+ WalletIcon: WALLET_ICONS3[wallet.id],
71532
+ networks: wallet.networks,
71533
+ size: 40,
71534
+ className: "uf-rounded-lg"
71535
+ }
71536
+ ) : /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
71537
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
71538
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71539
+ "div",
71540
+ {
71541
+ className: "uf-text-sm uf-font-medium",
71542
+ style: { color: components.card.titleColor, fontFamily: fonts.medium },
71543
+ children: wallet.name
71544
+ }
71545
+ ),
71546
+ wallet.id === recentWalletId && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71547
+ "span",
71548
+ {
71549
+ className: "uf-text-xs uf-px-2 uf-py-0.5 uf-rounded-full",
71550
+ style: {
71551
+ backgroundColor: colors2.primary + "20",
71552
+ color: colors2.primary,
71553
+ fontFamily: fonts.medium
71554
+ },
71555
+ children: "Last used"
71556
+ }
71557
+ )
71558
+ ] })
71559
+ ] }),
71560
+ isPending ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71561
+ LoaderCircle,
71562
+ {
71563
+ className: "uf-w-4 uf-h-4 uf-animate-spin",
71564
+ style: { color: colors2.primary }
71565
+ }
71566
+ ) : wallet.isInstalled ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71567
+ "span",
71568
+ {
71569
+ className: "uf-text-xs uf-px-2 uf-py-1 uf-rounded-full",
71570
+ style: {
71571
+ backgroundColor: colors2.primary + "20",
71572
+ color: colors2.primary,
71573
+ fontFamily: fonts.medium
71574
+ },
71575
+ children: "Detected"
71576
+ }
71577
+ ) : /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
71578
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71579
+ "span",
71580
+ {
71581
+ className: "uf-text-xs",
71582
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
71583
+ children: showOpenInApp ? "Open" : "Install"
71584
+ }
71585
+ ),
71586
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
71587
+ ExternalLink,
71588
+ {
71589
+ className: "uf-w-3 uf-h-3",
71590
+ style: { color: colors2.foregroundMuted }
71591
+ }
71592
+ )
71593
+ ] })
71594
+ ]
71595
+ },
71596
+ wallet.id
71597
+ );
71598
+ }) }),
71599
+ walletError && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "uf-text-center uf-text-sm uf-mt-4 uf-px-4", style: { color: "#ef4444" }, children: walletError })
71600
+ ] })
71601
+ ]
71602
+ }
71603
+ )
71604
+ );
71576
71605
  }
71577
71606
  const preConnectAccent = selectedWalletDef ? getWalletBrandColor(selectedWalletDef.id, mode) : void 0;
71578
71607
  const preConnectFg = preConnectAccent ? getContrastingTextColor(preConnectAccent) : void 0;
@@ -71961,7 +71990,9 @@ function DepositModal({
71961
71990
  applePayTitle = "Pay with Apple Pay",
71962
71991
  applePaySubTitle = "Instant",
71963
71992
  enableBankTransfer,
71964
- enableStripeLink = false,
71993
+ // No default: left undefined so the backend `stripe_link.enabled` can govern
71994
+ // (via the `??` chain in showStripeLink) once a dashboard toggle exists.
71995
+ enableStripeLink,
71965
71996
  userEmail,
71966
71997
  hideDepositFlowInfo = false,
71967
71998
  hideDisplayDescription = false,
@@ -72042,14 +72073,18 @@ function DepositModal({
72042
72073
  const [allExecutions, setAllExecutions] = (0, import_react3.useState)([]);
72043
72074
  const [selectedExecution, setSelectedExecution] = (0, import_react3.useState)(null);
72044
72075
  const [depositExecutions, setDepositExecutions] = (0, import_react3.useState)([]);
72076
+ const { userIpInfo, isLoading: isLoadingIp } = useUserIp2();
72045
72077
  const { projectConfig } = useProjectConfig({
72046
72078
  publishableKey,
72047
- enabled: open
72079
+ enabled: open && !isLoadingIp,
72080
+ countryCode: userIpInfo?.alpha2,
72081
+ subdivisionCode: userIpInfo?.subdivisionCode ?? void 0
72048
72082
  });
72049
72083
  const showTransferCrypto = enableTransferCrypto ?? projectConfig?.transfer_crypto?.enabled ?? true;
72050
72084
  const showConnectWallet = enableConnectWallet ?? projectConfig?.connect_wallet?.enabled ?? true;
72051
72085
  const showPayWithExchange = enablePayWithExchange ?? projectConfig?.pay_with_exchange?.enabled ?? true;
72052
72086
  const showFiatOnramp = !projectConfig?.fiat_onramp?.is_hidden && (enableFiatOnramp ?? projectConfig?.fiat_onramp?.enabled ?? true);
72087
+ const showStripeLink = !projectConfig?.stripe_link?.is_hidden && (enableStripeLink ?? projectConfig?.stripe_link?.enabled ?? false);
72053
72088
  const showConnectExchange = enableConnectExchange ?? projectConfig?.connect_exchange?.enabled ?? true;
72054
72089
  const showCashApp = enableCashApp ?? projectConfig?.cash_app?.enabled ?? true;
72055
72090
  const showApplePay = enableApplePay ?? projectConfig?.apple_pay?.enabled ?? true;
@@ -72195,7 +72230,6 @@ function DepositModal({
72195
72230
  publishableKey,
72196
72231
  enabled: open && showPayWithExchange
72197
72232
  });
72198
- const { userIpInfo, isLoading: isLoadingIp } = useUserIp2();
72199
72233
  const { providers: bankTransferProviders, isLoading: bankTransferProvidersLoading } = useBankTransferProviders({
72200
72234
  publishableKey,
72201
72235
  enabled: open && !!userIpInfo?.alpha2,
@@ -72373,6 +72407,12 @@ function DepositModal({
72373
72407
  const [cashAppView, setCashAppView] = (0, import_react3.useState)("amount");
72374
72408
  const [stripeLinkStep, setStripeLinkStep] = (0, import_react3.useState)("amount");
72375
72409
  const stripeLinkBackRef = (0, import_react3.useRef)(null);
72410
+ (0, import_react3.useEffect)(() => {
72411
+ if (view === "stripe_link" && !showStripeLink && effectiveInitialScreen === "main") {
72412
+ setView("main");
72413
+ setStripeLinkStep("amount");
72414
+ }
72415
+ }, [view, showStripeLink, effectiveInitialScreen]);
72376
72416
  const [cashAppAmount, setCashAppAmount] = (0, import_react3.useState)("");
72377
72417
  const [applePayView, setApplePayView] = (0, import_react3.useState)("email_input");
72378
72418
  const applePayHandleRef = (0, import_react3.useRef)(null);
@@ -72597,7 +72637,7 @@ function DepositModal({
72597
72637
  },
72598
72638
  "cashapp"
72599
72639
  ) : null;
72600
- const stripeLinkMenuButton = enableStripeLink ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72640
+ const stripeLinkMenuButton = showStripeLink ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72601
72641
  StripeLinkButton,
72602
72642
  {
72603
72643
  onClick: () => setView("stripe_link"),
@@ -72645,11 +72685,13 @@ function DepositModal({
72645
72685
  connectExchangeMenuButton
72646
72686
  ].filter(Boolean);
72647
72687
  const cashMenuButtons = [
72688
+ // Stripe "Pay with Link" is intentionally listed first so it always sits
72689
+ // above "Deposit with Card".
72690
+ stripeLinkMenuButton,
72648
72691
  depositWithCardMenuButton,
72649
72692
  applePayMenuButton,
72650
72693
  cashAppMenuButton,
72651
- bankTransferMenuButton,
72652
- stripeLinkMenuButton
72694
+ bankTransferMenuButton
72653
72695
  ].filter(Boolean);
72654
72696
  const depositTabs = [
72655
72697
  { id: "crypto", label: "Use Crypto", icon: Bitcoin, buttons: cryptoMenuButtons },
@@ -72744,13 +72786,13 @@ function DepositModal({
72744
72786
  const stackedOptions = [
72745
72787
  transferCryptoMenuButton,
72746
72788
  connectWalletMenuButton,
72789
+ stripeLinkMenuButton,
72747
72790
  depositWithCardMenuButton,
72748
72791
  applePayMenuButton,
72749
72792
  payWithExchangeMenuButton,
72750
72793
  connectExchangeMenuButton,
72751
72794
  cashAppMenuButton,
72752
72795
  bankTransferMenuButton,
72753
- stripeLinkMenuButton,
72754
72796
  depositTrackerMenuButton
72755
72797
  ].filter(Boolean);
72756
72798
  return renderScrollableOptions(stackedOptions);
@@ -72766,410 +72808,452 @@ function DepositModal({
72766
72808
  {
72767
72809
  ref: hideOverlay ? containerCallbackRef : void 0,
72768
72810
  hideOverlay,
72769
- 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}`}`,
72811
+ 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
72812
+ // is a grid, and its single auto row only *grows* to fill free
72813
+ // space (align-content: stretch) — it never shrinks below content,
72814
+ // so a long wallet list would balloon the row past the viewport and
72815
+ // push the footer off-screen instead of scrolling. Clamp the row to
72816
+ // the modal height with minmax(0,1fr) so the inner overflow-y-auto
72817
+ // list scrolls with the footer pinned. Reset to content-sized on
72818
+ // desktop (sm:) where the modal is auto-height and centered.
72819
+ view === "wallet_connect" ? "[grid-template-rows:minmax(0,1fr)] sm:[grid-template-rows:none]" : ""} ${themeClass}`}`,
72770
72820
  style: { backgroundColor: colors2.background },
72771
72821
  onPointerDownOutside: (e) => e.preventDefault(),
72772
72822
  onInteractOutside: (e) => e.preventDefault(),
72773
72823
  children: [
72774
72824
  /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(DialogTitle2, { className: "uf-sr-only", children: modalTitle || "Deposit" }),
72775
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(ThemeStyleInjector, { children: view === "main" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-min-h-0 uf-max-h-full", children: [
72776
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "uf-flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72777
- DepositHeader,
72778
- {
72779
- title: modalTitle || "Deposit",
72780
- showClose: !hideOverlay,
72781
- onClose: handleClose,
72782
- showBalance: showBalanceHeader,
72783
- balanceAddress: recipientAddress,
72784
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
72785
- balanceChainId: destinationChainId,
72786
- balanceTokenAddress: destinationTokenAddress,
72787
- projectName: projectConfig?.project_name,
72788
- publishableKey
72789
- }
72790
- ) }),
72791
- renderMainMenuBody(),
72792
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "uf-flex-shrink-0", children: depositPoweredByFooter })
72793
- ] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
72794
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72795
- DepositHeader,
72796
- {
72797
- title: transferCryptoTitle,
72798
- showBack: showBackTransfer,
72799
- onBack: handleBack,
72800
- onClose: handleClose,
72801
- showBalance: showBalanceHeader,
72802
- balanceAddress: recipientAddress,
72803
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
72804
- balanceChainId: destinationChainId,
72805
- balanceTokenAddress: destinationTokenAddress,
72806
- projectName: projectConfig?.project_name,
72807
- publishableKey
72808
- }
72809
- ),
72810
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
72811
- standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72812
- TransferCryptoSingleInput,
72813
- {
72814
- userId,
72815
- publishableKey,
72816
- recipientAddress,
72817
- destinationChainType,
72818
- destinationChainId,
72819
- destinationTokenAddress,
72820
- defaultSourceChainType,
72821
- defaultSourceChainId,
72822
- defaultSourceTokenAddress,
72823
- defaultSourceSymbol,
72824
- depositConfirmationMode,
72825
- onExecutionsChange: setDepositExecutions,
72826
- onDepositSuccess: onDepositSuccessFor("transfer"),
72827
- onDepositError: onDepositErrorFor("transfer"),
72828
- wallets
72829
- }
72830
- ) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72831
- TransferCryptoDoubleInput,
72832
- {
72833
- userId,
72834
- publishableKey,
72835
- recipientAddress,
72836
- destinationChainType,
72837
- destinationChainId,
72838
- destinationTokenAddress,
72839
- defaultSourceChainType,
72840
- defaultSourceChainId,
72841
- defaultSourceTokenAddress,
72842
- defaultSourceSymbol,
72843
- depositConfirmationMode,
72844
- onExecutionsChange: setDepositExecutions,
72845
- onDepositSuccess: onDepositSuccessFor("transfer"),
72846
- onDepositError: onDepositErrorFor("transfer"),
72847
- wallets
72848
- }
72849
- ),
72850
- depositPoweredByFooter
72851
- ] })
72852
- ] }) : view === "tracker" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
72853
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72854
- DepositHeader,
72855
- {
72856
- title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
72857
- showBack: showBackTracker,
72858
- onBack: handleBack,
72859
- onClose: handleClose
72860
- }
72861
- ),
72862
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
72863
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "uf-h-[460px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(DepositDetailContent, { execution: selectedExecution }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "uf-space-y-2 uf-pb-8", children: allExecutions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72864
- "div",
72865
- {
72866
- className: "uf-text-sm",
72867
- style: {
72868
- color: components.container.subtitleColor,
72869
- fontFamily: fonts.regular
72870
- },
72871
- children: "No deposits yet"
72872
- }
72873
- ) }) : allExecutions.map((execution) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72874
- DepositExecutionItem,
72875
- {
72876
- execution,
72877
- onClick: () => setSelectedExecution(execution)
72878
- },
72879
- execution.id
72880
- )) }) }),
72881
- depositPoweredByFooter
72882
- ] })
72883
- ] }) : view === "card" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
72884
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72885
- DepositHeader,
72886
- {
72887
- title: cardView === "quotes" ? t8.quotes : depositWithCardTitle,
72888
- showBack: showBackCard,
72889
- onBack: handleBack,
72890
- onClose: handleClose,
72891
- badge: cardView === "quotes" ? { count: quotesCount } : void 0,
72892
- showBalance: showBalanceHeader,
72893
- balanceAddress: recipientAddress,
72894
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
72895
- balanceChainId: destinationChainId,
72896
- balanceTokenAddress: destinationTokenAddress,
72897
- projectName: projectConfig?.project_name,
72898
- publishableKey
72899
- }
72900
- ),
72901
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
72902
- standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : !showFiatOnramp ? (
72903
- // Fiat on-ramp resolved hidden/disabled after a direct open
72904
- // (e.g. platform `is_hidden` for a Stripe Link-only project).
72905
- // Show a geo-restriction screen rather than the card UI so the
72906
- // hard-hide is honoured without a flash of "Pay with Card".
72907
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(GeoRestrictionScreen, { methodName: "Card" })
72908
- ) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72909
- BuyWithCard,
72910
- {
72911
- userId,
72912
- publishableKey,
72913
- view: cardView,
72914
- onViewChange: handleCardViewChange,
72915
- destinationTokenSymbol,
72916
- recipientAddress,
72917
- destinationChainType,
72918
- destinationChainId,
72919
- destinationTokenAddress,
72920
- onDepositSuccess: onDepositSuccessFor("card"),
72921
- onDepositError: onDepositErrorFor("card"),
72922
- onEvent,
72923
- themeClass,
72924
- wallets,
72925
- assetCdnUrl: projectConfig?.asset_cdn_url,
72926
- hideDepositFlowInfo,
72927
- hideDisplayDescription
72928
- }
72929
- ),
72930
- depositPoweredByFooter
72931
- ] })
72932
- ] }) : view === "exchange" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
72933
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72934
- DepositHeader,
72935
- {
72936
- title: payWithExchangeTitle,
72937
- showBack: exchangeView === "pending" || sessionOpenedFromMenu,
72938
- onBack: handleBack,
72939
- onClose: handleClose
72940
- }
72941
- ),
72942
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
72943
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72944
- PayWithExchange,
72945
- {
72946
- userId,
72947
- publishableKey,
72948
- exchanges,
72949
- view: exchangeView,
72950
- onViewChange: setExchangeView,
72951
- destinationTokenSymbol,
72952
- recipientAddress,
72953
- destinationChainType,
72954
- destinationChainId,
72955
- destinationTokenAddress,
72956
- onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
72957
- onDepositError: onDepositErrorFor("pay_with_exchange"),
72958
- wallets,
72959
- defaultToken: defaultToken ?? null
72960
- }
72961
- ),
72962
- depositPoweredByFooter
72963
- ] })
72964
- ] }) : view === "coinbase_connect" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
72965
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72966
- CoinbaseConnect,
72967
- {
72968
- publishableKey,
72969
- userId,
72970
- wallets,
72971
- recipientAddress,
72972
- destinationTokenAddress: destinationTokenAddress ?? "",
72973
- destinationChainId: destinationChainId ?? "",
72974
- destinationChainType: destinationChainType ?? "",
72975
- onDepositSuccess: onDepositSuccessFor("exchange_connect"),
72976
- onDepositError: onDepositErrorFor("exchange_connect"),
72977
- onTransferError: (error) => {
72978
- onDepositErrorFor("exchange_connect")?.({
72979
- message: error.message,
72980
- error
72981
- });
72982
- },
72983
- onBack: handleBack,
72984
- onClose: handleClose,
72985
- onDisconnect: handleExchangeDisconnect,
72986
- skipToHoldings: coinbaseSkipToHoldings,
72987
- canGoBack: sessionOpenedFromMenu,
72988
- onExecutionsChange: setDepositExecutions,
72989
- defaultSourceChainType,
72990
- defaultSourceChainId,
72991
- defaultSourceTokenAddress,
72992
- defaultSourceSymbol
72993
- }
72994
- ),
72995
- depositPoweredByFooter
72996
- ] }) : view === "wallet_connect" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
72997
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72998
- WalletConnect,
72999
- {
73000
- walletInfo: browserWalletInfo ?? void 0,
73001
- depositWallet: browserWalletInfo?.depositWallet ?? void 0,
73002
- wallets,
73003
- userId,
73004
- publishableKey,
73005
- assetCdnUrl: projectConfig?.asset_cdn_url,
73006
- projectName: projectConfig?.project_name,
73007
- onError: (error) => {
73008
- onDepositErrorFor("wallet_connect")?.({
73009
- message: error.message,
73010
- error
73011
- });
73012
- },
73013
- onDepositSuccess: onDepositSuccessFor("wallet_connect"),
73014
- onDepositError: onDepositErrorFor("wallet_connect"),
73015
- amountQuickSelect: browserWalletAmountQuickSelect,
73016
- onWalletDisconnect: handleWalletDisconnect,
73017
- onWalletConnected: (info, dw) => {
73018
- setBrowserWalletInfo({ ...info, depositWallet: dw });
73019
- setStoredWalletState(info.type);
73020
- setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
73021
- },
73022
- onBack: handleBack,
73023
- onClose: handleClose,
73024
- defaultSourceChainType,
73025
- defaultSourceChainId,
73026
- defaultSourceTokenAddress,
73027
- defaultSourceSymbol,
73028
- canGoBack: sessionOpenedFromMenu,
73029
- depositWalletsLoading: walletsLoading
73030
- }
73031
- ),
73032
- depositPoweredByFooter
73033
- ] }) : view === "bank_transfer" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
73034
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73035
- DepositHeader,
73036
- {
73037
- title: t8.bankTransfer.title,
73038
- showBack: bankTransferView !== "providers" || sessionOpenedFromMenu,
73039
- onBack: handleBack,
73040
- onClose: handleClose
73041
- }
73042
- ),
73043
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73044
- bankTransferProvidersLoading ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(SkeletonButton, { variant: "with-icons" }) : !hasEnabledBankTransferProvider ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(GeoRestrictionScreen, { methodName: "Bank Transfer" }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73045
- BankTransfer,
73046
- {
73047
- userId,
73048
- publishableKey,
73049
- view: bankTransferView,
73050
- onViewChange: setBankTransferView,
73051
- recipientAddress,
73052
- destinationChainType,
73053
- destinationChainId,
73054
- destinationTokenAddress,
73055
- destinationTokenSymbol,
73056
- wallets,
73057
- defaultToken: defaultToken ?? null,
73058
- assetCdnUrl: projectConfig?.asset_cdn_url,
73059
- onEvent,
73060
- onDepositSuccess,
73061
- onDepositError
73062
- }
73063
- ),
73064
- depositPoweredByFooter
73065
- ] })
73066
- ] }) : view === "stripe_link" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
73067
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73068
- DepositHeader,
73069
- {
73070
- title: "Deposit with Link",
73071
- showBack: stripeLinkStep !== "checkout" && stripeLinkStep !== "success",
73072
- onBack: handleBack,
73073
- showClose: stripeLinkStep !== "checkout",
73074
- onClose: handleClose
73075
- }
73076
- ),
73077
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73078
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73079
- PayWithStripeLink,
73080
- {
73081
- userId,
73082
- publishableKey,
73083
- recipientAddress,
73084
- destinationChainType,
73085
- destinationChainId,
73086
- destinationTokenAddress,
73087
- wallets,
73088
- email: userEmail,
73089
- iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/link.svg` : void 0,
73090
- step: stripeLinkStep,
73091
- onStepChange: setStripeLinkStep,
73092
- backHandlerRef: stripeLinkBackRef,
73093
- onDepositSuccess,
73094
- onDepositError
73095
- }
73096
- ),
73097
- depositPoweredByFooter
73098
- ] })
73099
- ] }) : view === "cashapp" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
73100
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73101
- DepositHeader,
73102
- {
73103
- title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
73104
- showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
73105
- onBack: handleBack,
73106
- onClose: handleClose
73107
- }
73108
- ),
73109
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73110
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73111
- PayWithCashApp,
73112
- {
73113
- userId,
73114
- publishableKey,
73115
- recipientAddress,
73116
- destinationChainType,
73117
- destinationChainId,
73118
- destinationTokenAddress,
73119
- cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
73120
- view: cashAppView,
73121
- onViewChange: setCashAppView,
73122
- onAmountChange: setCashAppAmount,
73123
- onEvent,
73124
- onDepositSuccess: onDepositSuccessFor("cashapp"),
73125
- onDepositError: onDepositErrorFor("cashapp"),
73126
- wallets
73127
- }
73128
- ),
73129
- depositPoweredByFooter
73130
- ] })
73131
- ] }) : view === "apple_pay" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
73132
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73133
- DepositHeader,
73134
- {
73135
- title: applePayHeaderTitle,
73136
- showBack: applePayShowBack,
73137
- onBack: () => {
73138
- const handled = applePayHandleRef.current?.requestBack() ?? false;
73139
- if (!handled) handleBack();
73140
- },
73141
- onClose: handleClose
73142
- }
73143
- ),
73144
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73145
- applePayProvidersLoading ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(SkeletonButton, { variant: "with-icons" }) : !hasEnabledApplePayProvider ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(GeoRestrictionScreen, { methodName: "Apple Pay" }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73146
- BuyWithApplePay,
73147
- {
73148
- ref: applePayHandleRef,
73149
- userId,
73150
- publishableKey,
73151
- destinationChainType,
73152
- destinationChainId,
73153
- destinationTokenAddress,
73154
- userEmail,
73155
- wallets,
73156
- onViewChange: setApplePayView,
73157
- onEvent,
73158
- onDepositSuccess: onDepositSuccessFor("apple_pay"),
73159
- onDepositError: onDepositErrorFor("apple_pay"),
73160
- exitLabel: sessionOpenedFromMenu ? "Return" : "Close",
73161
- onExit: () => {
73162
- if (sessionOpenedFromMenu) {
73163
- setView("main");
73164
- } else {
73165
- handleClose();
72825
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72826
+ ThemeStyleInjector,
72827
+ {
72828
+ className: view === "wallet_connect" ? "uf-flex uf-min-h-0 uf-flex-col" : void 0,
72829
+ children: view === "main" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-min-h-0 uf-max-h-full", children: [
72830
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "uf-flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72831
+ DepositHeader,
72832
+ {
72833
+ title: modalTitle || "Deposit",
72834
+ showClose: !hideOverlay,
72835
+ onClose: handleClose,
72836
+ showBalance: showBalanceHeader,
72837
+ balanceAddress: recipientAddress,
72838
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
72839
+ balanceChainId: destinationChainId,
72840
+ balanceTokenAddress: destinationTokenAddress,
72841
+ projectName: projectConfig?.project_name,
72842
+ publishableKey
72843
+ }
72844
+ ) }),
72845
+ renderMainMenuBody(),
72846
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "uf-flex-shrink-0", children: depositPoweredByFooter })
72847
+ ] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
72848
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72849
+ DepositHeader,
72850
+ {
72851
+ title: transferCryptoTitle,
72852
+ showBack: showBackTransfer,
72853
+ onBack: handleBack,
72854
+ onClose: handleClose,
72855
+ showBalance: showBalanceHeader,
72856
+ balanceAddress: recipientAddress,
72857
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
72858
+ balanceChainId: destinationChainId,
72859
+ balanceTokenAddress: destinationTokenAddress,
72860
+ projectName: projectConfig?.project_name,
72861
+ publishableKey
72862
+ }
72863
+ ),
72864
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
72865
+ standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72866
+ TransferCryptoSingleInput,
72867
+ {
72868
+ userId,
72869
+ publishableKey,
72870
+ recipientAddress,
72871
+ destinationChainType,
72872
+ destinationChainId,
72873
+ destinationTokenAddress,
72874
+ defaultSourceChainType,
72875
+ defaultSourceChainId,
72876
+ defaultSourceTokenAddress,
72877
+ defaultSourceSymbol,
72878
+ depositConfirmationMode,
72879
+ onExecutionsChange: setDepositExecutions,
72880
+ onDepositSuccess: onDepositSuccessFor("transfer"),
72881
+ onDepositError: onDepositErrorFor("transfer"),
72882
+ wallets
72883
+ }
72884
+ ) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72885
+ TransferCryptoDoubleInput,
72886
+ {
72887
+ userId,
72888
+ publishableKey,
72889
+ recipientAddress,
72890
+ destinationChainType,
72891
+ destinationChainId,
72892
+ destinationTokenAddress,
72893
+ defaultSourceChainType,
72894
+ defaultSourceChainId,
72895
+ defaultSourceTokenAddress,
72896
+ defaultSourceSymbol,
72897
+ depositConfirmationMode,
72898
+ onExecutionsChange: setDepositExecutions,
72899
+ onDepositSuccess: onDepositSuccessFor("transfer"),
72900
+ onDepositError: onDepositErrorFor("transfer"),
72901
+ wallets
73166
72902
  }
72903
+ ),
72904
+ depositPoweredByFooter
72905
+ ] })
72906
+ ] }) : view === "tracker" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
72907
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72908
+ DepositHeader,
72909
+ {
72910
+ title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
72911
+ showBack: showBackTracker,
72912
+ onBack: handleBack,
72913
+ onClose: handleClose
73167
72914
  }
73168
- }
73169
- ),
73170
- depositPoweredByFooter
73171
- ] })
73172
- ] }) : null })
72915
+ ),
72916
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
72917
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "uf-h-[460px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(DepositDetailContent, { execution: selectedExecution }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "uf-space-y-2 uf-pb-8", children: allExecutions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72918
+ "div",
72919
+ {
72920
+ className: "uf-text-sm",
72921
+ style: {
72922
+ color: components.container.subtitleColor,
72923
+ fontFamily: fonts.regular
72924
+ },
72925
+ children: "No deposits yet"
72926
+ }
72927
+ ) }) : allExecutions.map((execution) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72928
+ DepositExecutionItem,
72929
+ {
72930
+ execution,
72931
+ onClick: () => setSelectedExecution(execution)
72932
+ },
72933
+ execution.id
72934
+ )) }) }),
72935
+ depositPoweredByFooter
72936
+ ] })
72937
+ ] }) : view === "card" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
72938
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72939
+ DepositHeader,
72940
+ {
72941
+ title: cardView === "quotes" ? t8.quotes : depositWithCardTitle,
72942
+ showBack: showBackCard,
72943
+ onBack: handleBack,
72944
+ onClose: handleClose,
72945
+ badge: cardView === "quotes" ? { count: quotesCount } : void 0,
72946
+ showBalance: showBalanceHeader,
72947
+ balanceAddress: recipientAddress,
72948
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
72949
+ balanceChainId: destinationChainId,
72950
+ balanceTokenAddress: destinationTokenAddress,
72951
+ projectName: projectConfig?.project_name,
72952
+ publishableKey
72953
+ }
72954
+ ),
72955
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
72956
+ standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : !showFiatOnramp ? (
72957
+ // Fiat on-ramp resolved hidden/disabled after a direct open
72958
+ // (e.g. platform `is_hidden` for a Stripe Link-only project).
72959
+ // Show a geo-restriction screen rather than the card UI so the
72960
+ // hard-hide is honoured without a flash of "Pay with Card".
72961
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(GeoRestrictionScreen, { methodName: "Card" })
72962
+ ) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72963
+ BuyWithCard,
72964
+ {
72965
+ userId,
72966
+ publishableKey,
72967
+ view: cardView,
72968
+ onViewChange: handleCardViewChange,
72969
+ destinationTokenSymbol,
72970
+ recipientAddress,
72971
+ destinationChainType,
72972
+ destinationChainId,
72973
+ destinationTokenAddress,
72974
+ onDepositSuccess: onDepositSuccessFor("card"),
72975
+ onDepositError: onDepositErrorFor("card"),
72976
+ onEvent,
72977
+ themeClass,
72978
+ wallets,
72979
+ assetCdnUrl: projectConfig?.asset_cdn_url,
72980
+ hideDepositFlowInfo,
72981
+ hideDisplayDescription
72982
+ }
72983
+ ),
72984
+ depositPoweredByFooter
72985
+ ] })
72986
+ ] }) : view === "exchange" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
72987
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72988
+ DepositHeader,
72989
+ {
72990
+ title: payWithExchangeTitle,
72991
+ showBack: exchangeView === "pending" || sessionOpenedFromMenu,
72992
+ onBack: handleBack,
72993
+ onClose: handleClose
72994
+ }
72995
+ ),
72996
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
72997
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
72998
+ PayWithExchange,
72999
+ {
73000
+ userId,
73001
+ publishableKey,
73002
+ exchanges,
73003
+ view: exchangeView,
73004
+ onViewChange: setExchangeView,
73005
+ destinationTokenSymbol,
73006
+ recipientAddress,
73007
+ destinationChainType,
73008
+ destinationChainId,
73009
+ destinationTokenAddress,
73010
+ onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
73011
+ onDepositError: onDepositErrorFor("pay_with_exchange"),
73012
+ wallets,
73013
+ defaultToken: defaultToken ?? null
73014
+ }
73015
+ ),
73016
+ depositPoweredByFooter
73017
+ ] })
73018
+ ] }) : view === "coinbase_connect" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73019
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73020
+ CoinbaseConnect,
73021
+ {
73022
+ publishableKey,
73023
+ userId,
73024
+ wallets,
73025
+ recipientAddress,
73026
+ destinationTokenAddress: destinationTokenAddress ?? "",
73027
+ destinationChainId: destinationChainId ?? "",
73028
+ destinationChainType: destinationChainType ?? "",
73029
+ onDepositSuccess: onDepositSuccessFor("exchange_connect"),
73030
+ onDepositError: onDepositErrorFor("exchange_connect"),
73031
+ onTransferError: (error) => {
73032
+ onDepositErrorFor("exchange_connect")?.({
73033
+ message: error.message,
73034
+ error
73035
+ });
73036
+ },
73037
+ onBack: handleBack,
73038
+ onClose: handleClose,
73039
+ onDisconnect: handleExchangeDisconnect,
73040
+ skipToHoldings: coinbaseSkipToHoldings,
73041
+ canGoBack: sessionOpenedFromMenu,
73042
+ onExecutionsChange: setDepositExecutions,
73043
+ defaultSourceChainType,
73044
+ defaultSourceChainId,
73045
+ defaultSourceTokenAddress,
73046
+ defaultSourceSymbol
73047
+ }
73048
+ ),
73049
+ depositPoweredByFooter
73050
+ ] }) : view === "wallet_connect" ? (
73051
+ // Mobile: flex-fill the full-height dialog body so the wallet list
73052
+ // can grow and scroll, with the footer pinned to the bottom.
73053
+ // Desktop (sm:): stays content-sized.
73054
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
73055
+ "div",
73056
+ {
73057
+ className: "uf-flex uf-flex-col uf-gap-1.5 uf-min-h-0 uf-flex-1 sm:uf-flex-none",
73058
+ children: [
73059
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73060
+ WalletConnect,
73061
+ {
73062
+ walletInfo: browserWalletInfo ?? void 0,
73063
+ depositWallet: browserWalletInfo?.depositWallet ?? void 0,
73064
+ wallets,
73065
+ userId,
73066
+ publishableKey,
73067
+ assetCdnUrl: projectConfig?.asset_cdn_url,
73068
+ projectName: projectConfig?.project_name,
73069
+ onError: (error) => {
73070
+ onDepositErrorFor("wallet_connect")?.({
73071
+ message: error.message,
73072
+ error
73073
+ });
73074
+ },
73075
+ onDepositSuccess: onDepositSuccessFor("wallet_connect"),
73076
+ onDepositError: onDepositErrorFor("wallet_connect"),
73077
+ amountQuickSelect: browserWalletAmountQuickSelect,
73078
+ onWalletDisconnect: handleWalletDisconnect,
73079
+ onWalletConnected: (info, dw) => {
73080
+ setBrowserWalletInfo({ ...info, depositWallet: dw });
73081
+ setStoredWalletState(info.type);
73082
+ setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
73083
+ },
73084
+ onBack: handleBack,
73085
+ onClose: handleClose,
73086
+ defaultSourceChainType,
73087
+ defaultSourceChainId,
73088
+ defaultSourceTokenAddress,
73089
+ defaultSourceSymbol,
73090
+ canGoBack: sessionOpenedFromMenu,
73091
+ depositWalletsLoading: walletsLoading
73092
+ }
73093
+ ),
73094
+ depositPoweredByFooter
73095
+ ]
73096
+ }
73097
+ )
73098
+ ) : view === "bank_transfer" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
73099
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73100
+ DepositHeader,
73101
+ {
73102
+ title: t8.bankTransfer.title,
73103
+ showBack: bankTransferView !== "providers" || sessionOpenedFromMenu,
73104
+ onBack: handleBack,
73105
+ onClose: handleClose
73106
+ }
73107
+ ),
73108
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73109
+ bankTransferProvidersLoading ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(SkeletonButton, { variant: "with-icons" }) : !hasEnabledBankTransferProvider ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(GeoRestrictionScreen, { methodName: "Bank Transfer" }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73110
+ BankTransfer,
73111
+ {
73112
+ userId,
73113
+ publishableKey,
73114
+ view: bankTransferView,
73115
+ onViewChange: setBankTransferView,
73116
+ recipientAddress,
73117
+ destinationChainType,
73118
+ destinationChainId,
73119
+ destinationTokenAddress,
73120
+ destinationTokenSymbol,
73121
+ wallets,
73122
+ defaultToken: defaultToken ?? null,
73123
+ assetCdnUrl: projectConfig?.asset_cdn_url,
73124
+ onEvent,
73125
+ onDepositSuccess,
73126
+ onDepositError
73127
+ }
73128
+ ),
73129
+ depositPoweredByFooter
73130
+ ] })
73131
+ ] }) : view === "stripe_link" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
73132
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73133
+ DepositHeader,
73134
+ {
73135
+ title: "Deposit with Link",
73136
+ showBack: stripeLinkStep !== "checkout" && stripeLinkStep !== "success",
73137
+ onBack: handleBack,
73138
+ showClose: stripeLinkStep !== "checkout",
73139
+ onClose: handleClose
73140
+ }
73141
+ ),
73142
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73143
+ isLoadingIp ? (
73144
+ // Hold the geo decision until IP resolves so we don't mount
73145
+ // PayWithStripeLink (which kicks off config/OAuth work) for a
73146
+ // deep-link user who turns out to be outside the US.
73147
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(SkeletonButton, { variant: "with-icons" })
73148
+ ) : !showStripeLink ? (
73149
+ // Stripe Link's crypto on-ramp is US-only. On a direct open
73150
+ // (initialScreen="stripe_link") the row isn't in a menu to
73151
+ // fall back to, so show a geo-restriction screen rather than
73152
+ // the Link UI.
73153
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73154
+ GeoRestrictionScreen,
73155
+ {
73156
+ methodName: t8.stripeLink.title,
73157
+ message: "Pay with Link is only available in the US."
73158
+ }
73159
+ )
73160
+ ) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73161
+ PayWithStripeLink,
73162
+ {
73163
+ userId,
73164
+ publishableKey,
73165
+ recipientAddress,
73166
+ destinationChainType,
73167
+ destinationChainId,
73168
+ destinationTokenAddress,
73169
+ wallets,
73170
+ email: userEmail,
73171
+ iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/link.svg` : void 0,
73172
+ step: stripeLinkStep,
73173
+ onStepChange: setStripeLinkStep,
73174
+ backHandlerRef: stripeLinkBackRef,
73175
+ onDepositSuccess,
73176
+ onDepositError
73177
+ }
73178
+ ),
73179
+ depositPoweredByFooter
73180
+ ] })
73181
+ ] }) : view === "cashapp" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
73182
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73183
+ DepositHeader,
73184
+ {
73185
+ title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
73186
+ showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
73187
+ onBack: handleBack,
73188
+ onClose: handleClose
73189
+ }
73190
+ ),
73191
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73192
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73193
+ PayWithCashApp,
73194
+ {
73195
+ userId,
73196
+ publishableKey,
73197
+ recipientAddress,
73198
+ destinationChainType,
73199
+ destinationChainId,
73200
+ destinationTokenAddress,
73201
+ cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
73202
+ view: cashAppView,
73203
+ onViewChange: setCashAppView,
73204
+ onAmountChange: setCashAppAmount,
73205
+ onEvent,
73206
+ onDepositSuccess: onDepositSuccessFor("cashapp"),
73207
+ onDepositError: onDepositErrorFor("cashapp"),
73208
+ wallets
73209
+ }
73210
+ ),
73211
+ depositPoweredByFooter
73212
+ ] })
73213
+ ] }) : view === "apple_pay" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
73214
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73215
+ DepositHeader,
73216
+ {
73217
+ title: applePayHeaderTitle,
73218
+ showBack: applePayShowBack,
73219
+ onBack: () => {
73220
+ const handled = applePayHandleRef.current?.requestBack() ?? false;
73221
+ if (!handled) handleBack();
73222
+ },
73223
+ onClose: handleClose
73224
+ }
73225
+ ),
73226
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73227
+ applePayProvidersLoading ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(SkeletonButton, { variant: "with-icons" }) : !hasEnabledApplePayProvider ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(GeoRestrictionScreen, { methodName: "Apple Pay" }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
73228
+ BuyWithApplePay,
73229
+ {
73230
+ ref: applePayHandleRef,
73231
+ userId,
73232
+ publishableKey,
73233
+ destinationChainType,
73234
+ destinationChainId,
73235
+ destinationTokenAddress,
73236
+ userEmail,
73237
+ wallets,
73238
+ onViewChange: setApplePayView,
73239
+ onEvent,
73240
+ onDepositSuccess: onDepositSuccessFor("apple_pay"),
73241
+ onDepositError: onDepositErrorFor("apple_pay"),
73242
+ exitLabel: sessionOpenedFromMenu ? "Return" : "Close",
73243
+ onExit: () => {
73244
+ if (sessionOpenedFromMenu) {
73245
+ setView("main");
73246
+ } else {
73247
+ handleClose();
73248
+ }
73249
+ }
73250
+ }
73251
+ ),
73252
+ depositPoweredByFooter
73253
+ ] })
73254
+ ] }) : null
73255
+ }
73256
+ )
73173
73257
  ]
73174
73258
  }
73175
73259
  )
@@ -73608,253 +73692,275 @@ function CheckoutModal({
73608
73692
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(PortalContainerProvider, { value: null, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Dialog2, { open, onOpenChange: handleClose, modal: true, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73609
73693
  DialogContent2,
73610
73694
  {
73611
- 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}`,
73695
+ 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
73696
+ // grid whose single auto row only grows to fill free space and never
73697
+ // shrinks below content, so a long wallet list would balloon the row
73698
+ // past the viewport and push the footer off-screen. Clamp the row to
73699
+ // the modal height with minmax(0,1fr) so the inner overflow-y-auto list
73700
+ // scrolls with the footer pinned. Reset to content-sized on desktop.
73701
+ view === "wallet_connect" ? "[grid-template-rows:minmax(0,1fr)] sm:[grid-template-rows:none]" : ""} ${themeClass}`,
73612
73702
  style: { backgroundColor: colors2.background },
73613
73703
  onPointerDownOutside: (e) => e.preventDefault(),
73614
73704
  onInteractOutside: (e) => e.preventDefault(),
73615
- children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ThemeStyleInjector, { children: view === "main" ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
73616
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(DepositHeader, { title: modalTitle || "Checkout", showClose: true, onClose: handleClose }),
73617
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73618
- piLoading ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-space-y-3", children: [
73619
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73620
- "div",
73621
- {
73622
- className: "uf-rounded-xl uf-p-4 uf-animate-pulse",
73623
- style: {
73624
- backgroundColor: components.card.backgroundColor,
73625
- borderRadius: components.card.borderRadius,
73626
- border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
73627
- },
73628
- children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-gap-2", children: [
73629
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73630
- "div",
73705
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73706
+ ThemeStyleInjector,
73707
+ {
73708
+ className: view === "wallet_connect" ? "uf-flex uf-min-h-0 uf-flex-col" : void 0,
73709
+ children: view === "main" ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
73710
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(DepositHeader, { title: modalTitle || "Checkout", showClose: true, onClose: handleClose }),
73711
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73712
+ piLoading ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-space-y-3", children: [
73713
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73714
+ "div",
73715
+ {
73716
+ className: "uf-rounded-xl uf-p-4 uf-animate-pulse",
73717
+ style: {
73718
+ backgroundColor: components.card.backgroundColor,
73719
+ borderRadius: components.card.borderRadius,
73720
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
73721
+ },
73722
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-gap-2", children: [
73723
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73724
+ "div",
73725
+ {
73726
+ className: "uf-h-8 uf-w-24 uf-rounded",
73727
+ style: {
73728
+ backgroundColor: components.card.borderColor
73729
+ }
73730
+ }
73731
+ ),
73732
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73733
+ "div",
73734
+ {
73735
+ className: "uf-h-4 uf-w-16 uf-rounded",
73736
+ style: {
73737
+ backgroundColor: components.card.borderColor
73738
+ }
73739
+ }
73740
+ )
73741
+ ] })
73742
+ }
73743
+ ),
73744
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SkeletonButton2, {}),
73745
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SkeletonButton2, {})
73746
+ ] }) : piError ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
73747
+ /* @__PURE__ */ (0, import_jsx_runtime83.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_runtime83.jsx)(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
73748
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73749
+ "h3",
73750
+ {
73751
+ className: "uf-text-lg uf-font-semibold uf-mb-2",
73752
+ style: {
73753
+ color: colors2.foreground,
73754
+ fontFamily: fonts.semibold
73755
+ },
73756
+ children: "Unable to Load Checkout"
73757
+ }
73758
+ ),
73759
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73760
+ "p",
73761
+ {
73762
+ className: "uf-text-sm uf-max-w-[280px]",
73763
+ style: {
73764
+ color: colors2.foregroundMuted,
73765
+ fontFamily: fonts.regular
73766
+ },
73767
+ children: piError instanceof Error ? piError.message : "Something went wrong. Please try again."
73768
+ }
73769
+ )
73770
+ ] }) : paymentIntent ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-space-y-3", children: [
73771
+ progressSection,
73772
+ (paymentIntent.status === "requires_payment" || paymentIntent.status === "processing") && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
73773
+ showTransferCrypto && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73774
+ TransferCryptoButton,
73631
73775
  {
73632
- className: "uf-h-8 uf-w-24 uf-rounded",
73633
- style: {
73634
- backgroundColor: components.card.borderColor
73635
- }
73776
+ onClick: () => {
73777
+ lastCheckoutMethodRef.current = "transfer";
73778
+ setView("transfer");
73779
+ },
73780
+ title: i18n2.checkoutModal.transferCrypto.title,
73781
+ subtitle: i18n2.checkoutModal.transferCrypto.subtitle,
73782
+ featuredTokens: projectConfig?.transfer_crypto.networks
73636
73783
  }
73637
73784
  ),
73638
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73639
- "div",
73785
+ showConnectWallet && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73786
+ BrowserWalletButton,
73640
73787
  {
73641
- className: "uf-h-4 uf-w-16 uf-rounded",
73642
- style: {
73643
- backgroundColor: components.card.borderColor
73644
- }
73788
+ onClick: handleBrowserWalletClick,
73789
+ onConnectClick: handleWalletConnectClick,
73790
+ onDisconnect: handleWalletDisconnect,
73791
+ chainType: browserWalletChainType,
73792
+ publishableKey,
73793
+ featuredWallets: projectConfig?.connect_wallet?.wallets,
73794
+ subtitle: i18n2.checkoutModal.browserWallet.subtitle
73645
73795
  }
73646
73796
  )
73647
73797
  ] })
73648
- }
73649
- ),
73650
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SkeletonButton2, {}),
73651
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SkeletonButton2, {})
73652
- ] }) : piError ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
73653
- /* @__PURE__ */ (0, import_jsx_runtime83.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_runtime83.jsx)(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
73798
+ ] }) : null,
73799
+ poweredByFooter
73800
+ ] })
73801
+ ] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
73654
73802
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73655
- "h3",
73803
+ DepositHeader,
73656
73804
  {
73657
- className: "uf-text-lg uf-font-semibold uf-mb-2",
73658
- style: {
73659
- color: colors2.foreground,
73660
- fontFamily: fonts.semibold
73661
- },
73662
- children: "Unable to Load Checkout"
73805
+ title: modalTitle || "Checkout",
73806
+ showBack: true,
73807
+ onBack: handleBack,
73808
+ onClose: handleClose
73663
73809
  }
73664
73810
  ),
73665
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73666
- "p",
73667
- {
73668
- className: "uf-text-sm uf-max-w-[280px]",
73669
- style: {
73670
- color: colors2.foregroundMuted,
73671
- fontFamily: fonts.regular
73672
- },
73673
- children: piError instanceof Error ? piError.message : "Something went wrong. Please try again."
73674
- }
73675
- )
73676
- ] }) : paymentIntent ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-space-y-3", children: [
73677
- progressSection,
73678
- (paymentIntent.status === "requires_payment" || paymentIntent.status === "processing") && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
73679
- showTransferCrypto && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73680
- TransferCryptoButton,
73681
- {
73682
- onClick: () => {
73683
- lastCheckoutMethodRef.current = "transfer";
73684
- setView("transfer");
73685
- },
73686
- title: i18n2.checkoutModal.transferCrypto.title,
73687
- subtitle: i18n2.checkoutModal.transferCrypto.subtitle,
73688
- featuredTokens: projectConfig?.transfer_crypto.networks
73689
- }
73690
- ),
73691
- showConnectWallet && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73692
- BrowserWalletButton,
73693
- {
73694
- onClick: handleBrowserWalletClick,
73695
- onConnectClick: handleWalletConnectClick,
73696
- onDisconnect: handleWalletDisconnect,
73697
- chainType: browserWalletChainType,
73698
- publishableKey,
73699
- featuredWallets: projectConfig?.connect_wallet?.wallets,
73700
- subtitle: i18n2.checkoutModal.browserWallet.subtitle
73701
- }
73702
- )
73703
- ] })
73704
- ] }) : null,
73705
- poweredByFooter
73706
- ] })
73707
- ] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
73708
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73709
- DepositHeader,
73710
- {
73711
- title: modalTitle || "Checkout",
73712
- showBack: true,
73713
- onBack: handleBack,
73714
- onClose: handleClose
73715
- }
73716
- ),
73717
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73718
- paymentIntent ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
73719
- (() => {
73720
- const receivedUsd = parseFloat(
73721
- paymentIntent.destination_amount_received_usd || paymentIntent.amount_received_usd
73722
- );
73723
- const totalUsd = parseFloat(
73724
- paymentIntent.destination_amount_usd || paymentIntent.amount_usd
73725
- );
73726
- const pct = totalUsd > 0 ? Math.min(receivedUsd / totalUsd * 100, 100) : 0;
73727
- return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-space-y-2", children: [
73728
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between", children: [
73729
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73730
- "span",
73731
- {
73732
- className: "uf-text-xs",
73733
- style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
73734
- children: "Received"
73735
- }
73736
- ),
73737
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
73738
- "span",
73739
- {
73740
- className: "uf-text-xs",
73741
- style: { color: colors2.foreground, fontFamily: fonts.medium },
73742
- children: [
73743
- "$",
73744
- receivedUsd.toFixed(2),
73745
- " / $",
73746
- totalUsd.toFixed(2)
73747
- ]
73748
- }
73749
- )
73750
- ] }),
73751
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73752
- "div",
73753
- {
73754
- className: "uf-w-full uf-h-1.5 uf-rounded-full uf-overflow-hidden",
73755
- style: { backgroundColor: colors2.border },
73756
- children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73811
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73812
+ paymentIntent ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
73813
+ (() => {
73814
+ const receivedUsd = parseFloat(
73815
+ paymentIntent.destination_amount_received_usd || paymentIntent.amount_received_usd
73816
+ );
73817
+ const totalUsd = parseFloat(
73818
+ paymentIntent.destination_amount_usd || paymentIntent.amount_usd
73819
+ );
73820
+ const pct = totalUsd > 0 ? Math.min(receivedUsd / totalUsd * 100, 100) : 0;
73821
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-space-y-2", children: [
73822
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between", children: [
73823
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73824
+ "span",
73825
+ {
73826
+ className: "uf-text-xs",
73827
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
73828
+ children: "Received"
73829
+ }
73830
+ ),
73831
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
73832
+ "span",
73833
+ {
73834
+ className: "uf-text-xs",
73835
+ style: { color: colors2.foreground, fontFamily: fonts.medium },
73836
+ children: [
73837
+ "$",
73838
+ receivedUsd.toFixed(2),
73839
+ " / $",
73840
+ totalUsd.toFixed(2)
73841
+ ]
73842
+ }
73843
+ )
73844
+ ] }),
73845
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73757
73846
  "div",
73758
73847
  {
73759
- className: "uf-h-full uf-rounded-full uf-transition-all uf-duration-500",
73760
- style: {
73761
- width: `${pct}%`,
73762
- backgroundColor: paymentIntent.status === "succeeded" ? "rgb(34, 197, 94)" : colors2.primary
73763
- }
73848
+ className: "uf-w-full uf-h-1.5 uf-rounded-full uf-overflow-hidden",
73849
+ style: { backgroundColor: colors2.border },
73850
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73851
+ "div",
73852
+ {
73853
+ className: "uf-h-full uf-rounded-full uf-transition-all uf-duration-500",
73854
+ style: {
73855
+ width: `${pct}%`,
73856
+ backgroundColor: paymentIntent.status === "succeeded" ? "rgb(34, 197, 94)" : colors2.primary
73857
+ }
73858
+ }
73859
+ )
73764
73860
  }
73765
73861
  )
73862
+ ] });
73863
+ })(),
73864
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73865
+ TransferCryptoSingleInput,
73866
+ {
73867
+ userId: paymentIntent.user_id || "",
73868
+ publishableKey,
73869
+ clientSecret,
73870
+ recipientAddress: paymentIntent.recipient_address,
73871
+ destinationChainType: paymentIntent.destination_chain_type,
73872
+ destinationChainId: paymentIntent.destination_chain_id,
73873
+ destinationTokenAddress: paymentIntent.destination_token_address,
73874
+ defaultSourceChainType,
73875
+ defaultSourceChainId,
73876
+ defaultSourceTokenAddress,
73877
+ defaultSourceSymbol,
73878
+ depositConfirmationMode: "auto_ui",
73879
+ wallets,
73880
+ onSourceTokenChange: setSelectedSource,
73881
+ persistCheckingIndicator: true,
73882
+ productType: "payment",
73883
+ checkoutQuote: effectiveCheckoutQuote,
73884
+ isCheckoutQuoteLoading: isQuoteLoading || isQuoteFetching
73766
73885
  }
73767
73886
  )
73768
- ] });
73769
- })(),
73770
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73771
- TransferCryptoSingleInput,
73887
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SkeletonButton2, {}),
73888
+ poweredByFooter
73889
+ ] })
73890
+ ] }) : view === "wallet_connect" && paymentIntent ? (
73891
+ // Mobile: flex-fill the full-height sheet so the wallet list grows and
73892
+ // scrolls with the footer pinned. Desktop (sm:): content-sized.
73893
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
73894
+ "div",
73772
73895
  {
73773
- userId: paymentIntent.user_id || "",
73774
- publishableKey,
73775
- clientSecret,
73776
- recipientAddress: paymentIntent.recipient_address,
73777
- destinationChainType: paymentIntent.destination_chain_type,
73778
- destinationChainId: paymentIntent.destination_chain_id,
73779
- destinationTokenAddress: paymentIntent.destination_token_address,
73780
- defaultSourceChainType,
73781
- defaultSourceChainId,
73782
- defaultSourceTokenAddress,
73783
- defaultSourceSymbol,
73784
- depositConfirmationMode: "auto_ui",
73785
- wallets,
73786
- onSourceTokenChange: setSelectedSource,
73787
- persistCheckingIndicator: true,
73788
- productType: "payment",
73789
- checkoutQuote: effectiveCheckoutQuote,
73790
- isCheckoutQuoteLoading: isQuoteLoading || isQuoteFetching
73896
+ className: "uf-flex uf-flex-col uf-gap-1.5 uf-min-h-0 uf-flex-1 sm:uf-flex-none",
73897
+ children: [
73898
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73899
+ WalletConnect,
73900
+ {
73901
+ walletInfo: browserWalletInfo ?? void 0,
73902
+ depositWallet: browserWalletInfo?.depositWallet ?? void 0,
73903
+ wallets,
73904
+ userId: paymentIntent.user_id || "",
73905
+ publishableKey,
73906
+ clientSecret,
73907
+ prefillAmountUsd: remainingAmountUsd,
73908
+ checkoutAmountUsd: paymentIntent.amount_usd,
73909
+ checkoutReceivedUsd: paymentIntent.amount_received_usd,
73910
+ checkoutDestination: {
73911
+ chainType: paymentIntent.destination_chain_type,
73912
+ chainId: paymentIntent.destination_chain_id,
73913
+ tokenAddress: paymentIntent.destination_token_address,
73914
+ decimals: paymentIntent.destination_token_decimals ?? 6
73915
+ },
73916
+ productType: "payment",
73917
+ stablecoinParity: paymentIntent.stablecoin_parity ?? false,
73918
+ checkoutRemainingBaseUnits: (() => {
73919
+ const remaining = BigInt(paymentIntent.amount) - BigInt(paymentIntent.amount_received);
73920
+ return remaining > 0n ? remaining.toString() : "0";
73921
+ })(),
73922
+ onSuccess: (_txHash) => {
73923
+ emitCheckoutSuccess(
73924
+ {
73925
+ paymentIntentId: paymentIntent.id,
73926
+ status: "processing",
73927
+ paymentIntent
73928
+ },
73929
+ "wallet_connect"
73930
+ );
73931
+ },
73932
+ onError: (error) => {
73933
+ onCheckoutError?.({
73934
+ message: error.message,
73935
+ error,
73936
+ method: "wallet_connect"
73937
+ });
73938
+ },
73939
+ onWalletDisconnect: handleWalletDisconnect,
73940
+ onWalletConnected: (info, dw) => {
73941
+ setBrowserWalletInfo({ ...info, depositWallet: dw });
73942
+ setStoredWalletState(info.type);
73943
+ setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
73944
+ lastCheckoutMethodRef.current = "wallet_connect";
73945
+ },
73946
+ onNewDeposit: () => setView("main"),
73947
+ onDone: () => setView("main"),
73948
+ paymentIntentStatus: paymentIntent.status,
73949
+ onBack: handleBack,
73950
+ onClose: handleClose,
73951
+ defaultSourceChainType,
73952
+ defaultSourceChainId,
73953
+ defaultSourceTokenAddress,
73954
+ defaultSourceSymbol
73955
+ }
73956
+ ),
73957
+ poweredByFooter
73958
+ ]
73791
73959
  }
73792
73960
  )
73793
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SkeletonButton2, {}),
73794
- poweredByFooter
73795
- ] })
73796
- ] }) : view === "wallet_connect" && paymentIntent ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
73797
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
73798
- WalletConnect,
73799
- {
73800
- walletInfo: browserWalletInfo ?? void 0,
73801
- depositWallet: browserWalletInfo?.depositWallet ?? void 0,
73802
- wallets,
73803
- userId: paymentIntent.user_id || "",
73804
- publishableKey,
73805
- clientSecret,
73806
- prefillAmountUsd: remainingAmountUsd,
73807
- checkoutAmountUsd: paymentIntent.amount_usd,
73808
- checkoutReceivedUsd: paymentIntent.amount_received_usd,
73809
- checkoutDestination: {
73810
- chainType: paymentIntent.destination_chain_type,
73811
- chainId: paymentIntent.destination_chain_id,
73812
- tokenAddress: paymentIntent.destination_token_address,
73813
- decimals: paymentIntent.destination_token_decimals ?? 6
73814
- },
73815
- productType: "payment",
73816
- stablecoinParity: paymentIntent.stablecoin_parity ?? false,
73817
- checkoutRemainingBaseUnits: (() => {
73818
- const remaining = BigInt(paymentIntent.amount) - BigInt(paymentIntent.amount_received);
73819
- return remaining > 0n ? remaining.toString() : "0";
73820
- })(),
73821
- onSuccess: (_txHash) => {
73822
- emitCheckoutSuccess(
73823
- {
73824
- paymentIntentId: paymentIntent.id,
73825
- status: "processing",
73826
- paymentIntent
73827
- },
73828
- "wallet_connect"
73829
- );
73830
- },
73831
- onError: (error) => {
73832
- onCheckoutError?.({
73833
- message: error.message,
73834
- error,
73835
- method: "wallet_connect"
73836
- });
73837
- },
73838
- onWalletDisconnect: handleWalletDisconnect,
73839
- onWalletConnected: (info, dw) => {
73840
- setBrowserWalletInfo({ ...info, depositWallet: dw });
73841
- setStoredWalletState(info.type);
73842
- setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
73843
- lastCheckoutMethodRef.current = "wallet_connect";
73844
- },
73845
- onNewDeposit: () => setView("main"),
73846
- onDone: () => setView("main"),
73847
- paymentIntentStatus: paymentIntent.status,
73848
- onBack: handleBack,
73849
- onClose: handleClose,
73850
- defaultSourceChainType,
73851
- defaultSourceChainId,
73852
- defaultSourceTokenAddress,
73853
- defaultSourceSymbol
73854
- }
73855
- ),
73856
- poweredByFooter
73857
- ] }) : null })
73961
+ ) : null
73962
+ }
73963
+ )
73858
73964
  }
73859
73965
  ) }) });
73860
73966
  }