@tiledesk/tiledesk-server 2.1.41 → 2.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. package/.circleci/config.yml +54 -0
  2. package/.env.sample +1 -1
  3. package/.github/workflows/docker-community-push-latest.yml +22 -0
  4. package/.github/workflows/{docker-image-push.yml → docker-image-en-tag-push.yml} +1 -1
  5. package/.github/workflows/docker-image-tag-community-tag-push.yml +21 -0
  6. package/.github/workflows/{docker-push-latest.yml → docker-push-en-push-latest.yml} +1 -1
  7. package/CHANGELOG.md +198 -1
  8. package/Dockerfile +1 -1
  9. package/Dockerfile-en +1 -1
  10. package/README.md +5 -7
  11. package/app.js +12 -1
  12. package/channels/chat21/chat21Contact.js +34 -8
  13. package/channels/chat21/chat21Handler.js +48 -5
  14. package/channels/chat21/chat21WebHook.js +34 -5
  15. package/channels/chat21/nativeauth.js +2 -2
  16. package/config/email.js +2 -1
  17. package/config/global.js +3 -0
  18. package/config/labels/widget.json +170 -16
  19. package/event/messageEvent.js +18 -1
  20. package/middleware/passport.js +10 -4
  21. package/models/actionsConstants.js +7 -0
  22. package/models/department.js +3 -0
  23. package/models/faq.js +8 -2
  24. package/models/faq_kb.js +6 -0
  25. package/models/message.js +10 -4
  26. package/models/messageConstants.js +3 -3
  27. package/models/request.js +33 -3
  28. package/package.json +31 -28
  29. package/pubmodules/emailNotification/requestNotification.js +380 -62
  30. package/pubmodules/messageActions/messageActionsInterceptor.js +20 -7
  31. package/pubmodules/messageTransformer/index.js +1 -1
  32. package/pubmodules/messageTransformer/microLanguageAttributesTransformerInterceptor.js +67 -0
  33. package/pubmodules/pubModulesManager.js +66 -14
  34. package/pubmodules/rules/conciergeBot.js +81 -49
  35. package/routes/auth.js +34 -10
  36. package/routes/campaigns.js +117 -25
  37. package/routes/faq.js +19 -0
  38. package/routes/faq_kb.js +13 -4
  39. package/routes/faqpub.js +1 -1
  40. package/routes/images.js +1 -1
  41. package/routes/jwt.js +0 -1
  42. package/routes/logs.js +26 -0
  43. package/routes/message.js +7 -2
  44. package/routes/messagesRoot.js +73 -16
  45. package/routes/project_user.js +36 -1
  46. package/routes/request.js +88 -12
  47. package/routes/requestUtilRoot.js +30 -0
  48. package/routes/urls.js +12 -0
  49. package/routes/users.js +5 -1
  50. package/services/BotSubscriptionNotifier.js +1 -0
  51. package/services/departmentService.js +29 -5
  52. package/services/emailService.js +1103 -298
  53. package/services/faqBotHandler.js +176 -61
  54. package/services/faqBotSupport.js +181 -117
  55. package/services/faqService.js +17 -14
  56. package/services/messageService.js +57 -9
  57. package/services/modulesManager.js +86 -23
  58. package/services/requestService.js +58 -17
  59. package/template/email/assignedEmailMessage.html +205 -0
  60. package/template/email/assignedRequest.html +44 -14
  61. package/template/email/beenInvitedExistingUser.html +2 -2
  62. package/template/email/beenInvitedNewUser.html +1 -1
  63. package/template/email/newMessage.html +31 -12
  64. package/template/email/passwordChanged.html +2 -3
  65. package/template/email/pooledEmailMessage.html +208 -0
  66. package/template/email/pooledRequest.html +41 -14
  67. package/template/email/resetPassword.html +2 -3
  68. package/template/email/sendTranscript.html +1 -1
  69. package/template/email/test.html +1 -1
  70. package/template/email/ticket.html +78 -52
  71. package/template/email/ticket.txt +5 -1
  72. package/template/email/verify.html +1 -1
  73. package/test/authentication.js +76 -4
  74. package/test/authenticationJwt.js +76 -2
  75. package/test/campaignsRoute.js +226 -0
  76. package/test/faqService.js +3 -3
  77. package/test/faqkbRoute.js +3 -2
  78. package/test/messageRootRoute.js +193 -0
  79. package/test/messageRoute.js +75 -0
  80. package/test/messageService.js +5 -5
  81. package/test/requestRoute.js +27 -9
  82. package/test/requestService.js +472 -11
  83. package/test-int/bot.js +673 -8
  84. package/websocket/webSocketServer.js +7 -4
  85. package/template/email/ticket-taking.txt +0 -7
@@ -17,11 +17,23 @@ var ProjectUserUtil = require("../../utils/project_userUtil");
17
17
  var RequestUtil = require("../../utils/requestUtil");
18
18
  const authEvent = require('../../event/authEvent');
19
19
 
