// screens-bundles.jsx — Bundle catalogue (Internet · Voz · Combo), detail/purchase, recommended, compare, promotions
const ALL_BUNDLES = BUNDLES;
function CategoryTabs({ value, onChange }) {
return (
{BUNDLE_CATEGORIES.map(c => {
const active = value === c.id;
return (
onChange(c.id)} style={{
position: "relative", display: "flex", flexDirection: "column", alignItems: "center", gap: 6, padding: "14px 8px", borderRadius: 18,
background: active ? "var(--accent)" : "var(--surface)", color: active ? "#fff" : "var(--text-strong)",
border: `1px solid ${active ? "var(--accent)" : "var(--border)"}`, transition: "all .15s ease",
}}>
{c.id === "internet" ? DESTAQUE : null}
{c.label}
);
})}
);
}
function BundleGrid({ list, tweaks, isDesktop, go }) {
const layout = tweaks.bundleLayout;
return (
{list.map((b, i) => (
go("bundle-detail", { id: b.id })} featured={i === 0 && layout === "grid"} />
))}
);
}
/* ─────────────────────────── BUNDLE LIST ─────────────────────────── */
function ScreenBundles({ go, tweaks, args, isDesktop }) {
const [cat, setCat] = useState(args?.cat || "internet");
const list = bundlesByCat(cat);
const families = cat === "combo" ? [...new Set(list.map(b => b.family))] : null;
return (
<>
go("home")} right={
go("bundle-compare")}> Comparar
} />
{cat === "internet" ? (
Internet · Exclusivo TeleTaku
1,3 GB passa a 3 GB.
Paga o pacote semanal de 1.000 XOF com TeleTaku e leva mais do dobro.
go("bundle-detail", { id: "net1000", method: "teletaku" })}>Comprar agora
) : null}
{families ? families.map(f => (
b.family === f)} tweaks={tweaks} isDesktop={isDesktop} go={go} />
)) : (
<>
>
)}
{cat !== "internet" ? (
setCat("internet")}>
Precisas de mais internet?
Pacotes desde 100 XOF · dobro dos dados com TeleTaku
) : null}
>
);
}
/* ─────────────────────────── BUNDLE DETAIL + PURCHASE ─────────────────────────── */
function ScreenBundleDetail({ go, args, isDesktop }) {
const [id, setId] = useState(args?.id || args?.bundle?.id || "net1000");
const [forWho, setForWho] = useState(args?.recipient ? "other" : "self");
const [other, setOther] = useState(args?.recipient || "");
const [method, setMethod] = useState(args?.method || "teletaku");
const b = getBundle(id);
const eff = effective(b, method);
const up = UPSELL[id] ? getBundle(UPSELL[id]) : null;
const recipientOk = forWho === "self" || isTelecelNumber(other);
const source = PAY_SOURCES.find(s => s.id === method);
const enough = source.balance >= eff.price;
const canBuy = recipientOk && enough;
const left = (
<>
{b.family || b.kind}
{method === "teletaku" && b.ttVol ? b.ttVol.split(" ")[0] : b.vol}{method === "teletaku" && b.ttVol ? b.ttVol.split(" ")[1] : b.unit}
{b.title} · válido {b.validity}
{fmtXof(eff.price)}
XOF
{eff.price !== b.price ? {fmtXof(b.price)} : null}
{b.perk ? (
{b.ttVol ? <>Com TeleTaku recebes {b.ttVol} em vez de {b.vol} {b.unit}.> : <>Com TeleTaku pagas só {fmtXof(b.ttPrice)} XOF .>}
) : null}
O que está incluído
{b.includes.map((r, i) => (
))}
Validade {b.validity}
Começa a contar quando o pacote é ativado
{up ? (
Por mais {fmtXof(up.price - b.price)} XOF: {up.title}
{up.vol} {up.unit} · {up.sub}
setId(up.id)}>Mudar para {up.title}
) : null}
>
);
const right = (
<>
Para quem?
{forWho === "self"
?
O meu número
+245 96 660 14 29
:
go("saved-numbers")} />}
Pagar com
Os pacotes só podem ser pagos com o Saldo principal ou TeleTaku.
go("payment", { bundle: b, method, phone: forWho === "self" ? "+245 96 660 14 29" : formatTelecel(other), mode: "bundle" })}>
Comprar · {fmtXof(eff.price)} XOF
>
);
return (
<>
go("bundles", { cat: b.cat })} />
>
);
}
/* ─────────────────────────── RECOMMENDED ─────────────────────────── */
const RECOMMENDED_SECTIONS = [
{ title: "Internet em destaque", subtitle: "Dobro dos dados com TeleTaku", ids: ["net1000", "net100"] },
{ title: "Recomendado para ti", subtitle: "Com base no teu consumo", ids: ["net1000", "boss5000", "livre1000"] },
{ title: "Melhor valor", subtitle: "Mais GB por cada XOF", ids: ["boss10000", "boss5000", "livre1500"] },
{ title: "Para quem fala muito", subtitle: "Chamadas para todas as redes", ids: ["voz200", "boss5000", "livre1500"] },
];
function ScreenRecommended({ go }) {
return (
<>
go("home")} />
{RECOMMENDED_SECTIONS.map(sec => (
{sec.title}
{sec.subtitle}
{sec.ids.map(id => (
go("bundle-detail", { id })} />
))}
))}
>
);
}
/* ─────────────────────────── COMPARE ─────────────────────────── */
function ScreenBundleCompare({ go }) {
const [set, setSet] = useState("internet");
const ids = set === "internet" ? ["net100", "net1000", "livre1000"] : ["livre1500", "boss5000", "boss10000"];
const bundles = ids.map(getBundle);
const rows = [
{ label: "Preço", v: b => `${fmtXof(b.price)} XOF` },
{ label: "Internet", v: b => b.cat === "voz" ? "—" : `${b.vol} ${b.unit}` },
{ label: "Com TeleTaku", v: b => b.ttVol || (b.ttPrice ? `${fmtXof(b.ttPrice)} XOF` : "—") },
{ label: "Chamadas", v: b => b.calls || b.cat === "voz" ? "Ilimitadas" : b.minutes ? `${b.minutes} MIN` : "—" },
{ label: "Validade", v: b => b.validity },
];
return (
<>
go("bundles")} />
{bundles.map(b => (
go("bundle-detail", { id: b.id })} style={{ display: "flex", flexDirection: "column", gap: 4, textAlign: "center", padding: 12 }}>
{b.family || b.kind}
{b.vol}{b.unit}
{fmtXof(b.price)} XOF
))}
{rows.map((r, i) => (
{r.label}
{bundles.map(b =>
{r.v(b)}
)}
))}
>
);
}
/* ─────────────────────────── PROMOTIONS ─────────────────────────── */
const PROMO_LIST = [
{ eyebrow: "Internet · TeleTaku", title: "3 GB por 1.000 XOF", body: "Em vez de 1,3 GB. Válido 7 dias.", id: "net1000", method: "teletaku", tone: "red" },
{ eyebrow: "Internet diário", title: "140 MB por 100 XOF", body: "O dobro dos dados com TeleTaku. 24 horas.", id: "net100", method: "teletaku", tone: "dark" },
{ eyebrow: "Tele Boss", title: "Chamadas ilimitadas + 50 GB", body: "10.000 XOF · válido 15 dias.", id: "boss10000", tone: "red" },
{ eyebrow: "Voz 24h", title: "Fala à vontade por 150 XOF", body: "Chamadas ilimitadas para todas as redes com TeleTaku.", id: "voz200", method: "teletaku", tone: "dark" },
];
function ScreenPromotions({ go }) {
return (
<>
go("home")} />
{PROMO_LIST.map((p, i) => (
{p.eyebrow}
{p.title}
{p.body}
go("bundle-detail", { id: p.id, method: p.method })}>Comprar
))}
>
);
}
Object.assign(window, {
ScreenBundles, ScreenBundleDetail, ScreenRecommended, ScreenBundleCompare, ScreenPromotions, ALL_BUNDLES,
});