clarity-js 0.8.40 → 0.8.42

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 (113) hide show
  1. package/README.md +26 -26
  2. package/build/clarity.extended.js +1 -1
  3. package/build/clarity.insight.js +1 -1
  4. package/build/clarity.js +6027 -6027
  5. package/build/clarity.min.js +1 -1
  6. package/build/clarity.module.js +6027 -6027
  7. package/build/clarity.performance.js +1 -1
  8. package/package.json +70 -70
  9. package/rollup.config.ts +161 -161
  10. package/src/clarity.ts +65 -65
  11. package/src/core/api.ts +8 -8
  12. package/src/core/config.ts +29 -29
  13. package/src/core/copy.ts +3 -3
  14. package/src/core/event.ts +53 -53
  15. package/src/core/hash.ts +19 -19
  16. package/src/core/history.ts +71 -71
  17. package/src/core/index.ts +81 -81
  18. package/src/core/measure.ts +19 -19
  19. package/src/core/report.ts +28 -28
  20. package/src/core/scrub.ts +202 -202
  21. package/src/core/task.ts +181 -181
  22. package/src/core/throttle.ts +46 -46
  23. package/src/core/time.ts +26 -26
  24. package/src/core/timeout.ts +10 -10
  25. package/src/core/version.ts +2 -2
  26. package/src/data/baseline.ts +162 -162
  27. package/src/data/compress.ts +31 -31
  28. package/src/data/consent.ts +77 -77
  29. package/src/data/custom.ts +23 -23
  30. package/src/data/dimension.ts +53 -53
  31. package/src/data/encode.ts +155 -155
  32. package/src/data/envelope.ts +53 -53
  33. package/src/data/extract.ts +211 -211
  34. package/src/data/index.ts +50 -50
  35. package/src/data/limit.ts +44 -44
  36. package/src/data/metadata.ts +408 -408
  37. package/src/data/metric.ts +51 -51
  38. package/src/data/ping.ts +36 -36
  39. package/src/data/signal.ts +30 -30
  40. package/src/data/summary.ts +34 -34
  41. package/src/data/token.ts +39 -39
  42. package/src/data/upgrade.ts +44 -44
  43. package/src/data/upload.ts +333 -333
  44. package/src/data/variable.ts +83 -83
  45. package/src/diagnostic/encode.ts +40 -40
  46. package/src/diagnostic/fraud.ts +36 -36
  47. package/src/diagnostic/index.ts +13 -13
  48. package/src/diagnostic/internal.ts +28 -28
  49. package/src/diagnostic/script.ts +35 -35
  50. package/src/dynamic/agent/blank.ts +2 -2
  51. package/src/dynamic/agent/crisp.ts +40 -40
  52. package/src/dynamic/agent/encode.ts +25 -25
  53. package/src/dynamic/agent/index.ts +8 -8
  54. package/src/dynamic/agent/livechat.ts +58 -58
  55. package/src/dynamic/agent/tidio.ts +44 -44
  56. package/src/global.ts +6 -6
  57. package/src/index.ts +9 -9
  58. package/src/insight/blank.ts +14 -14
  59. package/src/insight/encode.ts +60 -60
  60. package/src/insight/snapshot.ts +114 -114
  61. package/src/interaction/change.ts +38 -38
  62. package/src/interaction/click.ts +173 -173
  63. package/src/interaction/clipboard.ts +32 -32
  64. package/src/interaction/encode.ts +210 -210
  65. package/src/interaction/index.ts +60 -60
  66. package/src/interaction/input.ts +57 -57
  67. package/src/interaction/pointer.ts +137 -137
  68. package/src/interaction/resize.ts +50 -50
  69. package/src/interaction/scroll.ts +129 -129
  70. package/src/interaction/selection.ts +66 -66
  71. package/src/interaction/submit.ts +30 -30
  72. package/src/interaction/timeline.ts +69 -69
  73. package/src/interaction/unload.ts +26 -26
  74. package/src/interaction/visibility.ts +27 -27
  75. package/src/layout/animation.ts +133 -133
  76. package/src/layout/custom.ts +42 -42
  77. package/src/layout/discover.ts +31 -31
  78. package/src/layout/document.ts +46 -46
  79. package/src/layout/dom.ts +439 -439
  80. package/src/layout/encode.ts +154 -154
  81. package/src/layout/index.ts +42 -42
  82. package/src/layout/mutation.ts +411 -411
  83. package/src/layout/node.ts +294 -294
  84. package/src/layout/offset.ts +19 -19
  85. package/src/layout/region.ts +151 -151
  86. package/src/layout/schema.ts +63 -63
  87. package/src/layout/selector.ts +82 -82
  88. package/src/layout/style.ts +159 -159
  89. package/src/layout/target.ts +32 -32
  90. package/src/layout/traverse.ts +27 -27
  91. package/src/performance/blank.ts +9 -9
  92. package/src/performance/encode.ts +31 -31
  93. package/src/performance/index.ts +12 -12
  94. package/src/performance/interaction.ts +125 -125
  95. package/src/performance/navigation.ts +31 -31
  96. package/src/performance/observer.ts +112 -112
  97. package/src/queue.ts +33 -33
  98. package/test/core.test.ts +139 -139
  99. package/test/helper.ts +162 -162
  100. package/test/html/core.html +27 -27
  101. package/test/stub.test.ts +7 -7
  102. package/test/tsconfig.test.json +5 -5
  103. package/tsconfig.json +21 -21
  104. package/tslint.json +32 -32
  105. package/types/agent.d.ts +39 -39
  106. package/types/core.d.ts +150 -150
  107. package/types/data.d.ts +571 -571
  108. package/types/diagnostic.d.ts +24 -24
  109. package/types/global.d.ts +30 -30
  110. package/types/index.d.ts +40 -40
  111. package/types/interaction.d.ts +177 -177
  112. package/types/layout.d.ts +276 -276
  113. package/types/performance.d.ts +31 -31
