2
0
Files
bot/packages/schemas/features/blocks/bubbles/text/schema.ts
Baptiste Arnaud 35300eaf34 ♻️ Introduce typebot v6 with events (#1013)
Closes #885
2023-11-08 15:34:16 +01:00

25 lines
677 B
TypeScript

import { z } from 'zod'
import type { TElement } from '@udecode/plate-common'
import { blockBaseSchema } from '../../shared'
import { BubbleBlockType } from '../constants'
export const textBubbleContentSchema = z.object({
html: z.string().optional(),
richText: z.array(z.any()).optional(),
plainText: z.string().optional(),
})
export const textBubbleBlockSchema = blockBaseSchema.merge(
z.object({
type: z.enum([BubbleBlockType.TEXT]),
content: textBubbleContentSchema.optional(),
})
)
export type TextBubbleBlock = Omit<
z.infer<typeof textBubbleBlockSchema>,
'content'
> & {
content?: { richText?: TElement[]; html?: string; plainText?: string }
}