@emailens/engine 0.2.0 → 0.3.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.ts +99 -1
- package/dist/index.js +827 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
package/dist/index.d.ts
CHANGED
|
@@ -160,6 +160,68 @@ interface DiffResult {
|
|
|
160
160
|
introduced: CSSWarning[];
|
|
161
161
|
unchanged: CSSWarning[];
|
|
162
162
|
}
|
|
163
|
+
interface SpamIssue {
|
|
164
|
+
rule: string;
|
|
165
|
+
severity: "error" | "warning" | "info";
|
|
166
|
+
message: string;
|
|
167
|
+
detail?: string;
|
|
168
|
+
}
|
|
169
|
+
interface SpamReport {
|
|
170
|
+
score: number;
|
|
171
|
+
level: "low" | "medium" | "high";
|
|
172
|
+
issues: SpamIssue[];
|
|
173
|
+
}
|
|
174
|
+
interface LinkIssue {
|
|
175
|
+
severity: "error" | "warning" | "info";
|
|
176
|
+
rule: string;
|
|
177
|
+
message: string;
|
|
178
|
+
href?: string;
|
|
179
|
+
text?: string;
|
|
180
|
+
}
|
|
181
|
+
interface LinkReport {
|
|
182
|
+
totalLinks: number;
|
|
183
|
+
issues: LinkIssue[];
|
|
184
|
+
breakdown: {
|
|
185
|
+
https: number;
|
|
186
|
+
http: number;
|
|
187
|
+
mailto: number;
|
|
188
|
+
tel: number;
|
|
189
|
+
anchor: number;
|
|
190
|
+
other: number;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
interface AccessibilityIssue {
|
|
194
|
+
severity: "error" | "warning" | "info";
|
|
195
|
+
rule: string;
|
|
196
|
+
message: string;
|
|
197
|
+
element?: string;
|
|
198
|
+
details?: string;
|
|
199
|
+
}
|
|
200
|
+
interface AccessibilityReport {
|
|
201
|
+
score: number;
|
|
202
|
+
issues: AccessibilityIssue[];
|
|
203
|
+
}
|
|
204
|
+
interface ImageIssue {
|
|
205
|
+
rule: string;
|
|
206
|
+
severity: "error" | "warning" | "info";
|
|
207
|
+
message: string;
|
|
208
|
+
src?: string;
|
|
209
|
+
}
|
|
210
|
+
interface ImageInfo {
|
|
211
|
+
src: string;
|
|
212
|
+
alt: string | null;
|
|
213
|
+
width: string | null;
|
|
214
|
+
height: string | null;
|
|
215
|
+
isTrackingPixel: boolean;
|
|
216
|
+
dataUriBytes: number;
|
|
217
|
+
issues: string[];
|
|
218
|
+
}
|
|
219
|
+
interface ImageReport {
|
|
220
|
+
total: number;
|
|
221
|
+
totalDataUriBytes: number;
|
|
222
|
+
issues: ImageIssue[];
|
|
223
|
+
images: ImageInfo[];
|
|
224
|
+
}
|
|
163
225
|
|
|
164
226
|
declare const EMAIL_CLIENTS: EmailClient[];
|
|
165
227
|
declare function getClient(id: string): EmailClient | undefined;
|
|
@@ -313,4 +375,40 @@ declare const AI_FIX_SYSTEM_PROMPT = "You are an expert email developer speciali
|
|
|
313
375
|
*/
|
|
314
376
|
declare const STRUCTURAL_FIX_PROPERTIES: Set<string>;
|
|
315
377
|
|
|
316
|
-
|
|
378
|
+
/**
|
|
379
|
+
* Analyze an HTML email for spam indicators.
|
|
380
|
+
*
|
|
381
|
+
* Returns a 0–100 score (100 = clean, 0 = very spammy) and an array
|
|
382
|
+
* of issues found. Uses heuristic rules modeled after common spam
|
|
383
|
+
* filter triggers (CAN-SPAM, GDPR, SpamAssassin patterns).
|
|
384
|
+
*/
|
|
385
|
+
declare function analyzeSpam(html: string): SpamReport;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Extract and validate all links from an HTML email.
|
|
389
|
+
*
|
|
390
|
+
* Performs static analysis only (no network requests). Checks for
|
|
391
|
+
* empty/placeholder hrefs, javascript: protocol, insecure HTTP,
|
|
392
|
+
* generic link text, accessibility issues, and more.
|
|
393
|
+
*/
|
|
394
|
+
declare function validateLinks(html: string): LinkReport;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Audit an HTML email for accessibility issues.
|
|
398
|
+
*
|
|
399
|
+
* Checks for missing lang attributes, image alt text, small fonts,
|
|
400
|
+
* layout table roles, link accessibility, heading hierarchy, and
|
|
401
|
+
* color contrast. Returns a 0–100 score and detailed issues.
|
|
402
|
+
*/
|
|
403
|
+
declare function checkAccessibility(html: string): AccessibilityReport;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Analyze images in an HTML email for best practices.
|
|
407
|
+
*
|
|
408
|
+
* Checks for missing dimensions, oversized data URIs, missing alt
|
|
409
|
+
* attributes, unsupported formats (WebP, SVG), tracking pixels,
|
|
410
|
+
* missing display:block, and overall image heaviness.
|
|
411
|
+
*/
|
|
412
|
+
declare function analyzeImages(html: string): ImageReport;
|
|
413
|
+
|
|
414
|
+
export { AI_FIX_SYSTEM_PROMPT, type AccessibilityIssue, type AccessibilityReport, type AiFixResult, type AiProvider, type CSSWarning, type CodeFix, type DiffResult, EMAIL_CLIENTS, type EmailClient, type EstimateOptions, type ExportPromptOptions, type ExportScope, type FixType, type Framework, type GenerateAiFixOptions, type ImageInfo, type ImageIssue, type ImageReport, type InputFormat, type LinkIssue, type LinkReport, type PreviewResult, STRUCTURAL_FIX_PROPERTIES, type SpamIssue, type SpamReport, type SupportLevel, type TokenEstimate, type TokenEstimateWithWarnings, type TransformResult, analyzeEmail, analyzeImages, analyzeSpam, checkAccessibility, diffResults, estimateAiFixTokens, generateAiFix, generateCompatibilityScore, generateFixPrompt, getClient, getCodeFix, getSuggestion, heuristicTokenCount, simulateDarkMode, transformForAllClients, transformForClient, validateLinks };
|