@fluent.xyz/connect 0.2.1 → 0.2.2

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
@@ -5322,12 +5322,17 @@ function resolveFluentWidgetConfig(config) {
5322
5322
  gasPayment: {
5323
5323
  ethValueByToken: config.gasPayment?.ethValueByToken
5324
5324
  },
5325
+ reputationEnabled: config.reputationEnabled ?? true,
5325
5326
  scopes: config.scopes ?? getFluentWidgetDefaultScopes(network),
5326
5327
  source: config.source ?? "fluent_connect_widget",
5327
5328
  campaign: config.campaign,
5328
5329
  assets: {
5329
5330
  ...FLUENT_CONNECT_DEFAULT_ASSETS,
5330
5331
  ...config.assets
5332
+ },
5333
+ avatar: {
5334
+ defaultLogoUrl: config.avatar?.defaultLogoUrl?.trim() || void 0,
5335
+ forceDefault: config.avatar?.forceDefault ?? false
5331
5336
  }
5332
5337
  };
5333
5338
  }
@@ -6945,7 +6950,7 @@ function toUnixSeconds(value) {
6945
6950
  }
6946
6951
 
6947
6952
  // package.json
6948
- var version = "0.2.1";
6953
+ var version = "0.2.2";
6949
6954
 
6950
6955
  // src/core/analytics.ts
6951
6956
  var INSTANCE_NAME = "fluent";
@@ -9196,13 +9201,15 @@ function WalletMenuActionCard({
9196
9201
  const resolvedConfig = resolveFluentWidgetConfig(config);
9197
9202
  const [reputation, setReputation] = useState({ phase: "disconnected" });
9198
9203
  const [actionStatus, setActionStatus] = useState(null);
9204
+ const reputationEnabled = resolvedConfig.reputationEnabled;
9199
9205
  const client2 = useMemo(() => {
9206
+ if (!reputationEnabled) return null;
9200
9207
  if (!session?.user.id) return null;
9201
9208
  if (!resolvedConfig.publicApiUrl) return null;
9202
9209
  return createFluentFamiliesClient({
9203
9210
  baseUrl: resolvedConfig.publicApiUrl
9204
9211
  });
9205
- }, [resolvedConfig.publicApiUrl, session?.user.id]);
9212
+ }, [reputationEnabled, resolvedConfig.publicApiUrl, session?.user.id]);
9206
9213
  useEffect(() => {
9207
9214
  if (!client2) {
9208
9215
  setReputation({ phase: "disconnected" });
@@ -9394,183 +9401,202 @@ function WalletMenuActionCard({
9394
9401
  ] })
9395
9402
  ] });
9396
9403
  }
9397
- return /* @__PURE__ */ jsxs(Tabs, { value: tab, onValueChange: onTabChange, className: "w-full flex flex-col", children: [
9398
- /* @__PURE__ */ jsxs(TabsList, { className: "w-full", children: [
9399
- /* @__PURE__ */ jsx(TabsTrigger, { value: "home", children: "Home" }),
9400
- /* @__PURE__ */ jsx(TabsTrigger, { value: "reputation", children: "Reputation" })
9401
- ] }),
9402
- /* @__PURE__ */ jsxs(TabsContent, { value: "home", className: "flex flex-col gap-4 pt-2", children: [
9403
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
9404
- /* @__PURE__ */ jsx("div", { className: "relative overflow-hidden rounded-xl px-4 py-8 bg-foreground/5", children: /* @__PURE__ */ jsxs("div", { className: "relative z-10 flex flex-col items-center gap-1", children: [
9405
- /* @__PURE__ */ jsx("div", { className: "tracking-[.05em] leading-none", children: portfolioDisplay ? /* @__PURE__ */ jsxs(Fragment, { children: [
9406
- /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
9407
- /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: portfolioDisplay.whole }),
9408
- /* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold opacity-50", children: [
9409
- portfolioDisplay.separator,
9410
- portfolioDisplay.fraction
9411
- ] })
9412
- ] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
9413
- "span",
9404
+ return (
9405
+ // With Reputation off, Home is the only panel: the strip goes away, and the
9406
+ // active value is pinned so a `tab` left on "reputation" can't blank the card.
9407
+ /* @__PURE__ */ jsxs(
9408
+ Tabs,
9409
+ {
9410
+ value: reputationEnabled ? tab : "home",
9411
+ onValueChange: onTabChange,
9412
+ className: "w-full flex flex-col",
9413
+ children: [
9414
+ reputationEnabled ? /* @__PURE__ */ jsxs(TabsList, { className: "w-full", children: [
9415
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "home", children: "Home" }),
9416
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "reputation", children: "Reputation" })
9417
+ ] }) : null,
9418
+ /* @__PURE__ */ jsxs(
9419
+ TabsContent,
9414
9420
  {
9415
- className: "relative inline-flex items-baseline",
9416
- "aria-busy": "true",
9417
- "aria-label": "Loading portfolio total",
9421
+ value: "home",
9422
+ className: `flex flex-col gap-4${reputationEnabled ? " pt-2" : ""}`,
9418
9423
  children: [
9419
- /* @__PURE__ */ jsxs("span", { className: "invisible", "aria-hidden": "true", children: [
9420
- /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
9421
- /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
9422
- /* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold", children: [
9423
- FLUENT_DECIMAL_SEPARATOR,
9424
- "00"
9424
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
9425
+ /* @__PURE__ */ jsx("div", { className: "relative overflow-hidden rounded-xl px-4 py-8 bg-foreground/5", children: /* @__PURE__ */ jsxs("div", { className: "relative z-10 flex flex-col items-center gap-1", children: [
9426
+ /* @__PURE__ */ jsx("div", { className: "tracking-[.05em] leading-none", children: portfolioDisplay ? /* @__PURE__ */ jsxs(Fragment, { children: [
9427
+ /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
9428
+ /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: portfolioDisplay.whole }),
9429
+ /* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold opacity-50", children: [
9430
+ portfolioDisplay.separator,
9431
+ portfolioDisplay.fraction
9432
+ ] })
9433
+ ] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
9434
+ "span",
9435
+ {
9436
+ className: "relative inline-flex items-baseline",
9437
+ "aria-busy": "true",
9438
+ "aria-label": "Loading portfolio total",
9439
+ children: [
9440
+ /* @__PURE__ */ jsxs("span", { className: "invisible", "aria-hidden": "true", children: [
9441
+ /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
9442
+ /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
9443
+ /* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold", children: [
9444
+ FLUENT_DECIMAL_SEPARATOR,
9445
+ "00"
9446
+ ] })
9447
+ ] }),
9448
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-foreground/10" })
9449
+ ]
9450
+ }
9451
+ ) : portfolioUnavailable ? /* @__PURE__ */ jsxs(Fragment, { children: [
9452
+ /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
9453
+ /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "\u2014" })
9454
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
9455
+ /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
9456
+ /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
9457
+ /* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold opacity-50", children: [
9458
+ FLUENT_DECIMAL_SEPARATOR,
9459
+ "00"
9460
+ ] })
9461
+ ] }) }),
9462
+ /* @__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: [
9463
+ /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5", children: formatFluentPortfolioPnlAbsolute(portfolioPnl.delta) }),
9464
+ portfolioPnl.percent !== null ? /* @__PURE__ */ jsxs(
9465
+ "span",
9466
+ {
9467
+ className: `inline-flex items-center ${portfolioPnl.delta >= 0 ? "text-green-400" : "text-red-400"}`,
9468
+ children: [
9469
+ /* @__PURE__ */ jsx(
9470
+ Icon,
9471
+ {
9472
+ name: portfolioPnl.delta >= 0 ? "arrow-up-s-fill" : "arrow-down-s-fill",
9473
+ className: "size-3.5"
9474
+ }
9475
+ ),
9476
+ /* @__PURE__ */ jsx("span", { children: formatFluentPortfolioPnlPercent(portfolioPnl.percent) })
9477
+ ]
9478
+ }
9479
+ ) : null
9480
+ ] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
9481
+ "span",
9482
+ {
9483
+ className: "relative inline-flex items-center gap-1.5",
9484
+ "aria-busy": "true",
9485
+ "aria-label": "Loading portfolio pnl",
9486
+ children: [
9487
+ /* @__PURE__ */ jsxs("span", { className: "invisible inline-flex items-center gap-1.5", "aria-hidden": "true", children: [
9488
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
9489
+ "$ +0",
9490
+ FLUENT_DECIMAL_SEPARATOR,
9491
+ "00"
9492
+ ] }),
9493
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center", children: [
9494
+ /* @__PURE__ */ jsx(Icon, { name: "arrow-up-s-fill", className: "size-3.5" }),
9495
+ /* @__PURE__ */ jsxs("span", { children: [
9496
+ "0",
9497
+ FLUENT_DECIMAL_SEPARATOR,
9498
+ "00%"
9499
+ ] })
9500
+ ] })
9501
+ ] }),
9502
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-foreground/10" })
9503
+ ]
9504
+ }
9505
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
9506
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
9507
+ "$ +0",
9508
+ FLUENT_DECIMAL_SEPARATOR,
9509
+ "00"
9510
+ ] }),
9511
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center text-green-400", children: [
9512
+ /* @__PURE__ */ jsx(Icon, { name: "arrow-up-s-fill", className: "size-3.5" }),
9513
+ /* @__PURE__ */ jsxs("span", { children: [
9514
+ "0",
9515
+ FLUENT_DECIMAL_SEPARATOR,
9516
+ "00%"
9517
+ ] })
9518
+ ] })
9519
+ ] }) })
9520
+ ] }) }),
9521
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
9522
+ /* @__PURE__ */ jsx(
9523
+ Button,
9524
+ {
9525
+ variant: "secondary",
9526
+ className: "h-16",
9527
+ disabled: !actionAddress || !swapperReady,
9528
+ onClick: handleSwapper,
9529
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
9530
+ /* @__PURE__ */ jsx(Icon, { name: "plus", className: "size-4" }),
9531
+ /* @__PURE__ */ jsx("span", { children: "Get USDnr" })
9532
+ ] })
9533
+ }
9534
+ ),
9535
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-16", onClick: handleBridge, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
9536
+ /* @__PURE__ */ jsx(Icon, { name: "arrow-left-right-line", className: "size-4" }),
9537
+ /* @__PURE__ */ jsx("span", { children: "Bridge" })
9538
+ ] }) })
9425
9539
  ] })
9426
9540
  ] }),
9427
- /* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-foreground/10" })
9541
+ /* @__PURE__ */ jsx(
9542
+ WalletMenuTokenList,
9543
+ {
9544
+ accountAddress,
9545
+ balances,
9546
+ busy: balancesBusy,
9547
+ usdPrices: prices,
9548
+ tokens: displayTokens,
9549
+ selectedSymbol: gasPaymentToken,
9550
+ onAddUserToken: addUserToken,
9551
+ onRemoveUserToken: removeUserToken
9552
+ }
9553
+ )
9428
9554
  ]
9429
9555
  }
9430
- ) : portfolioUnavailable ? /* @__PURE__ */ jsxs(Fragment, { children: [
9431
- /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
9432
- /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "\u2014" })
9433
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
9434
- /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
9435
- /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
9436
- /* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold opacity-50", children: [
9437
- FLUENT_DECIMAL_SEPARATOR,
9438
- "00"
9439
- ] })
9440
- ] }) }),
9441
- /* @__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: [
9442
- /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5", children: formatFluentPortfolioPnlAbsolute(portfolioPnl.delta) }),
9443
- portfolioPnl.percent !== null ? /* @__PURE__ */ jsxs(
9444
- "span",
9556
+ ),
9557
+ reputationEnabled ? /* @__PURE__ */ jsxs(TabsContent, { value: "reputation", className: "flex flex-col gap-2 pt-2", children: [
9558
+ reputation.phase === "ready" ? /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: orderedFamilyKeys(reputation.families.families).map((name) => /* @__PURE__ */ jsx(
9559
+ ReputationFamilyCard,
9445
9560
  {
9446
- className: `inline-flex items-center ${portfolioPnl.delta >= 0 ? "text-green-400" : "text-red-400"}`,
9447
- children: [
9448
- /* @__PURE__ */ jsx(
9449
- Icon,
9450
- {
9451
- name: portfolioPnl.delta >= 0 ? "arrow-up-s-fill" : "arrow-down-s-fill",
9452
- className: "size-3.5"
9453
- }
9454
- ),
9455
- /* @__PURE__ */ jsx("span", { children: formatFluentPortfolioPnlPercent(portfolioPnl.percent) })
9456
- ]
9561
+ family: name,
9562
+ tier: reputation.families.families[name].tier
9563
+ },
9564
+ name
9565
+ )) }) : null,
9566
+ reputation.phase === "loading" ? /* @__PURE__ */ jsx(
9567
+ "div",
9568
+ {
9569
+ className: "flex items-center justify-center rounded-xl bg-foreground/5 px-4 py-8",
9570
+ "aria-busy": "true",
9571
+ "aria-label": "Loading reputation",
9572
+ children: /* @__PURE__ */ jsx(Spinner, { className: "size-5 text-foreground/70" })
9457
9573
  }
9458
- ) : null
9459
- ] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
9460
- "span",
9461
- {
9462
- className: "relative inline-flex items-center gap-1.5",
9463
- "aria-busy": "true",
9464
- "aria-label": "Loading portfolio pnl",
9465
- children: [
9466
- /* @__PURE__ */ jsxs("span", { className: "invisible inline-flex items-center gap-1.5", "aria-hidden": "true", children: [
9467
- /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
9468
- "$ +0",
9469
- FLUENT_DECIMAL_SEPARATOR,
9470
- "00"
9471
- ] }),
9472
- /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center", children: [
9473
- /* @__PURE__ */ jsx(Icon, { name: "arrow-up-s-fill", className: "size-3.5" }),
9474
- /* @__PURE__ */ jsxs("span", { children: [
9475
- "0",
9476
- FLUENT_DECIMAL_SEPARATOR,
9477
- "00%"
9478
- ] })
9479
- ] })
9480
- ] }),
9481
- /* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-foreground/10" })
9482
- ]
9483
- }
9484
- ) : /* @__PURE__ */ jsxs(Fragment, { children: [
9485
- /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
9486
- "$ +0",
9487
- FLUENT_DECIMAL_SEPARATOR,
9488
- "00"
9489
- ] }),
9490
- /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center text-green-400", children: [
9491
- /* @__PURE__ */ jsx(Icon, { name: "arrow-up-s-fill", className: "size-3.5" }),
9492
- /* @__PURE__ */ jsxs("span", { children: [
9493
- "0",
9494
- FLUENT_DECIMAL_SEPARATOR,
9495
- "00%"
9496
- ] })
9497
- ] })
9498
- ] }) })
9499
- ] }) }),
9500
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
9501
- /* @__PURE__ */ jsx(
9502
- Button,
9503
- {
9504
- variant: "secondary",
9505
- className: "h-16",
9506
- disabled: !actionAddress || !swapperReady,
9507
- onClick: handleSwapper,
9508
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
9509
- /* @__PURE__ */ jsx(Icon, { name: "plus", className: "size-4" }),
9510
- /* @__PURE__ */ jsx("span", { children: "Get USDnr" })
9511
- ] })
9512
- }
9513
- ),
9514
- /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-16", onClick: handleBridge, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
9515
- /* @__PURE__ */ jsx(Icon, { name: "arrow-left-right-line", className: "size-4" }),
9516
- /* @__PURE__ */ jsx("span", { children: "Bridge" })
9517
- ] }) })
9518
- ] })
9519
- ] }),
9520
- /* @__PURE__ */ jsx(
9521
- WalletMenuTokenList,
9522
- {
9523
- accountAddress,
9524
- balances,
9525
- busy: balancesBusy,
9526
- usdPrices: prices,
9527
- tokens: displayTokens,
9528
- selectedSymbol: gasPaymentToken,
9529
- onAddUserToken: addUserToken,
9530
- onRemoveUserToken: removeUserToken
9531
- }
9532
- )
9533
- ] }),
9534
- /* @__PURE__ */ jsxs(TabsContent, { value: "reputation", className: "flex flex-col gap-2 pt-2", children: [
9535
- reputation.phase === "ready" ? /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: orderedFamilyKeys(reputation.families.families).map((name) => /* @__PURE__ */ jsx(
9536
- ReputationFamilyCard,
9537
- {
9538
- family: name,
9539
- tier: reputation.families.families[name].tier
9540
- },
9541
- name
9542
- )) }) : null,
9543
- reputation.phase === "loading" ? /* @__PURE__ */ jsx(
9544
- "div",
9545
- {
9546
- className: "flex items-center justify-center rounded-xl bg-foreground/5 px-4 py-8",
9547
- "aria-busy": "true",
9548
- "aria-label": "Loading reputation",
9549
- children: /* @__PURE__ */ jsx(Spinner, { className: "size-5 text-foreground/70" })
9550
- }
9551
- ) : null,
9552
- reputation.phase === "disconnected" ? /* @__PURE__ */ jsx(
9553
- ReputationNotice,
9554
- {
9555
- title: "Not connected",
9556
- description: "Connect with Fluent ID to see your reputation."
9557
- }
9558
- ) : null,
9559
- reputation.phase === "signup" ? /* @__PURE__ */ jsx(
9560
- ReputationNotice,
9561
- {
9562
- title: "No reputation available",
9563
- description: "Connect your X account to access your reputation.",
9564
- action: {
9565
- label: "Connect with X",
9566
- icon: "x",
9567
- onClick: onConnectWithX
9568
- }
9569
- }
9570
- ) : null,
9571
- reputation.phase === "error" ? /* @__PURE__ */ jsx(ReputationNotice, { title: "Could not load reputation", description: reputation.message }) : null
9572
- ] })
9573
- ] });
9574
+ ) : null,
9575
+ reputation.phase === "disconnected" ? /* @__PURE__ */ jsx(
9576
+ ReputationNotice,
9577
+ {
9578
+ title: "Not connected",
9579
+ description: "Connect with Fluent ID to see your reputation."
9580
+ }
9581
+ ) : null,
9582
+ reputation.phase === "signup" ? /* @__PURE__ */ jsx(
9583
+ ReputationNotice,
9584
+ {
9585
+ title: "No reputation available",
9586
+ description: "Connect your X account to access your reputation.",
9587
+ action: {
9588
+ label: "Connect with X",
9589
+ icon: "x",
9590
+ onClick: onConnectWithX
9591
+ }
9592
+ }
9593
+ ) : null,
9594
+ reputation.phase === "error" ? /* @__PURE__ */ jsx(ReputationNotice, { title: "Could not load reputation", description: reputation.message }) : null
9595
+ ] }) : null
9596
+ ]
9597
+ }
9598
+ )
9599
+ );
9574
9600
  }
