@nivaro/react 0.3.8 → 0.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/components/fields/FileField.js +20 -19
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/replayUploadQueue.js +107 -93
  4. package/dist/hooks/useNivaroForm.js +129 -126
  5. package/dist/hooks/useSessionRecorder.js +103 -101
  6. package/dist/index.d.ts +115 -2
  7. package/dist/index.js +466 -447
  8. package/dist/shared/components/CollectionBrowserView.js +1058 -1059
  9. package/dist/shared/components/ConformanceView.js +36 -35
  10. package/dist/shared/components/DataTable.js +230 -223
  11. package/dist/shared/components/ForceReloadBanner.js +58 -34
  12. package/dist/shared/components/ItemEditForm.js +3687 -3580
  13. package/dist/shared/components/JsonMapEditor.js +18 -17
  14. package/dist/shared/components/MatrixEditor.js +8 -7
  15. package/dist/shared/components/MyWorkView.js +32 -31
  16. package/dist/shared/components/PageRenderer.js +146 -145
  17. package/dist/shared/components/QueryTable.js +49 -49
  18. package/dist/shared/components/RecordGridEditor.js +76 -75
  19. package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
  20. package/dist/shared/components/ai/AskPanel.js +55 -54
  21. package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
  22. package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
  23. package/dist/shared/components/chat/ChatPanel.js +288 -287
  24. package/dist/shared/components/chat/SlashCommands.js +30 -29
  25. package/dist/shared/components/chat/chat-outbox.js +76 -75
  26. package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
  27. package/dist/shared/components/integrations/console/SignalCard.js +124 -123
  28. package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
  29. package/dist/shared/components/item-edit/CloneDialog.js +85 -78
  30. package/dist/shared/components/item-edit/InlineTableField.js +301 -300
  31. package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
  32. package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
  33. package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
  34. package/dist/shared/components/item-edit/staged-links.js +86 -0
  35. package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
  36. package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
  37. package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
  38. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
  39. package/dist/shared/components/panels/CommentPanel.js +237 -236
  40. package/dist/shared/components/profile/AiMemoryCard.js +15 -14
  41. package/dist/shared/components/profile/PersonAdminTools.js +70 -67
  42. package/dist/shared/components/profile/usePersonPresence.js +42 -37
  43. package/dist/shared/components/queue/QueueItemSheet.js +36 -35
  44. package/dist/shared/components/queue/QueueWorklist.js +597 -598
  45. package/dist/shared/lib/client-version.js +63 -0
  46. package/dist/shared/lib/force-reload.js +36 -0
  47. package/dist/shared/lib/load-error.js +11 -10
  48. package/dist/shared/lib/presence-live.js +73 -0
  49. package/dist/shared/lib/presence-state.js +39 -31
  50. package/dist/shared/lib/record-outbox.js +76 -75
  51. package/dist/shared/lib/request-gate.js +120 -102
  52. package/dist/shared/lib/rum.js +45 -36
  53. package/dist/shared/lib/safe-error.js +39 -0
  54. package/dist/shared/lib/server-clock.js +11 -7
  55. package/dist/shared/lib/signed-out.js +114 -0
  56. package/dist/shared/lib/socket-realtime.js +19 -17
  57. package/dist/shared/lib/unsaved-work.js +62 -0
  58. package/dist/shared/lib/use-online-users.js +11 -10
  59. package/dist/shared/lib/worker-socket.js +89 -79
  60. package/package.json +1 -1
@@ -1,22 +1,23 @@
1
1
  import { jsxs as a, jsx as r, Fragment as U } from "react/jsx-runtime";
2
- import { useQueryClient as W, useQuery as A, useMutation as j } from "@tanstack/react-query";
3
- import { ExternalLink as z, ArrowRight as E } from "lucide-react";
4
- import { useState as I } from "react";
2
+ import { useQueryClient as W, useQuery as A, useMutation as M } from "@tanstack/react-query";
3
+ import { ExternalLink as z, ArrowRight as j } from "lucide-react";
4
+ import { useState as E } from "react";
5
5
  import { toast as k } from "sonner";
6
6
  import { useNivaroClient as G, useItemNavigation as J } from "../../context.js";
