@nivaro/react 0.3.9 → 0.3.10

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 (47) hide show
  1. package/dist/components/fields/FileField.js +20 -19
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useNivaroForm.js +129 -126
  4. package/dist/hooks/useSessionRecorder.js +1 -1
  5. package/dist/index.d.ts +69 -1
  6. package/dist/index.js +512 -501
  7. package/dist/shared/components/CollectionBrowserView.js +1000 -1001
  8. package/dist/shared/components/ConformanceView.js +36 -35
  9. package/dist/shared/components/ForceReloadBanner.js +58 -34
  10. package/dist/shared/components/ItemEditForm.js +3687 -3580
  11. package/dist/shared/components/JsonMapEditor.js +18 -17
  12. package/dist/shared/components/MatrixEditor.js +8 -7
  13. package/dist/shared/components/MyWorkView.js +32 -31
  14. package/dist/shared/components/PageRenderer.js +146 -145
  15. package/dist/shared/components/RecordGridEditor.js +76 -75
  16. package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
  17. package/dist/shared/components/ai/AskPanel.js +55 -54
  18. package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
  19. package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
  20. package/dist/shared/components/chat/SlashCommands.js +30 -29
  21. package/dist/shared/components/chat/chat-outbox.js +76 -75
  22. package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
  23. package/dist/shared/components/integrations/console/SignalCard.js +124 -123
  24. package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
  25. package/dist/shared/components/item-edit/CloneDialog.js +85 -78
  26. package/dist/shared/components/item-edit/InlineTableField.js +301 -300
  27. package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
  28. package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
  29. package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
  30. package/dist/shared/components/item-edit/staged-links.js +86 -0
  31. package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
  32. package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
  33. package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
  34. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
  35. package/dist/shared/components/profile/AiMemoryCard.js +15 -14
  36. package/dist/shared/components/profile/PersonAdminTools.js +70 -67
  37. package/dist/shared/components/queue/QueueItemSheet.js +36 -35
  38. package/dist/shared/components/queue/QueueWorklist.js +597 -598
  39. package/dist/shared/lib/client-version.js +63 -0
  40. package/dist/shared/lib/force-reload.js +36 -0
  41. package/dist/shared/lib/load-error.js +11 -10
  42. package/dist/shared/lib/presence-live.js +54 -35
  43. package/dist/shared/lib/record-outbox.js +76 -75
  44. package/dist/shared/lib/safe-error.js +39 -0
  45. package/dist/shared/lib/server-clock.js +11 -7
  46. package/dist/shared/lib/unsaved-work.js +62 -0
  47. package/package.json +1 -1
@@ -1,146 +1,147 @@
1
- import { useState as k, useRef as $, useEffect as A, useCallback as w, useMemo as G } from "react";
2
- import { get as z, post as Q, patch as ce } from "../lib/commands.js";
1
+ import { useState as S, useRef as $, useEffect as A, useCallback as w, useMemo as G } from "react";
2
+ import { get as W, post as z, patch as ce } from "../lib/commands.js";
3
3
  import { useFormSchema as de } from "./useFormSchema.js";
4
4
  import { useOptionalNivaroClient as me } from "../shared/context.js";
5
5
  import { applyValidationRule as pe } from "../shared/lib/validation-rules.js";
6
+ import { useUnsavedWork as ge } from "../shared/lib/unsaved-work.js";
6
7
  function L(r, c) {
7
- const o = c[r.when];
8
+ const l = c[r.when];
8
9
  switch (r.op) {
9
10
  case "eq":
10
- return o === r.value;
11
+ return l === r.value;
11
12
  case "neq":
12
- return o !== r.value;
13
+ return l !== r.value;
13
14
  case "null":
14
- return o == null || o === "";
15
+ return l == null || l === "";
15
16
  case "nnull":
16
- return o != null && o !== "";
17
+ return l != null && l !== "";
17
18
  case "in":
18
- return Array.isArray(r.value) && r.value.includes(o);
19
+ return Array.isArray(r.value) && r.value.includes(l);
19
20
  case "contains":
20
- return typeof o == "string" && o.includes(String(r.value ?? ""));
21
+ return typeof l == "string" && l.includes(String(r.value ?? ""));
21
22
  default:
22
23
  return !0;
23
24
  }
24
25
  }
