@openreplay/tracker 16.4.3 → 16.4.4
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 +30 -34
- package/dist/cjs/entry.js.map +1 -1
- package/dist/cjs/index.js +30 -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 +30 -34
- package/dist/lib/entry.js.map +1 -1
- package/dist/lib/index.js +30 -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.4'; // 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,15 +7852,17 @@ 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
|
-
url = URL;
|
|
7874
|
-
const safeTitle = app.sanitizer.privateMode ? stringWiper(document.title) : document.title;
|
|
7864
|
+
url = urlSanitizer(URL);
|
|
7865
|
+
const safeTitle = app.sanitizer.privateMode ? stringWiper(document.title) : titleSanitizer(document.title);
|
|
7875
7866
|
const safeUrl = app.sanitizer.privateMode ? stringWiper(url) : url;
|
|
7876
7867
|
const safeReferrer = app.sanitizer.privateMode ? stringWiper(referrer) : referrer;
|
|
7877
7868
|
app.send(SetPageLocation(safeUrl, safeReferrer, navigationStart, safeTitle));
|
|
@@ -9259,10 +9250,17 @@ class XHRProxy {
|
|
|
9259
9250
|
}
|
|
9260
9251
|
}
|
|
9261
9252
|
|
|
9262
|
-
const
|
|
9253
|
+
const warn = (api) => {
|
|
9263
9254
|
const str = `Openreplay: Can't find ${api} in global context.`;
|
|
9264
9255
|
console.warn(str);
|
|
9265
9256
|
};
|
|
9257
|
+
const OR_FLAG = Symbol('OpenReplayProxyOriginal');
|
|
9258
|
+
const isProxied = (fn) => !!fn && fn[OR_FLAG] !== undefined;
|
|
9259
|
+
const unwrap = (fn) => isProxied(fn) ? fn[OR_FLAG] : fn;
|
|
9260
|
+
const wrap = (proxy, orig) => {
|
|
9261
|
+
proxy[OR_FLAG] = orig;
|
|
9262
|
+
return proxy;
|
|
9263
|
+
};
|
|
9266
9264
|
/**
|
|
9267
9265
|
* Creates network proxies for XMLHttpRequest, fetch, and sendBeacon to intercept and monitor network requests and
|
|
9268
9266
|
* responses.
|
|
@@ -9296,26 +9294,24 @@ function createNetworkProxy(context, ignoredHeaders, setSessionTokenHeader, sani
|
|
|
9296
9294
|
if (!context)
|
|
9297
9295
|
return;
|
|
9298
9296
|
if (modules.xhr) {
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9297
|
+
const original = unwrap(context.XMLHttpRequest);
|
|
9298
|
+
if (!original)
|
|
9299
|
+
warn('XMLHttpRequest');
|
|
9302
9300
|
else {
|
|
9303
|
-
|
|
9301
|
+
context.XMLHttpRequest = wrap(XHRProxy.create(ignoredHeaders, setSessionTokenHeader, sanitize, sendMessage, isServiceUrl, tokenUrlMatcher), original);
|
|
9304
9302
|
}
|
|
9305
9303
|
}
|
|
9306
9304
|
if (modules.fetch) {
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9305
|
+
const original = unwrap(context.fetch);
|
|
9306
|
+
if (!original)
|
|
9307
|
+
warn('fetch');
|
|
9310
9308
|
else {
|
|
9311
|
-
|
|
9309
|
+
context.fetch = wrap(FetchProxy.create(ignoredHeaders, setSessionTokenHeader, sanitize, sendMessage, isServiceUrl, tokenUrlMatcher), original);
|
|
9312
9310
|
}
|
|
9313
9311
|
}
|
|
9314
|
-
if (modules.beacon) {
|
|
9315
|
-
|
|
9316
|
-
|
|
9317
|
-
context.navigator.sendBeacon = BeaconProxy.create(origBeacon, ignoredHeaders, setSessionTokenHeader, sanitize, sendMessage, isServiceUrl);
|
|
9318
|
-
}
|
|
9312
|
+
if (modules.beacon && ((_a = context.navigator) === null || _a === void 0 ? void 0 : _a.sendBeacon)) {
|
|
9313
|
+
const original = unwrap(context.navigator.sendBeacon);
|
|
9314
|
+
context.navigator.sendBeacon = wrap(BeaconProxy.create(original, ignoredHeaders, setSessionTokenHeader, sanitize, sendMessage, isServiceUrl), original);
|
|
9319
9315
|
}
|
|
9320
9316
|
}
|
|
9321
9317
|
|
|
@@ -9656,7 +9652,7 @@ class API {
|
|
|
9656
9652
|
this.signalStartIssue = (reason, missingApi) => {
|
|
9657
9653
|
const doNotTrack = this.checkDoNotTrack();
|
|
9658
9654
|
console.log("Tracker couldn't start due to:", JSON.stringify({
|
|
9659
|
-
trackerVersion: '16.4.
|
|
9655
|
+
trackerVersion: '16.4.4',
|
|
9660
9656
|
projectKey: this.options.projectKey,
|
|
9661
9657
|
doNotTrack,
|
|
9662
9658
|
reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
|
|
@@ -9744,7 +9740,7 @@ class API {
|
|
|
9744
9740
|
this.app = app;
|
|
9745
9741
|
if (!this.crossdomainMode) {
|
|
9746
9742
|
// no need to send iframe viewport data since its a node for us
|
|
9747
|
-
Viewport(app);
|
|
9743
|
+
Viewport(app, options.urls);
|
|
9748
9744
|
// calculated in main window
|
|
9749
9745
|
Connection(app);
|
|
9750
9746
|
// while we can calculate it here, trying to compute it for all parts is hard
|