@nivaro/react 0.3.49 → 0.3.50
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/InlineGridField.js +166 -105
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +25 -1
- package/dist/shared/components/ItemEditForm.js +4676 -4579
- package/dist/shared/components/QueryTable.js +461 -332
- package/dist/shared/components/item-edit/CatalogPickerField.js +1144 -1127
- package/dist/shared/components/item-edit/CloneDialog.js +192 -142
- package/dist/shared/components/item-edit/FieldRenderer.js +127 -126
- package/dist/shared/components/item-edit/FieldRow.js +236 -226
- package/dist/shared/components/item-edit/InlineGridField.js +92 -90
- package/dist/shared/components/item-edit/InlineTableField.js +3088 -2945
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
- package/dist/shared/components/item-edit/PlanGrid.js +162 -162
- package/dist/shared/components/item-edit/PolishFields.js +169 -162
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -181
- package/dist/shared/components/item-edit/SummaryPanel.js +148 -135
- package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
- package/dist/shared/components/item-edit/helpers.js +181 -155
- package/dist/shared/components/item-edit/line-midair.js +201 -0
- package/dist/shared/components/item-edit/soft-rules.js +27 -0
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/panels/ItemLockBanner.js +414 -358
- package/dist/shared/components/panels/PipelinePanel.js +1157 -963
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/queue/QueueWorklist.js +870 -827
- package/dist/shared/components/queue/column-chooser.js +21 -0
- package/dist/shared/components/queue/live-state-aspect.js +6 -0
- package/dist/shared/components/ui/number-draft-input.js +93 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
- package/dist/shared/lib/error-hints.js +1 -0
- package/package.json +1 -1
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { ArrowRight as
|
|
4
|
-
import { useState as
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as ce } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as ke, useQuery as ne, useMutation as ye } from "@tanstack/react-query";
|
|
3
|
+
import { ArrowRight as Qe, Loader2 as re, Check as Re, GitBranch as Oe, AlertTriangle as Dt, ChevronDown as pe, Users as ft, Minus as Ot, UserPlus as Ft, X as ht, Zap as bt, Search as Bt } from "lucide-react";
|
|
4
|
+
import { useState as U, useRef as te, useEffect as oe, useMemo as ot, Suspense as xt, useCallback as It, lazy as Lt } from "react";
|
|
5
5
|
import { toast as ee } from "sonner";
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as ie, post as
|
|
8
|
-
import { errorToastOptions as
|
|
9
|
-
import { useRecordSignalWhile as
|
|
10
|
-
import { RUN_TRANSITION_EVENT as
|
|
11
|
-
import { userErrorMessage as
|
|
12
|
-
import { serverNow as
|
|
13
|
-
import { userCardQuery as
|
|
14
|
-
import { cn as
|
|
15
|
-
import { PushReadinessChip as
|
|
16
|
-
import { useHeaderFold as
|
|
17
|
-
import { invalidateRecordInsights as
|
|
18
|
-
import { UserChip as
|
|
19
|
-
import { OwnerAvatars as
|
|
20
|
-
import { UserAvatar as
|
|
21
|
-
import { Button as
|
|
22
|
-
import { DropdownMenu as
|
|
23
|
-
import { Popover as
|
|
6
|
+
import { useNivaroClient as he, useItemEditAuth as jt } from "../../context.js";
|
|
7
|
+
import { get as ie, post as fe, del as Mt } from "../../lib/commands.js";
|
|
8
|
+
import { errorToastOptions as gt, toastError as Et } from "../../lib/error-toast.js";
|
|
9
|
+
import { useRecordSignalWhile as yt, useRecordSignalPeers as Ut, signalSentence as Kt } from "../../lib/presence-signals.js";
|
|
10
|
+
import { RUN_TRANSITION_EVENT as Te } from "../../lib/run-transition.js";
|
|
11
|
+
import { userErrorMessage as ve } from "../../lib/safe-error.js";
|
|
12
|
+
import { serverNow as Qt } from "../../lib/server-clock.js";
|
|
13
|
+
import { userCardQuery as zt } from "../../lib/user-cards.js";
|
|
14
|
+
import { cn as we, formatRelative as ze, humanHours as Wt } from "../../lib/utils.js";
|
|
15
|
+
import { PushReadinessChip as Ht } from "../integrations/RecordIntegrationPreview.js";
|
|
16
|
+
import { useHeaderFold as Vt } from "../item-edit/HeaderTools.js";
|
|
17
|
+
import { invalidateRecordInsights as qe, invalidateRecordData as Ne } from "../item-edit/RecordInsights.js";
|
|
18
|
+
import { UserChip as wt } from "../item-edit/UserChip.js";
|
|
19
|
+
import { OwnerAvatars as Xt } from "../queue/OwnerAvatars.js";
|
|
20
|
+
import { UserAvatar as Gt } from "../UserAvatar.js";
|
|
21
|
+
import { Button as J } from "../ui/button.js";
|
|
22
|
+
import { DropdownMenu as Be, DropdownMenuTrigger as Ie, DropdownMenuContent as Le, DropdownMenuGroup as dt, DropdownMenuSeparator as ct, DropdownMenuItem as Se, DropdownMenuLabel as Yt } from "../ui/dropdown-menu.js";
|
|
23
|
+
import { Popover as We, PopoverTrigger as He, PopoverContent as Ve } from "../ui/popover.js";
|
|
24
24
|
import { Skeleton as le } from "../ui/skeleton.js";
|
|
25
|
-
import { TooltipProvider as
|
|
26
|
-
import { isAccessRefusal as
|
|
27
|
-
import { BranchLanes as
|
|
28
|
-
import { SlaClockLine as
|
|
29
|
-
const
|
|
30
|
-
() => import("./TransitionRequirementsDialog.js").then((
|
|
31
|
-
default:
|
|
25
|
+
import { TooltipProvider as vt, Tooltip as je, TooltipTrigger as Me, TooltipContent as Ee } from "../ui/tooltip.js";
|
|
26
|
+
import { isAccessRefusal as Nt, deniedToastAction as kt, WhyOwnersButton as Jt } from "./AccessInsights.js";
|
|
27
|
+
import { BranchLanes as Zt } from "./BranchLanes.js";
|
|
28
|
+
import { SlaClockLine as en } from "./SlaClock.js";
|
|
29
|
+
const _t = Lt(
|
|
30
|
+
() => import("./TransitionRequirementsDialog.js").then((n) => ({
|
|
31
|
+
default: n.TransitionRequirementsDialog
|
|
32
32
|
}))
|
|
33
33
|
);
|
|
34
|
-
function
|
|
35
|
-
const
|
|
36
|
-
return t.on_behalf_of_name ? `${
|
|
34
|
+
function Xe(n, t) {
|
|
35
|
+
const l = n || "System";
|
|
36
|
+
return t.on_behalf_of_name ? `${l}, for ${t.on_behalf_of_name}` : l;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
if (
|
|
40
|
-
const t = (
|
|
38
|
+
function tn(n) {
|
|
39
|
+
if (n.transition) return null;
|
|
40
|
+
const t = (n.comment ?? "").trim();
|
|
41
41
|
if (!t.startsWith("{")) return null;
|
|
42
42
|
try {
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
return `Split into ${Array.isArray(
|
|
46
|
-
if (
|
|
47
|
-
if (
|
|
43
|
+
const l = JSON.parse(t);
|
|
44
|
+
if (l.action === "split")
|
|
45
|
+
return `Split into ${Array.isArray(l.children) ? l.children.length : "parallel"} branches`;
|
|
46
|
+
if (l.action === "join") return "Every branch finished — joined";
|
|
47
|
+
if (l.action === "branch") return "Started as a parallel branch";
|
|
48
48
|
} catch {
|
|
49
49
|
}
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
return !(
|
|
52
|
+
function $e(n) {
|
|
53
|
+
return !(n.first_name || n.last_name || n.user_email);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
const t = (
|
|
57
|
-
return
|
|
55
|
+
function Ue(n) {
|
|
56
|
+
const t = (n.comment ?? "").trim().toLowerCase();
|
|
57
|
+
return n.origin === "import" || t.startsWith("import:") ? "Imported" : n.origin === "integration" ? "By an integration" : /-state-sync$/.test(t) || t.startsWith("legacy-") ? "Synced from another system" : t === "state-merge" || t === "instance-migration" ? "Moved by an admin script" : "Moved automatically";
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
if (
|
|
61
|
-
if (
|
|
62
|
-
const t = (
|
|
63
|
-
return
|
|
59
|
+
function Ke(n) {
|
|
60
|
+
if (n.transition_text) return n.transition_text;
|
|
61
|
+
if (n.transition_label) return `Rule: ${n.transition_label}`;
|
|
62
|
+
const t = (n.comment ?? "").trim(), l = /^auto: (.+)$/i.exec(t);
|
|
63
|
+
return l ? `Rule: ${l[1]}` : /-state-sync$/i.test(t) ? "The state was copied in from the system that owned this record" : /^instance-migration/i.test(t) ? "Moved when the pipeline was reshaped" : /^state-merge/i.test(t) ? "Moved when two states were merged" : null;
|
|
64
64
|
}
|
|
65
|
-
const
|
|
65
|
+
const mt = {
|
|
66
66
|
validation: "the partner refused what we sent",
|
|
67
67
|
not_found: "the partner could not find what we referred to",
|
|
68
68
|
auth: "the partner refused our credentials",
|
|
@@ -70,24 +70,24 @@ const rt = {
|
|
|
70
70
|
rate_limited: "the partner asked us to slow down",
|
|
71
71
|
unknown: "the partner refused it"
|
|
72
72
|
};
|
|
73
|
-
function
|
|
74
|
-
const t = Math.ceil((new Date(
|
|
73
|
+
function nn(n) {
|
|
74
|
+
const t = Math.ceil((new Date(n).getTime() - Qt()) / 6e4);
|
|
75
75
|
return !Number.isFinite(t) || t <= 0 ? "on the next check" : t < 60 ? `in ${t} min` : `in ${Math.round(t / 60)}h`;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
77
|
+
function rn({ held: n }) {
|
|
78
|
+
return n.length === 0 ? null : /* @__PURE__ */ e(
|
|
79
79
|
"div",
|
|
80
80
|
{
|
|
81
81
|
className: "space-y-2 border-b border-amber-100 bg-amber-50 px-5 py-3 dark:border-amber-500/20 dark:bg-amber-500/10",
|
|
82
82
|
"data-pipeline-auto-held": !0,
|
|
83
|
-
children:
|
|
84
|
-
const
|
|
85
|
-
return /* @__PURE__ */
|
|
86
|
-
/* @__PURE__ */
|
|
83
|
+
children: n.map((t) => {
|
|
84
|
+
const l = t.transition_label ?? "An automatic move", a = mt[t.error_class ?? "unknown"] ?? mt.unknown;
|
|
85
|
+
return /* @__PURE__ */ r("div", { className: "text-[12px] text-amber-800 dark:text-amber-300", children: [
|
|
86
|
+
/* @__PURE__ */ r("p", { className: "font-medium", children: [
|
|
87
87
|
"Needs a person: ",
|
|
88
|
-
|
|
88
|
+
l,
|
|
89
89
|
" stopped retrying — ",
|
|
90
|
-
|
|
90
|
+
a,
|
|
91
91
|
"."
|
|
92
92
|
] }),
|
|
93
93
|
t.error && /* @__PURE__ */ e(
|
|
@@ -98,8 +98,8 @@ function Kt({ held: r }) {
|
|
|
98
98
|
children: t.error
|
|
99
99
|
}
|
|
100
100
|
),
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
t.retry_at ? `It tries the same push again ${
|
|
101
|
+
/* @__PURE__ */ r("p", { className: "mt-1 text-[11px] text-amber-700 dark:text-amber-400", children: [
|
|
102
|
+
t.retry_at ? `It tries the same push again ${nn(t.retry_at)}. ` : "It will not send the same push again on its own. ",
|
|
103
103
|
"Fix the record so what it sends changes, retry the push, or move the record by hand.",
|
|
104
104
|
t.attempts > 1 ? ` ${t.attempts} attempts so far.` : ""
|
|
105
105
|
] })
|
|
@@ -108,84 +108,238 @@ function Kt({ held: r }) {
|
|
|
108
108
|
}
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
var
|
|
113
|
-
const t =
|
|
114
|
-
return ((t == null ? void 0 : t.code) ?? ((
|
|
111
|
+
function Ct(n) {
|
|
112
|
+
var l;
|
|
113
|
+
const t = n == null ? void 0 : n.response;
|
|
114
|
+
return ((t == null ? void 0 : t.code) ?? ((l = t == null ? void 0 : t.data) == null ? void 0 : l.code)) === "TRANSITION_DUPLICATE";
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
var
|
|
118
|
-
const t =
|
|
119
|
-
return (t == null ? void 0 : t.status) === 422 && ((
|
|
116
|
+
function St(n) {
|
|
117
|
+
var l;
|
|
118
|
+
const t = n;
|
|
119
|
+
return (t == null ? void 0 : t.status) === 422 && ((l = t.response) == null ? void 0 : l.error) === "TRANSITION_REQUIREMENTS" ? t.response.requirements ?? [] : null;
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
|
|
121
|
+
function an(n) {
|
|
122
|
+
var a;
|
|
123
|
+
const t = n == null ? void 0 : n.response, l = (t == null ? void 0 : t.code) ?? ((a = t == null ? void 0 : t.data) == null ? void 0 : a.code);
|
|
124
|
+
return typeof l == "string" ? l : null;
|
|
125
|
+
}
|
|
126
|
+
const sn = {
|
|
127
|
+
PRIORITY_REQUIRED: "priority"
|
|
128
|
+
};
|
|
129
|
+
function $t(n, t) {
|
|
130
|
+
const l = an(n), a = l ? sn[l] : void 0;
|
|
131
|
+
return !l || !a ? null : { code: l, actionKey: a, transitionId: t.transition_id, comment: t.comment };
|
|
132
|
+
}
|
|
133
|
+
const ln = 600;
|
|
134
|
+
function Tt(n) {
|
|
135
|
+
const t = ke(), [l, a] = U(!1), x = te(!0);
|
|
136
|
+
oe(() => (x.current = !0, () => {
|
|
137
|
+
x.current = !1;
|
|
138
|
+
}), []);
|
|
139
|
+
const m = te(n);
|
|
140
|
+
m.current = n;
|
|
141
|
+
const f = It(async () => {
|
|
142
|
+
a(!0);
|
|
143
|
+
try {
|
|
144
|
+
await t.refetchQueries({ queryKey: [...m.current], type: "active" });
|
|
145
|
+
} catch {
|
|
146
|
+
}
|
|
147
|
+
await new Promise((y) => setTimeout(y, ln)), x.current && a(!1);
|
|
148
|
+
}, [t]);
|
|
149
|
+
return { settling: l, settle: f };
|
|
150
|
+
}
|
|
151
|
+
function qt(n, t, l) {
|
|
152
|
+
for (const a of [
|
|
153
|
+
"pipeline-owners-resolved",
|
|
154
|
+
"pipeline-instance-owners",
|
|
155
|
+
"pipeline-all-owners"
|
|
156
|
+
])
|
|
157
|
+
n.invalidateQueries({ queryKey: [a, t, l] });
|
|
158
|
+
}
|
|
159
|
+
function on(n, t, l) {
|
|
160
|
+
var y;
|
|
161
|
+
if (!t) return null;
|
|
162
|
+
const a = new Map(l.map((C) => [String(C.id).toUpperCase(), C.sort])), x = [...n].sort(
|
|
163
|
+
(C, P) => new Date(P.timestamp).getTime() - new Date(C.timestamp).getTime()
|
|
164
|
+
)[0];
|
|
165
|
+
if (!(x != null && x.from_state) || String(x.to_state).toUpperCase() !== String(t).toUpperCase() || !((y = x.comment) != null && y.trim()) || x.origin && x.origin !== "person") return null;
|
|
166
|
+
const m = a.get(String(x.from_state).toUpperCase()), f = a.get(String(x.to_state).toUpperCase());
|
|
167
|
+
return m == null || f == null || f >= m ? null : x;
|
|
168
|
+
}
|
|
169
|
+
function dn({ entry: n }) {
|
|
170
|
+
const t = [n.first_name, n.last_name].filter(Boolean).join(" ") || n.user_email || "Someone";
|
|
171
|
+
return /* @__PURE__ */ r(
|
|
172
|
+
"div",
|
|
173
|
+
{
|
|
174
|
+
className: "mx-5 mt-3 rounded-lg border border-amber-200 bg-amber-50 px-3.5 py-2.5 dark:border-amber-500/30 dark:bg-amber-500/10",
|
|
175
|
+
"data-send-back-notice": !0,
|
|
176
|
+
children: [
|
|
177
|
+
/* @__PURE__ */ r("p", { className: "text-[12px] font-medium text-amber-900 dark:text-amber-200", children: [
|
|
178
|
+
"Sent back by ",
|
|
179
|
+
Xe(t, n),
|
|
180
|
+
" · ",
|
|
181
|
+
ze(n.timestamp)
|
|
182
|
+
] }),
|
|
183
|
+
/* @__PURE__ */ e("p", { className: "mt-0.5 whitespace-pre-line text-[13px] text-amber-950 dark:text-amber-100", children: n.comment })
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
function Rt({
|
|
189
|
+
collection: n,
|
|
190
|
+
item: t,
|
|
191
|
+
offer: l,
|
|
192
|
+
onFixed: a,
|
|
193
|
+
onDismiss: x,
|
|
194
|
+
className: m,
|
|
195
|
+
style: f
|
|
196
|
+
}) {
|
|
197
|
+
const y = he(), C = ke(), [P, h] = U(""), { data: b, isLoading: S } = ne({
|
|
198
|
+
queryKey: ["bulk-actions-available-one", n, l.actionKey],
|
|
199
|
+
queryFn: async () => ((await y.request(ie("/bulk-actions/available", { collection: n }))).data ?? []).find((O) => O.key === l.actionKey) ?? null,
|
|
200
|
+
staleTime: 6e4
|
|
201
|
+
}), L = ye({
|
|
202
|
+
mutationFn: async () => {
|
|
203
|
+
var k, A;
|
|
204
|
+
const D = { collection: n, ids: [t], reason: P.trim() || null }, E = ((b == null ? void 0 : b.source) === "extension" ? await y.request(fe(`/bulk-actions/${l.actionKey}/execute`, D)) : await y.request(fe("/bulk-actions/run", { ...D, key: l.actionKey }))).data ?? {};
|
|
205
|
+
if ((b == null ? void 0 : b.source) !== "extension" && !(E.succeeded && E.succeeded > 0))
|
|
206
|
+
throw new Error(
|
|
207
|
+
((A = (k = E.errors) == null ? void 0 : k[0]) == null ? void 0 : A.error) || `${(b == null ? void 0 : b.label) ?? "The fix"} did not change the record`
|
|
208
|
+
);
|
|
209
|
+
},
|
|
210
|
+
onSuccess: () => {
|
|
211
|
+
Ne(C, n, t), ee.success(`${(b == null ? void 0 : b.label) ?? "Done"} — trying again`), a();
|
|
212
|
+
},
|
|
213
|
+
onError: (D) => Et(D, `${(b == null ? void 0 : b.label) ?? "The fix"} failed`)
|
|
214
|
+
});
|
|
215
|
+
if (S || !b) return null;
|
|
216
|
+
const M = !L.isPending && (!b.require_reason || P.trim().length > 0);
|
|
217
|
+
return /* @__PURE__ */ r(
|
|
218
|
+
"div",
|
|
219
|
+
{
|
|
220
|
+
className: we(
|
|
221
|
+
"space-y-2 rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-500/30 dark:bg-amber-950",
|
|
222
|
+
m
|
|
223
|
+
),
|
|
224
|
+
style: f,
|
|
225
|
+
"data-refusal-fix": l.code,
|
|
226
|
+
children: [
|
|
227
|
+
/* @__PURE__ */ r("p", { className: "text-[12px] text-amber-950 dark:text-amber-100", children: [
|
|
228
|
+
"You can fix this here: ",
|
|
229
|
+
b.label.toLowerCase(),
|
|
230
|
+
" this record, then it is tried again."
|
|
231
|
+
] }),
|
|
232
|
+
b.require_reason && /* @__PURE__ */ e(
|
|
233
|
+
"input",
|
|
234
|
+
{
|
|
235
|
+
type: "text",
|
|
236
|
+
value: P,
|
|
237
|
+
onChange: (D) => h(D.target.value),
|
|
238
|
+
placeholder: "Reason (required)",
|
|
239
|
+
"aria-label": "Reason",
|
|
240
|
+
className: "w-full rounded-md border border-slate-200 bg-white px-3 py-1.5 text-[13px] placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-nvr-cyan/30 dark:border-border dark:bg-card"
|
|
241
|
+
}
|
|
242
|
+
),
|
|
243
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-end gap-2", children: [
|
|
244
|
+
/* @__PURE__ */ e(
|
|
245
|
+
J,
|
|
246
|
+
{
|
|
247
|
+
type: "button",
|
|
248
|
+
size: "sm",
|
|
249
|
+
variant: "ghost",
|
|
250
|
+
className: "h-7 text-[12px]",
|
|
251
|
+
onClick: x,
|
|
252
|
+
children: "Not now"
|
|
253
|
+
}
|
|
254
|
+
),
|
|
255
|
+
/* @__PURE__ */ r(
|
|
256
|
+
J,
|
|
257
|
+
{
|
|
258
|
+
type: "button",
|
|
259
|
+
size: "sm",
|
|
260
|
+
className: "h-7 gap-1.5 text-[12px]",
|
|
261
|
+
disabled: !M,
|
|
262
|
+
onClick: () => L.mutate(),
|
|
263
|
+
children: [
|
|
264
|
+
L.isPending && /* @__PURE__ */ e(re, { className: "h-3 w-3 animate-spin" }),
|
|
265
|
+
b.label,
|
|
266
|
+
", then try again"
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
)
|
|
270
|
+
] })
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
function de({
|
|
276
|
+
label: n,
|
|
123
277
|
color: t,
|
|
124
|
-
small:
|
|
278
|
+
small: l
|
|
125
279
|
}) {
|
|
126
280
|
return /* @__PURE__ */ e(
|
|
127
281
|
"span",
|
|
128
282
|
{
|
|
129
|
-
className: `nvr-state-pulse inline-flex items-center gap-1.5 rounded-full font-medium transition-colors duration-300 ${
|
|
283
|
+
className: `nvr-state-pulse inline-flex items-center gap-1.5 rounded-full font-medium transition-colors duration-300 ${l ? "px-2 py-0.5 text-[11px]" : "px-2.5 py-1 text-[12px]"}`,
|
|
130
284
|
style: {
|
|
131
285
|
backgroundColor: t ? `${t}22` : "#f1f5f9",
|
|
132
286
|
color: t ?? "#475569",
|
|
133
287
|
border: `1px solid ${t ? `${t}44` : "#e2e8f0"}`
|
|
134
288
|
},
|
|
135
|
-
children:
|
|
289
|
+
children: n
|
|
136
290
|
},
|
|
137
|
-
|
|
291
|
+
n
|
|
138
292
|
);
|
|
139
293
|
}
|
|
140
|
-
function
|
|
141
|
-
const t = Math.floor(
|
|
142
|
-
return t < 60 ? `${Math.max(1, t)}m` :
|
|
294
|
+
function Fe(n) {
|
|
295
|
+
const t = Math.floor(n / 6e4);
|
|
296
|
+
return t < 60 ? `${Math.max(1, t)}m` : Wt(n / 36e5);
|
|
143
297
|
}
|
|
144
|
-
function
|
|
145
|
-
history:
|
|
298
|
+
function cn({
|
|
299
|
+
history: n,
|
|
146
300
|
completedAt: t
|
|
147
301
|
}) {
|
|
148
|
-
const
|
|
149
|
-
(f,
|
|
302
|
+
const l = [...n].sort(
|
|
303
|
+
(f, y) => new Date(f.timestamp).getTime() - new Date(y.timestamp).getTime()
|
|
150
304
|
);
|
|
151
|
-
if (
|
|
152
|
-
const
|
|
153
|
-
const
|
|
305
|
+
if (l.length === 0) return null;
|
|
306
|
+
const a = t ? new Date(t).getTime() : Date.now(), x = l.map((f, y) => {
|
|
307
|
+
const C = new Date(f.timestamp).getTime(), P = y + 1 < l.length ? new Date(l[y + 1].timestamp).getTime() : a;
|
|
154
308
|
return {
|
|
155
309
|
key: f.id,
|
|
156
310
|
label: f.to_state_label,
|
|
157
311
|
color: f.to_state_color,
|
|
158
|
-
ms: Math.max(0,
|
|
159
|
-
current:
|
|
312
|
+
ms: Math.max(0, P - C),
|
|
313
|
+
current: y === l.length - 1 && !t
|
|
160
314
|
};
|
|
161
315
|
}).filter((f) => f.ms > 0 || f.current);
|
|
162
|
-
if (
|
|
163
|
-
const
|
|
164
|
-
return
|
|
165
|
-
/* @__PURE__ */
|
|
316
|
+
if (x.length < 2) return null;
|
|
317
|
+
const m = x.reduce((f, y) => f + y.ms, 0);
|
|
318
|
+
return m <= 0 ? null : /* @__PURE__ */ r("div", { "data-state-timeline": !0, children: [
|
|
319
|
+
/* @__PURE__ */ r("div", { className: "mb-1 flex items-center justify-between", children: [
|
|
166
320
|
/* @__PURE__ */ e("p", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400 dark:text-slate-500", children: "Time in step" }),
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
-
|
|
321
|
+
/* @__PURE__ */ r("p", { className: "text-[10px] tabular-nums text-slate-400 dark:text-slate-500", children: [
|
|
322
|
+
Fe(m),
|
|
169
323
|
" total",
|
|
170
324
|
t ? "" : " · so far"
|
|
171
325
|
] })
|
|
172
326
|
] }),
|
|
173
|
-
/* @__PURE__ */ e("div", { className: "flex h-4 w-full overflow-hidden rounded", children:
|
|
174
|
-
const
|
|
175
|
-
return /* @__PURE__ */
|
|
327
|
+
/* @__PURE__ */ e("div", { className: "flex h-4 w-full overflow-hidden rounded", children: x.map((f) => {
|
|
328
|
+
const y = f.ms / m * 100;
|
|
329
|
+
return /* @__PURE__ */ r(
|
|
176
330
|
"div",
|
|
177
331
|
{
|
|
178
|
-
"data-tip": `${f.label} — ${
|
|
332
|
+
"data-tip": `${f.label} — ${Fe(f.ms)}${f.current ? " (current)" : ""}`,
|
|
179
333
|
className: "relative flex min-w-[8px] items-center overflow-hidden border-r border-white/60 last:border-r-0 dark:border-black/30",
|
|
180
334
|
style: {
|
|
181
|
-
width: `${
|
|
335
|
+
width: `${y}%`,
|
|
182
336
|
backgroundColor: f.color ? `${f.color}55` : "rgba(100,116,139,.25)"
|
|
183
337
|
},
|
|
184
338
|
children: [
|
|
185
|
-
|
|
339
|
+
y >= 14 && /* @__PURE__ */ r("span", { className: "truncate px-1.5 text-[9.5px] font-medium leading-none text-slate-700 dark:text-slate-200", children: [
|
|
186
340
|
f.label,
|
|
187
341
|
" · ",
|
|
188
|
-
|
|
342
|
+
Fe(f.ms)
|
|
189
343
|
] }),
|
|
190
344
|
f.current && /* @__PURE__ */ e(
|
|
191
345
|
"span",
|
|
@@ -201,122 +355,122 @@ function Wt({
|
|
|
201
355
|
}) })
|
|
202
356
|
] });
|
|
203
357
|
}
|
|
204
|
-
function
|
|
205
|
-
states:
|
|
358
|
+
function mn({
|
|
359
|
+
states: n,
|
|
206
360
|
allTransitions: t,
|
|
207
|
-
availableTransitions:
|
|
208
|
-
currentStateId:
|
|
209
|
-
history:
|
|
210
|
-
onPathIds:
|
|
361
|
+
availableTransitions: l,
|
|
362
|
+
currentStateId: a,
|
|
363
|
+
history: x,
|
|
364
|
+
onPathIds: m,
|
|
211
365
|
skippedStates: f
|
|
212
366
|
}) {
|
|
213
|
-
var
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
if (!
|
|
218
|
-
const
|
|
219
|
-
if (!
|
|
220
|
-
const s =
|
|
221
|
-
|
|
222
|
-
}, [
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
const h = (
|
|
226
|
-
h && h !==
|
|
227
|
-
const
|
|
228
|
-
if (
|
|
229
|
-
return
|
|
230
|
-
const
|
|
231
|
-
return
|
|
232
|
-
}).sort((
|
|
367
|
+
var A;
|
|
368
|
+
const y = te(null);
|
|
369
|
+
oe(() => {
|
|
370
|
+
const d = y.current;
|
|
371
|
+
if (!d || d.scrollWidth <= d.clientWidth) return;
|
|
372
|
+
const N = d.querySelector("[data-track-current]");
|
|
373
|
+
if (!N) return;
|
|
374
|
+
const s = d.getBoundingClientRect(), g = N.getBoundingClientRect();
|
|
375
|
+
d.scrollLeft += g.left + g.width / 2 - (s.left + s.width / 2);
|
|
376
|
+
}, [a]);
|
|
377
|
+
const C = new Set(x.map((d) => d.to_state)), P = n.find((d) => d.is_initial);
|
|
378
|
+
P && P.id !== a && C.add(P.id);
|
|
379
|
+
const h = (A = x[0]) == null ? void 0 : A.from_state;
|
|
380
|
+
h && h !== a && C.add(h);
|
|
381
|
+
const b = (() => {
|
|
382
|
+
if (m)
|
|
383
|
+
return n.filter((u) => m.has(u.id) || C.has(u.id) || u.id === a).filter((u) => {
|
|
384
|
+
const v = u.stage_visibility ?? "always";
|
|
385
|
+
return v === "hide" ? !1 : v === "hide_unless_active" ? C.has(u.id) || u.id === a : !0;
|
|
386
|
+
}).sort((u, v) => u.sort - v.sort);
|
|
233
387
|
if (t.length === 0) {
|
|
234
|
-
const
|
|
235
|
-
return
|
|
388
|
+
const u = /* @__PURE__ */ new Set([...C]);
|
|
389
|
+
return a && u.add(a), n.filter((v) => u.has(v.id)).sort((v, B) => v.sort - B.sort);
|
|
236
390
|
}
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
),
|
|
240
|
-
for (const
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
const
|
|
244
|
-
|
|
391
|
+
const d = new Set(
|
|
392
|
+
x.filter((u) => u.from_state).map((u) => `${u.from_state}:${u.to_state}`)
|
|
393
|
+
), N = new Set(x.map((u) => u.from_state).filter(Boolean)), s = t.filter((u) => u.from_state !== null), g = /* @__PURE__ */ new Map();
|
|
394
|
+
for (const u of s) {
|
|
395
|
+
const v = u.from_state;
|
|
396
|
+
if (N.has(v) && !d.has(`${v}:${u.to_state}`)) continue;
|
|
397
|
+
const B = g.get(v) ?? [];
|
|
398
|
+
B.push(u.to_state), g.set(v, B);
|
|
245
399
|
}
|
|
246
|
-
if (
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
.../* @__PURE__ */ new Set([...
|
|
400
|
+
if (a) {
|
|
401
|
+
const u = s.filter((v) => v.from_state === a).map((v) => v.to_state);
|
|
402
|
+
g.set(a, [
|
|
403
|
+
.../* @__PURE__ */ new Set([...l.map((v) => v.to_state), ...u])
|
|
250
404
|
]);
|
|
251
405
|
}
|
|
252
|
-
const
|
|
253
|
-
for (;
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
for (const
|
|
406
|
+
const $ = /* @__PURE__ */ new Set(), K = n.filter((u) => u.is_initial).map((u) => u.id);
|
|
407
|
+
for (; K.length; ) {
|
|
408
|
+
const u = K.shift();
|
|
409
|
+
if (!$.has(u)) {
|
|
410
|
+
$.add(u);
|
|
411
|
+
for (const v of g.get(u) ?? []) $.has(v) || K.push(v);
|
|
258
412
|
}
|
|
259
413
|
}
|
|
260
|
-
const
|
|
261
|
-
return
|
|
262
|
-
const
|
|
263
|
-
return
|
|
264
|
-
}).sort((
|
|
414
|
+
const V = /* @__PURE__ */ new Set([...$, ...C]);
|
|
415
|
+
return a && V.add(a), n.filter((u) => V.has(u.id)).filter((u) => {
|
|
416
|
+
const v = u.stage_visibility ?? "always";
|
|
417
|
+
return v === "hide" ? !1 : v === "hide_unless_active" ? C.has(u.id) || u.id === a : !0;
|
|
418
|
+
}).sort((u, v) => u.sort - v.sort);
|
|
265
419
|
})();
|
|
266
|
-
if (
|
|
267
|
-
const
|
|
268
|
-
function
|
|
269
|
-
const s =
|
|
270
|
-
return s == null ? [] : [...
|
|
271
|
-
if (!
|
|
272
|
-
const
|
|
273
|
-
return
|
|
274
|
-
}).sort((
|
|
420
|
+
if (b.length < 2) return null;
|
|
421
|
+
const S = new Map(b.map((d, N) => [d.id, N])), L = new Map(n.map((d) => [d.id, d.label]));
|
|
422
|
+
function M(d, N) {
|
|
423
|
+
const s = S.get(d);
|
|
424
|
+
return s == null ? [] : [...x].filter((g) => {
|
|
425
|
+
if (!g.from_state) return !1;
|
|
426
|
+
const $ = S.get(g.from_state), K = S.get(g.to_state);
|
|
427
|
+
return $ == null || K == null ? !1 : $ === s && K > s || K === s && $ > s;
|
|
428
|
+
}).sort((g, $) => new Date(g.timestamp).getTime() - new Date($.timestamp).getTime());
|
|
275
429
|
}
|
|
276
|
-
function
|
|
277
|
-
var
|
|
278
|
-
return
|
|
430
|
+
function D(d) {
|
|
431
|
+
var N, s, g, $;
|
|
432
|
+
return $e(d) ? /* @__PURE__ */ e(bt, { className: "inline h-2.5 w-2.5", "aria-label": Ue(d) }) : ((((N = d.first_name) == null ? void 0 : N[0]) ?? "") + (((s = d.last_name) == null ? void 0 : s[0]) ?? "")).toUpperCase() || (($ = (g = d.user_email) == null ? void 0 : g[0]) == null ? void 0 : $.toUpperCase()) || "?";
|
|
279
433
|
}
|
|
280
|
-
function
|
|
281
|
-
return
|
|
434
|
+
function O(d) {
|
|
435
|
+
return Xe([d.first_name, d.last_name].filter(Boolean).join(" ") || d.user_email, d);
|
|
282
436
|
}
|
|
283
|
-
const
|
|
284
|
-
for (const
|
|
285
|
-
(
|
|
437
|
+
const E = /* @__PURE__ */ new Map();
|
|
438
|
+
for (const d of [...x].sort(
|
|
439
|
+
(N, s) => new Date(N.timestamp).getTime() - new Date(s.timestamp).getTime()
|
|
286
440
|
)) {
|
|
287
|
-
if (!
|
|
288
|
-
const
|
|
289
|
-
if (!(
|
|
290
|
-
for (let
|
|
291
|
-
const
|
|
292
|
-
!
|
|
441
|
+
if (!d.from_state) continue;
|
|
442
|
+
const N = S.get(d.from_state), s = S.get(d.to_state);
|
|
443
|
+
if (!(N == null || s == null || s <= N + 1))
|
|
444
|
+
for (let g = N + 1; g < s; g++) {
|
|
445
|
+
const $ = b[g].id;
|
|
446
|
+
!C.has($) && !E.has($) && E.set($, d);
|
|
293
447
|
}
|
|
294
448
|
}
|
|
295
|
-
function
|
|
296
|
-
const
|
|
297
|
-
return `Passed over on ${new Date(
|
|
449
|
+
function k(d) {
|
|
450
|
+
const N = L.get(d.from_state ?? "") ?? "the previous step", s = L.get(d.to_state) ?? "the next step", g = $e(d) ? "it moved automatically" : `${O(d)} moved it`;
|
|
451
|
+
return `Passed over on ${new Date(d.timestamp).toLocaleString()} — ${g} straight from ${N} to ${s}`;
|
|
298
452
|
}
|
|
299
|
-
return /* @__PURE__ */ e(
|
|
300
|
-
const s =
|
|
301
|
-
return /* @__PURE__ */
|
|
302
|
-
/* @__PURE__ */
|
|
453
|
+
return /* @__PURE__ */ e(vt, { delayDuration: 200, children: /* @__PURE__ */ e("div", { ref: y, className: "overflow-x-auto pt-1.5 pb-1", "data-state-track": !0, children: /* @__PURE__ */ e("div", { className: "flex w-full items-start", children: b.map((d, N) => {
|
|
454
|
+
const s = d.id === a, g = C.has(d.id), $ = g && !s, K = !g && !s ? E.get(d.id) : void 0, V = !g && !s ? f == null ? void 0 : f.get(d.id) : void 0, u = K || V ? [...K ? [k(K)] : [], ...V ?? []] : void 0, v = u !== void 0, B = d.color ?? "#94a3b8", z = N === b.length - 1, X = z ? null : b[N + 1], ae = X ? M(d.id, X.id) : [];
|
|
455
|
+
return /* @__PURE__ */ r("div", { className: "flex flex-1 items-start", children: [
|
|
456
|
+
/* @__PURE__ */ r("div", { className: "flex min-w-[76px] flex-1 flex-col items-center gap-1.5 px-1", children: [
|
|
303
457
|
/* @__PURE__ */ e(
|
|
304
458
|
"div",
|
|
305
459
|
{
|
|
306
460
|
"data-track-current": s || void 0,
|
|
307
|
-
className: `flex h-7 w-7 shrink-0 items-center justify-center rounded-full ${s ||
|
|
308
|
-
"data-tip":
|
|
461
|
+
className: `flex h-7 w-7 shrink-0 items-center justify-center rounded-full ${s || $ ? "nvr-fill-sweep" : ""}`,
|
|
462
|
+
"data-tip": d.description || void 0,
|
|
309
463
|
style: {
|
|
310
|
-
backgroundColor: s ||
|
|
311
|
-
border: s ||
|
|
312
|
-
boxShadow: s ? `0 0 0 3px white, 0 0 0 5px ${
|
|
464
|
+
backgroundColor: s || $ ? B : v ? "transparent" : "#f1f5f9",
|
|
465
|
+
border: s || $ ? "none" : v ? "1.5px dashed #cbd5e1" : "1.5px solid #e2e8f0",
|
|
466
|
+
boxShadow: s ? `0 0 0 3px white, 0 0 0 5px ${B}` : void 0
|
|
313
467
|
},
|
|
314
|
-
children:
|
|
468
|
+
children: $ ? /* @__PURE__ */ e(Re, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : s ? /* @__PURE__ */ e("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : v ? /* @__PURE__ */ e(Ot, { className: "h-3 w-3 text-slate-400", strokeWidth: 2.5 }) : /* @__PURE__ */ e("div", { className: "h-2 w-2 rounded-full bg-slate-300" })
|
|
315
469
|
},
|
|
316
|
-
s ? "cur" :
|
|
470
|
+
s ? "cur" : $ ? "done" : v ? "skip" : "todo"
|
|
317
471
|
),
|
|
318
|
-
|
|
319
|
-
/* @__PURE__ */ e(
|
|
472
|
+
v ? /* @__PURE__ */ r(je, { children: [
|
|
473
|
+
/* @__PURE__ */ e(Me, { asChild: !0, children: /* @__PURE__ */ e(
|
|
320
474
|
"span",
|
|
321
475
|
{
|
|
322
476
|
className: "w-full cursor-help break-words text-center leading-snug",
|
|
@@ -328,12 +482,12 @@ function Ht({
|
|
|
328
482
|
textDecoration: "line-through",
|
|
329
483
|
textDecorationColor: "#cbd5e1"
|
|
330
484
|
},
|
|
331
|
-
children:
|
|
485
|
+
children: d.label
|
|
332
486
|
}
|
|
333
487
|
) }),
|
|
334
|
-
/* @__PURE__ */
|
|
488
|
+
/* @__PURE__ */ r(Ee, { className: "max-w-[260px]", children: [
|
|
335
489
|
/* @__PURE__ */ e("p", { className: "text-[11px] font-medium", children: "Skipped for this record" }),
|
|
336
|
-
|
|
490
|
+
u.length > 0 ? /* @__PURE__ */ e("ul", { className: "mt-1 space-y-0.5 text-[11px] opacity-90", children: u.map((o) => /* @__PURE__ */ e("li", { children: o }, o)) }) : /* @__PURE__ */ e("p", { className: "mt-1 text-[11px] opacity-90", children: "Its skip conditions are met." })
|
|
337
491
|
] })
|
|
338
492
|
] }) : /* @__PURE__ */ e(
|
|
339
493
|
"span",
|
|
@@ -341,23 +495,23 @@ function Ht({
|
|
|
341
495
|
className: "w-full break-words text-center leading-snug",
|
|
342
496
|
style: {
|
|
343
497
|
fontSize: "11px",
|
|
344
|
-
color: s ?
|
|
345
|
-
fontWeight: s ? 600 :
|
|
498
|
+
color: s ? B : $ ? "#475569" : "#94a3b8",
|
|
499
|
+
fontWeight: s ? 600 : $ ? 500 : 400,
|
|
346
500
|
wordBreak: "break-word"
|
|
347
501
|
},
|
|
348
|
-
children:
|
|
502
|
+
children: d.label
|
|
349
503
|
}
|
|
350
504
|
)
|
|
351
505
|
] }),
|
|
352
|
-
!
|
|
506
|
+
!z && /* @__PURE__ */ r("div", { className: "mt-[13px] flex w-10 shrink-0 flex-col items-center gap-1.5", children: [
|
|
353
507
|
(() => {
|
|
354
|
-
const
|
|
355
|
-
return /* @__PURE__ */
|
|
508
|
+
const o = $ ? `${B}55` : "#e8ecf0";
|
|
509
|
+
return /* @__PURE__ */ r("div", { className: "flex w-full shrink-0 items-center", children: [
|
|
356
510
|
/* @__PURE__ */ e(
|
|
357
511
|
"div",
|
|
358
512
|
{
|
|
359
513
|
className: "h-0.5 flex-1 rounded-l-sm",
|
|
360
|
-
style: { backgroundColor:
|
|
514
|
+
style: { backgroundColor: o }
|
|
361
515
|
}
|
|
362
516
|
),
|
|
363
517
|
/* @__PURE__ */ e(
|
|
@@ -368,82 +522,82 @@ function Ht({
|
|
|
368
522
|
height: 0,
|
|
369
523
|
borderTop: "3px solid transparent",
|
|
370
524
|
borderBottom: "3px solid transparent",
|
|
371
|
-
borderLeft: `5px solid ${
|
|
525
|
+
borderLeft: `5px solid ${o}`
|
|
372
526
|
}
|
|
373
527
|
}
|
|
374
528
|
)
|
|
375
529
|
] });
|
|
376
530
|
})(),
|
|
377
|
-
|
|
378
|
-
const
|
|
379
|
-
(
|
|
380
|
-
) > 1 ?
|
|
381
|
-
return /* @__PURE__ */
|
|
382
|
-
/* @__PURE__ */ e(
|
|
383
|
-
/* @__PURE__ */
|
|
531
|
+
ae.map((o) => {
|
|
532
|
+
const p = o.from_state !== d.id, w = Math.abs(
|
|
533
|
+
(S.get(o.to_state) ?? 0) - (S.get(o.from_state ?? "") ?? 0)
|
|
534
|
+
) > 1 ? L.get(o.to_state) ?? "" : null;
|
|
535
|
+
return /* @__PURE__ */ r(je, { children: [
|
|
536
|
+
/* @__PURE__ */ e(Me, { asChild: !0, children: /* @__PURE__ */ r("div", { className: "flex w-full cursor-default flex-col items-center gap-0.5", children: [
|
|
537
|
+
/* @__PURE__ */ r(
|
|
384
538
|
"span",
|
|
385
539
|
{
|
|
386
540
|
className: "text-center font-mono text-[9px] font-semibold leading-none",
|
|
387
|
-
style: { color:
|
|
541
|
+
style: { color: p ? "#d97706" : "#475569" },
|
|
388
542
|
children: [
|
|
389
|
-
|
|
390
|
-
|
|
543
|
+
p && "↩ ",
|
|
544
|
+
D(o)
|
|
391
545
|
]
|
|
392
546
|
}
|
|
393
547
|
),
|
|
394
|
-
/* @__PURE__ */ e("span", { className: "text-[8.5px] leading-none text-slate-400", children:
|
|
548
|
+
/* @__PURE__ */ e("span", { className: "text-[8.5px] leading-none text-slate-400", children: ze(o.timestamp) })
|
|
395
549
|
] }) }),
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
|
|
398
|
-
/* @__PURE__ */
|
|
399
|
-
|
|
400
|
-
|
|
550
|
+
/* @__PURE__ */ r(Ee, { side: "top", className: "space-y-0.5 text-[12px]", children: [
|
|
551
|
+
$e(o) ? /* @__PURE__ */ r(ce, { children: [
|
|
552
|
+
/* @__PURE__ */ r("p", { className: "font-medium", children: [
|
|
553
|
+
p ? "↩ Sent back · " : "",
|
|
554
|
+
Ue(o)
|
|
401
555
|
] }),
|
|
402
|
-
|
|
403
|
-
] }) : /* @__PURE__ */
|
|
404
|
-
|
|
556
|
+
Ke(o) && /* @__PURE__ */ e("p", { className: "max-w-[280px] text-muted-foreground", children: Ke(o) })
|
|
557
|
+
] }) : /* @__PURE__ */ r("p", { className: "font-medium", children: [
|
|
558
|
+
p ? "↩ Sent back by" : "Approved by",
|
|
405
559
|
" ",
|
|
406
|
-
|
|
560
|
+
O(o)
|
|
407
561
|
] }),
|
|
408
|
-
|
|
562
|
+
w && /* @__PURE__ */ r("p", { className: "text-muted-foreground", children: [
|
|
409
563
|
"→ straight to ",
|
|
410
|
-
|
|
564
|
+
w
|
|
411
565
|
] }),
|
|
412
|
-
/* @__PURE__ */ e("p", { className: "text-muted-foreground", children: new Date(
|
|
566
|
+
/* @__PURE__ */ e("p", { className: "text-muted-foreground", children: new Date(o.timestamp).toLocaleString() })
|
|
413
567
|
] })
|
|
414
|
-
] },
|
|
568
|
+
] }, o.id);
|
|
415
569
|
})
|
|
416
570
|
] })
|
|
417
|
-
] },
|
|
571
|
+
] }, d.id);
|
|
418
572
|
}) }) }) });
|
|
419
573
|
}
|
|
420
|
-
function
|
|
421
|
-
return
|
|
422
|
-
const
|
|
423
|
-
return /* @__PURE__ */
|
|
574
|
+
function un({ history: n }) {
|
|
575
|
+
return n.length === 0 ? /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400 italic", children: "No transitions yet." }) : /* @__PURE__ */ e("div", { className: "space-y-3", children: n.map((t) => {
|
|
576
|
+
const l = $e(t), a = l ? Ue(t) : Xe([t.first_name, t.last_name].filter(Boolean).join(" ") || t.user_email, t), x = tn(t), m = t.comment && !l && !x ? t.comment : null, f = x ?? (l ? Ke(t) : null);
|
|
577
|
+
return /* @__PURE__ */ r("div", { className: "flex items-start gap-2.5 text-[12px]", children: [
|
|
424
578
|
/* @__PURE__ */ e("div", { className: "mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-slate-200" }),
|
|
425
|
-
/* @__PURE__ */
|
|
426
|
-
/* @__PURE__ */
|
|
427
|
-
t.from_state_label ? /* @__PURE__ */ e(
|
|
428
|
-
/* @__PURE__ */ e(
|
|
429
|
-
/* @__PURE__ */ e(
|
|
579
|
+
/* @__PURE__ */ r("div", { className: "flex-1 min-w-0", children: [
|
|
580
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
581
|
+
t.from_state_label ? /* @__PURE__ */ e(de, { label: t.from_state_label, color: t.from_state_color, small: !0 }) : /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400 italic", children: "started" }),
|
|
582
|
+
/* @__PURE__ */ e(Qe, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
583
|
+
/* @__PURE__ */ e(de, { label: t.to_state_label, color: t.to_state_color, small: !0 })
|
|
430
584
|
] }),
|
|
431
|
-
|
|
585
|
+
m && /* @__PURE__ */ r("p", { className: "mt-1 text-slate-500 italic", children: [
|
|
432
586
|
'"',
|
|
433
|
-
|
|
587
|
+
m,
|
|
434
588
|
'"'
|
|
435
589
|
] }),
|
|
436
|
-
/* @__PURE__ */
|
|
590
|
+
/* @__PURE__ */ r(
|
|
437
591
|
"p",
|
|
438
592
|
{
|
|
439
593
|
className: "mt-0.5 text-slate-400",
|
|
440
594
|
"data-history-on-behalf": t.on_behalf_of_name ? t.on_behalf_of ?? "" : void 0,
|
|
441
595
|
children: [
|
|
442
|
-
|
|
443
|
-
|
|
596
|
+
l && /* @__PURE__ */ e(bt, { className: "mr-1 inline h-3 w-3", "aria-hidden": !0 }),
|
|
597
|
+
a,
|
|
444
598
|
f ? ` · ${f}` : "",
|
|
445
599
|
" · ",
|
|
446
|
-
|
|
600
|
+
ze(t.timestamp)
|
|
447
601
|
]
|
|
448
602
|
}
|
|
449
603
|
)
|
|
@@ -451,107 +605,107 @@ function Vt({ history: r }) {
|
|
|
451
605
|
] }, t.id);
|
|
452
606
|
}) });
|
|
453
607
|
}
|
|
454
|
-
function
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
var
|
|
459
|
-
return (
|
|
608
|
+
function pn({ value: n, onChange: t }) {
|
|
609
|
+
const l = he(), [a, x] = U(!1), [m, f] = U(""), [y, C] = U(""), P = te(null), h = te(null);
|
|
610
|
+
oe(() => {
|
|
611
|
+
a ? setTimeout(() => {
|
|
612
|
+
var k;
|
|
613
|
+
return (k = P.current) == null ? void 0 : k.focus();
|
|
460
614
|
}, 50) : f("");
|
|
461
|
-
}, [
|
|
615
|
+
}, [a]), oe(() => (h.current && clearTimeout(h.current), h.current = setTimeout(() => C(m), 250), () => {
|
|
462
616
|
h.current && clearTimeout(h.current);
|
|
463
|
-
}), [
|
|
464
|
-
const { data:
|
|
465
|
-
queryKey: ["users", "async-search",
|
|
466
|
-
queryFn: () =>
|
|
617
|
+
}), [m]);
|
|
618
|
+
const { data: b, isLoading: S } = ne({
|
|
619
|
+
queryKey: ["users", "async-search", y],
|
|
620
|
+
queryFn: () => l.request(
|
|
467
621
|
ie("/users", {
|
|
468
622
|
limit: 50,
|
|
469
623
|
sort: "first_name",
|
|
470
|
-
...
|
|
624
|
+
...y ? { search: y } : {}
|
|
471
625
|
})
|
|
472
|
-
).then((
|
|
473
|
-
enabled:
|
|
626
|
+
).then((k) => k.data),
|
|
627
|
+
enabled: a,
|
|
474
628
|
staleTime: 3e4
|
|
475
|
-
}), { data:
|
|
476
|
-
...
|
|
477
|
-
enabled: !!
|
|
629
|
+
}), { data: L } = ne({
|
|
630
|
+
...zt(l, n),
|
|
631
|
+
enabled: !!n,
|
|
478
632
|
staleTime: 5 * 6e4
|
|
479
|
-
}),
|
|
480
|
-
return /* @__PURE__ */
|
|
481
|
-
/* @__PURE__ */
|
|
482
|
-
/* @__PURE__ */ e(
|
|
633
|
+
}), M = b ?? [], D = L ?? M.find((k) => k.id === n) ?? null, O = D ? [D.first_name, D.last_name].filter(Boolean).join(" ").trim() || D.email : n ? "Selected person" : null, E = (k) => [k.first_name, k.last_name].filter(Boolean).join(" ").trim();
|
|
634
|
+
return /* @__PURE__ */ r(We, { open: a, onOpenChange: x, children: [
|
|
635
|
+
/* @__PURE__ */ r("div", { className: "relative flex h-8 w-full", children: [
|
|
636
|
+
/* @__PURE__ */ e(He, { asChild: !0, children: /* @__PURE__ */ r(
|
|
483
637
|
"button",
|
|
484
638
|
{
|
|
485
639
|
type: "button",
|
|
486
640
|
className: "flex h-full w-full items-center justify-between gap-1.5 rounded-md border border-slate-200 bg-white px-2.5 text-left text-[13px] text-slate-700 hover:border-slate-300",
|
|
487
641
|
children: [
|
|
488
|
-
/* @__PURE__ */ e("span", { className: `flex-1 truncate ${
|
|
489
|
-
/* @__PURE__ */ e(
|
|
642
|
+
/* @__PURE__ */ e("span", { className: `flex-1 truncate ${O ? "" : "text-slate-400"}`, children: O ?? "Select a user…" }),
|
|
643
|
+
/* @__PURE__ */ e(pe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
490
644
|
]
|
|
491
645
|
}
|
|
492
646
|
) }),
|
|
493
|
-
|
|
647
|
+
n && /* @__PURE__ */ e(
|
|
494
648
|
"button",
|
|
495
649
|
{
|
|
496
650
|
type: "button",
|
|
497
|
-
onClick: (
|
|
498
|
-
|
|
651
|
+
onClick: (k) => {
|
|
652
|
+
k.stopPropagation(), t("");
|
|
499
653
|
},
|
|
500
654
|
className: "absolute right-6 top-1/2 -translate-y-1/2 flex h-5 w-5 items-center justify-center rounded text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-muted dark:hover:text-slate-300",
|
|
501
|
-
children: /* @__PURE__ */ e(
|
|
655
|
+
children: /* @__PURE__ */ e(ht, { className: "h-3 w-3" })
|
|
502
656
|
}
|
|
503
657
|
)
|
|
504
658
|
] }),
|
|
505
|
-
/* @__PURE__ */
|
|
506
|
-
/* @__PURE__ */ e("div", { className: "border-b border-slate-100 px-2 py-1.5", children: /* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */ e(
|
|
659
|
+
/* @__PURE__ */ r(Ve, { align: "start", className: "w-72 p-0", sideOffset: 4, children: [
|
|
660
|
+
/* @__PURE__ */ e("div", { className: "border-b border-slate-100 px-2 py-1.5", children: /* @__PURE__ */ r("div", { className: "relative", children: [
|
|
661
|
+
/* @__PURE__ */ e(Bt, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
508
662
|
/* @__PURE__ */ e(
|
|
509
663
|
"input",
|
|
510
664
|
{
|
|
511
|
-
ref:
|
|
512
|
-
value:
|
|
513
|
-
onChange: (
|
|
665
|
+
ref: P,
|
|
666
|
+
value: m,
|
|
667
|
+
onChange: (k) => f(k.target.value),
|
|
514
668
|
placeholder: "Search users…",
|
|
515
669
|
className: "h-7 w-full rounded-md bg-slate-50 pl-7 pr-2 text-[12px] placeholder-slate-400 focus:outline-none focus:ring-1 focus:ring-nvr-cyan/40"
|
|
516
670
|
}
|
|
517
671
|
)
|
|
518
672
|
] }) }),
|
|
519
|
-
/* @__PURE__ */ e("div", { className: "max-h-56 overflow-y-auto py-1", children:
|
|
520
|
-
/* @__PURE__ */ e(
|
|
673
|
+
/* @__PURE__ */ e("div", { className: "max-h-56 overflow-y-auto py-1", children: S ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2 px-3 py-2 text-[12px] text-slate-400", children: [
|
|
674
|
+
/* @__PURE__ */ e(re, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
521
675
|
"Loading…"
|
|
522
|
-
] }) :
|
|
523
|
-
const
|
|
524
|
-
return /* @__PURE__ */
|
|
676
|
+
] }) : M.length === 0 ? /* @__PURE__ */ e("div", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No results" }) : M.map((k) => {
|
|
677
|
+
const A = E(k), d = A ? `${A} (${k.email})` : k.email, N = k.id === n;
|
|
678
|
+
return /* @__PURE__ */ r(
|
|
525
679
|
"button",
|
|
526
680
|
{
|
|
527
681
|
type: "button",
|
|
528
682
|
onClick: () => {
|
|
529
|
-
t(
|
|
683
|
+
t(k.id), x(!1);
|
|
530
684
|
},
|
|
531
|
-
className: `flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12px] hover:bg-slate-50 ${
|
|
685
|
+
className: `flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12px] hover:bg-slate-50 ${N ? "font-medium text-slate-800" : "text-slate-600"}`,
|
|
532
686
|
children: [
|
|
533
687
|
/* @__PURE__ */ e(
|
|
534
|
-
|
|
688
|
+
Re,
|
|
535
689
|
{
|
|
536
|
-
className: `h-3.5 w-3.5 shrink-0 ${
|
|
690
|
+
className: `h-3.5 w-3.5 shrink-0 ${N ? "text-nvr-cyan" : "opacity-0"}`
|
|
537
691
|
}
|
|
538
692
|
),
|
|
539
|
-
|
|
693
|
+
d
|
|
540
694
|
]
|
|
541
695
|
},
|
|
542
|
-
|
|
696
|
+
k.id
|
|
543
697
|
);
|
|
544
698
|
}) })
|
|
545
699
|
] })
|
|
546
700
|
] });
|
|
547
701
|
}
|
|
548
|
-
function
|
|
549
|
-
userId:
|
|
702
|
+
function ut({
|
|
703
|
+
userId: n,
|
|
550
704
|
name: t,
|
|
551
|
-
email:
|
|
552
|
-
initials:
|
|
705
|
+
email: l,
|
|
706
|
+
initials: a
|
|
553
707
|
}) {
|
|
554
|
-
return /* @__PURE__ */ e(
|
|
708
|
+
return /* @__PURE__ */ e(wt, { userId: n, children: /* @__PURE__ */ r(
|
|
555
709
|
"button",
|
|
556
710
|
{
|
|
557
711
|
type: "button",
|
|
@@ -559,153 +713,153 @@ function at({
|
|
|
559
713
|
className: "group/owner flex min-w-0 flex-1 items-center gap-2.5 rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
560
714
|
children: [
|
|
561
715
|
/* @__PURE__ */ e(
|
|
562
|
-
|
|
716
|
+
Gt,
|
|
563
717
|
{
|
|
564
|
-
userId:
|
|
718
|
+
userId: n,
|
|
565
719
|
alt: t,
|
|
566
720
|
className: "h-6 w-6",
|
|
567
|
-
fallback: /* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80 dark:bg-nvr-cyan/15 dark:text-nvr-cyan", children:
|
|
721
|
+
fallback: /* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80 dark:bg-nvr-cyan/15 dark:text-nvr-cyan", children: a })
|
|
568
722
|
}
|
|
569
723
|
),
|
|
570
|
-
/* @__PURE__ */
|
|
724
|
+
/* @__PURE__ */ r("span", { className: "min-w-0 flex-1", children: [
|
|
571
725
|
/* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700 underline-offset-2 group-hover/owner:underline dark:text-slate-200", children: t }),
|
|
572
|
-
/* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400 dark:text-slate-500", children:
|
|
726
|
+
/* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400 dark:text-slate-500", children: l })
|
|
573
727
|
] })
|
|
574
728
|
]
|
|
575
729
|
}
|
|
576
730
|
) });
|
|
577
731
|
}
|
|
578
|
-
function
|
|
579
|
-
collection:
|
|
732
|
+
function fn({
|
|
733
|
+
collection: n,
|
|
580
734
|
item: t,
|
|
581
|
-
states:
|
|
582
|
-
currentStateId:
|
|
583
|
-
returned:
|
|
735
|
+
states: l,
|
|
736
|
+
currentStateId: a,
|
|
737
|
+
returned: x = !1
|
|
584
738
|
}) {
|
|
585
|
-
var
|
|
586
|
-
const
|
|
587
|
-
ie(`/pipelines/instance/${
|
|
588
|
-
).then((
|
|
589
|
-
var
|
|
590
|
-
return f.setQueryData(
|
|
591
|
-
}), { data:
|
|
592
|
-
queryKey:
|
|
593
|
-
queryFn: () =>
|
|
594
|
-
}), { data:
|
|
595
|
-
queryKey:
|
|
596
|
-
queryFn: () =>
|
|
597
|
-
var
|
|
598
|
-
return ((
|
|
739
|
+
var F, I, W;
|
|
740
|
+
const m = he(), f = ke(), { isAdmin: y } = jt(), [C, P] = U(!1), [h, b] = U(""), [S, L] = U(""), [M, D] = U(!1), O = ["pipeline-instance-owners", n, t], E = ["pipeline-owners-can-add", n, t], k = () => m.request(
|
|
741
|
+
ie(`/pipelines/instance/${n}/${t}/owners`)
|
|
742
|
+
).then((i) => {
|
|
743
|
+
var _;
|
|
744
|
+
return f.setQueryData(E, ((_ = i.meta) == null ? void 0 : _.can_add) ?? null), i;
|
|
745
|
+
}), { data: A, isLoading: d } = ne({
|
|
746
|
+
queryKey: O,
|
|
747
|
+
queryFn: () => k().then((i) => i.data)
|
|
748
|
+
}), { data: N } = ne({
|
|
749
|
+
queryKey: E,
|
|
750
|
+
queryFn: () => k().then((i) => {
|
|
751
|
+
var _;
|
|
752
|
+
return ((_ = i.meta) == null ? void 0 : _.can_add) ?? null;
|
|
599
753
|
}),
|
|
600
|
-
enabled: !
|
|
754
|
+
enabled: !d,
|
|
601
755
|
staleTime: 3e4
|
|
602
|
-
}), s = typeof
|
|
603
|
-
queryKey: ["pipeline-all-owners",
|
|
604
|
-
queryFn: () =>
|
|
605
|
-
ie(`/pipelines/instance/${
|
|
606
|
-
).then((
|
|
607
|
-
enabled: !!
|
|
756
|
+
}), s = typeof N == "boolean" ? N : y, { data: g, isLoading: $ } = ne({
|
|
757
|
+
queryKey: ["pipeline-all-owners", n, t],
|
|
758
|
+
queryFn: () => m.request(
|
|
759
|
+
ie(`/pipelines/instance/${n}/${t}/owners/all`)
|
|
760
|
+
).then((i) => i.data ?? null),
|
|
761
|
+
enabled: !!a,
|
|
608
762
|
staleTime: 3e4
|
|
609
|
-
}),
|
|
610
|
-
queryKey: ["pipeline-record-creator",
|
|
611
|
-
queryFn: () =>
|
|
612
|
-
ie(`/pipelines/instance/${
|
|
613
|
-
).then((
|
|
614
|
-
enabled:
|
|
763
|
+
}), K = new Set((A ?? []).map((i) => i.user)), V = a ? (((F = g == null ? void 0 : g[a]) == null ? void 0 : F.owners) ?? []).filter((i) => !K.has(i.id)) : [], u = V.length + ((A == null ? void 0 : A.length) ?? 0), v = !!((I = l.find((i) => i.id === a)) != null && I.is_initial), B = !d && !$, { data: z } = ne({
|
|
764
|
+
queryKey: ["pipeline-record-creator", n, t],
|
|
765
|
+
queryFn: () => m.request(
|
|
766
|
+
ie(`/pipelines/instance/${n}/${t}/creator`)
|
|
767
|
+
).then((i) => i.data ?? null),
|
|
768
|
+
enabled: v && B && u === 0,
|
|
615
769
|
staleTime: 6e4
|
|
616
|
-
}),
|
|
617
|
-
f.invalidateQueries({ queryKey:
|
|
618
|
-
},
|
|
619
|
-
mutationFn: () =>
|
|
620
|
-
|
|
770
|
+
}), X = v && u === 0 && (z != null && z.name) ? z : null, ae = () => {
|
|
771
|
+
f.invalidateQueries({ queryKey: O }), f.invalidateQueries({ queryKey: ["pipeline-instance", n, t] });
|
|
772
|
+
}, o = ye({
|
|
773
|
+
mutationFn: () => m.request(
|
|
774
|
+
fe(`/pipelines/instance/${n}/${t}/owners`, {
|
|
621
775
|
user: h,
|
|
622
|
-
state:
|
|
776
|
+
state: S || void 0
|
|
623
777
|
})
|
|
624
778
|
),
|
|
625
779
|
onSuccess: () => {
|
|
626
|
-
|
|
780
|
+
ae(), b(""), L(""), P(!1), ee.success("Owner added");
|
|
627
781
|
},
|
|
628
782
|
// The server's reason (a 403 says why), not a bare status phrase.
|
|
629
|
-
onError: (
|
|
630
|
-
}),
|
|
631
|
-
mutationFn: (
|
|
632
|
-
onSuccess: (
|
|
633
|
-
|
|
634
|
-
const H = [
|
|
783
|
+
onError: (i) => ee.error(ve(i, "Failed to add owner"))
|
|
784
|
+
}), p = ye({
|
|
785
|
+
mutationFn: (i) => m.request(Mt(`/pipelines/instance-owners/${i.id}`)),
|
|
786
|
+
onSuccess: (i, _) => {
|
|
787
|
+
ae();
|
|
788
|
+
const H = [_.first_name, _.last_name].filter(Boolean).join(" ") || _.email;
|
|
635
789
|
ee.success(`${H} removed as an owner`, {
|
|
636
790
|
action: {
|
|
637
791
|
label: "Undo",
|
|
638
|
-
onClick: () => void
|
|
639
|
-
|
|
640
|
-
user:
|
|
641
|
-
state:
|
|
792
|
+
onClick: () => void m.request(
|
|
793
|
+
fe(`/pipelines/instance/${n}/${t}/owners`, {
|
|
794
|
+
user: _.user,
|
|
795
|
+
state: _.state || void 0
|
|
642
796
|
})
|
|
643
|
-
).then(() =>
|
|
797
|
+
).then(() => ae()).catch((q) => ee.error(ve(q, "Could not add the owner back")))
|
|
644
798
|
}
|
|
645
799
|
});
|
|
646
800
|
},
|
|
647
|
-
onError: (
|
|
648
|
-
}),
|
|
649
|
-
var
|
|
650
|
-
const
|
|
651
|
-
return (`${
|
|
652
|
-
},
|
|
653
|
-
var
|
|
654
|
-
return
|
|
801
|
+
onError: (i) => ee.error(ve(i, "Failed to remove owner"))
|
|
802
|
+
}), w = (i) => {
|
|
803
|
+
var q, Z;
|
|
804
|
+
const _ = ((q = i.first_name) == null ? void 0 : q[0]) ?? "", H = ((Z = i.last_name) == null ? void 0 : Z[0]) ?? "";
|
|
805
|
+
return (`${_}${H}`.trim() || i.email[0] || "?").toUpperCase();
|
|
806
|
+
}, T = (i) => {
|
|
807
|
+
var _;
|
|
808
|
+
return i ? ((_ = l.find((H) => H.id === i || H.key === i)) == null ? void 0 : _.label) ?? i : null;
|
|
655
809
|
};
|
|
656
|
-
return /* @__PURE__ */
|
|
657
|
-
/* @__PURE__ */
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
-
/* @__PURE__ */ e(
|
|
810
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
811
|
+
/* @__PURE__ */ r("div", { className: "mb-3 flex items-center justify-between", children: [
|
|
812
|
+
/* @__PURE__ */ r("span", { className: "flex items-center gap-1.5 text-[11px] font-medium text-slate-400", children: [
|
|
813
|
+
/* @__PURE__ */ e(ft, { className: "h-3.5 w-3.5" }),
|
|
660
814
|
"Owners",
|
|
661
|
-
|
|
815
|
+
d || $ ? /* @__PURE__ */ e("span", { className: "inline-block h-3 w-4 animate-pulse rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : X ? null : /* @__PURE__ */ r("span", { className: "text-slate-300", children: [
|
|
662
816
|
"(",
|
|
663
|
-
|
|
817
|
+
u,
|
|
664
818
|
")"
|
|
665
819
|
] })
|
|
666
820
|
] }),
|
|
667
|
-
/* @__PURE__ */
|
|
668
|
-
|
|
669
|
-
!
|
|
821
|
+
/* @__PURE__ */ r("span", { className: "flex items-center gap-3", children: [
|
|
822
|
+
a && /* @__PURE__ */ e(Jt, { collection: n, itemId: String(t) }),
|
|
823
|
+
!C && s && /* @__PURE__ */ r(
|
|
670
824
|
"button",
|
|
671
825
|
{
|
|
672
826
|
type: "button",
|
|
673
|
-
onClick: () =>
|
|
827
|
+
onClick: () => P(!0),
|
|
674
828
|
className: "flex items-center gap-1 text-[11px] text-slate-400 transition-colors hover:text-nvr-cyan",
|
|
675
829
|
children: [
|
|
676
|
-
/* @__PURE__ */ e(
|
|
830
|
+
/* @__PURE__ */ e(Ft, { className: "h-3 w-3" }),
|
|
677
831
|
"Add"
|
|
678
832
|
]
|
|
679
833
|
}
|
|
680
834
|
)
|
|
681
835
|
] })
|
|
682
836
|
] }),
|
|
683
|
-
|
|
684
|
-
/* @__PURE__ */ e(
|
|
837
|
+
d || $ ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2 py-1.5 text-[12px] text-slate-400", children: [
|
|
838
|
+
/* @__PURE__ */ e(re, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
685
839
|
"Resolving owners…"
|
|
686
|
-
] }) :
|
|
687
|
-
|
|
840
|
+
] }) : X ? /* @__PURE__ */ r("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
|
|
841
|
+
x ? "Back with" : "With",
|
|
688
842
|
" ",
|
|
689
|
-
/* @__PURE__ */ e(
|
|
843
|
+
/* @__PURE__ */ e(wt, { userId: X.id, children: /* @__PURE__ */ e(
|
|
690
844
|
"button",
|
|
691
845
|
{
|
|
692
846
|
type: "button",
|
|
693
|
-
"aria-label": `${
|
|
847
|
+
"aria-label": `${X.name} — profile`,
|
|
694
848
|
className: "rounded font-medium text-slate-700 underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-foreground",
|
|
695
|
-
children:
|
|
849
|
+
children: X.name
|
|
696
850
|
}
|
|
697
851
|
) })
|
|
698
|
-
] }) :
|
|
699
|
-
|
|
700
|
-
var
|
|
701
|
-
const
|
|
702
|
-
return /* @__PURE__ */
|
|
852
|
+
] }) : u === 0 ? /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "No owners assigned." }) : /* @__PURE__ */ r("div", { className: "space-y-px", children: [
|
|
853
|
+
V.map((i) => {
|
|
854
|
+
var q, Z;
|
|
855
|
+
const _ = [i.first_name, i.last_name].filter(Boolean).join(" ") || i.email, H = (`${((q = i.first_name) == null ? void 0 : q[0]) ?? ""}${((Z = i.last_name) == null ? void 0 : Z[0]) ?? ""}`.trim() || i.email[0] || "?").toUpperCase();
|
|
856
|
+
return /* @__PURE__ */ r(
|
|
703
857
|
"div",
|
|
704
858
|
{
|
|
705
859
|
className: "-mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
|
|
706
860
|
children: [
|
|
707
|
-
/* @__PURE__ */ e(
|
|
708
|
-
|
|
861
|
+
/* @__PURE__ */ e(ut, { userId: i.id, name: _, email: i.email, initials: H }),
|
|
862
|
+
i.queue_only ? /* @__PURE__ */ e(
|
|
709
863
|
"span",
|
|
710
864
|
{
|
|
711
865
|
className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:bg-slate-800 dark:text-slate-400",
|
|
@@ -715,203 +869,203 @@ function Xt({
|
|
|
715
869
|
) : /* @__PURE__ */ e("span", { className: "shrink-0 rounded-full bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-medium text-nvr-navy/70 dark:text-nvr-cyan", children: "owner group" })
|
|
716
870
|
]
|
|
717
871
|
},
|
|
718
|
-
`group-${
|
|
872
|
+
`group-${i.id}`
|
|
719
873
|
);
|
|
720
874
|
}),
|
|
721
|
-
(
|
|
875
|
+
(A ?? []).map((i) => /* @__PURE__ */ r(
|
|
722
876
|
"div",
|
|
723
877
|
{
|
|
724
878
|
className: "group -mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
|
|
725
879
|
children: [
|
|
726
880
|
/* @__PURE__ */ e(
|
|
727
|
-
|
|
881
|
+
ut,
|
|
728
882
|
{
|
|
729
|
-
userId:
|
|
730
|
-
name: [
|
|
731
|
-
email:
|
|
732
|
-
initials:
|
|
883
|
+
userId: i.user,
|
|
884
|
+
name: [i.first_name, i.last_name].filter(Boolean).join(" ") || i.email,
|
|
885
|
+
email: i.email,
|
|
886
|
+
initials: w(i)
|
|
733
887
|
}
|
|
734
888
|
),
|
|
735
889
|
/* @__PURE__ */ e("span", { className: "shrink-0 rounded-full bg-amber-50 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:bg-amber-500/10 dark:text-amber-400", children: "manual" }),
|
|
736
|
-
/* @__PURE__ */ e("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children:
|
|
890
|
+
/* @__PURE__ */ e("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children: i.state ? T(i.state) : "all states" }),
|
|
737
891
|
/* @__PURE__ */ e(
|
|
738
892
|
"button",
|
|
739
893
|
{
|
|
740
894
|
type: "button",
|
|
741
|
-
"aria-label": `Remove ${[
|
|
742
|
-
disabled:
|
|
743
|
-
onClick: () =>
|
|
895
|
+
"aria-label": `Remove ${[i.first_name, i.last_name].filter(Boolean).join(" ") || i.email} as an owner`,
|
|
896
|
+
disabled: p.isPending,
|
|
897
|
+
onClick: () => p.mutate(i),
|
|
744
898
|
className: "shrink-0 rounded p-0.5 text-slate-300 opacity-0 transition-all hover:text-red-500 focus-visible:opacity-100 group-hover:opacity-100",
|
|
745
|
-
children: /* @__PURE__ */ e(
|
|
899
|
+
children: /* @__PURE__ */ e(ht, { className: "h-3 w-3" })
|
|
746
900
|
}
|
|
747
901
|
)
|
|
748
902
|
]
|
|
749
903
|
},
|
|
750
|
-
|
|
904
|
+
i.id
|
|
751
905
|
))
|
|
752
906
|
] }),
|
|
753
|
-
|
|
907
|
+
C && /* @__PURE__ */ r("div", { className: "mt-3 space-y-2 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3", children: [
|
|
754
908
|
/* @__PURE__ */ e("p", { className: "text-[11px] font-semibold text-slate-500", children: "Add owner" }),
|
|
755
|
-
/* @__PURE__ */ e(
|
|
756
|
-
|
|
757
|
-
/* @__PURE__ */ e(
|
|
909
|
+
/* @__PURE__ */ e(pn, { value: h, onChange: b }),
|
|
910
|
+
y ? /* @__PURE__ */ r(We, { open: M, onOpenChange: D, children: [
|
|
911
|
+
/* @__PURE__ */ e(He, { asChild: !0, children: /* @__PURE__ */ r(
|
|
758
912
|
"button",
|
|
759
913
|
{
|
|
760
914
|
type: "button",
|
|
761
915
|
className: "flex h-8 w-full items-center justify-between rounded-md border border-slate-200 bg-white px-2.5 text-left text-[13px] text-slate-700 transition-colors hover:border-slate-300 dark:border-border dark:bg-transparent dark:text-slate-300",
|
|
762
916
|
children: [
|
|
763
|
-
/* @__PURE__ */ e("span", { className: "truncate", children:
|
|
764
|
-
/* @__PURE__ */ e(
|
|
917
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: S ? ((W = l.find((i) => i.id === S)) == null ? void 0 : W.label) ?? S : "All states" }),
|
|
918
|
+
/* @__PURE__ */ e(pe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
765
919
|
]
|
|
766
920
|
}
|
|
767
921
|
) }),
|
|
768
|
-
/* @__PURE__ */ e(
|
|
769
|
-
var
|
|
770
|
-
const
|
|
922
|
+
/* @__PURE__ */ e(Ve, { align: "start", sideOffset: 4, className: "w-52 p-1", children: ["", ...l.map((i) => i.id)].map((i) => {
|
|
923
|
+
var q;
|
|
924
|
+
const _ = i === "" ? "All states" : ((q = l.find((Z) => Z.id === i)) == null ? void 0 : q.label) ?? i;
|
|
771
925
|
return /* @__PURE__ */ e(
|
|
772
926
|
"button",
|
|
773
927
|
{
|
|
774
928
|
type: "button",
|
|
775
|
-
className:
|
|
929
|
+
className: we(
|
|
776
930
|
"flex w-full rounded px-2.5 py-1.5 text-left text-[13px] transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
|
|
777
|
-
|
|
931
|
+
S === i && "font-medium text-slate-800 dark:text-slate-200"
|
|
778
932
|
),
|
|
779
933
|
onClick: () => {
|
|
780
|
-
|
|
934
|
+
L(i), D(!1);
|
|
781
935
|
},
|
|
782
|
-
children:
|
|
936
|
+
children: _
|
|
783
937
|
},
|
|
784
|
-
|
|
938
|
+
i
|
|
785
939
|
);
|
|
786
940
|
}) })
|
|
787
941
|
] }) : /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: "Hands off the current step." }),
|
|
788
|
-
/* @__PURE__ */
|
|
942
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-end gap-2 pt-0.5", children: [
|
|
789
943
|
/* @__PURE__ */ e(
|
|
790
|
-
|
|
944
|
+
J,
|
|
791
945
|
{
|
|
792
946
|
type: "button",
|
|
793
947
|
size: "sm",
|
|
794
948
|
variant: "ghost",
|
|
795
949
|
className: "h-7 text-[12px]",
|
|
796
950
|
onClick: () => {
|
|
797
|
-
|
|
951
|
+
P(!1), b(""), L("");
|
|
798
952
|
},
|
|
799
953
|
children: "Cancel"
|
|
800
954
|
}
|
|
801
955
|
),
|
|
802
956
|
/* @__PURE__ */ e(
|
|
803
|
-
|
|
957
|
+
J,
|
|
804
958
|
{
|
|
805
959
|
type: "button",
|
|
806
960
|
size: "sm",
|
|
807
961
|
className: "h-7 text-[12px]",
|
|
808
|
-
disabled: !h ||
|
|
809
|
-
onClick: () =>
|
|
810
|
-
children:
|
|
962
|
+
disabled: !h || o.isPending,
|
|
963
|
+
onClick: () => o.mutate(),
|
|
964
|
+
children: o.isPending ? /* @__PURE__ */ e(re, { className: "h-3.5 w-3.5 animate-spin" }) : "Add"
|
|
811
965
|
}
|
|
812
966
|
)
|
|
813
967
|
] })
|
|
814
968
|
] })
|
|
815
969
|
] });
|
|
816
970
|
}
|
|
817
|
-
const
|
|
971
|
+
const pt = {
|
|
818
972
|
out: "out of office",
|
|
819
973
|
suspended: "suspended",
|
|
820
974
|
redacted: "redacted"
|
|
821
975
|
};
|
|
822
|
-
function
|
|
823
|
-
collection:
|
|
976
|
+
function hn({
|
|
977
|
+
collection: n,
|
|
824
978
|
item: t,
|
|
825
|
-
states:
|
|
826
|
-
currentStateId:
|
|
979
|
+
states: l,
|
|
980
|
+
currentStateId: a
|
|
827
981
|
}) {
|
|
828
|
-
const
|
|
829
|
-
queryKey: ["pipeline-all-owners",
|
|
830
|
-
queryFn: () =>
|
|
831
|
-
ie(`/pipelines/instance/${
|
|
982
|
+
const x = he(), [m, f] = U(!1), { data: y, isLoading: C } = ne({
|
|
983
|
+
queryKey: ["pipeline-all-owners", n, t],
|
|
984
|
+
queryFn: () => x.request(
|
|
985
|
+
ie(`/pipelines/instance/${n}/${t}/owners/all`)
|
|
832
986
|
).then((h) => h.data ?? null),
|
|
833
|
-
enabled:
|
|
987
|
+
enabled: m,
|
|
834
988
|
staleTime: 3e4
|
|
835
|
-
}),
|
|
836
|
-
var
|
|
837
|
-
return !
|
|
838
|
-
}).sort((h,
|
|
839
|
-
return /* @__PURE__ */
|
|
840
|
-
/* @__PURE__ */ e(
|
|
989
|
+
}), P = [...l].filter((h) => {
|
|
990
|
+
var b;
|
|
991
|
+
return !y || ((b = y[h.id]) == null ? void 0 : b.on_path) !== !1;
|
|
992
|
+
}).sort((h, b) => h.sort - b.sort);
|
|
993
|
+
return /* @__PURE__ */ r(We, { open: m, onOpenChange: f, children: [
|
|
994
|
+
/* @__PURE__ */ e(He, { asChild: !0, children: /* @__PURE__ */ e(
|
|
841
995
|
"button",
|
|
842
996
|
{
|
|
843
997
|
type: "button",
|
|
844
998
|
title: "View approval chain",
|
|
845
999
|
className: "flex h-6 w-6 items-center justify-center rounded text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-muted dark:hover:text-slate-300",
|
|
846
1000
|
onClick: (h) => h.stopPropagation(),
|
|
847
|
-
children: /* @__PURE__ */ e(
|
|
1001
|
+
children: /* @__PURE__ */ e(ft, { className: "h-3.5 w-3.5" })
|
|
848
1002
|
}
|
|
849
1003
|
) }),
|
|
850
|
-
/* @__PURE__ */
|
|
851
|
-
/* @__PURE__ */
|
|
1004
|
+
/* @__PURE__ */ r(Ve, { align: "end", sideOffset: 6, className: "w-[576px] p-0 overflow-hidden", children: [
|
|
1005
|
+
/* @__PURE__ */ r("div", { className: "border-b border-slate-100 px-4 py-3", children: [
|
|
852
1006
|
/* @__PURE__ */ e("p", { className: "text-[12px] font-semibold text-slate-700", children: "Approval Chain" }),
|
|
853
1007
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400 mt-0.5", children: "Owners per pipeline state" })
|
|
854
1008
|
] }),
|
|
855
|
-
/* @__PURE__ */ e("div", { className: "max-h-[504px] overflow-y-auto", children:
|
|
856
|
-
var
|
|
857
|
-
const
|
|
1009
|
+
/* @__PURE__ */ e("div", { className: "max-h-[504px] overflow-y-auto", children: C ? /* @__PURE__ */ e("div", { className: "space-y-px p-3", children: [1, 2, 3].map((h) => /* @__PURE__ */ e(le, { className: "h-10 w-full" }, h)) }) : y ? /* @__PURE__ */ e("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: P.map((h) => {
|
|
1010
|
+
var E, k, A, d, N;
|
|
1011
|
+
const b = (((E = y[h.id]) == null ? void 0 : E.owners) ?? []).map((s) => ({
|
|
858
1012
|
id: s.id,
|
|
859
1013
|
name: [s.first_name, s.last_name].filter(Boolean).join(" ") || s.email
|
|
860
|
-
})),
|
|
861
|
-
return /* @__PURE__ */
|
|
1014
|
+
})), S = h.id === a, L = ((k = y[h.id]) == null ? void 0 : k.skipped) === !0 && !S, M = (((A = y[h.id]) == null ? void 0 : A.skip_reasons) ?? []).filter(Boolean), D = ((d = y[h.id]) == null ? void 0 : d.unavailable) ?? [], O = ((N = y[h.id]) == null ? void 0 : N.blocked) === !0 && !L;
|
|
1015
|
+
return /* @__PURE__ */ r(
|
|
862
1016
|
"div",
|
|
863
1017
|
{
|
|
864
|
-
className:
|
|
1018
|
+
className: we(
|
|
865
1019
|
"flex items-center gap-3 px-4 py-2.5",
|
|
866
1020
|
// Hex-with-alpha rather than bg-nvr-cyan/N — the
|
|
867
1021
|
// nvr-cyan token is an opaque var() so Tailwind silently
|
|
868
1022
|
// drops opacity modifiers on it. Kept very light so the
|
|
869
1023
|
// tint doesn't clash with the state badge's own color.
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
1024
|
+
S && "bg-nvr-cyan/[0.06] dark:bg-nvr-cyan/[0.11]",
|
|
1025
|
+
L && "opacity-60",
|
|
1026
|
+
O && "bg-red-50 dark:bg-red-500/10"
|
|
873
1027
|
),
|
|
874
|
-
"data-chain-blocked":
|
|
1028
|
+
"data-chain-blocked": O ? "" : void 0,
|
|
875
1029
|
children: [
|
|
876
|
-
/* @__PURE__ */ e(
|
|
877
|
-
/* @__PURE__ */ e("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children:
|
|
1030
|
+
/* @__PURE__ */ e(de, { label: h.label, color: h.color, small: !0 }),
|
|
1031
|
+
/* @__PURE__ */ e("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children: L ? (
|
|
878
1032
|
// Radix tooltip with zero delay — native `title` waits on
|
|
879
1033
|
// the OS hover timer, and a truncated reason needs its
|
|
880
1034
|
// full text the moment the cursor lands on it.
|
|
881
|
-
/* @__PURE__ */ e(
|
|
882
|
-
/* @__PURE__ */ e(
|
|
1035
|
+
/* @__PURE__ */ e(vt, { delayDuration: 0, children: /* @__PURE__ */ r(je, { children: [
|
|
1036
|
+
/* @__PURE__ */ e(Me, { asChild: !0, children: /* @__PURE__ */ r("div", { className: "flex min-w-0 flex-1 cursor-default items-center gap-2", children: [
|
|
883
1037
|
/* @__PURE__ */ e("span", { className: "inline-flex shrink-0 items-center gap-1 rounded-full border border-dashed border-slate-300 px-2 py-0.5 text-[10.5px] font-medium text-slate-400 dark:border-slate-600 dark:text-slate-500", children: "Skipped" }),
|
|
884
|
-
|
|
1038
|
+
M.length > 0 && /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[11px] text-slate-400 dark:text-slate-500", children: M.join(" · ") })
|
|
885
1039
|
] }) }),
|
|
886
|
-
/* @__PURE__ */
|
|
887
|
-
|
|
1040
|
+
/* @__PURE__ */ r(
|
|
1041
|
+
Ee,
|
|
888
1042
|
{
|
|
889
1043
|
side: "bottom",
|
|
890
1044
|
align: "start",
|
|
891
1045
|
className: "max-w-[420px] space-y-0.5 text-[11.5px] leading-snug",
|
|
892
1046
|
children: [
|
|
893
1047
|
/* @__PURE__ */ e("p", { className: "text-slate-500 dark:text-slate-400", children: "The pipeline will pass through this state without stopping:" }),
|
|
894
|
-
|
|
1048
|
+
M.length > 0 ? M.map((s) => /* @__PURE__ */ e("p", { children: s }, s)) : /* @__PURE__ */ e("p", { children: "Skip criteria currently match" })
|
|
895
1049
|
]
|
|
896
1050
|
}
|
|
897
1051
|
)
|
|
898
1052
|
] }) })
|
|
899
|
-
) : /* @__PURE__ */
|
|
900
|
-
/* @__PURE__ */ e(
|
|
901
|
-
|
|
1053
|
+
) : /* @__PURE__ */ r(ce, { children: [
|
|
1054
|
+
/* @__PURE__ */ e(Xt, { owners: b, max: 10, emptyLabel: "—" }),
|
|
1055
|
+
D.map((s) => /* @__PURE__ */ r(
|
|
902
1056
|
"span",
|
|
903
1057
|
{
|
|
904
|
-
"data-tip": `${s.name} is ${
|
|
905
|
-
className:
|
|
1058
|
+
"data-tip": `${s.name} is ${pt[s.reason] ?? s.reason}${s.delegate ? ` — ${s.delegate.name} covers${s.delegate.expires_at ? ` until ${new Date(s.delegate.expires_at).toLocaleDateString()}` : ""}` : " and nobody is covering"}`,
|
|
1059
|
+
className: we(
|
|
906
1060
|
"inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10.5px] font-medium",
|
|
907
1061
|
s.delegate ? "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200" : "border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
|
|
908
1062
|
),
|
|
909
1063
|
children: [
|
|
910
1064
|
s.name,
|
|
911
|
-
s.delegate ? /* @__PURE__ */
|
|
1065
|
+
s.delegate ? /* @__PURE__ */ r(ce, { children: [
|
|
912
1066
|
" → ",
|
|
913
1067
|
s.delegate.name,
|
|
914
|
-
s.delegate.expires_at && /* @__PURE__ */
|
|
1068
|
+
s.delegate.expires_at && /* @__PURE__ */ r("span", { className: "opacity-70", children: [
|
|
915
1069
|
", until",
|
|
916
1070
|
" ",
|
|
917
1071
|
new Date(s.delegate.expires_at).toLocaleDateString(
|
|
@@ -922,16 +1076,16 @@ function Jt({
|
|
|
922
1076
|
}
|
|
923
1077
|
)
|
|
924
1078
|
] })
|
|
925
|
-
] }) : /* @__PURE__ */
|
|
1079
|
+
] }) : /* @__PURE__ */ r("span", { className: "opacity-80", children: [
|
|
926
1080
|
" ",
|
|
927
1081
|
"· ",
|
|
928
|
-
|
|
1082
|
+
pt[s.reason] ?? s.reason
|
|
929
1083
|
] })
|
|
930
1084
|
]
|
|
931
1085
|
},
|
|
932
1086
|
s.id
|
|
933
1087
|
)),
|
|
934
|
-
|
|
1088
|
+
O && /* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1 rounded-full bg-red-600 px-2 py-0.5 text-[10.5px] font-semibold text-white", children: "No one can act here" })
|
|
935
1089
|
] }) })
|
|
936
1090
|
]
|
|
937
1091
|
},
|
|
@@ -941,182 +1095,188 @@ function Jt({
|
|
|
941
1095
|
] })
|
|
942
1096
|
] });
|
|
943
1097
|
}
|
|
944
|
-
function
|
|
945
|
-
collection:
|
|
1098
|
+
function Wn({
|
|
1099
|
+
collection: n,
|
|
946
1100
|
item: t,
|
|
947
|
-
defaultExpanded:
|
|
948
|
-
title:
|
|
949
|
-
showApprovalChain:
|
|
950
|
-
hideActionsCollapsed:
|
|
1101
|
+
defaultExpanded: l,
|
|
1102
|
+
title: a,
|
|
1103
|
+
showApprovalChain: x,
|
|
1104
|
+
hideActionsCollapsed: m,
|
|
951
1105
|
hideActionsExpanded: f,
|
|
952
|
-
onBeforeTransition:
|
|
953
|
-
addendumPending:
|
|
954
|
-
addendumView:
|
|
1106
|
+
onBeforeTransition: y,
|
|
1107
|
+
addendumPending: C,
|
|
1108
|
+
addendumView: P,
|
|
955
1109
|
asRole: h
|
|
956
1110
|
}) {
|
|
957
1111
|
return t === "new" ? null : /* @__PURE__ */ e(
|
|
958
|
-
|
|
1112
|
+
bn,
|
|
959
1113
|
{
|
|
960
|
-
collection:
|
|
1114
|
+
collection: n,
|
|
961
1115
|
item: t,
|
|
962
|
-
defaultExpanded:
|
|
963
|
-
title:
|
|
964
|
-
showApprovalChain:
|
|
965
|
-
hideActionsCollapsed:
|
|
1116
|
+
defaultExpanded: l,
|
|
1117
|
+
title: a,
|
|
1118
|
+
showApprovalChain: x,
|
|
1119
|
+
hideActionsCollapsed: m,
|
|
966
1120
|
hideActionsExpanded: f,
|
|
967
|
-
onBeforeTransition:
|
|
968
|
-
addendumPending:
|
|
969
|
-
addendumView:
|
|
1121
|
+
onBeforeTransition: y,
|
|
1122
|
+
addendumPending: C,
|
|
1123
|
+
addendumView: P,
|
|
970
1124
|
asRole: h
|
|
971
1125
|
},
|
|
972
|
-
`${
|
|
1126
|
+
`${n}:${t}`
|
|
973
1127
|
);
|
|
974
1128
|
}
|
|
975
|
-
function
|
|
976
|
-
const
|
|
977
|
-
queryKey: ["approval-brief",
|
|
978
|
-
queryFn: () =>
|
|
1129
|
+
function Pt({ collection: n, item: t }) {
|
|
1130
|
+
const l = he(), { data: a } = ne({
|
|
1131
|
+
queryKey: ["approval-brief", n, String(t)],
|
|
1132
|
+
queryFn: () => l.request(ie(`/pipelines/instance/${n}/${t}/approval-brief`)).then((m) => m.data),
|
|
979
1133
|
staleTime: 3e4,
|
|
980
1134
|
retry: !1
|
|
981
1135
|
});
|
|
982
|
-
if (!
|
|
983
|
-
const
|
|
984
|
-
if (
|
|
985
|
-
const f = String(
|
|
1136
|
+
if (!a) return null;
|
|
1137
|
+
const x = (m) => {
|
|
1138
|
+
if (m == null || m === "") return "—";
|
|
1139
|
+
const f = String(m);
|
|
986
1140
|
return f.length > 36 ? `${f.slice(0, 36)}…` : f;
|
|
987
1141
|
};
|
|
988
|
-
return /* @__PURE__ */
|
|
989
|
-
/* @__PURE__ */
|
|
1142
|
+
return /* @__PURE__ */ r("div", { className: "rounded-md border border-slate-200 bg-white px-3 py-2 text-[11.5px] dark:border-border dark:bg-card", children: [
|
|
1143
|
+
/* @__PURE__ */ r("p", { className: "text-slate-500 dark:text-muted-foreground", children: [
|
|
990
1144
|
/* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children: "Since entering this state" }),
|
|
991
1145
|
" ",
|
|
992
1146
|
"(",
|
|
993
|
-
|
|
1147
|
+
a.days_in_state,
|
|
994
1148
|
"d ago):",
|
|
995
1149
|
" ",
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1150
|
+
a.changed_total === 0 && a.comments === 0 && a.addendums.count === 0 ? /* @__PURE__ */ e("span", { children: "no changes to this record." }) : /* @__PURE__ */ r(ce, { children: [
|
|
1151
|
+
a.changed_total > 0 && /* @__PURE__ */ r("span", { children: [
|
|
1152
|
+
a.changed_total,
|
|
999
1153
|
" field",
|
|
1000
|
-
|
|
1154
|
+
a.changed_total === 1 ? "" : "s",
|
|
1001
1155
|
" changed",
|
|
1002
|
-
|
|
1156
|
+
a.edited_by.length > 0 ? ` by ${a.edited_by.join(", ")}` : ""
|
|
1003
1157
|
] }),
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1158
|
+
a.comments > 0 && /* @__PURE__ */ r("span", { children: [
|
|
1159
|
+
a.changed_total > 0 ? " · " : "",
|
|
1160
|
+
a.comments,
|
|
1007
1161
|
" comment",
|
|
1008
|
-
|
|
1162
|
+
a.comments === 1 ? "" : "s"
|
|
1009
1163
|
] }),
|
|
1010
|
-
|
|
1164
|
+
a.addendums.count > 0 && /* @__PURE__ */ r("span", { children: [
|
|
1011
1165
|
" · ",
|
|
1012
|
-
|
|
1166
|
+
a.addendums.count,
|
|
1013
1167
|
" addendum",
|
|
1014
|
-
|
|
1015
|
-
|
|
1168
|
+
a.addendums.count === 1 ? "" : "s",
|
|
1169
|
+
a.addendums.cost_impact !== 0 ? ` (${a.addendums.cost_impact > 0 ? "+" : ""}$${Math.abs(a.addendums.cost_impact).toLocaleString()})` : ""
|
|
1016
1170
|
] })
|
|
1017
1171
|
] })
|
|
1018
1172
|
] }),
|
|
1019
|
-
|
|
1020
|
-
|
|
1173
|
+
a.field_changes.length > 0 && /* @__PURE__ */ r("div", { className: "mt-1 space-y-0.5", children: [
|
|
1174
|
+
a.field_changes.slice(0, 5).map((m) => /* @__PURE__ */ r(
|
|
1021
1175
|
"p",
|
|
1022
1176
|
{
|
|
1023
1177
|
className: "font-mono text-[10.5px] text-slate-500 dark:text-muted-foreground",
|
|
1024
1178
|
children: [
|
|
1025
|
-
|
|
1179
|
+
m.field,
|
|
1026
1180
|
":",
|
|
1027
1181
|
" ",
|
|
1028
|
-
|
|
1029
|
-
/* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children:
|
|
1182
|
+
m.old !== void 0 && /* @__PURE__ */ r(ce, { children: [
|
|
1183
|
+
/* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children: x(m.old) }),
|
|
1030
1184
|
" "
|
|
1031
1185
|
] }),
|
|
1032
|
-
/* @__PURE__ */ e("span", { className: "text-emerald-600 dark:text-emerald-400", children:
|
|
1186
|
+
/* @__PURE__ */ e("span", { className: "text-emerald-600 dark:text-emerald-400", children: x(m.new) })
|
|
1033
1187
|
]
|
|
1034
1188
|
},
|
|
1035
|
-
|
|
1189
|
+
m.field
|
|
1036
1190
|
)),
|
|
1037
|
-
|
|
1191
|
+
a.field_changes.length > 5 && /* @__PURE__ */ r("p", { className: "text-[10.5px] text-slate-400", children: [
|
|
1038
1192
|
"+",
|
|
1039
|
-
|
|
1193
|
+
a.field_changes.length - 5,
|
|
1040
1194
|
" more — see History for the full trail"
|
|
1041
1195
|
] })
|
|
1042
1196
|
] }),
|
|
1043
|
-
(
|
|
1197
|
+
(a.lines ?? []).map((m) => /* @__PURE__ */ r(
|
|
1044
1198
|
"p",
|
|
1045
1199
|
{
|
|
1046
|
-
"data-brief-line":
|
|
1200
|
+
"data-brief-line": m.label,
|
|
1047
1201
|
className: "mt-1 text-slate-500 dark:text-muted-foreground",
|
|
1048
1202
|
children: [
|
|
1049
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children:
|
|
1203
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children: m.label }),
|
|
1050
1204
|
" ",
|
|
1051
1205
|
/* @__PURE__ */ e(
|
|
1052
1206
|
"span",
|
|
1053
1207
|
{
|
|
1054
|
-
className:
|
|
1055
|
-
children:
|
|
1208
|
+
className: m.tone === "danger" ? "text-red-700 dark:text-red-300" : m.tone === "warn" ? "text-amber-700 dark:text-amber-300" : "",
|
|
1209
|
+
children: m.text
|
|
1056
1210
|
}
|
|
1057
1211
|
)
|
|
1058
1212
|
]
|
|
1059
1213
|
},
|
|
1060
|
-
`${
|
|
1214
|
+
`${m.label}:${m.text}`
|
|
1061
1215
|
))
|
|
1062
1216
|
] });
|
|
1063
1217
|
}
|
|
1064
|
-
function
|
|
1065
|
-
collection:
|
|
1218
|
+
function bn({
|
|
1219
|
+
collection: n,
|
|
1066
1220
|
item: t,
|
|
1067
|
-
defaultExpanded:
|
|
1068
|
-
title:
|
|
1069
|
-
showApprovalChain:
|
|
1070
|
-
hideActionsCollapsed:
|
|
1221
|
+
defaultExpanded: l,
|
|
1222
|
+
title: a,
|
|
1223
|
+
showApprovalChain: x,
|
|
1224
|
+
hideActionsCollapsed: m,
|
|
1071
1225
|
hideActionsExpanded: f,
|
|
1072
|
-
onBeforeTransition:
|
|
1073
|
-
addendumPending:
|
|
1074
|
-
addendumView:
|
|
1226
|
+
onBeforeTransition: y,
|
|
1227
|
+
addendumPending: C,
|
|
1228
|
+
addendumView: P,
|
|
1075
1229
|
asRole: h
|
|
1076
1230
|
}) {
|
|
1077
|
-
var
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1080
|
-
const
|
|
1081
|
-
|
|
1082
|
-
!
|
|
1083
|
-
}, [
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1086
|
-
onSettled: () => {
|
|
1087
|
-
|
|
1231
|
+
var et, tt, nt;
|
|
1232
|
+
const b = he(), S = ke(), [L, M] = U(""), [D, O] = U(null), [E, k] = U(!1), [A, d] = U(!1), [N, s] = U(null), [g, $] = U(null);
|
|
1233
|
+
yt(n, t, "transition", !!D || !!N);
|
|
1234
|
+
const K = Ut(n, t, "transition"), V = te(!1);
|
|
1235
|
+
oe(() => {
|
|
1236
|
+
!V.current && l !== void 0 && (V.current = !0, d(l));
|
|
1237
|
+
}, [l]);
|
|
1238
|
+
const u = te(!1), v = (c) => {
|
|
1239
|
+
u.current || (u.current = !0, $(null), i.mutate(c, {
|
|
1240
|
+
onSettled: (R, j) => {
|
|
1241
|
+
if (j) {
|
|
1242
|
+
u.current = !1;
|
|
1243
|
+
return;
|
|
1244
|
+
}
|
|
1245
|
+
ae().finally(() => {
|
|
1246
|
+
u.current = !1;
|
|
1247
|
+
});
|
|
1088
1248
|
}
|
|
1089
1249
|
}));
|
|
1090
|
-
},
|
|
1091
|
-
if (
|
|
1092
|
-
if (
|
|
1093
|
-
|
|
1250
|
+
}, B = async (c) => {
|
|
1251
|
+
if (u.current) return;
|
|
1252
|
+
if (D === c) {
|
|
1253
|
+
O(null);
|
|
1094
1254
|
return;
|
|
1095
1255
|
}
|
|
1096
|
-
if (
|
|
1097
|
-
|
|
1098
|
-
let
|
|
1256
|
+
if (y) {
|
|
1257
|
+
u.current = !0;
|
|
1258
|
+
let Q = !1;
|
|
1099
1259
|
try {
|
|
1100
|
-
|
|
1260
|
+
Q = await y();
|
|
1101
1261
|
} finally {
|
|
1102
|
-
|
|
1262
|
+
u.current = !1;
|
|
1103
1263
|
}
|
|
1104
|
-
if (!
|
|
1264
|
+
if (!Q) return;
|
|
1105
1265
|
}
|
|
1106
|
-
const
|
|
1107
|
-
if (
|
|
1108
|
-
|
|
1266
|
+
const R = (Z ?? []).find((Q) => Q.id === c), j = String((R == null ? void 0 : R.comment_mode) ?? "none");
|
|
1267
|
+
if (j !== "optional" && j !== "required") {
|
|
1268
|
+
v({ transition_id: c });
|
|
1109
1269
|
return;
|
|
1110
1270
|
}
|
|
1111
|
-
|
|
1112
|
-
},
|
|
1113
|
-
queryKey:
|
|
1114
|
-
queryFn: () =>
|
|
1271
|
+
O(c);
|
|
1272
|
+
}, z = h ? ["pipeline-instance", n, t, h] : ["pipeline-instance", n, t], { settling: X, settle: ae } = Tt(z), { data: o, isLoading: p } = ne({
|
|
1273
|
+
queryKey: z,
|
|
1274
|
+
queryFn: () => b.request(
|
|
1115
1275
|
ie(
|
|
1116
|
-
`/pipelines/instance/${
|
|
1276
|
+
`/pipelines/instance/${n}/${t}${h ? `?as_role=${encodeURIComponent(h)}` : ""}`
|
|
1117
1277
|
)
|
|
1118
1278
|
).then(
|
|
1119
|
-
(
|
|
1279
|
+
(c) => c.data ?? {
|
|
1120
1280
|
instance: null,
|
|
1121
1281
|
states: [],
|
|
1122
1282
|
available_transitions: [],
|
|
@@ -1127,419 +1287,431 @@ function Zt({
|
|
|
1127
1287
|
),
|
|
1128
1288
|
staleTime: 1e4
|
|
1129
1289
|
});
|
|
1130
|
-
|
|
1131
|
-
() =>
|
|
1132
|
-
if (
|
|
1133
|
-
const
|
|
1134
|
-
Array.isArray(
|
|
1290
|
+
oe(
|
|
1291
|
+
() => S.getQueryCache().subscribe((c) => {
|
|
1292
|
+
if (c.type !== "updated" || c.action.type !== "success") return;
|
|
1293
|
+
const R = c.query.queryKey;
|
|
1294
|
+
Array.isArray(R) && R[0] === "item" && R[1] === n && String(R[2]) === t && S.invalidateQueries({ queryKey: ["pipeline-instance", n, t] });
|
|
1135
1295
|
}),
|
|
1136
|
-
[
|
|
1296
|
+
[S, n, t]
|
|
1137
1297
|
);
|
|
1138
|
-
const { data:
|
|
1139
|
-
queryKey: ["pipeline-all-owners",
|
|
1140
|
-
queryFn: () =>
|
|
1141
|
-
ie(`/pipelines/instance/${
|
|
1142
|
-
).then((
|
|
1143
|
-
enabled:
|
|
1298
|
+
const { data: w, isLoading: T } = ne({
|
|
1299
|
+
queryKey: ["pipeline-all-owners", n, t],
|
|
1300
|
+
queryFn: () => b.request(
|
|
1301
|
+
ie(`/pipelines/instance/${n}/${t}/owners/all`)
|
|
1302
|
+
).then((c) => c.data ?? null),
|
|
1303
|
+
enabled: A && !!(o != null && o.instance),
|
|
1144
1304
|
staleTime: 3e4
|
|
1145
|
-
}),
|
|
1146
|
-
if (!
|
|
1147
|
-
const
|
|
1148
|
-
return
|
|
1149
|
-
}, [
|
|
1150
|
-
if (!
|
|
1151
|
-
const
|
|
1152
|
-
for (const [
|
|
1153
|
-
|
|
1154
|
-
return
|
|
1155
|
-
}, [
|
|
1156
|
-
mutationFn: () =>
|
|
1305
|
+
}), F = ot(() => {
|
|
1306
|
+
if (!w) return null;
|
|
1307
|
+
const c = Object.entries(w);
|
|
1308
|
+
return c.length === 0 || c.every(([, R]) => R.on_path === void 0) ? null : new Set(c.filter(([, R]) => R.on_path !== !1).map(([R]) => R));
|
|
1309
|
+
}, [w]), I = ot(() => {
|
|
1310
|
+
if (!w) return null;
|
|
1311
|
+
const c = /* @__PURE__ */ new Map();
|
|
1312
|
+
for (const [R, j] of Object.entries(w))
|
|
1313
|
+
j.skipped && c.set(R, j.skip_reasons ?? []);
|
|
1314
|
+
return c;
|
|
1315
|
+
}, [w]), W = ye({
|
|
1316
|
+
mutationFn: () => b.request(fe(`/pipelines/instance/${n}/${t}/start`, {})),
|
|
1157
1317
|
onSuccess: () => {
|
|
1158
|
-
|
|
1318
|
+
S.invalidateQueries({ queryKey: z }), ee.success("Pipeline started");
|
|
1159
1319
|
},
|
|
1160
1320
|
onError: () => ee.error("Failed to start pipeline")
|
|
1161
|
-
}),
|
|
1321
|
+
}), i = ye({
|
|
1162
1322
|
mutationFn: ({
|
|
1163
|
-
transition_id:
|
|
1164
|
-
comment:
|
|
1165
|
-
reviewed:
|
|
1166
|
-
}) =>
|
|
1167
|
-
|
|
1168
|
-
transition_id:
|
|
1169
|
-
comment:
|
|
1170
|
-
...
|
|
1323
|
+
transition_id: c,
|
|
1324
|
+
comment: R,
|
|
1325
|
+
reviewed: j
|
|
1326
|
+
}) => b.request(
|
|
1327
|
+
fe(`/pipelines/instance/${n}/${t}/transition`, {
|
|
1328
|
+
transition_id: c,
|
|
1329
|
+
comment: R,
|
|
1330
|
+
...j ? { reviewed: !0 } : {}
|
|
1171
1331
|
})
|
|
1172
1332
|
),
|
|
1173
1333
|
onSuccess: () => {
|
|
1174
|
-
|
|
1334
|
+
S.invalidateQueries({ queryKey: z }), n === "nivaro_addendums" && S.invalidateQueries({ queryKey: ["addendums"] }), qe(S, n, String(t)), Ne(S, n, String(t)), qt(S, n, String(t)), $(null), M(""), O(null), s(null), ee.success("Transition executed");
|
|
1175
1335
|
},
|
|
1176
|
-
onError: (
|
|
1177
|
-
if (
|
|
1178
|
-
|
|
1336
|
+
onError: (c, R) => {
|
|
1337
|
+
if (Ct(c)) {
|
|
1338
|
+
S.invalidateQueries({ queryKey: z });
|
|
1179
1339
|
return;
|
|
1180
1340
|
}
|
|
1181
|
-
const
|
|
1182
|
-
if (
|
|
1341
|
+
const j = St(c);
|
|
1342
|
+
if (j) {
|
|
1183
1343
|
s((G) => ({
|
|
1184
|
-
payload:
|
|
1185
|
-
transitionId:
|
|
1186
|
-
comment:
|
|
1344
|
+
payload: j,
|
|
1345
|
+
transitionId: R.transition_id,
|
|
1346
|
+
comment: R.comment,
|
|
1187
1347
|
revision: ((G == null ? void 0 : G.revision) ?? 0) + 1
|
|
1188
1348
|
}));
|
|
1189
1349
|
return;
|
|
1190
1350
|
}
|
|
1191
|
-
const
|
|
1192
|
-
ee.error(
|
|
1351
|
+
const Q = c == null ? void 0 : c.response;
|
|
1352
|
+
$($t(c, R)), ee.error(ve(c, "Failed to execute transition"), {
|
|
1193
1353
|
duration: 12e3,
|
|
1194
1354
|
// What to do next + Copy details (lib/error-toast.ts); "Why?" below wins the action slot.
|
|
1195
|
-
...
|
|
1355
|
+
...gt(c, { action: "Transition" }),
|
|
1196
1356
|
// #1867: a refusal carries "Why?" — the role, owner or access rule
|
|
1197
1357
|
// that stopped it, and who can change it.
|
|
1198
|
-
...
|
|
1199
|
-
action:
|
|
1200
|
-
collection:
|
|
1358
|
+
...Nt(c) ? {
|
|
1359
|
+
action: kt(b, {
|
|
1360
|
+
collection: n,
|
|
1201
1361
|
itemId: String(t),
|
|
1202
1362
|
action: "transition",
|
|
1203
|
-
transitionId:
|
|
1363
|
+
transitionId: R.transition_id
|
|
1204
1364
|
})
|
|
1205
1365
|
} : {}
|
|
1206
|
-
}), s(null),
|
|
1366
|
+
}), s(null), O(null), qe(S, n, String(t)), Ne(S, n, String(t)), (Q == null ? void 0 : Q.status) === 409 && S.invalidateQueries({ queryKey: z });
|
|
1207
1367
|
}
|
|
1208
|
-
}),
|
|
1209
|
-
|
|
1210
|
-
const
|
|
1211
|
-
if (
|
|
1212
|
-
const
|
|
1213
|
-
const
|
|
1214
|
-
if (!
|
|
1215
|
-
|
|
1216
|
-
const
|
|
1368
|
+
}), _ = te(B);
|
|
1369
|
+
_.current = B;
|
|
1370
|
+
const H = te((o == null ? void 0 : o.available_transitions) ?? []);
|
|
1371
|
+
if (H.current = (o == null ? void 0 : o.available_transitions) ?? [], oe(() => {
|
|
1372
|
+
const c = (R) => {
|
|
1373
|
+
const j = R.detail;
|
|
1374
|
+
if (!j || j.claimed || j.collection !== n || String(j.item) !== String(t)) return;
|
|
1375
|
+
j.claimed = !0;
|
|
1376
|
+
const Q = String(j.transition_id).toUpperCase(), G = H.current.find((ue) => String(ue.id).toUpperCase() === Q);
|
|
1217
1377
|
if (!G) {
|
|
1218
1378
|
ee.error("That step is not available from where the record is now");
|
|
1219
1379
|
return;
|
|
1220
1380
|
}
|
|
1221
|
-
|
|
1381
|
+
_.current(G.id);
|
|
1222
1382
|
};
|
|
1223
|
-
return window.addEventListener(
|
|
1224
|
-
}, [
|
|
1225
|
-
return /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */
|
|
1383
|
+
return window.addEventListener(Te, c), () => window.removeEventListener(Te, c);
|
|
1384
|
+
}, [n, t]), p)
|
|
1385
|
+
return /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ r("div", { className: "flex w-full items-center gap-2.5 px-5 py-3.5", children: [
|
|
1226
1386
|
/* @__PURE__ */ e(le, { className: "h-3.5 w-3.5 shrink-0 rounded" }),
|
|
1227
1387
|
/* @__PURE__ */ e(le, { className: "h-4 w-20" }),
|
|
1228
1388
|
/* @__PURE__ */ e(le, { className: "h-[22px] w-40 rounded-full" }),
|
|
1229
1389
|
/* @__PURE__ */ e(le, { className: "ml-auto h-3.5 w-3.5 rounded" })
|
|
1230
1390
|
] }) });
|
|
1231
|
-
if (!(
|
|
1232
|
-
const { instance:
|
|
1233
|
-
(
|
|
1234
|
-
) : null,
|
|
1235
|
-
const
|
|
1236
|
-
for (const
|
|
1237
|
-
const G =
|
|
1238
|
-
G.push(
|
|
1391
|
+
if (!(o != null && o.binding)) return null;
|
|
1392
|
+
const { instance: q, available_transitions: Z, history: me, states: be } = o, _e = new Map((be ?? []).map((c) => [c.id, c])), xe = (q == null ? void 0 : q.current_state_obj) ?? null, se = D ? (Z ?? []).find((c) => c.id === D) : null, Pe = se ? _e.get(se.to_state) : null, At = q != null && q.completed_at && Z ? Z.filter(
|
|
1393
|
+
(c) => c.from_state && String(c.from_state).toUpperCase() === String(q.current_state).toUpperCase()
|
|
1394
|
+
) : null, Ae = q != null && q.completed_at ? At ?? [] : Z ?? [], Ge = Ae.length > 0, Ye = (c, R = !1) => {
|
|
1395
|
+
const j = /* @__PURE__ */ new Map();
|
|
1396
|
+
for (const Q of c) {
|
|
1397
|
+
const G = j.get(Q.label) ?? [];
|
|
1398
|
+
G.push(Q), j.set(Q.label, G);
|
|
1239
1399
|
}
|
|
1240
|
-
return Array.from(
|
|
1241
|
-
var
|
|
1242
|
-
const
|
|
1400
|
+
return Array.from(j.entries()).map(([Q, G]) => {
|
|
1401
|
+
var at, st;
|
|
1402
|
+
const ue = ((at = G[0]) == null ? void 0 : at.color) ?? null, Ce = G.some((Y) => Y.id === D), rt = (Y) => ue ? Y ? { backgroundColor: ue, borderColor: ue } : { borderColor: ue, color: ue } : void 0;
|
|
1243
1403
|
if (G.length === 1) {
|
|
1244
|
-
const
|
|
1245
|
-
return /* @__PURE__ */
|
|
1246
|
-
|
|
1404
|
+
const Y = G[0], ge = i.isPending && ((st = i.variables) == null ? void 0 : st.transition_id) === Y.id;
|
|
1405
|
+
return /* @__PURE__ */ r(
|
|
1406
|
+
J,
|
|
1247
1407
|
{
|
|
1248
1408
|
size: "sm",
|
|
1249
|
-
variant:
|
|
1250
|
-
className: `${
|
|
1251
|
-
style:
|
|
1252
|
-
disabled:
|
|
1253
|
-
onClick: () =>
|
|
1409
|
+
variant: Ce ? "default" : "outline",
|
|
1410
|
+
className: `${R ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5`,
|
|
1411
|
+
style: rt(Ce),
|
|
1412
|
+
disabled: i.isPending || X,
|
|
1413
|
+
onClick: () => B(Y.id),
|
|
1254
1414
|
children: [
|
|
1255
|
-
|
|
1256
|
-
|
|
1415
|
+
ge && /* @__PURE__ */ e(re, { className: "h-3 w-3 animate-spin" }),
|
|
1416
|
+
Q
|
|
1257
1417
|
]
|
|
1258
1418
|
},
|
|
1259
|
-
|
|
1419
|
+
Q
|
|
1260
1420
|
);
|
|
1261
1421
|
}
|
|
1262
|
-
return /* @__PURE__ */
|
|
1263
|
-
/* @__PURE__ */ e(
|
|
1264
|
-
|
|
1422
|
+
return /* @__PURE__ */ r(Be, { children: [
|
|
1423
|
+
/* @__PURE__ */ e(Ie, { asChild: !0, children: /* @__PURE__ */ r(
|
|
1424
|
+
J,
|
|
1265
1425
|
{
|
|
1266
1426
|
size: "sm",
|
|
1267
|
-
variant:
|
|
1268
|
-
className: `${
|
|
1269
|
-
style:
|
|
1270
|
-
disabled:
|
|
1427
|
+
variant: Ce ? "default" : "outline",
|
|
1428
|
+
className: `${R ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5`,
|
|
1429
|
+
style: rt(Ce),
|
|
1430
|
+
disabled: i.isPending || X,
|
|
1271
1431
|
children: [
|
|
1272
|
-
|
|
1273
|
-
/* @__PURE__ */ e(
|
|
1432
|
+
Q,
|
|
1433
|
+
/* @__PURE__ */ e(pe, { className: "h-3 w-3" })
|
|
1274
1434
|
]
|
|
1275
1435
|
}
|
|
1276
1436
|
) }),
|
|
1277
|
-
/* @__PURE__ */ e(
|
|
1278
|
-
(
|
|
1279
|
-
var
|
|
1280
|
-
return (((
|
|
1437
|
+
/* @__PURE__ */ e(Le, { align: "start", children: [...G].sort(
|
|
1438
|
+
(Y, ge) => {
|
|
1439
|
+
var it, lt;
|
|
1440
|
+
return (((it = _e.get(Y.to_state)) == null ? void 0 : it.sort) ?? 999) - (((lt = _e.get(ge.to_state)) == null ? void 0 : lt.sort) ?? 999);
|
|
1281
1441
|
}
|
|
1282
|
-
).map((
|
|
1283
|
-
var
|
|
1284
|
-
return /* @__PURE__ */
|
|
1285
|
-
|
|
1442
|
+
).map((Y) => {
|
|
1443
|
+
var ge;
|
|
1444
|
+
return /* @__PURE__ */ r(Se, { onSelect: () => B(Y.id), children: [
|
|
1445
|
+
Y.color && /* @__PURE__ */ e(
|
|
1286
1446
|
"span",
|
|
1287
1447
|
{
|
|
1288
1448
|
className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
|
|
1289
|
-
style: { backgroundColor:
|
|
1449
|
+
style: { backgroundColor: Y.color }
|
|
1290
1450
|
}
|
|
1291
1451
|
),
|
|
1292
|
-
((
|
|
1293
|
-
] },
|
|
1452
|
+
((ge = _e.get(Y.to_state)) == null ? void 0 : ge.label) ?? Y.to_state
|
|
1453
|
+
] }, Y.id);
|
|
1294
1454
|
}) })
|
|
1295
|
-
] },
|
|
1455
|
+
] }, Q);
|
|
1296
1456
|
});
|
|
1297
|
-
},
|
|
1298
|
-
|
|
1457
|
+
}, De = g ? /* @__PURE__ */ e(
|
|
1458
|
+
Rt,
|
|
1459
|
+
{
|
|
1460
|
+
collection: n,
|
|
1461
|
+
item: String(t),
|
|
1462
|
+
offer: g,
|
|
1463
|
+
onDismiss: () => $(null),
|
|
1464
|
+
onFixed: () => v({ transition_id: g.transitionId, comment: g.comment })
|
|
1465
|
+
}
|
|
1466
|
+
) : null, Je = on(me ?? [], q == null ? void 0 : q.current_state, be ?? []), Ze = /* @__PURE__ */ r("div", { className: "space-y-3 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3.5", children: [
|
|
1467
|
+
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1299
1468
|
/* @__PURE__ */ e("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
/* @__PURE__ */ e(
|
|
1303
|
-
/* @__PURE__ */ e(
|
|
1304
|
-
/* @__PURE__ */ e(
|
|
1469
|
+
se && /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700", children: se.label }),
|
|
1470
|
+
xe && Pe && /* @__PURE__ */ r("div", { className: "ml-auto flex items-center gap-1.5", children: [
|
|
1471
|
+
/* @__PURE__ */ e(de, { label: xe.label, color: xe.color, small: !0 }),
|
|
1472
|
+
/* @__PURE__ */ e(Qe, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
1473
|
+
/* @__PURE__ */ e(de, { label: Pe.label, color: Pe.color, small: !0 })
|
|
1305
1474
|
] })
|
|
1306
1475
|
] }),
|
|
1307
|
-
/* @__PURE__ */ e(
|
|
1476
|
+
/* @__PURE__ */ e(Pt, { collection: n, item: t }),
|
|
1308
1477
|
/* @__PURE__ */ e(
|
|
1309
1478
|
"input",
|
|
1310
1479
|
{
|
|
1311
1480
|
type: "text",
|
|
1312
|
-
value:
|
|
1313
|
-
onChange: (
|
|
1314
|
-
placeholder: String((
|
|
1481
|
+
value: L,
|
|
1482
|
+
onChange: (c) => M(c.target.value),
|
|
1483
|
+
placeholder: String((se == null ? void 0 : se.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
|
|
1315
1484
|
className: "w-full rounded-md border border-slate-200 bg-white px-3 py-1.5 text-[13px] placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-nvr-cyan/30"
|
|
1316
1485
|
}
|
|
1317
1486
|
),
|
|
1318
|
-
/* @__PURE__ */
|
|
1487
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-end gap-2", children: [
|
|
1319
1488
|
/* @__PURE__ */ e(
|
|
1320
|
-
|
|
1489
|
+
J,
|
|
1321
1490
|
{
|
|
1322
1491
|
type: "button",
|
|
1323
1492
|
size: "sm",
|
|
1324
1493
|
variant: "ghost",
|
|
1325
1494
|
className: "h-7 text-[12px]",
|
|
1326
|
-
onClick: () =>
|
|
1495
|
+
onClick: () => O(null),
|
|
1327
1496
|
children: "Cancel"
|
|
1328
1497
|
}
|
|
1329
1498
|
),
|
|
1330
1499
|
/* @__PURE__ */ e(
|
|
1331
|
-
|
|
1500
|
+
J,
|
|
1332
1501
|
{
|
|
1333
1502
|
type: "button",
|
|
1334
1503
|
size: "sm",
|
|
1335
1504
|
className: "h-7 gap-1.5 text-[12px]",
|
|
1336
|
-
disabled:
|
|
1337
|
-
onClick: () =>
|
|
1338
|
-
transition_id:
|
|
1339
|
-
comment:
|
|
1505
|
+
disabled: i.isPending || String((se == null ? void 0 : se.comment_mode) ?? "") === "required" && L.trim() === "",
|
|
1506
|
+
onClick: () => v({
|
|
1507
|
+
transition_id: D,
|
|
1508
|
+
comment: L.trim() || void 0
|
|
1340
1509
|
}),
|
|
1341
|
-
children:
|
|
1510
|
+
children: i.isPending ? /* @__PURE__ */ e(re, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ r(ce, { children: [
|
|
1342
1511
|
/* @__PURE__ */ e("span", { children: "Confirm" }),
|
|
1343
|
-
/* @__PURE__ */ e(
|
|
1512
|
+
/* @__PURE__ */ e(Re, { className: "h-3 w-3" })
|
|
1344
1513
|
] })
|
|
1345
1514
|
}
|
|
1346
1515
|
)
|
|
1347
1516
|
] })
|
|
1348
1517
|
] });
|
|
1349
|
-
return /* @__PURE__ */
|
|
1350
|
-
/* @__PURE__ */
|
|
1518
|
+
return /* @__PURE__ */ r(ce, { children: [
|
|
1519
|
+
/* @__PURE__ */ r(
|
|
1351
1520
|
"div",
|
|
1352
1521
|
{
|
|
1353
|
-
className: `overflow-hidden rounded-xl border bg-white dark:bg-card ${
|
|
1522
|
+
className: `overflow-hidden rounded-xl border bg-white dark:bg-card ${P ? "border-amber-300 dark:border-amber-600/50" : "border-slate-200 dark:border-border"}`,
|
|
1354
1523
|
children: [
|
|
1355
|
-
/* @__PURE__ */
|
|
1524
|
+
/* @__PURE__ */ r(
|
|
1356
1525
|
"div",
|
|
1357
1526
|
{
|
|
1358
1527
|
role: "button",
|
|
1359
1528
|
tabIndex: 0,
|
|
1360
|
-
onClick: () =>
|
|
1361
|
-
onKeyDown: (
|
|
1529
|
+
onClick: () => d((c) => !c),
|
|
1530
|
+
onKeyDown: (c) => (c.key === "Enter" || c.key === " ") && d((R) => !R),
|
|
1362
1531
|
className: "flex w-full cursor-pointer items-center gap-2.5 px-5 py-3.5 transition-colors hover:bg-slate-50/50 dark:hover:bg-white/[0.02]",
|
|
1363
1532
|
children: [
|
|
1364
|
-
/* @__PURE__ */ e(
|
|
1365
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children:
|
|
1366
|
-
/* @__PURE__ */
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
(((
|
|
1533
|
+
/* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
1534
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: a || "Pipeline" }),
|
|
1535
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
|
|
1536
|
+
P && /* @__PURE__ */ e("span", { className: "flex items-center gap-1 rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-400", children: "Addendum workflow" }),
|
|
1537
|
+
xe && /* @__PURE__ */ e(de, { label: xe.label, color: xe.color }),
|
|
1538
|
+
(((et = o == null ? void 0 : o.auto_held) == null ? void 0 : et.length) ?? 0) > 0 && /* @__PURE__ */ r(
|
|
1370
1539
|
"span",
|
|
1371
1540
|
{
|
|
1372
1541
|
className: "flex items-center gap-1 rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-400",
|
|
1373
|
-
"data-tip": ((
|
|
1542
|
+
"data-tip": ((o == null ? void 0 : o.auto_held) ?? []).map((c) => `${c.transition_label ?? "Automatic move"}: ${c.error ?? "refused"}`).join(`
|
|
1374
1543
|
`),
|
|
1375
1544
|
"data-pipeline-auto-held-pill": !0,
|
|
1376
1545
|
children: [
|
|
1377
|
-
/* @__PURE__ */ e(
|
|
1546
|
+
/* @__PURE__ */ e(Dt, { className: "h-3 w-3 shrink-0" }),
|
|
1378
1547
|
"Needs a person"
|
|
1379
1548
|
]
|
|
1380
1549
|
}
|
|
1381
1550
|
),
|
|
1382
|
-
|
|
1551
|
+
C && /* @__PURE__ */ r("span", { className: "flex items-center gap-1 rounded-full bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-400 dark:border-amber-500/20", children: [
|
|
1383
1552
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 animate-pulse shrink-0" }),
|
|
1384
1553
|
"Addendum in review"
|
|
1385
1554
|
] }),
|
|
1386
|
-
|
|
1555
|
+
K.length > 0 && /* @__PURE__ */ r(
|
|
1387
1556
|
"span",
|
|
1388
1557
|
{
|
|
1389
1558
|
className: "flex items-center gap-1 rounded-full border border-sky-200 bg-sky-50 px-2 py-0.5 text-[11px] font-medium text-sky-700 dark:border-sky-500/20 dark:bg-sky-500/10 dark:text-sky-300",
|
|
1390
1559
|
"data-pipeline-approving": !0,
|
|
1391
1560
|
children: [
|
|
1392
1561
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-sky-400" }),
|
|
1393
|
-
|
|
1562
|
+
Kt(K, "approving")
|
|
1394
1563
|
]
|
|
1395
1564
|
}
|
|
1396
1565
|
)
|
|
1397
1566
|
] }),
|
|
1398
|
-
/* @__PURE__ */
|
|
1399
|
-
!
|
|
1400
|
-
!
|
|
1401
|
-
|
|
1567
|
+
/* @__PURE__ */ r("div", { className: "ml-auto flex items-center gap-2", onClick: (c) => c.stopPropagation(), children: [
|
|
1568
|
+
!A && Ge && !m && /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-1.5", children: Ye(Ae, !0) }),
|
|
1569
|
+
!A && !q && (o == null ? void 0 : o.binding) && /* @__PURE__ */ r(
|
|
1570
|
+
J,
|
|
1402
1571
|
{
|
|
1403
1572
|
size: "sm",
|
|
1404
1573
|
variant: "outline",
|
|
1405
1574
|
className: "h-7 gap-1.5 text-[11px]",
|
|
1406
|
-
onClick: (
|
|
1407
|
-
|
|
1575
|
+
onClick: (c) => {
|
|
1576
|
+
c.stopPropagation(), W.mutate();
|
|
1408
1577
|
},
|
|
1409
|
-
disabled:
|
|
1578
|
+
disabled: W.isPending,
|
|
1410
1579
|
children: [
|
|
1411
|
-
|
|
1580
|
+
W.isPending ? /* @__PURE__ */ e(re, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(Oe, { className: "h-3 w-3" }),
|
|
1412
1581
|
"Start"
|
|
1413
1582
|
]
|
|
1414
1583
|
}
|
|
1415
1584
|
),
|
|
1416
|
-
|
|
1417
|
-
|
|
1585
|
+
x && ((o == null ? void 0 : o.binding) || (o == null ? void 0 : o.instance)) && /* @__PURE__ */ e(
|
|
1586
|
+
hn,
|
|
1418
1587
|
{
|
|
1419
|
-
collection:
|
|
1588
|
+
collection: n,
|
|
1420
1589
|
item: t,
|
|
1421
|
-
states:
|
|
1422
|
-
currentStateId: ((
|
|
1590
|
+
states: be ?? [],
|
|
1591
|
+
currentStateId: ((tt = o == null ? void 0 : o.instance) == null ? void 0 : tt.current_state) ?? null
|
|
1423
1592
|
}
|
|
1424
1593
|
)
|
|
1425
1594
|
] }),
|
|
1426
1595
|
/* @__PURE__ */ e(
|
|
1427
|
-
|
|
1596
|
+
pe,
|
|
1428
1597
|
{
|
|
1429
|
-
className:
|
|
1598
|
+
className: we(
|
|
1430
1599
|
"h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150",
|
|
1431
|
-
|
|
1600
|
+
A && "rotate-180"
|
|
1432
1601
|
)
|
|
1433
1602
|
}
|
|
1434
1603
|
)
|
|
1435
1604
|
]
|
|
1436
1605
|
}
|
|
1437
1606
|
),
|
|
1438
|
-
!
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1607
|
+
!A && D && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: Ze }),
|
|
1608
|
+
!A && De && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: De }),
|
|
1609
|
+
Je && !(q != null && q.completed_at) && /* @__PURE__ */ e(dn, { entry: Je }),
|
|
1610
|
+
A && /* @__PURE__ */ r("div", { className: "border-t border-slate-100 dark:border-border/60", children: [
|
|
1611
|
+
/* @__PURE__ */ e(rn, { held: (o == null ? void 0 : o.auto_held) ?? [] }),
|
|
1612
|
+
C && /* @__PURE__ */ r("div", { className: "flex items-center gap-2 border-b border-amber-100 bg-amber-50 px-5 py-2.5 dark:border-amber-500/20 dark:bg-amber-500/10", children: [
|
|
1442
1613
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
|
|
1443
1614
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-amber-700 dark:text-amber-400", children: "An addendum is in review — coordinate transitions carefully." })
|
|
1444
1615
|
] }),
|
|
1445
|
-
|
|
1446
|
-
(
|
|
1447
|
-
|
|
1616
|
+
q ? /* @__PURE__ */ r("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: [
|
|
1617
|
+
(be ?? []).length > 1 && /* @__PURE__ */ r("div", { className: "space-y-3 px-5 py-4", children: [
|
|
1618
|
+
T ? (
|
|
1448
1619
|
// Path pruning arrives with the owners query — rendering
|
|
1449
1620
|
// the UNPRUNED track first meant every state briefly
|
|
1450
1621
|
// showed, then snapped into formation. Hold a same-height
|
|
1451
1622
|
// placeholder until the real shape is known.
|
|
1452
|
-
/* @__PURE__ */
|
|
1453
|
-
[0, 1, 2, 3, 4].map((
|
|
1623
|
+
/* @__PURE__ */ r("div", { className: "flex h-[52px] items-center gap-2", children: [
|
|
1624
|
+
[0, 1, 2, 3, 4].map((c) => /* @__PURE__ */ r("span", { className: "flex items-center gap-2", children: [
|
|
1454
1625
|
/* @__PURE__ */ e(le, { className: "h-7 w-7 rounded-full" }),
|
|
1455
|
-
|
|
1456
|
-
] },
|
|
1626
|
+
c < 4 && /* @__PURE__ */ e(le, { className: "h-0.5 w-10" })
|
|
1627
|
+
] }, c)),
|
|
1457
1628
|
/* @__PURE__ */ e(le, { className: "ml-2 h-3 w-24" })
|
|
1458
1629
|
] })
|
|
1459
1630
|
) : /* @__PURE__ */ e(
|
|
1460
|
-
|
|
1631
|
+
mn,
|
|
1461
1632
|
{
|
|
1462
|
-
states:
|
|
1463
|
-
allTransitions: (
|
|
1464
|
-
availableTransitions:
|
|
1465
|
-
currentStateId:
|
|
1466
|
-
history:
|
|
1467
|
-
onPathIds:
|
|
1468
|
-
skippedStates:
|
|
1633
|
+
states: be,
|
|
1634
|
+
allTransitions: (o == null ? void 0 : o.all_transitions) ?? [],
|
|
1635
|
+
availableTransitions: Z ?? [],
|
|
1636
|
+
currentStateId: q.current_state,
|
|
1637
|
+
history: me ?? [],
|
|
1638
|
+
onPathIds: F,
|
|
1639
|
+
skippedStates: I
|
|
1469
1640
|
}
|
|
1470
1641
|
),
|
|
1471
|
-
(
|
|
1642
|
+
(o == null ? void 0 : o.branches) && /* @__PURE__ */ e(Zt, { data: o.branches }),
|
|
1472
1643
|
/* @__PURE__ */ e(
|
|
1473
|
-
|
|
1644
|
+
cn,
|
|
1474
1645
|
{
|
|
1475
|
-
history:
|
|
1476
|
-
completedAt:
|
|
1646
|
+
history: me ?? [],
|
|
1647
|
+
completedAt: q.completed_at
|
|
1477
1648
|
}
|
|
1478
1649
|
)
|
|
1479
1650
|
] }),
|
|
1480
|
-
/* @__PURE__ */
|
|
1481
|
-
!
|
|
1651
|
+
/* @__PURE__ */ r("div", { className: "space-y-3 px-5 py-4", children: [
|
|
1652
|
+
!q.completed_at && /* @__PURE__ */ e(en, { collection: n, itemId: String(t) }),
|
|
1482
1653
|
/* @__PURE__ */ e(
|
|
1483
|
-
|
|
1654
|
+
fn,
|
|
1484
1655
|
{
|
|
1485
|
-
collection:
|
|
1656
|
+
collection: n,
|
|
1486
1657
|
item: t,
|
|
1487
|
-
states:
|
|
1488
|
-
currentStateId: ((
|
|
1489
|
-
returned: ((
|
|
1490
|
-
(
|
|
1491
|
-
var
|
|
1492
|
-
return !!
|
|
1658
|
+
states: be ?? [],
|
|
1659
|
+
currentStateId: ((nt = o == null ? void 0 : o.instance) == null ? void 0 : nt.current_state) ?? null,
|
|
1660
|
+
returned: ((o == null ? void 0 : o.history) ?? []).some(
|
|
1661
|
+
(c) => {
|
|
1662
|
+
var R;
|
|
1663
|
+
return !!c.from_state && c.to_state === ((R = o == null ? void 0 : o.instance) == null ? void 0 : R.current_state);
|
|
1493
1664
|
}
|
|
1494
1665
|
)
|
|
1495
1666
|
}
|
|
1496
1667
|
)
|
|
1497
1668
|
] }),
|
|
1498
|
-
|
|
1499
|
-
/* @__PURE__ */ e("div", { className: "flex flex-wrap justify-end gap-2", children:
|
|
1500
|
-
|
|
1669
|
+
Ge && !f && /* @__PURE__ */ r("div", { className: "space-y-3 px-5 py-4", children: [
|
|
1670
|
+
/* @__PURE__ */ e("div", { className: "flex flex-wrap justify-end gap-2", children: Ye(Ae) }),
|
|
1671
|
+
D && Ze,
|
|
1672
|
+
De
|
|
1501
1673
|
] }),
|
|
1502
|
-
/* @__PURE__ */
|
|
1503
|
-
/* @__PURE__ */
|
|
1674
|
+
/* @__PURE__ */ r("div", { className: "px-5 py-3", children: [
|
|
1675
|
+
/* @__PURE__ */ r(
|
|
1504
1676
|
"button",
|
|
1505
1677
|
{
|
|
1506
1678
|
type: "button",
|
|
1507
1679
|
className: "flex items-center gap-1.5 text-[12px] text-slate-400 transition-colors hover:text-slate-600",
|
|
1508
|
-
onClick: () =>
|
|
1680
|
+
onClick: () => k((c) => !c),
|
|
1509
1681
|
children: [
|
|
1510
1682
|
/* @__PURE__ */ e(
|
|
1511
|
-
|
|
1683
|
+
pe,
|
|
1512
1684
|
{
|
|
1513
|
-
className:
|
|
1685
|
+
className: we(
|
|
1514
1686
|
"h-3.5 w-3.5 transition-transform duration-200",
|
|
1515
|
-
|
|
1687
|
+
E && "rotate-180"
|
|
1516
1688
|
)
|
|
1517
1689
|
}
|
|
1518
1690
|
),
|
|
1519
1691
|
"Transition history",
|
|
1520
1692
|
" ",
|
|
1521
|
-
/* @__PURE__ */
|
|
1693
|
+
/* @__PURE__ */ r("span", { className: "tabular-nums", children: [
|
|
1522
1694
|
"(",
|
|
1523
|
-
(
|
|
1695
|
+
(me == null ? void 0 : me.length) ?? 0,
|
|
1524
1696
|
")"
|
|
1525
1697
|
] })
|
|
1526
1698
|
]
|
|
1527
1699
|
}
|
|
1528
1700
|
),
|
|
1529
|
-
|
|
1701
|
+
E && /* @__PURE__ */ e("div", { className: "mt-3", children: /* @__PURE__ */ e(un, { history: me ?? [] }) })
|
|
1530
1702
|
] })
|
|
1531
|
-
] }) : /* @__PURE__ */
|
|
1703
|
+
] }) : /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-4 px-5 py-4", children: [
|
|
1532
1704
|
/* @__PURE__ */ e("p", { className: "text-[13px] text-slate-500", children: "Pipeline not started for this record." }),
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
|
|
1705
|
+
/* @__PURE__ */ r(
|
|
1706
|
+
J,
|
|
1535
1707
|
{
|
|
1536
1708
|
size: "sm",
|
|
1537
1709
|
variant: "outline",
|
|
1538
1710
|
className: "shrink-0 gap-1.5 text-[12px]",
|
|
1539
|
-
onClick: () =>
|
|
1540
|
-
disabled:
|
|
1711
|
+
onClick: () => W.mutate(),
|
|
1712
|
+
disabled: W.isPending,
|
|
1541
1713
|
children: [
|
|
1542
|
-
|
|
1714
|
+
W.isPending ? /* @__PURE__ */ e(re, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" }),
|
|
1543
1715
|
"Start Pipeline"
|
|
1544
1716
|
]
|
|
1545
1717
|
}
|
|
@@ -1549,87 +1721,93 @@ function Zt({
|
|
|
1549
1721
|
]
|
|
1550
1722
|
}
|
|
1551
1723
|
),
|
|
1552
|
-
|
|
1553
|
-
|
|
1724
|
+
N && /* @__PURE__ */ e(xt, { fallback: null, children: /* @__PURE__ */ e(
|
|
1725
|
+
_t,
|
|
1554
1726
|
{
|
|
1555
|
-
payload:
|
|
1556
|
-
transitionId:
|
|
1557
|
-
isRetry:
|
|
1727
|
+
payload: N.payload,
|
|
1728
|
+
transitionId: N.transitionId,
|
|
1729
|
+
isRetry: N.revision > 1,
|
|
1558
1730
|
onSubmitted: () => (
|
|
1559
1731
|
// mutateAsync so the dialog can stay busy until the transition
|
|
1560
1732
|
// settles; the mutation's own onError/onSuccess handle the outcome.
|
|
1561
|
-
|
|
1562
|
-
transition_id:
|
|
1563
|
-
comment:
|
|
1733
|
+
i.mutateAsync({
|
|
1734
|
+
transition_id: N.transitionId,
|
|
1735
|
+
comment: N.comment,
|
|
1564
1736
|
reviewed: !0
|
|
1565
1737
|
}).catch(() => {
|
|
1566
1738
|
})
|
|
1567
1739
|
),
|
|
1568
|
-
executing:
|
|
1740
|
+
executing: i.isPending,
|
|
1569
1741
|
onClose: () => s(null)
|
|
1570
1742
|
},
|
|
1571
|
-
|
|
1743
|
+
N.revision
|
|
1572
1744
|
) })
|
|
1573
1745
|
] });
|
|
1574
1746
|
}
|
|
1575
|
-
function
|
|
1576
|
-
collection:
|
|
1747
|
+
function Hn({
|
|
1748
|
+
collection: n,
|
|
1577
1749
|
item: t,
|
|
1578
|
-
onBeforeTransition:
|
|
1579
|
-
wrap:
|
|
1750
|
+
onBeforeTransition: l,
|
|
1751
|
+
wrap: a = !0
|
|
1580
1752
|
}) {
|
|
1581
1753
|
return t === "new" ? null : /* @__PURE__ */ e(
|
|
1582
|
-
|
|
1754
|
+
xn,
|
|
1583
1755
|
{
|
|
1584
|
-
collection:
|
|
1756
|
+
collection: n,
|
|
1585
1757
|
item: t,
|
|
1586
|
-
onBeforeTransition:
|
|
1587
|
-
wrap:
|
|
1758
|
+
onBeforeTransition: l,
|
|
1759
|
+
wrap: a
|
|
1588
1760
|
}
|
|
1589
1761
|
);
|
|
1590
1762
|
}
|
|
1591
|
-
function
|
|
1592
|
-
collection:
|
|
1763
|
+
function xn({
|
|
1764
|
+
collection: n,
|
|
1593
1765
|
item: t,
|
|
1594
|
-
onBeforeTransition:
|
|
1595
|
-
wrap:
|
|
1766
|
+
onBeforeTransition: l,
|
|
1767
|
+
wrap: a = !0
|
|
1596
1768
|
}) {
|
|
1597
|
-
const
|
|
1598
|
-
|
|
1599
|
-
const
|
|
1600
|
-
O.current || (O.current = !0,
|
|
1601
|
-
onSettled: () => {
|
|
1602
|
-
|
|
1769
|
+
const x = he(), m = ke(), [f, y] = U(""), [C, P] = U(null), [h, b] = U(null), [S, L] = U(null);
|
|
1770
|
+
yt(n, t, "transition", !!C || !!h);
|
|
1771
|
+
const M = te(null), D = Vt(M, !a), O = te(!1), E = (p) => {
|
|
1772
|
+
O.current || (O.current = !0, L(null), g.mutate(p, {
|
|
1773
|
+
onSettled: (w, T) => {
|
|
1774
|
+
if (T) {
|
|
1775
|
+
O.current = !1;
|
|
1776
|
+
return;
|
|
1777
|
+
}
|
|
1778
|
+
N().finally(() => {
|
|
1779
|
+
O.current = !1;
|
|
1780
|
+
});
|
|
1603
1781
|
}
|
|
1604
1782
|
}));
|
|
1605
|
-
},
|
|
1783
|
+
}, k = async (p) => {
|
|
1606
1784
|
if (O.current) return;
|
|
1607
|
-
if (
|
|
1608
|
-
|
|
1785
|
+
if (C === p) {
|
|
1786
|
+
P(null);
|
|
1609
1787
|
return;
|
|
1610
1788
|
}
|
|
1611
|
-
if (
|
|
1789
|
+
if (l) {
|
|
1612
1790
|
O.current = !0;
|
|
1613
|
-
let
|
|
1791
|
+
let F = !1;
|
|
1614
1792
|
try {
|
|
1615
|
-
|
|
1793
|
+
F = await l();
|
|
1616
1794
|
} finally {
|
|
1617
1795
|
O.current = !1;
|
|
1618
1796
|
}
|
|
1619
|
-
if (!
|
|
1797
|
+
if (!F) return;
|
|
1620
1798
|
}
|
|
1621
|
-
const
|
|
1622
|
-
if (
|
|
1623
|
-
|
|
1799
|
+
const w = (V ?? []).find((F) => F.id === p), T = String((w == null ? void 0 : w.comment_mode) ?? "none");
|
|
1800
|
+
if (T !== "optional" && T !== "required") {
|
|
1801
|
+
E({ transition_id: p });
|
|
1624
1802
|
return;
|
|
1625
1803
|
}
|
|
1626
|
-
|
|
1627
|
-
},
|
|
1628
|
-
queryKey:
|
|
1629
|
-
queryFn: () =>
|
|
1630
|
-
ie(`/pipelines/instance/${
|
|
1804
|
+
P(p);
|
|
1805
|
+
}, A = ["pipeline-instance", n, t], { settling: d, settle: N } = Tt(A), { data: s } = ne({
|
|
1806
|
+
queryKey: A,
|
|
1807
|
+
queryFn: () => x.request(
|
|
1808
|
+
ie(`/pipelines/instance/${n}/${t}`)
|
|
1631
1809
|
).then(
|
|
1632
|
-
(
|
|
1810
|
+
(p) => p.data ?? {
|
|
1633
1811
|
instance: null,
|
|
1634
1812
|
states: [],
|
|
1635
1813
|
available_transitions: [],
|
|
@@ -1639,261 +1817,261 @@ function Yt({
|
|
|
1639
1817
|
}
|
|
1640
1818
|
),
|
|
1641
1819
|
staleTime: 1e4
|
|
1642
|
-
}),
|
|
1820
|
+
}), g = ye({
|
|
1643
1821
|
mutationFn: ({
|
|
1644
|
-
transition_id:
|
|
1645
|
-
comment:
|
|
1646
|
-
reviewed:
|
|
1647
|
-
}) =>
|
|
1648
|
-
|
|
1649
|
-
transition_id:
|
|
1650
|
-
comment:
|
|
1651
|
-
...
|
|
1822
|
+
transition_id: p,
|
|
1823
|
+
comment: w,
|
|
1824
|
+
reviewed: T
|
|
1825
|
+
}) => x.request(
|
|
1826
|
+
fe(`/pipelines/instance/${n}/${t}/transition`, {
|
|
1827
|
+
transition_id: p,
|
|
1828
|
+
comment: w,
|
|
1829
|
+
...T ? { reviewed: !0 } : {}
|
|
1652
1830
|
})
|
|
1653
1831
|
),
|
|
1654
1832
|
onSuccess: () => {
|
|
1655
|
-
|
|
1833
|
+
m.invalidateQueries({ queryKey: A }), n === "nivaro_addendums" && m.invalidateQueries({ queryKey: ["addendums"] }), qe(m, n, String(t)), Ne(m, n, String(t)), qt(m, n, String(t)), L(null), y(""), P(null), b(null), ee.success("Transition executed");
|
|
1656
1834
|
},
|
|
1657
|
-
onError: (
|
|
1658
|
-
if (
|
|
1659
|
-
|
|
1835
|
+
onError: (p, w) => {
|
|
1836
|
+
if (Ct(p)) {
|
|
1837
|
+
m.invalidateQueries({ queryKey: A });
|
|
1660
1838
|
return;
|
|
1661
1839
|
}
|
|
1662
|
-
const
|
|
1663
|
-
if (
|
|
1664
|
-
|
|
1665
|
-
payload:
|
|
1666
|
-
transitionId:
|
|
1667
|
-
comment:
|
|
1668
|
-
revision: ((
|
|
1840
|
+
const T = St(p);
|
|
1841
|
+
if (T) {
|
|
1842
|
+
b((I) => ({
|
|
1843
|
+
payload: T,
|
|
1844
|
+
transitionId: w.transition_id,
|
|
1845
|
+
comment: w.comment,
|
|
1846
|
+
revision: ((I == null ? void 0 : I.revision) ?? 0) + 1
|
|
1669
1847
|
}));
|
|
1670
1848
|
return;
|
|
1671
1849
|
}
|
|
1672
|
-
const
|
|
1673
|
-
ee.error(
|
|
1850
|
+
const F = p == null ? void 0 : p.response;
|
|
1851
|
+
L($t(p, w)), ee.error(ve(p, "Failed to execute transition"), {
|
|
1674
1852
|
duration: 12e3,
|
|
1675
1853
|
// What to do next + Copy details (lib/error-toast.ts); "Why?" below wins the action slot.
|
|
1676
|
-
...
|
|
1854
|
+
...gt(p, { action: "Transition" }),
|
|
1677
1855
|
// #1867: a refusal carries "Why?" — the role, owner or access rule
|
|
1678
1856
|
// that stopped it, and who can change it.
|
|
1679
|
-
...
|
|
1680
|
-
action:
|
|
1681
|
-
collection:
|
|
1857
|
+
...Nt(p) ? {
|
|
1858
|
+
action: kt(x, {
|
|
1859
|
+
collection: n,
|
|
1682
1860
|
itemId: String(t),
|
|
1683
1861
|
action: "transition",
|
|
1684
|
-
transitionId:
|
|
1862
|
+
transitionId: w.transition_id
|
|
1685
1863
|
})
|
|
1686
1864
|
} : {}
|
|
1687
|
-
}),
|
|
1865
|
+
}), b(null), P(null), qe(m, n, String(t)), Ne(m, n, String(t)), (F == null ? void 0 : F.status) === 409 && m.invalidateQueries({ queryKey: A });
|
|
1688
1866
|
}
|
|
1689
|
-
}),
|
|
1690
|
-
|
|
1691
|
-
const
|
|
1692
|
-
if (
|
|
1693
|
-
const
|
|
1694
|
-
const
|
|
1695
|
-
if (!
|
|
1696
|
-
|
|
1697
|
-
const
|
|
1698
|
-
if (
|
|
1867
|
+
}), $ = te(k);
|
|
1868
|
+
$.current = k;
|
|
1869
|
+
const K = te((s == null ? void 0 : s.available_transitions) ?? []);
|
|
1870
|
+
if (K.current = (s == null ? void 0 : s.available_transitions) ?? [], oe(() => {
|
|
1871
|
+
const p = (w) => {
|
|
1872
|
+
const T = w.detail;
|
|
1873
|
+
if (!T || T.claimed || T.collection !== n || String(T.item) !== String(t)) return;
|
|
1874
|
+
T.claimed = !0;
|
|
1875
|
+
const F = String(T.transition_id).toUpperCase(), I = K.current.find((W) => String(W.id).toUpperCase() === F);
|
|
1876
|
+
if (!I) {
|
|
1699
1877
|
ee.error("That step is not available from where the record is now");
|
|
1700
1878
|
return;
|
|
1701
1879
|
}
|
|
1702
|
-
|
|
1880
|
+
$.current(I.id);
|
|
1703
1881
|
};
|
|
1704
|
-
return window.addEventListener(
|
|
1705
|
-
}, [
|
|
1706
|
-
const
|
|
1707
|
-
(
|
|
1882
|
+
return window.addEventListener(Te, p), () => window.removeEventListener(Te, p);
|
|
1883
|
+
}, [n, t]), !(s != null && s.binding) || !(s != null && s.instance)) return null;
|
|
1884
|
+
const V = (s.available_transitions ?? []).filter(
|
|
1885
|
+
(p) => !s.instance.completed_at || p.from_state && String(p.from_state).toUpperCase() === String(s.instance.current_state).toUpperCase()
|
|
1708
1886
|
);
|
|
1709
|
-
if (
|
|
1710
|
-
const
|
|
1711
|
-
for (const
|
|
1712
|
-
const
|
|
1713
|
-
|
|
1887
|
+
if (V.length === 0) return null;
|
|
1888
|
+
const u = new Map((s.states ?? []).map((p) => [p.id, p])), v = s.instance.current_state_obj ?? null, B = C ? V.find((p) => p.id === C) : null, z = B ? u.get(B.to_state) : null, X = /* @__PURE__ */ new Map();
|
|
1889
|
+
for (const p of V) {
|
|
1890
|
+
const w = X.get(p.label) ?? [];
|
|
1891
|
+
w.push(p), X.set(p.label, w);
|
|
1714
1892
|
}
|
|
1715
|
-
const
|
|
1716
|
-
(
|
|
1717
|
-
var
|
|
1718
|
-
return (((
|
|
1893
|
+
const ae = (p) => [...p].sort(
|
|
1894
|
+
(w, T) => {
|
|
1895
|
+
var F, I;
|
|
1896
|
+
return (((F = u.get(w.to_state)) == null ? void 0 : F.sort) ?? 999) - (((I = u.get(T.to_state)) == null ? void 0 : I.sort) ?? 999);
|
|
1719
1897
|
}
|
|
1720
|
-
),
|
|
1721
|
-
var
|
|
1722
|
-
const
|
|
1723
|
-
if (!
|
|
1724
|
-
const
|
|
1725
|
-
return Math.max(260, Math.min(600,
|
|
1898
|
+
), o = (() => {
|
|
1899
|
+
var T, F, I;
|
|
1900
|
+
const p = (T = M.current) == null ? void 0 : T.getBoundingClientRect();
|
|
1901
|
+
if (!p) return 600;
|
|
1902
|
+
const w = (I = (F = M.current) == null ? void 0 : F.closest('[role="dialog"]')) == null ? void 0 : I.getBoundingClientRect();
|
|
1903
|
+
return Math.max(260, Math.min(600, p.right - ((w == null ? void 0 : w.left) ?? 0) - 12));
|
|
1726
1904
|
})();
|
|
1727
|
-
return /* @__PURE__ */
|
|
1728
|
-
|
|
1729
|
-
/* @__PURE__ */ e(
|
|
1730
|
-
|
|
1905
|
+
return /* @__PURE__ */ r("div", { ref: M, className: "relative", children: [
|
|
1906
|
+
D ? /* @__PURE__ */ r(Be, { children: [
|
|
1907
|
+
/* @__PURE__ */ e(Ie, { asChild: !0, children: /* @__PURE__ */ r(
|
|
1908
|
+
J,
|
|
1731
1909
|
{
|
|
1732
1910
|
size: "sm",
|
|
1733
1911
|
variant: "outline",
|
|
1734
1912
|
className: "shrink-0 gap-1.5 text-[12px]",
|
|
1735
|
-
disabled:
|
|
1913
|
+
disabled: g.isPending || d,
|
|
1736
1914
|
"data-transitions-folded": !0,
|
|
1737
1915
|
children: [
|
|
1738
|
-
|
|
1916
|
+
g.isPending && /* @__PURE__ */ e(re, { className: "h-3 w-3 animate-spin" }),
|
|
1739
1917
|
"Actions",
|
|
1740
|
-
/* @__PURE__ */ e(
|
|
1918
|
+
/* @__PURE__ */ e(pe, { className: "h-3 w-3" })
|
|
1741
1919
|
]
|
|
1742
1920
|
}
|
|
1743
1921
|
) }),
|
|
1744
|
-
/* @__PURE__ */ e(
|
|
1745
|
-
([
|
|
1746
|
-
|
|
1747
|
-
/* @__PURE__ */
|
|
1748
|
-
|
|
1922
|
+
/* @__PURE__ */ e(Le, { align: "end", className: "min-w-[200px]", children: Array.from(X.entries()).map(
|
|
1923
|
+
([p, w], T, F) => w.length === 1 ? /* @__PURE__ */ r(dt, { children: [
|
|
1924
|
+
T > 0 && F[T - 1][1].length > 1 && /* @__PURE__ */ e(ct, {}),
|
|
1925
|
+
/* @__PURE__ */ r(Se, { onSelect: () => k(w[0].id), children: [
|
|
1926
|
+
w[0].color && /* @__PURE__ */ e(
|
|
1749
1927
|
"span",
|
|
1750
1928
|
{
|
|
1751
1929
|
className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
|
|
1752
|
-
style: { backgroundColor:
|
|
1930
|
+
style: { backgroundColor: w[0].color }
|
|
1753
1931
|
}
|
|
1754
1932
|
),
|
|
1755
|
-
|
|
1933
|
+
p
|
|
1756
1934
|
] })
|
|
1757
|
-
] },
|
|
1758
|
-
|
|
1759
|
-
/* @__PURE__ */ e(
|
|
1760
|
-
|
|
1761
|
-
var
|
|
1762
|
-
return /* @__PURE__ */
|
|
1763
|
-
|
|
1935
|
+
] }, p) : /* @__PURE__ */ r(dt, { children: [
|
|
1936
|
+
T > 0 && /* @__PURE__ */ e(ct, {}),
|
|
1937
|
+
/* @__PURE__ */ e(Yt, { className: "text-[11px] text-muted-foreground", children: p }),
|
|
1938
|
+
ae(w).map((I) => {
|
|
1939
|
+
var W;
|
|
1940
|
+
return /* @__PURE__ */ r(Se, { onSelect: () => k(I.id), children: [
|
|
1941
|
+
I.color && /* @__PURE__ */ e(
|
|
1764
1942
|
"span",
|
|
1765
1943
|
{
|
|
1766
1944
|
className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
|
|
1767
|
-
style: { backgroundColor:
|
|
1945
|
+
style: { backgroundColor: I.color }
|
|
1768
1946
|
}
|
|
1769
1947
|
),
|
|
1770
|
-
((
|
|
1771
|
-
] },
|
|
1948
|
+
((W = u.get(I.to_state)) == null ? void 0 : W.label) ?? I.to_state
|
|
1949
|
+
] }, I.id);
|
|
1772
1950
|
})
|
|
1773
|
-
] },
|
|
1951
|
+
] }, p)
|
|
1774
1952
|
) })
|
|
1775
1953
|
] }) : /* @__PURE__ */ e(
|
|
1776
1954
|
"div",
|
|
1777
1955
|
{
|
|
1778
|
-
className:
|
|
1779
|
-
children: Array.from(
|
|
1780
|
-
var
|
|
1781
|
-
const
|
|
1782
|
-
if (
|
|
1783
|
-
const
|
|
1784
|
-
|
|
1956
|
+
className: a ? "flex flex-wrap justify-end gap-2" : "flex shrink-0 items-center justify-end gap-2",
|
|
1957
|
+
children: Array.from(X.entries()).map(([p, w]) => {
|
|
1958
|
+
var W, i;
|
|
1959
|
+
const T = ((W = w[0]) == null ? void 0 : W.color) ?? null, F = w.some((_) => _.id === C), I = (_) => T ? _ ? { backgroundColor: T, borderColor: T } : { borderColor: T, color: T } : void 0;
|
|
1960
|
+
if (w.length === 1) {
|
|
1961
|
+
const _ = w[0], H = g.isPending && ((i = g.variables) == null ? void 0 : i.transition_id) === _.id, q = /* @__PURE__ */ r(
|
|
1962
|
+
J,
|
|
1785
1963
|
{
|
|
1786
1964
|
size: "sm",
|
|
1787
|
-
variant:
|
|
1965
|
+
variant: F ? "default" : "outline",
|
|
1788
1966
|
className: "gap-1.5 text-[12px]",
|
|
1789
|
-
style:
|
|
1790
|
-
disabled:
|
|
1791
|
-
onClick: () =>
|
|
1967
|
+
style: I(F),
|
|
1968
|
+
disabled: g.isPending || d,
|
|
1969
|
+
onClick: () => k(_.id),
|
|
1792
1970
|
children: [
|
|
1793
|
-
|
|
1794
|
-
|
|
1971
|
+
H && /* @__PURE__ */ e(re, { className: "h-3 w-3 animate-spin" }),
|
|
1972
|
+
p
|
|
1795
1973
|
]
|
|
1796
1974
|
},
|
|
1797
|
-
|
|
1975
|
+
p
|
|
1798
1976
|
);
|
|
1799
|
-
return
|
|
1800
|
-
|
|
1977
|
+
return _.pushes && _.pushes > 0 ? /* @__PURE__ */ r("span", { className: "relative inline-flex", children: [
|
|
1978
|
+
q,
|
|
1801
1979
|
/* @__PURE__ */ e(
|
|
1802
|
-
|
|
1980
|
+
Ht,
|
|
1803
1981
|
{
|
|
1804
|
-
collection:
|
|
1982
|
+
collection: n,
|
|
1805
1983
|
itemId: t,
|
|
1806
|
-
transitionId:
|
|
1807
|
-
label:
|
|
1984
|
+
transitionId: _.id,
|
|
1985
|
+
label: p,
|
|
1808
1986
|
compact: !0
|
|
1809
1987
|
}
|
|
1810
1988
|
)
|
|
1811
|
-
] },
|
|
1989
|
+
] }, p) : q;
|
|
1812
1990
|
}
|
|
1813
|
-
return /* @__PURE__ */
|
|
1814
|
-
/* @__PURE__ */ e(
|
|
1815
|
-
|
|
1991
|
+
return /* @__PURE__ */ r(Be, { children: [
|
|
1992
|
+
/* @__PURE__ */ e(Ie, { asChild: !0, children: /* @__PURE__ */ r(
|
|
1993
|
+
J,
|
|
1816
1994
|
{
|
|
1817
1995
|
size: "sm",
|
|
1818
|
-
variant:
|
|
1996
|
+
variant: F ? "default" : "outline",
|
|
1819
1997
|
className: "gap-1.5 text-[12px]",
|
|
1820
|
-
style:
|
|
1821
|
-
disabled:
|
|
1998
|
+
style: I(F),
|
|
1999
|
+
disabled: g.isPending || d,
|
|
1822
2000
|
children: [
|
|
1823
|
-
|
|
1824
|
-
/* @__PURE__ */ e(
|
|
2001
|
+
p,
|
|
2002
|
+
/* @__PURE__ */ e(pe, { className: "h-3 w-3" })
|
|
1825
2003
|
]
|
|
1826
2004
|
}
|
|
1827
2005
|
) }),
|
|
1828
|
-
/* @__PURE__ */ e(
|
|
1829
|
-
var
|
|
1830
|
-
return /* @__PURE__ */
|
|
1831
|
-
|
|
2006
|
+
/* @__PURE__ */ e(Le, { align: "start", children: ae(w).map((_) => {
|
|
2007
|
+
var H;
|
|
2008
|
+
return /* @__PURE__ */ r(Se, { onSelect: () => k(_.id), children: [
|
|
2009
|
+
_.color && /* @__PURE__ */ e(
|
|
1832
2010
|
"span",
|
|
1833
2011
|
{
|
|
1834
2012
|
className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
|
|
1835
|
-
style: { backgroundColor:
|
|
2013
|
+
style: { backgroundColor: _.color }
|
|
1836
2014
|
}
|
|
1837
2015
|
),
|
|
1838
|
-
((
|
|
1839
|
-
] },
|
|
2016
|
+
((H = u.get(_.to_state)) == null ? void 0 : H.label) ?? _.to_state
|
|
2017
|
+
] }, _.id);
|
|
1840
2018
|
}) })
|
|
1841
|
-
] },
|
|
2019
|
+
] }, p);
|
|
1842
2020
|
})
|
|
1843
2021
|
}
|
|
1844
2022
|
),
|
|
1845
|
-
|
|
2023
|
+
C && /* @__PURE__ */ r(
|
|
1846
2024
|
"div",
|
|
1847
2025
|
{
|
|
1848
2026
|
className: "absolute right-0 top-full z-50 mt-1 space-y-3 rounded-lg border border-slate-200 bg-white shadow-lg dark:bg-card dark:border-border p-3.5",
|
|
1849
|
-
style: { width:
|
|
2027
|
+
style: { width: o },
|
|
1850
2028
|
children: [
|
|
1851
|
-
/* @__PURE__ */
|
|
2029
|
+
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1852
2030
|
/* @__PURE__ */ e("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
/* @__PURE__ */ e(
|
|
1856
|
-
/* @__PURE__ */ e(
|
|
1857
|
-
/* @__PURE__ */ e(
|
|
2031
|
+
B && /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700", children: B.label }),
|
|
2032
|
+
v && z && /* @__PURE__ */ r("div", { className: "ml-auto flex items-center gap-1.5", children: [
|
|
2033
|
+
/* @__PURE__ */ e(de, { label: v.label, color: v.color, small: !0 }),
|
|
2034
|
+
/* @__PURE__ */ e(Qe, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
2035
|
+
/* @__PURE__ */ e(de, { label: z.label, color: z.color, small: !0 })
|
|
1858
2036
|
] })
|
|
1859
2037
|
] }),
|
|
1860
|
-
/* @__PURE__ */ e(
|
|
2038
|
+
/* @__PURE__ */ e(Pt, { collection: n, item: t }),
|
|
1861
2039
|
/* @__PURE__ */ e(
|
|
1862
2040
|
"input",
|
|
1863
2041
|
{
|
|
1864
2042
|
type: "text",
|
|
1865
2043
|
value: f,
|
|
1866
|
-
onChange: (
|
|
1867
|
-
placeholder: String((
|
|
2044
|
+
onChange: (p) => y(p.target.value),
|
|
2045
|
+
placeholder: String((B == null ? void 0 : B.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
|
|
1868
2046
|
className: "w-full rounded-md border border-slate-200 bg-white px-3 py-1.5 text-[13px] placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-nvr-cyan/30"
|
|
1869
2047
|
}
|
|
1870
2048
|
),
|
|
1871
|
-
/* @__PURE__ */
|
|
2049
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-end gap-2", children: [
|
|
1872
2050
|
/* @__PURE__ */ e(
|
|
1873
|
-
|
|
2051
|
+
J,
|
|
1874
2052
|
{
|
|
1875
2053
|
type: "button",
|
|
1876
2054
|
size: "sm",
|
|
1877
2055
|
variant: "ghost",
|
|
1878
2056
|
className: "h-7 text-[12px]",
|
|
1879
|
-
onClick: () =>
|
|
2057
|
+
onClick: () => P(null),
|
|
1880
2058
|
children: "Cancel"
|
|
1881
2059
|
}
|
|
1882
2060
|
),
|
|
1883
2061
|
/* @__PURE__ */ e(
|
|
1884
|
-
|
|
2062
|
+
J,
|
|
1885
2063
|
{
|
|
1886
2064
|
type: "button",
|
|
1887
2065
|
size: "sm",
|
|
1888
2066
|
className: "h-7 gap-1.5 text-[12px]",
|
|
1889
|
-
disabled:
|
|
1890
|
-
onClick: () =>
|
|
1891
|
-
transition_id:
|
|
2067
|
+
disabled: g.isPending || String((B == null ? void 0 : B.comment_mode) ?? "") === "required" && f.trim() === "",
|
|
2068
|
+
onClick: () => E({
|
|
2069
|
+
transition_id: C,
|
|
1892
2070
|
comment: f.trim() || void 0
|
|
1893
2071
|
}),
|
|
1894
|
-
children:
|
|
2072
|
+
children: g.isPending ? /* @__PURE__ */ e(re, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ r(ce, { children: [
|
|
1895
2073
|
/* @__PURE__ */ e("span", { children: "Confirm" }),
|
|
1896
|
-
/* @__PURE__ */ e(
|
|
2074
|
+
/* @__PURE__ */ e(Re, { className: "h-3 w-3" })
|
|
1897
2075
|
] })
|
|
1898
2076
|
}
|
|
1899
2077
|
)
|
|
@@ -1901,8 +2079,20 @@ function Yt({
|
|
|
1901
2079
|
]
|
|
1902
2080
|
}
|
|
1903
2081
|
),
|
|
1904
|
-
|
|
1905
|
-
|
|
2082
|
+
S && !C && /* @__PURE__ */ e(
|
|
2083
|
+
Rt,
|
|
2084
|
+
{
|
|
2085
|
+
collection: n,
|
|
2086
|
+
item: String(t),
|
|
2087
|
+
offer: S,
|
|
2088
|
+
className: "absolute right-0 top-full z-50 mt-1 shadow-lg",
|
|
2089
|
+
style: { width: o },
|
|
2090
|
+
onDismiss: () => L(null),
|
|
2091
|
+
onFixed: () => E({ transition_id: S.transitionId, comment: S.comment })
|
|
2092
|
+
}
|
|
2093
|
+
),
|
|
2094
|
+
h && /* @__PURE__ */ e(xt, { fallback: null, children: /* @__PURE__ */ e(
|
|
2095
|
+
_t,
|
|
1906
2096
|
{
|
|
1907
2097
|
payload: h.payload,
|
|
1908
2098
|
transitionId: h.transitionId,
|
|
@@ -1910,23 +2100,27 @@ function Yt({
|
|
|
1910
2100
|
onSubmitted: () => (
|
|
1911
2101
|
// mutateAsync so the dialog can stay busy until the transition
|
|
1912
2102
|
// settles; the mutation's own onError/onSuccess handle the outcome.
|
|
1913
|
-
|
|
2103
|
+
g.mutateAsync({
|
|
1914
2104
|
transition_id: h.transitionId,
|
|
1915
2105
|
comment: h.comment,
|
|
1916
2106
|
reviewed: !0
|
|
1917
2107
|
}).catch(() => {
|
|
1918
2108
|
})
|
|
1919
2109
|
),
|
|
1920
|
-
executing:
|
|
1921
|
-
onClose: () =>
|
|
2110
|
+
executing: g.isPending,
|
|
2111
|
+
onClose: () => b(null)
|
|
1922
2112
|
},
|
|
1923
2113
|
h.revision
|
|
1924
2114
|
) })
|
|
1925
2115
|
] });
|
|
1926
2116
|
}
|
|
1927
2117
|
export {
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
2118
|
+
Wn as PipelinePanel,
|
|
2119
|
+
Hn as PipelineTransitionButtons,
|
|
2120
|
+
sn as REFUSAL_FIX_ACTIONS,
|
|
2121
|
+
Ct as isDuplicateTransition,
|
|
2122
|
+
on as latestSendBack,
|
|
2123
|
+
an as refusalCode,
|
|
2124
|
+
$t as refusalFixFor,
|
|
2125
|
+
St as transitionRequirementsFromError
|
|
1932
2126
|
};
|