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