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