@nivaro/react 0.3.12 → 0.3.14

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/pipeline/OwnersSection.js +79 -75
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +50 -2
  5. package/dist/index.js +601 -596
  6. package/dist/shared/components/CollectionBrowserView.js +2373 -2298
  7. package/dist/shared/components/DataTable.js +347 -335
  8. package/dist/shared/components/ItemEditForm.js +5278 -5149
  9. package/dist/shared/components/ListLoadError.js +33 -0
  10. package/dist/shared/components/PageRenderer.js +562 -529
  11. package/dist/shared/components/ProfileView.js +53 -51
  12. package/dist/shared/components/RecordReadView.js +119 -117
  13. package/dist/shared/components/ReportView.js +1268 -1241
  14. package/dist/shared/components/cbv/export-rows.js +69 -0
  15. package/dist/shared/components/cbv/saved-view-risk.js +35 -0
  16. package/dist/shared/components/cbv/unknown-fields.js +18 -0
  17. package/dist/shared/components/integrations/console/AlertsView.js +27 -25
  18. package/dist/shared/components/integrations/console/EventsView.js +244 -209
  19. package/dist/shared/components/item-edit/CatalogPickerField.js +946 -878
  20. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +84 -57
  21. package/dist/shared/components/item-edit/FieldAffordances.js +63 -61
  22. package/dist/shared/components/item-edit/FieldRow.js +195 -179
  23. package/dist/shared/components/item-edit/FilePickerField.js +257 -254
  24. package/dist/shared/components/item-edit/HeaderTools.js +139 -95
  25. package/dist/shared/components/item-edit/InlineTableField.js +2087 -2075
  26. package/dist/shared/components/item-edit/RecordLiveSync.js +196 -181
  27. package/dist/shared/components/item-edit/RowComments.js +1 -3
  28. package/dist/shared/components/item-edit/SummaryPanel.js +62 -62
  29. package/dist/shared/components/item-edit/UserChip.js +113 -113
  30. package/dist/shared/components/item-edit/file-download.js +18 -0
  31. package/dist/shared/components/item-edit/line-qty.js +67 -32
  32. package/dist/shared/components/item-edit/save-refusal.js +23 -0
  33. package/dist/shared/components/monitoring/TrafficMiniMap.js +9 -9
  34. package/dist/shared/components/panels/CommentPanel.js +30 -30
  35. package/dist/shared/components/panels/ItemLockBanner.js +207 -185
  36. package/dist/shared/components/panels/PipelinePanel.js +915 -786
  37. package/dist/shared/components/pipeline/PipelineEditorView.js +45 -25
  38. package/dist/shared/components/profile/DelegationCard.js +1 -1
  39. package/dist/shared/components/profile/session-actions.js +24 -24
  40. package/dist/shared/components/queue/QueueItemSheet.js +18 -18
  41. package/dist/shared/components/queue/QueueWorklist.js +517 -504
  42. package/dist/shared/components/ui/dropdown-menu.js +8 -7
  43. package/dist/shared/context.js +71 -66
  44. package/dist/shared/lib/draft-store.js +60 -33
  45. package/dist/shared/lib/leave-guard.js +38 -0
  46. package/dist/shared/lib/load-error.js +38 -17
  47. package/dist/shared/lib/summary-mode.js +25 -25
  48. package/dist/shared/lib/table-pins.js +23 -0
  49. package/dist/shared/lib/validation-rules.js +55 -51
  50. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
- import { jsxs as a, jsx as r, Fragment as re } from "react/jsx-runtime";
2
- import { RefreshCw as ie, Search as Pe, X as Se, ArrowUpRight as Ee, ArrowDownLeft as De, ExternalLink as Oe } from "lucide-react";
3
- import { useState as g, useId as Te, useEffect as F, useMemo as k } from "react";
1
+ import { jsxs as s, jsx as r, Fragment as re } from "react/jsx-runtime";
2
+ import { RefreshCw as ie, Search as Se, X as Pe, ArrowUpRight as Ee, ArrowDownLeft as _e, ExternalLink as De } from "lucide-react";
3
+ import { useState as g, useId as Oe, useEffect as L, useMemo as S } from "react";
4
4
  import { toast as ne } from "sonner";
5
- import { useDebounced as Ie } from "../../../hooks/useDebounced.js";
6
- import { cn as y } from "../../../lib/utils.js";
7
- import { Checkbox as _e } from "../../ui/checkbox.js";
8
- import { SimpleSelect as L } from "../../ui/SimpleSelect.js";
5
+ import { useDebounced as Te } from "../../../hooks/useDebounced.js";
6
+ import { cn as w } from "../../../lib/utils.js";
7
+ import { Checkbox as Ie } from "../../ui/checkbox.js";
8
+ import { SimpleSelect as K } from "../../ui/SimpleSelect.js";
9
9
  import { useIntegrationEvents as Re, useReplayEvent as Ae } from "./api.js";
10
10
  import { agoText as le, exactTime as ce, TONE_TEXT as de, TONE_SOFT as ue, TONE_BORDER as $e, TONE_FILL as Fe } from "./tone.js";
11
11
  import { EventPathSheet as Le } from "./event-path/EventPathSheet.js";
