@fluent.xyz/connect 0.1.4 → 0.1.5

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
@@ -15,18 +15,20 @@ import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
15
15
  import { createAppKit, useAppKit } from '@reown/appkit/react';
16
16
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
17
17
  import { WagmiProvider, useAccount, useDisconnect, useWalletClient, useSwitchChain } from 'wagmi';
18
+ import { coinbaseWallet, baseAccount } from 'wagmi/connectors';
18
19
  import { Button as Button$1 } from '@base-ui/react/button';
19
20
  import { cva } from 'class-variance-authority';
20
21
  import { clsx } from 'clsx';
21
22
  import { twMerge } from 'tailwind-merge';
22
23
  import { Dialog as Dialog$1 } from '@base-ui/react/dialog';
23
- import { XIcon, Loader2, ExternalLink, Copy, LogOut, ChevronDownIcon, CheckIcon, ChevronUpIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon, Loader2Icon } from 'lucide-react';
24
+ import { XIcon, Loader2, ChevronLeft, ExternalLink, Copy, Settings, LogOut, ChevronDownIcon, CheckIcon, Loader2Icon, ChevronUpIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon } from 'lucide-react';
24
25
  import { openSwapperModal } from '@swapper-finance/deposit-sdk';
25
26
  import { Separator as Separator$1 } from '@base-ui/react/separator';
26
27
  import { Select as Select$1 } from '@base-ui/react/select';
27
28
  import { Switch as Switch$1 } from '@base-ui/react/switch';
28
29
  import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
29
30
  import { Toast as Toast$1 } from '@base-ui/react/toast';
31
+ import { Tooltip as Tooltip$1 } from '@base-ui/react/tooltip';
30
32
  import { Drawer as Drawer$1 } from '@base-ui/react/drawer';
31
33
 
32
34
  var __defProp = Object.defineProperty;
@@ -46,33 +48,6 @@ var fluentBridgeAbi = [
46
48
  }
47
49
  ];
48
50
 
49
- // ../registry/data/chains/fluent-devnet.json
50
- var fluent_devnet_default = {
51
- id: "fluent-devnet",
52
- name: "Fluent Developer Preview",
53
- chainId: 20993,
54
- testnet: true,
55
- nativeCurrency: {
56
- name: "Ether",
57
- symbol: "ETH",
58
- decimals: 18
59
- },
60
- rpcUrls: {
61
- default: {
62
- http: ["https://rpc.devnet.fluent.xyz/"],
63
- webSocket: ["wss://rpc.dev.gblend.xyz/ws"]
64
- }
65
- },
66
- blockExplorers: {
67
- default: {
68
- name: "Fluentscan Devnet",
69
- url: "https://devnet.fluentscan.xyz"
70
- }
71
- },
72
- infoURL: "https://docs.fluent.xyz/",
73
- faucets: ["https://testnet.fluent.xyz/dev-portal"]
74
- };
75
-
76
51
  // ../registry/data/chains/fluent-mainnet.json
