@nivaro/react 0.3.13 → 0.3.14
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/components/slots/pipeline/OwnersSection.js +79 -75
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +33 -2
- package/dist/index.js +520 -516
- package/dist/shared/components/CollectionBrowserView.js +2373 -2298
- package/dist/shared/components/DataTable.js +347 -335
- package/dist/shared/components/ItemEditForm.js +5278 -5149
- package/dist/shared/components/ListLoadError.js +33 -0
- package/dist/shared/components/PageRenderer.js +562 -529
- package/dist/shared/components/ProfileView.js +53 -51
- package/dist/shared/components/RecordReadView.js +119 -117
- package/dist/shared/components/ReportView.js +1268 -1241
- package/dist/shared/components/cbv/export-rows.js +69 -0
- package/dist/shared/components/cbv/saved-view-risk.js +35 -0
- package/dist/shared/components/cbv/unknown-fields.js +18 -0
- package/dist/shared/components/integrations/console/AlertsView.js +27 -25
- package/dist/shared/components/integrations/console/EventsView.js +244 -209
- package/dist/shared/components/item-edit/CatalogPickerField.js +946 -878
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +84 -57
- package/dist/shared/components/item-edit/FieldAffordances.js +63 -61
- package/dist/shared/components/item-edit/FieldRow.js +195 -179
- package/dist/shared/components/item-edit/FilePickerField.js +257 -254
- package/dist/shared/components/item-edit/HeaderTools.js +139 -95
- package/dist/shared/components/item-edit/InlineTableField.js +2087 -2075
- package/dist/shared/components/item-edit/RowComments.js +1 -3
- package/dist/shared/components/item-edit/SummaryPanel.js +62 -62
- package/dist/shared/components/item-edit/UserChip.js +113 -113
- package/dist/shared/components/item-edit/file-download.js +18 -0
- package/dist/shared/components/item-edit/line-qty.js +67 -32
- package/dist/shared/components/item-edit/save-refusal.js +23 -0
- package/dist/shared/components/monitoring/TrafficMiniMap.js +9 -9
- package/dist/shared/components/panels/CommentPanel.js +30 -30
- package/dist/shared/components/panels/ItemLockBanner.js +207 -185
- package/dist/shared/components/panels/PipelinePanel.js +915 -786
- package/dist/shared/components/pipeline/PipelineEditorView.js +45 -25
- package/dist/shared/components/profile/DelegationCard.js +1 -1
- package/dist/shared/components/profile/session-actions.js +24 -24
- package/dist/shared/components/queue/QueueItemSheet.js +18 -18
- package/dist/shared/components/queue/QueueWorklist.js +517 -504
- package/dist/shared/components/ui/dropdown-menu.js +8 -7
- package/dist/shared/lib/draft-store.js +60 -33
- package/dist/shared/lib/leave-guard.js +38 -0
- package/dist/shared/lib/load-error.js +38 -17
- package/dist/shared/lib/summary-mode.js +25 -25
- package/dist/shared/lib/table-pins.js +23 -0
- package/dist/shared/lib/validation-rules.js +55 -51
- package/package.json +1 -1
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
2
|
-
import { useQuery as
|
|
2
|
+
import { useQuery as P } from "@tanstack/react-query";
|
|
3
3
|
import { UserCheck as S, Mail as U, Phone as q, Building2 as D, User as $, Clock as z, MessageCircle as F, ExternalLink as K, RefreshCw as W, LogOut as H } from "lucide-react";
|
|
4
|
-
import R, { useState as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { useOptionalNivaroClient as T, useNavigation as
|
|
4
|
+
import R, { useState as O, useRef as C, useEffect as B } from "react";
|
|
5
|
+
import { createPortal as J } from "react-dom";
|
|
6
|
+
import { useOptionalNivaroClient as T, useNavigation as Q, useItemEditAuth as Z } from "../../context.js";
|
|
7
7
|
import { get as L, post as V } from "../../lib/commands.js";
|
|
8
8
|
import { userCardQuery as G } from "../../lib/user-cards.js";
|
|
9
|
-
import { cn as
|
|
9
|
+
import { cn as j } from "../../lib/utils.js";
|
|
10
10
|
import { canOpenDm as X, openDmWith as Y } from "../chat/chat-core.js";
|
|
11
11
|
import { HuddlePresenceLine as A } from "../chat/huddle/HuddleLiveBadge.js";
|
|
12
12
|
import { useHuddleLive as I } from "../chat/huddle/huddle-live.js";
|
|
13
13
|
import { MailSuppressedPill as ee } from "../profile/MailSuppressedPill.js";
|
|
14
14
|
import { useReloadTheirTabs as te, useSignOutEverywhere as ae } from "../profile/session-actions.js";
|
|
15
15
|
import { useCardPresence as ne } from "../profile/usePersonPresence.js";
|
|
16
|
-
import { UserAvatar as
|
|
16
|
+
import { UserAvatar as _ } from "../UserAvatar.js";
|
|
17
17
|
import { Popover as re, PopoverTrigger as le, PopoverContent as se } from "../ui/popover.js";
|
|
18
18
|
function E(e, r, i) {
|
|
19
|
-
const s =
|
|
19
|
+
const s = C(r);
|
|
20
20
|
s.current = r;
|
|
21
|
-
const d =
|
|
21
|
+
const d = C(i);
|
|
22
22
|
d.current = i, B(() => {
|
|
23
23
|
if (!e) return;
|
|
24
24
|
const o = (n) => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
return document.addEventListener("pointerdown", o, !0), window.addEventListener("blur",
|
|
29
|
-
document.removeEventListener("pointerdown", o, !0), window.removeEventListener("blur",
|
|
25
|
+
const f = n.target;
|
|
26
|
+
f && s.current(f) || d.current();
|
|
27
|
+
}, m = () => d.current();
|
|
28
|
+
return document.addEventListener("pointerdown", o, !0), window.addEventListener("blur", m), () => {
|
|
29
|
+
document.removeEventListener("pointerdown", o, !0), window.removeEventListener("blur", m);
|
|
30
30
|
};
|
|
31
31
|
}, [e]);
|
|
32
32
|
}
|
|
@@ -34,61 +34,61 @@ function ie({
|
|
|
34
34
|
users: e,
|
|
35
35
|
showSingleName: r = !0
|
|
36
36
|
}) {
|
|
37
|
-
const i =
|
|
37
|
+
const i = C(null), s = C(null), d = C(null), [o, m] = O(null), [n, f] = O({ x: 0, y: 0 }), g = () => {
|
|
38
38
|
d.current && clearTimeout(d.current), d.current = null;
|
|
39
|
-
},
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
const p = (
|
|
43
|
-
p &&
|
|
44
|
-
},
|
|
45
|
-
|
|
39
|
+
}, u = (a) => {
|
|
40
|
+
var h;
|
|
41
|
+
g();
|
|
42
|
+
const p = (h = i.current) == null ? void 0 : h.getBoundingClientRect();
|
|
43
|
+
p && f({ x: p.left, y: p.bottom + 6 }), m((x) => x === "pin" ? "pin" : a);
|
|
44
|
+
}, y = () => {
|
|
45
|
+
g(), d.current = setTimeout(() => m((a) => a === "pin" ? a : null), 160);
|
|
46
46
|
};
|
|
47
47
|
R.useLayoutEffect(() => {
|
|
48
|
-
var
|
|
48
|
+
var b;
|
|
49
49
|
if (!o) return;
|
|
50
50
|
const a = s.current;
|
|
51
51
|
if (!a) return;
|
|
52
52
|
const p = a.getBoundingClientRect();
|
|
53
|
-
let { x:
|
|
54
|
-
if (p.right > window.innerWidth - 8 && (
|
|
55
|
-
const
|
|
56
|
-
x = Math.max(8, ((
|
|
53
|
+
let { x: h, y: x } = n;
|
|
54
|
+
if (p.right > window.innerWidth - 8 && (h = Math.max(8, window.innerWidth - p.width - 8)), p.bottom > window.innerHeight - 8) {
|
|
55
|
+
const k = (b = i.current) == null ? void 0 : b.getBoundingClientRect();
|
|
56
|
+
x = Math.max(8, ((k == null ? void 0 : k.top) ?? x) - p.height - 6);
|
|
57
57
|
}
|
|
58
|
-
(
|
|
58
|
+
(h !== n.x || x !== n.y) && f({ x: h, y: x });
|
|
59
59
|
}, [o, n]), E(
|
|
60
60
|
!!o,
|
|
61
61
|
(a) => {
|
|
62
|
-
var p,
|
|
62
|
+
var p, h, x;
|
|
63
63
|
return (
|
|
64
64
|
// Clicks inside the user-card popover (portaled by Radix) keep the
|
|
65
65
|
// roster mounted — closing would unmount the card mid-click.
|
|
66
|
-
!!((p = a.closest) != null && p.call(a, "[data-radix-popper-content-wrapper]")) || !!((
|
|
66
|
+
!!((p = a.closest) != null && p.call(a, "[data-radix-popper-content-wrapper]")) || !!((h = s.current) != null && h.contains(a)) || !!((x = i.current) != null && x.contains(a))
|
|
67
67
|
);
|
|
68
68
|
},
|
|
69
|
-
() =>
|
|
69
|
+
() => m(null)
|
|
70
70
|
);
|
|
71
|
-
const
|
|
71
|
+
const c = (a) => a.split(" ").map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
|
|
72
72
|
if (e.length === 0)
|
|
73
73
|
return /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400", "data-roster-empty": !0, children: "—" });
|
|
74
|
-
const
|
|
74
|
+
const w = e.slice(0, 4), v = e.length - w.length, N = "flex h-6 w-6 items-center justify-center rounded-full border-2 border-white bg-[#c7f0fb] text-[10px] font-bold leading-none text-[#04516b] dark:border-slate-900 dark:bg-[#0c3b4a] dark:text-[#7dd8f2]";
|
|
75
75
|
return /* @__PURE__ */ l(
|
|
76
76
|
"span",
|
|
77
77
|
{
|
|
78
78
|
ref: i,
|
|
79
|
-
onMouseEnter: () =>
|
|
80
|
-
onMouseLeave:
|
|
79
|
+
onMouseEnter: () => u("hover"),
|
|
80
|
+
onMouseLeave: y,
|
|
81
81
|
onClick: (a) => {
|
|
82
|
-
a.stopPropagation(),
|
|
82
|
+
a.stopPropagation(), u("pin");
|
|
83
83
|
},
|
|
84
84
|
className: "inline-flex cursor-pointer items-center",
|
|
85
85
|
children: [
|
|
86
|
-
/* @__PURE__ */ t("span", { className: "flex -space-x-2", children:
|
|
87
|
-
|
|
86
|
+
/* @__PURE__ */ t("span", { className: "flex -space-x-2", children: w.map((a) => /* @__PURE__ */ t(
|
|
87
|
+
_,
|
|
88
88
|
{
|
|
89
89
|
userId: a.id,
|
|
90
90
|
className: "h-6 w-6 border-2 border-white dark:border-slate-900",
|
|
91
|
-
fallback: /* @__PURE__ */ t("span", { "data-copy-skip": !0, "aria-hidden": "true", className:
|
|
91
|
+
fallback: /* @__PURE__ */ t("span", { "data-copy-skip": !0, "aria-hidden": "true", className: N, children: c(a.name) })
|
|
92
92
|
},
|
|
93
93
|
a.id
|
|
94
94
|
)) }),
|
|
@@ -97,16 +97,16 @@ function ie({
|
|
|
97
97
|
v
|
|
98
98
|
] }),
|
|
99
99
|
r && e.length === 1 && /* @__PURE__ */ t("span", { className: "ml-1.5 max-w-[130px] truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: e[0].name }),
|
|
100
|
-
o &&
|
|
100
|
+
o && J(
|
|
101
101
|
/* @__PURE__ */ l(
|
|
102
102
|
"div",
|
|
103
103
|
{
|
|
104
104
|
ref: s,
|
|
105
105
|
style: oe(i.current, n),
|
|
106
|
-
onMouseEnter:
|
|
107
|
-
onMouseLeave:
|
|
106
|
+
onMouseEnter: g,
|
|
107
|
+
onMouseLeave: y,
|
|
108
108
|
onMouseDown: (a) => {
|
|
109
|
-
a.stopPropagation(),
|
|
109
|
+
a.stopPropagation(), m("pin");
|
|
110
110
|
},
|
|
111
111
|
onClick: (a) => a.stopPropagation(),
|
|
112
112
|
className: "w-max min-w-[190px] max-w-[300px] rounded-lg border border-slate-200 bg-white py-1.5 shadow-xl dark:border-slate-600 dark:bg-slate-800",
|
|
@@ -139,13 +139,13 @@ function Te({
|
|
|
139
139
|
collection: e,
|
|
140
140
|
itemId: r
|
|
141
141
|
}) {
|
|
142
|
-
const i = T(), { data: s = [], isLoading: d } =
|
|
142
|
+
const i = T(), { data: s = [], isLoading: d } = P({
|
|
143
143
|
queryKey: ["pipeline-owners-resolved", e, r],
|
|
144
144
|
queryFn: () => i.request(
|
|
145
145
|
V(`/pipelines/instance/${e}/owners/batch`, { ids: [r] })
|
|
146
146
|
).then((o) => {
|
|
147
|
-
var
|
|
148
|
-
return ((
|
|
147
|
+
var m;
|
|
148
|
+
return ((m = o.data) == null ? void 0 : m[r]) ?? [];
|
|
149
149
|
}),
|
|
150
150
|
enabled: !!i && !!e && !!r && r !== "new",
|
|
151
151
|
staleTime: 3e4
|
|
@@ -157,12 +157,12 @@ function $e({
|
|
|
157
157
|
itemId: r,
|
|
158
158
|
label: i
|
|
159
159
|
}) {
|
|
160
|
-
const s = T(), { data: d = [] } =
|
|
160
|
+
const s = T(), { data: d = [] } = P({
|
|
161
161
|
queryKey: ["pipeline-instance-owners", e, r],
|
|
162
162
|
queryFn: () => s.request(L(`/pipelines/instance/${e}/${r}/owners`)).then((n) => n.data ?? []),
|
|
163
163
|
enabled: !!s && !!e && !!r && r !== "new",
|
|
164
164
|
staleTime: 3e4
|
|
165
|
-
}), o = (n) => [n.first_name, n.last_name].filter(Boolean).join(" ") || n.email,
|
|
165
|
+
}), o = (n) => [n.first_name, n.last_name].filter(Boolean).join(" ") || n.email, m = (n) => o(n).split(" ").map((f) => f[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
|
|
166
166
|
return /* @__PURE__ */ l("div", { children: [
|
|
167
167
|
/* @__PURE__ */ t("p", { className: "text-[11px] font-medium text-slate-400 mb-1.5", children: i }),
|
|
168
168
|
d.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", children: d.map((n) => /* @__PURE__ */ l(
|
|
@@ -171,11 +171,11 @@ function $e({
|
|
|
171
171
|
className: "flex items-center gap-1.5 rounded-full border border-slate-200 bg-slate-50 py-0.5 pl-0.5 pr-2.5",
|
|
172
172
|
children: [
|
|
173
173
|
/* @__PURE__ */ t(
|
|
174
|
-
|
|
174
|
+
_,
|
|
175
175
|
{
|
|
176
176
|
userId: n.id,
|
|
177
177
|
className: "h-6 w-6",
|
|
178
|
-
fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 items-center justify-center rounded-full bg-nvr-cyan/15 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children:
|
|
178
|
+
fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 items-center justify-center rounded-full bg-nvr-cyan/15 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: m(n) })
|
|
179
179
|
}
|
|
180
180
|
),
|
|
181
181
|
/* @__PURE__ */ t("span", { className: "text-[12px] text-slate-700", children: o(n) })
|
|
@@ -192,41 +192,41 @@ function de({
|
|
|
192
192
|
navigate: s,
|
|
193
193
|
profileUrl: d,
|
|
194
194
|
online: o,
|
|
195
|
-
cardId:
|
|
195
|
+
cardId: m,
|
|
196
196
|
onAction: n,
|
|
197
|
-
open:
|
|
197
|
+
open: f = !1
|
|
198
198
|
}) {
|
|
199
|
-
var
|
|
200
|
-
const { isAdmin:
|
|
201
|
-
const
|
|
202
|
-
if (!
|
|
199
|
+
var h;
|
|
200
|
+
const { isAdmin: g, userId: u } = Z(), y = !!u && u.toUpperCase() === r.toUpperCase(), c = ne(r, f), w = I().roomOf(r), v = ((h = e == null ? void 0 : e.manager_name) == null ? void 0 : h.trim()) || null, N = (() => {
|
|
201
|
+
const x = e == null ? void 0 : e.timezone;
|
|
202
|
+
if (!x) return null;
|
|
203
203
|
try {
|
|
204
|
-
const
|
|
205
|
-
return
|
|
204
|
+
const b = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
205
|
+
return x === b ? null : new Intl.DateTimeFormat(void 0, {
|
|
206
206
|
hour: "numeric",
|
|
207
207
|
minute: "2-digit",
|
|
208
|
-
timeZone:
|
|
208
|
+
timeZone: x
|
|
209
209
|
}).format(/* @__PURE__ */ new Date());
|
|
210
210
|
} catch {
|
|
211
211
|
return null;
|
|
212
212
|
}
|
|
213
|
-
})(),
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
216
|
-
if (
|
|
217
|
-
const
|
|
218
|
-
return
|
|
213
|
+
})(), p = !!o || !!c.word ? c.word ? null : "Just now" : e != null && e.last_access ? (() => {
|
|
214
|
+
const x = Date.now() - new Date(e.last_access).getTime(), b = Math.floor(x / 6e4);
|
|
215
|
+
if (b < 2) return "Just now";
|
|
216
|
+
if (b < 60) return `${b}m ago`;
|
|
217
|
+
const k = Math.floor(b / 60);
|
|
218
|
+
return k < 24 ? `${k}h ago` : `${Math.floor(k / 24)}d ago`;
|
|
219
219
|
})() : null;
|
|
220
220
|
return /* @__PURE__ */ l(
|
|
221
221
|
se,
|
|
222
222
|
{
|
|
223
223
|
align: "start",
|
|
224
224
|
className: "w-72 p-0 overflow-hidden",
|
|
225
|
-
"data-nvr-user-card":
|
|
225
|
+
"data-nvr-user-card": m ?? "",
|
|
226
226
|
children: [
|
|
227
227
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-3 p-4 bg-gradient-to-br from-nvr-cyan/8 to-nvr-cyan/4 dark:from-nvr-cyan/10 dark:to-transparent border-b border-slate-100 dark:border-border", children: [
|
|
228
228
|
/* @__PURE__ */ t(
|
|
229
|
-
|
|
229
|
+
_,
|
|
230
230
|
{
|
|
231
231
|
userId: r,
|
|
232
232
|
className: "h-12 w-12 ring-2 ring-white shadow-sm dark:ring-card",
|
|
@@ -235,15 +235,15 @@ function de({
|
|
|
235
235
|
),
|
|
236
236
|
/* @__PURE__ */ l("div", { className: "min-w-0 flex-1", children: [
|
|
237
237
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
|
|
238
|
-
(o ||
|
|
238
|
+
(o || c.word) && /* @__PURE__ */ t(
|
|
239
239
|
"span",
|
|
240
240
|
{
|
|
241
|
-
"data-card-presence":
|
|
242
|
-
className:
|
|
241
|
+
"data-card-presence": c.word ?? "online",
|
|
242
|
+
className: j(
|
|
243
243
|
"h-2 w-2 shrink-0 rounded-full ring-2 ring-white dark:ring-card",
|
|
244
|
-
|
|
244
|
+
c.word === "away" ? "bg-white ring-amber-400 dark:bg-card" : c.word === "idle" ? "bg-amber-400" : "bg-emerald-400"
|
|
245
245
|
),
|
|
246
|
-
title:
|
|
246
|
+
title: c.word === "away" ? "Away" : c.word === "idle" ? "Idle" : "Online"
|
|
247
247
|
}
|
|
248
248
|
),
|
|
249
249
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100 truncate", children: e ? [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email : r }),
|
|
@@ -256,21 +256,21 @@ function de({
|
|
|
256
256
|
)
|
|
257
257
|
] }),
|
|
258
258
|
((e == null ? void 0 : e.title) || (e == null ? void 0 : e.department)) && /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-500 dark:text-slate-400 truncate mt-0.5", children: [e.title, e.department].filter(Boolean).join(" · ") }),
|
|
259
|
-
|
|
259
|
+
c.word && /* @__PURE__ */ l(
|
|
260
260
|
"p",
|
|
261
261
|
{
|
|
262
262
|
className: "mt-0.5 truncate text-[11px] text-slate-500 dark:text-slate-400",
|
|
263
263
|
"data-card-presence-line": !0,
|
|
264
264
|
children: [
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
c.word === "away" ? "Away" : c.word === "idle" ? `Idle${c.minutes ? ` · ${c.minutes}m` : ""}` : "Online now",
|
|
266
|
+
c.page ? ` · on ${c.page}` : ""
|
|
267
267
|
]
|
|
268
268
|
}
|
|
269
269
|
),
|
|
270
|
-
/* @__PURE__ */ t(A, { label: (
|
|
271
|
-
|
|
270
|
+
/* @__PURE__ */ t(A, { label: (w == null ? void 0 : w.label) ?? null, className: "mt-0.5" }),
|
|
271
|
+
N && /* @__PURE__ */ l("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: [
|
|
272
272
|
"Local time: ",
|
|
273
|
-
|
|
273
|
+
N
|
|
274
274
|
] }),
|
|
275
275
|
(e == null ? void 0 : e.is_out_of_office) && /* @__PURE__ */ l("span", { className: "mt-1 inline-flex items-center gap-1 rounded-full bg-amber-100 dark:bg-amber-900/30 px-1.5 py-px text-[10px] font-medium text-amber-700 dark:text-amber-400", children: [
|
|
276
276
|
/* @__PURE__ */ t(S, { className: "h-2.5 w-2.5" }),
|
|
@@ -280,8 +280,8 @@ function de({
|
|
|
280
280
|
ee,
|
|
281
281
|
{
|
|
282
282
|
email: e == null ? void 0 : e.email,
|
|
283
|
-
enabled:
|
|
284
|
-
canClear:
|
|
283
|
+
enabled: f,
|
|
284
|
+
canClear: g,
|
|
285
285
|
className: "mt-1"
|
|
286
286
|
}
|
|
287
287
|
)
|
|
@@ -311,7 +311,7 @@ function de({
|
|
|
311
311
|
}
|
|
312
312
|
)
|
|
313
313
|
] }),
|
|
314
|
-
((e == null ? void 0 : e.role_name) || v ||
|
|
314
|
+
((e == null ? void 0 : e.role_name) || v || p) && /* @__PURE__ */ l("div", { className: "px-4 py-3 space-y-1.5 border-b border-slate-100 dark:border-border", children: [
|
|
315
315
|
(e == null ? void 0 : e.role_name) && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-[11px] text-slate-500 dark:text-slate-400", children: [
|
|
316
316
|
/* @__PURE__ */ t(D, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
317
317
|
/* @__PURE__ */ t("span", { children: e.role_name })
|
|
@@ -324,11 +324,11 @@ function de({
|
|
|
324
324
|
/* @__PURE__ */ t("span", { className: "font-medium text-slate-600 dark:text-slate-300", children: v })
|
|
325
325
|
] })
|
|
326
326
|
] }),
|
|
327
|
-
|
|
327
|
+
p && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-[11px] text-slate-400", children: [
|
|
328
328
|
/* @__PURE__ */ t(z, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
329
329
|
/* @__PURE__ */ l("span", { children: [
|
|
330
330
|
"Last seen ",
|
|
331
|
-
|
|
331
|
+
p
|
|
332
332
|
] })
|
|
333
333
|
] })
|
|
334
334
|
] }),
|
|
@@ -379,7 +379,7 @@ function de({
|
|
|
379
379
|
}
|
|
380
380
|
)
|
|
381
381
|
] }),
|
|
382
|
-
|
|
382
|
+
g && !y && /* @__PURE__ */ t(
|
|
383
383
|
ce,
|
|
384
384
|
{
|
|
385
385
|
userId: r,
|
|
@@ -396,13 +396,13 @@ function ce({
|
|
|
396
396
|
name: r,
|
|
397
397
|
onDone: i
|
|
398
398
|
}) {
|
|
399
|
-
const [s, d] =
|
|
399
|
+
const [s, d] = O(!1);
|
|
400
400
|
B(() => {
|
|
401
401
|
if (!s) return;
|
|
402
|
-
const
|
|
403
|
-
return () => clearTimeout(
|
|
402
|
+
const f = setTimeout(() => d(!1), 4e3);
|
|
403
|
+
return () => clearTimeout(f);
|
|
404
404
|
}, [s]);
|
|
405
|
-
const o = te(e, { onDone: i }),
|
|
405
|
+
const o = te(e, { onDone: i }), m = ae(e, r, { onDone: i }), n = "flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] font-medium transition-colors disabled:opacity-50";
|
|
406
406
|
return /* @__PURE__ */ l(
|
|
407
407
|
"div",
|
|
408
408
|
{
|
|
@@ -416,13 +416,13 @@ function ce({
|
|
|
416
416
|
disabled: o.isPending,
|
|
417
417
|
onClick: () => o.mutate({}),
|
|
418
418
|
"data-tip": "Every tab they have open shows a 15-second countdown, then reloads",
|
|
419
|
-
className:
|
|
419
|
+
className: j(
|
|
420
420
|
n,
|
|
421
421
|
"text-amber-800 hover:bg-amber-50 dark:text-amber-300 dark:hover:bg-amber-500/10"
|
|
422
422
|
),
|
|
423
423
|
"data-user-card-reload": !0,
|
|
424
424
|
children: [
|
|
425
|
-
/* @__PURE__ */ t(W, { className:
|
|
425
|
+
/* @__PURE__ */ t(W, { className: j("h-3.5 w-3.5", o.isPending && "animate-spin") }),
|
|
426
426
|
o.isPending ? "Sending…" : "Reload tabs"
|
|
427
427
|
]
|
|
428
428
|
}
|
|
@@ -431,17 +431,17 @@ function ce({
|
|
|
431
431
|
"button",
|
|
432
432
|
{
|
|
433
433
|
type: "button",
|
|
434
|
-
disabled:
|
|
435
|
-
onClick: () => s ?
|
|
434
|
+
disabled: m.isPending,
|
|
435
|
+
onClick: () => s ? m.mutate() : d(!0),
|
|
436
436
|
"data-tip": s ? "Click again to sign them out of every session" : "Ends every session they have, on every app — they can sign in again",
|
|
437
|
-
className:
|
|
437
|
+
className: j(
|
|
438
438
|
n,
|
|
439
439
|
s ? "bg-red-600 text-white hover:bg-red-700" : "text-amber-800 hover:bg-amber-50 dark:text-amber-300 dark:hover:bg-amber-500/10"
|
|
440
440
|
),
|
|
441
441
|
"data-user-card-sign-out": s ? "armed" : "",
|
|
442
442
|
children: [
|
|
443
443
|
/* @__PURE__ */ t(H, { className: "h-3.5 w-3.5" }),
|
|
444
|
-
|
|
444
|
+
m.isPending ? "Signing out…" : s ? "Confirm sign out" : "Sign out"
|
|
445
445
|
]
|
|
446
446
|
}
|
|
447
447
|
)
|
|
@@ -454,34 +454,34 @@ function me({
|
|
|
454
454
|
size: r = "default",
|
|
455
455
|
children: i
|
|
456
456
|
}) {
|
|
457
|
-
const s = T(), { navigate: d, userUrl: o } =
|
|
457
|
+
const s = T(), { navigate: d, userUrl: o } = Q(), m = o ? o(e) : `/users/${e}`, [n, f] = O(!1), g = R.useId();
|
|
458
458
|
E(
|
|
459
459
|
n,
|
|
460
460
|
(a) => {
|
|
461
|
-
var p,
|
|
462
|
-
return !!((p = a.closest) != null && p.call(a, `[data-nvr-user-card="${CSS.escape(
|
|
463
|
-
!!((x = a.closest) != null && x.call(a, "[data-radix-popper-content-wrapper]")) && !((
|
|
461
|
+
var p, h, x, b;
|
|
462
|
+
return !!((p = a.closest) != null && p.call(a, `[data-nvr-user-card="${CSS.escape(g)}"]`)) || !!((h = a.closest) != null && h.call(a, `[data-nvr-user-chip="${CSS.escape(g)}"]`)) || // Anything else floating above the card (a tooltip, a nested menu).
|
|
463
|
+
!!((x = a.closest) != null && x.call(a, "[data-radix-popper-content-wrapper]")) && !((b = a.closest) != null && b.call(a, "[data-nvr-user-card]"));
|
|
464
464
|
},
|
|
465
|
-
() =>
|
|
465
|
+
() => f(!1)
|
|
466
466
|
);
|
|
467
|
-
const { data:
|
|
467
|
+
const { data: u, isLoading: y } = P({
|
|
468
468
|
...G(s, e),
|
|
469
469
|
enabled: !!s && !!e,
|
|
470
470
|
staleTime: 12e4
|
|
471
|
-
}), { data:
|
|
471
|
+
}), { data: c } = P({
|
|
472
472
|
queryKey: ["user-presence", e],
|
|
473
473
|
queryFn: () => s.request(L(`/presence/users/${e}`)).then((a) => a),
|
|
474
474
|
enabled: !!s && !!e && n,
|
|
475
475
|
staleTime: 15e3,
|
|
476
476
|
refetchInterval: n ? 2e4 : !1
|
|
477
|
-
}),
|
|
478
|
-
return
|
|
477
|
+
}), w = u ? [u.first_name, u.last_name].filter(Boolean).join(" ") || u.email : e, v = w.split(" ").map((a) => a[0]).filter(Boolean).slice(0, 2).join("").toUpperCase(), N = (c == null ? void 0 : c.online) ?? !1;
|
|
478
|
+
return y && !i ? r === "compact" ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1.5 rounded-full border border-slate-200 bg-slate-50 py-0.5 pl-0.5 pr-2.5", children: [
|
|
479
479
|
/* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 rounded-full animate-pulse bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
480
480
|
/* @__PURE__ */ t("span", { className: "animate-pulse h-2.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" })
|
|
481
|
-
] }) : /* @__PURE__ */ l(re, { open: n, onOpenChange:
|
|
482
|
-
/* @__PURE__ */ t(le, { asChild: !0, "data-nvr-user-chip":
|
|
481
|
+
] }) : /* @__PURE__ */ l(re, { open: n, onOpenChange: f, children: [
|
|
482
|
+
/* @__PURE__ */ t(le, { asChild: !0, "data-nvr-user-chip": g, children: i || (r === "compact" ? /* @__PURE__ */ l("span", { className: "inline-flex cursor-pointer items-center gap-1 rounded-full bg-slate-100 dark:bg-slate-800 py-px pl-px pr-1.5 hover:bg-slate-200 dark:hover:bg-slate-700 transition-colors", children: [
|
|
483
483
|
/* @__PURE__ */ t(
|
|
484
|
-
|
|
484
|
+
_,
|
|
485
485
|
{
|
|
486
486
|
userId: e,
|
|
487
487
|
className: "h-4 w-4",
|
|
@@ -496,10 +496,10 @@ function me({
|
|
|
496
496
|
)
|
|
497
497
|
}
|
|
498
498
|
),
|
|
499
|
-
/* @__PURE__ */ t("span", { className: "text-[11px] font-medium text-slate-600 dark:text-slate-300", children:
|
|
499
|
+
/* @__PURE__ */ t("span", { className: "text-[11px] font-medium text-slate-600 dark:text-slate-300", children: w })
|
|
500
500
|
] }) : /* @__PURE__ */ l("div", { className: "inline-flex cursor-pointer items-center gap-1.5 rounded-full border border-slate-200 bg-slate-50 py-0.5 pl-0.5 pr-2.5 hover:bg-slate-100 dark:border-border dark:bg-card dark:hover:bg-accent transition-colors", children: [
|
|
501
501
|
/* @__PURE__ */ t(
|
|
502
|
-
|
|
502
|
+
_,
|
|
503
503
|
{
|
|
504
504
|
userId: e,
|
|
505
505
|
className: "h-6 w-6",
|
|
@@ -514,19 +514,19 @@ function me({
|
|
|
514
514
|
)
|
|
515
515
|
}
|
|
516
516
|
),
|
|
517
|
-
/* @__PURE__ */ t("span", { className: "text-[12px] text-slate-700 dark:text-slate-300", children:
|
|
517
|
+
/* @__PURE__ */ t("span", { className: "text-[12px] text-slate-700 dark:text-slate-300", children: w })
|
|
518
518
|
] })) }),
|
|
519
519
|
/* @__PURE__ */ t(
|
|
520
520
|
de,
|
|
521
521
|
{
|
|
522
|
-
user:
|
|
522
|
+
user: u,
|
|
523
523
|
userId: e,
|
|
524
524
|
initials: v,
|
|
525
525
|
navigate: d,
|
|
526
|
-
profileUrl:
|
|
527
|
-
online:
|
|
528
|
-
cardId:
|
|
529
|
-
onAction: () =>
|
|
526
|
+
profileUrl: m,
|
|
527
|
+
online: N,
|
|
528
|
+
cardId: g,
|
|
529
|
+
onAction: () => f(!1),
|
|
530
530
|
open: n
|
|
531
531
|
}
|
|
532
532
|
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { toast as d } from "sonner";
|
|
2
|
+
import { useApiFetchConfig as u } from "../../context.js";
|
|
3
|
+
function f() {
|
|
4
|
+
const o = u(), a = o.authHeaders.Authorization;
|
|
5
|
+
return (c, i) => {
|
|
6
|
+
if (a)
|
|
7
|
+
return (e) => {
|
|
8
|
+
e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || (e.preventDefault(), fetch(c, { headers: o.authHeaders, credentials: o.credentials }).then(async (r) => {
|
|
9
|
+
if (!r.ok) throw new Error(String(r.status));
|
|
10
|
+
const n = URL.createObjectURL(await r.blob()), t = document.createElement("a");
|
|
11
|
+
t.href = n, t.download = i || "download", document.body.appendChild(t), t.click(), t.remove(), setTimeout(() => URL.revokeObjectURL(n), 3e4);
|
|
12
|
+
}).catch(() => d.error("The file could not be downloaded")));
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
f as useFileDownload
|
|
18
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { evaluateNumeric as
|
|
2
|
-
|
|
1
|
+
import { evaluateNumeric as a } from "../../lib/expression.js";
|
|
2
|
+
import { applyValidationRule as m } from "../../lib/validation-rules.js";
|
|
3
|
+
const f = {
|
|
3
4
|
tinyint: 255,
|
|
4
5
|
smallint: 32767,
|
|
5
6
|
integer: 2147483647,
|
|
6
7
|
int: 2147483647,
|
|
7
8
|
bigInteger: Number.MAX_SAFE_INTEGER,
|
|
8
9
|
bigint: Number.MAX_SAFE_INTEGER
|
|
9
|
-
},
|
|
10
|
-
...Object.keys(
|
|
10
|
+
}, b = /* @__PURE__ */ new Set([
|
|
11
|
+
...Object.keys(f),
|
|
11
12
|
"decimal",
|
|
12
13
|
"float",
|
|
13
14
|
"double",
|
|
@@ -17,41 +18,75 @@ const o = {
|
|
|
17
18
|
"smallmoney",
|
|
18
19
|
"number"
|
|
19
20
|
]);
|
|
20
|
-
function
|
|
21
|
-
return
|
|
21
|
+
function c(n) {
|
|
22
|
+
return n != null && Object.hasOwn(f, n);
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
24
|
+
function E(n, e = {}) {
|
|
25
|
+
const i = e.label ?? "Value";
|
|
26
|
+
if (n == null || typeof n == "string" && n.trim() === "")
|
|
26
27
|
return { ok: !0, value: null };
|
|
27
|
-
const
|
|
28
|
-
if (Number.isNaN(
|
|
29
|
-
const t =
|
|
30
|
-
return !Number.isFinite(
|
|
28
|
+
const r = typeof n == "number" ? n : Number(n);
|
|
29
|
+
if (Number.isNaN(r)) return { ok: !1, message: `${i} must be a number` };
|
|
30
|
+
const t = c(e.type) ? f[e.type] : Number.MAX_SAFE_INTEGER;
|
|
31
|
+
return !Number.isFinite(r) || Math.abs(r) > t ? { ok: !1, message: `${i} can't be more than ${t.toLocaleString("en-US")}` } : c(e.type) && !Number.isInteger(r) ? { ok: !1, message: `${i} must be a whole number` } : e.min !== void 0 && r < e.min ? {
|
|
31
32
|
ok: !1,
|
|
32
|
-
message:
|
|
33
|
-
} : { ok: !0, value:
|
|
33
|
+
message: e.min === 0 ? `${i} can't be negative` : `${i} can't be below ${e.min}`
|
|
34
|
+
} : { ok: !0, value: r };
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
-
const t = { ...
|
|
37
|
-
for (const u of
|
|
38
|
-
|
|
39
|
-
for (const [u,
|
|
40
|
-
const
|
|
41
|
-
|
|
36
|
+
function _(n, e, i, r = {}) {
|
|
37
|
+
const t = { ...n, ...e };
|
|
38
|
+
for (const u of i)
|
|
39
|
+
n[u] != null && n[u] !== "" && (t[u] = n[u]);
|
|
40
|
+
for (const [u, l] of Object.entries(r)) {
|
|
41
|
+
const o = a(l, t);
|
|
42
|
+
o !== null && (t[u] = o);
|
|
42
43
|
}
|
|
43
44
|
return t;
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
-
const
|
|
47
|
-
for (const [t, u] of Object.entries(
|
|
48
|
-
|
|
49
|
-
return
|
|
46
|
+
function p(n, e, i) {
|
|
47
|
+
const r = {};
|
|
48
|
+
for (const [t, u] of Object.entries(n))
|
|
49
|
+
i.has(t) && (e && t !== "_change_reason" && String(u ?? "") === String(e[t] ?? "") || (r[t] = u));
|
|
50
|
+
return r;
|
|
51
|
+
}
|
|
52
|
+
function g(n) {
|
|
53
|
+
let e = n;
|
|
54
|
+
if (typeof e == "string")
|
|
55
|
+
try {
|
|
56
|
+
e = JSON.parse(e);
|
|
57
|
+
} catch {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
return Array.isArray(e) ? e.filter((i) => i && typeof i.type == "string") : [];
|
|
61
|
+
}
|
|
62
|
+
function h(n, e, i) {
|
|
63
|
+
const r = [];
|
|
64
|
+
for (const t of n)
|
|
65
|
+
for (const u of g(t.validation_rules)) {
|
|
66
|
+
if (u.soft) continue;
|
|
67
|
+
const l = u.type === "gte_field" || u.type === "lte_field";
|
|
68
|
+
if (!(t.field in e) && !(l && u.field && u.field in e)) continue;
|
|
69
|
+
const o = y(t.type, i[t.field]), s = m(u, o, t.label || t.field, i);
|
|
70
|
+
if (s) {
|
|
71
|
+
r.push({ field: t.field, message: s });
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return r;
|
|
76
|
+
}
|
|
77
|
+
function y(n, e) {
|
|
78
|
+
if (typeof e != "string" || !b.has(n ?? "")) return e;
|
|
79
|
+
const i = e.trim();
|
|
80
|
+
if (i === "") return e;
|
|
81
|
+
const r = Number(i);
|
|
82
|
+
return Number.isNaN(r) ? e : r;
|
|
50
83
|
}
|
|
51
84
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
85
|
+
b as NUMBER_FIELD_TYPES,
|
|
86
|
+
p as changedRowFields,
|
|
87
|
+
E as checkNumberEntry,
|
|
88
|
+
c as isIntegerFieldType,
|
|
89
|
+
h as lineRuleErrors,
|
|
90
|
+
_ as mergePendingQtyRow,
|
|
91
|
+
y as ruleValueFor
|
|
57
92
|
};
|