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