@nivaro/react 0.3.50 → 0.3.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/shared/components/ItemEditForm.js +4720 -4593
- package/dist/shared/components/QueryTable.js +337 -324
- package/dist/shared/components/ReportView.js +105 -99
- package/dist/shared/components/alerts/AlertManagerView.js +327 -301
- package/dist/shared/components/item-edit/CatalogPickerField.js +1149 -1111
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
- package/dist/shared/components/item-edit/FieldRenderer.js +227 -223
- package/dist/shared/components/item-edit/FieldRow.js +287 -265
- package/dist/shared/components/item-edit/FilePickerField.js +315 -307
- package/dist/shared/components/item-edit/InlineTableField.js +491 -466
- package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
- package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
- package/dist/shared/components/item-edit/RelationCombobox.js +62 -60
- package/dist/shared/components/item-edit/SummaryPanel.js +287 -277
- package/dist/shared/components/item-edit/UserChip.js +233 -200
- package/dist/shared/components/item-edit/header-midair.js +51 -0
- package/dist/shared/components/item-edit/line-midair.js +76 -70
- package/dist/shared/components/panels/CommentPanel.js +290 -284
- package/dist/shared/components/panels/ItemLockBanner.js +30 -30
- package/dist/shared/components/panels/PipelinePanel.js +956 -901
- package/dist/shared/components/panels/TaskPanel.js +71 -61
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
- package/dist/shared/components/panels/requirement-side-effects.js +40 -0
- package/dist/shared/components/queue/QueueWorklist.js +141 -130
- package/dist/shared/lib/draft-store.js +48 -34
- package/dist/shared/lib/query-stats.js +60 -60
- package/package.json +1 -1
|
@@ -1,114 +1,138 @@
|
|
|
1
1
|
import { jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { UserCheck as
|
|
4
|
-
import R, { useState as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { useOptionalNivaroClient as
|
|
7
|
-
import { get as
|
|
8
|
-
import { userCardQuery as
|
|
2
|
+
import { useQuery as C } from "@tanstack/react-query";
|
|
3
|
+
import { UserCheck as U, Mail as q, Phone as D, Building2 as F, User as O, Clock as z, MessageCircle as K, ExternalLink as W, RefreshCw as H, LogOut as J } from "lucide-react";
|
|
4
|
+
import R, { useState as P, useRef as N, useEffect as $ } from "react";
|
|
5
|
+
import { createPortal as Z } from "react-dom";
|
|
6
|
+
import { useOptionalNivaroClient as S, useNavigation as V, useItemEditAuth as G } from "../../context.js";
|
|
7
|
+
import { get as B, post as X } from "../../lib/commands.js";
|
|
8
|
+
import { userCardQuery as L } from "../../lib/user-cards.js";
|
|
9
9
|
import { cn as j } from "../../lib/utils.js";
|
|
10
|
-
import { canOpenDm as
|
|
11
|
-
import { HuddlePresenceLine as
|
|
12
|
-
import { useHuddleLive as
|
|
10
|
+
import { canOpenDm as Y, openDmWith as A } from "../chat/chat-core.js";
|
|
11
|
+
import { HuddlePresenceLine as I } from "../chat/huddle/HuddleLiveBadge.js";
|
|
12
|
+
import { useHuddleLive as Q } 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
16
|
import { UserAvatar as _ } from "../UserAvatar.js";
|
|
17
17
|
import { Popover as re, PopoverTrigger as le, PopoverContent as se } from "../ui/popover.js";
|
|
18
|
-
function E(e,
|
|
19
|
-
const s =
|
|
20
|
-
s.current =
|
|
21
|
-
const d =
|
|
22
|
-
d.current =
|
|
18
|
+
function E(e, n, r) {
|
|
19
|
+
const s = N(n);
|
|
20
|
+
s.current = n;
|
|
21
|
+
const d = N(r);
|
|
22
|
+
d.current = r, $(() => {
|
|
23
23
|
if (!e) return;
|
|
24
|
-
const
|
|
25
|
-
const f =
|
|
24
|
+
const c = (a) => {
|
|
25
|
+
const f = a.target;
|
|
26
26
|
f && s.current(f) || d.current();
|
|
27
27
|
}, m = () => d.current();
|
|
28
|
-
return document.addEventListener("pointerdown",
|
|
29
|
-
document.removeEventListener("pointerdown",
|
|
28
|
+
return document.addEventListener("pointerdown", c, !0), window.addEventListener("blur", m), () => {
|
|
29
|
+
document.removeEventListener("pointerdown", c, !0), window.removeEventListener("blur", m);
|
|
30
30
|
};
|
|
31
31
|
}, [e]);
|
|
32
32
|
}
|
|
33
|
-
function ie({
|
|
33
|
+
function ie(e) {
|
|
34
|
+
const n = String(e ?? "").trim();
|
|
35
|
+
return !n || /^redacted\b/i.test(n) ? "" : n.split(/\s+/).map((r) => r[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
|
|
36
|
+
}
|
|
37
|
+
function oe(e, n) {
|
|
38
|
+
const r = String(e ?? "").trim();
|
|
39
|
+
return r || [n == null ? void 0 : n.first_name, n == null ? void 0 : n.last_name].filter(Boolean).join(" ").trim();
|
|
40
|
+
}
|
|
41
|
+
function de({
|
|
42
|
+
user: e,
|
|
43
|
+
avatarCls: n
|
|
44
|
+
}) {
|
|
45
|
+
const r = S(), { data: s } = C({
|
|
46
|
+
...L(r, e.id),
|
|
47
|
+
enabled: !!r && !!e.id && !String(e.name ?? "").trim(),
|
|
48
|
+
staleTime: 30 * 6e4,
|
|
49
|
+
retry: !1
|
|
50
|
+
}), d = oe(e.name, s), c = ie(d), m = /^redacted\b/i.test(d);
|
|
51
|
+
return /* @__PURE__ */ t(
|
|
52
|
+
"span",
|
|
53
|
+
{
|
|
54
|
+
className: "inline-flex",
|
|
55
|
+
"data-tip": m ? "Former user (account redacted)" : d || void 0,
|
|
56
|
+
children: /* @__PURE__ */ t(
|
|
57
|
+
_,
|
|
58
|
+
{
|
|
59
|
+
userId: e.id,
|
|
60
|
+
className: "h-6 w-6 border-2 border-white dark:border-slate-900",
|
|
61
|
+
fallback: /* @__PURE__ */ t("span", { "data-copy-skip": !0, "aria-hidden": "true", className: n, children: c || /* @__PURE__ */ t(O, { className: "h-3 w-3", "aria-hidden": !0 }) })
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
function ce({
|
|
34
68
|
users: e,
|
|
35
|
-
showSingleName:
|
|
69
|
+
showSingleName: n = !0
|
|
36
70
|
}) {
|
|
37
|
-
const
|
|
71
|
+
const r = N(null), s = N(null), d = N(null), [c, m] = P(null), [a, f] = P({ x: 0, y: 0 }), b = () => {
|
|
38
72
|
d.current && clearTimeout(d.current), d.current = null;
|
|
39
|
-
}, u = (
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
73
|
+
}, u = (i) => {
|
|
74
|
+
var x;
|
|
75
|
+
b();
|
|
76
|
+
const o = (x = r.current) == null ? void 0 : x.getBoundingClientRect();
|
|
77
|
+
o && f({ x: o.left, y: o.bottom + 6 }), m((h) => h === "pin" ? "pin" : i);
|
|
44
78
|
}, y = () => {
|
|
45
|
-
|
|
79
|
+
b(), d.current = setTimeout(() => m((i) => i === "pin" ? i : null), 160);
|
|
46
80
|
};
|
|
47
|
-
R.useLayoutEffect(() => {
|
|
48
|
-
var
|
|
49
|
-
if (!
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
52
|
-
const
|
|
53
|
-
let { x
|
|
54
|
-
if (
|
|
55
|
-
const
|
|
56
|
-
|
|
81
|
+
if (R.useLayoutEffect(() => {
|
|
82
|
+
var w;
|
|
83
|
+
if (!c) return;
|
|
84
|
+
const i = s.current;
|
|
85
|
+
if (!i) return;
|
|
86
|
+
const o = i.getBoundingClientRect();
|
|
87
|
+
let { x, y: h } = a;
|
|
88
|
+
if (o.right > window.innerWidth - 8 && (x = Math.max(8, window.innerWidth - o.width - 8)), o.bottom > window.innerHeight - 8) {
|
|
89
|
+
const g = (w = r.current) == null ? void 0 : w.getBoundingClientRect();
|
|
90
|
+
h = Math.max(8, ((g == null ? void 0 : g.top) ?? h) - o.height - 6);
|
|
57
91
|
}
|
|
58
|
-
(
|
|
59
|
-
}, [
|
|
60
|
-
!!
|
|
61
|
-
(
|
|
62
|
-
var
|
|
92
|
+
(x !== a.x || h !== a.y) && f({ x, y: h });
|
|
93
|
+
}, [c, a]), E(
|
|
94
|
+
!!c,
|
|
95
|
+
(i) => {
|
|
96
|
+
var o, x, h;
|
|
63
97
|
return (
|
|
64
98
|
// Clicks inside the user-card popover (portaled by Radix) keep the
|
|
65
99
|
// roster mounted — closing would unmount the card mid-click.
|
|
66
|
-
!!((
|
|
100
|
+
!!((o = i.closest) != null && o.call(i, "[data-radix-popper-content-wrapper]")) || !!((x = s.current) != null && x.contains(i)) || !!((h = r.current) != null && h.contains(i))
|
|
67
101
|
);
|
|
68
102
|
},
|
|
69
103
|
() => m(null)
|
|
70
|
-
)
|
|
71
|
-
const c = (a) => a.split(" ").map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
|
|
72
|
-
if (e.length === 0)
|
|
104
|
+
), e.length === 0)
|
|
73
105
|
return /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400", "data-roster-empty": !0, children: "—" });
|
|
74
|
-
const
|
|
106
|
+
const p = e.slice(0, 4), v = e.length - p.length, k = "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
107
|
return /* @__PURE__ */ l(
|
|
76
108
|
"span",
|
|
77
109
|
{
|
|
78
|
-
ref:
|
|
110
|
+
ref: r,
|
|
79
111
|
onMouseEnter: () => u("hover"),
|
|
80
112
|
onMouseLeave: y,
|
|
81
|
-
onClick: (
|
|
82
|
-
|
|
113
|
+
onClick: (i) => {
|
|
114
|
+
i.stopPropagation(), u("pin");
|
|
83
115
|
},
|
|
84
116
|
className: "inline-flex cursor-pointer items-center",
|
|
85
117
|
children: [
|
|
86
|
-
/* @__PURE__ */ t("span", { className: "flex -space-x-2", children:
|
|
87
|
-
_,
|
|
88
|
-
{
|
|
89
|
-
userId: a.id,
|
|
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: N, children: c(a.name) })
|
|
92
|
-
},
|
|
93
|
-
a.id
|
|
94
|
-
)) }),
|
|
118
|
+
/* @__PURE__ */ t("span", { className: "flex -space-x-2", children: p.map((i) => /* @__PURE__ */ t(de, { user: i, avatarCls: k }, i.id)) }),
|
|
95
119
|
v > 0 && /* @__PURE__ */ l("span", { className: "ml-1 rounded-full bg-slate-200 px-1.5 py-0.5 text-[10.5px] font-bold leading-none text-slate-600 dark:bg-slate-700 dark:text-slate-300", children: [
|
|
96
120
|
"+",
|
|
97
121
|
v
|
|
98
122
|
] }),
|
|
99
|
-
|
|
100
|
-
|
|
123
|
+
n && 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 }),
|
|
124
|
+
c && Z(
|
|
101
125
|
/* @__PURE__ */ l(
|
|
102
126
|
"div",
|
|
103
127
|
{
|
|
104
128
|
ref: s,
|
|
105
|
-
style:
|
|
106
|
-
onMouseEnter:
|
|
129
|
+
style: me(r.current, a),
|
|
130
|
+
onMouseEnter: b,
|
|
107
131
|
onMouseLeave: y,
|
|
108
|
-
onMouseDown: (
|
|
109
|
-
|
|
132
|
+
onMouseDown: (i) => {
|
|
133
|
+
i.stopPropagation(), m("pin");
|
|
110
134
|
},
|
|
111
|
-
onClick: (
|
|
135
|
+
onClick: (i) => i.stopPropagation(),
|
|
112
136
|
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",
|
|
113
137
|
children: [
|
|
114
138
|
/* @__PURE__ */ l("p", { className: "px-3 pb-1 text-[10px] font-bold uppercase tracking-wide text-slate-400", children: [
|
|
@@ -116,11 +140,11 @@ function ie({
|
|
|
116
140
|
" user",
|
|
117
141
|
e.length === 1 ? "" : "s"
|
|
118
142
|
] }),
|
|
119
|
-
e.map((
|
|
143
|
+
e.map((i) => /* @__PURE__ */ t("div", { className: "flex px-2 py-0.5", children: /* @__PURE__ */ t(xe, { userId: i.id, size: "compact" }) }, i.id))
|
|
120
144
|
]
|
|
121
145
|
}
|
|
122
146
|
),
|
|
123
|
-
M(
|
|
147
|
+
M(r.current)
|
|
124
148
|
)
|
|
125
149
|
]
|
|
126
150
|
}
|
|
@@ -129,43 +153,50 @@ function ie({
|
|
|
129
153
|
function M(e) {
|
|
130
154
|
return (e == null ? void 0 : e.closest('[role="dialog"]')) ?? document.body;
|
|
131
155
|
}
|
|
132
|
-
function
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
const s =
|
|
136
|
-
return { position: "absolute", left:
|
|
156
|
+
function me(e, n) {
|
|
157
|
+
const r = M(e);
|
|
158
|
+
if (r === document.body) return { position: "fixed", left: n.x, top: n.y, zIndex: 50 };
|
|
159
|
+
const s = r.getBoundingClientRect();
|
|
160
|
+
return { position: "absolute", left: n.x - s.left, top: n.y - s.top, zIndex: 120 };
|
|
137
161
|
}
|
|
138
|
-
function
|
|
162
|
+
function $e({
|
|
139
163
|
collection: e,
|
|
140
|
-
itemId:
|
|
164
|
+
itemId: n
|
|
141
165
|
}) {
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
166
|
+
const r = S(), {
|
|
167
|
+
data: s = [],
|
|
168
|
+
isLoading: d,
|
|
169
|
+
isFetching: c
|
|
170
|
+
} = C({
|
|
171
|
+
queryKey: ["pipeline-owners-resolved", e, n],
|
|
172
|
+
queryFn: () => r.request(
|
|
173
|
+
X(`/pipelines/instance/${e}/owners/batch`, { ids: [n] })
|
|
174
|
+
).then((m) => {
|
|
175
|
+
var a;
|
|
176
|
+
return ((a = m.data) == null ? void 0 : a[n]) ?? [];
|
|
149
177
|
}),
|
|
150
|
-
enabled: !!
|
|
151
|
-
staleTime: 3e4
|
|
178
|
+
enabled: !!r && !!e && !!n && n !== "new",
|
|
179
|
+
staleTime: 3e4,
|
|
180
|
+
// Keep this RECORD's last answer while a move re-asks (the tile used to go
|
|
181
|
+
// blank for ~2 s after Submit) — never another record's (b01-N15).
|
|
182
|
+
placeholderData: (m, a) => (a == null ? void 0 : a.queryKey[1]) === e && String(a == null ? void 0 : a.queryKey[2]) === String(n) ? m : void 0
|
|
152
183
|
});
|
|
153
|
-
return d ? /* @__PURE__ */ t("span", { className: "animate-pulse h-3 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" }) : /* @__PURE__ */ t(
|
|
184
|
+
return d || c && s.length === 0 ? /* @__PURE__ */ t("span", { className: "animate-pulse h-3 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" }) : /* @__PURE__ */ t(ce, { users: s });
|
|
154
185
|
}
|
|
155
|
-
function
|
|
186
|
+
function Be({
|
|
156
187
|
collection: e,
|
|
157
|
-
itemId:
|
|
158
|
-
label:
|
|
188
|
+
itemId: n,
|
|
189
|
+
label: r
|
|
159
190
|
}) {
|
|
160
|
-
const s =
|
|
161
|
-
queryKey: ["pipeline-instance-owners", e,
|
|
162
|
-
queryFn: () => s.request(
|
|
163
|
-
enabled: !!s && !!e && !!
|
|
191
|
+
const s = S(), { data: d = [] } = C({
|
|
192
|
+
queryKey: ["pipeline-instance-owners", e, n],
|
|
193
|
+
queryFn: () => s.request(B(`/pipelines/instance/${e}/${n}/owners`)).then((a) => a.data ?? []),
|
|
194
|
+
enabled: !!s && !!e && !!n && n !== "new",
|
|
164
195
|
staleTime: 3e4
|
|
165
|
-
}),
|
|
196
|
+
}), c = (a) => [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email, m = (a) => c(a).split(" ").map((f) => f[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
|
|
166
197
|
return /* @__PURE__ */ l("div", { children: [
|
|
167
|
-
/* @__PURE__ */ t("p", { className: "text-[11px] font-medium text-slate-400 mb-1.5", children:
|
|
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((
|
|
198
|
+
/* @__PURE__ */ t("p", { className: "text-[11px] font-medium text-slate-400 mb-1.5", children: r }),
|
|
199
|
+
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((a) => /* @__PURE__ */ l(
|
|
169
200
|
"div",
|
|
170
201
|
{
|
|
171
202
|
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",
|
|
@@ -173,49 +204,49 @@ function $e({
|
|
|
173
204
|
/* @__PURE__ */ t(
|
|
174
205
|
_,
|
|
175
206
|
{
|
|
176
|
-
userId:
|
|
207
|
+
userId: a.id,
|
|
177
208
|
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: m(
|
|
209
|
+
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(a) })
|
|
179
210
|
}
|
|
180
211
|
),
|
|
181
|
-
/* @__PURE__ */ t("span", { className: "text-[12px] text-slate-700", children:
|
|
212
|
+
/* @__PURE__ */ t("span", { className: "text-[12px] text-slate-700", children: c(a) })
|
|
182
213
|
]
|
|
183
214
|
},
|
|
184
|
-
|
|
215
|
+
a.id
|
|
185
216
|
)) })
|
|
186
217
|
] });
|
|
187
218
|
}
|
|
188
|
-
function
|
|
219
|
+
function pe({
|
|
189
220
|
user: e,
|
|
190
|
-
userId:
|
|
191
|
-
initials:
|
|
221
|
+
userId: n,
|
|
222
|
+
initials: r,
|
|
192
223
|
navigate: s,
|
|
193
224
|
profileUrl: d,
|
|
194
|
-
online:
|
|
225
|
+
online: c,
|
|
195
226
|
cardId: m,
|
|
196
|
-
onAction:
|
|
227
|
+
onAction: a,
|
|
197
228
|
open: f = !1
|
|
198
229
|
}) {
|
|
199
230
|
var h;
|
|
200
|
-
const { isAdmin:
|
|
201
|
-
const
|
|
202
|
-
if (!
|
|
231
|
+
const { isAdmin: b, userId: u } = G(), y = !!u && u.toUpperCase() === n.toUpperCase(), p = ne(n, f), v = Q().roomOf(n), k = ((h = e == null ? void 0 : e.manager_name) == null ? void 0 : h.trim()) || null, i = (() => {
|
|
232
|
+
const w = e == null ? void 0 : e.timezone;
|
|
233
|
+
if (!w) return null;
|
|
203
234
|
try {
|
|
204
|
-
const
|
|
205
|
-
return
|
|
235
|
+
const g = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
236
|
+
return w === g ? null : new Intl.DateTimeFormat(void 0, {
|
|
206
237
|
hour: "numeric",
|
|
207
238
|
minute: "2-digit",
|
|
208
|
-
timeZone:
|
|
239
|
+
timeZone: w
|
|
209
240
|
}).format(/* @__PURE__ */ new Date());
|
|
210
241
|
} catch {
|
|
211
242
|
return null;
|
|
212
243
|
}
|
|
213
|
-
})(),
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
216
|
-
if (
|
|
217
|
-
const
|
|
218
|
-
return
|
|
244
|
+
})(), x = !!c || !!p.word ? p.word ? null : "Just now" : e != null && e.last_access ? (() => {
|
|
245
|
+
const w = Date.now() - new Date(e.last_access).getTime(), g = Math.floor(w / 6e4);
|
|
246
|
+
if (g < 2) return "Just now";
|
|
247
|
+
if (g < 60) return `${g}m ago`;
|
|
248
|
+
const T = Math.floor(g / 60);
|
|
249
|
+
return T < 24 ? `${T}h ago` : `${Math.floor(T / 24)}d ago`;
|
|
219
250
|
})() : null;
|
|
220
251
|
return /* @__PURE__ */ l(
|
|
221
252
|
se,
|
|
@@ -228,25 +259,25 @@ function de({
|
|
|
228
259
|
/* @__PURE__ */ t(
|
|
229
260
|
_,
|
|
230
261
|
{
|
|
231
|
-
userId:
|
|
262
|
+
userId: n,
|
|
232
263
|
className: "h-12 w-12 ring-2 ring-white shadow-sm dark:ring-card",
|
|
233
|
-
fallback: /* @__PURE__ */ t("span", { className: "flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[15px] font-bold text-nvr-navy dark:text-nvr-cyan ring-2 ring-white dark:ring-card shadow-sm", children:
|
|
264
|
+
fallback: /* @__PURE__ */ t("span", { className: "flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[15px] font-bold text-nvr-navy dark:text-nvr-cyan ring-2 ring-white dark:ring-card shadow-sm", children: r })
|
|
234
265
|
}
|
|
235
266
|
),
|
|
236
267
|
/* @__PURE__ */ l("div", { className: "min-w-0 flex-1", children: [
|
|
237
268
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
|
|
238
|
-
(
|
|
269
|
+
(c || p.word) && /* @__PURE__ */ t(
|
|
239
270
|
"span",
|
|
240
271
|
{
|
|
241
|
-
"data-card-presence":
|
|
272
|
+
"data-card-presence": p.word ?? "online",
|
|
242
273
|
className: j(
|
|
243
274
|
"h-2 w-2 shrink-0 rounded-full ring-2 ring-white dark:ring-card",
|
|
244
|
-
|
|
275
|
+
p.word === "away" ? "bg-white ring-amber-400 dark:bg-card" : p.word === "idle" ? "bg-amber-400" : "bg-emerald-400"
|
|
245
276
|
),
|
|
246
|
-
title:
|
|
277
|
+
title: p.word === "away" ? "Away" : p.word === "idle" ? "Idle" : "Online"
|
|
247
278
|
}
|
|
248
279
|
),
|
|
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 :
|
|
280
|
+
/* @__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 : n }),
|
|
250
281
|
(e == null ? void 0 : e.status) && e.status !== "active" && /* @__PURE__ */ t(
|
|
251
282
|
"span",
|
|
252
283
|
{
|
|
@@ -256,24 +287,24 @@ function de({
|
|
|
256
287
|
)
|
|
257
288
|
] }),
|
|
258
289
|
((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
|
-
|
|
290
|
+
p.word && /* @__PURE__ */ l(
|
|
260
291
|
"p",
|
|
261
292
|
{
|
|
262
293
|
className: "mt-0.5 truncate text-[11px] text-slate-500 dark:text-slate-400",
|
|
263
294
|
"data-card-presence-line": !0,
|
|
264
295
|
children: [
|
|
265
|
-
|
|
266
|
-
|
|
296
|
+
p.word === "away" ? "Away" : p.word === "idle" ? `Idle${p.minutes ? ` · ${p.minutes}m` : ""}` : "Online now",
|
|
297
|
+
p.page ? ` · on ${p.page}` : ""
|
|
267
298
|
]
|
|
268
299
|
}
|
|
269
300
|
),
|
|
270
|
-
/* @__PURE__ */ t(
|
|
271
|
-
|
|
301
|
+
/* @__PURE__ */ t(I, { label: (v == null ? void 0 : v.label) ?? null, className: "mt-0.5" }),
|
|
302
|
+
i && /* @__PURE__ */ l("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: [
|
|
272
303
|
"Local time: ",
|
|
273
|
-
|
|
304
|
+
i
|
|
274
305
|
] }),
|
|
275
306
|
(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
|
-
/* @__PURE__ */ t(
|
|
307
|
+
/* @__PURE__ */ t(U, { className: "h-2.5 w-2.5" }),
|
|
277
308
|
" Out of office"
|
|
278
309
|
] }),
|
|
279
310
|
/* @__PURE__ */ t(
|
|
@@ -281,7 +312,7 @@ function de({
|
|
|
281
312
|
{
|
|
282
313
|
email: e == null ? void 0 : e.email,
|
|
283
314
|
enabled: f,
|
|
284
|
-
canClear:
|
|
315
|
+
canClear: b,
|
|
285
316
|
className: "mt-1"
|
|
286
317
|
}
|
|
287
318
|
)
|
|
@@ -294,7 +325,7 @@ function de({
|
|
|
294
325
|
href: `mailto:${e.email}`,
|
|
295
326
|
className: "flex items-center gap-2 text-[12px] text-slate-600 dark:text-slate-300 hover:text-nvr-navy dark:hover:text-nvr-cyan transition-colors truncate group",
|
|
296
327
|
children: [
|
|
297
|
-
/* @__PURE__ */ t(
|
|
328
|
+
/* @__PURE__ */ t(q, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 group-hover:text-nvr-cyan transition-colors" }),
|
|
298
329
|
/* @__PURE__ */ t("span", { className: "truncate", children: e.email })
|
|
299
330
|
]
|
|
300
331
|
}
|
|
@@ -305,30 +336,30 @@ function de({
|
|
|
305
336
|
href: `tel:${e.phone}`,
|
|
306
337
|
className: "flex items-center gap-2 text-[12px] text-slate-600 dark:text-slate-300 hover:text-nvr-navy dark:hover:text-nvr-cyan transition-colors group",
|
|
307
338
|
children: [
|
|
308
|
-
/* @__PURE__ */ t(
|
|
339
|
+
/* @__PURE__ */ t(D, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 group-hover:text-nvr-cyan transition-colors" }),
|
|
309
340
|
/* @__PURE__ */ t("span", { children: e.phone })
|
|
310
341
|
]
|
|
311
342
|
}
|
|
312
343
|
)
|
|
313
344
|
] }),
|
|
314
|
-
((e == null ? void 0 : e.role_name) ||
|
|
345
|
+
((e == null ? void 0 : e.role_name) || k || x) && /* @__PURE__ */ l("div", { className: "px-4 py-3 space-y-1.5 border-b border-slate-100 dark:border-border", children: [
|
|
315
346
|
(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
|
-
/* @__PURE__ */ t(
|
|
347
|
+
/* @__PURE__ */ t(F, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
317
348
|
/* @__PURE__ */ t("span", { children: e.role_name })
|
|
318
349
|
] }),
|
|
319
|
-
|
|
320
|
-
/* @__PURE__ */ t(
|
|
350
|
+
k && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-[11px] text-slate-500 dark:text-slate-400", children: [
|
|
351
|
+
/* @__PURE__ */ t(O, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
321
352
|
/* @__PURE__ */ l("span", { children: [
|
|
322
353
|
"Reports to",
|
|
323
354
|
" ",
|
|
324
|
-
/* @__PURE__ */ t("span", { className: "font-medium text-slate-600 dark:text-slate-300", children:
|
|
355
|
+
/* @__PURE__ */ t("span", { className: "font-medium text-slate-600 dark:text-slate-300", children: k })
|
|
325
356
|
] })
|
|
326
357
|
] }),
|
|
327
|
-
|
|
358
|
+
x && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-[11px] text-slate-400", children: [
|
|
328
359
|
/* @__PURE__ */ t(z, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
329
360
|
/* @__PURE__ */ l("span", { children: [
|
|
330
361
|
"Last seen ",
|
|
331
|
-
|
|
362
|
+
x
|
|
332
363
|
] })
|
|
333
364
|
] })
|
|
334
365
|
] }),
|
|
@@ -338,28 +369,28 @@ function de({
|
|
|
338
369
|
{
|
|
339
370
|
type: "button",
|
|
340
371
|
onClick: () => {
|
|
341
|
-
|
|
372
|
+
a == null || a(), s(d);
|
|
342
373
|
},
|
|
343
374
|
className: "flex flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-2 py-1.5 text-[11px] font-medium text-slate-600 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-accent transition-colors",
|
|
344
375
|
children: [
|
|
345
|
-
/* @__PURE__ */ t(
|
|
376
|
+
/* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" }),
|
|
346
377
|
" View profile"
|
|
347
378
|
]
|
|
348
379
|
}
|
|
349
380
|
),
|
|
350
|
-
|
|
381
|
+
Y() && /* @__PURE__ */ l(
|
|
351
382
|
"button",
|
|
352
383
|
{
|
|
353
384
|
type: "button",
|
|
354
385
|
onClick: () => {
|
|
355
|
-
|
|
356
|
-
|
|
386
|
+
a == null || a(), A(
|
|
387
|
+
n,
|
|
357
388
|
e ? [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email : void 0
|
|
358
389
|
);
|
|
359
390
|
},
|
|
360
391
|
className: "flex flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-2 py-1.5 text-[11px] font-medium text-slate-600 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-accent transition-colors",
|
|
361
392
|
children: [
|
|
362
|
-
/* @__PURE__ */ t(
|
|
393
|
+
/* @__PURE__ */ t(K, { className: "h-3.5 w-3.5" }),
|
|
363
394
|
" Message"
|
|
364
395
|
]
|
|
365
396
|
}
|
|
@@ -369,40 +400,40 @@ function de({
|
|
|
369
400
|
{
|
|
370
401
|
type: "button",
|
|
371
402
|
onClick: () => {
|
|
372
|
-
|
|
403
|
+
a == null || a(), window.location.href = `mailto:${e.email}`;
|
|
373
404
|
},
|
|
374
405
|
className: "flex flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-2 py-1.5 text-[11px] font-medium text-slate-600 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-accent transition-colors",
|
|
375
406
|
children: [
|
|
376
|
-
/* @__PURE__ */ t(
|
|
407
|
+
/* @__PURE__ */ t(W, { className: "h-3.5 w-3.5" }),
|
|
377
408
|
" Email"
|
|
378
409
|
]
|
|
379
410
|
}
|
|
380
411
|
)
|
|
381
412
|
] }),
|
|
382
|
-
|
|
383
|
-
|
|
413
|
+
b && !y && /* @__PURE__ */ t(
|
|
414
|
+
fe,
|
|
384
415
|
{
|
|
385
|
-
userId:
|
|
386
|
-
name: e ? [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email :
|
|
387
|
-
onDone:
|
|
416
|
+
userId: n,
|
|
417
|
+
name: e ? [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email : n,
|
|
418
|
+
onDone: a
|
|
388
419
|
}
|
|
389
420
|
)
|
|
390
421
|
]
|
|
391
422
|
}
|
|
392
423
|
);
|
|
393
424
|
}
|
|
394
|
-
function
|
|
425
|
+
function fe({
|
|
395
426
|
userId: e,
|
|
396
|
-
name:
|
|
397
|
-
onDone:
|
|
427
|
+
name: n,
|
|
428
|
+
onDone: r
|
|
398
429
|
}) {
|
|
399
|
-
const [s, d] =
|
|
400
|
-
|
|
430
|
+
const [s, d] = P(!1);
|
|
431
|
+
$(() => {
|
|
401
432
|
if (!s) return;
|
|
402
433
|
const f = setTimeout(() => d(!1), 4e3);
|
|
403
434
|
return () => clearTimeout(f);
|
|
404
435
|
}, [s]);
|
|
405
|
-
const
|
|
436
|
+
const c = te(e, { onDone: r }), m = ae(e, n, { onDone: r }), a = "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
437
|
return /* @__PURE__ */ l(
|
|
407
438
|
"div",
|
|
408
439
|
{
|
|
@@ -413,17 +444,17 @@ function ce({
|
|
|
413
444
|
"button",
|
|
414
445
|
{
|
|
415
446
|
type: "button",
|
|
416
|
-
disabled:
|
|
417
|
-
onClick: () =>
|
|
447
|
+
disabled: c.isPending,
|
|
448
|
+
onClick: () => c.mutate({}),
|
|
418
449
|
"data-tip": "Every tab they have open shows a 15-second countdown, then reloads",
|
|
419
450
|
className: j(
|
|
420
|
-
|
|
451
|
+
a,
|
|
421
452
|
"text-amber-800 hover:bg-amber-50 dark:text-amber-300 dark:hover:bg-amber-500/10"
|
|
422
453
|
),
|
|
423
454
|
"data-user-card-reload": !0,
|
|
424
455
|
children: [
|
|
425
|
-
/* @__PURE__ */ t(
|
|
426
|
-
|
|
456
|
+
/* @__PURE__ */ t(H, { className: j("h-3.5 w-3.5", c.isPending && "animate-spin") }),
|
|
457
|
+
c.isPending ? "Sending…" : "Reload tabs"
|
|
427
458
|
]
|
|
428
459
|
}
|
|
429
460
|
),
|
|
@@ -435,12 +466,12 @@ function ce({
|
|
|
435
466
|
onClick: () => s ? m.mutate() : d(!0),
|
|
436
467
|
"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
468
|
className: j(
|
|
438
|
-
|
|
469
|
+
a,
|
|
439
470
|
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
471
|
),
|
|
441
472
|
"data-user-card-sign-out": s ? "armed" : "",
|
|
442
473
|
children: [
|
|
443
|
-
/* @__PURE__ */ t(
|
|
474
|
+
/* @__PURE__ */ t(J, { className: "h-3.5 w-3.5" }),
|
|
444
475
|
m.isPending ? "Signing out…" : s ? "Confirm sign out" : "Sign out"
|
|
445
476
|
]
|
|
446
477
|
}
|
|
@@ -449,37 +480,37 @@ function ce({
|
|
|
449
480
|
}
|
|
450
481
|
);
|
|
451
482
|
}
|
|
452
|
-
function
|
|
483
|
+
function xe({
|
|
453
484
|
userId: e,
|
|
454
|
-
size:
|
|
455
|
-
children:
|
|
485
|
+
size: n = "default",
|
|
486
|
+
children: r
|
|
456
487
|
}) {
|
|
457
|
-
const s =
|
|
488
|
+
const s = S(), { navigate: d, userUrl: c } = V(), m = c ? c(e) : `/users/${e}`, [a, f] = P(!1), b = R.useId();
|
|
458
489
|
E(
|
|
459
|
-
|
|
460
|
-
(
|
|
461
|
-
var
|
|
462
|
-
return !!((
|
|
463
|
-
!!((
|
|
490
|
+
a,
|
|
491
|
+
(o) => {
|
|
492
|
+
var x, h, w, g;
|
|
493
|
+
return !!((x = o.closest) != null && x.call(o, `[data-nvr-user-card="${CSS.escape(b)}"]`)) || !!((h = o.closest) != null && h.call(o, `[data-nvr-user-chip="${CSS.escape(b)}"]`)) || // Anything else floating above the card (a tooltip, a nested menu).
|
|
494
|
+
!!((w = o.closest) != null && w.call(o, "[data-radix-popper-content-wrapper]")) && !((g = o.closest) != null && g.call(o, "[data-nvr-user-card]"));
|
|
464
495
|
},
|
|
465
496
|
() => f(!1)
|
|
466
497
|
);
|
|
467
|
-
const { data: u, isLoading: y } =
|
|
468
|
-
...
|
|
498
|
+
const { data: u, isLoading: y } = C({
|
|
499
|
+
...L(s, e),
|
|
469
500
|
enabled: !!s && !!e,
|
|
470
501
|
staleTime: 12e4
|
|
471
|
-
}), { data:
|
|
502
|
+
}), { data: p } = C({
|
|
472
503
|
queryKey: ["user-presence", e],
|
|
473
|
-
queryFn: () => s.request(
|
|
474
|
-
enabled: !!s && !!e &&
|
|
504
|
+
queryFn: () => s.request(B(`/presence/users/${e}`)).then((o) => o),
|
|
505
|
+
enabled: !!s && !!e && a,
|
|
475
506
|
staleTime: 15e3,
|
|
476
|
-
refetchInterval:
|
|
477
|
-
}),
|
|
478
|
-
return y && !
|
|
507
|
+
refetchInterval: a ? 2e4 : !1
|
|
508
|
+
}), v = u ? [u.first_name, u.last_name].filter(Boolean).join(" ") || u.email : e, k = v.split(" ").map((o) => o[0]).filter(Boolean).slice(0, 2).join("").toUpperCase(), i = (p == null ? void 0 : p.online) ?? !1;
|
|
509
|
+
return y && !r ? n === "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
510
|
/* @__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
511
|
/* @__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:
|
|
482
|
-
/* @__PURE__ */ t(le, { asChild: !0, "data-nvr-user-chip":
|
|
512
|
+
] }) : /* @__PURE__ */ l(re, { open: a, onOpenChange: f, children: [
|
|
513
|
+
/* @__PURE__ */ t(le, { asChild: !0, "data-nvr-user-chip": b, children: r || (n === "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
514
|
/* @__PURE__ */ t(
|
|
484
515
|
_,
|
|
485
516
|
{
|
|
@@ -491,12 +522,12 @@ function me({
|
|
|
491
522
|
"data-copy-skip": !0,
|
|
492
523
|
"aria-hidden": "true",
|
|
493
524
|
className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[9px] font-bold text-nvr-navy dark:text-nvr-cyan",
|
|
494
|
-
children:
|
|
525
|
+
children: k
|
|
495
526
|
}
|
|
496
527
|
)
|
|
497
528
|
}
|
|
498
529
|
),
|
|
499
|
-
/* @__PURE__ */ t("span", { className: "text-[11px] font-medium text-slate-600 dark:text-slate-300", children:
|
|
530
|
+
/* @__PURE__ */ t("span", { className: "text-[11px] font-medium text-slate-600 dark:text-slate-300", children: v })
|
|
500
531
|
] }) : /* @__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
532
|
/* @__PURE__ */ t(
|
|
502
533
|
_,
|
|
@@ -509,33 +540,35 @@ function me({
|
|
|
509
540
|
"data-copy-skip": !0,
|
|
510
541
|
"aria-hidden": "true",
|
|
511
542
|
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",
|
|
512
|
-
children:
|
|
543
|
+
children: k
|
|
513
544
|
}
|
|
514
545
|
)
|
|
515
546
|
}
|
|
516
547
|
),
|
|
517
|
-
/* @__PURE__ */ t("span", { className: "text-[12px] text-slate-700 dark:text-slate-300", children:
|
|
548
|
+
/* @__PURE__ */ t("span", { className: "text-[12px] text-slate-700 dark:text-slate-300", children: v })
|
|
518
549
|
] })) }),
|
|
519
550
|
/* @__PURE__ */ t(
|
|
520
|
-
|
|
551
|
+
pe,
|
|
521
552
|
{
|
|
522
553
|
user: u,
|
|
523
554
|
userId: e,
|
|
524
|
-
initials:
|
|
555
|
+
initials: k,
|
|
525
556
|
navigate: d,
|
|
526
557
|
profileUrl: m,
|
|
527
|
-
online:
|
|
528
|
-
cardId:
|
|
558
|
+
online: i,
|
|
559
|
+
cardId: b,
|
|
529
560
|
onAction: () => f(!1),
|
|
530
|
-
open:
|
|
561
|
+
open: a
|
|
531
562
|
}
|
|
532
563
|
)
|
|
533
564
|
] });
|
|
534
565
|
}
|
|
535
566
|
export {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
567
|
+
Be as OwnersInline,
|
|
568
|
+
$e as OwnersInlineCompact,
|
|
569
|
+
fe as UserCardAdminRow,
|
|
570
|
+
xe as UserChip,
|
|
571
|
+
ce as UserRosterCluster,
|
|
572
|
+
ie as rosterInitials,
|
|
573
|
+
oe as rosterName
|
|
541
574
|
};
|