@nivaro/react 0.3.99 → 0.3.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useFormSchema.js +82 -85
- package/dist/hooks/useSessionRecorder.js +206 -175
- package/dist/index.d.ts +84 -16
- package/dist/index.js +627 -622
- package/dist/lib/commands.js +15 -11
- package/dist/shared/components/ActivityEntry.js +5 -5
- package/dist/shared/components/CollectionBrowserView.js +516 -503
- package/dist/shared/components/ItemEditForm.js +3471 -3465
- package/dist/shared/components/JobsTray.js +76 -61
- package/dist/shared/components/MyWorkView.js +133 -126
- package/dist/shared/components/NotificationBell.js +322 -289
- package/dist/shared/components/RecordCompare.js +38 -40
- package/dist/shared/components/RecordReadView.js +119 -119
- package/dist/shared/components/TipLayer.js +56 -41
- package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
- package/dist/shared/components/integrations/console/SignalCard.js +40 -40
- package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +95 -73
- package/dist/shared/components/integrations/console/drill/status.js +23 -18
- package/dist/shared/components/item-edit/InlineGridField.js +45 -45
- package/dist/shared/components/item-edit/InlineTableField.js +750 -749
- package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
- package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
- package/dist/shared/components/item-edit/RecordInsights.js +86 -86
- package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
- package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
- package/dist/shared/components/item-edit/header-path-preview.js +46 -34
- package/dist/shared/components/item-edit/related-missing.js +75 -19
- package/dist/shared/components/notifications/DeliveryChips.js +1 -2
- package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
- package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
- package/dist/shared/components/panels/BackgroundMove.js +242 -0
- package/dist/shared/components/panels/MoveAdvisory.js +204 -0
- package/dist/shared/components/panels/PipelinePanel.js +1459 -1220
- package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
- package/dist/shared/components/profile/ActivityFeedCard.js +322 -0
- package/dist/shared/components/profile/DayTimeline.js +145 -140
- package/dist/shared/components/profile/PersonAccess.js +679 -383
- package/dist/shared/components/profile/PersonActivity.js +404 -427
- package/dist/shared/components/profile/PersonDidPanel.js +248 -134
- package/dist/shared/components/profile/PersonProfile.js +33 -32
- package/dist/shared/components/profile/journey-view.js +166 -0
- package/dist/shared/lib/activity-sentence.js +319 -236
- package/dist/shared/lib/commands.js +18 -14
- package/dist/shared/lib/error-hints.js +1 -1
- package/dist/shared/lib/job-failure-text.js +12 -0
- package/dist/shared/lib/jobs-tray.js +60 -41
- package/dist/shared/lib/move-failure.js +19 -0
- package/dist/shared/lib/obligation-banner.js +22 -21
- package/dist/shared/lib/partner-failure.js +83 -0
- package/dist/shared/lib/prefetch.js +73 -73
- package/dist/shared/lib/replay-checkout.js +18 -13
- package/dist/shared/lib/replay-context.js +90 -77
- package/dist/shared/lib/replay-idle.js +21 -0
- package/dist/shared/lib/replay-socket.js +21 -17
- package/dist/shared/lib/rum.js +56 -51
- package/dist/shared/lib/safe-error.js +17 -13
- package/dist/shared/lib/stale-chunk.js +69 -26
- package/dist/shared/lib/system-collections.js +20 -0
- package/package.json +1 -1
|
@@ -1,90 +1,91 @@
|
|
|
1
|
-
import { endSessionRecording as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { sessionStore as
|
|
4
|
-
import { useAutoRecord as
|
|
5
|
-
import { useOptionalNivaroClient as
|
|
6
|
-
import { normalizeReplayMasking as
|
|
7
|
-
import { normalizeReplaySampling as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { endSessionRecording as M, appendSessionRecordingEvents as te, sessionRecordingEnabled as pe, startSessionRecording as q } from "@nivaro/sdk";
|
|
2
|
+
import { useRef as he, useEffect as me } from "react";
|
|
3
|
+
import { sessionStore as we, sharedChunkStore as ye, ReplayUploader as ge, clearResume as N, ORPHAN_TTL_MS as ve, readResume as Re, isResumable as be, splitBySize as re, writeResume as Se, KEEPALIVE_CHUNK_BYTES as ke, CHUNK_BYTES as Ie, backoffDelay as Ae, errorStatus as Ee, clipChunkFailure as Ce } from "./replayUploadQueue.js";
|
|
4
|
+
import { useAutoRecord as _e } from "./useAutoRecord.js";
|
|
5
|
+
import { useOptionalNivaroClient as De } from "../shared/context.js";
|
|
6
|
+
import { normalizeReplayMasking as x, buildReplayMaskingOptions as j } from "../shared/lib/replay-masking.js";
|
|
7
|
+
import { normalizeReplaySampling as G, replaySampleDraw as Te, currentReplayRoute as L, isReplayRouteSampled as J, attributeChunkRoutes as ne } from "../shared/lib/replay-sampling.js";
|
|
8
|
+
import { noteReplayIdle as qe, createReplayIdleState as Le, REPLAY_IDLE_RESTART_MS as Pe } from "../shared/lib/replay-idle.js";
|
|
9
|
+
import { noteReplayEvent as Fe, createReplayCheckoutState as Me } from "../shared/lib/replay-checkout.js";
|
|
10
|
+
import { emitReplayTap as Ne, setReplayRecorderMode as O, registerReplayCapture as Oe, clipEndOffset as Ue, withClipKind as We } from "../shared/lib/replay-capture.js";
|
|
11
|
+
import { instrumentConsole as He, instrumentRequests as Ke, redactSecrets as $e } from "../shared/lib/replay-context.js";
|
|
12
|
+
import { instrumentSocket as Be } from "../shared/lib/replay-socket.js";
|
|
13
|
+
const ze = "nivaro-react@0.3.101", Q = 1e4, Ye = 150, xe = 3e3, je = 600, Ge = (o) => `nvr_replay_resume${o ? `:${o}` : ""}`, V = () => typeof navigator > "u" || navigator.onLine !== !1;
|
|
14
|
+
function Je(o) {
|
|
15
|
+
return typeof o.url != "string" || typeof fetch != "function" ? null : (f, u) => {
|
|
16
|
+
const l = typeof o.getToken == "function" ? o.getToken() : void 0, d = { "Content-Type": "application/json" };
|
|
17
|
+
return l && (d.Authorization = `Bearer ${l}`), fetch(`${o.url}/api/session-recordings/${f}/events`, {
|
|
17
18
|
method: "POST",
|
|
18
19
|
keepalive: !0,
|
|
19
|
-
credentials:
|
|
20
|
+
credentials: l ? "omit" : "include",
|
|
20
21
|
headers: d,
|
|
21
|
-
body:
|
|
22
|
+
body: u
|
|
22
23
|
});
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
|
-
async function
|
|
26
|
-
const
|
|
27
|
-
for (const [
|
|
28
|
-
const
|
|
26
|
+
async function Qe(o, f, u, l, d) {
|
|
27
|
+
const c = re(l), { routes: S } = ne(c, d.startRoute);
|
|
28
|
+
for (const [a, e] of c.entries()) {
|
|
29
|
+
const h = u();
|
|
29
30
|
try {
|
|
30
|
-
await
|
|
31
|
-
|
|
32
|
-
route:
|
|
31
|
+
await o.request(
|
|
32
|
+
te(f, h, e, {
|
|
33
|
+
route: S[a],
|
|
33
34
|
...d.build ? { build: d.build } : {}
|
|
34
35
|
})
|
|
35
36
|
);
|
|
36
|
-
} catch (
|
|
37
|
-
const b =
|
|
37
|
+
} catch (R) {
|
|
38
|
+
const b = Ee(R);
|
|
38
39
|
if (Ce(b) === "stop") return "closed";
|
|
39
|
-
b === 413 && console.warn(`[session-recorder] chunk ${
|
|
40
|
+
b === 413 && console.warn(`[session-recorder] chunk ${h} too large — dropped`);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
return "ok";
|
|
43
44
|
}
|
|
44
|
-
const
|
|
45
|
-
let
|
|
46
|
-
async function
|
|
47
|
-
if (!
|
|
45
|
+
const Ve = 3e4, Xe = 3e4;
|
|
46
|
+
let X = !1, v = null, E = null;
|
|
47
|
+
async function Ze(o = "error") {
|
|
48
|
+
if (!E) return null;
|
|
48
49
|
try {
|
|
49
50
|
return await Promise.race([
|
|
50
|
-
|
|
51
|
+
E(o),
|
|
51
52
|
new Promise((f) => setTimeout(() => f(null), 4e3))
|
|
52
53
|
]);
|
|
53
54
|
} catch {
|
|
54
55
|
return null;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
|
-
async function
|
|
58
|
+
async function Z() {
|
|
58
59
|
try {
|
|
59
60
|
return (await import("rrweb")).record;
|
|
60
61
|
} catch {
|
|
61
|
-
return
|
|
62
|
+
return X || (X = !0, console.warn(
|
|
62
63
|
"[nivaro] session recording is enabled on the instance but `rrweb` is not installed in this app — run `npm i rrweb` to record."
|
|
63
64
|
)), null;
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
-
const
|
|
67
|
+
function ee(o, f) {
|
|
68
|
+
const u = He(o), l = Ke(o), d = Be(o), c = () => {
|
|
68
69
|
f == null || f();
|
|
69
70
|
try {
|
|
70
|
-
|
|
71
|
-
path:
|
|
71
|
+
o("route", {
|
|
72
|
+
path: $e(window.location.pathname + window.location.search)
|
|
72
73
|
});
|
|
73
74
|
} catch {
|
|
74
75
|
}
|
|
75
|
-
},
|
|
76
|
+
}, S = history.pushState.bind(history), a = history.replaceState.bind(history);
|
|
76
77
|
return history.pushState = (...e) => {
|
|
77
|
-
|
|
78
|
+
S(...e), c();
|
|
78
79
|
}, history.replaceState = (...e) => {
|
|
79
|
-
|
|
80
|
-
}, window.addEventListener("popstate",
|
|
81
|
-
|
|
80
|
+
a(...e), c();
|
|
81
|
+
}, window.addEventListener("popstate", c), c(), () => {
|
|
82
|
+
u(), l(), d(), history.pushState = S, history.replaceState = a, window.removeEventListener("popstate", c);
|
|
82
83
|
};
|
|
83
84
|
}
|
|
84
|
-
function
|
|
85
|
-
const f =
|
|
86
|
-
|
|
87
|
-
const
|
|
85
|
+
function ft(o = {}) {
|
|
86
|
+
const f = De(), u = o.client ?? f, l = o.app, d = o.disabled ?? !1, c = o.build ?? ze;
|
|
87
|
+
_e({ client: u, disabled: d });
|
|
88
|
+
const S = he({
|
|
88
89
|
buffer: [],
|
|
89
90
|
stop: null,
|
|
90
91
|
uninstrument: null,
|
|
@@ -100,99 +101,111 @@ function st(n = {}) {
|
|
|
100
101
|
prevWindowRoute: "/",
|
|
101
102
|
sampled: !0
|
|
102
103
|
});
|
|
103
|
-
|
|
104
|
-
if (!
|
|
105
|
-
let
|
|
106
|
-
const e =
|
|
104
|
+
me(() => {
|
|
105
|
+
if (!u || d || typeof window > "u") return;
|
|
106
|
+
let a = !1;
|
|
107
|
+
const e = S.current;
|
|
107
108
|
e.dead = !1;
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
110
|
-
await
|
|
109
|
+
const h = u, R = we(), b = Ge(l), C = ye(), _ = Je(h), oe = async (t, r, i, w, y = {}) => {
|
|
110
|
+
if (!w || !_) {
|
|
111
|
+
await h.request(te(t, r, i, y));
|
|
111
112
|
return;
|
|
112
113
|
}
|
|
113
|
-
const
|
|
114
|
-
if (!
|
|
115
|
-
},
|
|
116
|
-
let
|
|
117
|
-
const
|
|
114
|
+
const g = await _(t, JSON.stringify({ seq: r, events: i, ...y }));
|
|
115
|
+
if (!g.ok) throw Object.assign(new Error(`HTTP ${g.status}`), { status: g.status });
|
|
116
|
+
}, n = new ge({ store: C, send: oe, online: V });
|
|
117
|
+
let k = null, D = 0;
|
|
118
|
+
const ie = () => document.readyState === "complete" && Date.now() - e.lastNavAt >= xe;
|
|
118
119
|
function I() {
|
|
119
|
-
|
|
120
|
-
recordingId:
|
|
121
|
-
nextSeq:
|
|
120
|
+
n.recordingId && Se(R, b, {
|
|
121
|
+
recordingId: n.recordingId,
|
|
122
|
+
nextSeq: n.nextSeq,
|
|
122
123
|
startedAt: e.startedAt,
|
|
123
124
|
lastActivityAt: Date.now()
|
|
124
125
|
});
|
|
125
126
|
}
|
|
126
|
-
function
|
|
127
|
-
|
|
127
|
+
function T() {
|
|
128
|
+
k && clearTimeout(k), k = null, D = 0;
|
|
128
129
|
}
|
|
129
|
-
function
|
|
130
|
-
|
|
131
|
-
const t =
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
function se() {
|
|
131
|
+
T();
|
|
132
|
+
const t = Ae(n.attempt);
|
|
133
|
+
D = Date.now() + t, k = setTimeout(() => {
|
|
134
|
+
k = null, D = 0, m(!0);
|
|
134
135
|
}, t);
|
|
135
136
|
}
|
|
136
|
-
function
|
|
137
|
+
function U() {
|
|
137
138
|
var t;
|
|
138
|
-
e.dead = !0, (t = e.stop) == null || t.call(e), e.stop = null, e.buffer = [],
|
|
139
|
+
e.dead = !0, (t = e.stop) == null || t.call(e), e.stop = null, e.buffer = [], T(), n.discard(), n.stopped = !0, N(R, b);
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
-
if (e.buffer.length === 0 || !
|
|
141
|
+
function W(t) {
|
|
142
|
+
if (e.buffer.length === 0 || !n.recordingId) return;
|
|
142
143
|
const r = e.buffer;
|
|
143
144
|
e.buffer = [];
|
|
144
|
-
const i =
|
|
145
|
-
for (const [
|
|
146
|
-
|
|
145
|
+
const i = re(r, t ? ke : Ie), { routes: w } = ne(i, e.bufferRoute);
|
|
146
|
+
for (const [y, g] of i.entries())
|
|
147
|
+
n.enqueue(g, { route: w[y], ...c ? { build: c } : {} });
|
|
147
148
|
I();
|
|
148
149
|
}
|
|
149
|
-
async function
|
|
150
|
-
if (!
|
|
151
|
-
if (t === "retry")
|
|
152
|
-
else if (t === "closed" || t === "abandoned")
|
|
150
|
+
async function ae(t) {
|
|
151
|
+
if (!a) {
|
|
152
|
+
if (t === "retry") se();
|
|
153
|
+
else if (t === "closed" || t === "abandoned") U();
|
|
153
154
|
else if (t === "stale")
|
|
154
155
|
try {
|
|
155
|
-
const r = await
|
|
156
|
-
if (
|
|
157
|
-
|
|
156
|
+
const r = await h.request(q(l));
|
|
157
|
+
if (a) return;
|
|
158
|
+
n.rebase(r.data.id), e.startedAt = Date.now(), I(), e.flushAfter = !0;
|
|
158
159
|
} catch {
|
|
159
|
-
|
|
160
|
+
U();
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
164
|
function m(t = !1, r = !1) {
|
|
164
|
-
return e.inFlight ? (t && (e.flushAfter = !0), e.inFlight) : e.dead || !
|
|
165
|
+
return e.inFlight ? (t && (e.flushAfter = !0), e.inFlight) : e.dead || !n.recordingId || !t && !ie() && e.buffer.length < je || (W(r), !n.hasPending() || Date.now() < D) ? Promise.resolve() : (e.inFlight = n.drain(r).then(ae).catch(() => {
|
|
165
166
|
}).finally(() => {
|
|
166
167
|
e.inFlight = null, e.flushAfter && (e.flushAfter = !1, m(!0));
|
|
167
168
|
}), e.inFlight);
|
|
168
169
|
}
|
|
169
|
-
function
|
|
170
|
+
async function ue() {
|
|
171
|
+
const t = n.recordingId;
|
|
172
|
+
if (!(!t || e.dead) && (await m(!0).catch(() => {
|
|
173
|
+
}), !(a || e.dead || n.recordingId !== t || n.hasPending())))
|
|
174
|
+
try {
|
|
175
|
+
const r = await h.request(q(l));
|
|
176
|
+
if (a || e.dead) return;
|
|
177
|
+
h.request(M(t)).catch(() => {
|
|
178
|
+
}), n.begin(r.data.id), e.startedAt = Date.now(), I();
|
|
179
|
+
} catch {
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function H() {
|
|
170
183
|
const t = window.requestIdleCallback;
|
|
171
|
-
t ? t(() => void m(), { timeout:
|
|
184
|
+
t ? t(() => void m(), { timeout: Q }) : m();
|
|
172
185
|
}
|
|
173
|
-
async function
|
|
174
|
-
const t = await
|
|
175
|
-
if (
|
|
176
|
-
C.prune(Date.now() -
|
|
177
|
-
const r =
|
|
178
|
-
if (r &&
|
|
186
|
+
async function le() {
|
|
187
|
+
const t = await Z();
|
|
188
|
+
if (a || !t) return;
|
|
189
|
+
C.prune(Date.now() - ve);
|
|
190
|
+
const r = Re(R, b);
|
|
191
|
+
if (r && be(r, Date.now())) {
|
|
179
192
|
const s = await C.list(r.recordingId);
|
|
180
|
-
if (
|
|
181
|
-
|
|
193
|
+
if (a) return;
|
|
194
|
+
n.begin(r.recordingId, r.nextSeq, { trusted: !1, restored: s }), e.startedAt = r.startedAt;
|
|
182
195
|
} else {
|
|
183
|
-
r && (C.clear(r.recordingId),
|
|
184
|
-
const s = await
|
|
185
|
-
if (
|
|
186
|
-
|
|
196
|
+
r && (C.clear(r.recordingId), N(R, b));
|
|
197
|
+
const s = await h.request(q(l));
|
|
198
|
+
if (a) return;
|
|
199
|
+
n.begin(s.data.id), e.startedAt = Date.now();
|
|
187
200
|
}
|
|
188
201
|
I(), e.lastNavAt = Date.now();
|
|
189
|
-
const i =
|
|
190
|
-
e.route =
|
|
191
|
-
const
|
|
202
|
+
const i = Te(R);
|
|
203
|
+
e.route = L(), e.bufferRoute = e.route, e.sampled = J(F, e.route, i);
|
|
204
|
+
const w = () => {
|
|
192
205
|
var p;
|
|
193
|
-
e.route =
|
|
206
|
+
e.route = L();
|
|
194
207
|
const s = e.sampled;
|
|
195
|
-
if (e.sampled =
|
|
208
|
+
if (e.sampled = J(F, e.route, i), e.sampled && !s)
|
|
196
209
|
try {
|
|
197
210
|
(p = t.takeFullSnapshot) == null || p.call(
|
|
198
211
|
t,
|
|
@@ -200,128 +213,146 @@ function st(n = {}) {
|
|
|
200
213
|
);
|
|
201
214
|
} catch {
|
|
202
215
|
}
|
|
203
|
-
},
|
|
216
|
+
}, y = Me(), g = Le(), A = (s) => {
|
|
217
|
+
setTimeout(() => {
|
|
218
|
+
(async () => {
|
|
219
|
+
var p;
|
|
220
|
+
if (s >= Pe && await ue(), !(a || e.dead))
|
|
221
|
+
try {
|
|
222
|
+
(p = t.takeFullSnapshot) == null || p.call(t, !0);
|
|
223
|
+
} catch {
|
|
224
|
+
}
|
|
225
|
+
})();
|
|
226
|
+
}, 0);
|
|
227
|
+
};
|
|
204
228
|
e.stop = t({
|
|
205
229
|
emit(s) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
w.pending = !1;
|
|
230
|
+
const p = qe(g, s);
|
|
231
|
+
if (e.sampled) {
|
|
232
|
+
if (p !== "keep") {
|
|
233
|
+
p === "resume" && A(g.idleMs);
|
|
234
|
+
return;
|
|
212
235
|
}
|
|
213
|
-
|
|
236
|
+
e.buffer.length === 0 && (e.bufferRoute = e.route), e.buffer.push(s), e.buffer.length >= Ye && H(), Fe(y, s) && setTimeout(() => {
|
|
237
|
+
var Y;
|
|
238
|
+
try {
|
|
239
|
+
(Y = t.takeFullSnapshot) == null || Y.call(t, !0);
|
|
240
|
+
} catch {
|
|
241
|
+
y.pending = !1;
|
|
242
|
+
}
|
|
243
|
+
}, 0);
|
|
244
|
+
}
|
|
214
245
|
},
|
|
215
|
-
...
|
|
216
|
-
}) ?? null, e.uninstrument =
|
|
246
|
+
...j(() => P)
|
|
247
|
+
}) ?? null, e.uninstrument = ee(
|
|
217
248
|
(s, p) => t.addCustomEvent(
|
|
218
249
|
s,
|
|
219
250
|
p
|
|
220
251
|
),
|
|
221
252
|
() => {
|
|
222
|
-
e.lastNavAt = Date.now(),
|
|
253
|
+
e.lastNavAt = Date.now(), w();
|
|
223
254
|
}
|
|
224
|
-
),
|
|
225
|
-
if (!
|
|
255
|
+
), E = async () => {
|
|
256
|
+
if (!n.recordingId) return null;
|
|
226
257
|
const s = Date.now() - e.startedAt;
|
|
227
258
|
return await m(!0).catch(() => {
|
|
228
|
-
}),
|
|
229
|
-
},
|
|
230
|
-
if (!
|
|
259
|
+
}), n.recordingId ? { recording_id: n.recordingId, offset_ms: s } : null;
|
|
260
|
+
}, O("full"), v = () => {
|
|
261
|
+
if (!n.recordingId) return null;
|
|
231
262
|
const s = Date.now() - e.startedAt;
|
|
232
263
|
return async () => (await m(!0).catch(() => {
|
|
233
|
-
}),
|
|
264
|
+
}), n.recordingId ? { recording_id: n.recordingId, offset_ms: s } : null);
|
|
234
265
|
};
|
|
235
266
|
}
|
|
236
|
-
async function
|
|
237
|
-
const t = await
|
|
238
|
-
|
|
267
|
+
async function ce() {
|
|
268
|
+
const t = await Z();
|
|
269
|
+
a || !t || (e.buffer = [], e.prevWindow = [], e.route = L(), e.bufferRoute = e.route, e.prevWindowRoute = e.route, e.stop = t({
|
|
239
270
|
emit(r, i) {
|
|
240
|
-
|
|
271
|
+
Ne(r), i ? (e.prevWindow = e.buffer, e.prevWindowRoute = e.bufferRoute, e.buffer = [r], e.bufferRoute = e.route) : e.buffer.push(r);
|
|
241
272
|
},
|
|
242
|
-
...
|
|
243
|
-
checkoutEveryNms:
|
|
244
|
-
}) ?? null, e.uninstrument =
|
|
273
|
+
...j(() => P),
|
|
274
|
+
checkoutEveryNms: Ve
|
|
275
|
+
}) ?? null, e.uninstrument = ee(
|
|
245
276
|
(r, i) => t.addCustomEvent(
|
|
246
277
|
r,
|
|
247
278
|
i
|
|
248
279
|
),
|
|
249
280
|
() => {
|
|
250
|
-
e.route =
|
|
281
|
+
e.route = L();
|
|
251
282
|
}
|
|
252
|
-
),
|
|
253
|
-
const i = [...e.prevWindow, ...e.buffer],
|
|
254
|
-
if (i.length === 0 || !
|
|
255
|
-
const
|
|
283
|
+
), O("clip"), v = (r) => {
|
|
284
|
+
const i = [...e.prevWindow, ...e.buffer], w = e.prevWindow.length > 0 ? e.prevWindowRoute : e.bufferRoute;
|
|
285
|
+
if (i.length === 0 || !u) return null;
|
|
286
|
+
const y = Ue(i, r);
|
|
256
287
|
return async () => {
|
|
257
|
-
const
|
|
258
|
-
|
|
288
|
+
const A = (await u.request(
|
|
289
|
+
We(q(l ?? "error-clip", void 0, !0), r)
|
|
259
290
|
)).data.id;
|
|
260
|
-
let
|
|
261
|
-
return await
|
|
262
|
-
startRoute:
|
|
263
|
-
build:
|
|
264
|
-
}) === "ok" && await
|
|
265
|
-
}), { recording_id:
|
|
291
|
+
let s = 0;
|
|
292
|
+
return await Qe(u, A, () => s++, i, {
|
|
293
|
+
startRoute: w,
|
|
294
|
+
build: c
|
|
295
|
+
}) === "ok" && await u.request(M(A)).catch(() => {
|
|
296
|
+
}), { recording_id: A, offset_ms: y };
|
|
266
297
|
};
|
|
267
|
-
},
|
|
298
|
+
}, E = async (r) => {
|
|
268
299
|
if (r === "error") {
|
|
269
|
-
if (e.lastClip && Date.now() - e.lastClip.at <
|
|
300
|
+
if (e.lastClip && Date.now() - e.lastClip.at < Xe)
|
|
270
301
|
return e.lastClip.link;
|
|
271
302
|
e.lastClip = { at: Date.now(), link: null };
|
|
272
303
|
}
|
|
273
|
-
const i =
|
|
304
|
+
const i = v == null ? void 0 : v(r);
|
|
274
305
|
if (!i) return null;
|
|
275
|
-
const
|
|
276
|
-
return r === "error" && (e.lastClip = { at: Date.now(), link:
|
|
306
|
+
const w = await i();
|
|
307
|
+
return r === "error" && (e.lastClip = { at: Date.now(), link: w }), w;
|
|
277
308
|
});
|
|
278
309
|
}
|
|
279
|
-
let
|
|
280
|
-
async function
|
|
310
|
+
let K = !1, P = x(null), F = G(null);
|
|
311
|
+
async function de() {
|
|
281
312
|
try {
|
|
282
|
-
const t = await
|
|
283
|
-
if (
|
|
284
|
-
|
|
313
|
+
const t = await u.request(pe());
|
|
314
|
+
if (a) return;
|
|
315
|
+
P = x(t.data.masking), F = G(t.data.sampling);
|
|
285
316
|
const r = t.data.cap_reached === !0;
|
|
286
|
-
|
|
317
|
+
K = t.data.enabled === !0 && !r;
|
|
287
318
|
const i = t.data.enabled !== !0 && t.data.error_replay === !0 && !r;
|
|
288
|
-
|
|
319
|
+
K ? await le() : i && await ce();
|
|
289
320
|
} catch {
|
|
290
321
|
}
|
|
291
322
|
}
|
|
292
|
-
|
|
293
|
-
const
|
|
323
|
+
de();
|
|
324
|
+
const fe = setInterval(H, Q), $ = () => {
|
|
294
325
|
document.visibilityState === "hidden" && m(!0, !0);
|
|
295
326
|
};
|
|
296
|
-
document.addEventListener("visibilitychange",
|
|
297
|
-
const
|
|
298
|
-
if (!(e.dead || !
|
|
299
|
-
for (const { chunk: t, body: r } of
|
|
327
|
+
document.addEventListener("visibilitychange", $);
|
|
328
|
+
const B = () => {
|
|
329
|
+
if (!(e.dead || !n.recordingId) && (W(!0), I(), !(!V() || !_)))
|
|
330
|
+
for (const { chunk: t, body: r } of n.keepaliveBatch())
|
|
300
331
|
try {
|
|
301
|
-
|
|
332
|
+
_(t.recordingId, r).catch(() => {
|
|
302
333
|
});
|
|
303
334
|
} catch {
|
|
304
335
|
}
|
|
305
336
|
};
|
|
306
|
-
window.addEventListener("pagehide",
|
|
307
|
-
const
|
|
308
|
-
|
|
337
|
+
window.addEventListener("pagehide", B);
|
|
338
|
+
const z = () => {
|
|
339
|
+
T(), m(!0);
|
|
309
340
|
};
|
|
310
|
-
return window.addEventListener("online",
|
|
341
|
+
return window.addEventListener("online", z), () => {
|
|
311
342
|
var t, r;
|
|
312
|
-
|
|
313
|
-
const i =
|
|
314
|
-
i && (e.dead ||
|
|
315
|
-
}),
|
|
343
|
+
a = !0, E = null, v = null, O(null), document.removeEventListener("visibilitychange", $), window.removeEventListener("pagehide", B), window.removeEventListener("online", z), clearInterval(fe), T(), (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(() => {
|
|
344
|
+
const i = n.recordingId;
|
|
345
|
+
i && (e.dead || h.request(M(i)).catch(() => {
|
|
346
|
+
}), n.discard(), n.recordingId = null, N(R, b));
|
|
316
347
|
});
|
|
317
348
|
};
|
|
318
|
-
}, [
|
|
349
|
+
}, [u, d, l, c]);
|
|
319
350
|
}
|
|
320
|
-
|
|
321
|
-
(
|
|
322
|
-
(
|
|
351
|
+
Oe(
|
|
352
|
+
(o) => Ze(o),
|
|
353
|
+
(o) => (v == null ? void 0 : v(o)) ?? null
|
|
323
354
|
);
|
|
324
355
|
export {
|
|
325
|
-
|
|
326
|
-
|
|
356
|
+
Ze as captureErrorClip,
|
|
357
|
+
ft as useSessionRecorder
|
|
327
358
|
};
|