@nivaro/react 0.3.45 → 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 (90) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +290 -23
  4. package/dist/index.js +679 -659
  5. package/dist/shared/components/BaseMap.js +149 -103
  6. package/dist/shared/components/CollectionBrowserView.js +813 -826
  7. package/dist/shared/components/ErrorNotice.js +169 -0
  8. package/dist/shared/components/ErrorSurface.js +23 -17
  9. package/dist/shared/components/ListLoadError.js +8 -29
  10. package/dist/shared/components/LoadErrorNote.js +38 -21
  11. package/dist/shared/components/QueryErrorState.js +8 -11
  12. package/dist/shared/components/ReportView.js +1320 -1291
  13. package/dist/shared/components/chat/ChannelArchive.js +60 -60
  14. package/dist/shared/components/chat/ChannelExtras.js +74 -74
  15. package/dist/shared/components/chat/ChatPanel.js +368 -367
  16. package/dist/shared/components/command-center/CommandCenterView.js +313 -69
  17. package/dist/shared/components/command-center/Customize.js +353 -0
  18. package/dist/shared/components/command-center/Header.js +279 -53
  19. package/dist/shared/components/command-center/KioskLinks.js +198 -0
  20. package/dist/shared/components/command-center/PeekPanel.js +144 -3
  21. package/dist/shared/components/command-center/announce.js +13 -0
  22. package/dist/shared/components/command-center/board-prefs.js +99 -0
  23. package/dist/shared/components/command-center/freshness.js +29 -0
  24. package/dist/shared/components/command-center/layout.js +56 -0
  25. package/dist/shared/components/command-center/panels/AttentionPanel.js +132 -3
  26. package/dist/shared/components/command-center/panels/Banner.js +75 -0
  27. package/dist/shared/components/command-center/panels/BoardSettings.js +224 -0
  28. package/dist/shared/components/command-center/panels/FeedPanel.js +145 -29
  29. package/dist/shared/components/command-center/panels/FlowPanel.js +154 -56
  30. package/dist/shared/components/command-center/panels/ForecastPanel.js +244 -3
  31. package/dist/shared/components/command-center/panels/MapLegend.js +266 -0
  32. package/dist/shared/components/command-center/panels/MapPanel.js +216 -66
  33. package/dist/shared/components/command-center/panels/PartnersPanel.js +49 -3
  34. package/dist/shared/components/command-center/panels/PeoplePanel.js +258 -40
  35. package/dist/shared/components/command-center/panels/RegionPicker.js +88 -3
  36. package/dist/shared/components/command-center/panels/SystemPanel.js +158 -38
  37. package/dist/shared/components/command-center/panels/ThroughputPanel.js +307 -3
  38. package/dist/shared/components/command-center/panels/TimeBar.js +227 -6
  39. package/dist/shared/components/command-center/panels/TrafficPanel.js +12 -8
  40. package/dist/shared/components/command-center/panels/WorkloadPanel.js +82 -3
  41. package/dist/shared/components/command-center/panels/attention-actions.js +267 -0
  42. package/dist/shared/components/command-center/panels/map-shared.js +95 -0
  43. package/dist/shared/components/command-center/panels/registry.js +87 -19
  44. package/dist/shared/components/command-center/shell-hooks.js +118 -0
  45. package/dist/shared/components/command-center/shortcuts.js +37 -0
  46. package/dist/shared/components/command-center/theme.js +39 -21
  47. package/dist/shared/components/command-center/time.js +52 -0
  48. package/dist/shared/components/command-center/url-state.js +54 -0
  49. package/dist/shared/components/command-center/work-links.js +32 -0
  50. package/dist/shared/components/help-videos/editor/ClipsPanel.js +49 -48
  51. package/dist/shared/components/help-videos/editor/PublishButton.js +37 -36
  52. package/dist/shared/components/help-videos/editor/StatsTab.js +45 -44
  53. package/dist/shared/components/help-videos/editor/VersionsTab.js +29 -28
  54. package/dist/shared/components/help-videos/library/AuthorRolesButton.js +19 -18
  55. package/dist/shared/components/help-videos/library/HelpVideoLibrary.js +132 -129
  56. package/dist/shared/components/help-videos/library/LearningPathsPanel.js +42 -41
  57. package/dist/shared/components/help-videos/settings/HouseStyleButton.js +21 -20
  58. package/dist/shared/components/help-videos/settings/RenderSettingsButton.js +22 -21
  59. package/dist/shared/components/import/DocumentAutofillButton.js +24 -20
  60. package/dist/shared/components/import/ImportFromFileButton.js +61 -60
  61. package/dist/shared/components/imports/ImportStalenessControl.js +20 -21
  62. package/dist/shared/components/imports/NewImportDialog.js +29 -28
  63. package/dist/shared/components/imports/RunDetailSheet.js +63 -63
  64. package/dist/shared/components/item-edit/FieldRow.js +329 -329
  65. package/dist/shared/components/item-edit/InlineTableField.js +898 -898
  66. package/dist/shared/components/item-edit/PersonalDefaultControl.js +57 -56
  67. package/dist/shared/components/item-edit/PlanGrid.js +220 -221
  68. package/dist/shared/components/item-edit/RecordGrantTools.js +49 -48
  69. package/dist/shared/components/item-edit/placement-behaviour.js +68 -67
  70. package/dist/shared/components/layout-editor/inspector/ColumnFit.js +24 -23
  71. package/dist/shared/components/layout-editor/inspector/PickerPreview.js +17 -16
  72. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +41 -41
  73. package/dist/shared/components/layout-editor/outputs/output-api.js +33 -31
  74. package/dist/shared/components/layout-editor/overview/overview-api.js +84 -83
  75. package/dist/shared/components/layout-editor/useLayoutDraft.js +47 -42
  76. package/dist/shared/components/monitoring/InactiveUserLinksView.js +10 -9
  77. package/dist/shared/components/monitoring/TrafficMiniMap.js +111 -70
  78. package/dist/shared/components/panels/SlaClock.js +35 -36
  79. package/dist/shared/components/pipeline/PipelineEditorView.js +311 -312
  80. package/dist/shared/components/pipeline/TeamSuggestions.js +31 -30
  81. package/dist/shared/components/profile/AgentsPanel.js +73 -72
  82. package/dist/shared/components/profile/MailSuppressedPill.js +22 -21
  83. package/dist/shared/components/support/SupportRequestDialog.js +85 -81
  84. package/dist/shared/components/support/SupportView.js +94 -87
  85. package/dist/shared/lib/autofill-poll.js +21 -18
  86. package/dist/shared/lib/error-actions.js +85 -0
  87. package/dist/shared/lib/error-message.js +223 -82
  88. package/dist/shared/lib/error-toast.js +71 -13
  89. package/dist/shared/lib/safe-error.js +136 -38
  90. package/package.json +1 -1
