🚸 (dashboard) Soften imported bot model check
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
import { useToast } from '@/hooks/useToast'
|
import { useToast } from '@/hooks/useToast'
|
||||||
import { readFile } from '@/utils/helpers'
|
import { readFile } from '@/utils/helpers'
|
||||||
import { Button, ButtonProps, chakra } from '@chakra-ui/react'
|
import { Button, ButtonProps, chakra } from '@chakra-ui/react'
|
||||||
import { Typebot, typebotSchema } from 'models'
|
import { groupSchema, Typebot } from 'models'
|
||||||
import React, { ChangeEvent } from 'react'
|
import React, { ChangeEvent } from 'react'
|
||||||
|
import { z } from 'zod'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
onNewTypebot: (typebot: Typebot) => void
|
onNewTypebot: (typebot: Typebot) => void
|
||||||
@@ -20,11 +21,7 @@ export const ImportTypebotFromFileButton = ({
|
|||||||
const fileContent = await readFile(file)
|
const fileContent = await readFile(file)
|
||||||
try {
|
try {
|
||||||
const typebot = JSON.parse(fileContent)
|
const typebot = JSON.parse(fileContent)
|
||||||
typebotSchema.parse({
|
z.array(groupSchema).parse(typebot.groups)
|
||||||
...typebot,
|
|
||||||
createdAt: new Date(),
|
|
||||||
updatedAt: new Date(),
|
|
||||||
})
|
|
||||||
onNewTypebot(typebot)
|
onNewTypebot(typebot)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
|||||||
@@ -3146,7 +3146,8 @@
|
|||||||
},
|
},
|
||||||
"prefilledVariables": {
|
"prefilledVariables": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": {}
|
"additionalProperties": {},
|
||||||
|
"description": "[More info about prefilled variables.](https://docs.typebot.io/editor/variables#prefilled-variables)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
|
|||||||
Reference in New Issue
Block a user