2022-06-11 07:27:38 +02:00
|
|
|
import { z } from 'zod'
|
2023-01-27 15:58:05 +01:00
|
|
|
import { scriptOptionsSchema, scriptBlockSchema } from './script'
|
2022-06-11 07:27:38 +02:00
|
|
|
import { conditionBlockSchema } from './condition'
|
|
|
|
import { redirectOptionsSchema, redirectBlockSchema } from './redirect'
|
|
|
|
import { setVariableOptionsSchema, setVariableBlockSchema } from './setVariable'
|
|
|
|
import { typebotLinkOptionsSchema, typebotLinkBlockSchema } from './typebotLink'
|
2023-01-26 18:23:09 +01:00
|
|
|
import { waitBlockSchema, waitOptionsSchema } from './wait'
|
2023-03-03 15:03:31 +01:00
|
|
|
import { jumpBlockSchema, jumpOptionsSchema } from './jump'
|
2022-06-11 07:27:38 +02:00
|
|
|
|
2023-01-27 15:58:05 +01:00
|
|
|
const logicBlockOptionsSchema = scriptOptionsSchema
|
2022-06-11 07:27:38 +02:00
|
|
|
.or(redirectOptionsSchema)
|
|
|
|
.or(setVariableOptionsSchema)
|
|
|
|
.or(typebotLinkOptionsSchema)
|
2023-01-26 18:23:09 +01:00
|
|
|
.or(waitOptionsSchema)
|
2023-03-03 15:03:31 +01:00
|
|
|
.or(jumpOptionsSchema)
|
2022-06-11 07:27:38 +02:00
|
|
|
|
2023-01-27 15:58:05 +01:00
|
|
|
export const logicBlockSchema = scriptBlockSchema
|
2022-06-11 07:27:38 +02:00
|
|
|
.or(conditionBlockSchema)
|
|
|
|
.or(redirectBlockSchema)
|
|
|
|
.or(typebotLinkBlockSchema)
|
|
|
|
.or(setVariableBlockSchema)
|
2023-01-26 18:23:09 +01:00
|
|
|
.or(waitBlockSchema)
|
2023-03-03 15:03:31 +01:00
|
|
|
.or(jumpBlockSchema)
|
2022-06-11 07:27:38 +02:00
|
|
|
|
|
|
|
export type LogicBlock = z.infer<typeof logicBlockSchema>
|
|
|
|
export type LogicBlockOptions = z.infer<typeof logicBlockOptionsSchema>
|