@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/lib/index.js CHANGED
@@ -4398,7 +4398,7 @@ class App {
4398
4398
  this.stopCallbacks = [];
4399
4399
  this.commitCallbacks = [];
4400
4400
  this.activityState = ActivityState.NotActive;
4401
- this.version = '17.1.2'; // TODO: version compatability check inside each plugin.
4401
+ this.version = '17.1.4'; // TODO: version compatability check inside each plugin.
4402
4402
  this.socketMode = false;
4403
4403
  this.compressionThreshold = 24 * 1000;
4404
4404
  this.bc = null;
@@ -7008,7 +7008,7 @@ function Viewport (app, options) {
7008
7008
  if (options?.replaceHashSymbol) {
7009
7009
  // replace hash router symbol if needed without affecting pathname of the url
7010
7010
  const u = new URL(currURL);
7011
- const hashRoute = u.hash.startsWith("#/") ? u.hash.slice(2) : "";
7011
+ const hashRoute = u.hash.startsWith('#/') ? u.hash.slice(2) : "";
7012
7012
  const routePath = hashRoute ? "/" + hashRoute.replace(/^\/+/, "") : "";
7013
7013
  const cleaned = u.origin + u.pathname.replace(/\/$/, "") + routePath + u.search;
7014
7014
  url = cleaned;
@@ -8776,6 +8776,11 @@ function Tabs (app) {
8776
8776
  app.send(TabChange(app.session.getTabId()));
8777
8777
  }
8778
8778
  }
8779
+ app.attachStartCallback(() => {
8780
+ // just for the good measure in case of restarts caused by assist plugin,
8781
+ // to keep latest active tab in state for live player
8782
+ changeTab();
8783
+ });
8779
8784
  app.attachEventListener(window, 'focus', changeTab, false, false);
8780
8785
  }
8781
8786
 
@@ -9228,7 +9233,7 @@ class ConstantProperties {
9228
9233
  user_id: this.user_id,
9229
9234
  distinct_id: this.deviceId,
9230
9235
  sdk_edition: 'web',
9231
- sdk_version: '17.1.2',
9236
+ sdk_version: '17.1.4',
9232
9237
  timezone: getUTCOffsetString(),
9233
9238
  search_engine: this.searchEngine,
9234
9239
  };
@@ -9872,7 +9877,7 @@ class API {
9872
9877
  this.signalStartIssue = (reason, missingApi) => {
9873
9878
  const doNotTrack = this.checkDoNotTrack();
9874
9879
  console.log("Tracker couldn't start due to:", JSON.stringify({
9875
- trackerVersion: '17.1.2',
9880
+ trackerVersion: '17.1.4',
9876
9881
  projectKey: this.options.projectKey,
9877
9882
  doNotTrack,
9878
9883
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
@@ -9896,6 +9901,8 @@ class API {
9896
9901
  this.analytics?.people.identify(id, { fromTracker: true });
9897
9902
  }
9898
9903
  };
9904
+ this.identify = this.setUserID;
9905
+ this.track = this.analytics?.track;
9899
9906
  this.userID = (id) => {
9900
9907
  deprecationWarn("'userID' method", "'setUserID' method", '/');
9901
9908
  this.setUserID(id);
@@ -9996,7 +10003,17 @@ class API {
9996
10003
  const app = new App(options.projectKey, options.sessionToken, options, this.signalStartIssue, this.crossdomainMode);
9997
10004
  this.app = app;
9998
10005
  if (options.projectKey && options.analytics?.active) {
9999
- const isSaas = !options.ingestPoint || options.ingestPoint.includes('api.openreplay.com');
10006
+ let isSaas = false;
10007
+ if (!options.ingestPoint) {
10008
+ isSaas = true;
10009
+ }
10010
+ if (options.ingestPoint) {
10011
+ const saasHost = 'api.openreplay.com';
10012
+ const urlObj = new URL(options.ingestPoint);
10013
+ if (urlObj.hostname === saasHost) {
10014
+ isSaas = true;
10015
+ }
10016
+ }
10000
10017
  const defaultEdp = 'https://api.openreplay.com/ingest';
10001
10018
  this.analytics = new Analytics({
10002
10019
  localStorage: options.localStorage ?? localStorage,
@@ -10093,6 +10110,7 @@ class API {
10093
10110
  return Promise.reject("Browser doesn't support required api, or doNotTrack is active.");
10094
10111
  }
10095
10112
  if (startOpts?.userID) {
10113
+ this.app.session.setUserID(startOpts.userID);
10096
10114
  this.analytics?.people.identify(startOpts.userID, { fromTracker: true });
10097
10115
  }
10098
10116
  return this.app.start(startOpts);