@nivaro/react 0.3.137 → 0.3.138

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.
Files changed (49) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +95 -4
  4. package/dist/index.js +748 -743
  5. package/dist/shared/components/CollectionBrowserView.js +392 -389
  6. package/dist/shared/components/DelegateCoverLine.js +80 -87
  7. package/dist/shared/components/ItemEditForm.js +589 -588
  8. package/dist/shared/components/MyWorkView.js +284 -286
  9. package/dist/shared/components/NotificationBell.js +251 -205
  10. package/dist/shared/components/ai/AiAnalyticsView.js +878 -417
  11. package/dist/shared/components/ai/AiPlanCard.js +164 -122
  12. package/dist/shared/components/ai/AiPlanUndo.js +291 -0
  13. package/dist/shared/components/ai/call-log/CallDrawer.js +357 -0
  14. package/dist/shared/components/ai/call-log/RawJson.js +126 -0
  15. package/dist/shared/components/ai/call-log/ThreadView.js +223 -0
  16. package/dist/shared/components/ai/call-log/TranscriptView.js +227 -0
  17. package/dist/shared/components/ai/call-log/controls.js +364 -0
  18. package/dist/shared/components/ai/call-log/format.js +46 -0
  19. package/dist/shared/components/ai/call-log/url.js +105 -0
  20. package/dist/shared/components/chat/chat-core.js +422 -346
  21. package/dist/shared/components/integrations/IntegrationObligationsView.js +98 -98
  22. package/dist/shared/components/integrations/RecordIntegrationPreview.js +102 -93
  23. package/dist/shared/components/integrations/console/api.js +11 -1
  24. package/dist/shared/components/item-edit/HeaderRollupExplainer.js +5 -1
  25. package/dist/shared/components/item-edit/RecordLiveSync.js +241 -229
  26. package/dist/shared/components/item-edit/RecordRecapChanges.js +166 -0
  27. package/dist/shared/components/item-edit/RecordRecapStrip.js +254 -84
  28. package/dist/shared/components/item-edit/live-related.js +34 -18
  29. package/dist/shared/components/panels/RevisionsPanel.js +735 -683
  30. package/dist/shared/components/queue/QueueWorklist.js +323 -316
  31. package/dist/shared/components/support/SupportRequestDialog.js +198 -181
  32. package/dist/shared/components/trackers/use-tracker-link.js +74 -65
  33. package/dist/shared/lib/config-update-refresh.js +34 -0
  34. package/dist/shared/lib/config-watch.js +17 -17
  35. package/dist/shared/lib/gap-refresh.js +49 -0
  36. package/dist/shared/lib/integration-dots.js +8 -8
  37. package/dist/shared/lib/live-ops.js +26 -23
  38. package/dist/shared/lib/live-pickers.js +1 -1
  39. package/dist/shared/lib/live-queries.js +223 -195
  40. package/dist/shared/lib/live.js +56 -51
  41. package/dist/shared/lib/obligation-banner.js +11 -10
  42. package/dist/shared/lib/obligation-filters.js +22 -18
  43. package/dist/shared/lib/obligation-reason-text.js +18 -8
  44. package/dist/shared/lib/presence-hooks.js +133 -132
  45. package/dist/shared/lib/reconnect-resync.js +90 -0
  46. package/dist/shared/lib/record-room-holds.js +43 -0
  47. package/dist/shared/lib/socket-realtime.js +116 -105
  48. package/dist/shared/lib/user-sync.js +1 -6
  49. package/package.json +1 -1
@@ -1,42 +1,43 @@
1
- import { jsx as u, jsxs as v } from "react/jsx-runtime";
2
- import { useQueryClient as w, useQuery as x } from "@tanstack/react-query";
3
- import { UserCheck as k } from "lucide-react";
4
- import { useRef as g, useEffect as p, useMemo as N } from "react";
5
- import { useNivaroClient as C } from "../context.js";
6
- import { get as D } from "../lib/commands.js";
7
- import { useLiveEvent as _, useLiveCollection as M } from "../lib/live.js";
1
+ import { jsx as a, jsxs as f } from "react/jsx-runtime";
2
+ import { useQueryClient as h, useQuery as y } from "@tanstack/react-query";
3
+ import { UserCheck as b } from "lucide-react";
4
+ import { useRef as x, useMemo as w, useEffect as k } from "react";
5
+ import { useNivaroClient as N } from "../context.js";
6
+ import { get as C } from "../lib/commands.js";
7
+ import { useGapRefresh as _ } from "../lib/gap-refresh.js";
8
+ import { useLiveEvent as D, useLiveCollection as M } from "../lib/live.js";
8
9
  import { useLiveOps as S } from "../lib/live-ops.js";
