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EAAAA,EAAAA,MAAlB,MACM/G,GAASC,EAAAA,EAAAA,aACT+G,GAEHC,EAAAA,EAAAA,IAAcvH,OAAOgB,SAASC,YAC7BuG,EAAAA,EAAAA,IAAoBxH,OAAOgB,SAASC,WAGlC,GAAEwG,EAAE,UAAEpH,GAAc+G,GAE1BM,EAAAA,EAAAA,IAAe,CACbnD,MAAO,cAEToD,EAAAA,EAAAA,IAAc,CACZpD,MAAO,cAETqD,EAAAA,EAAAA,IAAa,CACXrD,MAAO,aAGT,MAAMsD,GAAc5E,EAAAA,EAAAA,IAAcC,GAAUA,EAAM2E,cAYlD,OAVA5F,EAAAA,EAAAA,YAAU,KACJqF,GACFhH,EAAOwH,QAAQ,OAEhB,KAEH7F,EAAAA,EAAAA,YAAU,MACR8F,EAAAA,EAAAA,GAAYF,KACX,KAGD,UAAClE,MAAAA,CAAIC,UAAU,e,WACb,SAACoE,IAAIA,C,UACH,SAACC,QAAAA,C,SAAM,2BAGT,SAACC,EAAAA,EAAiBA,C,UAChB,SAAC/H,EAAgBA,CAACC,WAAYqH,EAAIpH,UAAWA,Y","sources":["webpack://_N_E/?8e71","webpack://_N_E/./src/modules/Auth/AuthRegisterForm.tsx","webpack://_N_E/./src/pages/register/index.tsx"],"sourcesContent":["\n (window.__NEXT_P = window.__NEXT_P || []).push([\n \"/register\",\n function () {\n return require(\"private-next-pages/register/index.tsx\");\n }\n ]);\n if(module.hot) {\n module.hot.dispose(function () {\n window.__NEXT_P.push([\"/register\"])\n });\n }\n ","import * as z from \"zod\";\nimport { useForm } from \"react-hook-form\";\nimport { zodResolver } from \"@hookform/resolvers/zod\";\n\nimport FieldText from \"components/Form/FieldText\";\nimport FieldPassword from \"components/Form/FieldPassword\";\nimport Button from \"components/Button\";\nimport { useAuthRegisterApi } from \"./authApi\";\nimport { useAuthSetLogin, useRedirectPreviousPath } from \"./authHooks\";\nimport Link from \"next/link\";\nimport { useAuthStore } from \"./authStore\";\nimport { useUserGetProfile } from \"modules/User/userApi\";\nimport { trackEvent } from \"lib/amplitude\";\nimport { IconCheck } from \"components/Icon/IconCheck\";\nimport { useRouter } from \"next/router\";\nimport { getCookie, isCustomDomain } from \"lib/helper\";\nimport { AuthSocialButtonNew } from \"./AuthSocialButtonNew\";\nimport {\n getSubDomain,\n isBlueBirdURL,\n isGateURL,\n useIsSubdomain,\n useIsTenant,\n} from \"lib/host\";\nimport { isBrowser } from \"lib/ssr\";\nimport useTranslation from \"next-translate/useTranslation\";\nimport { CONST } from \"lib/const\";\nimport { b2cSubdomain, listSubdomainNoGoogleSignIn } from \"./AuthLoginApp\";\nimport { useEffect } from \"react\";\n\nexport const AuthRegisterForm: React.FC<{\n ip_address?: string;\n userAgent?: string;\n}> = ({ ip_address = \"\", userAgent = \"\" }) => {\n const router = useRouter();\n const { email, name } = router.query;\n const { t } = useTranslation(\"common\");\n\n const subDomain = isBrowser() ? getSubDomain(window.location.hostname) : null;\n const slug: string = CONST.IS_DEV ? \"ares-gate\" : \"gate\";\n\n const LoginSchema: any =\n subDomain !== slug\n ? z.object({\n name: z.string().min(3, { message: \"Nama minimal 3 karakter\" }),\n username: z.string().min(1, { message: \"Masukkan email/no.hp kamu\" }),\n password: z\n .string()\n .min(8, { message: \"Kata sandi minimal 8 karakter\" }),\n password_confirmation: z\n .string()\n .min(8, { message: \"Kata sandi minimal 8 karakter\" }),\n })\n : z.object({\n name: z.string().min(3, { message: \"Nama minimal 3 karakter\" }),\n username: z.string().min(1, { message: \"Masukkan email/no.hp kamu\" }),\n password: z\n .string()\n .min(8, { message: \"Kata sandi minimal 8 karakter\" }),\n password_confirmation: z\n .string()\n .min(8, { message: \"Kata sandi minimal 8 karakter\" }),\n referral: z.string().min(1, { message: t(\"passReferral\") }),\n });\n\n type FormData = z.infer;\n\n const hookForm = useForm({\n resolver: zodResolver(LoginSchema),\n });\n\n const { setValue } = hookForm;\n\n useEffect(() => {\n if (email) setValue(\"username\", email as string);\n if (name) setValue(\"name\", name as string);\n }, [email, name, setValue]);\n\n const isSubdomainTenant = useIsSubdomain();\n // const subDomain = isBrowser() ? getSubDomain(window.location.hostname) : null;\n const referralCode =\n getCookie(\"ref_code_gk\") && getCookie(\"ref_code_gk\") !== \"null\"\n ? getCookie(\"ref_code_gk\")\n : typeof window !== \"undefined\"\n ? new URLSearchParams(window.location.search).get(\"referral\")\n : \"\";\n\n const useReferral = router.query.useReferral == \"true\" || referralCode;\n\n const authRegisterApi = useAuthRegisterApi();\n\n const { handleSubmit } = hookForm;\n\n const { encodedPath, redirectToPreviousPath } = useRedirectPreviousPath();\n\n const authStore = useAuthStore((state) => ({\n setLoading: state.setLoading,\n setLogin: state.setLogin,\n }));\n\n const userGetProfile = useUserGetProfile();\n\n const authSetLogin = useAuthSetLogin();\n const isB2B = useIsTenant() || useIsSubdomain();\n const isGate =\n typeof window !== \"undefined\" && isGateURL(window.location.hostname);\n\n /**\n * onSubmit\n */\n const onSubmit = (data: FormData) => {\n let origin = \"reguler\";\n if (isB2B) {\n origin = \"business\";\n }\n\n trackEvent({\n event: \"signup_a\",\n property: {\n is_success: undefined,\n },\n });\n const referrals = !isB2B\n ? referralCode\n : data?.referral\n ? data?.referral\n : subDomain == \"www\"\n ? \"\"\n : subDomain;\n authRegisterApi.doFetch(\n ip_address\n ? {\n name: data.name,\n username: data.username,\n password: data.password,\n referral: referrals,\n ip_address,\n user_agent: userAgent,\n origin,\n password_confirmation: data.password_confirmation,\n }\n : {\n name: data.name,\n username: data.username,\n password: data.password,\n referral: referrals,\n user_agent: userAgent,\n origin,\n password_confirmation: data.password_confirmation,\n },\n {\n onSuccess(data) {\n if (isSubdomainTenant)\n authSetLogin(\n data.token,\n \"username\",\n \"signup_success_a\",\n null,\n \"domain=gokampus.com\"\n );\n authSetLogin(data.token, \"username\", \"signup_success_a\");\n },\n onError(err) {\n if (err instanceof authRegisterApi.fetcher.Error) {\n const error: any = err.getActualType();\n if ([409, 404, 403].includes(error?.status)) {\n hookForm.setError(\"username\", {\n message: error.data?.message,\n });\n }\n\n if (error?.status == 422) {\n Object.entries(error.data.errors).map(([key, value]) => {\n hookForm.setError(key as any, {\n message: value as any,\n });\n });\n }\n }\n },\n }\n );\n };\n\n return (\n \n
\n

