feat: add tracking to account pages
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { Lang } from "@/constants/languages"
|
||||
import {
|
||||
GetLoyaltyPage,
|
||||
GetLoyaltyPageRefs,
|
||||
@@ -19,6 +20,7 @@ import { removeEmptyObjects } from "../../utils"
|
||||
import {
|
||||
LoyaltyPage,
|
||||
type LoyaltyPageRefsDataRaw,
|
||||
LoyaltyPageTackingData,
|
||||
validateLoyaltyPageRefsSchema,
|
||||
validateLoyaltyPageSchema,
|
||||
} from "./output"
|
||||
@@ -232,10 +234,13 @@ export const loyaltyPageQueryRouter = router({
|
||||
tracking: contentstackExtendedProcedureUID.query(async ({ ctx }) => {
|
||||
const { lang, uid } = ctx
|
||||
|
||||
const response = await request<any>(GetTrackingLoyaltyPage, {
|
||||
locale: lang,
|
||||
uid,
|
||||
})
|
||||
const response = await request<LoyaltyPageTackingData>(
|
||||
GetTrackingLoyaltyPage,
|
||||
{
|
||||
locale: lang,
|
||||
uid,
|
||||
}
|
||||
)
|
||||
|
||||
if (!response.data) {
|
||||
throw notFound(response)
|
||||
@@ -243,8 +248,8 @@ export const loyaltyPageQueryRouter = router({
|
||||
|
||||
const loyaltyTrackingData: TrackingSDKPageData = {
|
||||
pageId: response.data.loyalty_page.system.uid,
|
||||
lang: response.data.loyalty_page.system.locale,
|
||||
publishedDate: response.data.loyalty_page.system.published_at,
|
||||
lang: response.data.loyalty_page.system.locale as Lang,
|
||||
publishedDate: response.data.loyalty_page.system.updated_at,
|
||||
createdDate: response.data.loyalty_page.system.created_at,
|
||||
channel: TrackingChannelEnum["scandic-friends"],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user