@nivaro/react 0.3.64 → 0.3.66
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 +62 -8
- package/dist/shared/components/CollectionBrowserView.js +3127 -3204
- package/dist/shared/components/ConformanceView.js +235 -221
- package/dist/shared/components/DataTable.js +478 -459
- package/dist/shared/components/ItemEditForm.js +4842 -4500
- package/dist/shared/components/MyWorkView.js +124 -113
- package/dist/shared/components/PageRenderer.js +146 -138
- package/dist/shared/components/ProfileView.js +483 -472
- package/dist/shared/components/RecordDrilldownSheet.js +73 -65
- package/dist/shared/components/ReportView.js +1100 -1094
- package/dist/shared/components/bulk/BulkActionButtons.js +72 -72
- package/dist/shared/components/bulk/BulkCompareButton.js +62 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +114 -103
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +73 -0
- package/dist/shared/components/bulk/MessageStakeholders.js +235 -0
- package/dist/shared/components/bulk/bulk-field-options.js +29 -23
- package/dist/shared/components/integrations/IntegrationObligationsView.js +191 -173
- package/dist/shared/components/integrations/IntegrationStatusLines.js +101 -85
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +11 -9
- package/dist/shared/components/integrations/SendCurrentData.js +126 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +1535 -1440
- package/dist/shared/components/item-edit/FieldRenderer.js +49 -45
- package/dist/shared/components/item-edit/FieldRow.js +413 -403
- package/dist/shared/components/item-edit/GroupSection.js +555 -538
- package/dist/shared/components/item-edit/InlineTableField.js +2903 -2816
- package/dist/shared/components/item-edit/M2MCombobox.js +407 -338
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +367 -116
- package/dist/shared/components/item-edit/NestedRelationEditor.js +171 -163
- package/dist/shared/components/item-edit/PlanGrid.js +783 -724
- package/dist/shared/components/item-edit/QuickCreateButton.js +291 -224
- package/dist/shared/components/item-edit/RecordInsights.js +113 -111
- package/dist/shared/components/item-edit/RecordLiveSync.js +4 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +398 -364
- package/dist/shared/components/item-edit/SummaryPanel.js +146 -144
- package/dist/shared/components/item-edit/UserChip.js +264 -229
- package/dist/shared/components/item-edit/cascade-clear-notice.js +56 -0
- package/dist/shared/components/item-edit/collision-format.js +37 -0
- package/dist/shared/components/item-edit/field-a11y.js +25 -0
- package/dist/shared/components/item-edit/header-path-preview.js +52 -0
- package/dist/shared/components/item-edit/line-merge.js +84 -0
- package/dist/shared/components/item-edit/line-midair.js +94 -87
- package/dist/shared/components/item-edit/move-guard.js +17 -0
- package/dist/shared/components/item-edit/picker-search.js +27 -16
- package/dist/shared/components/item-edit/rail-width.js +8 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +126 -124
- package/dist/shared/components/panels/AccessDeniedPanel.js +96 -55
- package/dist/shared/components/panels/CommentPanel.js +142 -136
- package/dist/shared/components/panels/ItemLockBanner.js +246 -240
- package/dist/shared/components/panels/PipelinePanel.js +1366 -1194
- package/dist/shared/components/panels/RevisionsPanel.js +106 -102
- package/dist/shared/components/panels/SlaBreachBanner.js +16 -20
- package/dist/shared/components/panels/SlaClock.js +90 -68
- package/dist/shared/components/queue/QueueItemSheet.js +94 -87
- package/dist/shared/components/queue/QueueWorklist.js +1522 -1347
- package/dist/shared/components/queue/worklist-csv.js +75 -0
- package/dist/shared/components/queue/worklist-helpers.js +20 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +226 -207
- package/dist/shared/lib/bulk-copy.js +17 -0
- package/dist/shared/lib/cbv-export.js +122 -0
- package/dist/shared/lib/delete-offer.js +13 -0
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/leave-guard.js +41 -26
- package/dist/shared/lib/list-link.js +72 -56
- package/dist/shared/lib/live-queries.js +32 -30
- package/dist/shared/lib/moved-notice.js +25 -0
- package/dist/shared/lib/notification-target.js +56 -54
- package/dist/shared/lib/obligation-banner.js +11 -8
- package/dist/shared/lib/obligation-reason-text.js +6 -6
- package/dist/shared/lib/quick-filter-cascade.js +29 -19
- package/dist/shared/lib/sort-cycle.js +6 -0
- package/dist/shared/lib/summary-mode.js +59 -41
- package/package.json +1 -1
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
import { jsxs as t, jsx as e, Fragment as X } from "react/jsx-runtime";
|
|
2
2
|
import { readUser as be, readUserCard as xe, updateUser as de, readMyScopes as ge, saveMyScopeDefaults as fe, readItems as te } from "@nivaro/sdk";
|
|
3
|
-
import { useQueryClient as M, useQuery as
|
|
3
|
+
import { useQueryClient as M, useQuery as k, useMutation as S } from "@tanstack/react-query";
|
|
4
4
|
import { Loader2 as ce, Camera as ye, Building2 as ve, Mail as ke, Phone as Ne, Clock as we, Undo2 as Se, Check as _e, UserRound as Ce, Filter as qe, LogOut as Pe, ShieldCheck as Ae } from "lucide-react";
|
|
5
|
-
import { useRef as he, useEffect as Te, useState as
|
|
5
|
+
import { useRef as he, useEffect as Te, useState as q, useMemo as Fe } from "react";
|
|
6
6
|
import { useNivaroClient as F, useItemEditAuth as ne } from "../context.js";
|
|
7
|
-
import { get as T, patch as
|
|
7
|
+
import { get as T, patch as J, post as ee, put as Oe, del as De } from "../lib/commands.js";
|
|
8
8
|
import { playNotificationSound as me } from "../lib/notification-sound.js";
|
|
9
|
-
import {
|
|
9
|
+
import { restrictedScopeSelections as Me, cascadeFilter as Ke, fetchCascadeRelations as Le } from "../lib/quick-filter-cascade.js";
|
|
10
|
+
import { BRAND_ACCENT as ae, parseThemeAccents as Re, DEFAULT_THEME_ACCENTS as ue } from "../lib/theme-accents.js";
|
|
10
11
|
import { announceLocalPrefs as re } from "../lib/user-sync.js";
|
|
11
|
-
import { cn as
|
|
12
|
-
import { CustomStatusEditor as
|
|
13
|
-
import { mergeNotifyRulesClient as
|
|
14
|
-
import { TestMyRules as
|
|
15
|
-
import { AgentsPanel as
|
|
16
|
-
import { AiMemoryCard as
|
|
17
|
-
import { BrowserPushCard as
|
|
18
|
-
import { DelegationCard as
|
|
19
|
-
import { MailSuppressedPill as
|
|
20
|
-
import { PersonDidPanel as
|
|
21
|
-
import { TeamLoadCard as
|
|
22
|
-
import { TeamsConnect as
|
|
23
|
-
import { NotificationSourcesCard as
|
|
24
|
-
import { MyDefaultsCard as
|
|
25
|
-
import { UserScopesCard as
|
|
26
|
-
import { PersonProfile as
|
|
27
|
-
import { Toggle as
|
|
28
|
-
import { SignedInDevices as
|
|
29
|
-
import { SimpleSelectXs as
|
|
30
|
-
const
|
|
12
|
+
import { cn as $, setDisplayTimezone as Ie } from "../lib/utils.js";
|
|
13
|
+
import { CustomStatusEditor as je, activeCustomStatus as Ee } from "./CustomStatusEditor.js";
|
|
14
|
+
import { mergeNotifyRulesClient as Qe, NOTIFY_RULE_CATS as Ue, NotificationRulesEditor as $e } from "./notifications/NotificationRulesEditor.js";
|
|
15
|
+
import { TestMyRules as ze } from "./notifications/TestMyRules.js";
|
|
16
|
+
import { AgentsPanel as Be } from "./profile/AgentsPanel.js";
|
|
17
|
+
import { AiMemoryCard as He, AiHistoryCard as Ye } from "./profile/AiMemoryCard.js";
|
|
18
|
+
import { BrowserPushCard as We } from "./profile/BrowserPushCard.js";
|
|
19
|
+
import { DelegationCard as Ge } from "./profile/DelegationCard.js";
|
|
20
|
+
import { MailSuppressedPill as Je } from "./profile/MailSuppressedPill.js";
|
|
21
|
+
import { PersonDidPanel as Ve } from "./profile/PersonDidPanel.js";
|
|
22
|
+
import { TeamLoadCard as Ze } from "./profile/PersonExtras.js";
|
|
23
|
+
import { TeamsConnect as Xe } from "./profile/TeamsConnect.js";
|
|
24
|
+
import { NotificationSourcesCard as et } from "./NotificationSourcesCard.js";
|
|
25
|
+
import { MyDefaultsCard as tt } from "./profile/MyDefaultsCard.js";
|
|
26
|
+
import { UserScopesCard as at } from "./profile/PersonAccess.js";
|
|
27
|
+
import { PersonProfile as rt } from "./profile/PersonProfile.js";
|
|
28
|
+
import { Toggle as nt, SectionCard as se, Field as W, ConfirmButton as pe } from "./profile/primitives.js";
|
|
29
|
+
import { SignedInDevices as st } from "./profile/SignedInDevices.js";
|
|
30
|
+
import { SimpleSelectXs as z } from "./ui/SimpleSelect.js";
|
|
31
|
+
const lt = (o) => [o.first_name, o.last_name].filter(Boolean).join(" ") || (o.email ?? "Unknown"), ot = (o) => {
|
|
31
32
|
var p, n;
|
|
32
33
|
return (`${((p = o.first_name) == null ? void 0 : p[0]) ?? ""}${((n = o.last_name) == null ? void 0 : n[0]) ?? ""}` || (o.email ?? "?").slice(0, 2)).toUpperCase();
|
|
33
|
-
},
|
|
34
|
-
function
|
|
35
|
-
const o = F(), p = M(), { data: n = [] } =
|
|
34
|
+
}, it = Ue;
|
|
35
|
+
function dt() {
|
|
36
|
+
const o = F(), p = M(), { data: n = [] } = k({
|
|
36
37
|
queryKey: ["nvr-profile-fields"],
|
|
37
38
|
queryFn: () => o.request(T("/profile-fields/mine")).then((a) => a.data ?? []).catch(() => [])
|
|
38
|
-
}), [r,
|
|
39
|
+
}), [r, l] = q(null), i = S({
|
|
39
40
|
mutationFn: (a) => o.request(Oe("/profile-fields/mine", { values: a })),
|
|
40
41
|
onSuccess: () => {
|
|
41
|
-
|
|
42
|
+
l(null), p.invalidateQueries({ queryKey: ["nvr-profile-fields"] });
|
|
42
43
|
}
|
|
43
44
|
});
|
|
44
45
|
if (n.length === 0) return null;
|
|
45
|
-
const c = r ?? Object.fromEntries(n.map((a) => [a.key, a.value ?? ""])),
|
|
46
|
+
const c = r ?? Object.fromEntries(n.map((a) => [a.key, a.value ?? ""])), d = (a) => Array.isArray(a) ? a.map(String) : Array.isArray(a == null ? void 0 : a.choices) ? a.choices.map(
|
|
46
47
|
(h) => typeof h == "object" && h != null ? String(h.value ?? "") : String(h)
|
|
47
48
|
) : [];
|
|
48
49
|
return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
@@ -56,31 +57,31 @@ function lt() {
|
|
|
56
57
|
a.required && /* @__PURE__ */ e("span", { className: "ml-0.5 text-red-500", children: "*" })
|
|
57
58
|
] }),
|
|
58
59
|
a.type === "boolean" ? /* @__PURE__ */ e(
|
|
59
|
-
|
|
60
|
+
z,
|
|
60
61
|
{
|
|
61
62
|
value: c[a.key] || "false",
|
|
62
63
|
options: [
|
|
63
64
|
{ value: "true", label: "Yes" },
|
|
64
65
|
{ value: "false", label: "No" }
|
|
65
66
|
],
|
|
66
|
-
onChange: (h) =>
|
|
67
|
+
onChange: (h) => l({ ...c, [a.key]: h })
|
|
67
68
|
}
|
|
68
69
|
) : a.type === "select" ? /* @__PURE__ */ e(
|
|
69
|
-
|
|
70
|
+
z,
|
|
70
71
|
{
|
|
71
72
|
value: c[a.key] || "",
|
|
72
73
|
options: [
|
|
73
74
|
{ value: "", label: "—" },
|
|
74
|
-
...
|
|
75
|
+
...d(a.options).map((h) => ({ value: h, label: h }))
|
|
75
76
|
],
|
|
76
|
-
onChange: (h) =>
|
|
77
|
+
onChange: (h) => l({ ...c, [a.key]: h })
|
|
77
78
|
}
|
|
78
79
|
) : /* @__PURE__ */ e(
|
|
79
80
|
"input",
|
|
80
81
|
{
|
|
81
82
|
type: a.type === "number" ? "number" : a.type === "date" ? "date" : "text",
|
|
82
83
|
value: c[a.key] ?? "",
|
|
83
|
-
onChange: (h) =>
|
|
84
|
+
onChange: (h) => l({ ...c, [a.key]: h.target.value }),
|
|
84
85
|
className: "h-8 w-full rounded-md border border-slate-200 bg-background px-2 text-[12.5px] dark:border-border"
|
|
85
86
|
}
|
|
86
87
|
)
|
|
@@ -90,7 +91,7 @@ function lt() {
|
|
|
90
91
|
"button",
|
|
91
92
|
{
|
|
92
93
|
type: "button",
|
|
93
|
-
onClick: () =>
|
|
94
|
+
onClick: () => l(null),
|
|
94
95
|
className: "h-7 rounded-md px-2.5 text-[12px] text-slate-500",
|
|
95
96
|
children: "Cancel"
|
|
96
97
|
}
|
|
@@ -108,92 +109,92 @@ function lt() {
|
|
|
108
109
|
] })
|
|
109
110
|
] });
|
|
110
111
|
}
|
|
111
|
-
function
|
|
112
|
-
var
|
|
113
|
-
const o = F(), p = ne(), n = M(), { data: r } =
|
|
112
|
+
function ct() {
|
|
113
|
+
var G, le, oe;
|
|
114
|
+
const o = F(), p = ne(), n = M(), { data: r } = k({
|
|
114
115
|
queryKey: ["nvr-profile-prefs"],
|
|
115
|
-
queryFn: () => o.request(T("/users/me")).then((
|
|
116
|
-
var
|
|
117
|
-
return ((
|
|
116
|
+
queryFn: () => o.request(T("/users/me")).then((s) => {
|
|
117
|
+
var b;
|
|
118
|
+
return ((b = s.data) == null ? void 0 : b.preferences) ?? {};
|
|
118
119
|
})
|
|
119
|
-
}), { data:
|
|
120
|
+
}), { data: l } = k({
|
|
120
121
|
queryKey: ["nvr-profile-teams"],
|
|
121
|
-
queryFn: () => o.request(T("/users/me")).then((
|
|
122
|
-
var
|
|
122
|
+
queryFn: () => o.request(T("/users/me")).then((s) => {
|
|
123
|
+
var b, w;
|
|
123
124
|
return {
|
|
124
|
-
available: ((
|
|
125
|
-
link: ((
|
|
125
|
+
available: ((b = s.data) == null ? void 0 : b.teams_available) === !0,
|
|
126
|
+
link: ((w = s.data) == null ? void 0 : w.teams_link) ?? null
|
|
126
127
|
};
|
|
127
128
|
})
|
|
128
|
-
}), i = (
|
|
129
|
+
}), i = (l == null ? void 0 : l.available) === !0, c = ((G = l == null ? void 0 : l.link) == null ? void 0 : G.status) === "active", d = he(null), a = r != null;
|
|
129
130
|
Te(() => {
|
|
130
|
-
var
|
|
131
|
-
!a || typeof window > "u" || window.location.hash === "#notification-rules" && ((
|
|
131
|
+
var s;
|
|
132
|
+
!a || typeof window > "u" || window.location.hash === "#notification-rules" && ((s = d.current) == null || s.scrollIntoView({ block: "start", behavior: "smooth" }));
|
|
132
133
|
}, [a]);
|
|
133
|
-
const h = (r == null ? void 0 : r.notification_prefs) ?? {}, { data: m } =
|
|
134
|
+
const h = (r == null ? void 0 : r.notification_prefs) ?? {}, { data: m } = k({
|
|
134
135
|
queryKey: ["nvr-my-rule-defaults"],
|
|
135
|
-
queryFn: () => o.request(T("/notifications/my-rule-defaults")).then((
|
|
136
|
+
queryFn: () => o.request(T("/notifications/my-rule-defaults")).then((s) => s.data).catch(() => null),
|
|
136
137
|
staleTime: 6e4
|
|
137
|
-
}),
|
|
138
|
-
var
|
|
139
|
-
return ((
|
|
140
|
-
}, y =
|
|
141
|
-
mutationFn: (
|
|
138
|
+
}), P = (r == null ? void 0 : r.email_digest) === "daily" ? "daily" : "instant", C = Qe(h, m != null && m.role ? m.rules : null), K = (s) => {
|
|
139
|
+
var b, w, Y, ie;
|
|
140
|
+
return ((w = (b = h.matrix) == null ? void 0 : b[s]) == null ? void 0 : w.email) ?? (P === "daily" ? "daily" : ((ie = (Y = C.matrix) == null ? void 0 : Y[s]) == null ? void 0 : ie.email) ?? P);
|
|
141
|
+
}, y = S({
|
|
142
|
+
mutationFn: (s) => o.request(J("/users/me/preferences", { notification_prefs: s })),
|
|
142
143
|
onSuccess: () => {
|
|
143
144
|
n.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }), re(["notification_prefs"]);
|
|
144
145
|
}
|
|
145
|
-
}),
|
|
146
|
-
mutationFn: (
|
|
147
|
-
onSuccess: (
|
|
148
|
-
n.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }), re(Object.keys(
|
|
146
|
+
}), _ = S({
|
|
147
|
+
mutationFn: (s) => o.request(J("/users/me/preferences", s)),
|
|
148
|
+
onSuccess: (s, b) => {
|
|
149
|
+
n.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }), re(Object.keys(b));
|
|
149
150
|
}
|
|
150
|
-
}), [
|
|
151
|
-
mutationFn: (
|
|
152
|
-
onSuccess: (
|
|
153
|
-
total:
|
|
154
|
-
current:
|
|
155
|
-
proposed:
|
|
151
|
+
}), [v, O] = q(null), f = S({
|
|
152
|
+
mutationFn: (s) => o.request(ee("/notifications/rules-preview", { notification_prefs: s })),
|
|
153
|
+
onSuccess: (s) => O({
|
|
154
|
+
total: s.data.total_notifications,
|
|
155
|
+
current: s.data.current,
|
|
156
|
+
proposed: s.data.proposed
|
|
156
157
|
})
|
|
157
|
-
}),
|
|
158
|
-
const
|
|
159
|
-
...
|
|
158
|
+
}), I = (s) => {
|
|
159
|
+
const b = {
|
|
160
|
+
...s,
|
|
160
161
|
// Kept as-is: "mute 1h" said to the bot lives here, and a save must not wipe it.
|
|
161
162
|
...h.teams_muted_until ? { teams_muted_until: h.teams_muted_until } : {}
|
|
162
163
|
};
|
|
163
|
-
|
|
164
|
-
},
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
}, { data:
|
|
164
|
+
f.mutate(b), y.mutate(b);
|
|
165
|
+
}, U = (s) => I({ ...h, ...s }), x = (r == null ? void 0 : r.notification_sounds) ?? {}, L = (s, b) => {
|
|
166
|
+
const w = { ...x };
|
|
167
|
+
b === "default" ? delete w[s] : w[s] = b, b !== "default" && me(b, { preview: !0 }), _.mutate({ notification_sounds: Object.keys(w).length ? w : null });
|
|
168
|
+
}, { data: H } = k({
|
|
168
169
|
queryKey: ["nvr-noise-suggestions"],
|
|
169
|
-
queryFn: () => o.request(T("/notifications/noise-suggestions")).then((
|
|
170
|
+
queryFn: () => o.request(T("/notifications/noise-suggestions")).then((s) => s.data ?? []),
|
|
170
171
|
staleTime: 6e5
|
|
171
|
-
}), [
|
|
172
|
+
}), [j, g] = q({}), [E, Q] = q(() => {
|
|
172
173
|
try {
|
|
173
|
-
const
|
|
174
|
-
return
|
|
174
|
+
const s = JSON.parse(localStorage.getItem("nvr-noise-dismissed") ?? "null");
|
|
175
|
+
return s && Date.now() - s.at < 30 * 864e5 ? s.cats : [];
|
|
175
176
|
} catch {
|
|
176
177
|
return [];
|
|
177
178
|
}
|
|
178
|
-
}),
|
|
179
|
-
const
|
|
180
|
-
|
|
179
|
+
}), B = (s) => {
|
|
180
|
+
const b = [...E, s];
|
|
181
|
+
Q(b);
|
|
181
182
|
try {
|
|
182
|
-
localStorage.setItem("nvr-noise-dismissed", JSON.stringify({ at: Date.now(), cats:
|
|
183
|
+
localStorage.setItem("nvr-noise-dismissed", JSON.stringify({ at: Date.now(), cats: b }));
|
|
183
184
|
} catch {
|
|
184
185
|
}
|
|
185
|
-
},
|
|
186
|
+
}, u = Number.isInteger(Number(r == null ? void 0 : r.digest_hour)) ? Number(r == null ? void 0 : r.digest_hour) : 7, N = (s) => `${s % 12 === 0 ? 12 : s % 12}:45 ${s < 12 ? "AM" : "PM"}`, [A, R] = q(null), D = S({
|
|
186
187
|
mutationFn: () => o.request(ee("/users/me/digest-test", {})),
|
|
187
|
-
onSuccess: (
|
|
188
|
-
onError: () =>
|
|
189
|
-
}), V =
|
|
188
|
+
onSuccess: (s) => R(s.data.note),
|
|
189
|
+
onError: () => R("Test send failed — try again.")
|
|
190
|
+
}), V = it.some((s) => K(s.key) === "daily"), Z = ({ text: s }) => /* @__PURE__ */ e(
|
|
190
191
|
"span",
|
|
191
192
|
{
|
|
192
193
|
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",
|
|
193
194
|
role: "img",
|
|
194
|
-
title:
|
|
195
|
-
"data-tip":
|
|
196
|
-
"aria-label":
|
|
195
|
+
title: s,
|
|
196
|
+
"data-tip": s,
|
|
197
|
+
"aria-label": s,
|
|
197
198
|
children: "?"
|
|
198
199
|
}
|
|
199
200
|
);
|
|
@@ -201,7 +202,7 @@ function ot() {
|
|
|
201
202
|
"div",
|
|
202
203
|
{
|
|
203
204
|
id: "notification-rules",
|
|
204
|
-
ref:
|
|
205
|
+
ref: d,
|
|
205
206
|
"data-profile-card": "notifications",
|
|
206
207
|
className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
|
|
207
208
|
children: [
|
|
@@ -210,28 +211,28 @@ function ot() {
|
|
|
210
211
|
/* @__PURE__ */ e("p", { className: "mt-0.5 text-[11px] text-slate-400", children: "Per category: whether it lands in your in-app inbox, whether your browser pushes it, and how it reaches your email — each one as it happens, folded into the daily action summary, or not at all. Quiet hours pause pushes and hold emails until morning unless a category is let through them; critical alerts (SLA escalations, maintenance, monitor failures) always get through." })
|
|
211
212
|
] }),
|
|
212
213
|
/* @__PURE__ */ t("div", { className: "space-y-3 p-4", children: [
|
|
213
|
-
(
|
|
214
|
+
(H ?? []).filter((s) => !E.includes(s.category)).map((s) => /* @__PURE__ */ t(
|
|
214
215
|
"div",
|
|
215
216
|
{
|
|
216
|
-
"data-noise-suggestion":
|
|
217
|
+
"data-noise-suggestion": s.category,
|
|
217
218
|
className: "flex flex-wrap items-center gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-[12px] text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-200",
|
|
218
219
|
children: [
|
|
219
220
|
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1", children: [
|
|
220
|
-
|
|
221
|
+
s.message,
|
|
221
222
|
" Mute them?"
|
|
222
223
|
] }),
|
|
223
|
-
|
|
224
|
+
s.category in j ? /* @__PURE__ */ e(
|
|
224
225
|
"button",
|
|
225
226
|
{
|
|
226
227
|
type: "button",
|
|
227
228
|
className: "underline",
|
|
228
229
|
onClick: () => {
|
|
229
|
-
|
|
230
|
+
U({
|
|
230
231
|
matrix: {
|
|
231
232
|
...h.matrix ?? {},
|
|
232
|
-
[
|
|
233
|
+
[s.category]: j[s.category]
|
|
233
234
|
}
|
|
234
|
-
}),
|
|
235
|
+
}), g(({ [s.category]: b, ...w }) => w);
|
|
235
236
|
},
|
|
236
237
|
children: "Muted — undo"
|
|
237
238
|
}
|
|
@@ -242,25 +243,25 @@ function ot() {
|
|
|
242
243
|
type: "button",
|
|
243
244
|
className: "rounded border border-amber-300 px-2 py-0.5 font-medium dark:border-amber-800",
|
|
244
245
|
onClick: () => {
|
|
245
|
-
var
|
|
246
|
-
const
|
|
247
|
-
|
|
246
|
+
var w;
|
|
247
|
+
const b = ((w = h.matrix) == null ? void 0 : w[s.category]) ?? { inapp: !0, push: !0 };
|
|
248
|
+
g((Y) => ({ ...Y, [s.category]: b })), U({
|
|
248
249
|
matrix: {
|
|
249
250
|
...h.matrix ?? {},
|
|
250
|
-
[
|
|
251
|
+
[s.category]: { ...b, inapp: !1, push: !1 }
|
|
251
252
|
}
|
|
252
253
|
});
|
|
253
254
|
},
|
|
254
255
|
children: "Mute"
|
|
255
256
|
}
|
|
256
257
|
),
|
|
257
|
-
/* @__PURE__ */ e("button", { type: "button", className: "underline", onClick: () =>
|
|
258
|
+
/* @__PURE__ */ e("button", { type: "button", className: "underline", onClick: () => B(s.category), children: "Not now" })
|
|
258
259
|
] })
|
|
259
260
|
]
|
|
260
261
|
},
|
|
261
|
-
|
|
262
|
+
s.category
|
|
262
263
|
)),
|
|
263
|
-
|
|
264
|
+
v && v.total > 0 && /* @__PURE__ */ t(
|
|
264
265
|
"div",
|
|
265
266
|
{
|
|
266
267
|
"data-rules-preview": !0,
|
|
@@ -268,30 +269,30 @@ function ot() {
|
|
|
268
269
|
children: [
|
|
269
270
|
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1", children: [
|
|
270
271
|
"Last week with this change: ",
|
|
271
|
-
|
|
272
|
+
v.proposed.inapp,
|
|
272
273
|
" in-app instead of",
|
|
273
274
|
" ",
|
|
274
|
-
|
|
275
|
+
v.current.inapp,
|
|
275
276
|
", ",
|
|
276
|
-
|
|
277
|
+
v.proposed.email_sent,
|
|
277
278
|
" emails instead of",
|
|
278
279
|
" ",
|
|
279
|
-
|
|
280
|
+
v.current.email_sent,
|
|
280
281
|
", ",
|
|
281
|
-
|
|
282
|
+
v.proposed.push,
|
|
282
283
|
" pushes instead of",
|
|
283
284
|
" ",
|
|
284
|
-
|
|
285
|
+
v.current.push,
|
|
285
286
|
"."
|
|
286
287
|
] }),
|
|
287
|
-
/* @__PURE__ */ e("button", { type: "button", className: "underline", onClick: () =>
|
|
288
|
+
/* @__PURE__ */ e("button", { type: "button", className: "underline", onClick: () => O(null), children: "Dismiss" })
|
|
288
289
|
]
|
|
289
290
|
}
|
|
290
291
|
),
|
|
291
292
|
/* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-2 text-[12.5px] text-slate-600 dark:text-muted-foreground", children: [
|
|
292
293
|
"Sound:",
|
|
293
294
|
/* @__PURE__ */ e(
|
|
294
|
-
|
|
295
|
+
z,
|
|
295
296
|
{
|
|
296
297
|
value: String((r == null ? void 0 : r.notification_sound) ?? "off"),
|
|
297
298
|
options: [
|
|
@@ -299,20 +300,20 @@ function ot() {
|
|
|
299
300
|
{ value: "subtle", label: "Subtle blip" },
|
|
300
301
|
{ value: "chime", label: "Chime" }
|
|
301
302
|
],
|
|
302
|
-
onChange: (
|
|
303
|
-
me(
|
|
303
|
+
onChange: (s) => {
|
|
304
|
+
me(s, { preview: !0 }), _.mutate({ notification_sound: s });
|
|
304
305
|
}
|
|
305
306
|
}
|
|
306
307
|
),
|
|
307
308
|
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "plays when a notification or a direct message arrives" }),
|
|
308
|
-
/* @__PURE__ */ e("span", { className: "ml-auto", children: /* @__PURE__ */ e(
|
|
309
|
+
/* @__PURE__ */ e("span", { className: "ml-auto", children: /* @__PURE__ */ e(ze, {}) })
|
|
309
310
|
] }),
|
|
310
311
|
/* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-2 text-[12.5px] text-slate-600 dark:text-muted-foreground", children: [
|
|
311
312
|
/* @__PURE__ */ e(
|
|
312
|
-
|
|
313
|
+
nt,
|
|
313
314
|
{
|
|
314
315
|
on: (r == null ? void 0 : r.huddle_hold_notifications) !== !1,
|
|
315
|
-
onChange: () =>
|
|
316
|
+
onChange: () => _.mutate({
|
|
316
317
|
huddle_hold_notifications: (r == null ? void 0 : r.huddle_hold_notifications) === !1
|
|
317
318
|
}),
|
|
318
319
|
label: "Hold notifications during huddles"
|
|
@@ -322,39 +323,39 @@ function ot() {
|
|
|
322
323
|
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "toasts and sounds wait while you talk; you get one summary when you leave" })
|
|
323
324
|
] }),
|
|
324
325
|
/* @__PURE__ */ e(
|
|
325
|
-
|
|
326
|
+
$e,
|
|
326
327
|
{
|
|
327
328
|
subject: "person",
|
|
328
329
|
isAdmin: p.isAdmin,
|
|
329
330
|
value: h,
|
|
330
331
|
inherited: m != null && m.role ? m.rules : null,
|
|
331
332
|
inheritedName: ((le = m == null ? void 0 : m.role) == null ? void 0 : le.name) ?? null,
|
|
332
|
-
legacyEmail:
|
|
333
|
+
legacyEmail: P,
|
|
333
334
|
saving: y.isPending,
|
|
334
|
-
onCommit: (
|
|
335
|
-
onLegacyEmail: (
|
|
335
|
+
onCommit: (s) => I(s),
|
|
336
|
+
onLegacyEmail: (s) => _.mutate({ email_digest: s }),
|
|
336
337
|
teams: i ? {
|
|
337
338
|
available: !0,
|
|
338
339
|
linked: c,
|
|
339
|
-
header: /* @__PURE__ */ e("div", { className: "mt-0.5", children: /* @__PURE__ */ e(
|
|
340
|
+
header: /* @__PURE__ */ e("div", { className: "mt-0.5", children: /* @__PURE__ */ e(Xe, { linked: c, linkedAt: (oe = l == null ? void 0 : l.link) == null ? void 0 : oe.linked_at }) })
|
|
340
341
|
} : null,
|
|
341
342
|
extraColumn: {
|
|
342
343
|
header: /* @__PURE__ */ t(X, { children: [
|
|
343
344
|
"Sound",
|
|
344
345
|
/* @__PURE__ */ e(Z, { text: "A different sound for this category, or none. Default follows the Sound setting above." })
|
|
345
346
|
] }),
|
|
346
|
-
cell: (
|
|
347
|
-
|
|
347
|
+
cell: (s, b) => /* @__PURE__ */ e("div", { className: "inline-block", children: /* @__PURE__ */ e(
|
|
348
|
+
z,
|
|
348
349
|
{
|
|
349
|
-
ariaLabel: `Sound for ${
|
|
350
|
-
value:
|
|
350
|
+
ariaLabel: `Sound for ${b}`,
|
|
351
|
+
value: x[s] ?? "default",
|
|
351
352
|
options: [
|
|
352
353
|
{ value: "default", label: "Default" },
|
|
353
354
|
{ value: "off", label: "None" },
|
|
354
355
|
{ value: "subtle", label: "Subtle blip" },
|
|
355
356
|
{ value: "chime", label: "Chime" }
|
|
356
357
|
],
|
|
357
|
-
onChange: (
|
|
358
|
+
onChange: (w) => L(s, w)
|
|
358
359
|
}
|
|
359
360
|
) })
|
|
360
361
|
}
|
|
@@ -372,14 +373,14 @@ function ot() {
|
|
|
372
373
|
/* @__PURE__ */ t("span", { className: "flex items-center gap-1.5", children: [
|
|
373
374
|
"Deliver at",
|
|
374
375
|
/* @__PURE__ */ e(
|
|
375
|
-
|
|
376
|
+
z,
|
|
376
377
|
{
|
|
377
378
|
ariaLabel: "Digest delivery hour",
|
|
378
|
-
value: String(
|
|
379
|
-
onChange: (
|
|
380
|
-
options: Array.from({ length: 24 }, (
|
|
381
|
-
value: String(
|
|
382
|
-
label:
|
|
379
|
+
value: String(u),
|
|
380
|
+
onChange: (s) => _.mutate({ digest_hour: Number(s) }),
|
|
381
|
+
options: Array.from({ length: 24 }, (s, b) => ({
|
|
382
|
+
value: String(b),
|
|
383
|
+
label: N(b)
|
|
383
384
|
}))
|
|
384
385
|
}
|
|
385
386
|
),
|
|
@@ -391,7 +392,7 @@ function ot() {
|
|
|
391
392
|
{
|
|
392
393
|
type: "checkbox",
|
|
393
394
|
checked: (r == null ? void 0 : r.digest_layout) === "compact",
|
|
394
|
-
onChange: (
|
|
395
|
+
onChange: (s) => _.mutate({ digest_layout: s.target.checked ? "compact" : "detailed" }),
|
|
395
396
|
className: "rounded"
|
|
396
397
|
}
|
|
397
398
|
),
|
|
@@ -401,13 +402,13 @@ function ot() {
|
|
|
401
402
|
"button",
|
|
402
403
|
{
|
|
403
404
|
type: "button",
|
|
404
|
-
disabled:
|
|
405
|
-
onClick: () =>
|
|
405
|
+
disabled: D.isPending,
|
|
406
|
+
onClick: () => D.mutate(),
|
|
406
407
|
className: "text-[12px] text-slate-500 underline decoration-dotted underline-offset-2 hover:text-slate-700 disabled:opacity-50 dark:text-slate-400 dark:hover:text-slate-200",
|
|
407
|
-
children:
|
|
408
|
+
children: D.isPending ? "Building…" : "Send me a test summary now"
|
|
408
409
|
}
|
|
409
410
|
),
|
|
410
|
-
|
|
411
|
+
A && /* @__PURE__ */ e("span", { className: "text-[11.5px] text-slate-400", children: A })
|
|
411
412
|
] })
|
|
412
413
|
] }),
|
|
413
414
|
/* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-4 border-t border-slate-100 pt-3 text-[12.5px] text-slate-600 dark:border-border/60 dark:text-muted-foreground", children: [
|
|
@@ -416,25 +417,25 @@ function ot() {
|
|
|
416
417
|
["created", "create"],
|
|
417
418
|
["commented", "comment on"],
|
|
418
419
|
["transitioned", "move through a workflow"]
|
|
419
|
-
].map(([
|
|
420
|
-
var
|
|
420
|
+
].map(([s, b]) => {
|
|
421
|
+
var w;
|
|
421
422
|
return /* @__PURE__ */ t("label", { className: "flex cursor-pointer items-center gap-1.5", children: [
|
|
422
423
|
/* @__PURE__ */ e(
|
|
423
424
|
"input",
|
|
424
425
|
{
|
|
425
426
|
type: "checkbox",
|
|
426
|
-
checked: ((
|
|
427
|
-
onChange: (
|
|
427
|
+
checked: ((w = r == null ? void 0 : r.auto_watch) == null ? void 0 : w[s]) === !0,
|
|
428
|
+
onChange: (Y) => _.mutate({
|
|
428
429
|
auto_watch: {
|
|
429
430
|
...(r == null ? void 0 : r.auto_watch) ?? {},
|
|
430
|
-
[
|
|
431
|
+
[s]: Y.target.checked
|
|
431
432
|
}
|
|
432
433
|
}),
|
|
433
434
|
className: "rounded"
|
|
434
435
|
}
|
|
435
436
|
),
|
|
436
|
-
|
|
437
|
-
] },
|
|
437
|
+
b
|
|
438
|
+
] }, s);
|
|
438
439
|
})
|
|
439
440
|
] })
|
|
440
441
|
] })
|
|
@@ -442,15 +443,15 @@ function ot() {
|
|
|
442
443
|
}
|
|
443
444
|
);
|
|
444
445
|
}
|
|
445
|
-
function
|
|
446
|
-
const o = F(), p = M(), { data: n } =
|
|
446
|
+
function mt() {
|
|
447
|
+
const o = F(), p = M(), { data: n } = k({
|
|
447
448
|
queryKey: ["nvr-profile-prefs"],
|
|
448
449
|
queryFn: () => o.request(T("/users/me")).then((c) => {
|
|
449
|
-
var
|
|
450
|
-
return ((
|
|
450
|
+
var d;
|
|
451
|
+
return ((d = c.data) == null ? void 0 : d.preferences) ?? {};
|
|
451
452
|
})
|
|
452
|
-
}), r = (n == null ? void 0 : n.link_app) === "portal" || (n == null ? void 0 : n.link_app) === "admin" ? n.link_app : "auto",
|
|
453
|
-
mutationFn: (c) => o.request(
|
|
453
|
+
}), r = (n == null ? void 0 : n.link_app) === "portal" || (n == null ? void 0 : n.link_app) === "admin" ? n.link_app : "auto", l = S({
|
|
454
|
+
mutationFn: (c) => o.request(J("/users/me/preferences", { link_app: c })),
|
|
454
455
|
onSuccess: () => void p.invalidateQueries({ queryKey: ["nvr-profile-prefs"] })
|
|
455
456
|
});
|
|
456
457
|
return /* @__PURE__ */ t(
|
|
@@ -470,7 +471,7 @@ function it() {
|
|
|
470
471
|
{
|
|
471
472
|
type: "button",
|
|
472
473
|
title: c.hint,
|
|
473
|
-
onClick: () =>
|
|
474
|
+
onClick: () => l.mutate(c.v),
|
|
474
475
|
className: r === c.v ? "rounded bg-nvr-cyan px-3 py-1 text-[12.5px] font-medium text-white" : "rounded px-3 py-1 text-[12.5px] font-medium text-slate-600 hover:bg-slate-100 dark:text-muted-foreground dark:hover:bg-muted",
|
|
475
476
|
children: c.label
|
|
476
477
|
},
|
|
@@ -480,8 +481,8 @@ function it() {
|
|
|
480
481
|
}
|
|
481
482
|
);
|
|
482
483
|
}
|
|
483
|
-
function
|
|
484
|
-
const o = F(), p = M(), [n, r] =
|
|
484
|
+
function ut() {
|
|
485
|
+
const o = F(), p = M(), [n, r] = q(""), l = (() => {
|
|
485
486
|
try {
|
|
486
487
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
487
488
|
} catch {
|
|
@@ -497,16 +498,16 @@ function dt() {
|
|
|
497
498
|
} catch {
|
|
498
499
|
return [];
|
|
499
500
|
}
|
|
500
|
-
})(), { data: c } =
|
|
501
|
+
})(), { data: c } = k({
|
|
501
502
|
queryKey: ["nvr-profile-prefs"],
|
|
502
503
|
queryFn: () => o.request(T("/users/me")).then((m) => {
|
|
503
|
-
var
|
|
504
|
-
return ((
|
|
504
|
+
var P;
|
|
505
|
+
return ((P = m.data) == null ? void 0 : P.preferences) ?? {};
|
|
505
506
|
})
|
|
506
|
-
}),
|
|
507
|
-
mutationFn: (m) => o.request(
|
|
508
|
-
onSuccess: (m,
|
|
509
|
-
|
|
507
|
+
}), d = typeof (c == null ? void 0 : c.timezone) == "string" ? c.timezone : null, a = S({
|
|
508
|
+
mutationFn: (m) => o.request(J("/users/me/preferences", { timezone: m })),
|
|
509
|
+
onSuccess: (m, P) => {
|
|
510
|
+
Ie(P), r(""), p.invalidateQueries({ queryKey: ["nvr-profile-prefs"] });
|
|
510
511
|
}
|
|
511
512
|
}), h = n.length > 1 ? i.filter((m) => m.toLowerCase().includes(n.toLowerCase())).slice(0, 8) : [];
|
|
512
513
|
return /* @__PURE__ */ t(
|
|
@@ -519,12 +520,12 @@ function dt() {
|
|
|
519
520
|
/* @__PURE__ */ t("p", { className: "mt-0.5 text-[12px] text-slate-500 dark:text-muted-foreground", children: [
|
|
520
521
|
"Dates and times render in this zone. Your browser reports",
|
|
521
522
|
" ",
|
|
522
|
-
/* @__PURE__ */ e("span", { className: "font-medium", children:
|
|
523
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: l }),
|
|
523
524
|
"."
|
|
524
525
|
] }),
|
|
525
526
|
/* @__PURE__ */ t("div", { className: "mt-3 flex flex-wrap items-center gap-2", children: [
|
|
526
|
-
/* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-nvr-cyan/10 px-2.5 py-1 text-[12px] font-medium text-nvr-navy dark:text-nvr-cyan", children:
|
|
527
|
-
|
|
527
|
+
/* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-nvr-cyan/10 px-2.5 py-1 text-[12px] font-medium text-nvr-navy dark:text-nvr-cyan", children: d ?? `${l} (browser default)` }),
|
|
528
|
+
d && /* @__PURE__ */ e(
|
|
528
529
|
"button",
|
|
529
530
|
{
|
|
530
531
|
type: "button",
|
|
@@ -559,12 +560,12 @@ function dt() {
|
|
|
559
560
|
}
|
|
560
561
|
);
|
|
561
562
|
}
|
|
562
|
-
function
|
|
563
|
-
const o = F(), p = M(), { data: n } =
|
|
563
|
+
function pt() {
|
|
564
|
+
const o = F(), p = M(), { data: n } = k({
|
|
564
565
|
queryKey: ["nvr-profile-scopes"],
|
|
565
|
-
queryFn: () => o.request(ge()).then((
|
|
566
|
-
}), r =
|
|
567
|
-
mutationFn: ({ dimension:
|
|
566
|
+
queryFn: () => o.request(ge()).then((l) => l.data)
|
|
567
|
+
}), r = S({
|
|
568
|
+
mutationFn: ({ dimension: l, values: i }) => o.request(fe(l, i)),
|
|
568
569
|
onSuccess: () => void p.invalidateQueries({ queryKey: ["nvr-profile-scopes"] })
|
|
569
570
|
});
|
|
570
571
|
return !n || n.dimensions.length === 0 ? null : /* @__PURE__ */ e(
|
|
@@ -574,76 +575,86 @@ function ct() {
|
|
|
574
575
|
icon: /* @__PURE__ */ e(qe, { className: "h-4 w-4" }),
|
|
575
576
|
title: "Default filters",
|
|
576
577
|
hint: "Pre-selected in browsers and reports — clear anytime",
|
|
577
|
-
children: /* @__PURE__ */ e("div", { className: "space-y-3", children: n.dimensions.map((
|
|
578
|
-
|
|
578
|
+
children: /* @__PURE__ */ e("div", { className: "space-y-3", children: n.dimensions.map((l) => /* @__PURE__ */ e(
|
|
579
|
+
ht,
|
|
579
580
|
{
|
|
580
|
-
dimension:
|
|
581
|
-
selected: n.defaults[
|
|
582
|
-
restricted: n.restricted[
|
|
583
|
-
|
|
581
|
+
dimension: l,
|
|
582
|
+
selected: n.defaults[l.name] ?? [],
|
|
583
|
+
restricted: n.restricted[l.name],
|
|
584
|
+
scopes: n,
|
|
585
|
+
onSave: (i) => r.mutate({ dimension: l.name, values: i })
|
|
584
586
|
},
|
|
585
|
-
|
|
587
|
+
l.name
|
|
586
588
|
)) })
|
|
587
589
|
}
|
|
588
590
|
);
|
|
589
591
|
}
|
|
590
|
-
function
|
|
592
|
+
function ht({
|
|
591
593
|
dimension: o,
|
|
592
594
|
selected: p,
|
|
593
595
|
restricted: n,
|
|
594
|
-
|
|
596
|
+
scopes: r,
|
|
597
|
+
onSave: l
|
|
595
598
|
}) {
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
limit: 200
|
|
603
|
-
})
|
|
604
|
-
)).data ?? []).map((f) => ({
|
|
605
|
-
id: f.id,
|
|
606
|
-
label: String(f[i] ?? f.id)
|
|
607
|
-
}))
|
|
608
|
-
}), S = n != null && n.length ? new Set(n.map(String)) : null, k = S ? m.filter((d) => S.has(String(d.id))) : m, O = new Set(p.map(String)), y = k.length > 24 || m.length >= 200 && !S, { data: q = [], isFetching: _ } = v({
|
|
609
|
-
queryKey: ["nvr-scope-search", o.name, c],
|
|
599
|
+
const i = F(), c = M(), d = o.display_field ?? "name", [a, h] = q(""), [m, P] = q(!1), C = Me(o.target_collection, r), K = async () => C.length ? Ke(
|
|
600
|
+
o.target_collection,
|
|
601
|
+
await Le(i, c, o.target_collection),
|
|
602
|
+
C
|
|
603
|
+
) : null, { data: y = [] } = k({
|
|
604
|
+
queryKey: ["nvr-scope-options", o.name, C],
|
|
610
605
|
queryFn: async () => {
|
|
611
|
-
const
|
|
606
|
+
const u = await K();
|
|
607
|
+
return ((await i.request(
|
|
612
608
|
te(o.target_collection, {
|
|
613
|
-
fields: ["id",
|
|
614
|
-
|
|
609
|
+
fields: ["id", d],
|
|
610
|
+
...u ? { filter: u } : {},
|
|
615
611
|
sort: o.options_sort ? [o.options_sort] : void 0,
|
|
616
|
-
limit:
|
|
612
|
+
limit: 200
|
|
617
613
|
})
|
|
618
614
|
)).data ?? []).map((A) => ({
|
|
619
615
|
id: A.id,
|
|
620
|
-
label: String(A[
|
|
616
|
+
label: String(A[d] ?? A.id)
|
|
617
|
+
}));
|
|
618
|
+
}
|
|
619
|
+
}), _ = n != null && n.length ? new Set(n.map(String)) : null, v = _ ? y.filter((u) => _.has(String(u.id))) : y, O = new Set(p.map(String)), f = v.length > 24 || y.length >= 200 && !_, { data: I = [], isFetching: U } = k({
|
|
620
|
+
queryKey: ["nvr-scope-search", o.name, a, C],
|
|
621
|
+
queryFn: async () => {
|
|
622
|
+
const u = await K(), N = { [d]: { _contains: a } }, R = ((await i.request(
|
|
623
|
+
te(o.target_collection, {
|
|
624
|
+
fields: ["id", d],
|
|
625
|
+
filter: u ? { _and: [N, u] } : N,
|
|
626
|
+
sort: o.options_sort ? [o.options_sort] : void 0,
|
|
627
|
+
limit: 30
|
|
628
|
+
})
|
|
629
|
+
)).data ?? []).map((D) => ({
|
|
630
|
+
id: D.id,
|
|
631
|
+
label: String(D[d] ?? D.id)
|
|
621
632
|
}));
|
|
622
|
-
return
|
|
633
|
+
return _ ? R.filter((D) => _.has(String(D.id))) : R;
|
|
623
634
|
},
|
|
624
|
-
enabled:
|
|
625
|
-
placeholderData: (
|
|
626
|
-
}),
|
|
627
|
-
for (const
|
|
628
|
-
const
|
|
629
|
-
queryKey: ["nvr-scope-selected-labels", o.name,
|
|
630
|
-
queryFn: async () => ((await
|
|
635
|
+
enabled: f && a.trim().length > 0,
|
|
636
|
+
placeholderData: (u) => u
|
|
637
|
+
}), x = new Map(y.map((u) => [String(u.id), u.label]));
|
|
638
|
+
for (const u of I) x.set(String(u.id), u.label);
|
|
639
|
+
const L = p.filter((u) => !x.has(String(u))), { data: H = [] } = k({
|
|
640
|
+
queryKey: ["nvr-scope-selected-labels", o.name, L.map(String).sort().join(",")],
|
|
641
|
+
queryFn: async () => ((await i.request(
|
|
631
642
|
te(o.target_collection, {
|
|
632
|
-
fields: ["id",
|
|
633
|
-
filter: { id: { _in:
|
|
643
|
+
fields: ["id", d],
|
|
644
|
+
filter: { id: { _in: L } },
|
|
634
645
|
limit: 100
|
|
635
646
|
})
|
|
636
|
-
)).data ?? []).map((
|
|
637
|
-
id:
|
|
638
|
-
label: String(
|
|
647
|
+
)).data ?? []).map((N) => ({
|
|
648
|
+
id: N.id,
|
|
649
|
+
label: String(N[d] ?? N.id)
|
|
639
650
|
})),
|
|
640
|
-
enabled:
|
|
651
|
+
enabled: L.length > 0
|
|
641
652
|
});
|
|
642
|
-
for (const
|
|
643
|
-
const
|
|
644
|
-
const
|
|
645
|
-
|
|
646
|
-
},
|
|
653
|
+
for (const u of H) x.set(String(u.id), u.label);
|
|
654
|
+
const j = (u) => {
|
|
655
|
+
const N = O.has(String(u));
|
|
656
|
+
l(N ? p.filter((A) => String(A) !== String(u)) : [...p, u]);
|
|
657
|
+
}, g = a.trim().toLowerCase(), E = g ? v.filter((u) => u.label.toLowerCase().includes(g)) : v, Q = g.length === 0 ? v.slice(0, 30) : U && I.length === 0 ? E.slice(0, 30) : I, B = f && (m || g.length > 0);
|
|
647
658
|
return /* @__PURE__ */ t("div", { children: [
|
|
648
659
|
/* @__PURE__ */ t("p", { className: "mb-1 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: [
|
|
649
660
|
o.label,
|
|
@@ -652,7 +663,7 @@ function mt({
|
|
|
652
663
|
"button",
|
|
653
664
|
{
|
|
654
665
|
type: "button",
|
|
655
|
-
onClick: () =>
|
|
666
|
+
onClick: () => l([]),
|
|
656
667
|
className: "ml-2 normal-case tracking-normal text-slate-400 underline-offset-2 hover:text-slate-600 hover:underline",
|
|
657
668
|
children: [
|
|
658
669
|
"clear ",
|
|
@@ -661,126 +672,126 @@ function mt({
|
|
|
661
672
|
}
|
|
662
673
|
)
|
|
663
674
|
] }),
|
|
664
|
-
|
|
665
|
-
p.length > 0 && /* @__PURE__ */ e("div", { className: "mb-1.5 flex flex-wrap gap-1", children: p.map((
|
|
675
|
+
f ? /* @__PURE__ */ t("div", { className: "max-w-xl", children: [
|
|
676
|
+
p.length > 0 && /* @__PURE__ */ e("div", { className: "mb-1.5 flex flex-wrap gap-1", children: p.map((u) => /* @__PURE__ */ t(
|
|
666
677
|
"span",
|
|
667
678
|
{
|
|
668
679
|
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",
|
|
669
680
|
children: [
|
|
670
|
-
|
|
681
|
+
x.get(String(u)) ?? String(u),
|
|
671
682
|
/* @__PURE__ */ e(
|
|
672
683
|
"button",
|
|
673
684
|
{
|
|
674
685
|
type: "button",
|
|
675
|
-
onClick: () =>
|
|
676
|
-
"aria-label": `Remove ${
|
|
686
|
+
onClick: () => j(u),
|
|
687
|
+
"aria-label": `Remove ${x.get(String(u)) ?? u}`,
|
|
677
688
|
className: "rounded-full px-1 text-slate-400 hover:text-slate-600 dark:hover:text-slate-200",
|
|
678
689
|
children: "×"
|
|
679
690
|
}
|
|
680
691
|
)
|
|
681
692
|
]
|
|
682
693
|
},
|
|
683
|
-
String(
|
|
694
|
+
String(u)
|
|
684
695
|
)) }),
|
|
685
696
|
/* @__PURE__ */ e(
|
|
686
697
|
"input",
|
|
687
698
|
{
|
|
688
|
-
value:
|
|
689
|
-
onChange: (
|
|
690
|
-
onFocus: () =>
|
|
691
|
-
onBlur: () =>
|
|
699
|
+
value: a,
|
|
700
|
+
onChange: (u) => h(u.target.value),
|
|
701
|
+
onFocus: () => P(!0),
|
|
702
|
+
onBlur: () => P(!1),
|
|
692
703
|
placeholder: `Search ${o.label.toLowerCase()} to add…`,
|
|
693
704
|
className: "h-8 w-full rounded-md border border-slate-200 bg-white px-2.5 text-[12px] outline-none focus:border-nvr-cyan dark:border-border dark:bg-card"
|
|
694
705
|
}
|
|
695
706
|
),
|
|
696
|
-
|
|
707
|
+
B && /* @__PURE__ */ t(
|
|
697
708
|
"div",
|
|
698
709
|
{
|
|
699
|
-
onMouseDown: (
|
|
710
|
+
onMouseDown: (u) => u.preventDefault(),
|
|
700
711
|
className: "mt-1 max-h-44 overflow-y-auto rounded-md border border-slate-200 dark:border-border",
|
|
701
712
|
children: [
|
|
702
|
-
|
|
703
|
-
const
|
|
713
|
+
Q.map((u) => {
|
|
714
|
+
const N = O.has(String(u.id));
|
|
704
715
|
return /* @__PURE__ */ t(
|
|
705
716
|
"button",
|
|
706
717
|
{
|
|
707
718
|
type: "button",
|
|
708
|
-
onClick: () =>
|
|
709
|
-
className:
|
|
719
|
+
onClick: () => j(u.id),
|
|
720
|
+
className: $(
|
|
710
721
|
"flex w-full items-center justify-between px-2.5 py-1.5 text-left text-[12px] hover:bg-slate-50 dark:hover:bg-muted",
|
|
711
|
-
|
|
722
|
+
N ? "font-medium text-nvr-navy dark:text-nvr-cyan" : "text-slate-600 dark:text-slate-300"
|
|
712
723
|
),
|
|
713
724
|
children: [
|
|
714
|
-
/* @__PURE__ */ e("span", { className: "truncate", children:
|
|
715
|
-
/* @__PURE__ */ e("span", { className: "pl-2 text-[11px] text-slate-400", children:
|
|
725
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: u.label }),
|
|
726
|
+
/* @__PURE__ */ e("span", { className: "pl-2 text-[11px] text-slate-400", children: N ? "Remove" : "Add" })
|
|
716
727
|
]
|
|
717
728
|
},
|
|
718
|
-
String(
|
|
729
|
+
String(u.id)
|
|
719
730
|
);
|
|
720
731
|
}),
|
|
721
|
-
|
|
722
|
-
|
|
732
|
+
Q.length === 0 && /* @__PURE__ */ e("p", { className: "px-2.5 py-2 text-[11.5px] text-slate-400", children: U ? "Searching…" : g ? "No matches." : "No options." }),
|
|
733
|
+
g.length === 0 && v.length > 30 && /* @__PURE__ */ e("p", { className: "border-t border-slate-100 px-2.5 py-1.5 text-[11px] text-slate-400 dark:border-border", children: "Showing first 30 — type to narrow." })
|
|
723
734
|
]
|
|
724
735
|
}
|
|
725
736
|
),
|
|
726
|
-
!
|
|
737
|
+
!B && p.length === 0 && /* @__PURE__ */ e("p", { className: "mt-1 text-[11px] text-slate-400", children: "No defaults set — click to browse or type to search." })
|
|
727
738
|
] }) : /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: [
|
|
728
|
-
|
|
729
|
-
const
|
|
739
|
+
v.map((u) => {
|
|
740
|
+
const N = O.has(String(u.id));
|
|
730
741
|
return /* @__PURE__ */ e(
|
|
731
742
|
"button",
|
|
732
743
|
{
|
|
733
744
|
type: "button",
|
|
734
|
-
onClick: () =>
|
|
735
|
-
className:
|
|
745
|
+
onClick: () => j(u.id),
|
|
746
|
+
className: $(
|
|
736
747
|
"rounded-full border px-2.5 py-0.5 text-[11.5px] transition-colors",
|
|
737
|
-
|
|
748
|
+
N ? "border-nvr-cyan bg-nvr-cyan/10 font-medium text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:border-slate-300 dark:border-border"
|
|
738
749
|
),
|
|
739
|
-
children:
|
|
750
|
+
children: u.label
|
|
740
751
|
},
|
|
741
|
-
String(
|
|
752
|
+
String(u.id)
|
|
742
753
|
);
|
|
743
754
|
}),
|
|
744
|
-
|
|
755
|
+
v.length === 0 && /* @__PURE__ */ e("span", { className: "text-[11.5px] text-slate-400", children: "No options." })
|
|
745
756
|
] })
|
|
746
757
|
] });
|
|
747
758
|
}
|
|
748
|
-
function
|
|
749
|
-
const { data: o } =
|
|
759
|
+
function bt() {
|
|
760
|
+
const { data: o } = k({
|
|
750
761
|
queryKey: ["nvr-settings-2fa"],
|
|
751
|
-
queryFn: () => n.request({ _method: "GET", _path: "/settings/" }).then((
|
|
762
|
+
queryFn: () => n.request({ _method: "GET", _path: "/settings/" }).then((f) => (f == null ? void 0 : f.data) ?? null).catch(() => null),
|
|
752
763
|
staleTime: 6e5
|
|
753
|
-
}), p = (o == null ? void 0 : o.two_factor_enabled) !== !1, n = F(), r = M(), [
|
|
764
|
+
}), p = (o == null ? void 0 : o.two_factor_enabled) !== !1, n = F(), r = M(), [l, i] = q(null), [c, d] = q(""), [a, h] = q(null), { data: m } = k({
|
|
754
765
|
queryKey: ["nvr-profile-totp"],
|
|
755
|
-
queryFn: () => n.request({ _method: "GET", _path: "/two-factor/status" }).then((
|
|
756
|
-
}),
|
|
757
|
-
mutationFn: () => n.request({ _method: "POST", _path: "/two-factor/setup" }).then((
|
|
758
|
-
onSuccess: (
|
|
759
|
-
}),
|
|
760
|
-
mutationFn: (
|
|
766
|
+
queryFn: () => n.request({ _method: "GET", _path: "/two-factor/status" }).then((f) => f.data)
|
|
767
|
+
}), P = () => void r.invalidateQueries({ queryKey: ["nvr-profile-totp"] }), C = S({
|
|
768
|
+
mutationFn: () => n.request({ _method: "POST", _path: "/two-factor/setup" }).then((f) => f.data),
|
|
769
|
+
onSuccess: (f) => i(f)
|
|
770
|
+
}), K = S({
|
|
771
|
+
mutationFn: (f) => n.request({
|
|
761
772
|
_method: "POST",
|
|
762
773
|
_path: "/two-factor/verify",
|
|
763
|
-
_body: { token:
|
|
774
|
+
_body: { token: f }
|
|
764
775
|
}),
|
|
765
776
|
onSuccess: () => {
|
|
766
|
-
i(null),
|
|
777
|
+
i(null), d(""), P();
|
|
767
778
|
}
|
|
768
|
-
}), y =
|
|
769
|
-
mutationFn: (
|
|
779
|
+
}), y = S({
|
|
780
|
+
mutationFn: (f) => n.request({
|
|
770
781
|
_method: "POST",
|
|
771
782
|
_path: "/two-factor/disable",
|
|
772
|
-
_body: { token:
|
|
783
|
+
_body: { token: f }
|
|
773
784
|
}),
|
|
774
785
|
onSuccess: () => {
|
|
775
|
-
|
|
786
|
+
d(""), P();
|
|
776
787
|
}
|
|
777
|
-
}),
|
|
778
|
-
mutationFn: () => n.request({ _method: "POST", _path: "/users/me/token" }).then((
|
|
779
|
-
onSuccess: (
|
|
780
|
-
}),
|
|
788
|
+
}), _ = S({
|
|
789
|
+
mutationFn: () => n.request({ _method: "POST", _path: "/users/me/token" }).then((f) => f.data),
|
|
790
|
+
onSuccess: (f) => h(f.token)
|
|
791
|
+
}), v = S({
|
|
781
792
|
mutationFn: () => n.request({ _method: "DELETE", _path: "/users/me/token" }),
|
|
782
793
|
onSuccess: () => h(null)
|
|
783
|
-
}),
|
|
794
|
+
}), O = S({
|
|
784
795
|
mutationFn: () => n.request({ _method: "POST", _path: "/auth/logout-all" }),
|
|
785
796
|
onSuccess: () => window.location.assign("/login")
|
|
786
797
|
});
|
|
@@ -797,7 +808,7 @@ function ut() {
|
|
|
797
808
|
/* @__PURE__ */ e(
|
|
798
809
|
"span",
|
|
799
810
|
{
|
|
800
|
-
className:
|
|
811
|
+
className: $(
|
|
801
812
|
"rounded-full px-1.5 py-px text-[10px] font-semibold",
|
|
802
813
|
m != null && m.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"
|
|
803
814
|
),
|
|
@@ -805,20 +816,20 @@ function ut() {
|
|
|
805
816
|
}
|
|
806
817
|
)
|
|
807
818
|
] }),
|
|
808
|
-
!(m != null && m.enabled) && !
|
|
819
|
+
!(m != null && m.enabled) && !l && /* @__PURE__ */ e(
|
|
809
820
|
"button",
|
|
810
821
|
{
|
|
811
822
|
type: "button",
|
|
812
|
-
onClick: () =>
|
|
823
|
+
onClick: () => C.mutate(),
|
|
813
824
|
className: "mt-2 h-8 rounded-md border border-slate-200 px-3 text-[12px] font-medium text-slate-600 hover:border-nvr-cyan hover:text-nvr-navy dark:border-border dark:text-slate-300 dark:hover:text-nvr-cyan",
|
|
814
|
-
children:
|
|
825
|
+
children: C.isPending ? "Preparing…" : "Set up 2FA"
|
|
815
826
|
}
|
|
816
827
|
),
|
|
817
|
-
|
|
828
|
+
l && /* @__PURE__ */ t("div", { className: "mt-3 flex flex-wrap items-start gap-4", children: [
|
|
818
829
|
/* @__PURE__ */ e(
|
|
819
830
|
"img",
|
|
820
831
|
{
|
|
821
|
-
src:
|
|
832
|
+
src: l.qr,
|
|
822
833
|
alt: "Scan with your authenticator app",
|
|
823
834
|
className: "h-32 w-32 rounded-md border border-slate-200 dark:border-border"
|
|
824
835
|
}
|
|
@@ -830,7 +841,7 @@ function ut() {
|
|
|
830
841
|
"input",
|
|
831
842
|
{
|
|
832
843
|
value: c,
|
|
833
|
-
onChange: (
|
|
844
|
+
onChange: (f) => d(f.target.value),
|
|
834
845
|
placeholder: "123456",
|
|
835
846
|
inputMode: "numeric",
|
|
836
847
|
className: "h-8 w-[110px] rounded-md border border-slate-200 px-2.5 text-center text-[13px] tabular-nums tracking-widest dark:border-border dark:bg-background"
|
|
@@ -840,8 +851,8 @@ function ut() {
|
|
|
840
851
|
"button",
|
|
841
852
|
{
|
|
842
853
|
type: "button",
|
|
843
|
-
disabled: c.trim().length < 6 ||
|
|
844
|
-
onClick: () =>
|
|
854
|
+
disabled: c.trim().length < 6 || K.isPending,
|
|
855
|
+
onClick: () => K.mutate(c.trim()),
|
|
845
856
|
className: "h-8 rounded-md bg-nvr-cyan px-3 text-[12px] font-semibold text-white disabled:opacity-50",
|
|
846
857
|
children: "Confirm"
|
|
847
858
|
}
|
|
@@ -854,7 +865,7 @@ function ut() {
|
|
|
854
865
|
"input",
|
|
855
866
|
{
|
|
856
867
|
value: c,
|
|
857
|
-
onChange: (
|
|
868
|
+
onChange: (f) => d(f.target.value),
|
|
858
869
|
placeholder: "Code to disable",
|
|
859
870
|
inputMode: "numeric",
|
|
860
871
|
className: "h-8 w-[130px] rounded-md border border-slate-200 px-2.5 text-[12px] dark:border-border dark:bg-background"
|
|
@@ -885,16 +896,16 @@ function ut() {
|
|
|
885
896
|
"button",
|
|
886
897
|
{
|
|
887
898
|
type: "button",
|
|
888
|
-
onClick: () =>
|
|
899
|
+
onClick: () => _.mutate(),
|
|
889
900
|
className: "h-8 rounded-md border border-slate-200 px-3 text-[12px] font-medium text-slate-600 hover:border-nvr-cyan hover:text-nvr-navy dark:border-border dark:text-slate-300 dark:hover:text-nvr-cyan",
|
|
890
|
-
children:
|
|
901
|
+
children: _.isPending ? "Generating…" : "Generate token"
|
|
891
902
|
}
|
|
892
903
|
),
|
|
893
904
|
/* @__PURE__ */ e(
|
|
894
905
|
pe,
|
|
895
906
|
{
|
|
896
907
|
title: "Revoke API token",
|
|
897
|
-
onConfirm: () =>
|
|
908
|
+
onConfirm: () => v.mutate(),
|
|
898
909
|
confirmLabel: "Revoke token?",
|
|
899
910
|
className: "h-8 rounded-md px-3 text-[12px] font-medium text-slate-400 transition-colors hover:text-red-500",
|
|
900
911
|
armedClassName: "font-semibold text-red-500",
|
|
@@ -912,13 +923,13 @@ function ut() {
|
|
|
912
923
|
pe,
|
|
913
924
|
{
|
|
914
925
|
title: "Sign out everywhere",
|
|
915
|
-
onConfirm: () =>
|
|
926
|
+
onConfirm: () => O.mutate(),
|
|
916
927
|
confirmLabel: "Sign out everywhere?",
|
|
917
928
|
className: "mt-2 inline-flex h-8 items-center gap-1.5 rounded-md border border-slate-200 px-3 text-[12px] font-medium text-slate-600 transition-colors hover:border-red-300 hover:text-red-500 dark:border-border dark:text-slate-300 dark:hover:border-red-500/40 dark:hover:text-red-400",
|
|
918
929
|
armedClassName: "border-red-300 font-semibold text-red-500 dark:border-red-500/40 dark:text-red-400",
|
|
919
930
|
children: [
|
|
920
931
|
/* @__PURE__ */ e(Pe, { className: "h-3.5 w-3.5" }),
|
|
921
|
-
|
|
932
|
+
O.isPending ? "Signing out…" : "Sign out everywhere"
|
|
922
933
|
]
|
|
923
934
|
}
|
|
924
935
|
)
|
|
@@ -927,31 +938,31 @@ function ut() {
|
|
|
927
938
|
}
|
|
928
939
|
);
|
|
929
940
|
}
|
|
930
|
-
function
|
|
941
|
+
function ta({
|
|
931
942
|
userId: o,
|
|
932
943
|
className: p,
|
|
933
944
|
initialTab: n,
|
|
934
945
|
extra: r,
|
|
935
|
-
pushServiceWorker:
|
|
946
|
+
pushServiceWorker: l = "/sw.js"
|
|
936
947
|
}) {
|
|
937
948
|
const i = ne();
|
|
938
|
-
return !o || (i == null ? void 0 : i.userId) != null && String(i.userId) === String(o) ? /* @__PURE__ */ e(
|
|
949
|
+
return !o || (i == null ? void 0 : i.userId) != null && String(i.userId) === String(o) ? /* @__PURE__ */ e(xt, { className: p, extra: r, pushServiceWorker: l }) : /* @__PURE__ */ e(rt, { userId: o, className: p, initialTab: n });
|
|
939
950
|
}
|
|
940
|
-
function
|
|
951
|
+
function xt({
|
|
941
952
|
className: o,
|
|
942
953
|
extra: p,
|
|
943
954
|
pushServiceWorker: n
|
|
944
955
|
}) {
|
|
945
|
-
var
|
|
946
|
-
const r = F(),
|
|
947
|
-
queryKey: ["nvr-profile-user",
|
|
948
|
-
queryFn: () => r.request(be(
|
|
956
|
+
var j;
|
|
957
|
+
const r = F(), l = M(), i = ne(), c = !0, d = "me", { data: a } = k({
|
|
958
|
+
queryKey: ["nvr-profile-user", d],
|
|
959
|
+
queryFn: () => r.request(be(d)).then((g) => g.data),
|
|
949
960
|
enabled: c
|
|
950
|
-
}), h = (a == null ? void 0 : a.id) ?? null, { data: m } =
|
|
961
|
+
}), h = (a == null ? void 0 : a.id) ?? null, { data: m } = k({
|
|
951
962
|
queryKey: ["nvr-profile-card", h],
|
|
952
|
-
queryFn: () => r.request(xe(h)).then((
|
|
963
|
+
queryFn: () => r.request(xe(h)).then((g) => g.data),
|
|
953
964
|
enabled: !!h
|
|
954
|
-
}), [
|
|
965
|
+
}), [P, C] = q(null), K = Fe(
|
|
955
966
|
() => ({
|
|
956
967
|
first_name: (a == null ? void 0 : a.first_name) ?? "",
|
|
957
968
|
last_name: (a == null ? void 0 : a.last_name) ?? "",
|
|
@@ -960,35 +971,35 @@ function pt({
|
|
|
960
971
|
phone: (a == null ? void 0 : a.phone) ?? ""
|
|
961
972
|
}),
|
|
962
973
|
[a]
|
|
963
|
-
), y =
|
|
974
|
+
), y = P ?? K, _ = JSON.stringify(y) !== JSON.stringify(K), v = S({
|
|
964
975
|
mutationFn: () => r.request(de(a.id, y)),
|
|
965
976
|
onSuccess: () => {
|
|
966
|
-
|
|
977
|
+
C(null), l.invalidateQueries({ queryKey: ["nvr-profile-user"] }), l.invalidateQueries({ queryKey: ["nvr-profile-card"] });
|
|
967
978
|
}
|
|
968
|
-
}), [
|
|
969
|
-
mutationFn: async (
|
|
970
|
-
const
|
|
971
|
-
const
|
|
972
|
-
|
|
973
|
-
URL.revokeObjectURL(
|
|
974
|
-
const
|
|
975
|
-
|
|
976
|
-
const
|
|
977
|
-
if (!
|
|
978
|
-
const V = Math.max(
|
|
979
|
-
|
|
980
|
-
},
|
|
981
|
-
URL.revokeObjectURL(
|
|
982
|
-
},
|
|
979
|
+
}), [O, f] = q(gt), I = he(null), U = S({
|
|
980
|
+
mutationFn: async (g) => {
|
|
981
|
+
const E = await new Promise((Q, B) => {
|
|
982
|
+
const u = new Image(), N = URL.createObjectURL(g);
|
|
983
|
+
u.onload = () => {
|
|
984
|
+
URL.revokeObjectURL(N);
|
|
985
|
+
const A = 96, R = document.createElement("canvas");
|
|
986
|
+
R.width = A, R.height = A;
|
|
987
|
+
const D = R.getContext("2d");
|
|
988
|
+
if (!D) return B(new Error("canvas unavailable"));
|
|
989
|
+
const V = Math.max(A / u.width, A / u.height), Z = u.width * V, G = u.height * V;
|
|
990
|
+
D.drawImage(u, (A - Z) / 2, (A - G) / 2, Z, G), Q(R.toDataURL("image/jpeg", 0.85));
|
|
991
|
+
}, u.onerror = () => {
|
|
992
|
+
URL.revokeObjectURL(N), B(new Error("not an image"));
|
|
993
|
+
}, u.src = N;
|
|
983
994
|
});
|
|
984
|
-
await r.request(de(a.id, { avatar:
|
|
995
|
+
await r.request(de(a.id, { avatar: E }));
|
|
985
996
|
},
|
|
986
997
|
onSuccess: () => {
|
|
987
|
-
|
|
998
|
+
l.invalidateQueries({ queryKey: ["nvr-profile-user"] }), l.invalidateQueries({ queryKey: ["nvr-profile-card"] }), l.invalidateQueries({ queryKey: ["user-card"] }), l.invalidateQueries({ queryKey: ["user-avatar"] });
|
|
988
999
|
}
|
|
989
|
-
}),
|
|
990
|
-
if (!
|
|
991
|
-
return /* @__PURE__ */ t("div", { className:
|
|
1000
|
+
}), x = m ?? (a ? { ...a, role_name: null } : null);
|
|
1001
|
+
if (!x)
|
|
1002
|
+
return /* @__PURE__ */ t("div", { className: $("flex animate-pulse flex-col gap-4", o), "aria-busy": "true", children: [
|
|
992
1003
|
/* @__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: [
|
|
993
1004
|
/* @__PURE__ */ e("div", { className: "h-[76px] w-[76px] rounded-full bg-slate-100 dark:bg-muted" }),
|
|
994
1005
|
/* @__PURE__ */ t("div", { className: "flex-1 space-y-2.5", children: [
|
|
@@ -1002,26 +1013,26 @@ function pt({
|
|
|
1002
1013
|
/* @__PURE__ */ e("div", { className: "h-64 rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card" })
|
|
1003
1014
|
] })
|
|
1004
1015
|
] });
|
|
1005
|
-
const
|
|
1006
|
-
return /* @__PURE__ */ t("div", { className:
|
|
1016
|
+
const L = (a == null ? void 0 : a.avatar) ?? null, H = x.status === "active";
|
|
1017
|
+
return /* @__PURE__ */ t("div", { className: $("flex flex-col gap-4", o), "data-nvr-profile": !0, children: [
|
|
1007
1018
|
/* @__PURE__ */ e("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-x-5 gap-y-4 p-5", children: [
|
|
1008
1019
|
/* @__PURE__ */ t("div", { className: "relative", children: [
|
|
1009
|
-
|
|
1020
|
+
L ? /* @__PURE__ */ e(
|
|
1010
1021
|
"img",
|
|
1011
1022
|
{
|
|
1012
|
-
src:
|
|
1023
|
+
src: L.startsWith("data:") ? L : `/api/files/${L}`,
|
|
1013
1024
|
alt: "",
|
|
1014
1025
|
className: "h-[76px] w-[76px] rounded-full border border-slate-200 object-cover dark:border-border"
|
|
1015
1026
|
}
|
|
1016
|
-
) : /* @__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:
|
|
1027
|
+
) : /* @__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: ot(x) }),
|
|
1017
1028
|
/* @__PURE__ */ e(
|
|
1018
1029
|
"span",
|
|
1019
1030
|
{
|
|
1020
|
-
className:
|
|
1031
|
+
className: $(
|
|
1021
1032
|
"absolute bottom-0.5 right-0.5 h-3 w-3 rounded-full border-2 border-white dark:border-card",
|
|
1022
|
-
|
|
1033
|
+
H ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
|
|
1023
1034
|
),
|
|
1024
|
-
title:
|
|
1035
|
+
title: H ? "Active" : x.status
|
|
1025
1036
|
}
|
|
1026
1037
|
),
|
|
1027
1038
|
/* @__PURE__ */ t(X, { children: [
|
|
@@ -1032,24 +1043,24 @@ function pt({
|
|
|
1032
1043
|
title: "Change photo",
|
|
1033
1044
|
"aria-label": "Change photo",
|
|
1034
1045
|
onClick: () => {
|
|
1035
|
-
var
|
|
1036
|
-
return (
|
|
1046
|
+
var g;
|
|
1047
|
+
return (g = I.current) == null ? void 0 : g.click();
|
|
1037
1048
|
},
|
|
1038
1049
|
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",
|
|
1039
|
-
children:
|
|
1050
|
+
children: U.isPending ? /* @__PURE__ */ e(ce, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5" })
|
|
1040
1051
|
}
|
|
1041
1052
|
),
|
|
1042
1053
|
/* @__PURE__ */ e(
|
|
1043
1054
|
"input",
|
|
1044
1055
|
{
|
|
1045
|
-
ref:
|
|
1056
|
+
ref: I,
|
|
1046
1057
|
type: "file",
|
|
1047
1058
|
accept: "image/*",
|
|
1048
1059
|
className: "hidden",
|
|
1049
|
-
onChange: (
|
|
1050
|
-
var
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1060
|
+
onChange: (g) => {
|
|
1061
|
+
var Q;
|
|
1062
|
+
const E = (Q = g.target.files) == null ? void 0 : Q[0];
|
|
1063
|
+
E && U.mutate(E), g.target.value = "";
|
|
1053
1064
|
}
|
|
1054
1065
|
}
|
|
1055
1066
|
)
|
|
@@ -1057,57 +1068,57 @@ function pt({
|
|
|
1057
1068
|
] }),
|
|
1058
1069
|
/* @__PURE__ */ t("div", { className: "min-w-0 flex-1", children: [
|
|
1059
1070
|
/* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1060
|
-
/* @__PURE__ */ e("h1", { className: "text-[21px] font-semibold tracking-[-0.015em] text-slate-900 dark:text-white", children:
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
/* @__PURE__ */ e(
|
|
1071
|
+
/* @__PURE__ */ e("h1", { className: "text-[21px] font-semibold tracking-[-0.015em] text-slate-900 dark:text-white", children: lt(x) }),
|
|
1072
|
+
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 }),
|
|
1073
|
+
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" }),
|
|
1074
|
+
/* @__PURE__ */ e(Je, { email: x.email, canClear: i.isAdmin })
|
|
1064
1075
|
] }),
|
|
1065
1076
|
a && // The same status the chat panel's Online tab sets — one editor,
|
|
1066
1077
|
// one preference, so the profile always agrees with the top bar.
|
|
1067
1078
|
/* @__PURE__ */ e(
|
|
1068
|
-
|
|
1079
|
+
je,
|
|
1069
1080
|
{
|
|
1070
|
-
status:
|
|
1071
|
-
(
|
|
1081
|
+
status: Ee(
|
|
1082
|
+
(j = a.preferences) == null ? void 0 : j.custom_status
|
|
1072
1083
|
),
|
|
1073
1084
|
showExpiry: !0,
|
|
1074
1085
|
className: "mt-1.5"
|
|
1075
1086
|
}
|
|
1076
1087
|
),
|
|
1077
|
-
(
|
|
1088
|
+
(x.title || x.department) && /* @__PURE__ */ e("p", { className: "mt-0.5 truncate text-[13px] text-slate-500 dark:text-slate-400", children: [x.title, x.department].filter(Boolean).join(" · ") }),
|
|
1078
1089
|
/* @__PURE__ */ t("div", { className: "mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-[12.5px] text-slate-500 dark:text-slate-400", children: [
|
|
1079
|
-
|
|
1090
|
+
x.company && /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
1080
1091
|
/* @__PURE__ */ e(ve, { className: "h-3.5 w-3.5" }),
|
|
1081
1092
|
" ",
|
|
1082
|
-
|
|
1093
|
+
x.company
|
|
1083
1094
|
] }),
|
|
1084
1095
|
/* @__PURE__ */ t(
|
|
1085
1096
|
"a",
|
|
1086
1097
|
{
|
|
1087
|
-
href: `mailto:${
|
|
1098
|
+
href: `mailto:${x.email}`,
|
|
1088
1099
|
className: "inline-flex items-center gap-1.5 transition-colors hover:text-nvr-navy dark:hover:text-nvr-cyan",
|
|
1089
1100
|
children: [
|
|
1090
1101
|
/* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5" }),
|
|
1091
1102
|
" ",
|
|
1092
|
-
|
|
1103
|
+
x.email
|
|
1093
1104
|
]
|
|
1094
1105
|
}
|
|
1095
1106
|
),
|
|
1096
|
-
|
|
1107
|
+
x.phone && /* @__PURE__ */ t(
|
|
1097
1108
|
"a",
|
|
1098
1109
|
{
|
|
1099
|
-
href: `tel:${
|
|
1110
|
+
href: `tel:${x.phone}`,
|
|
1100
1111
|
className: "inline-flex items-center gap-1.5 transition-colors hover:text-nvr-navy dark:hover:text-nvr-cyan",
|
|
1101
1112
|
children: [
|
|
1102
1113
|
/* @__PURE__ */ e(Ne, { className: "h-3.5 w-3.5" }),
|
|
1103
1114
|
" ",
|
|
1104
|
-
|
|
1115
|
+
x.phone
|
|
1105
1116
|
]
|
|
1106
1117
|
}
|
|
1107
1118
|
),
|
|
1108
|
-
|
|
1119
|
+
x.last_access && /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1.5", title: "Last active", children: [
|
|
1109
1120
|
/* @__PURE__ */ e(we, { className: "h-3.5 w-3.5" }),
|
|
1110
|
-
new Date(
|
|
1121
|
+
new Date(x.last_access).toLocaleDateString(void 0, {
|
|
1111
1122
|
month: "short",
|
|
1112
1123
|
day: "numeric"
|
|
1113
1124
|
})
|
|
@@ -1115,10 +1126,10 @@ function pt({
|
|
|
1115
1126
|
] })
|
|
1116
1127
|
] })
|
|
1117
1128
|
] }) }),
|
|
1118
|
-
/* @__PURE__ */ e(
|
|
1119
|
-
|
|
1129
|
+
/* @__PURE__ */ e(ft, { tab: O, onChange: f }),
|
|
1130
|
+
O === "agents" ? /* @__PURE__ */ e(Be, {}) : O === "did" && a ? (
|
|
1120
1131
|
// #13 — your own audit trail, by day and collection.
|
|
1121
|
-
/* @__PURE__ */ e(
|
|
1132
|
+
/* @__PURE__ */ e(Ve, { userId: String(a.id), name: null })
|
|
1122
1133
|
) : a ? (
|
|
1123
1134
|
// One list in reading order — you, then notifications, then access
|
|
1124
1135
|
// and security — flowing into two balanced columns. Two fixed stacks
|
|
@@ -1136,13 +1147,13 @@ function pt({
|
|
|
1136
1147
|
icon: /* @__PURE__ */ e(Ce, { className: "h-4 w-4" }),
|
|
1137
1148
|
title: "About you",
|
|
1138
1149
|
hint: "Shown on your contact card across the app",
|
|
1139
|
-
actions:
|
|
1150
|
+
actions: _ && /* @__PURE__ */ t("span", { className: "flex items-center gap-1.5", children: [
|
|
1140
1151
|
/* @__PURE__ */ t(
|
|
1141
1152
|
"button",
|
|
1142
1153
|
{
|
|
1143
1154
|
type: "button",
|
|
1144
1155
|
title: "Discard changes",
|
|
1145
|
-
onClick: () =>
|
|
1156
|
+
onClick: () => C(null),
|
|
1146
1157
|
className: "inline-flex h-7 items-center gap-1 rounded-md px-2 text-[11.5px] font-medium text-slate-400 transition-colors hover:text-slate-600 dark:hover:text-slate-200",
|
|
1147
1158
|
children: [
|
|
1148
1159
|
/* @__PURE__ */ e(Se, { className: "h-3 w-3" }),
|
|
@@ -1154,11 +1165,11 @@ function pt({
|
|
|
1154
1165
|
"button",
|
|
1155
1166
|
{
|
|
1156
1167
|
type: "button",
|
|
1157
|
-
disabled:
|
|
1158
|
-
onClick: () =>
|
|
1168
|
+
disabled: v.isPending,
|
|
1169
|
+
onClick: () => v.mutate(),
|
|
1159
1170
|
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",
|
|
1160
1171
|
children: [
|
|
1161
|
-
|
|
1172
|
+
v.isPending ? /* @__PURE__ */ e(ce, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(_e, { className: "h-3 w-3" }),
|
|
1162
1173
|
" ",
|
|
1163
1174
|
"Save"
|
|
1164
1175
|
]
|
|
@@ -1167,80 +1178,80 @@ function pt({
|
|
|
1167
1178
|
] }),
|
|
1168
1179
|
children: /* @__PURE__ */ t("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
1169
1180
|
/* @__PURE__ */ e(
|
|
1170
|
-
|
|
1181
|
+
W,
|
|
1171
1182
|
{
|
|
1172
1183
|
label: "First name",
|
|
1173
1184
|
value: y.first_name,
|
|
1174
|
-
onChange: (
|
|
1185
|
+
onChange: (g) => C({ ...y, first_name: g })
|
|
1175
1186
|
}
|
|
1176
1187
|
),
|
|
1177
1188
|
/* @__PURE__ */ e(
|
|
1178
|
-
|
|
1189
|
+
W,
|
|
1179
1190
|
{
|
|
1180
1191
|
label: "Last name",
|
|
1181
1192
|
value: y.last_name,
|
|
1182
|
-
onChange: (
|
|
1193
|
+
onChange: (g) => C({ ...y, last_name: g })
|
|
1183
1194
|
}
|
|
1184
1195
|
),
|
|
1185
1196
|
/* @__PURE__ */ e(
|
|
1186
|
-
|
|
1197
|
+
W,
|
|
1187
1198
|
{
|
|
1188
1199
|
label: "Title",
|
|
1189
1200
|
value: y.title,
|
|
1190
|
-
onChange: (
|
|
1201
|
+
onChange: (g) => C({ ...y, title: g }),
|
|
1191
1202
|
placeholder: "e.g. Construction Manager"
|
|
1192
1203
|
}
|
|
1193
1204
|
),
|
|
1194
1205
|
/* @__PURE__ */ e(
|
|
1195
|
-
|
|
1206
|
+
W,
|
|
1196
1207
|
{
|
|
1197
1208
|
label: "Department",
|
|
1198
1209
|
value: y.department,
|
|
1199
|
-
onChange: (
|
|
1210
|
+
onChange: (g) => C({ ...y, department: g })
|
|
1200
1211
|
}
|
|
1201
1212
|
),
|
|
1202
1213
|
/* @__PURE__ */ e(
|
|
1203
|
-
|
|
1214
|
+
W,
|
|
1204
1215
|
{
|
|
1205
1216
|
label: "Phone",
|
|
1206
1217
|
value: y.phone,
|
|
1207
|
-
onChange: (
|
|
1218
|
+
onChange: (g) => C({ ...y, phone: g }),
|
|
1208
1219
|
placeholder: "+1 …",
|
|
1209
1220
|
type: "tel"
|
|
1210
1221
|
}
|
|
1211
1222
|
),
|
|
1212
|
-
/* @__PURE__ */ e(
|
|
1223
|
+
/* @__PURE__ */ e(W, { label: "Email", value: a.email ?? "", disabled: !0, hint: "managed by admin" })
|
|
1213
1224
|
] })
|
|
1214
1225
|
}
|
|
1215
1226
|
),
|
|
1216
1227
|
/* @__PURE__ */ e(
|
|
1217
|
-
|
|
1228
|
+
Ge,
|
|
1218
1229
|
{
|
|
1219
1230
|
user: a,
|
|
1220
1231
|
onSaved: () => {
|
|
1221
|
-
|
|
1232
|
+
l.invalidateQueries({ queryKey: ["nvr-profile-user"] }), l.invalidateQueries({ queryKey: ["nvr-profile-card"] });
|
|
1222
1233
|
}
|
|
1223
1234
|
}
|
|
1224
1235
|
),
|
|
1225
|
-
/* @__PURE__ */ e(lt, {}),
|
|
1226
1236
|
/* @__PURE__ */ e(dt, {}),
|
|
1227
|
-
/* @__PURE__ */ e(kt, {}),
|
|
1228
|
-
/* @__PURE__ */ e(Ze, {}),
|
|
1229
|
-
/* @__PURE__ */ e(it, {}),
|
|
1230
|
-
/* @__PURE__ */ e($e, {}),
|
|
1231
|
-
/* @__PURE__ */ e(ze, {}),
|
|
1232
|
-
i.isAdmin && (a != null && a.id) ? /* @__PURE__ */ e(Xe, { userId: String(a.id) }) : /* @__PURE__ */ e(ct, {}),
|
|
1233
|
-
/* @__PURE__ */ e(gt, {}),
|
|
1234
|
-
/* @__PURE__ */ e(Ge, { userId: "me" }),
|
|
1235
|
-
/* @__PURE__ */ e(ft, {}),
|
|
1236
|
-
/* @__PURE__ */ e(ot, {}),
|
|
1237
|
-
/* @__PURE__ */ e(Ve, {}),
|
|
1238
|
-
n !== !1 && /* @__PURE__ */ e(Be, { serviceWorkerPath: n }),
|
|
1239
|
-
/* @__PURE__ */ e(yt, {}),
|
|
1240
|
-
/* @__PURE__ */ e(at, {}),
|
|
1241
1237
|
/* @__PURE__ */ e(ut, {}),
|
|
1238
|
+
/* @__PURE__ */ e(St, {}),
|
|
1239
|
+
/* @__PURE__ */ e(tt, {}),
|
|
1240
|
+
/* @__PURE__ */ e(mt, {}),
|
|
1241
|
+
/* @__PURE__ */ e(He, {}),
|
|
1242
|
+
/* @__PURE__ */ e(Ye, {}),
|
|
1243
|
+
i.isAdmin && (a != null && a.id) ? /* @__PURE__ */ e(at, { userId: String(a.id) }) : /* @__PURE__ */ e(pt, {}),
|
|
1242
1244
|
/* @__PURE__ */ e(vt, {}),
|
|
1243
|
-
/* @__PURE__ */ e(
|
|
1245
|
+
/* @__PURE__ */ e(Ze, { userId: "me" }),
|
|
1246
|
+
/* @__PURE__ */ e(kt, {}),
|
|
1247
|
+
/* @__PURE__ */ e(ct, {}),
|
|
1248
|
+
/* @__PURE__ */ e(et, {}),
|
|
1249
|
+
n !== !1 && /* @__PURE__ */ e(We, { serviceWorkerPath: n }),
|
|
1250
|
+
/* @__PURE__ */ e(Nt, {}),
|
|
1251
|
+
/* @__PURE__ */ e(st, {}),
|
|
1252
|
+
/* @__PURE__ */ e(bt, {}),
|
|
1253
|
+
/* @__PURE__ */ e(wt, {}),
|
|
1254
|
+
/* @__PURE__ */ e(yt, {}),
|
|
1244
1255
|
p
|
|
1245
1256
|
]
|
|
1246
1257
|
}
|
|
@@ -1248,7 +1259,7 @@ function pt({
|
|
|
1248
1259
|
) : null
|
|
1249
1260
|
] });
|
|
1250
1261
|
}
|
|
1251
|
-
function
|
|
1262
|
+
function gt() {
|
|
1252
1263
|
try {
|
|
1253
1264
|
const o = new URLSearchParams(window.location.search).get("tab");
|
|
1254
1265
|
return o === "agents" || o === "did" ? o : "profile";
|
|
@@ -1256,15 +1267,15 @@ function ht() {
|
|
|
1256
1267
|
return "profile";
|
|
1257
1268
|
}
|
|
1258
1269
|
}
|
|
1259
|
-
function
|
|
1270
|
+
function ft({
|
|
1260
1271
|
tab: o,
|
|
1261
1272
|
onChange: p
|
|
1262
1273
|
}) {
|
|
1263
|
-
const n = (
|
|
1264
|
-
p(
|
|
1274
|
+
const n = (l) => {
|
|
1275
|
+
p(l);
|
|
1265
1276
|
try {
|
|
1266
1277
|
const i = new URL(window.location.href);
|
|
1267
|
-
|
|
1278
|
+
l !== "profile" ? i.searchParams.set("tab", l) : i.searchParams.delete("tab"), window.history.replaceState(window.history.state, "", i);
|
|
1268
1279
|
} catch {
|
|
1269
1280
|
}
|
|
1270
1281
|
};
|
|
@@ -1278,34 +1289,34 @@ function bt({
|
|
|
1278
1289
|
["profile", "Profile"],
|
|
1279
1290
|
["agents", "What my agents did"],
|
|
1280
1291
|
["did", "What I did"]
|
|
1281
|
-
].map(([
|
|
1292
|
+
].map(([l, i]) => /* @__PURE__ */ e(
|
|
1282
1293
|
"button",
|
|
1283
1294
|
{
|
|
1284
1295
|
type: "button",
|
|
1285
1296
|
role: "tab",
|
|
1286
|
-
"aria-selected": o ===
|
|
1287
|
-
onClick: () => n(
|
|
1288
|
-
className:
|
|
1297
|
+
"aria-selected": o === l,
|
|
1298
|
+
onClick: () => n(l),
|
|
1299
|
+
className: $(
|
|
1289
1300
|
"-mb-px border-b-2 px-3 py-2 text-[13px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/40",
|
|
1290
|
-
o ===
|
|
1301
|
+
o === l ? "border-nvr-cyan text-slate-900 dark:text-white" : "border-transparent text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-200"
|
|
1291
1302
|
),
|
|
1292
1303
|
children: i
|
|
1293
1304
|
},
|
|
1294
|
-
|
|
1305
|
+
l
|
|
1295
1306
|
))
|
|
1296
1307
|
}
|
|
1297
1308
|
);
|
|
1298
1309
|
}
|
|
1299
|
-
function
|
|
1300
|
-
const o = F(), [p, n] =
|
|
1310
|
+
function yt() {
|
|
1311
|
+
const o = F(), [p, n] = q(!1), { data: r = [], isLoading: l } = k({
|
|
1301
1312
|
queryKey: ["my-matrix-seats"],
|
|
1302
1313
|
queryFn: () => o.request(T("/pipelines/my-seats")).then((c) => c.data ?? []).catch(() => []),
|
|
1303
1314
|
enabled: p,
|
|
1304
1315
|
staleTime: 6e4
|
|
1305
1316
|
}), i = /* @__PURE__ */ new Map();
|
|
1306
1317
|
for (const c of r) {
|
|
1307
|
-
const
|
|
1308
|
-
|
|
1318
|
+
const d = i.get(c.template_name) ?? [];
|
|
1319
|
+
d.push(c), i.set(c.template_name, d);
|
|
1309
1320
|
}
|
|
1310
1321
|
return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white p-4 dark:border-border dark:bg-card", children: [
|
|
1311
1322
|
/* @__PURE__ */ t(
|
|
@@ -1323,10 +1334,10 @@ function xt() {
|
|
|
1323
1334
|
]
|
|
1324
1335
|
}
|
|
1325
1336
|
),
|
|
1326
|
-
p && (
|
|
1337
|
+
p && (l ? /* @__PURE__ */ e("p", { className: "mt-3 text-[12.5px] text-slate-400", children: "Loading…" }) : r.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: [...i.entries()].map(([c, d]) => /* @__PURE__ */ t("div", { children: [
|
|
1327
1338
|
/* @__PURE__ */ e("p", { className: "text-[11px] font-semibold uppercase tracking-wide text-slate-400", children: c }),
|
|
1328
1339
|
/* @__PURE__ */ t("ul", { className: "mt-1 space-y-1.5", children: [
|
|
1329
|
-
|
|
1340
|
+
d.slice(0, 40).map((a) => /* @__PURE__ */ t("li", { className: "text-[12.5px]", children: [
|
|
1330
1341
|
/* @__PURE__ */ e("span", { className: "font-medium", children: a.state_label || a.state_key }),
|
|
1331
1342
|
a.group_name && /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-muted-foreground", children: [
|
|
1332
1343
|
" ",
|
|
@@ -1351,28 +1362,28 @@ function xt() {
|
|
|
1351
1362
|
}
|
|
1352
1363
|
)
|
|
1353
1364
|
] }, a.group_id)),
|
|
1354
|
-
|
|
1365
|
+
d.length > 40 && /* @__PURE__ */ t("li", { className: "text-[11.5px] text-slate-400", children: [
|
|
1355
1366
|
"…and ",
|
|
1356
|
-
|
|
1367
|
+
d.length - 40,
|
|
1357
1368
|
" more"
|
|
1358
1369
|
] })
|
|
1359
1370
|
] })
|
|
1360
1371
|
] }, c)) }))
|
|
1361
1372
|
] });
|
|
1362
1373
|
}
|
|
1363
|
-
function
|
|
1364
|
-
const o = F(), p = M(), { data: n = [] } =
|
|
1374
|
+
function vt() {
|
|
1375
|
+
const o = F(), p = M(), { data: n = [] } = k({
|
|
1365
1376
|
queryKey: ["my-reminders"],
|
|
1366
1377
|
queryFn: () => o.request(T("/reminders")).then((m) => m.data).catch(() => []),
|
|
1367
1378
|
staleTime: 3e4
|
|
1368
|
-
}), [r,
|
|
1379
|
+
}), [r, l] = q(""), [i, c] = q(""), d = () => void p.invalidateQueries({ queryKey: ["my-reminders"] }), a = S({
|
|
1369
1380
|
mutationFn: () => o.request(ee("/reminders", { note: r, remind_at: new Date(i).toISOString() })),
|
|
1370
1381
|
onSuccess: () => {
|
|
1371
|
-
|
|
1382
|
+
l(""), c(""), d();
|
|
1372
1383
|
}
|
|
1373
|
-
}), h =
|
|
1384
|
+
}), h = S({
|
|
1374
1385
|
mutationFn: (m) => o.request(De(`/reminders/${m}`)),
|
|
1375
|
-
onSuccess:
|
|
1386
|
+
onSuccess: d
|
|
1376
1387
|
});
|
|
1377
1388
|
return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
1378
1389
|
/* @__PURE__ */ t("header", { className: "border-b border-slate-100 px-4 py-2.5 dark:border-border/60", children: [
|
|
@@ -1408,7 +1419,7 @@ function gt() {
|
|
|
1408
1419
|
"input",
|
|
1409
1420
|
{
|
|
1410
1421
|
value: r,
|
|
1411
|
-
onChange: (m) =>
|
|
1422
|
+
onChange: (m) => l(m.target.value),
|
|
1412
1423
|
placeholder: "Remind me to…",
|
|
1413
1424
|
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"
|
|
1414
1425
|
}
|
|
@@ -1437,8 +1448,8 @@ function gt() {
|
|
|
1437
1448
|
] })
|
|
1438
1449
|
] });
|
|
1439
1450
|
}
|
|
1440
|
-
function
|
|
1441
|
-
const o = F(), { data: p } =
|
|
1451
|
+
function kt() {
|
|
1452
|
+
const o = F(), { data: p } = k({
|
|
1442
1453
|
queryKey: ["my-stats"],
|
|
1443
1454
|
queryFn: () => o.request(T("/users/me/stats")).then((r) => r.data).catch(() => null),
|
|
1444
1455
|
staleTime: 5 * 6e4
|
|
@@ -1457,7 +1468,7 @@ function ft() {
|
|
|
1457
1468
|
] })
|
|
1458
1469
|
] }),
|
|
1459
1470
|
/* @__PURE__ */ t("div", { className: "px-4 py-3", children: [
|
|
1460
|
-
/* @__PURE__ */ e("div", { className: "flex items-end gap-1.5", style: { height: 56 }, children: p.weeks.map((r,
|
|
1471
|
+
/* @__PURE__ */ e("div", { className: "flex items-end gap-1.5", style: { height: 56 }, children: p.weeks.map((r, l) => {
|
|
1461
1472
|
const i = r.transitions + r.tasks_done + r.created;
|
|
1462
1473
|
return /* @__PURE__ */ e(
|
|
1463
1474
|
"div",
|
|
@@ -1466,7 +1477,7 @@ function ft() {
|
|
|
1466
1477
|
style: { height: `${Math.max(4, i / n * 100)}%` },
|
|
1467
1478
|
"data-tip": `${i} action${i === 1 ? "" : "s"}: ${r.transitions} transitions, ${r.tasks_done} tasks done, ${r.created} created`
|
|
1468
1479
|
},
|
|
1469
|
-
|
|
1480
|
+
l
|
|
1470
1481
|
);
|
|
1471
1482
|
}) }),
|
|
1472
1483
|
/* @__PURE__ */ t("div", { className: "mt-2 flex items-center justify-between text-[11px] text-slate-400", children: [
|
|
@@ -1493,23 +1504,23 @@ function ft() {
|
|
|
1493
1504
|
] })
|
|
1494
1505
|
] });
|
|
1495
1506
|
}
|
|
1496
|
-
function
|
|
1497
|
-
const o = F(), p = M(), { data: n } =
|
|
1507
|
+
function Nt() {
|
|
1508
|
+
const o = F(), p = M(), { data: n } = k({
|
|
1498
1509
|
queryKey: ["my-security"],
|
|
1499
1510
|
queryFn: () => o.request(T("/security/my/sessions")).then((i) => i.data).catch(() => ({ sessions: [], logins: [] })),
|
|
1500
1511
|
staleTime: 3e4
|
|
1501
|
-
}), r =
|
|
1512
|
+
}), r = S({
|
|
1502
1513
|
mutationFn: () => o.request(ee("/security/my/sessions/sign-out-others", {})).then((i) => i.data),
|
|
1503
1514
|
onSuccess: (i) => {
|
|
1504
|
-
p.invalidateQueries({ queryKey: ["my-security"] }),
|
|
1515
|
+
p.invalidateQueries({ queryKey: ["my-security"] }), l(`Signed out ${(i == null ? void 0 : i.revoked) ?? 0} other session(s)`);
|
|
1505
1516
|
},
|
|
1506
1517
|
onError: (i) => {
|
|
1507
|
-
var
|
|
1508
|
-
const c = ((a = (
|
|
1518
|
+
var d, a;
|
|
1519
|
+
const c = ((a = (d = i == null ? void 0 : i.response) == null ? void 0 : d.data) == null ? void 0 : a.error) ?? "Could not sign out your other sessions — try again.";
|
|
1509
1520
|
import("sonner").then(({ toast: h }) => h.error(c)).catch(() => {
|
|
1510
1521
|
});
|
|
1511
1522
|
}
|
|
1512
|
-
}),
|
|
1523
|
+
}), l = (i) => {
|
|
1513
1524
|
try {
|
|
1514
1525
|
import("sonner").then(({ toast: c }) => c.success(i));
|
|
1515
1526
|
} catch {
|
|
@@ -1571,10 +1582,10 @@ function yt() {
|
|
|
1571
1582
|
] })
|
|
1572
1583
|
] });
|
|
1573
1584
|
}
|
|
1574
|
-
function
|
|
1575
|
-
const o = F(), [p, n] =
|
|
1585
|
+
function wt() {
|
|
1586
|
+
const o = F(), [p, n] = q(!1), { data: r } = k({
|
|
1576
1587
|
queryKey: ["my-permissions"],
|
|
1577
|
-
queryFn: () => o.request(T("/security/my/permissions")).then((
|
|
1588
|
+
queryFn: () => o.request(T("/security/my/permissions")).then((l) => l.data),
|
|
1578
1589
|
enabled: p,
|
|
1579
1590
|
staleTime: 5 * 6e4
|
|
1580
1591
|
});
|
|
@@ -1583,7 +1594,7 @@ function vt() {
|
|
|
1583
1594
|
"button",
|
|
1584
1595
|
{
|
|
1585
1596
|
type: "button",
|
|
1586
|
-
onClick: () => n((
|
|
1597
|
+
onClick: () => n((l) => !l),
|
|
1587
1598
|
className: "flex w-full items-center justify-between px-4 py-2.5 text-left",
|
|
1588
1599
|
children: [
|
|
1589
1600
|
/* @__PURE__ */ t("div", { children: [
|
|
@@ -1604,7 +1615,7 @@ function vt() {
|
|
|
1604
1615
|
r.scopes.length > 0 && /* @__PURE__ */ t("p", { children: [
|
|
1605
1616
|
"Your data is limited to:",
|
|
1606
1617
|
" ",
|
|
1607
|
-
r.scopes.map((
|
|
1618
|
+
r.scopes.map((l) => `${l.dimension}: ${l.values.join(", ")}`).join(" · ")
|
|
1608
1619
|
] }),
|
|
1609
1620
|
!r.is_admin && /* @__PURE__ */ t("div", { children: [
|
|
1610
1621
|
/* @__PURE__ */ t("p", { className: "mb-1 text-[11px] font-semibold uppercase tracking-wide text-slate-400", children: [
|
|
@@ -1612,44 +1623,44 @@ function vt() {
|
|
|
1612
1623
|
r.collections.length,
|
|
1613
1624
|
")"
|
|
1614
1625
|
] }),
|
|
1615
|
-
/* @__PURE__ */ e("div", { className: "max-h-48 overflow-y-auto", children: r.collections.map((
|
|
1626
|
+
/* @__PURE__ */ e("div", { className: "max-h-48 overflow-y-auto", children: r.collections.map((l) => /* @__PURE__ */ t(
|
|
1616
1627
|
"p",
|
|
1617
1628
|
{
|
|
1618
1629
|
className: "flex items-center gap-2 border-b border-slate-50 py-0.5 text-[12px] last:border-b-0 dark:border-border/40",
|
|
1619
1630
|
children: [
|
|
1620
|
-
/* @__PURE__ */ e("span", { className: "font-mono", children:
|
|
1621
|
-
/* @__PURE__ */ e("span", { className: "ml-auto text-[10.5px] text-slate-400", children: [...new Set(
|
|
1631
|
+
/* @__PURE__ */ e("span", { className: "font-mono", children: l.collection }),
|
|
1632
|
+
/* @__PURE__ */ e("span", { className: "ml-auto text-[10.5px] text-slate-400", children: [...new Set(l.actions)].join(" · ") })
|
|
1622
1633
|
]
|
|
1623
1634
|
},
|
|
1624
|
-
|
|
1635
|
+
l.collection
|
|
1625
1636
|
)) })
|
|
1626
1637
|
] })
|
|
1627
1638
|
] })
|
|
1628
1639
|
] });
|
|
1629
1640
|
}
|
|
1630
|
-
function
|
|
1631
|
-
const o = F(), p = M(), { data: n } =
|
|
1641
|
+
function St() {
|
|
1642
|
+
const o = F(), p = M(), { data: n } = k({
|
|
1632
1643
|
queryKey: ["nvr-profile-prefs"],
|
|
1633
|
-
queryFn: () => o.request(T("/users/me")).then((
|
|
1644
|
+
queryFn: () => o.request(T("/users/me")).then((d) => {
|
|
1634
1645
|
var a;
|
|
1635
|
-
return ((a =
|
|
1646
|
+
return ((a = d.data) == null ? void 0 : a.preferences) ?? {};
|
|
1636
1647
|
})
|
|
1637
|
-
}), r =
|
|
1638
|
-
mutationFn: (
|
|
1639
|
-
onSuccess: (
|
|
1648
|
+
}), r = S({
|
|
1649
|
+
mutationFn: (d) => o.request(J("/users/me/preferences", d)),
|
|
1650
|
+
onSuccess: (d, a) => {
|
|
1640
1651
|
p.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }), re(Object.keys(a)), import("sonner").then(
|
|
1641
1652
|
({ toast: h }) => h.success("Saved — applied on all your open tabs and devices")
|
|
1642
1653
|
);
|
|
1643
1654
|
}
|
|
1644
|
-
}),
|
|
1655
|
+
}), l = (n == null ? void 0 : n.number_format) ?? {}, { data: i = [ae, ...ue] } = k({
|
|
1645
1656
|
queryKey: ["nvr-theme-accents"],
|
|
1646
1657
|
queryFn: () => o.request(
|
|
1647
1658
|
T("/settings")
|
|
1648
|
-
).then((
|
|
1659
|
+
).then((d) => {
|
|
1649
1660
|
var a, h;
|
|
1650
1661
|
return [
|
|
1651
|
-
{ ...ae, color: ((a =
|
|
1652
|
-
...
|
|
1662
|
+
{ ...ae, color: ((a = d.data) == null ? void 0 : a.project_color) ?? null },
|
|
1663
|
+
...Re((h = d.data) == null ? void 0 : h.theme_accents)
|
|
1653
1664
|
];
|
|
1654
1665
|
}).catch(() => [ae, ...ue]),
|
|
1655
1666
|
staleTime: 5 * 6e4
|
|
@@ -1668,10 +1679,10 @@ function kt() {
|
|
|
1668
1679
|
/* @__PURE__ */ t("label", { className: "flex items-center gap-1.5", children: [
|
|
1669
1680
|
"Timestamps",
|
|
1670
1681
|
/* @__PURE__ */ e(
|
|
1671
|
-
|
|
1682
|
+
z,
|
|
1672
1683
|
{
|
|
1673
1684
|
value: String((n == null ? void 0 : n.time_display) ?? "relative"),
|
|
1674
|
-
onChange: (
|
|
1685
|
+
onChange: (d) => r.mutate({ time_display: d }),
|
|
1675
1686
|
options: [
|
|
1676
1687
|
{ value: "relative", label: "Relative (3h ago)" },
|
|
1677
1688
|
{ value: "exact", label: "Exact (Aug 24, 3:12 PM)" }
|
|
@@ -1686,8 +1697,8 @@ function kt() {
|
|
|
1686
1697
|
id: "pref-compact-numbers",
|
|
1687
1698
|
type: "checkbox",
|
|
1688
1699
|
"aria-label": "Compact numbers (1.2M)",
|
|
1689
|
-
checked:
|
|
1690
|
-
onChange: (
|
|
1700
|
+
checked: l.compact === !0,
|
|
1701
|
+
onChange: (d) => r.mutate({ number_format: { ...l, compact: d.target.checked } }),
|
|
1691
1702
|
className: "rounded"
|
|
1692
1703
|
}
|
|
1693
1704
|
),
|
|
@@ -1698,8 +1709,8 @@ function kt() {
|
|
|
1698
1709
|
/* @__PURE__ */ e(
|
|
1699
1710
|
"input",
|
|
1700
1711
|
{
|
|
1701
|
-
defaultValue:
|
|
1702
|
-
onBlur: (
|
|
1712
|
+
defaultValue: l.locale ?? "",
|
|
1713
|
+
onBlur: (d) => r.mutate({ number_format: { ...l, locale: d.target.value.trim() || void 0 } }),
|
|
1703
1714
|
placeholder: "en-US",
|
|
1704
1715
|
className: "h-7 w-20 rounded-md border border-slate-200 bg-background px-1.5 text-[12px] dark:border-border"
|
|
1705
1716
|
}
|
|
@@ -1708,10 +1719,10 @@ function kt() {
|
|
|
1708
1719
|
/* @__PURE__ */ t("label", { className: "flex items-center gap-1.5", children: [
|
|
1709
1720
|
"Week starts",
|
|
1710
1721
|
/* @__PURE__ */ e(
|
|
1711
|
-
|
|
1722
|
+
z,
|
|
1712
1723
|
{
|
|
1713
1724
|
value: String((n == null ? void 0 : n.week_start) ?? "sun"),
|
|
1714
|
-
onChange: (
|
|
1725
|
+
onChange: (d) => r.mutate({ week_start: d }),
|
|
1715
1726
|
options: [
|
|
1716
1727
|
{ value: "sun", label: "Sunday" },
|
|
1717
1728
|
{ value: "mon", label: "Monday" }
|
|
@@ -1721,34 +1732,34 @@ function kt() {
|
|
|
1721
1732
|
] }),
|
|
1722
1733
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", "data-theme-accent-picker": !0, children: [
|
|
1723
1734
|
"Accent",
|
|
1724
|
-
/* @__PURE__ */ e("span", { className: "flex items-center gap-1", children: i.map((
|
|
1725
|
-
const a =
|
|
1735
|
+
/* @__PURE__ */ e("span", { className: "flex items-center gap-1", children: i.map((d) => {
|
|
1736
|
+
const a = d.key === "brand" && c === "brand" || d.key === c;
|
|
1726
1737
|
return /* @__PURE__ */ e(
|
|
1727
1738
|
"button",
|
|
1728
1739
|
{
|
|
1729
1740
|
type: "button",
|
|
1730
|
-
title:
|
|
1731
|
-
"aria-label": `Accent ${
|
|
1741
|
+
title: d.label,
|
|
1742
|
+
"aria-label": `Accent ${d.label}`,
|
|
1732
1743
|
"aria-pressed": a,
|
|
1733
|
-
"data-theme-accent":
|
|
1734
|
-
onClick: () => r.mutate({ theme_accent:
|
|
1735
|
-
className:
|
|
1744
|
+
"data-theme-accent": d.key,
|
|
1745
|
+
onClick: () => r.mutate({ theme_accent: d.key === "brand" ? null : d.key }),
|
|
1746
|
+
className: $(
|
|
1736
1747
|
"h-5 w-5 rounded-full border-2 transition-transform",
|
|
1737
1748
|
a ? "scale-110 border-slate-800 dark:border-slate-100" : "border-transparent hover:scale-105"
|
|
1738
1749
|
),
|
|
1739
|
-
style: { background:
|
|
1750
|
+
style: { background: d.color ?? "var(--nvr-cyan)" }
|
|
1740
1751
|
},
|
|
1741
|
-
|
|
1752
|
+
d.key
|
|
1742
1753
|
);
|
|
1743
1754
|
}) })
|
|
1744
1755
|
] }),
|
|
1745
1756
|
/* @__PURE__ */ t("label", { className: "flex items-center gap-1.5", children: [
|
|
1746
1757
|
"Text size",
|
|
1747
1758
|
/* @__PURE__ */ e(
|
|
1748
|
-
|
|
1759
|
+
z,
|
|
1749
1760
|
{
|
|
1750
1761
|
value: String((n == null ? void 0 : n.font_size) ?? "default"),
|
|
1751
|
-
onChange: (
|
|
1762
|
+
onChange: (d) => r.mutate({ font_size: d }),
|
|
1752
1763
|
options: [
|
|
1753
1764
|
{ value: "small", label: "Small" },
|
|
1754
1765
|
{ value: "default", label: "Default" },
|
|
@@ -1763,11 +1774,11 @@ function kt() {
|
|
|
1763
1774
|
);
|
|
1764
1775
|
}
|
|
1765
1776
|
export {
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1777
|
+
Ge as DelegationCard,
|
|
1778
|
+
St as DisplayPrefsCard,
|
|
1779
|
+
mt as LinkAppCard,
|
|
1780
|
+
ct as NotificationRulesCard,
|
|
1781
|
+
dt as ProfileFieldsCard,
|
|
1782
|
+
ta as ProfileView,
|
|
1783
|
+
ut as TimezoneCard
|
|
1773
1784
|
};
|