🚸 Improve parsing preprocessing on typebots

This commit is contained in:
Baptiste Arnaud
2023-08-23 10:57:38 +02:00
parent fe54888350
commit 0acede92ef
24 changed files with 132 additions and 584 deletions

View File

@@ -1,4 +1,3 @@
import { parseInvalidTypebot } from '@/features/typebot/helpers/parseInvalidTypebot'
import { useToast } from '@/hooks/useToast'
import { Button, ButtonProps, chakra } from '@chakra-ui/react'
import { Typebot, typebotCreateSchema } from '@typebot.io/schemas'
@@ -19,9 +18,7 @@ export const ImportTypebotFromFileButton = ({
const file = e.target.files[0]
const fileContent = await readFile(file)
try {
const typebot = typebotCreateSchema.parse(
parseInvalidTypebot(JSON.parse(fileContent))
)
const typebot = typebotCreateSchema.parse(JSON.parse(fileContent))
onNewTypebot(typebot as Typebot)
} catch (err) {
console.error(err)