@nivaro/react 0.3.127 → 0.3.128

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.
Files changed (39) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +20 -2
  4. package/dist/index.js +150 -147
  5. package/dist/shared/components/CollectionBrowserView.js +3259 -3211
  6. package/dist/shared/components/DataTable.js +406 -401
  7. package/dist/shared/components/ItemEditForm.js +4203 -4156
  8. package/dist/shared/components/MatrixEditor.js +548 -490
  9. package/dist/shared/components/MyWorkView.js +284 -274
  10. package/dist/shared/components/NotificationBell.js +264 -218
  11. package/dist/shared/components/RecordGridEditor.js +582 -472
  12. package/dist/shared/components/chat/chat-core.js +331 -346
  13. package/dist/shared/components/chat/chat-typing.js +25 -0
  14. package/dist/shared/components/command-center/CommandCenterView.js +1 -1
  15. package/dist/shared/components/command-center/PeekPanel.js +8 -1
  16. package/dist/shared/components/command-center/api.js +17 -9
  17. package/dist/shared/components/command-center/panels/AttentionPanel.js +4 -1
  18. package/dist/shared/components/command-center/panels/PartnersPanel.js +2 -1
  19. package/dist/shared/components/item-edit/GroupSection.js +1 -1
  20. package/dist/shared/components/item-edit/InlineTableField.js +432 -429
  21. package/dist/shared/components/item-edit/RecordLiveSync.js +115 -108
  22. package/dist/shared/components/item-edit/RecordViewersChip.js +17 -16
  23. package/dist/shared/components/item-edit/RowComments.js +33 -30
  24. package/dist/shared/components/item-edit/cascade-clear-notice.js +30 -28
  25. package/dist/shared/components/item-edit/live-related.js +29 -16
  26. package/dist/shared/components/item-edit/record-opened-live.js +86 -0
  27. package/dist/shared/components/panels/OwnerOpenedLine.js +24 -23
  28. package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
  29. package/dist/shared/components/pipeline/TeamSuggestions.js +1 -1
  30. package/dist/shared/components/queue/QueueItemSheet.js +171 -130
  31. package/dist/shared/components/record-grid-guard.js +85 -0
  32. package/dist/shared/components/support/TicketDetailSheet.js +168 -151
  33. package/dist/shared/lib/at-risk-fields.js +14 -0
  34. package/dist/shared/lib/live-queries.js +9 -8
  35. package/dist/shared/lib/live-screen.js +77 -76
  36. package/dist/shared/lib/presence-hooks.js +190 -127
  37. package/dist/shared/lib/user-sync.js +78 -65
  38. package/dist/shared/lib/waiting-count.js +40 -29
  39. package/package.json +1 -1