@@ -19,154 +19,175 @@ const Ke = {
19
19
  ["in", "Inbound"],
20
20
  ["poll", "Polls & feeds"]
21
21
  ], Ue = {
22
- in: De,
22
+ in: _e,
23
23
  out: Ee,
24
24
  poll: ie
25
25
  }, ae = {
26
26
  in: "Inbound — a partner called us",
27
27
  out: "Outbound — we pushed to a partner",
28
28
  poll: "Poll or feed — we asked the partner"
29
- }, M = (t) => t.provider ?? t.source ?? "", O = (t) => `${M(t)}:${t.id}`, Ye = [
29
+ }, O = (t) => t.provider ?? t.source ?? "", T = (t) => `${O(t)}:${t.id}`;
30
+ function Ye(t) {
31
+ const o = (a) => [
32
+ O(a),
33
+ a.collection ?? "",
34
+ a.item_id ?? "",
35
+ a.label,
36
+ a.text,
37
+ a.context ?? "",
38
+ a.status ?? "",
39
+ a.partner ?? "",
40
+ a.caller ?? "",
41
+ String(a.created_at).slice(0, 19)
42
+ ].join("\0"), i = [];
43
+ for (const a of t) {
44
+ const d = o(a), c = i[i.length - 1];
45
+ c && c.sig === d && !a.replayable && !c.event.replayable ? c.repeats++ : i.push({ event: a, repeats: 1, sig: d });
46
+ }
47
+ return i.map(({ event: a, repeats: d }) => ({ event: a, repeats: d }));
48
+ }
49
+ const je = [
30
50
  ["", "All"],
31
51
  ["error", "Problems"],
32
52
  ["ok", "OK"],
33
53
  ["info", "Info"]
34
54
  ];
35
- function je(t, n = /* @__PURE__ */ new Date()) {
36
- const c = new Date(t), i = (m) => new Date(m.getFullYear(), m.getMonth(), m.getDate()).getTime(), d = Math.round((i(n) - i(c)) / 864e5);
37
- return d === 0 ? "Today" : d === 1 ? "Yesterday" : c.toLocaleDateString(void 0, {
55
+ function Be(t, o = /* @__PURE__ */ new Date()) {
56
+ const i = new Date(t), a = (c) => new Date(c.getFullYear(), c.getMonth(), c.getDate()).getTime(), d = Math.round((a(o) - a(i)) / 864e5);
57
+ return d === 0 ? "Today" : d === 1 ? "Yesterday" : i.toLocaleDateString(void 0, {
38
58
  weekday: "long",
39
59
  month: "short",
40
60
  day: "numeric",
41
- ...c.getFullYear() !== n.getFullYear() ? { year: "numeric" } : {}
61
+ ...i.getFullYear() !== o.getFullYear() ? { year: "numeric" } : {}
42
62
  });
43
63
  }
44
- const Be = (t) => {
45
- const n = new Date(t);
46
- return `${n.getFullYear()}-${n.getMonth()}-${n.getDate()}`;
64
+ const We = (t) => {
65
+ const o = new Date(t);
66
+ return `${o.getFullYear()}-${o.getMonth()}-${o.getDate()}`;
47
67
  };
48
68
  function se({
49
69
  value: t,
50
- options: n,
51
- onChange: c,
52
- label: i,
70
+ options: o,
71
+ onChange: i,
72
+ label: a,
53
73
  disabled: d,
54
- ...m
74
+ ...c
55
75
  }) {
56
76
  return /* @__PURE__ */ r(
57
77
  "fieldset",
58
78
  {
59
- "aria-label": i,
79
+ "aria-label": a,
60
80
  disabled: d,
61
- ...m,
81
+ ...c,
62
82
  className: "m-0 inline-flex h-8 min-w-0 overflow-hidden rounded-md border border-border bg-card p-0",
63
- children: n.map(([f, l]) => {
64
- const h = t === f;
83
+ children: o.map(([m, u]) => {
84
+ const h = t === m;
65
85
  return /* @__PURE__ */ r(
66
86
  "button",
67
87
  {
68
88
  type: "button",
69
89
  "aria-pressed": h,
70
- "data-value": f || "all",
71
- onClick: () => c(f),
72
- className: y(
90
+ "data-value": m || "all",
91
+ onClick: () => i(m),
92
+ className: w(
73
93
  "px-2.5 text-[12px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
74
94
  h ? "bg-[#1e293b] text-[#f2f2f2] dark:bg-nvr-cyan/20 dark:text-foreground dark:ring-1 dark:ring-inset dark:ring-nvr-cyan/40" : "text-muted-foreground hover:bg-muted hover:text-foreground"
75
95
  ),
76
- children: l
96
+ children: u
77
97
  },
78
- f || "_all"
98
+ m || "_all"
79
99
  );
80
100
  })
81
101
  }
82
102
  );
83
103
  }
84
- function We({ event: t }) {
85
- const n = Ae(), [c, i] = g(!1), d = O(t), m = n.isPending;
104
+ function Xe({ event: t }) {
105
+ const o = Ae(), [i, a] = g(!1), d = T(t), c = o.isPending;
86
106
  return /* @__PURE__ */ r(
87
107
  "button",
88
108
  {
89
109
  type: "button",
90
110
  "data-ic-event-replay": d,
91
- "data-armed": c || void 0,
92
- disabled: m,
93
- onBlur: () => !m && i(!1),
94
- onKeyDown: (f) => f.key === "Escape" && i(!1),
95
- onClick: (f) => {
96
- if (f.stopPropagation(), !c) {
97
- i(!0);
111
+ "data-armed": i || void 0,
112
+ disabled: c,
113
+ onBlur: () => !c && a(!1),
114
+ onKeyDown: (m) => m.key === "Escape" && a(!1),
115
+ onClick: (m) => {
116
+ if (m.stopPropagation(), !i) {
117
+ a(!0);
98
118
  return;
99
119
  }
100
- n.mutate(t, {
101
- onSuccess: (l) => {
102
- i(!1), ne.success("Event replayed", l.detail ? { description: l.detail } : void 0);
120
+ o.mutate(t, {
121
+ onSuccess: (u) => {
122
+ a(!1), ne.success("Event replayed", u.detail ? { description: u.detail } : void 0);
103
123
  },
104
- onError: (l) => {
105
- var u;
106
- i(!1);
107
- const h = ((u = l == null ? void 0 : l.response) == null ? void 0 : u.error) ?? (l instanceof Error ? l.message : null);
124
+ onError: (u) => {
125
+ var f;
126
+ a(!1);
127
+ const h = ((f = u == null ? void 0 : u.response) == null ? void 0 : f.error) ?? (u instanceof Error ? u.message : null);
108
128
  ne.error(h ?? "Replay failed", { duration: 8e3 });
109
129
  }
110
130
  });
111
131
  },
112
- className: y(
132
+ className: w(
113
133
  "h-7 shrink-0 whitespace-nowrap rounded-md px-2.5 text-[12px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-70",
114
- c ? (
134
+ i ? (
115
135
  // Tinted brand fill + foreground ink: raw brand cyan under white
116
136
  // text is ~1.9:1, and brand-coloured text on white is no better.
117
137
  "bg-nvr-cyan/15 text-foreground ring-1 ring-inset ring-nvr-cyan/50 hover:bg-nvr-cyan/25 dark:bg-nvr-cyan/20"
118
138
  ) : "text-muted-foreground hover:bg-muted hover:text-foreground"
119
139
  ),
120
- children: m ? "Replaying…" : c ? "Replay this event?" : "Replay"
140
+ children: c ? "Replaying…" : i ? "Replay this event?" : "Replay"
121
141
  }
122
142
  );
123
143
  }
124
- function Xe({
144
+ function qe({
125
145
  event: t,
126
- onOpenRecord: n
146
+ onOpenRecord: o
127
147
  }) {
128
148
  if (!t.item_id || !t.collection) return null;
129
- const c = t.collection, i = t.item_label || `${c.replace(/_/g, " ")} ${t.item_id}`;
130
- return n ? /* @__PURE__ */ a(
149
+ const i = t.collection, a = t.item_label || `${i.replace(/_/g, " ")} ${t.item_id}`;
150
+ return o ? /* @__PURE__ */ s(
131
151
  "button",
132
152
  {
133
153
  type: "button",
134
- "data-ic-record": `${c}:${t.item_id}`,
154
+ "data-ic-record": `${i}:${t.item_id}`,
135
155
  onClick: (d) => {
136
- d.stopPropagation(), n(c, String(t.item_id));
156
+ d.stopPropagation(), o(i, String(t.item_id));
137
157
  },
138
158
  className: "inline-flex max-w-full items-center gap-1 truncate font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
139
159
  children: [
140
- i,
141
- /* @__PURE__ */ r(Oe, { className: "h-3 w-3 shrink-0 opacity-60", "aria-hidden": !0 })
160
+ a,
161
+ /* @__PURE__ */ r(De, { className: "h-3 w-3 shrink-0 opacity-60", "aria-hidden": !0 })
142
162
  ]
143
163
  }
144
- ) : /* @__PURE__ */ r("span", { className: "font-medium text-foreground", children: i });
164
+ ) : /* @__PURE__ */ r("span", { className: "font-medium text-foreground", children: a });
145
165
  }
146
- function qe({
166
+ function He({
147
167
  event: t,
148
- direction: n,
149
- onOpenRecord: c,
150
- onSelect: i
168
+ repeats: o = 1,
169
+ direction: i,
170
+ onOpenRecord: a,
171
+ onSelect: d
151
172
  }) {
152
- const d = t.status ?? "info", m = Ke[d] ?? "neutral", f = O(t), l = n ? Ue[n] : null, h = (u) => {
153
- u.target === u.currentTarget && (u.key === "Enter" || u.key === " ") && (u.preventDefault(), i(t));
173
+ const c = t.status ?? "info", m = Ke[c] ?? "neutral", u = T(t), h = i ? Ue[i] : null, f = (b) => {
174
+ b.target === b.currentTarget && (b.key === "Enter" || b.key === " ") && (b.preventDefault(), d(t));
154
175
  };
155
- return /* @__PURE__ */ a(
176
+ return /* @__PURE__ */ s(
156
177
  "li",
157
178
  {
158
- "data-ic-event": f,
179
+ "data-ic-event": u,
159
180
  "data-ic-event-status": t.status ?? "",
160
181
  className: "flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-muted/40",
161
182
  children: [
162
- /* @__PURE__ */ a(
183
+ /* @__PURE__ */ s(
163
184
  "div",
164
185
  {
165
186
  role: "button",
166
187
  tabIndex: 0,
167
- "data-ic-event-open": f,
168
- onClick: () => i(t),
169
- onKeyDown: h,
188
+ "data-ic-event-open": u,
189
+ onClick: () => d(t),
190
+ onKeyDown: f,
170
191
  className: "flex min-w-0 flex-1 cursor-pointer items-start gap-3 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
171
192
  children: [
172
193
  /* @__PURE__ */ r(
@@ -177,39 +198,51 @@ function qe({
177
198
  children: le(t.created_at)
178
199
  }
179
200
  ),
180
- /* @__PURE__ */ a("span", { className: "flex w-[136px] shrink-0 items-center gap-2 pt-px", children: [
181
- l && n ? /* @__PURE__ */ r(
182
- l,
201
+ /* @__PURE__ */ s("span", { className: "flex w-[136px] shrink-0 items-center gap-2 pt-px", children: [
202
+ h && i ? /* @__PURE__ */ r(
203
+ h,
183
204
  {
184
205
  className: "h-3.5 w-3.5 shrink-0 text-muted-foreground",
185
206
  role: "img",
186
- "aria-label": ae[n],
187
- "data-ic-event-direction": n,
188
- "data-tip": ae[n]
207
+ "aria-label": ae[i],
208
+ "data-ic-event-direction": i,
209
+ "data-tip": ae[i]
189
210
  }
190
211
  ) : /* @__PURE__ */ r("span", { className: "w-3.5 shrink-0", "aria-hidden": !0 }),
191
212
  /* @__PURE__ */ r(
192
213
  "span",
193
214
  {
194
- className: y("h-2 w-2 shrink-0 rounded-full", Fe[m]),
215
+ className: w("h-2 w-2 shrink-0 rounded-full", Fe[m]),
195
216
  role: "img",
196
- "aria-label": oe[d] ?? "Info",
197
- "data-tip": oe[d] ?? "Info"
217
+ "aria-label": oe[c] ?? "Info",
218
+ "data-tip": oe[c] ?? "Info"
198
219
  }
199
220
  ),
200
221
  /* @__PURE__ */ r("span", { className: "truncate text-[12.5px] text-muted-foreground", "data-tip": t.label, children: t.label })
201
222
  ] }),
202
- /* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: [
203
- /* @__PURE__ */ a("p", { className: "flex flex-wrap items-baseline gap-x-2 text-[13px] leading-5", children: [
204
- /* @__PURE__ */ r(Xe, { event: t, onOpenRecord: c }),
205
- t.record_count != null && t.record_count > 1 && /* @__PURE__ */ a("span", { className: "text-[12px] tabular-nums text-muted-foreground", children: [
223
+ /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
224
+ /* @__PURE__ */ s("p", { className: "flex flex-wrap items-baseline gap-x-2 text-[13px] leading-5", children: [
225
+ /* @__PURE__ */ r(qe, { event: t, onOpenRecord: a }),
226
+ t.record_count != null && t.record_count > 1 && /* @__PURE__ */ s("span", { className: "text-[12px] tabular-nums text-muted-foreground", children: [
206
227
  t.record_count,
207
228
  " records"
208
229
  ] }),
209
- d === "error" && /* @__PURE__ */ r(
230
+ o > 1 && /* @__PURE__ */ s(
210
231
  "span",
211
232
  {
212
- className: y(
233
+ className: "text-[12px] tabular-nums text-muted-foreground",
234
+ "data-ic-event-repeats": o,
235
+ "data-tip": `${o} identical events in the same second`,
236
+ children: [
237
+ "×",
238
+ o
239
+ ]
240
+ }
241
+ ),
242
+ c === "error" && /* @__PURE__ */ r(
243
+ "span",
244
+ {
245
+ className: w(
213
246
  "rounded-full px-1.5 py-px text-[11px] font-medium",
214
247
  ue.negative,
215
248
  de.negative
@@ -218,9 +251,9 @@ function qe({
218
251
  }
219
252
  )
220
253
  ] }),
221
- /* @__PURE__ */ a("p", { className: "text-[12.5px] leading-5 text-foreground [overflow-wrap:anywhere]", children: [
254
+ /* @__PURE__ */ s("p", { className: "text-[12.5px] leading-5 text-foreground [overflow-wrap:anywhere]", children: [
222
255
  t.text,
223
- t.context && /* @__PURE__ */ a("span", { className: "text-muted-foreground", children: [
256
+ t.context && /* @__PURE__ */ s("span", { className: "text-muted-foreground", children: [
224
257
  " · ",
225
258
  t.context
226
259
  ] })
@@ -229,114 +262,114 @@ function qe({
229
262
  ]
230
263
  }
231
264
  ),
232
- t.replayable && /* @__PURE__ */ r(We, { event: t })
265
+ t.replayable && /* @__PURE__ */ r(Xe, { event: t })
233
266
  ]
234
267
  }
235
268
  );
236
269
  }
237
- function K({ title: t, children: n }) {
238
- return /* @__PURE__ */ a("div", { className: "rounded-lg border border-border bg-card px-5 py-6", children: [
270
+ function M({ title: t, children: o }) {
271
+ return /* @__PURE__ */ s("div", { className: "rounded-lg border border-border bg-card px-5 py-6", children: [
239
272
  /* @__PURE__ */ r("p", { className: "text-[14px] font-semibold text-foreground", children: t }),
240
- /* @__PURE__ */ r("div", { className: "mt-1 max-w-[70ch] text-[12.5px] text-muted-foreground", children: n })
273
+ /* @__PURE__ */ r("div", { className: "mt-1 max-w-[70ch] text-[12.5px] text-muted-foreground", children: o })
241
274
  ] });
242
275
  }
243
- function ot({ onOpenRecord: t }) {
276
+ function at({ onOpenRecord: t }) {
244
277
  var V, z, G, J, Q, Z;
245
- const [n, c] = g(""), [i, d] = g(""), [m, f] = g(""), [l, h] = g(""), [u, T] = g(""), [U, I] = g(""), [_, R] = g(!1), [N, A] = g(null), b = Ie(U.trim(), 350), Y = Te(), [j, pe] = g([]), B = j.filter((e) => e.can_list), W = n ? B.filter((e) => e.direction === n) : B, me = i || (n && W.length === 1 ? W[0].id : ""), s = Re({
278
+ const [o, i] = g(""), [a, d] = g(""), [c, m] = g(""), [u, h] = g(""), [f, b] = g(""), [U, I] = g(""), [R, A] = g(!1), [k, $] = g(null), v = Te(U.trim(), 350), Y = Oe(), [j, pe] = g([]), B = j.filter((e) => e.can_list), W = o ? B.filter((e) => e.direction === o) : B, me = a || (o && W.length === 1 ? W[0].id : ""), l = Re({
246
279
  provider: me,
247
- status: m,
248
- partner: l || void 0,
249
- caller: n === "in" && u ? u : void 0,
250
- record: b || void 0,
251
- includePeople: n === "in" && _
280
+ status: c,
281
+ partner: u || void 0,
282
+ caller: o === "in" && f ? f : void 0,
283
+ record: v || void 0,
284
+ includePeople: o === "in" && R
252
285
  }), [fe, X] = g(!1), [, ge] = g(0);
253
- F(() => {
254
- const e = setInterval(() => ge((o) => o + 1), 3e4);
286
+ L(() => {
287
+ const e = setInterval(() => ge((n) => n + 1), 3e4);
255
288
  return () => clearInterval(e);
256
289
  }, []);
257
- const P = (z = (V = s.data) == null ? void 0 : V.pages[0]) == null ? void 0 : z.providers;
258
- F(() => {
290
+ const P = (z = (V = l.data) == null ? void 0 : V.pages[0]) == null ? void 0 : z.providers;
291
+ L(() => {
259
292
  P && pe(P);
260
293
  }, [P]);
261
- const $ = P ?? j, S = $.filter((e) => e.can_list), q = k(() => {
294
+ const F = P ?? j, E = F.filter((e) => e.can_list), q = S(() => {
262
295
  const e = /* @__PURE__ */ new Map();
263
- for (const o of $) o.direction && e.set(o.id, o.direction);
296
+ for (const n of F) n.direction && e.set(n.id, n.direction);
264
297
  return e;
265
- }, [$]), H = (e) => e.direction ?? q.get(M(e)) ?? null, x = ((J = (G = s.data) == null ? void 0 : G.pages[0]) == null ? void 0 : J.record) ?? null, v = k(() => {
298
+ }, [F]), H = (e) => e.direction ?? q.get(O(e)) ?? null, y = ((J = (G = l.data) == null ? void 0 : G.pages[0]) == null ? void 0 : J.record) ?? null, N = S(() => {
266
299
  var p;
267
- const e = /* @__PURE__ */ new Set(), o = [];
268
- for (const C of ((p = s.data) == null ? void 0 : p.pages) ?? [])
269
- for (const ee of C.entries) {
270
- const te = O(ee);
271
- e.has(te) || (e.add(te), o.push(ee));
300
+ const e = /* @__PURE__ */ new Set(), n = [];
301
+ for (const x of ((p = l.data) == null ? void 0 : p.pages) ?? [])
302
+ for (const ee of x.entries) {
303
+ const te = T(ee);
304
+ e.has(te) || (e.add(te), n.push(ee));
272
305
  }
273
- return o;
274
- }, [s.data]), E = k(
275
- () => n && !i ? v.filter((e) => H(e) === n) : v,
276
- [v, n, i, q]
277
- ), he = k(() => {
306
+ return n;
307
+ }, [l.data]), _ = S(
308
+ () => o && !a ? N.filter((e) => H(e) === o) : N,
309
+ [N, o, a, q]
310
+ ), he = S(() => {
278
311
  const e = /* @__PURE__ */ new Set();
279
- for (const o of v) o.partner && e.add(o.partner);
280
- return l && e.add(l), [
312
+ for (const n of N) n.partner && e.add(n.partner);
313
+ return u && e.add(u), [
281
314
  { value: "", label: "All partners" },
282
- ...[...e].sort((o, p) => o.localeCompare(p)).map((o) => ({ value: o, label: o }))
315
+ ...[...e].sort((n, p) => n.localeCompare(p)).map((n) => ({ value: n, label: n }))
283
316
  ];
284
- }, [v, l]), be = k(() => {
317
+ }, [N, u]), be = S(() => {
285
318
  const e = /* @__PURE__ */ new Map();
286
- for (const o of v) o.caller && !e.has(o.caller) && e.set(o.caller, o.label);
287
- return u && !e.has(u) && e.set(u, "Selected caller"), [
319
+ for (const n of N) n.caller && !e.has(n.caller) && e.set(n.caller, n.label);
320
+ return f && !e.has(f) && e.set(f, "Selected caller"), [
288
321
  { value: "", label: "All callers" },
289
- ...[...e.entries()].sort((o, p) => o[1].localeCompare(p[1])).map(([o, p]) => ({ value: o, label: p }))
322
+ ...[...e.entries()].sort((n, p) => n[1].localeCompare(p[1])).map(([n, p]) => ({ value: n, label: p }))
290
323
  ];
291
- }, [v, u]), xe = k(() => {
324
+ }, [N, f]), xe = S(() => {
292
325
  const e = [];
293
- for (const o of E) {
294
- const p = Be(o.created_at), C = e[e.length - 1];
295
- C && C.key === p ? C.items.push(o) : e.push({ key: p, label: je(o.created_at), items: [o] });
326
+ for (const n of _) {
327
+ const p = We(n.created_at), x = e[e.length - 1];
328
+ x && x.key === p ? x.items.push(n) : e.push({ key: p, label: Be(n.created_at), items: [n] });
296
329
  }
297
- return e;
298
- }, [E]), ve = n !== "" || i !== "" || m !== "" || l !== "" || u !== "" || b !== "" || _, D = s.dataUpdatedAt ? new Date(s.dataUpdatedAt).toISOString() : null, ye = s.isRefetching && fe && !s.isFetchingNextPage;
299
- F(() => {
300
- s.isRefetching || X(!1);
301
- }, [s.isRefetching]);
330
+ return e.map((n) => ({ ...n, rows: Ye(n.items) }));
331
+ }, [_]), ve = o !== "" || a !== "" || c !== "" || u !== "" || f !== "" || v !== "" || R, D = l.dataUpdatedAt ? new Date(l.dataUpdatedAt).toISOString() : null, ye = l.isRefetching && fe && !l.isFetchingNextPage;
332
+ L(() => {
333
+ l.isRefetching || X(!1);
334
+ }, [l.isRefetching]);
302
335
  const Ne = () => {
303
- c(""), d(""), f(""), h(""), T(""), I(""), R(!1);
336
+ i(""), d(""), m(""), h(""), b(""), I(""), A(!1);
304
337
  }, we = (e) => {
305
- c(e);
306
- const o = S.find((p) => p.id === i);
307
- e && o && o.direction !== e && d(""), e !== "in" && (T(""), R(!1));
338
+ i(e);
339
+ const n = E.find((p) => p.id === a);
340
+ e && n && n.direction !== e && d(""), e !== "in" && (b(""), A(!1));
308
341
  }, ke = [
309
- { value: "", label: n ? "Every source" : "All sources" },
310
- ...(n ? S.filter((e) => e.direction === n) : S).map((e) => ({
342
+ { value: "", label: o ? "Every source" : "All sources" },
343
+ ...(o ? E.filter((e) => e.direction === o) : E).map((e) => ({
311
344
  value: e.id,
312
345
  label: e.label
313
346
  }))
314
- ], Ce = /* @__PURE__ */ a("div", { className: "space-y-2", children: [
315
- /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2", children: [
347
+ ], Ce = /* @__PURE__ */ s("div", { className: "space-y-2", children: [
348
+ /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2", children: [
316
349
  /* @__PURE__ */ r("p", { className: "min-w-0 text-[13px] text-muted-foreground", "data-ic-events-summary": !0, children: "What each partner reported, newest first, across every record. Open an event to see everything it set off." }),
317
- /* @__PURE__ */ a(
350
+ /* @__PURE__ */ s(
318
351
  "button",
319
352
  {
320
353
  type: "button",
321
354
  "data-ic-events-refresh": !0,
322
- disabled: s.isFetching,
355
+ disabled: l.isFetching,
323
356
  onClick: () => {
324
- X(!0), s.refetch();
357
+ X(!0), l.refetch();
325
358
  },
326
359
  "data-tip": D ? `Updated ${ce(D)}` : void 0,
327
360
  className: "inline-flex h-8 items-center gap-1.5 rounded-md border border-border bg-card px-3 text-[12.5px] font-medium text-foreground transition-colors hover:bg-muted disabled:opacity-70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
328
361
  children: [
329
- /* @__PURE__ */ r(ie, { className: y("h-3.5 w-3.5", ye && "animate-spin") }),
362
+ /* @__PURE__ */ r(ie, { className: w("h-3.5 w-3.5", ye && "animate-spin") }),
330
363
  D ? `Updated ${le(D)}` : "Refresh"
331
364
  ]
332
365
  }
333
366
  )
334
367
  ] }),
335
- /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2", children: [
368
+ /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-2", children: [
336
369
  /* @__PURE__ */ r(
337
370
  se,
338
371
  {
339
- value: n,
372
+ value: o,
340
373
  options: Me,
341
374
  onChange: we,
342
375
  label: "Direction",
@@ -344,9 +377,9 @@ function ot({ onOpenRecord: t }) {
344
377
  }
345
378
  ),
346
379
  /* @__PURE__ */ r("div", { "data-ic-events-source": !0, children: /* @__PURE__ */ r(
347
- L,
380
+ K,
348
381
  {
349
- value: i,
382
+ value: a,
350
383
  onChange: d,
351
384
  options: ke,
352
385
  ariaLabel: "Source",
@@ -354,20 +387,20 @@ function ot({ onOpenRecord: t }) {
354
387
  }
355
388
  ) }),
356
389
  /* @__PURE__ */ r("div", { "data-ic-events-partner": !0, children: /* @__PURE__ */ r(
357
- L,
390
+ K,
358
391
  {
359
- value: l,
392
+ value: u,
360
393
  onChange: h,
361
394
  options: he,
362
395
  ariaLabel: "Partner",
363
396
  className: "h-8 w-[150px] border-border bg-card text-[12.5px]"
364
397
  }
365
398
  ) }),
366
- n === "in" && /* @__PURE__ */ r("div", { "data-ic-events-caller": !0, children: /* @__PURE__ */ r(
367
- L,
399
+ o === "in" && /* @__PURE__ */ r("div", { "data-ic-events-caller": !0, children: /* @__PURE__ */ r(
400
+ K,
368
401
  {
369
- value: u,
370
- onChange: T,
402
+ value: f,
403
+ onChange: b,
371
404
  options: be,
372
405
  ariaLabel: "Caller",
373
406
  className: "h-8 w-[170px] border-border bg-card text-[12.5px]"
@@ -376,17 +409,17 @@ function ot({ onOpenRecord: t }) {
376
409
  /* @__PURE__ */ r(
377
410
  se,
378
411
  {
379
- value: m,
380
- options: Ye,
381
- onChange: f,
412
+ value: c,
413
+ options: je,
414
+ onChange: m,
382
415
  label: "Status",
383
416
  "data-ic-events-status": !0
384
417
  }
385
418
  ),
386
- /* @__PURE__ */ a("label", { className: "relative inline-flex h-8 items-center", children: [
419
+ /* @__PURE__ */ s("label", { className: "relative inline-flex h-8 items-center", children: [
387
420
  /* @__PURE__ */ r("span", { className: "sr-only", children: "Find events that touched a record" }),
388
421
  /* @__PURE__ */ r(
389
- Pe,
422
+ Se,
390
423
  {
391
424
  className: "pointer-events-none absolute left-2.5 h-3.5 w-3.5 text-muted-foreground",
392
425
  "aria-hidden": !0
@@ -404,7 +437,7 @@ function ot({ onOpenRecord: t }) {
404
437
  }
405
438
  )
406
439
  ] }),
407
- n === "in" && /* @__PURE__ */ a(
440
+ o === "in" && /* @__PURE__ */ s(
408
441
  "div",
409
442
  {
410
443
  className: "inline-flex h-8 items-center gap-2 text-[12.5px] text-foreground",
@@ -412,11 +445,11 @@ function ot({ onOpenRecord: t }) {
412
445
  "data-tip": "Also list calls made with people's own tokens, not only integration accounts",
413
446
  children: [
414
447
  /* @__PURE__ */ r(
415
- _e,
448
+ Ie,
416
449
  {
417
450
  id: Y,
418
- checked: _,
419
- onCheckedChange: (e) => R(e === !0)
451
+ checked: R,
452
+ onCheckedChange: (e) => A(e === !0)
420
453
  }
421
454
  ),
422
455
  /* @__PURE__ */ r("label", { htmlFor: Y, className: "cursor-pointer", children: "Include people's tokens" })
@@ -424,28 +457,28 @@ function ot({ onOpenRecord: t }) {
424
457
  }
425
458
  )
426
459
  ] }),
427
- b && !s.isPlaceholderData && !s.isLoading && !s.isError && /* @__PURE__ */ a(
460
+ v && !l.isPlaceholderData && !l.isLoading && !l.isError && /* @__PURE__ */ s(
428
461
  "p",
429
462
  {
430
463
  className: "flex flex-wrap items-center gap-2 text-[12.5px] text-muted-foreground",
431
- "data-ic-events-record": x ? `${x.collection}:${x.item}` : "none",
464
+ "data-ic-events-record": y ? `${y.collection}:${y.item}` : "none",
432
465
  children: [
433
- x ? /* @__PURE__ */ a(re, { children: [
466
+ y ? /* @__PURE__ */ s(re, { children: [
434
467
  "Events that touched ",
435
- /* @__PURE__ */ r("span", { className: "font-medium text-foreground", children: b }),
436
- /* @__PURE__ */ a("span", { className: "text-[12px]", children: [
468
+ /* @__PURE__ */ r("span", { className: "font-medium text-foreground", children: v }),
469
+ /* @__PURE__ */ s("span", { className: "text-[12px]", children: [
437
470
  "(",
438
- x.collection.replace(/_/g, " "),
471
+ y.collection.replace(/_/g, " "),
439
472
  " ",
440
- x.item,
473
+ y.item,
441
474
  ")"
442
475
  ] })
443
- ] }) : /* @__PURE__ */ a(re, { children: [
476
+ ] }) : /* @__PURE__ */ s(re, { children: [
444
477
  "No record matches “",
445
- b,
478
+ v,
446
479
  "”"
447
480
  ] }),
448
- /* @__PURE__ */ a(
481
+ /* @__PURE__ */ s(
449
482
  "button",
450
483
  {
451
484
  type: "button",
@@ -453,7 +486,7 @@ function ot({ onOpenRecord: t }) {
453
486
  onClick: () => I(""),
454
487
  className: "inline-flex h-6 items-center gap-1 rounded px-1.5 font-medium text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
455
488
  children: [
456
- /* @__PURE__ */ r(Se, { className: "h-3 w-3", "aria-hidden": !0 }),
489
+ /* @__PURE__ */ r(Pe, { className: "h-3 w-3", "aria-hidden": !0 }),
457
490
  "Clear"
458
491
  ]
459
492
  }
@@ -462,9 +495,9 @@ function ot({ onOpenRecord: t }) {
462
495
  }
463
496
  )
464
497
  ] });
465
- let w;
466
- if (s.isLoading)
467
- w = /* @__PURE__ */ r("div", { className: "overflow-hidden rounded-lg border border-border bg-card", "aria-busy": !0, children: [0, 1, 2, 3, 4, 5].map((e) => /* @__PURE__ */ a(
498
+ let C;
499
+ if (l.isLoading)
500
+ C = /* @__PURE__ */ r("div", { className: "overflow-hidden rounded-lg border border-border bg-card", "aria-busy": !0, children: [0, 1, 2, 3, 4, 5].map((e) => /* @__PURE__ */ s(
468
501
  "div",
469
502
  {
470
503
  className: "flex items-center gap-3 border-t border-border px-4 py-3 first:border-t-0",
@@ -476,12 +509,12 @@ function ot({ onOpenRecord: t }) {
476
509
  },
477
510
  e
478
511
  )) });
479
- else if (s.isError) {
480
- const e = ((Z = (Q = s.error) == null ? void 0 : Q.response) == null ? void 0 : Z.error) ?? (s.error instanceof Error ? s.error.message : null);
481
- w = /* @__PURE__ */ a(
512
+ else if (l.isError) {
513
+ const e = ((Z = (Q = l.error) == null ? void 0 : Q.response) == null ? void 0 : Z.error) ?? (l.error instanceof Error ? l.error.message : null);
514
+ C = /* @__PURE__ */ s(
482
515
  "p",
483
516
  {
484
- className: y(
517
+ className: w(
485
518
  "rounded-lg border px-4 py-3 text-[12.5px]",
486
519
  $e.negative,
487
520
  ue.negative,
@@ -494,15 +527,15 @@ function ot({ onOpenRecord: t }) {
494
527
  ]
495
528
  }
496
529
  );
497
- } else S.length === 0 ? w = /* @__PURE__ */ a(K, { title: "No integration reports events yet", children: [
530
+ } else E.length === 0 ? C = /* @__PURE__ */ s(M, { title: "No integration reports events yet", children: [
498
531
  "An extension adds a source with",
499
532
  " ",
500
533
  /* @__PURE__ */ r("code", { className: "font-mono text-[12px] text-foreground", children: "ctx.notes.registerSource" }),
501
534
  " and a ",
502
535
  /* @__PURE__ */ r("code", { className: "font-mono text-[12px] text-foreground", children: "list" }),
503
536
  " function; its events then appear here, newest first, with Replay where the source can re-apply one."
504
- ] }) : E.length === 0 ? w = ve ? /* @__PURE__ */ a(K, { title: "Nothing matches", children: [
505
- b && !x ? `No record matches “${b}”. ` : "No events match these filters. ",
537
+ ] }) : _.length === 0 ? C = ve ? /* @__PURE__ */ s(M, { title: "Nothing matches", children: [
538
+ v && !y ? `No record matches “${v}”. ` : "No events match these filters. ",
506
539
  /* @__PURE__ */ r(
507
540
  "button",
508
541
  {
@@ -513,69 +546,71 @@ function ot({ onOpenRecord: t }) {
513
546
  children: "Clear the filters"
514
547
  }
515
548
  )
516
- ] }) : /* @__PURE__ */ r(K, { title: "No events yet", children: "The sources are connected but have not reported anything. Events appear here as partners send them." }) : w = /* @__PURE__ */ a(
549
+ ] }) : /* @__PURE__ */ r(M, { title: "No events yet", children: "The sources are connected but have not reported anything. Events appear here as partners send them." }) : C = /* @__PURE__ */ s(
517
550
  "div",
518
551
  {
519
- className: y("space-y-5 transition-opacity", s.isPlaceholderData && "opacity-60"),
520
- "aria-busy": s.isPlaceholderData || void 0,
552
+ className: w("space-y-5 transition-opacity", l.isPlaceholderData && "opacity-60"),
553
+ "aria-busy": l.isPlaceholderData || void 0,
521
554
  children: [
522
- xe.map((e) => /* @__PURE__ */ a("section", { "data-ic-events-day": e.key, "aria-label": e.label, children: [
523
- /* @__PURE__ */ a("h3", { className: "mb-2 flex items-baseline gap-2 text-[12.5px] font-semibold text-foreground", children: [
555
+ xe.map((e) => /* @__PURE__ */ s("section", { "data-ic-events-day": e.key, "aria-label": e.label, children: [
556
+ /* @__PURE__ */ s("h3", { className: "mb-2 flex items-baseline gap-2 text-[12.5px] font-semibold text-foreground", children: [
524
557
  e.label,
525
- /* @__PURE__ */ a("span", { className: "text-[12px] font-normal tabular-nums text-muted-foreground", children: [
558
+ /* @__PURE__ */ s("span", { className: "text-[12px] font-normal tabular-nums text-muted-foreground", children: [
526
559
  e.items.length,
527
560
  " event",
528
561
  e.items.length === 1 ? "" : "s"
529
562
  ] })
530
563
  ] }),
531
- /* @__PURE__ */ r("ul", { className: "divide-y divide-border overflow-hidden rounded-lg border border-border bg-card", children: e.items.map((o) => /* @__PURE__ */ r(
532
- qe,
564
+ /* @__PURE__ */ r("ul", { className: "divide-y divide-border overflow-hidden rounded-lg border border-border bg-card", children: e.rows.map(({ event: n, repeats: p }) => /* @__PURE__ */ r(
565
+ He,
533
566
  {
534
- event: o,
535
- direction: H(o),
567
+ event: n,
568
+ repeats: p,
569
+ direction: H(n),
536
570
  onOpenRecord: t,
537
- onSelect: (p) => A({ target: { source: M(p), id: String(p.id) }, event: p })
571
+ onSelect: (x) => $({ target: { source: O(x), id: String(x.id) }, event: x })
538
572
  },
539
- O(o)
573
+ T(n)
540
574
  )) })
541
575
  ] }, e.key)),
542
- /* @__PURE__ */ a("div", { className: "flex items-center gap-3", children: [
543
- s.hasNextPage ? /* @__PURE__ */ r(
576
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
577
+ l.hasNextPage ? /* @__PURE__ */ r(
544
578
  "button",
545
579
  {
546
580
  type: "button",
547
581
  "data-ic-events-older": !0,
548
- disabled: s.isFetchingNextPage,
549
- onClick: () => void s.fetchNextPage(),
582
+ disabled: l.isFetchingNextPage,
583
+ onClick: () => void l.fetchNextPage(),
550
584
  className: "inline-flex h-8 items-center rounded-md border border-border bg-card px-3 text-[12.5px] font-medium text-foreground transition-colors hover:bg-muted disabled:opacity-70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
551
- children: s.isFetchingNextPage ? "Loading older…" : "Show older"
585
+ children: l.isFetchingNextPage ? "Loading older…" : "Show older"
552
586
  }
553
587
  ) : /* @__PURE__ */ r("p", { className: "text-[12px] text-muted-foreground", "data-ic-events-end": !0, children: "That is as far back as the sources keep." }),
554
- /* @__PURE__ */ a("span", { className: "text-[12px] tabular-nums text-muted-foreground", children: [
555
- E.length,
588
+ /* @__PURE__ */ s("span", { className: "text-[12px] tabular-nums text-muted-foreground", children: [
589
+ _.length,
556
590
  " shown"
557
591
  ] })
558
592
  ] })
559
593
  ]
560
594
  }
561
595
  );
562
- return /* @__PURE__ */ a("div", { className: "space-y-4", "data-ic-events": !0, children: [
596
+ return /* @__PURE__ */ s("div", { className: "space-y-4", "data-ic-events": !0, children: [
563
597
  Ce,
564
- w,
598
+ C,
565
599
  /* @__PURE__ */ r(
566
600
  Le,
567
601
  {
568
- target: (N == null ? void 0 : N.target) ?? null,
569
- event: N == null ? void 0 : N.event,
570
- onClose: () => A(null),
602
+ target: (k == null ? void 0 : k.target) ?? null,
603
+ event: k == null ? void 0 : k.event,
604
+ onClose: () => $(null),
571
605
  onOpenRecord: t,
572
- onOpenEvent: (e) => A({ target: e, event: null })
606
+ onOpenEvent: (e) => $({ target: e, event: null })
573
607
  }
574
608
  )
575
609
  ] });
576
610
  }
577
611
  export {
578
- ot as EventsView,
612
+ at as EventsView,
579
613
  se as Segment,
580
- je as dayHeading
614
+ Ye as collapseRepeats,
615
+ Be as dayHeading
581
616
  };