Files
web/apps/scandic-web/server/routers/contentstack/schemas/blocks/contentEmbeds.ts
Erik Tiekstra 891108791c feat(SW-2264): Added campaign overview page
Approved-by: Matilda Landström
2025-06-19 15:19:56 +00:00

43 lines
995 B
TypeScript

import { z } from "zod"
import {
accountPageSchema,
campaignOverviewPageSchema,
campaignPageSchema,
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,
campaignOverviewPageSchema,
campaignPageSchema,
collectionPageSchema,
contentPageSchema,
destinationCityPageSchema,
destinationCountryPageSchema,
destinationOverviewPageSchema,
hotelPageSchema,
loyaltyPageSchema,
startPageSchema,
])
.transform((data) => {
const link = transformPageLink(data)
if (link) {
return link
}
return data
})