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C,EAAK,SAAEC,GAAU9C,GAAE,cAAEwH,GAAelH,EACrDkH,GAAc,SAERjC,EAAM,CACVhB,UAAW,CACTkD,MAAO,CACLC,SAAU7E,EACVC,eAKN0E,GAAc,EAAM,EACpBnH,SAEDsH,IAAA,IAAC,QAAEC,GAASD,EAAA,OACX9B,EAAAA,EAAAA,MAAC7C,EAAU,CAAA3C,SAAA,EACTF,EAAAA,EAAAA,KAACJ,EAAAA,EAAU,CACT8H,SAAUjE,EACV,UAAQ,kBAGVzD,EAAAA,EAAAA,KAACC,EAAAA,GAAK,CAACH,KAAK,WAAUI,SACnByH,IAAA,IAAC,MAAEvH,EAAK,KAAEC,GAAMsH,EAAA,OACf3H,EAAAA,EAAAA,KAACM,EAAAA,EAAMsH,SAAQ,CACbrH,SAAO,EACPC,UAAQ,EACRkH,SAAUjE,EACVhD,MAAM,WACN,UAAQ,eACRC,YAAY,iBACZS,QAASd,EAAKO,cAA0BC,IAAfR,EAAKS,SAC1BV,GACJ,KAGNJ,EAAAA,EAAAA,KAACe,EAAAA,GAAI,CACHC,MAAOC,EAAAA,GAAAA,OAAa4G,YACpBnB,GAAIC,EAAAA,GACJC,GAAI,IAAIC,EAAAA,EAAcC,yBAAyB5G,SAChD,sBAGDF,EAAAA,EAAAA,KAAC8H,EAAAA,GAAOC,QAAO,CACb,UAAQ,YACRC,UAAWnE,GAAWJ,EACtBiE,UAAWD,EACXlH,SAAO,EACP0H,KAAK,SAAQ/H,SACd,YAGU,KAIjBF,EAAAA,EAAAA,KAACkI,EAAAA,EAAc,CACbC,KAAM,IAAItB,EAAAA,EAAcuB,eACxBC,KAAK,6BACLC,SAAS,0BAId,C","sources":["routes/Auth/sharedComponents/EmailInput.js","hooks/parseQuerySearch.js","routes/Auth/Login.js","routes/Auth/useOneTimeTokenLogin.js"],"sourcesContent":["import { Input } from '@nextretreat/ui-components/dist/Input'\nimport theme from '@nextretreat/ui-components/dist/Theme'\nimport { Field } from 'formik'\nimport PropTypes from 'prop-types'\nimport { Text } from 'components/atoms/Typography'\n\nexport const EmailInput = ({ name = 'email', ...passingProps }) => (\n \n {({ field, meta }) => (\n Invalid e-mail\n ) : undefined\n }\n invalid={meta.touched && meta.error !== undefined}\n {...passingProps}\n {...field}\n />\n )}\n \n)\n\nEmailInput.propTypes = {\n name: PropTypes.string,\n}\n","import { useEffect, useState } from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nexport const useQuerySearch = () => {\n const [searchParams] = useSearchParams()\n const asStruct = {}\n searchParams.forEach((value, key) => {\n asStruct[key] = value\n })\n return asStruct\n}\n\n// aim is to allow to hide some parts of query (as token) but still kinda have them.\nexport const useQuerySearchAndDelete = (toDelete = []) => {\n const [urlParams, setUrlParams] = useState({})\n const [searchParams, setSearchParams] = useSearchParams()\n const asStruct = {}\n searchParams.forEach((value, key) => {\n asStruct[key] = value\n })\n\n useEffect(() => {\n setUrlParams(asStruct)\n\n const newSearchParams = new URLSearchParams(searchParams)\n toDelete.forEach((key) => {\n newSearchParams.delete(key)\n })\n setSearchParams(newSearchParams)\n }, [])\n \n return {...urlParams, ...asStruct}\n}\n\n","import { useLazyQuery } from '@apollo/client'\nimport styled from '@emotion/styled'\nimport { Input } from '@nextretreat/ui-components/dist/Input'\nimport theme from '@nextretreat/ui-components/dist/Theme'\nimport { useAuth } from 'AuthProvider'\nimport { Field, Form, Formik } from 'formik'\nimport { rem } from 'polished'\nimport { useLocation, useNavigate } from 'react-router-dom'\nimport * as Yup from 'yup'\nimport { AuthQueries } from 'api/Auth/AuthQueries'\nimport Button from 'components/atoms/Button'\nimport { Text } from 'components/atoms/Typography'\nimport { Icon } from 'components/Icon'\nimport { InfoPanel } from 'components/InfoPanel'\nimport {\n LOCAL_STORAGE_ACCESS_TOKEN_KEY,\n LOCAL_STORAGE_REFRESH_TOKEN_KEY,\n} from 'constants/constants'\nimport { PRIVATE_ROUTES, PUBLIC_ROUTES } from 'constants/routes'\nimport { GTM_EVENTS, useGoogleTracking } from 'hooks/useGoogleTracking'\nimport AppHelmet from 'sharedComponents/AppHelmet'\nimport { authStorage } from 'utils/storage'\nimport { AuthCardFooter } from './sharedComponents/AuthCardFooter'\nimport { AuthLayout } from './sharedComponents/AuthLayout'\nimport { EmailInput } from './sharedComponents/EmailInput'\nimport { Heading, Link } from './sharedComponents/Partials'\nimport { useOneTimeTokenLogin } from './useOneTimeTokenLogin'\n\nconst loginValidationSchema = Yup.object().shape({\n email: Yup.string().email().required(),\n password: Yup.string().required().ensure(),\n})\n\nconst StyledForm = styled(Form)`\n & > * {\n margin-top: ${rem(16)};\n }\n`\n\nconst INVALID_INPUT_MESSAGE = 'One of the inputs is invalid'\n\nconst Login = () => {\n const navigate = useNavigate()\n const { state } = useLocation()\n const { refetchData } = useAuth()\n const oneTiemTokenLoading = useOneTimeTokenLogin()\n const { logGTMEvent } = useGoogleTracking()\n\n const [login, { loading, error }] = useLazyQuery(AuthQueries.LOGIN, {\n fetchPolicy: 'network-only',\n nextFetchPolicy: 'network-only',\n onCompleted: (data) => {\n if (data) {\n authStorage.set(LOCAL_STORAGE_ACCESS_TOKEN_KEY, data.login.accessToken)\n authStorage.set(\n LOCAL_STORAGE_REFRESH_TOKEN_KEY,\n data.login.refreshToken\n )\n logGTMEvent({ event: GTM_EVENTS.successLogin })\n refetchData()\n navigate(state?.path || `/${PRIVATE_ROUTES.MY_TRIPS}`)\n }\n },\n })\n\n return (\n <>\n \n \n \n \n \n \n
\n Log in to your account\n\n {error?.message === INVALID_INPUT_MESSAGE && (\n }\n alignItems=\"flex-start\"\n $gap={rem(12)}\n >\n \n Incorrect password. Forgot password? We can help you with{' '}\n \n resetting your password.\n \n \n \n )}\n\n {\n setSubmitting(true)\n\n await login({\n variables: {\n input: {\n userName: email,\n password,\n },\n },\n })\n\n setSubmitting(false)\n }}\n >\n {({ isValid }) => (\n \n \n\n \n {({ field, meta }) => (\n \n )}\n \n \n Forgot Password?\n \n \n Login\n \n \n )}\n \n\n \n
\n
\n \n )\n}\n\nexport default Login\n","import { useQuery } from '@apollo/client'\nimport { useAuth } from 'AuthProvider'\nimport { useLocation, useNavigate } from 'react-router-dom'\nimport { AuthQueries } from 'api/Auth/AuthQueries'\nimport {\n LOCAL_STORAGE_ACCESS_TOKEN_KEY,\n LOCAL_STORAGE_REFRESH_TOKEN_KEY,\n} from 'constants/constants'\nimport { PRIVATE_ROUTES } from 'constants/routes'\nimport { useQuerySearch } from 'hooks/parseQuerySearch'\nimport { authStorage } from 'utils/storage'\n\nexport const useOneTimeTokenLogin = () => {\n const navigate = useNavigate()\n const { state } = useLocation()\n const { refetchData } = useAuth()\n const { ott: oneTimeToken } = useQuerySearch()\n\n const { loading: oneTiemTokenLoading } = useQuery(\n AuthQueries.ONE_TIME_TOKEN_LOGIN,\n {\n fetchPolicy: 'network-only',\n nextFetchPolicy: 'network-only',\n skip: !oneTimeToken,\n variables: {\n token: oneTimeToken,\n },\n onCompleted: (data) => {\n if (data) {\n authStorage.set(\n LOCAL_STORAGE_ACCESS_TOKEN_KEY,\n data.oneTimeTokenLogin.accessToken\n )\n authStorage.set(\n LOCAL_STORAGE_REFRESH_TOKEN_KEY,\n data.oneTimeTokenLogin.refreshToken\n )\n\n refetchData()\n navigate(state?.path || `/${PRIVATE_ROUTES.MY_TRIPS}`)\n }\n },\n }\n )\n\n return oneTiemTokenLoading\n}\n"],"names":["EmailInput","_ref","name","passingProps","_jsx","Field","children","_ref2","field","meta","Input","isBlock","required","label","placeholder","helpText","touched","undefined","error","Text","color","theme","ERROR_DEFAULT","invalid","useQuerySearch","searchParams","useSearchParams","asStruct","forEach","value","key","useQuerySearchAndDelete","toDelete","arguments","length","urlParams","setUrlParams","useState","setSearchParams","useEffect","newSearchParams","URLSearchParams","delete","loginValidationSchema","Yup","shape","email","password","ensure","StyledForm","_styled","Form","target","rem","Login","navigate","useNavigate","state","useLocation","refetchData","useAuth","oneTiemTokenLoading","useOneTimeTokenLogin","ott","oneTimeToken","loading","useQuery","AuthQueries","ONE_TIME_TOKEN_LOGIN","fetchPolicy","nextFetchPolicy","skip","variables","token","onCompleted","data","authStorage","set","LOCAL_STORAGE_ACCESS_TOKEN_KEY","oneTimeTokenLogin","accessToken","LOCAL_STORAGE_REFRESH_TOKEN_KEY","refreshToken","path","PRIVATE_ROUTES","MY_TRIPS","logGTMEvent","useGoogleTracking","login","useLazyQuery","LOGIN","event","GTM_EVENTS","successLogin","_jsxs","_Fragment","AppHelmet","indexable","title","content","AuthLayout","Heading","message","InfoPanel","ERROR_LIGHT","icon","Icon","alignItems","$gap","fontWeight","as","Link","to","PUBLIC_ROUTES","REQUEST_RESET_PASSWORD","Formik","initialValues","cast","validationSchema","onSubmit","async","setSubmitting","input","userName","_ref3","isValid","disabled","_ref4","Password","TXT_DEFAULT","Button","Primary","isLoading","type","AuthCardFooter","link","REGISTRATION","text","linkText"],"sourceRoot":""}