@emailens/engine 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +162 -7
  2. package/dist/{chunk-ZQF2XUIJ.js → chunk-2NMEKWO5.js} +2 -13
  3. package/dist/{chunk-3NDQOTPM.js → chunk-E4QE4WXE.js} +2 -2
  4. package/dist/{chunk-URZ4XPST.js → chunk-HBKZMR7V.js} +2 -2
  5. package/dist/{chunk-OY3DGZVU.js → chunk-PW6EUG2G.js} +2 -2
  6. package/dist/chunk-Z22AD2IU.js +14 -0
  7. package/dist/{chunk-ZQF2XUIJ.js.map → chunk-Z22AD2IU.js.map} +1 -1
  8. package/dist/compile/index.d.cts +2 -2
  9. package/dist/compile/index.d.ts +2 -2
  10. package/dist/compile/index.js +8 -7
  11. package/dist/compile/index.js.map +1 -1
  12. package/dist/index.cjs +3685 -507
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +80 -6
  15. package/dist/index.d.ts +80 -6
  16. package/dist/index.js +3678 -507
  17. package/dist/index.js.map +1 -1
  18. package/dist/maizzle-KKJF7XY7.js +9 -0
  19. package/dist/mjml-C46UWTTK.js +9 -0
  20. package/dist/react-email-C-p8ZL37.d.cts +58 -0
  21. package/dist/react-email-DcseUoOu.d.ts +58 -0
  22. package/dist/react-email-QKHRTEJW.js +9 -0
  23. package/dist/react-email-QKHRTEJW.js.map +1 -0
  24. package/dist/server.cjs +368 -0
  25. package/dist/server.cjs.map +1 -0
  26. package/dist/server.d.cts +80 -0
  27. package/dist/server.d.ts +80 -0
  28. package/dist/server.js +342 -0
  29. package/dist/server.js.map +1 -0
  30. package/dist/{react-email-BQljgXbo.d.cts → types-4P9AtKm_.d.cts} +65 -54
  31. package/dist/{react-email-BQljgXbo.d.ts → types-4P9AtKm_.d.ts} +65 -54
  32. package/package.json +13 -6
  33. package/dist/maizzle-Y2CLJ7GB.js +0 -8
  34. package/dist/mjml-D7IOYXXK.js +0 -8
  35. package/dist/react-email-4TW6IDAA.js +0 -8
  36. /package/dist/{maizzle-Y2CLJ7GB.js.map → chunk-2NMEKWO5.js.map} +0 -0
  37. /package/dist/{chunk-3NDQOTPM.js.map → chunk-E4QE4WXE.js.map} +0 -0
  38. /package/dist/{chunk-URZ4XPST.js.map → chunk-HBKZMR7V.js.map} +0 -0
  39. /package/dist/{chunk-OY3DGZVU.js.map → chunk-PW6EUG2G.js.map} +0 -0
  40. /package/dist/{mjml-D7IOYXXK.js.map → maizzle-KKJF7XY7.js.map} +0 -0
  41. /package/dist/{react-email-4TW6IDAA.js.map → mjml-C46UWTTK.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
- import { E as EmailClient, F as Framework, T as TransformResult, C as CSSWarning, a as CodeFix, D as DiffResult, b as ExportPromptOptions, A as AiProvider, c as AiFixResult, S as SpamAnalysisOptions, d as SpamReport, L as LinkReport, e as AccessibilityReport, I as ImageReport } from './react-email-BQljgXbo.cjs';
2
- export { f as AccessibilityIssue, g as CompileError, h as CompileReactEmailOptions, i as EstimateOptions, j as ExportScope, k as FixType, l as ImageInfo, m as ImageIssue, n as InputFormat, o as LinkIssue, P as PreviewResult, p as SandboxStrategy, q as SpamIssue, r as SupportLevel, s as TokenEstimate, t as TokenEstimateWithWarnings, u as estimateAiFixTokens, v as generateFixPrompt, w as heuristicTokenCount } from './react-email-BQljgXbo.cjs';
1
+ import { E as EmailClient, F as Framework, T as TransformResult, C as CSSWarning, a as CodeFix, D as DiffResult, b as ExportPromptOptions, A as AiProvider, c as AiFixResult, S as SupportLevel, d as SpamAnalysisOptions, e as SpamReport, L as LinkReport, f as AccessibilityReport, I as ImageReport, g as InboxPreview, h as SizeReport, i as TemplateReport, j as DeliverabilityReport } from './types-4P9AtKm_.cjs';
2
+ export { k as AccessibilityIssue, l as ClientTruncation, m as DeliverabilityCheck, n as DeliverabilityIssue, o as EstimateOptions, p as ExportScope, q as FixType, r as ImageInfo, s as ImageIssue, t as InboxPreviewIssue, u as InputFormat, v as LinkIssue, P as PreviewResult, w as SizeIssue, x as SpamIssue, y as TemplateIssue, z as TokenEstimate, B as TokenEstimateWithWarnings, G as estimateAiFixTokens, H as generateFixPrompt, J as heuristicTokenCount } from './types-4P9AtKm_.cjs';
3
+ export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy } from './react-email-C-p8ZL37.cjs';
3
4
 
