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