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.
- package/README.md +26 -26
- package/build/clarity.extended.js +1 -1
- package/build/clarity.insight.js +1 -1
- package/build/clarity.js +6027 -6027
- package/build/clarity.min.js +1 -1
- package/build/clarity.module.js +6027 -6027
- package/build/clarity.performance.js +1 -1
- package/package.json +70 -70
- package/rollup.config.ts +161 -161
- package/src/clarity.ts +65 -65
- package/src/core/api.ts +8 -8
- package/src/core/config.ts +29 -29
- package/src/core/copy.ts +3 -3
- package/src/core/event.ts +53 -53
- package/src/core/hash.ts +19 -19
- package/src/core/history.ts +71 -71
- package/src/core/index.ts +81 -81
- package/src/core/measure.ts +19 -19
- package/src/core/report.ts +28 -28
- package/src/core/scrub.ts +202 -202
- package/src/core/task.ts +181 -181
- package/src/core/throttle.ts +46 -46
- package/src/core/time.ts +26 -26
- package/src/core/timeout.ts +10 -10
- package/src/core/version.ts +2 -2
- package/src/data/baseline.ts +162 -162
- package/src/data/compress.ts +31 -31
- package/src/data/consent.ts +77 -77
- package/src/data/custom.ts +23 -23
- package/src/data/dimension.ts +53 -53
- package/src/data/encode.ts +155 -155
- package/src/data/envelope.ts +53 -53
- package/src/data/extract.ts +211 -211
- package/src/data/index.ts +50 -50
- package/src/data/limit.ts +44 -44
- package/src/data/metadata.ts +408 -408
- package/src/data/metric.ts +51 -51
- package/src/data/ping.ts +36 -36
- package/src/data/signal.ts +30 -30
- package/src/data/summary.ts +34 -34
- package/src/data/token.ts +39 -39
- package/src/data/upgrade.ts +44 -44
- package/src/data/upload.ts +333 -333
- package/src/data/variable.ts +83 -83
- package/src/diagnostic/encode.ts +40 -40
- package/src/diagnostic/fraud.ts +36 -36
- package/src/diagnostic/index.ts +13 -13
- package/src/diagnostic/internal.ts +28 -28
- package/src/diagnostic/script.ts +35 -35
- package/src/dynamic/agent/blank.ts +2 -2
- package/src/dynamic/agent/crisp.ts +40 -40
- package/src/dynamic/agent/encode.ts +25 -25
- package/src/dynamic/agent/index.ts +8 -8
- package/src/dynamic/agent/livechat.ts +58 -58
- package/src/dynamic/agent/tidio.ts +44 -44
- package/src/global.ts +6 -6
- package/src/index.ts +9 -9
- package/src/insight/blank.ts +14 -14
- package/src/insight/encode.ts +60 -60
- package/src/insight/snapshot.ts +114 -114
- package/src/interaction/change.ts +38 -38
- package/src/interaction/click.ts +173 -173
- package/src/interaction/clipboard.ts +32 -32
- package/src/interaction/encode.ts +210 -210
- package/src/interaction/index.ts +60 -60
- package/src/interaction/input.ts +57 -57
- package/src/interaction/pointer.ts +137 -137
- package/src/interaction/resize.ts +50 -50
- package/src/interaction/scroll.ts +129 -129
- package/src/interaction/selection.ts +66 -66
- package/src/interaction/submit.ts +30 -30
- package/src/interaction/timeline.ts +69 -69
- package/src/interaction/unload.ts +26 -26
- package/src/interaction/visibility.ts +27 -27
- package/src/layout/animation.ts +133 -133
- package/src/layout/custom.ts +42 -42
- package/src/layout/discover.ts +31 -31
- package/src/layout/document.ts +46 -46
- package/src/layout/dom.ts +439 -439
- package/src/layout/encode.ts +154 -154
- package/src/layout/index.ts +42 -42
- package/src/layout/mutation.ts +411 -411
- package/src/layout/node.ts +294 -294
- package/src/layout/offset.ts +19 -19
- package/src/layout/region.ts +151 -151
- package/src/layout/schema.ts +63 -63
- package/src/layout/selector.ts +82 -82
- package/src/layout/style.ts +159 -159
- package/src/layout/target.ts +32 -32
- package/src/layout/traverse.ts +27 -27
- package/src/performance/blank.ts +9 -9
- package/src/performance/encode.ts +31 -31
- package/src/performance/index.ts +12 -12
- package/src/performance/interaction.ts +125 -125
- package/src/performance/navigation.ts +31 -31
- package/src/performance/observer.ts +112 -112
- package/src/queue.ts +33 -33
- package/test/core.test.ts +139 -139
- package/test/helper.ts +162 -162
- package/test/html/core.html +27 -27
- package/test/stub.test.ts +7 -7
- package/test/tsconfig.test.json +5 -5
- package/tsconfig.json +21 -21
- package/tslint.json +32 -32
- package/types/agent.d.ts +39 -39
- package/types/core.d.ts +150 -150
- package/types/data.d.ts +571 -571
- package/types/diagnostic.d.ts +24 -24
- package/types/global.d.ts +30 -30
- package/types/index.d.ts +40 -40
- package/types/interaction.d.ts +177 -177
- package/types/layout.d.ts +276 -276
- package/types/performance.d.ts +31 -31
package/types/data.d.ts
CHANGED
|
@@ -1,571 +1,571 @@
|
|
|
1
|
-
import { Time } from "@clarity-types/core";
|
|
2
|
-
export type Target = (number | Node);
|
|
3
|
-
export type Token = (string | number | number[] | string[] | (string | number)[]);
|
|
4
|
-
export type DecodedToken = (any | any[]);
|
|
5
|
-
|
|
6
|
-
export type MetadataCallback = (data: Metadata, playback: boolean, consentStatus?: ConsentState) => void;
|
|
7
|
-
export interface MetadataCallbackOptions {
|
|
8
|
-
callback: MetadataCallback,
|
|
9
|
-
wait: boolean,
|
|
10
|
-
recall: boolean,
|
|
11
|
-
called: boolean,
|
|
12
|
-
consentInfo: boolean
|
|
13
|
-
}
|
|
14
|
-
export type SignalCallback = (data: ClaritySignal) => void
|
|
15
|
-
|
|
16
|
-
/* Enum */
|
|
17
|
-
export const enum Event {
|
|
18
|
-
/* Data */
|
|
19
|
-
Metric = 0,
|
|
20
|
-
Dimension = 1,
|
|
21
|
-
Upload = 2,
|
|
22
|
-
Upgrade = 3,
|
|
23
|
-
Baseline = 4,
|
|
24
|
-
Discover = 5,
|
|
25
|
-
Mutation = 6,
|
|
26
|
-
Region = 7,
|
|
27
|
-
Document = 8,
|
|
28
|
-
Click = 9,
|
|
29
|
-
Scroll = 10,
|
|
30
|
-
Resize = 11,
|
|
31
|
-
MouseMove = 12,
|
|
32
|
-
MouseDown = 13,
|
|
33
|
-
MouseUp = 14,
|
|
34
|
-
MouseWheel = 15,
|
|
35
|
-
DoubleClick = 16,
|
|
36
|
-
TouchStart = 17,
|
|
37
|
-
TouchEnd = 18,
|
|
38
|
-
TouchMove = 19,
|
|
39
|
-
TouchCancel = 20,
|
|
40
|
-
Selection = 21,
|
|
41
|
-
Timeline = 22,
|
|
42
|
-
Page = 23,
|
|
43
|
-
Custom = 24,
|
|
44
|
-
Ping = 25,
|
|
45
|
-
Unload = 26,
|
|
46
|
-
Input = 27,
|
|
47
|
-
Visibility = 28,
|
|
48
|
-
Navigation = 29,
|
|
49
|
-
/**
|
|
50
|
-
* @deprecated No longer support Network Connection
|
|
51
|
-
*/
|
|
52
|
-
Connection = 30,
|
|
53
|
-
ScriptError = 31,
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated No longer support Image Error
|
|
56
|
-
*/
|
|
57
|
-
ImageError = 32,
|
|
58
|
-
Log = 33,
|
|
59
|
-
Variable = 34,
|
|
60
|
-
Limit = 35,
|
|
61
|
-
Summary = 36,
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated No longer support Box event
|
|
64
|
-
*/
|
|
65
|
-
Box = 37,
|
|
66
|
-
Clipboard = 38,
|
|
67
|
-
Submit = 39,
|
|
68
|
-
Extract = 40,
|
|
69
|
-
Fraud = 41,
|
|
70
|
-
Change = 42,
|
|
71
|
-
Snapshot = 43,
|
|
72
|
-
Animation = 44,
|
|
73
|
-
StyleSheetAdoption = 45,
|
|
74
|
-
StyleSheetUpdate = 46,
|
|
75
|
-
Consent = 47,
|
|
76
|
-
ContextMenu = 48,
|
|
77
|
-
// 49 is reserved for internal use
|
|
78
|
-
Focus = 50,
|
|
79
|
-
CustomElement = 51,
|
|
80
|
-
Chat = 52,
|
|
81
|
-
|
|
82
|
-
// Apps specific events
|
|
83
|
-
WebViewDiscover = 100,
|
|
84
|
-
WebViewMutation = 101,
|
|
85
|
-
MutationError = 102,
|
|
86
|
-
FragmentVisibility = 103,
|
|
87
|
-
Keystrokes = 104,
|
|
88
|
-
BackGesture = 105,
|
|
89
|
-
WebViewStatus = 106,
|
|
90
|
-
AppInstallReferrer = 107
|
|
91
|
-
// 200-300 reserved for internal use
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export const enum Metric {
|
|
95
|
-
ClientTimestamp = 0,
|
|
96
|
-
Playback = 1,
|
|
97
|
-
TotalBytes = 2,
|
|
98
|
-
LayoutCost = 3,
|
|
99
|
-
TotalCost = 4,
|
|
100
|
-
InvokeCount = 5,
|
|
101
|
-
ThreadBlockedTime = 6,
|
|
102
|
-
LongTaskCount = 7,
|
|
103
|
-
LargestPaint = 8,
|
|
104
|
-
CumulativeLayoutShift = 9,
|
|
105
|
-
FirstInputDelay = 10,
|
|
106
|
-
RatingValue = 11,
|
|
107
|
-
RatingCount = 12,
|
|
108
|
-
ProductPrice = 13,
|
|
109
|
-
ScreenWidth = 14,
|
|
110
|
-
ScreenHeight = 15,
|
|
111
|
-
ColorDepth = 16,
|
|
112
|
-
ReviewCount = 17,
|
|
113
|
-
BestRating = 18,
|
|
114
|
-
WorstRating = 19,
|
|
115
|
-
CartPrice = 20,
|
|
116
|
-
CartShipping = 21,
|
|
117
|
-
CartDiscount = 22,
|
|
118
|
-
CartTax = 23,
|
|
119
|
-
CartTotal = 24,
|
|
120
|
-
EventCount = 25,
|
|
121
|
-
Automation = 26,
|
|
122
|
-
Mobile = 27,
|
|
123
|
-
UploadTime = 28,
|
|
124
|
-
SinglePage = 29,
|
|
125
|
-
/**
|
|
126
|
-
* @deprecated Browser API is deprecated. Reference: https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory
|
|
127
|
-
*/
|
|
128
|
-
UsedMemory = 30,
|
|
129
|
-
Iframed = 31,
|
|
130
|
-
MaxTouchPoints = 32,
|
|
131
|
-
HardwareConcurrency = 33,
|
|
132
|
-
DeviceMemory = 34,
|
|
133
|
-
Electron = 35,
|
|
134
|
-
/**
|
|
135
|
-
* @deprecated No longer tracking
|
|
136
|
-
*/
|
|
137
|
-
ConstructedStyles = 36,
|
|
138
|
-
/**
|
|
139
|
-
* @deprecated Move it to dimension as it'll report only last value
|
|
140
|
-
*/
|
|
141
|
-
InteractionNextPaint = 37,
|
|
142
|
-
HistoryClear = 38,
|
|
143
|
-
AngularZone = 39,
|
|
144
|
-
// 200-300 reserved for internal use
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export const enum Dimension {
|
|
148
|
-
UserAgent = 0,
|
|
149
|
-
Url = 1,
|
|
150
|
-
Referrer = 2,
|
|
151
|
-
PageTitle = 3,
|
|
152
|
-
NetworkHosts = 4,
|
|
153
|
-
SchemaType = 5,
|
|
154
|
-
ProductBrand = 6,
|
|
155
|
-
ProductAvailability = 7,
|
|
156
|
-
AuthorName = 8,
|
|
157
|
-
Language = 9,
|
|
158
|
-
ProductName = 10,
|
|
159
|
-
ProductCategory = 11,
|
|
160
|
-
ProductSku = 12,
|
|
161
|
-
ProductCurrency = 13,
|
|
162
|
-
ProductCondition = 14,
|
|
163
|
-
TabId = 15,
|
|
164
|
-
PageLanguage = 16,
|
|
165
|
-
DocumentDirection = 17,
|
|
166
|
-
Headline = 18,
|
|
167
|
-
MetaType = 19,
|
|
168
|
-
MetaTitle = 20,
|
|
169
|
-
Generator = 21,
|
|
170
|
-
Platform = 22,
|
|
171
|
-
PlatformVersion = 23,
|
|
172
|
-
Brand = 24,
|
|
173
|
-
Model = 25,
|
|
174
|
-
DevicePixelRatio = 26,
|
|
175
|
-
ConnectionType = 27,
|
|
176
|
-
Dob = 28,
|
|
177
|
-
CookieVersion = 29,
|
|
178
|
-
DeviceFamily = 30, // Allows iOS SDK to override the DeviceFamily value parsed from UserAgent.
|
|
179
|
-
InitialScrollTop = 31,
|
|
180
|
-
InitialScrollBottom = 32,
|
|
181
|
-
AncestorOrigins = 33,
|
|
182
|
-
Timezone = 34,
|
|
183
|
-
TimezoneOffset = 35,
|
|
184
|
-
Consent = 36,
|
|
185
|
-
InteractionNextPaint = 37
|
|
186
|
-
// 200-300 reserved for internal use
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export const enum Check {
|
|
190
|
-
None = 0,
|
|
191
|
-
Payload = 1,
|
|
192
|
-
Shutdown = 2,
|
|
193
|
-
Retry = 3,
|
|
194
|
-
Bytes = 4,
|
|
195
|
-
Collection = 5,
|
|
196
|
-
Server = 6,
|
|
197
|
-
Page = 7
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export const enum Code {
|
|
201
|
-
RunTask = 0,
|
|
202
|
-
CssRules = 1,
|
|
203
|
-
MutationObserver = 2,
|
|
204
|
-
PerformanceObserver = 3,
|
|
205
|
-
CallStackDepth = 4,
|
|
206
|
-
Selector = 5,
|
|
207
|
-
Metric = 6,
|
|
208
|
-
/**
|
|
209
|
-
* @deprecated No longer support ContentSecurityPolicy
|
|
210
|
-
*/
|
|
211
|
-
ContentSecurityPolicy = 7,
|
|
212
|
-
Config = 8,
|
|
213
|
-
FunctionExecutionTime = 9,
|
|
214
|
-
LeanLimit = 10,
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export const enum Severity {
|
|
218
|
-
Info = 0,
|
|
219
|
-
Warning = 1,
|
|
220
|
-
Error = 2,
|
|
221
|
-
Fatal = 3
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
export const enum Upload {
|
|
225
|
-
Async = 0,
|
|
226
|
-
Beacon = 1
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
export const enum BooleanFlag {
|
|
230
|
-
False = 0,
|
|
231
|
-
True = 1
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
export const enum GCMConsent {
|
|
235
|
-
Unknown = 0,
|
|
236
|
-
Granted = 1,
|
|
237
|
-
Denied = 2
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export const enum IframeStatus {
|
|
241
|
-
Unknown = 0,
|
|
242
|
-
TopFrame = 1,
|
|
243
|
-
Iframe = 2
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
export const enum Setting {
|
|
247
|
-
Expire = 365, // 1 Year
|
|
248
|
-
SessionExpire = 1, // 1 Day
|
|
249
|
-
CookieVersion = 2, // Increment this version every time there's a cookie schema change
|
|
250
|
-
SessionTimeout = 30 * Time.Minute, // 30 minutes
|
|
251
|
-
CookieInterval = 1, // 1 Day
|
|
252
|
-
PingInterval = 1 * Time.Minute, // 1 Minute
|
|
253
|
-
PingTimeout = 5 * Time.Minute, // 5 Minutes
|
|
254
|
-
SummaryInterval = 100, // Same events within 100ms will be collapsed into single summary
|
|
255
|
-
ClickText = 25, // Maximum number of characters to send as part of Click event's text field
|
|
256
|
-
ClickClass = 50, // Maximum number of characters to send as part of Click event's class name
|
|
257
|
-
ClickTag = 10, // Maximum number of characters to send as part of Click event's tag
|
|
258
|
-
ClickId = 25, // Maximum number of characters to send as part of Click event's id
|
|
259
|
-
PayloadLimit = 128, // Do not allow more than specified payloads per page
|
|
260
|
-
PageLimit = 128, // Do not allow more than 128 pages in a session
|
|
261
|
-
ShutdownLimit = 2 * Time.Hour, // Shutdown instrumentation after specified time
|
|
262
|
-
RetryLimit = 1, // Maximum number of attempts to upload a payload before giving up
|
|
263
|
-
PlaybackBytesLimit = 10 * 1024 * 1024, // 10MB
|
|
264
|
-
CollectionLimit = 128, // Number of unique entries for dimensions
|
|
265
|
-
ClickPrecision = 32767, // 2^15 - 1
|
|
266
|
-
BoxPrecision = 100, // Up to 2 decimal points (e.g. 34.56)
|
|
267
|
-
ScriptErrorLimit = 5, // Do not send the same script error more than 5 times per page
|
|
268
|
-
DimensionLimit = 256, // Do not extract dimensions which are over 256 characters
|
|
269
|
-
WordLength = 5, // Estimated average size of a word,
|
|
270
|
-
RestartDelay = 250, // Wait for 250ms before starting to wire up again
|
|
271
|
-
CallStackDepth = 20, // Maximum call stack depth before bailing out
|
|
272
|
-
RatingScale = 100, // Scale rating to specified scale
|
|
273
|
-
ViewportIntersectionRatio = 0.05, // Ratio of intersection area in comparison to viewport area before it's marked visible
|
|
274
|
-
IntersectionRatio = 0.8, // Ratio of intersection area in comparison to element's area before it's marked visible
|
|
275
|
-
MaxFirstPayloadBytes = 1 * 1024 * 1024, // 1MB: Cap the very first payload to a maximum of 1MB
|
|
276
|
-
MegaByte = 1024 * 1024, // 1MB
|
|
277
|
-
UploadFactor = 3, // Slow down sequence by specified factor
|
|
278
|
-
MinUploadDelay = 100, // Minimum time before we are ready to flush events to the server
|
|
279
|
-
MaxUploadDelay = 30 * Time.Second, // Do flush out payload once every 30s,
|
|
280
|
-
ExtractLimit = 10000, // Do not extract more than 10000 characters
|
|
281
|
-
ChecksumPrecision = 28, // n-bit integer to represent token hash
|
|
282
|
-
UploadTimeout = 15000, // Timeout in ms for XHR requests
|
|
283
|
-
LongTask = 30, // Long Task threshold in ms
|
|
284
|
-
MaxBeaconPayloadBytes = 64 * 1024, // 64KB: Cap the beacon payload to a maximum of 64KB
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
export const enum Character {
|
|
288
|
-
Zero = 48,
|
|
289
|
-
Nine = 57,
|
|
290
|
-
At = 64,
|
|
291
|
-
Blank = 32,
|
|
292
|
-
Tab = 9,
|
|
293
|
-
NewLine = 10,
|
|
294
|
-
Return = 13
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
export const enum ApplicationPlatform {
|
|
298
|
-
WebApp = 0
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
export const enum Constant {
|
|
302
|
-
Auto = "Auto",
|
|
303
|
-
Config = "Config",
|
|
304
|
-
Clarity = "clarity",
|
|
305
|
-
Restart = "restart",
|
|
306
|
-
Suspend = "suspend",
|
|
307
|
-
Pause = "pause",
|
|
308
|
-
Resume = "resume",
|
|
309
|
-
Report = "report",
|
|
310
|
-
Memory = "memory",
|
|
311
|
-
Empty = "",
|
|
312
|
-
Space = " ",
|
|
313
|
-
Expires = "expires=",
|
|
314
|
-
Domain = "domain=",
|
|
315
|
-
Dropped = "*na*",
|
|
316
|
-
Comma = ",",
|
|
317
|
-
Dot = ".",
|
|
318
|
-
At = "@",
|
|
319
|
-
Asterix = "*",
|
|
320
|
-
Semicolon = ";",
|
|
321
|
-
Equals = "=",
|
|
322
|
-
Path = ";path=/",
|
|
323
|
-
Target = "target",
|
|
324
|
-
Blank = "_blank",
|
|
325
|
-
Parent = "_parent",
|
|
326
|
-
Top = "_top",
|
|
327
|
-
String = "string",
|
|
328
|
-
Number = "number",
|
|
329
|
-
Email = "email",
|
|
330
|
-
CookieKey = "_clck", // Clarity Cookie Key
|
|
331
|
-
SessionKey = "_clsk", // Clarity Session Key
|
|
332
|
-
TabKey = "_cltk", // Clarity Tab Key
|
|
333
|
-
Pipe = "|",
|
|
334
|
-
End = "END",
|
|
335
|
-
Upgrade = "UPGRADE",
|
|
336
|
-
Action = "ACTION",
|
|
337
|
-
Signal = "SIGNAL",
|
|
338
|
-
Extract = "EXTRACT",
|
|
339
|
-
Snapshot = "SNAPSHOT",
|
|
340
|
-
Module = "MODULE",
|
|
341
|
-
UserHint = "userHint",
|
|
342
|
-
UserType = "userType",
|
|
343
|
-
UserId = "userId",
|
|
344
|
-
SessionId = "sessionId",
|
|
345
|
-
PageId = "pageId",
|
|
346
|
-
Mask = "•", // Placeholder character for explicitly masked content
|
|
347
|
-
Digit = "▫", // Placeholder character for digits
|
|
348
|
-
Letter = "▪", // Placeholder character for letters
|
|
349
|
-
SessionStorage = "sessionStorage",
|
|
350
|
-
Cookie = "cookie",
|
|
351
|
-
Navigation = "navigation",
|
|
352
|
-
Resource = "resource",
|
|
353
|
-
LongTask = "longtask",
|
|
354
|
-
FID = "first-input",
|
|
355
|
-
CLS = "layout-shift",
|
|
356
|
-
LCP = "largest-contentful-paint",
|
|
357
|
-
PerformanceEventTiming = "event",
|
|
358
|
-
HTTPS = "https://",
|
|
359
|
-
CompressionStream = "CompressionStream",
|
|
360
|
-
Accept = "Accept",
|
|
361
|
-
ClarityGzip = "application/x-clarity-gzip",
|
|
362
|
-
Tilde = "~",
|
|
363
|
-
ArrayStart = "[",
|
|
364
|
-
ConditionStart = "{",
|
|
365
|
-
ConditionEnd = "}",
|
|
366
|
-
Seperator = "<SEP>",
|
|
367
|
-
Timeout = "Timeout",
|
|
368
|
-
Bang = "!",
|
|
369
|
-
SHA256 = "SHA-256",
|
|
370
|
-
Electron = "Electron",
|
|
371
|
-
Caret = "^",
|
|
372
|
-
Granted = "granted",
|
|
373
|
-
Denied = "denied",
|
|
374
|
-
AdStorage = "ad_storage",
|
|
375
|
-
AnalyticsStorage = "analytics_storage",
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
export const enum XMLReadyState {
|
|
379
|
-
Unsent = 0,
|
|
380
|
-
Opened = 1,
|
|
381
|
-
Headers_Recieved = 2,
|
|
382
|
-
Loading = 3,
|
|
383
|
-
Done = 4
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
export const enum ConsentSource {
|
|
387
|
-
Implicit = 0,
|
|
388
|
-
API = 1,
|
|
389
|
-
GCM = 2
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/* Helper Interfaces */
|
|
393
|
-
|
|
394
|
-
export interface Payload {
|
|
395
|
-
e: Token[]; /* Envelope */
|
|
396
|
-
a: Token[][]; /* Events that are used for data analysis */
|
|
397
|
-
p: Token[][]; /* Events that are primarily used for session playback */
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
export interface EncodedPayload {
|
|
401
|
-
e: string; /* Envelope */
|
|
402
|
-
a: string; /* Analytics Payload */
|
|
403
|
-
p: string; /* Playback Payload */
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
export interface Metadata {
|
|
407
|
-
projectId: string;
|
|
408
|
-
userId: string;
|
|
409
|
-
sessionId: string;
|
|
410
|
-
pageNum: number;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
export interface Session {
|
|
414
|
-
session: string;
|
|
415
|
-
ts: number;
|
|
416
|
-
count: number;
|
|
417
|
-
upgrade: BooleanFlag;
|
|
418
|
-
upload: string;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
export interface User {
|
|
422
|
-
id: string;
|
|
423
|
-
version: number;
|
|
424
|
-
expiry: number;
|
|
425
|
-
consent: BooleanFlag;
|
|
426
|
-
dob: number;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
export interface Envelope extends Metadata {
|
|
430
|
-
sequence: number;
|
|
431
|
-
start: number;
|
|
432
|
-
duration: number;
|
|
433
|
-
version: string;
|
|
434
|
-
upload: Upload;
|
|
435
|
-
end: BooleanFlag;
|
|
436
|
-
applicationPlatform: number;
|
|
437
|
-
url: string;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
export interface Transit {
|
|
441
|
-
[key: number]: {
|
|
442
|
-
data: string;
|
|
443
|
-
attempts: number;
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
export interface BaselineState {
|
|
448
|
-
time: number;
|
|
449
|
-
event: number;
|
|
450
|
-
data: BaselineData;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
/* Event Data */
|
|
454
|
-
export interface BaselineData {
|
|
455
|
-
visible: BooleanFlag;
|
|
456
|
-
docWidth: number;
|
|
457
|
-
docHeight: number;
|
|
458
|
-
screenWidth: number;
|
|
459
|
-
screenHeight: number;
|
|
460
|
-
scrollX: number;
|
|
461
|
-
scrollY: number;
|
|
462
|
-
pointerX: number;
|
|
463
|
-
pointerY: number;
|
|
464
|
-
activityTime: number;
|
|
465
|
-
scrollTime: number;
|
|
466
|
-
pointerTime?: number;
|
|
467
|
-
moveX?: number;
|
|
468
|
-
moveY?: number;
|
|
469
|
-
moveTime?: number;
|
|
470
|
-
downX?: number;
|
|
471
|
-
downY?: number;
|
|
472
|
-
downTime?: number;
|
|
473
|
-
upX?: number;
|
|
474
|
-
upY?: number;
|
|
475
|
-
upTime?: number;
|
|
476
|
-
pointerPrevX?: number;
|
|
477
|
-
pointerPrevY?: number;
|
|
478
|
-
pointerPrevTime?: number;
|
|
479
|
-
modules: number[];
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
export interface IdentityData {
|
|
483
|
-
userId: string;
|
|
484
|
-
userHint: string;
|
|
485
|
-
sessionId?: string;
|
|
486
|
-
pageId?: string;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
export interface DimensionData {
|
|
490
|
-
[key: number]: string[];
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
export interface VariableData {
|
|
494
|
-
[name: string]: string[];
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
// Eventually custom event can be expanded to contain more properties
|
|
498
|
-
// For now, restricting to key value pair where both key & value are strings
|
|
499
|
-
// The way it's different from variable is that Custom Event has a notion of time
|
|
500
|
-
// Whereas variables have no timing element and eventually will turn into custom dimensions
|
|
501
|
-
export interface CustomData {
|
|
502
|
-
key?: string;
|
|
503
|
-
value: string;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
export interface MetricData {
|
|
507
|
-
[key: number]: number;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
export interface PingData {
|
|
511
|
-
gap: number;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
export interface LimitData {
|
|
515
|
-
check: number;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
export interface SummaryData {
|
|
519
|
-
[event: number]: [number, number][]; // Array of [start, duration] for every event type
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
export interface UpgradeData {
|
|
523
|
-
key: string;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
export interface ExtractData {
|
|
527
|
-
[key: number]: { [subkey: number]: string }; // Array of { subkey: number } representing the extracted data
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
export interface UploadData {
|
|
531
|
-
sequence: number;
|
|
532
|
-
attempts: number;
|
|
533
|
-
status: number;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
export interface ClaritySignal {
|
|
537
|
-
type: string
|
|
538
|
-
value?: number
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
export interface PerformanceEventTiming extends PerformanceEntry {
|
|
542
|
-
duration: DOMHighResTimeStamp;
|
|
543
|
-
interactionId: number;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
export interface Interaction {
|
|
547
|
-
id: number;
|
|
548
|
-
latency: number;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
export interface ConsentState {
|
|
552
|
-
ad_Storage?: string;
|
|
553
|
-
analytics_Storage?: string;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
export const enum ConsentType {
|
|
557
|
-
None = 0,
|
|
558
|
-
Implicit = 1,
|
|
559
|
-
General = 2
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
export interface ConsentData {
|
|
563
|
-
source: ConsentSource;
|
|
564
|
-
ad_Storage: BooleanFlag;
|
|
565
|
-
analytics_Storage: BooleanFlag;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
export interface GCMConsentState {
|
|
569
|
-
ad_Storage: GCMConsent;
|
|
570
|
-
analytics_Storage: GCMConsent;
|
|
571
|
-
}
|
|
1
|
+
import { Time } from "@clarity-types/core";
|
|
2
|
+
export type Target = (number | Node);
|
|
3
|
+
export type Token = (string | number | number[] | string[] | (string | number)[]);
|
|
4
|
+
export type DecodedToken = (any | any[]);
|
|
5
|
+
|
|
6
|
+
export type MetadataCallback = (data: Metadata, playback: boolean, consentStatus?: ConsentState) => void;
|
|
7
|
+
export interface MetadataCallbackOptions {
|
|
8
|
+
callback: MetadataCallback,
|
|
9
|
+
wait: boolean,
|
|
10
|
+
recall: boolean,
|
|
11
|
+
called: boolean,
|
|
12
|
+
consentInfo: boolean
|
|
13
|
+
}
|
|
14
|
+
export type SignalCallback = (data: ClaritySignal) => void
|
|
15
|
+
|
|
16
|
+
/* Enum */
|
|
17
|
+
export const enum Event {
|
|
18
|
+
/* Data */
|
|
19
|
+
Metric = 0,
|
|
20
|
+
Dimension = 1,
|
|
21
|
+
Upload = 2,
|
|
22
|
+
Upgrade = 3,
|
|
23
|
+
Baseline = 4,
|
|
24
|
+
Discover = 5,
|
|
25
|
+
Mutation = 6,
|
|
26
|
+
Region = 7,
|
|
27
|
+
Document = 8,
|
|
28
|
+
Click = 9,
|
|
29
|
+
Scroll = 10,
|
|
30
|
+
Resize = 11,
|
|
31
|
+
MouseMove = 12,
|
|
32
|
+
MouseDown = 13,
|
|
33
|
+
MouseUp = 14,
|
|
34
|
+
MouseWheel = 15,
|
|
35
|
+
DoubleClick = 16,
|
|
36
|
+
TouchStart = 17,
|
|
37
|
+
TouchEnd = 18,
|
|
38
|
+
TouchMove = 19,
|
|
39
|
+
TouchCancel = 20,
|
|
40
|
+
Selection = 21,
|
|
41
|
+
Timeline = 22,
|
|
42
|
+
Page = 23,
|
|
43
|
+
Custom = 24,
|
|
44
|
+
Ping = 25,
|
|
45
|
+
Unload = 26,
|
|
46
|
+
Input = 27,
|
|
47
|
+
Visibility = 28,
|
|
48
|
+
Navigation = 29,
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated No longer support Network Connection
|
|
51
|
+
*/
|
|
52
|
+
Connection = 30,
|
|
53
|
+
ScriptError = 31,
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated No longer support Image Error
|
|
56
|
+
*/
|
|
57
|
+
ImageError = 32,
|
|
58
|
+
Log = 33,
|
|
59
|
+
Variable = 34,
|
|
60
|
+
Limit = 35,
|
|
61
|
+
Summary = 36,
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated No longer support Box event
|
|
64
|
+
*/
|
|
65
|
+
Box = 37,
|
|
66
|
+
Clipboard = 38,
|
|
67
|
+
Submit = 39,
|
|
68
|
+
Extract = 40,
|
|
69
|
+
Fraud = 41,
|
|
70
|
+
Change = 42,
|
|
71
|
+
Snapshot = 43,
|
|
72
|
+
Animation = 44,
|
|
73
|
+
StyleSheetAdoption = 45,
|
|
74
|
+
StyleSheetUpdate = 46,
|
|
75
|
+
Consent = 47,
|
|
76
|
+
ContextMenu = 48,
|
|
77
|
+
// 49 is reserved for internal use
|
|
78
|
+
Focus = 50,
|
|
79
|
+
CustomElement = 51,
|
|
80
|
+
Chat = 52,
|
|
81
|
+
|
|
82
|
+
// Apps specific events
|
|
83
|
+
WebViewDiscover = 100,
|
|
84
|
+
WebViewMutation = 101,
|
|
85
|
+
MutationError = 102,
|
|
86
|
+
FragmentVisibility = 103,
|
|
87
|
+
Keystrokes = 104,
|
|
88
|
+
BackGesture = 105,
|
|
89
|
+
WebViewStatus = 106,
|
|
90
|
+
AppInstallReferrer = 107
|
|
91
|
+
// 200-300 reserved for internal use
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const enum Metric {
|
|
95
|
+
ClientTimestamp = 0,
|
|
96
|
+
Playback = 1,
|
|
97
|
+
TotalBytes = 2,
|
|
98
|
+
LayoutCost = 3,
|
|
99
|
+
TotalCost = 4,
|
|
100
|
+
InvokeCount = 5,
|
|
101
|
+
ThreadBlockedTime = 6,
|
|
102
|
+
LongTaskCount = 7,
|
|
103
|
+
LargestPaint = 8,
|
|
104
|
+
CumulativeLayoutShift = 9,
|
|
105
|
+
FirstInputDelay = 10,
|
|
106
|
+
RatingValue = 11,
|
|
107
|
+
RatingCount = 12,
|
|
108
|
+
ProductPrice = 13,
|
|
109
|
+
ScreenWidth = 14,
|
|
110
|
+
ScreenHeight = 15,
|
|
111
|
+
ColorDepth = 16,
|
|
112
|
+
ReviewCount = 17,
|
|
113
|
+
BestRating = 18,
|
|
114
|
+
WorstRating = 19,
|
|
115
|
+
CartPrice = 20,
|
|
116
|
+
CartShipping = 21,
|
|
117
|
+
CartDiscount = 22,
|
|
118
|
+
CartTax = 23,
|
|
119
|
+
CartTotal = 24,
|
|
120
|
+
EventCount = 25,
|
|
121
|
+
Automation = 26,
|
|
122
|
+
Mobile = 27,
|
|
123
|
+
UploadTime = 28,
|
|
124
|
+
SinglePage = 29,
|
|
125
|
+
/**
|
|
126
|
+
* @deprecated Browser API is deprecated. Reference: https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory
|
|
127
|
+
*/
|
|
128
|
+
UsedMemory = 30,
|
|
129
|
+
Iframed = 31,
|
|
130
|
+
MaxTouchPoints = 32,
|
|
131
|
+
HardwareConcurrency = 33,
|
|
132
|
+
DeviceMemory = 34,
|
|
133
|
+
Electron = 35,
|
|
134
|
+
/**
|
|
135
|
+
* @deprecated No longer tracking
|
|
136
|
+
*/
|
|
137
|
+
ConstructedStyles = 36,
|
|
138
|
+
/**
|
|
139
|
+
* @deprecated Move it to dimension as it'll report only last value
|
|
140
|
+
*/
|
|
141
|
+
InteractionNextPaint = 37,
|
|
142
|
+
HistoryClear = 38,
|
|
143
|
+
AngularZone = 39,
|
|
144
|
+
// 200-300 reserved for internal use
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export const enum Dimension {
|
|
148
|
+
UserAgent = 0,
|
|
149
|
+
Url = 1,
|
|
150
|
+
Referrer = 2,
|
|
151
|
+
PageTitle = 3,
|
|
152
|
+
NetworkHosts = 4,
|
|
153
|
+
SchemaType = 5,
|
|
154
|
+
ProductBrand = 6,
|
|
155
|
+
ProductAvailability = 7,
|
|
156
|
+
AuthorName = 8,
|
|
157
|
+
Language = 9,
|
|
158
|
+
ProductName = 10,
|
|
159
|
+
ProductCategory = 11,
|
|
160
|
+
ProductSku = 12,
|
|
161
|
+
ProductCurrency = 13,
|
|
162
|
+
ProductCondition = 14,
|
|
163
|
+
TabId = 15,
|
|
164
|
+
PageLanguage = 16,
|
|
165
|
+
DocumentDirection = 17,
|
|
166
|
+
Headline = 18,
|
|
167
|
+
MetaType = 19,
|
|
168
|
+
MetaTitle = 20,
|
|
169
|
+
Generator = 21,
|
|
170
|
+
Platform = 22,
|
|
171
|
+
PlatformVersion = 23,
|
|
172
|
+
Brand = 24,
|
|
173
|
+
Model = 25,
|
|
174
|
+
DevicePixelRatio = 26,
|
|
175
|
+
ConnectionType = 27,
|
|
176
|
+
Dob = 28,
|
|
177
|
+
CookieVersion = 29,
|
|
178
|
+
DeviceFamily = 30, // Allows iOS SDK to override the DeviceFamily value parsed from UserAgent.
|
|
179
|
+
InitialScrollTop = 31,
|
|
180
|
+
InitialScrollBottom = 32,
|
|
181
|
+
AncestorOrigins = 33,
|
|
182
|
+
Timezone = 34,
|
|
183
|
+
TimezoneOffset = 35,
|
|
184
|
+
Consent = 36,
|
|
185
|
+
InteractionNextPaint = 37
|
|
186
|
+
// 200-300 reserved for internal use
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export const enum Check {
|
|
190
|
+
None = 0,
|
|
191
|
+
Payload = 1,
|
|
192
|
+
Shutdown = 2,
|
|
193
|
+
Retry = 3,
|
|
194
|
+
Bytes = 4,
|
|
195
|
+
Collection = 5,
|
|
196
|
+
Server = 6,
|
|
197
|
+
Page = 7
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export const enum Code {
|
|
201
|
+
RunTask = 0,
|
|
202
|
+
CssRules = 1,
|
|
203
|
+
MutationObserver = 2,
|
|
204
|
+
PerformanceObserver = 3,
|
|
205
|
+
CallStackDepth = 4,
|
|
206
|
+
Selector = 5,
|
|
207
|
+
Metric = 6,
|
|
208
|
+
/**
|
|
209
|
+
* @deprecated No longer support ContentSecurityPolicy
|
|
210
|
+
*/
|
|
211
|
+
ContentSecurityPolicy = 7,
|
|
212
|
+
Config = 8,
|
|
213
|
+
FunctionExecutionTime = 9,
|
|
214
|
+
LeanLimit = 10,
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export const enum Severity {
|
|
218
|
+
Info = 0,
|
|
219
|
+
Warning = 1,
|
|
220
|
+
Error = 2,
|
|
221
|
+
Fatal = 3
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export const enum Upload {
|
|
225
|
+
Async = 0,
|
|
226
|
+
Beacon = 1
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export const enum BooleanFlag {
|
|
230
|
+
False = 0,
|
|
231
|
+
True = 1
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export const enum GCMConsent {
|
|
235
|
+
Unknown = 0,
|
|
236
|
+
Granted = 1,
|
|
237
|
+
Denied = 2
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export const enum IframeStatus {
|
|
241
|
+
Unknown = 0,
|
|
242
|
+
TopFrame = 1,
|
|
243
|
+
Iframe = 2
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export const enum Setting {
|
|
247
|
+
Expire = 365, // 1 Year
|
|
248
|
+
SessionExpire = 1, // 1 Day
|
|
249
|
+
CookieVersion = 2, // Increment this version every time there's a cookie schema change
|
|
250
|
+
SessionTimeout = 30 * Time.Minute, // 30 minutes
|
|
251
|
+
CookieInterval = 1, // 1 Day
|
|
252
|
+
PingInterval = 1 * Time.Minute, // 1 Minute
|
|
253
|
+
PingTimeout = 5 * Time.Minute, // 5 Minutes
|
|
254
|
+
SummaryInterval = 100, // Same events within 100ms will be collapsed into single summary
|
|
255
|
+
ClickText = 25, // Maximum number of characters to send as part of Click event's text field
|
|
256
|
+
ClickClass = 50, // Maximum number of characters to send as part of Click event's class name
|
|
257
|
+
ClickTag = 10, // Maximum number of characters to send as part of Click event's tag
|
|
258
|
+
ClickId = 25, // Maximum number of characters to send as part of Click event's id
|
|
259
|
+
PayloadLimit = 128, // Do not allow more than specified payloads per page
|
|
260
|
+
PageLimit = 128, // Do not allow more than 128 pages in a session
|
|
261
|
+
ShutdownLimit = 2 * Time.Hour, // Shutdown instrumentation after specified time
|
|
262
|
+
RetryLimit = 1, // Maximum number of attempts to upload a payload before giving up
|
|
263
|
+
PlaybackBytesLimit = 10 * 1024 * 1024, // 10MB
|
|
264
|
+
CollectionLimit = 128, // Number of unique entries for dimensions
|
|
265
|
+
ClickPrecision = 32767, // 2^15 - 1
|
|
266
|
+
BoxPrecision = 100, // Up to 2 decimal points (e.g. 34.56)
|
|
267
|
+
ScriptErrorLimit = 5, // Do not send the same script error more than 5 times per page
|
|
268
|
+
DimensionLimit = 256, // Do not extract dimensions which are over 256 characters
|
|
269
|
+
WordLength = 5, // Estimated average size of a word,
|
|
270
|
+
RestartDelay = 250, // Wait for 250ms before starting to wire up again
|
|
271
|
+
CallStackDepth = 20, // Maximum call stack depth before bailing out
|
|
272
|
+
RatingScale = 100, // Scale rating to specified scale
|
|
273
|
+
ViewportIntersectionRatio = 0.05, // Ratio of intersection area in comparison to viewport area before it's marked visible
|
|
274
|
+
IntersectionRatio = 0.8, // Ratio of intersection area in comparison to element's area before it's marked visible
|
|
275
|
+
MaxFirstPayloadBytes = 1 * 1024 * 1024, // 1MB: Cap the very first payload to a maximum of 1MB
|
|
276
|
+
MegaByte = 1024 * 1024, // 1MB
|
|
277
|
+
UploadFactor = 3, // Slow down sequence by specified factor
|
|
278
|
+
MinUploadDelay = 100, // Minimum time before we are ready to flush events to the server
|
|
279
|
+
MaxUploadDelay = 30 * Time.Second, // Do flush out payload once every 30s,
|
|
280
|
+
ExtractLimit = 10000, // Do not extract more than 10000 characters
|
|
281
|
+
ChecksumPrecision = 28, // n-bit integer to represent token hash
|
|
282
|
+
UploadTimeout = 15000, // Timeout in ms for XHR requests
|
|
283
|
+
LongTask = 30, // Long Task threshold in ms
|
|
284
|
+
MaxBeaconPayloadBytes = 64 * 1024, // 64KB: Cap the beacon payload to a maximum of 64KB
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export const enum Character {
|
|
288
|
+
Zero = 48,
|
|
289
|
+
Nine = 57,
|
|
290
|
+
At = 64,
|
|
291
|
+
Blank = 32,
|
|
292
|
+
Tab = 9,
|
|
293
|
+
NewLine = 10,
|
|
294
|
+
Return = 13
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export const enum ApplicationPlatform {
|
|
298
|
+
WebApp = 0
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export const enum Constant {
|
|
302
|
+
Auto = "Auto",
|
|
303
|
+
Config = "Config",
|
|
304
|
+
Clarity = "clarity",
|
|
305
|
+
Restart = "restart",
|
|
306
|
+
Suspend = "suspend",
|
|
307
|
+
Pause = "pause",
|
|
308
|
+
Resume = "resume",
|
|
309
|
+
Report = "report",
|
|
310
|
+
Memory = "memory",
|
|
311
|
+
Empty = "",
|
|
312
|
+
Space = " ",
|
|
313
|
+
Expires = "expires=",
|
|
314
|
+
Domain = "domain=",
|
|
315
|
+
Dropped = "*na*",
|
|
316
|
+
Comma = ",",
|
|
317
|
+
Dot = ".",
|
|
318
|
+
At = "@",
|
|
319
|
+
Asterix = "*",
|
|
320
|
+
Semicolon = ";",
|
|
321
|
+
Equals = "=",
|
|
322
|
+
Path = ";path=/",
|
|
323
|
+
Target = "target",
|
|
324
|
+
Blank = "_blank",
|
|
325
|
+
Parent = "_parent",
|
|
326
|
+
Top = "_top",
|
|
327
|
+
String = "string",
|
|
328
|
+
Number = "number",
|
|
329
|
+
Email = "email",
|
|
330
|
+
CookieKey = "_clck", // Clarity Cookie Key
|
|
331
|
+
SessionKey = "_clsk", // Clarity Session Key
|
|
332
|
+
TabKey = "_cltk", // Clarity Tab Key
|
|
333
|
+
Pipe = "|",
|
|
334
|
+
End = "END",
|
|
335
|
+
Upgrade = "UPGRADE",
|
|
336
|
+
Action = "ACTION",
|
|
337
|
+
Signal = "SIGNAL",
|
|
338
|
+
Extract = "EXTRACT",
|
|
339
|
+
Snapshot = "SNAPSHOT",
|
|
340
|
+
Module = "MODULE",
|
|
341
|
+
UserHint = "userHint",
|
|
342
|
+
UserType = "userType",
|
|
343
|
+
UserId = "userId",
|
|
344
|
+
SessionId = "sessionId",
|
|
345
|
+
PageId = "pageId",
|
|
346
|
+
Mask = "•", // Placeholder character for explicitly masked content
|
|
347
|
+
Digit = "▫", // Placeholder character for digits
|
|
348
|
+
Letter = "▪", // Placeholder character for letters
|
|
349
|
+
SessionStorage = "sessionStorage",
|
|
350
|
+
Cookie = "cookie",
|
|
351
|
+
Navigation = "navigation",
|
|
352
|
+
Resource = "resource",
|
|
353
|
+
LongTask = "longtask",
|
|
354
|
+
FID = "first-input",
|
|
355
|
+
CLS = "layout-shift",
|
|
356
|
+
LCP = "largest-contentful-paint",
|
|
357
|
+
PerformanceEventTiming = "event",
|
|
358
|
+
HTTPS = "https://",
|
|
359
|
+
CompressionStream = "CompressionStream",
|
|
360
|
+
Accept = "Accept",
|
|
361
|
+
ClarityGzip = "application/x-clarity-gzip",
|
|
362
|
+
Tilde = "~",
|
|
363
|
+
ArrayStart = "[",
|
|
364
|
+
ConditionStart = "{",
|
|
365
|
+
ConditionEnd = "}",
|
|
366
|
+
Seperator = "<SEP>",
|
|
367
|
+
Timeout = "Timeout",
|
|
368
|
+
Bang = "!",
|
|
369
|
+
SHA256 = "SHA-256",
|
|
370
|
+
Electron = "Electron",
|
|
371
|
+
Caret = "^",
|
|
372
|
+
Granted = "granted",
|
|
373
|
+
Denied = "denied",
|
|
374
|
+
AdStorage = "ad_storage",
|
|
375
|
+
AnalyticsStorage = "analytics_storage",
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export const enum XMLReadyState {
|
|
379
|
+
Unsent = 0,
|
|
380
|
+
Opened = 1,
|
|
381
|
+
Headers_Recieved = 2,
|
|
382
|
+
Loading = 3,
|
|
383
|
+
Done = 4
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export const enum ConsentSource {
|
|
387
|
+
Implicit = 0,
|
|
388
|
+
API = 1,
|
|
389
|
+
GCM = 2
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/* Helper Interfaces */
|
|
393
|
+
|
|
394
|
+
export interface Payload {
|
|
395
|
+
e: Token[]; /* Envelope */
|
|
396
|
+
a: Token[][]; /* Events that are used for data analysis */
|
|
397
|
+
p: Token[][]; /* Events that are primarily used for session playback */
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export interface EncodedPayload {
|
|
401
|
+
e: string; /* Envelope */
|
|
402
|
+
a: string; /* Analytics Payload */
|
|
403
|
+
p: string; /* Playback Payload */
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export interface Metadata {
|
|
407
|
+
projectId: string;
|
|
408
|
+
userId: string;
|
|
409
|
+
sessionId: string;
|
|
410
|
+
pageNum: number;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
export interface Session {
|
|
414
|
+
session: string;
|
|
415
|
+
ts: number;
|
|
416
|
+
count: number;
|
|
417
|
+
upgrade: BooleanFlag;
|
|
418
|
+
upload: string;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
export interface User {
|
|
422
|
+
id: string;
|
|
423
|
+
version: number;
|
|
424
|
+
expiry: number;
|
|
425
|
+
consent: BooleanFlag;
|
|
426
|
+
dob: number;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
export interface Envelope extends Metadata {
|
|
430
|
+
sequence: number;
|
|
431
|
+
start: number;
|
|
432
|
+
duration: number;
|
|
433
|
+
version: string;
|
|
434
|
+
upload: Upload;
|
|
435
|
+
end: BooleanFlag;
|
|
436
|
+
applicationPlatform: number;
|
|
437
|
+
url: string;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export interface Transit {
|
|
441
|
+
[key: number]: {
|
|
442
|
+
data: string;
|
|
443
|
+
attempts: number;
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export interface BaselineState {
|
|
448
|
+
time: number;
|
|
449
|
+
event: number;
|
|
450
|
+
data: BaselineData;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/* Event Data */
|
|
454
|
+
export interface BaselineData {
|
|
455
|
+
visible: BooleanFlag;
|
|
456
|
+
docWidth: number;
|
|
457
|
+
docHeight: number;
|
|
458
|
+
screenWidth: number;
|
|
459
|
+
screenHeight: number;
|
|
460
|
+
scrollX: number;
|
|
461
|
+
scrollY: number;
|
|
462
|
+
pointerX: number;
|
|
463
|
+
pointerY: number;
|
|
464
|
+
activityTime: number;
|
|
465
|
+
scrollTime: number;
|
|
466
|
+
pointerTime?: number;
|
|
467
|
+
moveX?: number;
|
|
468
|
+
moveY?: number;
|
|
469
|
+
moveTime?: number;
|
|
470
|
+
downX?: number;
|
|
471
|
+
downY?: number;
|
|
472
|
+
downTime?: number;
|
|
473
|
+
upX?: number;
|
|
474
|
+
upY?: number;
|
|
475
|
+
upTime?: number;
|
|
476
|
+
pointerPrevX?: number;
|
|
477
|
+
pointerPrevY?: number;
|
|
478
|
+
pointerPrevTime?: number;
|
|
479
|
+
modules: number[];
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export interface IdentityData {
|
|
483
|
+
userId: string;
|
|
484
|
+
userHint: string;
|
|
485
|
+
sessionId?: string;
|
|
486
|
+
pageId?: string;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export interface DimensionData {
|
|
490
|
+
[key: number]: string[];
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export interface VariableData {
|
|
494
|
+
[name: string]: string[];
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// Eventually custom event can be expanded to contain more properties
|
|
498
|
+
// For now, restricting to key value pair where both key & value are strings
|
|
499
|
+
// The way it's different from variable is that Custom Event has a notion of time
|
|
500
|
+
// Whereas variables have no timing element and eventually will turn into custom dimensions
|
|
501
|
+
export interface CustomData {
|
|
502
|
+
key?: string;
|
|
503
|
+
value: string;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export interface MetricData {
|
|
507
|
+
[key: number]: number;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
export interface PingData {
|
|
511
|
+
gap: number;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
export interface LimitData {
|
|
515
|
+
check: number;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
export interface SummaryData {
|
|
519
|
+
[event: number]: [number, number][]; // Array of [start, duration] for every event type
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
export interface UpgradeData {
|
|
523
|
+
key: string;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
export interface ExtractData {
|
|
527
|
+
[key: number]: { [subkey: number]: string }; // Array of { subkey: number } representing the extracted data
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
export interface UploadData {
|
|
531
|
+
sequence: number;
|
|
532
|
+
attempts: number;
|
|
533
|
+
status: number;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export interface ClaritySignal {
|
|
537
|
+
type: string
|
|
538
|
+
value?: number
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
export interface PerformanceEventTiming extends PerformanceEntry {
|
|
542
|
+
duration: DOMHighResTimeStamp;
|
|
543
|
+
interactionId: number;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
export interface Interaction {
|
|
547
|
+
id: number;
|
|
548
|
+
latency: number;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
export interface ConsentState {
|
|
552
|
+
ad_Storage?: string;
|
|
553
|
+
analytics_Storage?: string;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
export const enum ConsentType {
|
|
557
|
+
None = 0,
|
|
558
|
+
Implicit = 1,
|
|
559
|
+
General = 2
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
export interface ConsentData {
|
|
563
|
+
source: ConsentSource;
|
|
564
|
+
ad_Storage: BooleanFlag;
|
|
565
|
+
analytics_Storage: BooleanFlag;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
export interface GCMConsentState {
|
|
569
|
+
ad_Storage: GCMConsent;
|
|
570
|
+
analytics_Storage: GCMConsent;
|
|
571
|
+
}
|