@nivaro/react 0.3.46 → 0.3.47

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 (57) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +248 -16
  4. package/dist/index.js +679 -659
  5. package/dist/shared/components/CollectionBrowserView.js +813 -826
  6. package/dist/shared/components/ErrorNotice.js +169 -0
  7. package/dist/shared/components/ErrorSurface.js +23 -17
  8. package/dist/shared/components/ListLoadError.js +8 -29
  9. package/dist/shared/components/LoadErrorNote.js +38 -21
  10. package/dist/shared/components/QueryErrorState.js +8 -11
  11. package/dist/shared/components/ReportView.js +1320 -1291
  12. package/dist/shared/components/chat/ChannelArchive.js +60 -60
  13. package/dist/shared/components/chat/ChannelExtras.js +74 -74
  14. package/dist/shared/components/chat/ChatPanel.js +368 -367
  15. package/dist/shared/components/command-center/PeekPanel.js +33 -32
  16. package/dist/shared/components/command-center/panels/BoardSettings.js +41 -40
  17. package/dist/shared/components/command-center/panels/PeoplePanel.js +32 -31
  18. package/dist/shared/components/help-videos/editor/ClipsPanel.js +49 -48
  19. package/dist/shared/components/help-videos/editor/PublishButton.js +37 -36
  20. package/dist/shared/components/help-videos/editor/StatsTab.js +45 -44
  21. package/dist/shared/components/help-videos/editor/VersionsTab.js +29 -28
  22. package/dist/shared/components/help-videos/library/AuthorRolesButton.js +19 -18
  23. package/dist/shared/components/help-videos/library/HelpVideoLibrary.js +132 -129
  24. package/dist/shared/components/help-videos/library/LearningPathsPanel.js +42 -41
  25. package/dist/shared/components/help-videos/settings/HouseStyleButton.js +21 -20
  26. package/dist/shared/components/help-videos/settings/RenderSettingsButton.js +22 -21
  27. package/dist/shared/components/import/DocumentAutofillButton.js +24 -20
  28. package/dist/shared/components/import/ImportFromFileButton.js +61 -60
  29. package/dist/shared/components/imports/ImportStalenessControl.js +20 -21
  30. package/dist/shared/components/imports/NewImportDialog.js +29 -28
  31. package/dist/shared/components/imports/RunDetailSheet.js +63 -63
  32. package/dist/shared/components/item-edit/FieldRow.js +329 -329
  33. package/dist/shared/components/item-edit/InlineTableField.js +898 -898
  34. package/dist/shared/components/item-edit/PersonalDefaultControl.js +57 -56
  35. package/dist/shared/components/item-edit/PlanGrid.js +220 -221
  36. package/dist/shared/components/item-edit/RecordGrantTools.js +49 -48
  37. package/dist/shared/components/item-edit/placement-behaviour.js +68 -67
  38. package/dist/shared/components/layout-editor/inspector/ColumnFit.js +24 -23
  39. package/dist/shared/components/layout-editor/inspector/PickerPreview.js +17 -16
  40. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +41 -41
  41. package/dist/shared/components/layout-editor/outputs/output-api.js +33 -31
  42. package/dist/shared/components/layout-editor/overview/overview-api.js +84 -83
  43. package/dist/shared/components/layout-editor/useLayoutDraft.js +47 -42
  44. package/dist/shared/components/monitoring/InactiveUserLinksView.js +10 -9
  45. package/dist/shared/components/panels/SlaClock.js +35 -36
  46. package/dist/shared/components/pipeline/PipelineEditorView.js +311 -312
  47. package/dist/shared/components/pipeline/TeamSuggestions.js +31 -30
  48. package/dist/shared/components/profile/AgentsPanel.js +73 -72
  49. package/dist/shared/components/profile/MailSuppressedPill.js +22 -21
  50. package/dist/shared/components/support/SupportRequestDialog.js +85 -81
  51. package/dist/shared/components/support/SupportView.js +94 -87
  52. package/dist/shared/lib/autofill-poll.js +21 -18
  53. package/dist/shared/lib/error-actions.js +85 -0
  54. package/dist/shared/lib/error-message.js +223 -82
  55. package/dist/shared/lib/error-toast.js +71 -13
  56. package/dist/shared/lib/safe-error.js +136 -38
  57. package/package.json +1 -1
