Skip to content

Commit 1bdfa2a

Browse files
author
treml
committed
BOT-373 suggestedActions not mapped as button
1 parent de00a62 commit 1bdfa2a

File tree

5 files changed

+31
-38
lines changed

5 files changed

+31
-38
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,5 @@ typings/
5858
.env
5959

6060
dist
61+
package-lock.json
62+
yarn.lock

index.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class BotiumConnectorDirectline3 {
6060
botMsg.messageText = message.text || null
6161

6262
const mapButton = (b) => ({
63-
text: b.title,
63+
text: b.title || b.text,
6464
payload: b.value || b.url || b.data,
6565
imageUri: b.image || b.iconUrl
6666
})
@@ -78,7 +78,7 @@ class BotiumConnectorDirectline3 {
7878
message.attachments && message.attachments.forEach(a => {
7979
if (a.contentType === 'application/vnd.microsoft.card.hero') {
8080
botMsg.cards.push({
81-
text: a.content.title,
81+
text: a.content.title || a.content.text,
8282
image: a.content.images && a.content.images.length > 0 && mapImage(a.content.images[0]),
8383
buttons: a.content.buttons && a.content.buttons.map(mapButton)
8484
})
@@ -108,6 +108,25 @@ class BotiumConnectorDirectline3 {
108108
}
109109
})
110110

111+
message.suggestedActions && message.suggestedActions.actions && message.suggestedActions.actions.forEach(a => {
112+
botMsg.buttons.push(mapButton(a))
113+
})
114+
115+
if (!botMsg.messageText && botMsg.cards) {
116+
const card = botMsg.cards.find(c => c.text)
117+
if (card && _.isArray(card.text) && card.text.length > 0) {
118+
botMsg.messageText = card.text[0]
119+
} else if (card && _.isString(card.text)) {
120+
botMsg.messageText = card.text
121+
}
122+
}
123+
if (!botMsg.messageText && botMsg.buttons) {
124+
const button = botMsg.buttons.find(b => b.text)
125+
if (button) {
126+
botMsg.messageText = button.text
127+
}
128+
}
129+
111130
this.queueBotSays(botMsg)
112131
}
113132
}

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "botium-connector-directline3",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"description": "Botium Connector for Bot Framework Direct Line 3 API",
55
"main": "dist/botium-connector-directline3-cjs.js",
66
"module": "dist/botium-connector-directline3-es.js",
@@ -19,12 +19,12 @@
1919
},
2020
"homepage": "https://github.com/codeforequity-at/botium-connector-directline3#readme",
2121
"devDependencies": {
22-
"eslint": "^4.19.1",
23-
"eslint-config-standard": "^11.0.0",
24-
"eslint-plugin-import": "^2.11.0",
25-
"eslint-plugin-node": "^6.0.1",
26-
"eslint-plugin-promise": "^3.7.0",
27-
"eslint-plugin-standard": "^3.1.0",
22+
"eslint": "^5.12.0",
23+
"eslint-config-standard": "^12.0.0",
24+
"eslint-plugin-import": "^2.14.0",
25+
"eslint-plugin-node": "^8.0.1",
26+
"eslint-plugin-promise": "^4.0.1",
27+
"eslint-plugin-standard": "^4.0.0",
2828
"rollup": "^0.58.2",
2929
"rollup-plugin-buble": "^0.19.2",
3030
"rollup-plugin-commonjs": "^9.1.3",

samples/convo/botiumFluent.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

samples/convo/package.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
{
22
"name": "samples",
33
"version": "1.0.0",
4-
"description": "",
5-
"main": "botiumFluent.js",
64
"scripts": {
75
"mocha": "mocha spec"
86
},
97
"keywords": [],
108
"author": "",
119
"license": "ISC",
12-
"dependencies": {
13-
"botium-bindings": "latest",
14-
"botium-connector-directline3": "latest",
15-
"botium-core": "latest"
16-
},
1710
"botium": {
1811
"convodirs": [
1912
"spec\\convo"
@@ -24,6 +17,6 @@
2417
"devDependencies": {
2518
"mocha": "latest",
2619
"botium-bindings": "latest",
27-
"botium-connector-echo": "latest"
20+
"botium-connector-directline3": "../../"
2821
}
2922
}

0 commit comments

Comments
 (0)