fix(SW-3084): Handle unpublished entries inside content pages
Approved-by: Matilda Landström
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
]),
|
||||
})
|
||||
),
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user