Merged in feat/rework-contentstack (pull request #3493)
Feat(SW-3708): refactor contentstack fetching (removing all refs) and cache invalidation * Remove all REFS * Revalidate correct language * PR fixes * PR fixes * Throw when errors from contentstack api Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -10,19 +10,10 @@ import {
|
||||
includedHotelsSchema,
|
||||
} from "../campaignPage/output"
|
||||
import { promoHeroSchema } from "../promoCampaignPage/output"
|
||||
import {
|
||||
allCampaignsRefsSchema,
|
||||
allCampaignsSchema,
|
||||
} from "../schemas/blocks/allCampaigns"
|
||||
import {
|
||||
carouselCardsRefsSchema,
|
||||
carouselCardsSchema,
|
||||
} from "../schemas/blocks/carouselCards"
|
||||
import { allCampaignsSchema } from "../schemas/blocks/allCampaigns"
|
||||
import { carouselCardsSchema } from "../schemas/blocks/carouselCards"
|
||||
import { campaignOverviewPageHotelListingSchema } from "../schemas/blocks/hotelListing"
|
||||
import {
|
||||
linkAndTitleSchema,
|
||||
linkConnectionRefs,
|
||||
} from "../schemas/linkConnection"
|
||||
import { linkAndTitleSchema } from "../schemas/linkConnection"
|
||||
import { systemSchema } from "../schemas/system"
|
||||
|
||||
const navigationLinksSchema = z
|
||||
@@ -196,49 +187,3 @@ export const campaignOverviewPageSchema = z.object({
|
||||
url: z.string(),
|
||||
}),
|
||||
})
|
||||
|
||||
/** REFS */
|
||||
|
||||
const campaignOverviewPageHeaderRefs = z.object({
|
||||
navigation_links: z.array(linkConnectionRefs),
|
||||
})
|
||||
|
||||
const campaignOverviewPageCarouselCardsRef = z
|
||||
.object({
|
||||
__typename: z.literal(
|
||||
CampaignOverviewPageEnum.ContentStack.blocks.CarouselCards
|
||||
),
|
||||
})
|
||||
.merge(carouselCardsRefsSchema)
|
||||
|
||||
const campaignOverviewPageAllCampaignsRef = z
|
||||
.object({
|
||||
__typename: z.literal(
|
||||
CampaignOverviewPageEnum.ContentStack.blocks.AllCampaigns
|
||||
),
|
||||
})
|
||||
.merge(allCampaignsRefsSchema)
|
||||
|
||||
const blockRefsSchema = z.discriminatedUnion("__typename", [
|
||||
campaignOverviewPageAllCampaignsRef,
|
||||
campaignOverviewPageCarouselCardsRef,
|
||||
])
|
||||
|
||||
export const campaignOverviewPageRefsSchema = z.object({
|
||||
campaign_overview_page: z.object({
|
||||
header: campaignOverviewPageHeaderRefs,
|
||||
top_campaign_block: z.object({
|
||||
campaignConnection: z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
node: z.object({
|
||||
system: systemSchema,
|
||||
}),
|
||||
})
|
||||
),
|
||||
}),
|
||||
}),
|
||||
blocks: discriminatedUnionArray(blockRefsSchema.options).nullable(),
|
||||
system: systemSchema,
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user