@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typebot.io/js",
|
||||
"version": "0.2.61",
|
||||
"version": "0.2.62",
|
||||
"description": "Javascript library to display typebots on your website",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
|
@ -23,7 +23,8 @@ export const EmailInput = (props: Props) => {
|
||||
inputRef?.value !== '' && inputRef?.reportValidity()
|
||||
|
||||
const submit = () => {
|
||||
if (checkIfInputIsValid()) props.onSubmit({ value: inputValue() })
|
||||
if (checkIfInputIsValid())
|
||||
props.onSubmit({ value: inputRef?.value ?? inputValue() })
|
||||
else inputRef?.focus()
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ export const NumberInput = (props: NumberInputProps) => {
|
||||
|
||||
const submit = () => {
|
||||
if (checkIfInputIsValid())
|
||||
props.onSubmit({ value: inputValue().toString() })
|
||||
props.onSubmit({ value: inputRef?.value ?? inputValue().toString() })
|
||||
else inputRef?.focus()
|
||||
}
|
||||
|
||||
|
@ -63,13 +63,14 @@ export const PhoneInput = (props: PhoneInputProps) => {
|
||||
const selectedCountryDialCode = phoneCountries.find(
|
||||
(country) => country.code === selectedCountryCode()
|
||||
)?.dial_code
|
||||
if (checkIfInputIsValid())
|
||||
if (checkIfInputIsValid()) {
|
||||
const val = inputRef?.value ?? inputValue()
|
||||
props.onSubmit({
|
||||
value: inputValue().startsWith('+')
|
||||
? inputValue()
|
||||
: `${selectedCountryDialCode ?? ''}${inputValue()}`,
|
||||
value: val.startsWith('+')
|
||||
? val
|
||||
: `${selectedCountryDialCode ?? ''}${val}`,
|
||||
})
|
||||
else inputRef?.focus()
|
||||
} else inputRef?.focus()
|
||||
}
|
||||
|
||||
const submitWhenEnter = (e: KeyboardEvent) => {
|
||||
|
@ -23,7 +23,8 @@ export const TextInput = (props: Props) => {
|
||||
inputRef?.value !== '' && inputRef?.reportValidity()
|
||||
|
||||
const submit = () => {
|
||||
if (checkIfInputIsValid()) props.onSubmit({ value: inputValue() })
|
||||
if (checkIfInputIsValid())
|
||||
props.onSubmit({ value: inputRef?.value ?? inputValue() })
|
||||
else inputRef?.focus()
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,8 @@ export const UrlInput = (props: Props) => {
|
||||
inputRef?.value !== '' && inputRef?.reportValidity()
|
||||
|
||||
const submit = () => {
|
||||
if (checkIfInputIsValid()) props.onSubmit({ value: inputValue() })
|
||||
if (checkIfInputIsValid())
|
||||
props.onSubmit({ value: inputRef?.value ?? inputValue() })
|
||||
else inputRef?.focus()
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,13 @@ export const guessApiHost = (
|
||||
return chatApiUrl
|
||||
}
|
||||
|
||||
return (
|
||||
getRuntimeVariable('NEXT_PUBLIC_VIEWER_URL')?.split(',')[0] ??
|
||||
chatApiCloudFallbackHost
|
||||
const viewerUrls = getRuntimeVariable('NEXT_PUBLIC_VIEWER_URL')?.split(
|
||||
','
|
||||
) as string[] | undefined
|
||||
|
||||
const matchedUrl = viewerUrls?.find((url) =>
|
||||
window.location.href.startsWith(url)
|
||||
)
|
||||
|
||||
return matchedUrl ?? chatApiCloudFallbackHost
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typebot.io/nextjs",
|
||||
"version": "0.2.61",
|
||||
"version": "0.2.62",
|
||||
"description": "Convenient library to display typebots on your Next.js website",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typebot.io/react",
|
||||
"version": "0.2.61",
|
||||
"version": "0.2.62",
|
||||
"description": "Convenient library to display typebots on your React app",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
Reference in New Issue
Block a user