feat(emails): shared house-style email layout wrapper (consistency pass)

Merged
SW
4mo ago
+238-44

What

Welcome, valuation, and weekly-report emails should share one visual language (DESIGN.md — four-font system, shadow-as-border, achromatic chrome), but each outbound email was assembled ad hoc (rendered body + a bare footer). This is the consistency pass from recoupable/chat#1885 — it establishes the shared email template.

Changes

  • renderEmailLayout (lib/emails/) — one shared header + footer + optional-CTA wrapper:
    • Recoup wordmark header
    • achromatic shadow-as-border card (box-shadow, not a CSS border, per DESIGN.md)
    • the DESIGN.md font stack (Plus Jakarta Sans → system fallbacks)
    • literal hex brand tokens (email clients can't read CSS variables), centered fixed-max-width container
    • email-client-safe: all styles inline, webfonts degrade to system fonts.
  • processAndSendEmail — adopts the wrapper as the proof point. This is the path the live weekly-report email flows through (agent send_email → processAndSendEmail), so the already-live weekly report now renders in the shared house style, with the existing getEmailFooter output carried in as the layout footer.

Note

The welcome (api#774) and valuation (api#773) emails will adopt this same renderEmailLayout wrapper once merged — this PR establishes the shared template they align to, so all three read as one family.

Verification

  • TDD RED→GREEN:
    • renderEmailLayout — wraps body; includes footer when given / omits when not; renders CTA button (label + href) when given / none otherwise; carries house-style markers (wordmark, #0a0a0a ink, box-shadow card, Plus Jakarta Sans, max-width).
    • processAndSendEmail — the sent HTML preserves the body and is wrapped in the shared layout (wordmark + shadow-as-border + font stack).
  • Full lib/emails domain suite green — 159 tests passing (existing processAndSendEmail behavior unchanged).
  • tsc --noEmit: no errors in changed files (1 pre-existing baseline error in processAndSendEmail.test.ts is unchanged, only line-shifted).
  • eslint + prettier clean on all changed files.

Targets main.

Relates to recoupable/chat#1885 (consistency pass across onboarding emails).

🤖 Generated with Claude Code


Summary by cubic

Add a shared house‑style email layout and adopt it across weekly report, welcome, and valuation emails. This completes the consistency pass so onboarding emails use one visual language (recoupable/chat#1885).

  • New Features

    • lib/emails/renderEmailLayout: shared wrapper (header, footer, optional CTA) with Recoup wordmark, shadow‑as‑border card (box-shadow), DESIGN.md font stack, centered max‑width container, inline styles, and literal hex tokens.
    • Adopted in lib/emails/processAndSendEmail, lib/emails/buildWelcomeEmail, and lib/emails/valuationReport/renderValuationReportHtml; these now provide only body/CTA/footer and render through the new layout.
  • Bug Fixes

    • Single‑quoted font names in the font stack to avoid breaking style="…" in email clients; added a regression test in renderEmailLayout.test.ts.