1038 lines
42 KiB
HTML
1038 lines
42 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="pt-BR">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
|
|
<meta name="theme-color" content="#101820">
|
|
<title>INCTG Wi-Fi Convidados</title>
|
|
<link rel="icon" type="image/png" href="logo.png">
|
|
<!-- Mercado Pago: SDK JS V2 + Device ID (gera MP_DEVICE_SESSION_ID) -->
|
|
<script src="https://sdk.mercadopago.com/js/v2" defer></script>
|
|
<script src="https://www.mercadopago.com.br/integrations/v1/security-code.js" async view="checkout"></script>
|
|
<style>
|
|
:root {
|
|
--graphite: #101820;
|
|
--graphite-2: #151f2b;
|
|
--graphite-3: #1c2836;
|
|
--blue: #246BFD;
|
|
--blue-hover: #3d7cff;
|
|
--blue-soft: rgba(36, 107, 253, 0.14);
|
|
--white: #F4F6F8;
|
|
--gray: #7C8A9A;
|
|
--gray-2: #9aa7b5;
|
|
--line: rgba(124, 138, 154, 0.18);
|
|
--success: #12B886;
|
|
--success-soft: rgba(18, 184, 134, 0.12);
|
|
--danger: #E5484D;
|
|
--radius-sm: 6px;
|
|
--radius-md: 10px;
|
|
--radius-lg: 16px;
|
|
--font-heading: "Manrope", system-ui, sans-serif;
|
|
--font-body: "Inter", system-ui, sans-serif;
|
|
}
|
|
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
|
|
html { -webkit-text-size-adjust: 100%; }
|
|
|
|
body {
|
|
font-family: var(--font-body);
|
|
background: var(--graphite);
|
|
color: var(--white);
|
|
min-height: 100dvh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
|
|
position: relative;
|
|
overflow-x: hidden;
|
|
}
|
|
|
|
body::before {
|
|
content: "";
|
|
position: fixed;
|
|
inset: 0;
|
|
background:
|
|
radial-gradient(720px 420px at 85% -10%, rgba(36, 107, 253, 0.18), transparent 60%),
|
|
radial-gradient(520px 320px at -10% 110%, rgba(36, 107, 253, 0.08), transparent 60%);
|
|
pointer-events: none;
|
|
z-index: 0;
|
|
}
|
|
|
|
.wrap {
|
|
width: 100%;
|
|
max-width: 440px;
|
|
position: relative;
|
|
z-index: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 20px;
|
|
}
|
|
|
|
/* ---------- Header ---------- */
|
|
.brand {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 14px;
|
|
text-align: center;
|
|
padding-top: 8px;
|
|
}
|
|
|
|
.brand-logo {
|
|
width: 108px;
|
|
height: auto;
|
|
border-radius: 14px;
|
|
display: block;
|
|
}
|
|
|
|
.brand h1 {
|
|
font-family: var(--font-heading);
|
|
font-weight: 700;
|
|
font-size: 1.45rem;
|
|
letter-spacing: -0.02em;
|
|
line-height: 1.2;
|
|
}
|
|
|
|
.brand .tagline {
|
|
color: var(--gray);
|
|
font-size: 0.86rem;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.brand .tagline strong { color: var(--blue); font-weight: 600; }
|
|
|
|
/* ---------- Cards ---------- */
|
|
.card {
|
|
background: linear-gradient(180deg, rgba(28, 40, 54, 0.9), rgba(21, 31, 43, 0.9));
|
|
border: 1px solid var(--line);
|
|
border-radius: var(--radius-lg);
|
|
padding: 20px;
|
|
backdrop-filter: blur(6px);
|
|
}
|
|
|
|
.section-label {
|
|
font-size: 0.72rem;
|
|
font-weight: 600;
|
|
letter-spacing: 0.12em;
|
|
text-transform: uppercase;
|
|
color: var(--gray);
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
/* ---------- Planos ---------- */
|
|
.plan {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 14px;
|
|
width: 100%;
|
|
background: var(--graphite-2);
|
|
border: 1px solid var(--line);
|
|
border-radius: var(--radius-md);
|
|
padding: 16px;
|
|
cursor: pointer;
|
|
text-align: left;
|
|
color: inherit;
|
|
font: inherit;
|
|
transition: border-color 0.18s, transform 0.18s, background 0.18s;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.plan:last-child { margin-bottom: 0; }
|
|
|
|
.plan:hover { border-color: rgba(36, 107, 253, 0.55); transform: translateY(-1px); }
|
|
.plan:active { transform: translateY(0); }
|
|
|
|
.plan:focus-visible,
|
|
button:focus-visible,
|
|
a:focus-visible {
|
|
outline: 2px solid var(--blue);
|
|
outline-offset: 2px;
|
|
}
|
|
|
|
.plan-info h3 {
|
|
font-family: var(--font-heading);
|
|
font-size: 1rem;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.plan-meta {
|
|
margin-top: 4px;
|
|
color: var(--gray);
|
|
font-size: 0.78rem;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.plan-price {
|
|
font-family: var(--font-heading);
|
|
font-weight: 800;
|
|
font-size: 1.05rem;
|
|
color: var(--blue);
|
|
background: var(--blue-soft);
|
|
border-radius: var(--radius-sm);
|
|
padding: 8px 12px;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
/* ---------- Checkout ---------- */
|
|
.pay-head { text-align: center; margin-bottom: 6px; }
|
|
|
|
.pay-head h2 {
|
|
font-family: var(--font-heading);
|
|
font-size: 1.15rem;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.pay-head p { color: var(--gray); font-size: 0.84rem; margin-top: 4px; }
|
|
|
|
.qr-panel {
|
|
background: #fff;
|
|
border-radius: var(--radius-md);
|
|
padding: 14px;
|
|
width: 232px;
|
|
height: 232px;
|
|
margin: 18px auto 14px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.qr-panel img { width: 100%; height: 100%; object-fit: contain; }
|
|
|
|
.copia {
|
|
background: var(--graphite);
|
|
border: 1px dashed rgba(124, 138, 154, 0.35);
|
|
border-radius: var(--radius-sm);
|
|
padding: 12px;
|
|
font-size: 0.68rem;
|
|
line-height: 1.5;
|
|
word-break: break-all;
|
|
color: var(--gray-2);
|
|
font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
|
|
max-height: 84px;
|
|
overflow: hidden;
|
|
position: relative;
|
|
}
|
|
|
|
.row { display: flex; gap: 10px; margin-top: 12px; }
|
|
|
|
/* ---------- Botões ---------- */
|
|
.btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
width: 100%;
|
|
border: 0;
|
|
border-radius: var(--radius-md);
|
|
padding: 14px 18px;
|
|
font-family: var(--font-heading);
|
|
font-size: 0.95rem;
|
|
font-weight: 700;
|
|
cursor: pointer;
|
|
transition: background 0.18s, opacity 0.18s, transform 0.15s;
|
|
text-decoration: none;
|
|
color: #fff;
|
|
}
|
|
|
|
.btn:active { transform: scale(0.985); }
|
|
.btn:disabled { opacity: 0.55; cursor: wait; }
|
|
|
|
.btn-primary { background: var(--blue); }
|
|
.btn-primary:hover:not(:disabled) { background: var(--blue-hover); }
|
|
|
|
.btn-ghost {
|
|
background: transparent;
|
|
border: 1px solid var(--line);
|
|
color: var(--white);
|
|
font-weight: 600;
|
|
}
|
|
|
|
.btn-ghost:hover { border-color: var(--gray); }
|
|
|
|
.btn-success { background: var(--success); }
|
|
.btn-success:hover:not(:disabled) { background: #16c996; }
|
|
|
|
/* ---------- Status pill ---------- */
|
|
.pill {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
color: var(--gray);
|
|
font-size: 0.82rem;
|
|
margin-top: 14px;
|
|
min-height: 22px;
|
|
}
|
|
|
|
.pill .dot {
|
|
width: 8px; height: 8px; border-radius: 50%;
|
|
background: var(--gray);
|
|
flex: none;
|
|
}
|
|
|
|
.pill.waiting .dot {
|
|
background: var(--blue);
|
|
animation: pulse 1.4s ease-in-out infinite;
|
|
}
|
|
|
|
.pill.ok { color: var(--success); }
|
|
.pill.ok .dot { background: var(--success); animation: none; }
|
|
.pill.err { color: var(--danger); }
|
|
.pill.err .dot { background: var(--danger); animation: none; }
|
|
|
|
@keyframes pulse {
|
|
0%, 100% { opacity: 1; transform: scale(1); }
|
|
50% { opacity: 0.35; transform: scale(0.75); }
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
* { animation: none !important; transition: none !important; }
|
|
}
|
|
|
|
/* ---------- Voucher ---------- */
|
|
.voucher-view { text-align: center; }
|
|
|
|
.check {
|
|
width: 56px; height: 56px;
|
|
margin: 6px auto 14px;
|
|
border-radius: 50%;
|
|
background: var(--success-soft);
|
|
display: flex; align-items: center; justify-content: center;
|
|
}
|
|
|
|
.check svg { width: 28px; height: 28px; }
|
|
|
|
.voucher-view h2 {
|
|
font-family: var(--font-heading);
|
|
font-size: 1.2rem;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.voucher-view .hint {
|
|
color: var(--gray);
|
|
font-size: 0.85rem;
|
|
margin: 6px 0 18px;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.code-box {
|
|
background: var(--graphite);
|
|
border: 1px solid var(--line);
|
|
border-radius: var(--radius-md);
|
|
padding: 14px;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.code-box .lbl {
|
|
font-size: 0.68rem;
|
|
letter-spacing: 0.1em;
|
|
text-transform: uppercase;
|
|
color: var(--gray);
|
|
font-weight: 600;
|
|
}
|
|
|
|
.code-box .val {
|
|
font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
|
|
font-size: 1.45rem;
|
|
font-weight: 700;
|
|
color: var(--success);
|
|
letter-spacing: 0.08em;
|
|
margin-top: 4px;
|
|
user-select: all;
|
|
}
|
|
|
|
.steps {
|
|
margin: 16px 0 4px;
|
|
text-align: left;
|
|
color: var(--gray);
|
|
font-size: 0.8rem;
|
|
line-height: 1.7;
|
|
padding-left: 4px;
|
|
}
|
|
|
|
.steps li { margin-left: 18px; }
|
|
|
|
/* ---------- Footer / toast ---------- */
|
|
footer {
|
|
margin-top: 8px;
|
|
text-align: center;
|
|
color: var(--gray);
|
|
font-size: 0.72rem;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
footer strong { color: var(--white); font-weight: 600; }
|
|
|
|
.toast {
|
|
position: fixed;
|
|
bottom: calc(20px + env(safe-area-inset-bottom));
|
|
left: 50%;
|
|
transform: translateX(-50%) translateY(80px);
|
|
background: var(--graphite-3);
|
|
border: 1px solid var(--line);
|
|
color: var(--white);
|
|
padding: 10px 18px;
|
|
border-radius: 999px;
|
|
font-size: 0.85rem;
|
|
font-weight: 600;
|
|
opacity: 0;
|
|
transition: transform 0.25s, opacity 0.25s;
|
|
z-index: 10;
|
|
pointer-events: none;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
|
|
|
|
.hidden { display: none !important; }
|
|
|
|
.back {
|
|
display: block;
|
|
text-align: center;
|
|
margin-top: 16px;
|
|
color: var(--gray);
|
|
font-size: 0.85rem;
|
|
text-decoration: none;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.back:hover { color: var(--white); }
|
|
|
|
.empty {
|
|
text-align: center;
|
|
color: var(--gray);
|
|
font-size: 0.88rem;
|
|
padding: 12px 0;
|
|
}
|
|
|
|
.field {
|
|
display: block;
|
|
margin-bottom: 14px;
|
|
}
|
|
|
|
.field span {
|
|
display: block;
|
|
font-size: 0.8rem;
|
|
font-weight: 600;
|
|
color: var(--gray-2);
|
|
margin-bottom: 6px;
|
|
letter-spacing: 0.02em;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.field input {
|
|
width: 100%;
|
|
padding: 12px 14px;
|
|
font-family: var(--font-body);
|
|
font-size: 0.95rem;
|
|
color: var(--white);
|
|
background: var(--graphite-2);
|
|
border: 1px solid var(--line);
|
|
border-radius: var(--radius-sm);
|
|
outline: none;
|
|
transition: border-color 0.15s ease;
|
|
}
|
|
|
|
.field input:focus { border-color: var(--blue); }
|
|
|
|
.field input::placeholder { color: var(--gray); }
|
|
|
|
.mp-badge {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
margin-top: 14px;
|
|
font-size: 0.78rem;
|
|
color: var(--gray-2);
|
|
}
|
|
|
|
.mp-badge svg { flex: 0 0 auto; }
|
|
|
|
.skel {
|
|
height: 68px;
|
|
border-radius: var(--radius-md);
|
|
background: linear-gradient(90deg, var(--graphite-2) 25%, var(--graphite-3) 50%, var(--graphite-2) 75%);
|
|
background-size: 200% 100%;
|
|
animation: sk 1.2s infinite linear;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
@keyframes sk { to { background-position: -200% 0; } }
|
|
/* Mobile portal: readable rules, clear steps, and one primary payment action. */
|
|
:root { --radius-sm:12px; --radius-md:18px; --radius-lg:24px; --gray:#a3b3c7; --blue:#568aff; --blue-hover:#73a0ff; }
|
|
body { background:#0a1220; padding-top:32px; }
|
|
.wrap { max-width:500px; gap:18px; }
|
|
.brand { align-items:flex-start; text-align:left; gap:20px; padding:8px 4px 12px; }
|
|
.brand-logo { width:68px; border-radius:18px; }
|
|
.brand h1 { font-size:2.25rem; line-height:1.1; letter-spacing:-.045em; margin:10px 0; }
|
|
.brand .tagline { line-height:1.7; max-width:35ch; }
|
|
.eyebrow { color:#a7c2ff; text-transform:uppercase; font-size:.7rem; letter-spacing:.18em; font-weight:700; }
|
|
.journey { display:flex; gap:8px; margin-top:16px; flex-wrap:wrap; }
|
|
.journey span { font-size:.73rem; color:#c2cee0; border:1px solid var(--line); padding:7px 11px; border-radius:50px; }
|
|
.card { background:linear-gradient(145deg,#172438,#101b2b); border-color:rgba(164,190,230,.14); box-shadow:0 16px 40px #0002; padding:24px; }
|
|
.access-card { border-color:#f3bb5755; background:linear-gradient(135deg,#30291d,#191e29); }
|
|
.access-heading { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:12px; margin-bottom:12px; }
|
|
.access-heading strong { color:#ffda97; font-size:.9rem; }
|
|
.countdown { color:#ffe4b2; font-size:1.5rem; font-weight:800; font-variant-numeric:tabular-nums; }
|
|
.access-rules { color:#e5d9c5; font-size:.84rem; line-height:1.7; }
|
|
.consent { display:flex; align-items:flex-start; gap:10px; margin-top:16px; padding-top:14px; border-top:1px solid #f3bb572b; color:#f3e6d0; font-size:.8rem; line-height:1.6; cursor:pointer; }
|
|
.consent input { flex-shrink:0; width:19px; height:19px; margin-top:3px; accent-color:#568aff; }
|
|
#freeAccessMessage { margin-top:14px; color:#c2cee0; font-size:.83rem; line-height:1.6; }
|
|
#freeAccessProbe { font-size:.75rem; color:var(--gray); margin-top:10px; }
|
|
.how-to { padding-left:22px; color:#d7e3f5; line-height:1.7; font-size:.9rem; }
|
|
.how-to li { margin-bottom:10px; padding-left:4px; }
|
|
.step-label { color:#a7c2ff; font-size:.75rem; font-weight:700; margin-bottom:8px; }
|
|
.privacy { font-size:.8rem; line-height:1.7; color:#bac8db; }
|
|
.privacy summary { cursor:pointer; color:#dbe8ff; padding:12px 0; font-weight:600; }
|
|
.privacy p { margin-bottom:12px; }
|
|
.privacy a { color:#9cbeff; }
|
|
.payment-note { margin:16px 0; padding:14px; border:1px solid #f3bb5755; border-radius:14px; background:#30291d; }
|
|
.plan { padding:20px 16px; }
|
|
.btn { min-height:48px; border-radius:14px; }
|
|
#copyBtn { background:#568aff; color:#fff; border:0; flex:1 1 100%; }
|
|
#view-pay .row { flex-wrap:wrap; }
|
|
.pay-head p, .hint { line-height:1.7; }
|
|
.qr-panel { background:#fff; border-radius:20px; }
|
|
.copia { font-family:ui-monospace,monospace; font-size:.76rem; max-height:95px; overflow:auto; user-select:all; }
|
|
@media (max-width:360px) { .card { padding:18px; } .brand h1 { font-size:1.9rem; } }
|
|
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; } }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="wrap">
|
|
<header class="brand">
|
|
<img class="brand-logo" src="logo.png" alt="INCTG — Incorpore Technology Group" width="108" height="108">
|
|
<div>
|
|
<div class="eyebrow">INCTG · Wi-Fi para você</div>
|
|
<h1>Vamos conectar<br>seu Wi-Fi?</h1>
|
|
<p class="tagline" id="flowHelp">Primeiro, escolha por quanto tempo você quer usar a internet.</p>
|
|
<div class="journey" aria-label="Etapas"><span id="step-plans">1 · Escolher</span><span id="step-payer">2 · Preencher</span><span id="step-pay">3 · Pagar</span><span id="step-voucher">4 · Usar</span></div>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- ===== PLANOS ===== -->
|
|
<div class="card">
|
|
<div class="access-heading"><strong>Seu Wi-Fi</strong><span id="freeCountdown" class="countdown" role="timer" aria-label="Tempo restante"></span></div>
|
|
<p id="freeAccessMessage" role="status" aria-live="polite">Preparando seu acesso…</p>
|
|
<p id="freeAccessProbe" hidden></p>
|
|
<a id="wifiEntry" href="http://10.10.10.1/login" hidden>Abrir a entrada do Wi-Fi</a>
|
|
</div>
|
|
<main id="view-plans">
|
|
<div class="card">
|
|
<div class="step-label">PASSO 1 DE 4</div>
|
|
<div class="section-label">Escolha seu plano</div>
|
|
<div id="plans">
|
|
<div class="skel"></div><div class="skel"></div><div class="skel"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card" style="margin-top:14px">
|
|
<button class="btn btn-ghost" id="showLogin" type="button">Já tenho usuário e senha</button>
|
|
<div id="loginBox" class="hidden" style="margin-top:14px">
|
|
<label class="field">
|
|
<span>Usuário</span>
|
|
<input id="hsUser" type="text" autocomplete="username" autocapitalize="off" placeholder="Ex.: GAB12CD">
|
|
</label>
|
|
<label class="field">
|
|
<span>Senha</span>
|
|
<input id="hsPass" type="password" autocomplete="current-password" placeholder="Sua senha">
|
|
</label>
|
|
<button class="btn btn-primary" id="hsConnect" type="button">Conectar ao Wi-Fi</button>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<!-- ===== DADOS DO PAGADOR ===== -->
|
|
<section id="view-payer" class="card hidden" aria-labelledby="payerTitle">
|
|
<div class="pay-head">
|
|
<div class="step-label">PASSO 2 DE 4</div>
|
|
<h2 id="payerTitle">Quem vai pagar?</h2>
|
|
<p>Digite o nome e o e-mail de quem fará o pagamento.</p>
|
|
</div>
|
|
|
|
<label class="field">
|
|
<span>Nome completo</span>
|
|
<input id="payerName" type="text" autocomplete="name" maxlength="80" placeholder="Ex.: João da Silva">
|
|
</label>
|
|
|
|
<label class="field">
|
|
<span>E-mail</span>
|
|
<input id="payerEmail" type="email" autocomplete="email" inputmode="email" maxlength="120" placeholder="[email protected]">
|
|
</label>
|
|
|
|
<div class="row">
|
|
<button class="btn btn-ghost" id="payerBack" type="button">← Voltar</button>
|
|
<button class="btn btn-primary" id="payerNext" type="button">Gerar PIX</button>
|
|
</div>
|
|
<p class="hint" style="margin-top:16px">É menor de idade? Peça a um responsável para preencher os dados e fazer o pagamento. Veja abaixo como seus dados são usados.</p>
|
|
</section>
|
|
|
|
<!-- ===== PAGAMENTO ===== -->
|
|
<section id="view-pay" class="card hidden" aria-labelledby="payTitle">
|
|
<div class="pay-head">
|
|
<div class="step-label">PASSO 3 DE 4</div>
|
|
<h2 id="payTitle">Pague com PIX</h2>
|
|
<p>Faça assim:</p>
|
|
</div>
|
|
|
|
<ol class="how-to">
|
|
<li>Toque em <strong>Copiar código PIX</strong>.</li>
|
|
<li>Abra o aplicativo do seu banco.</li>
|
|
<li>Escolha <strong>PIX → Copia e Cola</strong>, cole o código e confirme o pagamento.</li>
|
|
<li>Pronto! Quando o pagamento for confirmado, seu plano começa automaticamente.</li>
|
|
</ol>
|
|
<div class="payment-note"><p id="accessRules" class="access-rules">Ao copiar, você terá 2 minutos de internet para pagar. Se o prazo acabar sem confirmação do pagamento, a internet para. Uma nova tentativa só será possível 45 minutos depois.</p><p class="access-rules" style="margin-top:8px">A janela pode fechar depois da cópia. Tudo bem: abra seu banco e cole o código.</p></div>
|
|
|
|
<div class="qr-panel">
|
|
<img id="qrImg" alt="QR Code do pagamento PIX">
|
|
</div>
|
|
|
|
<div class="copia" id="copiaCola" title="Código copia e cola"></div>
|
|
|
|
<div class="row">
|
|
<button class="btn btn-ghost" id="copyBtn" type="button">Copiar código PIX</button>
|
|
<button class="btn btn-primary" id="checkBtn" type="button">Já paguei</button>
|
|
</div>
|
|
|
|
<div class="pill waiting" id="payPill" role="status" aria-live="polite">
|
|
<span class="dot"></span><span id="payPillText">Aguardando pagamento…</span>
|
|
</div>
|
|
|
|
<div class="mp-badge">
|
|
<svg width="18" height="18" viewBox="0 0 24 24" aria-hidden="true">
|
|
<path fill="#009EE3" d="M12 2L3 6v6c0 5 3.8 9.4 9 10 5.2-.6 9-5 9-10V6l-9-4z"/>
|
|
<path fill="#00B1EA" d="M12 4.2L5 7.3v4.7c0 3.9 2.9 7.4 7 8 4.1-.6 7-4.1 7-8V7.3l-7-3.1z" opacity=".5"/>
|
|
</svg>
|
|
<span>Pagamento processado com segurança por <strong>Mercado Pago</strong></span>
|
|
</div>
|
|
|
|
<a class="back" href="#" id="backBtn">← Voltar aos planos</a>
|
|
</section>
|
|
|
|
<!-- ===== VOUCHER ===== -->
|
|
<section id="view-voucher" class="card voucher-view hidden" aria-labelledby="vTitle">
|
|
<div class="check" aria-hidden="true">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="#12B886" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round">
|
|
<polyline points="20 6 9 17 4 12"></polyline>
|
|
</svg>
|
|
</div>
|
|
<div class="step-label">PASSO 4 DE 4</div>
|
|
<h2 id="vTitle">Tudo pronto!</h2>
|
|
<p class="hint" id="paidConnectionMessage">Conectando seu aparelho ao plano comprado…</p>
|
|
|
|
<div class="code-box">
|
|
<div class="lbl">Usuário</div>
|
|
<div class="val" id="vUser">—</div>
|
|
</div>
|
|
<div class="code-box">
|
|
<div class="lbl">Senha</div>
|
|
<div class="val" id="vPass">—</div>
|
|
</div>
|
|
|
|
<ol class="steps">
|
|
<li>Seu pagamento foi confirmado</li>
|
|
<li>Mantenha o aparelho na rede <strong id="ssidLabel">Wi-Fi</strong></li>
|
|
<li>A conexão muda automaticamente para o plano comprado</li>
|
|
</ol>
|
|
|
|
<button class="btn btn-success" id="hsAutoLogin" type="button" style="margin-top:14px">Conectar agora</button>
|
|
<button class="btn btn-ghost" id="copyVoucher" type="button" style="margin-top:10px">Copiar usuário e senha</button>
|
|
<a class="back" href="#" id="backBtn2">← Voltar aos planos</a>
|
|
</section>
|
|
|
|
<details class="card privacy" id="privacyNotice">
|
|
<summary>Seus dados e sua privacidade (LGPD)</summary>
|
|
<p><strong>Responsável pelo Wi-Fi:</strong> <span id="privacyController">Procure o responsável por esta rede no local.</span><br><strong>Fale sobre seus dados:</strong> <span id="privacyContact">Solicite o contato ao responsável pelo Wi-Fi.</span></p>
|
|
<p>Usamos nome e e-mail de quem paga para criar o PIX no Mercado Pago. O identificador do aparelho (MAC), o plano, o valor, os horários e a situação do pagamento são usados para conectar o Wi-Fi e evitar uso indevido.</p>
|
|
<p>O Mercado Pago recebe os dados necessários ao pagamento e pode coletar informações do dispositivo para segurança e prevenção de fraude. Você paga dentro do aplicativo do seu banco. Este portal não pede sua senha do banco.</p>
|
|
<p>Para verificar se a internet funciona, seu navegador pode consultar Google e Apple. Essas consultas usam os dados normais de uma conexão, como o endereço IP. O portal não envia seu nome, e-mail, código PIX ou identificador MAC nesses testes.</p>
|
|
<p>O navegador guarda os dados do PIX nesta sessão para você continuar de onde parou. Os registros de compra e acesso ficam no sistema da rede para operar o serviço, atender solicitações e cumprir obrigações aplicáveis.</p>
|
|
<p><strong>Por quanto tempo guardamos:</strong> <span id="privacyRetention">Peça ao responsável pelo Wi-Fi os prazos aplicáveis a cada tipo de registro.</span></p>
|
|
<p>Você pode pedir informações sobre seus dados, acesso, correção e exclusão quando cabível. Procure o responsável pelo Wi-Fi neste local para exercer esses direitos e saber os prazos de guarda. A LGPD não exige apagar registros que precisam ser mantidos por obrigação legal.</p>
|
|
<p>Crianças e adolescentes: os dados devem ser tratados respeitando seu melhor interesse. Peça ajuda a um responsável para a compra; este aviso não substitui os cuidados e autorizações que forem necessários.</p>
|
|
<p><a href="https://www.gov.br/anpd/pt-br/assuntos/titular-de-dados/direito-dos-titulares" target="_blank" rel="noopener noreferrer">Conheça seus direitos na ANPD</a> · <a href="https://www.mercadopago.com.br/privacidade" target="_blank" rel="noopener noreferrer">Privacidade do Mercado Pago</a></p>
|
|
</details>
|
|
<footer>
|
|
<strong>INCTG</strong> — Incorpore Technology Group<br>
|
|
Tecnologia que resolve.
|
|
</footer>
|
|
</div>
|
|
|
|
<div class="toast" id="toast" role="status" aria-live="polite"></div>
|
|
|
|
<script>
|
|
const mac = new URLSearchParams(location.search).get('mac') || '';
|
|
let currentPaymentId = null;
|
|
let pollTimer = null;
|
|
let toastTimer = null;
|
|
let selectedPlanId = null;
|
|
let mpDevice = null;
|
|
let checkoutBusy = false;
|
|
let freeSeconds = 120;
|
|
let freeCooldownSeconds = 2700;
|
|
|
|
function durationLabel(seconds) {
|
|
return seconds % 60 === 0 ? (seconds / 60) + (seconds === 60 ? ' minuto' : ' minutos') : seconds + (seconds === 1 ? ' segundo' : ' segundos');
|
|
}
|
|
function renderAccessRules() {
|
|
$('accessRules').textContent = 'Ao tocar em “Copiar código PIX”, você terá ' + durationLabel(freeSeconds) + ' de internet para pagar. Se o prazo acabar sem confirmação do pagamento, a internet para. Uma nova tentativa só será possível ' + durationLabel(freeCooldownSeconds) + ' após o fim desse prazo. Pagamento confirmado? Seu plano começa automaticamente.';
|
|
}
|
|
|
|
const $ = (id) => document.getElementById(id);
|
|
|
|
// ===== Mercado Pago SDK V2 + Device ID =====
|
|
async function initMpSdk() {
|
|
try {
|
|
const res = await fetch('/api/mp/public-key');
|
|
const { publicKey } = await res.json();
|
|
if (publicKey && window.MercadoPago) {
|
|
const mp = new window.MercadoPago(publicKey);
|
|
if (typeof mp.getId === 'function') {
|
|
mpDevice = await Promise.resolve(mp.getId()).catch(() => null);
|
|
}
|
|
}
|
|
} catch { /* segue sem device id */ }
|
|
}
|
|
window.addEventListener('load', initMpSdk);
|
|
|
|
function deviceId() {
|
|
return mpDevice || window.MP_DEVICE_SESSION_ID || null;
|
|
}
|
|
|
|
function toast(msg) {
|
|
const t = $('toast');
|
|
t.textContent = msg;
|
|
t.classList.add('show');
|
|
clearTimeout(toastTimer);
|
|
toastTimer = setTimeout(() => t.classList.remove('show'), 2200);
|
|
}
|
|
|
|
async function copy(text, msg) {
|
|
try {
|
|
await navigator.clipboard.writeText(text);
|
|
} catch {
|
|
const ta = document.createElement('textarea');
|
|
ta.value = text;
|
|
document.body.appendChild(ta);
|
|
ta.select();
|
|
try {
|
|
if (!document.execCommand('copy')) throw new Error('Clipboard unavailable');
|
|
} catch {
|
|
toast('Não foi possível copiar. Selecione e copie o código manualmente.');
|
|
return false;
|
|
} finally { ta.remove(); }
|
|
}
|
|
toast(msg || 'Copiado!');
|
|
return true;
|
|
}
|
|
|
|
function show(view) {
|
|
const help = {plans:'Escolha por quanto tempo você quer usar a internet.',payer:'Preencha os dados de quem vai pagar.',pay:'Copie o código, abra seu banco e pague com PIX.',voucher:'Seu pagamento foi confirmado. Agora é só navegar.'};
|
|
$('flowHelp').textContent = help[view];
|
|
for (const step of ['plans','payer','pay','voucher']) {
|
|
if (step === view) $('step-' + step).setAttribute('aria-current','step');
|
|
else $('step-' + step).removeAttribute('aria-current');
|
|
$('step-' + step).style.background = step === view ? '#244b8c' : '';
|
|
}
|
|
$('view-plans').classList.toggle('hidden', view !== 'plans');
|
|
$('view-payer').classList.toggle('hidden', view !== 'payer');
|
|
$('view-pay').classList.toggle('hidden', view !== 'pay');
|
|
$('view-voucher').classList.toggle('hidden', view !== 'voucher');
|
|
if (view !== 'pay' && pollTimer) { clearInterval(pollTimer); pollTimer = null; }
|
|
|
|
window.scrollTo({ top: 0, behavior: 'instant' in window ? 'auto' : 'auto' });
|
|
}
|
|
|
|
function money(v) {
|
|
return 'R$ ' + v.toFixed(2).replace('.', ',');
|
|
}
|
|
|
|
async function loadPlans() {
|
|
try {
|
|
const res = await fetch('/api/plans');
|
|
const plans = await res.json();
|
|
const box = $('plans');
|
|
if (!plans.length) {
|
|
box.innerHTML = '<div class="empty">Nenhum plano disponível no momento.</div>';
|
|
return;
|
|
}
|
|
box.innerHTML = '';
|
|
for (const p of plans) {
|
|
const btn = document.createElement('button');
|
|
btn.type = 'button';
|
|
btn.className = 'plan';
|
|
btn.innerHTML =
|
|
'<div class="plan-info"><h3></h3><div class="plan-meta"></div></div>' +
|
|
'<div class="plan-price"></div>';
|
|
btn.querySelector('h3').textContent = p.name;
|
|
btn.querySelector('.plan-meta').textContent = p.speed + ' · validade ' + p.uptime;
|
|
btn.querySelector('.plan-price').textContent = money(p.price);
|
|
btn.addEventListener('click', () => { selectedPlanId = p.id; show('payer'); });
|
|
box.appendChild(btn);
|
|
}
|
|
} catch {
|
|
$('plans').innerHTML = '<div class="empty">Não foi possível carregar os planos. Recarregue a página.</div>';
|
|
}
|
|
}
|
|
|
|
async function checkout(planId) {
|
|
if (checkoutBusy) return;
|
|
checkoutBusy = true;
|
|
$('payerNext').disabled = true;
|
|
try {
|
|
const payerName = $('payerName').value.trim();
|
|
const payerEmail = $('payerEmail').value.trim();
|
|
if (payerName.length < 3) { toast('Informe seu nome completo'); show('payer'); return; }
|
|
if (!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(payerEmail)) { toast('Informe um e-mail válido'); show('payer'); return; }
|
|
|
|
const res = await fetch('/api/checkout', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ planId, mac, payerName, payerEmail, deviceId: deviceId() }),
|
|
});
|
|
const data = await res.json();
|
|
if (data.error) throw new Error(data.error);
|
|
|
|
currentPaymentId = data.paymentId;
|
|
sessionStorage.setItem('paymentId', currentPaymentId);
|
|
sessionStorage.setItem('pendingPix', JSON.stringify(data));
|
|
$('payTitle').textContent = data.planName + ' · ' + money(data.price);
|
|
$('qrImg').src = data.qrCodeBase64 ? 'data:image/png;base64,' + data.qrCodeBase64 : '';
|
|
$('copiaCola').textContent = data.copiaCola || '';
|
|
setPill('waiting', 'Aguardando pagamento…');
|
|
show('pay');
|
|
|
|
clearInterval(pollTimer);
|
|
pollTimer = setInterval(verify, 6000);
|
|
$('freeAccessMessage').textContent = 'PIX pronto. Agora toque em “Copiar código PIX”. Depois, abra o banco e cole o código.';
|
|
} catch (e) {
|
|
toast('Erro: ' + e.message);
|
|
} finally {
|
|
checkoutBusy = false;
|
|
$('payerNext').disabled = false;
|
|
}
|
|
}
|
|
|
|
function setPill(state, text) {
|
|
const pill = $('payPill');
|
|
pill.className = 'pill ' + state;
|
|
$('payPillText').textContent = text;
|
|
}
|
|
|
|
async function verify() {
|
|
if (!currentPaymentId) return;
|
|
const btn = $('checkBtn');
|
|
btn.disabled = true;
|
|
try {
|
|
const res = await fetch('/api/status/' + encodeURIComponent(currentPaymentId));
|
|
if (!res.ok) throw new Error('Falha na consulta');
|
|
const data = await res.json();
|
|
if (data.status === 'paid' && data.voucher) {
|
|
sessionStorage.removeItem('pendingPix');
|
|
clearInterval(window.freeAccessTimer);
|
|
const connected = data.connection?.state === 'active';
|
|
$('hsAutoLogin').hidden = connected;
|
|
$('freeAccessMessage').textContent = connected ? 'Pagamento confirmado. Seu plano está conectado. Boa navegação!' : 'Pagamento confirmado. Estamos conectando seu aparelho ao plano comprado.';
|
|
$('paidConnectionMessage').textContent = connected ? 'Seu plano está ativo neste aparelho. Você já pode navegar.' : 'Ativando sua conexão automaticamente. Se necessário, use “Conectar agora”.';
|
|
$('freeCountdown').textContent = connected ? 'Conectado' : 'Ativando';
|
|
clearInterval(pollTimer); pollTimer = null;
|
|
$('vUser').textContent = data.voucher.user;
|
|
$('vPass').textContent = data.voucher.pass;
|
|
setPill('ok', 'Pagamento aprovado');
|
|
show('voucher');
|
|
if (!connected) pollTimer = setInterval(verify, 6000);
|
|
return;
|
|
}
|
|
if (['rejected', 'cancelled', 'expired'].includes(data.status)) {
|
|
setPill('err', 'Pagamento não aprovado. Tente novamente.');
|
|
clearInterval(pollTimer); pollTimer = null;
|
|
} else {
|
|
setPill('waiting', 'Aguardando pagamento…');
|
|
}
|
|
} catch {
|
|
setPill('err', 'Falha ao verificar. Toque em "Já paguei".');
|
|
} finally {
|
|
btn.disabled = false;
|
|
}
|
|
}
|
|
|
|
$('checkBtn').addEventListener('click', verify);
|
|
$('copyBtn').addEventListener('click', async () => {
|
|
const button = $('copyBtn');
|
|
if (button.disabled) return;
|
|
const code = $('copiaCola').textContent.trim();
|
|
if (!code) { toast('O código PIX ainda não está disponível.'); return; }
|
|
if (!/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/i.test(mac)) { await startFreeAccess(); return; }
|
|
button.disabled = true;
|
|
try {
|
|
if (await copy(code, 'PIX copiado. Abra o banco e cole o código.')) await startFreeAccess();
|
|
} finally { button.disabled = false; }
|
|
});
|
|
$('copyVoucher').addEventListener('click', () =>
|
|
copy('Usuário: ' + $('vUser').textContent + '\nSenha: ' + $('vPass').textContent, 'Credenciais copiadas')
|
|
);
|
|
$('backBtn').addEventListener('click', (e) => { e.preventDefault(); show('plans'); });
|
|
$('backBtn2').addEventListener('click', (e) => { e.preventDefault(); show('plans'); });
|
|
$('payerBack').addEventListener('click', () => show('plans'));
|
|
$('payerNext').addEventListener('click', () => checkout(selectedPlanId));
|
|
|
|
// ===== Login no hotspot (voucher) =====
|
|
let HS_LOGIN = 'http://10.10.10.1/login';
|
|
|
|
function hsUrl(user, pass) {
|
|
return HS_LOGIN + '?username=' + encodeURIComponent(user) + '&password=' + encodeURIComponent(pass);
|
|
}
|
|
|
|
$('showLogin').addEventListener('click', () => {
|
|
$('loginBox').classList.toggle('hidden');
|
|
});
|
|
|
|
$('hsConnect').addEventListener('click', () => {
|
|
const u = $('hsUser').value.trim();
|
|
const p = $('hsPass').value;
|
|
if (!u || !p) { toast('Informe usuário e senha'); return; }
|
|
hotspotLogin(u, p);
|
|
});
|
|
|
|
$('hsAutoLogin').addEventListener('click', () => {
|
|
hotspotLogin($('vUser').textContent, $('vPass').textContent);
|
|
});
|
|
|
|
function hotspotLogin(user, pass, destination) {
|
|
const form = document.createElement('form');
|
|
form.method = 'POST'; form.action = HS_LOGIN;
|
|
for (const [name, value] of Object.entries({ username: user, password: pass, ...(destination ? { dst: destination } : {}) })) {
|
|
const field = document.createElement('input'); field.type = 'hidden'; field.name = name; field.value = value; form.append(field);
|
|
}
|
|
document.body.append(form); form.submit();
|
|
}
|
|
|
|
// ===== Internet temporaria para pagar (login automatico no hotspot) =====
|
|
async function startFreeAccess() {
|
|
const message = $('freeAccessMessage');
|
|
if (!/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/i.test(mac)) {
|
|
message.textContent = 'Para liberar internet temporária, conecte ao Wi-Fi de convidados e abra o portal pela tela de entrada da rede.';
|
|
$('wifiEntry').hidden = false;
|
|
return;
|
|
}
|
|
message.textContent = 'Preparando acesso temporário para abrir o aplicativo do banco…';
|
|
try {
|
|
const res = await fetch('/api/access/start', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ mac }),
|
|
});
|
|
const d = await res.json();
|
|
if (!res.ok) {
|
|
message.textContent = res.status === 429 ? d.error + (d.retryAfterSeconds ? ' Nova liberação em aproximadamente ' + Math.ceil(d.retryAfterSeconds / 60) + ' minutos.' : '') : 'Não foi possível liberar a internet temporária. Tente novamente ou consulte o responsável pela rede.';
|
|
return;
|
|
}
|
|
if (d.authenticated) {
|
|
// Captive-portal assistants re-evaluate the network on top-level navigation.
|
|
// An API login plus a DOM update leaves some phones using the captive state.
|
|
// Navigate once per server window; reloading must never extend its deadline.
|
|
if (Number.isFinite(d.expiresAt) && d.expiresAt > Date.now() &&
|
|
sessionStorage.getItem('freeAccessConfirmedUntil') !== String(d.expiresAt)) {
|
|
sessionStorage.setItem('freeAccessConfirmedUntil', String(d.expiresAt));
|
|
const target = new URL(location.href);
|
|
target.searchParams.set('mac', mac);
|
|
target.searchParams.set('free', '1');
|
|
target.searchParams.set('access', String(d.expiresAt));
|
|
message.textContent = 'Acesso autorizado. Atualizando a conexão deste aparelho…';
|
|
window.location.replace(target.href);
|
|
return;
|
|
}
|
|
if (d.probeToken) verifyClientInternet(d.probeToken);
|
|
sessionStorage.removeItem('freeLoginAttemptUntil');
|
|
clearInterval(window.freeAccessTimer);
|
|
const deadline = Date.now() + d.seconds * 1000;
|
|
const update = () => {
|
|
const seconds = Math.max(0, Math.ceil((deadline - Date.now()) / 1000));
|
|
$('freeCountdown').textContent = Math.floor(seconds / 60) + ':' + String(seconds % 60).padStart(2, '0');
|
|
message.textContent = seconds ? 'Sessão temporária confirmada: ' + seconds + ' segundos para efetuar o pagamento.' : 'O acesso temporário terminou. Se já pagou, toque em “Já paguei”.';
|
|
if (!seconds) message.textContent += ' Para solicitar mais tempo, aguarde ' + durationLabel(freeCooldownSeconds) + '. O pagamento confirmado ativa o plano automaticamente.';
|
|
if (!seconds) clearInterval(window.freeAccessTimer);
|
|
};
|
|
update(); window.freeAccessTimer = setInterval(update, 1000);
|
|
return;
|
|
}
|
|
message.textContent = 'O MikroTik ainda não confirmou o acesso. Tentando autenticar pela tela do hotspot…';
|
|
if (d.loginUrl && Number(sessionStorage.getItem('freeLoginAttemptUntil') || 0) < Date.now()) {
|
|
sessionStorage.setItem('freeLoginAttemptUntil', String(Date.now() + d.seconds * 1000));
|
|
const target = new URL(d.loginUrl);
|
|
hotspotLogin(target.searchParams.get('username'), target.searchParams.get('password'), target.searchParams.get('dst'));
|
|
}
|
|
} catch {
|
|
message.textContent = 'Não conseguimos conectar agora. Toque novamente em “Copiar código PIX” para tentar de novo.';
|
|
}
|
|
}
|
|
|
|
async function verifyClientInternet(token) {
|
|
const label = $('freeAccessProbe');
|
|
label.hidden = false;
|
|
label.textContent = 'Verificando o acesso a serviços externos neste aparelho…';
|
|
const results = await Promise.all([
|
|
['google', 'https://www.gstatic.com/generate_204'],
|
|
['apple', 'https://www.apple.com/library/test/success.html'],
|
|
].map(async ([provider, url]) => {
|
|
const controller = new AbortController();
|
|
const timer = setTimeout(() => controller.abort(), 6000);
|
|
try {
|
|
const response = await fetch(url + '?_=' + Date.now(), { mode: 'no-cors', cache: 'no-store', redirect: 'follow', credentials: 'omit', signal: controller.signal });
|
|
return { provider, ok: response.type === 'opaque' || response.ok };
|
|
} catch { return { provider, ok: false }; }
|
|
finally { clearTimeout(timer); }
|
|
}));
|
|
label.textContent = results.some(r => r.ok) ? 'Este aparelho alcançou um serviço externo. Você pode abrir o aplicativo do banco.' : 'A sessão está ativa, mas não foi possível confirmar o acesso externo. Verifique se o aplicativo do banco abre.';
|
|
try { await fetch('/api/access/report', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ mac, token, results }) }); } catch { /* report is optional */ }
|
|
}
|
|
|
|
async function loadSiteConfig() {
|
|
try {
|
|
const res = await fetch('/api/config');
|
|
const d = await res.json();
|
|
if (Number.isInteger(d.freeSeconds) && d.freeSeconds > 0) freeSeconds = d.freeSeconds;
|
|
if (Number.isInteger(d.freeCooldownSeconds) && d.freeCooldownSeconds >= 2700) freeCooldownSeconds = d.freeCooldownSeconds;
|
|
renderAccessRules();
|
|
if (typeof d.privacy?.controller === 'string' && d.privacy.controller.trim()) $('privacyController').textContent = d.privacy.controller;
|
|
if (typeof d.privacy?.contact === 'string' && d.privacy.contact.trim()) $('privacyContact').textContent = d.privacy.contact;
|
|
if (typeof d.privacy?.retention === 'string' && d.privacy.retention.trim()) $('privacyRetention').textContent = d.privacy.retention;
|
|
if (d.ssid) $('ssidLabel').textContent = d.ssid;
|
|
if (/^(?:\d{1,3}\.){3}\d{1,3}$/.test(d.hotspotIp)) HS_LOGIN = 'http://' + d.hotspotIp + '/login';
|
|
$('wifiEntry').href = HS_LOGIN;
|
|
} catch { /* usa padrao */ }
|
|
}
|
|
|
|
loadSiteConfig().then(() => {
|
|
const pendingPix = sessionStorage.getItem('pendingPix');
|
|
const returningFromAccess = new URLSearchParams(location.search).get('free') === '1' &&
|
|
(!pendingPix || Number(sessionStorage.getItem('freeAccessConfirmedUntil') || 0) > Date.now() ||
|
|
Number(sessionStorage.getItem('freeLoginAttemptUntil') || 0) > Date.now());
|
|
if (!/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/i.test(mac) || returningFromAccess) startFreeAccess();
|
|
else {
|
|
$('freeAccessMessage').textContent = pendingPix ? 'Seu PIX está aqui. Toque em “Copiar código PIX” e siga os passos.' : 'Vamos começar? Escolha um plano abaixo.';
|
|
}
|
|
});
|
|
show('plans');
|
|
loadPlans();
|
|
if (sessionStorage.getItem('paymentId')) {
|
|
currentPaymentId = sessionStorage.getItem('paymentId');
|
|
try {
|
|
const pending = JSON.parse(sessionStorage.getItem('pendingPix') || 'null');
|
|
if (pending?.paymentId === currentPaymentId) {
|
|
$('payTitle').textContent = pending.planName + ' · ' + money(pending.price);
|
|
$('qrImg').src = pending.qrCodeBase64 ? 'data:image/png;base64,' + pending.qrCodeBase64 : '';
|
|
$('copiaCola').textContent = pending.copiaCola || '';
|
|
show('pay');
|
|
pollTimer = setInterval(verify, 6000);
|
|
}
|
|
} catch { sessionStorage.removeItem('pendingPix'); }
|
|
verify();
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|