export type SendEmailArguments = { from?: string; to: string; /** * Address replies should go to when it differs from `from` — e.g. the contact * form, where the email is sent from the store's notification address but the * merchant wants Reply to reach the visitor. Declared so it survives typing; * honoring it is still up to the registered email service, so senders that * depend on it should also put the address in the body. */ replyTo?: string; subject: string; body?: string; template: string; data: EmailData; /** * Locale to render this email in (subject is translated by the caller; this drives the * body's currency/date formatting). Off-request (D7) there is no ALS locale, so callers * resolve it explicitly. Defaults to `getStoreLanguage()` when omitted. Forward-compat: * a caller can pass an order/customer's preferred locale once that is persisted. */ locale?: string; [key: string]: unknown; }; /** * Validates email arguments to ensure they meet the required format. * @param args - The arguments to validate * @throws Will throw an error if validation fails */ export declare function validateSendEmailArguments(args: unknown): asserts args is SendEmailArguments; export interface EmailService { sendEmail: (args: SendEmailArguments) => Promise; } /** * Retrieves the registered email service from the registry. * @returns The email service object. */ export declare function getEmailService(): EmailService | undefined; /** Registers a new email service. * @param service - The email service to register. * @throws Will throw an error if the service does not implement the EmailService interface. */ export declare function registerEmailService(service: EmailService): void; /** * Sends an email using the registered email service. * @param id - The identifier for the email type, e.g., 'order_confirmation' * @param args - The email arguments * @returns A promise that resolves when the email is sent. */ export declare function sendEmail(id: string, args: SendEmailArguments): Promise; export interface EmailData { storeInfo?: { logo?: { src?: string; alt?: string; height?: string; width?: string; }; storeName: string; storeEmail: string; storeDescription: string; phone: string; homeUrl: string; /** * The store's own address. Keys are the store settings' own names (kept, * D-29); `formatted` is the display, ready to print, added by the * Address Format Registry. */ address: { country?: string; province?: string; city?: string; street?: string; postalCode?: string; formatted?: string[]; }; }; brand?: { accentColor?: string; }; [key: string]: unknown; } /** * Builds email body from a template by replacing placeholders with actual data. * @param template - The email template string with placeholders in {{key}} format. * @param data - An object containing key-value pairs to replace in the template. * @returns The final email body string with placeholders replaced by actual data. */ export declare function buildEmailBodyFromTemplate(template: string, data: EmailData, locale?: string): Promise;