@nivaro/react 0.3.137 → 0.3.139

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 (50) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +95 -4
  4. package/dist/index.js +748 -743
  5. package/dist/shared/components/CollectionBrowserView.js +392 -389
  6. package/dist/shared/components/DelegateCoverLine.js +80 -87
  7. package/dist/shared/components/ItemEditForm.js +589 -588
  8. package/dist/shared/components/MyWorkView.js +284 -286
  9. package/dist/shared/components/NotificationBell.js +251 -205
  10. package/dist/shared/components/ai/AiAnalyticsView.js +878 -417
  11. package/dist/shared/components/ai/AiPlanCard.js +164 -122
  12. package/dist/shared/components/ai/AiPlanUndo.js +291 -0
  13. package/dist/shared/components/ai/call-log/CallDrawer.js +357 -0
  14. package/dist/shared/components/ai/call-log/RawJson.js +126 -0
  15. package/dist/shared/components/ai/call-log/ThreadView.js +223 -0
  16. package/dist/shared/components/ai/call-log/TranscriptView.js +227 -0
  17. package/dist/shared/components/ai/call-log/controls.js +364 -0
  18. package/dist/shared/components/ai/call-log/format.js +46 -0
  19. package/dist/shared/components/ai/call-log/url.js +105 -0
  20. package/dist/shared/components/chat/chat-core.js +422 -346
  21. package/dist/shared/components/integrations/IntegrationObligationsView.js +98 -98
  22. package/dist/shared/components/integrations/RecordIntegrationPreview.js +102 -93
  23. package/dist/shared/components/integrations/console/api.js +11 -1
  24. package/dist/shared/components/item-edit/HeaderRollupExplainer.js +5 -1
  25. package/dist/shared/components/item-edit/RecordLiveSync.js +241 -229
  26. package/dist/shared/components/item-edit/RecordRecapChanges.js +166 -0
  27. package/dist/shared/components/item-edit/RecordRecapStrip.js +254 -84
  28. package/dist/shared/components/item-edit/live-related.js +34 -18
  29. package/dist/shared/components/panels/RevisionsPanel.js +735 -683
  30. package/dist/shared/components/queue/QueueWorklist.js +323 -316
  31. package/dist/shared/components/support/SupportRequestDialog.js +198 -181
  32. package/dist/shared/components/trackers/use-tracker-link.js +74 -65
  33. package/dist/shared/lib/activity-sentence.js +167 -151
  34. package/dist/shared/lib/config-update-refresh.js +34 -0
  35. package/dist/shared/lib/config-watch.js +17 -17
  36. package/dist/shared/lib/gap-refresh.js +49 -0
  37. package/dist/shared/lib/integration-dots.js +8 -8
  38. package/dist/shared/lib/live-ops.js +26 -23
  39. package/dist/shared/lib/live-pickers.js +1 -1
  40. package/dist/shared/lib/live-queries.js +223 -195
  41. package/dist/shared/lib/live.js +56 -51
  42. package/dist/shared/lib/obligation-banner.js +11 -10
  43. package/dist/shared/lib/obligation-filters.js +22 -18
  44. package/dist/shared/lib/obligation-reason-text.js +18 -8
  45. package/dist/shared/lib/presence-hooks.js +133 -132
  46. package/dist/shared/lib/reconnect-resync.js +90 -0
  47. package/dist/shared/lib/record-room-holds.js +43 -0
  48. package/dist/shared/lib/socket-realtime.js +116 -105
  49. package/dist/shared/lib/user-sync.js +1 -6
  50. package/package.json +1 -1
