@openreplay/tracker 16.4.5 → 16.4.7-beta.1

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.5'; // TODO: version compatability check inside each plugin.
5275
+ this.version = '16.4.7-beta.1'; // TODO: version compatability check inside each plugin.
5276
5276
  this.socketMode = false;
5277
5277
  this.compressionThreshold = 24 * 1000;
5278
5278
  this.bc = null;
@@ -5376,6 +5376,13 @@ class App {
5376
5376
  }
5377
5377
  };
5378
5378
  void signalId();
5379
+ if (this.active()) {
5380
+ // @ts-ignore
5381
+ event.source?.postMessage({ line: proto.startIframe }, '*');
5382
+ }
5383
+ else {
5384
+ this.addCommand(proto.startIframe);
5385
+ }
5379
5386
  }
5380
5387
  /**
5381
5388
  * proxying messages from iframe to main body, so they can be in one batch (same indexes, etc)
@@ -7673,9 +7680,18 @@ function Timing (app, opts) {
7673
7680
  if (shouldSkip) {
7674
7681
  return;
7675
7682
  }
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,
7683
+ const entryName = options.resourceNameSanitizer
7684
+ ? options.resourceNameSanitizer(entry.name)
7685
+ : entry.name;
7686
+ const cached =
7677
7687
  // @ts-ignore
7678
- (entry.responseStatus && entry.responseStatus === 304) || entry.transferSize === 0));
7688
+ (entry.responseStatus && entry.responseStatus === 304) ||
7689
+ // @ts-ignore
7690
+ (entry.deliveryType && entry.deliveryType === 'cache') ||
7691
+ (entry.transferSize === 0 && entry.decodedBodySize > 0);
7692
+ const requestFailed = entry.responseStatus && entry.responseStatus >= 400;
7693
+ const decodedBodySize = requestFailed ? -111 : entry.decodedBodySize || 0;
7694
+ 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, decodedBodySize, app.sanitizer.privateMode ? entry.name.replaceAll(/./g, '*') : entryName, entry.initiatorType, entry.transferSize, cached));
7679
7695
  }
7680
7696
  const observer = new PerformanceObserver((list) => list.getEntries().forEach(resourceTiming));
7681
7697
  function onVitalsSignal(msg) {
@@ -9599,7 +9615,7 @@ function Tabs (app) {
9599
9615
  }
9600
9616
 
9601
9617
  const Messages = _Messages;
9602
- const DOCS_SETUP = '/en/sdk';
9618
+ const DOCS_SETUP = '/en/sdk/constructor';
9603
9619
  function processOptions(obj) {
9604
9620
  if (obj == null) {
9605
9621
  console.error(`OpenReplay: invalid options argument type. Please, check documentation on ${DOCS_HOST}${DOCS_SETUP}`);
@@ -9649,7 +9665,7 @@ class API {
9649
9665
  this.signalStartIssue = (reason, missingApi) => {
9650
9666
  const doNotTrack = this.checkDoNotTrack();
9651
9667
  console.log("Tracker couldn't start due to:", JSON.stringify({
9652
- trackerVersion: '16.4.5',
9668
+ trackerVersion: '16.4.7-beta.1',
9653
9669
  projectKey: this.options.projectKey,
9654
9670
  doNotTrack,
9655
9671
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,