@nivaro/react 0.3.99 → 0.3.101

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/full.css +1 -1
  2. package/dist/hooks/useFormSchema.js +82 -85
  3. package/dist/hooks/useSessionRecorder.js +206 -175
  4. package/dist/index.d.ts +84 -16
  5. package/dist/index.js +627 -622
  6. package/dist/lib/commands.js +15 -11
  7. package/dist/shared/components/ActivityEntry.js +5 -5
  8. package/dist/shared/components/CollectionBrowserView.js +516 -503
  9. package/dist/shared/components/ItemEditForm.js +3471 -3465
  10. package/dist/shared/components/JobsTray.js +76 -61
  11. package/dist/shared/components/MyWorkView.js +133 -126
  12. package/dist/shared/components/NotificationBell.js +322 -289
  13. package/dist/shared/components/RecordCompare.js +38 -40
  14. package/dist/shared/components/RecordReadView.js +119 -119
  15. package/dist/shared/components/TipLayer.js +56 -41
  16. package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
  17. package/dist/shared/components/integrations/console/SignalCard.js +40 -40
  18. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +95 -73
  19. package/dist/shared/components/integrations/console/drill/status.js +23 -18
  20. package/dist/shared/components/item-edit/InlineGridField.js +45 -45
  21. package/dist/shared/components/item-edit/InlineTableField.js +750 -749
  22. package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
  23. package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
  24. package/dist/shared/components/item-edit/RecordInsights.js +86 -86
  25. package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
  26. package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
  27. package/dist/shared/components/item-edit/header-path-preview.js +46 -34
  28. package/dist/shared/components/item-edit/related-missing.js +75 -19
  29. package/dist/shared/components/notifications/DeliveryChips.js +1 -2
  30. package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
  31. package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
  32. package/dist/shared/components/panels/BackgroundMove.js +242 -0
  33. package/dist/shared/components/panels/MoveAdvisory.js +204 -0
  34. package/dist/shared/components/panels/PipelinePanel.js +1459 -1220
  35. package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
  36. package/dist/shared/components/profile/ActivityFeedCard.js +322 -0
  37. package/dist/shared/components/profile/DayTimeline.js +145 -140
  38. package/dist/shared/components/profile/PersonAccess.js +679 -383
  39. package/dist/shared/components/profile/PersonActivity.js +404 -427
  40. package/dist/shared/components/profile/PersonDidPanel.js +248 -134
  41. package/dist/shared/components/profile/PersonProfile.js +33 -32
  42. package/dist/shared/components/profile/journey-view.js +166 -0
  43. package/dist/shared/lib/activity-sentence.js +319 -236
  44. package/dist/shared/lib/commands.js +18 -14
  45. package/dist/shared/lib/error-hints.js +1 -1
  46. package/dist/shared/lib/job-failure-text.js +12 -0
  47. package/dist/shared/lib/jobs-tray.js +60 -41
  48. package/dist/shared/lib/move-failure.js +19 -0
  49. package/dist/shared/lib/obligation-banner.js +22 -21
  50. package/dist/shared/lib/partner-failure.js +83 -0
  51. package/dist/shared/lib/prefetch.js +73 -73
  52. package/dist/shared/lib/replay-checkout.js +18 -13
  53. package/dist/shared/lib/replay-context.js +90 -77
  54. package/dist/shared/lib/replay-idle.js +21 -0
  55. package/dist/shared/lib/replay-socket.js +21 -17
  56. package/dist/shared/lib/rum.js +56 -51
  57. package/dist/shared/lib/safe-error.js +17 -13
  58. package/dist/shared/lib/stale-chunk.js +69 -26
  59. package/dist/shared/lib/system-collections.js +20 -0
  60. package/package.json +1 -1
