@nivaro/react 0.3.51 → 0.3.53
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 +47 -3
- package/dist/shared/components/ItemEditForm.js +3885 -3847
- package/dist/shared/components/NotificationBell.js +163 -150
- package/dist/shared/components/PageRenderer.js +600 -549
- package/dist/shared/components/ProfileView.js +36 -34
- package/dist/shared/components/QueryStatStrip.js +96 -89
- package/dist/shared/components/QueryTable.js +214 -215
- package/dist/shared/components/ReportView.js +548 -529
- package/dist/shared/components/alerts/AlertManagerView.js +346 -320
- package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
- package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
- package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
- package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
- package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
- package/dist/shared/components/item-edit/PlanGrid.js +718 -705
- package/dist/shared/components/item-edit/SummaryPanel.js +351 -337
- package/dist/shared/components/item-edit/line-qty.js +115 -53
- package/dist/shared/components/item-edit/save-refusal.js +18 -18
- package/dist/shared/components/item-edit/usePersonalDefaults.js +210 -207
- package/dist/shared/components/panels/CommentPanel.js +204 -197
- package/dist/shared/components/panels/ItemLockBanner.js +318 -291
- package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
- package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
- package/dist/shared/components/panels/RevisionsPanel.js +101 -106
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
- package/dist/shared/components/panels/requirement-side-effects.js +46 -29
- package/dist/shared/components/queue/QueueItemSheet.js +219 -146
- package/dist/shared/components/queue/QueueWorklist.js +738 -730
- package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
- package/dist/shared/lib/activity-sentence.js +236 -227
- package/dist/shared/lib/record-ref.js +43 -34
- package/package.json +1 -1
|
@@ -1,38 +1,50 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as o, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { readUnreadNotificationCount as ye, markNotificationRead as Ne, markNotificationsRead as Ce, markAllNotificationsRead as $e } from "@nivaro/sdk";
|
|
3
|
-
import { useQueryClient as
|
|
4
|
-
import { Bell as
|
|
5
|
-
import { useState as
|
|
6
|
-
import { createPortal as
|
|
7
|
-
import { useNivaroClient as
|
|
3
|
+
import { useQueryClient as _e, useQuery as ne, useMutation as E } from "@tanstack/react-query";
|
|
4
|
+
import { Bell as Se, CheckCheck as qe, ExternalLink as re, Check as z, History as Ee, ShieldCheck as Ae, ChevronDown as Le } from "lucide-react";
|
|
5
|
+
import { useState as $, useRef as oe, useEffect as O, useMemo as le, Fragment as ie } from "react";
|
|
6
|
+
import { createPortal as Re } from "react-dom";
|
|
7
|
+
import { useNivaroClient as Fe } from "../context.js";
|
|
8
8
|
import { get as Me, post as Ie } from "../lib/commands.js";
|
|
9
9
|
import { useLiveRefetchInterval as De } from "../lib/live-queries.js";
|
|
10
|
-
import { resolveNotificationTargetFor as
|
|
10
|
+
import { resolveNotificationTargetFor as A, runNotificationTarget as L } from "../lib/notification-target.js";
|
|
11
11
|
import { useTabAttention as Te } from "../lib/tab-attention.js";
|
|
12
12
|
import { formatRelative as se } from "../lib/utils.js";
|
|
13
13
|
import { AsItWasSheet as Ke } from "./notifications/AsItWasSheet.js";
|
|
14
14
|
import { bundleLocally as Be, laneTone as je, bundleAsNotification as ze, bundleHeadline as Oe, categoryChipLabel as Pe } from "./notifications/bundles.js";
|
|
15
15
|
import { DeliveryChips as Qe } from "./notifications/DeliveryChips.js";
|
|
16
16
|
import { NotificationActions as He } from "./notifications/NotificationActions.js";
|
|
17
|
-
import { NotificationDetailBits as
|
|
18
|
-
function
|
|
19
|
-
var
|
|
20
|
-
|
|
17
|
+
import { NotificationDetailBits as Ge } from "./notifications/NotificationDetailBits.js";
|
|
18
|
+
function Ue(n) {
|
|
19
|
+
var u, h;
|
|
20
|
+
if (!n) return null;
|
|
21
|
+
if (n.target_label && n.kind !== "record") return n.target_label;
|
|
22
|
+
if (String(n.collection ?? "") === "__chat__") return "Chat";
|
|
23
|
+
if (!n.collection) return null;
|
|
24
|
+
const d = ((u = n.record_collection_label) == null ? void 0 : u.trim()) || (() => {
|
|
25
|
+
const f = String(n.collection).replace(/_/g, " ").trim();
|
|
26
|
+
return f ? f.charAt(0).toUpperCase() + f.slice(1) : null;
|
|
27
|
+
})(), c = (h = n.record_label) == null ? void 0 : h.trim();
|
|
28
|
+
return d && c ? `${d} ${c}` : c || d || null;
|
|
21
29
|
}
|
|
22
|
-
function
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
const p = (($ = l.target) == null ? void 0 : $.collection) ?? l.collection, x = ((S = l.target) == null ? void 0 : S.id) ?? l.item;
|
|
26
|
-
return !!p && x != null && x !== "" && !/^(nivaro|directus)_|^__/i.test(p);
|
|
30
|
+
function Ye(n) {
|
|
31
|
+
var d, c;
|
|
32
|
+
return de(n) ? n.revision_id != null || (((c = (d = n.detail) == null ? void 0 : d.changes) == null ? void 0 : c.length) ?? 0) > 0 || n.category === "watch" || n.category === "workflow" : !1;
|
|
27
33
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
34
|
+
function de(n) {
|
|
35
|
+
var h, f, _;
|
|
36
|
+
if ((((h = n.target) == null ? void 0 : h.kind) ?? n.kind ?? (n.collection && n.item ? "record" : null)) !== "record") return !1;
|
|
37
|
+
const c = ((f = n.target) == null ? void 0 : f.collection) ?? n.collection, u = ((_ = n.target) == null ? void 0 : _.id) ?? n.item;
|
|
38
|
+
return !!c && u != null && u !== "" && !/^(nivaro|directus)_|^__/i.test(c);
|
|
39
|
+
}
|
|
40
|
+
function mt({
|
|
41
|
+
routes: n,
|
|
30
42
|
onNavigate: d,
|
|
31
|
-
app:
|
|
32
|
-
subscribe:
|
|
33
|
-
buttonClassName:
|
|
34
|
-
panelClassName:
|
|
35
|
-
beforeList:
|
|
43
|
+
app: c,
|
|
44
|
+
subscribe: u,
|
|
45
|
+
buttonClassName: h,
|
|
46
|
+
panelClassName: f,
|
|
47
|
+
beforeList: _,
|
|
36
48
|
extraBadge: P = 0,
|
|
37
49
|
mailLogUrl: ce,
|
|
38
50
|
renderTrigger: Q,
|
|
@@ -40,46 +52,46 @@ function ut({
|
|
|
40
52
|
subscriptionsPath: ue,
|
|
41
53
|
rulesPath: me,
|
|
42
54
|
onActionError: pe,
|
|
43
|
-
panelPlacement:
|
|
55
|
+
panelPlacement: y = "below",
|
|
44
56
|
tabBadge: xe = !0
|
|
45
57
|
}) {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
}, he = De(6e4, { enabled: !!
|
|
58
|
+
const k = Fe(), [b, m] = $(!1), [g, G] = $("attention"), R = oe(null), U = oe(null), [F, fe] = $(null), Y = _e(), N = () => {
|
|
59
|
+
Y.invalidateQueries({ queryKey: ["notification-count"] }), Y.invalidateQueries({ queryKey: ["notifications"] });
|
|
60
|
+
}, he = De(6e4, { enabled: !!u, safetyMs: 12e4 }), { data: p } = ne({
|
|
49
61
|
queryKey: ["notification-count"],
|
|
50
|
-
queryFn: () =>
|
|
62
|
+
queryFn: () => k.request(ye()),
|
|
51
63
|
refetchInterval: he
|
|
52
|
-
}), M = (
|
|
64
|
+
}), M = (p == null ? void 0 : p.unread) ?? 0, I = (p == null ? void 0 : p.attention) ?? M, S = (p == null ? void 0 : p.lanes) ?? { critical: 0, fyi: 0 }, w = M + P;
|
|
53
65
|
Te(I + P, { enabled: xe });
|
|
54
|
-
const { data:
|
|
55
|
-
queryKey: ["notifications", "bell",
|
|
56
|
-
queryFn: () =>
|
|
66
|
+
const { data: x } = ne({
|
|
67
|
+
queryKey: ["notifications", "bell", c ?? null, g],
|
|
68
|
+
queryFn: () => k.request(
|
|
57
69
|
Me("/notifications", {
|
|
58
70
|
limit: 60,
|
|
59
|
-
app:
|
|
71
|
+
app: c,
|
|
60
72
|
bundle: "record",
|
|
61
|
-
...
|
|
62
|
-
...
|
|
73
|
+
...g === "attention" ? { lane: "attention", status: "inbox" } : {},
|
|
74
|
+
...g === "fyi" ? { lane: "fyi", status: "inbox" } : {}
|
|
63
75
|
})
|
|
64
76
|
).then((e) => {
|
|
65
|
-
const t = e.pinned ?? [],
|
|
77
|
+
const t = e.pinned ?? [], l = new Set(t.map((r) => r.id)), s = (e.data ?? []).filter((r) => !l.has(r.id));
|
|
66
78
|
return e.bundles ? { rows: s, bundles: e.bundles, pinned: t } : { ...Be(s), pinned: t };
|
|
67
79
|
}),
|
|
68
|
-
enabled:
|
|
69
|
-
}), V = (
|
|
70
|
-
O(() =>
|
|
71
|
-
if (!
|
|
80
|
+
enabled: b
|
|
81
|
+
}), V = (x == null ? void 0 : x.rows) ?? [], D = (x == null ? void 0 : x.pinned) ?? [], W = (x == null ? void 0 : x.bundles) ?? [], [be, J] = $(() => /* @__PURE__ */ new Set()), [v, T] = $(null);
|
|
82
|
+
O(() => u == null ? void 0 : u(N), [u]), O(() => {
|
|
83
|
+
if (!b) return;
|
|
72
84
|
const e = (t) => {
|
|
73
|
-
var s,
|
|
74
|
-
const
|
|
75
|
-
(s =
|
|
85
|
+
var s, r;
|
|
86
|
+
const l = t.target;
|
|
87
|
+
(s = R.current) != null && s.contains(l) || (r = U.current) != null && r.contains(l) || m(!1);
|
|
76
88
|
};
|
|
77
89
|
return window.addEventListener("mousedown", e), () => window.removeEventListener("mousedown", e);
|
|
78
|
-
}, [
|
|
79
|
-
if (!
|
|
90
|
+
}, [b]), O(() => {
|
|
91
|
+
if (!b || y !== "right") return;
|
|
80
92
|
const e = () => {
|
|
81
|
-
var
|
|
82
|
-
const t = (
|
|
93
|
+
var l;
|
|
94
|
+
const t = (l = R.current) == null ? void 0 : l.getBoundingClientRect();
|
|
83
95
|
t && fe({
|
|
84
96
|
left: Math.round(t.right + 12),
|
|
85
97
|
bottom: Math.max(8, Math.round(window.innerHeight - t.bottom))
|
|
@@ -88,47 +100,47 @@ function ut({
|
|
|
88
100
|
return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
89
101
|
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
90
102
|
};
|
|
91
|
-
}, [
|
|
103
|
+
}, [b, y]);
|
|
92
104
|
const X = E({
|
|
93
|
-
mutationFn: (e) =>
|
|
94
|
-
onSuccess:
|
|
105
|
+
mutationFn: (e) => k.request(Ie(`/notifications/${e}/acknowledge`)),
|
|
106
|
+
onSuccess: N
|
|
95
107
|
}), K = E({
|
|
96
|
-
mutationFn: (e) =>
|
|
97
|
-
onSuccess:
|
|
108
|
+
mutationFn: (e) => k.request(Ne(e)),
|
|
109
|
+
onSuccess: N
|
|
98
110
|
}), B = E({
|
|
99
|
-
mutationFn: (e) =>
|
|
100
|
-
onSuccess:
|
|
101
|
-
}),
|
|
102
|
-
mutationFn: () =>
|
|
103
|
-
onSuccess:
|
|
111
|
+
mutationFn: (e) => k.request(Ce(e)),
|
|
112
|
+
onSuccess: N
|
|
113
|
+
}), ge = E({
|
|
114
|
+
mutationFn: () => k.request($e()),
|
|
115
|
+
onSuccess: N
|
|
104
116
|
}), Z = le(() => V.slice(0, 40), [V]), ee = le(() => {
|
|
105
117
|
const e = /* @__PURE__ */ new Map();
|
|
106
118
|
for (const t of Z) {
|
|
107
|
-
const
|
|
108
|
-
key:
|
|
119
|
+
const l = t.collection && t.item ? `${t.collection}:${t.item}` : `single:${t.id}`, s = e.get(l) ?? {
|
|
120
|
+
key: l,
|
|
109
121
|
collection: t.collection ?? null,
|
|
110
122
|
item: t.item ?? null,
|
|
111
123
|
rows: []
|
|
112
124
|
};
|
|
113
|
-
s.rows.push(t), e.set(
|
|
125
|
+
s.rows.push(t), e.set(l, s);
|
|
114
126
|
}
|
|
115
127
|
return [...e.values()];
|
|
116
|
-
}, [Z]),
|
|
117
|
-
const t =
|
|
118
|
-
t && (
|
|
128
|
+
}, [Z]), ke = (e) => {
|
|
129
|
+
const t = A(e, n);
|
|
130
|
+
t && (m(!1), L(t, d));
|
|
119
131
|
}, te = (e) => {
|
|
120
|
-
|
|
121
|
-
}, j = (e, t,
|
|
132
|
+
m(!1), d(e);
|
|
133
|
+
}, j = (e, t, l = !1) => {
|
|
122
134
|
var s;
|
|
123
|
-
return /* @__PURE__ */
|
|
124
|
-
/* @__PURE__ */
|
|
135
|
+
return /* @__PURE__ */ o(ie, { children: [
|
|
136
|
+
/* @__PURE__ */ o(
|
|
125
137
|
"button",
|
|
126
138
|
{
|
|
127
139
|
type: "button",
|
|
128
140
|
onClick: () => {
|
|
129
|
-
e.read || K.mutate(e.id),
|
|
141
|
+
e.read || K.mutate(e.id), ke(e);
|
|
130
142
|
},
|
|
131
|
-
className: `flex w-full items-start gap-2.5 py-2 pr-3 text-left transition-colors ${
|
|
143
|
+
className: `flex w-full items-start gap-2.5 py-2 pr-3 text-left transition-colors ${l ? "pl-7" : "pl-3"} ${t ? "hover:bg-slate-50 dark:hover:bg-muted" : "cursor-default"}`,
|
|
132
144
|
"data-notification-row": e.id,
|
|
133
145
|
children: [
|
|
134
146
|
/* @__PURE__ */ a(
|
|
@@ -137,8 +149,8 @@ function ut({
|
|
|
137
149
|
className: `mt-1.5 h-2 w-2 shrink-0 rounded-full ${e.read ? "bg-transparent" : e.lane === "critical" ? "bg-red-500" : "bg-nvr-cyan"}`
|
|
138
150
|
}
|
|
139
151
|
),
|
|
140
|
-
/* @__PURE__ */
|
|
141
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ o("span", { className: "min-w-0 flex-1", children: [
|
|
153
|
+
/* @__PURE__ */ o(
|
|
142
154
|
"span",
|
|
143
155
|
{
|
|
144
156
|
className: `block truncate text-[12.5px] ${e.read ? "font-normal text-slate-600 dark:text-slate-400" : "font-medium text-slate-900 dark:text-slate-100"}`,
|
|
@@ -149,7 +161,7 @@ function ut({
|
|
|
149
161
|
}
|
|
150
162
|
),
|
|
151
163
|
e.message && /* @__PURE__ */ a("span", { className: "mt-0.5 line-clamp-2 text-[11px] leading-snug text-slate-500", children: e.message.replace(/<[^>]+>/g, "") }),
|
|
152
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ o("span", { className: "mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[10.5px] text-slate-400", children: [
|
|
153
165
|
se(e.created_at),
|
|
154
166
|
/* @__PURE__ */ a(
|
|
155
167
|
Qe,
|
|
@@ -160,18 +172,18 @@ function ut({
|
|
|
160
172
|
}
|
|
161
173
|
),
|
|
162
174
|
de(e) && // biome-ignore lint/a11y/useSemanticElements: nested inside the row's <button> — a real <button> is invalid there
|
|
163
|
-
/* @__PURE__ */
|
|
175
|
+
/* @__PURE__ */ o(
|
|
164
176
|
"span",
|
|
165
177
|
{
|
|
166
178
|
role: "button",
|
|
167
179
|
tabIndex: -1,
|
|
168
180
|
"data-notification-as-it-was": e.id,
|
|
169
181
|
"data-tip": "The record as it was when you were told",
|
|
170
|
-
onClick: (
|
|
171
|
-
|
|
182
|
+
onClick: (r) => {
|
|
183
|
+
r.stopPropagation(), m(!1), T(e);
|
|
172
184
|
},
|
|
173
|
-
onKeyDown: (
|
|
174
|
-
(
|
|
185
|
+
onKeyDown: (r) => {
|
|
186
|
+
(r.key === "Enter" || r.key === " ") && (r.preventDefault(), r.stopPropagation(), m(!1), T(e));
|
|
175
187
|
},
|
|
176
188
|
className: "inline-flex items-center gap-0.5 rounded px-1 text-[10.5px] text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
|
|
177
189
|
children: [
|
|
@@ -189,11 +201,11 @@ function ut({
|
|
|
189
201
|
role: "button",
|
|
190
202
|
tabIndex: -1,
|
|
191
203
|
title: "Mark read",
|
|
192
|
-
onClick: (
|
|
193
|
-
|
|
204
|
+
onClick: (r) => {
|
|
205
|
+
r.stopPropagation(), K.mutate(e.id);
|
|
194
206
|
},
|
|
195
|
-
onKeyDown: (
|
|
196
|
-
(
|
|
207
|
+
onKeyDown: (r) => {
|
|
208
|
+
(r.key === "Enter" || r.key === " ") && (r.preventDefault(), r.stopPropagation(), K.mutate(e.id));
|
|
197
209
|
},
|
|
198
210
|
className: "mt-0.5 rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
|
|
199
211
|
children: /* @__PURE__ */ a(z, { className: "h-3 w-3" })
|
|
@@ -202,7 +214,7 @@ function ut({
|
|
|
202
214
|
]
|
|
203
215
|
}
|
|
204
216
|
),
|
|
205
|
-
((s = e.ack) == null ? void 0 : s.required) && !e.ack.at && /* @__PURE__ */ a("div", { className: `pb-2 pr-3 ${
|
|
217
|
+
((s = e.ack) == null ? void 0 : s.required) && !e.ack.at && /* @__PURE__ */ a("div", { className: `pb-2 pr-3 ${l ? "pl-[46px]" : "pl-[30px]"}`, children: /* @__PURE__ */ o(
|
|
206
218
|
"button",
|
|
207
219
|
{
|
|
208
220
|
type: "button",
|
|
@@ -211,7 +223,7 @@ function ut({
|
|
|
211
223
|
"data-notification-acknowledge": e.id,
|
|
212
224
|
className: "inline-flex items-center gap-1 rounded-md bg-nvr-cyan px-2 py-1 text-[11px] font-medium text-white hover:opacity-90 disabled:opacity-50",
|
|
213
225
|
children: [
|
|
214
|
-
/* @__PURE__ */ a(
|
|
226
|
+
/* @__PURE__ */ a(Ae, { className: "h-3 w-3" }),
|
|
215
227
|
"Acknowledge"
|
|
216
228
|
]
|
|
217
229
|
}
|
|
@@ -222,27 +234,27 @@ function ut({
|
|
|
222
234
|
actions: e.actions,
|
|
223
235
|
notificationId: e.id,
|
|
224
236
|
onError: pe,
|
|
225
|
-
className: `pb-2 pr-3 ${
|
|
237
|
+
className: `pb-2 pr-3 ${l ? "pl-[46px]" : "pl-[30px]"}`
|
|
226
238
|
}
|
|
227
239
|
),
|
|
228
240
|
/* @__PURE__ */ a(
|
|
229
|
-
|
|
241
|
+
Ge,
|
|
230
242
|
{
|
|
231
243
|
detail: e.detail,
|
|
232
244
|
why: e.why,
|
|
233
245
|
delivery: e.delivery,
|
|
234
246
|
notificationId: e.id,
|
|
235
|
-
recordChanges:
|
|
247
|
+
recordChanges: Ye(e),
|
|
236
248
|
subscriptionsPath: ue,
|
|
237
249
|
rulesPath: me,
|
|
238
250
|
onNavigate: te,
|
|
239
|
-
className: `-mt-1 pb-2 pr-3 ${
|
|
251
|
+
className: `-mt-1 pb-2 pr-3 ${l ? "pl-[46px]" : "pl-[30px]"}`
|
|
240
252
|
}
|
|
241
253
|
)
|
|
242
254
|
] }, e.id);
|
|
243
|
-
},
|
|
244
|
-
const t = `${e.collection}:${e.item}`,
|
|
245
|
-
return /* @__PURE__ */
|
|
255
|
+
}, we = (e) => {
|
|
256
|
+
const t = `${e.collection}:${e.item}`, l = be.has(t), s = je(e.lane), r = e.deleted ? null : A(ze(e), n), C = e.rows.filter((i) => !i.read).map((i) => i.id);
|
|
257
|
+
return /* @__PURE__ */ o(
|
|
246
258
|
"div",
|
|
247
259
|
{
|
|
248
260
|
className: "border-b border-slate-50 last:border-b-0 dark:border-border/50",
|
|
@@ -251,37 +263,37 @@ function ut({
|
|
|
251
263
|
"data-notification-bundle-count": e.count,
|
|
252
264
|
"data-notification-bundle-lane": e.lane,
|
|
253
265
|
children: [
|
|
254
|
-
/* @__PURE__ */
|
|
266
|
+
/* @__PURE__ */ o("div", { className: "flex items-start gap-2 px-3 py-2", children: [
|
|
255
267
|
/* @__PURE__ */ a(
|
|
256
268
|
"button",
|
|
257
269
|
{
|
|
258
270
|
type: "button",
|
|
259
|
-
"aria-expanded":
|
|
260
|
-
"aria-label":
|
|
271
|
+
"aria-expanded": l,
|
|
272
|
+
"aria-label": l ? "Collapse" : "Expand",
|
|
261
273
|
"data-notification-bundle-expand": t,
|
|
262
274
|
onClick: () => J((i) => {
|
|
263
|
-
const
|
|
264
|
-
return
|
|
275
|
+
const q = new Set(i);
|
|
276
|
+
return q.has(t) ? q.delete(t) : q.add(t), q;
|
|
265
277
|
}),
|
|
266
278
|
className: "mt-0.5 rounded p-0.5 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
|
|
267
279
|
children: /* @__PURE__ */ a(
|
|
268
|
-
|
|
280
|
+
Le,
|
|
269
281
|
{
|
|
270
|
-
className: `h-3.5 w-3.5 transition-transform ${
|
|
282
|
+
className: `h-3.5 w-3.5 transition-transform ${l ? "" : "-rotate-90"}`
|
|
271
283
|
}
|
|
272
284
|
)
|
|
273
285
|
}
|
|
274
286
|
),
|
|
275
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ o(
|
|
276
288
|
"button",
|
|
277
289
|
{
|
|
278
290
|
type: "button",
|
|
279
291
|
onClick: () => {
|
|
280
|
-
|
|
292
|
+
r ? (m(!1), L(r, d)) : J((i) => new Set(i).add(t));
|
|
281
293
|
},
|
|
282
294
|
className: "min-w-0 flex-1 text-left",
|
|
283
295
|
children: [
|
|
284
|
-
/* @__PURE__ */
|
|
296
|
+
/* @__PURE__ */ o("span", { className: "flex items-center gap-1.5", children: [
|
|
285
297
|
/* @__PURE__ */ a(
|
|
286
298
|
"span",
|
|
287
299
|
{
|
|
@@ -296,7 +308,7 @@ function ut({
|
|
|
296
308
|
}
|
|
297
309
|
)
|
|
298
310
|
] }),
|
|
299
|
-
/* @__PURE__ */
|
|
311
|
+
/* @__PURE__ */ o("span", { className: "mt-1 flex flex-wrap items-center gap-1 pl-3.5 text-[10.5px] text-slate-400", children: [
|
|
300
312
|
e.lane === "critical" && e.unread > 0 && /* @__PURE__ */ a(
|
|
301
313
|
"span",
|
|
302
314
|
{
|
|
@@ -330,7 +342,7 @@ function ut({
|
|
|
330
342
|
i
|
|
331
343
|
)),
|
|
332
344
|
/* @__PURE__ */ a("span", { children: e.newest ? se(e.newest) : "" }),
|
|
333
|
-
e.unread > 0 && e.unread < e.count && /* @__PURE__ */
|
|
345
|
+
e.unread > 0 && e.unread < e.count && /* @__PURE__ */ o("span", { children: [
|
|
334
346
|
"· ",
|
|
335
347
|
e.unread,
|
|
336
348
|
" unread"
|
|
@@ -339,33 +351,33 @@ function ut({
|
|
|
339
351
|
]
|
|
340
352
|
}
|
|
341
353
|
),
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
|
|
354
|
+
/* @__PURE__ */ o("span", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
355
|
+
r && /* @__PURE__ */ a(
|
|
344
356
|
"button",
|
|
345
357
|
{
|
|
346
358
|
type: "button",
|
|
347
359
|
title: "Open record",
|
|
348
360
|
onClick: () => {
|
|
349
|
-
|
|
361
|
+
m(!1), L(r, d);
|
|
350
362
|
},
|
|
351
363
|
className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
|
|
352
364
|
children: /* @__PURE__ */ a(re, { className: "h-3 w-3" })
|
|
353
365
|
}
|
|
354
366
|
),
|
|
355
|
-
|
|
367
|
+
C.length > 0 && /* @__PURE__ */ a(
|
|
356
368
|
"button",
|
|
357
369
|
{
|
|
358
370
|
type: "button",
|
|
359
371
|
title: "Mark all read",
|
|
360
372
|
"data-notification-bundle-read": t,
|
|
361
|
-
onClick: () => B.mutate(
|
|
373
|
+
onClick: () => B.mutate(C),
|
|
362
374
|
className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
|
|
363
375
|
children: /* @__PURE__ */ a(z, { className: "h-3 w-3" })
|
|
364
376
|
}
|
|
365
377
|
)
|
|
366
378
|
] })
|
|
367
379
|
] }),
|
|
368
|
-
|
|
380
|
+
l && /* @__PURE__ */ a(
|
|
369
381
|
"div",
|
|
370
382
|
{
|
|
371
383
|
className: "border-t border-slate-50 bg-slate-50/50 dark:border-border/50 dark:bg-muted/30",
|
|
@@ -377,56 +389,56 @@ function ut({
|
|
|
377
389
|
},
|
|
378
390
|
`bundle:${t}`
|
|
379
391
|
);
|
|
380
|
-
},
|
|
392
|
+
}, ve = [
|
|
381
393
|
{ key: "attention", label: "Needs you", count: I },
|
|
382
|
-
{ key: "fyi", label: "FYI", count:
|
|
394
|
+
{ key: "fyi", label: "FYI", count: S.fyi },
|
|
383
395
|
{ key: "all", label: "All", count: null }
|
|
384
|
-
], ae = () =>
|
|
385
|
-
return /* @__PURE__ */
|
|
386
|
-
Q ? Q({ open:
|
|
396
|
+
], ae = () => m((e) => (!e && g === "attention" && I === 0 && S.fyi > 0 && G("fyi"), !e));
|
|
397
|
+
return /* @__PURE__ */ o("div", { ref: R, className: "relative", "data-nvr-notification-bell": !0, children: [
|
|
398
|
+
Q ? Q({ open: b, badge: w, toggle: ae }) : /* @__PURE__ */ o(
|
|
387
399
|
"button",
|
|
388
400
|
{
|
|
389
401
|
type: "button",
|
|
390
402
|
onClick: ae,
|
|
391
|
-
className:
|
|
392
|
-
"aria-label":
|
|
403
|
+
className: h ?? "relative rounded-md p-1.5 text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-muted",
|
|
404
|
+
"aria-label": w ? `Notifications (${w} unread)` : "Notifications",
|
|
393
405
|
children: [
|
|
394
|
-
/* @__PURE__ */ a(
|
|
395
|
-
|
|
406
|
+
/* @__PURE__ */ a(Se, { className: "h-4 w-4", strokeWidth: 1.8 }),
|
|
407
|
+
w > 0 && /* @__PURE__ */ a(
|
|
396
408
|
"span",
|
|
397
409
|
{
|
|
398
410
|
"data-nvr-recording-hide": !0,
|
|
399
|
-
className: `absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[9.5px] font-bold ${
|
|
400
|
-
children:
|
|
411
|
+
className: `absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[9.5px] font-bold ${S.critical > 0 ? "bg-red-500 text-white" : "bg-nvr-cyan text-nvr-navy"}`,
|
|
412
|
+
children: w > 99 ? "99+" : w
|
|
401
413
|
}
|
|
402
414
|
)
|
|
403
415
|
]
|
|
404
416
|
}
|
|
405
417
|
),
|
|
406
|
-
|
|
407
|
-
/* @__PURE__ */
|
|
418
|
+
b && (y === "right" ? Re : (e) => e)(
|
|
419
|
+
/* @__PURE__ */ o(
|
|
408
420
|
"div",
|
|
409
421
|
{
|
|
410
|
-
ref:
|
|
411
|
-
className: `${
|
|
412
|
-
style:
|
|
422
|
+
ref: U,
|
|
423
|
+
className: `${y === "right" ? "fixed z-[110]" : "absolute right-0 top-10 z-40"} w-[360px] overflow-hidden rounded-xl border border-slate-200 bg-white shadow-xl dark:border-border dark:bg-card ${f ?? ""}`,
|
|
424
|
+
style: y === "right" && F ? { left: F.left, bottom: F.bottom } : void 0,
|
|
413
425
|
"data-nvr-notification-panel": !0,
|
|
414
426
|
children: [
|
|
415
|
-
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */ a("div", { className: "flex items-center gap-1 rounded-md bg-slate-100 p-0.5 dark:bg-muted", children:
|
|
427
|
+
_,
|
|
428
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between border-b border-slate-100 px-3 py-2 dark:border-border/60", children: [
|
|
429
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-1 rounded-md bg-slate-100 p-0.5 dark:bg-muted", children: ve.map((e) => /* @__PURE__ */ o(
|
|
418
430
|
"button",
|
|
419
431
|
{
|
|
420
432
|
type: "button",
|
|
421
|
-
onClick: () =>
|
|
433
|
+
onClick: () => G(e.key),
|
|
422
434
|
"data-nvr-lane-tab": e.key,
|
|
423
|
-
className:
|
|
435
|
+
className: g === e.key ? "rounded bg-white px-2 py-0.5 text-[11px] font-medium text-slate-900 shadow-sm dark:bg-card dark:text-slate-100" : "rounded px-2 py-0.5 text-[11px] font-medium text-slate-500 hover:text-slate-700 dark:text-slate-400",
|
|
424
436
|
children: [
|
|
425
437
|
e.label,
|
|
426
438
|
e.count != null && e.count > 0 && /* @__PURE__ */ a(
|
|
427
439
|
"span",
|
|
428
440
|
{
|
|
429
|
-
className: `ml-1 rounded-full px-1 text-[9.5px] font-bold ${e.key === "attention" &&
|
|
441
|
+
className: `ml-1 rounded-full px-1 text-[9.5px] font-bold ${e.key === "attention" && S.critical > 0 ? "bg-red-500/15 text-red-600 dark:text-red-400" : "bg-slate-200 text-slate-600 dark:bg-slate-700 dark:text-slate-300"}`,
|
|
430
442
|
children: e.count
|
|
431
443
|
}
|
|
432
444
|
)
|
|
@@ -434,46 +446,46 @@ function ut({
|
|
|
434
446
|
},
|
|
435
447
|
e.key
|
|
436
448
|
)) }),
|
|
437
|
-
M > 0 && /* @__PURE__ */
|
|
449
|
+
M > 0 && /* @__PURE__ */ o(
|
|
438
450
|
"button",
|
|
439
451
|
{
|
|
440
452
|
type: "button",
|
|
441
|
-
onClick: () =>
|
|
453
|
+
onClick: () => ge.mutate(),
|
|
442
454
|
className: "inline-flex items-center gap-1 text-[11px] font-medium text-slate-400 transition-colors hover:text-nvr-cyan",
|
|
443
455
|
children: [
|
|
444
|
-
/* @__PURE__ */ a(
|
|
456
|
+
/* @__PURE__ */ a(qe, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
|
|
445
457
|
"Mark all read"
|
|
446
458
|
]
|
|
447
459
|
}
|
|
448
460
|
)
|
|
449
461
|
] }),
|
|
450
|
-
/* @__PURE__ */
|
|
451
|
-
D.length > 0 && /* @__PURE__ */
|
|
462
|
+
/* @__PURE__ */ o("div", { className: "max-h-96 overflow-y-auto", children: [
|
|
463
|
+
D.length > 0 && /* @__PURE__ */ o("div", { "data-notification-pinned": !0, children: [
|
|
452
464
|
/* @__PURE__ */ a("div", { className: "bg-amber-50 px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-amber-700 dark:bg-amber-400/10 dark:text-amber-300", children: "Needs your acknowledgement" }),
|
|
453
|
-
D.map((e) => /* @__PURE__ */ a(ie, { children: j(e, !!
|
|
465
|
+
D.map((e) => /* @__PURE__ */ a(ie, { children: j(e, !!A(e, n)) }, e.id))
|
|
454
466
|
] }),
|
|
455
|
-
ee.length === 0 && W.length === 0 && D.length === 0 ? /* @__PURE__ */ a("p", { className: "px-3 py-6 text-center text-[12px] text-slate-400", children:
|
|
456
|
-
...W.map(
|
|
467
|
+
ee.length === 0 && W.length === 0 && D.length === 0 ? /* @__PURE__ */ a("p", { className: "px-3 py-6 text-center text-[12px] text-slate-400", children: g === "attention" ? "Nothing needs you right now." : g === "fyi" ? "No FYI notifications." : "No notifications" }) : [
|
|
468
|
+
...W.map(we),
|
|
457
469
|
...ee.map((e) => {
|
|
458
|
-
const t = e.rows.filter((i) => !i.read).map((i) => i.id),
|
|
459
|
-
return /* @__PURE__ */
|
|
470
|
+
const t = e.rows.filter((i) => !i.read).map((i) => i.id), l = A(e.rows[0], n), s = !!l, r = e.rows.find((i) => i.record_label) ?? e.rows[0], C = Ue(r);
|
|
471
|
+
return /* @__PURE__ */ o(
|
|
460
472
|
"div",
|
|
461
473
|
{
|
|
462
474
|
className: "border-b border-slate-50 last:border-b-0 dark:border-border/50",
|
|
463
475
|
children: [
|
|
464
|
-
s &&
|
|
465
|
-
/* @__PURE__ */
|
|
466
|
-
|
|
476
|
+
s && C && /* @__PURE__ */ o("div", { className: "flex items-center gap-1.5 px-3 pt-2", children: [
|
|
477
|
+
/* @__PURE__ */ o("span", { className: "truncate text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: [
|
|
478
|
+
C,
|
|
467
479
|
e.rows.length > 1 ? ` · ${e.rows.length}` : ""
|
|
468
480
|
] }),
|
|
469
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ o("span", { className: "ml-auto flex items-center gap-0.5", children: [
|
|
470
482
|
/* @__PURE__ */ a(
|
|
471
483
|
"button",
|
|
472
484
|
{
|
|
473
485
|
type: "button",
|
|
474
486
|
title: "Open record",
|
|
475
487
|
onClick: () => {
|
|
476
|
-
t.length && B.mutate(t),
|
|
488
|
+
t.length && B.mutate(t), m(!1), L(l, d);
|
|
477
489
|
},
|
|
478
490
|
className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
|
|
479
491
|
children: /* @__PURE__ */ a(re, { className: "h-3 w-3" })
|
|
@@ -504,7 +516,7 @@ function ut({
|
|
|
504
516
|
{
|
|
505
517
|
type: "button",
|
|
506
518
|
onClick: () => {
|
|
507
|
-
|
|
519
|
+
m(!1), d(H);
|
|
508
520
|
},
|
|
509
521
|
className: "block w-full border-t border-slate-100 px-3 py-1.5 text-center text-[11px] font-medium text-slate-500 hover:text-nvr-cyan dark:border-border/60",
|
|
510
522
|
children: "See all notifications"
|
|
@@ -518,15 +530,16 @@ function ut({
|
|
|
518
530
|
/* @__PURE__ */ a(
|
|
519
531
|
Ke,
|
|
520
532
|
{
|
|
521
|
-
notificationId: (
|
|
522
|
-
title: (
|
|
533
|
+
notificationId: (v == null ? void 0 : v.id) ?? null,
|
|
534
|
+
title: (v == null ? void 0 : v.title) ?? null,
|
|
523
535
|
onClose: () => T(null)
|
|
524
536
|
}
|
|
525
537
|
)
|
|
526
538
|
] });
|
|
527
539
|
}
|
|
528
540
|
export {
|
|
529
|
-
|
|
541
|
+
mt as NotificationBell,
|
|
542
|
+
Ue as bellGroupLabel,
|
|
530
543
|
de as hasSnapshotView,
|
|
531
|
-
|
|
544
|
+
Ye as offersChanges
|
|
532
545
|
};
|