25
26
  function H(r, c) {
26
27
  if (!r || r.length === 0) return !0;
27
- let o = !0, y = !1;
28
+ let l = !0, g = !1;
28
29
  for (const u of r) {
29
- const g = L(u, c);
30
- u.action === "show" ? (y = !0, g && (o = !0)) : u.action === "hide" && g && (o = !1);
30
+ const h = L(u, c);
31
+ u.action === "show" ? (g = !0, h && (l = !0)) : u.action === "hide" && h && (l = !1);
31
32
  }
32
- if (y) {
33
- const u = r.some((p) => p.action === "show" && L(p, c)), g = r.some((p) => p.action === "hide" && L(p, c));
34
- if (!u && !g) return !1;
33
+ if (g) {
34
+ const u = r.some((p) => p.action === "show" && L(p, c)), h = r.some((p) => p.action === "hide" && L(p, c));
35
+ if (!u && !h) return !1;
35
36
  }
36
- return o;
37
+ return l;
37
38
  }
38
- function ye(r, c) {
39
+ function he(r, c) {
39
40
  return r ? L(r, c) : !1;
40
41
  }
41
- function U(r, c) {
42
- const o = {};
42
+ function Q(r, c) {
43
+ const l = {};
43
44
  if (r)
44
- for (const y of r.fields)
45
- y.defaultValue !== void 0 && y.defaultValue !== null && (o[y.field] = y.defaultValue);
46
- return c && Object.assign(o, c), o;
45
+ for (const g of r.fields)
46
+ g.defaultValue !== void 0 && g.defaultValue !== null && (l[g.field] = g.defaultValue);
47
+ return c && Object.assign(l, c), l;
47
48
  }
48
- function ge(r) {
49
+ function ye(r) {
49
50
  return r == null || r === "" || Array.isArray(r) && r.length === 0;
50
51
  }
51
- function he(r, c) {
52
- const o = Object.keys(r), y = Object.keys(c);
53
- if (o.length !== y.length) return !1;
54
- for (const u of o)
52
+ function ve(r, c) {
53
+ const l = Object.keys(r), g = Object.keys(c);
54
+ if (l.length !== g.length) return !1;
55
+ for (const u of l)
55
56
  if (!Object.hasOwn(c, u) || r[u] !== c[u]) return !1;
56
57
  return !0;
57
58
  }
58
- function Re(r, c, o) {
59
- const y = me(), u = o ?? y;
59
+ function ke(r, c, l) {
60
+ const g = me(), u = l ?? g;
60
61
  if (!u)
61
62
  throw new Error(
62
63
  "useNivaroForm requires a NivaroClient — pass one as the third argument or wrap the tree in <NivaroProvider>."
63
64
  );
64
65
  const {
65
- mode: g,
66
+ mode: h,
66
67
  itemId: p,
67
68
  defaultValues: N,
68
69
  onSuccess: q,
69
- onError: v,
70
+ onError: b,
70
71
  validate: F,
71
- includeHidden: W = !1,
72
- layoutId: X,
73
- layoutSlug: Y,
72
+ includeHidden: X = !1,
73
+ layoutId: Y,
74
+ layoutSlug: Z,
74
75
  fieldRulesDebounce: x = 300
75
76
  } = c, {
76
- schema: l,
77
+ schema: o,
77
78
  loading: K,
78
- error: Z
79
- } = de(u, r, W, X, Y), [f, j] = k({}), [V, D] = k({}), [ee, S] = k({}), [te, P] = k(!1), [re, C] = k(g === "edit"), O = $(!1), R = $(null), _ = $(/* @__PURE__ */ new Map()), I = $(!0);
79
+ error: ee
80
+ } = de(u, r, X, Y, Z), [f, j] = S({}), [V, D] = S({}), [te, k] = S({}), [re, P] = S(!1), [ne, C] = S(h === "edit"), O = $(!1), R = $(null), U = $(/* @__PURE__ */ new Map()), I = $(!0);
80
81
  A(() => (I.current = !0, () => {
81
82
  I.current = !1;
82
83
  }), []), A(() => {
83
84
  O.current = !1;
84
85
  }, []), A(() => {
85
- if (!l || O.current) return;
86
- if (g === "edit" && p != null) {
86
+ if (!o || O.current) return;
87
+ if (h === "edit" && p != null) {
87
88
  let e = !0;
88
89
  C(!0);
89
- const i = l.fields.filter(
90
+ const s = o.fields.filter(
90
91
  (n) => {
91
- var s, m, a;
92
- return n.fieldType === "relation-m2m" && ((s = n.relation) == null ? void 0 : s.relatedCollection) && ((m = n.relation) == null ? void 0 : m.manyField) && ((a = n.relation) == null ? void 0 : a.junctionField);
92
+ var i, m, a;
93
+ return n.fieldType === "relation-m2m" && ((i = n.relation) == null ? void 0 : i.relatedCollection) && ((m = n.relation) == null ? void 0 : m.manyField) && ((a = n.relation) == null ? void 0 : a.junctionField);
93
94
  }
94
95
  );
95
- return u.request(z(`/items/${r}/${p}`)).then(async (n) => {
96
+ return u.request(W(`/items/${r}/${p}`)).then(async (n) => {
96
97
  if (!e) return;
97
- const s = {
98
- ...U(l, N),
98
+ const i = {
99
+ ...Q(o, N),
99
100
  ...n.data ?? {}
100
101
  };
101
- if (i.length > 0) {
102
+ if (s.length > 0) {
102
103
  const m = await Promise.allSettled(
103
- i.map((a) => {
104
- const d = a.relation, b = d.junctionCollection ?? d.relatedCollection;
104
+ s.map((a) => {
105
+ const d = a.relation, v = d.junctionCollection ?? d.relatedCollection;
105
106
  return u.request(
106
- z(`/items/${b}`, {
107
+ W(`/items/${v}`, {
107
108
  filter: JSON.stringify({ [d.manyField]: { _eq: p } }),
108
109
  fields: `id,${d.junctionField}`,
109
110
  limit: 200
110
111
  })
111
- ).then((h) => ({
112
+ ).then((y) => ({
112
113
  field: a.field,
113
114
  junctionField: d.junctionField,
114
- rows: h.data ?? []
115
+ rows: y.data ?? []
115
116
  })).catch(() => ({ field: a.field, junctionField: d.junctionField, rows: [] }));
116
117
  })
117
118
  );
118
119
  for (const a of m)
119
120
  if (a.status === "fulfilled") {
120
- const { field: d, junctionField: b, rows: h } = a.value, J = h.map((T) => T[b]).filter((T) => T != null);
121
- s[d] = J;
121
+ const { field: d, junctionField: v, rows: y } = a.value, J = y.map((T) => T[v]).filter((T) => T != null);
122
+ i[d] = J;
122
123
  }
123
124
  }
124
- e && (j(s), D(s), O.current = !0, C(!1));
125
+ e && (j(i), D(i), O.current = !0, C(!1));
125
126
  }).catch((n) => {
126
- e && (C(!1), v == null || v(n instanceof Error ? n : new Error(String(n))));
127
+ e && (C(!1), b == null || b(n instanceof Error ? n : new Error(String(n))));
127
128
  }), () => {
128
129
  e = !1;
129
130
  };
130
131
  }
131
- const t = U(l, N);
132
+ const t = Q(o, N);
132
133
  j(t), D(t), O.current = !0, C(!1);
133
- }, [l, g, p, r, N, v, u]);
134
+ }, [o, h, p, r, N, b, u]);
134
135
  const E = w(
135
136
  (t) => {
136
137
  x <= 0 || (R.current && clearTimeout(R.current), R.current = setTimeout(() => {
137
138
  R.current = null, u.request(
138
- Q("/field-rules/evaluate", { collection: r, data: t })
139
+ z("/field-rules/evaluate", { collection: r, data: t })
139
140
  ).then((e) => {
140
141
  var n;
141
142
  if (!I.current) return;
142
- const i = (n = e.data) == null ? void 0 : n.updates;
143
- i && Object.keys(i).length > 0 && j((s) => ({ ...s, ...i }));
143
+ const s = (n = e.data) == null ? void 0 : n.updates;
144
+ s && Object.keys(s).length > 0 && j((i) => ({ ...i, ...s }));
144
145
  }).catch(() => {
145
146
  });
146
147
  }, x));
@@ -150,139 +151,141 @@ function Re(r, c, o) {
150
151
  A(() => () => {
151
152
  R.current && clearTimeout(R.current);
152
153
  }, []);
153
- const ne = w(
154
+ const se = w(
154
155
  (t, e) => {
155
- j((i) => {
156
- const n = { ...i, [t]: e };
156
+ j((s) => {
157
+ const n = { ...s, [t]: e };
157
158
  return E(n), n;
158
- }), S((i) => {
159
- if (!i[t]) return i;
160
- const { [t]: n, ...s } = i;
161
- return s;
159
+ }), k((s) => {
160
+ if (!s[t]) return s;
161
+ const { [t]: n, ...i } = s;
162
+ return i;
162
163
  });
163
164
  },
164
165
  [E]
165
166
  ), ie = w(
166
167
  (t) => {
167
168
  j((e) => {
168
- const i = { ...e, ...t };
169
- return E(i), i;
169
+ const s = { ...e, ...t };
170
+ return E(s), s;
170
171
  });
171
172
  },
172
173
  [E]
173
- ), se = w(
174
+ ), oe = w(
174
175
  (t) => {
175
- j(t ?? V), S({});
176
+ j(t ?? V), k({});
176
177
  },
177
178
  [V]
178
179
  ), le = w(
179
180
  (t) => {
180
- const e = l == null ? void 0 : l.fields.find((i) => i.field === t);
181
+ const e = o == null ? void 0 : o.fields.find((s) => s.field === t);
181
182
  return e ? H(e.visibilityRules, f) : !0;
182
183
  },
183
- [l, f]
184
- ), oe = w(
184
+ [o, f]
185
+ ), ue = w(
185
186
  (t) => {
186
- const e = l == null ? void 0 : l.fields.find((i) => i.field === t);
187
- return e ? e.readonly ? !0 : ye(e.lockCondition, f) : !1;
187
+ const e = o == null ? void 0 : o.fields.find((s) => s.field === t);
188
+ return e ? e.readonly ? !0 : he(e.lockCondition, f) : !1;
188
189
  },
189
- [l, f]
190
- ), B = w(() => {
190
+ [o, f]
191
+ ), _ = w(() => {
191
192
  const t = {};
192
- if (!l) return t;
193
- for (const e of l.fields) {
193
+ if (!o) return t;
194
+ for (const e of o.fields) {
194
195
  if (!H(e.visibilityRules, f)) continue;
195
- const i = f[e.field];
196
- e.required && ge(i) && (t[e.field] == null && (t[e.field] = []), t[e.field].push(`${e.label} is required`));
197
- for (const s of e.validationRules ?? []) {
198
- if (s.soft) continue;
199
- const m = pe(s, i, e.label);
196
+ const s = f[e.field];
197
+ e.required && ye(s) && (t[e.field] == null && (t[e.field] = []), t[e.field].push(`${e.label} is required`));
198
+ for (const i of e.validationRules ?? []) {
199
+ if (i.soft) continue;
200
+ const m = pe(i, s, e.label);
200
201
  m && (t[e.field] == null && (t[e.field] = []), t[e.field].push(m));
201
202
  }
202
203
  const n = F == null ? void 0 : F[e.field];
203
204
  if (n) {
204
- const s = n(i, f);
205
- s && (t[e.field] == null && (t[e.field] = []), t[e.field].push(s));
205
+ const i = n(s, f);
206
+ i && (t[e.field] == null && (t[e.field] = []), t[e.field].push(i));
206
207
  }
207
208
  }
208
209
  if (F)
209
- for (const [e, i] of Object.entries(F)) {
210
- if (t[e] || l.fields.some((s) => s.field === e)) continue;
211
- const n = i(f[e], f);
210
+ for (const [e, s] of Object.entries(F)) {
211
+ if (t[e] || o.fields.some((i) => i.field === e)) continue;
212
+ const n = s(f[e], f);
212
213
  n && (t[e] == null && (t[e] = []), t[e].push(n));
213
214
  }
214
215
  return t;
215
- }, [l, f, F]), ue = w(
216
+ }, [o, f, F]), fe = w(
216
217
  async (t) => {
217
- var i;
218
- (i = t == null ? void 0 : t.preventDefault) == null || i.call(t);
219
- const e = B();
220
- if (S(e), !(Object.keys(e).length > 0)) {
218
+ var s;
219
+ (s = t == null ? void 0 : t.preventDefault) == null || s.call(t);
220
+ const e = _();
221
+ if (k(e), !(Object.keys(e).length > 0)) {
221
222
  P(!0);
222
223
  try {
223
- for (const m of _.current.values()) await m();
224
- const s = (g === "edit" && p != null ? await u.request(
224
+ for (const m of U.current.values()) await m();
225
+ const i = (h === "edit" && p != null ? await u.request(
225
226
  ce(`/items/${r}/${p}`, f)
226
227
  ) : await u.request(
227
- Q(`/items/${r}`, f)
228
+ z(`/items/${r}`, f)
228
229
  )).data ?? f;
229
- D(s), q == null || q(s);
230
+ D(i), q == null || q(i);
230
231
  } catch (n) {
231
- const s = n instanceof Error ? n : new Error(String(n)), m = n == null ? void 0 : n.response;
232
+ const i = n instanceof Error ? n : new Error(String(n)), m = n == null ? void 0 : n.response;
232
233
  if (m != null && typeof m == "object") {
233
234
  const a = m;
234
235
  if (typeof a.field == "string" && typeof a.error == "string")
235
- S((d) => ({
236
+ k((d) => ({
236
237
  ...d,
237
238
  [a.field]: [a.error]
238
239
  }));
239
240
  else if (Array.isArray(a.errors)) {
240
241
  const d = {};
241
- for (const b of a.errors)
242
- if (b != null && typeof b == "object") {
243
- const h = b;
244
- typeof h.field == "string" && typeof h.message == "string" && (d[h.field] == null && (d[h.field] = []), d[h.field].push(h.message));
242
+ for (const v of a.errors)
243
+ if (v != null && typeof v == "object") {
244
+ const y = v;
245
+ typeof y.field == "string" && typeof y.message == "string" && (d[y.field] == null && (d[y.field] = []), d[y.field].push(y.message));
245
246
  }
246
- Object.keys(d).length > 0 && S((b) => ({ ...b, ...d }));
247
+ Object.keys(d).length > 0 && k((v) => ({ ...v, ...d }));
247
248
  }
248
249
  }
249
- v == null || v(s);
250
+ b == null || b(i);
250
251
  } finally {
251
252
  P(!1);
252
253
  }
253
254
  }
254
255
  },
255
- [B, g, p, r, f, u, q, v]
256
- ), fe = G(() => !he(f, V), [f, V]), M = G(() => {
256
+ [_, h, p, r, f, u, q, b]
257
+ ), B = G(() => !ve(f, V), [f, V]);
258
+ ge(B, "Unsaved form changes");
259
+ const M = G(() => {
257
260
  const t = /* @__PURE__ */ new Map();
258
- if (!l) return t;
259
- for (const e of l.fields) {
260
- const i = e.group ?? null, n = t.get(i) ?? [];
261
- n.push(e), t.set(i, n);
261
+ if (!o) return t;
262
+ for (const e of o.fields) {
263
+ const s = e.group ?? null, n = t.get(s) ?? [];
264
+ n.push(e), t.set(s, n);
262
265
  }
263
266
  return t;
264
- }, [l]), ae = G(() => l ? l.groups.filter((t) => (M.get(t.key) ?? []).some((i) => H(i.visibilityRules, f))) : [], [l, M, f]);
267
+ }, [o]), ae = G(() => o ? o.groups.filter((t) => (M.get(t.key) ?? []).some((s) => H(s.visibilityRules, f))) : [], [o, M, f]);
265
268
  return {
266
- schema: l,
269
+ schema: o,
267
270
  schemaLoading: K,
268
- schemaError: Z,
271
+ schemaError: ee,
269
272
  values: f,
270
273
  initialValues: V,
271
- errors: ee,
272
- isDirty: fe,
273
- isSubmitting: te,
274
- isLoading: K || re,
274
+ errors: te,
275
+ isDirty: B,
276
+ isSubmitting: re,
277
+ isLoading: K || ne,
275
278
  isVisible: le,
276
- isLocked: oe,
277
- setValue: ne,
279
+ isLocked: ue,
280
+ setValue: se,
278
281
  setValues: ie,
279
- reset: se,
280
- handleSubmit: ue,
282
+ reset: oe,
283
+ handleSubmit: fe,
281
284
  fieldsByGroup: M,
282
285
  visibleGroups: ae,
283
- gridFlushersRef: _
286
+ gridFlushersRef: U
284
287
  };
285
288
  }
286
289
  export {
287
- Re as useNivaroForm
290
+ ke as useNivaroForm
288
291
  };
@@ -8,7 +8,7 @@ import { normalizeReplaySampling as x, replaySampleDraw as Ie, currentReplayRout
8
8
  import { emitReplayTap as _e, setReplayRecorderMode as N, registerReplayCapture as De, clipEndOffset as qe, withClipKind as Le } from "../shared/lib/replay-capture.js";
9
9
  import { instrumentConsole as Te, instrumentRequests as Pe, redactSecrets as Ne } from "../shared/lib/replay-context.js";
10
10
  import { instrumentSocket as Me } from "../shared/lib/replay-socket.js";
11
- const Oe = "nivaro-react@0.3.9", j = 1e4, Ue = 150, We = 3e3, Fe = 600, He = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
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
12
  function Ke(n) {
13
13
  return typeof n.url != "string" || typeof fetch != "function" ? null : (f, a) => {
14
14
  const u = typeof n.getToken == "function" ? n.getToken() : void 0, d = { "Content-Type": "application/json" };
package/dist/index.d.ts CHANGED
@@ -3063,7 +3063,8 @@ export declare const FORCE_RELOAD_EVENT = "nvr:force-refresh";
3063
3063
  * the app root. Mount it once per host.
3064
3064
  *
3065
3065
  * A second push while a countdown is running restarts the clock with the
3066
- * newer duration — the later instruction wins.
3066
+ * newer duration — the later instruction wins. The same instruction arriving
3067
+ * twice (live, then again on a reconnect) is ignored.
3067
3068
  *
3068
3069
  * The countdown runs against a wall-clock deadline, not a count of timer
3069
3070
  * ticks: a background tab's timers wake about once a minute, so counting 15
@@ -3071,12 +3072,36 @@ export declare const FORCE_RELOAD_EVENT = "nvr:force-refresh";
3071
3072
  * build never reloaded while the admin watched). A throttled tab reloads at
3072
3073
  * its first wake past the deadline, and a frozen one the moment it is shown
3073
3074
  * or focused again.
3075
+ *
3076
+ * Sticky refresh: a tab that was asleep or offline is told when it reconnects,
3077
+ * and a tab below an app's minimum build is told on connect
3078
+ * (api/src/services/sticky-refresh.ts). Each checks for itself first
3079
+ * (lib/force-reload.ts) and marks the instruction before reloading, so it
3080
+ * never reloads twice for one instruction (twice at most for a minimum build).
3081
+ *
3082
+ * Unsaved work (lib/unsaved-work.ts) holds the reload: past the deadline the
3083
+ * banner says a reload is waiting and reloads the moment the edits are saved
3084
+ * or discarded — or when the person clicks Reload now.
3074
3085
  */
3075
3086
  export declare function ForceReloadBanner(): JSX.Element | null;
3076
3087
 
3088
+ /**
3089
+ * Sticky force refresh — the client half of api/src/services/sticky-refresh.ts.
3090
+ *
3091
+ * The server pushes `client:force-refresh` live, again when a tab that missed it connects, and
3092
+ * whenever a tab connects below an app's minimum build. A browser's shared worker carries every
3093
+ * tab of an app on ONE socket and reports the first tab's build, so a push meant for an old tab
3094
+ * can reach a newer one: each tab checks for itself here before counting down.
3095
+ */
3096
+ /** What `client:force-refresh` carries. Everything after `message` is optional (older servers). */
3077
3097
  export declare interface ForceReloadDetail {
3078
3098
  seconds?: number;
3079
3099
  message?: string;
3100
+ id?: string;
3101
+ issued_at?: number;
3102
+ reason?: 'push' | 'sticky' | 'min-build';
3103
+ min_build?: string;
3104
+ set_at?: number;
3080
3105
  }
3081
3106
 
3082
3107
  /** Drop every settled metadata answer (call after a configuration write made outside the SDK client). */
@@ -3412,6 +3437,8 @@ declare type GuardRule = {
3412
3437
  value?: unknown;
3413
3438
  };
3414
3439
 
3440
+ export declare function hasUnsavedWork(): boolean;
3441
+
3415
3442
  export declare interface HeaderWidgetInfo {
3416
3443
  field: string;
3417
3444
  widgetId: number;
@@ -4803,6 +4830,9 @@ export declare function isChatPanelPinned(): boolean;
4803
4830
 
4804
4831
  export declare function isCleanRecording(): boolean;
4805
4832
 
4833
+ /** A bug in our own code (not the server's answer, not the network). */
4834
+ export declare function isCodeError(err: unknown): boolean;
4835
+
4806
4836
  /** True once a 401 said this tab is signed out, until a sign-in is heard. */
4807
4837
  export declare function isSignedOut(): boolean;
4808
4838
 
@@ -8205,6 +8235,9 @@ export declare function registerReplayCapture(fn: Capture, snap?: Snapshot): ()
8205
8235
 
8206
8236
  export declare function registerRoomOpener(fn: RoomOpener): () => void;
8207
8237
 
8238
+ /** Report a source of unsaved work; the returned function removes it. */
8239
+ export declare function registerUnsavedWork(label: string, dirty: () => boolean): () => void;
8240
+
8208
8241
  /** Register the host's opener. Returns an unregister function. */
8209
8242
  export declare function registerViewAsOpener(fn: ViewAsOpener): () => void;
8210
8243
 
@@ -8366,6 +8399,13 @@ export declare function reportClientCrash(client: {
8366
8399
  url?: string;
8367
8400
  }): Promise<void>;
8368
8401
 
8402
+ /**
8403
+ * Send a code error to the issue log once (POST /issues/client, with the
8404
+ * replay when a recorder is running). Anything else is the server's answer and
8405
+ * already logged there. Never throws.
8406
+ */
8407
+ export declare function reportCodeError(client: Parameters<typeof reportClientCrash>[0] | null | undefined, err: unknown): void;
8408
+
8369
8409
  export declare function ReportProblemButton({ app, floating, className, children, onReported }: {
8370
8410
  /** Your front end's label ('efp'), stored with the report. */
8371
8411
  app?: string;
@@ -9258,6 +9298,18 @@ export declare interface SocketRealtimeOptions {
9258
9298
 
9259
9299
  export declare type SocketRealtimeWindowEvent = 'catchupFull' | 'accessChanged' | 'configUpdate' | 'forceRefresh';
9260
9300
 
9301
+ /**
9302
+ * No raw JavaScript error text on screen, ever. "Cannot read properties of
9303
+ * null (reading 'id')" told a person nothing and invited them to press Save
9304
+ * again (2026-10-23: a duplicate workflow). A code error (a TypeError,
9305
+ * ReferenceError or RangeError that is not a network failure and carries no
9306
+ * HTTP status) shows one plain sentence instead, and the real error goes to
9307
+ * the issue log through the client crash report. A SyntaxError is left alone:
9308
+ * at runtime it comes from JSON.parse / RegExp on what a person typed, and its
9309
+ * text tells them what to fix.
9310
+ */
9311
+ export declare const SOMETHING_WENT_WRONG = "Something went wrong \u2014 it\u2019s been reported";
9312
+
9261
9313
  declare type Speed = 0.5 | 1 | 1.5 | 2 | 4;
9262
9314
 
9263
9315
  export declare function splitMessageTokens(text: string, entityPattern: string): MessageToken[];
@@ -9388,6 +9440,9 @@ export declare function SubmissionStatusPill({ status }: {
9388
9440
 
9389
9441
  export declare function subscribeClientChaos(cb: () => void): () => void;
9390
9442
 
9443
+ /** Told when a source comes or goes, or the record outbox changes. */
9444
+ export declare function subscribeUnsavedWork(cb: () => void): () => void;
9445
+
9391
9446
  /**
9392
9447
  * The one subscription editor — create + edit for nivaro_notification_subscriptions,
9393
9448
  * shared by the profile's Notifications & alerts card and the My Subscriptions
@@ -9866,6 +9921,9 @@ declare interface UnsavedSummary {
9866
9921
  text: string;
9867
9922
  }
9868
9923
 
9924
+ /** What would be lost, by label (empty = nothing). */
9925
+ export declare function unsavedWorkLabels(): string[];
9926
+
9869
9927
  /** The ids an update covers: one, a coalesced list, or null = "too many — refresh it all". */
9870
9928
  export declare function updateItemIds(ev: CollectionUpdateEvent): Array<string | number> | null;
9871
9929
 
@@ -10585,6 +10643,13 @@ export declare function useRelationOptions(client: NivaroClient | null, relatedC
10585
10643
  /** The single required videos (the same fetch as useRequiredList). */
10586
10644
  export declare function useRequiredVideos(): UseQueryResult<NoInfer<HelpVideoDto[]>, Error>;
10587
10645
 
10646
+ /**
10647
+ * The sentence to show for a failed action: the server's explanation when it
10648
+ * gave one, the plain "something went wrong" for a code error, else the
10649
+ * error's own message (or `fallback`).
10650
+ */
10651
+ export declare function userErrorMessage(err: unknown, fallback?: string): string;
10652
+
10588
10653
  export declare function useRoomMembership(): {
10589
10654
  join: UseMutationResult<unknown, Error, string, unknown>;
10590
10655
  leave: UseMutationResult<unknown, Error, string, unknown>;
@@ -10734,6 +10799,9 @@ export declare function useTypingIndicator(room: string | null): {
10734
10799
 
10735
10800
  export declare function useUnreadChirp(totalUnread: number, rooms?: RoomInfo[]): void;
10736
10801
 
10802
+ /** A form reports its dirty state while mounted. */
10803
+ export declare function useUnsavedWork(dirty: boolean, label?: string): void;
10804
+
10737
10805
  /** Directory of users to add to a private channel. */
10738
10806
  export declare function useUserSearch(search: string, enabled: boolean): {
10739
10807
  users: NoInfer<{