@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
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { memo as v, useRef as I } from "react";
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { Box as
|
|
5
|
-
import { IconDownload as
|
|
3
|
+
import { useTranslation as F } from "react-i18next";
|
|
4
|
+
import { Box as C, Tooltip as t, ActionIcon as i, Flex as s, Text as u } from "@mantine/core";
|
|
5
|
+
import { IconDownload as f, IconMinus as N, IconPlus as R, IconX as k } from "@tabler/icons-react";
|
|
6
6
|
import { getFileIcons as T } from "../../../helpers/getFileIcons.js";
|
|
7
|
-
import { getFileType as
|
|
8
|
-
import { useAttachmentsGalleryContext as
|
|
9
|
-
import { zoomStep as
|
|
7
|
+
import { getFileType as Z } from "../../../helpers/getFileType.js";
|
|
8
|
+
import { useAttachmentsGalleryContext as j } from "../AttachmentsGalleryContext.js";
|
|
9
|
+
import { getAttachmentFormat as D, zoomStep as p } from "../helpers.js";
|
|
10
10
|
import { useDownloadFile as M } from "../hooks/useDownloadFile.js";
|
|
11
|
-
import { useZoomReset as
|
|
11
|
+
import { useZoomReset as O } from "../hooks/useZoomReset.js";
|
|
12
12
|
import n from "../styles.module.css.js";
|
|
13
|
-
const
|
|
13
|
+
const U = v(
|
|
14
14
|
({ onClose: w, attachments: z }) => {
|
|
15
|
-
|
|
16
|
-
const { t: r } =
|
|
17
|
-
|
|
15
|
+
O();
|
|
16
|
+
const { t: r } = F("ui"), c = I(null), { zoomPercentage: y, transformRefs: m, selectedIndex: a } = j(), o = z?.[a], b = () => {
|
|
17
|
+
p({
|
|
18
18
|
animationRef: c,
|
|
19
19
|
dir: "in",
|
|
20
20
|
activeRef: m.current[a]
|
|
21
21
|
});
|
|
22
|
-
},
|
|
23
|
-
|
|
22
|
+
}, x = () => {
|
|
23
|
+
p({
|
|
24
24
|
animationRef: c,
|
|
25
25
|
dir: "out",
|
|
26
26
|
activeRef: m.current[a]
|
|
27
27
|
});
|
|
28
|
-
}, {
|
|
28
|
+
}, { isFetching: d, onDownload: g, isMobile: h } = M(o), A = o ? D(o).isImage : !1;
|
|
29
29
|
return /* @__PURE__ */ l(
|
|
30
|
-
|
|
30
|
+
C,
|
|
31
31
|
{
|
|
32
32
|
style: {
|
|
33
33
|
borderRadius: 8,
|
|
@@ -41,19 +41,19 @@ const L = v(
|
|
|
41
41
|
py: 8,
|
|
42
42
|
bg: "var(--mantine-color-dark-6)",
|
|
43
43
|
children: [
|
|
44
|
-
h ? /* @__PURE__ */ e(
|
|
45
|
-
|
|
44
|
+
h ? /* @__PURE__ */ e(t, { withArrow: !0, label: r("gallery.download"), children: /* @__PURE__ */ e(
|
|
45
|
+
i,
|
|
46
46
|
{
|
|
47
47
|
className: n.headerAction,
|
|
48
48
|
size: "lg",
|
|
49
49
|
variant: "subtle",
|
|
50
50
|
loading: d,
|
|
51
|
-
onClick:
|
|
52
|
-
children: /* @__PURE__ */ e(
|
|
51
|
+
onClick: g,
|
|
52
|
+
children: /* @__PURE__ */ e(f, { size: 20 })
|
|
53
53
|
}
|
|
54
54
|
) }) : /* @__PURE__ */ l(s, { align: "center", gap: 8, ml: 6, miw: 0, children: [
|
|
55
55
|
o ? T(
|
|
56
|
-
|
|
56
|
+
Z(
|
|
57
57
|
o.contentType ?? "",
|
|
58
58
|
!1,
|
|
59
59
|
o.originalFileName
|
|
@@ -61,21 +61,21 @@ const L = v(
|
|
|
61
61
|
!1,
|
|
62
62
|
20
|
|
63
63
|
) : null,
|
|
64
|
-
/* @__PURE__ */ e(
|
|
64
|
+
/* @__PURE__ */ e(u, { fw: 500, fz: 14, c: "var(--app-gallary-text)", truncate: !0, children: o?.originalFileName || "" })
|
|
65
65
|
] }),
|
|
66
|
-
A ? /* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */ e(
|
|
68
|
-
|
|
66
|
+
A ? /* @__PURE__ */ l(s, { gap: "xs", children: [
|
|
67
|
+
/* @__PURE__ */ e(t, { withArrow: !0, label: r("gallery.zoomOut"), children: /* @__PURE__ */ e(
|
|
68
|
+
i,
|
|
69
69
|
{
|
|
70
70
|
className: n.headerAction,
|
|
71
71
|
size: "lg",
|
|
72
72
|
variant: "subtle",
|
|
73
|
-
onClick:
|
|
73
|
+
onClick: x,
|
|
74
74
|
children: /* @__PURE__ */ e(N, { size: 20 })
|
|
75
75
|
}
|
|
76
76
|
) }),
|
|
77
77
|
/* @__PURE__ */ l(
|
|
78
|
-
|
|
78
|
+
u,
|
|
79
79
|
{
|
|
80
80
|
fw: 500,
|
|
81
81
|
fz: 14,
|
|
@@ -88,31 +88,31 @@ const L = v(
|
|
|
88
88
|
]
|
|
89
89
|
}
|
|
90
90
|
),
|
|
91
|
-
/* @__PURE__ */ e(
|
|
92
|
-
|
|
91
|
+
/* @__PURE__ */ e(t, { withArrow: !0, label: r("gallery.zoomIn"), children: /* @__PURE__ */ e(
|
|
92
|
+
i,
|
|
93
93
|
{
|
|
94
94
|
className: n.headerAction,
|
|
95
95
|
size: "lg",
|
|
96
96
|
variant: "subtle",
|
|
97
|
-
onClick:
|
|
97
|
+
onClick: b,
|
|
98
98
|
children: /* @__PURE__ */ e(R, { size: 20 })
|
|
99
99
|
}
|
|
100
100
|
) })
|
|
101
|
-
] }),
|
|
101
|
+
] }) : /* @__PURE__ */ e("div", {}),
|
|
102
102
|
/* @__PURE__ */ l(s, { justify: "end", gap: "xs", children: [
|
|
103
|
-
!h && /* @__PURE__ */ e(
|
|
104
|
-
|
|
103
|
+
!h && /* @__PURE__ */ e(t, { withArrow: !0, label: r("gallery.download"), children: /* @__PURE__ */ e(
|
|
104
|
+
i,
|
|
105
105
|
{
|
|
106
106
|
className: n.headerAction,
|
|
107
107
|
size: "lg",
|
|
108
108
|
variant: "subtle",
|
|
109
109
|
loading: d,
|
|
110
|
-
onClick:
|
|
111
|
-
children: /* @__PURE__ */ e(
|
|
110
|
+
onClick: g,
|
|
111
|
+
children: /* @__PURE__ */ e(f, { size: 20 })
|
|
112
112
|
}
|
|
113
113
|
) }),
|
|
114
|
-
/* @__PURE__ */ e(
|
|
115
|
-
|
|
114
|
+
/* @__PURE__ */ e(t, { withArrow: !0, label: r("gallery.close"), children: /* @__PURE__ */ e(
|
|
115
|
+
i,
|
|
116
116
|
{
|
|
117
117
|
className: n.headerAction,
|
|
118
118
|
size: "lg",
|
|
@@ -128,5 +128,5 @@ const L = v(
|
|
|
128
128
|
}
|
|
129
129
|
);
|
|
130
130
|
export {
|
|
131
|
-
|
|
131
|
+
U as ModalHeader
|
|
132
132
|
};
|
package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useShakePlayer.d.ts","sourceRoot":"","sources":["../../../../../src/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useShakePlayer.d.ts","sourceRoot":"","sources":["../../../../../src/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.tsx"],"names":[],"mappings":"AAkDA,eAAO,MAAM,cAAc,GAAI,uCAI5B;IACD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;;;;;;CAqLA,CAAC"}
|
|
@@ -1,101 +1,107 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { getEnvConfig as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
return
|
|
6
|
-
},
|
|
7
|
-
const
|
|
8
|
-
return (await fetch(`${
|
|
1
|
+
import { useState as R, useRef as f, useCallback as A, useEffect as C } from "react";
|
|
2
|
+
import { getEnvConfig as S } from "../../../../config/envConfig.js";
|
|
3
|
+
const U = () => {
|
|
4
|
+
const e = S().apiBaseUrl || "";
|
|
5
|
+
return e.endsWith("/") ? e.slice(0, -1) : e;
|
|
6
|
+
}, E = async (e) => {
|
|
7
|
+
const s = U();
|
|
8
|
+
return (await fetch(`${s}/v1/auth/refresh`, {
|
|
9
9
|
method: "POST",
|
|
10
10
|
credentials: "include",
|
|
11
|
-
signal:
|
|
11
|
+
signal: e
|
|
12
12
|
})).ok;
|
|
13
|
-
}, $ = async (
|
|
14
|
-
const
|
|
15
|
-
...
|
|
13
|
+
}, $ = async (e, s) => {
|
|
14
|
+
const l = await fetch(e, {
|
|
15
|
+
...s,
|
|
16
16
|
credentials: "include"
|
|
17
17
|
});
|
|
18
|
-
return
|
|
19
|
-
...
|
|
18
|
+
return l.status !== 401 && l.status !== 403 || !await E(s.signal) || s.signal.aborted ? l : fetch(e, {
|
|
19
|
+
...s,
|
|
20
20
|
credentials: "include"
|
|
21
21
|
});
|
|
22
|
-
}, V = ({
|
|
23
|
-
attachmentId:
|
|
24
|
-
isActive:
|
|
25
|
-
autoPlay:
|
|
22
|
+
}, q = () => !!window.layersDesktop || (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") && window.location.port !== "3000", V = ({
|
|
23
|
+
attachmentId: e,
|
|
24
|
+
isActive: s,
|
|
25
|
+
autoPlay: l
|
|
26
26
|
}) => {
|
|
27
|
-
const [
|
|
28
|
-
(
|
|
29
|
-
if (!
|
|
30
|
-
const
|
|
31
|
-
`/v1/attachments/${
|
|
32
|
-
|
|
27
|
+
const [w, g] = R(null), [b, p] = R(null), [T, d] = R(!1), m = f(null), c = f(!0), o = f(null), t = f(null), u = f(null), a = A(
|
|
28
|
+
(r) => {
|
|
29
|
+
if (!e || u.current || !c.current || r.aborted) return;
|
|
30
|
+
const h = U() || window.location.origin, i = new URL(
|
|
31
|
+
`/v1/attachments/${e}`,
|
|
32
|
+
h
|
|
33
33
|
).toString();
|
|
34
|
-
|
|
34
|
+
u.current = i, g(null), p(i);
|
|
35
35
|
},
|
|
36
|
-
[
|
|
37
|
-
),
|
|
38
|
-
if (!
|
|
36
|
+
[e]
|
|
37
|
+
), k = A(async () => {
|
|
38
|
+
if (!e || u.current) return;
|
|
39
39
|
o.current && (clearTimeout(o.current), o.current = null), t.current && t.current.abort();
|
|
40
|
-
const
|
|
41
|
-
t.current =
|
|
40
|
+
const r = new AbortController();
|
|
41
|
+
t.current = r, d(!1);
|
|
42
42
|
try {
|
|
43
|
-
await
|
|
43
|
+
await E(r.signal), a(r.signal);
|
|
44
44
|
} catch (n) {
|
|
45
|
-
if (n instanceof Error && n.name === "AbortError" || !c.current ||
|
|
46
|
-
|
|
45
|
+
if (n instanceof Error && n.name === "AbortError" || !c.current || r.signal.aborted) return;
|
|
46
|
+
d(!0);
|
|
47
47
|
}
|
|
48
|
-
}, [
|
|
49
|
-
if (!
|
|
48
|
+
}, [e, a]), y = async () => {
|
|
49
|
+
if (!e)
|
|
50
50
|
return;
|
|
51
51
|
t.current && t.current.abort();
|
|
52
|
-
const
|
|
53
|
-
t.current =
|
|
52
|
+
const r = new AbortController();
|
|
53
|
+
t.current = r;
|
|
54
54
|
try {
|
|
55
|
-
const n =
|
|
56
|
-
`${n}/v1/attachments/${
|
|
55
|
+
const n = U(), h = await $(
|
|
56
|
+
`${n}/v1/attachments/${e}/vod`,
|
|
57
57
|
{
|
|
58
58
|
method: "GET",
|
|
59
59
|
headers: {
|
|
60
60
|
Accept: "*/*"
|
|
61
61
|
},
|
|
62
|
-
signal:
|
|
62
|
+
signal: r.signal
|
|
63
63
|
}
|
|
64
64
|
);
|
|
65
|
-
if (!
|
|
66
|
-
await
|
|
65
|
+
if (!h.ok) {
|
|
66
|
+
await a(r.signal);
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
const
|
|
70
|
-
if (!c.current ||
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
p(null),
|
|
69
|
+
const i = await h.json();
|
|
70
|
+
if (!c.current || r.signal.aborted) return;
|
|
71
|
+
const v = n || window.location.origin;
|
|
72
|
+
if (i.ready) {
|
|
73
|
+
const B = new URL(i.url, v).toString();
|
|
74
|
+
if (u.current) return;
|
|
75
|
+
p(null), g(B);
|
|
76
76
|
} else
|
|
77
|
-
|
|
77
|
+
a(r.signal), o.current = setTimeout(() => {
|
|
78
78
|
y();
|
|
79
79
|
}, 3e3);
|
|
80
80
|
} catch (n) {
|
|
81
|
-
if (n instanceof Error && n.name === "AbortError" || !c.current ||
|
|
82
|
-
|
|
81
|
+
if (n instanceof Error && n.name === "AbortError" || !c.current || r.signal.aborted) return;
|
|
82
|
+
d(!0);
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
|
-
return
|
|
86
|
-
if (c.current = !0,
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
return C(() => {
|
|
86
|
+
if (c.current = !0, g(null), p(null), d(!1), u.current = null, o.current && (clearTimeout(o.current), o.current = null), t.current && (t.current.abort(), t.current = null), !!e) {
|
|
87
|
+
if (q()) {
|
|
88
|
+
const r = new AbortController();
|
|
89
|
+
t.current = r, a(r.signal);
|
|
90
|
+
} else
|
|
91
|
+
y();
|
|
92
|
+
return () => {
|
|
93
|
+
c.current = !1, o.current && (clearTimeout(o.current), o.current = null), t.current && (t.current.abort(), t.current = null), u.current = null;
|
|
89
94
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
}
|
|
96
|
+
}, [e]), C(() => {
|
|
97
|
+
if (!w && !b || !m.current) return;
|
|
98
|
+
const r = m.current.querySelector(
|
|
93
99
|
"video"
|
|
94
100
|
);
|
|
95
|
-
|
|
101
|
+
r && (s ? l !== !1 && r.play().catch((n) => {
|
|
96
102
|
console.error("Ошибка при воспроизведении видео:", n);
|
|
97
|
-
}) :
|
|
98
|
-
}, [
|
|
103
|
+
}) : r.pause());
|
|
104
|
+
}, [s, w, b, l]), { containerRef: m, fallbackToRawAttachment: k, isError: T, vodUrl: w, rawUrl: b };
|
|
99
105
|
};
|
|
100
106
|
export {
|
|
101
107
|
V as useShakePlayer
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { MutableRefObject } from 'react';
|
|
2
2
|
import { ReactZoomPanPinchContentRef } from 'react-zoom-pan-pinch';
|
|
3
|
+
import { IFileResponse } from '../../types/files';
|
|
4
|
+
export declare const getAttachmentFormat: (attachment: Pick<IFileResponse, "contentType" | "originalFileName">) => {
|
|
5
|
+
isVideo: boolean;
|
|
6
|
+
isPdf: boolean;
|
|
7
|
+
isImage: boolean;
|
|
8
|
+
isAudio: boolean;
|
|
9
|
+
isSupported: boolean;
|
|
10
|
+
};
|
|
3
11
|
export declare const animateTransform: ({ instance, from, to, duration, animationRef, }: {
|
|
4
12
|
instance: ReactZoomPanPinchContentRef["instance"];
|
|
5
13
|
from: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentsGalleryModal/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentsGalleryModal/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,eAAO,MAAM,mBAAmB,GAC9B,YAAY,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,kBAAkB,CAAC;;;;;;CAkBpE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,iDAM9B;IACD,QAAQ,EAAE,2BAA2B,CAAC,UAAU,CAAC,CAAC;IAClD,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC/C,SAuBA,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,mCAItB;IACD,GAAG,EAAE,IAAI,GAAG,KAAK,CAAC;IAClB,SAAS,EAAE,2BAA2B,CAAC;IACvC,YAAY,EAAE,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC/C,SA2BA,CAAC"}
|
|
@@ -1,40 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { isVideoFile as w } from "../../helpers/fileUtils.js";
|
|
2
|
+
import { STEPS as l } from "./constants.js";
|
|
3
|
+
const T = (i) => {
|
|
4
|
+
const t = (i.contentType || "").toLowerCase(), e = i.originalFileName || "", s = w(i.contentType, e), n = t === "application/pdf" || e.toLowerCase().endsWith(".pdf"), o = t.startsWith("image/") || /\.(jpe?g|png|gif|webp|bmp|svg|avif|heic|heif|tiff?|ico)$/i.test(e), c = t.startsWith("audio/") || /\.(mp3|wav|ogg|flac|m4a|aac|opus|weba)$/i.test(e);
|
|
5
|
+
return { isVideo: s, isPdf: n, isImage: o, isAudio: c, isSupported: o || s || n || c };
|
|
6
|
+
}, y = ({
|
|
7
|
+
instance: i,
|
|
4
8
|
from: t,
|
|
5
9
|
to: e,
|
|
6
10
|
duration: s = 200,
|
|
7
11
|
animationRef: n
|
|
8
12
|
}) => {
|
|
9
13
|
n.current && cancelAnimationFrame(n.current);
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
14
|
+
const o = performance.now(), c = (r) => {
|
|
15
|
+
const p = Math.min((r - o) / s, 1), a = 1 - Math.pow(1 - p, 3), m = t.scale + (e.scale - t.scale) * a, f = t.x + (e.x - t.x) * a, d = t.y + (e.y - t.y) * a;
|
|
16
|
+
i.setTransformState(m, f, d), p < 1 && (n.current = requestAnimationFrame(c));
|
|
13
17
|
};
|
|
14
|
-
n.current = requestAnimationFrame(
|
|
15
|
-
},
|
|
16
|
-
dir:
|
|
18
|
+
n.current = requestAnimationFrame(c);
|
|
19
|
+
}, A = ({
|
|
20
|
+
dir: i,
|
|
17
21
|
activeRef: t,
|
|
18
22
|
animationRef: e
|
|
19
23
|
}) => {
|
|
20
24
|
const s = t?.instance;
|
|
21
25
|
if (!s) return;
|
|
22
|
-
const { scale: n, positionX:
|
|
26
|
+
const { scale: n, positionX: o, positionY: c } = s.transformState, r = s.wrapperComponent?.getBoundingClientRect(), p = (r?.width ?? 0) / 2, a = (r?.height ?? 0) / 2, m = S(n), f = i === "in" ? m + 1 : m - 1, d = Math.min(Math.max(f, 0), l.length - 1), g = l[d], u = g / n, h = p - (p - o) * u, x = a - (a - c) * u;
|
|
23
27
|
y({
|
|
24
28
|
instance: s,
|
|
25
|
-
from: { scale: n, x:
|
|
26
|
-
to: { scale:
|
|
29
|
+
from: { scale: n, x: o, y: c },
|
|
30
|
+
to: { scale: g, x: h, y: x },
|
|
27
31
|
duration: 200,
|
|
28
32
|
animationRef: e
|
|
29
33
|
});
|
|
30
|
-
}, S = (
|
|
34
|
+
}, S = (i) => {
|
|
31
35
|
let t = 0, e = 1 / 0;
|
|
32
|
-
return
|
|
33
|
-
const
|
|
34
|
-
|
|
36
|
+
return l.forEach((s, n) => {
|
|
37
|
+
const o = Math.abs(s - i);
|
|
38
|
+
o < e && (e = o, t = n);
|
|
35
39
|
}), t;
|
|
36
40
|
};
|
|
37
41
|
export {
|
|
38
42
|
y as animateTransform,
|
|
39
|
-
|
|
43
|
+
T as getAttachmentFormat,
|
|
44
|
+
A as zoomStep
|
|
40
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDownloadFile.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentsGalleryModal/hooks/useDownloadFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAkC,MAAM,OAAO,CAAC;AAQvE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,eAAO,MAAM,eAAe,GAAI,eAAe,aAAa;;;oBAI9C,cAAc;;
|
|
1
|
+
{"version":3,"file":"useDownloadFile.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentsGalleryModal/hooks/useDownloadFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAkC,MAAM,OAAO,CAAC;AAQvE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,eAAO,MAAM,eAAe,GAAI,eAAe,aAAa;;;oBAI9C,cAAc;;CAgD3B,CAAC"}
|
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { downloadImageFromExternalUrl as
|
|
3
|
-
import { isVideoFile as
|
|
4
|
-
import { useMenu as
|
|
5
|
-
const
|
|
6
|
-
const [l, e] =
|
|
7
|
-
async (
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { useState as u, useCallback as c, useMemo as p } from "react";
|
|
2
|
+
import { downloadImageFromExternalUrl as a, downloadURL as b } from "../../../helpers/download.js";
|
|
3
|
+
import { isVideoFile as F } from "../../../helpers/fileUtils.js";
|
|
4
|
+
import { useMenu as U } from "../../../hooks/useMenu.js";
|
|
5
|
+
const M = (o) => {
|
|
6
|
+
const [l, e] = u(!1), r = c(
|
|
7
|
+
async (d) => {
|
|
8
|
+
if (d.stopPropagation(), !o)
|
|
9
|
+
return;
|
|
10
|
+
e(!0);
|
|
11
|
+
const i = o.originalFileName || "file";
|
|
12
|
+
if (o?.Url)
|
|
13
|
+
await a(o?.Url, i), e(!1);
|
|
14
|
+
else {
|
|
15
|
+
const s = await fetch(`/v1/attachments/${o.id}`, {
|
|
16
|
+
method: "GET"
|
|
17
|
+
});
|
|
18
|
+
if (!s.ok)
|
|
19
|
+
throw e(!1), new Error(`Error loading: ${s.statusText}`);
|
|
20
|
+
const w = await s.blob();
|
|
21
|
+
e(!1);
|
|
22
|
+
const n = window.URL.createObjectURL(w);
|
|
23
|
+
n && o && (o.id ? b(n, i) : a(n, i));
|
|
24
|
+
}
|
|
22
25
|
},
|
|
23
26
|
[o]
|
|
24
|
-
), { isMobile:
|
|
27
|
+
), { isMobile: f } = U(), m = F(
|
|
25
28
|
o?.contentType,
|
|
26
29
|
o?.originalFileName
|
|
27
30
|
);
|
|
28
31
|
return p(
|
|
29
|
-
() => ({ isVideo:
|
|
30
|
-
[
|
|
32
|
+
() => ({ isVideo: m, isMobile: f, onDownload: r, isFetching: l }),
|
|
33
|
+
[f, m, r, l]
|
|
31
34
|
);
|
|
32
35
|
};
|
|
33
36
|
export {
|
|
34
|
-
|
|
37
|
+
M as useDownloadFile
|
|
35
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetPreviewUrl.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentsGalleryModal/hooks/useGetPreviewUrl.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGetPreviewUrl.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentsGalleryModal/hooks/useGetPreviewUrl.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAQrD,eAAO,MAAM,gBAAgB,GAAI,YAAY,aAAa;;;;;;;;;;CA0FzD,CAAC"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { getEnvConfig as
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
const e =
|
|
1
|
+
import { useState as f, useEffect as A, useMemo as v } from "react";
|
|
2
|
+
import { getEnvConfig as F } from "../../../config/envConfig.js";
|
|
3
|
+
import { getAttachmentFormat as $ } from "../helpers.js";
|
|
4
|
+
const m = () => {
|
|
5
|
+
const e = F().apiBaseUrl || "";
|
|
6
6
|
return e.endsWith("/") ? e.slice(0, -1) : e;
|
|
7
|
-
},
|
|
8
|
-
const [
|
|
9
|
-
async function
|
|
10
|
-
return fetch(`${
|
|
7
|
+
}, S = (e) => {
|
|
8
|
+
const [l, g] = f(null), [u, n] = f(!1), [d, a] = f(!1);
|
|
9
|
+
async function p(r) {
|
|
10
|
+
return fetch(`${m()}/v1/attachments/${r}`, {
|
|
11
11
|
method: "GET",
|
|
12
12
|
credentials: "include"
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
async function
|
|
15
|
+
async function U() {
|
|
16
16
|
try {
|
|
17
|
-
return (await fetch(`${
|
|
17
|
+
return (await fetch(`${m()}/v1/auth/refresh`, {
|
|
18
18
|
method: "POST",
|
|
19
19
|
credentials: "include"
|
|
20
20
|
})).ok;
|
|
@@ -22,46 +22,41 @@ const h = () => {
|
|
|
22
22
|
return !1;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
async function
|
|
25
|
+
async function E(r, b) {
|
|
26
26
|
n(!0);
|
|
27
|
-
let
|
|
28
|
-
if ((
|
|
29
|
-
throw n(!1), a(!0), new Error(`Error loading: ${
|
|
30
|
-
const
|
|
31
|
-
|
|
27
|
+
let t = await p(r);
|
|
28
|
+
if ((t.status === 401 || t.status === 403) && await U() && (t = await p(r)), !t.ok)
|
|
29
|
+
throw n(!1), a(!0), new Error(`Error loading: ${t.statusText}`);
|
|
30
|
+
const c = await t.blob(), y = b && c.type !== "application/pdf" ? new Blob([c], { type: "application/pdf" }) : c;
|
|
31
|
+
g(window.URL.createObjectURL(y)), n(!1), a(!1);
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
e.
|
|
36
|
-
|
|
37
|
-
e.originalFileName || ""
|
|
38
|
-
), r = c || t || o || l;
|
|
39
|
-
return F(() => {
|
|
40
|
-
e.id && !t && r && !e.Url && U(e.id, o);
|
|
41
|
-
}, [e.Url, e.id, t, o, r]), T(
|
|
33
|
+
const { isVideo: s, isPdf: i, isImage: h, isAudio: w, isSupported: o } = $(e);
|
|
34
|
+
return A(() => {
|
|
35
|
+
e.id && !s && o && !e.Url && E(e.id, i);
|
|
36
|
+
}, [e.Url, e.id, s, i, o]), v(
|
|
42
37
|
() => ({
|
|
43
|
-
fileUrl:
|
|
44
|
-
isFetching:
|
|
45
|
-
isError:
|
|
38
|
+
fileUrl: l,
|
|
39
|
+
isFetching: u,
|
|
40
|
+
isError: d,
|
|
46
41
|
setIsError: a,
|
|
47
|
-
isVideo:
|
|
48
|
-
isPdf:
|
|
49
|
-
isImage:
|
|
50
|
-
isAudio:
|
|
51
|
-
isSupported:
|
|
42
|
+
isVideo: s,
|
|
43
|
+
isPdf: i,
|
|
44
|
+
isImage: h,
|
|
45
|
+
isAudio: w,
|
|
46
|
+
isSupported: o
|
|
52
47
|
}),
|
|
53
48
|
[
|
|
49
|
+
l,
|
|
50
|
+
d,
|
|
54
51
|
u,
|
|
52
|
+
s,
|
|
53
|
+
i,
|
|
54
|
+
h,
|
|
55
55
|
w,
|
|
56
|
-
|
|
57
|
-
t,
|
|
58
|
-
o,
|
|
59
|
-
c,
|
|
60
|
-
l,
|
|
61
|
-
r
|
|
56
|
+
o
|
|
62
57
|
]
|
|
63
58
|
);
|
|
64
59
|
};
|
|
65
60
|
export {
|
|
66
|
-
|
|
61
|
+
S as useGetPreviewUrl
|
|
67
62
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentsPreview.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentsPreview/AttachmentsPreview.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AttachmentsPreview.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentsPreview/AttachmentsPreview.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAOhE,UAAU,8BAA8B;IACtC,KAAK,EAAE,oBAAoB,CAAC,cAAc,EAAE,CAAC;IAC7C,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,kBAAkB,GAAI,8CAKhC,8BAA8B,mDA4QhC,CAAC"}
|