2
0

Introduce bot v2 in builder (#328)

Also, the new engine is the default for updated typebots for viewer

Closes #211
This commit is contained in:
Baptiste Arnaud
2023-02-21 15:25:14 +01:00
committed by GitHub
parent 527dc8a5b1
commit debdac12ff
208 changed files with 4462 additions and 5236 deletions

View File

@ -78,6 +78,7 @@ export const importTypebotInDatabase = async (
...JSON.parse(readFileSync(path).toString()),
workspaceId: proWorkspaceId,
...updates,
version: '3',
}
await prisma.typebot.create({
data: parseCreateTypebot(typebot),

View File

@ -16,6 +16,7 @@ export const parseTestTypebot = (
partialTypebot: Partial<Typebot>
): Typebot => ({
id: createId(),
version: '3',
workspaceId: proWorkspaceId,
folderId: null,
name: 'My typebot',
@ -62,6 +63,7 @@ export const parseTypebotToPublicTypebot = (
typebot: Typebot
): Omit<PublicTypebot, 'createdAt' | 'updatedAt'> => ({
id,
version: typebot.version,
groups: typebot.groups,
typebotId: typebot.id,
theme: typebot.theme,

View File

@ -1,15 +0,0 @@
import { Typebot } from 'models'
export const convertTypebotToV2 = (typebot: any): Typebot => {
const newTypebot = JSON.parse(
JSON.stringify(typebot)
.replace(/\"blocks\":/g, '"groups":')
.replace(/\"steps\":/g, '"blocks":')
.replace(/\"blockId\":/g, '"groupId":')
.replace(/\"blockId\":/g, '"blockId":')
)
return {
version: '2',
...newTypebot,
}
}