@nivaro/react 0.3.15 → 0.3.17

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 (37) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +127 -6
  4. package/dist/index.js +736 -734
  5. package/dist/shared/components/CollectionBrowserView.js +2344 -2309
  6. package/dist/shared/components/ItemEditForm.js +3773 -3604
  7. package/dist/shared/components/RecordGridEditor.js +319 -282
  8. package/dist/shared/components/RecordReadView.js +202 -200
  9. package/dist/shared/components/cbv/unknown-fields.js +18 -8
  10. package/dist/shared/components/chat/ChatAnalyticsView.js +2 -2
  11. package/dist/shared/components/import/DocumentAutofillButton.js +148 -142
  12. package/dist/shared/components/item-edit/CatalogPickerField.js +264 -276
  13. package/dist/shared/components/item-edit/FieldRenderer.js +136 -133
  14. package/dist/shared/components/item-edit/FieldRow.js +198 -184
  15. package/dist/shared/components/item-edit/HeaderTools.js +107 -99
  16. package/dist/shared/components/item-edit/InlineTableField.js +138 -136
  17. package/dist/shared/components/item-edit/RecordLiveSync.js +1 -0
  18. package/dist/shared/components/item-edit/RelationCombobox.js +30 -23
  19. package/dist/shared/components/item-edit/SummaryPanel.js +334 -294
  20. package/dist/shared/components/item-edit/column-length.js +12 -0
  21. package/dist/shared/components/panels/AccessDeniedPanel.js +47 -37
  22. package/dist/shared/components/panels/ItemLockBanner.js +307 -285
  23. package/dist/shared/components/panels/PipelinePanel.js +486 -465
  24. package/dist/shared/components/panels/RevisionsPanel.js +210 -204
  25. package/dist/shared/components/pipeline/PipelineEditorView.js +1672 -1568
  26. package/dist/shared/components/profile/DelegationCard.js +178 -121
  27. package/dist/shared/components/profile/PersonActivity.js +152 -139
  28. package/dist/shared/components/queue/QueueWorklist.js +668 -659
  29. package/dist/shared/components/queue/transition-note.js +90 -0
  30. package/dist/shared/components/support/SupportRequestDialog.js +100 -89
  31. package/dist/shared/components/support/TicketDetailSheet.js +104 -91
  32. package/dist/shared/lib/autofill-runs.js +33 -26
  33. package/dist/shared/lib/draft-store.js +40 -24
  34. package/dist/shared/lib/live-queries.js +10 -9
  35. package/dist/shared/lib/request-gate.js +140 -127
  36. package/dist/shared/lib/restore-skipped.js +10 -0
  37. package/package.json +1 -1
@@ -1,20 +1,20 @@
1
- import { jsx as e, jsxs as n, Fragment as W } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as s, Fragment as W } from "react/jsx-runtime";
2
2
  import { useQuery as T, useInfiniteQuery as B } from "@tanstack/react-query";
3
3
  import { Flame as Z, X as H, Globe as R, ArrowDownAZ as Y, ArrowUpAZ as G, Activity as J, LogIn as Q, Footprints as z } from "lucide-react";
4
- import { useState as S } from "react";
4
+ import { useState as $ } from "react";
5
5
  import { useNivaroClient as M, useItemNavigation as X, useNavigation as P } from "../../context.js";
6
- import { get as _ } from "../../lib/commands.js";
6
+ import { get as S } from "../../lib/commands.js";
7
7
  import { cn as v, formatRelative as j, formatDateTime as O } from "../../lib/utils.js";
8
8
  import { SimpleSelect as V } from "../ui/SimpleSelect.js";
9
9
  import { SectionCard as A, EmptyLine as C } from "./primitives.js";
