@tiledesk/tiledesk-server 2.2.31 → 2.2.34

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 CHANGED
@@ -1,6 +1,14 @@
1
1
 
2
2
 
3
3
 
4
+ # 2.2.33 -> PROD
5
+ - Request fulltext sort fix
6
+
7
+ # 2.2.32
8
+ - Added Arabic language for the widget
9
+ - Updated dependencies with npm update
10
+ - Filter requests by lead email
11
+
4
12
  # 2.2.31 (compatible with: Dashboard 2.2.37, Widget 5.0.25)
5
13
  - Fix email template reading from project.
6
14
  - Added transcript webpage for users without system messages
@@ -8,10 +16,10 @@
8
16
  - Fix ip address resolver
9
17
  - Exclude poweredBy field from widget endpoint
10
18
  - Bugfix when a conversation has a first_text with \agent
11
- - Added rasa chatbot chatbot type
19
+ - Added rasa chatbot chatbot type
12
20
  - Added visitor email and fullname in the fulltext index
13
21
 
14
- # 2.2.30 -> PROD
22
+ # 2.2.30
15
23
  - Log fix
16
24
 
17
25
  # 2.2.29
@@ -696,9 +696,7 @@
696
696
  },
697
697
 
698
698
 
699
- {
700
- "default":false,
701
- "_id":"6245d677f3058400357d1091",
699
+ {
702
700
  "lang":"SR",
703
701
  "data":{
704
702
  "LABEL_PLACEHOLDER":"откуцај своју поруку..",
@@ -776,7 +774,88 @@
776
774
  "LABEL_PRECHAT_ACCEPT_TERMS_PRIVACY":"Слазем се",
777
775
  "PRECHAT_REQUIRED_ERROR":"Ово поље је захтевано"
778
776
  }
779
- }
777
+ },
778
+
779
+
780
+ {
781
+ "lang":"AR",
782
+ "data": {
783
+ "LABEL_PLACEHOLDER": "اكتب رسالتك ..",
784
+ "LABEL_START_NW_CONV": "محادثة جديدة",
785
+ "LABEL_FIRST_MSG": "صِف مشكلتك بعد قليل ، وسيتواصل معك أحد الوكلاء.",
786
+ "LABEL_FIRST_MSG_NO_AGENTS": "🤔 جميع المشغلين غير متصلين في الوقت الحالي. يمكنك على أي حال وصف مشكلتك. سيتم تعيينه لفريق الدعم الذي سيعود إليك في أقرب وقت ممكن.",
787
+ "LABEL_FIRST_MSG_OPERATING_HOURS_CLOSED": "🤔 مكاتبنا مغلقة. يمكنك على أي حال وصف مشكلتك. سيتم تعيينه لفريق الدعم الذي سيعود إليك في أقرب وقت ممكن.",
788
+ "LABEL_SELECT_TOPIC": "اختر عنوانا",
789
+ "LABEL_COMPLETE_FORM": "أكمل النموذج لبدء محادثة مع الوكيل المتاح التالي.",
790
+ "LABEL_FIELD_NAME": "اسم",
791
+ "LABEL_ERROR_FIELD_NAME": "حقل مطلوب (بحد أدنى 5 أحرف).",
792
+ "LABEL_FIELD_EMAIL": "البريد الإلكتروني",
793
+ "LABEL_ERROR_FIELD_EMAIL": "أدخل عنوان بريد إلكتروني صالح.",
794
+ "LABEL_WRITING": "يكتب...",
795
+ "AGENT_NOT_AVAILABLE": " غير متصل على الانترنت",
796
+ "AGENT_AVAILABLE": " متصل",
797
+ "GUEST_LABEL": "زائر",
798
+ "ALL_AGENTS_OFFLINE_LABEL": "جميع المشغلين غير متصلون في الوقت الحالي",
799
+ "LABEL_LOADING": "جار التحميل...",
800
+ "CALLOUT_TITLE_PLACEHOLDER": "🖐 بحاجة الى مساعدة؟",
801
+ "CALLOUT_MSG_PLACEHOLDER": "انقر هنا وابدأ الدردشة معنا!",
802
+ "CUSTOMER_SATISFACTION": "رضا العملاء",
803
+ "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "رأيك في خدمة العملاء لدينا",
804
+ "DOWNLOAD_TRANSCRIPT": "تنزيل النص",
805
+ "BACK": "خلف",
806
+ "YOUR_RATING": "تقييمك",
807
+ "WRITE_YOUR_OPINION": "أكتب رأيك ... (اختياري)",
808
+ "SUBMIT": "يُقدِّم",
809
+ "THANK_YOU_FOR_YOUR_EVALUATION": "شكرا لتقييمك",
810
+ "YOUR_RATING_HAS_BEEN_RECEIVED": "لقد تم استلام تقييمك",
811
+ "ALERT_LEAVE_CHAT": "هل تريد مغادرة الدردشة؟",
812
+ "YES": "نعم",
813
+ "NO": "لا",
814
+ "BUTTON_CLOSE_TO_ICON": "تصغير الدردشة",
815
+ "BUTTON_EDIT_PROFILE": "تحديث الملف",
816
+ "BUTTON_DOWNLOAD_TRANSCRIPT": "تنزيل النص",
817
+ "RATE_CHAT": "معدل الدردشة",
818
+ "WELLCOME_TITLE": "مرحبًا ، مرحبًا بك في Tiledesk 👋",
819
+ "WELLCOME_MSG": "كيف يمكن أن نساعد؟",
820
+ "WELLCOME": "أهلا وسهلا",
821
+ "WELCOME_TITLE": "مرحبًا ، مرحبًا بك في Tiledesk 👋",
822
+ "WELCOME_MSG": "كيف يمكن أن نساعد؟",
823
+ "WELCOME": "أهلا وسهلا",
824
+ "OPTIONS": "والخيارات",
825
+ "SOUND_OFF": "الصوت مقفل",
826
+ "SOUND_ON": "الصوت مفعل",
827
+ "LOGOUT": "تسجيل خروج",
828
+ "CLOSE": "قريب",
829
+ "PREV_CONVERSATIONS": "محادثاتك",
830
+ "YOU": "أنت",
831
+ "SHOW_ALL_CONV": "عرض الكل",
832
+ "START_A_CONVERSATION": "بدء محادثة",
833
+ "NO_CONVERSATION": "لا محادثة",
834
+ "SEE_PREVIOUS": "انظر السابق",
835
+ "WAITING_TIME_FOUND": "يرد الفريق عادةً بـ $reply_time",
836
+ "WAITING_TIME_NOT_FOUND": "سيقوم الفريق بالرد في أقرب وقت ممكن",
837
+ "CLOSED": "مغلق",
838
+ "INFO_SUPPORT_USER_ADDED_SUBJECT": "أنت",
839
+ "INFO_SUPPORT_USER_ADDED_YOU_VERB": "لقد تم اضافتك ",
840
+ "INFO_SUPPORT_USER_ADDED_COMPLEMENT": "المحادثة",
841
+ "INFO_SUPPORT_USER_ADDED_VERB": "انضم",
842
+ "INFO_SUPPORT_CHAT_REOPENED": "تمت إعادة فتح الدردشة",
843
+ "INFO_SUPPORT_CHAT_CLOSED": "الدردشة مغلقة",
844
+ "TICKET_TAKING": "تم استلام الطلب ويقوم طاقم المساعدة بالتعامل معه.\nلإضافة المزيد من التعليقات ، قم بالرد على هذا البريد الإلكتروني.",
845
+ "LABEL_ERROR_FIELD_REQUIRED": "يتطلب حقلا",
846
+ "SENT_AN_ATTACHMENT": "أرسل مرفقًا",
847
+ "SENT_AN_IMAGE": "أرسل صورة",
848
+ "LABEL_PRECHAT_USER_FULLNAME": "الاسم الكامل",
849
+ "LABEL_PRECHAT_USER_EMAIL": "البريد الإلكتروني",
850
+ "LABEL_PRECHAT_USER_EMAIL_ERROR": "عنوان البريد الإلكتروني غير صالح",
851
+ "LABEL_PRECHAT_USER_PHONE": "هاتف",
852
+ "LABEL_PRECHAT_USER_PHONE_ERROR": "الهاتف مطلوب",
853
+ "LABEL_PRECHAT_FIRST_MESSAGE": "رسالتك لفريق الدعم",
854
+ "LABEL_PRECHAT_STATIC_TERMS_PRIVACY": "قبل متابعة المحادثة ، يرجى الموافقة على سياسة الخصوصية الخاصة بشروط <a href='https://tiledesk.com/termsofservice/' target='_blank'></a> و <a href='https://tiledesk.com/privacy.html' target='_blank'></a>",
855
+ "LABEL_PRECHAT_ACCEPT_TERMS_PRIVACY": "أنا موافق",
856
+ "PRECHAT_REQUIRED_ERROR": "هذه الخانة مطلوبه"
857
+ }
858
+ }
780
859
 
