@nivaro/react 0.3.67 → 0.3.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +836 -835
- package/dist/shared/components/ConformanceView.js +34 -34
- package/dist/shared/components/ReportView.js +196 -196
- package/dist/shared/components/SlaRulesView.js +36 -36
- package/dist/shared/components/chat/ChatPanel.js +484 -487
- package/dist/shared/components/chat/ChatViews.js +66 -66
- package/dist/shared/components/chat/RoomParts.js +159 -157
- package/dist/shared/components/help-videos/editor/StatsTab.js +48 -47
- package/dist/shared/components/help-videos/editor/VersionsTab.js +17 -16
- package/dist/shared/components/imports/CollectionImportPanel.js +72 -72
- package/dist/shared/components/item-edit/FieldRow.js +87 -87
- package/dist/shared/components/item-edit/FilePickerField.js +281 -297
- package/dist/shared/components/item-edit/RecordInsights.js +90 -91
- package/dist/shared/components/item-edit/SummaryPanel.js +31 -31
- package/dist/shared/components/layout-editor/assist/ExplainDiff.js +12 -12
- package/dist/shared/components/panels/AddendumPanel.js +409 -411
- package/dist/shared/components/panels/CommentPanel.js +169 -162
- package/dist/shared/components/panels/PipelinePanel.js +75 -75
- package/dist/shared/components/panels/RevisionsPanel.js +103 -103
- package/dist/shared/components/queue/QueueWorklist.js +142 -141
- package/dist/shared/lib/format-value.js +15 -15
- package/dist/shared/lib/utils.js +58 -53
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { useMemo as H, useState as _ } from "react";
|
|
|
5
5
|
import { toast as E } from "sonner";
|
|
6
6
|
import { useNivaroClient as X, useItemNavigation as Le } from "../context.js";
|
|
7
7
|
import { get as I, post as he, patch as se, del as Pe } from "../lib/commands.js";
|
|
8
|
-
import { titleCase as le, cn as M } from "../lib/utils.js";
|
|
8
|
+
import { titleCase as le, cn as M, toLocalDateString as Te } from "../lib/utils.js";
|
|
9
9
|
import { Badge as z } from "./ui/badge.js";
|
|
10
10
|
import { Button as P } from "./ui/button.js";
|
|
11
11
|
import { Command as ue, CommandInput as pe, CommandList as fe, CommandEmpty as xe, CommandGroup as ge, CommandItem as G } from "./ui/command.js";
|
|
@@ -13,10 +13,10 @@ import { Dialog as Z, DialogContent as J, DialogHeader as Y, DialogTitle as ee,
|
|
|
13
13
|
import { Input as V } from "./ui/input.js";
|
|
14
14
|
import { Label as K } from "./ui/label.js";
|
|
15
15
|
import { Popover as we, PopoverTrigger as ye, PopoverContent as _e } from "./ui/popover.js";
|
|
16
|
-
import { SimpleSelectXs as
|
|
17
|
-
import { Select as De, SelectTrigger as
|
|
16
|
+
import { SimpleSelectXs as Ue } from "./ui/SimpleSelect.js";
|
|
17
|
+
import { Select as De, SelectTrigger as Re, SelectValue as Ee, SelectContent as Me, SelectItem as Ie } from "./ui/select.js";
|
|
18
18
|
import { Switch as B } from "./ui/switch.js";
|
|
19
|
-
const
|
|
19
|
+
const Oe = {
|
|
20
20
|
workflow_template: "",
|
|
21
21
|
state_keys: [],
|
|
22
22
|
name: "",
|
|
@@ -32,7 +32,7 @@ const Ie = {
|
|
|
32
32
|
function O(i) {
|
|
33
33
|
return [i.first_name, i.last_name].filter(Boolean).join(" ") || i.email;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function je(i) {
|
|
36
36
|
var p;
|
|
37
37
|
return `${((p = i.split("/").pop()) == null ? void 0 : p.replace(/_/g, " ")) ?? i} clock`;
|
|
38
38
|
}
|
|
@@ -81,7 +81,7 @@ function ie({
|
|
|
81
81
|
userValue: A = (q) => q.id,
|
|
82
82
|
compact: s
|
|
83
83
|
}) {
|
|
84
|
-
const q = X(), [v, k] = _(!1), [g, S] = _(""), [x,
|
|
84
|
+
const q = X(), [v, k] = _(!1), [g, S] = _(""), [x, U] = _(null), f = u ? T.find((d) => d.value === u) : null, $ = u && !f ? N.find((d) => A(d).toUpperCase() === u.toUpperCase()) ?? (x && A(x).toUpperCase() === u.toUpperCase() ? x : null) : null, { data: C } = j({
|
|
85
85
|
queryKey: ["sla-user-search", g],
|
|
86
86
|
enabled: v && g.trim().length > 0,
|
|
87
87
|
staleTime: 6e4,
|
|
@@ -90,7 +90,7 @@ function ie({
|
|
|
90
90
|
`/users?search=${encodeURIComponent(g.trim())}&limit=30&sort=first_name`
|
|
91
91
|
)
|
|
92
92
|
)).data
|
|
93
|
-
}),
|
|
93
|
+
}), D = H(() => [...g.trim() && C ? C : N].sort((r, h) => O(r).localeCompare(O(h))), [N, C, g]), F = (d) => c[String(d.role ?? "").toUpperCase()];
|
|
94
94
|
return /* @__PURE__ */ a(we, { modal: !0, open: v, onOpenChange: k, children: [
|
|
95
95
|
/* @__PURE__ */ e(ye, { asChild: !0, children: /* @__PURE__ */ a(
|
|
96
96
|
"button",
|
|
@@ -149,14 +149,14 @@ function ie({
|
|
|
149
149
|
},
|
|
150
150
|
d.value
|
|
151
151
|
)),
|
|
152
|
-
|
|
152
|
+
D.map((d) => {
|
|
153
153
|
const r = A(d);
|
|
154
154
|
return /* @__PURE__ */ a(
|
|
155
155
|
G,
|
|
156
156
|
{
|
|
157
157
|
value: `${O(d)} ${d.email}`,
|
|
158
158
|
onSelect: () => {
|
|
159
|
-
|
|
159
|
+
U(d), p(r), k(!1);
|
|
160
160
|
},
|
|
161
161
|
className: "gap-2 text-[12px]",
|
|
162
162
|
children: [
|
|
@@ -182,7 +182,7 @@ function ie({
|
|
|
182
182
|
] }) })
|
|
183
183
|
] });
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function We(i, u) {
|
|
186
186
|
if (i.notify === "owner") return "owners again";
|
|
187
187
|
if (i.notify === "manager") return "managers";
|
|
188
188
|
if (i.notify.startsWith("user:")) {
|
|
@@ -201,7 +201,7 @@ function de({
|
|
|
201
201
|
onCancel: T,
|
|
202
202
|
saving: b
|
|
203
203
|
}) {
|
|
204
|
-
const A = X(), [s, q] = _(i ??
|
|
204
|
+
const A = X(), [s, q] = _(i ?? Oe), [v, k] = _(!1), [g, S] = _(!1), [x, U] = _(null);
|
|
205
205
|
function f(r, h) {
|
|
206
206
|
q((w) => ({ ...w, [r]: h }));
|
|
207
207
|
}
|
|
@@ -215,7 +215,7 @@ function de({
|
|
|
215
215
|
var h;
|
|
216
216
|
return ((h = $.find((w) => w.key === r)) == null ? void 0 : h.label) ?? r;
|
|
217
217
|
};
|
|
218
|
-
function
|
|
218
|
+
function D(r) {
|
|
219
219
|
q((h) => {
|
|
220
220
|
const w = h.state_keys.includes(r), n = c ? w ? h.state_keys.filter((o) => o !== r) : [...h.state_keys, r] : [r];
|
|
221
221
|
return { ...h, state_keys: n };
|
|
@@ -245,8 +245,8 @@ function de({
|
|
|
245
245
|
value: s.workflow_template,
|
|
246
246
|
onValueChange: (r) => q((h) => ({ ...h, workflow_template: r, state_keys: [] })),
|
|
247
247
|
children: [
|
|
248
|
-
/* @__PURE__ */ e(
|
|
249
|
-
/* @__PURE__ */ e(
|
|
248
|
+
/* @__PURE__ */ e(Re, { id: "sla-template", children: /* @__PURE__ */ e(Ee, { placeholder: "Select a workflow…" }) }),
|
|
249
|
+
/* @__PURE__ */ e(Me, { children: u.map((r) => /* @__PURE__ */ e(Ie, { value: r.id, children: r.name }, r.id)) })
|
|
250
250
|
]
|
|
251
251
|
}
|
|
252
252
|
)
|
|
@@ -275,7 +275,7 @@ function de({
|
|
|
275
275
|
G,
|
|
276
276
|
{
|
|
277
277
|
value: `${r.label} ${r.key}`,
|
|
278
|
-
onSelect: () =>
|
|
278
|
+
onSelect: () => D(r.key),
|
|
279
279
|
children: [
|
|
280
280
|
/* @__PURE__ */ e(
|
|
281
281
|
ae,
|
|
@@ -311,7 +311,7 @@ function de({
|
|
|
311
311
|
onChange: (r) => f("duration_hours", Number(r.target.value))
|
|
312
312
|
}
|
|
313
313
|
),
|
|
314
|
-
/* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1 pt-1", "data-sla-presets": !0, children:
|
|
314
|
+
/* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1 pt-1", "data-sla-presets": !0, children: ze.map((r) => {
|
|
315
315
|
const h = s.duration_hours === r.hours && s.business_hours_only === r.business;
|
|
316
316
|
return /* @__PURE__ */ e(
|
|
317
317
|
"button",
|
|
@@ -560,7 +560,7 @@ function de({
|
|
|
560
560
|
warning_threshold_pct: s.warning_threshold_pct,
|
|
561
561
|
business_hours_only: s.business_hours_only
|
|
562
562
|
})
|
|
563
|
-
).then((r) =>
|
|
563
|
+
).then((r) => U(r.data)).catch(() => E.error("Preview failed")).finally(() => S(!1));
|
|
564
564
|
},
|
|
565
565
|
children: g ? "Previewing…" : "Preview impact"
|
|
566
566
|
}
|
|
@@ -570,7 +570,7 @@ function de({
|
|
|
570
570
|
] })
|
|
571
571
|
] });
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function Ke({ rule: i }) {
|
|
574
574
|
var w, n, o;
|
|
575
575
|
const u = X(), { urlFor: p, open: N } = Le(), { data: c, isLoading: L } = j({
|
|
576
576
|
queryKey: ["sla-rule-records", i.id],
|
|
@@ -579,9 +579,9 @@ function We({ rule: i }) {
|
|
|
579
579
|
ok: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400",
|
|
580
580
|
warning: "bg-amber-500/10 text-amber-700 dark:text-amber-400",
|
|
581
581
|
breached: "bg-red-500/10 text-red-700 dark:text-red-400"
|
|
582
|
-
}, [b, A] = _(null), [s, q] = _(""), [v, k] = _(""), [g, S] = _({ op: "gte", v: "" }), [x,
|
|
582
|
+
}, [b, A] = _(null), [s, q] = _(""), [v, k] = _(""), [g, S] = _({ op: "gte", v: "" }), [x, U] = _({ op: "lte", v: "" }), [f, $] = _(""), C = (t) => A(
|
|
583
583
|
(l) => (l == null ? void 0 : l.key) === t ? l.dir === "asc" ? { key: t, dir: "desc" } : null : { key: t, dir: "asc" }
|
|
584
|
-
),
|
|
584
|
+
), D = { breached: 0, warning: 1, ok: 2 }, F = H(() => {
|
|
585
585
|
let t = (c == null ? void 0 : c.records) ?? [];
|
|
586
586
|
if (s.trim()) {
|
|
587
587
|
const l = s.trim().toLowerCase();
|
|
@@ -605,7 +605,7 @@ function We({ rule: i }) {
|
|
|
605
605
|
}
|
|
606
606
|
if (b) {
|
|
607
607
|
const l = b.dir === "asc" ? 1 : -1;
|
|
608
|
-
t = [...t].sort((m, y) => b.key === "label" ? m.label.localeCompare(y.label) * l : b.key === "status" ? (
|
|
608
|
+
t = [...t].sort((m, y) => b.key === "label" ? m.label.localeCompare(y.label) * l : b.key === "status" ? (D[m.status] - D[y.status]) * l : b.key === "entered_at" ? (new Date(m.entered_at).getTime() - new Date(y.entered_at).getTime()) * l : (m[b.key] - y[b.key]) * l);
|
|
609
609
|
}
|
|
610
610
|
return t;
|
|
611
611
|
}, [c == null ? void 0 : c.records, s, v, g, x, f, b]), d = (t) => (b == null ? void 0 : b.key) === t ? b.dir === "asc" ? " ↑" : " ↓" : "", r = F.length !== ((c == null ? void 0 : c.records.length) ?? 0), h = (t, l, m) => /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-0.5", children: [
|
|
@@ -729,7 +729,7 @@ function We({ rule: i }) {
|
|
|
729
729
|
}
|
|
730
730
|
) }),
|
|
731
731
|
/* @__PURE__ */ e("th", { className: "px-3 py-1.5 font-normal", children: /* @__PURE__ */ e(
|
|
732
|
-
|
|
732
|
+
Ue,
|
|
733
733
|
{
|
|
734
734
|
value: v,
|
|
735
735
|
onChange: k,
|
|
@@ -744,7 +744,7 @@ function We({ rule: i }) {
|
|
|
744
744
|
}
|
|
745
745
|
) }),
|
|
746
746
|
/* @__PURE__ */ e("th", { className: "px-3 py-1.5 text-right font-normal", children: h(g, S, "hours") }),
|
|
747
|
-
/* @__PURE__ */ e("th", { className: "px-3 py-1.5 text-right font-normal", children: h(x,
|
|
747
|
+
/* @__PURE__ */ e("th", { className: "px-3 py-1.5 text-right font-normal", children: h(x, U, "hours") }),
|
|
748
748
|
/* @__PURE__ */ e("th", { className: "px-3 py-1.5 text-right font-normal", children: /* @__PURE__ */ e(
|
|
749
749
|
"input",
|
|
750
750
|
{
|
|
@@ -786,7 +786,7 @@ function We({ rule: i }) {
|
|
|
786
786
|
{
|
|
787
787
|
className: "ml-1.5 rounded-full bg-slate-500/10 px-1.5 py-px text-[10px] font-medium text-slate-500 dark:text-slate-400",
|
|
788
788
|
"data-tip": `Regional clock: business hours count in ${t.timezone}`,
|
|
789
|
-
children:
|
|
789
|
+
children: je(t.timezone)
|
|
790
790
|
}
|
|
791
791
|
)
|
|
792
792
|
] }),
|
|
@@ -801,14 +801,14 @@ function We({ rule: i }) {
|
|
|
801
801
|
children: t.remaining_hours < 0 ? `${W(Math.abs(t.remaining_hours))} over` : W(t.remaining_hours)
|
|
802
802
|
}
|
|
803
803
|
),
|
|
804
|
-
/* @__PURE__ */ e("td", { className: "px-3 py-1.5 text-right text-slate-400", children:
|
|
804
|
+
/* @__PURE__ */ e("td", { className: "px-3 py-1.5 text-right text-slate-400", children: Te(t.entered_at) })
|
|
805
805
|
] }, `${t.collection}:${t.item}`)),
|
|
806
806
|
F.length === 0 && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 5, className: "px-3 py-4 text-center text-[12px] text-slate-400", children: "No records match the filters." }) })
|
|
807
807
|
] })
|
|
808
808
|
] }) })
|
|
809
809
|
] }) });
|
|
810
810
|
}
|
|
811
|
-
const
|
|
811
|
+
const ze = [
|
|
812
812
|
{ label: "4 business hours", hours: 4, business: !0 },
|
|
813
813
|
{ label: "1 business day", hours: 8, business: !0 },
|
|
814
814
|
{ label: "2 business days", hours: 16, business: !0 },
|
|
@@ -817,7 +817,7 @@ const Ke = [
|
|
|
817
817
|
{ label: "24 hours", hours: 24, business: !1 },
|
|
818
818
|
{ label: "72 hours", hours: 72, business: !1 }
|
|
819
819
|
];
|
|
820
|
-
function
|
|
820
|
+
function dt() {
|
|
821
821
|
const i = X(), u = ve(), { data: p = [], isLoading: N } = j({
|
|
822
822
|
queryKey: ["sla-rules"],
|
|
823
823
|
queryFn: async () => (await i.request(I("/sla/rules"))).data
|
|
@@ -855,7 +855,7 @@ function it() {
|
|
|
855
855
|
t && t.states.forEach((l, m) => n.set(`${t.tid}:${l.key}`, { ...l, sort: m }));
|
|
856
856
|
}
|
|
857
857
|
return n;
|
|
858
|
-
}, [A.map((n) => n.data ? "1" : "0").join("")]), [q, v] = _(!1), [k, g] = _(null), [S, x] = _(null), [
|
|
858
|
+
}, [A.map((n) => n.data ? "1" : "0").join("")]), [q, v] = _(!1), [k, g] = _(null), [S, x] = _(null), [U, f] = _(null), $ = () => void u.invalidateQueries({ queryKey: ["sla-rules"] }), C = Q({
|
|
859
859
|
// One rule per selected state; with several states the state label is
|
|
860
860
|
// appended so the resulting rows stay distinguishable.
|
|
861
861
|
mutationFn: async (n) => {
|
|
@@ -876,7 +876,7 @@ function it() {
|
|
|
876
876
|
$(), v(!1), o > 0 ? E.warning(`${n} SLA rules created, ${o} failed`) : E.success(n > 1 ? `${n} SLA rules created` : "SLA rule created");
|
|
877
877
|
},
|
|
878
878
|
onError: () => E.error("Failed to create SLA rule")
|
|
879
|
-
}),
|
|
879
|
+
}), D = Q({
|
|
880
880
|
mutationFn: ({ id: n, body: o }) => {
|
|
881
881
|
const { state_keys: t, ...l } = o;
|
|
882
882
|
return i.request(se(`/sla/rules/${n}`, { ...l, state_key: t[0] }));
|
|
@@ -1037,7 +1037,7 @@ function it() {
|
|
|
1037
1037
|
{
|
|
1038
1038
|
variant: "outline",
|
|
1039
1039
|
className: "whitespace-nowrap text-[10.5px] font-normal",
|
|
1040
|
-
title: m.map((R) => `+${R.after_hours}h → ${
|
|
1040
|
+
title: m.map((R) => `+${R.after_hours}h → ${We(R, L)}`).join(" · "),
|
|
1041
1041
|
children: [
|
|
1042
1042
|
m.length,
|
|
1043
1043
|
"-tier ladder"
|
|
@@ -1053,9 +1053,9 @@ function it() {
|
|
|
1053
1053
|
size: "sm",
|
|
1054
1054
|
className: M(
|
|
1055
1055
|
"h-7 gap-1 px-2 text-[11.5px]",
|
|
1056
|
-
|
|
1056
|
+
U === t.id ? "text-nvr-cyan" : "text-slate-500 dark:text-muted-foreground"
|
|
1057
1057
|
),
|
|
1058
|
-
onClick: () => f(
|
|
1058
|
+
onClick: () => f(U === t.id ? null : t.id),
|
|
1059
1059
|
children: [
|
|
1060
1060
|
/* @__PURE__ */ e(Fe, { className: "h-3.5 w-3.5" }),
|
|
1061
1061
|
"Preview"
|
|
@@ -1094,7 +1094,7 @@ function it() {
|
|
|
1094
1094
|
]
|
|
1095
1095
|
}
|
|
1096
1096
|
),
|
|
1097
|
-
|
|
1097
|
+
U === t.id && /* @__PURE__ */ e(Ke, { rule: t })
|
|
1098
1098
|
] }, t.id);
|
|
1099
1099
|
}) })
|
|
1100
1100
|
]
|
|
@@ -1138,9 +1138,9 @@ function it() {
|
|
|
1138
1138
|
users: L,
|
|
1139
1139
|
roleNames: T,
|
|
1140
1140
|
multiState: !1,
|
|
1141
|
-
onSave: (n) =>
|
|
1141
|
+
onSave: (n) => D.mutate({ id: k.id, body: n }),
|
|
1142
1142
|
onCancel: () => g(null),
|
|
1143
|
-
saving:
|
|
1143
|
+
saving: D.isPending
|
|
1144
1144
|
}
|
|
1145
1145
|
) })
|
|
1146
1146
|
]
|
|
@@ -1177,5 +1177,5 @@ function it() {
|
|
|
1177
1177
|
] });
|
|
1178
1178
|
}
|
|
1179
1179
|
export {
|
|
1180
|
-
|
|
1180
|
+
dt as SlaRulesView
|
|
1181
1181
|
};
|