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