@openreplay/tracker 17.1.2 → 17.1.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/index.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.2'; // TODO: version compatability check inside each plugin.
4405
+ this.version = '17.1.4'; // TODO: version compatability check inside each plugin.
4406
4406
  this.socketMode = false;
4407
4407
  this.compressionThreshold = 24 * 1000;
4408
4408
  this.bc = null;
@@ -7012,7 +7012,7 @@ function Viewport (app, options) {
7012
7012
  if (options?.replaceHashSymbol) {
7013
7013
  // replace hash router symbol if needed without affecting pathname of the url
7014
7014
  const u = new URL(currURL);
7015
- const hashRoute = u.hash.startsWith("#/") ? u.hash.slice(2) : "";
7015
+ const hashRoute = u.hash.startsWith('#/') ? u.hash.slice(2) : "";
7016
7016
  const routePath = hashRoute ? "/" + hashRoute.replace(/^\/+/, "") : "";
7017
7017
  const cleaned = u.origin + u.pathname.replace(/\/$/, "") + routePath + u.search;
7018
7018
  url = cleaned;
@@ -8780,6 +8780,11 @@ function Tabs (app) {
8780
8780
  app.send(TabChange(app.session.getTabId()));
8781
8781
  }
8782
8782
  }
8783
+ app.attachStartCallback(() => {
8784
+ // just for the good measure in case of restarts caused by assist plugin,
8785
+ // to keep latest active tab in state for live player
8786
+ changeTab();
8787
+ });
8783
8788
  app.attachEventListener(window, 'focus', changeTab, false, false);
8784
8789
  }
8785
8790
 
@@ -9232,7 +9237,7 @@ class ConstantProperties {
9232
9237
  user_id: this.user_id,
9233
9238
  distinct_id: this.deviceId,
9234
9239
  sdk_edition: 'web',
9235
- sdk_version: '17.1.2',
9240
+ sdk_version: '17.1.4',
9236
9241
  timezone: getUTCOffsetString(),
9237
9242
  search_engine: this.searchEngine,
9238
9243
  };
@@ -9876,7 +9881,7 @@ class API {
9876
9881
  this.signalStartIssue = (reason, missingApi) => {
9877
9882
  const doNotTrack = this.checkDoNotTrack();
9878
9883
  console.log("Tracker couldn't start due to:", JSON.stringify({
9879
- trackerVersion: '17.1.2',
9884
+ trackerVersion: '17.1.4',
9880
9885
  projectKey: this.options.projectKey,
9881
9886
  doNotTrack,
9882
9887
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
@@ -9900,6 +9905,8 @@ class API {
9900
9905
  this.analytics?.people.identify(id, { fromTracker: true });
9901
9906
  }
9902
9907
  };
9908
+ this.identify = this.setUserID;
9909
+ this.track = this.analytics?.track;
9903
9910
  this.userID = (id) => {
9904
9911
  deprecationWarn("'userID' method", "'setUserID' method", '/');
9905
9912
  this.setUserID(id);
@@ -10000,7 +10007,17 @@ class API {
10000
10007
  const app = new App(options.projectKey, options.sessionToken, options, this.signalStartIssue, this.crossdomainMode);
10001
10008
  this.app = app;
10002
10009
  if (options.projectKey && options.analytics?.active) {
10003
- const isSaas = !options.ingestPoint || options.ingestPoint.includes('api.openreplay.com');
10010
+ let isSaas = false;
10011
+ if (!options.ingestPoint) {
10012
+ isSaas = true;
10013
+ }
10014
+ if (options.ingestPoint) {
10015
+ const saasHost = 'api.openreplay.com';
10016
+ const urlObj = new URL(options.ingestPoint);
10017
+ if (urlObj.hostname === saasHost) {
10018
+ isSaas = true;
10019
+ }
10020
+ }
10004
10021
  const defaultEdp = 'https://api.openreplay.com/ingest';
10005
10022
  this.analytics = new Analytics({
10006
10023
  localStorage: options.localStorage ?? localStorage,
@@ -10097,6 +10114,7 @@ class API {
10097
10114
  return Promise.reject("Browser doesn't support required api, or doNotTrack is active.");
10098
10115
  }
10099
10116
  if (startOpts?.userID) {
10117
+ this.app.session.setUserID(startOpts.userID);
10100
10118
  this.analytics?.people.identify(startOpts.userID, { fromTracker: true });
10101
10119
  }
10102
10120
  return this.app.start(startOpts);