@tiledesk/tiledesk-server 2.2.39 → 2.3.3
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 +24 -0
- package/LICENSE +14 -657
- package/README.md +17 -3
- package/app.js +14 -2
- package/channels/chat21/chat21WebHook.js +12 -1
- 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/passport.js +4 -1
- package/models/lead.js +2 -0
- package/models/request.js +38 -11
- package/models/subscriptionLog.js +34 -0
- package/models/tagLibrary.js +42 -0
- package/package.json +4 -11
- package/pubmodules/activities/activityArchiver.js +295 -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 +51 -0
- package/pubmodules/canned/cannedResponseRoute.js +157 -0
- package/pubmodules/canned/index.js +3 -0
- package/pubmodules/emailNotification/requestNotification.js +184 -26
- package/pubmodules/messageActions/messageActionsInterceptor.js +4 -2
- package/pubmodules/pubModulesManager.js +104 -5
- package/pubmodules/scheduler/tasks/closeAgentUnresponsiveRequestTask.js +3 -1
- package/pubmodules/scheduler/tasks/closeBotUnresponsiveRequestTask.js +3 -1
- 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 +114 -0
- package/pubmodules/trigger/triggerRoute.js +150 -0
- package/routes/department.js +51 -0
- package/routes/group.js +140 -0
- package/routes/lead.js +24 -1
- package/routes/message.js +6 -3
- package/routes/project.js +52 -0
- package/routes/public-request.js +265 -2
- package/routes/request.js +83 -11
- package/routes/subscription.js +140 -0
- package/routes/tag.js +138 -0
- package/routes/user-request.js +3 -2
- package/routes/widget.js +16 -1
- package/routes/widgetLoader.js +31 -0
- package/services/emailService.js +189 -11
- package/services/faqService.js +1 -1
- package/services/leadService.js +2 -0
- package/services/modulesManager.js +7 -188
- 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/messageRoute.js +69 -0
- package/test/requestService.js +3 -1
- package/views/messages.jade +2 -2
package/routes/user-request.js
CHANGED
|
@@ -59,8 +59,9 @@ router.patch('/:requestid/rating', function (req, res) {
|
|
|
59
59
|
router.put('/:requestid/closeg', function (req, res) {
|
|
60
60
|
winston.debug(req.body);
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
// closeRequestByRequestId(request_id, id_project, skipStatsUpdate, notify, closed_by)
|
|
63
|
+
const closed_by = req.user.id;
|
|
64
|
+
return requestService.closeRequestByRequestId(req.params.requestid, req.projectid, false, true, closed_by).then(function(closedRequest) {
|
|
64
65
|
|
|
65
66
|
winston.verbose("request closed", closedRequest);
|
|
66
67
|
|
package/routes/widget.js
CHANGED
|
@@ -96,6 +96,7 @@ router.get('/', function(req, res, next) {
|
|
|
96
96
|
winston.debug("req.project:" + JSON.stringify(req.project));
|
|
97
97
|
|
|
98
98
|
if (req.project) {
|
|
99
|
+
//secondo me qui manca un parentesi tonda per gli or
|
|
99
100
|
if (req.project.profile && (req.project.profile.type === 'free' && req.project.trialExpired === true) || (req.project.profile.type === 'payment' && req.project.isActiveSubscription === false)) {
|
|
100
101
|
query.default = true;
|
|
101
102
|
}
|
|
@@ -129,7 +130,21 @@ router.get('/', function(req, res, next) {
|
|
|
129
130
|
return reject({err: "Project Not Found"});
|
|
130
131
|
}
|
|
131
132
|
|
|
132
|
-
|
|
133
|
+
|
|
134
|
+
winston.debug("project", project);
|
|
135
|
+
|
|
136
|
+
// ProjectSetter project not found with id: 62d8cf8b2b10b30013bb9b99
|
|
137
|
+
// Informazioni
|
|
138
|
+
// 2022-07-27 14:32:14.772 CESTerror: Error getting widget. {"err":"Project Not Found"}
|
|
139
|
+
// Informazioni
|
|
140
|
+
// 2022-07-27 14:32:14.778 CESTerror: uncaughtException: Cannot read property 'profile' of null
|
|
141
|
+
// Informazioni
|
|
142
|
+
// 2022-07-27 14:32:14.778 CESTTypeError: Cannot read property 'profile' of null at /usr/src/app/routes/widget.js:132:124 at /usr/src/app/node_modules/mongoose/lib/model.js:5074:18 at processTicksAndRejections (internal/process/task_queues.js:79:11) {"date":"Wed Jul 27 2022 12:32:14 GMT+0000 (Coordinated Universal Time)","error":{},"exception":true,"os":{"loadavg":[0.26,0.51,0.58],"uptime":1028128},"process":{"argv":["/usr/local/bin/node","/usr/src/app/bin/www"],"cwd":"/usr/src/app","execPath":"/usr/local/bin/node","gid":0,"memoryUsage":{"arrayBuffers":128833077,"external":130521753,"heapTotal":110641152,"heapUsed":85605912,"rss":310054912},"pid":26,"uid":0,"version":"v12.22.12"},"stack":"TypeError: Cannot read property 'profile' of null\n at /usr/src/app/routes/widget.js:132:124\n at /usr/src/app/node_modules/mongoose/lib/model.js:5074:18\n at processTicksAndRejections (internal/process/task_queues.js:79:11)","trace":[{"column":124,"file":"/usr/src/app/routes/widget.js","function":null,"line":132,"method":null,"native":false},{"column":18,"file":"/usr/src/app/node_modules/mongoose/lib/model.js","function":null,"line":5074,"method":null,"native":false},{"column":11,"file":"internal/process/task_queues.js","function":"processTicksAndRejections","line":79,"method":null,"native":false}]}
|
|
143
|
+
|
|
144
|
+
// console.log("project!=null",project!=null);
|
|
145
|
+
// console.log("project.profile",project.profile);
|
|
146
|
+
//secondo me qui manca un parentesi tonda per gli or
|
|
147
|
+
if (project && project.profile && ((project.profile.type === 'free' && project.trialExpired === true) || (project.profile.type === 'payment' && project.isActiveSubscription === false))) {
|
|
133
148
|
winston.debug('getProject remove poweredBy tag', project);
|
|
134
149
|
project.widget.poweredBy = undefined;
|
|
135
150
|
project.widget.baloonImage = undefined;
|
package/routes/widgetLoader.js
CHANGED
|
@@ -12,9 +12,40 @@ router.get('/load', function(req, res) {
|
|
|
12
12
|
winston.debug(query);
|
|
13
13
|
// TODO chech if query is null
|
|
14
14
|
res.redirect(widgetLocation+'?'+query);
|
|
15
|
+
|
|
15
16
|
});
|
|
16
17
|
|
|
17
18
|
|
|
19
|
+
router.get('/v5/:project_id', function(req, res) {
|
|
20
|
+
|
|
21
|
+
var project_id = req.params.project_id;
|
|
22
|
+
winston.debug("project_id: " + project_id);
|
|
23
|
+
|
|
24
|
+
res.type('.js');
|
|
25
|
+
|
|
26
|
+
var js = `
|
|
27
|
+
window.tiledeskSettings=
|
|
28
|
+
{
|
|
29
|
+
projectid: "${project_id}"
|
|
30
|
+
};
|
|
31
|
+
(function(d, s, id) {
|
|
32
|
+
var w=window; var d=document; var i=function(){i.c(arguments);};
|
|
33
|
+
i.q=[]; i.c=function(args){i.q.push(args);}; w.Tiledesk=i;
|
|
34
|
+
var js, fjs=d.getElementsByTagName(s)[0];
|
|
35
|
+
if (d.getElementById(id)) return;
|
|
36
|
+
js=d.createElement(s);
|
|
37
|
+
js.id=id; js.async=true; js.src="${widgetLocation}/launch.js";
|
|
38
|
+
fjs.parentNode.insertBefore(js, fjs);
|
|
39
|
+
}(document,'script','tiledesk-jssdk'));
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
winston.debug("js: " + js);
|
|
43
|
+
|
|
44
|
+
res.send(js);
|
|
45
|
+
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
|
|
18
49
|
var widgetTestLocation = process.env.WIDGET_TEST_LOCATION || widgetConfig.testLocation;
|
|
19
50
|
|
|
20
51
|
router.get('/test/load', function(req, res) {
|
package/services/emailService.js
CHANGED
|
@@ -191,20 +191,24 @@ class EmailService {
|
|
|
191
191
|
user: configEmail.user,
|
|
192
192
|
pass: configEmail.pass
|
|
193
193
|
},
|
|
194
|
+
// secureConnection: false,
|
|
195
|
+
// tls:{
|
|
196
|
+
// ciphers:'SSLv3'
|
|
197
|
+
// },
|
|
194
198
|
|
|
195
|
-
// openssl genrsa -out dkim_private.pem 2048
|
|
199
|
+
// openssl genrsa -out dkim_private.pem 2048
|
|
196
200
|
// openssl rsa -in dkim_private.pem -pubout -outform der 2>/dev/null | openssl base64 -A
|
|
197
201
|
// ->
|
|
198
202
|
// v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAunT2EopDAYnHwAOHd33KhlzjUXJfhmA+fK+cG85i9Pm33oyv1NoGrOynsni0PO6j7oRxxHqs6EMDOw4I/Q0C7aWn20oBomJZehTOkCV2xpuPKESiRktCe/MIZqbkRdypis4jSkFfFFkBHwgkAg5tb11E9elJap0ed/lN5/XlpGedqoypKxp+nEabgYO5mBMMNKRvbHx0eQttRYyIaNkTuMbAaqs4y3TkHOpGvZTJsvUonVMGAstSCfUmXnjF38aKpgyTausTSsxHbaxh3ieUB4ex+svnvsJ4Uh5Skklr+bxLVEHeJN55rxmV67ytLg5XCRWqdKIcJHFvSlm2YwJfcwIDAQABMacAL
|
|
199
203
|
// testdkim._domainkey.tiledesk.com. 86400 IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAunT2EopDAYnHwAOHd33KhlzjUXJfhmA+fK+cG85i9Pm33oyv1NoGrOynsni0PO6j7oRxxHqs6EMDOw4I/Q0C7aWn20oBomJZehTOkCV2xpuPKESiRktCe/MIZqbkRdypis4jSkFfFFkBHwgkAg5tb11E9elJap0ed/lN5/XlpGedqoypKxp+nEabgYO5mBMMNKRvbHx0eQttRYyIaNkTuMbAaqs4y3TkHOpGvZTJsvUonVMGAstSCfUmXnjF38aKpgyTausTSsxHbaxh3ieUB4ex+svnvsJ4Uh5Skklr+bxLVEHeJN55rxmV67ytLg5XCRWqdKIcJHFvSlm2YwJfcwIDAQABMacAL"
|
|
200
204
|
|
|
201
|
-
dkim: {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
205
|
+
// dkim: {
|
|
206
|
+
// domainName: "example.com",
|
|
207
|
+
// keySelector: "2017",
|
|
208
|
+
// privateKey: "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBg...",
|
|
209
|
+
// cacheDir: "/tmp",
|
|
210
|
+
// cacheTreshold: 100 * 1024
|
|
211
|
+
// }
|
|
208
212
|
};
|
|
209
213
|
|
|
210
214
|
winston.debug("getTransport transport: ",transport);
|
|
@@ -406,7 +410,9 @@ class EmailService {
|
|
|
406
410
|
}
|
|
407
411
|
}
|
|
408
412
|
|
|
409
|
-
|
|
413
|
+
// troncare nome utnete e nome progetto a max 10 caratteri
|
|
414
|
+
// cambiare in [Nicky:Dashboard Support] Assigned Chat
|
|
415
|
+
// serve per aggiornare native... fai aggiornamento
|
|
410
416
|
|
|
411
417
|
let subject = `[Tiledesk ${project ? project.name : '-'}] New Assigned Chat`;
|
|
412
418
|
|
|
@@ -958,11 +964,12 @@ class EmailService {
|
|
|
958
964
|
|
|
959
965
|
let inReplyTo;
|
|
960
966
|
let references;
|
|
967
|
+
winston.debug("message.request.attributes", message.request.attributes);
|
|
961
968
|
if (message.request.attributes) {
|
|
962
969
|
if (message.request.attributes.email_messageId) {
|
|
963
970
|
inReplyTo = message.request.attributes.email_messageId;
|
|
964
971
|
}
|
|
965
|
-
if (message.attributes.email_references) {
|
|
972
|
+
if (message.request.attributes.email_references) {
|
|
966
973
|
references = message.request.attributes.email_references;
|
|
967
974
|
}
|
|
968
975
|
}
|
|
@@ -1176,6 +1183,177 @@ class EmailService {
|
|
|
1176
1183
|
}
|
|
1177
1184
|
|
|
1178
1185
|
|
|
1186
|
+
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
async sendFollowerNotification(to, message, project) {
|
|
1196
|
+
|
|
1197
|
+
var that = this;
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
if (project.toJSON) {
|
|
1201
|
+
project = project.toJSON();
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
var html = await this.readTemplate('newMessageFollower.html', project.settings);
|
|
1205
|
+
|
|
1206
|
+
|
|
1207
|
+
var envTemplate = process.env.EMAIL_FOLLOWER_HTML_TEMPLATE;
|
|
1208
|
+
winston.debug("envTemplate: " + envTemplate);
|
|
1209
|
+
|
|
1210
|
+
if (envTemplate) {
|
|
1211
|
+
html = envTemplate;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
winston.debug("html: " + html);
|
|
1215
|
+
|
|
1216
|
+
var template = handlebars.compile(html);
|
|
1217
|
+
|
|
1218
|
+
var baseScope = JSON.parse(JSON.stringify(that));
|
|
1219
|
+
delete baseScope.pass;
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
let msgText = message.text;//.replace(/[\n\r]/g, '<br>');
|
|
1223
|
+
msgText = encode(msgText);
|
|
1224
|
+
if (this.markdown) {
|
|
1225
|
+
msgText = marked(msgText);
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
winston.debug("msgText: " + msgText);
|
|
1229
|
+
winston.debug("baseScope: " + JSON.stringify(baseScope));
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
var replacements = {
|
|
1233
|
+
message: message,
|
|
1234
|
+
project: project,
|
|
1235
|
+
msgText: msgText,
|
|
1236
|
+
baseScope: baseScope
|
|
1237
|
+
};
|
|
1238
|
+
|
|
1239
|
+
var html = template(replacements);
|
|
1240
|
+
winston.debug("html: " + html);
|
|
1241
|
+
|
|
1242
|
+
const fs = require('fs');
|
|
1243
|
+
fs.writeFileSync('tem1111.html', html);
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
let messageId = message._id + "@" + MESSAGE_ID_DOMAIN;
|
|
1248
|
+
|
|
1249
|
+
let replyTo;
|
|
1250
|
+
if (this.replyEnabled) {
|
|
1251
|
+
replyTo = message.request.request_id + this.inboundDomainDomainWithAt;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
let headers;
|
|
1255
|
+
if (message.request) {
|
|
1256
|
+
|
|
1257
|
+
messageId = message.request.request_id + "+" + messageId;
|
|
1258
|
+
|
|
1259
|
+
if (message.request.attributes && message.request.attributes.email_replyTo) {
|
|
1260
|
+
replyTo = message.request.attributes.email_replyTo;
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
headers = {"X-TILEDESK-PROJECT-ID": project._id, "X-TILEDESK-REQUEST-ID": message.request.request_id, "X-TILEDESK-TICKET-ID":message.request.ticket_id };
|
|
1264
|
+
|
|
1265
|
+
winston.verbose("messageId: " + messageId);
|
|
1266
|
+
winston.verbose("replyTo: " + replyTo);
|
|
1267
|
+
winston.verbose("email headers", headers);
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
|
+
let inReplyTo;
|
|
1272
|
+
let references;
|
|
1273
|
+
let cc;
|
|
1274
|
+
let ccString;
|
|
1275
|
+
|
|
1276
|
+
if (message.request && message.request.attributes) {
|
|
1277
|
+
winston.debug("email message.request.attributes: ", message.request.attributes);
|
|
1278
|
+
|
|
1279
|
+
if (message.request.attributes.email_messageId) {
|
|
1280
|
+
inReplyTo = message.request.attributes.email_messageId;
|
|
1281
|
+
}
|
|
1282
|
+
if (message.request.attributes.email_references) {
|
|
1283
|
+
references = message.request.attributes.email_references;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
if (message.request.attributes.email_cc) {
|
|
1287
|
+
cc = message.request.attributes.email_cc;
|
|
1288
|
+
}
|
|
1289
|
+
winston.debug("email message.request.attributes.email_ccStr: "+ message.request.attributes.email_ccStr);
|
|
1290
|
+
if (message.request.attributes.email_ccStr!=undefined) {
|
|
1291
|
+
ccString = message.request.attributes.email_ccStr;
|
|
1292
|
+
winston.debug("email set ccString");
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
winston.verbose("email inReplyTo: "+ inReplyTo);
|
|
1296
|
+
winston.verbose("email references: "+ references);
|
|
1297
|
+
winston.verbose("email cc: ", cc);
|
|
1298
|
+
winston.verbose("email ccString: "+ ccString);
|
|
1299
|
+
|
|
1300
|
+
let from;
|
|
1301
|
+
let configEmail;
|
|
1302
|
+
if (project && project.settings && project.settings.email) {
|
|
1303
|
+
if (project.settings.email.config) {
|
|
1304
|
+
configEmail = project.settings.email.config;
|
|
1305
|
+
winston.verbose("custom email configEmail setting found: ", configEmail);
|
|
1306
|
+
}
|
|
1307
|
+
if (project.settings.email.from) {
|
|
1308
|
+
from = project.settings.email.from;
|
|
1309
|
+
winston.verbose("custom from email setting found: "+ from);
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
that.send({
|
|
1317
|
+
messageId: messageId,
|
|
1318
|
+
// sender: message.senderFullname, //must be an email
|
|
1319
|
+
from:from,
|
|
1320
|
+
to:to,
|
|
1321
|
+
cc: ccString,
|
|
1322
|
+
replyTo: replyTo,
|
|
1323
|
+
inReplyTo: inReplyTo,
|
|
1324
|
+
references: references,
|
|
1325
|
+
// subject:`${message.request ? message.request.subject : '-'}`,
|
|
1326
|
+
subject:`${message.request ? message.request.ticket_id : '-'}`, //gmail uses subject
|
|
1327
|
+
text:html,
|
|
1328
|
+
html:html,
|
|
1329
|
+
config:configEmail,
|
|
1330
|
+
headers:headers
|
|
1331
|
+
});
|
|
1332
|
+
|
|
1333
|
+
// // messageId = "notification" + messageId;
|
|
1334
|
+
|
|
1335
|
+
// // that.send({
|
|
1336
|
+
// // messageId: messageId,
|
|
1337
|
+
// // // sender: message.senderFullname, //must be an email
|
|
1338
|
+
// // to: that.bcc,
|
|
1339
|
+
// // replyTo: replyTo,
|
|
1340
|
+
// // inReplyTo: inReplyTo,
|
|
1341
|
+
// // references: references,
|
|
1342
|
+
// // // subject: `${message.request ? message.request.subject : '-'} - notification`,
|
|
1343
|
+
// // subject: `${message.request ? message.request.subject : '-'} - notification`,
|
|
1344
|
+
// // text:html,
|
|
1345
|
+
// // html:html,
|
|
1346
|
+
// // headers:headers
|
|
1347
|
+
// // });
|
|
1348
|
+
|
|
1349
|
+
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
|
|
1179
1357
|
/*
|
|
1180
1358
|
sendEmailChannelTakingNotification(to, request, project, tokenQueryString) {
|
|
1181
1359
|
|
|
@@ -1505,6 +1683,6 @@ async sendRequestTranscript(to, messages, request, project) {
|
|
|
1505
1683
|
|
|
1506
1684
|
var emailService = new EmailService();
|
|
1507
1685
|
|
|
1508
|
-
//
|
|
1686
|
+
// emailService.sendTest("asd.");
|
|
1509
1687
|
|
|
1510
1688
|
module.exports = emailService;
|
package/services/faqService.js
CHANGED
|
@@ -78,7 +78,7 @@ class FaqService {
|
|
|
78
78
|
{ 'question': '\\start', 'answer': 'Hello 👋. I\'m a bot 🤖.\n\nChoose one of the options below or write a message to reach our staff.\n* Who are you?\n* Where are you?\n* What can you do?\n* 👨🏻🦰 I want an agent', 'intent_display_name': 'start', 'topic': 'internal' },
|
|
79
79
|
{ 'question': 'defaultFallback', 'answer': 'I can not provide an adequate answer. Write a new question or talk to a human agent.\n* Back to start tdAction:start\n* See the docs https://docs.tiledesk.com/\n* 👨🏻🦰 I want an agent', 'intent_display_name': 'defaultFallback', 'topic': 'internal' }, //TODO se metto spazio n * nn va
|
|
80
80
|
{ 'question': 'What can you do?', 'answer': 'Using natural language processing, I\'m able to find the best answer for your users. I also support images, videos etc.. Let\'s try:\n* Sample Image\n* Sample Video\n* Sample Action tdAction:action1\n* Sample Frame\n* Back to start tdAction:start', 'topic': 'sample' },
|
|
81
|
-
{ 'question': 'Sample Image', 'answer': 'tdImage:https://tiledesk.com/
|
|
81
|
+
{ 'question': 'Sample Image', 'answer': 'tdImage:https://tiledesk.com/wp-content/uploads/2022/07/tiledesk_v2.png\n* What can you do?\n* Back to start tdAction:start', 'topic': 'sample' },
|
|
82
82
|
{ 'question': 'Sample Frame', 'answer': 'tdFrame:https://www.emanueleferonato.com/wp-content/uploads/2019/02/runner/\n* What can you do?\n* Back to start tdAction:start', 'topic': 'sample' },
|
|
83
83
|
{ 'question': 'Sample Video', 'answer': 'tdVideo:https://www.youtube.com/embed/EngW7tLk6R8\n* What can you do?\n* Back to start tdAction:start', 'topic': 'sample' },
|
|
84
84
|
{ 'question': 'Where are you?', 'answer': 'We are here ❤️\ntdFrame:https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d6087916.923447935!2d8.234804542117423!3d41.836572992140624!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x12d4fe82448dd203%3A0xe22cf55c24635e6f!2sItaly!5e0!3m2!1sen!2sit!4v1613657475377!5m2!1sen!2sit\n* Back to start tdAction:start', 'topic': 'sample' },
|
package/services/leadService.js
CHANGED
|
@@ -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,9 +41,6 @@ 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;
|
|
@@ -107,50 +98,16 @@ class ModulesManager {
|
|
|
107
98
|
useUnderProjects(app) {
|
|
108
99
|
var that = this;
|
|
109
100
|
winston.debug("ModulesManager using controllers");
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
app.use('/:projectid/modules/triggers', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRole('admin')], this.triggerRoute);
|
|
114
|
-
winston.info("ModulesManager trigger controller loaded");
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (this.analyticsRoute) {
|
|
118
|
-
app.use('/:projectid/analytics', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRole('agent')], this.analyticsRoute);
|
|
119
|
-
winston.info("ModulesManager analytics controller loaded");
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (this.resthookRoute) {
|
|
123
|
-
app.use('/:projectid/subscriptions', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRole('admin')], this.resthookRoute);
|
|
124
|
-
winston.info("ModulesManager subscriptions controller loaded");
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (this.activityRoute) {
|
|
128
|
-
app.use('/:projectid/activities', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRole('admin')], this.activityRoute);
|
|
129
|
-
winston.info("ModulesManager activities controller loaded");
|
|
130
|
-
}
|
|
131
|
-
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
132
104
|
|
|
133
105
|
if (this.requestHistoryRoute) {
|
|
134
106
|
app.use('/:projectid/requests/:request_id/history', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRoleOrTypes(null, ['subscription'])] , this.requestHistoryRoute);
|
|
135
107
|
winston.info("ModulesManager requestHistory controller loaded");
|
|
136
108
|
}
|
|
137
109
|
|
|
138
|
-
|
|
139
|
-
if (this.cannedResponseRoute) {
|
|
140
|
-
app.use('/:projectid/canned', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRole('agent')], this.cannedResponseRoute);
|
|
141
|
-
winston.info("ModulesManager canned controller loaded");
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (this.tagRoute) {
|
|
145
|
-
app.use('/:projectid/tags', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRole('agent')], this.tagRoute);
|
|
146
|
-
winston.info("ModulesManager tag controller loaded");
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (this.groupsRoute) {
|
|
150
|
-
app.use('/:projectid/groups', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRole('admin')], this.groupsRoute);
|
|
151
|
-
winston.info("ModulesManager group controller loaded");
|
|
152
|
-
}
|
|
153
|
-
|
|
110
|
+
|
|
154
111
|
|
|
155
112
|
|
|
156
113
|
if (this.visitorCounterRoute) {
|
|
@@ -188,19 +145,6 @@ class ModulesManager {
|
|
|
188
145
|
|
|
189
146
|
|
|
190
147
|
|
|
191
|
-
try {
|
|
192
|
-
this.trigger = require('@tiledesk-ent/tiledesk-server-triggers').start;
|
|
193
|
-
winston.debug("this.trigger:"+ this.trigger);
|
|
194
|
-
this.triggerRoute = require('@tiledesk-ent/tiledesk-server-triggers').triggerRoute;
|
|
195
|
-
winston.debug("this.triggerRoute:"+ this.triggerRoute);
|
|
196
|
-
winston.info("ModulesManager trigger initialized");
|
|
197
|
-
} catch(err) {
|
|
198
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
199
|
-
winston.info("ModulesManager init trigger module not found");
|
|
200
|
-
}else {
|
|
201
|
-
winston.error("ModulesManager error initializing init trigger module", err);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
148
|
|
|
205
149
|
|
|
206
150
|
try {
|
|
@@ -213,51 +157,6 @@ class ModulesManager {
|
|
|
213
157
|
winston.error("ModulesManager error initializing init stripe module", err);
|
|
214
158
|
}
|
|
215
159
|
}
|
|
216
|
-
|
|
217
|
-
try {
|
|
218
|
-
this.resthookRoute = require('@tiledesk-ent/tiledesk-server-resthook').resthookRoute;
|
|
219
|
-
winston.debug("this.resthookRoute:"+ this.resthookRoute);
|
|
220
|
-
this.subscriptionNotifier = require('@tiledesk-ent/tiledesk-server-resthook').subscriptionNotifier;
|
|
221
|
-
// this.subscriptionNotifier.start();
|
|
222
|
-
winston.info("ModulesManager resthook initialized");
|
|
223
|
-
} catch(err) {
|
|
224
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
225
|
-
winston.info("ModulesManager init resthookRoute module not found");
|
|
226
|
-
}else {
|
|
227
|
-
winston.error("ModulesManager error initializing init resthook module", err);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
try {
|
|
233
|
-
this.analyticsRoute = require('@tiledesk-ent/tiledesk-server-analytics').analyticsRoute;
|
|
234
|
-
winston.debug("this.analyticsRoute:"+ this.analyticsRoute);
|
|
235
|
-
winston.info("ModulesManager analyticsRoute initialized");
|
|
236
|
-
} catch(err) {
|
|
237
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
238
|
-
winston.info("ModulesManager init analytics module not found");
|
|
239
|
-
}else {
|
|
240
|
-
winston.error("ModulesManager error initializing init analytics module", err);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
try {
|
|
246
|
-
this.activityArchiver = require('@tiledesk-ent/tiledesk-server-activities').activityArchiver;
|
|
247
|
-
// this.activityArchiver.listen();
|
|
248
|
-
winston.debug("this.activityArchiver:"+ this.activityArchiver);
|
|
249
|
-
|
|
250
|
-
this.activityRoute = require('@tiledesk-ent/tiledesk-server-activities').activityRoute;
|
|
251
|
-
winston.debug("this.activityRoute:"+ this.activityRoute);
|
|
252
|
-
|
|
253
|
-
winston.info("ModulesManager activities initialized");
|
|
254
|
-
} catch(err) {
|
|
255
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
256
|
-
winston.info("ModulesManager init activities module not found");
|
|
257
|
-
}else {
|
|
258
|
-
winston.error("ModulesManager error initializing init activities module", err);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
160
|
|
|
262
161
|
|
|
263
162
|
|
|
@@ -359,70 +258,8 @@ class ModulesManager {
|
|
|
359
258
|
}
|
|
360
259
|
}
|
|
361
260
|
|
|
362
|
-
try {
|
|
363
|
-
this.cannedResponseRoute = require('@tiledesk-ent/tiledesk-server-canned').cannedResponseRoute;
|
|
364
|
-
winston.debug("this.cannedResponseRoute:"+ this.cannedResponseRoute);
|
|
365
|
-
winston.info("ModulesManager cannedResponseRoute initialized");
|
|
366
|
-
} catch(err) {
|
|
367
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
368
|
-
winston.info("ModulesManager init canned module not found");
|
|
369
|
-
}else {
|
|
370
|
-
winston.error("ModulesManager error initializing init canned module", err);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
try {
|
|
375
|
-
this.tagRoute = require('@tiledesk-ent/tiledesk-server-tags').tagRoute;
|
|
376
|
-
winston.debug("this.tagRoute:"+ this.tagRoute);
|
|
377
|
-
winston.info("ModulesManager tagRoute initialized");
|
|
378
|
-
} catch(err) {
|
|
379
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
380
|
-
winston.info("ModulesManager init tag module not found");
|
|
381
|
-
}else {
|
|
382
|
-
winston.error("ModulesManager error initializing init tag module", err);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
try {
|
|
387
|
-
this.groupsRoute = require('@tiledesk-ent/tiledesk-server-groups').groupsRoute;
|
|
388
|
-
winston.debug("this.groupsRoute:"+ this.groupsRoute);
|
|
389
|
-
winston.info("ModulesManager groupsRoute initialized");
|
|
390
|
-
} catch(err) {
|
|
391
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
392
|
-
winston.info("ModulesManager init group module not found");
|
|
393
|
-
}else {
|
|
394
|
-
winston.error("ModulesManager error initializing init group module", err);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
261
|
|
|
399
|
-
|
|
400
|
-
if (config && config.routes && config.routes.departmentsRoute) {
|
|
401
|
-
try {
|
|
402
|
-
require('@tiledesk-ent/tiledesk-server-departments').ext(config.routes.departmentsRoute, config.passport);
|
|
403
|
-
winston.info("ModulesManager departmentsRoute initialized");
|
|
404
|
-
} catch(err) {
|
|
405
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
406
|
-
winston.info("ModulesManager init departments module not found");
|
|
407
|
-
}else {
|
|
408
|
-
winston.error("ModulesManager error initializing init departments module", err);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
if (config && config.routes && config.routes.projectsRoute) {
|
|
414
|
-
try {
|
|
415
|
-
require('@tiledesk-ent/tiledesk-server-mt').ext(config.routes.projectsRoute, config.passport);
|
|
416
|
-
winston.info("ModulesManager mt initialized");
|
|
417
|
-
} catch(err) {
|
|
418
|
-
if (err.code == 'MODULE_NOT_FOUND') {
|
|
419
|
-
winston.info("ModulesManager init mt module not found");
|
|
420
|
-
}else {
|
|
421
|
-
winston.error("ModulesManager error initializing init mt module", err);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
262
|
+
|
|
426
263
|
try {
|
|
427
264
|
this.visitorCounterRoute = require('@tiledesk-ent/tiledesk-server-visitorcounter').add(config.express);
|
|
428
265
|
winston.debug("this.visitorCounterRoute:"+ this.visitorCounterRoute);
|
|
@@ -474,24 +311,6 @@ class ModulesManager {
|
|
|
474
311
|
|
|
475
312
|
start() {
|
|
476
313
|
|
|
477
|
-
// stampa log
|
|
478
|
-
if (this.subscriptionNotifier) {
|
|
479
|
-
try {
|
|
480
|
-
this.subscriptionNotifier.start();
|
|
481
|
-
winston.info("ModulesManager subscriptionNotifier started");
|
|
482
|
-
} catch(err) {
|
|
483
|
-
winston.info("ModulesManager error starting subscriptionNotifier module", err);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
if (this.activityArchiver) {
|
|
488
|
-
try {
|
|
489
|
-
this.activityArchiver.listen();
|
|
490
|
-
winston.info("ModulesManager activityArchiver started");
|
|
491
|
-
} catch(err) {
|
|
492
|
-
winston.info("ModulesManager error starting activityArchiver module", err);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
314
|
|
|
496
315
|
if (this.jwthistoryArchiver) {
|
|
497
316
|
try {
|