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

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

View File

@@ -68,7 +68,25 @@ export const heroSchema = z.object({
bold_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
.intersection(z.object({ cta: z.string() }), linkConnectionSchema)
.transform((data) => {

View File

@@ -359,7 +359,7 @@ export async function getHotelsByHotelIds({
contentType?: "hotel" | "restaurant" | "meeting"
}) {
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(
cacheKey,