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