mirror of
https://github.com/domfelipe/mika-agent-assist.git
synced 2026-08-07 08:36:44 +00:00
Corrigiu fluxo etapa 3 do bem-vindo
X-Lovable-Edit-ID: edt-c5e3bc1c-23f7-4f07-a526-f16c05500790 Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
commit
d3d68c34db
2 changed files with 16 additions and 4 deletions
|
|
@ -80,11 +80,23 @@ function WelcomePage() {
|
||||||
return () => clearTimeout(t);
|
return () => clearTimeout(t);
|
||||||
}, [step]);
|
}, [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 mas já tem nome do agente, pula direto para a etapa 3.
|
||||||
|
const jumpedToStep3 = useRef(false);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!agent) return;
|
if (!agent) return;
|
||||||
if (agent.onboarding_completed) {
|
if (agent.onboarding_completed && agent.telegram_bot_token_vault_id) {
|
||||||
navigate({ to: "/painel", search: {} });
|
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]);
|
}, [agent, navigate]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,17 +36,17 @@ function DashboardPage() {
|
||||||
const previousStatusRef = useRef<string | null>(null);
|
const previousStatusRef = useRef<string | null>(null);
|
||||||
|
|
||||||
// Redireciona para /bem-vindo se cliente acabou de pagar e ainda não completou onboarding
|
// 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(() => {
|
useEffect(() => {
|
||||||
if (search.status !== "success" || !agent) return;
|
if (search.status !== "success" || !agent) return;
|
||||||
if (agent.status === "suspended" || agent.status === "error") {
|
if (agent.status === "suspended" || agent.status === "error") {
|
||||||
navigate({ search: { status: undefined }, replace: true });
|
navigate({ search: { status: undefined }, replace: true });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!agent.onboarding_completed) {
|
if (!agent.onboarding_completed || !agent.telegram_bot_token_vault_id) {
|
||||||
navigate({ to: "/bem-vindo", replace: true });
|
navigate({ to: "/bem-vindo", replace: true });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!agent.telegram_bot_username) setWizardOpen(true);
|
|
||||||
navigate({ search: { status: undefined }, replace: true });
|
navigate({ search: { status: undefined }, replace: true });
|
||||||
}, [search.status, agent, navigate]);
|
}, [search.status, agent, navigate]);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue