@nivaro/react 0.3.6 → 0.3.8
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 +16 -3
- package/dist/shared/components/ForceReloadBanner.js +31 -26
- package/dist/shared/components/RecordDrilldownSheet.js +79 -63
- package/dist/shared/components/StaleBuildChip.js +37 -0
- package/dist/shared/components/chat/ChatPanel.js +237 -233
- package/dist/shared/components/chat/chat-core.js +55 -48
- package/dist/shared/components/delegation/DelegationConsoleView.js +294 -167
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +143 -124
- package/dist/shared/components/notifications/NotificationSubscriptionsView.js +35 -9
- package/dist/shared/components/profile/PersonAdminTools.js +90 -88
- package/package.json +1 -1
|
@@ -5,11 +5,11 @@ import { toast as ee } from "sonner";
|
|
|
5
5
|
import { useNivaroClient as m } from "../../context.js";
|
|
6
6
|
import { get as g, patch as C, post as K, del as A } from "../../lib/commands.js";
|
|
7
7
|
import { isDndActive as te } from "../../lib/dnd.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
8
|
+
import { playNotificationSound as ne } from "../../lib/notification-sound.js";
|
|
9
|
+
import { announceLocalPrefs as se } from "../../lib/user-sync.js";
|
|
10
|
+
import { bindChatOutbox as re, enqueueChatOutbox as oe } from "./chat-outbox.js";
|
|
11
|
+
import { discardOutbox as Ct, editOutbox as Rt, holdOutbox as wt, nudgeChatOutbox as St, retryOutbox as Tt, useOutbox as $t } from "./chat-outbox.js";
|
|
12
|
+
import { huddleHolds as ae, holdNotification as ie } from "./huddle/huddle-hold.js";
|
|
13
13
|
const Me = ["👍", "✅", "👀", "🎉", "❤️", "😂"], ce = X(null);
|
|
14
14
|
function b() {
|
|
15
15
|
const e = Z(ce);
|
|
@@ -30,7 +30,7 @@ function B(e, t) {
|
|
|
30
30
|
const s = e.slice(3);
|
|
31
31
|
return [s.slice(0, 36), s.slice(37)].find((o) => o.toLowerCase() !== t.toLowerCase()) ?? null;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function F(e, t) {
|
|
34
34
|
const s = b(), n = v(), o = (t ?? []).join("|");
|
|
35
35
|
$(() => {
|
|
36
36
|
const r = () => {
|
|
@@ -63,7 +63,7 @@ function Le(e, t = null) {
|
|
|
63
63
|
staleTime: 5e3,
|
|
64
64
|
refetchInterval: s.realtime || s.subscribeRooms ? void 0 : 1e4
|
|
65
65
|
});
|
|
66
|
-
|
|
66
|
+
F([["nvr-chat"], ["nvr-chat-rooms"], ["nvr-chat-thread"]], e ? [e] : []);
|
|
67
67
|
const [i, c] = L([]), [f, u] = L(null), [l, d] = L(!1);
|
|
68
68
|
$(() => {
|
|
69
69
|
c([]), u(null);
|
|
@@ -72,7 +72,7 @@ function Le(e, t = null) {
|
|
|
72
72
|
if (i.length === 0) return q;
|
|
73
73
|
const _ = new Set(q.map((R) => R.id));
|
|
74
74
|
return [...i.filter((R) => !_.has(R.id)), ...q];
|
|
75
|
-
}, [i, q]),
|
|
75
|
+
}, [i, q]), O = M(async () => {
|
|
76
76
|
var R;
|
|
77
77
|
if (!e || l) return;
|
|
78
78
|
const _ = p[0];
|
|
@@ -94,7 +94,7 @@ function Le(e, t = null) {
|
|
|
94
94
|
hasOlder: f ?? !!((D = r == null ? void 0 : r.meta) != null && D.has_older),
|
|
95
95
|
hasNewer: !!((N = r == null ? void 0 : r.meta) != null && N.has_newer),
|
|
96
96
|
anchorId: ((E = r == null ? void 0 : r.meta) == null ? void 0 : E.anchor) ?? null,
|
|
97
|
-
loadOlder:
|
|
97
|
+
loadOlder: O,
|
|
98
98
|
loadingOlder: l
|
|
99
99
|
};
|
|
100
100
|
}
|
|
@@ -108,7 +108,7 @@ function Qe(e, t) {
|
|
|
108
108
|
staleTime: 5e3,
|
|
109
109
|
refetchInterval: s.realtime || s.subscribeRooms ? void 0 : 1e4
|
|
110
110
|
});
|
|
111
|
-
|
|
111
|
+
F([["nvr-chat-thread"]], e ? [e] : []);
|
|
112
112
|
const a = o ?? [];
|
|
113
113
|
return {
|
|
114
114
|
root: a.find((i) => i.id === t) ?? null,
|
|
@@ -119,11 +119,11 @@ function Qe(e, t) {
|
|
|
119
119
|
function Ue(e) {
|
|
120
120
|
var r, a, i;
|
|
121
121
|
const t = m(), s = v(), n = b();
|
|
122
|
-
return
|
|
122
|
+
return re(t, s, ((r = n.me) == null ? void 0 : r.id) ?? null), { mutate: M(
|
|
123
123
|
(c) => {
|
|
124
124
|
var u, l;
|
|
125
125
|
const f = typeof c == "string" ? { text: c } : c;
|
|
126
|
-
|
|
126
|
+
oe({
|
|
127
127
|
client_id: le(),
|
|
128
128
|
room: e,
|
|
129
129
|
text: f.text,
|
|
@@ -187,7 +187,7 @@ function Ae() {
|
|
|
187
187
|
refetchInterval: 45e3,
|
|
188
188
|
staleTime: 1e4
|
|
189
189
|
});
|
|
190
|
-
|
|
190
|
+
F([["nvr-chat-rooms"]]);
|
|
191
191
|
const o = k(
|
|
192
192
|
() => G(n.data ?? [], s == null ? void 0 : s.id, e),
|
|
193
193
|
[n.data, s == null ? void 0 : s.id, e]
|
|
@@ -358,7 +358,7 @@ function fe() {
|
|
|
358
358
|
onError: (s, n, o) => {
|
|
359
359
|
o != null && o.prev && t.setQueryData(["nvr-profile-prefs"], o.prev);
|
|
360
360
|
},
|
|
361
|
-
onSuccess: (s, n) =>
|
|
361
|
+
onSuccess: (s, n) => se(Object.keys(n)),
|
|
362
362
|
onSettled: () => {
|
|
363
363
|
t.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }), t.invalidateQueries({ queryKey: ["presence-online"] });
|
|
364
364
|
}
|
|
@@ -387,15 +387,15 @@ function Ve() {
|
|
|
387
387
|
function We(e, t) {
|
|
388
388
|
const s = b(), n = me(), o = x(), r = U(o);
|
|
389
389
|
r.current = o, $(() => {
|
|
390
|
-
const a = t ? t.filter((u) => z(u) && !H(u.room)).reduce((u, l) => u + l.unread, 0) : e, i = a > j, c =
|
|
391
|
-
if (s.sound && i && !f &&
|
|
390
|
+
const a = t ? t.filter((u) => z(u) && !H(u.room)).reduce((u, l) => u + l.unread, 0) : e, i = a > j, c = ae(r.current), f = te(r.current) || c;
|
|
391
|
+
if (s.sound && i && !f && ne(n), s.sound && i && c && ie({ kind: "chat", title: "New message" }), t) {
|
|
392
392
|
const u = Q.size > 0, l = w.size > 0;
|
|
393
393
|
for (const d of t) {
|
|
394
394
|
const q = Q.get(d.room) ?? 0;
|
|
395
395
|
if (u && !f && !d.muted && z(d) && d.unread > q && !H(d.room)) {
|
|
396
|
-
const p = d.lastMessage,
|
|
396
|
+
const p = d.lastMessage, O = p != null && p.sender_name ? String(p.sender_name).trim() : null;
|
|
397
397
|
ee(
|
|
398
|
-
d.kind === "dm" ? `New message from ${
|
|
398
|
+
d.kind === "dm" ? `New message from ${O || d.label}` : `New message in ${d.label}${O ? ` — ${O}` : ""}`,
|
|
399
399
|
{
|
|
400
400
|
description: p != null && p.message ? String(p.message).replace(/<[^>]*>/g, "").slice(0, 90) : void 0,
|
|
401
401
|
duration: 4e3,
|
|
@@ -534,7 +534,7 @@ function tt(e) {
|
|
|
534
534
|
refetchInterval: 3e4,
|
|
535
535
|
staleTime: 5e3
|
|
536
536
|
});
|
|
537
|
-
return
|
|
537
|
+
return F([["nvr-chat-peer-read"]], e ? [e] : []), r ?? null;
|
|
538
538
|
}
|
|
539
539
|
function nt(e) {
|
|
540
540
|
const t = m(), s = v();
|
|
@@ -599,7 +599,7 @@ function ct(e) {
|
|
|
599
599
|
enabled: !!e,
|
|
600
600
|
staleTime: 15e3
|
|
601
601
|
});
|
|
602
|
-
return
|
|
602
|
+
return F([["nvr-chat-pins"]], e ? [e] : []), s ?? [];
|
|
603
603
|
}
|
|
604
604
|
function ut(e) {
|
|
605
605
|
const t = m(), s = v();
|
|
@@ -630,40 +630,46 @@ function dt(e) {
|
|
|
630
630
|
return Number.isInteger(e) && e >= 0 && e < I.length ? I[e] : null;
|
|
631
631
|
}
|
|
632
632
|
function mt(e) {
|
|
633
|
+
return [...e].sort((t, s) => {
|
|
634
|
+
const n = (t.display_name ?? "").trim(), o = (s.display_name ?? "").trim();
|
|
635
|
+
return !n != !o ? n ? -1 : 1 : n.localeCompare(o, void 0, { sensitivity: "base" }) || String(t.user_id).localeCompare(String(s.user_id));
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
function ft(e) {
|
|
633
639
|
var s, n;
|
|
634
640
|
if (!e) return "?";
|
|
635
641
|
const t = e.trim().split(/\s+/);
|
|
636
642
|
return ((((s = t[0]) == null ? void 0 : s[0]) ?? "") + (((n = t[1]) == null ? void 0 : n[0]) ?? "")).toUpperCase() || "?";
|
|
637
643
|
}
|
|
638
|
-
let
|
|
639
|
-
function
|
|
640
|
-
return
|
|
641
|
-
|
|
644
|
+
let S = null;
|
|
645
|
+
function ht(e) {
|
|
646
|
+
return S = e, () => {
|
|
647
|
+
S === e && (S = null);
|
|
642
648
|
};
|
|
643
649
|
}
|
|
644
|
-
function
|
|
645
|
-
return
|
|
650
|
+
function yt() {
|
|
651
|
+
return S !== null;
|
|
646
652
|
}
|
|
647
|
-
function
|
|
648
|
-
|
|
653
|
+
function gt(e, t) {
|
|
654
|
+
S == null || S(e, t);
|
|
649
655
|
}
|
|
650
|
-
let
|
|
651
|
-
function
|
|
652
|
-
return
|
|
653
|
-
|
|
656
|
+
let T = null;
|
|
657
|
+
function pt(e) {
|
|
658
|
+
return T = e, () => {
|
|
659
|
+
T === e && (T = null);
|
|
654
660
|
};
|
|
655
661
|
}
|
|
656
662
|
function qe() {
|
|
657
|
-
return
|
|
663
|
+
return T !== null;
|
|
658
664
|
}
|
|
659
665
|
function W(e, t) {
|
|
660
|
-
|
|
666
|
+
T == null || T(e, t);
|
|
661
667
|
}
|
|
662
|
-
function
|
|
668
|
+
function vt(e = !0) {
|
|
663
669
|
const t = m(), { data: s } = y({ ...V(t), enabled: e });
|
|
664
670
|
return s;
|
|
665
671
|
}
|
|
666
|
-
async function
|
|
672
|
+
async function qt(e, t, s) {
|
|
667
673
|
var r;
|
|
668
674
|
const n = await e.request(
|
|
669
675
|
g("/chat/record-room", { collection: t, item: s })
|
|
@@ -679,25 +685,26 @@ export {
|
|
|
679
685
|
Ie as GENERAL_CHANNEL_ID,
|
|
680
686
|
Me as REACTION_EMOJI,
|
|
681
687
|
qe as canOpenChatRoom,
|
|
682
|
-
|
|
688
|
+
yt as canOpenDm,
|
|
683
689
|
lt as chatAvatarColor,
|
|
684
690
|
dt as chatAvatarColorAt,
|
|
685
691
|
ve as chatAvatarColorIndex,
|
|
686
|
-
|
|
692
|
+
ft as chatInitials,
|
|
687
693
|
V as chatRoomTypesQuery,
|
|
688
|
-
|
|
689
|
-
|
|
694
|
+
Ct as discardOutbox,
|
|
695
|
+
qt as discussRecord,
|
|
690
696
|
B as dmPeer,
|
|
691
697
|
xe as dmRoom,
|
|
692
|
-
|
|
698
|
+
Rt as editOutbox,
|
|
693
699
|
Xe as getMentionQuery,
|
|
694
|
-
|
|
695
|
-
|
|
700
|
+
wt as holdOutbox,
|
|
701
|
+
St as nudgeChatOutbox,
|
|
696
702
|
W as openChatRoom,
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
703
|
+
gt as openDmWith,
|
|
704
|
+
ht as registerDmOpener,
|
|
705
|
+
pt as registerRoomOpener,
|
|
700
706
|
Tt as retryOutbox,
|
|
707
|
+
mt as sortOnlineUsers,
|
|
701
708
|
Ze as splitMessageTokens,
|
|
702
709
|
De as useArchivedRooms,
|
|
703
710
|
je as useChannelAdmin,
|
|
@@ -720,10 +727,10 @@ export {
|
|
|
720
727
|
x as useMyPreferences,
|
|
721
728
|
me as useNotificationSoundPreference,
|
|
722
729
|
Ge as useOpenRoomRegistration,
|
|
723
|
-
|
|
730
|
+
$t as useOutbox,
|
|
724
731
|
tt as usePeerReadAt,
|
|
725
732
|
Ve as useRecordBrowserTimezone,
|
|
726
|
-
|
|
733
|
+
vt as useRecordRoomTypes,
|
|
727
734
|
Ee as useRoomMembership,
|
|
728
735
|
ct as useRoomPins,
|
|
729
736
|
Ue as useSendChatMessage,
|