@openreplay/tracker 4.1.10 → 4.1.11

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 (71) hide show
  1. package/.eslintignore +0 -3
  2. package/README.md +18 -22
  3. package/cjs/app/guards.d.ts +12 -11
  4. package/cjs/app/guards.js +1 -2
  5. package/cjs/app/index.d.ts +8 -11
  6. package/cjs/app/index.js +8 -27
  7. package/cjs/app/logger.d.ts +3 -3
  8. package/cjs/app/messages.d.ts +52 -0
  9. package/cjs/app/messages.gen.d.ts +6 -8
  10. package/cjs/app/messages.gen.js +94 -116
  11. package/cjs/app/messages.js +234 -0
  12. package/cjs/app/nodes.d.ts +1 -1
  13. package/cjs/app/observer/iframe_offsets.d.ts +1 -1
  14. package/cjs/app/observer/observer.js +5 -5
  15. package/cjs/app/observer/top_observer.d.ts +2 -2
  16. package/cjs/app/observer/top_observer.js +1 -1
  17. package/cjs/app/session.d.ts +2 -2
  18. package/cjs/app/ticker.d.ts +1 -1
  19. package/cjs/common/interaction.d.ts +5 -5
  20. package/cjs/common/messages.gen.d.ts +86 -104
  21. package/cjs/index.d.ts +2 -6
  22. package/cjs/index.js +5 -7
  23. package/cjs/modules/cssrules.js +1 -1
  24. package/cjs/modules/focus.js +2 -2
  25. package/cjs/modules/fonts.js +2 -2
  26. package/cjs/modules/img.js +5 -6
  27. package/cjs/modules/input.d.ts +1 -1
  28. package/cjs/modules/input.js +23 -15
  29. package/cjs/modules/mouse.js +1 -1
  30. package/cjs/modules/timing.js +3 -7
  31. package/cjs/modules/viewport.js +1 -3
  32. package/cjs/vendors/finder/finder.d.ts +1 -1
  33. package/lib/app/guards.d.ts +12 -11
  34. package/lib/app/guards.js +1 -2
  35. package/lib/app/index.d.ts +8 -11
  36. package/lib/app/index.js +9 -28
  37. package/lib/app/logger.d.ts +3 -3
  38. package/lib/app/messages.d.ts +52 -0
  39. package/lib/app/messages.gen.d.ts +6 -8
  40. package/lib/app/messages.gen.js +87 -107
  41. package/lib/app/messages.js +181 -0
  42. package/lib/app/nodes.d.ts +1 -1
  43. package/lib/app/observer/iframe_offsets.d.ts +1 -1
  44. package/lib/app/observer/observer.js +5 -5
  45. package/lib/app/observer/top_observer.d.ts +2 -2
  46. package/lib/app/observer/top_observer.js +1 -1
  47. package/lib/app/session.d.ts +2 -2
  48. package/lib/app/ticker.d.ts +1 -1
  49. package/lib/common/interaction.d.ts +5 -5
  50. package/lib/common/messages.gen.d.ts +86 -104
  51. package/lib/common/tsconfig.tsbuildinfo +1 -1
  52. package/lib/index.d.ts +2 -6
  53. package/lib/index.js +6 -8
  54. package/lib/modules/cssrules.js +1 -1
  55. package/lib/modules/focus.js +2 -2
  56. package/lib/modules/fonts.js +2 -2
  57. package/lib/modules/img.js +5 -6
  58. package/lib/modules/input.d.ts +1 -1
  59. package/lib/modules/input.js +23 -15
  60. package/lib/modules/mouse.js +1 -1
  61. package/lib/modules/timing.js +4 -8
  62. package/lib/modules/viewport.js +1 -3
  63. package/lib/vendors/finder/finder.d.ts +1 -1
  64. package/package.json +3 -8
  65. package/tsconfig-base.json +1 -2
  66. package/CHANGELOG.md +0 -19
  67. package/cjs/modules/network.d.ts +0 -28
  68. package/cjs/modules/network.js +0 -203
  69. package/jest.config.js +0 -11
  70. package/lib/modules/network.d.ts +0 -28
  71. package/lib/modules/network.js +0 -200
