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