🐛 (engine) Fix button validation when item content includes a comma
This commit is contained in:
@ -41,7 +41,13 @@ export const CreateNewTypebotButtons = () => {
|
||||
...typebot.theme,
|
||||
chat: {
|
||||
...typebot.theme.chat,
|
||||
hostAvatar: { isEnabled: true, url: user.image ?? undefined },
|
||||
hostAvatar: {
|
||||
isEnabled: true,
|
||||
url:
|
||||
typebot.theme.chat.hostAvatar?.url ??
|
||||
user.image ??
|
||||
undefined,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -3,9 +3,4 @@ import { ChoiceInputBlock } from 'models'
|
||||
export const validateButtonInput = (
|
||||
buttonBlock: ChoiceInputBlock,
|
||||
input: string
|
||||
) =>
|
||||
input
|
||||
.split(',')
|
||||
.every((value) =>
|
||||
buttonBlock.items.some((item) => item.content === value.trim())
|
||||
)
|
||||
) => buttonBlock.items.some((item) => item.content === input)
|
||||
|
@ -223,6 +223,7 @@ export const isReplyValid = (inputValue: string, block: Block): boolean => {
|
||||
case InputBlockType.URL:
|
||||
return validateUrl(inputValue)
|
||||
case InputBlockType.CHOICE:
|
||||
if (block.options.isMultipleChoice) return true
|
||||
return validateButtonInput(block, inputValue)
|
||||
}
|
||||
return true
|
||||
|
Reference in New Issue
Block a user