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