fix: _chatTransition — no el-step1 flash when routing from hero chat to Elena

This commit is contained in:
WASRUSGEN 2026-05-28 15:13:09 +03:00
parent 3c29e83ffc
commit c7c5d9f682

View File

@ -3621,9 +3621,30 @@ window.addEventListener('DOMContentLoaded', function(){
_refreshBalanceTab(); _refreshBalanceTab();
}); });
/* ── CHAT → ELENA TRANSITION ── */
function _chatTransition(userText, intent) {
if (intent === 'cabinet') { go('cabinet'); return; }
if (intent === 'create') { go('cabinet'); setTimeout(function(){ tab('create'); }, 200); return; }
// Скрываем el-step1 ДО переключения экрана — нет вспышки приветствия
var step1 = document.getElementById('el-step1');
var inp = document.getElementById('intake-custom');
if (step1) step1.style.display = 'none';
if (inp) inp.value = userText || '';
go('elena');
setTimeout(function(){
elenaIntent(intent);
// Восстановим el-step1 на будущее (если клиент вернётся)
setTimeout(function(){
if (step1) { step1.style.display = ''; }
if (inp) { inp.value = ''; }
}, 4000);
}, 80);
}
/* ── HERO CHAT ── */ /* ── HERO CHAT ── */
var _hchatDone = false; var _hchatDone =false;
var _HC_MESSAGES = [ var _HC_MESSAGES = [
{ text: 'Добрый день! Рады Вас видеть 👋', delay: 600, typing: 900 }, { text: 'Добрый день! Рады Вас видеть 👋', delay: 600, typing: 900 },
@ -3730,7 +3751,7 @@ function heroChatReply(key) {
_hcRemoveTyping(); _hcRemoveTyping();
_hcAddBubble(r.elena, false); _hcAddBubble(r.elena, false);
setTimeout(function(){ setTimeout(function(){
elenaIntent(r.intent); _chatTransition(r.user, r.intent);
}, 1200); }, 1200);
}, 900); }, 900);
}, 400); }, 400);
@ -3763,7 +3784,7 @@ function heroChatSend() {
setTimeout(function(){ setTimeout(function(){
_hcRemoveTyping(); _hcRemoveTyping();
_hcAddBubble(reply.elena, false); _hcAddBubble(reply.elena, false);
setTimeout(function(){ elenaIntent(intent); }, 1200); setTimeout(function(){ _chatTransition(txt, intent); }, 1200);
}, 900); }, 900);
}, 400); }, 400);
} }