@nivaro/react 0.3.66 → 0.3.68

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 (41) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +15 -1
  4. package/dist/index.js +836 -835
  5. package/dist/shared/components/ActivityEntry.js +28 -28
  6. package/dist/shared/components/CollectionBrowserView.js +584 -585
  7. package/dist/shared/components/ConformanceView.js +34 -34
  8. package/dist/shared/components/ItemEditForm.js +1758 -1758
  9. package/dist/shared/components/RecordCompare.js +149 -129
  10. package/dist/shared/components/ReportView.js +196 -196
  11. package/dist/shared/components/SlaRulesView.js +36 -36
  12. package/dist/shared/components/bulk/BulkCompareButton.js +16 -16
  13. package/dist/shared/components/chat/ChatPanel.js +484 -487
  14. package/dist/shared/components/chat/ChatViews.js +66 -66
  15. package/dist/shared/components/chat/RoomParts.js +159 -157
  16. package/dist/shared/components/help-videos/editor/StatsTab.js +48 -47
  17. package/dist/shared/components/help-videos/editor/VersionsTab.js +17 -16
  18. package/dist/shared/components/imports/CollectionImportPanel.js +72 -72
  19. package/dist/shared/components/integrations/IntegrationObligationsView.js +199 -187
  20. package/dist/shared/components/integrations/console/EventsView.js +22 -24
  21. package/dist/shared/components/integrations/console/SubmissionRow.js +6 -13
  22. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +29 -28
  23. package/dist/shared/components/integrations/console/tone.js +22 -21
  24. package/dist/shared/components/item-edit/FieldRow.js +188 -188
  25. package/dist/shared/components/item-edit/FilePickerField.js +281 -297
  26. package/dist/shared/components/item-edit/GroupSection.js +209 -209
  27. package/dist/shared/components/item-edit/RecordInsights.js +101 -101
  28. package/dist/shared/components/item-edit/SummaryPanel.js +31 -31
  29. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +12 -12
  30. package/dist/shared/components/panels/AddendumPanel.js +409 -411
  31. package/dist/shared/components/panels/BranchLanes.js +7 -7
  32. package/dist/shared/components/panels/CommentPanel.js +204 -197
  33. package/dist/shared/components/panels/PipelinePanel.js +264 -264
  34. package/dist/shared/components/panels/RecordIntegrityBanner.js +78 -78
  35. package/dist/shared/components/panels/RevisionsPanel.js +229 -229
  36. package/dist/shared/components/panels/TaskPanel.js +75 -75
  37. package/dist/shared/components/queue/QueueWorklist.js +591 -589
  38. package/dist/shared/lib/compare-value.js +73 -0
  39. package/dist/shared/lib/format-value.js +18 -17
  40. package/dist/shared/lib/utils.js +87 -80
  41. package/package.json +1 -1
@@ -1,25 +1,26 @@
1
1
  import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
- import { useQuery as Q, useQueryClient as I, useMutation as R } from "@tanstack/react-query";
2
+ import { useQuery as D, useQueryClient as I, useMutation as R } from "@tanstack/react-query";
3
3
  import { AlertCircle as W, RotateCw as L, ThumbsUp as P, ThumbsDown as K, CornerDownRight as U } from "lucide-react";
4
4
  import { useState as x, useId as y } from "react";
5
5
  import { useNivaroClient as T } from "../../../context.js";
6
6
  import { userErrorMessage as F } from "../../../lib/safe-error.js";
7
+ import { toLocalDateString as V } from "../../../lib/utils.js";
7
8
  import { Button as v } from "../../ui/button.js";
8
9
  import { Checkbox as $ } from "../../ui/checkbox.js";
9
10
  import { Skeleton as M } from "../../ui/skeleton.js";
10
- import { Textarea as V } from "../../ui/textarea.js";
11
+ import { Textarea as Y } from "../../ui/textarea.js";
11
12
  import { helpVideoApi as j } from "../api.js";
12
- import { fmtMoment as Y } from "../viewer/feedback.js";
13
+ import { fmtMoment as B } from "../viewer/feedback.js";
13
14
  const A = 2e3;
