@nivaro/react 0.2.55 → 0.3.0

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 (60) hide show
  1. package/dist/components/slots/TasksSlot.js +31 -29
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +101 -1
  5. package/dist/index.js +538 -525
  6. package/dist/shared/components/ItemEditForm.js +666 -658
  7. package/dist/shared/components/MyWorkView.js +47 -37
  8. package/dist/shared/components/ProfileView.js +163 -144
  9. package/dist/shared/components/ai/AiPlanCard.js +427 -0
  10. package/dist/shared/components/ai/AiPlanChanges.js +117 -0
  11. package/dist/shared/components/ai/TaskDo.js +1022 -0
  12. package/dist/shared/components/chat/ChatAnalyticsView.js +19 -17
  13. package/dist/shared/components/chat/ChatPanel.js +1356 -1317
  14. package/dist/shared/components/chat/HuddleAnalyticsTab.js +198 -0
  15. package/dist/shared/components/chat/RoomHeaderMenu.js +78 -65
  16. package/dist/shared/components/chat/chat-core.js +273 -264
  17. package/dist/shared/components/chat/huddle/HuddleAudioUi.js +397 -0
  18. package/dist/shared/components/chat/huddle/HuddleCallBar.js +296 -0
  19. package/dist/shared/components/chat/huddle/HuddleCallLayer.js +180 -0
  20. package/dist/shared/components/chat/huddle/HuddleCamera.js +124 -0
  21. package/dist/shared/components/chat/huddle/HuddleCollab.js +320 -0
  22. package/dist/shared/components/chat/huddle/HuddleControls.js +82 -121
  23. package/dist/shared/components/chat/huddle/HuddleDraw.js +231 -0
  24. package/dist/shared/components/chat/huddle/HuddleLiveBadge.js +52 -0
  25. package/dist/shared/components/chat/huddle/HuddlePeoplePicker.js +143 -0
  26. package/dist/shared/components/chat/huddle/HuddleScheduleCard.js +190 -0
  27. package/dist/shared/components/chat/huddle/HuddleScheduleForm.js +188 -0
  28. package/dist/shared/components/chat/huddle/HuddleStage.js +184 -89
  29. package/dist/shared/components/chat/huddle/HuddleStageTools.js +197 -0
  30. package/dist/shared/components/chat/huddle/huddle-audio-logic.js +156 -0
  31. package/dist/shared/components/chat/huddle/huddle-audio.js +69 -0
  32. package/dist/shared/components/chat/huddle/huddle-calls.js +129 -0
  33. package/dist/shared/components/chat/huddle/huddle-camera.js +143 -0
  34. package/dist/shared/components/chat/huddle/huddle-collab-store.js +391 -0
  35. package/dist/shared/components/chat/huddle/huddle-device-prefs.js +55 -0
  36. package/dist/shared/components/chat/huddle/huddle-devices.js +99 -0
  37. package/dist/shared/components/chat/huddle/huddle-draw.js +226 -0
  38. package/dist/shared/components/chat/huddle/huddle-follow-bus.js +96 -0
  39. package/dist/shared/components/chat/huddle/huddle-hold.js +62 -0
  40. package/dist/shared/components/chat/huddle/huddle-link-quality.js +159 -0
  41. package/dist/shared/components/chat/huddle/huddle-live.js +82 -0
  42. package/dist/shared/components/chat/huddle/huddle-pip.js +343 -0
  43. package/dist/shared/components/chat/huddle/huddle-quality.js +22 -0
  44. package/dist/shared/components/chat/huddle/huddle-reactions.js +71 -0
  45. package/dist/shared/components/chat/huddle/huddle-ring-refused.js +34 -0
  46. package/dist/shared/components/chat/huddle/huddle-schedule.js +102 -0
  47. package/dist/shared/components/chat/huddle/huddle-sfu.js +176 -0
  48. package/dist/shared/components/chat/huddle/huddle-shortcuts.js +91 -0
  49. package/dist/shared/components/chat/huddle/huddle-speaking.js +100 -0
  50. package/dist/shared/components/chat/huddle/huddle-store.js +431 -157
  51. package/dist/shared/components/chat/huddle/useHuddle.js +46 -38
  52. package/dist/shared/components/chat/huddle/useHuddleAudio.js +35 -0
  53. package/dist/shared/components/item-edit/GroupSection.js +1 -0
  54. package/dist/shared/components/item-edit/RecordChatActions.js +68 -59
  55. package/dist/shared/components/item-edit/UserChip.js +145 -142
  56. package/dist/shared/components/panels/TaskPanel.js +51 -49
  57. package/dist/shared/components/support/TicketDetailSheet.js +57 -42
  58. package/dist/shared/lib/notification-sound.js +25 -16
  59. package/dist/shared/lib/stale-chunk.js +60 -0
  60. package/package.json +2 -1
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
- import { useQueryClient as se, useQuery as oe, useMutation as D } from "@tanstack/react-query";
2
+ import { useQueryClient as se, useQuery as oe, useMutation as L } from "@tanstack/react-query";
3
3
  import { useState as N, useRef as q, useEffect as E, useMemo as ie } from "react";