{t(\"registering\")}

\n {t(\"infoValidation\")}\n
\n\n {!isGate && (\n
\n \n
\n )}\n\n {listSubdomainNoGoogleSignIn.includes(subDomain) ? (\n <>\n ) : (\n
\n {/* */}\n
\n )}\n\n \n {subDomain === slug && (\n \n )}\n \n \n \n \n\n
\n
\n \n {t(\"register\")}\n \n
\n\n {/* {\n trackEvent({\n event: \"signin_redirect_a\",\n });\n }}\n href={{\n pathname: \"/login\",\n query: encodedPath ? { url: encodedPath } : undefined,\n }}\n >\n \n */}\n\n
\n {t(\"haveAccount\")}{\" \"}\n
\n {\n trackEvent({\n event: \"signin_redirect_a\",\n });\n }}\n href={{\n pathname: \"/login\",\n query: encodedPath ? { url: encodedPath } : undefined,\n }}\n >\n {t(\"loginHere\")}\n \n
\n
\n\n
\n

\n {t(\"registerAgree\")}{\" \"}\n \n {t(\"tou\")}\n {\" \"}\n &{\" \"}\n \n {t(\"privacyPolicy\")}\n {\" \"}\n {t(\"registerAgree2\")}\n

\n
\n
\n\n {/* {listSubdomainNoGoogleSignIn.includes(subDomain) ? (\n <>\n ) : (\n
\n \n
\n )} */}\n \n\n {useReferral && (\n <>\n
\n\n \n
\n Referral: {referralCode}\n
\n\n \n \n \n )}\n {/*
*/}\n \n );\n};\n","import Head from \"next/head\";\nimport { AuthLayout } from \"modules/Auth/AuthLayout\";\nimport { AuthRegisterForm } from \"modules/Auth/AuthRegisterForm\";\nimport { trackEventGA, trackEventGTM, useTrackScreen } from \"lib/amplitude\";\nimport { useIsDesktop } from \"lib/device\";\nimport { AuthLayoutDesktop } from \"modules/Auth/AuthLayoutDesktop\";\nimport { GetServerSideProps } from \"next\";\nimport { useEffect } from \"react\";\nimport { checkTawkTo } from \"lib/tawk-to\";\nimport { useAuthStore } from \"modules/Auth/authStore\";\nimport { isBlueBirdURL, isSubdomainBluebird } from \"lib/host\";\nimport { useRouter } from \"next/router\";\n\nexport const getServerSideProps: GetServerSideProps = async (context) => {\n let ip: any;\n\n const { req } = context;\n const host = req.headers.host || \"\";\n const isBlueBirdTenant = isBlueBirdURL(host);\n\n const forwardedFor = req.headers[\"x-forwarded-for\"];\n const userAgent = req.headers[\"user-agent\"];\n\n if (forwardedFor) {\n if (Array.isArray(forwardedFor)) {\n ip = forwardedFor.at(0);\n } else {\n ip = forwardedFor?.split(\",\").at(0) ?? null;\n }\n } else if (req.headers[\"x-real-ip\"]) {\n ip = req.connection.remoteAddress;\n } else {\n ip = req.connection.remoteAddress;\n }\n\n if (isBlueBirdTenant) {\n return {\n props: {\n ip,\n userAgent,\n },\n redirect: {\n destination: \"/\",\n permanent: false,\n },\n };\n }\n\n return {\n props: {\n ip,\n userAgent,\n },\n };\n};\n\nconst Register: React.FC = (props) => {\n const isDesktop = useIsDesktop();\n const router = useRouter();\n const isBlueBirdTenant =\n typeof window !== \"undefined\" &&\n (isBlueBirdURL(window.location.hostname) ||\n isSubdomainBluebird(window.location.hostname));\n\n //@ts-ignore\n const { ip, userAgent } = props;\n\n useTrackScreen({\n event: \"signup_s\",\n });\n trackEventGTM({\n event: \"signup_s\",\n });\n trackEventGA({\n event: \"signup_s\",\n });\n\n const currentUser = useAuthStore((state) => state.currentUser);\n\n useEffect(() => {\n if (isBlueBirdTenant) {\n router.replace(\"/\");\n }\n }, []);\n\n useEffect(() => {\n checkTawkTo(currentUser);\n }, []);\n\n return (\n
\n \n Register - goKampus\n \n\n \n \n \n\n {/* {isDesktop ? (\n \n \n \n ) : (\n \n \n \n )} */}\n
\n );\n};\n\nexport default Register;\n"],"names":["window","__NEXT_P","push","AuthRegisterForm","ip_address","userAgent","router","useRouter","email","name","query","t","useTranslation","subDomain","isBrowser","getSubDomain","location","hostname","slug","CONST","LoginSchema","z","min","message","username","password","password_confirmation","referral","hookForm","useForm","resolver","zodResolver","setValue","useEffect","isSubdomainTenant","useIsSubdomain","referralCode","getCookie","URLSearchParams","search","get","useReferral","authRegisterApi","useAuthRegisterApi","handleSubmit","encodedPath","redirectToPreviousPath","useRedirectPreviousPath","authSetLogin","useAuthStore","state","setLoading","setLogin","useUserGetProfile","useAuthSetLogin","isB2B","useIsTenant","isGate","isGateURL","div","className","p","span","AuthSocialButtonNew","trackerId","listSubdomainNoGoogleSignIn","form","onSubmit","data","origin","trackEvent","event","property","is_success","undefined","referrals","doFetch","user_agent","onSuccess","token","onError","err","fetcher","Error","error","getActualType","includes","status","setError","Object","entries","errors","map","key","value","FieldText","label","placeholder","validator","hook","FieldPassword","Button","type","size","isFull","isLoading","Link","onClick","href","pathname","url","a","rel","target","IconCheck","color","props","useIsDesktop","isBlueBirdTenant","isBlueBirdURL","isSubdomainBluebird","ip","useTrackScreen","trackEventGTM","trackEventGA","currentUser","replace","checkTawkTo","Head","title","AuthLayoutDesktop"],"sourceRoot":""}