av6-core 1.0.16 → 1.0.18
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/index.js +18 -10
- package/dist/index.mjs +18 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1572,8 +1572,10 @@ var SmsProvider = class {
|
|
|
1572
1572
|
// src/providers/whatsapp.provider.ts
|
|
1573
1573
|
var import_axios2 = __toESM(require("axios"));
|
|
1574
1574
|
var WhatsAppProvider = class {
|
|
1575
|
-
constructor(args) {
|
|
1575
|
+
constructor(args, logger) {
|
|
1576
1576
|
this.args = args;
|
|
1577
|
+
this.logger = logger;
|
|
1578
|
+
this.logger.info(`[NotificationService] args for whatsapp : ${JSON.stringify(args)}`);
|
|
1577
1579
|
this.apiUrl = args.apiUrl || "https://api.interakt.ai/v1/public/message/";
|
|
1578
1580
|
this.apiKey = "RW9FTlFWM3h3aTdGbmJhVFFRU0RQdzVUdERyQl84VkU2RFRJWVdhcW8xZzo=";
|
|
1579
1581
|
}
|
|
@@ -1588,8 +1590,10 @@ var WhatsAppProvider = class {
|
|
|
1588
1590
|
error: "Missing recipient.whatsapp/phone"
|
|
1589
1591
|
};
|
|
1590
1592
|
}
|
|
1591
|
-
const
|
|
1592
|
-
|
|
1593
|
+
const allRecipients = [to];
|
|
1594
|
+
if (this.args.masterNumber) {
|
|
1595
|
+
allRecipients.push(this.args.masterNumber);
|
|
1596
|
+
}
|
|
1593
1597
|
try {
|
|
1594
1598
|
for (const recipient of allRecipients) {
|
|
1595
1599
|
const requestBody = {
|
|
@@ -1700,13 +1704,17 @@ var NotificationService = class {
|
|
|
1700
1704
|
}
|
|
1701
1705
|
const emailProvider = new EmailProvider(this.prisma, this.logger, this.envMode);
|
|
1702
1706
|
const smsProvider = new SmsProvider();
|
|
1703
|
-
const waProvider = new WhatsAppProvider(
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1707
|
+
const waProvider = new WhatsAppProvider(
|
|
1708
|
+
{
|
|
1709
|
+
apiUrl: cfg.serviceEvent.wpApiUrl,
|
|
1710
|
+
templateName: waTpl.templateCode,
|
|
1711
|
+
callbackData: "",
|
|
1712
|
+
countryCode: cfg.serviceEvent.countryCode,
|
|
1713
|
+
languageCode: "en",
|
|
1714
|
+
masterNumber: cfg.serviceEvent.masterPhone
|
|
1715
|
+
},
|
|
1716
|
+
this.logger
|
|
1717
|
+
);
|
|
1710
1718
|
const appProvider = new AppNotificationProvider();
|
|
1711
1719
|
this.logger.info(`[NotificationService] Email Template: ${JSON.stringify(emailTpl)}`);
|
|
1712
1720
|
this.logger.info(`[NotificationService] SMS Template: ${JSON.stringify(smsTpl)}`);
|
package/dist/index.mjs
CHANGED
|
@@ -1526,8 +1526,10 @@ var SmsProvider = class {
|
|
|
1526
1526
|
// src/providers/whatsapp.provider.ts
|
|
1527
1527
|
import axios2 from "axios";
|
|
1528
1528
|
var WhatsAppProvider = class {
|
|
1529
|
-
constructor(args) {
|
|
1529
|
+
constructor(args, logger) {
|
|
1530
1530
|
this.args = args;
|
|
1531
|
+
this.logger = logger;
|
|
1532
|
+
this.logger.info(`[NotificationService] args for whatsapp : ${JSON.stringify(args)}`);
|
|
1531
1533
|
this.apiUrl = args.apiUrl || "https://api.interakt.ai/v1/public/message/";
|
|
1532
1534
|
this.apiKey = "RW9FTlFWM3h3aTdGbmJhVFFRU0RQdzVUdERyQl84VkU2RFRJWVdhcW8xZzo=";
|
|
1533
1535
|
}
|
|
@@ -1542,8 +1544,10 @@ var WhatsAppProvider = class {
|
|
|
1542
1544
|
error: "Missing recipient.whatsapp/phone"
|
|
1543
1545
|
};
|
|
1544
1546
|
}
|
|
1545
|
-
const
|
|
1546
|
-
|
|
1547
|
+
const allRecipients = [to];
|
|
1548
|
+
if (this.args.masterNumber) {
|
|
1549
|
+
allRecipients.push(this.args.masterNumber);
|
|
1550
|
+
}
|
|
1547
1551
|
try {
|
|
1548
1552
|
for (const recipient of allRecipients) {
|
|
1549
1553
|
const requestBody = {
|
|
@@ -1654,13 +1658,17 @@ var NotificationService = class {
|
|
|
1654
1658
|
}
|
|
1655
1659
|
const emailProvider = new EmailProvider(this.prisma, this.logger, this.envMode);
|
|
1656
1660
|
const smsProvider = new SmsProvider();
|
|
1657
|
-
const waProvider = new WhatsAppProvider(
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1661
|
+
const waProvider = new WhatsAppProvider(
|
|
1662
|
+
{
|
|
1663
|
+
apiUrl: cfg.serviceEvent.wpApiUrl,
|
|
1664
|
+
templateName: waTpl.templateCode,
|
|
1665
|
+
callbackData: "",
|
|
1666
|
+
countryCode: cfg.serviceEvent.countryCode,
|
|
1667
|
+
languageCode: "en",
|
|
1668
|
+
masterNumber: cfg.serviceEvent.masterPhone
|
|
1669
|
+
},
|
|
1670
|
+
this.logger
|
|
1671
|
+
);
|
|
1664
1672
|
const appProvider = new AppNotificationProvider();
|
|
1665
1673
|
this.logger.info(`[NotificationService] Email Template: ${JSON.stringify(emailTpl)}`);
|
|
1666
1674
|
this.logger.info(`[NotificationService] SMS Template: ${JSON.stringify(smsTpl)}`);
|