easywork-common-lib 1.0.303 → 1.0.304
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/modules/queue/notifier.service.d.ts +2 -1
- package/dist/modules/queue/notifier.service.js +2 -0
- package/dist/modules/queue/notifier.service.js.map +1 -1
- package/dist/modules/queue/notifiers/index.d.ts +1 -0
- package/dist/modules/queue/notifiers/index.js +1 -0
- package/dist/modules/queue/notifiers/index.js.map +1 -1
- package/dist/modules/queue/notifiers/lead.notifier.d.ts +7 -0
- package/dist/modules/queue/notifiers/lead.notifier.js +49 -0
- package/dist/modules/queue/notifiers/lead.notifier.js.map +1 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { AmqpConnection } from "@golevelup/nestjs-rabbitmq";
|
|
2
2
|
import { SendNotificationDto } from "../../common";
|
|
3
|
-
import { ContactNotifier, TaskNotifier } from "./notifiers";
|
|
3
|
+
import { ContactNotifier, LeadNotifier, TaskNotifier } from "./notifiers";
|
|
4
4
|
export declare class EasyNotifierService {
|
|
5
5
|
private readonly amqpConnection;
|
|
6
6
|
private readonly exchangeName;
|
|
7
7
|
private readonly routingKey;
|
|
8
8
|
readonly task: TaskNotifier;
|
|
9
9
|
readonly contact: ContactNotifier;
|
|
10
|
+
readonly lead: LeadNotifier;
|
|
10
11
|
constructor(amqpConnection: AmqpConnection, exchangeName: string, routingKey: string);
|
|
11
12
|
sendNotification(data: SendNotificationDto): Promise<void>;
|
|
12
13
|
sendOTPPhone(code: string, recipientsId: string[]): Promise<void>;
|
|
@@ -24,12 +24,14 @@ let EasyNotifierService = class EasyNotifierService {
|
|
|
24
24
|
routingKey;
|
|
25
25
|
task;
|
|
26
26
|
contact;
|
|
27
|
+
lead;
|
|
27
28
|
constructor(amqpConnection, exchangeName, routingKey) {
|
|
28
29
|
this.amqpConnection = amqpConnection;
|
|
29
30
|
this.exchangeName = exchangeName;
|
|
30
31
|
this.routingKey = routingKey;
|
|
31
32
|
this.task = new notifiers_1.TaskNotifier(this);
|
|
32
33
|
this.contact = new notifiers_1.ContactNotifier(this);
|
|
34
|
+
this.lead = new notifiers_1.LeadNotifier(this);
|
|
33
35
|
}
|
|
34
36
|
async sendNotification(data) {
|
|
35
37
|
logger.debug(`Sending notification: ${JSON.stringify(data)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifier.service.js","sourceRoot":"","sources":["../../../src/modules/queue/notifier.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAA4D;AAC5D,2CAA4D;AAC5D,yCAAuH;AACvH,
|
|
1
|
+
{"version":3,"file":"notifier.service.js","sourceRoot":"","sources":["../../../src/modules/queue/notifier.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAA4D;AAC5D,2CAA4D;AAC5D,yCAAuH;AACvH,2CAA0E;AAE1E,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,qBAAqB,CAAC,CAAC;AAG1C,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAMP;IACyB;IACO;IAPrC,IAAI,CAAe;IACnB,OAAO,CAAkB;IACzB,IAAI,CAAe;IAEnC,YACqB,cAA8B,EACL,YAAoB,EACb,UAAkB;QAFlD,mBAAc,GAAd,cAAc,CAAgB;QACL,iBAAY,GAAZ,YAAY,CAAQ;QACb,eAAU,GAAV,UAAU,CAAQ;QAEnE,IAAI,CAAC,IAAI,GAAG,IAAI,wBAAY,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,IAAI,2BAAe,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,wBAAY,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,IAAyB;QAC5C,MAAM,CAAC,KAAK,CAAC,yBAAyB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9D,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAChF,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,YAAsB;QACnD,MAAM,eAAe,GAAwB;YACzC,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,8BAA8B,IAAI,EAAE;YAC7C,YAAY;YACZ,QAAQ,EAAE,CAAC,4BAAmB,CAAC,GAAG,CAAC;YACnC,QAAQ,EAAE,6BAAoB,CAAC,GAAG;YAClC,WAAW,EAAE,gCAAuB,CAAC,GAAG;SAC3C,CAAC;QAEF,MAAM,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,YAAsB;QACnD,MAAM,eAAe,GAAwB;YACzC,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,IAAI;YACb,YAAY;YACZ,QAAQ,EAAE,CAAC,4BAAmB,CAAC,KAAK,CAAC;YACrC,QAAQ,EAAE,6BAAoB,CAAC,GAAG;YAClC,WAAW,EAAE,gCAAuB,CAAC,GAAG;SAC3C,CAAC;QAEF,MAAM,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IACjD,CAAC;CACJ,CAAA;AA7CY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAQJ,WAAA,IAAA,eAAM,EAAC,eAAe,CAAC,CAAA;IACvB,WAAA,IAAA,eAAM,EAAC,sBAAsB,CAAC,CAAA;qCAFE,gCAAc;GAN1C,mBAAmB,CA6C/B"}
|
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./task.notifier"), exports);
|
|
18
18
|
__exportStar(require("./calendar.notifier"), exports);
|
|
19
19
|
__exportStar(require("./contact.notifier"), exports);
|
|
20
|
+
__exportStar(require("./lead.notifier"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/queue/notifiers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,sDAAoC;AACpC,qDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/queue/notifiers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,sDAAoC;AACpC,qDAAmC;AACnC,kDAAgC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EasyNotifierService } from '../notifier.service';
|
|
2
|
+
import { Lead, LeadComment } from '../../../entities';
|
|
3
|
+
export declare class LeadNotifier {
|
|
4
|
+
private readonly notifierService;
|
|
5
|
+
constructor(notifierService: EasyNotifierService);
|
|
6
|
+
notifyNewCommentLead(lead: Lead, comment: LeadComment, recipientsId: string[]): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.LeadNotifier = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const notifier_service_1 = require("../notifier.service");
|
|
15
|
+
const common_2 = require("../../../common");
|
|
16
|
+
let LeadNotifier = class LeadNotifier {
|
|
17
|
+
notifierService;
|
|
18
|
+
constructor(notifierService) {
|
|
19
|
+
this.notifierService = notifierService;
|
|
20
|
+
}
|
|
21
|
+
async notifyNewCommentLead(lead, comment, recipientsId) {
|
|
22
|
+
const commentText = comment.comment.slice(0, 20);
|
|
23
|
+
const content = `${comment.createdBy.name} comentó en el prospecto: <a href="/sales/leads/lead/${lead.id}?show=true" style="color:#170f6b">[${lead.name}]</a>. Texto del comentario: ${commentText}`;
|
|
24
|
+
const metadata = {
|
|
25
|
+
leadId: lead.id,
|
|
26
|
+
commentId: comment.id,
|
|
27
|
+
leadOwnerId: lead.createdBy?.id,
|
|
28
|
+
commentOwnerId: comment.createdBy?.id,
|
|
29
|
+
leadAssignedId: lead?.assignedBy?.id,
|
|
30
|
+
};
|
|
31
|
+
const notificationDto = {
|
|
32
|
+
title: "New Comment",
|
|
33
|
+
content,
|
|
34
|
+
recipientsId,
|
|
35
|
+
entityId: lead.id,
|
|
36
|
+
channels: [common_2.NotificationChannel.APP, common_2.NotificationChannel.SMS, common_2.NotificationChannel.PUSH],
|
|
37
|
+
category: common_2.NotificationCategory.CRM,
|
|
38
|
+
subCategory: common_2.NotificationSubcategory.CONTACT_NEW_COMMENT,
|
|
39
|
+
metadata,
|
|
40
|
+
};
|
|
41
|
+
await this.notifierService.sendNotification(notificationDto);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.LeadNotifier = LeadNotifier;
|
|
45
|
+
exports.LeadNotifier = LeadNotifier = __decorate([
|
|
46
|
+
(0, common_1.Injectable)(),
|
|
47
|
+
__metadata("design:paramtypes", [notifier_service_1.EasyNotifierService])
|
|
48
|
+
], LeadNotifier);
|
|
49
|
+
//# sourceMappingURL=lead.notifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lead.notifier.js","sourceRoot":"","sources":["../../../../src/modules/queue/notifiers/lead.notifier.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,0DAA0D;AAE1D,4CAA0H;AAGnH,IAAM,YAAY,GAAlB,MAAM,YAAY;IACQ;IAA7B,YAA6B,eAAoC;QAApC,oBAAe,GAAf,eAAe,CAAqB;IAAI,CAAC;IAEtE,KAAK,CAAC,oBAAoB,CAAC,IAAU,EAAE,OAAoB,EAAE,YAAsB;QAC/E,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,wDAAwD,IAAI,CAAC,EAAE,sCAAsC,IAAI,CAAC,IAAI,gCAAgC,WAAW,EAAE,CAAC;QAErM,MAAM,QAAQ,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,EAAE;YACf,SAAS,EAAE,OAAO,CAAC,EAAE;YACrB,WAAW,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE;YAC/B,cAAc,EAAE,OAAO,CAAC,SAAS,EAAE,EAAE;YACrC,cAAc,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE;SACvC,CAAC;QAEF,MAAM,eAAe,GAAwB;YACzC,KAAK,EAAE,aAAa;YACpB,OAAO;YACP,YAAY;YACZ,QAAQ,EAAE,IAAI,CAAC,EAAE;YACjB,QAAQ,EAAE,CAAC,4BAAmB,CAAC,GAAG,EAAE,4BAAmB,CAAC,GAAG,EAAE,4BAAmB,CAAC,IAAI,CAAC;YACtF,QAAQ,EAAE,6BAAoB,CAAC,GAAG;YAClC,WAAW,EAAE,gCAAuB,CAAC,mBAAmB;YACxD,QAAQ;SACX,CAAC;QAEF,MAAM,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IACjE,CAAC;CACJ,CAAA;AA5BY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;qCAEqC,sCAAmB;GADxD,YAAY,CA4BxB"}
|