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EAAAA,EAAAA,MACG8B,UAAU,2BACV5B,SAAS,2BACTC,KACC,0BACC,2DAAyD4D,EAAAA,EAAAA,IACxD3C,MAEDhB,IACC,GAAIA,EAAO,CAKT,MAAM8C,EAAe9C,EAAMmD,WAAW,MAElCJ,EAAAA,EAAAA,IAAkC/C,GADlCgD,OAAOhD,GAEX,MACyB,qBAAhB8C,IACNE,OAAOC,MAAMH,IACdA,GAAe9B,EAGnB,OAAO,KAeF4C,IAXuBC,EAAAA,EAAAA,MAASC,WAEoBhE,SAC/D,8BAG4BF,EAAAA,EAAAA,MAASqB,QA9QtB,sBAgRf,6BAGmDnB,SACnD,+BAGkCF,EAAAA,EAAAA,MAASqB,QArRpB,gBAuRvB,4CAG+DnB,SAC/D,6CAGoCF,EAAAA,EAAAA,MACnCoB,IA9RyB,GA+RzBG,IA/RyB,GAiSyCrB","sources":["webpack://_N_E/./node_modules/@hookform/resolvers/dist/resolvers.module.js","webpack://_N_E/./node_modules/@hookform/resolvers/yup/dist/yup.module.js","webpack://_N_E/./src/components/partial/AuthModals/AuthModals.types.ts","webpack://_N_E/./src/components/partial/AuthModals/AuthModals.utils.tsx","webpack://_N_E/./src/components/partial/AuthModals/AuthModals.tsx","webpack://_N_E/./src/util/validators/validators.tsx"],"sourcesContent":["import{get as r,set as e}from\"react-hook-form\";var i=function(e,i){for(var a in i.fields){var f=i.fields[a];if(f&&f.ref&&\"reportValidity\"in f.ref){var t=r(e,a);f.ref.setCustomValidity(t&&t.message||\"\"),f.ref.reportValidity()}}},a=function(a,f){f.shouldUseNativeValidation&&i(a,f);var t={};for(var o in a){var s=r(f.fields,o);e(t,o,Object.assign(a[o],{ref:s&&s.ref}))}return t};export{a as toNestError,i as validateFieldsNatively};\n//# sourceMappingURL=resolvers.module.js.map\n","import{validateFieldsNatively as e,toNestError as t}from\"@hookform/resolvers\";import{appendErrors as r}from\"react-hook-form\";var o=function(o,n,a){return void 0===n&&(n={}),void 0===a&&(a={}),function(s,i,c){try{return Promise.resolve(function(t,r){try{var u=(n.context&&\"development\"===process.env.NODE_ENV&&console.warn(\"You should not used the yup options context. Please, use the 'useForm' context object instead\"),Promise.resolve(o[\"sync\"===a.mode?\"validateSync\":\"validate\"](s,Object.assign({abortEarly:!1},n,{context:i}))).then(function(t){return c.shouldUseNativeValidation&&e({},c),{values:t,errors:{}}}))}catch(e){return r(e)}return u&&u.then?u.then(void 0,r):u}(0,function(e){return{values:{},errors:t((o=e,n=!c.shouldUseNativeValidation&&\"all\"===c.criteriaMode,o.inner.reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var o=e[t.path].types,a=o&&o[t.type];e[t.path]=r(t.path,n,e,t.type,a?[].concat(a,t.message):t.message)}return e},{})),c)};var o,n}))}catch(e){return Promise.reject(e)}}};export{o as yupResolver};\n//# sourceMappingURL=yup.module.js.map\n","export enum ModalTypes {\n login = \"login\",\n register = \"register\",\n passwordReset = \"passwordReset\",\n logout = \"logout\",\n}\n\nexport type ModalType = keyof typeof ModalTypes;\n","export enum Actions {\n LoginHide = \"LoginHide\",\n LoginShow = \"LoginShow\",\n PassResetHide = \"PassResetHide\",\n PassResetShow = \"PassResetShow\",\n PassResetSuccess = \"PassResetSuccess\",\n RegisterHide = \"RegisterHide\",\n RegisterShow = \"RegisterShow\",\n RegisterSuccess = \"RegisterSuccess\",\n SignUpHide = \"SignUpHide\",\n SignUpShow = \"SignUpShow\",\n}\n\nexport const initialState = {\n showLogin: false,\n showPassReset: false,\n showSignUp: false,\n showRegister: false,\n};\n\ntype State = typeof initialState;\n\ntype Action = { type: keyof typeof Actions };\n\nexport function reducer(state: State, action: Action): State {\n switch (action.type) {\n case Actions.LoginHide:\n return { ...state, showLogin: false };\n case Actions.LoginShow:\n return { ...initialState, showLogin: true };\n case Actions.PassResetHide:\n return { ...state, showLogin: true, showPassReset: false };\n case Actions.PassResetSuccess:\n return initialState;\n case Actions.PassResetShow:\n return { ...state, showPassReset: true };\n case Actions.RegisterHide:\n return { ...state, showSignUp: true, showRegister: false };\n case Actions.RegisterShow:\n return { ...initialState, showRegister: true };\n case Actions.RegisterSuccess:\n return initialState;\n case Actions.SignUpHide:\n return { ...state, showSignUp: false };\n case Actions.SignUpShow:\n return { ...initialState, showSignUp: true };\n default:\n return state;\n }\n}\n","/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport dynamic from \"next/dynamic\";\nimport React, { CSSProperties, useReducer } from \"react\";\n\nimport PasswordResetModal from \"#components/partial/PasswordResetModal/PasswordResetModal\";\nimport RegisterModal from \"#components/partial/RegisterModal/RegisterModal\";\nimport useAuth from \"#hooks/useAuth/useAuth\";\n\nimport { ModalType, ModalTypes } from \"./AuthModals.types\";\nimport { Actions, initialState, reducer } from \"./AuthModals.utils\";\n\nconst LoginModal = dynamic(\n () => import(\"#components/partial/LoginModal/LoginModal\"),\n);\n\n/**\n * This is an unstyled button that takes in the prop buttonType with\n * the following options:\n *\n * \"login\"\n * \"register\"\n * \"passwordReset\"\n * \"logout\"\n *\n * As well as an optional classname and inline styling which is self explanitory\n *\n * use example:\n *\n * \n *

