@nivaro/react 0.3.15 → 0.3.16
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/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +127 -6
- package/dist/index.js +736 -734
- package/dist/shared/components/CollectionBrowserView.js +2344 -2309
- package/dist/shared/components/ItemEditForm.js +3773 -3604
- package/dist/shared/components/RecordGridEditor.js +319 -282
- package/dist/shared/components/RecordReadView.js +202 -200
- package/dist/shared/components/cbv/unknown-fields.js +18 -8
- package/dist/shared/components/import/DocumentAutofillButton.js +148 -142
- package/dist/shared/components/item-edit/CatalogPickerField.js +264 -276
- package/dist/shared/components/item-edit/FieldRenderer.js +136 -133
- package/dist/shared/components/item-edit/FieldRow.js +198 -184
- package/dist/shared/components/item-edit/HeaderTools.js +107 -99
- package/dist/shared/components/item-edit/InlineTableField.js +138 -136
- package/dist/shared/components/item-edit/RecordLiveSync.js +1 -0
- package/dist/shared/components/item-edit/RelationCombobox.js +30 -23
- package/dist/shared/components/item-edit/SummaryPanel.js +334 -294
- package/dist/shared/components/item-edit/column-length.js +12 -0
- package/dist/shared/components/panels/AccessDeniedPanel.js +47 -37
- package/dist/shared/components/panels/ItemLockBanner.js +307 -285
- package/dist/shared/components/panels/PipelinePanel.js +486 -465
- package/dist/shared/components/panels/RevisionsPanel.js +210 -204
- package/dist/shared/components/profile/DelegationCard.js +178 -121
- package/dist/shared/components/profile/PersonActivity.js +152 -139
- package/dist/shared/components/queue/QueueWorklist.js +668 -659
- package/dist/shared/components/queue/transition-note.js +90 -0
- package/dist/shared/components/support/SupportRequestDialog.js +100 -89
- package/dist/shared/components/support/TicketDetailSheet.js +104 -91
- package/dist/shared/lib/autofill-runs.js +33 -26
- package/dist/shared/lib/draft-store.js +40 -24
- package/dist/shared/lib/live-queries.js +10 -9
- package/dist/shared/lib/restore-skipped.js +10 -0
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
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
|
|
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
|
|
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
|
|
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(
|
|
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
|
|
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__ */
|
|
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__ */
|
|
30
|
-
/* @__PURE__ */ e(ee, { weeks: a.weeks, max:
|
|
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__ */
|
|
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__ */
|
|
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,
|
|
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 -
|
|
60
|
-
return /* @__PURE__ */
|
|
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),
|
|
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 =
|
|
116
|
-
return /* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
-
|
|
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__ */
|
|
149
|
-
/* @__PURE__ */
|
|
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__ */
|
|
157
|
-
q(
|
|
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 = (
|
|
165
|
-
const u = Math.round(
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
-
},
|
|
205
|
-
function
|
|
206
|
-
var
|
|
207
|
-
const l = M(), { urlFor: p } = X(), a = P(), [
|
|
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(
|
|
212
|
+
queryFn: () => l.request(S(`/user-activity/${t}/summary`)).then((n) => n.data)
|
|
210
213
|
}), g = B({
|
|
211
|
-
queryKey: ["nvr-user-activity", t,
|
|
212
|
-
queryFn: ({ pageParam:
|
|
213
|
-
|
|
214
|
-
page:
|
|
215
|
-
limit:
|
|
216
|
-
...
|
|
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: (
|
|
223
|
-
}), b = ((
|
|
224
|
-
for (const
|
|
225
|
-
const
|
|
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 =
|
|
231
|
-
(f == null ? void 0 : f.date) ===
|
|
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__ */
|
|
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__ */
|
|
243
|
+
actions: /* @__PURE__ */ s(
|
|
241
244
|
"button",
|
|
242
245
|
{
|
|
243
246
|
type: "button",
|
|
244
|
-
onClick: () => N((
|
|
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__ */
|
|
254
|
-
x.actions.map((
|
|
255
|
-
const
|
|
256
|
-
return /* @__PURE__ */
|
|
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":
|
|
261
|
-
onClick: () => u(
|
|
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
|
-
|
|
265
|
-
|
|
267
|
+
r.cls,
|
|
268
|
+
i && i !== n.action && "opacity-40"
|
|
266
269
|
),
|
|
267
270
|
children: [
|
|
268
|
-
|
|
269
|
-
/* @__PURE__ */ e("span", { className: "font-mono opacity-70", children:
|
|
271
|
+
n.action,
|
|
272
|
+
/* @__PURE__ */ e("span", { className: "font-mono opacity-70", children: n.count })
|
|
270
273
|
]
|
|
271
274
|
},
|
|
272
|
-
|
|
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((
|
|
284
|
-
value:
|
|
285
|
-
label: `${
|
|
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__ */
|
|
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((
|
|
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__ */
|
|
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
|
-
] },
|
|
313
|
-
|
|
314
|
-
/* @__PURE__ */
|
|
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:
|
|
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:
|
|
320
|
-
const f = U[
|
|
321
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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:
|
|
342
|
+
children: le(r)
|
|
340
343
|
}
|
|
341
344
|
),
|
|
342
|
-
|
|
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: `${
|
|
353
|
+
title: `${r.collection} #${r.item}`,
|
|
351
354
|
children: [
|
|
352
|
-
|
|
353
|
-
|
|
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:
|
|
359
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: r.record_label ?? `#${r.item}` })
|
|
357
360
|
]
|
|
358
361
|
}
|
|
359
|
-
) : /* @__PURE__ */
|
|
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(
|
|
365
|
-
children: j(
|
|
376
|
+
title: O(r.timestamp),
|
|
377
|
+
children: j(r.timestamp)
|
|
366
378
|
}
|
|
367
379
|
)
|
|
368
380
|
] }),
|
|
369
|
-
|
|
370
|
-
|
|
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
|
-
|
|
385
|
+
r.ip
|
|
374
386
|
] })
|
|
375
|
-
] },
|
|
387
|
+
] }, r.id);
|
|
376
388
|
}) })
|
|
377
|
-
] },
|
|
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
|
|
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
|
|
416
|
+
function oe(t, l, p) {
|
|
405
417
|
return t.request(
|
|
406
|
-
|
|
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
|
|
410
|
-
const l = M(), p = P(), a = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), [
|
|
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: () =>
|
|
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,
|
|
426
|
+
queryKey: ["nvr-journey", t, i, c],
|
|
415
427
|
queryFn: () => l.request(
|
|
416
|
-
|
|
417
|
-
).then((
|
|
418
|
-
}), b = y.length > 1 || y.length === 1 && y[0] !== "admin", w = (x == null ? void 0 : x.sessions) ?? [],
|
|
419
|
-
return /* @__PURE__ */
|
|
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((
|
|
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 ===
|
|
432
|
-
"data-journey-app-filter":
|
|
433
|
-
onClick: () => m(
|
|
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 ===
|
|
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:
|
|
450
|
+
children: o ?? "All apps"
|
|
439
451
|
},
|
|
440
|
-
|
|
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((
|
|
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":
|
|
447
|
-
onClick: () => u(
|
|
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
|
-
|
|
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: `${
|
|
453
|
-
children:
|
|
464
|
+
title: `${o.steps} page views`,
|
|
465
|
+
children: o.date === a ? "Today" : o.date.slice(5)
|
|
454
466
|
},
|
|
455
|
-
|
|
467
|
+
o.date
|
|
456
468
|
)) }),
|
|
457
|
-
g ? /* @__PURE__ */ e(C, { children: "Loading…" }) : w.length === 0 ? /* @__PURE__ */
|
|
469
|
+
g ? /* @__PURE__ */ e(C, { children: "Loading…" }) : w.length === 0 ? /* @__PURE__ */ s(C, { children: [
|
|
458
470
|
"No pages recorded ",
|
|
459
|
-
|
|
471
|
+
i === a ? "today" : `on ${i}`,
|
|
460
472
|
"."
|
|
461
|
-
] }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: w.map((
|
|
462
|
-
/* @__PURE__ */
|
|
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(
|
|
478
|
+
j(o.started_at),
|
|
467
479
|
" · ",
|
|
468
|
-
|
|
480
|
+
o.steps.length,
|
|
469
481
|
" page",
|
|
470
|
-
|
|
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":
|
|
476
|
-
children:
|
|
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:
|
|
481
|
-
const f = (h.app ?? "admin") === "admin" && h.path.startsWith("/") && !h.path.startsWith("//") && !h.path.includes(":") ?
|
|
482
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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 && ` · ${
|
|
513
|
+
h.duration_seconds != null && ` · ${ie(h.duration_seconds)}`
|
|
502
514
|
] })
|
|
503
515
|
] })
|
|
504
|
-
] }, `${h.entered_at}-${
|
|
516
|
+
] }, `${h.entered_at}-${n}`);
|
|
505
517
|
}) })
|
|
506
|
-
] },
|
|
518
|
+
] }, o.session_id)) })
|
|
507
519
|
]
|
|
508
520
|
}
|
|
509
521
|
);
|
|
510
522
|
}
|
|
511
|
-
function
|
|
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__ */
|
|
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
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
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
|
};
|