🐛 Fix typebot publishing endpoint events parsing
This commit is contained in:
@@ -81,7 +81,11 @@ export const publishTypebot = authenticatedProcedure
|
|||||||
groups: parseGroups(existingTypebot.groups, {
|
groups: parseGroups(existingTypebot.groups, {
|
||||||
typebotVersion: existingTypebot.version,
|
typebotVersion: existingTypebot.version,
|
||||||
}),
|
}),
|
||||||
events: z.tuple([startEventSchema]).parse(existingTypebot.events),
|
events:
|
||||||
|
(existingTypebot.version === '6'
|
||||||
|
? z.tuple([startEventSchema])
|
||||||
|
: z.null()
|
||||||
|
).parse(existingTypebot.events) ?? undefined,
|
||||||
settings: settingsSchema.parse(existingTypebot.settings),
|
settings: settingsSchema.parse(existingTypebot.settings),
|
||||||
variables: z.array(variableSchema).parse(existingTypebot.variables),
|
variables: z.array(variableSchema).parse(existingTypebot.variables),
|
||||||
theme: themeSchema.parse(existingTypebot.theme),
|
theme: themeSchema.parse(existingTypebot.theme),
|
||||||
@@ -96,7 +100,11 @@ export const publishTypebot = authenticatedProcedure
|
|||||||
groups: parseGroups(existingTypebot.groups, {
|
groups: parseGroups(existingTypebot.groups, {
|
||||||
typebotVersion: existingTypebot.version,
|
typebotVersion: existingTypebot.version,
|
||||||
}),
|
}),
|
||||||
events: z.tuple([startEventSchema]).parse(existingTypebot.events),
|
events:
|
||||||
|
(existingTypebot.version === '6'
|
||||||
|
? z.tuple([startEventSchema])
|
||||||
|
: z.null()
|
||||||
|
).parse(existingTypebot.events) ?? undefined,
|
||||||
settings: settingsSchema.parse(existingTypebot.settings),
|
settings: settingsSchema.parse(existingTypebot.settings),
|
||||||
variables: z.array(variableSchema).parse(existingTypebot.variables),
|
variables: z.array(variableSchema).parse(existingTypebot.variables),
|
||||||
theme: themeSchema.parse(existingTypebot.theme),
|
theme: themeSchema.parse(existingTypebot.theme),
|
||||||
|
|||||||
Reference in New Issue
Block a user