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