@serhii.olishevskyi/docs 1.0.5 → 1.0.7

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
@@ -153,18 +153,64 @@ var init_config = __esm({
153
153
  });
154
154
 
155
155
  // src/utils/deviceId.ts
156
+ var getDeviceId;
156
157
  var init_deviceId = __esm({
157
158
  "src/utils/deviceId.ts"() {
158
159
  "use strict";
160
+ getDeviceId = () => {
161
+ let deviceId = localStorage.getItem("app_device_id");
162
+ if (!deviceId) {
163
+ deviceId = crypto.randomUUID();
164
+ localStorage.setItem("app_device_id", deviceId);
165
+ }
166
+ return deviceId;
167
+ };
159
168
  }
160
169
  });
161
170
 
162
171
  // src/services/session.service.ts
163
- var getUserLastSeenAt;
172
+ var trackUserSession, isCurrentSessionValid, getUserLastSeenAt;
164
173
  var init_session_service = __esm({
165
174
  "src/services/session.service.ts"() {
166
175
  "use strict";
167
176
  init_deviceId();
177
+ trackUserSession = async (supabase, userId) => {
178
+ const deviceId = getDeviceId();
179
+ let ip = "";
180
+ try {
181
+ const ipRes = await fetch("https://api.ipify.org?format=json");
182
+ const ipData = await ipRes.json();
183
+ ip = ipData.ip;
184
+ } catch (e) {
185
+ console.warn("Failed to fetch IP address", e);
186
+ }
187
+ await supabase.from("user_sessions").upsert(
188
+ {
189
+ user_id: userId,
190
+ device_id: deviceId,
191
+ user_agent: navigator.userAgent,
192
+ ip_address: ip,
193
+ url: window.location.href,
194
+ last_seen_at: (/* @__PURE__ */ new Date()).toISOString()
195
+ },
196
+ { onConflict: "user_id, device_id" }
197
+ );
198
+ };
199
+ isCurrentSessionValid = async (supabase, userId) => {
200
+ try {
201
+ const currentDeviceId = getDeviceId();
202
+ const { data, error } = await supabase.from("user_sessions").select("id").eq("user_id", userId).eq("device_id", currentDeviceId).maybeSingle();
203
+ if (error) {
204
+ console.warn("\u041F\u043E\u043C\u0438\u043B\u043A\u0430 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0438 \u0441\u0435\u0441\u0456\u0457:", error.message);
205
+ return true;
206
+ }
207
+ if (!data) return false;
208
+ return true;
209
+ } catch (err) {
210
+ console.error("\u041D\u0435\u0441\u043F\u043E\u0434\u0456\u0432\u0430\u043D\u0430 \u043F\u043E\u043C\u0438\u043B\u043A\u0430 \u043F\u0440\u0438 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0446\u0456 \u0441\u0435\u0441\u0456\u0457:", err);
211
+ return true;
212
+ }
213
+ };
168
214
  getUserLastSeenAt = async (supabase, userId) => {
169
215
  const { data, error } = await supabase.from("user_sessions").select("last_seen_at").eq("user_id", userId).order("last_seen_at", { ascending: false }).limit(1).maybeSingle();
170
216
  if (error || !data) return null;
@@ -209,7 +255,7 @@ var init_SupabaseProvider = __esm({
209
255
  });
210
256
 
211
257
  // src/context/AuthProvider.tsx
212
- var import_react2, import_jsx_runtime2, AuthContext, useAuth;
258
+ var import_react2, import_jsx_runtime2, AuthContext, AuthProvider, useAuth;
213
259
  var init_AuthProvider = __esm({
214
260
  "src/context/AuthProvider.tsx"() {
215
261
  "use strict";
@@ -218,6 +264,179 @@ var init_AuthProvider = __esm({
218
264
  init_SupabaseProvider();
219
265
  import_jsx_runtime2 = require("react/jsx-runtime");
220
266
  AuthContext = (0, import_react2.createContext)(void 0);
267
+ AuthProvider = ({ children }) => {
268
+ const supabase = useSupabase();
269
+ const [user, setUser] = (0, import_react2.useState)(null);
270
+ const [profile, setProfile] = (0, import_react2.useState)(null);
271
+ const [membership, setMembership] = (0, import_react2.useState)(null);
272
+ const [session, setSession] = (0, import_react2.useState)(null);
273
+ const [loading, setLoading] = (0, import_react2.useState)(true);
274
+ const currentUserIdRef = (0, import_react2.useRef)(null);
275
+ const fetchProfileAndMembership = (0, import_react2.useCallback)(async (userId) => {
276
+ try {
277
+ const { data, error } = await supabase.rpc("get_user_avatar_and_profile", {
278
+ p_user_id: userId
279
+ });
280
+ if (error || !data) {
281
+ console.error("Error fetching user context via RPC:", error?.message);
282
+ setProfile(null);
283
+ setMembership(null);
284
+ return;
285
+ }
286
+ const response = data;
287
+ if (response?.profile) {
288
+ const profileData = response.profile;
289
+ if (profileData.avatar_path && !profileData.avatar_path.startsWith("http")) {
290
+ const cleanPath = profileData.avatar_path.replace(/^user-media\//, "");
291
+ const { data: avatarSignedData } = await supabase.storage.from("user-media").createSignedUrl(cleanPath, 3600);
292
+ if (avatarSignedData?.signedUrl) {
293
+ profileData.avatar_url = avatarSignedData.signedUrl;
294
+ }
295
+ }
296
+ if (profileData.cover_image_path && !profileData.cover_image_path.startsWith("http")) {
297
+ const cleanPath = profileData.cover_image_path.replace(/^user-media\//, "");
298
+ const { data: coverSignedData } = await supabase.storage.from("user-media").createSignedUrl(cleanPath, 3600);
299
+ if (coverSignedData?.signedUrl) {
300
+ profileData.cover_image_url = coverSignedData.signedUrl;
301
+ }
302
+ }
303
+ let updatedMembership = response.membership;
304
+ if (updatedMembership) {
305
+ const now = (/* @__PURE__ */ new Date()).toISOString();
306
+ const isFirstLogin = !updatedMembership.first_login_at;
307
+ const updateData = {
308
+ last_login_at: now,
309
+ ...isFirstLogin && { first_login_at: now }
310
+ };
311
+ const { error: updateError } = await supabase.from("memberships").update(updateData).eq("id", updatedMembership.id);
312
+ if (updateError) {
313
+ console.error("Error updating membership login timestamps:", updateError.message);
314
+ } else {
315
+ updatedMembership = {
316
+ ...updatedMembership,
317
+ ...updateData
318
+ };
319
+ }
320
+ }
321
+ setProfile(profileData);
322
+ setMembership(updatedMembership);
323
+ }
324
+ } catch (err) {
325
+ console.error("Unexpected error fetching user context:", err);
326
+ setProfile(null);
327
+ setMembership(null);
328
+ }
329
+ }, []);
330
+ const refreshProfile = async () => {
331
+ if (currentUserIdRef.current) {
332
+ await fetchProfileAndMembership(currentUserIdRef.current);
333
+ }
334
+ };
335
+ const signOut = (0, import_react2.useCallback)(async () => {
336
+ await supabase.auth.signOut();
337
+ currentUserIdRef.current = null;
338
+ setUser(null);
339
+ setProfile(null);
340
+ setMembership(null);
341
+ setSession(null);
342
+ }, []);
343
+ const setActiveCompany = async (companyId) => {
344
+ if (!user) {
345
+ throw new Error("\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C \u043D\u0435 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u043E\u0432\u0430\u043D");
346
+ }
347
+ const { error: profileError } = await supabase.from("profiles").update({ active_company_id: companyId }).eq("id", user.id);
348
+ if (profileError) {
349
+ console.error("Error updating active company:", profileError);
350
+ throw new Error(profileError.message);
351
+ }
352
+ await refreshProfile();
353
+ };
354
+ const updateProfile = (newProfileData) => {
355
+ setProfile((prev) => prev ? { ...prev, ...newProfileData } : null);
356
+ };
357
+ (0, import_react2.useEffect)(() => {
358
+ const { data: { subscription } } = supabase.auth.onAuthStateChange(async (event, currentSession) => {
359
+ if (event === "TOKEN_REFRESHED" && currentUserIdRef.current === currentSession?.user?.id) {
360
+ setSession(currentSession);
361
+ return;
362
+ }
363
+ const currentUser = currentSession?.user ?? null;
364
+ const newUserId = currentUser?.id ?? null;
365
+ if (newUserId !== currentUserIdRef.current) {
366
+ currentUserIdRef.current = newUserId;
367
+ setUser(currentUser);
368
+ if (newUserId) {
369
+ await trackUserSession(supabase, newUserId).catch(console.error);
370
+ const isAuthLinkEvent = event === "SIGNED_IN" || event === "INITIAL_SESSION" || event === "PASSWORD_RECOVERY";
371
+ if (!isAuthLinkEvent) {
372
+ const isValid = await isCurrentSessionValid(supabase, newUserId);
373
+ if (!isValid) {
374
+ await supabase.auth.signOut();
375
+ currentUserIdRef.current = null;
376
+ setUser(null);
377
+ setProfile(null);
378
+ setMembership(null);
379
+ setLoading(false);
380
+ return;
381
+ }
382
+ }
383
+ await fetchProfileAndMembership(newUserId);
384
+ setSession(currentSession);
385
+ } else {
386
+ setProfile(null);
387
+ setMembership(null);
388
+ }
389
+ }
390
+ setLoading(false);
391
+ });
392
+ return () => {
393
+ subscription.unsubscribe();
394
+ };
395
+ }, [fetchProfileAndMembership]);
396
+ (0, import_react2.useEffect)(() => {
397
+ if (!user) return;
398
+ const checkSession = async () => {
399
+ try {
400
+ const valid = await isCurrentSessionValid(supabase, user.id);
401
+ if (!valid) {
402
+ console.warn("\u0421\u0435\u0441\u0456\u044E \u0432\u0456\u0434\u043A\u043B\u0438\u043A\u0430\u043D\u043E \u0437 \u0456\u043D\u0448\u043E\u0433\u043E \u043F\u0440\u0438\u0441\u0442\u0440\u043E\u044E.");
403
+ await signOut();
404
+ }
405
+ } catch (err) {
406
+ console.error("\u041F\u043E\u043C\u0438\u043B\u043A\u0430 \u043F\u0440\u0438 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0446\u0456 \u0441\u0435\u0441\u0456\u0457:", err);
407
+ }
408
+ };
409
+ const interval = setInterval(checkSession, 6e4);
410
+ const handleFocus = () => checkSession();
411
+ window.addEventListener("focus", handleFocus);
412
+ return () => {
413
+ clearInterval(interval);
414
+ window.removeEventListener("focus", handleFocus);
415
+ };
416
+ }, [user, signOut]);
417
+ const activeCompanyId = profile?.active_company_id ?? null;
418
+ const userRole = membership?.role ?? null;
419
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
420
+ AuthContext.Provider,
421
+ {
422
+ value: {
423
+ user,
424
+ profile,
425
+ membership,
426
+ userRole,
427
+ activeCompanyId,
428
+ session,
429
+ isAuthenticated: !!user,
430
+ loading,
431
+ signOut,
432
+ updateProfile,
433
+ refreshProfile,
434
+ setActiveCompany
435
+ },
436
+ children
437
+ }
438
+ );
439
+ };
221
440
  useAuth = () => {
222
441
  const context = (0, import_react2.useContext)(AuthContext);
223
442
  if (!context) {
@@ -1515,6 +1734,76 @@ var init_ConfirmationProvider = __esm({
1515
1734
  }
1516
1735
  });
1517
1736
 
1737
+ // src/context/AppSettingsProvider.tsx
1738
+ var import_react17, import_jsx_runtime18, DEFAULT_SETTINGS, AppSettingsContext, AppSettingsProvider, useAppSettings;
1739
+ var init_AppSettingsProvider = __esm({
1740
+ "src/context/AppSettingsProvider.tsx"() {
1741
+ "use strict";
1742
+ import_react17 = require("react");
1743
+ init_SupabaseProvider();
1744
+ import_jsx_runtime18 = require("react/jsx-runtime");
1745
+ DEFAULT_SETTINGS = {
1746
+ max_group_members: 100
1747
+ };
1748
+ AppSettingsContext = (0, import_react17.createContext)(void 0);
1749
+ AppSettingsProvider = ({ children }) => {
1750
+ const supabase = useSupabase();
1751
+ const [settings, setSettings] = (0, import_react17.useState)(DEFAULT_SETTINGS);
1752
+ const [loading, setLoading] = (0, import_react17.useState)(true);
1753
+ const [error, setError] = (0, import_react17.useState)(null);
1754
+ const fetchSettings = (0, import_react17.useCallback)(async () => {
1755
+ try {
1756
+ setLoading(true);
1757
+ setError(null);
1758
+ const { data, error: supabaseError } = await supabase.from("app_settings").select("key, value");
1759
+ if (supabaseError) throw supabaseError;
1760
+ if (data) {
1761
+ const parsedSettings = data.reduce((acc, item) => {
1762
+ acc[item.key] = item.value;
1763
+ return acc;
1764
+ }, { ...DEFAULT_SETTINGS });
1765
+ setSettings(parsedSettings);
1766
+ }
1767
+ } catch (err) {
1768
+ console.error("\u041E\u0448\u0438\u0431\u043A\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 \u0441\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0445 \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043A:", err.message || err);
1769
+ setError(err.message || "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F");
1770
+ } finally {
1771
+ setLoading(false);
1772
+ }
1773
+ }, []);
1774
+ (0, import_react17.useEffect)(() => {
1775
+ fetchSettings();
1776
+ }, [fetchSettings]);
1777
+ const getSetting = (0, import_react17.useCallback)((key, defaultValue) => {
1778
+ if (key in settings && settings[key] !== null && settings[key] !== void 0) {
1779
+ return settings[key];
1780
+ }
1781
+ return defaultValue;
1782
+ }, [settings]);
1783
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1784
+ AppSettingsContext.Provider,
1785
+ {
1786
+ value: {
1787
+ settings,
1788
+ loading,
1789
+ error,
1790
+ getSetting,
1791
+ refetchSettings: fetchSettings
1792
+ },
1793
+ children
1794
+ }
1795
+ );
1796
+ };
1797
+ useAppSettings = () => {
1798
+ const context = (0, import_react17.useContext)(AppSettingsContext);
1799
+ if (!context) {
1800
+ throw new Error("useAppSettings should be used within the AppSettingsProvider");
1801
+ }
1802
+ return context;
1803
+ };
1804
+ }
1805
+ });
1806
+
1518
1807
  // src/context/index.ts
1519
1808
  var Providers;
1520
1809
  var init_context = __esm({
@@ -1529,7 +1818,10 @@ var init_context = __esm({
1529
1818
  init_ToastProvider();
1530
1819
  init_ConfirmationProvider();
1531
1820
  init_AIProvider();
1821
+ init_AppSettingsProvider();
1532
1822
  init_SupabaseProvider();
1823
+ init_AppSettingsProvider();
1824
+ init_AuthProvider();
1533
1825
  init_TranslateProvider();
1534
1826
  init_TranslateText();
1535
1827
  init_TranslationEditProvider();
@@ -1541,6 +1833,7 @@ var init_context = __esm({
1541
1833
  init_AIProvider();
1542
1834
  Providers = {
1543
1835
  Supabase: SupabaseProvider,
1836
+ AppSettings: AppSettingsProvider,
1544
1837
  Translate: TranslateProvider,
1545
1838
  TranslationEdit: TranslationEditProvider,
1546
1839
  Localization: LocalizationProvider,
@@ -1554,33 +1847,33 @@ var init_context = __esm({
1554
1847
  });
1555
1848
 
1556
1849
  // src/UI/components/data.display/UserStatusChipComponent.tsx
1557
- var import_material10, import_InfoOutlined, import_jsx_runtime18, UserStatusChipComponent;
1850
+ var import_material10, import_InfoOutlined, import_jsx_runtime19, UserStatusChipComponent;
1558
1851
  var init_UserStatusChipComponent = __esm({
1559
1852
  "src/UI/components/data.display/UserStatusChipComponent.tsx"() {
1560
1853
  "use strict";
1561
1854
  import_material10 = require("@mui/material");
1562
1855
  import_InfoOutlined = __toESM(require("@mui/icons-material/InfoOutlined"));
1563
1856
  init_context();
1564
- import_jsx_runtime18 = require("react/jsx-runtime");
1857
+ import_jsx_runtime19 = require("react/jsx-runtime");
1565
1858
  UserStatusChipComponent = ({ overrideNamespace, state }) => {
1566
1859
  const confirm = useConfirmation();
1567
1860
  const handleShowReason = async (e) => {
1568
1861
  e.stopPropagation();
1569
1862
  if (!state.locked_reason) return;
1570
1863
  await confirm({
1571
- title: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Lock Reason" }),
1864
+ title: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Lock Reason" }),
1572
1865
  message: state.locked_reason,
1573
1866
  type: "info",
1574
- confirmText: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "OK" }),
1867
+ confirmText: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "OK" }),
1575
1868
  showNoButton: false,
1576
1869
  showCancelButton: false
1577
1870
  });
1578
1871
  };
1579
1872
  if (state.profile_archived) {
1580
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1873
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1581
1874
  import_material10.Chip,
1582
1875
  {
1583
- label: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Archived" }),
1876
+ label: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Archived" }),
1584
1877
  color: "default",
1585
1878
  size: "small",
1586
1879
  variant: "filled"
@@ -1588,10 +1881,10 @@ var init_UserStatusChipComponent = __esm({
1588
1881
  );
1589
1882
  }
1590
1883
  if (state.profile_locked) {
1591
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1884
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1592
1885
  import_material10.Chip,
1593
1886
  {
1594
- label: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "System Locked" }),
1887
+ label: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "System Locked" }),
1595
1888
  color: "error",
1596
1889
  size: "small",
1597
1890
  variant: "filled"
@@ -1599,30 +1892,30 @@ var init_UserStatusChipComponent = __esm({
1599
1892
  );
1600
1893
  }
1601
1894
  if (state.excluded) {
1602
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1895
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1603
1896
  import_material10.Chip,
1604
1897
  {
1605
- label: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Excluded" }),
1898
+ label: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Excluded" }),
1606
1899
  size: "small"
1607
1900
  }
1608
1901
  );
1609
1902
  }
1610
1903
  if (state.locked) {
1611
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1904
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1612
1905
  import_material10.Chip,
1613
1906
  {
1614
- label: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Locked" }),
1907
+ label: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Locked" }),
1615
1908
  color: "error",
1616
1909
  size: "small",
1617
1910
  onDelete: state.locked_reason ? handleShowReason : void 0,
1618
- deleteIcon: state.locked_reason ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material10.IconButton, { size: "small", component: "span", sx: { p: 0.2 }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_InfoOutlined.default, { fontSize: "small" }) }) : void 0
1911
+ deleteIcon: state.locked_reason ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material10.IconButton, { size: "small", component: "span", sx: { p: 0.2 }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_InfoOutlined.default, { fontSize: "small" }) }) : void 0
1619
1912
  }
1620
1913
  );
1621
1914
  }
1622
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1915
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1623
1916
  import_material10.Chip,
1624
1917
  {
1625
- label: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Active" }),
1918
+ label: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Active" }),
1626
1919
  color: "success",
1627
1920
  size: "small",
1628
1921
  variant: "outlined"
@@ -1633,38 +1926,38 @@ var init_UserStatusChipComponent = __esm({
1633
1926
  });
1634
1927
 
1635
1928
  // src/UI/components/data.display/UserRoleChipComponent.tsx
1636
- var import_material11, import_jsx_runtime19, UserRoleChipComponent;
1929
+ var import_material11, import_jsx_runtime20, UserRoleChipComponent;
1637
1930
  var init_UserRoleChipComponent = __esm({
1638
1931
  "src/UI/components/data.display/UserRoleChipComponent.tsx"() {
1639
1932
  "use strict";
1640
1933
  import_material11 = require("@mui/material");
1641
1934
  init_context();
1642
- import_jsx_runtime19 = require("react/jsx-runtime");
1935
+ import_jsx_runtime20 = require("react/jsx-runtime");
1643
1936
  UserRoleChipComponent = ({ overrideNamespace, role }) => {
1644
1937
  switch (role) {
1645
1938
  case "superadmin":
1646
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1939
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1647
1940
  import_material11.Chip,
1648
1941
  {
1649
- label: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Superadministrator" }),
1942
+ label: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Superadministrator" }),
1650
1943
  color: "error",
1651
1944
  size: "small"
1652
1945
  }
1653
1946
  );
1654
1947
  case "admin":
1655
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1948
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1656
1949
  import_material11.Chip,
1657
1950
  {
1658
- label: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Administrator" }),
1951
+ label: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Administrator" }),
1659
1952
  color: "primary",
1660
1953
  size: "small"
1661
1954
  }
1662
1955
  );
1663
1956
  default:
1664
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1957
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1665
1958
  import_material11.Chip,
1666
1959
  {
1667
- label: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "User" }),
1960
+ label: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "User" }),
1668
1961
  variant: "outlined",
1669
1962
  size: "small"
1670
1963
  }
@@ -1675,16 +1968,16 @@ var init_UserRoleChipComponent = __esm({
1675
1968
  });
1676
1969
 
1677
1970
  // src/UI/components/buttons/CopyClipboardButtonComponent.tsx
1678
- var import_react17, import_material12, import_Check3, import_ContentCopy3, import_jsx_runtime20, CopyClipboardButtonComponent;
1971
+ var import_react18, import_material12, import_Check3, import_ContentCopy3, import_jsx_runtime21, CopyClipboardButtonComponent;
1679
1972
  var init_CopyClipboardButtonComponent = __esm({
1680
1973
  "src/UI/components/buttons/CopyClipboardButtonComponent.tsx"() {
1681
1974
  "use strict";
1682
- import_react17 = require("react");
1975
+ import_react18 = require("react");
1683
1976
  import_material12 = require("@mui/material");
1684
1977
  import_Check3 = __toESM(require("@mui/icons-material/Check"));
1685
1978
  import_ContentCopy3 = __toESM(require("@mui/icons-material/ContentCopy"));
1686
1979
  init_TranslatableTooltipComponent();
1687
- import_jsx_runtime20 = require("react/jsx-runtime");
1980
+ import_jsx_runtime21 = require("react/jsx-runtime");
1688
1981
  CopyClipboardButtonComponent = ({
1689
1982
  overrideNamespace,
1690
1983
  textToCopy,
@@ -1697,7 +1990,7 @@ var init_CopyClipboardButtonComponent = __esm({
1697
1990
  sx,
1698
1991
  ...iconButtonProps
1699
1992
  }) => {
1700
- const [copied, setCopied] = (0, import_react17.useState)(false);
1993
+ const [copied, setCopied] = (0, import_react18.useState)(false);
1701
1994
  const handleCopy = async (e) => {
1702
1995
  e.stopPropagation();
1703
1996
  if (!textToCopy) return;
@@ -1714,7 +2007,7 @@ var init_CopyClipboardButtonComponent = __esm({
1714
2007
  console.error("Failed to copy text to clipboard:", error);
1715
2008
  }
1716
2009
  };
1717
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TranslatableTooltipComponent, { title: copied ? copiedTooltipText : copyTooltipText, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2010
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslatableTooltipComponent, { title: copied ? copiedTooltipText : copyTooltipText, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1718
2011
  import_material12.IconButton,
1719
2012
  {
1720
2013
  size,
@@ -1722,7 +2015,7 @@ var init_CopyClipboardButtonComponent = __esm({
1722
2015
  disabled: !textToCopy || iconButtonProps.disabled,
1723
2016
  sx: { p: 0.25, ...sx },
1724
2017
  ...iconButtonProps,
1725
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_Check3.default, { fontSize: size === "large" ? "medium" : "small", color: "success" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_ContentCopy3.default, { fontSize: size === "large" ? "medium" : "small" })
2018
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_Check3.default, { fontSize: size === "large" ? "medium" : "small", color: "success" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_ContentCopy3.default, { fontSize: size === "large" ? "medium" : "small" })
1726
2019
  }
1727
2020
  ) }) });
1728
2021
  };
@@ -1737,19 +2030,19 @@ var init_user_types = __esm({
1737
2030
  });
1738
2031
 
1739
2032
  // src/context/UserSettingsProvider.tsx
1740
- var import_react18, import_jsx_runtime21, UserSettingsContext, useUserSettings;
2033
+ var import_react19, import_jsx_runtime22, UserSettingsContext, useUserSettings;
1741
2034
  var init_UserSettingsProvider = __esm({
1742
2035
  "src/context/UserSettingsProvider.tsx"() {
1743
2036
  "use strict";
1744
- import_react18 = require("react");
2037
+ import_react19 = require("react");
1745
2038
  init_user_types();
1746
2039
  init_ThemeProvider();
1747
2040
  init_AuthProvider();
1748
2041
  init_SupabaseProvider();
1749
- import_jsx_runtime21 = require("react/jsx-runtime");
1750
- UserSettingsContext = (0, import_react18.createContext)(void 0);
2042
+ import_jsx_runtime22 = require("react/jsx-runtime");
2043
+ UserSettingsContext = (0, import_react19.createContext)(void 0);
1751
2044
  useUserSettings = () => {
1752
- const context = (0, import_react18.useContext)(UserSettingsContext);
2045
+ const context = (0, import_react19.useContext)(UserSettingsContext);
1753
2046
  if (!context) {
1754
2047
  throw new Error("useUserSettings should be used within the UserSettingsProvider");
1755
2048
  }
@@ -1764,11 +2057,11 @@ __export(UserPopoverComponent_exports, {
1764
2057
  UserPopoverComponent: () => UserPopoverComponent,
1765
2058
  default: () => UserPopoverComponent_default
1766
2059
  });
1767
- var import_react19, import_material13, import_icons_material2, import_jsx_runtime22, useUserStatus, UserPopoverComponent, UserPopoverComponent_default;
2060
+ var import_react20, import_material13, import_icons_material2, import_jsx_runtime23, useUserStatus, UserPopoverComponent, UserPopoverComponent_default;
1768
2061
  var init_UserPopoverComponent = __esm({
1769
2062
  "src/UI/components/data.display/UserPopoverComponent.tsx"() {
1770
2063
  "use strict";
1771
- import_react19 = require("react");
2064
+ import_react20 = require("react");
1772
2065
  import_material13 = require("@mui/material");
1773
2066
  import_icons_material2 = require("@mui/icons-material");
1774
2067
  init_UserStatusChipComponent();
@@ -1779,11 +2072,11 @@ var init_UserPopoverComponent = __esm({
1779
2072
  init_UserSettingsProvider();
1780
2073
  init_TranslatableTooltipComponent();
1781
2074
  init_session_service();
1782
- import_jsx_runtime22 = require("react/jsx-runtime");
2075
+ import_jsx_runtime23 = require("react/jsx-runtime");
1783
2076
  useUserStatus = (supabase, userId, open) => {
1784
- const [lastSeenAt, setLastSeenAt] = (0, import_react19.useState)(null);
1785
- const [loading, setLoading] = (0, import_react19.useState)(true);
1786
- (0, import_react19.useEffect)(() => {
2077
+ const [lastSeenAt, setLastSeenAt] = (0, import_react20.useState)(null);
2078
+ const [loading, setLoading] = (0, import_react20.useState)(true);
2079
+ (0, import_react20.useEffect)(() => {
1787
2080
  if (!userId || !open) {
1788
2081
  setLastSeenAt(null);
1789
2082
  setLoading(false);
@@ -1832,13 +2125,13 @@ var init_UserPopoverComponent = __esm({
1832
2125
  const { activeCompanyId, membership: currentMembership } = useAuth();
1833
2126
  const { openChatWithUser } = useUserSettings();
1834
2127
  const { formatDate, formatRelativeTime } = useLocalization();
1835
- const [profileData, setProfileData] = (0, import_react19.useState)(null);
1836
- const [membershipData, setMembershipData] = (0, import_react19.useState)(null);
1837
- const [avatarUrl, setAvatarUrl] = (0, import_react19.useState)(null);
1838
- const [coverUrl, setCoverUrl] = (0, import_react19.useState)(null);
1839
- const [loading, setLoading] = (0, import_react19.useState)(true);
2128
+ const [profileData, setProfileData] = (0, import_react20.useState)(null);
2129
+ const [membershipData, setMembershipData] = (0, import_react20.useState)(null);
2130
+ const [avatarUrl, setAvatarUrl] = (0, import_react20.useState)(null);
2131
+ const [coverUrl, setCoverUrl] = (0, import_react20.useState)(null);
2132
+ const [loading, setLoading] = (0, import_react20.useState)(true);
1840
2133
  const { lastSeenAt, isOnline } = useUserStatus(supabase, userId, open);
1841
- (0, import_react19.useEffect)(() => {
2134
+ (0, import_react20.useEffect)(() => {
1842
2135
  if (!open || !userId || !activeCompanyId) return;
1843
2136
  let isMounted = true;
1844
2137
  setLoading(true);
@@ -1884,7 +2177,7 @@ var init_UserPopoverComponent = __esm({
1884
2177
  }, [open, userId, currentMembership?.id, activeCompanyId]);
1885
2178
  const getStatusChip = () => {
1886
2179
  if (!profileData) return null;
1887
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UserStatusChipComponent, { state: { profile_archived: profileData.archived, profile_locked: profileData.locked, excluded: membershipData?.excluded || false, locked: membershipData?.locked || false, locked_reason: membershipData?.locked_reason || "" } });
2180
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UserStatusChipComponent, { state: { profile_archived: profileData.archived, profile_locked: profileData.locked, excluded: membershipData?.excluded || false, locked: membershipData?.locked || false, locked_reason: membershipData?.locked_reason || "" } });
1888
2181
  };
1889
2182
  const getStatusTypographyColor = (isOnline2, lastSeenAt2) => {
1890
2183
  if (isOnline2) return "success";
@@ -1905,7 +2198,7 @@ var init_UserPopoverComponent = __esm({
1905
2198
  return "inherit";
1906
2199
  };
1907
2200
  const canChat = currentMembership && membershipData && currentMembership.id !== membershipData.id;
1908
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2201
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1909
2202
  import_material13.Popover,
1910
2203
  {
1911
2204
  open,
@@ -1924,8 +2217,8 @@ var init_UserPopoverComponent = __esm({
1924
2217
  }
1925
2218
  }
1926
2219
  },
1927
- children: loading ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material13.Box, { sx: { display: "flex", justifyContent: "center", py: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material13.CircularProgress, { size: 28 }) }) : profileData ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material13.Box, { sx: { display: "flex", flexDirection: "column" }, children: [
1928
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2220
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.Box, { sx: { display: "flex", justifyContent: "center", py: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.CircularProgress, { size: 28 }) }) : profileData ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material13.Box, { sx: { display: "flex", flexDirection: "column" }, children: [
2221
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1929
2222
  import_material13.Box,
1930
2223
  {
1931
2224
  sx: {
@@ -1935,7 +2228,7 @@ var init_UserPopoverComponent = __esm({
1935
2228
  bgcolor: "action.selected"
1936
2229
  },
1937
2230
  children: [
1938
- coverUrl && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2231
+ coverUrl && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1939
2232
  import_material13.Box,
1940
2233
  {
1941
2234
  component: "img",
@@ -1951,7 +2244,7 @@ var init_UserPopoverComponent = __esm({
1951
2244
  }
1952
2245
  }
1953
2246
  ),
1954
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2247
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1955
2248
  import_material13.IconButton,
1956
2249
  {
1957
2250
  size: "small",
@@ -1969,15 +2262,15 @@ var init_UserPopoverComponent = __esm({
1969
2262
  transform: "scale(1.1)"
1970
2263
  }
1971
2264
  },
1972
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons_material2.Close, { fontSize: "small" })
2265
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons_material2.Close, { fontSize: "small" })
1973
2266
  }
1974
2267
  )
1975
2268
  ]
1976
2269
  }
1977
2270
  ),
1978
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material13.Box, { sx: { p: 2, pt: 0 }, children: [
1979
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material13.Stack, { direction: "row", spacing: 1.5, sx: { alignItems: "flex-end", mt: "-18px", mb: 1 }, children: [
1980
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2271
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material13.Box, { sx: { p: 2, pt: 0 }, children: [
2272
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material13.Stack, { direction: "row", spacing: 1.5, sx: { alignItems: "flex-end", mt: "-18px", mb: 1 }, children: [
2273
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1981
2274
  import_material13.Badge,
1982
2275
  {
1983
2276
  overlap: "circular",
@@ -2014,7 +2307,7 @@ var init_UserPopoverComponent = __esm({
2014
2307
  }
2015
2308
  }
2016
2309
  },
2017
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2310
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2018
2311
  import_material13.Avatar,
2019
2312
  {
2020
2313
  src: avatarUrl || coverUrl || void 0,
@@ -2033,53 +2326,53 @@ var init_UserPopoverComponent = __esm({
2033
2326
  )
2034
2327
  }
2035
2328
  ),
2036
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material13.Box, { sx: { overflow: "hidden", pb: 0.5 }, children: [
2037
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material13.Typography, { variant: "subtitle1", sx: { fontWeight: 600, lineHeight: 1.2 }, noWrap: true, children: profileData.display_name || `${profileData.first_name || ""} ${profileData.last_name || ""}` }),
2038
- membershipData?.employee_post && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material13.Typography, { variant: "body2", color: "text.secondary", noWrap: true, children: membershipData.employee_post })
2329
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material13.Box, { sx: { overflow: "hidden", pb: 0.5 }, children: [
2330
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.Typography, { variant: "subtitle1", sx: { fontWeight: 600, lineHeight: 1.2 }, noWrap: true, children: profileData.display_name || `${profileData.first_name || ""} ${profileData.last_name || ""}` }),
2331
+ membershipData?.employee_post && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.Typography, { variant: "body2", color: "text.secondary", noWrap: true, children: membershipData.employee_post })
2039
2332
  ] })
2040
2333
  ] }),
2041
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { my: 1, flexWrap: "wrap", gap: 0.5 }, children: [
2334
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { my: 1, flexWrap: "wrap", gap: 0.5 }, children: [
2042
2335
  getStatusChip(),
2043
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UserRoleChipComponent, { role: membershipData?.role || "user" })
2336
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UserRoleChipComponent, { role: membershipData?.role || "user" })
2044
2337
  ] }),
2045
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material13.Divider, { sx: { my: 1.5 } }),
2046
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material13.Stack, { spacing: 1, sx: { fontSize: "0.875rem", mb: 1.5 }, children: [
2047
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2048
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons_material2.AccessTime, { fontSize: "small", color: getStatusIconColor(isOnline, lastSeenAt) }),
2049
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material13.Typography, { variant: "body2", color: getStatusTypographyColor(isOnline, lastSeenAt), children: isOnline ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Online" }) : lastSeenAt ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
2050
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Last seen" }),
2338
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.Divider, { sx: { my: 1.5 } }),
2339
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material13.Stack, { spacing: 1, sx: { fontSize: "0.875rem", mb: 1.5 }, children: [
2340
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2341
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons_material2.AccessTime, { fontSize: "small", color: getStatusIconColor(isOnline, lastSeenAt) }),
2342
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.Typography, { variant: "body2", color: getStatusTypographyColor(isOnline, lastSeenAt), children: isOnline ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Online" }) : lastSeenAt ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
2343
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Last seen" }),
2051
2344
  ":",
2052
2345
  " ",
2053
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("strong", { children: formatRelativeTime(lastSeenAt) })
2054
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Offline" }) })
2346
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("strong", { children: formatRelativeTime(lastSeenAt) })
2347
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Offline" }) })
2055
2348
  ] }),
2056
- profileData.email && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2057
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons_material2.Email, { fontSize: "small" }),
2058
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material13.Typography, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: profileData.email }),
2059
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CopyClipboardButtonComponent, { textToCopy: profileData.email })
2349
+ profileData.email && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2350
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons_material2.Email, { fontSize: "small" }),
2351
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.Typography, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: profileData.email }),
2352
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CopyClipboardButtonComponent, { textToCopy: profileData.email })
2060
2353
  ] }),
2061
- membershipData?.employee_post && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2062
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons_material2.Work, { fontSize: "small" }),
2063
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material13.Typography, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: membershipData.employee_post }),
2064
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CopyClipboardButtonComponent, { textToCopy: membershipData.employee_post })
2354
+ membershipData?.employee_post && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2355
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons_material2.Work, { fontSize: "small" }),
2356
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.Typography, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: membershipData.employee_post }),
2357
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CopyClipboardButtonComponent, { textToCopy: membershipData.employee_post })
2065
2358
  ] }),
2066
- profileData.phone && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2067
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons_material2.Phone, { fontSize: "small" }),
2068
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material13.Typography, { variant: "body2", color: "text.primary", children: profileData.phone })
2359
+ profileData.phone && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2360
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons_material2.Phone, { fontSize: "small" }),
2361
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.Typography, { variant: "body2", color: "text.primary", children: profileData.phone })
2069
2362
  ] }),
2070
- profileData.birthday && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2071
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons_material2.Cake, { fontSize: "small" }),
2072
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material13.Typography, { variant: "body2", color: "text.primary", children: formatDate(profileData.birthday) })
2363
+ profileData.birthday && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2364
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons_material2.Cake, { fontSize: "small" }),
2365
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.Typography, { variant: "body2", color: "text.primary", children: formatDate(profileData.birthday) })
2073
2366
  ] }),
