clarity-js 0.7.61 → 0.7.62

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.
@@ -1,4 +1,4 @@
1
- import { BooleanFlag, Token, Upload, Envelope, WebApp } from "@clarity-types/data";
1
+ import { BooleanFlag, Token, Upload, Envelope, ApplicationPlatform } from "@clarity-types/data";
2
2
  import { time } from "@src/core/time";
3
3
  import version from "@src/core/version";
4
4
  import * as metadata from "@src/data/metadata";
@@ -19,7 +19,7 @@ export function start(): void {
19
19
  pageNum: m.pageNum,
20
20
  upload: Upload.Async,
21
21
  end: BooleanFlag.False,
22
- applicationPlatform: WebApp,
22
+ applicationPlatform: ApplicationPlatform.WebApp,
23
23
  url: ''
24
24
  };
25
25
  }
@@ -34,7 +34,7 @@ export function envelope(last: boolean): Token[] {
34
34
  data.sequence++;
35
35
  data.upload = last && "sendBeacon" in navigator ? Upload.Beacon : Upload.Async;
36
36
  data.end = last ? BooleanFlag.True : BooleanFlag.False;
37
- data.applicationPlatform = WebApp;
37
+ data.applicationPlatform = ApplicationPlatform.WebApp;
38
38
  data.url = scrub.url(location.href, false, true);
39
39
  return [
40
40
  data.version,
package/src/layout/dom.ts CHANGED
@@ -86,8 +86,14 @@ export function getId(node: Node, autogen: boolean = false): number {
86
86
  }
87
87
 
88
88
  export function add(node: Node, parent: Node, data: NodeInfo, source: Source): void {
89
- let id = getId(node, true);
90
89
  let parentId = parent ? getId(parent) : null;
90
+
91
+ // Do not add detached nodes
92
+ if ((!parent || !parentId) && (node as ShadowRoot).host == null) {
93
+ return;
94
+ }
95
+
96
+ let id = getId(node, true);
91
97
  let previousId = getPreviousId(node);
92
98
  let parentValue: NodeValue = null;
93
99
  let regionId = region.exists(node) ? id : null;
package/types/data.d.ts CHANGED
@@ -12,8 +12,6 @@ export interface MetadataCallbackOptions {
12
12
  }
13
13
  export type SignalCallback = (data: ClaritySignal) => void
14
14
 
15
- export const WebApp = 0;
16
-
17
15
  /* Enum */
18
16
  export const enum Event {
19
17
  /* Data */
@@ -47,22 +45,22 @@ export const enum Event {
47
45
  Input = 27,
48
46
  Visibility = 28,
49
47
  Navigation = 29,
50
- /**
51
- * @deprecated No longer support Network Connection
52
- */
48
+ /**
49
+ * @deprecated No longer support Network Connection
50
+ */
53
51
  Connection = 30,
54
52
  ScriptError = 31,
55
- /**
56
- * @deprecated No longer support Image Error
57
- */
53
+ /**
54
+ * @deprecated No longer support Image Error
55
+ */
58
56
  ImageError = 32,
59
57
  Log = 33,
60
58
  Variable = 34,
61
59
  Limit = 35,
62
60
  Summary = 36,
63
- /**
64
- * @deprecated No longer support Box event
65
- */
61
+ /**
62
+ * @deprecated No longer support Box event
63
+ */
66
64
  Box = 37,
67
65
  Clipboard = 38,
68
66
  Submit = 39,
@@ -116,9 +114,9 @@ export const enum Metric {
116
114
  Mobile = 27,
117
115
  UploadTime = 28,
118
116
  SinglePage = 29,
119
- /**
120
- * @deprecated Browser API is deprecated. Reference: https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory
121
- */
117
+ /**
118
+ * @deprecated Browser API is deprecated. Reference: https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory
119
+ */
122
120
  UsedMemory = 30,
123
121
  Iframed = 31,
124
122
  MaxTouchPoints = 32,
@@ -126,9 +124,9 @@ export const enum Metric {
126
124
  DeviceMemory = 34,
127
125
  Electron = 35,
128
126
  ConstructedStyles = 36,
129
- /**
130
- * @deprecated Move it to dimension as it'll report only last value
131
- */
127
+ /**
128
+ * @deprecated Move it to dimension as it'll report only last value
129
+ */
132
130
  InteractionNextPaint = 37,
133
131
  HistoryClear = 38
134
132
  }
@@ -193,9 +191,9 @@ export const enum Code {
193
191
  CallStackDepth = 4,
194
192
  Selector = 5,
195
193
  Metric = 6,
196
- /**
197
- * @deprecated No longer support ContentSecurityPolicy
198
- */
194
+ /**
195
+ * @deprecated No longer support ContentSecurityPolicy
196
+ */
199
197
  ContentSecurityPolicy = 7,
200
198
  Config = 8,
201
199
  FunctionExecutionTime = 9
@@ -270,6 +268,10 @@ export const enum Character {
270
268
  Return = 13
271
269
  }
272
270
 
271
+ export const enum ApplicationPlatform {
272
+ WebApp = 0
273
+ }
274
+
273
275
  export const enum Constant {
274
276
  Auto = "Auto",
275
277
  Config = "Config",
@@ -470,7 +472,7 @@ export interface UpgradeData {
470
472
  }
471
473
 
472
474
  export interface ExtractData {
473
- [key: number]: { [subkey : number]: string }; // Array of { subkey: number } representing the extracted data
475
+ [key: number]: { [subkey: number]: string }; // Array of { subkey: number } representing the extracted data
474
476
  }
475
477
 
476
478
  export interface UploadData {
@@ -488,7 +490,8 @@ export interface PerformanceEventTiming extends PerformanceEntry {
488
490
  duration: DOMHighResTimeStamp;
489
491
  interactionId: number;
490
492
  }
493
+
491
494
  export interface Interaction {
492
495
  id: number;
493
496
  latency: number;
494
- }
497
+ }