@openreplay/tracker 3.4.6 → 3.4.10

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 (94) hide show
  1. package/cjs/app/index.d.ts +7 -7
  2. package/cjs/app/index.js +22 -21
  3. package/cjs/app/logger.d.ts +0 -0
  4. package/cjs/app/logger.js +1 -0
  5. package/cjs/app/observer/iframe_observer.d.ts +1 -1
  6. package/cjs/app/observer/iframe_observer.js +8 -7
  7. package/cjs/app/observer/observer.d.ts +5 -2
  8. package/cjs/app/observer/observer.js +70 -49
  9. package/cjs/app/observer/shadow_root_observer.d.ts +1 -1
  10. package/cjs/app/observer/shadow_root_observer.js +4 -4
  11. package/cjs/app/observer/top_observer.d.ts +3 -3
  12. package/cjs/app/observer/top_observer.js +28 -24
  13. package/cjs/app/observer.d.ts +1 -1
  14. package/cjs/app/observer.js +26 -22
  15. package/cjs/app/sanitizer.d.ts +0 -0
  16. package/cjs/app/sanitizer.js +1 -0
  17. package/cjs/app/ticker.d.ts +1 -1
  18. package/cjs/index.d.ts +11 -10
  19. package/cjs/index.js +59 -56
  20. package/cjs/messages/index.d.ts +2 -2
  21. package/cjs/messages/message.d.ts +1 -1
  22. package/cjs/modules/connection.d.ts +1 -1
  23. package/cjs/modules/connection.js +2 -2
  24. package/cjs/modules/console.d.ts +1 -1
  25. package/cjs/modules/console.js +6 -6
  26. package/cjs/modules/cssrules.d.ts +1 -1
  27. package/cjs/modules/cssrules.js +4 -4
  28. package/cjs/modules/exception.d.ts +2 -2
  29. package/cjs/modules/exception.js +4 -4
  30. package/cjs/modules/img.d.ts +1 -1
  31. package/cjs/modules/img.js +6 -6
  32. package/cjs/modules/input.d.ts +1 -1
  33. package/cjs/modules/input.js +11 -11
  34. package/cjs/modules/longtasks.d.ts +1 -1
  35. package/cjs/modules/longtasks.js +2 -2
  36. package/cjs/modules/mouse.d.ts +1 -1
  37. package/cjs/modules/mouse.js +10 -10
  38. package/cjs/modules/performance.d.ts +1 -1
  39. package/cjs/modules/performance.js +5 -5
  40. package/cjs/modules/scroll.d.ts +1 -1
  41. package/cjs/modules/scroll.js +3 -3
  42. package/cjs/modules/timing.d.ts +1 -1
  43. package/cjs/modules/timing.js +6 -6
  44. package/cjs/modules/viewport.d.ts +1 -1
  45. package/cjs/modules/viewport.js +4 -4
  46. package/cjs/utils.js +1 -1
  47. package/lib/app/index.d.ts +7 -7
  48. package/lib/app/index.js +10 -9
  49. package/lib/app/logger.d.ts +0 -0
  50. package/lib/app/logger.js +1 -0
  51. package/lib/app/observer/iframe_observer.d.ts +1 -1
  52. package/lib/app/observer/iframe_observer.js +7 -6
  53. package/lib/app/observer/observer.d.ts +5 -2
  54. package/lib/app/observer/observer.js +58 -37
  55. package/lib/app/observer/shadow_root_observer.d.ts +1 -1
  56. package/lib/app/observer/shadow_root_observer.js +2 -2
  57. package/lib/app/observer/top_observer.d.ts +3 -3
  58. package/lib/app/observer/top_observer.js +22 -18
  59. package/lib/app/observer.d.ts +1 -1
  60. package/lib/app/observer.js +9 -5
  61. package/lib/app/sanitizer.d.ts +0 -0
  62. package/lib/app/sanitizer.js +1 -0
  63. package/lib/app/ticker.d.ts +1 -1
  64. package/lib/index.d.ts +11 -10
  65. package/lib/index.js +25 -22
  66. package/lib/messages/index.d.ts +2 -2
  67. package/lib/messages/message.d.ts +1 -1
  68. package/lib/messages/tsconfig.tsbuildinfo +1 -1
  69. package/lib/modules/connection.d.ts +1 -1
  70. package/lib/modules/connection.js +1 -1
  71. package/lib/modules/console.d.ts +1 -1
  72. package/lib/modules/console.js +4 -4
  73. package/lib/modules/cssrules.d.ts +1 -1
  74. package/lib/modules/cssrules.js +1 -1
  75. package/lib/modules/exception.d.ts +2 -2
  76. package/lib/modules/exception.js +1 -1
  77. package/lib/modules/img.d.ts +1 -1
  78. package/lib/modules/img.js +2 -2
  79. package/lib/modules/input.d.ts +1 -1
  80. package/lib/modules/input.js +2 -2
  81. package/lib/modules/longtasks.d.ts +1 -1
  82. package/lib/modules/longtasks.js +1 -1
  83. package/lib/modules/mouse.d.ts +1 -1
  84. package/lib/modules/mouse.js +3 -3
  85. package/lib/modules/performance.d.ts +1 -1
  86. package/lib/modules/performance.js +2 -2
  87. package/lib/modules/scroll.d.ts +1 -1
  88. package/lib/modules/scroll.js +1 -1
  89. package/lib/modules/timing.d.ts +1 -1
  90. package/lib/modules/timing.js +3 -3
  91. package/lib/modules/viewport.d.ts +1 -1
  92. package/lib/modules/viewport.js +1 -1
  93. package/package.json +2 -2
  94. package/tsconfig-base.json +1 -1