9575
9601
  var MOBILE_BREAKPOINT = 768;
9576
9602
  function useIsMobile() {
@@ -10377,6 +10403,23 @@ function useAuthToken(params) {
10377
10403
  walletClient
10378
10404
  ]);
10379
10405
  }
10406
+ function AccountAvatar({ userLogoUrl, defaultLogoUrl, className }) {
10407
+ const src = userLogoUrl || defaultLogoUrl || void 0;
10408
+ const [failedSrc, setFailedSrc] = useState(null);
10409
+ useEffect(() => setFailedSrc(null), [src]);
10410
+ if (!src || failedSrc === src) {
10411
+ return /* @__PURE__ */ jsx(Icon, { name: "fluent", className: cn("size-3", className) });
10412
+ }
10413
+ return /* @__PURE__ */ jsx(
10414
+ "img",
10415
+ {
10416
+ src,
10417
+ alt: "",
10418
+ className: "size-full rounded-md object-cover",
10419
+ onError: () => setFailedSrc(src)
10420
+ }
10421
+ );
10422
+ }
10380
10423
  var DrawerContext = React2.createContext(null);
10381
10424
  function useDrawer() {
10382
10425
  const context = React2.useContext(DrawerContext);
@@ -10558,7 +10601,8 @@ function FluentAccountDrawer({
10558
10601
  modal,
10559
10602
  disablePointerDismissal,
10560
10603
  children,
10561
- userLogoUrl
10604
+ userLogoUrl,
10605
+ defaultLogoUrl
10562
10606
  }) {
10563
10607
  return /* @__PURE__ */ jsxs(
10564
10608
  Drawer,
@@ -10590,14 +10634,7 @@ function FluentAccountDrawer({
10590
10634
  "aria-label": "Account actions",
10591
10635
  className: "!h-auto w-full gap-2 overflow-hidden rounded-xl border border-foreground/10 !bg-transparent p-1.5 pr-3 hover:border-foreground/20 hover:!bg-foreground/5 aria-expanded:border-foreground/20 aria-expanded:!bg-foreground/5",
10592
10636
  children: [
10593
- /* @__PURE__ */ jsx("div", { className: "flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-md bg-foreground/10 text-foreground", children: userLogoUrl ? /* @__PURE__ */ jsx(
10594
- "img",
10595
- {
10596
- src: userLogoUrl,
10597
- alt: "User logo",
10598
- className: "size-full rounded-md object-cover"
10599
- }
10600
- ) : /* @__PURE__ */ jsx(Icon, { name: "fluent", className: "size-3" }) }),
10637
+ /* @__PURE__ */ jsx("div", { className: "flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-md bg-foreground/10 text-foreground", children: /* @__PURE__ */ jsx(AccountAvatar, { userLogoUrl, defaultLogoUrl }) }),
10601
10638
  /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-left text-sm font-medium leading-none text-foreground", children: formatAddress(accountMenuAddress) })
10602
10639
  ]
10603
10640
  }
@@ -10623,7 +10660,7 @@ function FluentAccountDrawer({
10623
10660
  ] })
10624
10661
  ] })
