@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,12 +1,16 @@
1
- import { redactSecrets as S } from "./replay-context.js";
2
- const g = 800, h = 10, m = 20, A = /* @__PURE__ */ new Set([
1
+ import { redactSecrets as g } from "./replay-context.js";
2
+ const S = 800, h = 10, m = 20, A = /* @__PURE__ */ new Set([
3
3
  "nvr:ping",
4
4
  "nvr:pong",
5
5
  "time:sync",
6
6
  "chat:typing",
7
7
  "presence:update",
8
+ // Sent to every tab whenever anyone comes or goes: 77% of logged frames (production 2026-11-12).
9
+ "presence:changed",
10
+ // One frame per log line of a running job; job:update still says what changed.
11
+ "job:log",
8
12
  "catchup:cursor"
9
- ]), f = /* @__PURE__ */ new Set(), p = (n, e) => S(String(n)).replace(/\s+/g, " ").slice(0, e);
13
+ ]), f = /* @__PURE__ */ new Set(), p = (n, e) => g(String(n)).replace(/\s+/g, " ").slice(0, e);
10
14
  function _(n) {
11
15
  const e = Array.isArray(n) ? n : n == null ? [] : [n], t = [];
12
16
  for (const r of e)
@@ -39,7 +43,7 @@ function C(n, e) {
39
43
  } catch {
40
44
  }
41
45
  }
