Merged in feat/LOY-394-promos-linkable (pull request #2918)

feat(LOY-394): add promo campaign page link

* feat(LOY-394): make promo campaigns linkable from everewhere


Approved-by: Erik Tiekstra
Approved-by: Chuma Mcphoy (We Ahead)
This commit is contained in:
Matilda Landström
2025-10-07 13:30:34 +00:00
parent 31dcbc5335
commit 2176a7dd6f
35 changed files with 195 additions and 1 deletions

View File

@@ -143,6 +143,17 @@ export const startPageRefSchema = z.object({
system: systemSchema,
})
export const promoCampaignPageSchema = z
.object({
__typename: z.literal(ContentEnum.blocks.PromoCampaignPage),
})
.merge(pageLinkSchema)
export const promoCampaignPageRefSchema = z.object({
__typename: z.literal(ContentEnum.blocks.PromoCampaignPage),
system: systemSchema,
})
export const linkUnionSchema = z.discriminatedUnion("__typename", [
accountPageSchema,
campaignOverviewPageSchema,
@@ -155,6 +166,7 @@ export const linkUnionSchema = z.discriminatedUnion("__typename", [
hotelPageSchema,
loyaltyPageSchema,
startPageSchema,
promoCampaignPageSchema,
])
type Data =
@@ -169,6 +181,7 @@ type Data =
| z.output<typeof hotelPageSchema>
| z.output<typeof loyaltyPageSchema>
| z.output<typeof startPageSchema>
| z.output<typeof promoCampaignPageSchema>
| Object
export function transformPageLink(data: Data) {
@@ -182,6 +195,7 @@ export function transformPageLink(data: Data) {
case ContentEnum.blocks.DestinationOverviewPage:
case ContentEnum.blocks.HotelPage:
case ContentEnum.blocks.StartPage:
case ContentEnum.blocks.PromoCampaignPage:
return {
__typename: data.__typename,
system: data.system,
@@ -260,6 +274,7 @@ export const linkRefsUnionSchema = z.discriminatedUnion("__typename", [
hotelPageRefSchema,
loyaltyPageRefSchema,
startPageRefSchema,
promoCampaignPageRefSchema,
])
type RefData =
@@ -274,6 +289,7 @@ type RefData =
| z.output<typeof hotelPageRefSchema>
| z.output<typeof loyaltyPageRefSchema>
| z.output<typeof startPageRefSchema>
| z.output<typeof promoCampaignPageRefSchema>
| Object
export function transformPageLinkRef(data: RefData) {
@@ -290,6 +306,7 @@ export function transformPageLinkRef(data: RefData) {
case ContentEnum.blocks.HotelPage:
case ContentEnum.blocks.LoyaltyPage:
case ContentEnum.blocks.StartPage:
case ContentEnum.blocks.PromoCampaignPage:
return data.system
}
}