@serhii.olishevskyi/docs 1.0.8 → 1.1.0

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.
@@ -1531,7 +1531,7 @@ var SEVERITY_ICONS = {
1531
1531
  info: /* @__PURE__ */ jsx12(InfoIcon, { color: "info", sx: { fontSize: 40 } }),
1532
1532
  success: /* @__PURE__ */ jsx12(SuccessIcon, { color: "success", sx: { fontSize: 40 } })
1533
1533
  };
1534
- var ConfirmationProvider = ({ children }) => {
1534
+ var ConfirmationProvider = ({ overrideNamespace, children }) => {
1535
1535
  const [open, setOpen] = useState9(false);
1536
1536
  const [options, setOptions] = useState9(null);
1537
1537
  const [resolver, setResolver] = useState9(null);
@@ -1563,7 +1563,7 @@ var ConfirmationProvider = ({ children }) => {
1563
1563
  children: [
1564
1564
  /* @__PURE__ */ jsxs5(DialogTitle2, { sx: { display: "flex", alignItems: "center", gap: 1.5, pb: 1 }, children: [
1565
1565
  SEVERITY_ICONS[severityType],
1566
- /* @__PURE__ */ jsx12(Box3, { component: "span", sx: { fontWeight: 600 }, children: options?.title || /* @__PURE__ */ jsx12(TranslateText, { children: "Confirmation" }) })
1566
+ /* @__PURE__ */ jsx12(Box3, { component: "span", sx: { fontWeight: 600 }, children: options?.title || /* @__PURE__ */ jsx12(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "Confirmation" }) })
1567
1567
  ] }),
1568
1568
  /* @__PURE__ */ jsx12(DialogContent2, { sx: { py: 2 }, dividers: true, children: /* @__PURE__ */ jsx12(DialogContentText, { color: "text.secondary", children: options?.message }) }),
1569
1569
  /* @__PURE__ */ jsxs5(DialogActions2, { sx: { pt: 2, px: 2, justifyContent: "flex-end", gap: 1 }, children: [
@@ -1573,7 +1573,7 @@ var ConfirmationProvider = ({ children }) => {
1573
1573
  onClick: () => handleClose("cancel"),
1574
1574
  color: "inherit",
1575
1575
  variant: "text",
1576
- children: options?.cancelText || /* @__PURE__ */ jsx12(TranslateText, { children: "Cancel" })
1576
+ children: options?.cancelText || /* @__PURE__ */ jsx12(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "Cancel" })
1577
1577
  }
1578
1578
  ),
1579
1579
  options?.showNoButton && /* @__PURE__ */ jsx12(
@@ -1582,7 +1582,7 @@ var ConfirmationProvider = ({ children }) => {
1582
1582
  onClick: () => handleClose("no"),
1583
1583
  color: "inherit",
1584
1584
  variant: "outlined",
1585
- children: options?.noText || /* @__PURE__ */ jsx12(TranslateText, { children: "No" })
1585
+ children: options?.noText || /* @__PURE__ */ jsx12(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "No" })
1586
1586
  }
1587
1587
  ),
1588
1588
  /* @__PURE__ */ jsx12(
@@ -1592,7 +1592,7 @@ var ConfirmationProvider = ({ children }) => {
1592
1592
  color: options?.confirmColor || (severityType === "error" ? "error" : "primary"),
1593
1593
  variant: "contained",
1594
1594
  autoFocus: true,
1595
- children: options?.confirmText || /* @__PURE__ */ jsx12(TranslateText, { children: "Yes" })
1595
+ children: options?.confirmText || /* @__PURE__ */ jsx12(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "Yes" })
1596
1596
  }
1597
1597
  )
1598
1598
  ] })
@@ -1672,15 +1672,206 @@ var useAppSettings = () => {
1672
1672
  return context;
1673
1673
  };
1674
1674
 
