@nivaro/react 0.3.78 → 0.3.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/shared/components/chat/ChatPanel.js +867 -833
- package/dist/shared/components/item-edit/MembershipSetField.js +165 -147
- package/dist/shared/components/queue/QueueBulkBar.js +70 -66
- package/dist/shared/components/queue/QueueBulkMove.js +215 -0
- package/dist/shared/components/queue/QueueWorklist.js +790 -773
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { ArrowRight as f, X as v } from "lucide-react";
|
|
3
3
|
import { useState as g } from "react";
|
|
4
|
-
import { Command as k, CommandInput as y, CommandList as C, CommandEmpty as
|
|
4
|
+
import { Command as k, CommandInput as y, CommandList as C, CommandEmpty as w, CommandItem as N } from "../ui/command.js";
|
|
5
5
|
import { Popover as T, PopoverTrigger as O, PopoverContent as P } from "../ui/popover.js";
|
|
6
6
|
function z({
|
|
7
7
|
count: l,
|
|
8
|
-
states:
|
|
8
|
+
states: o,
|
|
9
9
|
busy: r,
|
|
10
|
-
claimsEnabled:
|
|
10
|
+
claimsEnabled: n = !0,
|
|
11
11
|
showClaim: i = !0,
|
|
12
12
|
showRelease: s = !0,
|
|
13
13
|
showTransition: m = !0,
|
|
@@ -18,74 +18,78 @@ function z({
|
|
|
18
18
|
children: h
|
|
19
19
|
}) {
|
|
20
20
|
const [b, d] = g(!1);
|
|
21
|
-
return l === 0 ? null :
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
disabled: r,
|
|
31
|
-
onClick: p,
|
|
32
|
-
className: "rounded-md px-2.5 py-1 text-[12px] font-medium text-nvr-navy hover:bg-nvr-cyan/10 disabled:opacity-50 dark:text-nvr-cyan",
|
|
33
|
-
children: "Claim"
|
|
34
|
-
}
|
|
35
|
-
),
|
|
36
|
-
o && s && /* @__PURE__ */ e(
|
|
37
|
-
"button",
|
|
38
|
-
{
|
|
39
|
-
type: "button",
|
|
40
|
-
disabled: r,
|
|
41
|
-
onClick: c,
|
|
42
|
-
className: "rounded-md px-2.5 py-1 text-[12px] font-medium text-slate-600 hover:bg-slate-100 disabled:opacity-50 dark:text-slate-300 dark:hover:bg-muted",
|
|
43
|
-
children: "Release"
|
|
44
|
-
}
|
|
45
|
-
),
|
|
46
|
-
h,
|
|
47
|
-
m && /* @__PURE__ */ t(T, { open: b, onOpenChange: d, children: [
|
|
48
|
-
/* @__PURE__ */ e(O, { asChild: !0, children: /* @__PURE__ */ t(
|
|
21
|
+
return l === 0 ? null : (
|
|
22
|
+
// Labels never wrap ("Push to / Fusion" on two lines, 2026-11-09): every button keeps one
|
|
23
|
+
// line (white-space inherits) and a bar wider than the window scrolls sideways instead.
|
|
24
|
+
/* @__PURE__ */ t("div", { className: "nvr-slide-up-centered fixed bottom-6 left-1/2 z-40 flex max-w-[calc(100vw-2rem)] -translate-x-1/2 items-center gap-1 overflow-x-auto whitespace-nowrap rounded-full border border-slate-200 bg-white px-4 py-2 shadow-lg dark:border-border dark:bg-card [&>*]:shrink-0", children: [
|
|
25
|
+
/* @__PURE__ */ t("span", { className: "mr-2 text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: [
|
|
26
|
+
l,
|
|
27
|
+
" selected"
|
|
28
|
+
] }),
|
|
29
|
+
n && i && /* @__PURE__ */ e(
|
|
49
30
|
"button",
|
|
50
31
|
{
|
|
51
32
|
type: "button",
|
|
52
|
-
disabled: r
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/* @__PURE__ */ e(f, { className: "h-3 w-3" })
|
|
57
|
-
]
|
|
33
|
+
disabled: r,
|
|
34
|
+
onClick: p,
|
|
35
|
+
className: "rounded-md px-2.5 py-1 text-[12px] font-medium text-nvr-navy hover:bg-nvr-cyan/10 disabled:opacity-50 dark:text-nvr-cyan",
|
|
36
|
+
children: "Claim"
|
|
58
37
|
}
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
38
|
+
),
|
|
39
|
+
n && s && /* @__PURE__ */ e(
|
|
40
|
+
"button",
|
|
41
|
+
{
|
|
42
|
+
type: "button",
|
|
43
|
+
disabled: r,
|
|
44
|
+
onClick: c,
|
|
45
|
+
className: "rounded-md px-2.5 py-1 text-[12px] font-medium text-slate-600 hover:bg-slate-100 disabled:opacity-50 dark:text-slate-300 dark:hover:bg-muted",
|
|
46
|
+
children: "Release"
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
h,
|
|
50
|
+
m && /* @__PURE__ */ t(T, { open: b, onOpenChange: d, children: [
|
|
51
|
+
/* @__PURE__ */ e(O, { asChild: !0, children: /* @__PURE__ */ t(
|
|
52
|
+
"button",
|
|
53
|
+
{
|
|
54
|
+
type: "button",
|
|
55
|
+
disabled: r || o.length === 0,
|
|
56
|
+
className: "flex items-center gap-1 rounded-md px-2.5 py-1 text-[12px] font-medium text-slate-600 hover:bg-slate-100 disabled:opacity-50 dark:text-slate-300 dark:hover:bg-muted",
|
|
57
|
+
children: [
|
|
58
|
+
"Transition ",
|
|
59
|
+
/* @__PURE__ */ e(f, { className: "h-3 w-3" })
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
) }),
|
|
63
|
+
/* @__PURE__ */ e(P, { className: "w-[200px] p-0", align: "center", side: "top", children: /* @__PURE__ */ t(k, { children: [
|
|
64
|
+
/* @__PURE__ */ e(y, { placeholder: "Target state…", className: "h-8 text-[12px]" }),
|
|
65
|
+
/* @__PURE__ */ t(C, { children: [
|
|
66
|
+
/* @__PURE__ */ e(w, { children: "No state found." }),
|
|
67
|
+
o.map((a) => /* @__PURE__ */ e(
|
|
68
|
+
N,
|
|
69
|
+
{
|
|
70
|
+
value: a.label,
|
|
71
|
+
onSelect: () => {
|
|
72
|
+
d(!1), u(a.value);
|
|
73
|
+
},
|
|
74
|
+
children: a.label
|
|
70
75
|
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
] });
|
|
76
|
+
a.value
|
|
77
|
+
))
|
|
78
|
+
] })
|
|
79
|
+
] }) })
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ e(
|
|
82
|
+
"button",
|
|
83
|
+
{
|
|
84
|
+
type: "button",
|
|
85
|
+
onClick: x,
|
|
86
|
+
className: "ml-1 rounded-full p-1 text-slate-400 hover:text-slate-600 dark:hover:text-slate-200",
|
|
87
|
+
"aria-label": "Clear selection",
|
|
88
|
+
children: /* @__PURE__ */ e(v, { className: "h-3.5 w-3.5" })
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
] })
|
|
92
|
+
);
|
|
89
93
|
}
|
|
90
94
|
export {
|
|
91
95
|
z as QueueBulkBar
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { jsxs as m, jsx as l, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as N } from "@tanstack/react-query";
|
|
3
|
+
import { ArrowRight as U } from "lucide-react";
|
|
4
|
+
import { useState as f, useMemo as D } from "react";
|
|
5
|
+
import { toast as q } from "sonner";
|
|
6
|
+
import { useNivaroClient as E } from "../../context.js";
|
|
7
|
+
import { get as _, post as B } from "../../lib/commands.js";
|
|
8
|
+
import { userErrorMessage as Y } from "../../lib/safe-error.js";
|
|
9
|
+
import { Popover as z, PopoverTrigger as G, PopoverContent as H } from "../ui/popover.js";
|
|
10
|
+
import { SimpleSelect as K } from "../ui/SimpleSelect.js";
|
|
11
|
+
function J(o) {
|
|
12
|
+
var h;
|
|
13
|
+
const s = /* @__PURE__ */ new Map();
|
|
14
|
+
for (const c of o) {
|
|
15
|
+
const i = ((h = c.label) == null ? void 0 : h.trim()) || "Move", n = s.get(i) ?? {
|
|
16
|
+
label: i,
|
|
17
|
+
ids: [],
|
|
18
|
+
noteRequired: !1,
|
|
19
|
+
targets: /* @__PURE__ */ new Map()
|
|
20
|
+
};
|
|
21
|
+
n.ids.push(c.id), c.comment_mode === "required" && (n.noteRequired = !0);
|
|
22
|
+
const p = String(c.to_state ?? "");
|
|
23
|
+
n.targets.set(p, [...n.targets.get(p) ?? [], c.id]), s.set(i, n);
|
|
24
|
+
}
|
|
25
|
+
return [...s.values()];
|
|
26
|
+
}
|
|
27
|
+
function ne({
|
|
28
|
+
collection: o,
|
|
29
|
+
ids: s,
|
|
30
|
+
disabled: h,
|
|
31
|
+
onDone: c
|
|
32
|
+
}) {
|
|
33
|
+
const i = E(), [n, p] = f(!1), [w, C] = f(""), [v, x] = f(""), [g, M] = f(""), [S, j] = f(!1), O = s.slice(0, 50).map(String).join(","), { data: y } = N({
|
|
34
|
+
queryKey: ["queue-bulk-move-binding", o],
|
|
35
|
+
queryFn: () => i.request(
|
|
36
|
+
_(`/pipelines/instances/${o}`, { ids: O })
|
|
37
|
+
).then((e) => {
|
|
38
|
+
var a, b;
|
|
39
|
+
return ((b = (a = e.data) == null ? void 0 : a.binding) == null ? void 0 : b.template) ?? null;
|
|
40
|
+
}),
|
|
41
|
+
enabled: n && !!o && s.length > 0,
|
|
42
|
+
staleTime: 5 * 6e4,
|
|
43
|
+
retry: !1
|
|
44
|
+
}), { data: d } = N({
|
|
45
|
+
queryKey: ["queue-bulk-move-outline", y],
|
|
46
|
+
queryFn: () => i.request(
|
|
47
|
+
_(`/pipelines/${y}/outline`)
|
|
48
|
+
).then((e) => e.data),
|
|
49
|
+
enabled: n && !!y,
|
|
50
|
+
staleTime: 5 * 6e4,
|
|
51
|
+
retry: !1
|
|
52
|
+
}), k = D(() => J((d == null ? void 0 : d.transitions) ?? []), [d]), I = (d == null ? void 0 : d.states) ?? [], $ = (e) => I.find((a) => String(a.id).toUpperCase() === e.toUpperCase()), t = k.find((e) => e.label === w) ?? null, R = t ? [...t.targets.keys()].filter(Boolean).sort((e, a) => {
|
|
53
|
+
var b, F;
|
|
54
|
+
return Number(((b = $(e)) == null ? void 0 : b.sort) ?? 0) - Number(((F = $(a)) == null ? void 0 : F.sort) ?? 0);
|
|
55
|
+
}) : [], L = R.length > 1, u = t ? L ? v ? t.targets.get(v) ?? [] : [] : t.ids : [], P = u.length ? `${u.join(",")}|${s.join(",")}` : "", { data: r, isFetching: T } = N({
|
|
56
|
+
queryKey: ["bulk-transition-preview", o, P],
|
|
57
|
+
queryFn: () => i.request(
|
|
58
|
+
B(`/items/${o}/bulk-transition?dry_run=1`, {
|
|
59
|
+
ids: s,
|
|
60
|
+
transition_ids: u,
|
|
61
|
+
comment: "(preview)"
|
|
62
|
+
})
|
|
63
|
+
),
|
|
64
|
+
enabled: n && !!o && u.length > 0,
|
|
65
|
+
staleTime: 15e3,
|
|
66
|
+
retry: !1
|
|
67
|
+
}), A = async () => {
|
|
68
|
+
if (!(!o || !t || u.length === 0) && !(t.noteRequired && !g.trim())) {
|
|
69
|
+
j(!0);
|
|
70
|
+
try {
|
|
71
|
+
const e = await i.request(
|
|
72
|
+
B(`/items/${o}/bulk-transition`, {
|
|
73
|
+
ids: s,
|
|
74
|
+
transition_ids: u,
|
|
75
|
+
...g.trim() ? { comment: g.trim() } : {}
|
|
76
|
+
})
|
|
77
|
+
);
|
|
78
|
+
e.failed > 0 ? q.warning(
|
|
79
|
+
`${t.label}: ${e.succeeded} done, ${e.failed} not moved — ${(e.errors ?? []).slice(0, 3).map((a) => `${a.label ?? `#${a.item}`}: ${a.error}`).join("; ")}`
|
|
80
|
+
) : q.success(`${t.label}: ${e.succeeded} done`), p(!1), C(""), x(""), M(""), c();
|
|
81
|
+
} catch (e) {
|
|
82
|
+
q.error(Y(e, `Could not ${t.label.toLowerCase()}`));
|
|
83
|
+
} finally {
|
|
84
|
+
j(!1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
return /* @__PURE__ */ m(z, { open: n, onOpenChange: p, children: [
|
|
89
|
+
/* @__PURE__ */ l(G, { asChild: !0, children: /* @__PURE__ */ m(
|
|
90
|
+
"button",
|
|
91
|
+
{
|
|
92
|
+
type: "button",
|
|
93
|
+
disabled: h || !o,
|
|
94
|
+
"data-tip": o ? void 0 : "Select records of one kind to move them together",
|
|
95
|
+
"data-queue-bulk-move": !0,
|
|
96
|
+
className: "flex items-center gap-1 rounded-md px-2.5 py-1 text-[12px] font-medium text-slate-600 hover:bg-slate-100 disabled:opacity-50 dark:text-slate-300 dark:hover:bg-muted",
|
|
97
|
+
children: [
|
|
98
|
+
"Move / Send Back ",
|
|
99
|
+
/* @__PURE__ */ l(U, { className: "h-3 w-3" })
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
) }),
|
|
103
|
+
/* @__PURE__ */ m(H, { side: "top", align: "center", className: "w-[360px] space-y-2 p-3", children: [
|
|
104
|
+
/* @__PURE__ */ m("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-foreground", children: [
|
|
105
|
+
"Move ",
|
|
106
|
+
s.length,
|
|
107
|
+
" record",
|
|
108
|
+
s.length === 1 ? "" : "s"
|
|
109
|
+
] }),
|
|
110
|
+
d ? k.length === 0 ? /* @__PURE__ */ l("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "You can’t move these records from here." }) : /* @__PURE__ */ m(
|
|
111
|
+
"form",
|
|
112
|
+
{
|
|
113
|
+
className: "space-y-2",
|
|
114
|
+
onSubmit: (e) => {
|
|
115
|
+
e.preventDefault(), A();
|
|
116
|
+
},
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ l(
|
|
119
|
+
K,
|
|
120
|
+
{
|
|
121
|
+
value: w,
|
|
122
|
+
onChange: (e) => {
|
|
123
|
+
C(e), x("");
|
|
124
|
+
},
|
|
125
|
+
options: [
|
|
126
|
+
{ value: "", label: "Choose a move…" },
|
|
127
|
+
...k.map((e) => ({ value: e.label, label: e.label }))
|
|
128
|
+
],
|
|
129
|
+
ariaLabel: "Choose a move",
|
|
130
|
+
className: "h-8 w-full text-[12.5px]"
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
t && L && /* @__PURE__ */ l(
|
|
134
|
+
K,
|
|
135
|
+
{
|
|
136
|
+
value: v,
|
|
137
|
+
onChange: x,
|
|
138
|
+
options: [
|
|
139
|
+
{ value: "", label: `${t.label} to…` },
|
|
140
|
+
...R.map((e) => {
|
|
141
|
+
var a;
|
|
142
|
+
return {
|
|
143
|
+
value: e,
|
|
144
|
+
label: ((a = $(e)) == null ? void 0 : a.label) ?? "another step"
|
|
145
|
+
};
|
|
146
|
+
})
|
|
147
|
+
],
|
|
148
|
+
ariaLabel: `${t.label} to which step`,
|
|
149
|
+
className: "h-8 w-full text-[12.5px]"
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
t && /* @__PURE__ */ l(
|
|
153
|
+
"textarea",
|
|
154
|
+
{
|
|
155
|
+
value: g,
|
|
156
|
+
onChange: (e) => M(e.target.value),
|
|
157
|
+
placeholder: t.noteRequired ? "Note for every record (required)" : "Note for every record (optional)",
|
|
158
|
+
"aria-label": "Note for every selected record",
|
|
159
|
+
maxLength: 2e3,
|
|
160
|
+
rows: 2,
|
|
161
|
+
className: "w-full rounded-md border border-slate-200 bg-background px-2 py-1 text-[12.5px] outline-none focus:border-nvr-cyan dark:border-border"
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
u.length > 0 && /* @__PURE__ */ l(
|
|
165
|
+
"p",
|
|
166
|
+
{
|
|
167
|
+
role: "status",
|
|
168
|
+
className: "text-[12px] text-slate-600 dark:text-muted-foreground",
|
|
169
|
+
"data-bulk-transition-preview": !0,
|
|
170
|
+
children: T || !r ? "Checking the selected records…" : r.failed === 0 ? `All ${r.succeeded} can move.` : /* @__PURE__ */ m(Q, { children: [
|
|
171
|
+
/* @__PURE__ */ m("span", { className: "font-medium text-amber-700 dark:text-amber-400", children: [
|
|
172
|
+
r.succeeded,
|
|
173
|
+
" of ",
|
|
174
|
+
r.succeeded + r.failed,
|
|
175
|
+
" can move.",
|
|
176
|
+
" ",
|
|
177
|
+
r.failed,
|
|
178
|
+
" can’t:"
|
|
179
|
+
] }),
|
|
180
|
+
" ",
|
|
181
|
+
r.errors.slice(0, 4).map((e) => `${e.label ?? `#${e.item}`} — ${e.error}`).join("; "),
|
|
182
|
+
r.errors.length > 4 ? `; and ${r.errors.length - 4} more` : ""
|
|
183
|
+
] })
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
/* @__PURE__ */ m("div", { className: "flex justify-end gap-2", children: [
|
|
187
|
+
/* @__PURE__ */ l(
|
|
188
|
+
"button",
|
|
189
|
+
{
|
|
190
|
+
type: "button",
|
|
191
|
+
onClick: () => p(!1),
|
|
192
|
+
className: "h-8 px-2 text-[12.5px] text-slate-500 hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground",
|
|
193
|
+
children: "Cancel"
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
/* @__PURE__ */ l(
|
|
197
|
+
"button",
|
|
198
|
+
{
|
|
199
|
+
type: "submit",
|
|
200
|
+
disabled: S || !t || u.length === 0 || r != null && r.succeeded === 0 || t.noteRequired && !g.trim(),
|
|
201
|
+
className: "h-8 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold text-white disabled:opacity-50",
|
|
202
|
+
children: S ? "Moving…" : r && !T ? `Run (${r.succeeded})` : "Run"
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
] })
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
) : /* @__PURE__ */ l("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "Loading the moves…" })
|
|
209
|
+
] })
|
|
210
|
+
] });
|
|
211
|
+
}
|
|
212
|
+
export {
|
|
213
|
+
ne as QueueBulkMove,
|
|
214
|
+
J as groupTransitions
|
|
215
|
+
};
|