781
860
  ]
782
861
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-server",
3
3
  "description": "The Tiledesk server module",
4
- "version": "2.2.31",
4
+ "version": "2.2.34",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -49,46 +49,46 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@tiledesk/tiledesk-chat21-app": "^1.1.4",
52
- "@tiledesk/tiledesk-chatbot-util": "^0.8.23",
52
+ "@tiledesk/tiledesk-chatbot-util": "^0.8.33",
53
53
  "app-root-path": "^3.0.0",
54
54
  "bcrypt-nodejs": "0.0.3",
55
- "body-parser": "^1.19.0",
56
- "cookie-parser": "~1.4.5",
55
+ "body-parser": "^1.20.0",
56
+ "cookie-parser": "^1.4.6",
57
57
  "cors": "^2.8.5",
58
58
  "csv-express": "^1.2.2",
59
- "debug": "^4.3.2",
59
+ "debug": "^4.3.4",
60
60
  "dotenv": "^8.6.0",
61
- "email-templates": "^8.0.8",
61
+ "email-templates": "^8.1.0",
62
62
  "eventemitter2": "^6.4.4",
63
- "express": "~4.17.1",
63
+ "express": "^4.17.3",
64
64
  "express-ipfilter": "^1.2.0",
65
- "express-session": "^1.17.2",
66
- "express-validator": "^6.12.1",
65
+ "express-session": "^1.17.3",
66
+ "express-validator": "^6.14.2",
67
67
  "fast-csv": "^4.3.6",
