@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.
- package/dist/components/AppContainer/AppContainer.d.ts.map +1 -1
- package/dist/components/AppContainer/AppContainer.js +72 -79
- package/dist/components/AppContainer/AppContainer.module.css.js +6 -6
- package/dist/components/AppContainer/components/AppsSidebar/TopSection.d.ts.map +1 -1
- package/dist/components/AppContainer/components/AppsSidebar/TopSection.js +24 -22
- package/dist/components/AppContainer/components/AppsSidebar/UserSection.d.ts.map +1 -1
- package/dist/components/AppContainer/components/AppsSidebar/UserSection.js +46 -37
- package/dist/components/AppContainer/components/Header.d.ts.map +1 -1
- package/dist/components/AppContainer/components/Header.js +6 -5
- package/dist/components/AppContainer/components/Main.js +4 -4
- package/dist/components/AppContainer/components/SlideAnimation.js +4 -4
- package/dist/components/AppContainer/components/ToolSidebar.d.ts.map +1 -1
- package/dist/components/AppContainer/components/ToolSidebar.js +161 -128
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.d.ts.map +1 -1
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.js +131 -121
- package/dist/components/AppContainer/hooks/useAppContainer.d.ts +1 -1
- package/dist/components/AppContainer/hooks/useAppContainer.d.ts.map +1 -1
- package/dist/components/AppContainer/hooks/useAppContainer.js +59 -56
- package/dist/components/AppContainer/hooks/useAppContainerDataStore.d.ts.map +1 -1
- package/dist/components/AppContainer/hooks/useAppContainerDataStore.js +4 -3
- package/dist/components/AppContainer/types.d.ts +1 -0
- package/dist/components/AppContainer/types.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/components/ModalHeader.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/components/ModalHeader.js +37 -37
- package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.js +68 -62
- package/dist/components/AttachmentsGalleryModal/helpers.d.ts +8 -0
- package/dist/components/AttachmentsGalleryModal/helpers.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/helpers.js +22 -17
- package/dist/components/AttachmentsGalleryModal/hooks/useDownloadFile.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/hooks/useDownloadFile.js +28 -25
- package/dist/components/AttachmentsGalleryModal/hooks/useGetPreviewUrl.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/hooks/useGetPreviewUrl.js +36 -41
- package/dist/components/AttachmentsPreview/AttachmentsPreview.d.ts.map +1 -1
- package/dist/components/AttachmentsPreview/AttachmentsPreview.js +135 -80
- package/dist/components/AttachmentsPreview/AttachmentsPreview.module.css.js +24 -14
- package/dist/components/BouncingLogo/BouncingLogo.d.ts +1 -3
- package/dist/components/BouncingLogo/BouncingLogo.d.ts.map +1 -1
- package/dist/components/BouncingLogo/BouncingLogo.js +14 -20
- package/dist/components/BouncingLogo/BouncingLogo.module.css.js +4 -8
- package/dist/components/Chat/ChatBubble/ChatBubble.module.css.js +5 -5
- package/dist/components/Chat/ChatInput/ChatInput.module.css.js +40 -28
- package/dist/components/Chat/ChatInput/index.d.ts +29 -1
- package/dist/components/Chat/ChatInput/index.d.ts.map +1 -1
- package/dist/components/Chat/ChatInput/index.js +178 -118
- package/dist/components/Chat/ChatInput/smilePlusIcon.d.ts +3 -0
- package/dist/components/Chat/ChatInput/smilePlusIcon.d.ts.map +1 -0
- package/dist/components/Chat/ChatInput/smilePlusIcon.js +49 -0
- package/dist/components/Chat/ChatMessage/ChatMessage.module.css.js +9 -9
- package/dist/components/Chat/ChatMessage/index.d.ts +2 -0
- package/dist/components/Chat/ChatMessage/index.d.ts.map +1 -1
- package/dist/components/Chat/ChatMessage/index.js +136 -118
- package/dist/components/Chat/MediaDocument/MediaDocument.module.css.js +4 -4
- package/dist/components/Chat/MessageActions/index.d.ts +7 -0
- package/dist/components/Chat/MessageActions/index.d.ts.map +1 -1
- package/dist/components/Chat/MessageActions/index.js +33 -30
- package/dist/components/Chat/MessageList/MessageList.module.css.js +14 -10
- package/dist/components/Chat/MessageList/index.d.ts +30 -3
- package/dist/components/Chat/MessageList/index.d.ts.map +1 -1
- package/dist/components/Chat/MessageList/index.js +154 -66
- package/dist/components/Chat/MessageReactions/MessageReactions.module.css.js +7 -7
- package/dist/components/Chat/MessageReactions/index.d.ts +17 -0
- package/dist/components/Chat/MessageReactions/index.d.ts.map +1 -1
- package/dist/components/Chat/MessageReactions/index.js +60 -28
- package/dist/components/Chat/MessageStatus/MessageStatus.module.css.js +6 -4
- package/dist/components/Chat/MessageStatus/index.d.ts +1 -1
- package/dist/components/Chat/MessageStatus/index.d.ts.map +1 -1
- package/dist/components/Chat/MessageStatus/index.js +49 -34
- package/dist/components/CircleColorPicker/CircleColorPicker.d.ts.map +1 -1
- package/dist/components/CircleColorPicker/CircleColorPicker.js +17 -15
- package/dist/components/ColorPicker/ColorPicker.module.css.js +26 -20
- package/dist/components/ColorPicker/ColorPickerList.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPickerList.js +81 -68
- package/dist/components/ColorPicker/ColorPickerToolbar.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPickerToolbar.js +75 -70
- package/dist/components/ColorPicker/icons.js +5 -5
- package/dist/components/ColorPicker/types.d.ts +6 -0
- package/dist/components/ColorPicker/types.d.ts.map +1 -1
- package/dist/components/ColorPicker/types.js +53 -11
- package/dist/components/ColorPicker/useRecentColors.d.ts +3 -1
- package/dist/components/ColorPicker/useRecentColors.d.ts.map +1 -1
- package/dist/components/ColorPicker/useRecentColors.js +43 -20
- package/dist/components/EmojiPicker/EmojiPanel.d.ts +2 -1
- package/dist/components/EmojiPicker/EmojiPanel.d.ts.map +1 -1
- package/dist/components/EmojiPicker/EmojiPanel.js +73 -72
- package/dist/components/EmojiPicker/EmojiPicker.d.ts +16 -1
- package/dist/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
- package/dist/components/EmojiPicker/EmojiPicker.js +121 -86
- package/dist/components/EmojiPicker/IconsPanel.d.ts.map +1 -1
- package/dist/components/EmojiPicker/IconsPanel.js +28 -25
- package/dist/components/EntityIcon.d.ts +1 -0
- package/dist/components/EntityIcon.d.ts.map +1 -1
- package/dist/components/EntityIcon.js +80 -32
- package/dist/components/ErrorPage/components/Error403.d.ts +5 -1
- package/dist/components/ErrorPage/components/Error403.d.ts.map +1 -1
- package/dist/components/ErrorPage/components/Error403.js +25 -21
- package/dist/components/ErrorPage/index.d.ts +5 -1
- package/dist/components/ErrorPage/index.d.ts.map +1 -1
- package/dist/components/ErrorPage/index.js +17 -10
- package/dist/components/MusicPlayerBar/components/HoverActions.js +28 -28
- package/dist/components/NavMenu/NavMenu.d.ts +7 -1
- package/dist/components/NavMenu/NavMenu.d.ts.map +1 -1
- package/dist/components/NavMenu/NavMenu.js +54 -44
- package/dist/components/NavMenu/NavMenu.module.css.js +10 -10
- package/dist/components/NavMenu/components/NavMenuItem.d.ts.map +1 -1
- package/dist/components/NavMenu/components/NavMenuItem.js +84 -84
- package/dist/components/NavMenu/types.d.ts +4 -0
- package/dist/components/NavMenu/types.d.ts.map +1 -1
- package/dist/components/WorkspaceMenu/WorkspaceItem.d.ts.map +1 -1
- package/dist/components/WorkspaceMenu/WorkspaceItem.js +16 -14
- package/dist/config/envConfig.d.ts +2 -0
- package/dist/config/envConfig.d.ts.map +1 -1
- package/dist/config/envConfig.js +41 -37
- package/dist/helpers/showNotifications.d.ts +15 -0
- package/dist/helpers/showNotifications.d.ts.map +1 -1
- package/dist/helpers/showNotifications.js +114 -72
- package/dist/helpers/showNotifications.module.css.js +16 -4
- package/dist/hooks/useUiPref.d.ts +2 -0
- package/dist/hooks/useUiPref.d.ts.map +1 -0
- package/dist/hooks/useUiPref.js +80 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +550 -540
- package/dist/lang/locales/ui_en.json.js +1 -1
- package/dist/lang/locales/ui_es.json.js +1 -1
- package/dist/lang/locales/ui_ru.json.js +1 -1
- package/package.json +1 -1
package/dist/config/envConfig.js
CHANGED
|
@@ -1,60 +1,64 @@
|
|
|
1
|
-
const
|
|
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 } =
|
|
5
|
+
const { livekit: n } = i();
|
|
6
6
|
return !!(n?.enabled && n.url);
|
|
7
7
|
}, a = () => {
|
|
8
|
-
const {
|
|
9
|
-
return
|
|
8
|
+
const { livekit: n } = i();
|
|
9
|
+
return !n?.enabled || !n.url ? !1 : n.callsEnabled ?? !0;
|
|
10
10
|
}, f = () => {
|
|
11
|
-
const { office: n } =
|
|
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
|
-
},
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
},
|
|
17
|
-
for (const
|
|
18
|
-
if (typeof
|
|
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
|
|
21
|
-
if (
|
|
22
|
-
return
|
|
23
|
+
const t = e.trim();
|
|
24
|
+
if (t)
|
|
25
|
+
return t;
|
|
23
26
|
}
|
|
24
|
-
}, s = (n, { trailingSlash:
|
|
27
|
+
}, s = (n, { trailingSlash: e = !1 } = {}) => {
|
|
25
28
|
const r = n.trim().replace(/\/+$/, "");
|
|
26
|
-
return r ?
|
|
27
|
-
},
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
30
|
-
const
|
|
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(
|
|
37
|
-
},
|
|
38
|
-
const n =
|
|
39
|
+
return Math.round(t * o[r]);
|
|
40
|
+
}, B = () => {
|
|
41
|
+
const n = i().maxFileSize;
|
|
39
42
|
if (n) {
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
43
|
+
const e = c(n);
|
|
44
|
+
if (e) return e;
|
|
42
45
|
}
|
|
43
46
|
return null;
|
|
44
|
-
},
|
|
45
|
-
const
|
|
46
|
-
return r ? `${r}${
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
f as isOfficeEnabled,
|
|
59
|
+
g as joinBaseUrlPath,
|
|
60
|
+
l as normalizeBaseUrl,
|
|
57
61
|
s as normalizeUrl,
|
|
58
|
-
|
|
59
|
-
|
|
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,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG;IACzE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;
|
|
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,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG;IACzE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC/B,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC,CAAC;AA4BF,eAAO,MAAM,wBAAwB,GACnC,QAAQ,EACR,OAAO,SAAS,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,EAErD,SAAS,OAAO,EAChB,UAAS;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,QAAQ,KAAK,WAAW,CAAC,GAAG,WAAW,CAAC;IAC5D,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,WAAW,CAAC,GAAG,WAAW,CAAC;CACjD,iBA+BP,CAAC;AA0CF,eAAO,MAAM,uBAAuB,GAAI,OAAO,wBAAwB,SAKtE,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AASD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,oCAAoC,cAAc,SA8C/E,CAAC;AAwBF,eAAO,MAAM,yBAAyB,GACpC,OAAO,wBAAwB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,SAMjD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,OAAO,wBAAwB,SAKtE,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,OAAO,wBAAwB,SAKtE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,OAAO,wBAAwB,SAMpE,CAAC"}
|
|
@@ -1,76 +1,117 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { InformationCircleIcon as
|
|
3
|
-
import { HugeiconsIcon as
|
|
4
|
-
import { Box as
|
|
5
|
-
import { notifications as
|
|
6
|
-
import { isFunction as
|
|
7
|
-
import { isOfflineSuppressed as
|
|
8
|
-
import
|
|
9
|
-
let
|
|
10
|
-
const
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
|
|
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:
|
|
17
|
-
onClick:
|
|
16
|
+
variant: s.variant ?? "default",
|
|
17
|
+
onClick: s.onClick,
|
|
18
18
|
radius: "md",
|
|
19
|
-
children:
|
|
19
|
+
children: s.label
|
|
20
20
|
},
|
|
21
|
-
|
|
21
|
+
e
|
|
22
22
|
)) })
|
|
23
|
-
] }) : o,
|
|
24
|
-
const { successMsg:
|
|
25
|
-
return o.then((
|
|
26
|
-
if (
|
|
27
|
-
const n =
|
|
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
|
-
...
|
|
29
|
+
...g(n) ? n : { message: n }
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
P(a);
|
|
32
32
|
}
|
|
33
|
-
return
|
|
34
|
-
}).catch((
|
|
35
|
-
if (
|
|
36
|
-
const n =
|
|
33
|
+
return i;
|
|
34
|
+
}).catch((i) => {
|
|
35
|
+
if (e) {
|
|
36
|
+
const n = C(e) ? e(i) : e, a = {
|
|
37
37
|
id: t.notifyId,
|
|
38
|
-
...
|
|
38
|
+
...g(n) ? n : { message: n }
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
R(a);
|
|
41
41
|
}
|
|
42
|
-
return
|
|
42
|
+
return i;
|
|
43
43
|
});
|
|
44
|
-
},
|
|
45
|
-
root:
|
|
46
|
-
icon:
|
|
47
|
-
title:
|
|
48
|
-
description:
|
|
49
|
-
},
|
|
50
|
-
const {
|
|
51
|
-
|
|
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
|
-
...
|
|
56
|
-
id:
|
|
57
|
-
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:
|
|
68
|
+
classNames: y,
|
|
61
69
|
onClose: () => {
|
|
62
|
-
|
|
70
|
+
i?.(o);
|
|
63
71
|
},
|
|
64
|
-
message:
|
|
72
|
+
message: I(e, s)
|
|
65
73
|
});
|
|
66
|
-
},
|
|
67
|
-
|
|
74
|
+
}, L = (o) => {
|
|
75
|
+
f(o, {
|
|
68
76
|
color: "blue",
|
|
69
|
-
icon:
|
|
77
|
+
icon: N
|
|
70
78
|
});
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
|
|
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:
|
|
122
|
+
classNames: y,
|
|
82
123
|
onClose: () => {
|
|
83
|
-
|
|
124
|
+
i?.(o);
|
|
84
125
|
},
|
|
85
|
-
message:
|
|
126
|
+
message: I(e, s)
|
|
86
127
|
});
|
|
87
|
-
},
|
|
88
|
-
|
|
128
|
+
}, V = (o) => {
|
|
129
|
+
E(o, {
|
|
89
130
|
color: "var(--mantine-color-blue-outline)",
|
|
90
|
-
icon:
|
|
131
|
+
icon: N
|
|
91
132
|
});
|
|
92
|
-
},
|
|
93
|
-
|
|
133
|
+
}, P = (o) => {
|
|
134
|
+
f(o, {
|
|
94
135
|
color: "green",
|
|
95
|
-
icon:
|
|
136
|
+
icon: j
|
|
96
137
|
});
|
|
97
|
-
},
|
|
98
|
-
|
|
138
|
+
}, X = (o) => {
|
|
139
|
+
f(o, {
|
|
99
140
|
color: "yellow",
|
|
100
|
-
icon:
|
|
141
|
+
icon: W
|
|
101
142
|
});
|
|
102
|
-
},
|
|
103
|
-
|
|
143
|
+
}, R = (o) => {
|
|
144
|
+
!o.bypassOfflineSuppression && M() || f(o, {
|
|
104
145
|
color: "red",
|
|
105
|
-
icon:
|
|
146
|
+
icon: q
|
|
106
147
|
});
|
|
107
148
|
};
|
|
108
149
|
export {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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 = "
|
|
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:
|
|
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
|
-
|
|
10
|
-
n as
|
|
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 @@
|
|
|
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
|
+
};
|