@@ -0,0 +1,234 @@
1
+ "use strict";
2
+ // Auto-generated, do not edit
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CreateIFrameDocument = exports.MouseClick = exports.CSSInsertRuleURLBased = exports.CustomIssue = exports.TechnicalInfo = exports.SetCSSDataURLBased = exports.SetNodeAttributeURLBased = exports.LongTask = exports.SetPageVisibility = exports.ConnectionInformation = exports.ResourceTiming = exports.PerformanceTrack = exports.GraphQL = exports.NgRx = exports.MobX = exports.Vuex = exports.Redux = exports.StateAction = exports.OTable = exports.Profiler = exports.Fetch = exports.CSSDeleteRule = exports.CSSInsertRule = exports.Metadata = exports.UserAnonymousID = exports.UserID = exports.RawCustomEvent = exports.JSException = exports.PageRenderTiming = exports.PageLoadTiming = exports.ConsoleLog = exports.MouseMove = exports.SetInputChecked = exports.SetInputValue = exports.SetInputTarget = exports.SetNodeScroll = exports.SetNodeData = exports.RemoveNodeAttribute = exports.SetNodeAttribute = exports.RemoveNode = exports.MoveNode = exports.CreateTextNode = exports.CreateElementNode = exports.CreateDocument = exports.SetViewportScroll = exports.SetViewportSize = exports.SetPageLocation = exports.Timestamp = exports.PartitionedMessage = exports.BatchMetadata = void 0;
5
+ function BatchMetadata(version, pageNo, firstIndex, timestamp, location) {
6
+ return [81 /* BatchMetadata */, version, pageNo, firstIndex, timestamp, location];
7
+ }
8
+ exports.BatchMetadata = BatchMetadata;
9
+ function PartitionedMessage(partNo, partTotal) {
10
+ return [82 /* PartitionedMessage */, partNo, partTotal];
11
+ }
12
+ exports.PartitionedMessage = PartitionedMessage;
13
+ function Timestamp(timestamp) {
14
+ return [0 /* Timestamp */, timestamp];
15
+ }
16
+ exports.Timestamp = Timestamp;
17
+ function SetPageLocation(url, referrer, navigationStart) {
18
+ return [4 /* SetPageLocation */, url, referrer, navigationStart];
19
+ }
20
+ exports.SetPageLocation = SetPageLocation;
21
+ function SetViewportSize(width, height) {
22
+ return [5 /* SetViewportSize */, width, height];
23
+ }
24
+ exports.SetViewportSize = SetViewportSize;
25
+ function SetViewportScroll(x, y) {
26
+ return [6 /* SetViewportScroll */, x, y];
27
+ }
28
+ exports.SetViewportScroll = SetViewportScroll;
29
+ function CreateDocument() {
30
+ return [7 /* CreateDocument */];
31
+ }
32
+ exports.CreateDocument = CreateDocument;
33
+ function CreateElementNode(id, parentID, index, tag, svg) {
34
+ return [8 /* CreateElementNode */, id, parentID, index, tag, svg];
35
+ }
36
+ exports.CreateElementNode = CreateElementNode;
37
+ function CreateTextNode(id, parentID, index) {
38
+ return [9 /* CreateTextNode */, id, parentID, index];
39
+ }
40
+ exports.CreateTextNode = CreateTextNode;
41
+ function MoveNode(id, parentID, index) {
42
+ return [10 /* MoveNode */, id, parentID, index];
43
+ }
44
+ exports.MoveNode = MoveNode;
45
+ function RemoveNode(id) {
46
+ return [11 /* RemoveNode */, id];
47
+ }
48
+ exports.RemoveNode = RemoveNode;
49
+ function SetNodeAttribute(id, name, value) {
50
+ return [12 /* SetNodeAttribute */, id, name, value];
51
+ }
52
+ exports.SetNodeAttribute = SetNodeAttribute;
53
+ function RemoveNodeAttribute(id, name) {
54
+ return [13 /* RemoveNodeAttribute */, id, name];
55
+ }
56
+ exports.RemoveNodeAttribute = RemoveNodeAttribute;
57
+ function SetNodeData(id, data) {
58
+ return [14 /* SetNodeData */, id, data];
59
+ }
60
+ exports.SetNodeData = SetNodeData;
61
+ function SetNodeScroll(id, x, y) {
62
+ return [16 /* SetNodeScroll */, id, x, y];
63
+ }
64
+ exports.SetNodeScroll = SetNodeScroll;
65
+ function SetInputTarget(id, label) {
66
+ return [17 /* SetInputTarget */, id, label];
67
+ }
68
+ exports.SetInputTarget = SetInputTarget;
69
+ function SetInputValue(id, value, mask) {
70
+ return [18 /* SetInputValue */, id, value, mask];
71
+ }
72
+ exports.SetInputValue = SetInputValue;
73
+ function SetInputChecked(id, checked) {
74
+ return [19 /* SetInputChecked */, id, checked];
75
+ }
76
+ exports.SetInputChecked = SetInputChecked;
77
+ function MouseMove(x, y) {
78
+ return [20 /* MouseMove */, x, y];
79
+ }
80
+ exports.MouseMove = MouseMove;
81
+ function ConsoleLog(level, value) {
82
+ return [22 /* ConsoleLog */, level, value];
83
+ }
84
+ exports.ConsoleLog = ConsoleLog;
85
+ function PageLoadTiming(requestStart, responseStart, responseEnd, domContentLoadedEventStart, domContentLoadedEventEnd, loadEventStart, loadEventEnd, firstPaint, firstContentfulPaint) {
86
+ return [
87
+ 23 /* PageLoadTiming */,
88
+ requestStart,
89
+ responseStart,
90
+ responseEnd,
91
+ domContentLoadedEventStart,
92
+ domContentLoadedEventEnd,
93
+ loadEventStart,
94
+ loadEventEnd,
95
+ firstPaint,
96
+ firstContentfulPaint,
97
+ ];
98
+ }
99
+ exports.PageLoadTiming = PageLoadTiming;
100
+ function PageRenderTiming(speedIndex, visuallyComplete, timeToInteractive) {
101
+ return [24 /* PageRenderTiming */, speedIndex, visuallyComplete, timeToInteractive];
102
+ }
103
+ exports.PageRenderTiming = PageRenderTiming;
104
+ function JSException(name, message, payload, metadata) {
105
+ return [78 /* JSException */, name, message, payload, metadata];
106
+ }
107
+ exports.JSException = JSException;
108
+ function RawCustomEvent(name, payload) {
109
+ return [27 /* RawCustomEvent */, name, payload];
110
+ }
111
+ exports.RawCustomEvent = RawCustomEvent;
112
+ function UserID(id) {
113
+ return [28 /* UserID */, id];
114
+ }
115
+ exports.UserID = UserID;
116
+ function UserAnonymousID(id) {
117
+ return [29 /* UserAnonymousID */, id];
118
+ }
119
+ exports.UserAnonymousID = UserAnonymousID;
120
+ function Metadata(key, value) {
121
+ return [30 /* Metadata */, key, value];
122
+ }
123
+ exports.Metadata = Metadata;
124
+ function CSSInsertRule(id, rule, index) {
125
+ return [37 /* CSSInsertRule */, id, rule, index];
126
+ }
127
+ exports.CSSInsertRule = CSSInsertRule;
128
+ function CSSDeleteRule(id, index) {
129
+ return [38 /* CSSDeleteRule */, id, index];
130
+ }
131
+ exports.CSSDeleteRule = CSSDeleteRule;
132
+ function Fetch(method, url, request, response, status, timestamp, duration) {
133
+ return [39 /* Fetch */, method, url, request, response, status, timestamp, duration];
134
+ }
135
+ exports.Fetch = Fetch;
136
+ function Profiler(name, duration, args, result) {
137
+ return [40 /* Profiler */, name, duration, args, result];
138
+ }
139
+ exports.Profiler = Profiler;
140
+ function OTable(key, value) {
141
+ return [41 /* OTable */, key, value];
142
+ }
143
+ exports.OTable = OTable;
144
+ function StateAction(type) {
145
+ return [42 /* StateAction */, type];
146
+ }
147
+ exports.StateAction = StateAction;
148
+ function Redux(action, state, duration) {
149
+ return [44 /* Redux */, action, state, duration];
150
+ }
151
+ exports.Redux = Redux;
152
+ function Vuex(mutation, state) {
153
+ return [45 /* Vuex */, mutation, state];
154
+ }
155
+ exports.Vuex = Vuex;
156
+ function MobX(type, payload) {
157
+ return [46 /* MobX */, type, payload];
158
+ }
159
+ exports.MobX = MobX;
160
+ function NgRx(action, state, duration) {
161
+ return [47 /* NgRx */, action, state, duration];
162
+ }
163
+ exports.NgRx = NgRx;
164
+ function GraphQL(operationKind, operationName, variables, response) {
165
+ return [48 /* GraphQL */, operationKind, operationName, variables, response];
166
+ }
167
+ exports.GraphQL = GraphQL;
168
+ function PerformanceTrack(frames, ticks, totalJSHeapSize, usedJSHeapSize) {
169
+ return [49 /* PerformanceTrack */, frames, ticks, totalJSHeapSize, usedJSHeapSize];
170
+ }
171
+ exports.PerformanceTrack = PerformanceTrack;
172
+ function ResourceTiming(timestamp, duration, ttfb, headerSize, encodedBodySize, decodedBodySize, url, initiator) {
173
+ return [
174
+ 53 /* ResourceTiming */,
175
+ timestamp,
176
+ duration,
177
+ ttfb,
178
+ headerSize,
179
+ encodedBodySize,
180
+ decodedBodySize,
181
+ url,
182
+ initiator,
183
+ ];
184
+ }
185
+ exports.ResourceTiming = ResourceTiming;
186
+ function ConnectionInformation(downlink, type) {
187
+ return [54 /* ConnectionInformation */, downlink, type];
188
+ }
189
+ exports.ConnectionInformation = ConnectionInformation;
190
+ function SetPageVisibility(hidden) {
191
+ return [55 /* SetPageVisibility */, hidden];
192
+ }
193
+ exports.SetPageVisibility = SetPageVisibility;
194
+ function LongTask(timestamp, duration, context, containerType, containerSrc, containerId, containerName) {
195
+ return [
196
+ 59 /* LongTask */,
197
+ timestamp,
198
+ duration,
199
+ context,
200
+ containerType,
201
+ containerSrc,
202
+ containerId,
203
+ containerName,
204
+ ];
205
+ }
206
+ exports.LongTask = LongTask;
207
+ function SetNodeAttributeURLBased(id, name, value, baseURL) {
208
+ return [60 /* SetNodeAttributeURLBased */, id, name, value, baseURL];
209
+ }
210
+ exports.SetNodeAttributeURLBased = SetNodeAttributeURLBased;
211
+ function SetCSSDataURLBased(id, data, baseURL) {
212
+ return [61 /* SetCSSDataURLBased */, id, data, baseURL];
213
+ }
214
+ exports.SetCSSDataURLBased = SetCSSDataURLBased;
215
+ function TechnicalInfo(type, value) {
216
+ return [63 /* TechnicalInfo */, type, value];
217
+ }
218
+ exports.TechnicalInfo = TechnicalInfo;
219
+ function CustomIssue(name, payload) {
220
+ return [64 /* CustomIssue */, name, payload];
221
+ }
222
+ exports.CustomIssue = CustomIssue;
223
+ function CSSInsertRuleURLBased(id, rule, index, baseURL) {
224
+ return [67 /* CSSInsertRuleURLBased */, id, rule, index, baseURL];
225
+ }
226
+ exports.CSSInsertRuleURLBased = CSSInsertRuleURLBased;
227
+ function MouseClick(id, hesitationTime, label, selector) {
228
+ return [69 /* MouseClick */, id, hesitationTime, label, selector];
229
+ }
230
+ exports.MouseClick = MouseClick;
231
+ function CreateIFrameDocument(frameID, id) {
232
+ return [70 /* CreateIFrameDocument */, frameID, id];
233
+ }
234
+ exports.CreateIFrameDocument = CreateIFrameDocument;
@@ -1,4 +1,4 @@
1
- type NodeCallback = (node: Node, isStart: boolean) => void;
1
+ declare type NodeCallback = (node: Node, isStart: boolean) => void;
2
2
  export default class Nodes {
3
3
  private readonly node_id;
4
4
  private nodes;
@@ -1,4 +1,4 @@
1
- export type Offset = [/*left:*/ number, /*top: */ number];
1
+ export declare type Offset = [/*left:*/ number, /*top: */ number];
2
2
  export default class IFrameOffsets {
3
3
  private readonly states;
4
4
  private calcOffset;
@@ -125,7 +125,7 @@ class Observer {
125
125
  return;
126
126
  }
127
127
  if (name === 'value' &&
128
- (0, guards_js_1.hasTag)(node, 'input') &&
128
+ (0, guards_js_1.hasTag)(node, 'INPUT') &&
129
129
  node.type !== 'button' &&
130
130
  node.type !== 'reset' &&
131
131
  node.type !== 'submit') {
@@ -135,7 +135,7 @@ class Observer {
135
135
  this.app.send((0, messages_gen_js_1.RemoveNodeAttribute)(id, name));
136
136
  return;
137
137
  }
138
- if (name === 'style' || (name === 'href' && (0, guards_js_1.hasTag)(node, 'link'))) {
138
+ if (name === 'style' || (name === 'href' && (0, guards_js_1.hasTag)(node, 'LINK'))) {
139
139
  this.app.send((0, messages_gen_js_1.SetNodeAttributeURLBased)(id, name, value, this.app.getBaseHref()));
140
140
  return;
141
141
  }
@@ -145,7 +145,7 @@ class Observer {
145
145
  this.app.send((0, messages_gen_js_1.SetNodeAttribute)(id, name, value));
146
146
  }
147
147
  sendNodeData(id, parentElement, data) {
148
- if ((0, guards_js_1.hasTag)(parentElement, 'style')) {
148
+ if ((0, guards_js_1.hasTag)(parentElement, 'STYLE') || (0, guards_js_1.hasTag)(parentElement, 'style')) {
149
149
  this.app.send((0, messages_gen_js_1.SetCSSDataURLBased)(id, data, this.app.getBaseHref()));
150
150
  return;
151
151
  }
@@ -206,7 +206,7 @@ class Observer {
206
206
  // Disable parent check for the upper context HTMLHtmlElement, because it is root there... (before)
207
207
  // TODO: get rid of "special" cases (there is an issue with CreateDocument altered behaviour though)
208
208
  // TODO: Clean the logic (though now it workd fine)
209
- if (!(0, guards_js_1.hasTag)(node, 'html') || !this.isTopContext) {
209
+ if (!(0, guards_js_1.hasTag)(node, 'HTML') || !this.isTopContext) {
210
210
  if (parent === null) {
211
211
  // Sometimes one observation contains attribute mutations for the removimg node, which gets ignored here.
212
212
  // That shouldn't affect the visual rendering ( should it? maybe when transition applied? )
@@ -314,7 +314,7 @@ class Observer {
314
314
  });
315
315
  this.clear();
316
316
  }
317
- // ISSSUE (nodeToBinde should be the same as node in all cases. Look at the comment about 0-node at the beginning of the file.)
317
+ // ISSSUE (nodeToBinde should be the same as node. Look at the comment about 0-node at the beginning of the file.)
318
318
  // TODO: use one observer instance for all iframes/shadowRoots (composition instiad of inheritance)
319
319
  observeRoot(node, beforeCommit, nodeToBind = node) {
320
320
  this.observer.observe(node, {
@@ -4,8 +4,8 @@ import App from '../index.js';
4
4
  export interface Options {
5
5
  captureIFrames: boolean;
6
6
  }
7
- type Context = Window & typeof globalThis;
8
- type ContextCallback = (context: Context) => void;
7
+ declare type Context = Window & typeof globalThis;
8
+ declare type ContextCallback = (context: Context) => void;
9
9
  export default class TopObserver extends Observer {
10
10
  private readonly options;
11
11
  private readonly iframeOffsets;
@@ -22,7 +22,7 @@ class TopObserver extends observer_js_1.default {
22
22
  }, options);
23
23
  // IFrames
24
24
  this.app.nodes.attachNodeCallback((node) => {
25
- if ((0, guards_js_1.hasTag)(node, 'iframe') &&
25
+ if ((0, guards_js_1.hasTag)(node, 'IFRAME') &&
26
26
  ((this.options.captureIFrames && !(0, utils_js_1.hasOpenreplayAttribute)(node, 'obscured')) ||
27
27
  (0, utils_js_1.hasOpenreplayAttribute)(node, 'capture'))) {
28
28
  this.handleIframe(node);
@@ -6,8 +6,8 @@ interface SessionInfo {
6
6
  timestamp: number;
7
7
  projectID?: string;
8
8
  }
9
- type OnUpdateCallback = (i: Partial<SessionInfo>) => void;
10
- export type Options = {
9
+ declare type OnUpdateCallback = (i: Partial<SessionInfo>) => void;
10
+ export declare type Options = {
11
11
  session_token_key: string;
12
12
  session_pageno_key: string;
13
13
  };
@@ -1,5 +1,5 @@
1
1
  import App from './index.js';
2
- type Callback = () => void;
2
+ declare type Callback = () => void;
3
3
  export default class Ticker {
4
4
  private readonly app;
5
5
  private timer;
@@ -3,22 +3,22 @@ export interface Options {
3
3
  connAttemptCount?: number;
4
4
  connAttemptGap?: number;
5
5
  }
6
- type Start = {
6
+ declare type Start = {
7
7
  type: 'start';
8
8
  ingestPoint: string;
9
9
  pageNo: number;
10
10
  timestamp: number;
11
11
  url: string;
12
12
  } & Options;
13
- type Auth = {
13
+ declare type Auth = {
14
14
  type: 'auth';
15
15
  token: string;
16
16
  beaconSizeLimit?: number;
17
17
  };
18
- export type ToWorkerData = null | 'stop' | Start | Auth | Array<Message>;
19
- type Failure = {
18
+ export declare type ToWorkerData = null | 'stop' | Start | Auth | Array<Message>;
19
+ declare type Failure = {
20
20
  type: 'failure';
21
21
  reason: string;
22
22
  };
23
- export type FromWorkerData = 'restart' | Failure | 'not_init';
23
+ export declare type FromWorkerData = 'restart' | Failure;
24
24
  export {};