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CAAC,GAAG,CAAC,QAEf,GACF,EAAK,SAAS,CAAC,MAAM,CAAC,QAGpB,EACF,EAAO,SAAS,CAAC,MAAM,CAAC,WAExB,GAEJ,CACF,EAEF,EAAG","sources":["","src/partials/js/webinarModal.js"],"sourcesContent":["(function(window1) {\n const showModalButtons = document.querySelectorAll('.showModal');\n const webinarModal = document.getElementById('webinarModal');\n const content = webinarModal.querySelector('.content');\n const closeIcon = content.querySelector('.content > svg');\n const form = content.querySelector('form');\n const okButton = content.querySelector('.ok');\n const button = form.querySelector('.mainButton');\n const retryButton = content.querySelector('.retryButton');\n const inputs = form.querySelectorAll('input:not([type=hidden]');\n const api = 'https://nn.uxfeedback.ru/webhook/uxfb/add-lead-webinar';\n const validationRules = {\n name: /.+/g,\n position: /.+/g,\n project: /.+/g,\n phone: /.+/g,\n email: /.*@.*\\..*/g\n };\n let timeout;\n showModalButtons.forEach((item)=>{\n item.onclick = (e)=>{\n e.preventDefault();\n webinarModal.style.display = 'flex';\n };\n });\n content.onmousedown = (e)=>{\n e.stopPropagation();\n };\n [\n okButton,\n webinarModal,\n closeIcon\n ].forEach((item)=>{\n item.onmousedown = ()=>{\n clearTimeout(timeout);\n content.classList.remove('success', 'failed');\n webinarModal.style.display = 'none';\n window1.location.hash = '';\n history.replaceState(null, null, ' ');\n form.reset();\n button.textContent = \"\\u0417\\u0430\\u0440\\u0435\\u0433\\u0438\\u0441\\u0442\\u0440\\u0438\\u0440\\u043E\\u0432\\u0430\\u0442\\u044C\\u0441\\u044F\";\n retryButton.textContent = \"\\u041E\\u0442\\u043F\\u0440\\u0430\\u0432\\u0438\\u0442\\u044C \\u0435\\u0449\\u0435 \\u0440\\u0430\\u0437\";\n button.removeAttribute('disabled');\n retryButton.removeAttribute('disabled');\n };\n });\n const isEmailValid = (email, rule)=>{\n return !!email.match(rule);\n };\n const isInputValid = (input, isEmail)=>{\n const rule = validationRules[input.name];\n return isEmail ? isEmailValid(input.value, rule) : input.value.match(rule);\n };\n const validateForm = ()=>{\n let isFormValid = [];\n inputs.forEach((item)=>{\n const isValid = isInputValid(item, item.name === 'email');\n if (isValid) isFormValid.push(true);\n else isFormValid.push(false);\n });\n return isFormValid;\n };\n const updateInputsClasses = ()=>{\n let isFormValid = [];\n inputs.forEach((item)=>{\n const isEmail = item.name === 'email';\n const isValid = isInputValid(item, isEmail);\n const isEmailFilled = isEmail && item.value.length > 0;\n const inputWrapper = item.parentElement.parentElement;\n if (isValid) {\n inputWrapper.classList.remove('invalid');\n isFormValid.push(true);\n } else {\n button.classList.add('invalid');\n inputWrapper.classList.add('invalid');\n isFormValid.push(false);\n }\n if (isEmailFilled) inputWrapper.classList.add('filled');\n else inputWrapper.classList.remove('filled');\n });\n const isAllInputsFilled = isFormValid.filter((status)=>!status).length === 1 && form.querySelector('.email.invalid.filled');\n if (!isAllInputsFilled) form.classList.add('invalid');\n };\n [\n button,\n retryButton\n ].forEach((item)=>item.onclick = (e)=>{\n e.preventDefault();\n const formData = [\n ...new FormData(form).entries()\n ];\n const url = new URL(document.location.href);\n const dataObject = formData.reduce((acc, [key, val])=>({\n ...acc,\n [key]: val\n }), {\n urlUtm: url.href\n });\n if (validateForm().includes(false)) {\n updateInputsClasses();\n return;\n }\n item.textContent = \"\\u041E\\u0442\\u043F\\u0440\\u0430\\u0432\\u043B\\u044F\\u0435\\u043C...\";\n item.setAttribute('disabled', true);\n Object.keys(dataObject).forEach((key)=>{\n dataObject[key] = dataObject[key]?.replaceAll('>', '>').replaceAll('<', '<').replaceAll('&', '&').replaceAll(/eval/gi, 'eval').replace(/\"/g, '"').replace(/'/g, ''');\n });\n fetch(api, {\n method: 'post',\n body: JSON.stringify(dataObject),\n headers: {\n \"Content-Type\": \"application/json\"\n }\n }).then((respose)=>{\n if (respose.status !== 200) throw respose;\n content.classList.remove('failed');\n content.classList.add('success');\n timeout = setTimeout(()=>{\n content.classList.remove('success');\n webinarModal.style.display = 'none';\n button.textContent = \"\\u0417\\u0430\\u0440\\u0435\\u0433\\u0438\\u0441\\u0442\\u0440\\u0438\\u0440\\u043E\\u0432\\u0430\\u0442\\u044C\\u0441\\u044F\";\n retryButton.textContent = \"\\u041E\\u0442\\u043F\\u0440\\u0430\\u0432\\u0438\\u0442\\u044C \\u0435\\u0449\\u0435 \\u0440\\u0430\\u0437\";\n item.removeAttribute('disabled');\n form.reset();\n }, 5000);\n }).catch(()=>{\n content.classList.add('failed');\n item.textContent = \"\\u041E\\u0442\\u043F\\u0440\\u0430\\u0432\\u0438\\u0442\\u044C \\u0435\\u0449\\u0435 \\u0440\\u0430\\u0437\";\n item.removeAttribute('disabled');\n });\n });\n inputs.forEach((input)=>{\n const inputWrapper = input.parentElement.parentElement;\n input.onkeyup = ()=>{\n if (!button.classList.contains('invalid')) return;\n const inputsValidationStatus = validateForm();\n const isAllInputsValid = !inputsValidationStatus.includes(false);\n const isAllInputsFilled = isAllInputsValid || inputsValidationStatus.filter((status)=>!status).length === 1 && form.querySelector('.email.invalid.filled');\n inputWrapper.classList.remove('invalid', 'filled');\n form.classList.remove('invalid');\n form.classList.add('half');\n if (isAllInputsFilled) form.classList.remove('half');\n if (isAllInputsValid) button.classList.remove('invalid');\n else updateInputsClasses();\n };\n });\n})(window);\n\n//# sourceMappingURL=webinarModal.5a620d2e.js.map\n","(function (window) {\n const showModalButtons = document.querySelectorAll('.showModal');\n const webinarModal = document.getElementById('webinarModal');\n const content = webinarModal.querySelector('.content');\n const closeIcon = content.querySelector('.content > svg');\n const form = content.querySelector('form');\n const okButton = content.querySelector('.ok');\n const button = form.querySelector('.mainButton');\n const retryButton = content.querySelector('.retryButton') \n const inputs = form.querySelectorAll('input:not([type=hidden]');\n const api = 'https://nn.uxfeedback.ru/webhook/uxfb/add-lead-webinar';\n const validationRules = {\n name: /.+/g,\n position: /.+/g,\n project: /.+/g,\n phone: /.+/g,\n email: /.*@.*\\..*/g,\n };\n let timeout;\n\n showModalButtons.forEach((item) => {\n item.onclick = (e) => {\n e.preventDefault();\n webinarModal.style.display = 'flex';\n }\n });\n\n content.onmousedown = (e) => {\n e.stopPropagation();\n };\n\n [okButton, webinarModal, closeIcon].forEach((item) => {\n item.onmousedown = () => {\n clearTimeout(timeout);\n content.classList.remove('success', 'failed');\n webinarModal.style.display = 'none';\n window.location.hash = '';\n history.replaceState(null, null, ' ');\n form.reset();\n button.textContent = 'Зарегистрироваться';\n retryButton.textContent = 'Отправить еще раз'\n button.removeAttribute('disabled');\n retryButton.removeAttribute('disabled');\n };\n })\n\n const isEmailValid = (email, rule) => {\n return !!email.match(rule);\n };\n\n const isInputValid = (input, isEmail) => {\n const rule = validationRules[input.name];\n\n return isEmail ? isEmailValid(input.value, rule) : input.value.match(rule);\n };\n\n const validateForm = () => {\n let isFormValid = [];\n\n inputs.forEach((item) => {\n const isValid = isInputValid(item, item.name === 'email');\n\n if(isValid) {\n isFormValid.push(true);\n } else {\n isFormValid.push(false);\n }\n });\n\n return isFormValid;\n };\n\n const updateInputsClasses = () => {\n let isFormValid = [];\n\n inputs.forEach((item) => {\n const isEmail = item.name === 'email';\n const isValid = isInputValid(item, isEmail);\n const isEmailFilled = isEmail && item.value.length > 0;\n const inputWrapper = item.parentElement.parentElement;\n\n if (isValid) {\n inputWrapper.classList.remove('invalid');\n isFormValid.push(true);\n } else {\n button.classList.add('invalid');\n inputWrapper.classList.add('invalid');\n isFormValid.push(false);\n }\n \n if (isEmailFilled) {\n inputWrapper.classList.add('filled');\n } else {\n inputWrapper.classList.remove('filled');\n }\n });\n\n const isAllInputsFilled = isFormValid.filter((status) => !status).length === 1 && form.querySelector('.email.invalid.filled');\n\n if (!isAllInputsFilled) {\n form.classList.add('invalid');\n }\n };\n\n [button, retryButton].forEach((item) => item.onclick = (e) => {\n e.preventDefault();\n\n const formData = [...(new FormData(form).entries())];\n const url = new URL(document.location.href);\n\n const dataObject = formData.reduce(\n (acc, [key, val]) => ({ ...acc, [key]: val }), \n { urlUtm: url.href }\n );\n\n if (validateForm().includes(false)) {\n updateInputsClasses();\n\n return;\n }\n\n item.textContent = 'Отправляем...';\n item.setAttribute('disabled', true);\n\n Object.keys(dataObject).forEach((key) => {\n dataObject[key] = dataObject[key]?.replaceAll('>', '>')\n .replaceAll('<', '<')\n .replaceAll('&', '&')\n .replaceAll(/eval/gi, 'eval')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n });\n\n fetch(api, {\n method: 'post',\n body: JSON.stringify(dataObject),\n headers: {\n \"Content-Type\": \"application/json\"\n }\n })\n .then((respose) => {\n if (respose.status !== 200) {\n throw respose;\n }\n \n content.classList.remove('failed');\n content.classList.add('success');\n timeout = setTimeout(() => {\n content.classList.remove('success');\n webinarModal.style.display = 'none';\n button.textContent = 'Зарегистрироваться';\n retryButton.textContent = 'Отправить еще раз'\n item.removeAttribute('disabled');\n form.reset();\n }, 5000);\n })\n .catch(() => {\n content.classList.add('failed');\n item.textContent = 'Отправить еще раз';\n item.removeAttribute('disabled');\n });\n\n });\n\n inputs.forEach((input) => {\n const inputWrapper = input.parentElement.parentElement;\n\n input.onkeyup = () => {\n if (!button.classList.contains('invalid')) {\n return;\n }\n\n const inputsValidationStatus = validateForm();\n const isAllInputsValid = !inputsValidationStatus.includes(false);\n const isAllInputsFilled = isAllInputsValid || \n (inputsValidationStatus.filter((status) => !status).length === 1 && form.querySelector('.email.invalid.filled'));\n\n inputWrapper.classList.remove('invalid', 'filled');\n form.classList.remove('invalid');\n form.classList.add('half');\n\n if (isAllInputsFilled) {\n form.classList.remove('half');\n }\n\n if (isAllInputsValid) {\n button.classList.remove('invalid');\n } else {\n updateInputsClasses();\n }\n }\n });\n\n})(window);"],"names":["window1","timeout","showModalButtons","document","querySelectorAll","webinarModal","getElementById","content","querySelector","closeIcon","form","okButton","button","retryButton","inputs","validationRules","name","position","project","phone","email","forEach","item","onclick","e","preventDefault","style","display","onmousedown","stopPropagation","clearTimeout","classList","remove","location","hash","history","replaceState","reset","textContent","removeAttribute","isEmailValid","rule","match","isInputValid","input","isEmail","value","validateForm","isFormValid","push","updateInputsClasses","isValid","isEmailFilled","length","inputWrapper","parentElement","add","filter","status","dataObject","formData","FormData","entries","reduce","acc","key","val","urlUtm","url","URL","href","includes","setAttribute","Object","keys","replaceAll","replace","fetch","method","body","JSON","stringify","headers","then","respose","setTimeout","catch","onkeyup","contains","inputsValidationStatus","isAllInputsValid","isAllInputsFilled","window"],"version":3,"file":"webinarModal.5a620d2e.js.map"}