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>
31 lines
1.0 KiB
TypeScript
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
|
|
>
|