2
0

🐛 Fix variable buttons with new engine

This commit is contained in:
Baptiste Arnaud
2023-02-21 18:00:09 +01:00
parent a4e3f4bf9c
commit 83ae57cf0c
5 changed files with 16 additions and 6 deletions

View File

@ -29,4 +29,4 @@ export const parseReactBotProps = ({ typebot, apiHost }: BotProps) => {
return `${typebotLine} ${apiHostLine}` return `${typebotLine} ${apiHostLine}`
} }
export const typebotImportUrl = `https://cdn.jsdelivr.net/npm/@typebot.io/js@0.0.9/dist/web.js` export const typebotImportUrl = `https://cdn.jsdelivr.net/npm/@typebot.io/js@0.0.10/dist/web.js`

View File

@ -3,4 +3,9 @@ import { ChoiceInputBlock } from 'models'
export const validateButtonInput = ( export const validateButtonInput = (
buttonBlock: ChoiceInputBlock, buttonBlock: ChoiceInputBlock,
input: string input: string
) => buttonBlock.items.some((item) => item.content === input) ) =>
buttonBlock.items.some(
(item) =>
item.content === input ||
(item.content?.startsWith('{{') && item.content.endsWith('}}'))
)

View File

@ -1,6 +1,6 @@
{ {
"name": "@typebot.io/js", "name": "@typebot.io/js",
"version": "0.0.9", "version": "0.0.10",
"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",

View File

@ -1,5 +1,6 @@
import { SendButton, Spinner } from '@/components/SendButton' import { SendButton, Spinner } from '@/components/SendButton'
import { BotContext, InputSubmitContent } from '@/types' import { BotContext, InputSubmitContent } from '@/types'
import { guessApiHost } from '@/utils/guessApiHost'
import { FileInputBlock } from 'models' import { FileInputBlock } from 'models'
import { defaultFileInputOptions } from 'models/features/blocks/inputs/file' import { defaultFileInputOptions } from 'models/features/blocks/inputs/file'
import { createSignal, Match, Show, Switch } from 'solid-js' import { createSignal, Match, Show, Switch } from 'solid-js'
@ -50,7 +51,9 @@ export const FileUploadForm = (props: Props) => {
}) })
setIsUploading(true) setIsUploading(true)
const urls = await uploadFiles({ const urls = await uploadFiles({
basePath: `/api/typebots/${props.context.typebotId}/blocks/${props.block.id}`, basePath: `${props.context.apiHost ?? guessApiHost()}/api/typebots/${
props.context.typebotId
}/blocks/${props.block.id}`,
files: [ files: [
{ {
file, file,
@ -73,7 +76,9 @@ export const FileUploadForm = (props: Props) => {
}) })
setIsUploading(true) setIsUploading(true)
const urls = await uploadFiles({ const urls = await uploadFiles({
basePath: `/api/typebots/${props.context.typebotId}/blocks/${props.block.id}`, basePath: `${props.context.apiHost ?? guessApiHost()}/api/typebots/${
props.context.typebotId
}/blocks/${props.block.id}`,
files: files.map((file) => ({ files: files.map((file) => ({
file: file, file: file,
path: `public/results/${props.context.resultId}/${props.block.id}/${file.name}`, path: `public/results/${props.context.resultId}/${props.block.id}/${file.name}`,

View File

@ -1,6 +1,6 @@
{ {
"name": "@typebot.io/react", "name": "@typebot.io/react",
"version": "0.0.9", "version": "0.0.10",
"description": "React library to display typebots on your website", "description": "React library to display typebots on your website",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",