801tmst__addHeaderFooter();802tmst__applyStyles();803tmst__installCart();804805tma__resources__drawPagesListHtml(objProfile, style, dashboardData);806807document.title = tma__translate('{{personal_account}}', 'store_dict');808809tma__resources__initEvents();810811const urlParams = new URLSearchParams(window.location.search);812if (urlParams.has('need_email')) {
const redirectUrl = urlParams.get('need_email'); if (redirectUrl) { tma__resources__drawCheckEmailPopup(redirectUrl); } }}function tma__resources__initEvents() { const checkEmailBeforeEnterLinks = document.querySelectorAll('.js-check-email-before-enter'); checkEmailBeforeEnterLinks.forEach(link => { link.addEventListener('click', event => { if (!window.mauser.email) { const url = link.getAttribute('href'); tma__resources__drawCheckEmailPopup(url); event.preventDefault(); } }); });}/** * Рисует попап для ввода email и редиректит после успеха на заданный url * @param {string} url Ссылка для редиректа */function tma__resources__drawCheckEmailPopup(url) { let html = ` <div class="tlk-popup__title" data-field="tlk-title">{{check_email_title}}</div> <form id="check-email-form"> <div class="tlk-popup__form-wrap"> <div class="tlk-popup__item tlk-form__item"> <div class="tlk-popup_check-email__text" data-field="tlk-text">{{check_email_text}}</div> <input type="text" name="login" placeholder="{{check_email_placeholder_email}}" class="tlk-input" required> <div class="tlk-input-error"></div> </div> </div> <div class="tlk-input-error tlk-input-error_all"></div> <div class="tlk-popup__buttons"> <button type="submit" class="tlk-popup__close-save tlk-popup__button tlk-btn tlk-btn_gray tlk-btn_reset"> {{check_email_save}} <span class="tlk-loadicon"></span> </button> </div> </form> `; html = tma__translate(html, 'store_dict'); tma__drawPopup({ id: 'check-email-popup', content: html, className: 'tlk-popup_check-email', closeBtns: [], }); const form = document.getElementById('check-email-form'); form.addEventListener('submit', function (event) { event.preventDefault(); tma__profile__submitEditProfile(form, { onSuccess: () => { // TODO: удалить фолбэк после обновления tilda-members-init.min.js if (typeof tma__getSafeRedirectUrl === 'function') { const safeUrl = tma__getSafeRedirectUrl(url); if (safeUrl) { window.location.assign(safeUrl); } } else if (url) { window.location.assign(url); } }, }); });}/** * Шаблон списка страниц * * @param {object} props - данные доступных ресурсов * @param {object} style - данные стилей * @param {DashboardData} [dashboardData] - данные стилей */function tma__resources__drawPagesListHtml(props, style, dashboardData) { const isStoreManagementEnabled = window.tildaMembers.is_init_store; const hasStoreManagementResources = tmst__main__hasStoreManagementResources(dashboardData); const hasTopText = style && (!style.typeId || style.typeId === 'custom') && style.textTop; const hasBottomText = style && (!style.typeId || style.typeId === 'custom') && style.textBottom;