2074
- membershipData?.created_at && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2075
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons_material2.CalendarToday, { fontSize: "small" }),
2076
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material13.Typography, { variant: "body2", color: "text.primary", children: [
2077
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "In company from" }),
2367
+ membershipData?.created_at && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2368
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons_material2.CalendarToday, { fontSize: "small" }),
2369
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material13.Typography, { variant: "body2", color: "text.primary", children: [
2370
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "In company from" }),
2078
2371
  ": ",
2079
2372
  formatDate(membershipData.created_at)
2080
2373
  ] })
2081
2374
  ] }),
2082
- profileData.description && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2375
+ profileData.description && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2083
2376
  import_material13.Typography,
2084
2377
  {
2085
2378
  variant: "caption",
@@ -2095,28 +2388,28 @@ var init_UserPopoverComponent = __esm({
2095
2388
  }
2096
2389
  )
2097
2390
  ] }),
2098
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material13.Divider, { sx: { my: 1 } }),
2099
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { justifyContent: "space-around", pt: 0.5 }, children: [
2100
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Send a notification" }), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material13.IconButton, { size: "small", color: "primary", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons_material2.NotificationsNone, { fontSize: "small" }) }) }),
2101
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Set a task" }), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material13.IconButton, { size: "small", color: "primary", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons_material2.AssignmentOutlined, { fontSize: "small" }) }) }),
2102
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Start a chat" }), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2391
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.Divider, { sx: { my: 1 } }),
2392
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material13.Stack, { direction: "row", spacing: 1, sx: { justifyContent: "space-around", pt: 0.5 }, children: [
2393
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Send a notification" }), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.IconButton, { size: "small", color: "primary", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons_material2.NotificationsNone, { fontSize: "small" }) }) }),
2394
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Set a task" }), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.IconButton, { size: "small", color: "primary", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons_material2.AssignmentOutlined, { fontSize: "small" }) }) }),
2395
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Start a chat" }), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2103
2396
  import_material13.IconButton,
2104
2397
  {
2105
2398
  size: "small",
2106
2399
  color: "primary",
2107
2400
  disabled: !canChat,
2108
2401
  onClick: () => membershipData && openChatWithUser(membershipData.id),
2109
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons_material2.ChatBubble, { fontSize: "small" })
2402
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons_material2.ChatBubble, { fontSize: "small" })
2110
2403
  }
