@openreplay/tracker 4.1.3 → 4.1.4-beta

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/cjs/app/index.js CHANGED
@@ -32,7 +32,7 @@ class App {
32
32
  this.stopCallbacks = [];
33
33
  this.commitCallbacks = [];
34
34
  this.activityState = ActivityState.NotActive;
35
- this.version = '4.0.1'; // TODO: version compatability check inside each plugin.
35
+ this.version = '4.1.3'; // TODO: version compatability check inside each plugin.
36
36
  this.projectKey = projectKey;
37
37
  this.options = Object.assign({
38
38
  revID: '',
@@ -216,10 +216,13 @@ class App {
216
216
  this.debug.error('OpenReplay error: Unable to build session URL');
217
217
  return undefined;
218
218
  }
219
- return this.options.ingestPoint.replace(/ingest$/, `${projectID}/session/${sessionID}`);
219
+ const ingest = this.options.ingestPoint;
220
+ const isSaas = ingest === exports.DEFAULT_INGEST_POINT;
221
+ const projectPath = isSaas ? ingest.replace('api', 'app') : ingest;
222
+ return projectPath.replace(/ingest$/, `${projectID}/session/${sessionID}`);
220
223
  }
221
224
  getHost() {
222
- return new URL(this.options.ingestPoint).hostname;
225
+ return new URL(this.options.ingestPoint).host;
223
226
  }
224
227
  getProjectKey() {
225
228
  return this.projectKey;
package/cjs/index.js CHANGED
@@ -133,7 +133,7 @@ class API {
133
133
  // no-cors issue only with text/plain or not-set Content-Type
134
134
  // req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
135
135
  req.send(JSON.stringify({
136
- trackerVersion: '4.0.1',
136
+ trackerVersion: '4.1.3',
137
137
  projectKey: options.projectKey,
138
138
  doNotTrack,
139
139
  // TODO: add precise reason (an exact API missing)
package/cjs/utils.js CHANGED
@@ -5,7 +5,7 @@ const DEPRECATED_ATTRS = { htmlmasked: 'hidden', masked: 'obscured' };
5
5
  exports.IN_BROWSER = !(typeof window === 'undefined');
6
6
  exports.IS_FIREFOX = exports.IN_BROWSER && navigator.userAgent.match(/firefox|fxios/i);
7
7
  exports.MAX_STR_LEN = 1e5;
8
- const navigationStart = (exports.IN_BROWSER && performance.timing.navigationStart) || performance.timeOrigin;
8
+ const navigationStart = exports.IN_BROWSER && (performance.timing.navigationStart || performance.timeOrigin);
9
9
  // performance.now() is buggy in some browsers
10
10
  exports.timestamp = exports.IN_BROWSER && performance.now() && navigationStart
11
11
  ? () => Math.round(performance.now() + navigationStart)
package/lib/app/index.js CHANGED
@@ -29,7 +29,7 @@ export default class App {
29
29
  this.stopCallbacks = [];
30
30
  this.commitCallbacks = [];
31
31
  this.activityState = ActivityState.NotActive;
32
- this.version = '4.0.1'; // TODO: version compatability check inside each plugin.
32
+ this.version = '4.1.3'; // TODO: version compatability check inside each plugin.
33
33
  this.projectKey = projectKey;
34
34
  this.options = Object.assign({
35
35
  revID: '',
@@ -213,10 +213,13 @@ export default class App {
213
213
  this.debug.error('OpenReplay error: Unable to build session URL');
214
214
  return undefined;
215
215
  }
216
- return this.options.ingestPoint.replace(/ingest$/, `${projectID}/session/${sessionID}`);
216
+ const ingest = this.options.ingestPoint;
217
+ const isSaas = ingest === DEFAULT_INGEST_POINT;
218
+ const projectPath = isSaas ? ingest.replace('api', 'app') : ingest;
219
+ return projectPath.replace(/ingest$/, `${projectID}/session/${sessionID}`);
217
220
  }
218
221
  getHost() {
219
- return new URL(this.options.ingestPoint).hostname;
222
+ return new URL(this.options.ingestPoint).host;
220
223
  }
221
224
  getProjectKey() {
222
225
  return this.projectKey;
package/lib/index.js CHANGED
@@ -128,7 +128,7 @@ export default class API {
128
128
  // no-cors issue only with text/plain or not-set Content-Type
129
129
  // req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
130
130
  req.send(JSON.stringify({
131
- trackerVersion: '4.0.1',
131
+ trackerVersion: '4.1.3',
132
132
  projectKey: options.projectKey,
133
133
  doNotTrack,
134
134
  // TODO: add precise reason (an exact API missing)
package/lib/utils.js CHANGED
@@ -2,7 +2,7 @@ const DEPRECATED_ATTRS = { htmlmasked: 'hidden', masked: 'obscured' };
2
2
  export const IN_BROWSER = !(typeof window === 'undefined');
3
3
  export const IS_FIREFOX = IN_BROWSER && navigator.userAgent.match(/firefox|fxios/i);
4
4
  export const MAX_STR_LEN = 1e5;
5
- const navigationStart = (IN_BROWSER && performance.timing.navigationStart) || performance.timeOrigin;
5
+ const navigationStart = IN_BROWSER && (performance.timing.navigationStart || performance.timeOrigin);
6
6
  // performance.now() is buggy in some browsers
7
7
  export const timestamp = IN_BROWSER && performance.now() && navigationStart
8
8
  ? () => Math.round(performance.now() + navigationStart)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openreplay/tracker",
3
3
  "description": "The OpenReplay tracker main package",
4
- "version": "4.1.3",
4
+ "version": "4.1.4-beta",
5
5
  "keywords": [
6
6
  "logging",
7
7
  "replay"