@nivaro/react 0.3.85 → 0.3.87

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.
@@ -1,26 +1,26 @@
1
1
  import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
2
  import { useQuery as _ } from "@tanstack/react-query";
3
- import { UserCheck as q, Mail as D, Phone as F, Building2 as z, User as T, Clock as K, MessageCircle as W, ExternalLink as H, RefreshCw as J, LogOut as Z } from "lucide-react";
4
- import M, { useState as j, useRef as C, useEffect as R } from "react";
5
- import { createPortal as V } from "react-dom";
6
- import { useOptionalNivaroClient as O, useNavigation as G, useItemEditAuth as X } from "../../context.js";
3
+ import { UserCheck as q, Mail as D, Phone as F, Building2 as z, User as O, Clock as K, MessageCircle as W, ExternalLink as H, RefreshCw as J, LogOut as Z } from "lucide-react";
4
+ import R, { useState as S, useRef as C, useEffect as L } from "react";
5
+ import { createPortal as G } from "react-dom";
6
+ import { useOptionalNivaroClient as M, useNavigation as V, useItemEditAuth as X } from "../../context.js";
7
7
  import { get as $, post as Y } from "../../lib/commands.js";
8
8
  import { userCardQuery as B } from "../../lib/user-cards.js";
9
- import { cn as S } from "../../lib/utils.js";
9
+ import { cn as P } from "../../lib/utils.js";
10
10
  import { canOpenDm as I, openDmWith as A } from "../chat/chat-core.js";
11
11
  import { HuddlePresenceLine as Q } from "../chat/huddle/HuddleLiveBadge.js";
12
12
  import { useHuddleLive as ee } from "../chat/huddle/huddle-live.js";
13
13
  import { MailSuppressedPill as te } from "../profile/MailSuppressedPill.js";
14
14
  import { SignOutMessageInput as ae } from "../profile/SignOutMessageInput.js";
