@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,181 @@
1
+ // Auto-generated, do not edit
2
+ export function BatchMetadata(version, pageNo, firstIndex, timestamp, location) {
3
+ return [81 /* BatchMetadata */, version, pageNo, firstIndex, timestamp, location];
4
+ }
5
+ export function PartitionedMessage(partNo, partTotal) {
6
+ return [82 /* PartitionedMessage */, partNo, partTotal];
7
+ }
8
+ export function Timestamp(timestamp) {
9
+ return [0 /* Timestamp */, timestamp];
10
+ }
11
+ export function SetPageLocation(url, referrer, navigationStart) {
12
+ return [4 /* SetPageLocation */, url, referrer, navigationStart];
13
+ }
14
+ export function SetViewportSize(width, height) {
15
+ return [5 /* SetViewportSize */, width, height];
16
+ }
17
+ export function SetViewportScroll(x, y) {
18
+ return [6 /* SetViewportScroll */, x, y];
19
+ }
20
+ export function CreateDocument() {
21
+ return [7 /* CreateDocument */];
22
+ }
23
+ export function CreateElementNode(id, parentID, index, tag, svg) {
24
+ return [8 /* CreateElementNode */, id, parentID, index, tag, svg];
25
+ }
26
+ export function CreateTextNode(id, parentID, index) {
27
+ return [9 /* CreateTextNode */, id, parentID, index];
28
+ }
29
+ export function MoveNode(id, parentID, index) {
30
+ return [10 /* MoveNode */, id, parentID, index];
31
+ }
32
+ export function RemoveNode(id) {
33
+ return [11 /* RemoveNode */, id];
34
+ }
35
+ export function SetNodeAttribute(id, name, value) {
36
+ return [12 /* SetNodeAttribute */, id, name, value];
37
+ }
38
+ export function RemoveNodeAttribute(id, name) {
39
+ return [13 /* RemoveNodeAttribute */, id, name];
40
+ }
41
+ export function SetNodeData(id, data) {
42
+ return [14 /* SetNodeData */, id, data];
43
+ }
44
+ export function SetNodeScroll(id, x, y) {
45
+ return [16 /* SetNodeScroll */, id, x, y];
46
+ }
47
+ export function SetInputTarget(id, label) {
48
+ return [17 /* SetInputTarget */, id, label];
49
+ }
50
+ export function SetInputValue(id, value, mask) {
51
+ return [18 /* SetInputValue */, id, value, mask];
52
+ }
53
+ export function SetInputChecked(id, checked) {
54
+ return [19 /* SetInputChecked */, id, checked];
55
+ }
56
+ export function MouseMove(x, y) {
57
+ return [20 /* MouseMove */, x, y];
58
+ }
59
+ export function ConsoleLog(level, value) {
60
+ return [22 /* ConsoleLog */, level, value];
61
+ }
62
+ export function PageLoadTiming(requestStart, responseStart, responseEnd, domContentLoadedEventStart, domContentLoadedEventEnd, loadEventStart, loadEventEnd, firstPaint, firstContentfulPaint) {
63
+ return [
64
+ 23 /* PageLoadTiming */,
65
+ requestStart,
66
+ responseStart,
67
+ responseEnd,
68
+ domContentLoadedEventStart,
69
+ domContentLoadedEventEnd,
70
+ loadEventStart,
71
+ loadEventEnd,
72
+ firstPaint,
73
+ firstContentfulPaint,
74
+ ];
75
+ }
76
+ export function PageRenderTiming(speedIndex, visuallyComplete, timeToInteractive) {
77
+ return [24 /* PageRenderTiming */, speedIndex, visuallyComplete, timeToInteractive];
78
+ }
79
+ export function JSException(name, message, payload, metadata) {
80
+ return [78 /* JSException */, name, message, payload, metadata];
81
+ }
82
+ export function RawCustomEvent(name, payload) {
83
+ return [27 /* RawCustomEvent */, name, payload];
84
+ }
85
+ export function UserID(id) {
86
+ return [28 /* UserID */, id];
87
+ }
88
+ export function UserAnonymousID(id) {
89
+ return [29 /* UserAnonymousID */, id];
90
+ }
91
+ export function Metadata(key, value) {
92
+ return [30 /* Metadata */, key, value];
93
+ }
94
+ export function CSSInsertRule(id, rule, index) {
95
+ return [37 /* CSSInsertRule */, id, rule, index];
96
+ }
97
+ export function CSSDeleteRule(id, index) {
98
+ return [38 /* CSSDeleteRule */, id, index];
99
+ }
100
+ export function Fetch(method, url, request, response, status, timestamp, duration) {
101
+ return [39 /* Fetch */, method, url, request, response, status, timestamp, duration];
102
+ }
103
+ export function Profiler(name, duration, args, result) {
104
+ return [40 /* Profiler */, name, duration, args, result];
105
+ }
106
+ export function OTable(key, value) {
107
+ return [41 /* OTable */, key, value];
108
+ }
109
+ export function StateAction(type) {
110
+ return [42 /* StateAction */, type];
111
+ }
112
+ export function Redux(action, state, duration) {
113
+ return [44 /* Redux */, action, state, duration];
114
+ }
115
+ export function Vuex(mutation, state) {
116
+ return [45 /* Vuex */, mutation, state];
117
+ }
118
+ export function MobX(type, payload) {
119
+ return [46 /* MobX */, type, payload];
120
+ }
121
+ export function NgRx(action, state, duration) {
122
+ return [47 /* NgRx */, action, state, duration];
123
+ }
124
+ export function GraphQL(operationKind, operationName, variables, response) {
125
+ return [48 /* GraphQL */, operationKind, operationName, variables, response];
126
+ }
127
+ export function PerformanceTrack(frames, ticks, totalJSHeapSize, usedJSHeapSize) {
128
+ return [49 /* PerformanceTrack */, frames, ticks, totalJSHeapSize, usedJSHeapSize];
129
+ }
130
+ export function ResourceTiming(timestamp, duration, ttfb, headerSize, encodedBodySize, decodedBodySize, url, initiator) {
131
+ return [
132
+ 53 /* ResourceTiming */,
133
+ timestamp,
134
+ duration,
135
+ ttfb,
136
+ headerSize,
137
+ encodedBodySize,
138
+ decodedBodySize,
139
+ url,
140
+ initiator,
141
+ ];
142
+ }
143
+ export function ConnectionInformation(downlink, type) {
144
+ return [54 /* ConnectionInformation */, downlink, type];
145
+ }
146
+ export function SetPageVisibility(hidden) {
147
+ return [55 /* SetPageVisibility */, hidden];
148
+ }
149
+ export function LongTask(timestamp, duration, context, containerType, containerSrc, containerId, containerName) {
150
+ return [
151
+ 59 /* LongTask */,
152
+ timestamp,
153
+ duration,
154
+ context,
155
+ containerType,
156
+ containerSrc,
157
+ containerId,
158
+ containerName,
159
+ ];
160
+ }
161
+ export function SetNodeAttributeURLBased(id, name, value, baseURL) {
162
+ return [60 /* SetNodeAttributeURLBased */, id, name, value, baseURL];
163
+ }
164
+ export function SetCSSDataURLBased(id, data, baseURL) {
165
+ return [61 /* SetCSSDataURLBased */, id, data, baseURL];
166
+ }
167
+ export function TechnicalInfo(type, value) {
168
+ return [63 /* TechnicalInfo */, type, value];
169
+ }
170
+ export function CustomIssue(name, payload) {
171
+ return [64 /* CustomIssue */, name, payload];
172
+ }
173
+ export function CSSInsertRuleURLBased(id, rule, index, baseURL) {
174
+ return [67 /* CSSInsertRuleURLBased */, id, rule, index, baseURL];
175
+ }
176
+ export function MouseClick(id, hesitationTime, label, selector) {
177
+ return [69 /* MouseClick */, id, hesitationTime, label, selector];
178
+ }
179
+ export function CreateIFrameDocument(frameID, id) {
180
+ return [70 /* CreateIFrameDocument */, frameID, id];
181
+ }
@@ -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;
@@ -123,7 +123,7 @@ export default class Observer {
123
123
  return;
124
124
  }
125
125
  if (name === 'value' &&
126
- hasTag(node, 'input') &&
126
+ hasTag(node, 'INPUT') &&
127
127
  node.type !== 'button' &&
128
128
  node.type !== 'reset' &&
129
129
  node.type !== 'submit') {
@@ -133,7 +133,7 @@ export default class Observer {
133
133
  this.app.send(RemoveNodeAttribute(id, name));
134
134
  return;
135
135
  }
136
- if (name === 'style' || (name === 'href' && hasTag(node, 'link'))) {
136
+ if (name === 'style' || (name === 'href' && hasTag(node, 'LINK'))) {
137
137
  this.app.send(SetNodeAttributeURLBased(id, name, value, this.app.getBaseHref()));
138
138
  return;
139
139
  }
@@ -143,7 +143,7 @@ export default class Observer {
143
143
  this.app.send(SetNodeAttribute(id, name, value));
144
144
  }
145
145
  sendNodeData(id, parentElement, data) {
146
- if (hasTag(parentElement, 'style')) {
146
+ if (hasTag(parentElement, 'STYLE') || hasTag(parentElement, 'style')) {
147
147
  this.app.send(SetCSSDataURLBased(id, data, this.app.getBaseHref()));
148
148
  return;
149
149
  }
@@ -204,7 +204,7 @@ export default class Observer {
204
204
  // Disable parent check for the upper context HTMLHtmlElement, because it is root there... (before)
205
205
  // TODO: get rid of "special" cases (there is an issue with CreateDocument altered behaviour though)
206
206
  // TODO: Clean the logic (though now it workd fine)
207
- if (!hasTag(node, 'html') || !this.isTopContext) {
207
+ if (!hasTag(node, 'HTML') || !this.isTopContext) {
208
208
  if (parent === null) {
209
209
  // Sometimes one observation contains attribute mutations for the removimg node, which gets ignored here.
210
210
  // That shouldn't affect the visual rendering ( should it? maybe when transition applied? )
@@ -312,7 +312,7 @@ export default class Observer {
312
312
  });
313
313
  this.clear();
314
314
  }
315
- // ISSSUE (nodeToBinde should be the same as node in all cases. Look at the comment about 0-node at the beginning of the file.)
315
+ // ISSSUE (nodeToBinde should be the same as node. Look at the comment about 0-node at the beginning of the file.)
316
316
  // TODO: use one observer instance for all iframes/shadowRoots (composition instiad of inheritance)
317
317
  observeRoot(node, beforeCommit, nodeToBind = node) {
318
318
  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;
@@ -20,7 +20,7 @@ export default class TopObserver extends Observer {
20
20
  }, options);
21
21
  // IFrames
22
22
  this.app.nodes.attachNodeCallback((node) => {
23
- if (hasTag(node, 'iframe') &&
23
+ if (hasTag(node, 'IFRAME') &&
24
24
  ((this.options.captureIFrames && !hasOpenreplayAttribute(node, 'obscured')) ||
25
25
  hasOpenreplayAttribute(node, 'capture'))) {
26
26
  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 {};