Refactor
This commit is contained in:
@@ -46,9 +46,6 @@ export const accountPageSchema = z.object({
|
||||
heading: z.string().nullable(),
|
||||
title: z.string(),
|
||||
url: z.string(),
|
||||
page_settings: z.object({
|
||||
tracking_page_name: z.string().nullable(),
|
||||
}),
|
||||
system: systemSchema.merge(
|
||||
z.object({
|
||||
created_at: z.string(),
|
||||
@@ -56,6 +53,9 @@ export const accountPageSchema = z.object({
|
||||
})
|
||||
),
|
||||
}),
|
||||
trackingProps: z.object({
|
||||
url: z.string(),
|
||||
}),
|
||||
})
|
||||
|
||||
const accountPageDynamicContentRefs = z
|
||||
|
||||
@@ -197,10 +197,7 @@ export const accountPageQueryRouter = router({
|
||||
createdDate: validatedAccountPage.data.account_page.system.created_at,
|
||||
channel: TrackingChannelEnum["scandic-friends"],
|
||||
pageType: `member${parsedtitle}page`,
|
||||
pageName:
|
||||
validatedAccountPage.data.account_page.page_settings.tracking_page_name,
|
||||
siteSections:
|
||||
validatedAccountPage.data.account_page.page_settings.tracking_page_name, // Always the same as pageName for this page
|
||||
pageName: validatedAccountPage.data.trackingProps.url,
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -144,9 +144,9 @@ export const contentPageSchema = z.object({
|
||||
updated_at: z.string(),
|
||||
})
|
||||
),
|
||||
page_settings: z.object({
|
||||
tracking_page_name: z.string().nullable(),
|
||||
}),
|
||||
}),
|
||||
trackingProps: z.object({
|
||||
url: z.string(),
|
||||
}),
|
||||
})
|
||||
|
||||
|
||||
@@ -68,9 +68,7 @@ export const contentPageQueryRouter = router({
|
||||
createdDate: contentPage.data.content_page.system.created_at,
|
||||
channel: TrackingChannelEnum["static-content-page"],
|
||||
pageType: "staticcontentpage",
|
||||
pageName: contentPage.data.content_page.page_settings.tracking_page_name,
|
||||
siteSections:
|
||||
contentPage.data.content_page.page_settings.tracking_page_name, // Always the same as pageName for this page
|
||||
pageName: contentPage.data.trackingProps.url,
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -22,8 +22,8 @@ export const hotelPageSchema = z.object({
|
||||
hotel_page_id: z.string(),
|
||||
title: z.string(),
|
||||
url: z.string(),
|
||||
page_settings: z.object({
|
||||
tracking_page_name: z.string().nullable(),
|
||||
}),
|
||||
}),
|
||||
trackingProps: z.object({
|
||||
url: z.string(),
|
||||
}),
|
||||
})
|
||||
|
||||
@@ -178,9 +178,6 @@ export const loyaltyPageSchema = z.object({
|
||||
updated_at: z.string(),
|
||||
})
|
||||
),
|
||||
page_settings: z.object({
|
||||
tracking_page_name: z.string().nullable(),
|
||||
}),
|
||||
})
|
||||
.transform((data) => {
|
||||
return {
|
||||
@@ -190,7 +187,9 @@ export const loyaltyPageSchema = z.object({
|
||||
preamble: data.preamble,
|
||||
sidebar: data.sidebar ? data.sidebar : [],
|
||||
system: data.system,
|
||||
pageSettings: data.page_settings,
|
||||
}
|
||||
}),
|
||||
trackingProps: z.object({
|
||||
url: z.string(),
|
||||
}),
|
||||
})
|
||||
|
||||
@@ -181,8 +181,7 @@ export const loyaltyPageQueryRouter = router({
|
||||
createdDate: loyaltyPage.system.created_at,
|
||||
channel: TrackingChannelEnum["scandic-friends"],
|
||||
pageType: "loyaltycontentpage",
|
||||
pageName: loyaltyPage.pageSettings.tracking_page_name,
|
||||
siteSections: loyaltyPage.pageSettings.tracking_page_name, // Always the same as pageName for this page
|
||||
pageName: validatedLoyaltyPage.data.trackingProps.url,
|
||||
}
|
||||
getLoyaltyPageSuccessCounter.add(1, metricsVariables)
|
||||
console.info(
|
||||
|
||||
Reference in New Issue
Block a user