fix: broader WhatsApp/social detection, generous assessment rules, overlay popup

- site_analyzer: scan onclick/data-href/data-url/data-link/data-action attrs
  on ALL tags for WhatsApp (wa.me, api.whatsapp, web.whatsapp, wa.link),
  tel: links, and social media URLs; raise dedup cap 5→8
- beauty_ai: rewrite lead quality rules — WARM for any genuine multi-brand
  retailer even with zero portfolio matches; portfolio absence NEVER justifies
  COLD alone; added country_fiscal fallback to ip_country
- index.html: assessPopup overlay modal on quality badge click in Browse tab;
  showAssessPopup() parses beauty_assessment JSON with all_contacts fallback;
  [x-cloak] CSS to prevent flash

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-13 10:37:36 +02:00
parent e426922544
commit dfd47743e3
3 changed files with 227 additions and 25 deletions

View File

@@ -355,24 +355,44 @@ Social media: {_fmt(all_social)}
{', '.join(BEAUTY_CATEGORIES)}
=== ASSESSMENT RULES ===
1. TARGET PROFILE: retailer, pharmacy, parafarmacia, perfumería, multi-brand beauty
ecommerce, salon chain, beauty distributor, or supermarket beauty section in Europe.
2. Identify ALL beauty brands mentioned anywhere on the page — go beyond the pre-detected
list above. Use product names, brand references in body text, alt text, etc.
3. Match brands against our portfolio. Lead quality is driven by portfolio overlap:
- HOT: 3+ portfolio brands detected, OR major EU beauty retailer clearly in our niche
- WARM: 1-2 portfolio brand matches, OR clear beauty multi-brand retailer with good reach
- COLD: beauty-adjacent but weak portfolio overlap, OR single-brand, OR unclear wholesale
- NOT_RELEVANT: not a beauty business, not in Europe, or clearly a consumer-only brand
4. Extract the BEST contact for outreach:
- Prefer business/commercial emails (info@, ventas@, compras@, admin@) over personal
- If WhatsApp exists, flag it — it's often the fastest channel in Spain/LatAm
- Check social media for direct messaging channels
5. Use the legal/company info to identify the official business name (razón social),
and if a CIF/NIF is visible, mention it in outreach_notes as it confirms legitimacy.
6. Write summary, pitch_angle, b2b_proposal, outreach_subject, and outreach_email in Spanish.
7. The outreach_email must be a complete ready-to-send email: greeting, 2-3 body sentences
(reference their specific range, 1-2 matching portfolio brands, add value), clear CTA.
1. TARGET PROFILE: We are looking for businesses that BUY BEAUTY PRODUCTS WHOLESALE to
resell: retailers, pharmacies, parafarmacias, perfumerías, multi-brand beauty ecommerce,
salon chains, supermarkets with beauty sections, beauty distributors — anywhere in Europe.
2. Identify ALL beauty brands anywhere on the page (body text, alt text, category names,
product listings, brand pages). Go beyond the pre-detected list already provided above.
3. LEAD QUALITY — rate on BUSINESS TYPE first, portfolio overlap second:
- HOT: Business type is clearly a multi-brand beauty reseller with professional/wholesale
activity AND at least one of: ≥2 portfolio brands detected, evident professional
lines, large catalogue (pharmacies, parafarmacia chains, pro salon distributors).
Also HOT: any large-scale EU beauty retailer even without portfolio brand matches.
- WARM: ANY genuine multi-brand beauty retailer or ecommerce that could buy wholesale —
even if ZERO portfolio brands are currently detected. They are our TARGET MARKET:
we want to introduce our brands to them. Pharmacies, perfumerías, beauty shops,
multi-brand online stores → default WARM unless there is a clear disqualifier.
When uncertain between WARM and COLD: choose WARM.
- COLD: ONLY if clearly disqualified: single-brand D2C (sells only their own brand),
beauty salon that doesn't sell products to end-consumers, personal influencer /
blog, OR no evidence this is a purchasing business at all.
- NOT_RELEVANT: No beauty/cosmetics connection, or clearly non-European.
⚠ CRITICAL: Portfolio brand absence NEVER alone justifies COLD. Our job is to introduce
our brands to retailers who don't carry them yet. Rate on whether they COULD buy wholesale.
4. country_fiscal: use aviso legal if found; otherwise use the IP country shown above.
NEVER leave country_fiscal empty — always provide a 2-letter ISO code.
5. Extract the BEST contact for outreach — check all data above:
- Prefer commercial emails (info@, ventas@, compras@, pedidos@) over generic/personal
- WhatsApp is often the fastest channel in Spain; flag it if present
- Set best_contact_channel and best_contact_value explicitly
6. Write summary, pitch_angle, b2b_proposal, outreach_subject, and outreach_email in SPANISH.
7. outreach_email must be a complete ready-to-send Spanish email: greeting + 3-4 sentences
referencing their specific range + 1-2 of our portfolio brands that match + clear CTA
(catálogo, muestra gratuita, llamada, primer pedido mínimo). No placeholders.
Respond ONLY with valid JSON, no markdown fences, no text outside the JSON object:
{{
@@ -536,6 +556,11 @@ async def assess_beauty_domain(analysis: dict) -> dict:
if not result.get("contact_social") and all_social:
result["contact_social"] = all_social[0]
# country_fiscal fallback — always provide a value
fc = (result.get("country_fiscal") or "").strip()
if not fc or fc.lower() in ("unknown", "n/a", "-"):
result["country_fiscal"] = analysis.get("ip_country") or ""
logger.info("Beauty AI %s → quality=%s, dist_matches=%s",
domain, result.get("lead_quality"), result.get("dist_matches"))
return result