feat(waitlist): SMS or email signup, motion, portrait reel, contact footer

- Hero toggle: SMS (default, international picker) or Email; step 2 asks only the name
- Apps Script accepts either contact, dedupes on email or phone (checks updated)
- Headline words rise in, sections and course photos reveal on scroll, hero photos drift
- Portrait reel under the hero; courses swipe on phones; Why us as big numbers on hairlines
- Footer: landing-style card with Contact us (Telegram, phone, email), credits, Powered by Yaltopia Tech

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kirukib 2026-10-20 14:20:33 +03:00
parent 4a3561bcb5
commit 270d36a237
3 changed files with 166 additions and 41 deletions

View File

@ -166,7 +166,76 @@
footer a { text-decoration: none; }
footer a:hover { color: var(--ink); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .card { opacity: 1; } html { scroll-behavior: auto; } }
/* ---------- SMS / email toggle: SMS first, since most people here live on their phone ---------- */
.seg { display: flex; width: max-content; gap: 4px; padding: 4px; margin: 0 auto 10px; border-radius: 999px; background: var(--field); border: 1px solid var(--line); }
.seg button { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 18px; border: 0; border-radius: 999px; background: none; color: var(--ink-3); font-weight: 600; font-size: 14px; cursor: pointer; transition: background 220ms var(--ease-out), color 220ms; }
.seg button[aria-selected="true"] { background: #fff; color: #0A0A0A; }
.bar .tel { flex: 1; min-width: 0; min-height: 48px; border: 0; background: none; }
.bar .tel input { height: 48px; }
.bar .cc { margin-left: 2px; }
.bar [hidden] { display: none !important; }
.more { grid-template-columns: 1fr; }
/* ---------- motion: headline words rise, then the rest; sections reveal on scroll ---------- */
h1 .w { display: inline-block; opacity: 0; animation: rise 900ms var(--ease-out) forwards; animation-delay: calc(var(--i) * 80ms + 200ms); }
.pitch > .proof, .pitch > .lead, .pitch > .join { opacity: 0; animation: rise 800ms var(--ease-out) forwards; }
.pitch > .proof { animation-delay: 80ms; } .pitch > .lead { animation-delay: 620ms; } .pitch > .join { animation-delay: 760ms; }
.collage { transform: translateY(var(--py, 0px)); }
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 900ms var(--ease-out), transform 1000ms var(--ease-out); transition-delay: var(--rd, 0ms); }
.reveal.in { opacity: 1; transform: none; }
.looks li.reveal img { transform: scale(1.18); transition: transform 1600ms var(--ease-out); transition-delay: var(--rd, 0ms); }
.looks li.in img { transform: scale(1); }
.looks li.in:hover img { transform: scale(1.05); transition-duration: 700ms; transition-delay: 0ms; }
.cta img { transform: scale(1.12); transition: transform 2400ms var(--ease-out); }
.cta.in img { transform: scale(1); }
/* ---------- portrait reel under the hero ---------- */
.reel { overflow: hidden; padding: 8px 0; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.reel > div { display: flex; gap: 12px; width: max-content; animation: reel 60s linear infinite; }
.reel:hover > div { animation-play-state: paused; }
.reel img { width: 190px; height: 250px; object-fit: cover; object-position: center 22%; border-radius: 18px; filter: grayscale(.4) brightness(.85); transition: filter 500ms var(--ease-out), transform 500ms var(--ease-out); }
.reel img:nth-child(even) { margin-top: 28px; }
.reel img:hover { filter: none; transform: translateY(-4px); }
@keyframes reel { to { transform: translateX(calc(-50% - 6px)); } }
@media (max-width: 760px) { .reel img { width: 120px; height: 160px; border-radius: 14px; } .reel img:nth-child(even) { margin-top: 18px; } }
/* courses swipe on phones */
@media (max-width: 520px) { .looks { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 78%; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: -24px; padding-inline: 24px; scroll-padding-inline: 24px; scrollbar-width: none; } .looks::-webkit-scrollbar { display: none; } .looks li { scroll-snap-align: start; } }
/* why us: big numbers on hairlines instead of three boxes */
.why { gap: 0; border-top: 1px solid var(--line); }
.why > div { background: none; border: 0; border-radius: 0; padding: 28px 24px 8px 0; }
.why > div + div { border-left: 1px solid var(--line); padding-left: 24px; }
.why .n { font-size: clamp(48px, 6vw, 80px); font-weight: 700; letter-spacing: -.05em; color: var(--ink); margin-bottom: 18px; }
@media (max-width: 760px) { .why > div, .why > div + div { border-left: 0; padding: 24px 0; border-bottom: 1px solid var(--line); } }
/* ---------- footer: landing-page card, contact block, credits, powered-by ---------- */
.foot { padding: clamp(72px, 9vw, 120px) 0 24px; }
.foot-card { display: grid; gap: 32px; padding: clamp(24px, 4vw, 48px); border-radius: 28px; background: var(--raise); border: 1px solid #1F1F1F; }
@media (min-width: 760px) { .foot-card { grid-template-columns: 1.3fr 1fr; align-items: end; } }
.foot-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.foot-brand img { width: min(100%, 340px); filter: invert(1); }
.foot-brand p { margin: 0; color: var(--ink-2); font-size: 17px; }
.foot-contact { display: flex; flex-direction: column; }
.foot-contact h3 { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.foot-contact a { display: flex; align-items: center; gap: 12px; min-height: 56px; border-bottom: 1px solid var(--line); text-decoration: none; font-weight: 600; overflow-wrap: anywhere; transition: padding 240ms var(--ease-out), color 160ms; }
.foot-contact a:hover { padding-left: 6px; }
.foot-contact a span { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #222; color: var(--ink-2); }
.foot-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 24px 4px 0; font-size: 13px; color: var(--ink-3); }
.foot-bar summary { padding: 0; font-size: 13px; font-weight: 500; display: inline; }
.foot-bar details { border: 0; } .foot-bar details p { padding: 8px 0 0; font-size: 13px; color: var(--ink-3); }
.foot-bar a { text-decoration: none; } .foot-bar a:hover { color: var(--ink); }
.powered { text-align: center; font-size: 12px; color: var(--ink-3); margin: 24px 0 0; letter-spacing: .04em; }
.shine { font-weight: 700; text-decoration: none; color: transparent; background: linear-gradient(110deg, var(--ink-2) 40%, #fff 50%, var(--ink-2) 60%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; animation: shine 3.2s linear infinite; }
@keyframes shine { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation: none !important; transition: none !important; }
.card, h1 .w, .pitch > *, .reveal { opacity: 1 !important; transform: none !important; }
.looks li img, .cta img, .collage { transform: none !important; }
.shine { color: var(--ink); background: none; }
html { scroll-behavior: auto; }
}
</style>
</head>
<body>
@ -197,24 +266,28 @@
<span class="live" aria-hidden="true"></span>
<span id="waiting" aria-live="polite">Be one of the first on the list</span>
</span>
<h1>Your <em>signature look</em> starts here.</h1>
<h1><span class="w" style="--i:0">Your</span> <em><span class="w" style="--i:1">signature</span> <span class="w" style="--i:2">look</span></em> <span class="w" style="--i:3">starts</span> <span class="w" style="--i:4">here.</span></h1>
<p class="lead">Video makeup courses from working Ethiopian artists. Join the waitlist and we'll tell you the day classes open.</p>
<div class="join" id="join">
<form id="form" novalidate>
<label class="sr-only" aria-hidden="true">Company<input id="company" name="company" tabindex="-1" autocomplete="off" /></label>
<div class="seg" role="radiogroup" aria-label="How should we reach you?">
<button type="button" role="radio" aria-selected="true" aria-checked="true" data-ch="sms"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="6" y="2" width="12" height="20" rx="3"/><path d="M11 18h2"/></svg>SMS</button>
<button type="button" role="radio" aria-selected="false" aria-checked="false" data-ch="email"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18v12H3zM3 7l9 6 9-6"/></svg>Email</button>
</div>
<div class="more" id="more" hidden>
<label class="sr-only" for="name">Full name</label>
<input id="name" name="name" autocomplete="name" placeholder="Full name" required maxlength="80" />
<div class="tel">
<label class="cc"><span class="sr-only">Country code</span><span class="flag" id="ccFlag" aria-hidden="true"></span><span id="ccDial" aria-hidden="true"></span><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg><select id="cc" autocomplete="tel-country-code"></select></label>
<label class="sr-only" for="phone">Phone number</label>
<input id="phone" name="phone" type="tel" autocomplete="tel-national" inputmode="tel" placeholder="911 234 567" required maxlength="20" />
</div>
</div>
<div class="bar">
<div class="tel" id="telWrap">
<label class="cc"><span class="sr-only">Country code</span><span class="flag" id="ccFlag" aria-hidden="true"></span><span id="ccDial" aria-hidden="true"></span><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg><select id="cc" autocomplete="tel-country-code"></select></label>
<label class="sr-only" for="phone">Phone number</label>
<input id="phone" name="phone" type="tel" autocomplete="tel-national" inputmode="tel" placeholder="911 234 567" maxlength="20" />
</div>
<label class="sr-only" for="email">Email</label>
<input id="email" name="email" type="email" autocomplete="email" placeholder="Enter your email" required maxlength="120" />
<input id="email" name="email" type="email" autocomplete="email" placeholder="Enter your email" maxlength="120" hidden />
<button class="btn" id="submit">Join waitlist</button>
</div>
<p class="err" id="err" role="alert"></p>
@ -224,23 +297,25 @@
</div>
</section>
<div class="reel" aria-hidden="true"><div><img src="/photos/habesha-tigray.jpg" alt="" loading="lazy" /><img src="/photos/hero.jpg" alt="" loading="lazy" /><img src="/photos/habesha-harari.jpg" alt="" loading="lazy" /><img src="/photos/habesha-eritrean.jpg" alt="" loading="lazy" /><img src="/photos/habesha-bride.jpg" alt="" loading="lazy" /><img src="/photos/habesha-trad.jpg" alt="" loading="lazy" /><img src="/photos/bridal.jpg" alt="" loading="lazy" /><img src="/photos/glam.jpg" alt="" loading="lazy" /><img src="/photos/foundations.jpg" alt="" loading="lazy" /><img src="/photos/clients.jpg" alt="" loading="lazy" /><img src="/photos/habesha-tigray.jpg" alt="" loading="lazy" /><img src="/photos/hero.jpg" alt="" loading="lazy" /><img src="/photos/habesha-harari.jpg" alt="" loading="lazy" /><img src="/photos/habesha-eritrean.jpg" alt="" loading="lazy" /><img src="/photos/habesha-bride.jpg" alt="" loading="lazy" /><img src="/photos/habesha-trad.jpg" alt="" loading="lazy" /><img src="/photos/bridal.jpg" alt="" loading="lazy" /><img src="/photos/glam.jpg" alt="" loading="lazy" /><img src="/photos/foundations.jpg" alt="" loading="lazy" /><img src="/photos/clients.jpg" alt="" loading="lazy" /></div></div>
<div class="wrap">
<section class="block" id="courses">
<p class="kicker">At launch</p>
<h2>Four courses, <em>one craft</em></h2>
<p class="kicker reveal">At launch</p>
<h2 class="reveal">Four courses, <em>one craft</em></h2>
<p class="sub">Start with the basics, or go straight to the looks clients book you for.</p>
<ul class="looks">
<li><img src="/photos/hero.jpg" alt="" loading="lazy" /><div><strong>Makeup foundations</strong><span>Skin tone, base and color</span></div></li>
<li><img src="/photos/habesha-harari.jpg" alt="" loading="lazy" /><div><strong>Bridal &amp; events</strong><span>Looks that last a 14-hour day</span></div></li>
<li><img src="/photos/habesha-eritrean.jpg" alt="" loading="lazy" /><div><strong>Skin prep &amp; care</strong><span>The canvas before the color</span></div></li>
<li><img src="/photos/habesha-trad.jpg" alt="" loading="lazy" /><div><strong>Building your clientele</strong><span>Pricing, kit and bookings</span></div></li>
<li class="reveal"><img src="/photos/hero.jpg" alt="" loading="lazy" /><div><strong>Makeup foundations</strong><span>Skin tone, base and color</span></div></li>
<li class="reveal"><img src="/photos/habesha-harari.jpg" alt="" loading="lazy" /><div><strong>Bridal &amp; events</strong><span>Looks that last a 14-hour day</span></div></li>
<li class="reveal"><img src="/photos/habesha-eritrean.jpg" alt="" loading="lazy" /><div><strong>Skin prep &amp; care</strong><span>The canvas before the color</span></div></li>
<li class="reveal"><img src="/photos/habesha-trad.jpg" alt="" loading="lazy" /><div><strong>Building your clientele</strong><span>Pricing, kit and bookings</span></div></li>
</ul>
</section>
<section class="block" id="why">
<p class="kicker">Why us</p>
<h2>Learn the craft, <em>your way</em></h2>
<div class="why">
<p class="kicker reveal">Why us</p>
<h2 class="reveal">Learn the craft, <em>your way</em></h2>
<div class="why reveal">
<div><span class="n">01</span><h3>Waitlist goes first</h3><p>Everyone on the list gets in on opening day, before we announce it anywhere else.</p></div>
<div><span class="n">02</span><h3>Pay once, keep it</h3><p>One payment per course with Telebirr or CBE Birr. Yours for life.</p></div>
<div><span class="n">03</span><h3>Made for your phone</h3><p>Short video lessons that work on a mobile data plan.</p></div>
@ -256,7 +331,7 @@
</div>
</section>
<section class="cta">
<section class="cta reveal">
<img src="/photos/habesha-bride.jpg" alt="" loading="lazy" />
<div>
<h2>Be first in <em>the chair</em>.</h2>
@ -264,9 +339,26 @@
</div>
</section>
<footer>
<span>© <span id="year"></span> Sirkul Makeup School/Studio · Photos: <a href="https://commons.wikimedia.org/wiki/File:Tigray_Bride_(48108302903).jpg" rel="noopener">Rod Waddington</a> (CC BY-SA 2.0), <a href="https://commons.wikimedia.org/wiki/File:Femme_harari_v%C3%AAtue_de_la_tenue_traditionnelle,_orn%C3%A9e_de_bijoux_en_or..jpg" rel="noopener">Imagesdumonde</a> (CC BY-SA 4.0), <a href="https://commons.wikimedia.org/wiki/File:Eritrean_woman.jpg" rel="noopener">T.Voekler</a> (CC BY-SA 3.0), <a href="https://www.pexels.com/" rel="noopener">Pexels</a></span>
<nav aria-label="Footer"><a href="#courses">Courses</a><a href="#faq">FAQ</a><a href="#top">Back to top ↑</a></nav>
<footer class="foot">
<div class="foot-card reveal">
<div class="foot-brand">
<img src="/brand/sirkul-logo.png" alt="Sirkul Makeup School/Studio" />
<p>Learn the craft. Keep it for life.</p>
<a class="btn" href="#join" data-focus>Join the waitlist</a>
</div>
<!-- Contact details mirror the app's settings (packages/db/seed/demo-seed.mjs → settings/app). -->
<div class="foot-contact">
<h3>Contact us</h3>
<a href="https://t.me/sirkulmakeup_demo" target="_blank" rel="noopener"><span><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 2L11 13M22 2l-7 20-4-9-9-4z"/></svg></span>Message us on Telegram</a>
<a href="tel:+251911234567"><span><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1.9.4 1.8.7 2.7a2 2 0 0 1-.5 2.1L8 9.8a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.7.7a2 2 0 0 1 1.7 2z"/></svg></span>+251 911 234 567</a>
<a href="mailto:support@sirkul-makeup.example"><span><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18v12H3zM3 7l9 6 9-6"/></svg></span>support@sirkul-makeup.example</a>
</div>
</div>
<div class="foot-bar">
<span>© <span id="year"></span> Sirkul Makeup School/Studio · All rights reserved</span>
<details><summary>Photo credits</summary><p><a href="https://commons.wikimedia.org/wiki/File:Tigray_Bride_(48108302903).jpg" rel="noopener">Rod Waddington</a> (CC BY-SA 2.0), <a href="https://commons.wikimedia.org/wiki/File:Femme_harari_v%C3%AAtue_de_la_tenue_traditionnelle,_orn%C3%A9e_de_bijoux_en_or..jpg" rel="noopener">Imagesdumonde</a> (CC BY-SA 4.0), <a href="https://commons.wikimedia.org/wiki/File:Eritrean_woman.jpg" rel="noopener">T.Voekler</a> (CC BY-SA 3.0), <a href="https://www.pexels.com/" rel="noopener">Pexels</a></p></details>
</div>
<p class="powered">Powered by <a class="shine" href="https://yaltopia.com" target="_blank" rel="noopener">Yaltopia Tech</a></p>
</footer>
</div>
</main>
@ -276,8 +368,29 @@
const ENDPOINT = '';
document.getElementById('year').textContent = new Date().getFullYear();
document.querySelectorAll('[data-focus]').forEach((a) => a.addEventListener('click', () => setTimeout(() => document.getElementById('email')?.focus({ preventScroll: true }), 400)));
document.querySelectorAll('[data-focus]').forEach((a) => a.addEventListener('click', () => setTimeout(() => document.getElementById(channel === 'sms' ? 'phone' : 'email')?.focus({ preventScroll: true }), 400)));
// Scroll reveal, and the hero photos drift up a little as the page scrolls.
const still = matchMedia('(prefers-reduced-motion: reduce)').matches;
const revealEls = document.querySelectorAll('.reveal');
if ('IntersectionObserver' in window && !still) {
document.querySelectorAll('.looks .reveal').forEach((el, k) => el.style.setProperty('--rd', k * 90 + 'ms'));
const io = new IntersectionObserver((es) => es.forEach((e) => { if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target); } }), { rootMargin: '0px 0px -10% 0px' });
revealEls.forEach((el) => io.observe(el));
const collage = document.querySelector('.collage');
let ticking = false;
addEventListener('scroll', () => { if (ticking) return; ticking = true; requestAnimationFrame(() => { collage.style.setProperty('--py', Math.min(scrollY, 900) * -0.12 + 'px'); ticking = false; }); }, { passive: true });
} else revealEls.forEach((el) => el.classList.add('in'));
// SMS (default) or email: one contact is enough, the toggle picks which field shows.
let channel = 'sms';
document.querySelectorAll('.seg button').forEach((b) => b.addEventListener('click', () => {
channel = b.dataset.ch;
document.querySelectorAll('.seg button').forEach((x) => { const on = x === b; x.setAttribute('aria-selected', on); x.setAttribute('aria-checked', on); });
$('telWrap').hidden = channel !== 'sms'; $('email').hidden = channel !== 'email';
err.textContent = ''; ['phone', 'email'].forEach((k) => $(k).removeAttribute('aria-invalid'));
$(channel === 'sms' ? 'phone' : 'email').focus();
}));
const form = document.getElementById('form'), err = document.getElementById('err'), btn = document.getElementById('submit'), more = document.getElementById('more');
const $ = (id) => document.getElementById(id);
const digits = (p) => p.replace(/[\s()-]/g, '');
@ -322,25 +435,28 @@
};
if (ENDPOINT) fetch(ENDPOINT).then((r) => r.json()).then((d) => { waiting = Number(d.count) || 0; showWaiting(false); }).catch(() => {});
const contactError = () => channel === 'sms'
? (normPhone($('phone').value) ? null : ['phone', cc.value === 'ET' ? 'Please enter a phone number, e.g. 911 234 567.' : 'Please check the phone number for the country you picked.'])
: (emailOk($('email').value.trim()) ? null : ['email', 'Please enter a valid email.']);
function check() {
const name = $('name').value.trim(), email = $('email').value.trim(), phone = normPhone($('phone').value);
const name = $('name').value.trim();
const bad = [];
if (name.length < 2) bad.push(['name', 'Please enter your name.']);
if (!phone) bad.push(['phone', cc.value === 'ET' ? 'Please enter a phone number, e.g. 911 234 567.' : 'Please check the phone number for the country you picked.']);
if (!emailOk(email)) bad.push(['email', 'Please enter a valid email.']);
const c = contactError(); if (c) bad.push(c);
['name', 'email', 'phone'].forEach((k) => $(k).setAttribute('aria-invalid', String(bad.some(([b]) => b === k))));
return bad.length ? { error: bad[0] } : { data: { name, email: email.toLowerCase(), phone, locale: navigator.language || 'en', createdAt: new Date().toISOString() } };
const email = channel === 'email' ? $('email').value.trim().toLowerCase() : '', phone = channel === 'sms' ? normPhone($('phone').value) : '';
return bad.length ? { error: bad[0] } : { data: { name, email, phone, channel, locale: navigator.language || 'en', createdAt: new Date().toISOString() } };
}
form.addEventListener('input', (e) => { if (e.target.getAttribute('aria-invalid') === 'true') { if (more.hidden) e.target.setAttribute('aria-invalid', String(!emailOk(e.target.value.trim()))); else check(); } });
form.addEventListener('input', (e) => { if (e.target.getAttribute('aria-invalid') === 'true') { if (more.hidden) { const c = contactError(); e.target.setAttribute('aria-invalid', String(!!c && c[0] === e.target.id)); } else check(); } });
form.addEventListener('submit', async (e) => {
e.preventDefault(); err.textContent = '';
// Step 1 asks only for the email (one field, like the reference); step 2 adds name and phone.
// Step 1 asks only for the phone or email; step 2 adds the name.
if (more.hidden) {
const ok = emailOk($('email').value.trim());
$('email').setAttribute('aria-invalid', String(!ok));
if (!ok) { err.textContent = 'Please enter a valid email.'; $('email').focus(); return; }
const c = contactError();
['phone', 'email'].forEach((k) => $(k).setAttribute('aria-invalid', String(!!c && c[0] === k)));
if (c) { err.textContent = c[1]; $(c[0]).focus(); return; }
more.hidden = false; btn.textContent = 'Get notified';
$('fine').textContent = 'Last step: so we can text you on opening day.';
$('fine').textContent = 'Last step: what should we call you?';
$('name').focus(); return;
}
const r = check();
@ -354,7 +470,7 @@
if (!res.ok || !out.ok) throw new Error(out.error || res.status);
} else {
let list = []; try { list = JSON.parse(localStorage.getItem('waitlist') || '[]'); } catch {}
if (!list.some((x) => x.email === r.data.email)) list.push(r.data);
if (!list.some((x) => (r.data.email && x.email === r.data.email) || (r.data.phone && x.phone === r.data.phone))) list.push(r.data);
try { localStorage.setItem('waitlist', JSON.stringify(list)); } catch {}
console.warn('Waitlist ENDPOINT not set: signup saved in this browser only.', r.data);
}
@ -362,7 +478,7 @@
// The new signup's initial joins the faces in the pill.
const me = document.createElement('b'); me.textContent = first[0].toUpperCase(); $('faces').prepend(me);
waiting += 1; showWaiting(true);
form.parentElement.innerHTML = `<div class="done" role="status"><div class="tick"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg></div><div><h3>You're on the list, ${first.replace(/[<>&"]/g, '')}.</h3><p>We'll message you the day classes open.</p></div></div>`;
form.parentElement.innerHTML = `<div class="done" role="status"><div class="tick"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg></div><div><h3>You're on the list, ${first.replace(/[<>&"]/g, '')}.</h3><p>We'll ${channel === 'sms' ? 'text' : 'email'} you the day classes open.</p></div></div>`;
} catch {
err.textContent = "Something went wrong. Please try again in a moment.";
btn.disabled = false;

View File

@ -24,9 +24,10 @@ function doPost(e) {
try {
const sheet = getSheet();
const last = sheet.getLastRow();
const emails = last > 1 ? sheet.getRange(2, 3, last - 1, 1).getValues().map((r) => String(r[0]).toLowerCase()) : [];
if (emails.indexOf(row.email) === -1) {
sheet.appendRow([new Date().toISOString(), safe(row.name), safe(row.email), "'" + row.phone, safe(row.locale), safe(row.page)]);
// Email (col C) and phone (col D) either may be blank; a match on either one is the same person.
const seen = last > 1 ? sheet.getRange(2, 3, last - 1, 2).getValues().some((r) => (row.email && String(r[0]).toLowerCase() === row.email) || (row.phone && String(r[1]).replace(/^'/, '') === row.phone)) : false;
if (!seen) {
sheet.appendRow([new Date().toISOString(), safe(row.name), safe(row.email), row.phone ? "'" + row.phone : '', safe(row.locale), safe(row.page)]);
}
} finally { lock.releaseLock(); }
return reply({ ok: true });
@ -43,9 +44,11 @@ function clean(d) {
const name = String(d.name || '').trim().slice(0, 80);
const email = String(d.email || '').trim().toLowerCase().slice(0, 120);
const phone = String(d.phone || '').replace(/[\s()-]/g, '');
// People sign up by SMS or by email: a name plus at least one valid contact.
if (name.length < 2) return { error: 'name' };
if (!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email)) return { error: 'email' };
if (!/^\+\d{8,15}$/.test(phone)) return { error: 'phone' };
if (email && !/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email)) return { error: 'email' };
if (phone && !/^\+\d{8,15}$/.test(phone)) return { error: 'phone' };
if (!email && !phone) return { error: 'contact' };
return { name, email, phone, locale: String(d.locale || '').slice(0, 20), page: String(d.page || '').slice(0, 200) };
}

View File

@ -2,7 +2,7 @@
import fs from 'fs'; import vm from 'vm'; import assert from 'assert';
const rows = [];
const sheet = { appendRow: (r) => rows.push(r), getLastRow: () => rows.length, setFrozenRows() {},
getRange: (r, c, n) => ({ getValues: () => rows.slice(r - 1, r - 1 + n).map((row) => [row[c - 1]]) }) };
getRange: (r, c, n, w = 1) => ({ getValues: () => rows.slice(r - 1, r - 1 + n).map((row) => row.slice(c - 1, c - 1 + w)) }) };
const ctx = {
SpreadsheetApp: { getActiveSpreadsheet: () => ({ getSheetByName: () => (rows.length ? sheet : null), insertSheet: () => sheet }) },
LockService: { getScriptLock: () => ({ waitLock() {}, releaseLock() {} }) },
@ -19,8 +19,14 @@ assert.deepEqual(post({ ...ok, email: 'selam@example.com' }), { ok: true }); ass
assert.deepEqual(post({ ...ok, email: 'x@y.co', phone: '0911' }), { ok: false, error: 'phone' });
assert.deepEqual(post({ ...ok, email: 'nope' }), { ok: false, error: 'email' });
assert.deepEqual(post({ ...ok, name: ' ' }), { ok: false, error: 'name' });
post({ ...ok, email: 'f@y.co', name: '=HYPERLINK("x")' }); assert.equal(rows.at(-1)[1], '\'=HYPERLINK("x")', 'formula neutralised');
post({ ...ok, email: 'f@y.co', phone: '+251911000222', name: '=HYPERLINK("x")' }); assert.equal(rows.at(-1)[1], '\'=HYPERLINK("x")', 'formula neutralised');
const n = rows.length; assert.deepEqual(post({ ...ok, email: 'bot@y.co', company: 'spam' }), { ok: true }); assert.equal(rows.length, n, 'honeypot dropped');
assert.deepEqual(ctx.doPost({ postData: { contents: '{bad' } }), { ok: false, error: 'bad_json' });
assert.deepEqual(ctx.doGet(), { ok: true, count: rows.length - 1 }, 'count excludes the header');
console.log('waitlist checks: all passed');
// SMS or email: either contact alone is enough, neither is an error, and a repeat phone is skipped.
assert.deepEqual(post({ name: 'Hana T', phone: '+251922000111' }), { ok: true });
const m = rows.length; post({ name: 'Hana T', phone: '+251 922 000 111' }); assert.equal(rows.length, m, 'duplicate phone skipped');
assert.deepEqual(post({ name: 'Mimi K', email: 'mimi@example.com' }), { ok: true });
assert.deepEqual(post({ name: 'No Contact' }), { ok: false, error: 'contact' });
console.log('waitlist sms/email checks: ok');