feat(SW-285): add support for shortcuts in content pages
This commit is contained in:
@@ -24,8 +24,25 @@ const contentPageBlockTextContent = z.object({
|
||||
}),
|
||||
})
|
||||
|
||||
const contentPageShortcuts = z.object({
|
||||
__typename: z.literal(ContentBlocksTypenameEnum.ContentPageBlocksShortcuts),
|
||||
shortcuts: z.object({
|
||||
title: z.string().nullable(),
|
||||
preamble: z.string().nullable(),
|
||||
shortcuts: z.array(
|
||||
z.object({
|
||||
text: z.string().optional(),
|
||||
openInNewTab: z.boolean(),
|
||||
url: z.string(),
|
||||
title: z.string(),
|
||||
})
|
||||
),
|
||||
}),
|
||||
})
|
||||
|
||||
const contentPageBlockItem = z.discriminatedUnion("__typename", [
|
||||
contentPageBlockTextContent,
|
||||
contentPageShortcuts,
|
||||
])
|
||||
|
||||
type BlockContentRaw = z.infer<typeof contentPageBlockTextContent>
|
||||
@@ -38,7 +55,8 @@ export interface RteBlockContent extends BlockContentRaw {
|
||||
}
|
||||
}
|
||||
|
||||
export type Block = RteBlockContent
|
||||
export type Shortcuts = z.infer<typeof contentPageShortcuts>
|
||||
export type Block = RteBlockContent | Shortcuts
|
||||
|
||||
// Content Page Schema and types
|
||||
export const validateContentPageSchema = z.object({
|
||||
|
||||
Reference in New Issue
Block a user