diff --git a/auth.ts b/auth.ts index a24975032..97115d530 100644 --- a/auth.ts +++ b/auth.ts @@ -8,9 +8,10 @@ import type { NextAuthConfig, User } from "next-auth" import type { OIDCConfig } from "next-auth/providers" function getLoginType(user: User) { - if (user?.nonce) { - return LoginTypeEnum.MagicLink - } + // TODO: handle magic link, should be enough to just check for Nonce. + // if (user?.nonce) { + // return LoginTypeEnum.MagicLink + // } if (user?.login_with.includes("@")) { return LoginTypeEnum.Email @@ -54,7 +55,6 @@ const customProvider = { sub: profile.sub, given_name: profile.given_name, login_with: profile.login_with, - nonce: profile.nonce, } }, } satisfies OIDCConfig diff --git a/components/Current/TrackingSDK.tsx b/components/Current/TrackingSDK.tsx index eb3820456..356c95b75 100644 --- a/components/Current/TrackingSDK.tsx +++ b/components/Current/TrackingSDK.tsx @@ -46,9 +46,8 @@ function createSDKPageObject(trackingData: TrackingSDKData) { event: "pageView", pageInfo: { pageName: segments.join("|"), - pageType: "contentpage", pageId: trackingData.pageId, - channel: "", + channel: trackingData.channel, siteSections, domain, siteversion: "new-web", diff --git a/lib/graphql/Query/AccountPage.graphql b/lib/graphql/Query/AccountPage.graphql index 1df21d608..54ec7aa9b 100644 --- a/lib/graphql/Query/AccountPage.graphql +++ b/lib/graphql/Query/AccountPage.graphql @@ -108,5 +108,6 @@ query GetTrackingAccountPage($locale: String!, $uid: String!) { uid updated_at } + title } } diff --git a/server/routers/contentstack/accountPage/output.ts b/server/routers/contentstack/accountPage/output.ts index 6545039cf..8dd73d65c 100644 --- a/server/routers/contentstack/accountPage/output.ts +++ b/server/routers/contentstack/accountPage/output.ts @@ -199,6 +199,7 @@ const validateAccountTrackingData = z.object({ updated_at: z.string(), created_at: z.string(), }), + title: z.string().nullable(), }), }) diff --git a/server/routers/contentstack/accountPage/query.ts b/server/routers/contentstack/accountPage/query.ts index 0b445e435..b2ae4bee0 100644 --- a/server/routers/contentstack/accountPage/query.ts +++ b/server/routers/contentstack/accountPage/query.ts @@ -159,6 +159,7 @@ export const accountPageQueryRouter = router({ publishedDate: response.data.account_page.system.updated_at, createdDate: response.data.account_page.system.created_at, channel: TrackingChannelEnum["scandic-friends"], + pageType: `member${response.data.account_page.title}page`, } return accountTrackingData diff --git a/server/routers/contentstack/loyaltyPage/query.ts b/server/routers/contentstack/loyaltyPage/query.ts index 42ee17794..047966c8a 100644 --- a/server/routers/contentstack/loyaltyPage/query.ts +++ b/server/routers/contentstack/loyaltyPage/query.ts @@ -252,6 +252,7 @@ export const loyaltyPageQueryRouter = router({ publishedDate: response.data.loyalty_page.system.updated_at, createdDate: response.data.loyalty_page.system.created_at, channel: TrackingChannelEnum["scandic-friends"], + pageType: "loyaltycontentpage", } return loyaltyTrackingData diff --git a/types/auth.d.ts b/types/auth.d.ts index debb444a1..e3ac612d2 100644 --- a/types/auth.d.ts +++ b/types/auth.d.ts @@ -27,6 +27,5 @@ declare module "next-auth" { sub: string email?: string login_with: string - nonce?: string } } diff --git a/types/components/tracking.ts b/types/components/tracking.ts index 20718c132..80e42e09f 100644 --- a/types/components/tracking.ts +++ b/types/components/tracking.ts @@ -13,13 +13,14 @@ export type TrackingSDKPageData = { createdDate: string publishedDate: string lang: Lang + pageType: string channel: TrackingChannel } export enum LoginTypeEnum { Email = "email", MembershipNumber = "membership number", - MagicLink = "magic link", + // MagicLink = "magic link", } export type LoginType = keyof typeof LoginTypeEnum @@ -37,12 +38,8 @@ export type TrackingSDKProps = { userData: TrackingSDKUserData } -export type TrackingSDKData = { - lang: Lang +export type TrackingSDKData = TrackingSDKPageData & { pathName: string - pageId: string - publishedDate: string - createdDate: string } // Old tracking setup types: