@openreplay/tracker 3.6.3 → 4.0.0

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/.eslintignore +8 -0
  2. package/.prettierignore +1 -0
  3. package/LICENSE +1 -1
  4. package/cjs/app/guards.d.ts +2 -1
  5. package/cjs/app/guards.js +6 -3
  6. package/cjs/app/index.d.ts +28 -23
  7. package/cjs/app/index.js +101 -83
  8. package/cjs/app/logger.js +6 -3
  9. package/cjs/app/messages.d.ts +52 -0
  10. package/cjs/app/messages.gen.d.ts +57 -0
  11. package/cjs/app/messages.gen.js +493 -0
  12. package/cjs/app/messages.js +234 -0
  13. package/cjs/app/nodes.d.ts +1 -1
  14. package/cjs/app/nodes.js +2 -0
  15. package/cjs/app/observer/iframe_observer.d.ts +1 -1
  16. package/cjs/app/observer/iframe_observer.js +3 -3
  17. package/cjs/app/observer/observer.d.ts +2 -3
  18. package/cjs/app/observer/observer.js +50 -52
  19. package/cjs/app/observer/shadow_root_observer.d.ts +1 -1
  20. package/cjs/app/observer/shadow_root_observer.js +3 -3
  21. package/cjs/app/observer/top_observer.d.ts +13 -2
  22. package/cjs/app/observer/top_observer.js +58 -23
  23. package/cjs/app/sanitizer.d.ts +1 -1
  24. package/cjs/app/sanitizer.js +5 -5
  25. package/cjs/app/session.d.ts +20 -2
  26. package/cjs/app/session.js +65 -6
  27. package/cjs/app/ticker.d.ts +1 -1
  28. package/cjs/common/{webworker.d.ts → interaction.d.ts} +5 -5
  29. package/cjs/common/{types.js → interaction.js} +0 -0
  30. package/cjs/common/messages.gen.d.ts +382 -0
  31. package/cjs/common/{webworker.js → messages.gen.js} +1 -0
  32. package/cjs/index.d.ts +10 -9
  33. package/cjs/index.js +47 -36
  34. package/cjs/modules/adoptedStyleSheets.d.ts +2 -0
  35. package/cjs/modules/adoptedStyleSheets.js +127 -0
  36. package/cjs/modules/connection.d.ts +1 -1
  37. package/cjs/modules/connection.js +2 -2
  38. package/cjs/modules/console.d.ts +1 -1
  39. package/cjs/modules/console.js +7 -21
  40. package/cjs/modules/cssrules.d.ts +1 -1
  41. package/cjs/modules/cssrules.js +18 -14
  42. package/cjs/modules/exception.d.ts +3 -3
  43. package/cjs/modules/exception.js +23 -18
  44. package/cjs/modules/img.d.ts +1 -1
  45. package/cjs/modules/img.js +39 -26
  46. package/cjs/modules/input.d.ts +1 -1
  47. package/cjs/modules/input.js +21 -21
  48. package/cjs/modules/mouse.d.ts +1 -1
  49. package/cjs/modules/mouse.js +50 -43
  50. package/cjs/modules/performance.d.ts +1 -1
  51. package/cjs/modules/performance.js +2 -2
  52. package/cjs/modules/scroll.d.ts +1 -1
  53. package/cjs/modules/scroll.js +16 -7
  54. package/cjs/modules/timing.d.ts +1 -1
  55. package/cjs/modules/timing.js +14 -26
  56. package/cjs/modules/viewport.d.ts +1 -1
  57. package/cjs/modules/viewport.js +4 -4
  58. package/cjs/utils.js +7 -7
  59. package/cjs/vendors/finder/finder.js +53 -48
  60. package/lib/app/guards.d.ts +2 -1
  61. package/lib/app/guards.js +4 -2
  62. package/lib/app/index.d.ts +28 -23
  63. package/lib/app/index.js +109 -91
  64. package/lib/app/logger.js +6 -3
  65. package/lib/app/messages.d.ts +52 -0
  66. package/lib/app/messages.gen.d.ts +57 -0
  67. package/lib/app/messages.gen.js +434 -0
  68. package/lib/app/messages.js +181 -0
  69. package/lib/app/nodes.d.ts +1 -1
  70. package/lib/app/nodes.js +2 -0
  71. package/lib/app/observer/iframe_observer.d.ts +1 -1
  72. package/lib/app/observer/iframe_observer.js +3 -3
  73. package/lib/app/observer/observer.d.ts +2 -3
  74. package/lib/app/observer/observer.js +51 -53
  75. package/lib/app/observer/shadow_root_observer.d.ts +1 -1
  76. package/lib/app/observer/shadow_root_observer.js +3 -3
  77. package/lib/app/observer/top_observer.d.ts +13 -2
  78. package/lib/app/observer/top_observer.js +62 -27
  79. package/lib/app/sanitizer.d.ts +1 -1
  80. package/lib/app/sanitizer.js +7 -7
  81. package/lib/app/session.d.ts +20 -2
  82. package/lib/app/session.js +65 -6
  83. package/lib/app/ticker.d.ts +1 -1
  84. package/lib/common/{webworker.d.ts → interaction.d.ts} +5 -5
  85. package/lib/common/{types.js → interaction.js} +0 -0
  86. package/lib/common/messages.gen.d.ts +382 -0
  87. package/lib/common/messages.gen.js +2 -0
  88. package/lib/common/tsconfig.tsbuildinfo +1 -1
  89. package/lib/index.d.ts +10 -9
  90. package/lib/index.js +60 -49
  91. package/lib/modules/adoptedStyleSheets.d.ts +2 -0
  92. package/lib/modules/adoptedStyleSheets.js +124 -0
  93. package/lib/modules/connection.d.ts +1 -1
  94. package/lib/modules/connection.js +2 -2
  95. package/lib/modules/console.d.ts +1 -1
  96. package/lib/modules/console.js +8 -22
  97. package/lib/modules/cssrules.d.ts +1 -1
  98. package/lib/modules/cssrules.js +19 -15
  99. package/lib/modules/exception.d.ts +3 -3
  100. package/lib/modules/exception.js +23 -18
  101. package/lib/modules/img.d.ts +1 -1
  102. package/lib/modules/img.js +41 -28
  103. package/lib/modules/input.d.ts +1 -1
  104. package/lib/modules/input.js +23 -23
  105. package/lib/modules/mouse.d.ts +1 -1
  106. package/lib/modules/mouse.js +53 -46
  107. package/lib/modules/performance.d.ts +1 -1
  108. package/lib/modules/performance.js +3 -3
  109. package/lib/modules/scroll.d.ts +1 -1
  110. package/lib/modules/scroll.js +17 -8
  111. package/lib/modules/timing.d.ts +1 -1
  112. package/lib/modules/timing.js +16 -28
  113. package/lib/modules/viewport.d.ts +1 -1
  114. package/lib/modules/viewport.js +4 -4
  115. package/lib/utils.js +7 -7
  116. package/lib/vendors/finder/finder.js +53 -48
  117. package/package.json +27 -10
  118. package/cjs/common/messages.d.ts +0 -444
  119. package/cjs/common/messages.js +0 -794
  120. package/cjs/common/types.d.ts +0 -9
  121. package/cjs/modules/longtasks.d.ts +0 -2
  122. package/cjs/modules/longtasks.js +0 -26
  123. package/lib/common/messages.d.ts +0 -444
  124. package/lib/common/messages.js +0 -790
  125. package/lib/common/types.d.ts +0 -9
  126. package/lib/common/webworker.js +0 -1
  127. package/lib/modules/longtasks.d.ts +0 -2
  128. package/lib/modules/longtasks.js +0 -23
