From 5374265b1f5f3dc83b35f4225a7e1642a96fd719 Mon Sep 17 00:00:00 2001 From: Tomer Lichtash Date: Tue, 17 Dec 2024 09:22:46 +0200 Subject: [PATCH 1/2] Add hybrid-field to phone auto-detect query --- packages/sdks/web-component/src/lib/helpers/templates.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/sdks/web-component/src/lib/helpers/templates.ts b/packages/sdks/web-component/src/lib/helpers/templates.ts index a64b78c4c..151791c83 100644 --- a/packages/sdks/web-component/src/lib/helpers/templates.ts +++ b/packages/sdks/web-component/src/lib/helpers/templates.ts @@ -303,7 +303,9 @@ export const setPhoneAutoDetectDefaultCode = ( autoDetectCode?: string, ) => { Array.from( - fragment.querySelectorAll('descope-phone-field[default-code="autoDetect"]'), + fragment.querySelectorAll( + 'descope-phone-field[default-code="autoDetect"], descope-hybrid-field[default-code="autoDetect"]', + ), ).forEach((phoneEle) => { phoneEle.setAttribute('default-code', autoDetectCode); }); From 623e74d1417c93b16896bdf3d98ddcfc72befa2d Mon Sep 17 00:00:00 2001 From: Tomer Lichtash Date: Wed, 18 Dec 2024 09:05:59 +0200 Subject: [PATCH 2/2] fix auto-detect query to match all components --- .../sdks/web-component/src/lib/helpers/templates.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/sdks/web-component/src/lib/helpers/templates.ts b/packages/sdks/web-component/src/lib/helpers/templates.ts index 151791c83..39d8ba8cb 100644 --- a/packages/sdks/web-component/src/lib/helpers/templates.ts +++ b/packages/sdks/web-component/src/lib/helpers/templates.ts @@ -302,13 +302,11 @@ export const setPhoneAutoDetectDefaultCode = ( fragment: DocumentFragment, autoDetectCode?: string, ) => { - Array.from( - fragment.querySelectorAll( - 'descope-phone-field[default-code="autoDetect"], descope-hybrid-field[default-code="autoDetect"]', - ), - ).forEach((phoneEle) => { - phoneEle.setAttribute('default-code', autoDetectCode); - }); + Array.from(fragment.querySelectorAll('[default-code="autoDetect"]')).forEach( + (phoneEle) => { + phoneEle.setAttribute('default-code', autoDetectCode); + }, + ); }; export const disableWebauthnButtons = (fragment: DocumentFragment) => {