@nivaro/react 0.3.119 → 0.3.120
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/shared/components/CopyValueButton.js +61 -0
- package/dist/shared/components/GridPresenceLine.js +46 -36
- package/dist/shared/components/ItemEditForm.js +1265 -1246
- package/dist/shared/components/ProfileView.js +181 -175
- package/dist/shared/components/RecordReadView.js +590 -557
- package/dist/shared/components/UserAvatar.js +11 -11
- package/dist/shared/components/item-edit/HeaderBand.js +50 -50
- package/dist/shared/components/item-edit/UserChip.js +52 -47
- package/dist/shared/components/profile/PersonAccess.js +84 -94
- package/dist/shared/components/profile/primitives.js +2 -1
- package/dist/shared/components/support/SupportEmailSwitch.js +63 -0
- package/dist/shared/components/support/SupportView.js +51 -45
- package/dist/shared/lib/header-strip.js +125 -120
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as t, jsx as e, Fragment as ee } from "react/jsx-runtime";
|
|
2
2
|
import { readUser as ye, readUserCard as ve, updateUser as ce, readMyScopes as ke, saveMyScopeDefaults as Ne, readItems as ae } from "@nivaro/sdk";
|
|
3
3
|
import { useQueryClient as M, useQuery as v, useMutation as _ } from "@tanstack/react-query";
|
|
4
|
-
import { Loader2 as
|
|
4
|
+
import { Loader2 as me, Camera as we, Building2 as _e, Mail as Se, Phone as Ce, Clock as qe, Undo2 as Pe, Check as Te, UserRound as Ae, Filter as Fe, LogOut as Le, ShieldCheck as Oe } from "lucide-react";
|
|
5
5
|
import { useRef as xe, useEffect as Me, useState as q, useMemo as De } from "react";
|
|
6
6
|
import { useNivaroClient as F, useItemEditAuth as se } from "../context.js";
|
|
7
|
-
import { get as A, patch as J, post as te, put as Ke, del as
|
|
8
|
-
import { parseLiveMode as
|
|
7
|
+
import { get as A, patch as J, post as te, put as Ke, del as Ee } from "../lib/commands.js";
|
|
8
|
+
import { parseLiveMode as ue, LIVE_MODE_LABELS as Re, LIVE_MODE_HINTS as G, useLivePreference as Ie } from "../lib/live-preference.js";
|
|
9
9
|
import { playNotificationSound as pe } from "../lib/notification-sound.js";
|
|
10
10
|
import { restrictedScopeSelections as je, cascadeFilter as Ue, fetchCascadeRelations as Qe } from "../lib/quick-filter-cascade.js";
|
|
11
11
|
import { BRAND_ACCENT as re, parseThemeAccents as $e, DEFAULT_THEME_ACCENTS as he } from "../lib/theme-accents.js";
|
|
@@ -23,25 +23,27 @@ import { MailSuppressedPill as at } from "./profile/MailSuppressedPill.js";
|
|
|
23
23
|
import { PersonDidPanel as rt } from "./profile/PersonDidPanel.js";
|
|
24
24
|
import { TeamLoadCard as nt } from "./profile/PersonExtras.js";
|
|
25
25
|
import { TeamsConnect as st } from "./profile/TeamsConnect.js";
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
26
|
+
import { CopyValueButton as lt } from "./CopyValueButton.js";
|
|
27
|
+
import { NotificationSourcesCard as ot } from "./NotificationSourcesCard.js";
|
|
28
|
+
import { MyDefaultsCard as it } from "./profile/MyDefaultsCard.js";
|
|
29
|
+
import { UserScopesCard as dt } from "./profile/PersonAccess.js";
|
|
30
|
+
import { PersonProfile as ct } from "./profile/PersonProfile.js";
|
|
30
31
|
import { Toggle as fe, SectionCard as le, Field as V, ConfirmButton as be } from "./profile/primitives.js";
|
|
31
|
-
import { SignedInDevices as
|
|
32
|
-
import {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
import { SignedInDevices as mt } from "./profile/SignedInDevices.js";
|
|
33
|
+
import { SupportEmailSwitch as ut } from "./support/SupportEmailSwitch.js";
|
|
34
|
+
import { SimpleSelectXs as R } from "./ui/SimpleSelect.js";
|
|
35
|
+
const pt = (s) => [s.first_name, s.last_name].filter(Boolean).join(" ") || (s.email ?? "Unknown"), ht = (s) => {
|
|
36
|
+
var m, r;
|
|
37
|
+
return (`${((m = s.first_name) == null ? void 0 : m[0]) ?? ""}${((r = s.last_name) == null ? void 0 : r[0]) ?? ""}` || (s.email ?? "?").slice(0, 2)).toUpperCase();
|
|
38
|
+
}, bt = Ve;
|
|
39
|
+
function xt() {
|
|
40
|
+
const s = F(), m = M(), { data: r = [] } = v({
|
|
39
41
|
queryKey: ["nvr-profile-fields"],
|
|
40
42
|
queryFn: () => s.request(A("/profile-fields/mine")).then((a) => a.data ?? []).catch(() => [])
|
|
41
43
|
}), [n, o] = q(null), d = _({
|
|
42
44
|
mutationFn: (a) => s.request(Ke("/profile-fields/mine", { values: a })),
|
|
43
45
|
onSuccess: () => {
|
|
44
|
-
o(null),
|
|
46
|
+
o(null), m.invalidateQueries({ queryKey: ["nvr-profile-fields"] });
|
|
45
47
|
}
|
|
46
48
|
});
|
|
47
49
|
if (r.length === 0) return null;
|
|
@@ -59,7 +61,7 @@ function ht() {
|
|
|
59
61
|
a.required && /* @__PURE__ */ e("span", { className: "ml-0.5 text-red-500", children: "*" })
|
|
60
62
|
] }),
|
|
61
63
|
a.type === "boolean" ? /* @__PURE__ */ e(
|
|
62
|
-
|
|
64
|
+
R,
|
|
63
65
|
{
|
|
64
66
|
value: c[a.key] || "false",
|
|
65
67
|
options: [
|
|
@@ -69,7 +71,7 @@ function ht() {
|
|
|
69
71
|
onChange: (h) => o({ ...c, [a.key]: h })
|
|
70
72
|
}
|
|
71
73
|
) : a.type === "select" ? /* @__PURE__ */ e(
|
|
72
|
-
|
|
74
|
+
R,
|
|
73
75
|
{
|
|
74
76
|
value: c[a.key] || "",
|
|
75
77
|
options: [
|
|
@@ -111,9 +113,9 @@ function ht() {
|
|
|
111
113
|
] })
|
|
112
114
|
] });
|
|
113
115
|
}
|
|
114
|
-
function
|
|
116
|
+
function gt() {
|
|
115
117
|
var W, oe, ie;
|
|
116
|
-
const s = F(),
|
|
118
|
+
const s = F(), m = se(), r = M(), { data: n } = v({
|
|
117
119
|
queryKey: ["nvr-profile-prefs"],
|
|
118
120
|
queryFn: () => s.request(A("/users/me")).then((l) => {
|
|
119
121
|
var b;
|
|
@@ -133,11 +135,11 @@ function bt() {
|
|
|
133
135
|
var l;
|
|
134
136
|
!a || typeof window > "u" || window.location.hash === "#notification-rules" && ((l = i.current) == null || l.scrollIntoView({ block: "start", behavior: "smooth" }));
|
|
135
137
|
}, [a]);
|
|
136
|
-
const h = (n == null ? void 0 : n.notification_prefs) ?? {}, { data:
|
|
138
|
+
const h = (n == null ? void 0 : n.notification_prefs) ?? {}, { data: u } = v({
|
|
137
139
|
queryKey: ["nvr-my-rule-defaults"],
|
|
138
140
|
queryFn: () => s.request(A("/notifications/my-rule-defaults")).then((l) => l.data).catch(() => null),
|
|
139
141
|
staleTime: 6e4
|
|
140
|
-
}), P = (n == null ? void 0 : n.email_digest) === "daily" ? "daily" : "instant", C = Ye(h,
|
|
142
|
+
}), P = (n == null ? void 0 : n.email_digest) === "daily" ? "daily" : "instant", C = Ye(h, u != null && u.role ? u.rules : null), D = (l) => {
|
|
141
143
|
var b, w, Y, de;
|
|
142
144
|
return ((w = (b = h.matrix) == null ? void 0 : b[l]) == null ? void 0 : w.email) ?? (P === "daily" ? "daily" : ((de = (Y = C.matrix) == null ? void 0 : Y[l]) == null ? void 0 : de.email) ?? P);
|
|
143
145
|
}, y = _({
|
|
@@ -185,11 +187,11 @@ function bt() {
|
|
|
185
187
|
localStorage.setItem("nvr-noise-dismissed", JSON.stringify({ at: Date.now(), cats: b }));
|
|
186
188
|
} catch {
|
|
187
189
|
}
|
|
188
|
-
}, p = Number.isInteger(Number(n == null ? void 0 : n.digest_hour)) ? Number(n == null ? void 0 : n.digest_hour) : 7, N = (l) => `${l % 12 === 0 ? 12 : l % 12}:45 ${l < 12 ? "AM" : "PM"}`, [T,
|
|
190
|
+
}, p = Number.isInteger(Number(n == null ? void 0 : n.digest_hour)) ? Number(n == null ? void 0 : n.digest_hour) : 7, N = (l) => `${l % 12 === 0 ? 12 : l % 12}:45 ${l < 12 ? "AM" : "PM"}`, [T, E] = q(null), O = _({
|
|
189
191
|
mutationFn: () => s.request(te("/users/me/digest-test", {})),
|
|
190
|
-
onSuccess: (l) =>
|
|
191
|
-
onError: () =>
|
|
192
|
-
}), Z =
|
|
192
|
+
onSuccess: (l) => E(l.data.note),
|
|
193
|
+
onError: () => E("Test send failed — try again.")
|
|
194
|
+
}), Z = bt.some((l) => D(l.key) === "daily"), X = ({ text: l }) => /* @__PURE__ */ e(
|
|
193
195
|
"span",
|
|
194
196
|
{
|
|
195
197
|
className: "ml-1 inline-flex h-3.5 w-3.5 cursor-help items-center justify-center rounded-full border border-slate-300 text-[9px] font-semibold normal-case tracking-normal text-slate-400 dark:border-border",
|
|
@@ -294,7 +296,7 @@ function bt() {
|
|
|
294
296
|
/* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-2 text-[12.5px] text-slate-600 dark:text-muted-foreground", children: [
|
|
295
297
|
"Sound:",
|
|
296
298
|
/* @__PURE__ */ e(
|
|
297
|
-
|
|
299
|
+
R,
|
|
298
300
|
{
|
|
299
301
|
value: String((n == null ? void 0 : n.notification_sound) ?? "off"),
|
|
300
302
|
options: [
|
|
@@ -324,8 +326,9 @@ function bt() {
|
|
|
324
326
|
"Hold notifications during huddles",
|
|
325
327
|
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "toasts and sounds wait while you talk; you get one summary when you leave" })
|
|
326
328
|
] }),
|
|
329
|
+
/* @__PURE__ */ e(ut, {}),
|
|
327
330
|
/* @__PURE__ */ e(
|
|
328
|
-
|
|
331
|
+
Ot,
|
|
329
332
|
{
|
|
330
333
|
on: (n == null ? void 0 : n.urgent_sound) === !0,
|
|
331
334
|
onChange: (l) => {
|
|
@@ -337,10 +340,10 @@ function bt() {
|
|
|
337
340
|
We,
|
|
338
341
|
{
|
|
339
342
|
subject: "person",
|
|
340
|
-
isAdmin:
|
|
343
|
+
isAdmin: m.isAdmin,
|
|
341
344
|
value: h,
|
|
342
|
-
inherited:
|
|
343
|
-
inheritedName: ((oe =
|
|
345
|
+
inherited: u != null && u.role ? u.rules : null,
|
|
346
|
+
inheritedName: ((oe = u == null ? void 0 : u.role) == null ? void 0 : oe.name) ?? null,
|
|
344
347
|
legacyEmail: P,
|
|
345
348
|
saving: y.isPending,
|
|
346
349
|
onCommit: (l) => I(l),
|
|
@@ -356,7 +359,7 @@ function bt() {
|
|
|
356
359
|
/* @__PURE__ */ e(X, { text: "A different sound for this category, or none. Default follows the Sound setting above." })
|
|
357
360
|
] }),
|
|
358
361
|
cell: (l, b) => /* @__PURE__ */ e("div", { className: "inline-block", children: /* @__PURE__ */ e(
|
|
359
|
-
|
|
362
|
+
R,
|
|
360
363
|
{
|
|
361
364
|
ariaLabel: `Sound for ${b}`,
|
|
362
365
|
value: x[l] ?? "default",
|
|
@@ -384,7 +387,7 @@ function bt() {
|
|
|
384
387
|
/* @__PURE__ */ t("span", { className: "flex items-center gap-1.5", children: [
|
|
385
388
|
"Deliver at",
|
|
386
389
|
/* @__PURE__ */ e(
|
|
387
|
-
|
|
390
|
+
R,
|
|
388
391
|
{
|
|
389
392
|
ariaLabel: "Digest delivery hour",
|
|
390
393
|
value: String(p),
|
|
@@ -454,8 +457,8 @@ function bt() {
|
|
|
454
457
|
}
|
|
455
458
|
);
|
|
456
459
|
}
|
|
457
|
-
function
|
|
458
|
-
const s = F(),
|
|
460
|
+
function ft() {
|
|
461
|
+
const s = F(), m = M(), { data: r } = v({
|
|
459
462
|
queryKey: ["nvr-profile-prefs"],
|
|
460
463
|
queryFn: () => s.request(A("/users/me")).then((c) => {
|
|
461
464
|
var i;
|
|
@@ -463,7 +466,7 @@ function xt() {
|
|
|
463
466
|
})
|
|
464
467
|
}), n = (r == null ? void 0 : r.link_app) === "portal" || (r == null ? void 0 : r.link_app) === "admin" ? r.link_app : "auto", o = _({
|
|
465
468
|
mutationFn: (c) => s.request(J("/users/me/preferences", { link_app: c })),
|
|
466
|
-
onSuccess: () => void
|
|
469
|
+
onSuccess: () => void m.invalidateQueries({ queryKey: ["nvr-profile-prefs"] })
|
|
467
470
|
});
|
|
468
471
|
return /* @__PURE__ */ t(
|
|
469
472
|
"div",
|
|
@@ -492,17 +495,17 @@ function xt() {
|
|
|
492
495
|
}
|
|
493
496
|
);
|
|
494
497
|
}
|
|
495
|
-
function
|
|
496
|
-
const s = F(),
|
|
498
|
+
function yt() {
|
|
499
|
+
const s = F(), m = M(), [r, n] = q(""), o = (() => {
|
|
497
500
|
try {
|
|
498
501
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
499
502
|
} catch {
|
|
500
503
|
return "UTC";
|
|
501
504
|
}
|
|
502
505
|
})(), d = (() => {
|
|
503
|
-
var
|
|
506
|
+
var u;
|
|
504
507
|
try {
|
|
505
|
-
return ((
|
|
508
|
+
return ((u = Intl.supportedValuesOf) == null ? void 0 : u.call(
|
|
506
509
|
Intl,
|
|
507
510
|
"timeZone"
|
|
508
511
|
)) ?? [];
|
|
@@ -511,16 +514,16 @@ function gt() {
|
|
|
511
514
|
}
|
|
512
515
|
})(), { data: c } = v({
|
|
513
516
|
queryKey: ["nvr-profile-prefs"],
|
|
514
|
-
queryFn: () => s.request(A("/users/me")).then((
|
|
517
|
+
queryFn: () => s.request(A("/users/me")).then((u) => {
|
|
515
518
|
var P;
|
|
516
|
-
return ((P =
|
|
519
|
+
return ((P = u.data) == null ? void 0 : P.preferences) ?? {};
|
|
517
520
|
})
|
|
518
521
|
}), i = typeof (c == null ? void 0 : c.timezone) == "string" ? c.timezone : null, a = _({
|
|
519
|
-
mutationFn: (
|
|
520
|
-
onSuccess: (
|
|
521
|
-
ze(P), n(""),
|
|
522
|
+
mutationFn: (u) => s.request(J("/users/me/preferences", { timezone: u })),
|
|
523
|
+
onSuccess: (u, P) => {
|
|
524
|
+
ze(P), n(""), m.invalidateQueries({ queryKey: ["nvr-profile-prefs"] });
|
|
522
525
|
}
|
|
523
|
-
}), h = r.length > 1 ? d.filter((
|
|
526
|
+
}), h = r.length > 1 ? d.filter((u) => u.toLowerCase().includes(r.toLowerCase())).slice(0, 8) : [];
|
|
524
527
|
return /* @__PURE__ */ t(
|
|
525
528
|
"div",
|
|
526
529
|
{
|
|
@@ -551,33 +554,33 @@ function gt() {
|
|
|
551
554
|
"input",
|
|
552
555
|
{
|
|
553
556
|
value: r,
|
|
554
|
-
onChange: (
|
|
557
|
+
onChange: (u) => n(u.target.value),
|
|
555
558
|
placeholder: "Change zone… (e.g. America/Denver)",
|
|
556
559
|
className: "h-8 w-[280px] rounded-md border border-slate-200 bg-background px-2.5 text-[12.5px] dark:border-border"
|
|
557
560
|
}
|
|
558
561
|
),
|
|
559
|
-
h.length > 0 && /* @__PURE__ */ e("div", { className: "absolute z-10 mt-1 w-[280px] rounded-md border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-card", children: h.map((
|
|
562
|
+
h.length > 0 && /* @__PURE__ */ e("div", { className: "absolute z-10 mt-1 w-[280px] rounded-md border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-card", children: h.map((u) => /* @__PURE__ */ e(
|
|
560
563
|
"button",
|
|
561
564
|
{
|
|
562
565
|
type: "button",
|
|
563
|
-
onClick: () => a.mutate(
|
|
566
|
+
onClick: () => a.mutate(u),
|
|
564
567
|
className: "block w-full px-2.5 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted dark:text-foreground",
|
|
565
|
-
children:
|
|
568
|
+
children: u
|
|
566
569
|
},
|
|
567
|
-
|
|
570
|
+
u
|
|
568
571
|
)) })
|
|
569
572
|
] })
|
|
570
573
|
]
|
|
571
574
|
}
|
|
572
575
|
);
|
|
573
576
|
}
|
|
574
|
-
function
|
|
575
|
-
const s = F(),
|
|
577
|
+
function vt() {
|
|
578
|
+
const s = F(), m = M(), { data: r } = v({
|
|
576
579
|
queryKey: ["nvr-profile-scopes"],
|
|
577
580
|
queryFn: () => s.request(ke()).then((o) => o.data)
|
|
578
581
|
}), n = _({
|
|
579
582
|
mutationFn: ({ dimension: o, values: d }) => s.request(Ne(o, d)),
|
|
580
|
-
onSuccess: () => void
|
|
583
|
+
onSuccess: () => void m.invalidateQueries({ queryKey: ["nvr-profile-scopes"] })
|
|
581
584
|
});
|
|
582
585
|
return !r || r.dimensions.length === 0 ? null : /* @__PURE__ */ e(
|
|
583
586
|
le,
|
|
@@ -587,7 +590,7 @@ function ft() {
|
|
|
587
590
|
title: "Default filters",
|
|
588
591
|
hint: "Pre-selected in browsers and reports — clear anytime",
|
|
589
592
|
children: /* @__PURE__ */ e("div", { className: "space-y-3", children: r.dimensions.map((o) => /* @__PURE__ */ e(
|
|
590
|
-
|
|
593
|
+
kt,
|
|
591
594
|
{
|
|
592
595
|
dimension: o,
|
|
593
596
|
selected: r.defaults[o.name] ?? [],
|
|
@@ -600,14 +603,14 @@ function ft() {
|
|
|
600
603
|
}
|
|
601
604
|
);
|
|
602
605
|
}
|
|
603
|
-
function
|
|
606
|
+
function kt({
|
|
604
607
|
dimension: s,
|
|
605
|
-
selected:
|
|
608
|
+
selected: m,
|
|
606
609
|
restricted: r,
|
|
607
610
|
scopes: n,
|
|
608
611
|
onSave: o
|
|
609
612
|
}) {
|
|
610
|
-
const d = F(), c = M(), i = s.display_field ?? "name", [a, h] = q(""), [
|
|
613
|
+
const d = F(), c = M(), i = s.display_field ?? "name", [a, h] = q(""), [u, P] = q(!1), C = je(s.target_collection, n), D = async () => C.length ? Ue(
|
|
611
614
|
s.target_collection,
|
|
612
615
|
await Qe(d, c, s.target_collection),
|
|
613
616
|
C
|
|
@@ -627,10 +630,10 @@ function yt({
|
|
|
627
630
|
label: String(T[i] ?? T.id)
|
|
628
631
|
}));
|
|
629
632
|
}
|
|
630
|
-
}), S = r != null && r.length ? new Set(r.map(String)) : null, k = S ? y.filter((p) => S.has(String(p.id))) : y, L = new Set(
|
|
633
|
+
}), S = r != null && r.length ? new Set(r.map(String)) : null, k = S ? y.filter((p) => S.has(String(p.id))) : y, L = new Set(m.map(String)), f = k.length > 24 || y.length >= 200 && !S, { data: I = [], isFetching: $ } = v({
|
|
631
634
|
queryKey: ["nvr-scope-search", s.name, a, C],
|
|
632
635
|
queryFn: async () => {
|
|
633
|
-
const p = await D(), N = { [i]: { _contains: a } },
|
|
636
|
+
const p = await D(), N = { [i]: { _contains: a } }, E = ((await d.request(
|
|
634
637
|
ae(s.target_collection, {
|
|
635
638
|
fields: ["id", i],
|
|
636
639
|
filter: p ? { _and: [N, p] } : N,
|
|
@@ -641,13 +644,13 @@ function yt({
|
|
|
641
644
|
id: O.id,
|
|
642
645
|
label: String(O[i] ?? O.id)
|
|
643
646
|
}));
|
|
644
|
-
return S ?
|
|
647
|
+
return S ? E.filter((O) => S.has(String(O.id))) : E;
|
|
645
648
|
},
|
|
646
649
|
enabled: f && a.trim().length > 0,
|
|
647
650
|
placeholderData: (p) => p
|
|
648
651
|
}), x = new Map(y.map((p) => [String(p.id), p.label]));
|
|
649
652
|
for (const p of I) x.set(String(p.id), p.label);
|
|
650
|
-
const K =
|
|
653
|
+
const K = m.filter((p) => !x.has(String(p))), { data: H = [] } = v({
|
|
651
654
|
queryKey: ["nvr-scope-selected-labels", s.name, K.map(String).sort().join(",")],
|
|
652
655
|
queryFn: async () => ((await d.request(
|
|
653
656
|
ae(s.target_collection, {
|
|
@@ -664,13 +667,13 @@ function yt({
|
|
|
664
667
|
for (const p of H) x.set(String(p.id), p.label);
|
|
665
668
|
const j = (p) => {
|
|
666
669
|
const N = L.has(String(p));
|
|
667
|
-
o(N ?
|
|
668
|
-
}, g = a.trim().toLowerCase(), U = g ? k.filter((p) => p.label.toLowerCase().includes(g)) : k, Q = g.length === 0 ? k.slice(0, 30) : $ && I.length === 0 ? U.slice(0, 30) : I, B = f && (
|
|
670
|
+
o(N ? m.filter((T) => String(T) !== String(p)) : [...m, p]);
|
|
671
|
+
}, g = a.trim().toLowerCase(), U = g ? k.filter((p) => p.label.toLowerCase().includes(g)) : k, Q = g.length === 0 ? k.slice(0, 30) : $ && I.length === 0 ? U.slice(0, 30) : I, B = f && (u || g.length > 0);
|
|
669
672
|
return /* @__PURE__ */ t("div", { children: [
|
|
670
673
|
/* @__PURE__ */ t("p", { className: "mb-1 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: [
|
|
671
674
|
s.label,
|
|
672
675
|
r != null && r.length ? /* @__PURE__ */ e("span", { className: "ml-1.5 normal-case tracking-normal text-amber-500", children: "(limited by your access)" }) : null,
|
|
673
|
-
|
|
676
|
+
m.length > 0 && /* @__PURE__ */ t(
|
|
674
677
|
"button",
|
|
675
678
|
{
|
|
676
679
|
type: "button",
|
|
@@ -678,13 +681,13 @@ function yt({
|
|
|
678
681
|
className: "ml-2 normal-case tracking-normal text-slate-400 underline-offset-2 hover:text-slate-600 hover:underline",
|
|
679
682
|
children: [
|
|
680
683
|
"clear ",
|
|
681
|
-
|
|
684
|
+
m.length
|
|
682
685
|
]
|
|
683
686
|
}
|
|
684
687
|
)
|
|
685
688
|
] }),
|
|
686
689
|
f ? /* @__PURE__ */ t("div", { className: "max-w-xl", children: [
|
|
687
|
-
|
|
690
|
+
m.length > 0 && /* @__PURE__ */ e("div", { className: "mb-1.5 flex flex-wrap gap-1", children: m.map((p) => /* @__PURE__ */ t(
|
|
688
691
|
"span",
|
|
689
692
|
{
|
|
690
693
|
className: "inline-flex items-center gap-1 rounded-full border border-nvr-cyan bg-nvr-cyan/10 py-0.5 pl-2.5 pr-1 text-[11.5px] font-medium text-nvr-navy dark:text-nvr-cyan",
|
|
@@ -745,7 +748,7 @@ function yt({
|
|
|
745
748
|
]
|
|
746
749
|
}
|
|
747
750
|
),
|
|
748
|
-
!B &&
|
|
751
|
+
!B && m.length === 0 && /* @__PURE__ */ e("p", { className: "mt-1 text-[11px] text-slate-400", children: "No defaults set — click to browse or type to search." })
|
|
749
752
|
] }) : /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: [
|
|
750
753
|
k.map((p) => {
|
|
751
754
|
const N = L.has(String(p.id));
|
|
@@ -767,12 +770,12 @@ function yt({
|
|
|
767
770
|
] })
|
|
768
771
|
] });
|
|
769
772
|
}
|
|
770
|
-
function
|
|
773
|
+
function Nt() {
|
|
771
774
|
const { data: s } = v({
|
|
772
775
|
queryKey: ["nvr-settings-2fa"],
|
|
773
776
|
queryFn: () => r.request({ _method: "GET", _path: "/settings/" }).then((f) => (f == null ? void 0 : f.data) ?? null).catch(() => null),
|
|
774
777
|
staleTime: 6e5
|
|
775
|
-
}),
|
|
778
|
+
}), m = (s == null ? void 0 : s.two_factor_enabled) !== !1, r = F(), n = M(), [o, d] = q(null), [c, i] = q(""), [a, h] = q(null), { data: u } = v({
|
|
776
779
|
queryKey: ["nvr-profile-totp"],
|
|
777
780
|
queryFn: () => r.request({ _method: "GET", _path: "/two-factor/status" }).then((f) => f.data)
|
|
778
781
|
}), P = () => void n.invalidateQueries({ queryKey: ["nvr-profile-totp"] }), C = _({
|
|
@@ -811,9 +814,9 @@ function vt() {
|
|
|
811
814
|
{
|
|
812
815
|
icon: /* @__PURE__ */ e(Oe, { className: "h-4 w-4" }),
|
|
813
816
|
title: "Security",
|
|
814
|
-
hint:
|
|
817
|
+
hint: m ? "Two-factor sign-in and API access" : "API access",
|
|
815
818
|
children: /* @__PURE__ */ t("div", { className: "space-y-4", children: [
|
|
816
|
-
|
|
819
|
+
m && /* @__PURE__ */ t("div", { children: [
|
|
817
820
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
818
821
|
/* @__PURE__ */ e("p", { className: "text-[12.5px] font-medium text-slate-700 dark:text-slate-200", children: "Two-factor authentication" }),
|
|
819
822
|
/* @__PURE__ */ e(
|
|
@@ -821,13 +824,13 @@ function vt() {
|
|
|
821
824
|
{
|
|
822
825
|
className: z(
|
|
823
826
|
"rounded-full px-1.5 py-px text-[10px] font-semibold",
|
|
824
|
-
|
|
827
|
+
u != null && u.enabled ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400" : "bg-slate-100 text-slate-500 dark:bg-muted dark:text-slate-400"
|
|
825
828
|
),
|
|
826
|
-
children:
|
|
829
|
+
children: u != null && u.enabled ? "Enabled" : "Off"
|
|
827
830
|
}
|
|
828
831
|
)
|
|
829
832
|
] }),
|
|
830
|
-
!(
|
|
833
|
+
!(u != null && u.enabled) && !o && /* @__PURE__ */ e(
|
|
831
834
|
"button",
|
|
832
835
|
{
|
|
833
836
|
type: "button",
|
|
@@ -871,7 +874,7 @@ function vt() {
|
|
|
871
874
|
] })
|
|
872
875
|
] })
|
|
873
876
|
] }),
|
|
874
|
-
(
|
|
877
|
+
(u == null ? void 0 : u.enabled) && /* @__PURE__ */ t("div", { className: "mt-2 flex gap-1.5", children: [
|
|
875
878
|
/* @__PURE__ */ e(
|
|
876
879
|
"input",
|
|
877
880
|
{
|
|
@@ -897,11 +900,14 @@ function vt() {
|
|
|
897
900
|
/* @__PURE__ */ t(
|
|
898
901
|
"div",
|
|
899
902
|
{
|
|
900
|
-
className:
|
|
903
|
+
className: m ? "border-t border-slate-100 pt-3 dark:border-border/60" : void 0,
|
|
901
904
|
children: [
|
|
902
905
|
/* @__PURE__ */ e("p", { className: "text-[12.5px] font-medium text-slate-700 dark:text-slate-200", children: "API token" }),
|
|
903
906
|
/* @__PURE__ */ e("p", { className: "mt-0.5 text-[11.5px] text-slate-400", children: "Personal Bearer token for scripts and integrations. Shown once — creating a new one replaces the old." }),
|
|
904
|
-
a && /* @__PURE__ */
|
|
907
|
+
a && /* @__PURE__ */ t("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
908
|
+
/* @__PURE__ */ e("code", { className: "min-w-0 flex-1 select-all break-all rounded-md bg-slate-50 px-2.5 py-2 font-mono text-[11.5px] text-nvr-navy dark:bg-muted dark:text-nvr-cyan", children: a }),
|
|
909
|
+
/* @__PURE__ */ e(lt, { value: a, label: "Copy token", testId: "copy-own-api-token" })
|
|
910
|
+
] }),
|
|
905
911
|
/* @__PURE__ */ t("div", { className: "mt-2 flex gap-1.5", children: [
|
|
906
912
|
/* @__PURE__ */ e(
|
|
907
913
|
"button",
|
|
@@ -949,19 +955,19 @@ function vt() {
|
|
|
949
955
|
}
|
|
950
956
|
);
|
|
951
957
|
}
|
|
952
|
-
function
|
|
958
|
+
function ha({
|
|
953
959
|
userId: s,
|
|
954
|
-
className:
|
|
960
|
+
className: m,
|
|
955
961
|
initialTab: r,
|
|
956
962
|
extra: n,
|
|
957
963
|
pushServiceWorker: o = "/sw.js"
|
|
958
964
|
}) {
|
|
959
965
|
const d = se();
|
|
960
|
-
return !s || (d == null ? void 0 : d.userId) != null && String(d.userId) === String(s) ? /* @__PURE__ */ e(
|
|
966
|
+
return !s || (d == null ? void 0 : d.userId) != null && String(d.userId) === String(s) ? /* @__PURE__ */ e(wt, { className: m, extra: n, pushServiceWorker: o }) : /* @__PURE__ */ e(ct, { userId: s, className: m, initialTab: r });
|
|
961
967
|
}
|
|
962
|
-
function
|
|
968
|
+
function wt({
|
|
963
969
|
className: s,
|
|
964
|
-
extra:
|
|
970
|
+
extra: m,
|
|
965
971
|
pushServiceWorker: r
|
|
966
972
|
}) {
|
|
967
973
|
var j;
|
|
@@ -969,7 +975,7 @@ function kt({
|
|
|
969
975
|
queryKey: ["nvr-profile-user", i],
|
|
970
976
|
queryFn: () => n.request(ye(i)).then((g) => g.data),
|
|
971
977
|
enabled: c
|
|
972
|
-
}), h = (a == null ? void 0 : a.id) ?? null, { data:
|
|
978
|
+
}), h = (a == null ? void 0 : a.id) ?? null, { data: u } = v({
|
|
973
979
|
queryKey: ["nvr-profile-card", h],
|
|
974
980
|
queryFn: () => n.request(ve(h)).then((g) => g.data),
|
|
975
981
|
enabled: !!h
|
|
@@ -987,18 +993,18 @@ function kt({
|
|
|
987
993
|
onSuccess: () => {
|
|
988
994
|
C(null), o.invalidateQueries({ queryKey: ["nvr-profile-user"] }), o.invalidateQueries({ queryKey: ["nvr-profile-card"] });
|
|
989
995
|
}
|
|
990
|
-
}), [L, f] = q(
|
|
996
|
+
}), [L, f] = q(_t), I = xe(null), $ = _({
|
|
991
997
|
mutationFn: async (g) => {
|
|
992
998
|
const U = await new Promise((Q, B) => {
|
|
993
999
|
const p = new Image(), N = URL.createObjectURL(g);
|
|
994
1000
|
p.onload = () => {
|
|
995
1001
|
URL.revokeObjectURL(N);
|
|
996
|
-
const T = 96,
|
|
997
|
-
|
|
998
|
-
const O =
|
|
1002
|
+
const T = 96, E = document.createElement("canvas");
|
|
1003
|
+
E.width = T, E.height = T;
|
|
1004
|
+
const O = E.getContext("2d");
|
|
999
1005
|
if (!O) return B(new Error("canvas unavailable"));
|
|
1000
1006
|
const Z = Math.max(T / p.width, T / p.height), X = p.width * Z, W = p.height * Z;
|
|
1001
|
-
O.drawImage(p, (T - X) / 2, (T - W) / 2, X, W), Q(
|
|
1007
|
+
O.drawImage(p, (T - X) / 2, (T - W) / 2, X, W), Q(E.toDataURL("image/jpeg", 0.85));
|
|
1002
1008
|
}, p.onerror = () => {
|
|
1003
1009
|
URL.revokeObjectURL(N), B(new Error("not an image"));
|
|
1004
1010
|
}, p.src = N;
|
|
@@ -1008,7 +1014,7 @@ function kt({
|
|
|
1008
1014
|
onSuccess: () => {
|
|
1009
1015
|
o.invalidateQueries({ queryKey: ["nvr-profile-user"] }), o.invalidateQueries({ queryKey: ["nvr-profile-card"] }), o.invalidateQueries({ queryKey: ["user-card"] }), o.invalidateQueries({ queryKey: ["user-avatar"] });
|
|
1010
1016
|
}
|
|
1011
|
-
}), x =
|
|
1017
|
+
}), x = u ?? (a ? { ...a, role_name: null } : null);
|
|
1012
1018
|
if (!x)
|
|
1013
1019
|
return /* @__PURE__ */ t("div", { className: z("flex animate-pulse flex-col gap-4", s), "aria-busy": "true", children: [
|
|
1014
1020
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-5 rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: [
|
|
@@ -1035,7 +1041,7 @@ function kt({
|
|
|
1035
1041
|
alt: "",
|
|
1036
1042
|
className: "h-[76px] w-[76px] rounded-full border border-slate-200 object-cover dark:border-border"
|
|
1037
1043
|
}
|
|
1038
|
-
) : /* @__PURE__ */ e("span", { className: "flex h-[76px] w-[76px] items-center justify-center rounded-full bg-[#c7f0fb] text-[24px] font-semibold text-[#04516b] dark:bg-nvr-cyan/15 dark:text-nvr-cyan", children:
|
|
1044
|
+
) : /* @__PURE__ */ e("span", { className: "flex h-[76px] w-[76px] items-center justify-center rounded-full bg-[#c7f0fb] text-[24px] font-semibold text-[#04516b] dark:bg-nvr-cyan/15 dark:text-nvr-cyan", children: ht(x) }),
|
|
1039
1045
|
/* @__PURE__ */ e(
|
|
1040
1046
|
"span",
|
|
1041
1047
|
{
|
|
@@ -1058,7 +1064,7 @@ function kt({
|
|
|
1058
1064
|
return (g = I.current) == null ? void 0 : g.click();
|
|
1059
1065
|
},
|
|
1060
1066
|
className: "absolute -right-1 -top-1 flex h-7 w-7 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-500 shadow-sm transition-colors hover:border-nvr-cyan hover:text-nvr-navy dark:border-border dark:bg-background dark:text-slate-300 dark:hover:text-nvr-cyan",
|
|
1061
|
-
children: $.isPending ? /* @__PURE__ */ e(
|
|
1067
|
+
children: $.isPending ? /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(we, { className: "h-3.5 w-3.5" })
|
|
1062
1068
|
}
|
|
1063
1069
|
),
|
|
1064
1070
|
/* @__PURE__ */ e(
|
|
@@ -1079,7 +1085,7 @@ function kt({
|
|
|
1079
1085
|
] }),
|
|
1080
1086
|
/* @__PURE__ */ t("div", { className: "min-w-0 flex-1", children: [
|
|
1081
1087
|
/* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1082
|
-
/* @__PURE__ */ e("h1", { className: "text-[21px] font-semibold tracking-[-0.015em] text-slate-900 dark:text-white", children:
|
|
1088
|
+
/* @__PURE__ */ e("h1", { className: "text-[21px] font-semibold tracking-[-0.015em] text-slate-900 dark:text-white", children: pt(x) }),
|
|
1083
1089
|
x.role_name && /* @__PURE__ */ e("span", { className: "rounded-full bg-nvr-cyan/10 px-2 py-px text-[10.5px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: x.role_name }),
|
|
1084
1090
|
x.is_out_of_office && /* @__PURE__ */ e("span", { className: "rounded-full bg-amber-50 px-2 py-px text-[10.5px] font-semibold text-amber-600 dark:bg-amber-500/10 dark:text-amber-400", children: "Out of office" }),
|
|
1085
1091
|
/* @__PURE__ */ e(at, { email: x.email, canClear: d.isAdmin })
|
|
@@ -1137,7 +1143,7 @@ function kt({
|
|
|
1137
1143
|
] })
|
|
1138
1144
|
] })
|
|
1139
1145
|
] }) }),
|
|
1140
|
-
/* @__PURE__ */ e(
|
|
1146
|
+
/* @__PURE__ */ e(St, { tab: L, onChange: f }),
|
|
1141
1147
|
L === "agents" ? /* @__PURE__ */ e(Je, {}) : L === "did" && a ? (
|
|
1142
1148
|
// #13 — your own audit trail, by day and collection.
|
|
1143
1149
|
/* @__PURE__ */ e(rt, { userId: String(a.id), name: null })
|
|
@@ -1180,7 +1186,7 @@ function kt({
|
|
|
1180
1186
|
onClick: () => k.mutate(),
|
|
1181
1187
|
className: "inline-flex h-7 items-center gap-1 rounded-md bg-nvr-cyan px-2.5 text-[11.5px] font-semibold text-white transition-opacity disabled:opacity-50",
|
|
1182
1188
|
children: [
|
|
1183
|
-
k.isPending ? /* @__PURE__ */ e(
|
|
1189
|
+
k.isPending ? /* @__PURE__ */ e(me, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(Te, { className: "h-3 w-3" }),
|
|
1184
1190
|
" ",
|
|
1185
1191
|
"Save"
|
|
1186
1192
|
]
|
|
@@ -1244,33 +1250,33 @@ function kt({
|
|
|
1244
1250
|
}
|
|
1245
1251
|
}
|
|
1246
1252
|
),
|
|
1247
|
-
/* @__PURE__ */ e(ht, {}),
|
|
1248
|
-
/* @__PURE__ */ e(gt, {}),
|
|
1249
|
-
/* @__PURE__ */ e(At, {}),
|
|
1250
|
-
/* @__PURE__ */ e(ot, {}),
|
|
1251
1253
|
/* @__PURE__ */ e(xt, {}),
|
|
1254
|
+
/* @__PURE__ */ e(yt, {}),
|
|
1255
|
+
/* @__PURE__ */ e(Lt, {}),
|
|
1256
|
+
/* @__PURE__ */ e(it, {}),
|
|
1257
|
+
/* @__PURE__ */ e(ft, {}),
|
|
1252
1258
|
/* @__PURE__ */ e(Ze, {}),
|
|
1253
1259
|
/* @__PURE__ */ e(Xe, {}),
|
|
1254
|
-
d.isAdmin && (a != null && a.id) ? /* @__PURE__ */ e(
|
|
1255
|
-
/* @__PURE__ */ e(St, {}),
|
|
1256
|
-
/* @__PURE__ */ e(nt, { userId: "me" }),
|
|
1257
|
-
/* @__PURE__ */ e(Ct, {}),
|
|
1258
|
-
/* @__PURE__ */ e(bt, {}),
|
|
1259
|
-
/* @__PURE__ */ e(lt, {}),
|
|
1260
|
-
r !== !1 && /* @__PURE__ */ e(et, { serviceWorkerPath: r }),
|
|
1260
|
+
d.isAdmin && (a != null && a.id) ? /* @__PURE__ */ e(dt, { userId: String(a.id) }) : /* @__PURE__ */ e(vt, {}),
|
|
1261
1261
|
/* @__PURE__ */ e(qt, {}),
|
|
1262
|
-
/* @__PURE__ */ e(
|
|
1263
|
-
/* @__PURE__ */ e(vt, {}),
|
|
1262
|
+
/* @__PURE__ */ e(nt, { userId: "me" }),
|
|
1264
1263
|
/* @__PURE__ */ e(Pt, {}),
|
|
1265
|
-
/* @__PURE__ */ e(
|
|
1266
|
-
|
|
1264
|
+
/* @__PURE__ */ e(gt, {}),
|
|
1265
|
+
/* @__PURE__ */ e(ot, {}),
|
|
1266
|
+
r !== !1 && /* @__PURE__ */ e(et, { serviceWorkerPath: r }),
|
|
1267
|
+
/* @__PURE__ */ e(Tt, {}),
|
|
1268
|
+
/* @__PURE__ */ e(mt, {}),
|
|
1269
|
+
/* @__PURE__ */ e(Nt, {}),
|
|
1270
|
+
/* @__PURE__ */ e(At, {}),
|
|
1271
|
+
/* @__PURE__ */ e(Ct, {}),
|
|
1272
|
+
m
|
|
1267
1273
|
]
|
|
1268
1274
|
}
|
|
1269
1275
|
)
|
|
1270
1276
|
) : null
|
|
1271
1277
|
] });
|
|
1272
1278
|
}
|
|
1273
|
-
function
|
|
1279
|
+
function _t() {
|
|
1274
1280
|
try {
|
|
1275
1281
|
const s = new URLSearchParams(window.location.search).get("tab");
|
|
1276
1282
|
return s === "agents" || s === "did" ? s : "profile";
|
|
@@ -1278,12 +1284,12 @@ function Nt() {
|
|
|
1278
1284
|
return "profile";
|
|
1279
1285
|
}
|
|
1280
1286
|
}
|
|
1281
|
-
function
|
|
1287
|
+
function St({
|
|
1282
1288
|
tab: s,
|
|
1283
|
-
onChange:
|
|
1289
|
+
onChange: m
|
|
1284
1290
|
}) {
|
|
1285
1291
|
const r = (o) => {
|
|
1286
|
-
|
|
1292
|
+
m(o);
|
|
1287
1293
|
try {
|
|
1288
1294
|
const d = new URL(window.location.href);
|
|
1289
1295
|
o !== "profile" ? d.searchParams.set("tab", o) : d.searchParams.delete("tab"), window.history.replaceState(window.history.state, "", d);
|
|
@@ -1318,11 +1324,11 @@ function wt({
|
|
|
1318
1324
|
}
|
|
1319
1325
|
);
|
|
1320
1326
|
}
|
|
1321
|
-
function
|
|
1322
|
-
const s = F(), [
|
|
1327
|
+
function Ct() {
|
|
1328
|
+
const s = F(), [m, r] = q(!1), { data: n = [], isLoading: o } = v({
|
|
1323
1329
|
queryKey: ["my-matrix-seats"],
|
|
1324
1330
|
queryFn: () => s.request(A("/pipelines/my-seats")).then((c) => c.data ?? []).catch(() => []),
|
|
1325
|
-
enabled:
|
|
1331
|
+
enabled: m,
|
|
1326
1332
|
staleTime: 6e4
|
|
1327
1333
|
}), d = /* @__PURE__ */ new Map();
|
|
1328
1334
|
for (const c of n) {
|
|
@@ -1341,11 +1347,11 @@ function _t() {
|
|
|
1341
1347
|
/* @__PURE__ */ e("h3", { className: "text-[14px] font-semibold", children: "My approval seats" }),
|
|
1342
1348
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "Every owner-matrix cell you sit in — why records land in your queue." })
|
|
1343
1349
|
] }),
|
|
1344
|
-
/* @__PURE__ */ e("span", { className: "text-slate-400", children:
|
|
1350
|
+
/* @__PURE__ */ e("span", { className: "text-slate-400", children: m ? "▾" : "▸" })
|
|
1345
1351
|
]
|
|
1346
1352
|
}
|
|
1347
1353
|
),
|
|
1348
|
-
|
|
1354
|
+
m && (o ? /* @__PURE__ */ e("p", { className: "mt-3 text-[12.5px] text-slate-400", children: "Loading…" }) : n.length === 0 ? /* @__PURE__ */ e("p", { className: "mt-3 text-[12.5px] text-slate-400", children: "You're not in any owner groups — approvals never route to you automatically." }) : /* @__PURE__ */ e("div", { className: "mt-3 space-y-3", children: [...d.entries()].map(([c, i]) => /* @__PURE__ */ t("div", { children: [
|
|
1349
1355
|
/* @__PURE__ */ e("p", { className: "text-[11px] font-semibold uppercase tracking-wide text-slate-400", children: c }),
|
|
1350
1356
|
/* @__PURE__ */ t("ul", { className: "mt-1 space-y-1.5", children: [
|
|
1351
1357
|
i.slice(0, 40).map((a) => /* @__PURE__ */ t("li", { className: "text-[12.5px]", children: [
|
|
@@ -1382,18 +1388,18 @@ function _t() {
|
|
|
1382
1388
|
] }, c)) }))
|
|
1383
1389
|
] });
|
|
1384
1390
|
}
|
|
1385
|
-
function
|
|
1386
|
-
const s = F(),
|
|
1391
|
+
function qt() {
|
|
1392
|
+
const s = F(), m = M(), { data: r = [] } = v({
|
|
1387
1393
|
queryKey: ["my-reminders"],
|
|
1388
|
-
queryFn: () => s.request(A("/reminders")).then((
|
|
1394
|
+
queryFn: () => s.request(A("/reminders")).then((u) => u.data).catch(() => []),
|
|
1389
1395
|
staleTime: 3e4
|
|
1390
|
-
}), [n, o] = q(""), [d, c] = q(""), i = () => void
|
|
1396
|
+
}), [n, o] = q(""), [d, c] = q(""), i = () => void m.invalidateQueries({ queryKey: ["my-reminders"] }), a = _({
|
|
1391
1397
|
mutationFn: () => s.request(te("/reminders", { note: n, remind_at: new Date(d).toISOString() })),
|
|
1392
1398
|
onSuccess: () => {
|
|
1393
1399
|
o(""), c(""), i();
|
|
1394
1400
|
}
|
|
1395
1401
|
}), h = _({
|
|
1396
|
-
mutationFn: (
|
|
1402
|
+
mutationFn: (u) => s.request(Ee(`/reminders/${u}`)),
|
|
1397
1403
|
onSuccess: i
|
|
1398
1404
|
});
|
|
1399
1405
|
return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
@@ -1403,34 +1409,34 @@ function St() {
|
|
|
1403
1409
|
] }),
|
|
1404
1410
|
/* @__PURE__ */ t("div", { className: "space-y-2 px-4 py-3", children: [
|
|
1405
1411
|
r.length === 0 && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "No upcoming reminders." }),
|
|
1406
|
-
r.map((
|
|
1412
|
+
r.map((u) => /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
1407
1413
|
/* @__PURE__ */ t("div", { className: "min-w-0 flex-1", children: [
|
|
1408
|
-
/* @__PURE__ */ e("p", { className: "truncate text-[12.5px] text-slate-700 dark:text-slate-200", children:
|
|
1409
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: new Date(
|
|
1414
|
+
/* @__PURE__ */ e("p", { className: "truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: u.note }),
|
|
1415
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: new Date(u.remind_at).toLocaleString() })
|
|
1410
1416
|
] }),
|
|
1411
1417
|
/* @__PURE__ */ e(
|
|
1412
1418
|
"button",
|
|
1413
1419
|
{
|
|
1414
1420
|
type: "button",
|
|
1415
|
-
onClick: () => h.mutate(
|
|
1421
|
+
onClick: () => h.mutate(u.id),
|
|
1416
1422
|
className: "shrink-0 rounded px-1.5 py-0.5 text-[11px] text-slate-400 hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-500/10",
|
|
1417
1423
|
children: "Cancel"
|
|
1418
1424
|
}
|
|
1419
1425
|
)
|
|
1420
|
-
] },
|
|
1426
|
+
] }, u.id)),
|
|
1421
1427
|
/* @__PURE__ */ t(
|
|
1422
1428
|
"form",
|
|
1423
1429
|
{
|
|
1424
1430
|
className: "flex flex-wrap items-center gap-2 pt-1",
|
|
1425
|
-
onSubmit: (
|
|
1426
|
-
|
|
1431
|
+
onSubmit: (u) => {
|
|
1432
|
+
u.preventDefault(), n.trim() && d && a.mutate();
|
|
1427
1433
|
},
|
|
1428
1434
|
children: [
|
|
1429
1435
|
/* @__PURE__ */ e(
|
|
1430
1436
|
"input",
|
|
1431
1437
|
{
|
|
1432
1438
|
value: n,
|
|
1433
|
-
onChange: (
|
|
1439
|
+
onChange: (u) => o(u.target.value),
|
|
1434
1440
|
placeholder: "Remind me to…",
|
|
1435
1441
|
className: "h-7 min-w-[160px] flex-1 rounded border border-slate-200 px-2 text-[12px] outline-none focus:border-nvr-cyan dark:border-border dark:bg-background"
|
|
1436
1442
|
}
|
|
@@ -1440,7 +1446,7 @@ function St() {
|
|
|
1440
1446
|
{
|
|
1441
1447
|
type: "datetime-local",
|
|
1442
1448
|
value: d,
|
|
1443
|
-
onChange: (
|
|
1449
|
+
onChange: (u) => c(u.target.value),
|
|
1444
1450
|
className: "h-7 rounded border border-slate-200 px-2 text-[12px] outline-none focus:border-nvr-cyan dark:border-border dark:bg-background"
|
|
1445
1451
|
}
|
|
1446
1452
|
),
|
|
@@ -1459,27 +1465,27 @@ function St() {
|
|
|
1459
1465
|
] })
|
|
1460
1466
|
] });
|
|
1461
1467
|
}
|
|
1462
|
-
function
|
|
1463
|
-
const s = F(), { data:
|
|
1468
|
+
function Pt() {
|
|
1469
|
+
const s = F(), { data: m } = v({
|
|
1464
1470
|
queryKey: ["my-stats"],
|
|
1465
1471
|
queryFn: () => s.request(A("/users/me/stats")).then((n) => n.data).catch(() => null),
|
|
1466
1472
|
staleTime: 5 * 6e4
|
|
1467
1473
|
});
|
|
1468
|
-
if (!
|
|
1469
|
-
const r = Math.max(1, ...
|
|
1474
|
+
if (!m) return null;
|
|
1475
|
+
const r = Math.max(1, ...m.weeks.map((n) => n.transitions + n.tasks_done + n.created));
|
|
1470
1476
|
return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
1471
1477
|
/* @__PURE__ */ t("header", { className: "flex items-center justify-between border-b border-slate-100 px-4 py-2.5 dark:border-border/60", children: [
|
|
1472
1478
|
/* @__PURE__ */ t("div", { children: [
|
|
1473
1479
|
/* @__PURE__ */ e("h3", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: "My activity" }),
|
|
1474
1480
|
/* @__PURE__ */ e("p", { className: "mt-0.5 text-[11px] text-slate-400", children: "Last 8 weeks — just yours." })
|
|
1475
1481
|
] }),
|
|
1476
|
-
|
|
1477
|
-
|
|
1482
|
+
m.streak_days > 1 && /* @__PURE__ */ t("span", { className: "rounded-full bg-nvr-cyan/10 px-2 py-0.5 text-[11px] font-medium text-nvr-navy dark:text-nvr-cyan", children: [
|
|
1483
|
+
m.streak_days,
|
|
1478
1484
|
"-day streak"
|
|
1479
1485
|
] })
|
|
1480
1486
|
] }),
|
|
1481
1487
|
/* @__PURE__ */ t("div", { className: "px-4 py-3", children: [
|
|
1482
|
-
/* @__PURE__ */ e("div", { className: "flex items-end gap-1.5", style: { height: 56 }, children:
|
|
1488
|
+
/* @__PURE__ */ e("div", { className: "flex items-end gap-1.5", style: { height: 56 }, children: m.weeks.map((n, o) => {
|
|
1483
1489
|
const d = n.transitions + n.tasks_done + n.created;
|
|
1484
1490
|
return /* @__PURE__ */ e(
|
|
1485
1491
|
"div",
|
|
@@ -1497,17 +1503,17 @@ function Ct() {
|
|
|
1497
1503
|
] }),
|
|
1498
1504
|
/* @__PURE__ */ t("div", { className: "mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
1499
1505
|
/* @__PURE__ */ t("span", { children: [
|
|
1500
|
-
/* @__PURE__ */ e("b", { className: "tabular-nums text-slate-700 dark:text-slate-200", children:
|
|
1506
|
+
/* @__PURE__ */ e("b", { className: "tabular-nums text-slate-700 dark:text-slate-200", children: m.totals.transitions }),
|
|
1501
1507
|
" ",
|
|
1502
1508
|
"transitions"
|
|
1503
1509
|
] }),
|
|
1504
1510
|
/* @__PURE__ */ t("span", { children: [
|
|
1505
|
-
/* @__PURE__ */ e("b", { className: "tabular-nums text-slate-700 dark:text-slate-200", children:
|
|
1511
|
+
/* @__PURE__ */ e("b", { className: "tabular-nums text-slate-700 dark:text-slate-200", children: m.totals.tasks_done }),
|
|
1506
1512
|
" ",
|
|
1507
1513
|
"tasks done"
|
|
1508
1514
|
] }),
|
|
1509
1515
|
/* @__PURE__ */ t("span", { children: [
|
|
1510
|
-
/* @__PURE__ */ e("b", { className: "tabular-nums text-slate-700 dark:text-slate-200", children:
|
|
1516
|
+
/* @__PURE__ */ e("b", { className: "tabular-nums text-slate-700 dark:text-slate-200", children: m.totals.created }),
|
|
1511
1517
|
" ",
|
|
1512
1518
|
"records created"
|
|
1513
1519
|
] })
|
|
@@ -1515,15 +1521,15 @@ function Ct() {
|
|
|
1515
1521
|
] })
|
|
1516
1522
|
] });
|
|
1517
1523
|
}
|
|
1518
|
-
function
|
|
1519
|
-
const s = F(),
|
|
1524
|
+
function Tt() {
|
|
1525
|
+
const s = F(), m = M(), { data: r } = v({
|
|
1520
1526
|
queryKey: ["my-security"],
|
|
1521
1527
|
queryFn: () => s.request(A("/security/my/sessions")).then((d) => d.data).catch(() => ({ sessions: [], logins: [] })),
|
|
1522
1528
|
staleTime: 3e4
|
|
1523
1529
|
}), n = _({
|
|
1524
1530
|
mutationFn: () => s.request(te("/security/my/sessions/sign-out-others", {})).then((d) => d.data),
|
|
1525
1531
|
onSuccess: (d) => {
|
|
1526
|
-
|
|
1532
|
+
m.invalidateQueries({ queryKey: ["my-security"] }), o(`Signed out ${(d == null ? void 0 : d.revoked) ?? 0} other session(s)`);
|
|
1527
1533
|
},
|
|
1528
1534
|
onError: (d) => {
|
|
1529
1535
|
var i, a;
|
|
@@ -1593,11 +1599,11 @@ function qt() {
|
|
|
1593
1599
|
] })
|
|
1594
1600
|
] });
|
|
1595
1601
|
}
|
|
1596
|
-
function
|
|
1597
|
-
const s = F(), [
|
|
1602
|
+
function At() {
|
|
1603
|
+
const s = F(), [m, r] = q(!1), { data: n } = v({
|
|
1598
1604
|
queryKey: ["my-permissions"],
|
|
1599
1605
|
queryFn: () => s.request(A("/security/my/permissions")).then((o) => o.data),
|
|
1600
|
-
enabled:
|
|
1606
|
+
enabled: m,
|
|
1601
1607
|
staleTime: 5 * 6e4
|
|
1602
1608
|
});
|
|
1603
1609
|
return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
@@ -1612,11 +1618,11 @@ function Pt() {
|
|
|
1612
1618
|
/* @__PURE__ */ e("h3", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: "What can I access?" }),
|
|
1613
1619
|
/* @__PURE__ */ e("p", { className: "mt-0.5 text-[11px] text-slate-400", children: "Your role, collections, and data limits in plain language." })
|
|
1614
1620
|
] }),
|
|
1615
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children:
|
|
1621
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: m ? "Hide" : "Show" })
|
|
1616
1622
|
]
|
|
1617
1623
|
}
|
|
1618
1624
|
),
|
|
1619
|
-
|
|
1625
|
+
m && n && /* @__PURE__ */ t("div", { className: "space-y-2 border-t border-slate-100 px-4 py-3 text-[12.5px] text-slate-600 dark:border-border/60 dark:text-slate-300", children: [
|
|
1620
1626
|
/* @__PURE__ */ t("p", { children: [
|
|
1621
1627
|
"Your role is ",
|
|
1622
1628
|
/* @__PURE__ */ e("b", { children: n.role ?? "unassigned" }),
|
|
@@ -1649,25 +1655,25 @@ function Pt() {
|
|
|
1649
1655
|
] })
|
|
1650
1656
|
] });
|
|
1651
1657
|
}
|
|
1652
|
-
function
|
|
1658
|
+
function Ft({
|
|
1653
1659
|
value: s,
|
|
1654
|
-
onChange:
|
|
1660
|
+
onChange: m
|
|
1655
1661
|
}) {
|
|
1656
1662
|
const r = F(), { data: n } = v({
|
|
1657
1663
|
queryKey: ["live-preference-default"],
|
|
1658
1664
|
queryFn: () => r.request(A("/live-preference/default")).then((i) => {
|
|
1659
1665
|
var a;
|
|
1660
|
-
return
|
|
1666
|
+
return ue((a = i.data) == null ? void 0 : a.mode);
|
|
1661
1667
|
}).catch(() => null),
|
|
1662
1668
|
staleTime: 5 * 6e4
|
|
1663
|
-
}), o =
|
|
1669
|
+
}), o = ue(s), d = Re[n ?? "normal"], c = G[o ?? n ?? "normal"];
|
|
1664
1670
|
return /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", "data-pref": "live-mode", "data-tip": c, children: [
|
|
1665
1671
|
"Live updates",
|
|
1666
1672
|
/* @__PURE__ */ e(
|
|
1667
|
-
|
|
1673
|
+
R,
|
|
1668
1674
|
{
|
|
1669
1675
|
value: o ?? "auto",
|
|
1670
|
-
onChange: (i) =>
|
|
1676
|
+
onChange: (i) => m(i),
|
|
1671
1677
|
options: [
|
|
1672
1678
|
// Each choice says what it does (the Roles card uses the same words).
|
|
1673
1679
|
{
|
|
@@ -1683,8 +1689,8 @@ function Tt({
|
|
|
1683
1689
|
)
|
|
1684
1690
|
] });
|
|
1685
1691
|
}
|
|
1686
|
-
function
|
|
1687
|
-
const s = F(),
|
|
1692
|
+
function Lt() {
|
|
1693
|
+
const s = F(), m = M(), { data: r } = v({
|
|
1688
1694
|
queryKey: ["nvr-profile-prefs"],
|
|
1689
1695
|
queryFn: () => s.request(A("/users/me")).then((i) => {
|
|
1690
1696
|
var a;
|
|
@@ -1693,7 +1699,7 @@ function At() {
|
|
|
1693
1699
|
}), n = _({
|
|
1694
1700
|
mutationFn: (i) => s.request(J("/users/me/preferences", i)),
|
|
1695
1701
|
onSuccess: (i, a) => {
|
|
1696
|
-
|
|
1702
|
+
m.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }), ne(Object.keys(a)), import("sonner").then(
|
|
1697
1703
|
({ toast: h }) => h.success("Saved — applied on all your open tabs and devices")
|
|
1698
1704
|
);
|
|
1699
1705
|
}
|
|
@@ -1724,7 +1730,7 @@ function At() {
|
|
|
1724
1730
|
/* @__PURE__ */ t("label", { className: "flex items-center gap-1.5", children: [
|
|
1725
1731
|
"Timestamps",
|
|
1726
1732
|
/* @__PURE__ */ e(
|
|
1727
|
-
|
|
1733
|
+
R,
|
|
1728
1734
|
{
|
|
1729
1735
|
value: String((r == null ? void 0 : r.time_display) ?? "relative"),
|
|
1730
1736
|
onChange: (i) => n.mutate({ time_display: i }),
|
|
@@ -1764,7 +1770,7 @@ function At() {
|
|
|
1764
1770
|
/* @__PURE__ */ t("label", { className: "flex items-center gap-1.5", children: [
|
|
1765
1771
|
"Week starts",
|
|
1766
1772
|
/* @__PURE__ */ e(
|
|
1767
|
-
|
|
1773
|
+
R,
|
|
1768
1774
|
{
|
|
1769
1775
|
value: String((r == null ? void 0 : r.week_start) ?? "sun"),
|
|
1770
1776
|
onChange: (i) => n.mutate({ week_start: i }),
|
|
@@ -1813,7 +1819,7 @@ function At() {
|
|
|
1813
1819
|
"Count in the browser tab"
|
|
1814
1820
|
] }),
|
|
1815
1821
|
/* @__PURE__ */ e(
|
|
1816
|
-
|
|
1822
|
+
Ft,
|
|
1817
1823
|
{
|
|
1818
1824
|
value: r == null ? void 0 : r.live_mode,
|
|
1819
1825
|
onChange: (i) => n.mutate({ live_mode: i === "auto" ? null : i })
|
|
@@ -1822,7 +1828,7 @@ function At() {
|
|
|
1822
1828
|
/* @__PURE__ */ t("label", { className: "flex items-center gap-1.5", children: [
|
|
1823
1829
|
"Live changes (screen readers)",
|
|
1824
1830
|
/* @__PURE__ */ e(
|
|
1825
|
-
|
|
1831
|
+
R,
|
|
1826
1832
|
{
|
|
1827
1833
|
value: String((r == null ? void 0 : r.live_announce) ?? "full"),
|
|
1828
1834
|
onChange: (i) => n.mutate({ live_announce: i }),
|
|
@@ -1837,7 +1843,7 @@ function At() {
|
|
|
1837
1843
|
/* @__PURE__ */ t("label", { className: "flex items-center gap-1.5", children: [
|
|
1838
1844
|
"Text size",
|
|
1839
1845
|
/* @__PURE__ */ e(
|
|
1840
|
-
|
|
1846
|
+
R,
|
|
1841
1847
|
{
|
|
1842
1848
|
value: String((r == null ? void 0 : r.font_size) ?? "default"),
|
|
1843
1849
|
onChange: (i) => n.mutate({ font_size: i }),
|
|
@@ -1854,9 +1860,9 @@ function At() {
|
|
|
1854
1860
|
}
|
|
1855
1861
|
);
|
|
1856
1862
|
}
|
|
1857
|
-
function
|
|
1863
|
+
function Ot({
|
|
1858
1864
|
on: s,
|
|
1859
|
-
onChange:
|
|
1865
|
+
onChange: m
|
|
1860
1866
|
}) {
|
|
1861
1867
|
const r = Ie();
|
|
1862
1868
|
return /* @__PURE__ */ t(
|
|
@@ -1865,7 +1871,7 @@ function Ft({
|
|
|
1865
1871
|
"data-urgent-sound": !0,
|
|
1866
1872
|
className: "flex items-start gap-2 text-[12.5px] text-slate-600 dark:text-muted-foreground",
|
|
1867
1873
|
children: [
|
|
1868
|
-
/* @__PURE__ */ e("span", { className: "pt-px", children: /* @__PURE__ */ e(fe, { on: s, onChange: () =>
|
|
1874
|
+
/* @__PURE__ */ e("span", { className: "pt-px", children: /* @__PURE__ */ e(fe, { on: s, onChange: () => m(!s), label: "Play a sound for urgent items" }) }),
|
|
1869
1875
|
/* @__PURE__ */ t("div", { className: "min-w-0", children: [
|
|
1870
1876
|
/* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-x-2", children: [
|
|
1871
1877
|
/* @__PURE__ */ e("span", { children: "Play a sound for urgent items" }),
|
|
@@ -1895,11 +1901,11 @@ function Ft({
|
|
|
1895
1901
|
}
|
|
1896
1902
|
export {
|
|
1897
1903
|
tt as DelegationCard,
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1904
|
+
Lt as DisplayPrefsCard,
|
|
1905
|
+
ft as LinkAppCard,
|
|
1906
|
+
gt as NotificationRulesCard,
|
|
1907
|
+
xt as ProfileFieldsCard,
|
|
1908
|
+
ha as ProfileView,
|
|
1909
|
+
yt as TimezoneCard,
|
|
1910
|
+
Ot as UrgentSoundRow
|
|
1905
1911
|
};
|