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:
@@ -32,6 +32,10 @@ fragment Hero_CampaignPage on CampaignPage {
|
||||
bold_text
|
||||
text
|
||||
}
|
||||
campaign_text {
|
||||
text
|
||||
bold_text
|
||||
}
|
||||
button {
|
||||
cta
|
||||
linkConnection {
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user