@openreplay/tracker 3.6.1 → 3.6.2

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.
Files changed (128) hide show
  1. package/LICENSE +1 -1
  2. package/cjs/app/guards.d.ts +1 -2
  3. package/cjs/app/guards.js +3 -6
  4. package/cjs/app/index.d.ts +23 -28
  5. package/cjs/app/index.js +86 -107
  6. package/cjs/app/logger.js +3 -6
  7. package/cjs/app/nodes.d.ts +1 -1
  8. package/cjs/app/nodes.js +0 -2
  9. package/cjs/app/observer/iframe_observer.d.ts +1 -1
  10. package/cjs/app/observer/iframe_observer.js +3 -3
  11. package/cjs/app/observer/observer.d.ts +3 -2
  12. package/cjs/app/observer/observer.js +52 -50
  13. package/cjs/app/observer/shadow_root_observer.d.ts +1 -1
  14. package/cjs/app/observer/shadow_root_observer.js +3 -3
  15. package/cjs/app/observer/top_observer.d.ts +2 -13
  16. package/cjs/app/observer/top_observer.js +23 -58
  17. package/cjs/app/sanitizer.d.ts +1 -1
  18. package/cjs/app/sanitizer.js +5 -5
  19. package/cjs/app/session.d.ts +2 -20
  20. package/cjs/app/session.js +6 -65
  21. package/cjs/app/ticker.d.ts +1 -1
  22. package/cjs/common/messages.d.ts +444 -0
  23. package/cjs/common/messages.js +794 -0
  24. package/cjs/common/types.d.ts +9 -0
  25. package/cjs/common/{interaction.js → types.js} +0 -0
  26. package/cjs/common/{interaction.d.ts → webworker.d.ts} +5 -5
  27. package/cjs/common/{messages.gen.js → webworker.js} +0 -1
  28. package/cjs/index.d.ts +9 -10
  29. package/cjs/index.js +36 -47
  30. package/cjs/modules/connection.d.ts +1 -1
  31. package/cjs/modules/connection.js +2 -2
  32. package/cjs/modules/console.d.ts +1 -1
  33. package/cjs/modules/console.js +21 -7
  34. package/cjs/modules/cssrules.d.ts +1 -1
  35. package/cjs/modules/cssrules.js +14 -18
  36. package/cjs/modules/exception.d.ts +3 -3
  37. package/cjs/modules/exception.js +18 -23
  38. package/cjs/modules/img.d.ts +1 -1
  39. package/cjs/modules/img.js +26 -39
  40. package/cjs/modules/input.d.ts +1 -1
  41. package/cjs/modules/input.js +21 -21
  42. package/cjs/modules/longtasks.d.ts +2 -0
  43. package/cjs/modules/longtasks.js +26 -0
  44. package/cjs/modules/mouse.d.ts +1 -1
  45. package/cjs/modules/mouse.js +43 -50
  46. package/cjs/modules/performance.d.ts +1 -1
  47. package/cjs/modules/performance.js +2 -2
  48. package/cjs/modules/scroll.d.ts +1 -1
  49. package/cjs/modules/scroll.js +7 -16
  50. package/cjs/modules/timing.d.ts +1 -1
  51. package/cjs/modules/timing.js +26 -14
  52. package/cjs/modules/viewport.d.ts +1 -1
  53. package/cjs/modules/viewport.js +4 -4
  54. package/cjs/utils.js +7 -7
  55. package/cjs/vendors/finder/finder.js +48 -53
  56. package/lib/app/guards.d.ts +1 -2
  57. package/lib/app/guards.js +2 -4
  58. package/lib/app/index.d.ts +23 -28
  59. package/lib/app/index.js +94 -115
  60. package/lib/app/logger.js +3 -6
  61. package/lib/app/nodes.d.ts +1 -1
  62. package/lib/app/nodes.js +0 -2
  63. package/lib/app/observer/iframe_observer.d.ts +1 -1
  64. package/lib/app/observer/iframe_observer.js +3 -3
  65. package/lib/app/observer/observer.d.ts +3 -2
  66. package/lib/app/observer/observer.js +53 -51
  67. package/lib/app/observer/shadow_root_observer.d.ts +1 -1
  68. package/lib/app/observer/shadow_root_observer.js +3 -3
  69. package/lib/app/observer/top_observer.d.ts +2 -13
  70. package/lib/app/observer/top_observer.js +27 -62
  71. package/lib/app/sanitizer.d.ts +1 -1
  72. package/lib/app/sanitizer.js +7 -7
  73. package/lib/app/session.d.ts +2 -20
  74. package/lib/app/session.js +6 -65
  75. package/lib/app/ticker.d.ts +1 -1
  76. package/lib/common/messages.d.ts +444 -0
  77. package/lib/common/messages.js +790 -0
  78. package/lib/common/tsconfig.tsbuildinfo +1 -1
  79. package/lib/common/types.d.ts +9 -0
  80. package/lib/common/{interaction.js → types.js} +0 -0
  81. package/lib/common/{interaction.d.ts → webworker.d.ts} +5 -5
  82. package/lib/common/webworker.js +1 -0
  83. package/lib/index.d.ts +9 -10
  84. package/lib/index.js +49 -60
  85. package/lib/modules/connection.d.ts +1 -1
  86. package/lib/modules/connection.js +2 -2
  87. package/lib/modules/console.d.ts +1 -1
  88. package/lib/modules/console.js +22 -8
  89. package/lib/modules/cssrules.d.ts +1 -1
  90. package/lib/modules/cssrules.js +15 -19
  91. package/lib/modules/exception.d.ts +3 -3
  92. package/lib/modules/exception.js +18 -23
  93. package/lib/modules/img.d.ts +1 -1
  94. package/lib/modules/img.js +28 -41
  95. package/lib/modules/input.d.ts +1 -1
  96. package/lib/modules/input.js +23 -23
  97. package/lib/modules/longtasks.d.ts +2 -0
  98. package/lib/modules/longtasks.js +23 -0
  99. package/lib/modules/mouse.d.ts +1 -1
  100. package/lib/modules/mouse.js +46 -53
  101. package/lib/modules/performance.d.ts +1 -1
  102. package/lib/modules/performance.js +3 -3
  103. package/lib/modules/scroll.d.ts +1 -1
  104. package/lib/modules/scroll.js +8 -17
  105. package/lib/modules/timing.d.ts +1 -1
  106. package/lib/modules/timing.js +28 -16
  107. package/lib/modules/viewport.d.ts +1 -1
  108. package/lib/modules/viewport.js +4 -4
  109. package/lib/utils.js +7 -7
  110. package/lib/vendors/finder/finder.js +48 -53
  111. package/package.json +10 -27
  112. package/.eslintignore +0 -8
  113. package/.prettierignore +0 -1
  114. package/cjs/app/messages.d.ts +0 -52
  115. package/cjs/app/messages.gen.d.ts +0 -57
  116. package/cjs/app/messages.gen.js +0 -493
  117. package/cjs/app/messages.js +0 -234
  118. package/cjs/common/messages.gen.d.ts +0 -382
  119. package/cjs/modules/adoptedStyleSheets.d.ts +0 -2
  120. package/cjs/modules/adoptedStyleSheets.js +0 -127
  121. package/lib/app/messages.d.ts +0 -52
  122. package/lib/app/messages.gen.d.ts +0 -57
  123. package/lib/app/messages.gen.js +0 -434
  124. package/lib/app/messages.js +0 -181
  125. package/lib/common/messages.gen.d.ts +0 -382
  126. package/lib/common/messages.gen.js +0 -2
  127. package/lib/modules/adoptedStyleSheets.d.ts +0 -2
  128. package/lib/modules/adoptedStyleSheets.js +0 -124
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const messages_gen_js_1 = require("../app/messages.gen.js");
3
+ const messages_js_1 = require("../common/messages.js");
4
4
  function default_1(app) {
5
5
  let url, width, height;
6
6
  let navigationStart = performance.timing.navigationStart;
@@ -8,7 +8,7 @@ function default_1(app) {
8
8
  const { URL } = document;
9
9
  if (URL !== url) {
10
10
  url = URL;
11
- app.send((0, messages_gen_js_1.SetPageLocation)(url, document.referrer, navigationStart));
11
+ app.send(new messages_js_1.SetPageLocation(url, document.referrer, navigationStart));
12
12
  navigationStart = 0;
13
13
  }
14
14
  });
