@nivaro/react 0.3.99 → 0.3.101

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 (60) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useFormSchema.js +82 -85
  3. package/dist/hooks/useSessionRecorder.js +206 -175
  4. package/dist/index.d.ts +84 -16
  5. package/dist/index.js +627 -622
  6. package/dist/lib/commands.js +15 -11
  7. package/dist/shared/components/ActivityEntry.js +5 -5
  8. package/dist/shared/components/CollectionBrowserView.js +516 -503
  9. package/dist/shared/components/ItemEditForm.js +3471 -3465
  10. package/dist/shared/components/JobsTray.js +76 -61
  11. package/dist/shared/components/MyWorkView.js +133 -126
  12. package/dist/shared/components/NotificationBell.js +322 -289
  13. package/dist/shared/components/RecordCompare.js +38 -40
  14. package/dist/shared/components/RecordReadView.js +119 -119
  15. package/dist/shared/components/TipLayer.js +56 -41
  16. package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
  17. package/dist/shared/components/integrations/console/SignalCard.js +40 -40
  18. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +95 -73
  19. package/dist/shared/components/integrations/console/drill/status.js +23 -18
  20. package/dist/shared/components/item-edit/InlineGridField.js +45 -45
  21. package/dist/shared/components/item-edit/InlineTableField.js +750 -749
  22. package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
  23. package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
  24. package/dist/shared/components/item-edit/RecordInsights.js +86 -86
  25. package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
  26. package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
  27. package/dist/shared/components/item-edit/header-path-preview.js +46 -34
  28. package/dist/shared/components/item-edit/related-missing.js +75 -19
  29. package/dist/shared/components/notifications/DeliveryChips.js +1 -2
  30. package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
  31. package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
  32. package/dist/shared/components/panels/BackgroundMove.js +242 -0
  33. package/dist/shared/components/panels/MoveAdvisory.js +204 -0
  34. package/dist/shared/components/panels/PipelinePanel.js +1459 -1220
  35. package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
  36. package/dist/shared/components/profile/ActivityFeedCard.js +322 -0
  37. package/dist/shared/components/profile/DayTimeline.js +145 -140
  38. package/dist/shared/components/profile/PersonAccess.js +679 -383
  39. package/dist/shared/components/profile/PersonActivity.js +404 -427
  40. package/dist/shared/components/profile/PersonDidPanel.js +248 -134
  41. package/dist/shared/components/profile/PersonProfile.js +33 -32
  42. package/dist/shared/components/profile/journey-view.js +166 -0
  43. package/dist/shared/lib/activity-sentence.js +319 -236
  44. package/dist/shared/lib/commands.js +18 -14
  45. package/dist/shared/lib/error-hints.js +1 -1
  46. package/dist/shared/lib/job-failure-text.js +12 -0
  47. package/dist/shared/lib/jobs-tray.js +60 -41
  48. package/dist/shared/lib/move-failure.js +19 -0
  49. package/dist/shared/lib/obligation-banner.js +22 -21
  50. package/dist/shared/lib/partner-failure.js +83 -0
  51. package/dist/shared/lib/prefetch.js +73 -73
  52. package/dist/shared/lib/replay-checkout.js +18 -13
  53. package/dist/shared/lib/replay-context.js +90 -77
  54. package/dist/shared/lib/replay-idle.js +21 -0
  55. package/dist/shared/lib/replay-socket.js +21 -17
  56. package/dist/shared/lib/rum.js +56 -51
  57. package/dist/shared/lib/safe-error.js +17 -13
  58. package/dist/shared/lib/stale-chunk.js +69 -26
  59. package/dist/shared/lib/system-collections.js +20 -0
  60. package/package.json +1 -1
@@ -1,50 +1,50 @@
1
1
  import { jsx as e, jsxs as d } from "react/jsx-runtime";
2
2
  import { useQueryClient as le, useQuery as ce, useMutation as F } from "@tanstack/react-query";
3
- import { Bot as me } from "lucide-react";
4
- import { useState as C, useRef as W, useEffect as E, useMemo as ue } from "react";
5
- import { useApiFetchConfig as pe, useItemNavigation as be, useNavigation as he } from "../context.js";
6
- import { useLiveEvent as xe } from "../lib/live.js";
7
- import { useLiveOps as ge, useFreshIds as fe } from "../lib/live-ops.js";
8
- import { resolveNotificationTarget as Z, runNotificationTarget as ke } from "../lib/notification-target.js";
9
- import { usePrefetchIntent as ye } from "../lib/prefetch.js";
10
- import { useOptionalRealtime as we } from "../lib/realtime.js";
11
- import { userErrorMessage as Ne } from "../lib/safe-error.js";
12
- import { withinDay as G, slaChip as ve } from "../lib/sla-chip.js";
3
+ import { Check as me, Bot as ue } from "lucide-react";
4
+ import { useState as C, useRef as W, useEffect as E, useMemo as pe } from "react";
5
+ import { useApiFetchConfig as he, useItemNavigation as be, useNavigation as xe } from "../context.js";
6
+ import { useLiveEvent as ge } from "../lib/live.js";
7
+ import { useLiveOps as fe, useFreshIds as ke } from "../lib/live-ops.js";
8
+ import { resolveNotificationTarget as Z, runNotificationTarget as ye } from "../lib/notification-target.js";
9
+ import { usePrefetchIntent as we } from "../lib/prefetch.js";
10
+ import { useOptionalRealtime as Ne } from "../lib/realtime.js";
11
+ import { userErrorMessage as ve } from "../lib/safe-error.js";
12
+ import { withinDay as G, slaChip as _e } from "../lib/sla-chip.js";
13
13
  import { cn as M } from "../lib/utils.js";
14
- import { AgentQuestionsCard as _e } from "./AgentQuestionsCard.js";
15
- import { FirstWeekCard as Ce } from "./ai/FirstWeekCard.js";
16
- import { TaskDoButton as $e } from "./ai/TaskDo.js";
17
- import { openChatRoom as Se, canOpenChatRoom as Te } from "./chat/chat-core.js";
18
- import { useMyRecordRooms as je } from "./chat/chat-hooks.js";
19
- import { LearningPathCard as Ae } from "./help-videos/viewer/LearningPathCard.js";
20
- import { RequiredVideosCard as Me } from "./help-videos/viewer/RequiredVideosCard.js";
21
- import { SkeletonBar as Oe, ListSkeleton as Le } from "./Skeletons.js";
22
- import { TickerNumber as qe } from "./TickerNumber.js";
23
- import { UserAvatar as Ie } from "./UserAvatar.js";
24
- const De = 8e3, R = ["records", "tasks", "team", "waiting", "notifications"], X = {
14
+ import { AgentQuestionsCard as Ce } from "./AgentQuestionsCard.js";
15
+ import { FirstWeekCard as $e } from "./ai/FirstWeekCard.js";
16
+ import { TaskDoButton as Se } from "./ai/TaskDo.js";
17
+ import { openChatRoom as Te, canOpenChatRoom as je } from "./chat/chat-core.js";
18
+ import { useMyRecordRooms as Ae } from "./chat/chat-hooks.js";
19
+ import { LearningPathCard as Me } from "./help-videos/viewer/LearningPathCard.js";
20
+ import { RequiredVideosCard as Oe } from "./help-videos/viewer/RequiredVideosCard.js";
21
+ import { SkeletonBar as Le, ListSkeleton as qe } from "./Skeletons.js";
22
+ import { TickerNumber as Ie } from "./TickerNumber.js";
23
+ import { UserAvatar as De } from "./UserAvatar.js";
24
+ const Fe = 8e3, R = ["records", "tasks", "team", "waiting", "notifications"], X = {
25
25
  records: "Waiting on you",
26
26
  tasks: "My tasks",
27
27
  team: "Team tasks",
28
28
  waiting: "Waiting on others",
29
29
  notifications: "Notifications"
30
- }, Fe = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), O = (i) => !!i && String(i).slice(0, 10) < Fe(), We = {
30
+ }, We = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), O = (i) => !!i && String(i).slice(0, 10) < We(), Ee = {
31
31
  alert: "bg-red-500/10 text-red-600 dark:text-red-400",
32
32
  warn: "bg-amber-400/15 text-amber-700 dark:text-amber-400",
33
33
  neutral: "bg-slate-500/10 text-slate-600 dark:text-slate-400",
34
34
  ok: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"
35
35
  };
