@nivaro/react 0.3.98 → 0.3.100
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/useFormSchema.js +82 -85
- package/dist/hooks/useSessionRecorder.js +206 -175
- package/dist/index.d.ts +38 -13
- package/dist/index.js +182 -180
- package/dist/lib/commands.js +15 -11
- package/dist/shared/components/CollectionBrowserView.js +516 -503
- package/dist/shared/components/ItemEditForm.js +3021 -3019
- package/dist/shared/components/JobsTray.js +20 -16
- package/dist/shared/components/MyWorkView.js +133 -126
- package/dist/shared/components/NotificationBell.js +314 -288
- package/dist/shared/components/RecordCompare.js +38 -40
- package/dist/shared/components/RecordReadView.js +119 -119
- package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
- package/dist/shared/components/item-edit/InlineGridField.js +45 -45
- package/dist/shared/components/item-edit/InlineTableField.js +750 -749
- package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
- package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
- package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
- package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
- package/dist/shared/components/item-edit/related-missing.js +75 -19
- package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
- package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
- package/dist/shared/components/panels/BackgroundMove.js +175 -0
- package/dist/shared/components/panels/MoveAdvisory.js +204 -0
- package/dist/shared/components/panels/PipelinePanel.js +1450 -1219
- package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
- package/dist/shared/lib/commands.js +18 -14
- package/dist/shared/lib/error-hints.js +1 -1
- package/dist/shared/lib/job-failure-text.js +12 -0
- package/dist/shared/lib/move-failure.js +9 -0
- package/dist/shared/lib/obligation-banner.js +15 -14
- package/dist/shared/lib/partner-failure.js +71 -0
- package/dist/shared/lib/prefetch.js +73 -73
- package/dist/shared/lib/replay-checkout.js +18 -13
- package/dist/shared/lib/replay-context.js +90 -77
- package/dist/shared/lib/replay-idle.js +21 -0
- package/dist/shared/lib/replay-socket.js +21 -17
- package/dist/shared/lib/rum.js +56 -51
- package/dist/shared/lib/safe-error.js +17 -13
- package/dist/shared/lib/stale-chunk.js +69 -26
- package/dist/shared/lib/system-collections.js +20 -0
- package/package.json +1 -1
|
@@ -1,218 +1,240 @@
|
|
|
1
|
-
import { jsxs as n, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Archive as
|
|
4
|
-
import { useState as s, useEffect as Se, Fragment as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import { resolveNotificationTargetFor as Q, runNotificationTarget as
|
|
8
|
-
import { openInTabsMessage as
|
|
1
|
+
import { jsxs as n, jsx as t, Fragment as at } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as nt, useQuery as I, keepPreviousData as lt, useMutation as v } from "@tanstack/react-query";
|
|
3
|
+
import { Archive as we, CheckCheck as rt, Search as dt, Check as de, AlarmClock as ie, ExternalLink as Ne, Bell as Ce, ShieldCheck as se, ChevronLeft as it, ChevronRight as st, History as ot, Trash2 as ct, ChevronDown as ut } from "lucide-react";
|
|
4
|
+
import { useState as s, useEffect as Se, Fragment as oe } from "react";
|
|
5
|
+
import { useNivaroClient as mt } from "../../context.js";
|
|
6
|
+
import { get as R, post as y, patch as pt, del as bt } from "../../lib/commands.js";
|
|
7
|
+
import { resolveNotificationTargetFor as Q, runNotificationTarget as ce } from "../../lib/notification-target.js";
|
|
8
|
+
import { openInTabsMessage as ht, openInTabs as xt } from "../../lib/open-in-tabs.js";
|
|
9
9
|
import { cn as m, formatRelative as G } from "../../lib/utils.js";
|
|
10
|
-
import { hasSnapshotView as
|
|
11
|
-
import { SimpleSelect as
|
|
12
|
-
import { AsItWasSheet as
|
|
13
|
-
import { bundleLocally as
|
|
14
|
-
import { DeliveryChips as
|
|
15
|
-
import { NotificationActions as
|
|
16
|
-
import { NotificationChangesList as
|
|
17
|
-
const
|
|
10
|
+
import { hasSnapshotView as gt, offersChanges as ft } from "../NotificationBell.js";
|
|
11
|
+
import { SimpleSelect as ue } from "../ui/SimpleSelect.js";
|
|
12
|
+
import { AsItWasSheet as kt } from "./AsItWasSheet.js";
|
|
13
|
+
import { bundleLocally as vt, laneTone as yt, bundleAsNotification as wt, bundleHeadline as Nt, categoryChipLabel as Ct } from "./bundles.js";
|
|
14
|
+
import { DeliveryChips as St } from "./DeliveryChips.js";
|
|
15
|
+
import { NotificationActions as _t } from "./NotificationActions.js";
|
|
16
|
+
import { NotificationChangesList as Dt, NotificationDetailBits as zt } from "./NotificationDetailBits.js";
|
|
17
|
+
const me = 25, At = [
|
|
18
18
|
{ key: "all", label: "All" },
|
|
19
19
|
{ key: "inbox", label: "Unread" },
|
|
20
20
|
{ key: "read", label: "Read" },
|
|
21
21
|
{ key: "snoozed", label: "Snoozed" },
|
|
22
22
|
{ key: "archived", label: "Archived" },
|
|
23
23
|
{ key: "sent", label: "Sent" }
|
|
24
|
-
],
|
|
24
|
+
], qt = [
|
|
25
25
|
{ key: "all", label: "Every lane" },
|
|
26
26
|
{ key: "critical", label: "Critical" },
|
|
27
27
|
{ key: "needs_you", label: "Needs you" },
|
|
28
28
|
{ key: "fyi", label: "FYI" }
|
|
29
29
|
];
|
|
30
30
|
function _e() {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
return
|
|
35
|
-
{ label: "For 1 hour", until:
|
|
36
|
-
{ label: "Until tomorrow 8am", until:
|
|
37
|
-
{ label: "Until next week", until:
|
|
31
|
+
const f = /* @__PURE__ */ new Date(), w = new Date(f.getTime() + 3600 * 1e3), N = new Date(f);
|
|
32
|
+
N.setDate(N.getDate() + 1), N.setHours(8, 0, 0, 0);
|
|
33
|
+
const C = new Date(f);
|
|
34
|
+
return C.setDate(C.getDate() + ((8 - C.getDay()) % 7 || 7)), C.setHours(8, 0, 0, 0), [
|
|
35
|
+
{ label: "For 1 hour", until: w },
|
|
36
|
+
{ label: "Until tomorrow 8am", until: N },
|
|
37
|
+
{ label: "Until next week", until: C }
|
|
38
38
|
];
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
routes:
|
|
42
|
-
onNavigate:
|
|
43
|
-
app:
|
|
44
|
-
mailLogUrl:
|
|
40
|
+
function Yt({
|
|
41
|
+
routes: f,
|
|
42
|
+
onNavigate: w,
|
|
43
|
+
app: N,
|
|
44
|
+
mailLogUrl: C,
|
|
45
45
|
subscriptionsPath: De,
|
|
46
46
|
rulesPath: ze,
|
|
47
|
-
changesId:
|
|
47
|
+
changesId: pe,
|
|
48
48
|
onNotice: r,
|
|
49
49
|
onError: d,
|
|
50
50
|
className: Ae
|
|
51
51
|
}) {
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
52
|
+
const u = mt(), Y = nt(), [V, qe] = s(() => {
|
|
53
|
+
if (pe !== void 0) return pe;
|
|
54
54
|
if (typeof window > "u") return null;
|
|
55
55
|
const e = new URLSearchParams(window.location.search).get("changes"), a = Number(e);
|
|
56
56
|
return e && Number.isInteger(a) && a > 0 ? a : null;
|
|
57
|
-
}), [i, Fe] = s("all"), [
|
|
58
|
-
queryKey: ["notifications", "sent",
|
|
59
|
-
queryFn: () =>
|
|
60
|
-
|
|
57
|
+
}), [i, Fe] = s("all"), [S, $e] = s("all"), [j, Me] = s(!0), { data: be = [], isLoading: Te } = I({
|
|
58
|
+
queryKey: ["notifications", "sent", j],
|
|
59
|
+
queryFn: () => u.request(
|
|
60
|
+
R("/notifications/sent", { lane: j ? "critical" : "all" })
|
|
61
61
|
).then((e) => e.data ?? []),
|
|
62
62
|
enabled: i === "sent",
|
|
63
63
|
refetchInterval: i === "sent" ? 3e4 : !1
|
|
64
|
-
}), [
|
|
64
|
+
}), [_, q] = s(1), [Le, Z] = s(null), [he, xe] = s(null), [J, Oe] = s(""), [B, Pe] = s(""), [T, Ie] = s(""), [U, Re] = s(!0), [je, Be] = s(() => /* @__PURE__ */ new Set()), [h, ge] = s(null), [F, K] = s(() => /* @__PURE__ */ new Set()), [W, L] = s(!1), [Ue, X] = s(!1), [fe, Ke] = s(!1), [ke, He] = s("30");
|
|
65
65
|
Se(() => {
|
|
66
|
-
K(/* @__PURE__ */ new Set()),
|
|
67
|
-
}, [i,
|
|
66
|
+
K(/* @__PURE__ */ new Set()), L(!1), X(!1);
|
|
67
|
+
}, [i, S, _, B, T]), Se(() => {
|
|
68
68
|
const e = setTimeout(() => {
|
|
69
69
|
Pe(J.trim()), q(1);
|
|
70
70
|
}, 350);
|
|
71
71
|
return () => clearTimeout(e);
|
|
72
72
|
}, [J]);
|
|
73
|
-
const { data:
|
|
73
|
+
const { data: x } = I({
|
|
74
74
|
queryKey: ["notification-count"],
|
|
75
|
-
queryFn: () =>
|
|
75
|
+
queryFn: () => u.request(R("/notifications/unread-count"))
|
|
76
76
|
}), { data: p, isLoading: Qe } = I({
|
|
77
77
|
queryKey: [
|
|
78
78
|
"notifications",
|
|
79
79
|
"center",
|
|
80
80
|
i,
|
|
81
|
-
C,
|
|
82
81
|
S,
|
|
82
|
+
_,
|
|
83
83
|
B,
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
T,
|
|
85
|
+
N ?? null,
|
|
86
86
|
U
|
|
87
87
|
],
|
|
88
|
-
queryFn: () =>
|
|
89
|
-
|
|
90
|
-
page:
|
|
91
|
-
limit:
|
|
88
|
+
queryFn: () => u.request(
|
|
89
|
+
R("/notifications", {
|
|
90
|
+
page: _,
|
|
91
|
+
limit: me,
|
|
92
92
|
status: i === "snoozed" || i === "sent" ? "all" : i,
|
|
93
93
|
snoozed: i === "snoozed" ? "true" : void 0,
|
|
94
|
-
lane:
|
|
94
|
+
lane: S === "all" ? void 0 : S,
|
|
95
95
|
search: B || void 0,
|
|
96
|
-
collection:
|
|
97
|
-
app:
|
|
96
|
+
collection: T || void 0,
|
|
97
|
+
app: N,
|
|
98
98
|
bundle: U ? "record" : void 0
|
|
99
99
|
})
|
|
100
100
|
).then((e) => {
|
|
101
101
|
if (!U || e.bundles) return e;
|
|
102
|
-
const a =
|
|
102
|
+
const a = vt(e.data ?? []);
|
|
103
103
|
return { ...e, data: a.rows, bundles: a.bundles };
|
|
104
104
|
}),
|
|
105
|
-
placeholderData:
|
|
105
|
+
placeholderData: lt,
|
|
106
106
|
enabled: i !== "sent"
|
|
107
107
|
}), { data: Ge = [] } = I({
|
|
108
108
|
queryKey: ["notifications", "center", "collections"],
|
|
109
|
-
queryFn: () =>
|
|
110
|
-
|
|
109
|
+
queryFn: () => u.request(
|
|
110
|
+
R("/collections")
|
|
111
111
|
).then((e) => {
|
|
112
112
|
const a = Array.isArray(e) ? e : e.data ?? [];
|
|
113
113
|
return [...new Set(a.map((l) => l.collection))].sort();
|
|
114
114
|
}),
|
|
115
115
|
staleTime: 3e5
|
|
116
|
-
}),
|
|
116
|
+
}), D = i === "archived" || _ > 1 ? [] : (p == null ? void 0 : p.pinned) ?? [], Ye = new Set(D.map((e) => e.id)), O = ((p == null ? void 0 : p.data) ?? []).filter((e) => !Ye.has(e.id)), H = (p == null ? void 0 : p.bundles) ?? [], z = (p == null ? void 0 : p.total) ?? 0, E = Math.max(1, Math.ceil(z / me)), g = () => {
|
|
117
117
|
Y.invalidateQueries({ queryKey: ["notifications"] }), Y.invalidateQueries({ queryKey: ["notification-count"] });
|
|
118
|
-
}, Ve =
|
|
119
|
-
mutationFn: (e) =>
|
|
120
|
-
onSuccess:
|
|
118
|
+
}, Ve = v({
|
|
119
|
+
mutationFn: (e) => u.request(y("/notifications/mark-read", { ids: e })),
|
|
120
|
+
onSuccess: g,
|
|
121
121
|
onError: () => d == null ? void 0 : d("Failed to mark the bundle read")
|
|
122
|
-
}), ee =
|
|
123
|
-
mutationFn: () =>
|
|
122
|
+
}), ee = v({
|
|
123
|
+
mutationFn: () => u.request(y("/notifications/mark-all-read")),
|
|
124
124
|
onSuccess: () => {
|
|
125
|
-
|
|
125
|
+
g(), r == null || r("All notifications marked as read");
|
|
126
126
|
},
|
|
127
127
|
onError: () => d == null ? void 0 : d("Failed to mark all read")
|
|
128
|
-
}),
|
|
128
|
+
}), P = v({
|
|
129
129
|
mutationFn: ({
|
|
130
130
|
id: e,
|
|
131
131
|
until: a,
|
|
132
132
|
untilChange: l
|
|
133
|
-
}) =>
|
|
134
|
-
|
|
133
|
+
}) => u.request(
|
|
134
|
+
y(
|
|
135
135
|
`/notifications/${e}/snooze`,
|
|
136
136
|
l ? { until_change: !0 } : { until: a ? a.toISOString() : null }
|
|
137
137
|
)
|
|
138
138
|
),
|
|
139
139
|
onSuccess: (e, a) => {
|
|
140
|
-
|
|
140
|
+
g(), xe(null), r == null || r(
|
|
141
141
|
a.untilChange ? "Snoozed — it comes back when someone changes the record" : a.until ? "Snoozed — it will return unread" : "Snooze cleared"
|
|
142
142
|
);
|
|
143
143
|
},
|
|
144
144
|
onError: () => d == null ? void 0 : d("Failed to snooze")
|
|
145
|
-
}),
|
|
146
|
-
mutationFn: (e) =>
|
|
145
|
+
}), ve = v({
|
|
146
|
+
mutationFn: (e) => u.request(y(`/notifications/${e}/acknowledge`)),
|
|
147
147
|
onSuccess: () => {
|
|
148
|
-
|
|
148
|
+
g(), r == null || r("Acknowledged");
|
|
149
149
|
},
|
|
150
150
|
onError: () => d == null ? void 0 : d("Failed to acknowledge")
|
|
151
151
|
}), Ze = () => ({
|
|
152
152
|
status: i === "snoozed" || i === "sent" ? "all" : i,
|
|
153
153
|
snoozed: i === "snoozed" ? "true" : void 0,
|
|
154
|
-
lane:
|
|
154
|
+
lane: S === "all" ? void 0 : S,
|
|
155
155
|
search: B || void 0,
|
|
156
|
-
collection:
|
|
157
|
-
}), $ =
|
|
158
|
-
mutationFn: (e) =>
|
|
159
|
-
|
|
156
|
+
collection: T || void 0
|
|
157
|
+
}), $ = v({
|
|
158
|
+
mutationFn: (e) => u.request(
|
|
159
|
+
y("/notifications/bulk-action", {
|
|
160
160
|
action: e.action,
|
|
161
161
|
until: e.until ? e.until.toISOString() : void 0,
|
|
162
162
|
...W ? { filter: Ze() } : { ids: [...F] }
|
|
163
163
|
})
|
|
164
164
|
),
|
|
165
165
|
onSuccess: (e, a) => {
|
|
166
|
-
var
|
|
167
|
-
|
|
168
|
-
const l = ((
|
|
166
|
+
var o;
|
|
167
|
+
g(), K(/* @__PURE__ */ new Set()), L(!1), X(!1);
|
|
168
|
+
const l = ((o = e.data) == null ? void 0 : o.updated) ?? 0;
|
|
169
169
|
r == null || r(
|
|
170
170
|
`${l} notification${l === 1 ? "" : "s"} ${a.action === "read" ? "marked read" : a.action === "archive" ? "archived" : "snoozed"}`
|
|
171
171
|
);
|
|
172
172
|
},
|
|
173
173
|
onError: () => d == null ? void 0 : d("That bulk action failed")
|
|
174
|
-
}), te =
|
|
175
|
-
mutationFn: (e) =>
|
|
174
|
+
}), te = v({
|
|
175
|
+
mutationFn: (e) => u.request(y("/notifications/archive-read", { days: e })),
|
|
176
176
|
onSuccess: (e) => {
|
|
177
177
|
var a;
|
|
178
|
-
|
|
178
|
+
g(), r == null || r(`${((a = e.data) == null ? void 0 : a.updated) ?? 0} archived — find them under Archived`);
|
|
179
179
|
},
|
|
180
180
|
onError: () => d == null ? void 0 : d("Clean-up failed")
|
|
181
181
|
}), { data: ae } = I({
|
|
182
182
|
queryKey: ["nvr-profile-prefs"],
|
|
183
|
-
queryFn: () =>
|
|
183
|
+
queryFn: () => u.request(R("/users/me")).then((e) => {
|
|
184
184
|
var a;
|
|
185
185
|
return ((a = e.data) == null ? void 0 : a.preferences) ?? {};
|
|
186
186
|
}),
|
|
187
|
-
enabled:
|
|
188
|
-
}), Je =
|
|
189
|
-
mutationFn: (e) =>
|
|
187
|
+
enabled: fe
|
|
188
|
+
}), Je = v({
|
|
189
|
+
mutationFn: (e) => u.request(pt("/users/me/preferences", { notification_cleanup_days: e })),
|
|
190
190
|
onSuccess: () => {
|
|
191
191
|
Y.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }), r == null || r("Automatic clean-up saved");
|
|
192
192
|
},
|
|
193
193
|
onError: () => d == null ? void 0 : d("Could not save the clean-up setting")
|
|
194
|
-
}), ne =
|
|
195
|
-
mutationFn: (e) =>
|
|
194
|
+
}), ne = v({
|
|
195
|
+
mutationFn: (e) => u.request(bt(`/notifications/${e}`)),
|
|
196
196
|
onSuccess: () => {
|
|
197
|
-
|
|
197
|
+
g(), Z(null), r == null || r("Notification deleted");
|
|
198
198
|
},
|
|
199
199
|
onError: () => d == null ? void 0 : d("Failed to delete notification")
|
|
200
200
|
}), We = async (e) => {
|
|
201
|
-
|
|
202
|
-
}),
|
|
203
|
-
}, Xe = (e) => {
|
|
204
|
-
|
|
201
|
+
await u.request(y(`/notifications/${e}/read`)).catch(() => {
|
|
202
|
+
}), g();
|
|
203
|
+
}, Xe = async (e) => {
|
|
204
|
+
e.read || (await u.request(y(`/notifications/${e.id}/read`)).catch(() => {
|
|
205
|
+
}), g()), ce(Q(e, f), w);
|
|
206
|
+
}, Ee = (e) => {
|
|
207
|
+
L(!1), K((a) => {
|
|
205
208
|
const l = new Set(a);
|
|
206
209
|
return l.has(e) ? l.delete(e) : l.add(e), l;
|
|
207
210
|
});
|
|
208
211
|
}, le = (e, a = !1) => {
|
|
209
|
-
var
|
|
210
|
-
const l = !e.read,
|
|
212
|
+
var M;
|
|
213
|
+
const l = !e.read, o = Q(e, f), A = /* @__PURE__ */ n(at, { children: [
|
|
214
|
+
/* @__PURE__ */ n("div", { className: "flex items-baseline gap-2", children: [
|
|
215
|
+
e.lane === "critical" && /* @__PURE__ */ t("span", { className: "shrink-0 rounded bg-red-500/10 px-1 text-[9.5px] font-bold uppercase tracking-wide text-red-600 dark:text-red-400", children: "Critical" }),
|
|
216
|
+
e.lane === "needs_you" && l && /* @__PURE__ */ t("span", { className: "shrink-0 rounded bg-nvr-cyan/10 px-1 text-[9.5px] font-bold uppercase tracking-wide text-nvr-navy dark:text-nvr-cyan", children: "Needs you" }),
|
|
217
|
+
/* @__PURE__ */ t(
|
|
218
|
+
"span",
|
|
219
|
+
{
|
|
220
|
+
className: m(
|
|
221
|
+
"truncate text-[13px]",
|
|
222
|
+
l ? "font-medium text-slate-900 dark:text-slate-100" : "font-normal text-slate-600 dark:text-slate-400"
|
|
223
|
+
),
|
|
224
|
+
children: e.subject ?? e.title ?? "—"
|
|
225
|
+
}
|
|
226
|
+
),
|
|
227
|
+
/* @__PURE__ */ t("span", { className: "shrink-0 text-[10.5px] text-slate-400", children: G(e.created_at ?? /* @__PURE__ */ new Date()) })
|
|
228
|
+
] }),
|
|
229
|
+
e.message && /* @__PURE__ */ t("p", { className: "mt-0.5 line-clamp-2 text-[12px] text-slate-500", children: e.message.replace(/<[^>]+>/g, "") })
|
|
230
|
+
] });
|
|
211
231
|
return /* @__PURE__ */ n(
|
|
212
232
|
"div",
|
|
213
233
|
{
|
|
214
234
|
className: m(
|
|
215
|
-
"group relative flex items-start gap-3 py-3
|
|
235
|
+
"group relative flex items-start gap-3 py-3",
|
|
236
|
+
// Only a row that opens something lights up under the pointer.
|
|
237
|
+
o && "transition-colors hover:bg-slate-50 dark:hover:bg-slate-800/40",
|
|
216
238
|
a ? "bg-slate-50/50 pl-8 pr-4 dark:bg-muted/30" : "px-4"
|
|
217
239
|
),
|
|
218
240
|
"data-notification-row": e.id,
|
|
@@ -223,7 +245,7 @@ function Qt({
|
|
|
223
245
|
{
|
|
224
246
|
type: "checkbox",
|
|
225
247
|
checked: F.has(e.id),
|
|
226
|
-
onChange: () =>
|
|
248
|
+
onChange: () => Ee(e.id),
|
|
227
249
|
"aria-label": "Select notification",
|
|
228
250
|
"data-notification-select": e.id,
|
|
229
251
|
className: "mt-1.5 h-3.5 w-3.5 shrink-0"
|
|
@@ -239,98 +261,99 @@ function Qt({
|
|
|
239
261
|
}
|
|
240
262
|
),
|
|
241
263
|
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
|
|
242
|
-
/* @__PURE__ */
|
|
264
|
+
o ? /* @__PURE__ */ t(
|
|
243
265
|
"button",
|
|
244
266
|
{
|
|
245
267
|
type: "button",
|
|
246
|
-
onClick: () => void
|
|
268
|
+
onClick: () => void Xe(e),
|
|
247
269
|
className: "block w-full text-left",
|
|
248
|
-
children:
|
|
249
|
-
/* @__PURE__ */ n("div", { className: "flex items-baseline gap-2", children: [
|
|
250
|
-
e.lane === "critical" && /* @__PURE__ */ t("span", { className: "shrink-0 rounded bg-red-500/10 px-1 text-[9.5px] font-bold uppercase tracking-wide text-red-600 dark:text-red-400", children: "Critical" }),
|
|
251
|
-
e.lane === "needs_you" && l && /* @__PURE__ */ t("span", { className: "shrink-0 rounded bg-nvr-cyan/10 px-1 text-[9.5px] font-bold uppercase tracking-wide text-nvr-navy dark:text-nvr-cyan", children: "Needs you" }),
|
|
252
|
-
/* @__PURE__ */ t(
|
|
253
|
-
"span",
|
|
254
|
-
{
|
|
255
|
-
className: m(
|
|
256
|
-
"truncate text-[13px]",
|
|
257
|
-
l ? "font-medium text-slate-900 dark:text-slate-100" : "font-normal text-slate-600 dark:text-slate-400"
|
|
258
|
-
),
|
|
259
|
-
children: e.subject ?? e.title ?? "—"
|
|
260
|
-
}
|
|
261
|
-
),
|
|
262
|
-
/* @__PURE__ */ t("span", { className: "shrink-0 text-[10.5px] text-slate-400", children: G(e.created_at ?? /* @__PURE__ */ new Date()) })
|
|
263
|
-
] }),
|
|
264
|
-
e.message && /* @__PURE__ */ t("p", { className: "mt-0.5 line-clamp-2 text-[12px] text-slate-500", children: e.message.replace(/<[^>]+>/g, "") })
|
|
265
|
-
]
|
|
270
|
+
children: A
|
|
266
271
|
}
|
|
272
|
+
) : (
|
|
273
|
+
// Nowhere to open: plain text, read or not. As a button its click
|
|
274
|
+
// only marked the row read, so the row dimmed (or left the Unread
|
|
275
|
+
// list) and opened nothing. Mark read is its own control below.
|
|
276
|
+
/* @__PURE__ */ t("div", { "data-notification-plain": !0, children: A })
|
|
267
277
|
),
|
|
268
278
|
/* @__PURE__ */ n("div", { className: "mt-1 flex flex-wrap items-center gap-2", children: [
|
|
269
279
|
e.sender_name && /* @__PURE__ */ n("span", { className: "text-[11px] text-slate-400", children: [
|
|
270
280
|
"From ",
|
|
271
281
|
e.sender_name
|
|
272
282
|
] }),
|
|
273
|
-
|
|
283
|
+
o && /* @__PURE__ */ t(
|
|
274
284
|
"button",
|
|
275
285
|
{
|
|
276
286
|
type: "button",
|
|
277
|
-
onClick: () =>
|
|
287
|
+
onClick: () => ce(o, w),
|
|
278
288
|
className: "inline-flex items-center gap-1 rounded-full bg-nvr-cyan/10 px-2 py-0.5 text-[10px] font-medium text-nvr-navy hover:bg-nvr-cyan/20 dark:bg-nvr-cyan/15 dark:text-nvr-cyan",
|
|
279
|
-
children:
|
|
289
|
+
children: o.type === "chat" ? "Open chat" : o.type === "external" ? "Open in app ↗" : e.target_label && e.kind !== "record" ? `${e.target_label}${e.item ? ` #${e.item}` : ""}` : e.collection === "__chat__" ? "Chat" : e.collection ? `${e.collection}${e.item ? ` #${e.item}` : ""}` : "Open"
|
|
290
|
+
}
|
|
291
|
+
),
|
|
292
|
+
l && !o && /* @__PURE__ */ n(
|
|
293
|
+
"button",
|
|
294
|
+
{
|
|
295
|
+
type: "button",
|
|
296
|
+
"data-notification-mark-read": e.id,
|
|
297
|
+
onClick: () => void We(e.id),
|
|
298
|
+
className: "inline-flex items-center gap-1 rounded-full border border-slate-200 px-2 py-0.5 text-[10px] font-medium text-slate-500 hover:bg-slate-50 hover:text-slate-700 dark:border-border dark:text-slate-400 dark:hover:bg-muted dark:hover:text-slate-200",
|
|
299
|
+
children: [
|
|
300
|
+
/* @__PURE__ */ t(de, { className: "h-3 w-3" }),
|
|
301
|
+
"Mark read"
|
|
302
|
+
]
|
|
280
303
|
}
|
|
281
304
|
),
|
|
282
|
-
/* @__PURE__ */ t(
|
|
283
|
-
|
|
305
|
+
/* @__PURE__ */ t(St, { delivery: e.delivery, mailLogUrl: C, onNavigate: w }),
|
|
306
|
+
gt(e) && /* @__PURE__ */ n(
|
|
284
307
|
"button",
|
|
285
308
|
{
|
|
286
309
|
type: "button",
|
|
287
310
|
"data-notification-as-it-was": e.id,
|
|
288
311
|
"data-tip": "The record as it was when you were told",
|
|
289
|
-
onClick: () =>
|
|
312
|
+
onClick: () => ge(e),
|
|
290
313
|
className: "inline-flex items-center gap-1 rounded-full border border-slate-200 px-2 py-0.5 text-[10px] font-medium text-slate-500 hover:bg-slate-50 hover:text-slate-700 dark:border-border dark:text-slate-400 dark:hover:bg-muted dark:hover:text-slate-200",
|
|
291
314
|
children: [
|
|
292
|
-
/* @__PURE__ */ t(
|
|
315
|
+
/* @__PURE__ */ t(ot, { className: "h-3 w-3" }),
|
|
293
316
|
"as it was"
|
|
294
317
|
]
|
|
295
318
|
}
|
|
296
319
|
)
|
|
297
320
|
] }),
|
|
298
321
|
/* @__PURE__ */ t(
|
|
299
|
-
|
|
322
|
+
zt,
|
|
300
323
|
{
|
|
301
324
|
detail: e.detail,
|
|
302
325
|
why: e.why,
|
|
303
326
|
delivery: e.delivery,
|
|
304
327
|
notificationId: e.id,
|
|
305
|
-
recordChanges:
|
|
328
|
+
recordChanges: ft(e),
|
|
306
329
|
subscriptionsPath: De,
|
|
307
330
|
rulesPath: ze,
|
|
308
|
-
onNavigate:
|
|
331
|
+
onNavigate: w,
|
|
309
332
|
className: "mt-1"
|
|
310
333
|
}
|
|
311
334
|
),
|
|
312
|
-
((
|
|
313
|
-
/* @__PURE__ */ t(
|
|
335
|
+
((M = e.ack) == null ? void 0 : M.required) && /* @__PURE__ */ t("div", { className: "mt-1.5", "data-notification-ack": e.ack.at ? "acked" : "pending", children: e.ack.at ? /* @__PURE__ */ n("span", { className: "inline-flex items-center gap-1 rounded-full bg-emerald-50 px-2 py-0.5 text-[10.5px] font-medium text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400", children: [
|
|
336
|
+
/* @__PURE__ */ t(se, { className: "h-3 w-3" }),
|
|
314
337
|
"Acknowledged ",
|
|
315
338
|
G(e.ack.at)
|
|
316
339
|
] }) : /* @__PURE__ */ n(
|
|
317
340
|
"button",
|
|
318
341
|
{
|
|
319
342
|
type: "button",
|
|
320
|
-
disabled:
|
|
321
|
-
onClick: () =>
|
|
343
|
+
disabled: ve.isPending,
|
|
344
|
+
onClick: () => ve.mutate(e.id),
|
|
322
345
|
"data-notification-acknowledge": e.id,
|
|
323
346
|
className: "inline-flex items-center gap-1 rounded-md bg-nvr-cyan px-2.5 py-1 text-[11.5px] font-medium text-white hover:opacity-90 disabled:opacity-50",
|
|
324
347
|
children: [
|
|
325
|
-
/* @__PURE__ */ t(
|
|
348
|
+
/* @__PURE__ */ t(se, { className: "h-3.5 w-3.5" }),
|
|
326
349
|
"Acknowledge"
|
|
327
350
|
]
|
|
328
351
|
}
|
|
329
352
|
) }),
|
|
330
353
|
e.actions && e.actions.length > 0 && /* @__PURE__ */ t(
|
|
331
|
-
|
|
354
|
+
_t,
|
|
332
355
|
{
|
|
333
|
-
actions: l ? e.actions : e.actions.filter((
|
|
356
|
+
actions: l ? e.actions : e.actions.filter((b) => !!b.input),
|
|
334
357
|
notificationId: e.id,
|
|
335
358
|
size: "sm",
|
|
336
359
|
onError: d,
|
|
@@ -344,11 +367,11 @@ function Qt({
|
|
|
344
367
|
"button",
|
|
345
368
|
{
|
|
346
369
|
type: "button",
|
|
347
|
-
onClick: () =>
|
|
370
|
+
onClick: () => P.mutate({ id: e.id, until: null }),
|
|
348
371
|
className: "inline-flex items-center gap-1 rounded-full bg-amber-50 px-2 py-0.5 text-[10.5px] font-medium text-amber-700 hover:bg-amber-100 dark:bg-amber-400/10 dark:text-amber-300",
|
|
349
372
|
"data-tip": "Click to wake now",
|
|
350
373
|
children: [
|
|
351
|
-
/* @__PURE__ */ t(
|
|
374
|
+
/* @__PURE__ */ t(ie, { className: "h-3 w-3" }),
|
|
352
375
|
e.snooze_until_change ? "Until it changes" : `Until ${new Date(e.snoozed_until).toLocaleString([], {
|
|
353
376
|
month: "short",
|
|
354
377
|
day: "numeric",
|
|
@@ -361,30 +384,30 @@ function Qt({
|
|
|
361
384
|
"button",
|
|
362
385
|
{
|
|
363
386
|
type: "button",
|
|
364
|
-
onClick: () => he
|
|
387
|
+
onClick: () => xe(he === e.id ? null : e.id),
|
|
365
388
|
className: "rounded p-1.5 text-slate-300 opacity-0 transition-all hover:bg-amber-50 hover:text-amber-500 group-hover:opacity-100 dark:hover:bg-amber-400/10",
|
|
366
389
|
"aria-label": "Snooze notification",
|
|
367
|
-
children: /* @__PURE__ */ t(
|
|
390
|
+
children: /* @__PURE__ */ t(ie, { className: "h-3.5 w-3.5" })
|
|
368
391
|
}
|
|
369
392
|
),
|
|
370
|
-
|
|
371
|
-
_e().map((
|
|
393
|
+
he === e.id && /* @__PURE__ */ n("div", { className: "absolute right-0 top-8 z-20 w-[180px] rounded-md border border-slate-200 bg-white py-1 shadow-lg dark:border-border dark:bg-card", children: [
|
|
394
|
+
_e().map((b) => /* @__PURE__ */ t(
|
|
372
395
|
"button",
|
|
373
396
|
{
|
|
374
397
|
type: "button",
|
|
375
|
-
disabled:
|
|
376
|
-
onClick: () =>
|
|
398
|
+
disabled: P.isPending,
|
|
399
|
+
onClick: () => P.mutate({ id: e.id, until: b.until }),
|
|
377
400
|
className: "block w-full px-3 py-1.5 text-left text-[12px] text-slate-700 hover:bg-muted dark:text-foreground",
|
|
378
|
-
children:
|
|
401
|
+
children: b.label
|
|
379
402
|
},
|
|
380
|
-
|
|
403
|
+
b.label
|
|
381
404
|
)),
|
|
382
405
|
e.collection && e.item != null && /* @__PURE__ */ t(
|
|
383
406
|
"button",
|
|
384
407
|
{
|
|
385
408
|
type: "button",
|
|
386
|
-
disabled:
|
|
387
|
-
onClick: () =>
|
|
409
|
+
disabled: P.isPending,
|
|
410
|
+
onClick: () => P.mutate({ id: e.id, until: null, untilChange: !0 }),
|
|
388
411
|
className: "block w-full border-t border-slate-100 px-3 py-1.5 text-left text-[12px] text-slate-700 hover:bg-muted dark:border-border dark:text-foreground",
|
|
389
412
|
"data-snooze-until-change": !0,
|
|
390
413
|
children: "Until the record changes"
|
|
@@ -419,15 +442,15 @@ function Qt({
|
|
|
419
442
|
onClick: () => Z(e.id),
|
|
420
443
|
className: "rounded p-1.5 text-slate-300 opacity-0 transition-all hover:bg-red-50 hover:text-red-400 group-hover:opacity-100",
|
|
421
444
|
"aria-label": "Delete notification",
|
|
422
|
-
children: /* @__PURE__ */ t(
|
|
445
|
+
children: /* @__PURE__ */ t(ct, { className: "h-3.5 w-3.5" })
|
|
423
446
|
}
|
|
424
447
|
) })
|
|
425
448
|
]
|
|
426
449
|
}
|
|
427
450
|
);
|
|
428
|
-
},
|
|
429
|
-
const a = `${e.collection}:${e.item}`, l =
|
|
430
|
-
const k = new Set(
|
|
451
|
+
}, et = (e) => {
|
|
452
|
+
const a = `${e.collection}:${e.item}`, l = je.has(a), o = yt(e.lane), A = e.deleted ? null : Q(wt(e), f), M = e.rows.filter((c) => !c.read).map((c) => c.id), b = () => Be((c) => {
|
|
453
|
+
const k = new Set(c);
|
|
431
454
|
return k.has(a) ? k.delete(a) : k.add(a), k;
|
|
432
455
|
});
|
|
433
456
|
return /* @__PURE__ */ n(
|
|
@@ -446,10 +469,10 @@ function Qt({
|
|
|
446
469
|
"aria-expanded": l,
|
|
447
470
|
"aria-label": l ? "Collapse" : "Expand",
|
|
448
471
|
"data-notification-bundle-expand": a,
|
|
449
|
-
onClick:
|
|
472
|
+
onClick: b,
|
|
450
473
|
className: "mt-1 rounded p-0.5 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
|
|
451
474
|
children: /* @__PURE__ */ t(
|
|
452
|
-
|
|
475
|
+
ut,
|
|
453
476
|
{
|
|
454
477
|
className: m("h-3.5 w-3.5 transition-transform", !l && "-rotate-90")
|
|
455
478
|
}
|
|
@@ -461,18 +484,18 @@ function Qt({
|
|
|
461
484
|
{
|
|
462
485
|
className: m(
|
|
463
486
|
"mt-2 h-2 w-2 shrink-0 rounded-full",
|
|
464
|
-
e.unread > 0 ?
|
|
487
|
+
e.unread > 0 ? o.dot : "bg-transparent"
|
|
465
488
|
)
|
|
466
489
|
}
|
|
467
490
|
),
|
|
468
491
|
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
|
|
469
|
-
/* @__PURE__ */ t("button", { type: "button", onClick:
|
|
492
|
+
/* @__PURE__ */ t("button", { type: "button", onClick: b, className: "block w-full text-left", children: /* @__PURE__ */ n("div", { className: "flex items-baseline gap-2", children: [
|
|
470
493
|
e.lane === "critical" && e.unread > 0 && /* @__PURE__ */ t(
|
|
471
494
|
"span",
|
|
472
495
|
{
|
|
473
496
|
className: m(
|
|
474
497
|
"shrink-0 rounded px-1 text-[9.5px] font-bold uppercase tracking-wide",
|
|
475
|
-
|
|
498
|
+
o.chip
|
|
476
499
|
),
|
|
477
500
|
children: "Critical"
|
|
478
501
|
}
|
|
@@ -482,9 +505,9 @@ function Qt({
|
|
|
482
505
|
{
|
|
483
506
|
className: m(
|
|
484
507
|
"truncate text-[13px]",
|
|
485
|
-
e.unread > 0 ? m("font-medium",
|
|
508
|
+
e.unread > 0 ? m("font-medium", o.text) : "font-normal text-slate-600 dark:text-slate-400"
|
|
486
509
|
),
|
|
487
|
-
children:
|
|
510
|
+
children: Nt(e)
|
|
488
511
|
}
|
|
489
512
|
),
|
|
490
513
|
/* @__PURE__ */ t("span", { className: "shrink-0 text-[10.5px] text-slate-400", children: e.newest ? G(e.newest) : "" })
|
|
@@ -506,20 +529,20 @@ function Qt({
|
|
|
506
529
|
children: "deleted"
|
|
507
530
|
}
|
|
508
531
|
),
|
|
509
|
-
e.categories.map((
|
|
532
|
+
e.categories.map((c) => /* @__PURE__ */ t(
|
|
510
533
|
"span",
|
|
511
534
|
{
|
|
512
535
|
className: "rounded bg-slate-100 px-1.5 py-px text-[10px] font-medium text-slate-600 dark:bg-muted dark:text-slate-300",
|
|
513
|
-
"data-notification-bundle-category":
|
|
514
|
-
children:
|
|
536
|
+
"data-notification-bundle-category": c,
|
|
537
|
+
children: Ct(c)
|
|
515
538
|
},
|
|
516
|
-
|
|
539
|
+
c
|
|
517
540
|
)),
|
|
518
|
-
|
|
541
|
+
A && /* @__PURE__ */ n(
|
|
519
542
|
"button",
|
|
520
543
|
{
|
|
521
544
|
type: "button",
|
|
522
|
-
onClick: () =>
|
|
545
|
+
onClick: () => ce(A, w),
|
|
523
546
|
className: "inline-flex items-center gap-1 rounded-full bg-nvr-cyan/10 px-2 py-0.5 text-[10px] font-medium text-nvr-navy hover:bg-nvr-cyan/20 dark:bg-nvr-cyan/15 dark:text-nvr-cyan",
|
|
524
547
|
children: [
|
|
525
548
|
/* @__PURE__ */ t(Ne, { className: "h-3 w-3" }),
|
|
@@ -534,15 +557,15 @@ function Qt({
|
|
|
534
557
|
] })
|
|
535
558
|
] })
|
|
536
559
|
] }),
|
|
537
|
-
|
|
560
|
+
M.length > 0 && /* @__PURE__ */ n(
|
|
538
561
|
"button",
|
|
539
562
|
{
|
|
540
563
|
type: "button",
|
|
541
564
|
"data-notification-bundle-read": a,
|
|
542
|
-
onClick: () => Ve.mutate(
|
|
565
|
+
onClick: () => Ve.mutate(M),
|
|
543
566
|
className: "inline-flex items-center gap-1 rounded-md border border-slate-200 px-2 py-1 text-[11px] font-medium text-slate-600 hover:bg-slate-50 dark:border-border dark:text-slate-300 dark:hover:bg-muted",
|
|
544
567
|
children: [
|
|
545
|
-
/* @__PURE__ */ t(
|
|
568
|
+
/* @__PURE__ */ t(de, { className: "h-3 w-3" }),
|
|
546
569
|
"Mark read"
|
|
547
570
|
]
|
|
548
571
|
}
|
|
@@ -553,16 +576,16 @@ function Qt({
|
|
|
553
576
|
{
|
|
554
577
|
className: "divide-y divide-slate-100 border-t border-slate-100 dark:divide-border dark:border-border",
|
|
555
578
|
"data-notification-bundle-rows": a,
|
|
556
|
-
children: e.rows.map((
|
|
579
|
+
children: e.rows.map((c) => /* @__PURE__ */ t(oe, { children: le(c, !0) }, c.id))
|
|
557
580
|
}
|
|
558
581
|
)
|
|
559
582
|
]
|
|
560
583
|
},
|
|
561
584
|
`bundle:${a}`
|
|
562
585
|
);
|
|
563
|
-
}, ye =
|
|
586
|
+
}, ye = D.length + O.length + H.reduce((e, a) => e + a.rows.length, 0), tt = (e) => {
|
|
564
587
|
var a;
|
|
565
|
-
return e === "all" ? null : ((a =
|
|
588
|
+
return e === "all" ? null : ((a = x == null ? void 0 : x.lanes) == null ? void 0 : a[e]) ?? null;
|
|
566
589
|
};
|
|
567
590
|
return /* @__PURE__ */ n("div", { className: m("flex flex-1 min-h-0 flex-col", Ae), "data-nvr-notification-center": !0, children: [
|
|
568
591
|
/* @__PURE__ */ n("header", { className: "shrink-0 border-b border-slate-200 bg-white px-8 py-5 dark:border-border dark:bg-background", children: [
|
|
@@ -570,10 +593,10 @@ function Qt({
|
|
|
570
593
|
/* @__PURE__ */ n("div", { children: [
|
|
571
594
|
/* @__PURE__ */ t("h1", { className: "text-xl font-bold text-slate-900 dark:text-slate-100", children: "Notifications" }),
|
|
572
595
|
/* @__PURE__ */ n("p", { className: "mt-0.5 text-[13px] text-slate-400", children: [
|
|
573
|
-
|
|
596
|
+
z,
|
|
574
597
|
" notification",
|
|
575
|
-
|
|
576
|
-
(
|
|
598
|
+
z === 1 ? "" : "s",
|
|
599
|
+
(x == null ? void 0 : x.attention) != null && x.attention > 0 ? ` · ${x.attention} need${x.attention === 1 ? "s" : ""} you` : ""
|
|
577
600
|
] })
|
|
578
601
|
] }),
|
|
579
602
|
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
@@ -585,7 +608,7 @@ function Qt({
|
|
|
585
608
|
"data-notification-cleanup-toggle": !0,
|
|
586
609
|
className: "inline-flex h-8 items-center gap-1.5 rounded-md border border-slate-200 px-3 text-[12px] font-medium text-slate-700 hover:bg-slate-50 dark:border-border dark:text-foreground dark:hover:bg-muted",
|
|
587
610
|
children: [
|
|
588
|
-
/* @__PURE__ */ t(
|
|
611
|
+
/* @__PURE__ */ t(we, { className: "h-3.5 w-3.5" }),
|
|
589
612
|
"Clean up"
|
|
590
613
|
]
|
|
591
614
|
}
|
|
@@ -598,14 +621,14 @@ function Qt({
|
|
|
598
621
|
disabled: ee.isPending,
|
|
599
622
|
className: "inline-flex h-8 items-center gap-1.5 rounded-md border border-slate-200 px-3 text-[12px] font-medium text-slate-700 hover:bg-slate-50 disabled:opacity-50 dark:border-border dark:text-foreground dark:hover:bg-muted",
|
|
600
623
|
children: [
|
|
601
|
-
/* @__PURE__ */ t(
|
|
624
|
+
/* @__PURE__ */ t(rt, { className: "h-3.5 w-3.5" }),
|
|
602
625
|
ee.isPending ? "Marking…" : "Mark all read"
|
|
603
626
|
]
|
|
604
627
|
}
|
|
605
628
|
)
|
|
606
629
|
] })
|
|
607
630
|
] }),
|
|
608
|
-
|
|
631
|
+
fe && /* @__PURE__ */ n(
|
|
609
632
|
"div",
|
|
610
633
|
{
|
|
611
634
|
className: "mt-3 space-y-2 rounded-md border border-slate-200 bg-slate-50 px-3 py-2.5 text-[12px] text-slate-600 dark:border-border dark:bg-muted/40 dark:text-muted-foreground",
|
|
@@ -614,9 +637,9 @@ function Qt({
|
|
|
614
637
|
/* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
615
638
|
"Archive everything read and older than",
|
|
616
639
|
/* @__PURE__ */ t(
|
|
617
|
-
|
|
640
|
+
ue,
|
|
618
641
|
{
|
|
619
|
-
value:
|
|
642
|
+
value: ke,
|
|
620
643
|
onChange: He,
|
|
621
644
|
ariaLabel: "Older than",
|
|
622
645
|
className: "h-7 w-auto rounded-md border-slate-200 bg-background px-2 text-[12px] dark:border-border",
|
|
@@ -633,7 +656,7 @@ function Qt({
|
|
|
633
656
|
{
|
|
634
657
|
type: "button",
|
|
635
658
|
disabled: te.isPending,
|
|
636
|
-
onClick: () => te.mutate(Number(
|
|
659
|
+
onClick: () => te.mutate(Number(ke)),
|
|
637
660
|
"data-notification-archive-read": !0,
|
|
638
661
|
className: "h-7 rounded-md bg-slate-900 px-2.5 text-[11.5px] font-medium text-white hover:bg-slate-700 disabled:opacity-50 dark:bg-slate-100 dark:text-slate-900",
|
|
639
662
|
children: te.isPending ? "Archiving…" : "Archive now"
|
|
@@ -643,7 +666,7 @@ function Qt({
|
|
|
643
666
|
/* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
644
667
|
"Or do it automatically — archive read notifications after",
|
|
645
668
|
/* @__PURE__ */ t(
|
|
646
|
-
|
|
669
|
+
ue,
|
|
647
670
|
{
|
|
648
671
|
value: String((ae == null ? void 0 : ae.notification_cleanup_days) ?? ""),
|
|
649
672
|
onChange: (e) => Je.mutate(e ? Number(e) : null),
|
|
@@ -663,8 +686,8 @@ function Qt({
|
|
|
663
686
|
}
|
|
664
687
|
),
|
|
665
688
|
/* @__PURE__ */ n("div", { className: "mt-4 flex flex-wrap items-center gap-2", children: [
|
|
666
|
-
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children:
|
|
667
|
-
const a =
|
|
689
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: qt.map((e) => {
|
|
690
|
+
const a = tt(e.key);
|
|
668
691
|
return /* @__PURE__ */ n(
|
|
669
692
|
"button",
|
|
670
693
|
{
|
|
@@ -675,7 +698,7 @@ function Qt({
|
|
|
675
698
|
"data-nvr-lane": e.key,
|
|
676
699
|
className: m(
|
|
677
700
|
"rounded-md px-3 py-1.5 text-[12.5px] font-medium transition-colors",
|
|
678
|
-
|
|
701
|
+
S === e.key ? e.key === "critical" ? "bg-red-500/10 text-red-700 dark:text-red-400" : "bg-nvr-cyan/10 text-nvr-navy dark:bg-nvr-cyan/15 dark:text-nvr-cyan" : "text-slate-500 hover:bg-slate-50 hover:text-slate-700 dark:hover:bg-slate-800/50"
|
|
679
702
|
),
|
|
680
703
|
children: [
|
|
681
704
|
e.label,
|
|
@@ -686,7 +709,7 @@ function Qt({
|
|
|
686
709
|
);
|
|
687
710
|
}) }),
|
|
688
711
|
/* @__PURE__ */ t("span", { className: "mx-1 h-5 w-px bg-slate-200 dark:bg-border" }),
|
|
689
|
-
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children:
|
|
712
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: At.map((e) => /* @__PURE__ */ t(
|
|
690
713
|
"button",
|
|
691
714
|
{
|
|
692
715
|
type: "button",
|
|
@@ -702,7 +725,7 @@ function Qt({
|
|
|
702
725
|
e.key
|
|
703
726
|
)) }),
|
|
704
727
|
/* @__PURE__ */ n("div", { className: "relative ml-auto", children: [
|
|
705
|
-
/* @__PURE__ */ t(
|
|
728
|
+
/* @__PURE__ */ t(dt, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
706
729
|
/* @__PURE__ */ t(
|
|
707
730
|
"input",
|
|
708
731
|
{
|
|
@@ -714,9 +737,9 @@ function Qt({
|
|
|
714
737
|
)
|
|
715
738
|
] }),
|
|
716
739
|
/* @__PURE__ */ t(
|
|
717
|
-
|
|
740
|
+
ue,
|
|
718
741
|
{
|
|
719
|
-
value:
|
|
742
|
+
value: T,
|
|
720
743
|
onChange: (e) => {
|
|
721
744
|
Ie(e), q(1);
|
|
722
745
|
},
|
|
@@ -739,7 +762,7 @@ function Qt({
|
|
|
739
762
|
{
|
|
740
763
|
type: "checkbox",
|
|
741
764
|
checked: U,
|
|
742
|
-
onChange: (e) =>
|
|
765
|
+
onChange: (e) => Re(e.target.checked),
|
|
743
766
|
className: "h-3.5 w-3.5",
|
|
744
767
|
"data-notification-group-by-record": !0
|
|
745
768
|
}
|
|
@@ -768,7 +791,7 @@ function Qt({
|
|
|
768
791
|
}
|
|
769
792
|
)
|
|
770
793
|
] }),
|
|
771
|
-
/* @__PURE__ */ t(
|
|
794
|
+
/* @__PURE__ */ t(Dt, { notificationId: V, className: "max-w-3xl" })
|
|
772
795
|
]
|
|
773
796
|
}
|
|
774
797
|
),
|
|
@@ -778,17 +801,17 @@ function Qt({
|
|
|
778
801
|
className: "flex shrink-0 flex-wrap items-center gap-2 border-b border-nvr-cyan/30 bg-nvr-cyan/5 px-8 py-2 text-[12px] text-slate-700 dark:text-slate-200",
|
|
779
802
|
"data-notification-bulkbar": !0,
|
|
780
803
|
children: [
|
|
781
|
-
/* @__PURE__ */ t("span", { className: "font-medium", children: W ? `All ${
|
|
782
|
-
!W && F.size >= ye &&
|
|
804
|
+
/* @__PURE__ */ t("span", { className: "font-medium", children: W ? `All ${z} matching` : `${F.size} selected` }),
|
|
805
|
+
!W && F.size >= ye && z > ye && /* @__PURE__ */ n(
|
|
783
806
|
"button",
|
|
784
807
|
{
|
|
785
808
|
type: "button",
|
|
786
|
-
onClick: () =>
|
|
809
|
+
onClick: () => L(!0),
|
|
787
810
|
"data-notification-select-matching": !0,
|
|
788
811
|
className: "text-nvr-navy underline decoration-dotted underline-offset-2 dark:text-nvr-cyan",
|
|
789
812
|
children: [
|
|
790
813
|
"Select all ",
|
|
791
|
-
|
|
814
|
+
z,
|
|
792
815
|
" matching"
|
|
793
816
|
]
|
|
794
817
|
}
|
|
@@ -803,7 +826,7 @@ function Qt({
|
|
|
803
826
|
"data-notification-bulk": "read",
|
|
804
827
|
className: "inline-flex h-7 items-center gap-1 rounded-md border border-slate-200 bg-background px-2 text-[11.5px] font-medium hover:bg-slate-50 dark:border-border",
|
|
805
828
|
children: [
|
|
806
|
-
/* @__PURE__ */ t(
|
|
829
|
+
/* @__PURE__ */ t(de, { className: "h-3 w-3" }),
|
|
807
830
|
" Mark read"
|
|
808
831
|
]
|
|
809
832
|
}
|
|
@@ -818,7 +841,7 @@ function Qt({
|
|
|
818
841
|
"data-notification-bulk": "snooze",
|
|
819
842
|
className: "inline-flex h-7 items-center gap-1 rounded-md border border-slate-200 bg-background px-2 text-[11.5px] font-medium hover:bg-slate-50 dark:border-border",
|
|
820
843
|
children: [
|
|
821
|
-
/* @__PURE__ */ t(
|
|
844
|
+
/* @__PURE__ */ t(ie, { className: "h-3 w-3" }),
|
|
822
845
|
" Snooze"
|
|
823
846
|
]
|
|
824
847
|
}
|
|
@@ -843,7 +866,7 @@ function Qt({
|
|
|
843
866
|
"data-notification-bulk": "archive",
|
|
844
867
|
className: "inline-flex h-7 items-center gap-1 rounded-md border border-slate-200 bg-background px-2 text-[11.5px] font-medium hover:bg-slate-50 dark:border-border",
|
|
845
868
|
children: [
|
|
846
|
-
/* @__PURE__ */ t(
|
|
869
|
+
/* @__PURE__ */ t(we, { className: "h-3 w-3" }),
|
|
847
870
|
" Archive"
|
|
848
871
|
]
|
|
849
872
|
}
|
|
@@ -854,12 +877,12 @@ function Qt({
|
|
|
854
877
|
type: "button",
|
|
855
878
|
onClick: () => {
|
|
856
879
|
const e = [];
|
|
857
|
-
for (const a of [...
|
|
880
|
+
for (const a of [...D, ...O, ...H.flatMap((l) => l.rows)]) {
|
|
858
881
|
if (!F.has(a.id)) continue;
|
|
859
|
-
const l = Q(a,
|
|
882
|
+
const l = Q(a, f);
|
|
860
883
|
l && (l.type === "external" ? e.push(l.url) : l.type === "path" && typeof window < "u" && e.push(`${window.location.origin}${l.path}`));
|
|
861
884
|
}
|
|
862
|
-
e.length === 0 ? r == null || r("None of the selected notifications opens a page") : r == null || r(
|
|
885
|
+
e.length === 0 ? r == null || r("None of the selected notifications opens a page") : r == null || r(ht(xt(e)));
|
|
863
886
|
},
|
|
864
887
|
"data-notification-bulk": "tabs",
|
|
865
888
|
className: "inline-flex h-7 items-center gap-1 rounded-md border border-slate-200 bg-background px-2 text-[11.5px] font-medium hover:bg-slate-50 dark:border-border",
|
|
@@ -874,7 +897,7 @@ function Qt({
|
|
|
874
897
|
{
|
|
875
898
|
type: "button",
|
|
876
899
|
onClick: () => {
|
|
877
|
-
K(/* @__PURE__ */ new Set()),
|
|
900
|
+
K(/* @__PURE__ */ new Set()), L(!1);
|
|
878
901
|
},
|
|
879
902
|
className: "ml-auto text-[11.5px] text-slate-500 underline decoration-dotted underline-offset-2",
|
|
880
903
|
children: "Clear selection"
|
|
@@ -892,7 +915,7 @@ function Qt({
|
|
|
892
915
|
"input",
|
|
893
916
|
{
|
|
894
917
|
type: "checkbox",
|
|
895
|
-
checked:
|
|
918
|
+
checked: j,
|
|
896
919
|
onChange: (e) => Me(e.target.checked),
|
|
897
920
|
className: "h-3.5 w-3.5",
|
|
898
921
|
"data-nvr-sent-critical": !0
|
|
@@ -901,11 +924,11 @@ function Qt({
|
|
|
901
924
|
"Critical only"
|
|
902
925
|
] })
|
|
903
926
|
] }),
|
|
904
|
-
Te ? /* @__PURE__ */ t("p", { className: "py-10 text-[13px] text-slate-400", children: "Loading…" }) :
|
|
927
|
+
Te ? /* @__PURE__ */ t("p", { className: "py-10 text-[13px] text-slate-400", children: "Loading…" }) : be.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col items-center justify-center py-24 text-center", children: [
|
|
905
928
|
/* @__PURE__ */ t(Ce, { className: "h-10 w-10 text-slate-200 dark:text-slate-700" }),
|
|
906
929
|
/* @__PURE__ */ t("p", { className: "mt-3 text-[14px] font-medium text-slate-500", children: "Nothing sent yet" }),
|
|
907
|
-
/* @__PURE__ */ t("p", { className: "mt-1 text-[12px] text-slate-400", children:
|
|
908
|
-
] }) : /* @__PURE__ */ t("div", { className: "divide-y divide-slate-100 overflow-hidden rounded-lg border border-slate-200 bg-white dark:divide-border dark:border-border dark:bg-card", children:
|
|
930
|
+
/* @__PURE__ */ t("p", { className: "mt-1 text-[12px] text-slate-400", children: j ? 'No critical sends. Untick "Critical only" to see everything you sent.' : "Messages you send to stakeholders or colleagues appear here." })
|
|
931
|
+
] }) : /* @__PURE__ */ t("div", { className: "divide-y divide-slate-100 overflow-hidden rounded-lg border border-slate-200 bg-white dark:divide-border dark:border-border dark:bg-card", children: be.map((e) => /* @__PURE__ */ n("div", { className: "px-4 py-3", "data-nvr-sent-row": !0, children: [
|
|
909
932
|
/* @__PURE__ */ n("div", { className: "flex items-baseline gap-2", children: [
|
|
910
933
|
e.lane === "critical" && /* @__PURE__ */ t("span", { className: "shrink-0 rounded bg-red-500/10 px-1 text-[9.5px] font-bold uppercase tracking-wide text-red-600 dark:text-red-400", children: "Critical" }),
|
|
911
934
|
/* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-slate-900 dark:text-slate-100", children: e.subject.replace(/^critical:\s*/i, "") }),
|
|
@@ -962,41 +985,41 @@ function Qt({
|
|
|
962
985
|
}
|
|
963
986
|
),
|
|
964
987
|
a.name,
|
|
965
|
-
a.ack === "acked" && /* @__PURE__ */ t(
|
|
988
|
+
a.ack === "acked" && /* @__PURE__ */ t(se, { className: "h-3 w-3" })
|
|
966
989
|
]
|
|
967
990
|
},
|
|
968
991
|
a.id
|
|
969
992
|
)) })
|
|
970
993
|
] }, e.key)) })
|
|
971
|
-
] }) : Qe ? /* @__PURE__ */ t("p", { className: "px-8 py-10 text-[13px] text-slate-400", children: "Loading…" }) :
|
|
994
|
+
] }) : Qe ? /* @__PURE__ */ t("p", { className: "px-8 py-10 text-[13px] text-slate-400", children: "Loading…" }) : O.length === 0 && H.length === 0 && D.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col items-center justify-center py-24 text-center", children: [
|
|
972
995
|
/* @__PURE__ */ t(Ce, { className: "h-10 w-10 text-slate-200 dark:text-slate-700" }),
|
|
973
996
|
/* @__PURE__ */ t("p", { className: "mt-3 text-[14px] font-medium text-slate-500", children: "You're all caught up" }),
|
|
974
997
|
/* @__PURE__ */ t("p", { className: "mt-1 text-[12px] text-slate-400", children: i === "inbox" ? "No unread notifications." : "No notifications here." })
|
|
975
998
|
] }) : /* @__PURE__ */ n("div", { className: "mx-8 my-6 divide-y divide-slate-100 overflow-hidden rounded-lg border border-slate-200 bg-white dark:divide-border dark:border-border dark:bg-card", children: [
|
|
976
|
-
|
|
999
|
+
D.length > 0 && /* @__PURE__ */ n("div", { "data-notification-pinned": !0, children: [
|
|
977
1000
|
/* @__PURE__ */ n("div", { className: "bg-amber-50 px-4 py-1 text-[10.5px] font-semibold uppercase tracking-wide text-amber-700 dark:bg-amber-400/10 dark:text-amber-300", children: [
|
|
978
1001
|
"Needs your acknowledgement · ",
|
|
979
|
-
|
|
1002
|
+
D.length
|
|
980
1003
|
] }),
|
|
981
|
-
|
|
1004
|
+
D.map((e) => /* @__PURE__ */ t(oe, { children: le(e) }, `pin:${e.id}`))
|
|
982
1005
|
] }),
|
|
983
|
-
H.map(
|
|
984
|
-
|
|
985
|
-
const l = (
|
|
986
|
-
if (!
|
|
987
|
-
const
|
|
988
|
-
return
|
|
989
|
-
},
|
|
990
|
-
return /* @__PURE__ */ n(
|
|
991
|
-
|
|
1006
|
+
H.map(et),
|
|
1007
|
+
O.map((e, a) => {
|
|
1008
|
+
const l = (b) => {
|
|
1009
|
+
if (!b) return "Older";
|
|
1010
|
+
const c = new Date(b), k = /* @__PURE__ */ new Date(), re = new Date(k.getFullYear(), k.getMonth(), k.getDate());
|
|
1011
|
+
return c >= re ? "Today" : c >= new Date(re.getTime() - 864e5) ? "Yesterday" : c >= new Date(re.getTime() - 5184e5) ? "This week" : "Older";
|
|
1012
|
+
}, o = l(e.created_at), A = a > 0 ? l(O[a - 1].created_at) : null;
|
|
1013
|
+
return /* @__PURE__ */ n(oe, { children: [
|
|
1014
|
+
o !== A ? /* @__PURE__ */ t("div", { className: "bg-slate-50/80 px-4 py-1 text-[10.5px] font-semibold uppercase tracking-wide text-slate-400 dark:bg-muted/40", children: o }) : null,
|
|
992
1015
|
le(e)
|
|
993
1016
|
] }, e.id);
|
|
994
1017
|
})
|
|
995
1018
|
] }),
|
|
996
|
-
i !== "sent" &&
|
|
1019
|
+
i !== "sent" && z > me && /* @__PURE__ */ n("div", { className: "mx-8 mb-6 flex items-center justify-between", children: [
|
|
997
1020
|
/* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: [
|
|
998
1021
|
"Page ",
|
|
999
|
-
|
|
1022
|
+
_,
|
|
1000
1023
|
" of ",
|
|
1001
1024
|
E
|
|
1002
1025
|
] }),
|
|
@@ -1005,11 +1028,11 @@ function Qt({
|
|
|
1005
1028
|
"button",
|
|
1006
1029
|
{
|
|
1007
1030
|
type: "button",
|
|
1008
|
-
disabled:
|
|
1031
|
+
disabled: _ <= 1,
|
|
1009
1032
|
onClick: () => q((e) => Math.max(1, e - 1)),
|
|
1010
1033
|
className: "inline-flex h-7 items-center rounded-md border border-slate-200 px-2 text-[12px] disabled:opacity-40 dark:border-border",
|
|
1011
1034
|
children: [
|
|
1012
|
-
/* @__PURE__ */ t(
|
|
1035
|
+
/* @__PURE__ */ t(it, { className: "mr-1 h-3.5 w-3.5" }),
|
|
1013
1036
|
"Previous"
|
|
1014
1037
|
]
|
|
1015
1038
|
}
|
|
@@ -1018,12 +1041,12 @@ function Qt({
|
|
|
1018
1041
|
"button",
|
|
1019
1042
|
{
|
|
1020
1043
|
type: "button",
|
|
1021
|
-
disabled:
|
|
1044
|
+
disabled: _ >= E,
|
|
1022
1045
|
onClick: () => q((e) => Math.min(E, e + 1)),
|
|
1023
1046
|
className: "inline-flex h-7 items-center rounded-md border border-slate-200 px-2 text-[12px] disabled:opacity-40 dark:border-border",
|
|
1024
1047
|
children: [
|
|
1025
1048
|
"Next",
|
|
1026
|
-
/* @__PURE__ */ t(
|
|
1049
|
+
/* @__PURE__ */ t(st, { className: "ml-1 h-3.5 w-3.5" })
|
|
1027
1050
|
]
|
|
1028
1051
|
}
|
|
1029
1052
|
)
|
|
@@ -1031,15 +1054,15 @@ function Qt({
|
|
|
1031
1054
|
] })
|
|
1032
1055
|
] }),
|
|
1033
1056
|
/* @__PURE__ */ t(
|
|
1034
|
-
|
|
1057
|
+
kt,
|
|
1035
1058
|
{
|
|
1036
|
-
notificationId: (
|
|
1037
|
-
title: (
|
|
1038
|
-
onClose: () =>
|
|
1059
|
+
notificationId: (h == null ? void 0 : h.id) ?? null,
|
|
1060
|
+
title: (h == null ? void 0 : h.subject) ?? (h == null ? void 0 : h.title) ?? null,
|
|
1061
|
+
onClose: () => ge(null)
|
|
1039
1062
|
}
|
|
1040
1063
|
)
|
|
1041
1064
|
] });
|
|
1042
1065
|
}
|
|
1043
1066
|
export {
|
|
1044
|
-
|
|
1067
|
+
Yt as NotificationCenterView
|
|
1045
1068
|
};
|