4
5
  declare const EMAIL_CLIENTS: EmailClient[];
5
6
  declare function getClient(id: string): EmailClient | undefined;
@@ -153,18 +154,52 @@ declare function generateAiFix(options: GenerateAiFixOptions): Promise<AiFixResu
153
154
  */
154
155
  declare const AI_FIX_SYSTEM_PROMPT = "You are an expert email developer specializing in cross-client HTML email compatibility. You fix emails to render correctly across all email clients.\n\nRules:\n- Return ONLY the fixed code inside a single code fence. No explanations before or after.\n- Preserve all existing content, text, links, and visual design.\n- For structural issues (fixType: \"structural\"), you MUST restructure the HTML \u2014 CSS-only changes will not work.\n- Common structural patterns:\n - word-break/overflow-wrap unsupported \u2192 wrap text in <table><tr><td> with constrained width\n - display:flex/grid \u2192 convert to <table> layout (match the original column count and proportions)\n - border-radius in Outlook \u2192 use VML <v:roundrect> with <!--[if mso]> conditionals\n - background-image in Outlook \u2192 use VML <v:rect> with <v:fill>\n - max-width in Outlook \u2192 wrap in <!--[if mso]><table width=\"N\"> conditional\n - position:absolute \u2192 use <table> cells for layout\n - <svg> \u2192 replace with <img> pointing to a hosted PNG\n- For CSS-only issues (fixType: \"css\"), swap properties or add fallbacks.\n- Apply ALL fixes from the issues list \u2014 do not skip any.\n- Use the framework syntax specified (JSX/MJML/Maizzle/HTML).\n- For JSX: use camelCase style props, React Email components, and proper TypeScript types.\n- For MJML: use mj-* elements and attributes.\n- For Maizzle: use Tailwind CSS classes.";
155
156
 
157
+ /**
158
+ * CSS/HTML feature support matrix — auto-generated from caniemail.com.
159
+ * Last synced: 2026-03-02
160
+ * caniemail last updated: 2026-02-16 15:39:06 +0000
161
+ *
162
+ * 251 features across 12 email clients.
163
+ *
164
+ * Support levels:
165
+ * - "supported": fully supported
166
+ * - "partial": partially supported (with caveats)
167
+ * - "unsupported": not supported at all
168
+ * - "unknown": no data available
169
+ *
170
+ * Data sources:
171
+ * - Most clients: caniemail.com API (verified data)
172
+ * - hey-mail: caniemail.com (WebKit-based)
173
+ * - superhuman: Manual overrides (Chromium/Blink-based, best-effort estimates)
174
+ *
175
+ * DO NOT EDIT — regenerate with: bun run sync:caniemail
176
+ */
177
+ declare const CSS_SUPPORT: Record<string, Record<string, SupportLevel>>;
156
178
  /**
157
179
  * Properties that require HTML structural changes (not just CSS swaps)
158
180
  * to fix. These cannot be solved by replacing one CSS value with another.
159
181
  */
