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:
@@ -6,14 +6,8 @@ import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/string
|
||||
|
||||
import { PromoCampaignPageEnum } from "../../../types/promoCampaignPage"
|
||||
import { discriminatedUnionArray } from "../../../utils/discriminatedUnion"
|
||||
import {
|
||||
accordionRefsSchema,
|
||||
accordionSchema,
|
||||
} from "../schemas/blocks/accordion"
|
||||
import {
|
||||
contentRefsSchema as blockContentRefsSchema,
|
||||
contentSchema as blockContentSchema,
|
||||
} from "../schemas/blocks/content"
|
||||
import { accordionSchema } from "../schemas/blocks/accordion"
|
||||
import { contentSchema as blockContentSchema } from "../schemas/blocks/content"
|
||||
import { systemSchema } from "../schemas/system"
|
||||
|
||||
export const promoCampaignPageContent = z
|
||||
@@ -96,30 +90,3 @@ export const promoCampaignPageSchema = z
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
/** REFS */
|
||||
const promoCampaignPageBlockContentRefs = z
|
||||
.object({
|
||||
__typename: z.literal(PromoCampaignPageEnum.ContentStack.blocks.Content),
|
||||
})
|
||||
.merge(blockContentRefsSchema)
|
||||
|
||||
const promoCampaignPageAccordionRefs = z
|
||||
.object({
|
||||
__typename: z.literal(PromoCampaignPageEnum.ContentStack.blocks.Accordion),
|
||||
})
|
||||
.merge(accordionRefsSchema)
|
||||
|
||||
const promoCampaignPageBlockRefsItem = z.discriminatedUnion("__typename", [
|
||||
promoCampaignPageAccordionRefs,
|
||||
promoCampaignPageBlockContentRefs,
|
||||
])
|
||||
|
||||
export const promoCampaignPageRefsSchema = z.object({
|
||||
promo_campaign_page: z.object({
|
||||
blocks: discriminatedUnionArray(
|
||||
promoCampaignPageBlockRefsItem.options
|
||||
).nullable(),
|
||||
system: systemSchema,
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user