clarity-js 0.8.37 → 0.8.38-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 +52 -21
- package/build/clarity.min.js +1 -1
- package/build/clarity.module.js +52 -21
- package/build/clarity.performance.js +1 -1
- package/build/dynamic/clarity.crisp.js +1 -0
- package/package.json +3 -2
- package/rollup.config.ts +26 -3
- package/src/core/dynamic.ts +20 -4
- package/src/core/version.ts +1 -1
- package/src/data/baseline.ts +7 -0
- package/src/data/encode.ts +1 -0
- package/src/data/upload.ts +2 -2
- package/src/dynamic/agent/crisp.ts +40 -0
- package/src/dynamic/agent/index.ts +2 -0
- package/src/interaction/click.ts +16 -5
- package/src/interaction/encode.ts +3 -0
- package/src/performance/blank.ts +2 -0
- package/types/data.d.ts +4 -0
- package/types/global.d.ts +5 -0
- package/types/interaction.d.ts +3 -0
- /package/build/{clarity.tidio.js → dynamic/clarity.tidio.js} +0 -0
package/src/interaction/click.ts
CHANGED
|
@@ -70,6 +70,9 @@ function handler(event: Event, root: Node, evt: MouseEvent): void {
|
|
|
70
70
|
hash: null,
|
|
71
71
|
trust: evt.isTrusted ? BooleanFlag.True : BooleanFlag.False,
|
|
72
72
|
isFullText: textInfo.isFullText,
|
|
73
|
+
tag: getElementAttribute(t, "tagName").substring(0, Setting.ClickTag),
|
|
74
|
+
class: getElementAttribute(t, "className").substring(0, Setting.ClickClass),
|
|
75
|
+
id: getElementAttribute(t, "id").substring(0, Setting.ClickId),
|
|
73
76
|
}
|
|
74
77
|
});
|
|
75
78
|
schedule(encode.bind(this, event));
|
|
@@ -109,15 +112,23 @@ function text(element: Node): TextInfo {
|
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
function reaction(element: Node): BooleanFlag {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
115
|
+
const tagName = getElementAttribute(element, "tagName");
|
|
116
|
+
|
|
117
|
+
if (UserInputTags.indexOf(tagName) >= 0) {
|
|
118
|
+
return BooleanFlag.False;
|
|
117
119
|
}
|
|
118
120
|
return BooleanFlag.True;
|
|
119
121
|
}
|
|
120
122
|
|
|
123
|
+
function getElementAttribute(element: Node, attribute: "tagName" | "className" | "id"): string {
|
|
124
|
+
if (element.nodeType === Node.ELEMENT_NODE) {
|
|
125
|
+
const attr = (element as HTMLElement)?.[attribute];
|
|
126
|
+
const value = typeof attr === "string" ? attr?.toLowerCase() : "";
|
|
127
|
+
return value;
|
|
128
|
+
}
|
|
129
|
+
return "";
|
|
130
|
+
}
|
|
131
|
+
|
|
121
132
|
function layout(element: Element): Box {
|
|
122
133
|
let box: Box = null;
|
|
123
134
|
let de = document.documentElement;
|
|
@@ -72,6 +72,9 @@ export default async function (type: Event, ts: number = null): Promise<void> {
|
|
|
72
72
|
tokens.push(cHash);
|
|
73
73
|
tokens.push(entry.data.trust);
|
|
74
74
|
tokens.push(entry.data.isFullText);
|
|
75
|
+
tokens.push(entry.data.tag);
|
|
76
|
+
tokens.push(entry.data.class);
|
|
77
|
+
tokens.push(entry.data.id);
|
|
75
78
|
queue(tokens);
|
|
76
79
|
timeline.track(entry.time, entry.event, cHash, entry.data.x, entry.data.y, entry.data.reaction, entry.data.context);
|
|
77
80
|
}
|
package/src/performance/blank.ts
CHANGED
package/types/data.d.ts
CHANGED
|
@@ -253,6 +253,9 @@ export const enum Setting {
|
|
|
253
253
|
PingTimeout = 5 * Time.Minute, // 5 Minutes
|
|
254
254
|
SummaryInterval = 100, // Same events within 100ms will be collapsed into single summary
|
|
255
255
|
ClickText = 25, // Maximum number of characters to send as part of Click event's text field
|
|
256
|
+
ClickClass = 50, // Maximum number of characters to send as part of Click event's class name
|
|
257
|
+
ClickTag = 10, // Maximum number of characters to send as part of Click event's tag
|
|
258
|
+
ClickId = 25, // Maximum number of characters to send as part of Click event's id
|
|
256
259
|
PayloadLimit = 128, // Do not allow more than specified payloads per page
|
|
257
260
|
PageLimit = 128, // Do not allow more than 128 pages in a session
|
|
258
261
|
ShutdownLimit = 2 * Time.Hour, // Shutdown instrumentation after specified time
|
|
@@ -473,6 +476,7 @@ export interface BaselineData {
|
|
|
473
476
|
pointerPrevX?: number;
|
|
474
477
|
pointerPrevY?: number;
|
|
475
478
|
pointerPrevTime?: number;
|
|
479
|
+
modules: number[];
|
|
476
480
|
}
|
|
477
481
|
|
|
478
482
|
export interface IdentityData {
|
package/types/global.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ declare global {
|
|
|
14
14
|
tidioChatApi?: {
|
|
15
15
|
on: (eventName: string, callback: (data: any) => void) => void;
|
|
16
16
|
};
|
|
17
|
+
$crisp?: {
|
|
18
|
+
push: (
|
|
19
|
+
args: [action: string, eventName: string, callback: (data: any) => void]
|
|
20
|
+
) => void;
|
|
21
|
+
};
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
interface Function {
|
package/types/interaction.d.ts
CHANGED
|
File without changes
|