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