2
0
Files
bot/packages/schemas/features/blocks/bubbles/video/schema.ts
Abhirup Basu c7263a17eb ️ Option to disable controls and autoplay on videos (#1631)
Extends the implementation of #1503 as per the suggestions provided in
the code review to resolve #1485



https://github.com/baptisteArno/typebot.io/assets/69730155/87481d64-57f5-4f7e-8a28-4a464f12cc31

---------

Co-authored-by: Baptiste Arnaud <baptiste.arnaud95@gmail.com>
2024-07-11 12:32:47 +02:00

31 lines
1.0 KiB
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(),
areControlsDisplayed: z.boolean().optional(),
isAutoplayEnabled: z.boolean().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
>