@nivaro/react 0.3.99 → 0.3.101

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 (60) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useFormSchema.js +82 -85
  3. package/dist/hooks/useSessionRecorder.js +206 -175
  4. package/dist/index.d.ts +84 -16
  5. package/dist/index.js +627 -622
  6. package/dist/lib/commands.js +15 -11
  7. package/dist/shared/components/ActivityEntry.js +5 -5
  8. package/dist/shared/components/CollectionBrowserView.js +516 -503
  9. package/dist/shared/components/ItemEditForm.js +3471 -3465
  10. package/dist/shared/components/JobsTray.js +76 -61
  11. package/dist/shared/components/MyWorkView.js +133 -126
  12. package/dist/shared/components/NotificationBell.js +322 -289
  13. package/dist/shared/components/RecordCompare.js +38 -40
  14. package/dist/shared/components/RecordReadView.js +119 -119
  15. package/dist/shared/components/TipLayer.js +56 -41
  16. package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
  17. package/dist/shared/components/integrations/console/SignalCard.js +40 -40
  18. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +95 -73
  19. package/dist/shared/components/integrations/console/drill/status.js +23 -18
  20. package/dist/shared/components/item-edit/InlineGridField.js +45 -45
  21. package/dist/shared/components/item-edit/InlineTableField.js +750 -749
  22. package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
  23. package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
  24. package/dist/shared/components/item-edit/RecordInsights.js +86 -86
  25. package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
  26. package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
  27. package/dist/shared/components/item-edit/header-path-preview.js +46 -34
  28. package/dist/shared/components/item-edit/related-missing.js +75 -19
  29. package/dist/shared/components/notifications/DeliveryChips.js +1 -2
  30. package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
  31. package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
  32. package/dist/shared/components/panels/BackgroundMove.js +242 -0
  33. package/dist/shared/components/panels/MoveAdvisory.js +204 -0
  34. package/dist/shared/components/panels/PipelinePanel.js +1459 -1220
  35. package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
  36. package/dist/shared/components/profile/ActivityFeedCard.js +322 -0
  37. package/dist/shared/components/profile/DayTimeline.js +145 -140
  38. package/dist/shared/components/profile/PersonAccess.js +679 -383
  39. package/dist/shared/components/profile/PersonActivity.js +404 -427
  40. package/dist/shared/components/profile/PersonDidPanel.js +248 -134
  41. package/dist/shared/components/profile/PersonProfile.js +33 -32
  42. package/dist/shared/components/profile/journey-view.js +166 -0
  43. package/dist/shared/lib/activity-sentence.js +319 -236
  44. package/dist/shared/lib/commands.js +18 -14
  45. package/dist/shared/lib/error-hints.js +1 -1
  46. package/dist/shared/lib/job-failure-text.js +12 -0
  47. package/dist/shared/lib/jobs-tray.js +60 -41
  48. package/dist/shared/lib/move-failure.js +19 -0
  49. package/dist/shared/lib/obligation-banner.js +22 -21
  50. package/dist/shared/lib/partner-failure.js +83 -0
  51. package/dist/shared/lib/prefetch.js +73 -73
  52. package/dist/shared/lib/replay-checkout.js +18 -13
  53. package/dist/shared/lib/replay-context.js +90 -77
  54. package/dist/shared/lib/replay-idle.js +21 -0
  55. package/dist/shared/lib/replay-socket.js +21 -17
  56. package/dist/shared/lib/rum.js +56 -51
  57. package/dist/shared/lib/safe-error.js +17 -13
  58. package/dist/shared/lib/stale-chunk.js +69 -26
  59. package/dist/shared/lib/system-collections.js +20 -0
  60. package/package.json +1 -1
@@ -1,20 +1,20 @@
1
- import { withSignal as L } from "@nivaro/sdk";
1
+ import { withSignal as p } from "@nivaro/sdk";
2
2
  import { useQueryClient as O } from "@tanstack/react-query";
3
- import { useRef as K, useEffect as k, useMemo as U } from "react";
3
+ import { useRef as $, useEffect as A, useMemo as U } from "react";
4
4
  import { useOptionalNivaroClient as H } from "../context.js";
5
- import { get as T } from "./commands.js";
6
- const x = 30, A = 80, G = 2, z = 6, M = 3e4;
5
+ import { get as K, getActiveLayout as x } from "./commands.js";
6
+ const G = 30, k = 80, z = 2, B = 6, M = 3e4;
7
7
  let v = [];