4
4
  import { useApiFetchConfig as le, useItemNavigation as ce, useNavigation as me } from "../context.js";
5
5
  import { useLiveEvent as ue } from "../lib/live.js";
@@ -9,36 +9,37 @@ import { useOptionalRealtime as he } from "../lib/realtime.js";
9
9
  import { withinDay as G, slaChip as ge } from "../lib/sla-chip.js";
10
10
  import { cn as A } from "../lib/utils.js";
11
11
  import { FirstWeekCard as fe } from "./ai/FirstWeekCard.js";
12
- import { openChatRoom as ke, canOpenChatRoom as ye } from "./chat/chat-core.js";
13
- import { useMyRecordRooms as Ne } from "./chat/chat-hooks.js";
14
- import { LearningPathCard as we } from "./help-videos/viewer/LearningPathCard.js";
15
- import { RequiredVideosCard as ve } from "./help-videos/viewer/RequiredVideosCard.js";
16
- import { TickerNumber as _e } from "./TickerNumber.js";
17
- import { UserAvatar as Ce } from "./UserAvatar.js";
18
- const $e = 8e3, X = ["records", "tasks", "team", "waiting", "notifications"], Se = {
12
+ import { TaskDoButton as ke } from "./ai/TaskDo.js";
13
+ import { openChatRoom as ye, canOpenChatRoom as Ne } from "./chat/chat-core.js";
14
+ import { useMyRecordRooms as we } from "./chat/chat-hooks.js";
15
+ import { LearningPathCard as ve } from "./help-videos/viewer/LearningPathCard.js";
16
+ import { RequiredVideosCard as _e } from "./help-videos/viewer/RequiredVideosCard.js";
17
+ import { TickerNumber as Ce } from "./TickerNumber.js";
18
+ import { UserAvatar as $e } from "./UserAvatar.js";
19
+ const Se = 8e3, X = ["records", "tasks", "team", "waiting", "notifications"], Te = {
19
20
  records: "Waiting on you",
20
21
  tasks: "My tasks",
21
22
  team: "Team tasks",
22
23
  waiting: "Waiting on others",
23
24
  notifications: "Notifications"
24
- }, Te = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), M = (l) => !!l && String(l).slice(0, 10) < Te(), je = {
25
+ }, je = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), M = (l) => !!l && String(l).slice(0, 10) < je(), Ae = {
25
26
  alert: "bg-red-500/10 text-red-600 dark:text-red-400",
26
27
  warn: "bg-amber-400/15 text-amber-700 dark:text-amber-400",
27
28
  neutral: "bg-slate-500/10 text-slate-600 dark:text-slate-400",
28
29
  ok: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"
29
30
  };