@@ -17,12 +17,12 @@ function default_1(app) {
17
17
  if (innerWidth !== width || innerHeight !== height) {
18
18
  width = innerWidth;
19
19
  height = innerHeight;
20
- app.send((0, messages_gen_js_1.SetViewportSize)(width, height));
20
+ app.send(new messages_js_1.SetViewportSize(width, height));
21
21
  }
22
22
  });
23
23
  const sendSetPageVisibility = document.hidden === undefined
24
24
  ? Function.prototype
25
- : app.safe(() => app.send((0, messages_gen_js_1.SetPageVisibility)(document.hidden)));
25
+ : app.safe(() => app.send(new messages_js_1.SetPageVisibility(document.hidden)));
26
26
  app.attachStartCallback(() => {
27
27
  url = '';
28
28
  width = height = -1;
package/cjs/utils.js CHANGED
@@ -17,26 +17,26 @@ function isURL(s) {
17
17
  return s.startsWith('https://') || s.startsWith('http://');
18
18
  }
19
19
  exports.isURL = isURL;
20
- exports.IN_BROWSER = !(typeof window === 'undefined');
20
+ exports.IN_BROWSER = !(typeof window === "undefined");
21
21
  // TODO: JOIN IT WITH LOGGER somehow (use logging decorators?); Don't forget about index.js loggin when there is no logger instance.
22
22
  exports.DOCS_HOST = 'https://docs.openreplay.com';
23
23
  const warnedFeatures = {};
24
- function deprecationWarn(nameOfFeature, useInstead, docsPath = '/') {
24
+ function deprecationWarn(nameOfFeature, useInstead, docsPath = "/") {
25
25
  if (warnedFeatures[nameOfFeature]) {
26
26
  return;
27
27
  }
28
- console.warn(`OpenReplay: ${nameOfFeature} is deprecated. ${useInstead ? `Please, use ${useInstead} instead.` : ''} Visit ${exports.DOCS_HOST}${docsPath} for more information.`);
28
+ console.warn(`OpenReplay: ${nameOfFeature} is deprecated. ${useInstead ? `Please, use ${useInstead} instead.` : ""} Visit ${exports.DOCS_HOST}${docsPath} for more information.`);
29
29
  warnedFeatures[nameOfFeature] = true;
30
30
  }
31
31
  exports.deprecationWarn = deprecationWarn;
32
32
  function getLabelAttribute(e) {
33
- let value = e.getAttribute('data-openreplay-label');
33
+ let value = e.getAttribute("data-openreplay-label");
34
34
  if (value !== null) {
35
35
  return value;
36
36
  }
37
- value = e.getAttribute('data-asayer-label');
37
+ value = e.getAttribute("data-asayer-label");
38
38
  if (value !== null) {
39
- deprecationWarn('"data-asayer-label" attribute', '"data-openreplay-label" attribute', '/');
39
+ deprecationWarn(`"data-asayer-label" attribute`, `"data-openreplay-label" attribute`, "/");
40
40
  }
41
41
  return value;
42
42
  }
@@ -48,7 +48,7 @@ function hasOpenreplayAttribute(e, name) {
48
48
  }
49
49
  const oldName = `data-asayer-${name}`;
50
50
  if (e.hasAttribute(oldName)) {
51
- deprecationWarn(`"${oldName}" attribute`, `"${newName}" attribute`, '/installation/sanitize-data');
51
+ deprecationWarn(`"${oldName}" attribute`, `"${newName}" attribute`, "/installation/sanitize-data");
52
52
  return true;
53
53
  }
54
54
  return false;
@@ -11,10 +11,10 @@ let config;
11
11
  let rootDocument;
12
12
  function finder(input, options) {
13
13
  if (input.nodeType !== Node.ELEMENT_NODE) {
14
- throw new Error("Can't generate CSS selector for non-element node type.");
14
+ throw new Error(`Can't generate CSS selector for non-element node type.`);
15
15
  }
16
- if ('html' === input.tagName.toLowerCase()) {
17
- return 'html';
16
+ if ("html" === input.tagName.toLowerCase()) {
17
+ return "html";
18
18
  }
19
19
  const defaults = {
20
20
  root: document.body,
@@ -38,7 +38,7 @@ function finder(input, options) {
38
38
  return selector(path);
39
39
  }
40
40
  else {
41
- throw new Error('Selector was not found.');
41
+ throw new Error(`Selector was not found.`);
42
42
  }
43
43
  }
44
44
  exports.finder = finder;
@@ -53,33 +53,30 @@ function findRootDocument(rootNode, defaults) {
53
53
  }
54
54
  function bottomUpSearch(input, limit, fallback) {
55
55
  let path = null;
56
- const stack = [];
56
+ let stack = [];
57
57
  let current = input;
58
58
  let i = 0;
59
59
  while (current && current !== config.root.parentElement) {
60
- let level = maybe(id(current)) ||
61
- maybe(...attr(current)) ||
62
- maybe(...classNames(current)) ||
63
- maybe(tagName(current)) || [any()];
60
+ let level = maybe(id(current)) || maybe(...attr(current)) || maybe(...classNames(current)) || maybe(tagName(current)) || [any()];
64
61
  const nth = index(current);
65
62
  if (limit === Limit.All) {
66
63
  if (nth) {
67
- level = level.concat(level.filter(dispensableNth).map((node) => nthChild(node, nth)));
64
+ level = level.concat(level.filter(dispensableNth).map(node => nthChild(node, nth)));
68
65
  }
69
66
  }
70
67
  else if (limit === Limit.Two) {
71
68
  level = level.slice(0, 1);
72
69
  if (nth) {
73
- level = level.concat(level.filter(dispensableNth).map((node) => nthChild(node, nth)));
70
+ level = level.concat(level.filter(dispensableNth).map(node => nthChild(node, nth)));
74
71
  }
75
72
  }
76
73
  else if (limit === Limit.One) {
77
- const [node] = (level = level.slice(0, 1));
74
+ const [node] = level = level.slice(0, 1);
78
75
  if (nth && dispensableNth(node)) {
79
76
  level = [nthChild(node, nth)];
80
77
  }
81
78
  }
82
- for (const node of level) {
79
+ for (let node of level) {
83
80
  node.level = i;
84
81
  }
85
82
  stack.push(level);
@@ -102,7 +99,7 @@ function findUniquePath(stack, fallback) {
102
99
  if (paths.length > config.threshold) {
103
100
  return fallback ? fallback() : null;
104
101
  }
105
- for (const candidate of paths) {
102
+ for (let candidate of paths) {
106
103
  if (unique(candidate)) {
107
104
  return candidate;
108
105
  }
@@ -125,7 +122,7 @@ function selector(path) {
125
122
  return query;
126
123
  }
127
124
  function penalty(path) {
128
- return path.map((node) => node.penalty).reduce((acc, i) => acc + i, 0);
125
+ return path.map(node => node.penalty).reduce((acc, i) => acc + i, 0);
129
126
  }
130
127
  function unique(path) {
131
128
  switch (rootDocument.querySelectorAll(selector(path)).length) {
@@ -138,10 +135,10 @@ function unique(path) {
138
135
  }
139
136
  }
140
137
  function id(input) {
141
- const elementId = input.getAttribute('id');
138
+ const elementId = input.getAttribute("id");
142
139
  if (elementId && config.idName(elementId)) {
143
140
  return {
144
- name: '#' + cssesc(elementId, { isIdentifier: true }),
141
+ name: "#" + cssesc(elementId, { isIdentifier: true }),
145
142
  penalty: 0,
146
143
  };
147
144
  }
@@ -150,15 +147,16 @@ function id(input) {
150
147
  function attr(input) {
151
148
  const attrs = Array.from(input.attributes).filter((attr) => config.attr(attr.name, attr.value));
152
149
  return attrs.map((attr) => ({
153
- name: '[' + cssesc(attr.name, { isIdentifier: true }) + '="' + cssesc(attr.value) + '"]',
154
- penalty: 0.5,
150
+ name: "[" + cssesc(attr.name, { isIdentifier: true }) + "=\"" + cssesc(attr.value) + "\"]",
151
+ penalty: 0.5
155
152
  }));
156
153
  }
157
154
  function classNames(input) {
158
- const names = Array.from(input.classList).filter(config.className);
155
+ const names = Array.from(input.classList)
156
+ .filter(config.className);
159
157
  return names.map((name) => ({
160
- name: '.' + cssesc(name, { isIdentifier: true }),
161
- penalty: 1,
158
+ name: "." + cssesc(name, { isIdentifier: true }),
159
+ penalty: 1
162
160
  }));
163
161
  }
164
162
  function tagName(input) {
@@ -166,15 +164,15 @@ function tagName(input) {
166
164
  if (config.tagName(name)) {
167
165
  return {
168
166
  name,
169
- penalty: 2,
167
+ penalty: 2
170
168
  };
171
169
  }
172
170
  return null;
173
171
  }
174
172
  function any() {
175
173
  return {
176
- name: '*',
177
- penalty: 3,
174
+ name: "*",
175
+ penalty: 3
178
176
  };
179
177
  }
180
178
  function index(input) {
@@ -201,11 +199,11 @@ function index(input) {
201
199
  function nthChild(node, i) {
202
200
  return {
203
201
  name: node.name + `:nth-child(${i})`,
204
- penalty: node.penalty + 1,
202
+ penalty: node.penalty + 1
205
203
  };
206
204
  }
207
205
  function dispensableNth(node) {
208
- return node.name !== 'html' && !node.name.startsWith('#');
206
+ return node.name !== "html" && !node.name.startsWith("#");
209
207
  }
210
208
  function maybe(...level) {
211
209
  const list = level.filter(notEmpty);
@@ -220,7 +218,7 @@ function notEmpty(value) {
220
218
  function combinations(stack, path = []) {
221
219
  const paths = [];
222
220
  if (stack.length > 0) {
223
- for (const node of stack[0]) {
221
+ for (let node of stack[0]) {
224
222
  paths.push(...combinations(stack.slice(1, stack.length), path.concat(node)));
225
223
  }
226
224
  }
@@ -234,7 +232,7 @@ function sort(paths) {
234
232
  }
235
233
  function optimize(path, input, scope = {
236
234
  counter: 0,
237
- visited: new Map(),
235
+ visited: new Map()
238
236
  }) {
239
237
  const paths = [];
240
238
  if (path.length > 2 && path.length > config.optimizedMinLength) {
@@ -265,20 +263,20 @@ const regexAnySingleEscape = /[ -,\.\/:-@\[-\^`\{-~]/;
265
263
  const regexSingleEscape = /[ -,\.\/:-@\[\]\^`\{-~]/;
266
264
  const regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;
267
265
  const defaultOptions = {
268
- escapeEverything: false,
269
- isIdentifier: false,
270
- quotes: 'single',
271
- wrap: false,
266
+ "escapeEverything": false,
267
+ "isIdentifier": false,
268
+ "quotes": "single",
269
+ "wrap": false
272
270
  };
273
271
  function cssesc(string, opt = {}) {
274
272
  const options = Object.assign(Object.assign({}, defaultOptions), opt);
275
- if (options.quotes != 'single' && options.quotes != 'double') {
276
- options.quotes = 'single';
273
+ if (options.quotes != "single" && options.quotes != "double") {
274
+ options.quotes = "single";
277
275
  }
278
- const quote = options.quotes == 'double' ? '"' : "'";
276
+ const quote = options.quotes == "double" ? "\"" : "'";
279
277
  const isIdentifier = options.isIdentifier;
280
278
  const firstChar = string.charAt(0);
281
- let output = '';
279
+ let output = "";
282
280
  let counter = 0;
283
281
  const length = string.length;
284
282
  while (counter < length) {
@@ -286,13 +284,13 @@ function cssesc(string, opt = {}) {
286
284
  let codePoint = character.charCodeAt(0);
287
285
  let value = void 0;
288
286
  // If it’s not a printable ASCII character…
289
- if (codePoint < 0x20 || codePoint > 0x7e) {
290
- if (codePoint >= 0xd800 && codePoint <= 0xdbff && counter < length) {
287
+ if (codePoint < 0x20 || codePoint > 0x7E) {
288
+ if (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) {
291
289
  // It’s a high surrogate, and there is a next character.
292
290
  const extra = string.charCodeAt(counter++);
293
- if ((extra & 0xfc00) == 0xdc00) {
291
+ if ((extra & 0xFC00) == 0xDC00) {
294
292
  // next character is low surrogate
295
- codePoint = ((codePoint & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000;
293
+ codePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000;
296
294
  }
297
295
  else {
298
296
  // It’s an unmatched surrogate; only append this code unit, in case
@@ -300,25 +298,22 @@ function cssesc(string, opt = {}) {
300
298
  counter--;
301
299
  }
302
300
  }
303
- value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
301
+ value = "\\" + codePoint.toString(16).toUpperCase() + " ";
304
302
  }
305
303
  else {
306
304
  if (options.escapeEverything) {
307
305
  if (regexAnySingleEscape.test(character)) {
308
- value = '\\' + character;
306
+ value = "\\" + character;
309
307
  }
310
308
  else {
311
- value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
309
+ value = "\\" + codePoint.toString(16).toUpperCase() + " ";
312
310
  }
313
311
  }
314
312
  else if (/[\t\n\f\r\x0B]/.test(character)) {
315
- value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
313
+ value = "\\" + codePoint.toString(16).toUpperCase() + " ";
316
314
  }
317
- else if (character == '\\' ||
318
- (!isIdentifier &&
319
- ((character == '"' && quote == character) || (character == "'" && quote == character))) ||
320
- (isIdentifier && regexSingleEscape.test(character))) {
321
- value = '\\' + character;
315
+ else if (character == "\\" || !isIdentifier && (character == "\"" && quote == character || character == "'" && quote == character) || isIdentifier && regexSingleEscape.test(character)) {
316
+ value = "\\" + character;
322
317
  }
323
318
  else {
324
319
  value = character;
@@ -328,10 +323,10 @@ function cssesc(string, opt = {}) {
328
323
  }
329
324
  if (isIdentifier) {
330
325
  if (/^-[-\d]/.test(output)) {
331
- output = '\\-' + output.slice(1);
326
+ output = "\\-" + output.slice(1);
332
327
  }
333
328
  else if (/\d/.test(firstChar)) {
334
- output = '\\3' + firstChar + ' ' + output.slice(1);
329
+ output = "\\3" + firstChar + " " + output.slice(1);
335
330
  }
336
331
  }
337
332
  // Remove spaces after `\HEX` escapes that are not followed by a hex digit,
@@ -343,7 +338,7 @@ function cssesc(string, opt = {}) {
343
338
  return $0;
344
339
  }
345
340
  // Strip the space.
346
- return ($1 || '') + $2;
341
+ return ($1 || "") + $2;
347
342
  });
348
343
  if (!isIdentifier && options.wrap) {
349
344
  return quote + output + quote;
@@ -1,8 +1,7 @@
1
1
  export declare function isSVGElement(node: Element): node is SVGElement;
2
2
  export declare function isElementNode(node: Node): node is Element;
3
3
  export declare function isTextNode(node: Node): node is Text;
4
- export declare function isDocument(node: Node): node is Document;
5
- export declare function isRootNode(node: Node): node is Document | DocumentFragment;
4
+ export declare function isRootNode(node: Node): boolean;
6
5
  declare type TagTypeMap = {
7
6
  HTML: HTMLHtmlElement;
8
7
  IMG: HTMLImageElement;
package/lib/app/guards.js CHANGED
@@ -7,11 +7,9 @@ export function isElementNode(node) {
7
7
  export function isTextNode(node) {
8
8
  return node.nodeType === Node.TEXT_NODE;
9
9
  }
10
- export function isDocument(node) {
11
- return node.nodeType === Node.DOCUMENT_NODE;
12
- }
13
10
  export function isRootNode(node) {
14
- return node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
11
+ return node.nodeType === Node.DOCUMENT_NODE ||
12
+ node.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
15
13
  }
16
14
  export function hasTag(el, tagName) {
17
15
  return el.nodeName === tagName;
@@ -1,20 +1,17 @@
1
- import type Message from './messages.gen.js';
2
- import Nodes from './nodes.js';
3
- import Observer from './observer/top_observer.js';
4
- import Sanitizer from './sanitizer.js';
5
- import Ticker from './ticker.js';
6
- import Logger from './logger.js';
7
- import Session from './session.js';
8
- import type { Options as ObserverOptions } from './observer/top_observer.js';
9
- import type { Options as SanitizerOptions } from './sanitizer.js';
10
- import type { Options as LoggerOptions } from './logger.js';
11
- import type { Options as SessOptions } from './session.js';
12
- import type { Options as WebworkerOptions } from '../common/interaction.js';
1
+ import type Message from "../common/messages.js";
2
+ import Nodes from "./nodes.js";
3
+ import Sanitizer from "./sanitizer.js";
4
+ import Ticker from "./ticker.js";
5
+ import Logger from "./logger.js";
6
+ import Session from "./session.js";
7
+ import type { Options as ObserverOptions } from "./observer/top_observer.js";
8
+ import type { Options as SanitizerOptions } from "./sanitizer.js";
9
+ import type { Options as LoggerOptions } from "./logger.js";
10
+ import type { Options as WebworkerOptions } from "../common/webworker.js";
13
11
  export interface StartOptions {
14
12
  userID?: string;
15
13
  metadata?: Record<string, string>;
16
14
  forceNew?: boolean;
17
- sessionHash?: string;
18
15
  }
19
16
  interface OnStartInfo {
20
17
  sessionID: string;
@@ -37,9 +34,9 @@ declare type CommitCallback = (messages: Array<Message>) => void;
37
34
  declare type AppOptions = {
38
35
  revID: string;
39
36
  node_id: string;
40
- session_reset_key: string;
41
37
  session_token_key: string;
42
38
  session_pageno_key: string;
39
+ session_reset_key: string;
43
40
  local_uuid_key: string;
44
41
  ingestPoint: string;
45
42
  resourceBaseHref: string | null;
@@ -47,10 +44,10 @@ declare type AppOptions = {
47
44
  __is_snippet: boolean;
48
45
  __debug_report_edp: string | null;
49
46
  __debug__?: LoggerOptions;
50
- localStorage: Storage | null;
51
- sessionStorage: Storage | null;
47
+ localStorage: Storage;
48
+ sessionStorage: Storage;
52
49
  onStart?: StartCallback;
53
- } & WebworkerOptions & SessOptions;
50
+ } & WebworkerOptions;
54
51
  export declare type Options = AppOptions & ObserverOptions & SanitizerOptions;
55
52
  export declare const DEFAULT_INGEST_POINT = "https://api.openreplay.com/ingest";
56
53
  export default class App {
@@ -64,41 +61,39 @@ export default class App {
64
61
  readonly localStorage: Storage;
65
62
  readonly sessionStorage: Storage;
66
63
  private readonly messages;
67
- readonly observer: Observer;
64
+ private readonly observer;
68
65
  private readonly startCallbacks;
69
66
  private readonly stopCallbacks;
70
67
  private readonly commitCallbacks;
71
68
  private readonly options;
72
69
  private readonly revID;
73
70
  private activityState;
74
- private readonly version;
71
+ private version;
75
72
  private readonly worker?;
76
- constructor(projectKey: string, sessionToken: string | undefined, options: Partial<Options>);
73
+ constructor(projectKey: string, sessionToken: string | null | undefined, options: Partial<Options>);
77
74
  private _debug;
78
75
  send(message: Message, urgent?: boolean): void;
79
76
  private commit;
80
77
  safe<T extends (...args: any[]) => void>(fn: T): T;
81
78
  attachCommitCallback(cb: CommitCallback): void;
82
- attachStartCallback(cb: StartCallback, useSafe?: boolean): void;
83
- attachStopCallback(cb: () => any, useSafe?: boolean): void;
79
+ attachStartCallback(cb: StartCallback): void;
80
+ attachStopCallback(cb: Function): void;
84
81
  attachEventListener(target: EventTarget, type: string, listener: EventListener, useSafe?: boolean, useCapture?: boolean): void;
85
82
  checkRequiredVersion(version: string): boolean;
86
- private getTrackerInfo;
83
+ private getStartInfo;
87
84
  getSessionInfo(): {
88
85
  userUUID: string | null;
89
86
  projectKey: string;
90
87
  revID: string;
88
+ timestamp: number;
91
89
  trackerVersion: string;
92
90
  isSnippet: boolean;
93
- sessionID: string | undefined;
91
+ sessionID: string | null;
94
92
  metadata: Record<string, string>;
95
93
  userID: string | null;
96
- timestamp: number;
97
- projectID?: string | undefined;
98
94
  };
99
95
  getSessionToken(): string | undefined;
100
96
  getSessionID(): string | undefined;
101
- getSessionURL(): string | undefined;
102
97
  getHost(): string;
103
98
  getProjectKey(): string;
104
99
  getBaseHref(): string;
@@ -108,7 +103,7 @@ export default class App {
108
103
  resetNextPageSession(flag: boolean): void;
109
104
  private _start;
110
105
  start(options?: StartOptions): Promise<StartPromiseReturn>;
111
- stop(stopWorker?: boolean): void;
106
+ stop(calledFromAPI?: boolean, restarting?: boolean): void;
112
107
  restart(): void;
113
108
  }
114
109
  export {};