160
182
  declare const STRUCTURAL_FIX_PROPERTIES: Set<string>;
183
+ /** HTML element features in the support matrix (for data-driven detection). */
184
+ declare const HTML_ELEMENT_FEATURES: readonly ["<abbr>", "<acronym>", "<address>", "<audio>", "<base>", "<bdi>", "<blockquote>", "<body>", "<code>", "<del>", "<dfn>", "<dialog>", "<div>", "<form>", "<h1>", "<hr>", "<img>", "<link>", "<marquee>", "<meter>", "<object>", "<p>", "<picture>", "<pre>", "<progress>", "<rp>", "<rt>", "<ruby>", "<select>", "<small>", "<span>", "<strike>", "<strong>", "<style>", "<svg>", "<table>", "<textarea>", "<ul>", "<video>", "<wbr>"];
185
+ /** CSS at-rule features in the support matrix. */
186
+ declare const AT_RULE_FEATURES: readonly ["@font-face", "@import", "@keyframes", "@media", "@supports"];
187
+ /** Compound CSS value features (e.g., "display:flex"). */
188
+ declare const COMPOUND_VALUE_FEATURES: readonly ["::after", "::before", "::first-letter", "::first-line", "::marker", "::placeholder", ":adjacent-sibling", ":attribute-selector", ":chaining", ":checked", ":child-combinator", ":class-selector", ":descendant-combinator", ":first-child", ":first-of-type", ":focus", ":general-sibling", ":grouping", ":has", ":hover", ":id-selector", ":lang", ":last-child", ":last-of-type", ":link", ":not", ":nth-child", ":nth-last-child", ":nth-of-type", ":only-child", ":only-of-type", ":target", ":type-selector", ":universal-selector", ":visited", "display:flex", "display:grid", "display:none"];
189
+ /** CSS function features (e.g., "linear-gradient"). */
190
+ declare const CSS_FUNCTION_FEATURES: readonly ["calc", "clamp", "conic-gradient", "fit-content", "linear-gradient", "max", "min", "radial-gradient"];
161
191
 
162
192
  /**
163
- * Analyze an HTML email for spam indicators.
193
+ * Analyze an HTML email for content hygiene issues.
164
194
  *
165
- * Returns a 0-100 score (100 = clean, 0 = very spammy) and an array
195
+ * Returns a 0-100 score (100 = clean, 0 = many issues) and an array
166
196
  * of issues found. Uses heuristic rules modeled after common spam
167
197
  * filter triggers (CAN-SPAM, GDPR, SpamAssassin patterns).
198
+ *
199
+ * **Important:** This is heuristic content analysis, NOT a real spam
200
+ * filter. It checks for common anti-patterns that trigger spam filters
201
+ * but cannot predict actual inbox placement. For real spam testing,
202
+ * use SpamAssassin integration or a dedicated service like GlockApps.
168
203
  */
169
204
  declare function analyzeSpam(html: string, options?: SpamAnalysisOptions): SpamReport;
170
205
 
@@ -195,12 +230,41 @@ declare function checkAccessibility(html: string): AccessibilityReport;
195
230
  */
196
231
  declare function analyzeImages(html: string): ImageReport;
197
232
 
