feat(SW-962): add preamble
This commit is contained in:
@@ -25,7 +25,11 @@ export const activitiesCardSchema = z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
node: z.discriminatedUnion("__typename", [
|
||||
pageLinks.contentPageSchema,
|
||||
pageLinks.contentPageSchema.extend({
|
||||
header: z.object({
|
||||
preamble: z.string(),
|
||||
}),
|
||||
}),
|
||||
]),
|
||||
})
|
||||
),
|
||||
@@ -33,9 +37,11 @@ export const activitiesCardSchema = z.object({
|
||||
})
|
||||
.transform((data) => {
|
||||
let contentPage = { href: "" }
|
||||
let preamble = ""
|
||||
if (data.hotel_page_activities_content_pageConnection.edges.length) {
|
||||
const page =
|
||||
data.hotel_page_activities_content_pageConnection.edges[0].node
|
||||
preamble = page.header.preamble
|
||||
if (page.web.original_url) {
|
||||
contentPage = {
|
||||
href: page.web.original_url,
|
||||
@@ -54,6 +60,7 @@ export const activitiesCardSchema = z.object({
|
||||
heading: data.heading,
|
||||
openInNewTab: !!data.open_in_new_tab,
|
||||
scriptedTopTitle: data.scripted_title,
|
||||
preamble,
|
||||
}
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user