@develit-services/notification 0.0.18 → 0.0.19
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/export/worker.cjs +0 -11
- package/dist/export/worker.mjs +0 -11
- package/package.json +1 -1
package/dist/export/worker.cjs
CHANGED
|
@@ -61,7 +61,6 @@ class EcomailConnector extends IEmailConnector {
|
|
|
61
61
|
super({ API_KEY, SMTP_HOST, SENDER });
|
|
62
62
|
}
|
|
63
63
|
async sendEmail(email) {
|
|
64
|
-
console.log("ecomail - sendEmail");
|
|
65
64
|
if (email.templateVariables) {
|
|
66
65
|
for (const [key, value] of Object.entries(email.templateVariables)) {
|
|
67
66
|
if (typeof value === "string" && String(value).includes("localhost") && key in email.templateVariables) {
|
|
@@ -69,14 +68,8 @@ class EcomailConnector extends IEmailConnector {
|
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
|
-
console.log("ecomail - convertEmail");
|
|
73
71
|
const emEmail = this.convertEmail(email);
|
|
74
72
|
const uri = emEmail.message.template_id ? "https://api2.ecomailapp.cz/transactional/send-template" : "https://api2.ecomailapp.cz/transactional/send-message";
|
|
75
|
-
console.log("ecomail - start with fetch", {
|
|
76
|
-
uri,
|
|
77
|
-
emEmail,
|
|
78
|
-
apiKey: this.API_KEY
|
|
79
|
-
});
|
|
80
73
|
const [_, error] = await backendSdk.useFetch(uri, {
|
|
81
74
|
method: "POST",
|
|
82
75
|
headers: {
|
|
@@ -85,7 +78,6 @@ class EcomailConnector extends IEmailConnector {
|
|
|
85
78
|
},
|
|
86
79
|
body: JSON.stringify(emEmail)
|
|
87
80
|
});
|
|
88
|
-
console.log("ecomail - fetch done");
|
|
89
81
|
if (error) throw error;
|
|
90
82
|
}
|
|
91
83
|
convertEmail(email) {
|
|
@@ -416,9 +408,6 @@ class NotificationServiceBase extends backendSdk.develitWorker(
|
|
|
416
408
|
);
|
|
417
409
|
}
|
|
418
410
|
await this.emailConnector.sendEmail(email);
|
|
419
|
-
this.log({
|
|
420
|
-
message: `Email sent to ${email.to}`
|
|
421
|
-
});
|
|
422
411
|
const { command } = await createAuditLogCommand({
|
|
423
412
|
db: this.db,
|
|
424
413
|
auditLog: {
|
package/dist/export/worker.mjs
CHANGED
|
@@ -52,7 +52,6 @@ class EcomailConnector extends IEmailConnector {
|
|
|
52
52
|
super({ API_KEY, SMTP_HOST, SENDER });
|
|
53
53
|
}
|
|
54
54
|
async sendEmail(email) {
|
|
55
|
-
console.log("ecomail - sendEmail");
|
|
56
55
|
if (email.templateVariables) {
|
|
57
56
|
for (const [key, value] of Object.entries(email.templateVariables)) {
|
|
58
57
|
if (typeof value === "string" && String(value).includes("localhost") && key in email.templateVariables) {
|
|
@@ -60,14 +59,8 @@ class EcomailConnector extends IEmailConnector {
|
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
|
-
console.log("ecomail - convertEmail");
|
|
64
62
|
const emEmail = this.convertEmail(email);
|
|
65
63
|
const uri = emEmail.message.template_id ? "https://api2.ecomailapp.cz/transactional/send-template" : "https://api2.ecomailapp.cz/transactional/send-message";
|
|
66
|
-
console.log("ecomail - start with fetch", {
|
|
67
|
-
uri,
|
|
68
|
-
emEmail,
|
|
69
|
-
apiKey: this.API_KEY
|
|
70
|
-
});
|
|
71
64
|
const [_, error] = await useFetch(uri, {
|
|
72
65
|
method: "POST",
|
|
73
66
|
headers: {
|
|
@@ -76,7 +69,6 @@ class EcomailConnector extends IEmailConnector {
|
|
|
76
69
|
},
|
|
77
70
|
body: JSON.stringify(emEmail)
|
|
78
71
|
});
|
|
79
|
-
console.log("ecomail - fetch done");
|
|
80
72
|
if (error) throw error;
|
|
81
73
|
}
|
|
82
74
|
convertEmail(email) {
|
|
@@ -407,9 +399,6 @@ class NotificationServiceBase extends develitWorker(
|
|
|
407
399
|
);
|
|
408
400
|
}
|
|
409
401
|
await this.emailConnector.sendEmail(email);
|
|
410
|
-
this.log({
|
|
411
|
-
message: `Email sent to ${email.to}`
|
|
412
|
-
});
|
|
413
402
|
const { command } = await createAuditLogCommand({
|
|
414
403
|
db: this.db,
|
|
415
404
|
auditLog: {
|