@extn/segi-js 0.2.14 → 0.2.16

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.
@@ -2,9 +2,24 @@
2
2
  var UID_KEY = "_bd_session_uid";
3
3
  var UID_TS_KEY = "_bd_session_at";
4
4
  var ANON_KEY = "_bd_anon";
5
+ var PROGRESS_KEY = "_segi_replay_progress";
5
6
  var IDLE_MS = 30 * 6e4;
6
7
  var memUid = null;
7
8
  var memAnon = null;
9
+ function readReplayProgress(sessionUid) {
10
+ try {
11
+ const p = JSON.parse(sessionStorage.getItem(PROGRESS_KEY) || "null");
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 (e2) {
14
+ }
15
+ return { sessionUid, startedAt: (/* @__PURE__ */ new Date()).toISOString(), clickCount: 0, pagesVisited: 0 };
16
+ }
17
+ function writeReplayProgress(progress) {
18
+ try {
19
+ sessionStorage.setItem(PROGRESS_KEY, JSON.stringify(progress));
20
+ } catch (e3) {
21
+ }
22
+ }
8
23
  function uuid() {
9
24
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
10
25
  return crypto.randomUUID();
@@ -22,7 +37,7 @@ function readSession() {
22
37
  const at = Number(_nullishCoalesce(sessionStorage.getItem(UID_TS_KEY), () => ( "0")));
23
38
  if (!uid || !at) return null;
24
39
  return { uid, at };
25
- } catch (e) {
40
+ } catch (e4) {
26
41
  return null;
27
42
  }
28
43
  }
@@ -31,13 +46,13 @@ function writeSession(uid, at) {
31
46
  if (typeof sessionStorage === "undefined") return;
32
47
  sessionStorage.setItem(UID_KEY, uid);
33
48
  sessionStorage.setItem(UID_TS_KEY, String(at));
34
- } catch (e2) {
49
+ } catch (e5) {
35
50
  }
36
51
  }
