@tiledesk/tiledesk-server 2.2.38 → 2.3.1-8.1
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/CHANGELOG.md +121 -0
- package/LICENSE +14 -657
- package/README.md +36 -21
- package/app.js +35 -62
- package/channels/chat21/chat21Handler.js +18 -3
- package/channels/chat21/chat21WebHook.js +31 -15
- package/channels/chat21/package-lock.json +663 -706
- package/channels/chat21/package.json +2 -2
- package/config/labels/widget.json +320 -0
- package/deploy.sh +2 -0
- package/event/botEvent.js +1 -1
- package/event/subscriptionEvent.js +11 -0
- package/fonts/Roboto-Italic.ttf +0 -0
- package/fonts/Roboto-Medium.ttf +0 -0
- package/fonts/Roboto-MediumItalic.ttf +0 -0
- package/fonts/Roboto-Regular.ttf +0 -0
- package/middleware/ipFilter.js +220 -0
- package/middleware/passport.js +11 -2
- package/models/lead.js +2 -0
- package/models/project.js +10 -0
- package/models/project_user.js +4 -0
- package/models/request.js +50 -12
- package/models/subscriptionLog.js +34 -0
- package/models/tagLibrary.js +42 -0
- package/package.json +6 -11
- package/pubmodules/activities/activityArchiver.js +314 -0
- package/pubmodules/activities/index.js +3 -0
- package/pubmodules/activities/models/activity.js +88 -0
- package/pubmodules/activities/routes/activity.js +710 -0
- package/pubmodules/activities/test/activityRoute.js +85 -0
- package/pubmodules/analytics/analytics.js +1719 -0
- package/pubmodules/analytics/index.js +3 -0
- package/pubmodules/canned/cannedResponse.js +55 -0
- package/pubmodules/canned/cannedResponseRoute.js +163 -0
- package/pubmodules/canned/index.js +3 -0
- package/pubmodules/emailNotification/requestNotification.js +215 -28
- package/pubmodules/events/eventRoute.js +37 -7
- package/pubmodules/messageActions/messageActionsInterceptor.js +4 -2
- package/pubmodules/pubModulesManager.js +140 -7
- package/pubmodules/rasa/index.js +8 -1
- package/pubmodules/rasa/listener.js +30 -9
- package/pubmodules/rules/conciergeBot.js +4 -4
- package/pubmodules/scheduler/tasks/closeAgentUnresponsiveRequestTask.js +3 -1
- package/pubmodules/scheduler/tasks/closeBotUnresponsiveRequestTask.js +5 -3
- package/pubmodules/tilebot/index.js +11 -0
- package/pubmodules/tilebot/listener.js +69 -0
- package/pubmodules/trigger/default.js +271 -0
- package/pubmodules/trigger/event/actionEventEmitter.js +10 -0
- package/pubmodules/trigger/event/flowEventEmitter.js +10 -0
- package/pubmodules/trigger/event/triggerEventEmitter.js +10 -0
- package/pubmodules/trigger/index.js +3 -0
- package/pubmodules/trigger/models/trigger.js +149 -0
- package/pubmodules/trigger/rulesTrigger.js +1181 -0
- package/pubmodules/trigger/start.js +118 -0
- package/pubmodules/trigger/triggerRoute.js +150 -0
- package/routes/auth.js +7 -2
- package/routes/department.js +51 -0
- package/routes/faq.js +7 -0
- package/routes/faq_kb.js +1 -1
- package/routes/group.js +140 -0
- package/routes/lead.js +24 -1
- package/routes/message.js +6 -3
- package/routes/project.js +118 -0
- package/routes/project_user.js +9 -0
- package/routes/public-request.js +280 -2
- package/routes/request.js +124 -17
- package/routes/subscription.js +140 -0
- package/routes/tag.js +138 -0
- package/routes/user-request.js +3 -2
- package/routes/users.js +1 -1
- package/routes/widget.js +80 -3
- package/routes/widgetLoader.js +31 -0
- package/services/banUserNotifier.js +86 -0
- package/services/emailService.js +189 -11
- package/services/faqBotHandler.js +2 -2
- package/services/faqBotSupport.js +0 -1
- package/services/faqService.js +2 -2
- package/services/geoService.js +30 -4
- package/services/leadService.js +2 -0
- package/services/modulesManager.js +16 -182
- package/services/requestService.js +364 -6
- package/services/subscriptionNotifier.js +485 -0
- package/template/email/assignedEmailMessage.html +1 -1
- package/template/email/assignedRequest.html +1 -1
- package/template/email/newMessage.html +1 -1
- package/template/email/newMessageFollower.html +236 -0
- package/template/email/passwordChanged.html +1 -1
- package/template/email/pooledEmailMessage.html +1 -1
- package/template/email/pooledRequest.html +1 -1
- package/template/email/resetPassword.html +2 -2
- package/template/email/ticket.html +1 -1
- package/test/cannedRoute.js +166 -0
- package/test/messageRoute.js +69 -0
- package/test/requestService.js +3 -1
- package/utils/orgUtil.js +3 -3
- package/views/messages.jade +2 -2
- package/websocket/webSocketServer.js +23 -5
|
@@ -28,16 +28,10 @@ if (licenseKey) {
|
|
|
28
28
|
|
|
29
29
|
class ModulesManager {
|
|
30
30
|
|
|
31
|
-
constructor() {
|
|
32
|
-
this.trigger = undefined;
|
|
33
|
-
this.triggerRoute = undefined;
|
|
31
|
+
constructor() {
|
|
34
32
|
this.stripe = undefined;
|
|
35
33
|
this.graphql = undefined;
|
|
36
|
-
this.
|
|
37
|
-
this.resthookRoute = undefined;
|
|
38
|
-
this.elasticIndexer = undefined;
|
|
39
|
-
this.activityArchiver = undefined;
|
|
40
|
-
this.activityRoute = undefined;
|
|
34
|
+
this.elasticIndexer = undefined;
|
|
41
35
|
this.facebookRoute = undefined;
|
|
42
36
|
this.jwthistoryArchiver = undefined;
|
|
43
37
|
this.jwthistoryRoute = undefined;
|
|
@@ -47,12 +41,10 @@ class ModulesManager {
|
|
|
47
41
|
this.routingQueue = undefined;
|
|
48
42
|
this.queue = undefined;
|
|
49
43
|
this.cache = undefined;
|
|
50
|
-
this.cannedResponseRoute = undefined;
|
|
51
|
-
this.tagRoute = undefined;
|
|
52
|
-
this.groupsRoute = undefined;
|
|
53
44
|
this.visitorCounterRoute = undefined;
|
|
54
45
|
this.visitorCounterMiddleware = undefined;
|
|
55
46
|
this.widgetsRoute = undefined;
|
|
47
|
+
this.enterprise = undefined;
|
|
56
48
|
}
|
|
57
49
|
|
|
58
50
|
injectBefore(app) {
|
|
@@ -106,50 +98,16 @@ class ModulesManager {
|
|
|
106
98
|
useUnderProjects(app) {
|
|
107
99
|
var that = this;
|
|
108
100
|
winston.debug("ModulesManager using controllers");
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
app.use('/:projectid/modules/triggers', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRole('admin')], this.triggerRoute);
|
|
113
|
-
winston.info("ModulesManager trigger controller loaded");
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (this.analyticsRoute) {
|
|
117
|
-
app.use('/:projectid/analytics', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRole('agent')], this.analyticsRoute);
|
|
118
|
-
winston.info("ModulesManager analytics controller loaded");
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (this.resthookRoute) {
|
|
122
|
-
app.use('/:projectid/subscriptions', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRole('admin')], this.resthookRoute);
|
|
123
|
-
winston.info("ModulesManager subscriptions controller loaded");
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (this.activityRoute) {
|
|
127
|
-
app.use('/:projectid/activities', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRole('admin')], this.activityRoute);
|
|
128
|
-
winston.info("ModulesManager activities controller loaded");
|
|
129
|
-
}
|
|
130
|
-
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
131
104
|
|
|
132
105
|
if (this.requestHistoryRoute) {
|
|
133
106
|
app.use('/:projectid/requests/:request_id/history', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRoleOrTypes(null, ['subscription'])] , this.requestHistoryRoute);
|
|
134
107
|
winston.info("ModulesManager requestHistory controller loaded");
|
|
135
108
|
}
|
|
136
109
|
|
|
137
|
-
|
|
138
|
-
if (this.cannedResponseRoute) {
|
|
139
|
-
app.use('/:projectid/canned', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRole('agent')], this.cannedResponseRoute);
|
|
140
|
-
winston.info("ModulesManager canned controller loaded");
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (this.tagRoute) {
|
|
144
|
-
app.use('/:projectid/tags', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRole('agent')], this.tagRoute);
|
|
145
|
-
winston.info("ModulesManager tag controller loaded");
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (this.groupsRoute) {
|
|
149
|
-
app.use('/:projectid/groups', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRole('admin')], this.groupsRoute);
|
|
150
|
-
winston.info("ModulesManager group controller loaded");
|
|
151
|
-
}
|
|
152
|
-
|
|
110
|
+
|
|
153
111
|
|
|
154
112
|
|
|
155
113
|
if (this.visitorCounterRoute) {
|
|
@@ -174,20 +132,21 @@ class ModulesManager {
|
|
|
174
132
|
|
|
175
133
|
|
|
176
134
|
try {
|
|
177
|
-
this.
|
|
178
|
-
winston.debug("this.
|
|
179
|
-
|
|
180
|
-
winston.debug("this.triggerRoute:"+ this.triggerRoute);
|
|
181
|
-
winston.info("ModulesManager trigger initialized");
|
|
135
|
+
this.enterprise = require('@tiledesk-ent/tiledesk-server-enterprise');
|
|
136
|
+
winston.debug("this.enterprise:"+ this.enterprise);
|
|
137
|
+
winston.info("ModulesManager enterprise initialized");
|
|
182
138
|
} catch(err) {
|
|
183
139
|
if (err.code == 'MODULE_NOT_FOUND') {
|
|
184
|
-
winston.info("ModulesManager init
|
|
140
|
+
winston.info("ModulesManager init enterprise module not found");
|
|
185
141
|
}else {
|
|
186
|
-
winston.error("ModulesManager error initializing init
|
|
142
|
+
winston.error("ModulesManager error initializing init enterprise module", err);
|
|
187
143
|
}
|
|
188
144
|
}
|
|
189
145
|
|
|
190
146
|
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
191
150
|
try {
|
|
192
151
|
this.stripe = require('@tiledesk-ent/tiledesk-server-payments').stripeRoute;
|
|
193
152
|
winston.info("ModulesManager stripe initialized");
|
|
@@ -198,51 +157,6 @@ class ModulesManager {
|
|
|
198
157
|
winston.error("ModulesManager error initializing init stripe module", err);
|
|
199
158
|
}
|
|
200
159
|
}
|
|
201
|
-
|
|
202
|
-
try {
|
|
203
|
-
this.resthookRoute = require('@tiledesk-ent/tiledesk-server-resthook').resthookRoute;
|
|
204
|
-
winston.debug("this.resthookRoute:"+ this.resthookRoute);
|
|
205
|
-
this.subscriptionNotifier = require('@tiledesk-ent/tiledesk-server-resthook').subscriptionNotifier;
|
|
206
|
-
// this.subscriptionNotifier.start();
|
|
207
|
-
winston.info("ModulesManager resthook initialized");
|
|
208
|
-
} catch(err) {
|
|
209
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
210
|
-
winston.info("ModulesManager init resthookRoute module not found");
|
|
211
|
-
}else {
|
|
212
|
-
winston.error("ModulesManager error initializing init resthook module", err);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
try {
|
|
218
|
-
this.analyticsRoute = require('@tiledesk-ent/tiledesk-server-analytics').analyticsRoute;
|
|
219
|
-
winston.debug("this.analyticsRoute:"+ this.analyticsRoute);
|
|
220
|
-
winston.info("ModulesManager analyticsRoute initialized");
|
|
221
|
-
} catch(err) {
|
|
222
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
223
|
-
winston.info("ModulesManager init analytics module not found");
|
|
224
|
-
}else {
|
|
225
|
-
winston.error("ModulesManager error initializing init analytics module", err);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
try {
|
|
231
|
-
this.activityArchiver = require('@tiledesk-ent/tiledesk-server-activities').activityArchiver;
|
|
232
|
-
// this.activityArchiver.listen();
|
|
233
|
-
winston.debug("this.activityArchiver:"+ this.activityArchiver);
|
|
234
|
-
|
|
235
|
-
this.activityRoute = require('@tiledesk-ent/tiledesk-server-activities').activityRoute;
|
|
236
|
-
winston.debug("this.activityRoute:"+ this.activityRoute);
|
|
237
|
-
|
|
238
|
-
winston.info("ModulesManager activities initialized");
|
|
239
|
-
} catch(err) {
|
|
240
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
241
|
-
winston.info("ModulesManager init activities module not found");
|
|
242
|
-
}else {
|
|
243
|
-
winston.error("ModulesManager error initializing init activities module", err);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
160
|
|
|
247
161
|
|
|
248
162
|
|
|
@@ -344,70 +258,8 @@ class ModulesManager {
|
|
|
344
258
|
}
|
|
345
259
|
}
|
|
346
260
|
|
|
347
|
-
try {
|
|
348
|
-
this.cannedResponseRoute = require('@tiledesk-ent/tiledesk-server-canned').cannedResponseRoute;
|
|
349
|
-
winston.debug("this.cannedResponseRoute:"+ this.cannedResponseRoute);
|
|
350
|
-
winston.info("ModulesManager cannedResponseRoute initialized");
|
|
351
|
-
} catch(err) {
|
|
352
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
353
|
-
winston.info("ModulesManager init canned module not found");
|
|
354
|
-
}else {
|
|
355
|
-
winston.error("ModulesManager error initializing init canned module", err);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
try {
|
|
360
|
-
this.tagRoute = require('@tiledesk-ent/tiledesk-server-tags').tagRoute;
|
|
361
|
-
winston.debug("this.tagRoute:"+ this.tagRoute);
|
|
362
|
-
winston.info("ModulesManager tagRoute initialized");
|
|
363
|
-
} catch(err) {
|
|
364
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
365
|
-
winston.info("ModulesManager init tag module not found");
|
|
366
|
-
}else {
|
|
367
|
-
winston.error("ModulesManager error initializing init tag module", err);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
try {
|
|
372
|
-
this.groupsRoute = require('@tiledesk-ent/tiledesk-server-groups').groupsRoute;
|
|
373
|
-
winston.debug("this.groupsRoute:"+ this.groupsRoute);
|
|
374
|
-
winston.info("ModulesManager groupsRoute initialized");
|
|
375
|
-
} catch(err) {
|
|
376
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
377
|
-
winston.info("ModulesManager init group module not found");
|
|
378
|
-
}else {
|
|
379
|
-
winston.error("ModulesManager error initializing init group module", err);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
261
|
|
|
384
|
-
|
|
385
|
-
if (config && config.routes && config.routes.departmentsRoute) {
|
|
386
|
-
try {
|
|
387
|
-
require('@tiledesk-ent/tiledesk-server-departments').ext(config.routes.departmentsRoute, config.passport);
|
|
388
|
-
winston.info("ModulesManager departmentsRoute initialized");
|
|
389
|
-
} catch(err) {
|
|
390
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
391
|
-
winston.info("ModulesManager init departments module not found");
|
|
392
|
-
}else {
|
|
393
|
-
winston.error("ModulesManager error initializing init departments module", err);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
if (config && config.routes && config.routes.projectsRoute) {
|
|
399
|
-
try {
|
|
400
|
-
require('@tiledesk-ent/tiledesk-server-mt').ext(config.routes.projectsRoute, config.passport);
|
|
401
|
-
winston.info("ModulesManager mt initialized");
|
|
402
|
-
} catch(err) {
|
|
403
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
404
|
-
winston.info("ModulesManager init mt module not found");
|
|
405
|
-
}else {
|
|
406
|
-
winston.error("ModulesManager error initializing init mt module", err);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
262
|
+
|
|
411
263
|
try {
|
|
412
264
|
this.visitorCounterRoute = require('@tiledesk-ent/tiledesk-server-visitorcounter').add(config.express);
|
|
413
265
|
winston.debug("this.visitorCounterRoute:"+ this.visitorCounterRoute);
|
|
@@ -459,24 +311,6 @@ class ModulesManager {
|
|
|
459
311
|
|
|
460
312
|
start() {
|
|
461
313
|
|
|
462
|
-
// stampa log
|
|
463
|
-
if (this.subscriptionNotifier) {
|
|
464
|
-
try {
|
|
465
|
-
this.subscriptionNotifier.start();
|
|
466
|
-
winston.info("ModulesManager subscriptionNotifier started");
|
|
467
|
-
} catch(err) {
|
|
468
|
-
winston.info("ModulesManager error starting subscriptionNotifier module", err);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
if (this.activityArchiver) {
|
|
473
|
-
try {
|
|
474
|
-
this.activityArchiver.listen();
|
|
475
|
-
winston.info("ModulesManager activityArchiver started");
|
|
476
|
-
} catch(err) {
|
|
477
|
-
winston.info("ModulesManager error starting activityArchiver module", err);
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
314
|
|
|
481
315
|
if (this.jwthistoryArchiver) {
|
|
482
316
|
try {
|