@openreplay/tracker 3.6.1 → 3.6.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.
Files changed (90) hide show
  1. package/.eslintignore +1 -1
  2. package/LICENSE +1 -1
  3. package/cjs/app/guards.d.ts +1 -2
  4. package/cjs/app/guards.js +1 -5
  5. package/cjs/app/index.d.ts +13 -16
  6. package/cjs/app/index.js +45 -47
  7. package/cjs/app/nodes.d.ts +1 -1
  8. package/cjs/app/nodes.js +0 -2
  9. package/cjs/app/observer/iframe_observer.js +2 -2
  10. package/cjs/app/observer/observer.js +13 -13
  11. package/cjs/app/observer/shadow_root_observer.js +2 -2
  12. package/cjs/app/observer/top_observer.d.ts +0 -11
  13. package/cjs/app/observer/top_observer.js +12 -46
  14. package/cjs/app/session.d.ts +0 -6
  15. package/cjs/app/session.js +0 -46
  16. package/cjs/common/messages.d.ts +444 -0
  17. package/cjs/common/messages.js +743 -0
  18. package/cjs/common/types.d.ts +9 -0
  19. package/cjs/common/{interaction.js → types.js} +0 -0
  20. package/cjs/common/{interaction.d.ts → webworker.d.ts} +3 -3
  21. package/cjs/common/{messages.gen.js → webworker.js} +0 -1
  22. package/cjs/index.d.ts +2 -2
  23. package/cjs/index.js +9 -14
  24. package/cjs/modules/connection.js +2 -2
  25. package/cjs/modules/console.js +20 -6
  26. package/cjs/modules/cssrules.js +12 -16
  27. package/cjs/modules/exception.d.ts +2 -2
  28. package/cjs/modules/exception.js +12 -16
  29. package/cjs/modules/img.js +21 -31
  30. package/cjs/modules/input.js +6 -6
  31. package/cjs/modules/longtasks.d.ts +2 -0
  32. package/cjs/modules/longtasks.js +34 -0
  33. package/cjs/modules/mouse.js +33 -42
  34. package/cjs/modules/performance.js +2 -2
  35. package/cjs/modules/scroll.js +7 -16
  36. package/cjs/modules/timing.js +4 -4
  37. package/cjs/modules/viewport.js +4 -4
  38. package/lib/app/guards.d.ts +1 -2
  39. package/lib/app/guards.js +0 -3
  40. package/lib/app/index.d.ts +13 -16
  41. package/lib/app/index.js +46 -48
  42. package/lib/app/nodes.d.ts +1 -1
  43. package/lib/app/nodes.js +0 -2
  44. package/lib/app/observer/iframe_observer.js +1 -1
  45. package/lib/app/observer/observer.js +12 -12
  46. package/lib/app/observer/shadow_root_observer.js +1 -1
  47. package/lib/app/observer/top_observer.d.ts +0 -11
  48. package/lib/app/observer/top_observer.js +12 -46
  49. package/lib/app/session.d.ts +0 -6
  50. package/lib/app/session.js +0 -46
  51. package/lib/common/messages.d.ts +444 -0
  52. package/lib/common/messages.js +739 -0
  53. package/lib/common/tsconfig.tsbuildinfo +1 -1
  54. package/lib/common/types.d.ts +9 -0
  55. package/lib/common/{interaction.js → types.js} +0 -0
  56. package/lib/common/{interaction.d.ts → webworker.d.ts} +3 -3
  57. package/lib/common/webworker.js +1 -0
  58. package/lib/index.d.ts +2 -2
  59. package/lib/index.js +9 -14
  60. package/lib/modules/connection.js +2 -2
  61. package/lib/modules/console.js +20 -6
  62. package/lib/modules/cssrules.js +12 -16
  63. package/lib/modules/exception.d.ts +2 -2
  64. package/lib/modules/exception.js +12 -16
  65. package/lib/modules/img.js +21 -31
  66. package/lib/modules/input.js +6 -6
  67. package/lib/modules/longtasks.d.ts +2 -0
  68. package/lib/modules/longtasks.js +31 -0
  69. package/lib/modules/mouse.js +34 -43
  70. package/lib/modules/performance.js +2 -2
  71. package/lib/modules/scroll.js +8 -17
  72. package/lib/modules/timing.js +4 -4
  73. package/lib/modules/viewport.js +4 -4
  74. package/package.json +4 -3
  75. package/.prettierignore +0 -1
  76. package/cjs/app/messages.d.ts +0 -52
  77. package/cjs/app/messages.gen.d.ts +0 -57
  78. package/cjs/app/messages.gen.js +0 -493
  79. package/cjs/app/messages.js +0 -234
  80. package/cjs/common/messages.gen.d.ts +0 -382
  81. package/cjs/modules/adoptedStyleSheets.d.ts +0 -2
  82. package/cjs/modules/adoptedStyleSheets.js +0 -127
  83. package/lib/app/messages.d.ts +0 -52
  84. package/lib/app/messages.gen.d.ts +0 -57
  85. package/lib/app/messages.gen.js +0 -434
  86. package/lib/app/messages.js +0 -181
  87. package/lib/common/messages.gen.d.ts +0 -382
  88. package/lib/common/messages.gen.js +0 -2
  89. package/lib/modules/adoptedStyleSheets.d.ts +0 -2
  90. package/lib/modules/adoptedStyleSheets.js +0 -124
