Skip to content

feat(email): branding, text overrides and 16 new templates (0.3.0) - #51

Merged
fnLog0 merged 2 commits into
masterfrom
feat/email-brand
Nov 4, 2026
Merged

fnLog0 merged 2 commits into
masterfrom
feat/email-brand

Conversation

@fnLog0

@fnLog0 fnLog0 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Grows @locusgraph/email from 4 to 20 templates and makes every one brandable and rewordable, so SpendGraph and other apps can send them without forking.

Branding

  • product ("locusgraph" | "spendgraph") on every template, with the product mark and wordmark in the header.
  • brand override: name, wordmark, markUrl, markWidth, markHeight, merged over the product's brand.

Text overrides

  • Every template has the same 8 text slots: subject, preview, label, heading, body, button, note, footer.
  • overrides replaces any slot with a string or a function of the props plus brandName. Left-out slots keep the default; an empty string removes one.

Setup once

  • createEmails({ product, brand, overrides }) returns all 20 templates under short names (emails.welcome, emails.paymentFailed, ...). Per-call overrides win over createEmails overrides, which win over defaults.

Build your own

  • defineEmail gives a new template the shared layout, slots, overrides and plain text. The kit parts and renderEmail remain for fully custom layouts.

Standard (from Postmark's template guidance and Clerk/Better Auth/Stack Auth comparisons)

  • preview gives the next step instead of repeating the subject.
  • The raw link prints under every button ("Or open: host/path") for clients that hide buttons.
  • Plain text is built from the same text: heading, body, action link, Label: value rows, note, footer, brand last.
  • Security emails (keys, roles, ownership, deletion) end with a calm securityFooter.

Templates

  • Account: welcome, emailVerification
  • Organization: invitation, invitationAccepted, ownershipTransferred, organizationDeleted
  • Members: roleChanged, memberRemoved
  • API keys: keyCreated, keyRevoked, keyExpiring
  • Billing: receipt, lowCredits, paymentFailed, planChanged
  • Usage: usageWarning, usageOverPlan, usageSummary, spendLimitReached
  • Agent: approvalRequested

Docs site

  • Email demo: all 20 templates, a product switch, and examples for brand once, overrides, out of credits and plain text.
  • Docs examples can now take an explicit code snippet (define-demo.ts, demo-docs.ts) instead of the demo function body.

Release notes for 0.3.0

  • Plain text output changed format: rows are now Label: value and the brand moves from first line to last.
  • Every email is one line taller (raw link under the button).

Before release

  • Replace apps/design/public/email/spendgraph-mark.png (currently a copy of the LocusGraph mark).
  • Deploy the docs site so design.locusgraph.com/email/*-mark.png serve the images.
  • After merge, push tag email-v0.3.0.

Test plan

  • pnpm check (lint, typecheck, tests, registry build)
  • @locusgraph/email: 36 tests
  • apps/example-react and apps/example-next build
  • Preview each template at /brand/media/email in light and dark

🤖 Generated with Claude Code

@fnLog0
fnLog0 merged commit e30b046 into master Nov 4, 2026
2 checks passed
@fnLog0
fnLog0 deleted the feat/email-brand branch November 4, 2026 05:49
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.

1 participant