@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,19 +1,23 @@
1
- import { jsxs as y, jsx as s } from "react/jsx-runtime";
2
- import { useQuery as Q } from "@tanstack/react-query";
3
- import { CalendarClock as te, ChevronLeft as ae, ChevronRight as re } from "lucide-react";
4
- import { useState as G, useMemo as se } from "react";
5
- import { useNivaroClient as ne, useNavigation as oe, useItemNavigation as le } from "../../context.js";
6
- import { get as ie } from "../../lib/commands.js";
7
- import { cn as S } from "../../lib/utils.js";
8
- import { localDateKey as ce, localDayOffset as de, pct as q, isSafeAdminPath as ue, segmentBox as U, recordingAt as X, activeSpan as me, packRows as H, binRequests as pe, hourTicks as he, shiftDate as J } from "./dayTimelineLayout.js";
9
- import { fetchJourneyDays as ge, pageLabel as be, fmtDuration as fe } from "./PersonActivity.js";
10
- import { SectionCard as ye, EmptyLine as K } from "./primitives.js";
11
- const T = 10, z = 3, I = 6, Y = 34, _ = (r) => new Date(r).toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" }), xe = (r) => new Date(r).toLocaleTimeString(void 0, { hour: "numeric" }), k = (r, o, c = `${o}s`) => `${r.toLocaleString()} ${r === 1 ? o : c}`;
12
- function ke(r) {
1
+ import { jsxs as x, jsx as s } from "react/jsx-runtime";
2
+ import { useQuery as J } from "@tanstack/react-query";
3
+ import { CalendarClock as re, ChevronLeft as se, ChevronRight as ne } from "lucide-react";
4
+ import { useState as H, useMemo as oe } from "react";
5
+ import { useNivaroClient as le, useNavigation as ie, useItemNavigation as ce } from "../../context.js";
6
+ import { get as de } from "../../lib/commands.js";
7
+ import { cn as q } from "../../lib/utils.js";
8
+ import { localDateKey as ue, localDayOffset as me, pct as C, isSafeAdminPath as pe, segmentBox as K, recordingAt as Z, activeSpan as he, packRows as U, binRequests as ge, hourTicks as be, shiftDate as V } from "./dayTimelineLayout.js";
9
+ import { fmtDuration as fe, fmtClock as ye } from "./journey-view.js";
10
+ import { fetchJourneyDays as xe, pageLabel as ke } from "./PersonActivity.js";
11
+ import { SectionCard as ve, EmptyLine as I } from "./primitives.js";
12
+ const M = 10, z = 3, B = 6, te = 34, _ = (r) => ye(new Date(r).toISOString()), $e = (r) => {
13
+ const [o, c, d] = r.split("-").map(Number);
14
+ return new Date(o, c - 1, d).toLocaleDateString("en-US", { month: "short", day: "numeric" });
15
+ }, we = (r) => new Date(r).toLocaleTimeString(void 0, { hour: "numeric" }), k = (r, o, c = `${o}s`) => `${r.toLocaleString()} ${r === 1 ? o : c}`;
16
+ function Ne(r) {
13
17
  const o = -r, c = Math.abs(o);
14
18
  return `UTC${o < 0 ? "−" : "+"}${String(Math.floor(c / 60)).padStart(2, "0")}:${String(c % 60).padStart(2, "0")}`;
15
19
  }
16
- const ve = {
20
+ const De = {
17
21
  rage_clicks: "rage click",
18
22
  dead_clicks: "dead click",
19
23
  client_errors: "client error",
@@ -21,65 +25,65 @@ const ve = {
21
25
  slow_actions: "slow call",
22
26
  abandoned_forms: "abandoned form"
23
27
  };
24
- function $e({
28
+ function Se({
25
29
  f: r,
26
30
  href: o,
27
31
  onGo: c
28
32
  }) {
29
- const d = Object.entries(r.worst.components.counts ?? {}).filter(([, p]) => p > 0).map(([p, m]) => k(m, ve[p] ?? p)).join(", "), f = `Frustration ${r.score}/100 — worst of ${k(r.sessions, "session")}${r.worst.top_route ? ` (mostly ${r.worst.top_route})` : ""}${d ? `: ${d}` : ""}${o ? ". Click to watch it." : ""}`, x = S(
33
+ const d = Object.entries(r.worst.components.counts ?? {}).filter(([, p]) => p > 0).map(([p, m]) => k(m, De[p] ?? p)).join(", "), b = `Frustration ${r.score}/100 — worst of ${k(r.sessions, "session")}${r.worst.top_route ? ` (mostly ${r.worst.top_route})` : ""}${d ? `: ${d}` : ""}${o ? ". Click to watch it." : ""}`, y = q(
30
34
  "inline-flex h-6 items-center gap-1 rounded-full border px-2 text-[11px] tabular-nums",
31
35
  r.score >= 50 ? "border-rose-300 text-rose-700 dark:border-rose-500/50 dark:text-rose-300" : "border-slate-200 text-slate-600 dark:border-border dark:text-slate-300"
32
36
  );
33
- return o ? /* @__PURE__ */ y(
37
+ return o ? /* @__PURE__ */ x(
34
38
  "a",
35
39
  {
36
40
  href: o,
37
- title: f,
41
+ title: b,
38
42
  "data-day-frustration": r.score,
39
- className: x,
40
- onClick: ee(() => c(o)),
43
+ className: y,
44
+ onClick: ae(() => c(o)),
41
45
  children: [
42
46
  "Frustration ",
43
47
  r.score
44
48
  ]
45
49
  }
46
- ) : /* @__PURE__ */ y("span", { title: f, "data-day-frustration": r.score, className: x, children: [
50
+ ) : /* @__PURE__ */ x("span", { title: b, "data-day-frustration": r.score, className: y, children: [
47
51
  "Frustration ",
48
52
  r.score
49
53
  ] });
50
54
  }
51
- function ee(r) {
55
+ function ae(r) {
52
56
  return (o) => {
53
57
  o.metaKey || o.ctrlKey || o.shiftKey || (o.preventDefault(), r());
54
58
  };
55
59
  }
56
- function je({ userId: r, initialDate: o }) {
57
- const c = ne(), d = oe(), { urlFor: f, open: x } = le(), p = ce(/* @__PURE__ */ new Date()), [m, $] = G(o ?? p), [h, P] = G(!1), [u, A] = G(null), M = de(m), { data: v } = Q({
60
+ function We({ userId: r, initialDate: o }) {
61
+ const c = le(), d = ie(), { urlFor: b, open: y } = ce(), p = ue(/* @__PURE__ */ new Date()), [m, N] = H(o ?? p), [h, E] = H(!1), [u, P] = H(null), L = me(m), { data: $ } = J({
58
62
  queryKey: ["nvr-journey-days", r, null],
59
- queryFn: () => ge(c, r, null)
60
- }), L = (v == null ? void 0 : v.days) ?? [], w = (v == null ? void 0 : v.apps) ?? [], { data: g, isLoading: F, isError: W } = Q({
61
- queryKey: ["nvr-person-day", r, m, M, u],
63
+ queryFn: () => xe(c, r, null)
64
+ }), R = ($ == null ? void 0 : $.days) ?? [], D = ($ == null ? void 0 : $.apps) ?? [], { data: g, isLoading: W, isError: G } = J({
65
+ queryKey: ["nvr-person-day", r, m, L, u],
62
66
  queryFn: () => c.request(
63
- ie(`/journeys/day/${r}`, {
67
+ de(`/journeys/day/${r}`, {
64
68
  date: m,
65
- tz_offset: M,
69
+ tz_offset: L,
66
70
  ...u ? { app: u } : {}
67
71
  })
68
72
  ).then((t) => t.data),
69
73
  staleTime: 5 * 6e4,
70
74
  refetchOnWindowFocus: !1,
71
75
  retry: !1
72
- }), R = (t) => d.consoleUrl ? d.consoleUrl(t) : t, N = (t, e) => R(
76
+ }), j = (t) => d.consoleUrl ? d.consoleUrl(t) : t, S = (t, e) => j(
73
77
  `/session-replays?recording=${encodeURIComponent(t)}${e != null ? `&t=${Math.round(e)}` : ""}`
74
- ), l = se(() => g ? we(g, h) : null, [g, h]), C = /* @__PURE__ */ y("div", { className: "flex items-center gap-1", children: [
78
+ ), l = oe(() => g ? _e(g, h) : null, [g, h]), T = /* @__PURE__ */ x("div", { className: "flex items-center gap-1", children: [
75
79
  /* @__PURE__ */ s(
76
80
  "button",
77
81
  {
78
82
  type: "button",
79
83
  "aria-label": "Previous day",
80
- onClick: () => $((t) => J(t, -1)),
84
+ onClick: () => N((t) => V(t, -1)),
81
85
  className: "inline-flex h-7 w-7 items-center justify-center rounded-md text-slate-500 hover:bg-slate-50 hover:text-slate-800 dark:text-slate-400 dark:hover:bg-muted",
82
- children: /* @__PURE__ */ s(ae, { className: "h-3.5 w-3.5" })
86
+ children: /* @__PURE__ */ s(se, { className: "h-3.5 w-3.5" })
83
87
  }
84
88
  ),
85
89
  /* @__PURE__ */ s(
@@ -89,7 +93,7 @@ function je({ userId: r, initialDate: o }) {
89
93
  "aria-label": "Day",
90
94
  value: m,
91
95
  max: p,
92
- onChange: (t) => t.target.value && $(t.target.value),
96
+ onChange: (t) => t.target.value && N(t.target.value),
93
97
  className: "h-7 rounded-md border border-slate-200 bg-white px-1.5 text-[11.5px] text-slate-700 dark:border-border dark:bg-card dark:text-slate-200"
94
98
  }
95
99
  ),
@@ -99,29 +103,29 @@ function je({ userId: r, initialDate: o }) {
99
103
  type: "button",
100
104
  "aria-label": "Next day",
101
105
  disabled: m >= p,
102
- onClick: () => $((t) => J(t, 1)),
106
+ onClick: () => N((t) => V(t, 1)),
103
107
  className: "inline-flex h-7 w-7 items-center justify-center rounded-md text-slate-500 hover:bg-slate-50 hover:text-slate-800 disabled:opacity-30 dark:text-slate-400 dark:hover:bg-muted",
104
- children: /* @__PURE__ */ s(re, { className: "h-3.5 w-3.5" })
108
+ children: /* @__PURE__ */ s(ne, { className: "h-3.5 w-3.5" })
105
109
  }
106
110
  )
107
111
  ] });
108
- return /* @__PURE__ */ y(
109
- ye,
112
+ return /* @__PURE__ */ x(
113
+ ve,
110
114
  {
111
- icon: /* @__PURE__ */ s(te, { className: "h-4 w-4" }),
115
+ icon: /* @__PURE__ */ s(re, { className: "h-4 w-4" }),
112
116
  title: "One day",
113
117
  hint: "Recordings, pages, requests, transitions and tasks on one timeline, in your time",
114
118
  testId: "day-timeline",
115
- actions: C,
119
+ actions: T,
116
120
  children: [
117
- (w.length > 1 || w.length === 1 && w[0] !== "admin") && /* @__PURE__ */ s("div", { className: "mb-2 flex flex-wrap items-center gap-1.5", "data-day-apps": !0, children: [null, ...w].map((t) => /* @__PURE__ */ s(
121
+ (D.length > 1 || D.length === 1 && D[0] !== "admin") && /* @__PURE__ */ s("div", { className: "mb-2 flex flex-wrap items-center gap-1.5", "data-day-apps": !0, children: [null, ...D].map((t) => /* @__PURE__ */ s(
118
122
  "button",
119
123
  {
120
124
  type: "button",
121
125
  "aria-pressed": u === t,
122
126
  "data-day-app-filter": t ?? "all",
123
- onClick: () => A(t),
124
- className: S(
127
+ onClick: () => P(t),
128
+ className: q(
125
129
  "rounded-md border px-2 py-0.5 text-[11px]",
126
130
  u === t ? "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"
127
131
  ),
@@ -129,33 +133,33 @@ function je({ userId: r, initialDate: o }) {
129
133
  },
130
134
  t ?? "__all"
131
135
  )) }),
132
- L.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap gap-1.5", "data-day-chips": !0, children: L.slice(0, 14).map((t) => /* @__PURE__ */ s(
136
+ R.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap gap-1.5", "data-day-chips": !0, children: R.slice(0, 14).map((t) => /* @__PURE__ */ s(
133
137
  "button",
134
138
  {
135
139
  type: "button",
136
140
  "aria-pressed": m === t.date,
137
- onClick: () => $(t.date),
138
- className: S(
141
+ onClick: () => N(t.date),
142
+ className: q(
139
143
  "rounded-full border px-2 py-0.5 text-[11px]",
140
144
  m === t.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"
141
145
  ),
142
146
  title: `${t.steps} page views`,
143
- children: t.date === p ? "Today" : t.date.slice(5)
147
+ children: t.date === p ? "Today" : $e(t.date)
144
148
  },
145
149
  t.date
146
150
  )) }),
147
- F ? /* @__PURE__ */ s(K, { children: "Loading…" }) : W || !g || !l ? /* @__PURE__ */ s(K, { children: "This day could not be loaded." }) : l.empty ? /* @__PURE__ */ y(K, { children: [
151
+ W ? /* @__PURE__ */ s(I, { children: "Loading…" }) : G || !g || !l ? /* @__PURE__ */ s(I, { children: "This day could not be loaded." }) : l.empty ? /* @__PURE__ */ x(I, { children: [
148
152
  "Nothing recorded ",
149
153
  m === p ? "today" : `on ${m}`,
150
154
  "."
151
- ] }) : /* @__PURE__ */ y("div", { "data-day-timeline": g.date, children: [
152
- /* @__PURE__ */ y("div", { className: "mb-2 flex flex-wrap items-center gap-x-3 gap-y-1", children: [
155
+ ] }) : /* @__PURE__ */ x("div", { "data-day-timeline": g.date, children: [
156
+ /* @__PURE__ */ x("div", { className: "mb-2 flex flex-wrap items-center gap-x-3 gap-y-1", children: [
153
157
  /* @__PURE__ */ s("p", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", "data-day-summary": !0, children: l.summary.join(" · ") }),
154
158
  g.frustration && /* @__PURE__ */ s(
155
- $e,
159
+ Se,
156
160
  {
157
161
  f: g.frustration,
158
- href: g.frustration.worst.recording_id ? N(g.frustration.worst.recording_id) : null,
162
+ href: g.frustration.worst.recording_id ? S(g.frustration.worst.recording_id) : null,
159
163
  onGo: (t) => d.navigate(t)
160
164
  }
161
165
  ),
@@ -164,16 +168,16 @@ function je({ userId: r, initialDate: o }) {
164
168
  {
165
169
  type: "button",
166
170
  "aria-pressed": h,
167
- onClick: () => P((t) => !t),
171
+ onClick: () => E((t) => !t),
168
172
  className: "ml-auto inline-flex h-6 items-center rounded-md border border-slate-200 px-2 text-[11px] text-slate-600 hover:bg-slate-50 dark:border-border dark:text-slate-300 dark:hover:bg-muted",
169
173
  children: h ? "Active hours" : "Whole day"
170
174
  }
171
175
  )
172
176
  ] }),
173
- /* @__PURE__ */ y("div", { className: "flex", children: [
174
- /* @__PURE__ */ y("div", { className: "w-[92px] shrink-0 pr-2", "aria-hidden": !0, children: [
177
+ /* @__PURE__ */ x("div", { className: "flex", children: [
178
+ /* @__PURE__ */ x("div", { className: "w-[92px] shrink-0 pr-2", "aria-hidden": !0, children: [
175
179
  /* @__PURE__ */ s("div", { className: "h-5" }),
176
- l.lanes.map((t) => /* @__PURE__ */ y(
180
+ l.lanes.map((t) => /* @__PURE__ */ x(
177
181
  "div",
178
182
  {
179
183
  className: "flex flex-col justify-center border-t border-slate-100 dark:border-border/60",
@@ -186,25 +190,25 @@ function je({ userId: r, initialDate: o }) {
186
190
  t.key
187
191
  ))
188
192
  ] }),
189
- /* @__PURE__ */ y("div", { className: "relative min-w-0 flex-1", children: [
193
+ /* @__PURE__ */ x("div", { className: "relative min-w-0 flex-1", children: [
190
194
  /* @__PURE__ */ s("div", { className: "relative h-5", children: l.ticks.map((t, e) => /* @__PURE__ */ s(
191
195
  "span",
192
196
  {
193
197
  className: "absolute top-0 whitespace-nowrap text-[10px] tabular-nums text-slate-400",
194
198
  style: {
195
- left: `${q(t, l.view)}%`,
196
- transform: e === 0 && q(t, l.view) < 2 ? void 0 : q(t, l.view) > 96 ? "translateX(-100%)" : "translateX(-50%)"
199
+ left: `${C(t, l.view)}%`,
200
+ transform: e === 0 && C(t, l.view) < 2 ? void 0 : C(t, l.view) > 96 ? "translateX(-100%)" : "translateX(-50%)"
197
201
  },
198
- children: xe(t)
202
+ children: we(t)
199
203
  },
200
204
  t
201
205
  )) }),
202
- /* @__PURE__ */ y("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 top-5", "aria-hidden": !0, children: [
206
+ /* @__PURE__ */ x("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 top-5", "aria-hidden": !0, children: [
203
207
  l.ticks.map((t) => /* @__PURE__ */ s(
204
208
  "span",
205
209
  {
206
210
  className: "absolute inset-y-0 w-px bg-slate-100 dark:bg-border/60",
207
- style: { left: `${q(t, l.view)}%` }
211
+ style: { left: `${C(t, l.view)}%` }
208
212
  },
209
213
  t
210
214
  )),
@@ -212,12 +216,12 @@ function je({ userId: r, initialDate: o }) {
212
216
  "span",
213
217
  {
214
218
  className: "absolute inset-y-0 w-px bg-red-400/70",
215
- style: { left: `${q(l.now, l.view)}%` },
219
+ style: { left: `${C(l.now, l.view)}%` },
216
220
  title: "Now"
217
221
  }
218
222
  )
219
223
  ] }),
220
- l.lanes.map((t) => /* @__PURE__ */ y(
224
+ l.lanes.map((t) => /* @__PURE__ */ x(
221
225
  "ul",
222
226
  {
223
227
  "aria-label": `${t.label}: ${t.count}`,
@@ -225,54 +229,55 @@ function je({ userId: r, initialDate: o }) {
225
229
  className: "relative border-t border-slate-100 dark:border-border/60",
226
230
  style: { height: t.height },
227
231
  children: [
228
- t.key === "recordings" && l.recordings.map(({ r: e, box: b, row: a }) => {
229
- const n = N(e.id), i = `Recording${e.app ? ` · ${e.app}` : ""} · ${_(e.start)}–${_(e.end)}${e.live ? " · live now" : ""}`;
230
- return /* @__PURE__ */ s(Z, { box: b, row: a, children: /* @__PURE__ */ s(
231
- O,
232
+ t.key === "recordings" && l.recordings.map(({ r: e, box: f, row: a }) => {
233
+ const n = S(e.id), i = `Recording${e.app ? ` · ${e.app}` : ""} · ${_(e.start)}–${_(e.end)}${e.live ? " · live now" : ""}`;
234
+ return /* @__PURE__ */ s(Y, { box: f, row: a, children: /* @__PURE__ */ s(
235
+ F,
232
236
  {
233
237
  href: n,
234
238
  label: `Watch ${i}`,
235
239
  onGo: () => n && d.navigate(n),
236
- className: S(
240
+ className: q(
237
241
  "bg-violet-400/80 hover:bg-violet-500 dark:bg-violet-500/70 dark:hover:bg-violet-400",
238
242
  e.live && "ring-1 ring-red-400"
239
243
  )
240
244
  }
241
245
  ) }, e.id);
242
246
  }),
243
- t.key === "pages" && l.pages.map(({ p: e, box: b, row: a }) => {
244
- const n = (e.app ?? "admin") !== "admin", i = !n && ue(e.path) ? R(e.path) : null, D = `${n ? `${e.app} · ` : ""}${be(e.path)} · ${_(e.start)}${e.duration_seconds != null ? ` · ${fe(e.duration_seconds)}` : ""}`;
245
- return /* @__PURE__ */ s(Z, { box: b, row: a, children: /* @__PURE__ */ s(
246
- O,
247
+ t.key === "pages" && l.pages.map(({ p: e, box: f, row: a }) => {
248
+ var A, Q, X;
249
+ const n = (e.app ?? "admin") !== "admin", i = (A = e.label) == null ? void 0 : A.record, v = i ? b({ collection: i.collection, itemId: i.id }) : !n && ((Q = e.label) == null ? void 0 : Q.kind) !== "record" && pe(e.path) ? j(e.path) : null, O = e.label ? e.label.section && e.label.kind === "page" ? `${e.label.section} › ${e.label.title}` : e.label.title : ke(e.path), w = `${n ? `${e.app} · ` : ""}${O}${(X = e.label) != null && X.detail ? ` (${e.label.detail})` : ""} · ${_(e.start)}${e.duration_seconds != null ? ` · ${fe(e.duration_seconds)}` : ""}`;
250
+ return /* @__PURE__ */ s(Y, { box: f, row: a, children: /* @__PURE__ */ s(
251
+ F,
247
252
  {
248
- href: i,
249
- label: i ? `Open ${D}` : D,
250
- onGo: () => i && d.navigate(i),
253
+ href: v,
254
+ label: v ? `Open ${w}` : w,
255
+ onGo: () => i ? y({ collection: i.collection, itemId: i.id }) : v && d.navigate(v),
251
256
  className: "bg-nvr-cyan/70 hover:bg-nvr-cyan"
252
257
  }
253
258
  ) }, `${e.session_id}-${e.start}-${e.path}`);
254
259
  }),
255
260
  t.key === "requests" && l.requests.map((e) => {
256
- const b = U(e.start, e.end, l.view, 0.25);
257
- if (!b) return null;
261
+ const f = K(e.start, e.end, l.view, 0.25);
262
+ if (!f) return null;
258
263
  const a = Math.max(
259
264
  2,
260
- Math.round(e.count / l.requestMax * (Y - 6))
261
- ), n = e.errors ? Math.max(2, Math.round(e.errors / e.count * a)) : 0, i = g.recordings ?? [], D = X(i, e.end - 1), E = X(i, e.start) ?? (D && { ...D, offsetMs: 0 }), j = E ? N(E.recording.id, E.offsetMs) : null, B = `${_(e.start)}${l.binMinutes > 1 ? `–${_(e.end)}` : ""} · ${k(e.count, "request")}${e.errors ? ` · ${k(e.errors, "error")}` : ""}`;
265
+ Math.round(e.count / l.requestMax * (te - 6))
266
+ ), n = e.errors ? Math.max(2, Math.round(e.errors / e.count * a)) : 0, i = g.recordings ?? [], v = Z(i, e.end - 1), O = Z(i, e.start) ?? (v && { ...v, offsetMs: 0 }), w = O ? S(O.recording.id, O.offsetMs) : null, A = `${_(e.start)}${l.binMinutes > 1 ? `–${_(e.end)}` : ""} · ${k(e.count, "request")}${e.errors ? ` · ${k(e.errors, "error")}` : ""}`;
262
267
  return /* @__PURE__ */ s(
263
268
  "li",
264
269
  {
265
270
  className: "absolute bottom-0.5 flex flex-col justify-end",
266
- style: { left: `${b.left}%`, width: `${b.width}%`, height: a },
271
+ style: { left: `${f.left}%`, width: `${f.width}%`, height: a },
267
272
  children: /* @__PURE__ */ s(
268
- O,
273
+ F,
269
274
  {
270
- href: j,
271
- label: j ? `Watch the recording at ${B}` : B,
272
- onGo: () => j && d.navigate(j),
273
- className: S(
275
+ href: w,
276
+ label: w ? `Watch the recording at ${A}` : A,
277
+ onGo: () => w && d.navigate(w),
278
+ className: q(
274
279
  "flex h-full flex-col justify-end overflow-hidden rounded-[1px] bg-slate-300 dark:bg-slate-600",
275
- j && "hover:bg-slate-400 dark:hover:bg-slate-500"
280
+ w && "hover:bg-slate-400 dark:hover:bg-slate-500"
276
281
  ),
277
282
  children: n > 0 && /* @__PURE__ */ s("span", { className: "block w-full bg-red-500", style: { height: n } })
278
283
  }
@@ -281,27 +286,27 @@ function je({ userId: r, initialDate: o }) {
281
286
  e.start
282
287
  );
283
288
  }),
284
- t.key === "transitions" && l.transitions.map(({ t: e, x: b, row: a }) => {
289
+ t.key === "transitions" && l.transitions.map(({ t: e, x: f, row: a }) => {
285
290
  const n = { collection: e.collection, itemId: e.item }, i = `${e.label ?? "Transition"}${e.from || e.to ? ` (${e.from ?? "—"} → ${e.to ?? "—"})` : ""} · ${e.collection} #${e.item} · ${_(e.at)}`;
286
- return /* @__PURE__ */ s(V, { x: b, row: a, children: /* @__PURE__ */ s(
287
- O,
291
+ return /* @__PURE__ */ s(ee, { x: f, row: a, children: /* @__PURE__ */ s(
292
+ F,
288
293
  {
289
- href: f(n),
294
+ href: b(n),
290
295
  label: `Open ${i}`,
291
- onGo: () => x(n),
296
+ onGo: () => y(n),
292
297
  className: "rounded-full bg-emerald-500 hover:bg-emerald-600 dark:bg-emerald-400"
293
298
  }
294
299
  ) }, e.id);
295
300
  }),
296
- t.key === "tasks" && l.tasks.map(({ t: e, x: b, row: a }) => {
297
- const n = e.collection && e.item ? { collection: e.collection, itemId: e.item } : null, i = n ? f(n) : R("/tasks"), D = `Task ${e.kind} · ${e.title} · ${_(e.at)}`;
298
- return /* @__PURE__ */ s(V, { x: b, row: a, children: /* @__PURE__ */ s(
299
- O,
301
+ t.key === "tasks" && l.tasks.map(({ t: e, x: f, row: a }) => {
302
+ const n = e.collection && e.item ? { collection: e.collection, itemId: e.item } : null, i = n ? b(n) : j("/tasks"), v = `Task ${e.kind} · ${e.title} · ${_(e.at)}`;
303
+ return /* @__PURE__ */ s(ee, { x: f, row: a, children: /* @__PURE__ */ s(
304
+ F,
300
305
  {
301
306
  href: i,
302
- label: `Open ${D}`,
303
- onGo: () => n ? x(n) : i && d.navigate(i),
304
- className: S(
307
+ label: `Open ${v}`,
308
+ onGo: () => n ? y(n) : i && d.navigate(i),
309
+ className: q(
305
310
  "rotate-45 rounded-[1px]",
306
311
  e.kind === "completed" ? "bg-amber-500 hover:bg-amber-600" : "border border-amber-500 bg-white hover:bg-amber-100 dark:bg-card"
307
312
  )
@@ -314,9 +319,9 @@ function je({ userId: r, initialDate: o }) {
314
319
  ))
315
320
  ] })
316
321
  ] }),
317
- /* @__PURE__ */ y("p", { className: "mt-2 text-[10.5px] text-slate-400", children: [
322
+ /* @__PURE__ */ x("p", { className: "mt-2 text-[10.5px] text-slate-400", children: [
318
323
  "Times in your zone (",
319
- ke(g.tz_offset),
324
+ Ne(g.tz_offset),
320
325
  "). Opening a day is recorded in the activity log.",
321
326
  g.capped.length > 0 && ` Some lanes show only their first entries (${g.capped.join(", ")}).`
322
327
  ] })
@@ -325,7 +330,7 @@ function je({ userId: r, initialDate: o }) {
325
330
  }
326
331
  );
327
332
  }
328
- function Z({
333
+ function Y({
329
334
  box: r,
330
335
  row: o,
331
336
  children: c
@@ -337,104 +342,104 @@ function Z({
337
342
  style: {
338
343
  left: `${r.left}%`,
339
344
  width: `${r.width}%`,
340
- top: I / 2 + o * (T + z),
341
- height: T
345
+ top: B / 2 + o * (M + z),
346
+ height: M
342
347
  },
343
348
  children: c
344
349
  }
345
350
  );
346
351
  }
347
- function V({ x: r, row: o, children: c }) {
352
+ function ee({ x: r, row: o, children: c }) {
348
353
  return /* @__PURE__ */ s(
349
354
  "li",
350
355
  {
351
356
  className: "absolute -translate-x-1/2",
352
357
  style: {
353
358
  left: `${r}%`,
354
- top: I / 2 + o * (T + z) + 1,
355
- width: T - 2,
356
- height: T - 2
359
+ top: B / 2 + o * (M + z) + 1,
360
+ width: M - 2,
361
+ height: M - 2
357
362
  },
358
363
  children: c
359
364
  }
360
365
  );
361
366
  }
362
- function O({
367
+ function F({
363
368
  href: r,
364
369
  label: o,
365
370
  onGo: c,
366
371
  className: d,
367
- children: f
372
+ children: b
368
373
  }) {
369
- const x = S(
374
+ const y = q(
370
375
  "block h-full w-full rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
371
376
  d
372
377
  );
373
- return r ? /* @__PURE__ */ s("a", { href: r, "aria-label": o, title: o, onClick: ee(c), className: x, children: f }) : /* @__PURE__ */ s("span", { role: "img", "aria-label": o, title: o, className: x, children: f });
378
+ return r ? /* @__PURE__ */ s("a", { href: r, "aria-label": o, title: o, onClick: ae(c), className: y, children: b }) : /* @__PURE__ */ s("span", { role: "img", "aria-label": o, title: o, className: y, children: b });
374
379
  }
375
- function we(r, o) {
376
- const c = { start: Date.parse(r.day_start), end: Date.parse(r.day_end) }, d = r.recordings ?? [], f = r.pages ?? [], x = r.requests ?? [], p = r.transitions ?? [], m = r.tasks ?? [], $ = [
380
+ function _e(r, o) {
381
+ const c = { start: Date.parse(r.day_start), end: Date.parse(r.day_end) }, d = r.recordings ?? [], b = r.pages ?? [], y = r.requests ?? [], p = r.transitions ?? [], m = r.tasks ?? [], N = [
377
382
  ...d.flatMap((a) => [Date.parse(a.start), Date.parse(a.end) - 1]),
378
- ...f.flatMap((a) => [Date.parse(a.start), Date.parse(a.end) - 1]),
379
- ...x.map((a) => Date.parse(a.minute)),
383
+ ...b.flatMap((a) => [Date.parse(a.start), Date.parse(a.end) - 1]),
384
+ ...y.map((a) => Date.parse(a.minute)),
380
385
  ...p.map((a) => Date.parse(a.at)),
381
386
  ...m.map((a) => Date.parse(a.at))
382
- ], h = o ? c : me($, c), P = h.end - h.start, u = (a) => Date.parse(a), A = H(d.map((a) => ({ start: u(a.start), end: u(a.end) }))), M = H(f.map((a) => ({ start: u(a.start), end: u(a.end) }))), v = P * 0.014, L = (a) => H(a.map((n) => ({ start: u(n.at), end: u(n.at) + v }))), w = L(p), g = L(m), { bins: F, binMinutes: W } = pe(x, h), R = Math.max(1, ...F.map((a) => a.count)), N = x.reduce((a, n) => a + n.count, 0), l = x.reduce((a, n) => a + n.errors, 0), C = (a) => I + a * T + (a - 1) * z, t = [];
387
+ ], h = o ? c : he(N, c), E = h.end - h.start, u = (a) => Date.parse(a), P = U(d.map((a) => ({ start: u(a.start), end: u(a.end) }))), L = U(b.map((a) => ({ start: u(a.start), end: u(a.end) }))), $ = E * 0.014, R = (a) => U(a.map((n) => ({ start: u(n.at), end: u(n.at) + $ }))), D = R(p), g = R(m), { bins: W, binMinutes: G } = ge(y, h), j = Math.max(1, ...W.map((a) => a.count)), S = y.reduce((a, n) => a + n.count, 0), l = y.reduce((a, n) => a + n.errors, 0), T = (a) => B + a * M + (a - 1) * z, t = [];
383
388
  r.recordings && t.push({
384
389
  key: "recordings",
385
390
  label: "Recordings",
386
391
  count: String(d.length),
387
- height: C(A.count)
392
+ height: T(P.count)
388
393
  }), r.pages && t.push({
389
394
  key: "pages",
390
395
  label: "Pages",
391
- count: String(f.length),
392
- height: C(M.count)
396
+ count: String(b.length),
397
+ height: T(L.count)
393
398
  }), r.requests && t.push({
394
399
  key: "requests",
395
400
  label: "Requests",
396
- count: l ? `${N.toLocaleString()} · ${l} err` : N.toLocaleString(),
397
- height: Y
401
+ count: l ? `${S.toLocaleString()} · ${l} err` : S.toLocaleString(),
402
+ height: te
398
403
  }), r.transitions && t.push({
399
404
  key: "transitions",
400
405
  label: "Transitions",
401
406
  count: String(p.length),
402
- height: C(w.count)
407
+ height: T(D.count)
403
408
  }), r.tasks && t.push({
404
409
  key: "tasks",
405
410
  label: "Tasks",
406
411
  count: String(m.length),
407
- height: C(g.count)
412
+ height: T(g.count)
408
413
  });
409
414
  const e = [
410
415
  r.recordings && k(d.length, "recording"),
411
- r.pages && k(f.length, "page"),
412
- r.requests && `${k(N, "request")}${l ? ` (${k(l, "error")})` : ""}`,
416
+ r.pages && k(b.length, "page"),
417
+ r.requests && `${k(S, "request")}${l ? ` (${k(l, "error")})` : ""}`,
413
418
  r.transitions && k(p.length, "transition"),
414
419
  r.tasks && k(m.length, "task")
415
- ].filter((a) => !!a), b = Date.now();
420
+ ].filter((a) => !!a), f = Date.now();
416
421
  return {
417
422
  view: h,
418
- ticks: he(h, c.start),
419
- now: b >= h.start && b < h.end ? b : null,
423
+ ticks: be(h, c.start),
424
+ now: f >= h.start && f < h.end ? f : null,
420
425
  lanes: t,
421
426
  summary: e,
422
- empty: $.length === 0,
427
+ empty: N.length === 0,
423
428
  recordings: d.flatMap((a, n) => {
424
- const i = U(u(a.start), u(a.end), h);
425
- return i ? [{ r: a, box: i, row: A.rows[n] }] : [];
429
+ const i = K(u(a.start), u(a.end), h);
430
+ return i ? [{ r: a, box: i, row: P.rows[n] }] : [];
426
431
  }),
427
- pages: f.flatMap((a, n) => {
428
- const i = U(u(a.start), u(a.end), h);
429
- return i ? [{ p: a, box: i, row: M.rows[n] }] : [];
432
+ pages: b.flatMap((a, n) => {
433
+ const i = K(u(a.start), u(a.end), h);
434
+ return i ? [{ p: a, box: i, row: L.rows[n] }] : [];
430
435
  }),
431
- requests: F,
432
- binMinutes: W,
433
- requestMax: R,
434
- transitions: p.map((a, n) => ({ t: a, x: q(u(a.at), h), row: w.rows[n] })),
435
- tasks: m.map((a, n) => ({ t: a, x: q(u(a.at), h), row: g.rows[n] }))
436
+ requests: W,
437
+ binMinutes: G,
438
+ requestMax: j,
439
+ transitions: p.map((a, n) => ({ t: a, x: C(u(a.at), h), row: D.rows[n] })),
440
+ tasks: m.map((a, n) => ({ t: a, x: C(u(a.at), h), row: g.rows[n] }))
436
441
  };
437
442
  }
438
443
  export {
439
- je as DayTimelineCard
444
+ We as DayTimelineCard
440
445
  };