@@ -1,382 +0,0 @@
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 +0,0 @@
1
- // Auto-generated, do not edit
2
- export {};
@@ -1,2 +0,0 @@
1
- import type App from '../app/index.js';
2
- export default function (app: App | null): void;
@@ -1,124 +0,0 @@
1
- import { TechnicalInfo, AdoptedSSReplaceURLBased, AdoptedSSInsertRuleURLBased, AdoptedSSDeleteRule, AdoptedSSAddOwner, AdoptedSSRemoveOwner, } from '../app/messages.gen.js';
2
- import { isRootNode } from '../app/guards.js';
3
- function hasAdoptedSS(node) {
4
- return (isRootNode(node) &&
5
- // @ts-ignore
6
- !!node.adoptedStyleSheets);
7
- }
8
- export default function (app) {
9
- if (app === null) {
10
- return;
11
- }
12
- if (!hasAdoptedSS(document)) {
13
- app.attachStartCallback(() => {
14
- // MBTODO: pre-start sendQueue app
15
- app.send(TechnicalInfo('no_adopted_stylesheets', ''));
16
- });
17
- return;
18
- }
19
- let nextID = 0xf;
20
- const styleSheetIDMap = new Map();
21
- const adoptedStyleSheetsOwnings = new Map();
22
- const updateAdoptedStyleSheets = (root) => {
23
- let nodeID = app.nodes.getID(root);
24
- if (root === document) {
25
- nodeID = 0; // main document doesn't have nodeID. ID count starts from the documentElement
26
- }
27
- if (!nodeID) {
28
- return;
29
- }
30
- let pastOwning = adoptedStyleSheetsOwnings.get(nodeID);
31
- if (!pastOwning) {
32
- pastOwning = [];
33
- }
34
- const nowOwning = [];
35
- const styleSheets = root.adoptedStyleSheets;
36
- for (const s of styleSheets) {
37
- let sheetID = styleSheetIDMap.get(s);
38
- const init = !sheetID;
39
- if (!sheetID) {
40
- sheetID = ++nextID;
41
- }
42
- nowOwning.push(sheetID);
43
- if (!pastOwning.includes(sheetID)) {
44
- app.send(AdoptedSSAddOwner(sheetID, nodeID));
45
- }
46
- if (init) {
47
- const rules = s.cssRules;
48
- for (let i = 0; i < rules.length; i++) {
49
- app.send(AdoptedSSInsertRuleURLBased(sheetID, rules[i].cssText, i, app.getBaseHref()));
50
- }
51
- }
52
- }
53
- for (const sheetID of pastOwning) {
54
- if (!nowOwning.includes(sheetID)) {
55
- app.send(AdoptedSSRemoveOwner(sheetID, nodeID));
56
- }
57
- }
58
- adoptedStyleSheetsOwnings.set(nodeID, nowOwning);
59
- };
60
- function patchAdoptedStyleSheets(prototype) {
61
- const nativeAdoptedStyleSheetsDescriptor = Object.getOwnPropertyDescriptor(prototype, 'adoptedStyleSheets');
62
- if (nativeAdoptedStyleSheetsDescriptor) {
63
- Object.defineProperty(prototype, 'adoptedStyleSheets', Object.assign(Object.assign({}, nativeAdoptedStyleSheetsDescriptor), { set: function (value) {
64
- // @ts-ignore
65
- const retVal = nativeAdoptedStyleSheetsDescriptor.set.call(this, value);
66
- updateAdoptedStyleSheets(this);
67
- return retVal;
68
- } }));
69
- }
70
- }
71
- const patchContext = (context) => {
72
- patchAdoptedStyleSheets(context.Document.prototype);
73
- patchAdoptedStyleSheets(context.ShadowRoot.prototype);
74
- //@ts-ignore TODO: configure ts (use necessary lib)
75
- const { insertRule, deleteRule, replace, replaceSync } = context.CSSStyleSheet.prototype;
76
- //@ts-ignore
77
- context.CSSStyleSheet.prototype.replace = function (text) {
78
- return replace.call(this, text).then((sheet) => {
79
- const sheetID = styleSheetIDMap.get(this);
80
- if (sheetID) {
81
- app.send(AdoptedSSReplaceURLBased(sheetID, text, app.getBaseHref()));
82
- }
83
- return sheet;
84
- });
85
- };
86
- //@ts-ignore
87
- context.CSSStyleSheet.prototype.replaceSync = function (text) {
88
- const sheetID = styleSheetIDMap.get(this);
89
- if (sheetID) {
90
- app.send(AdoptedSSReplaceURLBased(sheetID, text, app.getBaseHref()));
91
- }
92
- return replaceSync.call(this, text);
93
- };
94
- context.CSSStyleSheet.prototype.insertRule = function (rule, index = 0) {
95
- const sheetID = styleSheetIDMap.get(this);
96
- if (sheetID) {
97
- app.send(AdoptedSSInsertRuleURLBased(sheetID, rule, index, app.getBaseHref()));
98
- }
99
- return insertRule.call(this, rule, index);
100
- };
101
- context.CSSStyleSheet.prototype.deleteRule = function (index) {
102
- const sheetID = styleSheetIDMap.get(this);
103
- if (sheetID) {
104
- app.send(AdoptedSSDeleteRule(sheetID, index));
105
- }
106
- return deleteRule.call(this, index);
107
- };
108
- };
109
- patchContext(window);
110
- app.observer.attachContextCallback(patchContext);
111
- app.attachStopCallback(() => {
112
- styleSheetIDMap.clear();
113
- adoptedStyleSheetsOwnings.clear();
114
- });
115
- // So far main Document is not triggered with nodeCallbacks
116
- app.attachStartCallback(() => {
117
- updateAdoptedStyleSheets(document);
118
- });
119
- app.nodes.attachNodeCallback((node) => {
120
- if (hasAdoptedSS(node)) {
121
- updateAdoptedStyleSheets(node);
122
- }
123
- });
124
- }