1675
+ // src/context/UserSettingsProvider.tsx
1676
+ import { createContext as createContext12, useContext as useContext12, useEffect as useEffect8, useState as useState11, useCallback as useCallback6 } from "react";
1677
+
1678
+ // src/types/user.types.ts
1679
+ var defaultUserSettings = {
1680
+ sidebar_open: true,
1681
+ chat_open: false,
1682
+ language: "ua",
1683
+ theme_mode: "light"
1684
+ };
1685
+
1686
+ // src/context/UserSettingsProvider.tsx
1687
+ import { jsx as jsx14 } from "react/jsx-runtime";
1688
+ var UserSettingsContext = createContext12(void 0);
1689
+ var UserSettingsProvider = ({ children }) => {
1690
+ const supabase = useSupabase();
1691
+ const { user, isAuthenticated, loading: isAuthLoading } = useAuth();
1692
+ const userId = user?.id;
1693
+ const [settings, setSettings] = useState11({
1694
+ id: "",
1695
+ ...defaultUserSettings
1696
+ });
1697
+ const [loading, setLoading] = useState11(true);
1698
+ const [error, setError] = useState11(null);
1699
+ const [activeChatUserId, setActiveChatUserId] = useState11(null);
1700
+ const fetchSettings = useCallback6(async () => {
1701
+ if (isAuthLoading) return;
1702
+ if (!isAuthenticated || !userId) {
1703
+ setSettings({ id: "", ...defaultUserSettings });
1704
+ setLoading(false);
1705
+ return;
1706
+ }
1707
+ try {
1708
+ setSettings((prev) => {
1709
+ if (prev.id !== userId) {
1710
+ setLoading(true);
1711
+ }
1712
+ return prev;
1713
+ });
1714
+ setError(null);
1715
+ let { data, error: fetchError } = await supabase.from("user_settings").select("*").eq("id", userId).maybeSingle();
1716
+ if (fetchError) throw fetchError;
1717
+ if (!data) {
1718
+ const newSettings = {
1719
+ id: userId,
1720
+ sidebar_open: defaultUserSettings.sidebar_open ?? true,
1721
+ chat_open: defaultUserSettings.chat_open ?? false,
1722
+ language: defaultUserSettings.language ?? "ua",
1723
+ theme_mode: defaultUserSettings.theme_mode ?? "light"
1724
+ };
1725
+ const { data: insertedData, error: insertError } = await supabase.from("user_settings").insert(newSettings).select().single();
1726
+ if (insertError) {
1727
+ if (insertError.code === "23505") {
1728
+ const { data: retryData } = await supabase.from("user_settings").select("*").eq("id", userId).single();
1729
+ data = retryData;
1730
+ } else {
1731
+ throw insertError;
1732
+ }
1733
+ } else {
1734
+ data = insertedData;
1735
+ }
1736
+ }
1737
+ if (data) {
1738
+ setSettings({
1739
+ ...defaultUserSettings,
1740
+ ...data
1741
+ });
1742
+ if (data.theme_mode) {
1743
+ localStorage.setItem(THEME_MODE_STORAGE_KEY, data.theme_mode);
1744
+ }
1745
+ }
1746
+ } catch (err) {
1747
+ console.error("Failed to load user settings from Supabase:", err);
1748
+ setError(err.message || "Failed to load user settings");
1749
+ } finally {
1750
+ setLoading(false);
1751
+ }
1752
+ }, [isAuthenticated, isAuthLoading, userId]);
1753
+ useEffect8(() => {
1754
+ fetchSettings();
1755
+ }, [fetchSettings]);
1756
+ const toggleSidebar = useCallback6(
1757
+ async (open) => {
1758
+ const isExplicitBoolean = typeof open === "boolean";
1759
+ const nextState = isExplicitBoolean ? open : !settings.sidebar_open;
1760
+ setSettings((prev) => ({ ...prev, sidebar_open: nextState }));
1761
+ if (!userId) return;
1762
+ try {
1763
+ const { error: error2 } = await supabase.from("user_settings").update({ sidebar_open: nextState, updated_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", userId);
1764
+ if (error2) throw error2;
1765
+ } catch (err) {
1766
+ console.error("Failed to update sidebar state:", err);
1767
+ setSettings((prev) => ({ ...prev, sidebar_open: !nextState }));
1768
+ }
1769
+ },
1770
+ [settings.sidebar_open, userId]
1771
+ );
1772
+ const toggleChat = useCallback6(
1773
+ async (open) => {
1774
+ const isExplicitBoolean = typeof open === "boolean";
1775
+ const nextState = isExplicitBoolean ? open : !settings.chat_open;
1776
+ setSettings((prev) => ({ ...prev, chat_open: nextState }));
1777
+ if (!userId) return;
1778
+ try {
1779
+ const { error: error2 } = await supabase.from("user_settings").update({ chat_open: nextState, updated_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", userId);
1780
+ if (error2) throw error2;
1781
+ } catch (err) {
1782
+ console.error("Failed to update chat state:", err);
1783
+ setSettings((prev) => ({ ...prev, chat_open: !nextState }));
1784
+ }
1785
+ },
1786
+ [settings.chat_open, userId]
1787
+ );
1788
+ const openChatWithUser = useCallback6(
1789
+ async (targetUserId) => {
1790
+ setActiveChatUserId(targetUserId);
1791
+ if (!settings.chat_open) {
1792
+ await toggleChat(true);
1793
+ }
1794
+ },
1795
+ [settings.chat_open, toggleChat]
1796
+ );
1797
+ const setLanguage = useCallback6(
1798
+ async (newLanguage) => {
1799
+ const previousLanguage = settings.language;
1800
+ setSettings((prev) => ({ ...prev, language: newLanguage }));
1801
+ if (!userId) return;
1802
+ try {
1803
+ const { error: error2 } = await supabase.from("user_settings").update({ language: newLanguage, updated_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", userId);
1804
+ if (error2) throw error2;
1805
+ } catch (err) {
1806
+ console.error("Failed to update language on server:", err);
1807
+ setSettings((prev) => ({ ...prev, language: previousLanguage }));
1808
+ }
1809
+ },
1810
+ [settings.language, userId]
1811
+ );
1812
+ const setThemeMode = useCallback6(
1813
+ async (newMode) => {
1814
+ const previousMode = settings.theme_mode;
1815
+ setSettings((prev) => ({ ...prev, theme_mode: newMode }));
1816
+ localStorage.setItem(THEME_MODE_STORAGE_KEY, newMode);
1817
+ if (!userId) return;
1818
+ try {
1819
+ const { error: error2 } = await supabase.from("user_settings").update({ theme_mode: newMode, updated_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", userId);
1820
+ if (error2) throw error2;
1821
+ } catch (err) {
1822
+ console.error("Failed to update theme mode on server:", err);
1823
+ setSettings((prev) => ({ ...prev, theme_mode: previousMode }));
1824
+ }
1825
+ },
1826
+ [settings.theme_mode, userId]
1827
+ );
1828
+ return /* @__PURE__ */ jsx14(
1829
+ UserSettingsContext.Provider,
1830
+ {
1831
+ value: {
1832
+ settings,
1833
+ loading,
1834
+ error,
1835
+ activeChatUserId,
1836
+ toggleSidebar,
1837
+ toggleChat,
1838
+ openChatWithUser,
1839
+ setLanguage,
1840
+ setThemeMode,
1841
+ refreshSettings: fetchSettings
1842
+ },
1843
+ children
1844
+ }
1845
+ );
1846
+ };
1847
+ var useUserSettings = () => {
1848
+ const context = useContext12(UserSettingsContext);
1849
+ if (!context) {
1850
+ throw new Error("useUserSettings should be used within the UserSettingsProvider");
1851
+ }
1852
+ return context;
1853
+ };
1854
+
1855
+ // src/context/PublicThemeProvider.tsx
1856
+ import { useMemo as useMemo6 } from "react";
1857
+ import { ThemeProvider as MuiThemeProvider2 } from "@mui/material";
1858
+ import { jsx as jsx15 } from "react/jsx-runtime";
1859
+ var PublicThemeProvider = ({ children }) => {
1860
+ const publicTheme = useMemo6(() => buildMuiTheme(INITIAL_THEME_CONFIG), []);
1861
+ return /* @__PURE__ */ jsx15(MuiThemeProvider2, { theme: publicTheme, children });
1862
+ };
1863
+
1675
1864
  // src/context/index.ts
1676
1865
  var Providers = {
1677
1866
  Supabase: SupabaseProvider,
1678
1867
  AppSettings: AppSettingsProvider,
1679
1868
  Auth: AuthProvider,
1869
+ UserSettings: UserSettingsProvider,
1680
1870
  Translate: TranslateProvider,
1681
1871
  TranslationEdit: TranslationEditProvider,
1682
1872
  Localization: LocalizationProvider,
1683
- Theme: ThemeProvider,
1873
+ PublicTheme: PublicThemeProvider,
1874
+ ProtectedTheme: ThemeProvider,
1684
1875
  Breadcrumb: BreadcrumbProvider,
1685
1876
  Toast: ToastProvider,
1686
1877
  Confirmation: ConfirmationProvider,
@@ -1688,26 +1879,26 @@ var Providers = {
1688
1879
  };
1689
1880
 
1690
1881
  // src/UI/components/data.display/UserStatusChipComponent.tsx
1691
- import { jsx as jsx14 } from "react/jsx-runtime";
1882
+ import { jsx as jsx16 } from "react/jsx-runtime";
1692
1883
  var UserStatusChipComponent = ({ overrideNamespace, state }) => {
1693
1884
  const confirm = useConfirmation();
1694
1885
  const handleShowReason = async (e) => {
1695
1886
  e.stopPropagation();
1696
1887
  if (!state.locked_reason) return;
1697
1888
  await confirm({
1698
- title: /* @__PURE__ */ jsx14(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Lock Reason" }),
1889
+ title: /* @__PURE__ */ jsx16(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Lock Reason" }),
1699
1890
  message: state.locked_reason,
1700
1891
  type: "info",
1701
- confirmText: /* @__PURE__ */ jsx14(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "OK" }),
1892
+ confirmText: /* @__PURE__ */ jsx16(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "OK" }),
1702
1893
  showNoButton: false,
1703
1894
  showCancelButton: false
1704
1895
  });
1705
1896
  };
1706
1897
  if (state.profile_archived) {
1707
- return /* @__PURE__ */ jsx14(
1898
+ return /* @__PURE__ */ jsx16(
1708
1899
  Chip,
1709
1900
  {
1710
- label: /* @__PURE__ */ jsx14(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Archived" }),
1901
+ label: /* @__PURE__ */ jsx16(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Archived" }),
1711
1902
  color: "default",
1712
1903
  size: "small",
1713
1904
  variant: "filled"
@@ -1715,10 +1906,10 @@ var UserStatusChipComponent = ({ overrideNamespace, state }) => {
1715
1906
  );
1716
1907
  }
1717
1908
  if (state.profile_locked) {
1718
- return /* @__PURE__ */ jsx14(
1909
+ return /* @__PURE__ */ jsx16(
1719
1910
  Chip,
1720
1911
  {
1721
- label: /* @__PURE__ */ jsx14(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "System Locked" }),
1912
+ label: /* @__PURE__ */ jsx16(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "System Locked" }),
1722
1913
  color: "error",
1723
1914
  size: "small",
1724
1915
  variant: "filled"
@@ -1726,30 +1917,30 @@ var UserStatusChipComponent = ({ overrideNamespace, state }) => {
1726
1917
  );
1727
1918
  }
1728
1919
  if (state.excluded) {
1729
- return /* @__PURE__ */ jsx14(
1920
+ return /* @__PURE__ */ jsx16(
1730
1921
  Chip,
1731
1922
  {
1732
- label: /* @__PURE__ */ jsx14(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Excluded" }),
1923
+ label: /* @__PURE__ */ jsx16(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Excluded" }),
1733
1924
  size: "small"
1734
1925
  }
1735
1926
  );
1736
1927
  }
1737
1928
  if (state.locked) {
1738
- return /* @__PURE__ */ jsx14(
1929
+ return /* @__PURE__ */ jsx16(
1739
1930
  Chip,
1740
1931
  {
1741
- label: /* @__PURE__ */ jsx14(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Locked" }),
1932
+ label: /* @__PURE__ */ jsx16(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Locked" }),
1742
1933
  color: "error",
1743
1934
  size: "small",
1744
1935
  onDelete: state.locked_reason ? handleShowReason : void 0,
1745
- deleteIcon: state.locked_reason ? /* @__PURE__ */ jsx14(IconButton2, { size: "small", component: "span", sx: { p: 0.2 }, children: /* @__PURE__ */ jsx14(InfoOutlinedIcon, { fontSize: "small" }) }) : void 0
1936
+ deleteIcon: state.locked_reason ? /* @__PURE__ */ jsx16(IconButton2, { size: "small", component: "span", sx: { p: 0.2 }, children: /* @__PURE__ */ jsx16(InfoOutlinedIcon, { fontSize: "small" }) }) : void 0
1746
1937
  }
1747
1938
  );
1748
1939
  }
1749
- return /* @__PURE__ */ jsx14(
1940
+ return /* @__PURE__ */ jsx16(
1750
1941
  Chip,
1751
1942
  {
1752
- label: /* @__PURE__ */ jsx14(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Active" }),
1943
+ label: /* @__PURE__ */ jsx16(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Active" }),
1753
1944
  color: "success",
1754
1945
  size: "small",
1755
1946
  variant: "outlined"
@@ -1759,32 +1950,32 @@ var UserStatusChipComponent = ({ overrideNamespace, state }) => {
1759
1950
 
1760
1951
  // src/UI/components/data.display/UserRoleChipComponent.tsx
1761
1952
  import { Chip as Chip2 } from "@mui/material";
1762
- import { jsx as jsx15 } from "react/jsx-runtime";
1953
+ import { jsx as jsx17 } from "react/jsx-runtime";
1763
1954
  var UserRoleChipComponent = ({ overrideNamespace, role }) => {
1764
1955
  switch (role) {
1765
1956
  case "superadmin":
1766
- return /* @__PURE__ */ jsx15(
1957
+ return /* @__PURE__ */ jsx17(
1767
1958
  Chip2,
1768
1959
  {
1769
- label: /* @__PURE__ */ jsx15(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Superadministrator" }),
1960
+ label: /* @__PURE__ */ jsx17(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Superadministrator" }),
1770
1961
  color: "error",
1771
1962
  size: "small"
1772
1963
  }
1773
1964
  );
1774
1965
  case "admin":
1775
- return /* @__PURE__ */ jsx15(
1966
+ return /* @__PURE__ */ jsx17(
1776
1967
  Chip2,
1777
1968
  {
1778
- label: /* @__PURE__ */ jsx15(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Administrator" }),
1969
+ label: /* @__PURE__ */ jsx17(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Administrator" }),
1779
1970
  color: "primary",
1780
1971
  size: "small"
1781
1972
  }
1782
1973
  );
1783
1974
  default:
1784
- return /* @__PURE__ */ jsx15(
1975
+ return /* @__PURE__ */ jsx17(
1785
1976
  Chip2,
1786
1977
  {
1787
- label: /* @__PURE__ */ jsx15(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "User" }),
1978
+ label: /* @__PURE__ */ jsx17(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "User" }),
1788
1979
  variant: "outlined",
1789
1980
  size: "small"
1790
1981
  }
@@ -1793,14 +1984,14 @@ var UserRoleChipComponent = ({ overrideNamespace, role }) => {
1793
1984
  };
1794
1985
 
1795
1986
  // src/UI/components/buttons/CopyClipboardButtonComponent.tsx
1796
- import { useState as useState11 } from "react";
1987
+ import { useState as useState12 } from "react";
1797
1988
  import { IconButton as IconButton3 } from "@mui/material";
1798
1989
  import CheckIcon from "@mui/icons-material/Check";
1799
1990
  import CopyIcon from "@mui/icons-material/ContentCopy";
1800
1991
 
1801
1992
  // src/UI/components/data.display/TranslatableTooltipComponent.tsx
1802
1993
  import { Tooltip as Tooltip2 } from "@mui/material";
1803
- import { jsx as jsx16 } from "react/jsx-runtime";
1994
+ import { jsx as jsx18 } from "react/jsx-runtime";
1804
1995
  var TranslatableTooltipComponent = ({
1805
1996
  overrideNamespace,
1806
1997
  title,
@@ -1809,10 +2000,10 @@ var TranslatableTooltipComponent = ({
1809
2000
  ...props
1810
2001
  }) => {
1811
2002
  const { isTranslationMode } = useTranslationEdit();
1812
- return /* @__PURE__ */ jsx16(
2003
+ return /* @__PURE__ */ jsx18(
1813
2004
  Tooltip2,
1814
2005
  {
1815
- title: typeof title === "string" ? /* @__PURE__ */ jsx16(TranslateText, { overrideNamespace, children: title }) : title,
2006
+ title: typeof title === "string" ? /* @__PURE__ */ jsx18(TranslateText, { overrideNamespace, children: title }) : title,
1816
2007
  slotProps: {
1817
2008
  popper: {
1818
2009
  sx: isTranslationMode ? {
@@ -1826,13 +2017,13 @@ var TranslatableTooltipComponent = ({
1826
2017
  },
1827
2018
  leaveDelay: isTranslationMode ? 1e3 : 100,
1828
2019
  ...props,
1829
- children: disableSpan ? children : /* @__PURE__ */ jsx16("span", { children })
2020
+ children: disableSpan ? children : /* @__PURE__ */ jsx18("span", { children })
1830
2021
  }
1831
2022
  );
1832
2023
  };
1833
2024
 
1834
2025
  // src/UI/components/buttons/CopyClipboardButtonComponent.tsx
1835
- import { jsx as jsx17 } from "react/jsx-runtime";
2026
+ import { jsx as jsx19 } from "react/jsx-runtime";
1836
2027
  var CopyClipboardButtonComponent = ({
1837
2028
  overrideNamespace,
1838
2029
  textToCopy,
@@ -1845,7 +2036,7 @@ var CopyClipboardButtonComponent = ({
1845
2036
  sx,
1846
2037
  ...iconButtonProps
1847
2038
  }) => {
1848
- const [copied, setCopied] = useState11(false);
2039
+ const [copied, setCopied] = useState12(false);
1849
2040
  const handleCopy = async (e) => {
1850
2041
  e.stopPropagation();
1851
2042
  if (!textToCopy) return;
@@ -1862,7 +2053,7 @@ var CopyClipboardButtonComponent = ({
1862
2053
  console.error("Failed to copy text to clipboard:", error);
1863
2054
  }
1864
2055
  };
1865
- return /* @__PURE__ */ jsx17(TranslatableTooltipComponent, { title: copied ? copiedTooltipText : copyTooltipText, children: /* @__PURE__ */ jsx17("span", { children: /* @__PURE__ */ jsx17(
2056
+ return /* @__PURE__ */ jsx19(TranslatableTooltipComponent, { title: copied ? copiedTooltipText : copyTooltipText, children: /* @__PURE__ */ jsx19("span", { children: /* @__PURE__ */ jsx19(
1866
2057
  IconButton3,
1867
2058
  {
1868
2059
  size,
@@ -1870,25 +2061,13 @@ var CopyClipboardButtonComponent = ({
1870
2061
  disabled: !textToCopy || iconButtonProps.disabled,
1871
2062
  sx: { p: 0.25, ...sx },
1872
2063
  ...iconButtonProps,
1873
- children: copied ? /* @__PURE__ */ jsx17(CheckIcon, { fontSize: size === "large" ? "medium" : "small", color: "success" }) : /* @__PURE__ */ jsx17(CopyIcon, { fontSize: size === "large" ? "medium" : "small" })
2064
+ children: copied ? /* @__PURE__ */ jsx19(CheckIcon, { fontSize: size === "large" ? "medium" : "small", color: "success" }) : /* @__PURE__ */ jsx19(CopyIcon, { fontSize: size === "large" ? "medium" : "small" })
1874
2065
  }
1875
2066
  ) }) });
1876
2067
  };
1877
2068
 
1878
- // src/context/UserSettingsProvider.tsx
1879
- import { createContext as createContext12, useContext as useContext12, useEffect as useEffect8, useState as useState12, useCallback as useCallback6 } from "react";
1880
- import { jsx as jsx18 } from "react/jsx-runtime";
1881
- var UserSettingsContext = createContext12(void 0);
1882
- var useUserSettings = () => {
1883
- const context = useContext12(UserSettingsContext);
1884
- if (!context) {
1885
- throw new Error("useUserSettings should be used within the UserSettingsProvider");
1886
- }
1887
- return context;
1888
- };
1889
-
1890
2069
  // src/UI/components/data.display/UserPopoverComponent.tsx
1891
- import { Fragment as Fragment2, jsx as jsx19, jsxs as jsxs6 } from "react/jsx-runtime";
2070
+ import { Fragment as Fragment2, jsx as jsx20, jsxs as jsxs6 } from "react/jsx-runtime";
1892
2071
  var useUserStatus = (supabase, userId, open) => {
1893
2072
  const [lastSeenAt, setLastSeenAt] = useState13(null);
1894
2073
  const [loading, setLoading] = useState13(true);
@@ -1993,7 +2172,7 @@ var UserPopoverComponent = ({
1993
2172
  }, [open, userId, currentMembership?.id, activeCompanyId]);
1994
2173
  const getStatusChip = () => {
1995
2174
  if (!profileData) return null;
1996
- return /* @__PURE__ */ jsx19(UserStatusChipComponent, { state: { profile_archived: profileData.archived, profile_locked: profileData.locked, excluded: membershipData?.excluded || false, locked: membershipData?.locked || false, locked_reason: membershipData?.locked_reason || "" } });
2175
+ return /* @__PURE__ */ jsx20(UserStatusChipComponent, { state: { profile_archived: profileData.archived, profile_locked: profileData.locked, excluded: membershipData?.excluded || false, locked: membershipData?.locked || false, locked_reason: membershipData?.locked_reason || "" } });
1997
2176
  };
1998
2177
  const getStatusTypographyColor = (isOnline2, lastSeenAt2) => {
1999
2178
  if (isOnline2) return "success";
@@ -2014,7 +2193,7 @@ var UserPopoverComponent = ({
2014
2193
  return "inherit";
2015
2194
  };
2016
2195
  const canChat = currentMembership && membershipData && currentMembership.id !== membershipData.id;
2017
- return /* @__PURE__ */ jsx19(
2196
+ return /* @__PURE__ */ jsx20(
2018
2197
  Popover,
2019
2198
  {
2020
2199
  open,
@@ -2033,7 +2212,7 @@ var UserPopoverComponent = ({
2033
2212
  }
2034
2213
  }
2035
2214
  },
2036
- children: loading ? /* @__PURE__ */ jsx19(Box4, { sx: { display: "flex", justifyContent: "center", py: 4 }, children: /* @__PURE__ */ jsx19(CircularProgress2, { size: 28 }) }) : profileData ? /* @__PURE__ */ jsxs6(Box4, { sx: { display: "flex", flexDirection: "column" }, children: [
2215
+ children: loading ? /* @__PURE__ */ jsx20(Box4, { sx: { display: "flex", justifyContent: "center", py: 4 }, children: /* @__PURE__ */ jsx20(CircularProgress2, { size: 28 }) }) : profileData ? /* @__PURE__ */ jsxs6(Box4, { sx: { display: "flex", flexDirection: "column" }, children: [
2037
2216
  /* @__PURE__ */ jsxs6(
2038
2217
  Box4,
2039
2218
  {
@@ -2044,7 +2223,7 @@ var UserPopoverComponent = ({
2044
2223
  bgcolor: "action.selected"
2045
2224
  },
2046
2225
  children: [
2047
- coverUrl && /* @__PURE__ */ jsx19(
2226
+ coverUrl && /* @__PURE__ */ jsx20(
2048
2227
  Box4,
2049
2228
  {
2050
2229
  component: "img",
@@ -2060,7 +2239,7 @@ var UserPopoverComponent = ({
2060
2239
  }
2061
2240
  }
2062
2241
  ),
2063
- /* @__PURE__ */ jsx19(
2242
+ /* @__PURE__ */ jsx20(
2064
2243
  IconButton4,
2065
2244
  {
2066
2245
  size: "small",
@@ -2078,7 +2257,7 @@ var UserPopoverComponent = ({
2078
2257
  transform: "scale(1.1)"
2079
2258
  }
2080
2259
  },
2081
- children: /* @__PURE__ */ jsx19(CloseIcon, { fontSize: "small" })
2260
+ children: /* @__PURE__ */ jsx20(CloseIcon, { fontSize: "small" })
2082
2261
  }
2083
2262
  )
2084
2263
  ]
@@ -2086,7 +2265,7 @@ var UserPopoverComponent = ({
2086
2265
  ),
2087
2266
  /* @__PURE__ */ jsxs6(Box4, { sx: { p: 2, pt: 0 }, children: [
2088
2267
  /* @__PURE__ */ jsxs6(Stack, { direction: "row", spacing: 1.5, sx: { alignItems: "flex-end", mt: "-18px", mb: 1 }, children: [
2089
- /* @__PURE__ */ jsx19(
2268
+ /* @__PURE__ */ jsx20(
2090
2269
  Badge,
2091
2270
  {
2092
2271
  overlap: "circular",
@@ -2123,7 +2302,7 @@ var UserPopoverComponent = ({
2123
2302
  }
2124
2303
  }
2125
2304
  },
2126
- children: /* @__PURE__ */ jsx19(
2305
+ children: /* @__PURE__ */ jsx20(
2127
2306
  Avatar,
2128
2307
  {
2129
2308
  src: avatarUrl || coverUrl || void 0,
@@ -2143,52 +2322,52 @@ var UserPopoverComponent = ({
2143
2322
  }
2144
2323
  ),
2145
2324
  /* @__PURE__ */ jsxs6(Box4, { sx: { overflow: "hidden", pb: 0.5 }, children: [
2146
- /* @__PURE__ */ jsx19(Typography2, { variant: "subtitle1", sx: { fontWeight: 600, lineHeight: 1.2 }, noWrap: true, children: profileData.display_name || `${profileData.first_name || ""} ${profileData.last_name || ""}` }),
2147
- membershipData?.employee_post && /* @__PURE__ */ jsx19(Typography2, { variant: "body2", color: "text.secondary", noWrap: true, children: membershipData.employee_post })
2325
+ /* @__PURE__ */ jsx20(Typography2, { variant: "subtitle1", sx: { fontWeight: 600, lineHeight: 1.2 }, noWrap: true, children: profileData.display_name || `${profileData.first_name || ""} ${profileData.last_name || ""}` }),
2326
+ membershipData?.employee_post && /* @__PURE__ */ jsx20(Typography2, { variant: "body2", color: "text.secondary", noWrap: true, children: membershipData.employee_post })
2148
2327
  ] })
2149
2328
  ] }),
2150
2329
  /* @__PURE__ */ jsxs6(Stack, { direction: "row", spacing: 1, sx: { my: 1, flexWrap: "wrap", gap: 0.5 }, children: [
2151
2330
  getStatusChip(),
2152
- /* @__PURE__ */ jsx19(UserRoleChipComponent, { role: membershipData?.role || "user" })
2331
+ /* @__PURE__ */ jsx20(UserRoleChipComponent, { role: membershipData?.role || "user" })
2153
2332
  ] }),
2154
- /* @__PURE__ */ jsx19(Divider, { sx: { my: 1.5 } }),
2333
+ /* @__PURE__ */ jsx20(Divider, { sx: { my: 1.5 } }),
2155
2334
  /* @__PURE__ */ jsxs6(Stack, { spacing: 1, sx: { fontSize: "0.875rem", mb: 1.5 }, children: [
2156
2335
  /* @__PURE__ */ jsxs6(Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2157
- /* @__PURE__ */ jsx19(AccessTimeIcon, { fontSize: "small", color: getStatusIconColor(isOnline, lastSeenAt) }),
2158
- /* @__PURE__ */ jsx19(Typography2, { variant: "body2", color: getStatusTypographyColor(isOnline, lastSeenAt), children: isOnline ? /* @__PURE__ */ jsx19(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Online" }) : lastSeenAt ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
2159
- /* @__PURE__ */ jsx19(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Last seen" }),
2336
+ /* @__PURE__ */ jsx20(AccessTimeIcon, { fontSize: "small", color: getStatusIconColor(isOnline, lastSeenAt) }),
2337
+ /* @__PURE__ */ jsx20(Typography2, { variant: "body2", color: getStatusTypographyColor(isOnline, lastSeenAt), children: isOnline ? /* @__PURE__ */ jsx20(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Online" }) : lastSeenAt ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
2338
+ /* @__PURE__ */ jsx20(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Last seen" }),
2160
2339
  ":",
2161
2340
  " ",
2162
- /* @__PURE__ */ jsx19("strong", { children: formatRelativeTime(lastSeenAt) })
2163
- ] }) : /* @__PURE__ */ jsx19(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Offline" }) })
2341
+ /* @__PURE__ */ jsx20("strong", { children: formatRelativeTime(lastSeenAt) })
2342
+ ] }) : /* @__PURE__ */ jsx20(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Offline" }) })
2164
2343
  ] }),
2165
2344
  profileData.email && /* @__PURE__ */ jsxs6(Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2166
- /* @__PURE__ */ jsx19(EmailIcon, { fontSize: "small" }),
2167
- /* @__PURE__ */ jsx19(Typography2, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: profileData.email }),
2168
- /* @__PURE__ */ jsx19(CopyClipboardButtonComponent, { textToCopy: profileData.email })
2345
+ /* @__PURE__ */ jsx20(EmailIcon, { fontSize: "small" }),
2346
+ /* @__PURE__ */ jsx20(Typography2, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: profileData.email }),
2347
+ /* @__PURE__ */ jsx20(CopyClipboardButtonComponent, { textToCopy: profileData.email })
2169
2348
  ] }),
2170
2349
  membershipData?.employee_post && /* @__PURE__ */ jsxs6(Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2171
- /* @__PURE__ */ jsx19(WorkIcon, { fontSize: "small" }),
2172
- /* @__PURE__ */ jsx19(Typography2, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: membershipData.employee_post }),
2173
- /* @__PURE__ */ jsx19(CopyClipboardButtonComponent, { textToCopy: membershipData.employee_post })
2350
+ /* @__PURE__ */ jsx20(WorkIcon, { fontSize: "small" }),
2351
+ /* @__PURE__ */ jsx20(Typography2, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: membershipData.employee_post }),
2352
+ /* @__PURE__ */ jsx20(CopyClipboardButtonComponent, { textToCopy: membershipData.employee_post })
2174
2353
  ] }),
2175
2354
  profileData.phone && /* @__PURE__ */ jsxs6(Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2176
- /* @__PURE__ */ jsx19(PhoneIcon, { fontSize: "small" }),
2177
- /* @__PURE__ */ jsx19(Typography2, { variant: "body2", color: "text.primary", children: profileData.phone })
2355
+ /* @__PURE__ */ jsx20(PhoneIcon, { fontSize: "small" }),
2356
+ /* @__PURE__ */ jsx20(Typography2, { variant: "body2", color: "text.primary", children: profileData.phone })
2178
2357
  ] }),
2179
2358
  profileData.birthday && /* @__PURE__ */ jsxs6(Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2180
- /* @__PURE__ */ jsx19(CakeIcon, { fontSize: "small" }),
2181
- /* @__PURE__ */ jsx19(Typography2, { variant: "body2", color: "text.primary", children: formatDate(profileData.birthday) })
2359
+ /* @__PURE__ */ jsx20(CakeIcon, { fontSize: "small" }),
2360
+ /* @__PURE__ */ jsx20(Typography2, { variant: "body2", color: "text.primary", children: formatDate(profileData.birthday) })
2182
2361
  ] }),
2183
2362
  membershipData?.created_at && /* @__PURE__ */ jsxs6(Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2184
- /* @__PURE__ */ jsx19(CalendarIcon, { fontSize: "small" }),
2363
+ /* @__PURE__ */ jsx20(CalendarIcon, { fontSize: "small" }),
2185
2364
  /* @__PURE__ */ jsxs6(Typography2, { variant: "body2", color: "text.primary", children: [
2186
- /* @__PURE__ */ jsx19(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "In company from" }),
2365
+ /* @__PURE__ */ jsx20(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "In company from" }),
2187
2366
  ": ",
2188
2367
  formatDate(membershipData.created_at)
2189
2368
  ] })
2190
2369
  ] }),
2191
- profileData.description && /* @__PURE__ */ jsx19(
2370
+ profileData.description && /* @__PURE__ */ jsx20(
2192
2371
  Typography2,
2193
2372
  {
2194
2373
  variant: "caption",
@@ -2204,28 +2383,28 @@ var UserPopoverComponent = ({
2204
2383
  }
2205
2384
  )
2206
2385
  ] }),
2207
- /* @__PURE__ */ jsx19(Divider, { sx: { my: 1 } }),
2386
+ /* @__PURE__ */ jsx20(Divider, { sx: { my: 1 } }),
2208
2387
  /* @__PURE__ */ jsxs6(Stack, { direction: "row", spacing: 1, sx: { justifyContent: "space-around", pt: 0.5 }, children: [
2209
- /* @__PURE__ */ jsx19(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx19(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Send a notification" }), children: /* @__PURE__ */ jsx19(IconButton4, { size: "small", color: "primary", children: /* @__PURE__ */ jsx19(NotificationIcon, { fontSize: "small" }) }) }),
2210
- /* @__PURE__ */ jsx19(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx19(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Set a task" }), children: /* @__PURE__ */ jsx19(IconButton4, { size: "small", color: "primary", children: /* @__PURE__ */ jsx19(TaskIcon, { fontSize: "small" }) }) }),
2211
- /* @__PURE__ */ jsx19(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx19(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Start a chat" }), children: /* @__PURE__ */ jsx19(
2388
+ /* @__PURE__ */ jsx20(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx20(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Send a notification" }), children: /* @__PURE__ */ jsx20(IconButton4, { size: "small", color: "primary", children: /* @__PURE__ */ jsx20(NotificationIcon, { fontSize: "small" }) }) }),
2389
+ /* @__PURE__ */ jsx20(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx20(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Set a task" }), children: /* @__PURE__ */ jsx20(IconButton4, { size: "small", color: "primary", children: /* @__PURE__ */ jsx20(TaskIcon, { fontSize: "small" }) }) }),
2390
+ /* @__PURE__ */ jsx20(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx20(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Start a chat" }), children: /* @__PURE__ */ jsx20(
2212
2391
  IconButton4,
2213
2392
  {
2214
2393
  size: "small",
2215
2394
  color: "primary",
2216
2395
  disabled: !canChat,
2217
2396
  onClick: () => membershipData && openChatWithUser(membershipData.id),
2218
- children: /* @__PURE__ */ jsx19(ChatIcon, { fontSize: "small" })
2397
+ children: /* @__PURE__ */ jsx20(ChatIcon, { fontSize: "small" })
2219
2398
  }
2220
2399
  ) })
2221
2400
  ] })
2222
2401
  ] })
2223
- ] }) : /* @__PURE__ */ jsx19(Box4, { sx: { p: 2 }, children: /* @__PURE__ */ jsx19(
2402
+ ] }) : /* @__PURE__ */ jsx20(Box4, { sx: { p: 2 }, children: /* @__PURE__ */ jsx20(
2224
2403
  Typography2,
2225
2404
  {
2226
2405
  color: "error",
2227
2406
  variant: "body2",
2228
- children: /* @__PURE__ */ jsx19(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Failed to load user data" })
2407
+ children: /* @__PURE__ */ jsx20(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Failed to load user data" })
2229
2408
  }
2230
2409
  ) })
2231
2410
  }
@@ -2260,6 +2439,8 @@ export {
2260
2439
  useConfirmation,
2261
2440
  AppSettingsProvider,
2262
2441
  useAppSettings,
2442
+ UserSettingsProvider,
2443
+ useUserSettings,
2263
2444
  Providers,
2264
2445
  UserStatusChipComponent,
2265
2446
  UserRoleChipComponent,