@bernierllc/email-testing-suite 0.7.11 → 0.7.12
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/package.json +8 -8
- package/dist/analytics.d.ts +0 -52
- package/dist/analytics.d.ts.map +0 -1
- package/dist/analytics.js +0 -211
- package/dist/analytics.js.map +0 -1
- package/dist/best-practices.d.ts +0 -34
- package/dist/best-practices.d.ts.map +0 -1
- package/dist/best-practices.js +0 -268
- package/dist/best-practices.js.map +0 -1
- package/dist/email-testing-suite.d.ts +0 -74
- package/dist/email-testing-suite.d.ts.map +0 -1
- package/dist/email-testing-suite.js +0 -424
- package/dist/email-testing-suite.js.map +0 -1
- package/dist/errors.d.ts +0 -12
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -25
- package/dist/errors.js.map +0 -1
- package/dist/feature-test-helpers.d.ts +0 -204
- package/dist/feature-test-helpers.d.ts.map +0 -1
- package/dist/feature-test-helpers.js +0 -375
- package/dist/feature-test-helpers.js.map +0 -1
- package/dist/index.d.ts +0 -14
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -49
- package/dist/index.js.map +0 -1
- package/dist/test-patterns.d.ts +0 -48
- package/dist/test-patterns.d.ts.map +0 -1
- package/dist/test-patterns.js +0 -132
- package/dist/test-patterns.js.map +0 -1
- package/dist/types.d.ts +0 -258
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -10
- package/dist/types.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bernierllc/email-testing-suite",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.12",
|
|
4
4
|
"description": "Complete email testing solution with opinionated defaults, pre-configured test patterns, integrated mock server, and comprehensive reporting",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"directory": "packages/suite/email-testing-suite"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"@bernierllc/email-capture": "^1.3.0",
|
|
33
|
+
"@bernierllc/email-parser": "^0.7.0",
|
|
32
34
|
"@bernierllc/email-sender": "^5.13.0",
|
|
33
|
-
"@bernierllc/email-test-orchestrator": "^0.7.10",
|
|
34
|
-
"@bernierllc/email-validator": "^3.4.0",
|
|
35
|
-
"@bernierllc/logger": "^1.7.1",
|
|
36
35
|
"@bernierllc/email-test-assertions": "^1.6.1",
|
|
36
|
+
"@bernierllc/email-test-orchestrator": "^0.7.11",
|
|
37
|
+
"@bernierllc/email-validator": "^3.4.0",
|
|
38
|
+
"@bernierllc/logger": "^2.0.0",
|
|
39
|
+
"@bernierllc/mock-smtp-server": "^1.6.4",
|
|
37
40
|
"@bernierllc/retry-policy": "^0.7.0",
|
|
38
|
-
"@bernierllc/mock-smtp-server": "^1.6.3",
|
|
39
41
|
"@bernierllc/smtp-analyzer": "^0.6.0",
|
|
40
|
-
"@bernierllc/template-engine": "^0.7.0",
|
|
41
|
-
"@bernierllc/email-parser": "^0.7.0",
|
|
42
42
|
"@bernierllc/template-validator": "^1.5.0",
|
|
43
|
-
"@bernierllc/
|
|
43
|
+
"@bernierllc/template-engine": "^0.7.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/jest": "^29.5.5",
|
package/dist/analytics.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { EmailTestResult, AnalyticsData } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Analytics engine for email testing data
|
|
4
|
-
*/
|
|
5
|
-
export declare class EmailTestAnalytics {
|
|
6
|
-
private testHistory;
|
|
7
|
-
/**
|
|
8
|
-
* Add test result to analytics history
|
|
9
|
-
*/
|
|
10
|
-
addTestResult(result: EmailTestResult): void;
|
|
11
|
-
/**
|
|
12
|
-
* Add multiple test results
|
|
13
|
-
*/
|
|
14
|
-
addTestResults(results: EmailTestResult[]): void;
|
|
15
|
-
/**
|
|
16
|
-
* Generate analytics for a given period
|
|
17
|
-
*/
|
|
18
|
-
generateAnalytics(period?: string): AnalyticsData;
|
|
19
|
-
/**
|
|
20
|
-
* Filter test results by period
|
|
21
|
-
*/
|
|
22
|
-
private filterByPeriod;
|
|
23
|
-
/**
|
|
24
|
-
* Calculate trend data
|
|
25
|
-
*/
|
|
26
|
-
private calculateTrends;
|
|
27
|
-
/**
|
|
28
|
-
* Identify top issues from test results
|
|
29
|
-
*/
|
|
30
|
-
private identifyTopIssues;
|
|
31
|
-
/**
|
|
32
|
-
* Calculate performance metrics
|
|
33
|
-
*/
|
|
34
|
-
private calculatePerformanceMetrics;
|
|
35
|
-
/**
|
|
36
|
-
* Get test history
|
|
37
|
-
*/
|
|
38
|
-
getTestHistory(): EmailTestResult[];
|
|
39
|
-
/**
|
|
40
|
-
* Clear analytics history
|
|
41
|
-
*/
|
|
42
|
-
clearHistory(): void;
|
|
43
|
-
/**
|
|
44
|
-
* Export analytics data as JSON
|
|
45
|
-
*/
|
|
46
|
-
exportAsJSON(period?: string): string;
|
|
47
|
-
/**
|
|
48
|
-
* Export analytics data as CSV
|
|
49
|
-
*/
|
|
50
|
-
exportAsCSV(period?: string): string;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=analytics.d.ts.map
|
package/dist/analytics.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EAId,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,WAAW,CAAyB;IAE5C;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAI5C;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,IAAI;IAIhD;;OAEG;IACH,iBAAiB,CAAC,MAAM,GAAE,MAAuB,GAAG,aAAa;IAqBjE;;OAEG;IACH,OAAO,CAAC,cAAc;IAwBtB;;OAEG;IACH,OAAO,CAAC,eAAe;IA2BvB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAiDzB;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAuBnC;;OAEG;IACH,cAAc,IAAI,eAAe,EAAE;IAInC;;OAEG;IACH,YAAY,IAAI,IAAI;IAIpB;;OAEG;IACH,YAAY,CAAC,MAAM,GAAE,MAAuB,GAAG,MAAM;IAKrD;;OAEG;IACH,WAAW,CAAC,MAAM,GAAE,MAAuB,GAAG,MAAM;CAoCrD"}
|
package/dist/analytics.js
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Copyright (c) 2025 Bernier LLC
|
|
4
|
-
|
|
5
|
-
This file is licensed to the client under a limited-use license.
|
|
6
|
-
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
7
|
-
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.EmailTestAnalytics = void 0;
|
|
11
|
-
/**
|
|
12
|
-
* Analytics engine for email testing data
|
|
13
|
-
*/
|
|
14
|
-
class EmailTestAnalytics {
|
|
15
|
-
testHistory = [];
|
|
16
|
-
/**
|
|
17
|
-
* Add test result to analytics history
|
|
18
|
-
*/
|
|
19
|
-
addTestResult(result) {
|
|
20
|
-
this.testHistory.push(result);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Add multiple test results
|
|
24
|
-
*/
|
|
25
|
-
addTestResults(results) {
|
|
26
|
-
this.testHistory.push(...results);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Generate analytics for a given period
|
|
30
|
-
*/
|
|
31
|
-
generateAnalytics(period = 'last_30_days') {
|
|
32
|
-
const filteredResults = this.filterByPeriod(period);
|
|
33
|
-
const testCount = filteredResults.length;
|
|
34
|
-
const successCount = filteredResults.filter((r) => r.success).length;
|
|
35
|
-
const successRate = testCount > 0 ? (successCount / testCount) * 100 : 0;
|
|
36
|
-
const trends = this.calculateTrends(filteredResults);
|
|
37
|
-
const topIssues = this.identifyTopIssues(filteredResults);
|
|
38
|
-
const performanceMetrics = this.calculatePerformanceMetrics(filteredResults);
|
|
39
|
-
return {
|
|
40
|
-
period,
|
|
41
|
-
testCount,
|
|
42
|
-
successRate,
|
|
43
|
-
trends,
|
|
44
|
-
topIssues,
|
|
45
|
-
performanceMetrics,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Filter test results by period
|
|
50
|
-
*/
|
|
51
|
-
filterByPeriod(period) {
|
|
52
|
-
const now = new Date();
|
|
53
|
-
let cutoffDate;
|
|
54
|
-
switch (period) {
|
|
55
|
-
case 'last_7_days':
|
|
56
|
-
cutoffDate = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);
|
|
57
|
-
break;
|
|
58
|
-
case 'last_30_days':
|
|
59
|
-
cutoffDate = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
|
|
60
|
-
break;
|
|
61
|
-
case 'last_90_days':
|
|
62
|
-
cutoffDate = new Date(now.getTime() - 90 * 24 * 60 * 60 * 1000);
|
|
63
|
-
break;
|
|
64
|
-
default:
|
|
65
|
-
cutoffDate = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
|
|
66
|
-
}
|
|
67
|
-
return this.testHistory.filter((result) => {
|
|
68
|
-
const resultDate = new Date(result.timestamp);
|
|
69
|
-
return resultDate >= cutoffDate;
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Calculate trend data
|
|
74
|
-
*/
|
|
75
|
-
calculateTrends(results) {
|
|
76
|
-
const trendMap = new Map();
|
|
77
|
-
for (const result of results) {
|
|
78
|
-
const date = new Date(result.timestamp).toISOString().split('T')[0];
|
|
79
|
-
if (!trendMap.has(date)) {
|
|
80
|
-
trendMap.set(date, {
|
|
81
|
-
date,
|
|
82
|
-
successRate: 0,
|
|
83
|
-
testCount: 0,
|
|
84
|
-
averageScore: 0,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
const trend = trendMap.get(date);
|
|
88
|
-
trend.testCount++;
|
|
89
|
-
trend.averageScore = (trend.averageScore * (trend.testCount - 1) + result.score) / trend.testCount;
|
|
90
|
-
if (result.success) {
|
|
91
|
-
trend.successRate = ((trend.successRate * (trend.testCount - 1)) / trend.testCount) * 100;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return Array.from(trendMap.values()).sort((a, b) => a.date.localeCompare(b.date));
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Identify top issues from test results
|
|
98
|
-
*/
|
|
99
|
-
identifyTopIssues(results) {
|
|
100
|
-
const issueMap = new Map();
|
|
101
|
-
for (const result of results) {
|
|
102
|
-
if (result.errors && result.errors.length > 0) {
|
|
103
|
-
for (const error of result.errors) {
|
|
104
|
-
const key = error.substring(0, 100); // Normalize error message
|
|
105
|
-
if (!issueMap.has(key)) {
|
|
106
|
-
issueMap.set(key, {
|
|
107
|
-
issue: key,
|
|
108
|
-
count: 0,
|
|
109
|
-
severity: 'error',
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
const issue = issueMap.get(key);
|
|
113
|
-
issue.count++;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
// Check validation warnings
|
|
117
|
-
if (result.validations) {
|
|
118
|
-
for (const validation of result.validations) {
|
|
119
|
-
if (validation.warnings && validation.warnings.length > 0) {
|
|
120
|
-
for (const warning of validation.warnings) {
|
|
121
|
-
const key = warning.substring(0, 100);
|
|
122
|
-
if (!issueMap.has(key)) {
|
|
123
|
-
issueMap.set(key, {
|
|
124
|
-
issue: key,
|
|
125
|
-
count: 0,
|
|
126
|
-
severity: 'warning',
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
const issue = issueMap.get(key);
|
|
130
|
-
issue.count++;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return Array.from(issueMap.values())
|
|
137
|
-
.sort((a, b) => b.count - a.count)
|
|
138
|
-
.slice(0, 10);
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Calculate performance metrics
|
|
142
|
-
*/
|
|
143
|
-
calculatePerformanceMetrics(results) {
|
|
144
|
-
if (results.length === 0) {
|
|
145
|
-
return {
|
|
146
|
-
averageRenderTime: 0,
|
|
147
|
-
averageDeliveryTime: 0,
|
|
148
|
-
averageSize: 0,
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
const totalDuration = results.reduce((sum, r) => sum + r.duration, 0);
|
|
152
|
-
const averageRenderTime = totalDuration / results.length;
|
|
153
|
-
// Mock delivery time and size calculations
|
|
154
|
-
const averageDeliveryTime = averageRenderTime * 1.5;
|
|
155
|
-
const averageSize = 50000; // Mock value
|
|
156
|
-
return {
|
|
157
|
-
averageRenderTime,
|
|
158
|
-
averageDeliveryTime,
|
|
159
|
-
averageSize,
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Get test history
|
|
164
|
-
*/
|
|
165
|
-
getTestHistory() {
|
|
166
|
-
return [...this.testHistory];
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Clear analytics history
|
|
170
|
-
*/
|
|
171
|
-
clearHistory() {
|
|
172
|
-
this.testHistory = [];
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Export analytics data as JSON
|
|
176
|
-
*/
|
|
177
|
-
exportAsJSON(period = 'last_30_days') {
|
|
178
|
-
const analytics = this.generateAnalytics(period);
|
|
179
|
-
return JSON.stringify(analytics, null, 2);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Export analytics data as CSV
|
|
183
|
-
*/
|
|
184
|
-
exportAsCSV(period = 'last_30_days') {
|
|
185
|
-
const analytics = this.generateAnalytics(period);
|
|
186
|
-
const lines = [];
|
|
187
|
-
// Header
|
|
188
|
-
lines.push('Metric,Value');
|
|
189
|
-
// Summary metrics
|
|
190
|
-
lines.push(`Test Count,${analytics.testCount}`);
|
|
191
|
-
lines.push(`Success Rate,${analytics.successRate.toFixed(2)}%`);
|
|
192
|
-
lines.push(`Average Render Time,${analytics.performanceMetrics.averageRenderTime.toFixed(2)}ms`);
|
|
193
|
-
lines.push(`Average Delivery Time,${analytics.performanceMetrics.averageDeliveryTime.toFixed(2)}ms`);
|
|
194
|
-
lines.push(`Average Size,${analytics.performanceMetrics.averageSize} bytes`);
|
|
195
|
-
// Trends
|
|
196
|
-
lines.push('');
|
|
197
|
-
lines.push('Date,Test Count,Success Rate,Average Score');
|
|
198
|
-
for (const trend of analytics.trends) {
|
|
199
|
-
lines.push(`${trend.date},${trend.testCount},${trend.successRate.toFixed(2)}%,${trend.averageScore.toFixed(2)}`);
|
|
200
|
-
}
|
|
201
|
-
// Top Issues
|
|
202
|
-
lines.push('');
|
|
203
|
-
lines.push('Issue,Count,Severity');
|
|
204
|
-
for (const issue of analytics.topIssues) {
|
|
205
|
-
lines.push(`"${issue.issue}",${issue.count},${issue.severity}`);
|
|
206
|
-
}
|
|
207
|
-
return lines.join('\n');
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
exports.EmailTestAnalytics = EmailTestAnalytics;
|
|
211
|
-
//# sourceMappingURL=analytics.js.map
|
package/dist/analytics.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;AAUF;;GAEG;AACH,MAAa,kBAAkB;IACrB,WAAW,GAAsB,EAAE,CAAC;IAE5C;;OAEG;IACH,aAAa,CAAC,MAAuB;QACnC,IAAI,CAAC,WAAW,CAAC,IA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-
* Best practices validator for email testing
|
|
4
|
-
*/
|
|
5
|
-
export declare class BestPracticesValidator {
|
|
6
|
-
/**
|
|
7
|
-
* Validate email against best practices
|
|
8
|
-
*/
|
|
9
|
-
static validateEmail(email: EmailData): {
|
|
10
|
-
passed: boolean;
|
|
11
|
-
score: number;
|
|
12
|
-
recommendations: Recommendation[];
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Get recommended test coverage for email type
|
|
16
|
-
*/
|
|
17
|
-
static getRecommendedCoverage(emailType: string): {
|
|
18
|
-
validators: string[];
|
|
19
|
-
description: string;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Generate compliance checklist
|
|
23
|
-
*/
|
|
24
|
-
static getComplianceChecklist(region: 'US' | 'EU' | 'GLOBAL'): string[];
|
|
25
|
-
/**
|
|
26
|
-
* Get accessibility guidelines
|
|
27
|
-
*/
|
|
28
|
-
static getAccessibilityGuidelines(): Recommendation[];
|
|
29
|
-
/**
|
|
30
|
-
* Get performance optimization tips
|
|
31
|
-
*/
|
|
32
|
-
static getPerformanceOptimizationTips(): Recommendation[];
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=best-practices.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"best-practices.d.ts","sourceRoot":"","sources":["../src/best-practices.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzD;;GAEG;AACH,qBAAa,sBAAsB;IACjC;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG;QACtC,MAAM,EAAE,OAAO,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,eAAe,EAAE,cAAc,EAAE,CAAC;KACnC;IA4HD;;OAEG;IACH,MAAM,CAAC,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG;QAChD,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;KACrB;IA8BD;;OAEG;IACH,MAAM,CAAC,sBAAsB,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,QAAQ,GAAG,MAAM,EAAE;IA4BvE;;OAEG;IACH,MAAM,CAAC,0BAA0B,IAAI,cAAc,EAAE;IAwCrD;;OAEG;IACH,MAAM,CAAC,8BAA8B,IAAI,cAAc,EAAE;CAuC1D"}
|
package/dist/best-practices.js
DELETED
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Copyright (c) 2025 Bernier LLC
|
|
4
|
-
|
|
5
|
-
This file is licensed to the client under a limited-use license.
|
|
6
|
-
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
7
|
-
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.BestPracticesValidator = void 0;
|
|
11
|
-
/**
|
|
12
|
-
* Best practices validator for email testing
|
|
13
|
-
*/
|
|
14
|
-
class BestPracticesValidator {
|
|
15
|
-
/**
|
|
16
|
-
* Validate email against best practices
|
|
17
|
-
*/
|
|
18
|
-
static validateEmail(email) {
|
|
19
|
-
const recommendations = [];
|
|
20
|
-
let score = 100;
|
|
21
|
-
// Check subject line
|
|
22
|
-
if (!email.subject || email.subject.length === 0) {
|
|
23
|
-
recommendations.push({
|
|
24
|
-
category: 'Subject Line',
|
|
25
|
-
priority: 'high',
|
|
26
|
-
title: 'Missing subject line',
|
|
27
|
-
description: 'Email should have a subject line',
|
|
28
|
-
action: 'Add a descriptive subject line to the email',
|
|
29
|
-
});
|
|
30
|
-
score -= 20;
|
|
31
|
-
}
|
|
32
|
-
else if (email.subject.length > 60) {
|
|
33
|
-
recommendations.push({
|
|
34
|
-
category: 'Subject Line',
|
|
35
|
-
priority: 'medium',
|
|
36
|
-
title: 'Subject line too long',
|
|
37
|
-
description: 'Subject line should be under 60 characters for optimal display',
|
|
38
|
-
action: 'Shorten the subject line to 60 characters or less',
|
|
39
|
-
});
|
|
40
|
-
score -= 5;
|
|
41
|
-
}
|
|
42
|
-
// Check HTML content
|
|
43
|
-
if (email.html) {
|
|
44
|
-
if (!email.html.includes('<!DOCTYPE') && !email.html.includes('<html')) {
|
|
45
|
-
recommendations.push({
|
|
46
|
-
category: 'HTML Structure',
|
|
47
|
-
priority: 'medium',
|
|
48
|
-
title: 'Missing HTML structure',
|
|
49
|
-
description: 'Email HTML should include proper DOCTYPE and html tags',
|
|
50
|
-
action: 'Add proper HTML structure to the email template',
|
|
51
|
-
});
|
|
52
|
-
score -= 10;
|
|
53
|
-
}
|
|
54
|
-
// Check for alt text on images
|
|
55
|
-
const imgTags = email.html.match(/<img[^>]*>/g) || [];
|
|
56
|
-
const imagesWithoutAlt = imgTags.filter((tag) => !tag.includes('alt=')).length;
|
|
57
|
-
if (imagesWithoutAlt > 0) {
|
|
58
|
-
recommendations.push({
|
|
59
|
-
category: 'Accessibility',
|
|
60
|
-
priority: 'high',
|
|
61
|
-
title: 'Images missing alt text',
|
|
62
|
-
description: `${imagesWithoutAlt} image(s) do not have alt text`,
|
|
63
|
-
action: 'Add descriptive alt text to all images for accessibility',
|
|
64
|
-
});
|
|
65
|
-
score -= 15;
|
|
66
|
-
}
|
|
67
|
-
// Check for responsive design
|
|
68
|
-
if (!email.html.includes('viewport') && !email.html.includes('media query')) {
|
|
69
|
-
recommendations.push({
|
|
70
|
-
category: 'Responsive Design',
|
|
71
|
-
priority: 'medium',
|
|
72
|
-
title: 'Email may not be mobile-friendly',
|
|
73
|
-
description: 'Email does not appear to include responsive design elements',
|
|
74
|
-
action: 'Add viewport meta tag and media queries for mobile support',
|
|
75
|
-
});
|
|
76
|
-
score -= 10;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
// Check plain text version
|
|
80
|
-
if (!email.text || email.text.length === 0) {
|
|
81
|
-
recommendations.push({
|
|
82
|
-
category: 'Content',
|
|
83
|
-
priority: 'medium',
|
|
84
|
-
title: 'Missing plain text version',
|
|
85
|
-
description: 'Email should include a plain text version for accessibility',
|
|
86
|
-
action: 'Add a plain text version of the email content',
|
|
87
|
-
});
|
|
88
|
-
score -= 10;
|
|
89
|
-
}
|
|
90
|
-
// Check for unsubscribe link (basic check)
|
|
91
|
-
const hasUnsubscribe = (email.html && email.html.toLowerCase().includes('unsubscribe')) ||
|
|
92
|
-
(email.text && email.text.toLowerCase().includes('unsubscribe'));
|
|
93
|
-
if (!hasUnsubscribe) {
|
|
94
|
-
recommendations.push({
|
|
95
|
-
category: 'Compliance',
|
|
96
|
-
priority: 'high',
|
|
97
|
-
title: 'Missing unsubscribe link',
|
|
98
|
-
description: 'Email should include an unsubscribe link for compliance',
|
|
99
|
-
action: 'Add an unsubscribe link to the email footer',
|
|
100
|
-
});
|
|
101
|
-
score -= 20;
|
|
102
|
-
}
|
|
103
|
-
// Check from address
|
|
104
|
-
if (!email.from || !email.from.includes('@')) {
|
|
105
|
-
recommendations.push({
|
|
106
|
-
category: 'Sender Information',
|
|
107
|
-
priority: 'high',
|
|
108
|
-
title: 'Invalid from address',
|
|
109
|
-
description: 'Email must have a valid from address',
|
|
110
|
-
action: 'Ensure the from address is a valid email address',
|
|
111
|
-
});
|
|
112
|
-
score -= 15;
|
|
113
|
-
}
|
|
114
|
-
// Check recipients
|
|
115
|
-
if (!email.to || email.to.length === 0) {
|
|
116
|
-
recommendations.push({
|
|
117
|
-
category: 'Recipients',
|
|
118
|
-
priority: 'high',
|
|
119
|
-
title: 'No recipients specified',
|
|
120
|
-
description: 'Email must have at least one recipient',
|
|
121
|
-
action: 'Add at least one recipient to the email',
|
|
122
|
-
});
|
|
123
|
-
score -= 20;
|
|
124
|
-
}
|
|
125
|
-
return {
|
|
126
|
-
passed: score >= 70,
|
|
127
|
-
score: Math.max(0, score),
|
|
128
|
-
recommendations,
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Get recommended test coverage for email type
|
|
133
|
-
*/
|
|
134
|
-
static getRecommendedCoverage(emailType) {
|
|
135
|
-
switch (emailType.toLowerCase()) {
|
|
136
|
-
case 'transactional':
|
|
137
|
-
return {
|
|
138
|
-
validators: ['template', 'compliance', 'performance', 'security'],
|
|
139
|
-
description: 'Transactional emails require template accuracy, compliance, fast delivery, and security',
|
|
140
|
-
};
|
|
141
|
-
case 'marketing':
|
|
142
|
-
return {
|
|
143
|
-
validators: ['template', 'compliance', 'accessibility', 'performance'],
|
|
144
|
-
description: 'Marketing emails need full validation including accessibility and compliance',
|
|
145
|
-
};
|
|
146
|
-
case 'notification':
|
|
147
|
-
return {
|
|
148
|
-
validators: ['template', 'performance'],
|
|
149
|
-
description: 'Notification emails prioritize template accuracy and delivery speed',
|
|
150
|
-
};
|
|
151
|
-
case 'newsletter':
|
|
152
|
-
return {
|
|
153
|
-
validators: ['template', 'compliance', 'accessibility', 'performance'],
|
|
154
|
-
description: 'Newsletters require comprehensive validation for broad audience reach',
|
|
155
|
-
};
|
|
156
|
-
default:
|
|
157
|
-
return {
|
|
158
|
-
validators: ['template', 'compliance', 'accessibility', 'performance', 'security'],
|
|
159
|
-
description: 'Default comprehensive validation for all email types',
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Generate compliance checklist
|
|
165
|
-
*/
|
|
166
|
-
static getComplianceChecklist(region) {
|
|
167
|
-
const baseChecklist = [
|
|
168
|
-
'Include valid from address',
|
|
169
|
-
'Include unsubscribe link',
|
|
170
|
-
'Include physical mailing address',
|
|
171
|
-
'Accurate subject line (no deceptive practices)',
|
|
172
|
-
'Honor opt-out requests promptly',
|
|
173
|
-
];
|
|
174
|
-
if (region === 'EU' || region === 'GLOBAL') {
|
|
175
|
-
baseChecklist.push('Obtain explicit consent (GDPR)', 'Provide data privacy information', 'Enable data portability and deletion requests');
|
|
176
|
-
}
|
|
177
|
-
if (region === 'US' || region === 'GLOBAL') {
|
|
178
|
-
baseChecklist.push('Comply with CAN-SPAM Act', 'Include valid postal address', 'Process opt-out within 10 business days');
|
|
179
|
-
}
|
|
180
|
-
return baseChecklist;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Get accessibility guidelines
|
|
184
|
-
*/
|
|
185
|
-
static getAccessibilityGuidelines() {
|
|
186
|
-
return [
|
|
187
|
-
{
|
|
188
|
-
category: 'Accessibility',
|
|
189
|
-
priority: 'high',
|
|
190
|
-
title: 'Provide alt text for all images',
|
|
191
|
-
description: 'Screen readers need descriptive alt text to convey image content',
|
|
192
|
-
action: 'Add meaningful alt attributes to all img tags',
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
category: 'Accessibility',
|
|
196
|
-
priority: 'high',
|
|
197
|
-
title: 'Use semantic HTML',
|
|
198
|
-
description: 'Proper heading hierarchy and semantic elements improve screen reader navigation',
|
|
199
|
-
action: 'Use h1-h6 tags appropriately and semantic HTML elements',
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
category: 'Accessibility',
|
|
203
|
-
priority: 'medium',
|
|
204
|
-
title: 'Ensure sufficient color contrast',
|
|
205
|
-
description: 'Text should have at least 4.5:1 contrast ratio with background',
|
|
206
|
-
action: 'Use color contrast checker and adjust colors as needed',
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
category: 'Accessibility',
|
|
210
|
-
priority: 'medium',
|
|
211
|
-
title: 'Avoid relying solely on color',
|
|
212
|
-
description: 'Important information should not be conveyed by color alone',
|
|
213
|
-
action: 'Use text labels, icons, or patterns in addition to color',
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
category: 'Accessibility',
|
|
217
|
-
priority: 'low',
|
|
218
|
-
title: 'Include plain text version',
|
|
219
|
-
description: 'Plain text version provides fallback for accessibility tools',
|
|
220
|
-
action: 'Generate plain text version of all HTML emails',
|
|
221
|
-
},
|
|
222
|
-
];
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Get performance optimization tips
|
|
226
|
-
*/
|
|
227
|
-
static getPerformanceOptimizationTips() {
|
|
228
|
-
return [
|
|
229
|
-
{
|
|
230
|
-
category: 'Performance',
|
|
231
|
-
priority: 'high',
|
|
232
|
-
title: 'Optimize image sizes',
|
|
233
|
-
description: 'Large images increase email size and load time',
|
|
234
|
-
action: 'Compress images and use appropriate dimensions',
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
category: 'Performance',
|
|
238
|
-
priority: 'high',
|
|
239
|
-
title: 'Minimize CSS and inline styles',
|
|
240
|
-
description: 'Excessive CSS increases email size',
|
|
241
|
-
action: 'Inline critical CSS and remove unused styles',
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
category: 'Performance',
|
|
245
|
-
priority: 'medium',
|
|
246
|
-
title: 'Limit external resources',
|
|
247
|
-
description: 'External resources may be blocked or slow to load',
|
|
248
|
-
action: 'Inline images and styles when possible',
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
category: 'Performance',
|
|
252
|
-
priority: 'medium',
|
|
253
|
-
title: 'Keep total size under 102KB',
|
|
254
|
-
description: 'Gmail clips messages over 102KB',
|
|
255
|
-
action: 'Optimize content to stay under size threshold',
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
category: 'Performance',
|
|
259
|
-
priority: 'low',
|
|
260
|
-
title: 'Use web-safe fonts',
|
|
261
|
-
description: 'Custom fonts may not render consistently across clients',
|
|
262
|
-
action: 'Use web-safe fonts with appropriate fallbacks',
|
|
263
|
-
},
|
|
264
|
-
];
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
exports.BestPracticesValidator = BestPracticesValidator;
|
|
268
|
-
//# sourceMappingURL=best-practices.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"best-practices.js","sourceRoot":"","sources":["../src/best-practices.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;AAIF;;GAEG;AACH,MAAa,sBAAsB;IACjC;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