clarity-js 0.8.10-beta → 0.8.10

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