@extn/segi-js 0.2.15 → 0.2.17
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/README.md +81 -25
- package/dist/cdn.global.js +25 -25
- package/dist/index.d.mts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +117 -13
- package/dist/index.mjs +106 -2
- package/dist/replay/index.d.mts +6 -8
- package/dist/replay/index.d.ts +6 -8
- package/dist/replay/index.js +159 -43
- package/dist/replay/index.mjs +135 -19
- package/dist/{rrweb-O2KFXCVA.mjs → rrweb-I4V7NHNY.mjs} +4 -4
- package/dist/{rrweb-VXG3W6SS.js → rrweb-XVHLVZYC.js} +6 -6
- package/package.json +2 -1
package/dist/replay/index.js
CHANGED
|
@@ -10,14 +10,14 @@ function readReplayProgress(sessionUid) {
|
|
|
10
10
|
try {
|
|
11
11
|
const p = JSON.parse(sessionStorage.getItem(PROGRESS_KEY) || "null");
|
|
12
12
|
if (_optionalChain([p, 'optionalAccess', _ => _.sessionUid]) === sessionUid && Number.isFinite(Date.parse(p.startedAt)) && [p.clickCount, p.pagesVisited].every((n) => Number.isSafeInteger(n) && n >= 0)) return p;
|
|
13
|
-
} catch (
|
|
13
|
+
} catch (e2) {
|
|
14
14
|
}
|
|
15
15
|
return { sessionUid, startedAt: (/* @__PURE__ */ new Date()).toISOString(), clickCount: 0, pagesVisited: 0 };
|
|
16
16
|
}
|
|
17
17
|
function writeReplayProgress(progress) {
|
|
18
18
|
try {
|
|
19
19
|
sessionStorage.setItem(PROGRESS_KEY, JSON.stringify(progress));
|
|
20
|
-
} catch (
|
|
20
|
+
} catch (e3) {
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
function uuid() {
|
|
@@ -37,7 +37,7 @@ function readSession() {
|
|
|
37
37
|
const at = Number(_nullishCoalesce(sessionStorage.getItem(UID_TS_KEY), () => ( "0")));
|
|
38
38
|
if (!uid || !at) return null;
|
|
39
39
|
return { uid, at };
|
|
40
|
-
} catch (
|
|
40
|
+
} catch (e4) {
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -46,7 +46,7 @@ function writeSession(uid, at) {
|
|
|
46
46
|
if (typeof sessionStorage === "undefined") return;
|
|
47
47
|
sessionStorage.setItem(UID_KEY, uid);
|
|
48
48
|
sessionStorage.setItem(UID_TS_KEY, String(at));
|
|
49
|
-
} catch (
|
|
49
|
+
} catch (e5) {
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
function getOrCreateSessionUid() {
|
|
@@ -76,7 +76,7 @@ function getOrCreateAnonId() {
|
|
|
76
76
|
const fresh = uuid();
|
|
77
77
|
localStorage.setItem(ANON_KEY, fresh);
|
|
78
78
|
return fresh;
|
|
79
|
-
} catch (
|
|
79
|
+
} catch (e6) {
|
|
80
80
|
if (!memAnon) memAnon = uuid();
|
|
81
81
|
return memAnon;
|
|
82
82
|
}
|
|
@@ -88,11 +88,12 @@ function normalizeBase(endpoint) {
|
|
|
88
88
|
const raw = endpoint && endpoint.trim() || DEFAULT_API_BASE;
|
|
89
89
|
return raw.replace(/\/+$/, "").replace(/\/api\/ingest\/events$/, "").replace(/\/api\/ingest$/, "").replace(/\/api$/, "");
|
|
90
90
|
}
|
|
91
|
-
async function postTrace(cfg, path, body) {
|
|
91
|
+
async function postTrace(cfg, path, body, signal) {
|
|
92
92
|
const url = `${normalizeBase(cfg.endpoint)}/api/trace${path}`;
|
|
93
93
|
try {
|
|
94
94
|
const res = await fetch(url, {
|
|
95
95
|
method: "POST",
|
|
96
|
+
signal,
|
|
96
97
|
headers: {
|
|
97
98
|
"Content-Type": "application/json",
|
|
98
99
|
"X-Segi-Project-Key": cfg.projectKey
|
|
@@ -105,7 +106,7 @@ async function postTrace(cfg, path, body) {
|
|
|
105
106
|
// instead (separate API, no throw).
|
|
106
107
|
});
|
|
107
108
|
return res;
|
|
108
|
-
} catch (
|
|
109
|
+
} catch (e7) {
|
|
109
110
|
return null;
|
|
110
111
|
}
|
|
111
112
|
}
|
|
@@ -115,7 +116,7 @@ function beaconTrace(cfg, path, body) {
|
|
|
115
116
|
const url = `${normalizeBase(cfg.endpoint)}/api/trace${path}?pk=${encodeURIComponent(cfg.projectKey)}`;
|
|
116
117
|
const blob = new Blob([JSON.stringify(body)], { type: "application/json" });
|
|
117
118
|
return navigator.sendBeacon(url, blob);
|
|
118
|
-
} catch (
|
|
119
|
+
} catch (e8) {
|
|
119
120
|
return false;
|
|
120
121
|
}
|
|
121
122
|
}
|
|
@@ -133,7 +134,7 @@ async function gzipString(str) {
|
|
|
133
134
|
void writer.close();
|
|
134
135
|
const buf = await new Response(cs.readable).arrayBuffer();
|
|
135
136
|
return new Uint8Array(buf);
|
|
136
|
-
} catch (
|
|
137
|
+
} catch (e9) {
|
|
137
138
|
return null;
|
|
138
139
|
}
|
|
139
140
|
}
|
|
@@ -151,7 +152,12 @@ function saveProgress() {
|
|
|
151
152
|
});
|
|
152
153
|
}
|
|
153
154
|
function sendError(signal) {
|
|
154
|
-
if (!
|
|
155
|
+
if (!canCollect() || !active) return;
|
|
156
|
+
try {
|
|
157
|
+
if (isPathBlocked(active.options, new URL(_nullishCoalesce(signal.url, () => ( location.href)), location.href).pathname)) return;
|
|
158
|
+
} catch (e10) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
155
161
|
void postTrace(active.config, "/events", { events: [{
|
|
156
162
|
sessionUid: active.sessionUid,
|
|
157
163
|
ts: signal.ts,
|
|
@@ -172,7 +178,7 @@ function readQuery(name) {
|
|
|
172
178
|
if (typeof location === "undefined") return void 0;
|
|
173
179
|
try {
|
|
174
180
|
return _nullishCoalesce(new URLSearchParams(location.search).get(name), () => ( void 0));
|
|
175
|
-
} catch (
|
|
181
|
+
} catch (e11) {
|
|
176
182
|
return void 0;
|
|
177
183
|
}
|
|
178
184
|
}
|
|
@@ -180,14 +186,98 @@ function isPathBlocked(opts, path) {
|
|
|
180
186
|
const list = _nullishCoalesce(opts.blockRoutes, () => ( []));
|
|
181
187
|
return list.some((p) => path.startsWith(p));
|
|
182
188
|
}
|
|
189
|
+
var waiting = null;
|
|
190
|
+
var starting = false;
|
|
191
|
+
var configured = false;
|
|
192
|
+
var manualPaused = false;
|
|
193
|
+
function pathAllowed() {
|
|
194
|
+
return !!waiting && configured && !isPathBlocked(waiting.config.options, location.pathname);
|
|
195
|
+
}
|
|
196
|
+
function canCollect() {
|
|
197
|
+
return pathAllowed() && !!active && active.recordingEnabled && !active.paused && !active.replayBlocked;
|
|
198
|
+
}
|
|
199
|
+
async function startWhenAllowed() {
|
|
200
|
+
if (!waiting || active || starting || !pathAllowed() || manualPaused) return;
|
|
201
|
+
starting = true;
|
|
202
|
+
try {
|
|
203
|
+
await startReplay(waiting);
|
|
204
|
+
} finally {
|
|
205
|
+
starting = false;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
183
208
|
async function activateReplay(args) {
|
|
209
|
+
if (waiting || typeof window === "undefined" || args.config.options.enabled === false) return;
|
|
210
|
+
const sample = Math.max(0, Math.min(100, _nullishCoalesce(args.config.options.sample, () => ( 100))));
|
|
211
|
+
if (Math.random() * 100 >= sample) return;
|
|
212
|
+
waiting = args;
|
|
213
|
+
const epoch = activationEpoch;
|
|
214
|
+
const suspendExcluded = () => {
|
|
215
|
+
if (active && !pathAllowed()) {
|
|
216
|
+
active.routePaused = true;
|
|
217
|
+
active.paused = true;
|
|
218
|
+
_optionalChain([active, 'access', _2 => _2.rrweb, 'optionalAccess', _3 => _3.pause, 'call', _4 => _4()]);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
for (const method of ["pushState", "replaceState"]) {
|
|
222
|
+
const original = history[method];
|
|
223
|
+
const wrapped = function(...params) {
|
|
224
|
+
original.apply(this, params);
|
|
225
|
+
suspendExcluded();
|
|
226
|
+
};
|
|
227
|
+
history[method] = wrapped;
|
|
228
|
+
cleanup.push(() => {
|
|
229
|
+
if (history[method] === wrapped) history[method] = original;
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
window.addEventListener("popstate", suspendExcluded);
|
|
233
|
+
cleanup.push(() => window.removeEventListener("popstate", suspendExcluded));
|
|
234
|
+
let inFlight = false;
|
|
235
|
+
const load = async () => {
|
|
236
|
+
if (inFlight || configured || epoch !== activationEpoch) return;
|
|
237
|
+
inFlight = true;
|
|
238
|
+
const controller = new AbortController();
|
|
239
|
+
const timeout = setTimeout(() => controller.abort(), 1e4);
|
|
240
|
+
try {
|
|
241
|
+
const res = await postTrace({ projectKey: args.projectKey, endpoint: _nullishCoalesce(args.config.options.endpoint, () => ( args.endpoint)) }, "/config", {}, controller.signal);
|
|
242
|
+
if (!_optionalChain([res, 'optionalAccess', _5 => _5.ok])) return;
|
|
243
|
+
const policy = await res.json();
|
|
244
|
+
if (epoch !== activationEpoch || typeof policy.recordingEnabled !== "boolean" || !Array.isArray(policy.recordingDenyList) || policy.recordingDenyList.some((p) => typeof p !== "string" || !p.startsWith("/"))) return;
|
|
245
|
+
configured = true;
|
|
246
|
+
clearInterval(timer);
|
|
247
|
+
waiting = { ...args, config: withReplay({
|
|
248
|
+
...args.config.options,
|
|
249
|
+
blockRoutes: [..._nullishCoalesce(args.config.options.blockRoutes, () => ( [])), ...policy.recordingDenyList]
|
|
250
|
+
}) };
|
|
251
|
+
if (!policy.recordingEnabled) {
|
|
252
|
+
waiting = null;
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
pendingErrors = pendingErrors.filter((e) => {
|
|
256
|
+
try {
|
|
257
|
+
return !isPathBlocked(waiting.config.options, new URL(_nullishCoalesce(e.url, () => ( location.href)), location.href).pathname);
|
|
258
|
+
} catch (e12) {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
await startWhenAllowed();
|
|
263
|
+
} catch (e13) {
|
|
264
|
+
} finally {
|
|
265
|
+
clearTimeout(timeout);
|
|
266
|
+
inFlight = false;
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
const timer = setInterval(() => {
|
|
270
|
+
void load();
|
|
271
|
+
}, 3e4);
|
|
272
|
+
cleanup.push(() => clearInterval(timer));
|
|
273
|
+
await load();
|
|
274
|
+
}
|
|
275
|
+
async function startReplay(args) {
|
|
184
276
|
if (active) return;
|
|
185
277
|
if (typeof window === "undefined") return;
|
|
186
278
|
const epoch = ++activationEpoch;
|
|
187
279
|
const options = args.config.options;
|
|
188
280
|
if (options.enabled === false) return;
|
|
189
|
-
const sample = Math.max(0, Math.min(100, _nullishCoalesce(options.sample, () => ( 100))));
|
|
190
|
-
if (Math.random() * 100 >= sample) return;
|
|
191
281
|
if (isPathBlocked(options, location.pathname)) return;
|
|
192
282
|
const sessionUid = getOrCreateSessionUid();
|
|
193
283
|
const anonId = getOrCreateAnonId();
|
|
@@ -203,7 +293,7 @@ async function activateReplay(args) {
|
|
|
203
293
|
device: deviceClass(),
|
|
204
294
|
viewportW: window.innerWidth,
|
|
205
295
|
viewportH: window.innerHeight,
|
|
206
|
-
ua: _optionalChain([navigator, 'access',
|
|
296
|
+
ua: _optionalChain([navigator, 'access', _6 => _6.userAgent, 'optionalAccess', _7 => _7.slice, 'call', _8 => _8(0, 512)]),
|
|
207
297
|
referrer: document.referrer || void 0,
|
|
208
298
|
landingUrl: location.href.slice(0, 512),
|
|
209
299
|
utmSource: readQuery("utm_source"),
|
|
@@ -216,6 +306,7 @@ async function activateReplay(args) {
|
|
|
216
306
|
};
|
|
217
307
|
const onClick = (event) => {
|
|
218
308
|
if (!event.isTrusted || epoch !== activationEpoch) return;
|
|
309
|
+
if (!pathAllowed() || manualPaused) return;
|
|
219
310
|
if (!active) {
|
|
220
311
|
progress.clickCount++;
|
|
221
312
|
return;
|
|
@@ -227,14 +318,14 @@ async function activateReplay(args) {
|
|
|
227
318
|
};
|
|
228
319
|
window.addEventListener("click", onClick, true);
|
|
229
320
|
cleanup.push(() => window.removeEventListener("click", onClick, true));
|
|
230
|
-
let recordingEnabled =
|
|
321
|
+
let recordingEnabled = false;
|
|
231
322
|
try {
|
|
232
323
|
const res = await postTrace(transportCfg, "/session/start", dto);
|
|
233
324
|
if (res && res.ok) {
|
|
234
325
|
const body = await res.json().catch(() => ({}));
|
|
235
|
-
|
|
326
|
+
recordingEnabled = body.recordingEnabled === true;
|
|
236
327
|
}
|
|
237
|
-
} catch (
|
|
328
|
+
} catch (e14) {
|
|
238
329
|
}
|
|
239
330
|
if (epoch !== activationEpoch) return;
|
|
240
331
|
if (!recordingEnabled) {
|
|
@@ -247,6 +338,7 @@ async function activateReplay(args) {
|
|
|
247
338
|
rrweb: null,
|
|
248
339
|
replayBlocked: false,
|
|
249
340
|
paused: true,
|
|
341
|
+
routePaused: false,
|
|
250
342
|
userId: null,
|
|
251
343
|
startedAt: dto.startedAt,
|
|
252
344
|
pagesVisited: 0,
|
|
@@ -262,10 +354,11 @@ async function activateReplay(args) {
|
|
|
262
354
|
options,
|
|
263
355
|
rrweb: null,
|
|
264
356
|
replayBlocked: false,
|
|
265
|
-
paused:
|
|
357
|
+
paused: manualPaused || !pathAllowed(),
|
|
358
|
+
routePaused: !pathAllowed(),
|
|
266
359
|
userId: null,
|
|
267
360
|
startedAt: dto.startedAt,
|
|
268
|
-
pagesVisited: progress.pagesVisited + 1,
|
|
361
|
+
pagesVisited: progress.pagesVisited + (pathAllowed() ? 1 : 0),
|
|
269
362
|
clickCount: progress.clickCount,
|
|
270
363
|
recordingEnabled: true
|
|
271
364
|
};
|
|
@@ -303,7 +396,7 @@ async function activateReplay(args) {
|
|
|
303
396
|
setTimeout(onIdle, 5e3);
|
|
304
397
|
}
|
|
305
398
|
};
|
|
306
|
-
void Promise.resolve().then(() => _interopRequireWildcard(require("../rrweb-
|
|
399
|
+
void Promise.resolve().then(() => _interopRequireWildcard(require("../rrweb-XVHLVZYC.js"))).then(
|
|
307
400
|
({ startRrweb }) => new Promise((resolve) => {
|
|
308
401
|
scheduleRrwebStart(() => {
|
|
309
402
|
if (epoch !== activationEpoch) {
|
|
@@ -313,6 +406,7 @@ async function activateReplay(args) {
|
|
|
313
406
|
startRrweb({
|
|
314
407
|
sessionUid,
|
|
315
408
|
options,
|
|
409
|
+
shouldRecord: canCollect,
|
|
316
410
|
sendChunk: async (chunk, useBeacon) => {
|
|
317
411
|
if (epoch !== activationEpoch || !active || active.replayBlocked) return;
|
|
318
412
|
const bodyStr = `{"sessionUid":${JSON.stringify(sessionUid)},"chunk":[${chunk.join(",")}]}`;
|
|
@@ -326,7 +420,7 @@ async function activateReplay(args) {
|
|
|
326
420
|
if (typeof navigator !== "undefined" && typeof navigator.sendBeacon === "function") {
|
|
327
421
|
navigator.sendBeacon(url, blob);
|
|
328
422
|
}
|
|
329
|
-
} catch (
|
|
423
|
+
} catch (e15) {
|
|
330
424
|
}
|
|
331
425
|
return;
|
|
332
426
|
}
|
|
@@ -347,22 +441,24 @@ async function activateReplay(args) {
|
|
|
347
441
|
if (res.status === 429) {
|
|
348
442
|
if (active) {
|
|
349
443
|
active.replayBlocked = true;
|
|
350
|
-
_optionalChain([active, 'access',
|
|
444
|
+
_optionalChain([active, 'access', _9 => _9.rrweb, 'optionalAccess', _10 => _10.stop, 'call', _11 => _11()]);
|
|
351
445
|
active.rrweb = null;
|
|
352
446
|
}
|
|
353
447
|
}
|
|
354
|
-
} catch (
|
|
448
|
+
} catch (e16) {
|
|
355
449
|
}
|
|
356
450
|
}
|
|
357
451
|
}).then(resolve, () => resolve(null));
|
|
358
452
|
});
|
|
359
453
|
})
|
|
360
454
|
).then((handles) => {
|
|
361
|
-
if (handles && active && epoch === activationEpoch)
|
|
362
|
-
|
|
455
|
+
if (handles && active && epoch === activationEpoch) {
|
|
456
|
+
active.rrweb = handles;
|
|
457
|
+
if (!canCollect()) handles.pause();
|
|
458
|
+
} else _optionalChain([handles, 'optionalAccess', _12 => _12.stop, 'call', _13 => _13()]);
|
|
363
459
|
}).catch(() => {
|
|
364
460
|
});
|
|
365
|
-
void postTrace(transportCfg, "/events", {
|
|
461
|
+
if (canCollect()) void postTrace(transportCfg, "/events", {
|
|
366
462
|
events: [
|
|
367
463
|
{
|
|
368
464
|
sessionUid,
|
|
@@ -375,7 +471,7 @@ async function activateReplay(args) {
|
|
|
375
471
|
});
|
|
376
472
|
const onPageHide = () => {
|
|
377
473
|
if (!active) return;
|
|
378
|
-
_optionalChain([active, 'access',
|
|
474
|
+
_optionalChain([active, 'access', _14 => _14.rrweb, 'optionalAccess', _15 => _15.flush, 'call', _16 => _16(true)]);
|
|
379
475
|
beaconTrace(active.config, "/session/end", {
|
|
380
476
|
sessionUid: active.sessionUid,
|
|
381
477
|
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -389,8 +485,8 @@ async function activateReplay(args) {
|
|
|
389
485
|
const MAX_SESSION_DURATION_MS = 30 * 6e4;
|
|
390
486
|
const endTimer = setTimeout(() => {
|
|
391
487
|
if (!active) return;
|
|
392
|
-
_optionalChain([active, 'access',
|
|
393
|
-
_optionalChain([active, 'access',
|
|
488
|
+
_optionalChain([active, 'access', _17 => _17.rrweb, 'optionalAccess', _18 => _18.flush, 'call', _19 => _19(true)]);
|
|
489
|
+
_optionalChain([active, 'access', _20 => _20.rrweb, 'optionalAccess', _21 => _21.stop, 'call', _22 => _22()]);
|
|
394
490
|
active.rrweb = null;
|
|
395
491
|
beaconTrace(active.config, "/session/end", {
|
|
396
492
|
sessionUid: active.sessionUid,
|
|
@@ -407,6 +503,7 @@ async function activateReplay(args) {
|
|
|
407
503
|
var replayApi = {
|
|
408
504
|
/** Internal bridge from the error SDK; no stack/message is copied to trace. */
|
|
409
505
|
_captureError(signal) {
|
|
506
|
+
if (configured && !pathAllowed()) return;
|
|
410
507
|
if (!active) {
|
|
411
508
|
if (pendingErrors.length < 20) pendingErrors.push(signal);
|
|
412
509
|
return;
|
|
@@ -415,7 +512,11 @@ var replayApi = {
|
|
|
415
512
|
},
|
|
416
513
|
_stop() {
|
|
417
514
|
activationEpoch++;
|
|
418
|
-
|
|
515
|
+
waiting = null;
|
|
516
|
+
configured = false;
|
|
517
|
+
manualPaused = false;
|
|
518
|
+
starting = false;
|
|
519
|
+
_optionalChain([active, 'optionalAccess', _23 => _23.rrweb, 'optionalAccess', _24 => _24.stop, 'call', _25 => _25()]);
|
|
419
520
|
for (const remove of cleanup) remove();
|
|
420
521
|
cleanup = [];
|
|
421
522
|
active = null;
|
|
@@ -423,18 +524,24 @@ var replayApi = {
|
|
|
423
524
|
pendingUser = void 0;
|
|
424
525
|
},
|
|
425
526
|
pause() {
|
|
426
|
-
|
|
527
|
+
manualPaused = true;
|
|
528
|
+
_optionalChain([active, 'optionalAccess', _26 => _26.rrweb, 'optionalAccess', _27 => _27.pause, 'call', _28 => _28()]);
|
|
427
529
|
if (active) active.paused = true;
|
|
428
530
|
},
|
|
429
531
|
resume() {
|
|
430
|
-
|
|
431
|
-
if (active) active.
|
|
532
|
+
manualPaused = false;
|
|
533
|
+
if (!pathAllowed() || _optionalChain([active, 'optionalAccess', _29 => _29.replayBlocked]) || _optionalChain([active, 'optionalAccess', _30 => _30.recordingEnabled]) === false) return;
|
|
534
|
+
if (active) {
|
|
535
|
+
active.paused = false;
|
|
536
|
+
active.routePaused = false;
|
|
537
|
+
_optionalChain([active, 'access', _31 => _31.rrweb, 'optionalAccess', _32 => _32.resume, 'call', _33 => _33()]);
|
|
538
|
+
} else void startWhenAllowed();
|
|
432
539
|
bumpSessionActivity();
|
|
433
540
|
},
|
|
434
541
|
setUser(user) {
|
|
435
542
|
pendingUser = user;
|
|
436
|
-
if (!active) return;
|
|
437
|
-
active.userId = _nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
543
|
+
if (!active || !canCollect()) return;
|
|
544
|
+
active.userId = _nullishCoalesce(_optionalChain([user, 'optionalAccess', _34 => _34.id, 'optionalAccess', _35 => _35.slice, 'call', _36 => _36(0, 128)]), () => ( null));
|
|
438
545
|
void postTrace(active.config, "/session/start", {
|
|
439
546
|
sessionUid: active.sessionUid,
|
|
440
547
|
anonId: getOrCreateAnonId(),
|
|
@@ -446,7 +553,7 @@ var replayApi = {
|
|
|
446
553
|
});
|
|
447
554
|
},
|
|
448
555
|
event(name, meta) {
|
|
449
|
-
if (!active ||
|
|
556
|
+
if (!active || !canCollect()) return;
|
|
450
557
|
void postTrace(active.config, "/events", {
|
|
451
558
|
events: [
|
|
452
559
|
{
|
|
@@ -465,23 +572,31 @@ var replayApi = {
|
|
|
465
572
|
* Bumps the page-views counter and emits a fresh page_view event.
|
|
466
573
|
*/
|
|
467
574
|
notifyRouteChange(url, title) {
|
|
468
|
-
if (!active)
|
|
575
|
+
if (!active) {
|
|
576
|
+
void startWhenAllowed();
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
if (!active.recordingEnabled || active.replayBlocked) return;
|
|
469
580
|
bumpSessionActivity();
|
|
470
581
|
const nowBlocked = isPathBlocked(active.options, location.pathname);
|
|
471
582
|
if (nowBlocked) {
|
|
583
|
+
active.routePaused = true;
|
|
472
584
|
if (!active.paused) {
|
|
473
|
-
_optionalChain([active, 'access',
|
|
585
|
+
_optionalChain([active, 'access', _37 => _37.rrweb, 'optionalAccess', _38 => _38.pause, 'call', _39 => _39()]);
|
|
474
586
|
active.paused = true;
|
|
475
587
|
}
|
|
476
588
|
return;
|
|
477
589
|
}
|
|
478
|
-
if (
|
|
479
|
-
|
|
590
|
+
if (manualPaused) return;
|
|
591
|
+
if (active.routePaused) {
|
|
592
|
+
active.routePaused = false;
|
|
480
593
|
active.paused = false;
|
|
594
|
+
_optionalChain([active, 'access', _40 => _40.rrweb, 'optionalAccess', _41 => _41.resume, 'call', _42 => _42()]);
|
|
595
|
+
if (pendingUser !== void 0) replayApi.setUser(pendingUser);
|
|
481
596
|
}
|
|
482
597
|
active.pagesVisited += 1;
|
|
483
598
|
saveProgress();
|
|
484
|
-
_optionalChain([active, 'access',
|
|
599
|
+
_optionalChain([active, 'access', _43 => _43.rrweb, 'optionalAccess', _44 => _44.takeFullSnapshot, 'call', _45 => _45()]);
|
|
485
600
|
void postTrace(active.config, "/events", {
|
|
486
601
|
events: [
|
|
487
602
|
{
|
|
@@ -496,11 +611,12 @@ var replayApi = {
|
|
|
496
611
|
},
|
|
497
612
|
/** Test seam: returns null when replay was not activated for this session. */
|
|
498
613
|
_sessionUid() {
|
|
499
|
-
return _nullishCoalesce(_optionalChain([active, 'optionalAccess',
|
|
614
|
+
return _nullishCoalesce(_optionalChain([active, 'optionalAccess', _46 => _46.sessionUid]), () => ( null));
|
|
500
615
|
}
|
|
501
616
|
};
|
|
502
617
|
|
|
503
618
|
|
|
504
619
|
|
|
505
620
|
|
|
506
|
-
|
|
621
|
+
|
|
622
|
+
exports.activateReplay = activateReplay; exports.isPathBlocked = isPathBlocked; exports.replayApi = replayApi; exports.withReplay = withReplay;
|