import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react'; import ReactDOM from 'react-dom/client'; // --- DEFINIÇÕES DE DADOS --- interface Option { id: string; text: string; emoji?: string; image?: string; } interface QuizStep { id: string; type: 'age' | 'info' | 'single-choice' | 'multi-choice' | 'loading' | 'name' | 'final-plan' | 'commitment' | 'slider'; title: string; subtitle?: string; options?: Option[]; image?: string; buttonText?: string; mainText?: string; loadingTexts?: string[]; min?: number; max?: number; defaultValue?: number; unit?: string; hint?: string; testimonials?: { name: string; date: string; rating: number; text: string; avatar: string; }[]; } const quizData: QuizStep[] = [ { id: 'name', type: 'name', title: '👊 QUAL É SEU NOME?', subtitle: 'Quero te chamar pelo nome quando te salvar dessa situação.', buttonText: 'CONTINUAR' }, { id: 'age', type: 'slider', title: '⏰ QUAL SUA IDADE?', subtitle: 'Depois dos 30, o corpo começa a te jogar contra a parede.', hint: 'Arraste para selecionar', min: 18, max: 80, defaultValue: 35, unit: 'anos', buttonText: 'PRÓXIMO PASSO' }, { id: 'currentWeight', type: 'slider', title: '⚖️ SEU PESO ATUAL EM KG?', subtitle: 'Seja honesta para o plano funcionar.', hint: 'Arraste para marcar', min: 40, max: 200, defaultValue: 80, unit: 'kg', buttonText: 'REGISTRAR PESO' }, { id: 'height', type: 'slider', title: '📏 E SUA ALTURA EM CM?', subtitle: 'Ajuste sua altura exata.', hint: 'Arraste para ajustar', min: 100, max: 220, defaultValue: 165, unit: 'cm', buttonText: 'CALCULAR IMC' }, { id: 'proof-27k', type: 'info', title: 'MAIS DE 27.000 MULHERES!', subtitle: 'Elas relataram perda de peso real. Comece sua mudança agora.', image: 'https://conquistafit.site/wp-content/uploads/2025/11/lg-if2k4-pag2-ajrdsc.webp', buttonText: 'EU QUERO SER A PRÓXIMA' }, { id: 'whatHoldsYouBack', type: 'multi-choice', title: '💥 O QUE TE TRAVA HOJE?', options: [{ id: 'h1', text: 'Ansiedade / Compulsão' }, { id: 'h2', text: 'Falta de Tempo' }, { id: 'h3', text: 'Metabolismo Lento' }, { id: 'h4', text: 'Efeito Sanfona' }], buttonText: 'VOU SUPERAR ISSO' }, { id: 'feelingInMirror', type: 'single-choice', title: '😡 SENTIMENTO NO ESPELHO?', options: [{ id: 'f1', text: 'Frustrada e Cansada', emoji: '😞' }, { id: 'f2', text: 'Sem Autoestima', emoji: '💔' }, { id: 'f3', text: 'Vergonha de Sair', emoji: '😶' }, { id: 'f4', text: 'Pronta para o Basta', emoji: '🔥' }] }, { id: 'before-after-1', type: 'info', title: 'RESULTADOS EM 7 DIAS', subtitle: 'Queima de gordura visceral destravada.', image: 'https://conquistafit.site/wp-content/uploads/2025/11/Group-1891.png', buttonText: 'QUERO ESSE RESULTADO' }, { id: 'mealsPerDay', type: 'slider', title: '🍔 REFEIÇÕES POR DIA?', min: 1, max: 8, defaultValue: 3, unit: 'vezes', buttonText: 'CONFIRMAR' }, { id: 'before-after-2', type: 'info', title: 'TRANSFORMAÇÃO VISÍVEL', image: 'https://conquistafit.site/wp-content/uploads/2025/11/Dep-5.png', buttonText: 'CONTINUAR' }, { id: 'dietaryRestrictions', type: 'multi-choice', title: '🚫 RESTRIÇÃO ALIMENTAR?', options: [{ id: 'r1', text: 'Nenhuma' }, { id: 'r2', text: 'Sem Glúten' }, { id: 'r3', text: 'Sem Lactose' }, { id: 'r4', text: 'Vegetariana' }], buttonText: 'PRÓXIMO' }, { id: 'before-after-3', type: 'info', title: 'SAÚDE QUE SE VÊ', image: 'https://conquistafit.site/wp-content/uploads/2025/11/Dep6.png', buttonText: 'VAMOS ADIANTE' }, { id: 'exerciseFrequency', type: 'single-choice', title: '🏋️‍♀️ EXERCÍCIOS?', options: [{ id: 'e1', text: 'Sedentária', emoji: '🛋️' }, { id: 'e2', text: 'Pouco ativa', emoji: '🚶' }, { id: 'e3', text: 'Ativa', emoji: '🏃' }, { id: 'e4', text: 'Atleta', emoji: '🏅' }] }, { id: 'before-after-4', type: 'info', title: 'MUDANÇA POSSÍVEL', image: 'https://conquistafit.site/wp-content/uploads/2025/11/Group-1889.png', buttonText: 'QUERO COMEÇAR' }, { id: 'familySupport', type: 'single-choice', title: '👨‍👩‍👧 FAMÍLIA APOIA?', options: [{ id: 's1', text: 'Me apoiam', emoji: '❤️' }, { id: 's2', text: 'Me sabotam', emoji: '🍕' }, { id: 's3', text: 'Indiferentes', emoji: '😐' }, { id: 's4', text: 'Moro sozinha', emoji: '🏠' }] }, { id: 'before-after-5', type: 'info', title: 'SUA NOVA VERSÃO 2026', image: 'https://conquistafit.site/wp-content/uploads/2025/11/Group-1890.png', buttonText: 'QUASE LÁ, CONTINUAR' }, { id: 'fatteningHabit', type: 'multi-choice', title: '🍕 HÁBITO QUE ENGORDA?', options: [{ id: 'hab1', text: 'Beliscar' }, { id: 'hab2', text: 'Doce' }, { id: 'hab3', text: 'Noite' }, { id: 'hab4', text: 'Bebidas' }], buttonText: 'VOU ELIMINAR' }, { id: 'motivationLevel', type: 'commitment', title: '🔥 ESTÁ PRONTA?', buttonText: 'ESTOU 100% PRONTA' }, { id: 'loading-1', type: 'loading', title: 'GERANDO DOSSIÊ...', mainText: 'Processando seus dados metabólicos.', loadingTexts: ['Calculando IMC...', 'Protocolos de saciedade...', 'Dossiê 2026...', 'Finalizando...'], testimonials: [{ name: 'Dra. Paula Costa', date: 'Nutricionista', rating: 5, text: 'Quase pronto. Metabolismo detectado.', avatar: 'https://conquistafit.site/wp-content/uploads/2025/12/595111737_122141445536959250_3157664674890558791_n.jpg' }] }, { id: 'final-plan', type: 'final-plan', title: 'DIAGNÓSTICO CONCLUÍDO!', subtitle: 'DERRETA 5KG EM 7 DIAS', image: 'https://i.postimg.cc/c1m5rthW/50-RECEUITAS.png', buttonText: 'LIBERAR ACESSO' }, ]; // --- COMPONENTES --- const ProgressBar = ({ progress }: { progress: number }) => (
); const App: React.FC = () => { const [step, setStep] = useState(0); const [answers, setAnswers] = useState>({}); const [quizStarted, setQuizStarted] = useState(false); const [city, setCity] = useState('sua região'); const [playing, setPlaying] = useState(false); const audioRef = useRef(null); useEffect(() => { fetch('https://ipapi.co/json/').then(r => r.json()).then(d => d.city && setCity(d.city)).catch(() => {}); }, []); const handleNext = (val?: any) => { const current = quizData[step]; if (current && val !== undefined) setAnswers(p => ({ ...p, [current.id]: val })); setStep(s => s + 1); }; // Fix for the error: useEffect inside JSX for the loading step. // Hooks must be at the top level. This handles the automatic progression for loading steps. useEffect(() => { const currentStep = quizData[step]; if (currentStep && currentStep.type === 'loading') { const timer = setTimeout(() => { handleNext(); }, 4000); return () => clearTimeout(timer); } }, [step]); const toggleAudio = (url: string) => { if (!audioRef.current) return; if (audioRef.current.src !== url) { audioRef.current.src = url; audioRef.current.play(); setPlaying(true); } else { if (playing) audioRef.current.pause(); else audioRef.current.play(); setPlaying(!playing); } }; const current = quizData[step]; const progress = Math.round((step / quizData.length) * 100); // --- RENDERIZADO DAS TELAS --- if (!quizStarted) return (
); if (!current) { // --- SALES PAGE --- const checkoutUrl = "https://pay.cakto.com.br/pjbyx7r_696261"; return (
); } // --- RENDERIZADO DAS ETAPAS DO QUIZ --- const renderStep = () => { switch (current.type) { case 'name': return (

