From cdd83a4346a88584dfb5d4adc87ec84a98504ec0 Mon Sep 17 00:00:00 2001 From: Hrishikesh Vaipurkar Date: Wed, 31 Jul 2024 14:40:27 +0200 Subject: [PATCH] feat: SW-158 Tracking support --- auth.ts | 7 ++----- types/components/tracking.ts | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/auth.ts b/auth.ts index 6f5992154..5cb6a77f0 100644 --- a/auth.ts +++ b/auth.ts @@ -10,13 +10,10 @@ import type { JWT } from "next-auth/jwt" import type { OIDCConfig } from "next-auth/providers" function getLoginType(user: User) { - // 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 + } else if (user?.login_with.toLowerCase() == LoginTypeEnum["email link"]) { + return LoginTypeEnum["email link"] } else { return LoginTypeEnum["membership number"] } diff --git a/types/components/tracking.ts b/types/components/tracking.ts index cbda0eec7..354212d8d 100644 --- a/types/components/tracking.ts +++ b/types/components/tracking.ts @@ -20,7 +20,7 @@ export type TrackingSDKPageData = { export enum LoginTypeEnum { email = "email", "membership number" = "membership number", - // MagicLink = "magic link", + "email link" = "email link", } export type LoginType = keyof typeof LoginTypeEnum