@nivaro/react 0.3.112 → 0.3.114
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/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +50 -2
- package/dist/shared/components/CollectionBrowserView.js +2559 -2505
- package/dist/shared/components/DataTable.js +543 -504
- package/dist/shared/components/cbv/ColumnHeaderMenu.js +56 -39
- package/dist/shared/components/cbv/column-totals.js +146 -41
- package/dist/shared/components/item-edit/InlineTableField.js +858 -863
- package/dist/shared/components/item-edit/UserChip.js +262 -239
- package/dist/shared/components/item-edit/grid-search.js +164 -134
- package/dist/shared/components/panels/PipelinePanel.js +1136 -1130
- package/dist/shared/components/panels/StandInReason.js +69 -0
- package/dist/shared/components/queue/QueueWorklist.js +1589 -1491
- package/dist/shared/components/queue/queue-totals.js +92 -0
- package/dist/shared/components/queue/worklist-helpers.js +18 -14
- package/dist/shared/lib/list-link.js +56 -50
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var ar = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var ft = (t, e, r) =>
|
|
4
|
-
import { jsx as n, jsxs as
|
|
5
|
-
import { useQueryClient as Ze, useQuery as
|
|
6
|
-
import { ArrowRight as qt, Loader2 as
|
|
7
|
-
import { useState as
|
|
8
|
-
import { toast as
|
|
2
|
+
var sr = (t, e, r) => e in t ? ar(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var ft = (t, e, r) => sr(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { jsx as n, jsxs as s, Fragment as Ce } from "react/jsx-runtime";
|
|
5
|
+
import { useQueryClient as Ze, useQuery as ke, useMutation as Ge } from "@tanstack/react-query";
|
|
6
|
+
import { ArrowRight as qt, Loader2 as Se, Check as Pt, GitBranch as ht, AlertTriangle as tn, ChevronDown as We, Send as nn, Users as rn, Undo2 as ir, Minus as or, UserPlus as lr, X as dr, Zap as an, Clock as cr } from "lucide-react";
|
|
7
|
+
import { useState as G, useRef as xe, useEffect as Be, useMemo as it, Suspense as sn, useCallback as on, lazy as ur, Fragment as mr } from "react";
|
|
8
|
+
import { toast as z } from "sonner";
|
|
9
9
|
import { useNivaroClient as Ie, useItemEditAuth as ln } from "../../context.js";
|
|
10
|
-
import { get as
|
|
10
|
+
import { get as $e, post as Je, del as pr } from "../../lib/commands.js";
|
|
11
11
|
import { errorToastOptions as dn, toastError as fr } from "../../lib/error-toast.js";
|
|
12
12
|
import { partnerMoveFailure as cn, partnerMoveReading as un } from "../../lib/move-failure.js";
|
|
13
13
|
import { OPEN_MOVE_STATE_EVENT as Wt } from "../../lib/move-state.js";
|
|
@@ -16,40 +16,41 @@ import { RUN_TRANSITION_EVENT as ot } from "../../lib/run-transition.js";
|
|
|
16
16
|
import { userErrorMessage as Ee } from "../../lib/safe-error.js";
|
|
17
17
|
import { serverNow as br } from "../../lib/server-clock.js";
|
|
18
18
|
import { useStartsOpen as vr } from "../../lib/use-starts-open.js";
|
|
19
|
-
import { cn as
|
|
19
|
+
import { cn as ce, titleCase as xr, toLocalDateString as yr, formatRelative as Rt, formatDateTime as zt, humanHours as wr } from "../../lib/utils.js";
|
|
20
20
|
import { PushReadinessChip as kr } from "../integrations/RecordIntegrationPreview.js";
|
|
21
21
|
import { useHeaderFold as _r } from "../item-edit/HeaderTools.js";
|
|
22
22
|
import { invalidateRecordInsights as ze, invalidateRecordData as He } from "../item-edit/RecordInsights.js";
|
|
23
23
|
import { UserChip as pn } from "../item-edit/UserChip.js";
|
|
24
24
|
import { OwnerAvatars as Nr } from "../queue/OwnerAvatars.js";
|
|
25
25
|
import { UserAvatar as Sr } from "../UserAvatar.js";
|
|
26
|
-
import { Button as
|
|
27
|
-
import { DropdownMenu as xt, DropdownMenuTrigger as yt, DropdownMenuContent as wt, DropdownMenuGroup as Ht, DropdownMenuSeparator as kt, DropdownMenuItem as nt, DropdownMenuLabel as
|
|
26
|
+
import { Button as fe } from "../ui/button.js";
|
|
27
|
+
import { DropdownMenu as xt, DropdownMenuTrigger as yt, DropdownMenuContent as wt, DropdownMenuGroup as Ht, DropdownMenuSeparator as kt, DropdownMenuItem as nt, DropdownMenuLabel as Cr } from "../ui/dropdown-menu.js";
|
|
28
28
|
import { Popover as fn, PopoverTrigger as hn, PopoverContent as gn } from "../ui/popover.js";
|
|
29
|
-
import { Skeleton as
|
|
29
|
+
import { Skeleton as Ae } from "../ui/skeleton.js";
|
|
30
30
|
import { TooltipProvider as bn, Tooltip as _t, TooltipTrigger as Nt, TooltipContent as St } from "../ui/tooltip.js";
|
|
31
31
|
import { ViewAsPersonButton as gt } from "../ViewAsPersonButton.js";
|
|
32
|
-
import { isAccessRefusal as vn, deniedToastAction as xn, WhyOwnersButton as
|
|
32
|
+
import { isAccessRefusal as vn, deniedToastAction as xn, WhyOwnersButton as $r } from "./AccessInsights.js";
|
|
33
33
|
import { AsyncUserPicker as Tr } from "./AsyncUserPicker.js";
|
|
34
|
-
import { runningMovePoll as yn, useRunEnded as wn, startedInBackground as kn, pendingOptIn as _n, sameMoveId as
|
|
35
|
-
import { withBlockedMoves as Sn, BlockedMenuMark as rt, blockedMenuItemProps as at, isBlockedMove as
|
|
34
|
+
import { runningMovePoll as yn, useRunEnded as wn, startedInBackground as kn, pendingOptIn as _n, sameMoveId as Ct, runningMoveTip as Mr, unansweredHoldTip as Nn, RunningMoveNotice as qr, MoveProblemNotice as Pr } from "./BackgroundMove.js";
|
|
35
|
+
import { withBlockedMoves as Sn, BlockedMenuMark as rt, blockedMenuItemProps as at, isBlockedMove as Cn, BlockedMoveButton as $n, blockedGroupTip as Tn } from "./BlockedMove.js";
|
|
36
36
|
import { BranchLanes as Rr } from "./BranchLanes.js";
|
|
37
|
-
import { landingState as
|
|
37
|
+
import { landingState as Fr, landingSkipGroups as Ar, joinLabels as Gt } from "./landing-state.js";
|
|
38
38
|
import { distinctAdvisories as Mn, MoveAdvisoryNotice as qn, REFUSAL_FIX_ACTIONS as Or, useRecordFixAction as Dr } from "./MoveAdvisory.js";
|
|
39
39
|
import { MoveToStatePanel as Br } from "./MoveToStatePanel.js";
|
|
40
|
-
import { SignOffSummaryLines as Er, useStepTiming as Pn, TimingLegend as Ir, timingWords as Rn, firstTouchText as
|
|
40
|
+
import { SignOffSummaryLines as Er, useStepTiming as Pn, TimingLegend as Ir, timingWords as Rn, firstTouchText as Fn, waitingFill as Ur, workingFill as Lr } from "./PipelineInsight.js";
|
|
41
41
|
import { SlaClockLine as jr } from "./SlaClock.js";
|
|
42
|
-
|
|
42
|
+
import { standInIds as Kr, StandInReasonLines as Qr } from "./StandInReason.js";
|
|
43
|
+
const An = ur(
|
|
43
44
|
() => import("./TransitionRequirementsDialog.js").then((t) => ({
|
|
44
45
|
default: t.TransitionRequirementsDialog
|
|
45
46
|
}))
|
|
46
47
|
);
|
|
47
|
-
function
|
|
48
|
-
var
|
|
49
|
-
const r = t || "System", a = (
|
|
48
|
+
function Ft(t, e) {
|
|
49
|
+
var i;
|
|
50
|
+
const r = t || "System", a = (i = e.acting_admin) != null && i.name && t ? `${e.acting_admin.name} as ${r}` : r;
|
|
50
51
|
return e.on_behalf_of_name ? `${a}, for ${e.on_behalf_of_name}` : a;
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function Wr(t) {
|
|
53
54
|
if (t.transition) return null;
|
|
54
55
|
const e = (t.comment ?? "").trim();
|
|
55
56
|
if (!e.startsWith("{")) return null;
|
|
@@ -63,10 +64,10 @@ function Kr(t) {
|
|
|
63
64
|
}
|
|
64
65
|
return null;
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
+
function st(t) {
|
|
67
68
|
return !(t.first_name || t.last_name || t.user_email);
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
+
function $t(t) {
|
|
70
71
|
const e = (t.comment ?? "").trim().toLowerCase();
|
|
71
72
|
return t.origin === "import" || e.startsWith("import:") ? "Imported" : t.origin === "integration" ? "By an integration" : /-state-sync$/.test(e) || e.startsWith("legacy-") ? "Synced from another system" : e === "state-merge" || e === "instance-migration" ? "Moved by an admin script" : "Moved automatically";
|
|
72
73
|
}
|
|
@@ -84,11 +85,11 @@ const Vt = {
|
|
|
84
85
|
rate_limited: "the partner asked us to slow down",
|
|
85
86
|
unknown: "the partner refused it"
|
|
86
87
|
};
|
|
87
|
-
function
|
|
88
|
+
function zr(t) {
|
|
88
89
|
const e = Math.ceil((new Date(t).getTime() - br()) / 6e4);
|
|
89
90
|
return !Number.isFinite(e) || e <= 0 ? "on the next check" : e < 60 ? `in ${e} min` : `in ${Math.round(e / 60)}h`;
|
|
90
91
|
}
|
|
91
|
-
function
|
|
92
|
+
function Hr({ held: t }) {
|
|
92
93
|
return t.length === 0 ? null : /* @__PURE__ */ n(
|
|
93
94
|
"div",
|
|
94
95
|
{
|
|
@@ -96,8 +97,8 @@ function Wr({ held: t }) {
|
|
|
96
97
|
"data-pipeline-auto-held": !0,
|
|
97
98
|
children: t.map((e) => {
|
|
98
99
|
const r = e.transition_label ?? "An automatic move", a = Vt[e.error_class ?? "unknown"] ?? Vt.unknown;
|
|
99
|
-
return /* @__PURE__ */
|
|
100
|
-
/* @__PURE__ */
|
|
100
|
+
return /* @__PURE__ */ s("div", { className: "text-[12px] text-amber-800 dark:text-amber-300", children: [
|
|
101
|
+
/* @__PURE__ */ s("p", { className: "font-medium", children: [
|
|
101
102
|
"Needs a person: ",
|
|
102
103
|
r,
|
|
103
104
|
" stopped retrying — ",
|
|
@@ -112,8 +113,8 @@ function Wr({ held: t }) {
|
|
|
112
113
|
children: e.error
|
|
113
114
|
}
|
|
114
115
|
),
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
e.retry_at ? `It tries the same push again ${
|
|
116
|
+
/* @__PURE__ */ s("p", { className: "mt-1 text-[11px] text-amber-700 dark:text-amber-400", children: [
|
|
117
|
+
e.retry_at ? `It tries the same push again ${zr(e.retry_at)}. ` : "It will not send the same push again on its own. ",
|
|
117
118
|
"Fix the record so what it sends changes, retry the push, or move the record by hand.",
|
|
118
119
|
e.attempts > 1 ? ` ${e.attempts} attempts so far.` : ""
|
|
119
120
|
] })
|
|
@@ -145,41 +146,41 @@ function Bn(t) {
|
|
|
145
146
|
return { message: typeof r.error == "string" && r.error.trim() ? r.error : `${a ?? "Someone else"} is editing this record right now.`, holder: a };
|
|
146
147
|
}
|
|
147
148
|
function En(t, e) {
|
|
148
|
-
var
|
|
149
|
-
const r = dt(t), a = t == null ? void 0 : t.response,
|
|
150
|
-
return !r || !
|
|
149
|
+
var y, v, p;
|
|
150
|
+
const r = dt(t), a = t == null ? void 0 : t.response, i = ((y = a == null ? void 0 : a.fix) == null ? void 0 : y.action) ?? ((p = (v = a == null ? void 0 : a.data) == null ? void 0 : v.fix) == null ? void 0 : p.action), d = typeof i == "string" && i.trim() || (r ? Or[r] : void 0);
|
|
151
|
+
return !r || !d ? null : { code: r, actionKey: d, transitionId: e.transition_id, comment: e.comment };
|
|
151
152
|
}
|
|
152
|
-
const
|
|
153
|
+
const Gr = 600;
|
|
153
154
|
function In(t) {
|
|
154
|
-
const e = Ze(), [r, a] =
|
|
155
|
-
Be(() => (
|
|
156
|
-
|
|
155
|
+
const e = Ze(), [r, a] = G(!1), i = xe(!0);
|
|
156
|
+
Be(() => (i.current = !0, () => {
|
|
157
|
+
i.current = !1;
|
|
157
158
|
}), []);
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
const
|
|
159
|
+
const d = xe(t);
|
|
160
|
+
d.current = t;
|
|
161
|
+
const y = on(async () => {
|
|
161
162
|
a(!0);
|
|
162
163
|
try {
|
|
163
|
-
await e.refetchQueries({ queryKey: [...
|
|
164
|
+
await e.refetchQueries({ queryKey: [...d.current], type: "active" });
|
|
164
165
|
} catch {
|
|
165
166
|
}
|
|
166
|
-
await new Promise((
|
|
167
|
+
await new Promise((v) => setTimeout(v, Gr)), i.current && a(!1);
|
|
167
168
|
}, [e]);
|
|
168
|
-
return { settling: r, settle:
|
|
169
|
+
return { settling: r, settle: y };
|
|
169
170
|
}
|
|
170
171
|
const je = 1500, Xt = 4e3;
|
|
171
|
-
class
|
|
172
|
+
class Vr {
|
|
172
173
|
constructor() {
|
|
173
174
|
ft(this, "seen", null);
|
|
174
175
|
ft(this, "fresh", /* @__PURE__ */ new Map());
|
|
175
176
|
}
|
|
176
177
|
/** Feed the ids on offer now. */
|
|
177
178
|
observe(e, r) {
|
|
178
|
-
const a = new Set(e.map((
|
|
179
|
+
const a = new Set(e.map((i) => String(i).toUpperCase()));
|
|
179
180
|
if (this.seen)
|
|
180
|
-
for (const
|
|
181
|
-
this.seen.has(
|
|
182
|
-
for (const
|
|
181
|
+
for (const i of a)
|
|
182
|
+
this.seen.has(i) || this.fresh.set(i, { at: r, hovered: !1, left: !1 });
|
|
183
|
+
for (const i of [...this.fresh.keys()]) a.has(i) || this.fresh.delete(i);
|
|
183
184
|
this.seen = a;
|
|
184
185
|
}
|
|
185
186
|
/** The pointer is on the button. */
|
|
@@ -199,8 +200,8 @@ class Hr {
|
|
|
199
200
|
}
|
|
200
201
|
/** A press: true = let it through. A press inside the window counts as the pointer being there. */
|
|
201
202
|
press(e, r) {
|
|
202
|
-
const a = String(e).toUpperCase(),
|
|
203
|
-
return
|
|
203
|
+
const a = String(e).toUpperCase(), i = this.fresh.get(a);
|
|
204
|
+
return i ? r - i.at < je ? (i.hovered = !0, i.left = !1, !1) : i.hovered && !i.left && r - i.at < Xt ? !1 : (this.fresh.delete(a), !0) : !0;
|
|
204
205
|
}
|
|
205
206
|
/** Inside its time window (drawn dimmed)? */
|
|
206
207
|
timed(e, r) {
|
|
@@ -216,87 +217,87 @@ class Hr {
|
|
|
216
217
|
this.seen = null, this.fresh.clear();
|
|
217
218
|
}
|
|
218
219
|
}
|
|
219
|
-
function
|
|
220
|
-
const r =
|
|
221
|
-
r.current || (r.current = new
|
|
222
|
-
const a = r.current,
|
|
223
|
-
|
|
224
|
-
const [,
|
|
225
|
-
return
|
|
220
|
+
function Un(t, e) {
|
|
221
|
+
const r = xe(null);
|
|
222
|
+
r.current || (r.current = new Vr());
|
|
223
|
+
const a = r.current, i = xe(e);
|
|
224
|
+
i.current !== e && (i.current = e, a.reset());
|
|
225
|
+
const [, d] = G(0), y = t ? t.join(",") : null;
|
|
226
|
+
return it(() => {
|
|
226
227
|
t && a.observe(t, Date.now());
|
|
227
|
-
}, [a,
|
|
228
|
+
}, [a, y]), Be(() => {
|
|
228
229
|
if (!a.hasTimed(Date.now())) return;
|
|
229
|
-
const
|
|
230
|
-
return () => clearTimeout(
|
|
231
|
-
}, [a,
|
|
232
|
-
dimmed: (
|
|
233
|
-
press: (
|
|
234
|
-
bind: (
|
|
235
|
-
onPointerEnter: () => a.enter(
|
|
236
|
-
onPointerMove: () => a.enter(
|
|
237
|
-
onPointerLeave: () => a.leave(
|
|
230
|
+
const v = setTimeout(() => d((p) => p + 1), je + 20);
|
|
231
|
+
return () => clearTimeout(v);
|
|
232
|
+
}, [a, y]), {
|
|
233
|
+
dimmed: (v) => a.timed(v, Date.now()),
|
|
234
|
+
press: (v) => a.press(v, Date.now()),
|
|
235
|
+
bind: (v) => ({
|
|
236
|
+
onPointerEnter: () => a.enter(v, Date.now()),
|
|
237
|
+
onPointerMove: () => a.enter(v, Date.now()),
|
|
238
|
+
onPointerLeave: () => a.leave(v)
|
|
238
239
|
})
|
|
239
240
|
};
|
|
240
241
|
}
|
|
241
|
-
function
|
|
242
|
+
function Ln(t, e) {
|
|
242
243
|
return ["approval-brief", t, String(e)];
|
|
243
244
|
}
|
|
244
245
|
function jn(t, e, r) {
|
|
245
246
|
return t.request(
|
|
246
|
-
|
|
247
|
+
$e(`/pipelines/instance/${e}/${r}/approval-brief`)
|
|
247
248
|
).then((a) => a.data);
|
|
248
249
|
}
|
|
249
|
-
function
|
|
250
|
+
function Xr(t) {
|
|
250
251
|
return (t ?? []).filter((e) => e.tone === "warn" || e.tone === "danger");
|
|
251
252
|
}
|
|
252
253
|
function Yt(t) {
|
|
253
254
|
return `${(t.label ?? "").trim().toLowerCase()}|${(t.text ?? "").trim().toLowerCase()}`;
|
|
254
255
|
}
|
|
255
|
-
function
|
|
256
|
+
function Yr(t) {
|
|
256
257
|
const e = Math.max(0, Math.floor(Number(t) || 0));
|
|
257
258
|
return e === 0 ? "today" : e === 1 ? "1 day ago" : `${e} days ago`;
|
|
258
259
|
}
|
|
259
|
-
function
|
|
260
|
-
const a = (_) => _ == null || _ === "" ? "" : String(_),
|
|
261
|
-
if (t === void 0) return { old: null, new: bt(
|
|
262
|
-
if (
|
|
263
|
-
let
|
|
264
|
-
for (;
|
|
265
|
-
const p =
|
|
266
|
-
return { old: bt(
|
|
260
|
+
function Jr(t, e, r = 40) {
|
|
261
|
+
const a = (_) => _ == null || _ === "" ? "" : String(_), i = a(t), d = a(e), y = (_) => _ === "" ? "(empty)" : _;
|
|
262
|
+
if (t === void 0) return { old: null, new: bt(y(d), 0, r) };
|
|
263
|
+
if (i.length <= r && d.length <= r) return { old: y(i), new: y(d) };
|
|
264
|
+
let v = 0;
|
|
265
|
+
for (; v < i.length && v < d.length && i[v] === d[v]; ) v++;
|
|
266
|
+
const p = v > r / 2 ? v - Math.floor(r / 3) : 0;
|
|
267
|
+
return { old: bt(y(i), p, r), new: bt(y(d), p, r) };
|
|
267
268
|
}
|
|
268
269
|
function bt(t, e, r) {
|
|
269
|
-
const a = Math.min(e, Math.max(0, t.length - r)),
|
|
270
|
-
return `${a > 0 ? "…" : ""}${
|
|
270
|
+
const a = Math.min(e, Math.max(0, t.length - r)), i = t.slice(a, a + r);
|
|
271
|
+
return `${a > 0 ? "…" : ""}${i}${a + r < t.length ? "…" : ""}`;
|
|
271
272
|
}
|
|
272
|
-
const
|
|
273
|
+
const Zr = 4e3;
|
|
273
274
|
function Kn(t, e) {
|
|
274
275
|
const r = Ie(), a = Ze();
|
|
275
276
|
return on(async () => {
|
|
276
277
|
try {
|
|
277
|
-
const
|
|
278
|
+
const i = await Promise.race([
|
|
278
279
|
a.fetchQuery({
|
|
279
|
-
queryKey:
|
|
280
|
+
queryKey: Ln(t, e),
|
|
280
281
|
queryFn: () => jn(r, t, e),
|
|
281
282
|
staleTime: 0,
|
|
282
283
|
retry: !1
|
|
283
284
|
}),
|
|
284
|
-
new Promise((
|
|
285
|
+
new Promise((d) => setTimeout(() => d(null), Zr))
|
|
285
286
|
]);
|
|
286
|
-
return
|
|
287
|
+
return Xr(i == null ? void 0 : i.lines);
|
|
287
288
|
} catch {
|
|
288
289
|
return [];
|
|
289
290
|
}
|
|
290
291
|
}, [r, a, t, e]);
|
|
291
292
|
}
|
|
292
293
|
function Qn({ lines: t }) {
|
|
293
|
-
return t.length === 0 ? null : /* @__PURE__ */
|
|
294
|
+
return t.length === 0 ? null : /* @__PURE__ */ s(
|
|
294
295
|
"div",
|
|
295
296
|
{
|
|
296
297
|
"data-forward-warning": !0,
|
|
297
298
|
className: "rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-[12px] text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200",
|
|
298
299
|
children: [
|
|
299
|
-
t.map((e) => /* @__PURE__ */
|
|
300
|
+
t.map((e) => /* @__PURE__ */ s("p", { children: [
|
|
300
301
|
/* @__PURE__ */ n("span", { className: "font-semibold", children: e.label ? `${e.label}: ` : "" }),
|
|
301
302
|
e.text
|
|
302
303
|
] }, `${e.label}:${e.text}`)),
|
|
@@ -308,16 +309,16 @@ function Qn({ lines: t }) {
|
|
|
308
309
|
function et(t, e, r) {
|
|
309
310
|
if (!r) return !1;
|
|
310
311
|
const a = e.find(
|
|
311
|
-
(
|
|
312
|
-
),
|
|
313
|
-
return !!a && !!
|
|
312
|
+
(d) => String(d.id).toUpperCase() === String(r).toUpperCase()
|
|
313
|
+
), i = e.find((d) => String(d.id).toUpperCase() === String(t.to_state).toUpperCase());
|
|
314
|
+
return !!a && !!i && i.sort < a.sort;
|
|
314
315
|
}
|
|
315
|
-
function
|
|
316
|
-
var
|
|
316
|
+
function At(t, e, r) {
|
|
317
|
+
var i;
|
|
317
318
|
if (!t) return !1;
|
|
318
|
-
if ((((
|
|
319
|
+
if ((((i = t.order_partners) == null ? void 0 : i.length) ?? 0) > 0) return !0;
|
|
319
320
|
if (et(t, e, r)) return !1;
|
|
320
|
-
const a = e.find((
|
|
321
|
+
const a = e.find((d) => String(d.id).toUpperCase() === String(t.to_state).toUpperCase());
|
|
321
322
|
return !!(a != null && a.is_terminal) && !/(^|_)cancel/i.test(String(a.key ?? ""));
|
|
322
323
|
}
|
|
323
324
|
const Jt = {
|
|
@@ -328,12 +329,12 @@ const Jt = {
|
|
|
328
329
|
blue: "border-sky-200 bg-sky-50 text-sky-800 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300",
|
|
329
330
|
purple: "border-violet-200 bg-violet-50 text-violet-800 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-300"
|
|
330
331
|
};
|
|
331
|
-
function
|
|
332
|
-
return !t || t.length === 0 ? null : /* @__PURE__ */ n(
|
|
332
|
+
function ea({ flags: t }) {
|
|
333
|
+
return !t || t.length === 0 ? null : /* @__PURE__ */ n(Ce, { children: t.map((e) => /* @__PURE__ */ s(
|
|
333
334
|
"span",
|
|
334
335
|
{
|
|
335
336
|
"data-record-flag": e.name,
|
|
336
|
-
className:
|
|
337
|
+
className: ce(
|
|
337
338
|
"inline-flex shrink-0 items-center gap-1 self-center rounded-full border px-2 py-0.5 text-[11px] font-semibold",
|
|
338
339
|
Jt[e.color] ?? Jt.amber
|
|
339
340
|
),
|
|
@@ -353,26 +354,26 @@ function Wn({
|
|
|
353
354
|
item: e,
|
|
354
355
|
tx: r
|
|
355
356
|
}) {
|
|
356
|
-
const a = Ie(),
|
|
357
|
+
const a = Ie(), i = (r == null ? void 0 : r.order_partners) ?? [], { data: d } = ke({
|
|
357
358
|
queryKey: ["push-preflight", t, e, "t", (r == null ? void 0 : r.id) ?? ""],
|
|
358
359
|
queryFn: () => a.request(
|
|
359
|
-
|
|
360
|
+
$e(`/integration-preview/${t}/${encodeURIComponent(e)}/preflight`, {
|
|
360
361
|
transition_id: (r == null ? void 0 : r.id) ?? ""
|
|
361
362
|
})
|
|
362
363
|
).then((p) => p.data),
|
|
363
|
-
enabled:
|
|
364
|
+
enabled: i.length > 0 && !!(r != null && r.id),
|
|
364
365
|
staleTime: 2e4
|
|
365
366
|
});
|
|
366
|
-
if (
|
|
367
|
-
const
|
|
368
|
-
return /* @__PURE__ */
|
|
367
|
+
if (i.length === 0) return null;
|
|
368
|
+
const y = d != null && d.pushes ? d.pushes.filter((p) => p.status === "would_push" && i.includes(p.api_name)).map((p) => Zt(p.api_name)) : null, v = [...new Set(y ?? i.map(Zt))];
|
|
369
|
+
return /* @__PURE__ */ s(
|
|
369
370
|
"p",
|
|
370
371
|
{
|
|
371
372
|
"data-order-send-note": !0,
|
|
372
373
|
className: "flex items-start gap-1.5 rounded-md border border-sky-200 bg-sky-50 px-2.5 py-1.5 text-[12px] text-sky-900 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-200",
|
|
373
374
|
children: [
|
|
374
375
|
/* @__PURE__ */ n(nn, { className: "mt-0.5 h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
|
|
375
|
-
|
|
376
|
+
y && y.length === 0 ? "Nothing is sent to a partner for this record — it only moves the record on." : `This places an order with ${v.join(" or ")}. It cannot be called back from here.`
|
|
376
377
|
]
|
|
377
378
|
}
|
|
378
379
|
);
|
|
@@ -387,31 +388,31 @@ function zn(t) {
|
|
|
387
388
|
}
|
|
388
389
|
function Hn(t, e, r, a) {
|
|
389
390
|
if (!a || a.size === 0) return t;
|
|
390
|
-
const
|
|
391
|
+
const i = new Set([...a.keys()].map((d) => String(d).toUpperCase()));
|
|
391
392
|
return t.filter(
|
|
392
|
-
(
|
|
393
|
+
(d) => !(!d.to_previous && i.has(String(d.to_state).toUpperCase()) && et(d, e, r))
|
|
393
394
|
);
|
|
394
395
|
}
|
|
395
396
|
function Gn(t, e, r) {
|
|
396
|
-
var p, _,
|
|
397
|
+
var p, _, b, k, S, F;
|
|
397
398
|
const a = [...(t == null ? void 0 : t.available_transitions) ?? [], ...(t == null ? void 0 : t.all_transitions) ?? []].find(
|
|
398
399
|
(C) => C.id === e
|
|
399
|
-
),
|
|
400
|
-
return
|
|
400
|
+
), i = r == null ? void 0 : r.data, d = ((p = i == null ? void 0 : i.new_state) == null ? void 0 : p.id) ?? ((_ = i == null ? void 0 : i.instance) == null ? void 0 : _.current_state) ?? null, y = ((b = i == null ? void 0 : i.new_state) == null ? void 0 : b.label) ?? (a ? (S = (k = t == null ? void 0 : t.states) == null ? void 0 : k.find((C) => C.id === a.to_state)) == null ? void 0 : S.label : void 0) ?? null, v = ((F = t == null ? void 0 : t.instance) == null ? void 0 : F.current_state) ?? null;
|
|
401
|
+
return v && d && String(v) === String(d) ? "Nothing moved" : a != null && a.label && y ? `${a.label} — now ${y}` : y ? `Moved to ${y}` : a != null && a.label ? `${a.label} done` : "Transition executed";
|
|
401
402
|
}
|
|
402
|
-
const
|
|
403
|
+
const ta = 1200;
|
|
403
404
|
function Vn(t) {
|
|
404
405
|
const e = `nvr-move-${Math.random().toString(36).slice(2)}`;
|
|
405
406
|
let r = !1;
|
|
406
407
|
const a = setTimeout(() => {
|
|
407
|
-
r = !0,
|
|
408
|
-
},
|
|
408
|
+
r = !0, z.loading(`${(t == null ? void 0 : t.trim()) || "Moving"}…`, { id: e });
|
|
409
|
+
}, ta);
|
|
409
410
|
return {
|
|
410
411
|
/** Options for the result toast: replaces the loading one when shown. */
|
|
411
412
|
done: () => (clearTimeout(a), r ? { id: e, duration: 7e3 } : {}),
|
|
412
413
|
/** An error toast of its own follows — drop the loading one. */
|
|
413
414
|
fail: () => {
|
|
414
|
-
clearTimeout(a), r &&
|
|
415
|
+
clearTimeout(a), r && z.dismiss(e);
|
|
415
416
|
}
|
|
416
417
|
};
|
|
417
418
|
}
|
|
@@ -423,23 +424,23 @@ function lt(t, e, r) {
|
|
|
423
424
|
])
|
|
424
425
|
t.invalidateQueries({ queryKey: [a, e, r] });
|
|
425
426
|
}
|
|
426
|
-
function
|
|
427
|
-
var
|
|
427
|
+
function na(t, e, r) {
|
|
428
|
+
var v;
|
|
428
429
|
if (!e) return null;
|
|
429
|
-
const a = new Map(r.map((p) => [String(p.id).toUpperCase(), p.sort])),
|
|
430
|
+
const a = new Map(r.map((p) => [String(p.id).toUpperCase(), p.sort])), i = [...t].sort(
|
|
430
431
|
(p, _) => new Date(_.timestamp).getTime() - new Date(p.timestamp).getTime()
|
|
431
432
|
)[0];
|
|
432
|
-
if (!(
|
|
433
|
-
const
|
|
434
|
-
return
|
|
433
|
+
if (!(i != null && i.from_state) || String(i.to_state).toUpperCase() !== String(e).toUpperCase() || !((v = i.comment) != null && v.trim()) || i.origin && i.origin !== "person") return null;
|
|
434
|
+
const d = a.get(String(i.from_state).toUpperCase()), y = a.get(String(i.to_state).toUpperCase());
|
|
435
|
+
return d == null || y == null || y >= d ? null : i;
|
|
435
436
|
}
|
|
436
|
-
function
|
|
437
|
+
function Ne({ className: t }) {
|
|
437
438
|
return /* @__PURE__ */ n(
|
|
438
439
|
tn,
|
|
439
440
|
{
|
|
440
441
|
"aria-hidden": !0,
|
|
441
442
|
"data-move-blocked-mark": !0,
|
|
442
|
-
className:
|
|
443
|
+
className: ce("h-3 w-3 shrink-0 text-amber-600 dark:text-amber-400", t)
|
|
443
444
|
}
|
|
444
445
|
);
|
|
445
446
|
}
|
|
@@ -456,20 +457,20 @@ function Mt({
|
|
|
456
457
|
nameOf: e
|
|
457
458
|
}) {
|
|
458
459
|
const r = Mn(t);
|
|
459
|
-
return r.map(({ advisory: a, moves:
|
|
460
|
+
return r.map(({ advisory: a, moves: i }) => /* @__PURE__ */ s(mr, { children: [
|
|
460
461
|
/* @__PURE__ */ n(kt, {}),
|
|
461
|
-
/* @__PURE__ */
|
|
462
|
+
/* @__PURE__ */ s(
|
|
462
463
|
"div",
|
|
463
464
|
{
|
|
464
465
|
"data-move-blocked-note": a.code,
|
|
465
466
|
className: "flex max-w-[280px] items-start gap-2 px-2 py-1.5 text-[11px] leading-snug text-slate-600 dark:text-slate-300",
|
|
466
467
|
children: [
|
|
467
|
-
/* @__PURE__ */ n(
|
|
468
|
-
/* @__PURE__ */
|
|
468
|
+
/* @__PURE__ */ n(Ne, { className: "mt-0.5" }),
|
|
469
|
+
/* @__PURE__ */ s("span", { className: "min-w-0", children: [
|
|
469
470
|
a.message,
|
|
470
|
-
r.length > 1 && /* @__PURE__ */
|
|
471
|
+
r.length > 1 && /* @__PURE__ */ s("span", { className: "mt-0.5 block text-amber-800/80 dark:text-amber-300/80", children: [
|
|
471
472
|
"Stops: ",
|
|
472
|
-
[...new Set(
|
|
473
|
+
[...new Set(i.map(e))].join(", ")
|
|
473
474
|
] })
|
|
474
475
|
] })
|
|
475
476
|
]
|
|
@@ -479,28 +480,28 @@ function Mt({
|
|
|
479
480
|
}
|
|
480
481
|
function Yn(t, e, r) {
|
|
481
482
|
const a = String(t.comment_mode ?? "none");
|
|
482
|
-
return a === "optional" || a === "required" ||
|
|
483
|
+
return a === "optional" || a === "required" || At(t, e, r);
|
|
483
484
|
}
|
|
484
|
-
function
|
|
485
|
+
function ra({ entry: t }) {
|
|
485
486
|
const e = [t.first_name, t.last_name].filter(Boolean).join(" ") || t.user_email || "Someone";
|
|
486
|
-
return /* @__PURE__ */
|
|
487
|
+
return /* @__PURE__ */ s(
|
|
487
488
|
"div",
|
|
488
489
|
{
|
|
489
490
|
className: "flex items-start gap-2.5 border-t border-amber-200/80 bg-amber-50/70 px-4 py-2.5 dark:border-amber-500/20 dark:bg-amber-500/[0.06]",
|
|
490
491
|
"data-send-back-notice": !0,
|
|
491
492
|
children: [
|
|
492
493
|
/* @__PURE__ */ n(
|
|
493
|
-
|
|
494
|
+
ir,
|
|
494
495
|
{
|
|
495
496
|
"aria-hidden": !0,
|
|
496
497
|
className: "mt-[3px] h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-400"
|
|
497
498
|
}
|
|
498
499
|
),
|
|
499
|
-
/* @__PURE__ */
|
|
500
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
500
501
|
/* @__PURE__ */ n("p", { className: "whitespace-pre-line break-words text-[13px] leading-snug text-slate-800 dark:text-slate-100", children: t.comment }),
|
|
501
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ s("p", { className: "mt-0.5 text-[11.5px] text-amber-800/80 dark:text-amber-300/80", children: [
|
|
502
503
|
"Sent back by ",
|
|
503
|
-
|
|
504
|
+
Ft(e, t),
|
|
504
505
|
" · ",
|
|
505
506
|
Rt(t.timestamp)
|
|
506
507
|
] })
|
|
@@ -514,30 +515,30 @@ function Jn({
|
|
|
514
515
|
item: e,
|
|
515
516
|
offer: r,
|
|
516
517
|
onFixed: a,
|
|
517
|
-
onDismiss:
|
|
518
|
-
className:
|
|
519
|
-
style:
|
|
518
|
+
onDismiss: i,
|
|
519
|
+
className: d,
|
|
520
|
+
style: y
|
|
520
521
|
}) {
|
|
521
|
-
const [
|
|
522
|
-
mutationFn: () => k(
|
|
522
|
+
const [v, p] = G(""), { action: _, isLoading: b, run: k } = Dr(t, e, r.actionKey), S = Ge({
|
|
523
|
+
mutationFn: () => k(v),
|
|
523
524
|
onSuccess: () => {
|
|
524
|
-
|
|
525
|
+
z.success(`${(_ == null ? void 0 : _.label) ?? "Done"} — trying again`), a();
|
|
525
526
|
},
|
|
526
527
|
onError: (C) => fr(C, `${(_ == null ? void 0 : _.label) ?? "The fix"} failed`)
|
|
527
528
|
});
|
|
528
|
-
if (
|
|
529
|
-
const
|
|
530
|
-
return /* @__PURE__ */
|
|
529
|
+
if (b || !_) return null;
|
|
530
|
+
const F = !S.isPending && (!_.require_reason || v.trim().length > 0);
|
|
531
|
+
return /* @__PURE__ */ s(
|
|
531
532
|
"div",
|
|
532
533
|
{
|
|
533
|
-
className:
|
|
534
|
+
className: ce(
|
|
534
535
|
"space-y-2 rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-500/30 dark:bg-amber-950",
|
|
535
|
-
|
|
536
|
+
d
|
|
536
537
|
),
|
|
537
|
-
style:
|
|
538
|
+
style: y,
|
|
538
539
|
"data-refusal-fix": r.code,
|
|
539
540
|
children: [
|
|
540
|
-
/* @__PURE__ */
|
|
541
|
+
/* @__PURE__ */ s("p", { className: "text-[12px] text-amber-950 dark:text-amber-100", children: [
|
|
541
542
|
"You can fix this here: ",
|
|
542
543
|
_.label,
|
|
543
544
|
", then the move is tried again."
|
|
@@ -546,35 +547,35 @@ function Jn({
|
|
|
546
547
|
"input",
|
|
547
548
|
{
|
|
548
549
|
type: "text",
|
|
549
|
-
value:
|
|
550
|
+
value: v,
|
|
550
551
|
onChange: (C) => p(C.target.value),
|
|
551
552
|
placeholder: "Reason (required)",
|
|
552
553
|
"aria-label": "Reason",
|
|
553
554
|
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"
|
|
554
555
|
}
|
|
555
556
|
),
|
|
556
|
-
/* @__PURE__ */
|
|
557
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-2", children: [
|
|
557
558
|
/* @__PURE__ */ n(
|
|
558
|
-
|
|
559
|
+
fe,
|
|
559
560
|
{
|
|
560
561
|
type: "button",
|
|
561
562
|
size: "sm",
|
|
562
563
|
variant: "ghost",
|
|
563
564
|
className: "h-7 text-[12px]",
|
|
564
|
-
onClick:
|
|
565
|
+
onClick: i,
|
|
565
566
|
children: "Not now"
|
|
566
567
|
}
|
|
567
568
|
),
|
|
568
|
-
/* @__PURE__ */
|
|
569
|
-
|
|
569
|
+
/* @__PURE__ */ s(
|
|
570
|
+
fe,
|
|
570
571
|
{
|
|
571
572
|
type: "button",
|
|
572
573
|
size: "sm",
|
|
573
574
|
className: "h-7 gap-1.5 text-[12px]",
|
|
574
|
-
disabled: !
|
|
575
|
-
onClick: () =>
|
|
575
|
+
disabled: !F,
|
|
576
|
+
onClick: () => S.mutate(),
|
|
576
577
|
children: [
|
|
577
|
-
|
|
578
|
+
S.isPending && /* @__PURE__ */ n(Se, { className: "h-3 w-3 animate-spin" }),
|
|
578
579
|
_.label,
|
|
579
580
|
", then try again"
|
|
580
581
|
]
|
|
@@ -608,71 +609,71 @@ function vt(t) {
|
|
|
608
609
|
const e = Math.floor(t / 6e4);
|
|
609
610
|
return e < 60 ? `${Math.max(1, e)}m` : wr(t / 36e5);
|
|
610
611
|
}
|
|
611
|
-
function
|
|
612
|
+
function aa({
|
|
612
613
|
history: t,
|
|
613
614
|
completedAt: e,
|
|
614
615
|
collection: r,
|
|
615
616
|
item: a
|
|
616
617
|
}) {
|
|
617
|
-
const
|
|
618
|
+
const i = Pn(
|
|
618
619
|
r ?? "",
|
|
619
620
|
a ?? "",
|
|
620
621
|
Zn(t, e),
|
|
621
622
|
!!r && !!a && t.length > 1
|
|
622
|
-
),
|
|
623
|
-
(
|
|
623
|
+
), d = [...t].sort(
|
|
624
|
+
(b, k) => new Date(b.timestamp).getTime() - new Date(k.timestamp).getTime()
|
|
624
625
|
);
|
|
625
|
-
if (
|
|
626
|
-
const
|
|
627
|
-
const
|
|
626
|
+
if (d.length === 0) return null;
|
|
627
|
+
const y = e ? new Date(e).getTime() : Date.now(), v = d.map((b, k) => {
|
|
628
|
+
const S = new Date(b.timestamp).getTime(), F = k + 1 < d.length ? new Date(d[k + 1].timestamp).getTime() : y;
|
|
628
629
|
return {
|
|
629
|
-
key:
|
|
630
|
-
label:
|
|
631
|
-
color:
|
|
632
|
-
ms: Math.max(0,
|
|
633
|
-
current: k ===
|
|
634
|
-
timing: (
|
|
630
|
+
key: b.id,
|
|
631
|
+
label: b.to_state_label,
|
|
632
|
+
color: b.to_state_color,
|
|
633
|
+
ms: Math.max(0, F - S),
|
|
634
|
+
current: k === d.length - 1 && !e,
|
|
635
|
+
timing: (i == null ? void 0 : i.get(Number(b.id))) ?? null
|
|
635
636
|
};
|
|
636
|
-
}).filter((
|
|
637
|
-
if (
|
|
638
|
-
const p =
|
|
637
|
+
}).filter((b) => b.ms > 0 || b.current);
|
|
638
|
+
if (v.length < 2) return null;
|
|
639
|
+
const p = v.reduce((b, k) => b + k.ms, 0);
|
|
639
640
|
if (p <= 0) return null;
|
|
640
|
-
const _ =
|
|
641
|
-
return /* @__PURE__ */
|
|
642
|
-
/* @__PURE__ */
|
|
641
|
+
const _ = v.some((b) => b.timing);
|
|
642
|
+
return /* @__PURE__ */ s("div", { "data-state-timeline": !0, "data-step-timing": _ ? "split" : void 0, children: [
|
|
643
|
+
/* @__PURE__ */ s("div", { className: "mb-1 flex items-center justify-between gap-3", children: [
|
|
643
644
|
/* @__PURE__ */ n("p", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400 dark:text-slate-500", children: "Time in step" }),
|
|
644
|
-
/* @__PURE__ */
|
|
645
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-3 text-[10px] tabular-nums text-slate-400 dark:text-slate-500", children: [
|
|
645
646
|
_ && /* @__PURE__ */ n(Ir, {}),
|
|
646
|
-
/* @__PURE__ */
|
|
647
|
+
/* @__PURE__ */ s("span", { children: [
|
|
647
648
|
vt(p),
|
|
648
649
|
" total",
|
|
649
650
|
e ? "" : " · so far"
|
|
650
651
|
] })
|
|
651
652
|
] })
|
|
652
653
|
] }),
|
|
653
|
-
/* @__PURE__ */ n("div", { className: "flex h-4 w-full overflow-hidden rounded", children:
|
|
654
|
-
const k =
|
|
655
|
-
`${
|
|
656
|
-
|
|
657
|
-
|
|
654
|
+
/* @__PURE__ */ n("div", { className: "flex h-4 w-full overflow-hidden rounded", children: v.map((b) => {
|
|
655
|
+
const k = b.ms / p * 100, S = b.timing, F = S ? S.waiting_ms + S.working_ms : 0, C = S && F > 0 ? S.waiting_ms / F * 100 : 0, oe = [
|
|
656
|
+
`${b.label} — ${vt(b.ms)}${b.current ? " (current)" : ""}`,
|
|
657
|
+
S ? Rn(S) : null,
|
|
658
|
+
S ? Fn(S) : null
|
|
658
659
|
].filter(Boolean).join(" · ");
|
|
659
|
-
return /* @__PURE__ */
|
|
660
|
+
return /* @__PURE__ */ s(
|
|
660
661
|
"div",
|
|
661
662
|
{
|
|
662
|
-
"data-tip":
|
|
663
|
-
"data-step-visit":
|
|
663
|
+
"data-tip": oe,
|
|
664
|
+
"data-step-visit": b.key,
|
|
664
665
|
className: "relative flex min-w-[8px] items-center overflow-hidden border-r border-white/60 last:border-r-0 dark:border-black/30",
|
|
665
666
|
style: {
|
|
666
667
|
width: `${k}%`,
|
|
667
|
-
backgroundColor:
|
|
668
|
+
backgroundColor: S ? void 0 : b.color ? `${b.color}55` : "rgba(100,116,139,.25)"
|
|
668
669
|
},
|
|
669
670
|
children: [
|
|
670
|
-
|
|
671
|
+
S && /* @__PURE__ */ s("span", { className: "absolute inset-0 flex", "aria-hidden": !0, children: [
|
|
671
672
|
/* @__PURE__ */ n(
|
|
672
673
|
"span",
|
|
673
674
|
{
|
|
674
675
|
className: "h-full",
|
|
675
|
-
style: { width: `${C}%`, background:
|
|
676
|
+
style: { width: `${C}%`, background: Ur(b.color) },
|
|
676
677
|
"data-step-waiting": !0
|
|
677
678
|
}
|
|
678
679
|
),
|
|
@@ -680,149 +681,149 @@ function na({
|
|
|
680
681
|
"span",
|
|
681
682
|
{
|
|
682
683
|
className: "h-full flex-1",
|
|
683
|
-
style: { background:
|
|
684
|
+
style: { background: Lr(b.color) },
|
|
684
685
|
"data-step-working": !0
|
|
685
686
|
}
|
|
686
687
|
)
|
|
687
688
|
] }),
|
|
688
|
-
k >= 14 && /* @__PURE__ */
|
|
689
|
-
|
|
689
|
+
k >= 14 && /* @__PURE__ */ s("span", { className: "relative truncate px-1.5 text-[9.5px] font-medium leading-none text-slate-700 dark:text-slate-200", children: [
|
|
690
|
+
b.label,
|
|
690
691
|
" · ",
|
|
691
|
-
vt(
|
|
692
|
+
vt(b.ms)
|
|
692
693
|
] }),
|
|
693
|
-
|
|
694
|
+
b.current && /* @__PURE__ */ n(
|
|
694
695
|
"span",
|
|
695
696
|
{
|
|
696
697
|
className: "absolute inset-y-0 right-0 w-[2px]",
|
|
697
|
-
style: { backgroundColor:
|
|
698
|
+
style: { backgroundColor: b.color ?? "#64748b" }
|
|
698
699
|
}
|
|
699
700
|
)
|
|
700
701
|
]
|
|
701
702
|
},
|
|
702
|
-
|
|
703
|
+
b.key
|
|
703
704
|
);
|
|
704
705
|
}) })
|
|
705
706
|
] });
|
|
706
707
|
}
|
|
707
708
|
function Zn(t, e) {
|
|
708
|
-
return `${t.reduce((a,
|
|
709
|
+
return `${t.reduce((a, i) => Math.max(a, Number(i.id) || 0), 0)}:${t.length}:${e ?? ""}`;
|
|
709
710
|
}
|
|
710
|
-
function
|
|
711
|
+
function sa({
|
|
711
712
|
states: t,
|
|
712
713
|
allTransitions: e,
|
|
713
714
|
availableTransitions: r,
|
|
714
715
|
currentStateId: a,
|
|
715
|
-
history:
|
|
716
|
-
onPathIds:
|
|
717
|
-
skippedStates:
|
|
716
|
+
history: i,
|
|
717
|
+
onPathIds: d,
|
|
718
|
+
skippedStates: y
|
|
718
719
|
}) {
|
|
719
|
-
var
|
|
720
|
-
const
|
|
720
|
+
var ee;
|
|
721
|
+
const v = xe(null);
|
|
721
722
|
Be(() => {
|
|
722
|
-
const g =
|
|
723
|
+
const g = v.current;
|
|
723
724
|
if (!g || g.scrollWidth <= g.clientWidth) return;
|
|
724
|
-
const
|
|
725
|
-
if (!
|
|
726
|
-
const
|
|
727
|
-
g.scrollLeft +=
|
|
725
|
+
const x = g.querySelector("[data-track-current]");
|
|
726
|
+
if (!x) return;
|
|
727
|
+
const P = g.getBoundingClientRect(), M = x.getBoundingClientRect();
|
|
728
|
+
g.scrollLeft += M.left + M.width / 2 - (P.left + P.width / 2);
|
|
728
729
|
}, [a]);
|
|
729
|
-
const p = new Set(
|
|
730
|
+
const p = new Set(i.map((g) => g.to_state)), _ = t.find((g) => g.is_initial);
|
|
730
731
|
_ && _.id !== a && p.add(_.id);
|
|
731
|
-
const
|
|
732
|
-
|
|
732
|
+
const b = (ee = i[0]) == null ? void 0 : ee.from_state;
|
|
733
|
+
b && b !== a && p.add(b);
|
|
733
734
|
const k = (() => {
|
|
734
|
-
if (
|
|
735
|
-
return t.filter((
|
|
736
|
-
const R =
|
|
737
|
-
return R === "hide" ? !1 : R === "hide_unless_active" ? p.has(
|
|
738
|
-
}).sort((
|
|
735
|
+
if (d)
|
|
736
|
+
return t.filter((w) => d.has(w.id) || p.has(w.id) || w.id === a).filter((w) => {
|
|
737
|
+
const R = w.stage_visibility ?? "always";
|
|
738
|
+
return R === "hide" ? !1 : R === "hide_unless_active" ? p.has(w.id) || w.id === a : !0;
|
|
739
|
+
}).sort((w, R) => w.sort - R.sort);
|
|
739
740
|
if (e.length === 0) {
|
|
740
|
-
const
|
|
741
|
-
return a &&
|
|
741
|
+
const w = /* @__PURE__ */ new Set([...p]);
|
|
742
|
+
return a && w.add(a), t.filter((R) => w.has(R.id)).sort((R, u) => R.sort - u.sort);
|
|
742
743
|
}
|
|
743
744
|
const g = new Set(
|
|
744
|
-
|
|
745
|
-
),
|
|
746
|
-
for (const
|
|
747
|
-
const R =
|
|
748
|
-
if (
|
|
749
|
-
const u =
|
|
750
|
-
u.push(
|
|
745
|
+
i.filter((w) => w.from_state).map((w) => `${w.from_state}:${w.to_state}`)
|
|
746
|
+
), x = new Set(i.map((w) => w.from_state).filter(Boolean)), P = e.filter((w) => w.from_state !== null), M = /* @__PURE__ */ new Map();
|
|
747
|
+
for (const w of P) {
|
|
748
|
+
const R = w.from_state;
|
|
749
|
+
if (x.has(R) && !g.has(`${R}:${w.to_state}`)) continue;
|
|
750
|
+
const u = M.get(R) ?? [];
|
|
751
|
+
u.push(w.to_state), M.set(R, u);
|
|
751
752
|
}
|
|
752
753
|
if (a) {
|
|
753
|
-
const
|
|
754
|
-
|
|
755
|
-
.../* @__PURE__ */ new Set([...r.map((R) => R.to_state), ...
|
|
754
|
+
const w = P.filter((R) => R.from_state === a).map((R) => R.to_state);
|
|
755
|
+
M.set(a, [
|
|
756
|
+
.../* @__PURE__ */ new Set([...r.map((R) => R.to_state), ...w])
|
|
756
757
|
]);
|
|
757
758
|
}
|
|
758
|
-
const
|
|
759
|
-
for (;
|
|
760
|
-
const
|
|
761
|
-
if (!
|
|
762
|
-
|
|
763
|
-
for (const R of
|
|
759
|
+
const T = /* @__PURE__ */ new Set(), Q = t.filter((w) => w.is_initial).map((w) => w.id);
|
|
760
|
+
for (; Q.length; ) {
|
|
761
|
+
const w = Q.shift();
|
|
762
|
+
if (!T.has(w)) {
|
|
763
|
+
T.add(w);
|
|
764
|
+
for (const R of M.get(w) ?? []) T.has(R) || Q.push(R);
|
|
764
765
|
}
|
|
765
766
|
}
|
|
766
|
-
const
|
|
767
|
-
return a &&
|
|
768
|
-
const R =
|
|
769
|
-
return R === "hide" ? !1 : R === "hide_unless_active" ? p.has(
|
|
770
|
-
}).sort((
|
|
767
|
+
const I = /* @__PURE__ */ new Set([...T, ...p]);
|
|
768
|
+
return a && I.add(a), t.filter((w) => I.has(w.id)).filter((w) => {
|
|
769
|
+
const R = w.stage_visibility ?? "always";
|
|
770
|
+
return R === "hide" ? !1 : R === "hide_unless_active" ? p.has(w.id) || w.id === a : !0;
|
|
771
|
+
}).sort((w, R) => w.sort - R.sort);
|
|
771
772
|
})();
|
|
772
773
|
if (k.length < 2) return null;
|
|
773
|
-
const
|
|
774
|
-
function
|
|
775
|
-
const
|
|
776
|
-
return
|
|
777
|
-
if (!
|
|
778
|
-
const
|
|
779
|
-
return
|
|
780
|
-
}).sort((
|
|
774
|
+
const S = k.findIndex((g) => g.id === a), F = new Map(k.map((g, x) => [g.id, x])), C = new Map(t.map((g) => [g.id, g.label]));
|
|
775
|
+
function oe(g, x) {
|
|
776
|
+
const P = F.get(g);
|
|
777
|
+
return P == null ? [] : [...i].filter((M) => {
|
|
778
|
+
if (!M.from_state) return !1;
|
|
779
|
+
const T = F.get(M.from_state), Q = F.get(M.to_state);
|
|
780
|
+
return T == null || Q == null ? !1 : T === P && Q > P || Q < T && T - 1 === P;
|
|
781
|
+
}).sort((M, T) => new Date(M.timestamp).getTime() - new Date(T.timestamp).getTime());
|
|
781
782
|
}
|
|
782
783
|
function le(g) {
|
|
783
|
-
var
|
|
784
|
-
return
|
|
784
|
+
var x, P, M, T;
|
|
785
|
+
return st(g) ? /* @__PURE__ */ n(an, { className: "inline h-2.5 w-2.5", "aria-label": $t(g) }) : ((((x = g.first_name) == null ? void 0 : x[0]) ?? "") + (((P = g.last_name) == null ? void 0 : P[0]) ?? "")).toUpperCase() || ((T = (M = g.user_email) == null ? void 0 : M[0]) == null ? void 0 : T.toUpperCase()) || "?";
|
|
785
786
|
}
|
|
786
|
-
function
|
|
787
|
-
return
|
|
787
|
+
function be(g) {
|
|
788
|
+
return Ft([g.first_name, g.last_name].filter(Boolean).join(" ") || g.user_email, g);
|
|
788
789
|
}
|
|
789
|
-
const
|
|
790
|
-
for (const g of [...
|
|
791
|
-
(
|
|
790
|
+
const ne = /* @__PURE__ */ new Map();
|
|
791
|
+
for (const g of [...i].sort(
|
|
792
|
+
(x, P) => new Date(x.timestamp).getTime() - new Date(P.timestamp).getTime()
|
|
792
793
|
)) {
|
|
793
794
|
if (!g.from_state) continue;
|
|
794
|
-
const
|
|
795
|
-
if (!(
|
|
796
|
-
for (let
|
|
797
|
-
const
|
|
798
|
-
!p.has(
|
|
795
|
+
const x = F.get(g.from_state), P = F.get(g.to_state);
|
|
796
|
+
if (!(x == null || P == null || P <= x + 1))
|
|
797
|
+
for (let M = x + 1; M < P; M++) {
|
|
798
|
+
const T = k[M].id;
|
|
799
|
+
!p.has(T) && !ne.has(T) && ne.set(T, g);
|
|
799
800
|
}
|
|
800
801
|
}
|
|
801
|
-
function
|
|
802
|
-
const
|
|
803
|
-
return `Passed over on ${zt(g.timestamp)} — ${
|
|
802
|
+
function ue(g) {
|
|
803
|
+
const x = C.get(g.from_state ?? "") ?? "the previous step", P = C.get(g.to_state) ?? "the next step", M = st(g) ? "it moved automatically" : `${be(g)} moved it`;
|
|
804
|
+
return `Passed over on ${zt(g.timestamp)} — ${M} straight from ${x} to ${P}`;
|
|
804
805
|
}
|
|
805
|
-
return /* @__PURE__ */ n(bn, { delayDuration: 200, children: /* @__PURE__ */ n("div", { ref:
|
|
806
|
-
const
|
|
807
|
-
return /* @__PURE__ */
|
|
808
|
-
/* @__PURE__ */
|
|
806
|
+
return /* @__PURE__ */ n(bn, { delayDuration: 200, children: /* @__PURE__ */ n("div", { ref: v, className: "overflow-x-auto pt-1.5 pb-1", "data-state-track": !0, children: /* @__PURE__ */ n("div", { className: "flex w-full items-start", children: k.map((g, x) => {
|
|
807
|
+
const P = g.id === a, M = p.has(g.id), T = M && !P && (S < 0 || x < S), Q = M && !P && !T, I = !M && !P ? ne.get(g.id) : void 0, w = !M && !P ? y == null ? void 0 : y.get(g.id) : void 0, R = I || w ? [...I ? [ue(I)] : [], ...w ?? []] : void 0, u = R !== void 0, he = g.color ?? "#94a3b8", re = x === k.length - 1, de = re ? null : k[x + 1], L = de ? oe(g.id, de.id) : [];
|
|
808
|
+
return /* @__PURE__ */ s("div", { className: "flex flex-1 items-start", children: [
|
|
809
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-[76px] flex-1 flex-col items-center gap-1.5 px-1", children: [
|
|
809
810
|
/* @__PURE__ */ n(
|
|
810
811
|
"div",
|
|
811
812
|
{
|
|
812
|
-
"data-track-current":
|
|
813
|
-
className: `flex h-7 w-7 shrink-0 items-center justify-center rounded-full ${
|
|
814
|
-
"data-tip":
|
|
815
|
-
"data-track-again":
|
|
813
|
+
"data-track-current": P || void 0,
|
|
814
|
+
className: `flex h-7 w-7 shrink-0 items-center justify-center rounded-full ${P || T ? "nvr-fill-sweep" : ""}`,
|
|
815
|
+
"data-tip": Q ? `Passed before the record was sent back — it needs this step again.${g.description ? ` ${g.description}` : ""}` : g.description || void 0,
|
|
816
|
+
"data-track-again": Q || void 0,
|
|
816
817
|
style: {
|
|
817
|
-
backgroundColor:
|
|
818
|
-
border:
|
|
819
|
-
boxShadow:
|
|
818
|
+
backgroundColor: P || T ? he : u ? "transparent" : "#f1f5f9",
|
|
819
|
+
border: P || T ? "none" : u ? "1.5px dashed #cbd5e1" : "1.5px solid #e2e8f0",
|
|
820
|
+
boxShadow: P ? `0 0 0 3px white, 0 0 0 5px ${he}` : void 0
|
|
820
821
|
},
|
|
821
|
-
children:
|
|
822
|
+
children: T ? /* @__PURE__ */ n(Pt, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : P ? /* @__PURE__ */ n("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : u ? /* @__PURE__ */ n(or, { className: "h-3 w-3 text-slate-400", strokeWidth: 2.5 }) : /* @__PURE__ */ n("div", { className: "h-2 w-2 rounded-full bg-slate-300" })
|
|
822
823
|
},
|
|
823
|
-
|
|
824
|
+
P ? "cur" : T ? "done" : u ? "skip" : "todo"
|
|
824
825
|
),
|
|
825
|
-
u ? /* @__PURE__ */
|
|
826
|
+
u ? /* @__PURE__ */ s(_t, { children: [
|
|
826
827
|
/* @__PURE__ */ n(Nt, { asChild: !0, children: /* @__PURE__ */ n(
|
|
827
828
|
"span",
|
|
828
829
|
{
|
|
@@ -838,36 +839,36 @@ function ra({
|
|
|
838
839
|
children: g.label
|
|
839
840
|
}
|
|
840
841
|
) }),
|
|
841
|
-
/* @__PURE__ */
|
|
842
|
+
/* @__PURE__ */ s(St, { className: "max-w-[260px]", children: [
|
|
842
843
|
/* @__PURE__ */ n("p", { className: "text-[11px] font-medium", children: "Skipped for this record" }),
|
|
843
|
-
R.length > 0 ? /* @__PURE__ */ n("ul", { className: "mt-1 space-y-0.5 text-[11px] opacity-90", children: R.map((
|
|
844
|
+
R.length > 0 ? /* @__PURE__ */ n("ul", { className: "mt-1 space-y-0.5 text-[11px] opacity-90", children: R.map((U) => /* @__PURE__ */ n("li", { children: U }, U)) }) : /* @__PURE__ */ n("p", { className: "mt-1 text-[11px] opacity-90", children: "Its skip conditions are met." })
|
|
844
845
|
] })
|
|
845
846
|
] }) : /* @__PURE__ */ n(
|
|
846
847
|
"span",
|
|
847
848
|
{
|
|
848
|
-
className:
|
|
849
|
+
className: ce(
|
|
849
850
|
"w-full break-words text-center leading-snug",
|
|
850
|
-
!
|
|
851
|
+
!P && !T && "text-slate-500 dark:text-slate-400"
|
|
851
852
|
),
|
|
852
853
|
style: {
|
|
853
854
|
fontSize: "11px",
|
|
854
|
-
color:
|
|
855
|
-
fontWeight:
|
|
855
|
+
color: P ? he : T ? "#475569" : void 0,
|
|
856
|
+
fontWeight: P ? 600 : T ? 500 : 400,
|
|
856
857
|
wordBreak: "break-word"
|
|
857
858
|
},
|
|
858
859
|
children: g.label
|
|
859
860
|
}
|
|
860
861
|
)
|
|
861
862
|
] }),
|
|
862
|
-
!
|
|
863
|
+
!re && /* @__PURE__ */ s("div", { className: "mt-[13px] flex w-10 shrink-0 flex-col items-center gap-1.5", children: [
|
|
863
864
|
(() => {
|
|
864
|
-
const
|
|
865
|
-
return /* @__PURE__ */
|
|
865
|
+
const U = T ? `${he}55` : "#e8ecf0";
|
|
866
|
+
return /* @__PURE__ */ s("div", { className: "flex w-full shrink-0 items-center", children: [
|
|
866
867
|
/* @__PURE__ */ n(
|
|
867
868
|
"div",
|
|
868
869
|
{
|
|
869
870
|
className: "h-0.5 flex-1 rounded-l-sm",
|
|
870
|
-
style: { backgroundColor:
|
|
871
|
+
style: { backgroundColor: U }
|
|
871
872
|
}
|
|
872
873
|
),
|
|
873
874
|
/* @__PURE__ */ n(
|
|
@@ -878,115 +879,115 @@ function ra({
|
|
|
878
879
|
height: 0,
|
|
879
880
|
borderTop: "3px solid transparent",
|
|
880
881
|
borderBottom: "3px solid transparent",
|
|
881
|
-
borderLeft: `5px solid ${
|
|
882
|
+
borderLeft: `5px solid ${U}`
|
|
882
883
|
}
|
|
883
884
|
}
|
|
884
885
|
)
|
|
885
886
|
] });
|
|
886
887
|
})(),
|
|
887
|
-
|
|
888
|
-
const
|
|
889
|
-
(
|
|
890
|
-
) > 1 ? C.get(
|
|
891
|
-
return /* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */ n(Nt, { asChild: !0, children: /* @__PURE__ */
|
|
893
|
-
/* @__PURE__ */
|
|
888
|
+
L.map((U) => {
|
|
889
|
+
const ve = U.from_state !== g.id, W = Math.abs(
|
|
890
|
+
(F.get(U.to_state) ?? 0) - (F.get(U.from_state ?? "") ?? 0)
|
|
891
|
+
) > 1 ? C.get(U.to_state) ?? "" : null;
|
|
892
|
+
return /* @__PURE__ */ s(_t, { children: [
|
|
893
|
+
/* @__PURE__ */ n(Nt, { asChild: !0, children: /* @__PURE__ */ s("div", { className: "flex w-full cursor-default flex-col items-center gap-0.5", children: [
|
|
894
|
+
/* @__PURE__ */ s(
|
|
894
895
|
"span",
|
|
895
896
|
{
|
|
896
897
|
className: "text-center font-mono text-[9px] font-semibold leading-none",
|
|
897
|
-
style: { color:
|
|
898
|
+
style: { color: ve ? "#d97706" : "#475569" },
|
|
898
899
|
children: [
|
|
899
|
-
|
|
900
|
-
le(
|
|
900
|
+
ve && "↩ ",
|
|
901
|
+
le(U)
|
|
901
902
|
]
|
|
902
903
|
}
|
|
903
904
|
),
|
|
904
|
-
/* @__PURE__ */ n("span", { className: "text-[8.5px] leading-none text-slate-400", children: Rt(
|
|
905
|
+
/* @__PURE__ */ n("span", { className: "text-[8.5px] leading-none text-slate-400", children: Rt(U.timestamp) })
|
|
905
906
|
] }) }),
|
|
906
|
-
/* @__PURE__ */
|
|
907
|
-
|
|
908
|
-
/* @__PURE__ */
|
|
909
|
-
|
|
910
|
-
|
|
907
|
+
/* @__PURE__ */ s(St, { side: "top", className: "space-y-0.5 text-[12px]", children: [
|
|
908
|
+
st(U) ? /* @__PURE__ */ s(Ce, { children: [
|
|
909
|
+
/* @__PURE__ */ s("p", { className: "font-medium", children: [
|
|
910
|
+
ve ? "↩ Sent back · " : "",
|
|
911
|
+
$t(U)
|
|
911
912
|
] }),
|
|
912
|
-
Tt(
|
|
913
|
-
] }) : /* @__PURE__ */
|
|
914
|
-
|
|
913
|
+
Tt(U) && /* @__PURE__ */ n("p", { className: "max-w-[280px] text-muted-foreground", children: Tt(U) })
|
|
914
|
+
] }) : /* @__PURE__ */ s("p", { className: "font-medium", children: [
|
|
915
|
+
ve ? "↩ Sent back by" : "Approved by",
|
|
915
916
|
" ",
|
|
916
|
-
|
|
917
|
+
be(U)
|
|
917
918
|
] }),
|
|
918
|
-
|
|
919
|
+
W && /* @__PURE__ */ s("p", { className: "text-muted-foreground", children: [
|
|
919
920
|
"→ straight to ",
|
|
920
|
-
|
|
921
|
+
W
|
|
921
922
|
] }),
|
|
922
|
-
/* @__PURE__ */ n("p", { className: "text-muted-foreground", children: zt(
|
|
923
|
+
/* @__PURE__ */ n("p", { className: "text-muted-foreground", children: zt(U.timestamp) })
|
|
923
924
|
] })
|
|
924
|
-
] },
|
|
925
|
+
] }, U.id);
|
|
925
926
|
})
|
|
926
927
|
] })
|
|
927
928
|
] }, g.id);
|
|
928
929
|
}) }) }) });
|
|
929
930
|
}
|
|
930
|
-
function
|
|
931
|
+
function ia({
|
|
931
932
|
history: t,
|
|
932
933
|
collection: e,
|
|
933
934
|
item: r,
|
|
934
935
|
completedAt: a = null
|
|
935
936
|
}) {
|
|
936
|
-
const
|
|
937
|
+
const i = Pn(
|
|
937
938
|
e ?? "",
|
|
938
939
|
r ?? "",
|
|
939
940
|
Zn(t, a),
|
|
940
941
|
!!e && !!r && t.length > 0
|
|
941
942
|
);
|
|
942
|
-
return t.length === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400 italic", children: "No transitions yet." }) : /* @__PURE__ */ n("div", { className: "space-y-3", children: t.map((
|
|
943
|
-
var
|
|
944
|
-
const
|
|
945
|
-
return /* @__PURE__ */
|
|
943
|
+
return t.length === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400 italic", children: "No transitions yet." }) : /* @__PURE__ */ n("div", { className: "space-y-3", children: t.map((d) => {
|
|
944
|
+
var S;
|
|
945
|
+
const y = st(d), v = y ? $t(d) : Ft([d.first_name, d.last_name].filter(Boolean).join(" ") || d.user_email, d), p = Wr(d), _ = d.comment && !y && !p ? d.comment : null, b = p ?? (y ? Tt(d) : null), k = (i == null ? void 0 : i.get(Number(d.id))) ?? null;
|
|
946
|
+
return /* @__PURE__ */ s("div", { className: "flex items-start gap-2.5 text-[12px]", children: [
|
|
946
947
|
/* @__PURE__ */ n("div", { className: "mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-slate-200" }),
|
|
947
|
-
/* @__PURE__ */
|
|
948
|
-
/* @__PURE__ */
|
|
949
|
-
|
|
948
|
+
/* @__PURE__ */ s("div", { className: "flex-1 min-w-0", children: [
|
|
949
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
950
|
+
d.from_state_label ? /* @__PURE__ */ n(Oe, { label: d.from_state_label, color: d.from_state_color, small: !0 }) : /* @__PURE__ */ n("span", { className: "text-[11px] text-slate-400 italic", children: "started" }),
|
|
950
951
|
/* @__PURE__ */ n(qt, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
951
|
-
/* @__PURE__ */ n(Oe, { label:
|
|
952
|
+
/* @__PURE__ */ n(Oe, { label: d.to_state_label, color: d.to_state_color, small: !0 })
|
|
952
953
|
] }),
|
|
953
|
-
_ && /* @__PURE__ */
|
|
954
|
+
_ && /* @__PURE__ */ s("p", { className: "mt-1 text-slate-500 italic", children: [
|
|
954
955
|
'"',
|
|
955
956
|
_,
|
|
956
957
|
'"'
|
|
957
958
|
] }),
|
|
958
|
-
/* @__PURE__ */
|
|
959
|
+
/* @__PURE__ */ s(
|
|
959
960
|
"p",
|
|
960
961
|
{
|
|
961
962
|
className: "mt-0.5 text-slate-400",
|
|
962
|
-
"data-history-on-behalf":
|
|
963
|
-
"data-history-acting-admin": ((
|
|
963
|
+
"data-history-on-behalf": d.on_behalf_of_name ? d.on_behalf_of ?? "" : void 0,
|
|
964
|
+
"data-history-acting-admin": ((S = d.acting_admin) == null ? void 0 : S.id) || void 0,
|
|
964
965
|
children: [
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
966
|
+
y && /* @__PURE__ */ n(an, { className: "mr-1 inline h-3 w-3", "aria-hidden": !0 }),
|
|
967
|
+
v,
|
|
968
|
+
b ? ` · ${b}` : "",
|
|
968
969
|
" · ",
|
|
969
|
-
Rt(
|
|
970
|
+
Rt(d.timestamp)
|
|
970
971
|
]
|
|
971
972
|
}
|
|
972
973
|
),
|
|
973
|
-
k && /* @__PURE__ */
|
|
974
|
+
k && /* @__PURE__ */ s(
|
|
974
975
|
"p",
|
|
975
976
|
{
|
|
976
977
|
className: "mt-0.5 flex items-center gap-1 text-[11px] text-slate-500 dark:text-slate-400",
|
|
977
|
-
"data-history-timing":
|
|
978
|
-
"data-tip":
|
|
978
|
+
"data-history-timing": d.id,
|
|
979
|
+
"data-tip": Fn(k) ?? void 0,
|
|
979
980
|
children: [
|
|
980
981
|
/* @__PURE__ */ n(cr, { className: "h-3 w-3 shrink-0 text-slate-400", "aria-hidden": !0 }),
|
|
981
982
|
"In ",
|
|
982
|
-
|
|
983
|
+
d.to_state_label,
|
|
983
984
|
": ",
|
|
984
985
|
Rn(k)
|
|
985
986
|
]
|
|
986
987
|
}
|
|
987
988
|
)
|
|
988
989
|
] })
|
|
989
|
-
] },
|
|
990
|
+
] }, d.id);
|
|
990
991
|
}) });
|
|
991
992
|
}
|
|
992
993
|
function en({
|
|
@@ -995,7 +996,7 @@ function en({
|
|
|
995
996
|
email: r,
|
|
996
997
|
initials: a
|
|
997
998
|
}) {
|
|
998
|
-
return /* @__PURE__ */ n(pn, { userId: t, children: /* @__PURE__ */
|
|
999
|
+
return /* @__PURE__ */ n(pn, { userId: t, children: /* @__PURE__ */ s(
|
|
999
1000
|
"button",
|
|
1000
1001
|
{
|
|
1001
1002
|
type: "button",
|
|
@@ -1011,7 +1012,7 @@ function en({
|
|
|
1011
1012
|
fallback: /* @__PURE__ */ n("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 })
|
|
1012
1013
|
}
|
|
1013
1014
|
),
|
|
1014
|
-
/* @__PURE__ */
|
|
1015
|
+
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
|
|
1015
1016
|
/* @__PURE__ */ n("span", { className: "block truncate text-[12px] font-medium text-slate-700 underline-offset-2 group-hover/owner:underline dark:text-slate-200", children: e }),
|
|
1016
1017
|
/* @__PURE__ */ n("span", { className: "block truncate text-[11px] text-slate-400 dark:text-slate-500", children: r })
|
|
1017
1018
|
] })
|
|
@@ -1019,109 +1020,110 @@ function en({
|
|
|
1019
1020
|
}
|
|
1020
1021
|
) });
|
|
1021
1022
|
}
|
|
1022
|
-
function
|
|
1023
|
+
function oa({
|
|
1023
1024
|
collection: t,
|
|
1024
1025
|
item: e,
|
|
1025
1026
|
states: r,
|
|
1026
1027
|
currentStateId: a,
|
|
1027
|
-
returned:
|
|
1028
|
+
returned: i = !1,
|
|
1029
|
+
standInReason: d = null
|
|
1028
1030
|
}) {
|
|
1029
|
-
var
|
|
1030
|
-
const
|
|
1031
|
-
|
|
1031
|
+
var Ue, Me, me, Pe;
|
|
1032
|
+
const y = Ie(), v = Ze(), { isAdmin: p } = ln(), [_, b] = G(!1), [k, S] = G(""), [F, C] = G(""), [oe, le] = G(!1), be = ["pipeline-instance-owners", t, e], ne = ["pipeline-owners-can-add", t, e], ue = () => y.request(
|
|
1033
|
+
$e(`/pipelines/instance/${t}/${e}/owners`)
|
|
1032
1034
|
).then((m) => {
|
|
1033
|
-
var
|
|
1034
|
-
return
|
|
1035
|
-
}), { data:
|
|
1036
|
-
queryKey:
|
|
1037
|
-
queryFn: () =>
|
|
1038
|
-
}), { data:
|
|
1039
|
-
queryKey:
|
|
1040
|
-
queryFn: () =>
|
|
1041
|
-
var
|
|
1042
|
-
return ((
|
|
1035
|
+
var E;
|
|
1036
|
+
return v.setQueryData(ne, ((E = m.meta) == null ? void 0 : E.can_add) ?? null), m;
|
|
1037
|
+
}), { data: ee, isLoading: g } = ke({
|
|
1038
|
+
queryKey: be,
|
|
1039
|
+
queryFn: () => ue().then((m) => m.data)
|
|
1040
|
+
}), { data: x } = ke({
|
|
1041
|
+
queryKey: ne,
|
|
1042
|
+
queryFn: () => ue().then((m) => {
|
|
1043
|
+
var E;
|
|
1044
|
+
return ((E = m.meta) == null ? void 0 : E.can_add) ?? null;
|
|
1043
1045
|
}),
|
|
1044
|
-
enabled: !
|
|
1046
|
+
enabled: !g,
|
|
1045
1047
|
staleTime: 3e4
|
|
1046
|
-
}),
|
|
1048
|
+
}), P = typeof x == "boolean" ? x : p, { data: M, isLoading: T } = ke({
|
|
1047
1049
|
queryKey: ["pipeline-all-owners", t, e],
|
|
1048
|
-
queryFn: () =>
|
|
1049
|
-
|
|
1050
|
+
queryFn: () => y.request(
|
|
1051
|
+
$e(`/pipelines/instance/${t}/${e}/owners/all`)
|
|
1050
1052
|
).then((m) => m.data ?? null),
|
|
1051
1053
|
enabled: !!a,
|
|
1052
1054
|
staleTime: 3e4
|
|
1053
|
-
}),
|
|
1054
|
-
(a ? ((
|
|
1055
|
+
}), Q = new Set((ee ?? []).map((m) => m.user)), I = a ? (((Ue = M == null ? void 0 : M[a]) == null ? void 0 : Ue.owners) ?? []).filter((m) => !Q.has(m.id)) : [], w = new Map(
|
|
1056
|
+
(a ? ((Me = M == null ? void 0 : M[a]) == null ? void 0 : Me.unavailable) ?? [] : []).map((m) => [
|
|
1055
1057
|
String(m.id).toUpperCase(),
|
|
1056
1058
|
m
|
|
1057
1059
|
])
|
|
1058
|
-
),
|
|
1060
|
+
), R = I.length + ((ee == null ? void 0 : ee.length) ?? 0), u = !!((me = r.find((m) => m.id === a)) != null && me.is_initial), he = !g && !T, { data: re } = ke({
|
|
1059
1061
|
queryKey: ["pipeline-record-creator", t, e],
|
|
1060
|
-
queryFn: () =>
|
|
1061
|
-
|
|
1062
|
+
queryFn: () => y.request(
|
|
1063
|
+
$e(`/pipelines/instance/${t}/${e}/creator`)
|
|
1062
1064
|
).then((m) => m.data ?? null),
|
|
1063
|
-
enabled:
|
|
1065
|
+
enabled: u && he && R === 0,
|
|
1064
1066
|
staleTime: 6e4
|
|
1065
|
-
}),
|
|
1066
|
-
(m) => !m.state || m.state === a || m.state === (
|
|
1067
|
-
),
|
|
1068
|
-
|
|
1069
|
-
},
|
|
1070
|
-
mutationFn: () =>
|
|
1067
|
+
}), de = u && R === 0 && (re != null && re.name) ? re : null, L = r.find((m) => m.id === a), U = (ee ?? []).some(
|
|
1068
|
+
(m) => !m.state || m.state === a || m.state === (L == null ? void 0 : L.key)
|
|
1069
|
+
), ve = !!L && I.length > 0 && I.every((m) => m.queue_only) && !U, W = d && d.state.id.toUpperCase() === String(a).toUpperCase() ? d : null, Te = Kr(W), ae = () => {
|
|
1070
|
+
v.invalidateQueries({ queryKey: be }), v.invalidateQueries({ queryKey: ["pipeline-instance", t, e] });
|
|
1071
|
+
}, te = Ge({
|
|
1072
|
+
mutationFn: () => y.request(
|
|
1071
1073
|
Je(`/pipelines/instance/${t}/${e}/owners`, {
|
|
1072
|
-
user:
|
|
1073
|
-
state:
|
|
1074
|
+
user: k,
|
|
1075
|
+
state: F || void 0
|
|
1074
1076
|
})
|
|
1075
1077
|
),
|
|
1076
1078
|
onSuccess: () => {
|
|
1077
|
-
|
|
1079
|
+
ae(), S(""), C(""), b(!1), z.success("Owner added");
|
|
1078
1080
|
},
|
|
1079
1081
|
// The server's reason (a 403 says why), not a bare status phrase.
|
|
1080
|
-
onError: (m) =>
|
|
1081
|
-
}),
|
|
1082
|
-
mutationFn: (m) =>
|
|
1083
|
-
onSuccess: (m,
|
|
1084
|
-
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1082
|
+
onError: (m) => z.error(Ee(m, "Failed to add owner"))
|
|
1083
|
+
}), V = Ge({
|
|
1084
|
+
mutationFn: (m) => y.request(pr(`/pipelines/instance-owners/${m.id}`)),
|
|
1085
|
+
onSuccess: (m, E) => {
|
|
1086
|
+
ae();
|
|
1087
|
+
const X = [E.first_name, E.last_name].filter(Boolean).join(" ") || E.email;
|
|
1088
|
+
z.success(`${X} removed as an owner`, {
|
|
1087
1089
|
action: {
|
|
1088
1090
|
label: "Undo",
|
|
1089
|
-
onClick: () => void
|
|
1091
|
+
onClick: () => void y.request(
|
|
1090
1092
|
Je(`/pipelines/instance/${t}/${e}/owners`, {
|
|
1091
|
-
user:
|
|
1092
|
-
state:
|
|
1093
|
+
user: E.user,
|
|
1094
|
+
state: E.state || void 0
|
|
1093
1095
|
})
|
|
1094
|
-
).then(() =>
|
|
1096
|
+
).then(() => ae()).catch((j) => z.error(Ee(j, "Could not add the owner back")))
|
|
1095
1097
|
}
|
|
1096
1098
|
});
|
|
1097
1099
|
},
|
|
1098
|
-
onError: (m) =>
|
|
1099
|
-
}),
|
|
1100
|
-
var
|
|
1101
|
-
const
|
|
1102
|
-
return (`${
|
|
1103
|
-
},
|
|
1104
|
-
var
|
|
1105
|
-
return m ? ((
|
|
1100
|
+
onError: (m) => z.error(Ee(m, "Failed to remove owner"))
|
|
1101
|
+
}), we = (m) => {
|
|
1102
|
+
var j, l;
|
|
1103
|
+
const E = ((j = m.first_name) == null ? void 0 : j[0]) ?? "", X = ((l = m.last_name) == null ? void 0 : l[0]) ?? "";
|
|
1104
|
+
return (`${E}${X}`.trim() || m.email[0] || "?").toUpperCase();
|
|
1105
|
+
}, o = (m) => {
|
|
1106
|
+
var E;
|
|
1107
|
+
return m ? ((E = r.find((X) => X.id === m || X.key === m)) == null ? void 0 : E.label) ?? m : null;
|
|
1106
1108
|
};
|
|
1107
|
-
return /* @__PURE__ */
|
|
1108
|
-
/* @__PURE__ */
|
|
1109
|
-
/* @__PURE__ */
|
|
1109
|
+
return /* @__PURE__ */ s("div", { children: [
|
|
1110
|
+
/* @__PURE__ */ s("div", { className: "mb-3 flex items-center justify-between", children: [
|
|
1111
|
+
/* @__PURE__ */ s("span", { className: "flex items-center gap-1.5 text-[11px] font-medium text-slate-400", children: [
|
|
1110
1112
|
/* @__PURE__ */ n(rn, { className: "h-3.5 w-3.5" }),
|
|
1111
1113
|
"Owners",
|
|
1112
|
-
|
|
1114
|
+
g || T ? /* @__PURE__ */ n("span", { className: "inline-block h-3 w-4 animate-pulse rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : de ? null : /* @__PURE__ */ s("span", { className: "text-slate-300", children: [
|
|
1113
1115
|
"(",
|
|
1114
|
-
|
|
1116
|
+
R,
|
|
1115
1117
|
")"
|
|
1116
1118
|
] })
|
|
1117
1119
|
] }),
|
|
1118
|
-
/* @__PURE__ */
|
|
1119
|
-
a && /* @__PURE__ */ n(
|
|
1120
|
-
!
|
|
1120
|
+
/* @__PURE__ */ s("span", { className: "flex items-center gap-3", children: [
|
|
1121
|
+
a && /* @__PURE__ */ n($r, { collection: t, itemId: String(e) }),
|
|
1122
|
+
!_ && P && /* @__PURE__ */ s(
|
|
1121
1123
|
"button",
|
|
1122
1124
|
{
|
|
1123
1125
|
type: "button",
|
|
1124
|
-
onClick: () =>
|
|
1126
|
+
onClick: () => b(!0),
|
|
1125
1127
|
className: "flex items-center gap-1 text-[11px] text-slate-400 transition-colors hover:text-nvr-cyan",
|
|
1126
1128
|
children: [
|
|
1127
1129
|
/* @__PURE__ */ n(lr, { className: "h-3 w-3" }),
|
|
@@ -1131,57 +1133,57 @@ function ia({
|
|
|
1131
1133
|
)
|
|
1132
1134
|
] })
|
|
1133
1135
|
] }),
|
|
1134
|
-
|
|
1135
|
-
/* @__PURE__ */ n(
|
|
1136
|
+
g || T ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2 py-1.5 text-[12px] text-slate-400", children: [
|
|
1137
|
+
/* @__PURE__ */ n(Se, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1136
1138
|
"Resolving owners…"
|
|
1137
|
-
] }) :
|
|
1138
|
-
|
|
1139
|
+
] }) : de ? /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
|
|
1140
|
+
i ? "Back with" : "With",
|
|
1139
1141
|
" ",
|
|
1140
|
-
/* @__PURE__ */ n(pn, { userId:
|
|
1142
|
+
/* @__PURE__ */ n(pn, { userId: de.id, children: /* @__PURE__ */ n(
|
|
1141
1143
|
"button",
|
|
1142
1144
|
{
|
|
1143
1145
|
type: "button",
|
|
1144
|
-
"aria-label": `${
|
|
1146
|
+
"aria-label": `${de.name} — profile`,
|
|
1145
1147
|
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",
|
|
1146
|
-
children:
|
|
1148
|
+
children: de.name
|
|
1147
1149
|
}
|
|
1148
1150
|
) }),
|
|
1149
1151
|
/* @__PURE__ */ n(
|
|
1150
1152
|
gt,
|
|
1151
1153
|
{
|
|
1152
|
-
person: { id: String(
|
|
1154
|
+
person: { id: String(de.id), name: de.name ?? "" },
|
|
1153
1155
|
className: "ml-1 inline-flex align-middle"
|
|
1154
1156
|
}
|
|
1155
1157
|
)
|
|
1156
|
-
] }) :
|
|
1158
|
+
] }) : R === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: "No owners assigned." }) : /* @__PURE__ */ s("div", { className: "space-y-px", children: [
|
|
1157
1159
|
I.map((m) => {
|
|
1158
|
-
var
|
|
1159
|
-
const
|
|
1160
|
-
return /* @__PURE__ */
|
|
1160
|
+
var j, l;
|
|
1161
|
+
const E = [m.first_name, m.last_name].filter(Boolean).join(" ") || m.email, X = (`${((j = m.first_name) == null ? void 0 : j[0]) ?? ""}${((l = m.last_name) == null ? void 0 : l[0]) ?? ""}`.trim() || m.email[0] || "?").toUpperCase();
|
|
1162
|
+
return /* @__PURE__ */ s(
|
|
1161
1163
|
"div",
|
|
1162
1164
|
{
|
|
1163
1165
|
className: "group/row -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",
|
|
1164
1166
|
children: [
|
|
1165
|
-
/* @__PURE__ */ n(en, { userId: m.id, name:
|
|
1167
|
+
/* @__PURE__ */ n(en, { userId: m.id, name: E, email: m.email, initials: X }),
|
|
1166
1168
|
/* @__PURE__ */ n(
|
|
1167
1169
|
gt,
|
|
1168
1170
|
{
|
|
1169
|
-
person: { id: String(m.id), name:
|
|
1171
|
+
person: { id: String(m.id), name: E, firstName: m.first_name },
|
|
1170
1172
|
className: "opacity-0 focus-visible:opacity-100 group-hover/row:opacity-100 data-[state=open]:opacity-100"
|
|
1171
1173
|
}
|
|
1172
1174
|
),
|
|
1173
1175
|
(() => {
|
|
1174
|
-
const
|
|
1175
|
-
return
|
|
1176
|
+
const h = w.get(String(m.id).toUpperCase());
|
|
1177
|
+
return h ? /* @__PURE__ */ n(
|
|
1176
1178
|
"span",
|
|
1177
1179
|
{
|
|
1178
|
-
"data-owner-unavailable":
|
|
1179
|
-
className:
|
|
1180
|
+
"data-owner-unavailable": h.reason,
|
|
1181
|
+
className: ce(
|
|
1180
1182
|
"shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-medium",
|
|
1181
|
-
|
|
1183
|
+
h.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"
|
|
1182
1184
|
),
|
|
1183
|
-
"data-tip":
|
|
1184
|
-
children:
|
|
1185
|
+
"data-tip": h.delegate ? `${E} is ${Qe[h.reason] ?? h.reason} — ${h.delegate.name} covers` : `${E} is ${Qe[h.reason] ?? h.reason} and can't approve this step`,
|
|
1186
|
+
children: h.delegate ? `${Qe[h.reason] ?? h.reason} · ${h.delegate.name} covers` : Qe[h.reason] ?? h.reason
|
|
1185
1187
|
}
|
|
1186
1188
|
) : null;
|
|
1187
1189
|
})(),
|
|
@@ -1190,7 +1192,7 @@ function ia({
|
|
|
1190
1192
|
{
|
|
1191
1193
|
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",
|
|
1192
1194
|
"data-tip": "The record is in their queue, but only the step’s owners can move it",
|
|
1193
|
-
children: "in their queue"
|
|
1195
|
+
children: ve && Te.has(String(m.id).toUpperCase()) ? "stand-in" : "in their queue"
|
|
1194
1196
|
}
|
|
1195
1197
|
) : /* @__PURE__ */ n("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" })
|
|
1196
1198
|
]
|
|
@@ -1198,7 +1200,7 @@ function ia({
|
|
|
1198
1200
|
`group-${m.id}`
|
|
1199
1201
|
);
|
|
1200
1202
|
}),
|
|
1201
|
-
(
|
|
1203
|
+
(ee ?? []).map((m) => /* @__PURE__ */ s(
|
|
1202
1204
|
"div",
|
|
1203
1205
|
{
|
|
1204
1206
|
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",
|
|
@@ -1209,7 +1211,7 @@ function ia({
|
|
|
1209
1211
|
userId: m.user,
|
|
1210
1212
|
name: [m.first_name, m.last_name].filter(Boolean).join(" ") || m.email,
|
|
1211
1213
|
email: m.email,
|
|
1212
|
-
initials:
|
|
1214
|
+
initials: we(m)
|
|
1213
1215
|
}
|
|
1214
1216
|
),
|
|
1215
1217
|
/* @__PURE__ */ n(
|
|
@@ -1224,14 +1226,14 @@ function ia({
|
|
|
1224
1226
|
}
|
|
1225
1227
|
),
|
|
1226
1228
|
/* @__PURE__ */ n("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" }),
|
|
1227
|
-
/* @__PURE__ */ n("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children: m.state ?
|
|
1229
|
+
/* @__PURE__ */ n("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children: m.state ? o(m.state) : "all states" }),
|
|
1228
1230
|
/* @__PURE__ */ n(
|
|
1229
1231
|
"button",
|
|
1230
1232
|
{
|
|
1231
1233
|
type: "button",
|
|
1232
1234
|
"aria-label": `Remove ${[m.first_name, m.last_name].filter(Boolean).join(" ") || m.email} as an owner`,
|
|
1233
|
-
disabled:
|
|
1234
|
-
onClick: () =>
|
|
1235
|
+
disabled: V.isPending,
|
|
1236
|
+
onClick: () => V.mutate(m),
|
|
1235
1237
|
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",
|
|
1236
1238
|
children: /* @__PURE__ */ n(dr, { className: "h-3 w-3" })
|
|
1237
1239
|
}
|
|
@@ -1241,76 +1243,79 @@ function ia({
|
|
|
1241
1243
|
m.id
|
|
1242
1244
|
))
|
|
1243
1245
|
] }),
|
|
1244
|
-
|
|
1246
|
+
ve && !g && !T && (W ? (
|
|
1247
|
+
// Why nobody is assigned + why this person stands in (Rob 2026-11-14).
|
|
1248
|
+
/* @__PURE__ */ n(Qr, { reason: W, className: "mt-2" })
|
|
1249
|
+
) : /* @__PURE__ */ s(
|
|
1245
1250
|
"p",
|
|
1246
1251
|
{
|
|
1247
1252
|
"data-owners-stand-in": !0,
|
|
1248
1253
|
className: "mt-1.5 text-[11px] leading-snug text-slate-500 dark:text-slate-400",
|
|
1249
1254
|
children: [
|
|
1250
1255
|
"Shown as a stand-in — no one is assigned to ",
|
|
1251
|
-
|
|
1256
|
+
L == null ? void 0 : L.label,
|
|
1252
1257
|
"."
|
|
1253
1258
|
]
|
|
1254
1259
|
}
|
|
1255
|
-
),
|
|
1256
|
-
|
|
1260
|
+
)),
|
|
1261
|
+
_ && /* @__PURE__ */ s("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: [
|
|
1257
1262
|
/* @__PURE__ */ n("p", { className: "text-[11px] font-semibold text-slate-500", children: "Add owner" }),
|
|
1258
|
-
/* @__PURE__ */ n(Tr, { value:
|
|
1259
|
-
|
|
1260
|
-
/* @__PURE__ */ n(hn, { asChild: !0, children: /* @__PURE__ */
|
|
1263
|
+
/* @__PURE__ */ n(Tr, { value: k, onChange: S }),
|
|
1264
|
+
p ? /* @__PURE__ */ s(fn, { open: oe, onOpenChange: le, children: [
|
|
1265
|
+
/* @__PURE__ */ n(hn, { asChild: !0, children: /* @__PURE__ */ s(
|
|
1261
1266
|
"button",
|
|
1262
1267
|
{
|
|
1263
1268
|
type: "button",
|
|
1264
1269
|
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",
|
|
1265
1270
|
children: [
|
|
1266
|
-
/* @__PURE__ */ n("span", { className: "truncate", children:
|
|
1271
|
+
/* @__PURE__ */ n("span", { className: "truncate", children: F ? ((Pe = r.find((m) => m.id === F)) == null ? void 0 : Pe.label) ?? F : "All states" }),
|
|
1267
1272
|
/* @__PURE__ */ n(We, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
1268
1273
|
]
|
|
1269
1274
|
}
|
|
1270
1275
|
) }),
|
|
1271
1276
|
/* @__PURE__ */ n(gn, { align: "start", sideOffset: 4, className: "w-52 p-1", children: ["", ...r.map((m) => m.id)].map((m) => {
|
|
1272
|
-
var
|
|
1273
|
-
const
|
|
1277
|
+
var j;
|
|
1278
|
+
const E = m === "" ? "All states" : ((j = r.find((l) => l.id === m)) == null ? void 0 : j.label) ?? m;
|
|
1274
1279
|
return /* @__PURE__ */ n(
|
|
1275
1280
|
"button",
|
|
1276
1281
|
{
|
|
1277
1282
|
type: "button",
|
|
1278
|
-
className:
|
|
1283
|
+
className: ce(
|
|
1279
1284
|
"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",
|
|
1280
|
-
|
|
1285
|
+
F === m && "font-medium text-slate-800 dark:text-slate-200"
|
|
1281
1286
|
),
|
|
1282
1287
|
onClick: () => {
|
|
1283
|
-
|
|
1288
|
+
C(m), le(!1);
|
|
1284
1289
|
},
|
|
1285
|
-
children:
|
|
1290
|
+
children: E
|
|
1286
1291
|
},
|
|
1287
1292
|
m
|
|
1288
1293
|
);
|
|
1289
1294
|
}) })
|
|
1290
1295
|
] }) : /* @__PURE__ */ n("p", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: "Hands off the current step." }),
|
|
1291
|
-
/* @__PURE__ */
|
|
1296
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-2 pt-0.5", children: [
|
|
1292
1297
|
/* @__PURE__ */ n(
|
|
1293
|
-
|
|
1298
|
+
fe,
|
|
1294
1299
|
{
|
|
1295
1300
|
type: "button",
|
|
1296
1301
|
size: "sm",
|
|
1297
1302
|
variant: "ghost",
|
|
1298
1303
|
className: "h-7 text-[12px]",
|
|
1299
1304
|
onClick: () => {
|
|
1300
|
-
|
|
1305
|
+
b(!1), S(""), C("");
|
|
1301
1306
|
},
|
|
1302
1307
|
children: "Cancel"
|
|
1303
1308
|
}
|
|
1304
1309
|
),
|
|
1305
1310
|
/* @__PURE__ */ n(
|
|
1306
|
-
|
|
1311
|
+
fe,
|
|
1307
1312
|
{
|
|
1308
1313
|
type: "button",
|
|
1309
1314
|
size: "sm",
|
|
1310
1315
|
className: "h-7 text-[12px]",
|
|
1311
|
-
disabled: !
|
|
1312
|
-
onClick: () =>
|
|
1313
|
-
children:
|
|
1316
|
+
disabled: !k || te.isPending,
|
|
1317
|
+
onClick: () => te.mutate(),
|
|
1318
|
+
children: te.isPending ? /* @__PURE__ */ n(Se, { className: "h-3.5 w-3.5 animate-spin" }) : "Add"
|
|
1314
1319
|
}
|
|
1315
1320
|
)
|
|
1316
1321
|
] })
|
|
@@ -1319,17 +1324,17 @@ function ia({
|
|
|
1319
1324
|
}
|
|
1320
1325
|
function er(t, e, r, a) {
|
|
1321
1326
|
if (!t || !(r != null && r.length)) return null;
|
|
1322
|
-
const
|
|
1323
|
-
if (!
|
|
1324
|
-
const
|
|
1325
|
-
return
|
|
1327
|
+
const d = new Map(r.map((p) => [String(p.id).toUpperCase(), p])).get(String(t.to_state).toUpperCase()), y = Number(e == null ? void 0 : e.sort);
|
|
1328
|
+
if (!d || !Number.isFinite(y) || !(Number(d.sort) > y)) return null;
|
|
1329
|
+
const v = Fr(String(t.to_state), r, a);
|
|
1330
|
+
return v && v.skipped.length > 0 ? v : null;
|
|
1326
1331
|
}
|
|
1327
1332
|
function tr({ landing: t }) {
|
|
1328
1333
|
if (!t || t.skipped.length === 0) return null;
|
|
1329
|
-
const e =
|
|
1334
|
+
const e = Ar(t);
|
|
1330
1335
|
if (e.length === 1) {
|
|
1331
1336
|
const r = e[0];
|
|
1332
|
-
return /* @__PURE__ */
|
|
1337
|
+
return /* @__PURE__ */ s(
|
|
1333
1338
|
"p",
|
|
1334
1339
|
{
|
|
1335
1340
|
"data-confirm-skips": !0,
|
|
@@ -1349,18 +1354,18 @@ function tr({ landing: t }) {
|
|
|
1349
1354
|
}
|
|
1350
1355
|
);
|
|
1351
1356
|
}
|
|
1352
|
-
return /* @__PURE__ */
|
|
1357
|
+
return /* @__PURE__ */ s(
|
|
1353
1358
|
"div",
|
|
1354
1359
|
{
|
|
1355
1360
|
"data-confirm-skips": !0,
|
|
1356
1361
|
className: "text-[11.5px] leading-snug text-slate-600 dark:text-slate-300",
|
|
1357
1362
|
children: [
|
|
1358
|
-
/* @__PURE__ */
|
|
1363
|
+
/* @__PURE__ */ s("p", { children: [
|
|
1359
1364
|
"Goes straight to ",
|
|
1360
1365
|
/* @__PURE__ */ n("span", { className: "font-medium", children: t.state.label }),
|
|
1361
1366
|
". Skipped on the way:"
|
|
1362
1367
|
] }),
|
|
1363
|
-
/* @__PURE__ */ n("ul", { className: "mt-0.5 list-disc space-y-0.5 pl-4", children: e.map((r) => /* @__PURE__ */
|
|
1368
|
+
/* @__PURE__ */ n("ul", { className: "mt-0.5 list-disc space-y-0.5 pl-4", children: e.map((r) => /* @__PURE__ */ s("li", { children: [
|
|
1364
1369
|
/* @__PURE__ */ n("span", { className: "font-medium", children: Gt(r.labels) }),
|
|
1365
1370
|
r.reason ? ` — ${r.reason}` : ""
|
|
1366
1371
|
] }, r.labels.join("|"))) })
|
|
@@ -1373,71 +1378,71 @@ const Qe = {
|
|
|
1373
1378
|
suspended: "suspended",
|
|
1374
1379
|
redacted: "redacted"
|
|
1375
1380
|
};
|
|
1376
|
-
function
|
|
1381
|
+
function la({
|
|
1377
1382
|
collection: t,
|
|
1378
1383
|
item: e,
|
|
1379
1384
|
states: r,
|
|
1380
1385
|
currentStateId: a
|
|
1381
1386
|
}) {
|
|
1382
|
-
const
|
|
1387
|
+
const i = Ie(), [d, y] = G(!1), { data: v, isLoading: p } = ke({
|
|
1383
1388
|
queryKey: ["pipeline-all-owners", t, e],
|
|
1384
|
-
queryFn: () =>
|
|
1385
|
-
|
|
1386
|
-
).then((
|
|
1387
|
-
enabled:
|
|
1389
|
+
queryFn: () => i.request(
|
|
1390
|
+
$e(`/pipelines/instance/${t}/${e}/owners/all`)
|
|
1391
|
+
).then((b) => b.data ?? null),
|
|
1392
|
+
enabled: d,
|
|
1388
1393
|
staleTime: 3e4
|
|
1389
|
-
}), _ = [...r].filter((
|
|
1394
|
+
}), _ = [...r].filter((b) => {
|
|
1390
1395
|
var k;
|
|
1391
|
-
return !
|
|
1392
|
-
}).sort((
|
|
1393
|
-
return /* @__PURE__ */
|
|
1396
|
+
return !v || ((k = v[b.id]) == null ? void 0 : k.on_path) !== !1;
|
|
1397
|
+
}).sort((b, k) => b.sort - k.sort);
|
|
1398
|
+
return /* @__PURE__ */ s(fn, { open: d, onOpenChange: y, children: [
|
|
1394
1399
|
/* @__PURE__ */ n(hn, { asChild: !0, children: /* @__PURE__ */ n(
|
|
1395
1400
|
"button",
|
|
1396
1401
|
{
|
|
1397
1402
|
type: "button",
|
|
1398
1403
|
title: "View approval chain",
|
|
1399
1404
|
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",
|
|
1400
|
-
onClick: (
|
|
1405
|
+
onClick: (b) => b.stopPropagation(),
|
|
1401
1406
|
children: /* @__PURE__ */ n(rn, { className: "h-3.5 w-3.5" })
|
|
1402
1407
|
}
|
|
1403
1408
|
) }),
|
|
1404
|
-
/* @__PURE__ */
|
|
1405
|
-
/* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ s(gn, { align: "end", sideOffset: 6, className: "w-[576px] p-0 overflow-hidden", children: [
|
|
1410
|
+
/* @__PURE__ */ s("div", { className: "border-b border-slate-100 px-4 py-3", children: [
|
|
1406
1411
|
/* @__PURE__ */ n("p", { className: "text-[12px] font-semibold text-slate-700", children: "Approval Chain" }),
|
|
1407
1412
|
/* @__PURE__ */ n("p", { className: "text-[11px] text-slate-400 mt-0.5", children: "Owners per pipeline state" })
|
|
1408
1413
|
] }),
|
|
1409
|
-
/* @__PURE__ */ n("div", { className: "max-h-[504px] overflow-y-auto", children: p ? /* @__PURE__ */ n("div", { className: "space-y-px p-3", children: [1, 2, 3].map((
|
|
1410
|
-
var
|
|
1411
|
-
const k = (((
|
|
1412
|
-
id:
|
|
1413
|
-
name: [
|
|
1414
|
-
})),
|
|
1415
|
-
return /* @__PURE__ */
|
|
1414
|
+
/* @__PURE__ */ n("div", { className: "max-h-[504px] overflow-y-auto", children: p ? /* @__PURE__ */ n("div", { className: "space-y-px p-3", children: [1, 2, 3].map((b) => /* @__PURE__ */ n(Ae, { className: "h-10 w-full" }, b)) }) : v ? /* @__PURE__ */ n("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: _.map((b) => {
|
|
1415
|
+
var be, ne, ue, ee, g;
|
|
1416
|
+
const k = (((be = v[b.id]) == null ? void 0 : be.owners) ?? []).map((x) => ({
|
|
1417
|
+
id: x.id,
|
|
1418
|
+
name: [x.first_name, x.last_name].filter(Boolean).join(" ") || x.email
|
|
1419
|
+
})), S = b.id === a, F = ((ne = v[b.id]) == null ? void 0 : ne.skipped) === !0 && !S, C = (((ue = v[b.id]) == null ? void 0 : ue.skip_reasons) ?? []).filter(Boolean), oe = ((ee = v[b.id]) == null ? void 0 : ee.unavailable) ?? [], le = ((g = v[b.id]) == null ? void 0 : g.blocked) === !0 && !F;
|
|
1420
|
+
return /* @__PURE__ */ s(
|
|
1416
1421
|
"div",
|
|
1417
1422
|
{
|
|
1418
|
-
className:
|
|
1423
|
+
className: ce(
|
|
1419
1424
|
"flex items-center gap-3 px-4 py-2.5",
|
|
1420
1425
|
// Hex-with-alpha rather than bg-nvr-cyan/N — the
|
|
1421
1426
|
// nvr-cyan token is an opaque var() so Tailwind silently
|
|
1422
1427
|
// drops opacity modifiers on it. Kept very light so the
|
|
1423
1428
|
// tint doesn't clash with the state badge's own color.
|
|
1424
|
-
|
|
1425
|
-
|
|
1429
|
+
S && "bg-nvr-cyan/[0.06] dark:bg-nvr-cyan/[0.11]",
|
|
1430
|
+
F && "opacity-60",
|
|
1426
1431
|
le && "bg-red-50 dark:bg-red-500/10"
|
|
1427
1432
|
),
|
|
1428
1433
|
"data-chain-blocked": le ? "" : void 0,
|
|
1429
1434
|
children: [
|
|
1430
|
-
/* @__PURE__ */ n(Oe, { label:
|
|
1431
|
-
/* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children:
|
|
1435
|
+
/* @__PURE__ */ n(Oe, { label: b.label, color: b.color, small: !0 }),
|
|
1436
|
+
/* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children: F ? (
|
|
1432
1437
|
// Radix tooltip with zero delay — native `title` waits on
|
|
1433
1438
|
// the OS hover timer, and a truncated reason needs its
|
|
1434
1439
|
// full text the moment the cursor lands on it.
|
|
1435
|
-
/* @__PURE__ */ n(bn, { delayDuration: 0, children: /* @__PURE__ */
|
|
1436
|
-
/* @__PURE__ */ n(Nt, { asChild: !0, children: /* @__PURE__ */
|
|
1440
|
+
/* @__PURE__ */ n(bn, { delayDuration: 0, children: /* @__PURE__ */ s(_t, { children: [
|
|
1441
|
+
/* @__PURE__ */ n(Nt, { asChild: !0, children: /* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 cursor-default items-center gap-2", children: [
|
|
1437
1442
|
/* @__PURE__ */ n("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" }),
|
|
1438
1443
|
C.length > 0 && /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-[11px] text-slate-400 dark:text-slate-500", children: C.join(" · ") })
|
|
1439
1444
|
] }) }),
|
|
1440
|
-
/* @__PURE__ */
|
|
1445
|
+
/* @__PURE__ */ s(
|
|
1441
1446
|
St,
|
|
1442
1447
|
{
|
|
1443
1448
|
side: "bottom",
|
|
@@ -1445,30 +1450,30 @@ function sa({
|
|
|
1445
1450
|
className: "max-w-[420px] space-y-0.5 text-[11.5px] leading-snug",
|
|
1446
1451
|
children: [
|
|
1447
1452
|
/* @__PURE__ */ n("p", { className: "text-slate-500 dark:text-slate-400", children: "The pipeline will pass through this state without stopping:" }),
|
|
1448
|
-
C.length > 0 ? C.map((
|
|
1453
|
+
C.length > 0 ? C.map((x) => /* @__PURE__ */ n("p", { children: x }, x)) : /* @__PURE__ */ n("p", { children: "Skip criteria currently match" })
|
|
1449
1454
|
]
|
|
1450
1455
|
}
|
|
1451
1456
|
)
|
|
1452
1457
|
] }) })
|
|
1453
|
-
) : /* @__PURE__ */
|
|
1458
|
+
) : /* @__PURE__ */ s(Ce, { children: [
|
|
1454
1459
|
/* @__PURE__ */ n(Nr, { owners: k, max: 10, emptyLabel: "—" }),
|
|
1455
|
-
|
|
1460
|
+
oe.map((x) => /* @__PURE__ */ s(
|
|
1456
1461
|
"span",
|
|
1457
1462
|
{
|
|
1458
|
-
"data-tip": `${
|
|
1459
|
-
className:
|
|
1463
|
+
"data-tip": `${x.name} is ${Qe[x.reason] ?? x.reason}${x.delegate ? ` — ${x.delegate.name} covers${x.delegate.expires_at ? ` until ${yr(x.delegate.expires_at)}` : ""}` : " and nobody is covering"}`,
|
|
1464
|
+
className: ce(
|
|
1460
1465
|
"inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10.5px] font-medium",
|
|
1461
|
-
|
|
1466
|
+
x.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"
|
|
1462
1467
|
),
|
|
1463
1468
|
children: [
|
|
1464
|
-
|
|
1465
|
-
|
|
1469
|
+
x.name,
|
|
1470
|
+
x.delegate ? /* @__PURE__ */ s(Ce, { children: [
|
|
1466
1471
|
" → ",
|
|
1467
|
-
|
|
1468
|
-
|
|
1472
|
+
x.delegate.name,
|
|
1473
|
+
x.delegate.expires_at && /* @__PURE__ */ s("span", { className: "opacity-70", children: [
|
|
1469
1474
|
", until",
|
|
1470
1475
|
" ",
|
|
1471
|
-
new Date(
|
|
1476
|
+
new Date(x.delegate.expires_at).toLocaleDateString(
|
|
1472
1477
|
void 0,
|
|
1473
1478
|
{
|
|
1474
1479
|
month: "short",
|
|
@@ -1476,53 +1481,53 @@ function sa({
|
|
|
1476
1481
|
}
|
|
1477
1482
|
)
|
|
1478
1483
|
] })
|
|
1479
|
-
] }) : /* @__PURE__ */
|
|
1484
|
+
] }) : /* @__PURE__ */ s("span", { className: "opacity-80", children: [
|
|
1480
1485
|
" ",
|
|
1481
1486
|
"· ",
|
|
1482
|
-
Qe[
|
|
1487
|
+
Qe[x.reason] ?? x.reason
|
|
1483
1488
|
] })
|
|
1484
1489
|
]
|
|
1485
1490
|
},
|
|
1486
|
-
|
|
1491
|
+
x.id
|
|
1487
1492
|
)),
|
|
1488
1493
|
le && /* @__PURE__ */ n("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" })
|
|
1489
1494
|
] }) })
|
|
1490
1495
|
]
|
|
1491
1496
|
},
|
|
1492
|
-
|
|
1497
|
+
b.id
|
|
1493
1498
|
);
|
|
1494
1499
|
}) }) : /* @__PURE__ */ n("p", { className: "px-4 py-3 text-[12px] text-slate-400", children: "No pipeline configured." }) })
|
|
1495
1500
|
] })
|
|
1496
1501
|
] });
|
|
1497
1502
|
}
|
|
1498
|
-
function
|
|
1503
|
+
function Ya({
|
|
1499
1504
|
collection: t,
|
|
1500
1505
|
item: e,
|
|
1501
1506
|
defaultExpanded: r,
|
|
1502
1507
|
title: a,
|
|
1503
|
-
showApprovalChain:
|
|
1504
|
-
hideActionsCollapsed:
|
|
1505
|
-
hideActionsExpanded:
|
|
1506
|
-
onBeforeTransition:
|
|
1508
|
+
showApprovalChain: i,
|
|
1509
|
+
hideActionsCollapsed: d,
|
|
1510
|
+
hideActionsExpanded: y,
|
|
1511
|
+
onBeforeTransition: v,
|
|
1507
1512
|
addendumPending: p,
|
|
1508
1513
|
addendumView: _,
|
|
1509
|
-
asRole:
|
|
1514
|
+
asRole: b,
|
|
1510
1515
|
asUser: k
|
|
1511
1516
|
}) {
|
|
1512
1517
|
return e === "new" ? null : /* @__PURE__ */ n(
|
|
1513
|
-
|
|
1518
|
+
da,
|
|
1514
1519
|
{
|
|
1515
1520
|
collection: t,
|
|
1516
1521
|
item: e,
|
|
1517
1522
|
defaultExpanded: r,
|
|
1518
1523
|
title: a,
|
|
1519
|
-
showApprovalChain:
|
|
1520
|
-
hideActionsCollapsed:
|
|
1521
|
-
hideActionsExpanded:
|
|
1522
|
-
onBeforeTransition:
|
|
1524
|
+
showApprovalChain: i,
|
|
1525
|
+
hideActionsCollapsed: d,
|
|
1526
|
+
hideActionsExpanded: y,
|
|
1527
|
+
onBeforeTransition: v,
|
|
1523
1528
|
addendumPending: p,
|
|
1524
1529
|
addendumView: _,
|
|
1525
|
-
asRole:
|
|
1530
|
+
asRole: b,
|
|
1526
1531
|
asUser: k
|
|
1527
1532
|
},
|
|
1528
1533
|
`${t}:${e}`
|
|
@@ -1533,50 +1538,50 @@ function nr({
|
|
|
1533
1538
|
item: e,
|
|
1534
1539
|
omitLines: r
|
|
1535
1540
|
}) {
|
|
1536
|
-
const a = Ie(), { data:
|
|
1537
|
-
queryKey:
|
|
1541
|
+
const a = Ie(), { data: i } = ke({
|
|
1542
|
+
queryKey: Ln(t, e),
|
|
1538
1543
|
queryFn: () => jn(a, t, e),
|
|
1539
1544
|
staleTime: 3e4,
|
|
1540
1545
|
retry: !1
|
|
1541
1546
|
});
|
|
1542
|
-
if (!
|
|
1543
|
-
const
|
|
1544
|
-
return /* @__PURE__ */
|
|
1545
|
-
/* @__PURE__ */
|
|
1547
|
+
if (!i) return null;
|
|
1548
|
+
const d = i.changed_by_people ?? i.changed_total, y = new Set((r ?? []).map(Yt)), v = (i.lines ?? []).filter((p) => !y.has(Yt(p)));
|
|
1549
|
+
return /* @__PURE__ */ s("div", { className: "rounded-md border border-slate-200 bg-white px-3 py-2 text-[11.5px] dark:border-border dark:bg-card", children: [
|
|
1550
|
+
/* @__PURE__ */ s("p", { className: "text-slate-500 dark:text-muted-foreground", children: [
|
|
1546
1551
|
/* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: "Since entering this state" }),
|
|
1547
1552
|
" ",
|
|
1548
1553
|
"(",
|
|
1549
|
-
|
|
1554
|
+
Yr(i.days_in_state),
|
|
1550
1555
|
"):",
|
|
1551
1556
|
" ",
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1557
|
+
i.changed_total === 0 && i.comments === 0 && i.addendums.count === 0 ? /* @__PURE__ */ n("span", { children: "no changes to this record." }) : /* @__PURE__ */ s(Ce, { children: [
|
|
1558
|
+
d > 0 && /* @__PURE__ */ s("span", { children: [
|
|
1559
|
+
d,
|
|
1555
1560
|
" field",
|
|
1556
|
-
|
|
1561
|
+
d === 1 ? "" : "s",
|
|
1557
1562
|
" changed",
|
|
1558
|
-
|
|
1563
|
+
i.edited_by.length > 0 ? ` by ${i.edited_by.join(", ")}` : ""
|
|
1559
1564
|
] }),
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1565
|
+
d === 0 && i.changed_total > 0 && i.comments === 0 && i.addendums.count === 0 && /* @__PURE__ */ n("span", { children: "only values the record fills in itself changed." }),
|
|
1566
|
+
i.comments > 0 && /* @__PURE__ */ s("span", { children: [
|
|
1567
|
+
d > 0 ? " · " : "",
|
|
1568
|
+
i.comments,
|
|
1564
1569
|
" comment",
|
|
1565
|
-
|
|
1570
|
+
i.comments === 1 ? "" : "s"
|
|
1566
1571
|
] }),
|
|
1567
|
-
|
|
1572
|
+
i.addendums.count > 0 && /* @__PURE__ */ s("span", { children: [
|
|
1568
1573
|
" · ",
|
|
1569
|
-
|
|
1574
|
+
i.addendums.count,
|
|
1570
1575
|
" addendum",
|
|
1571
|
-
|
|
1572
|
-
|
|
1576
|
+
i.addendums.count === 1 ? "" : "s",
|
|
1577
|
+
i.addendums.cost_impact !== 0 ? ` (${i.addendums.cost_impact > 0 ? "+" : ""}$${Math.abs(i.addendums.cost_impact).toLocaleString()})` : ""
|
|
1573
1578
|
] })
|
|
1574
1579
|
] })
|
|
1575
1580
|
] }),
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
const _ =
|
|
1579
|
-
return /* @__PURE__ */
|
|
1581
|
+
i.field_changes.length > 0 && /* @__PURE__ */ s("div", { className: "mt-1 space-y-0.5", children: [
|
|
1582
|
+
i.field_changes.slice(0, 5).map((p) => {
|
|
1583
|
+
const _ = Jr(p.old, p.new);
|
|
1584
|
+
return /* @__PURE__ */ s(
|
|
1580
1585
|
"p",
|
|
1581
1586
|
{
|
|
1582
1587
|
"data-brief-change": p.field,
|
|
@@ -1586,7 +1591,7 @@ function nr({
|
|
|
1586
1591
|
p.auto ? /* @__PURE__ */ n("span", { children: " (updated automatically)" }) : null,
|
|
1587
1592
|
":",
|
|
1588
1593
|
" ",
|
|
1589
|
-
_.old !== null && /* @__PURE__ */
|
|
1594
|
+
_.old !== null && /* @__PURE__ */ s(Ce, { children: [
|
|
1590
1595
|
/* @__PURE__ */ n("span", { className: "text-red-600 line-through dark:text-red-400", children: _.old }),
|
|
1591
1596
|
/* @__PURE__ */ n("span", { "aria-hidden": "true", children: " → " }),
|
|
1592
1597
|
/* @__PURE__ */ n("span", { className: "sr-only", children: " changed to " })
|
|
@@ -1597,13 +1602,13 @@ function nr({
|
|
|
1597
1602
|
p.field
|
|
1598
1603
|
);
|
|
1599
1604
|
}),
|
|
1600
|
-
|
|
1605
|
+
i.field_changes.length > 5 && /* @__PURE__ */ s("p", { className: "text-[10.5px] text-slate-400", children: [
|
|
1601
1606
|
"+",
|
|
1602
|
-
|
|
1607
|
+
i.field_changes.length - 5,
|
|
1603
1608
|
" more — see History for the full trail"
|
|
1604
1609
|
] })
|
|
1605
1610
|
] }),
|
|
1606
|
-
|
|
1611
|
+
v.map((p) => /* @__PURE__ */ s(
|
|
1607
1612
|
"p",
|
|
1608
1613
|
{
|
|
1609
1614
|
"data-brief-line": p.label,
|
|
@@ -1624,106 +1629,106 @@ function nr({
|
|
|
1624
1629
|
))
|
|
1625
1630
|
] });
|
|
1626
1631
|
}
|
|
1627
|
-
function
|
|
1632
|
+
function da({
|
|
1628
1633
|
collection: t,
|
|
1629
1634
|
item: e,
|
|
1630
1635
|
defaultExpanded: r,
|
|
1631
1636
|
title: a,
|
|
1632
|
-
showApprovalChain:
|
|
1633
|
-
hideActionsCollapsed:
|
|
1634
|
-
hideActionsExpanded:
|
|
1635
|
-
onBeforeTransition:
|
|
1637
|
+
showApprovalChain: i,
|
|
1638
|
+
hideActionsCollapsed: d,
|
|
1639
|
+
hideActionsExpanded: y,
|
|
1640
|
+
onBeforeTransition: v,
|
|
1636
1641
|
addendumPending: p,
|
|
1637
1642
|
addendumView: _,
|
|
1638
|
-
asRole:
|
|
1643
|
+
asRole: b,
|
|
1639
1644
|
asUser: k
|
|
1640
1645
|
}) {
|
|
1641
|
-
var
|
|
1642
|
-
const
|
|
1646
|
+
var Lt, jt, Kt;
|
|
1647
|
+
const S = !!b || !!k, F = Ie(), C = Ze(), { isAdmin: oe } = ln(), [le, be] = G(0), ne = xe(null);
|
|
1643
1648
|
Be(() => {
|
|
1644
|
-
if (!
|
|
1649
|
+
if (!oe) return;
|
|
1645
1650
|
const c = ($) => {
|
|
1646
|
-
const
|
|
1647
|
-
!
|
|
1651
|
+
const q = $.detail;
|
|
1652
|
+
!q || q.claimed || q.collection !== t || String(q.item) !== String(e) || (q.claimed = !0, Q(!0), be((D) => D + 1), setTimeout(
|
|
1648
1653
|
() => {
|
|
1649
|
-
var
|
|
1650
|
-
return (
|
|
1654
|
+
var D;
|
|
1655
|
+
return (D = ne.current) == null ? void 0 : D.scrollIntoView({ block: "center", behavior: "smooth" });
|
|
1651
1656
|
},
|
|
1652
1657
|
80
|
|
1653
1658
|
));
|
|
1654
1659
|
};
|
|
1655
1660
|
return window.addEventListener(Wt, c), () => window.removeEventListener(Wt, c);
|
|
1656
|
-
}, [
|
|
1657
|
-
const [
|
|
1658
|
-
mn(t, e, "transition", !!g || !!
|
|
1659
|
-
const
|
|
1660
|
-
|
|
1661
|
-
onSettled: ($,
|
|
1662
|
-
if (
|
|
1663
|
-
|
|
1661
|
+
}, [oe, t, e]);
|
|
1662
|
+
const [ue, ee] = G(""), [g, x] = G(null), [P, M] = G(!1), [T, Q] = vr(r, !1), [I, w] = G(null), [R, u] = G(null), [he, re] = G(null), [de, L] = G([]), U = Kn(t, String(e));
|
|
1663
|
+
mn(t, e, "transition", !!g || !!I);
|
|
1664
|
+
const ve = hr(t, e, "transition"), W = xe(!1), Te = (c) => {
|
|
1665
|
+
W.current || S || (W.current = !0, u(null), j.mutate(c, {
|
|
1666
|
+
onSettled: ($, q) => {
|
|
1667
|
+
if (q) {
|
|
1668
|
+
W.current = !1;
|
|
1664
1669
|
return;
|
|
1665
1670
|
}
|
|
1666
|
-
|
|
1667
|
-
|
|
1671
|
+
we().finally(() => {
|
|
1672
|
+
W.current = !1;
|
|
1668
1673
|
});
|
|
1669
1674
|
}
|
|
1670
1675
|
}));
|
|
1671
|
-
},
|
|
1672
|
-
var
|
|
1673
|
-
if (
|
|
1674
|
-
if (
|
|
1675
|
-
|
|
1676
|
+
}, ae = async (c, $) => {
|
|
1677
|
+
var ge, pe;
|
|
1678
|
+
if (W.current) return;
|
|
1679
|
+
if (S) {
|
|
1680
|
+
z.info(
|
|
1676
1681
|
o != null && o.as_user ? `Previewing as ${o.as_user.name}: moves are not made from a preview.` : "Previewing as a role: moves are not made from a preview."
|
|
1677
1682
|
);
|
|
1678
1683
|
return;
|
|
1679
1684
|
}
|
|
1680
1685
|
if (o != null && o.running_move) return;
|
|
1681
1686
|
if (g === c) {
|
|
1682
|
-
|
|
1687
|
+
x(null);
|
|
1683
1688
|
return;
|
|
1684
1689
|
}
|
|
1685
|
-
if (!($ != null && $.cleared) && ((o == null ? void 0 : o.available_transitions) ?? []).some((
|
|
1686
|
-
|
|
1690
|
+
if (!($ != null && $.cleared) && ((o == null ? void 0 : o.available_transitions) ?? []).some((ie) => ie.id === c && ie.advisory)) {
|
|
1691
|
+
x(null), u(null), re(c), C.invalidateQueries({ queryKey: ["pipeline-instance", t, e] });
|
|
1687
1692
|
return;
|
|
1688
1693
|
}
|
|
1689
|
-
if (
|
|
1690
|
-
|
|
1691
|
-
let
|
|
1694
|
+
if (re(null), v) {
|
|
1695
|
+
W.current = !0;
|
|
1696
|
+
let ie = !1;
|
|
1692
1697
|
try {
|
|
1693
|
-
|
|
1698
|
+
ie = await v();
|
|
1694
1699
|
} finally {
|
|
1695
|
-
|
|
1700
|
+
W.current = !1;
|
|
1696
1701
|
}
|
|
1697
|
-
if (!
|
|
1702
|
+
if (!ie) return;
|
|
1698
1703
|
}
|
|
1699
|
-
const
|
|
1700
|
-
if (
|
|
1701
|
-
if (
|
|
1702
|
-
|
|
1703
|
-
let
|
|
1704
|
+
const q = (B ?? []).find((ie) => ie.id === c), D = String((q == null ? void 0 : q.comment_mode) ?? "none"), Z = At(q, (o == null ? void 0 : o.states) ?? [], (ge = o == null ? void 0 : o.instance) == null ? void 0 : ge.current_state);
|
|
1705
|
+
if (D !== "optional" && D !== "required") {
|
|
1706
|
+
if (q && !et(q, (o == null ? void 0 : o.states) ?? [], (pe = o == null ? void 0 : o.instance) == null ? void 0 : pe.current_state)) {
|
|
1707
|
+
W.current = !0;
|
|
1708
|
+
let ie = [];
|
|
1704
1709
|
try {
|
|
1705
|
-
|
|
1710
|
+
ie = await U();
|
|
1706
1711
|
} finally {
|
|
1707
|
-
|
|
1712
|
+
W.current = !1;
|
|
1708
1713
|
}
|
|
1709
|
-
if (
|
|
1710
|
-
|
|
1714
|
+
if (ie.length > 0 || Z) {
|
|
1715
|
+
L(ie), x(c);
|
|
1711
1716
|
return;
|
|
1712
1717
|
}
|
|
1713
1718
|
}
|
|
1714
|
-
if (
|
|
1715
|
-
|
|
1719
|
+
if (Z) {
|
|
1720
|
+
L([]), x(c);
|
|
1716
1721
|
return;
|
|
1717
1722
|
}
|
|
1718
|
-
|
|
1723
|
+
Te({ transition_id: c });
|
|
1719
1724
|
return;
|
|
1720
1725
|
}
|
|
1721
|
-
|
|
1722
|
-
},
|
|
1723
|
-
queryKey:
|
|
1724
|
-
queryFn: () =>
|
|
1725
|
-
|
|
1726
|
-
`/pipelines/instance/${t}/${e}${k ? `?as_user=${encodeURIComponent(k)}` :
|
|
1726
|
+
L([]), x(c);
|
|
1727
|
+
}, te = k ? ["pipeline-instance", t, e, "as-user", k] : b ? ["pipeline-instance", t, e, b] : ["pipeline-instance", t, e], { settling: V, settle: we } = In(te), { data: o, isLoading: Ue } = ke({
|
|
1728
|
+
queryKey: te,
|
|
1729
|
+
queryFn: () => F.request(
|
|
1730
|
+
$e(
|
|
1731
|
+
`/pipelines/instance/${t}/${e}${k ? `?as_user=${encodeURIComponent(k)}` : b ? `?as_role=${encodeURIComponent(b)}` : ""}`
|
|
1727
1732
|
)
|
|
1728
1733
|
).then(
|
|
1729
1734
|
(c) => c.data ?? {
|
|
@@ -1741,7 +1746,7 @@ function oa({
|
|
|
1741
1746
|
wn(!!(o != null && o.running_move), () => {
|
|
1742
1747
|
ze(C, t, String(e)), He(C, t, String(e)), lt(C, t, String(e));
|
|
1743
1748
|
});
|
|
1744
|
-
const
|
|
1749
|
+
const Me = Un(
|
|
1745
1750
|
o ? (o.available_transitions ?? []).map((c) => String(c.id)) : null,
|
|
1746
1751
|
`${t}:${e}`
|
|
1747
1752
|
);
|
|
@@ -1753,43 +1758,43 @@ function oa({
|
|
|
1753
1758
|
}),
|
|
1754
1759
|
[C, t, e]
|
|
1755
1760
|
);
|
|
1756
|
-
const { data:
|
|
1761
|
+
const { data: me, isLoading: Pe } = ke({
|
|
1757
1762
|
queryKey: ["pipeline-all-owners", t, e],
|
|
1758
|
-
queryFn: () =>
|
|
1759
|
-
|
|
1763
|
+
queryFn: () => F.request(
|
|
1764
|
+
$e(`/pipelines/instance/${t}/${e}/owners/all`)
|
|
1760
1765
|
).then((c) => c.data ?? null),
|
|
1761
1766
|
// Also when a send back is on offer: its target may be a chain step this record skipped.
|
|
1762
1767
|
// And while a move is being confirmed: the panel names where it really lands.
|
|
1763
|
-
enabled: (
|
|
1768
|
+
enabled: (T || zn(o) || !!g) && !!(o != null && o.instance),
|
|
1764
1769
|
staleTime: 3e4
|
|
1765
|
-
}),
|
|
1766
|
-
if (!
|
|
1767
|
-
const c = Object.entries(
|
|
1770
|
+
}), m = it(() => {
|
|
1771
|
+
if (!me) return null;
|
|
1772
|
+
const c = Object.entries(me);
|
|
1768
1773
|
return c.length === 0 || c.every(([, $]) => $.on_path === void 0) ? null : new Set(c.filter(([, $]) => $.on_path !== !1).map(([$]) => $));
|
|
1769
|
-
}, [
|
|
1770
|
-
if (!
|
|
1774
|
+
}, [me]), E = it(() => {
|
|
1775
|
+
if (!me) return null;
|
|
1771
1776
|
const c = /* @__PURE__ */ new Map();
|
|
1772
|
-
for (const [$,
|
|
1773
|
-
|
|
1777
|
+
for (const [$, q] of Object.entries(me))
|
|
1778
|
+
q.skipped && c.set($, q.skip_reasons ?? []);
|
|
1774
1779
|
return c;
|
|
1775
|
-
}, [
|
|
1776
|
-
mutationFn: () =>
|
|
1780
|
+
}, [me]), X = Ge({
|
|
1781
|
+
mutationFn: () => F.request(Je(`/pipelines/instance/${t}/${e}/start`, {})),
|
|
1777
1782
|
onSuccess: () => {
|
|
1778
|
-
C.invalidateQueries({ queryKey:
|
|
1783
|
+
C.invalidateQueries({ queryKey: te }), z.success("Pipeline started");
|
|
1779
1784
|
},
|
|
1780
|
-
onError: () =>
|
|
1781
|
-
}),
|
|
1785
|
+
onError: () => z.error("Failed to start pipeline")
|
|
1786
|
+
}), j = Ge({
|
|
1782
1787
|
mutationFn: ({
|
|
1783
1788
|
transition_id: c,
|
|
1784
1789
|
comment: $,
|
|
1785
|
-
reviewed:
|
|
1786
|
-
lock_ack:
|
|
1787
|
-
}) =>
|
|
1790
|
+
reviewed: q,
|
|
1791
|
+
lock_ack: D
|
|
1792
|
+
}) => S ? Promise.reject(new Error("Moves are not made from a preview")) : F.request(
|
|
1788
1793
|
Je(`/pipelines/instance/${t}/${e}/transition`, {
|
|
1789
1794
|
transition_id: c,
|
|
1790
1795
|
comment: $,
|
|
1791
|
-
...
|
|
1792
|
-
...
|
|
1796
|
+
...q ? { reviewed: !0 } : {},
|
|
1797
|
+
...D ? { lock_ack: !0 } : {},
|
|
1793
1798
|
..._n(o == null ? void 0 : o.available_transitions, c)
|
|
1794
1799
|
})
|
|
1795
1800
|
),
|
|
@@ -1798,233 +1803,233 @@ function oa({
|
|
|
1798
1803
|
return {
|
|
1799
1804
|
slow: Vn(
|
|
1800
1805
|
($ = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
|
|
1801
|
-
(
|
|
1806
|
+
(q) => q.id === c.transition_id
|
|
1802
1807
|
)) == null ? void 0 : $.label
|
|
1803
1808
|
)
|
|
1804
1809
|
};
|
|
1805
1810
|
},
|
|
1806
|
-
onSuccess: (c, $,
|
|
1807
|
-
C.invalidateQueries({ queryKey:
|
|
1808
|
-
const
|
|
1809
|
-
|
|
1810
|
-
`${
|
|
1811
|
-
|
|
1812
|
-
) :
|
|
1811
|
+
onSuccess: (c, $, q) => {
|
|
1812
|
+
C.invalidateQueries({ queryKey: te }), t === "nivaro_addendums" && C.invalidateQueries({ queryKey: ["addendums"] }), ze(C, t, String(e)), He(C, t, String(e)), lt(C, t, String(e)), u(null), ee(""), x(null), w(null);
|
|
1813
|
+
const D = kn(c);
|
|
1814
|
+
D ? z.info(
|
|
1815
|
+
`${D.transition_label ?? "The move"} started. You will be told if it does not go through.`,
|
|
1816
|
+
q == null ? void 0 : q.slow.done()
|
|
1817
|
+
) : z.success(Gn(o, $.transition_id, c), q == null ? void 0 : q.slow.done());
|
|
1813
1818
|
},
|
|
1814
|
-
onError: (c, $,
|
|
1815
|
-
var
|
|
1816
|
-
if (
|
|
1817
|
-
C.invalidateQueries({ queryKey:
|
|
1819
|
+
onError: (c, $, q) => {
|
|
1820
|
+
var ie, Fe;
|
|
1821
|
+
if (q == null || q.slow.fail(), On(c)) {
|
|
1822
|
+
C.invalidateQueries({ queryKey: te });
|
|
1818
1823
|
return;
|
|
1819
1824
|
}
|
|
1820
1825
|
if (dt(c) === "TRANSITION_RUNNING") {
|
|
1821
|
-
C.invalidateQueries({ queryKey:
|
|
1826
|
+
C.invalidateQueries({ queryKey: te }), x(null), w(null), z.info(Ee(c, "This move is already running on this record."));
|
|
1822
1827
|
return;
|
|
1823
1828
|
}
|
|
1824
|
-
const
|
|
1825
|
-
if (
|
|
1826
|
-
|
|
1827
|
-
const
|
|
1829
|
+
const D = Bn(c);
|
|
1830
|
+
if (D) {
|
|
1831
|
+
x(null);
|
|
1832
|
+
const _e = ((ie = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
|
|
1828
1833
|
(tt) => tt.id === $.transition_id
|
|
1829
|
-
)) == null ? void 0 :
|
|
1830
|
-
|
|
1834
|
+
)) == null ? void 0 : ie.label) ?? "Move";
|
|
1835
|
+
z.warning(D.message, {
|
|
1831
1836
|
id: `nvr-locked-move:${t}:${String(e)}`,
|
|
1832
1837
|
duration: 2e4,
|
|
1833
1838
|
action: {
|
|
1834
|
-
label: `${
|
|
1835
|
-
onClick: () =>
|
|
1839
|
+
label: `${_e} anyway`,
|
|
1840
|
+
onClick: () => Te({ ...$, lock_ack: !0 })
|
|
1836
1841
|
},
|
|
1837
1842
|
cancel: { label: "Wait", onClick: () => {
|
|
1838
1843
|
} }
|
|
1839
1844
|
});
|
|
1840
1845
|
return;
|
|
1841
1846
|
}
|
|
1842
|
-
const
|
|
1843
|
-
if (
|
|
1844
|
-
|
|
1845
|
-
payload:
|
|
1847
|
+
const Z = Dn(c);
|
|
1848
|
+
if (Z) {
|
|
1849
|
+
w((_e) => ({
|
|
1850
|
+
payload: Z,
|
|
1846
1851
|
transitionId: $.transition_id,
|
|
1847
1852
|
comment: $.comment,
|
|
1848
|
-
revision: ((
|
|
1853
|
+
revision: ((_e == null ? void 0 : _e.revision) ?? 0) + 1
|
|
1849
1854
|
}));
|
|
1850
1855
|
return;
|
|
1851
1856
|
}
|
|
1852
|
-
const
|
|
1857
|
+
const ge = c == null ? void 0 : c.response;
|
|
1853
1858
|
u(En(c, $));
|
|
1854
|
-
const
|
|
1859
|
+
const pe = cn(
|
|
1855
1860
|
c,
|
|
1856
|
-
(
|
|
1857
|
-
(
|
|
1858
|
-
)) == null ? void 0 :
|
|
1861
|
+
(Fe = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
|
|
1862
|
+
(_e) => _e.id === $.transition_id
|
|
1863
|
+
)) == null ? void 0 : Fe.label
|
|
1859
1864
|
);
|
|
1860
|
-
|
|
1865
|
+
z.error((pe == null ? void 0 : pe.title) ?? Ee(c, "Failed to execute transition"), {
|
|
1861
1866
|
duration: 12e3,
|
|
1862
1867
|
// What to do next + Copy details (lib/error-toast.ts); "Why?" below wins the action slot.
|
|
1863
1868
|
// A partner's refusal copies what the toast said and the other system's answer as
|
|
1864
1869
|
// stored, never the generic reading of a 422.
|
|
1865
|
-
...dn(
|
|
1870
|
+
...dn(pe ? un(c, pe) : c, {
|
|
1866
1871
|
action: "Transition"
|
|
1867
1872
|
}),
|
|
1868
|
-
...
|
|
1873
|
+
...pe ? { description: pe.description } : {},
|
|
1869
1874
|
// #1867: a refusal carries "Why?" — the role, owner or access rule
|
|
1870
1875
|
// that stopped it, and who can change it.
|
|
1871
1876
|
...vn(c) ? {
|
|
1872
|
-
action: xn(
|
|
1877
|
+
action: xn(F, {
|
|
1873
1878
|
collection: t,
|
|
1874
1879
|
itemId: String(e),
|
|
1875
1880
|
action: "transition",
|
|
1876
1881
|
transitionId: $.transition_id
|
|
1877
1882
|
})
|
|
1878
1883
|
} : {}
|
|
1879
|
-
}),
|
|
1884
|
+
}), w(null), x(null), ze(C, t, String(e)), He(C, t, String(e)), (ge == null ? void 0 : ge.status) === 409 && C.invalidateQueries({ queryKey: te });
|
|
1880
1885
|
}
|
|
1881
|
-
}),
|
|
1882
|
-
|
|
1883
|
-
const
|
|
1884
|
-
if (
|
|
1886
|
+
}), l = xe(ae);
|
|
1887
|
+
l.current = ae;
|
|
1888
|
+
const h = xe((o == null ? void 0 : o.available_transitions) ?? []);
|
|
1889
|
+
if (h.current = (o == null ? void 0 : o.available_transitions) ?? [], Be(() => {
|
|
1885
1890
|
const c = ($) => {
|
|
1886
|
-
const
|
|
1887
|
-
if (!
|
|
1888
|
-
|
|
1889
|
-
const
|
|
1890
|
-
if (!
|
|
1891
|
-
|
|
1891
|
+
const q = $.detail;
|
|
1892
|
+
if (!q || q.claimed || S || q.collection !== t || String(q.item) !== String(e)) return;
|
|
1893
|
+
q.claimed = !0;
|
|
1894
|
+
const D = String(q.transition_id).toUpperCase(), Z = h.current.find((ge) => String(ge.id).toUpperCase() === D);
|
|
1895
|
+
if (!Z) {
|
|
1896
|
+
z.error("That step is not available from where the record is now");
|
|
1892
1897
|
return;
|
|
1893
1898
|
}
|
|
1894
|
-
|
|
1899
|
+
l.current(Z.id);
|
|
1895
1900
|
};
|
|
1896
1901
|
return window.addEventListener(ot, c), () => window.removeEventListener(ot, c);
|
|
1897
|
-
}, [t, e,
|
|
1898
|
-
return /* @__PURE__ */ n("div", { className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */
|
|
1899
|
-
/* @__PURE__ */ n(
|
|
1900
|
-
/* @__PURE__ */ n(
|
|
1901
|
-
/* @__PURE__ */ n(
|
|
1902
|
-
/* @__PURE__ */ n(
|
|
1902
|
+
}, [t, e, S]), Ue)
|
|
1903
|
+
return /* @__PURE__ */ n("div", { className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ s("div", { className: "flex w-full items-center gap-2.5 px-5 py-3.5", children: [
|
|
1904
|
+
/* @__PURE__ */ n(Ae, { className: "h-3.5 w-3.5 shrink-0 rounded" }),
|
|
1905
|
+
/* @__PURE__ */ n(Ae, { className: "h-4 w-20" }),
|
|
1906
|
+
/* @__PURE__ */ n(Ae, { className: "h-[22px] w-40 rounded-full" }),
|
|
1907
|
+
/* @__PURE__ */ n(Ae, { className: "ml-auto h-3.5 w-3.5 rounded" })
|
|
1903
1908
|
] }) });
|
|
1904
1909
|
if (!(o != null && o.binding)) return null;
|
|
1905
|
-
const { instance: f, available_transitions:
|
|
1910
|
+
const { instance: f, available_transitions: B, history: O, states: H } = o, Y = new Map((H ?? []).map((c) => [c.id, c])), K = (f == null ? void 0 : f.current_state_obj) ?? null, J = g ? (B ?? []).find((c) => c.id === g) : null, N = J ? Y.get(J.to_state) : null, se = er(J, K, H, me), De = (se == null ? void 0 : se.state) ?? N, ct = f != null && f.completed_at && B ? B.filter(
|
|
1906
1911
|
(c) => c.from_state && String(c.from_state).toUpperCase() === String(f.current_state).toUpperCase()
|
|
1907
1912
|
) : null, Re = f != null && f.completed_at ? ct ?? [] : Hn(
|
|
1908
|
-
|
|
1909
|
-
|
|
1913
|
+
B ?? [],
|
|
1914
|
+
H ?? [],
|
|
1910
1915
|
f == null ? void 0 : f.current_state,
|
|
1911
|
-
|
|
1912
|
-
), ut = Sn(Re, o.blocked_transitions), mt = ut.length > 0, Ot = Mn(Re), Ve =
|
|
1913
|
-
const
|
|
1914
|
-
for (const
|
|
1915
|
-
const
|
|
1916
|
-
|
|
1916
|
+
E
|
|
1917
|
+
), ut = Sn(Re, o.blocked_transitions), mt = ut.length > 0, Ot = Mn(Re), Ve = he ? Re.find((c) => c.id === he) : null, qe = (o == null ? void 0 : o.running_move) ?? null, Xe = qe ? null : (o == null ? void 0 : o.last_move_problem) ?? null, Dt = Xe ? Re.find((c) => Ct(c.id, Xe.transition_id)) : null, Bt = (c, $ = !1) => {
|
|
1918
|
+
const q = /* @__PURE__ */ new Map();
|
|
1919
|
+
for (const D of c) {
|
|
1920
|
+
const Z = q.get(D.label) ?? [];
|
|
1921
|
+
Z.push(D), q.set(D.label, Z);
|
|
1917
1922
|
}
|
|
1918
|
-
return Array.from(
|
|
1919
|
-
var
|
|
1920
|
-
const
|
|
1921
|
-
(
|
|
1922
|
-
var
|
|
1923
|
-
return (((
|
|
1923
|
+
return Array.from(q.entries()).map(([D, Z]) => {
|
|
1924
|
+
var _e, tt, Qt;
|
|
1925
|
+
const ge = ((_e = Z[0]) == null ? void 0 : _e.color) ?? null, pe = Z.some((A) => A.id === g), ie = (A) => ge ? A ? { backgroundColor: ge, borderColor: ge } : { borderColor: ge, color: ge } : void 0, Fe = [...Z].sort(
|
|
1926
|
+
(A, ye) => {
|
|
1927
|
+
var Le, Ye;
|
|
1928
|
+
return (((Le = Y.get(A.to_state)) == null ? void 0 : Le.sort) ?? 999) - (((Ye = Y.get(ye.to_state)) == null ? void 0 : Ye.sort) ?? 999);
|
|
1924
1929
|
}
|
|
1925
1930
|
);
|
|
1926
|
-
if (
|
|
1931
|
+
if (Z.every(Cn))
|
|
1927
1932
|
return /* @__PURE__ */ n(
|
|
1928
|
-
|
|
1933
|
+
$n,
|
|
1929
1934
|
{
|
|
1930
|
-
label:
|
|
1935
|
+
label: D,
|
|
1931
1936
|
small: $,
|
|
1932
|
-
code: (tt =
|
|
1937
|
+
code: (tt = Fe[0].blocked) == null ? void 0 : tt.code,
|
|
1933
1938
|
reason: Tn(
|
|
1934
|
-
|
|
1935
|
-
(
|
|
1936
|
-
var
|
|
1937
|
-
return ((
|
|
1939
|
+
Fe,
|
|
1940
|
+
(A) => {
|
|
1941
|
+
var ye;
|
|
1942
|
+
return ((ye = Y.get(Fe[A].to_state)) == null ? void 0 : ye.label) ?? Fe[A].to_state;
|
|
1938
1943
|
}
|
|
1939
1944
|
)
|
|
1940
1945
|
},
|
|
1941
|
-
|
|
1946
|
+
D
|
|
1942
1947
|
);
|
|
1943
|
-
if (
|
|
1944
|
-
const
|
|
1945
|
-
|
|
1948
|
+
if (Z.length === 1) {
|
|
1949
|
+
const A = Z[0], ye = j.isPending && ((Qt = j.variables) == null ? void 0 : Qt.transition_id) === A.id || Ct(qe == null ? void 0 : qe.transition_id, A.id), Le = Nn(Xe, A.id), Ye = /* @__PURE__ */ s(
|
|
1950
|
+
fe,
|
|
1946
1951
|
{
|
|
1947
1952
|
size: "sm",
|
|
1948
|
-
variant:
|
|
1949
|
-
className:
|
|
1953
|
+
variant: pe && !A.advisory ? "default" : "outline",
|
|
1954
|
+
className: ce(
|
|
1950
1955
|
$ ? "h-7 text-[11px]" : "text-[12px]",
|
|
1951
1956
|
"gap-1.5 data-[fresh=true]:opacity-60",
|
|
1952
|
-
|
|
1957
|
+
A.advisory && Xn
|
|
1953
1958
|
),
|
|
1954
|
-
style:
|
|
1955
|
-
disabled:
|
|
1956
|
-
"aria-disabled":
|
|
1957
|
-
"data-fresh":
|
|
1958
|
-
...
|
|
1959
|
-
...Ke(
|
|
1959
|
+
style: A.advisory ? void 0 : ie(pe),
|
|
1960
|
+
disabled: j.isPending || V || !!qe || !!Le,
|
|
1961
|
+
"aria-disabled": Me.dimmed(A.id) || void 0,
|
|
1962
|
+
"data-fresh": Me.dimmed(A.id) || void 0,
|
|
1963
|
+
...Me.bind(A.id),
|
|
1964
|
+
...Ke(A),
|
|
1960
1965
|
onClick: () => {
|
|
1961
|
-
|
|
1966
|
+
Me.press(A.id) && ae(A.id);
|
|
1962
1967
|
},
|
|
1963
1968
|
children: [
|
|
1964
|
-
|
|
1965
|
-
|
|
1969
|
+
ye ? /* @__PURE__ */ n(Se, { className: "h-3 w-3 animate-spin" }) : A.advisory && /* @__PURE__ */ n(Ne, {}),
|
|
1970
|
+
D
|
|
1966
1971
|
]
|
|
1967
1972
|
},
|
|
1968
|
-
|
|
1973
|
+
D
|
|
1969
1974
|
);
|
|
1970
|
-
return
|
|
1975
|
+
return Le ? /* @__PURE__ */ n("span", { className: "inline-flex", "data-tip": Le, "data-move-held": !0, children: Ye }, D) : Ye;
|
|
1971
1976
|
}
|
|
1972
|
-
return /* @__PURE__ */
|
|
1973
|
-
/* @__PURE__ */ n(yt, { asChild: !0, children: /* @__PURE__ */
|
|
1974
|
-
|
|
1977
|
+
return /* @__PURE__ */ s(xt, { children: [
|
|
1978
|
+
/* @__PURE__ */ n(yt, { asChild: !0, children: /* @__PURE__ */ s(
|
|
1979
|
+
fe,
|
|
1975
1980
|
{
|
|
1976
1981
|
size: "sm",
|
|
1977
|
-
variant:
|
|
1982
|
+
variant: pe ? "default" : "outline",
|
|
1978
1983
|
className: `${$ ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5`,
|
|
1979
|
-
style:
|
|
1980
|
-
disabled:
|
|
1984
|
+
style: ie(pe),
|
|
1985
|
+
disabled: j.isPending || V || !!qe,
|
|
1981
1986
|
children: [
|
|
1982
|
-
|
|
1983
|
-
|
|
1987
|
+
Z.every((A) => A.advisory) && /* @__PURE__ */ n(Ne, {}),
|
|
1988
|
+
D,
|
|
1984
1989
|
/* @__PURE__ */ n(We, { className: "h-3 w-3" })
|
|
1985
1990
|
]
|
|
1986
1991
|
}
|
|
1987
1992
|
) }),
|
|
1988
|
-
/* @__PURE__ */
|
|
1989
|
-
|
|
1990
|
-
var
|
|
1991
|
-
return /* @__PURE__ */
|
|
1993
|
+
/* @__PURE__ */ s(wt, { align: "start", children: [
|
|
1994
|
+
Fe.map((A) => {
|
|
1995
|
+
var ye;
|
|
1996
|
+
return /* @__PURE__ */ s(
|
|
1992
1997
|
nt,
|
|
1993
1998
|
{
|
|
1994
|
-
onSelect: () =>
|
|
1995
|
-
...Ke(
|
|
1996
|
-
...at(
|
|
1999
|
+
onSelect: () => ae(A.id),
|
|
2000
|
+
...Ke(A, "menu"),
|
|
2001
|
+
...at(A),
|
|
1997
2002
|
children: [
|
|
1998
|
-
|
|
2003
|
+
A.color && /* @__PURE__ */ n(
|
|
1999
2004
|
"span",
|
|
2000
2005
|
{
|
|
2001
|
-
className:
|
|
2006
|
+
className: ce(
|
|
2002
2007
|
"mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
|
|
2003
|
-
|
|
2008
|
+
A.blocked && "opacity-40"
|
|
2004
2009
|
),
|
|
2005
|
-
style: { backgroundColor:
|
|
2010
|
+
style: { backgroundColor: A.color }
|
|
2006
2011
|
}
|
|
2007
2012
|
),
|
|
2008
|
-
((
|
|
2009
|
-
|
|
2010
|
-
|
|
2013
|
+
((ye = Y.get(A.to_state)) == null ? void 0 : ye.label) ?? A.to_state,
|
|
2014
|
+
A.advisory && /* @__PURE__ */ n(Ne, { className: "ml-auto" }),
|
|
2015
|
+
A.blocked && /* @__PURE__ */ n(rt, {})
|
|
2011
2016
|
]
|
|
2012
2017
|
},
|
|
2013
|
-
|
|
2018
|
+
A.id
|
|
2014
2019
|
);
|
|
2015
2020
|
}),
|
|
2016
2021
|
/* @__PURE__ */ n(
|
|
2017
2022
|
Mt,
|
|
2018
2023
|
{
|
|
2019
|
-
moves:
|
|
2020
|
-
nameOf: (
|
|
2021
|
-
var
|
|
2022
|
-
return ((
|
|
2024
|
+
moves: Z,
|
|
2025
|
+
nameOf: (A) => {
|
|
2026
|
+
var ye;
|
|
2027
|
+
return ((ye = Y.get(A.to_state)) == null ? void 0 : ye.label) ?? A.to_state;
|
|
2023
2028
|
}
|
|
2024
2029
|
}
|
|
2025
2030
|
)
|
|
2026
2031
|
] })
|
|
2027
|
-
] },
|
|
2032
|
+
] }, D);
|
|
2028
2033
|
});
|
|
2029
2034
|
}, pt = R ? /* @__PURE__ */ n(
|
|
2030
2035
|
Jn,
|
|
@@ -2033,33 +2038,33 @@ function oa({
|
|
|
2033
2038
|
item: String(e),
|
|
2034
2039
|
offer: R,
|
|
2035
2040
|
onDismiss: () => u(null),
|
|
2036
|
-
onFixed: () =>
|
|
2041
|
+
onFixed: () => Te({ transition_id: R.transitionId, comment: R.comment })
|
|
2037
2042
|
}
|
|
2038
|
-
) : null, rr =
|
|
2039
|
-
Ot.map(({ advisory: $, moves:
|
|
2043
|
+
) : null, rr = T && !y && !!f && mt, Et = (c) => /* @__PURE__ */ s(Ce, { children: [
|
|
2044
|
+
Ot.map(({ advisory: $, moves: q }) => /* @__PURE__ */ n(
|
|
2040
2045
|
qn,
|
|
2041
2046
|
{
|
|
2042
2047
|
collection: t,
|
|
2043
2048
|
item: String(e),
|
|
2044
2049
|
advisory: $,
|
|
2045
|
-
armedMove: Ve &&
|
|
2050
|
+
armedMove: Ve && q.some((D) => D.id === Ve.id) ? {
|
|
2046
2051
|
id: Ve.id,
|
|
2047
2052
|
label: Ve.label,
|
|
2048
|
-
confirms: Yn(Ve,
|
|
2053
|
+
confirms: Yn(Ve, H ?? [], f == null ? void 0 : f.current_state)
|
|
2049
2054
|
} : null,
|
|
2050
|
-
stops: Ot.length > 1 ? [...new Set(
|
|
2055
|
+
stops: Ot.length > 1 ? [...new Set(q.map((D) => D.label))] : void 0,
|
|
2051
2056
|
className: c ? "rounded-lg border border-amber-200/80 px-3 dark:border-amber-500/20" : void 0,
|
|
2052
|
-
onDismiss: () =>
|
|
2053
|
-
onFixed: (
|
|
2054
|
-
|
|
2057
|
+
onDismiss: () => re(null),
|
|
2058
|
+
onFixed: (D) => {
|
|
2059
|
+
re(null), C.invalidateQueries({ queryKey: te }), D && ae(D.id, { cleared: !0 });
|
|
2055
2060
|
}
|
|
2056
2061
|
},
|
|
2057
2062
|
`${$.code}:${$.message}`
|
|
2058
2063
|
)),
|
|
2059
|
-
|
|
2064
|
+
qe && /* @__PURE__ */ n(
|
|
2060
2065
|
qr,
|
|
2061
2066
|
{
|
|
2062
|
-
run:
|
|
2067
|
+
run: qe,
|
|
2063
2068
|
className: c ? "rounded-lg border border-sky-200/80 px-3 dark:border-sky-500/20" : void 0
|
|
2064
2069
|
}
|
|
2065
2070
|
),
|
|
@@ -2067,88 +2072,88 @@ function oa({
|
|
|
2067
2072
|
Pr,
|
|
2068
2073
|
{
|
|
2069
2074
|
problem: Xe,
|
|
2070
|
-
retryDisabled:
|
|
2071
|
-
onRetry: Dt ? () => void
|
|
2075
|
+
retryDisabled: j.isPending || V,
|
|
2076
|
+
onRetry: Dt ? () => void ae(Dt.id) : void 0,
|
|
2072
2077
|
className: c ? "rounded-lg border border-amber-200/80 px-3 dark:border-amber-500/20" : void 0
|
|
2073
2078
|
}
|
|
2074
2079
|
)
|
|
2075
|
-
] }), It =
|
|
2076
|
-
/* @__PURE__ */
|
|
2080
|
+
] }), It = na(O ?? [], f == null ? void 0 : f.current_state, H ?? []), Ut = /* @__PURE__ */ s("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: [
|
|
2081
|
+
/* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
2077
2082
|
/* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
|
|
2078
|
-
|
|
2079
|
-
K && De && /* @__PURE__ */
|
|
2083
|
+
J && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: J.label }),
|
|
2084
|
+
K && De && /* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-1.5", children: [
|
|
2080
2085
|
/* @__PURE__ */ n(Oe, { label: K.label, color: K.color, small: !0 }),
|
|
2081
2086
|
/* @__PURE__ */ n(qt, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
2082
2087
|
/* @__PURE__ */ n(Oe, { label: De.label, color: De.color, small: !0 })
|
|
2083
2088
|
] })
|
|
2084
2089
|
] }),
|
|
2085
2090
|
/* @__PURE__ */ n(tr, { landing: se }),
|
|
2086
|
-
/* @__PURE__ */ n(Wn, { collection: t, item: String(e), tx:
|
|
2091
|
+
/* @__PURE__ */ n(Wn, { collection: t, item: String(e), tx: J }),
|
|
2087
2092
|
/* @__PURE__ */ n(nr, { collection: t, item: e, omitLines: de }),
|
|
2088
2093
|
/* @__PURE__ */ n(Qn, { lines: de }),
|
|
2089
2094
|
/* @__PURE__ */ n(
|
|
2090
2095
|
"input",
|
|
2091
2096
|
{
|
|
2092
2097
|
type: "text",
|
|
2093
|
-
value:
|
|
2094
|
-
onChange: (c) =>
|
|
2095
|
-
placeholder: String((
|
|
2098
|
+
value: ue,
|
|
2099
|
+
onChange: (c) => ee(c.target.value),
|
|
2100
|
+
placeholder: String((J == null ? void 0 : J.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
|
|
2096
2101
|
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"
|
|
2097
2102
|
}
|
|
2098
2103
|
),
|
|
2099
|
-
/* @__PURE__ */
|
|
2104
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-2", children: [
|
|
2100
2105
|
/* @__PURE__ */ n(
|
|
2101
|
-
|
|
2106
|
+
fe,
|
|
2102
2107
|
{
|
|
2103
2108
|
type: "button",
|
|
2104
2109
|
size: "sm",
|
|
2105
2110
|
variant: "ghost",
|
|
2106
2111
|
className: "h-7 text-[12px]",
|
|
2107
|
-
onClick: () =>
|
|
2112
|
+
onClick: () => x(null),
|
|
2108
2113
|
children: "Cancel"
|
|
2109
2114
|
}
|
|
2110
2115
|
),
|
|
2111
2116
|
/* @__PURE__ */ n(
|
|
2112
|
-
|
|
2117
|
+
fe,
|
|
2113
2118
|
{
|
|
2114
2119
|
type: "button",
|
|
2115
2120
|
size: "sm",
|
|
2116
2121
|
className: "h-7 gap-1.5 text-[12px]",
|
|
2117
|
-
disabled:
|
|
2118
|
-
onClick: () =>
|
|
2122
|
+
disabled: j.isPending || !!qe || String((J == null ? void 0 : J.comment_mode) ?? "") === "required" && ue.trim() === "",
|
|
2123
|
+
onClick: () => Te({
|
|
2119
2124
|
transition_id: g,
|
|
2120
|
-
comment:
|
|
2125
|
+
comment: ue.trim() || void 0
|
|
2121
2126
|
}),
|
|
2122
|
-
children:
|
|
2123
|
-
/* @__PURE__ */ n("span", { children: de.length > 0 &&
|
|
2127
|
+
children: j.isPending ? /* @__PURE__ */ n(Se, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ s(Ce, { children: [
|
|
2128
|
+
/* @__PURE__ */ n("span", { children: de.length > 0 && J ? `${J.label} anyway` : "Confirm" }),
|
|
2124
2129
|
/* @__PURE__ */ n(Pt, { className: "h-3 w-3" })
|
|
2125
2130
|
] })
|
|
2126
2131
|
}
|
|
2127
2132
|
)
|
|
2128
2133
|
] })
|
|
2129
2134
|
] });
|
|
2130
|
-
return /* @__PURE__ */
|
|
2131
|
-
/* @__PURE__ */
|
|
2135
|
+
return /* @__PURE__ */ s(Ce, { children: [
|
|
2136
|
+
/* @__PURE__ */ s(
|
|
2132
2137
|
"div",
|
|
2133
2138
|
{
|
|
2134
2139
|
className: `overflow-hidden rounded-xl border bg-white dark:bg-card ${_ ? "border-amber-300 dark:border-amber-600/50" : "border-slate-200 dark:border-border"}`,
|
|
2135
2140
|
children: [
|
|
2136
|
-
/* @__PURE__ */
|
|
2141
|
+
/* @__PURE__ */ s(
|
|
2137
2142
|
"div",
|
|
2138
2143
|
{
|
|
2139
2144
|
role: "button",
|
|
2140
2145
|
tabIndex: 0,
|
|
2141
|
-
onClick: () =>
|
|
2142
|
-
onKeyDown: (c) => (c.key === "Enter" || c.key === " ") &&
|
|
2146
|
+
onClick: () => Q((c) => !c),
|
|
2147
|
+
onKeyDown: (c) => (c.key === "Enter" || c.key === " ") && Q(($) => !$),
|
|
2143
2148
|
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]",
|
|
2144
2149
|
children: [
|
|
2145
2150
|
/* @__PURE__ */ n(ht, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
2146
2151
|
/* @__PURE__ */ n("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: a || "Pipeline" }),
|
|
2147
|
-
/* @__PURE__ */
|
|
2152
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
|
|
2148
2153
|
_ && /* @__PURE__ */ n("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" }),
|
|
2149
2154
|
K && /* @__PURE__ */ n(Oe, { label: K.label, color: K.color }),
|
|
2150
|
-
/* @__PURE__ */ n(
|
|
2151
|
-
(((
|
|
2155
|
+
/* @__PURE__ */ n(ea, { flags: o == null ? void 0 : o.flags }),
|
|
2156
|
+
(((Lt = o == null ? void 0 : o.auto_held) == null ? void 0 : Lt.length) ?? 0) > 0 && /* @__PURE__ */ s(
|
|
2152
2157
|
"span",
|
|
2153
2158
|
{
|
|
2154
2159
|
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",
|
|
@@ -2161,46 +2166,46 @@ function oa({
|
|
|
2161
2166
|
]
|
|
2162
2167
|
}
|
|
2163
2168
|
),
|
|
2164
|
-
p && /* @__PURE__ */
|
|
2169
|
+
p && /* @__PURE__ */ s("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: [
|
|
2165
2170
|
/* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 animate-pulse shrink-0" }),
|
|
2166
2171
|
"Addendum in review"
|
|
2167
2172
|
] }),
|
|
2168
|
-
|
|
2173
|
+
ve.length > 0 && /* @__PURE__ */ s(
|
|
2169
2174
|
"span",
|
|
2170
2175
|
{
|
|
2171
2176
|
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",
|
|
2172
2177
|
"data-pipeline-approving": !0,
|
|
2173
2178
|
children: [
|
|
2174
2179
|
/* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-sky-400" }),
|
|
2175
|
-
gr(
|
|
2180
|
+
gr(ve, "approving")
|
|
2176
2181
|
]
|
|
2177
2182
|
}
|
|
2178
2183
|
)
|
|
2179
2184
|
] }),
|
|
2180
|
-
/* @__PURE__ */
|
|
2181
|
-
!
|
|
2182
|
-
!
|
|
2183
|
-
|
|
2185
|
+
/* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-2", onClick: (c) => c.stopPropagation(), children: [
|
|
2186
|
+
!T && mt && !d && /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1.5", children: Bt(ut, !0) }),
|
|
2187
|
+
!T && !f && (o == null ? void 0 : o.binding) && /* @__PURE__ */ s(
|
|
2188
|
+
fe,
|
|
2184
2189
|
{
|
|
2185
2190
|
size: "sm",
|
|
2186
2191
|
variant: "outline",
|
|
2187
2192
|
className: "h-7 gap-1.5 text-[11px]",
|
|
2188
2193
|
onClick: (c) => {
|
|
2189
|
-
c.stopPropagation(),
|
|
2194
|
+
c.stopPropagation(), X.mutate();
|
|
2190
2195
|
},
|
|
2191
|
-
disabled:
|
|
2196
|
+
disabled: X.isPending,
|
|
2192
2197
|
children: [
|
|
2193
|
-
|
|
2198
|
+
X.isPending ? /* @__PURE__ */ n(Se, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(ht, { className: "h-3 w-3" }),
|
|
2194
2199
|
"Start"
|
|
2195
2200
|
]
|
|
2196
2201
|
}
|
|
2197
2202
|
),
|
|
2198
|
-
|
|
2199
|
-
|
|
2203
|
+
i && ((o == null ? void 0 : o.binding) || (o == null ? void 0 : o.instance)) && /* @__PURE__ */ n(
|
|
2204
|
+
la,
|
|
2200
2205
|
{
|
|
2201
2206
|
collection: t,
|
|
2202
2207
|
item: e,
|
|
2203
|
-
states:
|
|
2208
|
+
states: H ?? [],
|
|
2204
2209
|
currentStateId: ((jt = o == null ? void 0 : o.instance) == null ? void 0 : jt.current_state) ?? null
|
|
2205
2210
|
}
|
|
2206
2211
|
)
|
|
@@ -2208,9 +2213,9 @@ function oa({
|
|
|
2208
2213
|
/* @__PURE__ */ n(
|
|
2209
2214
|
We,
|
|
2210
2215
|
{
|
|
2211
|
-
className:
|
|
2216
|
+
className: ce(
|
|
2212
2217
|
"h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150",
|
|
2213
|
-
|
|
2218
|
+
T && "rotate-180"
|
|
2214
2219
|
)
|
|
2215
2220
|
}
|
|
2216
2221
|
)
|
|
@@ -2218,44 +2223,44 @@ function oa({
|
|
|
2218
2223
|
}
|
|
2219
2224
|
),
|
|
2220
2225
|
!rr && Et(!1),
|
|
2221
|
-
!
|
|
2222
|
-
!
|
|
2223
|
-
It && !(f != null && f.completed_at) && /* @__PURE__ */ n(
|
|
2224
|
-
|
|
2225
|
-
/* @__PURE__ */ n(
|
|
2226
|
-
p && /* @__PURE__ */
|
|
2226
|
+
!T && g && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: Ut }),
|
|
2227
|
+
!T && pt && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: pt }),
|
|
2228
|
+
It && !(f != null && f.completed_at) && /* @__PURE__ */ n(ra, { entry: It }),
|
|
2229
|
+
T && /* @__PURE__ */ s("div", { className: "border-t border-slate-100 dark:border-border/60", children: [
|
|
2230
|
+
/* @__PURE__ */ n(Hr, { held: (o == null ? void 0 : o.auto_held) ?? [] }),
|
|
2231
|
+
p && /* @__PURE__ */ s("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: [
|
|
2227
2232
|
/* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
|
|
2228
2233
|
/* @__PURE__ */ n("p", { className: "text-[12px] text-amber-700 dark:text-amber-400", children: "An addendum is in review — coordinate transitions carefully." })
|
|
2229
2234
|
] }),
|
|
2230
|
-
f ? /* @__PURE__ */
|
|
2231
|
-
(
|
|
2232
|
-
|
|
2235
|
+
f ? /* @__PURE__ */ s("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: [
|
|
2236
|
+
(H ?? []).length > 1 && /* @__PURE__ */ s("div", { className: "space-y-3 px-5 py-4", children: [
|
|
2237
|
+
Pe ? (
|
|
2233
2238
|
// Path pruning arrives with the owners query — rendering
|
|
2234
2239
|
// the UNPRUNED track first meant every state briefly
|
|
2235
2240
|
// showed, then snapped into formation. Hold a same-height
|
|
2236
2241
|
// placeholder until the real shape is known.
|
|
2237
|
-
/* @__PURE__ */
|
|
2238
|
-
[0, 1, 2, 3, 4].map((c) => /* @__PURE__ */
|
|
2239
|
-
/* @__PURE__ */ n(
|
|
2240
|
-
c < 4 && /* @__PURE__ */ n(
|
|
2242
|
+
/* @__PURE__ */ s("div", { className: "flex h-[52px] items-center gap-2", children: [
|
|
2243
|
+
[0, 1, 2, 3, 4].map((c) => /* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
|
|
2244
|
+
/* @__PURE__ */ n(Ae, { className: "h-7 w-7 rounded-full" }),
|
|
2245
|
+
c < 4 && /* @__PURE__ */ n(Ae, { className: "h-0.5 w-10" })
|
|
2241
2246
|
] }, c)),
|
|
2242
|
-
/* @__PURE__ */ n(
|
|
2247
|
+
/* @__PURE__ */ n(Ae, { className: "ml-2 h-3 w-24" })
|
|
2243
2248
|
] })
|
|
2244
2249
|
) : /* @__PURE__ */ n(
|
|
2245
|
-
|
|
2250
|
+
sa,
|
|
2246
2251
|
{
|
|
2247
|
-
states:
|
|
2252
|
+
states: H,
|
|
2248
2253
|
allTransitions: (o == null ? void 0 : o.all_transitions) ?? [],
|
|
2249
|
-
availableTransitions:
|
|
2254
|
+
availableTransitions: B ?? [],
|
|
2250
2255
|
currentStateId: f.current_state,
|
|
2251
2256
|
history: O ?? [],
|
|
2252
|
-
onPathIds:
|
|
2253
|
-
skippedStates:
|
|
2257
|
+
onPathIds: m,
|
|
2258
|
+
skippedStates: E
|
|
2254
2259
|
}
|
|
2255
2260
|
),
|
|
2256
2261
|
(o == null ? void 0 : o.branches) && /* @__PURE__ */ n(Rr, { data: o.branches }),
|
|
2257
2262
|
/* @__PURE__ */ n(
|
|
2258
|
-
|
|
2263
|
+
aa,
|
|
2259
2264
|
{
|
|
2260
2265
|
history: O ?? [],
|
|
2261
2266
|
completedAt: f.completed_at,
|
|
@@ -2264,51 +2269,52 @@ function oa({
|
|
|
2264
2269
|
}
|
|
2265
2270
|
)
|
|
2266
2271
|
] }),
|
|
2267
|
-
/* @__PURE__ */
|
|
2272
|
+
/* @__PURE__ */ s("div", { className: "space-y-3 px-5 py-4", children: [
|
|
2268
2273
|
!f.completed_at && /* @__PURE__ */ n(jr, { collection: t, itemId: String(e) }),
|
|
2269
2274
|
!f.completed_at && /* @__PURE__ */ n(Er, { summaries: o == null ? void 0 : o.sign_offs }),
|
|
2270
2275
|
/* @__PURE__ */ n(
|
|
2271
|
-
|
|
2276
|
+
oa,
|
|
2272
2277
|
{
|
|
2273
2278
|
collection: t,
|
|
2274
2279
|
item: e,
|
|
2275
|
-
states:
|
|
2280
|
+
states: H ?? [],
|
|
2276
2281
|
currentStateId: ((Kt = o == null ? void 0 : o.instance) == null ? void 0 : Kt.current_state) ?? null,
|
|
2277
2282
|
returned: ((o == null ? void 0 : o.history) ?? []).some(
|
|
2278
2283
|
(c) => {
|
|
2279
2284
|
var $;
|
|
2280
2285
|
return !!c.from_state && c.to_state === (($ = o == null ? void 0 : o.instance) == null ? void 0 : $.current_state);
|
|
2281
2286
|
}
|
|
2282
|
-
)
|
|
2287
|
+
),
|
|
2288
|
+
standInReason: (o == null ? void 0 : o.stand_in_reason) ?? null
|
|
2283
2289
|
}
|
|
2284
2290
|
)
|
|
2285
2291
|
] }),
|
|
2286
|
-
mt && !
|
|
2292
|
+
mt && !y && /* @__PURE__ */ s("div", { className: "space-y-3 px-5 py-4", children: [
|
|
2287
2293
|
Et(!0),
|
|
2288
2294
|
/* @__PURE__ */ n("div", { className: "flex flex-wrap justify-end gap-2", children: Bt(ut) }),
|
|
2289
|
-
g &&
|
|
2295
|
+
g && Ut,
|
|
2290
2296
|
pt
|
|
2291
2297
|
] }),
|
|
2292
|
-
/* @__PURE__ */
|
|
2293
|
-
/* @__PURE__ */
|
|
2298
|
+
/* @__PURE__ */ s("div", { className: "px-5 py-3", children: [
|
|
2299
|
+
/* @__PURE__ */ s(
|
|
2294
2300
|
"button",
|
|
2295
2301
|
{
|
|
2296
2302
|
type: "button",
|
|
2297
2303
|
className: "flex items-center gap-1.5 text-[12px] text-slate-400 transition-colors hover:text-slate-600",
|
|
2298
|
-
onClick: () =>
|
|
2304
|
+
onClick: () => M((c) => !c),
|
|
2299
2305
|
children: [
|
|
2300
2306
|
/* @__PURE__ */ n(
|
|
2301
2307
|
We,
|
|
2302
2308
|
{
|
|
2303
|
-
className:
|
|
2309
|
+
className: ce(
|
|
2304
2310
|
"h-3.5 w-3.5 transition-transform duration-200",
|
|
2305
|
-
|
|
2311
|
+
P && "rotate-180"
|
|
2306
2312
|
)
|
|
2307
2313
|
}
|
|
2308
2314
|
),
|
|
2309
2315
|
"Transition history",
|
|
2310
2316
|
" ",
|
|
2311
|
-
/* @__PURE__ */
|
|
2317
|
+
/* @__PURE__ */ s("span", { className: "tabular-nums", children: [
|
|
2312
2318
|
"(",
|
|
2313
2319
|
(O == null ? void 0 : O.length) ?? 0,
|
|
2314
2320
|
")"
|
|
@@ -2316,8 +2322,8 @@ function oa({
|
|
|
2316
2322
|
]
|
|
2317
2323
|
}
|
|
2318
2324
|
),
|
|
2319
|
-
|
|
2320
|
-
|
|
2325
|
+
P && /* @__PURE__ */ n("div", { className: "mt-3", children: /* @__PURE__ */ n(
|
|
2326
|
+
ia,
|
|
2321
2327
|
{
|
|
2322
2328
|
history: O ?? [],
|
|
2323
2329
|
collection: t,
|
|
@@ -2326,33 +2332,33 @@ function oa({
|
|
|
2326
2332
|
}
|
|
2327
2333
|
) })
|
|
2328
2334
|
] }),
|
|
2329
|
-
|
|
2335
|
+
oe && (H ?? []).length > 1 && /* @__PURE__ */ n("div", { className: "px-5 py-3", ref: ne, children: /* @__PURE__ */ n(
|
|
2330
2336
|
Br,
|
|
2331
2337
|
{
|
|
2332
2338
|
collection: t,
|
|
2333
2339
|
item: e,
|
|
2334
|
-
states:
|
|
2340
|
+
states: H ?? [],
|
|
2335
2341
|
currentStateId: f.current_state ?? null,
|
|
2336
2342
|
openSignal: le,
|
|
2337
2343
|
onMoved: () => {
|
|
2338
|
-
C.invalidateQueries({ queryKey:
|
|
2344
|
+
C.invalidateQueries({ queryKey: te }), C.invalidateQueries({
|
|
2339
2345
|
queryKey: ["pipeline-instance", t, e]
|
|
2340
2346
|
});
|
|
2341
2347
|
}
|
|
2342
2348
|
}
|
|
2343
2349
|
) })
|
|
2344
|
-
] }) : /* @__PURE__ */
|
|
2350
|
+
] }) : /* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-4 px-5 py-4", children: [
|
|
2345
2351
|
/* @__PURE__ */ n("p", { className: "text-[13px] text-slate-500", children: "Pipeline not started for this record." }),
|
|
2346
|
-
/* @__PURE__ */
|
|
2347
|
-
|
|
2352
|
+
/* @__PURE__ */ s(
|
|
2353
|
+
fe,
|
|
2348
2354
|
{
|
|
2349
2355
|
size: "sm",
|
|
2350
2356
|
variant: "outline",
|
|
2351
2357
|
className: "shrink-0 gap-1.5 text-[12px]",
|
|
2352
|
-
onClick: () =>
|
|
2353
|
-
disabled:
|
|
2358
|
+
onClick: () => X.mutate(),
|
|
2359
|
+
disabled: X.isPending,
|
|
2354
2360
|
children: [
|
|
2355
|
-
|
|
2361
|
+
X.isPending ? /* @__PURE__ */ n(Se, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ n(ht, { className: "h-3.5 w-3.5" }),
|
|
2356
2362
|
"Start Pipeline"
|
|
2357
2363
|
]
|
|
2358
2364
|
}
|
|
@@ -2362,130 +2368,130 @@ function oa({
|
|
|
2362
2368
|
]
|
|
2363
2369
|
}
|
|
2364
2370
|
),
|
|
2365
|
-
|
|
2366
|
-
|
|
2371
|
+
I && /* @__PURE__ */ n(sn, { fallback: null, children: /* @__PURE__ */ n(
|
|
2372
|
+
An,
|
|
2367
2373
|
{
|
|
2368
|
-
payload:
|
|
2369
|
-
transitionId:
|
|
2370
|
-
isRetry:
|
|
2374
|
+
payload: I.payload,
|
|
2375
|
+
transitionId: I.transitionId,
|
|
2376
|
+
isRetry: I.revision > 1,
|
|
2371
2377
|
onSubmitted: () => (
|
|
2372
2378
|
// mutateAsync so the dialog can stay busy until the transition
|
|
2373
2379
|
// settles; the mutation's own onError/onSuccess handle the outcome.
|
|
2374
|
-
|
|
2375
|
-
transition_id:
|
|
2376
|
-
comment:
|
|
2380
|
+
j.mutateAsync({
|
|
2381
|
+
transition_id: I.transitionId,
|
|
2382
|
+
comment: I.comment,
|
|
2377
2383
|
reviewed: !0
|
|
2378
2384
|
}).catch(() => {
|
|
2379
2385
|
})
|
|
2380
2386
|
),
|
|
2381
|
-
executing:
|
|
2382
|
-
onClose: () =>
|
|
2387
|
+
executing: j.isPending,
|
|
2388
|
+
onClose: () => w(null)
|
|
2383
2389
|
},
|
|
2384
|
-
|
|
2390
|
+
I.revision
|
|
2385
2391
|
) })
|
|
2386
2392
|
] });
|
|
2387
2393
|
}
|
|
2388
|
-
function
|
|
2394
|
+
function Ja({
|
|
2389
2395
|
collection: t,
|
|
2390
2396
|
item: e,
|
|
2391
2397
|
onBeforeTransition: r,
|
|
2392
2398
|
wrap: a = !0,
|
|
2393
|
-
asRole:
|
|
2394
|
-
asUser:
|
|
2399
|
+
asRole: i,
|
|
2400
|
+
asUser: d
|
|
2395
2401
|
}) {
|
|
2396
2402
|
return e === "new" ? null : /* @__PURE__ */ n(
|
|
2397
|
-
|
|
2403
|
+
ca,
|
|
2398
2404
|
{
|
|
2399
2405
|
collection: t,
|
|
2400
2406
|
item: e,
|
|
2401
2407
|
onBeforeTransition: r,
|
|
2402
2408
|
wrap: a,
|
|
2403
|
-
asRole:
|
|
2404
|
-
asUser:
|
|
2409
|
+
asRole: i,
|
|
2410
|
+
asUser: d
|
|
2405
2411
|
}
|
|
2406
2412
|
);
|
|
2407
2413
|
}
|
|
2408
|
-
function
|
|
2414
|
+
function ca({
|
|
2409
2415
|
collection: t,
|
|
2410
2416
|
item: e,
|
|
2411
2417
|
onBeforeTransition: r,
|
|
2412
2418
|
wrap: a = !0,
|
|
2413
|
-
asRole:
|
|
2414
|
-
asUser:
|
|
2419
|
+
asRole: i,
|
|
2420
|
+
asUser: d
|
|
2415
2421
|
}) {
|
|
2416
|
-
const
|
|
2417
|
-
mn(t, e, "transition", !!k || !!
|
|
2418
|
-
const
|
|
2419
|
-
|
|
2420
|
-
onSettled: (
|
|
2422
|
+
const y = !!i || !!d, v = Ie(), p = Ze(), [_, b] = G(""), [k, S] = G(null), [F, C] = G(null), [oe, le] = G(null), [be, ne] = G(null), [ue, ee] = G([]), g = Kn(t, String(e));
|
|
2423
|
+
mn(t, e, "transition", !!k || !!F);
|
|
2424
|
+
const x = xe(null), P = _r(x, !a), M = xe(!1), T = (l) => {
|
|
2425
|
+
M.current || y || (M.current = !0, le(null), L.mutate(l, {
|
|
2426
|
+
onSettled: (h, f) => {
|
|
2421
2427
|
if (f) {
|
|
2422
|
-
|
|
2428
|
+
M.current = !1;
|
|
2423
2429
|
return;
|
|
2424
2430
|
}
|
|
2425
2431
|
R().finally(() => {
|
|
2426
|
-
|
|
2432
|
+
M.current = !1;
|
|
2427
2433
|
});
|
|
2428
2434
|
}
|
|
2429
2435
|
}));
|
|
2430
|
-
},
|
|
2431
|
-
var
|
|
2432
|
-
if (
|
|
2433
|
-
if (
|
|
2434
|
-
|
|
2436
|
+
}, Q = async (l, h) => {
|
|
2437
|
+
var H, Y;
|
|
2438
|
+
if (M.current) return;
|
|
2439
|
+
if (y) {
|
|
2440
|
+
z.info(
|
|
2435
2441
|
u != null && u.as_user ? `Previewing as ${u.as_user.name}: moves are not made from a preview.` : "Previewing as a role: moves are not made from a preview."
|
|
2436
2442
|
);
|
|
2437
2443
|
return;
|
|
2438
2444
|
}
|
|
2439
2445
|
if (u != null && u.running_move) return;
|
|
2440
|
-
if (k ===
|
|
2441
|
-
|
|
2446
|
+
if (k === l) {
|
|
2447
|
+
S(null);
|
|
2442
2448
|
return;
|
|
2443
2449
|
}
|
|
2444
|
-
if (!(
|
|
2445
|
-
|
|
2450
|
+
if (!(h != null && h.cleared) && ((u == null ? void 0 : u.available_transitions) ?? []).some((K) => K.id === l && K.advisory)) {
|
|
2451
|
+
S(null), le(null), ne(l), p.invalidateQueries({ queryKey: ["pipeline-instance", t, e] });
|
|
2446
2452
|
return;
|
|
2447
2453
|
}
|
|
2448
|
-
if (
|
|
2449
|
-
|
|
2454
|
+
if (ne(null), r) {
|
|
2455
|
+
M.current = !0;
|
|
2450
2456
|
let K = !1;
|
|
2451
2457
|
try {
|
|
2452
2458
|
K = await r();
|
|
2453
2459
|
} finally {
|
|
2454
|
-
|
|
2460
|
+
M.current = !1;
|
|
2455
2461
|
}
|
|
2456
2462
|
if (!K) return;
|
|
2457
2463
|
}
|
|
2458
|
-
const f = (
|
|
2459
|
-
if (
|
|
2460
|
-
if (f && !et(f, (u == null ? void 0 : u.states) ?? [], (
|
|
2461
|
-
|
|
2464
|
+
const f = (W ?? []).find((K) => K.id === l), B = String((f == null ? void 0 : f.comment_mode) ?? "none"), O = At(f, (u == null ? void 0 : u.states) ?? [], (H = u == null ? void 0 : u.instance) == null ? void 0 : H.current_state);
|
|
2465
|
+
if (B !== "optional" && B !== "required") {
|
|
2466
|
+
if (f && !et(f, (u == null ? void 0 : u.states) ?? [], (Y = u == null ? void 0 : u.instance) == null ? void 0 : Y.current_state)) {
|
|
2467
|
+
M.current = !0;
|
|
2462
2468
|
let K = [];
|
|
2463
2469
|
try {
|
|
2464
2470
|
K = await g();
|
|
2465
2471
|
} finally {
|
|
2466
|
-
|
|
2472
|
+
M.current = !1;
|
|
2467
2473
|
}
|
|
2468
2474
|
if (K.length > 0 || O) {
|
|
2469
|
-
|
|
2475
|
+
ee(K), S(l);
|
|
2470
2476
|
return;
|
|
2471
2477
|
}
|
|
2472
2478
|
}
|
|
2473
2479
|
if (O) {
|
|
2474
|
-
|
|
2480
|
+
ee([]), S(l);
|
|
2475
2481
|
return;
|
|
2476
2482
|
}
|
|
2477
|
-
|
|
2483
|
+
T({ transition_id: l });
|
|
2478
2484
|
return;
|
|
2479
2485
|
}
|
|
2480
|
-
|
|
2481
|
-
},
|
|
2482
|
-
queryKey:
|
|
2483
|
-
queryFn: () =>
|
|
2484
|
-
|
|
2485
|
-
`/pipelines/instance/${t}/${e}${
|
|
2486
|
+
ee([]), S(l);
|
|
2487
|
+
}, I = d ? ["pipeline-instance", t, e, "as-user", d] : i ? ["pipeline-instance", t, e, i] : ["pipeline-instance", t, e], { settling: w, settle: R } = In(I), { data: u } = ke({
|
|
2488
|
+
queryKey: I,
|
|
2489
|
+
queryFn: () => v.request(
|
|
2490
|
+
$e(
|
|
2491
|
+
`/pipelines/instance/${t}/${e}${d ? `?as_user=${encodeURIComponent(d)}` : i ? `?as_role=${encodeURIComponent(i)}` : ""}`
|
|
2486
2492
|
)
|
|
2487
2493
|
).then(
|
|
2488
|
-
(
|
|
2494
|
+
(l) => l.data ?? {
|
|
2489
2495
|
instance: null,
|
|
2490
2496
|
states: [],
|
|
2491
2497
|
available_transitions: [],
|
|
@@ -2495,254 +2501,254 @@ function la({
|
|
|
2495
2501
|
}
|
|
2496
2502
|
),
|
|
2497
2503
|
staleTime: 1e4,
|
|
2498
|
-
refetchInterval: (
|
|
2504
|
+
refetchInterval: (l) => yn(l.state.data)
|
|
2499
2505
|
});
|
|
2500
2506
|
wn(!!(u != null && u.running_move), () => {
|
|
2501
2507
|
ze(p, t, String(e)), He(p, t, String(e)), lt(p, t, String(e));
|
|
2502
2508
|
});
|
|
2503
|
-
const
|
|
2504
|
-
u ? (u.available_transitions ?? []).map((
|
|
2509
|
+
const he = Un(
|
|
2510
|
+
u ? (u.available_transitions ?? []).map((l) => String(l.id)) : null,
|
|
2505
2511
|
`${t}:${e}`
|
|
2506
|
-
), { data:
|
|
2512
|
+
), { data: re } = ke({
|
|
2507
2513
|
queryKey: ["pipeline-all-owners", t, e],
|
|
2508
|
-
queryFn: () =>
|
|
2509
|
-
|
|
2510
|
-
).then((
|
|
2514
|
+
queryFn: () => v.request(
|
|
2515
|
+
$e(`/pipelines/instance/${t}/${e}/owners/all`)
|
|
2516
|
+
).then((l) => l.data ?? null),
|
|
2511
2517
|
// Also while a move is being confirmed: the panel names where it really lands.
|
|
2512
2518
|
enabled: zn(u) || !!k,
|
|
2513
2519
|
staleTime: 3e4
|
|
2514
|
-
}), de =
|
|
2515
|
-
if (!
|
|
2516
|
-
const
|
|
2517
|
-
for (const [
|
|
2518
|
-
f.skipped &&
|
|
2519
|
-
return
|
|
2520
|
-
}, [
|
|
2520
|
+
}), de = it(() => {
|
|
2521
|
+
if (!re) return null;
|
|
2522
|
+
const l = /* @__PURE__ */ new Map();
|
|
2523
|
+
for (const [h, f] of Object.entries(re))
|
|
2524
|
+
f.skipped && l.set(h, f.skip_reasons ?? []);
|
|
2525
|
+
return l;
|
|
2526
|
+
}, [re]), L = Ge({
|
|
2521
2527
|
mutationFn: ({
|
|
2522
|
-
transition_id:
|
|
2523
|
-
comment:
|
|
2528
|
+
transition_id: l,
|
|
2529
|
+
comment: h,
|
|
2524
2530
|
reviewed: f,
|
|
2525
|
-
lock_ack:
|
|
2526
|
-
}) =>
|
|
2531
|
+
lock_ack: B
|
|
2532
|
+
}) => y ? Promise.reject(new Error("Moves are not made from a preview")) : v.request(
|
|
2527
2533
|
Je(`/pipelines/instance/${t}/${e}/transition`, {
|
|
2528
|
-
transition_id:
|
|
2529
|
-
comment:
|
|
2534
|
+
transition_id: l,
|
|
2535
|
+
comment: h,
|
|
2530
2536
|
...f ? { reviewed: !0 } : {},
|
|
2531
|
-
...
|
|
2532
|
-
..._n(u == null ? void 0 : u.available_transitions,
|
|
2537
|
+
...B ? { lock_ack: !0 } : {},
|
|
2538
|
+
..._n(u == null ? void 0 : u.available_transitions, l)
|
|
2533
2539
|
})
|
|
2534
2540
|
),
|
|
2535
|
-
onMutate: (
|
|
2536
|
-
var
|
|
2541
|
+
onMutate: (l) => {
|
|
2542
|
+
var h;
|
|
2537
2543
|
return {
|
|
2538
2544
|
slow: Vn(
|
|
2539
|
-
(
|
|
2540
|
-
(f) => f.id ===
|
|
2541
|
-
)) == null ? void 0 :
|
|
2545
|
+
(h = [...(u == null ? void 0 : u.available_transitions) ?? [], ...(u == null ? void 0 : u.all_transitions) ?? []].find(
|
|
2546
|
+
(f) => f.id === l.transition_id
|
|
2547
|
+
)) == null ? void 0 : h.label
|
|
2542
2548
|
)
|
|
2543
2549
|
};
|
|
2544
2550
|
},
|
|
2545
|
-
onSuccess: (
|
|
2546
|
-
p.invalidateQueries({ queryKey:
|
|
2547
|
-
const
|
|
2548
|
-
|
|
2549
|
-
`${
|
|
2551
|
+
onSuccess: (l, h, f) => {
|
|
2552
|
+
p.invalidateQueries({ queryKey: I }), t === "nivaro_addendums" && p.invalidateQueries({ queryKey: ["addendums"] }), ze(p, t, String(e)), He(p, t, String(e)), lt(p, t, String(e)), le(null), b(""), S(null), C(null);
|
|
2553
|
+
const B = kn(l);
|
|
2554
|
+
B ? z.info(
|
|
2555
|
+
`${B.transition_label ?? "The move"} started. You will be told if it does not go through.`,
|
|
2550
2556
|
f == null ? void 0 : f.slow.done()
|
|
2551
|
-
) :
|
|
2557
|
+
) : z.success(Gn(u, h.transition_id, l), f == null ? void 0 : f.slow.done());
|
|
2552
2558
|
},
|
|
2553
|
-
onError: (
|
|
2554
|
-
var K,
|
|
2555
|
-
if (f == null || f.slow.fail(), On(
|
|
2556
|
-
p.invalidateQueries({ queryKey:
|
|
2559
|
+
onError: (l, h, f) => {
|
|
2560
|
+
var K, J;
|
|
2561
|
+
if (f == null || f.slow.fail(), On(l)) {
|
|
2562
|
+
p.invalidateQueries({ queryKey: I });
|
|
2557
2563
|
return;
|
|
2558
2564
|
}
|
|
2559
|
-
if (dt(
|
|
2560
|
-
p.invalidateQueries({ queryKey:
|
|
2565
|
+
if (dt(l) === "TRANSITION_RUNNING") {
|
|
2566
|
+
p.invalidateQueries({ queryKey: I }), S(null), C(null), z.info(Ee(l, "This move is already running on this record."));
|
|
2561
2567
|
return;
|
|
2562
2568
|
}
|
|
2563
|
-
const
|
|
2564
|
-
if (
|
|
2565
|
-
|
|
2566
|
-
const
|
|
2567
|
-
(se) => se.id ===
|
|
2569
|
+
const B = Bn(l);
|
|
2570
|
+
if (B) {
|
|
2571
|
+
S(null);
|
|
2572
|
+
const N = ((K = [...(u == null ? void 0 : u.available_transitions) ?? [], ...(u == null ? void 0 : u.all_transitions) ?? []].find(
|
|
2573
|
+
(se) => se.id === h.transition_id
|
|
2568
2574
|
)) == null ? void 0 : K.label) ?? "Move";
|
|
2569
|
-
|
|
2575
|
+
z.warning(B.message, {
|
|
2570
2576
|
id: `nvr-locked-move:${t}:${String(e)}`,
|
|
2571
2577
|
duration: 2e4,
|
|
2572
2578
|
action: {
|
|
2573
|
-
label: `${
|
|
2574
|
-
onClick: () =>
|
|
2579
|
+
label: `${N} anyway`,
|
|
2580
|
+
onClick: () => T({ ...h, lock_ack: !0 })
|
|
2575
2581
|
},
|
|
2576
2582
|
cancel: { label: "Wait", onClick: () => {
|
|
2577
2583
|
} }
|
|
2578
2584
|
});
|
|
2579
2585
|
return;
|
|
2580
2586
|
}
|
|
2581
|
-
const O = Dn(
|
|
2587
|
+
const O = Dn(l);
|
|
2582
2588
|
if (O) {
|
|
2583
|
-
C((
|
|
2589
|
+
C((N) => ({
|
|
2584
2590
|
payload: O,
|
|
2585
|
-
transitionId:
|
|
2586
|
-
comment:
|
|
2587
|
-
revision: ((
|
|
2591
|
+
transitionId: h.transition_id,
|
|
2592
|
+
comment: h.comment,
|
|
2593
|
+
revision: ((N == null ? void 0 : N.revision) ?? 0) + 1
|
|
2588
2594
|
}));
|
|
2589
2595
|
return;
|
|
2590
2596
|
}
|
|
2591
|
-
const
|
|
2592
|
-
le(En(
|
|
2593
|
-
const
|
|
2594
|
-
|
|
2595
|
-
(
|
|
2596
|
-
(
|
|
2597
|
-
)) == null ? void 0 :
|
|
2597
|
+
const H = l == null ? void 0 : l.response;
|
|
2598
|
+
le(En(l, h));
|
|
2599
|
+
const Y = cn(
|
|
2600
|
+
l,
|
|
2601
|
+
(J = [...(u == null ? void 0 : u.available_transitions) ?? [], ...(u == null ? void 0 : u.all_transitions) ?? []].find(
|
|
2602
|
+
(N) => N.id === h.transition_id
|
|
2603
|
+
)) == null ? void 0 : J.label
|
|
2598
2604
|
);
|
|
2599
|
-
|
|
2605
|
+
z.error((Y == null ? void 0 : Y.title) ?? Ee(l, "Failed to execute transition"), {
|
|
2600
2606
|
duration: 12e3,
|
|
2601
2607
|
// What to do next + Copy details (lib/error-toast.ts); "Why?" below wins the action slot.
|
|
2602
2608
|
// A partner's refusal copies what the toast said and the other system's answer as
|
|
2603
2609
|
// stored, never the generic reading of a 422.
|
|
2604
|
-
...dn(
|
|
2610
|
+
...dn(Y ? un(l, Y) : l, {
|
|
2605
2611
|
action: "Transition"
|
|
2606
2612
|
}),
|
|
2607
|
-
...
|
|
2613
|
+
...Y ? { description: Y.description } : {},
|
|
2608
2614
|
// #1867: a refusal carries "Why?" — the role, owner or access rule
|
|
2609
2615
|
// that stopped it, and who can change it.
|
|
2610
|
-
...vn(
|
|
2611
|
-
action: xn(
|
|
2616
|
+
...vn(l) ? {
|
|
2617
|
+
action: xn(v, {
|
|
2612
2618
|
collection: t,
|
|
2613
2619
|
itemId: String(e),
|
|
2614
2620
|
action: "transition",
|
|
2615
|
-
transitionId:
|
|
2621
|
+
transitionId: h.transition_id
|
|
2616
2622
|
})
|
|
2617
2623
|
} : {}
|
|
2618
|
-
}), C(null),
|
|
2624
|
+
}), C(null), S(null), ze(p, t, String(e)), He(p, t, String(e)), (H == null ? void 0 : H.status) === 409 && p.invalidateQueries({ queryKey: I });
|
|
2619
2625
|
}
|
|
2620
|
-
}),
|
|
2621
|
-
|
|
2622
|
-
const
|
|
2623
|
-
if (
|
|
2624
|
-
const
|
|
2625
|
-
const f =
|
|
2626
|
-
if (!f || f.claimed ||
|
|
2626
|
+
}), U = xe(Q);
|
|
2627
|
+
U.current = Q;
|
|
2628
|
+
const ve = xe((u == null ? void 0 : u.available_transitions) ?? []);
|
|
2629
|
+
if (ve.current = (u == null ? void 0 : u.available_transitions) ?? [], Be(() => {
|
|
2630
|
+
const l = (h) => {
|
|
2631
|
+
const f = h.detail;
|
|
2632
|
+
if (!f || f.claimed || y || f.collection !== t || String(f.item) !== String(e)) return;
|
|
2627
2633
|
f.claimed = !0;
|
|
2628
|
-
const
|
|
2634
|
+
const B = String(f.transition_id).toUpperCase(), O = ve.current.find((H) => String(H.id).toUpperCase() === B);
|
|
2629
2635
|
if (!O) {
|
|
2630
|
-
|
|
2636
|
+
z.error("That step is not available from where the record is now");
|
|
2631
2637
|
return;
|
|
2632
2638
|
}
|
|
2633
|
-
|
|
2639
|
+
U.current(O.id);
|
|
2634
2640
|
};
|
|
2635
|
-
return window.addEventListener(ot,
|
|
2636
|
-
}, [t, e,
|
|
2637
|
-
const
|
|
2641
|
+
return window.addEventListener(ot, l), () => window.removeEventListener(ot, l);
|
|
2642
|
+
}, [t, e, y]), !(u != null && u.binding) || !(u != null && u.instance)) return null;
|
|
2643
|
+
const W = Hn(
|
|
2638
2644
|
(u.available_transitions ?? []).filter(
|
|
2639
|
-
(
|
|
2645
|
+
(l) => !u.instance.completed_at || l.from_state && String(l.from_state).toUpperCase() === String(u.instance.current_state).toUpperCase()
|
|
2640
2646
|
),
|
|
2641
2647
|
u.states ?? [],
|
|
2642
2648
|
u.instance.current_state,
|
|
2643
2649
|
u.instance.completed_at ? null : de
|
|
2644
|
-
),
|
|
2645
|
-
if (
|
|
2646
|
-
const
|
|
2647
|
-
for (const
|
|
2648
|
-
const
|
|
2649
|
-
|
|
2650
|
+
), Te = Sn(W, u.blocked_transitions);
|
|
2651
|
+
if (Te.length === 0) return null;
|
|
2652
|
+
const ae = new Map((u.states ?? []).map((l) => [l.id, l])), te = u.instance.current_state_obj ?? null, V = k ? W.find((l) => l.id === k) : null, we = be ? W.find((l) => l.id === be) : null, o = u.running_move ?? null, Ue = o ? Mr(o) : void 0, Me = V ? ae.get(V.to_state) : null, me = er(V, te, u.states ?? [], re), Pe = (me == null ? void 0 : me.state) ?? Me, m = /* @__PURE__ */ new Map();
|
|
2653
|
+
for (const l of Te) {
|
|
2654
|
+
const h = m.get(l.label) ?? [];
|
|
2655
|
+
h.push(l), m.set(l.label, h);
|
|
2650
2656
|
}
|
|
2651
|
-
const
|
|
2652
|
-
(
|
|
2653
|
-
var
|
|
2654
|
-
return (((
|
|
2657
|
+
const E = (l) => [...l].sort(
|
|
2658
|
+
(h, f) => {
|
|
2659
|
+
var B, O;
|
|
2660
|
+
return (((B = ae.get(h.to_state)) == null ? void 0 : B.sort) ?? 999) - (((O = ae.get(f.to_state)) == null ? void 0 : O.sort) ?? 999);
|
|
2655
2661
|
}
|
|
2656
|
-
),
|
|
2657
|
-
var
|
|
2658
|
-
return ((
|
|
2659
|
-
},
|
|
2660
|
-
var f,
|
|
2661
|
-
const
|
|
2662
|
-
if (!
|
|
2663
|
-
const
|
|
2664
|
-
return Math.max(260, Math.min(600,
|
|
2662
|
+
), X = (l) => {
|
|
2663
|
+
var h;
|
|
2664
|
+
return ((h = ae.get(l.to_state)) == null ? void 0 : h.label) ?? l.to_state;
|
|
2665
|
+
}, j = (() => {
|
|
2666
|
+
var f, B, O;
|
|
2667
|
+
const l = (f = x.current) == null ? void 0 : f.getBoundingClientRect();
|
|
2668
|
+
if (!l) return 600;
|
|
2669
|
+
const h = (O = (B = x.current) == null ? void 0 : B.closest('[role="dialog"]')) == null ? void 0 : O.getBoundingClientRect();
|
|
2670
|
+
return Math.max(260, Math.min(600, l.right - ((h == null ? void 0 : h.left) ?? 0) - 12));
|
|
2665
2671
|
})();
|
|
2666
|
-
return /* @__PURE__ */
|
|
2667
|
-
|
|
2668
|
-
/* @__PURE__ */ n(yt, { asChild: !0, children: /* @__PURE__ */
|
|
2669
|
-
|
|
2672
|
+
return /* @__PURE__ */ s("div", { ref: x, className: "relative", "data-tip": Ue, children: [
|
|
2673
|
+
P ? /* @__PURE__ */ s(xt, { children: [
|
|
2674
|
+
/* @__PURE__ */ n(yt, { asChild: !0, children: /* @__PURE__ */ s(
|
|
2675
|
+
fe,
|
|
2670
2676
|
{
|
|
2671
2677
|
size: "sm",
|
|
2672
2678
|
variant: "outline",
|
|
2673
2679
|
className: "shrink-0 gap-1.5 text-[12px]",
|
|
2674
|
-
disabled:
|
|
2680
|
+
disabled: L.isPending || w || !!o,
|
|
2675
2681
|
"data-transitions-folded": !0,
|
|
2676
2682
|
children: [
|
|
2677
|
-
|
|
2683
|
+
L.isPending || o ? /* @__PURE__ */ n(Se, { className: "h-3 w-3 animate-spin" }) : W.length > 0 && W.every((l) => l.advisory) && /* @__PURE__ */ n(Ne, {}),
|
|
2678
2684
|
"Actions",
|
|
2679
2685
|
/* @__PURE__ */ n(We, { className: "h-3 w-3" })
|
|
2680
2686
|
]
|
|
2681
2687
|
}
|
|
2682
2688
|
) }),
|
|
2683
|
-
/* @__PURE__ */
|
|
2684
|
-
Array.from(
|
|
2685
|
-
([
|
|
2686
|
-
f > 0 &&
|
|
2687
|
-
/* @__PURE__ */
|
|
2689
|
+
/* @__PURE__ */ s(wt, { align: "end", className: "min-w-[200px]", children: [
|
|
2690
|
+
Array.from(m.entries()).map(
|
|
2691
|
+
([l, h], f, B) => h.length === 1 ? /* @__PURE__ */ s(Ht, { children: [
|
|
2692
|
+
f > 0 && B[f - 1][1].length > 1 && /* @__PURE__ */ n(kt, {}),
|
|
2693
|
+
/* @__PURE__ */ s(
|
|
2688
2694
|
nt,
|
|
2689
2695
|
{
|
|
2690
|
-
onSelect: () =>
|
|
2691
|
-
...Ke(
|
|
2692
|
-
...at(
|
|
2696
|
+
onSelect: () => Q(h[0].id),
|
|
2697
|
+
...Ke(h[0], "menu"),
|
|
2698
|
+
...at(h[0]),
|
|
2693
2699
|
children: [
|
|
2694
|
-
|
|
2700
|
+
h[0].color && /* @__PURE__ */ n(
|
|
2695
2701
|
"span",
|
|
2696
2702
|
{
|
|
2697
|
-
className:
|
|
2703
|
+
className: ce(
|
|
2698
2704
|
"mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
|
|
2699
|
-
|
|
2705
|
+
h[0].blocked && "opacity-40"
|
|
2700
2706
|
),
|
|
2701
|
-
style: { backgroundColor:
|
|
2707
|
+
style: { backgroundColor: h[0].color }
|
|
2702
2708
|
}
|
|
2703
2709
|
),
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2710
|
+
l,
|
|
2711
|
+
h[0].advisory && /* @__PURE__ */ n(Ne, { className: "ml-auto" }),
|
|
2712
|
+
h[0].blocked && /* @__PURE__ */ n(rt, {})
|
|
2707
2713
|
]
|
|
2708
2714
|
}
|
|
2709
2715
|
)
|
|
2710
|
-
] },
|
|
2716
|
+
] }, l) : /* @__PURE__ */ s(Ht, { children: [
|
|
2711
2717
|
f > 0 && /* @__PURE__ */ n(kt, {}),
|
|
2712
|
-
/* @__PURE__ */ n(
|
|
2713
|
-
|
|
2718
|
+
/* @__PURE__ */ n(Cr, { className: "text-[11px] text-muted-foreground", children: l }),
|
|
2719
|
+
E(h).map((O) => /* @__PURE__ */ s(
|
|
2714
2720
|
nt,
|
|
2715
2721
|
{
|
|
2716
|
-
onSelect: () =>
|
|
2722
|
+
onSelect: () => Q(O.id),
|
|
2717
2723
|
...Ke(O, "menu"),
|
|
2718
2724
|
...at(O),
|
|
2719
2725
|
children: [
|
|
2720
2726
|
O.color && /* @__PURE__ */ n(
|
|
2721
2727
|
"span",
|
|
2722
2728
|
{
|
|
2723
|
-
className:
|
|
2729
|
+
className: ce(
|
|
2724
2730
|
"mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
|
|
2725
2731
|
O.blocked && "opacity-40"
|
|
2726
2732
|
),
|
|
2727
2733
|
style: { backgroundColor: O.color }
|
|
2728
2734
|
}
|
|
2729
2735
|
),
|
|
2730
|
-
|
|
2731
|
-
O.advisory && /* @__PURE__ */ n(
|
|
2736
|
+
X(O),
|
|
2737
|
+
O.advisory && /* @__PURE__ */ n(Ne, { className: "ml-auto" }),
|
|
2732
2738
|
O.blocked && /* @__PURE__ */ n(rt, {})
|
|
2733
2739
|
]
|
|
2734
2740
|
},
|
|
2735
2741
|
O.id
|
|
2736
2742
|
))
|
|
2737
|
-
] },
|
|
2743
|
+
] }, l)
|
|
2738
2744
|
),
|
|
2739
2745
|
/* @__PURE__ */ n(
|
|
2740
2746
|
Mt,
|
|
2741
2747
|
{
|
|
2742
|
-
moves:
|
|
2743
|
-
nameOf: (
|
|
2744
|
-
var
|
|
2745
|
-
return (((
|
|
2748
|
+
moves: W,
|
|
2749
|
+
nameOf: (l) => {
|
|
2750
|
+
var h, f;
|
|
2751
|
+
return (((h = m.get(l.label)) == null ? void 0 : h.length) ?? 0) > 1 ? ((f = ae.get(l.to_state)) == null ? void 0 : f.label) ?? l.to_state : l.label;
|
|
2746
2752
|
}
|
|
2747
2753
|
}
|
|
2748
2754
|
)
|
|
@@ -2751,175 +2757,175 @@ function la({
|
|
|
2751
2757
|
"div",
|
|
2752
2758
|
{
|
|
2753
2759
|
className: a ? "flex flex-wrap justify-end gap-2" : "flex shrink-0 items-center justify-end gap-2",
|
|
2754
|
-
children: Array.from(
|
|
2755
|
-
var
|
|
2756
|
-
const f =
|
|
2760
|
+
children: Array.from(m.entries()).map(([l, h]) => {
|
|
2761
|
+
var Y, K, J;
|
|
2762
|
+
const f = h.some((N) => {
|
|
2757
2763
|
var se;
|
|
2758
|
-
return (((se =
|
|
2759
|
-
}),
|
|
2760
|
-
if (
|
|
2761
|
-
const
|
|
2764
|
+
return (((se = N.order_partners) == null ? void 0 : se.length) ?? 0) > 0;
|
|
2765
|
+
}), B = f ? null : ((Y = h[0]) == null ? void 0 : Y.color) ?? null, O = h.some((N) => N.id === k), H = (N) => B ? N ? { backgroundColor: B, borderColor: B } : { borderColor: B, color: B } : void 0;
|
|
2766
|
+
if (h.every(Cn)) {
|
|
2767
|
+
const N = E(h);
|
|
2762
2768
|
return /* @__PURE__ */ n(
|
|
2763
|
-
|
|
2769
|
+
$n,
|
|
2764
2770
|
{
|
|
2765
|
-
label:
|
|
2766
|
-
code: (K =
|
|
2767
|
-
reason: Tn(
|
|
2771
|
+
label: l,
|
|
2772
|
+
code: (K = N[0].blocked) == null ? void 0 : K.code,
|
|
2773
|
+
reason: Tn(N, (se) => X(N[se]))
|
|
2768
2774
|
},
|
|
2769
|
-
|
|
2775
|
+
l
|
|
2770
2776
|
);
|
|
2771
2777
|
}
|
|
2772
|
-
if (
|
|
2773
|
-
const
|
|
2774
|
-
|
|
2778
|
+
if (h.length === 1) {
|
|
2779
|
+
const N = h[0], se = Ct(o == null ? void 0 : o.transition_id, N.id), De = Nn(o ? null : u.last_move_problem, N.id), ct = L.isPending && ((J = L.variables) == null ? void 0 : J.transition_id) === N.id || se, Re = /* @__PURE__ */ s(
|
|
2780
|
+
fe,
|
|
2775
2781
|
{
|
|
2776
2782
|
size: "sm",
|
|
2777
|
-
variant: O && !
|
|
2778
|
-
className:
|
|
2783
|
+
variant: O && !N.advisory ? "default" : "outline",
|
|
2784
|
+
className: ce(
|
|
2779
2785
|
"gap-1.5 text-[12px] data-[fresh=true]:opacity-60",
|
|
2780
|
-
|
|
2786
|
+
N.advisory && Xn
|
|
2781
2787
|
),
|
|
2782
|
-
style:
|
|
2783
|
-
disabled:
|
|
2788
|
+
style: N.advisory ? void 0 : H(O),
|
|
2789
|
+
disabled: L.isPending || w || !!o || !!De,
|
|
2784
2790
|
"data-move-running": se || void 0,
|
|
2785
|
-
"aria-disabled":
|
|
2786
|
-
"data-fresh":
|
|
2787
|
-
...
|
|
2788
|
-
...Ke(
|
|
2791
|
+
"aria-disabled": he.dimmed(N.id) || void 0,
|
|
2792
|
+
"data-fresh": he.dimmed(N.id) || void 0,
|
|
2793
|
+
...he.bind(N.id),
|
|
2794
|
+
...Ke(N),
|
|
2789
2795
|
onClick: () => {
|
|
2790
|
-
|
|
2796
|
+
he.press(N.id) && Q(N.id);
|
|
2791
2797
|
},
|
|
2792
2798
|
children: [
|
|
2793
|
-
ct ? /* @__PURE__ */ n(
|
|
2794
|
-
|
|
2799
|
+
ct ? /* @__PURE__ */ n(Se, { className: "h-3 w-3 animate-spin" }) : N.advisory ? /* @__PURE__ */ n(Ne, {}) : f && /* @__PURE__ */ n(nn, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
2800
|
+
l
|
|
2795
2801
|
]
|
|
2796
2802
|
},
|
|
2797
|
-
|
|
2803
|
+
l
|
|
2798
2804
|
);
|
|
2799
|
-
return De ? /* @__PURE__ */ n("span", { className: "inline-flex", "data-tip": De, "data-move-held": !0, children: Re },
|
|
2805
|
+
return De ? /* @__PURE__ */ n("span", { className: "inline-flex", "data-tip": De, "data-move-held": !0, children: Re }, l) : N.pushes && N.pushes > 0 ? /* @__PURE__ */ s("span", { className: "relative inline-flex", children: [
|
|
2800
2806
|
Re,
|
|
2801
2807
|
/* @__PURE__ */ n(
|
|
2802
2808
|
kr,
|
|
2803
2809
|
{
|
|
2804
2810
|
collection: t,
|
|
2805
2811
|
itemId: e,
|
|
2806
|
-
transitionId:
|
|
2807
|
-
label:
|
|
2812
|
+
transitionId: N.id,
|
|
2813
|
+
label: l,
|
|
2808
2814
|
compact: !0
|
|
2809
2815
|
}
|
|
2810
2816
|
)
|
|
2811
|
-
] },
|
|
2817
|
+
] }, l) : Re;
|
|
2812
2818
|
}
|
|
2813
|
-
return /* @__PURE__ */
|
|
2814
|
-
/* @__PURE__ */ n(yt, { asChild: !0, children: /* @__PURE__ */
|
|
2815
|
-
|
|
2819
|
+
return /* @__PURE__ */ s(xt, { children: [
|
|
2820
|
+
/* @__PURE__ */ n(yt, { asChild: !0, children: /* @__PURE__ */ s(
|
|
2821
|
+
fe,
|
|
2816
2822
|
{
|
|
2817
2823
|
size: "sm",
|
|
2818
2824
|
variant: O ? "default" : "outline",
|
|
2819
2825
|
className: "gap-1.5 text-[12px]",
|
|
2820
|
-
style:
|
|
2821
|
-
disabled:
|
|
2826
|
+
style: H(O),
|
|
2827
|
+
disabled: L.isPending || w || !!o,
|
|
2822
2828
|
children: [
|
|
2823
|
-
|
|
2824
|
-
|
|
2829
|
+
h.every((N) => N.advisory) && /* @__PURE__ */ n(Ne, {}),
|
|
2830
|
+
l,
|
|
2825
2831
|
/* @__PURE__ */ n(We, { className: "h-3 w-3" })
|
|
2826
2832
|
]
|
|
2827
2833
|
}
|
|
2828
2834
|
) }),
|
|
2829
|
-
/* @__PURE__ */
|
|
2830
|
-
|
|
2835
|
+
/* @__PURE__ */ s(wt, { align: "start", children: [
|
|
2836
|
+
E(h).map((N) => /* @__PURE__ */ s(
|
|
2831
2837
|
nt,
|
|
2832
2838
|
{
|
|
2833
|
-
onSelect: () =>
|
|
2834
|
-
...Ke(
|
|
2835
|
-
...at(
|
|
2839
|
+
onSelect: () => Q(N.id),
|
|
2840
|
+
...Ke(N, "menu"),
|
|
2841
|
+
...at(N),
|
|
2836
2842
|
children: [
|
|
2837
|
-
|
|
2843
|
+
N.color && /* @__PURE__ */ n(
|
|
2838
2844
|
"span",
|
|
2839
2845
|
{
|
|
2840
|
-
className:
|
|
2846
|
+
className: ce(
|
|
2841
2847
|
"mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
|
|
2842
|
-
|
|
2848
|
+
N.blocked && "opacity-40"
|
|
2843
2849
|
),
|
|
2844
|
-
style: { backgroundColor:
|
|
2850
|
+
style: { backgroundColor: N.color }
|
|
2845
2851
|
}
|
|
2846
2852
|
),
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2853
|
+
X(N),
|
|
2854
|
+
N.advisory && /* @__PURE__ */ n(Ne, { className: "ml-auto" }),
|
|
2855
|
+
N.blocked && /* @__PURE__ */ n(rt, {})
|
|
2850
2856
|
]
|
|
2851
2857
|
},
|
|
2852
|
-
|
|
2858
|
+
N.id
|
|
2853
2859
|
)),
|
|
2854
2860
|
/* @__PURE__ */ n(
|
|
2855
2861
|
Mt,
|
|
2856
2862
|
{
|
|
2857
|
-
moves:
|
|
2858
|
-
nameOf: (
|
|
2863
|
+
moves: h,
|
|
2864
|
+
nameOf: (N) => {
|
|
2859
2865
|
var se;
|
|
2860
|
-
return ((se =
|
|
2866
|
+
return ((se = ae.get(N.to_state)) == null ? void 0 : se.label) ?? N.to_state;
|
|
2861
2867
|
}
|
|
2862
2868
|
}
|
|
2863
2869
|
)
|
|
2864
2870
|
] })
|
|
2865
|
-
] },
|
|
2871
|
+
] }, l);
|
|
2866
2872
|
})
|
|
2867
2873
|
}
|
|
2868
2874
|
),
|
|
2869
|
-
k && /* @__PURE__ */
|
|
2875
|
+
k && /* @__PURE__ */ s(
|
|
2870
2876
|
"div",
|
|
2871
2877
|
{
|
|
2872
2878
|
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",
|
|
2873
|
-
style: { width:
|
|
2879
|
+
style: { width: j },
|
|
2874
2880
|
children: [
|
|
2875
|
-
/* @__PURE__ */
|
|
2881
|
+
/* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
2876
2882
|
/* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
/* @__PURE__ */ n(Oe, { label:
|
|
2883
|
+
V && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: V.label }),
|
|
2884
|
+
te && Pe && /* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-1.5", children: [
|
|
2885
|
+
/* @__PURE__ */ n(Oe, { label: te.label, color: te.color, small: !0 }),
|
|
2880
2886
|
/* @__PURE__ */ n(qt, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
2881
|
-
/* @__PURE__ */ n(Oe, { label:
|
|
2887
|
+
/* @__PURE__ */ n(Oe, { label: Pe.label, color: Pe.color, small: !0 })
|
|
2882
2888
|
] })
|
|
2883
2889
|
] }),
|
|
2884
|
-
/* @__PURE__ */ n(tr, { landing:
|
|
2885
|
-
/* @__PURE__ */ n(Wn, { collection: t, item: String(e), tx:
|
|
2886
|
-
/* @__PURE__ */ n(nr, { collection: t, item: e, omitLines:
|
|
2887
|
-
/* @__PURE__ */ n(Qn, { lines:
|
|
2890
|
+
/* @__PURE__ */ n(tr, { landing: me }),
|
|
2891
|
+
/* @__PURE__ */ n(Wn, { collection: t, item: String(e), tx: V }),
|
|
2892
|
+
/* @__PURE__ */ n(nr, { collection: t, item: e, omitLines: ue }),
|
|
2893
|
+
/* @__PURE__ */ n(Qn, { lines: ue }),
|
|
2888
2894
|
/* @__PURE__ */ n(
|
|
2889
2895
|
"input",
|
|
2890
2896
|
{
|
|
2891
2897
|
type: "text",
|
|
2892
2898
|
value: _,
|
|
2893
|
-
onChange: (
|
|
2894
|
-
placeholder: String((
|
|
2899
|
+
onChange: (l) => b(l.target.value),
|
|
2900
|
+
placeholder: String((V == null ? void 0 : V.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
|
|
2895
2901
|
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"
|
|
2896
2902
|
}
|
|
2897
2903
|
),
|
|
2898
|
-
/* @__PURE__ */
|
|
2904
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-2", children: [
|
|
2899
2905
|
/* @__PURE__ */ n(
|
|
2900
|
-
|
|
2906
|
+
fe,
|
|
2901
2907
|
{
|
|
2902
2908
|
type: "button",
|
|
2903
2909
|
size: "sm",
|
|
2904
2910
|
variant: "ghost",
|
|
2905
2911
|
className: "h-7 text-[12px]",
|
|
2906
|
-
onClick: () =>
|
|
2912
|
+
onClick: () => S(null),
|
|
2907
2913
|
children: "Cancel"
|
|
2908
2914
|
}
|
|
2909
2915
|
),
|
|
2910
2916
|
/* @__PURE__ */ n(
|
|
2911
|
-
|
|
2917
|
+
fe,
|
|
2912
2918
|
{
|
|
2913
2919
|
type: "button",
|
|
2914
2920
|
size: "sm",
|
|
2915
2921
|
className: "h-7 gap-1.5 text-[12px]",
|
|
2916
|
-
disabled:
|
|
2917
|
-
onClick: () =>
|
|
2922
|
+
disabled: L.isPending || !!o || String((V == null ? void 0 : V.comment_mode) ?? "") === "required" && _.trim() === "",
|
|
2923
|
+
onClick: () => T({
|
|
2918
2924
|
transition_id: k,
|
|
2919
2925
|
comment: _.trim() || void 0
|
|
2920
2926
|
}),
|
|
2921
|
-
children:
|
|
2922
|
-
/* @__PURE__ */ n("span", { children:
|
|
2927
|
+
children: L.isPending ? /* @__PURE__ */ n(Se, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ s(Ce, { children: [
|
|
2928
|
+
/* @__PURE__ */ n("span", { children: ue.length > 0 && V ? `${V.label} anyway` : "Confirm" }),
|
|
2923
2929
|
/* @__PURE__ */ n(Pt, { className: "h-3 w-3" })
|
|
2924
2930
|
] })
|
|
2925
2931
|
}
|
|
@@ -2928,77 +2934,77 @@ function la({
|
|
|
2928
2934
|
]
|
|
2929
2935
|
}
|
|
2930
2936
|
),
|
|
2931
|
-
(
|
|
2937
|
+
(we == null ? void 0 : we.advisory) && !k && /* @__PURE__ */ n(
|
|
2932
2938
|
qn,
|
|
2933
2939
|
{
|
|
2934
2940
|
floating: !0,
|
|
2935
2941
|
collection: t,
|
|
2936
2942
|
item: String(e),
|
|
2937
|
-
advisory:
|
|
2943
|
+
advisory: we.advisory,
|
|
2938
2944
|
armedMove: {
|
|
2939
|
-
id:
|
|
2940
|
-
label:
|
|
2941
|
-
confirms: Yn(
|
|
2945
|
+
id: we.id,
|
|
2946
|
+
label: we.label,
|
|
2947
|
+
confirms: Yn(we, u.states ?? [], u.instance.current_state)
|
|
2942
2948
|
},
|
|
2943
2949
|
className: "absolute right-0 top-full z-50 mt-1",
|
|
2944
|
-
style: { width:
|
|
2945
|
-
onDismiss: () =>
|
|
2946
|
-
onFixed: (
|
|
2947
|
-
|
|
2950
|
+
style: { width: j },
|
|
2951
|
+
onDismiss: () => ne(null),
|
|
2952
|
+
onFixed: (l) => {
|
|
2953
|
+
ne(null), p.invalidateQueries({ queryKey: I }), l && Q(l.id, { cleared: !0 });
|
|
2948
2954
|
}
|
|
2949
2955
|
}
|
|
2950
2956
|
),
|
|
2951
|
-
|
|
2957
|
+
oe && !k && /* @__PURE__ */ n(
|
|
2952
2958
|
Jn,
|
|
2953
2959
|
{
|
|
2954
2960
|
collection: t,
|
|
2955
2961
|
item: String(e),
|
|
2956
|
-
offer:
|
|
2962
|
+
offer: oe,
|
|
2957
2963
|
className: "absolute right-0 top-full z-50 mt-1 shadow-lg",
|
|
2958
|
-
style: { width:
|
|
2964
|
+
style: { width: j },
|
|
2959
2965
|
onDismiss: () => le(null),
|
|
2960
|
-
onFixed: () =>
|
|
2966
|
+
onFixed: () => T({ transition_id: oe.transitionId, comment: oe.comment })
|
|
2961
2967
|
}
|
|
2962
2968
|
),
|
|
2963
|
-
|
|
2964
|
-
|
|
2969
|
+
F && /* @__PURE__ */ n(sn, { fallback: null, children: /* @__PURE__ */ n(
|
|
2970
|
+
An,
|
|
2965
2971
|
{
|
|
2966
|
-
payload:
|
|
2967
|
-
transitionId:
|
|
2968
|
-
isRetry:
|
|
2972
|
+
payload: F.payload,
|
|
2973
|
+
transitionId: F.transitionId,
|
|
2974
|
+
isRetry: F.revision > 1,
|
|
2969
2975
|
onSubmitted: () => (
|
|
2970
2976
|
// mutateAsync so the dialog can stay busy until the transition
|
|
2971
2977
|
// settles; the mutation's own onError/onSuccess handle the outcome.
|
|
2972
|
-
|
|
2973
|
-
transition_id:
|
|
2974
|
-
comment:
|
|
2978
|
+
L.mutateAsync({
|
|
2979
|
+
transition_id: F.transitionId,
|
|
2980
|
+
comment: F.comment,
|
|
2975
2981
|
reviewed: !0
|
|
2976
2982
|
}).catch(() => {
|
|
2977
2983
|
})
|
|
2978
2984
|
),
|
|
2979
|
-
executing:
|
|
2985
|
+
executing: L.isPending,
|
|
2980
2986
|
onClose: () => C(null)
|
|
2981
2987
|
},
|
|
2982
|
-
|
|
2988
|
+
F.revision
|
|
2983
2989
|
) })
|
|
2984
2990
|
] });
|
|
2985
2991
|
}
|
|
2986
2992
|
export {
|
|
2987
2993
|
je as FRESH_BUTTON_MS,
|
|
2988
2994
|
Xt as FRESH_HOVER_MAX_MS,
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2995
|
+
Vr as FreshButtonGuard,
|
|
2996
|
+
Ya as PipelinePanel,
|
|
2997
|
+
Ja as PipelineTransitionButtons,
|
|
2992
2998
|
Or as REFUSAL_FIX_ACTIONS,
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2999
|
+
ea as RecordFlagChips,
|
|
3000
|
+
ta as SLOW_MOVE_MS,
|
|
3001
|
+
At as asksFirst,
|
|
3002
|
+
Yr as briefAgeText,
|
|
3003
|
+
Jr as briefDiffPair,
|
|
2998
3004
|
Yt as briefLineKey,
|
|
2999
|
-
|
|
3005
|
+
Xr as briefWarnings,
|
|
3000
3006
|
On as isDuplicateTransition,
|
|
3001
|
-
|
|
3007
|
+
na as latestSendBack,
|
|
3002
3008
|
Bn as lockedMoveOffer,
|
|
3003
3009
|
dt as refusalCode,
|
|
3004
3010
|
En as refusalFixFor,
|