av6-core 1.6.7 → 1.6.9
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 +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +15 -7
- package/dist/index.mjs +15 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -623,7 +623,12 @@ type EmitPayload = {
|
|
|
623
623
|
service: string;
|
|
624
624
|
shortCode: string;
|
|
625
625
|
data?: Record<string, any>;
|
|
626
|
-
|
|
626
|
+
attachments?: Array<{
|
|
627
|
+
filename: string;
|
|
628
|
+
path: string;
|
|
629
|
+
cid: string;
|
|
630
|
+
content?: Buffer;
|
|
631
|
+
}>;
|
|
627
632
|
};
|
|
628
633
|
type ILogger = winston.Logger | Console;
|
|
629
634
|
type NotificationEmitterDeps = {
|
package/dist/index.d.ts
CHANGED
|
@@ -623,7 +623,12 @@ type EmitPayload = {
|
|
|
623
623
|
service: string;
|
|
624
624
|
shortCode: string;
|
|
625
625
|
data?: Record<string, any>;
|
|
626
|
-
|
|
626
|
+
attachments?: Array<{
|
|
627
|
+
filename: string;
|
|
628
|
+
path: string;
|
|
629
|
+
cid: string;
|
|
630
|
+
content?: Buffer;
|
|
631
|
+
}>;
|
|
627
632
|
};
|
|
628
633
|
type ILogger = winston.Logger | Console;
|
|
629
634
|
type NotificationEmitterDeps = {
|
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 = {
|
|
@@ -3578,7 +3578,8 @@ var NotificationService = class {
|
|
|
3578
3578
|
recipient: { email: recipient },
|
|
3579
3579
|
subject: msg.subject,
|
|
3580
3580
|
body: msg.body,
|
|
3581
|
-
priority: cfg.priority === "PRIMARY" ? "high" : cfg.priority === "SECONDARY" ? "normal" : "low"
|
|
3581
|
+
priority: cfg.priority === "PRIMARY" ? "high" : cfg.priority === "SECONDARY" ? "normal" : "low",
|
|
3582
|
+
attachments: evt.attachments
|
|
3582
3583
|
});
|
|
3583
3584
|
return this.mapProviderResult(res);
|
|
3584
3585
|
}
|
|
@@ -3826,6 +3827,10 @@ var NotificationService = class {
|
|
|
3826
3827
|
this.logger.info("[NotificationService] WhatsApp: no recipients resolved");
|
|
3827
3828
|
return;
|
|
3828
3829
|
}
|
|
3830
|
+
const message = renderTemplate(tpl.bodyText ?? "", evt.data ?? {});
|
|
3831
|
+
const dataWp = tpl.extra?.bodyValues?.map((x) => getNestedValue(evt.data, x));
|
|
3832
|
+
const fileUrls = tpl.extra?.fileUrls?.map((x) => getNestedValue(evt.data, x));
|
|
3833
|
+
const fileName = getNestedValue(tpl.extra?.fileName);
|
|
3829
3834
|
const apiKey = cfg.serviceEvent.wpApiKey ?? "";
|
|
3830
3835
|
if (!apiKey.trim()) {
|
|
3831
3836
|
await this.writeSystemFailureItem({
|
|
@@ -3850,9 +3855,11 @@ var NotificationService = class {
|
|
|
3850
3855
|
const bulk = await this.sendWhatsappBulkSafe({
|
|
3851
3856
|
provider: waProvider,
|
|
3852
3857
|
recipients,
|
|
3853
|
-
bodyValues:
|
|
3858
|
+
bodyValues: dataWp ?? [],
|
|
3854
3859
|
concurrency: 5,
|
|
3855
|
-
includeMaster: Boolean(cfg.serviceEvent.masterPhone)
|
|
3860
|
+
includeMaster: Boolean(cfg.serviceEvent.masterPhone),
|
|
3861
|
+
fileName,
|
|
3862
|
+
fileUrls
|
|
3856
3863
|
});
|
|
3857
3864
|
for (const it of bulk.items) {
|
|
3858
3865
|
await this.prisma.eventDeliveryItem.create({
|
|
@@ -3860,8 +3867,7 @@ var NotificationService = class {
|
|
|
3860
3867
|
deliveryId,
|
|
3861
3868
|
notificationType: "WHATSAPP" /* WHATSAPP */,
|
|
3862
3869
|
recipient: it.recipient,
|
|
3863
|
-
messageContent:
|
|
3864
|
-
// Interakt template; body content not stored
|
|
3870
|
+
messageContent: message,
|
|
3865
3871
|
thirdPartyResponse: it.meta ?? void 0,
|
|
3866
3872
|
isSent: it.ok,
|
|
3867
3873
|
sentAt: it.ok ? /* @__PURE__ */ new Date() : null,
|
|
@@ -3950,7 +3956,9 @@ var NotificationService = class {
|
|
|
3950
3956
|
recipients: uniq,
|
|
3951
3957
|
bodyValues: args.bodyValues,
|
|
3952
3958
|
includeMaster: args.includeMaster,
|
|
3953
|
-
concurrency: args.concurrency
|
|
3959
|
+
concurrency: args.concurrency,
|
|
3960
|
+
fileName: args.fileName,
|
|
3961
|
+
fileUrl: args.fileUrls
|
|
3954
3962
|
});
|
|
3955
3963
|
const items2 = (bulkRes?.items ?? []).map((x) => ({
|
|
3956
3964
|
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 = {
|
|
@@ -3527,7 +3527,8 @@ var NotificationService = class {
|
|
|
3527
3527
|
recipient: { email: recipient },
|
|
3528
3528
|
subject: msg.subject,
|
|
3529
3529
|
body: msg.body,
|
|
3530
|
-
priority: cfg.priority === "PRIMARY" ? "high" : cfg.priority === "SECONDARY" ? "normal" : "low"
|
|
3530
|
+
priority: cfg.priority === "PRIMARY" ? "high" : cfg.priority === "SECONDARY" ? "normal" : "low",
|
|
3531
|
+
attachments: evt.attachments
|
|
3531
3532
|
});
|
|
3532
3533
|
return this.mapProviderResult(res);
|
|
3533
3534
|
}
|
|
@@ -3775,6 +3776,10 @@ var NotificationService = class {
|
|
|
3775
3776
|
this.logger.info("[NotificationService] WhatsApp: no recipients resolved");
|
|
3776
3777
|
return;
|
|
3777
3778
|
}
|
|
3779
|
+
const message = renderTemplate(tpl.bodyText ?? "", evt.data ?? {});
|
|
3780
|
+
const dataWp = tpl.extra?.bodyValues?.map((x) => getNestedValue(evt.data, x));
|
|
3781
|
+
const fileUrls = tpl.extra?.fileUrls?.map((x) => getNestedValue(evt.data, x));
|
|
3782
|
+
const fileName = getNestedValue(tpl.extra?.fileName);
|
|
3778
3783
|
const apiKey = cfg.serviceEvent.wpApiKey ?? "";
|
|
3779
3784
|
if (!apiKey.trim()) {
|
|
3780
3785
|
await this.writeSystemFailureItem({
|
|
@@ -3799,9 +3804,11 @@ var NotificationService = class {
|
|
|
3799
3804
|
const bulk = await this.sendWhatsappBulkSafe({
|
|
3800
3805
|
provider: waProvider,
|
|
3801
3806
|
recipients,
|
|
3802
|
-
bodyValues:
|
|
3807
|
+
bodyValues: dataWp ?? [],
|
|
3803
3808
|
concurrency: 5,
|
|
3804
|
-
includeMaster: Boolean(cfg.serviceEvent.masterPhone)
|
|
3809
|
+
includeMaster: Boolean(cfg.serviceEvent.masterPhone),
|
|
3810
|
+
fileName,
|
|
3811
|
+
fileUrls
|
|
3805
3812
|
});
|
|
3806
3813
|
for (const it of bulk.items) {
|
|
3807
3814
|
await this.prisma.eventDeliveryItem.create({
|
|
@@ -3809,8 +3816,7 @@ var NotificationService = class {
|
|
|
3809
3816
|
deliveryId,
|
|
3810
3817
|
notificationType: "WHATSAPP" /* WHATSAPP */,
|
|
3811
3818
|
recipient: it.recipient,
|
|
3812
|
-
messageContent:
|
|
3813
|
-
// Interakt template; body content not stored
|
|
3819
|
+
messageContent: message,
|
|
3814
3820
|
thirdPartyResponse: it.meta ?? void 0,
|
|
3815
3821
|
isSent: it.ok,
|
|
3816
3822
|
sentAt: it.ok ? /* @__PURE__ */ new Date() : null,
|
|
@@ -3899,7 +3905,9 @@ var NotificationService = class {
|
|
|
3899
3905
|
recipients: uniq,
|
|
3900
3906
|
bodyValues: args.bodyValues,
|
|
3901
3907
|
includeMaster: args.includeMaster,
|
|
3902
|
-
concurrency: args.concurrency
|
|
3908
|
+
concurrency: args.concurrency,
|
|
3909
|
+
fileName: args.fileName,
|
|
3910
|
+
fileUrl: args.fileUrls
|
|
3903
3911
|
});
|
|
3904
3912
|
const items2 = (bulkRes?.items ?? []).map((x) => ({
|
|
3905
3913
|
recipient: String(x.recipient ?? ""),
|