@nivaro/react 0.3.10 → 0.3.12

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/full.css +1 -1
  2. package/dist/hooks/useNivaroForm.js +1 -1
  3. package/dist/hooks/useSessionRecorder.js +109 -102
  4. package/dist/index.d.ts +34 -3
  5. package/dist/shared/components/CollectionBrowserView.js +1546 -1477
  6. package/dist/shared/components/ItemEditForm.js +4332 -4195
  7. package/dist/shared/components/PageRenderer.js +512 -465
  8. package/dist/shared/components/ProfileView.js +115 -109
  9. package/dist/shared/components/QueryStatStrip.js +74 -70
  10. package/dist/shared/components/ReportView.js +818 -827
  11. package/dist/shared/components/SheetHeaderBody.js +16 -14
  12. package/dist/shared/components/chat/ChatPanel.js +492 -472
  13. package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
  14. package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
  15. package/dist/shared/components/item-edit/FieldRow.js +20 -19
  16. package/dist/shared/components/item-edit/FilePickerField.js +52 -40
  17. package/dist/shared/components/item-edit/GroupSection.js +221 -221
  18. package/dist/shared/components/item-edit/InlineGridField.js +41 -41
  19. package/dist/shared/components/item-edit/InlineTableField.js +2249 -2238
  20. package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
  21. package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
  22. package/dist/shared/components/item-edit/QuickPicker.js +263 -216
  23. package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
  24. package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
  25. package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
  26. package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
  27. package/dist/shared/components/item-edit/UserChip.js +301 -233
  28. package/dist/shared/components/item-edit/helpers.js +133 -134
  29. package/dist/shared/components/item-edit/line-qty.js +57 -0
  30. package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
  31. package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
  32. package/dist/shared/components/panels/CommentPanel.js +350 -315
  33. package/dist/shared/components/panels/ItemLockBanner.js +297 -230
  34. package/dist/shared/components/panels/PipelinePanel.js +719 -701
  35. package/dist/shared/components/profile/PersonAdminTools.js +168 -144
  36. package/dist/shared/components/profile/PersonProfile.js +42 -41
  37. package/dist/shared/components/profile/session-actions.js +52 -0
  38. package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
  39. package/dist/shared/components/queue/QueueWorklist.js +1005 -935
  40. package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
  41. package/dist/shared/lib/obligation-banner.js +14 -13
  42. package/dist/shared/lib/obligation-reason-text.js +13 -0
  43. package/dist/shared/lib/query-filter-seed.js +34 -11
  44. package/dist/shared/lib/replay-checkout.js +20 -0
  45. package/dist/shared/lib/sanitize-html.js +24 -15
  46. package/dist/shared/lib/sheet-def.js +38 -22
  47. package/dist/shared/lib/unique-options.js +10 -0
  48. package/dist/shared/lib/utils.js +57 -43
  49. package/dist/shared/lib/validation-rules.js +58 -34
  50. package/package.json +1 -1
