@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,66 +1,69 @@
1
- import { jsxs as n, jsx as t, Fragment as T } from "react/jsx-runtime";
2
- import { useQueryClient as $, useQuery as f, useMutation as S } from "@tanstack/react-query";
3
- import { Plus as V, Search as P, LifeBuoy as I } from "lucide-react";
4
- import { useState as c, useRef as U, useEffect as M } from "react";
5
- import { useNivaroClient as R, useItemEditAuth as W } from "../../context.js";
6
- import { get as v, patch as Y, post as z, del as H } from "../../lib/commands.js";
7
- import { useLiveOps as J } from "../../lib/live-ops.js";
8
- import { RelationCombobox as X } from "../item-edit/RelationCombobox.js";
9
- import { SimpleSelect as Z } from "../ui/SimpleSelect.js";
10
- import { SupportAnalytics as ee } from "./SupportAnalytics.js";
11
- import { SupportRequestDialog as te } from "./SupportRequestDialog.js";
12
- import { StatusPill as ae, TicketDetailSheet as re } from "./TicketDetailSheet.js";
13
- function se(l) {
1
+ import { jsxs as n, jsx as t, Fragment as P } from "react/jsx-runtime";
2
+ import { useQueryClient as R, useQuery as v, useMutation as _ } from "@tanstack/react-query";
3
+ import { Plus as I, Search as U, LifeBuoy as W } from "lucide-react";
4
+ import { useState as c, useRef as Y, useEffect as $ } from "react";
5
+ import { useNivaroClient as Q, useItemEditAuth as z } from "../../context.js";
6
+ import { get as k, patch as H, post as J, del as X } from "../../lib/commands.js";
7
+ import { takeSupportDraft as Z } from "../../lib/error-actions.js";
8
+ import { useLiveOps as ee } from "../../lib/live-ops.js";
9
+ import { RelationCombobox as te } from "../item-edit/RelationCombobox.js";
10
+ import { SimpleSelect as ae } from "../ui/SimpleSelect.js";
11
+ import { SupportAnalytics as re } from "./SupportAnalytics.js";
12
+ import { SupportRequestDialog as se } from "./SupportRequestDialog.js";
13
+ import { StatusPill as ne, TicketDetailSheet as le } from "./TicketDetailSheet.js";
14
+ function oe(l) {
14
15
  if (!l) return "";
15
16
  const i = Math.round((Date.now() - new Date(l).getTime()) / 6e4);
16
17
  if (i < 60) return `${Math.max(i, 1)}m ago`;
17
18
  const d = Math.round(i / 60);
18
19
  return d < 48 ? `${d}h ago` : `${Math.round(d / 24)}d ago`;
19
20
  }
20
- function ye({
21
+ function Ne({
21
22
  initialTicketId: l,
22
23
  onTicketChange: i,
23
24
  className: d
24
25
  }) {
25
- const p = R(), m = $(), h = W(), x = !!(h != null && h.isAdmin), [s, b] = c("mine"), y = U(!1), a = (e) => {
26
- y.current = !0, b(e);
27
- }, [r, _] = c(l ?? null), [Q, C] = c(!1), [k, A] = c("open"), [g, O] = c("unassigned"), [N, j] = c("");
28
- M(() => {
29
- l != null && _(l);
26
+ const m = Q(), h = R(), x = z(), b = !!(x != null && x.isAdmin), [s, g] = c("mine"), f = Y(!1), a = (e) => {
27
+ f.current = !0, g(e);
28
+ }, [r, C] = c(l ?? null), [p, O] = c(
29
+ () => typeof window < "u" && /[?&]new=1\b/.test(window.location.search) ? Z() : null
30
+ ), [T, A] = c(!!p), [N, D] = c("open"), [y, j] = c("unassigned"), [w, B] = c("");
31
+ $(() => {
32
+ l != null && C(l);
30
33
  }, [l]);
31
- const { data: o } = f({
34
+ const { data: o } = v({
32
35
  queryKey: ["support-summary"],
33
- queryFn: () => p.request(v("/support/summary")).then((e) => e.data)
36
+ queryFn: () => m.request(k("/support/summary")).then((e) => e.data)
34
37
  }), F = !!(o != null && o.desk);
35
- J("support", () => {
36
- m.invalidateQueries({ queryKey: ["support-tickets"] }), m.invalidateQueries({ queryKey: ["support-summary"] }), m.invalidateQueries({ queryKey: ["support-ticket"] });
38
+ ee("support", () => {
39
+ h.invalidateQueries({ queryKey: ["support-tickets"] }), h.invalidateQueries({ queryKey: ["support-summary"] }), h.invalidateQueries({ queryKey: ["support-ticket"] });
37
40
  });
38
- const [D, B] = c(!1);
39
- M(() => {
40
- !D && o && (o.desk && !y.current && b("desk"), B(!0));
41
- }, [o, D]);
42
- const w = s === "desk" ? {
41
+ const [K, E] = c(!1);
42
+ $(() => {
43
+ !K && o && (o.desk && !f.current && g("desk"), E(!0));
44
+ }, [o, K]);
45
+ const q = s === "desk" ? {
43
46
  scope: "desk",
44
- status: g === "closed" ? "closed" : "open",
45
- ...g === "unassigned" ? { assignee: "unassigned" } : {},
46
- ...g === "me" ? { assignee: "me" } : {}
47
- } : { scope: "mine", status: k };
48
- N.trim() && (w.q = N.trim());
49
- const { data: u, isLoading: E } = f({
50
- queryKey: ["support-tickets", w],
51
- queryFn: () => p.request(v("/support/tickets", w)),
47
+ status: y === "closed" ? "closed" : "open",
48
+ ...y === "unassigned" ? { assignee: "unassigned" } : {},
49
+ ...y === "me" ? { assignee: "me" } : {}
50
+ } : { scope: "mine", status: N };
51
+ w.trim() && (q.q = w.trim());
52
+ const { data: u, isLoading: G } = v({
53
+ queryKey: ["support-tickets", q],
54
+ queryFn: () => m.request(k("/support/tickets", q)),
52
55
  enabled: s !== "types" && s !== "analytics"
53
- }), q = (e) => {
54
- _(e), i == null || i(e);
55
- }, G = [
56
+ }), S = (e) => {
57
+ C(e), i == null || i(e);
58
+ }, L = [
56
59
  { key: "mine", label: "My requests", count: o == null ? void 0 : o.mine_open },
57
60
  ...F ? [{ key: "desk", label: "Desk", count: o == null ? void 0 : o.unassigned }] : [],
58
61
  ...F ? [{ key: "analytics", label: "Analytics" }] : [],
59
- ...x ? [{ key: "types", label: "Request types" }] : []
62
+ ...b ? [{ key: "types", label: "Request types" }] : []
60
63
  ];
61
64
  return /* @__PURE__ */ n("div", { className: d, "data-support-view": !0, children: [
62
65
  /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
63
- /* @__PURE__ */ t("div", { className: "flex items-center gap-1", role: "tablist", children: G.map((e) => /* @__PURE__ */ n(
66
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-1", role: "tablist", children: L.map((e) => /* @__PURE__ */ n(
64
67
  "button",
65
68
  {
66
69
  type: "button",
@@ -81,16 +84,16 @@ function ye({
81
84
  {
82
85
  type: "button",
83
86
  "data-support-new": !0,
84
- onClick: () => C(!0),
87
+ onClick: () => A(!0),
85
88
  className: "inline-flex h-8 items-center gap-1.5 rounded-md border border-nvr-cyan/60 bg-nvr-cyan/10 px-3 text-[12.5px] font-medium text-nvr-navy hover:bg-nvr-cyan/15 dark:text-nvr-cyan",
86
89
  children: [
87
- /* @__PURE__ */ t(V, { className: "h-3.5 w-3.5" }),
90
+ /* @__PURE__ */ t(I, { className: "h-3.5 w-3.5" }),
88
91
  " Get help"
89
92
  ]
90
93
  }
91
94
  )
92
95
  ] }),
93
- s === "types" ? /* @__PURE__ */ t(ne, {}) : s === "analytics" ? /* @__PURE__ */ t(ee, {}) : /* @__PURE__ */ n(T, { children: [
96
+ s === "types" ? /* @__PURE__ */ t(de, {}) : s === "analytics" ? /* @__PURE__ */ t(re, {}) : /* @__PURE__ */ n(P, { children: [
94
97
  /* @__PURE__ */ n("div", { className: "mt-4 flex flex-wrap items-center gap-2", children: [
95
98
  (s === "desk" ? [
96
99
  ["unassigned", "Not picked up"],
@@ -100,28 +103,28 @@ function ye({
100
103
  ] : [
101
104
  ["open", "Open"],
102
105
  ["closed", "Closed"]
103
- ]).map(([e, L]) => {
104
- const K = s === "desk" ? g === e : k === e;
106
+ ]).map(([e, V]) => {
107
+ const M = s === "desk" ? y === e : N === e;
105
108
  return /* @__PURE__ */ t(
106
109
  "button",
107
110
  {
108
111
  type: "button",
109
112
  "data-support-filter": e,
110
- "aria-pressed": K,
111
- onClick: () => s === "desk" ? O(e) : A(e),
112
- className: K ? "h-7 rounded-full border border-nvr-cyan/60 bg-nvr-cyan/10 px-2.5 text-[12px] font-medium text-nvr-navy dark:text-nvr-cyan" : "h-7 rounded-full border border-slate-200 px-2.5 text-[12px] text-slate-600 hover:border-slate-300 dark:border-border dark:text-slate-300",
113
- children: L
113
+ "aria-pressed": M,
114
+ onClick: () => s === "desk" ? j(e) : D(e),
115
+ className: M ? "h-7 rounded-full border border-nvr-cyan/60 bg-nvr-cyan/10 px-2.5 text-[12px] font-medium text-nvr-navy dark:text-nvr-cyan" : "h-7 rounded-full border border-slate-200 px-2.5 text-[12px] text-slate-600 hover:border-slate-300 dark:border-border dark:text-slate-300",
116
+ children: V
114
117
  },
115
118
  e
116
119
  );
117
120
  }),
118
121
  /* @__PURE__ */ n("label", { className: "ml-auto flex h-8 items-center gap-1.5 rounded-md border border-slate-200 bg-white px-2 dark:border-border dark:bg-background", children: [
119
- /* @__PURE__ */ t(P, { className: "h-3.5 w-3.5 text-slate-400" }),
122
+ /* @__PURE__ */ t(U, { className: "h-3.5 w-3.5 text-slate-400" }),
120
123
  /* @__PURE__ */ t(
121
124
  "input",
122
125
  {
123
- value: N,
124
- onChange: (e) => j(e.target.value),
126
+ value: w,
127
+ onChange: (e) => B(e.target.value),
125
128
  placeholder: "Search requests",
126
129
  "aria-label": "Search requests",
127
130
  className: "w-48 bg-transparent text-[12.5px] text-slate-900 outline-none dark:text-slate-100"
@@ -129,7 +132,7 @@ function ye({
129
132
  )
130
133
  ] })
131
134
  ] }),
132
- /* @__PURE__ */ t("div", { className: "mt-3 overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: E ? /* @__PURE__ */ t("div", { className: "space-y-2 p-4", children: [0, 1, 2].map((e) => /* @__PURE__ */ t(
135
+ /* @__PURE__ */ t("div", { className: "mt-3 overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: G ? /* @__PURE__ */ t("div", { className: "space-y-2 p-4", children: [0, 1, 2].map((e) => /* @__PURE__ */ t(
133
136
  "div",
134
137
  {
135
138
  className: "h-10 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))]"
@@ -140,7 +143,7 @@ function ye({
140
143
  {
141
144
  type: "button",
142
145
  "data-support-row": e.id,
143
- onClick: () => q(e.id),
146
+ onClick: () => S(e.id),
144
147
  className: "grid w-full grid-cols-[1fr_auto] items-start gap-3 px-4 py-2.5 text-left hover:bg-slate-50 dark:hover:bg-white/5",
145
148
  children: [
146
149
  /* @__PURE__ */ n("span", { className: "min-w-0", children: [
@@ -161,14 +164,14 @@ function ye({
161
164
  ].filter(Boolean).join(" · ") })
162
165
  ] }),
163
166
  /* @__PURE__ */ n("span", { className: "flex flex-col items-end gap-1", children: [
164
- /* @__PURE__ */ t(ae, { status: e.status, label: e.status_label }),
165
- /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400", children: se(e.updated_at ?? e.created_at) })
167
+ /* @__PURE__ */ t(ne, { status: e.status, label: e.status_label }),
168
+ /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400", children: oe(e.updated_at ?? e.created_at) })
166
169
  ] })
167
170
  ]
168
171
  }
169
172
  ) }, e.id)) }) : /* @__PURE__ */ n("div", { className: "flex flex-col items-center gap-2 px-6 py-12 text-center", children: [
170
- /* @__PURE__ */ t(I, { className: "h-6 w-6 text-slate-300" }),
171
- /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-700 dark:text-slate-200", children: s === "desk" ? g === "unassigned" ? "Every request has been picked up." : "Nothing here." : k === "open" ? "You have no open requests." : "No closed requests yet." }),
173
+ /* @__PURE__ */ t(W, { className: "h-6 w-6 text-slate-300" }),
174
+ /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-700 dark:text-slate-200", children: s === "desk" ? y === "unassigned" ? "Every request has been picked up." : "Nothing here." : N === "open" ? "You have no open requests." : "No closed requests yet." }),
172
175
  s === "mine" && /* @__PURE__ */ t("p", { className: "max-w-sm text-[12px] text-slate-500 dark:text-muted-foreground", children: "Use Get help for anything general, or Request a change from a record's ⋯ menu to ask for a change to that record." })
173
176
  ] }) }),
174
177
  u && u.total > u.data.length && /* @__PURE__ */ n("p", { className: "mt-2 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
@@ -180,36 +183,40 @@ function ye({
180
183
  ] })
181
184
  ] }),
182
185
  /* @__PURE__ */ t(
183
- te,
186
+ se,
184
187
  {
185
- open: Q,
186
- onOpenChange: C,
188
+ open: T,
189
+ onOpenChange: (e) => {
190
+ A(e), e || O(null);
191
+ },
192
+ initialTitle: p == null ? void 0 : p.title,
193
+ initialDescription: p == null ? void 0 : p.description,
187
194
  onCreated: (e) => {
188
- a("mine"), A("open"), q(e.id);
195
+ a("mine"), D("open"), S(e.id);
189
196
  }
190
197
  }
191
198
  ),
192
- /* @__PURE__ */ t(re, { ticketId: r, onOpenChange: (e) => !e && q(null) })
199
+ /* @__PURE__ */ t(le, { ticketId: r, onOpenChange: (e) => !e && S(null) })
193
200
  ] });
194
201
  }
195
- function ne() {
196
- const l = R(), i = $(), [d, p] = c(""), { data: m = [] } = f({
202
+ function de() {
203
+ const l = Q(), i = R(), [d, m] = c(""), { data: h = [] } = v({
197
204
  queryKey: ["support-categories", "all"],
198
- queryFn: () => l.request(v("/support/categories", { all: "1" })).then((a) => a.data ?? [])
199
- }), { data: h = [] } = f({
205
+ queryFn: () => l.request(k("/support/categories", { all: "1" })).then((a) => a.data ?? [])
206
+ }), { data: x = [] } = v({
200
207
  queryKey: ["support-teams"],
201
- queryFn: () => l.request(v("/user-groups")).then((a) => a.data ?? []).catch(() => [])
202
- }), x = () => void i.invalidateQueries({ queryKey: ["support-categories"] }), s = S({
203
- mutationFn: ({ id: a, body: r }) => l.request(Y(`/support/categories/${a}`, r)),
204
- onSuccess: x
205
- }), b = S({
206
- mutationFn: () => l.request(z("/support/categories", { name: d.trim() })),
208
+ queryFn: () => l.request(k("/user-groups")).then((a) => a.data ?? []).catch(() => [])
209
+ }), b = () => void i.invalidateQueries({ queryKey: ["support-categories"] }), s = _({
210
+ mutationFn: ({ id: a, body: r }) => l.request(H(`/support/categories/${a}`, r)),
211
+ onSuccess: b
212
+ }), g = _({
213
+ mutationFn: () => l.request(J("/support/categories", { name: d.trim() })),
207
214
  onSuccess: () => {
208
- p(""), x();
215
+ m(""), b();
209
216
  }
210
- }), y = S({
211
- mutationFn: (a) => l.request(H(`/support/categories/${a}`)),
212
- onSuccess: x
217
+ }), f = _({
218
+ mutationFn: (a) => l.request(X(`/support/categories/${a}`)),
219
+ onSuccess: b
213
220
  });
214
221
  return /* @__PURE__ */ n("div", { className: "mt-4 space-y-3", "data-support-types-editor": !0, children: [
215
222
  /* @__PURE__ */ t("p", { className: "max-w-2xl text-[12.5px] text-slate-500 dark:text-muted-foreground", children: "The kinds of request people pick from. A type tied to a collection is offered on those records only; without one it is offered everywhere, including General Support. With no team a request goes to every administrator; a default assignee skips the desk entirely." }),
@@ -222,7 +229,7 @@ function ne() {
222
229
  /* @__PURE__ */ t("th", { className: "px-3 py-2 font-medium", children: "Active" }),
223
230
  /* @__PURE__ */ t("th", { className: "px-3 py-2" })
224
231
  ] }) }),
225
- /* @__PURE__ */ t("tbody", { className: "divide-y divide-slate-100 dark:divide-border/60", children: m.map((a) => /* @__PURE__ */ n("tr", { "data-support-type-row": a.id, children: [
232
+ /* @__PURE__ */ t("tbody", { className: "divide-y divide-slate-100 dark:divide-border/60", children: h.map((a) => /* @__PURE__ */ n("tr", { "data-support-type-row": a.id, children: [
226
233
  /* @__PURE__ */ t("td", { className: "px-3 py-2", children: /* @__PURE__ */ t(
227
234
  "input",
228
235
  {
@@ -243,19 +250,19 @@ function ne() {
243
250
  }
244
251
  ) }),
245
252
  /* @__PURE__ */ t("td", { className: "px-3 py-2", children: /* @__PURE__ */ t(
246
- Z,
253
+ ae,
247
254
  {
248
255
  value: a.team_id != null ? String(a.team_id) : "",
249
256
  onChange: (r) => s.mutate({ id: a.id, body: { team_id: r ? Number(r) : null } }),
250
257
  options: [
251
258
  { value: "", label: "Administrators" },
252
- ...h.map((r) => ({ value: String(r.id), label: r.name }))
259
+ ...x.map((r) => ({ value: String(r.id), label: r.name }))
253
260
  ],
254
261
  ariaLabel: "Team"
255
262
  }
256
263
  ) }),
257
264
  /* @__PURE__ */ t("td", { className: "px-3 py-2", children: /* @__PURE__ */ t(
258
- X,
265
+ te,
259
266
  {
260
267
  collection: "nivaro_users",
261
268
  value: a.default_assignee,
@@ -276,7 +283,7 @@ function ne() {
276
283
  "button",
277
284
  {
278
285
  type: "button",
279
- onClick: () => y.mutate(a.id),
286
+ onClick: () => f.mutate(a.id),
280
287
  className: "text-[11.5px] text-slate-400 hover:text-red-600",
281
288
  children: "Remove"
282
289
  }
@@ -288,14 +295,14 @@ function ne() {
288
295
  {
289
296
  className: "flex items-center gap-2",
290
297
  onSubmit: (a) => {
291
- a.preventDefault(), d.trim() && b.mutate();
298
+ a.preventDefault(), d.trim() && g.mutate();
292
299
  },
293
300
  children: [
294
301
  /* @__PURE__ */ t(
295
302
  "input",
296
303
  {
297
304
  value: d,
298
- onChange: (a) => p(a.target.value),
305
+ onChange: (a) => m(a.target.value),
299
306
  placeholder: "New type, e.g. Vendor change",
300
307
  "aria-label": "New type name",
301
308
  className: "h-8 w-72 rounded-md border border-slate-200 bg-white px-3 text-[12.5px] outline-none focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-slate-100"
@@ -305,7 +312,7 @@ function ne() {
305
312
  "button",
306
313
  {
307
314
  type: "submit",
308
- disabled: !d.trim() || b.isPending,
315
+ disabled: !d.trim() || g.isPending,
309
316
  className: "h-8 rounded-md border border-nvr-cyan/60 bg-nvr-cyan/10 px-3 text-[12.5px] font-medium text-nvr-navy disabled:opacity-50 dark:text-nvr-cyan",
310
317
  children: "Add type"
311
318
  }
@@ -316,5 +323,5 @@ function ne() {
316
323
  ] });
317
324
  }
318
325
  export {
319
- ye as SupportView
326
+ Ne as SupportView
320
327
  };
@@ -1,32 +1,35 @@
1
- function m(e) {
2
- let t = !1, a = null;
3
- const f = e.intervalMs ?? 2e3, i = async () => {
4
- var l, o, u, c, d;
5
- let n;
1
+ import { statusTitle as d } from "./safe-error.js";
2
+ function g(e) {
3
+ let n = !1, a = null;
4
+ const m = e.intervalMs ?? 2e3, i = async () => {
5
+ var o, l, u, c, f;
6
+ let r;
6
7
  try {
7
- n = await e.fetchResult();
8
- } catch (r) {
9
- if (t) return;
10
- e.onError(r.message), e.onSettled();
8
+ r = await e.fetchResult();
9
+ } catch (t) {
10
+ if (n) return;
11
+ e.onError(t.message), e.onSettled();
11
12
  return;
12
13
  }
13
- if (!t) {
14
- if (n.status === 202) {
15
- const r = (o = (l = n.json) == null ? void 0 : l.data) == null ? void 0 : o.document_name;
16
- (u = e.onRunning) == null || u.call(e, r ? String(r) : void 0), a = setTimeout(i, f);
14
+ if (!n) {
15
+ if (r.status === 202) {
16
+ const t = (l = (o = r.json) == null ? void 0 : o.data) == null ? void 0 : l.document_name;
17
+ (u = e.onRunning) == null || u.call(e, t ? String(t) : void 0), a = setTimeout(i, m);
17
18
  return;
18
19
  }
19
- if (!n.ok) {
20
- e.onError(((c = n.json) == null ? void 0 : c.error) || `Document autofill failed (${n.status})`), e.onSettled();
20
+ if (!r.ok) {
21
+ e.onError(
22
+ ((c = r.json) == null ? void 0 : c.error) || `Document autofill failed. ${d(r.status) ?? "Try again."}`.trim()
23
+ ), e.onSettled();
21
24
  return;
22
25
  }
23
- e.onDone((d = n.json) == null ? void 0 : d.data), e.onSettled();
26
+ e.onDone((f = r.json) == null ? void 0 : f.data), e.onSettled();
24
27
  }
25
28
  };
26
29
  return i(), () => {
27
- t = !0, a && clearTimeout(a);
30
+ n = !0, a && clearTimeout(a);
28
31
  };
29
32
  }
30
33
  export {
31
- m as pollProposal
34
+ g as pollProposal
32
35
  };
@@ -0,0 +1,85 @@
1
+ import { errorDetailsText as c } from "./error-message.js";
2
+ let o = {};
3
+ function g(n) {
4
+ o = { ...o, ...n };
5
+ }
6
+ const i = "nvr:support-draft", s = 15 * 6e4;
7
+ function f(n, e = Date.now()) {
8
+ try {
9
+ localStorage.setItem(i, JSON.stringify({ ...n, at: e }));
10
+ } catch {
11
+ }
12
+ }
13
+ function y(n = Date.now()) {
14
+ try {
15
+ const e = localStorage.getItem(i);
16
+ if (!e) return null;
17
+ localStorage.removeItem(i);
18
+ const t = JSON.parse(e);
19
+ return typeof t.at != "number" || n - t.at > s || typeof t.title != "string" || typeof t.description != "string" ? null : { title: t.title.slice(0, 200), description: t.description.slice(0, 4e3) };
20
+ } catch {
21
+ return null;
22
+ }
23
+ }
24
+ function l(n, e = {}) {
25
+ const t = n.kind === "forbidden" ? "I need access to do this." : "I ran into a problem and could not finish what I was doing.";
26
+ return {
27
+ title: (n.kind === "forbidden" ? `Access: ${n.title}` : n.title).slice(0, 200),
28
+ description: `${t}
29
+
30
+ ${c(n, e)}`
31
+ };
32
+ }
33
+ function a(n) {
34
+ o.navigate ? o.navigate(n) : typeof window < "u" && window.location.assign(n);
35
+ }
36
+ function d(n, e = {}) {
37
+ f(l(n, e));
38
+ const t = `${o.supportPath ?? "/support"}?new=1`;
39
+ if (typeof window > "u") return;
40
+ const r = window.open(t, "_blank");
41
+ r ? r.opener = null : a(t);
42
+ }
43
+ function u() {
44
+ if (o.signIn) {
45
+ o.signIn();
46
+ return;
47
+ }
48
+ if (typeof window > "u") return;
49
+ const n = `${window.location.pathname}${window.location.search}`, e = o.signInPath ?? "/login";
50
+ window.location.assign(
51
+ n && !n.startsWith(e) ? `${e}?redirect=${encodeURIComponent(n)}` : e
52
+ );
53
+ }
54
+ function w() {
55
+ typeof window > "u" || (window.history.length > 1 ? window.history.back() : a("/"));
56
+ }
57
+ function h(n, e, t = {}) {
58
+ switch (n) {
59
+ case "retry":
60
+ t.retry ? t.retry() : typeof window < "u" && window.location.reload();
61
+ return;
62
+ case "reload":
63
+ typeof window < "u" && window.location.reload();
64
+ return;
65
+ case "sign-in":
66
+ u();
67
+ return;
68
+ case "go-back":
69
+ w();
70
+ return;
71
+ case "contact":
72
+ d(e, { action: t.action });
73
+ return;
74
+ }
75
+ }
76
+ export {
77
+ w as goBack,
78
+ u as goToSignIn,
79
+ d as openSupportForError,
80
+ h as runErrorAction,
81
+ f as saveSupportDraft,
82
+ g as setErrorActionHost,
83
+ l as supportDraftFor,
84
+ y as takeSupportDraft
85
+ };