@nivaro/react 0.3.64 → 0.3.66
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 +62 -8
- package/dist/shared/components/CollectionBrowserView.js +3127 -3204
- package/dist/shared/components/ConformanceView.js +235 -221
- package/dist/shared/components/DataTable.js +478 -459
- package/dist/shared/components/ItemEditForm.js +4842 -4500
- package/dist/shared/components/MyWorkView.js +124 -113
- package/dist/shared/components/PageRenderer.js +146 -138
- package/dist/shared/components/ProfileView.js +483 -472
- package/dist/shared/components/RecordDrilldownSheet.js +73 -65
- package/dist/shared/components/ReportView.js +1100 -1094
- package/dist/shared/components/bulk/BulkActionButtons.js +72 -72
- package/dist/shared/components/bulk/BulkCompareButton.js +62 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +114 -103
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +73 -0
- package/dist/shared/components/bulk/MessageStakeholders.js +235 -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 +1535 -1440
- 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/GroupSection.js +555 -538
- package/dist/shared/components/item-edit/InlineTableField.js +2903 -2816
- package/dist/shared/components/item-edit/M2MCombobox.js +407 -338
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +367 -116
- 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 +398 -364
- package/dist/shared/components/item-edit/SummaryPanel.js +146 -144
- package/dist/shared/components/item-edit/UserChip.js +264 -229
- package/dist/shared/components/item-edit/cascade-clear-notice.js +56 -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/header-path-preview.js +52 -0
- package/dist/shared/components/item-edit/line-merge.js +84 -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 +27 -16
- package/dist/shared/components/item-edit/rail-width.js +8 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +126 -124
- 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 +1522 -1347
- 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/quick-filter-cascade.js +29 -19
- package/dist/shared/lib/sort-cycle.js +6 -0
- package/dist/shared/lib/summary-mode.js +59 -41
- package/package.json +1 -1
|
@@ -1,55 +1,56 @@
|
|
|
1
1
|
import { jsxs as _, jsx as v } from "react/jsx-runtime";
|
|
2
2
|
import { QueryClientContext as je } from "@tanstack/react-query";
|
|
3
|
-
import { Lock as
|
|
3
|
+
import { Lock as ce, LockOpen as ye } from "lucide-react";
|
|
4
4
|
import { useState as S, useEffect as x, useRef as C, useCallback as E, useContext as Be } from "react";
|
|
5
|
-
import { toast as
|
|
5
|
+
import { toast as f } from "sonner";
|
|
6
6
|
import { useNivaroClient as Qe, useItemEditAuth as Ue } from "../../context.js";
|
|
7
|
-
import { post as
|
|
7
|
+
import { post as M, get as Ve, del as J } from "../../lib/commands.js";
|
|
8
8
|
import { idleState as We } from "../../lib/idle.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
import { noteNamedMovedNotice as He, movedNoticeText as Je, movedNoticeId as Ge } from "../../lib/moved-notice.js";
|
|
10
|
+
import { useOptionalRealtime as ge, updateTouches as Xe } from "../../lib/realtime.js";
|
|
11
|
+
import { announceRecordTabs as ee, useRecordTabsSignal as Ze } from "../../lib/record-tabs.js";
|
|
12
|
+
import { noteTakeOverHold as ue } from "../item-edit/FieldAffordances.js";
|
|
13
|
+
import { Button as D } from "../ui/button.js";
|
|
13
14
|
import { Popover as we, PopoverTrigger as xe, PopoverContent as _e } from "../ui/popover.js";
|
|
14
|
-
const
|
|
15
|
+
const te = 1e4, pe = 1500, et = 2e3, tt = 5 * 6e4, rt = 3e4, nt = 6e4, at = 15e3, Le = 1500, st = 1e4;
|
|
15
16
|
function Ee(e, t) {
|
|
16
17
|
return e ? `${t ?? "Someone else"} took over editing — your changes are still here, but can’t be saved until they release it` : "Someone else started editing while you were away — your changes are still here, but can’t be saved until they release it";
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function ot() {
|
|
19
20
|
const [e, t] = S(!0);
|
|
20
21
|
return x(() => {
|
|
21
22
|
if (typeof window > "u" || typeof document > "u") return;
|
|
22
|
-
let s = null,
|
|
23
|
-
const q = () => typeof document.hasFocus == "function" ? document.hasFocus() : !0,
|
|
24
|
-
|
|
23
|
+
let s = null, N = null, h = 0;
|
|
24
|
+
const q = () => typeof document.hasFocus == "function" ? document.hasFocus() : !0, w = () => {
|
|
25
|
+
N && clearInterval(N), N = null;
|
|
25
26
|
}, $ = (y) => y instanceof HTMLInputElement && y.type === "file", p = (y) => {
|
|
26
|
-
$(y.target) && (
|
|
27
|
+
$(y.target) && (h = Date.now() + tt);
|
|
27
28
|
}, o = (y) => {
|
|
28
|
-
!$(y.target) || !
|
|
29
|
+
!$(y.target) || !h || (h = 0, q() || T());
|
|
29
30
|
}, T = () => {
|
|
30
31
|
s && clearTimeout(s);
|
|
31
|
-
const y =
|
|
32
|
+
const y = h - Date.now();
|
|
32
33
|
s = setTimeout(
|
|
33
34
|
() => {
|
|
34
35
|
if (s = null, !q()) {
|
|
35
|
-
|
|
36
|
+
w(), t(!1);
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
-
q() || (
|
|
40
|
-
},
|
|
39
|
+
w(), N = setInterval(() => {
|
|
40
|
+
q() || (w(), t(!1));
|
|
41
|
+
}, et);
|
|
41
42
|
},
|
|
42
43
|
y > 0 ? Math.max(y, pe) : pe
|
|
43
44
|
);
|
|
44
45
|
}, c = () => {
|
|
45
|
-
s && clearTimeout(s), s = null,
|
|
46
|
+
s && clearTimeout(s), s = null, h = 0, w(), t(!0);
|
|
46
47
|
};
|
|
47
48
|
return window.addEventListener("blur", T), window.addEventListener("focus", c), document.addEventListener("click", p, !0), document.addEventListener("change", o, !0), document.addEventListener("cancel", o, !0), () => {
|
|
48
|
-
window.removeEventListener("blur", T), window.removeEventListener("focus", c), document.removeEventListener("click", p, !0), document.removeEventListener("change", o, !0), document.removeEventListener("cancel", o, !0), s && clearTimeout(s),
|
|
49
|
+
window.removeEventListener("blur", T), window.removeEventListener("focus", c), document.removeEventListener("click", p, !0), document.removeEventListener("change", o, !0), document.removeEventListener("cancel", o, !0), s && clearTimeout(s), w();
|
|
49
50
|
};
|
|
50
51
|
}, []), e;
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function it() {
|
|
53
54
|
const [e, t] = S(
|
|
54
55
|
() => typeof document > "u" || document.visibilityState !== "hidden"
|
|
55
56
|
);
|
|
@@ -58,274 +59,274 @@ function at() {
|
|
|
58
59
|
return document.addEventListener("visibilitychange", s), () => document.removeEventListener("visibilitychange", s);
|
|
59
60
|
}, []), e;
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
const { lazy:
|
|
63
|
-
$.current =
|
|
64
|
-
const p = E(() =>
|
|
65
|
-
W.current = null,
|
|
66
|
-
}, [
|
|
67
|
-
|
|
68
|
-
}, []),
|
|
62
|
+
function _t(e, t, s, N = {}) {
|
|
63
|
+
const { lazy: h = !1, active: q = !0, dirty: w } = N, $ = C(w);
|
|
64
|
+
$.current = w;
|
|
65
|
+
const p = E(() => h && $.current === !1, [h]), o = Qe(), { isAdmin: T, userId: c } = Ue(), y = Be(je), [Y, R] = S(null), [K, L] = S(!1), [B, le] = S(!1), [$e, Se] = S([]), [Ne, Q] = S(null), [Re, de] = S(!1), [Ce, fe] = S(""), [Te, re] = S(!1), [qe, me] = S(!1), G = C(null), i = C(!1), I = C(!1), ne = C(!1), ae = C(0), F = C(!1), U = C(null), V = C(null), W = C(null), X = C(!1), P = `${e ?? ""}:${t ?? ""}`, j = E(() => {
|
|
66
|
+
W.current = null, X.current = !1, ue(P, !1);
|
|
67
|
+
}, [P]), m = E(() => {
|
|
68
|
+
G.current && (clearInterval(G.current), G.current = null);
|
|
69
|
+
}, []), se = E(
|
|
69
70
|
(a) => {
|
|
70
|
-
var
|
|
71
|
-
const n = a,
|
|
72
|
-
return
|
|
71
|
+
var l, r;
|
|
72
|
+
const n = a, k = n.status ?? ((l = n.response) == null ? void 0 : l.status), u = ((r = n.response) == null ? void 0 : r.data) ?? n.response;
|
|
73
|
+
return k !== 403 || (u == null ? void 0 : u.code) !== "EDIT_LOCKED" ? !1 : (m(), i.current = !1, L(!1), f.warning(u.error || "You can no longer edit this record — your edit lock was let go"), y == null || y.invalidateQueries({ queryKey: ["pipeline-instance-lock", e, t] }), y == null || y.invalidateQueries({ queryKey: ["pipeline-instance", e, t] }), !0);
|
|
73
74
|
},
|
|
74
|
-
[y, e, t,
|
|
75
|
-
),
|
|
75
|
+
[y, e, t, m]
|
|
76
|
+
), b = E(async () => {
|
|
76
77
|
var a, n;
|
|
77
78
|
if (!e || !t || F.current) return !1;
|
|
78
79
|
U.current = null, V.current = null;
|
|
79
80
|
try {
|
|
80
81
|
return await o.request(
|
|
81
|
-
|
|
82
|
-
), i.current = !0, L(!0),
|
|
83
|
-
const
|
|
82
|
+
M(`/item-locks/${e}/${t}/lock`, { beat_ms: te })
|
|
83
|
+
), i.current = !0, L(!0), re(!1), R(null), m(), G.current = setInterval(() => {
|
|
84
|
+
const k = Math.max(
|
|
84
85
|
0,
|
|
85
86
|
Math.floor((Date.now() - new Date(We().last_active).getTime()) / 1e3)
|
|
86
87
|
);
|
|
87
88
|
o.request(
|
|
88
|
-
|
|
89
|
-
idle_seconds:
|
|
90
|
-
beat_ms:
|
|
89
|
+
M(`/item-locks/${e}/${t}/heartbeat`, {
|
|
90
|
+
idle_seconds: k,
|
|
91
|
+
beat_ms: te
|
|
91
92
|
})
|
|
92
|
-
).then((
|
|
93
|
-
if (!(
|
|
94
|
-
|
|
93
|
+
).then((u) => {
|
|
94
|
+
if (!(u != null && u.idle_released)) return;
|
|
95
|
+
m(), i.current = !1, L(!1), f.info(
|
|
95
96
|
"Your edit lock was released after inactivity — it re-locks when you resume."
|
|
96
97
|
);
|
|
97
|
-
const
|
|
98
|
-
window.removeEventListener("pointerdown",
|
|
98
|
+
const l = () => {
|
|
99
|
+
window.removeEventListener("pointerdown", l, !0), window.removeEventListener("keydown", l, !0), !p() && b();
|
|
99
100
|
};
|
|
100
|
-
window.addEventListener("pointerdown",
|
|
101
|
-
}).catch((
|
|
102
|
-
var
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
const ve =
|
|
109
|
-
V.current = ve ?? "Someone else",
|
|
101
|
+
window.addEventListener("pointerdown", l, !0), window.addEventListener("keydown", l, !0);
|
|
102
|
+
}).catch((u) => {
|
|
103
|
+
var H, be;
|
|
104
|
+
const l = u, r = l.status ?? ((H = l.response) == null ? void 0 : H.status);
|
|
105
|
+
if (se(u) || r !== 404 && r !== 409) return;
|
|
106
|
+
const d = ((be = l.response) == null ? void 0 : be.data) ?? l.response;
|
|
107
|
+
if (r === 404 && !(d != null && d.locked_by) && (d == null ? void 0 : d.taken_over) === !0) {
|
|
108
|
+
m(), i.current = !1, L(!1);
|
|
109
|
+
const ve = d.taken_over_by_name ?? null;
|
|
110
|
+
V.current = ve ?? "Someone else", f.warning(
|
|
110
111
|
`${ve ?? "Someone else"} took over editing — your changes are still here; they save once you edit again`
|
|
111
112
|
);
|
|
112
113
|
return;
|
|
113
114
|
}
|
|
114
|
-
if (
|
|
115
|
+
if (r === 404 && !(d != null && d.locked_by)) {
|
|
115
116
|
if (p()) {
|
|
116
|
-
|
|
117
|
+
m(), i.current = !1, L(!1);
|
|
117
118
|
return;
|
|
118
119
|
}
|
|
119
|
-
|
|
120
|
+
b();
|
|
120
121
|
return;
|
|
121
122
|
}
|
|
122
|
-
|
|
123
|
-
locked_by:
|
|
124
|
-
locked_by_name:
|
|
125
|
-
}),
|
|
126
|
-
|
|
123
|
+
m(), i.current = !1, L(!1), d != null && d.locked_by && (R({
|
|
124
|
+
locked_by: d.locked_by,
|
|
125
|
+
locked_by_name: d.locked_by_name ?? null
|
|
126
|
+
}), f.warning(
|
|
127
|
+
d.taken_over === !1 ? Ee(!1) : `${d.locked_by_name ?? "Another user"} took over editing — your changes are no longer being saved`
|
|
127
128
|
));
|
|
128
129
|
});
|
|
129
|
-
},
|
|
130
|
-
} catch (
|
|
131
|
-
const
|
|
132
|
-
return U.current =
|
|
133
|
-
locked_by:
|
|
134
|
-
locked_by_name:
|
|
135
|
-
...typeof
|
|
130
|
+
}, te), !0;
|
|
131
|
+
} catch (k) {
|
|
132
|
+
const u = k, l = u.status ?? ((a = u.response) == null ? void 0 : a.status), r = ((n = u.response) == null ? void 0 : n.data) ?? u.response;
|
|
133
|
+
return U.current = l ?? null, V.current = (r == null ? void 0 : r.taken_over) === !0 ? r.locked_by_name ?? "Someone else" : null, se(k) ? !1 : l === 404 ? (F.current = !0, m(), i.current = !1, L(!1), !1) : (l === 409 && (r != null && r.locked_by) && (i.current = !1, L(!1), R({
|
|
134
|
+
locked_by: r.locked_by,
|
|
135
|
+
locked_by_name: r.locked_by_name ?? null,
|
|
136
|
+
...typeof r.may_take_over == "boolean" ? { may_take_over: r.may_take_over } : {}
|
|
136
137
|
})), !1);
|
|
137
138
|
}
|
|
138
|
-
}, [o, e, t,
|
|
139
|
+
}, [o, e, t, m, se, p]), g = E(async () => {
|
|
139
140
|
if (!(!e || !t))
|
|
140
141
|
try {
|
|
141
142
|
const a = await o.request(Ve(`/item-locks/${e}/${t}/lock`)), n = a == null ? void 0 : a.data;
|
|
142
143
|
Se(Array.isArray(n == null ? void 0 : n.queue) ? n.queue : []), Q(typeof (n == null ? void 0 : n.my_position) == "number" ? n.my_position : null);
|
|
143
|
-
const
|
|
144
|
+
const k = (n == null ? void 0 : n.is_mine) === !0 || !!c && String((n == null ? void 0 : n.locked_by) ?? "").toLowerCase() === c.toLowerCase(), u = typeof (n == null ? void 0 : n.may_take_over) == "boolean" ? { may_take_over: n.may_take_over } : {};
|
|
144
145
|
if (i.current) return;
|
|
145
|
-
if (!(n != null && n.locked_by) ||
|
|
146
|
-
|
|
146
|
+
if (!(n != null && n.locked_by) || k) {
|
|
147
|
+
R(null);
|
|
147
148
|
return;
|
|
148
149
|
}
|
|
149
|
-
|
|
150
|
-
(
|
|
151
|
-
...
|
|
152
|
-
note: n.note ??
|
|
153
|
-
idle_minutes: n.locked_by_idle_minutes ??
|
|
154
|
-
...
|
|
150
|
+
R(
|
|
151
|
+
(l) => l && l.locked_by === String(n.locked_by) ? {
|
|
152
|
+
...l,
|
|
153
|
+
note: n.note ?? l.note ?? null,
|
|
154
|
+
idle_minutes: n.locked_by_idle_minutes ?? l.idle_minutes ?? null,
|
|
155
|
+
...u
|
|
155
156
|
} : {
|
|
156
157
|
locked_by: String(n.locked_by),
|
|
157
158
|
locked_by_name: n.locked_by_name ?? null,
|
|
158
159
|
note: n.note ?? null,
|
|
159
160
|
idle_minutes: n.locked_by_idle_minutes ?? null,
|
|
160
|
-
...
|
|
161
|
+
...u
|
|
161
162
|
}
|
|
162
|
-
),
|
|
163
|
+
), re(!1);
|
|
163
164
|
} catch (a) {
|
|
164
165
|
(a == null ? void 0 : a.status) === 404 && (F.current = !0);
|
|
165
166
|
}
|
|
166
|
-
}, [o, e, t, c]),
|
|
167
|
+
}, [o, e, t, c]), A = (Y == null ? void 0 : Y.locked_by) ?? null;
|
|
167
168
|
x(() => {
|
|
168
|
-
|
|
169
|
-
}, [
|
|
170
|
-
if (!
|
|
171
|
-
const a = setInterval(() => void
|
|
169
|
+
A && g();
|
|
170
|
+
}, [A, g]), x(() => {
|
|
171
|
+
if (!A) return;
|
|
172
|
+
const a = setInterval(() => void g(), rt);
|
|
172
173
|
return () => clearInterval(a);
|
|
173
|
-
}, [
|
|
174
|
+
}, [A, g]), x(() => {
|
|
174
175
|
if (!(!s || !e || !t))
|
|
175
|
-
return
|
|
176
|
-
|
|
176
|
+
return I.current = !1, F.current = !1, h ? g() : b(), () => {
|
|
177
|
+
m(), I.current = !1, i.current && (i.current = !1, o.request(J(`/item-locks/${e}/${t}/lock`)).then(() => ee(c, "lock-released", e, t)).catch(() => {
|
|
177
178
|
}));
|
|
178
179
|
};
|
|
179
|
-
}, [s, e, t,
|
|
180
|
-
const
|
|
181
|
-
if (!(!s || i.current ||
|
|
182
|
-
|
|
180
|
+
}, [s, e, t, b, o, m, c, h, g]);
|
|
181
|
+
const Ie = E(async () => {
|
|
182
|
+
if (!(!s || i.current || ne.current) && !(Date.now() < ae.current)) {
|
|
183
|
+
ne.current = !0;
|
|
183
184
|
try {
|
|
184
|
-
const a = await
|
|
185
|
-
!a && U.current === 409 &&
|
|
185
|
+
const a = await b();
|
|
186
|
+
!a && U.current === 409 && f.warning("Someone else is editing this record — your change can’t be saved yet"), !a && U.current !== 409 && !F.current && (ae.current = Date.now() + at);
|
|
186
187
|
} finally {
|
|
187
|
-
|
|
188
|
+
ne.current = !1;
|
|
188
189
|
}
|
|
189
190
|
}
|
|
190
|
-
}, [s,
|
|
191
|
+
}, [s, b]);
|
|
191
192
|
x(() => {
|
|
192
193
|
const a = () => {
|
|
193
|
-
|
|
194
|
+
ae.current = 0;
|
|
194
195
|
};
|
|
195
196
|
return window.addEventListener("online", a), () => window.removeEventListener("online", a);
|
|
196
197
|
}, []);
|
|
197
|
-
const
|
|
198
|
+
const Z = E(() => {
|
|
198
199
|
var a;
|
|
199
200
|
if (!(!e || !t))
|
|
200
201
|
try {
|
|
201
|
-
const n = (a = o.getToken) == null ? void 0 : a.call(o),
|
|
202
|
+
const n = (a = o.getToken) == null ? void 0 : a.call(o), k = o.url ?? "";
|
|
202
203
|
fetch(
|
|
203
|
-
`${
|
|
204
|
+
`${k}/api/item-locks/${encodeURIComponent(e)}/${encodeURIComponent(t)}/lock/release`,
|
|
204
205
|
{
|
|
205
206
|
method: "POST",
|
|
206
207
|
keepalive: !0,
|
|
207
208
|
credentials: n ? "omit" : "include",
|
|
208
209
|
headers: n ? { Authorization: `Bearer ${n}` } : {}
|
|
209
210
|
}
|
|
210
|
-
).then(() =>
|
|
211
|
+
).then(() => ee(c, "lock-released", e, t)).catch(() => {
|
|
211
212
|
});
|
|
212
213
|
} catch {
|
|
213
214
|
}
|
|
214
|
-
}, [o, e, t, c]),
|
|
215
|
+
}, [o, e, t, c]), oe = it(), Ae = ot(), O = q && oe && Ae, ke = C(O);
|
|
215
216
|
x(() => {
|
|
216
|
-
const a =
|
|
217
|
-
|
|
218
|
-
}, [s, O, e, t,
|
|
217
|
+
const a = ke.current;
|
|
218
|
+
ke.current = O, !(!s || !e || !t || a || !O) && (i.current || !A || g());
|
|
219
|
+
}, [s, O, e, t, A, g]), x(() => {
|
|
219
220
|
if (!(!s || !e || !t)) {
|
|
220
221
|
if (O) {
|
|
221
|
-
if (
|
|
222
|
-
if (
|
|
223
|
-
|
|
224
|
-
!a && U.current === 409 &&
|
|
222
|
+
if (I.current) {
|
|
223
|
+
if (I.current = !1, p()) return;
|
|
224
|
+
b().then((a) => {
|
|
225
|
+
!a && U.current === 409 && f.warning(Ee(V.current != null, V.current));
|
|
225
226
|
});
|
|
226
227
|
}
|
|
227
228
|
return;
|
|
228
229
|
}
|
|
229
|
-
i.current && (
|
|
230
|
-
}) :
|
|
230
|
+
i.current && (m(), i.current = !1, L(!1), I.current = !0, oe ? o.request(J(`/item-locks/${e}/${t}/lock`)).then(() => ee(c, "lock-released", e, t)).catch(() => {
|
|
231
|
+
}) : Z());
|
|
231
232
|
}
|
|
232
233
|
}, [
|
|
233
234
|
s,
|
|
234
235
|
O,
|
|
235
|
-
|
|
236
|
+
oe,
|
|
236
237
|
e,
|
|
237
238
|
t,
|
|
238
|
-
|
|
239
|
+
b,
|
|
239
240
|
o,
|
|
240
|
-
|
|
241
|
+
m,
|
|
241
242
|
c,
|
|
242
|
-
|
|
243
|
+
Z,
|
|
243
244
|
p
|
|
244
245
|
]), x(() => {
|
|
245
|
-
if (!s || !
|
|
246
|
+
if (!s || !h || !e || !t || A || !O) return;
|
|
246
247
|
const a = setInterval(() => {
|
|
247
|
-
!i.current && !F.current &&
|
|
248
|
-
},
|
|
248
|
+
!i.current && !F.current && g();
|
|
249
|
+
}, nt);
|
|
249
250
|
return () => clearInterval(a);
|
|
250
|
-
}, [s,
|
|
251
|
+
}, [s, h, e, t, A, O, g]), x(() => {
|
|
251
252
|
if (!s || !e || !t) return;
|
|
252
253
|
const a = () => {
|
|
253
|
-
i.current && (
|
|
254
|
-
}, n = (
|
|
255
|
-
|
|
254
|
+
i.current && (m(), i.current = !1, I.current = !0, Z());
|
|
255
|
+
}, n = (k) => {
|
|
256
|
+
k.persisted && I.current && (I.current = !1, p() || b());
|
|
256
257
|
};
|
|
257
258
|
return window.addEventListener("pagehide", a), window.addEventListener("pageshow", n), () => {
|
|
258
259
|
window.removeEventListener("pagehide", a), window.removeEventListener("pageshow", n);
|
|
259
260
|
};
|
|
260
|
-
}, [s, e, t,
|
|
261
|
-
if (!s || !
|
|
262
|
-
const a = W.current, n = a != null && !
|
|
263
|
-
$.current !== !1 || !i.current || (
|
|
261
|
+
}, [s, e, t, m, b, Z, p]), x(() => {
|
|
262
|
+
if (!s || !h || !e || !t || w !== !1 || !i.current) return;
|
|
263
|
+
const a = W.current, n = a != null && !X.current ? Math.max(Le, a + st - Date.now()) : Le, k = setTimeout(() => {
|
|
264
|
+
$.current !== !1 || !i.current || (m(), i.current = !1, L(!1), j(), o.request(J(`/item-locks/${e}/${t}/lock`)).then(() => ee(c, "lock-released", e, t)).catch(() => {
|
|
264
265
|
}));
|
|
265
266
|
}, n);
|
|
266
|
-
return () => clearTimeout(
|
|
267
|
+
return () => clearTimeout(k);
|
|
267
268
|
}, [
|
|
268
269
|
s,
|
|
269
|
-
|
|
270
|
+
h,
|
|
270
271
|
e,
|
|
271
272
|
t,
|
|
272
|
-
|
|
273
|
-
|
|
273
|
+
w,
|
|
274
|
+
K,
|
|
274
275
|
o,
|
|
275
|
-
|
|
276
|
+
m,
|
|
276
277
|
c,
|
|
277
|
-
|
|
278
|
+
j
|
|
278
279
|
]), x(() => {
|
|
279
|
-
|
|
280
|
-
}, [
|
|
281
|
-
!
|
|
282
|
-
}, [
|
|
283
|
-
s && i.current &&
|
|
280
|
+
w === !0 && W.current != null && (X.current = !0);
|
|
281
|
+
}, [w]), x(() => {
|
|
282
|
+
!K && W.current != null && j();
|
|
283
|
+
}, [K, j]), x(() => () => ue(P, !1), [P]), Ze(c, "lock-released", e, t, () => {
|
|
284
|
+
s && i.current && b();
|
|
284
285
|
});
|
|
285
|
-
const
|
|
286
|
+
const ie = ge();
|
|
286
287
|
x(() => {
|
|
287
|
-
if (!(!s || !
|
|
288
|
-
return
|
|
288
|
+
if (!(!s || !ie || !e || !t))
|
|
289
|
+
return ie.subscribeCollections([e], (a) => {
|
|
289
290
|
var n;
|
|
290
|
-
i.current || F.current || !((n = a.changed_fields) != null && n.includes("$lock")) || !
|
|
291
|
+
i.current || F.current || !((n = a.changed_fields) != null && n.includes("$lock")) || !Xe(a, t) || g();
|
|
291
292
|
});
|
|
292
|
-
}, [s,
|
|
293
|
-
const
|
|
293
|
+
}, [s, ie, e, t, g]);
|
|
294
|
+
const z = ge(), [Oe, he] = S(!1), Me = E(async () => {
|
|
294
295
|
if (!(!e || !t)) {
|
|
295
|
-
|
|
296
|
+
he(!0);
|
|
296
297
|
try {
|
|
297
|
-
await o.request(
|
|
298
|
+
await o.request(M(`/item-locks/${e}/${t}/lock/request`, {})), f.success("Asked the current editor to release the lock");
|
|
298
299
|
} catch {
|
|
299
|
-
|
|
300
|
+
f.error("Could not send the lock request");
|
|
300
301
|
} finally {
|
|
301
|
-
|
|
302
|
+
he(!1);
|
|
302
303
|
}
|
|
303
304
|
}
|
|
304
305
|
}, [o, e, t]);
|
|
305
306
|
x(() => {
|
|
306
|
-
if (!
|
|
307
|
-
const a =
|
|
307
|
+
if (!z || !e || !t) return;
|
|
308
|
+
const a = z.on("lock:requested", (r) => {
|
|
308
309
|
if ((r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || !i.current) return;
|
|
309
|
-
const
|
|
310
|
-
|
|
310
|
+
const d = (r == null ? void 0 : r.from) ?? {};
|
|
311
|
+
f(`${d.name ?? "Someone"} is asking you to release this record`, {
|
|
311
312
|
duration: 3e4,
|
|
312
313
|
action: {
|
|
313
314
|
label: "Release",
|
|
314
315
|
onClick: () => {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
to:
|
|
316
|
+
m(), i.current = !1, L(!1), o.request(
|
|
317
|
+
M(`/item-locks/${e}/${t}/lock/respond`, {
|
|
318
|
+
to: d.id,
|
|
318
319
|
action: "release"
|
|
319
320
|
})
|
|
320
|
-
).then(() =>
|
|
321
|
+
).then(() => f.success("Lock released")).catch(() => f.error("Failed to release the lock"));
|
|
321
322
|
}
|
|
322
323
|
},
|
|
323
324
|
cancel: {
|
|
324
325
|
label: "Keep editing",
|
|
325
326
|
onClick: () => {
|
|
326
327
|
o.request(
|
|
327
|
-
|
|
328
|
-
to:
|
|
328
|
+
M(`/item-locks/${e}/${t}/lock/respond`, {
|
|
329
|
+
to: d.id,
|
|
329
330
|
action: "decline"
|
|
330
331
|
})
|
|
331
332
|
).catch(() => {
|
|
@@ -333,51 +334,56 @@ function yt(e, t, s, R = {}) {
|
|
|
333
334
|
}
|
|
334
335
|
}
|
|
335
336
|
});
|
|
336
|
-
}), n =
|
|
337
|
-
var
|
|
338
|
-
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || ((r == null ? void 0 : r.action) === "release" ? (
|
|
339
|
-
`${((
|
|
337
|
+
}), n = z.on("lock:response", (r) => {
|
|
338
|
+
var d, H;
|
|
339
|
+
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || ((r == null ? void 0 : r.action) === "release" ? (f.success(`${((d = r == null ? void 0 : r.from) == null ? void 0 : d.name) ?? "The editor"} released the lock — it's yours`), b()) : f.warning(
|
|
340
|
+
`${((H = r == null ? void 0 : r.from) == null ? void 0 : H.name) ?? "The editor"} is keeping the lock${r != null && r.note ? `: "${r.note}"` : ""}`
|
|
340
341
|
));
|
|
341
|
-
}),
|
|
342
|
-
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || (
|
|
343
|
-
}),
|
|
344
|
-
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || (i.current &&
|
|
342
|
+
}), k = z.on("lock:available", (r) => {
|
|
343
|
+
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || (f.success("Your turn — the edit lock is yours"), Q(null), b());
|
|
344
|
+
}), u = z.on("lock:queued", (r) => {
|
|
345
|
+
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || (i.current && f(`${(r == null ? void 0 : r.user_name) ?? "Someone"} is waiting to edit this record`, { duration: 8e3 }), g());
|
|
346
|
+
}), l = z.on("lock:moved", (r) => {
|
|
347
|
+
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || (He(e, t), f.warning(Je(r ?? {}), {
|
|
348
|
+
id: Ge(e, t),
|
|
349
|
+
duration: 3e4
|
|
350
|
+
}), g());
|
|
345
351
|
});
|
|
346
352
|
return () => {
|
|
347
|
-
a(), n(),
|
|
353
|
+
a(), n(), k(), u(), l();
|
|
348
354
|
};
|
|
349
|
-
}, [
|
|
350
|
-
const
|
|
355
|
+
}, [z, e, t, o, b, m, g]);
|
|
356
|
+
const De = E(async () => {
|
|
351
357
|
if (!(!e || !t)) {
|
|
352
|
-
|
|
358
|
+
de(!0);
|
|
353
359
|
try {
|
|
354
360
|
const a = await o.request(
|
|
355
|
-
|
|
361
|
+
M(`/item-locks/${e}/${t}/lock/queue`, {})
|
|
356
362
|
), n = a == null ? void 0 : a.data;
|
|
357
363
|
if (n != null && n.free) {
|
|
358
|
-
Q(null),
|
|
364
|
+
Q(null), R(null), f.success("Nobody is editing this record now — go ahead");
|
|
359
365
|
return;
|
|
360
366
|
}
|
|
361
|
-
const
|
|
362
|
-
Q(typeof
|
|
367
|
+
const k = n == null ? void 0 : n.position;
|
|
368
|
+
Q(typeof k == "number" ? k : 1), f.success("You are in line — the lock comes to you automatically when it frees up"), g();
|
|
363
369
|
} catch {
|
|
364
|
-
|
|
370
|
+
f.error("Could not join the queue");
|
|
365
371
|
} finally {
|
|
366
|
-
|
|
372
|
+
de(!1);
|
|
367
373
|
}
|
|
368
374
|
}
|
|
369
|
-
}, [o, e, t,
|
|
375
|
+
}, [o, e, t, g]), Ye = E(async () => {
|
|
370
376
|
if (!(!e || !t))
|
|
371
377
|
try {
|
|
372
|
-
await o.request(
|
|
378
|
+
await o.request(J(`/item-locks/${e}/${t}/lock/queue`)), Q(null), g();
|
|
373
379
|
} catch {
|
|
374
380
|
}
|
|
375
|
-
}, [o, e, t,
|
|
381
|
+
}, [o, e, t, g]), Fe = E(
|
|
376
382
|
async (a) => {
|
|
377
383
|
if (!(!e || !t || !i.current)) {
|
|
378
|
-
|
|
384
|
+
fe(a);
|
|
379
385
|
try {
|
|
380
|
-
await o.request(
|
|
386
|
+
await o.request(M(`/item-locks/${e}/${t}/lock/note`, { note: a }));
|
|
381
387
|
} catch {
|
|
382
388
|
}
|
|
383
389
|
}
|
|
@@ -385,66 +391,66 @@ function yt(e, t, s, R = {}) {
|
|
|
385
391
|
[o, e, t]
|
|
386
392
|
), ze = E(async () => {
|
|
387
393
|
if (!(!e || !t || !i.current)) {
|
|
388
|
-
|
|
394
|
+
me(!0), m(), i.current = !1, L(!1);
|
|
389
395
|
try {
|
|
390
|
-
await o.request(
|
|
396
|
+
await o.request(J(`/item-locks/${e}/${t}/lock`)), re(!0), fe(""), f.success("Lock released — anyone can edit this record now");
|
|
391
397
|
} catch {
|
|
392
|
-
|
|
398
|
+
f.error("Failed to release the lock"), b();
|
|
393
399
|
} finally {
|
|
394
|
-
|
|
400
|
+
me(!1);
|
|
395
401
|
}
|
|
396
402
|
}
|
|
397
|
-
}, [o, e, t,
|
|
403
|
+
}, [o, e, t, m, b]), Ke = E(async () => {
|
|
398
404
|
if (i.current) return !0;
|
|
399
|
-
const a = await
|
|
400
|
-
return a &&
|
|
401
|
-
}, [
|
|
405
|
+
const a = await b();
|
|
406
|
+
return a && f.success("You hold the edit lock again"), a;
|
|
407
|
+
}, [b]), Pe = E(async () => {
|
|
402
408
|
var a;
|
|
403
409
|
if (!(!e || !t)) {
|
|
404
410
|
le(!0);
|
|
405
411
|
try {
|
|
406
412
|
await o.request(
|
|
407
|
-
|
|
408
|
-
),
|
|
413
|
+
M(`/item-locks/${e}/${t}/lock/force`, { beat_ms: te })
|
|
414
|
+
), f.success("You now hold the edit lock"), W.current = Date.now(), X.current = !1, ue(P, !0), await b() || j();
|
|
409
415
|
} catch (n) {
|
|
410
|
-
const
|
|
411
|
-
|
|
416
|
+
const k = ((a = n == null ? void 0 : n.response) == null ? void 0 : a.error) ?? "Failed to take over the lock";
|
|
417
|
+
f.error(k), (n == null ? void 0 : n.status) === 403 && R((u) => u && { ...u, may_take_over: !1 });
|
|
412
418
|
} finally {
|
|
413
419
|
le(!1);
|
|
414
420
|
}
|
|
415
421
|
}
|
|
416
|
-
}, [o, e, t,
|
|
422
|
+
}, [o, e, t, b, P, j]);
|
|
417
423
|
return {
|
|
418
424
|
lockHolder: Y,
|
|
419
|
-
acquired:
|
|
425
|
+
acquired: K,
|
|
420
426
|
isReadOnly: !!Y,
|
|
421
427
|
takeOver: Pe,
|
|
422
428
|
takingOver: B,
|
|
423
429
|
isAdmin: T,
|
|
424
|
-
requestLock:
|
|
430
|
+
requestLock: Me,
|
|
425
431
|
requesting: Oe,
|
|
426
432
|
queue: $e,
|
|
427
|
-
myPosition:
|
|
428
|
-
joinQueue:
|
|
433
|
+
myPosition: Ne,
|
|
434
|
+
joinQueue: De,
|
|
429
435
|
leaveQueue: Ye,
|
|
430
|
-
joining:
|
|
436
|
+
joining: Re,
|
|
431
437
|
myNote: Ce,
|
|
432
438
|
saveNote: Fe,
|
|
433
439
|
release: ze,
|
|
434
440
|
releasing: qe,
|
|
435
441
|
released: Te,
|
|
436
442
|
relock: Ke,
|
|
437
|
-
claim:
|
|
443
|
+
claim: Ie
|
|
438
444
|
};
|
|
439
445
|
}
|
|
440
|
-
function
|
|
446
|
+
function pt({
|
|
441
447
|
note: e,
|
|
442
448
|
onSave: t,
|
|
443
449
|
waiting: s,
|
|
444
|
-
onRelease:
|
|
445
|
-
releasing:
|
|
450
|
+
onRelease: N,
|
|
451
|
+
releasing: h,
|
|
446
452
|
released: q,
|
|
447
|
-
onRelock:
|
|
453
|
+
onRelock: w
|
|
448
454
|
}) {
|
|
449
455
|
var T;
|
|
450
456
|
const [$, p] = S(e);
|
|
@@ -468,15 +474,15 @@ function gt({
|
|
|
468
474
|
/* @__PURE__ */ v("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "You released the edit lock" }),
|
|
469
475
|
/* @__PURE__ */ v("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: "Anyone can edit this record now. Your next edit locks it again — or lock it now." }),
|
|
470
476
|
/* @__PURE__ */ _(
|
|
471
|
-
|
|
477
|
+
D,
|
|
472
478
|
{
|
|
473
479
|
type: "button",
|
|
474
480
|
size: "sm",
|
|
475
481
|
className: "mt-2 h-7 w-full text-[12px]",
|
|
476
|
-
onClick:
|
|
482
|
+
onClick: w,
|
|
477
483
|
"data-lock-relock": !0,
|
|
478
484
|
children: [
|
|
479
|
-
/* @__PURE__ */ v(
|
|
485
|
+
/* @__PURE__ */ v(ce, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
480
486
|
" Lock again"
|
|
481
487
|
]
|
|
482
488
|
}
|
|
@@ -492,7 +498,7 @@ function gt({
|
|
|
492
498
|
"data-lock-holder": !0,
|
|
493
499
|
className: "relative inline-flex h-8 w-8 items-center justify-center text-[#0e7490] transition-colors hover:bg-accent hover:text-accent-foreground dark:text-nvr-cyan",
|
|
494
500
|
children: [
|
|
495
|
-
/* @__PURE__ */ v(
|
|
501
|
+
/* @__PURE__ */ v(ce, { className: "h-4 w-4", strokeWidth: 2 }),
|
|
496
502
|
s.length > 0 && /* @__PURE__ */ v("span", { className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-amber-500 ring-2 ring-background" })
|
|
497
503
|
]
|
|
498
504
|
}
|
|
@@ -522,33 +528,33 @@ function gt({
|
|
|
522
528
|
" ",
|
|
523
529
|
s.map((c) => c.name ?? "someone").join(", ")
|
|
524
530
|
] }),
|
|
525
|
-
|
|
526
|
-
|
|
531
|
+
N && /* @__PURE__ */ _(
|
|
532
|
+
D,
|
|
527
533
|
{
|
|
528
534
|
type: "button",
|
|
529
535
|
variant: "outline",
|
|
530
536
|
size: "sm",
|
|
531
537
|
className: "mt-2 h-7 w-full text-[12px]",
|
|
532
|
-
onClick:
|
|
533
|
-
disabled:
|
|
538
|
+
onClick: N,
|
|
539
|
+
disabled: h,
|
|
534
540
|
"data-lock-release": !0,
|
|
535
541
|
children: [
|
|
536
542
|
/* @__PURE__ */ v(ye, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
537
|
-
|
|
543
|
+
h ? "Releasing…" : s.length > 0 ? `Release lock to ${((T = s[0]) == null ? void 0 : T.name) ?? "the next person"}` : "Release lock"
|
|
538
544
|
]
|
|
539
545
|
}
|
|
540
546
|
)
|
|
541
547
|
] })
|
|
542
548
|
] });
|
|
543
549
|
}
|
|
544
|
-
function
|
|
550
|
+
function Lt({
|
|
545
551
|
lockHolder: e,
|
|
546
552
|
onTakeOver: t,
|
|
547
553
|
takingOver: s,
|
|
548
|
-
isAdmin:
|
|
549
|
-
onRequestLock:
|
|
554
|
+
isAdmin: N,
|
|
555
|
+
onRequestLock: h,
|
|
550
556
|
requesting: q,
|
|
551
|
-
queue:
|
|
557
|
+
queue: w,
|
|
552
558
|
myPosition: $,
|
|
553
559
|
onJoinQueue: p,
|
|
554
560
|
onLeaveQueue: o,
|
|
@@ -556,16 +562,16 @@ function wt({
|
|
|
556
562
|
noun: c = "this item",
|
|
557
563
|
readOnlyText: y = "fields are read-only"
|
|
558
564
|
}) {
|
|
559
|
-
const [Y,
|
|
560
|
-
if (x(() =>
|
|
561
|
-
const L = e.locked_by_name || "Another user", B = (
|
|
565
|
+
const [Y, R] = S(!1), K = (e == null ? void 0 : e.locked_by) ?? null;
|
|
566
|
+
if (x(() => R(!1), [K]), !e) return null;
|
|
567
|
+
const L = e.locked_by_name || "Another user", B = (w == null ? void 0 : w.length) ?? 0;
|
|
562
568
|
return /* @__PURE__ */ _(
|
|
563
569
|
"div",
|
|
564
570
|
{
|
|
565
571
|
className: "mb-4 flex flex-wrap items-center gap-3 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-100",
|
|
566
572
|
"data-lock-banner": !0,
|
|
567
573
|
children: [
|
|
568
|
-
/* @__PURE__ */ v(
|
|
574
|
+
/* @__PURE__ */ v(ce, { className: "h-4 w-4 shrink-0 text-amber-500" }),
|
|
569
575
|
/* @__PURE__ */ _("span", { className: "min-w-0 flex-1", children: [
|
|
570
576
|
/* @__PURE__ */ v("span", { className: "font-medium", children: L }),
|
|
571
577
|
" is editing ",
|
|
@@ -599,7 +605,7 @@ function wt({
|
|
|
599
605
|
] })
|
|
600
606
|
] }),
|
|
601
607
|
p && ($ != null ? /* @__PURE__ */ _(
|
|
602
|
-
|
|
608
|
+
D,
|
|
603
609
|
{
|
|
604
610
|
size: "sm",
|
|
605
611
|
variant: "outline",
|
|
@@ -613,7 +619,7 @@ function wt({
|
|
|
613
619
|
]
|
|
614
620
|
}
|
|
615
621
|
) : /* @__PURE__ */ v(
|
|
616
|
-
|
|
622
|
+
D,
|
|
617
623
|
{
|
|
618
624
|
size: "sm",
|
|
619
625
|
variant: "outline",
|
|
@@ -624,13 +630,13 @@ function wt({
|
|
|
624
630
|
children: T ? "Joining…" : "Ask to be next"
|
|
625
631
|
}
|
|
626
632
|
)),
|
|
627
|
-
|
|
628
|
-
|
|
633
|
+
h && /* @__PURE__ */ v(
|
|
634
|
+
D,
|
|
629
635
|
{
|
|
630
636
|
size: "sm",
|
|
631
637
|
variant: "outline",
|
|
632
638
|
className: "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15",
|
|
633
|
-
onClick:
|
|
639
|
+
onClick: h,
|
|
634
640
|
disabled: q,
|
|
635
641
|
children: q ? "Asking…" : "Ask them to wrap up"
|
|
636
642
|
}
|
|
@@ -638,7 +644,7 @@ function wt({
|
|
|
638
644
|
// Admins always; other roles only when the server says they may (the
|
|
639
645
|
// takeover-role allowlist, #256) — unknown = offered, and a 403 then
|
|
640
646
|
// hides it. A Take over that can only fail was a dead end.
|
|
641
|
-
(
|
|
647
|
+
(N || e.may_take_over !== !1) && (Y ? /* @__PURE__ */ _(
|
|
642
648
|
"span",
|
|
643
649
|
{
|
|
644
650
|
className: "flex basis-full flex-wrap items-center justify-end gap-2 text-[12px] text-amber-800 dark:text-amber-200",
|
|
@@ -649,23 +655,23 @@ function wt({
|
|
|
649
655
|
" may have unsaved changes — they can’t save them once you take over."
|
|
650
656
|
] }),
|
|
651
657
|
/* @__PURE__ */ v(
|
|
652
|
-
|
|
658
|
+
D,
|
|
653
659
|
{
|
|
654
660
|
size: "sm",
|
|
655
661
|
variant: "outline",
|
|
656
662
|
className: "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15",
|
|
657
|
-
onClick: () =>
|
|
663
|
+
onClick: () => R(!1),
|
|
658
664
|
disabled: s,
|
|
659
665
|
children: "Cancel"
|
|
660
666
|
}
|
|
661
667
|
),
|
|
662
668
|
/* @__PURE__ */ v(
|
|
663
|
-
|
|
669
|
+
D,
|
|
664
670
|
{
|
|
665
671
|
size: "sm",
|
|
666
672
|
className: "h-7 shrink-0 bg-amber-600 text-[12px] text-white hover:bg-amber-700",
|
|
667
673
|
onClick: () => {
|
|
668
|
-
|
|
674
|
+
R(!1), t();
|
|
669
675
|
},
|
|
670
676
|
disabled: s,
|
|
671
677
|
"data-lock-takeover-go": !0,
|
|
@@ -675,12 +681,12 @@ function wt({
|
|
|
675
681
|
]
|
|
676
682
|
}
|
|
677
683
|
) : /* @__PURE__ */ v(
|
|
678
|
-
|
|
684
|
+
D,
|
|
679
685
|
{
|
|
680
686
|
size: "sm",
|
|
681
687
|
variant: "outline",
|
|
682
|
-
className:
|
|
683
|
-
onClick: () =>
|
|
688
|
+
className: N ? "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15" : "h-7 shrink-0 border-amber-200 bg-white/60 text-[12px] text-amber-700/80 hover:bg-amber-100 dark:border-amber-500/30 dark:bg-transparent dark:text-amber-200/80 dark:hover:bg-amber-500/15",
|
|
689
|
+
onClick: () => R(!0),
|
|
684
690
|
disabled: s,
|
|
685
691
|
children: s ? "Taking over…" : "Take over"
|
|
686
692
|
}
|
|
@@ -690,9 +696,9 @@ function wt({
|
|
|
690
696
|
);
|
|
691
697
|
}
|
|
692
698
|
export {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
699
|
+
Lt as ItemLockBanner,
|
|
700
|
+
pt as LockHolderButton,
|
|
701
|
+
st as TAKEOVER_HOLD_MS,
|
|
696
702
|
Ee as takenAwayText,
|
|
697
|
-
|
|
703
|
+
_t as useItemLock
|
|
698
704
|
};
|