14
- function ne({
15
+ function de({
15
16
  video: c,
16
17
  onJump: a,
17
18
  onAnswerEdit: h
18
19
  }) {
19
- const i = T(), u = Q({
20
+ const i = T(), u = D({
20
21
  queryKey: ["help-videos", "analytics", c.id],
21
22
  queryFn: () => j(i).analytics(c.id)
22
- }), r = u.data;
23
+ }), s = u.data;
23
24
  if (u.error)
24
25
  return /* @__PURE__ */ t(
25
26
  "div",
@@ -39,7 +40,7 @@ function ne({
39
40
  ]
40
41
  }
41
42
  );
42
- if (!r)
43
+ if (!s)
43
44
  return /* @__PURE__ */ t(
44
45
  "div",
45
46
  {
@@ -53,44 +54,44 @@ function ne({
53
54
  ]
54
55
  }
55
56
  );
56
- const o = r.ratings ?? { up: 0, down: 0, helpful_rate: 0 }, l = r.questions ?? [], m = o.up + o.down;
57
- return !r.unique_viewers && !m && !l.length ? /* @__PURE__ */ t("div", { className: "max-w-[65ch] space-y-1 p-5 text-[13px]", "data-hv-stats-empty": !0, children: [
57
+ const d = s.ratings ?? { up: 0, down: 0, helpful_rate: 0 }, l = s.questions ?? [], m = d.up + d.down;
58
+ return !s.unique_viewers && !m && !l.length ? /* @__PURE__ */ t("div", { className: "max-w-[65ch] space-y-1 p-5 text-[13px]", "data-hv-stats-empty": !0, children: [
58
59
  /* @__PURE__ */ e("p", { className: "font-medium text-foreground", children: "Nobody has watched this yet." }),
59
60
  /* @__PURE__ */ e("p", { className: "text-muted-foreground", children: "Once people watch, you will see how many finished it, where they stopped, whether it helped, and the questions they asked." })
60
61
  ] }) : /* @__PURE__ */ t("div", { className: "max-w-[760px] space-y-6 p-5 text-[13px]", "data-hv-stats": !0, children: [
61
62
  /* @__PURE__ */ t("dl", { className: "grid grid-cols-1 gap-px overflow-hidden rounded-lg border border-border bg-border sm:grid-cols-4", children: [
62
63
  [
63
- ["People who watched", String(r.unique_viewers)],
64
- ["Watched most of it", `${Math.round(r.completion_rate * 100)}%`],
65
- ["Hours watched", String(r.watched_hours)]
66
- ].map(([s, n]) => /* @__PURE__ */ t("div", { className: "bg-card p-3", children: [
67
- /* @__PURE__ */ e("dt", { className: "text-[12px] text-muted-foreground", children: s }),
64
+ ["People who watched", String(s.unique_viewers)],
65
+ ["Watched most of it", `${Math.round(s.completion_rate * 100)}%`],
66
+ ["Hours watched", String(s.watched_hours)]
67
+ ].map(([r, n]) => /* @__PURE__ */ t("div", { className: "bg-card p-3", children: [
68
+ /* @__PURE__ */ e("dt", { className: "text-[12px] text-muted-foreground", children: r }),
68
69
  /* @__PURE__ */ e("dd", { className: "text-[18px] font-semibold tabular-nums text-foreground", children: n })
69
- ] }, s)),
70
- /* @__PURE__ */ t("div", { className: "bg-card p-3", "data-hv-stats-ratings": `${o.up}/${o.down}`, children: [
70
+ ] }, r)),
71
+ /* @__PURE__ */ t("div", { className: "bg-card p-3", "data-hv-stats-ratings": `${d.up}/${d.down}`, children: [
71
72
  /* @__PURE__ */ e("dt", { className: "text-[12px] text-muted-foreground", children: "Found it helpful" }),
72
- /* @__PURE__ */ e("dd", { className: "text-[18px] font-semibold tabular-nums text-foreground", children: m ? `${Math.round(o.helpful_rate * 100)}%` : "—" }),
73
+ /* @__PURE__ */ e("dd", { className: "text-[18px] font-semibold tabular-nums text-foreground", children: m ? `${Math.round(d.helpful_rate * 100)}%` : "—" }),
73
74
  /* @__PURE__ */ t("dd", { className: "flex items-center gap-2 text-[12px] text-muted-foreground", children: [
74
75
  /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1", children: [
75
76
  /* @__PURE__ */ e(P, { className: "h-3 w-3", "aria-hidden": !0 }),
76
77
  " ",
77
- o.up
78
+ d.up
78
79
  ] }),
79
80
  /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1", children: [
80
81
  /* @__PURE__ */ e(K, { className: "h-3 w-3", "aria-hidden": !0 }),
81
82
  " ",
82
- o.down
83
+ d.down
83
84
  ] }),
84
85
  /* @__PURE__ */ t("span", { className: "sr-only", children: [
85
- o.up,
86
+ d.up,
86
87
  " found it helpful, ",
87
- o.down,
88
+ d.down,
88
89
  " did not"
89
90
  ] })
90
91
  ] })
91
92
  ] })
92
93
  ] }),
93
- r.unique_viewers > 0 && /* @__PURE__ */ t("section", { children: [
94
+ s.unique_viewers > 0 && /* @__PURE__ */ t("section", { children: [
94
95
  /* @__PURE__ */ e("h3", { className: "mb-2 text-[13px] font-semibold text-foreground", children: "Where people stop" }),
95
96
  /* @__PURE__ */ e("p", { className: "sr-only", children: "Share of viewers who reached each part of the video." }),
96
97
  /* @__PURE__ */ e(
@@ -99,25 +100,25 @@ function ne({
99
100
  className: "flex h-28 items-end gap-1 border-b border-border",
100
101
  "aria-hidden": !0,
101
102
  "data-hv-dropoff": !0,
102
- children: r.drop_off.map((s, n) => /* @__PURE__ */ e(
103
+ children: s.drop_off.map((r, n) => /* @__PURE__ */ e(
103
104
  "div",
104
105
  {
105
106
  className: "flex-1 rounded-t-sm bg-nvr-navy dark:bg-nvr-cyan",
106
- style: { height: `${Math.max(2, s * 100)}%` },
107
- title: `${n * 5}–${n * 5 + 5}% of the video: ${Math.round(s * 100)}% of viewers`
107
+ style: { height: `${Math.max(2, r * 100)}%` },
108
+ title: `${n * 5}–${n * 5 + 5}% of the video: ${Math.round(r * 100)}% of viewers`
108
109
  },
109
110
  n
110
111
  ))
111
112
  }
112
113
  ),
113
- /* @__PURE__ */ e("ul", { className: "sr-only", "data-hv-dropoff-list": !0, children: r.drop_off.map((s, n) => (
114
+ /* @__PURE__ */ e("ul", { className: "sr-only", "data-hv-dropoff-list": !0, children: s.drop_off.map((r, n) => (
114
115
  // biome-ignore lint/suspicious/noArrayIndexKey: fixed 5% sections
115
116
  /* @__PURE__ */ t("li", { children: [
116
117
  n * 5,
117
118
  "–",
118
119
  n * 5 + 5,
119
120
  "% of the video: ",
120
- Math.round(s * 100),
121
+ Math.round(r * 100),
121
122
  "% of viewers still watching"
122
123
  ] }, n)
123
124
  )) }),
@@ -131,28 +132,28 @@ function ne({
131
132
  "Questions",
132
133
  l.length ? ` (${l.length})` : ""
133
134
  ] }),
134
- l.length === 0 ? /* @__PURE__ */ e("p", { className: "text-muted-foreground", children: "Nobody has asked a question yet. Viewers can ask one at any moment of the video." }) : /* @__PURE__ */ e("ul", { className: "space-y-2", children: l.map((s) => /* @__PURE__ */ e(
135
- B,
135
+ l.length === 0 ? /* @__PURE__ */ e("p", { className: "text-muted-foreground", children: "Nobody has asked a question yet. Viewers can ask one at any moment of the video." }) : /* @__PURE__ */ e("ul", { className: "space-y-2", children: l.map((r) => /* @__PURE__ */ e(
136
+ H,
136
137
  {
137
138
  video: c,
138
- item: s,
139
+ item: r,
139
140
  onJump: a,
140
141
  onAnswerEdit: h
141
142
  },
142
- s.id
143
+ r.id
143
144
  )) })
144
145
  ] })
145
146
  ] });
146
147
  }
147
- function B({
148
+ function H({
148
149
  video: c,
149
150
  item: a,
150
151
  onJump: h,
151
152
  onAnswerEdit: i
152
153
  }) {
153
- const u = T(), r = I(), [o, l] = x(!1), [m, s] = x(""), [n, z] = x(!1), [C, D] = x(!1), [_, g] = x(null), k = y(), q = y(), S = y(), N = Y(a.at_ms), b = R({
154
- mutationFn: (d) => j(u).answer(c.id, a.id, d),
155
- onSuccess: (d, p) => {
154
+ const u = T(), s = I(), [d, l] = x(!1), [m, r] = x(""), [n, z] = x(!1), [C, Q] = x(!1), [_, g] = x(null), k = y(), q = y(), S = y(), N = B(a.at_ms), b = R({
155
+ mutationFn: (o) => j(u).answer(c.id, a.id, o),
156
+ onSuccess: (o, p) => {
156
157
  const w = [];
157
158
  if (n && i) {
158
159
  const f = i("chapter", a.at_ms, p);
@@ -162,9 +163,9 @@ function B({
162
163
  const f = i("caption", a.at_ms, p);
163
164
  f && w.push(`Caption: ${f}`);
164
165
  }
165
- g(w.length ? w.join(" · ") : null), l(!1), s(""), r.invalidateQueries({ queryKey: ["help-videos", "analytics", c.id] });
166
+ g(w.length ? w.join(" · ") : null), l(!1), r(""), s.invalidateQueries({ queryKey: ["help-videos", "analytics", c.id] });
166
167
  },
167
- onError: (d) => g(F(d, "The answer was not saved."))
168
+ onError: (o) => g(F(o, "The answer was not saved."))
168
169
  });
169
170
  return /* @__PURE__ */ t(
170
171
  "li",
@@ -176,7 +177,7 @@ function B({
176
177
  /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-[12px] text-muted-foreground", children: [
177
178
  /* @__PURE__ */ e("span", { children: a.asked_by_name ?? "Someone" }),
178
179
  /* @__PURE__ */ e("span", { "aria-hidden": !0, children: "·" }),
179
- /* @__PURE__ */ e("span", { children: new Date(a.created_at).toLocaleDateString() }),
180
+ /* @__PURE__ */ e("span", { children: V(a.created_at) }),
180
181
  /* @__PURE__ */ e("span", { "aria-hidden": !0, children: "·" }),
181
182
  /* @__PURE__ */ t(
182
183
  "button",
@@ -211,12 +212,12 @@ function B({
211
212
  a.answer
212
213
  ] })
213
214
  ] }),
214
- o ? /* @__PURE__ */ t(
215
+ d ? /* @__PURE__ */ t(
215
216
  "form",
216
217
  {
217
218
  className: "mt-2 space-y-1.5",
218
- onSubmit: (d) => {
219
- d.preventDefault();
219
+ onSubmit: (o) => {
220
+ o.preventDefault();
220
221
  const p = m.trim();
221
222
  if (!p) {
222
223
  g("Write the answer first");
@@ -228,11 +229,11 @@ function B({
228
229
  children: [
229
230
  /* @__PURE__ */ e("label", { htmlFor: k, className: "sr-only", children: "Your answer" }),
230
231
  /* @__PURE__ */ e(
231
- V,
232
+ Y,
232
233
  {
233
234
  id: k,
234
235
  value: m,
235
- onChange: (d) => s(d.target.value),
236
+ onChange: (o) => r(o.target.value),
236
237
  rows: 3,
237
238
  maxLength: A,
238
239
  placeholder: "Your answer (the person who asked is notified)",
@@ -246,7 +247,7 @@ function B({
246
247
  {
247
248
  id: q,
248
249
  checked: n,
249
- onCheckedChange: (d) => z(d === !0),
250
+ onCheckedChange: (o) => z(o === !0),
250
251
  "data-hv-answer-chapter": !0
251
252
  }
252
253
  ),
@@ -259,7 +260,7 @@ function B({
259
260
  {
260
261
  id: S,
261
262
  checked: C,
262
- onCheckedChange: (d) => D(d === !0),
263
+ onCheckedChange: (o) => Q(o === !0),
263
264
  "data-hv-answer-caption": !0
264
265
  }
265
266
  ),
@@ -305,7 +306,7 @@ function B({
305
306
  variant: "outline",
306
307
  className: "h-7 text-[12px]",
307
308
  onClick: () => {
308
- g(null), s(a.answer ?? ""), l(!0);
309
+ g(null), r(a.answer ?? ""), l(!0);
309
310
  },
310
311
  "data-hv-answer-open": !0,
311
312
  children: a.answer ? "Change the answer" : "Answer"
@@ -325,5 +326,5 @@ function B({
325
326
  );
326
327
  }
327
328
  export {
328
- ne as StatsTab
329
+ de as StatsTab
329
330
  };
@@ -5,39 +5,40 @@ import { useState as d } from "react";
5
5
  import { toast as F } from "sonner";
6
6
  import { useNivaroClient as q } from "../../../context.js";
7
7
  import { userErrorMessage as _ } from "../../../lib/safe-error.js";
8
+ import { toLocalDateString as z } from "../../../lib/utils.js";
8
9
  import { Button as c } from "../../ui/button.js";
9
10
  import { Skeleton as g } from "../../ui/skeleton.js";
10
- import { helpVideoApi as w, helpVideoKeys as z, helpVideoError as M } from "../api.js";
11
- import { DownloadMenu as j } from "../viewer/DownloadMenu.js";
12
- import { renderLabel as K, whenSaved as y } from "./publish.js";
13
- import { UnsavedNote as P } from "./UnsavedNote.js";
11
+ import { helpVideoApi as y, helpVideoKeys as M, helpVideoError as j } from "../api.js";
12
+ import { DownloadMenu as K } from "../viewer/DownloadMenu.js";
13
+ import { renderLabel as P, whenSaved as w } from "./publish.js";
14
+ import { UnsavedNote as Q } from "./UnsavedNote.js";
14
15
  const m = "rounded-full px-2 py-0.5 text-[11px] font-medium";
15
- function re({
16
+ function se({
16
17
  video: a,
17
18
  onRerecord: k,
18
19
  onRestored: E,
19
20
  beforeChange: u,
20
21
  conflict: V = !1,
21
- onReload: D = () => {
22
+ onReload: R = () => {
22
23
  }
23
24
  }) {
24
- const p = q(), R = C(), [f, i] = d(null), [L, o] = d(!1), [h, x] = d(null), s = I({
25
+ const p = q(), D = C(), [f, i] = d(null), [L, o] = d(!1), [h, x] = d(null), s = I({
25
26
  queryKey: ["help-videos", "versions", a.id],
26
- queryFn: () => w(p).versions(a.id)
27
+ queryFn: () => y(p).versions(a.id)
27
28
  }), S = async () => {
28
- i(null), o(!1), (await y(u, async () => {
29
+ i(null), o(!1), (await w(u, async () => {
29
30
  })).ok ? k() : o(!0);
30
31
  }, $ = async (e, n) => {
31
32
  var v;
32
33
  i(null), o(!1), x(e);
33
34
  try {
34
- if (!(await y(u, () => w(p).restore(a.id, e))).ok) {
35
+ if (!(await w(u, () => y(p).restore(a.id, e))).ok) {
35
36
  o(!0);
36
37
  return;
37
38
  }
38
- F.success(`Version ${n} copied into a new draft`), R.invalidateQueries({ queryKey: z.one(a.id) }), s.refetch(), E();
39
+ F.success(`Version ${n} copied into a new draft`), D.invalidateQueries({ queryKey: M.one(a.id) }), s.refetch(), E();
39
40
  } catch (l) {
40
- const b = (v = M(l)) == null ? void 0 : v.code;
41
+ const b = (v = j(l)) == null ? void 0 : v.code;
41
42
  i(
42
43
  b === "HELP_VIDEO_VERSION_FILES_REMOVED" ? `Version ${n} couldn't be restored: its files were removed by retention.` : `Version ${n} couldn't be restored. ${_(l, "")}`
43
44
  ), b === "HELP_VIDEO_VERSION_FILES_REMOVED" && s.refetch();
@@ -50,7 +51,7 @@ function re({
50
51
  /* @__PURE__ */ r("p", { className: "max-w-[65ch] text-muted-foreground", children: "Every published cut is kept. Restoring copies an older cut into a new draft, so nothing is overwritten." }),
51
52
  /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
52
53
  a.draft_download_urls && /* @__PURE__ */ r(
53
- j,
54
+ K,
54
55
  {
55
56
  urls: a.draft_download_urls,
56
57
  original: !0,
@@ -71,7 +72,7 @@ function re({
71
72
  )
72
73
  ] })
73
74
  ] }),
74
- L && /* @__PURE__ */ r(P, { conflict: V, onReload: D, "data-hv-versions-note": !0 }),
75
+ L && /* @__PURE__ */ r(Q, { conflict: V, onReload: R, "data-hv-versions-note": !0 }),
75
76
  /* @__PURE__ */ r("div", { role: "status", "aria-live": "polite", children: f && /* @__PURE__ */ t(
76
77
  "p",
77
78
  {
@@ -125,7 +126,7 @@ function re({
125
126
  e.created_by_name ?? "Unknown",
126
127
  " ·",
127
128
  " ",
128
- e.files_removed_at ? `Files removed by retention on ${new Date(e.files_removed_at).toLocaleDateString()}` : K(e).text
129
+ e.files_removed_at ? `Files removed by retention on ${z(e.files_removed_at)}` : P(e).text
129
130
  ] })
130
131
  ] }),
131
132
  e.files_removed_at && /* @__PURE__ */ r(
@@ -170,5 +171,5 @@ function re({
170
171
  ] });
171
172
  }
172
173
  export {
173
- re as VersionsTab
174
+ se as VersionsTab
174
175
  };