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