37
52
  function getOrCreateSessionUid() {
38
53
  const now = Date.now();
39
54
  const existing = readSession();
40
- if (existing && now - existing.at < IDLE_MS) {
55
+ if (existing && now - existing.at < IDLE_MS && now - Date.parse(readReplayProgress(existing.uid).startedAt) < IDLE_MS) {
41
56
  writeSession(existing.uid, now);
42
57
  return existing.uid;
43
58
  }
@@ -61,7 +76,7 @@ function getOrCreateAnonId() {
61
76
  const fresh = uuid();
62
77
  localStorage.setItem(ANON_KEY, fresh);
63
78
  return fresh;
64
- } catch (e3) {
79
+ } catch (e6) {
65
80
  if (!memAnon) memAnon = uuid();
66
81
  return memAnon;
67
82
  }
@@ -73,11 +88,12 @@ function normalizeBase(endpoint) {
73
88
  const raw = endpoint && endpoint.trim() || DEFAULT_API_BASE;
74
89
  return raw.replace(/\/+$/, "").replace(/\/api\/ingest\/events$/, "").replace(/\/api\/ingest$/, "").replace(/\/api$/, "");
75
90
  }
76
- async function postTrace(cfg, path, body) {
91
+ async function postTrace(cfg, path, body, signal) {
77
92
  const url = `${normalizeBase(cfg.endpoint)}/api/trace${path}`;
78
93
  try {
79
94
  const res = await fetch(url, {
80
95
  method: "POST",
96
+ signal,
81
97
  headers: {
82
98
  "Content-Type": "application/json",
83
99
  "X-Segi-Project-Key": cfg.projectKey
@@ -90,7 +106,7 @@ async function postTrace(cfg, path, body) {
90
106
  // instead (separate API, no throw).
91
107
  });
92
108
  return res;
93
- } catch (e4) {
109
+ } catch (e7) {
94
110
  return null;
95
111
  }
96
112
  }
@@ -100,7 +116,7 @@ function beaconTrace(cfg, path, body) {
100
116
  const url = `${normalizeBase(cfg.endpoint)}/api/trace${path}?pk=${encodeURIComponent(cfg.projectKey)}`;
101
117
  const blob = new Blob([JSON.stringify(body)], { type: "application/json" });
102
118
  return navigator.sendBeacon(url, blob);
103
- } catch (e5) {
119
+ } catch (e8) {
104
120
  return false;
105
121
  }
106
122
  }
@@ -118,11 +134,38 @@ async function gzipString(str) {
118
134
  void writer.close();
119
135
  const buf = await new Response(cs.readable).arrayBuffer();
120
136
  return new Uint8Array(buf);
121
- } catch (e6) {
137
+ } catch (e9) {
122
138
  return null;
123
139
  }
124
140
  }
125
141
  var active = null;
142
+ var activationEpoch = 0;
143
+ var cleanup = [];
144
+ var pendingErrors = [];
145
+ function saveProgress() {
146
+ if (!active) return;
147
+ writeReplayProgress({
148
+ sessionUid: active.sessionUid,
149
+ startedAt: active.startedAt,
150
+ clickCount: active.clickCount,
151
+ pagesVisited: active.pagesVisited
152
+ });
153
+ }
154
+ function sendError(signal) {
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
+ }
161
+ void postTrace(active.config, "/events", { events: [{
162
+ sessionUid: active.sessionUid,
163
+ ts: signal.ts,
164
+ url: signal.url,
165
+ type: "error",
166
+ name: "sdk_error"
167
+ }] });
168
+ }
126
169
  var pendingUser = void 0;
127
170
  function deviceClass() {
128
171
  if (typeof window === "undefined") return "desktop";
@@ -135,7 +178,7 @@ function readQuery(name) {
135
178
  if (typeof location === "undefined") return void 0;
136
179
  try {
137
180
  return _nullishCoalesce(new URLSearchParams(location.search).get(name), () => ( void 0));
138
- } catch (e7) {
181
+ } catch (e11) {
139
182
  return void 0;
140
183
  }
141
184
  }
@@ -143,16 +186,102 @@ function isPathBlocked(opts, path) {
143
186
  const list = _nullishCoalesce(opts.blockRoutes, () => ( []));
144
187
  return list.some((p) => path.startsWith(p));
145
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
+ }
146
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) {
147
276
  if (active) return;
148
277
  if (typeof window === "undefined") return;
278
+ const epoch = ++activationEpoch;
149
279
  const options = args.config.options;
150
280
  if (options.enabled === false) return;
151
- const sample = Math.max(0, Math.min(100, _nullishCoalesce(options.sample, () => ( 100))));
152
- if (Math.random() * 100 >= sample) return;
153
281
  if (isPathBlocked(options, location.pathname)) return;
154
282
  const sessionUid = getOrCreateSessionUid();
155
283
  const anonId = getOrCreateAnonId();
284
+ const progress = readReplayProgress(sessionUid);
156
285
  const transportCfg = {
157
286
  endpoint: _nullishCoalesce(options.endpoint, () => ( args.endpoint)),
158
287
  projectKey: args.projectKey
@@ -160,11 +289,11 @@ async function activateReplay(args) {
160
289
  const dto = {
161
290
  sessionUid,
162
291
  anonId,
163
- startedAt: (/* @__PURE__ */ new Date()).toISOString(),
292
+ startedAt: progress.startedAt,
164
293
  device: deviceClass(),
165
294
  viewportW: window.innerWidth,
166
295
  viewportH: window.innerHeight,
167
- ua: _optionalChain([navigator, 'access', _ => _.userAgent, 'optionalAccess', _2 => _2.slice, 'call', _3 => _3(0, 512)]),
296
+ ua: _optionalChain([navigator, 'access', _6 => _6.userAgent, 'optionalAccess', _7 => _7.slice, 'call', _8 => _8(0, 512)]),
168
297
  referrer: document.referrer || void 0,
169
298
  landingUrl: location.href.slice(0, 512),
170
299
  utmSource: readQuery("utm_source"),
@@ -175,16 +304,33 @@ async function activateReplay(args) {
175
304
  fbclid: readQuery("fbclid"),
176
305
  gclid: readQuery("gclid")
177
306
  };
178
- let recordingEnabled = true;
307
+ const onClick = (event) => {
308
+ if (!event.isTrusted || epoch !== activationEpoch) return;
309
+ if (!pathAllowed() || manualPaused) return;
310
+ if (!active) {
311
+ progress.clickCount++;
312
+ return;
313
+ }
314
+ if (active.paused || active.replayBlocked || !active.recordingEnabled) return;
315
+ active.clickCount++;
316
+ saveProgress();
317
+ bumpSessionActivity();
318
+ };
319
+ window.addEventListener("click", onClick, true);
320
+ cleanup.push(() => window.removeEventListener("click", onClick, true));
321
+ let recordingEnabled = false;
179
322
  try {
180
323
  const res = await postTrace(transportCfg, "/session/start", dto);
181
324
  if (res && res.ok) {
182
325
  const body = await res.json().catch(() => ({}));
183
- if (body.recordingEnabled === false) recordingEnabled = false;
326
+ recordingEnabled = body.recordingEnabled === true;
184
327
  }
185
- } catch (e8) {
328
+ } catch (e14) {
186
329
  }
330
+ if (epoch !== activationEpoch) return;
187
331
  if (!recordingEnabled) {
332
+ window.removeEventListener("click", onClick, true);
333
+ pendingErrors = [];
188
334
  active = {
189
335
  sessionUid,
190
336
  config: transportCfg,
@@ -192,6 +338,7 @@ async function activateReplay(args) {
192
338
  rrweb: null,
193
339
  replayBlocked: false,
194
340
  paused: true,
341
+ routePaused: false,
195
342
  userId: null,
196
343
  startedAt: dto.startedAt,
197
344
  pagesVisited: 0,
@@ -207,13 +354,17 @@ async function activateReplay(args) {
207
354
  options,
208
355
  rrweb: null,
209
356
  replayBlocked: false,
210
- paused: false,
357
+ paused: manualPaused || !pathAllowed(),
358
+ routePaused: !pathAllowed(),
211
359
  userId: null,
212
360
  startedAt: dto.startedAt,
213
- pagesVisited: 1,
214
- clickCount: 0,
361
+ pagesVisited: progress.pagesVisited + (pathAllowed() ? 1 : 0),
362
+ clickCount: progress.clickCount,
215
363
  recordingEnabled: true
216
364
  };
365
+ saveProgress();
366
+ for (const error of pendingErrors) sendError(error);
367
+ pendingErrors = [];
217
368
  if (pendingUser !== void 0) replayApi.setUser(pendingUser);
218
369
  let lastSessionBump = Date.now();
219
370
  const bumpIfStale = () => {
@@ -224,6 +375,7 @@ async function activateReplay(args) {
224
375
  };
225
376
  for (const ev of ["mousedown", "keydown", "scroll", "touchstart"]) {
226
377
  window.addEventListener(ev, bumpIfStale, { passive: true, capture: true });
378
+ cleanup.push(() => window.removeEventListener(ev, bumpIfStale, true));
227
379
  }
228
380
  const w = window;
229
381
  const scheduleRrwebStart = (run) => {
@@ -244,14 +396,19 @@ async function activateReplay(args) {
244
396
  setTimeout(onIdle, 5e3);
245
397
  }
246
398
  };
247
- void Promise.resolve().then(() => _interopRequireWildcard(require("../rrweb-VXG3W6SS.js"))).then(
399
+ void Promise.resolve().then(() => _interopRequireWildcard(require("../rrweb-XVHLVZYC.js"))).then(
248
400
  ({ startRrweb }) => new Promise((resolve) => {
249
401
  scheduleRrwebStart(() => {
402
+ if (epoch !== activationEpoch) {
403
+ resolve(null);
404
+ return;
405
+ }
250
406
  startRrweb({
251
407
  sessionUid,
252
408
  options,
409
+ shouldRecord: canCollect,
253
410
  sendChunk: async (chunk, useBeacon) => {
254
- if (!active || active.replayBlocked) return;
411
+ if (epoch !== activationEpoch || !active || active.replayBlocked) return;
255
412
  const bodyStr = `{"sessionUid":${JSON.stringify(sessionUid)},"chunk":[${chunk.join(",")}]}`;
256
413
  const base = (transportCfg.endpoint || "https://segiapi.extn.ai").replace(/\/+$/, "").replace(/\/api\/ingest\/events$/, "").replace(/\/api\/ingest$/, "").replace(/\/api$/, "");
257
414
  if (useBeacon) {
@@ -263,7 +420,7 @@ async function activateReplay(args) {
263
420
  if (typeof navigator !== "undefined" && typeof navigator.sendBeacon === "function") {
264
421
  navigator.sendBeacon(url, blob);
265
422
  }
266
- } catch (e9) {
423
+ } catch (e15) {
267
424
  }
268
425
  return;
269
426
  }
@@ -284,21 +441,24 @@ async function activateReplay(args) {
284
441
  if (res.status === 429) {
285
442
  if (active) {
286
443
  active.replayBlocked = true;
287
- _optionalChain([active, 'access', _4 => _4.rrweb, 'optionalAccess', _5 => _5.stop, 'call', _6 => _6()]);
444
+ _optionalChain([active, 'access', _9 => _9.rrweb, 'optionalAccess', _10 => _10.stop, 'call', _11 => _11()]);
288
445
  active.rrweb = null;
289
446
  }
290
447
  }
291
- } catch (e10) {
448
+ } catch (e16) {
292
449
  }
293
450
  }
294
451
  }).then(resolve, () => resolve(null));
295
452
  });
296
453
  })
297
454
  ).then((handles) => {
298
- if (handles && active) active.rrweb = handles;
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()]);
299
459
  }).catch(() => {
300
460
  });
301
- void postTrace(transportCfg, "/events", {
461
+ if (canCollect()) void postTrace(transportCfg, "/events", {
302
462
  events: [
303
463
  {
304
464
  sessionUid,
@@ -309,9 +469,9 @@ async function activateReplay(args) {
309
469
  }
310
470
  ]
311
471
  });
312
- window.addEventListener("pagehide", () => {
472
+ const onPageHide = () => {
313
473
  if (!active) return;
314
- _optionalChain([active, 'access', _7 => _7.rrweb, 'optionalAccess', _8 => _8.flush, 'call', _9 => _9(true)]);
474
+ _optionalChain([active, 'access', _14 => _14.rrweb, 'optionalAccess', _15 => _15.flush, 'call', _16 => _16(true)]);
315
475
  beaconTrace(active.config, "/session/end", {
316
476
  sessionUid: active.sessionUid,
317
477
  endedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -319,12 +479,14 @@ async function activateReplay(args) {
319
479
  pagesVisited: active.pagesVisited,
320
480
  clickCount: active.clickCount
321
481
  });
322
- });
482
+ };
483
+ window.addEventListener("pagehide", onPageHide);
484
+ cleanup.push(() => window.removeEventListener("pagehide", onPageHide));
323
485
  const MAX_SESSION_DURATION_MS = 30 * 6e4;
324
- setTimeout(() => {
486
+ const endTimer = setTimeout(() => {
325
487
  if (!active) return;
326
- _optionalChain([active, 'access', _10 => _10.rrweb, 'optionalAccess', _11 => _11.flush, 'call', _12 => _12(true)]);
327
- _optionalChain([active, 'access', _13 => _13.rrweb, 'optionalAccess', _14 => _14.stop, 'call', _15 => _15()]);
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()]);
328
490
  active.rrweb = null;
329
491
  beaconTrace(active.config, "/session/end", {
330
492
  sessionUid: active.sessionUid,
@@ -335,22 +497,51 @@ async function activateReplay(args) {
335
497
  });
336
498
  active.paused = true;
337
499
  active.replayBlocked = true;
338
- }, MAX_SESSION_DURATION_MS);
500
+ }, Math.max(0, MAX_SESSION_DURATION_MS - (Date.now() - Date.parse(progress.startedAt))));
501
+ cleanup.push(() => clearTimeout(endTimer));
339
502
  }
340
503
  var replayApi = {
504
+ /** Internal bridge from the error SDK; no stack/message is copied to trace. */
505
+ _captureError(signal) {
506
+ if (configured && !pathAllowed()) return;
507
+ if (!active) {
508
+ if (pendingErrors.length < 20) pendingErrors.push(signal);
509
+ return;
510
+ }
511
+ sendError(signal);
512
+ },
513
+ _stop() {
514
+ activationEpoch++;
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()]);
520
+ for (const remove of cleanup) remove();
521
+ cleanup = [];
522
+ active = null;
523
+ pendingErrors = [];
524
+ pendingUser = void 0;
525
+ },
341
526
  pause() {
342
- _optionalChain([active, 'optionalAccess', _16 => _16.rrweb, 'optionalAccess', _17 => _17.pause, 'call', _18 => _18()]);
527
+ manualPaused = true;
528
+ _optionalChain([active, 'optionalAccess', _26 => _26.rrweb, 'optionalAccess', _27 => _27.pause, 'call', _28 => _28()]);
343
529
  if (active) active.paused = true;
344
530
  },
345
531
  resume() {
346
- _optionalChain([active, 'optionalAccess', _19 => _19.rrweb, 'optionalAccess', _20 => _20.resume, 'call', _21 => _21()]);
347
- if (active) active.paused = false;
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();
348
539
  bumpSessionActivity();
349
540
  },
350
541
  setUser(user) {
351
542
  pendingUser = user;
352
- if (!active) return;
353
- active.userId = _nullishCoalesce(_optionalChain([user, 'optionalAccess', _22 => _22.id, 'optionalAccess', _23 => _23.slice, 'call', _24 => _24(0, 128)]), () => ( null));
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));
354
545
  void postTrace(active.config, "/session/start", {
355
546
  sessionUid: active.sessionUid,
356
547
  anonId: getOrCreateAnonId(),
@@ -362,7 +553,7 @@ var replayApi = {
362
553
  });
363
554
  },
364
555
  event(name, meta) {
365
- if (!active || active.paused) return;
556
+ if (!active || !canCollect()) return;
366
557
  void postTrace(active.config, "/events", {
367
558
  events: [
368
559
  {
@@ -381,22 +572,31 @@ var replayApi = {
381
572
  * Bumps the page-views counter and emits a fresh page_view event.
382
573
  */
383
574
  notifyRouteChange(url, title) {
384
- if (!active) return;
575
+ if (!active) {
576
+ void startWhenAllowed();
577
+ return;
578
+ }
579
+ if (!active.recordingEnabled || active.replayBlocked) return;
385
580
  bumpSessionActivity();
386
581
  const nowBlocked = isPathBlocked(active.options, location.pathname);
387
582
  if (nowBlocked) {
583
+ active.routePaused = true;
388
584
  if (!active.paused) {
389
- _optionalChain([active, 'access', _25 => _25.rrweb, 'optionalAccess', _26 => _26.pause, 'call', _27 => _27()]);
585
+ _optionalChain([active, 'access', _37 => _37.rrweb, 'optionalAccess', _38 => _38.pause, 'call', _39 => _39()]);
390
586
  active.paused = true;
391
587
  }
392
588
  return;
393
589
  }
394
- if (active.paused) {
395
- _optionalChain([active, 'access', _28 => _28.rrweb, 'optionalAccess', _29 => _29.resume, 'call', _30 => _30()]);
590
+ if (manualPaused) return;
591
+ if (active.routePaused) {
592
+ active.routePaused = false;
396
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);
397
596
  }
398
597
  active.pagesVisited += 1;
399
- _optionalChain([active, 'access', _31 => _31.rrweb, 'optionalAccess', _32 => _32.takeFullSnapshot, 'call', _33 => _33()]);
598
+ saveProgress();
599
+ _optionalChain([active, 'access', _43 => _43.rrweb, 'optionalAccess', _44 => _44.takeFullSnapshot, 'call', _45 => _45()]);
400
600
  void postTrace(active.config, "/events", {
401
601
  events: [
402
602
  {
@@ -411,11 +611,12 @@ var replayApi = {
411
611
  },
412
612
  /** Test seam: returns null when replay was not activated for this session. */
413
613
  _sessionUid() {
414
- return _nullishCoalesce(_optionalChain([active, 'optionalAccess', _34 => _34.sessionUid]), () => ( null));
614
+ return _nullishCoalesce(_optionalChain([active, 'optionalAccess', _46 => _46.sessionUid]), () => ( null));
415
615
  }
416
616
  };
417
617
 
418
618
 
419
619
 
420
620
 
421
- exports.activateReplay = activateReplay; exports.replayApi = replayApi; exports.withReplay = withReplay;
621
+
622
+ exports.activateReplay = activateReplay; exports.isPathBlocked = isPathBlocked; exports.replayApi = replayApi; exports.withReplay = withReplay;