fix(SW-438): fix sidebar refs
This commit is contained in:
@@ -29,6 +29,7 @@ fragment ContentCardSidebar_ContentPageRefs on ContentPageSidebarContentCard {
|
||||
content_cardConnection {
|
||||
edges {
|
||||
node {
|
||||
__typename
|
||||
...TeaserCardBlockRef
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ fragment QuickLinksSidebar_ContentPage on ContentPageSidebarShortcuts {
|
||||
|
||||
fragment QuickLinksSidebar_ContentPageRefs on ContentPageSidebarShortcuts {
|
||||
shortcuts {
|
||||
__typename
|
||||
...ShortcutsRefs
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,11 +24,12 @@ fragment ScriptedCardSidebar_ContentPage on ContentPageSidebarScriptedCard {
|
||||
}
|
||||
}
|
||||
|
||||
fragment ScriptedCardSidebar_ContentPageRefs on ContentPageSidebarContentCard {
|
||||
fragment ScriptedCardSidebar_ContentPageRefs on ContentPageSidebarScriptedCard {
|
||||
scripted_card {
|
||||
scripted_cardConnection {
|
||||
edges {
|
||||
node {
|
||||
__typename
|
||||
...CardBlockRef
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,10 @@ query GetContentPageRefs($locale: String!, $uid: String!) {
|
||||
sidebar {
|
||||
__typename
|
||||
...ContentSidebar_ContentPageRefs
|
||||
...ContentCardSidebar_ContentPageRefs
|
||||
...JoinLoyaltyContactSidebar_ContentPageRefs
|
||||
...ScriptedCardSidebar_ContentPageRefs
|
||||
...QuickLinksSidebar_ContentPageRefs
|
||||
}
|
||||
system {
|
||||
...System
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user