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