@@ -0,0 +1,382 @@
1
+ export declare const enum Type {
2
+ BatchMetadata = 81,
3
+ PartitionedMessage = 82,
4
+ Timestamp = 0,
5
+ SetPageLocation = 4,
6
+ SetViewportSize = 5,
7
+ SetViewportScroll = 6,
8
+ CreateDocument = 7,
9
+ CreateElementNode = 8,
10
+ CreateTextNode = 9,
11
+ MoveNode = 10,
12
+ RemoveNode = 11,
13
+ SetNodeAttribute = 12,
14
+ RemoveNodeAttribute = 13,
15
+ SetNodeData = 14,
16
+ SetNodeScroll = 16,
17
+ SetInputTarget = 17,
18
+ SetInputValue = 18,
19
+ SetInputChecked = 19,
20
+ MouseMove = 20,
21
+ ConsoleLog = 22,
22
+ PageLoadTiming = 23,
23
+ PageRenderTiming = 24,
24
+ JSException = 25,
25
+ RawCustomEvent = 27,
26
+ UserID = 28,
27
+ UserAnonymousID = 29,
28
+ Metadata = 30,
29
+ CSSInsertRule = 37,
30
+ CSSDeleteRule = 38,
31
+ Fetch = 39,
32
+ Profiler = 40,
33
+ OTable = 41,
34
+ StateAction = 42,
35
+ Redux = 44,
36
+ Vuex = 45,
37
+ MobX = 46,
38
+ NgRx = 47,
39
+ GraphQL = 48,
40
+ PerformanceTrack = 49,
41
+ ResourceTiming = 53,
42
+ ConnectionInformation = 54,
43
+ SetPageVisibility = 55,
44
+ LongTask = 59,
45
+ SetNodeAttributeURLBased = 60,
46
+ SetCSSDataURLBased = 61,
47
+ TechnicalInfo = 63,
48
+ CustomIssue = 64,
49
+ CSSInsertRuleURLBased = 67,
50
+ MouseClick = 69,
51
+ CreateIFrameDocument = 70,
52
+ AdoptedSSReplaceURLBased = 71,
53
+ AdoptedSSInsertRuleURLBased = 73,
54
+ AdoptedSSDeleteRule = 75,
55
+ AdoptedSSAddOwner = 76,
56
+ AdoptedSSRemoveOwner = 77
57
+ }
58
+ export declare type BatchMetadata = [
59
+ Type.BatchMetadata,
60
+ number,
61
+ number,
62
+ number,
63
+ number,
64
+ string
65
+ ];
66
+ export declare type PartitionedMessage = [
67
+ Type.PartitionedMessage,
68
+ number,
69
+ number
70
+ ];
71
+ export declare type Timestamp = [
72
+ Type.Timestamp,
73
+ number
74
+ ];
75
+ export declare type SetPageLocation = [
76
+ Type.SetPageLocation,
77
+ string,
78
+ string,
79
+ number
80
+ ];
81
+ export declare type SetViewportSize = [
82
+ Type.SetViewportSize,
83
+ number,
84
+ number
85
+ ];
86
+ export declare type SetViewportScroll = [
87
+ Type.SetViewportScroll,
88
+ number,
89
+ number
90
+ ];
91
+ export declare type CreateDocument = [
92
+ Type.CreateDocument
93
+ ];
94
+ export declare type CreateElementNode = [
95
+ Type.CreateElementNode,
96
+ number,
97
+ number,
98
+ number,
99
+ string,
100
+ boolean
101
+ ];
102
+ export declare type CreateTextNode = [
103
+ Type.CreateTextNode,
104
+ number,
105
+ number,
106
+ number
107
+ ];
108
+ export declare type MoveNode = [
109
+ Type.MoveNode,
110
+ number,
111
+ number,
112
+ number
113
+ ];
114
+ export declare type RemoveNode = [
115
+ Type.RemoveNode,
116
+ number
117
+ ];
118
+ export declare type SetNodeAttribute = [
119
+ Type.SetNodeAttribute,
120
+ number,
121
+ string,
122
+ string
123
+ ];
124
+ export declare type RemoveNodeAttribute = [
125
+ Type.RemoveNodeAttribute,
126
+ number,
127
+ string
128
+ ];
129
+ export declare type SetNodeData = [
130
+ Type.SetNodeData,
131
+ number,
132
+ string
133
+ ];
134
+ export declare type SetNodeScroll = [
135
+ Type.SetNodeScroll,
136
+ number,
137
+ number,
138
+ number
139
+ ];
140
+ export declare type SetInputTarget = [
141
+ Type.SetInputTarget,
142
+ number,
143
+ string
144
+ ];
145
+ export declare type SetInputValue = [
146
+ Type.SetInputValue,
147
+ number,
148
+ string,
149
+ number
150
+ ];
151
+ export declare type SetInputChecked = [
152
+ Type.SetInputChecked,
153
+ number,
154
+ boolean
155
+ ];
156
+ export declare type MouseMove = [
157
+ Type.MouseMove,
158
+ number,
159
+ number
160
+ ];
161
+ export declare type ConsoleLog = [
162
+ Type.ConsoleLog,
163
+ string,
164
+ string
165
+ ];
166
+ export declare type PageLoadTiming = [
167
+ Type.PageLoadTiming,
168
+ number,
169
+ number,
170
+ number,
171
+ number,
172
+ number,
173
+ number,
174
+ number,
175
+ number,
176
+ number
177
+ ];
178
+ export declare type PageRenderTiming = [
179
+ Type.PageRenderTiming,
180
+ number,
181
+ number,
182
+ number
183
+ ];
184
+ export declare type JSException = [
185
+ Type.JSException,
186
+ string,
187
+ string,
188
+ string
189
+ ];
190
+ export declare type RawCustomEvent = [
191
+ Type.RawCustomEvent,
192
+ string,
193
+ string
194
+ ];
195
+ export declare type UserID = [
196
+ Type.UserID,
197
+ string
198
+ ];
199
+ export declare type UserAnonymousID = [
200
+ Type.UserAnonymousID,
201
+ string
202
+ ];
203
+ export declare type Metadata = [
204
+ Type.Metadata,
205
+ string,
206
+ string
207
+ ];
208
+ export declare type CSSInsertRule = [
209
+ Type.CSSInsertRule,
210
+ number,
211
+ string,
212
+ number
213
+ ];
214
+ export declare type CSSDeleteRule = [
215
+ Type.CSSDeleteRule,
216
+ number,
217
+ number
218
+ ];
219
+ export declare type Fetch = [
220
+ Type.Fetch,
221
+ string,
222
+ string,
223
+ string,
224
+ string,
225
+ number,
226
+ number,
227
+ number
228
+ ];
229
+ export declare type Profiler = [
230
+ Type.Profiler,
231
+ string,
232
+ number,
233
+ string,
234
+ string
235
+ ];
236
+ export declare type OTable = [
237
+ Type.OTable,
238
+ string,
239
+ string
240
+ ];
241
+ export declare type StateAction = [
242
+ Type.StateAction,
243
+ string
244
+ ];
245
+ export declare type Redux = [
246
+ Type.Redux,
247
+ string,
248
+ string,
249
+ number
250
+ ];
251
+ export declare type Vuex = [
252
+ Type.Vuex,
253
+ string,
254
+ string
255
+ ];
256
+ export declare type MobX = [
257
+ Type.MobX,
258
+ string,
259
+ string
260
+ ];
261
+ export declare type NgRx = [
262
+ Type.NgRx,
263
+ string,
264
+ string,
265
+ number
266
+ ];
267
+ export declare type GraphQL = [
268
+ Type.GraphQL,
269
+ string,
270
+ string,
271
+ string,
272
+ string
273
+ ];
274
+ export declare type PerformanceTrack = [
275
+ Type.PerformanceTrack,
276
+ number,
277
+ number,
278
+ number,
279
+ number
280
+ ];
281
+ export declare type ResourceTiming = [
282
+ Type.ResourceTiming,
283
+ number,
284
+ number,
285
+ number,
286
+ number,
287
+ number,
288
+ number,
289
+ string,
290
+ string
291
+ ];
292
+ export declare type ConnectionInformation = [
293
+ Type.ConnectionInformation,
294
+ number,
295
+ string
296
+ ];
297
+ export declare type SetPageVisibility = [
298
+ Type.SetPageVisibility,
299
+ boolean
300
+ ];
301
+ export declare type LongTask = [
302
+ Type.LongTask,
303
+ number,
304
+ number,
305
+ number,
306
+ number,
307
+ string,
308
+ string,
309
+ string
310
+ ];
311
+ export declare type SetNodeAttributeURLBased = [
312
+ Type.SetNodeAttributeURLBased,
313
+ number,
314
+ string,
315
+ string,
316
+ string
317
+ ];
318
+ export declare type SetCSSDataURLBased = [
319
+ Type.SetCSSDataURLBased,
320
+ number,
321
+ string,
322
+ string
323
+ ];
324
+ export declare type TechnicalInfo = [
325
+ Type.TechnicalInfo,
326
+ string,
327
+ string
328
+ ];
329
+ export declare type CustomIssue = [
330
+ Type.CustomIssue,
331
+ string,
332
+ string
333
+ ];
334
+ export declare type CSSInsertRuleURLBased = [
335
+ Type.CSSInsertRuleURLBased,
336
+ number,
337
+ string,
338
+ number,
339
+ string
340
+ ];
341
+ export declare type MouseClick = [
342
+ Type.MouseClick,
343
+ number,
344
+ number,
345
+ string,
346
+ string
347
+ ];
348
+ export declare type CreateIFrameDocument = [
349
+ Type.CreateIFrameDocument,
350
+ number,
351
+ number
352
+ ];
353
+ export declare type AdoptedSSReplaceURLBased = [
354
+ Type.AdoptedSSReplaceURLBased,
355
+ number,
356
+ string,
357
+ string
358
+ ];
359
+ export declare type AdoptedSSInsertRuleURLBased = [
360
+ Type.AdoptedSSInsertRuleURLBased,
361
+ number,
362
+ string,
363
+ number,
364
+ string
365
+ ];
366
+ export declare type AdoptedSSDeleteRule = [
367
+ Type.AdoptedSSDeleteRule,
368
+ number,
369
+ number
370
+ ];
371
+ export declare type AdoptedSSAddOwner = [
372
+ Type.AdoptedSSAddOwner,
373
+ number,
374
+ number
375
+ ];
376
+ export declare type AdoptedSSRemoveOwner = [
377
+ Type.AdoptedSSRemoveOwner,
378
+ number,
379
+ number
380
+ ];
381
+ declare type Message = BatchMetadata | PartitionedMessage | Timestamp | SetPageLocation | SetViewportSize | SetViewportScroll | CreateDocument | CreateElementNode | CreateTextNode | MoveNode | RemoveNode | SetNodeAttribute | RemoveNodeAttribute | SetNodeData | SetNodeScroll | SetInputTarget | SetInputValue | SetInputChecked | MouseMove | ConsoleLog | PageLoadTiming | PageRenderTiming | JSException | RawCustomEvent | UserID | UserAnonymousID | Metadata | CSSInsertRule | CSSDeleteRule | Fetch | Profiler | OTable | StateAction | Redux | Vuex | MobX | NgRx | GraphQL | PerformanceTrack | ResourceTiming | ConnectionInformation | SetPageVisibility | LongTask | SetNodeAttributeURLBased | SetCSSDataURLBased | TechnicalInfo | CustomIssue | CSSInsertRuleURLBased | MouseClick | CreateIFrameDocument | AdoptedSSReplaceURLBased | AdoptedSSInsertRuleURLBased | AdoptedSSDeleteRule | AdoptedSSAddOwner | AdoptedSSRemoveOwner;
382
+ export default Message;
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
+ // Auto-generated, do not edit
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
package/cjs/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import App from "./app/index.js";
1
+ import App from './app/index.js';
2
2
  export { default as App } from './app/index.js';
