@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentgrowth/content-emailing",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "Unified email delivery and template management system",
6
6
  "main": "src/index.js",
@@ -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
- // Simple default wrapper
209
- // In a real usage, this might load a 'base' template from DB
210
- return `
211
- <!DOCTYPE html>
212
- <html>
213
- <head><title>${subject}</title></head>
214
- <body style="font-family: sans-serif; line-height: 1.6; color: #333;">
215
- <div style="max-width: 600px; margin: 0 auto; padding: 20px;">
216
- ${content}
217
- <div style="margin-top: 20px; font-size: 12px; color: #999;">
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 ---