diff --git a/src/index.ts b/src/index.ts index a5c0995..bb6cd5b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,7 +16,7 @@ export { mailingJobs, sendEmailJob } from './jobs/index.js' export type { SendEmailTaskInput } from './jobs/sendEmailTask.js' // Main email sending function -export { sendEmail, type SendEmailOptions, type BaseEmailDocument } from './sendEmail.js' +export { sendEmail, type SendEmailOptions } from './sendEmail.js' export { default as sendEmailDefault } from './sendEmail.js' // Utility functions for developers diff --git a/src/jobs/sendEmailTask.ts b/src/jobs/sendEmailTask.ts index 9c65f6f..77ed254 100644 --- a/src/jobs/sendEmailTask.ts +++ b/src/jobs/sendEmailTask.ts @@ -1,4 +1,5 @@ -import { sendEmail, BaseEmailDocument } from '../sendEmail.js' +import { sendEmail } from '../sendEmail.js' +import { BaseEmailDocument } from '../types/index.js' export interface SendEmailTaskInput { // Template mode fields diff --git a/src/sendEmail.ts b/src/sendEmail.ts index e38f01e..63452b4 100644 --- a/src/sendEmail.ts +++ b/src/sendEmail.ts @@ -1,29 +1,6 @@ import { Payload } from 'payload' import { getMailing, renderTemplate, parseAndValidateEmails } from './utils/helpers.js' - -// Generic email interface that can work with any ID type -export interface BaseEmailDocument { - id: string | number - template?: any - to: string[] - cc?: string[] - bcc?: string[] - from?: string - replyTo?: string - subject: string - html: string - text?: string - variables?: Record - scheduledAt?: string - sentAt?: string - status?: 'pending' | 'processing' | 'sent' | 'failed' - attempts?: number - lastAttemptAt?: string - error?: string - priority?: number - createdAt?: string - updatedAt?: string -} +import { BaseEmailDocument } from './types/index.js' // Options for sending emails export interface SendEmailOptions {