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