9
- import { cn as h } from "../lib/utils.js";
10
- import { TickerNumber as T } from "./TickerNumber.js";
11
- const y = ["my-work-covering"], E = 5e3;
12
- function $(e, o = /* @__PURE__ */ new Date()) {
13
- const r = e.first_name || e.name, t = q(e.ends_at, o), a = `You're covering for ${e.name} ${t ?? "today"}`;
14
- return e.records === 0 ? { lead: a, count: null, tail: `none of ${r}'s records need you right now` } : {
15
- lead: a,
10
+ import { cn as v } from "../lib/utils.js";
11
+ import { TickerNumber as E } from "./TickerNumber.js";
12
+ const g = ["my-work-covering"], $ = 5e3;
13
+ function q(e, n = /* @__PURE__ */ new Date()) {
14
+ const r = e.first_name || e.name, t = T(e.ends_at, n), u = `You're covering for ${e.name} ${t ?? "today"}`;
15
+ return e.records === 0 ? { lead: u, count: null, tail: `none of ${r}'s records need you right now` } : {
16
+ lead: u,
16
17
  count: e.records,
17
18
  tail: `of ${r}'s record${e.records === 1 ? "" : "s"} need${e.records === 1 ? "s" : ""} you`
18
19
  };
19
20
  }
20
- function q(e, o = /* @__PURE__ */ new Date()) {
21
+ function T(e, n = /* @__PURE__ */ new Date()) {
21
22
  if (!e) return null;
22
23
  const r = new Date(e);
23
- return !Number.isFinite(r.getTime()) || r.toDateString() === o.toDateString() ? null : `until ${r.toLocaleDateString(void 0, { weekday: "short", month: "short", day: "numeric" })}`;
24
+ return !Number.isFinite(r.getTime()) || r.toDateString() === n.toDateString() ? null : `until ${r.toLocaleDateString(void 0, { weekday: "short", month: "short", day: "numeric" })}`;
24
25
  }
25
- function L(e, o = Date.now()) {
26
- const r = e.map((t) => t.ends_at ? new Date(t.ends_at).getTime() : Number.NaN).filter((t) => Number.isFinite(t) && t > o);
27
- return r.length ? Math.min(...r) - o : null;
26
+ function L(e, n = Date.now()) {
27
+ const r = e.map((t) => t.ends_at ? new Date(t.ends_at).getTime() : Number.NaN).filter((t) => Number.isFinite(t) && t > n);
28
+ return r.length ? Math.min(...r) - n : null;
28
29
  }
29
- function Q(e, o) {
30
- return o.some((r) => {
30
+ function Q(e, n) {
31
+ return n.some((r) => {
31
32
  const t = e.get(String(r.collection));
32
33
  return !!t && (r.item === "*" || t.has(String(r.item)));
33
34
  });
34
35
  }
35
- function O(e = !0) {
36
- const o = C();
37
- return x({
38
- queryKey: y,
39
- queryFn: () => o.request(D("/my-work/covering")).then((r) => {
36
+ function R(e = !0) {
37
+ const n = N();
38
+ return y({
39
+ queryKey: g,
40
+ queryFn: () => n.request(C("/my-work/covering")).then((r) => {
40
41
  var t;
41
42
  return Array.isArray((t = r.data) == null ? void 0 : t.covering) ? r.data.covering : [];
42
43
  }),
@@ -46,101 +47,93 @@ function O(e = !0) {
46
47
  refetchInterval: 5 * 6e4
47
48
  });
48
49
  }
49
- function F(e = !0) {
50
- const o = w(), r = O(e), t = r.data ?? [], a = g(0), c = g(null), i = g(() => {
51
- });
52
- i.current = () => {
53
- if (c.current) return;
54
- const n = () => {
55
- c.current = null, a.current = Date.now(), o.invalidateQueries({ queryKey: y });
56
- }, d = a.current + E - Date.now();
57
- d <= 0 ? n() : c.current = setTimeout(n, d);
58
- }, p(
59
- () => () => {
60
- c.current && clearTimeout(c.current);
61
- },
62
- []
63
- ), _("owners:changed", () => i.current(), { debounceMs: 1500, enabled: e }), S("my-work", () => i.current(), { debounceMs: 1500, enabled: e });
64
- const s = N(() => {
65
- var d;
66
- const n = /* @__PURE__ */ new Map();
67
- for (const b of t)
68
- for (const l of b.keys) {
69
- const m = l.indexOf(":");
70
- if (m <= 0) continue;
71
- const f = l.slice(0, m);
72
- n.has(f) || n.set(f, /* @__PURE__ */ new Set()), (d = n.get(f)) == null || d.add(l.slice(m + 1));
50
+ function O(e = !0) {
51
+ const n = h(), r = R(e), t = r.data ?? [], u = _(
52
+ () => void n.invalidateQueries({ queryKey: g }, { cancelRefetch: !1 }),
53
+ $,
54
+ e
55
+ ), s = x(u);
56
+ s.current = u, D("owners:changed", () => s.current(), { debounceMs: 1500, enabled: e }), S("my-work", () => s.current(), { debounceMs: 1500, enabled: e });
57
+ const i = w(() => {
58
+ var c;
59
+ const o = /* @__PURE__ */ new Map();
60
+ for (const p of t)
61
+ for (const d of p.keys) {
62
+ const l = d.indexOf(":");
63
+ if (l <= 0) continue;
64
+ const m = d.slice(0, l);
65
+ o.has(m) || o.set(m, /* @__PURE__ */ new Set()), (c = o.get(m)) == null || c.add(d.slice(l + 1));
73
66
  }
74
- return n;
67
+ return o;
75
68
  }, [t]);
76
69
  return M(
77
- [...s.keys()],
78
- (n) => {
79
- Q(s, n.events) && i.current();
70
+ [...i.keys()],
71
+ (o) => {
72
+ Q(i, o.events) && s.current();
80
73
  },
81
- { debounceMs: 1e3, includeOwn: !0, enabled: e && s.size > 0 }
82
- ), p(() => {
83
- const n = L(t);
84
- if (n == null || n > 2 ** 31 - 1) return;
85
- const d = setTimeout(() => i.current(), n + 1e3);
86
- return () => clearTimeout(d);
74
+ { debounceMs: 1e3, includeOwn: !0, enabled: e && i.size > 0 }
75
+ ), k(() => {
76
+ const o = L(t);
77
+ if (o == null || o > 2 ** 31 - 1) return;
78
+ const c = setTimeout(() => s.current(), o + 1e3);
79
+ return () => clearTimeout(c);
87
80
  }, [t]), r;
88
81
  }
89
- function P({
82
+ function V({
90
83
  onShow: e,
91
- showing: o,
84
+ showing: n,
92
85
  showLabel: r = "Show them",
93
86
  className: t
94
87
  }) {
95
- const { data: a } = F(), c = a ?? [];
96
- return c.length === 0 ? null : /* @__PURE__ */ u(
88
+ const { data: u } = O(), s = u ?? [];
89
+ return s.length === 0 ? null : /* @__PURE__ */ a(
97
90
  "section",
98
91
  {
99
92
  "data-delegate-cover": !0,
100
93
  "aria-label": "Covering for colleagues",
101
- className: h(
94
+ className: v(
102
95
  "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
103
96
  t
104
97
  ),
105
- children: /* @__PURE__ */ u("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: c.map((i) => {
106
- const s = $(i), n = o != null && o === i.user_id;
98
+ children: /* @__PURE__ */ a("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: s.map((i) => {
99
+ const o = q(i), c = n != null && n === i.user_id;
107
100
  return (
108
101
  // Wraps instead of squeezing: in a narrow column (phone, the home side card) the
109
102
  // action drops under the sentence; the icon sits in the first line, not a gutter.
110
- /* @__PURE__ */ v(
103
+ /* @__PURE__ */ f(
111
104
  "li",
112
105
  {
113
106
  "data-delegate-cover-line": i.user_id,
114
107
  className: "flex flex-wrap items-center gap-x-4 gap-y-2 px-4 py-2.5",
115
108
  children: [
116
- /* @__PURE__ */ v("p", { className: "min-w-[min(100%,18rem)] flex-1 text-[12.5px] leading-5 text-foreground", children: [
117
- /* @__PURE__ */ u(
118
- k,
109
+ /* @__PURE__ */ f("p", { className: "min-w-[min(100%,18rem)] flex-1 text-[12.5px] leading-5 text-foreground", children: [
110
+ /* @__PURE__ */ a(
111
+ b,
119
112
  {
120
113
  className: "-mt-0.5 mr-2 inline-block h-4 w-4 text-nvr-cyan",
121
114
  strokeWidth: 2,
122
115
  "aria-hidden": !0
123
116
  }
124
117
  ),
125
- /* @__PURE__ */ u("span", { children: s.lead }),
126
- /* @__PURE__ */ u("span", { className: "text-muted-foreground", children: " — " }),
127
- s.count != null && /* @__PURE__ */ v("span", { className: "font-semibold tabular-nums", "data-delegate-cover-count": !0, children: [
128
- /* @__PURE__ */ u(T, { value: s.count }),
118
+ /* @__PURE__ */ a("span", { children: o.lead }),
119
+ /* @__PURE__ */ a("span", { className: "text-muted-foreground", children: " — " }),
120
+ o.count != null && /* @__PURE__ */ f("span", { className: "font-semibold tabular-nums", "data-delegate-cover-count": !0, children: [
121
+ /* @__PURE__ */ a(E, { value: o.count }),
129
122
  " "
130
123
  ] }),
131
- /* @__PURE__ */ u("span", { className: s.count == null ? "text-muted-foreground" : void 0, children: s.tail })
124
+ /* @__PURE__ */ a("span", { className: o.count == null ? "text-muted-foreground" : void 0, children: o.tail })
132
125
  ] }),
133
- e && i.records > 0 && /* @__PURE__ */ u(
126
+ e && i.records > 0 && /* @__PURE__ */ a(
134
127
  "button",
135
128
  {
136
129
  type: "button",
137
130
  onClick: () => e(i),
138
- "aria-pressed": o !== void 0 ? n : void 0,
139
- className: h(
131
+ "aria-pressed": n !== void 0 ? c : void 0,
132
+ className: v(
140
133
  "max-w-full shrink-0 rounded-md border px-2.5 py-1 text-[11.5px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
141
- n ? "border-nvr-cyan/50 bg-nvr-cyan/10 text-[#0e7490] dark:text-[#67e8f9]" : "border-slate-200 text-foreground hover:bg-muted dark:border-border"
134
+ c ? "border-nvr-cyan/50 bg-nvr-cyan/10 text-[#0e7490] dark:text-[#67e8f9]" : "border-slate-200 text-foreground hover:bg-muted dark:border-border"
142
135
  ),
143
- children: n ? "Showing" : r
136
+ children: c ? "Showing" : r
144
137
  }
145
138
  )
146
139
  ]
@@ -153,12 +146,12 @@ function P({
153
146
  );
154
147
  }
155
148
  export {
156
- y as COVERING_QUERY_KEY,
157
- P as DelegateCoverLine,
149
+ g as COVERING_QUERY_KEY,
150
+ V as DelegateCoverLine,
158
151
  Q as coverBatchMatters,
159
- q as coverEnds,
160
- $ as coverSentence,
152
+ T as coverEnds,
153
+ q as coverSentence,
161
154
  L as nextCoverEnd,
162
- F as useCovering,
163
- O as useCoveringQuery
155
+ O as useCovering,
156
+ R as useCoveringQuery
164
157
  };