15
- import { useReloadTheirTabs as ne, useSignOutEverywhere as re } from "../profile/session-actions.js";
16
- import { useCardPresence as le } from "../profile/usePersonPresence.js";
17
- import { UserAvatar as P } from "../UserAvatar.js";
18
- import { Popover as se, PopoverTrigger as ie, PopoverContent as oe } from "../ui/popover.js";
15
+ import { SIGN_OUT_ARM_MS as ne, useReloadTheirTabs as re, useSignOutEverywhere as le } from "../profile/session-actions.js";
16
+ import { useCardPresence as se } from "../profile/usePersonPresence.js";
17
+ import { UserAvatar as j } from "../UserAvatar.js";
18
+ import { Popover as ie, PopoverTrigger as oe, PopoverContent as de } from "../ui/popover.js";
19
19
  function E(e, n, i) {
20
20
  const s = C(n);
21
21
  s.current = n;
22
22
  const d = C(i);
23
- d.current = i, R(() => {
23
+ d.current = i, L(() => {
24
24
  if (!e) return;
25
25
  const o = (r) => {
26
26
  const p = r.target;
@@ -31,51 +31,51 @@ function E(e, n, i) {
31
31
  };
32
32
  }, [e]);
33
33
  }
34
- function de(e) {
34
+ function ce(e) {
35
35
  const n = String(e ?? "").trim();
36
36
  return !n || /^redacted\b/i.test(n) ? "" : n.split(/\s+/).map((i) => i[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
37
37
  }
38
- function ce(e, n) {
38
+ function me(e, n) {
39
39
  const i = String(e ?? "").trim();
40
40
  return i || [n == null ? void 0 : n.first_name, n == null ? void 0 : n.last_name].filter(Boolean).join(" ").trim();
41
41
  }
42
- function me({
42
+ function pe({
43
43
  user: e,
44
44
  avatarCls: n
45
45
  }) {
46
- const i = O(), { data: s } = _({
46
+ const i = M(), { data: s } = _({
47
47
  ...B(i, e.id),
48
48
  enabled: !!i && !!e.id && !String(e.name ?? "").trim(),
49
49
  staleTime: 30 * 6e4,
50
50
  retry: !1
51
- }), d = ce(e.name, s), o = de(d), m = /^redacted\b/i.test(d);
51
+ }), d = me(e.name, s), o = ce(d), m = /^redacted\b/i.test(d);
52
52
  return /* @__PURE__ */ t(
53
53
  "span",
54
54
  {
55
55
  className: "inline-flex",
56
56
  "data-tip": m ? "Former user (account redacted)" : d || void 0,
57
57
  children: /* @__PURE__ */ t(
58
- P,
58
+ j,
59
59
  {
60
60
  userId: e.id,
61
61
  className: "h-6 w-6 border-2 border-white dark:border-slate-900",
62
- fallback: /* @__PURE__ */ t("span", { "data-copy-skip": !0, "aria-hidden": "true", className: n, children: o || /* @__PURE__ */ t(T, { className: "h-3 w-3", "aria-hidden": !0 }) })
62
+ fallback: /* @__PURE__ */ t("span", { "data-copy-skip": !0, "aria-hidden": "true", className: n, children: o || /* @__PURE__ */ t(O, { className: "h-3 w-3", "aria-hidden": !0 }) })
63
63
  }
64
64
  )
65
65
  }
66
66
  );
67
67
  }
68
- function pe(e) {
68
+ function fe(e) {
69
69
  if (e.length === 0) return null;
70
70
  const n = e.find((i) => !i.inactive) ?? e[0];
71
71
  return { name: n.name, more: e.length - 1, mark: n.inactive ?? null };
72
72
  }
73
- function fe({
73
+ function xe({
74
74
  users: e,
75
75
  showSingleName: n = !0,
76
76
  nameLabel: i = !1
77
77
  }) {
78
- const s = C(null), d = C(null), o = C(null), [m, r] = j(null), [p, g] = j({ x: 0, y: 0 }), h = () => {
78
+ const s = C(null), d = C(null), o = C(null), [m, r] = S(null), [p, g] = S({ x: 0, y: 0 }), h = () => {
79
79
  o.current && clearTimeout(o.current), o.current = null;
80
80
  }, k = (a) => {
81
81
  var b;
@@ -85,7 +85,7 @@ function fe({
85
85
  }, c = () => {
86
86
  h(), o.current = setTimeout(() => r((a) => a === "pin" ? a : null), 160);
87
87
  };
88
- if (M.useLayoutEffect(() => {
88
+ if (R.useLayoutEffect(() => {
89
89
  var u;
90
90
  if (!m) return;
91
91
  const a = d.current;
@@ -122,13 +122,13 @@ function fe({
122
122
  },
123
123
  className: "inline-flex cursor-pointer items-center",
124
124
  children: [
125
- /* @__PURE__ */ t("span", { className: "flex -space-x-2", children: w.map((a) => /* @__PURE__ */ t(me, { user: a, avatarCls: N }, a.id)) }),
125
+ /* @__PURE__ */ t("span", { className: "flex -space-x-2", children: w.map((a) => /* @__PURE__ */ t(pe, { user: a, avatarCls: N }, a.id)) }),
126
126
  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: [
127
127
  "+",
128
128
  v
129
129
  ] }),
130
130
  i ? (() => {
131
- const a = pe(e);
131
+ const a = fe(e);
132
132
  return a ? /* @__PURE__ */ l(
133
133
  "span",
134
134
  {
@@ -136,7 +136,7 @@ function fe({
136
136
  className: "ml-1.5 inline-flex max-w-[170px] items-baseline gap-1 text-[12px] font-medium text-slate-700 dark:text-slate-200",
137
137
  children: [
138
138
  /* @__PURE__ */ t("span", { className: "truncate", children: a.name }),
139
- a.mark && /* @__PURE__ */ t(L, { mark: a.mark }),
139
+ a.mark && /* @__PURE__ */ t(T, { mark: a.mark }),
140
140
  a.more > 0 && /* @__PURE__ */ l("span", { className: "shrink-0 text-slate-500 dark:text-slate-400", children: [
141
141
  "+",
142
142
  a.more
@@ -145,12 +145,12 @@ function fe({
145
145
  }
146
146
  ) : null;
147
147
  })() : 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 }),
148
- m && V(
148
+ m && G(
149
149
  /* @__PURE__ */ l(
150
150
  "div",
151
151
  {
152
152
  ref: d,
153
- style: xe(s.current, p),
153
+ style: he(s.current, p),
154
154
  onMouseEnter: h,
155
155
  onMouseLeave: c,
156
156
  onMouseDown: (a) => {
@@ -165,8 +165,8 @@ function fe({
165
165
  e.length === 1 ? "" : "s"
166
166
  ] }),
167
167
  e.map((a) => /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5 px-2 py-0.5", children: [
168
- /* @__PURE__ */ t(ge, { userId: a.id, size: "compact" }),
169
- a.inactive && /* @__PURE__ */ t(L, { mark: a.inactive })
168
+ /* @__PURE__ */ t(ue, { userId: a.id, size: "compact" }),
169
+ a.inactive && /* @__PURE__ */ t(T, { mark: a.inactive })
170
170
  ] }, a.id))
171
171
  ]
172
172
  }
@@ -177,7 +177,7 @@ function fe({
177
177
  }
178
178
  );
179
179
  }
180
- function L({ mark: e }) {
180
+ function T({ mark: e }) {
181
181
  return /* @__PURE__ */ t(
182
182
  "span",
183
183
  {
@@ -190,17 +190,17 @@ function L({ mark: e }) {
190
190
  function U(e) {
191
191
  return (e == null ? void 0 : e.closest('[role="dialog"]')) ?? document.body;
192
192
  }
193
- function xe(e, n) {
193
+ function he(e, n) {
194
194
  const i = U(e);
195
195
  if (i === document.body) return { position: "fixed", left: n.x, top: n.y, zIndex: 50 };
196
196
  const s = i.getBoundingClientRect();
197
197
  return { position: "absolute", left: n.x - s.left, top: n.y - s.top, zIndex: 120 };
198
198
  }
199
- function Ee({
199
+ function Ue({
200
200
  collection: e,
201
201
  itemId: n
202
202
  }) {
203
- const i = O(), {
203
+ const i = M(), {
204
204
  data: s = [],
205
205
  isLoading: d,
206
206
  isFetching: o
@@ -216,14 +216,14 @@ function Ee({
216
216
  // blank for ~2 s after Submit) — never another record's (b01-N15).
217
217
  placeholderData: (m, r) => (r == null ? void 0 : r.queryKey[1]) === e && String(r == null ? void 0 : r.queryKey[2]) === String(n) ? m : void 0
218
218
  });
219
- return d || o && 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(fe, { users: s, nameLabel: !0 });
219
+ return d || o && 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(xe, { users: s, nameLabel: !0 });
220
220
  }
221
- function Ue({
221
+ function qe({
222
222
  collection: e,
223
223
  itemId: n,
224
224
  label: i
225
225
  }) {
226
- const s = O(), { data: d = [] } = _({
226
+ const s = M(), { data: d = [] } = _({
227
227
  queryKey: ["pipeline-instance-owners", e, n],
228
228
  queryFn: () => s.request($(`/pipelines/instance/${e}/${n}/owners`)).then((r) => r.data ?? []),
229
229
  enabled: !!s && !!e && !!n && n !== "new",
@@ -237,7 +237,7 @@ function Ue({
237
237
  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",
238
238
  children: [
239
239
  /* @__PURE__ */ t(
240
- P,
240
+ j,
241
241
  {
242
242
  userId: r.id,
243
243
  className: "h-6 w-6",
@@ -251,7 +251,7 @@ function Ue({
251
251
  )) })
252
252
  ] });
253
253
  }
254
- function he({
254
+ function be({
255
255
  user: e,
256
256
  userId: n,
257
257
  initials: i,
@@ -263,7 +263,7 @@ function he({
263
263
  open: p = !1
264
264
  }) {
265
265
  var b;
266
- const { isAdmin: g, userId: h } = X(), k = !!h && h.toUpperCase() === n.toUpperCase(), c = le(n, p), w = ee().roomOf(n), v = ((b = e == null ? void 0 : e.manager_name) == null ? void 0 : b.trim()) || null, N = (() => {
266
+ const { isAdmin: g, userId: h } = X(), k = !!h && h.toUpperCase() === n.toUpperCase(), c = se(n, p), w = ee().roomOf(n), v = ((b = e == null ? void 0 : e.manager_name) == null ? void 0 : b.trim()) || null, N = (() => {
267
267
  const x = e == null ? void 0 : e.timezone;
268
268
  if (!x) return null;
269
269
  try {
@@ -284,7 +284,7 @@ function he({
284
284
  return y < 24 ? `${y}h ago` : `${Math.floor(y / 24)}d ago`;
285
285
  })() : null;
286
286
  return /* @__PURE__ */ l(
287
- oe,
287
+ de,
288
288
  {
289
289
  align: "start",
290
290
  className: "w-72 p-0 overflow-hidden",
@@ -292,7 +292,7 @@ function he({
292
292
  children: [
293
293
  /* @__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: [
294
294
  /* @__PURE__ */ t(
295
- P,
295
+ j,
296
296
  {
297
297
  userId: n,
298
298
  className: "h-12 w-12 ring-2 ring-white shadow-sm dark:ring-card",
@@ -305,7 +305,7 @@ function he({
305
305
  "span",
306
306
  {
307
307
  "data-card-presence": c.word ?? "online",
308
- className: S(
308
+ className: P(
309
309
  "h-2 w-2 shrink-0 rounded-full ring-2 ring-white dark:ring-card",
310
310
  c.word === "away" ? "bg-white ring-amber-400 dark:bg-card" : c.word === "idle" ? "bg-amber-400" : "bg-emerald-400"
311
311
  ),
@@ -383,7 +383,7 @@ function he({
383
383
  /* @__PURE__ */ t("span", { children: e.role_name })
384
384
  ] }),
385
385
  v && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-[11px] text-slate-500 dark:text-slate-400", children: [
386
- /* @__PURE__ */ t(T, { className: "h-3.5 w-3.5 shrink-0" }),
386
+ /* @__PURE__ */ t(O, { className: "h-3.5 w-3.5 shrink-0" }),
387
387
  /* @__PURE__ */ l("span", { children: [
388
388
  "Reports to",
389
389
  " ",
@@ -408,7 +408,7 @@ function he({
408
408
  },
409
409
  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",
410
410
  children: [
411
- /* @__PURE__ */ t(T, { className: "h-3.5 w-3.5" }),
411
+ /* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" }),
412
412
  " View profile"
413
413
  ]
414
414
  }
@@ -446,7 +446,7 @@ function he({
446
446
  )
447
447
  ] }),
448
448
  g && !k && /* @__PURE__ */ t(
449
- be,
449
+ ge,
450
450
  {
451
451
  userId: n,
452
452
  name: e ? [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email : n,
@@ -457,18 +457,18 @@ function he({
457
457
  }
458
458
  );
459
459
  }
460
- function be({
460
+ function ge({
461
461
  userId: e,
462
462
  name: n,
463
463
  onDone: i
464
464
  }) {
465
- const [s, d] = j(!1), [o, m] = j("");
466
- R(() => {
465
+ const [s, d] = S(!1), [o, m] = S("");
466
+ L(() => {
467
467
  if (!s || o.trim()) return;
468
- const k = setTimeout(() => d(!1), 1e4);
468
+ const k = setTimeout(() => d(!1), ne);
469
469
  return () => clearTimeout(k);
470
470
  }, [s, o]);
471
- const r = ne(e, { onDone: i }), p = re(e, n, { onDone: i }), g = () => p.mutate({ message: o }), h = "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";
471
+ const r = re(e, { onDone: i }), p = le(e, n, { onDone: i }), g = () => p.mutate({ message: o }), h = "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";
472
472
  return /* @__PURE__ */ l("div", { className: "border-t border-slate-100 p-2 dark:border-border", "data-user-card-admin": !0, children: [
473
473
  /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
474
474
  /* @__PURE__ */ l(
@@ -478,13 +478,13 @@ function be({
478
478
  disabled: r.isPending,
479
479
  onClick: () => r.mutate({}),
480
480
  "data-tip": "Every tab they have open shows a 15-second countdown, then reloads",
481
- className: S(
481
+ className: P(
482
482
  h,
483
483
  "text-amber-800 hover:bg-amber-50 dark:text-amber-300 dark:hover:bg-amber-500/10"
484
484
  ),
485
485
  "data-user-card-reload": !0,
486
486
  children: [
487
- /* @__PURE__ */ t(J, { className: S("h-3.5 w-3.5", r.isPending && "animate-spin") }),
487
+ /* @__PURE__ */ t(J, { className: P("h-3.5 w-3.5", r.isPending && "animate-spin") }),
488
488
  r.isPending ? "Sending…" : "Reload tabs"
489
489
  ]
490
490
  }
@@ -496,7 +496,7 @@ function be({
496
496
  disabled: p.isPending,
497
497
  onClick: () => s ? g() : d(!0),
498
498
  "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",
499
- className: S(
499
+ className: P(
500
500
  h,
501
501
  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"
502
502
  ),
@@ -519,12 +519,12 @@ function be({
519
519
  )
520
520
  ] });
521
521
  }
522
- function ge({
522
+ function ue({
523
523
  userId: e,
524
524
  size: n = "default",
525
525
  children: i
526
526
  }) {
527
- const s = O(), { navigate: d, userUrl: o } = G(), m = o ? o(e) : `/users/${e}`, [r, p] = j(!1), g = M.useId();
527
+ const s = M(), { navigate: d, userUrl: o } = V(), m = o ? o(e) : `/users/${e}`, [r, p] = S(!1), g = R.useId();
528
528
  E(
529
529
  r,
530
530
  (a) => {
@@ -548,10 +548,10 @@ function ge({
548
548
  return k && !i ? 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: [
549
549
  /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 rounded-full animate-pulse bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }),
550
550
  /* @__PURE__ */ t("span", { className: "animate-pulse h-2.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" })
551
- ] }) : /* @__PURE__ */ l(se, { open: r, onOpenChange: p, children: [
552
- /* @__PURE__ */ t(ie, { asChild: !0, "data-nvr-user-chip": g, children: i || (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: [
551
+ ] }) : /* @__PURE__ */ l(ie, { open: r, onOpenChange: p, children: [
552
+ /* @__PURE__ */ t(oe, { asChild: !0, "data-nvr-user-chip": g, children: i || (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: [
553
553
  /* @__PURE__ */ t(
554
- P,
554
+ j,
555
555
  {
556
556
  userId: e,
557
557
  className: "h-4 w-4",
@@ -569,7 +569,7 @@ function ge({
569
569
  /* @__PURE__ */ t("span", { className: "text-[11px] font-medium text-slate-600 dark:text-slate-300", children: w })
570
570
  ] }) : /* @__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: [
571
571
  /* @__PURE__ */ t(
572
- P,
572
+ j,
573
573
  {
574
574
  userId: e,
575
575
  className: "h-6 w-6",
@@ -587,7 +587,7 @@ function ge({
587
587
  /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-700 dark:text-slate-300", children: w })
588
588
  ] })) }),
589
589
  /* @__PURE__ */ t(
590
- he,
590
+ be,
591
591
  {
592
592
  user: h,
593
593
  userId: e,
@@ -603,12 +603,12 @@ function ge({
603
603
  ] });
604
604
  }
605
605
  export {
606
- Ue as OwnersInline,
607
- Ee as OwnersInlineCompact,
608
- be as UserCardAdminRow,
609
- ge as UserChip,
610
- fe as UserRosterCluster,
611
- de as rosterInitials,
612
- pe as rosterLabel,
613
- ce as rosterName
606
+ qe as OwnersInline,
607
+ Ue as OwnersInlineCompact,
608
+ ge as UserCardAdminRow,
609
+ ue as UserChip,
610
+ xe as UserRosterCluster,
611
+ ce as rosterInitials,
612
+ fe as rosterLabel,
613
+ me as rosterName
614
614
  };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as n, jsx as e, Fragment as T } from "react/jsx-runtime";
2
2
  import { useMutation as y, useQuery as q } from "@tanstack/react-query";
3
- import { RefreshCw as F, LogOut as M, GitMerge as U, UserMinus as H } from "lucide-react";
3
+ import { RefreshCw as E, LogOut as F, GitMerge as U, UserMinus as H } from "lucide-react";
4
4
  import { useState as u, useEffect as K } from "react";
5
5
  import { toast as x } from "sonner";
6
6
  import { useNivaroClient as C } from "../../context.js";
@@ -8,14 +8,14 @@ import { post as N, get as j } from "../../lib/commands.js";
8
8
  import { cn as O } from "../../lib/utils.js";
9
9
  import { SectionCard as f, EmptyLine as R } from "./primitives.js";
10
10
  import { SignOutMessageInput as Q } from "./SignOutMessageInput.js";
11
- import { useReloadTheirTabs as z, useSignOutEverywhere as J } from "./session-actions.js";
12
- import { useInvalidatePerson as $, errorText as _ } from "./types.js";
13
- function de({ profile: i }) {
11
+ import { useReloadTheirTabs as z, SIGN_OUT_ARM_MS as J, useSignOutEverywhere as V } from "./session-actions.js";
12
+ import { useInvalidatePerson as A, errorText as _ } from "./types.js";
13
+ function le({ profile: i }) {
14
14
  const [c, l] = u("15"), [t, p] = u(""), s = z(i.id);
15
15
  return /* @__PURE__ */ n(
16
16
  f,
17
17
  {
18
- icon: /* @__PURE__ */ e(F, { className: "h-4 w-4" }),
18
+ icon: /* @__PURE__ */ e(E, { className: "h-4 w-4" }),
19
19
  title: "Force a reload",
20
20
  hint: "Every tab they have open shows a countdown, then reloads onto the current build",
21
21
  tone: "danger",
@@ -52,7 +52,7 @@ function de({ profile: i }) {
52
52
  onClick: () => s.mutate({ seconds: Number(c) || 15, message: t }),
53
53
  className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-amber-300 px-2.5 text-[11.5px] font-medium text-amber-800 transition-colors hover:bg-amber-50 disabled:opacity-50 dark:border-amber-500/40 dark:text-amber-300 dark:hover:bg-amber-500/10",
54
54
  children: [
55
- /* @__PURE__ */ e(F, { className: O("h-3 w-3", s.isPending && "animate-spin") }),
55
+ /* @__PURE__ */ e(E, { className: O("h-3 w-3", s.isPending && "animate-spin") }),
56
56
  s.isPending ? "Sending…" : "Reload their tabs"
57
57
  ]
58
58
  }
@@ -63,14 +63,14 @@ function de({ profile: i }) {
63
63
  }
64
64
  );
65
65
  }
66
- function le({ profile: i }) {
66
+ function ce({ profile: i }) {
67
67
  const c = [i.first_name, i.last_name].filter(Boolean).join(" ") || i.email || "They", [l, t] = u(!1), [p, s] = u("");
68
68
  K(() => {
69
69
  if (!l || p.trim()) return;
70
- const a = setTimeout(() => t(!1), 1e4);
70
+ const a = setTimeout(() => t(!1), J);
71
71
  return () => clearTimeout(a);
72
72
  }, [l, p]);
73
- const d = J(i.id, c, {
73
+ const d = V(i.id, c, {
74
74
  onDone: () => {
75
75
  t(!1), s("");
76
76
  }
@@ -78,7 +78,7 @@ function le({ profile: i }) {
78
78
  return /* @__PURE__ */ n(
79
79
  f,
80
80
  {
81
- icon: /* @__PURE__ */ e(M, { className: "h-4 w-4" }),
81
+ icon: /* @__PURE__ */ e(F, { className: "h-4 w-4" }),
82
82
  title: "Sign out everywhere",
83
83
  hint: "Ends every session they have, on every app — each open tab goes back to sign-in",
84
84
  tone: "danger",
@@ -99,7 +99,7 @@ function le({ profile: i }) {
99
99
  l ? "border-red-600 bg-red-600 text-white hover:bg-red-700" : "border-amber-300 text-amber-800 hover:bg-amber-50 dark:border-amber-500/40 dark:text-amber-300 dark:hover:bg-amber-500/10"
100
100
  ),
101
101
  children: [
102
- /* @__PURE__ */ e(M, { className: "h-3 w-3" }),
102
+ /* @__PURE__ */ e(F, { className: "h-3 w-3" }),
103
103
  d.isPending ? "Signing out…" : l ? "Confirm sign out" : "Sign them out"
104
104
  ]
105
105
  }
@@ -118,7 +118,7 @@ function le({ profile: i }) {
118
118
  }
119
119
  );
120
120
  }
121
- function A({
121
+ function $({
122
122
  excludeId: i,
123
123
  value: c,
124
124
  label: l,
@@ -180,7 +180,7 @@ const I = {
180
180
  direct_reports: "Direct reports",
181
181
  notification_subscriptions: "Notification subscriptions",
182
182
  field_watches: "Field watches"
183
- }, V = {
183
+ }, W = {
184
184
  queue_claims: "queue_claims",
185
185
  instance_ownerships: "instance_ownerships",
186
186
  open_tasks: "open_tasks",
@@ -190,8 +190,8 @@ const I = {
190
190
  notification_subscriptions: "notification_subscriptions",
191
191
  field_watches: "notification_subscriptions"
192
192
  };
193
- function ce({ profile: i }) {
194
- const c = C(), l = $(i.id), [t, p] = u(null), [s, d] = u({}), [h, a] = u(!0), [m, g] = u(null), { data: o, refetch: v } = q({
193
+ function me({ profile: i }) {
194
+ const c = C(), l = A(i.id), [t, p] = u(null), [s, d] = u({}), [h, a] = u(!0), [m, g] = u(null), { data: o, refetch: v } = q({
195
195
  queryKey: ["nvr-offboarding", i.id],
196
196
  queryFn: () => c.request(j(`/offboarding/${i.id}`)).then((r) => r.data)
197
197
  }), w = y({
@@ -213,10 +213,10 @@ function ce({ profile: i }) {
213
213
  testId: "offboarding",
214
214
  children: o ? /* @__PURE__ */ n("div", { className: "space-y-3", children: [
215
215
  /* @__PURE__ */ e("div", { className: "grid gap-x-6 gap-y-1 sm:grid-cols-2", children: Object.entries(o.holdings).map(([r, b]) => {
216
- const k = V[r], P = O(
216
+ const k = W[r], P = O(
217
217
  "flex items-center gap-2 text-[12.5px]",
218
218
  b === 0 ? "text-slate-300 dark:text-slate-600" : "text-slate-700 dark:text-slate-200"
219
- ), E = /* @__PURE__ */ n(T, { children: [
219
+ ), M = /* @__PURE__ */ n(T, { children: [
220
220
  /* @__PURE__ */ e("span", { className: "flex-1", children: I[r] ?? r }),
221
221
  /* @__PURE__ */ e("span", { className: "font-semibold tabular-nums", children: b })
222
222
  ] });
@@ -227,19 +227,19 @@ function ce({ profile: i }) {
227
227
  type: "checkbox",
228
228
  checked: s[k] !== !1,
229
229
  disabled: b === 0,
230
- onChange: (B) => d((G) => ({ ...G, [k]: B.target.checked })),
230
+ onChange: (G) => d((B) => ({ ...B, [k]: G.target.checked })),
231
231
  className: "h-3.5 w-3.5"
232
232
  }
233
233
  ),
234
- E
234
+ M
235
235
  ] }, r) : /* @__PURE__ */ n("div", { className: P, children: [
236
236
  /* @__PURE__ */ e("span", { className: "w-3.5" }),
237
- E
237
+ M
238
238
  ] }, r);
239
239
  }) }),
240
240
  D === 0 ? /* @__PURE__ */ e(R, { children: "Nothing to hand over — this account holds no work." }) : /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2.5", children: [
241
241
  /* @__PURE__ */ e(
242
- A,
242
+ $,
243
243
  {
244
244
  excludeId: i.id,
245
245
  value: t,
@@ -290,8 +290,8 @@ function ce({ profile: i }) {
290
290
  }
291
291
  );
292
292
  }
293
- function me({ profile: i }) {
294
- const c = C(), l = $(i.id), [t, p] = u(null), [s, d] = u(null), [h, a] = u(""), m = y({
293
+ function ue({ profile: i }) {
294
+ const c = C(), l = A(i.id), [t, p] = u(null), [s, d] = u(null), [h, a] = u(""), m = y({
295
295
  mutationFn: () => c.request(
296
296
  N(`/offboarding/${i.id}/merge`, { into: t == null ? void 0 : t.id, dry_run: !0 })
297
297
  ).then((o) => o.data),
@@ -315,7 +315,7 @@ function me({ profile: i }) {
315
315
  children: /* @__PURE__ */ n("div", { className: "space-y-3", children: [
316
316
  /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2.5", children: [
317
317
  /* @__PURE__ */ e(
318
- A,
318
+ $,
319
319
  {
320
320
  excludeId: i.id,
321
321
  value: t,
@@ -376,9 +376,9 @@ function me({ profile: i }) {
376
376
  );
377
377
  }
378
378
  export {
379
- de as ForceReloadCard,
380
- me as MergeCard,
381
- ce as OffboardingCard,
382
- le as SignOutEverywhereCard,
383
- A as UserPicker
379
+ le as ForceReloadCard,
380
+ ue as MergeCard,
381
+ me as OffboardingCard,
382
+ ce as SignOutEverywhereCard,
383
+ $ as UserPicker
384
384
  };
@@ -7,10 +7,11 @@ function h(e) {
7
7
  const o = e.remembered ? ` Tabs that connect in the next ${e.remember_hours ?? 24} h reload too.` : "", n = typeof e.tabs == "number" && e.sockets > 0 ? Math.max(1, e.tabs) : e.sockets;
8
8
  return (n > 0 ? `Reload pushed to ${n} open tab${n === 1 ? "" : "s"}${e.partial ? " (another server did not answer — there may be more)" : ""}.` : e.partial ? "Reload sent — another server did not answer, so their open tabs could not be counted." : e.nodes != null ? "Reload sent — they have no tab open right now." : "Reload sent to every tab they have open (tabs on other servers are not counted).") + o;
9
9
  }
10
+ const y = 3e4;
10
11
  function l(e, o) {
11
12
  return o > 0 ? `${e} is signed out of ${o} session${o === 1 ? "" : "s"} — every open tab goes back to sign-in.` : `${e} had no session open.`;
12
13
  }
13
- function y(e, o = {}) {
14
+ function $(e, o = {}) {
14
15
  const n = u();
15
16
  return i({
16
17
  mutationFn: (s = {}) => {
@@ -30,7 +31,7 @@ function y(e, o = {}) {
30
31
  onError: (s) => a.error(m(s, "Failed to push the reload"))
31
32
  });
32
33
  }
33
- function $(e, o, n = {}) {
34
+ function T(e, o, n = {}) {
34
35
  const s = u();
35
36
  return i({
36
37
  // `message` (optional): shown to them on their sign-in page (sign-out-note).
@@ -51,8 +52,9 @@ function $(e, o, n = {}) {
51
52
  });
52
53
  }
53
54
  export {
55
+ y as SIGN_OUT_ARM_MS,
54
56
  h as reloadPushedText,
55
57
  l as signedOutText,
56
- y as useReloadTheirTabs,
57
- $ as useSignOutEverywhere
58
+ $ as useReloadTheirTabs,
59
+ T as useSignOutEverywhere
58
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.85",
3
+ "version": "0.3.87",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",