@nivaro/react 0.3.100 → 0.3.102

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 (32) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +46 -3
  4. package/dist/index.js +623 -620
  5. package/dist/shared/components/ActivityEntry.js +5 -5
  6. package/dist/shared/components/CollectionBrowserView.js +183 -175
  7. package/dist/shared/components/ItemEditForm.js +2708 -2704
  8. package/dist/shared/components/JobsTray.js +74 -63
  9. package/dist/shared/components/NotificationBell.js +80 -73
  10. package/dist/shared/components/TipLayer.js +56 -41
  11. package/dist/shared/components/cbv-file-label.js +46 -0
  12. package/dist/shared/components/integrations/console/SignalCard.js +40 -40
  13. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +95 -73
  14. package/dist/shared/components/integrations/console/drill/status.js +23 -18
  15. package/dist/shared/components/item-edit/RecordInsights.js +86 -86
  16. package/dist/shared/components/item-edit/header-path-preview.js +46 -34
  17. package/dist/shared/components/notifications/DeliveryChips.js +1 -2
  18. package/dist/shared/components/panels/BackgroundMove.js +152 -85
  19. package/dist/shared/components/panels/PipelinePanel.js +602 -594
  20. package/dist/shared/components/profile/ActivityFeedCard.js +322 -0
  21. package/dist/shared/components/profile/DayTimeline.js +145 -140
  22. package/dist/shared/components/profile/PersonAccess.js +679 -383
  23. package/dist/shared/components/profile/PersonActivity.js +404 -427
  24. package/dist/shared/components/profile/PersonDidPanel.js +248 -134
  25. package/dist/shared/components/profile/PersonProfile.js +33 -32
  26. package/dist/shared/components/profile/journey-view.js +166 -0
  27. package/dist/shared/lib/activity-sentence.js +319 -236
  28. package/dist/shared/lib/jobs-tray.js +60 -41
  29. package/dist/shared/lib/move-failure.js +16 -6
  30. package/dist/shared/lib/obligation-banner.js +16 -16
  31. package/dist/shared/lib/partner-failure.js +44 -32
  32. package/package.json +1 -1
@@ -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
  };
@@ -1,9 +1,19 @@
1
- import { partnerCallText as e } from "./partner-failure.js";
2
- import { serverErrorText as i } from "./safe-error.js";
3
- function p(n, r) {
4
- const t = i(n), o = t ? e(t) : null;
5
- return o ? { title: `${(r == null ? void 0 : r.trim()) || "The move"} did not go through`, description: o } : null;
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
+ };
6
15
  }
7
16
  export {
8
- p as partnerMoveFailure
17
+ u as partnerMoveFailure,
18
+ h as partnerMoveReading
9
19
  };
@@ -1,28 +1,28 @@
1
- import { toneForOutcome as d } from "./obligation-filters.js";
2
- import { plainObligationReason as f } from "./obligation-reason-text.js";
3
- import { partnerFailureText as p } from "./partner-failure.js";
4
- import { formatDate as $, getDisplayTimezone as g } from "./utils.js";
5
- const _ = (o) => {
6
- const t = g();
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 = _();
7
7
  return new Intl.DateTimeFormat("en-US", {
8
8
  hour: "numeric",
9
9
  minute: "2-digit",
10
10
  ...t ? { timeZone: t } : {}
11
11
  }).format(new Date(o));
12
12
  };