@@ -1,131 +1,135 @@
1
1
  import { jsx as t, jsxs as a } from "react/jsx-runtime";
2
- import { useQueryClient as L, useQuery as Y, useMutation as _ } from "@tanstack/react-query";
3
- import { Loader2 as M, Paperclip as z, X as G } from "lucide-react";
4
- import { useState as l, useRef as P, useEffect as W } from "react";
5
- import { useNivaroClient as H } from "../../context.js";
6
- import { get as X, post as B } from "../../lib/commands.js";
7
- import { invalidateRecordTasks as J } from "../../lib/record-tasks.js";
8
- import { prepareReplayClip as V } from "../../lib/replay-capture.js";
9
- import { installReplayTail as Z } from "../../lib/replay-tail.js";
10
- import { Dialog as O, DialogContent as ee, DialogHeader as te, DialogTitle as re, DialogDescription as ae } from "../ui/dialog.js";
11
- import { collectSupportContext as ne } from "./support-context.js";
12
- function fe({
13
- open: u,
2
+ import { useQueryClient as _, useQuery as z, useMutation as G } from "@tanstack/react-query";
3
+ import { Loader2 as j, Paperclip as H, X } from "lucide-react";
4
+ import { useState as l, useRef as U, useEffect as I } from "react";
5
+ import { useNivaroClient as B } from "../../context.js";
6
+ import { get as J, post as V } from "../../lib/commands.js";
7
+ import { invalidateRecordTasks as Z } from "../../lib/record-tasks.js";
8
+ import { prepareReplayClip as O } from "../../lib/replay-capture.js";
9
+ import { installReplayTail as ee } from "../../lib/replay-tail.js";
10
+ import { Dialog as te, DialogContent as re, DialogHeader as ae, DialogTitle as ne, DialogDescription as le } from "../ui/dialog.js";
11
+ import { collectSupportContext as se } from "./support-context.js";
12
+ function ye({
13
+ open: s,
14
14
  onOpenChange: c,
15
- collection: o,
15
+ collection: d,
16
16
  item: p,
17
- recordLabel: C,
18
- onCreated: f
17
+ recordLabel: A,
18
+ initialTitle: f,
19
+ initialDescription: g,
20
+ onCreated: y
19
21
  }) {
20
- const m = H(), i = L(), n = !!o && p != null && p !== "", [d, S] = l(null), [g, D] = l(""), [R, I] = l(""), [y, b] = l([]), [T, A] = l(!1), [Q, x] = l(null), [E, K] = l(!0), v = P(null), k = P(!1);
21
- W(() => {
22
- Z();
23
- }, []), W(() => {
24
- if (!u) {
25
- v.current = null;
22
+ const m = B(), i = _(), n = !!d && p != null && p !== "", [u, Q] = l(null), [b, v] = l(""), [E, k] = l(""), [w, N] = l([]), [T, K] = l(!1), [F, x] = l(null), [M, P] = l(!0), q = U(null), C = U(!1);
23
+ I(() => {
24
+ ee();
25
+ }, []), I(() => {
26
+ s && (f && v((e) => e || f), g && k((e) => e || g));
27
+ }, [s, f, g]), I(() => {
28
+ if (!s) {
29
+ q.current = null;
26
30
  return;
27
31
  }
28
- v.current = {
29
- clip: V("support"),
32
+ q.current = {
33
+ clip: O("support"),
30
34
  route: typeof window < "u" ? window.location.pathname : ""
31
35
  };
32
- }, [u]);
33
- const { data: w = [] } = Y({
34
- queryKey: ["support-categories", n ? o : null],
36
+ }, [s]);
37
+ const { data: S = [] } = z({
38
+ queryKey: ["support-categories", n ? d : null],
35
39
  queryFn: () => m.request(
36
- X("/support/categories", n ? { collection: o } : void 0)
40
+ J("/support/categories", n ? { collection: d } : void 0)
37
41
  ).then((e) => e.data ?? []),
38
- enabled: u
39
- }), N = () => {
40
- S(null), D(""), I(""), b([]), x(null), K(!0);
42
+ enabled: s
43
+ }), R = () => {
44
+ Q(null), v(""), k(""), N([]), x(null), P(!0);
41
45
  };
42
- async function j() {
43
- if (!E) return { fileId: null, replay: null };
44
- const e = v.current;
45
- return ne({
46
+ async function $() {
47
+ if (!M) return { fileId: null, replay: null };
48
+ const e = q.current;
49
+ return se({
46
50
  clip: (e == null ? void 0 : e.clip) ?? null,
47
51
  route: (e == null ? void 0 : e.route) ?? (typeof window < "u" ? window.location.pathname : ""),
48
52
  upload: (r) => m.upload(r, { title: "What they saw" }),
49
53
  userAgent: typeof navigator < "u" ? navigator.userAgent : null
50
54
  });
51
55
  }
52
- const q = _({
56
+ const D = G({
53
57
  mutationFn: async () => {
54
- const e = await j();
58
+ const e = await $();
55
59
  return m.request(
56
- B("/support/tickets", {
57
- title: g.trim(),
58
- description: R.trim() || null,
59
- category_id: d,
60
- collection: n ? o : null,
60
+ V("/support/tickets", {
61
+ title: b.trim(),
62
+ description: E.trim() || null,
63
+ category_id: u,
64
+ collection: n ? d : null,
61
65
  item: n ? String(p) : null,
62
- attachments: [...y.map((r) => r.id), ...e.fileId ? [e.fileId] : []],
66
+ attachments: [...w.map((r) => r.id), ...e.fileId ? [e.fileId] : []],
63
67
  ...e.replay ? { replay: e.replay } : {}
64
68
  })
65
69
  );
66
70
  },
67
71
  onSuccess: (e) => {
68
- i.invalidateQueries({ queryKey: ["support-tickets"] }), i.invalidateQueries({ queryKey: ["support-summary"] }), n && J(i, o, p), f == null || f(e.data), N(), c(!1);
72
+ i.invalidateQueries({ queryKey: ["support-tickets"] }), i.invalidateQueries({ queryKey: ["support-summary"] }), n && Z(i, d, p), y == null || y(e.data), R(), c(!1);
69
73
  },
70
74
  onError: (e) => {
71
- var s;
75
+ var o;
72
76
  const r = e.response;
73
- if ((((s = r == null ? void 0 : r.data) == null ? void 0 : s.code) ?? (r == null ? void 0 : r.code)) === "DUPLICATE_REQUEST") {
74
- i.invalidateQueries({ queryKey: ["support-tickets"] }), i.invalidateQueries({ queryKey: ["support-summary"] }), N(), c(!1);
77
+ if ((((o = r == null ? void 0 : r.data) == null ? void 0 : o.code) ?? (r == null ? void 0 : r.code)) === "DUPLICATE_REQUEST") {
78
+ i.invalidateQueries({ queryKey: ["support-tickets"] }), i.invalidateQueries({ queryKey: ["support-summary"] }), R(), c(!1);
75
79
  return;
76
80
  }
77
81
  x(e.message || "Could not send the request");
78
82
  },
79
83
  onSettled: () => {
80
- k.current = !1;
84
+ C.current = !1;
81
85
  }
82
86
  });
83
- async function U(e) {
87
+ async function L(e) {
84
88
  if (e != null && e.length) {
85
- A(!0), x(null);
89
+ K(!0), x(null);
86
90
  try {
87
91
  for (const r of Array.from(e).slice(0, 10)) {
88
- const s = await m.upload(r);
89
- b(($) => [...$, { id: String(s.id), name: r.name }]);
92
+ const o = await m.upload(r);
93
+ N((Y) => [...Y, { id: String(o.id), name: r.name }]);
90
94
  }
91
95
  } catch {
92
96
  x("A file could not be uploaded");
93
97
  } finally {
94
- A(!1);
98
+ K(!1);
95
99
  }
96
100
  }
97
101
  }
98
- const h = w.find((e) => e.id === d) ?? null, F = g.trim().length > 0 && !q.isPending && !T;
102
+ const h = S.find((e) => e.id === u) ?? null, W = b.trim().length > 0 && !D.isPending && !T;
99
103
  return /* @__PURE__ */ t(
100
- O,
104
+ te,
101
105
  {
102
- open: u,
106
+ open: s,
103
107
  onOpenChange: (e) => {
104
- e || N(), c(e);
108
+ e || R(), c(e);
105
109
  },
106
- children: /* @__PURE__ */ a(ee, { className: "max-w-xl dark:bg-card", "data-support-request": !0, children: [
107
- /* @__PURE__ */ a(te, { className: "px-6 pt-5", children: [
108
- /* @__PURE__ */ t(re, { className: "text-[15px] font-semibold text-slate-900 dark:text-slate-100", children: n ? `Request a change${C ? ` · ${C}` : ""}` : "Get help" }),
109
- /* @__PURE__ */ t(ae, { className: "text-[12.5px] text-slate-500 dark:text-muted-foreground", children: n ? "Tell the administrators what needs to change on this record. You can follow the request under My requests." : "Ask the administrators for help. You can follow the request under My requests." })
110
+ children: /* @__PURE__ */ a(re, { className: "max-w-xl dark:bg-card", "data-support-request": !0, children: [
111
+ /* @__PURE__ */ a(ae, { className: "px-6 pt-5", children: [
112
+ /* @__PURE__ */ t(ne, { className: "text-[15px] font-semibold text-slate-900 dark:text-slate-100", children: n ? `Request a change${A ? ` · ${A}` : ""}` : "Get help" }),
113
+ /* @__PURE__ */ t(le, { className: "text-[12.5px] text-slate-500 dark:text-muted-foreground", children: n ? "Tell the administrators what needs to change on this record. You can follow the request under My requests." : "Ask the administrators for help. You can follow the request under My requests." })
110
114
  ] }),
111
115
  /* @__PURE__ */ a(
112
116
  "form",
113
117
  {
114
118
  className: "space-y-4 px-6 pb-5 pt-3",
115
119
  onSubmit: (e) => {
116
- e.preventDefault(), !(!F || k.current) && (k.current = !0, q.mutate());
120
+ e.preventDefault(), !(!W || C.current) && (C.current = !0, D.mutate());
117
121
  },
118
122
  children: [
119
- w.length > 0 && /* @__PURE__ */ a("fieldset", { children: [
123
+ S.length > 0 && /* @__PURE__ */ a("fieldset", { children: [
120
124
  /* @__PURE__ */ t("legend", { className: "mb-1.5 text-[12px] font-medium text-slate-700 dark:text-slate-200", children: "What kind of request?" }),
121
- /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1.5", "data-support-types": !0, children: w.map((e) => /* @__PURE__ */ t(
125
+ /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1.5", "data-support-types": !0, children: S.map((e) => /* @__PURE__ */ t(
122
126
  "button",
123
127
  {
124
128
  type: "button",
125
129
  "data-support-type": e.id,
126
- "aria-pressed": d === e.id,
127
- onClick: () => S(d === e.id ? null : e.id),
128
- className: d === e.id ? "rounded-full border border-nvr-cyan/60 bg-nvr-cyan/10 px-2.5 py-1 text-[12px] font-medium text-nvr-navy dark:text-nvr-cyan" : "rounded-full border border-slate-200 px-2.5 py-1 text-[12px] text-slate-600 hover:border-slate-300 dark:border-border dark:text-slate-300",
130
+ "aria-pressed": u === e.id,
131
+ onClick: () => Q(u === e.id ? null : e.id),
132
+ className: u === e.id ? "rounded-full border border-nvr-cyan/60 bg-nvr-cyan/10 px-2.5 py-1 text-[12px] font-medium text-nvr-navy dark:text-nvr-cyan" : "rounded-full border border-slate-200 px-2.5 py-1 text-[12px] text-slate-600 hover:border-slate-300 dark:border-border dark:text-slate-300",
129
133
  children: e.name
130
134
  },
131
135
  e.id
@@ -138,8 +142,8 @@ function fe({
138
142
  "input",
139
143
  {
140
144
  "data-support-title": !0,
141
- value: g,
142
- onChange: (e) => D(e.target.value),
145
+ value: b,
146
+ onChange: (e) => v(e.target.value),
143
147
  maxLength: 200,
144
148
  placeholder: n ? "e.g. Move to funding year 2027" : "e.g. I need access to the National zone",
145
149
  className: "h-9 w-full rounded-md border border-slate-200 bg-white px-3 text-[13px] text-slate-900 outline-none focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-slate-100"
@@ -152,8 +156,8 @@ function fe({
152
156
  "textarea",
153
157
  {
154
158
  "data-support-description": !0,
155
- value: R,
156
- onChange: (e) => I(e.target.value),
159
+ value: E,
160
+ onChange: (e) => k(e.target.value),
157
161
  rows: 5,
158
162
  placeholder: "What should change, and why",
159
163
  className: "w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-[13px] text-slate-900 outline-none focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-slate-100"
@@ -162,7 +166,7 @@ function fe({
162
166
  ] }),
163
167
  /* @__PURE__ */ a("div", { children: [
164
168
  /* @__PURE__ */ a("label", { className: "inline-flex cursor-pointer items-center gap-1.5 text-[12px] font-medium text-slate-600 hover:text-slate-900 dark:text-slate-300 dark:hover:text-slate-100", children: [
165
- T ? /* @__PURE__ */ t(M, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t(z, { className: "h-3.5 w-3.5" }),
169
+ T ? /* @__PURE__ */ t(j, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t(H, { className: "h-3.5 w-3.5" }),
166
170
  "Attach files",
167
171
  /* @__PURE__ */ t(
168
172
  "input",
@@ -172,12 +176,12 @@ function fe({
172
176
  className: "hidden",
173
177
  "data-support-files": !0,
174
178
  onChange: (e) => {
175
- U(e.target.files), e.target.value = "";
179
+ L(e.target.files), e.target.value = "";
176
180
  }
177
181
  }
178
182
  )
179
183
  ] }),
180
- y.length > 0 && /* @__PURE__ */ t("ul", { className: "mt-1.5 flex flex-wrap gap-1.5", children: y.map((e) => /* @__PURE__ */ a(
184
+ w.length > 0 && /* @__PURE__ */ t("ul", { className: "mt-1.5 flex flex-wrap gap-1.5", children: w.map((e) => /* @__PURE__ */ a(
181
185
  "li",
182
186
  {
183
187
  className: "inline-flex items-center gap-1 rounded bg-slate-100 px-2 py-0.5 text-[11.5px] text-slate-700 dark:bg-white/10 dark:text-slate-200",
@@ -188,9 +192,9 @@ function fe({
188
192
  {
189
193
  type: "button",
190
194
  "aria-label": `Remove ${e.name}`,
191
- onClick: () => b((r) => r.filter((s) => s.id !== e.id)),
195
+ onClick: () => N((r) => r.filter((o) => o.id !== e.id)),
192
196
  className: "text-slate-400 hover:text-slate-700 dark:hover:text-slate-100",
193
- children: /* @__PURE__ */ t(G, { className: "h-3 w-3" })
197
+ children: /* @__PURE__ */ t(X, { className: "h-3 w-3" })
194
198
  }
195
199
  )
196
200
  ]
@@ -208,8 +212,8 @@ function fe({
208
212
  "input",
209
213
  {
210
214
  type: "checkbox",
211
- checked: E,
212
- onChange: (e) => K(e.target.checked),
215
+ checked: M,
216
+ onChange: (e) => P(e.target.checked),
213
217
  className: "mt-0.5 accent-[#00ceff]"
214
218
  }
215
219
  ),
@@ -220,7 +224,7 @@ function fe({
220
224
  ]
221
225
  }
222
226
  ),
223
- Q && /* @__PURE__ */ t("p", { className: "text-[12px] text-red-600 dark:text-red-400", role: "alert", children: Q }),
227
+ F && /* @__PURE__ */ t("p", { className: "text-[12px] text-red-600 dark:text-red-400", role: "alert", children: F }),
224
228
  /* @__PURE__ */ a("div", { className: "flex justify-end gap-2 pt-1", children: [
225
229
  /* @__PURE__ */ t(
226
230
  "button",
@@ -236,10 +240,10 @@ function fe({
236
240
  {
237
241
  type: "submit",
238
242
  "data-support-send": !0,
239
- disabled: !F,
243
+ disabled: !W,
240
244
  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 disabled:opacity-50 dark:text-nvr-cyan",
241
245
  children: [
242
- q.isPending && /* @__PURE__ */ t(M, { className: "h-3.5 w-3.5 animate-spin" }),
246
+ D.isPending && /* @__PURE__ */ t(j, { className: "h-3.5 w-3.5 animate-spin" }),
243
247
  "Send request"
244
248
  ]
245
249
  }
@@ -253,5 +257,5 @@ function fe({
253
257
  );
254
258
  }
255
259
  export {
256
- fe as SupportRequestDialog
260
+ ye as SupportRequestDialog
257
261
  };