clarity-js 0.8.11 → 0.8.13-beta
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/build/clarity.extended.js +1 -1
- package/build/clarity.insight.js +1 -1
- package/build/clarity.js +2964 -3181
- package/build/clarity.min.js +1 -1
- package/build/clarity.module.js +2964 -3181
- package/build/clarity.performance.js +1 -1
- package/package.json +69 -76
- package/rollup.config.ts +88 -84
- package/src/clarity.ts +28 -34
- package/src/core/config.ts +2 -2
- package/src/core/event.ts +32 -36
- package/src/core/hash.ts +6 -5
- package/src/core/history.ts +11 -10
- package/src/core/index.ts +11 -21
- package/src/core/measure.ts +5 -9
- package/src/core/report.ts +3 -3
- package/src/core/scrub.ts +20 -29
- package/src/core/task.ts +45 -73
- package/src/core/time.ts +3 -3
- package/src/core/timeout.ts +2 -2
- package/src/core/version.ts +1 -1
- package/src/data/baseline.ts +55 -60
- package/src/data/consent.ts +2 -2
- package/src/data/custom.ts +13 -8
- package/src/data/dimension.ts +7 -11
- package/src/data/encode.ts +30 -36
- package/src/data/envelope.ts +38 -38
- package/src/data/extract.ts +77 -86
- package/src/data/index.ts +6 -10
- package/src/data/limit.ts +1 -1
- package/src/data/metadata.ts +266 -305
- package/src/data/metric.ts +8 -18
- package/src/data/ping.ts +4 -8
- package/src/data/signal.ts +18 -18
- package/src/data/summary.ts +4 -6
- package/src/data/token.ts +8 -10
- package/src/data/upgrade.ts +3 -7
- package/src/data/upload.ts +49 -100
- package/src/data/variable.ts +20 -27
- package/src/diagnostic/encode.ts +2 -2
- package/src/diagnostic/fraud.ts +4 -3
- package/src/diagnostic/internal.ts +5 -11
- package/src/diagnostic/script.ts +8 -12
- package/src/global.ts +1 -1
- package/src/insight/blank.ts +4 -4
- package/src/insight/encode.ts +17 -23
- package/src/insight/snapshot.ts +37 -57
- package/src/interaction/change.ts +6 -9
- package/src/interaction/click.ts +28 -34
- package/src/interaction/clipboard.ts +2 -2
- package/src/interaction/encode.ts +31 -35
- package/src/interaction/input.ts +9 -11
- package/src/interaction/pointer.ts +24 -35
- package/src/interaction/resize.ts +5 -5
- package/src/interaction/scroll.ts +11 -14
- package/src/interaction/selection.ts +8 -12
- package/src/interaction/submit.ts +2 -2
- package/src/interaction/timeline.ts +9 -13
- package/src/interaction/unload.ts +1 -1
- package/src/interaction/visibility.ts +2 -2
- package/src/layout/animation.ts +41 -47
- package/src/layout/discover.ts +5 -5
- package/src/layout/document.ts +19 -31
- package/src/layout/dom.ts +91 -141
- package/src/layout/encode.ts +37 -52
- package/src/layout/mutation.ts +318 -321
- package/src/layout/node.ts +81 -104
- package/src/layout/offset.ts +6 -7
- package/src/layout/region.ts +40 -60
- package/src/layout/schema.ts +8 -15
- package/src/layout/selector.ts +25 -47
- package/src/layout/style.ts +36 -44
- package/src/layout/target.ts +10 -14
- package/src/layout/traverse.ts +11 -17
- package/src/performance/blank.ts +1 -1
- package/src/performance/encode.ts +4 -4
- package/src/performance/interaction.ts +70 -58
- package/src/performance/navigation.ts +2 -2
- package/src/performance/observer.ts +26 -59
- package/src/queue.ts +9 -16
- package/tsconfig.json +1 -1
- package/tslint.json +32 -25
- package/types/core.d.ts +13 -13
- package/types/data.d.ts +29 -32
- package/types/diagnostic.d.ts +1 -1
- package/types/interaction.d.ts +4 -4
- package/types/layout.d.ts +21 -36
- package/types/performance.d.ts +5 -6
- package/.lintstagedrc.yml +0 -3
- package/biome.json +0 -43
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Code, Constant, Dimension, Metric,
|
|
1
|
+
import { Code, Constant, Dimension, Metric, Severity, PerformanceEventTiming } from "@clarity-types/data";
|
|
2
2
|
import { FunctionNames } from "@clarity-types/performance";
|
|
3
3
|
import config from "@src/core/config";
|
|
4
4
|
import { bind } from "@src/core/event";
|
|
@@ -7,40 +7,27 @@ import { setTimeout } from "@src/core/timeout";
|
|
|
7
7
|
import * as dimension from "@src/data/dimension";
|
|
8
8
|
import * as metric from "@src/data/metric";
|
|
9
9
|
import * as internal from "@src/diagnostic/internal";
|
|
10
|
-
import * as interaction from "@src/performance/interaction";
|
|
11
10
|
import * as navigation from "@src/performance/navigation";
|
|
11
|
+
import * as interaction from "@src/performance/interaction";
|
|
12
12
|
|
|
13
13
|
let observer: PerformanceObserver;
|
|
14
|
-
const types: string[] = [
|
|
15
|
-
Constant.Navigation,
|
|
16
|
-
Constant.Resource,
|
|
17
|
-
Constant.LongTask,
|
|
18
|
-
Constant.FID,
|
|
19
|
-
Constant.CLS,
|
|
20
|
-
Constant.LCP,
|
|
21
|
-
Constant.PerformanceEventTiming,
|
|
22
|
-
];
|
|
14
|
+
const types: string[] = [Constant.Navigation, Constant.Resource, Constant.LongTask, Constant.FID, Constant.CLS, Constant.LCP, Constant.PerformanceEventTiming];
|
|
23
15
|
|
|
24
16
|
export function start(): void {
|
|
25
17
|
// Capture connection properties, if available
|
|
26
18
|
if (navigator && "connection" in navigator) {
|
|
27
|
-
|
|
28
|
-
dimension.log(Dimension.ConnectionType, navigator.connection["effectiveType"]);
|
|
19
|
+
dimension.log(Dimension.ConnectionType, navigator["connection"]["effectiveType"]);
|
|
29
20
|
}
|
|
30
21
|
|
|
31
22
|
// Check the browser support performance observer as a pre-requisite for any performance measurement
|
|
32
|
-
if (window
|
|
23
|
+
if (window["PerformanceObserver"] && PerformanceObserver.supportedEntryTypes) {
|
|
33
24
|
// Start monitoring performance data after page has finished loading.
|
|
34
25
|
// If the document.readyState is not yet complete, we intentionally call observe using a setTimeout.
|
|
35
26
|
// This allows us to capture loadEventEnd on navigation timeline.
|
|
36
27
|
if (document.readyState !== "complete") {
|
|
37
28
|
bind(window, "load", setTimeout.bind(this, observe, 0));
|
|
38
|
-
} else {
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
internal.log(Code.PerformanceObserver, Severity.Info);
|
|
43
|
-
}
|
|
29
|
+
} else { observe(); }
|
|
30
|
+
} else { internal.log(Code.PerformanceObserver, Severity.Info); }
|
|
44
31
|
}
|
|
45
32
|
|
|
46
33
|
function observe(): void {
|
|
@@ -48,27 +35,21 @@ function observe(): void {
|
|
|
48
35
|
// Some browsers will throw an error for unsupported entryType, e.g. "layout-shift"
|
|
49
36
|
// In those cases, we log it as a warning and continue with rest of the Clarity processing
|
|
50
37
|
try {
|
|
51
|
-
if (observer) {
|
|
52
|
-
observer.disconnect();
|
|
53
|
-
}
|
|
38
|
+
if (observer) { observer.disconnect(); }
|
|
54
39
|
observer = new PerformanceObserver(measure(handle) as PerformanceObserverCallback);
|
|
55
40
|
// Reference: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/observe
|
|
56
41
|
// "buffered" flag indicates whether buffered entries should be queued into the observer's buffer.
|
|
57
42
|
// It must only be used only with the "type" option, and cannot be used with entryTypes.
|
|
58
43
|
// This is why we need to individually "observe" each supported type
|
|
59
|
-
for (
|
|
44
|
+
for (let x of types) {
|
|
60
45
|
if (PerformanceObserver.supportedEntryTypes.indexOf(x) >= 0) {
|
|
61
46
|
// Initialize CLS with a value of zero. It's possible (and recommended) for sites to not have any cumulative layout shift.
|
|
62
47
|
// In those cases, we want to still initialize the metric in Clarity
|
|
63
|
-
if (x === Constant.CLS) {
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
observer.observe({ type: x, buffered: true });
|
|
48
|
+
if (x === Constant.CLS) { metric.sum(Metric.CumulativeLayoutShift, 0); }
|
|
49
|
+
observer.observe({type: x, buffered: true});
|
|
67
50
|
}
|
|
68
51
|
}
|
|
69
|
-
} catch {
|
|
70
|
-
internal.log(Code.PerformanceObserver, Severity.Warning);
|
|
71
|
-
}
|
|
52
|
+
} catch { internal.log(Code.PerformanceObserver, Severity.Warning); }
|
|
72
53
|
}
|
|
73
54
|
|
|
74
55
|
function handle(entries: PerformanceObserverEntryList): void {
|
|
@@ -77,65 +58,51 @@ function handle(entries: PerformanceObserverEntryList): void {
|
|
|
77
58
|
}
|
|
78
59
|
|
|
79
60
|
function process(entries: PerformanceEntryList): void {
|
|
80
|
-
|
|
61
|
+
let visible = "visibilityState" in document ? document.visibilityState === "visible" : true;
|
|
81
62
|
for (let i = 0; i < entries.length; i++) {
|
|
82
|
-
|
|
63
|
+
let entry = entries[i];
|
|
83
64
|
switch (entry.entryType) {
|
|
84
65
|
case Constant.Navigation:
|
|
85
66
|
navigation.compute(entry as PerformanceNavigationTiming);
|
|
86
67
|
break;
|
|
87
|
-
case Constant.Resource:
|
|
88
|
-
|
|
68
|
+
case Constant.Resource:
|
|
69
|
+
let name = entry.name;
|
|
89
70
|
dimension.log(Dimension.NetworkHosts, host(name));
|
|
90
|
-
if (name === config.upload || name === config.fallback) {
|
|
91
|
-
metric.max(Metric.UploadTime, entry.duration);
|
|
92
|
-
}
|
|
71
|
+
if (name === config.upload || name === config.fallback) { metric.max(Metric.UploadTime, entry.duration); }
|
|
93
72
|
break;
|
|
94
|
-
}
|
|
95
73
|
case Constant.LongTask:
|
|
96
74
|
metric.count(Metric.LongTaskCount);
|
|
97
75
|
break;
|
|
98
76
|
case Constant.FID:
|
|
99
|
-
|
|
100
|
-
if (visible && (entry as any).processingStart) {
|
|
101
|
-
// biome-ignore lint/suspicious/noExplicitAny: not all browsers support processingstart
|
|
102
|
-
metric.max(Metric.FirstInputDelay, (entry as any).processingStart - entry.startTime);
|
|
103
|
-
}
|
|
77
|
+
if (visible) { metric.max(Metric.FirstInputDelay, entry["processingStart"] - entry.startTime); }
|
|
104
78
|
break;
|
|
105
79
|
case Constant.PerformanceEventTiming:
|
|
106
|
-
if (visible &&
|
|
107
|
-
|
|
80
|
+
if (visible && 'PerformanceEventTiming' in window && 'interactionId' in PerformanceEventTiming.prototype)
|
|
81
|
+
{
|
|
82
|
+
interaction.processInteractionEntry(entry as PerformanceEventTiming);
|
|
108
83
|
// Logging it as dimension because we're always looking for the last value.
|
|
109
|
-
dimension.log(Dimension.InteractionNextPaint, interaction.estimateP98LongestInteraction().toString());
|
|
84
|
+
dimension.log(Dimension.InteractionNextPaint, interaction.estimateP98LongestInteraction().toString());
|
|
110
85
|
}
|
|
111
86
|
break;
|
|
112
87
|
case Constant.CLS:
|
|
113
88
|
// Scale the value to avoid sending back floating point number
|
|
114
|
-
|
|
115
|
-
if (visible && !(entry as any).hadRecentInput) {
|
|
116
|
-
// biome-ignore lint/suspicious/noExplicitAny: not all browsers support layoutshift value
|
|
117
|
-
metric.sum(Metric.CumulativeLayoutShift, (entry as any).value * 1000);
|
|
118
|
-
}
|
|
89
|
+
if (visible && !entry["hadRecentInput"]) { metric.sum(Metric.CumulativeLayoutShift, entry["value"] * 1000); }
|
|
119
90
|
break;
|
|
120
91
|
case Constant.LCP:
|
|
121
|
-
if (visible) {
|
|
122
|
-
metric.max(Metric.LargestPaint, entry.startTime);
|
|
123
|
-
}
|
|
92
|
+
if (visible) { metric.max(Metric.LargestPaint, entry.startTime); }
|
|
124
93
|
break;
|
|
125
94
|
}
|
|
126
95
|
}
|
|
127
96
|
}
|
|
128
97
|
|
|
129
98
|
export function stop(): void {
|
|
130
|
-
if (observer) {
|
|
131
|
-
observer.disconnect();
|
|
132
|
-
}
|
|
99
|
+
if (observer) { observer.disconnect(); }
|
|
133
100
|
observer = null;
|
|
134
101
|
interaction.resetInteractions();
|
|
135
102
|
}
|
|
136
103
|
|
|
137
104
|
function host(url: string): string {
|
|
138
|
-
|
|
105
|
+
let a = document.createElement("a");
|
|
139
106
|
a.href = url;
|
|
140
107
|
return a.host;
|
|
141
108
|
}
|
package/src/queue.ts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { Constant } from "@clarity-types/data";
|
|
2
2
|
import * as clarity from "@src/clarity";
|
|
3
3
|
|
|
4
|
-
const w = window;
|
|
4
|
+
const w = window;
|
|
5
5
|
const c = Constant.Clarity;
|
|
6
6
|
|
|
7
7
|
export function setup() {
|
|
8
|
-
// Start queuing up calls while Clarity is inactive and we are in a browser enviornment
|
|
8
|
+
// Start queuing up calls while Clarity is inactive and we are in a browser enviornment
|
|
9
9
|
if (typeof w !== "undefined") {
|
|
10
|
-
w[c] = (
|
|
11
|
-
|
|
12
|
-
w[c].q = [];
|
|
13
|
-
}
|
|
14
|
-
w[c].q.push(args);
|
|
10
|
+
w[c] = function() {
|
|
11
|
+
(w[c].q = w[c].q || []).push(arguments);
|
|
15
12
|
// if the start function was called, don't queue it and instead process the queue
|
|
16
|
-
|
|
13
|
+
arguments[0] === "start" && w[c].q.unshift(w[c].q.pop()) && process();
|
|
17
14
|
};
|
|
18
15
|
}
|
|
19
16
|
}
|
|
@@ -21,20 +18,16 @@ export function setup() {
|
|
|
21
18
|
export function process() {
|
|
22
19
|
if (typeof w !== "undefined") {
|
|
23
20
|
// Do not execute or reset global "clarity" variable if a version of Clarity is already running on the page
|
|
24
|
-
if (w[c]
|
|
25
|
-
return console.warn("Error CL001: Multiple Clarity tags detected.");
|
|
26
|
-
}
|
|
21
|
+
if (w[c] && w[c].v) { return console.warn("Error CL001: Multiple Clarity tags detected."); }
|
|
27
22
|
|
|
28
23
|
// Expose clarity in a browser environment
|
|
29
24
|
// To be efficient about queuing up operations while Clarity is wiring up, we expose clarity.*(args) => clarity(*, args);
|
|
30
25
|
// This allows us to reprocess any calls that we missed once Clarity is available on the page
|
|
31
26
|
// Once Clarity script bundle is loaded on the page, we also initialize a "v" property that holds current version
|
|
32
27
|
// We use the presence or absence of "v" to determine if we are attempting to run a duplicate instance
|
|
33
|
-
|
|
34
|
-
w[c] = (method: string, ...args): void
|
|
28
|
+
let queue = w[c] ? (w[c].q || []) : [];
|
|
29
|
+
w[c] = function(method: string, ...args: any[]): void { return clarity[method](...args); }
|
|
35
30
|
w[c].v = clarity.version;
|
|
36
|
-
while (queue.length > 0) {
|
|
37
|
-
w[c](...queue.shift());
|
|
38
|
-
}
|
|
31
|
+
while (queue.length > 0) { w[c](...queue.shift()); }
|
|
39
32
|
}
|
|
40
33
|
}
|
package/tsconfig.json
CHANGED
package/tslint.json
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
2
|
+
"extends": "tslint:recommended",
|
|
3
|
+
"rules": {
|
|
4
|
+
"max-line-length": [
|
|
5
|
+
true,
|
|
6
|
+
140
|
|
7
|
+
],
|
|
8
|
+
"no-console": [
|
|
9
|
+
false
|
|
10
|
+
],
|
|
11
|
+
"no-string-literal": false,
|
|
12
|
+
"prefer-const": false,
|
|
13
|
+
"prefer-for-of": false,
|
|
14
|
+
"object-literal-sort-keys": false,
|
|
15
|
+
"one-variable-per-declaration": false,
|
|
16
|
+
"trailing-comma": [
|
|
17
|
+
false
|
|
18
|
+
],
|
|
19
|
+
"variable-name": false,
|
|
20
|
+
"interface-name": false,
|
|
21
|
+
"interface-over-type-literal": false,
|
|
22
|
+
"only-arrow-functions": false,
|
|
23
|
+
"typedef": [
|
|
24
|
+
true,
|
|
25
|
+
"call-signature",
|
|
26
|
+
"parameter",
|
|
27
|
+
"property-declaration",
|
|
28
|
+
"member-variable-declaration",
|
|
29
|
+
"object-destructuring",
|
|
30
|
+
"array-destructuring"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}
|
package/types/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Data from "./data";
|
|
2
2
|
|
|
3
3
|
type TaskFunction = () => Promise<void>;
|
|
4
4
|
type TaskResolve = () => void;
|
|
@@ -10,20 +10,20 @@ type Checksum = [number /* FraudId */, string /* Query Selector */];
|
|
|
10
10
|
|
|
11
11
|
export const enum Priority {
|
|
12
12
|
Normal = 0,
|
|
13
|
-
High = 1
|
|
13
|
+
High = 1
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export const enum Time {
|
|
17
17
|
Second = 1000,
|
|
18
18
|
Minute = 60 * 1000,
|
|
19
19
|
Hour = 60 * 60 * 1000,
|
|
20
|
-
Day = 24 * 60 * 60 * 1000
|
|
20
|
+
Day = 24 * 60 * 60 * 1000
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export const enum Task {
|
|
24
24
|
Wait = 0,
|
|
25
25
|
Run = 1,
|
|
26
|
-
Stop = 2
|
|
26
|
+
Stop = 2
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export const enum ExtractSource {
|
|
@@ -31,20 +31,20 @@ export const enum ExtractSource {
|
|
|
31
31
|
Cookie = 1,
|
|
32
32
|
Text = 2,
|
|
33
33
|
Fragment = 3,
|
|
34
|
-
Hash = 4
|
|
34
|
+
Hash = 4
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export const enum Type {
|
|
38
38
|
Array = 1,
|
|
39
39
|
Object = 2,
|
|
40
|
-
Simple = 3
|
|
40
|
+
Simple = 3
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export type Syntax = {
|
|
44
|
-
name: string
|
|
45
|
-
type: Type
|
|
46
|
-
condition: string
|
|
47
|
-
}
|
|
44
|
+
name: string,
|
|
45
|
+
type: Type,
|
|
46
|
+
condition: string
|
|
47
|
+
}
|
|
48
48
|
|
|
49
49
|
export const enum Privacy {
|
|
50
50
|
None = 0,
|
|
@@ -52,7 +52,7 @@ export const enum Privacy {
|
|
|
52
52
|
Text = 2,
|
|
53
53
|
TextImage = 3,
|
|
54
54
|
Exclude = 4,
|
|
55
|
-
Snapshot = 5
|
|
55
|
+
Snapshot = 5
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/* Helper Interfaces */
|
|
@@ -83,7 +83,7 @@ export interface RequestIdleCallbackOptions {
|
|
|
83
83
|
|
|
84
84
|
export interface RequestIdleCallbackDeadline {
|
|
85
85
|
didTimeout: boolean;
|
|
86
|
-
timeRemaining: () => number;
|
|
86
|
+
timeRemaining: (() => number);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export interface AsyncTask {
|
|
@@ -146,5 +146,5 @@ export const enum Constant {
|
|
|
146
146
|
Zone = "Zone",
|
|
147
147
|
Symbol = "__symbol__",
|
|
148
148
|
AddEventListener = "addEventListener",
|
|
149
|
-
RemoveEventListener = "removeEventListener"
|
|
149
|
+
RemoveEventListener = "removeEventListener"
|
|
150
150
|
}
|
package/types/data.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { Time } from "@clarity-types/core";
|
|
2
|
-
export type Target = number | Node;
|
|
3
|
-
export type Token = string | number | number[] | string[] | (string | number)[];
|
|
2
|
+
export type Target = (number | Node);
|
|
3
|
+
export type Token = (string | number | number[] | string[] | (string | number)[]);
|
|
4
|
+
export type DecodedToken = (any | any[]);
|
|
4
5
|
|
|
5
6
|
export type MetadataCallback = (data: Metadata, playback: boolean) => void;
|
|
6
7
|
export interface MetadataCallbackOptions {
|
|
7
|
-
callback: MetadataCallback
|
|
8
|
-
wait: boolean
|
|
9
|
-
recall: boolean
|
|
10
|
-
called: boolean
|
|
8
|
+
callback: MetadataCallback,
|
|
9
|
+
wait: boolean,
|
|
10
|
+
recall: boolean,
|
|
11
|
+
called: boolean
|
|
11
12
|
}
|
|
12
|
-
export type SignalCallback = (data: ClaritySignal) => void
|
|
13
|
+
export type SignalCallback = (data: ClaritySignal) => void
|
|
13
14
|
|
|
14
15
|
/* Enum */
|
|
15
16
|
export const enum Event {
|
|
@@ -79,7 +80,7 @@ export const enum Event {
|
|
|
79
80
|
Keystrokes = 104,
|
|
80
81
|
BackGesture = 105,
|
|
81
82
|
WebViewStatus = 106,
|
|
82
|
-
AppInstallReferrer = 107
|
|
83
|
+
AppInstallReferrer = 107
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
export const enum Metric {
|
|
@@ -130,7 +131,7 @@ export const enum Metric {
|
|
|
130
131
|
* @deprecated Move it to dimension as it'll report only last value
|
|
131
132
|
*/
|
|
132
133
|
InteractionNextPaint = 37,
|
|
133
|
-
HistoryClear = 38
|
|
134
|
+
HistoryClear = 38
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
export const enum Dimension {
|
|
@@ -171,7 +172,7 @@ export const enum Dimension {
|
|
|
171
172
|
Timezone = 34,
|
|
172
173
|
TimezoneOffset = 35,
|
|
173
174
|
Consent = 36,
|
|
174
|
-
InteractionNextPaint = 37
|
|
175
|
+
InteractionNextPaint = 37
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
export const enum Check {
|
|
@@ -182,7 +183,7 @@ export const enum Check {
|
|
|
182
183
|
Bytes = 4,
|
|
183
184
|
Collection = 5,
|
|
184
185
|
Server = 6,
|
|
185
|
-
Page = 7
|
|
186
|
+
Page = 7
|
|
186
187
|
}
|
|
187
188
|
|
|
188
189
|
export const enum Code {
|
|
@@ -206,41 +207,37 @@ export const enum Severity {
|
|
|
206
207
|
Info = 0,
|
|
207
208
|
Warning = 1,
|
|
208
209
|
Error = 2,
|
|
209
|
-
Fatal = 3
|
|
210
|
+
Fatal = 3
|
|
210
211
|
}
|
|
211
212
|
|
|
212
213
|
export const enum Upload {
|
|
213
214
|
Async = 0,
|
|
214
|
-
Beacon = 1
|
|
215
|
+
Beacon = 1
|
|
215
216
|
}
|
|
216
217
|
|
|
217
218
|
export const enum BooleanFlag {
|
|
218
219
|
False = 0,
|
|
219
|
-
True = 1
|
|
220
|
+
True = 1
|
|
220
221
|
}
|
|
221
222
|
|
|
222
223
|
export const enum IframeStatus {
|
|
223
224
|
Unknown = 0,
|
|
224
225
|
TopFrame = 1,
|
|
225
|
-
Iframe = 2
|
|
226
|
+
Iframe = 2
|
|
226
227
|
}
|
|
227
228
|
|
|
228
229
|
export const enum Setting {
|
|
229
230
|
Expire = 365, // 1 Year
|
|
230
231
|
SessionExpire = 1, // 1 Day
|
|
231
232
|
CookieVersion = 2, // Increment this version every time there's a cookie schema change
|
|
232
|
-
// biome-ignore lint/style/useLiteralEnumMembers: Time.Minute is a const enum, it is compiled to a number
|
|
233
233
|
SessionTimeout = 30 * Time.Minute, // 30 minutes
|
|
234
234
|
CookieInterval = 1, // 1 Day
|
|
235
|
-
// biome-ignore lint/style/useLiteralEnumMembers: Time.Minute is a const enum, it is compiled to a number
|
|
236
235
|
PingInterval = 1 * Time.Minute, // 1 Minute
|
|
237
|
-
// biome-ignore lint/style/useLiteralEnumMembers: Time.Minute is a const enum, it is compiled to a number
|
|
238
236
|
PingTimeout = 5 * Time.Minute, // 5 Minutes
|
|
239
237
|
SummaryInterval = 100, // Same events within 100ms will be collapsed into single summary
|
|
240
238
|
ClickText = 25, // Maximum number of characters to send as part of Click event's text field
|
|
241
239
|
PayloadLimit = 128, // Do not allow more than specified payloads per page
|
|
242
240
|
PageLimit = 128, // Do not allow more than 128 pages in a session
|
|
243
|
-
// biome-ignore lint/style/useLiteralEnumMembers: Time.Hour is a const enum, it is compiled to a number
|
|
244
241
|
ShutdownLimit = 2 * Time.Hour, // Shutdown instrumentation after specified time
|
|
245
242
|
RetryLimit = 1, // Maximum number of attempts to upload a payload before giving up
|
|
246
243
|
PlaybackBytesLimit = 10 * 1024 * 1024, // 10MB
|
|
@@ -259,7 +256,6 @@ export const enum Setting {
|
|
|
259
256
|
MegaByte = 1024 * 1024, // 1MB
|
|
260
257
|
UploadFactor = 3, // Slow down sequence by specified factor
|
|
261
258
|
MinUploadDelay = 100, // Minimum time before we are ready to flush events to the server
|
|
262
|
-
// biome-ignore lint/style/useLiteralEnumMembers: Time.Second is a const enum, it is compiled to a number
|
|
263
259
|
MaxUploadDelay = 30 * Time.Second, // Do flush out payload once every 30s,
|
|
264
260
|
ExtractLimit = 10000, // Do not extract more than 10000 characters
|
|
265
261
|
ChecksumPrecision = 28, // n-bit integer to represent token hash
|
|
@@ -274,11 +270,11 @@ export const enum Character {
|
|
|
274
270
|
Blank = 32,
|
|
275
271
|
Tab = 9,
|
|
276
272
|
NewLine = 10,
|
|
277
|
-
Return = 13
|
|
273
|
+
Return = 13
|
|
278
274
|
}
|
|
279
275
|
|
|
280
276
|
export const enum ApplicationPlatform {
|
|
281
|
-
WebApp = 0
|
|
277
|
+
WebApp = 0
|
|
282
278
|
}
|
|
283
279
|
|
|
284
280
|
export const enum Constant {
|
|
@@ -357,21 +353,22 @@ export const enum XMLReadyState {
|
|
|
357
353
|
Opened = 1,
|
|
358
354
|
Headers_Recieved = 2,
|
|
359
355
|
Loading = 3,
|
|
360
|
-
Done = 4
|
|
356
|
+
Done = 4
|
|
361
357
|
}
|
|
362
358
|
|
|
359
|
+
|
|
363
360
|
/* Helper Interfaces */
|
|
364
361
|
|
|
365
362
|
export interface Payload {
|
|
366
|
-
e: Token[] /* Envelope
|
|
367
|
-
a: Token[][] /* Events that are used for data analysis
|
|
368
|
-
p: Token[][] /* Events that are primarily used for session playback
|
|
363
|
+
e: Token[]; /* Envelope */
|
|
364
|
+
a: Token[][]; /* Events that are used for data analysis */
|
|
365
|
+
p: Token[][]; /* Events that are primarily used for session playback */
|
|
369
366
|
}
|
|
370
367
|
|
|
371
368
|
export interface EncodedPayload {
|
|
372
|
-
e: string /* Envelope
|
|
373
|
-
a: string /* Analytics Payload
|
|
374
|
-
p: string /* Playback Payload
|
|
369
|
+
e: string; /* Envelope */
|
|
370
|
+
a: string; /* Analytics Payload */
|
|
371
|
+
p: string; /* Playback Payload */
|
|
375
372
|
}
|
|
376
373
|
|
|
377
374
|
export interface Metadata {
|
|
@@ -504,8 +501,8 @@ export interface UploadData {
|
|
|
504
501
|
}
|
|
505
502
|
|
|
506
503
|
export interface ClaritySignal {
|
|
507
|
-
type: string
|
|
508
|
-
value?: number
|
|
504
|
+
type: string
|
|
505
|
+
value?: number
|
|
509
506
|
}
|
|
510
507
|
|
|
511
508
|
export interface PerformanceEventTiming extends PerformanceEntry {
|
|
@@ -516,4 +513,4 @@ export interface PerformanceEventTiming extends PerformanceEntry {
|
|
|
516
513
|
export interface Interaction {
|
|
517
514
|
id: number;
|
|
518
515
|
latency: number;
|
|
519
|
-
}
|
|
516
|
+
}
|
package/types/diagnostic.d.ts
CHANGED
package/types/interaction.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BooleanFlag } from "@clarity-types/data";
|
|
2
2
|
import { Time } from "./core";
|
|
3
|
-
import
|
|
3
|
+
import { Event, Target } from "./data";
|
|
4
4
|
|
|
5
5
|
/* Enum */
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ export const enum BrowsingContext {
|
|
|
8
8
|
Self = 0,
|
|
9
9
|
Blank = 1,
|
|
10
10
|
Parent = 2,
|
|
11
|
-
Top = 3
|
|
11
|
+
Top = 3
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export const enum Setting {
|
|
@@ -25,7 +25,7 @@ export const enum Setting {
|
|
|
25
25
|
export const enum Clipboard {
|
|
26
26
|
Cut = 0,
|
|
27
27
|
Copy = 1,
|
|
28
|
-
Paste = 2
|
|
28
|
+
Paste = 2
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/* Helper Interfaces */
|