36
- function Ee({ sla: i }) {
37
- const u = ve(i);
36
+ function Ue({ sla: i }) {
37
+ const u = _e(i);
38
38
  return u ? /* @__PURE__ */ e(
39
39
  "span",
40
40
  {
41
41
  "data-sla-chip": u.tone,
42
- className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums ${We[u.tone]}`,
42
+ className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums ${Ee[u.tone]}`,
43
43
  children: u.label
44
44
  }
45
45
  ) : null;
46
46
  }
47
- function Ue({ state: i, color: u }) {
47
+ function Ke({ state: i, color: u }) {
48
48
  return i ? /* @__PURE__ */ e(
49
49
  "span",
50
50
  {
@@ -57,7 +57,7 @@ function Ue({ state: i, color: u }) {
57
57
  }
58
58
  ) : null;
59
59
  }
60
- function Ke({ order: i, hidden: u }) {
60
+ function Pe({ order: i, hidden: u }) {
61
61
  const c = i.filter(
62
62
  (m) => !u.includes(m) && (m === "records" || m === "tasks" || m === "notifications")
63
63
  ), w = (m, g) => /* @__PURE__ */ d(
@@ -70,7 +70,7 @@ function Ke({ order: i, hidden: u }) {
70
70
  m === "records" && /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Records whose current step resolves you as an owner — most urgent first." })
71
71
  ] }),
72
72
  /* @__PURE__ */ e(
73
- Le,
73
+ qe,
74
74
  {
75
75
  header: !1,
76
76
  rows: g,
@@ -108,7 +108,7 @@ function Ke({ order: i, hidden: u }) {
108
108
  className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
109
109
  children: [
110
110
  /* @__PURE__ */ e("p", { className: "text-[10.5px] uppercase tracking-wide text-muted-foreground", children: m }),
111
- /* @__PURE__ */ e("p", { className: "mt-0.5 flex h-[27px] items-center", children: /* @__PURE__ */ e(Oe, { width: 34, className: "h-[18px] rounded-md" }) })
111
+ /* @__PURE__ */ e("p", { className: "mt-0.5 flex h-[27px] items-center", children: /* @__PURE__ */ e(Le, { width: 34, className: "h-[18px] rounded-md" }) })
112
112
  ]
113
113
  },
114
114
  m
@@ -122,28 +122,28 @@ function Ke({ order: i, hidden: u }) {
122
122
  function L({ label: i, value: u, tone: c }) {
123
123
  return /* @__PURE__ */ d("div", { className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card", children: [
124
124
  /* @__PURE__ */ e("p", { className: "text-[10.5px] uppercase tracking-wide text-muted-foreground", children: i }),
125
- /* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${c ?? ""}`, children: /* @__PURE__ */ e(qe, { value: u }) })
125
+ /* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${c ?? ""}`, children: /* @__PURE__ */ e(Ie, { value: u }) })
126
126
  ] });
127
127
  }
128
- function ut({
128
+ function pt({
129
129
  notificationRoutes: i,
130
130
  onOpenPath: u
131
131
  } = {}) {
132
- const { apiBase: c, authHeaders: w, credentials: k } = pe(), { open: m } = be(), g = he(), f = le(), ee = ye(), U = (r) => {
133
- var h, l;
134
- const n = ((h = i == null ? void 0 : i.support) == null ? void 0 : h.call(i, String(r))) ?? ((l = g.consoleUrl) == null ? void 0 : l.call(g, `/support?ticket=${r}`)) ?? `/support?ticket=${r}`;
135
- u ? u(n) : g.navigate(n);
136
- }, q = we(), [te, $] = C(!1), [x, re] = C(() => {
132
+ const { apiBase: c, authHeaders: w, credentials: k } = he(), { open: m } = be(), g = xe(), f = le(), ee = we(), U = (r) => {
133
+ var b, l;
134
+ const s = ((b = i == null ? void 0 : i.support) == null ? void 0 : b.call(i, String(r))) ?? ((l = g.consoleUrl) == null ? void 0 : l.call(g, `/support?ticket=${r}`)) ?? `/support?ticket=${r}`;
135
+ u ? u(s) : g.navigate(s);
136
+ }, q = Ne(), [te, $] = C(!1), [x, re] = C(() => {
137
137
  try {
138
138
  const r = localStorage.getItem("nvr_mywork_sections");
139
139
  if (r) {
140
- const n = JSON.parse(r);
141
- if (Array.isArray(n == null ? void 0 : n.order) && Array.isArray(n == null ? void 0 : n.hidden)) {
142
- const h = R.map((l, p) => ({
140
+ const s = JSON.parse(r);
141
+ if (Array.isArray(s == null ? void 0 : s.order) && Array.isArray(s == null ? void 0 : s.hidden)) {
142
+ const b = R.map((l, p) => ({
143
143
  k: l,
144
- at: n.order.indexOf(l) >= 0 ? n.order.indexOf(l) : p - 0.5
144
+ at: s.order.indexOf(l) >= 0 ? s.order.indexOf(l) : p - 0.5
145
145
  })).sort((l, p) => l.at - p.at).map((l) => l.k);
146
- return { order: h, hidden: n.hidden.filter((l) => h.includes(l)) };
146
+ return { order: b, hidden: s.hidden.filter((l) => b.includes(l)) };
147
147
  }
148
148
  }
149
149
  } catch {
@@ -155,7 +155,7 @@ function ut({
155
155
  localStorage.setItem("nvr_mywork_sections", JSON.stringify(r));
156
156
  } catch {
157
157
  }
158
- }, [ae, de] = C(!1), P = W(0), [S, ne] = C("all"), { data: a, isLoading: se, refetch: Q, isFetching: B } = ce({
158
+ }, [ae, de] = C(!1), P = W(0), [S, se] = C("all"), { data: a, isLoading: ne, refetch: Q, isFetching: B } = ce({
159
159
  queryKey: ["my-work"],
160
160
  queryFn: async () => {
161
161
  const r = await fetch(`${c}/my-work`, { headers: w, credentials: k });
@@ -166,24 +166,24 @@ function ut({
166
166
  }), z = W(0), N = W(null), H = () => {
167
167
  const r = () => {
168
168
  N.current = null, z.current = Date.now(), $(!1), f.invalidateQueries({ queryKey: ["my-work"] });
169
- }, n = z.current + De - Date.now();
170
- N.current || (n <= 0 ? r() : N.current = setTimeout(r, n));
169
+ }, s = z.current + Fe - Date.now();
170
+ N.current || (s <= 0 ? r() : N.current = setTimeout(r, s));
171
171
  };
172
- ge("my-work", H, { debounceMs: 1500 }), xe("notification:new", H, { debounceMs: 1500 }), E(
172
+ fe("my-work", H, { debounceMs: 1500 }), ge("notification:new", H, { debounceMs: 1500 }), E(
173
173
  () => () => {
174
174
  N.current && clearTimeout(N.current);
175
175
  },
176
176
  []
177
177
  );
178
- const J = fe([
178
+ const J = ke([
179
179
  ...((a == null ? void 0 : a.owned) ?? []).map((r) => `o:${r.collection}:${r.item}`),
180
180
  ...((a == null ? void 0 : a.tasks) ?? []).map((r) => `t:${r.id}`),
181
181
  ...((a == null ? void 0 : a.team_tasks) ?? []).map((r) => `tt:${r.id}`),
182
182
  ...((a == null ? void 0 : a.requested) ?? []).map((r) => `r:${r.id}`),
183
183
  ...((a == null ? void 0 : a.notifications) ?? []).map((r) => `n:${r.id}`)
184
- ]), v = (r) => J.has(r) ? "bg-nvr-cyan/10 transition-colors duration-700" : "transition-colors duration-700", I = ue(() => {
184
+ ]), v = (r) => J.has(r) ? "bg-nvr-cyan/10 transition-colors duration-700" : "transition-colors duration-700", I = pe(() => {
185
185
  const r = /* @__PURE__ */ new Set();
186
- for (const n of (a == null ? void 0 : a.owned) ?? []) n.collection && r.add(n.collection);
186
+ for (const s of (a == null ? void 0 : a.owned) ?? []) s.collection && r.add(s.collection);
187
187
  return [...r];
188
188
  }, [a]);
189
189
  E(() => {
@@ -203,20 +203,20 @@ function ut({
203
203
  }),
204
204
  onSuccess: () => f.invalidateQueries({ queryKey: ["my-work"] })
205
205
  }), T = F({
206
- mutationFn: async ({ id: r, action: n }) => {
207
- const h = await fetch(`${c}/tasks/${r}/${n}`, {
206
+ mutationFn: async ({ id: r, action: s }) => {
207
+ const b = await fetch(`${c}/tasks/${r}/${s}`, {
208
208
  method: "POST",
209
209
  headers: { ...w, "content-type": "application/json" },
210
210
  credentials: k,
211
211
  body: "{}"
212
- }), l = await h.json().catch(() => ({}));
213
- if (!h.ok) throw new Error(l.error ?? "Failed");
214
- return n;
212
+ }), l = await b.json().catch(() => ({}));
213
+ if (!b.ok) throw new Error(l.error ?? "Failed");
214
+ return s;
215
215
  },
216
216
  onSuccess: (r) => {
217
217
  D(r === "claim" ? "It’s yours — it moved to My tasks." : "Reminder sent."), f.invalidateQueries({ queryKey: ["my-work"] });
218
218
  },
219
- onError: (r) => D(Ne(r, "Failed"))
219
+ onError: (r) => D(ve(r, "Failed"))
220
220
  }), [j, D] = C(null);
221
221
  E(() => {
222
222
  if (!j) return;
@@ -233,28 +233,28 @@ function ut({
233
233
  onSuccess: () => {
234
234
  f.invalidateQueries({ queryKey: ["my-work"] }), f.invalidateQueries({ queryKey: ["notifications"] });
235
235
  }
236
- }), _ = (r, n) => {
237
- const h = {
236
+ }), _ = (r, s) => {
237
+ const b = {
238
238
  record: (p, t) => (m({ collection: p, itemId: t }), null),
239
239
  ...i
240
- }, l = Z(r, n, {
241
- ...h,
240
+ }, l = Z(r, s, {
241
+ ...b,
242
242
  record: (p, t) => {
243
- var b;
244
- return ((b = i == null ? void 0 : i.record) == null ? void 0 : b.call(i, p, t)) ?? null;
243
+ var h;
244
+ return ((h = i == null ? void 0 : i.record) == null ? void 0 : h.call(i, p, t)) ?? null;
245
245
  }
246
246
  });
247
247
  if (l) {
248
- ke(l, (p) => u == null ? void 0 : u(p));
248
+ ye(l, (p) => u == null ? void 0 : u(p));
249
249
  return;
250
250
  }
251
- r && n && !/^nivaro_/i.test(r) && r !== "__chat__" && m({ collection: r, itemId: n });
252
- }, oe = (r, n) => r && n && !/^nivaro_/i.test(r) && r !== "__chat__" ? !0 : !!Z(r, n, {
251
+ r && s && !/^nivaro_/i.test(r) && r !== "__chat__" && m({ collection: r, itemId: s });
252
+ }, oe = (r, s) => r && s && !/^nivaro_/i.test(r) && r !== "__chat__" ? !0 : !!Z(r, s, {
253
253
  record: () => null,
254
254
  ...i
255
255
  });
256
- return se || !a ? /* @__PURE__ */ e(Ke, { order: x.order, hidden: x.hidden }) : /* @__PURE__ */ d("div", { className: "space-y-5 p-6", "data-my-work": !0, children: [
257
- /* @__PURE__ */ e(Ce, { onOpenPath: u }),
256
+ return ne || !a ? /* @__PURE__ */ e(Pe, { order: x.order, hidden: x.hidden }) : /* @__PURE__ */ d("div", { className: "space-y-5 p-6", "data-my-work": !0, children: [
257
+ /* @__PURE__ */ e($e, { onOpenPath: u }),
258
258
  /* @__PURE__ */ d("div", { className: "flex items-start justify-between", children: [
259
259
  /* @__PURE__ */ d("div", { className: "grid flex-1 grid-cols-2 gap-3 lg:grid-cols-4", children: [
260
260
  /* @__PURE__ */ e(L, { label: "Waiting on you", value: a.counts.owned }),
@@ -307,10 +307,10 @@ function ut({
307
307
  ),
308
308
  ae && /* @__PURE__ */ d("div", { className: "absolute right-0 top-full z-20 mt-1 w-56 rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
309
309
  /* @__PURE__ */ e("p", { className: "px-1 pb-1.5 text-[11px] font-semibold text-slate-500", children: "Sections" }),
310
- x.order.map((r, n) => {
311
- const h = X[r] ?? r, l = x.hidden.includes(r), p = (t) => {
312
- const b = [...x.order], o = n + t;
313
- o < 0 || o >= b.length || ([b[n], b[o]] = [b[o], b[n]], K({ ...x, order: b }));
310
+ x.order.map((r, s) => {
311
+ const b = X[r] ?? r, l = x.hidden.includes(r), p = (t) => {
312
+ const h = [...x.order], o = s + t;
313
+ o < 0 || o >= h.length || ([h[s], h[o]] = [h[o], h[s]], K({ ...x, order: h }));
314
314
  };
315
315
  return /* @__PURE__ */ d("div", { className: "flex items-center gap-1 rounded px-1 py-1 hover:bg-muted", children: [
316
316
  /* @__PURE__ */ e(
@@ -330,7 +330,7 @@ function ut({
330
330
  "span",
331
331
  {
332
332
  className: `min-w-0 flex-1 truncate text-[12px] ${l ? "text-slate-400 line-through" : ""}`,
333
- children: h
333
+ children: b
334
334
  }
335
335
  ),
336
336
  /* @__PURE__ */ e(
@@ -338,7 +338,7 @@ function ut({
338
338
  {
339
339
  type: "button",
340
340
  onClick: () => p(-1),
341
- disabled: n === 0,
341
+ disabled: s === 0,
342
342
  className: "px-1 text-[11px] text-slate-400 hover:text-foreground disabled:opacity-30",
343
343
  children: "↑"
344
344
  }
@@ -348,7 +348,7 @@ function ut({
348
348
  {
349
349
  type: "button",
350
350
  onClick: () => p(1),
351
- disabled: n === x.order.length - 1,
351
+ disabled: s === x.order.length - 1,
352
352
  className: "px-1 text-[11px] text-slate-400 hover:text-foreground disabled:opacity-30",
353
353
  children: "↓"
354
354
  }
@@ -367,61 +367,61 @@ function ut({
367
367
  children: j
368
368
  }
369
369
  ),
370
- /* @__PURE__ */ e(_e, { questions: a.questions ?? [] }),
370
+ /* @__PURE__ */ e(Ce, { questions: a.questions ?? [] }),
371
+ /* @__PURE__ */ e(Oe, { className: "mb-4" }),
371
372
  /* @__PURE__ */ e(Me, { className: "mb-4" }),
372
- /* @__PURE__ */ e(Ae, { className: "mb-4" }),
373
373
  (() => {
374
374
  const r = {
375
375
  records: () => {
376
- const t = a.owned.filter((s) => G(s.sla)).length, b = a.owned.filter((s) => {
376
+ const t = a.owned.filter((n) => G(n.sla)).length, h = a.owned.filter((n) => {
377
377
  var y;
378
- return ((y = s.sla) == null ? void 0 : y.status) === "breached";
379
- }).length, o = S === "soon" ? a.owned.filter((s) => G(s.sla)) : S === "breached" ? a.owned.filter((s) => {
378
+ return ((y = n.sla) == null ? void 0 : y.status) === "breached";
379
+ }).length, o = S === "soon" ? a.owned.filter((n) => G(n.sla)) : S === "breached" ? a.owned.filter((n) => {
380
380
  var y;
381
- return ((y = s.sla) == null ? void 0 : y.status) === "breached";
381
+ return ((y = n.sla) == null ? void 0 : y.status) === "breached";
382
382
  }) : a.owned, A = [
383
383
  { key: "all", label: `All (${a.owned.length})` },
384
384
  { key: "soon", label: `Warning within 24h (${t})` },
385
- { key: "breached", label: `Breached (${b})` }
385
+ { key: "breached", label: `Breached (${h})` }
386
386
  ];
387
387
  return /* @__PURE__ */ d("section", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
388
388
  /* @__PURE__ */ d("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
389
389
  /* @__PURE__ */ e("h2", { className: "text-[13px] font-medium", children: "Waiting on you" }),
390
390
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Records whose current step resolves you as an owner — most urgent first." })
391
391
  ] }),
392
- a.owned.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-1 border-b border-slate-100 px-4 py-2 dark:border-border/60", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-1 rounded-lg bg-slate-100 p-1 dark:bg-muted", children: A.map((s) => /* @__PURE__ */ e(
392
+ a.owned.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-1 border-b border-slate-100 px-4 py-2 dark:border-border/60", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-1 rounded-lg bg-slate-100 p-1 dark:bg-muted", children: A.map((n) => /* @__PURE__ */ e(
393
393
  "button",
394
394
  {
395
395
  type: "button",
396
- "data-my-work-sla-filter": s.key,
397
- "aria-pressed": S === s.key,
398
- onClick: () => ne(s.key),
396
+ "data-my-work-sla-filter": n.key,
397
+ "aria-pressed": S === n.key,
398
+ onClick: () => se(n.key),
399
399
  className: [
400
400
  "rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors duration-150",
401
- S === s.key ? "bg-white text-slate-900 shadow-sm dark:bg-card dark:text-foreground" : "text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200"
401
+ S === n.key ? "bg-white text-slate-900 shadow-sm dark:bg-card dark:text-foreground" : "text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200"
402
402
  ].join(" "),
403
- children: s.label
403
+ children: n.label
404
404
  },
405
- s.key
405
+ n.key
406
406
  )) }) }),
407
- o.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-6 text-center text-[12.5px] text-muted-foreground", children: a.owned.length === 0 ? "Nothing is waiting on you. Enjoy it." : "Nothing matches this filter." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: o.map((s) => {
407
+ o.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-6 text-center text-[12.5px] text-muted-foreground", children: a.owned.length === 0 ? "Nothing is waiting on you. Enjoy it." : "Nothing matches this filter." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: o.map((n) => {
408
408
  var y;
409
409
  return /* @__PURE__ */ e(
410
410
  "li",
411
411
  {
412
- className: v(`o:${s.collection}:${s.item}`),
413
- "data-my-work-fresh": J.has(`o:${s.collection}:${s.item}`) || void 0,
412
+ className: v(`o:${n.collection}:${n.item}`),
413
+ "data-my-work-fresh": J.has(`o:${n.collection}:${n.item}`) || void 0,
414
414
  children: /* @__PURE__ */ d(
415
415
  "button",
416
416
  {
417
417
  type: "button",
418
- onClick: () => _(s.collection, s.item),
419
- ...ee.record(s.collection, s.item),
418
+ onClick: () => _(n.collection, n.item),
419
+ ...ee.record(n.collection, n.item),
420
420
  className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-muted",
421
421
  children: [
422
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] font-medium", children: s.label }),
423
- /* @__PURE__ */ e("span", { className: "hidden text-[11px] text-muted-foreground sm:inline", children: s.collection.replace(/_/g, " ") }),
424
- ((y = s.flags) == null ? void 0 : y.some((ie) => /^on hold$/i.test(ie.name.trim()))) && /* @__PURE__ */ e(
422
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] font-medium", children: n.label }),
423
+ /* @__PURE__ */ e("span", { className: "hidden text-[11px] text-muted-foreground sm:inline", children: n.collection.replace(/_/g, " ") }),
424
+ ((y = n.flags) == null ? void 0 : y.some((ie) => /^on hold$/i.test(ie.name.trim()))) && /* @__PURE__ */ e(
425
425
  "span",
426
426
  {
427
427
  "data-my-work-hold": !0,
@@ -429,13 +429,13 @@ function ut({
429
429
  children: "On hold"
430
430
  }
431
431
  ),
432
- /* @__PURE__ */ e(Ue, { state: s.state, color: s.state_color }),
433
- /* @__PURE__ */ e(Ee, { sla: s.sla })
432
+ /* @__PURE__ */ e(Ke, { state: n.state, color: n.state_color }),
433
+ /* @__PURE__ */ e(Ue, { sla: n.sla })
434
434
  ]
435
435
  }
436
436
  )
437
437
  },
438
- `${s.collection}:${s.item}`
438
+ `${n.collection}:${n.item}`
439
439
  );
440
440
  }) })
441
441
  ] });
@@ -467,7 +467,7 @@ function ut({
467
467
  "data-tip": `Handed to ${t.agent_name ?? "your agent"} — it picks this up through My Work`,
468
468
  "data-my-work-agent-task": t.id,
469
469
  children: [
470
- /* @__PURE__ */ e(me, { className: "h-3 w-3", "aria-hidden": !0 }),
470
+ /* @__PURE__ */ e(ue, { className: "h-3 w-3", "aria-hidden": !0 }),
471
471
  t.agent_name ?? "Agent"
472
472
  ]
473
473
  }
@@ -485,7 +485,7 @@ function ut({
485
485
  }
486
486
  ),
487
487
  /* @__PURE__ */ e(
488
- $e,
488
+ Se,
489
489
  {
490
490
  task: t,
491
491
  isAssignee: !0,
@@ -562,7 +562,7 @@ function ut({
562
562
  }
563
563
  ),
564
564
  waiting: () => {
565
- const t = a.requested ?? [], b = t.filter((o) => O(o.due_date)).length;
565
+ const t = a.requested ?? [], h = t.filter((o) => O(o.due_date)).length;
566
566
  return /* @__PURE__ */ d(
567
567
  "section",
568
568
  {
@@ -572,15 +572,15 @@ function ut({
572
572
  /* @__PURE__ */ d("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
573
573
  /* @__PURE__ */ d("h2", { className: "text-[13px] font-medium", children: [
574
574
  "Waiting on others",
575
- b > 0 && /* @__PURE__ */ d("span", { className: "ml-2 rounded bg-red-500/10 px-1.5 py-0.5 text-[10.5px] font-semibold text-red-600 dark:text-red-400", children: [
576
- b,
575
+ h > 0 && /* @__PURE__ */ d("span", { className: "ml-2 rounded bg-red-500/10 px-1.5 py-0.5 text-[10.5px] font-semibold text-red-600 dark:text-red-400", children: [
576
+ h,
577
577
  " overdue"
578
578
  ] })
579
579
  ] }),
580
580
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Tasks you asked someone else to do." })
581
581
  ] }),
582
582
  t.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "You are not waiting on anyone." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: t.map((o) => {
583
- const A = O(o.due_date), s = !!o.nudged_at && Date.now() - new Date(o.nudged_at).getTime() < 20 * 36e5;
583
+ const A = O(o.due_date), n = !!o.nudged_at && Date.now() - new Date(o.nudged_at).getTime() < 20 * 36e5;
584
584
  return /* @__PURE__ */ d(
585
585
  "li",
586
586
  {
@@ -619,11 +619,11 @@ function ut({
619
619
  {
620
620
  type: "button",
621
621
  onClick: () => T.mutate({ id: o.id, action: "nudge" }),
622
- disabled: T.isPending || s,
623
- title: s ? "Already nudged today" : "Send a reminder",
622
+ disabled: T.isPending || n,
623
+ title: n ? "Already nudged today" : "Send a reminder",
624
624
  className: "shrink-0 rounded-md border border-slate-200 px-2 py-0.5 text-[11px] font-medium hover:bg-muted disabled:opacity-50 dark:border-border",
625
625
  "data-my-work-nudge": o.id,
626
- children: s ? "Nudged" : "Nudge"
626
+ children: n ? "Nudged" : "Nudge"
627
627
  }
628
628
  )
629
629
  ]
@@ -654,33 +654,40 @@ function ut({
654
654
  className: M("flex items-start gap-2.5 px-4 py-2", v(`n:${t.id}`)),
655
655
  children: [
656
656
  /* @__PURE__ */ e(
657
- Ie,
657
+ De,
658
658
  {
659
659
  userId: t.sender,
660
660
  className: "mt-0.5 h-5 w-5",
661
661
  fallback: /* @__PURE__ */ e("span", { className: "mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-slate-100 text-[9px] font-semibold text-slate-500 dark:bg-muted" })
662
662
  }
663
663
  ),
664
- /* @__PURE__ */ d(
664
+ oe(t.collection, t.item) ? /* @__PURE__ */ d(
665
665
  "button",
666
666
  {
667
667
  type: "button",
668
668
  onClick: () => _(t.collection, t.item),
669
- className: oe(t.collection, t.item) ? "min-w-0 flex-1 cursor-pointer text-left hover:opacity-80" : "min-w-0 flex-1 cursor-default text-left",
669
+ className: "min-w-0 flex-1 cursor-pointer text-left hover:opacity-80",
670
670
  children: [
671
671
  /* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium", children: t.subject }),
672
672
  t.message && /* @__PURE__ */ e("p", { className: "truncate text-[11.5px] text-muted-foreground", children: t.message })
673
673
  ]
674
674
  }
675
+ ) : (
676
+ // Nowhere to open: plain text, never a button that does nothing.
677
+ /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", "data-notification-plain": !0, children: [
678
+ /* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium", children: t.subject }),
679
+ t.message && /* @__PURE__ */ e("p", { className: "truncate text-[11.5px] text-muted-foreground", children: t.message })
680
+ ] })
675
681
  ),
676
682
  /* @__PURE__ */ e(
677
683
  "button",
678
684
  {
679
685
  type: "button",
680
- title: "Mark read",
686
+ "aria-label": "Mark read",
687
+ "data-tip": "Mark read",
681
688
  onClick: () => Y.mutate([t.id]),
682
- className: "text-[11px] text-muted-foreground hover:text-foreground",
683
- children: "✓"
689
+ className: "mt-0.5 shrink-0 rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
690
+ children: /* @__PURE__ */ e(me, { className: "h-3 w-3" })
684
691
  }
685
692
  )
686
693
  ]
@@ -688,28 +695,28 @@ function ut({
688
695
  t.id
689
696
  )) })
690
697
  ] })
691
- }, n = new Map(
698
+ }, s = new Map(
692
699
  x.order.filter((t) => !x.hidden.includes(t) && r[t]).map((t) => [t, r[t]()]).filter(([, t]) => t != null)
693
- ), h = [...n.keys()], l = [];
700
+ ), b = [...s.keys()], l = [];
694
701
  let p = 0;
695
- for (; p < h.length; ) {
696
- const t = h[p];
702
+ for (; p < b.length; ) {
703
+ const t = b[p];
697
704
  if (t === "records")
698
- l.push(/* @__PURE__ */ e("div", { children: n.get(t) }, t)), p++;
705
+ l.push(/* @__PURE__ */ e("div", { children: s.get(t) }, t)), p++;
699
706
  else {
700
- const b = [t];
701
- p + 1 < h.length && h[p + 1] !== "records" && b.push(h[p + 1]), l.push(
702
- /* @__PURE__ */ e("div", { className: "grid gap-5 lg:grid-cols-2", children: b.map((o) => /* @__PURE__ */ e("div", { children: n.get(o) }, o)) }, b.join("+"))
703
- ), p += b.length;
707
+ const h = [t];
708
+ p + 1 < b.length && b[p + 1] !== "records" && h.push(b[p + 1]), l.push(
709
+ /* @__PURE__ */ e("div", { className: "grid gap-5 lg:grid-cols-2", children: h.map((o) => /* @__PURE__ */ e("div", { children: s.get(o) }, o)) }, h.join("+"))
710
+ ), p += h.length;
704
711
  }
705
712
  }
706
713
  return l;
707
714
  })(),
708
- /* @__PURE__ */ e(Pe, {})
715
+ /* @__PURE__ */ e(Qe, {})
709
716
  ] });
710
717
  }
711
- function Pe() {
712
- const i = Te(), { rooms: u } = je(i);
718
+ function Qe() {
719
+ const i = je(), { rooms: u } = Ae(i);
713
720
  return !i || u.length === 0 ? null : /* @__PURE__ */ d(
714
721
  "section",
715
722
  {
@@ -721,7 +728,7 @@ function Pe() {
721
728
  "button",
722
729
  {
723
730
  type: "button",
724
- onClick: () => Se(c.room, c.label),
731
+ onClick: () => Te(c.room, c.label),
725
732
  className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-muted/40",
726
733
  "data-my-work-chat-room": c.room,
727
734
  children: [
@@ -742,5 +749,5 @@ function Pe() {
742
749
  );
743
750
  }
744
751
  export {
745
- ut as MyWorkView
752
+ pt as MyWorkView
746
753
  };