/** * Email Template Preview API Route Handler for Next.js * * Renders a template with sample data to preview the interpolated output. * Re-export in your Next.js application at /api/email-templates/[id]/preview. * * @example * ```typescript * // In your Next.js app: app/api/email-templates/[id]/preview/route.ts * export { POST } from 'nextly/api/email-templates-preview'; * ``` * * The rendered subject/html stay JSON-encoded inside `data` (no raw HTML * response; admin renders the preview in an iframe sandbox). * * @module api/email-templates-preview */ interface RouteContext { params: Promise<{ id: string; }>; } /** * POST handler for previewing an email template with sample data. * * Renders the template by replacing `{{variable}}` placeholders with values * from the provided `data` object. Supports dot-notation for nested values * (e.g., `{{user.name}}`). HTML-escapes interpolated values by default. * Wraps with shared layout (header/footer) when the template has * `useLayout: true`. * * Requires authentication. * * Request Body: * - data: Object with key-value pairs for variable interpolation (required) * * Response Codes: * - 200 OK: Preview rendered successfully * - 400 Bad Request: Invalid input * - 401 Unauthorized: Authentication required * - 404 Not Found: Template with ID does not exist * - 500 Internal Server Error: Preview failed * * Response: `{ "data": { "subject": string, "html": string } }` */ declare const POST: (request: Request, context: RouteContext) => Promise; export { POST };