@contentgrowth/content-emailing 0.1.0 → 0.2.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/package.json +1 -1
- package/src/backend/EmailService.js +19 -16
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { marked } from 'marked';
|
|
6
6
|
import Mustache from 'mustache';
|
|
7
|
+
import { wrapInEmailTemplate } from '../common/htmlWrapper.js';
|
|
7
8
|
|
|
8
9
|
export class EmailService {
|
|
9
10
|
/**
|
|
@@ -23,6 +24,13 @@ export class EmailService {
|
|
|
23
24
|
fromAddress: 'noreply@example.com',
|
|
24
25
|
provider: 'mailchannels'
|
|
25
26
|
},
|
|
27
|
+
// Branding configuration for email templates
|
|
28
|
+
branding: {
|
|
29
|
+
brandName: config.branding?.brandName || 'Your App',
|
|
30
|
+
portalUrl: config.branding?.portalUrl || 'https://app.example.com',
|
|
31
|
+
primaryColor: config.branding?.primaryColor || '#667eea',
|
|
32
|
+
...config.branding
|
|
33
|
+
},
|
|
26
34
|
...config
|
|
27
35
|
};
|
|
28
36
|
this.cache = cacheProvider;
|
|
@@ -204,22 +212,17 @@ export class EmailService {
|
|
|
204
212
|
return { subject, html, plainText };
|
|
205
213
|
}
|
|
206
214
|
|
|
207
|
-
wrapInBaseTemplate(content, subject, data) {
|
|
208
|
-
//
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
<p>Sent via X0 Start</p>
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
</body>
|
|
222
|
-
</html>`;
|
|
215
|
+
wrapInBaseTemplate(content, subject, data = {}) {
|
|
216
|
+
// Merge branding config with template data
|
|
217
|
+
const templateData = {
|
|
218
|
+
...data,
|
|
219
|
+
brandName: data.brandName || this.config.branding.brandName,
|
|
220
|
+
portalUrl: data.portalUrl || this.config.branding.portalUrl,
|
|
221
|
+
unsubscribeUrl: data.unsubscribeUrl || '{{unsubscribe_url}}'
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// Use the full branded HTML wrapper from common
|
|
225
|
+
return wrapInEmailTemplate(content, subject, templateData);
|
|
223
226
|
}
|
|
224
227
|
|
|
225
228
|
// --- Delivery ---
|