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