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