Files
web/apps/scandic-web/server/routers/contentstack/schemas/blocks/contentEmbeds.ts
Erik Tiekstra ac953ccd97 feat(SW-1818): Refactored sysAsset handling to support PDF links
Approved-by: Matilda Landström
2025-06-09 09:28:17 +00:00

39 lines
887 B
TypeScript

import { z } from "zod"
import {
accountPageSchema,
collectionPageSchema,
contentPageSchema,
destinationCityPageSchema,
destinationCountryPageSchema,
destinationOverviewPageSchema,
hotelPageSchema,
loyaltyPageSchema,
startPageSchema,
transformPageLink,
} from "../pageLinks"
import { imageContainerSchema } from "./imageContainer"
import { sysAssetSchema } from "./sysAsset"
export const contentEmbedsSchema = z
.discriminatedUnion("__typename", [
imageContainerSchema,
sysAssetSchema,
accountPageSchema,
collectionPageSchema,
contentPageSchema,
destinationCityPageSchema,
destinationCountryPageSchema,
destinationOverviewPageSchema,
hotelPageSchema,
loyaltyPageSchema,
startPageSchema,
])
.transform((data) => {
const link = transformPageLink(data)
if (link) {
return link
}
return data
})