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