10625
10662
  ] }) : /* @__PURE__ */ jsxs("div", { className: "relative flex items-center gap-2 overflow-hidden rounded-xl border border-foreground/10 p-2 pr-3 shadow-2xl", children: [
10626
- /* @__PURE__ */ jsx("div", { className: "relative z-10 flex size-8 items-center justify-center rounded-md bg-foreground/10", children: /* @__PURE__ */ jsx(Icon, { name: "fluent", className: "size-3" }) }),
10663
+ /* @__PURE__ */ jsx("div", { className: "relative z-10 flex size-8 items-center justify-center overflow-hidden rounded-md bg-foreground/10", children: /* @__PURE__ */ jsx(AccountAvatar, { userLogoUrl, defaultLogoUrl }) }),
10627
10664
  /* @__PURE__ */ jsx("div", { className: "relative z-10 text-sm font-medium leading-none", children: "Connected" })
10628
10665
  ] }) }),
10629
10666
  /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-4", children })
@@ -10638,16 +10675,10 @@ function FluentWidgetConnectButton({
10638
10675
  addressLabel,
10639
10676
  onClick,
10640
10677
  className,
10641
- userLogoUrl
10678
+ userLogoUrl,
10679
+ defaultLogoUrl
10642
10680
  }) {
10643
- const userLogo = userLogoUrl ? /* @__PURE__ */ jsx(
10644
- "img",
10645
- {
10646
- src: userLogoUrl,
10647
- alt: "User logo",
10648
- className: "size-full rounded-md object-cover"
10649
- }
10650
- ) : /* @__PURE__ */ jsx(Icon, { name: "fluent", className: "size-3" });
10681
+ const userLogo = /* @__PURE__ */ jsx(AccountAvatar, { userLogoUrl, defaultLogoUrl });
10651
10682
  return /* @__PURE__ */ jsxs(
10652
10683
  "button",
10653
10684
  {
@@ -10687,7 +10718,8 @@ function FluentConnectButtonSlot({
10687
10718
  openAccount,
10688
10719
  renderConnectButton,
10689
10720
  connectButton,
10690
- userLogoUrl
10721
+ userLogoUrl,
10722
+ defaultLogoUrl
10691
10723
  }) {
10692
10724
  const connectAddressLabel = hasConnectedAccount ? externalWalletConnected ? connectedAddress ? formatAddress(connectedAddress) : "Connected" : fluentAccountAddress ? formatAddress(fluentAccountAddress) : "Connected" : void 0;
10693
10725
  const defaultConnectButton = /* @__PURE__ */ jsx(
@@ -10697,7 +10729,8 @@ function FluentConnectButtonSlot({
10697
10729
  pending: connecting,
10698
10730
  addressLabel: connectAddressLabel,
10699
10731
  onClick: onTopConnectClick,
10700
- userLogoUrl
10732
+ userLogoUrl,
10733
+ defaultLogoUrl
10701
10734
  }
10702
10735
  );
10703
10736
  const connectButtonContext = {
@@ -11104,6 +11137,8 @@ function FluentWidgetContent({
11104
11137
  getAuthToken
11105
11138
  ]
11106
11139
  );
11140
+ const accountAvatarUrl = resolvedConfig.avatar.forceDefault ? void 0 : getHighResTwitterAvatar(user?.twitter?.profilePictureUrl);
11141
+ const defaultLogoUrl = resolvedConfig.avatar.defaultLogoUrl;
11107
11142
  const widget = /* @__PURE__ */ jsx(FluentPortalContainerProvider, { children: /* @__PURE__ */ jsxs(Toaster, { children: [
11108
11143
  /* @__PURE__ */ jsx("div", { className: WIDGET_STYLE_SCOPE, children: /* @__PURE__ */ jsx(
11109
11144
  FluentAccountDrawer,
@@ -11116,7 +11151,8 @@ function FluentWidgetContent({
11116
11151
  onAccountMenuAction: handleAccountMenuAction,
11117
11152
  settingsOpen: walletMenuTab === "settings",
11118
11153
  onCloseSettings: closeSettings,
11119
- userLogoUrl: getHighResTwitterAvatar(user?.twitter?.profilePictureUrl),
11154
+ userLogoUrl: accountAvatarUrl,
11155
+ defaultLogoUrl,
11120
11156
  connectButton: /* @__PURE__ */ jsx(
11121
11157
  FluentConnectButtonSlot,
11122
11158
  {
@@ -11130,7 +11166,8 @@ function FluentWidgetContent({
11130
11166
  openAccount: openAccountMenu,
11131
11167
  renderConnectButton,
11132
11168
  connectButton,
11133
- userLogoUrl: getHighResTwitterAvatar(user?.twitter?.profilePictureUrl)
11169
+ userLogoUrl: accountAvatarUrl,
11170
+ defaultLogoUrl
11134
11171
  }
11135
11172
  ),
11136
11173
  children: /* @__PURE__ */ jsx(
@@ -11394,6 +11431,6 @@ function FluentWidget(props) {
11394
11431
  ) });
11395
11432
  }
11396
11433
 
11397
- export { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FLUENT_CONNECT_DEFAULT_ASSETS, FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES, FLUENT_USER_TOKEN_LIMIT, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_WIDGET_USER_TOKENS_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY, FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT, FluentAccountDrawer, FluentAuthError, FluentPortalContainerProvider, FluentWidget, FluentWidgetConnectButton, FluentWidgetNetworkProvider, Icon, Label, Separator, WIDGET_STYLE_SCOPE, WalletMenuActionCard, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentSponsorshipRpcUrl, createFluentUserTokenStore, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, createFluentZeroDevSponsoredPaymaster, findFluentSymbolCollisions, fluent2 as fluent, apps as fluentApps, fluentBridgeAbi, fluent as fluentChain, fluentChains, fluentDefinitionToViemChain, integrations as fluentIntegrations, l1Chains as fluentL1Chains, fluentMainnet, fluentMainnetTokenDefaults, fluentTestnet, fluentTestnetTokenDefaults, fluentTokenIdentity, fluentZeroDevChainIds, getApp, getContractAddressFromChain, getFluentChain, getFluentChainByChainId, getFluentChainForNetwork, getFluentDefaultWidgetDisplayTokens, getFluentDefaultWidgetGasTokens, getFluentExplorerBaseUrl, getFluentGasPaymentEthValue, getFluentGasPaymentTokens, getFluentGasPaymentValueTier, getFluentGasTokenAddress, getFluentTokenDefaults, getFluentTokenDefaultsForNetwork, getFluentZeroDevErc20PaymasterTokens, getL1Chain, getL1ForFluentChain, getZeroDevRpcUrl, getZerodevIntegration, isFaucetNetwork, isFluentDefaultToken, isFluentNativeToken, isFluentZeroDevChain, l1DefinitionToViemChain, mergeFluentDisplayTokens, normalizeFluentWidgetNetwork, readFluentTokenBalances, readFluentTokenMetadata, registryVersion, resolveBridgeAddresses, resolveFluentWidgetNetworkFromEnv, resolveFluentZeroDevErc20PaymasterToken, resolveL1Definition, selectFluentGasPaymentToken, sendFluentZeroDevErc20PaymasterDemo, sortFluentGasTokens, useFluentUserTokens, useFluentWidget, useFluentWidgetNetwork, useFluentZeroDevAccount, useWidget };
11434
+ export { AccountAvatar, Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FLUENT_CONNECT_DEFAULT_ASSETS, FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES, FLUENT_USER_TOKEN_LIMIT, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_WIDGET_USER_TOKENS_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY, FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT, FluentAccountDrawer, FluentAuthError, FluentPortalContainerProvider, FluentWidget, FluentWidgetConnectButton, FluentWidgetNetworkProvider, Icon, Label, Separator, WIDGET_STYLE_SCOPE, WalletMenuActionCard, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentSponsorshipRpcUrl, createFluentUserTokenStore, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, createFluentZeroDevSponsoredPaymaster, findFluentSymbolCollisions, fluent2 as fluent, apps as fluentApps, fluentBridgeAbi, fluent as fluentChain, fluentChains, fluentDefinitionToViemChain, integrations as fluentIntegrations, l1Chains as fluentL1Chains, fluentMainnet, fluentMainnetTokenDefaults, fluentTestnet, fluentTestnetTokenDefaults, fluentTokenIdentity, fluentZeroDevChainIds, getApp, getContractAddressFromChain, getFluentChain, getFluentChainByChainId, getFluentChainForNetwork, getFluentDefaultWidgetDisplayTokens, getFluentDefaultWidgetGasTokens, getFluentExplorerBaseUrl, getFluentGasPaymentEthValue, getFluentGasPaymentTokens, getFluentGasPaymentValueTier, getFluentGasTokenAddress, getFluentTokenDefaults, getFluentTokenDefaultsForNetwork, getFluentZeroDevErc20PaymasterTokens, getL1Chain, getL1ForFluentChain, getZeroDevRpcUrl, getZerodevIntegration, isFaucetNetwork, isFluentDefaultToken, isFluentNativeToken, isFluentZeroDevChain, l1DefinitionToViemChain, mergeFluentDisplayTokens, normalizeFluentWidgetNetwork, readFluentTokenBalances, readFluentTokenMetadata, registryVersion, resolveBridgeAddresses, resolveFluentWidgetNetworkFromEnv, resolveFluentZeroDevErc20PaymasterToken, resolveL1Definition, selectFluentGasPaymentToken, sendFluentZeroDevErc20PaymasterDemo, sortFluentGasTokens, useFluentUserTokens, useFluentWidget, useFluentWidgetNetwork, useFluentZeroDevAccount, useWidget };
11398
11435
  //# sourceMappingURL=index.js.map
11399
11436
  //# sourceMappingURL=index.js.map