@@ -1,30 +1,31 @@
1
- import { jsx as t, jsxs as l, Fragment as R } from "react/jsx-runtime";
2
- import { useQueryClient as B } from "@tanstack/react-query";
3
- import { Loader2 as K, Film as z, Link2 as E, Download as G, Trash2 as S, Plus as H } from "lucide-react";
4
- import { memo as I, useId as O, useState as T, useRef as U, useEffect as _ } from "react";
1
+ import { jsx as t, jsxs as l, Fragment as B } from "react/jsx-runtime";
2
+ import { useQueryClient as E } from "@tanstack/react-query";
3
+ import { Loader2 as K, Film as z, Link2 as G, Download as S, Trash2 as H, Plus as I } from "lucide-react";
4
+ import { memo as O, useId as U, useState as T, useRef as _, useEffect as J } from "react";
5
5
  import { toast as A } from "sonner";
6
- import { useApiFetchConfig as J, useNivaroClient as W } from "../../../context.js";
7
- import { Button as X } from "../../ui/button.js";
8
- import { useHelpVideoClips as Y, helpVideoKeys as u, helpVideoApi as Z } from "../api.js";
6
+ import { useApiFetchConfig as W, useNivaroClient as X } from "../../../context.js";
7
+ import { userErrorMessage as F } from "../../../lib/safe-error.js";
8
+ import { Button as Y } from "../../ui/button.js";
9
+ import { useHelpVideoClips as Z, helpVideoKeys as u, helpVideoApi as q } from "../api.js";
9
10
  import { CLIP_LIMITS as k } from "../types.js";
