@nivaro/react 0.3.17 → 0.3.19
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +54 -1
- package/dist/index.js +243 -240
- package/dist/shared/components/CollectionBrowserView.js +439 -438
- package/dist/shared/components/ItemEditForm.js +3758 -3708
- package/dist/shared/components/ProfileView.js +38 -23
- package/dist/shared/components/RecordReadView.js +452 -430
- package/dist/shared/components/bulk/BulkActionButtons.js +113 -106
- package/dist/shared/components/chat/ChannelArchive.js +16 -17
- package/dist/shared/components/chat/ChatPanel.js +992 -930
- package/dist/shared/components/chat/Composer.js +307 -303
- package/dist/shared/components/chat/chat-core.js +8 -4
- package/dist/shared/components/chat/chat-drafts.js +60 -43
- package/dist/shared/components/help-videos/api.js +3 -0
- package/dist/shared/components/help-videos/library/HelpVideoLibrary.js +225 -177
- package/dist/shared/components/item-edit/InlineTableField.js +159 -158
- package/dist/shared/components/item-edit/RecordLiveSync.js +169 -155
- package/dist/shared/components/item-edit/RelationCombobox.js +274 -247
- package/dist/shared/components/item-edit/RowHistorySheet.js +62 -62
- package/dist/shared/components/item-edit/picker-search.js +28 -0
- package/dist/shared/components/panels/RevisionsPanel.js +268 -260
- package/dist/shared/components/profile/BrowserPushCard.js +135 -89
- package/dist/shared/components/profile/push-failure.js +76 -0
- package/dist/shared/lib/display-prefs.js +90 -0
- package/dist/shared/lib/theme-accents.js +21 -16
- package/package.json +1 -1
|
@@ -564,13 +564,17 @@ function ot(e, t = {}) {
|
|
|
564
564
|
t.sender && (n.sender = t.sender), t.room && (n.room = t.room), t.from && (n.from = t.from), t.to && (n.to = t.to), t.has_attachment && (n.has_attachment = "1"), t.mentions_me && (n.mentions_me = "1");
|
|
565
565
|
const o = Object.keys(n).length > 1, { data: r, isLoading: a } = y({
|
|
566
566
|
queryKey: ["nvr-chat-search", n],
|
|
567
|
-
queryFn: async () =>
|
|
568
|
-
|
|
569
|
-
|
|
567
|
+
queryFn: async () => {
|
|
568
|
+
var c;
|
|
569
|
+
const i = await s.request(
|
|
570
|
+
g("/chat/search", n)
|
|
571
|
+
);
|
|
572
|
+
return { hits: i.data ?? [], meaning: ((c = i.meta) == null ? void 0 : c.meaning) ?? null };
|
|
573
|
+
},
|
|
570
574
|
enabled: e.trim().length >= 2 || o,
|
|
571
575
|
staleTime: 15e3
|
|
572
576
|
});
|
|
573
|
-
return { hits: r ?? [], loading: a };
|
|
577
|
+
return { hits: (r == null ? void 0 : r.hits) ?? [], meaning: (r == null ? void 0 : r.meaning) ?? null, loading: a };
|
|
574
578
|
}
|
|
575
579
|
function at() {
|
|
576
580
|
const e = m(), t = v();
|
|
@@ -1,59 +1,76 @@
|
|
|
1
|
-
import { useQueryClient as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import { useNivaroClient as
|
|
4
|
-
import { get as
|
|
5
|
-
import { useOptionalRealtime as
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
const r =
|
|
1
|
+
import { useQueryClient as D, useQuery as U } from "@tanstack/react-query";
|
|
2
|
+
import { useEffect as d, useRef as f } from "react";
|
|
3
|
+
import { useNivaroClient as I } from "../../context.js";
|
|
4
|
+
import { get as Q, put as $, del as g } from "../../lib/commands.js";
|
|
5
|
+
import { useOptionalRealtime as S } from "../../lib/realtime.js";
|
|
6
|
+
const K = 1500, h = Math.random().toString(36).slice(2, 12);
|
|
7
|
+
function x(e = !0) {
|
|
8
|
+
const r = I(), n = S(), l = D(), { data: s } = U({
|
|
9
9
|
queryKey: ["nvr-chat-drafts"],
|
|
10
|
-
queryFn: () => r.request(
|
|
11
|
-
enabled:
|
|
10
|
+
queryFn: () => r.request(Q("/chat/drafts")).then((i) => (i.data ?? []).map((m) => m.room)),
|
|
11
|
+
enabled: e,
|
|
12
12
|
staleTime: 6e4
|
|
13
13
|
});
|
|
14
|
-
return
|
|
15
|
-
if (!(!
|
|
16
|
-
return
|
|
14
|
+
return d(() => {
|
|
15
|
+
if (!(!e || !n))
|
|
16
|
+
return n.on(
|
|
17
17
|
"chat:draft",
|
|
18
|
-
() => void
|
|
18
|
+
() => void l.invalidateQueries({ queryKey: ["nvr-chat-drafts"] })
|
|
19
19
|
);
|
|
20
|
-
}, [
|
|
20
|
+
}, [e, n, l]), new Set(s ?? []);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const s =
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
var
|
|
22
|
+
function B(e, r, n, l) {
|
|
23
|
+
const s = I(), i = S(), m = D(), c = f(""), v = f(n);
|
|
24
|
+
v.current = n;
|
|
25
|
+
const y = f(!1), q = async (t) => {
|
|
26
|
+
var u;
|
|
27
27
|
try {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
)).data) == null ? void 0 :
|
|
31
|
-
(
|
|
28
|
+
const a = ((u = (await s.request(
|
|
29
|
+
Q(`/chat/drafts/${encodeURIComponent(e)}`)
|
|
30
|
+
)).data) == null ? void 0 : u.body) ?? "", p = v.current;
|
|
31
|
+
(t ? p === "" : p === c.current) ? (c.current = a, a !== p && l(a)) : t && (c.current = a);
|
|
32
32
|
} catch {
|
|
33
33
|
} finally {
|
|
34
|
-
|
|
34
|
+
y.current = !0;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
r && (
|
|
39
|
-
}, [
|
|
40
|
-
if (!(!r || !
|
|
41
|
-
return
|
|
42
|
-
!
|
|
37
|
+
d(() => {
|
|
38
|
+
r && (y.current = !1, c.current = "", q(!0));
|
|
39
|
+
}, [e, r]), d(() => {
|
|
40
|
+
if (!(!r || !i))
|
|
41
|
+
return i.on("chat:draft", (t) => {
|
|
42
|
+
!t || t.room !== e || t.device === h || q(!1);
|
|
43
43
|
});
|
|
44
|
-
}, [r,
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
}, [r, i, e]);
|
|
45
|
+
const C = (t, u) => {
|
|
46
|
+
const E = () => {
|
|
47
|
+
t === R.current && (c.current = u), m.invalidateQueries({ queryKey: ["nvr-chat-drafts"] });
|
|
48
|
+
};
|
|
49
|
+
(u.trim() ? s.request($(`/chat/drafts/${encodeURIComponent(t)}`, { body: u, device: h })) : s.request(g(`/chat/drafts/${encodeURIComponent(t)}?device=${h}`))).then(E).catch(() => {
|
|
50
|
+
});
|
|
51
|
+
}, R = f(e);
|
|
52
|
+
R.current = e;
|
|
53
|
+
const o = f(null);
|
|
54
|
+
d(() => {
|
|
55
|
+
if (!r || !y.current) return;
|
|
56
|
+
if (n === c.current) {
|
|
57
|
+
o.current = null;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
o.current = { room: e, body: n };
|
|
61
|
+
const t = setTimeout(() => {
|
|
62
|
+
o.current = null, C(e, n);
|
|
63
|
+
}, K);
|
|
64
|
+
return () => clearTimeout(t);
|
|
65
|
+
}, [n, e, r]), d(() => {
|
|
66
|
+
if (r)
|
|
67
|
+
return () => {
|
|
68
|
+
const t = o.current;
|
|
69
|
+
o.current = null, t && t.room === e && C(t.room, t.body);
|
|
49
70
|
};
|
|
50
|
-
|
|
51
|
-
});
|
|
52
|
-
}, U);
|
|
53
|
-
return () => clearTimeout(n);
|
|
54
|
-
}, [e, t, r]);
|
|
71
|
+
}, [e, r]);
|
|
55
72
|
}
|
|
56
73
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
74
|
+
x as useDraftRooms,
|
|
75
|
+
B as useDraftSync
|
|
59
76
|
};
|
|
@@ -249,6 +249,9 @@ function $(s) {
|
|
|
249
249
|
setContexts: (e, t) => a(c(`/help-videos/${e}/contexts`, { contexts: t })),
|
|
250
250
|
setRequirements: (e, t) => a(c(`/help-videos/${e}/requirements`, { role_ids: t })),
|
|
251
251
|
archive: (e) => a(p(`/help-videos/${e}`)),
|
|
252
|
+
/** Back to draft: viewers stop seeing it; the published version is kept, so `publish` puts the
|
|
253
|
+
* same cut back with no new render. 409 HELP_VIDEO_NOT_PUBLISHED unless it is published. */
|
|
254
|
+
unpublish: (e) => a(i(`/help-videos/${e}/unpublish`, {})).then((t) => t.data),
|
|
252
255
|
/** Deletes the video, its versions, files, views and requirements for good. Administrators
|
|
253
256
|
* only (403 ADMIN_ONLY otherwise); 404 when it is already gone. */
|
|
254
257
|
purge: (e) => a(p(`/help-videos/${e}?purge=1`)),
|