2
0
Files
bot/packages/schemas/features/blocks/bubbles/video/schema.ts
2024-06-24 14:31:07 +02:00

29 lines
939 B
TypeScript

import { z } from '../../../../zod'
import { blockBaseSchema } from '../../shared'
import { VideoBubbleContentType } from './constants'
import { variableStringSchema } from '../../../utils'
import { BubbleBlockType } from '../constants'
export const videoBubbleContentSchema = z.object({
url: z.string().optional(),
id: z.string().optional(),
type: z.nativeEnum(VideoBubbleContentType).optional(),
height: z.number().or(variableStringSchema).optional(),
aspectRatio: z.string().optional(),
maxWidth: z.string().optional(),
queryParamsStr: z.string().optional(),
})
export const videoBubbleBlockSchema = blockBaseSchema.merge(
z.object({
type: z.enum([BubbleBlockType.VIDEO]),
content: videoBubbleContentSchema.optional(),
})
)
export type VideoBubbleBlock = z.infer<typeof videoBubbleBlockSchema>
export type EmbeddableVideoBubbleContentType = Exclude<
VideoBubbleContentType,
VideoBubbleContentType.URL
>