@@ -1,105 +1,122 @@
1
- import { jsxs as n, jsx as t, Fragment as _e } from "react/jsx-runtime";
2
- import { readUnreadNotificationCount as Me, markNotificationRead as Se, markNotificationsRead as qe, markAllNotificationsRead as Le } from "@nivaro/sdk";
3
- import { useQueryClient as Ae, useQuery as de, useMutation as A } from "@tanstack/react-query";
4
- import { Bell as Ee, CheckCheck as Fe, ExternalLink as ce, Check as E, History as Ie, ShieldCheck as Te, ChevronDown as De } from "lucide-react";
5
- import { useState as _, useRef as z, useEffect as Q, useMemo as ue, Fragment as pe } from "react";
6
- import { createPortal as Be } from "react-dom";
7
- import { useNivaroClient as Ke } from "../context.js";
8
- import { get as Oe, post as Pe } from "../lib/commands.js";
9
- import { createCoalescer as je } from "../lib/live-counts.js";
10
- import { useLiveRefetchInterval as ze } from "../lib/live-queries.js";
11
- import { resolveNotificationTargetFor as M, runNotificationTarget as F } from "../lib/notification-target.js";
12
- import { useRecordPeek as Qe, notificationPeekTarget as He, isNewTabClick as Ge } from "../lib/record-peek.js";
13
- import { cn as Ue, formatRelative as Ye } from "../lib/utils.js";
14
- import { AgentBadge as Ve } from "./AgentBadge.js";
15
- import { LiveCount as me } from "./LiveCount.js";
16
- import { AsItWasSheet as We } from "./notifications/AsItWasSheet.js";
17
- import { bundleLocally as Je, laneTone as Xe, bundleAsNotification as Ze, bundleHeadline as et, categoryChipLabel as tt } from "./notifications/bundles.js";
18
- import { DeliveryChips as at } from "./notifications/DeliveryChips.js";
19
- import { NotificationActions as rt } from "./notifications/NotificationActions.js";
20
- import { ResolvedLine as nt, NotificationDetailBits as ot } from "./notifications/NotificationDetailBits.js";
21
- import { RelativeTime as lt } from "./RelativeTime.js";
22
- function it(r) {
23
- var m, k;
1
+ import { jsxs as n, jsx as t, Fragment as Ke } from "react/jsx-runtime";
2
+ import { readUnreadNotificationCount as Be, markNotificationRead as Pe, markNotificationsRead as Oe, markAllNotificationsRead as je } from "@nivaro/sdk";
3
+ import { useQueryClient as ze, useQuery as xe, keepPreviousData as Qe, useMutation as E } from "@tanstack/react-query";
4
+ import { Bell as He, CheckCheck as Ge, ExternalLink as be, Check as I, History as Ue, ShieldCheck as Ye, ChevronDown as Ve } from "lucide-react";
5
+ import { useState as _, useRef as U, useCallback as We, useEffect as Y, useMemo as ge, Fragment as ke } from "react";
6
+ import { createPortal as Je } from "react-dom";
7
+ import { useNivaroClient as Xe } from "../context.js";
8
+ import { get as Ze, post as et } from "../lib/commands.js";
9
+ import { createCoalescer as tt } from "../lib/live-counts.js";
10
+ import { useLiveRefetchInterval as at } from "../lib/live-queries.js";
11
+ import { useTopInserts as ve } from "../lib/live-screen.js";
12
+ import { resolveNotificationTargetFor as S, runNotificationTarget as D } from "../lib/notification-target.js";
13
+ import { useRecordPeek as rt, notificationPeekTarget as nt, isNewTabClick as ot } from "../lib/record-peek.js";
14
+ import { cn as we, formatRelative as lt } from "../lib/utils.js";
15
+ import { AgentBadge as it } from "./AgentBadge.js";
16
+ import { LiveCount as ye } from "./LiveCount.js";
17
+ import { AsItWasSheet as st } from "./notifications/AsItWasSheet.js";
18
+ import { bundleLocally as dt, laneTone as ct, bundleAsNotification as ut, bundleHeadline as pt, categoryChipLabel as mt } from "./notifications/bundles.js";
19
+ import { DeliveryChips as ft } from "./notifications/DeliveryChips.js";
20
+ import { NotificationActions as ht } from "./notifications/NotificationActions.js";
21
+ import { ResolvedLine as xt, NotificationDetailBits as bt } from "./notifications/NotificationDetailBits.js";
22
+ import { RelativeTime as gt } from "./RelativeTime.js";
23
+ import { SkeletonBar as Ne } from "./Skeletons.js";
24
+ function kt(r) {
25
+ var f, v;
24
26
  if (!r) return null;
25
27
  if (r.target_label && r.kind !== "record") return r.target_label;
26
28
  if (String(r.collection ?? "") === "__chat__") return "Chat";
27
29
  if (!r.collection) return null;
28
- const c = ((m = r.record_collection_label) == null ? void 0 : m.trim()) || (() => {
29
- const h = String(r.collection).replace(/_/g, " ").trim();
30
- return h ? h.charAt(0).toUpperCase() + h.slice(1) : null;
31
- })(), u = (k = r.record_label) == null ? void 0 : k.trim();
30
+ const c = ((f = r.record_collection_label) == null ? void 0 : f.trim()) || (() => {
31
+ const b = String(r.collection).replace(/_/g, " ").trim();
32
+ return b ? b.charAt(0).toUpperCase() + b.slice(1) : null;
33
+ })(), u = (v = r.record_label) == null ? void 0 : v.trim();
32
34
  return c && u ? `${c} ${u}` : u || c || null;
33
35
  }
34
- function st(r) {
36
+ function vt(r) {
35
37
  var c, u;
36
- return fe(r) ? r.revision_id != null || (((u = (c = r.detail) == null ? void 0 : c.changes) == null ? void 0 : u.length) ?? 0) > 0 || r.category === "watch" || r.category === "workflow" : !1;
38
+ return Ce(r) ? r.revision_id != null || (((u = (c = r.detail) == null ? void 0 : c.changes) == null ? void 0 : u.length) ?? 0) > 0 || r.category === "watch" || r.category === "workflow" : !1;
37
39
  }
38
- function fe(r) {
39
- var k, h, S;
40
- if ((((k = r.target) == null ? void 0 : k.kind) ?? r.kind ?? (r.collection && r.item ? "record" : null)) !== "record") return !1;
41
- const u = ((h = r.target) == null ? void 0 : h.collection) ?? r.collection, m = ((S = r.target) == null ? void 0 : S.id) ?? r.item;
42
- return !!u && m != null && m !== "" && !/^(nivaro|directus)_|^__/i.test(u);
40
+ function Ce(r) {
41
+ var v, b, M;
42
+ if ((((v = r.target) == null ? void 0 : v.kind) ?? r.kind ?? (r.collection && r.item ? "record" : null)) !== "record") return !1;
43
+ const u = ((b = r.target) == null ? void 0 : b.collection) ?? r.collection, f = ((M = r.target) == null ? void 0 : M.id) ?? r.item;
44
+ return !!u && f != null && f !== "" && !/^(nivaro|directus)_|^__/i.test(u);
43
45
  }
44
- function qt({
46
+ const wt = (r) => `n:${r.id}`, yt = (r) => `b:${r.collection}:${r.item}`;
47
+ function Gt({
45
48
  routes: r,
46
49
  onNavigate: c,
47
50
  app: u,
48
- subscribe: m,
49
- buttonClassName: k,
50
- panelClassName: h,
51
- beforeList: S,
52
- extraBadge: xe = 0,
53
- mailLogUrl: he,
54
- renderTrigger: H,
55
- allPath: G,
56
- subscriptionsPath: be,
57
- rulesPath: ke,
58
- onActionError: ge,
51
+ subscribe: f,
52
+ buttonClassName: v,
53
+ panelClassName: b,
54
+ beforeList: M,
55
+ extraBadge: $e = 0,
56
+ mailLogUrl: Re,
57
+ renderTrigger: V,
58
+ allPath: W,
59
+ subscriptionsPath: _e,
60
+ rulesPath: Se,
61
+ onActionError: Me,
59
62
  panelPlacement: R = "below"
60
63
  }) {
61
- const y = Ke(), I = Qe(), [g, p] = _(!1), [v, U] = _("attention"), T = z(null), Y = z(null), [D, ve] = _(null), V = Ae(), N = () => {
62
- V.invalidateQueries({ queryKey: ["notification-count"] }), V.invalidateQueries({ queryKey: ["notifications"] });
63
- }, we = ze(6e4, { enabled: !!m, safetyMs: 12e4 }), { data: f } = de({
64
+ const y = Xe(), T = rt(), [g, m] = _(!1), [h, J] = _("attention"), K = U(null), X = U(null), [B, Fe] = _(null), Z = ze(), N = () => {
65
+ Z.invalidateQueries({ queryKey: ["notification-count"] }), Z.invalidateQueries({ queryKey: ["notifications"] });
66
+ }, qe = at(6e4, { enabled: !!f, safetyMs: 12e4 }), { data: x } = xe({
64
67
  queryKey: ["notification-count"],
65
- queryFn: () => y.request(Me()),
66
- refetchInterval: we
67
- }), B = (f == null ? void 0 : f.unread) ?? 0, W = (f == null ? void 0 : f.attention) ?? B, q = (f == null ? void 0 : f.lanes) ?? { critical: 0, fyi: 0 }, C = B + xe, { data: x } = de({
68
- queryKey: ["notifications", "bell", u ?? null, v],
68
+ queryFn: () => y.request(Be()),
69
+ refetchInterval: qe
70
+ }), P = (x == null ? void 0 : x.unread) ?? 0, ee = (x == null ? void 0 : x.attention) ?? P, F = (x == null ? void 0 : x.lanes) ?? { critical: 0, fyi: 0 }, C = P + $e, { data: p, isPlaceholderData: O } = xe({
71
+ queryKey: ["notifications", "bell", u ?? null, h],
69
72
  queryFn: () => y.request(
70
- Oe("/notifications", {
73
+ Ze("/notifications", {
71
74
  limit: 60,
72
75
  app: u,
73
76
  bundle: "record",
74
- ...v === "attention" ? { lane: "attention", status: "inbox" } : {},
75
- ...v === "fyi" ? { lane: "fyi", status: "inbox" } : {}
77
+ ...h === "attention" ? { lane: "attention", status: "inbox" } : {},
78
+ ...h === "fyi" ? { lane: "fyi", status: "inbox" } : {}
76
79
  })
77
80
  ).then((e) => {
78
81
  const a = e.pinned ?? [], o = new Set(a.map((s) => s.id)), i = (e.data ?? []).filter((s) => !o.has(s.id));
79
- return e.bundles ? { rows: i, bundles: e.bundles, pinned: a } : { ...Je(i), pinned: a };
82
+ return e.bundles ? { rows: i, bundles: e.bundles, pinned: a } : { ...dt(i), pinned: a };
80
83
  }),
81
- enabled: g
82
- }), J = (x == null ? void 0 : x.rows) ?? [], K = (x == null ? void 0 : x.pinned) ?? [], X = (x == null ? void 0 : x.bundles) ?? [], [ye, Z] = _(() => /* @__PURE__ */ new Set()), [$, O] = _(null), ee = z(N);
83
- ee.current = N, Q(() => {
84
- if (!m) return;
85
- const e = je(() => ee.current()), a = m(() => e.poke());
84
+ enabled: g,
85
+ // R8: a lane switch keeps the last list (dimmed) until the new lane answers — no
86
+ // "Nothing needs you" flash between them.
87
+ placeholderData: Qe
88
+ }), te = g && !!p && !O, q = ve(p ? p.rows : void 0, wt, {
89
+ enabled: te,
90
+ resetKey: `${h}|${u ?? ""}`
91
+ }), L = ve(p ? p.bundles : void 0, yt, {
92
+ enabled: te,
93
+ resetKey: `${h}|${u ?? ""}`
94
+ }), ae = p ? q.rows : [], j = (p == null ? void 0 : p.pinned) ?? [], re = p ? L.rows : [], z = q.held + L.held, ne = q.rootRef, oe = L.rootRef, Le = We(
95
+ (e) => {
96
+ ne(e), oe(e);
97
+ },
98
+ [ne, oe]
99
+ ), [Ae, le] = _(() => /* @__PURE__ */ new Set()), [$, Q] = _(null), ie = U(N);
100
+ ie.current = N, Y(() => {
101
+ if (!f) return;
102
+ const e = tt(() => ie.current()), a = f(() => e.poke());
86
103
  return () => {
87
104
  a(), e.cancel();
88
105
  };
89
- }, [m]), Q(() => {
106
+ }, [f]), Y(() => {
90
107
  if (!g) return;
91
108
  const e = (a) => {
92
109
  var i, s;
93
110
  const o = a.target;
94
- (i = T.current) != null && i.contains(o) || (s = Y.current) != null && s.contains(o) || p(!1);
111
+ (i = K.current) != null && i.contains(o) || (s = X.current) != null && s.contains(o) || m(!1);
95
112
  };
96
113
  return window.addEventListener("mousedown", e), () => window.removeEventListener("mousedown", e);
97
- }, [g]), Q(() => {
114
+ }, [g]), Y(() => {
98
115
  if (!g || R !== "right") return;
99
116
  const e = () => {
100
117
  var o;
101
- const a = (o = T.current) == null ? void 0 : o.getBoundingClientRect();
102
- a && ve({
118
+ const a = (o = K.current) == null ? void 0 : o.getBoundingClientRect();
119
+ a && Fe({
103
120
  left: Math.round(a.right + 12),
104
121
  bottom: Math.max(8, Math.round(window.innerHeight - a.bottom))
105
122
  });
@@ -108,21 +125,21 @@ function qt({
108
125
  window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
109
126
  };
110
127
  }, [g, R]);
111
- const te = A({
112
- mutationFn: (e) => y.request(Pe(`/notifications/${e}/acknowledge`)),
128
+ const se = E({
129
+ mutationFn: (e) => y.request(et(`/notifications/${e}/acknowledge`)),
113
130
  onSuccess: N
114
- }), L = A({
115
- mutationFn: (e) => y.request(Se(e)),
131
+ }), A = E({
132
+ mutationFn: (e) => y.request(Pe(e)),
116
133
  onSuccess: N
117
- }), P = A({
118
- mutationFn: (e) => y.request(qe(e)),
134
+ }), H = E({
135
+ mutationFn: (e) => y.request(Oe(e)),
119
136
  onSuccess: N
120
- }), Ne = A({
121
- mutationFn: () => y.request(Le()),
137
+ }), Ee = E({
138
+ mutationFn: () => y.request(je()),
122
139
  onSuccess: N
123
- }), ae = ue(() => J.slice(0, 40), [J]), re = ue(() => {
140
+ }), de = ge(() => ae.slice(0, 40), [ae]), ce = ge(() => {
124
141
  const e = /* @__PURE__ */ new Map();
125
- for (const a of ae) {
142
+ for (const a of de) {
126
143
  const o = a.collection && a.item ? `${a.collection}:${a.item}` : `single:${a.id}`, i = e.get(o) ?? {
127
144
  key: o,
128
145
  collection: a.collection ?? null,
@@ -132,19 +149,19 @@ function qt({
132
149
  i.rows.push(a), e.set(o, i);
133
150
  }
134
151
  return [...e.values()];
135
- }, [ae]), Ce = (e, a) => {
136
- const o = I ? He(e) : null;
137
- if (o && I && !Ge(a)) {
138
- p(!1), I.open(o);
152
+ }, [de]), Ie = (e, a) => {
153
+ const o = T ? nt(e) : null;
154
+ if (o && T && !ot(a)) {
155
+ m(!1), T.open(o);
139
156
  return;
140
157
  }
141
- const i = M(e, r);
142
- i && (p(!1), F(i, c));
143
- }, ne = (e) => {
144
- p(!1), c(e);
145
- }, j = (e, a, o = !1) => {
146
- var w, le, ie, se;
147
- const i = M(e, r) != null, s = `py-2 pr-3 ${o ? "pl-7" : "pl-3"}`, b = /* @__PURE__ */ n(_e, { children: [
158
+ const i = S(e, r);
159
+ i && (m(!1), D(i, c));
160
+ }, ue = (e) => {
161
+ m(!1), c(e);
162
+ }, G = (e, a, o = !1) => {
163
+ var w, me, fe, he;
164
+ const i = S(e, r) != null, s = `py-2 pr-3 ${o ? "pl-7" : "pl-3"}`, k = /* @__PURE__ */ n(Ke, { children: [
148
165
  /* @__PURE__ */ t(
149
166
  "span",
150
167
  {
@@ -163,19 +180,19 @@ function qt({
163
180
  }
164
181
  ),
165
182
  e.message && /* @__PURE__ */ t("span", { className: "mt-0.5 line-clamp-2 whitespace-pre-line text-[11px] leading-snug text-slate-500", children: e.message.replace(/<[^>]+>/g, "") }),
166
- /* @__PURE__ */ t(nt, { resolved: (w = e.detail) == null ? void 0 : w.resolved }),
183
+ /* @__PURE__ */ t(xt, { resolved: (w = e.detail) == null ? void 0 : w.resolved }),
167
184
  /* @__PURE__ */ n("span", { className: "mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[10.5px] text-slate-400", children: [
168
- /* @__PURE__ */ t(lt, { value: e.created_at }),
169
- /* @__PURE__ */ t(Ve, { label: (le = e.detail) == null ? void 0 : le.via_agent }),
185
+ /* @__PURE__ */ t(gt, { value: e.created_at }),
186
+ /* @__PURE__ */ t(it, { label: (me = e.detail) == null ? void 0 : me.via_agent }),
170
187
  /* @__PURE__ */ t(
171
- at,
188
+ ft,
172
189
  {
173
190
  delivery: e.delivery,
174
- mailLogUrl: he,
175
- onNavigate: ne
191
+ mailLogUrl: Re,
192
+ onNavigate: ue
176
193
  }
177
194
  ),
178
- fe(e) && // biome-ignore lint/a11y/useSemanticElements: nested inside the row's <button> — a real <button> is invalid there
195
+ Ce(e) && // biome-ignore lint/a11y/useSemanticElements: nested inside the row's <button> — a real <button> is invalid there
179
196
  /* @__PURE__ */ n(
180
197
  "span",
181
198
  {
@@ -184,14 +201,14 @@ function qt({
184
201
  "data-notification-as-it-was": e.id,
185
202
  "data-tip": "The record as it was when you were told",
186
203
  onClick: (d) => {
187
- d.stopPropagation(), p(!1), O(e);
204
+ d.stopPropagation(), m(!1), Q(e);
188
205
  },
189
206
  onKeyDown: (d) => {
190
- (d.key === "Enter" || d.key === " ") && (d.preventDefault(), d.stopPropagation(), p(!1), O(e));
207
+ (d.key === "Enter" || d.key === " ") && (d.preventDefault(), d.stopPropagation(), m(!1), Q(e));
191
208
  },
192
209
  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",
193
210
  children: [
194
- /* @__PURE__ */ t(Ie, { className: "h-3 w-3" }),
211
+ /* @__PURE__ */ t(Ue, { className: "h-3 w-3" }),
195
212
  "Record when sent"
196
213
  ]
197
214
  }
@@ -199,18 +216,18 @@ function qt({
199
216
  ] })
200
217
  ] })
201
218
  ] }), l = "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";
202
- return /* @__PURE__ */ n(pe, { children: [
219
+ return /* @__PURE__ */ n(ke, { children: [
203
220
  i ? /* @__PURE__ */ n(
204
221
  "button",
205
222
  {
206
223
  type: "button",
207
224
  onClick: (d) => {
208
- e.read || L.mutate(e.id), Ce(e, d);
225
+ e.read || A.mutate(e.id), Ie(e, d);
209
226
  },
210
227
  className: `flex w-full items-start gap-2.5 text-left transition-colors hover:bg-slate-50 dark:hover:bg-muted ${s}`,
211
228
  "data-notification-row": e.id,
212
229
  children: [
213
- b,
230
+ k,
214
231
  !a && !e.read && // biome-ignore lint/a11y/useSemanticElements: nested inside the row's <button> — a real <button> is invalid there
215
232
  /* @__PURE__ */ t(
216
233
  "span",
@@ -220,13 +237,13 @@ function qt({
220
237
  "aria-label": "Mark read",
221
238
  "data-tip": "Mark read",
222
239
  onClick: (d) => {
223
- d.stopPropagation(), L.mutate(e.id);
240
+ d.stopPropagation(), A.mutate(e.id);
224
241
  },
225
242
  onKeyDown: (d) => {
226
- (d.key === "Enter" || d.key === " ") && (d.preventDefault(), d.stopPropagation(), L.mutate(e.id));
243
+ (d.key === "Enter" || d.key === " ") && (d.preventDefault(), d.stopPropagation(), A.mutate(e.id));
227
244
  },
228
245
  className: l,
229
- children: /* @__PURE__ */ t(E, { className: "h-3 w-3" })
246
+ children: /* @__PURE__ */ t(I, { className: "h-3 w-3" })
230
247
  }
231
248
  )
232
249
  ]
@@ -238,7 +255,7 @@ function qt({
238
255
  "data-notification-row": e.id,
239
256
  "data-notification-plain": !0,
240
257
  children: [
241
- b,
258
+ k,
242
259
  /* @__PURE__ */ t(
243
260
  "button",
244
261
  {
@@ -246,54 +263,54 @@ function qt({
246
263
  "aria-label": "Mark read",
247
264
  "data-tip": "Mark read",
248
265
  tabIndex: e.read ? -1 : void 0,
249
- onClick: () => L.mutate(e.id),
250
- className: Ue(l, "shrink-0", e.read && "invisible"),
251
- children: /* @__PURE__ */ t(E, { className: "h-3 w-3" })
266
+ onClick: () => A.mutate(e.id),
267
+ className: we(l, "shrink-0", e.read && "invisible"),
268
+ children: /* @__PURE__ */ t(I, { className: "h-3 w-3" })
252
269
  }
253
270
  )
254
271
  ]
255
272
  }
256
273
  ),
257
- ((ie = e.ack) == null ? void 0 : ie.required) && !e.ack.at && /* @__PURE__ */ t("div", { className: `pb-2 pr-3 ${o ? "pl-[46px]" : "pl-[30px]"}`, children: /* @__PURE__ */ n(
274
+ ((fe = e.ack) == null ? void 0 : fe.required) && !e.ack.at && /* @__PURE__ */ t("div", { className: `pb-2 pr-3 ${o ? "pl-[46px]" : "pl-[30px]"}`, children: /* @__PURE__ */ n(
258
275
  "button",
259
276
  {
260
277
  type: "button",
261
- disabled: te.isPending,
262
- onClick: () => te.mutate(e.id),
278
+ disabled: se.isPending,
279
+ onClick: () => se.mutate(e.id),
263
280
  "data-notification-acknowledge": e.id,
264
281
  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",
265
282
  children: [
266
- /* @__PURE__ */ t(Te, { className: "h-3 w-3" }),
283
+ /* @__PURE__ */ t(Ye, { className: "h-3 w-3" }),
267
284
  "Acknowledge"
268
285
  ]
269
286
  }
270
287
  ) }),
271
- e.actions && e.actions.length > 0 && !e.read && !((se = e.detail) != null && se.resolved) && /* @__PURE__ */ t(
272
- rt,
288
+ e.actions && e.actions.length > 0 && !e.read && !((he = e.detail) != null && he.resolved) && /* @__PURE__ */ t(
289
+ ht,
273
290
  {
274
291
  actions: e.actions,
275
292
  notificationId: e.id,
276
- onError: ge,
293
+ onError: Me,
277
294
  className: `pb-2 pr-3 ${o ? "pl-[46px]" : "pl-[30px]"}`
278
295
  }
279
296
  ),
280
297
  /* @__PURE__ */ t(
281
- ot,
298
+ bt,
282
299
  {
283
300
  detail: e.detail,
284
301
  why: e.why,
285
302
  delivery: e.delivery,
286
303
  notificationId: e.id,
287
- recordChanges: st(e),
288
- subscriptionsPath: be,
289
- rulesPath: ke,
290
- onNavigate: ne,
304
+ recordChanges: vt(e),
305
+ subscriptionsPath: _e,
306
+ rulesPath: Se,
307
+ onNavigate: ue,
291
308
  className: `pb-3 pr-3 ${o ? "pl-[46px]" : "pl-[30px]"}`
292
309
  }
293
310
  )
294
311
  ] }, e.id);
295
- }, $e = (e) => {
296
- const a = `${e.collection}:${e.item}`, o = ye.has(a), i = Xe(e.lane), s = e.deleted ? null : M(Ze(e), r), b = e.rows.filter((l) => !l.read).map((l) => l.id);
312
+ }, De = (e) => {
313
+ const a = `${e.collection}:${e.item}`, o = Ae.has(a), i = ct(e.lane), s = e.deleted ? null : S(ut(e), r), k = e.rows.filter((l) => !l.read).map((l) => l.id);
297
314
  return /* @__PURE__ */ n(
298
315
  "div",
299
316
  {
@@ -311,13 +328,13 @@ function qt({
311
328
  "aria-expanded": o,
312
329
  "aria-label": o ? "Collapse" : "Expand",
313
330
  "data-notification-bundle-expand": a,
314
- onClick: () => Z((l) => {
331
+ onClick: () => le((l) => {
315
332
  const w = new Set(l);
316
333
  return w.has(a) ? w.delete(a) : w.add(a), w;
317
334
  }),
318
335
  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",
319
336
  children: /* @__PURE__ */ t(
320
- De,
337
+ Ve,
321
338
  {
322
339
  className: `h-3.5 w-3.5 transition-transform ${o ? "" : "-rotate-90"}`
323
340
  }
@@ -329,7 +346,7 @@ function qt({
329
346
  {
330
347
  type: "button",
331
348
  onClick: () => {
332
- s ? (p(!1), F(s, c)) : Z((l) => new Set(l).add(a));
349
+ s ? (m(!1), D(s, c)) : le((l) => new Set(l).add(a));
333
350
  },
334
351
  className: "min-w-0 flex-1 text-left",
335
352
  children: [
@@ -344,7 +361,7 @@ function qt({
344
361
  "span",
345
362
  {
346
363
  className: `truncate text-[12.5px] ${e.unread > 0 ? `font-medium ${i.text}` : "font-normal text-slate-600 dark:text-slate-400"}`,
347
- children: et(e)
364
+ children: pt(e)
348
365
  }
349
366
  )
350
367
  ] }),
@@ -378,11 +395,11 @@ function qt({
378
395
  {
379
396
  className: "rounded bg-slate-100 px-1 py-px text-[9.5px] font-medium text-slate-600 dark:bg-muted dark:text-slate-300",
380
397
  "data-notification-bundle-category": l,
381
- children: tt(l)
398
+ children: mt(l)
382
399
  },
383
400
  l
384
401
  )),
385
- /* @__PURE__ */ t("span", { children: e.newest ? Ye(e.newest) : "" }),
402
+ /* @__PURE__ */ t("span", { children: e.newest ? lt(e.newest) : "" }),
386
403
  e.unread > 0 && e.unread < e.count && /* @__PURE__ */ n("span", { children: [
387
404
  "· ",
388
405
  e.unread,
@@ -401,22 +418,22 @@ function qt({
401
418
  "data-tip": "Open record",
402
419
  "data-notification-open-record": !0,
403
420
  onClick: () => {
404
- p(!1), F(s, c);
421
+ m(!1), D(s, c);
405
422
  },
406
423
  className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
407
- children: /* @__PURE__ */ t(ce, { className: "h-3 w-3" })
424
+ children: /* @__PURE__ */ t(be, { className: "h-3 w-3" })
408
425
  }
409
426
  ),
410
- b.length > 0 && /* @__PURE__ */ t(
427
+ k.length > 0 && /* @__PURE__ */ t(
411
428
  "button",
412
429
  {
413
430
  type: "button",
414
431
  "aria-label": "Mark read",
415
432
  "data-tip": "Mark read",
416
433
  "data-notification-bundle-read": a,
417
- onClick: () => P.mutate(b),
434
+ onClick: () => H.mutate(k),
418
435
  className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
419
- children: /* @__PURE__ */ t(E, { className: "h-3 w-3" })
436
+ children: /* @__PURE__ */ t(I, { className: "h-3 w-3" })
420
437
  }
421
438
  )
422
439
  ] })
@@ -426,144 +443,173 @@ function qt({
426
443
  {
427
444
  className: "border-t border-slate-50 bg-slate-50/50 dark:border-border/50 dark:bg-muted/30",
428
445
  "data-notification-bundle-rows": a,
429
- children: e.rows.map((l) => j(l, !0, !0))
446
+ children: e.rows.map((l) => G(l, !0, !0))
430
447
  }
431
448
  )
432
449
  ]
433
450
  },
434
451
  `bundle:${a}`
435
452
  );
436
- }, Re = [
437
- { key: "attention", label: "Needs you", count: W },
438
- { key: "fyi", label: "FYI", count: q.fyi },
453
+ }, Te = [
454
+ { key: "attention", label: "Needs you", count: ee },
455
+ { key: "fyi", label: "FYI", count: F.fyi },
439
456
  { key: "all", label: "All", count: null }
440
- ], oe = () => p((e) => (!e && v === "attention" && W === 0 && q.fyi > 0 && U("fyi"), !e));
441
- return /* @__PURE__ */ n("div", { ref: T, className: "relative", "data-nvr-notification-bell": !0, children: [
442
- H ? H({ open: g, badge: C, toggle: oe }) : /* @__PURE__ */ n(
457
+ ], pe = () => m((e) => (!e && h === "attention" && ee === 0 && F.fyi > 0 && J("fyi"), !e));
458
+ return /* @__PURE__ */ n("div", { ref: K, className: "relative", "data-nvr-notification-bell": !0, children: [
459
+ V ? V({ open: g, badge: C, toggle: pe }) : /* @__PURE__ */ n(
443
460
  "button",
444
461
  {
445
462
  type: "button",
446
- onClick: oe,
447
- className: k ?? "relative rounded-md p-1.5 text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-muted",
463
+ onClick: pe,
464
+ className: v ?? "relative rounded-md p-1.5 text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-muted",
448
465
  "aria-label": C ? `Notifications (${C} unread)` : "Notifications",
449
466
  children: [
450
- /* @__PURE__ */ t(Ee, { className: "h-4 w-4", strokeWidth: 1.8 }),
467
+ /* @__PURE__ */ t(He, { className: "h-4 w-4", strokeWidth: 1.8 }),
451
468
  C > 0 && /* @__PURE__ */ t(
452
469
  "span",
453
470
  {
454
471
  "data-nvr-recording-hide": !0,
455
- 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 ${q.critical > 0 ? "bg-red-500 text-white" : "bg-nvr-cyan text-nvr-navy"}`,
456
- children: /* @__PURE__ */ t(me, { value: C > 99 ? "99+" : C })
472
+ 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 ${F.critical > 0 ? "bg-red-500 text-white" : "bg-nvr-cyan text-nvr-navy"}`,
473
+ children: /* @__PURE__ */ t(ye, { value: C > 99 ? "99+" : C })
457
474
  }
458
475
  )
459
476
  ]
460
477
  }
461
478
  ),
462
- g && (R === "right" ? Be : (e) => e)(
479
+ g && (R === "right" ? Je : (e) => e)(
463
480
  /* @__PURE__ */ n(
464
481
  "div",
465
482
  {
466
- ref: Y,
467
- className: `${R === "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 ${h ?? ""}`,
468
- style: R === "right" && D ? { left: D.left, bottom: D.bottom } : void 0,
483
+ ref: X,
484
+ className: `${R === "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 ${b ?? ""}`,
485
+ style: R === "right" && B ? { left: B.left, bottom: B.bottom } : void 0,
469
486
  "data-nvr-notification-panel": !0,
470
487
  children: [
471
- S,
488
+ M,
472
489
  /* @__PURE__ */ n("div", { className: "flex items-center justify-between border-b border-slate-100 px-3 py-2 dark:border-border/60", children: [
473
- /* @__PURE__ */ t("div", { className: "flex items-center gap-1 rounded-md bg-slate-100 p-0.5 dark:bg-muted", children: Re.map((e) => /* @__PURE__ */ n(
490
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-1 rounded-md bg-slate-100 p-0.5 dark:bg-muted", children: Te.map((e) => /* @__PURE__ */ n(
474
491
  "button",
475
492
  {
476
493
  type: "button",
477
- onClick: () => U(e.key),
494
+ onClick: () => J(e.key),
478
495
  "data-nvr-lane-tab": e.key,
479
- className: v === 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",
496
+ className: h === 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",
480
497
  children: [
481
498
  e.label,
482
499
  e.count != null && e.count > 0 && /* @__PURE__ */ t(
483
500
  "span",
484
501
  {
485
- className: `ml-1 rounded-full px-1 text-[9.5px] font-bold ${e.key === "attention" && q.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"}`,
486
- children: /* @__PURE__ */ t(me, { value: e.count })
502
+ className: `ml-1 rounded-full px-1 text-[9.5px] font-bold ${e.key === "attention" && F.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"}`,
503
+ children: /* @__PURE__ */ t(ye, { value: e.count })
487
504
  }
488
505
  )
489
506
  ]
490
507
  },
491
508
  e.key
492
509
  )) }),
493
- B > 0 && /* @__PURE__ */ n(
510
+ P > 0 && /* @__PURE__ */ n(
494
511
  "button",
495
512
  {
496
513
  type: "button",
497
- onClick: () => Ne.mutate(),
514
+ onClick: () => Ee.mutate(),
498
515
  className: "inline-flex items-center gap-1 text-[11px] font-medium text-slate-400 transition-colors hover:text-nvr-cyan",
499
516
  children: [
500
- /* @__PURE__ */ t(Fe, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
517
+ /* @__PURE__ */ t(Ge, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
501
518
  "Mark all read"
502
519
  ]
503
520
  }
504
521
  )
505
522
  ] }),
506
- /* @__PURE__ */ n("div", { className: "max-h-96 overflow-y-auto", children: [
507
- K.length > 0 && /* @__PURE__ */ n("div", { "data-notification-pinned": !0, children: [
508
- /* @__PURE__ */ t("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" }),
509
- K.map((e) => /* @__PURE__ */ t(pe, { children: j(e, !!M(e, r)) }, e.id))
510
- ] }),
511
- re.length === 0 && X.length === 0 && K.length === 0 ? /* @__PURE__ */ t("p", { className: "px-3 py-6 text-center text-[12px] text-slate-400", children: v === "attention" ? "Nothing needs you right now." : v === "fyi" ? "No FYI notifications." : "No notifications" }) : [
512
- ...X.map($e),
513
- ...re.map((e) => {
514
- const a = e.rows.filter((l) => !l.read).map((l) => l.id), o = M(e.rows[0], r), i = !!o, s = e.rows.find((l) => l.record_label) ?? e.rows[0], b = it(s);
515
- return /* @__PURE__ */ n(
516
- "div",
523
+ /* @__PURE__ */ n(
524
+ "div",
525
+ {
526
+ ref: Le,
527
+ className: we(
528
+ "max-h-96 overflow-y-auto transition-opacity",
529
+ O && "opacity-60"
530
+ ),
531
+ "aria-busy": !p || O || void 0,
532
+ children: [
533
+ z > 0 && /* @__PURE__ */ t("div", { className: "sticky top-0 z-[1] flex justify-center py-1", children: /* @__PURE__ */ n(
534
+ "button",
517
535
  {
518
- className: "border-b border-slate-50 last:border-b-0 dark:border-border/50",
536
+ type: "button",
537
+ "data-notification-new-pill": z,
538
+ onClick: () => {
539
+ q.reveal(), L.reveal();
540
+ },
541
+ className: "rounded-full border border-nvr-cyan/40 bg-white px-2.5 py-0.5 text-[11px] font-medium text-nvr-navy shadow-sm hover:bg-nvr-cyan/10 dark:bg-card dark:text-nvr-cyan",
519
542
  children: [
520
- i && b && /* @__PURE__ */ n("div", { className: "flex items-center gap-1.5 px-3 pt-2", children: [
521
- /* @__PURE__ */ n("span", { className: "truncate text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: [
522
- b,
523
- e.rows.length > 1 ? ` · ${e.rows.length}` : ""
524
- ] }),
525
- /* @__PURE__ */ n("span", { className: "ml-auto flex items-center gap-0.5", children: [
526
- /* @__PURE__ */ t(
527
- "button",
528
- {
529
- type: "button",
530
- "aria-label": "Open record",
531
- "data-tip": "Open record",
532
- "data-notification-open-record": !0,
533
- onClick: () => {
534
- a.length && P.mutate(a), p(!1), F(o, c);
535
- },
536
- className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
537
- children: /* @__PURE__ */ t(ce, { className: "h-3 w-3" })
538
- }
539
- ),
540
- a.length > 0 && /* @__PURE__ */ t(
541
- "button",
542
- {
543
- type: "button",
544
- "aria-label": "Mark read",
545
- "data-tip": "Mark read",
546
- onClick: () => P.mutate(a),
547
- className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
548
- children: /* @__PURE__ */ t(E, { className: "h-3 w-3" })
549
- }
550
- )
551
- ] })
552
- ] }),
553
- e.rows.map((l) => j(l, i))
543
+ z,
544
+ " new"
554
545
  ]
555
- },
556
- e.key
557
- );
558
- })
559
- ]
560
- ] }),
561
- G && /* @__PURE__ */ t(
546
+ }
547
+ ) }),
548
+ j.length > 0 && /* @__PURE__ */ n("div", { "data-notification-pinned": !0, children: [
549
+ /* @__PURE__ */ t("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" }),
550
+ j.map((e) => /* @__PURE__ */ t(ke, { children: G(e, !!S(e, r)) }, e.id))
551
+ ] }),
552
+ p ? ce.length === 0 && re.length === 0 && j.length === 0 ? /* @__PURE__ */ t("p", { className: "px-3 py-6 text-center text-[12px] text-slate-400", children: h === "attention" ? "Nothing needs you right now." : h === "fyi" ? "No FYI notifications." : "No notifications" }) : [
553
+ ...re.map(De),
554
+ ...ce.map((e) => {
555
+ const a = e.rows.filter((l) => !l.read).map((l) => l.id), o = S(e.rows[0], r), i = !!o, s = e.rows.find((l) => l.record_label) ?? e.rows[0], k = kt(s);
556
+ return /* @__PURE__ */ n(
557
+ "div",
558
+ {
559
+ className: "border-b border-slate-50 last:border-b-0 dark:border-border/50",
560
+ children: [
561
+ i && k && /* @__PURE__ */ n("div", { className: "flex items-center gap-1.5 px-3 pt-2", children: [
562
+ /* @__PURE__ */ n("span", { className: "truncate text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: [
563
+ k,
564
+ e.rows.length > 1 ? ` · ${e.rows.length}` : ""
565
+ ] }),
566
+ /* @__PURE__ */ n("span", { className: "ml-auto flex items-center gap-0.5", children: [
567
+ /* @__PURE__ */ t(
568
+ "button",
569
+ {
570
+ type: "button",
571
+ "aria-label": "Open record",
572
+ "data-tip": "Open record",
573
+ "data-notification-open-record": !0,
574
+ onClick: () => {
575
+ a.length && H.mutate(a), m(!1), D(o, c);
576
+ },
577
+ className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
578
+ children: /* @__PURE__ */ t(be, { className: "h-3 w-3" })
579
+ }
580
+ ),
581
+ a.length > 0 && /* @__PURE__ */ t(
582
+ "button",
583
+ {
584
+ type: "button",
585
+ "aria-label": "Mark read",
586
+ "data-tip": "Mark read",
587
+ onClick: () => H.mutate(a),
588
+ className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
589
+ children: /* @__PURE__ */ t(I, { className: "h-3 w-3" })
590
+ }
591
+ )
592
+ ] })
593
+ ] }),
594
+ e.rows.map((l) => G(l, i))
595
+ ]
596
+ },
597
+ e.key
598
+ );
599
+ })
600
+ ] : /* @__PURE__ */ t("div", { className: "space-y-3 px-3 py-4", "data-notification-loading": !0, children: [72, 88, 64].map((e) => /* @__PURE__ */ n("div", { className: "space-y-1.5", children: [
601
+ /* @__PURE__ */ t(Ne, { width: `${e}%` }),
602
+ /* @__PURE__ */ t(Ne, { width: "40%", className: "h-2.5" })
603
+ ] }, e)) })
604
+ ]
605
+ }
606
+ ),
607
+ W && /* @__PURE__ */ t(
562
608
  "button",
563
609
  {
564
610
  type: "button",
565
611
  onClick: () => {
566
- p(!1), c(G);
612
+ m(!1), c(W);
567
613
  },
568
614
  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",
569
615
  children: "See all notifications"
@@ -575,18 +621,18 @@ function qt({
575
621
  document.body
576
622
  ),
577
623
  /* @__PURE__ */ t(
578
- We,
624
+ st,
579
625
  {
580
626
  notificationId: ($ == null ? void 0 : $.id) ?? null,
581
627
  title: ($ == null ? void 0 : $.title) ?? null,
582
- onClose: () => O(null)
628
+ onClose: () => Q(null)
583
629
  }
584
630
  )
585
631
  ] });
586
632
  }
587
633
  export {
588
- qt as NotificationBell,
589
- it as bellGroupLabel,
590
- fe as hasSnapshotView,
591
- st as offersChanges
634
+ Gt as NotificationBell,
635
+ kt as bellGroupLabel,
636
+ Ce as hasSnapshotView,
637
+ vt as offersChanges
592
638
  };