@emailens/engine 0.6.0 → 0.7.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
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 SpamAnalysisOptions, d as SpamReport, L as LinkReport, e as AccessibilityReport, I as ImageReport, f as InboxPreview, g as SizeReport, h as TemplateReport } from './react-email-CYOtHJch.cjs';
2
+ export { i as AccessibilityIssue, j as ClientTruncation, k as CompileError, l as CompileReactEmailOptions, m as EstimateOptions, n as ExportScope, o as FixType, p as ImageInfo, q as ImageIssue, r as InboxPreviewIssue, s as InputFormat, t as LinkIssue, P as PreviewResult, u as SandboxStrategy, v as SizeIssue, w as SpamIssue, x as SupportLevel, y as TemplateIssue, z as TokenEstimate, B as TokenEstimateWithWarnings, G as estimateAiFixTokens, H as generateFixPrompt, J as heuristicTokenCount } from './react-email-CYOtHJch.cjs';
3
3
 
4
4
  declare const EMAIL_CLIENTS: EmailClient[];
5
5
  declare function getClient(id: string): EmailClient | undefined;
@@ -195,12 +195,41 @@ declare function checkAccessibility(html: string): AccessibilityReport;
195
195
  */
196
196
  declare function analyzeImages(html: string): ImageReport;
197
197
 
198
+ /**
199
+ * Extract subject and preheader text from the email HTML, plus
200
+ * flag common issues (missing title, length problems, etc.).
201
+ *
202
+ * The subject comes from the `<title>` tag. The preheader is extracted
203
+ * from the first visible text in `<body>`, including hidden preheader
204
+ * hacks (zero-width divs, display:none spans, etc.).
205
+ */
206
+ declare function extractInboxPreview(html: string): InboxPreview;
207
+
208
+ /**
209
+ * Check email HTML size for Gmail clipping issues.
210
+ *
211
+ * Returns byte count, human-readable size, clip status, and issues.
212
+ * Gmail clips messages larger than ~102 KB, hiding content behind a
213
+ * "View entire message" link.
214
+ */
215
+ declare function checkSize(html: string): SizeReport;
216
+
217
+ /**
218
+ * Scan HTML email for unresolved template/merge variables.
219
+ *
220
+ * Detects patterns like `{{var}}`, `${var}`, `<%= %>`, `*|TAG|*`,
221
+ * `%%tag%%`, and `{merge_field}` in text content and key attributes.
222
+ *
223
+ * Returns the count of unresolved variables and detailed issues.
224
+ */
225
+ declare function checkTemplateVariables(html: string): TemplateReport;
226
+
198
227
  interface AuditOptions {
199
228
  framework?: Framework;
200
229
  /** Options for spam analysis */
201
230
  spam?: SpamAnalysisOptions;
202
231
  /** Skip specific checks */
203
- skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility">;
232
+ skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility" | "inboxPreview" | "size" | "templateVariables">;
204
233
  }
205
234
  interface AuditReport {
206
235
  compatibility: {
@@ -216,6 +245,9 @@ interface AuditReport {
216
245
  links: LinkReport;
217
246
  accessibility: AccessibilityReport;
218
247
  images: ImageReport;
248
+ inboxPreview: InboxPreview;
249
+ size: SizeReport;
250
+ templateVariables: TemplateReport;
219
251
  }
220
252
  /**
221
253
  * Run all email analysis checks in a single call.
@@ -277,6 +309,12 @@ interface EmailSession {
277
309
  checkAccessibility(): AccessibilityReport;
278
310
  /** Analyze images (shares pre-parsed DOM). */
279
311
  analyzeImages(): ImageReport;
312
+ /** Extract subject line and preheader text (shares pre-parsed DOM). */
313
+ extractInboxPreview(): InboxPreview;
314
+ /** Check email size for Gmail clipping (needs raw HTML for byte count). */
315
+ checkSize(): SizeReport;
316
+ /** Scan for unresolved template/merge variables (shares pre-parsed DOM). */
317
+ checkTemplateVariables(): TemplateReport;
280
318
  /**
281
319
  * Transform HTML for a specific client.
282
320
  *
@@ -375,4 +413,4 @@ declare function wcagGrade(ratio: number): WcagGrade;
375
413
  */
376
414
  declare function alphaBlend(fg: RGBA, bgR: number, bgG: number, bgB: number): [number, number, number];
377
415
 
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 };
416
+ 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, InboxPreview, LinkReport, MAX_HTML_SIZE, type RGBA, STRUCTURAL_FIX_PROPERTIES, SizeReport, SpamAnalysisOptions, SpamReport, 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,5 @@
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 SpamAnalysisOptions, d as SpamReport, L as LinkReport, e as AccessibilityReport, I as ImageReport, f as InboxPreview, g as SizeReport, h as TemplateReport } from './react-email-CYOtHJch.js';
2
+ export { i as AccessibilityIssue, j as ClientTruncation, k as CompileError, l as CompileReactEmailOptions, m as EstimateOptions, n as ExportScope, o as FixType, p as ImageInfo, q as ImageIssue, r as InboxPreviewIssue, s as InputFormat, t as LinkIssue, P as PreviewResult, u as SandboxStrategy, v as SizeIssue, w as SpamIssue, x as SupportLevel, y as TemplateIssue, z as TokenEstimate, B as TokenEstimateWithWarnings, G as estimateAiFixTokens, H as generateFixPrompt, J as heuristicTokenCount } from './react-email-CYOtHJch.js';
3
3
 
