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