77
52
  var fluent_mainnet_default = {
78
53
  id: "fluent-mainnet",
@@ -4384,7 +4359,6 @@ function parse(schema, value) {
4384
4359
  return schema.parse(value);
4385
4360
  }
4386
4361
  var fluentChains = {
4387
- devnet: parse(fluentChainSchema, fluent_devnet_default),
4388
4362
  testnet: parse(fluentChainSchema, fluent_testnet_default),
4389
4363
  mainnet: parse(fluentChainSchema, fluent_mainnet_default)
4390
4364
  };
@@ -4499,12 +4473,10 @@ function l1DefinitionToViemChain(definition) {
4499
4473
  }
4500
4474
 
4501
4475
  // ../connect-sdk/src/chains.ts
4502
- var fluentDevnet = fluentDefinitionToViemChain(fluentChains.devnet);
4503
4476
  var fluentTestnet = fluentDefinitionToViemChain(fluentChains.testnet);
4504
4477
  var fluentMainnet = fluentDefinitionToViemChain(fluentChains.mainnet);
4505
4478
  l1DefinitionToViemChain(l1Chains.sepolia);
4506
4479
  var fluent = {
4507
- devnet: fluentDevnet,
4508
4480
  testnet: fluentTestnet,
4509
4481
  mainnet: fluentMainnet
4510
4482
  };
@@ -4704,25 +4676,10 @@ var fluentMainnetWidgetTokens = [
4704
4676
  fluentMainnetTokenDefaults.USDnr,
4705
4677
  fluentMainnetTokenDefaults.BLEND
4706
4678
  ];
4707
- function withChainId(defaults, chainId) {
4708
- return Object.fromEntries(
4709
- Object.entries(defaults).map(([key, token]) => [key, { ...token, chainId }])
4710
- );
4711
- }
4712
- var fluentDevnetTokenDefaults = withChainId(fluentTestnetTokenDefaults, 20993);
4713
- var fluentDevnetWidgetTokens = [
4714
- fluentDevnetTokenDefaults.ETH,
4715
- fluentDevnetTokenDefaults.USDnr,
4716
- fluentDevnetTokenDefaults.BLEND,
4717
- fluentDevnetTokenDefaults.USDC,
4718
- fluentDevnetTokenDefaults.USDT
4719
- ];
4720
4679
  function getFluentTokenDefaultsForNetwork(network) {
4721
4680
  switch (network) {
4722
4681
  case "mainnet":
4723
4682
  return fluentMainnetTokenDefaults;
4724
- case "devnet":
4725
- return fluentDevnetTokenDefaults;
4726
4683
  default:
4727
4684
  return fluentTestnetTokenDefaults;
4728
4685
  }
@@ -4971,7 +4928,6 @@ var FLUENT_NETWORK_ENV_KEYS = [
4971
4928
  "FLUENT_NETWORK"
4972
4929
  ];
4973
4930
  var FLUENT_NETWORK_ALIASES = {
4974
- devnet: "devnet",
4975
4931
  testnet: "testnet",
4976
4932
  mainnet: "mainnet",
4977
4933
  development: "testnet",
@@ -5014,7 +4970,7 @@ var FLUENT_WIDGET_DEFAULT_SCOPES = [
5014
4970
  ];
5015
4971
  var FLUENT_WIDGET_MAINNET_SCOPES = ["openid", "profile", "wallet", "families:read"];
5016
4972
  function isFaucetNetwork(network) {
5017
- return network === "devnet" || network === "testnet";
4973
+ return network === "testnet";
5018
4974
  }
5019
4975
  function getFluentWidgetDefaultScopes(network) {
5020
4976
  return isFaucetNetwork(network) ? FLUENT_WIDGET_DEFAULT_SCOPES : FLUENT_WIDGET_MAINNET_SCOPES;
@@ -5023,8 +4979,6 @@ function getFluentChainForNetwork(network) {
5023
4979
  switch (network) {
5024
4980
  case "mainnet":
5025
4981
  return fluentMainnet;
5026
- case "devnet":
5027
- return fluentDevnet;
5028
4982
  default:
5029
4983
  return fluentTestnet;
5030
4984
  }
@@ -5079,15 +5033,6 @@ var FLUENT_CONNECT_NETWORK_ENDPOINTS = {
5079
5033
  bridgeUrl: FLUENT_CONNECT_DEFAULT_PORTAL_BRIDGE_URL,
5080
5034
  analyticsHost: FLUENT_CONNECT_TESTNET_ANALYTICS_HOST
5081
5035
  },
5082
- // devnet mirrors testnet infrastructure.
5083
- devnet: {
5084
- authorizeUrl: FLUENT_CONNECT_TESTNET_AUTHORIZE_URL,
5085
- publicApiUrl: FLUENT_CONNECT_TESTNET_PUBLIC_API_URL,
5086
- reputationSignupUrl: FLUENT_CONNECT_TESTNET_REPUTATION_SIGNUP_URL,
5087
- faucetEndpoint: FLUENT_CONNECT_TESTNET_FAUCET_ENDPOINT,
5088
- bridgeUrl: FLUENT_CONNECT_DEFAULT_PORTAL_BRIDGE_URL,
5089
- analyticsHost: FLUENT_CONNECT_TESTNET_ANALYTICS_HOST
5090
- },
5091
5036
  mainnet: {
5092
5037
  authorizeUrl: FLUENT_CONNECT_MAINNET_AUTHORIZE_URL,
5093
5038
  publicApiUrl: FLUENT_CONNECT_MAINNET_PUBLIC_API_URL,
@@ -5438,18 +5383,30 @@ function getFluentGasPaymentValueTier(ethValueWei) {
5438
5383
  if (ethValueWei > 0n) return "neutral";
5439
5384
  return "neutral";
5440
5385
  }
5386
+ var GAS_BALANCE_MAX_FRACTION_DIGITS = 6;
5387
+ function roundToFractionDigits(raw, decimals, digits) {
5388
+ const discardedScale = 10n ** BigInt(decimals - digits);
5389
+ return (raw + discardedScale / 2n) / discardedScale;
5390
+ }
5441
5391
  function formatFluentGasTokenBalance(balance, maximumFractionDigits = 1) {
5442
5392
  if (balance.raw === null || balance.formatted === null) return null;
5443
5393
  if (maximumFractionDigits < 0 || !Number.isInteger(maximumFractionDigits)) {
5444
5394
  throw new Error("maximumFractionDigits must be a non-negative integer");
5445
5395
  }
5446
- let plain = balance.formatted;
5447
- if (balance.decimals > maximumFractionDigits) {
5448
- const discardedScale = 10n ** BigInt(balance.decimals - maximumFractionDigits);
5449
- const rounded = (balance.raw + discardedScale / 2n) / discardedScale;
5450
- plain = formatUnits(rounded, maximumFractionDigits);
5396
+ if (balance.decimals <= maximumFractionDigits) {
5397
+ return formatFluentLocaleAmount(balance.formatted, maximumFractionDigits);
5451
5398
  }
5452
- return formatFluentLocaleAmount(plain, maximumFractionDigits);
5399
+ const maxDigits = Math.max(
5400
+ maximumFractionDigits,
5401
+ Math.min(balance.decimals, GAS_BALANCE_MAX_FRACTION_DIGITS)
5402
+ );
5403
+ for (let digits = maximumFractionDigits; digits <= maxDigits; digits += 1) {
5404
+ const rounded = roundToFractionDigits(balance.raw, balance.decimals, digits);
5405
+ if (rounded > 0n || balance.raw === 0n) {
5406
+ return formatFluentLocaleAmount(formatUnits(rounded, digits), digits);
5407
+ }
5408
+ }
5409
+ return formatFluentLocaleAmount(0, maximumFractionDigits);
5453
5410
  }
5454
5411
  function formatFluentLocaleAmount(value, maximumFractionDigits = 2) {
5455
5412
  const amount = typeof value === "number" ? value : Number(value);
@@ -6537,7 +6494,7 @@ function toUnixSeconds(value) {
6537
6494
  }
6538
6495
 
6539
6496
  // package.json
6540
- var version = "0.1.4";
6497
+ var version = "0.1.5";
6541
6498
 
6542
6499
  // src/core/analytics.ts
6543
6500
  var INSTANCE_NAME = "fluent";
@@ -6651,16 +6608,23 @@ function hasStoredWidgetSession(storage = globalThis.window?.localStorage) {
6651
6608
  }
6652
6609
  var REOWN_PROJECT_ID = FLUENT_CONNECT_REOWN_PROJECT_ID;
6653
6610
  var queryClient = new QueryClient();
6654
- var appKitByChainId = /* @__PURE__ */ new Map();
6611
+ var appKitByKey = /* @__PURE__ */ new Map();
6655
6612
  var reownConfigured = Boolean(REOWN_PROJECT_ID);
6656
- function getReownWagmiAdapter(chain) {
6657
- const existing = appKitByChainId.get(chain.id);
6613
+ function getReownWagmiAdapter(chain, disableAnalytics) {
6614
+ const key = `${chain.id}:${disableAnalytics ? "no-analytics" : "analytics"}`;
6615
+ const existing = appKitByKey.get(key);
6658
6616
  if (existing) return existing;
6659
6617
  const adapter = new WagmiAdapter({
6660
6618
  networks: [chain],
6661
- projectId: REOWN_PROJECT_ID
6619
+ projectId: REOWN_PROJECT_ID,
6620
+ ...disableAnalytics ? {
6621
+ connectors: [
6622
+ coinbaseWallet({ preference: { options: "all", telemetry: false } }),
6623
+ baseAccount({ preference: { telemetry: false } })
6624
+ ]
6625
+ } : {}
6662
6626
  });
6663
- appKitByChainId.set(chain.id, adapter);
6627
+ appKitByKey.set(key, adapter);
6664
6628
  if (typeof window !== "undefined") {
6665
6629
  createAppKit({
6666
6630
  adapters: [adapter],
@@ -6683,8 +6647,9 @@ function getReownWagmiAdapter(chain) {
6683
6647
  }
6684
6648
  ],
6685
6649
  enableEIP6963: true,
6686
- enableCoinbase: true,
6650
+ enableCoinbase: !disableAnalytics,
6687
6651
  enableWalletConnect: true,
6652
+ features: { analytics: !disableAnalytics },
6688
6653
  themeMode: "dark",
6689
6654
  themeVariables: {
6690
6655
  "--w3m-accent": "#49EDED",
@@ -6696,16 +6661,20 @@ function getReownWagmiAdapter(chain) {
6696
6661
  }
6697
6662
  function ReownProvider({
6698
6663
  children,
6699
- network = "testnet"
6664
+ network = "testnet",
6665
+ disableAnalytics = false
6700
6666
  }) {
6701
6667
  const chain = useMemo(() => getFluentChainForNetwork(network), [network]);
6702
- const wagmiAdapter = useMemo(() => getReownWagmiAdapter(chain), [chain]);
6668
+ const wagmiAdapter = useMemo(
6669
+ () => getReownWagmiAdapter(chain, disableAnalytics),
6670
+ [chain, disableAnalytics]
6671
+ );
6703
6672
  if (!wagmiAdapter) return /* @__PURE__ */ jsx(Fragment, { children });
6704
6673
  return /* @__PURE__ */ jsx(WagmiProvider, { config: wagmiAdapter.wagmiConfig, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children }) });
6705
6674
  }
6706
6675
  function useReownWallet() {
6707
6676
  const { open } = useAppKit();
6708
- const { address, chainId, isConnected } = useAccount();
6677
+ const { address, chainId, isConnected, status } = useAccount();
6709
6678
  const { disconnect } = useDisconnect();
6710
6679
  const { data: walletClient } = useWalletClient();
6711
6680
  const { switchChainAsync } = useSwitchChain();
@@ -6723,11 +6692,12 @@ function useReownWallet() {
6723
6692
  address,
6724
6693
  chainId,
6725
6694
  walletClient,
6695
+ reconnecting: status === "reconnecting",
6726
6696
  open: openWallet,
6727
6697
  disconnect,
6728
6698
  switchChain
6729
6699
  }),
6730
- [isConnected, address, chainId, walletClient, openWallet, disconnect, switchChain]
6700
+ [isConnected, address, chainId, walletClient, status, openWallet, disconnect, switchChain]
6731
6701
  );
6732
6702
  }
6733
6703
  function cn(...inputs) {
@@ -6776,14 +6746,42 @@ var Button = forwardRef(function Button2({ className, variant = "default", size
6776
6746
  }
6777
6747
  );
6778
6748
  });
6749
+ var WIDGET_STYLE_SCOPE = "fluent-root dark contents text-white";
6750
+ var FluentPortalContainerContext = createContext(null);
6751
+ function FluentPortalContainerProvider({ children }) {
6752
+ const [container, setContainer] = useState(null);
6753
+ useLayoutEffect(() => {
6754
+ const element = document.createElement("div");
6755
+ element.setAttribute("data-fluent-portal-root", "");
6756
+ element.className = WIDGET_STYLE_SCOPE;
6757
+ document.body.appendChild(element);
6758
+ setContainer(element);
6759
+ return () => {
6760
+ element.remove();
6761
+ setContainer(null);
6762
+ };
6763
+ }, []);
6764
+ return /* @__PURE__ */ jsx(FluentPortalContainerContext.Provider, { value: container, children });
6765
+ }
6766
+ function useFluentPortalContainer(override) {
6767
+ const container = useContext(FluentPortalContainerContext);
6768
+ return override ?? container ?? void 0;
6769
+ }
6779
6770
  function Dialog({ ...props }) {
6780
6771
  return /* @__PURE__ */ jsx(Dialog$1.Root, { "data-slot": "dialog", ...props });
6781
6772
  }
6782
6773
  function DialogTrigger({ ...props }) {
6783
6774
  return /* @__PURE__ */ jsx(Dialog$1.Trigger, { "data-slot": "dialog-trigger", ...props });
6784
6775
  }
6785
- function DialogPortal({ ...props }) {
6786
- return /* @__PURE__ */ jsx(Dialog$1.Portal, { "data-slot": "dialog-portal", ...props });
6776
+ function DialogPortal({ container, ...props }) {
6777
+ return /* @__PURE__ */ jsx(
6778
+ Dialog$1.Portal,
6779
+ {
6780
+ "data-slot": "dialog-portal",
6781
+ container: useFluentPortalContainer(container),
6782
+ ...props
6783
+ }
6784
+ );
6787
6785
  }
6788
6786
  function DialogClose({ ...props }) {
6789
6787
  return /* @__PURE__ */ jsx(Dialog$1.Close, { "data-slot": "dialog-close", ...props });
@@ -7323,7 +7321,7 @@ function SelectContent({
7323
7321
  alignItemWithTrigger = true,
7324
7322
  ...props
7325
7323
  }) {
7326
- return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(
7324
+ return /* @__PURE__ */ jsx(Select$1.Portal, { container: useFluentPortalContainer(), children: /* @__PURE__ */ jsx(
7327
7325
  Select$1.Positioner,
7328
7326
  {
7329
7327
  side,
@@ -7376,6 +7374,19 @@ function SelectItem({
7376
7374
  }
7377
7375
  );
7378
7376
  }
7377
+ function SelectSeparator({
7378
+ className,
7379
+ ...props
7380
+ }) {
7381
+ return /* @__PURE__ */ jsx(
7382
+ Select$1.Separator,
7383
+ {
7384
+ "data-slot": "select-separator",
7385
+ className: cn("pointer-events-none -mx-1 my-1 h-px bg-border", className),
7386
+ ...props
7387
+ }
7388
+ );
7389
+ }
7379
7390
  function SelectScrollUpButton({
7380
7391
  className,
7381
7392
  ...props
@@ -7416,6 +7427,18 @@ function SelectScrollDownButton({
7416
7427
  }
7417
7428
  );
7418
7429
  }
7430
+ function Spinner({ className, ...props }) {
7431
+ return /* @__PURE__ */ jsx(
7432
+ Loader2Icon,
7433
+ {
7434
+ "data-slot": "spinner",
7435
+ role: "status",
7436
+ "aria-label": "Loading",
7437
+ className: cn("size-4 animate-spin", className),
7438
+ ...props
7439
+ }
7440
+ );
7441
+ }
7419
7442
  function Switch({
7420
7443
  className,
7421
7444
  size = "default",
@@ -7772,8 +7795,15 @@ var toast = Toast$1.createToastManager();
7772
7795
  function ToastProvider({ ...props }) {
7773
7796
  return /* @__PURE__ */ jsx(Toast$1.Provider, { ...props });
7774
7797
  }
7775
- function ToastPortal({ ...props }) {
7776
- return /* @__PURE__ */ jsx(Toast$1.Portal, { "data-slot": "toast-portal", ...props });
7798
+ function ToastPortal({ container, ...props }) {
7799
+ return /* @__PURE__ */ jsx(
7800
+ Toast$1.Portal,
7801
+ {
7802
+ "data-slot": "toast-portal",
7803
+ container: useFluentPortalContainer(container),
7804
+ ...props
7805
+ }
7806
+ );
7777
7807
  }
7778
7808
  function ToastViewport({ className, ...props }) {
7779
7809
  return /* @__PURE__ */ jsx(
@@ -7967,6 +7997,50 @@ async function copyAddressToClipboard(address) {
7967
7997
  });
7968
7998
  }
7969
7999
  }
8000
+ var TooltipProvider = Tooltip$1.Provider;
8001
+ var Tooltip = Tooltip$1.Root;
8002
+ function TooltipTrigger({ className, ...props }) {
8003
+ return /* @__PURE__ */ jsx(
8004
+ Tooltip$1.Trigger,
8005
+ {
8006
+ "data-slot": "tooltip-trigger",
8007
+ className: cn("outline-none focus-visible:ring-3 focus-visible:ring-ring/50", className),
8008
+ ...props
8009
+ }
8010
+ );
8011
+ }
8012
+ function TooltipContent({
8013
+ className,
8014
+ children,
8015
+ side = "top",
8016
+ sideOffset = 6,
8017
+ align = "center",
8018
+ alignOffset = 0,
8019
+ ...props
8020
+ }) {
8021
+ return /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(
8022
+ Tooltip$1.Positioner,
8023
+ {
8024
+ side,
8025
+ sideOffset,
8026
+ align,
8027
+ alignOffset,
8028
+ className: "isolate z-50",
8029
+ children: /* @__PURE__ */ jsx(
8030
+ Tooltip$1.Popup,
8031
+ {
8032
+ "data-slot": "tooltip-content",
8033
+ className: cn(
8034
+ "dark relative isolate z-50 max-w-64 origin-(--transform-origin) rounded-lg border border-white/15 bg-popover px-2 py-1 text-xs text-popover-foreground shadow-xl duration-100 data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
8035
+ className
8036
+ ),
8037
+ ...props,
8038
+ children
8039
+ }
8040
+ )
8041
+ }
8042
+ ) });
8043
+ }
7970
8044
  var tokenIcons = {
7971
8045
  ETH: "eth",
7972
8046
  USDnr: "usdnr",
@@ -8006,7 +8080,7 @@ function WalletMenuGasPayment({
8006
8080
  }),
8007
8081
  [balances, gasTokens]
8008
8082
  );
8009
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", "aria-label": "Gas payment tokens", children: sortedRows.map(({ token, balance }) => {
8083
+ return /* @__PURE__ */ jsx(TooltipProvider, { delay: 200, children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", "aria-label": "Gas payment tokens", children: sortedRows.map(({ token, balance }) => {
8010
8084
  const symbol = token.symbol;
8011
8085
  const unavailable = balance?.status === "not-configured";
8012
8086
  const failed = balance?.status === "error";
@@ -8014,6 +8088,7 @@ function WalletMenuGasPayment({
8014
8088
  const active = selectedSymbol === symbol;
8015
8089
  const formatted = balance?.status === "ready" ? formatFluentGasTokenBalance(balance, 0) ?? (balance.formatted ? formatFluentLocaleAmount(balance.formatted, 0) : null) : null;
8016
8090
  const usdValueLabel = formatTokenUsdValue(balance, usdPrices[symbol]);
8091
+ const exactBalance = balance?.status === "ready" && balance.formatted?.includes(".") ? balance.formatted : null;
8017
8092
  return /* @__PURE__ */ jsxs(
8018
8093
  "div",
8019
8094
  {
@@ -8064,7 +8139,28 @@ function WalletMenuGasPayment({
8064
8139
  ) : /* @__PURE__ */ jsx("span", { className: "shrink-0 text-xs leading-4 text-muted-foreground", children: symbol === "ETH" ? "Native" : "No address" })
8065
8140
  ] }),
8066
8141
  /* @__PURE__ */ jsxs("span", { className: "flex flex-col items-end gap-0.5 tabular-nums", children: [
8067
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium leading-4", children: renderBalanceLabel({
8142
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium leading-4", children: exactBalance ? /* @__PURE__ */ jsxs(Tooltip, { children: [
8143
+ /* @__PURE__ */ jsx(
8144
+ TooltipTrigger,
8145
+ {
8146
+ tabIndex: 0,
8147
+ "aria-label": `${symbol} balance: ${exactBalance}`,
8148
+ render: /* @__PURE__ */ jsx("span", { className: "cursor-default rounded-sm" }),
8149
+ children: renderBalanceLabel({
8150
+ formatted,
8151
+ unavailable,
8152
+ failed,
8153
+ isLoading: busy,
8154
+ hasAccount: Boolean(accountAddress)
8155
+ })
8156
+ }
8157
+ ),
8158
+ /* @__PURE__ */ jsxs(TooltipContent, { className: "tabular-nums break-all", children: [
8159
+ exactBalance,
8160
+ " ",
8161
+ symbol
8162
+ ] })
8163
+ ] }) : renderBalanceLabel({
8068
8164
  formatted,
8069
8165
  unavailable,
8070
8166
  failed,
@@ -8077,7 +8173,7 @@ function WalletMenuGasPayment({
8077
8173
  },
8078
8174
  symbol
8079
8175
  );
8080
- }) }) });
8176
+ }) }) }) });
8081
8177
  }
8082
8178
  function formatTokenUsdValue(balance, usdPrice) {
8083
8179
  if (!balance || balance.status !== "ready" || balance.formatted === null) return null;
@@ -8337,27 +8433,114 @@ function WalletMenuActionCard({
8337
8433
  (balance) => balance.status === "ready" && balance.raw !== null && balance.raw > 0n
8338
8434
  );
8339
8435
  const portfolioUnavailable = Boolean(accountAddress) && !portfolioLoading && hasReadyBalances && portfolioTotal === null;
8436
+ if (tab === "settings") {
8437
+ return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-6", children: [
8438
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8439
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Preferences" }),
8440
+ /* @__PURE__ */ jsxs(FieldGroup, { className: "w-full gap-2", children: [
8441
+ /* @__PURE__ */ jsx(FieldLabel, { htmlFor: "silent-signing", children: /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", children: [
8442
+ /* @__PURE__ */ jsxs(FieldContent, { children: [
8443
+ /* @__PURE__ */ jsx(FieldTitle, { children: "Quick sign" }),
8444
+ /* @__PURE__ */ jsx(FieldDescription, { children: "Sign transactions without a confirmation popup." })
8445
+ ] }),
8446
+ /* @__PURE__ */ jsx(
8447
+ Switch,
8448
+ {
8449
+ id: "silent-signing",
8450
+ checked: silentSigningEnabled,
8451
+ onCheckedChange: (enabled) => {
8452
+ track("wallet_silent_signing_toggled", { enabled });
8453
+ onSilentSigningChange(enabled);
8454
+ }
8455
+ }
8456
+ )
8457
+ ] }) }),
8458
+ /* @__PURE__ */ jsx(FieldLabel, { htmlFor: "gas-payment", children: /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", children: [
8459
+ /* @__PURE__ */ jsxs(FieldContent, { children: [
8460
+ /* @__PURE__ */ jsx(FieldTitle, { children: "Gas payment" }),
8461
+ /* @__PURE__ */ jsx(FieldDescription, { children: "Token used to pay transaction fees." })
8462
+ ] }),
8463
+ /* @__PURE__ */ jsxs(
8464
+ Select,
8465
+ {
8466
+ value: gasPaymentToken,
8467
+ onValueChange: (value) => {
8468
+ if (value) {
8469
+ track("wallet_gas_token_selected", { symbol: value });
8470
+ onGasPaymentTokenChange(value);
8471
+ }
8472
+ },
8473
+ children: [
8474
+ /* @__PURE__ */ jsx(
8475
+ SelectTrigger,
8476
+ {
8477
+ id: "gas-payment",
8478
+ size: "sm",
8479
+ className: "shrink-0 border-0 bg-transparent p-0 !h-auto shadow-none dark:bg-transparent dark:hover:bg-transparent",
8480
+ children: /* @__PURE__ */ jsx(SelectValue, {})
8481
+ }
8482
+ ),
8483
+ /* @__PURE__ */ jsx(SelectContent, { align: "end", alignItemWithTrigger: false, children: FLUENT_GAS_PAYMENT_PRIORITY.map((symbol) => /* @__PURE__ */ jsx(SelectItem, { value: symbol, children: symbol }, symbol)) })
8484
+ ]
8485
+ }
8486
+ )
8487
+ ] }) })
8488
+ ] })
8489
+ ] }),
8490
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8491
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Developer" }),
8492
+ /* @__PURE__ */ jsxs(FieldGroup, { className: "w-full gap-2", children: [
8493
+ faucetAvailable ? /* @__PURE__ */ jsx(
8494
+ SettingsActionField,
8495
+ {
8496
+ title: faucetBusy ? "Requesting faucet" : "Faucet",
8497
+ description: session ? "Claim testnet BLEND" : "Connect Fluent ID first",
8498
+ disabled: faucetBusy || !session,
8499
+ onClick: onFaucet
8500
+ }
8501
+ ) : null,
8502
+ /* @__PURE__ */ jsx(
8503
+ SettingsActionField,
8504
+ {
8505
+ title: "Explorer",
8506
+ description: "View Kernel smart wallet",
8507
+ disabled: !actionAddress,
8508
+ onClick: handleExplorer
8509
+ }
8510
+ )
8511
+ ] })
8512
+ ] })
8513
+ ] });
8514
+ }
8340
8515
  return /* @__PURE__ */ jsxs(Tabs, { value: tab, onValueChange: onTabChange, className: "w-full flex flex-col", children: [
8341
8516
  /* @__PURE__ */ jsxs(TabsList, { className: "w-full", children: [
8342
8517
  /* @__PURE__ */ jsx(TabsTrigger, { value: "home", children: "Home" }),
8343
- /* @__PURE__ */ jsx(TabsTrigger, { value: "reputation", children: "Reputation" }),
8344
- /* @__PURE__ */ jsx(TabsTrigger, { value: "settings", children: "Settings" })
8518
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "reputation", children: "Reputation" })
8345
8519
  ] }),
8346
8520
  /* @__PURE__ */ jsxs(TabsContent, { value: "home", className: "flex flex-col gap-4 pt-2", children: [
8347
8521
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8348
8522
  /* @__PURE__ */ jsx("div", { className: "relative overflow-hidden rounded-xl px-4 py-8 bg-white/5", children: /* @__PURE__ */ jsxs("div", { className: "relative z-10 flex flex-col items-center gap-1", children: [
8349
- /* @__PURE__ */ jsx("div", { className: "tracking-[.05em]", children: portfolioDisplay ? /* @__PURE__ */ jsxs(Fragment, { children: [
8523
+ /* @__PURE__ */ jsx("div", { className: "tracking-[.05em] leading-none", children: portfolioDisplay ? /* @__PURE__ */ jsxs(Fragment, { children: [
8350
8524
  /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
8351
8525
  /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: portfolioDisplay.whole }),
8352
8526
  /* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold opacity-50", children: [
8353
8527
  ",",
8354
8528
  portfolioDisplay.fraction
8355
8529
  ] })
8356
- ] }) : portfolioLoading ? /* @__PURE__ */ jsx(
8530
+ ] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
8357
8531
  "span",
8358
8532
  {
8359
- className: "inline-block h-9 w-28 animate-pulse rounded-md bg-white/10",
8360
- "aria-label": "Loading portfolio total"
8533
+ className: "relative inline-flex items-baseline",
8534
+ "aria-busy": "true",
8535
+ "aria-label": "Loading portfolio total",
8536
+ children: [
8537
+ /* @__PURE__ */ jsxs("span", { className: "invisible", "aria-hidden": "true", children: [
8538
+ /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
8539
+ /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
8540
+ /* @__PURE__ */ jsx("span", { className: "text-lg font-semibold", children: ",00" })
8541
+ ] }),
8542
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-white/10" })
8543
+ ]
8361
8544
  }
8362
8545
  ) : portfolioUnavailable ? /* @__PURE__ */ jsxs(Fragment, { children: [
8363
8546
  /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
@@ -8367,7 +8550,7 @@ function WalletMenuActionCard({
8367
8550
  /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
8368
8551
  /* @__PURE__ */ jsx("span", { className: "text-lg font-semibold opacity-50", children: ",00" })
8369
8552
  ] }) }),
8370
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5 text-xs font-medium", children: portfolioPnl ? /* @__PURE__ */ jsxs(Fragment, { children: [
8553
+ /* @__PURE__ */ jsx("div", { className: "flex min-h-4 items-center gap-1.5 text-xs font-medium leading-none", children: portfolioPnl ? /* @__PURE__ */ jsxs(Fragment, { children: [
8371
8554
  /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5", children: formatFluentPortfolioPnlAbsolute(portfolioPnl.delta) }),
8372
8555
  portfolioPnl.percent !== null ? /* @__PURE__ */ jsxs(
8373
8556
  "span",
@@ -8385,11 +8568,22 @@ function WalletMenuActionCard({
8385
8568
  ]
8386
8569
  }
8387
8570
  ) : null
8388
- ] }) : portfolioLoading ? /* @__PURE__ */ jsx(
8571
+ ] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
8389
8572
  "span",
8390
8573
  {
8391
- className: "inline-block h-4 w-24 animate-pulse rounded-md bg-white/10",
8392
- "aria-label": "Loading portfolio pnl"
8574
+ className: "relative inline-flex items-center gap-1.5",
8575
+ "aria-busy": "true",
8576
+ "aria-label": "Loading portfolio pnl",
8577
+ children: [
8578
+ /* @__PURE__ */ jsxs("span", { className: "invisible inline-flex items-center gap-1.5", "aria-hidden": "true", children: [
8579
+ /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5", children: "$ +0,00" }),
8580
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center", children: [
8581
+ /* @__PURE__ */ jsx(Icon, { name: "arrow-up-s-fill", className: "size-3.5" }),
8582
+ /* @__PURE__ */ jsx("span", { children: "0,00%" })
8583
+ ] })
8584
+ ] }),
8585
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-white/10" })
8586
+ ]
8393
8587
  }
8394
8588
  ) : /* @__PURE__ */ jsxs(Fragment, { children: [
8395
8589
  /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5", children: "$ +0,00" }),
@@ -8442,7 +8636,15 @@ function WalletMenuActionCard({
8442
8636
  },
8443
8637
  name
8444
8638
  )) }) : null,
8445
- reputation.phase === "loading" ? /* @__PURE__ */ jsx(ReputationNotice, { title: "Loading reputation", description: "Fetching your Fluent families." }) : null,
8639
+ reputation.phase === "loading" ? /* @__PURE__ */ jsx(
8640
+ "div",
8641
+ {
8642
+ className: "flex items-center justify-center rounded-xl bg-white/5 px-4 py-8",
8643
+ "aria-busy": "true",
8644
+ "aria-label": "Loading reputation",
8645
+ children: /* @__PURE__ */ jsx(Spinner, { className: "size-5 text-white/70" })
8646
+ }
8647
+ ) : null,
8446
8648
  reputation.phase === "disconnected" ? /* @__PURE__ */ jsx(
8447
8649
  ReputationNotice,
8448
8650
  {
@@ -8463,87 +8665,6 @@ function WalletMenuActionCard({
8463
8665
  }
8464
8666
  ) : null,
8465
8667
  reputation.phase === "error" ? /* @__PURE__ */ jsx(ReputationNotice, { title: "Could not load reputation", description: reputation.message }) : null
8466
- ] }),
8467
- /* @__PURE__ */ jsxs(TabsContent, { value: "settings", className: "flex flex-col gap-6 pt-2", children: [
8468
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8469
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Preferences" }),
8470
- /* @__PURE__ */ jsxs(FieldGroup, { className: "w-full gap-2", children: [
8471
- /* @__PURE__ */ jsx(FieldLabel, { htmlFor: "silent-signing", children: /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", children: [
8472
- /* @__PURE__ */ jsxs(FieldContent, { children: [
8473
- /* @__PURE__ */ jsx(FieldTitle, { children: "Quick sign" }),
8474
- /* @__PURE__ */ jsx(FieldDescription, { children: "Sign transactions without a confirmation popup." })
8475
- ] }),
8476
- /* @__PURE__ */ jsx(
8477
- Switch,
8478
- {
8479
- id: "silent-signing",
8480
- checked: silentSigningEnabled,
8481
- onCheckedChange: (enabled) => {
8482
- track("wallet_silent_signing_toggled", { enabled });
8483
- onSilentSigningChange(enabled);
8484
- }
8485
- }
8486
- )
8487
- ] }) }),
8488
- /* @__PURE__ */ jsx(FieldLabel, { htmlFor: "gas-payment", children: /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", children: [
8489
- /* @__PURE__ */ jsxs(FieldContent, { children: [
8490
- /* @__PURE__ */ jsx(FieldTitle, { children: "Gas payment" }),
8491
- /* @__PURE__ */ jsx(FieldDescription, { children: "Token used to pay transaction fees." })
8492
- ] }),
8493
- /* @__PURE__ */ jsxs(
8494
- Select,
8495
- {
8496
- value: gasPaymentToken,
8497
- onValueChange: (value) => {
8498
- if (value) {
8499
- track("wallet_gas_token_selected", { symbol: value });
8500
- onGasPaymentTokenChange(value);
8501
- }
8502
- },
8503
- children: [
8504
- /* @__PURE__ */ jsx(
8505
- SelectTrigger,
8506
- {
8507
- id: "gas-payment",
8508
- size: "sm",
8509
- className: "shrink-0 border-0 bg-transparent p-0 !h-auto shadow-none dark:bg-transparent dark:hover:bg-transparent",
8510
- children: /* @__PURE__ */ jsx(SelectValue, {})
8511
- }
8512
- ),
8513
- /* @__PURE__ */ jsx(SelectContent, { align: "end", alignItemWithTrigger: false, children: FLUENT_GAS_PAYMENT_PRIORITY.map((symbol) => /* @__PURE__ */ jsx(SelectItem, { value: symbol, children: symbol }, symbol)) })
8514
- ]
8515
- }
8516
- )
8517
- ] }) })
8518
- ] })
8519
- ] }),
8520
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8521
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Developer" }),
8522
- /* @__PURE__ */ jsxs(FieldGroup, { className: "w-full gap-2", children: [
8523
- faucetAvailable ? /* @__PURE__ */ jsx(
8524
- SettingsActionField,
8525
- {
8526
- title: faucetBusy ? "Requesting faucet" : "Faucet",
8527
- description: session ? "Claim testnet BLEND" : "Connect Fluent ID first",
8528
- disabled: faucetBusy || !session,
8529
- onClick: onFaucet
8530
- }
8531
- ) : null,
8532
- /* @__PURE__ */ jsx(
8533
- SettingsActionField,
8534
- {
8535
- title: "Explorer",
8536
- description: "View Kernel smart wallet",
8537
- disabled: !actionAddress,
8538
- onClick: handleExplorer
8539
- }
8540
- )
8541
- ] })
8542
- ] }),
8543
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8544
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Account" }),
8545
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "justify-between", onClick: onDisconnect, children: "Disconnect" }) })
8546
- ] })
8547
8668
  ] })