@@ -1,4 +1,4 @@
1
- import App from './index';
1
+ import App from "./index.js";
2
2
  interface Window extends WindowProxy {
3
3
  HTMLInputElement: typeof HTMLInputElement;
4
4
  HTMLLinkElement: typeof HTMLLinkElement;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("../utils");
4
- const messages_1 = require("../messages");
3
+ const utils_js_1 = require("../utils.js");
4
+ const index_js_1 = require("../messages/index.js");
5
5
  function isSVGElement(node) {
6
6
  return node.namespaceURI === 'http://www.w3.org/2000/svg';
7
7
  }
@@ -33,7 +33,7 @@ class Observer {
33
33
  if (frameID === undefined || docID === undefined) {
34
34
  continue;
35
35
  }
36
- this.app.send(messages_1.CreateIFrameDocument(frameID, docID));
36
+ this.app.send((0, index_js_1.CreateIFrameDocument)(frameID, docID));
37
37
  continue;
38
38
  }
39
39
  if (this.isIgnored(target) || !context.document.contains(target)) {
@@ -128,16 +128,16 @@ class Observer {
128
128
  name = name.substr(6);
129
129
  }
130
130
  if (value === null) {
131
- this.app.send(new messages_1.RemoveNodeAttribute(id, name));
131
+ this.app.send(new index_js_1.RemoveNodeAttribute(id, name));
132
132
  }
133
133
  else if (name === 'href') {
134
134
  if (value.length > 1e5) {
135
135
  value = '';
136
136
  }
137
- this.app.send(new messages_1.SetNodeAttributeURLBased(id, name, value, this.app.getBaseHref()));
137
+ this.app.send(new index_js_1.SetNodeAttributeURLBased(id, name, value, this.app.getBaseHref()));
138
138
  }
139
139
  else {
140
- this.app.send(new messages_1.SetNodeAttribute(id, name, value));
140
+ this.app.send(new index_js_1.SetNodeAttribute(id, name, value));
141
141
  }
142
142
  return;
143
143
  }
@@ -157,18 +157,19 @@ class Observer {
157
157
  return;
158
158
  }
159
159
  if (value === null) {
160
- this.app.send(new messages_1.RemoveNodeAttribute(id, name));
160
+ this.app.send(new index_js_1.RemoveNodeAttribute(id, name));
161
161
  return;
162
162
  }
163
163
  if (name === 'style' || name === 'href' && this.isInstance(node, HTMLLinkElement)) {
164
- this.app.send(new messages_1.SetNodeAttributeURLBased(id, name, value, this.app.getBaseHref()));
164
+ this.app.send(new index_js_1.SetNodeAttributeURLBased(id, name, value, this.app.getBaseHref()));
165
165
  return;
166
166
  }
167
167
  if (name === 'href' || value.length > 1e5) {
168
168
  value = '';
169
169
  }
170
- this.app.send(new messages_1.SetNodeAttribute(id, name, value));
170
+ this.app.send(new index_js_1.SetNodeAttribute(id, name, value));
171
171
  }
