@tiledesk/tiledesk-server 2.10.68 → 2.10.70
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 +8 -0
- package/models/faq_kb.js +6 -2
- package/package.json +3 -3
- package/pubmodules/trigger/start.js +8 -4
- package/routes/faq_kb.js +7 -4
- package/routes/public-request.js +6 -1
- package/routes/webhooks.js +1 -0
- package/services/faqService.js +104 -34
- package/services/webhookService.js +1 -1
- package/test/authenticationJwt.js +1 -1
- package/test/example-json-rules.txt +2 -1
- package/test/faqService.js +3 -3
- package/test/faqkbRoute.js +11 -10
- package/test/kbRoute.js +2 -2
- package/test/requestRoute.js +1 -1
- package/test/userRequestRoute.js +1 -1
- package/test/webhookRoute.js +0 -1
- package/test-int/bot.js +16 -16
- package/test-int/botSubscriptionNotifier.js +1 -1
- package/views/layout.jade +2 -1
- package/views/messages.jade +11 -4
- package/views/messages_old.jade +20 -0
package/CHANGELOG.md
CHANGED
@@ -5,6 +5,14 @@
|
|
5
5
|
🚀 IN PRODUCTION 🚀
|
6
6
|
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
|
7
7
|
|
8
|
+
# 2.10.71
|
9
|
+
- Updated tybot-connector to 2.0.0
|
10
|
+
- Bug fix: chatbot loosing slug after import/fork
|
11
|
+
- Added: white labelling on messages template (transcript)
|
12
|
+
|
13
|
+
# 2.10.69
|
14
|
+
- Updated tiledesk-apps to 1.0.28
|
15
|
+
|
8
16
|
# 2.10.68
|
9
17
|
- Updated tybot-connector to 0.4.2
|
10
18
|
|
package/models/faq_kb.js
CHANGED
@@ -148,8 +148,12 @@ var Faq_kbSchema = new Schema({
|
|
148
148
|
|
149
149
|
Faq_kbSchema.pre("save", async function (next) {
|
150
150
|
// Check if the document is new and if the slug has not been set manually
|
151
|
-
if (this.isNew
|
152
|
-
|
151
|
+
if (this.isNew) {
|
152
|
+
|
153
|
+
let baseSlug = this.slug;
|
154
|
+
if (!this.slug) {
|
155
|
+
baseSlug = generateSlug(this.name);
|
156
|
+
}
|
153
157
|
let uniqueSlug = baseSlug;
|
154
158
|
|
155
159
|
const existingCount = await mongoose.model("faq_kb").countDocuments({
|
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.10.
|
4
|
+
"version": "2.10.70",
|
5
5
|
"scripts": {
|
6
6
|
"start": "node ./bin/www",
|
7
7
|
"pretest": "mongodb-runner start",
|
@@ -36,7 +36,7 @@
|
|
36
36
|
"@tiledesk-ent/tiledesk-server-visitorcounter": "^1.1.1"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
|
-
"@tiledesk/tiledesk-apps": "^1.0.
|
39
|
+
"@tiledesk/tiledesk-apps": "^1.0.28",
|
40
40
|
"@tiledesk/tiledesk-chat21-app": "^1.1.8",
|
41
41
|
"@tiledesk/tiledesk-chatbot-templates": "^0.1.3",
|
42
42
|
"@tiledesk/tiledesk-chatbot-util": "^0.8.33",
|
@@ -47,7 +47,7 @@
|
|
47
47
|
"@tiledesk/tiledesk-messenger-connector": "^0.1.23",
|
48
48
|
"@tiledesk/tiledesk-rasa-connector": "^1.0.10",
|
49
49
|
"@tiledesk/tiledesk-telegram-connector": "^0.1.14",
|
50
|
-
"@tiledesk/tiledesk-tybot-connector": "^0.
|
50
|
+
"@tiledesk/tiledesk-tybot-connector": "^2.0.0",
|
51
51
|
"@tiledesk/tiledesk-whatsapp-connector": "^0.1.81",
|
52
52
|
"@tiledesk/tiledesk-whatsapp-jobworker": "^0.0.11",
|
53
53
|
"@tiledesk/tiledesk-sms-connector": "^0.1.11",
|
@@ -3,9 +3,8 @@ var Trigger = require('./models/trigger');
|
|
3
3
|
var DefaultTrigger = require('./default');
|
4
4
|
var projectEvent = require('../../event/projectEvent');
|
5
5
|
var winston = require('../../config/winston');
|
6
|
-
|
6
|
+
const chatbotTypes = require("../../models/chatbotTypes");
|
7
7
|
var rulesTrigger = require('./rulesTrigger');
|
8
|
-
const chatbotTypeConstants = require('../../models/chatbotTypes');
|
9
8
|
|
10
9
|
|
11
10
|
function saveTrigger(trigger) {
|
@@ -19,9 +18,14 @@ function saveTrigger(trigger) {
|
|
19
18
|
projectEvent.on('project.create', async (project) => {
|
20
19
|
setImmediate( async () => {
|
21
20
|
|
22
|
-
|
21
|
+
let identity_bot = {
|
22
|
+
name: "Bot",
|
23
|
+
type: "identity",
|
24
|
+
subtype: chatbotTypes.CHATBOT,
|
25
|
+
description: "An identity bot"
|
26
|
+
}
|
23
27
|
|
24
|
-
var botIdentity = await faqService.create(
|
28
|
+
var botIdentity = await faqService.create(project._id, "system", identity_bot);
|
25
29
|
var botIdentityId = "bot_"+botIdentity.id;
|
26
30
|
winston.debug("botIdentityId:"+botIdentityId);
|
27
31
|
|
package/routes/faq_kb.js
CHANGED
@@ -50,9 +50,11 @@ router.post('/', roleChecker.hasRole('admin'), async function (req, res) {
|
|
50
50
|
//return res.status(403).send({ success: false, error: "Maximum number of chatbots reached for the current plan", plan_limit: chatbots_limit })
|
51
51
|
}
|
52
52
|
|
53
|
-
faqService.create(req.
|
54
|
-
res.
|
55
|
-
})
|
53
|
+
faqService.create(req.projectid, req.user.id, req.body).then((savedFaq_kb) => {
|
54
|
+
res.status(200).send(savedFaq_kb);
|
55
|
+
}).catch((err) => {
|
56
|
+
res.status(500).send({ succes: false, error: err })
|
57
|
+
})
|
56
58
|
|
57
59
|
});
|
58
60
|
|
@@ -683,7 +685,7 @@ router.post('/importjson/:id_faq_kb', roleChecker.hasRole('admin'), upload.singl
|
|
683
685
|
// **** CREATE TRUE option ****
|
684
686
|
// ****************************
|
685
687
|
if (req.query.create === 'true') {
|
686
|
-
let savedChatbot = await faqService.create(
|
688
|
+
let savedChatbot = await faqService.create(req.projectid, req.user.id, json)
|
687
689
|
.catch((err) => {
|
688
690
|
winston.error("Error creating new chatbot")
|
689
691
|
return res.status(400).send({ succes: false, message: "Error creatings new chatbot", error: err })
|
@@ -931,6 +933,7 @@ router.get('/exportjson/:id_faq_kb', roleChecker.hasRole('admin'), (req, res) =>
|
|
931
933
|
webhook_url: faq_kb.webhook_url,
|
932
934
|
language: faq_kb.language,
|
933
935
|
name: faq_kb.name,
|
936
|
+
slug: faq_kb.slug,
|
934
937
|
type: faq_kb.type,
|
935
938
|
subtype: faq_kb.subtype,
|
936
939
|
description: faq_kb.description,
|
package/routes/public-request.js
CHANGED
@@ -55,7 +55,12 @@ var printer = new PdfPrinter(fonts);
|
|
55
55
|
return res.status(404).send({success: false, msg: 'Object not found.'});
|
56
56
|
}
|
57
57
|
|
58
|
-
return res.render('messages',
|
58
|
+
return res.render('messages',
|
59
|
+
{ title: 'Tiledesk',
|
60
|
+
messages: messages,
|
61
|
+
brandName: process.env.BRAND_NAME || null,
|
62
|
+
brandLogo: process.env.BRAND_LOGO || null
|
63
|
+
});
|
59
64
|
});
|
60
65
|
|
61
66
|
});
|
package/routes/webhooks.js
CHANGED
package/services/faqService.js
CHANGED
@@ -9,30 +9,30 @@ const chatbotTypes = require("../models/chatbotTypes");
|
|
9
9
|
|
10
10
|
class FaqService {
|
11
11
|
|
12
|
-
|
13
|
-
create(name, url, projectid, user_id, type, subtype, description, webhook_url, webhook_enabled, language, template, mainCategory, intentsEngine, attributes) {
|
12
|
+
create(id_project, id_user, data) {
|
14
13
|
var that = this;
|
15
14
|
return new Promise(function (resolve, reject) {
|
16
15
|
|
17
16
|
//winston.debug('FAQ-KB POST REQUEST BODY ', req.body);
|
18
17
|
var newFaq_kb = new Faq_kb({
|
19
|
-
name: name,
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
18
|
+
name: data.name,
|
19
|
+
slug: data.slug,
|
20
|
+
description: data.description,
|
21
|
+
url: data.url,
|
22
|
+
id_project: id_project,
|
23
|
+
webhook_url: data.webhook_url,
|
24
|
+
webhook_enabled: data.webhook_enabled,
|
25
|
+
type: data.type,
|
26
|
+
subtype: data.subtype,
|
27
|
+
language: data.language,
|
28
28
|
public: false,
|
29
29
|
certified: false,
|
30
|
-
mainCategory: mainCategory,
|
31
|
-
intentsEngine: intentsEngine,
|
30
|
+
mainCategory: data.mainCategory,
|
31
|
+
intentsEngine: data.intentsEngine,
|
32
32
|
trashed: false,
|
33
|
-
createdBy:
|
34
|
-
updatedBy:
|
35
|
-
attributes: attributes
|
33
|
+
createdBy: id_user,
|
34
|
+
updatedBy: id_user,
|
35
|
+
attributes: data.attributes
|
36
36
|
});
|
37
37
|
|
38
38
|
|
@@ -45,32 +45,28 @@ class FaqService {
|
|
45
45
|
|
46
46
|
botEvent.emit('faqbot.create', savedFaq_kb);
|
47
47
|
|
48
|
-
winston.debug('type ' + type)
|
48
|
+
winston.debug('type ' + data.type)
|
49
49
|
|
50
|
-
|
50
|
+
let template = "empty";
|
51
51
|
|
52
|
-
|
53
|
-
if (!template) {
|
54
|
-
template = "empty";
|
55
|
-
}
|
56
|
-
} else {
|
52
|
+
if (data.type === "internal" || data.type === "tilebot") {
|
57
53
|
|
58
|
-
|
59
|
-
|
60
|
-
template = "empty";
|
61
|
-
}
|
62
|
-
} else if (subtype === chatbotTypes.WEBHOOK) {
|
54
|
+
if (data.subtype) {
|
55
|
+
if (data.subtype === chatbotTypes.WEBHOOK) {
|
63
56
|
template = "blank_webhook"
|
64
|
-
} else if (subtype === chatbotTypes.COPILOT) {
|
57
|
+
} else if (data.subtype === chatbotTypes.COPILOT) {
|
65
58
|
template = "blank_copilot"
|
66
|
-
} else {
|
67
|
-
template
|
59
|
+
} else if (data.subtype === chatbotTypes.CHATBOT) {
|
60
|
+
if (data.template) {
|
61
|
+
template = data.template;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
} else {
|
65
|
+
if (data.template) {
|
66
|
+
template = data.template;
|
68
67
|
}
|
69
68
|
}
|
70
69
|
|
71
|
-
if (!template) {
|
72
|
-
template = "empty";
|
73
|
-
}
|
74
70
|
winston.debug('template ' + template);
|
75
71
|
that.createGreetingsAndOperationalsFaqs(savedFaq_kb._id, savedFaq_kb.createdBy, savedFaq_kb.id_project, template);
|
76
72
|
} else {
|
@@ -84,6 +80,80 @@ class FaqService {
|
|
84
80
|
});
|
85
81
|
}
|
86
82
|
|
83
|
+
// _create(name, url, projectid, user_id, type, subtype, description, webhook_url, webhook_enabled, language, template, mainCategory, intentsEngine, attributes) {
|
84
|
+
// var that = this;
|
85
|
+
// return new Promise(function (resolve, reject) {
|
86
|
+
|
87
|
+
// //winston.debug('FAQ-KB POST REQUEST BODY ', req.body);
|
88
|
+
// var newFaq_kb = new Faq_kb({
|
89
|
+
// name: name,
|
90
|
+
// description: description,
|
91
|
+
// url: url,
|
92
|
+
// id_project: projectid,
|
93
|
+
// webhook_url: webhook_url,
|
94
|
+
// webhook_enabled: webhook_enabled,
|
95
|
+
// type: type,
|
96
|
+
// subtype: subtype,
|
97
|
+
// language: language,
|
98
|
+
// public: false,
|
99
|
+
// certified: false,
|
100
|
+
// mainCategory: mainCategory,
|
101
|
+
// intentsEngine: intentsEngine,
|
102
|
+
// trashed: false,
|
103
|
+
// createdBy: user_id,
|
104
|
+
// updatedBy: user_id,
|
105
|
+
// attributes: attributes
|
106
|
+
// });
|
107
|
+
|
108
|
+
|
109
|
+
// newFaq_kb.save(function (err, savedFaq_kb) {
|
110
|
+
// if (err) {
|
111
|
+
// winston.error('--- > ERROR ', err)
|
112
|
+
// return reject('Error saving object.');
|
113
|
+
// }
|
114
|
+
// winston.debug('-> -> SAVED FAQFAQ KB ', savedFaq_kb.toObject())
|
115
|
+
|
116
|
+
// botEvent.emit('faqbot.create', savedFaq_kb);
|
117
|
+
|
118
|
+
// winston.debug('type ' + type)
|
119
|
+
|
120
|
+
// if (type === "internal" || type === "tilebot") {
|
121
|
+
|
122
|
+
// if (!subtype) {
|
123
|
+
// if (!template) {
|
124
|
+
// template = "empty";
|
125
|
+
// }
|
126
|
+
// } else {
|
127
|
+
|
128
|
+
// if (subtype === chatbotTypes.CHATBOT) {
|
129
|
+
// if (!template) {
|
130
|
+
// template = "empty";
|
131
|
+
// }
|
132
|
+
// } else if (subtype === chatbotTypes.WEBHOOK) {
|
133
|
+
// template = "blank_webhook"
|
134
|
+
// } else if (subtype === chatbotTypes.COPILOT) {
|
135
|
+
// template = "blank_copilot"
|
136
|
+
// } else {
|
137
|
+
// template = "empty";
|
138
|
+
// }
|
139
|
+
// }
|
140
|
+
|
141
|
+
// if (!template) {
|
142
|
+
// template = "empty";
|
143
|
+
// }
|
144
|
+
// winston.debug('template ' + template);
|
145
|
+
// that.createGreetingsAndOperationalsFaqs(savedFaq_kb._id, savedFaq_kb.createdBy, savedFaq_kb.id_project, template);
|
146
|
+
// } else {
|
147
|
+
// winston.debug('external bot: ', savedFaq_kb);
|
148
|
+
// }
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
// return resolve(savedFaq_kb);
|
153
|
+
// });
|
154
|
+
// });
|
155
|
+
// }
|
156
|
+
|
87
157
|
createGreetingsAndOperationalsFaqs(faq_kb_id, created_by, projectid, template) {
|
88
158
|
var that = this;
|
89
159
|
return new Promise(function (resolve, reject) {
|
@@ -370,7 +370,7 @@ describe('AuthenticationJWT', () => {
|
|
370
370
|
// create(name, createdBy, settings)
|
371
371
|
projectService.create("test-signinJWt-user", savedUser._id).then(function (savedProject) {
|
372
372
|
// create(name, url, projectid, user_id, type, description, webhook_url, webhook_enabled, language) {
|
373
|
-
faqService.create(
|
373
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot"}).then(function (savedBot) {
|
374
374
|
|
375
375
|
var savedBotObj = savedBot.toObject();
|
376
376
|
if (log) { console.log("savedBotObj", savedBotObj); }
|
package/test/faqService.js
CHANGED
@@ -29,7 +29,7 @@ describe('FaqService()', function () {
|
|
29
29
|
|
30
30
|
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
31
31
|
projectService.create("test-FaqService", savedUser._id).then(function (savedProject) {
|
32
|
-
faqService.create(
|
32
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot" }).then(function (savedBot) {
|
33
33
|
|
34
34
|
var newFaq = new Faq({
|
35
35
|
id_faq_kb: savedBot._id,
|
@@ -85,7 +85,7 @@ describe('FaqService()', function () {
|
|
85
85
|
|
86
86
|
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
87
87
|
projectService.create("test-FaqService", savedUser._id).then(function (savedProject) {
|
88
|
-
faqService.create(
|
88
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot" }).then(function (savedBot) {
|
89
89
|
|
90
90
|
var newFaq = new Faq({
|
91
91
|
id_faq_kb: savedBot._id,
|
@@ -141,7 +141,7 @@ describe('FaqService()', function () {
|
|
141
141
|
|
142
142
|
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
143
143
|
projectService.create("test-FaqService", savedUser._id).then(function (savedProject) {
|
144
|
-
faqService.create(
|
144
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot" }).then(function (savedBot) {
|
145
145
|
|
146
146
|
var newFaq0 = new Faq({
|
147
147
|
id_faq_kb: savedBot._id,
|
package/test/faqkbRoute.js
CHANGED
@@ -710,25 +710,26 @@ describe('FaqKBRoute', () => {
|
|
710
710
|
|
711
711
|
res.should.have.status(200);
|
712
712
|
res.should.be.a('object');
|
713
|
-
expect(res.body.name).to.equal("
|
713
|
+
expect(res.body.name).to.equal("example bot");
|
714
|
+
expect(res.body.slug).to.equal("my-example-bot");
|
714
715
|
expect(res.body.language).to.equal("en");
|
715
716
|
|
716
717
|
let id_faq_kb = res.body._id;
|
717
718
|
|
718
719
|
chai.request(server)
|
719
|
-
|
720
|
-
|
721
|
-
|
720
|
+
.get('/' + savedProject._id + '/faq?id_faq_kb=' + id_faq_kb)
|
721
|
+
.auth(email, pwd)
|
722
|
+
.end((err, res) => {
|
722
723
|
|
723
|
-
|
724
|
-
|
724
|
+
if (err) { console.error("err: ", err); }
|
725
|
+
if (log) { console.log("res.body", res.body); }
|
725
726
|
|
726
|
-
|
727
|
-
|
727
|
+
res.should.have.status(200);
|
728
|
+
//res.body.should.be.an('array').that.is.not.empty;
|
728
729
|
|
729
|
-
|
730
|
+
done();
|
730
731
|
|
731
|
-
|
732
|
+
})
|
732
733
|
})
|
733
734
|
|
734
735
|
})
|
package/test/kbRoute.js
CHANGED
@@ -1800,8 +1800,8 @@ describe('KbRoute', () => {
|
|
1800
1800
|
|
1801
1801
|
userService.signup(email, pwd, "Test Firstname", "Test Lastname").then((savedUser) => {
|
1802
1802
|
projectService.create('test-faqkb-create', savedUser._id).then((savedProject) => {
|
1803
|
-
faqService.create(
|
1804
|
-
faqService.create(
|
1803
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot1" }).then((savedBot1) => {
|
1804
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot2" }).then((savedBot2) => {
|
1805
1805
|
|
1806
1806
|
chai.request(server)
|
1807
1807
|
.get('/' + savedProject._id + '/kb/namespace/all')
|
package/test/requestRoute.js
CHANGED
@@ -315,7 +315,7 @@ describe('RequestRoute', () => {
|
|
315
315
|
var savedProject = savedProjectAndPU.project;
|
316
316
|
|
317
317
|
|
318
|
-
faqService.create(
|
318
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal" }).then(function (savedBot) {
|
319
319
|
|
320
320
|
|
321
321
|
|
package/test/userRequestRoute.js
CHANGED
@@ -49,7 +49,7 @@ describe('UserService()', function () {
|
|
49
49
|
projectService.createAndReturnProjectAndProjectUser("createWithId", savedUser.id).then(function (savedProjectAndPU) {
|
50
50
|
var savedProject = savedProjectAndPU.project;
|
51
51
|
|
52
|
-
faqService.create(
|
52
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "tilebot", subtype: chatbotTypes.CHATBOT, language: "en", template: "blank" }).then(async function (savedFaq_kb) {
|
53
53
|
|
54
54
|
var signOptions = {
|
55
55
|
issuer: 'https://tiledesk.com',
|
package/test/webhookRoute.js
CHANGED
@@ -358,7 +358,6 @@ describe('WebhookRoute', () => {
|
|
358
358
|
if (err) { console.error("err: ", err); }
|
359
359
|
if (log) { console.log("res.body", res.body); }
|
360
360
|
|
361
|
-
console.log("res.body", res.body);
|
362
361
|
res.should.have.status(200);
|
363
362
|
res.body.should.be.a('object');
|
364
363
|
expect(res.body.success).to.equal(true);
|
package/test-int/bot.js
CHANGED
@@ -50,7 +50,7 @@ describe('bot', () => {
|
|
50
50
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
51
51
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
52
52
|
// create(name, url, projectid, user_id, type)
|
53
|
-
faqService.create(
|
53
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal" }).then(function(savedBot) {
|
54
54
|
|
55
55
|
var newFaq = new Faq({
|
56
56
|
id_faq_kb: savedBot._id,
|
@@ -152,7 +152,7 @@ describe('bot', () => {
|
|
152
152
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
153
153
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
154
154
|
// create(name, url, projectid, user_id, type)
|
155
|
-
faqService.create(
|
155
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal" }).then(function(savedBot) {
|
156
156
|
|
157
157
|
var newFaq = new Faq({
|
158
158
|
id_faq_kb: savedBot._id,
|
@@ -282,7 +282,7 @@ describe('bot', () => {
|
|
282
282
|
// expect(savedMessage.sender).to.equal("question");
|
283
283
|
|
284
284
|
// create(name, url, projectid, user_id, type)
|
285
|
-
faqService.create(
|
285
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal" }).then(function(savedBot) {
|
286
286
|
|
287
287
|
var newFaq = new Faq({
|
288
288
|
id_faq_kb: savedBot._id,
|
@@ -385,7 +385,7 @@ describe('bot', () => {
|
|
385
385
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
386
386
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
387
387
|
// create(name, url, projectid, user_id, type)
|
388
|
-
faqService.create(
|
388
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal" }).then(function(savedBot) {
|
389
389
|
|
390
390
|
var newFaq = new Faq({
|
391
391
|
id_faq_kb: savedBot._id,
|
@@ -478,7 +478,7 @@ describe('bot', () => {
|
|
478
478
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
479
479
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
480
480
|
// create(name, url, projectid, user_id, type)
|
481
|
-
faqService.create("testbot", "http://localhost:3001/samples/bot/external/searcher",
|
481
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", url: "http://localhost:3001/samples/bot/external/searcher", type: "internal" }).then(function(savedBot) {
|
482
482
|
|
483
483
|
var newFaq = new Faq({
|
484
484
|
id_faq_kb: savedBot._id,
|
@@ -573,7 +573,7 @@ describe('bot', () => {
|
|
573
573
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
574
574
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
575
575
|
// create(name, url, projectid, user_id, type)
|
576
|
-
faqService.create(
|
576
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal" }).then(function(savedBot) {
|
577
577
|
|
578
578
|
var newFaq = new Faq({
|
579
579
|
id_faq_kb: savedBot._id,
|
@@ -678,7 +678,7 @@ describe('bot', () => {
|
|
678
678
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
679
679
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
680
680
|
// create(name, url, projectid, user_id, type)
|
681
|
-
faqService.create(
|
681
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal" }).then(function(savedBot) {
|
682
682
|
|
683
683
|
var newFaq = new Faq({
|
684
684
|
id_faq_kb: savedBot._id,
|
@@ -785,7 +785,7 @@ describe('bot', () => {
|
|
785
785
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
786
786
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
787
787
|
// create(name, url, projectid, user_id, type)
|
788
|
-
faqService.create(
|
788
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal" }).then(function(savedBot) {
|
789
789
|
|
790
790
|
var newFaq = new Faq({
|
791
791
|
id_faq_kb: savedBot._id,
|
@@ -881,7 +881,7 @@ describe('bot', () => {
|
|
881
881
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
882
882
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
883
883
|
// create(name, url, projectid, user_id, type)
|
884
|
-
faqService.create(
|
884
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal" }).then(function(savedBot) {
|
885
885
|
|
886
886
|
|
887
887
|
var newFaq2 = new Faq({
|
@@ -999,7 +999,7 @@ describe('bot', () => {
|
|
999
999
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
1000
1000
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
1001
1001
|
// create(name, url, projectid, user_id, type)
|
1002
|
-
faqService.create(
|
1002
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal" }).then(function(savedBot) {
|
1003
1003
|
|
1004
1004
|
|
1005
1005
|
var newFaq2 = new Faq({
|
@@ -1218,7 +1218,7 @@ describe('bot', () => {
|
|
1218
1218
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
1219
1219
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
1220
1220
|
// create(name, url, projectid, user_id, type)
|
1221
|
-
faqService.create(
|
1221
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal" }).then(function(savedBot) {
|
1222
1222
|
|
1223
1223
|
var newFaq = new Faq({
|
1224
1224
|
id_faq_kb: savedBot._id,
|
@@ -1318,7 +1318,7 @@ describe('bot', () => {
|
|
1318
1318
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
1319
1319
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
1320
1320
|
// create(name, url, projectid, user_id, type)
|
1321
|
-
faqService.create(
|
1321
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal", webhook_url: "http://localhost:3019/", webhook_enabled: true }).then(function(savedBot) {
|
1322
1322
|
|
1323
1323
|
var newFaq = new Faq({
|
1324
1324
|
id_faq_kb: savedBot._id,
|
@@ -1430,7 +1430,7 @@ describe('bot', () => {
|
|
1430
1430
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
1431
1431
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
1432
1432
|
// create(name, url, projectid, user_id, type)
|
1433
|
-
faqService.create(
|
1433
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal", webhook_url: "http://localhost:3019/", webhook_enabled: true }).then(function(savedBot) {
|
1434
1434
|
|
1435
1435
|
Faq.findOneAndUpdate({id_project:savedProject._id,id_faq_kb:savedBot._id, question: "defaultFallback" }, {webhook_enabled: true},{new: true, upsert:false}, function (err, savedFaq) {
|
1436
1436
|
console.log("savedFaq",savedFaq);
|
@@ -1535,7 +1535,7 @@ describe('bot', () => {
|
|
1535
1535
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
1536
1536
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
1537
1537
|
// create(name, url, projectid, user_id, type)
|
1538
|
-
faqService.create(
|
1538
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal", webhook_url: "http://localhost:3019/", webhook_enabled: true }).then(function(savedBot) {
|
1539
1539
|
|
1540
1540
|
Faq.findOneAndUpdate({id_project:savedProject._id,id_faq_kb:savedBot._id, question: "defaultFallback" }, {webhook_enabled: true},{new: true, upsert:false}, function (err, savedFaq) {
|
1541
1541
|
console.log("savedFaq",savedFaq);
|
@@ -1667,7 +1667,7 @@ describe('bot', () => {
|
|
1667
1667
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
1668
1668
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
1669
1669
|
// create(name, url, projectid, user_id, type)
|
1670
|
-
faqService.create(
|
1670
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", type: "internal", webhook_url: "http://localhost:3019/", webhook_enabled: true }).then(function(savedBot) {
|
1671
1671
|
|
1672
1672
|
Faq.findOneAndUpdate({id_project:savedProject._id,id_faq_kb:savedBot._id, question: "defaultFallback" }, {webhook_enabled: true},{new: true, upsert:false}, function (err, savedFaq) {
|
1673
1673
|
console.log("savedFaq",savedFaq);
|
@@ -1803,7 +1803,7 @@ describe('bot', () => {
|
|
1803
1803
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
1804
1804
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
1805
1805
|
// create(name, url, projectid, user_id, type)
|
1806
|
-
faqService.create(
|
1806
|
+
faqService.create(savedProject._id, savedUser._id,{ name: "testbot", type: "internal", webhook_enabled: true }).then(function(savedBot) {
|
1807
1807
|
|
1808
1808
|
var newFaq = new Faq({
|
1809
1809
|
id_faq_kb: savedBot._id,
|
@@ -46,7 +46,7 @@ describe('botSubscriptionNotifier', () => {
|
|
46
46
|
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
47
47
|
projectService.create("test-bot", savedUser._id).then(function(savedProject) {
|
48
48
|
// create(name, url, projectid, user_id, type)
|
49
|
-
faqService.create("testbot",
|
49
|
+
faqService.create(savedProject._id, savedUser._id, { name: "testbot", url: "http://localhost:3036/", type: "external" }).then(function(savedBot) {
|
50
50
|
|
51
51
|
|
52
52
|
|
package/views/layout.jade
CHANGED
@@ -58,7 +58,8 @@ html
|
|
58
58
|
a{
|
59
59
|
color:#00B7FF
|
60
60
|
}
|
61
|
-
|
61
|
+
|
62
|
+
title= (brandName ? brandName + " Chat Transcript" : (title ? title + " Chat Transcript" : "Chat Transcript"))
|
62
63
|
link(rel='stylesheet', href='/stylesheets/style.css')
|
63
64
|
body
|
64
65
|
block content
|
package/views/messages.jade
CHANGED
@@ -2,7 +2,11 @@ extends layout
|
|
2
2
|
|
3
3
|
block content
|
4
4
|
div(class="transcript-container")
|
5
|
-
|
5
|
+
|
6
|
+
if brandLogo
|
7
|
+
img.className#IdName(src="brandLogo" alt="brand logo")
|
8
|
+
else if !brandLogo && !brandName
|
9
|
+
img.className#IdName(src="https://tiledesk.com/wp-content/uploads/2022/07/tiledesk_v2.png" alt="tiledesk logo")
|
6
10
|
|
7
11
|
div(class="transcript-wrapper")
|
8
12
|
h1(class="transcript-title") Chat Transcript
|
@@ -13,8 +17,11 @@ block content
|
|
13
17
|
span(class="transcript-chat-date") [#{message.createdAt.toLocaleString('en', { timeZone: 'UTC' })}]
|
14
18
|
span(class="transcript-chat-sender") #{message.senderFullname}:
|
15
19
|
span(class="transcript-chat-msg") #{message.text}
|
16
|
-
|
17
|
-
|
18
|
-
|
20
|
+
|
21
|
+
if brandName
|
22
|
+
p(class="transcript-powered-by") Powered by #{brandName}
|
23
|
+
else
|
24
|
+
p(class="transcript-powered-by") Powered by
|
25
|
+
a(href="https://tiledesk.com/", target="_blank") Tiledesk
|
19
26
|
|
20
27
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
extends layout
|
2
|
+
|
3
|
+
block content
|
4
|
+
div(class="transcript-container")
|
5
|
+
img.className#IdName(src="https://tiledesk.com/wp-content/uploads/2022/07/tiledesk_v2.png" alt="tiledesk logo")
|
6
|
+
|
7
|
+
div(class="transcript-wrapper")
|
8
|
+
h1(class="transcript-title") Chat Transcript
|
9
|
+
|
10
|
+
|
11
|
+
each message in messages
|
12
|
+
p(class="transcript-p")
|
13
|
+
span(class="transcript-chat-date") [#{message.createdAt.toLocaleString('en', { timeZone: 'UTC' })}]
|
14
|
+
span(class="transcript-chat-sender") #{message.senderFullname}:
|
15
|
+
span(class="transcript-chat-msg") #{message.text}
|
16
|
+
|
17
|
+
p(class="transcript-powered-by") Powered by
|
18
|
+
a(href="https://tiledesk.com/", target="_blank") tiledesk
|
19
|
+
|
20
|
+
|