13
- function h(o, t) {
13
+ function w(o, t) {
14
14
  const r = t.getTime() - new Date(o).getTime(), e = Math.floor(r / 6e4);
15
15
  if (e < 1) return "just now";
16
16
  if (e < 60) return `${e}m ago`;
17
17
  const n = Math.floor(e / 60);
18
18
  if (n < 24) return `${n}h ago`;
19
19
  const i = Math.floor(n / 24);
20
- return i < 7 ? `${i}d ago` : $(o);
20
+ return i < 7 ? `${i}d ago` : g(o);
21
21
  }
22
- function w(o) {
22
+ function b(o) {
23
23
  return o.split(/[._-]+/).filter(Boolean).map((t) => t[0].toUpperCase() + t.slice(1)).join(" ");
24
24
  }
25
- function M(o, t = /* @__PURE__ */ new Date()) {
25
+ function k(o, t = /* @__PURE__ */ new Date()) {
26
26
  const r = /* @__PURE__ */ new Map();
27
27
  for (const e of o) {
28
28
  if (e.outcome === "superseded") continue;
@@ -30,17 +30,17 @@ function M(o, t = /* @__PURE__ */ new Date()) {
30
30
  (!n || e.id > n.id) && r.set(e.api, e);
31
31
  }
32
32
  return [...r.values()].map((e) => {
33
- var c;
34
- const n = e.resolved_at ?? e.due_at, i = `${h(n, t)} (${_(n)})`, l = e.reason ? ` — ${p(e.reason) ?? f(e.reason)}` : "", u = ((c = e.label) == null ? void 0 : c.trim()) || (e.trigger === "transition" ? w(e.kind) : ""), a = u ? ` · ${u}` : "";
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}` : "";
35
35
  let s;
36
36
  if (e.outcome === "sent") s = `told ${i}${a}`;
37
37
  else if (e.outcome === "pending") {
38
- const m = Math.round((t.getTime() - new Date(e.due_at).getTime()) / 6e4);
39
- s = `sent ${i}${a}, awaiting acknowledgement (${m} min)`;
38
+ const d = Math.round((t.getTime() - new Date(e.due_at).getTime()) / 6e4);
39
+ s = `sent ${i}${a}, awaiting acknowledgement (${d} min)`;
40
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}`;
41
41
  return {
42
42
  api: e.api,
43
- tone: d(e.outcome),
43
+ tone: f(e.outcome),
44
44
  text: s,
45
45
  obligation_id: e.id,
46
46
  outcome: e.outcome,
@@ -54,5 +54,5 @@ function M(o, t = /* @__PURE__ */ new Date()) {
54
54
  });
55
55
  }
56
56
  export {
57
- M as bannerLines
57
+ k as bannerLines
58
58
  };
@@ -1,9 +1,9 @@
1
- import { isRawErrorText as f } from "./safe-error.js";
2
- function b(t, e) {
3
- const r = (t ?? "").trim(), s = (e ?? "").trim(), n = s && r.toLowerCase().startsWith(`${s.toLowerCase()}:`) ? r.slice(s.length + 1).trim() : r;
4
- return n ? n.charAt(0).toUpperCase() + n.slice(1) : "";
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
5
  }
6
- const m = /\bHTTP \d{3}: /, u = [
6
+ const d = /\bHTTP \d{3}: /, h = [
7
7
  "message",
8
8
  "error_description",
9
9
  "detail",
@@ -12,7 +12,7 @@ const m = /\bHTTP \d{3}: /, u = [
12
12
  "reason",
13
13
  "description",
14
14
  "msg"
15
- ], T = new RegExp(`"(?:${u.join("|")})"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)`);
15
+ ], m = new RegExp(`"(?:${h.join("|")})"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)`);
16
16
  function a(t) {
17
17
  try {
18
18
  return JSON.parse(`"${t.replace(/\\$/, "")}"`);
@@ -20,52 +20,64 @@ function a(t) {
20
20
  return t;
21
21
  }
22
22
  }
23
- function h(t, e = 0) {
23
+ function f(t, e = 0) {
24
24
  if (typeof t == "string") return t;
25
25
  if (!t || typeof t != "object" || Array.isArray(t) || e > 1) return null;
26
26
  const r = t;
27
- for (const s of u) {
28
- const n = h(r[s], e + 1);
29
- if (n != null && n.trim()) return n;
27
+ for (const n of h) {
28
+ const s = f(r[n], e + 1);
29
+ if (s != null && s.trim()) return s;
30
30
  }
31
31
  return null;
32
32
  }
33
- function d(t) {
34
- const e = m.exec(t);
33
+ function p(t) {
34
+ const e = d.exec(t);
35
35
  if (!e) return null;
36
36
  const r = t.slice(e.index + e[0].length).trim();
37
- let s = null, n = !1;
37
+ let n = null, s = !1;
38
38
  try {
39
- s = h(JSON.parse(r));
39
+ n = f(JSON.parse(r));
40
40
  } catch {
41
- const i = T.exec(r);
42
- i ? (s = a(i[1]), n = r[i.index + i[0].length] !== '"') : r.startsWith('"') && (s = a(r.slice(1).replace(/"$/, "")), n = r.length < 2 || !r.endsWith('"'));
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
43
  }
44
- const o = (s ?? "").replace(/\s+/g, " ").trim(), c = n || o.length > 300 ? `${o.slice(0, 299).trimEnd()}…` : o;
45
- if (o.length < 3 || /<[a-z!/]/i.test(o) || f(o)) return null;
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
46
  const l = t.slice(0, e.index).replace(/[\s:·—–-]+$/, "").trim();
47
47
  return l ? `${l}: ${c}` : c;
48
48
  }
49
- const p = /\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 y(t) {
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
51
  var r;
52
- const e = Number(((r = p.exec(t)) == null ? void 0 : r[1]) ?? 0);
52
+ const e = Number(((r = T.exec(t)) == null ? void 0 : r[1]) ?? 0);
53
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
54
  }
55
- function A(t) {
56
- return d(t) ?? y(t);
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}`;
57
68
  }
58
- const E = /(?:^|: )submission failed\s+[—–-]\s/i;
59
- function x(t) {
60
- const e = E.exec(t);
69
+ const b = /(?:^|: )submission failed\s+[—–-]\s/i;
70
+ function S(t) {
71
+ const e = b.exec(t);
61
72
  if (!e) return null;
62
73
  const r = t.slice(e.index + (e[0].startsWith(": ") ? 2 : 0));
63
- return A(r.charAt(0).toUpperCase() + r.slice(1));
74
+ return N(r.charAt(0).toUpperCase() + r.slice(1));
64
75
  }
65
76
  export {
66
- x as partnerCallText,
67
- A as partnerFailureText,
68
- y as partnerOutcome,
69
- d as partnerWords,
70
- b as withoutMoveLabel
77
+ S as partnerCallText,
78
+ E as partnerFailureText,
79
+ A as partnerOutcome,
80
+ N as partnerSaid,
81
+ p as partnerWords,
82
+ $ as withoutMoveLabel
71
83
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.100",
3
+ "version": "0.3.102",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",