2111
2404
  ) })
2112
2405
  ] })
2113
2406
  ] })
2114
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material13.Box, { sx: { p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2407
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.Box, { sx: { p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2115
2408
  import_material13.Typography,
2116
2409
  {
2117
2410
  color: "error",
2118
2411
  variant: "body2",
2119
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Failed to load user data" })
2412
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Failed to load user data" })
2120
2413
  }
2121
2414
  ) })
2122
2415
  }
@@ -2130,6 +2423,8 @@ var init_UserPopoverComponent = __esm({
2130
2423
  var index_exports = {};
2131
2424
  __export(index_exports, {
2132
2425
  AIProvider: () => AIProvider,
2426
+ AppSettingsProvider: () => AppSettingsProvider,
2427
+ AuthProvider: () => AuthProvider,
2133
2428
  BreadcrumbProvider: () => BreadcrumbProvider,
2134
2429
  ConfirmationProvider: () => ConfirmationProvider,
2135
2430
  LocalizationProvider: () => LocalizationProvider,
@@ -2142,7 +2437,9 @@ __export(index_exports, {
2142
2437
  TranslationEditProvider: () => TranslationEditProvider,
2143
2438
  UI: () => UI,
2144
2439
  useAI: () => useAI,
2440
+ useAppSettings: () => useAppSettings,
2145
2441
  useAppTheme: () => useAppTheme,
2442
+ useAuth: () => useAuth,
2146
2443
  useBreadcrumb: () => useBreadcrumb,
2147
2444
  useConfirmation: () => useConfirmation,
2148
2445
  useLocalization: () => useLocalization,
@@ -2842,11 +3139,11 @@ var EmailInputComponent = ({
2842
3139
  };
2843
3140
 
2844
3141
  // src/UI/components/data.display/UserAvatarComponent.tsx
2845
- var import_react20 = require("react");
3142
+ var import_react21 = require("react");
2846
3143
  var import_material14 = require("@mui/material");
2847
3144
  init_context();
2848
- var import_jsx_runtime23 = require("react/jsx-runtime");
2849
- var LazyUserPopover = (0, import_react20.lazy)(() => Promise.resolve().then(() => (init_UserPopoverComponent(), UserPopoverComponent_exports)));
3145
+ var import_jsx_runtime24 = require("react/jsx-runtime");
3146
+ var LazyUserPopover = (0, import_react21.lazy)(() => Promise.resolve().then(() => (init_UserPopoverComponent(), UserPopoverComponent_exports)));
2850
3147
  var getInitials = (name) => {
2851
3148
  if (!name) return "?";
2852
3149
  const parts = name.trim().split(" ");
@@ -2868,11 +3165,11 @@ var UserAvatarComponent = ({
2868
3165
  sx = {}
2869
3166
  }) => {
2870
3167
  const supabase = useSupabase();
2871
- const [anchorEl, setAnchorEl] = (0, import_react20.useState)(null);
2872
- const [hasInteracted, setHasInteracted] = (0, import_react20.useState)(false);
2873
- const [resolvedAvatarUrl, setResolvedAvatarUrl] = (0, import_react20.useState)(null);
3168
+ const [anchorEl, setAnchorEl] = (0, import_react21.useState)(null);
3169
+ const [hasInteracted, setHasInteracted] = (0, import_react21.useState)(false);
3170
+ const [resolvedAvatarUrl, setResolvedAvatarUrl] = (0, import_react21.useState)(null);
2874
3171
  const canShowPopover = !disablePopover && Boolean(userId);
2875
- (0, import_react20.useEffect)(() => {
3172
+ (0, import_react21.useEffect)(() => {
2876
3173
  let isMounted = true;
2877
3174
  const resolveAvatar = async () => {
2878
3175
  if (!avatarUrl) {
@@ -2917,12 +3214,12 @@ var UserAvatarComponent = ({
2917
3214
  };
2918
3215
  const isPopoverOpen = Boolean(anchorEl);
2919
3216
  const initials = getInitials(displayName || "");
2920
- const getTooltip = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
2921
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material14.Typography, { component: "div", variant: "caption", children: displayName }),
2922
- displayName && employeePost && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material14.Typography, { component: "div", variant: "caption", children: employeePost })
3217
+ const getTooltip = /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
3218
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { component: "div", variant: "caption", children: displayName }),
3219
+ displayName && employeePost && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { component: "div", variant: "caption", children: employeePost })
2923
3220
  ] });
2924
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
2925
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material14.Tooltip, { title: disableTooltip || isPopoverOpen ? "" : getTooltip, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3221
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
3222
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Tooltip, { title: disableTooltip || isPopoverOpen ? "" : getTooltip, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2926
3223
  import_material14.Avatar,
2927
3224
  {
2928
3225
  src: resolvedAvatarUrl || void 0,
@@ -2948,7 +3245,7 @@ var UserAvatarComponent = ({
2948
3245
  children: !resolvedAvatarUrl && initials
2949
3246
  }
2950
3247
  ) }),
2951
- canShowPopover && hasInteracted && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react20.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3248
+ canShowPopover && hasInteracted && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react21.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2952
3249
  LazyUserPopover,
2953
3250
  {
2954
3251
  userId,
@@ -2993,6 +3290,8 @@ init_context();
2993
3290
  // Annotate the CommonJS export names for ESM import in node:
2994
3291
  0 && (module.exports = {
2995
3292
  AIProvider,
3293
+ AppSettingsProvider,
3294
+ AuthProvider,
2996
3295
  BreadcrumbProvider,
2997
3296
  ConfirmationProvider,
2998
3297
  LocalizationProvider,
@@ -3005,7 +3304,9 @@ init_context();
3005
3304
  TranslationEditProvider,
3006
3305
  UI,
3007
3306
  useAI,
3307
+ useAppSettings,
3008
3308
  useAppTheme,
3309
+ useAuth,
3009
3310
  useBreadcrumb,
3010
3311
  useConfirmation,
3011
3312
  useLocalization,