From 969acda4f766a1782a84cbc1955a87e6dfda2229 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Mon, 2 Nov 2026 12:43:28 -0500 Subject: [PATCH] feat: implement Hero and multi-touch WhatsApp conversion flow (Slice 2) (#8) Co-authored-by: kiskaadee --- .gitignore | 1 + biome.json | 3 +- index.html | 15 +-- package.json | 1 + tests/hero-whatsapp.test.js | 181 ++++++++++++++++++++++++++++++++++++ 5 files changed, 194 insertions(+), 7 deletions(-) create mode 100644 tests/hero-whatsapp.test.js diff --git a/.gitignore b/.gitignore index 8fb2604..29dea20 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .direnv node_modules/ +.pnpm-store/ dist/ .vite/ .vite-hooks/_ diff --git a/biome.json b/biome.json index 444aaa7..71bef5c 100644 --- a/biome.json +++ b/biome.json @@ -15,7 +15,8 @@ "**/*.tsx", "**/*.json", "**/*.css", - "**/*.html" + "**/*.html", + "!**/.pnpm-store" ] }, "css": { diff --git a/index.html b/index.html index c75ebdd..1aab72c 100644 --- a/index.html +++ b/index.html @@ -21,10 +21,12 @@ - 💬 + Conversar con Azu @@ -51,14 +53,15 @@
+ - Acompañamiento Consciente · Valledupar + Acompañamiento Consciente · Valledupar & Online

Sal del automático. Abre tu corazón, recupera tu soberanía.

- 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.

Azucena Sánchez — Fundadora diff --git a/package.json b/package.json index 2f33ae5..483b9b6 100644 --- a/package.json +++ b/package.json @@ -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 .", diff --git a/tests/hero-whatsapp.test.js b/tests/hero-whatsapp.test.js new file mode 100644 index 0000000..120c958 --- /dev/null +++ b/tests/hero-whatsapp.test.js @@ -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(/
/)?.[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, + //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(/
/)?.[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(/]+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( + /]*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(' { + const heroSection = indexHtml.match(/
/)?.[0]; + assert.ok(heroSection, 'Hero section must exist'); + + const imgMatch = heroSection.match(/]+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(/
/)?.[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', + ); + }, + ); +});