fix: brand outbound email templates with ZapDesk + KnowAll AI logos#378
Open
akash2017sky wants to merge 6 commits into
Open
fix: brand outbound email templates with ZapDesk + KnowAll AI logos#378akash2017sky wants to merge 6 commits into
akash2017sky wants to merge 6 commits into
Conversation
…361) Outbound mail (ticket confirmation, agent reply, status change, test email) now picks up the same visual language as the ZapDesk UI and carries the KnowAll AI brand mark, so customers see branded support communication rather than a generic system notification. - Header: ZapDesk logo image (240x60 displayed, 480x120 source PNG generated from public/assets/logo.svg) replaces the text header. - Footer: KnowAll AI logo + "Powered by KnowAll AI" link, alongside the existing "Please reply to this email to update your ticket" line. - CTA button refined (12x24 padding, line-height: 1) so View Ticket buttons render the same in Outlook desktop and Gmail web. - Single layoutWrapper now used by all templates including the previously-inline sendTestEmail body. - Logo URLs are env-overridable (ZAPDESK_LOGO_URL, KNOWALL_LOGO_URL) for deployments where outbound mail can't reach APP_URL — defaults point at the new public/email/ assets so local dev works out of box. - Light/dark color-scheme meta added; logos use transparent backgrounds so they read correctly on both white and dark email backgrounds. - scripts/generate-email-assets.mjs regenerates the ZapDesk PNG from logo.svg via sharp; scripts/preview-email-templates.mjs renders all templates to a local email-preview.html (gitignored) for visual review without sending real mail. knowall-logo.png is shipped as a transparent placeholder — replace it with the real KnowAll AI logo before merge. Closes #361 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adding ZAPDESK_LOGO_URL and KNOWALL_LOGO_URL pushed the description and required columns past the existing padding. Re-run prettier to widen the columns so format:check passes on CI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates outbound email rendering to use a shared branded HTML layout (ZapDesk logo header + KnowAll AI footer) across all core templates, and adds local tooling to preview/regenerate email assets.
Changes:
- Exported and expanded
layoutWrapperto include logo header/footer, CTA refinements, and light/dark color-scheme meta tags. - Updated
sendTestEmailto reuse the shared email layout for consistency. - Added scripts to (a) generate email PNG assets from the main SVG and (b) render a local multi-template preview HTML, plus gitignore/docs updates.
Reviewed changes
Copilot reviewed 5 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/email.ts | Switches test email HTML to use the shared layoutWrapper. |
| src/lib/email-templates.ts | Adds branded header/footer and exports layoutWrapper; introduces env-overridable logo URLs and dark-mode meta tags. |
| scripts/preview-email-templates.mjs | New local preview generator that writes email-preview.html for visual review. |
| scripts/generate-email-assets.mjs | New asset generator using sharp to produce PNG email logos. |
| public/email/zapdesk-logo.png | Adds/updates the ZapDesk email logo PNG asset. |
| public/email/knowall-logo.png | Adds a KnowAll AI email logo asset (currently described as a placeholder in PR). |
| .gitignore | Ignores the generated email-preview.html. |
| CLAUDE.md | Documents the new logo URL environment variables. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+16
to
+28
| // Minimal transparent placeholder so the path resolves in dev. Replace | ||
| // before merge with the real KnowAll AI logo (PNG, transparent, ~480x120). | ||
| await sharp({ | ||
| create: { | ||
| width: 480, | ||
| height: 120, | ||
| channels: 4, | ||
| background: { r: 0, g: 0, b: 0, alpha: 0 }, | ||
| }, | ||
| }) | ||
| .png() | ||
| .toFile('public/email/knowall-logo.png'); | ||
| console.log('wrote public/email/knowall-logo.png (480x120 transparent placeholder)'); |
Comment on lines
+189
to
+206
| | Variable | Description | Required | | ||
| | ----------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------- | | ||
| | `NEXTAUTH_URL` | Base URL of the application | Yes | | ||
| | `NEXTAUTH_SECRET` | Secret for NextAuth encryption | Yes | | ||
| | `AZURE_AD_CLIENT_ID` | Azure AD application client ID | Yes | | ||
| | `AZURE_AD_CLIENT_SECRET` | Azure AD application client secret | Yes | | ||
| | `AZURE_AD_TENANT_ID` | Azure AD tenant ID (or 'common') | Yes | | ||
| | `AZURE_DEVOPS_ORG` | Azure DevOps organization name | Yes | | ||
| | `AZURE_DEVOPS_PAT` | Personal Access Token for service account | For email integration | | ||
| | `EMAIL_WEBHOOK_SECRET` | Shared secret for `/api/email/poll` and `/api/email/webhook` | For email integration | | ||
| | `MAIL_POLL_MAILBOX` | Mailbox ZapDesk polls for inbound email | For inbound email | | ||
| | `MAIL_FROM` | Sender address for outbound mail | For outbound email | | ||
| | `MAIL_FROM_NAME` | Display name for outbound mail | No (default: ZapDesk Support) | | ||
| | `MAIL_TENANT_ID` | Tenant ID for the dedicated mail Azure AD app | For email integration | | ||
| | `MAIL_CLIENT_ID` | Client ID for the dedicated mail Azure AD app | For email integration | | ||
| | `MAIL_CLIENT_SECRET` | Client secret for the dedicated mail Azure AD app | For email integration | | ||
| | `ZAPDESK_LOGO_URL` | Override URL for the ZapDesk logo in outbound email | No (default: `${APP_URL}/email/zapdesk-logo.png`) | | ||
| | `KNOWALL_LOGO_URL` | Override URL for the KnowAll AI logo in the outbound email footer | No (default: `${APP_URL}/email/knowall-logo.png`) | |
- Guard knowall-logo.png from being overwritten by the asset script: only write the transparent placeholder if the file does not already exist, so re-running the script never clobbers the real logo once it is dropped in. - Document APP_URL in CLAUDE.md env-var table — it controls the base URL for outbound email links and asset paths (falls back to NEXTAUTH_URL), which ZAPDESK_LOGO_URL / KNOWALL_LOGO_URL defaults reference. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
All four outbound email templates (
ticketConfirmationTemplate,agentReplyTemplate,statusChangeTemplate,sendTestEmail) now share a single branded layout: ZapDesk logo at the top, KnowAll AI logo + link in the footer, and a refined CTA button that reads consistently across Gmail web, Outlook desktop, Outlook web and Apple Mail.public/email/folder hosts the PNG assets, referenced by absolute URL so any email client can fetch them.public/assets/logo.svgviasharp(script:scripts/generate-email-assets.mjs) — single source of truth, regeneratable.ZAPDESK_LOGO_URL,KNOWALL_LOGO_URL) for deployments where outbound mail can't reachAPP_URL(e.g. internal-only app URL).⚠ Action required before merge — KnowAll AI logo
public/email/knowall-logo.pngin this PR is a 480×120 transparent placeholder so the path resolves and CI passes. It needs to be replaced with the real KnowAll AI logo before this PR is merged.How to upload the real logo
public/email/knowall-logo.pngwidth=120 height=30only as hints; the image's natural aspect ratio is preserved bymax-width: 100%; height: auto. But 4:1 will look the most balanced beside the ZapDesk logo.git add public/email/knowall-logo.png git commit -m "Add KnowAll AI logo for outbound email footer" git pushbun run scripts/preview-email-templates.mjsthen openemail-preview.html.(The ZapDesk logo at
public/email/zapdesk-logo.pngis already correct — it's auto-generated frompublic/assets/logo.svg. Iflogo.svgever changes, regenerate viabun run scripts/generate-email-assets.mjs.)Fixes
Fixes #361
Acceptance criteria
View Ticket #N) matches the in-app primary button style (#22c55e, rounded, white text)<img>with explicitwidth/heightto avoid layout shift in slow-rendering clients${APP_URL}/email/...Files changed
src/lib/email-templates.ts— new brandedlayoutWrapper(logo header, KnowAll footer, refined CTA, dark-mode meta), exported soemail.tscan reuse it.src/lib/email.ts—sendTestEmailnow useslayoutWrapperinstead of inline HTML so the test email matches the rest.public/email/zapdesk-logo.png— generated frompublic/assets/logo.svg.public/email/knowall-logo.png— transparent placeholder, see action-required section above.scripts/generate-email-assets.mjs— regenerator for the ZapDesk PNG.scripts/preview-email-templates.mjs— renders all templates to a localemail-preview.html(gitignored) for visual review..gitignore— excludeemail-preview.html.CLAUDE.md— documentsZAPDESK_LOGO_URLandKNOWALL_LOGO_URL.New env vars
ZAPDESK_LOGO_URL${APP_URL}/email/zapdesk-logo.png)KNOWALL_LOGO_URL${APP_URL}/email/knowall-logo.png)Test plan
Local preview (no email sent)
bun run scripts/preview-email-templates.mjsemail-preview.htmlin a browser. Confirm:bun run devrunning solocalhost:3000/email/zapdesk-logo.pngresolves).Live email send
MAIL_*env vars andMAIL_FROMare set; restartbun run dev./admin, click "Send test email", enter your email address.Inbound-driven templates
[ZapDesk #N]tag) → triggerssendTicketConfirmation→ confirmation email lands in the customer inbox with new layout.sendStatusChangeNotification→ status-change email lands with new layout.sendAgentReply→ reply email lands with new layout (and history block, if there's prior conversation).Cross-client rendering check (after real logo is in place)
Send a test email to addresses on each client and verify logos render and layout holds:
Automated checks
bun run typecheck— passesbun run lint— passes (4 pre-existing warnings, unrelated)bunx prettier --checkon changed files — passesOut of scope
🤖 Generated with Claude Code