{"version":3,"file":"authentication-Cx1p_RCB.js","sources":["../../../app/assets/images/envelope-check.png?react","../../../app/javascript/components/Login/index.jsx","../../../app/javascript/entrypoints/authentication.jsx"],"sourcesContent":["export default \"__VITE_ASSET__Zvwh1xKa__$_?react__\"","import React, { useState } from 'react'\nimport PhoneInput from 'react-phone-input-2'\n\nimport TwofaInput from '@components/TwofaInput'\nimport { InputField } from '@components/FormBuilder'\nimport Fetch from '@javascript/Fetch'\nimport Icon from '@components/shared/icons'\nimport { formatPhoneNumber } from '@javascript/util'\n\nimport Envelope from '@images/envelope-check.png?react'\n\nimport 'react-phone-input-2/lib/material.css'\n\nconst Login = ({ data }) => {\n const { requestTwofaPath, confirmTwofaPath, reaPath } = data\n\n const [view, setView] = useState('phone')\n const [phone, setPhone] = useState('')\n const [email, setEmail] = useState('')\n const [dialCode, setDialCode] = useState('')\n const [phoneError, setPhoneError] = useState([])\n const [twofaError, setTwofaError] = useState([])\n const [pin, setPin] = useState('')\n const [twofaType, setTwofaType] = useState('phone')\n\n const handlePhoneChange = (newPhone, data, e, formattedValue) => {\n setPhone(newPhone);\n setDialCode(data.dialCode);\n setPhoneError([]);\n }\n\n const onEnterKeyPress = (e) => {\n if (e.key === \"Enter\") {\n sendTwofa(e);\n }\n }\n\n const handleEmailChange = (e) => {\n setEmail(e.currentTarget.value)\n }\n\n const handleChangePin = (e, value) => {\n setPin(value)\n }\n\n const retry = () => {\n setView(twofaType);\n setPhoneError([]);\n setTwofaError([]);\n }\n\n const redirectBackToRea = () => {\n window.open(reaPath, '_self')\n }\n\n const sendTwofa = async (e) => {\n const target = e.currentTarget\n\n target.disabled = true\n\n setTwofaType(view)\n\n const payload = view === 'phone' ? { phone } : { email }\n\n const resp = await Fetch.post({\n url: requestTwofaPath,\n payload,\n })\n\n if (!resp.errors) {\n setView('confirmation')\n } else {\n setPhoneError([resp.errors])\n }\n\n target.disabled = false\n }\n\n const confirmTwofa = async (e) => {\n const target = e.currentTarget\n\n target.disabled = true\n\n const resp = await Fetch.post({\n url: confirmTwofaPath,\n payload: {\n code: pin,\n phone,\n email,\n },\n })\n\n if (!resp.errors) {\n window.location = resp.url\n } else {\n setTwofaError(resp.errors)\n }\n\n target.disabled = false\n }\n\n const swapView = (newView) => {\n setPhoneError([]);\n setView(newView)\n }\n\n const twofaContent = () => {\n switch (view) {\n case 'email':\n return (\n
\n

\n In order to retrieve your agents, we need you to verify your\n contact information.\n

\n \n \n Email Access Code\n \n
\n \n \n Verify with phone\n \n
\n )\n case 'confirmation':\n return (\n
\n 0}\n setError={setTwofaError}\n confirmTwofa={confirmTwofa}\n />\n

\n A message with a verification code was just sent to \n {twofaType === 'phone' ? formatPhoneNumber(phone) : email }\n

\n \n Continue to Agents List\n \n
\n
\n Didn't receive a code?\n
\n
\n \n Try another method\n \n or\n \n create a new request\n \n
\n
\n
\n )\n default:\n return (\n
\n

\n In order to retrieve your agents, we need you to verify your\n contact information.\n

\n
\n 0,\n }}\n />\n {phoneError.length > 0 && (\n {phoneError}\n )}\n
\n \n Text Access Code\n \n
\n \n \n Verify with email\n \n
\n )\n }\n }\n\n return (\n
\n
\n
\n

\n Find And Compare\n
\n The Best Local Realtors!\n

\n
\n \"envelope\"\n

Welcome Back!

\n {twofaContent()}\n {view !== 'confirmation' && (\n
\n We'll send you an access code allowing you to view your\n agents. Choose either email or text message (standard message\n rates apply) to receive your access code.\n
\n )}\n
\n
\n
\n
\n )\n}\n\nexport default Login\n","import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport \"../errorHandling\";\n\nimport Login from '@components/Login';\n\nconst loadLogin = () => {\n const container = document.getElementById('login-component');\n\n if (container) {\n const data = JSON.parse(container.dataset.props);\n const root = createRoot(container);\n\n root.render();\n }\n}\n\n\ndocument.addEventListener('DOMContentLoaded', () => {\n loadLogin();\n})\n"],"names":["Envelope","Login","data","requestTwofaPath","confirmTwofaPath","reaPath","view","setView","useState","phone","setPhone","email","setEmail","dialCode","setDialCode","phoneError","setPhoneError","twofaError","setTwofaError","pin","setPin","twofaType","setTwofaType","handlePhoneChange","newPhone","e","formattedValue","onEnterKeyPress","sendTwofa","handleEmailChange","handleChangePin","value","retry","redirectBackToRea","target","payload","resp","Fetch","confirmTwofa","swapView","newView","twofaContent","jsxs","jsx","InputField","Icon","TwofaInput","formatPhoneNumber","PhoneInput","loadLogin","container","createRoot"],"mappings":"kLAAA,MAAeA,EAAA,iDCaTC,EAAQ,CAAC,CAAE,KAAAC,KAAW,CAC1B,KAAM,CAAE,iBAAAC,EAAkB,iBAAAC,EAAkB,QAAAC,CAAA,EAAYH,EAElD,CAACI,EAAMC,CAAO,EAAIC,WAAS,OAAO,EAClC,CAACC,EAAOC,CAAQ,EAAIF,WAAS,EAAE,EAC/B,CAACG,EAAOC,CAAQ,EAAIJ,WAAS,EAAE,EAC/B,CAACK,EAAUC,CAAW,EAAIN,WAAS,EAAE,EACrC,CAACO,EAAYC,CAAa,EAAIR,EAAA,SAAS,CAAE,CAAA,EACzC,CAACS,EAAYC,CAAa,EAAIV,EAAA,SAAS,CAAE,CAAA,EACzC,CAACW,EAAKC,CAAM,EAAIZ,WAAS,EAAE,EAC3B,CAACa,EAAWC,CAAY,EAAId,WAAS,OAAO,EAE5Ce,EAAoB,CAACC,EAAUtB,EAAMuB,EAAGC,IAAmB,CAC/DhB,EAASc,CAAQ,EACjBV,EAAYZ,EAAK,QAAQ,EACzBc,EAAc,CAAE,CAAA,CAAA,EAGZW,EAAmBF,GAAM,CACzBA,EAAE,MAAQ,SACZG,EAAUH,CAAC,CACb,EAGII,EAAqBJ,GAAM,CACtBb,EAAAa,EAAE,cAAc,KAAK,CAAA,EAG1BK,EAAkB,CAACL,EAAGM,IAAU,CACpCX,EAAOW,CAAK,CAAA,EAGRC,EAAQ,IAAM,CAClBzB,EAAQc,CAAS,EACjBL,EAAc,CAAE,CAAA,EAChBE,EAAc,CAAE,CAAA,CAAA,EAGZe,EAAoB,IAAM,CACvB,OAAA,KAAK5B,EAAS,OAAO,CAAA,EAGxBuB,E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