* fix(email): make team org invites more transactional Use org-branded sender and subject instead of the default "Best from ClassroomIO" marketing identity. Include the inviter name in the body, remove promotional emojis, and thread optional subject overrides through the email job pipeline. Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com> * fix(email): escape invite fields and sanitize email headers Address Greptile review: escape inviter/org/role values in the team invite template, sanitize display names in buildEmailFromName, and strip control characters from dynamic subjects. Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com> * fix(email): use RFC 5322 backslash escaping in display names Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com> * test(email): add vitest coverage for email header helpers Cover escapeHtml, sanitizeEmailDisplayName, sanitizeEmailSubject, and buildEmailFromName. Collapse repeated whitespace when stripping control characters from header values. Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com> * fix(email): strip all ASCII control chars from email headers Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com>
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
/**
|
|
* @cio/email - Unified Email Package
|
|
*
|
|
* Declarative schema-only email system with unified send() API
|
|
*
|
|
* @example
|
|
* ```ts
|
|
* import { sendEmail } from '@cio/email';
|
|
*
|
|
* await sendEmail('forgotPassword', {
|
|
* to: 'user@example.com',
|
|
* fields: {
|
|
* name: 'John Doe',
|
|
* email: 'user@example.com',
|
|
* link: 'https://app.classroomio.com/reset?token=abc123'
|
|
* }
|
|
* });
|
|
* ```
|
|
*/
|
|
|
|
// Pre-import all emails to register them in the registry
|
|
import './emails/index';
|
|
|
|
// Export unified API
|
|
export { sendEmail, defineEmail } from './send';
|
|
|
|
// Export types for advanced usage
|
|
export type { EmailTemplate, EmailDefinition, SendConfig, DefineEmailConfig } from './core/types';
|
|
export type { EmailId, EmailSchemaFor } from './utils/types';
|
|
|
|
// Re-export low-level utilities
|
|
export { deliverEmail } from './send';
|
|
export { buildEmailFromName, escapeHtml, sanitizeEmailSubject } from './utils/functions/email-helpers';
|
|
export { getDefaultTemplate } from './templates/default';
|
|
export { buildEmailBranding, resolveThemeColor, ZEmailBranding } from './core/branding';
|
|
export { buildSessionIcs, type SessionIcsInput } from './ics';
|
|
export type { EmailBranding } from './core/branding';
|
|
|
|
// Export email registry for introspection (optional)
|
|
export { EmailRegistry } from './core/registry';
|