@openreplay/tracker 12.0.9-beta.2 → 12.0.9-beta.5

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
@@ -80,7 +80,7 @@ class App {
80
80
  this.stopCallbacks = [];
81
81
  this.commitCallbacks = [];
82
82
  this.activityState = ActivityState.NotActive;
83
- this.version = '12.0.9-beta.2'; // TODO: version compatability check inside each plugin.
83
+ this.version = '12.0.9-beta.5'; // TODO: version compatability check inside each plugin.
84
84
  this.compressionThreshold = 24 * 1000;
85
85
  this.restartAttempts = 0;
86
86
  this.bc = null;
@@ -956,9 +956,15 @@ class App {
956
956
  * and here we just apply 10ms delay just in case
957
957
  * */
958
958
  start(...args) {
959
+ if (this.activityState === ActivityState.Active ||
960
+ this.activityState === ActivityState.Starting) {
961
+ const reason = 'OpenReplay: trying to call `start()` on the instance that has been started already.';
962
+ return Promise.resolve(UnsuccessfulStart(reason));
963
+ }
959
964
  if (!document.hidden) {
960
965
  return new Promise((resolve) => {
961
966
  setTimeout(() => {
967
+ this.activityState = ActivityState.Starting;
962
968
  resolve(this._start(...args));
963
969
  }, 25);
964
970
  });
@@ -969,6 +975,7 @@ class App {
969
975
  if (!document.hidden) {
970
976
  document.removeEventListener('visibilitychange', onVisibilityChange);
971
977
  setTimeout(() => {
978
+ this.activityState = ActivityState.Starting;
972
979
  resolve(this._start(...args));
973
980
  }, 25);
974
981
  }
@@ -94,6 +94,7 @@ class TopObserver extends observer_js_1.default {
94
94
  observer.handleShadowRoot(shadow);
95
95
  return shadow;
96
96
  };
97
+ this.app.nodes.clear();
97
98
  // Can observe documentElement (<html>) here, because it is not supposed to be changing.
98
99
  // However, it is possible in some exotic cases and may cause an ignorance of the newly created <html>
99
100
  // In this case context.document have to be observed, but this will cause
package/cjs/index.js CHANGED
@@ -97,7 +97,7 @@ class API {
97
97
  const orig = this.options.ingestPoint || index_js_1.DEFAULT_INGEST_POINT;
98
98
  req.open('POST', orig + '/v1/web/not-started');
99
99
  req.send(JSON.stringify({
100
- trackerVersion: '12.0.9-beta.2',
100
+ trackerVersion: '12.0.9-beta.5',
101
101
  projectKey: this.options.projectKey,
102
102
  doNotTrack,
103
103
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
package/lib/app/index.js CHANGED
@@ -51,7 +51,7 @@ export default class App {
51
51
  this.stopCallbacks = [];
52
52
  this.commitCallbacks = [];
53
53
  this.activityState = ActivityState.NotActive;
54
- this.version = '12.0.9-beta.2'; // TODO: version compatability check inside each plugin.
54
+ this.version = '12.0.9-beta.5'; // TODO: version compatability check inside each plugin.
55
55
  this.compressionThreshold = 24 * 1000;
56
56
  this.restartAttempts = 0;
57
57
  this.bc = null;
@@ -927,9 +927,15 @@ export default class App {
927
927
  * and here we just apply 10ms delay just in case
928
928
  * */
929
929
  start(...args) {
930
+ if (this.activityState === ActivityState.Active ||
931
+ this.activityState === ActivityState.Starting) {
932
+ const reason = 'OpenReplay: trying to call `start()` on the instance that has been started already.';
933
+ return Promise.resolve(UnsuccessfulStart(reason));
934
+ }
930
935
  if (!document.hidden) {
931
936
  return new Promise((resolve) => {
932
937
  setTimeout(() => {
938
+ this.activityState = ActivityState.Starting;
933
939
  resolve(this._start(...args));
934
940
  }, 25);
935
941
  });
@@ -940,6 +946,7 @@ export default class App {
940
946
  if (!document.hidden) {
941
947
  document.removeEventListener('visibilitychange', onVisibilityChange);
942
948
  setTimeout(() => {
949
+ this.activityState = ActivityState.Starting;
943
950
  resolve(this._start(...args));
944
951
  }, 25);
945
952
  }
@@ -89,6 +89,7 @@ export default class TopObserver extends Observer {
89
89
  observer.handleShadowRoot(shadow);
90
90
  return shadow;
91
91
  };
92
+ this.app.nodes.clear();
92
93
  // Can observe documentElement (<html>) here, because it is not supposed to be changing.
93
94
  // However, it is possible in some exotic cases and may cause an ignorance of the newly created <html>
94
95
  // In this case context.document have to be observed, but this will cause
package/lib/index.js CHANGED
@@ -66,7 +66,7 @@ export default class API {
66
66
  const orig = this.options.ingestPoint || DEFAULT_INGEST_POINT;
67
67
  req.open('POST', orig + '/v1/web/not-started');
68
68
  req.send(JSON.stringify({
69
- trackerVersion: '12.0.9-beta.2',
69
+ trackerVersion: '12.0.9-beta.5',
70
70
  projectKey: this.options.projectKey,
71
71
  doNotTrack,
72
72
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
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": "12.0.9-beta.2",
4
+ "version": "12.0.9-beta.5",
5
5
  "keywords": [
6
6
  "logging",
7
7
  "replay"