8548
8669
  ] });
8549
8670
  }
@@ -8693,6 +8814,10 @@ function deriveWidgetAccount(input) {
8693
8814
  const connecting = Boolean(
8694
8815
  !hasConnectedAccount && directAuth && smartAccount.privyAuthenticated && !smartAccount.error
8695
8816
  );
8817
+ const restoring = Boolean(
8818
+ !hasConnectedAccount && !connecting && !smartAccount.error && (directAuth && !smartAccount.privyReady || wallet?.reconnecting)
8819
+ );
8820
+ const status = hasConnectedAccount ? "connected" : connecting ? "connecting" : restoring ? "restoring" : "disconnected";
8696
8821
  const externalReady = Boolean(wallet?.connected && wallet.hasWalletClient);
8697
8822
  const type = fluentAccountReady ? "smart" : wallet?.connected ? "eoa" : void 0;
8698
8823
  const executionReady = fluentAccountReady || externalReady;
@@ -8717,7 +8842,8 @@ function deriveWidgetAccount(input) {
8717
8842
  accountMenuAddress,
8718
8843
  fluentAccountReady,
8719
8844
  hasConnectedAccount,
8720
- connecting
8845
+ connecting,
8846
+ status
8721
8847
  };
8722
8848
  }
8723
8849
  function useWidgetAccount(input) {
@@ -8741,6 +8867,7 @@ function useWidgetAccount(input) {
8741
8867
  wallet?.connected,
8742
8868
  wallet?.address,
8743
8869
  wallet?.hasWalletClient,
8870
+ wallet?.reconnecting,
8744
8871
  sessionUserId,
8745
8872
  sessionSmartAccountAddress,
8746
8873
  directAuth
@@ -9355,7 +9482,15 @@ function useHostedConnect(params) {
9355
9482
  return { hostedAuthorizeUrl, beginHostedConnect };
9356
9483
  }
9357
9484
  function useAccountMenu(params) {
9358
- const { accountMenuAddress, network, hasConnectedAccount, setAccountOpen, requestDisconnect, track } = params;
9485
+ const {
9486
+ accountMenuAddress,
9487
+ network,
9488
+ hasConnectedAccount,
9489
+ setAccountOpen,
9490
+ requestDisconnect,
9491
+ onOpenSettings,
9492
+ track
9493
+ } = params;
9359
9494
  const openAccountMenu = useCallback(() => setAccountOpen(true), [setAccountOpen]);
9360
9495
  const handleAccountMenuAction = useCallback(
9361
9496
  (value) => {
@@ -9375,11 +9510,15 @@ function useAccountMenu(params) {
9375
9510
  copyAddressToClipboard(accountMenuAddress);
9376
9511
  return;
9377
9512
  }
9513
+ if (value === "settings") {
9514
+ onOpenSettings?.();
9515
+ return;
9516
+ }
9378
9517
  if (value === "disconnect") {
9379
9518
  requestDisconnect();
9380
9519
  }
9381
9520
  },
9382
- [accountMenuAddress, network, requestDisconnect, track]
9521
+ [accountMenuAddress, network, onOpenSettings, requestDisconnect, track]
9383
9522
  );
9384
9523
  const wasConnected = useRef(hasConnectedAccount);
9385
9524
  useEffect(() => {
@@ -9420,8 +9559,15 @@ function Drawer({
9420
9559
  }
9421
9560
  ) });
9422
9561
  }
9423
- function DrawerPortal({ ...props }) {
9424
- return /* @__PURE__ */ jsx(Drawer$1.Portal, { "data-slot": "drawer-portal", ...props });
9562
+ function DrawerPortal({ container, ...props }) {
9563
+ return /* @__PURE__ */ jsx(
9564
+ Drawer$1.Portal,
9565
+ {
9566
+ "data-slot": "drawer-portal",
9567
+ container: useFluentPortalContainer(container),
9568
+ ...props
9569
+ }
9570
+ );
9425
9571
  }
9426
9572
  function DrawerOverlay({
9427
9573
  className,
@@ -9537,6 +9683,19 @@ function DrawerHeader({ className, ...props }) {
9537
9683
  }
9538
9684
  );
9539
9685
  }
9686
+ function DrawerTitle({ className, ...props }) {
9687
+ return /* @__PURE__ */ jsx(
9688
+ Drawer$1.Title,
9689
+ {
9690
+ "data-slot": "drawer-title",
9691
+ className: cn(
9692
+ "text-base font-medium text-foreground",
9693
+ className
9694
+ ),
9695
+ ...props
9696
+ }
9697
+ );
9698
+ }
9540
9699
  function FluentAccountDrawer(props) {
9541
9700
  const {
9542
9701
  accountOpen,
@@ -9546,6 +9705,8 @@ function FluentAccountDrawer(props) {
9546
9705
  connectButton,
9547
9706
  accountMenuAddress,
9548
9707
  onAccountMenuAction,
9708
+ settingsOpen = false,
9709
+ onCloseSettings,
9549
9710
  children
9550
9711
  } = props;
9551
9712
  return /* @__PURE__ */ jsxs(
@@ -9557,7 +9718,19 @@ function FluentAccountDrawer(props) {
9557
9718
  children: [
9558
9719
  connectButton,
9559
9720
  hasConnectedAccount ? /* @__PURE__ */ jsxs(DrawerContent, { "aria-label": "Connected account", className: "dark text-white antialiased sm:w-96", children: [
9560
- /* @__PURE__ */ jsx(DrawerHeader, { className: "items-stretch p-4 pb-0", children: accountMenuAddress ? /* @__PURE__ */ jsxs(Select, { value: null, onValueChange: onAccountMenuAction, children: [
9721
+ /* @__PURE__ */ jsx(DrawerHeader, { className: "items-stretch p-4 pb-0", children: settingsOpen ? /* @__PURE__ */ jsxs("div", { className: "relative flex h-11 items-center justify-center", children: [
9722
+ /* @__PURE__ */ jsx(
9723
+ "button",
9724
+ {
9725
+ type: "button",
9726
+ "aria-label": "Back",
9727
+ className: "absolute left-0 inline-flex size-8 items-center justify-center rounded-lg text-white/70 transition-colors hover:bg-white/5 hover:text-white",
9728
+ onClick: onCloseSettings,
9729
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-5" })
9730
+ }
9731
+ ),
9732
+ /* @__PURE__ */ jsx(DrawerTitle, { className: "text-sm font-medium leading-none text-white", children: "Settings" })
9733
+ ] }) : accountMenuAddress ? /* @__PURE__ */ jsxs(Select, { value: null, onValueChange: onAccountMenuAction, children: [
9561
9734
  /* @__PURE__ */ jsxs(
9562
9735
  SelectTrigger,
9563
9736
  {
@@ -9578,6 +9751,12 @@ function FluentAccountDrawer(props) {
9578
9751
  /* @__PURE__ */ jsx(Copy, { className: "size-4" }),
9579
9752
  "Copy address"
9580
9753
  ] }),
9754
+ /* @__PURE__ */ jsx(SelectSeparator, { className: "mx-2" }),
9755
+ /* @__PURE__ */ jsxs(SelectItem, { value: "settings", children: [
9756
+ /* @__PURE__ */ jsx(Settings, { className: "size-4" }),
9757
+ "Settings"
9758
+ ] }),
9759
+ /* @__PURE__ */ jsx(SelectSeparator, { className: "mx-2" }),
9581
9760
  /* @__PURE__ */ jsxs(SelectItem, { value: "disconnect", children: [
9582
9761
  /* @__PURE__ */ jsx(LogOut, { className: "size-4" }),
9583
9762
  "Disconnect"
@@ -9792,7 +9971,8 @@ function FluentWidgetContent({
9792
9971
  accountMenuAddress,
9793
9972
  fluentAccountReady,
9794
9973
  hasConnectedAccount,
9795
- connecting
9974
+ connecting,
9975
+ status
9796
9976
  } = useWidgetAccount({
9797
9977
  smartAccount: {
9798
9978
  smartAccountReady: smartAccount.smartAccountReady,
@@ -9806,7 +9986,8 @@ function FluentWidgetContent({
9806
9986
  wallet: activeWallet ? {
9807
9987
  connected: activeWallet.connected,
9808
9988
  address: activeWallet.address,
9809
- hasWalletClient: Boolean(activeWallet.walletClient)
9989
+ hasWalletClient: Boolean(activeWallet.walletClient),
9990
+ reconnecting: activeWallet.reconnecting
9810
9991
  } : null,
9811
9992
  sessionUserId: session?.user?.id,
9812
9993
  sessionSmartAccountAddress: session?.wallet?.smartAccountAddress,
@@ -9900,7 +10081,7 @@ function FluentWidgetContent({
9900
10081
  }, [activeWallet, authenticated, commitSilentSigningEnabled, directAuth, fluentConnect, logout, setDirectAuthRequested, setSession]);
9901
10082
  const requestDisconnect = useCallback(() => {
9902
10083
  track("wallet_disconnected");
9903
- handleDisconnect();
10084
+ return handleDisconnect();
9904
10085
  }, [handleDisconnect, track]);
9905
10086
  const { openAccountMenu, handleAccountMenuAction } = useAccountMenu({
9906
10087
  accountMenuAddress,
@@ -9908,8 +10089,21 @@ function FluentWidgetContent({
9908
10089
  hasConnectedAccount,
9909
10090
  setAccountOpen,
9910
10091
  requestDisconnect,
10092
+ onOpenSettings: () => setWalletMenuTab("settings"),
9911
10093
  track
9912
10094
  });
10095
+ const lastMenuTabRef = useRef(walletMenuTab === "settings" ? "home" : walletMenuTab);
10096
+ useEffect(() => {
10097
+ if (walletMenuTab !== "settings") lastMenuTabRef.current = walletMenuTab;
10098
+ }, [walletMenuTab]);
10099
+ useEffect(() => {
10100
+ if (!accountOpen && walletMenuTab === "settings") {
10101
+ setWalletMenuTab(lastMenuTabRef.current);
10102
+ }
10103
+ }, [accountOpen, setWalletMenuTab, walletMenuTab]);
10104
+ const closeSettings = useCallback(() => {
10105
+ setWalletMenuTab(lastMenuTabRef.current);
10106
+ }, [setWalletMenuTab]);
9913
10107
  const { faucetBusy, claimFaucet } = useFaucet({
9914
10108
  session,
9915
10109
  identityToken,
@@ -10045,7 +10239,9 @@ function FluentWidgetContent({
10045
10239
  widget: widgetApi,
10046
10240
  openConnect,
10047
10241
  openAccount: openAccountMenu,
10242
+ disconnect: requestDisconnect,
10048
10243
  hasConnectedAccount,
10244
+ status,
10049
10245
  connecting,
10050
10246
  refreshBalances
10051
10247
  }),
@@ -10056,13 +10252,15 @@ function FluentWidgetContent({
10056
10252
  widgetApi,
10057
10253
  openConnect,
10058
10254
  openAccountMenu,
10255
+ requestDisconnect,
10059
10256
  hasConnectedAccount,
10257
+ status,
10060
10258
  connecting,
10061
10259
  refreshBalances
10062
10260
  ]
10063
10261
  );
10064
- const widget = /* @__PURE__ */ jsx(Toaster, { children: /* @__PURE__ */ jsxs("div", { className: "dark contents text-white antialiased", children: [
10065
- /* @__PURE__ */ jsx(
10262
+ const widget = /* @__PURE__ */ jsx(FluentPortalContainerProvider, { children: /* @__PURE__ */ jsxs(Toaster, { children: [
10263
+ /* @__PURE__ */ jsx("div", { className: WIDGET_STYLE_SCOPE, children: /* @__PURE__ */ jsx(
10066
10264
  FluentAccountDrawer,
10067
10265
  {
10068
10266
  accountOpen,
@@ -10071,6 +10269,8 @@ function FluentWidgetContent({
10071
10269
  isMobile,
10072
10270
  accountMenuAddress,
10073
10271
  onAccountMenuAction: handleAccountMenuAction,
10272
+ settingsOpen: walletMenuTab === "settings",
10273
+ onCloseSettings: closeSettings,
10074
10274
  connectButton: /* @__PURE__ */ jsx(
10075
10275
  FluentConnectButtonSlot,
10076
10276
  {
@@ -10109,50 +10309,52 @@ function FluentWidgetContent({
10109
10309
  }
10110
10310
  )
10111
10311
  }
10112
- ),
10312
+ ) }),
10113
10313
  /* @__PURE__ */ jsx(FluentWidgetProvider, { value: context, children: mode === "page" ? renderPage?.(context) : renderHome?.(context) }),
10114
- showDebugPayload && mode === "home" ? /* @__PURE__ */ jsx(
10115
- DebugPanel,
10116
- {
10117
- session,
10118
- wallet: activeWallet,
10119
- walletStatus,
10120
- hostedError
10121
- }
10122
- ) : null,
10123
- /* @__PURE__ */ jsx(
10124
- ConnectChoiceModal,
10125
- {
10126
- open: connectOpen,
10127
- onClose: () => setConnectOpen(false),
10128
- wallet: activeWallet,
10129
- fluentReady: directAuth ? privyReady : true,
10130
- authMode: resolvedConfig.authMode,
10131
- config,
10132
- fluentAuthorizeUrl: directAuth ? void 0 : hostedAuthorizeUrl,
10133
- hostedError,
10134
- track,
10135
- onExternalWalletSelected: () => {
10136
- externalWalletAnalytics.current.intent = true;
10137
- },
10138
- onFluentLogin: () => {
10139
- track("connect_login_started");
10140
- if (directAuth) {
10141
- startDirectFluentLogin();
10142
- return;
10314
+ /* @__PURE__ */ jsxs("div", { className: WIDGET_STYLE_SCOPE, children: [
10315
+ showDebugPayload && mode === "home" ? /* @__PURE__ */ jsx(
10316
+ DebugPanel,
10317
+ {
10318
+ session,
10319
+ wallet: activeWallet,
10320
+ walletStatus,
10321
+ hostedError
10322
+ }
10323
+ ) : null,
10324
+ /* @__PURE__ */ jsx(
10325
+ ConnectChoiceModal,
10326
+ {
10327
+ open: connectOpen,
10328
+ onClose: () => setConnectOpen(false),
10329
+ wallet: activeWallet,
10330
+ fluentReady: directAuth ? privyReady : true,
10331
+ authMode: resolvedConfig.authMode,
10332
+ config,
10333
+ fluentAuthorizeUrl: directAuth ? void 0 : hostedAuthorizeUrl,
10334
+ hostedError,
10335
+ track,
10336
+ onExternalWalletSelected: () => {
10337
+ externalWalletAnalytics.current.intent = true;
10338
+ },
10339
+ onFluentLogin: () => {
10340
+ track("connect_login_started");
10341
+ if (directAuth) {
10342
+ startDirectFluentLogin();
10343
+ return;
10344
+ }
10345
+ setWalletStatus("Opening hosted Fluent Connect ID");
10143
10346
  }
10144
- setWalletStatus("Opening hosted Fluent Connect ID");
10145
10347
  }
10146
- }
10147
- ),
10148
- /* @__PURE__ */ jsx(
10149
- BatchOperationReviewModal,
10150
- {
10151
- operation: batchReview,
10152
- onConfirm: acceptBatchReview,
10153
- onCancel: rejectBatchReview
10154
- }
10155
- )
10348
+ ),
10349
+ /* @__PURE__ */ jsx(
10350
+ BatchOperationReviewModal,
10351
+ {
10352
+ operation: batchReview,
10353
+ onConfirm: acceptBatchReview,
10354
+ onCancel: rejectBatchReview
10355
+ }
10356
+ )
10357
+ ] })
10156
10358
  ] }) });
10157
10359
  return widget;
10158
10360
  }
@@ -10172,6 +10374,13 @@ function FluentWidget(props) {
10172
10374
  [props.config]
10173
10375
  );
10174
10376
  const resolvedNetwork = resolvedConfig.network;
10377
+ const privyClientId = resolvedConfig.clientId.startsWith("client-") ? resolvedConfig.clientId : void 0;
10378
+ useEffect(() => {
10379
+ if (resolvedConfig.authMode !== "direct" || privyClientId) return;
10380
+ console.warn(
10381
+ `[fluent widget] clientId "${resolvedConfig.clientId}" is not a Privy app client. authMode: "direct" will fail with invalid_origin outside Fluent origins \u2014 use the client id issued by Fluent, or authMode: "hosted".`
10382
+ );
10383
+ }, [privyClientId, resolvedConfig.authMode, resolvedConfig.clientId]);
10175
10384
  const analyticsContext = useRef({});
10176
10385
  const externalWallet = useRef({ intent: false, connected: false });
10177
10386
  const track = useMemo(
@@ -10305,33 +10514,41 @@ function FluentWidget(props) {
10305
10514
  PrivyProvider,
10306
10515
  {
10307
10516
  appId: FLUENT_CONNECT_PRIVY_APP_ID,
10517
+ clientId: privyClientId,
10308
10518
  config: privyConfig,
10309
- children: /* @__PURE__ */ jsx(ReownProvider, { network: resolvedNetwork, children: /* @__PURE__ */ jsx(
10310
- FluentWidgetContent,
10519
+ children: /* @__PURE__ */ jsx(
10520
+ ReownProvider,
10311
10521
  {
10312
- ...props,
10313
- track,
10314
- reportAnalyticsSession,
10315
- externalWalletAnalytics: externalWallet,
10316
- accountOpen,
10317
- setAccountOpen,
10318
- walletMenuTab,
10319
- setWalletMenuTab: handleTabChange,
10320
- gasPaymentToken,
10321
- setGasPaymentToken,
10322
- silentSigningEnabled,
10323
- silentSigningChecked,
10324
- onSilentSigningChange: handleSilentSigningChange,
10325
- commitSilentSigningEnabled,
10326
- requestPrivyLogin,
10327
- pendingPrivyLoginRef
10522
+ network: resolvedNetwork,
10523
+ disableAnalytics: resolvedConfig.disableAnalytics,
10524
+ children: /* @__PURE__ */ jsx(
10525
+ FluentWidgetContent,
10526
+ {
10527
+ ...props,
10528
+ track,
10529
+ reportAnalyticsSession,
10530
+ externalWalletAnalytics: externalWallet,
10531
+ accountOpen,
10532
+ setAccountOpen,
10533
+ walletMenuTab,
10534
+ setWalletMenuTab: handleTabChange,
10535
+ gasPaymentToken,
10536
+ setGasPaymentToken,
10537
+ silentSigningEnabled,
10538
+ silentSigningChecked,
10539
+ onSilentSigningChange: handleSilentSigningChange,
10540
+ commitSilentSigningEnabled,
10541
+ requestPrivyLogin,
10542
+ pendingPrivyLoginRef
10543
+ }
10544
+ )
10328
10545
  }
10329
- ) })
10546
+ )
10330
10547
  },
10331
10548
  `${resolvedNetwork}:${silentSigningEnabled ? "silent-signing" : "prompt-signing"}-${privyEpoch}`
10332
10549
  ) });
10333
10550
  }
10334
10551
 
10335
- export { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FLUENT_CONNECT_DEFAULT_ASSETS, FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES, FLUENT_GAS_PAYMENT_PRIORITY, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY, FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT, FluentWidget, FluentWidgetConnectButton, FluentWidgetNetworkProvider, Icon, Separator, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, fluent2 as fluent, apps as fluentApps, fluentBridgeAbi, fluent as fluentChain, fluentChains, fluentDefinitionToViemChain, fluentDevnet, fluentDevnetTokenDefaults, fluentDevnetWidgetTokens, integrations as fluentIntegrations, l1Chains as fluentL1Chains, fluentMainnet, fluentMainnetTokenDefaults, fluentMainnetWidgetTokens, fluentTestnet, fluentTestnetTokenDefaults, fluentTestnetWidgetTokens, fluentZeroDevChainIds, formatFluentGasTokenBalance, formatFluentLocaleAmount, getApp, getContractAddressFromChain, getFluentChain, getFluentChainByChainId, getFluentChainForNetwork, getFluentDefaultGasTokens, getFluentDefaultWidgetGasTokens, getFluentExplorerBaseUrl, getFluentGasPaymentEthValue, getFluentGasPaymentTokens, getFluentGasPaymentValueTier, getFluentGasTokenAddress, getFluentTokenDefaults, getFluentTokenDefaultsForNetwork, getFluentZeroDevErc20PaymasterTokens, getL1Chain, getL1ForFluentChain, getZeroDevRpcUrl, getZerodevIntegration, isFaucetNetwork, isFluentZeroDevChain, l1DefinitionToViemChain, normalizeFluentWidgetNetwork, readFluentTokenBalances, registryVersion, resolveBridgeAddresses, resolveFluentWidgetNetworkFromEnv, resolveFluentZeroDevErc20PaymasterToken, resolveL1Definition, selectFluentGasPaymentToken, sendFluentZeroDevErc20PaymasterDemo, useFluentWidget, useFluentWidgetNetwork, useFluentZeroDevAccount, useWidget };
10552
+ export { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FLUENT_CONNECT_DEFAULT_ASSETS, FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES, FLUENT_GAS_PAYMENT_PRIORITY, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY, FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT, FluentWidget, FluentWidgetConnectButton, FluentWidgetNetworkProvider, Icon, Separator, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, fluent2 as fluent, apps as fluentApps, fluentBridgeAbi, fluent as fluentChain, fluentChains, fluentDefinitionToViemChain, integrations as fluentIntegrations, l1Chains as fluentL1Chains, fluentMainnet, fluentMainnetTokenDefaults, fluentMainnetWidgetTokens, fluentTestnet, fluentTestnetTokenDefaults, fluentTestnetWidgetTokens, fluentZeroDevChainIds, formatFluentGasTokenBalance, formatFluentLocaleAmount, getApp, getContractAddressFromChain, getFluentChain, getFluentChainByChainId, getFluentChainForNetwork, getFluentDefaultGasTokens, getFluentDefaultWidgetGasTokens, getFluentExplorerBaseUrl, getFluentGasPaymentEthValue, getFluentGasPaymentTokens, getFluentGasPaymentValueTier, getFluentGasTokenAddress, getFluentTokenDefaults, getFluentTokenDefaultsForNetwork, getFluentZeroDevErc20PaymasterTokens, getL1Chain, getL1ForFluentChain, getZeroDevRpcUrl, getZerodevIntegration, isFaucetNetwork, isFluentZeroDevChain, l1DefinitionToViemChain, normalizeFluentWidgetNetwork, readFluentTokenBalances, registryVersion, resolveBridgeAddresses, resolveFluentWidgetNetworkFromEnv, resolveFluentZeroDevErc20PaymasterToken, resolveL1Definition, selectFluentGasPaymentToken, sendFluentZeroDevErc20PaymasterDemo, useFluentWidget, useFluentWidgetNetwork, useFluentZeroDevAccount, useWidget };
10336
10553
  //# sourceMappingURL=index.js.map
10337
10554
  //# sourceMappingURL=index.js.map