@layers-app/shared 0.4.5 → 0.4.6

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.
Files changed (128) hide show
  1. package/dist/components/AppContainer/AppContainer.d.ts.map +1 -1
  2. package/dist/components/AppContainer/AppContainer.js +72 -79
  3. package/dist/components/AppContainer/AppContainer.module.css.js +6 -6
  4. package/dist/components/AppContainer/components/AppsSidebar/TopSection.d.ts.map +1 -1
  5. package/dist/components/AppContainer/components/AppsSidebar/TopSection.js +24 -22
  6. package/dist/components/AppContainer/components/AppsSidebar/UserSection.d.ts.map +1 -1
  7. package/dist/components/AppContainer/components/AppsSidebar/UserSection.js +46 -37
  8. package/dist/components/AppContainer/components/Header.d.ts.map +1 -1
  9. package/dist/components/AppContainer/components/Header.js +6 -5
  10. package/dist/components/AppContainer/components/Main.js +4 -4
  11. package/dist/components/AppContainer/components/SlideAnimation.js +4 -4
  12. package/dist/components/AppContainer/components/ToolSidebar.d.ts.map +1 -1
  13. package/dist/components/AppContainer/components/ToolSidebar.js +161 -128
  14. package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.d.ts.map +1 -1
  15. package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.js +131 -121
  16. package/dist/components/AppContainer/hooks/useAppContainer.d.ts +1 -1
  17. package/dist/components/AppContainer/hooks/useAppContainer.d.ts.map +1 -1
  18. package/dist/components/AppContainer/hooks/useAppContainer.js +59 -56
  19. package/dist/components/AppContainer/hooks/useAppContainerDataStore.d.ts.map +1 -1
  20. package/dist/components/AppContainer/hooks/useAppContainerDataStore.js +4 -3
  21. package/dist/components/AppContainer/types.d.ts +1 -0
  22. package/dist/components/AppContainer/types.d.ts.map +1 -1
  23. package/dist/components/AttachmentsGalleryModal/components/ModalHeader.d.ts.map +1 -1
  24. package/dist/components/AttachmentsGalleryModal/components/ModalHeader.js +37 -37
  25. package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.d.ts.map +1 -1
  26. package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.js +68 -62
  27. package/dist/components/AttachmentsGalleryModal/helpers.d.ts +8 -0
  28. package/dist/components/AttachmentsGalleryModal/helpers.d.ts.map +1 -1
  29. package/dist/components/AttachmentsGalleryModal/helpers.js +22 -17
  30. package/dist/components/AttachmentsGalleryModal/hooks/useDownloadFile.d.ts.map +1 -1
  31. package/dist/components/AttachmentsGalleryModal/hooks/useDownloadFile.js +28 -25
  32. package/dist/components/AttachmentsGalleryModal/hooks/useGetPreviewUrl.d.ts.map +1 -1
  33. package/dist/components/AttachmentsGalleryModal/hooks/useGetPreviewUrl.js +36 -41
  34. package/dist/components/AttachmentsPreview/AttachmentsPreview.d.ts.map +1 -1
  35. package/dist/components/AttachmentsPreview/AttachmentsPreview.js +135 -80
  36. package/dist/components/AttachmentsPreview/AttachmentsPreview.module.css.js +24 -14
  37. package/dist/components/BouncingLogo/BouncingLogo.d.ts +1 -3
  38. package/dist/components/BouncingLogo/BouncingLogo.d.ts.map +1 -1
  39. package/dist/components/BouncingLogo/BouncingLogo.js +14 -20
  40. package/dist/components/BouncingLogo/BouncingLogo.module.css.js +4 -8
  41. package/dist/components/Chat/ChatBubble/ChatBubble.module.css.js +5 -5
  42. package/dist/components/Chat/ChatInput/ChatInput.module.css.js +40 -28
  43. package/dist/components/Chat/ChatInput/index.d.ts +29 -1
  44. package/dist/components/Chat/ChatInput/index.d.ts.map +1 -1
  45. package/dist/components/Chat/ChatInput/index.js +178 -118
  46. package/dist/components/Chat/ChatInput/smilePlusIcon.d.ts +3 -0
  47. package/dist/components/Chat/ChatInput/smilePlusIcon.d.ts.map +1 -0
  48. package/dist/components/Chat/ChatInput/smilePlusIcon.js +49 -0
  49. package/dist/components/Chat/ChatMessage/ChatMessage.module.css.js +9 -9
  50. package/dist/components/Chat/ChatMessage/index.d.ts +2 -0
  51. package/dist/components/Chat/ChatMessage/index.d.ts.map +1 -1
  52. package/dist/components/Chat/ChatMessage/index.js +136 -118
  53. package/dist/components/Chat/MediaDocument/MediaDocument.module.css.js +4 -4
  54. package/dist/components/Chat/MessageActions/index.d.ts +7 -0
  55. package/dist/components/Chat/MessageActions/index.d.ts.map +1 -1
  56. package/dist/components/Chat/MessageActions/index.js +33 -30
  57. package/dist/components/Chat/MessageList/MessageList.module.css.js +14 -10
  58. package/dist/components/Chat/MessageList/index.d.ts +30 -3
  59. package/dist/components/Chat/MessageList/index.d.ts.map +1 -1
  60. package/dist/components/Chat/MessageList/index.js +154 -66
  61. package/dist/components/Chat/MessageReactions/MessageReactions.module.css.js +7 -7
  62. package/dist/components/Chat/MessageReactions/index.d.ts +17 -0
  63. package/dist/components/Chat/MessageReactions/index.d.ts.map +1 -1
  64. package/dist/components/Chat/MessageReactions/index.js +60 -28
  65. package/dist/components/Chat/MessageStatus/MessageStatus.module.css.js +6 -4
  66. package/dist/components/Chat/MessageStatus/index.d.ts +1 -1
  67. package/dist/components/Chat/MessageStatus/index.d.ts.map +1 -1
  68. package/dist/components/Chat/MessageStatus/index.js +49 -34
  69. package/dist/components/CircleColorPicker/CircleColorPicker.d.ts.map +1 -1
  70. package/dist/components/CircleColorPicker/CircleColorPicker.js +17 -15
  71. package/dist/components/ColorPicker/ColorPicker.module.css.js +26 -20
  72. package/dist/components/ColorPicker/ColorPickerList.d.ts.map +1 -1
  73. package/dist/components/ColorPicker/ColorPickerList.js +81 -68
  74. package/dist/components/ColorPicker/ColorPickerToolbar.d.ts.map +1 -1
  75. package/dist/components/ColorPicker/ColorPickerToolbar.js +75 -70
  76. package/dist/components/ColorPicker/icons.js +5 -5
  77. package/dist/components/ColorPicker/types.d.ts +6 -0
  78. package/dist/components/ColorPicker/types.d.ts.map +1 -1
  79. package/dist/components/ColorPicker/types.js +53 -11
  80. package/dist/components/ColorPicker/useRecentColors.d.ts +3 -1
  81. package/dist/components/ColorPicker/useRecentColors.d.ts.map +1 -1
  82. package/dist/components/ColorPicker/useRecentColors.js +43 -20
  83. package/dist/components/EmojiPicker/EmojiPanel.d.ts +2 -1
  84. package/dist/components/EmojiPicker/EmojiPanel.d.ts.map +1 -1
  85. package/dist/components/EmojiPicker/EmojiPanel.js +73 -72
  86. package/dist/components/EmojiPicker/EmojiPicker.d.ts +16 -1
  87. package/dist/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
  88. package/dist/components/EmojiPicker/EmojiPicker.js +121 -86
  89. package/dist/components/EmojiPicker/IconsPanel.d.ts.map +1 -1
  90. package/dist/components/EmojiPicker/IconsPanel.js +28 -25
  91. package/dist/components/EntityIcon.d.ts +1 -0
  92. package/dist/components/EntityIcon.d.ts.map +1 -1
  93. package/dist/components/EntityIcon.js +80 -32
  94. package/dist/components/ErrorPage/components/Error403.d.ts +5 -1
  95. package/dist/components/ErrorPage/components/Error403.d.ts.map +1 -1
  96. package/dist/components/ErrorPage/components/Error403.js +25 -21
  97. package/dist/components/ErrorPage/index.d.ts +5 -1
  98. package/dist/components/ErrorPage/index.d.ts.map +1 -1
  99. package/dist/components/ErrorPage/index.js +17 -10
  100. package/dist/components/MusicPlayerBar/components/HoverActions.js +28 -28
  101. package/dist/components/NavMenu/NavMenu.d.ts +7 -1
  102. package/dist/components/NavMenu/NavMenu.d.ts.map +1 -1
  103. package/dist/components/NavMenu/NavMenu.js +54 -44
  104. package/dist/components/NavMenu/NavMenu.module.css.js +10 -10
  105. package/dist/components/NavMenu/components/NavMenuItem.d.ts.map +1 -1
  106. package/dist/components/NavMenu/components/NavMenuItem.js +84 -84
  107. package/dist/components/NavMenu/types.d.ts +4 -0
  108. package/dist/components/NavMenu/types.d.ts.map +1 -1
  109. package/dist/components/WorkspaceMenu/WorkspaceItem.d.ts.map +1 -1
  110. package/dist/components/WorkspaceMenu/WorkspaceItem.js +16 -14
  111. package/dist/config/envConfig.d.ts +2 -0
  112. package/dist/config/envConfig.d.ts.map +1 -1
  113. package/dist/config/envConfig.js +41 -37
  114. package/dist/helpers/showNotifications.d.ts +15 -0
  115. package/dist/helpers/showNotifications.d.ts.map +1 -1
  116. package/dist/helpers/showNotifications.js +114 -72
  117. package/dist/helpers/showNotifications.module.css.js +16 -4
  118. package/dist/hooks/useUiPref.d.ts +2 -0
  119. package/dist/hooks/useUiPref.d.ts.map +1 -0
  120. package/dist/hooks/useUiPref.js +80 -0
  121. package/dist/index.css +1 -1
  122. package/dist/index.d.ts +1 -0
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +550 -540
  125. package/dist/lang/locales/ui_en.json.js +1 -1
  126. package/dist/lang/locales/ui_es.json.js +1 -1
  127. package/dist/lang/locales/ui_ru.json.js +1 -1
  128. package/package.json +1 -1
