(function () {
'use strict';
var questions = [
{
question: 'Кто вы и что продаёте?',
options: [
{ text: 'Психолог / психотерапевт', scores: { A: 1, B: 1, C: 1 } },
{ text: 'Психолог-сексолог / сексолог', scores: { A: 1, B: 1, C: 1 } },
{ text: 'Коуч / наставник', scores: { A: 1, B: 1, C: 1 } },
{ text: 'Эксперт обучения / школа / курсы', scores: { A: 0, B: 1, C: 2 } },
{ text: 'Другая экспертная услуга', scores: { A: 1, B: 1, C: 1 } },
],
},
{
question: 'Как сейчас у вас с клиентами?',
options: [
{ text: 'Случайно, "то густо, то пусто"', scores: { A: 3, B: 1, C: 0 } },
{ text: 'Есть, но нестабильно (1–5 заявок/неделя)', scores: { A: 1, B: 3, C: 1 } },
{ text: 'Стабильно, но мало (хочу больше)', scores: { A: 0, B: 2, C: 3 } },
{ text: 'Есть поток, но дорого/не окупается', scores: { A: 0, B: 1, C: 4 } },
],
},
{
question: 'Какой доход хотите в месяц (в горизонте 3–6 месяцев)?',
options: [
{ text: '50–100k (нужна стабильность)', scores: { A: 4, B: 1, C: 0 } },
{ text: '100–200k (уверенность)', scores: { A: 2, B: 3, C: 1 } },
{ text: '200–400k (система)', scores: { A: 1, B: 2, C: 3 } },
{ text: '400–700k (масштаб)', scores: { A: 0, B: 1, C: 4 } },
{ text: '700k+ (управляемый рост)', scores: { A: 0, B: 0, C: 5 } },
],
},
{
question: 'Что с продуктом и средним чеком?',
options: [
{ text: 'Только разовые консультации/услуги, пакетов нет', scores: { A: 4, B: 1, C: 0 } },
{ text: 'Пакеты есть, но продаются тяжело', scores: { A: 1, B: 4, C: 1 } },
{ text: 'Есть линейка (вход/пакет/сопровождение), но "не докручена"', scores: { A: 0, B: 3, C: 3 } },
{ text: 'Есть понятная линейка и высокий чек, но упёрся(лась) в потолок', scores: { A: 0, B: 1, C: 5 } },
],
},
{
question: 'Реклама/продвижение: что уже пробовали?',
options: [
{ text: 'Ничего — страшно/не знаю с чего начать', scores: { A: 4, B: 1, C: 0 } },
{ text: 'Контент/соцсети — но без системы', scores: { A: 2, B: 3, C: 1 } },
{ text: 'Пробовал(а) рекламу сам(а) — непонятно, почему не работает', scores: { A: 1, B: 4, C: 2 } },
{ text: 'Были подрядчики/агентства — результат неясен', scores: { A: 0, B: 3, C: 4 } },
{ text: 'Реклама есть, но хочу масштаб/прогноз', scores: { A: 0, B: 1, C: 5 } },
],
},
{
question: 'Где вы чувствуете "главный затык" сейчас?',
options: [
{ text: '"Я не понимаю, что именно продавать и кому"', scores: { A: 5, B: 1, C: 0 } },
{ text: '"У меня мало заявок, я устал(а) от нестабильности"', scores: { A: 2, B: 5, C: 1 } },
{ text: '"Заявки есть, но плохо покупают/сливаются"', scores: { A: 1, B: 4, C: 3 } },
{ text: '"Поток есть, но нет роста/упёрся(лась) в потолок"', scores: { A: 0, B: 1, C: 5 } },
],
},
{
question: 'Сколько готовы вложить в продвижение в ближайшие 30 дней (если будет понятный план)?',
options: [
{ text: '0–10k', scores: { A: 4, B: 1, C: 0 } },
{ text: '10–30k', scores: { A: 2, B: 3, C: 1 } },
{ text: '30–70k', scores: { A: 1, B: 2, C: 4 } },
{ text: '70k+', scores: { A: 0, B: 1, C: 5 } },
{ text: 'Не знаю — хочу понять расчёт под мои цифры', scores: { A: 1, B: 3, C: 3 } },
],
},
];
var results = {
A: {
title: 'Вы на этапе «Старт»',
text: 'Сейчас важнее всего — чтобы было понятно, что вы предлагаете и кому. Один простой формат работы и один пакет. Потом уже привлекать людей.',
steps: [
'определить один главный формат работы и один пакет услуг',
'понять, кому вы помогаете и с какими запросами к вам приходят',
'выбрать один способ, через который к вам будут приходить клиенты',
],
cta: 'Напишите в мессенджер: «Хочу на разбор» и удобное время — на встрече покажу, с чего логично начать и где первые точки роста.',
},
B: {
title: 'Вы на этапе «Стабильность»',
text: 'У вас уже есть услуги и пакеты, но клиенты приходят неровно. Нужна простая система: от первого знакомства до записи на консультацию.',
steps: [
'чётко сформулировать, что вы даёте и зачем к вам идти именно сейчас',
'выстроить простой путь: человек узнал о вас → пришёл на встречу → записался',
'сделать так, чтобы заявки приходили регулярно, а не «то густо, то пусто»',
],
cta: 'Напишите: «Хочу на разбор» и когда удобно — на встрече разберём, на каком шаге отваливаются люди и что подкрутить.',
},
C: {
title: 'Вы на этапе «Рост»',
text: 'У вас уже есть клиенты и стабильность. Сейчас важно понять, сколько людей нужно привлечь под ваши цели и как лучше работать с теми, кто уже с вами.',
steps: [
'посчитать, сколько новых обращений нужно, чтобы выйти на желаемый доход',
'привлекать больше людей так, чтобы вложения окупались',
'развивать пакеты и сопровождение, чтобы один клиент приносил больше',
],
cta: 'Напишите: «Хочу на разбор» и удобные слоты по времени — на встрече соберём план роста: вложения, ожидания и опоры под масштаб.',
},
};
function esc(s) {
if (!s) return '';
var d = document.createElement('div');
d.textContent = s;
return d.innerHTML;
}
function createQuizController(root) {
if (!root) return null;
var currentQuestionIndex = 0;
var scores = { A: 0, B: 0, C: 0 };
var selectedOption = null;
function el(sel) {
return root.querySelector(sel);
}
function introScreen() {
return el('#intro-screen, .sq-intro-screen');
}
function quizScreen() {
return el('#quiz-screen, .sq-quiz-screen');
}
function loadingScreen() {
return el('#loading-screen, .sq-loading-screen');
}
function resultScreen() {
return el('#result-screen, .sq-result-screen');
}
function updateProgress() {
var fill = el('#progress-fill, .sq-progress-fill');
if (!fill) return;
var pct = (currentQuestionIndex / questions.length) * 100;
fill.style.width = pct + '%';
}
function showQuestion(index) {
currentQuestionIndex = index;
var q = questions[index];
var container = el('#question-container, .sq-question-container');
if (!container) return;
var opts = q.options
.map(function (opt, i) {
return (
''
);
})
.join('');
container.innerHTML =
'
Вопрос ' +
(index + 1) +
' из ' +
questions.length +
'
' +
q.question +
'
' +
opts +
'
';
updateProgress();
selectedOption = null;
var nextBtn = el('#next-btn, .sq-next-btn');
if (nextBtn) nextBtn.disabled = true;
}
function selectOption(optionIndex) {
var options = root.querySelectorAll('#question-container .option, .sq-question-container .option');
options.forEach(function (o) {
o.classList.remove('selected');
});
if (options[optionIndex]) {
options[optionIndex].classList.add('selected');
}
selectedOption = optionIndex;
var nextBtn = el('#next-btn, .sq-next-btn');
if (nextBtn) nextBtn.disabled = false;
}
function resetToIntro() {
scores = { A: 0, B: 0, C: 0 };
currentQuestionIndex = 0;
selectedOption = null;
var intro = introScreen();
var quiz = quizScreen();
var loading = loadingScreen();
var result = resultScreen();
if (intro) {
intro.classList.add('active');
intro.style.display = '';
}
if (quiz) {
quiz.classList.remove('active');
quiz.style.display = 'none';
}
if (loading) {
loading.classList.remove('active');
loading.style.display = 'none';
}
if (result) {
result.classList.remove('active');
result.style.display = 'none';
}
updateProgress();
}
function startQuiz() {
scores = { A: 0, B: 0, C: 0 };
currentQuestionIndex = 0;
var intro = introScreen();
var quiz = quizScreen();
if (intro) {
intro.classList.remove('active');
intro.style.display = 'none';
}
if (quiz) {
quiz.style.display = 'block';
quiz.classList.add('active');
}
showQuestion(0);
}
function runLoadingSequence() {
var progressBar = el('#analysis-progress, .sq-analysis-progress');
var analysisText = el('#analysis-text, .sq-analysis-text');
var steps = [
{ progress: 22, text: 'Смотрю ваши ответы...', delay: 280 },
{ progress: 48, text: 'Подбираю под вашу практику...', delay: 560 },
{ progress: 72, text: 'Готовлю рекомендации...', delay: 840 },
{ progress: 92, text: 'Почти готово...', delay: 1120 },
{ progress: 100, text: 'Готово', delay: 1400 },
];
if (progressBar) progressBar.style.width = '0%';
var t = 0;
steps.forEach(function (step) {
t += step.delay;
setTimeout(function () {
if (progressBar) progressBar.style.width = step.progress + '%';
if (analysisText) analysisText.textContent = step.text;
}, t);
});
setTimeout(showResult, t + 450);
}
function nextQuestion() {
if (selectedOption === null) return;
var currentQuestion = questions[currentQuestionIndex];
var sel = currentQuestion.options[selectedOption].scores;
scores.A += sel.A;
scores.B += sel.B;
scores.C += sel.C;
currentQuestionIndex++;
if (currentQuestionIndex < questions.length) {
showQuestion(currentQuestionIndex);
} else {
var quiz = quizScreen();
var loading = loadingScreen();
if (quiz) {
quiz.classList.remove('active');
quiz.style.display = 'none';
}
if (loading) {
loading.style.display = 'block';
loading.classList.add('active');
}
runLoadingSequence();
}
}
function showResult() {
var loading = loadingScreen();
var result = resultScreen();
if (loading) {
loading.style.display = 'none';
loading.classList.remove('active');
}
if (result) {
result.style.display = 'block';
result.classList.add('active');
}
calculateResult();
}
function calculateResult() {
var total = scores.A + scores.B + scores.C;
var branch = 'A';
var maxScore = Math.max(scores.A, scores.B, scores.C);
if (scores.C === maxScore) branch = 'C';
else if (scores.B === maxScore) branch = 'B';
var probability = '';
var probabilityColor = '';
if (total >= 22) {
probability = 'Отлично: СПРУТ хорошо подходит под вашу практику.';
probabilityColor = '#5d7a5d';
} else if (total >= 16) {
probability = 'Хороший результат: СПРУТ вам подойдёт — немного подстроим под вас.';
probabilityColor = '#5d7a5d';
} else {
probability = 'СПРУТ вам тоже подойдёт — на встрече расскажу, с чего начать.';
probabilityColor = '#b45309';
}
var result = results[branch];
var resultContent = el('#result-content, .sq-result-content');
if (!resultContent) return;
var stepsHtml = result.steps
.map(function (step, index) {
return (
'
' +
'
' +
(index + 1) +
'
' +
'
' +
esc(step) +
'
'
);
})
.join('');
resultContent.innerHTML =
'
' +
'
ВАШ РЕЗУЛЬТАТ
' +
'
' +
esc(probability) +
'
' +
'
' +
'
' +
'
' +
esc(result.title) +
'
' +
'
' +
esc(result.text) +
'
' +
'
' +
'
Ваш план: что сделать по шагам
' +
'
' +
stepsHtml +
'
' +
'
' +
esc(result.cta) +
'
' +
'
' +
'
' +
'Хотите разобрать ситуацию глубже — напишите в мессенджер. Я отвечу лично (это не бот): коротко и бесплатно посмотрю ваши ответы и скажу, есть ли смысл двигаться дальше и как СПРУТ может лечь на вашу практику.' +
'
' +
'
После переписки договоримся о времени — встретимся онлайн, один на один.
' +
'
' +
'На встрече наглядно покажу точки роста и где теряются заявки, внимание или деньги, и что можно сделать именно в вашей ситуации.' +
'
';
}
function bookSessionWhatsApp() {
var text = encodeURIComponent(
'Здравствуйте! Хочу на разбор после теста на сайте СПРУТ.\n\nУдобное время: первая/вторая половина дня, будни или выходные — укажите своё.'
);
window.open('https://wa.me/79934485351?text=' + text, '_blank');
}
function bookSessionMax() {
window.open('https://max.ru/u/f9LHodD0cOJQokuMcHif4Kc0eINswz3jMdSyxXIXtQOV8mEu_vw2V648UTU', '_blank');
}
function bookSessionTelegram() {
window.open('https://t.me/Ekaterina_sprut', '_blank');
}
function bindQuizScreenInput() {
var quiz = quizScreen();
if (!quiz || quiz.dataset.sqInputBound === '1') return;
quiz.dataset.sqInputBound = '1';
function handleInput(e) {
var option = e.target.closest('.option');
if (option) {
e.preventDefault();
e.stopPropagation();
var idx = parseInt(option.getAttribute('data-option-index'), 10);
if (!isNaN(idx)) selectOption(idx);
return;
}
var next = e.target.closest('.sq-next-btn, #next-btn');
if (next && !next.disabled) {
e.preventDefault();
e.stopPropagation();
nextQuestion();
}
}
quiz.addEventListener('click', handleInput, true);
quiz.addEventListener(
'touchend',
function (e) {
if (e.cancelable) e.preventDefault();
handleInput(e);
},
{ capture: true, passive: false }
);
}
function init() {
if (root.dataset.sqInit === '1') return;
root.dataset.sqInit = '1';
bindQuizScreenInput();
var quiz = quizScreen();
var loading = loadingScreen();
var result = resultScreen();
if (quiz) {
quiz.style.display = 'none';
quiz.classList.remove('active');
}
if (loading) {
loading.style.display = 'none';
loading.classList.remove('active');
}
if (result) {
result.style.display = 'none';
result.classList.remove('active');
}
var startBtn = el('#sprut-quiz-start, .sq-start-btn');
if (startBtn && !startBtn.dataset.sqBound) {
startBtn.dataset.sqBound = '1';
startBtn.addEventListener('click', startQuiz);
}
var msgr = el('#sprut-result-messengers, .sq-result-messengers');
if (msgr) {
msgr.addEventListener('click', function (e) {
var btn = e.target.closest('button');
if (!btn) return;
if (btn.classList.contains('sprut-msgr-wa')) bookSessionWhatsApp();
else if (btn.classList.contains('sprut-msgr-max')) bookSessionMax();
else if (btn.classList.contains('sprut-msgr-tg')) bookSessionTelegram();
});
}
var mobileMenuToggle = root.querySelector('#mobile-menu-toggle');
var navLinks = root.querySelector('#nav-links');
if (mobileMenuToggle && navLinks) {
mobileMenuToggle.addEventListener('click', function () {
navLinks.classList.toggle('active');
mobileMenuToggle.classList.toggle('active');
});
navLinks.addEventListener('click', function (e) {
if (e.target.tagName === 'A') {
navLinks.classList.remove('active');
mobileMenuToggle.classList.remove('active');
}
});
}
resetToIntro();
}
return {
init: init,
startQuiz: startQuiz,
resetToIntro: resetToIntro,
selectOption: selectOption,
nextQuestion: nextQuestion,
};
}
var popupController = null;
var pageController = null;
function syncQuizApi() {
window.SprutQuizApi = {
pick: function (idx) {
if (popupController && popupController.selectOption) popupController.selectOption(idx);
},
next: function () {
if (popupController && popupController.nextQuestion) popupController.nextQuestion();
},
start: function () {
if (popupController && popupController.startQuiz) popupController.startQuiz();
},
};
}
function handleModalQuizInput(e) {
var modal = document.getElementById('sprut-quiz-popup-modal');
if (!modal || !modal.classList.contains('is-open')) return;
var option = e.target.closest('.option');
if (option && modal.contains(option)) {
e.preventDefault();
e.stopPropagation();
var idx = parseInt(option.getAttribute('data-option-index'), 10);
if (!isNaN(idx) && window.SprutQuizApi) window.SprutQuizApi.pick(idx);
return;
}
var next = e.target.closest('.sq-next-btn, #next-btn');
if (next && modal.contains(next) && !next.disabled && window.SprutQuizApi) {
e.preventDefault();
e.stopPropagation();
window.SprutQuizApi.next();
}
}
function ensureModalQuizClicks() {
if (window.__sprutQuizClicksBound) return;
var modal = document.getElementById('sprut-quiz-popup-modal');
if (!modal) return;
window.__sprutQuizClicksBound = true;
modal.addEventListener('click', handleModalQuizInput, true);
modal.addEventListener(
'touchend',
function (e) {
if (e.cancelable) e.preventDefault();
handleModalQuizInput(e);
},
{ capture: true, passive: false }
);
}
function boot() {
ensureModalQuizClicks();
var popupRoot = document.getElementById('sprut-quiz-popup-root');
if (popupRoot) {
popupController = createQuizController(popupRoot);
if (popupController) popupController.init();
}
var pageRoot = document.getElementById('sprut-quiz');
if (pageRoot && !pageRoot.closest('#sprut-quiz-popup-modal')) {
pageController = createQuizController(pageRoot);
if (pageController) pageController.init();
}
syncQuizApi();
}
function applyPopupAction(autoStart, wasOpen) {
if (!popupController) return false;
if (!wasOpen) {
if (autoStart) popupController.startQuiz();
else popupController.resetToIntro();
} else if (autoStart) {
var modalEl = document.getElementById('sprut-quiz-popup-modal');
var quizEl = modalEl && modalEl.querySelector('.sq-quiz-screen');
var onQuiz =
quizEl &&
quizEl.style.display !== 'none' &&
quizEl.classList.contains('active');
if (!onQuiz) popupController.startQuiz();
}
return true;
}
window.openSprutQuizPopup = function (autoStart) {
var modal = document.getElementById('sprut-quiz-popup-modal');
if (!modal) return false;
var wasOpen = modal.classList.contains('is-open');
modal.classList.add('is-open');
modal.setAttribute('aria-hidden', 'false');
document.body.classList.add('sprut-quiz-popup-open');
if (!popupController) boot();
if (!applyPopupAction(autoStart, wasOpen) && autoStart) {
var n = 0;
var timer = setInterval(function () {
if (!popupController) boot();
if (popupController || ++n > 80) {
clearInterval(timer);
if (popupController) applyPopupAction(true, wasOpen);
}
}, 50);
}
return true;
};
window.closeSprutQuizPopup = function () {
var modal = document.getElementById('sprut-quiz-popup-modal');
if (!modal) return;
modal.classList.remove('is-open');
document.body.classList.remove('sprut-quiz-popup-open');
if (popupController) popupController.resetToIntro();
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', boot);
} else {
boot();
}
})();