@openreplay/tracker 4.1.4-beta.1 → 4.1.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
@@ -32,7 +32,7 @@ class App {
32
32
  this.stopCallbacks = [];
33
33
  this.commitCallbacks = [];
34
34
  this.activityState = ActivityState.NotActive;
35
- this.version = '4.1.4-beta.0'; // TODO: version compatability check inside each plugin.
35
+ this.version = '4.1.5'; // TODO: version compatability check inside each plugin.
36
36
  this.projectKey = projectKey;
37
37
  this.options = Object.assign({
38
38
  revID: '',
@@ -85,7 +85,7 @@ class App {
85
85
  }
86
86
  else if (data === 'restart') {
87
87
  this.stop(false);
88
- this.start({ forceNew: true });
88
+ this.start({ forceNew: true }); // TODO: keep userID & metadata (draw scenarios)
89
89
  }
90
90
  };
91
91
  const alertWorker = () => {
@@ -331,7 +331,8 @@ class App {
331
331
  (typeof beaconSizeLimit !== 'number' && typeof beaconSizeLimit !== 'undefined')) {
332
332
  return Promise.reject(`Incorrect server response: ${JSON.stringify(r)}`);
333
333
  }
334
- if (sessionID !== this.session.getInfo().sessionID) {
334
+ const prevSessionID = this.session.getInfo().sessionID;
335
+ if (prevSessionID && prevSessionID !== sessionID) {
335
336
  this.session.reset();
336
337
  }
337
338
  this.session.setSessionToken(token);
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.1.4-beta.0',
136
+ trackerVersion: '4.1.5',
137
137
  projectKey: options.projectKey,
138
138
  doNotTrack,
139
139
  // TODO: add precise reason (an exact API missing)
@@ -66,7 +66,13 @@ function default_1(app) {
66
66
  }
67
67
  }
68
68
  adoptedStyleSheetsOwnings.set(nodeID, nowOwning);
69
- }, 20);
69
+ }, 20); // Misterious bug:
70
+ /* On the page https://explore.fast.design/components/fast-accordion
71
+ the only rule inside the only adoptedStyleSheet of the iframe-s document
72
+ gets changed during first milliseconds after the load.
73
+ Howerer, none of the documented methods (replace, insertRule) is triggered.
74
+ The rule is not substituted (remains the same object), however the text gets changed.
75
+ */
70
76
  function patchAdoptedStyleSheets(prototype) {
71
77
  const nativeAdoptedStyleSheetsDescriptor = Object.getOwnPropertyDescriptor(prototype, 'adoptedStyleSheets');
72
78
  if (nativeAdoptedStyleSheetsDescriptor) {
@@ -89,32 +95,24 @@ function default_1(app) {
89
95
  }
90
96
  patchAdoptedStyleSheets(context.Document.prototype);
91
97
  patchAdoptedStyleSheets(context.ShadowRoot.prototype);
92
- //@ts-ignore TODO: configure ts
98
+ //@ts-ignore TODO: upgrade ts to 4.8+
93
99
  const { replace, replaceSync } = context.CSSStyleSheet.prototype;
94
100
  //@ts-ignore
95
101
  context.CSSStyleSheet.prototype.replace = function (text) {
96
- styleSheetIDMap.get(this) === 29 && console.log("replace with", text);
97
102
  return replace.call(this, text).then((sheet) => {
98
103
  const sheetID = styleSheetIDMap.get(this);
99
104
  if (sheetID) {
100
105
  app.send((0, messages_gen_js_1.AdoptedSSReplaceURLBased)(sheetID, text, app.getBaseHref()));
101
106
  }
102
- else {
103
- console.log("repl-async no sheet-id");
104
- }
105
107
  return sheet;
106
108
  });
107
109
  };
108
110
  //@ts-ignore
109
111
  context.CSSStyleSheet.prototype.replaceSync = function (text) {
110
112
  const sheetID = styleSheetIDMap.get(this);
111
- sheetID === 29 && console.log("replacesnc with", text);
112
113
  if (sheetID) {
113
114
  app.send((0, messages_gen_js_1.AdoptedSSReplaceURLBased)(sheetID, text, app.getBaseHref()));
114
115
  }
115
- else {
116
- console.log("replsync no sheet-id", this);
117
- }
118
116
  return replaceSync.call(this, text);
119
117
  };
120
118
  };
@@ -15,10 +15,8 @@ function default_1(app) {
15
15
  const sheetID = constructedStyleSheets_js_1.styleSheetIDMap.get(sheet);
16
16
  if (!sheetID) {
17
17
  // OK-case. Sheet haven't been registered yet. Rules will be sent on registration.
18
- console.log("no-sheet id", sheet, rule);
19
18
  return;
20
19
  }
21
- sheetID === 29 && console.log("repdel", sheet, rule);
22
20
  if (typeof rule === 'string') {
23
21
  app.send((0, messages_gen_js_1.AdoptedSSInsertRuleURLBased)(sheetID, rule, index, app.getBaseHref()));
24
22
  }
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.1.4-beta.0'; // TODO: version compatability check inside each plugin.
32
+ this.version = '4.1.5'; // TODO: version compatability check inside each plugin.
33
33
  this.projectKey = projectKey;
34
34
  this.options = Object.assign({
35
35
  revID: '',
@@ -82,7 +82,7 @@ export default class App {
82
82
  }
83
83
  else if (data === 'restart') {
84
84
  this.stop(false);
85
- this.start({ forceNew: true });
85
+ this.start({ forceNew: true }); // TODO: keep userID & metadata (draw scenarios)
86
86
  }
87
87
  };
88
88
  const alertWorker = () => {
@@ -328,7 +328,8 @@ export default class App {
328
328
  (typeof beaconSizeLimit !== 'number' && typeof beaconSizeLimit !== 'undefined')) {
329
329
  return Promise.reject(`Incorrect server response: ${JSON.stringify(r)}`);
330
330
  }
331
- if (sessionID !== this.session.getInfo().sessionID) {
331
+ const prevSessionID = this.session.getInfo().sessionID;
332
+ if (prevSessionID && prevSessionID !== sessionID) {
332
333
  this.session.reset();
333
334
  }
334
335
  this.session.setSessionToken(token);
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.1.4-beta.0',
131
+ trackerVersion: '4.1.5',
132
132
  projectKey: options.projectKey,
133
133
  doNotTrack,
134
134
  // TODO: add precise reason (an exact API missing)
@@ -62,7 +62,13 @@ export default function (app) {
62
62
  }
63
63
  }
64
64
  adoptedStyleSheetsOwnings.set(nodeID, nowOwning);
65
- }, 20);
65
+ }, 20); // Misterious bug:
66
+ /* On the page https://explore.fast.design/components/fast-accordion
67
+ the only rule inside the only adoptedStyleSheet of the iframe-s document
68
+ gets changed during first milliseconds after the load.
69
+ Howerer, none of the documented methods (replace, insertRule) is triggered.
70
+ The rule is not substituted (remains the same object), however the text gets changed.
71
+ */
66
72
  function patchAdoptedStyleSheets(prototype) {
67
73
  const nativeAdoptedStyleSheetsDescriptor = Object.getOwnPropertyDescriptor(prototype, 'adoptedStyleSheets');
68
74
  if (nativeAdoptedStyleSheetsDescriptor) {
@@ -85,32 +91,24 @@ export default function (app) {
85
91
  }
86
92
  patchAdoptedStyleSheets(context.Document.prototype);
87
93
  patchAdoptedStyleSheets(context.ShadowRoot.prototype);
88
- //@ts-ignore TODO: configure ts
94
+ //@ts-ignore TODO: upgrade ts to 4.8+
89
95
  const { replace, replaceSync } = context.CSSStyleSheet.prototype;
90
96
  //@ts-ignore
91
97
  context.CSSStyleSheet.prototype.replace = function (text) {
92
- styleSheetIDMap.get(this) === 29 && console.log("replace with", text);
93
98
  return replace.call(this, text).then((sheet) => {
94
99
  const sheetID = styleSheetIDMap.get(this);
95
100
  if (sheetID) {
96
101
  app.send(AdoptedSSReplaceURLBased(sheetID, text, app.getBaseHref()));
97
102
  }
98
- else {
99
- console.log("repl-async no sheet-id");
100
- }
101
103
  return sheet;
102
104
  });
103
105
  };
104
106
  //@ts-ignore
105
107
  context.CSSStyleSheet.prototype.replaceSync = function (text) {
106
108
  const sheetID = styleSheetIDMap.get(this);
107
- sheetID === 29 && console.log("replacesnc with", text);
108
109
  if (sheetID) {
109
110
  app.send(AdoptedSSReplaceURLBased(sheetID, text, app.getBaseHref()));
110
111
  }
111
- else {
112
- console.log("replsync no sheet-id", this);
113
- }
114
112
  return replaceSync.call(this, text);
115
113
  };
116
114
  };
@@ -14,10 +14,8 @@ export default function (app) {
14
14
  const sheetID = styleSheetIDMap.get(sheet);
15
15
  if (!sheetID) {
16
16
  // OK-case. Sheet haven't been registered yet. Rules will be sent on registration.
17
- console.log("no-sheet id", sheet, rule);
18
17
  return;
19
18
  }
20
- sheetID === 29 && console.log("repdel", sheet, rule);
21
19
  if (typeof rule === 'string') {
22
20
  app.send(AdoptedSSInsertRuleURLBased(sheetID, rule, index, app.getBaseHref()));
23
21
  }
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.4-beta.1",
4
+ "version": "4.1.5",
5
5
  "keywords": [
6
6
  "logging",
7
7
  "replay"