@@ -1,103 +1,104 @@
1
- var k = Object.defineProperty;
2
- var G = (l, o, n) => o in l ? k(l, o, { enumerable: !0, configurable: !0, writable: !0, value: n }) : l[o] = n;
3
- var U = (l, o, n) => G(l, typeof o != "symbol" ? o + "" : o, n);
4
- import { bindClientChaosSocket as $ } from "./client-chaos.js";
5
- import { deliveryAckFor as x } from "./delivery-ack.js";
6
- import { createRecordGapTracker as B, recordRefetchEvent as D } from "./record-gaps.js";
7
- import { forgetSettledReads as W } from "./request-gate.js";
8
- import { createRoomGapTracker as V, refetchEventsFor as z } from "./room-gaps.js";
9
- import { livenessOf as H, attachSocketLiveness as K } from "./socket-liveness.js";
10
- const I = 3e3;
11
- function P(l = I) {
12
- const o = /* @__PURE__ */ new Map();
13
- return (n, m) => {
1
+ var H = Object.defineProperty;
2
+ var $ = (l, r, s) => r in l ? H(l, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : l[r] = s;
3
+ var I = (l, r, s) => $(l, typeof r != "symbol" ? r + "" : r, s);
4
+ import { bindClientChaosSocket as x } from "./client-chaos.js";
5
+ import { deliveryAckFor as B } from "./delivery-ack.js";
6
+ import { createRecordGapTracker as D, recordRefetchEvent as V } from "./record-gaps.js";
7
+ import { createRecordRoomHolds as z } from "./record-room-holds.js";
8
+ import { forgetSettledReads as J } from "./request-gate.js";
9
+ import { createRoomGapTracker as K, refetchEventsFor as P } from "./room-gaps.js";
10
+ import { livenessOf as Q, attachSocketLiveness as X } from "./socket-liveness.js";
11
+ const y = 3e3;
12
+ function Y(l = y) {
13
+ const r = /* @__PURE__ */ new Map();
14
+ return (s, m) => {
14
15
  var w;
15
16
  if (!(l > 0)) {
16
17
  m();
17
18
  return;
18
19
  }
19
- const u = o.has(n);
20
- if (o.set(n, m), u) return;
20
+ const u = r.has(s);
21
+ if (r.set(s, m), u) return;
21
22
  const a = setTimeout(
22
23
  () => {
23
- const d = o.get(n);
24
- o.delete(n), d == null || d();
24
+ const d = r.get(s);
25
+ r.delete(s), d == null || d();
25
26
  },
26
27
  Math.floor(Math.random() * l)
27
28
  );
28
29
  (w = a.unref) == null || w.call(a);
29
30
  };
30
31
  }
31
- const j = {
32
+ const T = {
32
33
  catchupFull: "nvr:catchup-full",
33
34
  accessChanged: "nvr:access-changed",
34
35
  configUpdate: "nvr:config-update",
35
36
  forceRefresh: "nvr:force-refresh"
36
37
  };
37
38
  class M {
38
- constructor(o, n) {
39
- U(this, "refs", /* @__PURE__ */ new Map());
40
- this.join = o, this.leave = n;
39
+ constructor(r, s) {
40
+ I(this, "refs", /* @__PURE__ */ new Map());
41
+ this.join = r, this.leave = s;
41
42
  }
42
- add(o) {
43
- const n = this.refs.get(o) ?? 0;
44
- this.refs.set(o, n + 1), n === 0 && this.join(o);
43
+ add(r) {
44
+ const s = this.refs.get(r) ?? 0;
45
+ this.refs.set(r, s + 1), s === 0 && this.join(r);
45
46
  }
46
- remove(o) {
47
- const n = this.refs.get(o) ?? 0;
48
- n <= 0 || (n === 1 ? (this.refs.delete(o), this.leave(o)) : this.refs.set(o, n - 1));
47
+ remove(r) {
48
+ const s = this.refs.get(r) ?? 0;
49
+ s <= 0 || (s === 1 ? (this.refs.delete(r), this.leave(r)) : this.refs.set(r, s - 1));
49
50
  }
50
51
  rejoinAll() {
51
- for (const o of this.refs.keys()) this.join(o);
52
+ for (const r of this.refs.keys()) this.join(r);
52
53
  }
53
54
  keys() {
54
55
  return [...this.refs.keys()];
55
56
  }
56
57
  }
57
- function oe(l) {
58
- let o = null, n = 0, m = !1, u = null, a = { state: "live", transport: null, refreshed: null, resumed: null };
58
+ function ce(l) {
59
+ let r = null, s = 0, m = !1, u = null, a = { state: "live", transport: null, refreshed: null, resumed: null };
59
60
  const w = /* @__PURE__ */ new Set(), d = (e) => {
60
61
  var t;
61
62
  return ((t = l.windowEvents) == null ? void 0 : t[e]) !== !1;
62
- }, L = P(l.reactionJitterMs ?? I), E = /* @__PURE__ */ new Set(), v = (e) => {
63
+ }, L = Y(l.reactionJitterMs ?? y), E = /* @__PURE__ */ new Set(), g = (e) => {
63
64
  const t = { ...a, ...e };
64
65
  if (!(t.state === a.state && t.transport === a.transport && t.refreshed === a.refreshed && t.resumed === a.resumed && (t.repair ?? null) === (a.repair ?? null))) {
65
66
  a = t;
66
- for (const s of w) s(a);
67
+ for (const n of w) n(a);
67
68
  }
68
69
  }, _ = () => {
69
- var e, t, s;
70
- return ((s = (t = (e = o == null ? void 0 : o.io) == null ? void 0 : e.engine) == null ? void 0 : t.transport) == null ? void 0 : s.name) ?? null;
70
+ var e, t, n;
71
+ return ((n = (t = (e = r == null ? void 0 : r.io) == null ? void 0 : e.engine) == null ? void 0 : t.transport) == null ? void 0 : n.name) ?? null;
71
72
  };
72
- let q = !1;
73
+ let j = !1;
73
74
  const N = () => {
74
- q && (q = !1, v({ repair: null }));
75
+ j && (j = !1, g({ repair: null }));
75
76
  }, C = (e, t) => {
76
- u && clearTimeout(u), u = null, v({ state: "live", transport: _(), refreshed: e, resumed: t }), N();
77
- }, g = (e, t) => {
77
+ u && clearTimeout(u), u = null, g({ state: "live", transport: _(), refreshed: e, resumed: t }), N();
78
+ }, v = (e, t) => {
78
79
  typeof window > "u" || window.dispatchEvent(new CustomEvent(e, { detail: t }));
79
80
  }, p = (e, t) => {
80
- o != null && o.connected && o.emit(e, t);
81
+ r != null && r.connected && r.emit(e, t);
81
82
  }, F = (e, t) => {
82
- var s;
83
- for (const r of ((s = o == null ? void 0 : o.listeners) == null ? void 0 : s.call(o, e)) ?? []) r(t);
84
- }, h = B({
83
+ var n;
84
+ for (const o of ((n = r == null ? void 0 : r.listeners) == null ? void 0 : n.call(r, e)) ?? []) o(t);
85
+ }, h = D({
85
86
  refetch: (e) => {
86
87
  for (const t of e) {
87
- const s = D(t);
88
- F(s.event, s.payload);
88
+ const n = V(t);
89
+ F(n.event, n.payload);
89
90
  }
90
91
  }
91
- }), O = (e) => e.filter((t) => t.startsWith("collection:")).map((t) => t.slice(11)), y = (e) => {
92
+ }), O = (e) => e.filter((t) => t.startsWith("collection:")).map((t) => t.slice(11)), U = (e) => {
92
93
  h.forget(O(e));
93
- for (const t of z(e)) F(t.event, t.payload);
94
- g("nvr:realtime-stale", { rooms: e });
95
- }, R = V({
94
+ for (const t of P(e)) F(t.event, t.payload);
95
+ v("nvr:realtime-stale", { rooms: e });
96
+ }, R = K({
96
97
  request: (e) => p("catchup:room", e),
97
98
  dispatch: (e, t) => {
98
99
  h.observe(e, t), F(e, t);
99
100
  },
100
- refetch: y
101
+ refetch: U
101
102
  }), S = new M(
102
103
  (e) => {
103
104
  R.reset([`collection:${e}`]), h.forget([e]), p("collection:join", { collection: e });
@@ -110,120 +111,130 @@ function oe(l) {
110
111
  // lib/socket.ts watchJoinPayload.
111
112
  (e) => p("admin:join", e === "traffic-map" ? { room: e, frames: "batch" } : { room: e }),
112
113
  (e) => p("admin:leave", { room: e })
113
- ), A = new M(
114
+ ), W = z(), A = new M(
114
115
  (e) => p("ops:join", { topic: e }),
115
116
  (e) => p("ops:leave", { topic: e })
116
- ), T = () => {
117
- var s;
118
- if (o) return o;
117
+ ), q = () => {
118
+ var n;
119
+ if (r) return r;
119
120
  const e = typeof l.socket == "function" ? l.socket() : l.socket;
120
- o = e, $(e);
121
- const t = H(e) ?? K(e);
122
- return t && (t.repairing() && (a = { ...a, repair: "silent" }), t.onRepairing((r, c) => {
123
- q = !r && c === "repaired", q || v({ repair: r ? "silent" : null });
121
+ r = e, x(e);
122
+ const t = Q(e) ?? X(e);
123
+ return t && (t.repairing() && (a = { ...a, repair: "silent" }), t.onRepairing((o, c) => {
124
+ j = !o && c === "repaired", j || g({ repair: o ? "silent" : null });
124
125
  })), m = e.connected, e.on("auth:ok", () => {
125
- if (R.reset(), S.rejoinAll(), b.rejoinAll(), A.rejoinAll(), m && n > 0) {
126
- const r = n;
127
- v({ transport: _() }), u && clearTimeout(u), u = setTimeout(() => C(null, "unverified"), l.catchupTimeoutMs ?? 8e3), e.emit("catchup", { cursor: r });
126
+ if (R.reset(), S.rejoinAll(), b.rejoinAll(), A.rejoinAll(), m && s > 0) {
127
+ const o = s;
128
+ g({ transport: _() }), u && clearTimeout(u), u = setTimeout(() => C(null, "unverified"), l.catchupTimeoutMs ?? 8e3), e.emit("catchup", { cursor: o });
128
129
  } else
129
- v({
130
+ g({
130
131
  state: "live",
131
132
  transport: _(),
132
133
  refreshed: null,
133
134
  resumed: m && a.state === "reconnecting" ? "unverified" : null
134
135
  }), N();
135
136
  m = !0;
136
- }), e.on("catchup:cursor", (r) => {
137
- n === 0 && typeof (r == null ? void 0 : r.seq) == "number" && r.seq > 0 && (n = r.seq);
137
+ }), e.on("catchup:cursor", (o) => {
138
+ s === 0 && typeof (o == null ? void 0 : o.seq) == "number" && o.seq > 0 && (s = o.seq);
138
139
  }), e.on("disconnect", () => {
139
140
  u && clearTimeout(u), u = null;
140
- const r = !!(t != null && t.repairing());
141
- q = !1, v({ state: "reconnecting", refreshed: null, ...r ? {} : { repair: null } });
142
- }), e.on("connect_error", () => v({ state: "reconnecting", refreshed: null })), (s = e.onAny) == null || s.call(e, (r, c) => {
141
+ const o = !!(t != null && t.repairing());
142
+ j = !1, g({ state: "reconnecting", refreshed: null, ...o ? {} : { repair: null } });
143
+ }), e.on("connect_error", () => g({ state: "reconnecting", refreshed: null })), (n = e.onAny) == null || n.call(e, (o, c) => {
143
144
  const i = c == null ? void 0 : c._seq;
144
- typeof i == "number" && i > n && (n = i), R.observe(c), h.observe(r, c);
145
- const f = x(c);
145
+ typeof i == "number" && i > s && (s = i), R.observe(c), h.observe(o, c);
146
+ const f = B(c);
146
147
  f && e.emit("rt:ack", f);
147
- }), e.on("catchup:room:events", (r) => R.replayed(r)), e.on("realtime:stale", (r) => {
148
- const c = Array.isArray(r == null ? void 0 : r.rooms) ? r.rooms.filter((i) => typeof i == "string") : [];
149
- R.reset(c), h.forget(r != null && r.all ? void 0 : O(c)), r != null && r.all ? (d("catchupFull") && g(j.catchupFull, {}), g("nvr:realtime-stale", { rooms: c, all: !0 })) : c.length && y(c);
148
+ }), e.on("catchup:room:events", (o) => R.replayed(o)), e.on("realtime:stale", (o) => {
149
+ const c = Array.isArray(o == null ? void 0 : o.rooms) ? o.rooms.filter((i) => typeof i == "string") : [];
150
+ R.reset(c), h.forget(o != null && o.all ? void 0 : O(c)), o != null && o.all ? (d("catchupFull") && v(T.catchupFull, {}), v("nvr:realtime-stale", { rooms: c, all: !0 })) : c.length && U(c);
150
151
  }), e.on(
151
152
  "catchup:events",
152
- (r) => {
153
+ (o) => {
153
154
  var c;
154
- for (const i of (r == null ? void 0 : r.events) ?? []) {
155
- i.seq > n && (n = i.seq);
155
+ for (const i of (o == null ? void 0 : o.events) ?? []) {
156
+ i.seq > s && (s = i.seq);
156
157
  const f = {
157
158
  ...i.payload,
158
159
  _seq: i.seq,
159
160
  ...typeof i.iseq == "number" ? { _iseq: i.iseq } : {}
160
161
  };
161
162
  h.observe(i.event, f);
162
- for (const J of ((c = e.listeners) == null ? void 0 : c.call(e, i.event)) ?? []) J(f);
163
+ for (const G of ((c = e.listeners) == null ? void 0 : c.call(e, i.event)) ?? []) G(f);
163
164
  }
164
165
  C(null, "replayed");
165
166
  }
166
- ), e.on("catchup:full", (r) => {
167
- h.forget(), d("catchupFull") && L("full", () => g(j.catchupFull, {})), C(
168
- (r == null ? void 0 : r.reason) === "slow-consumer" ? "Live updates resumed. This tab fell too far behind to send each change, so the lists and records on this page were reloaded." : "Live updates resumed. The connection was gone too long to replay each change, so the lists and records on this page were reloaded.",
167
+ ), e.on("catchup:full", (o) => {
168
+ h.forget(), d("catchupFull") && L("full", () => v(T.catchupFull, {})), C(
169
+ (o == null ? void 0 : o.reason) === "slow-consumer" ? "Live updates resumed. This tab fell too far behind to send each change, so the lists and records on this page were reloaded." : "Live updates resumed. The connection was gone too long to replay each change, so the lists and records on this page were reloaded.",
169
170
  "reloaded"
170
171
  );
171
- }), e.on("access:changed", (r) => {
172
+ }), e.on("access:changed", (o) => {
172
173
  var c;
173
- if (W(), (c = r == null ? void 0 : r.rooms_left) != null && c.length && d("accessChanged")) {
174
- for (const i of r.rooms_left) E.add(i);
174
+ if (J(), (c = o == null ? void 0 : o.rooms_left) != null && c.length && d("accessChanged")) {
175
+ for (const i of o.rooms_left) E.add(i);
175
176
  L("access", () => {
176
177
  const i = [...E];
177
- E.clear(), g(j.accessChanged, { rooms_left: i });
178
+ E.clear(), v(T.accessChanged, { rooms_left: i });
178
179
  });
179
180
  }
180
- }), e.on("config:update", (r) => {
181
- W(), d("configUpdate") && g(j.configUpdate, r ?? {});
182
- }), e.on("client:force-refresh", (r) => {
183
- d("forceRefresh") && g(j.forceRefresh, r ?? {});
181
+ }), e.on("config:update", (o) => {
182
+ J(), d("configUpdate") && v(T.configUpdate, o ?? {});
183
+ }), e.on("client:force-refresh", (o) => {
184
+ d("forceRefresh") && v(T.forceRefresh, o ?? {});
184
185
  }), e;
185
186
  };
186
187
  return {
187
188
  subscribeCollections(e, t) {
188
- const s = T(), r = [...new Set(e.filter(Boolean))];
189
- for (const f of r) S.add(f);
189
+ const n = q(), o = [...new Set(e.filter(Boolean))];
190
+ for (const f of o) S.add(f);
190
191
  const c = (f) => {
191
- f != null && f.collection && r.includes(f.collection) && t(f);
192
+ f != null && f.collection && o.includes(f.collection) && t(f);
192
193
  };
193
- s.on("collection:update", c);
194
+ n.on("collection:update", c);
194
195
  let i = !1;
195
196
  return () => {
196
197
  if (!i) {
197
- i = !0, s.off("collection:update", c);
198
- for (const f of r) S.remove(f);
198
+ i = !0, n.off("collection:update", c);
199
+ for (const f of o) S.remove(f);
199
200
  }
200
201
  };
201
202
  },
202
203
  on(e, t) {
203
- const s = T();
204
- return s.on(e, t), () => {
205
- s.off(e, t);
204
+ const n = q();
205
+ return n.on(e, t), () => {
206
+ n.off(e, t);
206
207
  };
207
208
  },
208
209
  emit(e, t) {
209
- if (T(), e === "ops:join" || e === "ops:leave") {
210
- const s = String((t == null ? void 0 : t.topic) ?? "");
211
- if (!s) return;
212
- e === "ops:join" ? A.add(s) : A.remove(s);
210
+ if (q(), e === "record:join") {
211
+ const n = W.join(t);
212
+ n && (r == null || r.emit(e, n));
213
213
  return;
214
214
  }
215
- o == null || o.emit(e, t);
215
+ if (e === "record:leave") {
216
+ const n = W.leave(t);
217
+ n && (r == null || r.emit(e, n));
218
+ return;
219
+ }
220
+ if (e === "ops:join" || e === "ops:leave") {
221
+ const n = String((t == null ? void 0 : t.topic) ?? "");
222
+ if (!n) return;
223
+ e === "ops:join" ? A.add(n) : A.remove(n);
224
+ return;
225
+ }
226
+ r == null || r.emit(e, t);
216
227
  },
217
228
  status() {
218
229
  return a;
219
230
  },
220
231
  onStatus(e) {
221
- return T(), w.add(e), () => {
232
+ return q(), w.add(e), () => {
222
233
  w.delete(e);
223
234
  };
224
235
  },
225
236
  joinWatch(e) {
226
- T(), b.add(e);
237
+ q(), b.add(e);
227
238
  let t = !1;
228
239
  return () => {
229
240
  t || (t = !0, b.remove(e));
@@ -235,7 +246,7 @@ function oe(l) {
235
246
  };
236
247
  }
237
248
  export {
238
- I as REACTION_JITTER_MS,
239
- P as createJitteredReaction,
240
- oe as createSocketRealtime
249
+ y as REACTION_JITTER_MS,
250
+ Y as createJitteredReaction,
251
+ ce as createSocketRealtime
241
252
  };
@@ -76,12 +76,7 @@ function C(t, n, i) {
76
76
  function m(t, n = 1200) {
77
77
  setTimeout(t, Math.floor(Math.random() * n));
78
78
  }
79
- const p = [
80
- ["notification-count"],
81
- ["notifications"],
82
- ["my-work"],
83
- ["my-work-count"]
84
- ], K = [["nvr-chat-rooms"], ["nvr-chat-record-room"]], T = {
79
+ const p = [["notification-count"], ["notifications"], ["my-work-count"]], K = [["nvr-chat-rooms"], ["nvr-chat-record-room"]], T = {
85
80
  "saved-views": [["cbv-views"], ["cbv-view-count"]],
86
81
  "saved-searches": [["global-search-saved"]],
87
82
  overview: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.137",
3
+ "version": "0.3.139",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",