233
+ /**
234
+ * Extract subject and preheader text from the email HTML, plus
235
+ * flag common issues (missing title, length problems, etc.).
236
+ *
237
+ * The subject comes from the `<title>` tag. The preheader is extracted
238
+ * from the first visible text in `<body>`, including hidden preheader
239
+ * hacks (zero-width divs, display:none spans, etc.).
240
+ */
241
+ declare function extractInboxPreview(html: string): InboxPreview;
242
+
243
+ /**
244
+ * Check email HTML size for Gmail clipping issues.
245
+ *
246
+ * Returns byte count, human-readable size, clip status, and issues.
247
+ * Gmail clips messages larger than ~102 KB, hiding content behind a
248
+ * "View entire message" link.
249
+ */
250
+ declare function checkSize(html: string): SizeReport;
251
+
252
+ /**
253
+ * Scan HTML email for unresolved template/merge variables.
254
+ *
255
+ * Detects patterns like `{{var}}`, `${var}`, `<%= %>`, `*|TAG|*`,
256
+ * `%%tag%%`, and `{merge_field}` in text content and key attributes.
257
+ *
258
+ * Returns the count of unresolved variables and detailed issues.
259
+ */
260
+ declare function checkTemplateVariables(html: string): TemplateReport;
261
+
198
262
  interface AuditOptions {
199
263
  framework?: Framework;
200
264
  /** Options for spam analysis */
201
265
  spam?: SpamAnalysisOptions;
202
266
  /** Skip specific checks */
203
- skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility">;
267
+ skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility" | "inboxPreview" | "size" | "templateVariables">;
204
268
  }