172
+ /* TODO: abstract sanitation */
172
173
  getInnerTextSecure(el) {
173
174
  const id = this.app.nodes.getID(el);
174
175
  if (!id) {
@@ -184,18 +185,19 @@ class Observer {
184
185
  data = data.replace(/\d/g, '0');
185
186
  }
186
187
  if (this.options.obscureTextEmails) {
187
- data = data.replace(/([^\s]+)@([^\s]+)\.([^\s]+)/g, (...f) => utils_1.stars(f[1]) + '@' + utils_1.stars(f[2]) + '.' + utils_1.stars(f[3]));
188
+ data = data.replace(/([^\s]+)@([^\s]+)\.([^\s]+)/g, (...f) => (0, utils_js_1.stars)(f[1]) + '@' + (0, utils_js_1.stars)(f[2]) + '.' + (0, utils_js_1.stars)(f[3]));
188
189
  }
189
190
  return data;
190
191
  }
191
192
  sendNodeData(id, parentElement, data) {
192
193
  if (this.isInstance(parentElement, HTMLStyleElement) || this.isInstance(parentElement, SVGStyleElement)) {
193
- this.app.send(new messages_1.SetCSSDataURLBased(id, data, this.app.getBaseHref()));
194
+ this.app.send(new index_js_1.SetCSSDataURLBased(id, data, this.app.getBaseHref()));
194
195
  return;
195
196
  }
196
197
  data = this.checkObscure(id, data);
197
- this.app.send(new messages_1.SetNodeData(id, data));
198
+ this.app.send(new index_js_1.SetNodeData(id, data));
198
199
  }
200
+ /* end TODO: abstract sanitation */
199
201
  bindNode(node) {
200
202
  const r = this.app.nodes.registerNode(node);
201
203
  const id = r[0];
@@ -210,7 +212,9 @@ class Observer {
210
212
  acceptNode: (node) => this.isIgnored(node) || this.app.nodes.getID(node) !== undefined
211
213
  ? NodeFilter.FILTER_REJECT
212
214
  : NodeFilter.FILTER_ACCEPT,
213
- }, false);
215
+ },
216
+ // @ts-ignore
217
+ false);
214
218
  while (walker.nextNode()) {
215
219
  this.bindNode(walker.currentNode);
216
220
  }