68
- "geoip-lite": "^1.4.2",
68
+ "geoip-lite": "^1.4.5",
69
69
  "handlebars": "^4.7.7",
70
- "html-entities": "^2.3.2",
70
+ "html-entities": "^2.3.3",
71
71
  "http": "0.0.0",
72
- "immutable": "^4.0.0-rc.14",
72
+ "immutable": "^4.1.0",
73
73
  "jade": "~1.11.0",
74
74
  "jsonwebtoken": "^8.5.1",
75
75
  "lodash": "^4.17.21",
76
76
  "marked": "^3.0.4",
77
- "maskdata": "^1.1.6",
77
+ "maskdata": "^1.1.10",
78
78
  "migrate-mongoose": "^4.0.0",
79
79
  "mix-hash": "^1.0.7",
80
- "moment": "^2.29.1",
80
+ "moment": "^2.29.3",
81
81
  "moment-timezone": "^0.5.33",
82
- "mongoose": "^5.13.12",
82
+ "mongoose": "^5.13.14",
83
83
  "mongoose-auto-increment": "^5.0.1",
84
84
  "mongoose-sequence": "^5.3.1",
85
85
  "morgan": "^1.10.0",
86
- "multer": "^1.4.3",
86
+ "multer": "^1.4.4",
87
87
  "multer-gridfs-storage": "^4.2.0",
88
- "nanoid": "^3.1.25",
88
+ "nanoid": "^3.3.4",
89
89
  "node-rsa": "^1.1.1",
90
- "node-schedule": "^2.0.0",
91
- "nodemailer": "^6.6.3",
90
+ "node-schedule": "^2.1.0",
91
+ "nodemailer": "^6.7.5",
92
92
  "passport": "^0.4.1",
93
93
  "passport-http": "^0.3.0",
94
94
  "passport-jwt": "^4.0.0",
@@ -100,18 +100,18 @@
100
100
  "sharp": "^0.27.2",
101
101
  "uniqid": "^5.4.0",
102
102
  "uuid": "^3.3.3",
103
- "winston": "^3.3.3",
103
+ "winston": "^3.7.2",
104
104
  "winston-mongodb": "^5.0.7",
