2
0
Files
bot/packages/schemas/features/blocks/bubbles/video/schema.ts

28 lines
886 B
TypeScript
Raw Normal View History

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(),
})
export const videoBubbleBlockSchema = blockBaseSchema.merge(
z.object({
2022-06-11 07:27:38 +02:00
type: z.enum([BubbleBlockType.VIDEO]),
content: videoBubbleContentSchema.optional(),
})
)
2022-06-11 07:27:38 +02:00
export type VideoBubbleBlock = z.infer<typeof videoBubbleBlockSchema>
export type EmbeddableVideoBubbleContentType = Exclude<
VideoBubbleContentType,
VideoBubbleContentType.URL
>