3
- import * as _Messages from "./common/messages.js";
3
+ import * as _Messages from './app/messages.gen.js';
4
4
  export declare const Messages: typeof _Messages;
5
- import type { Options as AppOptions } from "./app/index.js";
6
- import type { Options as ConsoleOptions } from "./modules/console.js";
7
- import type { Options as ExceptionOptions } from "./modules/exception.js";
8
- import type { Options as InputOptions } from "./modules/input.js";
9
- import type { Options as PerformanceOptions } from "./modules/performance.js";
10
- import type { Options as TimingOptions } from "./modules/timing.js";
5
+ import type { Options as AppOptions } from './app/index.js';
6
+ import type { Options as ConsoleOptions } from './modules/console.js';
7
+ import type { Options as ExceptionOptions } from './modules/exception.js';
8
+ import type { Options as InputOptions } from './modules/input.js';
9
+ import type { Options as PerformanceOptions } from './modules/performance.js';
10
+ import type { Options as TimingOptions } from './modules/timing.js';
11
11
  import type { StartOptions } from './app/index.js';
12
12
  import type { StartPromiseReturn } from './app/index.js';
13
13
  export declare type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & InputOptions & PerformanceOptions & TimingOptions> & {
@@ -25,10 +25,11 @@ export default class API {
25
25
  use<T>(fn: (app: App | null, options?: Options) => T): T;
26
26
  isActive(): boolean;
27
27
  start(startOpts?: Partial<StartOptions>): Promise<StartPromiseReturn>;
28
- stop(): void;
28
+ stop(): string | undefined;
29
29
  getSessionToken(): string | null | undefined;
30
30
  getSessionID(): string | null | undefined;
31
31
  sessionID(): string | null | undefined;
32
+ getSessionURL(): string | undefined;
32
33
  setUserID(id: string): void;
33
34
  userID(id: string): void;
34
35
  setUserAnonymousID(id: string): void;
package/cjs/index.js CHANGED
@@ -4,8 +4,8 @@ exports.Messages = exports.App = void 0;
4
4
  const index_js_1 = require("./app/index.js");
5
5
  var index_js_2 = require("./app/index.js");
6
6
  Object.defineProperty(exports, "App", { enumerable: true, get: function () { return index_js_2.default; } });
7
- const messages_js_1 = require("./common/messages.js");
8
- const _Messages = require("./common/messages.js");
7
+ const messages_gen_js_1 = require("./app/messages.gen.js");
8
+ const _Messages = require("./app/messages.gen.js");
9
9
  exports.Messages = _Messages;
10
10
  const connection_js_1 = require("./modules/connection.js");
11
11
  const console_js_1 = require("./modules/console.js");
@@ -18,6 +18,7 @@ const performance_js_1 = require("./modules/performance.js");
18
18
  const scroll_js_1 = require("./modules/scroll.js");
19
19
  const viewport_js_1 = require("./modules/viewport.js");
20
20
  const cssrules_js_1 = require("./modules/cssrules.js");
21
+ const adoptedStyleSheets_js_1 = require("./modules/adoptedStyleSheets.js");
21
22
  const utils_js_1 = require("./utils.js");
22
23
  const DOCS_SETUP = '/installation/setup-or';
23
24
  function processOptions(obj) {
@@ -27,22 +28,23 @@ function processOptions(obj) {
27
28
  }
28
29
  if (typeof obj.projectKey !== 'string') {
29
30
  if (typeof obj.projectKey !== 'number') {
30
- if (typeof obj.projectID !== 'number') { // Back compatability
31
+ if (typeof obj.projectID !== 'number') {
32
+ // Back compatability
31
33
  console.error(`OpenReplay: projectKey is missing or wrong type (string is expected). Please, check ${utils_js_1.DOCS_HOST}${DOCS_SETUP} for more information.`);
32
34
  return false;
33
35
  }
34
36
  else {
35
37
  obj.projectKey = obj.projectID.toString();
36
- (0, utils_js_1.deprecationWarn)("`projectID` option", "`projectKey` option", DOCS_SETUP);
38
+ (0, utils_js_1.deprecationWarn)('`projectID` option', '`projectKey` option', DOCS_SETUP);
37
39
  }
38
40
  }
39
41
  else {
40
- console.warn("OpenReplay: projectKey is expected to have a string type.");
42
+ console.warn('OpenReplay: projectKey is expected to have a string type.');
41
43
  obj.projectKey = obj.projectKey.toString();
42
44
  }
43
45
  }
44
- if (typeof obj.sessionToken !== 'string' && obj.sessionToken != null) {
45
- console.warn(`OpenReplay: invalid options argument type. Please, check documentation on ${utils_js_1.DOCS_HOST}${DOCS_SETUP}`);
46
+ if (obj.sessionToken != null) {
47
+ (0, utils_js_1.deprecationWarn)('`sessionToken` option', '`sessionHash` start() option', '/');
46
48
  }
47
49
  return true;
48
50
  }
@@ -69,31 +71,33 @@ class API {
69
71
  return;
70
72
  }
71
73
  if (window.__OPENREPLAY__) {
72
- console.error("OpenReplay: one tracker instance has been initialised already");
74
+ console.error('OpenReplay: one tracker instance has been initialised already');
73
75
  return;
74
76
  }
75
77
  if (!options.__DISABLE_SECURE_MODE && location.protocol !== 'https:') {
76
- 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
+ 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.');
77
79
  return;
78
80
  }
79
81
  const doNotTrack = options.respectDoNotTrack &&
80
- (navigator.doNotTrack == '1'
82
+ (navigator.doNotTrack == '1' ||
81
83
  // @ts-ignore
82
- || window.doNotTrack == '1');
83
- const app = this.app = doNotTrack ||
84
- !('Map' in window) ||
85
- !('Set' in window) ||
86
- !('MutationObserver' in window) ||
87
- !('performance' in window) ||
88
- !('timing' in performance) ||
89
- !('startsWith' in String.prototype) ||
90
- !('Blob' in window) ||
91
- !('Worker' in window)
92
- ? null
93
- : new index_js_1.default(options.projectKey, options.sessionToken, options);
84
+ window.doNotTrack == '1');
85
+ const app = (this.app =
86
+ doNotTrack ||
87
+ !('Map' in window) ||
88
+ !('Set' in window) ||
89
+ !('MutationObserver' in window) ||
90
+ !('performance' in window) ||
91
+ !('timing' in performance) ||
92
+ !('startsWith' in String.prototype) ||
93
+ !('Blob' in window) ||
94
+ !('Worker' in window)
95
+ ? null
96
+ : new index_js_1.default(options.projectKey, options.sessionToken, options));
94
97
  if (app !== null) {
95
98
  (0, viewport_js_1.default)(app);
96
99
  (0, cssrules_js_1.default)(app);
100
+ (0, adoptedStyleSheets_js_1.default)(app);
97
101
  (0, connection_js_1.default)(app);
98
102
  (0, console_js_1.default)(app, options);
99
103
  (0, exception_js_1.default)(app, options);
@@ -123,11 +127,11 @@ class API {
123
127
  console.log("OpenReplay: browser doesn't support API required for tracking or doNotTrack is set to 1.");
124
128
  const req = new XMLHttpRequest();
125
129
  const orig = options.ingestPoint || index_js_1.DEFAULT_INGEST_POINT;
126
- req.open("POST", orig + "/v1/web/not-started");
130
+ req.open('POST', orig + '/v1/web/not-started');
127
131
  // no-cors issue only with text/plain or not-set Content-Type
128
132
  // req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
129
133
  req.send(JSON.stringify({
130
- trackerVersion: '3.6.3',
134
+ trackerVersion: '4.0.0',
131
135
  projectKey: options.projectKey,
132
136
  doNotTrack,
133
137
  // TODO: add precise reason (an exact API missing)
@@ -146,7 +150,7 @@ class API {
146
150
  start(startOpts) {
147
151
  if (!utils_js_1.IN_BROWSER) {
148
152
  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}`);
149
- return Promise.reject("Trying to start not in browser.");
153
+ return Promise.reject('Trying to start not in browser.');
150
154
  }
151
155
  if (this.app === null) {
152
156
  return Promise.reject("Browser doesn't support required api, or doNotTrack is active.");
@@ -158,7 +162,10 @@ class API {
158
162
  if (this.app === null) {
159
163
  return;
160
164
  }
161
- this.app.stop(true);
165
+ this.app.stop();
166
+ const sessionHash = this.app.session.getSessionHash();
167
+ this.app.session.reset();
168
+ return sessionHash;
162
169
  }
163
170
  getSessionToken() {
164
171
  if (this.app === null) {
@@ -173,36 +180,40 @@ class API {
173
180
  return this.app.getSessionID();
174
181
  }
175
182
  sessionID() {
176
- (0, utils_js_1.deprecationWarn)("'sessionID' method", "'getSessionID' method", "/");
183
+ (0, utils_js_1.deprecationWarn)("'sessionID' method", "'getSessionID' method", '/');
177
184
  return this.getSessionID();
178
185
  }
186
+ getSessionURL() {
187
+ if (this.app === null) {
188
+ return undefined;
189
+ }
190
+ return this.app.getSessionURL();
191
+ }
179
192
  setUserID(id) {
180
193
  if (typeof id === 'string' && this.app !== null) {
181
194
  this.app.session.setUserID(id);
182
195
  }
183
196
  }
184
197
  userID(id) {
185
- (0, utils_js_1.deprecationWarn)("'userID' method", "'setUserID' method", "/");
198
+ (0, utils_js_1.deprecationWarn)("'userID' method", "'setUserID' method", '/');
186
199
  this.setUserID(id);
187
200
  }
188
201
  setUserAnonymousID(id) {
189
202
  if (typeof id === 'string' && this.app !== null) {
190
- this.app.send(new messages_js_1.UserAnonymousID(id));
203
+ this.app.send((0, messages_gen_js_1.UserAnonymousID)(id));
191
204
  }
192
205
  }
193
206
  userAnonymousID(id) {
194
- (0, utils_js_1.deprecationWarn)("'userAnonymousID' method", "'setUserAnonymousID' method", "/");
207
+ (0, utils_js_1.deprecationWarn)("'userAnonymousID' method", "'setUserAnonymousID' method", '/');
195
208
  this.setUserAnonymousID(id);
196
209
  }
197
210
  setMetadata(key, value) {
198
- if (typeof key === 'string' &&
199
- typeof value === 'string' &&
200
- this.app !== null) {
211
+ if (typeof key === 'string' && typeof value === 'string' && this.app !== null) {
201
212
  this.app.session.setMetadata(key, value);
202
213
  }
203
214
  }
204
215
  metadata(key, value) {
205
- (0, utils_js_1.deprecationWarn)("'metadata' method", "'setMetadata' method", "/");
216
+ (0, utils_js_1.deprecationWarn)("'metadata' method", "'setMetadata' method", '/');
206
217
  this.setMetadata(key, value);
207
218
  }
208
219
  event(key, payload, issue = false) {
@@ -217,7 +228,7 @@ class API {
217
228
  catch (e) {
218
229
  return;
219
230
  }
220
- this.app.send(new messages_js_1.RawCustomEvent(key, payload));
231
+ this.app.send((0, messages_gen_js_1.RawCustomEvent)(key, payload));
221
232
  }
222
233
  }
223
234
  }
@@ -229,7 +240,7 @@ class API {
229
240
  catch (e) {
230
241
  return;
231
242
  }
232
- this.app.send(new messages_js_1.CustomIssue(key, payload));
243
+ this.app.send((0, messages_gen_js_1.CustomIssue)(key, payload));
233
244
  }
234
245
  }
235
246
  }
@@ -0,0 +1,2 @@
1
+ import type App from '../app/index.js';
2
+ export default function (app: App | null): void;