@@ -1,22 +1,26 @@
1
- function o(t, n) {
2
- return { _method: "GET", _path: t, _params: n };
1
+ function n(t, o) {
2
+ return { _method: "GET", _path: t, _params: o };
3
3
  }
4
- function _(t, n) {
5
- return { _method: "POST", _path: t, _body: n };
4
+ function e(t) {
5
+ return n("/collection-layouts/active", { ...t, optional: 1 });
6
6
  }
7
- function e(t, n) {
8
- return { _method: "PATCH", _path: t, _body: n };
7
+ function u(t, o) {
8
+ return { _method: "POST", _path: t, _body: o };
9
9
  }
10
- function r(t, n) {
11
- return { _method: "PUT", _path: t, _body: n };
10
+ function r(t, o) {
11
+ return { _method: "PATCH", _path: t, _body: o };
12
12
  }
13
- function h(t) {
13
+ function _(t, o) {
14
+ return { _method: "PUT", _path: t, _body: o };
15
+ }
16
+ function a(t) {
14
17
  return { _method: "DELETE", _path: t };
15
18
  }
16
19
  export {
17
- h as del,
18
- o as get,
19
- e as patch,
20
- _ as post,
21
- r as put
20
+ a as del,
21
+ n as get,
22
+ e as getActiveLayout,
23
+ r as patch,
24
+ u as post,
25
+ _ as put
22
26
  };
@@ -106,7 +106,7 @@ const h = {
106
106
  // ── The platform ───────────────────────────────────────────────────────────
107
107
  MAINTENANCE: "Wait until maintenance ends, then try again.",
108
108
  SERVER_BUSY: "Try again in a few seconds.",
109
- DB_UNAVAILABLE: "The database cannot be reached right now. Try again in a minute.",
109
+ DB_UNAVAILABLE: "Try again in a moment.",
110
110
  MIGRATION_PENDING: "An update is still being applied. Try again in a few minutes.",
111
111
  NOT_CONFIGURED: "Ask an administrator to set this up first.",
112
112
  NOT_READY: "This is still being set up. Try again in a few minutes.",
@@ -0,0 +1,12 @@
1
+ import { describeError as e } from "./error-message.js";
2
+ import { partnerCallText as n } from "./partner-failure.js";
3
+ import { isRawErrorText as o } from "./safe-error.js";
4
+ function u(i) {
5
+ const r = (i ?? "").trim();
6
+ if (!r) return null;
7
+ const t = n(r);
8
+ return t || (o(r) ? e({ message: r }, "This did not finish").title.trim() || "This did not finish" : r);
9
+ }
10
+ export {
11
+ u as jobFailureText
12
+ };
@@ -1,8 +1,8 @@
1
- import { useSyncExternalStore as k } from "react";
2
- const u = "nvr:jobs-tray:v1", a = "nvr:jobs-tray:dismissed:v1", m = 20, w = 1440 * 60 * 1e3;
3
- let s = [], o = /* @__PURE__ */ new Set(), y = !1, S = 0;
4
- const d = /* @__PURE__ */ new Set();
5
- function r(t, n) {
1
+ import { useSyncExternalStore as J } from "react";
2
+ const c = "nvr:jobs-tray:v1", d = "nvr:jobs-tray:dismissed:v1", D = 20, $ = 1440 * 60 * 1e3;
3
+ let s = [], r = /* @__PURE__ */ new Set(), m = !1, b = 0;
4
+ const y = /* @__PURE__ */ new Set();
5
+ function a(t, n) {
6
6
  try {
7
7
  const e = localStorage.getItem(t);
8
8
  return e ? JSON.parse(e) : n;
@@ -10,32 +10,32 @@ function r(t, n) {
10
10
  return n;
11
11
  }
12
12
  }
13
- function f() {
13
+ function g() {
14
14
  try {
15
- localStorage.setItem(u, JSON.stringify(s)), localStorage.setItem(a, JSON.stringify([...o].slice(-200)));
15
+ localStorage.setItem(c, JSON.stringify(s)), localStorage.setItem(d, JSON.stringify([...r].slice(-200)));
16
16
  } catch {
17
17
  }
18
18
  }
19
- function l() {
20
- S++;
21
- for (const t of d) t();
19
+ function f() {
20
+ b++;
21
+ for (const t of y) t();
22
22
  }
23
- function g() {
24
- const t = Date.now() - w;
25
- s = s.filter((n) => n.status === "queued" || n.status === "running" || n.at >= t).sort((n, e) => e.at - n.at).slice(0, m);
23
+ function _() {
24
+ const t = Date.now() - $;
25
+ s = s.filter((n) => n.status === "queued" || n.status === "running" || n.at >= t).sort((n, e) => e.at - n.at).slice(0, D);
26
26
  }
27
- function i() {
28
- y || typeof window > "u" || (y = !0, s = r(u, []), o = new Set(r(a, [])), g(), window.addEventListener("storage", (t) => {
29
- t.key !== u && t.key !== a || (s = r(u, []), o = new Set(r(a, [])), l());
27
+ function l() {
28
+ m || typeof window > "u" || (m = !0, s = a(c, []), r = new Set(a(d, [])), _(), window.addEventListener("storage", (t) => {
29
+ t.key !== c && t.key !== d || (s = a(c, []), r = new Set(a(d, [])), f());
30
30
  }));
31
31
  }
32
- function _(t, n) {
33
- return o.has(t) && (n === "completed" || n === "error" || n === "canceled");
32
+ function j(t, n) {
33
+ return r.has(t) && (n === "completed" || n === "error" || n === "canceled");
34
34
  }
35
- function b(t, n = Date.now()) {
36
- if (i(), !(t != null && t.key) || !t.status) return;
37
- const e = s.find((c) => c.key === t.key);
38
- if (e && (e.status === "completed" || e.status === "error" || e.status === "canceled") && t.status === "running" || (t.status === "queued" && o.delete(t.key), _(t.key, t.status))) return;
35
+ function E(t, n = Date.now()) {
36
+ if (l(), !(t != null && t.key) || !t.status) return;
37
+ const e = s.find((i) => i.key === t.key);
38
+ if (e && (e.status === "completed" || e.status === "error" || e.status === "canceled") && t.status === "running" || (t.status === "queued" && r.delete(t.key), j(t.key, t.status))) return;
39
39
  s = [{
40
40
  key: t.key,
41
41
  kind: t.kind ?? (e == null ? void 0 : e.kind) ?? "job",
@@ -51,32 +51,51 @@ function b(t, n = Date.now()) {
51
51
  position: t.position ?? null,
52
52
  eta_seconds: t.eta_seconds ?? null,
53
53
  at: n
54
- }, ...s.filter((c) => c.key !== t.key)], g(), f(), l();
54
+ }, ...s.filter((i) => i.key !== t.key)], _(), g(), f();
55
+ }
56
+ const k = (t) => `${t} job${t === 1 ? "" : "s"}`;
57
+ function O(t) {
58
+ let n = 0, e = 0, u = 0, i = 0;
59
+ for (const o of t)
60
+ o.status === "running" || o.status === "queued" ? n++ : o.status === "error" ? e++ : o.status === "canceled" ? i++ : u++;
61
+ if (n > 0)
62
+ return {
63
+ tone: "running",
64
+ text: `${k(n)} running`,
65
+ note: e > 0 ? `${e} failed` : null
66
+ };
67
+ const w = [
68
+ [e, "failed"],
69
+ [u, u && (e || i) ? "done" : "finished"],
70
+ [i, "cancelled"]
71
+ ].filter(([o]) => o > 0).map(([o, S], h) => h === 0 ? `${k(o)} ${S}` : `${o} ${S}`).join(", ");
72
+ return { tone: e > 0 ? "failed" : u > 0 ? "done" : "cancelled", text: w, note: null };
55
73
  }
56
- function D(t) {
57
- i();
58
- for (const n of t) b(n, n.at ? new Date(n.at).getTime() : Date.now());
74
+ function T(t) {
75
+ l();
76
+ for (const n of t) E(n, n.at ? new Date(n.at).getTime() : Date.now());
59
77
  }
60
- function E(t) {
61
- i(), o.add(t), s = s.filter((n) => n.key !== t), f(), l();
78
+ function N(t) {
79
+ l(), r.add(t), s = s.filter((n) => n.key !== t), g(), f();
62
80
  }
63
- function I() {
64
- i();
81
+ function M() {
82
+ l();
65
83
  for (const t of s)
66
- t.status !== "queued" && t.status !== "running" && o.add(t.key);
67
- s = s.filter((t) => t.status === "queued" || t.status === "running"), f(), l();
84
+ t.status !== "queued" && t.status !== "running" && r.add(t.key);
85
+ s = s.filter((t) => t.status === "queued" || t.status === "running"), g(), f();
68
86
  }
69
- function q() {
70
- return i(), k(
71
- (t) => (d.add(t), () => d.delete(t)),
72
- () => S,
87
+ function A() {
88
+ return l(), J(
89
+ (t) => (y.add(t), () => y.delete(t)),
90
+ () => b,
73
91
  () => 0
74
92
  ), s;
75
93
  }
76
94
  export {
77
- b as applyJobUpdate,
78
- I as dismissFinishedJobs,
79
- E as dismissJob,
80
- D as seedJobs,
81
- q as useTrayJobs
95
+ E as applyJobUpdate,
96
+ M as dismissFinishedJobs,
97
+ N as dismissJob,
98
+ T as seedJobs,
99
+ O as trayHeadline,
100
+ A as useTrayJobs
82
101
  };
@@ -0,0 +1,19 @@
1
+ import { describeError as c } from "./error-message.js";
2
+ import { partnerCallText as p } from "./partner-failure.js";
3
+ import { serverErrorText as o } from "./safe-error.js";
4
+ function u(i, t) {
5
+ const r = o(i), n = r ? p(r) : null;
6
+ return n ? { title: `${(t == null ? void 0 : t.trim()) || "The move"} did not go through`, description: n } : null;
7
+ }
8
+ function h(i, t) {
9
+ const r = c(i), { hint: n, ...e } = r;
10
+ return {
11
+ ...e,
12
+ title: `${t.title} — ${t.description}`,
13
+ technical: r.technical ?? o(i) ?? void 0
14
+ };
15
+ }
16
+ export {
17
+ u as partnerMoveFailure,
18
+ h as partnerMoveReading
19
+ };
@@ -1,45 +1,46 @@
1
- import { toneForOutcome as d } from "./obligation-filters.js";
2
- import { plainObligationReason as f } from "./obligation-reason-text.js";
3
- import { formatDate as $, getDisplayTimezone as p } from "./utils.js";
4
- const g = (o) => {
5
- const t = p();
1
+ import { toneForOutcome as f } from "./obligation-filters.js";
2
+ import { plainObligationReason as p } from "./obligation-reason-text.js";
3
+ import { partnerFailureText as $ } from "./partner-failure.js";
4
+ import { formatDate as g, getDisplayTimezone as _ } from "./utils.js";
5
+ const h = (o) => {
6
+ const t = _();
6
7
  return new Intl.DateTimeFormat("en-US", {
7
8
  hour: "numeric",
8
9
  minute: "2-digit",
9
10
  ...t ? { timeZone: t } : {}
10
11
  }).format(new Date(o));
11
12
  };
12
- function _(o, t) {
13
- const l = t.getTime() - new Date(o).getTime(), e = Math.floor(l / 6e4);
13
+ function w(o, t) {
14
+ const r = t.getTime() - new Date(o).getTime(), e = Math.floor(r / 6e4);
14
15
  if (e < 1) return "just now";
15
16
  if (e < 60) return `${e}m ago`;
16
17
  const n = Math.floor(e / 60);
17
18
  if (n < 24) return `${n}h ago`;
18
19
  const i = Math.floor(n / 24);
19
- return i < 7 ? `${i}d ago` : $(o);
20
+ return i < 7 ? `${i}d ago` : g(o);
20
21
  }
21
- function h(o) {
22
+ function b(o) {
22
23
  return o.split(/[._-]+/).filter(Boolean).map((t) => t[0].toUpperCase() + t.slice(1)).join(" ");
23
24
  }
24
- function T(o, t = /* @__PURE__ */ new Date()) {
25
- const l = /* @__PURE__ */ new Map();
25
+ function k(o, t = /* @__PURE__ */ new Date()) {
26
+ const r = /* @__PURE__ */ new Map();
26
27
  for (const e of o) {
27
28
  if (e.outcome === "superseded") continue;
28
- const n = l.get(e.api);
29
- (!n || e.id > n.id) && l.set(e.api, e);
29
+ const n = r.get(e.api);
30
+ (!n || e.id > n.id) && r.set(e.api, e);
30
31
  }
31
- return [...l.values()].map((e) => {
32
- var c;
33
- const n = e.resolved_at ?? e.due_at, i = `${_(n, t)} (${g(n)})`, r = e.reason ? ` — ${f(e.reason)}` : "", u = ((c = e.label) == null ? void 0 : c.trim()) || (e.trigger === "transition" ? h(e.kind) : ""), a = u ? ` · ${u}` : "";
32
+ return [...r.values()].map((e) => {
33
+ var m;
34
+ const n = e.resolved_at ?? e.due_at, i = `${w(n, t)} (${h(n)})`, u = e.reason ? p(e.reason) : "", l = e.reason ? ` — ${u !== e.reason.trim() ? u : $(e.reason) ?? u}` : "", c = ((m = e.label) == null ? void 0 : m.trim()) || (e.trigger === "transition" ? b(e.kind) : ""), a = c ? ` · ${c}` : "";
34
35
  let s;
35
36
  if (e.outcome === "sent") s = `told ${i}${a}`;
36
37
  else if (e.outcome === "pending") {
37
- const m = Math.round((t.getTime() - new Date(e.due_at).getTime()) / 6e4);
38
- s = `sent ${i}${a}, awaiting acknowledgement (${m} min)`;
39
- } else e.outcome === "skipped" ? s = `should have been told ${i}${a}${r}` : e.outcome === "failed" ? s = `send failed ${i}${a}${r}` : e.outcome === "missing" ? s = `never told${a}${r}` : s = `still not told${a}${r}`;
38
+ const d = Math.round((t.getTime() - new Date(e.due_at).getTime()) / 6e4);
39
+ s = `sent ${i}${a}, awaiting acknowledgement (${d} min)`;
40
+ } else e.outcome === "skipped" ? s = `should have been told ${i}${a}${l}` : e.outcome === "failed" ? s = `send failed ${i}${a}${l}` : e.outcome === "missing" ? s = `never told${a}${l}` : s = `still not told${a}${l}`;
40
41
  return {
41
42
  api: e.api,
42
- tone: d(e.outcome),
43
+ tone: f(e.outcome),
43
44
  text: s,
44
45
  obligation_id: e.id,
45
46
  outcome: e.outcome,
@@ -53,5 +54,5 @@ function T(o, t = /* @__PURE__ */ new Date()) {
53
54
  });
54
55
  }
55
56
  export {
56
- T as bannerLines
57
+ k as bannerLines
57
58
  };
@@ -0,0 +1,83 @@
1
+ import { isRawErrorText as u } from "./safe-error.js";
2
+ function $(t, e) {
3
+ const r = (t ?? "").trim(), n = (e ?? "").trim(), s = n && r.toLowerCase().startsWith(`${n.toLowerCase()}:`) ? r.slice(n.length + 1).trim() : r;
4
+ return s ? s.charAt(0).toUpperCase() + s.slice(1) : "";
5
+ }
6
+ const d = /\bHTTP \d{3}: /, h = [
7
+ "message",
8
+ "error_description",
9
+ "detail",
10
+ "error",
11
+ "title",
12
+ "reason",
13
+ "description",
14
+ "msg"
15
+ ], m = new RegExp(`"(?:${h.join("|")})"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)`);
16
+ function a(t) {
17
+ try {
18
+ return JSON.parse(`"${t.replace(/\\$/, "")}"`);
19
+ } catch {
20
+ return t;
21
+ }
22
+ }
23
+ function f(t, e = 0) {
24
+ if (typeof t == "string") return t;
25
+ if (!t || typeof t != "object" || Array.isArray(t) || e > 1) return null;
26
+ const r = t;
27
+ for (const n of h) {
28
+ const s = f(r[n], e + 1);
29
+ if (s != null && s.trim()) return s;
30
+ }
31
+ return null;
32
+ }
33
+ function p(t) {
34
+ const e = d.exec(t);
35
+ if (!e) return null;
36
+ const r = t.slice(e.index + e[0].length).trim();
37
+ let n = null, s = !1;
38
+ try {
39
+ n = f(JSON.parse(r));
40
+ } catch {
41
+ const i = m.exec(r);
42
+ i ? (n = a(i[1]), s = r[i.index + i[0].length] !== '"') : r.startsWith('"') && (n = a(r.slice(1).replace(/"$/, "")), s = r.length < 2 || !r.endsWith('"'));
43
+ }
44
+ const o = (n ?? "").replace(/\s+/g, " ").trim(), c = s || o.length > 300 ? `${o.slice(0, 299).trimEnd()}…` : o;
45
+ if (o.length < 3 || /<[a-z!/]/i.test(o) || u(o)) return null;
46
+ const l = t.slice(0, e.index).replace(/[\s:·—–-]+$/, "").trim();
47
+ return l ? `${l}: ${c}` : c;
48
+ }
49
+ const T = /\bHTTP (\d{3})\b/, g = /\b(?:fetch failed|Timed out after \d+ms|socket hang up|E(?:CONN[A-Z]+|NOTFOUND|AI_AGAIN|TIMEDOUT|HOSTUNREACH))\b/;
50
+ function A(t) {
51
+ var r;
52
+ const e = Number(((r = T.exec(t)) == null ? void 0 : r[1]) ?? 0);
53
+ return e ? e === 401 || e === 403 ? "The other system did not accept this app’s sign-in. An administrator needs to check the connection." : e === 408 || e === 504 ? "The other system took too long to answer." : e === 502 || e === 503 ? "The other system is not answering right now." : e >= 500 ? "The other system ran into a problem of its own." : "The other system refused the request." : g.test(t) ? /Timed out after|ETIMEDOUT/.test(t) ? "The other system took too long to answer." : "The other system could not be reached." : null;
54
+ }
55
+ function E(t) {
56
+ return p(t) ?? A(t);
57
+ }
58
+ const y = /^(submission failed)\s+[—–-]\s+([\s\S]+)$/i;
59
+ function N(t) {
60
+ const e = E(t);
61
+ if (e) return e;
62
+ const r = y.exec(t.trim());
63
+ if (!r) return null;
64
+ const n = r[2].replace(/\s+/g, " ").trim();
65
+ if (n.length < 3 || /<[a-z!/]/i.test(n) || u(n)) return null;
66
+ const s = n.length > 300 ? `${n.slice(0, 299).trimEnd()}…` : n, o = r[1];
67
+ return `${o.charAt(0).toUpperCase()}${o.slice(1).toLowerCase()}: ${s}`;
68
+ }
69
+ const b = /(?:^|: )submission failed\s+[—–-]\s/i;
70
+ function S(t) {
71
+ const e = b.exec(t);
72
+ if (!e) return null;
73
+ const r = t.slice(e.index + (e[0].startsWith(": ") ? 2 : 0));
74
+ return N(r.charAt(0).toUpperCase() + r.slice(1));
75
+ }
76
+ export {
77
+ S as partnerCallText,
78
+ E as partnerFailureText,
79
+ A as partnerOutcome,
80
+ N as partnerSaid,
81
+ p as partnerWords,
82
+ $ as withoutMoveLabel
83
+ };