// screens-payment.jsx — Confirm & pay (Saldo principal / TeleTaku), PIN sheet, Success, Payment methods function PinSheet({ method, total, onClose, onDone }) { const [pin, setPin] = useState(""); const [processing, setProcessing] = useState(false); const [stage, setStage] = useState(0); const isMain = method === "main"; const start = () => setProcessing(true); useEffect(() => { if (!processing) return; const t = [setTimeout(() => setStage(1), 700), setTimeout(() => setStage(2), 1400), setTimeout(onDone, 2100)]; return () => t.forEach(clearTimeout); }, [processing]); const press = (d) => { if (pin.length >= 4) return; const n = pin + d; setPin(n); if (n.length === 4) setTimeout(start, 250); }; const key = { height: 54, borderRadius: 14, background: "var(--surface-2)", fontFamily: "var(--font-display)", fontSize: 22, fontWeight: 700 }; return (
!processing && onClose()}>
e.stopPropagation()} style={{ maxWidth: 480, margin: "0 auto" }}>
{processing ? (

A processar…

{["A contactar " + (isMain ? "a tua conta" : "o TeleTaku") + "…", "A confirmar o pagamento…", "Quase pronto…"][stage]}

) : isMain ? ( <>

Confirmar compra

Vão ser debitados {fmtXof(total)} XOF do teu Saldo principal.

) : ( <>

PIN TeleTaku

Insere o teu PIN para autorizar {fmtXof(total)} XOF.

{[0, 1, 2, 3].map(i =>
i ? "filled" : ""} ${pin.length === i ? "active" : ""}`}>{pin.length > i ? "•" : ""}
)}
{[1, 2, 3, 4, 5, 6, 7, 8, 9].map(d => )}
)}
); } /* ─────────────────────────── PAYMENT ─────────────────────────── */ function ScreenPayment({ go, args, user }) { const bundle = args?.bundle || null; const isBundle = !!bundle; const phone = args?.phone || user.phone; const [method, setMethod] = useState(isBundle ? (args?.method || "teletaku") : "teletaku"); const [sheet, setSheet] = useState(false); const eff = isBundle ? effective(bundle, method) : null; const total = isBundle ? eff.price : (args?.amount || 1000); const isSelf = phone === user.phone; return ( <>
go(isBundle ? "bundle-detail" : "recharge", isBundle ? { id: bundle.id, method } : null)} right={ Seguro } />
Resumo
{isBundle ? "Pacote" : "Recarga"} {isBundle ? `${bundle.title} · ${eff.vol}` : `${fmtXof(total)} XOF`}
{isBundle ?
Validade{bundle.validity}
: null}
Para {isSelf ? "Meu número" : phone}
Total {fmtXof(total)} XOF
Pagar com
{isBundle ? : {}} price={total} onlyTeletaku />}
Pagamento protegido · {method === "main" ? "debitado do Saldo principal" : "autorizado com PIN TeleTaku"}
{sheet ? setSheet(false)} onDone={() => go("success", { amount: total, phone, method, isBundle, bundle, vol: eff?.vol, isSelf })} /> : null} ); } /* ─────────────────────────── SUCCESS ─────────────────────────── */ function ScreenSuccess({ go, args }) { const [animated, setAnimated] = useState(false); useEffect(() => { const t = setTimeout(() => setAnimated(true), 100); return () => clearTimeout(t); }, []); const a = { amount: 1000, phone: "+245 96 660 14 29", method: "teletaku", isSelf: true, ...(args || {}) }; const amount = a.amount; return ( <>

{a.isBundle ? "Pacote ativado!" : "Recarga concluída!"}

{a.isBundle ? `${a.bundle.title} (${a.vol}) ${a.isSelf ? "já está ativo no teu número" : "foi enviado para " + a.phone}.` : `${fmtXof(amount)} XOF enviados para ${a.isSelf ? "o teu número" : a.phone}.`}

Valor{fmtXof(amount)} XOF
Pago com{a.method === "main" ? "Saldo principal" : "TeleTaku"}
ReferênciaTLC-84210293
Ganhaste {Math.max(1, Math.round(amount / 100))} pontos
{!a.isBundle ? ( ) : null}
); } /* ─────────────────────────── PAYMENT METHODS ─────────────────────────── */ function ScreenPaymentMethods({ go }) { return ( <>
go("account")} />

A compra de pacotes é feita com o Saldo principal ou com a carteira TeleTaku.

Saldo principal
4.520 XOF
+245 96 660 14 29
TeleTaku
8.450 XOF
Mais dados e preços mais baixos nos pacotes
Renovar pacote automaticamente
Quando o pacote de internet terminar
Pedir PIN TeleTaku sempre
Recomendado para a tua segurança
); } function Toggle({ on: initOn = false }) { const [on, setOn] = useState(initOn); return ( ); } Object.assign(window, { ScreenPayment, ScreenSuccess, ScreenPaymentMethods, Toggle, PinSheet });