@nivaro/react 0.3.127 → 0.3.129

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/components/slots/CommentsSlot.js +124 -95
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +29 -3
  5. package/dist/index.js +150 -147
  6. package/dist/shared/components/CollectionBrowserView.js +3259 -3211
  7. package/dist/shared/components/DataTable.js +406 -401
  8. package/dist/shared/components/ItemEditForm.js +4485 -4409
  9. package/dist/shared/components/MatrixEditor.js +548 -490
  10. package/dist/shared/components/MyWorkView.js +284 -274
  11. package/dist/shared/components/NotificationBell.js +264 -218
  12. package/dist/shared/components/RecordGridEditor.js +582 -472
  13. package/dist/shared/components/ai/AiMarkdown.js +215 -196
  14. package/dist/shared/components/chat/chat-core.js +331 -346
  15. package/dist/shared/components/chat/chat-typing.js +25 -0
  16. package/dist/shared/components/command-center/CommandCenterView.js +1 -1
  17. package/dist/shared/components/command-center/PeekPanel.js +8 -1
  18. package/dist/shared/components/command-center/api.js +17 -9
  19. package/dist/shared/components/command-center/panels/AttentionPanel.js +4 -1
  20. package/dist/shared/components/command-center/panels/PartnersPanel.js +2 -1
  21. package/dist/shared/components/item-edit/GroupSection.js +1 -1
  22. package/dist/shared/components/item-edit/HeaderTools.js +216 -210
  23. package/dist/shared/components/item-edit/InlineTableField.js +432 -429
  24. package/dist/shared/components/item-edit/RecordLiveSync.js +115 -108
  25. package/dist/shared/components/item-edit/RecordViewersChip.js +17 -16
  26. package/dist/shared/components/item-edit/RowComments.js +33 -30
  27. package/dist/shared/components/item-edit/cascade-clear-notice.js +30 -28
  28. package/dist/shared/components/item-edit/live-related.js +29 -16
  29. package/dist/shared/components/item-edit/record-opened-live.js +86 -0
  30. package/dist/shared/components/panels/CommentPanel.js +345 -327
  31. package/dist/shared/components/panels/OwnerOpenedLine.js +24 -23
  32. package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
  33. package/dist/shared/components/pipeline/TeamSuggestions.js +1 -1
  34. package/dist/shared/components/queue/QueueItemSheet.js +171 -130
  35. package/dist/shared/components/record-grid-guard.js +85 -0
  36. package/dist/shared/components/support/TicketDetailSheet.js +213 -174
  37. package/dist/shared/components/trackers/MirroredText.js +40 -0
  38. package/dist/shared/components/trackers/SourceTracker.js +168 -0
  39. package/dist/shared/components/trackers/TrackerChip.js +71 -0
  40. package/dist/shared/components/trackers/TrackerLinkPanel.js +1039 -0
  41. package/dist/shared/components/trackers/TrackerPickers.js +245 -0
  42. package/dist/shared/components/trackers/tracker-model.js +126 -0
  43. package/dist/shared/components/trackers/use-tracker-link.js +159 -0
  44. package/dist/shared/lib/at-risk-fields.js +14 -0
  45. package/dist/shared/lib/live-queries.js +9 -8
  46. package/dist/shared/lib/live-screen.js +77 -76
  47. package/dist/shared/lib/presence-hooks.js +190 -127
  48. package/dist/shared/lib/user-sync.js +78 -65
  49. package/dist/shared/lib/waiting-count.js +40 -29
  50. package/package.json +1 -1
@@ -1,44 +1,55 @@
1
- import { useQueryClient as a, useQuery as l } from "@tanstack/react-query";
2
- import { useRef as c, useEffect as p } from "react";
3
- import { useOptionalNivaroClient as y } from "../context.js";
4
- import { get as v } from "./commands.js";
5
- import { useLiveEvent as w } from "./live.js";
6
- import { useLiveOps as I } from "./live-ops.js";
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 o = 0;
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 && (o += Math.floor(r));
13
- return o;
12
+ typeof r == "number" && Number.isFinite(r) && r > 0 && (n += Math.floor(r));
13
+ return n;
14
14
  }
15
- const h = 3e4;
16
- function Q(e = !0) {
17
- const o = y(), r = a(), f = k(18e4, { safetyMs: 18e4, enabled: e }), { data: m } = l({
18
- queryKey: ["my-work"],
19
- queryFn: () => o.request(v("/my-work")).then((t) => t.data),
20
- enabled: e && !!o,
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: f,
23
- refetchIntervalInBackground: !0,
22
+ refetchInterval: d,
23
+ refetchIntervalInBackground: !1,
24
24
  retry: !1,
25
- select: (t) => q(t == null ? void 0 : t.counts)
26
- }), i = c(0), n = c(null), u = () => {
27
- if (n.current) return;
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
- n.current = null, i.current = Date.now(), r.invalidateQueries({ queryKey: ["my-work"] });
30
- }, s = i.current + h - Date.now();
31
- s <= 0 ? t() : n.current = setTimeout(t, s);
32
- };
33
- return I("my-work", u, { debounceMs: 1500, enabled: e }), w("notification:new", u, { debounceMs: 1500, enabled: e }), p(
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
- n.current && clearTimeout(n.current);
45
+ o.current && clearTimeout(o.current);
36
46
  },
37
47
  []
38
- ), e ? m ?? 0 : 0;
48
+ ), e ? p ?? 0 : 0;
39
49
  }
40
50
  export {
41
- h as WAITING_LIVE_GAP_MS,
42
- Q as useWaitingCount,
51
+ l as WAITING_COUNT_KEY,
52
+ E as WAITING_LIVE_GAP_MS,
53
+ G as useWaitingCount,
43
54
  q as waitingCount
44
55
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.127",
3
+ "version": "0.3.129",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",