av6-core 1.6.7 → 1.6.8
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.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +13 -6
- package/dist/index.mjs +13 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3389,7 +3389,7 @@ var WhatsAppProvider = class {
|
|
|
3389
3389
|
}
|
|
3390
3390
|
};
|
|
3391
3391
|
if (inp.fileUrl) {
|
|
3392
|
-
requestBody.template.headerValues =
|
|
3392
|
+
requestBody.template.headerValues = inp.fileUrl;
|
|
3393
3393
|
if (inp.fileName) requestBody.template.fileName = inp.fileName;
|
|
3394
3394
|
}
|
|
3395
3395
|
const headers = {
|
|
@@ -3826,6 +3826,10 @@ var NotificationService = class {
|
|
|
3826
3826
|
this.logger.info("[NotificationService] WhatsApp: no recipients resolved");
|
|
3827
3827
|
return;
|
|
3828
3828
|
}
|
|
3829
|
+
const message = renderTemplate(tpl.bodyText ?? "", evt.data ?? {});
|
|
3830
|
+
const dataWp = tpl.extra?.bodyValues?.map((x) => getNestedValue(evt.data, x));
|
|
3831
|
+
const fileUrls = tpl.extra?.fileUrls?.map((x) => getNestedValue(evt.data, x));
|
|
3832
|
+
const fileName = getNestedValue(tpl.extra?.fileName);
|
|
3829
3833
|
const apiKey = cfg.serviceEvent.wpApiKey ?? "";
|
|
3830
3834
|
if (!apiKey.trim()) {
|
|
3831
3835
|
await this.writeSystemFailureItem({
|
|
@@ -3850,9 +3854,11 @@ var NotificationService = class {
|
|
|
3850
3854
|
const bulk = await this.sendWhatsappBulkSafe({
|
|
3851
3855
|
provider: waProvider,
|
|
3852
3856
|
recipients,
|
|
3853
|
-
bodyValues:
|
|
3857
|
+
bodyValues: dataWp ?? [],
|
|
3854
3858
|
concurrency: 5,
|
|
3855
|
-
includeMaster: Boolean(cfg.serviceEvent.masterPhone)
|
|
3859
|
+
includeMaster: Boolean(cfg.serviceEvent.masterPhone),
|
|
3860
|
+
fileName,
|
|
3861
|
+
fileUrls
|
|
3856
3862
|
});
|
|
3857
3863
|
for (const it of bulk.items) {
|
|
3858
3864
|
await this.prisma.eventDeliveryItem.create({
|
|
@@ -3860,8 +3866,7 @@ var NotificationService = class {
|
|
|
3860
3866
|
deliveryId,
|
|
3861
3867
|
notificationType: "WHATSAPP" /* WHATSAPP */,
|
|
3862
3868
|
recipient: it.recipient,
|
|
3863
|
-
messageContent:
|
|
3864
|
-
// Interakt template; body content not stored
|
|
3869
|
+
messageContent: message,
|
|
3865
3870
|
thirdPartyResponse: it.meta ?? void 0,
|
|
3866
3871
|
isSent: it.ok,
|
|
3867
3872
|
sentAt: it.ok ? /* @__PURE__ */ new Date() : null,
|
|
@@ -3950,7 +3955,9 @@ var NotificationService = class {
|
|
|
3950
3955
|
recipients: uniq,
|
|
3951
3956
|
bodyValues: args.bodyValues,
|
|
3952
3957
|
includeMaster: args.includeMaster,
|
|
3953
|
-
concurrency: args.concurrency
|
|
3958
|
+
concurrency: args.concurrency,
|
|
3959
|
+
fileName: args.fileName,
|
|
3960
|
+
fileUrl: args.fileUrls
|
|
3954
3961
|
});
|
|
3955
3962
|
const items2 = (bulkRes?.items ?? []).map((x) => ({
|
|
3956
3963
|
recipient: String(x.recipient ?? ""),
|
package/dist/index.mjs
CHANGED
|
@@ -3338,7 +3338,7 @@ var WhatsAppProvider = class {
|
|
|
3338
3338
|
}
|
|
3339
3339
|
};
|
|
3340
3340
|
if (inp.fileUrl) {
|
|
3341
|
-
requestBody.template.headerValues =
|
|
3341
|
+
requestBody.template.headerValues = inp.fileUrl;
|
|
3342
3342
|
if (inp.fileName) requestBody.template.fileName = inp.fileName;
|
|
3343
3343
|
}
|
|
3344
3344
|
const headers = {
|
|
@@ -3775,6 +3775,10 @@ var NotificationService = class {
|
|
|
3775
3775
|
this.logger.info("[NotificationService] WhatsApp: no recipients resolved");
|
|
3776
3776
|
return;
|
|
3777
3777
|
}
|
|
3778
|
+
const message = renderTemplate(tpl.bodyText ?? "", evt.data ?? {});
|
|
3779
|
+
const dataWp = tpl.extra?.bodyValues?.map((x) => getNestedValue(evt.data, x));
|
|
3780
|
+
const fileUrls = tpl.extra?.fileUrls?.map((x) => getNestedValue(evt.data, x));
|
|
3781
|
+
const fileName = getNestedValue(tpl.extra?.fileName);
|
|
3778
3782
|
const apiKey = cfg.serviceEvent.wpApiKey ?? "";
|
|
3779
3783
|
if (!apiKey.trim()) {
|
|
3780
3784
|
await this.writeSystemFailureItem({
|
|
@@ -3799,9 +3803,11 @@ var NotificationService = class {
|
|
|
3799
3803
|
const bulk = await this.sendWhatsappBulkSafe({
|
|
3800
3804
|
provider: waProvider,
|
|
3801
3805
|
recipients,
|
|
3802
|
-
bodyValues:
|
|
3806
|
+
bodyValues: dataWp ?? [],
|
|
3803
3807
|
concurrency: 5,
|
|
3804
|
-
includeMaster: Boolean(cfg.serviceEvent.masterPhone)
|
|
3808
|
+
includeMaster: Boolean(cfg.serviceEvent.masterPhone),
|
|
3809
|
+
fileName,
|
|
3810
|
+
fileUrls
|
|
3805
3811
|
});
|
|
3806
3812
|
for (const it of bulk.items) {
|
|
3807
3813
|
await this.prisma.eventDeliveryItem.create({
|
|
@@ -3809,8 +3815,7 @@ var NotificationService = class {
|
|
|
3809
3815
|
deliveryId,
|
|
3810
3816
|
notificationType: "WHATSAPP" /* WHATSAPP */,
|
|
3811
3817
|
recipient: it.recipient,
|
|
3812
|
-
messageContent:
|
|
3813
|
-
// Interakt template; body content not stored
|
|
3818
|
+
messageContent: message,
|
|
3814
3819
|
thirdPartyResponse: it.meta ?? void 0,
|
|
3815
3820
|
isSent: it.ok,
|
|
3816
3821
|
sentAt: it.ok ? /* @__PURE__ */ new Date() : null,
|
|
@@ -3899,7 +3904,9 @@ var NotificationService = class {
|
|
|
3899
3904
|
recipients: uniq,
|
|
3900
3905
|
bodyValues: args.bodyValues,
|
|
3901
3906
|
includeMaster: args.includeMaster,
|
|
3902
|
-
concurrency: args.concurrency
|
|
3907
|
+
concurrency: args.concurrency,
|
|
3908
|
+
fileName: args.fileName,
|
|
3909
|
+
fileUrl: args.fileUrls
|
|
3903
3910
|
});
|
|
3904
3911
|
const items2 = (bulkRes?.items ?? []).map((x) => ({
|
|
3905
3912
|
recipient: String(x.recipient ?? ""),
|