2022-06-07 08:49:12 +02:00
|
|
|
import { z } from 'zod'
|
2023-02-19 09:53:57 +01:00
|
|
|
import { variableStringSchema } from '../../utils'
|
2023-01-25 11:27:47 +01:00
|
|
|
import { blockBaseSchema } from '../baseSchemas'
|
|
|
|
import { BubbleBlockType } from './enums'
|
2022-06-07 08:49:12 +02:00
|
|
|
|
|
|
|
export const embedBubbleContentSchema = z.object({
|
|
|
|
url: z.string().optional(),
|
2023-02-19 09:53:57 +01:00
|
|
|
height: z.number().or(variableStringSchema),
|
2022-06-07 08:49:12 +02:00
|
|
|
})
|
|
|
|
|
2022-06-11 07:27:38 +02:00
|
|
|
export const embedBubbleBlockSchema = blockBaseSchema.and(
|
2022-06-07 08:49:12 +02:00
|
|
|
z.object({
|
2022-06-11 07:27:38 +02:00
|
|
|
type: z.enum([BubbleBlockType.EMBED]),
|
2022-06-07 08:49:12 +02:00
|
|
|
content: embedBubbleContentSchema,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
|
|
|
|
export const defaultEmbedBubbleContent: EmbedBubbleContent = { height: 400 }
|
|
|
|
|
2022-06-11 07:27:38 +02:00
|
|
|
export type EmbedBubbleBlock = z.infer<typeof embedBubbleBlockSchema>
|
2022-06-07 08:49:12 +02:00
|
|
|
export type EmbedBubbleContent = z.infer<typeof embedBubbleContentSchema>
|