205
269
  interface AuditReport {
206
270
  compatibility: {
@@ -216,6 +280,9 @@ interface AuditReport {
216
280
  links: LinkReport;
217
281
  accessibility: AccessibilityReport;
218
282
  images: ImageReport;
283
+ inboxPreview: InboxPreview;
284
+ size: SizeReport;
285
+ templateVariables: TemplateReport;
219
286
  }
220
287
  /**
221
288
  * Run all email analysis checks in a single call.
@@ -277,6 +344,12 @@ interface EmailSession {
277
344
  checkAccessibility(): AccessibilityReport;
278
345
  /** Analyze images (shares pre-parsed DOM). */
279
346
  analyzeImages(): ImageReport;
347
+ /** Extract subject line and preheader text (shares pre-parsed DOM). */
348
+ extractInboxPreview(): InboxPreview;
349
+ /** Check email size for Gmail clipping (needs raw HTML for byte count). */
350
+ checkSize(): SizeReport;
351
+ /** Scan for unresolved template/merge variables (shares pre-parsed DOM). */
352
+ checkTemplateVariables(): TemplateReport;
280
353
  /**
281
354
  * Transform HTML for a specific client.
282
355
  *
@@ -337,6 +410,7 @@ declare function createSession(html: string, options?: CreateSessionOptions): Em
337
410
  /** Maximum HTML input size: 2MB. Inputs exceeding this are rejected early. */
338
411
  declare const MAX_HTML_SIZE: number;
339
412
  declare const GENERIC_LINK_TEXT: Set<string>;
413
+ declare const EMPTY_DELIVERABILITY: DeliverabilityReport;
340
414
 
341
415
  /**
342
416
  * WCAG 2.1 color parsing, luminance, and contrast utilities.
@@ -375,4 +449,4 @@ declare function wcagGrade(ratio: number): WcagGrade;
375
449
  */
376
450
  declare function alphaBlend(fg: RGBA, bgR: number, bgG: number, bgB: number): [number, number, number];
377
451
 
378
- export { AI_FIX_SYSTEM_PROMPT, AccessibilityReport, AiFixResult, AiProvider, type AuditOptions, type AuditReport, CSSWarning, CodeFix, type CreateSessionOptions, DiffResult, EMAIL_CLIENTS, EmailClient, type EmailSession, ExportPromptOptions, Framework, GENERIC_LINK_TEXT, type GenerateAiFixOptions, ImageReport, LinkReport, MAX_HTML_SIZE, type RGBA, STRUCTURAL_FIX_PROPERTIES, SpamAnalysisOptions, SpamReport, TransformResult, type WcagGrade, alphaBlend, analyzeEmail, analyzeImages, analyzeSpam, auditEmail, checkAccessibility, contrastRatio, createSession, diffResults, errorWarnings, generateAiFix, generateCompatibilityScore, getClient, getCodeFix, getSuggestion, parseColor, relativeLuminance, simulateDarkMode, structuralWarnings, transformForAllClients, transformForClient, validateLinks, warningsForClient, wcagGrade };
452
+ export { AI_FIX_SYSTEM_PROMPT, AT_RULE_FEATURES, AccessibilityReport, AiFixResult, AiProvider, type AuditOptions, type AuditReport, COMPOUND_VALUE_FEATURES, CSSWarning, CSS_FUNCTION_FEATURES, CSS_SUPPORT, CodeFix, type CreateSessionOptions, DeliverabilityReport, DiffResult, EMAIL_CLIENTS, EMPTY_DELIVERABILITY, EmailClient, type EmailSession, ExportPromptOptions, Framework, GENERIC_LINK_TEXT, type GenerateAiFixOptions, HTML_ELEMENT_FEATURES, ImageReport, InboxPreview, LinkReport, MAX_HTML_SIZE, type RGBA, STRUCTURAL_FIX_PROPERTIES, SizeReport, SpamAnalysisOptions, SpamReport, SupportLevel, TemplateReport, TransformResult, type WcagGrade, alphaBlend, analyzeEmail, analyzeImages, analyzeSpam, auditEmail, checkAccessibility, checkSize, checkTemplateVariables, contrastRatio, createSession, diffResults, errorWarnings, extractInboxPreview, generateAiFix, generateCompatibilityScore, getClient, getCodeFix, getSuggestion, parseColor, relativeLuminance, simulateDarkMode, structuralWarnings, transformForAllClients, transformForClient, validateLinks, warningsForClient, wcagGrade };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { E as EmailClient, F as Framework, T as TransformResult, C as CSSWarning, a as CodeFix, D as DiffResult, b as ExportPromptOptions, A as AiProvider, c as AiFixResult, S as SpamAnalysisOptions, d as SpamReport, L as LinkReport, e as AccessibilityReport, I as ImageReport } from './react-email-BQljgXbo.js';
2
- export { f as AccessibilityIssue, g as CompileError, h as CompileReactEmailOptions, i as EstimateOptions, j as ExportScope, k as FixType, l as ImageInfo, m as ImageIssue, n as InputFormat, o as LinkIssue, P as PreviewResult, p as SandboxStrategy, q as SpamIssue, r as SupportLevel, s as TokenEstimate, t as TokenEstimateWithWarnings, u as estimateAiFixTokens, v as generateFixPrompt, w as heuristicTokenCount } from './react-email-BQljgXbo.js';
1
+ import { E as EmailClient, F as Framework, T as TransformResult, C as CSSWarning, a as CodeFix, D as DiffResult, b as ExportPromptOptions, A as AiProvider, c as AiFixResult, S as SupportLevel, d as SpamAnalysisOptions, e as SpamReport, L as LinkReport, f as AccessibilityReport, I as ImageReport, g as InboxPreview, h as SizeReport, i as TemplateReport, j as DeliverabilityReport } from './types-4P9AtKm_.js';
2
+ export { k as AccessibilityIssue, l as ClientTruncation, m as DeliverabilityCheck, n as DeliverabilityIssue, o as EstimateOptions, p as ExportScope, q as FixType, r as ImageInfo, s as ImageIssue, t as InboxPreviewIssue, u as InputFormat, v as LinkIssue, P as PreviewResult, w as SizeIssue, x as SpamIssue, y as TemplateIssue, z as TokenEstimate, B as TokenEstimateWithWarnings, G as estimateAiFixTokens, H as generateFixPrompt, J as heuristicTokenCount } from './types-4P9AtKm_.js';
3
+ export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy } from './react-email-DcseUoOu.js';
3
4
 
4
5
  declare const EMAIL_CLIENTS: EmailClient[];
5
6
  declare function getClient(id: string): EmailClient | undefined;
@@ -153,18 +154,52 @@ declare function generateAiFix(options: GenerateAiFixOptions): Promise<AiFixResu
153
154
  */
154
155
  declare const AI_FIX_SYSTEM_PROMPT = "You are an expert email developer specializing in cross-client HTML email compatibility. You fix emails to render correctly across all email clients.\n\nRules:\n- Return ONLY the fixed code inside a single code fence. No explanations before or after.\n- Preserve all existing content, text, links, and visual design.\n- For structural issues (fixType: \"structural\"), you MUST restructure the HTML \u2014 CSS-only changes will not work.\n- Common structural patterns:\n - word-break/overflow-wrap unsupported \u2192 wrap text in <table><tr><td> with constrained width\n - display:flex/grid \u2192 convert to <table> layout (match the original column count and proportions)\n - border-radius in Outlook \u2192 use VML <v:roundrect> with <!--[if mso]> conditionals\n - background-image in Outlook \u2192 use VML <v:rect> with <v:fill>\n - max-width in Outlook \u2192 wrap in <!--[if mso]><table width=\"N\"> conditional\n - position:absolute \u2192 use <table> cells for layout\n - <svg> \u2192 replace with <img> pointing to a hosted PNG\n- For CSS-only issues (fixType: \"css\"), swap properties or add fallbacks.\n- Apply ALL fixes from the issues list \u2014 do not skip any.\n- Use the framework syntax specified (JSX/MJML/Maizzle/HTML).\n- For JSX: use camelCase style props, React Email components, and proper TypeScript types.\n- For MJML: use mj-* elements and attributes.\n- For Maizzle: use Tailwind CSS classes.";
155
156
 
157
+ /**
158
+ * CSS/HTML feature support matrix — auto-generated from caniemail.com.
159
+ * Last synced: 2026-03-02
160
+ * caniemail last updated: 2026-02-16 15:39:06 +0000
161
+ *
162
+ * 251 features across 12 email clients.
163
+ *
164
+ * Support levels:
165
+ * - "supported": fully supported
166
+ * - "partial": partially supported (with caveats)
167
+ * - "unsupported": not supported at all
168
+ * - "unknown": no data available
169
+ *
170
+ * Data sources:
171
+ * - Most clients: caniemail.com API (verified data)
172
+ * - hey-mail: caniemail.com (WebKit-based)
173
+ * - superhuman: Manual overrides (Chromium/Blink-based, best-effort estimates)
174
+ *
175
+ * DO NOT EDIT — regenerate with: bun run sync:caniemail
176
+ */
177
+ declare const CSS_SUPPORT: Record<string, Record<string, SupportLevel>>;
156
178
  /**
157
179
  * Properties that require HTML structural changes (not just CSS swaps)
158
180
  * to fix. These cannot be solved by replacing one CSS value with another.
159
181
  */
160
182
  declare const STRUCTURAL_FIX_PROPERTIES: Set<string>;
183
+ /** HTML element features in the support matrix (for data-driven detection). */
184
+ declare const HTML_ELEMENT_FEATURES: readonly ["<abbr>", "<acronym>", "<address>", "<audio>", "<base>", "<bdi>", "<blockquote>", "<body>", "<code>", "<del>", "<dfn>", "<dialog>", "<div>", "<form>", "<h1>", "<hr>", "<img>", "<link>", "<marquee>", "<meter>", "<object>", "<p>", "<picture>", "<pre>", "<progress>", "<rp>", "<rt>", "<ruby>", "<select>", "<small>", "<span>", "<strike>", "<strong>", "<style>", "<svg>", "<table>", "<textarea>", "<ul>", "<video>", "<wbr>"];
185
+ /** CSS at-rule features in the support matrix. */
186
+ declare const AT_RULE_FEATURES: readonly ["@font-face", "@import", "@keyframes", "@media", "@supports"];
187
+ /** Compound CSS value features (e.g., "display:flex"). */
188
+ declare const COMPOUND_VALUE_FEATURES: readonly ["::after", "::before", "::first-letter", "::first-line", "::marker", "::placeholder", ":adjacent-sibling", ":attribute-selector", ":chaining", ":checked", ":child-combinator", ":class-selector", ":descendant-combinator", ":first-child", ":first-of-type", ":focus", ":general-sibling", ":grouping", ":has", ":hover", ":id-selector", ":lang", ":last-child", ":last-of-type", ":link", ":not", ":nth-child", ":nth-last-child", ":nth-of-type", ":only-child", ":only-of-type", ":target", ":type-selector", ":universal-selector", ":visited", "display:flex", "display:grid", "display:none"];
189
+ /** CSS function features (e.g., "linear-gradient"). */
190
+ declare const CSS_FUNCTION_FEATURES: readonly ["calc", "clamp", "conic-gradient", "fit-content", "linear-gradient", "max", "min", "radial-gradient"];
161
191
 
162
192
  /**
163
- * Analyze an HTML email for spam indicators.
193
+ * Analyze an HTML email for content hygiene issues.
164
194
  *
165
- * Returns a 0-100 score (100 = clean, 0 = very spammy) and an array
195
+ * Returns a 0-100 score (100 = clean, 0 = many issues) and an array
166
196
  * of issues found. Uses heuristic rules modeled after common spam
167
197
  * filter triggers (CAN-SPAM, GDPR, SpamAssassin patterns).
198
+ *
199
+ * **Important:** This is heuristic content analysis, NOT a real spam
200
+ * filter. It checks for common anti-patterns that trigger spam filters
201
+ * but cannot predict actual inbox placement. For real spam testing,
202
+ * use SpamAssassin integration or a dedicated service like GlockApps.
168
203
  */
169
204
  declare function analyzeSpam(html: string, options?: SpamAnalysisOptions): SpamReport;
170
205
 
@@ -195,12 +230,41 @@ declare function checkAccessibility(html: string): AccessibilityReport;
195
230
  */
196
231
  declare function analyzeImages(html: string): ImageReport;
197
232
 
233
+ /**
234
+ * Extract subject and preheader text from the email HTML, plus
235
+ * flag common issues (missing title, length problems, etc.).
236
+ *
237
+ * The subject comes from the `<title>` tag. The preheader is extracted
238
+ * from the first visible text in `<body>`, including hidden preheader
239
+ * hacks (zero-width divs, display:none spans, etc.).
240
+ */
241
+ declare function extractInboxPreview(html: string): InboxPreview;
242
+
243
+ /**
244
+ * Check email HTML size for Gmail clipping issues.
245
+ *
246
+ * Returns byte count, human-readable size, clip status, and issues.
247
+ * Gmail clips messages larger than ~102 KB, hiding content behind a
248
+ * "View entire message" link.
249
+ */
250
+ declare function checkSize(html: string): SizeReport;
251
+
252
+ /**
253
+ * Scan HTML email for unresolved template/merge variables.
254
+ *
255
+ * Detects patterns like `{{var}}`, `${var}`, `<%= %>`, `*|TAG|*`,
256
+ * `%%tag%%`, and `{merge_field}` in text content and key attributes.
257
+ *
258
+ * Returns the count of unresolved variables and detailed issues.
259
+ */
260
+ declare function checkTemplateVariables(html: string): TemplateReport;
261
+
198
262
  interface AuditOptions {
199
263
  framework?: Framework;
200
264
  /** Options for spam analysis */
201
265
  spam?: SpamAnalysisOptions;
202
266
  /** Skip specific checks */
203
- skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility">;
267
+ skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility" | "inboxPreview" | "size" | "templateVariables">;
204
268
  }
205
269
  interface AuditReport {
206
270
  compatibility: {
@@ -216,6 +280,9 @@ interface AuditReport {
216
280
  links: LinkReport;
217
281
  accessibility: AccessibilityReport;
218
282
  images: ImageReport;
283
+ inboxPreview: InboxPreview;
284
+ size: SizeReport;
285
+ templateVariables: TemplateReport;
219
286
  }
220
287
  /**
221
288
  * Run all email analysis checks in a single call.
@@ -277,6 +344,12 @@ interface EmailSession {
277
344
  checkAccessibility(): AccessibilityReport;
278
345
  /** Analyze images (shares pre-parsed DOM). */
279
346
  analyzeImages(): ImageReport;
347
+ /** Extract subject line and preheader text (shares pre-parsed DOM). */
348
+ extractInboxPreview(): InboxPreview;
349
+ /** Check email size for Gmail clipping (needs raw HTML for byte count). */
350
+ checkSize(): SizeReport;
351
+ /** Scan for unresolved template/merge variables (shares pre-parsed DOM). */
352
+ checkTemplateVariables(): TemplateReport;
280
353
  /**
281
354
  * Transform HTML for a specific client.
282
355
  *
@@ -337,6 +410,7 @@ declare function createSession(html: string, options?: CreateSessionOptions): Em
337
410
  /** Maximum HTML input size: 2MB. Inputs exceeding this are rejected early. */
338
411
  declare const MAX_HTML_SIZE: number;
339
412
  declare const GENERIC_LINK_TEXT: Set<string>;
413
+ declare const EMPTY_DELIVERABILITY: DeliverabilityReport;
340
414
 
341
415
  /**
342
416
  * WCAG 2.1 color parsing, luminance, and contrast utilities.
@@ -375,4 +449,4 @@ declare function wcagGrade(ratio: number): WcagGrade;
375
449
  */
376
450
  declare function alphaBlend(fg: RGBA, bgR: number, bgG: number, bgB: number): [number, number, number];
377
451
 
378
- export { AI_FIX_SYSTEM_PROMPT, AccessibilityReport, AiFixResult, AiProvider, type AuditOptions, type AuditReport, CSSWarning, CodeFix, type CreateSessionOptions, DiffResult, EMAIL_CLIENTS, EmailClient, type EmailSession, ExportPromptOptions, Framework, GENERIC_LINK_TEXT, type GenerateAiFixOptions, ImageReport, LinkReport, MAX_HTML_SIZE, type RGBA, STRUCTURAL_FIX_PROPERTIES, SpamAnalysisOptions, SpamReport, TransformResult, type WcagGrade, alphaBlend, analyzeEmail, analyzeImages, analyzeSpam, auditEmail, checkAccessibility, contrastRatio, createSession, diffResults, errorWarnings, generateAiFix, generateCompatibilityScore, getClient, getCodeFix, getSuggestion, parseColor, relativeLuminance, simulateDarkMode, structuralWarnings, transformForAllClients, transformForClient, validateLinks, warningsForClient, wcagGrade };
452
+ export { AI_FIX_SYSTEM_PROMPT, AT_RULE_FEATURES, AccessibilityReport, AiFixResult, AiProvider, type AuditOptions, type AuditReport, COMPOUND_VALUE_FEATURES, CSSWarning, CSS_FUNCTION_FEATURES, CSS_SUPPORT, CodeFix, type CreateSessionOptions, DeliverabilityReport, DiffResult, EMAIL_CLIENTS, EMPTY_DELIVERABILITY, EmailClient, type EmailSession, ExportPromptOptions, Framework, GENERIC_LINK_TEXT, type GenerateAiFixOptions, HTML_ELEMENT_FEATURES, ImageReport, InboxPreview, LinkReport, MAX_HTML_SIZE, type RGBA, STRUCTURAL_FIX_PROPERTIES, SizeReport, SpamAnalysisOptions, SpamReport, SupportLevel, TemplateReport, TransformResult, type WcagGrade, alphaBlend, analyzeEmail, analyzeImages, analyzeSpam, auditEmail, checkAccessibility, checkSize, checkTemplateVariables, contrastRatio, createSession, diffResults, errorWarnings, extractInboxPreview, generateAiFix, generateCompatibilityScore, getClient, getCodeFix, getSuggestion, parseColor, relativeLuminance, simulateDarkMode, structuralWarnings, transformForAllClients, transformForClient, validateLinks, warningsForClient, wcagGrade };