@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.
- package/dist/components/fields/FileField.js +20 -19
- package/dist/full.css +1 -1
- package/dist/hooks/useNivaroForm.js +129 -126
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +69 -1
- package/dist/index.js +512 -501
- package/dist/shared/components/CollectionBrowserView.js +1000 -1001
- package/dist/shared/components/ConformanceView.js +36 -35
- package/dist/shared/components/ForceReloadBanner.js +58 -34
- package/dist/shared/components/ItemEditForm.js +3687 -3580
- package/dist/shared/components/JsonMapEditor.js +18 -17
- package/dist/shared/components/MatrixEditor.js +8 -7
- package/dist/shared/components/MyWorkView.js +32 -31
- package/dist/shared/components/PageRenderer.js +146 -145
- package/dist/shared/components/RecordGridEditor.js +76 -75
- package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
- package/dist/shared/components/ai/AskPanel.js +55 -54
- package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
- package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
- package/dist/shared/components/chat/SlashCommands.js +30 -29
- package/dist/shared/components/chat/chat-outbox.js +76 -75
- package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
- package/dist/shared/components/integrations/console/SignalCard.js +124 -123
- package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
- package/dist/shared/components/item-edit/CloneDialog.js +85 -78
- package/dist/shared/components/item-edit/InlineTableField.js +301 -300
- package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
- package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
- package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
- package/dist/shared/components/item-edit/staged-links.js +86 -0
- package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
- package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
- package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
- package/dist/shared/components/profile/AiMemoryCard.js +15 -14
- package/dist/shared/components/profile/PersonAdminTools.js +70 -67
- package/dist/shared/components/queue/QueueItemSheet.js +36 -35
- package/dist/shared/components/queue/QueueWorklist.js +597 -598
- package/dist/shared/lib/client-version.js +63 -0
- package/dist/shared/lib/force-reload.js +36 -0
- package/dist/shared/lib/load-error.js +11 -10
- package/dist/shared/lib/presence-live.js +54 -35
- package/dist/shared/lib/record-outbox.js +76 -75
- package/dist/shared/lib/safe-error.js +39 -0
- package/dist/shared/lib/server-clock.js +11 -7
- package/dist/shared/lib/unsaved-work.js +62 -0
- package/package.json +1 -1
|
@@ -1,146 +1,147 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { get as
|
|
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
|
|
8
|
+
const l = c[r.when];
|
|
8
9
|
switch (r.op) {
|
|
9
10
|
case "eq":
|
|
10
|
-
return
|
|
11
|
+
return l === r.value;
|
|
11
12
|
case "neq":
|
|
12
|
-
return
|
|
13
|
+
return l !== r.value;
|
|
13
14
|
case "null":
|
|
14
|
-
return
|
|
15
|
+
return l == null || l === "";
|
|
15
16
|
case "nnull":
|
|
16
|
-
return
|
|
17
|
+
return l != null && l !== "";
|
|
17
18
|
case "in":
|
|
18
|
-
return Array.isArray(r.value) && r.value.includes(
|
|
19
|
+
return Array.isArray(r.value) && r.value.includes(l);
|
|
19
20
|
case "contains":
|
|
20
|
-
return typeof
|
|
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
|
|
28
|
+
let l = !0, g = !1;
|
|
28
29
|
for (const u of r) {
|
|
29
|
-
const
|
|
30
|
-
u.action === "show" ? (
|
|
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 (
|
|
33
|
-
const u = r.some((p) => p.action === "show" && L(p, c)),
|
|
34
|
-
if (!u && !
|
|
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
|
|
37
|
+
return l;
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function he(r, c) {
|
|
39
40
|
return r ? L(r, c) : !1;
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
const
|
|
42
|
+
function Q(r, c) {
|
|
43
|
+
const l = {};
|
|
43
44
|
if (r)
|
|
44
|
-
for (const
|
|
45
|
-
|
|
46
|
-
return c && Object.assign(
|
|
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
|
|
49
|
+
function ye(r) {
|
|
49
50
|
return r == null || r === "" || Array.isArray(r) && r.length === 0;
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
for (const u of
|
|
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
|
|
59
|
-
const
|
|
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:
|
|
66
|
+
mode: h,
|
|
66
67
|
itemId: p,
|
|
67
68
|
defaultValues: N,
|
|
68
69
|
onSuccess: q,
|
|
69
|
-
onError:
|
|
70
|
+
onError: b,
|
|
70
71
|
validate: F,
|
|
71
|
-
includeHidden:
|
|
72
|
-
layoutId:
|
|
73
|
-
layoutSlug:
|
|
72
|
+
includeHidden: X = !1,
|
|
73
|
+
layoutId: Y,
|
|
74
|
+
layoutSlug: Z,
|
|
74
75
|
fieldRulesDebounce: x = 300
|
|
75
76
|
} = c, {
|
|
76
|
-
schema:
|
|
77
|
+
schema: o,
|
|
77
78
|
loading: K,
|
|
78
|
-
error:
|
|
79
|
-
} = de(u, r,
|
|
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 (!
|
|
86
|
-
if (
|
|
86
|
+
if (!o || O.current) return;
|
|
87
|
+
if (h === "edit" && p != null) {
|
|
87
88
|
let e = !0;
|
|
88
89
|
C(!0);
|
|
89
|
-
const
|
|
90
|
+
const s = o.fields.filter(
|
|
90
91
|
(n) => {
|
|
91
|
-
var
|
|
92
|
-
return n.fieldType === "relation-m2m" && ((
|
|
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(
|
|
96
|
+
return u.request(W(`/items/${r}/${p}`)).then(async (n) => {
|
|
96
97
|
if (!e) return;
|
|
97
|
-
const
|
|
98
|
-
...
|
|
98
|
+
const i = {
|
|
99
|
+
...Q(o, N),
|
|
99
100
|
...n.data ?? {}
|
|
100
101
|
};
|
|
101
|
-
if (
|
|
102
|
+
if (s.length > 0) {
|
|
102
103
|
const m = await Promise.allSettled(
|
|
103
|
-
|
|
104
|
-
const d = a.relation,
|
|
104
|
+
s.map((a) => {
|
|
105
|
+
const d = a.relation, v = d.junctionCollection ?? d.relatedCollection;
|
|
105
106
|
return u.request(
|
|
106
|
-
|
|
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((
|
|
112
|
+
).then((y) => ({
|
|
112
113
|
field: a.field,
|
|
113
114
|
junctionField: d.junctionField,
|
|
114
|
-
rows:
|
|
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:
|
|
121
|
-
|
|
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(
|
|
125
|
+
e && (j(i), D(i), O.current = !0, C(!1));
|
|
125
126
|
}).catch((n) => {
|
|
126
|
-
e && (C(!1),
|
|
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 =
|
|
132
|
+
const t = Q(o, N);
|
|
132
133
|
j(t), D(t), O.current = !0, C(!1);
|
|
133
|
-
}, [
|
|
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
|
-
|
|
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
|
|
143
|
-
|
|
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
|
|
154
|
+
const se = w(
|
|
154
155
|
(t, e) => {
|
|
155
|
-
j((
|
|
156
|
-
const n = { ...
|
|
156
|
+
j((s) => {
|
|
157
|
+
const n = { ...s, [t]: e };
|
|
157
158
|
return E(n), n;
|
|
158
|
-
}),
|
|
159
|
-
if (!
|
|
160
|
-
const { [t]: n, ...
|
|
161
|
-
return
|
|
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
|
|
169
|
-
return E(
|
|
169
|
+
const s = { ...e, ...t };
|
|
170
|
+
return E(s), s;
|
|
170
171
|
});
|
|
171
172
|
},
|
|
172
173
|
[E]
|
|
173
|
-
),
|
|
174
|
+
), oe = w(
|
|
174
175
|
(t) => {
|
|
175
|
-
j(t ?? V),
|
|
176
|
+
j(t ?? V), k({});
|
|
176
177
|
},
|
|
177
178
|
[V]
|
|
178
179
|
), le = w(
|
|
179
180
|
(t) => {
|
|
180
|
-
const e =
|
|
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
|
-
[
|
|
184
|
-
),
|
|
184
|
+
[o, f]
|
|
185
|
+
), ue = w(
|
|
185
186
|
(t) => {
|
|
186
|
-
const e =
|
|
187
|
-
return e ? e.readonly ? !0 :
|
|
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
|
-
[
|
|
190
|
-
),
|
|
190
|
+
[o, f]
|
|
191
|
+
), _ = w(() => {
|
|
191
192
|
const t = {};
|
|
192
|
-
if (!
|
|
193
|
-
for (const e of
|
|
193
|
+
if (!o) return t;
|
|
194
|
+
for (const e of o.fields) {
|
|
194
195
|
if (!H(e.visibilityRules, f)) continue;
|
|
195
|
-
const
|
|
196
|
-
e.required &&
|
|
197
|
-
for (const
|
|
198
|
-
if (
|
|
199
|
-
const m = pe(
|
|
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
|
|
205
|
-
|
|
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,
|
|
210
|
-
if (t[e] ||
|
|
211
|
-
const n =
|
|
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
|
-
}, [
|
|
216
|
+
}, [o, f, F]), fe = w(
|
|
216
217
|
async (t) => {
|
|
217
|
-
var
|
|
218
|
-
(
|
|
219
|
-
const e =
|
|
220
|
-
if (
|
|
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
|
|
224
|
-
const
|
|
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
|
-
|
|
228
|
+
z(`/items/${r}`, f)
|
|
228
229
|
)).data ?? f;
|
|
229
|
-
D(
|
|
230
|
+
D(i), q == null || q(i);
|
|
230
231
|
} catch (n) {
|
|
231
|
-
const
|
|
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
|
-
|
|
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
|
|
242
|
-
if (
|
|
243
|
-
const
|
|
244
|
-
typeof
|
|
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 &&
|
|
247
|
+
Object.keys(d).length > 0 && k((v) => ({ ...v, ...d }));
|
|
247
248
|
}
|
|
248
249
|
}
|
|
249
|
-
|
|
250
|
+
b == null || b(i);
|
|
250
251
|
} finally {
|
|
251
252
|
P(!1);
|
|
252
253
|
}
|
|
253
254
|
}
|
|
254
255
|
},
|
|
255
|
-
[
|
|
256
|
-
),
|
|
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 (!
|
|
259
|
-
for (const e of
|
|
260
|
-
const
|
|
261
|
-
n.push(e), t.set(
|
|
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
|
-
}, [
|
|
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:
|
|
269
|
+
schema: o,
|
|
267
270
|
schemaLoading: K,
|
|
268
|
-
schemaError:
|
|
271
|
+
schemaError: ee,
|
|
269
272
|
values: f,
|
|
270
273
|
initialValues: V,
|
|
271
|
-
errors:
|
|
272
|
-
isDirty:
|
|
273
|
-
isSubmitting:
|
|
274
|
-
isLoading: K ||
|
|
274
|
+
errors: te,
|
|
275
|
+
isDirty: B,
|
|
276
|
+
isSubmitting: re,
|
|
277
|
+
isLoading: K || ne,
|
|
275
278
|
isVisible: le,
|
|
276
|
-
isLocked:
|
|
277
|
-
setValue:
|
|
279
|
+
isLocked: ue,
|
|
280
|
+
setValue: se,
|
|
278
281
|
setValues: ie,
|
|
279
|
-
reset:
|
|
280
|
-
handleSubmit:
|
|
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
|
-
|
|
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.
|
|
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<{
|