{current.title}

{current.subtitle}

setAnswers(p => ({ ...p, name: e.target.value }))} placeholder="DIGITE SEU NOME" className="w-full p-6 bg-white border-2 border-slate-100 rounded-[2rem] text-center text-xl focus:border-primary focus:outline-none font-black text-secondary shadow-xl uppercase mb-10" />
); case 'slider': return (

{current.title}

{current.subtitle}

{answers[current.id] || current.defaultValue} {current.unit}
{current.hint}
setAnswers(p => ({ ...p, [current.id]: Number(e.target.value) }))} className="w-full h-5 bg-slate-100 rounded-full appearance-none cursor-pointer accent-primary border-4 border-white shadow-sm" />
); case 'loading': return (

{current.mainText}

Dra

Dra. Paula Costa

"{current.testimonials![0].text}"

); case 'final-plan': return (

DIAGNÓSTICO CONCLUÍDO

Seu Metabolismo Está em Estado de

ALERTA 🔥
); case 'single-choice': return (

{current.title}

{current.options?.map(o => ( ))}
); case 'multi-choice': return (

{current.title}

{current.options?.map(o => ( ))}
); case 'info': return (

{current.title}

info {current.subtitle &&

"{current.subtitle}"

}
); case 'commitment': return (

VOCÊ PROMETE SEGUIR?

); default: return null; } }; const showHeader = !['loading', 'final-plan', 'name', 'commitment'].includes(current?.type || ''); return (
{showHeader && (
Ambiente Seguro Conquista Fit
)}
{renderStep()}
); }; const root = ReactDOM.createRoot(document.getElementById('root')!); root.render();