@nivaro/react 0.2.56 → 0.3.1
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/components/slots/TasksSlot.js +31 -29
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +414 -1
- package/dist/index.js +767 -716
- package/dist/shared/components/ClientChaosToolbar.js +410 -0
- package/dist/shared/components/ItemEditForm.js +666 -658
- package/dist/shared/components/LoadErrorNote.js +49 -0
- package/dist/shared/components/MyWorkView.js +47 -37
- package/dist/shared/components/PretendDown.js +258 -0
- package/dist/shared/components/ProfileView.js +208 -184
- package/dist/shared/components/QueryErrorState.js +16 -0
- package/dist/shared/components/ReportView.js +1351 -1338
- package/dist/shared/components/WidgetSlot.js +438 -418
- package/dist/shared/components/ai/AiPlanCard.js +427 -0
- package/dist/shared/components/ai/AiPlanChanges.js +117 -0
- package/dist/shared/components/ai/TaskDo.js +1022 -0
- package/dist/shared/components/chaos/DeclareIncidentButton.js +72 -0
- package/dist/shared/components/chaos/DrillBanner.js +119 -0
- package/dist/shared/components/chaos/DrillTag.js +62 -0
- package/dist/shared/components/chaos/GameDayStrip.js +61 -0
- package/dist/shared/components/chat/ChatAnalyticsView.js +19 -17
- package/dist/shared/components/chat/ChatPanel.js +1356 -1317
- package/dist/shared/components/chat/HuddleAnalyticsTab.js +198 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +78 -65
- package/dist/shared/components/chat/chat-core.js +273 -264
- package/dist/shared/components/chat/huddle/HuddleAudioUi.js +397 -0
- package/dist/shared/components/chat/huddle/HuddleCallBar.js +296 -0
- package/dist/shared/components/chat/huddle/HuddleCallLayer.js +180 -0
- package/dist/shared/components/chat/huddle/HuddleCamera.js +124 -0
- package/dist/shared/components/chat/huddle/HuddleCollab.js +320 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +82 -121
- package/dist/shared/components/chat/huddle/HuddleDraw.js +231 -0
- package/dist/shared/components/chat/huddle/HuddleLiveBadge.js +52 -0
- package/dist/shared/components/chat/huddle/HuddlePeoplePicker.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleScheduleCard.js +190 -0
- package/dist/shared/components/chat/huddle/HuddleScheduleForm.js +188 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +184 -89
- package/dist/shared/components/chat/huddle/HuddleStageTools.js +197 -0
- package/dist/shared/components/chat/huddle/huddle-audio-logic.js +156 -0
- package/dist/shared/components/chat/huddle/huddle-audio.js +69 -0
- package/dist/shared/components/chat/huddle/huddle-calls.js +129 -0
- package/dist/shared/components/chat/huddle/huddle-camera.js +143 -0
- package/dist/shared/components/chat/huddle/huddle-collab-store.js +391 -0
- package/dist/shared/components/chat/huddle/huddle-device-prefs.js +55 -0
- package/dist/shared/components/chat/huddle/huddle-devices.js +99 -0
- package/dist/shared/components/chat/huddle/huddle-draw.js +226 -0
- package/dist/shared/components/chat/huddle/huddle-follow-bus.js +96 -0
- package/dist/shared/components/chat/huddle/huddle-hold.js +62 -0
- package/dist/shared/components/chat/huddle/huddle-link-quality.js +159 -0
- package/dist/shared/components/chat/huddle/huddle-live.js +82 -0
- package/dist/shared/components/chat/huddle/huddle-pip.js +343 -0
- package/dist/shared/components/chat/huddle/huddle-quality.js +22 -0
- package/dist/shared/components/chat/huddle/huddle-reactions.js +71 -0
- package/dist/shared/components/chat/huddle/huddle-ring-refused.js +34 -0
- package/dist/shared/components/chat/huddle/huddle-schedule.js +102 -0
- package/dist/shared/components/chat/huddle/huddle-sfu.js +176 -0
- package/dist/shared/components/chat/huddle/huddle-shortcuts.js +91 -0
- package/dist/shared/components/chat/huddle/huddle-speaking.js +100 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +431 -157
- package/dist/shared/components/chat/huddle/useHuddle.js +46 -38
- package/dist/shared/components/chat/huddle/useHuddleAudio.js +35 -0
- package/dist/shared/components/client-chaos-gate.js +51 -0
- package/dist/shared/components/integrations/console/SignalCard.js +172 -167
- package/dist/shared/components/item-edit/GroupSection.js +1 -0
- package/dist/shared/components/item-edit/RecordChatActions.js +68 -59
- package/dist/shared/components/item-edit/UserChip.js +145 -142
- package/dist/shared/components/layout-editor/EditorTopBar.js +108 -105
- package/dist/shared/components/layout-editor/LayoutEditor.js +514 -508
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +18 -10
- package/dist/shared/components/panels/TaskPanel.js +51 -49
- package/dist/shared/components/pipeline/PipelineEditorView.js +495 -479
- package/dist/shared/components/pipeline/TeamsView.js +184 -169
- package/dist/shared/components/support/TicketDetailSheet.js +57 -42
- package/dist/shared/lib/client-chaos.js +359 -0
- package/dist/shared/lib/load-error.js +26 -0
- package/dist/shared/lib/notification-sound.js +25 -16
- package/dist/shared/lib/socket-realtime.js +31 -30
- package/dist/shared/lib/worker-socket.js +108 -89
- package/package.json +2 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { AlertTriangle as l, RotateCw as o } from "lucide-react";
|
|
3
|
+
import { cn as a } from "../lib/utils.js";
|
|
4
|
+
function x({
|
|
5
|
+
message: n,
|
|
6
|
+
onRetry: i,
|
|
7
|
+
className: s,
|
|
8
|
+
centered: e = !1
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ t(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
role: "status",
|
|
14
|
+
"data-load-error": "",
|
|
15
|
+
className: a(
|
|
16
|
+
"flex gap-2 text-[12px] text-slate-600 dark:text-muted-foreground",
|
|
17
|
+
e ? "flex-col items-center text-center" : "items-start",
|
|
18
|
+
s
|
|
19
|
+
),
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ r(
|
|
22
|
+
l,
|
|
23
|
+
{
|
|
24
|
+
className: a("h-3.5 w-3.5 shrink-0 text-amber-500", !e && "mt-px"),
|
|
25
|
+
"aria-hidden": !0
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
/* @__PURE__ */ t("div", { className: a("min-w-0", e && "max-w-[240px]"), children: [
|
|
29
|
+
/* @__PURE__ */ r("p", { className: "leading-snug [text-wrap:balance]", children: n }),
|
|
30
|
+
i && /* @__PURE__ */ t(
|
|
31
|
+
"button",
|
|
32
|
+
{
|
|
33
|
+
type: "button",
|
|
34
|
+
onClick: i,
|
|
35
|
+
className: "mt-1 inline-flex items-center gap-1 rounded text-[12px] font-medium text-sky-700 hover:underline dark:text-nvr-cyan focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ r(o, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
38
|
+
"Try again"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
] })
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
x as LoadErrorNote
|
|
49
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as se, useQuery as oe, useMutation as
|
|
2
|
+
import { useQueryClient as se, useQuery as oe, useMutation as L } from "@tanstack/react-query";
|
|
3
3
|
import { useState as N, useRef as q, useEffect as E, useMemo as ie } from "react";
|
|
4
4
|
import { useApiFetchConfig as le, useItemNavigation as ce, useNavigation as me } from "../context.js";
|
|
5
5
|
import { useLiveEvent as ue } from "../lib/live.js";
|
|
@@ -9,36 +9,37 @@ import { useOptionalRealtime as he } from "../lib/realtime.js";
|
|
|
9
9
|
import { withinDay as G, slaChip as ge } from "../lib/sla-chip.js";
|
|
10
10
|
import { cn as A } from "../lib/utils.js";
|
|
11
11
|
import { FirstWeekCard as fe } from "./ai/FirstWeekCard.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
12
|
+
import { TaskDoButton as ke } from "./ai/TaskDo.js";
|
|
13
|
+
import { openChatRoom as ye, canOpenChatRoom as Ne } from "./chat/chat-core.js";
|
|
14
|
+
import { useMyRecordRooms as we } from "./chat/chat-hooks.js";
|
|
15
|
+
import { LearningPathCard as ve } from "./help-videos/viewer/LearningPathCard.js";
|
|
16
|
+
import { RequiredVideosCard as _e } from "./help-videos/viewer/RequiredVideosCard.js";
|
|
17
|
+
import { TickerNumber as Ce } from "./TickerNumber.js";
|
|
18
|
+
import { UserAvatar as $e } from "./UserAvatar.js";
|
|
19
|
+
const Se = 8e3, X = ["records", "tasks", "team", "waiting", "notifications"], Te = {
|
|
19
20
|
records: "Waiting on you",
|
|
20
21
|
tasks: "My tasks",
|
|
21
22
|
team: "Team tasks",
|
|
22
23
|
waiting: "Waiting on others",
|
|
23
24
|
notifications: "Notifications"
|
|
24
|
-
},
|
|
25
|
+
}, je = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), M = (l) => !!l && String(l).slice(0, 10) < je(), Ae = {
|
|
25
26
|
alert: "bg-red-500/10 text-red-600 dark:text-red-400",
|
|
26
27
|
warn: "bg-amber-400/15 text-amber-700 dark:text-amber-400",
|
|
27
28
|
neutral: "bg-slate-500/10 text-slate-600 dark:text-slate-400",
|
|
28
29
|
ok: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"
|
|
29
30
|
};
|
|
30
|
-
function
|
|
31
|
+
function Me({ sla: l }) {
|
|
31
32
|
const c = ge(l);
|
|
32
33
|
return c ? /* @__PURE__ */ e(
|
|
33
34
|
"span",
|
|
34
35
|
{
|
|
35
36
|
"data-sla-chip": c.tone,
|
|
36
|
-
className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums ${
|
|
37
|
+
className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums ${Ae[c.tone]}`,
|
|
37
38
|
children: c.label
|
|
38
39
|
}
|
|
39
40
|
) : null;
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
+
function Oe({ state: l, color: c }) {
|
|
42
43
|
return l ? /* @__PURE__ */ e(
|
|
43
44
|
"span",
|
|
44
45
|
{
|
|
@@ -54,10 +55,10 @@ function Me({ state: l, color: c }) {
|
|
|
54
55
|
function O({ label: l, value: c, tone: u }) {
|
|
55
56
|
return /* @__PURE__ */ s("div", { className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card", children: [
|
|
56
57
|
/* @__PURE__ */ e("p", { className: "text-[10.5px] uppercase tracking-wide text-muted-foreground", children: l }),
|
|
57
|
-
/* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${u ?? ""}`, children: /* @__PURE__ */ e(
|
|
58
|
+
/* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${u ?? ""}`, children: /* @__PURE__ */ e(Ce, { value: c }) })
|
|
58
59
|
] });
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
+
function Xe({
|
|
61
62
|
notificationRoutes: l,
|
|
62
63
|
onOpenPath: c
|
|
63
64
|
} = {}) {
|
|
@@ -65,7 +66,7 @@ function Ze({
|
|
|
65
66
|
var b, i;
|
|
66
67
|
const d = ((b = l == null ? void 0 : l.support) == null ? void 0 : b.call(l, String(t))) ?? ((i = _.consoleUrl) == null ? void 0 : i.call(_, `/support?ticket=${t}`)) ?? `/support?ticket=${t}`;
|
|
67
68
|
c ? c(d) : _.navigate(d);
|
|
68
|
-
},
|
|
69
|
+
}, D = he(), [R, C] = N(!1), [x, ee] = N(() => {
|
|
69
70
|
try {
|
|
70
71
|
const t = localStorage.getItem("nvr_mywork_sections");
|
|
71
72
|
if (t) {
|
|
@@ -98,7 +99,7 @@ function Ze({
|
|
|
98
99
|
}), z = q(0), g = q(null), J = () => {
|
|
99
100
|
const t = () => {
|
|
100
101
|
g.current = null, z.current = Date.now(), C(!1), h.invalidateQueries({ queryKey: ["my-work"] });
|
|
101
|
-
}, d = z.current +
|
|
102
|
+
}, d = z.current + Se - Date.now();
|
|
102
103
|
g.current || (d <= 0 ? t() : g.current = setTimeout(t, d));
|
|
103
104
|
};
|
|
104
105
|
pe("my-work", J, { debounceMs: 1500 }), ue("notification:new", J, { debounceMs: 1500 }), E(
|
|
@@ -113,19 +114,19 @@ function Ze({
|
|
|
113
114
|
...((a == null ? void 0 : a.team_tasks) ?? []).map((t) => `tt:${t.id}`),
|
|
114
115
|
...((a == null ? void 0 : a.requested) ?? []).map((t) => `r:${t.id}`),
|
|
115
116
|
...((a == null ? void 0 : a.notifications) ?? []).map((t) => `n:${t.id}`)
|
|
116
|
-
]), f = (t) => H.has(t) ? "bg-nvr-cyan/10 transition-colors duration-700" : "transition-colors duration-700",
|
|
117
|
+
]), f = (t) => H.has(t) ? "bg-nvr-cyan/10 transition-colors duration-700" : "transition-colors duration-700", F = ie(() => {
|
|
117
118
|
const t = /* @__PURE__ */ new Set();
|
|
118
119
|
for (const d of (a == null ? void 0 : a.owned) ?? []) d.collection && t.add(d.collection);
|
|
119
120
|
return [...t];
|
|
120
121
|
}, [a]);
|
|
121
122
|
E(() => {
|
|
122
|
-
if (!(!
|
|
123
|
-
return
|
|
123
|
+
if (!(!D || F.length === 0))
|
|
124
|
+
return D.subscribeCollections(F, () => {
|
|
124
125
|
const t = Date.now();
|
|
125
126
|
t - P.current < 3e4 || (P.current = t, C(!0));
|
|
126
127
|
});
|
|
127
|
-
}, [
|
|
128
|
-
const V =
|
|
128
|
+
}, [D, F]);
|
|
129
|
+
const V = L({
|
|
129
130
|
// A ticket closes through /support so its requester hears about it.
|
|
130
131
|
mutationFn: (t) => fetch(`${u}/${t.kind === "support" ? "support/tickets" : "tasks"}/${t.id}`, {
|
|
131
132
|
method: "PATCH",
|
|
@@ -134,7 +135,7 @@ function Ze({
|
|
|
134
135
|
body: JSON.stringify({ status: "done" })
|
|
135
136
|
}),
|
|
136
137
|
onSuccess: () => h.invalidateQueries({ queryKey: ["my-work"] })
|
|
137
|
-
}), S =
|
|
138
|
+
}), S = L({
|
|
138
139
|
mutationFn: async ({ id: t, action: d }) => {
|
|
139
140
|
const b = await fetch(`${u}/tasks/${t}/${d}`, {
|
|
140
141
|
method: "POST",
|
|
@@ -146,16 +147,16 @@ function Ze({
|
|
|
146
147
|
return d;
|
|
147
148
|
},
|
|
148
149
|
onSuccess: (t) => {
|
|
149
|
-
|
|
150
|
+
I(t === "claim" ? "It’s yours — it moved to My tasks." : "Reminder sent."), h.invalidateQueries({ queryKey: ["my-work"] });
|
|
150
151
|
},
|
|
151
|
-
onError: (t) =>
|
|
152
|
-
}), [T,
|
|
152
|
+
onError: (t) => I(t instanceof Error ? t.message : "Failed")
|
|
153
|
+
}), [T, I] = N(null);
|
|
153
154
|
E(() => {
|
|
154
155
|
if (!T) return;
|
|
155
|
-
const t = setTimeout(() =>
|
|
156
|
+
const t = setTimeout(() => I(null), 4e3);
|
|
156
157
|
return () => clearTimeout(t);
|
|
157
158
|
}, [T]);
|
|
158
|
-
const Y =
|
|
159
|
+
const Y = L({
|
|
159
160
|
mutationFn: (t) => fetch(`${u}/notifications/mark-read`, {
|
|
160
161
|
method: "POST",
|
|
161
162
|
headers: { ...w, "content-type": "application/json" },
|
|
@@ -240,7 +241,7 @@ function Ze({
|
|
|
240
241
|
te && /* @__PURE__ */ s("div", { className: "absolute right-0 top-full z-20 mt-1 w-56 rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
|
|
241
242
|
/* @__PURE__ */ e("p", { className: "px-1 pb-1.5 text-[11px] font-semibold text-slate-500", children: "Sections" }),
|
|
242
243
|
x.order.map((t, d) => {
|
|
243
|
-
const b =
|
|
244
|
+
const b = Te[t] ?? t, i = x.hidden.includes(t), m = (r) => {
|
|
244
245
|
const p = [...x.order], n = d + r;
|
|
245
246
|
n < 0 || n >= p.length || ([p[d], p[n]] = [p[n], p[d]], K({ ...x, order: p }));
|
|
246
247
|
};
|
|
@@ -299,8 +300,8 @@ function Ze({
|
|
|
299
300
|
children: T
|
|
300
301
|
}
|
|
301
302
|
),
|
|
303
|
+
/* @__PURE__ */ e(_e, { className: "mb-4" }),
|
|
302
304
|
/* @__PURE__ */ e(ve, { className: "mb-4" }),
|
|
303
|
-
/* @__PURE__ */ e(we, { className: "mb-4" }),
|
|
304
305
|
(() => {
|
|
305
306
|
const t = {
|
|
306
307
|
records: () => {
|
|
@@ -349,8 +350,8 @@ function Ze({
|
|
|
349
350
|
children: [
|
|
350
351
|
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] font-medium", children: o.label }),
|
|
351
352
|
/* @__PURE__ */ e("span", { className: "hidden text-[11px] text-muted-foreground sm:inline", children: o.collection.replace(/_/g, " ") }),
|
|
352
|
-
/* @__PURE__ */ e(
|
|
353
|
-
/* @__PURE__ */ e(
|
|
353
|
+
/* @__PURE__ */ e(Oe, { state: o.state, color: o.state_color }),
|
|
354
|
+
/* @__PURE__ */ e(Me, { sla: o.sla })
|
|
354
355
|
]
|
|
355
356
|
}
|
|
356
357
|
)
|
|
@@ -391,6 +392,15 @@ function Ze({
|
|
|
391
392
|
]
|
|
392
393
|
}
|
|
393
394
|
),
|
|
395
|
+
/* @__PURE__ */ e(
|
|
396
|
+
ke,
|
|
397
|
+
{
|
|
398
|
+
task: r,
|
|
399
|
+
isAssignee: !0,
|
|
400
|
+
compact: !0,
|
|
401
|
+
onTaskChanged: () => void h.invalidateQueries({ queryKey: ["my-work"] })
|
|
402
|
+
}
|
|
403
|
+
),
|
|
394
404
|
r.due_date && /* @__PURE__ */ e(
|
|
395
405
|
"span",
|
|
396
406
|
{
|
|
@@ -552,7 +562,7 @@ function Ze({
|
|
|
552
562
|
className: A("flex items-start gap-2.5 px-4 py-2", f(`n:${r.id}`)),
|
|
553
563
|
children: [
|
|
554
564
|
/* @__PURE__ */ e(
|
|
555
|
-
|
|
565
|
+
$e,
|
|
556
566
|
{
|
|
557
567
|
userId: r.sender,
|
|
558
568
|
className: "mt-0.5 h-5 w-5",
|
|
@@ -603,11 +613,11 @@ function Ze({
|
|
|
603
613
|
}
|
|
604
614
|
return i;
|
|
605
615
|
})(),
|
|
606
|
-
/* @__PURE__ */ e(
|
|
616
|
+
/* @__PURE__ */ e(De, {})
|
|
607
617
|
] });
|
|
608
618
|
}
|
|
609
|
-
function
|
|
610
|
-
const l =
|
|
619
|
+
function De() {
|
|
620
|
+
const l = Ne(), { rooms: c } = we(l);
|
|
611
621
|
return !l || c.length === 0 ? null : /* @__PURE__ */ s(
|
|
612
622
|
"section",
|
|
613
623
|
{
|
|
@@ -619,7 +629,7 @@ function Oe() {
|
|
|
619
629
|
"button",
|
|
620
630
|
{
|
|
621
631
|
type: "button",
|
|
622
|
-
onClick: () =>
|
|
632
|
+
onClick: () => ye(u.room, u.label),
|
|
623
633
|
className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-muted/40",
|
|
624
634
|
"data-my-work-chat-room": u.room,
|
|
625
635
|
children: [
|
|
@@ -640,5 +650,5 @@ function Oe() {
|
|
|
640
650
|
);
|
|
641
651
|
}
|
|
642
652
|
export {
|
|
643
|
-
|
|
653
|
+
Xe as MyWorkView
|
|
644
654
|
};
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { jsxs as c, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as $ } from "@tanstack/react-query";
|
|
3
|
+
import { PlugZap as m, Radio as v, Bot as N, Handshake as y, LayoutGrid as D, Database as E } from "lucide-react";
|
|
4
|
+
import { useEffect as C, useCallback as I } from "react";
|
|
5
|
+
import { clearPretendDown as A, getPretendDown as f, setPretendDown as R, PRETEND_DOWN_EVENT as S } from "../lib/client-chaos.js";
|
|
6
|
+
import { cn as o, titleCase as T } from "../lib/utils.js";
|
|
7
|
+
import { useClientChaosGate as h, usePretendDownVersion as O } from "./client-chaos-gate.js";
|
|
8
|
+
import { Popover as q, PopoverTrigger as L, PopoverContent as j } from "./ui/popover.js";
|
|
9
|
+
const z = "layout-editor", W = {
|
|
10
|
+
query: /* @__PURE__ */ a(E, { className: "h-3.5 w-3.5" }),
|
|
11
|
+
data: /* @__PURE__ */ a(D, { className: "h-3.5 w-3.5" }),
|
|
12
|
+
partner: /* @__PURE__ */ a(y, { className: "h-3.5 w-3.5" }),
|
|
13
|
+
ai: /* @__PURE__ */ a(N, { className: "h-3.5 w-3.5" }),
|
|
14
|
+
realtime: /* @__PURE__ */ a(v, { className: "h-3.5 w-3.5" }),
|
|
15
|
+
panel: /* @__PURE__ */ a(m, { className: "h-3.5 w-3.5" })
|
|
16
|
+
};
|
|
17
|
+
function J(t) {
|
|
18
|
+
C(() => () => A(t), [t]);
|
|
19
|
+
}
|
|
20
|
+
function w(t) {
|
|
21
|
+
return O(), f(t).map((n) => n.id);
|
|
22
|
+
}
|
|
23
|
+
function G(t, n) {
|
|
24
|
+
const s = $();
|
|
25
|
+
return I(
|
|
26
|
+
(i) => {
|
|
27
|
+
const l = new Set(f(t).map((r) => r.id));
|
|
28
|
+
l.has(i) ? l.delete(i) : l.add(i), R(
|
|
29
|
+
t,
|
|
30
|
+
n.filter((r) => l.has(r.id))
|
|
31
|
+
), s.invalidateQueries({ refetchType: "active" }), typeof window < "u" && window.dispatchEvent(new CustomEvent(S));
|
|
32
|
+
},
|
|
33
|
+
[t, n, s]
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
function b({
|
|
37
|
+
scope: t,
|
|
38
|
+
options: n,
|
|
39
|
+
className: s
|
|
40
|
+
}) {
|
|
41
|
+
const i = new Set(w(t)), l = G(t, n);
|
|
42
|
+
return /* @__PURE__ */ c("div", { className: s, children: [
|
|
43
|
+
/* @__PURE__ */ a("p", { className: "text-[12px] font-medium text-slate-700 dark:text-foreground", children: "Pretend down" }),
|
|
44
|
+
/* @__PURE__ */ a("p", { className: "mt-0.5 text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: "See how this view copes when something it uses fails. Only you, only here, until you leave." }),
|
|
45
|
+
n.length === 0 ? /* @__PURE__ */ a("p", { className: "mt-2 text-[12px] text-slate-500 dark:text-muted-foreground", children: "This view uses nothing that can be pretended down yet." }) : /* @__PURE__ */ a("ul", { className: "-mx-1.5 mt-1.5 space-y-px", children: n.map((r) => {
|
|
46
|
+
const e = i.has(r.id);
|
|
47
|
+
return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ c(
|
|
48
|
+
"button",
|
|
49
|
+
{
|
|
50
|
+
type: "button",
|
|
51
|
+
role: "switch",
|
|
52
|
+
"aria-checked": e,
|
|
53
|
+
onClick: () => l(r.id),
|
|
54
|
+
className: o(
|
|
55
|
+
"flex w-full items-center gap-2.5 rounded-md px-1.5 py-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
56
|
+
e ? "bg-amber-50 dark:bg-amber-400/10" : "hover:bg-muted"
|
|
57
|
+
),
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ a(
|
|
60
|
+
"span",
|
|
61
|
+
{
|
|
62
|
+
className: o(
|
|
63
|
+
"flex h-6 w-6 shrink-0 items-center justify-center rounded-md",
|
|
64
|
+
e ? "bg-amber-100 text-amber-700 dark:bg-amber-400/15 dark:text-amber-300" : "bg-slate-100 text-slate-500 dark:bg-white/[0.06] dark:text-muted-foreground"
|
|
65
|
+
),
|
|
66
|
+
children: W[r.kind]
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
/* @__PURE__ */ c("span", { className: "min-w-0 flex-1", children: [
|
|
70
|
+
/* @__PURE__ */ a("span", { className: "block truncate text-[12.5px] leading-tight", children: r.label }),
|
|
71
|
+
(e || r.hint) && /* @__PURE__ */ a("span", { className: "block truncate text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: e ? "Pretending it is down" : r.hint })
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ a(
|
|
74
|
+
"span",
|
|
75
|
+
{
|
|
76
|
+
"aria-hidden": !0,
|
|
77
|
+
className: o(
|
|
78
|
+
"relative h-4 w-7 shrink-0 rounded-full transition-colors motion-reduce:transition-none",
|
|
79
|
+
e ? "bg-amber-500" : "bg-slate-200 dark:bg-white/[0.15]"
|
|
80
|
+
),
|
|
81
|
+
children: /* @__PURE__ */ a(
|
|
82
|
+
"span",
|
|
83
|
+
{
|
|
84
|
+
className: o(
|
|
85
|
+
"absolute top-0.5 h-3 w-3 rounded-full bg-white shadow-sm transition-transform motion-reduce:transition-none",
|
|
86
|
+
e ? "translate-x-3.5" : "translate-x-0.5"
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
) }, r.id);
|
|
95
|
+
}) })
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
function X({
|
|
99
|
+
scope: t,
|
|
100
|
+
options: n,
|
|
101
|
+
user: s,
|
|
102
|
+
className: i
|
|
103
|
+
}) {
|
|
104
|
+
const l = h(s), r = w(t).length;
|
|
105
|
+
return l.allowed ? /* @__PURE__ */ c(q, { children: [
|
|
106
|
+
/* @__PURE__ */ a(L, { asChild: !0, children: /* @__PURE__ */ c(
|
|
107
|
+
"button",
|
|
108
|
+
{
|
|
109
|
+
type: "button",
|
|
110
|
+
"data-pretend-down": "",
|
|
111
|
+
"data-tip": "Pretend a dependency is down and see how this view copes (only you)",
|
|
112
|
+
className: o(
|
|
113
|
+
"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border px-2.5 text-[12px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
114
|
+
r > 0 ? "border-amber-300 bg-amber-50 text-amber-800 hover:bg-amber-100 dark:border-amber-400/30 dark:bg-amber-400/10 dark:text-amber-200 dark:hover:bg-amber-400/15" : "border-slate-200 text-slate-600 hover:bg-muted dark:border-border dark:text-muted-foreground",
|
|
115
|
+
i
|
|
116
|
+
),
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ a(m, { className: "h-3.5 w-3.5" }),
|
|
119
|
+
/* @__PURE__ */ a("span", { children: r > 0 ? `${r} down` : "Pretend down" })
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
) }),
|
|
123
|
+
/* @__PURE__ */ a(j, { align: "end", className: "w-[300px] p-3", children: /* @__PURE__ */ a(b, { scope: t, options: n }) })
|
|
124
|
+
] }) : null;
|
|
125
|
+
}
|
|
126
|
+
const B = { is_admin: !0 };
|
|
127
|
+
function ee({
|
|
128
|
+
scope: t,
|
|
129
|
+
options: n
|
|
130
|
+
}) {
|
|
131
|
+
return h(B).allowed ? /* @__PURE__ */ a(
|
|
132
|
+
b,
|
|
133
|
+
{
|
|
134
|
+
scope: t,
|
|
135
|
+
options: n,
|
|
136
|
+
className: "mt-3 border-t border-slate-100 pt-3 dark:border-border"
|
|
137
|
+
}
|
|
138
|
+
) : null;
|
|
139
|
+
}
|
|
140
|
+
const g = (t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
141
|
+
function x(t = {}) {
|
|
142
|
+
const n = [];
|
|
143
|
+
return t.ai !== !1 && n.push({
|
|
144
|
+
id: "ai",
|
|
145
|
+
kind: "ai",
|
|
146
|
+
label: "AI gateway",
|
|
147
|
+
hint: "Ask AI, AI fill and summaries",
|
|
148
|
+
patterns: [/^\/ai(\/|$)/, /^\/ask(\/|$)/]
|
|
149
|
+
}), t.partners !== !1 && n.push({
|
|
150
|
+
id: "partners",
|
|
151
|
+
kind: "partner",
|
|
152
|
+
label: "Partners and external APIs",
|
|
153
|
+
hint: "Calls out to other systems",
|
|
154
|
+
status: 502,
|
|
155
|
+
patterns: [/^\/external-apis(\/|$)/, /^\/integrations?(\/|$)/, /^\/erp-submissions(\/|$)/]
|
|
156
|
+
}), n.push({
|
|
157
|
+
id: "realtime",
|
|
158
|
+
kind: "realtime",
|
|
159
|
+
label: "Live updates",
|
|
160
|
+
hint: "The socket: presence, live figures",
|
|
161
|
+
patterns: [],
|
|
162
|
+
socket: !0
|
|
163
|
+
}), n;
|
|
164
|
+
}
|
|
165
|
+
const M = [
|
|
166
|
+
{
|
|
167
|
+
field: "__pipeline__",
|
|
168
|
+
id: "panel:pipeline",
|
|
169
|
+
label: "Pipeline panel",
|
|
170
|
+
patterns: [/^\/pipelines\/instance(\/|$)/, /^\/workflows\/instance(\/|$)/]
|
|
171
|
+
},
|
|
172
|
+
{ field: "__owners__", id: "panel:owners", label: "Owners panel", patterns: [/\/owners(\/|$)/] },
|
|
173
|
+
{
|
|
174
|
+
field: "__comments__",
|
|
175
|
+
id: "panel:comments",
|
|
176
|
+
label: "Comments panel",
|
|
177
|
+
patterns: [/^\/comments(\/|$)/]
|
|
178
|
+
},
|
|
179
|
+
{ field: "__tasks__", id: "panel:tasks", label: "Tasks panel", patterns: [/^\/tasks(\/|$)/] },
|
|
180
|
+
{
|
|
181
|
+
field: "__addendums__",
|
|
182
|
+
id: "panel:addendums",
|
|
183
|
+
label: "Addendums panel",
|
|
184
|
+
patterns: [/^\/addendums(\/|$)/]
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
field: "__related_records__",
|
|
188
|
+
id: "panel:related",
|
|
189
|
+
label: "Related records panel",
|
|
190
|
+
patterns: [/^\/items\/[^/]+\/[^/]+\/related(\/|$)/, /^\/related-records(\/|$)/]
|
|
191
|
+
},
|
|
192
|
+
{ field: "__pdf__", id: "panel:pdf", label: "PDF panel", patterns: [/^\/pdf(-templates)?(\/|$)/] }
|
|
193
|
+
];
|
|
194
|
+
function te(t) {
|
|
195
|
+
var r;
|
|
196
|
+
const n = (t == null ? void 0 : t.assignments) ?? [], s = [], i = /* @__PURE__ */ new Map();
|
|
197
|
+
for (const e of n) {
|
|
198
|
+
const d = e.field ?? "";
|
|
199
|
+
d.startsWith("__widget_") && d.endsWith("__") && e.widget_id != null && i.set(String(e.widget_id), ((r = e.label) == null ? void 0 : r.trim()) || null);
|
|
200
|
+
}
|
|
201
|
+
for (const [e, d] of i)
|
|
202
|
+
s.push({
|
|
203
|
+
id: `widget:${e}`,
|
|
204
|
+
kind: "query",
|
|
205
|
+
label: d ?? `Record widget ${e}`,
|
|
206
|
+
hint: "Its query or rollup",
|
|
207
|
+
status: 500,
|
|
208
|
+
patterns: [new RegExp(`^/widgets-internal/${g(e)}(/|$)`)]
|
|
209
|
+
});
|
|
210
|
+
const l = new Set(n.map((e) => e.field ?? ""));
|
|
211
|
+
for (const e of M)
|
|
212
|
+
l.has(e.field) && s.push({ id: e.id, kind: "panel", label: e.label, patterns: e.patterns });
|
|
213
|
+
return [...s, ...x()];
|
|
214
|
+
}
|
|
215
|
+
function ne(t, n = {}) {
|
|
216
|
+
var r;
|
|
217
|
+
const s = /* @__PURE__ */ new Map(), i = (e, d, p, _, k = []) => {
|
|
218
|
+
const u = s.get(e) ?? { label: d, kind: p, ids: [], extra: [] };
|
|
219
|
+
u.ids.push(_);
|
|
220
|
+
for (const P of k) u.extra.push(P);
|
|
221
|
+
s.set(e, u);
|
|
222
|
+
};
|
|
223
|
+
for (const e of t)
|
|
224
|
+
e.type === "ai_query" ? i("ai", "Ask AI charts", "ai", e.id) : e.type === "report_preset" ? i("preset", "Report presets", "query", e.id, [
|
|
225
|
+
/^\/report-studio\/widget-presets(\/|$)/,
|
|
226
|
+
/^\/custom-queries(\/|$)/
|
|
227
|
+
]) : e.type === "cumulative_flow" ? i("flow", "Pipeline flow", "data", e.id) : e.collection && i(
|
|
228
|
+
`c:${e.collection}`,
|
|
229
|
+
((r = n[e.collection]) == null ? void 0 : r.trim()) || T(e.collection),
|
|
230
|
+
"data",
|
|
231
|
+
e.id
|
|
232
|
+
);
|
|
233
|
+
const l = [];
|
|
234
|
+
for (const [e, d] of s) {
|
|
235
|
+
const p = d.ids.map(g).join("|");
|
|
236
|
+
l.push({
|
|
237
|
+
id: `dash:${e}`,
|
|
238
|
+
kind: d.kind,
|
|
239
|
+
label: d.kind === "data" && e.startsWith("c:") ? `${d.label} data` : d.label,
|
|
240
|
+
hint: `${d.ids.length} widget${d.ids.length === 1 ? "" : "s"}`,
|
|
241
|
+
status: 500,
|
|
242
|
+
patterns: [new RegExp(`^/dashboards/widgets/(${p})(/|$)`), ...d.extra]
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
return [...l, ...x({ partners: !1 })];
|
|
246
|
+
}
|
|
247
|
+
export {
|
|
248
|
+
z as LAYOUT_PRETEND_SCOPE,
|
|
249
|
+
X as PretendDownButton,
|
|
250
|
+
b as PretendDownList,
|
|
251
|
+
ee as PretendDownSection,
|
|
252
|
+
x as commonPretendDownOptions,
|
|
253
|
+
ne as dashboardPretendDownOptions,
|
|
254
|
+
te as layoutPretendDownOptions,
|
|
255
|
+
w as usePretendDownIds,
|
|
256
|
+
J as usePretendDownScope,
|
|
257
|
+
G as usePretendDownToggle
|
|
258
|
+
};
|