@@ -1,60 +1,64 @@
1
- const o = () => {
1
+ const i = () => {
2
2
  const n = typeof window > "u" ? void 0 : window;
3
3
  return n?.envConfig == null ? {} : n.envConfig;
4
4
  }, u = () => {
5
- const { livekit: n } = o();
5
+ const { livekit: n } = i();
6
6
  return !!(n?.enabled && n.url);
7
7
  }, a = () => {
8
- const { office: n } = o();
9
- return !!(n?.enabled && n.url);
8
+ const { livekit: n } = i();
9
+ return !n?.enabled || !n.url ? !1 : n.callsEnabled ?? !0;
10
10
  }, f = () => {
11
- const { office: n } = o();
11
+ const { office: n } = i();
12
+ return !!(n?.enabled && n.url);
13
+ }, d = () => {
14
+ const { office: n } = i();
12
15
  return n?.enabled ? n.url : void 0;
13
- }, d = (n, t) => {
14
- const e = n(o());
15
- return e === void 0 ? t : e;
16
- }, m = (...n) => {
17
- for (const t of n) {
18
- if (typeof t != "string")
16
+ }, m = (n, e) => {
17
+ const t = n(i());
18
+ return t === void 0 ? e : t;
19
+ }, v = (...n) => {
20
+ for (const e of n) {
21
+ if (typeof e != "string")
19
22
  continue;
20
- const e = t.trim();
21
- if (e)
22
- return e;
23
+ const t = e.trim();
24
+ if (t)
25
+ return t;
23
26
  }
24
- }, s = (n, { trailingSlash: t = !1 } = {}) => {
27
+ }, s = (n, { trailingSlash: e = !1 } = {}) => {
25
28
  const r = n.trim().replace(/\/+$/, "");
26
- return r ? t ? `${r}/` : r : t ? "/" : "";
27
- }, c = (n) => n == null ? "" : s(n), l = (n) => {
28
- const t = n.trim().match(/^(\d+(?:\.\d+)?)\s*(KB|MB|GB|TB)$/i);
29
- if (!t) return null;
30
- const e = parseFloat(t[1]), r = t[2].toUpperCase(), i = {
29
+ return r ? e ? `${r}/` : r : e ? "/" : "";
30
+ }, l = (n) => n == null ? "" : s(n), c = (n) => {
31
+ const e = n.trim().match(/^(\d+(?:\.\d+)?)\s*(KB|MB|GB|TB)$/i);
32
+ if (!e) return null;
33
+ const t = parseFloat(e[1]), r = e[2].toUpperCase(), o = {
31
34
  KB: 1024,
32
35
  MB: 1024 ** 2,
33
36
  GB: 1024 ** 3,
34
37
  TB: 1024 ** 4
35
38
  };
36
- return Math.round(e * i[r]);
37
- }, v = () => {
38
- const n = o().maxFileSize;
39
+ return Math.round(t * o[r]);
40
+ }, B = () => {
41
+ const n = i().maxFileSize;
39
42
  if (n) {
40
- const t = l(n);
41
- if (t) return t;
43
+ const e = c(n);
44
+ if (e) return e;
42
45
  }
43
46
  return null;
44
- }, B = (n, t) => {
45
- const e = t.startsWith("/") ? t : `/${t}`, r = c(n);
46
- return r ? `${r}${e}` : e;
47
+ }, g = (n, e) => {
48
+ const t = e.startsWith("/") ? e : `/${e}`, r = l(n);
49
+ return r ? `${r}${t}` : t;
47
50
  };
48
51
  export {
49
- o as getEnvConfig,
50
- d as getEnvValue,
51
- v as getMaxUploadSize,
52
- f as getOfficeUrl,
52
+ i as getEnvConfig,
53
+ m as getEnvValue,
54
+ B as getMaxUploadSize,
55
+ d as getOfficeUrl,
56
+ a as isLivekitCallsEnabled,
53
57
  u as isLivekitEnabled,
54
- a as isOfficeEnabled,
55
- B as joinBaseUrlPath,
56
- c as normalizeBaseUrl,
58
+ f as isOfficeEnabled,
59
+ g as joinBaseUrlPath,
60
+ l as normalizeBaseUrl,
57
61
  s as normalizeUrl,
58
- l as parseSizeToBytes,
59
- m as resolveNonBlankString
62
+ c as parseSizeToBytes,
63
+ v as resolveNonBlankString
60
64
  };
@@ -9,6 +9,7 @@ export interface NotificationAction {
9
9
  export type ExtendedNotificationData = Omit<NotificationData, 'message'> & {
10
10
  message?: ReactNode;
11
11
  actions?: NotificationAction[];
12
+ bypassOfflineSuppression?: boolean;
12
13
  };
13
14
  export declare const showRequestNotifications: <Response, Request extends Promise<Response> = Promise<Response>>(request: Request, options?: {
14
15
  notifyId?: string;
@@ -16,6 +17,20 @@ export declare const showRequestNotifications: <Response, Request extends Promis
16
17
  errorMsg?: ((err: any) => MessageType) | MessageType;
17
18
  }) => Promise<any>;
18
19
  export declare const showMessageNotification: (props: ExtendedNotificationData) => void;
20
+ export interface ChatToastProps {
21
+ id: string;
22
+ title: ReactNode;
23
+ body: ReactNode;
24
+ icon?: ReactNode;
25
+ onClick: () => void;
26
+ }
27
+ /**
28
+ * Chat/mention toast: a single clickable card (icon + 1-line title + 2-line
29
+ * clamped body). Clicking anywhere opens the conversation; the X dismisses.
30
+ * No action button — one tap, like a native notification. Re-showing the same
31
+ * id swaps the content in place rather than spamming a new card.
32
+ */
33
+ export declare const showChatToast: ({ id, title, body, icon, onClick }: ChatToastProps) => void;
19
34
  export declare const updateMessageNotification: (props: ExtendedNotificationData & {
20
35
  id: string;
21
36
  }) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"showNotifications.d.ts","sourceRoot":"","sources":["../../src/helpers/showNotifications.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUlC,OAAO,EAAE,gBAAgB,EAAiB,MAAM,wBAAwB,CAAC;AAOzE,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,gBAAgB,CAAC;AAetD,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAChC;AAED,MAAM,MAAM,wBAAwB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,SAMpE,CAAC"}
@@ -1,76 +1,117 @@
1
- import { jsxs as I, jsx as e } from "react/jsx-runtime";
2
- import { InformationCircleIcon as N, CheckmarkCircle02Icon as y, Alert01Icon as B, Alert02Icon as O } from "@hugeicons/core-free-icons";
3
- import { HugeiconsIcon as a } from "@hugeicons/react";
4
- import { Box as u, Button as b } from "@mantine/core";
5
- import { notifications as h } from "@mantine/notifications";
6
- import { isFunction as f, isObject as d } from "lodash-es";
7
- import { isOfflineSuppressed as z } from "./offlineSuppression.js";
8
- import l from "./showNotifications.module.css.js";
9
- let M = 0;
10
- const S = /* @__PURE__ */ e(a, { icon: y, size: 14, color: "white" }), k = /* @__PURE__ */ e(a, { icon: O, size: 14, color: "white" }), x = /* @__PURE__ */ e(a, { icon: B, size: 14, color: "white" }), p = /* @__PURE__ */ e(a, { icon: N, size: 14, color: "white" }), w = (o, t) => t?.length ? /* @__PURE__ */ I(u, { children: [
11
- /* @__PURE__ */ e(u, { children: o }),
12
- /* @__PURE__ */ e(u, { className: l.actions, children: t.map((i, s) => /* @__PURE__ */ e(
13
- b,
1
+ import { jsx as r, jsxs as p } from "react/jsx-runtime";
2
+ import { InformationCircleIcon as S, CheckmarkCircle02Icon as T, Alert01Icon as O, Alert02Icon as b } from "@hugeicons/core-free-icons";
3
+ import { HugeiconsIcon as m } from "@hugeicons/react";
4
+ import { UnstyledButton as x, Group as k, Box as l, Text as w, Button as z } from "@mantine/core";
5
+ import { notifications as u } from "@mantine/notifications";
6
+ import { isFunction as C, isObject as g } from "lodash-es";
7
+ import { isOfflineSuppressed as M } from "./offlineSuppression.js";
8
+ import c from "./showNotifications.module.css.js";
9
+ let v = 0;
10
+ const j = /* @__PURE__ */ r(m, { icon: T, size: 14, color: "white" }), q = /* @__PURE__ */ r(m, { icon: b, size: 14, color: "white" }), W = /* @__PURE__ */ r(m, { icon: O, size: 14, color: "white" }), N = /* @__PURE__ */ r(m, { icon: S, size: 14, color: "white" }), I = (o, t) => t?.length ? /* @__PURE__ */ p(l, { children: [
11
+ /* @__PURE__ */ r(l, { children: o }),
12
+ /* @__PURE__ */ r(l, { className: c.actions, children: t.map((s, e) => /* @__PURE__ */ r(
13
+ z,
14
14
  {
15
15
  size: "compact-sm",
16
- variant: i.variant ?? "default",
17
- onClick: i.onClick,
16
+ variant: s.variant ?? "default",
17
+ onClick: s.onClick,
18
18
  radius: "md",
19
- children: i.label
19
+ children: s.label
20
20
  },
21
- s
21
+ e
22
22
  )) })
23
- ] }) : o, D = (o, t = {}) => {
24
- const { successMsg: i, errorMsg: s } = t;
25
- return o.then((c) => {
26
- if (i) {
27
- const n = f(i) ? i(c) : i, r = {
23
+ ] }) : o, J = (o, t = {}) => {
24
+ const { successMsg: s, errorMsg: e } = t;
25
+ return o.then((i) => {
26
+ if (s) {
27
+ const n = C(s) ? s(i) : s, a = {
28
28
  id: t.notifyId,
29
- ...d(n) ? n : { message: n }
29
+ ...g(n) ? n : { message: n }
30
30
  };
31
- v(r);
31
+ P(a);
32
32
  }
33
- return c;
34
- }).catch((c) => {
35
- if (s) {
36
- const n = f(s) ? s(c) : s, r = {
33
+ return i;
34
+ }).catch((i) => {
35
+ if (e) {
36
+ const n = C(e) ? e(i) : e, a = {
37
37
  id: t.notifyId,
38
- ...d(n) ? n : { message: n }
38
+ ...g(n) ? n : { message: n }
39
39
  };
40
- q(r);
40
+ R(a);
41
41
  }
42
- return c;
42
+ return i;
43
43
  });
44
- }, g = {
45
- root: l.root,
46
- icon: l.icon,
47
- title: l.title,
48
- description: l.description
49
- }, m = (o, t) => {
50
- const { actions: i, message: s, onClose: c, ...n } = o, r = `ntf-${++M}`, C = n.id ?? r;
51
- h.show({
44
+ }, y = {
45
+ root: c.root,
46
+ icon: c.icon,
47
+ title: c.title,
48
+ description: c.description
49
+ }, f = (o, t) => {
50
+ const {
51
+ actions: s,
52
+ message: e,
53
+ onClose: i,
54
+ bypassOfflineSuppression: n,
55
+ ...a
56
+ } = o, h = `ntf-${++v}`, B = a.id ?? h;
57
+ u.show({
52
58
  color: t.color,
53
59
  radius: 12,
54
60
  p: "sm",
55
- ...n,
56
- id: C,
57
- icon: t.icon,
61
+ ...a,
62
+ id: B,
63
+ // Let callers override the icon (e.g. a chat toast showing the sender's avatar);
64
+ // fall back to the status icon (info/success/etc.) when none is supplied.
65
+ icon: a.icon ?? t.icon,
58
66
  withCloseButton: !0,
59
67
  withBorder: !0,
60
- classNames: g,
68
+ classNames: y,
61
69
  onClose: () => {
62
- c?.(o);
70
+ i?.(o);
63
71
  },
64
- message: w(s, i)
72
+ message: I(e, s)
65
73
  });
66
- }, G = (o) => {
67
- m(o, {
74
+ }, L = (o) => {
75
+ f(o, {
68
76
  color: "blue",
69
- icon: p
77
+ icon: N
70
78
  });
71
- }, j = (o, t) => {
72
- const { actions: i, message: s, onClose: c, ...n } = o;
73
- h.update({
79
+ }, d = /* @__PURE__ */ new Set();
80
+ let A = 0;
81
+ const Q = ({ id: o, title: t, body: s, icon: e, onClick: i }) => {
82
+ const n = ++A, a = /* @__PURE__ */ r(
83
+ x,
84
+ {
85
+ className: c.chatToast,
86
+ onClick: () => {
87
+ u.hide(o), i();
88
+ },
89
+ children: /* @__PURE__ */ p(k, { gap: "sm", wrap: "nowrap", align: "flex-start", children: [
90
+ e ? /* @__PURE__ */ r(l, { className: c.chatToastIcon, children: e }) : null,
91
+ /* @__PURE__ */ p(l, { style: { minWidth: 0, flex: 1 }, children: [
92
+ /* @__PURE__ */ r(w, { className: c.chatToastTitle, children: t }),
93
+ /* @__PURE__ */ r(w, { className: c.chatToastBody, children: s }, n)
94
+ ] })
95
+ ] })
96
+ }
97
+ ), h = {
98
+ id: o,
99
+ radius: 12,
100
+ p: "sm",
101
+ withCloseButton: !0,
102
+ withBorder: !0,
103
+ autoClose: 6e3,
104
+ classNames: {
105
+ root: c.chatToastRoot,
106
+ closeButton: c.chatToastClose
107
+ },
108
+ message: a,
109
+ onClose: () => d.delete(o)
110
+ };
111
+ d.has(o) ? u.update(h) : (d.add(o), u.show(h));
112
+ }, E = (o, t) => {
113
+ const { actions: s, message: e, onClose: i, ...n } = o;
114
+ u.update({
74
115
  color: t.color,
75
116
  radius: 12,
76
117
  p: "sm",
@@ -78,38 +119,39 @@ const S = /* @__PURE__ */ e(a, { icon: y, size: 14, color: "white" }), k = /* @_
78
119
  icon: t.icon,
79
120
  withCloseButton: !0,
80
121
  withBorder: !0,
81
- classNames: g,
122
+ classNames: y,
82
123
  onClose: () => {
83
- c?.(o);
124
+ i?.(o);
84
125
  },
85
- message: w(s, i)
126
+ message: I(e, s)
86
127
  });
87
- }, J = (o) => {
88
- j(o, {
128
+ }, V = (o) => {
129
+ E(o, {
89
130
  color: "var(--mantine-color-blue-outline)",
90
- icon: p
131
+ icon: N
91
132
  });
92
- }, v = (o) => {
93
- m(o, {
133
+ }, P = (o) => {
134
+ f(o, {
94
135
  color: "green",
95
- icon: S
136
+ icon: j
96
137
  });
97
- }, K = (o) => {
98
- m(o, {
138
+ }, X = (o) => {
139
+ f(o, {
99
140
  color: "yellow",
100
- icon: x
141
+ icon: W
101
142
  });
102
- }, q = (o) => {
103
- z() || m(o, {
143
+ }, R = (o) => {
144
+ !o.bypassOfflineSuppression && M() || f(o, {
104
145
  color: "red",
105
- icon: k
146
+ icon: q
106
147
  });
107
148
  };
108
149
  export {
109
- q as showErrorNotification,
110
- G as showMessageNotification,
111
- D as showRequestNotifications,
112
- v as showSuccessNotification,
113
- K as showWarningNotification,
114
- J as updateMessageNotification
150
+ Q as showChatToast,
151
+ R as showErrorNotification,
152
+ L as showMessageNotification,
153
+ J as showRequestNotifications,
154
+ P as showSuccessNotification,
155
+ X as showWarningNotification,
156
+ V as updateMessageNotification
115
157
  };
@@ -1,13 +1,25 @@
1
- const t = "_root_zr3bj_1", o = "_icon_zr3bj_15", c = "_title_zr3bj_49", s = "_description_zr3bj_65", i = "_actions_zr3bj_77", n = {
1
+ const t = "_root_wm0dw_1", o = "_icon_wm0dw_15", c = "_title_wm0dw_49", s = "_description_wm0dw_65", a = "_actions_wm0dw_77", _ = "_chatToastRoot_wm0dw_93", n = "_chatToast_wm0dw_93", w = "_chatToastIcon_wm0dw_135", T = "_chatToastTitle_wm0dw_147", d = "_chatToastBody_wm0dw_167", h = "_chatToastClose_wm0dw_231", i = {
2
2
  root: t,
3
3
  icon: o,
4
4
  title: c,
5
5
  description: s,
6
- actions: i
6
+ actions: a,
7
+ chatToastRoot: _,
8
+ chatToast: n,
9
+ chatToastIcon: w,
10
+ chatToastTitle: T,
11
+ chatToastBody: d,
12
+ chatToastClose: h
7
13
  };
8
14
  export {
9
- i as actions,
10
- n as default,
15
+ a as actions,
16
+ n as chatToast,
17
+ d as chatToastBody,
18
+ h as chatToastClose,
19
+ w as chatToastIcon,
20
+ _ as chatToastRoot,
21
+ T as chatToastTitle,
22
+ i as default,
11
23
  s as description,
12
24
  o as icon,
13
25
  t as root,
@@ -0,0 +1,2 @@
1
+ export declare function useUiPref<T>(key: string, defaultValue: T): readonly [T, (next: T | ((prev: T) => T)) => void];
2
+ //# sourceMappingURL=useUiPref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUiPref.d.ts","sourceRoot":"","sources":["../../src/hooks/useUiPref.ts"],"names":[],"mappings":"AA4GA,wBAAgB,SAAS,CAAC,CAAC,EACzB,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,CAAC,GACd,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAiDpD"}
@@ -0,0 +1,80 @@
1
+ import { useCallback as i, useSyncExternalStore as E, useEffect as v } from "react";
2
+ import { getEnvConfig as b } from "../config/envConfig.js";
3
+ const p = "layers.uiPref.", c = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set();
4
+ let u = !1;
5
+ function U(t, e) {
6
+ if (typeof window > "u") return e;
7
+ try {
8
+ const n = window.localStorage.getItem(p + t);
9
+ return n == null ? e : JSON.parse(n);
10
+ } catch {
11
+ return e;
12
+ }
13
+ }
14
+ function h(t, e) {
15
+ if (!(typeof window > "u"))
16
+ try {
17
+ window.localStorage.setItem(p + t, JSON.stringify(e));
18
+ } catch {
19
+ }
20
+ }
21
+ function w(t) {
22
+ a.get(t)?.forEach((e) => e());
23
+ }
24
+ function S(t) {
25
+ const e = b().apiBaseUrl;
26
+ return e ? e.replace(/\/+$/, "") + t : t;
27
+ }
28
+ function d(t, e) {
29
+ if (c.has(t)) return c.get(t);
30
+ const n = U(t, e);
31
+ return c.set(t, n), n;
32
+ }
33
+ function j() {
34
+ u || typeof window > "u" || (u = !0, fetch(S("/v1/ui-prefs"), {
35
+ credentials: "include",
36
+ headers: { Accept: "application/json" }
37
+ }).then((t) => {
38
+ if (!t.ok) throw new Error(String(t.status));
39
+ return t.json();
40
+ }).then((t) => {
41
+ Object.entries(t ?? {}).forEach(([e, n]) => {
42
+ l.has(e) || (c.set(e, n), h(e, n), w(e));
43
+ });
44
+ }).catch(() => {
45
+ }));
46
+ }
47
+ function O(t, e) {
48
+ const n = i(
49
+ (o) => {
50
+ let r = a.get(t);
51
+ return r || (r = /* @__PURE__ */ new Set(), a.set(t, r)), r.add(o), () => {
52
+ r?.delete(o);
53
+ };
54
+ },
55
+ [t]
56
+ ), f = i(
57
+ () => d(t, e),
58
+ [t, e]
59
+ ), g = E(n, f, f);
60
+ v(() => {
61
+ j();
62
+ }, []);
63
+ const m = i(
64
+ (o) => {
65
+ const r = d(t, e), s = typeof o == "function" ? o(r) : o;
66
+ l.add(t), c.set(t, s), h(t, s), w(t), fetch(S(`/v1/ui-prefs/${encodeURIComponent(t)}`), {
67
+ method: "PUT",
68
+ credentials: "include",
69
+ headers: { "Content-Type": "application/json" },
70
+ body: JSON.stringify(s)
71
+ }).catch(() => {
72
+ });
73
+ },
74
+ [t, e]
75
+ );
76
+ return [g, m];
77
+ }
78
+ export {
79
+ O as useUiPref
80
+ };