From 9809db75c7954826f3b69645d437b6d7c712e04d Mon Sep 17 00:00:00 2001 From: Swaathee Radhakrishnan Date: Fri, 10 May 2024 10:20:18 -0700 Subject: [PATCH 1/3] fix input checkbox and radio --- packages/clarity-js/src/core/scrub.ts | 6 +++++- packages/clarity-js/src/interaction/encode.ts | 2 +- packages/clarity-js/src/interaction/input.ts | 3 ++- packages/clarity-js/types/interaction.d.ts | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/clarity-js/src/core/scrub.ts b/packages/clarity-js/src/core/scrub.ts index b74cb6ff..e1fe5927 100644 --- a/packages/clarity-js/src/core/scrub.ts +++ b/packages/clarity-js/src/core/scrub.ts @@ -9,8 +9,12 @@ let digitRegex = null; let letterRegex = null; let currencyRegex = null; -export function text(value: string, hint: string, privacy: Privacy, mangle: boolean = false): string { +export function text(value: string, hint: string, privacy: Privacy, mangle: boolean = false, type?: string): string { if (value) { + if (hint == "input" && type == "checkbox" || type == "radio") { + return value; + } + switch (privacy) { case Privacy.None: return value; diff --git a/packages/clarity-js/src/interaction/encode.ts b/packages/clarity-js/src/interaction/encode.ts index 1fa8ef64..a54d31fb 100644 --- a/packages/clarity-js/src/interaction/encode.ts +++ b/packages/clarity-js/src/interaction/encode.ts @@ -96,7 +96,7 @@ export default async function (type: Event, ts: number = null): Promise { let iTarget = metadata(entry.data.target as Node, entry.event, entry.data.value); tokens = [entry.time, entry.event]; tokens.push(iTarget.id); - tokens.push(scrub.text(entry.data.value, "input", iTarget.privacy)); + tokens.push(scrub.text(entry.data.value, "input", iTarget.privacy, false, entry.data.type)); queue(tokens); } input.reset(); diff --git a/packages/clarity-js/src/interaction/input.ts b/packages/clarity-js/src/interaction/input.ts index 2c85183d..3d0b7574 100644 --- a/packages/clarity-js/src/interaction/input.ts +++ b/packages/clarity-js/src/interaction/input.ts @@ -24,6 +24,7 @@ function recompute(evt: UIEvent): void { let value = get(input); if (input && input.type && value) { let v = input.value; + let t = input.type; switch (input.type) { case "radio": case "checkbox": @@ -31,7 +32,7 @@ function recompute(evt: UIEvent): void { break; } - let data: InputData = { target: input, value: v }; + let data: InputData = { target: input, value: v, type: t }; // If last entry in the queue is for the same target node as the current one, remove it so we can later swap it with current data. if (state.length > 0 && (state[state.length - 1].data.target === data.target)) { state.pop(); } diff --git a/packages/clarity-js/types/interaction.d.ts b/packages/clarity-js/types/interaction.d.ts index 17c104b3..a7d62418 100644 --- a/packages/clarity-js/types/interaction.d.ts +++ b/packages/clarity-js/types/interaction.d.ts @@ -93,6 +93,7 @@ export interface ChangeData { export interface InputData { target: Target; value: string; + type?: string; } export interface SubmitData { From 20a640c746607a1f15109edd51328fb35f4d2d77 Mon Sep 17 00:00:00 2001 From: Swaathee Radhakrishnan Date: Fri, 10 May 2024 14:15:25 -0700 Subject: [PATCH 2/3] resolve comment --- packages/clarity-js/src/core/scrub.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/clarity-js/src/core/scrub.ts b/packages/clarity-js/src/core/scrub.ts index e1fe5927..3d56dc62 100644 --- a/packages/clarity-js/src/core/scrub.ts +++ b/packages/clarity-js/src/core/scrub.ts @@ -11,7 +11,7 @@ let currencyRegex = null; export function text(value: string, hint: string, privacy: Privacy, mangle: boolean = false, type?: string): string { if (value) { - if (hint == "input" && type == "checkbox" || type == "radio") { + if (hint == "input" && (type == "checkbox" || type == "radio")) { return value; } From 84cc56bc7e19e772496bd7c95d5ed6bdd422c346 Mon Sep 17 00:00:00 2001 From: Sam Martin Date: Mon, 16 Sep 2024 12:19:58 -0700 Subject: [PATCH 3/3] updating version --- lerna.json | 2 +- package.json | 2 +- packages/clarity-decode/package.json | 4 ++-- packages/clarity-devtools/package.json | 8 ++++---- packages/clarity-devtools/static/manifest.json | 4 ++-- packages/clarity-js/package.json | 2 +- packages/clarity-js/src/core/scrub.ts | 2 +- packages/clarity-js/src/core/version.ts | 2 +- packages/clarity-visualize/package.json | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lerna.json b/lerna.json index 5077ca41..eac2d6be 100644 --- a/lerna.json +++ b/lerna.json @@ -2,7 +2,7 @@ "packages": [ "packages/*" ], - "version": "0.7.46", + "version": "0.7.47", "npmClient": "yarn", "useWorkspaces": true } diff --git a/package.json b/package.json index 46928b9a..a6267eea 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "clarity", "private": true, - "version": "0.7.46", + "version": "0.7.47", "repository": "https://github.com/microsoft/clarity.git", "author": "Sarvesh Nagpal ", "license": "MIT", diff --git a/packages/clarity-decode/package.json b/packages/clarity-decode/package.json index dceebbde..35f98ee7 100644 --- a/packages/clarity-decode/package.json +++ b/packages/clarity-decode/package.json @@ -1,6 +1,6 @@ { "name": "clarity-decode", - "version": "0.7.46", + "version": "0.7.47", "description": "An analytics library that uses web page interactions to generate aggregated insights", "author": "Microsoft Corp.", "license": "MIT", @@ -26,7 +26,7 @@ "url": "https://github.com/Microsoft/clarity/issues" }, "dependencies": { - "clarity-js": "^0.7.46" + "clarity-js": "^0.7.47" }, "devDependencies": { "@rollup/plugin-commonjs": "^24.0.0", diff --git a/packages/clarity-devtools/package.json b/packages/clarity-devtools/package.json index 38072768..cab8b08f 100644 --- a/packages/clarity-devtools/package.json +++ b/packages/clarity-devtools/package.json @@ -1,6 +1,6 @@ { "name": "clarity-devtools", - "version": "0.7.46", + "version": "0.7.47", "private": true, "description": "Adds Clarity debugging support to browser devtools", "author": "Microsoft Corp.", @@ -24,9 +24,9 @@ "url": "https://github.com/Microsoft/clarity/issues" }, "dependencies": { - "clarity-decode": "^0.7.46", - "clarity-js": "^0.7.46", - "clarity-visualize": "^0.7.46" + "clarity-decode": "^0.7.47", + "clarity-js": "^0.7.47", + "clarity-visualize": "^0.7.47" }, "devDependencies": { "@rollup/plugin-node-resolve": "^15.0.0", diff --git a/packages/clarity-devtools/static/manifest.json b/packages/clarity-devtools/static/manifest.json index ffdebcb3..4da012f3 100644 --- a/packages/clarity-devtools/static/manifest.json +++ b/packages/clarity-devtools/static/manifest.json @@ -2,8 +2,8 @@ "manifest_version": 2, "name": "Microsoft Clarity Developer Tools", "description": "Clarity helps you understand how users are interacting with your website.", - "version": "0.7.46", - "version_name": "0.7.46", + "version": "0.7.47", + "version_name": "0.7.47", "minimum_chrome_version": "50", "devtools_page": "devtools.html", "icons": { diff --git a/packages/clarity-js/package.json b/packages/clarity-js/package.json index 46450f76..cd6818ad 100644 --- a/packages/clarity-js/package.json +++ b/packages/clarity-js/package.json @@ -1,6 +1,6 @@ { "name": "clarity-js", - "version": "0.7.46", + "version": "0.7.47", "description": "An analytics library that uses web page interactions to generate aggregated insights", "author": "Microsoft Corp.", "license": "MIT", diff --git a/packages/clarity-js/src/core/scrub.ts b/packages/clarity-js/src/core/scrub.ts index 3d56dc62..5484178b 100644 --- a/packages/clarity-js/src/core/scrub.ts +++ b/packages/clarity-js/src/core/scrub.ts @@ -11,7 +11,7 @@ let currencyRegex = null; export function text(value: string, hint: string, privacy: Privacy, mangle: boolean = false, type?: string): string { if (value) { - if (hint == "input" && (type == "checkbox" || type == "radio")) { + if (hint == "input" && (type === "checkbox" || type === "radio")) { return value; } diff --git a/packages/clarity-js/src/core/version.ts b/packages/clarity-js/src/core/version.ts index 3966967f..58073e83 100644 --- a/packages/clarity-js/src/core/version.ts +++ b/packages/clarity-js/src/core/version.ts @@ -1,2 +1,2 @@ -let version = "0.7.46"; +let version = "0.7.47"; export default version; diff --git a/packages/clarity-visualize/package.json b/packages/clarity-visualize/package.json index 3692e0ea..a5c13d89 100644 --- a/packages/clarity-visualize/package.json +++ b/packages/clarity-visualize/package.json @@ -1,6 +1,6 @@ { "name": "clarity-visualize", - "version": "0.7.46", + "version": "0.7.47", "description": "An analytics library that uses web page interactions to generate aggregated insights", "author": "Microsoft Corp.", "license": "MIT", @@ -27,7 +27,7 @@ "url": "https://github.com/Microsoft/clarity/issues" }, "dependencies": { - "clarity-decode": "^0.7.46" + "clarity-decode": "^0.7.47" }, "devDependencies": { "@rollup/plugin-commonjs": "^24.0.0",