8
- function B(e = Date.now(), r = x) {
8
+ function J(e = Date.now(), r = G) {
9
9
  return v = v.filter((t) => e - t < 6e4), v.length >= r ? !1 : (v.push(e), !0);
10
10
  }
11
- function J(e) {
11
+ function W(e) {
12
12
  return e ? e.saveData ? !1 : e.effectiveType !== "slow-2g" && e.effectiveType !== "2g" : !0;
13
13
  }
14
- function W() {
15
- return typeof navigator > "u" ? !1 : !J(navigator.connection);
14
+ function X() {
15
+ return typeof navigator > "u" ? !1 : !W(navigator.connection);
16
16
  }
17
- function X(e = G, r = z) {
17
+ function V(e = z, r = B) {
18
18
  const t = [], n = /* @__PURE__ */ new Map(), i = () => {
19
19
  for (; n.size < e && t.length > 0; ) {
20
20
  const u = t.shift();
@@ -51,49 +51,49 @@ function X(e = G, r = z) {
51
51
  }
52
52
  };
53
53
  }
54
- const g = X();
55
- function V(e, r) {
54
+ const g = V();
55
+ function Y(e, r) {
56
56
  setTimeout(() => {
57
57
  const t = e.getQueryCache().find({ queryKey: r, exact: !0 });
58
58
  !t || t.getObserversCount() > 0 || t.state.fetchStatus !== "fetching" || e.cancelQueries({ queryKey: r, exact: !0 });
59
59
  }, 120);
60
60
  }
61
- function Y(e, r) {
61
+ function Z(e, r) {
62
62
  return {
63
63
  item: ["item", e, String(r)],
64
64
  layout: ["active-layout", e, null, String(r)]
65
65
  };
66
66
  }
67
- function F(e, r, t) {
67
+ function b(e, r, t) {
68
68
  const n = e.getQueryState(r);
69
69
  return n ? n.fetchStatus === "fetching" ? !0 : n.dataUpdatedAt > 0 && t - n.dataUpdatedAt < M : !1;
70
70
  }
71
71
  function y(e, r, t, n = Date.now(), i) {
72
- if (W() || F(e, r, n)) return !1;
72
+ if (X() || b(e, r, n)) return !1;
73
73
  const u = JSON.stringify(r);
74
- return g.has(u) || !B(n) ? !1 : g.add({
74
+ return g.has(u) || !J(n) ? !1 : g.add({
75
75
  id: u,
76
76
  group: i ?? null,
77
77
  run: () => (
78
78
  // Fresh by now (the page itself fetched it while this waited) = nothing to do.
79
- F(e, r, Date.now()) ? Promise.resolve() : e.prefetchQuery({
79
+ b(e, r, Date.now()) ? Promise.resolve() : e.prefetchQuery({
80
80
  queryKey: r,
81
81
  queryFn: ({ signal: s }) => t(s),
82
82
  staleTime: M
83
83
  })
84
84
  ),
85
- cancel: () => V(e, r)
85
+ cancel: () => Y(e, r)
86
86
  });
87
87
  }
88
88
  function N(e, r, t, n, i = {}) {
89
89
  if (!t || n == null || n === "" || n === "new") return 0;
90
- const u = Y(t, n), s = i.group ?? `record:${t}:${n}`;
90
+ const u = Z(t, n), s = i.group ?? `record:${t}:${n}`;
91
91
  let c = 0;
92
92
  return y(
93
93
  e,
94
94
  u.item,
95
95
  (l) => r.request(
96
- L(T(`/items/${t}/${n}`), l)
96
+ p(K(`/items/${t}/${n}`), l)
97
97
  ).then((f) => f.data),
98
98
  Date.now(),
99
99
  s
@@ -101,27 +101,27 @@ function N(e, r, t, n, i = {}) {
101
101
  e,
102
102
  u.layout,
103
103
  (l) => r.request(
104
- L(T("/collection-layouts/active", { collection: t, item: String(n) }), l)
104
+ p(x({ collection: t, item: String(n) }), l)
105
105
  ).then((f) => f.data ?? null),
106
106
  Date.now(),
107
107
  s
108
108
  ) && c++, c;
109
109
  }
110
- function Z(e) {
110
+ function j(e) {
111
111
  return { meta: ["cbv-collection-meta", e] };
112
112
  }
113
113
  function Q(e, r, t, n = {}) {
114
114
  if (!t || /^(nivaro|directus)_/i.test(t)) return 0;
115
- const i = Z(t);
115
+ const i = j(t);
116
116
  return y(
117
117
  e,
118
118
  i.meta,
119
- (u) => r.request(L(T(`/collections/${t}`), u)).then((s) => s.data),
119
+ (u) => r.request(p(K(`/collections/${t}`), u)).then((s) => s.data),
120
120
  Date.now(),
121
121
  n.group ?? `list:${t}`
122
122
  ) ? 1 : 0;
123
123
  }
124
- function j(e, r = 2e3) {
124
+ function ee(e, r = 2e3) {
125
125
  if (typeof window > "u") return () => {
126
126
  };
127
127
  const t = window;
@@ -135,19 +135,19 @@ function j(e, r = 2e3) {
135
135
  const n = setTimeout(e, 300);
136
136
  return () => clearTimeout(n);
137
137
  }
138
- function ce(e) {
139
- const r = K(e);
138
+ function se(e) {
139
+ const r = $(e);
140
140
  r.current = e;
141
141
  const t = JSON.stringify(e.queryKey);
142
- k(() => {
142
+ A(() => {
143
143
  if (e.enabled)
144
- return j(() => {
144
+ return ee(() => {
145
145
  const n = r.current;
146
146
  y(n.qc, n.queryKey, n.queryFn);
147
147
  });
148
148
  }, [e.enabled, t]);
149
149
  }
150
- function ee(e, r) {
150
+ function te(e, r) {
151
151
  const t = e.getAttribute("href");
152
152
  if (!t || t.startsWith("#") || e.hasAttribute("download") || e.target && e.target !== "_self") return null;
153
153
  try {
@@ -157,7 +157,7 @@ function ee(e, r) {
157
157
  return null;
158
158
  }
159
159
  }
160
- function te(e) {
160
+ function ne(e) {
161
161
  if (typeof document > "u") return () => {
162
162
  };
163
163
  const r = e.root ?? document, t = window.location.origin;
@@ -167,54 +167,54 @@ function te(e) {
167
167
  }, c = () => {
168
168
  s(), i = null, u && g.cancelGroup(u), u = null;
169
169
  }, l = (a) => {
170
- var C, D, b;
171
- const o = ee(a, t);
170
+ var _, C, D;
171
+ const o = te(a, t);
172
172
  if (!o) return;
173
173
  try {
174
- (C = e.preloadRoute) == null || C.call(e, o);
174
+ (_ = e.preloadRoute) == null || _.call(e, o);
175
175
  } catch {
176
176
  }
177
177
  if (!e.client) return;
178
- const d = o.split("?")[0], m = `link:${d}`, w = (D = e.matchRecord) == null ? void 0 : D.call(e, d);
178
+ const d = o.split("?")[0], m = `link:${d}`, w = (C = e.matchRecord) == null ? void 0 : C.call(e, d);
179
179
  if (w) {
180
180
  N(e.qc, e.client, w.collection, w.id, { group: m }) > 0 && (u = m);
181
181
  return;
182
182
  }
183
- const _ = (b = e.matchList) == null ? void 0 : b.call(e, d);
184
- _ && Q(e.qc, e.client, _, { group: m }) > 0 && (u = m);
183
+ const I = (D = e.matchList) == null ? void 0 : D.call(e, d);
184
+ I && Q(e.qc, e.client, I, { group: m }) > 0 && (u = m);
185
185
  }, f = (a) => {
186
186
  var o, d;
187
187
  return (d = (o = a.target) == null ? void 0 : o.closest) == null ? void 0 : d.call(o, "a[href]");
188
- }, P = (a) => {
188
+ }, T = (a) => {
189
189
  const o = f(a);
190
190
  !o || o === i || (c(), i = o, n = setTimeout(() => {
191
191
  n = null, l(o);
192
- }, A));
193
- }, q = (a) => {
192
+ }, k));
193
+ }, P = (a) => {
194
194
  const o = a.relatedTarget;
195
195
  i && o && i.contains(o) || c();
196
196
  }, E = () => {
197
197
  u = null;
198
- }, R = (a) => {
198
+ }, q = (a) => {
199
199
  const o = a.key;
200
200
  (o === "Enter" || o === " ") && E();
201
- }, S = (a) => {
201
+ }, R = (a) => {
202
202
  const o = f(a);
203
203
  o && (c(), l(o));
204
- }, I = (a) => {
204
+ }, S = (a) => {
205
205
  f(a) && c();
206
206
  };
207
- return r.addEventListener("pointerover", P, { passive: !0 }), r.addEventListener("pointerout", q, { passive: !0 }), r.addEventListener("pointerdown", E, { passive: !0, capture: !0 }), r.addEventListener("keydown", R, { capture: !0 }), r.addEventListener("focusin", S), r.addEventListener("focusout", I), () => {
208
- s(), r.removeEventListener("pointerover", P), r.removeEventListener("pointerout", q), r.removeEventListener("pointerdown", E, { capture: !0 }), r.removeEventListener("keydown", R, { capture: !0 }), r.removeEventListener("focusin", S), r.removeEventListener("focusout", I);
207
+ return r.addEventListener("pointerover", T, { passive: !0 }), r.addEventListener("pointerout", P, { passive: !0 }), r.addEventListener("pointerdown", E, { passive: !0, capture: !0 }), r.addEventListener("keydown", q, { capture: !0 }), r.addEventListener("focusin", R), r.addEventListener("focusout", S), () => {
208
+ s(), r.removeEventListener("pointerover", T), r.removeEventListener("pointerout", P), r.removeEventListener("pointerdown", E, { capture: !0 }), r.removeEventListener("keydown", q, { capture: !0 }), r.removeEventListener("focusin", R), r.removeEventListener("focusout", S);
209
209
  };
210
210
  }
211
- function se(e) {
212
- const r = K(e);
211
+ function ae(e) {
212
+ const r = $(e);
213
213
  r.current = e;
214
214
  const t = e.enabled !== !1;
215
- k(() => {
215
+ A(() => {
216
216
  if (t)
217
- return te({
217
+ return ne({
218
218
  qc: r.current.qc,
219
219
  get client() {
220
220
  return r.current.client;
@@ -235,68 +235,68 @@ function se(e) {
235
235
  });
236
236
  }, [t]);
237
237
  }
238
- const h = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set();
239
- function $(e, r) {
238
+ const h = /* @__PURE__ */ new Map(), L = /* @__PURE__ */ new Set();
239
+ function F(e, r) {
240
240
  const t = () => {
241
241
  const i = h.get(e);
242
242
  i && clearTimeout(i), h.set(
243
243
  e,
244
244
  setTimeout(() => {
245
- h.delete(e), r() && p.add(e);
246
- }, A)
245
+ h.delete(e), r() && L.add(e);
246
+ }, k)
247
247
  );
248
248
  }, n = () => {
249
249
  const i = h.get(e);
250
- i && clearTimeout(i), h.delete(e), p.delete(e) && g.cancelGroup(e);
250
+ i && clearTimeout(i), h.delete(e), L.delete(e) && g.cancelGroup(e);
251
251
  };
252
252
  return {
253
253
  onPointerEnter: t,
254
254
  onPointerLeave: n,
255
255
  onPointerDown: () => {
256
- p.delete(e);
256
+ L.delete(e);
257
257
  },
258
258
  onFocus: t,
259
259
  onBlur: n
260
260
  };
261
261
  }
262
- function ae() {
262
+ function fe() {
263
263
  const e = O(), r = H();
264
264
  return U(
265
265
  () => ({
266
266
  record: (t, n) => {
267
267
  if (!r || !t || n == null || n === "" || n === "new") return {};
268
268
  const i = `record:${t}:${n}`;
269
- return $(i, () => N(e, r, t, n, { group: i }));
269
+ return F(i, () => N(e, r, t, n, { group: i }));
270
270
  },
271
271
  list: (t) => {
272
272
  if (!r || !t) return {};
273
273
  const n = `list:${t}`;
274
- return $(n, () => Q(e, r, t, { group: n }));
274
+ return F(n, () => Q(e, r, t, { group: n }));
275
275
  }
276
276
  }),
277
277
  [e, r]
278
278
  );
279
279
  }
280
280
  export {
281
- A as INTENT_DWELL_MS,
282
- G as MAX_PREFETCH_IN_FLIGHT,
283
- z as MAX_PREFETCH_QUEUED,
284
- x as PREFETCH_PER_MINUTE,
281
+ k as INTENT_DWELL_MS,
282
+ z as MAX_PREFETCH_IN_FLIGHT,
283
+ B as MAX_PREFETCH_QUEUED,
284
+ G as PREFETCH_PER_MINUTE,
285
285
  M as PREFETCH_STALE_MS,
286
- J as connectionAllowsPrefetch,
287
- X as createPrefetchLimiter,
288
- te as installIntentPrefetch,
289
- $ as intentProps,
290
- ee as linkPath,
291
- Z as listQueryKeys,
286
+ W as connectionAllowsPrefetch,
287
+ V as createPrefetchLimiter,
288
+ ne as installIntentPrefetch,
289
+ F as intentProps,
290
+ te as linkPath,
291
+ j as listQueryKeys,
292
292
  Q as prefetchCollectionList,
293
293
  y as prefetchKey,
294
294
  g as prefetchLimiter,
295
295
  N as prefetchRecord,
296
- Y as recordQueryKeys,
297
- B as takePrefetchToken,
298
- ce as useIdleNextPage,
299
- se as useIntentPrefetch,
300
- ae as usePrefetchIntent,
301
- j as whenIdle
296
+ Z as recordQueryKeys,
297
+ J as takePrefetchToken,
298
+ se as useIdleNextPage,
299
+ ae as useIntentPrefetch,
300
+ fe as usePrefetchIntent,
301
+ ee as whenIdle
302
302
  };
@@ -1,20 +1,25 @@
1
1
  const i = 6e4, o = 9e5;
2
- const a = /* @__PURE__ */ new Set([1, 2, 3, 4, 5, 6, 12, 14]);
3
- function u(e = Date.now()) {
4
- return { lastFullAt: e, interacted: !1, pending: !1 };
2
+ const l = /* @__PURE__ */ new Set([1, 2, 3, 4, 5, 6, 12, 14]);
3
+ function u(n) {
4
+ var t;
5
+ const e = n;
6
+ return (e == null ? void 0 : e.type) === 3 && l.has(Number((t = e.data) == null ? void 0 : t.source));
5
7
  }
6
- function _(e, l, t = Date.now()) {
7
- var E;
8
- const n = l;
9
- if ((n == null ? void 0 : n.type) === 2)
10
- return e.lastFullAt = t, e.interacted = !1, e.pending = !1, !1;
11
- if ((n == null ? void 0 : n.type) === 3 && a.has(Number((E = n.data) == null ? void 0 : E.source)) && (e.interacted = !0), e.pending) return !1;
12
- const c = t - e.lastFullAt, r = e.interacted ? c >= 6e4 : c >= 9e5;
13
- return r && (e.pending = !0), r;
8
+ function a(n = Date.now()) {
9
+ return { lastFullAt: n, interacted: !1, pending: !1 };
10
+ }
11
+ function s(n, e, t = Date.now()) {
12
+ const c = e;
13
+ if ((c == null ? void 0 : c.type) === 2)
14
+ return n.lastFullAt = t, n.interacted = !1, n.pending = !1, !1;
15
+ if (u(e) && (n.interacted = !0), n.pending) return !1;
16
+ const r = t - n.lastFullAt, E = n.interacted ? r >= 6e4 : r >= 9e5;
17
+ return E && (n.pending = !0), E;
14
18
  }
15
19
  export {
16
20
  i as REPLAY_CHECKOUT_ACTIVE_MS,
17
21
  o as REPLAY_CHECKOUT_IDLE_MS,
18
- u as createReplayCheckoutState,
19
- _ as noteReplayEvent
22
+ a as createReplayCheckoutState,
23
+ u as isReplayInputEvent,
24
+ s as noteReplayEvent
20
25
  };
@@ -1,144 +1,157 @@
1
- import { pagePattern as b } from "./page-context.js";
2
- const R = ["warn", "error"], A = 200, U = 500, N = 1e3, u = "[redacted]", T = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3
- function C(t) {
4
- return String(t).replace(
1
+ import { pagePattern as _ } from "./page-context.js";
2
+ const L = ["warn", "error"], T = 200, O = 500, U = 1e3, u = "[redacted]", N = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3
+ function v(e) {
4
+ return String(e).replace(
5
5
  /([\w.-]*(?:token|secret|password|passwd|api[_-]?key|authorization|cookie)[\w.-]*)(["']?\s*[:=]\s*["']?)((?:(?:bearer|basic)\s+)?[^\s"'&,;}\])]+)/gi,
6
- (e, n, o, i) => i === u ? e : `${n}${o}${u}`
6
+ (t, o, n, c) => c === u ? t : `${o}${n}${u}`
7
7
  ).replace(/\b(bearer)\s+(?!\[redacted\])[\w.~+/=-]+/gi, `$1 ${u}`).replace(
8
8
  /\bBasic\s+([A-Za-z0-9+/]{8,}={0,2})/g,
9
- (e, n) => /[0-9+/=]/.test(n) || /[A-Z]/.test(n.slice(1)) ? `Basic ${u}` : e
10
- ).replace(/\beyJ[\w-]{6,}(?:\.[\w-]*){1,2}/g, u).replace(/[A-Za-z0-9+/_=-]{32,}/g, (e) => T.test(e) ? e : /^[0-9a-f]{32,}$/i.test(e) ? u : e.includes("/") && /[a-z]{3,}\//i.test(e) ? e : /\d/.test(e) && /[a-z]/i.test(e) ? u : e);
9
+ (t, o) => /[0-9+/=]/.test(o) || /[A-Z]/.test(o.slice(1)) ? `Basic ${u}` : t
10
+ ).replace(/\beyJ[\w-]{6,}(?:\.[\w-]*){1,2}/g, u).replace(/[A-Za-z0-9+/_=-]{32,}/g, (t) => N.test(t) ? t : /^[0-9a-f]{32,}$/i.test(t) ? u : t.includes("/") && /[a-z]{3,}\//i.test(t) ? t : /\d/.test(t) && /[a-z]/i.test(t) ? u : t);
11
11
  }
12
- function M(t) {
13
- if (typeof t == "string") return t;
14
- if (t instanceof Error) return `${t.name}: ${t.message}`;
12
+ function C(e) {
13
+ if (typeof e == "string") return e;
14
+ if (e instanceof Error) return `${e.name}: ${e.message}`;
15
15
  try {
16
- return JSON.stringify(t) ?? String(t);
16
+ return JSON.stringify(e) ?? String(e);
17
17
  } catch {
18
- return String(t);
18
+ return String(e);
19
19
  }
20
20
  }
21
- function k(t, e = A) {
22
- const n = t.map(M).join(" ").slice(0, e * 8);
23
- return C(n).slice(0, e);
21
+ function M(e, t = T) {
22
+ const o = e.map(C).join(" ").slice(0, t * 8);
23
+ return v(o).slice(0, t);
24
24
  }
25
- function v(t, e = U) {
25
+ function H(e, t = O) {
26
26
  if (typeof console > "u") return () => {
27
27
  };
28
- let n = 0, o = !1;
29
- const i = {}, f = {};
30
- for (const s of R) {
28
+ let o = 0, n = !1;
29
+ const c = {}, f = {};
30
+ for (const s of L) {
31
31
  const l = console[s];
32
- i[s] = l;
32
+ c[s] = l;
33
33
  const d = (...r) => {
34
- if (l.apply(console, r), !(o || n >= e)) {
35
- o = !0;
34
+ if (l.apply(console, r), !(n || o >= t)) {
35
+ n = !0;
36
36
  try {
37
- n++, t("console", { level: s, msg: k(r) });
37
+ o++, e("console", { level: s, msg: M(r) });
38
38
  } catch {
39
39
  } finally {
40
- o = !1;
40
+ n = !1;
41
41
  }
42
42
  }
43
43
  };
44
44
  f[s] = d, console[s] = d;
45
45
  }
46
46
  return () => {
47
- for (const s of R)
48
- console[s] === f[s] && (console[s] = i[s]);
47
+ for (const s of L)
48
+ console[s] === f[s] && (console[s] = c[s]);
49
49
  };
50
50
  }
51
- function z(t, e) {
51
+ function k(e, t) {
52
52
  try {
53
- const n = e ?? (typeof window < "u" && window.location ? window.location.href : "http://localhost/"), o = new URL(t, n);
54
- if (o.protocol !== "http:" && o.protocol !== "https:") return null;
55
- const i = b(o.pathname);
56
- return o.origin === new URL(n).origin ? i : `${o.host}${i}`;
53
+ const o = t ?? (typeof window < "u" && window.location ? window.location.href : "http://localhost/"), n = new URL(e, o);
54
+ if (n.protocol !== "http:" && n.protocol !== "https:") return null;
55
+ const c = _(n.pathname);
56
+ return n.origin === new URL(o).origin ? c : `${n.host}${c}`;
57
57
  } catch {
58
58
  return null;
59
59
  }
60
60
  }
61
- function q(t, e) {
61
+ const z = [
62
+ /\/api\/presence\/(ping|online|disconnect)\/?$/,
63
+ /\/api\/job-runs\/busy\/?$/,
64
+ /\/api\/announcements\/active\/?$/,
65
+ /\/api\/realtime\/build-status\/?$/,
66
+ /\/api\/notifications\/unread-count\/?$/,
67
+ /\/api\/auth\/ws-token\/?$/,
68
+ /\/api\/analytics\/pageview(\/[^/]*)?\/?$/,
69
+ /\/api\/layout-usage\/beacon\/?$/,
70
+ /\/api\/(health|ready|version)\/?$/,
71
+ /\/version\.json$/,
72
+ /\/api\/items\/[^/]*_presence(\/[^/]*)?\/?$/
73
+ ];
74
+ function q(e, t) {
62
75
  try {
63
- const n = e ?? (typeof window < "u" && window.location ? window.location.href : "http://localhost/"), o = new URL(t, n).pathname;
64
- return /\/session-recordings(\/|$)/.test(o) || /\/rum\/?$/.test(o);
76
+ const o = t ?? (typeof window < "u" && window.location ? window.location.href : "http://localhost/"), n = new URL(e, o).pathname;
77
+ return /\/session-recordings(\/|$)/.test(n) || /\/rum\/?$/.test(n) ? !0 : z.some((c) => c.test(n));
65
78
  } catch {
66
79
  return !1;
67
80
  }
68
81
  }
69
- const $ = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
70
- function O(t) {
71
- if (typeof t == "string") return t;
72
- if (typeof URL < "u" && t instanceof URL) return t.href;
73
- const e = t == null ? void 0 : t.url;
74
- return typeof e == "string" ? e : String(t ?? "");
82
+ const S = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
83
+ function A(e) {
84
+ if (typeof e == "string") return e;
85
+ if (typeof URL < "u" && e instanceof URL) return e.href;
86
+ const t = e == null ? void 0 : e.url;
87
+ return typeof t == "string" ? t : String(e ?? "");
75
88
  }
76
- function V(t, e = N) {
77
- let n = 0, o = !1;
78
- const i = (a, c, h, S) => {
79
- if (!(o || n >= e))
89
+ function j(e, t = U) {
90
+ let o = 0, n = !1;
91
+ const c = (a, i, h, m) => {
92
+ if (!(n || o >= t))
80
93
  try {
81
- if (q(c)) return;
82
- const p = z(c);
94
+ if (q(i)) return;
95
+ const p = k(i);
83
96
  if (!p) return;
84
- n++;
85
- const m = {
97
+ o++;
98
+ const E = {
86
99
  method: String(a || "GET").toUpperCase().slice(0, 10),
87
100
  route: p,
88
101
  status: Number(h) || 0,
89
- duration_ms: Math.max(0, Math.round($() - S))
102
+ duration_ms: Math.max(0, Math.round(S() - m))
90
103
  };
91
- t("request", m);
104
+ e("request", E);
92
105
  } catch {
93
106
  }
94
107
  }, f = globalThis, s = typeof f.fetch == "function" ? f.fetch : null;
95
108
  let l = null;
96
- s && (l = function(a, c) {
97
- const h = $(), S = s.call(this ?? globalThis, a, c);
109
+ s && (l = function(a, i) {
110
+ const h = S(), m = s.call(this ?? globalThis, a, i);
98
111
  try {
99
- const p = (c == null ? void 0 : c.method) ?? (a == null ? void 0 : a.method) ?? "GET", m = O(a);
100
- S.then(
101
- (_) => i(p, m, _.status, h),
102
- () => i(p, m, 0, h)
112
+ const p = (i == null ? void 0 : i.method) ?? (a == null ? void 0 : a.method) ?? "GET", E = A(a);
113
+ m.then(
114
+ (R) => c(p, E, R.status, h),
115
+ () => c(p, E, 0, h)
103
116
  );
104
117
  } catch {
105
118
  }
106
- return S;
119
+ return m;
107
120
  }, f.fetch = l);
108
- const d = f.XMLHttpRequest, r = d == null ? void 0 : d.prototype, g = r == null ? void 0 : r.open, w = r == null ? void 0 : r.send, L = /* @__PURE__ */ new WeakMap();
109
- let y = null, E = null;
110
- return r && g && w && (y = function(a, c) {
121
+ const d = f.XMLHttpRequest, r = d == null ? void 0 : d.prototype, g = r == null ? void 0 : r.open, w = r == null ? void 0 : r.send, b = /* @__PURE__ */ new WeakMap();
122
+ let y = null, $ = null;
123
+ return r && g && w && (y = function(a, i) {
111
124
  try {
112
- L.set(this, { method: a, url: O(c) });
125
+ b.set(this, { method: a, url: A(i) });
113
126
  } catch {
114
127
  }
115
128
  return g.apply(this, arguments);
116
- }, E = function(a) {
117
- const c = L.get(this);
118
- if (c) {
119
- const h = $();
129
+ }, $ = function(a) {
130
+ const i = b.get(this);
131
+ if (i) {
132
+ const h = S();
120
133
  try {
121
- this.addEventListener("loadend", () => i(c.method, c.url, this.status, h), {
134
+ this.addEventListener("loadend", () => c(i.method, i.url, this.status, h), {
122
135
  once: !0
123
136
  });
124
137
  } catch {
125
138
  }
126
139
  }
127
140
  return w.call(this, a);
128
- }, r.open = y, r.send = E), () => {
129
- o = !0, l && f.fetch === l && s && (f.fetch = s), r && (y && r.open === y && g && (r.open = g), E && r.send === E && w && (r.send = w));
141
+ }, r.open = y, r.send = $), () => {
142
+ n = !0, l && f.fetch === l && s && (f.fetch = s), r && (y && r.open === y && g && (r.open = g), $ && r.send === $ && w && (r.send = w));
130
143
  };
131
144
  }
132
145
  export {
133
- R as CONSOLE_LEVELS,
134
- A as CONSOLE_MAX_CHARS,
135
- U as CONSOLE_MAX_EVENTS,
146
+ L as CONSOLE_LEVELS,
147
+ T as CONSOLE_MAX_CHARS,
148
+ O as CONSOLE_MAX_EVENTS,
136
149
  u as REDACTED,
137
- N as REQUEST_MAX_EVENTS,
138
- k as consoleLine,
139
- v as instrumentConsole,
140
- V as instrumentRequests,
150
+ U as REQUEST_MAX_EVENTS,
151
+ M as consoleLine,
152
+ H as instrumentConsole,
153
+ j as instrumentRequests,
141
154
  q as isRecorderNoise,
142
- C as redactSecrets,
143
- z as requestRoute
155
+ v as redactSecrets,
156
+ k as requestRoute
144
157
  };
@@ -0,0 +1,21 @@
1
+ import { isReplayInputEvent as p } from "./replay-checkout.js";
2
+ const u = 5 * 6e4, l = 30 * 6e4, A = 15e3, a = 2, c = 4;
3
+ function I(i = Date.now()) {
4
+ return { lastInputAt: i, pausedAt: 0, awaitingSince: 0, idleMs: 0 };
5
+ }
6
+ function f(i, e, n = Date.now()) {
7
+ const t = p(e);
8
+ if (i.awaitingSince) {
9
+ t && (i.lastInputAt = n);
10
+ const r = e == null ? void 0 : e.type;
11
+ return r === a ? (i.awaitingSince = 0, "keep") : r === c ? "keep" : n - i.awaitingSince < A ? "drop" : (i.awaitingSince = 0, "keep");
12
+ }
13
+ return i.pausedAt ? t ? (i.idleMs = n - i.lastInputAt, i.pausedAt = 0, i.lastInputAt = n, i.awaitingSince = n, "resume") : "drop" : t ? (i.lastInputAt = n, "keep") : n - i.lastInputAt >= u ? (i.pausedAt = n, "drop") : "keep";
14
+ }
15
+ export {
16
+ u as REPLAY_IDLE_PAUSE_MS,
17
+ l as REPLAY_IDLE_RESTART_MS,
18
+ A as REPLAY_IDLE_RESUME_WAIT_MS,
19
+ I as createReplayIdleState,
20
+ f as noteReplayIdle
21
+ };