Click me to Log In

\n * \n *\n * Aiden/11082022\n */\n\nconst AuthModals = ({\n children,\n buttonType,\n classname,\n inlineStyle,\n}: {\n buttonType: ModalType;\n children: JSX.Element;\n classname: string;\n inlineStyle?: CSSProperties;\n}) => {\n const [state, dispatch] = useReducer(reducer, initialState);\n const { showLogin, showPassReset, showRegister } = state;\n const { authenticated, logOut } = useAuth();\n\n const handleClick = () => {\n switch (buttonType) {\n case ModalTypes.login:\n return handleLogin();\n case ModalTypes.register:\n // not really great to have this here, but this\n // needs to be redone at some point\n return window.location.assign(\"/apply\");\n case ModalTypes.passwordReset:\n return handleForgotPassword();\n case ModalTypes.logout:\n return handleLogOut();\n default:\n return buttonType;\n }\n };\n\n const handleLogOut = async () => {\n await logOut();\n };\n\n const handleLogin = () => {\n dispatch({ type: Actions.LoginShow });\n };\n\n const handleForgotPassword = () => {\n dispatch({ type: Actions.PassResetShow });\n };\n\n const handleSignUp = () => {\n dispatch({ type: Actions.SignUpShow });\n };\n\n const handleHideLogin = () => {\n dispatch({ type: Actions.LoginHide });\n };\n\n const handleHidePasswordReset = () => {\n dispatch({ type: Actions.PassResetHide });\n };\n\n const handleHideRegister = () => {\n dispatch({ type: Actions.RegisterHide });\n };\n\n const handleRegistrationSuccess = () => {\n dispatch({ type: Actions.RegisterSuccess });\n };\n\n return (\n \n \n {children}\n \n \n {!authenticated && (\n <>\n \n\n \n \n )}\n \n );\n};\n\nexport default AuthModals;\n","import moment from \"moment\";\nimport { boolean, date, number, object, ref, string, StringSchema } from \"yup\";\nimport { AnyObject } from \"yup/lib/types\";\n\nimport { USStateInfo } from \"#constants/allUSStates\";\nimport {\n centsToDollarString,\n parseCentsFromCurrencyInputString,\n} from \"#util/number/number\";\n\nexport const validateStateAbbreviations = (usStates: USStateInfo[]) =>\n string()\n .length(2, () => \"State must be exactly two characters\")\n .required()\n .test(\"state\", \"This state is not supported by Tenet yet\", (value) => {\n const state = usStates.find(\n (usState) => usState.abbreviation === value?.toUpperCase(),\n );\n if (value && state?.supportsDirectPurchase && state?.supportsRefinance) {\n return true;\n }\n\n return false;\n });\n\nexport const validStateAbbreviation = (usStates: USStateInfo[]) =>\n string()\n .length(2)\n .test(\"real-state\", \"Please enter a valid state abbreviation\", (value) => {\n const state = usStates.find(\n (usState) => usState.abbreviation === value?.toUpperCase(),\n );\n\n return !!state;\n });\n\n// MT, 6/6/23 - We only want 5 digit zip codes so all DB records are consistent. Previously, there were both 5 and 9 digit in the DB\nconst usPostalCodeRegEx = /^\\d{5}$/;\nconst dateOfBirthRegEx =\n /^(((0)[0-9])|((1)[0-2]))(\\/)([0-2][0-9]|(3)[0-1])(\\/)\\d{4}$/;\nconst ssnRegEx = /^\\d{3}-\\d{2}-\\d{4}$/;\nconst vinLength = 17;\nconst bankAccountRegEx = /\\W*\\d{8,17}\\b/;\nconst routingNumberLength = 9;\nconst phoneNumberLength = 10;\n\nexport const checkedRequiredValidator = boolean()\n .required(\"You must accept to continue.\")\n .oneOf([true], \"You must accept to continue.\");\n\nexport const emailValidator = string().email(\"Please enter a valid email.\");\nexport const emailRequiredValidator = emailValidator.required(\n \"Please enter a valid email.\",\n);\n\nexport const loginPasswordRequiredValidator = string().required(\n \"Please enter your password.\",\n);\n\nexport const passwordValidator = string()\n .min(8, \"Password must be at least 8 characters long.\")\n .matches(/[A-Z]+/, \"Password must contain at least one uppercase letter\")\n .matches(/\\d+/, \"Password must contain at least one number\");\n\nexport const passwordRequiredValidator = passwordValidator.required(\n \"Please enter a password.\",\n);\n\nexport const phoneValidator = string()\n .min(phoneNumberLength, \"Please enter a valid phone number.\")\n .max(phoneNumberLength, \"Please enter a valid phone number.\");\n\nexport const phoneRequiredValidator = phoneValidator.transform((val) =>\n val === \"\" ? undefined : (val as string),\n);\n\nexport const positiveIntegerValidator = number()\n .typeError(\"Please enter a number\")\n .test(\n \"Positive integer\",\n \"Please enter a whole number greater than 0.\",\n (value?: number) => {\n if (!value) return false;\n\n if (value <= 0) return false;\n\n return value % Math.floor(value) === 0;\n },\n );\n\nexport const confirmPasswordValidator = string().oneOf(\n [ref(\"password\"), null],\n \"The password you have entered does not match the confirmation.\",\n);\n\nexport const confirmPasswordRequiredValidator =\n confirmPasswordValidator.required(\"Please re-enter your password.\");\n\nexport const vinValidator = string().length(vinLength, \"Must be 17 characters\");\n\nexport const vinRequiredValidator = vinValidator.required();\n\nexport const dateOfBirthValidator = string()\n .matches(dateOfBirthRegEx, \"Please enter a valid date of birth.\")\n .test(\n \"18-or-older\",\n \"Sorry! You must be 18 years of age or older to use Tenet\",\n (value?: string) => {\n if (!value) return false;\n\n const [M, D, Y] = value.split(\"/\");\n const DOB = new Date(+Y, +M - 1, +D);\n const yearsAgo = (+new Date() - +DOB) / 1000 / 60 / 60 / 24 / 365;\n\n return yearsAgo >= 18;\n },\n );\nexport const MigratedDateOfBirthValidator = date().test(\n \"18-or-older\",\n \"Sorry! You must be 18 years of age or older to use Tenet\",\n (value?: Date) => {\n if (!value) return false;\n\n const yearsAgo = (+new Date() - +value) / 1000 / 60 / 60 / 24 / 365;\n\n return yearsAgo >= 18;\n },\n);\nexport const moveInDateValidator = date()\n .typeError(\"Month and year is required (e.g. July 2020)\")\n .test(\n \"is-previous-date\",\n \"Please enter a date earlier than today\",\n (value?: Date) => {\n if (!value) return false;\n\n const today = moment();\n const inputDate = moment(value);\n // today.diff(inputDate) will return negative if today is earlier than inputDate\n return today.diff(inputDate) > 0;\n },\n );\nexport const usPostalCodeValidator = string().matches(\n usPostalCodeRegEx,\n \"Please enter a valid postal code.\",\n);\nexport const usPostalCodeRequiredValidator = usPostalCodeValidator.required(\n \"Please enter a valid postal code.\",\n);\n\nexport const currencyStringValidator = string().test(\n \"test-cents-number-conversion\",\n \"Please enter a valid number\",\n (value) => {\n if (value) {\n const parsedValue = parseCentsFromCurrencyInputString(value);\n\n return !!parsedValue && !Number.isNaN(parsedValue);\n }\n\n return false;\n },\n);\nexport const currencyStringRequiredValidator = currencyStringValidator.required(\n \"Please enter an amount.\",\n);\n\nexport const currencyValueValidator = (\n min: number,\n): StringSchema =>\n string()\n .typeError(\"Please enter an amount.\")\n .required(\"Please enter an amount.\")\n .test(\n \"test-cents-number-value\",\n `Please enter an amount greater than $${(min / 100).toFixed(2)}.`,\n (value) => {\n if (value) {\n /** MT, 2/27/23 - Entering a price ending in \".00\" results in value coming in\n * as a cents integer, not a Currency string. This guards for that scenario.\n * (I don't love this solution, but it works and I was chasing this for too long)\n * */\n const parsedValue = !value.startsWith(\"$\")\n ? Number(value)\n : parseCentsFromCurrencyInputString(value);\n return (\n typeof parsedValue !== \"undefined\" &&\n !Number.isNaN(parsedValue) &&\n parsedValue >= min\n );\n }\n return false;\n },\n );\n\nexport const maxCurrencyValueValidator = (\n max: number,\n): StringSchema =>\n string()\n .typeError(\"Please enter an amount.\")\n .required(\"Please enter an amount.\")\n .test(\n \"test-cents-number-value\",\n `Please enter an amount less than $${(max / 100).toFixed(2)}.`,\n (value) => {\n if (value) {\n /** MT, 2/27/23 - Entering a price ending in \".00\" results in value coming in\n * as a cents integer, not a Currency string. This guards for that scenario.\n * (I don't love this solution, but it works and I was chasing this for too long)\n * */\n const parsedValue = !value.startsWith(\"$\")\n ? Number(value)\n : parseCentsFromCurrencyInputString(value);\n return (\n typeof parsedValue !== \"undefined\" &&\n !Number.isNaN(parsedValue) &&\n parsedValue <= max\n );\n }\n return false;\n },\n );\n\nexport const minMaxCurrencyValueValidator = (\n min: number,\n max: number,\n lowErrorMessage?: string,\n highErrorMessage?: string,\n): StringSchema => {\n const lowErrMessage =\n lowErrorMessage ||\n `Please enter an amount less than $${(max / 100).toFixed(2)}.`;\n const highErrMessage =\n highErrorMessage ||\n `Please enter an amount greater than $${(min / 100).toFixed(2)}.`;\n return string()\n .typeError(\"Please enter an amount.\")\n .required(\"Please enter an amount.\")\n .test(\"test-cents-number-value-max\", lowErrMessage, (value) => {\n if (value) {\n /** MT, 2/27/23 - Entering a price ending in \".00\" results in value coming in\n * as a cents integer, not a Currency string. This guards for that scenario.\n * (I don't love this solution, but it works and I was chasing this for too long)\n * */\n const parsedValue = !value.startsWith(\"$\")\n ? Number(value)\n : parseCentsFromCurrencyInputString(value);\n return (\n typeof parsedValue !== \"undefined\" &&\n !Number.isNaN(parsedValue) &&\n parsedValue <= max\n );\n }\n return false;\n })\n .test(\"test-cents-number-value-min\", highErrMessage, (value) => {\n if (value) {\n /** MT, 2/27/23 - Entering a price ending in \".00\" results in value coming in\n * as a cents integer, not a Currency string. This guards for that scenario.\n * (I don't love this solution, but it works and I was chasing this for too long)\n * */\n const parsedValue = !value.startsWith(\"$\")\n ? Number(value)\n : parseCentsFromCurrencyInputString(value);\n return (\n typeof parsedValue !== \"undefined\" &&\n !Number.isNaN(parsedValue) &&\n parsedValue >= min\n );\n }\n return false;\n });\n};\n\nexport const autopayAmountCurrencyValueValidator = (\n min: number,\n): StringSchema =>\n string()\n .typeError(\"Please enter an amount.\")\n .required(\"Please enter an amount.\")\n .test(\n \"test-cents-number-value\",\n `Please enter an amount greater than monthly payment of ${centsToDollarString(\n min,\n )}`,\n (value) => {\n if (value) {\n /** MT, 2/27/23 - Entering a price ending in \".00\" results in value coming in\n * as a cents integer, not a Currency string. This guards for that scenario.\n * (I don't love this solution, but it works and I was chasing this for too long)\n * */\n const parsedValue = !value.startsWith(\"$\")\n ? Number(value)\n : parseCentsFromCurrencyInputString(value);\n return (\n typeof parsedValue !== \"undefined\" &&\n !Number.isNaN(parsedValue) &&\n parsedValue >= min\n );\n }\n return false;\n },\n );\n\nexport const stateObjectValidator = object().nullable();\n\nexport const stateObjectRequiredValidator = stateObjectValidator.required(\n \"Please select a US state.\",\n);\n\nexport const usSsnValidator = string().matches(\n ssnRegEx,\n \"Please enter a valid SSN.\",\n);\n\nexport const usSsnRequiredValidator = usSsnValidator.required(\n \"Please enter a valid SSN.\",\n);\n\nexport const bankAccountValidator = string().matches(\n bankAccountRegEx,\n \"Please enter a vaid bank account number.\",\n);\n\nexport const bankAccountRequiredValidator = bankAccountValidator.required(\n \"Please enter a vaid bank account number.\",\n);\n\nexport const routingNumberValidator = string()\n .min(routingNumberLength)\n .max(routingNumberLength);\n\nexport const routingNumberRequiredValidator = routingNumberValidator.required();\n"],"names":["e","i","a","fields","f","ref","t","setCustomValidity","message","reportValidity","shouldUseNativeValidation","o","s","Object","assign","n","c","Promise","resolve","r","u","context","mode","abortEarly","then","values","errors","criteriaMode","inner","reduce","path","type","types","concat","reject","ModalTypes","Actions","initialState","showLogin","showPassReset","showSignUp","showRegister","reducer","state","action","LoginHide","LoginShow","PassResetHide","PassResetSuccess","PassResetShow","RegisterHide","RegisterShow","RegisterSuccess","SignUpHide","SignUpShow","LoginModal","dynamic","children","buttonType","classname","inlineStyle","dispatch","useReducer","authenticated","logOut","useAuth","handleLogOut","async","handleLogin","handleForgotPassword","style","cursor","className","onClick","login","register","window","location","passwordReset","logout","open","onClose","handleOpenPasswordReset","handleOpenSignUp","RegisterModal","onSuccess","PasswordResetModal","validateStateAbbreviations","usStates","string","length","required","test","value","find","usState","abbreviation","toUpperCase","supportsDirectPurchase","supportsRefinance","validStateAbbreviation","checkedRequiredValidator","boolean","oneOf","emailValidator","email","emailRequiredValidator","loginPasswordRequiredValidator","passwordRequiredValidator","min","matches","phoneValidator","max","phoneRequiredValidator","transform","val","undefined","positiveIntegerValidator","number","typeError","Math","floor","confirmPasswordRequiredValidator","vinValidator","MigratedDateOfBirthValidator","M","D","Y","split","DOB","Date","date","moveInDateValidator","today","moment","inputDate","diff","usPostalCodeRequiredValidator","currencyValueValidator","parsedValue","parseCentsFromCurrencyInputString","Number","isNaN","toFixed","startsWith","maxCurrencyValueValidator","minMaxCurrencyValueValidator","lowErrorMessage","highErrorMessage","lowErrMessage","highErrMessage","autopayAmountCurrencyValueValidator","centsToDollarString","usSsnRequiredValidator","object","nullable"],"sourceRoot":""}