@sesionario/blocks 1.17.0 → 1.17.1

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.d.cts CHANGED
@@ -246,8 +246,11 @@ type LanguageSwitcherProps = {
246
246
  declare function LanguageSwitcher({ languages: propLanguages, currentLanguage: propCurrentLanguage, onLanguageChange: propOnLanguageChange, labels, className, size, shape, variant, showIcon, align, side, }: LanguageSwitcherProps): React.JSX.Element;
247
247
 
248
248
  type PlatformNavbarProps = {
249
- /** Brand mark (isotype). Typically a link to the member app home. */
250
- logo: ReactNode;
249
+ /**
250
+ * Brand mark (isotype). Typically a link to the member app home.
251
+ * Omit in shells that already brand the sidebar.
252
+ */
253
+ logo?: ReactNode;
251
254
  /** Optional control before the center (e.g. SidebarTrigger). */
252
255
  leading?: ReactNode;
253
256
  /** Flex-growing center slot (tabs, subtitle). Horizontally scrollable. */
@@ -259,7 +262,7 @@ type PlatformNavbarProps = {
259
262
  innerClassName?: string;
260
263
  };
261
264
  /**
262
- * Shared sticky top chrome: logo | optional leading | scrollable center | fixed right.
265
+ * Shared sticky top chrome: optional logo | optional leading | scrollable center | fixed right.
263
266
  * Apps inject search, notifications, and the account menu into `right`.
264
267
  */
265
268
  declare function PlatformNavbar({ logo, leading, center, right, className, innerClassName, }: PlatformNavbarProps): React.JSX.Element;
@@ -293,7 +296,6 @@ type PlatformAccountMenuUrls = {
293
296
  authAppUrl: string;
294
297
  appUrl: string;
295
298
  adminUrl: string;
296
- backofficeUrl: string;
297
299
  loginPath?: string;
298
300
  accountPath?: string;
299
301
  activityPath?: string;
@@ -305,15 +307,6 @@ type PlatformAccountMenuLabels = {
305
307
  personalProfile: string;
306
308
  activity: string;
307
309
  professionalProfile: string;
308
- /** @deprecated Unused; kept so apps can pass labels without breaking. */
309
- mainApp: string;
310
- /** @deprecated Unused; kept so apps can pass labels without breaking. */
311
- orgManagement: string;
312
- backoffice: string;
313
- /** @deprecated Unused; kept so apps can pass labels without breaking. */
314
- memberOrgs: string;
315
- /** @deprecated Unused; kept so apps can pass labels without breaking. */
316
- managementOrgs: string;
317
310
  showMoreOrgs: string;
318
311
  showLessOrgs: string;
319
312
  manageOrg: string;
@@ -339,8 +332,6 @@ type PlatformAccountMenuProps = {
339
332
  /** While session is resolving. */
340
333
  isPending?: boolean;
341
334
  user?: PlatformAccountMenuUser | null;
342
- /** Platform admin (JWT role includes admin). Enables Backoffice link. */
343
- isAdmin?: boolean;
344
335
  verificationStatus?: ProfessionalVerificationStatus;
345
336
  urls: PlatformAccountMenuUrls;
346
337
  memberOrgs?: PlatformAccountMenuOrg[];
@@ -368,7 +359,7 @@ type PlatformAccountMenuProps = {
368
359
  * Cross-app account / settings menu. Guest trigger is a settings cog;
369
360
  * signed-in trigger is the user avatar.
370
361
  */
371
- declare function PlatformAccountMenu({ variant, isPending, user, isAdmin, verificationStatus, urls, memberOrgs, manageableOrgs, languages, currentLanguage, onLanguageChange, labels: labelsProp, onSignOut, extraItems, trigger: triggerProp, contentSide, contentAlign, contentSideOffset, contentClassName, className, }: PlatformAccountMenuProps): React.JSX.Element;
362
+ declare function PlatformAccountMenu({ variant, isPending, user, verificationStatus, urls, memberOrgs, manageableOrgs, languages, currentLanguage, onLanguageChange, labels: labelsProp, onSignOut, extraItems, trigger: triggerProp, contentSide, contentAlign, contentSideOffset, contentClassName, className, }: PlatformAccountMenuProps): React.JSX.Element;
372
363
 
373
364
  declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
374
365
  inset?: boolean;
package/dist/index.d.ts CHANGED
@@ -246,8 +246,11 @@ type LanguageSwitcherProps = {
246
246
  declare function LanguageSwitcher({ languages: propLanguages, currentLanguage: propCurrentLanguage, onLanguageChange: propOnLanguageChange, labels, className, size, shape, variant, showIcon, align, side, }: LanguageSwitcherProps): React.JSX.Element;
247
247
 
248
248
  type PlatformNavbarProps = {
249
- /** Brand mark (isotype). Typically a link to the member app home. */
250
- logo: ReactNode;
249
+ /**
250
+ * Brand mark (isotype). Typically a link to the member app home.
251
+ * Omit in shells that already brand the sidebar.
252
+ */
253
+ logo?: ReactNode;
251
254
  /** Optional control before the center (e.g. SidebarTrigger). */
252
255
  leading?: ReactNode;
253
256
  /** Flex-growing center slot (tabs, subtitle). Horizontally scrollable. */
@@ -259,7 +262,7 @@ type PlatformNavbarProps = {
259
262
  innerClassName?: string;
260
263
  };
261
264
  /**
262
- * Shared sticky top chrome: logo | optional leading | scrollable center | fixed right.
265
+ * Shared sticky top chrome: optional logo | optional leading | scrollable center | fixed right.
263
266
  * Apps inject search, notifications, and the account menu into `right`.
264
267
  */
265
268
  declare function PlatformNavbar({ logo, leading, center, right, className, innerClassName, }: PlatformNavbarProps): React.JSX.Element;
@@ -293,7 +296,6 @@ type PlatformAccountMenuUrls = {
293
296
  authAppUrl: string;
294
297
  appUrl: string;
295
298
  adminUrl: string;
296
- backofficeUrl: string;
297
299
  loginPath?: string;
298
300
  accountPath?: string;
299
301
  activityPath?: string;
@@ -305,15 +307,6 @@ type PlatformAccountMenuLabels = {
305
307
  personalProfile: string;
306
308
  activity: string;
307
309
  professionalProfile: string;
308
- /** @deprecated Unused; kept so apps can pass labels without breaking. */
309
- mainApp: string;
310
- /** @deprecated Unused; kept so apps can pass labels without breaking. */
311
- orgManagement: string;
312
- backoffice: string;
313
- /** @deprecated Unused; kept so apps can pass labels without breaking. */
314
- memberOrgs: string;
315
- /** @deprecated Unused; kept so apps can pass labels without breaking. */
316
- managementOrgs: string;
317
310
  showMoreOrgs: string;
318
311
  showLessOrgs: string;
319
312
  manageOrg: string;
@@ -339,8 +332,6 @@ type PlatformAccountMenuProps = {
339
332
  /** While session is resolving. */
340
333
  isPending?: boolean;
341
334
  user?: PlatformAccountMenuUser | null;
342
- /** Platform admin (JWT role includes admin). Enables Backoffice link. */
343
- isAdmin?: boolean;
344
335
  verificationStatus?: ProfessionalVerificationStatus;
345
336
  urls: PlatformAccountMenuUrls;
346
337
  memberOrgs?: PlatformAccountMenuOrg[];
@@ -368,7 +359,7 @@ type PlatformAccountMenuProps = {
368
359
  * Cross-app account / settings menu. Guest trigger is a settings cog;
369
360
  * signed-in trigger is the user avatar.
370
361
  */
371
- declare function PlatformAccountMenu({ variant, isPending, user, isAdmin, verificationStatus, urls, memberOrgs, manageableOrgs, languages, currentLanguage, onLanguageChange, labels: labelsProp, onSignOut, extraItems, trigger: triggerProp, contentSide, contentAlign, contentSideOffset, contentClassName, className, }: PlatformAccountMenuProps): React.JSX.Element;
362
+ declare function PlatformAccountMenu({ variant, isPending, user, verificationStatus, urls, memberOrgs, manageableOrgs, languages, currentLanguage, onLanguageChange, labels: labelsProp, onSignOut, extraItems, trigger: triggerProp, contentSide, contentAlign, contentSideOffset, contentClassName, className, }: PlatformAccountMenuProps): React.JSX.Element;
372
363
 
373
364
  declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
374
365
  inset?: boolean;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import * as React7 from 'react';
3
3
  import { createContext, useContext, useState, useRef, useEffect, useLayoutEffect, useCallback, useMemo, useId } from 'react';
4
- import { ChevronsUpDown, CheckIcon, Smile, SearchIcon, Search, Clock, Flag, Hash, Lightbulb, Trophy, Plane, Apple, Leaf, Hand, Loader2, AlertTriangle, Inbox, X, ChevronLeft, ChevronRight, Monitor, Sun, Moon, Building2, Check, Plus, Languages, BadgeCheck, Settings, User, Activity, LayoutDashboard, LogOut, LogIn, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, Pencil, Play, AlertCircle, VolumeX, Pause, Volume1, Volume2, PictureInPicture2, Minimize, Maximize, ArrowDownIcon, MessageCircleDashedIcon, MessageCircle, ChevronUp, ChevronDown, XIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
4
+ import { ChevronsUpDown, CheckIcon, Smile, SearchIcon, Search, Clock, Flag, Hash, Lightbulb, Trophy, Plane, Apple, Leaf, Hand, Loader2, AlertTriangle, Inbox, X, ChevronLeft, ChevronRight, Monitor, Sun, Moon, Building2, Check, Plus, Languages, BadgeCheck, Settings, User, Activity, LogOut, LogIn, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, Pencil, Play, AlertCircle, VolumeX, Pause, Volume1, Volume2, PictureInPicture2, Minimize, Maximize, ArrowDownIcon, MessageCircleDashedIcon, MessageCircle, ChevronUp, ChevronDown, XIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
5
5
  import { clsx } from 'clsx';
6
6
  import { twMerge } from 'tailwind-merge';
7
7
  import { cva } from 'class-variance-authority';
@@ -1715,7 +1715,7 @@ function PlatformNavbar({
1715
1715
  innerClassName
1716
1716
  ),
1717
1717
  children: [
1718
- /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-2", children: logo }),
1718
+ logo != null && logo !== false ? /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-2", children: logo }) : null,
1719
1719
  leading ? /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-2", children: leading }) : null,
1720
1720
  /* @__PURE__ */ jsx(
1721
1721
  "div",
@@ -1800,11 +1800,6 @@ var defaultLabels3 = {
1800
1800
  personalProfile: "Personal profile",
1801
1801
  activity: "Activity",
1802
1802
  professionalProfile: "Professional profile",
1803
- mainApp: "Main app",
1804
- orgManagement: "Organization management",
1805
- backoffice: "Backoffice",
1806
- memberOrgs: "My organizations",
1807
- managementOrgs: "Management team",
1808
1803
  showMoreOrgs: "Show more",
1809
1804
  showLessOrgs: "Show less",
1810
1805
  manageOrg: "Manage organization",
@@ -1883,9 +1878,9 @@ function LanguageThemeSubs({
1883
1878
  const themeValue = theme ?? "system";
1884
1879
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1885
1880
  /* @__PURE__ */ jsxs(DropdownMenuSub, { children: [
1886
- /* @__PURE__ */ jsxs(DropdownMenuSubTrigger, { className: "gap-2", children: [
1887
- /* @__PURE__ */ jsx(Languages, { className: "size-4" }),
1888
- labels.language
1881
+ /* @__PURE__ */ jsxs(DropdownMenuSubTrigger, { className: "gap-2 [&>svg:last-child]:ml-0", children: [
1882
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: labels.language }),
1883
+ /* @__PURE__ */ jsx(Languages, { className: "size-4" })
1889
1884
  ] }),
1890
1885
  /* @__PURE__ */ jsx(DropdownMenuSubContent, { className: "min-w-40", children: /* @__PURE__ */ jsx(
1891
1886
  DropdownMenuRadioGroup,
@@ -1897,9 +1892,9 @@ function LanguageThemeSubs({
1897
1892
  ) })
1898
1893
  ] }),
1899
1894
  /* @__PURE__ */ jsxs(DropdownMenuSub, { children: [
1900
- /* @__PURE__ */ jsxs(DropdownMenuSubTrigger, { className: "gap-2", children: [
1901
- themeValue === "light" ? /* @__PURE__ */ jsx(Sun, { className: "size-4" }) : themeValue === "dark" ? /* @__PURE__ */ jsx(Moon, { className: "size-4" }) : /* @__PURE__ */ jsx(Monitor, { className: "size-4" }),
1902
- labels.theme
1895
+ /* @__PURE__ */ jsxs(DropdownMenuSubTrigger, { className: "gap-2 [&>svg:last-child]:ml-0", children: [
1896
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: labels.theme }),
1897
+ themeValue === "light" ? /* @__PURE__ */ jsx(Sun, { className: "size-4" }) : themeValue === "dark" ? /* @__PURE__ */ jsx(Moon, { className: "size-4" }) : /* @__PURE__ */ jsx(Monitor, { className: "size-4" })
1903
1898
  ] }),
1904
1899
  /* @__PURE__ */ jsx(DropdownMenuSubContent, { className: "min-w-40", children: /* @__PURE__ */ jsxs(DropdownMenuRadioGroup, { value: themeValue, onValueChange: setTheme, children: [
1905
1900
  /* @__PURE__ */ jsx(DropdownMenuRadioItem, { value: "system", children: labels.themeSystem }),
@@ -1933,14 +1928,14 @@ function OrgMenuRows({
1933
1928
  return /* @__PURE__ */ jsxs(
1934
1929
  "div",
1935
1930
  {
1936
- className: "relative flex items-center",
1931
+ className: "relative",
1937
1932
  "data-testid": `platform-account-org-${org.id}`,
1938
1933
  children: [
1939
1934
  /* @__PURE__ */ jsx(
1940
1935
  DropdownMenuItem,
1941
1936
  {
1942
1937
  asChild: true,
1943
- className: cn("min-w-0 flex-1 gap-2", org.canManage && "pr-9"),
1938
+ className: cn("gap-2", org.canManage && "pr-9"),
1944
1939
  children: /* @__PURE__ */ jsxs("a", { href: orgHomeHref, children: [
1945
1940
  /* @__PURE__ */ jsx(
1946
1941
  MenuAvatar,
@@ -1950,7 +1945,7 @@ function OrgMenuRows({
1950
1945
  sizeClass: "size-6"
1951
1946
  }
1952
1947
  ),
1953
- /* @__PURE__ */ jsx("span", { className: "truncate", children: org.name })
1948
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: org.name })
1954
1949
  ] })
1955
1950
  }
1956
1951
  ),
@@ -1958,8 +1953,8 @@ function OrgMenuRows({
1958
1953
  DropdownMenuItem,
1959
1954
  {
1960
1955
  asChild: true,
1961
- className: "absolute right-1 top-1/2 size-7 -translate-y-1/2 p-0",
1962
- children: /* @__PURE__ */ jsx("a", { href: manageHref, "aria-label": labels.manageOrg, children: /* @__PURE__ */ jsx(Settings, { className: "size-3.5" }) })
1956
+ className: "absolute right-0.5 top-1/2 size-7 -translate-y-1/2 p-0",
1957
+ children: /* @__PURE__ */ jsx("a", { href: manageHref, "aria-label": labels.manageOrg, children: /* @__PURE__ */ jsx(Settings, { className: "size-4" }) })
1963
1958
  }
1964
1959
  ) : null
1965
1960
  ]
@@ -1967,7 +1962,7 @@ function OrgMenuRows({
1967
1962
  org.id
1968
1963
  );
1969
1964
  }),
1970
- collapsible ? /* @__PURE__ */ jsx(
1965
+ collapsible ? /* @__PURE__ */ jsxs(
1971
1966
  DropdownMenuItem,
1972
1967
  {
1973
1968
  className: "gap-2",
@@ -1975,13 +1970,10 @@ function OrgMenuRows({
1975
1970
  event.preventDefault();
1976
1971
  setExpanded((value) => !value);
1977
1972
  },
1978
- children: expanded ? /* @__PURE__ */ jsxs(Fragment, { children: [
1979
- /* @__PURE__ */ jsx(ChevronUp, { className: "size-4" }),
1980
- labels.showLessOrgs
1981
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1982
- /* @__PURE__ */ jsx(ChevronDown, { className: "size-4" }),
1983
- labels.showMoreOrgs
1984
- ] })
1973
+ children: [
1974
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: expanded ? labels.showLessOrgs : labels.showMoreOrgs }),
1975
+ expanded ? /* @__PURE__ */ jsx(ChevronUp, { className: "size-4" }) : /* @__PURE__ */ jsx(ChevronDown, { className: "size-4" })
1976
+ ]
1985
1977
  }
1986
1978
  ) : null
1987
1979
  ]
@@ -1992,7 +1984,6 @@ function PlatformAccountMenu({
1992
1984
  variant = "platform",
1993
1985
  isPending = false,
1994
1986
  user = null,
1995
- isAdmin = false,
1996
1987
  verificationStatus = "unverified",
1997
1988
  urls,
1998
1989
  memberOrgs = [],
@@ -2016,6 +2007,7 @@ function PlatformAccountMenu({
2016
2007
  () => mergePlatformAccountOrgs(memberOrgs, manageableOrgs),
2017
2008
  [memberOrgs, manageableOrgs]
2018
2009
  );
2010
+ const hasOrgs = mergedOrgs.length > 0;
2019
2011
  const loginHref = `${urls.authAppUrl}${urls.loginPath ?? "/login"}`;
2020
2012
  const accountHref = `${urls.authAppUrl}${urls.accountPath ?? "/account"}`;
2021
2013
  const activityHref = `${urls.authAppUrl}${urls.activityPath ?? "/account/activity"}`;
@@ -2095,37 +2087,36 @@ function PlatformAccountMenu({
2095
2087
  ] }),
2096
2088
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
2097
2089
  variant === "platform" ? /* @__PURE__ */ jsxs(Fragment, { children: [
2090
+ hasOrgs ? /* @__PURE__ */ jsxs(Fragment, { children: [
2091
+ /* @__PURE__ */ jsx(
2092
+ OrgMenuRows,
2093
+ {
2094
+ orgs: mergedOrgs,
2095
+ appUrl: urls.appUrl,
2096
+ adminUrl: urls.adminUrl,
2097
+ labels
2098
+ }
2099
+ ),
2100
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
2101
+ ] }) : null,
2098
2102
  /* @__PURE__ */ jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxs("a", { href: accountHref, children: [
2099
- /* @__PURE__ */ jsx(User, { className: "size-4" }),
2100
- labels.personalProfile
2103
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: labels.personalProfile }),
2104
+ /* @__PURE__ */ jsx(User, { className: "size-4" })
2101
2105
  ] }) }),
2102
2106
  /* @__PURE__ */ jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxs("a", { href: activityHref, children: [
2103
- /* @__PURE__ */ jsx(Activity, { className: "size-4" }),
2104
- labels.activity
2107
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: labels.activity }),
2108
+ /* @__PURE__ */ jsx(Activity, { className: "size-4" })
2105
2109
  ] }) }),
2106
2110
  /* @__PURE__ */ jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxs("a", { href: profileHref, children: [
2107
- /* @__PURE__ */ jsx(User, { className: "size-4" }),
2108
- labels.professionalProfile
2111
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: labels.professionalProfile }),
2112
+ /* @__PURE__ */ jsx(User, { className: "size-4" })
2109
2113
  ] }) }),
2110
- /* @__PURE__ */ jsx(
2111
- OrgMenuRows,
2112
- {
2113
- orgs: mergedOrgs,
2114
- appUrl: urls.appUrl,
2115
- adminUrl: urls.adminUrl,
2116
- labels
2117
- }
2118
- ),
2119
2114
  extraItems,
2120
- isAdmin && urls.backofficeUrl ? /* @__PURE__ */ jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxs("a", { href: urls.backofficeUrl, children: [
2121
- /* @__PURE__ */ jsx(LayoutDashboard, { className: "size-4" }),
2122
- labels.backoffice
2123
- ] }) }) : null,
2124
2115
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
2125
2116
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2126
2117
  /* @__PURE__ */ jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxs("a", { href: accountHref, children: [
2127
- /* @__PURE__ */ jsx(Settings, { className: "size-4" }),
2128
- labels.accountSettings
2118
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: labels.accountSettings }),
2119
+ /* @__PURE__ */ jsx(Settings, { className: "size-4" })
2129
2120
  ] }) }),
2130
2121
  extraItems,
2131
2122
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
@@ -2150,8 +2141,8 @@ function PlatformAccountMenu({
2150
2141
  void handleSignOut();
2151
2142
  },
2152
2143
  children: [
2153
- /* @__PURE__ */ jsx(LogOut, { className: "size-4" }),
2154
- signingOut ? labels.signingOut : labels.signOut
2144
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: signingOut ? labels.signingOut : labels.signOut }),
2145
+ /* @__PURE__ */ jsx(LogOut, { className: "size-4" })
2155
2146
  ]
2156
2147
  }
2157
2148
  )
@@ -2167,8 +2158,8 @@ function PlatformAccountMenu({
2167
2158
  ),
2168
2159
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
2169
2160
  /* @__PURE__ */ jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxs("a", { href: loginHref, children: [
2170
- /* @__PURE__ */ jsx(LogIn, { className: "size-4" }),
2171
- labels.signIn
2161
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: labels.signIn }),
2162
+ /* @__PURE__ */ jsx(LogIn, { className: "size-4" })
2172
2163
  ] }) })
2173
2164
  ] })
2174
2165
  }
@@ -7241,6 +7232,7 @@ function SupportMessengerProvider({
7241
7232
  className
7242
7233
  }) {
7243
7234
  const isMobile = useMediaQuery2("(max-width: 767px)");
7235
+ const dockRef = useRef(null);
7244
7236
  const [listOpen, setListOpen] = useState(false);
7245
7237
  const [threads, setThreads] = useState([]);
7246
7238
  const [mobileThreadKey, setMobileThreadKey] = useState(null);
@@ -7248,6 +7240,7 @@ function SupportMessengerProvider({
7248
7240
  () => items.reduce((sum, item) => sum + (item.unreadCount ?? 0), 0),
7249
7241
  [items]
7250
7242
  );
7243
+ const isDesktopOpen = !isMobile && (listOpen || threads.length > 0);
7251
7244
  useEffect(() => {
7252
7245
  if (!forceMinimized) return;
7253
7246
  setListOpen(false);
@@ -7290,6 +7283,20 @@ function SupportMessengerProvider({
7290
7283
  setThreads([]);
7291
7284
  setMobileThreadKey(null);
7292
7285
  }, []);
7286
+ useEffect(() => {
7287
+ if (!isDesktopOpen) return;
7288
+ function onPointerDown(event) {
7289
+ const target = event.target;
7290
+ if (!(target instanceof Node)) return;
7291
+ if (dockRef.current?.contains(target)) return;
7292
+ if (target instanceof Element && target.closest('[data-slot="popover-content"]')) {
7293
+ return;
7294
+ }
7295
+ closeAll();
7296
+ }
7297
+ document.addEventListener("pointerdown", onPointerDown);
7298
+ return () => document.removeEventListener("pointerdown", onPointerDown);
7299
+ }, [isDesktopOpen, closeAll]);
7293
7300
  const ctx = useMemo(
7294
7301
  () => ({
7295
7302
  listOpen,
@@ -7333,6 +7340,7 @@ function SupportMessengerProvider({
7333
7340
  enabled ? /* @__PURE__ */ jsxs(
7334
7341
  "div",
7335
7342
  {
7343
+ ref: dockRef,
7336
7344
  className: cn(
7337
7345
  "pointer-events-none fixed right-4 bottom-4 z-50 flex flex-col items-end gap-3",
7338
7346
  className