7
- import { get as M, post as Q } from "../../lib/commands.js";
7
+ import { get as I, post as Q } from "../../lib/commands.js";
8
8
  import { formatMultiValue as X } from "../../lib/format-value.js";
9
9
  import { useLiveRecord as Y, batchTouches as K, LIVE_ASPECTS as P } from "../../lib/live.js";
10
- import { cn as Z, formatRelative as L, humanHours as ee } from "../../lib/utils.js";
11
- import { transitionRequirementsFromError as te } from "../panels/PipelinePanel.js";
12
- import { TransitionRequirementsDialog as re } from "../panels/TransitionRequirementsDialog.js";
13
- import { Badge as ae } from "../ui/badge.js";
14
- import { Sheet as ne, SheetContent as oe, SheetHeader as se, SheetTitle as de } from "../ui/sheet.js";
15
- import { OwnerAvatars as ie } from "./OwnerAvatars.js";
16
- function le(e) {
17
- return ee(e);
18
- }
10
+ import { userErrorMessage as Z } from "../../lib/safe-error.js";
11
+ import { cn as L, formatRelative as ee, humanHours as te } from "../../lib/utils.js";
12
+ import { transitionRequirementsFromError as re } from "../panels/PipelinePanel.js";
13
+ import { TransitionRequirementsDialog as ae } from "../panels/TransitionRequirementsDialog.js";
14
+ import { Badge as ne } from "../ui/badge.js";
15
+ import { Sheet as oe, SheetContent as se, SheetHeader as de, SheetTitle as ie } from "../ui/sheet.js";
16
+ import { OwnerAvatars as le } from "./OwnerAvatars.js";
19
17
  function ce(e) {
18
+ return te(e);
19
+ }
20
+ function me(e) {
20
21
  return e.split(".").map((c) => c.replace(/_/g, " ").replace(/\b\w/g, (h) => h.toUpperCase())).join(" → ");
21
22
  }
22
23
  function l({ label: e, children: c }) {
@@ -25,7 +26,7 @@ function l({ label: e, children: c }) {
25
26
  /* @__PURE__ */ r("div", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: c })
26
27
  ] });
27
28
  }
