feat(SW-3121): Added support for campaign text inside the hero of campaign pages

* fix: making sure the cacheKey for getHotelsByHotelIds is not sorting the original array

Approved-by: Matilda Landström
This commit is contained in:
Erik Tiekstra
2025-08-28 13:46:48 +00:00
parent 8a53e97e5f
commit 2e655619d1
5 changed files with 57 additions and 8 deletions

View File

@@ -33,11 +33,14 @@
background-color: var(--Surface-Brand-Accent-Default); background-color: var(--Surface-Brand-Accent-Default);
} }
.heading { .heading,
.highlight,
.rateText {
color: var(--Text-Brand-OnAccent-Heading); color: var(--Text-Brand-OnAccent-Heading);
} }
.text { .text,
.campaignText {
color: var(--Text-Brand-OnPrimary-1-Default); color: var(--Text-Brand-OnPrimary-1-Default);
} }
@@ -51,12 +54,18 @@
background-color: var(--Surface-Brand-Primary-3-Default); background-color: var(--Surface-Brand-Primary-3-Default);
} }
.heading { .highlight {
color: var(--Text-Brand-OnPrimary-3-Heading);
}
.heading,
.rateText {
color: var(--Text-Brand-OnPrimary-3-Accent); color: var(--Text-Brand-OnPrimary-3-Accent);
} }
.benefitList > li, .benefitList > li,
.text { .text,
.campaignText {
color: var(--Text-Brand-OnPrimary-3-Default); color: var(--Text-Brand-OnPrimary-3-Default);
} }
} }

View File

@@ -25,6 +25,7 @@ export default async function CampaignHero({
heading, heading,
benefits, benefits,
rate_text, rate_text,
campaign_text,
button, button,
theme, theme,
pageType = "campaign", pageType = "campaign",
@@ -73,6 +74,23 @@ export default async function CampaignHero({
))} ))}
</ul> </ul>
) : null} ) : null}
{pageType === "campaign" && campaign_text ? (
<p className={styles.campaignText}>
{campaign_text.text ? (
<Typography variant="Body/Paragraph/mdRegular">
<span>{campaign_text.text}</span>
</Typography>
) : null}
{campaign_text.bold_text && campaign_text.text ? " " : null}
{campaign_text.bold_text ? (
<Typography variant="Body/Paragraph/mdBold">
<span className={styles.highlight}>
{campaign_text.bold_text}
</span>
</Typography>
) : null}
</p>
) : null}
<Divider <Divider
color={ color={
theme === "Peach" theme === "Peach"
@@ -81,7 +99,7 @@ export default async function CampaignHero({
} }
/> />
{rate_text ? ( {rate_text ? (
<span className={styles.heading}> <p className={styles.rateText}>
{rate_text.bold_text ? ( {rate_text.bold_text ? (
<Typography variant="Title/Subtitle/lg"> <Typography variant="Title/Subtitle/lg">
<span>{rate_text.bold_text}</span> <span>{rate_text.bold_text}</span>
@@ -93,7 +111,7 @@ export default async function CampaignHero({
<span>{rate_text.text}</span> <span>{rate_text.text}</span>
</Typography> </Typography>
) : null} ) : null}
</span> </p>
) : null} ) : null}
{button ? ( {button ? (
<ButtonLink <ButtonLink

View File

@@ -32,6 +32,10 @@ fragment Hero_CampaignPage on CampaignPage {
bold_text bold_text
text text
} }
campaign_text {
text
bold_text
}
button { button {
cta cta
linkConnection { linkConnection {

View File

@@ -68,7 +68,25 @@ export const heroSchema = z.object({
bold_text: z.string().nullish(), bold_text: z.string().nullish(),
text: z.string().nullish(), text: z.string().nullish(),
}) })
.nullish(), .nullish()
.transform((data) => {
if (data?.bold_text || data?.text) {
return data
}
return null
}),
campaign_text: z
.object({
text: z.string().nullish(),
bold_text: z.string().nullish(),
})
.nullish()
.transform((data) => {
if (data?.bold_text || data?.text) {
return data
}
return null
}),
button: z button: z
.intersection(z.object({ cta: z.string() }), linkConnectionSchema) .intersection(z.object({ cta: z.string() }), linkConnectionSchema)
.transform((data) => { .transform((data) => {

View File

@@ -359,7 +359,7 @@ export async function getHotelsByHotelIds({
contentType?: "hotel" | "restaurant" | "meeting" contentType?: "hotel" | "restaurant" | "meeting"
}) { }) {
const cacheClient = await getCacheClient() const cacheClient = await getCacheClient()
const cacheKey = `${lang}:getHotelsByHotelIds:hotels:${contentType}:${hotelIds.sort().join(",")}` const cacheKey = `${lang}:getHotelsByHotelIds:hotels:${contentType}:${[...hotelIds].sort().join(",")}`
return await cacheClient.cacheOrGet( return await cacheClient.cacheOrGet(
cacheKey, cacheKey,