@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.
- package/dist/full.css +1 -1
- package/dist/hooks/useFormSchema.js +82 -85
- package/dist/hooks/useSessionRecorder.js +206 -175
- package/dist/index.d.ts +84 -16
- package/dist/index.js +627 -622
- package/dist/lib/commands.js +15 -11
- package/dist/shared/components/ActivityEntry.js +5 -5
- package/dist/shared/components/CollectionBrowserView.js +516 -503
- package/dist/shared/components/ItemEditForm.js +3471 -3465
- package/dist/shared/components/JobsTray.js +76 -61
- package/dist/shared/components/MyWorkView.js +133 -126
- package/dist/shared/components/NotificationBell.js +322 -289
- package/dist/shared/components/RecordCompare.js +38 -40
- package/dist/shared/components/RecordReadView.js +119 -119
- package/dist/shared/components/TipLayer.js +56 -41
- package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
- package/dist/shared/components/integrations/console/SignalCard.js +40 -40
- package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +95 -73
- package/dist/shared/components/integrations/console/drill/status.js +23 -18
- package/dist/shared/components/item-edit/InlineGridField.js +45 -45
- package/dist/shared/components/item-edit/InlineTableField.js +750 -749
- package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
- package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
- package/dist/shared/components/item-edit/RecordInsights.js +86 -86
- package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
- package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
- package/dist/shared/components/item-edit/header-path-preview.js +46 -34
- package/dist/shared/components/item-edit/related-missing.js +75 -19
- package/dist/shared/components/notifications/DeliveryChips.js +1 -2
- package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
- package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
- package/dist/shared/components/panels/BackgroundMove.js +242 -0
- package/dist/shared/components/panels/MoveAdvisory.js +204 -0
- package/dist/shared/components/panels/PipelinePanel.js +1459 -1220
- package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
- package/dist/shared/components/profile/ActivityFeedCard.js +322 -0
- package/dist/shared/components/profile/DayTimeline.js +145 -140
- package/dist/shared/components/profile/PersonAccess.js +679 -383
- package/dist/shared/components/profile/PersonActivity.js +404 -427
- package/dist/shared/components/profile/PersonDidPanel.js +248 -134
- package/dist/shared/components/profile/PersonProfile.js +33 -32
- package/dist/shared/components/profile/journey-view.js +166 -0
- package/dist/shared/lib/activity-sentence.js +319 -236
- package/dist/shared/lib/commands.js +18 -14
- package/dist/shared/lib/error-hints.js +1 -1
- package/dist/shared/lib/job-failure-text.js +12 -0
- package/dist/shared/lib/jobs-tray.js +60 -41
- package/dist/shared/lib/move-failure.js +19 -0
- package/dist/shared/lib/obligation-banner.js +22 -21
- package/dist/shared/lib/partner-failure.js +83 -0
- package/dist/shared/lib/prefetch.js +73 -73
- package/dist/shared/lib/replay-checkout.js +18 -13
- package/dist/shared/lib/replay-context.js +90 -77
- package/dist/shared/lib/replay-idle.js +21 -0
- package/dist/shared/lib/replay-socket.js +21 -17
- package/dist/shared/lib/rum.js +56 -51
- package/dist/shared/lib/safe-error.js +17 -13
- package/dist/shared/lib/stale-chunk.js +69 -26
- package/dist/shared/lib/system-collections.js +20 -0
- package/package.json +1 -1
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { CalendarClock as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import { cn as
|
|
8
|
-
import { localDateKey as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
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
|
|
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,
|
|
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__ */
|
|
37
|
+
return o ? /* @__PURE__ */ x(
|
|
34
38
|
"a",
|
|
35
39
|
{
|
|
36
40
|
href: o,
|
|
37
|
-
title:
|
|
41
|
+
title: b,
|
|
38
42
|
"data-day-frustration": r.score,
|
|
39
|
-
className:
|
|
40
|
-
onClick:
|
|
43
|
+
className: y,
|
|
44
|
+
onClick: ae(() => c(o)),
|
|
41
45
|
children: [
|
|
42
46
|
"Frustration ",
|
|
43
47
|
r.score
|
|
44
48
|
]
|
|
45
49
|
}
|
|
46
|
-
) : /* @__PURE__ */
|
|
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
|
|
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
|
|
57
|
-
const c =
|
|
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: () =>
|
|
60
|
-
}),
|
|
61
|
-
queryKey: ["nvr-person-day", r, m,
|
|
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
|
-
|
|
67
|
+
de(`/journeys/day/${r}`, {
|
|
64
68
|
date: m,
|
|
65
|
-
tz_offset:
|
|
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
|
-
}),
|
|
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 =
|
|
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: () =>
|
|
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(
|
|
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 &&
|
|
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: () =>
|
|
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(
|
|
108
|
+
children: /* @__PURE__ */ s(ne, { className: "h-3.5 w-3.5" })
|
|
105
109
|
}
|
|
106
110
|
)
|
|
107
111
|
] });
|
|
108
|
-
return /* @__PURE__ */
|
|
109
|
-
|
|
112
|
+
return /* @__PURE__ */ x(
|
|
113
|
+
ve,
|
|
110
114
|
{
|
|
111
|
-
icon: /* @__PURE__ */ s(
|
|
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:
|
|
119
|
+
actions: T,
|
|
116
120
|
children: [
|
|
117
|
-
(
|
|
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: () =>
|
|
124
|
-
className:
|
|
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
|
-
|
|
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: () =>
|
|
138
|
-
className:
|
|
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
|
|
147
|
+
children: t.date === p ? "Today" : $e(t.date)
|
|
144
148
|
},
|
|
145
149
|
t.date
|
|
146
150
|
)) }),
|
|
147
|
-
|
|
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__ */
|
|
152
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
159
|
+
Se,
|
|
156
160
|
{
|
|
157
161
|
f: g.frustration,
|
|
158
|
-
href: g.frustration.worst.recording_id ?
|
|
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: () =>
|
|
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__ */
|
|
174
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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: `${
|
|
196
|
-
transform: e === 0 &&
|
|
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:
|
|
202
|
+
children: we(t)
|
|
199
203
|
},
|
|
200
204
|
t
|
|
201
205
|
)) }),
|
|
202
|
-
/* @__PURE__ */
|
|
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: `${
|
|
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: `${
|
|
219
|
+
style: { left: `${C(l.now, l.view)}%` },
|
|
216
220
|
title: "Now"
|
|
217
221
|
}
|
|
218
222
|
)
|
|
219
223
|
] }),
|
|
220
|
-
l.lanes.map((t) => /* @__PURE__ */
|
|
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:
|
|
229
|
-
const n =
|
|
230
|
-
return /* @__PURE__ */ s(
|
|
231
|
-
|
|
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:
|
|
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:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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:
|
|
249
|
-
label:
|
|
250
|
-
onGo: () => i && d.navigate(
|
|
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
|
|
257
|
-
if (!
|
|
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 * (
|
|
261
|
-
), n = e.errors ? Math.max(2, Math.round(e.errors / e.count * a)) : 0, i = g.recordings ?? [],
|
|
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: `${
|
|
271
|
+
style: { left: `${f.left}%`, width: `${f.width}%`, height: a },
|
|
267
272
|
children: /* @__PURE__ */ s(
|
|
268
|
-
|
|
273
|
+
F,
|
|
269
274
|
{
|
|
270
|
-
href:
|
|
271
|
-
label:
|
|
272
|
-
onGo: () =>
|
|
273
|
-
className:
|
|
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
|
-
|
|
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:
|
|
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(
|
|
287
|
-
|
|
291
|
+
return /* @__PURE__ */ s(ee, { x: f, row: a, children: /* @__PURE__ */ s(
|
|
292
|
+
F,
|
|
288
293
|
{
|
|
289
|
-
href:
|
|
294
|
+
href: b(n),
|
|
290
295
|
label: `Open ${i}`,
|
|
291
|
-
onGo: () =>
|
|
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:
|
|
297
|
-
const n = e.collection && e.item ? { collection: e.collection, itemId: e.item } : null, i = n ?
|
|
298
|
-
return /* @__PURE__ */ s(
|
|
299
|
-
|
|
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 ${
|
|
303
|
-
onGo: () => n ?
|
|
304
|
-
className:
|
|
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__ */
|
|
322
|
+
/* @__PURE__ */ x("p", { className: "mt-2 text-[10.5px] text-slate-400", children: [
|
|
318
323
|
"Times in your zone (",
|
|
319
|
-
|
|
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
|
|
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:
|
|
341
|
-
height:
|
|
345
|
+
top: B / 2 + o * (M + z),
|
|
346
|
+
height: M
|
|
342
347
|
},
|
|
343
348
|
children: c
|
|
344
349
|
}
|
|
345
350
|
);
|
|
346
351
|
}
|
|
347
|
-
function
|
|
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:
|
|
355
|
-
width:
|
|
356
|
-
height:
|
|
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
|
|
367
|
+
function F({
|
|
363
368
|
href: r,
|
|
364
369
|
label: o,
|
|
365
370
|
onGo: c,
|
|
366
371
|
className: d,
|
|
367
|
-
children:
|
|
372
|
+
children: b
|
|
368
373
|
}) {
|
|
369
|
-
const
|
|
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:
|
|
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
|
|
376
|
-
const c = { start: Date.parse(r.day_start), end: Date.parse(r.day_end) }, d = r.recordings ?? [],
|
|
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
|
-
...
|
|
379
|
-
...
|
|
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 :
|
|
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:
|
|
392
|
+
height: T(P.count)
|
|
388
393
|
}), r.pages && t.push({
|
|
389
394
|
key: "pages",
|
|
390
395
|
label: "Pages",
|
|
391
|
-
count: String(
|
|
392
|
-
height:
|
|
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 ? `${
|
|
397
|
-
height:
|
|
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:
|
|
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:
|
|
412
|
+
height: T(g.count)
|
|
408
413
|
});
|
|
409
414
|
const e = [
|
|
410
415
|
r.recordings && k(d.length, "recording"),
|
|
411
|
-
r.pages && k(
|
|
412
|
-
r.requests && `${k(
|
|
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),
|
|
420
|
+
].filter((a) => !!a), f = Date.now();
|
|
416
421
|
return {
|
|
417
422
|
view: h,
|
|
418
|
-
ticks:
|
|
419
|
-
now:
|
|
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:
|
|
427
|
+
empty: N.length === 0,
|
|
423
428
|
recordings: d.flatMap((a, n) => {
|
|
424
|
-
const i =
|
|
425
|
-
return i ? [{ r: a, box: i, row:
|
|
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:
|
|
428
|
-
const i =
|
|
429
|
-
return i ? [{ p: a, box: i, row:
|
|
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:
|
|
432
|
-
binMinutes:
|
|
433
|
-
requestMax:
|
|
434
|
-
transitions: p.map((a, n) => ({ t: a, x:
|
|
435
|
-
tasks: m.map((a, n) => ({ t: a, x:
|
|
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
|
-
|
|
444
|
+
We as DayTimelineCard
|
|
440
445
|
};
|