@nivaro/react 0.3.127 → 0.3.128
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 +20 -2
- package/dist/index.js +150 -147
- package/dist/shared/components/CollectionBrowserView.js +3259 -3211
- package/dist/shared/components/DataTable.js +406 -401
- package/dist/shared/components/ItemEditForm.js +4203 -4156
- package/dist/shared/components/MatrixEditor.js +548 -490
- package/dist/shared/components/MyWorkView.js +284 -274
- package/dist/shared/components/NotificationBell.js +264 -218
- package/dist/shared/components/RecordGridEditor.js +582 -472
- package/dist/shared/components/chat/chat-core.js +331 -346
- package/dist/shared/components/chat/chat-typing.js +25 -0
- package/dist/shared/components/command-center/CommandCenterView.js +1 -1
- package/dist/shared/components/command-center/PeekPanel.js +8 -1
- package/dist/shared/components/command-center/api.js +17 -9
- package/dist/shared/components/command-center/panels/AttentionPanel.js +4 -1
- package/dist/shared/components/command-center/panels/PartnersPanel.js +2 -1
- package/dist/shared/components/item-edit/GroupSection.js +1 -1
- package/dist/shared/components/item-edit/InlineTableField.js +432 -429
- package/dist/shared/components/item-edit/RecordLiveSync.js +115 -108
- package/dist/shared/components/item-edit/RecordViewersChip.js +17 -16
- package/dist/shared/components/item-edit/RowComments.js +33 -30
- package/dist/shared/components/item-edit/cascade-clear-notice.js +30 -28
- package/dist/shared/components/item-edit/live-related.js +29 -16
- package/dist/shared/components/item-edit/record-opened-live.js +86 -0
- package/dist/shared/components/panels/OwnerOpenedLine.js +24 -23
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/pipeline/TeamSuggestions.js +1 -1
- package/dist/shared/components/queue/QueueItemSheet.js +171 -130
- package/dist/shared/components/record-grid-guard.js +85 -0
- package/dist/shared/components/support/TicketDetailSheet.js +168 -151
- package/dist/shared/lib/at-risk-fields.js +14 -0
- package/dist/shared/lib/live-queries.js +9 -8
- package/dist/shared/lib/live-screen.js +77 -76
- package/dist/shared/lib/presence-hooks.js +190 -127
- package/dist/shared/lib/user-sync.js +78 -65
- package/dist/shared/lib/waiting-count.js +40 -29
- package/package.json +1 -1
|
@@ -1,44 +1,55 @@
|
|
|
1
|
-
import { useQueryClient as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useOptionalNivaroClient as
|
|
4
|
-
import { get as
|
|
5
|
-
import { useLiveEvent as
|
|
6
|
-
import { useLiveOps as
|
|
1
|
+
import { useQueryClient as v, useQuery as y } from "@tanstack/react-query";
|
|
2
|
+
import { useRef as u, useEffect as a } from "react";
|
|
3
|
+
import { useOptionalNivaroClient as h } from "../context.js";
|
|
4
|
+
import { get as w } from "./commands.js";
|
|
5
|
+
import { useLiveEvent as I } from "./live.js";
|
|
6
|
+
import { useLiveOps as g } from "./live-ops.js";
|
|
7
7
|
import { useLiveRefetchInterval as k } from "./live-queries.js";
|
|
8
8
|
function q(e) {
|
|
9
9
|
if (!e) return 0;
|
|
10
|
-
let
|
|
10
|
+
let n = 0;
|
|
11
11
|
for (const r of [e.owned, e.approvals, e.questions])
|
|
12
|
-
typeof r == "number" && Number.isFinite(r) && r > 0 && (
|
|
13
|
-
return
|
|
12
|
+
typeof r == "number" && Number.isFinite(r) && r > 0 && (n += Math.floor(r));
|
|
13
|
+
return n;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
queryKey:
|
|
19
|
-
queryFn: () =>
|
|
20
|
-
enabled: e && !!
|
|
15
|
+
const E = 3e4, l = ["my-work-count"];
|
|
16
|
+
function G(e = !0) {
|
|
17
|
+
const n = h(), r = v(), d = k(18e4, { safetyMs: 18e4, enabled: e }), { data: p } = y({
|
|
18
|
+
queryKey: l,
|
|
19
|
+
queryFn: () => n.request(w("/my-work/counts")).then((t) => t.data),
|
|
20
|
+
enabled: e && !!n,
|
|
21
21
|
staleTime: 6e4,
|
|
22
|
-
refetchInterval:
|
|
23
|
-
refetchIntervalInBackground: !
|
|
22
|
+
refetchInterval: d,
|
|
23
|
+
refetchIntervalInBackground: !1,
|
|
24
24
|
retry: !1,
|
|
25
|
-
select: (t) => q(t
|
|
26
|
-
}),
|
|
27
|
-
if (
|
|
25
|
+
select: (t) => q(t)
|
|
26
|
+
}), c = u(0), o = u(null), s = u(!1), i = () => {
|
|
27
|
+
if (typeof document < "u" && document.hidden) {
|
|
28
|
+
s.current = !0;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (o.current) return;
|
|
28
32
|
const t = () => {
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
return
|
|
33
|
+
o.current = null, c.current = Date.now(), r.invalidateQueries({ queryKey: l });
|
|
34
|
+
}, m = c.current + E - Date.now();
|
|
35
|
+
m <= 0 ? t() : o.current = setTimeout(t, m);
|
|
36
|
+
}, f = u(i);
|
|
37
|
+
return f.current = i, g("my-work", i, { debounceMs: 1500, enabled: e }), I("notification:new", i, { debounceMs: 1500, enabled: e }), a(() => {
|
|
38
|
+
if (!e || typeof document > "u") return;
|
|
39
|
+
const t = () => {
|
|
40
|
+
document.hidden || !s.current || (s.current = !1, f.current());
|
|
41
|
+
};
|
|
42
|
+
return document.addEventListener("visibilitychange", t), () => document.removeEventListener("visibilitychange", t);
|
|
43
|
+
}, [e]), a(
|
|
34
44
|
() => () => {
|
|
35
|
-
|
|
45
|
+
o.current && clearTimeout(o.current);
|
|
36
46
|
},
|
|
37
47
|
[]
|
|
38
|
-
), e ?
|
|
48
|
+
), e ? p ?? 0 : 0;
|
|
39
49
|
}
|
|
40
50
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
l as WAITING_COUNT_KEY,
|
|
52
|
+
E as WAITING_LIVE_GAP_MS,
|
|
53
|
+
G as useWaitingCount,
|
|
43
54
|
q as waitingCount
|
|
44
55
|
};
|