2
0

Add conditional choice items

Allows you to conditonnally display an item from the Buttons or the Picture choice input

Closes #546
This commit is contained in:
Baptiste Arnaud
2023-06-05 17:33:43 +02:00
parent acaa1c6223
commit ef0a2d9dc6
18 changed files with 404 additions and 157 deletions

View File

@ -4,6 +4,7 @@ import { itemBaseSchema } from '../../items/baseSchemas'
import { optionBaseSchema, blockBaseSchema } from '../baseSchemas'
import { defaultButtonLabel } from './constants'
import { InputBlockType } from './enums'
import { conditionSchema } from '../logic/condition'
export const choiceInputOptionsSchema = optionBaseSchema.merge(
z.object({
@ -26,6 +27,12 @@ export const buttonItemSchema = itemBaseSchema.merge(
z.object({
type: z.literal(ItemType.BUTTON),
content: z.string().optional(),
displayCondition: z
.object({
isEnabled: z.boolean().optional(),
condition: conditionSchema.optional(),
})
.optional(),
})
)