@nivaro/react 0.3.59 → 0.3.61
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/shared/components/ItemEditForm.js +3332 -3324
- package/dist/shared/components/item-edit/InlineTableField.js +6 -6
- package/dist/shared/components/item-edit/RecordHeaderActions.js +8 -8
- package/dist/shared/components/panels/AddendumPanel.js +464 -466
- package/dist/shared/components/panels/PipelinePanel.js +391 -364
- package/dist/shared/components/panels/landing-state.js +32 -19
- package/dist/shared/lib/request-gate.js +159 -144
- package/package.json +1 -1
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Ke = (t, e,
|
|
1
|
+
var tn = Object.defineProperty;
|
|
2
|
+
var nn = (t, e, a) => e in t ? tn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
|
|
3
|
+
var Ke = (t, e, a) => nn(t, typeof e != "symbol" ? e + "" : e, a);
|
|
4
4
|
import { jsx as n, jsxs as i, Fragment as he } from "react/jsx-runtime";
|
|
5
5
|
import { useQueryClient as Te, useQuery as se, useMutation as $e } from "@tanstack/react-query";
|
|
6
|
-
import { ArrowRight as et, Loader2 as oe, Check as Oe, GitBranch as Qe, AlertTriangle as
|
|
7
|
-
import { useState as Q, useRef as te, useEffect as ue, useMemo as Ae, Suspense as
|
|
6
|
+
import { ArrowRight as et, Loader2 as oe, Check as Oe, GitBranch as Qe, AlertTriangle as rn, ChevronDown as ve, Users as kt, Minus as an, UserPlus as sn, X as _t, Zap as St, Search as ln } from "lucide-react";
|
|
7
|
+
import { useState as Q, useRef as te, useEffect as ue, useMemo as Ae, Suspense as Ct, useCallback as $t, lazy as on } from "react";
|
|
8
8
|
import { toast as J } from "sonner";
|
|
9
|
-
import { useNivaroClient as be, useItemEditAuth as
|
|
10
|
-
import { get as de, post as Ne, del as
|
|
11
|
-
import { errorToastOptions as
|
|
12
|
-
import { useRecordSignalWhile as
|
|
9
|
+
import { useNivaroClient as be, useItemEditAuth as dn } from "../../context.js";
|
|
10
|
+
import { get as de, post as Ne, del as cn } from "../../lib/commands.js";
|
|
11
|
+
import { errorToastOptions as Tt, toastError as un } from "../../lib/error-toast.js";
|
|
12
|
+
import { useRecordSignalWhile as qt, useRecordSignalPeers as mn, signalSentence as pn } from "../../lib/presence-signals.js";
|
|
13
13
|
import { RUN_TRANSITION_EVENT as Ue } from "../../lib/run-transition.js";
|
|
14
14
|
import { userErrorMessage as qe } from "../../lib/safe-error.js";
|
|
15
|
-
import { serverNow as
|
|
16
|
-
import { userCardQuery as
|
|
17
|
-
import { cn as ke, formatRelative as tt, humanHours as
|
|
18
|
-
import { PushReadinessChip as
|
|
19
|
-
import { useHeaderFold as
|
|
15
|
+
import { serverNow as fn } from "../../lib/server-clock.js";
|
|
16
|
+
import { userCardQuery as hn } from "../../lib/user-cards.js";
|
|
17
|
+
import { cn as ke, formatRelative as tt, humanHours as bn } from "../../lib/utils.js";
|
|
18
|
+
import { PushReadinessChip as gn } from "../integrations/RecordIntegrationPreview.js";
|
|
19
|
+
import { useHeaderFold as xn } from "../item-edit/HeaderTools.js";
|
|
20
20
|
import { invalidateRecordInsights as Be, invalidateRecordData as Re } from "../item-edit/RecordInsights.js";
|
|
21
|
-
import { UserChip as
|
|
22
|
-
import { OwnerAvatars as
|
|
23
|
-
import { UserAvatar as
|
|
21
|
+
import { UserChip as Rt } from "../item-edit/UserChip.js";
|
|
22
|
+
import { OwnerAvatars as wn } from "../queue/OwnerAvatars.js";
|
|
23
|
+
import { UserAvatar as yn } from "../UserAvatar.js";
|
|
24
24
|
import { Button as ee } from "../ui/button.js";
|
|
25
|
-
import { DropdownMenu as We, DropdownMenuTrigger as He, DropdownMenuContent as Ge, DropdownMenuGroup as xt, DropdownMenuSeparator as wt, DropdownMenuItem as Me, DropdownMenuLabel as
|
|
25
|
+
import { DropdownMenu as We, DropdownMenuTrigger as He, DropdownMenuContent as Ge, DropdownMenuGroup as xt, DropdownMenuSeparator as wt, DropdownMenuItem as Me, DropdownMenuLabel as vn } from "../ui/dropdown-menu.js";
|
|
26
26
|
import { Popover as nt, PopoverTrigger as rt, PopoverContent as at } from "../ui/popover.js";
|
|
27
27
|
import { Skeleton as pe } from "../ui/skeleton.js";
|
|
28
|
-
import { TooltipProvider as
|
|
29
|
-
import { isAccessRefusal as
|
|
30
|
-
import { BranchLanes as
|
|
31
|
-
import { landingState as
|
|
32
|
-
import { SlaClockLine as
|
|
33
|
-
const
|
|
28
|
+
import { TooltipProvider as Pt, Tooltip as Ve, TooltipTrigger as Xe, TooltipContent as Ye } from "../ui/tooltip.js";
|
|
29
|
+
import { isAccessRefusal as Dt, deniedToastAction as Mt, WhyOwnersButton as Nn } from "./AccessInsights.js";
|
|
30
|
+
import { BranchLanes as kn } from "./BranchLanes.js";
|
|
31
|
+
import { landingState as _n, landingSkipGroups as Sn, joinLabels as yt } from "./landing-state.js";
|
|
32
|
+
import { SlaClockLine as Cn } from "./SlaClock.js";
|
|
33
|
+
const Ft = on(
|
|
34
34
|
() => import("./TransitionRequirementsDialog.js").then((t) => ({
|
|
35
35
|
default: t.TransitionRequirementsDialog
|
|
36
36
|
}))
|
|
37
37
|
);
|
|
38
38
|
function st(t, e) {
|
|
39
|
-
const
|
|
40
|
-
return e.on_behalf_of_name ? `${
|
|
39
|
+
const a = t || "System";
|
|
40
|
+
return e.on_behalf_of_name ? `${a}, for ${e.on_behalf_of_name}` : a;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function $n(t) {
|
|
43
43
|
if (t.transition) return null;
|
|
44
44
|
const e = (t.comment ?? "").trim();
|
|
45
45
|
if (!e.startsWith("{")) return null;
|
|
46
46
|
try {
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
return `Split into ${Array.isArray(
|
|
50
|
-
if (
|
|
51
|
-
if (
|
|
47
|
+
const a = JSON.parse(e);
|
|
48
|
+
if (a.action === "split")
|
|
49
|
+
return `Split into ${Array.isArray(a.children) ? a.children.length : "parallel"} branches`;
|
|
50
|
+
if (a.action === "join") return "Every branch finished — joined";
|
|
51
|
+
if (a.action === "branch") return "Started as a parallel branch";
|
|
52
52
|
} catch {
|
|
53
53
|
}
|
|
54
54
|
return null;
|
|
@@ -63,10 +63,10 @@ function Je(t) {
|
|
|
63
63
|
function Ze(t) {
|
|
64
64
|
if (t.transition_text) return t.transition_text;
|
|
65
65
|
if (t.transition_label) return `Rule: ${t.transition_label}`;
|
|
66
|
-
const e = (t.comment ?? "").trim(),
|
|
67
|
-
return
|
|
66
|
+
const e = (t.comment ?? "").trim(), a = /^auto: (.+)$/i.exec(e);
|
|
67
|
+
return a ? `Rule: ${a[1]}` : /-state-sync$/i.test(e) ? "The state was copied in from the system that owned this record" : /^instance-migration/i.test(e) ? "Moved when the pipeline was reshaped" : /^state-merge/i.test(e) ? "Moved when two states were merged" : null;
|
|
68
68
|
}
|
|
69
|
-
const
|
|
69
|
+
const vt = {
|
|
70
70
|
validation: "the partner refused what we sent",
|
|
71
71
|
not_found: "the partner could not find what we referred to",
|
|
72
72
|
auth: "the partner refused our credentials",
|
|
@@ -74,22 +74,22 @@ const yt = {
|
|
|
74
74
|
rate_limited: "the partner asked us to slow down",
|
|
75
75
|
unknown: "the partner refused it"
|
|
76
76
|
};
|
|
77
|
-
function
|
|
78
|
-
const e = Math.ceil((new Date(t).getTime() -
|
|
77
|
+
function Tn(t) {
|
|
78
|
+
const e = Math.ceil((new Date(t).getTime() - fn()) / 6e4);
|
|
79
79
|
return !Number.isFinite(e) || e <= 0 ? "on the next check" : e < 60 ? `in ${e} min` : `in ${Math.round(e / 60)}h`;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function qn({ held: t }) {
|
|
82
82
|
return t.length === 0 ? null : /* @__PURE__ */ n(
|
|
83
83
|
"div",
|
|
84
84
|
{
|
|
85
85
|
className: "space-y-2 border-b border-amber-100 bg-amber-50 px-5 py-3 dark:border-amber-500/20 dark:bg-amber-500/10",
|
|
86
86
|
"data-pipeline-auto-held": !0,
|
|
87
87
|
children: t.map((e) => {
|
|
88
|
-
const
|
|
88
|
+
const a = e.transition_label ?? "An automatic move", r = vt[e.error_class ?? "unknown"] ?? vt.unknown;
|
|
89
89
|
return /* @__PURE__ */ i("div", { className: "text-[12px] text-amber-800 dark:text-amber-300", children: [
|
|
90
90
|
/* @__PURE__ */ i("p", { className: "font-medium", children: [
|
|
91
91
|
"Needs a person: ",
|
|
92
|
-
|
|
92
|
+
a,
|
|
93
93
|
" stopped retrying — ",
|
|
94
94
|
r,
|
|
95
95
|
"."
|
|
@@ -103,7 +103,7 @@ function $n({ held: t }) {
|
|
|
103
103
|
}
|
|
104
104
|
),
|
|
105
105
|
/* @__PURE__ */ i("p", { className: "mt-1 text-[11px] text-amber-700 dark:text-amber-400", children: [
|
|
106
|
-
e.retry_at ? `It tries the same push again ${
|
|
106
|
+
e.retry_at ? `It tries the same push again ${Tn(e.retry_at)}. ` : "It will not send the same push again on its own. ",
|
|
107
107
|
"Fix the record so what it sends changes, retry the push, or move the record by hand.",
|
|
108
108
|
e.attempts > 1 ? ` ${e.attempts} attempts so far.` : ""
|
|
109
109
|
] })
|
|
@@ -112,99 +112,99 @@ function $n({ held: t }) {
|
|
|
112
112
|
}
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
var
|
|
115
|
+
function At(t) {
|
|
116
|
+
var a;
|
|
117
117
|
const e = t == null ? void 0 : t.response;
|
|
118
|
-
return ((e == null ? void 0 : e.code) ?? ((
|
|
118
|
+
return ((e == null ? void 0 : e.code) ?? ((a = e == null ? void 0 : e.data) == null ? void 0 : a.code)) === "TRANSITION_DUPLICATE";
|
|
119
119
|
}
|
|
120
|
-
function
|
|
121
|
-
var
|
|
120
|
+
function Ut(t) {
|
|
121
|
+
var a;
|
|
122
122
|
const e = t;
|
|
123
|
-
return (e == null ? void 0 : e.status) === 422 && ((
|
|
123
|
+
return (e == null ? void 0 : e.status) === 422 && ((a = e.response) == null ? void 0 : a.error) === "TRANSITION_REQUIREMENTS" ? e.response.requirements ?? [] : null;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function Rn(t) {
|
|
126
126
|
var r;
|
|
127
|
-
const e = t == null ? void 0 : t.response,
|
|
128
|
-
return typeof
|
|
127
|
+
const e = t == null ? void 0 : t.response, a = (e == null ? void 0 : e.code) ?? ((r = e == null ? void 0 : e.data) == null ? void 0 : r.code);
|
|
128
|
+
return typeof a == "string" ? a : null;
|
|
129
129
|
}
|
|
130
|
-
const
|
|
130
|
+
const Pn = {
|
|
131
131
|
PRIORITY_REQUIRED: "priority"
|
|
132
132
|
};
|
|
133
|
-
function
|
|
134
|
-
const
|
|
135
|
-
return !
|
|
133
|
+
function Bt(t, e) {
|
|
134
|
+
const a = Rn(t), r = a ? Pn[a] : void 0;
|
|
135
|
+
return !a || !r ? null : { code: a, actionKey: r, transitionId: e.transition_id, comment: e.comment };
|
|
136
136
|
}
|
|
137
|
-
const
|
|
138
|
-
function
|
|
139
|
-
const e = Te(), [
|
|
137
|
+
const Dn = 600;
|
|
138
|
+
function Ot(t) {
|
|
139
|
+
const e = Te(), [a, r] = Q(!1), l = te(!0);
|
|
140
140
|
ue(() => (l.current = !0, () => {
|
|
141
141
|
l.current = !1;
|
|
142
142
|
}), []);
|
|
143
143
|
const o = te(t);
|
|
144
144
|
o.current = t;
|
|
145
|
-
const f =
|
|
145
|
+
const f = $t(async () => {
|
|
146
146
|
r(!0);
|
|
147
147
|
try {
|
|
148
148
|
await e.refetchQueries({ queryKey: [...o.current], type: "active" });
|
|
149
149
|
} catch {
|
|
150
150
|
}
|
|
151
|
-
await new Promise((h) => setTimeout(h,
|
|
151
|
+
await new Promise((h) => setTimeout(h, Dn)), l.current && r(!1);
|
|
152
152
|
}, [e]);
|
|
153
|
-
return { settling:
|
|
153
|
+
return { settling: a, settle: f };
|
|
154
154
|
}
|
|
155
155
|
const Se = 1500;
|
|
156
|
-
class
|
|
156
|
+
class Mn {
|
|
157
157
|
constructor() {
|
|
158
158
|
Ke(this, "seen", null);
|
|
159
159
|
Ke(this, "fresh", /* @__PURE__ */ new Map());
|
|
160
160
|
}
|
|
161
161
|
/** Feed the ids on offer now. */
|
|
162
|
-
observe(e,
|
|
162
|
+
observe(e, a) {
|
|
163
163
|
const r = new Set(e.map((l) => String(l).toUpperCase()));
|
|
164
164
|
if (this.seen)
|
|
165
165
|
for (const l of r)
|
|
166
|
-
this.seen.has(l) || this.fresh.set(l, { at:
|
|
166
|
+
this.seen.has(l) || this.fresh.set(l, { at: a, hovered: !1, left: !1 });
|
|
167
167
|
for (const l of [...this.fresh.keys()]) r.has(l) || this.fresh.delete(l);
|
|
168
168
|
this.seen = r;
|
|
169
169
|
}
|
|
170
170
|
/** The pointer is on the button. */
|
|
171
|
-
enter(e,
|
|
171
|
+
enter(e, a) {
|
|
172
172
|
const r = this.fresh.get(String(e).toUpperCase());
|
|
173
|
-
r && !r.left &&
|
|
173
|
+
r && !r.left && a - r.at < Se && (r.hovered = !0);
|
|
174
174
|
}
|
|
175
175
|
/** The pointer left the button. */
|
|
176
176
|
leave(e) {
|
|
177
|
-
const
|
|
178
|
-
|
|
177
|
+
const a = this.fresh.get(String(e).toUpperCase());
|
|
178
|
+
a != null && a.hovered && (a.left = !0);
|
|
179
179
|
}
|
|
180
180
|
/** Still inert (no state change)? */
|
|
181
|
-
inert(e,
|
|
181
|
+
inert(e, a) {
|
|
182
182
|
const r = this.fresh.get(String(e).toUpperCase());
|
|
183
|
-
return r ?
|
|
183
|
+
return r ? a - r.at < Se || r.hovered && !r.left : !1;
|
|
184
184
|
}
|
|
185
185
|
/** A press: true = let it through. A press inside the window counts as the pointer being there. */
|
|
186
|
-
press(e,
|
|
186
|
+
press(e, a) {
|
|
187
187
|
const r = String(e).toUpperCase(), l = this.fresh.get(r);
|
|
188
|
-
return l ?
|
|
188
|
+
return l ? a - l.at < Se ? (l.hovered = !0, l.left = !1, !1) : l.hovered && !l.left ? !1 : (this.fresh.delete(r), !0) : !0;
|
|
189
189
|
}
|
|
190
190
|
/** Inside its time window (drawn dimmed)? */
|
|
191
|
-
timed(e,
|
|
191
|
+
timed(e, a) {
|
|
192
192
|
const r = this.fresh.get(String(e).toUpperCase());
|
|
193
|
-
return !!r &&
|
|
193
|
+
return !!r && a - r.at < Se;
|
|
194
194
|
}
|
|
195
195
|
/** Any button still inside its time window? */
|
|
196
196
|
hasTimed(e) {
|
|
197
|
-
for (const
|
|
197
|
+
for (const a of this.fresh.values()) if (e - a.at < Se) return !0;
|
|
198
198
|
return !1;
|
|
199
199
|
}
|
|
200
200
|
reset() {
|
|
201
201
|
this.seen = null, this.fresh.clear();
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
function
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
const r =
|
|
204
|
+
function Lt(t, e) {
|
|
205
|
+
const a = te(null);
|
|
206
|
+
a.current || (a.current = new Mn());
|
|
207
|
+
const r = a.current, l = te(e);
|
|
208
208
|
l.current !== e && (l.current = e, r.reset());
|
|
209
209
|
const [, o] = Q(0), f = t ? t.join(",") : null;
|
|
210
210
|
return Ae(() => {
|
|
@@ -223,38 +223,38 @@ function Ot(t, e) {
|
|
|
223
223
|
})
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function jt(t, e) {
|
|
227
227
|
return ["approval-brief", t, String(e)];
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function Et(t, e, a) {
|
|
230
230
|
return t.request(
|
|
231
|
-
de(`/pipelines/instance/${e}/${
|
|
231
|
+
de(`/pipelines/instance/${e}/${a}/approval-brief`)
|
|
232
232
|
).then((r) => r.data);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function Fn(t) {
|
|
235
235
|
return (t ?? []).filter((e) => e.tone === "warn" || e.tone === "danger");
|
|
236
236
|
}
|
|
237
|
-
const
|
|
238
|
-
function
|
|
239
|
-
const
|
|
240
|
-
return
|
|
237
|
+
const An = 4e3;
|
|
238
|
+
function It(t, e) {
|
|
239
|
+
const a = be(), r = Te();
|
|
240
|
+
return $t(async () => {
|
|
241
241
|
try {
|
|
242
242
|
const l = await Promise.race([
|
|
243
243
|
r.fetchQuery({
|
|
244
|
-
queryKey:
|
|
245
|
-
queryFn: () =>
|
|
244
|
+
queryKey: jt(t, e),
|
|
245
|
+
queryFn: () => Et(a, t, e),
|
|
246
246
|
staleTime: 0,
|
|
247
247
|
retry: !1
|
|
248
248
|
}),
|
|
249
|
-
new Promise((o) => setTimeout(() => o(null),
|
|
249
|
+
new Promise((o) => setTimeout(() => o(null), An))
|
|
250
250
|
]);
|
|
251
|
-
return
|
|
251
|
+
return Fn(l == null ? void 0 : l.lines);
|
|
252
252
|
} catch {
|
|
253
253
|
return [];
|
|
254
254
|
}
|
|
255
|
-
}, [
|
|
255
|
+
}, [a, r, t, e]);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Kt({ lines: t }) {
|
|
258
258
|
return t.length === 0 ? null : /* @__PURE__ */ i(
|
|
259
259
|
"div",
|
|
260
260
|
{
|
|
@@ -270,70 +270,70 @@ function It({ lines: t }) {
|
|
|
270
270
|
}
|
|
271
271
|
);
|
|
272
272
|
}
|
|
273
|
-
function Le(t, e,
|
|
274
|
-
if (!
|
|
273
|
+
function Le(t, e, a) {
|
|
274
|
+
if (!a) return !1;
|
|
275
275
|
const r = e.find(
|
|
276
|
-
(o) => String(o.id).toUpperCase() === String(
|
|
276
|
+
(o) => String(o.id).toUpperCase() === String(a).toUpperCase()
|
|
277
277
|
), l = e.find((o) => String(o.id).toUpperCase() === String(t.to_state).toUpperCase());
|
|
278
278
|
return !!r && !!l && l.sort < r.sort;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function Qt(t) {
|
|
281
281
|
return t != null && t.instance ? (t.available_transitions ?? []).some(
|
|
282
282
|
(e) => {
|
|
283
|
-
var
|
|
284
|
-
return Le(e, t.states ?? [], (
|
|
283
|
+
var a;
|
|
284
|
+
return Le(e, t.states ?? [], (a = t.instance) == null ? void 0 : a.current_state);
|
|
285
285
|
}
|
|
286
286
|
) : !1;
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function zt(t, e, a, r) {
|
|
289
289
|
if (!r || r.size === 0) return t;
|
|
290
290
|
const l = new Set([...r.keys()].map((o) => String(o).toUpperCase()));
|
|
291
291
|
return t.filter(
|
|
292
|
-
(o) => !(l.has(String(o.to_state).toUpperCase()) && Le(o, e,
|
|
292
|
+
(o) => !(!o.to_previous && l.has(String(o.to_state).toUpperCase()) && Le(o, e, a))
|
|
293
293
|
);
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function Wt(t, e, a) {
|
|
296
296
|
var N, P, x, w, S, B;
|
|
297
297
|
const r = [...(t == null ? void 0 : t.available_transitions) ?? [], ...(t == null ? void 0 : t.all_transitions) ?? []].find(
|
|
298
298
|
(j) => j.id === e
|
|
299
|
-
), l =
|
|
299
|
+
), l = a == null ? void 0 : a.data, o = ((N = l == null ? void 0 : l.new_state) == null ? void 0 : N.id) ?? ((P = l == null ? void 0 : l.instance) == null ? void 0 : P.current_state) ?? null, f = ((x = l == null ? void 0 : l.new_state) == null ? void 0 : x.label) ?? (r ? (S = (w = t == null ? void 0 : t.states) == null ? void 0 : w.find((j) => j.id === r.to_state)) == null ? void 0 : S.label : void 0) ?? null, h = ((B = t == null ? void 0 : t.instance) == null ? void 0 : B.current_state) ?? null;
|
|
300
300
|
return h && o && String(h) === String(o) ? "Nothing moved" : r != null && r.label && f ? `${r.label} — now ${f}` : f ? `Moved to ${f}` : r != null && r.label ? `${r.label} done` : "Transition executed";
|
|
301
301
|
}
|
|
302
|
-
const
|
|
303
|
-
function
|
|
302
|
+
const Un = 1200;
|
|
303
|
+
function Ht(t) {
|
|
304
304
|
const e = `nvr-move-${Math.random().toString(36).slice(2)}`;
|
|
305
|
-
let
|
|
305
|
+
let a = !1;
|
|
306
306
|
const r = setTimeout(() => {
|
|
307
|
-
|
|
308
|
-
},
|
|
307
|
+
a = !0, J.loading(`${(t == null ? void 0 : t.trim()) || "Moving"}…`, { id: e });
|
|
308
|
+
}, Un);
|
|
309
309
|
return {
|
|
310
310
|
/** Options for the result toast: replaces the loading one when shown. */
|
|
311
|
-
done: () => (clearTimeout(r),
|
|
311
|
+
done: () => (clearTimeout(r), a ? { id: e, duration: 7e3 } : {}),
|
|
312
312
|
/** An error toast of its own follows — drop the loading one. */
|
|
313
313
|
fail: () => {
|
|
314
|
-
clearTimeout(r),
|
|
314
|
+
clearTimeout(r), a && J.dismiss(e);
|
|
315
315
|
}
|
|
316
316
|
};
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function Gt(t, e, a) {
|
|
319
319
|
for (const r of [
|
|
320
320
|
"pipeline-owners-resolved",
|
|
321
321
|
"pipeline-instance-owners",
|
|
322
322
|
"pipeline-all-owners"
|
|
323
323
|
])
|
|
324
|
-
t.invalidateQueries({ queryKey: [r, e,
|
|
324
|
+
t.invalidateQueries({ queryKey: [r, e, a] });
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function Bn(t, e, a) {
|
|
327
327
|
var h;
|
|
328
328
|
if (!e) return null;
|
|
329
|
-
const r = new Map(
|
|
329
|
+
const r = new Map(a.map((N) => [String(N.id).toUpperCase(), N.sort])), l = [...t].sort(
|
|
330
330
|
(N, P) => new Date(P.timestamp).getTime() - new Date(N.timestamp).getTime()
|
|
331
331
|
)[0];
|
|
332
332
|
if (!(l != null && l.from_state) || String(l.to_state).toUpperCase() !== String(e).toUpperCase() || !((h = l.comment) != null && h.trim()) || l.origin && l.origin !== "person") return null;
|
|
333
333
|
const o = r.get(String(l.from_state).toUpperCase()), f = r.get(String(l.to_state).toUpperCase());
|
|
334
334
|
return o == null || f == null || f >= o ? null : l;
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function On({ entry: t }) {
|
|
337
337
|
const e = [t.first_name, t.last_name].filter(Boolean).join(" ") || t.user_email || "Someone";
|
|
338
338
|
return /* @__PURE__ */ i(
|
|
339
339
|
"div",
|
|
@@ -352,23 +352,23 @@ function Un({ entry: t }) {
|
|
|
352
352
|
}
|
|
353
353
|
);
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function Vt({
|
|
356
356
|
collection: t,
|
|
357
357
|
item: e,
|
|
358
|
-
offer:
|
|
358
|
+
offer: a,
|
|
359
359
|
onFixed: r,
|
|
360
360
|
onDismiss: l,
|
|
361
361
|
className: o,
|
|
362
362
|
style: f
|
|
363
363
|
}) {
|
|
364
364
|
const h = be(), N = Te(), [P, x] = Q(""), { data: w, isLoading: S } = se({
|
|
365
|
-
queryKey: ["bulk-actions-available-one", t,
|
|
366
|
-
queryFn: async () => ((await h.request(de("/bulk-actions/available", { collection: t }))).data ?? []).find((E) => E.key ===
|
|
365
|
+
queryKey: ["bulk-actions-available-one", t, a.actionKey],
|
|
366
|
+
queryFn: async () => ((await h.request(de("/bulk-actions/available", { collection: t }))).data ?? []).find((E) => E.key === a.actionKey) ?? null,
|
|
367
367
|
staleTime: 6e4
|
|
368
368
|
}), B = $e({
|
|
369
369
|
mutationFn: async () => {
|
|
370
370
|
var D, M;
|
|
371
|
-
const A = { collection: t, ids: [e], reason: P.trim() || null }, K = ((w == null ? void 0 : w.source) === "extension" ? await h.request(Ne(`/bulk-actions/${
|
|
371
|
+
const A = { collection: t, ids: [e], reason: P.trim() || null }, K = ((w == null ? void 0 : w.source) === "extension" ? await h.request(Ne(`/bulk-actions/${a.actionKey}/execute`, A)) : await h.request(Ne("/bulk-actions/run", { ...A, key: a.actionKey }))).data ?? {};
|
|
372
372
|
if ((w == null ? void 0 : w.source) !== "extension" && !(K.succeeded && K.succeeded > 0))
|
|
373
373
|
throw new Error(
|
|
374
374
|
((M = (D = K.errors) == null ? void 0 : D[0]) == null ? void 0 : M.error) || `${(w == null ? void 0 : w.label) ?? "The fix"} did not change the record`
|
|
@@ -377,7 +377,7 @@ function Gt({
|
|
|
377
377
|
onSuccess: () => {
|
|
378
378
|
Re(N, t, e), J.success(`${(w == null ? void 0 : w.label) ?? "Done"} — trying again`), r();
|
|
379
379
|
},
|
|
380
|
-
onError: (A) =>
|
|
380
|
+
onError: (A) => un(A, `${(w == null ? void 0 : w.label) ?? "The fix"} failed`)
|
|
381
381
|
});
|
|
382
382
|
if (S || !w) return null;
|
|
383
383
|
const j = !B.isPending && (!w.require_reason || P.trim().length > 0);
|
|
@@ -389,7 +389,7 @@ function Gt({
|
|
|
389
389
|
o
|
|
390
390
|
),
|
|
391
391
|
style: f,
|
|
392
|
-
"data-refusal-fix":
|
|
392
|
+
"data-refusal-fix": a.code,
|
|
393
393
|
children: [
|
|
394
394
|
/* @__PURE__ */ i("p", { className: "text-[12px] text-amber-950 dark:text-amber-100", children: [
|
|
395
395
|
"You can fix this here: ",
|
|
@@ -442,12 +442,12 @@ function Gt({
|
|
|
442
442
|
function fe({
|
|
443
443
|
label: t,
|
|
444
444
|
color: e,
|
|
445
|
-
small:
|
|
445
|
+
small: a
|
|
446
446
|
}) {
|
|
447
447
|
return /* @__PURE__ */ n(
|
|
448
448
|
"span",
|
|
449
449
|
{
|
|
450
|
-
className: `nvr-state-pulse inline-flex items-center gap-1.5 rounded-full font-medium transition-colors duration-300 ${
|
|
450
|
+
className: `nvr-state-pulse inline-flex items-center gap-1.5 rounded-full font-medium transition-colors duration-300 ${a ? "px-2 py-0.5 text-[11px]" : "px-2.5 py-1 text-[12px]"}`,
|
|
451
451
|
style: {
|
|
452
452
|
backgroundColor: e ? `${e}22` : "#f1f5f9",
|
|
453
453
|
color: e ?? "#475569",
|
|
@@ -460,24 +460,24 @@ function fe({
|
|
|
460
460
|
}
|
|
461
461
|
function ze(t) {
|
|
462
462
|
const e = Math.floor(t / 6e4);
|
|
463
|
-
return e < 60 ? `${Math.max(1, e)}m` :
|
|
463
|
+
return e < 60 ? `${Math.max(1, e)}m` : bn(t / 36e5);
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function Ln({
|
|
466
466
|
history: t,
|
|
467
467
|
completedAt: e
|
|
468
468
|
}) {
|
|
469
|
-
const
|
|
469
|
+
const a = [...t].sort(
|
|
470
470
|
(f, h) => new Date(f.timestamp).getTime() - new Date(h.timestamp).getTime()
|
|
471
471
|
);
|
|
472
|
-
if (
|
|
473
|
-
const r = e ? new Date(e).getTime() : Date.now(), l =
|
|
474
|
-
const N = new Date(f.timestamp).getTime(), P = h + 1 <
|
|
472
|
+
if (a.length === 0) return null;
|
|
473
|
+
const r = e ? new Date(e).getTime() : Date.now(), l = a.map((f, h) => {
|
|
474
|
+
const N = new Date(f.timestamp).getTime(), P = h + 1 < a.length ? new Date(a[h + 1].timestamp).getTime() : r;
|
|
475
475
|
return {
|
|
476
476
|
key: f.id,
|
|
477
477
|
label: f.to_state_label,
|
|
478
478
|
color: f.to_state_color,
|
|
479
479
|
ms: Math.max(0, P - N),
|
|
480
|
-
current: h ===
|
|
480
|
+
current: h === a.length - 1 && !e
|
|
481
481
|
};
|
|
482
482
|
}).filter((f) => f.ms > 0 || f.current);
|
|
483
483
|
if (l.length < 2) return null;
|
|
@@ -522,10 +522,10 @@ function Bn({
|
|
|
522
522
|
}) })
|
|
523
523
|
] });
|
|
524
524
|
}
|
|
525
|
-
function
|
|
525
|
+
function jn({
|
|
526
526
|
states: t,
|
|
527
527
|
allTransitions: e,
|
|
528
|
-
availableTransitions:
|
|
528
|
+
availableTransitions: a,
|
|
529
529
|
currentStateId: r,
|
|
530
530
|
history: l,
|
|
531
531
|
onPathIds: o,
|
|
@@ -567,7 +567,7 @@ function On({
|
|
|
567
567
|
if (r) {
|
|
568
568
|
const g = c.filter((_) => _.from_state === r).map((_) => _.to_state);
|
|
569
569
|
C.set(r, [
|
|
570
|
-
.../* @__PURE__ */ new Set([...
|
|
570
|
+
.../* @__PURE__ */ new Set([...a.map((_) => _.to_state), ...g])
|
|
571
571
|
]);
|
|
572
572
|
}
|
|
573
573
|
const q = /* @__PURE__ */ new Set(), y = t.filter((g) => g.is_initial).map((g) => g.id);
|
|
@@ -596,7 +596,7 @@ function On({
|
|
|
596
596
|
}
|
|
597
597
|
function A(m) {
|
|
598
598
|
var k, c, C, q;
|
|
599
|
-
return Fe(m) ? /* @__PURE__ */ n(
|
|
599
|
+
return Fe(m) ? /* @__PURE__ */ n(St, { className: "inline h-2.5 w-2.5", "aria-label": Je(m) }) : ((((k = m.first_name) == null ? void 0 : k[0]) ?? "") + (((c = m.last_name) == null ? void 0 : c[0]) ?? "")).toUpperCase() || ((q = (C = m.user_email) == null ? void 0 : C[0]) == null ? void 0 : q.toUpperCase()) || "?";
|
|
600
600
|
}
|
|
601
601
|
function E(m) {
|
|
602
602
|
return st([m.first_name, m.last_name].filter(Boolean).join(" ") || m.user_email, m);
|
|
@@ -617,7 +617,7 @@ function On({
|
|
|
617
617
|
const k = B.get(m.from_state ?? "") ?? "the previous step", c = B.get(m.to_state) ?? "the next step", C = Fe(m) ? "it moved automatically" : `${E(m)} moved it`;
|
|
618
618
|
return `Passed over on ${new Date(m.timestamp).toLocaleString()} — ${C} straight from ${k} to ${c}`;
|
|
619
619
|
}
|
|
620
|
-
return /* @__PURE__ */ n(
|
|
620
|
+
return /* @__PURE__ */ n(Pt, { delayDuration: 200, children: /* @__PURE__ */ n("div", { ref: h, className: "overflow-x-auto pt-1.5 pb-1", "data-state-track": !0, children: /* @__PURE__ */ n("div", { className: "flex w-full items-start", children: w.map((m, k) => {
|
|
621
621
|
const c = m.id === r, C = N.has(m.id), q = C && !c, y = !C && !c ? K.get(m.id) : void 0, V = !C && !c ? f == null ? void 0 : f.get(m.id) : void 0, g = y || V ? [...y ? [D(y)] : [], ...V ?? []] : void 0, _ = g !== void 0, L = m.color ?? "#94a3b8", H = k === w.length - 1, ne = H ? null : w[k + 1], G = ne ? j(m.id, ne.id) : [];
|
|
622
622
|
return /* @__PURE__ */ i("div", { className: "flex flex-1 items-start", children: [
|
|
623
623
|
/* @__PURE__ */ i("div", { className: "flex min-w-[76px] flex-1 flex-col items-center gap-1.5 px-1", children: [
|
|
@@ -632,7 +632,7 @@ function On({
|
|
|
632
632
|
border: c || q ? "none" : _ ? "1.5px dashed #cbd5e1" : "1.5px solid #e2e8f0",
|
|
633
633
|
boxShadow: c ? `0 0 0 3px white, 0 0 0 5px ${L}` : void 0
|
|
634
634
|
},
|
|
635
|
-
children: q ? /* @__PURE__ */ n(Oe, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : c ? /* @__PURE__ */ n("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : _ ? /* @__PURE__ */ n(
|
|
635
|
+
children: q ? /* @__PURE__ */ n(Oe, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : c ? /* @__PURE__ */ n("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : _ ? /* @__PURE__ */ n(an, { className: "h-3 w-3 text-slate-400", strokeWidth: 2.5 }) : /* @__PURE__ */ n("div", { className: "h-2 w-2 rounded-full bg-slate-300" })
|
|
636
636
|
},
|
|
637
637
|
c ? "cur" : q ? "done" : _ ? "skip" : "todo"
|
|
638
638
|
),
|
|
@@ -738,9 +738,9 @@ function On({
|
|
|
738
738
|
] }, m.id);
|
|
739
739
|
}) }) }) });
|
|
740
740
|
}
|
|
741
|
-
function
|
|
741
|
+
function En({ history: t }) {
|
|
742
742
|
return t.length === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400 italic", children: "No transitions yet." }) : /* @__PURE__ */ n("div", { className: "space-y-3", children: t.map((e) => {
|
|
743
|
-
const
|
|
743
|
+
const a = Fe(e), r = a ? Je(e) : st([e.first_name, e.last_name].filter(Boolean).join(" ") || e.user_email, e), l = $n(e), o = e.comment && !a && !l ? e.comment : null, f = l ?? (a ? Ze(e) : null);
|
|
744
744
|
return /* @__PURE__ */ i("div", { className: "flex items-start gap-2.5 text-[12px]", children: [
|
|
745
745
|
/* @__PURE__ */ n("div", { className: "mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-slate-200" }),
|
|
746
746
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
@@ -760,7 +760,7 @@ function Ln({ history: t }) {
|
|
|
760
760
|
className: "mt-0.5 text-slate-400",
|
|
761
761
|
"data-history-on-behalf": e.on_behalf_of_name ? e.on_behalf_of ?? "" : void 0,
|
|
762
762
|
children: [
|
|
763
|
-
|
|
763
|
+
a && /* @__PURE__ */ n(St, { className: "mr-1 inline h-3 w-3", "aria-hidden": !0 }),
|
|
764
764
|
r,
|
|
765
765
|
f ? ` · ${f}` : "",
|
|
766
766
|
" · ",
|
|
@@ -772,8 +772,8 @@ function Ln({ history: t }) {
|
|
|
772
772
|
] }, e.id);
|
|
773
773
|
}) });
|
|
774
774
|
}
|
|
775
|
-
function
|
|
776
|
-
const
|
|
775
|
+
function In({ value: t, onChange: e }) {
|
|
776
|
+
const a = be(), [r, l] = Q(!1), [o, f] = Q(""), [h, N] = Q(""), P = te(null), x = te(null);
|
|
777
777
|
ue(() => {
|
|
778
778
|
r ? setTimeout(() => {
|
|
779
779
|
var D;
|
|
@@ -784,7 +784,7 @@ function jn({ value: t, onChange: e }) {
|
|
|
784
784
|
}), [o]);
|
|
785
785
|
const { data: w, isLoading: S } = se({
|
|
786
786
|
queryKey: ["users", "async-search", h],
|
|
787
|
-
queryFn: () =>
|
|
787
|
+
queryFn: () => a.request(
|
|
788
788
|
de("/users", {
|
|
789
789
|
limit: 50,
|
|
790
790
|
sort: "first_name",
|
|
@@ -794,7 +794,7 @@ function jn({ value: t, onChange: e }) {
|
|
|
794
794
|
enabled: r,
|
|
795
795
|
staleTime: 3e4
|
|
796
796
|
}), { data: B } = se({
|
|
797
|
-
...
|
|
797
|
+
...hn(a, t),
|
|
798
798
|
enabled: !!t,
|
|
799
799
|
staleTime: 5 * 6e4
|
|
800
800
|
}), j = w ?? [], A = B ?? j.find((D) => D.id === t) ?? null, E = A ? [A.first_name, A.last_name].filter(Boolean).join(" ").trim() || A.email : t ? "Selected person" : null, K = (D) => [D.first_name, D.last_name].filter(Boolean).join(" ").trim();
|
|
@@ -819,13 +819,13 @@ function jn({ value: t, onChange: e }) {
|
|
|
819
819
|
D.stopPropagation(), e("");
|
|
820
820
|
},
|
|
821
821
|
className: "absolute right-6 top-1/2 -translate-y-1/2 flex h-5 w-5 items-center justify-center rounded text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-muted dark:hover:text-slate-300",
|
|
822
|
-
children: /* @__PURE__ */ n(
|
|
822
|
+
children: /* @__PURE__ */ n(_t, { className: "h-3 w-3" })
|
|
823
823
|
}
|
|
824
824
|
)
|
|
825
825
|
] }),
|
|
826
826
|
/* @__PURE__ */ i(at, { align: "start", className: "w-72 p-0", sideOffset: 4, children: [
|
|
827
827
|
/* @__PURE__ */ n("div", { className: "border-b border-slate-100 px-2 py-1.5", children: /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
828
|
-
/* @__PURE__ */ n(
|
|
828
|
+
/* @__PURE__ */ n(ln, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
829
829
|
/* @__PURE__ */ n(
|
|
830
830
|
"input",
|
|
831
831
|
{
|
|
@@ -866,13 +866,13 @@ function jn({ value: t, onChange: e }) {
|
|
|
866
866
|
] })
|
|
867
867
|
] });
|
|
868
868
|
}
|
|
869
|
-
function
|
|
869
|
+
function Nt({
|
|
870
870
|
userId: t,
|
|
871
871
|
name: e,
|
|
872
|
-
email:
|
|
872
|
+
email: a,
|
|
873
873
|
initials: r
|
|
874
874
|
}) {
|
|
875
|
-
return /* @__PURE__ */ n(
|
|
875
|
+
return /* @__PURE__ */ n(Rt, { userId: t, children: /* @__PURE__ */ i(
|
|
876
876
|
"button",
|
|
877
877
|
{
|
|
878
878
|
type: "button",
|
|
@@ -880,7 +880,7 @@ function vt({
|
|
|
880
880
|
className: "group/owner flex min-w-0 flex-1 items-center gap-2.5 rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
881
881
|
children: [
|
|
882
882
|
/* @__PURE__ */ n(
|
|
883
|
-
|
|
883
|
+
yn,
|
|
884
884
|
{
|
|
885
885
|
userId: t,
|
|
886
886
|
alt: e,
|
|
@@ -890,33 +890,33 @@ function vt({
|
|
|
890
890
|
),
|
|
891
891
|
/* @__PURE__ */ i("span", { className: "min-w-0 flex-1", children: [
|
|
892
892
|
/* @__PURE__ */ n("span", { className: "block truncate text-[12px] font-medium text-slate-700 underline-offset-2 group-hover/owner:underline dark:text-slate-200", children: e }),
|
|
893
|
-
/* @__PURE__ */ n("span", { className: "block truncate text-[11px] text-slate-400 dark:text-slate-500", children:
|
|
893
|
+
/* @__PURE__ */ n("span", { className: "block truncate text-[11px] text-slate-400 dark:text-slate-500", children: a })
|
|
894
894
|
] })
|
|
895
895
|
]
|
|
896
896
|
}
|
|
897
897
|
) });
|
|
898
898
|
}
|
|
899
|
-
function
|
|
899
|
+
function Kn({
|
|
900
900
|
collection: t,
|
|
901
901
|
item: e,
|
|
902
|
-
states:
|
|
902
|
+
states: a,
|
|
903
903
|
currentStateId: r,
|
|
904
904
|
returned: l = !1
|
|
905
905
|
}) {
|
|
906
906
|
var ie, Z, ge, xe;
|
|
907
|
-
const o = be(), f = Te(), { isAdmin: h } =
|
|
907
|
+
const o = be(), f = Te(), { isAdmin: h } = dn(), [N, P] = Q(!1), [x, w] = Q(""), [S, B] = Q(""), [j, A] = Q(!1), E = ["pipeline-instance-owners", t, e], K = ["pipeline-owners-can-add", t, e], D = () => o.request(
|
|
908
908
|
de(`/pipelines/instance/${t}/${e}/owners`)
|
|
909
|
-
).then((
|
|
909
|
+
).then((s) => {
|
|
910
910
|
var u;
|
|
911
|
-
return f.setQueryData(K, ((u =
|
|
911
|
+
return f.setQueryData(K, ((u = s.meta) == null ? void 0 : u.can_add) ?? null), s;
|
|
912
912
|
}), { data: M, isLoading: m } = se({
|
|
913
913
|
queryKey: E,
|
|
914
|
-
queryFn: () => D().then((
|
|
914
|
+
queryFn: () => D().then((s) => s.data)
|
|
915
915
|
}), { data: k } = se({
|
|
916
916
|
queryKey: K,
|
|
917
|
-
queryFn: () => D().then((
|
|
917
|
+
queryFn: () => D().then((s) => {
|
|
918
918
|
var u;
|
|
919
|
-
return ((u =
|
|
919
|
+
return ((u = s.meta) == null ? void 0 : u.can_add) ?? null;
|
|
920
920
|
}),
|
|
921
921
|
enabled: !m,
|
|
922
922
|
staleTime: 3e4
|
|
@@ -924,19 +924,19 @@ function En({
|
|
|
924
924
|
queryKey: ["pipeline-all-owners", t, e],
|
|
925
925
|
queryFn: () => o.request(
|
|
926
926
|
de(`/pipelines/instance/${t}/${e}/owners/all`)
|
|
927
|
-
).then((
|
|
927
|
+
).then((s) => s.data ?? null),
|
|
928
928
|
enabled: !!r,
|
|
929
929
|
staleTime: 3e4
|
|
930
|
-
}), y = new Set((M ?? []).map((
|
|
931
|
-
(r ? ((Z = C == null ? void 0 : C[r]) == null ? void 0 : Z.unavailable) ?? [] : []).map((
|
|
932
|
-
String(
|
|
933
|
-
|
|
930
|
+
}), y = new Set((M ?? []).map((s) => s.user)), V = r ? (((ie = C == null ? void 0 : C[r]) == null ? void 0 : ie.owners) ?? []).filter((s) => !y.has(s.id)) : [], g = new Map(
|
|
931
|
+
(r ? ((Z = C == null ? void 0 : C[r]) == null ? void 0 : Z.unavailable) ?? [] : []).map((s) => [
|
|
932
|
+
String(s.id).toUpperCase(),
|
|
933
|
+
s
|
|
934
934
|
])
|
|
935
|
-
), _ = V.length + ((M == null ? void 0 : M.length) ?? 0), L = !!((ge =
|
|
935
|
+
), _ = V.length + ((M == null ? void 0 : M.length) ?? 0), L = !!((ge = a.find((s) => s.id === r)) != null && ge.is_initial), H = !m && !q, { data: ne } = se({
|
|
936
936
|
queryKey: ["pipeline-record-creator", t, e],
|
|
937
937
|
queryFn: () => o.request(
|
|
938
938
|
de(`/pipelines/instance/${t}/${e}/creator`)
|
|
939
|
-
).then((
|
|
939
|
+
).then((s) => s.data ?? null),
|
|
940
940
|
enabled: L && H && _ === 0,
|
|
941
941
|
staleTime: 6e4
|
|
942
942
|
}), G = L && _ === 0 && (ne != null && ne.name) ? ne : null, R = () => {
|
|
@@ -952,10 +952,10 @@ function En({
|
|
|
952
952
|
R(), w(""), B(""), P(!1), J.success("Owner added");
|
|
953
953
|
},
|
|
954
954
|
// The server's reason (a 403 says why), not a bare status phrase.
|
|
955
|
-
onError: (
|
|
955
|
+
onError: (s) => J.error(qe(s, "Failed to add owner"))
|
|
956
956
|
}), z = $e({
|
|
957
|
-
mutationFn: (
|
|
958
|
-
onSuccess: (
|
|
957
|
+
mutationFn: (s) => o.request(cn(`/pipelines/instance-owners/${s.id}`)),
|
|
958
|
+
onSuccess: (s, u) => {
|
|
959
959
|
R();
|
|
960
960
|
const b = [u.first_name, u.last_name].filter(Boolean).join(" ") || u.email;
|
|
961
961
|
J.success(`${b} removed as an owner`, {
|
|
@@ -970,19 +970,19 @@ function En({
|
|
|
970
970
|
}
|
|
971
971
|
});
|
|
972
972
|
},
|
|
973
|
-
onError: (
|
|
974
|
-
}), p = (
|
|
973
|
+
onError: (s) => J.error(qe(s, "Failed to remove owner"))
|
|
974
|
+
}), p = (s) => {
|
|
975
975
|
var F, $;
|
|
976
|
-
const u = ((F =
|
|
977
|
-
return (`${u}${b}`.trim() ||
|
|
978
|
-
}, me = (
|
|
976
|
+
const u = ((F = s.first_name) == null ? void 0 : F[0]) ?? "", b = (($ = s.last_name) == null ? void 0 : $[0]) ?? "";
|
|
977
|
+
return (`${u}${b}`.trim() || s.email[0] || "?").toUpperCase();
|
|
978
|
+
}, me = (s) => {
|
|
979
979
|
var u;
|
|
980
|
-
return
|
|
980
|
+
return s ? ((u = a.find((b) => b.id === s || b.key === s)) == null ? void 0 : u.label) ?? s : null;
|
|
981
981
|
};
|
|
982
982
|
return /* @__PURE__ */ i("div", { children: [
|
|
983
983
|
/* @__PURE__ */ i("div", { className: "mb-3 flex items-center justify-between", children: [
|
|
984
984
|
/* @__PURE__ */ i("span", { className: "flex items-center gap-1.5 text-[11px] font-medium text-slate-400", children: [
|
|
985
|
-
/* @__PURE__ */ n(
|
|
985
|
+
/* @__PURE__ */ n(kt, { className: "h-3.5 w-3.5" }),
|
|
986
986
|
"Owners",
|
|
987
987
|
m || q ? /* @__PURE__ */ n("span", { className: "inline-block h-3 w-4 animate-pulse rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : G ? null : /* @__PURE__ */ i("span", { className: "text-slate-300", children: [
|
|
988
988
|
"(",
|
|
@@ -991,7 +991,7 @@ function En({
|
|
|
991
991
|
] })
|
|
992
992
|
] }),
|
|
993
993
|
/* @__PURE__ */ i("span", { className: "flex items-center gap-3", children: [
|
|
994
|
-
r && /* @__PURE__ */ n(
|
|
994
|
+
r && /* @__PURE__ */ n(Nn, { collection: t, itemId: String(e) }),
|
|
995
995
|
!N && c && /* @__PURE__ */ i(
|
|
996
996
|
"button",
|
|
997
997
|
{
|
|
@@ -999,7 +999,7 @@ function En({
|
|
|
999
999
|
onClick: () => P(!0),
|
|
1000
1000
|
className: "flex items-center gap-1 text-[11px] text-slate-400 transition-colors hover:text-nvr-cyan",
|
|
1001
1001
|
children: [
|
|
1002
|
-
/* @__PURE__ */ n(
|
|
1002
|
+
/* @__PURE__ */ n(sn, { className: "h-3 w-3" }),
|
|
1003
1003
|
"Add"
|
|
1004
1004
|
]
|
|
1005
1005
|
}
|
|
@@ -1012,7 +1012,7 @@ function En({
|
|
|
1012
1012
|
] }) : G ? /* @__PURE__ */ i("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
|
|
1013
1013
|
l ? "Back with" : "With",
|
|
1014
1014
|
" ",
|
|
1015
|
-
/* @__PURE__ */ n(
|
|
1015
|
+
/* @__PURE__ */ n(Rt, { userId: G.id, children: /* @__PURE__ */ n(
|
|
1016
1016
|
"button",
|
|
1017
1017
|
{
|
|
1018
1018
|
type: "button",
|
|
@@ -1022,17 +1022,17 @@ function En({
|
|
|
1022
1022
|
}
|
|
1023
1023
|
) })
|
|
1024
1024
|
] }) : _ === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: "No owners assigned." }) : /* @__PURE__ */ i("div", { className: "space-y-px", children: [
|
|
1025
|
-
V.map((
|
|
1025
|
+
V.map((s) => {
|
|
1026
1026
|
var F, $;
|
|
1027
|
-
const u = [
|
|
1027
|
+
const u = [s.first_name, s.last_name].filter(Boolean).join(" ") || s.email, b = (`${((F = s.first_name) == null ? void 0 : F[0]) ?? ""}${(($ = s.last_name) == null ? void 0 : $[0]) ?? ""}`.trim() || s.email[0] || "?").toUpperCase();
|
|
1028
1028
|
return /* @__PURE__ */ i(
|
|
1029
1029
|
"div",
|
|
1030
1030
|
{
|
|
1031
1031
|
className: "-mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
|
|
1032
1032
|
children: [
|
|
1033
|
-
/* @__PURE__ */ n(
|
|
1033
|
+
/* @__PURE__ */ n(Nt, { userId: s.id, name: u, email: s.email, initials: b }),
|
|
1034
1034
|
(() => {
|
|
1035
|
-
const v = g.get(String(
|
|
1035
|
+
const v = g.get(String(s.id).toUpperCase());
|
|
1036
1036
|
return v ? /* @__PURE__ */ n(
|
|
1037
1037
|
"span",
|
|
1038
1038
|
{
|
|
@@ -1046,7 +1046,7 @@ function En({
|
|
|
1046
1046
|
}
|
|
1047
1047
|
) : null;
|
|
1048
1048
|
})(),
|
|
1049
|
-
|
|
1049
|
+
s.queue_only ? /* @__PURE__ */ n(
|
|
1050
1050
|
"span",
|
|
1051
1051
|
{
|
|
1052
1052
|
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",
|
|
@@ -1056,44 +1056,44 @@ function En({
|
|
|
1056
1056
|
) : /* @__PURE__ */ n("span", { className: "shrink-0 rounded-full bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-medium text-nvr-navy/70 dark:text-nvr-cyan", children: "owner group" })
|
|
1057
1057
|
]
|
|
1058
1058
|
},
|
|
1059
|
-
`group-${
|
|
1059
|
+
`group-${s.id}`
|
|
1060
1060
|
);
|
|
1061
1061
|
}),
|
|
1062
|
-
(M ?? []).map((
|
|
1062
|
+
(M ?? []).map((s) => /* @__PURE__ */ i(
|
|
1063
1063
|
"div",
|
|
1064
1064
|
{
|
|
1065
1065
|
className: "group -mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
|
|
1066
1066
|
children: [
|
|
1067
1067
|
/* @__PURE__ */ n(
|
|
1068
|
-
|
|
1068
|
+
Nt,
|
|
1069
1069
|
{
|
|
1070
|
-
userId:
|
|
1071
|
-
name: [
|
|
1072
|
-
email:
|
|
1073
|
-
initials: p(
|
|
1070
|
+
userId: s.user,
|
|
1071
|
+
name: [s.first_name, s.last_name].filter(Boolean).join(" ") || s.email,
|
|
1072
|
+
email: s.email,
|
|
1073
|
+
initials: p(s)
|
|
1074
1074
|
}
|
|
1075
1075
|
),
|
|
1076
1076
|
/* @__PURE__ */ n("span", { className: "shrink-0 rounded-full bg-amber-50 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:bg-amber-500/10 dark:text-amber-400", children: "manual" }),
|
|
1077
|
-
/* @__PURE__ */ n("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children:
|
|
1077
|
+
/* @__PURE__ */ n("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children: s.state ? me(s.state) : "all states" }),
|
|
1078
1078
|
/* @__PURE__ */ n(
|
|
1079
1079
|
"button",
|
|
1080
1080
|
{
|
|
1081
1081
|
type: "button",
|
|
1082
|
-
"aria-label": `Remove ${[
|
|
1082
|
+
"aria-label": `Remove ${[s.first_name, s.last_name].filter(Boolean).join(" ") || s.email} as an owner`,
|
|
1083
1083
|
disabled: z.isPending,
|
|
1084
|
-
onClick: () => z.mutate(
|
|
1084
|
+
onClick: () => z.mutate(s),
|
|
1085
1085
|
className: "shrink-0 rounded p-0.5 text-slate-300 opacity-0 transition-all hover:text-red-500 focus-visible:opacity-100 group-hover:opacity-100",
|
|
1086
|
-
children: /* @__PURE__ */ n(
|
|
1086
|
+
children: /* @__PURE__ */ n(_t, { className: "h-3 w-3" })
|
|
1087
1087
|
}
|
|
1088
1088
|
)
|
|
1089
1089
|
]
|
|
1090
1090
|
},
|
|
1091
|
-
|
|
1091
|
+
s.id
|
|
1092
1092
|
))
|
|
1093
1093
|
] }),
|
|
1094
1094
|
N && /* @__PURE__ */ i("div", { className: "mt-3 space-y-2 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3", children: [
|
|
1095
1095
|
/* @__PURE__ */ n("p", { className: "text-[11px] font-semibold text-slate-500", children: "Add owner" }),
|
|
1096
|
-
/* @__PURE__ */ n(
|
|
1096
|
+
/* @__PURE__ */ n(In, { value: x, onChange: w }),
|
|
1097
1097
|
h ? /* @__PURE__ */ i(nt, { open: j, onOpenChange: A, children: [
|
|
1098
1098
|
/* @__PURE__ */ n(rt, { asChild: !0, children: /* @__PURE__ */ i(
|
|
1099
1099
|
"button",
|
|
@@ -1101,28 +1101,28 @@ function En({
|
|
|
1101
1101
|
type: "button",
|
|
1102
1102
|
className: "flex h-8 w-full items-center justify-between rounded-md border border-slate-200 bg-white px-2.5 text-left text-[13px] text-slate-700 transition-colors hover:border-slate-300 dark:border-border dark:bg-transparent dark:text-slate-300",
|
|
1103
1103
|
children: [
|
|
1104
|
-
/* @__PURE__ */ n("span", { className: "truncate", children: S ? ((xe =
|
|
1104
|
+
/* @__PURE__ */ n("span", { className: "truncate", children: S ? ((xe = a.find((s) => s.id === S)) == null ? void 0 : xe.label) ?? S : "All states" }),
|
|
1105
1105
|
/* @__PURE__ */ n(ve, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
1106
1106
|
]
|
|
1107
1107
|
}
|
|
1108
1108
|
) }),
|
|
1109
|
-
/* @__PURE__ */ n(at, { align: "start", sideOffset: 4, className: "w-52 p-1", children: ["", ...
|
|
1109
|
+
/* @__PURE__ */ n(at, { align: "start", sideOffset: 4, className: "w-52 p-1", children: ["", ...a.map((s) => s.id)].map((s) => {
|
|
1110
1110
|
var F;
|
|
1111
|
-
const u =
|
|
1111
|
+
const u = s === "" ? "All states" : ((F = a.find(($) => $.id === s)) == null ? void 0 : F.label) ?? s;
|
|
1112
1112
|
return /* @__PURE__ */ n(
|
|
1113
1113
|
"button",
|
|
1114
1114
|
{
|
|
1115
1115
|
type: "button",
|
|
1116
1116
|
className: ke(
|
|
1117
1117
|
"flex w-full rounded px-2.5 py-1.5 text-left text-[13px] transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
|
|
1118
|
-
S ===
|
|
1118
|
+
S === s && "font-medium text-slate-800 dark:text-slate-200"
|
|
1119
1119
|
),
|
|
1120
1120
|
onClick: () => {
|
|
1121
|
-
B(
|
|
1121
|
+
B(s), A(!1);
|
|
1122
1122
|
},
|
|
1123
1123
|
children: u
|
|
1124
1124
|
},
|
|
1125
|
-
|
|
1125
|
+
s
|
|
1126
1126
|
);
|
|
1127
1127
|
}) })
|
|
1128
1128
|
] }) : /* @__PURE__ */ n("p", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: "Hands off the current step." }),
|
|
@@ -1155,39 +1155,66 @@ function En({
|
|
|
1155
1155
|
] })
|
|
1156
1156
|
] });
|
|
1157
1157
|
}
|
|
1158
|
-
function
|
|
1159
|
-
if (!t || !(
|
|
1160
|
-
const o = new Map(
|
|
1158
|
+
function Xt(t, e, a, r) {
|
|
1159
|
+
if (!t || !(a != null && a.length)) return null;
|
|
1160
|
+
const o = new Map(a.map((N) => [String(N.id).toUpperCase(), N])).get(String(t.to_state).toUpperCase()), f = Number(e == null ? void 0 : e.sort);
|
|
1161
1161
|
if (!o || !Number.isFinite(f) || !(Number(o.sort) > f)) return null;
|
|
1162
|
-
const h =
|
|
1162
|
+
const h = _n(String(t.to_state), a, r);
|
|
1163
1163
|
return h && h.skipped.length > 0 ? h : null;
|
|
1164
1164
|
}
|
|
1165
|
-
function
|
|
1166
|
-
var r;
|
|
1165
|
+
function Yt({ landing: t }) {
|
|
1167
1166
|
if (!t || t.skipped.length === 0) return null;
|
|
1168
|
-
const e =
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
/* @__PURE__ */
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1167
|
+
const e = Sn(t);
|
|
1168
|
+
if (e.length === 1) {
|
|
1169
|
+
const a = e[0];
|
|
1170
|
+
return /* @__PURE__ */ i(
|
|
1171
|
+
"p",
|
|
1172
|
+
{
|
|
1173
|
+
"data-confirm-skips": !0,
|
|
1174
|
+
className: "text-[11.5px] leading-snug text-slate-600 dark:text-slate-300",
|
|
1175
|
+
children: [
|
|
1176
|
+
"Goes straight to ",
|
|
1177
|
+
/* @__PURE__ */ n("span", { className: "font-medium", children: t.state.label }),
|
|
1178
|
+
" —",
|
|
1179
|
+
" ",
|
|
1180
|
+
yt(a.labels),
|
|
1181
|
+
" ",
|
|
1182
|
+
a.labels.length === 1 ? "is" : "are",
|
|
1183
|
+
" skipped",
|
|
1184
|
+
a.reason ? ` (${a.reason})` : "",
|
|
1185
|
+
"."
|
|
1186
|
+
]
|
|
1187
|
+
}
|
|
1188
|
+
);
|
|
1189
|
+
}
|
|
1190
|
+
return /* @__PURE__ */ i(
|
|
1191
|
+
"div",
|
|
1192
|
+
{
|
|
1193
|
+
"data-confirm-skips": !0,
|
|
1194
|
+
className: "text-[11.5px] leading-snug text-slate-600 dark:text-slate-300",
|
|
1195
|
+
children: [
|
|
1196
|
+
/* @__PURE__ */ i("p", { children: [
|
|
1197
|
+
"Goes straight to ",
|
|
1198
|
+
/* @__PURE__ */ n("span", { className: "font-medium", children: t.state.label }),
|
|
1199
|
+
". Skipped on the way:"
|
|
1200
|
+
] }),
|
|
1201
|
+
/* @__PURE__ */ n("ul", { className: "mt-0.5 list-disc space-y-0.5 pl-4", children: e.map((a) => /* @__PURE__ */ i("li", { children: [
|
|
1202
|
+
/* @__PURE__ */ n("span", { className: "font-medium", children: yt(a.labels) }),
|
|
1203
|
+
a.reason ? ` — ${a.reason}` : ""
|
|
1204
|
+
] }, a.labels.join("|"))) })
|
|
1205
|
+
]
|
|
1206
|
+
}
|
|
1207
|
+
);
|
|
1181
1208
|
}
|
|
1182
1209
|
const Ce = {
|
|
1183
1210
|
out: "out of office",
|
|
1184
1211
|
suspended: "suspended",
|
|
1185
1212
|
redacted: "redacted"
|
|
1186
1213
|
};
|
|
1187
|
-
function
|
|
1214
|
+
function Qn({
|
|
1188
1215
|
collection: t,
|
|
1189
1216
|
item: e,
|
|
1190
|
-
states:
|
|
1217
|
+
states: a,
|
|
1191
1218
|
currentStateId: r
|
|
1192
1219
|
}) {
|
|
1193
1220
|
const l = be(), [o, f] = Q(!1), { data: h, isLoading: N } = se({
|
|
@@ -1197,7 +1224,7 @@ function In({
|
|
|
1197
1224
|
).then((x) => x.data ?? null),
|
|
1198
1225
|
enabled: o,
|
|
1199
1226
|
staleTime: 3e4
|
|
1200
|
-
}), P = [...
|
|
1227
|
+
}), P = [...a].filter((x) => {
|
|
1201
1228
|
var w;
|
|
1202
1229
|
return !h || ((w = h[x.id]) == null ? void 0 : w.on_path) !== !1;
|
|
1203
1230
|
}).sort((x, w) => x.sort - w.sort);
|
|
@@ -1209,7 +1236,7 @@ function In({
|
|
|
1209
1236
|
title: "View approval chain",
|
|
1210
1237
|
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",
|
|
1211
1238
|
onClick: (x) => x.stopPropagation(),
|
|
1212
|
-
children: /* @__PURE__ */ n(
|
|
1239
|
+
children: /* @__PURE__ */ n(kt, { className: "h-3.5 w-3.5" })
|
|
1213
1240
|
}
|
|
1214
1241
|
) }),
|
|
1215
1242
|
/* @__PURE__ */ i(at, { align: "end", sideOffset: 6, className: "w-[576px] p-0 overflow-hidden", children: [
|
|
@@ -1243,7 +1270,7 @@ function In({
|
|
|
1243
1270
|
// Radix tooltip with zero delay — native `title` waits on
|
|
1244
1271
|
// the OS hover timer, and a truncated reason needs its
|
|
1245
1272
|
// full text the moment the cursor lands on it.
|
|
1246
|
-
/* @__PURE__ */ n(
|
|
1273
|
+
/* @__PURE__ */ n(Pt, { delayDuration: 0, children: /* @__PURE__ */ i(Ve, { children: [
|
|
1247
1274
|
/* @__PURE__ */ n(Xe, { asChild: !0, children: /* @__PURE__ */ i("div", { className: "flex min-w-0 flex-1 cursor-default items-center gap-2", children: [
|
|
1248
1275
|
/* @__PURE__ */ n("span", { className: "inline-flex shrink-0 items-center gap-1 rounded-full border border-dashed border-slate-300 px-2 py-0.5 text-[10.5px] font-medium text-slate-400 dark:border-slate-600 dark:text-slate-500", children: "Skipped" }),
|
|
1249
1276
|
j.length > 0 && /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-[11px] text-slate-400 dark:text-slate-500", children: j.join(" · ") })
|
|
@@ -1262,7 +1289,7 @@ function In({
|
|
|
1262
1289
|
)
|
|
1263
1290
|
] }) })
|
|
1264
1291
|
) : /* @__PURE__ */ i(he, { children: [
|
|
1265
|
-
/* @__PURE__ */ n(
|
|
1292
|
+
/* @__PURE__ */ n(wn, { owners: w, max: 10, emptyLabel: "—" }),
|
|
1266
1293
|
A.map((c) => /* @__PURE__ */ i(
|
|
1267
1294
|
"span",
|
|
1268
1295
|
{
|
|
@@ -1306,10 +1333,10 @@ function In({
|
|
|
1306
1333
|
] })
|
|
1307
1334
|
] });
|
|
1308
1335
|
}
|
|
1309
|
-
function
|
|
1336
|
+
function kr({
|
|
1310
1337
|
collection: t,
|
|
1311
1338
|
item: e,
|
|
1312
|
-
defaultExpanded:
|
|
1339
|
+
defaultExpanded: a,
|
|
1313
1340
|
title: r,
|
|
1314
1341
|
showApprovalChain: l,
|
|
1315
1342
|
hideActionsCollapsed: o,
|
|
@@ -1320,11 +1347,11 @@ function vr({
|
|
|
1320
1347
|
asRole: x
|
|
1321
1348
|
}) {
|
|
1322
1349
|
return e === "new" ? null : /* @__PURE__ */ n(
|
|
1323
|
-
|
|
1350
|
+
zn,
|
|
1324
1351
|
{
|
|
1325
1352
|
collection: t,
|
|
1326
1353
|
item: e,
|
|
1327
|
-
defaultExpanded:
|
|
1354
|
+
defaultExpanded: a,
|
|
1328
1355
|
title: r,
|
|
1329
1356
|
showApprovalChain: l,
|
|
1330
1357
|
hideActionsCollapsed: o,
|
|
@@ -1337,10 +1364,10 @@ function vr({
|
|
|
1337
1364
|
`${t}:${e}`
|
|
1338
1365
|
);
|
|
1339
1366
|
}
|
|
1340
|
-
function
|
|
1341
|
-
const
|
|
1342
|
-
queryKey:
|
|
1343
|
-
queryFn: () =>
|
|
1367
|
+
function Jt({ collection: t, item: e }) {
|
|
1368
|
+
const a = be(), { data: r } = se({
|
|
1369
|
+
queryKey: jt(t, e),
|
|
1370
|
+
queryFn: () => Et(a, t, e),
|
|
1344
1371
|
staleTime: 3e4,
|
|
1345
1372
|
retry: !1
|
|
1346
1373
|
});
|
|
@@ -1426,10 +1453,10 @@ function Yt({ collection: t, item: e }) {
|
|
|
1426
1453
|
))
|
|
1427
1454
|
] });
|
|
1428
1455
|
}
|
|
1429
|
-
function
|
|
1456
|
+
function zn({
|
|
1430
1457
|
collection: t,
|
|
1431
1458
|
item: e,
|
|
1432
|
-
defaultExpanded:
|
|
1459
|
+
defaultExpanded: a,
|
|
1433
1460
|
title: r,
|
|
1434
1461
|
showApprovalChain: l,
|
|
1435
1462
|
hideActionsCollapsed: o,
|
|
@@ -1440,12 +1467,12 @@ function Kn({
|
|
|
1440
1467
|
asRole: x
|
|
1441
1468
|
}) {
|
|
1442
1469
|
var ct, ut, mt;
|
|
1443
|
-
const w = be(), S = Te(), [B, j] = Q(""), [A, E] = Q(null), [K, D] = Q(!1), [M, m] = Q(!1), [k, c] = Q(null), [C, q] = Q(null), [y, V] = Q([]), g =
|
|
1444
|
-
|
|
1445
|
-
const _ =
|
|
1470
|
+
const w = be(), S = Te(), [B, j] = Q(""), [A, E] = Q(null), [K, D] = Q(!1), [M, m] = Q(!1), [k, c] = Q(null), [C, q] = Q(null), [y, V] = Q([]), g = It(t, String(e));
|
|
1471
|
+
qt(t, e, "transition", !!A || !!k);
|
|
1472
|
+
const _ = mn(t, e, "transition"), L = te(!1);
|
|
1446
1473
|
ue(() => {
|
|
1447
|
-
!L.current &&
|
|
1448
|
-
}, [
|
|
1474
|
+
!L.current && a !== void 0 && (L.current = !0, m(a));
|
|
1475
|
+
}, [a]);
|
|
1449
1476
|
const H = te(!1), ne = (d) => {
|
|
1450
1477
|
H.current || (H.current = !0, q(null), b.mutate(d, {
|
|
1451
1478
|
onSettled: (T, U) => {
|
|
@@ -1494,7 +1521,7 @@ function Kn({
|
|
|
1494
1521
|
return;
|
|
1495
1522
|
}
|
|
1496
1523
|
V([]), E(d);
|
|
1497
|
-
}, R = x ? ["pipeline-instance", t, e, x] : ["pipeline-instance", t, e], { settling: X, settle: z } =
|
|
1524
|
+
}, R = x ? ["pipeline-instance", t, e, x] : ["pipeline-instance", t, e], { settling: X, settle: z } = Ot(R), { data: p, isLoading: me } = se({
|
|
1498
1525
|
queryKey: R,
|
|
1499
1526
|
queryFn: () => w.request(
|
|
1500
1527
|
de(
|
|
@@ -1511,7 +1538,7 @@ function Kn({
|
|
|
1511
1538
|
}
|
|
1512
1539
|
),
|
|
1513
1540
|
staleTime: 1e4
|
|
1514
|
-
}), ie =
|
|
1541
|
+
}), ie = Lt(
|
|
1515
1542
|
p ? (p.available_transitions ?? []).map((d) => String(d.id)) : null,
|
|
1516
1543
|
`${t}:${e}`
|
|
1517
1544
|
);
|
|
@@ -1530,13 +1557,13 @@ function Kn({
|
|
|
1530
1557
|
).then((d) => d.data ?? null),
|
|
1531
1558
|
// Also when a send back is on offer: its target may be a chain step this record skipped.
|
|
1532
1559
|
// And while a move is being confirmed: the panel names where it really lands.
|
|
1533
|
-
enabled: (M ||
|
|
1560
|
+
enabled: (M || Qt(p) || !!A) && !!(p != null && p.instance),
|
|
1534
1561
|
staleTime: 3e4
|
|
1535
1562
|
}), xe = Ae(() => {
|
|
1536
1563
|
if (!Z) return null;
|
|
1537
1564
|
const d = Object.entries(Z);
|
|
1538
1565
|
return d.length === 0 || d.every(([, T]) => T.on_path === void 0) ? null : new Set(d.filter(([, T]) => T.on_path !== !1).map(([T]) => T));
|
|
1539
|
-
}, [Z]),
|
|
1566
|
+
}, [Z]), s = Ae(() => {
|
|
1540
1567
|
if (!Z) return null;
|
|
1541
1568
|
const d = /* @__PURE__ */ new Map();
|
|
1542
1569
|
for (const [T, U] of Object.entries(Z))
|
|
@@ -1563,7 +1590,7 @@ function Kn({
|
|
|
1563
1590
|
onMutate: (d) => {
|
|
1564
1591
|
var T;
|
|
1565
1592
|
return {
|
|
1566
|
-
slow:
|
|
1593
|
+
slow: Ht(
|
|
1567
1594
|
(T = [...(p == null ? void 0 : p.available_transitions) ?? [], ...(p == null ? void 0 : p.all_transitions) ?? []].find(
|
|
1568
1595
|
(U) => U.id === d.transition_id
|
|
1569
1596
|
)) == null ? void 0 : T.label
|
|
@@ -1571,14 +1598,14 @@ function Kn({
|
|
|
1571
1598
|
};
|
|
1572
1599
|
},
|
|
1573
1600
|
onSuccess: (d, T, U) => {
|
|
1574
|
-
S.invalidateQueries({ queryKey: R }), t === "nivaro_addendums" && S.invalidateQueries({ queryKey: ["addendums"] }), Be(S, t, String(e)), Re(S, t, String(e)),
|
|
1601
|
+
S.invalidateQueries({ queryKey: R }), t === "nivaro_addendums" && S.invalidateQueries({ queryKey: ["addendums"] }), Be(S, t, String(e)), Re(S, t, String(e)), Gt(S, t, String(e)), q(null), j(""), E(null), c(null), J.success(Wt(p, T.transition_id, d), U == null ? void 0 : U.slow.done());
|
|
1575
1602
|
},
|
|
1576
1603
|
onError: (d, T, U) => {
|
|
1577
|
-
if (U == null || U.slow.fail(),
|
|
1604
|
+
if (U == null || U.slow.fail(), At(d)) {
|
|
1578
1605
|
S.invalidateQueries({ queryKey: R });
|
|
1579
1606
|
return;
|
|
1580
1607
|
}
|
|
1581
|
-
const Y =
|
|
1608
|
+
const Y = Ut(d);
|
|
1582
1609
|
if (Y) {
|
|
1583
1610
|
c((le) => ({
|
|
1584
1611
|
payload: Y,
|
|
@@ -1589,14 +1616,14 @@ function Kn({
|
|
|
1589
1616
|
return;
|
|
1590
1617
|
}
|
|
1591
1618
|
const I = d == null ? void 0 : d.response;
|
|
1592
|
-
q(
|
|
1619
|
+
q(Bt(d, T)), J.error(qe(d, "Failed to execute transition"), {
|
|
1593
1620
|
duration: 12e3,
|
|
1594
1621
|
// What to do next + Copy details (lib/error-toast.ts); "Why?" below wins the action slot.
|
|
1595
|
-
|
|
1622
|
+
...Tt(d, { action: "Transition" }),
|
|
1596
1623
|
// #1867: a refusal carries "Why?" — the role, owner or access rule
|
|
1597
1624
|
// that stopped it, and who can change it.
|
|
1598
|
-
...
|
|
1599
|
-
action:
|
|
1625
|
+
...Dt(d) ? {
|
|
1626
|
+
action: Mt(w, {
|
|
1600
1627
|
collection: t,
|
|
1601
1628
|
itemId: String(e),
|
|
1602
1629
|
action: "transition",
|
|
@@ -1629,13 +1656,13 @@ function Kn({
|
|
|
1629
1656
|
/* @__PURE__ */ n(pe, { className: "ml-auto h-3.5 w-3.5 rounded" })
|
|
1630
1657
|
] }) });
|
|
1631
1658
|
if (!(p != null && p.binding)) return null;
|
|
1632
|
-
const { instance: v, available_transitions: ce, history: O, states: re } = p, we = new Map((re ?? []).map((d) => [d.id, d])), ye = (v == null ? void 0 : v.current_state_obj) ?? null, ae = A ? (ce ?? []).find((d) => d.id === A) : null,
|
|
1659
|
+
const { instance: v, available_transitions: ce, history: O, states: re } = p, we = new Map((re ?? []).map((d) => [d.id, d])), ye = (v == null ? void 0 : v.current_state_obj) ?? null, ae = A ? (ce ?? []).find((d) => d.id === A) : null, Zt = ae ? we.get(ae.to_state) : null, Pe = Xt(ae, ye, re, Z), je = (Pe == null ? void 0 : Pe.state) ?? Zt, en = v != null && v.completed_at && ce ? ce.filter(
|
|
1633
1660
|
(d) => d.from_state && String(d.from_state).toUpperCase() === String(v.current_state).toUpperCase()
|
|
1634
|
-
) : null, Ee = v != null && v.completed_at ?
|
|
1661
|
+
) : null, Ee = v != null && v.completed_at ? en ?? [] : zt(
|
|
1635
1662
|
ce ?? [],
|
|
1636
1663
|
re ?? [],
|
|
1637
1664
|
v == null ? void 0 : v.current_state,
|
|
1638
|
-
|
|
1665
|
+
s
|
|
1639
1666
|
), it = Ee.length > 0, lt = (d, T = !1) => {
|
|
1640
1667
|
const U = /* @__PURE__ */ new Map();
|
|
1641
1668
|
for (const Y of d) {
|
|
@@ -1705,7 +1732,7 @@ function Kn({
|
|
|
1705
1732
|
] }, Y);
|
|
1706
1733
|
});
|
|
1707
1734
|
}, Ie = C ? /* @__PURE__ */ n(
|
|
1708
|
-
|
|
1735
|
+
Vt,
|
|
1709
1736
|
{
|
|
1710
1737
|
collection: t,
|
|
1711
1738
|
item: String(e),
|
|
@@ -1713,7 +1740,7 @@ function Kn({
|
|
|
1713
1740
|
onDismiss: () => q(null),
|
|
1714
1741
|
onFixed: () => ne({ transition_id: C.transitionId, comment: C.comment })
|
|
1715
1742
|
}
|
|
1716
|
-
) : null, ot =
|
|
1743
|
+
) : null, ot = Bn(O ?? [], v == null ? void 0 : v.current_state, re ?? []), dt = /* @__PURE__ */ i("div", { className: "space-y-3 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3.5", children: [
|
|
1717
1744
|
/* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1718
1745
|
/* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
|
|
1719
1746
|
ae && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: ae.label }),
|
|
@@ -1723,9 +1750,9 @@ function Kn({
|
|
|
1723
1750
|
/* @__PURE__ */ n(fe, { label: je.label, color: je.color, small: !0 })
|
|
1724
1751
|
] })
|
|
1725
1752
|
] }),
|
|
1726
|
-
/* @__PURE__ */ n(
|
|
1727
|
-
/* @__PURE__ */ n(
|
|
1728
|
-
/* @__PURE__ */ n(
|
|
1753
|
+
/* @__PURE__ */ n(Yt, { landing: Pe }),
|
|
1754
|
+
/* @__PURE__ */ n(Jt, { collection: t, item: e }),
|
|
1755
|
+
/* @__PURE__ */ n(Kt, { lines: y }),
|
|
1729
1756
|
/* @__PURE__ */ n(
|
|
1730
1757
|
"input",
|
|
1731
1758
|
{
|
|
@@ -1795,7 +1822,7 @@ function Kn({
|
|
|
1795
1822
|
`),
|
|
1796
1823
|
"data-pipeline-auto-held-pill": !0,
|
|
1797
1824
|
children: [
|
|
1798
|
-
/* @__PURE__ */ n(
|
|
1825
|
+
/* @__PURE__ */ n(rn, { className: "h-3 w-3 shrink-0" }),
|
|
1799
1826
|
"Needs a person"
|
|
1800
1827
|
]
|
|
1801
1828
|
}
|
|
@@ -1811,7 +1838,7 @@ function Kn({
|
|
|
1811
1838
|
"data-pipeline-approving": !0,
|
|
1812
1839
|
children: [
|
|
1813
1840
|
/* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-sky-400" }),
|
|
1814
|
-
|
|
1841
|
+
pn(_, "approving")
|
|
1815
1842
|
]
|
|
1816
1843
|
}
|
|
1817
1844
|
)
|
|
@@ -1835,7 +1862,7 @@ function Kn({
|
|
|
1835
1862
|
}
|
|
1836
1863
|
),
|
|
1837
1864
|
l && ((p == null ? void 0 : p.binding) || (p == null ? void 0 : p.instance)) && /* @__PURE__ */ n(
|
|
1838
|
-
|
|
1865
|
+
Qn,
|
|
1839
1866
|
{
|
|
1840
1867
|
collection: t,
|
|
1841
1868
|
item: e,
|
|
@@ -1858,9 +1885,9 @@ function Kn({
|
|
|
1858
1885
|
),
|
|
1859
1886
|
!M && A && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: dt }),
|
|
1860
1887
|
!M && Ie && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: Ie }),
|
|
1861
|
-
ot && !(v != null && v.completed_at) && /* @__PURE__ */ n(
|
|
1888
|
+
ot && !(v != null && v.completed_at) && /* @__PURE__ */ n(On, { entry: ot }),
|
|
1862
1889
|
M && /* @__PURE__ */ i("div", { className: "border-t border-slate-100 dark:border-border/60", children: [
|
|
1863
|
-
/* @__PURE__ */ n(
|
|
1890
|
+
/* @__PURE__ */ n(qn, { held: (p == null ? void 0 : p.auto_held) ?? [] }),
|
|
1864
1891
|
N && /* @__PURE__ */ i("div", { className: "flex items-center gap-2 border-b border-amber-100 bg-amber-50 px-5 py-2.5 dark:border-amber-500/20 dark:bg-amber-500/10", children: [
|
|
1865
1892
|
/* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
|
|
1866
1893
|
/* @__PURE__ */ n("p", { className: "text-[12px] text-amber-700 dark:text-amber-400", children: "An addendum is in review — coordinate transitions carefully." })
|
|
@@ -1880,7 +1907,7 @@ function Kn({
|
|
|
1880
1907
|
/* @__PURE__ */ n(pe, { className: "ml-2 h-3 w-24" })
|
|
1881
1908
|
] })
|
|
1882
1909
|
) : /* @__PURE__ */ n(
|
|
1883
|
-
|
|
1910
|
+
jn,
|
|
1884
1911
|
{
|
|
1885
1912
|
states: re,
|
|
1886
1913
|
allTransitions: (p == null ? void 0 : p.all_transitions) ?? [],
|
|
@@ -1888,12 +1915,12 @@ function Kn({
|
|
|
1888
1915
|
currentStateId: v.current_state,
|
|
1889
1916
|
history: O ?? [],
|
|
1890
1917
|
onPathIds: xe,
|
|
1891
|
-
skippedStates:
|
|
1918
|
+
skippedStates: s
|
|
1892
1919
|
}
|
|
1893
1920
|
),
|
|
1894
|
-
(p == null ? void 0 : p.branches) && /* @__PURE__ */ n(
|
|
1921
|
+
(p == null ? void 0 : p.branches) && /* @__PURE__ */ n(kn, { data: p.branches }),
|
|
1895
1922
|
/* @__PURE__ */ n(
|
|
1896
|
-
|
|
1923
|
+
Ln,
|
|
1897
1924
|
{
|
|
1898
1925
|
history: O ?? [],
|
|
1899
1926
|
completedAt: v.completed_at
|
|
@@ -1901,9 +1928,9 @@ function Kn({
|
|
|
1901
1928
|
)
|
|
1902
1929
|
] }),
|
|
1903
1930
|
/* @__PURE__ */ i("div", { className: "space-y-3 px-5 py-4", children: [
|
|
1904
|
-
!v.completed_at && /* @__PURE__ */ n(
|
|
1931
|
+
!v.completed_at && /* @__PURE__ */ n(Cn, { collection: t, itemId: String(e) }),
|
|
1905
1932
|
/* @__PURE__ */ n(
|
|
1906
|
-
|
|
1933
|
+
Kn,
|
|
1907
1934
|
{
|
|
1908
1935
|
collection: t,
|
|
1909
1936
|
item: e,
|
|
@@ -1950,7 +1977,7 @@ function Kn({
|
|
|
1950
1977
|
]
|
|
1951
1978
|
}
|
|
1952
1979
|
),
|
|
1953
|
-
K && /* @__PURE__ */ n("div", { className: "mt-3", children: /* @__PURE__ */ n(
|
|
1980
|
+
K && /* @__PURE__ */ n("div", { className: "mt-3", children: /* @__PURE__ */ n(En, { history: O ?? [] }) })
|
|
1954
1981
|
] })
|
|
1955
1982
|
] }) : /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-4 px-5 py-4", children: [
|
|
1956
1983
|
/* @__PURE__ */ n("p", { className: "text-[13px] text-slate-500", children: "Pipeline not started for this record." }),
|
|
@@ -1973,8 +2000,8 @@ function Kn({
|
|
|
1973
2000
|
]
|
|
1974
2001
|
}
|
|
1975
2002
|
),
|
|
1976
|
-
k && /* @__PURE__ */ n(
|
|
1977
|
-
|
|
2003
|
+
k && /* @__PURE__ */ n(Ct, { fallback: null, children: /* @__PURE__ */ n(
|
|
2004
|
+
Ft,
|
|
1978
2005
|
{
|
|
1979
2006
|
payload: k.payload,
|
|
1980
2007
|
transitionId: k.transitionId,
|
|
@@ -1996,32 +2023,32 @@ function Kn({
|
|
|
1996
2023
|
) })
|
|
1997
2024
|
] });
|
|
1998
2025
|
}
|
|
1999
|
-
function
|
|
2026
|
+
function _r({
|
|
2000
2027
|
collection: t,
|
|
2001
2028
|
item: e,
|
|
2002
|
-
onBeforeTransition:
|
|
2029
|
+
onBeforeTransition: a,
|
|
2003
2030
|
wrap: r = !0
|
|
2004
2031
|
}) {
|
|
2005
2032
|
return e === "new" ? null : /* @__PURE__ */ n(
|
|
2006
|
-
|
|
2033
|
+
Wn,
|
|
2007
2034
|
{
|
|
2008
2035
|
collection: t,
|
|
2009
2036
|
item: e,
|
|
2010
|
-
onBeforeTransition:
|
|
2037
|
+
onBeforeTransition: a,
|
|
2011
2038
|
wrap: r
|
|
2012
2039
|
}
|
|
2013
2040
|
);
|
|
2014
2041
|
}
|
|
2015
|
-
function
|
|
2042
|
+
function Wn({
|
|
2016
2043
|
collection: t,
|
|
2017
2044
|
item: e,
|
|
2018
|
-
onBeforeTransition:
|
|
2045
|
+
onBeforeTransition: a,
|
|
2019
2046
|
wrap: r = !0
|
|
2020
2047
|
}) {
|
|
2021
|
-
const l = be(), o = Te(), [f, h] = Q(""), [N, P] = Q(null), [x, w] = Q(null), [S, B] = Q(null), [j, A] = Q([]), E =
|
|
2022
|
-
|
|
2023
|
-
const K = te(null), D =
|
|
2024
|
-
M.current || (M.current = !0, B(null), L.mutate(
|
|
2048
|
+
const l = be(), o = Te(), [f, h] = Q(""), [N, P] = Q(null), [x, w] = Q(null), [S, B] = Q(null), [j, A] = Q([]), E = It(t, String(e));
|
|
2049
|
+
qt(t, e, "transition", !!N || !!x);
|
|
2050
|
+
const K = te(null), D = xn(K, !r), M = te(!1), m = (s) => {
|
|
2051
|
+
M.current || (M.current = !0, B(null), L.mutate(s, {
|
|
2025
2052
|
onSettled: (u, b) => {
|
|
2026
2053
|
if (b) {
|
|
2027
2054
|
M.current = !1;
|
|
@@ -2032,24 +2059,24 @@ function Qn({
|
|
|
2032
2059
|
});
|
|
2033
2060
|
}
|
|
2034
2061
|
}));
|
|
2035
|
-
}, k = async (
|
|
2062
|
+
}, k = async (s) => {
|
|
2036
2063
|
var F;
|
|
2037
2064
|
if (M.current) return;
|
|
2038
|
-
if (N ===
|
|
2065
|
+
if (N === s) {
|
|
2039
2066
|
P(null);
|
|
2040
2067
|
return;
|
|
2041
2068
|
}
|
|
2042
|
-
if (
|
|
2069
|
+
if (a) {
|
|
2043
2070
|
M.current = !0;
|
|
2044
2071
|
let $ = !1;
|
|
2045
2072
|
try {
|
|
2046
|
-
$ = await
|
|
2073
|
+
$ = await a();
|
|
2047
2074
|
} finally {
|
|
2048
2075
|
M.current = !1;
|
|
2049
2076
|
}
|
|
2050
2077
|
if (!$) return;
|
|
2051
2078
|
}
|
|
2052
|
-
const u = (G ?? []).find(($) => $.id ===
|
|
2079
|
+
const u = (G ?? []).find(($) => $.id === s), b = String((u == null ? void 0 : u.comment_mode) ?? "none");
|
|
2053
2080
|
if (b !== "optional" && b !== "required") {
|
|
2054
2081
|
if (u && !Le(u, (y == null ? void 0 : y.states) ?? [], (F = y == null ? void 0 : y.instance) == null ? void 0 : F.current_state)) {
|
|
2055
2082
|
M.current = !0;
|
|
@@ -2060,20 +2087,20 @@ function Qn({
|
|
|
2060
2087
|
M.current = !1;
|
|
2061
2088
|
}
|
|
2062
2089
|
if ($.length > 0) {
|
|
2063
|
-
A($), P(
|
|
2090
|
+
A($), P(s);
|
|
2064
2091
|
return;
|
|
2065
2092
|
}
|
|
2066
2093
|
}
|
|
2067
|
-
m({ transition_id:
|
|
2094
|
+
m({ transition_id: s });
|
|
2068
2095
|
return;
|
|
2069
2096
|
}
|
|
2070
|
-
A([]), P(
|
|
2071
|
-
}, c = ["pipeline-instance", t, e], { settling: C, settle: q } =
|
|
2097
|
+
A([]), P(s);
|
|
2098
|
+
}, c = ["pipeline-instance", t, e], { settling: C, settle: q } = Ot(c), { data: y } = se({
|
|
2072
2099
|
queryKey: c,
|
|
2073
2100
|
queryFn: () => l.request(
|
|
2074
2101
|
de(`/pipelines/instance/${t}/${e}`)
|
|
2075
2102
|
).then(
|
|
2076
|
-
(
|
|
2103
|
+
(s) => s.data ?? {
|
|
2077
2104
|
instance: null,
|
|
2078
2105
|
states: [],
|
|
2079
2106
|
available_transitions: [],
|
|
@@ -2083,54 +2110,54 @@ function Qn({
|
|
|
2083
2110
|
}
|
|
2084
2111
|
),
|
|
2085
2112
|
staleTime: 1e4
|
|
2086
|
-
}), V =
|
|
2087
|
-
y ? (y.available_transitions ?? []).map((
|
|
2113
|
+
}), V = Lt(
|
|
2114
|
+
y ? (y.available_transitions ?? []).map((s) => String(s.id)) : null,
|
|
2088
2115
|
`${t}:${e}`
|
|
2089
2116
|
), { data: g } = se({
|
|
2090
2117
|
queryKey: ["pipeline-all-owners", t, e],
|
|
2091
2118
|
queryFn: () => l.request(
|
|
2092
2119
|
de(`/pipelines/instance/${t}/${e}/owners/all`)
|
|
2093
|
-
).then((
|
|
2120
|
+
).then((s) => s.data ?? null),
|
|
2094
2121
|
// Also while a move is being confirmed: the panel names where it really lands.
|
|
2095
|
-
enabled:
|
|
2122
|
+
enabled: Qt(y) || !!N,
|
|
2096
2123
|
staleTime: 3e4
|
|
2097
2124
|
}), _ = Ae(() => {
|
|
2098
2125
|
if (!g) return null;
|
|
2099
|
-
const
|
|
2126
|
+
const s = /* @__PURE__ */ new Map();
|
|
2100
2127
|
for (const [u, b] of Object.entries(g))
|
|
2101
|
-
b.skipped &&
|
|
2102
|
-
return
|
|
2128
|
+
b.skipped && s.set(u, b.skip_reasons ?? []);
|
|
2129
|
+
return s;
|
|
2103
2130
|
}, [g]), L = $e({
|
|
2104
2131
|
mutationFn: ({
|
|
2105
|
-
transition_id:
|
|
2132
|
+
transition_id: s,
|
|
2106
2133
|
comment: u,
|
|
2107
2134
|
reviewed: b
|
|
2108
2135
|
}) => l.request(
|
|
2109
2136
|
Ne(`/pipelines/instance/${t}/${e}/transition`, {
|
|
2110
|
-
transition_id:
|
|
2137
|
+
transition_id: s,
|
|
2111
2138
|
comment: u,
|
|
2112
2139
|
...b ? { reviewed: !0 } : {}
|
|
2113
2140
|
})
|
|
2114
2141
|
),
|
|
2115
|
-
onMutate: (
|
|
2142
|
+
onMutate: (s) => {
|
|
2116
2143
|
var u;
|
|
2117
2144
|
return {
|
|
2118
|
-
slow:
|
|
2145
|
+
slow: Ht(
|
|
2119
2146
|
(u = [...(y == null ? void 0 : y.available_transitions) ?? [], ...(y == null ? void 0 : y.all_transitions) ?? []].find(
|
|
2120
|
-
(b) => b.id ===
|
|
2147
|
+
(b) => b.id === s.transition_id
|
|
2121
2148
|
)) == null ? void 0 : u.label
|
|
2122
2149
|
)
|
|
2123
2150
|
};
|
|
2124
2151
|
},
|
|
2125
|
-
onSuccess: (
|
|
2126
|
-
o.invalidateQueries({ queryKey: c }), t === "nivaro_addendums" && o.invalidateQueries({ queryKey: ["addendums"] }), Be(o, t, String(e)), Re(o, t, String(e)),
|
|
2152
|
+
onSuccess: (s, u, b) => {
|
|
2153
|
+
o.invalidateQueries({ queryKey: c }), t === "nivaro_addendums" && o.invalidateQueries({ queryKey: ["addendums"] }), Be(o, t, String(e)), Re(o, t, String(e)), Gt(o, t, String(e)), B(null), h(""), P(null), w(null), J.success(Wt(y, u.transition_id, s), b == null ? void 0 : b.slow.done());
|
|
2127
2154
|
},
|
|
2128
|
-
onError: (
|
|
2129
|
-
if (b == null || b.slow.fail(),
|
|
2155
|
+
onError: (s, u, b) => {
|
|
2156
|
+
if (b == null || b.slow.fail(), At(s)) {
|
|
2130
2157
|
o.invalidateQueries({ queryKey: c });
|
|
2131
2158
|
return;
|
|
2132
2159
|
}
|
|
2133
|
-
const F =
|
|
2160
|
+
const F = Ut(s);
|
|
2134
2161
|
if (F) {
|
|
2135
2162
|
w((v) => ({
|
|
2136
2163
|
payload: F,
|
|
@@ -2140,15 +2167,15 @@ function Qn({
|
|
|
2140
2167
|
}));
|
|
2141
2168
|
return;
|
|
2142
2169
|
}
|
|
2143
|
-
const $ =
|
|
2144
|
-
B(
|
|
2170
|
+
const $ = s == null ? void 0 : s.response;
|
|
2171
|
+
B(Bt(s, u)), J.error(qe(s, "Failed to execute transition"), {
|
|
2145
2172
|
duration: 12e3,
|
|
2146
2173
|
// What to do next + Copy details (lib/error-toast.ts); "Why?" below wins the action slot.
|
|
2147
|
-
|
|
2174
|
+
...Tt(s, { action: "Transition" }),
|
|
2148
2175
|
// #1867: a refusal carries "Why?" — the role, owner or access rule
|
|
2149
2176
|
// that stopped it, and who can change it.
|
|
2150
|
-
...
|
|
2151
|
-
action:
|
|
2177
|
+
...Dt(s) ? {
|
|
2178
|
+
action: Mt(l, {
|
|
2152
2179
|
collection: t,
|
|
2153
2180
|
itemId: String(e),
|
|
2154
2181
|
action: "transition",
|
|
@@ -2161,7 +2188,7 @@ function Qn({
|
|
|
2161
2188
|
H.current = k;
|
|
2162
2189
|
const ne = te((y == null ? void 0 : y.available_transitions) ?? []);
|
|
2163
2190
|
if (ne.current = (y == null ? void 0 : y.available_transitions) ?? [], ue(() => {
|
|
2164
|
-
const
|
|
2191
|
+
const s = (u) => {
|
|
2165
2192
|
const b = u.detail;
|
|
2166
2193
|
if (!b || b.claimed || b.collection !== t || String(b.item) !== String(e)) return;
|
|
2167
2194
|
b.claimed = !0;
|
|
@@ -2172,33 +2199,33 @@ function Qn({
|
|
|
2172
2199
|
}
|
|
2173
2200
|
H.current($.id);
|
|
2174
2201
|
};
|
|
2175
|
-
return window.addEventListener(Ue,
|
|
2202
|
+
return window.addEventListener(Ue, s), () => window.removeEventListener(Ue, s);
|
|
2176
2203
|
}, [t, e]), !(y != null && y.binding) || !(y != null && y.instance)) return null;
|
|
2177
|
-
const G =
|
|
2204
|
+
const G = zt(
|
|
2178
2205
|
(y.available_transitions ?? []).filter(
|
|
2179
|
-
(
|
|
2206
|
+
(s) => !y.instance.completed_at || s.from_state && String(s.from_state).toUpperCase() === String(y.instance.current_state).toUpperCase()
|
|
2180
2207
|
),
|
|
2181
2208
|
y.states ?? [],
|
|
2182
2209
|
y.instance.current_state,
|
|
2183
2210
|
y.instance.completed_at ? null : _
|
|
2184
2211
|
);
|
|
2185
2212
|
if (G.length === 0) return null;
|
|
2186
|
-
const R = new Map((y.states ?? []).map((
|
|
2187
|
-
for (const
|
|
2188
|
-
const u = Z.get(
|
|
2189
|
-
u.push(
|
|
2213
|
+
const R = new Map((y.states ?? []).map((s) => [s.id, s])), X = y.instance.current_state_obj ?? null, z = N ? G.find((s) => s.id === N) : null, p = z ? R.get(z.to_state) : null, me = Xt(z, X, y.states ?? [], g), ie = (me == null ? void 0 : me.state) ?? p, Z = /* @__PURE__ */ new Map();
|
|
2214
|
+
for (const s of G) {
|
|
2215
|
+
const u = Z.get(s.label) ?? [];
|
|
2216
|
+
u.push(s), Z.set(s.label, u);
|
|
2190
2217
|
}
|
|
2191
|
-
const ge = (
|
|
2218
|
+
const ge = (s) => [...s].sort(
|
|
2192
2219
|
(u, b) => {
|
|
2193
2220
|
var F, $;
|
|
2194
2221
|
return (((F = R.get(u.to_state)) == null ? void 0 : F.sort) ?? 999) - ((($ = R.get(b.to_state)) == null ? void 0 : $.sort) ?? 999);
|
|
2195
2222
|
}
|
|
2196
2223
|
), xe = (() => {
|
|
2197
2224
|
var b, F, $;
|
|
2198
|
-
const
|
|
2199
|
-
if (!
|
|
2225
|
+
const s = (b = K.current) == null ? void 0 : b.getBoundingClientRect();
|
|
2226
|
+
if (!s) return 600;
|
|
2200
2227
|
const u = ($ = (F = K.current) == null ? void 0 : F.closest('[role="dialog"]')) == null ? void 0 : $.getBoundingClientRect();
|
|
2201
|
-
return Math.max(260, Math.min(600,
|
|
2228
|
+
return Math.max(260, Math.min(600, s.right - ((u == null ? void 0 : u.left) ?? 0) - 12));
|
|
2202
2229
|
})();
|
|
2203
2230
|
return /* @__PURE__ */ i("div", { ref: K, className: "relative", children: [
|
|
2204
2231
|
D ? /* @__PURE__ */ i(We, { children: [
|
|
@@ -2218,7 +2245,7 @@ function Qn({
|
|
|
2218
2245
|
}
|
|
2219
2246
|
) }),
|
|
2220
2247
|
/* @__PURE__ */ n(Ge, { align: "end", className: "min-w-[200px]", children: Array.from(Z.entries()).map(
|
|
2221
|
-
([
|
|
2248
|
+
([s, u], b, F) => u.length === 1 ? /* @__PURE__ */ i(xt, { children: [
|
|
2222
2249
|
b > 0 && F[b - 1][1].length > 1 && /* @__PURE__ */ n(wt, {}),
|
|
2223
2250
|
/* @__PURE__ */ i(Me, { onSelect: () => k(u[0].id), children: [
|
|
2224
2251
|
u[0].color && /* @__PURE__ */ n(
|
|
@@ -2228,11 +2255,11 @@ function Qn({
|
|
|
2228
2255
|
style: { backgroundColor: u[0].color }
|
|
2229
2256
|
}
|
|
2230
2257
|
),
|
|
2231
|
-
|
|
2258
|
+
s
|
|
2232
2259
|
] })
|
|
2233
|
-
] },
|
|
2260
|
+
] }, s) : /* @__PURE__ */ i(xt, { children: [
|
|
2234
2261
|
b > 0 && /* @__PURE__ */ n(wt, {}),
|
|
2235
|
-
/* @__PURE__ */ n(
|
|
2262
|
+
/* @__PURE__ */ n(vn, { className: "text-[11px] text-muted-foreground", children: s }),
|
|
2236
2263
|
ge(u).map(($) => {
|
|
2237
2264
|
var v;
|
|
2238
2265
|
return /* @__PURE__ */ i(Me, { onSelect: () => k($.id), children: [
|
|
@@ -2246,13 +2273,13 @@ function Qn({
|
|
|
2246
2273
|
((v = R.get($.to_state)) == null ? void 0 : v.label) ?? $.to_state
|
|
2247
2274
|
] }, $.id);
|
|
2248
2275
|
})
|
|
2249
|
-
] },
|
|
2276
|
+
] }, s)
|
|
2250
2277
|
) })
|
|
2251
2278
|
] }) : /* @__PURE__ */ n(
|
|
2252
2279
|
"div",
|
|
2253
2280
|
{
|
|
2254
2281
|
className: r ? "flex flex-wrap justify-end gap-2" : "flex shrink-0 items-center justify-end gap-2",
|
|
2255
|
-
children: Array.from(Z.entries()).map(([
|
|
2282
|
+
children: Array.from(Z.entries()).map(([s, u]) => {
|
|
2256
2283
|
var v, ce;
|
|
2257
2284
|
const b = ((v = u[0]) == null ? void 0 : v.color) ?? null, F = u.some((O) => O.id === N), $ = (O) => b ? O ? { backgroundColor: b, borderColor: b } : { borderColor: b, color: b } : void 0;
|
|
2258
2285
|
if (u.length === 1) {
|
|
@@ -2272,24 +2299,24 @@ function Qn({
|
|
|
2272
2299
|
},
|
|
2273
2300
|
children: [
|
|
2274
2301
|
re && /* @__PURE__ */ n(oe, { className: "h-3 w-3 animate-spin" }),
|
|
2275
|
-
|
|
2302
|
+
s
|
|
2276
2303
|
]
|
|
2277
2304
|
},
|
|
2278
|
-
|
|
2305
|
+
s
|
|
2279
2306
|
);
|
|
2280
2307
|
return O.pushes && O.pushes > 0 ? /* @__PURE__ */ i("span", { className: "relative inline-flex", children: [
|
|
2281
2308
|
we,
|
|
2282
2309
|
/* @__PURE__ */ n(
|
|
2283
|
-
|
|
2310
|
+
gn,
|
|
2284
2311
|
{
|
|
2285
2312
|
collection: t,
|
|
2286
2313
|
itemId: e,
|
|
2287
2314
|
transitionId: O.id,
|
|
2288
|
-
label:
|
|
2315
|
+
label: s,
|
|
2289
2316
|
compact: !0
|
|
2290
2317
|
}
|
|
2291
2318
|
)
|
|
2292
|
-
] },
|
|
2319
|
+
] }, s) : we;
|
|
2293
2320
|
}
|
|
2294
2321
|
return /* @__PURE__ */ i(We, { children: [
|
|
2295
2322
|
/* @__PURE__ */ n(He, { asChild: !0, children: /* @__PURE__ */ i(
|
|
@@ -2301,7 +2328,7 @@ function Qn({
|
|
|
2301
2328
|
style: $(F),
|
|
2302
2329
|
disabled: L.isPending || C,
|
|
2303
2330
|
children: [
|
|
2304
|
-
|
|
2331
|
+
s,
|
|
2305
2332
|
/* @__PURE__ */ n(ve, { className: "h-3 w-3" })
|
|
2306
2333
|
]
|
|
2307
2334
|
}
|
|
@@ -2319,7 +2346,7 @@ function Qn({
|
|
|
2319
2346
|
((re = R.get(O.to_state)) == null ? void 0 : re.label) ?? O.to_state
|
|
2320
2347
|
] }, O.id);
|
|
2321
2348
|
}) })
|
|
2322
|
-
] },
|
|
2349
|
+
] }, s);
|
|
2323
2350
|
})
|
|
2324
2351
|
}
|
|
2325
2352
|
),
|
|
@@ -2338,15 +2365,15 @@ function Qn({
|
|
|
2338
2365
|
/* @__PURE__ */ n(fe, { label: ie.label, color: ie.color, small: !0 })
|
|
2339
2366
|
] })
|
|
2340
2367
|
] }),
|
|
2341
|
-
/* @__PURE__ */ n(
|
|
2342
|
-
/* @__PURE__ */ n(
|
|
2343
|
-
/* @__PURE__ */ n(
|
|
2368
|
+
/* @__PURE__ */ n(Yt, { landing: me }),
|
|
2369
|
+
/* @__PURE__ */ n(Jt, { collection: t, item: e }),
|
|
2370
|
+
/* @__PURE__ */ n(Kt, { lines: j }),
|
|
2344
2371
|
/* @__PURE__ */ n(
|
|
2345
2372
|
"input",
|
|
2346
2373
|
{
|
|
2347
2374
|
type: "text",
|
|
2348
2375
|
value: f,
|
|
2349
|
-
onChange: (
|
|
2376
|
+
onChange: (s) => h(s.target.value),
|
|
2350
2377
|
placeholder: String((z == null ? void 0 : z.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
|
|
2351
2378
|
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"
|
|
2352
2379
|
}
|
|
@@ -2385,7 +2412,7 @@ function Qn({
|
|
|
2385
2412
|
}
|
|
2386
2413
|
),
|
|
2387
2414
|
S && !N && /* @__PURE__ */ n(
|
|
2388
|
-
|
|
2415
|
+
Vt,
|
|
2389
2416
|
{
|
|
2390
2417
|
collection: t,
|
|
2391
2418
|
item: String(e),
|
|
@@ -2396,8 +2423,8 @@ function Qn({
|
|
|
2396
2423
|
onFixed: () => m({ transition_id: S.transitionId, comment: S.comment })
|
|
2397
2424
|
}
|
|
2398
2425
|
),
|
|
2399
|
-
x && /* @__PURE__ */ n(
|
|
2400
|
-
|
|
2426
|
+
x && /* @__PURE__ */ n(Ct, { fallback: null, children: /* @__PURE__ */ n(
|
|
2427
|
+
Ft,
|
|
2401
2428
|
{
|
|
2402
2429
|
payload: x.payload,
|
|
2403
2430
|
transitionId: x.transitionId,
|
|
@@ -2421,18 +2448,18 @@ function Qn({
|
|
|
2421
2448
|
}
|
|
2422
2449
|
export {
|
|
2423
2450
|
Se as FRESH_BUTTON_MS,
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2451
|
+
Mn as FreshButtonGuard,
|
|
2452
|
+
kr as PipelinePanel,
|
|
2453
|
+
_r as PipelineTransitionButtons,
|
|
2454
|
+
Pn as REFUSAL_FIX_ACTIONS,
|
|
2455
|
+
Un as SLOW_MOVE_MS,
|
|
2456
|
+
Fn as briefWarnings,
|
|
2457
|
+
At as isDuplicateTransition,
|
|
2458
|
+
Bn as latestSendBack,
|
|
2459
|
+
Rn as refusalCode,
|
|
2460
|
+
Bt as refusalFixFor,
|
|
2461
|
+
Ht as slowMoveToast,
|
|
2462
|
+
Ut as transitionRequirementsFromError,
|
|
2463
|
+
Wt as transitionToastText,
|
|
2464
|
+
zt as withoutSkippedSendBacks
|
|
2438
2465
|
};
|