Merged in fix/sw-1980-sas-comparison-block-link (pull request #1641)
Update link in SASTierComparison to use pageLink reference * Update link in SASTierComparison to use pageLink reference Approved-by: Linus Flood
This commit is contained in:
@@ -71,10 +71,10 @@ export function SasTierComparison({
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{tierComparison.cta?.href && (
|
{tierComparison.cta?.link && (
|
||||||
<Button theme="primaryLight" asChild className={styles.ctaButton}>
|
<Button theme="primaryLight" asChild className={styles.ctaButton}>
|
||||||
<Link href={tierComparison.cta.href} color="white">
|
<Link href={tierComparison.cta.link.url} color="white">
|
||||||
{tierComparison.cta.title}
|
{tierComparison.cta.title || tierComparison.cta.link.title}
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
#import "../Fragments/PageLink/AccountPageLink.graphql"
|
||||||
|
#import "../Fragments/PageLink/CollectionPageLink.graphql"
|
||||||
|
#import "../Fragments/PageLink/ContentPageLink.graphql"
|
||||||
|
#import "../Fragments/PageLink/DestinationCityPageLink.graphql"
|
||||||
|
#import "../Fragments/PageLink/DestinationCountryPageLink.graphql"
|
||||||
|
#import "../Fragments/PageLink/DestinationOverviewPageLink.graphql"
|
||||||
|
#import "../Fragments/PageLink/HotelPageLink.graphql"
|
||||||
|
#import "../Fragments/PageLink/LoyaltyPageLink.graphql"
|
||||||
|
#import "../Fragments/PageLink/StartPageLink.graphql"
|
||||||
|
|
||||||
query GetAllSasTierComparison($lang: String!) {
|
query GetAllSasTierComparison($lang: String!) {
|
||||||
all_sas_tier_comparison(locale: $lang) {
|
all_sas_tier_comparison(locale: $lang) {
|
||||||
items {
|
items {
|
||||||
@@ -15,9 +25,24 @@ query GetAllSasTierComparison($lang: String!) {
|
|||||||
title
|
title
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cta {
|
call_to_action {
|
||||||
title
|
title
|
||||||
href
|
linkConnection {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
__typename
|
||||||
|
...AccountPageLink
|
||||||
|
...CollectionPageLink
|
||||||
|
...ContentPageLink
|
||||||
|
...DestinationCityPageLink
|
||||||
|
...DestinationCountryPageLink
|
||||||
|
...DestinationOverviewPageLink
|
||||||
|
...HotelPageLink
|
||||||
|
...LoyaltyPageLink
|
||||||
|
...StartPageLink
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
|
|
||||||
|
import { linkUnionSchema, transformPageLink } from "../schemas/pageLinks"
|
||||||
|
|
||||||
const link = z.object({
|
const link = z.object({
|
||||||
href: z.string(),
|
href: z.string(),
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
@@ -23,9 +25,25 @@ export const validateSasTierComparisonSchema = z
|
|||||||
link: link.optional(),
|
link: link.optional(),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
cta: link.optional(),
|
call_to_action: z.object({
|
||||||
|
title: z.string().optional(),
|
||||||
|
linkConnection: z.object({
|
||||||
|
edges: z.array(
|
||||||
|
z.object({
|
||||||
|
node: linkUnionSchema,
|
||||||
|
})
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
.transform((data) => data.all_sas_tier_comparison.items.at(0))
|
.transform((data) => {
|
||||||
|
const { call_to_action, ...item } = data.all_sas_tier_comparison.items[0]
|
||||||
|
|
||||||
|
const linkNode = call_to_action.linkConnection.edges[0]?.node
|
||||||
|
const link = transformPageLink(linkNode)
|
||||||
|
|
||||||
|
return { ...item, cta: { title: call_to_action.title, link } }
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user