105
- "ws": "^7.5.4"
105
+ "ws": "^7.5.8"
106
106
  },
107
107
  "devDependencies": {
108
- "chai": "^4.3.4",
108
+ "chai": "^4.3.6",
109
109
  "chai-http": "^4.3.0",
110
110
  "chai-string": "^1.5.0",
111
- "loadtest": "^5.1.2",
111
+ "loadtest": "^5.2.0",
112
112
  "mocha": "^8.4.0",
113
113
  "mongodb-runner": "4.8.3",
114
- "nodemon": "^2.0.12",
114
+ "nodemon": "^2.0.16",
115
115
  "sinon": "^9.2.4",
116
116
  "sinon-mongoose": "^2.3.0"
117
117
  },
@@ -49,4 +49,25 @@ var winston = require('../config/winston');
49
49
  });
50
50
 
51
51
 
52
+ router.get('/:requestid/messages-user.html', function(req, res) {
53
+
54
+ winston.debug(req.params);
55
+ winston.debug("here");
56
+ return Message.find({"recipient": req.params.requestid}).sort({createdAt: 'asc'}).exec(function(err, messages) {
57
+ if (err) {
58
+ return res.status(500).send({success: false, msg: 'Error getting object.'});
59
+ }
60
+
61
+ var messages = messages.filter(m => m.sender != "system" );
62
+
63
+ //skip info message
64
+ if(!messages){
65
+ return res.status(404).send({success: false, msg: 'Object not found.'});
66
+ }
67
+
68
+ return res.render('messages', { title: 'Tiledesk', messages: messages});
69
+ });
70
+
71
+ });
72
+
52
73
  module.exports = router;
