@openreplay/tracker 16.4.3 → 16.4.5
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/cjs/entry.js +31 -34
- package/dist/cjs/entry.js.map +1 -1
- package/dist/cjs/index.js +31 -34
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/main/index.d.ts +2 -0
- package/dist/cjs/main/modules/viewport.d.ts +5 -1
- package/dist/lib/entry.js +31 -34
- package/dist/lib/entry.js.map +1 -1
- package/dist/lib/index.js +31 -34
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/main/index.d.ts +2 -0
- package/dist/lib/main/modules/viewport.d.ts +5 -1
- package/dist/types/main/index.d.ts +2 -0
- package/dist/types/main/modules/viewport.d.ts +5 -1
- package/package.json +2 -2
package/dist/cjs/entry.js
CHANGED
|
@@ -5172,7 +5172,7 @@ class Session {
|
|
|
5172
5172
|
}
|
|
5173
5173
|
}
|
|
5174
5174
|
|
|
5175
|
-
function wrap(callback, n) {
|
|
5175
|
+
function wrap$1(callback, n) {
|
|
5176
5176
|
let t = 0;
|
|
5177
5177
|
return () => {
|
|
5178
5178
|
if (t++ >= n) {
|
|
@@ -5200,7 +5200,7 @@ class Ticker {
|
|
|
5200
5200
|
if (useSafe) {
|
|
5201
5201
|
callback = this.app.safe(callback);
|
|
5202
5202
|
}
|
|
5203
|
-
this.callbacks.unshift(n ? wrap(callback, n) : callback) - 1;
|
|
5203
|
+
this.callbacks.unshift(n ? wrap$1(callback, n) : callback) - 1;
|
|
5204
5204
|
}
|
|
5205
5205
|
start() {
|
|
5206
5206
|
if (this.timer === null) {
|
|
@@ -5276,7 +5276,7 @@ class App {
|
|
|
5276
5276
|
this.stopCallbacks = [];
|
|
5277
5277
|
this.commitCallbacks = [];
|
|
5278
5278
|
this.activityState = ActivityState.NotActive;
|
|
5279
|
-
this.version = '16.4.
|
|
5279
|
+
this.version = '16.4.5'; // TODO: version compatability check inside each plugin.
|
|
5280
5280
|
this.socketMode = false;
|
|
5281
5281
|
this.compressionThreshold = 24 * 1000;
|
|
5282
5282
|
this.bc = null;
|
|
@@ -7677,11 +7677,6 @@ function Timing (app, opts) {
|
|
|
7677
7677
|
if (shouldSkip) {
|
|
7678
7678
|
return;
|
|
7679
7679
|
}
|
|
7680
|
-
const failed = entry.responseEnd === 0
|
|
7681
|
-
|| (entry.transferSize === 0 && entry.decodedBodySize === 0);
|
|
7682
|
-
if (failed) {
|
|
7683
|
-
app.send(ResourceTiming(entry.startTime + getTimeOrigin(), 0, 0, 0, 0, 0, entry.name, entry.initiatorType, 0, true));
|
|
7684
|
-
}
|
|
7685
7680
|
app.send(ResourceTiming(entry.startTime + getTimeOrigin(), entry.duration, entry.responseStart && entry.startTime ? entry.responseStart - entry.startTime : 0, entry.transferSize > entry.encodedBodySize ? entry.transferSize - entry.encodedBodySize : 0, entry.encodedBodySize || 0, entry.decodedBodySize || 0, app.sanitizer.privateMode ? entry.name.replaceAll(/./g, '*') : entry.name, entry.initiatorType, entry.transferSize,
|
|
7686
7681
|
// @ts-ignore
|
|
7687
7682
|
(entry.responseStatus && entry.responseStatus === 304) || entry.transferSize === 0));
|
|
@@ -7692,14 +7687,8 @@ function Timing (app, opts) {
|
|
|
7692
7687
|
return app.send(WebVitals(msg.name, String(msg.value)));
|
|
7693
7688
|
}
|
|
7694
7689
|
}
|
|
7695
|
-
let prevSessionID;
|
|
7696
7690
|
app.attachStartCallback(function ({ sessionID }) {
|
|
7697
|
-
|
|
7698
|
-
// Send past page resources on a newly started session
|
|
7699
|
-
performance.getEntriesByType('resource').forEach(resourceTiming);
|
|
7700
|
-
prevSessionID = sessionID;
|
|
7701
|
-
}
|
|
7702
|
-
observer.observe({ entryTypes: ['resource'] });
|
|
7691
|
+
observer.observe({ type: 'resource', buffered: true });
|
|
7703
7692
|
// browser support:
|
|
7704
7693
|
// onCLS(): Chromium
|
|
7705
7694
|
// onFCP(): Chromium, Firefox, Safari
|
|
@@ -7863,16 +7852,19 @@ function Scroll (app, insideIframe) {
|
|
|
7863
7852
|
}, 5, false);
|
|
7864
7853
|
}
|
|
7865
7854
|
|
|
7866
|
-
function Viewport (app) {
|
|
7855
|
+
function Viewport (app, options) {
|
|
7867
7856
|
let url, width, height;
|
|
7868
7857
|
let navigationStart;
|
|
7869
7858
|
let referrer = document.referrer;
|
|
7859
|
+
const urlSanitizer = options?.urlSanitizer || ((u) => u);
|
|
7860
|
+
const titleSanitizer = options?.titleSanitizer || ((t) => t);
|
|
7870
7861
|
const sendSetPageLocation = app.safe(() => {
|
|
7871
7862
|
const { URL } = document;
|
|
7872
7863
|
if (URL !== url) {
|
|
7873
7864
|
url = URL;
|
|
7874
|
-
const
|
|
7875
|
-
const
|
|
7865
|
+
const sanitized = urlSanitizer(url);
|
|
7866
|
+
const safeTitle = app.sanitizer.privateMode ? stringWiper(document.title) : titleSanitizer(document.title);
|
|
7867
|
+
const safeUrl = app.sanitizer.privateMode ? stringWiper(sanitized) : sanitized;
|
|
7876
7868
|
const safeReferrer = app.sanitizer.privateMode ? stringWiper(referrer) : referrer;
|
|
7877
7869
|
app.send(SetPageLocation(safeUrl, safeReferrer, navigationStart, safeTitle));
|
|
7878
7870
|
navigationStart = 0;
|
|
@@ -9259,10 +9251,17 @@ class XHRProxy {
|
|
|
9259
9251
|
}
|
|
9260
9252
|
}
|
|
9261
9253
|
|
|
9262
|
-
const
|
|
9254
|
+
const warn = (api) => {
|
|
9263
9255
|
const str = `Openreplay: Can't find ${api} in global context.`;
|
|
9264
9256
|
console.warn(str);
|
|
9265
9257
|
};
|
|
9258
|
+
const OR_FLAG = Symbol('OpenReplayProxyOriginal');
|
|
9259
|
+
const isProxied = (fn) => !!fn && fn[OR_FLAG] !== undefined;
|
|
9260
|
+
const unwrap = (fn) => isProxied(fn) ? fn[OR_FLAG] : fn;
|
|
9261
|
+
const wrap = (proxy, orig) => {
|
|
9262
|
+
proxy[OR_FLAG] = orig;
|
|
9263
|
+
return proxy;
|
|
9264
|
+
};
|
|
9266
9265
|
/**
|
|
9267
9266
|
* Creates network proxies for XMLHttpRequest, fetch, and sendBeacon to intercept and monitor network requests and
|
|
9268
9267
|
* responses.
|
|
@@ -9296,26 +9295,24 @@ function createNetworkProxy(context, ignoredHeaders, setSessionTokenHeader, sani
|
|
|
9296
9295
|
if (!context)
|
|
9297
9296
|
return;
|
|
9298
9297
|
if (modules.xhr) {
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9298
|
+
const original = unwrap(context.XMLHttpRequest);
|
|
9299
|
+
if (!original)
|
|
9300
|
+
warn('XMLHttpRequest');
|
|
9302
9301
|
else {
|
|
9303
|
-
|
|
9302
|
+
context.XMLHttpRequest = wrap(XHRProxy.create(ignoredHeaders, setSessionTokenHeader, sanitize, sendMessage, isServiceUrl, tokenUrlMatcher), original);
|
|
9304
9303
|
}
|
|
9305
9304
|
}
|
|
9306
9305
|
if (modules.fetch) {
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9306
|
+
const original = unwrap(context.fetch);
|
|
9307
|
+
if (!original)
|
|
9308
|
+
warn('fetch');
|
|
9310
9309
|
else {
|
|
9311
|
-
|
|
9310
|
+
context.fetch = wrap(FetchProxy.create(ignoredHeaders, setSessionTokenHeader, sanitize, sendMessage, isServiceUrl, tokenUrlMatcher), original);
|
|
9312
9311
|
}
|
|
9313
9312
|
}
|
|
9314
|
-
if (modules.beacon) {
|
|
9315
|
-
|
|
9316
|
-
|
|
9317
|
-
context.navigator.sendBeacon = BeaconProxy.create(origBeacon, ignoredHeaders, setSessionTokenHeader, sanitize, sendMessage, isServiceUrl);
|
|
9318
|
-
}
|
|
9313
|
+
if (modules.beacon && ((_a = context.navigator) === null || _a === void 0 ? void 0 : _a.sendBeacon)) {
|
|
9314
|
+
const original = unwrap(context.navigator.sendBeacon);
|
|
9315
|
+
context.navigator.sendBeacon = wrap(BeaconProxy.create(original, ignoredHeaders, setSessionTokenHeader, sanitize, sendMessage, isServiceUrl), original);
|
|
9319
9316
|
}
|
|
9320
9317
|
}
|
|
9321
9318
|
|
|
@@ -9656,7 +9653,7 @@ class API {
|
|
|
9656
9653
|
this.signalStartIssue = (reason, missingApi) => {
|
|
9657
9654
|
const doNotTrack = this.checkDoNotTrack();
|
|
9658
9655
|
console.log("Tracker couldn't start due to:", JSON.stringify({
|
|
9659
|
-
trackerVersion: '16.4.
|
|
9656
|
+
trackerVersion: '16.4.5',
|
|
9660
9657
|
projectKey: this.options.projectKey,
|
|
9661
9658
|
doNotTrack,
|
|
9662
9659
|
reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
|
|
@@ -9744,7 +9741,7 @@ class API {
|
|
|
9744
9741
|
this.app = app;
|
|
9745
9742
|
if (!this.crossdomainMode) {
|
|
9746
9743
|
// no need to send iframe viewport data since its a node for us
|
|
9747
|
-
Viewport(app);
|
|
9744
|
+
Viewport(app, options.urls);
|
|
9748
9745
|
// calculated in main window
|
|
9749
9746
|
Connection(app);
|
|
9750
9747
|
// while we can calculate it here, trying to compute it for all parts is hard
|