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GAHI3D,SACI0D,EAAAA,EAAAA,KAAAA,YAA8B,CAAEE,MAAO5D,IAE3CF,GAAaC,GAAYH,EAAa,CACxC,MAAMiE,EAAoBC,IAAOlE,SAC3B8D,EAAAA,EAAAA,KAAAA,iBACJ5D,EACAC,EACA8D,EAAkBE,WAIxB,MAAO3G,GAOP,OAHAgF,EAAShF,QAET4G,QAAQhG,MAAMZ,GAIP,OAATwF,QAAS,IAATA,GAAAA,IACAK,EAAOgB,KAAK,gBAmBR","sources":["webpack://_N_E/./src/components/base/Card/Card.styles.tsx","webpack://_N_E/./src/components/base/Card/Card.types.tsx","webpack://_N_E/./src/components/base/Card/Card.tsx","webpack://_N_E/./src/hooks/useFirstFocusable/useFirstFocusable.tsx","webpack://_N_E/./src/components/base/Form/Form.tsx","webpack://_N_E/./src/components/base/InputField/InputField.tsx","webpack://_N_E/./src/components/base/PhoneInputField/PhoneInputField.tsx","webpack://_N_E/./src/components/partial/PasswordResetModal/PasswordResetModal.tsx","webpack://_N_E/./src/components/base/DateInput/DateInput.tsx","webpack://_N_E/./src/components/base/DateInputField/DateInputField.tsx","webpack://_N_E/./src/components/partial/RegisterModal/RegisterModal.types.tsx","webpack://_N_E/./src/components/partial/RegisterModal/RegisterModal.util.tsx","webpack://_N_E/./src/components/partial/RegisterModal/RegisterModal.tsx"],"sourcesContent":["import { css } from \"#themes\";\n\nexport const root = css({\n borderRadius: \"$card\",\n paddingX: 32,\n paddingY: 20,\n\n variants: {\n variant: {\n gradient: {\n background: \"$brandGradient\",\n },\n lightBlue: {\n background: \"#E8F9FF\",\n },\n primary: {\n background: \"$brandAccentPrimary\",\n },\n tipEmission: {\n background: \"$brandSecondaryLight\",\n },\n tipBattery: {\n background: \"$brandPrimaryLight\",\n },\n inputGroup: {\n background: \"$backgroundSecondary\",\n },\n savings: {\n background: \"$brandSecondaryLight\",\n },\n metricsGroup: {\n paddingX: 0,\n paddingY: 0,\n display: \"flex\",\n flexDirection: \"column\",\n background: \"$backgroundSecondary\",\n },\n },\n },\n length: 0,\n});\n","export enum Variants {\n inputGroup = \"inputGroup\",\n gradient = \"gradient\",\n metricsGroup = \"metricsGroup\",\n primary = \"primary\",\n savings = \"savings\",\n tipBattery = \"tipBattery\",\n tipEmission = \"tipEmission\",\n lightBlue = \"lightBlue\",\n}\n\nexport type Component = (\n props: Props,\n) => React.ReactElement | null;\n\nexport type Props =\n PolymorphicComponentPropsWithRef<\n T,\n {\n variant?: keyof typeof Variants;\n }\n >;\n","import { forwardRef } from \"react\";\n\nimport * as css from \"./Card.styles\";\nimport { Component as ComponentType, Props, Variants } from \"./Card.types\";\n\n/**\n * The Card component is used to group content together by presenting it\n * inside of a visual container.\n *\n * By default, it will render as a block-level `
` element, though this can\n * be overridden by providing a valid elementType via the `as` prop.\n *\n * Card accepts a `variant` prop, which may be used to determine the visual\n * style of the container.\n */\nconst Text: ComponentType = forwardRef(\n (\n { as, variant = Variants.lightBlue, ...otherProps }: Props,\n ref?: PolymorphicRef,\n ) => {\n const Component = as || \"span\";\n\n return (\n \n );\n },\n);\n\nexport default Text;\n","import { useEffect } from \"react\";\n\n/**\n * This hook will find and focus on the first focusable DOM node in the given\n * container element. It accepts a ref that contains the DOM node to\n * search within, as well as an optional list of dependencies, which determines\n * when the hook is re-run (ie, when the dependencies change, the container will\n * be re-searched, and the first found element focused on again).\n */\nfunction useFirstFocusable(\n containerRef: React.MutableRefObject,\n dependencies?: unknown[],\n focus = true,\n) {\n useEffect(() => {\n if (containerRef.current) {\n const focusable: HTMLElement | null = containerRef.current.querySelector(\n \"button, [href], input, select, textarea, [tabindex]\",\n );\n\n if (focus) {\n focusable?.focus();\n }\n }\n // Dependencies are based on function parameters, and cannot be statically\n // typed, so we're disabling the eslint rule here.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [...(dependencies || [])]);\n}\n\nexport default useFirstFocusable;\n","import { forwardRef, useEffect, useRef } from \"react\";\n\nimport Card from \"#components/base/Card/Card\";\nimport Text from \"#components/base/Text/Text\";\nimport useFirstFocusable from \"#hooks/useFirstFocusable/useFirstFocusable\";\nimport { flex, layout } from \"#styles\";\n\nimport type { Props } from \"./Form.types\";\n\n/**\n * Form is a simple wrapper around an HTML `
` element, with a set of props\n * designed for use with \"react-hook-form\". More specifically:\n *\n * - The form component contains styles for arranging inputs vertically with a\n * standard gap amount.\n * - The form component will redirect focus to the first focusable element in\n * the Form after mounting.\n * - The form component will handle rendering form-level errors when a\n * \"react-hook-form\" `errors` object is passed with a error key with the\n * name \"form\".\n * - The form component will handle clearing \"form\" errors on submit events,\n * when a \"react-hook-form\" `clearErrors` fn is passed.\n */\nconst Form = forwardRef(\n (\n {\n children,\n clearErrors,\n onSubmit,\n errors,\n autoFocus = true,\n \"aria-label\": ariaLabel,\n ...otherProps\n },\n ref,\n ) => {\n const formRef = useRef(null);\n const handleSubmit = (e: React.FormEvent) => {\n clearErrors?.(\"form\");\n onSubmit?.(e);\n };\n\n useEffect(() => {\n // If a `ref` value has been forwarded, we need to share current\n // `formRef` value with it on every render.\n if (formRef && ref) {\n if (typeof ref === \"function\") {\n ref(formRef.current);\n } else {\n // eslint-disable-next-line no-param-reassign\n ref.current = formRef.current;\n }\n }\n });\n\n useFirstFocusable(formRef, [], autoFocus);\n\n return (\n \n {errors?.form && (\n \n {errors.form.message}\n \n )}\n\n {children}\n \n );\n },\n);\n\nexport default Form;\n","/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport { forwardRef } from \"react\";\n\nimport Input from \"#components/base/Input/Input\";\nimport Text from \"#components/base/Text/Text\";\nimport { flex, layout } from \"#styles\";\n\nimport type { Component, Props } from \"./InputField.types\";\n\nconst InputField: Component = forwardRef(\n (\n {\n className,\n errors,\n label,\n name,\n hidden,\n \"aria-label\": ariaLabel,\n ...otherProps\n }: Props,\n ref?: PolymorphicRef,\n ) => {\n const hasError = !!errors?.[name];\n return (\n \n {label && (\n \n {label}\n \n )}\n\n
\n {/* @ts-ignore */ \"\"}\n \n\n {hasError && (\n \n {errors?.[name]?.message}\n \n )}\n
\n
\n );\n },\n);\n\nexport default InputField;\n","import { forwardRef } from \"react\";\nimport { Control, useController } from \"react-hook-form\";\nimport NumberFormat from \"react-number-format\";\n\nimport Input from \"#components/base/Input/Input\";\nimport Text from \"#components/base/Text/Text\";\nimport { flex, layout } from \"#styles\";\n\nimport { Props } from \"./PhoneInputField.types\";\n\n/**\n * `PhoneInputField` is an specialized input field that standardizes the input\n * and formatting of phone numbers. It allows numbers to be input and visually\n * displayed in a more human-readable format, while allowing the value tracked\n * by a react-hook-form backed form state to be an unbroken string of numeric\n * digits.\n */\nexport const PhoneInputField = forwardRef(\n ({ className, control, errors, id, label, name, ...otherProps }, ref) => {\n const { field } = useController({ control: control as Control, name });\n const { onChange, ...fieldProps } = field;\n const hasError = !!errors?.[field.name];\n const handleValueChange = ({ value }: { value: string }) => onChange(value);\n return (\n
\n {label && (\n \n {label}\n \n )}\n\n
\n \n\n {hasError && (\n \n {errors?.[name]?.message}\n \n )}\n
\n
\n );\n },\n);\n\nexport default PhoneInputField;\n","import dynamic from \"next/dynamic\";\nimport { useRef } from \"react\";\n\nimport Modal from \"#components/base/Modal/Modal\";\nimport type { Props as ModalProps } from \"#components/base/Modal/Modal.types\";\n\nconst PasswordResetForm = dynamic(\n () => import(\"../PasswordResetForm/PasswordResetForm\"),\n);\n\nexport default function PasswordResetModal({ onClose, open }: ModalProps) {\n const hasBeenOpen = useRef(false);\n\n if (open && !hasBeenOpen.current) {\n hasBeenOpen.current = true; // lazy load the form until initial modal open\n }\n\n return (\n \n {hasBeenOpen.current && }\n \n );\n}\n","import { forwardRef } from \"react\";\nimport NumberFormat from \"react-number-format\";\n\nimport Input from \"#components/base/Input/Input\";\n\nimport { Props } from \"./DateInput.types\";\n\nconst DateInput = forwardRef((props, ref) => (\n \n));\n\nexport default DateInput;\n","import { forwardRef } from \"react\";\n\nimport DateInput from \"#components/base/DateInput/DateInput\";\nimport Text from \"#components/base/Text/Text\";\nimport { flex, layout } from \"#styles\";\n\nimport { Props } from \"./DateInputField.types\";\n\nconst DateInputField = forwardRef(\n ({ className, errors, label, name, ...otherProps }, ref) => {\n const hasError = !!errors?.[name];\n\n return (\n
\n {label && (\n \n {label}\n \n )}\n\n
\n \n\n {hasError && (\n \n {errors?.[name]?.message}\n \n )}\n
\n
\n );\n },\n);\n\nexport default DateInputField;\n","import { SubmitHandler } from \"react-hook-form\";\n\nimport { Props as ModalProps } from \"#components/base/Modal/Modal.types\";\n\nexport enum ActionTypes {\n UPDATE_VALUES = \"UPDATE_VALUES\",\n RESET_VALUES = \"RESET_VALUES\",\n}\n\nexport type Actions =\n | { payload: State; type: ActionTypes.UPDATE_VALUES }\n | { type: ActionTypes.RESET_VALUES };\n\nexport interface Props extends ModalProps {\n /**\n * The callback handler invoked when the user successfully registers via this\n * modal.\n */\n onSuccess?: () => void;\n}\n\nexport interface State {\n acceptsEmail?: boolean;\n dateOfBirth?: string;\n email?: string;\n firstName?: string;\n lastName?: string;\n phoneNumber?: string;\n}\n\nexport interface StepOneFieldValues {\n dateOfBirth?: string;\n firstName?: string;\n lastName?: string;\n phoneNumber?: string;\n}\n\nexport interface StepTwoFieldValues {\n acceptsEmail?: boolean;\n confirmPassword?: string;\n email?: string;\n password?: string;\n}\n\nexport interface StepProps {\n error?: unknown;\n onSubmit?: SubmitHandler;\n}\n","import { yupResolver } from \"@hookform/resolvers/yup\";\nimport { object, string } from \"yup\";\n\nimport {\n checkedRequiredValidator,\n confirmPasswordRequiredValidator,\n emailRequiredValidator,\n MigratedDateOfBirthValidator,\n passwordRequiredValidator,\n phoneRequiredValidator,\n} from \"#util/validators/validators\";\n\nimport { Actions, State } from \"./RegisterModal.types\";\n\nexport const initialState = {\n acceptsEmail: false,\n dateOfBirth: \"\",\n email: \"\",\n firstName: \"\",\n lastName: \"\",\n phoneNumber: \"\",\n};\n\nexport const personalInfoFormConfig = {\n defaultValues: {\n dateOfBirth: \"\",\n firstName: \"\",\n lastName: \"\",\n phoneNumber: \"\",\n },\n mode: \"onSubmit\",\n resolver: yupResolver(\n object({\n dateOfBirth: MigratedDateOfBirthValidator.required(\n \"Please enter a valid date of birth.\",\n ).nullable(),\n firstName: string().required(),\n lastName: string().required(),\n phoneNumber: phoneRequiredValidator,\n }),\n ),\n} as const;\n\nexport const registerFormConfig = {\n defaultValues: {\n acceptsEmail: false,\n confirmPassword: \"\",\n email: \"\",\n password: \"\",\n },\n mode: \"onSubmit\",\n resolver: yupResolver(\n object({\n acceptsEmail: checkedRequiredValidator,\n confirmPassword: confirmPasswordRequiredValidator,\n email: emailRequiredValidator,\n password: passwordRequiredValidator,\n }),\n ),\n} as const;\n\n/* eslint-disable default-param-last */\n/* MPR, 2022/8/16: ideally we would follow this rule universally, but I am\n * neither going to reorder the reducers parameters, nor modify the actions\n * type to allow null or undefined to be passed should state also not be */\nexport const reducer = (state: State = {}, action: Actions) => {\n switch (action.type) {\n case \"UPDATE_VALUES\":\n return {\n ...state,\n ...action.payload,\n };\n case \"RESET_VALUES\":\n return initialState;\n default:\n return state;\n }\n};\n/* eslint-enable default-param-last */\n","import classNames from \"classnames\";\nimport moment from \"moment\";\nimport { useCallback, useEffect, useReducer, useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\n\nimport LOSAPIClient from \"#api.los/client\";\nimport Button from \"#components/base/Button/Button\";\nimport CheckboxField from \"#components/base/CheckboxField/CheckboxField\";\nimport DateInputField from \"#components/base/DateInputField/DateInputField\";\nimport Form from \"#components/base/Form/Form\";\nimport InputField from \"#components/base/InputField/InputField\";\nimport Modal from \"#components/base/Modal/Modal\";\nimport PhoneInputField from \"#components/base/PhoneInputField/PhoneInputField\";\nimport Text from \"#components/base/Text/Text\";\nimport { useRouterContext as useRouter } from \"#components/provider/Router\";\nimport { AUTH_CODES } from \"#constants/errorCodes\";\nimport { layout } from \"#styles\";\nimport atomics from \"#styles/atomic.module.scss\";\n\nimport {\n ActionTypes,\n Props,\n StepOneFieldValues,\n StepProps,\n StepTwoFieldValues,\n} from \"./RegisterModal.types\";\nimport {\n initialState,\n personalInfoFormConfig,\n reducer,\n registerFormConfig,\n} from \"./RegisterModal.util\";\n\nconst FormStepOne = ({ onSubmit }: StepProps) => {\n const {\n control,\n clearErrors,\n formState: { errors, isSubmitting },\n handleSubmit,\n register,\n } = useForm(personalInfoFormConfig);\n\n return (\n {\n onSubmit?.(values);\n // nextStep();\n })}\n aria-label=\"register personal info\"\n >\n \n\n \n\n \n\n \n\n \n \n );\n};\n\nconst FormStepTwo = ({ error, onSubmit }: StepProps) => {\n const {\n clearErrors,\n formState: { errors, isSubmitting },\n handleSubmit,\n register,\n setError,\n } = useForm(registerFormConfig);\n\n const handleError = useCallback(\n (e: unknown) => {\n switch (typeof e === \"object\" && (e as Record)?.code) {\n case AUTH_CODES.IN_USE:\n setError(\n \"email\",\n {\n message:\n \"This email address is already associated with an account.\",\n },\n { shouldFocus: true },\n );\n break;\n case AUTH_CODES.WEAK_PASS:\n setError(\n \"password\",\n { message: \"Your password must be at least 6 digits long.\" },\n { shouldFocus: true },\n );\n break;\n default:\n setError(\n \"form\",\n {\n message:\n \"Unable to create an account. Check your details and try again!\",\n },\n { shouldFocus: true },\n );\n }\n },\n [setError],\n );\n\n useEffect(() => {\n if (error) {\n handleError(error);\n }\n }, [handleError, error]);\n\n return (\n {\n onSubmit?.(values);\n })}\n aria-label=\"register email and password\"\n >\n \n\n \n\n \n\n \n\n \n Create an account\n \n \n );\n};\n\n/**\n * RegisterModal is a modal that allows a user to create a new account with\n * Tenet, via a two-step signup process, without requiring them to also create a\n * loan application.\n */\nconst RegisterModal = ({ onClose, onSuccess, ...props }: Props) => {\n const [formValueState, dispatch] = useReducer(reducer, initialState);\n const [error, setError] = useState(null);\n const router = useRouter();\n\n const handleSubmitStepOne = (values: StepOneFieldValues) => {\n dispatch({ payload: values, type: ActionTypes.UPDATE_VALUES });\n };\n\n const handleSubmitStepTwo = async (values: StepTwoFieldValues) => {\n // Destruct out variables we don't want to save to state.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { password, confirmPassword, ...otherValues } = values;\n dispatch({ payload: otherValues, type: ActionTypes.UPDATE_VALUES });\n\n const { firstName, lastName, dateOfBirth, phoneNumber } = formValueState;\n if (values.email && values.password) {\n try {\n await LOSAPIClient.user.register(values.email, values.password);\n const isAuthenticated = await LOSAPIClient.isAuthenticated();\n if (isAuthenticated) {\n if (phoneNumber) {\n await LOSAPIClient.user.updatePhone({ phone: phoneNumber });\n }\n if (firstName && lastName && dateOfBirth) {\n const dateOfBirthMoment = moment(dateOfBirth);\n await LOSAPIClient.user.updateNameAndDob(\n firstName,\n lastName,\n dateOfBirthMoment.toDate(),\n );\n }\n } else throw new Error(\"User registration failed.\");\n } catch (e) {\n // If user got here, they should already be authenticated, and will\n // no longer have access to the personal info form. They'll have to\n // update their info via the loan application flow.\n setError(e);\n // eslint-disable-next-line no-console\n console.error(e);\n return;\n }\n\n onSuccess?.();\n router.push(\"/dashboard\");\n }\n };\n\n return (\n Create an account}\n onClose={onClose}\n {...props}\n variant=\"fullScreenMobile\"\n >\n
\n

\n Sign up to connect your EV with Tenet’s Smartdrive Dashboard and track\n your emissions savings, battery health and vehicle usage.\n

\n\n
\n \n \n
\n
\n \n );\n};\n\nexport default RegisterModal;\n"],"names":["root","css","borderRadius","paddingX","paddingY","variants","variant","gradient","background","lightBlue","primary","tipEmission","tipBattery","inputGroup","savings","metricsGroup","display","flexDirection","length","Variants","Text","forwardRef","ref","as","otherProps","Component","cssProps","containerRef","dependencies","focus","useEffect","current","focusable","querySelector","children","clearErrors","onSubmit","errors","autoFocus","ariaLabel","formRef","useRef","useFirstFocusable","flex","layout","e","form","Card","message","InputField","className","label","name","hidden","hasError","style","htmlFor","error","color","PhoneInputField","control","id","field","useController","onChange","fieldProps","customInput","Input","format","getInputRef","mask","onValueChange","value","type","PasswordResetForm","dynamic","PasswordResetModal","onClose","open","hasBeenOpen","DateInput","props","ActionTypes","initialState","acceptsEmail","dateOfBirth","email","firstName","lastName","phoneNumber","personalInfoFormConfig","defaultValues","mode","resolver","yupResolver","object","MigratedDateOfBirthValidator","nullable","string","required","phoneRequiredValidator","registerFormConfig","confirmPassword","password","checkedRequiredValidator","confirmPasswordRequiredValidator","emailRequiredValidator","passwordRequiredValidator","reducer","state","action","payload","FormStepOne","formState","isSubmitting","handleSubmit","register","useForm","Form","values","placeholder","autoComplete","Button","disabled","FormStepTwo","setError","handleError","useCallback","code","AUTH_CODES","shouldFocus","CheckboxField","defaultChecked","onSuccess","formValueState","dispatch","useReducer","useState","router","useRouter","Modal","header","classNames","atomics","UPDATE_VALUES","async","otherValues","LOSAPIClient","Error","phone","dateOfBirthMoment","moment","toDate","console","push"],"sourceRoot":""}