4
4
  declare const EMAIL_CLIENTS: EmailClient[];
5
5
  declare function getClient(id: string): EmailClient | undefined;
@@ -195,12 +195,41 @@ declare function checkAccessibility(html: string): AccessibilityReport;
195
195
  */
196
196
  declare function analyzeImages(html: string): ImageReport;
197
197
 
198
+ /**
199
+ * Extract subject and preheader text from the email HTML, plus
200
+ * flag common issues (missing title, length problems, etc.).
201
+ *
202
+ * The subject comes from the `<title>` tag. The preheader is extracted
203
+ * from the first visible text in `<body>`, including hidden preheader
204
+ * hacks (zero-width divs, display:none spans, etc.).
205
+ */
206
+ declare function extractInboxPreview(html: string): InboxPreview;
207
+
208
+ /**
209
+ * Check email HTML size for Gmail clipping issues.
210
+ *
211
+ * Returns byte count, human-readable size, clip status, and issues.
212
+ * Gmail clips messages larger than ~102 KB, hiding content behind a
213
+ * "View entire message" link.
214
+ */
215
+ declare function checkSize(html: string): SizeReport;
216
+
217
+ /**
218
+ * Scan HTML email for unresolved template/merge variables.
219
+ *
220
+ * Detects patterns like `{{var}}`, `${var}`, `<%= %>`, `*|TAG|*`,
221
+ * `%%tag%%`, and `{merge_field}` in text content and key attributes.
222
+ *
223
+ * Returns the count of unresolved variables and detailed issues.
224
+ */
225
+ declare function checkTemplateVariables(html: string): TemplateReport;
226
+
198
227
  interface AuditOptions {
199
228
  framework?: Framework;
200
229
  /** Options for spam analysis */
201
230
  spam?: SpamAnalysisOptions;
202
231
  /** Skip specific checks */
203
- skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility">;
232
+ skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility" | "inboxPreview" | "size" | "templateVariables">;
204
233
  }
205
234
  interface AuditReport {
206
235
  compatibility: {
@@ -216,6 +245,9 @@ interface AuditReport {
216
245
  links: LinkReport;
217
246
  accessibility: AccessibilityReport;
218
247
  images: ImageReport;
248
+ inboxPreview: InboxPreview;
249
+ size: SizeReport;
250
+ templateVariables: TemplateReport;
219
251
  }
220
252
  /**
221
253
  * Run all email analysis checks in a single call.
@@ -277,6 +309,12 @@ interface EmailSession {
277
309
  checkAccessibility(): AccessibilityReport;
278
310
  /** Analyze images (shares pre-parsed DOM). */
279
311
  analyzeImages(): ImageReport;
312
+ /** Extract subject line and preheader text (shares pre-parsed DOM). */
313
+ extractInboxPreview(): InboxPreview;
314
+ /** Check email size for Gmail clipping (needs raw HTML for byte count). */
315
+ checkSize(): SizeReport;
316
+ /** Scan for unresolved template/merge variables (shares pre-parsed DOM). */
317
+ checkTemplateVariables(): TemplateReport;
280
318
  /**
281
319
  * Transform HTML for a specific client.
282
320
  *
@@ -375,4 +413,4 @@ declare function wcagGrade(ratio: number): WcagGrade;
375
413
  */
376
414
  declare function alphaBlend(fg: RGBA, bgR: number, bgG: number, bgB: number): [number, number, number];
377
415
 
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 };
416
+ 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, InboxPreview, LinkReport, MAX_HTML_SIZE, type RGBA, STRUCTURAL_FIX_PROPERTIES, SizeReport, SpamAnalysisOptions, SpamReport, 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 };