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