clarity-js 0.6.42 → 0.6.43
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.js +515 -500
- package/build/clarity.min.js +1 -1
- package/build/clarity.module.js +515 -500
- package/package.json +1 -1
- package/src/clarity.ts +1 -0
- package/src/core/version.ts +1 -1
- package/src/diagnostic/fraud.ts +7 -1
- package/src/layout/dom.ts +7 -1
- package/src/layout/index.ts +2 -0
- package/types/data.d.ts +8 -1
package/package.json
CHANGED
package/src/clarity.ts
CHANGED
|
@@ -11,6 +11,7 @@ import * as layout from "@src/layout";
|
|
|
11
11
|
import * as performance from "@src/performance";
|
|
12
12
|
export { version };
|
|
13
13
|
export { consent, event, identify, set, upgrade, metadata } from "@src/data";
|
|
14
|
+
export { hashText } from "@src/layout";
|
|
14
15
|
|
|
15
16
|
const modules: Module[] = [diagnostic, layout, interaction, performance];
|
|
16
17
|
|
package/src/core/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
let version = "0.6.
|
|
1
|
+
let version = "0.6.43";
|
|
2
2
|
export default version;
|
package/src/diagnostic/fraud.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BooleanFlag, Event, Metric, Setting } from "@clarity-types/data";
|
|
1
|
+
import { BooleanFlag, Event, IframeStatus, Metric, Setting } from "@clarity-types/data";
|
|
2
2
|
import { FraudData } from "@clarity-types/diagnostic";
|
|
3
3
|
import hash from "@src/core/hash";
|
|
4
4
|
import * as metric from "@src/data/metric";
|
|
@@ -10,6 +10,12 @@ export let data: FraudData;
|
|
|
10
10
|
export function start(): void {
|
|
11
11
|
history = [];
|
|
12
12
|
metric.max(Metric.Automation, navigator.webdriver ? BooleanFlag.True : BooleanFlag.False);
|
|
13
|
+
try {
|
|
14
|
+
metric.max(Metric.Iframed, window.top == window.self ? IframeStatus.TopFrame : IframeStatus.Iframe);
|
|
15
|
+
} catch (ex) {
|
|
16
|
+
metric.max(Metric.Iframed, IframeStatus.Unknown);
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
export function check(id: number, target: number, input: string): void {
|
package/src/layout/dom.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Privacy } from "@clarity-types/core";
|
|
2
|
-
import { Code, Severity } from "@clarity-types/data";
|
|
2
|
+
import { Code, Setting, Severity } from "@clarity-types/data";
|
|
3
3
|
import { Constant, Mask, NodeInfo, NodeMeta, NodeValue, Selector, SelectorInput, Source } from "@clarity-types/layout";
|
|
4
4
|
import config from "@src/core/config";
|
|
5
5
|
import hash from "@src/core/hash";
|
|
@@ -307,6 +307,12 @@ function updateSelector(value: NodeValue): void {
|
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
+
export function hashText(hash: string): string {
|
|
311
|
+
let id = lookup(hash);
|
|
312
|
+
let node = getNode(id);
|
|
313
|
+
return node !== null && node.textContent !== null ? node.textContent.substr(0, Setting.ClickText) : '';
|
|
314
|
+
}
|
|
315
|
+
|
|
310
316
|
export function getNode(id: number): Node {
|
|
311
317
|
if (id in nodes) {
|
|
312
318
|
return nodes[id];
|
package/src/layout/index.ts
CHANGED
|
@@ -4,6 +4,8 @@ import * as dom from "@src/layout/dom";
|
|
|
4
4
|
import * as mutation from "@src/layout/mutation";
|
|
5
5
|
import * as region from "@src/layout/region";
|
|
6
6
|
|
|
7
|
+
export { hashText } from "@src/layout/dom";
|
|
8
|
+
|
|
7
9
|
export function start(): void {
|
|
8
10
|
// The order below is important
|
|
9
11
|
// and is determined by interdependencies of modules
|
package/types/data.d.ts
CHANGED
|
@@ -96,7 +96,8 @@ export const enum Metric {
|
|
|
96
96
|
Mobile = 27,
|
|
97
97
|
UploadTime = 28,
|
|
98
98
|
SinglePage = 29,
|
|
99
|
-
UsedMemory = 30
|
|
99
|
+
UsedMemory = 30,
|
|
100
|
+
Iframed = 31,
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
export const enum Dimension {
|
|
@@ -170,6 +171,12 @@ export const enum BooleanFlag {
|
|
|
170
171
|
True = 1
|
|
171
172
|
}
|
|
172
173
|
|
|
174
|
+
export const enum IframeStatus {
|
|
175
|
+
Unknown = 0,
|
|
176
|
+
TopFrame = 1,
|
|
177
|
+
Iframe = 2
|
|
178
|
+
}
|
|
179
|
+
|
|
173
180
|
export const enum Setting {
|
|
174
181
|
Expire = 365, // 1 Year
|
|
175
182
|
SessionExpire = 1, // 1 Day
|