@platform-x/hep-notification-client 1.2.1 → 1.2.3
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.
|
File without changes
|
|
File without changes
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EmailHandler } from "./platform-x/util/emailHandler";
|
|
2
2
|
import { TwilioService } from "./common/service/twilioService";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const initNotificationSecrets: (secretServiceIns: any) => void;
|
|
4
4
|
export declare const getIAMSecrets: () => any;
|
|
5
5
|
export { EmailHandler, TwilioService };
|
package/dist/src/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TwilioService = exports.EmailHandler = exports.getIAMSecrets = exports.
|
|
3
|
+
exports.TwilioService = exports.EmailHandler = exports.getIAMSecrets = exports.initNotificationSecrets = void 0;
|
|
4
4
|
const emailHandler_1 = require("./platform-x/util/emailHandler");
|
|
5
5
|
Object.defineProperty(exports, "EmailHandler", { enumerable: true, get: function () { return emailHandler_1.EmailHandler; } });
|
|
6
6
|
const twilioService_1 = require("./common/service/twilioService");
|
|
7
7
|
Object.defineProperty(exports, "TwilioService", { enumerable: true, get: function () { return twilioService_1.TwilioService; } });
|
|
8
8
|
let injectedSecretService;
|
|
9
|
-
const
|
|
9
|
+
const initNotificationSecrets = (secretServiceIns) => {
|
|
10
10
|
injectedSecretService = secretServiceIns;
|
|
11
11
|
};
|
|
12
|
-
exports.
|
|
12
|
+
exports.initNotificationSecrets = initNotificationSecrets;
|
|
13
13
|
const getIAMSecrets = () => {
|
|
14
14
|
if (!injectedSecretService) {
|
|
15
15
|
throw new Error("IAM secrets not initialized");
|
|
@@ -42,7 +42,7 @@ export declare class EmailHandler {
|
|
|
42
42
|
* @param emailConfig
|
|
43
43
|
* @returns
|
|
44
44
|
*/
|
|
45
|
-
sendEmailWithPersonalizations(emailConfig: any,
|
|
45
|
+
sendEmailWithPersonalizations(emailConfig: any, email_from?: any): Promise<unknown>;
|
|
46
46
|
/**
|
|
47
47
|
* Utility method to prepare CC emails in standardized format
|
|
48
48
|
* @param ccEmails - Can be string, array of strings, or Recipients array
|
|
@@ -226,12 +226,12 @@ class EmailHandler {
|
|
|
226
226
|
* @param emailConfig
|
|
227
227
|
* @returns
|
|
228
228
|
*/
|
|
229
|
-
sendEmailWithPersonalizations(emailConfig,
|
|
229
|
+
sendEmailWithPersonalizations(emailConfig, email_from) {
|
|
230
230
|
return __awaiter(this, void 0, void 0, function* () {
|
|
231
231
|
logger_1.Logger.info(`EmailHandler: Reached sendEmailWithPersonalizations method with emailConfig: ${JSON.stringify(emailConfig)}`, 'sendEmailWithPersonalizations');
|
|
232
232
|
logger_1.Logger.info(`EMAIL_FROM-------> ${config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.EMAIL_FROM}`, 'triggerEmails');
|
|
233
233
|
const Mail = sgHelpers.classes.Mail;
|
|
234
|
-
let email_from = isCFF ?
|
|
234
|
+
// let email_from = isCFF ? config?.CFF_MAIL_FROM : config?.EMAIL_FROM;
|
|
235
235
|
logger_1.Logger.info('sendEmailWithPersonalizations : Email From:', JSON.stringify(email_from));
|
|
236
236
|
const Personalization = sgHelpers.classes.Personalization;
|
|
237
237
|
const secrets = yield (0, __1.getIAMSecrets)();
|
|
@@ -340,7 +340,7 @@ class EmailHandler {
|
|
|
340
340
|
return __awaiter(this, void 0, void 0, function* () {
|
|
341
341
|
var _a, _b;
|
|
342
342
|
try {
|
|
343
|
-
let { email_type, replacement_variables, recipients, cc_recipients, isCFF =
|
|
343
|
+
let { email_type, replacement_variables, recipients, cc_recipients, isCFF = config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.EMAIL_FROM } = reqBody;
|
|
344
344
|
logger_1.Logger.info(`EmailHandler: reached in sendPersonalizeEmailRequest with emailType: ${email_type}`, 'sendPersonalizeEmailRequest');
|
|
345
345
|
// disable SOLR because of connectivity issue
|
|
346
346
|
logger_1.Logger.debug('Reached sendPersonalizeEmailRequest in emailHandler', 'sendPersonalizeEmailRequest');
|
|
@@ -379,9 +379,9 @@ class EmailHandler {
|
|
|
379
379
|
personalizations: recipientsData,
|
|
380
380
|
attachments: reqBody === null || reqBody === void 0 ? void 0 : reqBody.attachments,
|
|
381
381
|
};
|
|
382
|
-
let is_cff = (isCFF && isCFF === true) ? true : false;
|
|
382
|
+
// let is_cff: boolean = (isCFF && isCFF === true) ? true : false;
|
|
383
383
|
logger_1.Logger.info(`sendPersonalizeEmailRequest -${JSON.stringify(emailConfiguration)}`, 'sendPersonalizeEmailRequest');
|
|
384
|
-
return yield this.sendEmailWithPersonalizations(emailConfiguration,
|
|
384
|
+
return yield this.sendEmailWithPersonalizations(emailConfiguration, isCFF).then((response) => __awaiter(this, void 0, void 0, function* () {
|
|
385
385
|
if (response.statusCode === 202) {
|
|
386
386
|
response.msg =
|
|
387
387
|
'Thanks for getting in touch with us. We shall contact you soon.';
|