package/routes/request.js CHANGED
@@ -807,6 +807,11 @@ router.get('/', function (req, res, next) {
807
807
  winston.debug('REQUEST ROUTE - QUERY snap_lead_lead_id', query.snap_lead_lead_id);
808
808
  }
809
809
 
810
+ if (req.query.snap_lead_email) {
811
+ query["snapshot.lead.email"] = req.query.snap_lead_email;
812
+ winston.debug('REQUEST ROUTE - QUERY snap_lead_email', query.snap_lead_email);
813
+ }
814
+
810
815
  if (req.query.channel) {
811
816
  query["channel.name"] = req.query.channel
812
817
  winston.debug('REQUEST ROUTE - QUERY channel', query.channel);
@@ -832,11 +837,21 @@ router.get('/', function (req, res, next) {
832
837
 
833
838
  winston.verbose('REQUEST ROUTE - REQUEST FIND ', query);
834
839
 
840
+ var projection = undefined;
841
+
842
+ if (req.query.full_text) {
843
+ winston.info('fulltext projection');
844
+
845
+ projection = {score: { $meta: "textScore" } };
846
+ }
835
847
  // requestcachefarequi populaterequired
836
- var q1 = Request.find(query).
848
+ var q1 = Request.find(query, projection).
837
849
  skip(skip).limit(limit);
838
850
 
839
-
851
+
852
+
853
+
854
+
840
855
  winston.debug('REQUEST ROUTE no_populate:' + req.query.no_populate);
841
856
 
842
857
  if (req.query.no_populate != "true" && req.query.no_populate != true) {
@@ -857,7 +872,13 @@ router.get('/', function (req, res, next) {
857
872
  // // q1.select({ "snapshot": 1});
858
873
  // }
859
874
 
860
- q1.sort(sortQuery);
875
+ if (req.query.full_text) {
876
+ winston.info('fulltext sort');
877
+ q1.sort( { score: { $meta: "textScore" } } ) //https://docs.mongodb.com/manual/reference/operator/query/text/#sort-by-text-search-score
878
+ } else {
879
+ q1.sort(sortQuery);
880
+ }
881
+
861
882
 
862
883
  // winston.info('q1',q1);
863
884
 
@@ -1003,6 +1024,8 @@ router.get('/csv', function (req, res, next) {
1003
1024
 
1004
1025
  winston.debug("sort query", sortQuery);
1005
1026
 
1027
+
1028
+
1006
1029
  winston.debug('REQUEST ROUTE - REQUEST FIND ', query)
1007
1030
  return Request.find(query, '-transcript -status -__v').
1008
1031
  skip(skip).limit(limit).
@@ -1111,7 +1134,6 @@ router.get('/csv', function (req, res, next) {
1111
1134
  // };
1112
1135
  // console.log('REQUEST ROUTE - objectToReturn ', objectToReturn);
1113
1136
  return res.csv(requests, true);
1114
- // return res.csv([ { name: "joe", id: 1 }])
1115
1137
  });
1116
1138
 
1117
1139
  // });
@@ -321,11 +321,16 @@ router.get('/me', function (req, res, next) {
321
321
 
322
322
  winston.verbose('REQUEST ROUTE - REQUEST FIND ', query);
323
323
 
324
+ if (req.query.full_text) {
325
+ winston.info('fulltext projection');
326
+
327
+ projection = {score: { $meta: "textScore" } };
328
+ }
324
329
  // requestcachefarequi populaterequired
325
- var q1 = Request.find(query).
330
+ var q1 = Request.find(query, projection).
326
331
  skip(skip).limit(limit);
327
332
 
328
-
333
+
329
334
  winston.debug('REQUEST ROUTE no_populate:' + req.query.no_populate);
330
335
 
331
336
  if (req.query.no_populate != "true" && req.query.no_populate != true) {
@@ -346,7 +351,12 @@ router.get('/me', function (req, res, next) {
346
351
  // // q1.select({ "snapshot": 1});
347
352
  // }
348
353
 
349
- q1.sort(sortQuery);
354
+ if (req.query.full_text) {
355
+ winston.info('fulltext sort');
356
+ q1.sort( { score: { $meta: "textScore" } } ) //https://docs.mongodb.com/manual/reference/operator/query/text/#sort-by-text-search-score
357
+ } else {
358
+ q1.sort(sortQuery);
359
+ }
350
360
 
351
361
  // winston.info('q1',q1);
352
362
 
package/routes/widget.js CHANGED
@@ -116,7 +116,7 @@ router.get('/', function(req, res, next) {
116
116
 
117
117
 
118
118
  var getProject = function(req) {
119
- winston.info('getProject.');
119
+ winston.debug('getProject.');
120
120
 
121
121
  return new Promise(function (resolve, reject) {
122
122
 
@@ -130,7 +130,7 @@ router.get('/', function(req, res, next) {
130
130
  }
131
131
 
132
132
  if (project && project.profile && (project.profile.type === 'free' && project.trialExpired === true) || (project.profile.type === 'payment' && project.isActiveSubscription === false)) {
133
- winston.info('getProject remove poweredBy tag', project);
133
+ winston.debug('getProject remove poweredBy tag', project);
134
134
  project.widget.poweredBy = undefined;
135
135
  project.widget.baloonImage = undefined;
136
136
  }
@@ -219,7 +219,7 @@ describe('LabelRoute', () => {
219
219
  chai.request(server)
220
220
  .post('/'+ savedProject._id + '/labels/default/clone')
221
221
  .auth(email, pwd)
222
- .send({lang: "AR"})
222
+ .send({lang: "ARR"}) //not exists
223
223
  .end((err, res) => {
224
224
  //console.log("res", res);
225
225
  console.log("res.body", res.body);
@@ -227,18 +227,18 @@ describe('LabelRoute', () => {
227
227
  res.body.should.be.a('object');
228
228
  // expect(res.body.jwtSecret).to.not.equal(null);
229
229
  expect(res.body.id_project).to.equal(savedProject.id);
230
- expect(res.body.data[0].lang).to.equal("AR");
230
+ expect(res.body.data[0].lang).to.equal("ARR");
231
231
 
232
232
 
233
233
  chai.request(server)
234
- .get('/'+ savedProject._id + '/labels/AR')
234
+ .get('/'+ savedProject._id + '/labels/ARR')
235
235
  .auth(email, pwd)
236
236
  .send()
237
237
  .end((err, res) => {
238
238
  //console.log("res", res);
239
239
  console.log("res.body ar", res.body);
240
240
  expect(res.body.data.LABEL_PLACEHOLDER).to.equal("type your message..");
241
- expect(res.body.lang).to.equal("AR");
241
+ expect(res.body.lang).to.equal("ARR");
242
242
  expect(res.body.default).to.equal(true);
243
243
  done();
244
244
  });