fix(SW-438): fix sidebar refs

This commit is contained in:
Matilda Landström
2024-10-16 08:11:55 +02:00
parent 01db5aa192
commit e5eb6a5331
6 changed files with 41 additions and 5 deletions

View File

@@ -34,14 +34,23 @@ import {
contentRefsSchema as sidebarContentRefsSchema,
contentSchema as sidebarContentSchema,
} from "../schemas/sidebar/content"
import { contentCardsSchema } from "../schemas/sidebar/contentCard"
import {
contentCardRefschema,
contentCardsSchema,
} from "../schemas/sidebar/contentCard"
import { dynamicContentSchema as sidebarDynamicContentSchema } from "../schemas/sidebar/dynamicContent"
import {
joinLoyaltyContactRefsSchema,
joinLoyaltyContactSchema,
} from "../schemas/sidebar/joinLoyaltyContact"
import { quickLinksSchema } from "../schemas/sidebar/quickLinks"
import { scriptedCardsSchema } from "../schemas/sidebar/scriptedCard"
import {
quickLinksRefschema,
quickLinksSchema,
} from "../schemas/sidebar/quickLinks"
import {
scriptedCardRefschema,
scriptedCardsSchema,
} from "../schemas/sidebar/scriptedCard"
import { systemSchema } from "../schemas/system"
import { ContentPageEnum } from "@/types/enums/contentPage"
@@ -254,6 +263,12 @@ const contentPageSidebarContentRef = z
})
.merge(sidebarContentRefsSchema)
const contentPageSidebarContentCardRef = z
.object({
__typename: z.literal(ContentPageEnum.ContentStack.sidebar.ContentCard),
})
.merge(contentCardRefschema)
const contentPageSidebarJoinLoyaltyContactRef = z
.object({
__typename: z.literal(
@@ -262,9 +277,24 @@ const contentPageSidebarJoinLoyaltyContactRef = z
})
.merge(joinLoyaltyContactRefsSchema)
const contentPageSidebarScriptedCardRef = z
.object({
__typename: z.literal(ContentPageEnum.ContentStack.sidebar.ScriptedCard),
})
.merge(scriptedCardRefschema)
const contentPageSidebarQuickLinksRef = z
.object({
__typename: z.literal(ContentPageEnum.ContentStack.sidebar.QuickLinks),
})
.merge(quickLinksRefschema)
const contentPageSidebarRefsItem = z.discriminatedUnion("__typename", [
contentPageSidebarContentRef,
contentPageSidebarContentCardRef,
contentPageSidebarJoinLoyaltyContactRef,
contentPageSidebarScriptedCardRef,
contentPageSidebarQuickLinksRef,
])
const contentPageHeaderRefs = z.object({

View File

@@ -43,7 +43,7 @@ export const scriptedCardsSchema = z.object({
})
export const scriptedCardRefschema = z.object({
cripted_card: z.object({
scripted_card: z.object({
scripted_cardConnection: z.object({
edges: z.array(
z.object({