From 09c5ca0c4f010afe0ef9dcbf0baf5a45f74a89dc Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 26 Apr 2026 20:39:53 +0000 Subject: [PATCH 1/3] Changes Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com> --- src/routes/bem-vindo.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/routes/bem-vindo.tsx b/src/routes/bem-vindo.tsx index 4efd6c3..1291b21 100644 --- a/src/routes/bem-vindo.tsx +++ b/src/routes/bem-vindo.tsx @@ -80,10 +80,11 @@ function WelcomePage() { return () => clearTimeout(t); }, [step]); - // Se já completou o onboarding, vai direto para /painel + // Se já completou o onboarding E já conectou o Telegram, vai direto para /painel. + // Se ainda não conectou o Telegram, mantém o usuário aqui na etapa 3 (managed bot). useEffect(() => { if (!agent) return; - if (agent.onboarding_completed) { + if (agent.onboarding_completed && agent.telegram_bot_token_vault_id) { navigate({ to: "/painel", search: {} }); } }, [agent, navigate]); From 7bdf7730a7b65344bfa6c84d3f3753da11075ef9 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 26 Apr 2026 20:40:07 +0000 Subject: [PATCH 2/3] Changes Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com> --- src/routes/bem-vindo.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/routes/bem-vindo.tsx b/src/routes/bem-vindo.tsx index 1291b21..90e1abb 100644 --- a/src/routes/bem-vindo.tsx +++ b/src/routes/bem-vindo.tsx @@ -81,11 +81,22 @@ function WelcomePage() { }, [step]); // Se já completou o onboarding E já conectou o Telegram, vai direto para /painel. - // Se ainda não conectou o Telegram, mantém o usuário aqui na etapa 3 (managed bot). + // Se ainda não conectou o Telegram mas já tem nome do agente, pula direto para a etapa 3. + const jumpedToStep3 = useRef(false); useEffect(() => { if (!agent) return; if (agent.onboarding_completed && agent.telegram_bot_token_vault_id) { navigate({ to: "/painel", search: {} }); + return; + } + if ( + !jumpedToStep3.current && + agent.onboarding_completed && + !agent.telegram_bot_token_vault_id && + agent.agent_name + ) { + jumpedToStep3.current = true; + setStep(3); } }, [agent, navigate]); From dba14992e33921368c1227b4c5378215fe4f975a Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 26 Apr 2026 20:40:18 +0000 Subject: [PATCH 3/3] Changes Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com> --- src/routes/painel.index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/painel.index.tsx b/src/routes/painel.index.tsx index 2059052..73afba0 100644 --- a/src/routes/painel.index.tsx +++ b/src/routes/painel.index.tsx @@ -36,17 +36,17 @@ function DashboardPage() { const previousStatusRef = useRef(null); // Redireciona para /bem-vindo se cliente acabou de pagar e ainda não completou onboarding + // OU se ainda não conectou o Telegram (para usar o novo fluxo de Managed Bot) useEffect(() => { if (search.status !== "success" || !agent) return; if (agent.status === "suspended" || agent.status === "error") { navigate({ search: { status: undefined }, replace: true }); return; } - if (!agent.onboarding_completed) { + if (!agent.onboarding_completed || !agent.telegram_bot_token_vault_id) { navigate({ to: "/bem-vindo", replace: true }); return; } - if (!agent.telegram_bot_username) setWizardOpen(true); navigate({ search: { status: undefined }, replace: true }); }, [search.status, agent, navigate]);