@@ -197,7 +197,7 @@ function ke(r, c, l) {
197
197
  e.required && ye(s) && (t[e.field] == null && (t[e.field] = []), t[e.field].push(`${e.label} is required`));
198
198
  for (const i of e.validationRules ?? []) {
199
199
  if (i.soft) continue;
200
- const m = pe(i, s, e.label);
200
+ const m = pe(i, s, e.label, f);
201
201
  m && (t[e.field] == null && (t[e.field] = []), t[e.field].push(m));
202
202
  }
203
203
  const n = F == null ? void 0 : F[e.field];
@@ -1,15 +1,16 @@
1
- import { endSessionRecording as $, appendSessionRecordingEvents as X, sessionRecordingEnabled as ce, startSessionRecording as T } from "@nivaro/sdk";
1
+ import { endSessionRecording as $, appendSessionRecordingEvents as X, sessionRecordingEnabled as ce, startSessionRecording as L } from "@nivaro/sdk";
2
2
  import { useRef as de, useEffect as fe } from "react";
3
- import { sessionStore as pe, sharedChunkStore as he, ReplayUploader as me, clearResume as P, ORPHAN_TTL_MS as we, readResume as ge, isResumable as ve, splitBySize as Z, writeResume as ye, KEEPALIVE_CHUNK_BYTES as be, CHUNK_BYTES as Re, backoffDelay as Se, errorStatus as ke, clipChunkFailure as Ee } from "./replayUploadQueue.js";
4
- import { useAutoRecord as Ae } from "./useAutoRecord.js";
5
- import { useOptionalNivaroClient as Ce } from "../shared/context.js";
3
+ import { sessionStore as pe, sharedChunkStore as he, ReplayUploader as me, clearResume as P, ORPHAN_TTL_MS as we, readResume as ye, isResumable as ge, splitBySize as Z, writeResume as ve, KEEPALIVE_CHUNK_BYTES as be, CHUNK_BYTES as Re, backoffDelay as Se, errorStatus as ke, clipChunkFailure as Ce } from "./replayUploadQueue.js";
4
+ import { useAutoRecord as Ee } from "./useAutoRecord.js";
5
+ import { useOptionalNivaroClient as Ae } from "../shared/context.js";
6
6
  import { normalizeReplayMasking as B, buildReplayMaskingOptions as z } from "../shared/lib/replay-masking.js";
7
- import { normalizeReplaySampling as x, replaySampleDraw as Ie, currentReplayRoute as _, isReplayRouteSampled as Y, attributeChunkRoutes as ee } from "../shared/lib/replay-sampling.js";
8
- import { emitReplayTap as _e, setReplayRecorderMode as N, registerReplayCapture as De, clipEndOffset as qe, withClipKind as Le } from "../shared/lib/replay-capture.js";
9
- import { instrumentConsole as Te, instrumentRequests as Pe, redactSecrets as Ne } from "../shared/lib/replay-context.js";
10
- import { instrumentSocket as Me } from "../shared/lib/replay-socket.js";
11
- const Oe = "nivaro-react@0.3.10", j = 1e4, Ue = 150, We = 3e3, Fe = 600, He = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
12
- function Ke(n) {
7
+ import { normalizeReplaySampling as x, replaySampleDraw as Ie, currentReplayRoute as D, isReplayRouteSampled as Y, attributeChunkRoutes as ee } from "../shared/lib/replay-sampling.js";
8
+ import { noteReplayEvent as _e, createReplayCheckoutState as De } from "../shared/lib/replay-checkout.js";
9
+ import { emitReplayTap as Te, setReplayRecorderMode as N, registerReplayCapture as qe, clipEndOffset as Le, withClipKind as Pe } from "../shared/lib/replay-capture.js";
10
+ import { instrumentConsole as Ne, instrumentRequests as Fe, redactSecrets as Me } from "../shared/lib/replay-context.js";
11
+ import { instrumentSocket as Oe } from "../shared/lib/replay-socket.js";
12
+ const Ue = "nivaro-react@0.3.12", j = 1e4, We = 150, He = 3e3, Ke = 600, $e = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
13
+ function Be(n) {
13
14
  return typeof n.url != "string" || typeof fetch != "function" ? null : (f, a) => {
14
15
  const u = typeof n.getToken == "function" ? n.getToken() : void 0, d = { "Content-Type": "application/json" };
15
16
  return u && (d.Authorization = `Bearer ${u}`), fetch(`${n.url}/api/session-recordings/${f}/events`, {
@@ -21,32 +22,32 @@ function Ke(n) {
21
22
  });
22
23
  };
23
24
  }
24
- async function $e(n, f, a, u, d) {
25
- const l = Z(u), { routes: b } = ee(l, d.startRoute);
25
+ async function ze(n, f, a, u, d) {
26
+ const l = Z(u), { routes: R } = ee(l, d.startRoute);
26
27
  for (const [c, e] of l.entries()) {
27
28
  const g = a();
28
29
  try {
29
30
  await n.request(
30
31
  X(f, g, e, {
31
- route: b[c],
32
+ route: R[c],
32
33
  ...d.build ? { build: d.build } : {}
33
34
  })
34
35
  );
35
36
  } catch (v) {
36
- const y = ke(v);
37
- if (Ee(y) === "stop") return "closed";
38
- y === 413 && console.warn(`[session-recorder] chunk ${g} too large — dropped`);
37
+ const b = ke(v);
38
+ if (Ce(b) === "stop") return "closed";
39
+ b === 413 && console.warn(`[session-recorder] chunk ${g} too large — dropped`);
39
40
  }
40
41
  }
41
42
  return "ok";
42
43
  }
43
- const Be = 3e4, ze = 3e4;
44
- let J = !1, w = null, S = null;
45
- async function xe(n = "error") {
46
- if (!S) return null;
44
+ const xe = 3e4, Ye = 3e4;
45
+ let J = !1, y = null, k = null;
46
+ async function je(n = "error") {
47
+ if (!k) return null;
47
48
  try {
48
49
  return await Promise.race([
49
- S(n),
50
+ k(n),
50
51
  new Promise((f) => setTimeout(() => f(null), 4e3))
51
52
  ]);
52
53
  } catch {
@@ -63,27 +64,27 @@ async function Q() {
63
64
  }
64
65
  }
65
66
  function V(n, f) {
66
- const a = Te(n), u = Pe(n), d = Me(n), l = () => {
67
+ const a = Ne(n), u = Fe(n), d = Oe(n), l = () => {
67
68
  f == null || f();
68
69
  try {
69
70
  n("route", {
70
- path: Ne(window.location.pathname + window.location.search)
71
+ path: Me(window.location.pathname + window.location.search)
71
72
  });
72
73
  } catch {
73
74
  }
74
- }, b = history.pushState.bind(history), c = history.replaceState.bind(history);
75
+ }, R = history.pushState.bind(history), c = history.replaceState.bind(history);
75
76
  return history.pushState = (...e) => {
76
- b(...e), l();
77
+ R(...e), l();
77
78
  }, history.replaceState = (...e) => {
78
79
  c(...e), l();
79
80
  }, window.addEventListener("popstate", l), l(), () => {
80
- a(), u(), d(), history.pushState = b, history.replaceState = c, window.removeEventListener("popstate", l);
81
+ a(), u(), d(), history.pushState = R, history.replaceState = c, window.removeEventListener("popstate", l);
81
82
  };
82
83
  }
83
- function nt(n = {}) {
84
- const f = Ce(), a = n.client ?? f, u = n.app, d = n.disabled ?? !1, l = n.build ?? Oe;
85
- Ae({ client: a, disabled: d });
86
- const b = de({
84
+ function st(n = {}) {
85
+ const f = Ae(), a = n.client ?? f, u = n.app, d = n.disabled ?? !1, l = n.build ?? Ue;
86
+ Ee({ client: a, disabled: d });
87
+ const R = de({
87
88
  buffer: [],
88
89
  stop: null,
89
90
  uninstrument: null,
@@ -102,94 +103,94 @@ function nt(n = {}) {
102
103
  fe(() => {
103
104
  if (!a || d || typeof window > "u") return;
104
105
  let c = !1;
105
- const e = b.current;
106
+ const e = R.current;
106
107
  e.dead = !1;
107
- const g = a, v = pe(), y = He(u), k = he(), E = Ke(g), te = async (t, r, i, h, s = {}) => {
108
+ const g = a, v = pe(), b = $e(u), C = he(), E = Be(g), te = async (t, r, i, h, w = {}) => {
108
109
  if (!h || !E) {
109
- await g.request(X(t, r, i, s));
110
+ await g.request(X(t, r, i, w));
110
111
  return;
111
112
  }
112
- const p = await E(t, JSON.stringify({ seq: r, events: i, ...s }));
113
- if (!p.ok) throw Object.assign(new Error(`HTTP ${p.status}`), { status: p.status });
114
- }, o = new me({ store: k, send: te, online: G });
115
- let R = null, A = 0;
116
- const re = () => document.readyState === "complete" && Date.now() - e.lastNavAt >= We;
117
- function C() {
118
- o.recordingId && ye(v, y, {
113
+ const s = await E(t, JSON.stringify({ seq: r, events: i, ...w }));
114
+ if (!s.ok) throw Object.assign(new Error(`HTTP ${s.status}`), { status: s.status });
115
+ }, o = new me({ store: C, send: te, online: G });
116
+ let S = null, A = 0;
117
+ const re = () => document.readyState === "complete" && Date.now() - e.lastNavAt >= He;
118
+ function I() {
119
+ o.recordingId && ve(v, b, {
119
120
  recordingId: o.recordingId,
120
121
  nextSeq: o.nextSeq,
121
122
  startedAt: e.startedAt,
122
123
  lastActivityAt: Date.now()
123
124
  });
124
125
  }
125
- function I() {
126
- R && clearTimeout(R), R = null, A = 0;
126
+ function _() {
127
+ S && clearTimeout(S), S = null, A = 0;
127
128
  }
128
129
  function ne() {
129
- I();
130
+ _();
130
131
  const t = Se(o.attempt);
131
- A = Date.now() + t, R = setTimeout(() => {
132
- R = null, A = 0, m(!0);
132
+ A = Date.now() + t, S = setTimeout(() => {
133
+ S = null, A = 0, m(!0);
133
134
  }, t);
134
135
  }
135
- function M() {
136
+ function F() {
136
137
  var t;
137
- e.dead = !0, (t = e.stop) == null || t.call(e), e.stop = null, e.buffer = [], I(), o.discard(), o.stopped = !0, P(v, y);
138
+ e.dead = !0, (t = e.stop) == null || t.call(e), e.stop = null, e.buffer = [], _(), o.discard(), o.stopped = !0, P(v, b);
138
139
  }
139
- function O(t) {
140
+ function M(t) {
140
141
  if (e.buffer.length === 0 || !o.recordingId) return;
141
142
  const r = e.buffer;
142
143
  e.buffer = [];
143
144
  const i = Z(r, t ? be : Re), { routes: h } = ee(i, e.bufferRoute);
144
- for (const [s, p] of i.entries())
145
- o.enqueue(p, { route: h[s], ...l ? { build: l } : {} });
146
- C();
145
+ for (const [w, s] of i.entries())
146
+ o.enqueue(s, { route: h[w], ...l ? { build: l } : {} });
147
+ I();
147
148
  }
148
149
  async function oe(t) {
149
150
  if (!c) {
150
151
  if (t === "retry") ne();
151
- else if (t === "closed" || t === "abandoned") M();
152
+ else if (t === "closed" || t === "abandoned") F();
152
153
  else if (t === "stale")
153
154
  try {
154
- const r = await g.request(T(u));
155
+ const r = await g.request(L(u));
155
156
  if (c) return;
156
- o.rebase(r.data.id), e.startedAt = Date.now(), C(), e.flushAfter = !0;
157
+ o.rebase(r.data.id), e.startedAt = Date.now(), I(), e.flushAfter = !0;
157
158
  } catch {
158
- M();
159
+ F();
159
160
  }
160
161
  }
161
162
  }
162
163
  function m(t = !1, r = !1) {
163
- return e.inFlight ? (t && (e.flushAfter = !0), e.inFlight) : e.dead || !o.recordingId || !t && !re() && e.buffer.length < Fe || (O(r), !o.hasPending() || Date.now() < A) ? Promise.resolve() : (e.inFlight = o.drain(r).then(oe).catch(() => {
164
+ return e.inFlight ? (t && (e.flushAfter = !0), e.inFlight) : e.dead || !o.recordingId || !t && !re() && e.buffer.length < Ke || (M(r), !o.hasPending() || Date.now() < A) ? Promise.resolve() : (e.inFlight = o.drain(r).then(oe).catch(() => {
164
165
  }).finally(() => {
165
166
  e.inFlight = null, e.flushAfter && (e.flushAfter = !1, m(!0));
166
167
  }), e.inFlight);
167
168
  }
168
- function U() {
169
+ function O() {
169
170
  const t = window.requestIdleCallback;
170
171
  t ? t(() => void m(), { timeout: j }) : m();
171
172
  }
172
173
  async function ie() {
173
174
  const t = await Q();
174
175
  if (c || !t) return;
175
- k.prune(Date.now() - we);
176
- const r = ge(v, y);
177
- if (r && ve(r, Date.now())) {
178
- const s = await k.list(r.recordingId);
176
+ C.prune(Date.now() - we);
177
+ const r = ye(v, b);
178
+ if (r && ge(r, Date.now())) {
179
+ const s = await C.list(r.recordingId);
179
180
  if (c) return;
180
181
  o.begin(r.recordingId, r.nextSeq, { trusted: !1, restored: s }), e.startedAt = r.startedAt;
181
182
  } else {
182
- r && (k.clear(r.recordingId), P(v, y));
183
- const s = await g.request(T(u));
183
+ r && (C.clear(r.recordingId), P(v, b));
184
+ const s = await g.request(L(u));
184
185
  if (c) return;
185
186
  o.begin(s.data.id), e.startedAt = Date.now();
186
187
  }
187
- C(), e.lastNavAt = Date.now();
188
+ I(), e.lastNavAt = Date.now();
188
189
  const i = Ie(v);
189
- e.route = _(), e.bufferRoute = e.route, e.sampled = Y(q, e.route, i);
190
+ e.route = D(), e.bufferRoute = e.route, e.sampled = Y(q, e.route, i);
190
191
  const h = () => {
191
192
  var p;
192
- e.route = _();
193
+ e.route = D();
193
194
  const s = e.sampled;
194
195
  if (e.sampled = Y(q, e.route, i), e.sampled && !s)
195
196
  try {
@@ -199,13 +200,19 @@ function nt(n = {}) {
199
200
  );
200
201
  } catch {
201
202
  }
202
- };
203
+ }, w = De();
203
204
  e.stop = t({
204
205
  emit(s) {
205
- e.sampled && (e.buffer.length === 0 && (e.bufferRoute = e.route), e.buffer.push(s), e.buffer.length >= Ue && U());
206
+ e.sampled && (e.buffer.length === 0 && (e.bufferRoute = e.route), e.buffer.push(s), e.buffer.length >= We && O(), _e(w, s) && setTimeout(() => {
207
+ var p;
208
+ try {
209
+ (p = t.takeFullSnapshot) == null || p.call(t, !0);
210
+ } catch {
211
+ w.pending = !1;
212
+ }
213
+ }, 0));
206
214
  },
207
- ...z(() => D),
208
- checkoutEveryNms: 6e4
215
+ ...z(() => T)
209
216
  }) ?? null, e.uninstrument = V(
210
217
  (s, p) => t.addCustomEvent(
211
218
  s,
@@ -214,12 +221,12 @@ function nt(n = {}) {
214
221
  () => {
215
222
  e.lastNavAt = Date.now(), h();
216
223
  }
217
- ), S = async () => {
224
+ ), k = async () => {
218
225
  if (!o.recordingId) return null;
219
226
  const s = Date.now() - e.startedAt;
220
227
  return await m(!0).catch(() => {
221
228
  }), o.recordingId ? { recording_id: o.recordingId, offset_ms: s } : null;
222
- }, N("full"), w = () => {
229
+ }, N("full"), y = () => {
223
230
  if (!o.recordingId) return null;
224
231
  const s = Date.now() - e.startedAt;
225
232
  return async () => (await m(!0).catch(() => {
@@ -228,67 +235,67 @@ function nt(n = {}) {
228
235
  }
229
236
  async function se() {
230
237
  const t = await Q();
231
- c || !t || (e.buffer = [], e.prevWindow = [], e.route = _(), e.bufferRoute = e.route, e.prevWindowRoute = e.route, e.stop = t({
238
+ c || !t || (e.buffer = [], e.prevWindow = [], e.route = D(), e.bufferRoute = e.route, e.prevWindowRoute = e.route, e.stop = t({
232
239
  emit(r, i) {
233
- _e(r), i ? (e.prevWindow = e.buffer, e.prevWindowRoute = e.bufferRoute, e.buffer = [r], e.bufferRoute = e.route) : e.buffer.push(r);
240
+ Te(r), i ? (e.prevWindow = e.buffer, e.prevWindowRoute = e.bufferRoute, e.buffer = [r], e.bufferRoute = e.route) : e.buffer.push(r);
234
241
  },
235
- ...z(() => D),
236
- checkoutEveryNms: Be
242
+ ...z(() => T),
243
+ checkoutEveryNms: xe
237
244
  }) ?? null, e.uninstrument = V(
238
245
  (r, i) => t.addCustomEvent(
239
246
  r,
240
247
  i
241
248
  ),
242
249
  () => {
243
- e.route = _();
250
+ e.route = D();
244
251
  }
245
- ), N("clip"), w = (r) => {
252
+ ), N("clip"), y = (r) => {
246
253
  const i = [...e.prevWindow, ...e.buffer], h = e.prevWindow.length > 0 ? e.prevWindowRoute : e.bufferRoute;
247
254
  if (i.length === 0 || !a) return null;
248
- const s = qe(i, r);
255
+ const w = Le(i, r);
249
256
  return async () => {
250
- const L = (await a.request(
251
- Le(T(u ?? "error-clip", void 0, !0), r)
257
+ const p = (await a.request(
258
+ Pe(L(u ?? "error-clip", void 0, !0), r)
252
259
  )).data.id;
253
260
  let le = 0;
254
- return await $e(a, L, () => le++, i, {
261
+ return await ze(a, p, () => le++, i, {
255
262
  startRoute: h,
256
263
  build: l
257
- }) === "ok" && await a.request($(L)).catch(() => {
258
- }), { recording_id: L, offset_ms: s };
264
+ }) === "ok" && await a.request($(p)).catch(() => {
265
+ }), { recording_id: p, offset_ms: w };
259
266
  };
260
- }, S = async (r) => {
267
+ }, k = async (r) => {
261
268
  if (r === "error") {
262
- if (e.lastClip && Date.now() - e.lastClip.at < ze)
269
+ if (e.lastClip && Date.now() - e.lastClip.at < Ye)
263
270
  return e.lastClip.link;
264
271
  e.lastClip = { at: Date.now(), link: null };
265
272
  }
266
- const i = w == null ? void 0 : w(r);
273
+ const i = y == null ? void 0 : y(r);
267
274
  if (!i) return null;
268
275
  const h = await i();
269
276
  return r === "error" && (e.lastClip = { at: Date.now(), link: h }), h;
270
277
  });
271
278
  }
272
- let W = !1, D = B(null), q = x(null);
279
+ let U = !1, T = B(null), q = x(null);
273
280
  async function ae() {
274
281
  try {
275
282
  const t = await a.request(ce());
276
283
  if (c) return;
277
- D = B(t.data.masking), q = x(t.data.sampling);
284
+ T = B(t.data.masking), q = x(t.data.sampling);
278
285
  const r = t.data.cap_reached === !0;
279
- W = t.data.enabled === !0 && !r;
286
+ U = t.data.enabled === !0 && !r;
280
287
  const i = t.data.enabled !== !0 && t.data.error_replay === !0 && !r;
281
- W ? await ie() : i && await se();
288
+ U ? await ie() : i && await se();
282
289
  } catch {
283
290
  }
284
291
  }
285
292
  ae();
286
- const ue = setInterval(U, j), F = () => {
293
+ const ue = setInterval(O, j), W = () => {
287
294
  document.visibilityState === "hidden" && m(!0, !0);
288
295
  };
289
- document.addEventListener("visibilitychange", F);
296
+ document.addEventListener("visibilitychange", W);
290
297
  const H = () => {
291
- if (!(e.dead || !o.recordingId) && (O(!0), C(), !(!G() || !E)))
298
+ if (!(e.dead || !o.recordingId) && (M(!0), I(), !(!G() || !E)))
292
299
  for (const { chunk: t, body: r } of o.keepaliveBatch())
293
300
  try {
294
301
  E(t.recordingId, r).catch(() => {
@@ -298,23 +305,23 @@ function nt(n = {}) {
298
305
  };
299
306
  window.addEventListener("pagehide", H);
300
307
  const K = () => {
301
- I(), m(!0);
308
+ _(), m(!0);
302
309
  };
303
310
  return window.addEventListener("online", K), () => {
304
311
  var t, r;
305
- c = !0, S = null, w = null, N(null), document.removeEventListener("visibilitychange", F), window.removeEventListener("pagehide", H), window.removeEventListener("online", K), clearInterval(ue), I(), (t = e.uninstrument) == null || t.call(e), e.uninstrument = null, (r = e.stop) == null || r.call(e), e.stop = null, e.prevWindow = [], m(!0).then(() => {
312
+ c = !0, k = null, y = null, N(null), document.removeEventListener("visibilitychange", W), window.removeEventListener("pagehide", H), window.removeEventListener("online", K), clearInterval(ue), _(), (t = e.uninstrument) == null || t.call(e), e.uninstrument = null, (r = e.stop) == null || r.call(e), e.stop = null, e.prevWindow = [], m(!0).then(() => {
306
313
  const i = o.recordingId;
307
314
  i && (e.dead || g.request($(i)).catch(() => {
308
- }), o.discard(), o.recordingId = null, P(v, y));
315
+ }), o.discard(), o.recordingId = null, P(v, b));
309
316
  });
310
317
  };
311
318
  }, [a, d, u, l]);
312
319
  }
313
- De(
314
- (n) => xe(n),
315
- (n) => (w == null ? void 0 : w(n)) ?? null
320
+ qe(
321
+ (n) => je(n),
322
+ (n) => (y == null ? void 0 : y(n)) ?? null
316
323
  );
317
324
  export {
318
- xe as captureErrorClip,
319
- nt as useSessionRecorder
325
+ je as captureErrorClip,
326
+ st as useSessionRecorder
320
327
  };
package/dist/index.d.ts CHANGED
@@ -4924,6 +4924,9 @@ export declare interface ItemEditFormProps {
4924
4924
  /** false = skip the document.title side effect — a workspace-tab host keeps
4925
4925
  * several forms mounted and only the ACTIVE one may own the browser tab. */
4926
4926
  documentTitle?: boolean;
4927
+ /** false = mounted but not on screen (a background workspace tab): the form
4928
+ * lets its edit lock go after a while and takes it back when shown. */
4929
+ active?: boolean;
4927
4930
  /** Hands the host a stable save trigger (workspace "Save all"); called with
4928
4931
  * null on unmount. The trigger runs the same handleSave the button does —
4929
4932
  * validation and dialogs included. */
@@ -5563,6 +5566,9 @@ declare interface LockHolder {
5563
5566
  note?: string | null;
5564
5567
  /** Minutes since the holder last did anything (presence), when known. */
5565
5568
  idle_minutes?: number | null;
5569
+ /** Whether THIS viewer may force-take the lock (server verdict; absent =
5570
+ * unknown, the button shows and the server's 403 explains). */
5571
+ may_take_over?: boolean;
5566
5572
  }
5567
5573
 
5568
5574
  declare interface LockQueueEntry {
@@ -7255,6 +7261,8 @@ declare interface QuerySheetDef {
7255
7261
  stats: QueryWidgetStat[];
7256
7262
  /** "As of" line under the tiles: label + the latest value of field. */
7257
7263
  as_of?: SheetHeaderAsOf;
7264
+ /** What the tiles cover, under them ("Project lifetime"); `{{param}}` tokens. */
7265
+ note?: string;
7258
7266
  };
7259
7267
  /** Zero-based tab to open first (clamped into range). */
7260
7268
  initial_tab?: number;
@@ -7263,6 +7271,8 @@ declare interface QuerySheetDef {
7263
7271
  * fields render as fixed context, not pickers. */
7264
7272
  tabs?: Array<{
7265
7273
  label: string;
7274
+ /** What the tab's view covers, above it ("Spend dated in {{funding_years}}"). */
7275
+ note?: string;
7266
7276
  config?: QueryWidgetConfig;
7267
7277
  matrix?: {
7268
7278
  config: MatrixEditorConfig;
@@ -7486,8 +7496,13 @@ declare type QueryWidgetFilter = {
7486
7496
  /** Query-string key that pre-selects this filter when the page URL carries
7487
7497
  * it (`?fy=2026`, a comma list for several values, compared on
7488
7498
  * value_field). Beats default_values and the user-scope seeding; when the
7489
- * URL lacks it, those apply as before. */
7499
+ * URL lacks it, those apply as before. A change made on the page is
7500
+ * written back to the address (an emptied filter as `?fy=`, "All"), so a
7501
+ * reload or a shared link keeps it. */
7490
7502
  url_param?: string;
7503
+ /** One value at a time: picking another replaces it (a per-year query that
7504
+ * would silently sum two years). */
7505
+ single?: boolean;
7491
7506
  };
7492
7507
 
7493
7508
  declare interface QueryWidgetStat {
@@ -7535,6 +7550,12 @@ declare interface QueryWidgetStat {
7535
7550
  * the table the number covers; when NO row does, the tile shows its
7536
7551
  * empty_label instead of a summed zero. */
7537
7552
  coverage?: string;
7553
+ /** A context tile that only means something when the main rows carry this
7554
+ * field — e.g. "Fusion figures as of" over rows whose fusion_synced_at is
7555
+ * null: when no row has a value, the tile shows `requires_label` instead
7556
+ * of its own value (an import date over all-empty Fusion columns misleads). */
7557
+ requires_field?: string;
7558
+ requires_label?: string;
7538
7559
  }
7539
7560
 
7540
7561
  /** The full query-widget surface (filters, stats, table, row actions, drill
@@ -8565,7 +8586,8 @@ declare interface ReviewListConfig {
8565
8586
  empty_color?: string | null;
8566
8587
  stamp_user_field?: string | null;
8567
8588
  stamp_date_field?: string | null;
8568
- /** POST this endpoint with {ids, status, note, workflow_id} instead of
8589
+ /** POST this endpoint with {ids, status, note, workflow_id, expected}
8590
+ * (`expected` = each row's status as the list showed it) instead of
8569
8591
  * per-row PATCHes — lets a deployment route decisions through an
8570
8592
  * endpoint that owns stamping, authorization, notes and notifications
8571
8593
  * (e.g. an extension's /decide route). */
@@ -10321,7 +10343,15 @@ export declare function useIsRecordingSelf(userId: string | number | null | unde
10321
10343
 
10322
10344
  export declare function useItemEditAuth(): ItemEditAuthContextValue;
10323
10345
 
10324
- export declare function useItemLock(collection: string | undefined, item: string | undefined, enabled: boolean): {
10346
+ export declare function useItemLock(collection: string | undefined, item: string | undefined, enabled: boolean, opts?: {
10347
+ /** Take the lock on the first real edit (`claim`), not on open — opening
10348
+ * a record only learns whether someone else holds it. A reader who never
10349
+ * edits (an approver re-opening what they sent back) never blocks the
10350
+ * person who has to fix it. */
10351
+ lazy?: boolean;
10352
+ /** False = mounted but not on screen (a background workspace tab). */
10353
+ active?: boolean;
10354
+ }): {
10325
10355
  lockHolder: LockHolder | null;
10326
10356
  acquired: boolean;
10327
10357
  isReadOnly: boolean;
@@ -10341,6 +10371,7 @@ export declare function useItemLock(collection: string | undefined, item: string
10341
10371
  releasing: boolean;
10342
10372
  released: boolean;
10343
10373
  relock: () => Promise<boolean>;
10374
+ claim: () => Promise<void>;
10344
10375
  };
10345
10376
 
10346
10377
  /** Resolved item-link helpers honoring the host's itemUrl/openItem overrides. */