@nivaro/react 0.2.54 → 0.2.55
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 +99 -98
- package/dist/index.d.ts +339 -2
- package/dist/index.js +644 -618
- package/dist/layout-editor.d.ts +4 -0
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/ItemEditForm.js +4066 -3832
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +599 -552
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +76 -73
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +292 -279
- package/dist/shared/components/item-edit/GroupSection.js +698 -574
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +39 -32
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
- package/dist/shared/components/layout-editor/AddPanel.js +134 -117
- package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
- package/dist/shared/components/layout-editor/CollabParts.js +80 -75
- package/dist/shared/components/layout-editor/DesignNode.js +126 -120
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
- package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
- package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
- package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
- package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
- package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
- package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
- package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
- package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
- package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +81 -77
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
- package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
- package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +101 -52
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-ops.js +84 -82
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { jsxs as t, jsx as e, Fragment as
|
|
2
|
-
import { readUser as
|
|
3
|
-
import { useQueryClient as
|
|
4
|
-
import { Loader2 as ue, Camera as Ne, Building2 as we, Mail as Se, Phone as _e, Clock as qe, Undo2 as Ce, Check as
|
|
5
|
-
import { useState as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as
|
|
1
|
+
import { jsxs as t, jsx as e, Fragment as oe } from "react/jsx-runtime";
|
|
2
|
+
import { readUser as fe, readUserCard as ye, updateUser as me, readMyScopes as ve, saveMyScopeDefaults as ke, readItems as ne } from "@nivaro/sdk";
|
|
3
|
+
import { useQueryClient as E, useQuery as q, useMutation as _ } from "@tanstack/react-query";
|
|
4
|
+
import { Loader2 as ue, Camera as Ne, Building2 as we, Mail as Se, Phone as _e, Clock as qe, Undo2 as Ce, Check as Pe, UserRound as Ae, Filter as Te, LogOut as Fe, ShieldCheck as Oe } from "lucide-react";
|
|
5
|
+
import { useState as C, useMemo as Le, useRef as De } from "react";
|
|
6
|
+
import { useNivaroClient as T, useItemEditAuth as xe } from "../context.js";
|
|
7
|
+
import { get as F, patch as V, post as ae, put as Me, del as Ee } from "../lib/commands.js";
|
|
8
8
|
import { playNotificationSound as pe } from "../lib/notification-sound.js";
|
|
9
|
-
import { BRAND_ACCENT as
|
|
10
|
-
import { announceLocalPrefs as
|
|
11
|
-
import { cn as
|
|
9
|
+
import { BRAND_ACCENT as se, parseThemeAccents as Ke, DEFAULT_THEME_ACCENTS as he } from "../lib/theme-accents.js";
|
|
10
|
+
import { announceLocalPrefs as le } from "../lib/user-sync.js";
|
|
11
|
+
import { cn as $, setDisplayTimezone as Ie } from "../lib/utils.js";
|
|
12
12
|
import { CustomStatusEditor as je, activeCustomStatus as Qe } from "./CustomStatusEditor.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
13
|
+
import { AgentsPanel as Re } from "./profile/AgentsPanel.js";
|
|
14
|
+
import { AiMemoryCard as $e, AiHistoryCard as Ue } from "./profile/AiMemoryCard.js";
|
|
15
|
+
import { BrowserPushCard as ze } from "./profile/BrowserPushCard.js";
|
|
16
|
+
import { DelegationCard as Be } from "./profile/DelegationCard.js";
|
|
17
|
+
import { MailSuppressedPill as He } from "./profile/MailSuppressedPill.js";
|
|
18
|
+
import { TeamLoadCard as Ye } from "./profile/PersonExtras.js";
|
|
19
|
+
import { NotificationSourcesCard as We } from "./NotificationSourcesCard.js";
|
|
20
|
+
import { UserScopesCard as Ge } from "./profile/PersonAccess.js";
|
|
21
|
+
import { PersonProfile as Je } from "./profile/PersonProfile.js";
|
|
22
|
+
import { SectionCard as ie, Field as Y, ConfirmButton as be } from "./profile/primitives.js";
|
|
23
|
+
import { SimpleSelectXs as M } from "./ui/SimpleSelect.js";
|
|
24
|
+
const Ve = (i) => [i.first_name, i.last_name].filter(Boolean).join(" ") || (i.email ?? "Unknown"), Ze = (i) => {
|
|
24
25
|
var u, a;
|
|
25
|
-
return (`${((u =
|
|
26
|
-
},
|
|
26
|
+
return (`${((u = i.first_name) == null ? void 0 : u[0]) ?? ""}${((a = i.last_name) == null ? void 0 : a[0]) ?? ""}` || (i.email ?? "?").slice(0, 2)).toUpperCase();
|
|
27
|
+
}, te = [
|
|
27
28
|
{
|
|
28
29
|
key: "mentions",
|
|
29
30
|
label: "Mentions",
|
|
@@ -75,18 +76,18 @@ const Je = (l) => [l.first_name, l.last_name].filter(Boolean).join(" ") || (l.em
|
|
|
75
76
|
help: "Any notification that does not fit a category above — direct messages from other users, access requests, task assignments."
|
|
76
77
|
}
|
|
77
78
|
];
|
|
78
|
-
function
|
|
79
|
-
const
|
|
79
|
+
function Xe() {
|
|
80
|
+
const i = T(), u = E(), { data: a = [] } = q({
|
|
80
81
|
queryKey: ["nvr-profile-fields"],
|
|
81
|
-
queryFn: () =>
|
|
82
|
-
}), [s,
|
|
83
|
-
mutationFn: (n) =>
|
|
82
|
+
queryFn: () => i.request(F("/profile-fields/mine")).then((n) => n.data ?? []).catch(() => [])
|
|
83
|
+
}), [s, l] = C(null), o = _({
|
|
84
|
+
mutationFn: (n) => i.request(Me("/profile-fields/mine", { values: n })),
|
|
84
85
|
onSuccess: () => {
|
|
85
|
-
|
|
86
|
+
l(null), u.invalidateQueries({ queryKey: ["nvr-profile-fields"] });
|
|
86
87
|
}
|
|
87
88
|
});
|
|
88
89
|
if (a.length === 0) return null;
|
|
89
|
-
const
|
|
90
|
+
const c = s ?? Object.fromEntries(a.map((n) => [n.key, n.value ?? ""])), m = (n) => Array.isArray(n) ? n.map(String) : Array.isArray(n == null ? void 0 : n.choices) ? n.choices.map(
|
|
90
91
|
(b) => typeof b == "object" && b != null ? String(b.value ?? "") : String(b)
|
|
91
92
|
) : [];
|
|
92
93
|
return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
@@ -100,31 +101,31 @@ function Ze() {
|
|
|
100
101
|
n.required && /* @__PURE__ */ e("span", { className: "ml-0.5 text-red-500", children: "*" })
|
|
101
102
|
] }),
|
|
102
103
|
n.type === "boolean" ? /* @__PURE__ */ e(
|
|
103
|
-
|
|
104
|
+
M,
|
|
104
105
|
{
|
|
105
|
-
value:
|
|
106
|
+
value: c[n.key] || "false",
|
|
106
107
|
options: [
|
|
107
108
|
{ value: "true", label: "Yes" },
|
|
108
109
|
{ value: "false", label: "No" }
|
|
109
110
|
],
|
|
110
|
-
onChange: (b) =>
|
|
111
|
+
onChange: (b) => l({ ...c, [n.key]: b })
|
|
111
112
|
}
|
|
112
113
|
) : n.type === "select" ? /* @__PURE__ */ e(
|
|
113
|
-
|
|
114
|
+
M,
|
|
114
115
|
{
|
|
115
|
-
value:
|
|
116
|
+
value: c[n.key] || "",
|
|
116
117
|
options: [
|
|
117
118
|
{ value: "", label: "—" },
|
|
118
|
-
...
|
|
119
|
+
...m(n.options).map((b) => ({ value: b, label: b }))
|
|
119
120
|
],
|
|
120
|
-
onChange: (b) =>
|
|
121
|
+
onChange: (b) => l({ ...c, [n.key]: b })
|
|
121
122
|
}
|
|
122
123
|
) : /* @__PURE__ */ e(
|
|
123
124
|
"input",
|
|
124
125
|
{
|
|
125
126
|
type: n.type === "number" ? "number" : n.type === "date" ? "date" : "text",
|
|
126
|
-
value:
|
|
127
|
-
onChange: (b) =>
|
|
127
|
+
value: c[n.key] ?? "",
|
|
128
|
+
onChange: (b) => l({ ...c, [n.key]: b.target.value }),
|
|
128
129
|
className: "h-8 w-full rounded-md border border-slate-200 bg-background px-2 text-[12.5px] dark:border-border"
|
|
129
130
|
}
|
|
130
131
|
)
|
|
@@ -134,7 +135,7 @@ function Ze() {
|
|
|
134
135
|
"button",
|
|
135
136
|
{
|
|
136
137
|
type: "button",
|
|
137
|
-
onClick: () =>
|
|
138
|
+
onClick: () => l(null),
|
|
138
139
|
className: "h-7 rounded-md px-2.5 text-[12px] text-slate-500",
|
|
139
140
|
children: "Cancel"
|
|
140
141
|
}
|
|
@@ -143,77 +144,77 @@ function Ze() {
|
|
|
143
144
|
"button",
|
|
144
145
|
{
|
|
145
146
|
type: "button",
|
|
146
|
-
disabled:
|
|
147
|
-
onClick: () =>
|
|
147
|
+
disabled: o.isPending,
|
|
148
|
+
onClick: () => o.mutate(c),
|
|
148
149
|
className: "h-7 rounded-md bg-nvr-cyan px-3 text-[12px] font-semibold text-white disabled:opacity-50",
|
|
149
|
-
children:
|
|
150
|
+
children: o.isPending ? "Saving…" : "Save"
|
|
150
151
|
}
|
|
151
152
|
)
|
|
152
153
|
] })
|
|
153
154
|
] });
|
|
154
155
|
}
|
|
155
|
-
function
|
|
156
|
-
const
|
|
156
|
+
function et() {
|
|
157
|
+
const i = T(), u = E(), { data: a } = q({
|
|
157
158
|
queryKey: ["nvr-profile-prefs"],
|
|
158
|
-
queryFn: () =>
|
|
159
|
+
queryFn: () => i.request(F("/users/me")).then((r) => {
|
|
159
160
|
var h;
|
|
160
161
|
return ((h = r.data) == null ? void 0 : h.preferences) ?? {};
|
|
161
162
|
})
|
|
162
|
-
}), s = (a == null ? void 0 : a.notification_prefs) ?? {},
|
|
163
|
+
}), s = (a == null ? void 0 : a.notification_prefs) ?? {}, l = (a == null ? void 0 : a.email_digest) === "daily" ? "daily" : "instant", o = (r) => {
|
|
163
164
|
var h, x;
|
|
164
|
-
return ((x = (h = s.matrix) == null ? void 0 : h[r]) == null ? void 0 : x.email) ??
|
|
165
|
-
}, [
|
|
166
|
-
mutationFn: (r) =>
|
|
165
|
+
return ((x = (h = s.matrix) == null ? void 0 : h[r]) == null ? void 0 : x.email) ?? l;
|
|
166
|
+
}, [c, m] = C(null), [n, b] = C(null), p = c ?? s.quiet_start ?? "", w = n ?? s.quiet_end ?? "", k = _({
|
|
167
|
+
mutationFn: (r) => i.request(V("/users/me/preferences", { notification_prefs: r })),
|
|
167
168
|
onSuccess: () => {
|
|
168
|
-
u.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }),
|
|
169
|
+
u.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }), le(["notification_prefs"]);
|
|
169
170
|
}
|
|
170
|
-
}),
|
|
171
|
-
mutationFn: (r) =>
|
|
171
|
+
}), P = _({
|
|
172
|
+
mutationFn: (r) => i.request(V("/users/me/preferences", r)),
|
|
172
173
|
onSuccess: (r, h) => {
|
|
173
|
-
u.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }),
|
|
174
|
+
u.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }), le(Object.keys(h));
|
|
174
175
|
}
|
|
175
|
-
}), [
|
|
176
|
-
mutationFn: (r) =>
|
|
177
|
-
onSuccess: (r) =>
|
|
176
|
+
}), [v, O] = C(null), L = _({
|
|
177
|
+
mutationFn: (r) => i.request(ae("/notifications/rules-preview", { notification_prefs: r })),
|
|
178
|
+
onSuccess: (r) => O({
|
|
178
179
|
total: r.data.total_notifications,
|
|
179
180
|
current: r.data.current,
|
|
180
181
|
proposed: r.data.proposed
|
|
181
182
|
})
|
|
182
|
-
}),
|
|
183
|
+
}), S = (r) => {
|
|
183
184
|
const h = {
|
|
184
|
-
quiet_start: r.quiet_start ?? (
|
|
185
|
-
quiet_end: r.quiet_end ?? (
|
|
185
|
+
quiet_start: r.quiet_start ?? (p || void 0),
|
|
186
|
+
quiet_end: r.quiet_end ?? (w || void 0),
|
|
186
187
|
matrix: r.matrix ?? s.matrix ?? {},
|
|
187
188
|
escalation: r.escalation ?? s.escalation ?? {}
|
|
188
189
|
};
|
|
189
|
-
|
|
190
|
-
}, y = (a == null ? void 0 : a.notification_sounds) ?? {},
|
|
190
|
+
L.mutate(h), k.mutate(h);
|
|
191
|
+
}, y = (a == null ? void 0 : a.notification_sounds) ?? {}, z = (r, h) => {
|
|
191
192
|
const x = { ...y };
|
|
192
|
-
h === "default" ? delete x[r] : x[r] = h, h !== "default" && pe(h, { preview: !0 }),
|
|
193
|
-
}, { data:
|
|
193
|
+
h === "default" ? delete x[r] : x[r] = h, h !== "default" && pe(h, { preview: !0 }), P.mutate({ notification_sounds: Object.keys(x).length ? x : null });
|
|
194
|
+
}, { data: I } = q({
|
|
194
195
|
queryKey: ["nvr-noise-suggestions"],
|
|
195
|
-
queryFn: () =>
|
|
196
|
+
queryFn: () => i.request(F("/notifications/noise-suggestions")).then((r) => r.data ?? []),
|
|
196
197
|
staleTime: 6e5
|
|
197
|
-
}), [
|
|
198
|
+
}), [f, K] = C({}), [j, U] = C(() => {
|
|
198
199
|
try {
|
|
199
200
|
const r = JSON.parse(localStorage.getItem("nvr-noise-dismissed") ?? "null");
|
|
200
201
|
return r && Date.now() - r.at < 30 * 864e5 ? r.cats : [];
|
|
201
202
|
} catch {
|
|
202
203
|
return [];
|
|
203
204
|
}
|
|
204
|
-
}),
|
|
205
|
-
const h = [...
|
|
206
|
-
|
|
205
|
+
}), d = (r) => {
|
|
206
|
+
const h = [...j, r];
|
|
207
|
+
U(h);
|
|
207
208
|
try {
|
|
208
209
|
localStorage.setItem("nvr-noise-dismissed", JSON.stringify({ at: Date.now(), cats: h }));
|
|
209
210
|
} catch {
|
|
210
211
|
}
|
|
211
|
-
},
|
|
212
|
+
}, N = (r, h, x) => {
|
|
212
213
|
var ce;
|
|
213
214
|
const g = { ...((ce = s.escalation) == null ? void 0 : ce[r]) ?? {} };
|
|
214
215
|
x ? g[h] = x : delete g[h];
|
|
215
|
-
const
|
|
216
|
-
Object.keys(g).length ?
|
|
216
|
+
const H = { ...s.escalation ?? {} };
|
|
217
|
+
Object.keys(g).length ? H[r] = g : delete H[r], S({ escalation: H });
|
|
217
218
|
}, A = [
|
|
218
219
|
{ value: "", label: "never" },
|
|
219
220
|
{ value: "15", label: "15 min" },
|
|
@@ -221,35 +222,35 @@ function Xe() {
|
|
|
221
222
|
{ value: "240", label: "4 hours" },
|
|
222
223
|
{ value: "480", label: "8 hours" },
|
|
223
224
|
{ value: "1440", label: "1 day" }
|
|
224
|
-
],
|
|
225
|
+
], Z = (r, h) => {
|
|
225
226
|
var g;
|
|
226
227
|
const x = ((g = s.matrix) == null ? void 0 : g[r]) ?? { inapp: !0, push: !0 };
|
|
227
|
-
|
|
228
|
+
S({
|
|
228
229
|
matrix: { ...s.matrix ?? {}, [r]: { ...x, [h]: x[h] === !1 } }
|
|
229
230
|
});
|
|
230
|
-
},
|
|
231
|
+
}, D = (r, h) => {
|
|
231
232
|
var g;
|
|
232
233
|
const x = ((g = s.matrix) == null ? void 0 : g[r]) ?? { inapp: !0, push: !0 };
|
|
233
|
-
|
|
234
|
-
},
|
|
234
|
+
S({ matrix: { ...s.matrix ?? {}, [r]: { ...x, email: h } } });
|
|
235
|
+
}, W = (r) => {
|
|
235
236
|
var g;
|
|
236
237
|
const h = ((g = s.matrix) == null ? void 0 : g[r]) ?? { inapp: !0, push: !0 }, x = { ...h };
|
|
237
|
-
h.quiet_override ? delete x.quiet_override : x.quiet_override = !0,
|
|
238
|
-
},
|
|
238
|
+
h.quiet_override ? delete x.quiet_override : x.quiet_override = !0, S({ matrix: { ...s.matrix ?? {}, [r]: x } });
|
|
239
|
+
}, Q = !!(p && w), B = (r) => {
|
|
239
240
|
var x;
|
|
240
241
|
const h = {};
|
|
241
|
-
for (const g of
|
|
242
|
+
for (const g of te)
|
|
242
243
|
h[g.key] = { ...((x = s.matrix) == null ? void 0 : x[g.key]) ?? { inapp: !0, push: !0 }, email: r };
|
|
243
|
-
|
|
244
|
-
},
|
|
245
|
-
mutationFn: () =>
|
|
246
|
-
onSuccess: (r) =>
|
|
247
|
-
onError: () =>
|
|
248
|
-
}), ge =
|
|
244
|
+
S({ matrix: h }), r !== "off" && P.mutate({ email_digest: r });
|
|
245
|
+
}, X = Number.isInteger(Number(a == null ? void 0 : a.digest_hour)) ? Number(a == null ? void 0 : a.digest_hour) : 7, ee = (r) => `${r % 12 === 0 ? 12 : r % 12}:45 ${r < 12 ? "AM" : "PM"}`, [G, J] = C(null), re = _({
|
|
246
|
+
mutationFn: () => i.request(ae("/users/me/digest-test", {})),
|
|
247
|
+
onSuccess: (r) => J(r.data.note),
|
|
248
|
+
onError: () => J("Test send failed — try again.")
|
|
249
|
+
}), ge = te.some((r) => o(r.key) === "daily"), de = [
|
|
249
250
|
{ value: "instant", label: "Individual email" },
|
|
250
251
|
{ value: "daily", label: "Daily summary" },
|
|
251
252
|
{ value: "off", label: "No email" }
|
|
252
|
-
],
|
|
253
|
+
], R = ({ text: r }) => /* @__PURE__ */ e(
|
|
253
254
|
"span",
|
|
254
255
|
{
|
|
255
256
|
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",
|
|
@@ -271,7 +272,7 @@ function Xe() {
|
|
|
271
272
|
/* @__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." })
|
|
272
273
|
] }),
|
|
273
274
|
/* @__PURE__ */ t("div", { className: "space-y-3 p-4", children: [
|
|
274
|
-
(
|
|
275
|
+
(I ?? []).filter((r) => !j.includes(r.category)).map((r) => /* @__PURE__ */ t(
|
|
275
276
|
"div",
|
|
276
277
|
{
|
|
277
278
|
"data-noise-suggestion": r.category,
|
|
@@ -281,22 +282,22 @@ function Xe() {
|
|
|
281
282
|
r.message,
|
|
282
283
|
" Mute them?"
|
|
283
284
|
] }),
|
|
284
|
-
r.category in
|
|
285
|
+
r.category in f ? /* @__PURE__ */ e(
|
|
285
286
|
"button",
|
|
286
287
|
{
|
|
287
288
|
type: "button",
|
|
288
289
|
className: "underline",
|
|
289
290
|
onClick: () => {
|
|
290
|
-
|
|
291
|
+
S({
|
|
291
292
|
matrix: {
|
|
292
293
|
...s.matrix ?? {},
|
|
293
|
-
[r.category]:
|
|
294
|
+
[r.category]: f[r.category]
|
|
294
295
|
}
|
|
295
|
-
}),
|
|
296
|
+
}), K(({ [r.category]: h, ...x }) => x);
|
|
296
297
|
},
|
|
297
298
|
children: "Muted — undo"
|
|
298
299
|
}
|
|
299
|
-
) : /* @__PURE__ */ t(
|
|
300
|
+
) : /* @__PURE__ */ t(oe, { children: [
|
|
300
301
|
/* @__PURE__ */ e(
|
|
301
302
|
"button",
|
|
302
303
|
{
|
|
@@ -305,7 +306,7 @@ function Xe() {
|
|
|
305
306
|
onClick: () => {
|
|
306
307
|
var x;
|
|
307
308
|
const h = ((x = s.matrix) == null ? void 0 : x[r.category]) ?? { inapp: !0, push: !0 };
|
|
308
|
-
|
|
309
|
+
K((g) => ({ ...g, [r.category]: h })), S({
|
|
309
310
|
matrix: {
|
|
310
311
|
...s.matrix ?? {},
|
|
311
312
|
[r.category]: { ...h, inapp: !1, push: !1 }
|
|
@@ -315,13 +316,13 @@ function Xe() {
|
|
|
315
316
|
children: "Mute"
|
|
316
317
|
}
|
|
317
318
|
),
|
|
318
|
-
/* @__PURE__ */ e("button", { type: "button", className: "underline", onClick: () =>
|
|
319
|
+
/* @__PURE__ */ e("button", { type: "button", className: "underline", onClick: () => d(r.category), children: "Not now" })
|
|
319
320
|
] })
|
|
320
321
|
]
|
|
321
322
|
},
|
|
322
323
|
r.category
|
|
323
324
|
)),
|
|
324
|
-
|
|
325
|
+
v && v.total > 0 && /* @__PURE__ */ t(
|
|
325
326
|
"div",
|
|
326
327
|
{
|
|
327
328
|
"data-rules-preview": !0,
|
|
@@ -329,23 +330,23 @@ function Xe() {
|
|
|
329
330
|
children: [
|
|
330
331
|
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1", children: [
|
|
331
332
|
"Last week with this change: ",
|
|
332
|
-
|
|
333
|
+
v.proposed.inapp,
|
|
333
334
|
" in-app instead of",
|
|
334
335
|
" ",
|
|
335
|
-
|
|
336
|
+
v.current.inapp,
|
|
336
337
|
", ",
|
|
337
|
-
|
|
338
|
+
v.proposed.email_sent,
|
|
338
339
|
" emails instead of",
|
|
339
340
|
" ",
|
|
340
|
-
|
|
341
|
+
v.current.email_sent,
|
|
341
342
|
", ",
|
|
342
|
-
|
|
343
|
+
v.proposed.push,
|
|
343
344
|
" pushes instead of",
|
|
344
345
|
" ",
|
|
345
|
-
|
|
346
|
+
v.current.push,
|
|
346
347
|
"."
|
|
347
348
|
] }),
|
|
348
|
-
/* @__PURE__ */ e("button", { type: "button", className: "underline", onClick: () =>
|
|
349
|
+
/* @__PURE__ */ e("button", { type: "button", className: "underline", onClick: () => O(null), children: "Dismiss" })
|
|
349
350
|
]
|
|
350
351
|
}
|
|
351
352
|
),
|
|
@@ -355,9 +356,9 @@ function Xe() {
|
|
|
355
356
|
"input",
|
|
356
357
|
{
|
|
357
358
|
type: "time",
|
|
358
|
-
value:
|
|
359
|
-
onChange: (r) =>
|
|
360
|
-
onBlur: () =>
|
|
359
|
+
value: p,
|
|
360
|
+
onChange: (r) => m(r.target.value),
|
|
361
|
+
onBlur: () => S({ quiet_start: p || void 0 }),
|
|
361
362
|
className: "h-7 rounded-md border border-slate-200 bg-background px-1.5 text-[12px] dark:border-border"
|
|
362
363
|
}
|
|
363
364
|
),
|
|
@@ -366,18 +367,18 @@ function Xe() {
|
|
|
366
367
|
"input",
|
|
367
368
|
{
|
|
368
369
|
type: "time",
|
|
369
|
-
value:
|
|
370
|
+
value: w,
|
|
370
371
|
onChange: (r) => b(r.target.value),
|
|
371
|
-
onBlur: () =>
|
|
372
|
+
onBlur: () => S({ quiet_end: w || void 0 }),
|
|
372
373
|
className: "h-7 rounded-md border border-slate-200 bg-background px-1.5 text-[12px] dark:border-border"
|
|
373
374
|
}
|
|
374
375
|
),
|
|
375
|
-
(
|
|
376
|
+
(p || w) && /* @__PURE__ */ e(
|
|
376
377
|
"button",
|
|
377
378
|
{
|
|
378
379
|
type: "button",
|
|
379
380
|
onClick: () => {
|
|
380
|
-
|
|
381
|
+
m(""), b(""), k.mutate({ matrix: s.matrix ?? {} });
|
|
381
382
|
},
|
|
382
383
|
className: "text-[11.5px] text-slate-400 underline decoration-dotted underline-offset-2",
|
|
383
384
|
children: "Clear"
|
|
@@ -387,7 +388,7 @@ function Xe() {
|
|
|
387
388
|
/* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-2 text-[12.5px] text-slate-600 dark:text-muted-foreground", children: [
|
|
388
389
|
"Sound:",
|
|
389
390
|
/* @__PURE__ */ e(
|
|
390
|
-
|
|
391
|
+
M,
|
|
391
392
|
{
|
|
392
393
|
value: String((a == null ? void 0 : a.notification_sound) ?? "off"),
|
|
393
394
|
options: [
|
|
@@ -396,7 +397,7 @@ function Xe() {
|
|
|
396
397
|
{ value: "chime", label: "Chime" }
|
|
397
398
|
],
|
|
398
399
|
onChange: (r) => {
|
|
399
|
-
pe(r, { preview: !0 }),
|
|
400
|
+
pe(r, { preview: !0 }), P.mutate({ notification_sound: r });
|
|
400
401
|
}
|
|
401
402
|
}
|
|
402
403
|
),
|
|
@@ -407,54 +408,54 @@ function Xe() {
|
|
|
407
408
|
/* @__PURE__ */ e("th", { className: "py-1 font-semibold", children: "Category" }),
|
|
408
409
|
/* @__PURE__ */ t("th", { className: "py-1 text-center font-semibold", children: [
|
|
409
410
|
"In-app",
|
|
410
|
-
/* @__PURE__ */ e(
|
|
411
|
+
/* @__PURE__ */ e(R, { text: "The notification itself: the bell badge and your Notifications inbox in the app. Off = no row is written for this category, so nothing shows anywhere in the app." })
|
|
411
412
|
] }),
|
|
412
413
|
/* @__PURE__ */ t("th", { className: "py-1 text-center font-semibold", children: [
|
|
413
414
|
"Push",
|
|
414
|
-
/* @__PURE__ */ e(
|
|
415
|
+
/* @__PURE__ */ e(R, { text: "A browser / device alert (the popup you get even with the tab closed) on devices where you allowed notifications. Off keeps the in-app row but stops the device alert. Quiet hours pause pushes too." })
|
|
415
416
|
] }),
|
|
416
417
|
/* @__PURE__ */ t("th", { className: "py-1 text-center font-semibold", children: [
|
|
417
418
|
"Email",
|
|
418
|
-
/* @__PURE__ */ e(
|
|
419
|
+
/* @__PURE__ */ e(R, { text: "Individual email = one message as each event happens. Daily summary = held and delivered once a day in your action summary (deliver-at time below). No email = never emailed for this category (in-app and push are unaffected)." })
|
|
419
420
|
] }),
|
|
420
421
|
/* @__PURE__ */ t("th", { className: "py-1 text-center font-semibold", children: [
|
|
421
422
|
"Sound",
|
|
422
|
-
/* @__PURE__ */ e(
|
|
423
|
+
/* @__PURE__ */ e(R, { text: "A different sound for this category, or none. Default follows the Sound setting above." })
|
|
423
424
|
] }),
|
|
424
425
|
/* @__PURE__ */ t("th", { className: "py-1 text-center font-semibold", children: [
|
|
425
426
|
"Quiet hours",
|
|
426
|
-
/* @__PURE__ */ e(
|
|
427
|
+
/* @__PURE__ */ e(R, { text: "Ticked = this category still pushes and emails during your quiet hours (the in-app row always lands either way). Leave it off to have quiet hours hold this category until morning. Critical alerts always get through." })
|
|
427
428
|
] })
|
|
428
429
|
] }) }),
|
|
429
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
430
|
+
/* @__PURE__ */ e("tbody", { children: te.map((r) => {
|
|
430
431
|
var x;
|
|
431
432
|
const h = ((x = s.matrix) == null ? void 0 : x[r.key]) ?? {};
|
|
432
433
|
return /* @__PURE__ */ t("tr", { className: "border-t border-slate-100 dark:border-border", children: [
|
|
433
434
|
/* @__PURE__ */ t("td", { className: "py-1.5 text-slate-700 dark:text-foreground", children: [
|
|
434
435
|
r.label,
|
|
435
|
-
/* @__PURE__ */ e(
|
|
436
|
+
/* @__PURE__ */ e(R, { text: r.help })
|
|
436
437
|
] }),
|
|
437
438
|
["inapp", "push"].map((g) => /* @__PURE__ */ e("td", { className: "py-1.5 text-center", children: /* @__PURE__ */ e(
|
|
438
439
|
"input",
|
|
439
440
|
{
|
|
440
441
|
type: "checkbox",
|
|
441
442
|
checked: h[g] !== !1,
|
|
442
|
-
onChange: () =>
|
|
443
|
-
disabled:
|
|
443
|
+
onChange: () => Z(r.key, g),
|
|
444
|
+
disabled: k.isPending,
|
|
444
445
|
className: "h-3.5 w-3.5"
|
|
445
446
|
}
|
|
446
447
|
) }, g)),
|
|
447
448
|
/* @__PURE__ */ e("td", { className: "py-1 text-center", children: /* @__PURE__ */ e("div", { className: "inline-block", children: /* @__PURE__ */ e(
|
|
448
|
-
|
|
449
|
+
M,
|
|
449
450
|
{
|
|
450
451
|
ariaLabel: `Email for ${r.label}`,
|
|
451
|
-
value:
|
|
452
|
+
value: o(r.key),
|
|
452
453
|
options: de,
|
|
453
|
-
onChange: (g) =>
|
|
454
|
+
onChange: (g) => D(r.key, g)
|
|
454
455
|
}
|
|
455
456
|
) }) }),
|
|
456
457
|
/* @__PURE__ */ e("td", { className: "py-1 text-center", children: /* @__PURE__ */ e("div", { className: "inline-block", children: /* @__PURE__ */ e(
|
|
457
|
-
|
|
458
|
+
M,
|
|
458
459
|
{
|
|
459
460
|
ariaLabel: `Sound for ${r.label}`,
|
|
460
461
|
value: y[r.key] ?? "default",
|
|
@@ -464,7 +465,7 @@ function Xe() {
|
|
|
464
465
|
{ value: "subtle", label: "Subtle blip" },
|
|
465
466
|
{ value: "chime", label: "Chime" }
|
|
466
467
|
],
|
|
467
|
-
onChange: (g) =>
|
|
468
|
+
onChange: (g) => z(r.key, g)
|
|
468
469
|
}
|
|
469
470
|
) }) }),
|
|
470
471
|
/* @__PURE__ */ e("td", { className: "py-1.5 text-center", children: /* @__PURE__ */ e(
|
|
@@ -472,10 +473,10 @@ function Xe() {
|
|
|
472
473
|
{
|
|
473
474
|
type: "checkbox",
|
|
474
475
|
checked: h.quiet_override === !0,
|
|
475
|
-
onChange: () =>
|
|
476
|
-
disabled:
|
|
476
|
+
onChange: () => W(r.key),
|
|
477
|
+
disabled: k.isPending,
|
|
477
478
|
"aria-label": `Let ${r.label} through quiet hours`,
|
|
478
|
-
title:
|
|
479
|
+
title: Q ? void 0 : "Set quiet hours above for this to matter — it is remembered either way",
|
|
479
480
|
"data-quiet-override": r.key,
|
|
480
481
|
className: "h-3.5 w-3.5"
|
|
481
482
|
}
|
|
@@ -489,8 +490,8 @@ function Xe() {
|
|
|
489
490
|
"button",
|
|
490
491
|
{
|
|
491
492
|
type: "button",
|
|
492
|
-
disabled:
|
|
493
|
-
onClick: () =>
|
|
493
|
+
disabled: k.isPending,
|
|
494
|
+
onClick: () => B(r.value),
|
|
494
495
|
className: "rounded border border-slate-200 px-2 py-0.5 hover:border-slate-400 hover:text-slate-800 dark:border-border dark:hover:text-foreground",
|
|
495
496
|
children: r.label
|
|
496
497
|
},
|
|
@@ -507,25 +508,25 @@ function Xe() {
|
|
|
507
508
|
/* @__PURE__ */ e("th", { className: "py-1 font-semibold", children: "Category" }),
|
|
508
509
|
/* @__PURE__ */ t("th", { className: "py-1 font-semibold", children: [
|
|
509
510
|
"Push after",
|
|
510
|
-
/* @__PURE__ */ e(
|
|
511
|
+
/* @__PURE__ */ e(R, { text: "Still unread after this long → a browser / device push (needs a registered device; quiet hours do not apply to escalations you asked for)." })
|
|
511
512
|
] }),
|
|
512
513
|
/* @__PURE__ */ t("th", { className: "py-1 font-semibold", children: [
|
|
513
514
|
"Email after",
|
|
514
|
-
/* @__PURE__ */ e(
|
|
515
|
+
/* @__PURE__ */ e(R, { text: "Still unread after this long → one email with the notification, regardless of the Email column above (No email still means no email at delivery time; this is the fallback)." })
|
|
515
516
|
] })
|
|
516
517
|
] }) }),
|
|
517
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
518
|
+
/* @__PURE__ */ e("tbody", { children: te.map((r) => {
|
|
518
519
|
var x;
|
|
519
520
|
const h = ((x = s.escalation) == null ? void 0 : x[r.key]) ?? {};
|
|
520
521
|
return /* @__PURE__ */ t("tr", { className: "border-t border-slate-100 dark:border-border", children: [
|
|
521
522
|
/* @__PURE__ */ e("td", { className: "py-1 text-slate-700 dark:text-foreground", children: r.label }),
|
|
522
523
|
["push_after_min", "email_after_min"].map((g) => /* @__PURE__ */ e("td", { className: "py-1", children: /* @__PURE__ */ e(
|
|
523
|
-
|
|
524
|
+
M,
|
|
524
525
|
{
|
|
525
526
|
ariaLabel: `${g === "push_after_min" ? "Push" : "Email"} after for ${r.label}`,
|
|
526
527
|
value: h[g] ? String(h[g]) : "",
|
|
527
528
|
options: A,
|
|
528
|
-
onChange: (
|
|
529
|
+
onChange: (H) => N(r.key, g, H ? Number(H) : null)
|
|
529
530
|
}
|
|
530
531
|
) }, g))
|
|
531
532
|
] }, r.key);
|
|
@@ -544,14 +545,14 @@ function Xe() {
|
|
|
544
545
|
/* @__PURE__ */ t("span", { className: "flex items-center gap-1.5", children: [
|
|
545
546
|
"Deliver at",
|
|
546
547
|
/* @__PURE__ */ e(
|
|
547
|
-
|
|
548
|
+
M,
|
|
548
549
|
{
|
|
549
550
|
ariaLabel: "Digest delivery hour",
|
|
550
|
-
value: String(
|
|
551
|
-
onChange: (r) =>
|
|
551
|
+
value: String(X),
|
|
552
|
+
onChange: (r) => P.mutate({ digest_hour: Number(r) }),
|
|
552
553
|
options: Array.from({ length: 24 }, (r, h) => ({
|
|
553
554
|
value: String(h),
|
|
554
|
-
label:
|
|
555
|
+
label: ee(h)
|
|
555
556
|
}))
|
|
556
557
|
}
|
|
557
558
|
),
|
|
@@ -563,7 +564,7 @@ function Xe() {
|
|
|
563
564
|
{
|
|
564
565
|
type: "checkbox",
|
|
565
566
|
checked: (a == null ? void 0 : a.digest_layout) === "compact",
|
|
566
|
-
onChange: (r) =>
|
|
567
|
+
onChange: (r) => P.mutate({ digest_layout: r.target.checked ? "compact" : "detailed" }),
|
|
567
568
|
className: "rounded"
|
|
568
569
|
}
|
|
569
570
|
),
|
|
@@ -573,13 +574,13 @@ function Xe() {
|
|
|
573
574
|
"button",
|
|
574
575
|
{
|
|
575
576
|
type: "button",
|
|
576
|
-
disabled:
|
|
577
|
-
onClick: () =>
|
|
577
|
+
disabled: re.isPending,
|
|
578
|
+
onClick: () => re.mutate(),
|
|
578
579
|
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",
|
|
579
|
-
children:
|
|
580
|
+
children: re.isPending ? "Building…" : "Send me a test summary now"
|
|
580
581
|
}
|
|
581
582
|
),
|
|
582
|
-
|
|
583
|
+
G && /* @__PURE__ */ e("span", { className: "text-[11.5px] text-slate-400", children: G })
|
|
583
584
|
] })
|
|
584
585
|
] }),
|
|
585
586
|
/* @__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: [
|
|
@@ -596,7 +597,7 @@ function Xe() {
|
|
|
596
597
|
{
|
|
597
598
|
type: "checkbox",
|
|
598
599
|
checked: ((x = a == null ? void 0 : a.auto_watch) == null ? void 0 : x[r]) === !0,
|
|
599
|
-
onChange: (g) =>
|
|
600
|
+
onChange: (g) => P.mutate({
|
|
600
601
|
auto_watch: {
|
|
601
602
|
...(a == null ? void 0 : a.auto_watch) ?? {},
|
|
602
603
|
[r]: g.target.checked
|
|
@@ -614,15 +615,15 @@ function Xe() {
|
|
|
614
615
|
}
|
|
615
616
|
);
|
|
616
617
|
}
|
|
617
|
-
function
|
|
618
|
-
const
|
|
618
|
+
function tt() {
|
|
619
|
+
const i = T(), u = E(), { data: a } = q({
|
|
619
620
|
queryKey: ["nvr-profile-prefs"],
|
|
620
|
-
queryFn: () =>
|
|
621
|
-
var
|
|
622
|
-
return ((
|
|
621
|
+
queryFn: () => i.request(F("/users/me")).then((c) => {
|
|
622
|
+
var m;
|
|
623
|
+
return ((m = c.data) == null ? void 0 : m.preferences) ?? {};
|
|
623
624
|
})
|
|
624
|
-
}), s = (a == null ? void 0 : a.link_app) === "portal" || (a == null ? void 0 : a.link_app) === "admin" ? a.link_app : "auto",
|
|
625
|
-
mutationFn: (
|
|
625
|
+
}), s = (a == null ? void 0 : a.link_app) === "portal" || (a == null ? void 0 : a.link_app) === "admin" ? a.link_app : "auto", l = _({
|
|
626
|
+
mutationFn: (c) => i.request(V("/users/me/preferences", { link_app: c })),
|
|
626
627
|
onSuccess: () => void u.invalidateQueries({ queryKey: ["nvr-profile-prefs"] })
|
|
627
628
|
});
|
|
628
629
|
return /* @__PURE__ */ t(
|
|
@@ -637,50 +638,50 @@ function et() {
|
|
|
637
638
|
{ v: "auto", label: "Automatic", hint: "Admins open the admin, everyone else the portal" },
|
|
638
639
|
{ v: "portal", label: "Portal", hint: "Always the front-end app" },
|
|
639
640
|
{ v: "admin", label: "Admin", hint: "Always the admin console" }
|
|
640
|
-
].map((
|
|
641
|
+
].map((c) => /* @__PURE__ */ e(
|
|
641
642
|
"button",
|
|
642
643
|
{
|
|
643
644
|
type: "button",
|
|
644
|
-
title:
|
|
645
|
-
onClick: () =>
|
|
646
|
-
className: s ===
|
|
647
|
-
children:
|
|
645
|
+
title: c.hint,
|
|
646
|
+
onClick: () => l.mutate(c.v),
|
|
647
|
+
className: s === 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",
|
|
648
|
+
children: c.label
|
|
648
649
|
},
|
|
649
|
-
|
|
650
|
+
c.v
|
|
650
651
|
)) })
|
|
651
652
|
]
|
|
652
653
|
}
|
|
653
654
|
);
|
|
654
655
|
}
|
|
655
|
-
function
|
|
656
|
-
const
|
|
656
|
+
function at() {
|
|
657
|
+
const i = T(), u = E(), [a, s] = C(""), l = (() => {
|
|
657
658
|
try {
|
|
658
659
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
659
660
|
} catch {
|
|
660
661
|
return "UTC";
|
|
661
662
|
}
|
|
662
|
-
})(),
|
|
663
|
-
var
|
|
663
|
+
})(), o = (() => {
|
|
664
|
+
var p;
|
|
664
665
|
try {
|
|
665
|
-
return ((
|
|
666
|
+
return ((p = Intl.supportedValuesOf) == null ? void 0 : p.call(
|
|
666
667
|
Intl,
|
|
667
668
|
"timeZone"
|
|
668
669
|
)) ?? [];
|
|
669
670
|
} catch {
|
|
670
671
|
return [];
|
|
671
672
|
}
|
|
672
|
-
})(), { data:
|
|
673
|
+
})(), { data: c } = q({
|
|
673
674
|
queryKey: ["nvr-profile-prefs"],
|
|
674
|
-
queryFn: () =>
|
|
675
|
-
var
|
|
676
|
-
return ((
|
|
675
|
+
queryFn: () => i.request(F("/users/me")).then((p) => {
|
|
676
|
+
var w;
|
|
677
|
+
return ((w = p.data) == null ? void 0 : w.preferences) ?? {};
|
|
677
678
|
})
|
|
678
|
-
}),
|
|
679
|
-
mutationFn: (
|
|
680
|
-
onSuccess: (
|
|
681
|
-
Ie(
|
|
679
|
+
}), m = typeof (c == null ? void 0 : c.timezone) == "string" ? c.timezone : null, n = _({
|
|
680
|
+
mutationFn: (p) => i.request(V("/users/me/preferences", { timezone: p })),
|
|
681
|
+
onSuccess: (p, w) => {
|
|
682
|
+
Ie(w), s(""), u.invalidateQueries({ queryKey: ["nvr-profile-prefs"] });
|
|
682
683
|
}
|
|
683
|
-
}), b = a.length > 1 ?
|
|
684
|
+
}), b = a.length > 1 ? o.filter((p) => p.toLowerCase().includes(a.toLowerCase())).slice(0, 8) : [];
|
|
684
685
|
return /* @__PURE__ */ t(
|
|
685
686
|
"div",
|
|
686
687
|
{
|
|
@@ -691,12 +692,12 @@ function tt() {
|
|
|
691
692
|
/* @__PURE__ */ t("p", { className: "mt-0.5 text-[12px] text-slate-500 dark:text-muted-foreground", children: [
|
|
692
693
|
"Dates and times render in this zone. Your browser reports",
|
|
693
694
|
" ",
|
|
694
|
-
/* @__PURE__ */ e("span", { className: "font-medium", children:
|
|
695
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: l }),
|
|
695
696
|
"."
|
|
696
697
|
] }),
|
|
697
698
|
/* @__PURE__ */ t("div", { className: "mt-3 flex flex-wrap items-center gap-2", children: [
|
|
698
|
-
/* @__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:
|
|
699
|
-
|
|
699
|
+
/* @__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: m ?? `${l} (browser default)` }),
|
|
700
|
+
m && /* @__PURE__ */ e(
|
|
700
701
|
"button",
|
|
701
702
|
{
|
|
702
703
|
type: "button",
|
|
@@ -711,114 +712,114 @@ function tt() {
|
|
|
711
712
|
"input",
|
|
712
713
|
{
|
|
713
714
|
value: a,
|
|
714
|
-
onChange: (
|
|
715
|
+
onChange: (p) => s(p.target.value),
|
|
715
716
|
placeholder: "Change zone… (e.g. America/Denver)",
|
|
716
717
|
className: "h-8 w-[280px] rounded-md border border-slate-200 bg-background px-2.5 text-[12.5px] dark:border-border"
|
|
717
718
|
}
|
|
718
719
|
),
|
|
719
|
-
b.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: b.map((
|
|
720
|
+
b.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: b.map((p) => /* @__PURE__ */ e(
|
|
720
721
|
"button",
|
|
721
722
|
{
|
|
722
723
|
type: "button",
|
|
723
|
-
onClick: () => n.mutate(
|
|
724
|
+
onClick: () => n.mutate(p),
|
|
724
725
|
className: "block w-full px-2.5 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted dark:text-foreground",
|
|
725
|
-
children:
|
|
726
|
+
children: p
|
|
726
727
|
},
|
|
727
|
-
|
|
728
|
+
p
|
|
728
729
|
)) })
|
|
729
730
|
] })
|
|
730
731
|
]
|
|
731
732
|
}
|
|
732
733
|
);
|
|
733
734
|
}
|
|
734
|
-
function
|
|
735
|
-
const
|
|
735
|
+
function rt() {
|
|
736
|
+
const i = T(), u = E(), { data: a } = q({
|
|
736
737
|
queryKey: ["nvr-profile-scopes"],
|
|
737
|
-
queryFn: () =>
|
|
738
|
-
}), s =
|
|
739
|
-
mutationFn: ({ dimension:
|
|
738
|
+
queryFn: () => i.request(ve()).then((l) => l.data)
|
|
739
|
+
}), s = _({
|
|
740
|
+
mutationFn: ({ dimension: l, values: o }) => i.request(ke(l, o)),
|
|
740
741
|
onSuccess: () => void u.invalidateQueries({ queryKey: ["nvr-profile-scopes"] })
|
|
741
742
|
});
|
|
742
743
|
return !a || a.dimensions.length === 0 ? null : /* @__PURE__ */ e(
|
|
743
|
-
|
|
744
|
+
ie,
|
|
744
745
|
{
|
|
745
746
|
testId: "scopes",
|
|
746
747
|
icon: /* @__PURE__ */ e(Te, { className: "h-4 w-4" }),
|
|
747
748
|
title: "Default filters",
|
|
748
749
|
hint: "Pre-selected in browsers and reports — clear anytime",
|
|
749
|
-
children: /* @__PURE__ */ e("div", { className: "space-y-3", children: a.dimensions.map((
|
|
750
|
-
|
|
750
|
+
children: /* @__PURE__ */ e("div", { className: "space-y-3", children: a.dimensions.map((l) => /* @__PURE__ */ e(
|
|
751
|
+
nt,
|
|
751
752
|
{
|
|
752
|
-
dimension:
|
|
753
|
-
selected: a.defaults[
|
|
754
|
-
restricted: a.restricted[
|
|
755
|
-
onSave: (
|
|
753
|
+
dimension: l,
|
|
754
|
+
selected: a.defaults[l.name] ?? [],
|
|
755
|
+
restricted: a.restricted[l.name],
|
|
756
|
+
onSave: (o) => s.mutate({ dimension: l.name, values: o })
|
|
756
757
|
},
|
|
757
|
-
|
|
758
|
+
l.name
|
|
758
759
|
)) })
|
|
759
760
|
}
|
|
760
761
|
);
|
|
761
762
|
}
|
|
762
|
-
function
|
|
763
|
-
dimension:
|
|
763
|
+
function nt({
|
|
764
|
+
dimension: i,
|
|
764
765
|
selected: u,
|
|
765
766
|
restricted: a,
|
|
766
767
|
onSave: s
|
|
767
768
|
}) {
|
|
768
|
-
const
|
|
769
|
-
queryKey: ["nvr-scope-options",
|
|
770
|
-
queryFn: async () => ((await
|
|
771
|
-
|
|
772
|
-
fields: ["id",
|
|
773
|
-
sort:
|
|
769
|
+
const l = T(), o = i.display_field ?? "name", [c, m] = C(""), [n, b] = C(!1), { data: p = [] } = q({
|
|
770
|
+
queryKey: ["nvr-scope-options", i.name],
|
|
771
|
+
queryFn: async () => ((await l.request(
|
|
772
|
+
ne(i.target_collection, {
|
|
773
|
+
fields: ["id", o],
|
|
774
|
+
sort: i.options_sort ? [i.options_sort] : void 0,
|
|
774
775
|
limit: 200
|
|
775
776
|
})
|
|
776
|
-
)).data ?? []).map((
|
|
777
|
-
id:
|
|
778
|
-
label: String(
|
|
777
|
+
)).data ?? []).map((N) => ({
|
|
778
|
+
id: N.id,
|
|
779
|
+
label: String(N[o] ?? N.id)
|
|
779
780
|
}))
|
|
780
|
-
}),
|
|
781
|
-
queryKey: ["nvr-scope-search",
|
|
781
|
+
}), w = a != null && a.length ? new Set(a.map(String)) : null, k = w ? p.filter((d) => w.has(String(d.id))) : p, P = new Set(u.map(String)), v = k.length > 24 || p.length >= 200 && !w, { data: O = [], isFetching: L } = q({
|
|
782
|
+
queryKey: ["nvr-scope-search", i.name, c],
|
|
782
783
|
queryFn: async () => {
|
|
783
|
-
const
|
|
784
|
-
|
|
785
|
-
fields: ["id",
|
|
786
|
-
filter: { [
|
|
787
|
-
sort:
|
|
784
|
+
const N = ((await l.request(
|
|
785
|
+
ne(i.target_collection, {
|
|
786
|
+
fields: ["id", o],
|
|
787
|
+
filter: { [o]: { _contains: c } },
|
|
788
|
+
sort: i.options_sort ? [i.options_sort] : void 0,
|
|
788
789
|
limit: 30
|
|
789
790
|
})
|
|
790
791
|
)).data ?? []).map((A) => ({
|
|
791
792
|
id: A.id,
|
|
792
|
-
label: String(A[
|
|
793
|
+
label: String(A[o] ?? A.id)
|
|
793
794
|
}));
|
|
794
|
-
return
|
|
795
|
+
return w ? N.filter((A) => w.has(String(A.id))) : N;
|
|
795
796
|
},
|
|
796
|
-
enabled:
|
|
797
|
-
placeholderData: (
|
|
798
|
-
}),
|
|
799
|
-
for (const
|
|
800
|
-
const y = u.filter((
|
|
801
|
-
queryKey: ["nvr-scope-selected-labels",
|
|
802
|
-
queryFn: async () => ((await
|
|
803
|
-
|
|
804
|
-
fields: ["id",
|
|
797
|
+
enabled: v && c.trim().length > 0,
|
|
798
|
+
placeholderData: (d) => d
|
|
799
|
+
}), S = new Map(p.map((d) => [String(d.id), d.label]));
|
|
800
|
+
for (const d of O) S.set(String(d.id), d.label);
|
|
801
|
+
const y = u.filter((d) => !S.has(String(d))), { data: z = [] } = q({
|
|
802
|
+
queryKey: ["nvr-scope-selected-labels", i.name, y.map(String).sort().join(",")],
|
|
803
|
+
queryFn: async () => ((await l.request(
|
|
804
|
+
ne(i.target_collection, {
|
|
805
|
+
fields: ["id", o],
|
|
805
806
|
filter: { id: { _in: y } },
|
|
806
807
|
limit: 100
|
|
807
808
|
})
|
|
808
|
-
)).data ?? []).map((
|
|
809
|
-
id:
|
|
810
|
-
label: String(
|
|
809
|
+
)).data ?? []).map((N) => ({
|
|
810
|
+
id: N.id,
|
|
811
|
+
label: String(N[o] ?? N.id)
|
|
811
812
|
})),
|
|
812
813
|
enabled: y.length > 0
|
|
813
814
|
});
|
|
814
|
-
for (const
|
|
815
|
-
const
|
|
816
|
-
const
|
|
817
|
-
s(
|
|
818
|
-
},
|
|
815
|
+
for (const d of z) S.set(String(d.id), d.label);
|
|
816
|
+
const I = (d) => {
|
|
817
|
+
const N = P.has(String(d));
|
|
818
|
+
s(N ? u.filter((A) => String(A) !== String(d)) : [...u, d]);
|
|
819
|
+
}, f = c.trim().toLowerCase(), K = f ? k.filter((d) => d.label.toLowerCase().includes(f)) : k, j = f.length === 0 ? k.slice(0, 30) : L && O.length === 0 ? K.slice(0, 30) : O, U = v && (n || f.length > 0);
|
|
819
820
|
return /* @__PURE__ */ t("div", { children: [
|
|
820
821
|
/* @__PURE__ */ t("p", { className: "mb-1 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: [
|
|
821
|
-
|
|
822
|
+
i.label,
|
|
822
823
|
a != null && a.length ? /* @__PURE__ */ e("span", { className: "ml-1.5 normal-case tracking-normal text-amber-500", children: "(limited by your access)" }) : null,
|
|
823
824
|
u.length > 0 && /* @__PURE__ */ t(
|
|
824
825
|
"button",
|
|
@@ -833,131 +834,131 @@ function rt({
|
|
|
833
834
|
}
|
|
834
835
|
)
|
|
835
836
|
] }),
|
|
836
|
-
|
|
837
|
-
u.length > 0 && /* @__PURE__ */ e("div", { className: "mb-1.5 flex flex-wrap gap-1", children: u.map((
|
|
837
|
+
v ? /* @__PURE__ */ t("div", { className: "max-w-xl", children: [
|
|
838
|
+
u.length > 0 && /* @__PURE__ */ e("div", { className: "mb-1.5 flex flex-wrap gap-1", children: u.map((d) => /* @__PURE__ */ t(
|
|
838
839
|
"span",
|
|
839
840
|
{
|
|
840
841
|
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",
|
|
841
842
|
children: [
|
|
842
|
-
|
|
843
|
+
S.get(String(d)) ?? String(d),
|
|
843
844
|
/* @__PURE__ */ e(
|
|
844
845
|
"button",
|
|
845
846
|
{
|
|
846
847
|
type: "button",
|
|
847
|
-
onClick: () =>
|
|
848
|
-
"aria-label": `Remove ${
|
|
848
|
+
onClick: () => I(d),
|
|
849
|
+
"aria-label": `Remove ${S.get(String(d)) ?? d}`,
|
|
849
850
|
className: "rounded-full px-1 text-slate-400 hover:text-slate-600 dark:hover:text-slate-200",
|
|
850
851
|
children: "×"
|
|
851
852
|
}
|
|
852
853
|
)
|
|
853
854
|
]
|
|
854
855
|
},
|
|
855
|
-
String(
|
|
856
|
+
String(d)
|
|
856
857
|
)) }),
|
|
857
858
|
/* @__PURE__ */ e(
|
|
858
859
|
"input",
|
|
859
860
|
{
|
|
860
|
-
value:
|
|
861
|
-
onChange: (
|
|
861
|
+
value: c,
|
|
862
|
+
onChange: (d) => m(d.target.value),
|
|
862
863
|
onFocus: () => b(!0),
|
|
863
864
|
onBlur: () => b(!1),
|
|
864
|
-
placeholder: `Search ${
|
|
865
|
+
placeholder: `Search ${i.label.toLowerCase()} to add…`,
|
|
865
866
|
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"
|
|
866
867
|
}
|
|
867
868
|
),
|
|
868
|
-
|
|
869
|
+
U && /* @__PURE__ */ t(
|
|
869
870
|
"div",
|
|
870
871
|
{
|
|
871
|
-
onMouseDown: (
|
|
872
|
+
onMouseDown: (d) => d.preventDefault(),
|
|
872
873
|
className: "mt-1 max-h-44 overflow-y-auto rounded-md border border-slate-200 dark:border-border",
|
|
873
874
|
children: [
|
|
874
|
-
|
|
875
|
-
const
|
|
875
|
+
j.map((d) => {
|
|
876
|
+
const N = P.has(String(d.id));
|
|
876
877
|
return /* @__PURE__ */ t(
|
|
877
878
|
"button",
|
|
878
879
|
{
|
|
879
880
|
type: "button",
|
|
880
|
-
onClick: () =>
|
|
881
|
-
className:
|
|
881
|
+
onClick: () => I(d.id),
|
|
882
|
+
className: $(
|
|
882
883
|
"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",
|
|
883
|
-
|
|
884
|
+
N ? "font-medium text-nvr-navy dark:text-nvr-cyan" : "text-slate-600 dark:text-slate-300"
|
|
884
885
|
),
|
|
885
886
|
children: [
|
|
886
|
-
/* @__PURE__ */ e("span", { className: "truncate", children:
|
|
887
|
-
/* @__PURE__ */ e("span", { className: "pl-2 text-[11px] text-slate-400", children:
|
|
887
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: d.label }),
|
|
888
|
+
/* @__PURE__ */ e("span", { className: "pl-2 text-[11px] text-slate-400", children: N ? "Remove" : "Add" })
|
|
888
889
|
]
|
|
889
890
|
},
|
|
890
|
-
String(
|
|
891
|
+
String(d.id)
|
|
891
892
|
);
|
|
892
893
|
}),
|
|
893
|
-
|
|
894
|
-
|
|
894
|
+
j.length === 0 && /* @__PURE__ */ e("p", { className: "px-2.5 py-2 text-[11.5px] text-slate-400", children: L ? "Searching…" : f ? "No matches." : "No options." }),
|
|
895
|
+
f.length === 0 && k.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." })
|
|
895
896
|
]
|
|
896
897
|
}
|
|
897
898
|
),
|
|
898
|
-
!
|
|
899
|
+
!U && u.length === 0 && /* @__PURE__ */ e("p", { className: "mt-1 text-[11px] text-slate-400", children: "No defaults set — click to browse or type to search." })
|
|
899
900
|
] }) : /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: [
|
|
900
|
-
|
|
901
|
-
const
|
|
901
|
+
k.map((d) => {
|
|
902
|
+
const N = P.has(String(d.id));
|
|
902
903
|
return /* @__PURE__ */ e(
|
|
903
904
|
"button",
|
|
904
905
|
{
|
|
905
906
|
type: "button",
|
|
906
|
-
onClick: () =>
|
|
907
|
-
className:
|
|
907
|
+
onClick: () => I(d.id),
|
|
908
|
+
className: $(
|
|
908
909
|
"rounded-full border px-2.5 py-0.5 text-[11.5px] transition-colors",
|
|
909
|
-
|
|
910
|
+
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"
|
|
910
911
|
),
|
|
911
|
-
children:
|
|
912
|
+
children: d.label
|
|
912
913
|
},
|
|
913
|
-
String(
|
|
914
|
+
String(d.id)
|
|
914
915
|
);
|
|
915
916
|
}),
|
|
916
|
-
|
|
917
|
+
k.length === 0 && /* @__PURE__ */ e("span", { className: "text-[11.5px] text-slate-400", children: "No options." })
|
|
917
918
|
] })
|
|
918
919
|
] });
|
|
919
920
|
}
|
|
920
|
-
function
|
|
921
|
-
const { data:
|
|
921
|
+
function st() {
|
|
922
|
+
const { data: i } = q({
|
|
922
923
|
queryKey: ["nvr-settings-2fa"],
|
|
923
924
|
queryFn: () => a.request({ _method: "GET", _path: "/settings/" }).then((y) => (y == null ? void 0 : y.data) ?? null).catch(() => null),
|
|
924
925
|
staleTime: 6e5
|
|
925
|
-
}), u = (
|
|
926
|
+
}), u = (i == null ? void 0 : i.two_factor_enabled) !== !1, a = T(), s = E(), [l, o] = C(null), [c, m] = C(""), [n, b] = C(null), { data: p } = q({
|
|
926
927
|
queryKey: ["nvr-profile-totp"],
|
|
927
928
|
queryFn: () => a.request({ _method: "GET", _path: "/two-factor/status" }).then((y) => y.data)
|
|
928
|
-
}),
|
|
929
|
+
}), w = () => void s.invalidateQueries({ queryKey: ["nvr-profile-totp"] }), k = _({
|
|
929
930
|
mutationFn: () => a.request({ _method: "POST", _path: "/two-factor/setup" }).then((y) => y.data),
|
|
930
|
-
onSuccess: (y) =>
|
|
931
|
-
}),
|
|
931
|
+
onSuccess: (y) => o(y)
|
|
932
|
+
}), P = _({
|
|
932
933
|
mutationFn: (y) => a.request({
|
|
933
934
|
_method: "POST",
|
|
934
935
|
_path: "/two-factor/verify",
|
|
935
936
|
_body: { token: y }
|
|
936
937
|
}),
|
|
937
938
|
onSuccess: () => {
|
|
938
|
-
|
|
939
|
+
o(null), m(""), w();
|
|
939
940
|
}
|
|
940
|
-
}),
|
|
941
|
+
}), v = _({
|
|
941
942
|
mutationFn: (y) => a.request({
|
|
942
943
|
_method: "POST",
|
|
943
944
|
_path: "/two-factor/disable",
|
|
944
945
|
_body: { token: y }
|
|
945
946
|
}),
|
|
946
947
|
onSuccess: () => {
|
|
947
|
-
|
|
948
|
+
m(""), w();
|
|
948
949
|
}
|
|
949
|
-
}),
|
|
950
|
+
}), O = _({
|
|
950
951
|
mutationFn: () => a.request({ _method: "POST", _path: "/users/me/token" }).then((y) => y.data),
|
|
951
952
|
onSuccess: (y) => b(y.token)
|
|
952
|
-
}),
|
|
953
|
+
}), L = _({
|
|
953
954
|
mutationFn: () => a.request({ _method: "DELETE", _path: "/users/me/token" }),
|
|
954
955
|
onSuccess: () => b(null)
|
|
955
|
-
}),
|
|
956
|
+
}), S = _({
|
|
956
957
|
mutationFn: () => a.request({ _method: "POST", _path: "/auth/logout-all" }),
|
|
957
958
|
onSuccess: () => window.location.assign("/login")
|
|
958
959
|
});
|
|
959
960
|
return /* @__PURE__ */ e(
|
|
960
|
-
|
|
961
|
+
ie,
|
|
961
962
|
{
|
|
962
963
|
icon: /* @__PURE__ */ e(Oe, { className: "h-4 w-4" }),
|
|
963
964
|
title: "Security",
|
|
@@ -969,28 +970,28 @@ function nt() {
|
|
|
969
970
|
/* @__PURE__ */ e(
|
|
970
971
|
"span",
|
|
971
972
|
{
|
|
972
|
-
className:
|
|
973
|
+
className: $(
|
|
973
974
|
"rounded-full px-1.5 py-px text-[10px] font-semibold",
|
|
974
|
-
|
|
975
|
+
p != null && p.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"
|
|
975
976
|
),
|
|
976
|
-
children:
|
|
977
|
+
children: p != null && p.enabled ? "Enabled" : "Off"
|
|
977
978
|
}
|
|
978
979
|
)
|
|
979
980
|
] }),
|
|
980
|
-
!(
|
|
981
|
+
!(p != null && p.enabled) && !l && /* @__PURE__ */ e(
|
|
981
982
|
"button",
|
|
982
983
|
{
|
|
983
984
|
type: "button",
|
|
984
|
-
onClick: () =>
|
|
985
|
+
onClick: () => k.mutate(),
|
|
985
986
|
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",
|
|
986
|
-
children:
|
|
987
|
+
children: k.isPending ? "Preparing…" : "Set up 2FA"
|
|
987
988
|
}
|
|
988
989
|
),
|
|
989
|
-
|
|
990
|
+
l && /* @__PURE__ */ t("div", { className: "mt-3 flex flex-wrap items-start gap-4", children: [
|
|
990
991
|
/* @__PURE__ */ e(
|
|
991
992
|
"img",
|
|
992
993
|
{
|
|
993
|
-
src:
|
|
994
|
+
src: l.qr,
|
|
994
995
|
alt: "Scan with your authenticator app",
|
|
995
996
|
className: "h-32 w-32 rounded-md border border-slate-200 dark:border-border"
|
|
996
997
|
}
|
|
@@ -1001,8 +1002,8 @@ function nt() {
|
|
|
1001
1002
|
/* @__PURE__ */ e(
|
|
1002
1003
|
"input",
|
|
1003
1004
|
{
|
|
1004
|
-
value:
|
|
1005
|
-
onChange: (y) =>
|
|
1005
|
+
value: c,
|
|
1006
|
+
onChange: (y) => m(y.target.value),
|
|
1006
1007
|
placeholder: "123456",
|
|
1007
1008
|
inputMode: "numeric",
|
|
1008
1009
|
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"
|
|
@@ -1012,8 +1013,8 @@ function nt() {
|
|
|
1012
1013
|
"button",
|
|
1013
1014
|
{
|
|
1014
1015
|
type: "button",
|
|
1015
|
-
disabled:
|
|
1016
|
-
onClick: () =>
|
|
1016
|
+
disabled: c.trim().length < 6 || P.isPending,
|
|
1017
|
+
onClick: () => P.mutate(c.trim()),
|
|
1017
1018
|
className: "h-8 rounded-md bg-nvr-cyan px-3 text-[12px] font-semibold text-white disabled:opacity-50",
|
|
1018
1019
|
children: "Confirm"
|
|
1019
1020
|
}
|
|
@@ -1021,12 +1022,12 @@ function nt() {
|
|
|
1021
1022
|
] })
|
|
1022
1023
|
] })
|
|
1023
1024
|
] }),
|
|
1024
|
-
(
|
|
1025
|
+
(p == null ? void 0 : p.enabled) && /* @__PURE__ */ t("div", { className: "mt-2 flex gap-1.5", children: [
|
|
1025
1026
|
/* @__PURE__ */ e(
|
|
1026
1027
|
"input",
|
|
1027
1028
|
{
|
|
1028
|
-
value:
|
|
1029
|
-
onChange: (y) =>
|
|
1029
|
+
value: c,
|
|
1030
|
+
onChange: (y) => m(y.target.value),
|
|
1030
1031
|
placeholder: "Code to disable",
|
|
1031
1032
|
inputMode: "numeric",
|
|
1032
1033
|
className: "h-8 w-[130px] rounded-md border border-slate-200 px-2.5 text-[12px] dark:border-border dark:bg-background"
|
|
@@ -1036,10 +1037,10 @@ function nt() {
|
|
|
1036
1037
|
"button",
|
|
1037
1038
|
{
|
|
1038
1039
|
type: "button",
|
|
1039
|
-
disabled:
|
|
1040
|
-
onClick: () =>
|
|
1040
|
+
disabled: c.trim().length < 6 || v.isPending,
|
|
1041
|
+
onClick: () => v.mutate(c.trim()),
|
|
1041
1042
|
className: "h-8 rounded-md border border-red-200 px-3 text-[12px] font-medium text-red-500 transition-colors hover:bg-red-50 disabled:opacity-50 dark:border-red-500/30 dark:hover:bg-red-500/10",
|
|
1042
|
-
children:
|
|
1043
|
+
children: v.isPending ? "Disabling…" : "Disable"
|
|
1043
1044
|
}
|
|
1044
1045
|
)
|
|
1045
1046
|
] })
|
|
@@ -1057,16 +1058,16 @@ function nt() {
|
|
|
1057
1058
|
"button",
|
|
1058
1059
|
{
|
|
1059
1060
|
type: "button",
|
|
1060
|
-
onClick: () =>
|
|
1061
|
+
onClick: () => O.mutate(),
|
|
1061
1062
|
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",
|
|
1062
|
-
children:
|
|
1063
|
+
children: O.isPending ? "Generating…" : "Generate token"
|
|
1063
1064
|
}
|
|
1064
1065
|
),
|
|
1065
1066
|
/* @__PURE__ */ e(
|
|
1066
1067
|
be,
|
|
1067
1068
|
{
|
|
1068
1069
|
title: "Revoke API token",
|
|
1069
|
-
onConfirm: () =>
|
|
1070
|
+
onConfirm: () => L.mutate(),
|
|
1070
1071
|
confirmLabel: "Revoke token?",
|
|
1071
1072
|
className: "h-8 rounded-md px-3 text-[12px] font-medium text-slate-400 transition-colors hover:text-red-500",
|
|
1072
1073
|
armedClassName: "font-semibold text-red-500",
|
|
@@ -1084,13 +1085,13 @@ function nt() {
|
|
|
1084
1085
|
be,
|
|
1085
1086
|
{
|
|
1086
1087
|
title: "Sign out everywhere",
|
|
1087
|
-
onConfirm: () =>
|
|
1088
|
+
onConfirm: () => S.mutate(),
|
|
1088
1089
|
confirmLabel: "Sign out everywhere?",
|
|
1089
1090
|
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",
|
|
1090
1091
|
armedClassName: "border-red-300 font-semibold text-red-500 dark:border-red-500/40 dark:text-red-400",
|
|
1091
1092
|
children: [
|
|
1092
1093
|
/* @__PURE__ */ e(Fe, { className: "h-3.5 w-3.5" }),
|
|
1093
|
-
|
|
1094
|
+
S.isPending ? "Signing out…" : "Sign out everywhere"
|
|
1094
1095
|
]
|
|
1095
1096
|
}
|
|
1096
1097
|
)
|
|
@@ -1099,31 +1100,31 @@ function nt() {
|
|
|
1099
1100
|
}
|
|
1100
1101
|
);
|
|
1101
1102
|
}
|
|
1102
|
-
function
|
|
1103
|
-
userId:
|
|
1103
|
+
function It({
|
|
1104
|
+
userId: i,
|
|
1104
1105
|
className: u,
|
|
1105
1106
|
initialTab: a,
|
|
1106
1107
|
extra: s,
|
|
1107
|
-
pushServiceWorker:
|
|
1108
|
+
pushServiceWorker: l = "/sw.js"
|
|
1108
1109
|
}) {
|
|
1109
|
-
const
|
|
1110
|
-
return !
|
|
1110
|
+
const o = xe();
|
|
1111
|
+
return !i || (o == null ? void 0 : o.userId) != null && String(o.userId) === String(i) ? /* @__PURE__ */ e(lt, { className: u, extra: s, pushServiceWorker: l }) : /* @__PURE__ */ e(Je, { userId: i, className: u, initialTab: a });
|
|
1111
1112
|
}
|
|
1112
|
-
function
|
|
1113
|
-
className:
|
|
1113
|
+
function lt({
|
|
1114
|
+
className: i,
|
|
1114
1115
|
extra: u,
|
|
1115
1116
|
pushServiceWorker: a
|
|
1116
1117
|
}) {
|
|
1117
|
-
var
|
|
1118
|
-
const s =
|
|
1119
|
-
queryKey: ["nvr-profile-user",
|
|
1120
|
-
queryFn: () => s.request(
|
|
1121
|
-
enabled:
|
|
1122
|
-
}), b = (n == null ? void 0 : n.id) ?? null, { data:
|
|
1118
|
+
var U;
|
|
1119
|
+
const s = T(), l = E(), o = xe(), c = !0, m = "me", { data: n } = q({
|
|
1120
|
+
queryKey: ["nvr-profile-user", m],
|
|
1121
|
+
queryFn: () => s.request(fe(m)).then((d) => d.data),
|
|
1122
|
+
enabled: c
|
|
1123
|
+
}), b = (n == null ? void 0 : n.id) ?? null, { data: p } = q({
|
|
1123
1124
|
queryKey: ["nvr-profile-card", b],
|
|
1124
|
-
queryFn: () => s.request(
|
|
1125
|
+
queryFn: () => s.request(ye(b)).then((d) => d.data),
|
|
1125
1126
|
enabled: !!b
|
|
1126
|
-
}), [
|
|
1127
|
+
}), [w, k] = C(null), P = Le(
|
|
1127
1128
|
() => ({
|
|
1128
1129
|
first_name: (n == null ? void 0 : n.first_name) ?? "",
|
|
1129
1130
|
last_name: (n == null ? void 0 : n.last_name) ?? "",
|
|
@@ -1132,35 +1133,35 @@ function st({
|
|
|
1132
1133
|
phone: (n == null ? void 0 : n.phone) ?? ""
|
|
1133
1134
|
}),
|
|
1134
1135
|
[n]
|
|
1135
|
-
),
|
|
1136
|
-
mutationFn: () => s.request(me(n.id,
|
|
1136
|
+
), v = w ?? P, O = JSON.stringify(v) !== JSON.stringify(P), L = _({
|
|
1137
|
+
mutationFn: () => s.request(me(n.id, v)),
|
|
1137
1138
|
onSuccess: () => {
|
|
1138
|
-
|
|
1139
|
+
k(null), l.invalidateQueries({ queryKey: ["nvr-profile-user"] }), l.invalidateQueries({ queryKey: ["nvr-profile-card"] });
|
|
1139
1140
|
}
|
|
1140
|
-
}),
|
|
1141
|
-
mutationFn: async (
|
|
1142
|
-
const
|
|
1143
|
-
const
|
|
1144
|
-
|
|
1145
|
-
URL.revokeObjectURL(
|
|
1146
|
-
const Q = 96,
|
|
1147
|
-
|
|
1148
|
-
const
|
|
1149
|
-
if (!
|
|
1150
|
-
const
|
|
1151
|
-
|
|
1152
|
-
},
|
|
1153
|
-
URL.revokeObjectURL(
|
|
1154
|
-
},
|
|
1141
|
+
}), [S, y] = C(ot), z = De(null), I = _({
|
|
1142
|
+
mutationFn: async (d) => {
|
|
1143
|
+
const N = await new Promise((A, Z) => {
|
|
1144
|
+
const D = new Image(), W = URL.createObjectURL(d);
|
|
1145
|
+
D.onload = () => {
|
|
1146
|
+
URL.revokeObjectURL(W);
|
|
1147
|
+
const Q = 96, B = document.createElement("canvas");
|
|
1148
|
+
B.width = Q, B.height = Q;
|
|
1149
|
+
const X = B.getContext("2d");
|
|
1150
|
+
if (!X) return Z(new Error("canvas unavailable"));
|
|
1151
|
+
const ee = Math.max(Q / D.width, Q / D.height), G = D.width * ee, J = D.height * ee;
|
|
1152
|
+
X.drawImage(D, (Q - G) / 2, (Q - J) / 2, G, J), A(B.toDataURL("image/jpeg", 0.85));
|
|
1153
|
+
}, D.onerror = () => {
|
|
1154
|
+
URL.revokeObjectURL(W), Z(new Error("not an image"));
|
|
1155
|
+
}, D.src = W;
|
|
1155
1156
|
});
|
|
1156
|
-
await s.request(me(n.id, { avatar:
|
|
1157
|
+
await s.request(me(n.id, { avatar: N }));
|
|
1157
1158
|
},
|
|
1158
1159
|
onSuccess: () => {
|
|
1159
|
-
|
|
1160
|
+
l.invalidateQueries({ queryKey: ["nvr-profile-user"] }), l.invalidateQueries({ queryKey: ["nvr-profile-card"] }), l.invalidateQueries({ queryKey: ["user-card"] }), l.invalidateQueries({ queryKey: ["user-avatar"] });
|
|
1160
1161
|
}
|
|
1161
|
-
}),
|
|
1162
|
-
if (!
|
|
1163
|
-
return /* @__PURE__ */ t("div", { className:
|
|
1162
|
+
}), f = p ?? (n ? { ...n, role_name: null } : null);
|
|
1163
|
+
if (!f)
|
|
1164
|
+
return /* @__PURE__ */ t("div", { className: $("flex animate-pulse flex-col gap-4", i), "aria-busy": "true", children: [
|
|
1164
1165
|
/* @__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: [
|
|
1165
1166
|
/* @__PURE__ */ e("div", { className: "h-[76px] w-[76px] rounded-full bg-slate-100 dark:bg-muted" }),
|
|
1166
1167
|
/* @__PURE__ */ t("div", { className: "flex-1 space-y-2.5", children: [
|
|
@@ -1174,29 +1175,29 @@ function st({
|
|
|
1174
1175
|
/* @__PURE__ */ e("div", { className: "h-64 rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card" })
|
|
1175
1176
|
] })
|
|
1176
1177
|
] });
|
|
1177
|
-
const
|
|
1178
|
-
return /* @__PURE__ */ t("div", { className:
|
|
1178
|
+
const K = (n == null ? void 0 : n.avatar) ?? null, j = f.status === "active";
|
|
1179
|
+
return /* @__PURE__ */ t("div", { className: $("flex flex-col gap-4", i), "data-nvr-profile": !0, children: [
|
|
1179
1180
|
/* @__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: [
|
|
1180
1181
|
/* @__PURE__ */ t("div", { className: "relative", children: [
|
|
1181
|
-
|
|
1182
|
+
K ? /* @__PURE__ */ e(
|
|
1182
1183
|
"img",
|
|
1183
1184
|
{
|
|
1184
|
-
src:
|
|
1185
|
+
src: K.startsWith("data:") ? K : `/api/files/${K}`,
|
|
1185
1186
|
alt: "",
|
|
1186
1187
|
className: "h-[76px] w-[76px] rounded-full border border-slate-200 object-cover dark:border-border"
|
|
1187
1188
|
}
|
|
1188
|
-
) : /* @__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:
|
|
1189
|
+
) : /* @__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: Ze(f) }),
|
|
1189
1190
|
/* @__PURE__ */ e(
|
|
1190
1191
|
"span",
|
|
1191
1192
|
{
|
|
1192
|
-
className:
|
|
1193
|
+
className: $(
|
|
1193
1194
|
"absolute bottom-0.5 right-0.5 h-3 w-3 rounded-full border-2 border-white dark:border-card",
|
|
1194
|
-
|
|
1195
|
+
j ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
|
|
1195
1196
|
),
|
|
1196
|
-
title:
|
|
1197
|
+
title: j ? "Active" : f.status
|
|
1197
1198
|
}
|
|
1198
1199
|
),
|
|
1199
|
-
/* @__PURE__ */ t(
|
|
1200
|
+
/* @__PURE__ */ t(oe, { children: [
|
|
1200
1201
|
/* @__PURE__ */ e(
|
|
1201
1202
|
"button",
|
|
1202
1203
|
{
|
|
@@ -1204,24 +1205,24 @@ function st({
|
|
|
1204
1205
|
title: "Change photo",
|
|
1205
1206
|
"aria-label": "Change photo",
|
|
1206
1207
|
onClick: () => {
|
|
1207
|
-
var
|
|
1208
|
-
return (
|
|
1208
|
+
var d;
|
|
1209
|
+
return (d = z.current) == null ? void 0 : d.click();
|
|
1209
1210
|
},
|
|
1210
1211
|
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",
|
|
1211
|
-
children:
|
|
1212
|
+
children: I.isPending ? /* @__PURE__ */ e(ue, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Ne, { className: "h-3.5 w-3.5" })
|
|
1212
1213
|
}
|
|
1213
1214
|
),
|
|
1214
1215
|
/* @__PURE__ */ e(
|
|
1215
1216
|
"input",
|
|
1216
1217
|
{
|
|
1217
|
-
ref:
|
|
1218
|
+
ref: z,
|
|
1218
1219
|
type: "file",
|
|
1219
1220
|
accept: "image/*",
|
|
1220
1221
|
className: "hidden",
|
|
1221
|
-
onChange: (
|
|
1222
|
-
var
|
|
1223
|
-
const
|
|
1224
|
-
|
|
1222
|
+
onChange: (d) => {
|
|
1223
|
+
var A;
|
|
1224
|
+
const N = (A = d.target.files) == null ? void 0 : A[0];
|
|
1225
|
+
N && I.mutate(N), d.target.value = "";
|
|
1225
1226
|
}
|
|
1226
1227
|
}
|
|
1227
1228
|
)
|
|
@@ -1229,10 +1230,10 @@ function st({
|
|
|
1229
1230
|
] }),
|
|
1230
1231
|
/* @__PURE__ */ t("div", { className: "min-w-0 flex-1", children: [
|
|
1231
1232
|
/* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1232
|
-
/* @__PURE__ */ e("h1", { className: "text-[21px] font-semibold tracking-[-0.015em] text-slate-900 dark:text-white", children:
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
/* @__PURE__ */ e(
|
|
1233
|
+
/* @__PURE__ */ e("h1", { className: "text-[21px] font-semibold tracking-[-0.015em] text-slate-900 dark:text-white", children: Ve(f) }),
|
|
1234
|
+
f.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: f.role_name }),
|
|
1235
|
+
f.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" }),
|
|
1236
|
+
/* @__PURE__ */ e(He, { email: f.email, canClear: o.isAdmin })
|
|
1236
1237
|
] }),
|
|
1237
1238
|
n && // The same status the chat panel's Online tab sets — one editor,
|
|
1238
1239
|
// one preference, so the profile always agrees with the top bar.
|
|
@@ -1240,46 +1241,46 @@ function st({
|
|
|
1240
1241
|
je,
|
|
1241
1242
|
{
|
|
1242
1243
|
status: Qe(
|
|
1243
|
-
(
|
|
1244
|
+
(U = n.preferences) == null ? void 0 : U.custom_status
|
|
1244
1245
|
),
|
|
1245
1246
|
showExpiry: !0,
|
|
1246
1247
|
className: "mt-1.5"
|
|
1247
1248
|
}
|
|
1248
1249
|
),
|
|
1249
|
-
(
|
|
1250
|
+
(f.title || f.department) && /* @__PURE__ */ e("p", { className: "mt-0.5 truncate text-[13px] text-slate-500 dark:text-slate-400", children: [f.title, f.department].filter(Boolean).join(" · ") }),
|
|
1250
1251
|
/* @__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: [
|
|
1251
|
-
|
|
1252
|
+
f.company && /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
1252
1253
|
/* @__PURE__ */ e(we, { className: "h-3.5 w-3.5" }),
|
|
1253
1254
|
" ",
|
|
1254
|
-
|
|
1255
|
+
f.company
|
|
1255
1256
|
] }),
|
|
1256
1257
|
/* @__PURE__ */ t(
|
|
1257
1258
|
"a",
|
|
1258
1259
|
{
|
|
1259
|
-
href: `mailto:${
|
|
1260
|
+
href: `mailto:${f.email}`,
|
|
1260
1261
|
className: "inline-flex items-center gap-1.5 transition-colors hover:text-nvr-navy dark:hover:text-nvr-cyan",
|
|
1261
1262
|
children: [
|
|
1262
1263
|
/* @__PURE__ */ e(Se, { className: "h-3.5 w-3.5" }),
|
|
1263
1264
|
" ",
|
|
1264
|
-
|
|
1265
|
+
f.email
|
|
1265
1266
|
]
|
|
1266
1267
|
}
|
|
1267
1268
|
),
|
|
1268
|
-
|
|
1269
|
+
f.phone && /* @__PURE__ */ t(
|
|
1269
1270
|
"a",
|
|
1270
1271
|
{
|
|
1271
|
-
href: `tel:${
|
|
1272
|
+
href: `tel:${f.phone}`,
|
|
1272
1273
|
className: "inline-flex items-center gap-1.5 transition-colors hover:text-nvr-navy dark:hover:text-nvr-cyan",
|
|
1273
1274
|
children: [
|
|
1274
1275
|
/* @__PURE__ */ e(_e, { className: "h-3.5 w-3.5" }),
|
|
1275
1276
|
" ",
|
|
1276
|
-
|
|
1277
|
+
f.phone
|
|
1277
1278
|
]
|
|
1278
1279
|
}
|
|
1279
1280
|
),
|
|
1280
|
-
|
|
1281
|
+
f.last_access && /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1.5", title: "Last active", children: [
|
|
1281
1282
|
/* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5" }),
|
|
1282
|
-
new Date(
|
|
1283
|
+
new Date(f.last_access).toLocaleDateString(void 0, {
|
|
1283
1284
|
month: "short",
|
|
1284
1285
|
day: "numeric"
|
|
1285
1286
|
})
|
|
@@ -1287,7 +1288,8 @@ function st({
|
|
|
1287
1288
|
] })
|
|
1288
1289
|
] })
|
|
1289
1290
|
] }) }),
|
|
1290
|
-
|
|
1291
|
+
/* @__PURE__ */ e(it, { tab: S, onChange: y }),
|
|
1292
|
+
S === "agents" ? /* @__PURE__ */ e(Re, {}) : n ? (
|
|
1291
1293
|
// One list in reading order — you, then notifications, then access
|
|
1292
1294
|
// and security — flowing into two balanced columns. Two fixed stacks
|
|
1293
1295
|
// left thirteen cards on one side and four on the other, and the page
|
|
@@ -1299,18 +1301,18 @@ function st({
|
|
|
1299
1301
|
"data-profile-columns": !0,
|
|
1300
1302
|
children: [
|
|
1301
1303
|
/* @__PURE__ */ e(
|
|
1302
|
-
|
|
1304
|
+
ie,
|
|
1303
1305
|
{
|
|
1304
|
-
icon: /* @__PURE__ */ e(
|
|
1306
|
+
icon: /* @__PURE__ */ e(Ae, { className: "h-4 w-4" }),
|
|
1305
1307
|
title: "About you",
|
|
1306
1308
|
hint: "Shown on your contact card across the app",
|
|
1307
|
-
actions:
|
|
1309
|
+
actions: O && /* @__PURE__ */ t("span", { className: "flex items-center gap-1.5", children: [
|
|
1308
1310
|
/* @__PURE__ */ t(
|
|
1309
1311
|
"button",
|
|
1310
1312
|
{
|
|
1311
1313
|
type: "button",
|
|
1312
1314
|
title: "Discard changes",
|
|
1313
|
-
onClick: () =>
|
|
1315
|
+
onClick: () => k(null),
|
|
1314
1316
|
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",
|
|
1315
1317
|
children: [
|
|
1316
1318
|
/* @__PURE__ */ e(Ce, { className: "h-3 w-3" }),
|
|
@@ -1322,11 +1324,11 @@ function st({
|
|
|
1322
1324
|
"button",
|
|
1323
1325
|
{
|
|
1324
1326
|
type: "button",
|
|
1325
|
-
disabled:
|
|
1326
|
-
onClick: () =>
|
|
1327
|
+
disabled: L.isPending,
|
|
1328
|
+
onClick: () => L.mutate(),
|
|
1327
1329
|
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",
|
|
1328
1330
|
children: [
|
|
1329
|
-
|
|
1331
|
+
L.isPending ? /* @__PURE__ */ e(ue, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(Pe, { className: "h-3 w-3" }),
|
|
1330
1332
|
" ",
|
|
1331
1333
|
"Save"
|
|
1332
1334
|
]
|
|
@@ -1335,78 +1337,78 @@ function st({
|
|
|
1335
1337
|
] }),
|
|
1336
1338
|
children: /* @__PURE__ */ t("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
1337
1339
|
/* @__PURE__ */ e(
|
|
1338
|
-
|
|
1340
|
+
Y,
|
|
1339
1341
|
{
|
|
1340
1342
|
label: "First name",
|
|
1341
|
-
value:
|
|
1342
|
-
onChange: (
|
|
1343
|
+
value: v.first_name,
|
|
1344
|
+
onChange: (d) => k({ ...v, first_name: d })
|
|
1343
1345
|
}
|
|
1344
1346
|
),
|
|
1345
1347
|
/* @__PURE__ */ e(
|
|
1346
|
-
|
|
1348
|
+
Y,
|
|
1347
1349
|
{
|
|
1348
1350
|
label: "Last name",
|
|
1349
|
-
value:
|
|
1350
|
-
onChange: (
|
|
1351
|
+
value: v.last_name,
|
|
1352
|
+
onChange: (d) => k({ ...v, last_name: d })
|
|
1351
1353
|
}
|
|
1352
1354
|
),
|
|
1353
1355
|
/* @__PURE__ */ e(
|
|
1354
|
-
|
|
1356
|
+
Y,
|
|
1355
1357
|
{
|
|
1356
1358
|
label: "Title",
|
|
1357
|
-
value:
|
|
1358
|
-
onChange: (
|
|
1359
|
+
value: v.title,
|
|
1360
|
+
onChange: (d) => k({ ...v, title: d }),
|
|
1359
1361
|
placeholder: "e.g. Construction Manager"
|
|
1360
1362
|
}
|
|
1361
1363
|
),
|
|
1362
1364
|
/* @__PURE__ */ e(
|
|
1363
|
-
|
|
1365
|
+
Y,
|
|
1364
1366
|
{
|
|
1365
1367
|
label: "Department",
|
|
1366
|
-
value:
|
|
1367
|
-
onChange: (
|
|
1368
|
+
value: v.department,
|
|
1369
|
+
onChange: (d) => k({ ...v, department: d })
|
|
1368
1370
|
}
|
|
1369
1371
|
),
|
|
1370
1372
|
/* @__PURE__ */ e(
|
|
1371
|
-
|
|
1373
|
+
Y,
|
|
1372
1374
|
{
|
|
1373
1375
|
label: "Phone",
|
|
1374
|
-
value:
|
|
1375
|
-
onChange: (
|
|
1376
|
+
value: v.phone,
|
|
1377
|
+
onChange: (d) => k({ ...v, phone: d }),
|
|
1376
1378
|
placeholder: "+1 …",
|
|
1377
1379
|
type: "tel"
|
|
1378
1380
|
}
|
|
1379
1381
|
),
|
|
1380
|
-
/* @__PURE__ */ e(
|
|
1382
|
+
/* @__PURE__ */ e(Y, { label: "Email", value: n.email ?? "", disabled: !0, hint: "managed by admin" })
|
|
1381
1383
|
] })
|
|
1382
1384
|
}
|
|
1383
1385
|
),
|
|
1384
1386
|
/* @__PURE__ */ e(
|
|
1385
|
-
|
|
1387
|
+
Be,
|
|
1386
1388
|
{
|
|
1387
1389
|
user: n,
|
|
1388
1390
|
onSaved: () => {
|
|
1389
|
-
|
|
1391
|
+
l.invalidateQueries({ queryKey: ["nvr-profile-user"] }), l.invalidateQueries({ queryKey: ["nvr-profile-card"] });
|
|
1390
1392
|
}
|
|
1391
1393
|
}
|
|
1392
1394
|
),
|
|
1393
|
-
/* @__PURE__ */ e(
|
|
1395
|
+
/* @__PURE__ */ e(Xe, {}),
|
|
1396
|
+
/* @__PURE__ */ e(at, {}),
|
|
1397
|
+
/* @__PURE__ */ e(ht, {}),
|
|
1394
1398
|
/* @__PURE__ */ e(tt, {}),
|
|
1399
|
+
/* @__PURE__ */ e($e, {}),
|
|
1400
|
+
/* @__PURE__ */ e(Ue, {}),
|
|
1401
|
+
o.isAdmin && (n != null && n.id) ? /* @__PURE__ */ e(Ge, { userId: String(n.id) }) : /* @__PURE__ */ e(rt, {}),
|
|
1402
|
+
/* @__PURE__ */ e(ct, {}),
|
|
1403
|
+
/* @__PURE__ */ e(Ye, { userId: "me" }),
|
|
1395
1404
|
/* @__PURE__ */ e(mt, {}),
|
|
1396
1405
|
/* @__PURE__ */ e(et, {}),
|
|
1397
|
-
/* @__PURE__ */ e(
|
|
1398
|
-
/* @__PURE__ */ e(
|
|
1399
|
-
|
|
1400
|
-
/* @__PURE__ */ e(
|
|
1401
|
-
/* @__PURE__ */ e(
|
|
1402
|
-
/* @__PURE__ */ e(it, {}),
|
|
1403
|
-
/* @__PURE__ */ e(Xe, {}),
|
|
1404
|
-
/* @__PURE__ */ e(Ye, {}),
|
|
1405
|
-
a !== !1 && /* @__PURE__ */ e(Ue, { serviceWorkerPath: a }),
|
|
1406
|
+
/* @__PURE__ */ e(We, {}),
|
|
1407
|
+
a !== !1 && /* @__PURE__ */ e(ze, { serviceWorkerPath: a }),
|
|
1408
|
+
/* @__PURE__ */ e(ut, {}),
|
|
1409
|
+
/* @__PURE__ */ e(st, {}),
|
|
1410
|
+
/* @__PURE__ */ e(pt, {}),
|
|
1406
1411
|
/* @__PURE__ */ e(dt, {}),
|
|
1407
|
-
/* @__PURE__ */ e(nt, {}),
|
|
1408
|
-
/* @__PURE__ */ e(ct, {}),
|
|
1409
|
-
/* @__PURE__ */ e(lt, {}),
|
|
1410
1412
|
u
|
|
1411
1413
|
]
|
|
1412
1414
|
}
|
|
@@ -1414,23 +1416,69 @@ function st({
|
|
|
1414
1416
|
) : null
|
|
1415
1417
|
] });
|
|
1416
1418
|
}
|
|
1417
|
-
function
|
|
1418
|
-
|
|
1419
|
+
function ot() {
|
|
1420
|
+
try {
|
|
1421
|
+
return new URLSearchParams(window.location.search).get("tab") === "agents" ? "agents" : "profile";
|
|
1422
|
+
} catch {
|
|
1423
|
+
return "profile";
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
function it({
|
|
1427
|
+
tab: i,
|
|
1428
|
+
onChange: u
|
|
1429
|
+
}) {
|
|
1430
|
+
const a = (l) => {
|
|
1431
|
+
u(l);
|
|
1432
|
+
try {
|
|
1433
|
+
const o = new URL(window.location.href);
|
|
1434
|
+
l === "agents" ? o.searchParams.set("tab", "agents") : o.searchParams.delete("tab"), window.history.replaceState(window.history.state, "", o);
|
|
1435
|
+
} catch {
|
|
1436
|
+
}
|
|
1437
|
+
};
|
|
1438
|
+
return /* @__PURE__ */ e(
|
|
1439
|
+
"div",
|
|
1440
|
+
{
|
|
1441
|
+
role: "tablist",
|
|
1442
|
+
"aria-label": "Profile sections",
|
|
1443
|
+
className: "flex gap-1 border-b border-slate-200 dark:border-border",
|
|
1444
|
+
children: [
|
|
1445
|
+
["profile", "Profile"],
|
|
1446
|
+
["agents", "What my agents did"]
|
|
1447
|
+
].map(([l, o]) => /* @__PURE__ */ e(
|
|
1448
|
+
"button",
|
|
1449
|
+
{
|
|
1450
|
+
type: "button",
|
|
1451
|
+
role: "tab",
|
|
1452
|
+
"aria-selected": i === l,
|
|
1453
|
+
onClick: () => a(l),
|
|
1454
|
+
className: $(
|
|
1455
|
+
"-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",
|
|
1456
|
+
i === 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"
|
|
1457
|
+
),
|
|
1458
|
+
children: o
|
|
1459
|
+
},
|
|
1460
|
+
l
|
|
1461
|
+
))
|
|
1462
|
+
}
|
|
1463
|
+
);
|
|
1464
|
+
}
|
|
1465
|
+
function dt() {
|
|
1466
|
+
const i = T(), [u, a] = C(!1), { data: s = [], isLoading: l } = q({
|
|
1419
1467
|
queryKey: ["my-matrix-seats"],
|
|
1420
|
-
queryFn: () =>
|
|
1468
|
+
queryFn: () => i.request(F("/pipelines/my-seats")).then((c) => c.data ?? []).catch(() => []),
|
|
1421
1469
|
enabled: u,
|
|
1422
1470
|
staleTime: 6e4
|
|
1423
|
-
}),
|
|
1424
|
-
for (const
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1471
|
+
}), o = /* @__PURE__ */ new Map();
|
|
1472
|
+
for (const c of s) {
|
|
1473
|
+
const m = o.get(c.template_name) ?? [];
|
|
1474
|
+
m.push(c), o.set(c.template_name, m);
|
|
1427
1475
|
}
|
|
1428
1476
|
return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white p-4 dark:border-border dark:bg-card", children: [
|
|
1429
1477
|
/* @__PURE__ */ t(
|
|
1430
1478
|
"button",
|
|
1431
1479
|
{
|
|
1432
1480
|
type: "button",
|
|
1433
|
-
onClick: () => a((
|
|
1481
|
+
onClick: () => a((c) => !c),
|
|
1434
1482
|
className: "flex w-full items-center justify-between text-left",
|
|
1435
1483
|
children: [
|
|
1436
1484
|
/* @__PURE__ */ t("div", { children: [
|
|
@@ -1441,10 +1489,10 @@ function lt() {
|
|
|
1441
1489
|
]
|
|
1442
1490
|
}
|
|
1443
1491
|
),
|
|
1444
|
-
u && (
|
|
1445
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] font-semibold uppercase tracking-wide text-slate-400", children:
|
|
1492
|
+
u && (l ? /* @__PURE__ */ e("p", { className: "mt-3 text-[12.5px] text-slate-400", children: "Loading…" }) : s.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: [...o.entries()].map(([c, m]) => /* @__PURE__ */ t("div", { children: [
|
|
1493
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] font-semibold uppercase tracking-wide text-slate-400", children: c }),
|
|
1446
1494
|
/* @__PURE__ */ t("ul", { className: "mt-1 space-y-0.5", children: [
|
|
1447
|
-
|
|
1495
|
+
m.slice(0, 40).map((n) => /* @__PURE__ */ t("li", { className: "text-[12.5px]", children: [
|
|
1448
1496
|
/* @__PURE__ */ e("span", { className: "font-medium", children: n.state_label }),
|
|
1449
1497
|
n.group_name && /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-muted-foreground", children: [
|
|
1450
1498
|
" ",
|
|
@@ -1454,28 +1502,28 @@ function lt() {
|
|
|
1454
1502
|
Array.isArray(n.filters) && n.filters.length > 0 && /* @__PURE__ */ e("span", { className: "ml-1.5 font-mono text-[10.5px] text-slate-400", children: n.filters.slice(0, 3).map((b) => `${b.field}=${String(b.value)}`).join(" · ") }),
|
|
1455
1503
|
(n.is_default === !0 || n.is_default === 1) && /* @__PURE__ */ e("span", { className: "ml-1.5 rounded bg-slate-100 px-1 py-px text-[9.5px] text-slate-500 dark:bg-muted", children: "default" })
|
|
1456
1504
|
] }, n.group_id)),
|
|
1457
|
-
|
|
1505
|
+
m.length > 40 && /* @__PURE__ */ t("li", { className: "text-[11.5px] text-slate-400", children: [
|
|
1458
1506
|
"…and ",
|
|
1459
|
-
|
|
1507
|
+
m.length - 40,
|
|
1460
1508
|
" more"
|
|
1461
1509
|
] })
|
|
1462
1510
|
] })
|
|
1463
|
-
] },
|
|
1511
|
+
] }, c)) }))
|
|
1464
1512
|
] });
|
|
1465
1513
|
}
|
|
1466
|
-
function
|
|
1467
|
-
const
|
|
1514
|
+
function ct() {
|
|
1515
|
+
const i = T(), u = E(), { data: a = [] } = q({
|
|
1468
1516
|
queryKey: ["my-reminders"],
|
|
1469
|
-
queryFn: () =>
|
|
1517
|
+
queryFn: () => i.request(F("/reminders")).then((p) => p.data).catch(() => []),
|
|
1470
1518
|
staleTime: 3e4
|
|
1471
|
-
}), [s,
|
|
1472
|
-
mutationFn: () =>
|
|
1519
|
+
}), [s, l] = C(""), [o, c] = C(""), m = () => void u.invalidateQueries({ queryKey: ["my-reminders"] }), n = _({
|
|
1520
|
+
mutationFn: () => i.request(ae("/reminders", { note: s, remind_at: new Date(o).toISOString() })),
|
|
1473
1521
|
onSuccess: () => {
|
|
1474
|
-
|
|
1522
|
+
l(""), c(""), m();
|
|
1475
1523
|
}
|
|
1476
|
-
}), b =
|
|
1477
|
-
mutationFn: (
|
|
1478
|
-
onSuccess:
|
|
1524
|
+
}), b = _({
|
|
1525
|
+
mutationFn: (p) => i.request(Ee(`/reminders/${p}`)),
|
|
1526
|
+
onSuccess: m
|
|
1479
1527
|
});
|
|
1480
1528
|
return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
1481
1529
|
/* @__PURE__ */ t("header", { className: "border-b border-slate-100 px-4 py-2.5 dark:border-border/60", children: [
|
|
@@ -1484,34 +1532,34 @@ function ot() {
|
|
|
1484
1532
|
] }),
|
|
1485
1533
|
/* @__PURE__ */ t("div", { className: "space-y-2 px-4 py-3", children: [
|
|
1486
1534
|
a.length === 0 && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "No upcoming reminders." }),
|
|
1487
|
-
a.map((
|
|
1535
|
+
a.map((p) => /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
1488
1536
|
/* @__PURE__ */ t("div", { className: "min-w-0 flex-1", children: [
|
|
1489
|
-
/* @__PURE__ */ e("p", { className: "truncate text-[12.5px] text-slate-700 dark:text-slate-200", children:
|
|
1490
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: new Date(
|
|
1537
|
+
/* @__PURE__ */ e("p", { className: "truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: p.note }),
|
|
1538
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: new Date(p.remind_at).toLocaleString() })
|
|
1491
1539
|
] }),
|
|
1492
1540
|
/* @__PURE__ */ e(
|
|
1493
1541
|
"button",
|
|
1494
1542
|
{
|
|
1495
1543
|
type: "button",
|
|
1496
|
-
onClick: () => b.mutate(
|
|
1544
|
+
onClick: () => b.mutate(p.id),
|
|
1497
1545
|
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",
|
|
1498
1546
|
children: "Cancel"
|
|
1499
1547
|
}
|
|
1500
1548
|
)
|
|
1501
|
-
] },
|
|
1549
|
+
] }, p.id)),
|
|
1502
1550
|
/* @__PURE__ */ t(
|
|
1503
1551
|
"form",
|
|
1504
1552
|
{
|
|
1505
1553
|
className: "flex flex-wrap items-center gap-2 pt-1",
|
|
1506
|
-
onSubmit: (
|
|
1507
|
-
|
|
1554
|
+
onSubmit: (p) => {
|
|
1555
|
+
p.preventDefault(), s.trim() && o && n.mutate();
|
|
1508
1556
|
},
|
|
1509
1557
|
children: [
|
|
1510
1558
|
/* @__PURE__ */ e(
|
|
1511
1559
|
"input",
|
|
1512
1560
|
{
|
|
1513
1561
|
value: s,
|
|
1514
|
-
onChange: (
|
|
1562
|
+
onChange: (p) => l(p.target.value),
|
|
1515
1563
|
placeholder: "Remind me to…",
|
|
1516
1564
|
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"
|
|
1517
1565
|
}
|
|
@@ -1520,8 +1568,8 @@ function ot() {
|
|
|
1520
1568
|
"input",
|
|
1521
1569
|
{
|
|
1522
1570
|
type: "datetime-local",
|
|
1523
|
-
value:
|
|
1524
|
-
onChange: (
|
|
1571
|
+
value: o,
|
|
1572
|
+
onChange: (p) => c(p.target.value),
|
|
1525
1573
|
className: "h-7 rounded border border-slate-200 px-2 text-[12px] outline-none focus:border-nvr-cyan dark:border-border dark:bg-background"
|
|
1526
1574
|
}
|
|
1527
1575
|
),
|
|
@@ -1529,7 +1577,7 @@ function ot() {
|
|
|
1529
1577
|
"button",
|
|
1530
1578
|
{
|
|
1531
1579
|
type: "submit",
|
|
1532
|
-
disabled: !s.trim() || !
|
|
1580
|
+
disabled: !s.trim() || !o || n.isPending,
|
|
1533
1581
|
className: "h-7 rounded bg-nvr-cyan px-2.5 text-[11.5px] font-medium text-white hover:bg-nvr-cyan-dark disabled:opacity-50",
|
|
1534
1582
|
children: n.isPending ? "Adding…" : "Add"
|
|
1535
1583
|
}
|
|
@@ -1540,10 +1588,10 @@ function ot() {
|
|
|
1540
1588
|
] })
|
|
1541
1589
|
] });
|
|
1542
1590
|
}
|
|
1543
|
-
function
|
|
1544
|
-
const
|
|
1591
|
+
function mt() {
|
|
1592
|
+
const i = T(), { data: u } = q({
|
|
1545
1593
|
queryKey: ["my-stats"],
|
|
1546
|
-
queryFn: () =>
|
|
1594
|
+
queryFn: () => i.request(F("/users/me/stats")).then((s) => s.data).catch(() => null),
|
|
1547
1595
|
staleTime: 5 * 6e4
|
|
1548
1596
|
});
|
|
1549
1597
|
if (!u) return null;
|
|
@@ -1560,16 +1608,16 @@ function it() {
|
|
|
1560
1608
|
] })
|
|
1561
1609
|
] }),
|
|
1562
1610
|
/* @__PURE__ */ t("div", { className: "px-4 py-3", children: [
|
|
1563
|
-
/* @__PURE__ */ e("div", { className: "flex items-end gap-1.5", style: { height: 56 }, children: u.weeks.map((s,
|
|
1564
|
-
const
|
|
1611
|
+
/* @__PURE__ */ e("div", { className: "flex items-end gap-1.5", style: { height: 56 }, children: u.weeks.map((s, l) => {
|
|
1612
|
+
const o = s.transitions + s.tasks_done + s.created;
|
|
1565
1613
|
return /* @__PURE__ */ e(
|
|
1566
1614
|
"div",
|
|
1567
1615
|
{
|
|
1568
1616
|
className: "flex-1 rounded-t bg-nvr-cyan/60 transition-all dark:bg-nvr-cyan/40",
|
|
1569
|
-
style: { height: `${Math.max(4,
|
|
1570
|
-
"data-tip": `${
|
|
1617
|
+
style: { height: `${Math.max(4, o / a * 100)}%` },
|
|
1618
|
+
"data-tip": `${o} action${o === 1 ? "" : "s"}: ${s.transitions} transitions, ${s.tasks_done} tasks done, ${s.created} created`
|
|
1571
1619
|
},
|
|
1572
|
-
|
|
1620
|
+
l
|
|
1573
1621
|
);
|
|
1574
1622
|
}) }),
|
|
1575
1623
|
/* @__PURE__ */ t("div", { className: "mt-2 flex items-center justify-between text-[11px] text-slate-400", children: [
|
|
@@ -1596,19 +1644,19 @@ function it() {
|
|
|
1596
1644
|
] })
|
|
1597
1645
|
] });
|
|
1598
1646
|
}
|
|
1599
|
-
function
|
|
1600
|
-
const
|
|
1647
|
+
function ut() {
|
|
1648
|
+
const i = T(), u = E(), { data: a } = q({
|
|
1601
1649
|
queryKey: ["my-security"],
|
|
1602
|
-
queryFn: () =>
|
|
1650
|
+
queryFn: () => i.request(F("/security/my/sessions")).then((o) => o.data).catch(() => ({ sessions: [], logins: [] })),
|
|
1603
1651
|
staleTime: 3e4
|
|
1604
|
-
}), s =
|
|
1605
|
-
mutationFn: () =>
|
|
1606
|
-
onSuccess: (
|
|
1607
|
-
u.invalidateQueries({ queryKey: ["my-security"] }),
|
|
1652
|
+
}), s = _({
|
|
1653
|
+
mutationFn: () => i.request(ae("/security/my/sessions/sign-out-others", {})).then((o) => o.data),
|
|
1654
|
+
onSuccess: (o) => {
|
|
1655
|
+
u.invalidateQueries({ queryKey: ["my-security"] }), l(`Signed out ${(o == null ? void 0 : o.revoked) ?? 0} other session(s)`);
|
|
1608
1656
|
}
|
|
1609
|
-
}),
|
|
1657
|
+
}), l = (o) => {
|
|
1610
1658
|
try {
|
|
1611
|
-
import("sonner").then(({ toast:
|
|
1659
|
+
import("sonner").then(({ toast: c }) => c.success(o));
|
|
1612
1660
|
} catch {
|
|
1613
1661
|
}
|
|
1614
1662
|
};
|
|
@@ -1635,43 +1683,43 @@ function dt() {
|
|
|
1635
1683
|
(a == null ? void 0 : a.sessions.length) ?? 0,
|
|
1636
1684
|
")"
|
|
1637
1685
|
] }),
|
|
1638
|
-
((a == null ? void 0 : a.sessions) ?? []).map((
|
|
1686
|
+
((a == null ? void 0 : a.sessions) ?? []).map((o) => /* @__PURE__ */ t(
|
|
1639
1687
|
"p",
|
|
1640
1688
|
{
|
|
1641
1689
|
className: "flex items-center gap-2 text-[12px] text-slate-600 dark:text-slate-300",
|
|
1642
1690
|
children: [
|
|
1643
1691
|
/* @__PURE__ */ t("span", { className: "font-mono text-slate-400", children: [
|
|
1644
|
-
|
|
1692
|
+
o.sid_prefix,
|
|
1645
1693
|
"…"
|
|
1646
1694
|
] }),
|
|
1647
|
-
|
|
1695
|
+
o.current && /* @__PURE__ */ e("span", { className: "rounded bg-nvr-cyan/[0.08] px-1.5 py-px text-[10px] font-medium text-[#007a99] dark:text-nvr-cyan", children: "this session" }),
|
|
1648
1696
|
/* @__PURE__ */ t("span", { className: "ml-auto text-[11px] text-slate-400", children: [
|
|
1649
1697
|
"expires in ",
|
|
1650
|
-
Math.round(
|
|
1698
|
+
Math.round(o.ttl_seconds / 3600),
|
|
1651
1699
|
"h"
|
|
1652
1700
|
] })
|
|
1653
1701
|
]
|
|
1654
1702
|
},
|
|
1655
|
-
|
|
1703
|
+
o.sid_prefix
|
|
1656
1704
|
)),
|
|
1657
|
-
((a == null ? void 0 : a.logins) ?? []).length > 0 && /* @__PURE__ */ t(
|
|
1705
|
+
((a == null ? void 0 : a.logins) ?? []).length > 0 && /* @__PURE__ */ t(oe, { children: [
|
|
1658
1706
|
/* @__PURE__ */ e("p", { className: "pt-1 text-[11px] font-semibold uppercase tracking-wide text-slate-400", children: "Recent sign-ins" }),
|
|
1659
|
-
((a == null ? void 0 : a.logins) ?? []).slice(0, 8).map((
|
|
1707
|
+
((a == null ? void 0 : a.logins) ?? []).slice(0, 8).map((o, c) => (
|
|
1660
1708
|
// biome-ignore lint/suspicious/noArrayIndexKey: log rows
|
|
1661
1709
|
/* @__PURE__ */ t("p", { className: "flex items-center gap-2 text-[11.5px] text-slate-500", children: [
|
|
1662
|
-
/* @__PURE__ */ e("span", { className: "font-mono", children:
|
|
1663
|
-
|
|
1664
|
-
/* @__PURE__ */ e("span", { className: "ml-auto text-slate-400", children: new Date(
|
|
1665
|
-
] },
|
|
1710
|
+
/* @__PURE__ */ e("span", { className: "font-mono", children: o.ip ?? "—" }),
|
|
1711
|
+
o.new_ip && /* @__PURE__ */ e("span", { className: "rounded bg-amber-100 px-1 text-[9.5px] font-semibold text-amber-700 dark:bg-amber-400/15 dark:text-amber-400", children: "new IP" }),
|
|
1712
|
+
/* @__PURE__ */ e("span", { className: "ml-auto text-slate-400", children: new Date(o.created_at).toLocaleString() })
|
|
1713
|
+
] }, c)
|
|
1666
1714
|
))
|
|
1667
1715
|
] })
|
|
1668
1716
|
] })
|
|
1669
1717
|
] });
|
|
1670
1718
|
}
|
|
1671
|
-
function
|
|
1672
|
-
const
|
|
1719
|
+
function pt() {
|
|
1720
|
+
const i = T(), [u, a] = C(!1), { data: s } = q({
|
|
1673
1721
|
queryKey: ["my-permissions"],
|
|
1674
|
-
queryFn: () =>
|
|
1722
|
+
queryFn: () => i.request(F("/security/my/permissions")).then((l) => l.data),
|
|
1675
1723
|
enabled: u,
|
|
1676
1724
|
staleTime: 5 * 6e4
|
|
1677
1725
|
});
|
|
@@ -1680,7 +1728,7 @@ function ct() {
|
|
|
1680
1728
|
"button",
|
|
1681
1729
|
{
|
|
1682
1730
|
type: "button",
|
|
1683
|
-
onClick: () => a((
|
|
1731
|
+
onClick: () => a((l) => !l),
|
|
1684
1732
|
className: "flex w-full items-center justify-between px-4 py-2.5 text-left",
|
|
1685
1733
|
children: [
|
|
1686
1734
|
/* @__PURE__ */ t("div", { children: [
|
|
@@ -1701,7 +1749,7 @@ function ct() {
|
|
|
1701
1749
|
s.scopes.length > 0 && /* @__PURE__ */ t("p", { children: [
|
|
1702
1750
|
"Your data is limited to:",
|
|
1703
1751
|
" ",
|
|
1704
|
-
s.scopes.map((
|
|
1752
|
+
s.scopes.map((l) => `${l.dimension}: ${l.values.join(", ")}`).join(" · ")
|
|
1705
1753
|
] }),
|
|
1706
1754
|
!s.is_admin && /* @__PURE__ */ t("div", { children: [
|
|
1707
1755
|
/* @__PURE__ */ t("p", { className: "mb-1 text-[11px] font-semibold uppercase tracking-wide text-slate-400", children: [
|
|
@@ -1709,48 +1757,48 @@ function ct() {
|
|
|
1709
1757
|
s.collections.length,
|
|
1710
1758
|
")"
|
|
1711
1759
|
] }),
|
|
1712
|
-
/* @__PURE__ */ e("div", { className: "max-h-48 overflow-y-auto", children: s.collections.map((
|
|
1760
|
+
/* @__PURE__ */ e("div", { className: "max-h-48 overflow-y-auto", children: s.collections.map((l) => /* @__PURE__ */ t(
|
|
1713
1761
|
"p",
|
|
1714
1762
|
{
|
|
1715
1763
|
className: "flex items-center gap-2 border-b border-slate-50 py-0.5 text-[12px] last:border-b-0 dark:border-border/40",
|
|
1716
1764
|
children: [
|
|
1717
|
-
/* @__PURE__ */ e("span", { className: "font-mono", children:
|
|
1718
|
-
/* @__PURE__ */ e("span", { className: "ml-auto text-[10.5px] text-slate-400", children: [...new Set(
|
|
1765
|
+
/* @__PURE__ */ e("span", { className: "font-mono", children: l.collection }),
|
|
1766
|
+
/* @__PURE__ */ e("span", { className: "ml-auto text-[10.5px] text-slate-400", children: [...new Set(l.actions)].join(" · ") })
|
|
1719
1767
|
]
|
|
1720
1768
|
},
|
|
1721
|
-
|
|
1769
|
+
l.collection
|
|
1722
1770
|
)) })
|
|
1723
1771
|
] })
|
|
1724
1772
|
] })
|
|
1725
1773
|
] });
|
|
1726
1774
|
}
|
|
1727
|
-
function
|
|
1728
|
-
const
|
|
1775
|
+
function ht() {
|
|
1776
|
+
const i = T(), u = E(), { data: a } = q({
|
|
1729
1777
|
queryKey: ["nvr-profile-prefs"],
|
|
1730
|
-
queryFn: () =>
|
|
1778
|
+
queryFn: () => i.request(F("/users/me")).then((m) => {
|
|
1731
1779
|
var n;
|
|
1732
|
-
return ((n =
|
|
1780
|
+
return ((n = m.data) == null ? void 0 : n.preferences) ?? {};
|
|
1733
1781
|
})
|
|
1734
|
-
}), s =
|
|
1735
|
-
mutationFn: (
|
|
1736
|
-
onSuccess: (
|
|
1737
|
-
u.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }),
|
|
1782
|
+
}), s = _({
|
|
1783
|
+
mutationFn: (m) => i.request(V("/users/me/preferences", m)),
|
|
1784
|
+
onSuccess: (m, n) => {
|
|
1785
|
+
u.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }), le(Object.keys(n)), import("sonner").then(
|
|
1738
1786
|
({ toast: b }) => b.success("Saved — applied on all your open tabs and devices")
|
|
1739
1787
|
);
|
|
1740
1788
|
}
|
|
1741
|
-
}),
|
|
1789
|
+
}), l = (a == null ? void 0 : a.number_format) ?? {}, { data: o = [se, ...he] } = q({
|
|
1742
1790
|
queryKey: ["nvr-theme-accents"],
|
|
1743
|
-
queryFn: () =>
|
|
1744
|
-
|
|
1745
|
-
).then((
|
|
1791
|
+
queryFn: () => i.request(
|
|
1792
|
+
F("/settings")
|
|
1793
|
+
).then((m) => {
|
|
1746
1794
|
var n, b;
|
|
1747
1795
|
return [
|
|
1748
|
-
{ ...
|
|
1749
|
-
...Ke((b =
|
|
1796
|
+
{ ...se, color: ((n = m.data) == null ? void 0 : n.project_color) ?? null },
|
|
1797
|
+
...Ke((b = m.data) == null ? void 0 : b.theme_accents)
|
|
1750
1798
|
];
|
|
1751
|
-
}).catch(() => [
|
|
1799
|
+
}).catch(() => [se, ...he]),
|
|
1752
1800
|
staleTime: 5 * 6e4
|
|
1753
|
-
}),
|
|
1801
|
+
}), c = typeof (a == null ? void 0 : a.theme_accent) == "string" ? a.theme_accent : "brand";
|
|
1754
1802
|
return /* @__PURE__ */ t(
|
|
1755
1803
|
"div",
|
|
1756
1804
|
{
|
|
@@ -1765,10 +1813,10 @@ function mt() {
|
|
|
1765
1813
|
/* @__PURE__ */ t("label", { className: "flex items-center gap-1.5", children: [
|
|
1766
1814
|
"Timestamps",
|
|
1767
1815
|
/* @__PURE__ */ e(
|
|
1768
|
-
|
|
1816
|
+
M,
|
|
1769
1817
|
{
|
|
1770
1818
|
value: String((a == null ? void 0 : a.time_display) ?? "relative"),
|
|
1771
|
-
onChange: (
|
|
1819
|
+
onChange: (m) => s.mutate({ time_display: m }),
|
|
1772
1820
|
options: [
|
|
1773
1821
|
{ value: "relative", label: "Relative (3h ago)" },
|
|
1774
1822
|
{ value: "exact", label: "Exact (Aug 24, 3:12 PM)" }
|
|
@@ -1781,8 +1829,8 @@ function mt() {
|
|
|
1781
1829
|
"input",
|
|
1782
1830
|
{
|
|
1783
1831
|
type: "checkbox",
|
|
1784
|
-
checked:
|
|
1785
|
-
onChange: (
|
|
1832
|
+
checked: l.compact === !0,
|
|
1833
|
+
onChange: (m) => s.mutate({ number_format: { ...l, compact: m.target.checked } }),
|
|
1786
1834
|
className: "rounded"
|
|
1787
1835
|
}
|
|
1788
1836
|
),
|
|
@@ -1793,8 +1841,8 @@ function mt() {
|
|
|
1793
1841
|
/* @__PURE__ */ e(
|
|
1794
1842
|
"input",
|
|
1795
1843
|
{
|
|
1796
|
-
defaultValue:
|
|
1797
|
-
onBlur: (
|
|
1844
|
+
defaultValue: l.locale ?? "",
|
|
1845
|
+
onBlur: (m) => s.mutate({ number_format: { ...l, locale: m.target.value.trim() || void 0 } }),
|
|
1798
1846
|
placeholder: "en-US",
|
|
1799
1847
|
className: "h-7 w-20 rounded-md border border-slate-200 bg-background px-1.5 text-[12px] dark:border-border"
|
|
1800
1848
|
}
|
|
@@ -1803,10 +1851,10 @@ function mt() {
|
|
|
1803
1851
|
/* @__PURE__ */ t("label", { className: "flex items-center gap-1.5", children: [
|
|
1804
1852
|
"Week starts",
|
|
1805
1853
|
/* @__PURE__ */ e(
|
|
1806
|
-
|
|
1854
|
+
M,
|
|
1807
1855
|
{
|
|
1808
1856
|
value: String((a == null ? void 0 : a.week_start) ?? "sun"),
|
|
1809
|
-
onChange: (
|
|
1857
|
+
onChange: (m) => s.mutate({ week_start: m }),
|
|
1810
1858
|
options: [
|
|
1811
1859
|
{ value: "sun", label: "Sunday" },
|
|
1812
1860
|
{ value: "mon", label: "Monday" }
|
|
@@ -1816,34 +1864,34 @@ function mt() {
|
|
|
1816
1864
|
] }),
|
|
1817
1865
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", "data-theme-accent-picker": !0, children: [
|
|
1818
1866
|
"Accent",
|
|
1819
|
-
/* @__PURE__ */ e("span", { className: "flex items-center gap-1", children:
|
|
1820
|
-
const n =
|
|
1867
|
+
/* @__PURE__ */ e("span", { className: "flex items-center gap-1", children: o.map((m) => {
|
|
1868
|
+
const n = m.key === "brand" && c === "brand" || m.key === c;
|
|
1821
1869
|
return /* @__PURE__ */ e(
|
|
1822
1870
|
"button",
|
|
1823
1871
|
{
|
|
1824
1872
|
type: "button",
|
|
1825
|
-
title:
|
|
1826
|
-
"aria-label": `Accent ${
|
|
1873
|
+
title: m.label,
|
|
1874
|
+
"aria-label": `Accent ${m.label}`,
|
|
1827
1875
|
"aria-pressed": n,
|
|
1828
|
-
"data-theme-accent":
|
|
1829
|
-
onClick: () => s.mutate({ theme_accent:
|
|
1830
|
-
className:
|
|
1876
|
+
"data-theme-accent": m.key,
|
|
1877
|
+
onClick: () => s.mutate({ theme_accent: m.key === "brand" ? null : m.key }),
|
|
1878
|
+
className: $(
|
|
1831
1879
|
"h-5 w-5 rounded-full border-2 transition-transform",
|
|
1832
1880
|
n ? "scale-110 border-slate-800 dark:border-slate-100" : "border-transparent hover:scale-105"
|
|
1833
1881
|
),
|
|
1834
|
-
style: { background:
|
|
1882
|
+
style: { background: m.color ?? "var(--nvr-cyan)" }
|
|
1835
1883
|
},
|
|
1836
|
-
|
|
1884
|
+
m.key
|
|
1837
1885
|
);
|
|
1838
1886
|
}) })
|
|
1839
1887
|
] }),
|
|
1840
1888
|
/* @__PURE__ */ t("label", { className: "flex items-center gap-1.5", children: [
|
|
1841
1889
|
"Text size",
|
|
1842
1890
|
/* @__PURE__ */ e(
|
|
1843
|
-
|
|
1891
|
+
M,
|
|
1844
1892
|
{
|
|
1845
1893
|
value: String((a == null ? void 0 : a.font_size) ?? "default"),
|
|
1846
|
-
onChange: (
|
|
1894
|
+
onChange: (m) => s.mutate({ font_size: m }),
|
|
1847
1895
|
options: [
|
|
1848
1896
|
{ value: "small", label: "Small" },
|
|
1849
1897
|
{ value: "default", label: "Default" },
|
|
@@ -1858,11 +1906,11 @@ function mt() {
|
|
|
1858
1906
|
);
|
|
1859
1907
|
}
|
|
1860
1908
|
export {
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1909
|
+
Be as DelegationCard,
|
|
1910
|
+
ht as DisplayPrefsCard,
|
|
1911
|
+
tt as LinkAppCard,
|
|
1912
|
+
et as NotificationRulesCard,
|
|
1913
|
+
Xe as ProfileFieldsCard,
|
|
1914
|
+
It as ProfileView,
|
|
1915
|
+
at as TimezoneCard
|
|
1868
1916
|
};
|