feat: implement Hero and multi-touch WhatsApp conversion flow (Slice 2) (#8)

Co-authored-by: kiskaadee <fcortesbio@gmail.com>
This commit is contained in:
kiskaadee authored and Fabian Andres Cortes committed 2026-11-02 12:43:28 -05:00
1 parent abe10331cb
commit 969acda4f7
5 files changed
+194 -7

No files matched your search

+1
View File
@@ -1,5 +1,6 @@
.direnv
node_modules/
.pnpm-store/
dist/
.vite/
.vite-hooks/_
+2 -1
View File
@@ -15,7 +15,8 @@
"**/*.tsx",
"**/*.json",
"**/*.css",
"**/*.html"
"**/*.html",
"!**/.pnpm-store"
]
},
"css": {
+9 -6
View File
@@ -21,10 +21,12 @@
<!-- Floating WhatsApp Action -->
<a
href="https://wa.me/573215428972?text=Hola%20Azu,%20visit%C3%A9%20tu%20p%C3%A1gina%20y%20me%20gustar%C3%ADa%20conversar%20sobre%20tus%20sesiones."
class="fixed bottom-5 right-5 z-50 flex items-center gap-2 rounded-full bg-[#25D366] px-5 py-3 text-sm font-bold text-white shadow-lg transition hover:scale-105 hover:shadow-xl focus:outline-none focus:ring-4 focus:ring-[#25D366]/40"
aria-label="Conversar por WhatsApp con Azu"
class="fixed bottom-5 right-5 z-50 flex min-h-[48px] min-w-[48px] items-center gap-2.5 rounded-full bg-[#25D366] px-5 py-3 text-sm font-bold text-white shadow-lg shadow-black/20 transition hover:scale-105 hover:bg-[#20ba59] hover:shadow-xl focus:outline-none focus:ring-4 focus:ring-[#25D366]/40 active:scale-95"
aria-label="Conversar por WhatsApp con Azucena Sánchez"
>
<span class="text-lg">💬</span>
<svg class="h-6 w-6 fill-current shrink-0" viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
<path d="M12.04 2c-5.46 0-9.91 4.45-9.91 9.91 0 1.75.46 3.45 1.32 4.95L2.05 22l5.25-1.38c1.45.79 3.08 1.21 4.74 1.21 5.46 0 9.91-4.45 9.91-9.91 0-2.65-1.03-5.14-2.9-7.01A9.816 9.816 0 0 0 12.04 2zm.01 1.67c2.2 0 4.26.86 5.82 2.41a8.17 8.17 0 0 1 2.41 5.83c0 4.54-3.7 8.24-8.24 8.24-1.48 0-2.93-.4-4.2-1.15l-.3-.18-3.12.82.83-3.04-.2-.31a8.196 8.196 0 0 1-1.26-4.38c0-4.54 3.7-8.24 8.24-8.24zm4.52 11.66c-.25-.13-1.47-.72-1.7-.81-.23-.08-.39-.13-.56.13-.17.25-.64.81-.79.97-.14.17-.29.19-.54.06-.25-.13-1.06-.39-2.02-1.25-.75-.67-1.26-1.5-1.41-1.75-.14-.25-.02-.39.11-.51.11-.11.25-.29.37-.44.13-.14.17-.25.25-.41.08-.17.04-.31-.02-.44-.06-.13-.56-1.34-.76-1.84-.2-.49-.4-.42-.56-.43h-.47c-.17 0-.44.06-.67.31-.23.25-.89.87-.89 2.12s.91 2.46 1.04 2.63c.13.17 1.79 2.73 4.33 3.83.61.26 1.08.42 1.45.54.61.19 1.16.17 1.6.1.49-.07 1.47-.6 1.68-1.18.21-.58.21-1.07.14-1.18-.06-.11-.23-.18-.48-.3z"/>
</svg>
<span>Conversar con Azu</span>
</a>
@@ -51,14 +53,15 @@
<section id="hero" class="py-12 md:py-20 lg:py-24">
<div class="mx-auto grid max-w-6xl items-center gap-12 px-6 md:grid-cols-12">
<div class="md:col-span-7">
<!-- Dual modality eyebrow; pending Azu's confirmation on exact wording per brief Section 02 -->
<span class="inline-block text-xs font-bold uppercase tracking-widest text-gold mb-3">
Acompañamiento Consciente · Valledupar
Acompañamiento Consciente · Valledupar & Online
</span>
<h1 class="font-serif text-4xl leading-tight sm:text-5xl lg:text-6xl text-forest font-semibold mb-6">
Sal del automático. Abre tu corazón, recupera tu soberanía.
</h1>
<p class="text-base sm:text-lg text-forest/85 leading-relaxed max-w-xl mb-8">
Un espacio sereno para soltar la sobrecarga mental, calmar el sistema nervioso y reconectar con la vitalidad y el discernimiento de tu propio ser.
¿Vives en el cansancio del piloto automático, el parloteo mental incesante y la fatiga del sistema nervioso? Este es un espacio sereno para soltar la sobrecarga, aquietar la mente y abrir tu corazón a tu propia medicina interna.
</p>
<a
href="https://wa.me/573215428972?text=Hola%20Azu,%20visit%C3%A9%20tu%20p%C3%A1gina%20y%20me%20gustar%C3%ADa%20conversar%20sobre%20tus%20sesiones."
@@ -72,7 +75,7 @@
<div class="overflow-hidden rounded-3xl border border-sage/30 shadow-2xl aspect-[4/5] bg-sage/10">
<img
src="/img/azu-hero.jpg"
alt="Azucena Sánchez — Fundadora"
alt="Retrato de Azucena Sánchez al aire libre, facilitadora y mentora de El Corazón como Portal"
class="h-full w-full object-cover"
loading="eager"
/>
+1
View File
@@ -7,6 +7,7 @@
"dev": "vp dev",
"build": "vp build",
"preview": "vp preview",
"test": "node --test tests/*.test.js",
"lint": "biome check .",
"lint:fix": "biome check --write .",
"format": "biome format --write .",
+181
View File
@@ -0,0 +1,181 @@
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import test from 'node:test';
const indexPath = path.resolve('index.html');
const indexHtml = fs.readFileSync(indexPath, 'utf-8');
test('Slice 2 Acceptance Criteria: Hero and WhatsApp Flow', async (t) => {
await t.test(
'Criterion 1: Eyebrow badge signals dual modality and includes confirmation comment',
() => {
// Must contain Valledupar & Online dual modality in Hero section
const heroSection = indexHtml.match(/<section id="hero"[\s\S]*?<\/section>/)?.[0];
assert.ok(heroSection, 'Hero section must exist in index.html');
// Check for dual modality text: VALLEDUPAR & ONLINE
const eyebrowRegex = /ACOMPAÑAMIENTO CONSCIENTE\s*·\s*VALLEDUPAR\s*&\s*ONLINE/i;
assert.match(
heroSection,
eyebrowRegex,
'Eyebrow must explicitly signal dual modality: ACOMPAÑAMIENTO CONSCIENTE · VALLEDUPAR & ONLINE',
);
// Must include comment noting pending client confirmation per brief Section 02
assert.match(
heroSection,
/<!--[\s\S]*?pending[\s\S]*?confirmation[\s\S]*?Section 02[\s\S]*?-->/i,
'Hero eyebrow must have an explanatory comment noting pending confirmation per brief Section 02',
);
},
);
await t.test(
'Criterion 2: Primary Hero CTA triggers wa.me with pre-filled encoded inquiry message',
() => {
const heroSection = indexHtml.match(/<section id="hero"[\s\S]*?<\/section>/)?.[0];
assert.ok(heroSection, 'Hero section must exist');
const expectedPhone = '573215428972';
const expectedMessage =
'Hola Azu, visité tu página y me gustaría conversar sobre tus sesiones.';
const expectedEncoded = encodeURIComponent(expectedMessage);
// Hero primary CTA anchor
const ctaMatch = heroSection.match(/<a[^>]+href="([^"]+)"[^>]*>[\s\S]*?<\/a>/i);
assert.ok(ctaMatch, 'Hero must contain a primary CTA link');
const href = ctaMatch[1];
assert.ok(
href.startsWith(`https://wa.me/${expectedPhone}`),
`Hero CTA must target https://wa.me/${expectedPhone}`,
);
const url = new URL(href);
assert.equal(
url.searchParams.get('text'),
expectedMessage,
'CTA pre-filled text must match approved inquiry message',
);
assert.ok(
href.includes(expectedEncoded) || href.includes('Hola%20Azu'),
'URL must contain correctly percent-encoded query parameter',
);
},
);
await t.test(
'Criterion 3: Persistent floating WhatsApp button with >= 48px touch target, SVG icon and aria-label',
() => {
// Find floating WhatsApp button
const floatingBtnMatch = indexHtml.match(
/<a[^>]*class="[^"]*fixed[^"]*bottom-[^"]*right-[^"]*z-50[^"]*"[^>]*>[\s\S]*?<\/a>/i,
);
assert.ok(
floatingBtnMatch,
'Floating WhatsApp button must exist with fixed positioning (fixed, bottom-*, right-*, z-50)',
);
const buttonMarkup = floatingBtnMatch[0];
// Touch target >= 48px
assert.match(buttonMarkup, /min-h-\[48px\]/, 'Touch target must specify min-h-[48px]');
assert.match(buttonMarkup, /min-w-\[48px\]/, 'Touch target must specify min-w-[48px]');
// Accessible aria-label
assert.match(
buttonMarkup,
/aria-label="[^"]*WhatsApp[^"]*"/i,
'Button must have an accessible aria-label mentioning WhatsApp',
);
// Crisp SVG WhatsApp icon (no emoji placeholder)
assert.ok(buttonMarkup.includes('<svg'), 'Floating button must contain an inline SVG icon');
assert.ok(!buttonMarkup.includes('💬'), 'Floating button must not use emoji 💬');
},
);
await t.test(
'Criterion 4: Natural lifestyle portrait photo used in Hero with descriptive alt text',
() => {
const heroSection = indexHtml.match(/<section id="hero"[\s\S]*?<\/section>/)?.[0];
assert.ok(heroSection, 'Hero section must exist');
const imgMatch = heroSection.match(/<img[^>]+src="([^"]+)"[^>]*>/i);
assert.ok(imgMatch, 'Hero must contain an image tag');
const src = imgMatch[1];
assert.equal(
src,
'/img/azu-hero.jpg',
'Hero must use natural lifestyle photo /img/azu-hero.jpg',
);
assert.ok(
!heroSection.includes('turban') && !heroSection.includes('turbante'),
'Turban photo must not be used or referenced in Hero',
);
// Descriptive alt text
const altMatch = imgMatch[0].match(/alt="([^"]*)"/i);
assert.ok(altMatch, 'Hero image must have alt attribute');
assert.ok(
altMatch[1].length >= 15 && altMatch[1].toLowerCase().includes('azucena'),
'Alt text must be descriptive and identify Azucena',
);
},
);
await t.test(
'Criterion 5: Zero personal or secondary phone numbers in rendered markup or scripts',
() => {
// Find all phone number sequences
// Colombian mobile phone numbers are 10 digits starting with 3 (e.g. 321 542 8972)
// or international format +57... / 573215428972
const phoneMatches = indexHtml.matchAll(/(?:\+?57)?[ -]?(3\d{2}[ -]?\d{3}[ -]?\d{4})/g);
for (const match of phoneMatches) {
const rawDigits = match[0].replace(/\D/g, '');
const normalized = rawDigits.startsWith('57') ? rawDigits : `57${rawDigits}`;
assert.equal(
normalized,
'573215428972',
`Found unexpected phone number: ${match[0]} (only 573215428972 allowed)`,
);
}
},
);
await t.test(
'Criterion 6: Grounded problem-identification narrative ("Esto es lo que necesito" hook)',
() => {
const heroSection = indexHtml.match(/<section id="hero"[\s\S]*?<\/section>/)?.[0];
assert.ok(heroSection, 'Hero section must exist');
const lowerHero = heroSection.toLowerCase();
// Autopilot
assert.ok(
lowerHero.includes('automático') || lowerHero.includes('automatico'),
'Hero must speak directly to chronic autopilot',
);
// Mental chatter / overthinking
assert.ok(
lowerHero.includes('parloteo mental'),
'Hero must speak directly to mental chatter ("parloteo mental")',
);
// Nervous system fatigue
assert.ok(
lowerHero.includes('sistema nervioso'),
'Hero must speak directly to nervous system fatigue',
);
// Opening heart
assert.ok(
lowerHero.includes('abre tu corazón') || lowerHero.includes('abrir tu corazón'),
'Hero must speak to opening the heart',
);
},
);
});