@xbg.solutions/utils-email-connector 1.0.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/lib/email-connector.d.ts +47 -0
- package/lib/email-connector.d.ts.map +1 -0
- package/lib/email-connector.js +134 -0
- package/lib/email-connector.js.map +1 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +86 -0
- package/lib/index.js.map +1 -0
- package/lib/providers/mailjet-provider.d.ts +46 -0
- package/lib/providers/mailjet-provider.d.ts.map +1 -0
- package/lib/providers/mailjet-provider.js +195 -0
- package/lib/providers/mailjet-provider.js.map +1 -0
- package/lib/providers/ortto-provider.d.ts +50 -0
- package/lib/providers/ortto-provider.d.ts.map +1 -0
- package/lib/providers/ortto-provider.js +222 -0
- package/lib/providers/ortto-provider.js.map +1 -0
- package/lib/types.d.ts +86 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +6 -0
- package/lib/types.js.map +1 -0
- package/package.json +31 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email Connector
|
|
3
|
+
* Sends transactional and marketing emails
|
|
4
|
+
*/
|
|
5
|
+
import { TransactionalEmailRequest, MarketingEmailRequest, BulkEmailRequest, EmailResult, BulkEmailResult, EmailTemplate, CreateTemplateRequest } from './types';
|
|
6
|
+
export interface EmailProvider {
|
|
7
|
+
sendTransactional(request: TransactionalEmailRequest): Promise<EmailResult>;
|
|
8
|
+
sendMarketing(request: MarketingEmailRequest): Promise<EmailResult>;
|
|
9
|
+
sendBulk(request: BulkEmailRequest): Promise<BulkEmailResult>;
|
|
10
|
+
getTemplate(templateId: string): Promise<EmailTemplate>;
|
|
11
|
+
createTemplate(template: CreateTemplateRequest): Promise<EmailTemplate>;
|
|
12
|
+
listTemplates(): Promise<EmailTemplate[]>;
|
|
13
|
+
deleteTemplate(templateId: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare class EmailConnector {
|
|
16
|
+
private provider;
|
|
17
|
+
constructor(provider: EmailProvider);
|
|
18
|
+
/**
|
|
19
|
+
* Send transactional email
|
|
20
|
+
*/
|
|
21
|
+
sendTransactional(request: TransactionalEmailRequest): Promise<EmailResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Send marketing email
|
|
24
|
+
*/
|
|
25
|
+
sendMarketing(request: MarketingEmailRequest): Promise<EmailResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Send bulk emails
|
|
28
|
+
*/
|
|
29
|
+
sendBulk(request: BulkEmailRequest): Promise<BulkEmailResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Get email template
|
|
32
|
+
*/
|
|
33
|
+
getTemplate(templateId: string): Promise<EmailTemplate>;
|
|
34
|
+
/**
|
|
35
|
+
* Create email template
|
|
36
|
+
*/
|
|
37
|
+
createTemplate(template: CreateTemplateRequest): Promise<EmailTemplate>;
|
|
38
|
+
/**
|
|
39
|
+
* List all email templates
|
|
40
|
+
*/
|
|
41
|
+
listTemplates(): Promise<EmailTemplate[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Delete email template
|
|
44
|
+
*/
|
|
45
|
+
deleteTemplate(templateId: string): Promise<void>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=email-connector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-connector.d.ts","sourceRoot":"","sources":["../src/email-connector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,aAAa,EACb,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAGjB,MAAM,WAAW,aAAa;IAC5B,iBAAiB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5E,aAAa,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACpE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9D,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACxD,cAAc,CAAC,QAAQ,EAAE,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACxE,aAAa,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1C,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAgB;gBAEpB,QAAQ,EAAE,aAAa;IAInC;;OAEG;IACG,iBAAiB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,WAAW,CAAC;IAsCjF;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAuBzE;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IA6BnE;;OAEG;IACG,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAI7D;;OAEG;IACG,cAAc,CAAC,QAAQ,EAAE,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;IAQ7E;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAI/C;;OAEG;IACG,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIxD"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Email Connector
|
|
4
|
+
* Sends transactional and marketing emails
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.EmailConnector = void 0;
|
|
8
|
+
const utils_logger_1 = require("@xbg/utils-logger");
|
|
9
|
+
class EmailConnector {
|
|
10
|
+
constructor(provider) {
|
|
11
|
+
this.provider = provider;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Send transactional email
|
|
15
|
+
*/
|
|
16
|
+
async sendTransactional(request) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
try {
|
|
19
|
+
utils_logger_1.logger.info('Sending transactional email', {
|
|
20
|
+
recipientCount: request.to.length,
|
|
21
|
+
subject: request.subject,
|
|
22
|
+
templateId: request.templateId,
|
|
23
|
+
});
|
|
24
|
+
const result = await this.provider.sendTransactional(request);
|
|
25
|
+
if (result.success) {
|
|
26
|
+
utils_logger_1.logger.info('Email sent successfully', {
|
|
27
|
+
messageId: result.messageId,
|
|
28
|
+
recipients: result.recipients,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
utils_logger_1.logger.warn('Failed to send email', {
|
|
33
|
+
errorCode: (_a = result.error) === null || _a === void 0 ? void 0 : _a.code,
|
|
34
|
+
errorMessage: (_b = result.error) === null || _b === void 0 ? void 0 : _b.message,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
const errorObj = error instanceof Error ? error : new Error(String(error));
|
|
41
|
+
utils_logger_1.logger.error('Email send error', errorObj);
|
|
42
|
+
return {
|
|
43
|
+
success: false,
|
|
44
|
+
error: {
|
|
45
|
+
code: 'SEND_ERROR',
|
|
46
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
47
|
+
},
|
|
48
|
+
timestamp: new Date(),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Send marketing email
|
|
54
|
+
*/
|
|
55
|
+
async sendMarketing(request) {
|
|
56
|
+
try {
|
|
57
|
+
utils_logger_1.logger.info('Sending marketing email', {
|
|
58
|
+
recipientCount: request.to.length,
|
|
59
|
+
campaignId: request.campaignId,
|
|
60
|
+
});
|
|
61
|
+
return await this.provider.sendMarketing(request);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const errorObj = error instanceof Error ? error : new Error(String(error));
|
|
65
|
+
utils_logger_1.logger.error('Marketing email error', errorObj);
|
|
66
|
+
return {
|
|
67
|
+
success: false,
|
|
68
|
+
error: {
|
|
69
|
+
code: 'MARKETING_SEND_ERROR',
|
|
70
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
71
|
+
},
|
|
72
|
+
timestamp: new Date(),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Send bulk emails
|
|
78
|
+
*/
|
|
79
|
+
async sendBulk(request) {
|
|
80
|
+
try {
|
|
81
|
+
utils_logger_1.logger.info('Sending bulk emails', {
|
|
82
|
+
count: request.emails.length,
|
|
83
|
+
batchSize: request.batchSize,
|
|
84
|
+
});
|
|
85
|
+
const result = await this.provider.sendBulk(request);
|
|
86
|
+
utils_logger_1.logger.info('Bulk email complete', {
|
|
87
|
+
successful: result.successful,
|
|
88
|
+
failed: result.failed,
|
|
89
|
+
});
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
const errorObj = error instanceof Error ? error : new Error(String(error));
|
|
94
|
+
utils_logger_1.logger.error('Bulk email error', errorObj);
|
|
95
|
+
return {
|
|
96
|
+
success: false,
|
|
97
|
+
successful: 0,
|
|
98
|
+
failed: request.emails.length,
|
|
99
|
+
results: [],
|
|
100
|
+
timestamp: new Date(),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get email template
|
|
106
|
+
*/
|
|
107
|
+
async getTemplate(templateId) {
|
|
108
|
+
return this.provider.getTemplate(templateId);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Create email template
|
|
112
|
+
*/
|
|
113
|
+
async createTemplate(template) {
|
|
114
|
+
utils_logger_1.logger.info('Creating email template', {
|
|
115
|
+
name: template.name,
|
|
116
|
+
});
|
|
117
|
+
return this.provider.createTemplate(template);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* List all email templates
|
|
121
|
+
*/
|
|
122
|
+
async listTemplates() {
|
|
123
|
+
return this.provider.listTemplates();
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Delete email template
|
|
127
|
+
*/
|
|
128
|
+
async deleteTemplate(templateId) {
|
|
129
|
+
utils_logger_1.logger.info('Deleting email template', { templateId });
|
|
130
|
+
return this.provider.deleteTemplate(templateId);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.EmailConnector = EmailConnector;
|
|
134
|
+
//# sourceMappingURL=email-connector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-connector.js","sourceRoot":"","sources":["../src/email-connector.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH,oDAA2C;AAY3C,MAAa,cAAc;IAGzB,YAAY,QAAuB;QACjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB,CAAC,OAAkC;;QACxD,IAAI,CAAC;YACH,qBAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE;gBACzC,cAAc,EAAE,OAAO,CAAC,EAAE,CAAC,MAAM;gBACjC,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;YAEH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;YAE9D,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,qBAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE;oBACrC,SAAS,EAAE,MAAM,CAAC,SAAS;oBAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;iBAC9B,CA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C;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,UAAkB;QAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,QAA+B;QAClD,qBAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE;YACrC,IAAI,EAAE,QAAQ,CAAC,IAAI;SACpB,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,UAAkB;QACrC,qBAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC;CACF;AA1ID,wCA0IC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email Connector Barrel Export
|
|
3
|
+
*/
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './email-connector';
|
|
6
|
+
export * from './providers/mailjet-provider';
|
|
7
|
+
export * from './providers/ortto-provider';
|
|
8
|
+
import { EmailConnector } from './email-connector';
|
|
9
|
+
export declare function initializeEmailConnector(config: any): void;
|
|
10
|
+
/**
|
|
11
|
+
* Factory function to create email connector with configuration
|
|
12
|
+
*/
|
|
13
|
+
export declare function createEmailConnector(): EmailConnector | null;
|
|
14
|
+
export declare function getEmailConnector(): EmailConnector | null;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOnD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAI1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,GAAG,IAAI,CA4C5D;AAOD,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,IAAI,CAKzD"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Email Connector Barrel Export
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.initializeEmailConnector = initializeEmailConnector;
|
|
21
|
+
exports.createEmailConnector = createEmailConnector;
|
|
22
|
+
exports.getEmailConnector = getEmailConnector;
|
|
23
|
+
__exportStar(require("./types"), exports);
|
|
24
|
+
__exportStar(require("./email-connector"), exports);
|
|
25
|
+
__exportStar(require("./providers/mailjet-provider"), exports);
|
|
26
|
+
__exportStar(require("./providers/ortto-provider"), exports);
|
|
27
|
+
const email_connector_1 = require("./email-connector");
|
|
28
|
+
const mailjet_provider_1 = require("./providers/mailjet-provider");
|
|
29
|
+
const ortto_provider_1 = require("./providers/ortto-provider");
|
|
30
|
+
// Config is provided via initializeEmailConnector() at app startup
|
|
31
|
+
let connectorConfig = null;
|
|
32
|
+
function initializeEmailConnector(config) {
|
|
33
|
+
connectorConfig = config;
|
|
34
|
+
// Reset singleton so it gets re-created with new config
|
|
35
|
+
emailConnectorInstance = undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Factory function to create email connector with configuration
|
|
39
|
+
*/
|
|
40
|
+
function createEmailConnector() {
|
|
41
|
+
if (!connectorConfig) {
|
|
42
|
+
throw new Error('Email connector not initialized. Call initializeEmailConnector() first.');
|
|
43
|
+
}
|
|
44
|
+
if (!connectorConfig.email.enabled) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const provider = connectorConfig.email.provider;
|
|
48
|
+
if (provider === 'mailjet') {
|
|
49
|
+
const mailjetConfig = connectorConfig.email.providers.mailjet;
|
|
50
|
+
if (!mailjetConfig) {
|
|
51
|
+
throw new Error('Mailjet configuration not found');
|
|
52
|
+
}
|
|
53
|
+
const mailjetProvider = new mailjet_provider_1.MailjetProvider({
|
|
54
|
+
apiKey: mailjetConfig.apiKey,
|
|
55
|
+
secretKey: mailjetConfig.secretKey,
|
|
56
|
+
fromEmail: connectorConfig.email.fromAddress,
|
|
57
|
+
fromName: connectorConfig.email.fromName,
|
|
58
|
+
});
|
|
59
|
+
return new email_connector_1.EmailConnector(mailjetProvider);
|
|
60
|
+
}
|
|
61
|
+
if (provider === 'ortto') {
|
|
62
|
+
const orttoConfig = connectorConfig.email.providers.ortto;
|
|
63
|
+
if (!orttoConfig) {
|
|
64
|
+
throw new Error('Ortto configuration not found');
|
|
65
|
+
}
|
|
66
|
+
const orttoProvider = new ortto_provider_1.OrttoEmailProvider({
|
|
67
|
+
apiKey: orttoConfig.apiKey,
|
|
68
|
+
region: orttoConfig.region,
|
|
69
|
+
fromEmail: connectorConfig.email.fromAddress,
|
|
70
|
+
fromName: connectorConfig.email.fromName,
|
|
71
|
+
});
|
|
72
|
+
return new email_connector_1.EmailConnector(orttoProvider);
|
|
73
|
+
}
|
|
74
|
+
throw new Error(`Unsupported email provider: ${provider}`);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Singleton instance (lazy-loaded)
|
|
78
|
+
*/
|
|
79
|
+
let emailConnectorInstance;
|
|
80
|
+
function getEmailConnector() {
|
|
81
|
+
if (emailConnectorInstance === undefined) {
|
|
82
|
+
emailConnectorInstance = createEmailConnector();
|
|
83
|
+
}
|
|
84
|
+
return emailConnectorInstance;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAcH,4DAIC;AAKD,oDA4CC;AAOD,8CAKC;AA7ED,0CAAwB;AACxB,oDAAkC;AAClC,+DAA6C;AAC7C,6DAA2C;AAE3C,uDAAmD;AACnD,mEAA+D;AAC/D,+DAAgE;AAEhE,mEAAmE;AACnE,IAAI,eAAe,GAAQ,IAAI,CAAC;AAEhC,SAAgB,wBAAwB,CAAC,MAAW;IAClD,eAAe,GAAG,MAAM,CAAC;IACzB,wDAAwD;IACxD,sBAAsB,GAAG,SAAS,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB;IAClC,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;IAED,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,OAAO,EAA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,sBAAyD,CAAC;AAE9D,SAAgB,iBAAiB;IAC/B,IAAI,sBAAsB,KAAK,SAAS,EAAE,CAAC;QACzC,sBAAsB,GAAG,oBAAoB,EAAE,CAAC;IAClD,CAAC;IACD,OAAO,sBAAsB,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mailjet Email Provider
|
|
3
|
+
* Implementation using Mailjet API
|
|
4
|
+
*/
|
|
5
|
+
import { EmailProvider } from '../email-connector';
|
|
6
|
+
import { TransactionalEmailRequest, MarketingEmailRequest, BulkEmailRequest, EmailResult, BulkEmailResult, EmailTemplate, CreateTemplateRequest } from '../types';
|
|
7
|
+
export interface MailjetConfig {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
secretKey: string;
|
|
10
|
+
fromEmail: string;
|
|
11
|
+
fromName: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class MailjetProvider implements EmailProvider {
|
|
14
|
+
private client;
|
|
15
|
+
private config;
|
|
16
|
+
constructor(config: MailjetConfig);
|
|
17
|
+
/**
|
|
18
|
+
* Send transactional email
|
|
19
|
+
*/
|
|
20
|
+
sendTransactional(request: TransactionalEmailRequest): Promise<EmailResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Send marketing email
|
|
23
|
+
*/
|
|
24
|
+
sendMarketing(request: MarketingEmailRequest): Promise<EmailResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Send bulk emails
|
|
27
|
+
*/
|
|
28
|
+
sendBulk(request: BulkEmailRequest): Promise<BulkEmailResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Get email template
|
|
31
|
+
*/
|
|
32
|
+
getTemplate(templateId: string): Promise<EmailTemplate>;
|
|
33
|
+
/**
|
|
34
|
+
* Create email template
|
|
35
|
+
*/
|
|
36
|
+
createTemplate(template: CreateTemplateRequest): Promise<EmailTemplate>;
|
|
37
|
+
/**
|
|
38
|
+
* List all templates
|
|
39
|
+
*/
|
|
40
|
+
listTemplates(): Promise<EmailTemplate[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Delete template
|
|
43
|
+
*/
|
|
44
|
+
deleteTemplate(templateId: string): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=mailjet-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mailjet-provider.d.ts","sourceRoot":"","sources":["../../src/providers/mailjet-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,aAAa,EACb,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,eAAgB,YAAW,aAAa;IACnD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,aAAa;IAKjC;;OAEG;IACG,iBAAiB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,WAAW,CAAC;IAmEjF;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAKzE;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAiCnE;;OAEG;IACG,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAmB7D;;OAEG;IACG,cAAc,CAAC,QAAQ,EAAE,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;IA2B7E;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAmB/C;;OAEG;IACG,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGxD"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Mailjet Email Provider
|
|
4
|
+
* Implementation using Mailjet API
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.MailjetProvider = void 0;
|
|
11
|
+
const node_mailjet_1 = __importDefault(require("node-mailjet"));
|
|
12
|
+
class MailjetProvider {
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.config = config;
|
|
15
|
+
this.client = node_mailjet_1.default.apiConnect(config.apiKey, config.secretKey);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Send transactional email
|
|
19
|
+
*/
|
|
20
|
+
async sendTransactional(request) {
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
22
|
+
try {
|
|
23
|
+
const message = {
|
|
24
|
+
From: {
|
|
25
|
+
Email: this.config.fromEmail,
|
|
26
|
+
Name: this.config.fromName,
|
|
27
|
+
},
|
|
28
|
+
To: request.to.map((recipient) => ({
|
|
29
|
+
Email: recipient.email,
|
|
30
|
+
Name: recipient.name,
|
|
31
|
+
Variables: recipient.variables,
|
|
32
|
+
})),
|
|
33
|
+
Subject: request.subject,
|
|
34
|
+
ReplyTo: request.replyTo ? { Email: request.replyTo } : undefined,
|
|
35
|
+
};
|
|
36
|
+
// Use template or raw content
|
|
37
|
+
if (request.templateId) {
|
|
38
|
+
message.TemplateID = parseInt(request.templateId, 10);
|
|
39
|
+
message.TemplateLanguage = true;
|
|
40
|
+
message.Variables = request.variables || {};
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
message.HTMLPart = request.htmlContent;
|
|
44
|
+
message.TextPart = request.textContent;
|
|
45
|
+
}
|
|
46
|
+
// Add attachments
|
|
47
|
+
if (request.attachments && request.attachments.length > 0) {
|
|
48
|
+
message.Attachments = request.attachments.map((att) => ({
|
|
49
|
+
Filename: att.filename,
|
|
50
|
+
ContentType: att.contentType || 'application/octet-stream',
|
|
51
|
+
Base64Content: Buffer.isBuffer(att.content)
|
|
52
|
+
? att.content.toString('base64')
|
|
53
|
+
: Buffer.from(att.content).toString('base64'),
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
// Add custom headers for tags
|
|
57
|
+
if (request.tags && request.tags.length > 0) {
|
|
58
|
+
message.CustomCampaign = request.tags.join(',');
|
|
59
|
+
}
|
|
60
|
+
const result = await this.client.post('send', { version: 'v3.1' }).request({
|
|
61
|
+
Messages: [message],
|
|
62
|
+
});
|
|
63
|
+
const data = result.body;
|
|
64
|
+
return {
|
|
65
|
+
success: true,
|
|
66
|
+
messageId: (_e = (_d = (_c = (_b = (_a = data.Messages) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.To) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.MessageID) === null || _e === void 0 ? void 0 : _e.toString(),
|
|
67
|
+
recipients: request.to.length,
|
|
68
|
+
timestamp: new Date(),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
return {
|
|
73
|
+
success: false,
|
|
74
|
+
error: {
|
|
75
|
+
code: ((_f = error.statusCode) === null || _f === void 0 ? void 0 : _f.toString()) || 'MAILJET_ERROR',
|
|
76
|
+
message: error.message || 'Unknown Mailjet error',
|
|
77
|
+
details: (_g = error.response) === null || _g === void 0 ? void 0 : _g.body,
|
|
78
|
+
},
|
|
79
|
+
timestamp: new Date(),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Send marketing email
|
|
85
|
+
*/
|
|
86
|
+
async sendMarketing(request) {
|
|
87
|
+
// Marketing emails use the same Mailjet API with campaign tracking
|
|
88
|
+
return this.sendTransactional(request);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Send bulk emails
|
|
92
|
+
*/
|
|
93
|
+
async sendBulk(request) {
|
|
94
|
+
const batchSize = request.batchSize || 50;
|
|
95
|
+
const results = [];
|
|
96
|
+
let successful = 0;
|
|
97
|
+
let failed = 0;
|
|
98
|
+
// Process in batches
|
|
99
|
+
for (let i = 0; i < request.emails.length; i += batchSize) {
|
|
100
|
+
const batch = request.emails.slice(i, i + batchSize);
|
|
101
|
+
await Promise.all(batch.map(async (email) => {
|
|
102
|
+
const result = await this.sendTransactional(email);
|
|
103
|
+
results.push(result);
|
|
104
|
+
if (result.success) {
|
|
105
|
+
successful++;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
failed++;
|
|
109
|
+
}
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
success: failed === 0,
|
|
114
|
+
successful,
|
|
115
|
+
failed,
|
|
116
|
+
results,
|
|
117
|
+
timestamp: new Date(),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Get email template
|
|
122
|
+
*/
|
|
123
|
+
async getTemplate(templateId) {
|
|
124
|
+
const result = await this.client.get('template', { version: 'v3' }).id(templateId).request();
|
|
125
|
+
const template = result.body.Data[0];
|
|
126
|
+
return {
|
|
127
|
+
id: template.ID.toString(),
|
|
128
|
+
name: template.Name,
|
|
129
|
+
subject: template.Subject || '',
|
|
130
|
+
htmlContent: template.Html || '',
|
|
131
|
+
textContent: template.Text,
|
|
132
|
+
variables: [], // Mailjet doesn't expose variable definitions
|
|
133
|
+
metadata: {
|
|
134
|
+
createdAt: new Date(template.CreatedAt),
|
|
135
|
+
updatedAt: new Date(template.EditedAt),
|
|
136
|
+
version: '1.0',
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Create email template
|
|
142
|
+
*/
|
|
143
|
+
async createTemplate(template) {
|
|
144
|
+
const result = await this.client.post('template', { version: 'v3' }).request({
|
|
145
|
+
Name: template.name,
|
|
146
|
+
Subject: template.subject,
|
|
147
|
+
Html: template.htmlContent,
|
|
148
|
+
Text: template.textContent,
|
|
149
|
+
Purposes: ['transactional'],
|
|
150
|
+
});
|
|
151
|
+
const created = result.body.Data[0];
|
|
152
|
+
return {
|
|
153
|
+
id: created.ID.toString(),
|
|
154
|
+
name: created.Name,
|
|
155
|
+
subject: created.Subject,
|
|
156
|
+
htmlContent: created.Html,
|
|
157
|
+
textContent: created.Text,
|
|
158
|
+
variables: template.variables || [],
|
|
159
|
+
metadata: {
|
|
160
|
+
createdAt: new Date(),
|
|
161
|
+
updatedAt: new Date(),
|
|
162
|
+
version: '1.0',
|
|
163
|
+
tags: template.tags,
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* List all templates
|
|
169
|
+
*/
|
|
170
|
+
async listTemplates() {
|
|
171
|
+
const result = await this.client.get('template', { version: 'v3' }).request();
|
|
172
|
+
const templates = result.body.Data || [];
|
|
173
|
+
return templates.map((t) => ({
|
|
174
|
+
id: t.ID.toString(),
|
|
175
|
+
name: t.Name,
|
|
176
|
+
subject: t.Subject || '',
|
|
177
|
+
htmlContent: t.Html || '',
|
|
178
|
+
textContent: t.Text,
|
|
179
|
+
variables: [],
|
|
180
|
+
metadata: {
|
|
181
|
+
createdAt: new Date(t.CreatedAt),
|
|
182
|
+
updatedAt: new Date(t.EditedAt),
|
|
183
|
+
version: '1.0',
|
|
184
|
+
},
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Delete template
|
|
189
|
+
*/
|
|
190
|
+
async deleteTemplate(templateId) {
|
|
191
|
+
await this.client.delete('template', { version: 'v3' }).id(templateId).request();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
exports.MailjetProvider = MailjetProvider;
|
|
195
|
+
//# sourceMappingURL=mailjet-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mailjet-provider.js","sourceRoot":"","sources":["../../src/providers/mailjet-provider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,gEAAmC;AAoBnC,MAAa,eAAe;IAI1B,YAAY,MAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,sBAAO,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;IACpE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB,CAAC,OAAkC;;QACxD,IAAI,CAAC;YACH,MAAM,OAAO,GAAQ;gBACnB,IAAI,EAAE;oBACJ,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS;oBAC5B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;iBAC3B;gBACD,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;oBACjC,KAAK,EAAE,SAAS,CAAC,KAAK;oBACtB,IAAI,EAAE,SAAS,CAAC,IAAI;oBACpB,SAAS,EAAE,SAAS,CAAC,SAAS;iBAC/B,CAAC,CAAC;gBACH,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS;aAClE,CAAC;YAEF,8BAA8B;YAC9B,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;gBACvB,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;gBACtD,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;gBAChC,OA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C;QAElD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC;YAChC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE;YACnB,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,EAAE;YACxB,WAAW,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE;YACzB,WAAW,EAAE,CAAC,CAAC,IAAI;YACnB,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE;gBACR,SAAS,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;gBAChC,SAAS,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;gBAC/B,OAAO,EAAE,KAAK;aACf;SACF,CAAC,CAAC,CAAC;IACN,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,UAAkB;QACrC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;IACnF,CAAC;CACF;AA3MD,0CA2MC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ortto Email Provider
|
|
3
|
+
* Implementation for transactional emails via Ortto
|
|
4
|
+
* https://help.ortto.com/developer/latest/
|
|
5
|
+
*/
|
|
6
|
+
import { EmailProvider } from '../email-connector';
|
|
7
|
+
import { TransactionalEmailRequest, MarketingEmailRequest, BulkEmailRequest, EmailResult, BulkEmailResult, EmailTemplate, CreateTemplateRequest } from '../types';
|
|
8
|
+
export interface OrttoEmailConfig {
|
|
9
|
+
apiKey: string;
|
|
10
|
+
region?: 'us' | 'au' | 'eu';
|
|
11
|
+
fromEmail: string;
|
|
12
|
+
fromName: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class OrttoEmailProvider implements EmailProvider {
|
|
15
|
+
private client;
|
|
16
|
+
private config;
|
|
17
|
+
constructor(config: OrttoEmailConfig);
|
|
18
|
+
private getBaseURL;
|
|
19
|
+
/**
|
|
20
|
+
* Send transactional email via Ortto
|
|
21
|
+
*/
|
|
22
|
+
sendTransactional(request: TransactionalEmailRequest): Promise<EmailResult>;
|
|
23
|
+
/**
|
|
24
|
+
* Send marketing email
|
|
25
|
+
* Note: For Ortto, marketing campaigns are better handled via journey-connector
|
|
26
|
+
* This method delegates to transactional for simple sends
|
|
27
|
+
*/
|
|
28
|
+
sendMarketing(request: MarketingEmailRequest): Promise<EmailResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Send bulk emails
|
|
31
|
+
*/
|
|
32
|
+
sendBulk(request: BulkEmailRequest): Promise<BulkEmailResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Get email template
|
|
35
|
+
*/
|
|
36
|
+
getTemplate(templateId: string): Promise<EmailTemplate>;
|
|
37
|
+
/**
|
|
38
|
+
* Create email template
|
|
39
|
+
*/
|
|
40
|
+
createTemplate(template: CreateTemplateRequest): Promise<EmailTemplate>;
|
|
41
|
+
/**
|
|
42
|
+
* List all templates
|
|
43
|
+
*/
|
|
44
|
+
listTemplates(): Promise<EmailTemplate[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Delete template
|
|
47
|
+
*/
|
|
48
|
+
deleteTemplate(templateId: string): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=ortto-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ortto-provider.d.ts","sourceRoot":"","sources":["../../src/providers/ortto-provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,aAAa,EACb,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,kBAAmB,YAAW,aAAa;IACtD,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAmB;gBAErB,MAAM,EAAE,gBAAgB;IAcpC,OAAO,CAAC,UAAU;IASlB;;OAEG;IACG,iBAAiB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,WAAW,CAAC;IAgDjF;;;;OAIG;IACG,aAAa,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAIzE;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAsCnE;;OAEG;IACG,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAuB7D;;OAEG;IACG,cAAc,CAAC,QAAQ,EAAE,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;IAgC7E;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAuB/C;;OAEG;IACG,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAOxD"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Ortto Email Provider
|
|
4
|
+
* Implementation for transactional emails via Ortto
|
|
5
|
+
* https://help.ortto.com/developer/latest/
|
|
6
|
+
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.OrttoEmailProvider = void 0;
|
|
12
|
+
const axios_1 = __importDefault(require("axios"));
|
|
13
|
+
class OrttoEmailProvider {
|
|
14
|
+
constructor(config) {
|
|
15
|
+
this.config = config;
|
|
16
|
+
const baseURL = this.getBaseURL(config.region || 'us');
|
|
17
|
+
this.client = axios_1.default.create({
|
|
18
|
+
baseURL,
|
|
19
|
+
headers: {
|
|
20
|
+
'X-Api-Key': config.apiKey,
|
|
21
|
+
'Content-Type': 'application/json',
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
getBaseURL(region) {
|
|
26
|
+
const regionMap = {
|
|
27
|
+
us: 'https://api.ortto.com',
|
|
28
|
+
au: 'https://api.ap-southeast-2.ortto.com',
|
|
29
|
+
eu: 'https://api.eu-west-1.ortto.com',
|
|
30
|
+
};
|
|
31
|
+
return regionMap[region] || regionMap.us;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Send transactional email via Ortto
|
|
35
|
+
*/
|
|
36
|
+
async sendTransactional(request) {
|
|
37
|
+
var _a, _b, _c, _d, _e;
|
|
38
|
+
try {
|
|
39
|
+
const payload = {
|
|
40
|
+
from: {
|
|
41
|
+
email: this.config.fromEmail,
|
|
42
|
+
name: this.config.fromName,
|
|
43
|
+
},
|
|
44
|
+
to: request.to.map(recipient => ({
|
|
45
|
+
email: recipient.email,
|
|
46
|
+
name: recipient.name,
|
|
47
|
+
})),
|
|
48
|
+
subject: request.subject,
|
|
49
|
+
reply_to: request.replyTo,
|
|
50
|
+
template_id: request.templateId,
|
|
51
|
+
variables: request.variables || {},
|
|
52
|
+
html: request.htmlContent,
|
|
53
|
+
text: request.textContent,
|
|
54
|
+
attachments: (_a = request.attachments) === null || _a === void 0 ? void 0 : _a.map(att => ({
|
|
55
|
+
filename: att.filename,
|
|
56
|
+
content_type: att.contentType || 'application/octet-stream',
|
|
57
|
+
content: Buffer.isBuffer(att.content)
|
|
58
|
+
? att.content.toString('base64')
|
|
59
|
+
: Buffer.from(att.content).toString('base64'),
|
|
60
|
+
})),
|
|
61
|
+
tags: request.tags,
|
|
62
|
+
};
|
|
63
|
+
const response = await this.client.post('/v1/email/send', payload);
|
|
64
|
+
return {
|
|
65
|
+
success: true,
|
|
66
|
+
messageId: (_b = response.data) === null || _b === void 0 ? void 0 : _b.message_id,
|
|
67
|
+
recipients: request.to.length,
|
|
68
|
+
timestamp: new Date(),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
return {
|
|
73
|
+
success: false,
|
|
74
|
+
error: {
|
|
75
|
+
code: ((_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.status) === null || _d === void 0 ? void 0 : _d.toString()) || 'ORTTO_ERROR',
|
|
76
|
+
message: error.message || 'Unknown Ortto error',
|
|
77
|
+
details: (_e = error.response) === null || _e === void 0 ? void 0 : _e.data,
|
|
78
|
+
},
|
|
79
|
+
timestamp: new Date(),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Send marketing email
|
|
85
|
+
* Note: For Ortto, marketing campaigns are better handled via journey-connector
|
|
86
|
+
* This method delegates to transactional for simple sends
|
|
87
|
+
*/
|
|
88
|
+
async sendMarketing(request) {
|
|
89
|
+
return this.sendTransactional(request);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Send bulk emails
|
|
93
|
+
*/
|
|
94
|
+
async sendBulk(request) {
|
|
95
|
+
const batchSize = request.batchSize || 50;
|
|
96
|
+
const results = [];
|
|
97
|
+
let successful = 0;
|
|
98
|
+
let failed = 0;
|
|
99
|
+
// Process in batches
|
|
100
|
+
for (let i = 0; i < request.emails.length; i += batchSize) {
|
|
101
|
+
const batch = request.emails.slice(i, i + batchSize);
|
|
102
|
+
await Promise.all(batch.map(async (email) => {
|
|
103
|
+
const result = await this.sendTransactional(email);
|
|
104
|
+
results.push(result);
|
|
105
|
+
if (result.success) {
|
|
106
|
+
successful++;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
failed++;
|
|
110
|
+
}
|
|
111
|
+
}));
|
|
112
|
+
// Add delay between batches to respect rate limits
|
|
113
|
+
if (i + batchSize < request.emails.length) {
|
|
114
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
success: failed === 0,
|
|
119
|
+
successful,
|
|
120
|
+
failed,
|
|
121
|
+
results,
|
|
122
|
+
timestamp: new Date(),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get email template
|
|
127
|
+
*/
|
|
128
|
+
async getTemplate(templateId) {
|
|
129
|
+
try {
|
|
130
|
+
const response = await this.client.get(`/v1/email/templates/${templateId}`);
|
|
131
|
+
const template = response.data;
|
|
132
|
+
return {
|
|
133
|
+
id: template.id,
|
|
134
|
+
name: template.name,
|
|
135
|
+
subject: template.subject || '',
|
|
136
|
+
htmlContent: template.html || '',
|
|
137
|
+
textContent: template.text,
|
|
138
|
+
variables: template.variables || [],
|
|
139
|
+
metadata: {
|
|
140
|
+
createdAt: new Date(template.created_at),
|
|
141
|
+
updatedAt: new Date(template.updated_at),
|
|
142
|
+
version: template.version || '1.0',
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
throw new Error(`Failed to get template: ${error.message}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Create email template
|
|
152
|
+
*/
|
|
153
|
+
async createTemplate(template) {
|
|
154
|
+
try {
|
|
155
|
+
const response = await this.client.post('/v1/email/templates', {
|
|
156
|
+
name: template.name,
|
|
157
|
+
subject: template.subject,
|
|
158
|
+
html: template.htmlContent,
|
|
159
|
+
text: template.textContent,
|
|
160
|
+
variables: template.variables,
|
|
161
|
+
tags: template.tags,
|
|
162
|
+
});
|
|
163
|
+
const created = response.data;
|
|
164
|
+
return {
|
|
165
|
+
id: created.id,
|
|
166
|
+
name: created.name,
|
|
167
|
+
subject: created.subject,
|
|
168
|
+
htmlContent: created.html,
|
|
169
|
+
textContent: created.text,
|
|
170
|
+
variables: template.variables || [],
|
|
171
|
+
metadata: {
|
|
172
|
+
createdAt: new Date(),
|
|
173
|
+
updatedAt: new Date(),
|
|
174
|
+
version: '1.0',
|
|
175
|
+
tags: template.tags,
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
throw new Error(`Failed to create template: ${error.message}`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* List all templates
|
|
185
|
+
*/
|
|
186
|
+
async listTemplates() {
|
|
187
|
+
var _a;
|
|
188
|
+
try {
|
|
189
|
+
const response = await this.client.get('/v1/email/templates');
|
|
190
|
+
const templates = ((_a = response.data) === null || _a === void 0 ? void 0 : _a.templates) || [];
|
|
191
|
+
return templates.map((t) => ({
|
|
192
|
+
id: t.id,
|
|
193
|
+
name: t.name,
|
|
194
|
+
subject: t.subject || '',
|
|
195
|
+
htmlContent: t.html || '',
|
|
196
|
+
textContent: t.text,
|
|
197
|
+
variables: t.variables || [],
|
|
198
|
+
metadata: {
|
|
199
|
+
createdAt: new Date(t.created_at),
|
|
200
|
+
updatedAt: new Date(t.updated_at),
|
|
201
|
+
version: t.version || '1.0',
|
|
202
|
+
},
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
throw new Error(`Failed to list templates: ${error.message}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Delete template
|
|
211
|
+
*/
|
|
212
|
+
async deleteTemplate(templateId) {
|
|
213
|
+
try {
|
|
214
|
+
await this.client.delete(`/v1/email/templates/${templateId}`);
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
throw new Error(`Failed to delete template: ${error.message}`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
exports.OrttoEmailProvider = OrttoEmailProvider;
|
|
222
|
+
//# sourceMappingURL=ortto-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ortto-provider.js","sourceRoot":"","sources":["../../src/providers/ortto-provider.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,kDAA6C;AAmB7C,MAAa,kBAAkB;IAI7B,YAAY,MAAwB;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC;QAEvD,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO;YACP,OAAO,EAAE;gBACP,WAAW,EAAE,MAAM,CAAC,MAAM;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CAAC;IACL,CAAC;IAEO,UAAU,CAAC,MAAc;QAC/B,MAAM,SAAS,GAA2B;YACxC,EAAE,EAAE,uBAAuB;YAC3B,EAAE,EAAE,sCAAsC;YAC1C,EAAE,EAAE,iCAAiC;SACtC,CAAC;QACF,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB,CAAC,OAAkC;;QACxD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG;gBACd,IAAI,EAAE;oBACJ,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS;oBAC5B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;iBAC3B;gBACD,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;oBAC/B,KAAK,EAAE,SAAS,CAAC,KAAK;oBACtB,IAAI,EAAE,SAAS,CAAC,IAAI;iBACrB,CAAC,CAAC;gBACH,OA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E,CAAC,CAAC,IAAI;gBACZ,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,EAAE;gBACxB,WAAW,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE;gBACzB,WAAW,EAAE,CAAC,CAAC,IAAI;gBACnB,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,EAAE;gBAC5B,QAAQ,EAAE;oBACR,SAAS,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;oBACjC,SAAS,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;oBACjC,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,KAAK;iBAC5B;aACF,CAAC,CAAC,CAAC;QACN,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,6BAA6B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,UAAkB;QACrC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,uBAAuB,UAAU,EAAE,CAAC,CAAC;QAChE,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,8BAA8B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;CACF;AAjOD,gDAiOC"}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email Connector Types
|
|
3
|
+
*/
|
|
4
|
+
export interface TransactionalEmailRequest {
|
|
5
|
+
to: EmailRecipient[];
|
|
6
|
+
templateId?: string;
|
|
7
|
+
subject?: string;
|
|
8
|
+
htmlContent?: string;
|
|
9
|
+
textContent?: string;
|
|
10
|
+
variables?: Record<string, any>;
|
|
11
|
+
attachments?: EmailAttachment[];
|
|
12
|
+
replyTo?: string;
|
|
13
|
+
tags?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface MarketingEmailRequest extends TransactionalEmailRequest {
|
|
16
|
+
listId?: string;
|
|
17
|
+
campaignId?: string;
|
|
18
|
+
unsubscribeLink?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface BulkEmailRequest {
|
|
21
|
+
emails: TransactionalEmailRequest[];
|
|
22
|
+
batchSize?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface EmailRecipient {
|
|
25
|
+
email: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
variables?: Record<string, any>;
|
|
28
|
+
}
|
|
29
|
+
export interface EmailAttachment {
|
|
30
|
+
filename: string;
|
|
31
|
+
content: Buffer | string;
|
|
32
|
+
contentType?: string;
|
|
33
|
+
disposition?: 'attachment' | 'inline';
|
|
34
|
+
contentId?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface EmailResult {
|
|
37
|
+
success: boolean;
|
|
38
|
+
messageId?: string;
|
|
39
|
+
recipients?: number;
|
|
40
|
+
error?: EmailError;
|
|
41
|
+
timestamp: Date;
|
|
42
|
+
}
|
|
43
|
+
export interface BulkEmailResult {
|
|
44
|
+
success: boolean;
|
|
45
|
+
successful: number;
|
|
46
|
+
failed: number;
|
|
47
|
+
results: EmailResult[];
|
|
48
|
+
timestamp: Date;
|
|
49
|
+
}
|
|
50
|
+
export interface EmailError {
|
|
51
|
+
code: string;
|
|
52
|
+
message: string;
|
|
53
|
+
details?: Record<string, any>;
|
|
54
|
+
}
|
|
55
|
+
export interface EmailTemplate {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
subject: string;
|
|
59
|
+
htmlContent: string;
|
|
60
|
+
textContent?: string;
|
|
61
|
+
variables: TemplateVariable[];
|
|
62
|
+
metadata: TemplateMetadata;
|
|
63
|
+
}
|
|
64
|
+
export interface TemplateVariable {
|
|
65
|
+
name: string;
|
|
66
|
+
type: 'string' | 'number' | 'boolean' | 'date';
|
|
67
|
+
required: boolean;
|
|
68
|
+
defaultValue?: any;
|
|
69
|
+
description?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface TemplateMetadata {
|
|
72
|
+
createdAt: Date;
|
|
73
|
+
updatedAt: Date;
|
|
74
|
+
version: string;
|
|
75
|
+
author?: string;
|
|
76
|
+
tags?: string[];
|
|
77
|
+
}
|
|
78
|
+
export interface CreateTemplateRequest {
|
|
79
|
+
name: string;
|
|
80
|
+
subject: string;
|
|
81
|
+
htmlContent: string;
|
|
82
|
+
textContent?: string;
|
|
83
|
+
variables?: TemplateVariable[];
|
|
84
|
+
tags?: string[];
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,cAAc,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,qBAAsB,SAAQ,yBAAyB;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,yBAAyB,EAAE,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC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AAC;IAC/C,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB"}
|
package/lib/types.js
ADDED
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xbg.solutions/utils-email-connector",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Email sending with Mailjet and Ortto providers",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"build:watch": "tsc --watch",
|
|
13
|
+
"clean": "rm -rf lib",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@xbg/utils-logger": "^1.0.0",
|
|
18
|
+
"axios": "^1.6.2",
|
|
19
|
+
"node-mailjet": "^6.0.5"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^20.11.0",
|
|
23
|
+
"typescript": "^5.3.3"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": "22"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
}
|
|
31
|
+
}
|