clarity-js 0.6.26 → 0.6.30

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/types/data.d.ts CHANGED
@@ -39,14 +39,22 @@ export const enum Event {
39
39
  Input = 27,
40
40
  Visibility = 28,
41
41
  Navigation = 29,
42
+ /**
43
+ * @deprecated No longer support Network Connection
44
+ */
42
45
  Connection = 30,
43
46
  ScriptError = 31,
47
+ /**
48
+ * @deprecated No longer support Image Error
49
+ */
44
50
  ImageError = 32,
45
51
  Log = 33,
46
52
  Variable = 34,
47
53
  Limit = 35,
48
54
  Summary = 36,
49
55
  Box = 37,
56
+ Clipboard = 38,
57
+ Submit = 39
50
58
  }
51
59
 
52
60
  export const enum Metric {
@@ -74,7 +82,10 @@ export const enum Metric {
74
82
  CartShipping = 21,
75
83
  CartDiscount = 22,
76
84
  CartTax = 23,
77
- CartTotal = 24
85
+ CartTotal = 24,
86
+ EventCount = 25,
87
+ Automation = 26,
88
+ Mobile = 27
78
89
  }
79
90
 
80
91
  export const enum Dimension {
@@ -99,8 +110,11 @@ export const enum Dimension {
99
110
  Headline = 18,
100
111
  MetaType = 19,
101
112
  MetaTitle = 20,
102
- Generator = 21
103
-
113
+ Generator = 21,
114
+ Platform = 22,
115
+ PlatformVersion = 23,
116
+ Brand = 24,
117
+ Model = 25
104
118
  }
105
119
 
106
120
  export const enum Check {
@@ -160,6 +174,7 @@ export const enum Setting {
160
174
  BoxPrecision = 100, // Up to 2 decimal points (e.g. 34.56)
161
175
  ResizeObserverThreshold = 15, // At least 15 characters before we attach a resize observer for the node
162
176
  ScriptErrorLimit = 5, // Do not send the same script error more than 5 times per page
177
+ DimensionLimit = 256, // Do not extract dimensions which are over 256 characters
163
178
  WordLength = 5, // Estimated average size of a word,
164
179
  RestartDelay = 250, // Wait for 250ms before starting to wire up again
165
180
  CallStackDepth = 20, // Maximum call stack depth before bailing out
@@ -228,7 +243,8 @@ export const enum Constant {
228
243
  HTTPS = "https://",
229
244
  CompressionStream = "CompressionStream",
230
245
  Accept = "Accept",
231
- ClarityGzip = "application/x-clarity-gzip"
246
+ ClarityGzip = "application/x-clarity-gzip",
247
+ Tilde = "~",
232
248
  }
233
249
 
234
250
  export const enum XMLReadyState {
@@ -9,12 +9,6 @@ export interface ScriptErrorData {
9
9
  stack: string;
10
10
  }
11
11
 
12
- export interface ImageErrorData {
13
- source: string;
14
- target: Target;
15
- region?: number;
16
- }
17
-
18
12
  export interface LogData {
19
13
  code: Code;
20
14
  name: string;
package/types/index.d.ts CHANGED
@@ -15,7 +15,7 @@ interface Clarity {
15
15
  event: (name: string, value: string) => void;
16
16
  set: (variable: string, value: string | string[]) => void;
17
17
  identify: (userId: string, sessionId?: string, pageId?: string) => void;
18
- metadata: (callback: Data.MetadataCallback) => void;
18
+ metadata: (callback: Data.MetadataCallback, wait?: boolean) => void;
19
19
  }
20
20
 
21
21
  interface Helper {
@@ -17,6 +17,12 @@ export const enum Setting {
17
17
  TimelineSpan = 2 * Time.Second, // 2 seconds
18
18
  }
19
19
 
20
+ export const enum Clipboard {
21
+ Cut = 0,
22
+ Copy = 1,
23
+ Paste = 2
24
+ }
25
+
20
26
  /* Helper Interfaces */
21
27
  export interface PointerState {
22
28
  time: number;
@@ -30,12 +36,24 @@ export interface ClickState {
30
36
  data: ClickData;
31
37
  }
32
38
 
39
+ export interface ClipboardState {
40
+ time: number;
41
+ event: number;
42
+ data: ClipboardData;
43
+ }
44
+
33
45
  export interface ScrollState {
34
46
  time: number;
35
47
  event: number;
36
48
  data: ScrollData;
37
49
  }
38
50
 
51
+ export interface SubmitState {
52
+ time: number;
53
+ event: number;
54
+ data: SubmitData;
55
+ }
56
+
39
57
  export interface InputState {
40
58
  time: number;
41
59
  event: number;
@@ -63,6 +81,10 @@ export interface InputData {
63
81
  value: string;
64
82
  }
65
83
 
84
+ export interface SubmitData {
85
+ target: Target;
86
+ }
87
+
66
88
  export interface PointerData {
67
89
  target: Target;
68
90
  x: number;
@@ -83,6 +105,11 @@ export interface ClickData {
83
105
  hash: string;
84
106
  }
85
107
 
108
+ export interface ClipboardData {
109
+ target: Target;
110
+ action: Clipboard;
111
+ }
112
+
86
113
  export interface ResizeData {
87
114
  width: number;
88
115
  height: number;
@@ -1,23 +0,0 @@
1
- import { Event } from "@clarity-types/data";
2
- import { ImageErrorData } from "@clarity-types/diagnostic";
3
- import { bind } from "@src/core/event";
4
- import { schedule } from "@src/core/task";
5
- import encode from "./encode";
6
-
7
- export let data: ImageErrorData;
8
-
9
- export function start(): void {
10
- bind(document, "error", handler, true);
11
- }
12
-
13
- function handler(error: ErrorEvent): void {
14
- let element = error.target as HTMLElement;
15
- if (element && element.tagName === "IMG") {
16
- data = { source: (element as HTMLImageElement).src, target: element };
17
- schedule(encode.bind(this, Event.ImageError));
18
- }
19
- }
20
-
21
- export function stop(): void {
22
- data = null;
23
- }
@@ -1,37 +0,0 @@
1
- import { BooleanFlag, Event } from "@clarity-types/data";
2
- import { ConnectionData, NavigatorConnection } from "@clarity-types/performance";
3
- import encode from "./encode";
4
-
5
- // Reference: https://wicg.github.io/netinfo/
6
- export let data: ConnectionData;
7
-
8
- export function start(): void {
9
- // Check if the client supports Navigator.Connection: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/connection
10
- // This is an experimental API so we go a bit deeper in our check and ensure that values returned are valid
11
- if (navigator &&
12
- "connection" in navigator &&
13
- "downlink" in navigator["connection"] &&
14
- typeof navigator["connection"]["downlink"] === "number") {
15
- (navigator["connection"] as NavigatorConnection).addEventListener("change", recompute);
16
- recompute();
17
- }
18
- }
19
-
20
- function recompute(): void {
21
- let connection = navigator["connection"] as NavigatorConnection;
22
- data = {
23
- downlink: connection.downlink,
24
- rtt: connection.rtt,
25
- saveData: connection.saveData ? BooleanFlag.True : BooleanFlag.False,
26
- type: connection.effectiveType
27
- };
28
- encode(Event.Connection);
29
- }
30
-
31
- export function reset(): void {
32
- data = null;
33
- }
34
-
35
- export function stop(): void {
36
- reset();
37
- }