@openreplay/tracker 16.4.4 → 16.4.6

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.
@@ -4,5 +4,6 @@ export interface Options {
4
4
  capturePageLoadTimings: boolean;
5
5
  capturePageRenderTimings: boolean;
6
6
  excludedResourceUrls?: Array<string>;
7
+ resourceNameSanitizer?: (url: string) => string;
7
8
  }
8
9
  export default function (app: App, opts: Partial<Options>): void;
package/dist/lib/entry.js CHANGED
@@ -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.4'; // TODO: version compatability check inside each plugin.
5275
+ this.version = '16.4.6'; // TODO: version compatability check inside each plugin.
5276
5276
  this.socketMode = false;
5277
5277
  this.compressionThreshold = 24 * 1000;
5278
5278
  this.bc = null;
@@ -7673,7 +7673,10 @@ function Timing (app, opts) {
7673
7673
  if (shouldSkip) {
7674
7674
  return;
7675
7675
  }
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,
7676
+ const entryName = options.resourceNameSanitizer
7677
+ ? options.resourceNameSanitizer(entry.name)
7678
+ : entry.name;
7679
+ 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, '*') : entryName, entry.initiatorType, entry.transferSize,
7677
7680
  // @ts-ignore
7678
7681
  (entry.responseStatus && entry.responseStatus === 304) || entry.transferSize === 0));
7679
7682
  }
@@ -7857,9 +7860,10 @@ function Viewport (app, options) {
7857
7860
  const sendSetPageLocation = app.safe(() => {
7858
7861
  const { URL } = document;
7859
7862
  if (URL !== url) {
7860
- url = urlSanitizer(URL);
7863
+ url = URL;
7864
+ const sanitized = urlSanitizer(url);
7861
7865
  const safeTitle = app.sanitizer.privateMode ? stringWiper(document.title) : titleSanitizer(document.title);
7862
- const safeUrl = app.sanitizer.privateMode ? stringWiper(url) : url;
7866
+ const safeUrl = app.sanitizer.privateMode ? stringWiper(sanitized) : sanitized;
7863
7867
  const safeReferrer = app.sanitizer.privateMode ? stringWiper(referrer) : referrer;
7864
7868
  app.send(SetPageLocation(safeUrl, safeReferrer, navigationStart, safeTitle));
7865
7869
  navigationStart = 0;
@@ -9648,7 +9652,7 @@ class API {
9648
9652
  this.signalStartIssue = (reason, missingApi) => {
9649
9653
  const doNotTrack = this.checkDoNotTrack();
9650
9654
  console.log("Tracker couldn't start due to:", JSON.stringify({
9651
- trackerVersion: '16.4.4',
9655
+ trackerVersion: '16.4.6',
9652
9656
  projectKey: this.options.projectKey,
9653
9657
  doNotTrack,
9654
9658
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,