@nivaro/react 0.3.8 → 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/replayUploadQueue.js +107 -93
- package/dist/hooks/useNivaroForm.js +129 -126
- package/dist/hooks/useSessionRecorder.js +103 -101
- package/dist/index.d.ts +115 -2
- package/dist/index.js +466 -447
- package/dist/shared/components/CollectionBrowserView.js +1058 -1059
- package/dist/shared/components/ConformanceView.js +36 -35
- package/dist/shared/components/DataTable.js +230 -223
- 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/QueryTable.js +49 -49
- 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/ChatPanel.js +288 -287
- 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/panels/CommentPanel.js +237 -236
- package/dist/shared/components/profile/AiMemoryCard.js +15 -14
- package/dist/shared/components/profile/PersonAdminTools.js +70 -67
- package/dist/shared/components/profile/usePersonPresence.js +42 -37
- 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 +73 -0
- package/dist/shared/lib/presence-state.js +39 -31
- package/dist/shared/lib/record-outbox.js +76 -75
- package/dist/shared/lib/request-gate.js +120 -102
- package/dist/shared/lib/rum.js +45 -36
- package/dist/shared/lib/safe-error.js +39 -0
- package/dist/shared/lib/server-clock.js +11 -7
- package/dist/shared/lib/signed-out.js +114 -0
- package/dist/shared/lib/socket-realtime.js +19 -17
- package/dist/shared/lib/unsaved-work.js +62 -0
- package/dist/shared/lib/use-online-users.js +11 -10
- package/dist/shared/lib/worker-socket.js +89 -79
- package/package.json +1 -1
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { noteOwnWriteFromCommand as
|
|
1
|
+
import { noteOwnWriteFromCommand as C } from "./own-writes.js";
|
|
2
|
+
import { noteCredentialChanged as z, isIdentityRead as D, claimIdentityCall as M, signedOutError as $, noteSignedIn as Z, isSignedOutError as U, noteUnauthorized as x } from "./signed-out.js";
|
|
2
3
|
function q(t) {
|
|
3
4
|
if (!t || typeof t != "object") return "";
|
|
4
5
|
const s = Object.entries(t).filter(([, o]) => o != null).map(([o, u]) => [o, String(u)]).sort(([o], [u]) => o < u ? -1 : o > u ? 1 : 0);
|
|
5
6
|
return s.length ? new URLSearchParams(s).toString() : "";
|
|
6
7
|
}
|
|
7
|
-
function
|
|
8
|
+
function P(t) {
|
|
8
9
|
const s = (t._method ?? "GET").toUpperCase(), o = s === "GET" || t._body === void 0 ? "" : JSON.stringify(t._body);
|
|
9
10
|
return `${s} ${t._path ?? ""} ${q(t._params)} ${o}`;
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
+
function A(t) {
|
|
12
13
|
return (t._method ?? "GET").toUpperCase() === "GET";
|
|
13
14
|
}
|
|
14
|
-
const
|
|
15
|
-
function
|
|
16
|
-
return
|
|
15
|
+
const I = /^\/(widgets-internal\/[^/]+\/render|items\/[^/]+\/[^/]+\/child-summary|items\/[^/]+\/auto-id-preview|config-conformance\/record\/.+\/check|pipelines\/instance\/[^/]+\/owners\/batch|addendums\/summary|at-risk\/evaluate|record-views\/.+\/touch)$/;
|
|
16
|
+
function H(t) {
|
|
17
|
+
return A(t) ? !0 : (t._method ?? "GET").toUpperCase() !== "POST" ? !1 : I.test((t._path ?? "").split("?")[0]);
|
|
17
18
|
}
|
|
18
19
|
function T(t) {
|
|
19
20
|
if (t == null || typeof t != "object") return t;
|
|
@@ -23,11 +24,11 @@ function T(t) {
|
|
|
23
24
|
return t;
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
|
-
const
|
|
27
|
-
function
|
|
28
|
-
return t[
|
|
27
|
+
const j = Symbol("nivaro.coalesced");
|
|
28
|
+
function B(t) {
|
|
29
|
+
return t[j] === !0;
|
|
29
30
|
}
|
|
30
|
-
const
|
|
31
|
+
const O = 20, F = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?$/, W = /* @__PURE__ */ new Set(["aggregate", "export", "distinct", "resolve-paths", "batch-read"]), K = /* @__PURE__ */ new Set([
|
|
31
32
|
"fields",
|
|
32
33
|
"filter",
|
|
33
34
|
"sort",
|
|
@@ -40,32 +41,32 @@ const C = 20, D = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?$/, I = /*
|
|
|
40
41
|
"conditions",
|
|
41
42
|
"labels"
|
|
42
43
|
]);
|
|
43
|
-
function
|
|
44
|
+
function Y(t) {
|
|
44
45
|
const s = t;
|
|
45
46
|
if ((s._method ?? "GET").toUpperCase() !== "GET") return null;
|
|
46
|
-
const o =
|
|
47
|
+
const o = F.exec(s._path ?? "");
|
|
47
48
|
if (!o) return null;
|
|
48
49
|
const [, u, d] = o;
|
|
49
|
-
if (d !== void 0 &&
|
|
50
|
-
const m = s._params ?? {},
|
|
50
|
+
if (d !== void 0 && W.has(d)) return null;
|
|
51
|
+
const m = s._params ?? {}, a = {};
|
|
51
52
|
for (const [r, c] of Object.entries(m))
|
|
52
53
|
if (c !== void 0) {
|
|
53
|
-
if (!
|
|
54
|
-
|
|
54
|
+
if (!K.has(r)) return null;
|
|
55
|
+
a[r] = c;
|
|
55
56
|
}
|
|
56
|
-
return d === void 0 ? { collection: u, query:
|
|
57
|
+
return d === void 0 ? { collection: u, query: a } : { collection: u, id: d, query: a };
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
+
function J(t) {
|
|
59
60
|
let s = [], o;
|
|
60
|
-
const u = (
|
|
61
|
-
if (
|
|
61
|
+
const u = (a) => t.request(a.command).then(a.resolve, a.reject), d = async (a) => {
|
|
62
|
+
if (a.length === 1) return u(a[0]);
|
|
62
63
|
let r;
|
|
63
64
|
try {
|
|
64
65
|
const c = await t.request({
|
|
65
66
|
_method: "POST",
|
|
66
67
|
_path: "/items/batch-read",
|
|
67
68
|
_body: {
|
|
68
|
-
reads:
|
|
69
|
+
reads: a.map((n, e) => ({
|
|
69
70
|
key: String(e),
|
|
70
71
|
collection: n.read.collection,
|
|
71
72
|
...n.read.id !== void 0 ? { id: n.read.id } : {},
|
|
@@ -77,7 +78,7 @@ function Z(t) {
|
|
|
77
78
|
} catch {
|
|
78
79
|
r = void 0;
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
+
a.forEach((c, n) => {
|
|
81
82
|
const e = r == null ? void 0 : r[n];
|
|
82
83
|
if ((e == null ? void 0 : e.status) !== 200 || e === void 0) {
|
|
83
84
|
u(c);
|
|
@@ -87,36 +88,36 @@ function Z(t) {
|
|
|
87
88
|
});
|
|
88
89
|
}, m = () => {
|
|
89
90
|
o = void 0;
|
|
90
|
-
const
|
|
91
|
+
const a = s;
|
|
91
92
|
s = [];
|
|
92
|
-
for (let r = 0; r <
|
|
93
|
-
d(
|
|
93
|
+
for (let r = 0; r < a.length; r += O)
|
|
94
|
+
d(a.slice(r, r + O));
|
|
94
95
|
};
|
|
95
|
-
return (
|
|
96
|
+
return (a, r) => new Promise((c, n) => {
|
|
96
97
|
s.push({
|
|
97
98
|
read: r,
|
|
98
|
-
command:
|
|
99
|
+
command: a,
|
|
99
100
|
resolve: c,
|
|
100
101
|
reject: n
|
|
101
102
|
}), o === void 0 && (o = setTimeout(m, 0));
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
|
-
const
|
|
105
|
-
function
|
|
105
|
+
const b = 50, Q = 10, V = /^\/collections\/([A-Za-z_][A-Za-z0-9_-]{0,127})$/;
|
|
106
|
+
function X(t) {
|
|
106
107
|
const s = t;
|
|
107
108
|
if ((s._method ?? "GET").toUpperCase() !== "GET" || q(s._params) !== "") return null;
|
|
108
|
-
const o =
|
|
109
|
+
const o = V.exec(s._path ?? "");
|
|
109
110
|
return o ? o[1] : null;
|
|
110
111
|
}
|
|
111
|
-
function
|
|
112
|
+
function ee() {
|
|
112
113
|
return Object.assign(new Error("Not found"), { status: 404, response: { error: "Not found" } });
|
|
113
114
|
}
|
|
114
|
-
function
|
|
115
|
+
function te(t) {
|
|
115
116
|
let s = !0, o = [], u;
|
|
116
117
|
const d = (r) => t.request(r.command).then(r.resolve, r.reject), m = async (r) => {
|
|
117
|
-
const c = [...new Set(r.map((
|
|
118
|
+
const c = [...new Set(r.map((i) => i.name))];
|
|
118
119
|
if (c.length === 1 || !s) {
|
|
119
|
-
for (const
|
|
120
|
+
for (const i of r) d(i);
|
|
120
121
|
return;
|
|
121
122
|
}
|
|
122
123
|
let n;
|
|
@@ -126,11 +127,11 @@ function F(t) {
|
|
|
126
127
|
_path: "/collections",
|
|
127
128
|
_params: { names: c.join(",") }
|
|
128
129
|
});
|
|
129
|
-
} catch (
|
|
130
|
-
const h =
|
|
130
|
+
} catch (i) {
|
|
131
|
+
const h = i == null ? void 0 : i.status;
|
|
131
132
|
if (h === 400 || h === 404 || h === 405) s = !1;
|
|
132
133
|
else if (h === 429 || h !== void 0 && h >= 500) {
|
|
133
|
-
for (const p of r) p.reject(
|
|
134
|
+
for (const p of r) p.reject(i);
|
|
134
135
|
return;
|
|
135
136
|
}
|
|
136
137
|
n = void 0;
|
|
@@ -138,13 +139,13 @@ function F(t) {
|
|
|
138
139
|
const e = n == null ? void 0 : n.data;
|
|
139
140
|
if (!e || typeof e != "object" || Array.isArray(e)) {
|
|
140
141
|
Array.isArray(e) && (s = !1);
|
|
141
|
-
for (const
|
|
142
|
+
for (const i of r) d(i);
|
|
142
143
|
return;
|
|
143
144
|
}
|
|
144
145
|
const l = e, f = new Set(Array.isArray(n == null ? void 0 : n.missing) ? n.missing : []);
|
|
145
|
-
for (const
|
|
146
|
-
Object.hasOwn(l,
|
|
147
|
-
},
|
|
146
|
+
for (const i of r)
|
|
147
|
+
Object.hasOwn(l, i.name) ? i.resolve({ data: T(l[i.name]) }) : f.has(i.name) ? i.reject(ee()) : d(i);
|
|
148
|
+
}, a = () => {
|
|
148
149
|
u = void 0;
|
|
149
150
|
const r = o;
|
|
150
151
|
o = [];
|
|
@@ -152,8 +153,8 @@ function F(t) {
|
|
|
152
153
|
for (const e of r) {
|
|
153
154
|
let l = n.get(e.name);
|
|
154
155
|
if (!l) {
|
|
155
|
-
const f = c[c.length - 1],
|
|
156
|
-
l = f &&
|
|
156
|
+
const f = c[c.length - 1], i = f ? new Set(f.map((h) => h.name)).size : b;
|
|
157
|
+
l = f && i < b ? f : [], l !== f && c.push(l), n.set(e.name, l);
|
|
157
158
|
}
|
|
158
159
|
l.push(e);
|
|
159
160
|
}
|
|
@@ -165,108 +166,125 @@ function F(t) {
|
|
|
165
166
|
command: r,
|
|
166
167
|
resolve: n,
|
|
167
168
|
reject: e
|
|
168
|
-
}), u === void 0 && (u = setTimeout(
|
|
169
|
+
}), u === void 0 && (u = setTimeout(a, Q));
|
|
169
170
|
});
|
|
170
171
|
}
|
|
171
|
-
const R = 3e3,
|
|
172
|
-
function
|
|
172
|
+
const R = 3e3, ne = /^\/(collections\/[A-Za-z_][A-Za-z0-9_-]*|field-config\/[A-Za-z_][A-Za-z0-9_-]*|collection-layouts(\/active|\/summary\/[A-Za-z_][A-Za-z0-9_-]*)?|chat\/room-types|users\/me)$/, se = /^\/(record-views|item-locks|drafts|presence|rum|comments|notifications|tasks|field-rules\/evaluate|chat\/(?!room-types)|field-config\/[^/]+\/(evaluate-visibility|evaluate-defaults|evaluate-lock|cascade|project)$|items\/(?!nivaro_|directus_)[^/]+|users\/cards$|files\/verify$)/;
|
|
173
|
+
function oe(t) {
|
|
173
174
|
const s = (t._path ?? "").split("?")[0];
|
|
174
|
-
return (t._method ?? "GET").toUpperCase() === "POST" &&
|
|
175
|
+
return (t._method ?? "GET").toUpperCase() === "POST" && I.test(s) ? !0 : se.test(s);
|
|
175
176
|
}
|
|
176
|
-
function
|
|
177
|
+
function re(t) {
|
|
177
178
|
const s = t;
|
|
178
|
-
if (!
|
|
179
|
+
if (!A(s) || !ne.test(s._path ?? "")) return !1;
|
|
179
180
|
const o = s._params;
|
|
180
181
|
return !(o && o.item != null && /^\/collection-layouts\/active$/.test(s._path ?? ""));
|
|
181
182
|
}
|
|
182
|
-
let
|
|
183
|
-
function
|
|
184
|
-
|
|
183
|
+
let y = 0;
|
|
184
|
+
function k() {
|
|
185
|
+
y++;
|
|
185
186
|
}
|
|
186
|
-
function
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
function G(t, s) {
|
|
188
|
+
return t.then(
|
|
189
|
+
(o) => (s && Z(), o),
|
|
190
|
+
(o) => {
|
|
191
|
+
throw U(o, s) && x(s), o;
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
function le(t, s = {}) {
|
|
196
|
+
if (B(t)) return t;
|
|
197
|
+
const o = /* @__PURE__ */ new Map(), u = s.batchReads ? J(t) : null, d = s.batchCollections === !1 ? null : te(t), m = /* @__PURE__ */ new Map();
|
|
198
|
+
let a = y;
|
|
190
199
|
const r = (n, e, l) => {
|
|
191
|
-
if (e !==
|
|
192
|
-
|
|
200
|
+
if (e !== y) return;
|
|
201
|
+
a !== y && (m.clear(), a = y);
|
|
193
202
|
const f = Date.now();
|
|
194
|
-
for (const [
|
|
203
|
+
for (const [i, h] of m) f - h.at >= R && m.delete(i);
|
|
195
204
|
m.set(n, { at: f, epoch: e, value: l });
|
|
196
205
|
}, c = (n) => {
|
|
197
206
|
const e = n;
|
|
198
|
-
if (!
|
|
199
|
-
|
|
200
|
-
const _ = !
|
|
201
|
-
_ &&
|
|
202
|
-
const w = t.request(n);
|
|
203
|
-
return (_ ? w.finally(
|
|
207
|
+
if (!A(e)) {
|
|
208
|
+
C(e._method, e._path, e._body);
|
|
209
|
+
const _ = !oe(e);
|
|
210
|
+
_ && k();
|
|
211
|
+
const w = G(t.request(n), !1);
|
|
212
|
+
return (_ ? w.finally(k) : w).then((S) => (C(e._method, e._path, e._body, S), S));
|
|
204
213
|
}
|
|
205
|
-
const l =
|
|
214
|
+
const l = P(e), f = re(e);
|
|
206
215
|
if (f) {
|
|
207
216
|
const _ = m.get(l);
|
|
208
|
-
if (_ && _.epoch ===
|
|
217
|
+
if (_ && _.epoch === y && Date.now() - _.at < R)
|
|
209
218
|
return Promise.resolve(T(_.value));
|
|
210
219
|
}
|
|
211
|
-
const
|
|
212
|
-
if (
|
|
213
|
-
const h =
|
|
214
|
-
|
|
220
|
+
const i = o.get(l);
|
|
221
|
+
if (i) return i.then(T);
|
|
222
|
+
const h = D(e._method, e._path, e._params);
|
|
223
|
+
if (h && !M()) return Promise.reject($());
|
|
224
|
+
const p = u ? Y(e) : null, E = !p && d ? X(e) : null, L = G(
|
|
225
|
+
p && u ? u(n, p) : E && d ? d(n, E) : t.request(n),
|
|
226
|
+
h
|
|
227
|
+
), N = y, g = L.then((_) => (f && r(l, N, T(_)), _)).finally(() => {
|
|
228
|
+
o.get(l) === g && o.delete(l);
|
|
215
229
|
});
|
|
216
|
-
return o.set(l,
|
|
230
|
+
return o.set(l, g), g;
|
|
217
231
|
};
|
|
218
232
|
return new Proxy(t, {
|
|
219
233
|
get(n, e, l) {
|
|
220
234
|
if (e === "request") return c;
|
|
221
|
-
if (e ===
|
|
235
|
+
if (e === j) return !0;
|
|
236
|
+
if (e === "setToken" && typeof n.setToken == "function")
|
|
237
|
+
return (i) => {
|
|
238
|
+
n.setToken(i), z();
|
|
239
|
+
};
|
|
222
240
|
const f = Reflect.get(n, e, l);
|
|
223
241
|
return typeof f == "function" ? f.bind(n) : f;
|
|
224
242
|
}
|
|
225
243
|
});
|
|
226
244
|
}
|
|
227
|
-
const
|
|
228
|
-
function
|
|
229
|
-
for (const t of [...
|
|
245
|
+
const ie = /^\/(item-locks|drafts|auth)\b/, v = /* @__PURE__ */ new Set();
|
|
246
|
+
function ae() {
|
|
247
|
+
for (const t of [...v]) t();
|
|
230
248
|
}
|
|
231
|
-
function
|
|
249
|
+
function fe(t) {
|
|
232
250
|
return t.subscribe((s) => {
|
|
233
|
-
s.type === "observerAdded" && s.query.state.fetchStatus === "fetching" &&
|
|
251
|
+
s.type === "observerAdded" && s.query.state.fetchStatus === "fetching" && v.size !== 0 && ae();
|
|
234
252
|
});
|
|
235
253
|
}
|
|
236
|
-
function
|
|
254
|
+
function de(t, s = {}) {
|
|
237
255
|
let o = s.open ?? !0, u;
|
|
238
256
|
const d = /* @__PURE__ */ new Map(), m = () => {
|
|
239
257
|
const n = [...d.values()];
|
|
240
258
|
d.clear();
|
|
241
259
|
for (const e of n) e.release();
|
|
242
|
-
},
|
|
243
|
-
|
|
260
|
+
}, a = () => {
|
|
261
|
+
v.delete(a), m();
|
|
244
262
|
}, r = (n) => {
|
|
245
263
|
const e = n;
|
|
246
|
-
if (o || !
|
|
247
|
-
const l =
|
|
264
|
+
if (o || !H(e) || ie.test(e._path ?? "")) return t.request(n);
|
|
265
|
+
const l = P(e), f = d.get(l);
|
|
248
266
|
if (f) return f.promise.then(T);
|
|
249
|
-
let
|
|
267
|
+
let i = () => {
|
|
250
268
|
};
|
|
251
|
-
const p = new Promise((
|
|
252
|
-
|
|
269
|
+
const p = new Promise((E) => {
|
|
270
|
+
i = E;
|
|
253
271
|
}).then(() => t.request(n));
|
|
254
|
-
return d.set(l, { promise: p, release:
|
|
272
|
+
return d.set(l, { promise: p, release: i }), v.add(a), p;
|
|
255
273
|
};
|
|
256
274
|
return new Proxy(t, {
|
|
257
275
|
get(n, e, l) {
|
|
258
276
|
if (e === "request") return r;
|
|
259
277
|
if (e === "open") return o;
|
|
260
278
|
if (e === "setOpen")
|
|
261
|
-
return (
|
|
279
|
+
return (i) => {
|
|
262
280
|
u !== void 0 && (clearTimeout(u), u = void 0);
|
|
263
281
|
const h = o;
|
|
264
|
-
o =
|
|
282
|
+
o = i, i && !h && (v.delete(a), m());
|
|
265
283
|
};
|
|
266
284
|
if (e === "dispose")
|
|
267
285
|
return () => {
|
|
268
286
|
u === void 0 && (u = setTimeout(() => {
|
|
269
|
-
u = void 0, o = !0,
|
|
287
|
+
u = void 0, o = !0, v.delete(a), m();
|
|
270
288
|
}, 0));
|
|
271
289
|
};
|
|
272
290
|
const f = Reflect.get(n, e, l);
|
|
@@ -275,17 +293,17 @@ function ne(t, s = {}) {
|
|
|
275
293
|
});
|
|
276
294
|
}
|
|
277
295
|
export {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
296
|
+
O as BATCH_READ_LIMIT,
|
|
297
|
+
b as COLLECTION_BATCH_LIMIT,
|
|
298
|
+
Q as COLLECTION_BATCH_WINDOW_MS,
|
|
281
299
|
R as SETTLED_READ_MS,
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
300
|
+
X as batchableCollectionMeta,
|
|
301
|
+
Y as batchableRead,
|
|
302
|
+
de as createGatedClient,
|
|
303
|
+
k as forgetSettledReads,
|
|
304
|
+
B as isCoalesced,
|
|
305
|
+
re as isSettledRead,
|
|
306
|
+
ae as releaseGatedReads,
|
|
307
|
+
fe as releaseGatedReadsOnSharedFetch,
|
|
308
|
+
le as withGetCoalescing
|
|
291
309
|
};
|
package/dist/shared/lib/rum.js
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { isSignedOut as E, isSignedOutError as T, noteUnauthorized as k } from "./signed-out.js";
|
|
2
|
+
let m = !1, v, d = (e) => e;
|
|
3
|
+
const o = [];
|
|
4
|
+
let h = null, p = "/api", f, w = null, c = 0, g = null;
|
|
4
5
|
function y(e) {
|
|
5
6
|
const t = e.tagName.toLowerCase(), n = (e.textContent ?? "").trim().slice(0, 40), r = e.getAttribute("aria-label"), i = e.getAttribute("data-testid");
|
|
6
7
|
return `${t}${i ? `[${i}]` : ""}${r ? ` '${r}'` : n ? ` '${n}'` : ""}`;
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
+
function _(e) {
|
|
9
10
|
typeof window > "u" || window.addEventListener(
|
|
10
11
|
"click",
|
|
11
12
|
(t) => {
|
|
12
13
|
const n = t.target instanceof Element ? t.target.closest('button, a, [role="button"], input, [data-testid]') : null;
|
|
13
|
-
n && (n === w ? (
|
|
14
|
+
n && (n === w ? (c++, c === 3 && (s({
|
|
14
15
|
kind: "rage",
|
|
15
16
|
route: `${e()} :: ${y(n)}`.slice(0, 300),
|
|
16
|
-
duration_ms:
|
|
17
|
-
}),
|
|
18
|
-
w = null,
|
|
17
|
+
duration_ms: c
|
|
18
|
+
}), u())) : (w = n, c = 1), g && clearTimeout(g), g = setTimeout(() => {
|
|
19
|
+
w = null, c = 0;
|
|
19
20
|
}, 600));
|
|
20
21
|
},
|
|
21
22
|
{ capture: !0, passive: !0 }
|
|
22
23
|
);
|
|
23
24
|
}
|
|
24
|
-
const
|
|
25
|
-
function
|
|
25
|
+
const $ = 1e3, M = 1e4, b = 3;
|
|
26
|
+
function D(e = b, t = M) {
|
|
26
27
|
let n = [];
|
|
27
28
|
return (r) => (n = n.filter((i) => r - i < t), n.push(r), n.length >= e ? (n = [], !0) : !1);
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
+
function A(e) {
|
|
30
31
|
if (typeof window > "u" || typeof MutationObserver > "u") return;
|
|
31
|
-
const t =
|
|
32
|
+
const t = D();
|
|
32
33
|
window.addEventListener(
|
|
33
34
|
"click",
|
|
34
35
|
(n) => {
|
|
@@ -54,15 +55,19 @@ function $(e) {
|
|
|
54
55
|
kind: "dead",
|
|
55
56
|
route: `${e()} :: ${y(r)}`.slice(0, 300),
|
|
56
57
|
duration_ms: b
|
|
57
|
-
}),
|
|
58
|
-
},
|
|
58
|
+
}), u());
|
|
59
|
+
}, $);
|
|
59
60
|
},
|
|
60
61
|
{ capture: !0, passive: !0 }
|
|
61
62
|
);
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
-
if (
|
|
65
|
-
|
|
64
|
+
function u() {
|
|
65
|
+
if (o.length === 0) return;
|
|
66
|
+
if (E()) {
|
|
67
|
+
o.length = 0;
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const e = JSON.stringify({ events: o.splice(0, o.length) });
|
|
66
71
|
try {
|
|
67
72
|
const t = f == null ? void 0 : f();
|
|
68
73
|
!t && typeof navigator.sendBeacon == "function" && navigator.sendBeacon(`${p}/rum`, new Blob([e], { type: "application/json" })) || fetch(`${p}/rum`, {
|
|
@@ -74,22 +79,26 @@ function o() {
|
|
|
74
79
|
},
|
|
75
80
|
body: e,
|
|
76
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);
|
|
77
86
|
}).catch(() => {
|
|
78
87
|
});
|
|
79
88
|
} catch {
|
|
80
89
|
}
|
|
81
90
|
}
|
|
82
91
|
function s(e) {
|
|
83
|
-
|
|
92
|
+
o.push({
|
|
84
93
|
...e,
|
|
85
94
|
app: v,
|
|
86
95
|
vw: typeof window > "u" ? void 0 : window.innerWidth
|
|
87
|
-
}),
|
|
96
|
+
}), o.length >= 10 ? u() : (h && clearTimeout(h), h = setTimeout(u, 1e4));
|
|
88
97
|
}
|
|
89
|
-
const
|
|
90
|
-
function
|
|
91
|
-
if (!m || !
|
|
92
|
-
const t = e.roleId &&
|
|
98
|
+
const C = /^[A-Za-z0-9._:-]{1,80}$/, B = /^[0-9A-Fa-f-]{36}$/;
|
|
99
|
+
function O(e) {
|
|
100
|
+
if (!m || !C.test(e.key)) return;
|
|
101
|
+
const t = e.roleId && B.test(e.roleId) ? e.roleId.toUpperCase() : void 0;
|
|
93
102
|
s({
|
|
94
103
|
kind: "widget",
|
|
95
104
|
route: `widget:${e.key}`,
|
|
@@ -99,19 +108,19 @@ function A(e) {
|
|
|
99
108
|
paint_ms: Math.max(0, Math.round(e.paintMs))
|
|
100
109
|
});
|
|
101
110
|
}
|
|
102
|
-
function
|
|
111
|
+
function S(e) {
|
|
103
112
|
if (!m || typeof window > "u") return;
|
|
104
113
|
const t = performance.now();
|
|
105
114
|
requestAnimationFrame(() => {
|
|
106
115
|
requestAnimationFrame(() => {
|
|
107
116
|
const n = Math.round(performance.now() - t);
|
|
108
|
-
s({ route:
|
|
117
|
+
s({ route: d(e), kind: "route", duration_ms: n });
|
|
109
118
|
});
|
|
110
119
|
});
|
|
111
120
|
}
|
|
112
|
-
function
|
|
121
|
+
function I(e) {
|
|
113
122
|
if (m || typeof window > "u" || typeof performance > "u") return;
|
|
114
|
-
m = !0, v = e == null ? void 0 : e.app, e != null && e.routePattern && (
|
|
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));
|
|
115
124
|
const t = performance.getEntriesByType("navigation")[0];
|
|
116
125
|
let n = null;
|
|
117
126
|
try {
|
|
@@ -124,23 +133,23 @@ function B(e) {
|
|
|
124
133
|
setTimeout(() => {
|
|
125
134
|
const i = performance.getEntriesByName("first-contentful-paint")[0];
|
|
126
135
|
s({
|
|
127
|
-
route:
|
|
136
|
+
route: d(window.location.pathname),
|
|
128
137
|
kind: "load",
|
|
129
138
|
ttfb_ms: t ? Math.round(t.responseStart) : void 0,
|
|
130
139
|
fcp_ms: i ? Math.round(i.startTime) : void 0,
|
|
131
140
|
lcp_ms: n ?? void 0,
|
|
132
141
|
duration_ms: t ? Math.round(t.loadEventEnd || t.domContentLoadedEventEnd) : void 0
|
|
133
142
|
});
|
|
134
|
-
}, 6e3), window.addEventListener("pagehide",
|
|
135
|
-
document.visibilityState === "hidden" &&
|
|
143
|
+
}, 6e3), window.addEventListener("pagehide", u), document.addEventListener("visibilitychange", () => {
|
|
144
|
+
document.visibilityState === "hidden" && u();
|
|
136
145
|
});
|
|
137
146
|
}
|
|
138
147
|
export {
|
|
139
148
|
b as DEAD_BURST,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
149
|
+
$ as DEAD_WAIT_MS,
|
|
150
|
+
M as DEAD_WINDOW_MS,
|
|
151
|
+
D as createDeadClickCounter,
|
|
152
|
+
S as rumRouteChange,
|
|
153
|
+
O as rumWidget,
|
|
154
|
+
I as startRum
|
|
146
155
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { reportClientCrash as a } from "./client-crash.js";
|
|
2
|
+
const u = "Something went wrong — it’s been reported", c = /failed to fetch|load failed|networkerror|network request failed|network error/i;
|
|
3
|
+
function l(t) {
|
|
4
|
+
var s;
|
|
5
|
+
const r = t, e = (r == null ? void 0 : r.status) ?? ((s = r == null ? void 0 : r.response) == null ? void 0 : s.status);
|
|
6
|
+
return typeof e == "number" ? e : null;
|
|
7
|
+
}
|
|
8
|
+
function f(t) {
|
|
9
|
+
return !(t instanceof Error) || l(t) != null || t.response != null || c.test(t.message) ? !1 : t instanceof TypeError || t instanceof ReferenceError || t instanceof RangeError;
|
|
10
|
+
}
|
|
11
|
+
const d = /^(bad request|unauthorized|forbidden|not found|conflict|unprocessable entity|too many requests|internal server error|bad gateway|service unavailable|gateway timeout)$/i;
|
|
12
|
+
function m(t) {
|
|
13
|
+
var s;
|
|
14
|
+
const r = t, e = [(s = r == null ? void 0 : r.response) == null ? void 0 : s.data, r == null ? void 0 : r.response];
|
|
15
|
+
for (const o of e) {
|
|
16
|
+
const n = o == null ? void 0 : o.error;
|
|
17
|
+
if (typeof n == "string" && n.trim() && !d.test(n.trim())) return n.trim();
|
|
18
|
+
}
|
|
19
|
+
for (const o of e) {
|
|
20
|
+
const n = o == null ? void 0 : o.message;
|
|
21
|
+
if (typeof n == "string" && n.trim()) return n.trim();
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
function g(t, r = "Failed") {
|
|
26
|
+
const e = m(t);
|
|
27
|
+
return e || (f(t) ? u : t instanceof Error ? t.message || r : typeof t == "string" && t.trim() ? t : r);
|
|
28
|
+
}
|
|
29
|
+
const i = /* @__PURE__ */ new WeakSet();
|
|
30
|
+
function E(t, r) {
|
|
31
|
+
!t || !f(r) || i.has(r) || (i.add(r), a(t, r, null).catch(() => {
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
u as SOMETHING_WENT_WRONG,
|
|
36
|
+
f as isCodeError,
|
|
37
|
+
E as reportCodeError,
|
|
38
|
+
g as userErrorMessage
|
|
39
|
+
};
|
|
@@ -3,19 +3,23 @@ const i = 1e3;
|
|
|
3
3
|
function o() {
|
|
4
4
|
return Date.now() + s;
|
|
5
5
|
}
|
|
6
|
-
function f(
|
|
7
|
-
s
|
|
6
|
+
function f() {
|
|
7
|
+
return s;
|
|
8
8
|
}
|
|
9
9
|
function u(t) {
|
|
10
|
+
s = Number.isFinite(t) && Math.abs(t) >= i ? Math.round(t) : 0;
|
|
11
|
+
}
|
|
12
|
+
function c(t) {
|
|
10
13
|
let e = null;
|
|
11
|
-
for (const
|
|
12
|
-
const
|
|
13
|
-
!Number.isFinite(
|
|
14
|
+
for (const r of t) {
|
|
15
|
+
const n = r.received - r.sent;
|
|
16
|
+
!Number.isFinite(n) || n < 0 || !Number.isFinite(r.server) || (!e || n < e.received - e.sent) && (e = r);
|
|
14
17
|
}
|
|
15
18
|
return e ? e.server - (e.sent + (e.received - e.sent) / 2) : null;
|
|
16
19
|
}
|
|
17
20
|
export {
|
|
18
|
-
|
|
21
|
+
c as measureClockOffset,
|
|
22
|
+
f as serverClockOffset,
|
|
19
23
|
o as serverNow,
|
|
20
|
-
|
|
24
|
+
u as setServerClockOffset
|
|
21
25
|
};
|