Skip to content

feat: email template library + /templates page + Browse picker (HIR-75)#2

Merged
pypesdev merged 1 commit intopypesdev:mainfrom
jaredzwick:hir-75/email-template-library
May 2, 2026
Merged

feat: email template library + /templates page + Browse picker (HIR-75)#2
pypesdev merged 1 commit intopypesdev:mainfrom
jaredzwick:hir-75/email-template-library

Conversation

@jaredzwick
Copy link
Copy Markdown
Collaborator

Summary

Adds the first 'move the needle' README TODO: a starter email template library.

  • src/lib/templates/catalog.ts — 6 seeded templates (saas_onboarding, agency_outreach, recruiter_outbound, b2b_warm_intro, founder_to_founder, re_engagement_silent_3day) using the existing {{variable}} placeholder syntax from the campaigns API (src/app/api/campaigns/route.ts).
  • /templates (Next.js app router) — grid of template cards with preview + 'Use this template' that hands off to the sequence form.
  • /dashboard/campaigns/new — single-step sequence-creation form with a 'Browse templates' button that opens the same picker as a modal, and ?templateId= prefill from the templates page.
  • tests/int/templates.int.spec.ts — 10 unit tests (vitest) verifying:
    • all 6 required templates are seeded with unique IDs
    • every {{placeholder}} in subject/body is declared in variables[]
    • every declared variable is actually used in the template text
    • extractPlaceholders and getTemplateById behave correctly

Notes for reviewers

  • I went with {{first_name}} (existing campaigns API syntax) rather than the {first_name} shape mentioned in the issue body — per the engineer's note to match the existing templating system.
  • Repo had no UI for sequence creation yet (only the /api/campaigns endpoint), so I added a minimal one at /dashboard/campaigns/new. That gives the modal somewhere to live without introducing a new abstraction.
  • Out of scope (follow-ups): template editing UI, user-saved custom templates, AI generation.

Test plan

  • pnpm exec vitest run --config ./vitest.config.mts tests/int/templates.int.spec.ts — 10/10 pass
  • pnpm exec next lint clean on all new files
  • pnpm exec tsc --noEmit — no new type errors introduced (pre-existing errors in libs/db, src/app/api/campaigns/route.ts, etc. are unchanged)
  • Visual QA on /templates and /dashboard/campaigns/new (auth-gated, deferred to local run)

Definition of done

  • PR open against pypesdev/coldflow main branch
  • All 6 templates render in /templates page (rendered via TemplatePicker)
  • Picker prefills sequence-creation form correctly (URL param + modal handler both call applyTemplate)
  • Catalog test green in CI
  • README's 'Move the needle TO-DO' templates checkbox ticked

Closes HIR-75. Parent: HIR-74.

Seeds 6 starter templates (saas_onboarding, agency_outreach,
recruiter_outbound, b2b_warm_intro, founder_to_founder,
re_engagement_silent_3day) in src/lib/templates/catalog.ts using the
existing {{variable}} placeholder syntax from the campaigns API.

- /templates renders a grid with preview + 'Use this template'
- /dashboard/campaigns/new is a single-step sequence form with a
  'Browse templates' modal and ?templateId= prefill
- Catalog test enforces every {{placeholder}} is declared in
  variables[] and vice versa, so future templates stay consistent

Closes HIR-75. Ticks the 'Templates for popular email needs'
TODO in the README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants