Skip to content

Commit

Permalink
Merge pull request #597 from microsoft/swradhak/fixinputradioandcheckbox
Browse files Browse the repository at this point in the history
fix input checkbox and radio state
  • Loading branch information
ender336 authored Sep 16, 2024
2 parents 0de08f8 + 84cc56b commit 3b8b400
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "0.7.46",
"version": "0.7.47",
"npmClient": "yarn",
"useWorkspaces": true
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions packages/clarity-decode/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions packages/clarity-devtools/package.json
Original file line number Diff line number Diff line change
@@ -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.",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/clarity-devtools/static/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/clarity-js/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 5 additions & 1 deletion packages/clarity-js/src/core/scrub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/clarity-js/src/core/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
let version = "0.7.46";
let version = "0.7.47";
export default version;
2 changes: 1 addition & 1 deletion packages/clarity-js/src/interaction/encode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default async function (type: Event, ts: number = null): Promise<void> {
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();
Expand Down
3 changes: 2 additions & 1 deletion packages/clarity-js/src/interaction/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ 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":
v = input.checked ? "true" : "false";
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(); }
Expand Down
1 change: 1 addition & 0 deletions packages/clarity-js/types/interaction.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export interface ChangeData {
export interface InputData {
target: Target;
value: string;
type?: string;
}

export interface SubmitData {
Expand Down
4 changes: 2 additions & 2 deletions packages/clarity-visualize/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 3b8b400

Please sign in to comment.