/** * Resolve the per-port branding shell for transactional emails. * * Senders that have a portId call this once and pass the result into * the email template. Senders without a portId (e.g. CRM invite at * create-time before a port is selected) pass null — the shell * falls back to the Port Nimara defaults. */ import { getPortBrandingConfig } from '@/lib/services/port-config'; import type { BrandingShell } from '@/lib/email/shell'; export async function getBrandingShell( portId: string | null | undefined, ): Promise { if (!portId) return null; try { const cfg = await getPortBrandingConfig(portId); return { logoUrl: cfg.logoUrl, primaryColor: cfg.primaryColor, emailHeaderHtml: cfg.emailHeaderHtml, emailFooterHtml: cfg.emailFooterHtml, }; } catch { return null; } }