✨ Add new Jump block
Also improve Select input with a clear button Closes #186
This commit is contained in:
@ -5,4 +5,5 @@ export enum LogicBlockType {
|
||||
SCRIPT = 'Code',
|
||||
TYPEBOT_LINK = 'Typebot link',
|
||||
WAIT = 'Wait',
|
||||
JUMP = 'Jump',
|
||||
}
|
||||
|
17
packages/models/features/blocks/logic/jump.ts
Normal file
17
packages/models/features/blocks/logic/jump.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { z } from 'zod'
|
||||
import { blockBaseSchema } from '../baseSchemas'
|
||||
import { LogicBlockType } from './enums'
|
||||
|
||||
export const jumpOptionsSchema = z.object({
|
||||
groupId: z.string().optional(),
|
||||
blockId: z.string().optional(),
|
||||
})
|
||||
|
||||
export const jumpBlockSchema = blockBaseSchema.and(
|
||||
z.object({
|
||||
type: z.enum([LogicBlockType.JUMP]),
|
||||
options: jumpOptionsSchema,
|
||||
})
|
||||
)
|
||||
|
||||
export type JumpBlock = z.infer<typeof jumpBlockSchema>
|
@ -5,12 +5,14 @@ import { redirectOptionsSchema, redirectBlockSchema } from './redirect'
|
||||
import { setVariableOptionsSchema, setVariableBlockSchema } from './setVariable'
|
||||
import { typebotLinkOptionsSchema, typebotLinkBlockSchema } from './typebotLink'
|
||||
import { waitBlockSchema, waitOptionsSchema } from './wait'
|
||||
import { jumpBlockSchema, jumpOptionsSchema } from './jump'
|
||||
|
||||
const logicBlockOptionsSchema = scriptOptionsSchema
|
||||
.or(redirectOptionsSchema)
|
||||
.or(setVariableOptionsSchema)
|
||||
.or(typebotLinkOptionsSchema)
|
||||
.or(waitOptionsSchema)
|
||||
.or(jumpOptionsSchema)
|
||||
|
||||
export const logicBlockSchema = scriptBlockSchema
|
||||
.or(conditionBlockSchema)
|
||||
@ -18,6 +20,7 @@ export const logicBlockSchema = scriptBlockSchema
|
||||
.or(typebotLinkBlockSchema)
|
||||
.or(setVariableBlockSchema)
|
||||
.or(waitBlockSchema)
|
||||
.or(jumpBlockSchema)
|
||||
|
||||
export type LogicBlock = z.infer<typeof logicBlockSchema>
|
||||
export type LogicBlockOptions = z.infer<typeof logicBlockOptionsSchema>
|
||||
|
Reference in New Issue
Block a user