10
- import { ClipDialog as q } from "./ClipDialog.js";
11
- import { clipLink as ee, clipMeta as te } from "./clips.js";
12
- async function ie(s) {
11
+ import { ClipDialog as ee } from "./ClipDialog.js";
12
+ import { clipLink as te, clipMeta as ie } from "./clips.js";
13
+ async function ae(r) {
13
14
  try {
14
- await navigator.clipboard.writeText(s), A.success("Link copied");
15
+ await navigator.clipboard.writeText(r), A.success("Link copied");
15
16
  } catch {
16
- A(s, { description: "Copy this link", duration: 15e3 });
17
+ A(r, { description: "Copy this link", duration: 15e3 });
17
18
  }
18
19
  }
19
20
  const C = "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors duration-150 hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:pointer-events-none disabled:opacity-40 motion-reduce:transition-none";
20
- function ae({
21
- clips: s,
21
+ function ne({
22
+ clips: r,
22
23
  onDelete: c,
23
24
  deleting: n
24
25
  }) {
25
- const { apiBase: m } = J(), h = typeof window > "u" ? "" : window.location.origin;
26
- return /* @__PURE__ */ t("ul", { className: "-mx-1.5 space-y-px", "data-hv-clip-rows": s.length, children: s.map((e) => {
27
- const r = e.url ? ee(m, e.url, h) : null, f = e.status === "queued" || e.status === "rendering";
26
+ const { apiBase: m } = W(), h = typeof window > "u" ? "" : window.location.origin;
27
+ return /* @__PURE__ */ t("ul", { className: "-mx-1.5 space-y-px", "data-hv-clip-rows": r.length, children: r.map((e) => {
28
+ const s = e.url ? te(m, e.url, h) : null, f = e.status === "queued" || e.status === "rendering";
28
29
  return /* @__PURE__ */ l(
29
30
  "li",
30
31
  {
@@ -46,34 +47,34 @@ function ae({
46
47
  {
47
48
  className: `truncate text-[12px] ${e.status === "failed" ? "text-rose-700 dark:text-rose-300" : "text-muted-foreground"}`,
48
49
  "data-hv-clip-meta": !0,
49
- children: te(e)
50
+ children: ie(e)
50
51
  }
51
52
  )
52
53
  ] }),
53
- r && /* @__PURE__ */ l(R, { children: [
54
+ s && /* @__PURE__ */ l(B, { children: [
54
55
  /* @__PURE__ */ t(
55
56
  "button",
56
57
  {
57
58
  type: "button",
58
59
  className: C,
59
- onClick: () => void ie(r),
60
+ onClick: () => void ae(s),
60
61
  "aria-label": `Copy link to ${e.label || "clip"}`,
61
62
  title: "Copy link",
62
63
  "data-hv-clip-copy": e.id,
63
- "data-hv-clip-url": r,
64
- children: /* @__PURE__ */ t(E, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
64
+ "data-hv-clip-url": s,
65
+ children: /* @__PURE__ */ t(G, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
65
66
  }
66
67
  ),
67
68
  /* @__PURE__ */ t(
68
69
  "a",
69
70
  {
70
- href: `${r}&download=1`,
71
+ href: `${s}&download=1`,
71
72
  download: !0,
72
73
  className: C,
73
74
  "aria-label": `Download ${e.label || "clip"} (${e.kind.toUpperCase()})`,
74
75
  title: "Download",
75
76
  "data-hv-clip-download": e.id,
76
- children: /* @__PURE__ */ t(G, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
77
+ children: /* @__PURE__ */ t(S, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
77
78
  }
78
79
  )
79
80
  ] }),
@@ -87,7 +88,7 @@ function ae({
87
88
  "aria-label": `Delete ${e.label || "clip"}`,
88
89
  title: "Delete",
89
90
  "data-hv-clip-delete": e.id,
90
- children: /* @__PURE__ */ t(S, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
91
+ children: /* @__PURE__ */ t(H, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
91
92
  }
92
93
  )
93
94
  ]
@@ -96,40 +97,40 @@ function ae({
96
97
  );
97
98
  }) });
98
99
  }
99
- const ge = I(function({
100
+ const ye = O(function({
100
101
  headless: c,
101
102
  videoId: n,
102
103
  edits: m,
103
104
  draft: h,
104
105
  presets: e,
105
- initialRange: r,
106
+ initialRange: s,
106
107
  playheadRange: f,
107
108
  request: d,
108
109
  onNote: g
109
110
  }) {
110
- const F = W(), p = B(), N = O(), x = Y(n), [y, D] = T(
111
+ const V = X(), p = E(), N = U(), x = Z(n), [y, D] = T(
111
112
  null
112
- ), [V, P] = T(null), v = x.data ?? [], $ = v.filter((i) => i.status !== "failed").length >= k.maxPerVideo, b = (i) => {
113
+ ), [j, M] = T(null), v = x.data ?? [], P = v.filter((i) => i.status !== "failed").length >= k.maxPerVideo, b = (i) => {
113
114
  var Q;
114
115
  const a = f(), o = e();
115
- a && o.push({ key: "playhead", label: "Around the playhead", range: a }), D({ initial: i ?? r() ?? ((Q = o[0]) == null ? void 0 : Q.range) ?? a, presets: o });
116
- }, M = U(b);
117
- M.current = b;
116
+ a && o.push({ key: "playhead", label: "Around the playhead", range: a }), D({ initial: i ?? s() ?? ((Q = o[0]) == null ? void 0 : Q.range) ?? a, presets: o });
117
+ }, $ = _(b);
118
+ $.current = b;
118
119
  const L = (d == null ? void 0 : d.n) ?? 0, w = (d == null ? void 0 : d.range) ?? null;
119
- _(() => {
120
- L > 0 && w && M.current(w);
120
+ J(() => {
121
+ L > 0 && w && $.current(w);
121
122
  }, [L, w]);
122
- const j = async (i) => {
123
- P(i.id);
123
+ const R = async (i) => {
124
+ M(i.id);
124
125
  try {
125
- await Z(F).deleteClip(n, i.id), p.setQueryData(
126
+ await q(V).deleteClip(n, i.id), p.setQueryData(
126
127
  u.clips(n),
127
128
  (a) => a == null ? void 0 : a.filter((o) => o.id !== i.id)
128
129
  );
129
130
  } catch (a) {
130
- g == null || g(`The clip could not be deleted. ${a.message}`);
131
+ g == null || g(`The clip could not be deleted. ${F(a, "")}`);
131
132
  } finally {
132
- P(null), p.invalidateQueries({ queryKey: u.clips(n) });
133
+ M(null), p.invalidateQueries({ queryKey: u.clips(n) });
133
134
  }
134
135
  };
135
136
  return /* @__PURE__ */ l("section", { className: "space-y-2", "aria-labelledby": N, "data-hv-clips": !0, children: [
@@ -143,17 +144,17 @@ const ge = I(function({
143
144
  }
144
145
  ),
145
146
  /* @__PURE__ */ l(
146
- X,
147
+ Y,
147
148
  {
148
149
  size: "sm",
149
150
  variant: "outline",
150
151
  className: "h-8 text-[12.5px]",
151
152
  onClick: () => b(),
152
- disabled: $,
153
- title: $ ? `A video can have at most ${k.maxPerVideo} clips` : "Make a short MP4 or GIF of a chapter, the selection or a range",
153
+ disabled: P,
154
+ title: P ? `A video can have at most ${k.maxPerVideo} clips` : "Make a short MP4 or GIF of a chapter, the selection or a range",
154
155
  "data-hv-make-clip": !0,
155
156
  children: [
156
- /* @__PURE__ */ t(H, { className: "!size-3.5", "aria-hidden": !0 }),
157
+ /* @__PURE__ */ t(I, { className: "!size-3.5", "aria-hidden": !0 }),
157
158
  " Make a clip"
158
159
  ]
159
160
  }
@@ -161,15 +162,15 @@ const ge = I(function({
161
162
  ] }),
162
163
  x.error ? /* @__PURE__ */ l("p", { className: "text-[12px] text-rose-700 dark:text-rose-300", children: [
163
164
  "The clips could not be loaded. ",
164
- x.error.message
165
+ F(x.error, "")
165
166
  ] }) : v.length === 0 ? /* @__PURE__ */ l("p", { className: "text-[12px] leading-snug text-muted-foreground", children: [
166
167
  "A clip is a short MP4 or GIF of a chapter, the selected piece or any range up to",
167
168
  " ",
168
169
  k.maxMs / 1e3,
169
170
  " seconds, with a link to paste into chat, a document or mail. Everyone who can watch the video can open it."
170
- ] }) : /* @__PURE__ */ t(ae, { clips: v, onDelete: (i) => void j(i), deleting: V }),
171
+ ] }) : /* @__PURE__ */ t(ne, { clips: v, onDelete: (i) => void R(i), deleting: j }),
171
172
  y && /* @__PURE__ */ t(
172
- q,
173
+ ee,
173
174
  {
174
175
  videoId: n,
175
176
  edits: m,
@@ -188,6 +189,6 @@ const ge = I(function({
188
189
  ] });
189
190
  });
190
191
  export {
191
- ae as ClipRows,
192
- ge as ClipsPanel
192
+ ne as ClipRows,
193
+ ye as ClipsPanel
193
194
  };
@@ -4,57 +4,58 @@ import { AlertCircle as G } from "lucide-react";
4
4
  import { useState as r } from "react";
5
5
  import { toast as H } from "sonner";
6
6
  import { useNivaroClient as I } from "../../../context.js";
7
+ import { userErrorMessage as E } from "../../../lib/safe-error.js";
7
8
  import { Button as g } from "../../ui/button.js";
8
- import { Checkbox as M } from "../../ui/checkbox.js";
9
+ import { Checkbox as J } from "../../ui/checkbox.js";
9
10
  import { Label as O } from "../../ui/label.js";
10
- import { Popover as J, PopoverTrigger as X, PopoverContent as Y } from "../../ui/popover.js";
11
- import { Textarea as Z } from "../../ui/textarea.js";
12
- import { helpVideoApi as E, helpVideoKeys as f } from "../api.js";
13
- import { missingForPublish as ee, renderLabel as te, viewersWaitForRender as ae, describeMissing as se, whenSaved as ne } from "./publish.js";
14
- import { UnsavedNote as ie } from "./UnsavedNote.js";
15
- const re = {
11
+ import { Popover as X, PopoverTrigger as Y, PopoverContent as Z } from "../../ui/popover.js";
12
+ import { Textarea as ee } from "../../ui/textarea.js";
13
+ import { helpVideoApi as K, helpVideoKeys as f } from "../api.js";
14
+ import { missingForPublish as te, renderLabel as ae, viewersWaitForRender as se, describeMissing as ne, whenSaved as ie } from "./publish.js";
15
+ import { UnsavedNote as re } from "./UnsavedNote.js";
16
+ const oe = {
16
17
  neutral: "text-muted-foreground",
17
18
  busy: "text-sky-800 dark:text-sky-300",
18
19
  good: "text-emerald-800 dark:text-emerald-300",
19
20
  bad: "text-rose-700 dark:text-rose-300"
20
21
  }, le = "No changes since the last publish";
21
- function Ne({
22
+ function Ce({
22
23
  video: e,
23
- edits: K,
24
- pending: Q = !1,
25
- beforePublish: S,
26
- onPublished: j,
27
- conflict: B = !1,
28
- onReload: L = () => {
24
+ edits: Q,
25
+ pending: S = !1,
26
+ beforePublish: j,
27
+ onPublished: B,
28
+ conflict: L = !1,
29
+ onReload: U = () => {
29
30
  }
30
31
  }) {
31
32
  var $, _, T, F, q;
32
- const x = I(), u = D(), [U, m] = r(!1), [b, w] = r(!1), [v, y] = r(!1), [V, o] = r(!1), [N, l] = r(null), [k, C] = r(""), h = ee(e), p = te(e.published), i = e.status === "published", d = ((($ = e.required_role_ids) == null ? void 0 : $.length) ?? 0) > 0 && i, c = i && !!e.draft_matches_published && !Q, n = c && d, A = K ?? ((_ = e.draft) == null ? void 0 : _.edits), P = !!A && ae(A, ((T = e.draft) == null ? void 0 : T.source_duration_ms) ?? null), z = async () => {
33
- y(!0), l(null), o(!1);
33
+ const x = I(), u = D(), [V, m] = r(!1), [b, w] = r(!1), [v, y] = r(!1), [z, l] = r(!1), [N, o] = r(null), [k, C] = r(""), h = te(e), p = ae(e.published), i = e.status === "published", d = ((($ = e.required_role_ids) == null ? void 0 : $.length) ?? 0) > 0 && i, c = i && !!e.draft_matches_published && !S, n = c && d, A = Q ?? ((_ = e.draft) == null ? void 0 : _.edits), P = !!A && se(A, ((T = e.draft) == null ? void 0 : T.source_duration_ms) ?? null), M = async () => {
34
+ y(!0), o(null), l(!1);
34
35
  try {
35
- if (!(await ne(
36
- S,
37
- () => E(x).publish(e.id, n || b, i ? k : void 0)
36
+ if (!(await ie(
37
+ j,
38
+ () => K(x).publish(e.id, n || b, i ? k : void 0)
38
39
  )).ok) {
39
- o(!0);
40
+ l(!0);
40
41
  return;
41
42
  }
42
- H.success(n ? "Everyone who must watch it is asked again" : "Published"), m(!1), w(!1), C(""), u.invalidateQueries({ queryKey: f.all }), u.invalidateQueries({ queryKey: f.one(e.id) }), j();
43
+ H.success(n ? "Everyone who must watch it is asked again" : "Published"), m(!1), w(!1), C(""), u.invalidateQueries({ queryKey: f.all }), u.invalidateQueries({ queryKey: f.one(e.id) }), B();
43
44
  } catch (a) {
44
- l(`It couldn't be published. ${a.message}`);
45
+ o(`It couldn't be published. ${E(a, "")}`);
45
46
  } finally {
46
47
  y(!1);
47
48
  }
48
49
  }, R = () => {
49
- l(null), o(!1), E(x).rerender(e.id).then(() => u.invalidateQueries({ queryKey: f.one(e.id) })).catch((a) => {
50
- l(`The render couldn't start. ${a.message}`), m(!0);
50
+ o(null), l(!1), K(x).rerender(e.id).then(() => u.invalidateQueries({ queryKey: f.one(e.id) })).catch((a) => {
51
+ o(`The render couldn't start. ${E(a, "")}`), m(!0);
51
52
  });
52
53
  };
53
54
  return /* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 flex-wrap items-center justify-end gap-x-2 gap-y-1 sm:flex-none", children: [
54
55
  /* @__PURE__ */ t(
55
56
  "span",
56
57
  {
57
- className: `min-w-0 basis-full text-right text-[12px] sm:basis-auto ${re[p.tone]}`,
58
+ className: `min-w-0 basis-full text-right text-[12px] sm:basis-auto ${oe[p.tone]}`,
58
59
  title: p.text,
59
60
  "data-hv-render-status": ((F = e.published) == null ? void 0 : F.render_status) ?? "none",
60
61
  children: p.text
@@ -62,11 +63,11 @@ function Ne({
62
63
  ),
63
64
  ((q = e.published) == null ? void 0 : q.render_status) === "failed" && /* @__PURE__ */ t(g, { size: "sm", variant: "ghost", className: "h-8", onClick: R, children: "Render again" }),
64
65
  /* @__PURE__ */ s(
65
- J,
66
+ X,
66
67
  {
67
- open: U,
68
+ open: V,
68
69
  onOpenChange: (a) => {
69
- m(a), a && (l(null), o(!1));
70
+ m(a), a && (o(null), l(!1));
70
71
  },
71
72
  children: [
72
73
  c && /* @__PURE__ */ t(
@@ -78,7 +79,7 @@ function Ne({
78
79
  children: le
79
80
  }
80
81
  ),
81
- /* @__PURE__ */ t(X, { asChild: !0, children: /* @__PURE__ */ t(
82
+ /* @__PURE__ */ t(Y, { asChild: !0, children: /* @__PURE__ */ t(
82
83
  g,
83
84
  {
84
85
  size: "sm",
@@ -89,15 +90,15 @@ function Ne({
89
90
  children: n ? "Ask to watch again" : i ? "Publish changes" : "Publish"
90
91
  }
91
92
  ) }),
92
- /* @__PURE__ */ s(Y, { align: "end", className: "w-[300px] space-y-3 text-[13px]", children: [
93
+ /* @__PURE__ */ s(Z, { align: "end", className: "w-[300px] space-y-3 text-[13px]", children: [
93
94
  n ? /* @__PURE__ */ t("p", { "data-hv-publish-again-only": !0, children: "Nothing changed since the last publish. Everyone who must watch this video will be asked to watch it again. The video itself stays as it is." }) : h.length ? /* @__PURE__ */ s("p", { "data-hv-publish-missing": !0, children: [
94
- se(h),
95
+ ne(h),
95
96
  " (Details tab)."
96
97
  ] }) : /* @__PURE__ */ s(W, { children: [
97
98
  /* @__PURE__ */ t("p", { "data-hv-publish-copy": P ? "waits" : "now", children: P ? `This version hides or cuts part of the recording, so viewers get it once it finishes rendering, usually within a few minutes. Until then the video shows as getting ready${i ? " and the current version can’t be watched either" : ""}.` : "Viewers get this version straight away. The finished video renders in the background." }),
98
99
  d && /* @__PURE__ */ s("div", { className: "flex items-start gap-2", children: [
99
100
  /* @__PURE__ */ t(
100
- M,
101
+ J,
101
102
  {
102
103
  id: `hv-watch-again-${e.id}`,
103
104
  checked: b,
@@ -129,7 +130,7 @@ function Ne({
129
130
  }
130
131
  ),
131
132
  /* @__PURE__ */ t(
132
- Z,
133
+ ee,
133
134
  {
134
135
  id: `hv-change-note-${e.id}`,
135
136
  value: k,
@@ -147,7 +148,7 @@ function Ne({
147
148
  "."
148
149
  ] })
149
150
  ] }),
150
- V && /* @__PURE__ */ t(ie, { conflict: B, onReload: L, "data-hv-publish-note": !0 }),
151
+ z && /* @__PURE__ */ t(re, { conflict: L, onReload: U, "data-hv-publish-note": !0 }),
151
152
  N && /* @__PURE__ */ s(
152
153
  "p",
153
154
  {
@@ -165,7 +166,7 @@ function Ne({
165
166
  {
166
167
  className: "w-full",
167
168
  disabled: v,
168
- onClick: () => void z(),
169
+ onClick: () => void M(),
169
170
  "data-hv-publish-confirm": !0,
170
171
  children: v ? n ? "Asking…" : "Publishing…" : n ? "Ask to watch again" : "Publish"
171
172
  }
@@ -178,5 +179,5 @@ function Ne({
178
179
  }
179
180
  export {
180
181
  le as NO_CHANGES,
181
- Ne as PublishButton
182
+ Ce as PublishButton
182
183
  };
@@ -1,23 +1,24 @@
1
1
  import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
- import { useQuery as D, useQueryClient as Q, useMutation as I } from "@tanstack/react-query";
3
- import { AlertCircle as R, RotateCw as W, ThumbsUp as L, ThumbsDown as P, CornerDownRight as K } from "lucide-react";
2
+ import { useQuery as Q, useQueryClient as I, useMutation as R } from "@tanstack/react-query";
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
+ import { userErrorMessage as F } from "../../../lib/safe-error.js";
6
7
  import { Button as v } from "../../ui/button.js";
7
8
  import { Checkbox as $ } from "../../ui/checkbox.js";
8
- import { Skeleton as A } from "../../ui/skeleton.js";
9
- import { Textarea as U } from "../../ui/textarea.js";
10
- import { helpVideoApi as F } from "../api.js";
11
- import { fmtMoment as V } from "../viewer/feedback.js";
12
- const M = 2e3;
13
- function se({
9
+ import { Skeleton as M } from "../../ui/skeleton.js";
10
+ import { Textarea as V } from "../../ui/textarea.js";
11
+ import { helpVideoApi as j } from "../api.js";
12
+ import { fmtMoment as Y } from "../viewer/feedback.js";
13
+ const A = 2e3;
14
+ function ne({
14
15
  video: c,
15
16
  onJump: a,
16
17
  onAnswerEdit: h
17
18
  }) {
18
- const i = T(), u = D({
19
+ const i = T(), u = Q({
19
20
  queryKey: ["help-videos", "analytics", c.id],
20
- queryFn: () => F(i).analytics(c.id)
21
+ queryFn: () => j(i).analytics(c.id)
21
22
  }), r = u.data;
22
23
  if (u.error)
23
24
  return /* @__PURE__ */ t(
@@ -26,13 +27,13 @@ function se({
26
27
  className: "flex items-center gap-2 p-5 text-[13px] text-rose-700 dark:text-rose-300",
27
28
  role: "alert",
28
29
  children: [
29
- /* @__PURE__ */ e(R, { className: "h-4 w-4", "aria-hidden": !0 }),
30
+ /* @__PURE__ */ e(W, { className: "h-4 w-4", "aria-hidden": !0 }),
30
31
  /* @__PURE__ */ t("span", { children: [
31
32
  "The stats couldn't load. ",
32
- u.error.message
33
+ F(u.error, "")
33
34
  ] }),
34
35
  /* @__PURE__ */ t(v, { size: "sm", variant: "outline", className: "h-7", onClick: () => void u.refetch(), children: [
35
- /* @__PURE__ */ e(W, { className: "!size-3.5" }),
36
+ /* @__PURE__ */ e(L, { className: "!size-3.5" }),
36
37
  " Try again"
37
38
  ] })
38
39
  ]
@@ -47,13 +48,13 @@ function se({
47
48
  "aria-busy": "true",
48
49
  "aria-label": "Loading stats",
49
50
  children: [
50
- /* @__PURE__ */ e(A, { className: "h-16 w-full" }),
51
- /* @__PURE__ */ e(A, { className: "h-28 w-full" })
51
+ /* @__PURE__ */ e(M, { className: "h-16 w-full" }),
52
+ /* @__PURE__ */ e(M, { className: "h-28 w-full" })
52
53
  ]
53
54
  }
54
55
  );
55
- const l = r.ratings ?? { up: 0, down: 0, helpful_rate: 0 }, o = r.questions ?? [], m = l.up + l.down;
56
- return !r.unique_viewers && !m && !o.length ? /* @__PURE__ */ t("div", { className: "max-w-[65ch] space-y-1 p-5 text-[13px]", "data-hv-stats-empty": !0, children: [
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
58
  /* @__PURE__ */ e("p", { className: "font-medium text-foreground", children: "Nobody has watched this yet." }),
58
59
  /* @__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." })
59
60
  ] }) : /* @__PURE__ */ t("div", { className: "max-w-[760px] space-y-6 p-5 text-[13px]", "data-hv-stats": !0, children: [
@@ -66,24 +67,24 @@ function se({
66
67
  /* @__PURE__ */ e("dt", { className: "text-[12px] text-muted-foreground", children: s }),
67
68
  /* @__PURE__ */ e("dd", { className: "text-[18px] font-semibold tabular-nums text-foreground", children: n })
68
69
  ] }, s)),
69
- /* @__PURE__ */ t("div", { className: "bg-card p-3", "data-hv-stats-ratings": `${l.up}/${l.down}`, children: [
70
+ /* @__PURE__ */ t("div", { className: "bg-card p-3", "data-hv-stats-ratings": `${o.up}/${o.down}`, children: [
70
71
  /* @__PURE__ */ e("dt", { className: "text-[12px] text-muted-foreground", children: "Found it helpful" }),
71
- /* @__PURE__ */ e("dd", { className: "text-[18px] font-semibold tabular-nums text-foreground", children: m ? `${Math.round(l.helpful_rate * 100)}%` : "—" }),
72
+ /* @__PURE__ */ e("dd", { className: "text-[18px] font-semibold tabular-nums text-foreground", children: m ? `${Math.round(o.helpful_rate * 100)}%` : "—" }),
72
73
  /* @__PURE__ */ t("dd", { className: "flex items-center gap-2 text-[12px] text-muted-foreground", children: [
73
74
  /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1", children: [
74
- /* @__PURE__ */ e(L, { className: "h-3 w-3", "aria-hidden": !0 }),
75
+ /* @__PURE__ */ e(P, { className: "h-3 w-3", "aria-hidden": !0 }),
75
76
  " ",
76
- l.up
77
+ o.up
77
78
  ] }),
78
79
  /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1", children: [
79
- /* @__PURE__ */ e(P, { className: "h-3 w-3", "aria-hidden": !0 }),
80
+ /* @__PURE__ */ e(K, { className: "h-3 w-3", "aria-hidden": !0 }),
80
81
  " ",
81
- l.down
82
+ o.down
82
83
  ] }),
83
84
  /* @__PURE__ */ t("span", { className: "sr-only", children: [
84
- l.up,
85
+ o.up,
85
86
  " found it helpful, ",
86
- l.down,
87
+ o.down,
87
88
  " did not"
88
89
  ] })
89
90
  ] })
@@ -125,13 +126,13 @@ function se({
125
126
  /* @__PURE__ */ e("span", { children: "End" })
126
127
  ] })
127
128
  ] }),
128
- /* @__PURE__ */ t("section", { "data-hv-stats-questions": o.length, children: [
129
+ /* @__PURE__ */ t("section", { "data-hv-stats-questions": l.length, children: [
129
130
  /* @__PURE__ */ t("h3", { className: "mb-2 text-[13px] font-semibold text-foreground", children: [
130
131
  "Questions",
131
- o.length ? ` (${o.length})` : ""
132
+ l.length ? ` (${l.length})` : ""
132
133
  ] }),
133
- o.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: o.map((s) => /* @__PURE__ */ e(
134
- Y,
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
136
  {
136
137
  video: c,
137
138
  item: s,
@@ -143,14 +144,14 @@ function se({
143
144
  ] })
144
145
  ] });
145
146
  }
146
- function Y({
147
+ function B({
147
148
  video: c,
148
149
  item: a,
149
150
  onJump: h,
150
151
  onAnswerEdit: i
151
152
  }) {
152
- const u = T(), r = Q(), [l, o] = x(!1), [m, s] = x(""), [n, j] = x(!1), [C, z] = x(!1), [_, g] = x(null), k = y(), q = y(), S = y(), N = V(a.at_ms), b = I({
153
- mutationFn: (d) => F(u).answer(c.id, a.id, d),
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),
154
155
  onSuccess: (d, p) => {
155
156
  const w = [];
156
157
  if (n && i) {
@@ -161,9 +162,9 @@ function Y({
161
162
  const f = i("caption", a.at_ms, p);
162
163
  f && w.push(`Caption: ${f}`);
163
164
  }
164
- g(w.length ? w.join(" · ") : null), o(!1), s(""), r.invalidateQueries({ queryKey: ["help-videos", "analytics", c.id] });
165
+ g(w.length ? w.join(" · ") : null), l(!1), s(""), r.invalidateQueries({ queryKey: ["help-videos", "analytics", c.id] });
165
166
  },
166
- onError: (d) => g(d.message || "The answer was not saved.")
167
+ onError: (d) => g(F(d, "The answer was not saved."))
167
168
  });
168
169
  return /* @__PURE__ */ t(
169
170
  "li",
@@ -196,7 +197,7 @@ function Y({
196
197
  /* @__PURE__ */ e("p", { className: "mt-1 whitespace-pre-line text-foreground", children: a.text }),
197
198
  a.answer && /* @__PURE__ */ t("p", { className: "mt-1.5 flex gap-1.5 whitespace-pre-line border-l-2 border-nvr-cyan pl-2 text-foreground", children: [
198
199
  /* @__PURE__ */ e(
199
- K,
200
+ U,
200
201
  {
201
202
  className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground",
202
203
  "aria-hidden": !0
@@ -210,7 +211,7 @@ function Y({
210
211
  a.answer
211
212
  ] })
212
213
  ] }),
213
- l ? /* @__PURE__ */ t(
214
+ o ? /* @__PURE__ */ t(
214
215
  "form",
215
216
  {
216
217
  className: "mt-2 space-y-1.5",
@@ -227,13 +228,13 @@ function Y({
227
228
  children: [
228
229
  /* @__PURE__ */ e("label", { htmlFor: k, className: "sr-only", children: "Your answer" }),
229
230
  /* @__PURE__ */ e(
230
- U,
231
+ V,
231
232
  {
232
233
  id: k,
233
234
  value: m,
234
235
  onChange: (d) => s(d.target.value),
235
236
  rows: 3,
236
- maxLength: M,
237
+ maxLength: A,
237
238
  placeholder: "Your answer (the person who asked is notified)",
238
239
  className: "text-[13px]"
239
240
  }
@@ -245,7 +246,7 @@ function Y({
245
246
  {
246
247
  id: q,
247
248
  checked: n,
248
- onCheckedChange: (d) => j(d === !0),
249
+ onCheckedChange: (d) => z(d === !0),
249
250
  "data-hv-answer-chapter": !0
250
251
  }
251
252
  ),
@@ -258,7 +259,7 @@ function Y({
258
259
  {
259
260
  id: S,
260
261
  checked: C,
261
- onCheckedChange: (d) => z(d === !0),
262
+ onCheckedChange: (d) => D(d === !0),
262
263
  "data-hv-answer-caption": !0
263
264
  }
264
265
  ),
@@ -285,14 +286,14 @@ function Y({
285
286
  size: "sm",
286
287
  variant: "ghost",
287
288
  className: "h-7",
288
- onClick: () => o(!1),
289
+ onClick: () => l(!1),
289
290
  children: "Cancel"
290
291
  }
291
292
  ),
292
293
  /* @__PURE__ */ t("span", { className: "ml-auto text-[12px] tabular-nums text-muted-foreground", children: [
293
294
  m.length,
294
295
  "/",
295
- M
296
+ A
296
297
  ] })
297
298
  ] })
298
299
  ]
@@ -304,7 +305,7 @@ function Y({
304
305
  variant: "outline",
305
306
  className: "h-7 text-[12px]",
306
307
  onClick: () => {
307
- g(null), s(a.answer ?? ""), o(!0);
308
+ g(null), s(a.answer ?? ""), l(!0);
308
309
  },
309
310
  "data-hv-answer-open": !0,
310
311
  children: a.answer ? "Change the answer" : "Answer"
@@ -324,5 +325,5 @@ function Y({
324
325
  );
325
326
  }
326
327
  export {
327
- se as StatsTab
328
+ ne as StatsTab
328
329
  };