30
- function Ae({ sla: l }) {
31
+ function Me({ sla: l }) {
31
32
  const c = ge(l);
32
33
  return c ? /* @__PURE__ */ e(
33
34
  "span",
34
35
  {
35
36
  "data-sla-chip": c.tone,
36
- className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums ${je[c.tone]}`,
37
+ className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums ${Ae[c.tone]}`,
37
38
  children: c.label
38
39
  }
39
40
  ) : null;
40
41
  }
41
- function Me({ state: l, color: c }) {
42
+ function Oe({ state: l, color: c }) {
42
43
  return l ? /* @__PURE__ */ e(
43
44
  "span",
44
45
  {
@@ -54,10 +55,10 @@ function Me({ state: l, color: c }) {
54
55
  function O({ label: l, value: c, tone: u }) {
55
56
  return /* @__PURE__ */ s("div", { className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card", children: [
56
57
  /* @__PURE__ */ e("p", { className: "text-[10.5px] uppercase tracking-wide text-muted-foreground", children: l }),
57
- /* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${u ?? ""}`, children: /* @__PURE__ */ e(_e, { value: c }) })
58
+ /* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${u ?? ""}`, children: /* @__PURE__ */ e(Ce, { value: c }) })
58
59
  ] });
59
60
  }
60
- function Ze({
61
+ function Xe({
61
62
  notificationRoutes: l,
62
63
  onOpenPath: c
63
64
  } = {}) {
@@ -65,7 +66,7 @@ function Ze({
65
66
  var b, i;
66
67
  const d = ((b = l == null ? void 0 : l.support) == null ? void 0 : b.call(l, String(t))) ?? ((i = _.consoleUrl) == null ? void 0 : i.call(_, `/support?ticket=${t}`)) ?? `/support?ticket=${t}`;
67
68
  c ? c(d) : _.navigate(d);
68
- }, F = he(), [R, C] = N(!1), [x, ee] = N(() => {
69
+ }, D = he(), [R, C] = N(!1), [x, ee] = N(() => {
69
70
  try {
70
71
  const t = localStorage.getItem("nvr_mywork_sections");
71
72
  if (t) {
@@ -98,7 +99,7 @@ function Ze({
98
99
  }), z = q(0), g = q(null), J = () => {
99
100
  const t = () => {
100
101
  g.current = null, z.current = Date.now(), C(!1), h.invalidateQueries({ queryKey: ["my-work"] });
101
- }, d = z.current + $e - Date.now();
102
+ }, d = z.current + Se - Date.now();
102
103
  g.current || (d <= 0 ? t() : g.current = setTimeout(t, d));
103
104
  };
104
105
  pe("my-work", J, { debounceMs: 1500 }), ue("notification:new", J, { debounceMs: 1500 }), E(
@@ -113,19 +114,19 @@ function Ze({
113
114
  ...((a == null ? void 0 : a.team_tasks) ?? []).map((t) => `tt:${t.id}`),
114
115
  ...((a == null ? void 0 : a.requested) ?? []).map((t) => `r:${t.id}`),
115
116
  ...((a == null ? void 0 : a.notifications) ?? []).map((t) => `n:${t.id}`)
116
- ]), f = (t) => H.has(t) ? "bg-nvr-cyan/10 transition-colors duration-700" : "transition-colors duration-700", I = ie(() => {
117
+ ]), f = (t) => H.has(t) ? "bg-nvr-cyan/10 transition-colors duration-700" : "transition-colors duration-700", F = ie(() => {
117
118
  const t = /* @__PURE__ */ new Set();
118
119
  for (const d of (a == null ? void 0 : a.owned) ?? []) d.collection && t.add(d.collection);
119
120
  return [...t];
120
121
  }, [a]);
121
122
  E(() => {
122
- if (!(!F || I.length === 0))
123
- return F.subscribeCollections(I, () => {
123
+ if (!(!D || F.length === 0))
124
+ return D.subscribeCollections(F, () => {
124
125
  const t = Date.now();
125
126
  t - P.current < 3e4 || (P.current = t, C(!0));
126
127
  });
127
- }, [F, I]);
128
- const V = D({
128
+ }, [D, F]);
129
+ const V = L({
129
130
  // A ticket closes through /support so its requester hears about it.
130
131
  mutationFn: (t) => fetch(`${u}/${t.kind === "support" ? "support/tickets" : "tasks"}/${t.id}`, {
131
132
  method: "PATCH",
@@ -134,7 +135,7 @@ function Ze({
134
135
  body: JSON.stringify({ status: "done" })
135
136
  }),
136
137
  onSuccess: () => h.invalidateQueries({ queryKey: ["my-work"] })
137
- }), S = D({
138
+ }), S = L({
138
139
  mutationFn: async ({ id: t, action: d }) => {
139
140
  const b = await fetch(`${u}/tasks/${t}/${d}`, {
140
141
  method: "POST",
@@ -146,16 +147,16 @@ function Ze({
146
147
  return d;
147
148
  },
148
149
  onSuccess: (t) => {
149
- L(t === "claim" ? "It’s yours — it moved to My tasks." : "Reminder sent."), h.invalidateQueries({ queryKey: ["my-work"] });
150
+ I(t === "claim" ? "It’s yours — it moved to My tasks." : "Reminder sent."), h.invalidateQueries({ queryKey: ["my-work"] });
150
151
  },
151
- onError: (t) => L(t instanceof Error ? t.message : "Failed")
152
- }), [T, L] = N(null);
152
+ onError: (t) => I(t instanceof Error ? t.message : "Failed")
153
+ }), [T, I] = N(null);
153
154
  E(() => {
154
155
  if (!T) return;
155
- const t = setTimeout(() => L(null), 4e3);
156
+ const t = setTimeout(() => I(null), 4e3);
156
157
  return () => clearTimeout(t);
157
158
  }, [T]);
158
- const Y = D({
159
+ const Y = L({
159
160
  mutationFn: (t) => fetch(`${u}/notifications/mark-read`, {
160
161
  method: "POST",
161
162
  headers: { ...w, "content-type": "application/json" },
@@ -240,7 +241,7 @@ function Ze({
240
241
  te && /* @__PURE__ */ s("div", { className: "absolute right-0 top-full z-20 mt-1 w-56 rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
241
242
  /* @__PURE__ */ e("p", { className: "px-1 pb-1.5 text-[11px] font-semibold text-slate-500", children: "Sections" }),
242
243
  x.order.map((t, d) => {
243
- const b = Se[t] ?? t, i = x.hidden.includes(t), m = (r) => {
244
+ const b = Te[t] ?? t, i = x.hidden.includes(t), m = (r) => {
244
245
  const p = [...x.order], n = d + r;
245
246
  n < 0 || n >= p.length || ([p[d], p[n]] = [p[n], p[d]], K({ ...x, order: p }));
246
247
  };
@@ -299,8 +300,8 @@ function Ze({
299
300
  children: T
300
301
  }
301
302
  ),
303
+ /* @__PURE__ */ e(_e, { className: "mb-4" }),
302
304
  /* @__PURE__ */ e(ve, { className: "mb-4" }),
303
- /* @__PURE__ */ e(we, { className: "mb-4" }),
304
305
  (() => {
305
306
  const t = {
306
307
  records: () => {
@@ -349,8 +350,8 @@ function Ze({
349
350
  children: [
350
351
  /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] font-medium", children: o.label }),
351
352
  /* @__PURE__ */ e("span", { className: "hidden text-[11px] text-muted-foreground sm:inline", children: o.collection.replace(/_/g, " ") }),
352
- /* @__PURE__ */ e(Me, { state: o.state, color: o.state_color }),
353
- /* @__PURE__ */ e(Ae, { sla: o.sla })
353
+ /* @__PURE__ */ e(Oe, { state: o.state, color: o.state_color }),
354
+ /* @__PURE__ */ e(Me, { sla: o.sla })
354
355
  ]
355
356
  }
356
357
  )
@@ -391,6 +392,15 @@ function Ze({
391
392
  ]
392
393
  }
393
394
  ),
395
+ /* @__PURE__ */ e(
396
+ ke,
397
+ {
398
+ task: r,
399
+ isAssignee: !0,
400
+ compact: !0,
401
+ onTaskChanged: () => void h.invalidateQueries({ queryKey: ["my-work"] })
402
+ }
403
+ ),
394
404
  r.due_date && /* @__PURE__ */ e(
395
405
  "span",
396
406
  {
@@ -552,7 +562,7 @@ function Ze({
552
562
  className: A("flex items-start gap-2.5 px-4 py-2", f(`n:${r.id}`)),
553
563
  children: [
554
564
  /* @__PURE__ */ e(
555
- Ce,
565
+ $e,
556
566
  {
557
567
  userId: r.sender,
558
568
  className: "mt-0.5 h-5 w-5",
@@ -603,11 +613,11 @@ function Ze({
603
613
  }
604
614
  return i;
605
615
  })(),
606
- /* @__PURE__ */ e(Oe, {})
616
+ /* @__PURE__ */ e(De, {})
607
617
  ] });
608
618
  }
609
- function Oe() {
610
- const l = ye(), { rooms: c } = Ne(l);
619
+ function De() {
620
+ const l = Ne(), { rooms: c } = we(l);
611
621
  return !l || c.length === 0 ? null : /* @__PURE__ */ s(
612
622
  "section",
613
623
  {
@@ -619,7 +629,7 @@ function Oe() {
619
629
  "button",
620
630
  {
621
631
  type: "button",
622
- onClick: () => ke(u.room, u.label),
632
+ onClick: () => ye(u.room, u.label),
623
633
  className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-muted/40",
624
634
  "data-my-work-chat-room": u.room,
625
635
  children: [
@@ -640,5 +650,5 @@ function Oe() {
640
650
  );
641
651
  }
642
652
  export {
643
- Ze as MyWorkView
653
+ Xe as MyWorkView
644
654
  };