20
+ var syncJoinAndLeaveGroupEvent = false;
21
+ if (process.env.SYNC_JOIN_LEAVE_GROUP_EVENT === true || process.env.SYNC_JOIN_LEAVE_GROUP_EVENT ==="true") {
22
+ syncJoinAndLeaveGroupEvent = true;
23
+ }
24
+ winston.info("Chat21 Sync JoinAndLeave Support Group Event: " + syncJoinAndLeaveGroupEvent);
25
+
26
+ var allowReopenChat = false;
27
+ if (process.env.ALLOW_REOPEN_CHAT === true || process.env.ALLOW_REOPEN_CHAT ==="true") {
28
+ allowReopenChat = true;
29
+ }
30
+ winston.info("Chat21 allow reopen chat: " + allowReopenChat);
31
+
20
32
 
21
33
  router.post('/', function (req, res) {
22
34
 
23
35
 
24
-
36
+ winston.debug("req.body.event_type: " + req.body.event_type);
25
37
 
26
38
  //Deprecated
27
39
  if (req.body.event_type == "message-sent" || req.body.event_type == "new-message") {
@@ -38,7 +50,7 @@ router.post('/', function (req, res) {
38
50
 
39
51
  var message = req.body.data;
40
52
 
41
-
53
+ winston.debug("message text: " + message.text);
42
54
 
43
55
 
44
56
  // before request_id id_project unique commented
@@ -344,16 +356,16 @@ router.post('/', function (req, res) {
344
356
  var projectId = RequestUtil.getProjectIdFromRequestId(recipient_id);
345
357
 
346
358
  var isObjectId = mongoose.Types.ObjectId.isValid(projectId);
347
- winston.verbose("isObjectId:"+ isObjectId);
359
+ winston.debug("isObjectId:"+ isObjectId);
348
360
 
349
- winston.verbose("attributes",conversation.attributes);
361
+ winston.debug("attributes",conversation.attributes);
350
362
 
351
363
  if (!projectId || !isObjectId) { //back compatibility when projectId were always presents in the attributes (firebase)
352
364
  projectId = conversation.attributes.projectId;
353
365
  winston.verbose('getting projectId from attributes (back compatibility): '+ projectId);
354
366
  }
355
367
 
356
- winston.verbose('projectId: '+ projectId);
368
+ winston.debug('projectId: '+ projectId);
357
369
 
358
370
  if (!projectId) {
359
371
  return res.status(500).send({success: false, msg: "Error projectid is not presents in attributes " });
@@ -411,6 +423,11 @@ router.post('/', function (req, res) {
411
423
 
412
424
  winston.debug("req.body", JSON.stringify(req.body));
413
425
 
426
+ if (!syncJoinAndLeaveGroupEvent) {
427
+ winston.debug("syncJoinAndLeaveGroupEvent is disabled");
428
+ return res.status(200).send({success: true, msg: "syncJoinAndLeaveGroupEvent is disabled" });
429
+ }
430
+
414
431
  var data = req.body.data;
415
432
  //winston.debug("data",data);
416
433
 
@@ -476,6 +493,12 @@ router.post('/', function (req, res) {
476
493
 
477
494
  winston.debug("req.body", JSON.stringify(req.body));
478
495
 
496
+ if (!syncJoinAndLeaveGroupEvent) {
497
+ winston.debug("syncJoinAndLeaveGroupEvent is disabled");
498
+ return res.status(200).send({success: true, msg: "syncJoinAndLeaveGroupEvent is disabled" });
499
+ }
500
+
501
+
479
502
 
480
503
  var data = req.body.data;
481
504
  // winston.debug("data",data);
@@ -515,6 +538,11 @@ router.post('/', function (req, res) {
515
538
 
516
539
  winston.debug("req.body",req.body);
517
540
 
541
+ if (!allowReopenChat) {
542
+ winston.debug("allowReopenChat is disabled");
543
+ return res.status(200).send({success: true, msg: "allowReopenChat is disabled" });
544
+ }
545
+
518
546
 
519
547
  var conversation = req.body.data;
520
548
  // winston.debug("conversation",conversation);
@@ -694,6 +722,7 @@ else if (req.body.event_type == "presence-change") {
694
722
 
695
723
  project_user.presence = update
696
724
 
725
+
697
726
  project_user.save(function (err, savedProjectUser) {
698
727
  if (err) {
699
728
  winston.error('Error saving project_user ', err)
@@ -46,7 +46,7 @@ router.post('/createCustomToken', function (req, res) {
46
46
  ]
47
47
 
48
48
  const now = Math.round(new Date().getTime()/1000);
49
- console.log("now: ", now)
49
+ // console.log("now: ", now)
50
50
  const exp = now + 60 * 60 * 24 * 30;
51
51
 
52
52
  var payload = {
@@ -76,7 +76,7 @@ router.post('/createCustomToken', function (req, res) {
76
76
  "kid": "tiledesk-key", //"legacy-token-key",
77
77
  "tiledesk_api_roles": "user"
78
78
  }
79
- console.log("payload:\n", payload)
79
+ winston.debug("payload:\n", payload)
80
80
  var token = jwt.sign(
81
81
  payload,
82
82
  jwtSecret,
package/config/email.js CHANGED
@@ -3,6 +3,7 @@ module.exports = {
3
3
  'username': 'postmaster@mg.tiledesk.com',
4
4
  'from': 'Tiledesk Notification <postmaster@mg.tiledesk.com>',
5
5
  'bcc': 'tiledesknotification@frontiere21.it',
6
- 'replyToDomain': 'tickets.com',
7
6
  'baseUrl':'https://console.tiledesk.com/v2/dashboard',
7
+ 'replyEnabled' : false,
8
+ 'inboundDomain': 'tickets.tiledesk.com'
8
9
  };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ 'apiUrl':'http://localhost:3000',
3
+ };
@@ -22,7 +22,7 @@
22
22
  "CALLOUT_TITLE_PLACEHOLDER": "🖐 Need Help?",
23
23
  "CALLOUT_MSG_PLACEHOLDER": "Click here and start chatting with us!",
24
24
  "CUSTOMER_SATISFACTION": "Customer satisfaction",
25
- "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "your opinion on our customer service",
25
+ "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "Your opinion on our customer service",
26
26
  "DOWNLOAD_TRANSCRIPT": "Download transcript",
27
27
  "BACK": "Back",
28
28
  "YOUR_RATING": "your rating",
@@ -37,14 +37,20 @@
37
37
  "BUTTON_EDIT_PROFILE": "Update profile",
38
38
  "BUTTON_DOWNLOAD_TRANSCRIPT": "Download transcript",
39
39
  "RATE_CHAT": "Rate chat",
40
+
40
41
  "WELLCOME_TITLE": "Hi, welcome to Tiledesk 👋",
41
42
  "WELLCOME_MSG": "How can we help?",
42
43
  "WELLCOME": "Welcome",
44
+
45
+ "WELCOME_TITLE": "Hi, welcome to Tiledesk 👋",
46
+ "WELCOME_MSG": "How can we help?",
47
+ "WELCOME": "Welcome",
48
+
43
49
  "OPTIONS": "options",
44
50
  "SOUND_OFF": "sound off",
45
51
  "SOUND_ON": "sound on",
46
52
  "LOGOUT": "logout",
47
- "CLOSE": "close",
53
+ "CLOSE": "Close",
48
54
  "PREV_CONVERSATIONS": "Your conversations",
49
55
  "YOU": "You",
50
56
  "SHOW_ALL_CONV": "show all",
@@ -53,7 +59,22 @@
53
59
  "SEE_PREVIOUS": "see previous",
54
60
  "WAITING_TIME_FOUND": "The team typically replies in $reply_time",
55
61
  "WAITING_TIME_NOT_FOUND": "The team will reply as soon as possible",
56
- "CLOSED": "CLOSED"
62
+ "CLOSED": "Closed",
63
+
64
+ "INFO_SUPPORT_USER_ADDED_SUBJECT":"you",
65
+ "INFO_SUPPORT_USER_ADDED_YOU_VERB":"you have been added ",
66
+ "INFO_SUPPORT_USER_ADDED_COMPLEMENT":"joined",
67
+ "INFO_SUPPORT_USER_ADDED_VERB":"to chat",
68
+ "INFO_SUPPORT_CHAT_REOPENED":"Chat reopened",
69
+ "INFO_SUPPORT_CHAT_CLOSED":"Chat closed",
70
+
71
+ "TICKET_TAKING":"The request has been received and the assistance staff is dealing with it.\nTo add more comments, reply to this email.",
72
+
73
+ "LABEL_ERROR_FIELD_REQUIRED": "Required field",
74
+ "SENT_AN_ATTACHMENT": "sent an attachment",
75
+ "SENT_AN_IMAGE": "sent an image"
76
+
77
+
57
78
  }
58
79
  },
59
80
  {
@@ -79,7 +100,7 @@
79
100
  "CALLOUT_TITLE_PLACEHOLDER": "🖐 Bisogno di aiuto?",
80
101
  "CALLOUT_MSG_PLACEHOLDER": "Clicca qui e inizia a chattare con noi!",
81
102
  "CUSTOMER_SATISFACTION": "Valutazione servizio",
82
- "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "il tuo giudizio sul nostro servizio clienti",
103
+ "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "Il tuo giudizio sul nostro servizio clienti",
83
104
  "DOWNLOAD_TRANSCRIPT": "Scarica transcript",
84
105
  "BACK": "Indietro",
85
106
  "YOUR_RATING": "il tuo voto",
@@ -94,10 +115,16 @@
94
115
  "BUTTON_EDIT_PROFILE": "Modifica profilo",
95
116
  "BUTTON_DOWNLOAD_TRANSCRIPT": "Scarica transcript",
96
117
  "RATE_CHAT": "Valuta chat",
118
+
97
119
  "WELLCOME_TITLE": "Ciao, benvenuto su Tiledesk 👋",
98
120
  "WELLCOME_MSG": "Come possiamo aiutarti?",
99
- "OPTIONS": "opzioni",
100
121
  "WELLCOME": "Benvenuto",
122
+
123
+ "WELCOME_TITLE": "Ciao, benvenuto su Tiledesk 👋",
124
+ "WELCOME_MSG": "Come possiamo aiutarti?",
125
+ "WELCOME": "Benvenuto",
126
+
127
+ "OPTIONS": "opzioni",
101
128
  "SOUND_OFF": "suono spento",
102
129
  "SOUND_ON": "suono acceso",
103
130
  "LOGOUT": "disconnetti",
@@ -110,7 +137,20 @@
110
137
  "SEE_PREVIOUS": "vedi precedenti",
111
138
  "WAITING_TIME_FOUND": "Il team tipicamente risponde in $reply_time",
112
139
  "WAITING_TIME_NOT_FOUND": "Vi risponderemo appena possibile",
113
- "CLOSED": "CHIUSA"
140
+ "CLOSED": "Chiusa",
141
+
142
+ "INFO_SUPPORT_USER_ADDED_SUBJECT":"tu",
143
+ "INFO_SUPPORT_USER_ADDED_YOU_VERB":"sei stato aggiunto ",
144
+ "INFO_SUPPORT_USER_ADDED_COMPLEMENT":"si è unito",
145
+ "INFO_SUPPORT_USER_ADDED_VERB":"alla chat",
146
+ "INFO_SUPPORT_CHAT_REOPENED":"Chat riaperta",
147
+ "INFO_SUPPORT_CHAT_CLOSED":"Chat chiusa",
148
+
149
+ "TICKET_TAKING":"La richiesta è stata ricevuta e il personale di assistenza se ne sta occupando.\nPer aggiungere ulteriori commenti, rispondi a questa email.",
150
+
151
+ "LABEL_ERROR_FIELD_REQUIRED": "Campo richiesto",
152
+ "SENT_AN_ATTACHMENT": "ha inviato un allegato",
153
+ "SENT_AN_IMAGE":"ha inviato un'immagine"
114
154
  }
115
155
  },
116
156
  {
@@ -136,7 +176,7 @@
136
176
  "CALLOUT_TITLE_PLACEHOLDER": "🖐 Besoin d'aide?",
137
177
  "CALLOUT_MSG_PLACEHOLDER": "Cliquez ici et commencez à discuter avec nous!",
138
178
  "CUSTOMER_SATISFACTION": "Évaluation des services",
139
- "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "votre avis sur notre service client",
179
+ "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "Votre avis sur notre service client",
140
180
  "DOWNLOAD_TRANSCRIPT": "Télécharger la transcription",
141
181
  "BACK": "En arrière",
142
182
  "YOUR_RATING": "votre vote",
@@ -151,10 +191,16 @@
151
191
  "BUTTON_EDIT_PROFILE": "Modifier le profil",
152
192
  "BUTTON_DOWNLOAD_TRANSCRIPT": "Télécharger la transcription",
153
193
  "RATE_CHAT": "évaluer la conversation",
194
+
154
195
  "WELLCOME_TITLE": "Salut, bienvenue à Tiledesk 👋",
155
196
  "WELLCOME_MSG": "Comment pouvons-nous vous aider?",
156
- "OPTIONS": "options",
157
197
  "WELLCOME": "Bienvenue",
198
+
199
+ "WELCOME_TITLE": "Salut, bienvenue à Tiledesk 👋",
200
+ "WELCOME_MSG": "Comment pouvons-nous vous aider?",
201
+ "WELCOME": "Bienvenue",
202
+
203
+ "OPTIONS": "options",
158
204
  "SOUND_OFF": "Sound off",
159
205
  "SOUND_ON": "Sound on",
160
206
  "LOGOUT": "Connectez-out",
@@ -167,7 +213,20 @@
167
213
  "SEE_PREVIOUS": "voir les conversations précédentes",
168
214
  "WAITING_TIME_FOUND": "L'équipe répond généralement en $reply_time",
169
215
  "WAITING_TIME_NOT_FOUND": "Nous vous répondrons dans les plus brefs délais",
170
- "CLOSED": "FERMÉ"
216
+ "CLOSED": "Fermé",
217
+
218
+ "INFO_SUPPORT_USER_ADDED_SUBJECT":"toi",
219
+ "INFO_SUPPORT_USER_ADDED_YOU_VERB":"tu as été ajouté ",
220
+ "INFO_SUPPORT_USER_ADDED_COMPLEMENT":"rejoint",
221
+ "INFO_SUPPORT_USER_ADDED_VERB":"discuter",
222
+ "INFO_SUPPORT_CHAT_REOPENED":"Chat rouvert",
223
+ "INFO_SUPPORT_CHAT_CLOSED":"Chat fermé",
224
+
225
+ "TICKET_TAKING":"La demande a été reçue et le personnel d'assistance la traite.\nPour ajouter d'autres commentaires, répondez à cet e-mail.",
226
+
227
+ "LABEL_ERROR_FIELD_REQUIRED": "Champ obligatoire",
228
+ "SENT_AN_ATTACHMENT": "envoyé une pièce jointe",
229
+ "SENT_AN_IMAGE": "envoyé une image"
171
230
  }
172
231
  },
173
232
  {
@@ -208,9 +267,15 @@
208
267
  "BUTTON_EDIT_PROFILE":"Actualización del perfil",
209
268
  "BUTTON_DOWNLOAD_TRANSCRIPT":"Download transcript",
210
269
  "RATE_CHAT":"Califica el chat",
270
+
211
271
  "WELLCOME_TITLE":"Hola, bienvenido a tiledesk 👋",
212
272
  "WELLCOME_MSG":"¿Cómo podemos ayudar?",
213
273
  "WELLCOME":"¡Bienvenido!",
274
+
275
+ "WELCOME_TITLE":"Hola, bienvenido a tiledesk 👋",
276
+ "WELCOME_MSG":"¿Cómo podemos ayudar?",
277
+ "WELCOME":"¡Bienvenido!",
278
+
214
279
  "OPTIONS":"Opciones",
215
280
  "SOUND_OFF":"Sonido apagado",
216
281
  "SOUND_ON":"Sonido encendido",
@@ -224,7 +289,21 @@
224
289
  "SEE_PREVIOUS":"Ver anterior",
225
290
  "WAITING_TIME_FOUND":"El equipo típicamente responde en $reply_time",
226
291
  "WAITING_TIME_NOT_FOUND":"El equipo responderá lo antes posible.",
227
- "CLOSED":"CERRADO"
292
+ "CLOSED":"Cerrado",
293
+
294
+ "INFO_SUPPORT_USER_ADDED_SUBJECT":"usted",
295
+ "INFO_SUPPORT_USER_ADDED_YOU_VERB":"usted ha sido agregado ",
296
+ "INFO_SUPPORT_USER_ADDED_COMPLEMENT":"unido",
297
+ "INFO_SUPPORT_USER_ADDED_VERB":"para charlar",
298
+ "INFO_SUPPORT_CHAT_REOPENED":"Chat reabierto",
299
+ "INFO_SUPPORT_CHAT_CLOSED":"Chat cerrado",
300
+
301
+ "TICKET_TAKING":"La solicitud ha sido recibida y el personal de asistencia está tratando con ella. \nPara agregar más comentarios, responda a este correo electrónico.",
302
+
303
+ "LABEL_ERROR_FIELD_REQUIRED": "Campo obligatorio",
304
+ "SENT_AN_ATTACHMENT": "envió un archivo adjunto",
305
+ "SENT_AN_IMAGE": "envió una imagen"
306
+
228
307
  }
229
308
  },
230
309
  {
@@ -265,14 +344,20 @@
265
344
  "BUTTON_EDIT_PROFILE":"Profil aktualisieren",
266
345
  "BUTTON_DOWNLOAD_TRANSCRIPT":"Download transcript",
267
346
  "RATE_CHAT":"Chat bewerten",
347
+
268
348
  "WELLCOME_TITLE":"Hallo, willkommen in Tiledesk 👋",
269
349
  "WELLCOME_MSG":"Wie können wir helfen?",
270
350
  "WELLCOME":"Herzlich willkommen",
351
+
352
+ "WELCOME_TITLE":"Hallo, willkommen in Tiledesk 👋",
353
+ "WELCOME_MSG":"Wie können wir helfen?",
354
+ "WELCOME":"Herzlich willkommen",
355
+
271
356
  "OPTIONS":"Optionen",
272
357
  "SOUND_OFF":"Ton aus",
273
358
  "SOUND_ON":"Ton an",
274
359
  "LOGOUT":"Ausloggen",
275
- "CLOSE":"schließen",
360
+ "CLOSE":"Schließen",
276
361
  "PREV_CONVERSATIONS":"Ihre Gespräche",
277
362
  "YOU":"Du",
278
363
  "SHOW_ALL_CONV":"zeige alles",
@@ -281,7 +366,20 @@
281
366
  "SEE_PREVIOUS":"siehe vorher",
282
367
  "WAITING_TIME_FOUND":"Das Team antwortet normalerweise in $reply_time",
283
368
  "WAITING_TIME_NOT_FOUND":"Das Team wird so schnell wie möglich antworten",
284
- "CLOSED":"GESCHLOSSEN"
369
+ "CLOSED":"Geschlossen",
370
+
371
+ "INFO_SUPPORT_USER_ADDED_SUBJECT": "Sie",
372
+ "INFO_SUPPORT_USER_ADDED_YOU_VERB": "Sie wurden hinzugefügt ",
373
+ "INFO_SUPPORT_USER_ADDED_COMPLEMENT": "beigetreten",
374
+ "INFO_SUPPORT_USER_ADDED_VERB": "zum Chatten",
375
+ "INFO_SUPPORT_CHAT_REOPENED": "Chat wieder geöffnet",
376
+ "INFO_SUPPORT_CHAT_CLOSED": "Chat geschlossen",
377
+
378
+ "TICKET_TAKING":"Die Anfrage ist eingegangen und wird vom Hilfspersonal bearbeitet.\nUm weitere Kommentare hinzuzufügen, antworten Sie auf diese E-Mail.",
379
+
380
+ "LABEL_ERROR_FIELD_REQUIRED": "Pflichtfeld",
381
+ "SENT_AN_ATTACHMENT": "Anhang gesendet",
382
+ "SENT_AN_IMAGE": "ein Bild gesendet"
285
383
  }
286
384
  },
287
385
  {
@@ -322,9 +420,15 @@
322
420
  "BUTTON_EDIT_PROFILE":"Atualizar perfil",
323
421
  "BUTTON_DOWNLOAD_TRANSCRIPT":"Download transcript",
324
422
  "RATE_CHAT":"Classificar conversa",
423
+
325
424
  "WELLCOME_TITLE":"Olá, seja bem-vindo ao Tiledesk 👋",
326
425
  "WELLCOME_MSG":"Como podemos ajudar?",
327
426
  "WELLCOME":"Bem-vinda",
427
+
428
+ "WELCOME_TITLE":"Olá, seja bem-vindo ao Tiledesk 👋",
429
+ "WELCOME_MSG":"Como podemos ajudar?",
430
+ "WELCOME":"Bem-vinda",
431
+
328
432
  "OPTIONS":"Opções",
329
433
  "SOUND_OFF":"som desligado",
330
434
  "SOUND_ON":"som ligado",
@@ -338,7 +442,20 @@
338
442
  "SEE_PREVIOUS":"ver anterior",
339
443
  "WAITING_TIME_FOUND":"A equipe normalmente responde em $reply_time",
340
444
  "WAITING_TIME_NOT_FOUND":"A equipe responderá o mais breve possível",
341
- "CLOSED":"FECHADO"
445
+ "CLOSED":"Fechado",
446
+
447
+ "INFO_SUPPORT_USER_ADDED_SUBJECT": "você",
448
+ "INFO_SUPPORT_USER_ADDED_YOU_VERB": "você foi adicionado ",
449
+ "INFO_SUPPORT_USER_ADDED_COMPLEMENT": "aderiu",
450
+ "INFO_SUPPORT_USER_ADDED_VERB": "para conversar",
451
+ "INFO_SUPPORT_CHAT_REOPENED": "Chat reaberto",
452
+ "INFO_SUPPORT_CHAT_CLOSED": "Bate-papo fechado",
453
+
454
+ "TICKET_TAKING":"A solicitação foi recebida e a equipe de assistência está tratando dela. \nPara adicionar mais comentários, responda a este e-mail.",
455
+
456
+ "LABEL_ERROR_FIELD_REQUIRED": "Campo obrigatório",
457
+ "SENT_AN_ATTACHMENT": "enviou um anexo",
458
+ "SENT_AN_IMAGE": "enviou uma imagem"
342
459
  }
343
460
  },
344
461
  {
@@ -379,14 +496,20 @@
379
496
  "BUTTON_EDIT_PROFILE":"Обновить профиль",
380
497
  "BUTTON_DOWNLOAD_TRANSCRIPT":"Download transcript",
381
498
  "RATE_CHAT":"Оценить чат",
499
+
382
500
  "WELLCOME_TITLE":"Привет, добро пожаловать в Tiledesk 👋",
383
501
  "WELLCOME_MSG":"Как мы можем помочь?",
384
502
  "WELLCOME":"желанный",
503
+
504
+ "WELCOME_TITLE":"Привет, добро пожаловать в Tiledesk 👋",
505
+ "WELCOME_MSG":"Как мы можем помочь?",
506
+ "WELCOME":"желанный",
507
+
385
508
  "OPTIONS":"опции",
386
509
  "SOUND_OFF":"звук выключен",
387
510
  "SOUND_ON":"звучать на",
388
511
  "LOGOUT":"выйти",
389
- "CLOSE":"закрывать",
512
+ "CLOSE":"Закрывать",
390
513
  "PREV_CONVERSATIONS":"Ваши разговоры",
391
514
  "YOU":"Вы",
392
515
  "SHOW_ALL_CONV":"показать все",
@@ -395,7 +518,19 @@
395
518
  "SEE_PREVIOUS":"смотри предыдущий",
396
519
  "WAITING_TIME_FOUND":"Команда обычно отвечает в $reply_time",
397
520
  "WAITING_TIME_NOT_FOUND":"Команда ответит как можно скорее",
398
- "CLOSED":"ЗАКРЫТО"
521
+ "CLOSED":"Закрыто",
522
+ "INFO_SUPPORT_USER_ADDED_SUBJECT": "вы",
523
+ "INFO_SUPPORT_USER_ADDED_YOU_VERB": "вы добавлены ",
524
+ "INFO_SUPPORT_USER_ADDED_COMPLEMENT": "присоединился",
525
+ "INFO_SUPPORT_USER_ADDED_VERB": "в чат",
526
+ "INFO_SUPPORT_CHAT_REOPENED": "Чат возобновлен",
527
+ "INFO_SUPPORT_CHAT_CLOSED": "Чат закрыт",
528
+
529
+ "TICKET_TAKING":"Запрос был получен, и обслуживающий персонал занимается им. \nЧтобы добавить больше комментариев, ответьте на это письмо.",
530
+
531
+ "LABEL_ERROR_FIELD_REQUIRED": "Обязательное поле",
532
+ "SENT_AN_ATTACHMENT": "отправлено вложение",
533
+ "SENT_AN_IMAGE": "отправил изображение"
399
534
  }
400
535
  },
401
536
  {
@@ -436,9 +571,15 @@
436
571
  "BUTTON_EDIT_PROFILE":"Profili güncelle",
437
572
  "BUTTON_DOWNLOAD_TRANSCRIPT":"Download transcript",
438
573
  "RATE_CHAT":"Sohbeti derecelendir",
574
+
439
575
  "WELLCOME_TITLE":"Merhaba Tiledesk’e hoş geldiniz. 👋",
440
576
  "WELLCOME_MSG":"Size nasıl yardımcı olabiliriz?",
441
577
  "WELLCOME":"Hoş geldiniz.",
578
+
579
+ "WELCOME_TITLE":"Merhaba Tiledesk’e hoş geldiniz. 👋",
580
+ "WELCOME_MSG":"Size nasıl yardımcı olabiliriz?",
581
+ "WELCOME":"Hoş geldiniz.",
582
+
442
583
  "OPTIONS":"Seçenekler",
443
584
  "SOUND_OFF":"Ses kapalı",
444
585
  "SOUND_ON":"Ses açık",
@@ -452,7 +593,20 @@
452
593
  "SEE_PREVIOUS":"Öncekine bak",
453
594
  "WAITING_TIME_FOUND":"Ekip genellikle …… içerisinde cevaplar $reply_time",
454
595
  "WAITING_TIME_NOT_FOUND":"Ekip en kısa süre içerisinde cevap verecektir.",
455
- "CLOSED":"KAPALI"
596
+ "CLOSED":"Kapali",
597
+
598
+ "INFO_SUPPORT_USER_ADDED_SUBJECT": "siz",
599
+ "INFO_SUPPORT_USER_ADDED_YOU_VERB": "eklendiniz ",
600
+ "INFO_SUPPORT_USER_ADDED_COMPLEMENT": "katıldı",
601
+ "INFO_SUPPORT_USER_ADDED_VERB": "sohbet etmek",
602
+ "INFO_SUPPORT_CHAT_REOPENED": "Sohbet yeniden açıldı",
603
+ "INFO_SUPPORT_CHAT_CLOSED": "Sohbet kapatıldı",
604
+
605
+ "TICKET_TAKING":"Talep alındı ve yardım ekibi bununla ilgileniyor.\nDaha fazla yorum eklemek için bu e-postayı yanıtlayın.",
606
+
607
+ "LABEL_ERROR_FIELD_REQUIRED": "Gerekli alan",
608
+ "SENT_AN_ATTACHMENT": "bir ek gönderdi",
609
+ "SENT_AN_IMAGE": "bir resim gönderdi"
456
610
  }
457
611
  }
458
612
  ]
@@ -61,6 +61,11 @@ function populateMessageWithRequest(message, eventPrefix) {
61
61
  populate('participatingAgents').
62
62
  populate({path:'requester',populate:{path:'id_user'}}).
63
63
  lean().
64
+ //perche lean?
65
+ // TODO availableAgentsCount nn c'è per il lean problema trigger
66
+ // request.department._id DA CORREGGERE ANCHE PER REQUEST.CREATE
67
+ // request.department.hasBot
68
+ // request.isOpen
64
69
  cache(cacheUtil.defaultTTL, message.id_project+":requests:request_id:"+message.recipient).
65
70
  exec(function (err, request) {
66
71
 
@@ -88,6 +93,7 @@ function populateMessageWithRequest(message, eventPrefix) {
88
93
  winston.debug("message.emit",messageJson );
89
94
  messageEvent.emit(eventPrefix,messageJson );
90
95
 
96
+ //se a req.first_text toglio ritorni a capo è sempre diverso da msg.txt
91
97
  if (message.text === request.first_text){
92
98
  messageEvent.emit(eventPrefix+'.first', messageJson );
93
99
  }
@@ -98,6 +104,17 @@ function populateMessageWithRequest(message, eventPrefix) {
98
104
  messageEvent.emit(eventPrefix+'.from.requester', messageJson );
99
105
  }
100
106
 
107
+ // olumn":21,"file":"/app/node_modules/mongoose/lib/model.js","function":null,"line":4869,"method":null,"native":false},{"column":11,"file":"/app/node_modules/mongoose/lib/query.js","function":"_hooks.execPost","line":4391,"method":"execPost","native":false},{"column":16,"file":"/app/node_modules/kareem/index.js","function":null,"line":135,"method":null,"native":false},{"column":9,"file":"internal/process/task_queues.js","function":"processTicksAndRejections","line":79,"method":null,"native":false}]}
108
+ // 2021-01-26T10:30:16.045281+00:00 app[web.1]: error: uncaughtException: Cannot read property 'name' of undefined
109
+ // 2021-01-26T10:30:16.045283+00:00 app[web.1]: TypeError: Cannot read property 'name' of undefined
110
+ // 2021-01-26T10:30:16.045284+00:00 app[web.1]: at /app/event/messageEvent.js:101:80
111
+ // 2021-01-26T10:30:16.045284+00:00 app[web.1]: at /app/node_modules/mongoose/lib/model.js:4846:16
112
+ // 2021-01-26T10:30:16.045285+00:00 app[web.1]: at /app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:24:16
113
+ // 2021-01-26T10:30:16.045285+00:00 app[web.1]: at /app/node_modules/mongoose/lib/model.js:4869:21
114
+ // 2021-01-26T10:30:16.045286+00:00 app[web.1]: at _hooks.execPost (/app/node_modules/mongoose/lib/query.js:4391:11)
115
+ // 2021-01-26T10:30:16.045286+00:00 app[web.1]: at /app/node_modules/kareem/index.js:135:16
116
+ // 2021-01-26T10:30:16.045287+00:00 app[web.1]:
117
+
101
118
  message2Event.emit(eventPrefix+'.request.channel.' + request.channel.name, messageJson );
102
119
  message2Event.emit(eventPrefix+'.request.channelOutbound.' + request.channelOutbound.name, messageJson );
103
120
  message2Event.emit(eventPrefix+'.channel.' + message.channel.name, messageJson );
@@ -129,7 +146,7 @@ function populateMessageWithRequest(message, eventPrefix) {
129
146
  }
130
147
 
131
148
  } else {
132
- winston.warn("request is undefined in messageEvent. Is it a direct message ?" );
149
+ winston.debug("request is undefined in messageEvent. Is it a direct or group message ?" );
133
150
  messageEvent.emit(eventPrefix,messageJson );
134
151
  message2Event.emit(eventPrefix+'.channel.' + message.channel.name, messageJson );
135
152
  }
@@ -63,7 +63,7 @@ module.exports = function(passport) {
63
63
 
64
64
  var opts = {
65
65
  // jwtFromRequest: ExtractJwt.fromAuthHeader(),
66
- jwtFromRequest: ExtractJwt.fromAuthHeaderWithScheme("jwt"),
66
+ jwtFromRequest:ExtractJwt.fromExtractors([ExtractJwt.fromAuthHeaderWithScheme("jwt"), ExtractJwt.fromUrlQueryParameter('secret_token')]),
67
67
  //this will help you to pass request body to passport
68
68
  passReqToCallback: true, //https://stackoverflow.com/questions/55163015/how-to-bind-or-pass-req-parameter-to-passport-js-jwt-strategy
69
69
  // secretOrKey: configSecret,
@@ -341,9 +341,15 @@ module.exports = function(passport) {
341
341
 
342
342
 
343
343
  passport.use(new BasicStrategy(function(userid, password, done) {
344
-
345
- User.findOne({ email: userid, status: 100}, 'email firstname lastname password emailverified id')
346
- .cache(cacheUtil.defaultTTL, "users:email:"+userid)
344
+
345
+ winston.debug("BasicStrategy: " + userid);
346
+
347
+
348
+ var email = userid.toLowerCase();
349
+ winston.debug("email lowercase: " + email);
350
+
351
+ User.findOne({ email: email, status: 100}, 'email firstname lastname password emailverified id')
352
+ .cache(cacheUtil.defaultTTL, "users:email:"+email)
347
353
  .exec(function (err, user) {
348
354
 
349
355
  if (err) {
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ CHAT_ACTION_MESSAGE : {
3
+ AGENT : "\\agent",
4
+ CLOSE : "\\close",
5
+ }
6
+ }
7
+
@@ -2,6 +2,7 @@ var mongoose = require('mongoose');
2
2
  var Schema = mongoose.Schema;
3
3
  var routingConstants = require('../models/routingConstants');
4
4
  var winston = require('../config/winston');
5
+ var TagSchema = require("../models/tag");
5
6
 
6
7
  var DepartmentSchema = new Schema({
7
8
  id_bot: {
@@ -46,6 +47,7 @@ var DepartmentSchema = new Schema({
46
47
  index: true
47
48
  // required: true
48
49
  },
50
+ tags: [TagSchema],
49
51
  status: {
50
52
  type: Number,
51
53
  default: 1,
@@ -71,6 +73,7 @@ DepartmentSchema.virtual('bot', {
71
73
  });
72
74
 
73
75
  DepartmentSchema.virtual('hasBot').get(function () {
76
+ // winston.debug("department hasBot virtual called");
74
77
  if (this.id_bot!=undefined) {
75
78
  return true;
76
79
  }else {
package/models/faq.js CHANGED
@@ -93,8 +93,14 @@ FaqSchema.index({ id_project: 1, id_faq_kb: 1, question: 1 });
93
93
  // https://docs.mongodb.com/manual/core/index-text/
94
94
  // https://docs.mongodb.com/manual/tutorial/specify-language-for-text-index/
95
95
  // https://docs.mongodb.com/manual/reference/text-search-languages/#text-search-languages
96
- FaqSchema.index({question: 'text', answer: 'text'},
97
- {"name":"faq_fulltext","default_language": defaultFullTextLanguage,"language_override": "language", weights: {question: 10,answer: 1}}); // schema level
96
+
97
+
98
+ FaqSchema.index({question: 'text'},
99
+ {"name":"faq_fulltext","default_language": defaultFullTextLanguage,"language_override": "language"}); // schema level
100
+
101
+ // FaqSchema.index({question: 'text', answer: 'text'},
102
+ // {"name":"faq_fulltext","default_language": defaultFullTextLanguage,"language_override": "language", weights: {question: 10,answer: 1}}); // schema level
103
+
98
104
 
99
105
  FaqSchema.index({ id_project: 1, id_faq_kb: 1, intent_display_name: 1 }, { unique: true });
100
106
 
package/models/faq_kb.js CHANGED
@@ -53,6 +53,12 @@ var Faq_kbSchema = new Schema({
53
53
  default: uuidv4(),
54
54
  select: false
55
55
  },
56
+ language: {
57
+ type: String,
58
+ required: false,
59
+ default: 'en'
60
+ // index: true
61
+ },
56
62
  attributes: {
57
63
  type: Object,
58
64
  },
package/models/message.js CHANGED
@@ -6,6 +6,12 @@ var MessageConstants = require('../models/messageConstants');
6
6
  var defaultFullTextLanguage = process.env.DEFAULT_FULLTEXT_INDEX_LANGUAGE || "none";
7
7
 
8
8
  var MessageSchema = new Schema({
9
+ // messageId: {
10
+ // type: String,
11
+ // required: true,
12
+ // // unique: true???
13
+ // index: true
14
+ // },
9
15
  sender: {
10
16
  type: String,
11
17
  required: true,
@@ -21,10 +27,10 @@ var MessageSchema = new Schema({
21
27
  required: true,
22
28
  index: true
23
29
  },
24
- // recipientFullname: {
25
- // type: String,
26
- // required: false
27
- // },
30
+ recipientFullname: {
31
+ type: String,
32
+ required: false
33
+ },
28
34
  type: {
29
35
  type: String,
30
36
  required: true,