42
- function d(n, e) {
46
+ function u(n, e) {
43
47
  if (f.size !== 0)
44
48
  try {
45
49
  const t = { kind: "connection", name: n };
@@ -48,23 +52,23 @@ function d(n, e) {
48
52
  } catch {
49
53
  }
50
54
  }
51
- function O(n) {
55
+ function I(n) {
52
56
  var i;
53
57
  let e = 0;
54
58
  const t = (o, ...l) => {
55
- var a, u;
56
- if (o === "catchup:full") d("full-resync");
59
+ var a, d;
60
+ if (o === "catchup:full") u("full-resync");
57
61
  else if (o === "catchup:events") {
58
- const y = ((u = (a = l[0]) == null ? void 0 : a.events) == null ? void 0 : u.length) ?? 0;
59
- d("catch-up", `${y} missed event${y === 1 ? "" : "s"} replayed`);
62
+ const y = ((d = (a = l[0]) == null ? void 0 : a.events) == null ? void 0 : d.length) ?? 0;
63
+ u("catch-up", `${y} missed event${y === 1 ? "" : "s"} replayed`);
60
64
  } else C(o, l[0]);
61
- }, r = () => d(e++ > 0 ? "reconnected" : "connected"), c = (o) => d("disconnected", o), s = (o) => d("error", o == null ? void 0 : o.message);
65
+ }, r = () => u(e++ > 0 ? "reconnected" : "connected"), c = (o) => u("disconnected", o), s = (o) => u("error", o == null ? void 0 : o.message);
62
66
  return (i = n.onAny) == null || i.call(n, t), n.on("connect", r), n.on("disconnect", c), n.on("connect_error", s), () => {
63
- var o, l, a, u;
64
- (o = n.offAny) == null || o.call(n, t), (l = n.off) == null || l.call(n, "connect", r), (a = n.off) == null || a.call(n, "disconnect", c), (u = n.off) == null || u.call(n, "connect_error", s);
67
+ var o, l, a, d;
68
+ (o = n.offAny) == null || o.call(n, t), (l = n.off) == null || l.call(n, "connect", r), (a = n.off) == null || a.call(n, "disconnect", c), (d = n.off) == null || d.call(n, "connect_error", s);
65
69
  };
66
70
  }
67
- function T(n, e = g) {
71
+ function O(n, e = S) {
68
72
  let t = 0, r = !1;
69
73
  const c = (s) => {
70
74
  if (!(r || t > e))
@@ -82,12 +86,12 @@ function T(n, e = g) {
82
86
  };
83
87
  }
84
88
  export {
85
- g as SOCKET_MAX_EVENTS,
89
+ S as SOCKET_MAX_EVENTS,
86
90
  m as SOCKET_MAX_FIELDS,
87
91
  h as SOCKET_MAX_IDS,
88
92
  E as describeSocketPayload,
89
- T as instrumentSocket,
90
- d as reportSocketConnection,
93
+ O as instrumentSocket,
94
+ u as reportSocketConnection,
91
95
  C as reportSocketEvent,
92
- O as tapReplaySocket
96
+ I as tapReplaySocket
93
97
  };
@@ -1,41 +1,41 @@
1
1
  import { isSignedOut as E, isSignedOutError as T, noteUnauthorized as k } from "./signed-out.js";
2
- let m = !1, v, d = (e) => e;
2
+ let m = !1, p, c = (e) => e;
3
3
  const o = [];
4
- let h = null, p = "/api", f, w = null, c = 0, g = null;
4
+ let h = null, v = "/api", f, w = null, d = 0, g = null;
5
5
  function y(e) {
6
- const t = e.tagName.toLowerCase(), n = (e.textContent ?? "").trim().slice(0, 40), r = e.getAttribute("aria-label"), i = e.getAttribute("data-testid");
7
- return `${t}${i ? `[${i}]` : ""}${r ? ` '${r}'` : n ? ` '${n}'` : ""}`;
6
+ const n = e.tagName.toLowerCase(), t = (e.textContent ?? "").trim().slice(0, 40), i = e.getAttribute("aria-label"), r = e.getAttribute("data-testid");
7
+ return `${n}${r ? `[${r}]` : ""}${i ? ` '${i}'` : t ? ` '${t}'` : ""}`;
8
8
  }
9
9
  function _(e) {
10
10
  typeof window > "u" || window.addEventListener(
11
11
  "click",
12
- (t) => {
13
- const n = t.target instanceof Element ? t.target.closest('button, a, [role="button"], input, [data-testid]') : null;
14
- n && (n === w ? (c++, c === 3 && (s({
12
+ (n) => {
13
+ const t = n.target instanceof Element ? n.target.closest('button, a, [role="button"], input, [data-testid]') : null;
14
+ t && (t === w ? (d++, d === 3 && (s({
15
15
  kind: "rage",
16
- route: `${e()} :: ${y(n)}`.slice(0, 300),
17
- duration_ms: c
18
- }), u())) : (w = n, c = 1), g && clearTimeout(g), g = setTimeout(() => {
19
- w = null, c = 0;
16
+ route: `${e()} :: ${y(t)}`.slice(0, 300),
17
+ duration_ms: d
18
+ }), u())) : (w = t, d = 1), g && clearTimeout(g), g = setTimeout(() => {
19
+ w = null, d = 0;
20
20
  }, 600));
21
21
  },
22
22
  { capture: !0, passive: !0 }
23
23
  );
24
24
  }
25
25
  const $ = 1e3, M = 1e4, b = 3;
26
- function D(e = b, t = M) {
27
- let n = [];
28
- return (r) => (n = n.filter((i) => r - i < t), n.push(r), n.length >= e ? (n = [], !0) : !1);
26
+ function D(e = b, n = M) {
27
+ let t = [];
28
+ return (i) => (t = t.filter((r) => i - r < n), t.push(i), t.length >= e ? (t = [], !0) : !1);
29
29
  }
30
30
  function A(e) {
31
31
  if (typeof window > "u" || typeof MutationObserver > "u") return;
32
- const t = D();
32
+ const n = D();
33
33
  window.addEventListener(
34
34
  "click",
35
- (n) => {
36
- const r = n.target instanceof Element ? n.target.closest('button, a[href], [role="button"]') : null;
37
- if (!r || r.disabled || r.closest(".nvr-no-record")) return;
38
- const i = window.location.href;
35
+ (t) => {
36
+ const i = t.target instanceof Element ? t.target.closest('button, a[href], [role="button"]') : null;
37
+ if (!i || i.disabled || i.closest(".nvr-no-record")) return;
38
+ const r = window.location.href;
39
39
  let l = !1;
40
40
  const a = new MutationObserver(() => {
41
41
  l = !0;
@@ -51,9 +51,9 @@ function A(e) {
51
51
  return;
52
52
  }
53
53
  setTimeout(() => {
54
- a.disconnect(), !(l || window.location.href !== i) && t(Date.now()) && (s({
54
+ a.disconnect(), !(l || window.location.href !== r) && n(Date.now()) && (s({
55
55
  kind: "dead",
56
- route: `${e()} :: ${y(r)}`.slice(0, 300),
56
+ route: `${e()} :: ${y(i)}`.slice(0, 300),
57
57
  duration_ms: b
58
58
  }), u());
59
59
  }, $);
@@ -69,20 +69,20 @@ function u() {
69
69
  }
70
70
  const e = JSON.stringify({ events: o.splice(0, o.length) });
71
71
  try {
72
- const t = f == null ? void 0 : f();
73
- !t && typeof navigator.sendBeacon == "function" && navigator.sendBeacon(`${p}/rum`, new Blob([e], { type: "application/json" })) || fetch(`${p}/rum`, {
72
+ const n = f == null ? void 0 : f();
73
+ !n && typeof navigator.sendBeacon == "function" && navigator.sendBeacon(`${v}/rum`, new Blob([e], { type: "application/json" })) || fetch(`${v}/rum`, {
74
74
  method: "POST",
75
75
  credentials: "include",
76
76
  headers: {
77
77
  "Content-Type": "application/json",
78
- ...t ? { Authorization: `Bearer ${t}` } : {}
78
+ ...n ? { Authorization: `Bearer ${n}` } : {}
79
79
  },
80
80
  body: e,
81
81
  keepalive: !0
82
- }).then(async (r) => {
83
- if (r.status !== 401) return;
84
- const i = await r.json().catch(() => null);
85
- T({ status: 401, response: i }) && k(!1);
82
+ }).then(async (i) => {
83
+ if (i.status !== 401) return;
84
+ const r = await i.json().catch(() => null);
85
+ T({ status: 401, response: r }) && k(!1);
86
86
  }).catch(() => {
87
87
  });
88
88
  } catch {
@@ -91,54 +91,59 @@ function u() {
91
91
  function s(e) {
92
92
  o.push({
93
93
  ...e,
94
- app: v,
94
+ app: p,
95
95
  vw: typeof window > "u" ? void 0 : window.innerWidth
96
96
  }), o.length >= 10 ? u() : (h && clearTimeout(h), h = setTimeout(u, 1e4));
97
97
  }
98
- const C = /^[A-Za-z0-9._:-]{1,80}$/, B = /^[0-9A-Fa-f-]{36}$/;
99
- function O(e) {
98
+ const C = /^[A-Za-z0-9._:-]{1,80}$/, L = /^[0-9A-Fa-f-]{36}$/;
99
+ function B(e) {
100
100
  if (!m || !C.test(e.key)) return;
101
- const t = e.roleId && B.test(e.roleId) ? e.roleId.toUpperCase() : void 0;
101
+ const n = e.roleId && L.test(e.roleId) ? e.roleId.toUpperCase() : void 0;
102
102
  s({
103
103
  kind: "widget",
104
104
  route: `widget:${e.key}`,
105
105
  widget: e.key,
106
- role: t,
106
+ role: n,
107
107
  fetch_ms: Math.max(0, Math.round(e.fetchMs)),
108
108
  paint_ms: Math.max(0, Math.round(e.paintMs))
109
109
  });
110
110
  }
111
- function S(e) {
112
- if (!m || typeof window > "u") return;
113
- const t = performance.now();
114
- requestAnimationFrame(() => {
111
+ function O(e) {
112
+ if (!m || typeof window > "u" || document.visibilityState === "hidden") return;
113
+ const n = performance.now();
114
+ let t = !1;
115
+ const i = () => {
116
+ document.visibilityState === "hidden" && (t = !0);
117
+ };
118
+ document.addEventListener("visibilitychange", i), requestAnimationFrame(() => {
115
119
  requestAnimationFrame(() => {
116
- const n = Math.round(performance.now() - t);
117
- s({ route: d(e), kind: "route", duration_ms: n });
120
+ if (document.removeEventListener("visibilitychange", i), t) return;
121
+ const r = Math.round(performance.now() - n);
122
+ s({ route: c(e), kind: "route", duration_ms: r });
118
123
  });
119
124
  });
120
125
  }
121
126
  function I(e) {
122
127
  if (m || typeof window > "u" || typeof performance > "u") return;
123
- m = !0, v = e == null ? void 0 : e.app, e != null && e.routePattern && (d = e.routePattern), e != null && e.apiBase && (p = e.apiBase), f = e == null ? void 0 : e.getToken, _(() => d(window.location.pathname)), A(() => d(window.location.pathname));
124
- const t = performance.getEntriesByType("navigation")[0];
125
- let n = null;
128
+ m = !0, p = e == null ? void 0 : e.app, e != null && e.routePattern && (c = e.routePattern), e != null && e.apiBase && (v = e.apiBase), f = e == null ? void 0 : e.getToken, _(() => c(window.location.pathname)), A(() => c(window.location.pathname));
129
+ const n = performance.getEntriesByType("navigation")[0];
130
+ let t = null;
126
131
  try {
127
132
  new PerformanceObserver((l) => {
128
133
  const a = l.getEntries().at(-1);
129
- (a == null ? void 0 : a.startTime) != null && (n = Math.round(a.startTime));
134
+ (a == null ? void 0 : a.startTime) != null && (t = Math.round(a.startTime));
130
135
  }).observe({ type: "largest-contentful-paint", buffered: !0 });
131
136
  } catch {
132
137
  }
133
138
  setTimeout(() => {
134
- const i = performance.getEntriesByName("first-contentful-paint")[0];
139
+ const r = performance.getEntriesByName("first-contentful-paint")[0];
135
140
  s({
136
- route: d(window.location.pathname),
141
+ route: c(window.location.pathname),
137
142
  kind: "load",
138
- ttfb_ms: t ? Math.round(t.responseStart) : void 0,
139
- fcp_ms: i ? Math.round(i.startTime) : void 0,
140
- lcp_ms: n ?? void 0,
141
- duration_ms: t ? Math.round(t.loadEventEnd || t.domContentLoadedEventEnd) : void 0
143
+ ttfb_ms: n ? Math.round(n.responseStart) : void 0,
144
+ fcp_ms: r ? Math.round(r.startTime) : void 0,
145
+ lcp_ms: t ?? void 0,
146
+ duration_ms: n ? Math.round(n.loadEventEnd || n.domContentLoadedEventEnd) : void 0
142
147
  });
143
148
  }, 6e3), window.addEventListener("pagehide", u), document.addEventListener("visibilitychange", () => {
144
149
  document.visibilityState === "hidden" && u();
@@ -149,7 +154,7 @@ export {
149
154
  $ as DEAD_WAIT_MS,
150
155
  M as DEAD_WINDOW_MS,
151
156
  D as createDeadClickCounter,
152
- S as rumRouteChange,
153
- O as rumWidget,
157
+ O as rumRouteChange,
158
+ B as rumWidget,
154
159
  I as startRum
155
160
  };
@@ -1,4 +1,4 @@
1
- import { reportClientCrash as T } from "./client-crash.js";
1
+ import { reportClientCrash as y } from "./client-crash.js";
2
2
  const d = "Something went wrong — it’s been reported", m = /failed to fetch|load failed|networkerror|network request failed|network error/i;
3
3
  function h(e) {
4
4
  var r;
@@ -9,7 +9,7 @@ function w(e) {
9
9
  return !(e instanceof Error) || h(e) != null || e.response != null || m.test(e.message) ? !1 : e instanceof TypeError || e instanceof ReferenceError || e instanceof RangeError;
10
10
  }
11
11
  const g = /^(bad request|unauthorized|forbidden|not found|conflict|unprocessable entity|too many requests|internal server error|bad gateway|service unavailable|gateway timeout)$/i;
12
- function y(e) {
12
+ function T(e) {
13
13
  var r;
14
14
  const t = e, o = [(r = t == null ? void 0 : t.response) == null ? void 0 : r.data, t == null ? void 0 : t.response];
15
15
  for (const n of o) {
@@ -22,14 +22,17 @@ function y(e) {
22
22
  }
23
23
  return null;
24
24
  }
25
- function A(e, t = "Failed") {
26
- const o = h(e), r = y(e);
27
- if (r && !c(r) && !S(e, o)) return r;
25
+ function A(e) {
26
+ return T(e);
27
+ }
28
+ function O(e, t = "Failed") {
29
+ const o = h(e), r = T(e);
30
+ if (r && !c(r) && !v(e, o)) return r;
28
31
  if (w(e)) return d;
29
32
  const n = e instanceof Error ? e.message : typeof e == "string" ? e : "";
30
33
  return !o && m.test(n) ? "Cannot reach the server" : n.trim() && !c(n) ? n.trim() : n.trim() ? C(n, t || d, o) : r ? f(o) ?? (t || d) : t;
31
34
  }
32
- function S(e, t) {
35
+ function v(e, t) {
33
36
  if (t !== 500) return !1;
34
37
  const o = e, r = o == null ? void 0 : o.response, n = r && typeof r.data == "object" && r.data ? r.data : r;
35
38
  return !!n && typeof n.statusCode == "number" && typeof n.code != "string";
@@ -53,7 +56,7 @@ const E = {
53
56
  function f(e) {
54
57
  return e == null ? null : E[e] ?? (e >= 500 ? E[500] : e >= 400 ? E[400] : null);
55
58
  }
56
- function v(e) {
59
+ function S(e) {
57
60
  if (typeof e != "string") return !1;
58
61
  const t = e.trim();
59
62
  return /^request failed with status( code)? \d{3}$/i.test(t) || // apiFetch-style "Request failed (500)", the SDK's "HTTP 500", "Error 404", "500 Internal Server Error"
@@ -120,7 +123,7 @@ const R = [
120
123
  function c(e) {
121
124
  if (typeof e != "string") return e != null;
122
125
  const t = e.trim();
123
- return t ? v(t) ? !0 : R.some((o) => o.test(t)) : !1;
126
+ return t ? S(t) ? !0 : R.some((o) => o.test(t)) : !1;
124
127
  }
125
128
  const N = /\s+[—–-]\s+|:\s+|\.\s+/;
126
129
  function C(e, t = d, o) {
@@ -146,20 +149,21 @@ function C(e, t = d, o) {
146
149
  return f(o ?? b(r)) ?? t;
147
150
  }
148
151
  const p = /* @__PURE__ */ new WeakSet();
149
- function O(e, t) {
150
- !e || !w(t) || p.has(t) || (p.add(t), T(e, t, null).catch(() => {
152
+ function k(e, t) {
153
+ !e || !w(t) || p.has(t) || (p.add(t), y(e, t, null).catch(() => {
151
154
  }));
152
155
  }
153
156
  export {
154
157
  d as SOMETHING_WENT_WRONG,
155
158
  E as STATUS_TITLES,
156
159
  h as errorStatusOf,
157
- v as isBareStatusText,
160
+ S as isBareStatusText,
158
161
  w as isCodeError,
159
162
  c as isRawErrorText,
160
163
  C as plainErrorText,
161
- O as reportCodeError,
164
+ k as reportCodeError,
165
+ A as serverErrorText,
162
166
  b as statusInText,
163
167
  f as statusTitle,
164
- A as userErrorMessage
168
+ O as userErrorMessage
165
169
  };
@@ -1,5 +1,5 @@
1
- const l = "nvr-stale-chunk-reload";
2
- const d = [
1
+ import { unsavedWorkLabels as S } from "./unsaved-work.js";
2
+ const c = "nvr-stale-chunk-reload", m = 6e4, w = [
3
3
  /Failed to fetch dynamically imported module/i,
4
4
  // Chromium
5
5
  /Importing a module script failed/i,
@@ -9,44 +9,85 @@ const d = [
9
9
  /Unable to preload CSS/i
10
10
  // Vite's CSS preload
11
11
  ];
12
- function c(e) {
12
+ function v(e) {
13
13
  const n = e instanceof Error ? e.message : typeof e == "string" ? e : e && typeof e == "object" && "message" in e ? String(e.message) : "";
14
- return d.some((t) => t.test(n));
14
+ return w.some((t) => t.test(n));
15
15
  }
16
- function u(e = {}) {
17
- var o;
18
- const n = (e.now ?? Date.now)(), t = e.storage === void 0 ? s() : e.storage;
19
- let r = 0;
16
+ function y(e = {}) {
17
+ var l, i;
18
+ let n = [];
20
19
  try {
21
- r = Number(t == null ? void 0 : t.getItem(l)) || 0;
20
+ n = (e.unsaved ?? S)();
22
21
  } catch {
23
- r = 0;
22
+ n = [];
24
23
  }
25
- if (r && n - r < 6e4)
26
- return (o = e.onGiveUp) == null || o.call(e), "gave-up";
24
+ if (n.length > 0)
25
+ return e.onHeld ? e.onHeld(n) : (l = e.onGiveUp) == null || l.call(e), "held";
26
+ const t = (e.now ?? Date.now)(), r = e.storage === void 0 ? h() : e.storage;
27
+ let o = 0;
27
28
  try {
28
- t == null || t.setItem(l, String(n));
29
+ o = Number(r == null ? void 0 : r.getItem(c)) || 0;
30
+ } catch {
31
+ o = 0;
32
+ }
33
+ if (o && t - o < m)
34
+ return (i = e.onGiveUp) == null || i.call(e), "gave-up";
35
+ try {
36
+ r == null || r.setItem(c, String(t));
29
37
  } catch {
30
38
  }
31
39
  return (e.reload ?? (() => window.location.reload()))(), "reload";
32
40
  }
33
- function f(e = {}) {
41
+ function C(e = {}) {
42
+ const n = e.storage === void 0 ? h() : e.storage;
43
+ try {
44
+ const t = Number(n == null ? void 0 : n.getItem(c)) || 0;
45
+ return t > 0 && (e.now ?? Date.now)() - t < m;
46
+ } catch {
47
+ return !1;
48
+ }
49
+ }
50
+ const E = 2e3, g = 1e4;
51
+ function d(e) {
52
+ let n = null;
53
+ return () => {
54
+ const t = (e.now ?? Date.now)(), r = (n == null ? void 0 : n.outcome) === "reload" ? g : E;
55
+ if (n && t - n.at < r) return n.outcome;
56
+ const o = y(e);
57
+ return n = { outcome: o, at: t }, o;
58
+ };
59
+ }
60
+ let u = null, f = null;
61
+ function R(e = {}) {
34
62
  const n = e.target ?? (typeof window < "u" ? window : void 0);
35
63
  if (!n) return () => {
36
64
  };
37
- let t = !1;
65
+ const t = d(e);
66
+ u = t;
38
67
  const r = () => {
39
- t || (t = !0, u(e) === "gave-up" && (t = !1));
40
- }, o = (i) => {
41
- i.preventDefault(), r();
42
- }, a = (i) => {
43
- c(i.reason) && (i.preventDefault(), r());
68
+ t();
69
+ }, o = (l) => {
70
+ v(l.reason) && (l.preventDefault(), t());
44
71
  };
45
- return n.addEventListener("vite:preloadError", o), n.addEventListener("unhandledrejection", a), () => {
46
- n.removeEventListener("vite:preloadError", o), n.removeEventListener("unhandledrejection", a);
72
+ return n.addEventListener("vite:preloadError", r), n.addEventListener("unhandledrejection", o), () => {
73
+ n.removeEventListener("vite:preloadError", r), n.removeEventListener("unhandledrejection", o), u === t && (u = null);
47
74
  };
48
75
  }
49
- function s() {
76
+ function D(e, n, t) {
77
+ const r = t ? d(t) : null, o = () => (f ?? (f = d({})), (r ?? u ?? f)() !== "reload" ? Promise.resolve({ default: n }) : new Promise((i) => {
78
+ var s;
79
+ const a = setTimeout(() => i({ default: n }), g);
80
+ (s = a.unref) == null || s.call(a);
81
+ }));
82
+ return () => e().then(
83
+ (l) => l && l.default !== void 0 ? l : o(),
84
+ (l) => {
85
+ if (!v(l)) throw l;
86
+ return o();
87
+ }
88
+ );
89
+ }
90
+ function h() {
50
91
  try {
51
92
  return typeof sessionStorage < "u" ? sessionStorage : null;
52
93
  } catch {
@@ -54,7 +95,9 @@ function s() {
54
95
  }
55
96
  }
56
97
  export {
57
- f as installStaleChunkRecovery,
58
- c as isStaleChunkError,
59
- u as recoverFromStaleChunk
98
+ D as guardLazyImport,
99
+ R as installStaleChunkRecovery,
100
+ v as isStaleChunkError,
101
+ y as recoverFromStaleChunk,
102
+ C as staleChunkReloadJustTried
60
103
  };
@@ -0,0 +1,20 @@
1
+ const r = /^(nivaro_|directus_)/i;
2
+ function t(e) {
3
+ return !!e && r.test(e);
4
+ }
5
+ function i(e) {
6
+ return !t(e);
7
+ }
8
+ function o(e) {
9
+ return !t(e) || String(e).toLowerCase() === "nivaro_addendums";
10
+ }
11
+ function s(e) {
12
+ const n = String(e ?? "").toLowerCase();
13
+ return n === "nivaro_files" || n === "directus_files";
14
+ }
15
+ export {
16
+ i as hasRecordExtras,
17
+ s as isFileCollection,
18
+ t as isSystemCollection,
19
+ o as mayHavePipeline
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.99",
3
+ "version": "0.3.101",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",