Merged in feat/SW-1532-startpage-cardgrid-optional-link (pull request #2635)

feat(SW-1532): add optional link to start page card grid

* feat(SW-1532): add optional link to start page card grid


Approved-by: Erik Tiekstra
This commit is contained in:
Matilda Landström
2025-08-15 07:25:00 +00:00
parent 007025313b
commit 57c6f59449
5 changed files with 85 additions and 4 deletions

View File

@@ -8,6 +8,29 @@
#import "./Refs/LoyaltyCard.graphql"
#import "./Refs/TeaserCard.graphql"
#import "../PageLink/AccountPageLink.graphql"
#import "../PageLink/CampaignOverviewPageLink.graphql"
#import "../PageLink/CampaignPageLink.graphql"
#import "../PageLink/CollectionPageLink.graphql"
#import "../PageLink/ContentPageLink.graphql"
#import "../PageLink/DestinationCityPageLink.graphql"
#import "../PageLink/DestinationCountryPageLink.graphql"
#import "../PageLink/DestinationOverviewPageLink.graphql"
#import "../PageLink/HotelPageLink.graphql"
#import "../PageLink/LoyaltyPageLink.graphql"
#import "../PageLink/StartPageLink.graphql"
#import "../AccountPage/Ref.graphql"
#import "../CampaignOverviewPage/Ref.graphql"
#import "../CampaignPage/Ref.graphql"
#import "../ContentPage/Ref.graphql"
#import "../HotelPage/Ref.graphql"
#import "../LoyaltyPage/Ref.graphql"
#import "../CollectionPage/Ref.graphql"
#import "../DestinationCityPage/Ref.graphql"
#import "../DestinationCountryPage/Ref.graphql"
#import "../DestinationOverviewPage/Ref.graphql"
fragment CardsGrid_ContentPage on ContentPageBlocksCardsGrid {
cards_grid {
layout
@@ -122,6 +145,33 @@ fragment CardsGrid_StartPage on StartPageBlocksCardsGrid {
}
}
}
link {
cta_text
is_contentstack_link
open_in_new_tab
external_link {
href
title
}
linkConnection {
edges {
node {
__typename
...AccountPageLink
...CampaignOverviewPageLink
...CampaignPageLink
...CollectionPageLink
...ContentPageLink
...DestinationCityPageLink
...DestinationCountryPageLink
...DestinationOverviewPageLink
...HotelPageLink
...LoyaltyPageLink
...StartPageLink
}
}
}
}
}
}
@@ -137,5 +187,25 @@ fragment CardsGrid_StartPageRefs on StartPageBlocksCardsGrid {
}
}
}
link {
linkConnection {
edges {
node {
__typename
...AccountPageRef
...CampaignOverviewPageRef
...CampaignPageRef
...CollectionPageRef
...ContentPageRef
...DestinationCityPageRef
...DestinationCountryPageRef
...DestinationOverviewPageRef
...HotelPageRef
...LoyaltyPageRef
...StartPageRef
}
}
}
}
}
}

View File

@@ -75,6 +75,8 @@ export const cardsGridSchema = z.object({
})
),
}),
link: buttonSchema.optional(),
layout: z.nativeEnum(CardsGridLayoutEnum),
preamble: z.string().optional().default(""),
theme: z.nativeEnum(scriptedCardThemeEnum).nullable(),
@@ -86,6 +88,10 @@ export const cardsGridSchema = z.object({
preamble: data.preamble,
theme: data.theme,
title: data.title,
link:
data.link?.href && data.link.title
? { href: data.link.href, text: data.link.title }
: undefined,
cards: data.cardConnection.edges.map((card) => {
if (card.node.__typename === CardsGridEnum.cards.Card) {
return transformCardBlock(card.node)
@@ -147,6 +153,7 @@ export const cardGridRefsSchema = z.object({
})
),
}),
link: linkConnectionRefsSchema.optional(),
})
.transform((data) => {
return data.cardConnection.edges