28
- function Ce({
29
+ function Re({
29
30
  item: e,
30
31
  onOpenChange: c,
31
32
  onClaim: h,
@@ -41,15 +42,15 @@ function Ce({
41
42
  itemLayout: F
42
43
  }) {
43
44
  var R;
44
- const p = W(), x = G(), { open: H } = J(), [f, _] = I(""), [m, y] = I(null), n = e == null ? void 0 : e.collection, o = e == null ? void 0 : e.item_id, { data: d } = A({
45
+ const p = W(), x = G(), { open: H } = J(), [f, _] = E(""), [m, y] = E(null), n = e == null ? void 0 : e.collection, o = e == null ? void 0 : e.item_id, { data: d } = A({
45
46
  queryKey: ["queue-sheet-instance", n, o],
46
- queryFn: () => x.request(M(`/pipelines/instance/${n}/${o}`)).then((t) => t.data),
47
+ queryFn: () => x.request(I(`/pipelines/instance/${n}/${o}`)).then((t) => t.data),
47
48
  enabled: !!n && !!o
48
49
  }), { data: i } = A({
49
50
  queryKey: ["queue-sheet-comments", n, o],
50
- queryFn: () => x.request(M("/comments", { collection: n, item: o })).catch(() => ({ data: [] })),
51
+ queryFn: () => x.request(I("/comments", { collection: n, item: o })).catch(() => ({ data: [] })),
51
52
  enabled: !!n && !!o
52
- }), b = j({
53
+ }), b = M({
53
54
  mutationFn: (t) => x.request(
54
55
  Q(`/pipelines/instance/${n}/${o}/transition`, {
55
56
  transition_id: t
@@ -59,7 +60,7 @@ function Ce({
59
60
  y(null), p.invalidateQueries({ queryKey: ["queue-sheet-instance", n, o] }), w(), k.success("Transitioned");
60
61
  },
61
62
  onError: (t, s) => {
62
- const T = te(t);
63
+ const T = re(t);
63
64
  if (T) {
64
65
  y((v) => ({
65
66
  payload: T,
@@ -68,9 +69,9 @@ function Ce({
68
69
  }));
69
70
  return;
70
71
  }
71
- k.error(t instanceof Error ? t.message : "Transition failed");
72
+ k.error(Z(t, "Transition failed"));
72
73
  }
73
- }), C = j({
74
+ }), C = M({
74
75
  mutationFn: (t) => x.request(Q("/comments", { collection: n, item: o, text: t })),
75
76
  onSuccess: () => {
76
77
  _(""), p.invalidateQueries({ queryKey: ["queue-sheet-comments", n, o] });
@@ -81,19 +82,19 @@ function Ce({
81
82
  K(t, P.state) && (p.invalidateQueries({ queryKey: ["queue-sheet-instance", n, o] }), t.own || w()), K(t, P.comments) && p.invalidateQueries({ queryKey: ["queue-sheet-comments", n, o] });
82
83
  });
83
84
  const S = (d == null ? void 0 : d.available_transitions) ?? [], V = new Map(((d == null ? void 0 : d.states) ?? []).map((t) => [t.id, t]));
84
- return /* @__PURE__ */ a(ne, { open: !!e, onOpenChange: c, children: [
85
+ return /* @__PURE__ */ a(oe, { open: !!e, onOpenChange: c, children: [
85
86
  /* @__PURE__ */ r(
86
- oe,
87
+ se,
87
88
  {
88
89
  side: "right",
89
90
  className: "flex max-w-full flex-col gap-0 p-0",
90
91
  style: { width: D ?? 480, maxWidth: "96vw" },
91
92
  children: e && /* @__PURE__ */ a(U, { children: [
92
- /* @__PURE__ */ r(se, { className: "shrink-0 border-b border-slate-200 px-5 py-4 dark:border-border", children: /* @__PURE__ */ a("div", { className: "flex items-start justify-between gap-3 pr-6", children: [
93
+ /* @__PURE__ */ r(de, { className: "shrink-0 border-b border-slate-200 px-5 py-4 dark:border-border", children: /* @__PURE__ */ a("div", { className: "flex items-start justify-between gap-3 pr-6", children: [
93
94
  /* @__PURE__ */ a("div", { className: "min-w-0", children: [
94
- /* @__PURE__ */ r(de, { className: "truncate text-[15px] font-semibold", children: e.label }),
95
+ /* @__PURE__ */ r(ie, { className: "truncate text-[15px] font-semibold", children: e.label }),
95
96
  /* @__PURE__ */ a("div", { className: "mt-1.5 flex items-center gap-2", children: [
96
- /* @__PURE__ */ r(ae, { variant: "outline", children: q ? q(e.collection) : e.collection }),
97
+ /* @__PURE__ */ r(ne, { variant: "outline", children: q ? q(e.collection) : e.collection }),
97
98
  e.state && /* @__PURE__ */ r(
98
99
  "span",
99
100
  {
@@ -126,21 +127,21 @@ function Ce({
126
127
  ] }) }),
127
128
  /* @__PURE__ */ a("div", { className: "flex-1 overflow-y-auto px-5 py-4", children: [
128
129
  /* @__PURE__ */ a("div", { className: "mb-4 grid grid-cols-2 gap-px overflow-hidden rounded-lg border border-slate-200 bg-slate-200 dark:border-border dark:bg-border", children: [
129
- /* @__PURE__ */ r(l, { label: "Owners", children: /* @__PURE__ */ r(ie, { owners: e.owners, max: 6 }) }),
130
+ /* @__PURE__ */ r(l, { label: "Owners", children: /* @__PURE__ */ r(le, { owners: e.owners, max: 6 }) }),
130
131
  /* @__PURE__ */ r(l, { label: "Claimed by", children: ((R = e.claimed_by) == null ? void 0 : R.name) ?? "—" }),
131
132
  /* @__PURE__ */ r(l, { label: "SLA", children: e.sla_status ? /* @__PURE__ */ r(
132
133
  "span",
133
134
  {
134
- className: Z(
135
+ className: L(
135
136
  "rounded px-1.5 py-0.5 text-[11px] font-medium",
136
137
  e.sla_status === "breached" ? "bg-red-50 text-red-600 dark:bg-red-500/10 dark:text-red-400" : e.sla_status === "warning" ? "bg-amber-50 text-amber-600 dark:bg-amber-500/10 dark:text-amber-400" : "bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400"
137
138
  ),
138
139
  children: e.sla_status
139
140
  }
140
141
  ) : "—" }),
141
- /* @__PURE__ */ r(l, { label: "Aging", children: le(e.aging_hours) }),
142
+ /* @__PURE__ */ r(l, { label: "Aging", children: ce(e.aging_hours) }),
142
143
  e.at_risk && /* @__PURE__ */ r(l, { label: "Risk", children: /* @__PURE__ */ r("span", { className: "text-red-500", children: "⚑ At risk" }) }),
143
- Object.entries(e.extra ?? {}).map(([t, s]) => /* @__PURE__ */ r(l, { label: ce(t), children: s == null || s === "" ? "—" : u != null && u[t] ? X(String(s), u[t]) : String(s) }, t))
144
+ Object.entries(e.extra ?? {}).map(([t, s]) => /* @__PURE__ */ r(l, { label: me(t), children: s == null || s === "" ? "—" : u != null && u[t] ? X(String(s), u[t]) : String(s) }, t))
144
145
  ] }),
145
146
  S.length > 0 && /* @__PURE__ */ a("div", { className: "mb-4", children: [
146
147
  /* @__PURE__ */ r("p", { className: "mb-1.5 text-[11px] font-medium uppercase tracking-wide text-slate-400 dark:text-muted-foreground", children: "Transitions" }),
@@ -155,7 +156,7 @@ function Ce({
155
156
  className: "flex items-center gap-1 rounded-md border border-slate-200 bg-white px-2.5 py-1.5 text-[12px] font-medium text-slate-700 hover:border-nvr-cyan hover:text-nvr-navy disabled:opacity-50 dark:border-border dark:bg-card dark:text-slate-200 dark:hover:text-nvr-cyan",
156
157
  children: [
157
158
  t.label || (s == null ? void 0 : s.label) || (s == null ? void 0 : s.key) || "Move",
158
- /* @__PURE__ */ r(E, { className: "h-3 w-3 text-slate-400" })
159
+ /* @__PURE__ */ r(j, { className: "h-3 w-3 text-slate-400" })
159
160
  ]
160
161
  },
161
162
  t.id
@@ -177,7 +178,7 @@ function Ce({
177
178
  ((i == null ? void 0 : i.data) ?? []).map((t) => /* @__PURE__ */ a("div", { className: "rounded-md bg-slate-50 px-3 py-2 dark:bg-muted/40", children: [
178
179
  /* @__PURE__ */ a("p", { className: "text-[11px] font-medium text-slate-500 dark:text-muted-foreground", children: [
179
180
  [t.first_name, t.last_name].filter(Boolean).join(" ") || t.email || "—",
180
- /* @__PURE__ */ r("span", { className: "ml-1.5 font-normal text-slate-400", children: L(t.created_at) })
181
+ /* @__PURE__ */ r("span", { className: "ml-1.5 font-normal text-slate-400", children: ee(t.created_at) })
181
182
  ] }),
182
183
  /* @__PURE__ */ r("p", { className: "mt-0.5 whitespace-pre-wrap text-[12px] text-slate-700 dark:text-slate-200", children: t.text })
183
184
  ] }, t.id)),
@@ -215,7 +216,7 @@ function Ce({
215
216
  className: "flex w-full items-center justify-center gap-1.5 rounded-md bg-nvr-cyan px-3 py-2 text-[13px] font-semibold text-white hover:bg-nvr-cyan/90",
216
217
  children: [
217
218
  "Next ",
218
- /* @__PURE__ */ r(E, { className: "h-3.5 w-3.5" })
219
+ /* @__PURE__ */ r(j, { className: "h-3.5 w-3.5" })
219
220
  ]
220
221
  }
221
222
  ) })
@@ -223,7 +224,7 @@ function Ce({
223
224
  }
224
225
  ),
225
226
  m && /* @__PURE__ */ r(
226
- re,
227
+ ae,
227
228
  {
228
229
  payload: m.payload,
229
230
  isRetry: m.revision > 1,
@@ -236,5 +237,5 @@ function Ce({
236
237
  ] });
237
238
  }
238
239
  export {
239
- Ce as QueueItemSheet
240
+ Re as QueueItemSheet
240
241
  };