2
0

🚸 (dashboard) Soften imported bot model check

This commit is contained in:
Baptiste Arnaud
2023-01-16 17:22:34 +01:00
parent ef9170dcb6
commit 67ee197d9b
2 changed files with 5 additions and 7 deletions

View File

@ -1,8 +1,9 @@
import { useToast } from '@/hooks/useToast'
import { readFile } from '@/utils/helpers'
import { Button, ButtonProps, chakra } from '@chakra-ui/react'
import { Typebot, typebotSchema } from 'models'
import { groupSchema, Typebot } from 'models'
import React, { ChangeEvent } from 'react'
import { z } from 'zod'
type Props = {
onNewTypebot: (typebot: Typebot) => void
@ -20,11 +21,7 @@ export const ImportTypebotFromFileButton = ({
const fileContent = await readFile(file)
try {
const typebot = JSON.parse(fileContent)
typebotSchema.parse({
...typebot,
createdAt: new Date(),
updatedAt: new Date(),
})
z.array(groupSchema).parse(typebot.groups)
onNewTypebot(typebot)
} catch (err) {
console.error(err)

View File

@ -3146,7 +3146,8 @@
},
"prefilledVariables": {
"type": "object",
"additionalProperties": {}
"additionalProperties": {},
"description": "[More info about prefilled variables.](https://docs.typebot.io/editor/variables#prefilled-variables)"
}
},
"required": [