feat(SW-285): add support for tags
This commit is contained in:
@@ -7,6 +7,7 @@ import { imageVaultAssetSchema } from "../schemas/imageVault"
|
||||
import { ContentBlocksTypenameEnum } from "@/types/components/content/enums"
|
||||
import { ImageVaultAsset } from "@/types/components/imageVault"
|
||||
import { Embeds } from "@/types/requests/embeds"
|
||||
import { RTEEmbedsEnum } from "@/types/requests/rte"
|
||||
import { EdgesWithTotalCount } from "@/types/requests/utils/edges"
|
||||
import { RTEDocument } from "@/types/rte/node"
|
||||
|
||||
@@ -84,3 +85,56 @@ export type ContentPage = Omit<ContentPageRaw, "blocks" | "hero_image"> & {
|
||||
heroImage?: ImageVaultAsset
|
||||
blocks: Block[]
|
||||
}
|
||||
|
||||
const rteConnectionRefs = z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
node: z.object({
|
||||
__typename: z.nativeEnum(RTEEmbedsEnum),
|
||||
system: z.object({
|
||||
content_type_uid: z.string(),
|
||||
uid: z.string(),
|
||||
}),
|
||||
}),
|
||||
})
|
||||
),
|
||||
})
|
||||
|
||||
const contentPageBlockTextContentRefs = z.object({
|
||||
__typename: z.literal(ContentBlocksTypenameEnum.ContentPageBlocksContent),
|
||||
content: z.object({
|
||||
content: z.object({
|
||||
embedded_itemsConnection: rteConnectionRefs,
|
||||
}),
|
||||
}),
|
||||
})
|
||||
|
||||
const contentPageShortcutsRefs = z.object({
|
||||
__typename: z.literal(ContentBlocksTypenameEnum.ContentPageBlocksShortcuts),
|
||||
shortcuts: z.object({
|
||||
shortcuts: z.array(
|
||||
z.object({
|
||||
linkConnection: rteConnectionRefs,
|
||||
})
|
||||
),
|
||||
}),
|
||||
})
|
||||
|
||||
const contentPageBlockRefsItem = z.discriminatedUnion("__typename", [
|
||||
contentPageBlockTextContentRefs,
|
||||
contentPageShortcutsRefs,
|
||||
])
|
||||
|
||||
export const validateContentPageRefsSchema = z.object({
|
||||
content_page: z.object({
|
||||
blocks: z.array(contentPageBlockRefsItem).nullable(),
|
||||
system: z.object({
|
||||
content_type_uid: z.string(),
|
||||
uid: z.string(),
|
||||
}),
|
||||
}),
|
||||
})
|
||||
|
||||
export type ContentPageRefsDataRaw = z.infer<
|
||||
typeof validateContentPageRefsSchema
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user