@tiledesk/tiledesk-server 2.2.17 → 2.2.21
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +10 -24
- package/app.js +41 -1
- package/config/labels/widget.json +12 -12
- package/models/routerLogger.js +57 -0
- package/package.json +1 -1
- package/pubmodules/events/eventRoute.js +2 -2
- package/routes/faq.js +1 -1
- package/routes/public-analytics.js +3 -0
- package/routes/widget.js +1 -1
- package/services/faqBotSupport.js +1 -0
package/CHANGELOG.md
CHANGED
@@ -1,32 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
* Azione: invia in chat messaggio “Assegnata a $REQUEST_FIRST_PARTECIPANT” [SCATTA SU: ONAFTERSERVE()]
|
1
|
+
# 2.2.21 -> PROD
|
2
|
+
- Increased list answers limit from 100 to 300
|
3
|
+
- enabled again waiting time in widgets endpoint unused
|
5
4
|
|
6
|
-
* Trigger2:
|
7
|
-
* agenti non disponibili
|
8
|
-
* Azione: rispondi con messaggio “offline” (il messaggio offline comprende info sulla messa in coda e sul tempo medio di attesa) $AVG_WAIT_TIME
|
9
|
-
* richiesta served() => in unassigned (in coda)
|
10
5
|
|
11
|
-
|
12
|
-
|
13
|
-
* Azione: messaggio “orari chiusi”
|
14
|
-
* Il chatbot rimane (più probabile perchè il chatbot di ingresso già gestisce le faq)
|
15
|
-
* metti in coda con messaggio (“orari chiusi” oppure altro messaggio)
|
6
|
+
# 2.2.20
|
7
|
+
- disabled waiting time in widgets endpoint unused
|
16
8
|
|
17
|
-
|
9
|
+
# 2.2.18
|
10
|
+
- Router logger module enable with ROUTELOGGER_ENABLED=true
|
18
11
|
|
19
|
-
|
20
|
-
|
21
|
-
ATTUALE: se orari chiusi fai serve() solo messaggio orari chiusi
|
22
|
-
AGGIUNGERE (con documentazione): se orari chiusi invita un chatbot (visto che non c’è, ma serve solo negli orari di chiusura) con messaggio orari chiusi
|
12
|
+
# 2.2.17
|
13
|
+
- Removed default fallback limit on parse reply
|
23
14
|
|
24
|
-
|
25
|
-
|
26
|
-
# 2.2.17 -> PROD
|
27
|
-
- removed default fallback limit on parse reply
|
28
|
-
|
29
|
-
# 2.2.16 -> PROD
|
15
|
+
# 2.2.16
|
30
16
|
- Email templates endpoint
|
31
17
|
- Created request.updated event for request event and deprecated request.update.comment
|
32
18
|
- Added Handlebars template processor for the message transformer module only if message.attributes.templateProcessor=true
|
package/app.js
CHANGED
@@ -107,7 +107,7 @@ var email = require('./routes/email');
|
|
107
107
|
var bootDataLoader = require('./services/bootDataLoader');
|
108
108
|
var settingDataLoader = require('./services/settingDataLoader');
|
109
109
|
var schemaMigrationService = require('./services/schemaMigrationService');
|
110
|
-
|
110
|
+
var RouterLogger = require('./models/routerLogger');
|
111
111
|
|
112
112
|
require('./services/mongoose-cache-fn')(mongoose);
|
113
113
|
|
@@ -222,7 +222,42 @@ app.options('*', cors());
|
|
222
222
|
// const customRedisRateLimiter = require("./rateLimiter").customRedisRateLimiter;
|
223
223
|
// app.use(customRedisRateLimiter);
|
224
224
|
|
225
|
+
if (process.env.ROUTELOGGER_ENABLED==="true") {
|
226
|
+
winston.info("RouterLogger enabled ");
|
227
|
+
app.use(function (req, res, next) {
|
228
|
+
// winston.error("log ", req);
|
229
|
+
|
230
|
+
try {
|
231
|
+
var projectid = req.projectid;
|
232
|
+
winston.debug("RouterLogger projectIdSetter projectid:" + projectid);
|
233
|
+
|
234
|
+
var fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl;
|
235
|
+
winston.debug("fullUrl:"+ fullUrl);
|
236
|
+
winston.debug("req.get('origin'):" + req.get('origin'));
|
237
|
+
|
238
|
+
var routerLogger = new RouterLogger({
|
239
|
+
origin: req.get('origin'),
|
240
|
+
fullurl: fullUrl,
|
241
|
+
url: req.originalUrl.split("?").shift(),
|
242
|
+
id_project: projectid,
|
243
|
+
});
|
244
|
+
|
245
|
+
routerLogger.save(function (err, savedRouterLogger) {
|
246
|
+
if (err) {
|
247
|
+
winston.error('Error saving RouterLogger ', err)
|
248
|
+
}
|
249
|
+
winston.debug("RouterLogger saved "+ savedRouterLogger);
|
250
|
+
next();
|
251
|
+
});
|
252
|
+
}catch(e) {
|
253
|
+
winston.error('Error saving RouterLogger ', e)
|
254
|
+
next();
|
255
|
+
}
|
256
|
+
});
|
225
257
|
|
258
|
+
} else {
|
259
|
+
winston.info("RouterLogger disabled ");
|
260
|
+
}
|
226
261
|
|
227
262
|
app.get('/', function (req, res) {
|
228
263
|
res.send('Hello from Tiledesk server. It\'s UP. See the documentation here http://developer.tiledesk.com');
|
@@ -276,6 +311,9 @@ var projectSetter = function (req, res, next) {
|
|
276
311
|
}
|
277
312
|
|
278
313
|
|
314
|
+
|
315
|
+
|
316
|
+
|
279
317
|
// app.use('/admin', admin);
|
280
318
|
|
281
319
|
//oauth2
|
@@ -284,6 +322,7 @@ var projectSetter = function (req, res, next) {
|
|
284
322
|
// app.post('/oauth/token', oauth2.token);
|
285
323
|
|
286
324
|
|
325
|
+
|
287
326
|
app.use('/auth', auth);
|
288
327
|
app.use('/testauth', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken], authtest);
|
289
328
|
|
@@ -407,6 +446,7 @@ app.use(function (err, req, res, next) {
|
|
407
446
|
res.render('error');
|
408
447
|
});*/
|
409
448
|
|
449
|
+
|
410
450
|
// error handler
|
411
451
|
app.use((err, req, res, next) => {
|
412
452
|
winston.error("General error", err);
|
@@ -63,8 +63,8 @@
|
|
63
63
|
|
64
64
|
"INFO_SUPPORT_USER_ADDED_SUBJECT":"you",
|
65
65
|
"INFO_SUPPORT_USER_ADDED_YOU_VERB":"you have been added ",
|
66
|
-
"INFO_SUPPORT_USER_ADDED_COMPLEMENT":"
|
67
|
-
"INFO_SUPPORT_USER_ADDED_VERB":"
|
66
|
+
"INFO_SUPPORT_USER_ADDED_COMPLEMENT":"the chat",
|
67
|
+
"INFO_SUPPORT_USER_ADDED_VERB":"joined",
|
68
68
|
"INFO_SUPPORT_CHAT_REOPENED":"Chat reopened",
|
69
69
|
"INFO_SUPPORT_CHAT_CLOSED":"Chat closed",
|
70
70
|
|
@@ -141,8 +141,8 @@
|
|
141
141
|
|
142
142
|
"INFO_SUPPORT_USER_ADDED_SUBJECT":"tu",
|
143
143
|
"INFO_SUPPORT_USER_ADDED_YOU_VERB":"sei stato aggiunto ",
|
144
|
-
"INFO_SUPPORT_USER_ADDED_COMPLEMENT":"
|
145
|
-
"INFO_SUPPORT_USER_ADDED_VERB":"
|
144
|
+
"INFO_SUPPORT_USER_ADDED_COMPLEMENT":"alla chat",
|
145
|
+
"INFO_SUPPORT_USER_ADDED_VERB":"si è unito",
|
146
146
|
"INFO_SUPPORT_CHAT_REOPENED":"Chat riaperta",
|
147
147
|
"INFO_SUPPORT_CHAT_CLOSED":"Chat chiusa",
|
148
148
|
|
@@ -217,8 +217,8 @@
|
|
217
217
|
|
218
218
|
"INFO_SUPPORT_USER_ADDED_SUBJECT":"toi",
|
219
219
|
"INFO_SUPPORT_USER_ADDED_YOU_VERB":"tu as été ajouté ",
|
220
|
-
"INFO_SUPPORT_USER_ADDED_COMPLEMENT":"
|
221
|
-
"INFO_SUPPORT_USER_ADDED_VERB":"
|
220
|
+
"INFO_SUPPORT_USER_ADDED_COMPLEMENT":"discuter",
|
221
|
+
"INFO_SUPPORT_USER_ADDED_VERB":"rejoint",
|
222
222
|
"INFO_SUPPORT_CHAT_REOPENED":"Chat rouvert",
|
223
223
|
"INFO_SUPPORT_CHAT_CLOSED":"Chat fermé",
|
224
224
|
|
@@ -293,8 +293,8 @@
|
|
293
293
|
|
294
294
|
"INFO_SUPPORT_USER_ADDED_SUBJECT":"usted",
|
295
295
|
"INFO_SUPPORT_USER_ADDED_YOU_VERB":"usted ha sido agregado ",
|
296
|
-
"INFO_SUPPORT_USER_ADDED_COMPLEMENT":"
|
297
|
-
"INFO_SUPPORT_USER_ADDED_VERB":"
|
296
|
+
"INFO_SUPPORT_USER_ADDED_COMPLEMENT":"para charlar",
|
297
|
+
"INFO_SUPPORT_USER_ADDED_VERB":"unido",
|
298
298
|
"INFO_SUPPORT_CHAT_REOPENED":"Chat reabierto",
|
299
299
|
"INFO_SUPPORT_CHAT_CLOSED":"Chat cerrado",
|
300
300
|
|
@@ -370,8 +370,8 @@
|
|
370
370
|
|
371
371
|
"INFO_SUPPORT_USER_ADDED_SUBJECT": "Sie",
|
372
372
|
"INFO_SUPPORT_USER_ADDED_YOU_VERB": "Sie wurden hinzugefügt ",
|
373
|
-
"INFO_SUPPORT_USER_ADDED_COMPLEMENT": "
|
374
|
-
"INFO_SUPPORT_USER_ADDED_VERB": "
|
373
|
+
"INFO_SUPPORT_USER_ADDED_COMPLEMENT": "zum Chatten",
|
374
|
+
"INFO_SUPPORT_USER_ADDED_VERB": "beigetreten",
|
375
375
|
"INFO_SUPPORT_CHAT_REOPENED": "Chat wieder geöffnet",
|
376
376
|
"INFO_SUPPORT_CHAT_CLOSED": "Chat geschlossen",
|
377
377
|
|
@@ -446,8 +446,8 @@
|
|
446
446
|
|
447
447
|
"INFO_SUPPORT_USER_ADDED_SUBJECT": "você",
|
448
448
|
"INFO_SUPPORT_USER_ADDED_YOU_VERB": "você foi adicionado ",
|
449
|
-
"INFO_SUPPORT_USER_ADDED_COMPLEMENT": "
|
450
|
-
"INFO_SUPPORT_USER_ADDED_VERB": "
|
449
|
+
"INFO_SUPPORT_USER_ADDED_COMPLEMENT": "para conversar",
|
450
|
+
"INFO_SUPPORT_USER_ADDED_VERB": "aderiu",
|
451
451
|
"INFO_SUPPORT_CHAT_REOPENED": "Chat reaberto",
|
452
452
|
"INFO_SUPPORT_CHAT_CLOSED": "Bate-papo fechado",
|
453
453
|
|
@@ -0,0 +1,57 @@
|
|
1
|
+
var mongoose = require('mongoose');
|
2
|
+
var Schema = mongoose.Schema;
|
3
|
+
var config = require('../config/database');
|
4
|
+
|
5
|
+
|
6
|
+
var winston = require('../config/winston');
|
7
|
+
|
8
|
+
var dbUrl = process.env.MONGODB_LOGS_URI || config.databaselogs || process.env.MONGODB_URI;
|
9
|
+
winston.info('VisitorCounterSchema dbUrl: '+dbUrl);
|
10
|
+
|
11
|
+
// mongoose.set('useFindAndModify', false); //??
|
12
|
+
// mongoose.set('useCreateIndex', true);
|
13
|
+
// mongoose.set('useUnifiedTopology', true);
|
14
|
+
|
15
|
+
var conn = mongoose.createConnection(dbUrl, { "autoIndex": true });
|
16
|
+
// var conn = mongoose.connect(dbUrl, { "useNewUrlParser": true, "autoIndex": true });
|
17
|
+
|
18
|
+
// db.getCollection('reqlogs').aggregate([ {$group:{_id:{id_project:"$id_project"}, "count":{$sum:1}}},{$sort:{"count":-1}}])
|
19
|
+
// db.getCollection('projects').find({"_id":ObjectId("5afeaf94404bff0014098f54")})
|
20
|
+
|
21
|
+
var RouterLoggerSchema = new Schema({
|
22
|
+
url: {
|
23
|
+
type: String,
|
24
|
+
index: true
|
25
|
+
},
|
26
|
+
fullurl: {
|
27
|
+
type: String,
|
28
|
+
index: true
|
29
|
+
},
|
30
|
+
|
31
|
+
// ip: {
|
32
|
+
// type: String,
|
33
|
+
// index: true
|
34
|
+
// },
|
35
|
+
// host: {
|
36
|
+
// type: String,
|
37
|
+
// index: true
|
38
|
+
// },
|
39
|
+
origin: {
|
40
|
+
type: String,
|
41
|
+
index: true
|
42
|
+
},
|
43
|
+
id_project: {
|
44
|
+
type: String,
|
45
|
+
index: true
|
46
|
+
//required: true
|
47
|
+
}
|
48
|
+
}, {
|
49
|
+
timestamps: true
|
50
|
+
}
|
51
|
+
);
|
52
|
+
|
53
|
+
var routerLogger = conn.model('router_logger', RouterLoggerSchema);
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
module.exports = routerLogger;
|
package/package.json
CHANGED
@@ -41,8 +41,8 @@ router.post('/', [
|
|
41
41
|
eventService.emit(req.body.name, req.body.attributes, req.projectid, pu, req.user.id, undefined, req.user).then(function(event) {
|
42
42
|
res.json(event);
|
43
43
|
}).catch(function(err) {
|
44
|
-
winston.error('Error saving the event '+ JSON.stringify(
|
45
|
-
return res.status(500).send({success: false, msg: 'Error saving the event '+ JSON.stringify(
|
44
|
+
winston.error('Error saving the event '+ JSON.stringify(event), err)
|
45
|
+
return res.status(500).send({success: false, msg: 'Error saving the event '+ JSON.stringify(event)});
|
46
46
|
});
|
47
47
|
|
48
48
|
// var newEvent = new Event({
|
package/routes/faq.js
CHANGED
@@ -273,7 +273,7 @@ router.get('/', function (req, res, next) {
|
|
273
273
|
query.id_faq_kb = req.query.id_faq_kb;
|
274
274
|
}
|
275
275
|
|
276
|
-
var limit =
|
276
|
+
var limit = 300; // Number of request per page
|
277
277
|
|
278
278
|
if (req.query.limit) {
|
279
279
|
limit = parseInt(req.query.limit);
|
@@ -11,6 +11,9 @@ var winston = require('../config/winston');
|
|
11
11
|
//winston.debug(req.params);
|
12
12
|
//winston.debug("req.projectid", req.projectid);
|
13
13
|
|
14
|
+
// res.json([]);
|
15
|
+
|
16
|
+
|
14
17
|
AnalyticResult.aggregate([
|
15
18
|
//last 4
|
16
19
|
{ $match: {"id_project":req.projectid, "createdAt" : { $gte : new Date((new Date().getTime() - (4 * 60 * 60 * 1000))) }} },
|
package/routes/widget.js
CHANGED
@@ -368,6 +368,7 @@ class FaqBotSupport {
|
|
368
368
|
// found = true;
|
369
369
|
// return resolve(bot_answer);
|
370
370
|
|
371
|
+
// problem with
|
371
372
|
// if (message.channel.name == "chat21") { //why this contition on chat21 channel? bacause only chat21 support parsed replies?
|
372
373
|
winston.debug("faqBotSupport message.channel.name is chat21",message);
|
373
374
|
that.getParsedMessage(bot_answer.text,message, bot, faqs[0]).then(function(bot_answerres) {
|