diff --git a/packages/embeds/js/package.json b/packages/embeds/js/package.json index db6b73a99..a5a4676c5 100644 --- a/packages/embeds/js/package.json +++ b/packages/embeds/js/package.json @@ -1,6 +1,6 @@ { "name": "@typebot.io/js", - "version": "0.3.47", + "version": "0.3.48", "description": "Javascript library to display typebots on your website", "license": "FSL-1.1-ALv2", "type": "module", diff --git a/packages/embeds/js/src/features/blocks/inputs/phone/components/PhoneInput.tsx b/packages/embeds/js/src/features/blocks/inputs/phone/components/PhoneInput.tsx index 53ecead48..1b9d9f235 100644 --- a/packages/embeds/js/src/features/blocks/inputs/phone/components/PhoneInput.tsx +++ b/packages/embeds/js/src/features/blocks/inputs/phone/components/PhoneInput.tsx @@ -27,33 +27,27 @@ export const PhoneInput = (props: PhoneInputProps) => { const handleInput = (inputValue: string | undefined) => { setInputValue(inputValue as string); - if ( - (inputValue === "" || inputValue === "+") && - selectedCountryCode() !== "INT" - ) - setSelectedCountryCode("INT"); - const matchedCountry = - inputValue?.startsWith("+") && - inputValue.length > 2 && - phoneCountries.reduce<(typeof phoneCountries)[number] | null>( - (matchedCountry, country) => { - if ( - !country?.dial_code || - (matchedCountry !== null && !matchedCountry.dial_code) - ) { - return matchedCountry; - } - if ( - inputValue?.startsWith(country.dial_code) && - country.dial_code.length > (matchedCountry?.dial_code.length ?? 0) - ) { - return country; - } + + if (inputValue?.startsWith("+") && inputValue.length > 2) { + const matchedCountry = phoneCountries.reduce< + (typeof phoneCountries)[number] | null + >((matchedCountry, country) => { + if ( + !country?.dial_code || + (matchedCountry !== null && !matchedCountry.dial_code) + ) { return matchedCountry; - }, - null, - ); - if (matchedCountry) setSelectedCountryCode(matchedCountry.code); + } + if ( + inputValue?.startsWith(country.dial_code) && + country.dial_code.length > (matchedCountry?.dial_code.length ?? 0) + ) { + return country; + } + return matchedCountry; + }, null); + if (matchedCountry) setSelectedCountryCode(matchedCountry.code); + } }; const checkIfInputIsValid = () => diff --git a/packages/embeds/nextjs/package.json b/packages/embeds/nextjs/package.json index 3bc0e6136..6f2b1b48e 100644 --- a/packages/embeds/nextjs/package.json +++ b/packages/embeds/nextjs/package.json @@ -1,6 +1,6 @@ { "name": "@typebot.io/nextjs", - "version": "0.3.47", + "version": "0.3.48", "license": "FSL-1.1-ALv2", "description": "Convenient library to display typebots on your Next.js website", "type": "module", diff --git a/packages/embeds/react/package.json b/packages/embeds/react/package.json index a6a54d4ca..25b36c360 100644 --- a/packages/embeds/react/package.json +++ b/packages/embeds/react/package.json @@ -1,6 +1,6 @@ { "name": "@typebot.io/react", - "version": "0.3.47", + "version": "0.3.48", "description": "Convenient library to display typebots on your React app", "license": "FSL-1.1-ALv2", "type": "module",