// Paywall — tela que bloqueia o app quando o trial expira. // Renderizada DEPOIS do login mas ANTES do conteúdo principal, // quando profile.plan === 'trial' e trial_ends_at já passou. // // Existem duas versões: WebPaywall (desktop, layout amplo) e // MobilePaywall (celular, layout compacto). Ambas oferecem os 3 // planos com botão que abre o checkout Nexano. (function () { const PLANS = [ { id: 'mensal', name: 'Mensal', subtitle: 'Mais flexível', total: 29.90, months: 1, color: '#6FB8FF' }, { id: 'semestral', name: 'Semestral', subtitle: 'Equilibrado', total: 149.40, months: 6, color: '#FFB547', save: '17%' }, { id: 'anual', name: 'Anual', subtitle: 'Melhor custo', total: 238.80, months: 12, color: '#B197FC', save: '33%', recommended: true }, ]; const fmtBRL = (v) => `R$ ${v.toLocaleString('pt-BR', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`; // ── Web Paywall (desktop) ────────────────────────────────── function WebPaywall({ user, onLogout, onRefresh, showToast }) { const choose = (planId) => { const plan = PLANS.find(p => p.id === planId); if (window.Checkout && window.Checkout.openCheckout(planId, user)) { showToast && showToast(`Abrindo checkout · ${plan.name}`); } }; return (
Seu período de teste terminou
Continue com a Central completa
Sofia 24/7, tarefas, hábitos, metas, finanças e backup em nuvem. Seus dados estão salvos — só faltam você escolher um plano.
{PLANS.map(plan => ( choose(plan.id)} /> ))}
Todos os planos incluem
{['Sofia IA ilimitada', 'Backup em nuvem', 'Cofrinhos e metas', 'Sincronização', 'Relatórios PDF', 'Suporte prioritário', 'Cancele a qualquer hora', '14 dias garantia'].map((f, i) => (
{f}
))}
·
); } function PaywallCardWeb({ plan, onSelect }) { const perMonth = plan.total / plan.months; const periodLabel = plan.months === 1 ? '/mês' : plan.months === 6 ? 'a cada 6 meses' : '/ano'; return (
{plan.recommended && (
MAIS POPULAR
)}
{plan.name}
{plan.save && ( economize {plan.save} )}
{plan.subtitle}
{fmtBRL(plan.total)} {periodLabel}
{plan.months > 1 && (
equivale a {fmtBRL(perMonth)}/mês
)}
); } // ── Mobile Paywall (celular) ─────────────────────────────── function MobilePaywall({ user, onLogout, onRefresh, showToast }) { const choose = (planId) => { const plan = PLANS.find(p => p.id === planId); if (window.Checkout && window.Checkout.openCheckout(planId, user)) { showToast && showToast(`Abrindo checkout · ${plan.name}`); } }; return (
Seu trial terminou
Continue com a Central completa
Seus dados estão salvos. Escolha um plano e siga de onde parou ✨
{PLANS.map(plan => ( choose(plan.id)} /> ))}
Tudo incluído
Sofia IA ilimitada · Backup em nuvem · Cofrinhos e metas ilimitados · Relatórios PDF · 14 dias garantia
); } function PaywallCardMobile({ plan, onSelect }) { const perMonth = plan.total / plan.months; const periodLabel = plan.months === 1 ? '/mês' : plan.months === 6 ? '/sem' : '/ano'; return (
{plan.recommended && (
POPULAR
)}
{plan.name}
{plan.save && ( -{plan.save} )}
{plan.subtitle}
{fmtBRL(plan.total)} {periodLabel}
{plan.months > 1 && (
{fmtBRL(perMonth)}/mês
)}
); } // Expõe globalmente window.WebPaywall = WebPaywall; window.MobilePaywall = MobilePaywall; })();