package/types/layout.d.ts CHANGED
@@ -1,277 +1,277 @@
1
- import { Privacy } from "@clarity-types/core";
2
-
3
- /* Enum */
4
-
5
- export const enum AnimationOperation {
6
- Create = 0,
7
- Play = 1,
8
- Pause = 2,
9
- Cancel = 3,
10
- Finish = 4,
11
- CommitStyles = 5
12
- }
13
-
14
- export const enum Source {
15
- Discover,
16
- ChildListAdd,
17
- ChildListRemove,
18
- Attributes,
19
- CharacterData
20
- }
21
-
22
- export const enum Selector {
23
- Alpha = 0,
24
- Beta = 1,
25
- Default = 1
26
- }
27
-
28
- export const enum InteractionState {
29
- None = 16,
30
- Clicked = 20,
31
- Input = 30
32
- }
33
-
34
- export interface AnimationState {
35
- time: number;
36
- event: number;
37
- data: AnimationData;
38
- }
39
-
40
- export interface AnimationData {
41
- id: string;
42
- operation: AnimationOperation;
43
- keyFrames?: string;
44
- timing?: string;
45
- timeline?: string;
46
- targetId?: number;
47
- }
48
-
49
- export interface CustomElementData {
50
- name: string;
51
- }
52
-
53
- export const enum RegionVisibility {
54
- Rendered = 0,
55
- Visible = 10,
56
- ScrolledToEnd = 13
57
- }
58
-
59
- export const enum Mask {
60
- Text = "address,password,contact",
61
- Disable = "radio,checkbox,range,button,reset,submit",
62
- Exclude = "password,secret,pass,social,ssn,code,hidden",
63
- Tags = "INPUT,SELECT,TEXTAREA"
64
- }
65
-
66
- export const enum Constant {
67
- Empty = "",
68
- SvgPrefix = "svg:",
69
- DataPrefix = "data:",
70
- IFramePrefix = "iframe:",
71
- SvgNamespace = "http://www.w3.org/2000/svg",
72
- Id = "id",
73
- Class = "class",
74
- Style = "style",
75
- Href = "href",
76
- Src = "src",
77
- Srcset = "srcset",
78
- Hash = "#",
79
- Dot = ".",
80
- Separator = ">",
81
- Tilde = "~",
82
- Bang = "!",
83
- Period = ".",
84
- Comma = ",",
85
- DataAttribute = "data-",
86
- MaskData = "data-clarity-mask",
87
- UnmaskData = "data-clarity-unmask",
88
- RegionData = "data-clarity-region",
89
- Type = "type",
90
- Submit = "submit",
91
- Name = "name",
92
- Base = "*B",
93
- SameOrigin = "*O",
94
- Object = "object",
95
- Function = "function",
96
- StyleTag = "STYLE",
97
- InputTag = "INPUT",
98
- IFrameTag = "IFRAME",
99
- ImageTag = "IMG",
100
- TitleTag = "TITLE",
101
- BodyTag = "BODY",
102
- SvgTag = "svg:svg",
103
- BaseTag = "BASE",
104
- NativeCode = "[native code]",
105
- DocumentTag = "*D",
106
- ShadowDomTag = "*S",
107
- PolyfillShadowDomTag = "*P",
108
- TextTag = "*T",
109
- SuspendMutationTag = "*M",
110
- ChildList = "childList",
111
- Attributes = "attributes",
112
- CharacterData = "characterData",
113
- Throttle = "throttle",
114
- LoadEvent = "load",
115
- Pixel = "px",
116
- BorderBox = "border-box",
117
- Value = "value",
118
- MutationObserver = "MutationObserver",
119
- JsonLD = "application/ld+json",
120
- String = "string",
121
- Number = "number",
122
- Disable = "disable",
123
- HTML = "HTML",
124
- Property = "property",
125
- Content = "content",
126
- Generator = "generator",
127
- ogType = "og:type",
128
- ogTitle = "og:title",
129
- SvgStyle = "svg:style",
130
- ExcludeClassNames = "load,active,fixed,visible,focus,show,collaps,animat",
131
- StyleSheet = "stylesheet"
132
- }
133
-
134
- export const enum JsonLD {
135
- Type = "@type",
136
- Recipe = "recipe",
137
- Product = "product",
138
- AggregateRating = "aggregaterating",
139
- Author = "person",
140
- Offer = "offer",
141
- Brand = "brand",
142
- RatingValue = "ratingValue",
143
- BestRating = "bestRating",
144
- WorstRating = "worstRating",
145
- RatingCount = "ratingCount",
146
- ReviewCount = "reviewCount",
147
- Availability = "availability",
148
- Price = "price",
149
- PriceCurrency = "priceCurrency",
150
- ItemCondition = "itemCondition",
151
- Category = "category",
152
- Sku = "sku",
153
- Name = "name",
154
- Article = "article",
155
- Posting = "posting",
156
- Headline = "headline",
157
- Creator = "creator"
158
- }
159
-
160
- export const enum Setting {
161
- LookAhead = 33, // 33ms
162
- MutationSuspendThreshold = 10, // Stop listening for mutations after hitting a threshold count
163
- MutationActivePeriod = 3000, // Unit: milliseconds. Let mutations continue as normal during active periods of user interactions
164
- MaxMutationHistoryCount = 10000,
165
- MaxMutationHistoryTime = 30000, // Unit: milliseconds. Maximum time to keep mutation history in memory
166
- }
167
-
168
- export const enum StyleSheetOperation {
169
- Create = 0,
170
- Replace = 1,
171
- ReplaceSync = 2,
172
- SetAdoptedStyles = 3
173
- }
174
-
175
- /* Helper Interfaces */
176
- export interface Box {
177
- x: number; // Left
178
- y: number; // Top
179
- w: number; // Width
180
- h: number; // Height
181
- }
182
-
183
- export interface Attributes {
184
- [key: string]: string;
185
- }
186
-
187
- export interface SelectorInput {
188
- id: number;
189
- tag: string;
190
- prefix: [string, string];
191
- position: number;
192
- attributes: Attributes;
193
- }
194
-
195
- export interface NodeInfo {
196
- tag: string;
197
- attributes?: Attributes;
198
- value?: string;
199
- }
200
-
201
- export interface NodeValue {
202
- id: number;
203
- parent: number;
204
- previous: number;
205
- children: number[];
206
- data: NodeInfo;
207
- selector: [string, string];
208
- hash: [string, string];
209
- region: number;
210
- metadata: NodeMeta;
211
- }
212
-
213
- export interface NodeMeta {
214
- active: boolean;
215
- suspend: boolean;
216
- privacy: Privacy;
217
- position: number;
218
- fraud: number;
219
- size: number[];
220
- }
221
-
222
- export interface MutationQueue {
223
- time: number;
224
- mutations: MutationRecord[];
225
- }
226
-
227
- export interface MutationRecordWithTime {
228
- timestamp: number;
229
- mutation: MutationRecord;
230
- }
231
-
232
- export interface MutationHistory {
233
- [key: string]: [/* Count */ number, /* Instance */ number, /* Remove Nodes Buffer */ NodeList?];
234
- }
235
-
236
- export interface RegionQueue {
237
- node: Node;
238
- state: RegionState;
239
- }
240
-
241
- export interface RegionState {
242
- time: number;
243
- data: RegionData;
244
- }
245
-
246
- export interface StyleSheetState {
247
- time: number;
248
- event: number,
249
- data: StyleSheetData
250
- }
251
-
252
- /* Event Data */
253
-
254
- export interface DocumentData {
255
- width: number;
256
- height: number;
257
- }
258
-
259
- export interface RegionData {
260
- id: number;
261
- visibility: RegionVisibility;
262
- interaction: InteractionState;
263
- name: string;
264
- }
265
-
266
- export interface TargetMetadata {
267
- id: number;
268
- hash: [string, string];
269
- privacy: Privacy;
270
- }
271
-
272
- export interface StyleSheetData {
273
- id: number | string;
274
- operation: StyleSheetOperation;
275
- cssRules?: string;
276
- newIds?: string[]
1
+ import { Privacy } from "@clarity-types/core";
2
+
3
+ /* Enum */
4
+
5
+ export const enum AnimationOperation {
6
+ Create = 0,
7
+ Play = 1,
8
+ Pause = 2,
9
+ Cancel = 3,
10
+ Finish = 4,
11
+ CommitStyles = 5
12
+ }
13
+
14
+ export const enum Source {
15
+ Discover,
16
+ ChildListAdd,
17
+ ChildListRemove,
18
+ Attributes,
19
+ CharacterData
20
+ }
21
+
22
+ export const enum Selector {
23
+ Alpha = 0,
24
+ Beta = 1,
25
+ Default = 1
26
+ }
27
+
28
+ export const enum InteractionState {
29
+ None = 16,
30
+ Clicked = 20,
31
+ Input = 30
32
+ }
33
+
34
+ export interface AnimationState {
35
+ time: number;
36
+ event: number;
37
+ data: AnimationData;
38
+ }
39
+
40
+ export interface AnimationData {
41
+ id: string;
42
+ operation: AnimationOperation;
43
+ keyFrames?: string;
44
+ timing?: string;
45
+ timeline?: string;
46
+ targetId?: number;
47
+ }
48
+
49
+ export interface CustomElementData {
50
+ name: string;
51
+ }
52
+
53
+ export const enum RegionVisibility {
54
+ Rendered = 0,
55
+ Visible = 10,
56
+ ScrolledToEnd = 13
57
+ }
58
+
59
+ export const enum Mask {
60
+ Text = "address,password,contact",
61
+ Disable = "radio,checkbox,range,button,reset,submit",
62
+ Exclude = "password,secret,pass,social,ssn,code,hidden",
63
+ Tags = "INPUT,SELECT,TEXTAREA"
64
+ }
65
+
66
+ export const enum Constant {
67
+ Empty = "",
68
+ SvgPrefix = "svg:",
69
+ DataPrefix = "data:",
70
+ IFramePrefix = "iframe:",
71
+ SvgNamespace = "http://www.w3.org/2000/svg",
72
+ Id = "id",
73
+ Class = "class",
74
+ Style = "style",
75
+ Href = "href",
76
+ Src = "src",
77
+ Srcset = "srcset",
78
+ Hash = "#",
79
+ Dot = ".",
80
+ Separator = ">",
81
+ Tilde = "~",
82
+ Bang = "!",
83
+ Period = ".",
84
+ Comma = ",",
85
+ DataAttribute = "data-",
86
+ MaskData = "data-clarity-mask",
87
+ UnmaskData = "data-clarity-unmask",
88
+ RegionData = "data-clarity-region",
89
+ Type = "type",
90
+ Submit = "submit",
91
+ Name = "name",
92
+ Base = "*B",
93
+ SameOrigin = "*O",
94
+ Object = "object",
95
+ Function = "function",
96
+ StyleTag = "STYLE",
97
+ InputTag = "INPUT",
98
+ IFrameTag = "IFRAME",
99
+ ImageTag = "IMG",
100
+ TitleTag = "TITLE",
101
+ BodyTag = "BODY",
102
+ SvgTag = "svg:svg",
103
+ BaseTag = "BASE",
104
+ NativeCode = "[native code]",
105
+ DocumentTag = "*D",
106
+ ShadowDomTag = "*S",
107
+ PolyfillShadowDomTag = "*P",
108
+ TextTag = "*T",
109
+ SuspendMutationTag = "*M",
110
+ ChildList = "childList",
111
+ Attributes = "attributes",
112
+ CharacterData = "characterData",
113
+ Throttle = "throttle",
114
+ LoadEvent = "load",
115
+ Pixel = "px",
116
+ BorderBox = "border-box",
117
+ Value = "value",
118
+ MutationObserver = "MutationObserver",
119
+ JsonLD = "application/ld+json",
120
+ String = "string",
121
+ Number = "number",
122
+ Disable = "disable",
123
+ HTML = "HTML",
124
+ Property = "property",
125
+ Content = "content",
126
+ Generator = "generator",
127
+ ogType = "og:type",
128
+ ogTitle = "og:title",
129
+ SvgStyle = "svg:style",
130
+ ExcludeClassNames = "load,active,fixed,visible,focus,show,collaps,animat",
131
+ StyleSheet = "stylesheet"
132
+ }
133
+
134
+ export const enum JsonLD {
135
+ Type = "@type",
136
+ Recipe = "recipe",
137
+ Product = "product",
138
+ AggregateRating = "aggregaterating",
139
+ Author = "person",
140
+ Offer = "offer",
141
+ Brand = "brand",
142
+ RatingValue = "ratingValue",
143
+ BestRating = "bestRating",
144
+ WorstRating = "worstRating",
145
+ RatingCount = "ratingCount",
146
+ ReviewCount = "reviewCount",
147
+ Availability = "availability",
148
+ Price = "price",
149
+ PriceCurrency = "priceCurrency",
150
+ ItemCondition = "itemCondition",
151
+ Category = "category",
152
+ Sku = "sku",
153
+ Name = "name",
154
+ Article = "article",
155
+ Posting = "posting",
156
+ Headline = "headline",
157
+ Creator = "creator"
158
+ }
159
+
160
+ export const enum Setting {
161
+ LookAhead = 33, // 33ms
162
+ MutationSuspendThreshold = 10, // Stop listening for mutations after hitting a threshold count
163
+ MutationActivePeriod = 3000, // Unit: milliseconds. Let mutations continue as normal during active periods of user interactions
164
+ MaxMutationHistoryCount = 10000,
165
+ MaxMutationHistoryTime = 30000, // Unit: milliseconds. Maximum time to keep mutation history in memory
166
+ }
167
+
168
+ export const enum StyleSheetOperation {
169
+ Create = 0,
170
+ Replace = 1,
171
+ ReplaceSync = 2,
172
+ SetAdoptedStyles = 3
173
+ }
174
+
175
+ /* Helper Interfaces */
176
+ export interface Box {
177
+ x: number; // Left
178
+ y: number; // Top
179
+ w: number; // Width
180
+ h: number; // Height
181
+ }
182
+
183
+ export interface Attributes {
184
+ [key: string]: string;
185
+ }
186
+
187
+ export interface SelectorInput {
188
+ id: number;
189
+ tag: string;
190
+ prefix: [string, string];
191
+ position: number;
192
+ attributes: Attributes;
193
+ }
194
+
195
+ export interface NodeInfo {
196
+ tag: string;
197
+ attributes?: Attributes;
198
+ value?: string;
199
+ }
200
+
201
+ export interface NodeValue {
202
+ id: number;
203
+ parent: number;
204
+ previous: number;
205
+ children: number[];
206
+ data: NodeInfo;
207
+ selector: [string, string];
208
+ hash: [string, string];
209
+ region: number;
210
+ metadata: NodeMeta;
211
+ }
212
+
213
+ export interface NodeMeta {
214
+ active: boolean;
215
+ suspend: boolean;
216
+ privacy: Privacy;
217
+ position: number;
218
+ fraud: number;
219
+ size: number[];
220
+ }
221
+
222
+ export interface MutationQueue {
223
+ time: number;
224
+ mutations: MutationRecord[];
225
+ }
226
+
227
+ export interface MutationRecordWithTime {
228
+ timestamp: number;
229
+ mutation: MutationRecord;
230
+ }
231
+
232
+ export interface MutationHistory {
233
+ [key: string]: [/* Count */ number, /* Instance */ number, /* Remove Nodes Buffer */ NodeList?];
234
+ }
235
+
236
+ export interface RegionQueue {
237
+ node: Node;
238
+ state: RegionState;
239
+ }
240
+
241
+ export interface RegionState {
242
+ time: number;
243
+ data: RegionData;
244
+ }
245
+
246
+ export interface StyleSheetState {
247
+ time: number;
248
+ event: number,
249
+ data: StyleSheetData
250
+ }
251
+
252
+ /* Event Data */
253
+
254
+ export interface DocumentData {
255
+ width: number;
256
+ height: number;
257
+ }
258
+
259
+ export interface RegionData {
260
+ id: number;
261
+ visibility: RegionVisibility;
262
+ interaction: InteractionState;
263
+ name: string;
264
+ }
265
+
266
+ export interface TargetMetadata {
267
+ id: number;
268
+ hash: [string, string];
269
+ privacy: Privacy;
270
+ }
271
+
272
+ export interface StyleSheetData {
273
+ id: number | string;
274
+ operation: StyleSheetOperation;
275
+ cssRules?: string;
276
+ newIds?: string[]
277
277
  }
@@ -1,31 +1,31 @@
1
- /* Helper Interface */
2
-
3
-
4
- // Reference: https://wicg.github.io/netinfo/#networkinformation-interface
5
- export interface NavigatorConnection extends EventTarget {
6
- effectiveType: string;
7
- downlinkMax: number;
8
- downlink: number;
9
- rtt: number;
10
- saveData: boolean;
11
- }
12
-
13
- /* Event Data */
14
- export interface NavigationData {
15
- fetchStart: number;
16
- connectStart: number;
17
- connectEnd: number;
18
- requestStart: number;
19
- responseStart: number;
20
- responseEnd: number;
21
- domInteractive: number;
22
- domComplete: number;
23
- loadEventStart: number;
24
- loadEventEnd: number;
25
- redirectCount: number;
26
- size: number;
27
- type: string;
28
- protocol: string;
29
- encodedSize: number;
30
- decodedSize: number;
31
- }
1
+ /* Helper Interface */
2
+
3
+
4
+ // Reference: https://wicg.github.io/netinfo/#networkinformation-interface
5
+ export interface NavigatorConnection extends EventTarget {
6
+ effectiveType: string;
7
+ downlinkMax: number;
8
+ downlink: number;
9
+ rtt: number;
10
+ saveData: boolean;
11
+ }
12
+
13
+ /* Event Data */
14
+ export interface NavigationData {
15
+ fetchStart: number;
16
+ connectStart: number;
17
+ connectEnd: number;
18
+ requestStart: number;
19
+ responseStart: number;
20
+ responseEnd: number;
21
+ domInteractive: number;
22
+ domComplete: number;
23
+ loadEventStart: number;
24
+ loadEventEnd: number;
25
+ redirectCount: number;
26
+ size: number;
27
+ type: string;
28
+ protocol: string;
29
+ encodedSize: number;
30
+ decodedSize: number;
31
+ }