@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.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +95 -4
- package/dist/index.js +748 -743
- package/dist/shared/components/CollectionBrowserView.js +392 -389
- package/dist/shared/components/DelegateCoverLine.js +80 -87
- package/dist/shared/components/ItemEditForm.js +589 -588
- package/dist/shared/components/MyWorkView.js +284 -286
- package/dist/shared/components/NotificationBell.js +251 -205
- package/dist/shared/components/ai/AiAnalyticsView.js +878 -417
- package/dist/shared/components/ai/AiPlanCard.js +164 -122
- package/dist/shared/components/ai/AiPlanUndo.js +291 -0
- package/dist/shared/components/ai/call-log/CallDrawer.js +357 -0
- package/dist/shared/components/ai/call-log/RawJson.js +126 -0
- package/dist/shared/components/ai/call-log/ThreadView.js +223 -0
- package/dist/shared/components/ai/call-log/TranscriptView.js +227 -0
- package/dist/shared/components/ai/call-log/controls.js +364 -0
- package/dist/shared/components/ai/call-log/format.js +46 -0
- package/dist/shared/components/ai/call-log/url.js +105 -0
- package/dist/shared/components/chat/chat-core.js +422 -346
- package/dist/shared/components/integrations/IntegrationObligationsView.js +98 -98
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +102 -93
- package/dist/shared/components/integrations/console/api.js +11 -1
- package/dist/shared/components/item-edit/HeaderRollupExplainer.js +5 -1
- package/dist/shared/components/item-edit/RecordLiveSync.js +241 -229
- package/dist/shared/components/item-edit/RecordRecapChanges.js +166 -0
- package/dist/shared/components/item-edit/RecordRecapStrip.js +254 -84
- package/dist/shared/components/item-edit/live-related.js +34 -18
- package/dist/shared/components/panels/RevisionsPanel.js +735 -683
- package/dist/shared/components/queue/QueueWorklist.js +323 -316
- package/dist/shared/components/support/SupportRequestDialog.js +198 -181
- package/dist/shared/components/trackers/use-tracker-link.js +74 -65
- package/dist/shared/lib/activity-sentence.js +167 -151
- package/dist/shared/lib/config-update-refresh.js +34 -0
- package/dist/shared/lib/config-watch.js +17 -17
- package/dist/shared/lib/gap-refresh.js +49 -0
- package/dist/shared/lib/integration-dots.js +8 -8
- package/dist/shared/lib/live-ops.js +26 -23
- package/dist/shared/lib/live-pickers.js +1 -1
- package/dist/shared/lib/live-queries.js +223 -195
- package/dist/shared/lib/live.js +56 -51
- package/dist/shared/lib/obligation-banner.js +11 -10
- package/dist/shared/lib/obligation-filters.js +22 -18
- package/dist/shared/lib/obligation-reason-text.js +18 -8
- package/dist/shared/lib/presence-hooks.js +133 -132
- package/dist/shared/lib/reconnect-resync.js +90 -0
- package/dist/shared/lib/record-room-holds.js +43 -0
- package/dist/shared/lib/socket-realtime.js +116 -105
- package/dist/shared/lib/user-sync.js +1 -6
- package/package.json +1 -1
|
@@ -1,103 +1,104 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { bindClientChaosSocket as
|
|
5
|
-
import { deliveryAckFor as
|
|
6
|
-
import { createRecordGapTracker as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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 =
|
|
20
|
-
if (
|
|
20
|
+
const u = r.has(s);
|
|
21
|
+
if (r.set(s, m), u) return;
|
|
21
22
|
const a = setTimeout(
|
|
22
23
|
() => {
|
|
23
|
-
const d =
|
|
24
|
-
|
|
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
|
|
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(
|
|
39
|
-
|
|
40
|
-
this.join =
|
|
39
|
+
constructor(r, s) {
|
|
40
|
+
I(this, "refs", /* @__PURE__ */ new Map());
|
|
41
|
+
this.join = r, this.leave = s;
|
|
41
42
|
}
|
|
42
|
-
add(
|
|
43
|
-
const
|
|
44
|
-
this.refs.set(
|
|
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(
|
|
47
|
-
const
|
|
48
|
-
|
|
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
|
|
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
|
|
58
|
-
let
|
|
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 =
|
|
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
|
|
67
|
+
for (const n of w) n(a);
|
|
67
68
|
}
|
|
68
69
|
}, _ = () => {
|
|
69
|
-
var e, t,
|
|
70
|
-
return ((
|
|
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
|
|
73
|
+
let j = !1;
|
|
73
74
|
const N = () => {
|
|
74
|
-
|
|
75
|
+
j && (j = !1, g({ repair: null }));
|
|
75
76
|
}, C = (e, t) => {
|
|
76
|
-
u && clearTimeout(u), u = null,
|
|
77
|
-
},
|
|
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
|
-
|
|
81
|
+
r != null && r.connected && r.emit(e, t);
|
|
81
82
|
}, F = (e, t) => {
|
|
82
|
-
var
|
|
83
|
-
for (const
|
|
84
|
-
}, h =
|
|
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
|
|
88
|
-
F(
|
|
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)),
|
|
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
|
|
94
|
-
|
|
95
|
-
}, R =
|
|
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:
|
|
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
|
-
),
|
|
117
|
-
var
|
|
118
|
-
if (
|
|
117
|
+
), q = () => {
|
|
118
|
+
var n;
|
|
119
|
+
if (r) return r;
|
|
119
120
|
const e = typeof l.socket == "function" ? l.socket() : l.socket;
|
|
120
|
-
|
|
121
|
-
const t =
|
|
122
|
-
return t && (t.repairing() && (a = { ...a, repair: "silent" }), t.onRepairing((
|
|
123
|
-
|
|
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 &&
|
|
126
|
-
const
|
|
127
|
-
|
|
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
|
-
|
|
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", (
|
|
137
|
-
|
|
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
|
|
141
|
-
|
|
142
|
-
}), e.on("connect_error", () =>
|
|
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 >
|
|
145
|
-
const f =
|
|
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", (
|
|
148
|
-
const c = Array.isArray(
|
|
149
|
-
R.reset(c), h.forget(
|
|
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
|
-
(
|
|
153
|
+
(o) => {
|
|
153
154
|
var c;
|
|
154
|
-
for (const i of (
|
|
155
|
-
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
|
|
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", (
|
|
167
|
-
h.forget(), d("catchupFull") && L("full", () =>
|
|
168
|
-
(
|
|
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", (
|
|
172
|
+
}), e.on("access:changed", (o) => {
|
|
172
173
|
var c;
|
|
173
|
-
if (
|
|
174
|
-
for (const i of
|
|
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(),
|
|
178
|
+
E.clear(), v(T.accessChanged, { rooms_left: i });
|
|
178
179
|
});
|
|
179
180
|
}
|
|
180
|
-
}), e.on("config:update", (
|
|
181
|
-
|
|
182
|
-
}), e.on("client:force-refresh", (
|
|
183
|
-
d("forceRefresh") &&
|
|
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
|
|
189
|
-
for (const f of
|
|
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 &&
|
|
192
|
+
f != null && f.collection && o.includes(f.collection) && t(f);
|
|
192
193
|
};
|
|
193
|
-
|
|
194
|
+
n.on("collection:update", c);
|
|
194
195
|
let i = !1;
|
|
195
196
|
return () => {
|
|
196
197
|
if (!i) {
|
|
197
|
-
i = !0,
|
|
198
|
-
for (const f of
|
|
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
|
|
204
|
-
return
|
|
205
|
-
|
|
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 (
|
|
210
|
-
const
|
|
211
|
-
|
|
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
|
-
|
|
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
|
|
232
|
+
return q(), w.add(e), () => {
|
|
222
233
|
w.delete(e);
|
|
223
234
|
};
|
|
224
235
|
},
|
|
225
236
|
joinWatch(e) {
|
|
226
|
-
|
|
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
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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: [
|