@openreplay/tracker 17.1.0 → 17.1.2

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 CHANGED
@@ -4402,7 +4402,7 @@ class App {
4402
4402
  this.stopCallbacks = [];
4403
4403
  this.commitCallbacks = [];
4404
4404
  this.activityState = ActivityState.NotActive;
4405
- this.version = '17.1.0'; // TODO: version compatability check inside each plugin.
4405
+ this.version = '17.1.2'; // TODO: version compatability check inside each plugin.
4406
4406
  this.socketMode = false;
4407
4407
  this.compressionThreshold = 24 * 1000;
4408
4408
  this.bc = null;
@@ -5509,6 +5509,7 @@ class App {
5509
5509
  assistOnly: startOpts.assistOnly ?? this.socketMode,
5510
5510
  width: window.screen.width,
5511
5511
  height: window.screen.height,
5512
+ referrer: document.referrer,
5512
5513
  }),
5513
5514
  });
5514
5515
  if (r.status !== 200) {
@@ -7005,11 +7006,21 @@ function Viewport (app, options) {
7005
7006
  const urlSanitizer = options?.urlSanitizer || ((u) => u);
7006
7007
  const titleSanitizer = options?.titleSanitizer || ((t) => t);
7007
7008
  const sendSetPageLocation = app.safe(() => {
7008
- const { URL } = document;
7009
- if (URL !== url) {
7010
- url = URL;
7009
+ const currURL = document.URL;
7010
+ if (currURL !== url) {
7011
+ url = currURL;
7012
+ if (options?.replaceHashSymbol) {
7013
+ // replace hash router symbol if needed without affecting pathname of the url
7014
+ const u = new URL(currURL);
7015
+ const hashRoute = u.hash.startsWith("#/") ? u.hash.slice(2) : "";
7016
+ const routePath = hashRoute ? "/" + hashRoute.replace(/^\/+/, "") : "";
7017
+ const cleaned = u.origin + u.pathname.replace(/\/$/, "") + routePath + u.search;
7018
+ url = cleaned;
7019
+ }
7011
7020
  const sanitized = urlSanitizer(url);
7012
- const safeTitle = app.sanitizer.privateMode ? stringWiper(document.title) : titleSanitizer(document.title);
7021
+ const safeTitle = app.sanitizer.privateMode
7022
+ ? stringWiper(document.title)
7023
+ : titleSanitizer(document.title);
7013
7024
  const safeUrl = app.sanitizer.privateMode ? stringWiper(sanitized) : sanitized;
7014
7025
  const safeReferrer = app.sanitizer.privateMode ? stringWiper(referrer) : referrer;
7015
7026
  app.send(SetPageLocation(safeUrl, safeReferrer, navigationStart, safeTitle));
@@ -9221,7 +9232,7 @@ class ConstantProperties {
9221
9232
  user_id: this.user_id,
9222
9233
  distinct_id: this.deviceId,
9223
9234
  sdk_edition: 'web',
9224
- sdk_version: '17.1.0',
9235
+ sdk_version: '17.1.2',
9225
9236
  timezone: getUTCOffsetString(),
9226
9237
  search_engine: this.searchEngine,
9227
9238
  };
@@ -9865,7 +9876,7 @@ class API {
9865
9876
  this.signalStartIssue = (reason, missingApi) => {
9866
9877
  const doNotTrack = this.checkDoNotTrack();
9867
9878
  console.log("Tracker couldn't start due to:", JSON.stringify({
9868
- trackerVersion: '17.1.0',
9879
+ trackerVersion: '17.1.2',
9869
9880
  projectKey: this.options.projectKey,
9870
9881
  doNotTrack,
9871
9882
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,