@@ -218,7 +222,7 @@ class Observer {
218
222
  unbindNode(node) {
219
223
  const id = this.app.nodes.unregisterNode(node);
220
224
  if (id !== undefined && this.recents[id] === false) {
221
- this.app.send(new messages_1.RemoveNode(id));
225
+ this.app.send(new index_js_1.RemoveNode(id));
222
226
  }
223
227
  }
224
228
  _commitNode(id, node) {
@@ -242,7 +246,7 @@ class Observer {
242
246
  return false;
243
247
  }
244
248
  if (this.textMasked.has(parentID) ||
245
- (this.isInstance(node, Element) && utils_1.hasOpenreplayAttribute(node, 'masked'))) {
249
+ (this.isInstance(node, Element) && (0, utils_js_1.hasOpenreplayAttribute)(node, 'masked'))) {
246
250
  this.textMasked.add(id);
247
251
  }
248
252
  let sibling = node.previousSibling;
@@ -267,7 +271,7 @@ class Observer {
267
271
  if (isNew === true) {
268
272
  if (this.isInstance(node, Element)) {
269
273
  if (parentID !== undefined) {
270
- this.app.send(new messages_1.CreateElementNode(id, parentID, index, node.tagName, isSVGElement(node)));
274
+ this.app.send(new index_js_1.CreateElementNode(id, parentID, index, node.tagName, isSVGElement(node)));
271
275
  }
272
276
  for (let i = 0; i < node.attributes.length; i++) {
273
277
  const attr = node.attributes[i];
@@ -280,13 +284,13 @@ class Observer {
280
284
  }
281
285
  else if (this.isInstance(node, Text)) {
282
286
  // for text node id != 0, hence parentID !== undefined and parent is Element
283
- this.app.send(new messages_1.CreateTextNode(id, parentID, index));
287
+ this.app.send(new index_js_1.CreateTextNode(id, parentID, index));
284
288
  this.sendNodeData(id, parent, node.data);
285
289
  }
286
290
  return true;
287
291
  }
288
292
  if (isNew === false && parentID !== undefined) {
289
- this.app.send(new messages_1.MoveNode(id, parentID, index));
293
+ this.app.send(new index_js_1.MoveNode(id, parentID, index));
290
294
  }
291
295
  const attr = this.attributesList[id];
292
296
  if (attr !== undefined) {
@@ -329,7 +333,7 @@ class Observer {
329
333
  }
330
334
  handleIframe(iframe) {
331
335
  let context = null;
332
- const handle = () => {
336
+ const handle = this.app.safe(() => {
333
337
  const id = this.app.nodes.getID(iframe);
334
338
  if (id === undefined) {
335
339
  return;
@@ -344,7 +348,7 @@ class Observer {
344
348
  const observer = new Observer(this.app, this.options, context);
345
349
  this.iframeObservers.push(observer);
346
350
  observer.observeIframe(id, context);
347
- };
351
+ });
348
352
  this.app.attachEventListener(iframe, "load", handle);
349
353
  handle();
350
354
  }
@@ -365,7 +369,7 @@ class Observer {
365
369
  console.log("Wrong");
366
370
  return;
367
371
  }
368
- this.app.send(messages_1.CreateIFrameDocument(id, docID));
372
+ this.app.send((0, index_js_1.CreateIFrameDocument)(id, docID));
369
373
  this.commitNodes();
370
374
  }
371
375
  observe() {
@@ -377,7 +381,7 @@ class Observer {
377
381
  attributeOldValue: false,
378
382
  characterDataOldValue: false,
379
383
  });
380
- this.app.send(new messages_1.CreateDocument());
384
+ this.app.send(new index_js_1.CreateDocument());
381
385
  this.bindTree(this.context.document.documentElement);
382
386
  this.commitNodes();
383
387
  }
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1,4 +1,4 @@
1
- import App from './index';
1
+ import App from "./index.js";
2
2
  declare type Callback = () => void;
3
3
  export default class Ticker {
4
4
  private readonly app;
package/cjs/index.d.ts CHANGED
@@ -1,13 +1,14 @@
1
- import App from './app';
2
- export { default as App } from './app';
3
- import * as _Messages from './messages';
1
+ import App from "./app/index.js";
2
+ export { default as App } from './app/index.js';
3
+ import * as _Messages from "./messages/index.js";
4
4
  export declare const Messages: typeof _Messages;
5
- import { Options as AppOptions } from './app';
6
- import { Options as ConsoleOptions } from './modules/console';
7
- import { Options as ExceptionOptions } from './modules/exception';
8
- import { Options as InputOptions } from './modules/input';
9
- import { Options as PerformanceOptions } from './modules/performance';
10
- import { Options as TimingOptions } from './modules/timing';
5
+ import { Options as AppOptions } from "./app/index.js";
6
+ import { Options as ConsoleOptions } from "./modules/console.js";
7
+ import { Options as ExceptionOptions } from "./modules/exception.js";
8
+ import { Options as InputOptions } from "./modules/input.js";
9
+ import { Options as PerformanceOptions } from "./modules/performance.js";
10
+ import { Options as TimingOptions } from "./modules/timing.js";
11
+ export type { OnStartInfo } from './app/index.js';
11
12
  export declare type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & InputOptions & PerformanceOptions & TimingOptions> & {
12
13
  projectID?: number;
13
14
  projectKey: string;
@@ -22,7 +23,7 @@ export default class API {
22
23
  use<T>(fn: (app: App | null, options?: Options) => T): T;
23
24
  isActive(): boolean;
24
25
  active(): boolean;
25
- start(): void;
26
+ start(): Promise<import("./app/index.js").OnStartInfo>;
26
27
  stop(): void;
27
28
  getSessionToken(): string | null | undefined;
28
29
  getSessionID(): string | null | undefined;
package/cjs/index.js CHANGED
@@ -1,40 +1,40 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Messages = exports.App = void 0;
4
- const app_1 = require("./app");
5
- var app_2 = require("./app");
6
- Object.defineProperty(exports, "App", { enumerable: true, get: function () { return app_2.default; } });
7
- const messages_1 = require("./messages");
8
- const _Messages = require("./messages");
4
+ const index_js_1 = require("./app/index.js");
5
+ var index_js_2 = require("./app/index.js");
6
+ Object.defineProperty(exports, "App", { enumerable: true, get: function () { return index_js_2.default; } });
7
+ const index_js_3 = require("./messages/index.js");
8
+ const _Messages = require("./messages/index.js");
9
9
  exports.Messages = _Messages;
10
- const connection_1 = require("./modules/connection");
11
- const console_1 = require("./modules/console");
12
- const exception_1 = require("./modules/exception");
13
- const img_1 = require("./modules/img");
14
- const input_1 = require("./modules/input");
15
- const mouse_1 = require("./modules/mouse");
16
- const timing_1 = require("./modules/timing");
17
- const performance_1 = require("./modules/performance");
18
- const scroll_1 = require("./modules/scroll");
19
- const viewport_1 = require("./modules/viewport");
20
- const longtasks_1 = require("./modules/longtasks");
21
- const cssrules_1 = require("./modules/cssrules");
22
- const utils_1 = require("./utils");
10
+ const connection_js_1 = require("./modules/connection.js");
11
+ const console_js_1 = require("./modules/console.js");
12
+ const exception_js_1 = require("./modules/exception.js");
13
+ const img_js_1 = require("./modules/img.js");
14
+ const input_js_1 = require("./modules/input.js");
15
+ const mouse_js_1 = require("./modules/mouse.js");
16
+ const timing_js_1 = require("./modules/timing.js");
17
+ const performance_js_1 = require("./modules/performance.js");
18
+ const scroll_js_1 = require("./modules/scroll.js");
19
+ const viewport_js_1 = require("./modules/viewport.js");
20
+ const longtasks_js_1 = require("./modules/longtasks.js");
21
+ const cssrules_js_1 = require("./modules/cssrules.js");
22
+ const utils_js_1 = require("./utils.js");
23
23
  const DOCS_SETUP = '/installation/setup-or';
24
24
  function processOptions(obj) {
25
25
  if (obj == null) {
26
- console.error(`OpenReplay: invalid options argument type. Please, check documentation on ${utils_1.DOCS_HOST}${DOCS_SETUP}`);
26
+ console.error(`OpenReplay: invalid options argument type. Please, check documentation on ${utils_js_1.DOCS_HOST}${DOCS_SETUP}`);
27
27
  return false;
28
28
  }
29
29
  if (typeof obj.projectKey !== 'string') {
30
30
  if (typeof obj.projectKey !== 'number') {
31
31
  if (typeof obj.projectID !== 'number') { // Back compatability
32
- console.error(`OpenReplay: projectKey is missing or wrong type (string is expected). Please, check ${utils_1.DOCS_HOST}${DOCS_SETUP} for more information.`);
32
+ console.error(`OpenReplay: projectKey is missing or wrong type (string is expected). Please, check ${utils_js_1.DOCS_HOST}${DOCS_SETUP} for more information.`);
33
33
  return false;
34
34
  }
35
35
  else {
36
36
  obj.projectKey = obj.projectID.toString();
37
- utils_1.deprecationWarn("`projectID` option", "`projectKey` option", DOCS_SETUP);
37
+ (0, utils_js_1.deprecationWarn)("`projectID` option", "`projectKey` option", DOCS_SETUP);
38
38
  }
39
39
  }
40
40
  else {
@@ -43,7 +43,7 @@ function processOptions(obj) {
43
43
  }
44
44
  }
45
45
  if (typeof obj.sessionToken !== 'string' && obj.sessionToken != null) {
46
- console.warn(`OpenReplay: invalid options argument type. Please, check documentation on ${utils_1.DOCS_HOST}${DOCS_SETUP}`);
46
+ console.warn(`OpenReplay: invalid options argument type. Please, check documentation on ${utils_js_1.DOCS_HOST}${DOCS_SETUP}`);
47
47
  }
48
48
  return true;
49
49
  }
@@ -56,17 +56,17 @@ class API {
56
56
  return;
57
57
  }
58
58
  if (e instanceof Error) {
59
- this.app.send(exception_1.getExceptionMessage(e, []));
59
+ this.app.send((0, exception_js_1.getExceptionMessage)(e, []));
60
60
  }
61
61
  else if (e instanceof ErrorEvent ||
62
62
  ('PromiseRejectionEvent' in window && e instanceof PromiseRejectionEvent)) {
63
- const msg = exception_1.getExceptionMessageFromEvent(e);
63
+ const msg = (0, exception_js_1.getExceptionMessageFromEvent)(e);
64
64
  if (msg != null) {
65
65
  this.app.send(msg);
66
66
  }
67
67
  }
68
68
  };
69
- if (!utils_1.IN_BROWSER || !processOptions(options)) {
69
+ if (!utils_js_1.IN_BROWSER || !processOptions(options)) {
70
70
  return;
71
71
  }
72
72
  if (window.__OPENREPLAY__) {
@@ -77,7 +77,10 @@ class API {
77
77
  console.error("OpenReplay: Your website must be publicly accessible and running on SSL in order for OpenReplay to properly capture and replay the user session. You can disable this check by setting `__DISABLE_SECURE_MODE` option to `true` if you are testing in localhost. Keep in mind, that asset files on a local machine are not available to the outside world. This might affect tracking if you use css files.");
78
78
  return;
79
79
  }
80
- const doNotTrack = options.respectDoNotTrack && (navigator.doNotTrack == '1' || window.doNotTrack == '1');
80
+ const doNotTrack = options.respectDoNotTrack &&
81
+ (navigator.doNotTrack == '1'
82
+ // @ts-ignore
83
+ || window.doNotTrack == '1');
81
84
  this.app = doNotTrack ||
82
85
  !('Map' in window) ||
83
86
  !('Set' in window) ||
@@ -88,31 +91,31 @@ class API {
88
91
  !('Blob' in window) ||
89
92
  !('Worker' in window)
90
93
  ? null
91
- : new app_1.default(options.projectKey, options.sessionToken, options);
94
+ : new index_js_1.default(options.projectKey, options.sessionToken, options);
92
95
  if (this.app !== null) {
93
- viewport_1.default(this.app);
94
- cssrules_1.default(this.app);
95
- connection_1.default(this.app);
96
- console_1.default(this.app, options);
97
- exception_1.default(this.app, options);
98
- img_1.default(this.app);
99
- input_1.default(this.app, options);
100
- mouse_1.default(this.app);
101
- timing_1.default(this.app, options);
102
- performance_1.default(this.app, options);
103
- scroll_1.default(this.app);
104
- longtasks_1.default(this.app);
96
+ (0, viewport_js_1.default)(this.app);
97
+ (0, cssrules_js_1.default)(this.app);
98
+ (0, connection_js_1.default)(this.app);
99
+ (0, console_js_1.default)(this.app, options);
100
+ (0, exception_js_1.default)(this.app, options);
101
+ (0, img_js_1.default)(this.app);
102
+ (0, input_js_1.default)(this.app, options);
103
+ (0, mouse_js_1.default)(this.app);
104
+ (0, timing_js_1.default)(this.app, options);
105
+ (0, performance_js_1.default)(this.app, options);
106
+ (0, scroll_js_1.default)(this.app);
107
+ (0, longtasks_js_1.default)(this.app);
105
108
  window.__OPENREPLAY__ = this;
106
109
  }
107
110
  else {
108
111
  console.log("OpenReplay: browser doesn't support API required for tracking or doNotTrack is set to 1.");
109
112
  const req = new XMLHttpRequest();
110
- const orig = options.ingestPoint || app_1.DEFAULT_INGEST_POINT;
113
+ const orig = options.ingestPoint || index_js_1.DEFAULT_INGEST_POINT;
111
114
  req.open("POST", orig + "/v1/web/not-started");
112
115
  // no-cors issue only with text/plain or not-set Content-Type
113
116
  // req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
114
117
  req.send(JSON.stringify({
115
- trackerVersion: '3.4.6',
118
+ trackerVersion: '3.4.10',
116
119
  projectKey: options.projectKey,
117
120
  doNotTrack,
118
121
  // TODO: add precise reason (an exact API missing)
@@ -129,18 +132,18 @@ class API {
129
132
  return this.app.active();
130
133
  }
131
134
  active() {
132
- utils_1.deprecationWarn("'active' method", "'isActive' method", "/");
135
+ (0, utils_js_1.deprecationWarn)("'active' method", "'isActive' method", "/");
133
136
  return this.isActive();
134
137
  }
135
138
  start() {
136
- if (!utils_1.IN_BROWSER) {
137
- console.error(`OpenReplay: you are trying to start Tracker on a node.js environment. If you want to use OpenReplay with SSR, please, use componentDidMount or useEffect API for placing the \`tracker.start()\` line. Check documentation on ${utils_1.DOCS_HOST}${DOCS_SETUP}`);
138
- return;
139
+ if (!utils_js_1.IN_BROWSER) {
140
+ console.error(`OpenReplay: you are trying to start Tracker on a node.js environment. If you want to use OpenReplay with SSR, please, use componentDidMount or useEffect API for placing the \`tracker.start()\` line. Check documentation on ${utils_js_1.DOCS_HOST}${DOCS_SETUP}`);
141
+ return Promise.reject("Trying to start not in browser.");
139
142
  }
140
143
  if (this.app === null) {
141
- return;
144
+ return Promise.reject("Browser doesn't support required api, or doNotTrack is active.");
142
145
  }
143
- this.app.start();
146
+ return this.app.start();
144
147
  }
145
148
  stop() {
146
149
  if (this.app === null) {
@@ -161,36 +164,36 @@ class API {
161
164
  return this.app.getSessionID();
162
165
  }
163
166
  sessionID() {
164
- utils_1.deprecationWarn("'sessionID' method", "'getSessionID' method", "/");
167
+ (0, utils_js_1.deprecationWarn)("'sessionID' method", "'getSessionID' method", "/");
165
168
  return this.getSessionID();
166
169
  }
167
170
  setUserID(id) {
168
171
  if (typeof id === 'string' && this.app !== null) {
169
- this.app.send(new messages_1.UserID(id));
172
+ this.app.send(new index_js_3.UserID(id));
170
173
  }
171
174
  }
172
175
  userID(id) {
173
- utils_1.deprecationWarn("'userID' method", "'setUserID' method", "/");
176
+ (0, utils_js_1.deprecationWarn)("'userID' method", "'setUserID' method", "/");
174
177
  this.setUserID(id);
175
178
  }
176
179
  setUserAnonymousID(id) {
177
180
  if (typeof id === 'string' && this.app !== null) {
178
- this.app.send(new messages_1.UserAnonymousID(id));
181
+ this.app.send(new index_js_3.UserAnonymousID(id));
179
182
  }
180
183
  }
181
184
  userAnonymousID(id) {
182
- utils_1.deprecationWarn("'userAnonymousID' method", "'setUserAnonymousID' method", "/");
185
+ (0, utils_js_1.deprecationWarn)("'userAnonymousID' method", "'setUserAnonymousID' method", "/");
183
186
  this.setUserAnonymousID(id);
184
187
  }
185
188
  setMetadata(key, value) {
186
189
  if (typeof key === 'string' &&
187
190
  typeof value === 'string' &&
188
191
  this.app !== null) {
189
- this.app.send(new messages_1.Metadata(key, value));
192
+ this.app.send(new index_js_3.Metadata(key, value));
190
193
  }
191
194
  }
192
195
  metadata(key, value) {
193
- utils_1.deprecationWarn("'metadata' method", "'setMetadata' method", "/");
196
+ (0, utils_js_1.deprecationWarn)("'metadata' method", "'setMetadata' method", "/");
194
197
  this.setMetadata(key, value);
195
198
  }
196
199
  event(key, payload, issue = false) {
@@ -205,7 +208,7 @@ class API {
205
208
  catch (e) {
206
209
  return;
207
210
  }
208
- this.app.send(new messages_1.RawCustomEvent(key, payload));
211
+ this.app.send(new index_js_3.RawCustomEvent(key, payload));
209
212
  }
210
213
  }
211
214
  }
@@ -217,7 +220,7 @@ class API {
217
220
  catch (e) {
218
221
  return;
219
222
  }
220
- this.app.send(new messages_1.CustomIssue(key, payload));
223
+ this.app.send(new index_js_3.CustomIssue(key, payload));
221
224
  }
222
225
  }
223
226
  }
@@ -1,5 +1,5 @@
1
- import Message from './message';
2
- import Writer from './writer';
1
+ import Message from "./message.js";
2
+ import Writer from "./writer.js";
3
3
  export declare const classes: Map<number, Function>;
4
4
  declare class _BatchMeta implements Message {
5
5
  pageNo: number;
@@ -1,4 +1,4 @@
1
- import Writer from './writer';
1
+ import Writer from "./writer.js";
2
2
  export default interface Message {
3
3
  encode(w: Writer): boolean;
4
4
  }
@@ -1,2 +1,2 @@
1
- import App from '../app';
1
+ import App from "../app/index.js";
2
2
  export default function (app: App): void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const messages_1 = require("../messages");
3
+ const index_js_1 = require("../messages/index.js");
4
4
  function default_1(app) {
5
5
  const connection = navigator.connection ||
6
6
  navigator.mozConnection ||
@@ -8,7 +8,7 @@ function default_1(app) {
8
8
  if (connection === undefined) {
9
9
  return;
10
10
  }
11
- const sendConnectionInformation = () => app.send(new messages_1.ConnectionInformation(Math.round(connection.downlink * 1000), connection.type || 'unknown'));
11
+ const sendConnectionInformation = () => app.send(new index_js_1.ConnectionInformation(Math.round(connection.downlink * 1000), connection.type || 'unknown'));
12
12
  sendConnectionInformation();
13
13
  connection.addEventListener('change', sendConnectionInformation);
14
14
  }
@@ -1,4 +1,4 @@
1
- import App from '../app';
1
+ import App from "../app/index.js";
2
2
  export interface Options {
3
3
  consoleMethods: Array<string> | null;
4
4
  consoleThrottling: number;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("../utils");
4
- const messages_1 = require("../messages");
5
- const printError = utils_1.IN_BROWSER && 'InstallTrigger' in window // detect Firefox
3
+ const utils_js_1 = require("../utils.js");
4
+ const index_js_1 = require("../messages/index.js");
5
+ const printError = utils_js_1.IN_BROWSER && 'InstallTrigger' in window // detect Firefox
6
6
  ? (e) => e.message + '\n' + e.stack
7
7
  : (e) => e.stack || e.message;
8
8
  function printString(arg) {
@@ -92,7 +92,7 @@ function default_1(app, opts) {
92
92
  options.consoleMethods.length === 0) {
93
93
  return;
94
94
  }
95
- const sendConsoleLog = app.safe((level, args) => app.send(new messages_1.ConsoleLog(level, printf(args))));
95
+ const sendConsoleLog = app.safe((level, args) => app.send(new index_js_1.ConsoleLog(level, printf(args))));
96
96
  let n;
97
97
  const reset = () => {
98
98
  n = 0;
@@ -114,7 +114,7 @@ function default_1(app, opts) {
114
114
  };
115
115
  });
116
116
  patchConsole(window.console);
117
- app.nodes.attachNodeCallback(node => {
117
+ app.nodes.attachNodeCallback(app.safe(node => {
118
118
  if (node instanceof HTMLIFrameElement) {
119
119
  let context = node.contentWindow;
120
120
  if (context) {
@@ -127,6 +127,6 @@ function default_1(app, opts) {
127
127
  }
128
128
  });
129
129
  }
130
- });
130
+ }));
131
131
  }
132
132
  exports.default = default_1;
@@ -1,2 +1,2 @@
1
- import App from '../app';
1
+ import App from "../app/index.js";
2
2
  export default function (app: App | null): void;
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const messages_1 = require("../messages");
3
+ const index_js_1 = require("../messages/index.js");
4
4
  function default_1(app) {
5
5
  if (app === null) {
6
6
  return;
7
7
  }
8
8
  if (!window.CSSStyleSheet) {
9
- app.send(new messages_1.TechnicalInfo("no_stylesheet_prototype_in_window", ""));
9
+ app.send(new index_js_1.TechnicalInfo("no_stylesheet_prototype_in_window", ""));
10
10
  return;
11
11
  }
12
12
  const processOperation = app.safe((stylesheet, index, rule) => {
13
13
  const sendMessage = typeof rule === 'string'
14
- ? (nodeID) => app.send(new messages_1.CSSInsertRuleURLBased(nodeID, rule, index, app.getBaseHref()))
15
- : (nodeID) => app.send(new messages_1.CSSDeleteRule(nodeID, index));
14
+ ? (nodeID) => app.send(new index_js_1.CSSInsertRuleURLBased(nodeID, rule, index, app.getBaseHref()))
15
+ : (nodeID) => app.send(new index_js_1.CSSDeleteRule(nodeID, index));
16
16
  // TODO: Extend messages to maintain nested rules (CSSGroupingRule prototype, as well as CSSKeyframesRule)
17
17
  if (stylesheet.ownerNode == null) {
18
18
  throw new Error("Owner Node not found");
@@ -1,5 +1,5 @@
1
- import App from '../app';
2
- import Message from '../messages/message';
1
+ import App from "../app/index.js";
2
+ import Message from "../messages/message.js";
3
3
  export interface Options {
4
4
  captureExceptions: boolean;
5
5
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getExceptionMessageFromEvent = exports.getExceptionMessage = void 0;
4
- const messages_1 = require("../messages");
4
+ const index_js_1 = require("../messages/index.js");
5
5
  const error_stack_parser_1 = require("error-stack-parser");
6
6
  function getDefaultStack(e) {
7
7
  return [{
@@ -19,7 +19,7 @@ function getExceptionMessage(error, fallbackStack) {
19
19
  }
20
20
  catch (e) {
21
21
  }
22
- return new messages_1.JSException(error.name, error.message, JSON.stringify(stack));
22
+ return new index_js_1.JSException(error.name, error.message, JSON.stringify(stack));
23
23
  }
24
24
  exports.getExceptionMessage = getExceptionMessage;
25
25
  function getExceptionMessageFromEvent(e) {
@@ -33,7 +33,7 @@ function getExceptionMessageFromEvent(e) {
33
33
  name = 'Error';
34
34
  message = e.message;
35
35
  }
36
- return new messages_1.JSException(name, message, JSON.stringify(getDefaultStack(e)));
36
+ return new index_js_1.JSException(name, message, JSON.stringify(getDefaultStack(e)));
37
37
  }
38
38
  }
39
39
  else if ('PromiseRejectionEvent' in window && e instanceof PromiseRejectionEvent) {
@@ -41,7 +41,7 @@ function getExceptionMessageFromEvent(e) {
41
41
  return getExceptionMessage(e.reason, []);
42
42
  }
43
43
  else {
44
- return new messages_1.JSException('Unhandled Promise Rejection', String(e.reason), '[]');
44
+ return new index_js_1.JSException('Unhandled Promise Rejection', String(e.reason), '[]');
45
45
  }
46
46
  }
47
47
  return null;
@@ -1,2 +1,2 @@
1
- import App from '../app';
1
+ import App from "../app/index.js";
2
2
  export default function (app: App): void;