fix(SW-3084): Handle unpublished entries inside content pages

Approved-by: Matilda Landström
This commit is contained in:
Erik Tiekstra
2025-08-14 07:24:35 +00:00
parent 04aebb372c
commit a362d236fb
5 changed files with 26 additions and 27 deletions

View File

@@ -4,6 +4,8 @@ import { CardsEnum } from "../../../../../types/cardsEnum"
import { tempImageVaultAssetSchema } from "../../imageVault"
import {
accountPageSchema,
campaignOverviewPageSchema,
campaignPageSchema,
collectionPageSchema,
contentPageSchema,
destinationCityPageSchema,
@@ -49,6 +51,8 @@ export const teaserCardBlockSchema = z.object({
imageContainerSchema,
sysAssetSchema,
accountPageSchema,
campaignOverviewPageSchema,
campaignPageSchema,
collectionPageSchema,
contentPageSchema,
destinationCityPageSchema,

View File

@@ -3,15 +3,8 @@ import { z } from "zod"
import { BlocksEnums } from "../../../../types/blocksEnum"
import { ContentEnum } from "../../../../types/content"
import {
accountPageSchema,
collectionPageSchema,
contentPageSchema,
destinationCityPageSchema,
destinationCountryPageSchema,
destinationOverviewPageSchema,
hotelPageSchema,
loyaltyPageSchema,
startPageSchema,
linkRefsUnionSchema,
linkUnionSchema,
transformPageLink,
} from "../pageLinks"
import {
@@ -36,15 +29,7 @@ export const contentSchema = z.object({
.discriminatedUnion("__typename", [
imageContainerSchema,
sysAssetSchema,
accountPageSchema,
collectionPageSchema,
contentPageSchema,
destinationCityPageSchema,
destinationCountryPageSchema,
destinationOverviewPageSchema,
hotelPageSchema,
loyaltyPageSchema,
startPageSchema,
...linkUnionSchema.options,
])
.transform((data) => {
const link = transformPageLink(data)
@@ -73,15 +58,7 @@ export const contentRefsSchema = z.object({
node: z.discriminatedUnion("__typename", [
sysAssetRefsSchema,
imageContainerRefsSchema,
accountPageSchema,
collectionPageSchema,
contentPageSchema,
destinationCityPageSchema,
destinationCountryPageSchema,
destinationOverviewPageSchema,
hotelPageSchema,
loyaltyPageSchema,
startPageSchema,
...linkRefsUnionSchema.options,
]),
})
),

View File

@@ -25,7 +25,12 @@ export const scriptedCardsSchema = z.object({
),
}),
})
.nullish()
.transform((data) => {
if (!data?.scripted_cardConnection?.edges.length) {
return null
}
return {
theme: data.theme,
...transformCardBlock(data.scripted_cardConnection.edges[0].node),

View File

@@ -24,7 +24,12 @@ export const teaserCardsSchema = z.object({
),
}),
})
.nullish()
.transform((data) => {
if (!data?.teaser_cardConnection?.edges.length) {
return null
}
return {
...transformTeaserCardBlock(data.teaser_cardConnection.edges[0].node),
theme: data.theme,