10
- function fe({ userId: t, title: l = "Rhythm" }) {
10
+ function be({ userId: t, title: l = "Rhythm" }) {
11
11
  const p = M(), { data: a } = T({
12
12
  queryKey: ["nvr-user-stats", t],
13
- queryFn: () => p.request(_(`/users/${t}/stats`)).then((c) => c.data).catch(() => null),
13
+ queryFn: () => p.request(S(`/users/${t}/stats`)).then((c) => c.data).catch(() => null),
14
14
  staleTime: 5 * 6e4
15
15
  });
16
16
  if (!a) return null;
17
- const r = Math.max(1, ...a.weeks.map((c) => c.transitions + c.tasks_done + c.created)), u = a.totals.transitions + a.totals.tasks_done + a.totals.created === 0;
17
+ const i = Math.max(1, ...a.weeks.map((c) => c.transitions + c.tasks_done + c.created)), u = a.totals.transitions + a.totals.tasks_done + a.totals.created === 0;
18
18
  return /* @__PURE__ */ e(
19
19
  A,
20
20
  {
@@ -22,19 +22,19 @@ function fe({ userId: t, title: l = "Rhythm" }) {
22
22
  title: l,
23
23
  hint: "Last eight weeks",
24
24
  testId: "stats",
25
- actions: a.streak_days > 0 && /* @__PURE__ */ n("span", { className: "text-[11.5px] font-medium text-amber-600 dark:text-amber-400", children: [
25
+ actions: a.streak_days > 0 && /* @__PURE__ */ s("span", { className: "text-[11.5px] font-medium text-amber-600 dark:text-amber-400", children: [
26
26
  a.streak_days,
27
27
  "-day streak"
28
28
  ] }),
29
- children: u ? /* @__PURE__ */ e(C, { children: "Nothing recorded in the last eight weeks." }) : /* @__PURE__ */ n(W, { children: [
30
- /* @__PURE__ */ e(ee, { weeks: a.weeks, max: r }),
29
+ children: u ? /* @__PURE__ */ e(C, { children: "Nothing recorded in the last eight weeks." }) : /* @__PURE__ */ s(W, { children: [
30
+ /* @__PURE__ */ e(ee, { weeks: a.weeks, max: i }),
31
31
  a.active_days && /* @__PURE__ */ e(ae, { days: a.active_days }),
32
32
  a.typical_hours_utc && /* @__PURE__ */ e(se, { hours: a.typical_hours_utc }),
33
33
  /* @__PURE__ */ e("dl", { className: "mt-4 grid grid-cols-3 gap-2 text-center", children: [
34
34
  ["Approvals", a.totals.transitions],
35
35
  ["Tasks done", a.totals.tasks_done],
36
36
  ["Records created", a.totals.created]
37
- ].map(([c, m]) => /* @__PURE__ */ n("div", { className: "rounded-md bg-slate-50 py-2 dark:bg-muted/40", children: [
37
+ ].map(([c, m]) => /* @__PURE__ */ s("div", { className: "rounded-md bg-slate-50 py-2 dark:bg-muted/40", children: [
38
38
  /* @__PURE__ */ e("dd", { className: "text-[16px] font-semibold tabular-nums text-slate-800 dark:text-slate-100", children: Number(m).toLocaleString() }),
39
39
  /* @__PURE__ */ e("dt", { className: "text-[10.5px] font-medium uppercase tracking-wide text-slate-400", children: c })
40
40
  ] }, String(c))) })
@@ -53,11 +53,11 @@ function ee({
53
53
  max: l
54
54
  }) {
55
55
  const p = E(/* @__PURE__ */ new Date());
56
- return /* @__PURE__ */ n("div", { "data-person-week-bars": !0, children: [
56
+ return /* @__PURE__ */ s("div", { "data-person-week-bars": !0, children: [
57
57
  /* @__PURE__ */ e("p", { className: "text-[10.5px] font-medium uppercase tracking-wide text-slate-400", children: "Actions per week" }),
58
- /* @__PURE__ */ e("div", { className: "mt-1.5 flex items-end gap-1.5", "data-person-stats-bars": !0, children: t.map((a, r) => {
59
- const u = a.transitions + a.tasks_done + a.created, c = u === 0 ? 2 : Math.max(6, Math.round(u / l * 56)), m = new Date(p.getTime() - (t.length - 1 - r) * 7 * F), d = r === t.length - 1;
60
- return /* @__PURE__ */ n(
58
+ /* @__PURE__ */ e("div", { className: "mt-1.5 flex items-end gap-1.5", "data-person-stats-bars": !0, children: t.map((a, i) => {
59
+ const u = a.transitions + a.tasks_done + a.created, c = u === 0 ? 2 : Math.max(6, Math.round(u / l * 56)), m = new Date(p.getTime() - (t.length - 1 - i) * 7 * F), d = i === t.length - 1;
60
+ return /* @__PURE__ */ s(
61
61
  "div",
62
62
  {
63
63
  className: "flex flex-1 flex-col items-center justify-end",
@@ -103,7 +103,7 @@ function ee({
103
103
  }
104
104
  const te = ["Mon", "", "Wed", "", "Fri", "", "Sun"];
105
105
  function ae({ days: t }) {
106
- const l = new Set(t), p = E(/* @__PURE__ */ new Date()), a = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), r = Array.from({ length: 8 }, (m, d) => {
106
+ const l = new Set(t), p = E(/* @__PURE__ */ new Date()), a = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), i = Array.from({ length: 8 }, (m, d) => {
107
107
  const N = new Date(p.getTime() - (7 - d) * 7 * F);
108
108
  return {
109
109
  monday: N,
@@ -112,18 +112,18 @@ function ae({ days: t }) {
112
112
  return { key: b, on: l.has(b), future: b > a, today: b === a, date: g };
113
113
  })
114
114
  };
115
- }), u = r.flat().flatMap((m) => m.cells).filter((m) => m.on).length, c = r.flatMap((m) => m.cells).filter((m) => !m.future).length;
116
- return /* @__PURE__ */ n("div", { className: "mt-4", "data-person-presence-strip": u, children: [
117
- /* @__PURE__ */ n("div", { className: "flex items-baseline justify-between", children: [
115
+ }), u = i.flat().flatMap((m) => m.cells).filter((m) => m.on).length, c = i.flatMap((m) => m.cells).filter((m) => !m.future).length;
116
+ return /* @__PURE__ */ s("div", { className: "mt-4", "data-person-presence-strip": u, children: [
117
+ /* @__PURE__ */ s("div", { className: "flex items-baseline justify-between", children: [
118
118
  /* @__PURE__ */ e("p", { className: "text-[10.5px] font-medium uppercase tracking-wide text-slate-400", children: "Days with activity" }),
119
- /* @__PURE__ */ n("p", { className: "text-[11.5px] tabular-nums text-slate-600 dark:text-slate-300", children: [
119
+ /* @__PURE__ */ s("p", { className: "text-[11.5px] tabular-nums text-slate-600 dark:text-slate-300", children: [
120
120
  /* @__PURE__ */ e("span", { className: "font-semibold", children: u }),
121
121
  " of the last ",
122
122
  c,
123
123
  " days"
124
124
  ] })
125
125
  ] }),
126
- /* @__PURE__ */ n("div", { className: "mt-1.5 flex gap-1.5", children: [
126
+ /* @__PURE__ */ s("div", { className: "mt-1.5 flex gap-1.5", children: [
127
127
  /* @__PURE__ */ e("div", { className: "flex flex-col gap-[3px] pr-1", "aria-hidden": !0, children: te.map((m, d) => /* @__PURE__ */ e(
128
128
  "span",
129
129
  {
@@ -132,7 +132,7 @@ function ae({ days: t }) {
132
132
  },
133
133
  d
134
134
  )) }),
135
- r.map((m) => /* @__PURE__ */ e("div", { className: "flex flex-1 flex-col gap-[3px]", children: m.cells.map((d) => /* @__PURE__ */ e(
135
+ i.map((m) => /* @__PURE__ */ e("div", { className: "flex flex-1 flex-col gap-[3px]", children: m.cells.map((d) => /* @__PURE__ */ e(
136
136
  "span",
137
137
  {
138
138
  title: d.future ? void 0 : `${d.date.toLocaleDateString(void 0, { weekday: "short", month: "short", day: "numeric", timeZone: "UTC" })}${d.on ? " · active" : " · no activity"}`,
@@ -145,35 +145,35 @@ function ae({ days: t }) {
145
145
  d.key
146
146
  )) }, m.monday.toISOString()))
147
147
  ] }),
148
- /* @__PURE__ */ n("div", { className: "mt-1.5 flex items-center justify-between text-[10px] text-slate-400", children: [
149
- /* @__PURE__ */ n("span", { className: "flex items-center gap-1", children: [
148
+ /* @__PURE__ */ s("div", { className: "mt-1.5 flex items-center justify-between text-[10px] text-slate-400", children: [
149
+ /* @__PURE__ */ s("span", { className: "flex items-center gap-1", children: [
150
150
  /* @__PURE__ */ e("span", { className: "inline-block h-2.5 w-2.5 rounded-[2px] bg-nvr-cyan" }),
151
151
  " did something",
152
152
  /* @__PURE__ */ e("span", { className: "ml-2 inline-block h-2.5 w-2.5 rounded-[2px] bg-slate-200 dark:bg-slate-700" }),
153
153
  " ",
154
154
  "quiet"
155
155
  ] }),
156
- /* @__PURE__ */ n("span", { children: [
157
- q(r[0].monday),
156
+ /* @__PURE__ */ s("span", { children: [
157
+ q(i[0].monday),
158
158
  " → today"
159
159
  ] })
160
160
  ] })
161
161
  ] });
162
162
  }
163
163
  function se({ hours: t }) {
164
- const l = -(/* @__PURE__ */ new Date()).getTimezoneOffset() / 60, p = (r) => ((r + l) % 24 + 24) % 24, a = (r) => {
165
- const u = Math.round(r * 2) / 2, c = Math.floor(u) % 24, m = u % 1 ? 30 : 0;
164
+ const l = -(/* @__PURE__ */ new Date()).getTimezoneOffset() / 60, p = (i) => ((i + l) % 24 + 24) % 24, a = (i) => {
165
+ const u = Math.round(i * 2) / 2, c = Math.floor(u) % 24, m = u % 1 ? 30 : 0;
166
166
  return new Date(2e3, 0, 1, c, m).toLocaleTimeString([], { hour: "numeric", minute: m ? "2-digit" : void 0 });
167
167
  };
168
- return /* @__PURE__ */ n("p", { className: "mt-3 text-[12px] text-slate-600 dark:text-slate-300", "data-person-typical-hours": !0, children: [
168
+ return /* @__PURE__ */ s("p", { className: "mt-3 text-[12px] text-slate-600 dark:text-slate-300", "data-person-typical-hours": !0, children: [
169
169
  "Usually active",
170
170
  " ",
171
- /* @__PURE__ */ n("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: [
171
+ /* @__PURE__ */ s("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: [
172
172
  a(p(t.start)),
173
173
  " – ",
174
174
  a(p(t.end))
175
175
  ] }),
176
- /* @__PURE__ */ n("span", { className: "text-slate-400", children: [
176
+ /* @__PURE__ */ s("span", { className: "text-slate-400", children: [
177
177
  " ",
178
178
  "· your time · based on ",
179
179
  t.samples.toLocaleString(),
@@ -182,6 +182,9 @@ function se({ hours: t }) {
182
182
  ] });
183
183
  }
184
184
  function ne(t) {
185
+ return !t.collection || !t.item || /^(nivaro|directus)_/i.test(t.collection) ? !1 : t.action !== "delete";
186
+ }
187
+ function le(t) {
185
188
  return t.link ? t.action === "create" ? "linked" : t.action === "delete" ? "unlinked" : t.action : t.action;
186
189
  }
187
190
  const U = {
@@ -201,47 +204,47 @@ const U = {
201
204
  }, K = {
202
205
  cls: "bg-slate-100 text-slate-600 dark:bg-muted dark:text-muted-foreground",
203
206
  dot: "bg-slate-400"
204
- }, le = 50;
205
- function be({ userId: t }) {
206
- var i, D, h;
207
- const l = M(), { urlFor: p } = X(), a = P(), [r, u] = S(""), [c, m] = S(""), [d, N] = S("desc"), y = !!r || !!c, { data: x } = T({
207
+ }, re = 50;
208
+ function ve({ userId: t }) {
209
+ var o, D, h;
210
+ const l = M(), { urlFor: p } = X(), a = P(), [i, u] = $(""), [c, m] = $(""), [d, N] = $("desc"), y = !!i || !!c, { data: x } = T({
208
211
  queryKey: ["nvr-user-activity-summary", t],
209
- queryFn: () => l.request(_(`/user-activity/${t}/summary`)).then((s) => s.data)
212
+ queryFn: () => l.request(S(`/user-activity/${t}/summary`)).then((n) => n.data)
210
213
  }), g = B({
211
- queryKey: ["nvr-user-activity", t, r, c, d],
212
- queryFn: ({ pageParam: s }) => l.request(
213
- _(`/user-activity/${t}`, {
214
- page: s,
215
- limit: le,
216
- ...r && { action: r },
214
+ queryKey: ["nvr-user-activity", t, i, c, d],
215
+ queryFn: ({ pageParam: n }) => l.request(
216
+ S(`/user-activity/${t}`, {
217
+ page: n,
218
+ limit: re,
219
+ ...i && { action: i },
217
220
  ...c && { collection: c },
218
221
  sort: d
219
222
  })
220
223
  ),
221
224
  initialPageParam: 1,
222
- getNextPageParam: (s) => s.page * s.limit < s.total ? s.page + 1 : void 0
223
- }), b = ((i = g.data) == null ? void 0 : i.pages.flatMap((s) => s.data)) ?? [], w = ((h = (D = g.data) == null ? void 0 : D.pages[0]) == null ? void 0 : h.total) ?? (x == null ? void 0 : x.total) ?? 0, $ = [];
224
- for (const s of b) {
225
- const o = new Date(s.timestamp).toLocaleDateString(void 0, {
225
+ getNextPageParam: (n) => n.page * n.limit < n.total ? n.page + 1 : void 0
226
+ }), b = ((o = g.data) == null ? void 0 : o.pages.flatMap((n) => n.data)) ?? [], w = ((h = (D = g.data) == null ? void 0 : D.pages[0]) == null ? void 0 : h.total) ?? (x == null ? void 0 : x.total) ?? 0, _ = [];
227
+ for (const n of b) {
228
+ const r = new Date(n.timestamp).toLocaleDateString(void 0, {
226
229
  weekday: "short",
227
230
  month: "short",
228
231
  day: "numeric",
229
232
  year: "numeric"
230
- }), f = $[$.length - 1];
231
- (f == null ? void 0 : f.date) === o ? f.entries.push(s) : $.push({ date: o, entries: [s] });
233
+ }), f = _[_.length - 1];
234
+ (f == null ? void 0 : f.date) === r ? f.entries.push(n) : _.push({ date: r, entries: [n] });
232
235
  }
233
- return /* @__PURE__ */ n(
236
+ return /* @__PURE__ */ s(
234
237
  A,
235
238
  {
236
239
  icon: /* @__PURE__ */ e(J, { className: "h-4 w-4" }),
237
240
  title: "Activity",
238
241
  hint: w ? `${w.toLocaleString()} event${w === 1 ? "" : "s"}` : void 0,
239
242
  testId: "activity",
240
- actions: /* @__PURE__ */ n(
243
+ actions: /* @__PURE__ */ s(
241
244
  "button",
242
245
  {
243
246
  type: "button",
244
- onClick: () => N((s) => s === "desc" ? "asc" : "desc"),
247
+ onClick: () => N((n) => n === "desc" ? "asc" : "desc"),
245
248
  className: "inline-flex h-7 items-center gap-1 rounded-md px-2 text-[11.5px] text-slate-500 hover:bg-slate-50 hover:text-slate-800 dark:text-slate-400 dark:hover:bg-muted",
246
249
  children: [
247
250
  d === "desc" ? /* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(G, { className: "h-3.5 w-3.5" }),
@@ -250,26 +253,26 @@ function be({ userId: t }) {
250
253
  }
251
254
  ),
252
255
  children: [
253
- x && x.actions.length > 0 && /* @__PURE__ */ n("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", children: [
254
- x.actions.map((s) => {
255
- const o = U[s.action] ?? K;
256
- return /* @__PURE__ */ n(
256
+ x && x.actions.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", children: [
257
+ x.actions.map((n) => {
258
+ const r = U[n.action] ?? K;
259
+ return /* @__PURE__ */ s(
257
260
  "button",
258
261
  {
259
262
  type: "button",
260
- "aria-pressed": r === s.action,
261
- onClick: () => u(r === s.action ? "" : s.action),
263
+ "aria-pressed": i === n.action,
264
+ onClick: () => u(i === n.action ? "" : n.action),
262
265
  className: v(
263
266
  "inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium transition-opacity",
264
- o.cls,
265
- r && r !== s.action && "opacity-40"
267
+ r.cls,
268
+ i && i !== n.action && "opacity-40"
266
269
  ),
267
270
  children: [
268
- s.action,
269
- /* @__PURE__ */ e("span", { className: "font-mono opacity-70", children: s.count })
271
+ n.action,
272
+ /* @__PURE__ */ e("span", { className: "font-mono opacity-70", children: n.count })
270
273
  ]
271
274
  },
272
- s.action
275
+ n.action
273
276
  );
274
277
  }),
275
278
  x.collections.length > 1 && /* @__PURE__ */ e(
@@ -280,15 +283,15 @@ function be({ userId: t }) {
280
283
  onChange: m,
281
284
  options: [
282
285
  { value: "", label: "Every collection" },
283
- ...x.collections.map((s) => ({
284
- value: s.collection,
285
- label: `${s.collection_label ?? s.collection} · ${s.count}`
286
+ ...x.collections.map((n) => ({
287
+ value: n.collection,
288
+ label: `${n.collection_label ?? n.collection} · ${n.count}`
286
289
  }))
287
290
  ],
288
291
  className: "ml-auto h-7 w-[200px] text-[11.5px]"
289
292
  }
290
293
  ),
291
- y && /* @__PURE__ */ n(
294
+ y && /* @__PURE__ */ s(
292
295
  "button",
293
296
  {
294
297
  type: "button",
@@ -303,22 +306,22 @@ function be({ userId: t }) {
303
306
  }
304
307
  )
305
308
  ] }),
306
- g.isLoading ? /* @__PURE__ */ e("div", { className: "space-y-3", "aria-busy": !0, children: [0, 1, 2, 3].map((s) => /* @__PURE__ */ n("div", { className: "flex animate-pulse gap-3", children: [
309
+ g.isLoading ? /* @__PURE__ */ e("div", { className: "space-y-3", "aria-busy": !0, children: [0, 1, 2, 3].map((n) => /* @__PURE__ */ s("div", { className: "flex animate-pulse gap-3", children: [
307
310
  /* @__PURE__ */ e("div", { className: "mt-1 h-2 w-2 rounded-full bg-slate-100 dark:bg-muted" }),
308
- /* @__PURE__ */ n("div", { className: "flex-1 space-y-1.5", children: [
311
+ /* @__PURE__ */ s("div", { className: "flex-1 space-y-1.5", children: [
309
312
  /* @__PURE__ */ e("div", { className: "h-3 w-24 rounded bg-slate-100 dark:bg-muted" }),
310
313
  /* @__PURE__ */ e("div", { className: "h-3 w-48 rounded bg-slate-100 dark:bg-muted" })
311
314
  ] })
312
- ] }, s)) }) : b.length === 0 ? /* @__PURE__ */ e(C, { children: y ? "Nothing matches those filters." : "No activity recorded." }) : /* @__PURE__ */ n("div", { children: [
313
- $.map((s) => /* @__PURE__ */ n("div", { children: [
314
- /* @__PURE__ */ n("div", { className: "flex items-center gap-3 py-2", children: [
315
+ ] }, n)) }) : b.length === 0 ? /* @__PURE__ */ e(C, { children: y ? "Nothing matches those filters." : "No activity recorded." }) : /* @__PURE__ */ s("div", { children: [
316
+ _.map((n) => /* @__PURE__ */ s("div", { children: [
317
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-3 py-2", children: [
315
318
  /* @__PURE__ */ e("div", { className: "h-px flex-1 bg-slate-100 dark:bg-border" }),
316
- /* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-slate-400", children: s.date }),
319
+ /* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-slate-400", children: n.date }),
317
320
  /* @__PURE__ */ e("div", { className: "h-px flex-1 bg-slate-100 dark:bg-border" })
318
321
  ] }),
319
- /* @__PURE__ */ e("ol", { className: "relative ml-1 border-l border-slate-100 dark:border-border", children: s.entries.map((o) => {
320
- const f = U[o.action] ?? K, k = o.collection && o.item ? p({ collection: o.collection, itemId: o.item }) : null;
321
- return /* @__PURE__ */ n("li", { className: "relative py-2 pl-4", "data-activity-row": o.id, children: [
322
+ /* @__PURE__ */ e("ol", { className: "relative ml-1 border-l border-slate-100 dark:border-border", children: n.entries.map((r) => {
323
+ const f = U[r.action] ?? K, k = ne(r) ? p({ collection: r.collection, itemId: r.item }) : null;
324
+ return /* @__PURE__ */ s("li", { className: "relative py-2 pl-4", "data-activity-row": r.id, children: [
322
325
  /* @__PURE__ */ e(
323
326
  "span",
324
327
  {
@@ -328,7 +331,7 @@ function be({ userId: t }) {
328
331
  )
329
332
  }
330
333
  ),
331
- /* @__PURE__ */ n("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-0.5", children: [
334
+ /* @__PURE__ */ s("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-0.5", children: [
332
335
  /* @__PURE__ */ e(
333
336
  "span",
334
337
  {
@@ -336,10 +339,10 @@ function be({ userId: t }) {
336
339
  "rounded-full px-1.5 py-0.5 text-[10px] font-medium",
337
340
  f.cls
338
341
  ),
339
- children: ne(o)
342
+ children: le(r)
340
343
  }
341
344
  ),
342
- o.collection && (k ? /* @__PURE__ */ n(
345
+ r.collection && (k ? /* @__PURE__ */ s(
343
346
  "a",
344
347
  {
345
348
  href: k,
@@ -347,34 +350,43 @@ function be({ userId: t }) {
347
350
  L.metaKey || L.ctrlKey || (L.preventDefault(), a.navigate(k));
348
351
  },
349
352
  className: "min-w-0 truncate text-[12.5px] text-slate-700 hover:underline dark:text-slate-200",
350
- title: `${o.collection} #${o.item}`,
353
+ title: `${r.collection} #${r.item}`,
351
354
  children: [
352
- o.link ? null : /* @__PURE__ */ n("span", { className: "text-slate-400", children: [
353
- o.collection_label ?? o.collection,
355
+ r.link ? null : /* @__PURE__ */ s("span", { className: "text-slate-400", children: [
356
+ r.collection_label ?? r.collection,
354
357
  " "
355
358
  ] }),
356
- /* @__PURE__ */ e("span", { className: "font-medium", children: o.record_label ?? `#${o.item}` })
359
+ /* @__PURE__ */ e("span", { className: "font-medium", children: r.record_label ?? `#${r.item}` })
357
360
  ]
358
361
  }
359
- ) : /* @__PURE__ */ e("span", { className: "text-[12.5px] text-slate-600 dark:text-slate-300", children: o.collection_label ?? o.collection })),
362
+ ) : /* @__PURE__ */ s("span", { className: "min-w-0 truncate text-[12.5px] text-slate-600 dark:text-slate-300", children: [
363
+ r.link && r.record_label ? null : /* @__PURE__ */ s("span", { className: "text-slate-400", children: [
364
+ r.collection_label ?? r.collection,
365
+ " "
366
+ ] }),
367
+ r.record_label ? /* @__PURE__ */ e("span", { className: "font-medium", children: r.record_label }) : r.item ? /* @__PURE__ */ s("span", { className: "font-medium", children: [
368
+ "#",
369
+ r.item
370
+ ] }) : null
371
+ ] })),
360
372
  /* @__PURE__ */ e(
361
373
  "span",
362
374
  {
363
375
  className: "ml-auto text-[11px] text-slate-400",
364
- title: O(o.timestamp),
365
- children: j(o.timestamp)
376
+ title: O(r.timestamp),
377
+ children: j(r.timestamp)
366
378
  }
367
379
  )
368
380
  ] }),
369
- o.comment && /* @__PURE__ */ e("p", { className: "mt-0.5 text-[11.5px] text-slate-500 dark:text-slate-400", children: o.comment }),
370
- o.ip && /* @__PURE__ */ n("span", { className: "mt-0.5 inline-flex items-center gap-1 font-mono text-[10px] text-slate-300 dark:text-slate-600", children: [
381
+ r.comment && /* @__PURE__ */ e("p", { className: "mt-0.5 text-[11.5px] text-slate-500 dark:text-slate-400", children: r.comment }),
382
+ r.ip && /* @__PURE__ */ s("span", { className: "mt-0.5 inline-flex items-center gap-1 font-mono text-[10px] text-slate-300 dark:text-slate-600", children: [
371
383
  /* @__PURE__ */ e(R, { className: "h-2.5 w-2.5" }),
372
384
  " ",
373
- o.ip
385
+ r.ip
374
386
  ] })
375
- ] }, o.id);
387
+ ] }, r.id);
376
388
  }) })
377
- ] }, s.date)),
389
+ ] }, n.date)),
378
390
  g.hasNextPage && /* @__PURE__ */ e("div", { className: "pt-3 text-center", children: /* @__PURE__ */ e(
379
391
  "button",
380
392
  {
@@ -395,28 +407,28 @@ function I(t) {
395
407
  const l = t.split("/").filter(Boolean);
396
408
  return l[0] === "collections" && l[1] ? l[2] ? `${l[1]} · record ${l[2]}` : `${l[1]} (browser)` : l.map((p) => p.replace(/-/g, " ")).join(" › ").replace(/\b\w/g, (p) => p.toUpperCase());
397
409
  }
398
- function re(t) {
410
+ function ie(t) {
399
411
  if (t == null) return "";
400
412
  if (t < 60) return `${t}s`;
401
413
  const l = Math.floor(t / 60);
402
414
  return l < 60 ? `${l}m ${t % 60}s` : `${Math.floor(l / 60)}h ${l % 60}m`;
403
415
  }
404
- function ie(t, l, p) {
416
+ function oe(t, l, p) {
405
417
  return t.request(
406
- _(`/journeys/days/${l}`, p ? { app: p } : void 0)
418
+ S(`/journeys/days/${l}`, p ? { app: p } : void 0)
407
419
  ).then((a) => ({ days: a.data ?? [], apps: a.apps ?? [] })).catch(() => ({ days: [], apps: [] }));
408
420
  }
409
- function ve({ userId: t }) {
410
- const l = M(), p = P(), a = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), [r, u] = S(a), [c, m] = S(null), { data: d } = T({
421
+ function ye({ userId: t }) {
422
+ const l = M(), p = P(), a = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), [i, u] = $(a), [c, m] = $(null), { data: d } = T({
411
423
  queryKey: ["nvr-journey-days", t, c],
412
- queryFn: () => ie(l, t, c)
424
+ queryFn: () => oe(l, t, c)
413
425
  }), N = (d == null ? void 0 : d.days) ?? [], y = (d == null ? void 0 : d.apps) ?? [], { data: x, isLoading: g } = T({
414
- queryKey: ["nvr-journey", t, r, c],
426
+ queryKey: ["nvr-journey", t, i, c],
415
427
  queryFn: () => l.request(
416
- _(`/journeys/user/${t}`, c ? { date: r, app: c } : { date: r })
417
- ).then((i) => i.data).catch(() => null)
418
- }), b = y.length > 1 || y.length === 1 && y[0] !== "admin", w = (x == null ? void 0 : x.sessions) ?? [], $ = (i) => p.consoleUrl ? p.consoleUrl(i) : i;
419
- return /* @__PURE__ */ n(
428
+ S(`/journeys/user/${t}`, c ? { date: i, app: c } : { date: i })
429
+ ).then((o) => o.data).catch(() => null)
430
+ }), b = y.length > 1 || y.length === 1 && y[0] !== "admin", w = (x == null ? void 0 : x.sessions) ?? [], _ = (o) => p.consoleUrl ? p.consoleUrl(o) : o;
431
+ return /* @__PURE__ */ s(
420
432
  A,
421
433
  {
422
434
  icon: /* @__PURE__ */ e(z, { className: "h-4 w-4" }),
@@ -424,64 +436,64 @@ function ve({ userId: t }) {
424
436
  hint: "Their path through the admin and the portal, per session — kept 30 days",
425
437
  testId: "journey",
426
438
  children: [
427
- b && /* @__PURE__ */ e("div", { className: "mb-2 flex flex-wrap items-center gap-1.5", "data-journey-apps": !0, children: [null, ...y].map((i) => /* @__PURE__ */ e(
439
+ b && /* @__PURE__ */ e("div", { className: "mb-2 flex flex-wrap items-center gap-1.5", "data-journey-apps": !0, children: [null, ...y].map((o) => /* @__PURE__ */ e(
428
440
  "button",
429
441
  {
430
442
  type: "button",
431
- "aria-pressed": c === i,
432
- "data-journey-app-filter": i ?? "all",
433
- onClick: () => m(i),
443
+ "aria-pressed": c === o,
444
+ "data-journey-app-filter": o ?? "all",
445
+ onClick: () => m(o),
434
446
  className: v(
435
447
  "rounded-md border px-2 py-0.5 text-[11px]",
436
- c === i ? "border-nvr-cyan bg-accent text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 dark:border-border dark:text-slate-400"
448
+ c === o ? "border-nvr-cyan bg-accent text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 dark:border-border dark:text-slate-400"
437
449
  ),
438
- children: i ?? "All apps"
450
+ children: o ?? "All apps"
439
451
  },
440
- i ?? "__all"
452
+ o ?? "__all"
441
453
  )) }),
442
- N.length > 0 && /* @__PURE__ */ e("div", { className: "mb-3 flex flex-wrap gap-1.5", children: N.slice(0, 14).map((i) => /* @__PURE__ */ e(
454
+ N.length > 0 && /* @__PURE__ */ e("div", { className: "mb-3 flex flex-wrap gap-1.5", children: N.slice(0, 14).map((o) => /* @__PURE__ */ e(
443
455
  "button",
444
456
  {
445
457
  type: "button",
446
- "aria-pressed": r === i.date,
447
- onClick: () => u(i.date),
458
+ "aria-pressed": i === o.date,
459
+ onClick: () => u(o.date),
448
460
  className: v(
449
461
  "rounded-full border px-2 py-0.5 text-[11px]",
450
- r === i.date ? "border-nvr-cyan bg-accent text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 dark:border-border dark:text-slate-400"
462
+ i === o.date ? "border-nvr-cyan bg-accent text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 dark:border-border dark:text-slate-400"
451
463
  ),
452
- title: `${i.steps} page views`,
453
- children: i.date === a ? "Today" : i.date.slice(5)
464
+ title: `${o.steps} page views`,
465
+ children: o.date === a ? "Today" : o.date.slice(5)
454
466
  },
455
- i.date
467
+ o.date
456
468
  )) }),
457
- g ? /* @__PURE__ */ e(C, { children: "Loading…" }) : w.length === 0 ? /* @__PURE__ */ n(C, { children: [
469
+ g ? /* @__PURE__ */ e(C, { children: "Loading…" }) : w.length === 0 ? /* @__PURE__ */ s(C, { children: [
458
470
  "No pages recorded ",
459
- r === a ? "today" : `on ${r}`,
471
+ i === a ? "today" : `on ${i}`,
460
472
  "."
461
- ] }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: w.map((i, D) => /* @__PURE__ */ n("div", { children: [
462
- /* @__PURE__ */ n("p", { className: "mb-1.5 text-[11px] font-medium text-slate-400", children: [
473
+ ] }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: w.map((o, D) => /* @__PURE__ */ s("div", { children: [
474
+ /* @__PURE__ */ s("p", { className: "mb-1.5 text-[11px] font-medium text-slate-400", children: [
463
475
  "Session ",
464
476
  D + 1,
465
477
  " · started ",
466
- j(i.started_at),
478
+ j(o.started_at),
467
479
  " · ",
468
- i.steps.length,
480
+ o.steps.length,
469
481
  " page",
470
- i.steps.length === 1 ? "" : "s",
482
+ o.steps.length === 1 ? "" : "s",
471
483
  b && /* @__PURE__ */ e(
472
484
  "span",
473
485
  {
474
486
  className: "ml-1.5 rounded bg-slate-100 px-1.5 py-px text-[10px] font-medium text-slate-600 dark:bg-muted dark:text-slate-300",
475
- "data-journey-app": i.app ?? "admin",
476
- children: i.app ?? "admin"
487
+ "data-journey-app": o.app ?? "admin",
488
+ children: o.app ?? "admin"
477
489
  }
478
490
  )
479
491
  ] }),
480
- /* @__PURE__ */ e("ol", { className: "relative ml-2 border-l border-slate-200 dark:border-border", children: i.steps.map((h, s) => {
481
- const f = (h.app ?? "admin") === "admin" && h.path.startsWith("/") && !h.path.startsWith("//") && !h.path.includes(":") ? $(h.path) : null;
482
- return /* @__PURE__ */ n("li", { className: "relative py-1 pl-4", children: [
492
+ /* @__PURE__ */ e("ol", { className: "relative ml-2 border-l border-slate-200 dark:border-border", children: o.steps.map((h, n) => {
493
+ const f = (h.app ?? "admin") === "admin" && h.path.startsWith("/") && !h.path.startsWith("//") && !h.path.includes(":") ? _(h.path) : null;
494
+ return /* @__PURE__ */ s("li", { className: "relative py-1 pl-4", children: [
483
495
  /* @__PURE__ */ e("span", { className: "absolute -left-[3.5px] top-[13px] h-1.5 w-1.5 rounded-full bg-nvr-cyan" }),
484
- /* @__PURE__ */ n("div", { className: "flex items-baseline gap-2", children: [
496
+ /* @__PURE__ */ s("div", { className: "flex items-baseline gap-2", children: [
485
497
  f ? /* @__PURE__ */ e(
486
498
  "a",
487
499
  {
@@ -493,22 +505,22 @@ function ve({ userId: t }) {
493
505
  children: I(h.path)
494
506
  }
495
507
  ) : /* @__PURE__ */ e("span", { className: "truncate text-[12.5px] text-slate-700 dark:text-slate-300", children: I(h.path) }),
496
- /* @__PURE__ */ n("span", { className: "shrink-0 text-[10.5px] tabular-nums text-slate-400", children: [
508
+ /* @__PURE__ */ s("span", { className: "shrink-0 text-[10.5px] tabular-nums text-slate-400", children: [
497
509
  new Date(h.entered_at).toLocaleTimeString(void 0, {
498
510
  hour: "2-digit",
499
511
  minute: "2-digit"
500
512
  }),
501
- h.duration_seconds != null && ` · ${re(h.duration_seconds)}`
513
+ h.duration_seconds != null && ` · ${ie(h.duration_seconds)}`
502
514
  ] })
503
515
  ] })
504
- ] }, `${h.entered_at}-${s}`);
516
+ ] }, `${h.entered_at}-${n}`);
505
517
  }) })
506
- ] }, i.session_id)) })
518
+ ] }, o.session_id)) })
507
519
  ]
508
520
  }
509
521
  );
510
522
  }
511
- function ye({ profile: t }) {
523
+ function Ne({ profile: t }) {
512
524
  var p;
513
525
  const l = ((p = t.admin) == null ? void 0 : p.logins) ?? [];
514
526
  return /* @__PURE__ */ e(
@@ -518,7 +530,7 @@ function ye({ profile: t }) {
518
530
  title: "Sign-ins",
519
531
  hint: t.admin ? `${t.admin.sessions} live session${t.admin.sessions === 1 ? "" : "s"} · ${t.admin.activity_30d.toLocaleString()} actions in 30 days` : void 0,
520
532
  testId: "sign-ins",
521
- children: l.length === 0 ? /* @__PURE__ */ e(C, { children: "No sign-in recorded yet." }) : /* @__PURE__ */ e("ul", { className: "space-y-1.5", children: l.map((a) => /* @__PURE__ */ n(
533
+ children: l.length === 0 ? /* @__PURE__ */ e(C, { children: "No sign-in recorded yet." }) : /* @__PURE__ */ e("ul", { className: "space-y-1.5", children: l.map((a) => /* @__PURE__ */ s(
522
534
  "li",
523
535
  {
524
536
  className: "flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[12px] text-slate-600 dark:text-slate-300",
@@ -535,11 +547,12 @@ function ye({ profile: t }) {
535
547
  );
536
548
  }
537
549
  export {
538
- be as ActivityFeedCard,
539
- ve as JourneyCard,
540
- ye as SignInsCard,
541
- fe as StatsCard,
542
- ie as fetchJourneyDays,
543
- re as fmtDuration,
550
+ ve as ActivityFeedCard,
551
+ ye as JourneyCard,
552
+ Ne as SignInsCard,
553
+ be as StatsCard,
554
+ ne as activityLinkable,
555
+ oe as fetchJourneyDays,
556
+ ie as fmtDuration,
544
557
  I as pageLabel
545
558
  };