@extn/segi-js 0.2.11 → 0.2.12
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/cdn.global.js +27 -27
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/dist/index.mjs +2 -0
- package/dist/replay/index.d.mts +5 -5
- package/dist/replay/index.d.ts +5 -5
- package/dist/replay/index.js +25 -183
- package/dist/replay/index.mjs +3 -161
- package/dist/{types-DfmnOA9D.d.mts → types-CsgcNSc1.d.mts} +5 -5
- package/dist/{types-DfmnOA9D.d.ts → types-CsgcNSc1.d.ts} +5 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SegiClientOptions, SegiEventDto, SegiUser, SegiBreadcrumb } from '@extn/segi-shared';
|
|
2
2
|
export { SegiBreadcrumb, SegiClientOptions, SegiEventDto, SegiUser } from '@extn/segi-shared';
|
|
3
|
-
import { R as ReplayConfig } from './types-
|
|
3
|
+
import { R as ReplayConfig } from './types-CsgcNSc1.mjs';
|
|
4
4
|
|
|
5
5
|
interface InitOptions {
|
|
6
6
|
/** Re-initialize even if already initialized. Replaces config and listeners. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SegiClientOptions, SegiEventDto, SegiUser, SegiBreadcrumb } from '@extn/segi-shared';
|
|
2
2
|
export { SegiBreadcrumb, SegiClientOptions, SegiEventDto, SegiUser } from '@extn/segi-shared';
|
|
3
|
-
import { R as ReplayConfig } from './types-
|
|
3
|
+
import { R as ReplayConfig } from './types-CsgcNSc1.js';
|
|
4
4
|
|
|
5
5
|
interface InitOptions {
|
|
6
6
|
/** Re-initialize even if already initialized. Replaces config and listeners. */
|
package/dist/index.js
CHANGED
|
@@ -151,6 +151,8 @@ function captureWindowError(event) {
|
|
|
151
151
|
if (event instanceof ErrorEvent) {
|
|
152
152
|
const err = event.error;
|
|
153
153
|
const message = _nullishCoalesce(_nullishCoalesce(_optionalChain([err, 'optionalAccess', _ => _.message]), () => ( event.message)), () => ( "Error"));
|
|
154
|
+
if (event.error == null && (!event.message || /^Script error\.?$/i.test(event.message)) && !event.filename)
|
|
155
|
+
return;
|
|
154
156
|
Segi.captureException(_nullishCoalesce(err, () => ( new Error(message))), {
|
|
155
157
|
message,
|
|
156
158
|
url: typeof location !== "undefined" ? location.href : void 0
|
package/dist/index.mjs
CHANGED
|
@@ -151,6 +151,8 @@ function captureWindowError(event) {
|
|
|
151
151
|
if (event instanceof ErrorEvent) {
|
|
152
152
|
const err = event.error;
|
|
153
153
|
const message = err?.message ?? event.message ?? "Error";
|
|
154
|
+
if (event.error == null && (!event.message || /^Script error\.?$/i.test(event.message)) && !event.filename)
|
|
155
|
+
return;
|
|
154
156
|
Segi.captureException(err ?? new Error(message), {
|
|
155
157
|
message,
|
|
156
158
|
url: typeof location !== "undefined" ? location.href : void 0
|
package/dist/replay/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ReplayConfig, a as ReplayOptions } from '../types-
|
|
1
|
+
import { R as ReplayConfig, a as ReplayOptions } from '../types-CsgcNSc1.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Replay orchestrator. Exposed at `@extn/segi-js/replay`.
|
|
@@ -20,13 +20,13 @@ import { R as ReplayConfig, a as ReplayOptions } from '../types-DfmnOA9D.mjs';
|
|
|
20
20
|
* Segi.replay.notifyRouteChange();
|
|
21
21
|
*
|
|
22
22
|
* Activation is async because:
|
|
23
|
-
* - we POST /api/trace/session/start before
|
|
24
|
-
*
|
|
23
|
+
* - we POST /api/trace/session/start before rrweb attaches, so the server
|
|
24
|
+
* can short-circuit a recording-off project
|
|
25
25
|
* - this also lets the client honor the project-level recording toggle
|
|
26
26
|
* without redeploying the SDK
|
|
27
27
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
28
|
+
* rrweb DOM replay is dynamic-imported (see ./rrweb) so apps that don't opt
|
|
29
|
+
* in pay zero rrweb bytes. Chunks POST to /api/trace/replay.
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
declare function withReplay(options?: ReplayOptions): ReplayConfig;
|
package/dist/replay/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ReplayConfig, a as ReplayOptions } from '../types-
|
|
1
|
+
import { R as ReplayConfig, a as ReplayOptions } from '../types-CsgcNSc1.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Replay orchestrator. Exposed at `@extn/segi-js/replay`.
|
|
@@ -20,13 +20,13 @@ import { R as ReplayConfig, a as ReplayOptions } from '../types-DfmnOA9D.js';
|
|
|
20
20
|
* Segi.replay.notifyRouteChange();
|
|
21
21
|
*
|
|
22
22
|
* Activation is async because:
|
|
23
|
-
* - we POST /api/trace/session/start before
|
|
24
|
-
*
|
|
23
|
+
* - we POST /api/trace/session/start before rrweb attaches, so the server
|
|
24
|
+
* can short-circuit a recording-off project
|
|
25
25
|
* - this also lets the client honor the project-level recording toggle
|
|
26
26
|
* without redeploying the SDK
|
|
27
27
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
28
|
+
* rrweb DOM replay is dynamic-imported (see ./rrweb) so apps that don't opt
|
|
29
|
+
* in pay zero rrweb bytes. Chunks POST to /api/trace/replay.
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
declare function withReplay(options?: ReplayOptions): ReplayConfig;
|
package/dist/replay/index.js
CHANGED
|
@@ -1,143 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/replay/
|
|
2
|
-
var FLUSH_CLICK_INTERVAL_MS = 5e3;
|
|
3
|
-
var FLUSH_CLICK_BUFFER = 50;
|
|
4
|
-
var SCROLL_THROTTLE_MS = 1e3;
|
|
5
|
-
function deviceClass(w) {
|
|
6
|
-
if (w < 640) return "mobile";
|
|
7
|
-
if (w < 1024) return "tablet";
|
|
8
|
-
return "desktop";
|
|
9
|
-
}
|
|
10
|
-
function isMaskedElement(el, maskClass) {
|
|
11
|
-
let cur = el;
|
|
12
|
-
while (cur) {
|
|
13
|
-
if (_optionalChain([cur, 'access', _ => _.classList, 'optionalAccess', _2 => _2.contains, 'call', _3 => _3(maskClass)])) return true;
|
|
14
|
-
cur = cur.parentElement;
|
|
15
|
-
}
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
function buildSelector(el) {
|
|
19
|
-
try {
|
|
20
|
-
if (el.id) return `#${el.id}`;
|
|
21
|
-
const tag = _optionalChain([el, 'access', _4 => _4.tagName, 'optionalAccess', _5 => _5.toLowerCase, 'call', _6 => _6()]);
|
|
22
|
-
if (!tag) return void 0;
|
|
23
|
-
const cls = (el.className && typeof el.className === "string" ? el.className.split(/\s+/).filter(Boolean).slice(0, 2) : []).map((c) => `.${c}`);
|
|
24
|
-
return `${tag}${cls.join("")}`.slice(0, 512);
|
|
25
|
-
} catch (e2) {
|
|
26
|
-
return void 0;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function startHeatmap(args) {
|
|
30
|
-
const maskClass = _nullishCoalesce(_optionalChain([args, 'access', _7 => _7.options, 'access', _8 => _8.mask, 'optionalAccess', _9 => _9.class]), () => ( "segi-mask"));
|
|
31
|
-
let paused = false;
|
|
32
|
-
const buffer = [];
|
|
33
|
-
let lastScrollPct = -1;
|
|
34
|
-
let lastScrollPostAt = 0;
|
|
35
|
-
const flushClicks = (opts = {}) => {
|
|
36
|
-
if (buffer.length === 0) return;
|
|
37
|
-
const batch = buffer.splice(0, buffer.length);
|
|
38
|
-
args.sendClicks(batch, Boolean(opts.useBeacon));
|
|
39
|
-
};
|
|
40
|
-
const interval = setInterval(() => {
|
|
41
|
-
if (!paused) flushClicks();
|
|
42
|
-
}, FLUSH_CLICK_INTERVAL_MS);
|
|
43
|
-
const onClick = (e) => {
|
|
44
|
-
if (paused) return;
|
|
45
|
-
try {
|
|
46
|
-
const target = e.target;
|
|
47
|
-
if (!target) return;
|
|
48
|
-
if (isMaskedElement(target, maskClass)) return;
|
|
49
|
-
const docW = Math.max(
|
|
50
|
-
document.documentElement.scrollWidth,
|
|
51
|
-
_nullishCoalesce(_optionalChain([document, 'access', _10 => _10.body, 'optionalAccess', _11 => _11.scrollWidth]), () => ( 0)),
|
|
52
|
-
1
|
|
53
|
-
);
|
|
54
|
-
const docH = Math.max(
|
|
55
|
-
document.documentElement.scrollHeight,
|
|
56
|
-
_nullishCoalesce(_optionalChain([document, 'access', _12 => _12.body, 'optionalAccess', _13 => _13.scrollHeight]), () => ( 0)),
|
|
57
|
-
1
|
|
58
|
-
);
|
|
59
|
-
const pageX = e.pageX;
|
|
60
|
-
const pageY = e.pageY;
|
|
61
|
-
const w = window.innerWidth;
|
|
62
|
-
const row = {
|
|
63
|
-
sessionUid: args.sessionUid,
|
|
64
|
-
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
65
|
-
urlPath: location.pathname.slice(0, 255),
|
|
66
|
-
device: deviceClass(w),
|
|
67
|
-
viewportW: w,
|
|
68
|
-
viewportH: window.innerHeight,
|
|
69
|
-
x: Math.round(e.clientX),
|
|
70
|
-
y: Math.round(e.clientY),
|
|
71
|
-
pageX: Math.round(pageX),
|
|
72
|
-
pageY: Math.round(pageY),
|
|
73
|
-
relX: Math.max(0, Math.min(1, pageX / docW)),
|
|
74
|
-
relY: Math.max(0, Math.min(1, pageY / docH)),
|
|
75
|
-
selector: buildSelector(target),
|
|
76
|
-
tag: _optionalChain([target, 'access', _14 => _14.tagName, 'optionalAccess', _15 => _15.toLowerCase, 'call', _16 => _16(), 'access', _17 => _17.slice, 'call', _18 => _18(0, 32)]),
|
|
77
|
-
text: _optionalChain([(_nullishCoalesce(target.textContent, () => ( void 0))), 'optionalAccess', _19 => _19.trim, 'call', _20 => _20(), 'access', _21 => _21.slice, 'call', _22 => _22(0, 128)]) || void 0
|
|
78
|
-
};
|
|
79
|
-
buffer.push(row);
|
|
80
|
-
if (buffer.length >= FLUSH_CLICK_BUFFER) flushClicks();
|
|
81
|
-
} catch (e3) {
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
const onScroll = () => {
|
|
85
|
-
if (paused) return;
|
|
86
|
-
const now = Date.now();
|
|
87
|
-
if (now - lastScrollPostAt < SCROLL_THROTTLE_MS) return;
|
|
88
|
-
try {
|
|
89
|
-
const docH = Math.max(
|
|
90
|
-
document.documentElement.scrollHeight,
|
|
91
|
-
_nullishCoalesce(_optionalChain([document, 'access', _23 => _23.body, 'optionalAccess', _24 => _24.scrollHeight]), () => ( 0)),
|
|
92
|
-
1
|
|
93
|
-
);
|
|
94
|
-
const viewH = window.innerHeight;
|
|
95
|
-
const maxY = Math.round(window.scrollY + viewH);
|
|
96
|
-
const pct = Math.max(0, Math.min(100, Math.round(maxY / docH * 100)));
|
|
97
|
-
if (pct <= lastScrollPct) return;
|
|
98
|
-
lastScrollPct = pct;
|
|
99
|
-
lastScrollPostAt = now;
|
|
100
|
-
const w = window.innerWidth;
|
|
101
|
-
args.sendScroll(
|
|
102
|
-
{
|
|
103
|
-
sessionUid: args.sessionUid,
|
|
104
|
-
urlPath: location.pathname.slice(0, 255),
|
|
105
|
-
device: deviceClass(w),
|
|
106
|
-
viewportH: viewH,
|
|
107
|
-
docH,
|
|
108
|
-
maxScrollY: maxY,
|
|
109
|
-
maxScrollPct: pct
|
|
110
|
-
},
|
|
111
|
-
false
|
|
112
|
-
);
|
|
113
|
-
} catch (e4) {
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
const onPageHide = () => {
|
|
117
|
-
flushClicks({ useBeacon: true });
|
|
118
|
-
};
|
|
119
|
-
window.addEventListener("click", onClick, true);
|
|
120
|
-
window.addEventListener("scroll", onScroll, { capture: true, passive: true });
|
|
121
|
-
window.addEventListener("pagehide", onPageHide);
|
|
122
|
-
return {
|
|
123
|
-
pause() {
|
|
124
|
-
paused = true;
|
|
125
|
-
},
|
|
126
|
-
resume() {
|
|
127
|
-
paused = false;
|
|
128
|
-
},
|
|
129
|
-
stop() {
|
|
130
|
-
clearInterval(interval);
|
|
131
|
-
window.removeEventListener("click", onClick, true);
|
|
132
|
-
window.removeEventListener("scroll", onScroll, true);
|
|
133
|
-
window.removeEventListener("pagehide", onPageHide);
|
|
134
|
-
flushClicks({ useBeacon: true });
|
|
135
|
-
},
|
|
136
|
-
flushClicks
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// src/replay/session.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/replay/session.ts
|
|
141
2
|
var UID_KEY = "_bd_session_uid";
|
|
142
3
|
var UID_TS_KEY = "_bd_session_at";
|
|
143
4
|
var ANON_KEY = "_bd_anon";
|
|
@@ -161,7 +22,7 @@ function readSession() {
|
|
|
161
22
|
const at = Number(_nullishCoalesce(sessionStorage.getItem(UID_TS_KEY), () => ( "0")));
|
|
162
23
|
if (!uid || !at) return null;
|
|
163
24
|
return { uid, at };
|
|
164
|
-
} catch (
|
|
25
|
+
} catch (e) {
|
|
165
26
|
return null;
|
|
166
27
|
}
|
|
167
28
|
}
|
|
@@ -170,7 +31,7 @@ function writeSession(uid, at) {
|
|
|
170
31
|
if (typeof sessionStorage === "undefined") return;
|
|
171
32
|
sessionStorage.setItem(UID_KEY, uid);
|
|
172
33
|
sessionStorage.setItem(UID_TS_KEY, String(at));
|
|
173
|
-
} catch (
|
|
34
|
+
} catch (e2) {
|
|
174
35
|
}
|
|
175
36
|
}
|
|
176
37
|
function getOrCreateSessionUid() {
|
|
@@ -200,7 +61,7 @@ function getOrCreateAnonId() {
|
|
|
200
61
|
const fresh = uuid();
|
|
201
62
|
localStorage.setItem(ANON_KEY, fresh);
|
|
202
63
|
return fresh;
|
|
203
|
-
} catch (
|
|
64
|
+
} catch (e3) {
|
|
204
65
|
if (!memAnon) memAnon = uuid();
|
|
205
66
|
return memAnon;
|
|
206
67
|
}
|
|
@@ -229,7 +90,7 @@ async function postTrace(cfg, path, body) {
|
|
|
229
90
|
// instead (separate API, no throw).
|
|
230
91
|
});
|
|
231
92
|
return res;
|
|
232
|
-
} catch (
|
|
93
|
+
} catch (e4) {
|
|
233
94
|
return null;
|
|
234
95
|
}
|
|
235
96
|
}
|
|
@@ -239,7 +100,7 @@ function beaconTrace(cfg, path, body) {
|
|
|
239
100
|
const url = `${normalizeBase(cfg.endpoint)}/api/trace${path}?pk=${encodeURIComponent(cfg.projectKey)}`;
|
|
240
101
|
const blob = new Blob([JSON.stringify(body)], { type: "application/json" });
|
|
241
102
|
return navigator.sendBeacon(url, blob);
|
|
242
|
-
} catch (
|
|
103
|
+
} catch (e5) {
|
|
243
104
|
return false;
|
|
244
105
|
}
|
|
245
106
|
}
|
|
@@ -249,7 +110,7 @@ function withReplay(options = {}) {
|
|
|
249
110
|
return { __segi_replay: true, options };
|
|
250
111
|
}
|
|
251
112
|
var active = null;
|
|
252
|
-
function
|
|
113
|
+
function deviceClass() {
|
|
253
114
|
if (typeof window === "undefined") return "desktop";
|
|
254
115
|
const w = window.innerWidth;
|
|
255
116
|
if (w < 640) return "mobile";
|
|
@@ -260,7 +121,7 @@ function readQuery(name) {
|
|
|
260
121
|
if (typeof location === "undefined") return void 0;
|
|
261
122
|
try {
|
|
262
123
|
return _nullishCoalesce(new URLSearchParams(location.search).get(name), () => ( void 0));
|
|
263
|
-
} catch (
|
|
124
|
+
} catch (e6) {
|
|
264
125
|
return void 0;
|
|
265
126
|
}
|
|
266
127
|
}
|
|
@@ -286,10 +147,10 @@ async function activateReplay(args) {
|
|
|
286
147
|
sessionUid,
|
|
287
148
|
anonId,
|
|
288
149
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
289
|
-
device:
|
|
150
|
+
device: deviceClass(),
|
|
290
151
|
viewportW: window.innerWidth,
|
|
291
152
|
viewportH: window.innerHeight,
|
|
292
|
-
ua: _optionalChain([navigator, 'access',
|
|
153
|
+
ua: _optionalChain([navigator, 'access', _ => _.userAgent, 'optionalAccess', _2 => _2.slice, 'call', _3 => _3(0, 512)]),
|
|
293
154
|
referrer: document.referrer || void 0,
|
|
294
155
|
landingUrl: location.href.slice(0, 512),
|
|
295
156
|
utmSource: readQuery("utm_source"),
|
|
@@ -307,14 +168,13 @@ async function activateReplay(args) {
|
|
|
307
168
|
const body = await res.json().catch(() => ({}));
|
|
308
169
|
if (body.recordingEnabled === false) recordingEnabled = false;
|
|
309
170
|
}
|
|
310
|
-
} catch (
|
|
171
|
+
} catch (e7) {
|
|
311
172
|
}
|
|
312
173
|
if (!recordingEnabled) {
|
|
313
174
|
active = {
|
|
314
175
|
sessionUid,
|
|
315
176
|
config: transportCfg,
|
|
316
177
|
options,
|
|
317
|
-
heatmap: null,
|
|
318
178
|
rrweb: null,
|
|
319
179
|
replayBlocked: false,
|
|
320
180
|
paused: true,
|
|
@@ -326,22 +186,10 @@ async function activateReplay(args) {
|
|
|
326
186
|
};
|
|
327
187
|
return;
|
|
328
188
|
}
|
|
329
|
-
const heatmap = startHeatmap({
|
|
330
|
-
sessionUid,
|
|
331
|
-
options,
|
|
332
|
-
sendClicks: (rows, useBeacon) => {
|
|
333
|
-
if (useBeacon) beaconTrace(transportCfg, "/heatmap/clicks", { clicks: rows });
|
|
334
|
-
else void postTrace(transportCfg, "/heatmap/clicks", { clicks: rows });
|
|
335
|
-
},
|
|
336
|
-
sendScroll: (row) => {
|
|
337
|
-
void postTrace(transportCfg, "/heatmap/scroll", row);
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
189
|
active = {
|
|
341
190
|
sessionUid,
|
|
342
191
|
config: transportCfg,
|
|
343
192
|
options,
|
|
344
|
-
heatmap,
|
|
345
193
|
rrweb: null,
|
|
346
194
|
replayBlocked: false,
|
|
347
195
|
paused: false,
|
|
@@ -399,7 +247,7 @@ async function activateReplay(args) {
|
|
|
399
247
|
if (typeof navigator !== "undefined" && typeof navigator.sendBeacon === "function") {
|
|
400
248
|
navigator.sendBeacon(url, blob);
|
|
401
249
|
}
|
|
402
|
-
} catch (
|
|
250
|
+
} catch (e8) {
|
|
403
251
|
}
|
|
404
252
|
return;
|
|
405
253
|
}
|
|
@@ -415,11 +263,11 @@ async function activateReplay(args) {
|
|
|
415
263
|
if (res.status === 429) {
|
|
416
264
|
if (active) {
|
|
417
265
|
active.replayBlocked = true;
|
|
418
|
-
_optionalChain([active, 'access',
|
|
266
|
+
_optionalChain([active, 'access', _4 => _4.rrweb, 'optionalAccess', _5 => _5.stop, 'call', _6 => _6()]);
|
|
419
267
|
active.rrweb = null;
|
|
420
268
|
}
|
|
421
269
|
}
|
|
422
|
-
} catch (
|
|
270
|
+
} catch (e9) {
|
|
423
271
|
}
|
|
424
272
|
}
|
|
425
273
|
}).then(resolve, () => resolve(null));
|
|
@@ -442,7 +290,7 @@ async function activateReplay(args) {
|
|
|
442
290
|
});
|
|
443
291
|
window.addEventListener("pagehide", () => {
|
|
444
292
|
if (!active) return;
|
|
445
|
-
_optionalChain([active, 'access',
|
|
293
|
+
_optionalChain([active, 'access', _7 => _7.rrweb, 'optionalAccess', _8 => _8.flush, 'call', _9 => _9(true)]);
|
|
446
294
|
beaconTrace(active.config, "/session/end", {
|
|
447
295
|
sessionUid: active.sessionUid,
|
|
448
296
|
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -454,11 +302,9 @@ async function activateReplay(args) {
|
|
|
454
302
|
const MAX_SESSION_DURATION_MS = 30 * 6e4;
|
|
455
303
|
setTimeout(() => {
|
|
456
304
|
if (!active) return;
|
|
457
|
-
_optionalChain([active, 'access',
|
|
458
|
-
_optionalChain([active, 'access',
|
|
305
|
+
_optionalChain([active, 'access', _10 => _10.rrweb, 'optionalAccess', _11 => _11.flush, 'call', _12 => _12(true)]);
|
|
306
|
+
_optionalChain([active, 'access', _13 => _13.rrweb, 'optionalAccess', _14 => _14.stop, 'call', _15 => _15()]);
|
|
459
307
|
active.rrweb = null;
|
|
460
|
-
_optionalChain([active, 'access', _40 => _40.heatmap, 'optionalAccess', _41 => _41.stop, 'call', _42 => _42()]);
|
|
461
|
-
active.heatmap = null;
|
|
462
308
|
beaconTrace(active.config, "/session/end", {
|
|
463
309
|
sessionUid: active.sessionUid,
|
|
464
310
|
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -472,25 +318,23 @@ async function activateReplay(args) {
|
|
|
472
318
|
}
|
|
473
319
|
var replayApi = {
|
|
474
320
|
pause() {
|
|
475
|
-
_optionalChain([active, 'optionalAccess',
|
|
476
|
-
_optionalChain([active, 'optionalAccess', _46 => _46.rrweb, 'optionalAccess', _47 => _47.pause, 'call', _48 => _48()]);
|
|
321
|
+
_optionalChain([active, 'optionalAccess', _16 => _16.rrweb, 'optionalAccess', _17 => _17.pause, 'call', _18 => _18()]);
|
|
477
322
|
if (active) active.paused = true;
|
|
478
323
|
},
|
|
479
324
|
resume() {
|
|
480
|
-
_optionalChain([active, 'optionalAccess',
|
|
481
|
-
_optionalChain([active, 'optionalAccess', _52 => _52.rrweb, 'optionalAccess', _53 => _53.resume, 'call', _54 => _54()]);
|
|
325
|
+
_optionalChain([active, 'optionalAccess', _19 => _19.rrweb, 'optionalAccess', _20 => _20.resume, 'call', _21 => _21()]);
|
|
482
326
|
if (active) active.paused = false;
|
|
483
327
|
bumpSessionActivity();
|
|
484
328
|
},
|
|
485
329
|
setUser(user) {
|
|
486
330
|
if (!active) return;
|
|
487
|
-
active.userId = _nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
331
|
+
active.userId = _nullishCoalesce(_optionalChain([user, 'optionalAccess', _22 => _22.id]), () => ( null));
|
|
488
332
|
void postTrace(active.config, "/session/start", {
|
|
489
333
|
sessionUid: active.sessionUid,
|
|
490
334
|
anonId: getOrCreateAnonId(),
|
|
491
335
|
userId: active.userId,
|
|
492
336
|
startedAt: active.startedAt,
|
|
493
|
-
device:
|
|
337
|
+
device: deviceClass(),
|
|
494
338
|
viewportW: window.innerWidth,
|
|
495
339
|
viewportH: window.innerHeight
|
|
496
340
|
});
|
|
@@ -520,19 +364,17 @@ var replayApi = {
|
|
|
520
364
|
const nowBlocked = isPathBlocked(active.options, location.pathname);
|
|
521
365
|
if (nowBlocked) {
|
|
522
366
|
if (!active.paused) {
|
|
523
|
-
_optionalChain([active, 'access',
|
|
524
|
-
_optionalChain([active, 'access', _59 => _59.rrweb, 'optionalAccess', _60 => _60.pause, 'call', _61 => _61()]);
|
|
367
|
+
_optionalChain([active, 'access', _23 => _23.rrweb, 'optionalAccess', _24 => _24.pause, 'call', _25 => _25()]);
|
|
525
368
|
active.paused = true;
|
|
526
369
|
}
|
|
527
370
|
return;
|
|
528
371
|
}
|
|
529
372
|
if (active.paused) {
|
|
530
|
-
_optionalChain([active, 'access',
|
|
531
|
-
_optionalChain([active, 'access', _65 => _65.rrweb, 'optionalAccess', _66 => _66.resume, 'call', _67 => _67()]);
|
|
373
|
+
_optionalChain([active, 'access', _26 => _26.rrweb, 'optionalAccess', _27 => _27.resume, 'call', _28 => _28()]);
|
|
532
374
|
active.paused = false;
|
|
533
375
|
}
|
|
534
376
|
active.pagesVisited += 1;
|
|
535
|
-
_optionalChain([active, 'access',
|
|
377
|
+
_optionalChain([active, 'access', _29 => _29.rrweb, 'optionalAccess', _30 => _30.takeFullSnapshot, 'call', _31 => _31()]);
|
|
536
378
|
void postTrace(active.config, "/events", {
|
|
537
379
|
events: [
|
|
538
380
|
{
|
|
@@ -547,7 +389,7 @@ var replayApi = {
|
|
|
547
389
|
},
|
|
548
390
|
/** Test seam: returns null when replay was not activated for this session. */
|
|
549
391
|
_sessionUid() {
|
|
550
|
-
return _nullishCoalesce(_optionalChain([active, 'optionalAccess',
|
|
392
|
+
return _nullishCoalesce(_optionalChain([active, 'optionalAccess', _32 => _32.sessionUid]), () => ( null));
|
|
551
393
|
}
|
|
552
394
|
};
|
|
553
395
|
|