@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
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useQueryClient as v } from "@tanstack/react-query";
|
|
2
|
+
import { useEffect as w } from "react";
|
|
3
|
+
const l = "nvr:config-update";
|
|
4
|
+
function N(n, o) {
|
|
5
|
+
return n ? o.some((e) => !!e && e === n) : !0;
|
|
6
|
+
}
|
|
7
|
+
function J(n, o, e = {}) {
|
|
8
|
+
const r = v(), i = e.enabled !== !1, s = e.jitterMs ?? 1500, c = JSON.stringify(n), f = JSON.stringify(o);
|
|
9
|
+
w(() => {
|
|
10
|
+
if (!i || typeof window > "u") return;
|
|
11
|
+
const d = JSON.parse(c), m = JSON.parse(f);
|
|
12
|
+
let t = null;
|
|
13
|
+
const a = (y) => {
|
|
14
|
+
var u;
|
|
15
|
+
const p = (u = y.detail) == null ? void 0 : u.collection;
|
|
16
|
+
!N(p, d) || t || (t = setTimeout(
|
|
17
|
+
() => {
|
|
18
|
+
t = null;
|
|
19
|
+
for (const h of m)
|
|
20
|
+
r.invalidateQueries({ queryKey: h, refetchType: "active" }, { cancelRefetch: !1 });
|
|
21
|
+
},
|
|
22
|
+
Math.floor(Math.random() * Math.max(0, s))
|
|
23
|
+
));
|
|
24
|
+
};
|
|
25
|
+
return window.addEventListener(l, a), () => {
|
|
26
|
+
window.removeEventListener(l, a), t && clearTimeout(t);
|
|
27
|
+
};
|
|
28
|
+
}, [r, i, s, c, f]);
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
l as CONFIG_UPDATE_WINDOW_EVENT,
|
|
32
|
+
N as configUpdateTouches,
|
|
33
|
+
J as useConfigUpdateRefresh
|
|
34
|
+
};
|
|
@@ -3,32 +3,32 @@ import { useLiveOps as b } from "./live-ops.js";
|
|
|
3
3
|
function y(n, t) {
|
|
4
4
|
return `cfg-${n}:${t}`;
|
|
5
5
|
}
|
|
6
|
-
const
|
|
6
|
+
const d = (n, t) => n != null && t != null && String(n).toLowerCase() === String(t).toLowerCase();
|
|
7
7
|
function S(n, t, o) {
|
|
8
8
|
var i;
|
|
9
|
-
const r = typeof t.part == "string" && t.part ? t.part : "several", e = t.by,
|
|
9
|
+
const r = typeof t.part == "string" && t.part ? t.part : "several", e = t.by, s = e && e.id != null ? { id: String(e.id), name: typeof e.name == "string" ? e.name : "Someone" } : null;
|
|
10
10
|
return n ? {
|
|
11
|
-
by:
|
|
11
|
+
by: d((i = n.by) == null ? void 0 : i.id, s == null ? void 0 : s.id) || !n.by && !s ? s : null,
|
|
12
12
|
part: n.part === r ? r : "several",
|
|
13
13
|
at: o,
|
|
14
14
|
count: n.count + 1
|
|
15
|
-
} : { by:
|
|
15
|
+
} : { by: s, part: r, at: o, count: 1 };
|
|
16
16
|
}
|
|
17
17
|
function $(n, t, o = {}) {
|
|
18
|
-
const [r, e] = p(null),
|
|
18
|
+
const [r, e] = p(null), s = m(null), c = t != null && t !== "" ? y(n, t) : null, { meId: i, onChange: u } = o;
|
|
19
19
|
b(
|
|
20
|
-
|
|
21
|
-
(
|
|
22
|
-
if (
|
|
23
|
-
const g = S(
|
|
24
|
-
|
|
20
|
+
c,
|
|
21
|
+
(a) => {
|
|
22
|
+
if (a != null && a.reconnect || a != null && a.by && d(a.by.id, i)) return;
|
|
23
|
+
const g = S(s.current, a ?? {}, Date.now());
|
|
24
|
+
s.current = g, e(g), u == null || u(g);
|
|
25
25
|
},
|
|
26
26
|
{ enabled: o.enabled !== !1, debounceMs: 250 }
|
|
27
27
|
);
|
|
28
|
-
const
|
|
29
|
-
|
|
28
|
+
const l = w(() => {
|
|
29
|
+
s.current = null, e(null);
|
|
30
30
|
}, []);
|
|
31
|
-
return { change: r, clear:
|
|
31
|
+
return { change: r, clear: l };
|
|
32
32
|
}
|
|
33
33
|
const h = {
|
|
34
34
|
state: "changed a state",
|
|
@@ -67,7 +67,7 @@ const C = /* @__PURE__ */ new Set([
|
|
|
67
67
|
"sort",
|
|
68
68
|
"updated_at"
|
|
69
69
|
]);
|
|
70
|
-
function
|
|
70
|
+
function f(n) {
|
|
71
71
|
const t = {};
|
|
72
72
|
for (const o of Object.keys(n).sort()) C.has(o) || (t[o] = n[o]);
|
|
73
73
|
try {
|
|
@@ -77,10 +77,10 @@ function d(n) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
function W(n, t) {
|
|
80
|
-
const o = new Map((n ?? []).map((e) => [String(e.id),
|
|
80
|
+
const o = new Map((n ?? []).map((e) => [String(e.id), f(e)])), r = [];
|
|
81
81
|
for (const e of t ?? []) {
|
|
82
|
-
const
|
|
83
|
-
|
|
82
|
+
const s = String(e.id), c = o.get(s);
|
|
83
|
+
c != null && c !== f(e) && r.push(s);
|
|
84
84
|
}
|
|
85
85
|
return r;
|
|
86
86
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useRef as s, useEffect as l } from "react";
|
|
2
|
+
function a() {
|
|
3
|
+
return typeof document > "u" || document.visibilityState !== "hidden";
|
|
4
|
+
}
|
|
5
|
+
function d(o, r) {
|
|
6
|
+
const u = r.now ?? (() => Date.now()), c = r.isVisible ?? a;
|
|
7
|
+
let t = Number.NEGATIVE_INFINITY, n = null, e = !1;
|
|
8
|
+
const i = () => {
|
|
9
|
+
if (n = null, !c()) {
|
|
10
|
+
e = !0;
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
e = !1, t = u(), o();
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
poke() {
|
|
17
|
+
if (n) return;
|
|
18
|
+
const f = t + r.gapMs - u();
|
|
19
|
+
f <= 0 ? i() : n = setTimeout(i, f);
|
|
20
|
+
},
|
|
21
|
+
resume() {
|
|
22
|
+
!n && e && c() && i();
|
|
23
|
+
},
|
|
24
|
+
cancel() {
|
|
25
|
+
n && clearTimeout(n), n = null, e = !1;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function p(o, r, u = !0) {
|
|
30
|
+
const c = s(o);
|
|
31
|
+
c.current = o;
|
|
32
|
+
const t = s(null);
|
|
33
|
+
return l(() => {
|
|
34
|
+
if (!u) return;
|
|
35
|
+
const e = d(() => c.current(), { gapMs: r });
|
|
36
|
+
t.current = e;
|
|
37
|
+
const i = () => e.resume();
|
|
38
|
+
return typeof document < "u" && document.addEventListener("visibilitychange", i), () => {
|
|
39
|
+
typeof document < "u" && document.removeEventListener("visibilitychange", i), e.cancel(), t.current === e && (t.current = null);
|
|
40
|
+
};
|
|
41
|
+
}, [r, u]), s(() => {
|
|
42
|
+
var e;
|
|
43
|
+
return (e = t.current) == null ? void 0 : e.poke();
|
|
44
|
+
}).current;
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
d as createGapRefresher,
|
|
48
|
+
p as useGapRefresh
|
|
49
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toneForObligation as s } from "./obligation-filters.js";
|
|
2
2
|
const r = { danger: 3, warning: 2, positive: 1, neutral: 0 };
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
for (const o of
|
|
3
|
+
function a(i) {
|
|
4
|
+
const n = /* @__PURE__ */ new Map();
|
|
5
|
+
for (const o of i) {
|
|
6
6
|
if (o.outcome === "superseded") continue;
|
|
7
|
-
const t = s(o
|
|
8
|
-
(!
|
|
7
|
+
const t = s(o), e = n.get(o.api);
|
|
8
|
+
(!e || r[t] > r[e]) && n.set(o.api, t);
|
|
9
9
|
}
|
|
10
|
-
return [...
|
|
10
|
+
return [...n.entries()].map(([o, t]) => ({ api: o, tone: t }));
|
|
11
11
|
}
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
a as dotsForRecord
|
|
14
14
|
};
|
|
@@ -1,41 +1,44 @@
|
|
|
1
1
|
import { useRef as m, useEffect as l, useState as h } from "react";
|
|
2
2
|
import { useLiveEvent as S } from "./live.js";
|
|
3
3
|
import { useOptionalRealtime as b } from "./realtime.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
r
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { useResync as w } from "./reconnect-resync.js";
|
|
5
|
+
function j(t, u, n = {}) {
|
|
6
|
+
const c = b(), r = n.enabled !== !1 && !!t, s = m(n.match);
|
|
7
|
+
s.current = n.match;
|
|
8
|
+
const o = m(u);
|
|
9
|
+
o.current = u, l(() => {
|
|
10
|
+
if (!(!c || !r || !t))
|
|
11
|
+
return c.emit("ops:join", { topic: t }), () => c.emit("ops:leave", { topic: t });
|
|
12
|
+
}, [c, r, t]), S(
|
|
10
13
|
"ops:changed",
|
|
11
14
|
(e) => {
|
|
12
|
-
|
|
15
|
+
u(e ?? {});
|
|
13
16
|
},
|
|
14
17
|
{
|
|
15
|
-
enabled:
|
|
18
|
+
enabled: r,
|
|
16
19
|
debounceMs: n.debounceMs ?? 300,
|
|
17
20
|
includeOwn: !0,
|
|
18
|
-
match: (e) => (e == null ? void 0 : e.topic) === t && (!
|
|
21
|
+
match: (e) => (e == null ? void 0 : e.topic) === t && (!s.current || s.current(e ?? {}))
|
|
19
22
|
}
|
|
20
|
-
);
|
|
23
|
+
), w(() => o.current({ topic: t, reconnect: !0 }), { enabled: r });
|
|
21
24
|
}
|
|
22
|
-
function
|
|
23
|
-
const n = m(null), [
|
|
25
|
+
function y(t, u = 4e3) {
|
|
26
|
+
const n = m(null), [c, r] = h(() => /* @__PURE__ */ new Set()), s = (t ?? []).map(String).join("\0");
|
|
24
27
|
return l(() => {
|
|
25
|
-
const
|
|
26
|
-
if (n.current =
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
() =>
|
|
30
|
-
const a = new Set(
|
|
31
|
-
for (const d of
|
|
28
|
+
const o = new Set(s ? s.split("\0") : []), e = n.current;
|
|
29
|
+
if (n.current = o, !e || e.size === 0) return;
|
|
30
|
+
const i = [...o].filter((f) => !e.has(f));
|
|
31
|
+
i.length !== 0 && (r((f) => /* @__PURE__ */ new Set([...f, ...i])), setTimeout(
|
|
32
|
+
() => r((f) => {
|
|
33
|
+
const a = new Set(f);
|
|
34
|
+
for (const d of i) a.delete(d);
|
|
32
35
|
return a;
|
|
33
36
|
}),
|
|
34
|
-
|
|
37
|
+
u
|
|
35
38
|
));
|
|
36
|
-
}, [
|
|
39
|
+
}, [s, u]), c;
|
|
37
40
|
}
|
|
38
41
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
y as useFreshIds,
|
|
43
|
+
j as useLiveOps
|
|
41
44
|
};
|