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