Skip to content

Commit 7829dbd

Browse files
srinaathSrinaath Ravichandran
andauthored
V4.10.0 (#2180)
* Webchat Upgrade and Version number change Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com> * Handle change to middleware (#2177) * Handle change to middleware * Updated babel preset env Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com> * Reverted change to babel Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com> Locks updated to pre webchat change Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com> Post wechat check Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com> Prevent hoisting bf-chatdown Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com> * Updated babel preset env Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com> * fix: Webchat socket instantiation delay (#2179) * Updated websocket server code to backup messages if it is not connected * Refactored more occurances of socket send * Renaming variables * Added unit test to make sure backedup messages are cleared before connection starts * Lint fix * Updated release date Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com> * All tests working Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com> Co-authored-by: Srinaath Ravichandran <srravich@microsoft.com>
1 parent 9042e38 commit 7829dbd

File tree

24 files changed

+11686
-6555
lines changed

24 files changed

+11686
-6555
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## Unreleased
7+
## v4.10.0 - 2020 - 08 - 21
88
## Added
99
- [client] Added a log panel entry at the start of a conversation that displays the bot endpoint in PR [2149](https://github.com/microsoft/BotFramework-Emulator/pull/2149)
10+
- [client] - Bumped `botframework-webchat` to v4.10.0 in PR [2177](https://github.com/microsoft/BotFramework-Emulator/pull/2177)
1011

1112
## Fixed
1213
- [client] Added missing content to signed in view of Cosmos DB service dialog and fixed product page link in PR [2150](https://github.com/microsoft/BotFramework-Emulator/pull/2150)
1314
- [docs] Modified CONTRIBUTING.md to include updated information about global dependencies required to build from source in PR [2153](https://github.com/microsoft/BotFramework-Emulator/pull/2153)
1415
- [client] Fixed a bug where trying to open the sign-in link on an OAuth card would open the file explorer if ngrok was not configured in PR [2155](https://github.com/microsoft/BotFramework-Emulator/pull/2155)
16+
- [client] Change to a warning message in inspector when clicking on LUIS trace [2160](https://github.com/microsoft/BotFramework-Emulator/pull/2160)
17+
- [client] Handle result from webchat middleware gracefully [2177](https://github.com/microsoft/BotFramework-Emulator/pull/2177)
18+
- [client] Handle Webchat socket instantiation delay [2179](https://github.com/microsoft/BotFramework-Emulator/pull/2179)
1519

1620
## v4.9.0 - 2020 - 05 - 11
1721
## Added

lerna.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,12 @@
1414
"packages/extensions/json",
1515
"packages/tools"
1616
],
17+
"command": {
18+
"bootstrap": {
19+
"nohoist": [
20+
"@microsoft/bf-chatdown"
21+
]
22+
}
23+
},
1724
"version": "independent"
1825
}

package-lock.json

Lines changed: 11489 additions & 6489 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/app/client/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
4949
"@babel/plugin-transform-react-jsx": "^7.0.0",
5050
"@babel/plugin-transform-runtime": "^7.4.4",
51-
"@babel/preset-env": "^7.1.0",
51+
"@babel/preset-env": "^7.11.0",
5252
"@babel/preset-typescript": "^7.1.0",
5353
"@types/enzyme": "^3.1.10",
5454
"@types/jest": "24.0.13",
@@ -93,10 +93,10 @@
9393
"url-loader": "^1.0.1",
9494
"webpack": "^4.32.2",
9595
"webpack-cli": "^3.3.2",
96-
"webpack-dev-server": "^3.4.1"
96+
"webpack-dev-server": "^3.4.1",
97+
"@babel/runtime": "^7.1.5"
9798
},
9899
"dependencies": {
99-
"@babel/runtime": "^7.1.5",
100100
"@bfemulator/app-shared": "^1.0.0",
101101
"@bfemulator/sdk-client": "^1.0.0",
102102
"@bfemulator/sdk-shared": "^1.0.0",
@@ -107,8 +107,8 @@
107107
"base64url": "3.0.0",
108108
"botframework-config": "4.4.0",
109109
"botframework-schema": "^4.3.4",
110-
"botframework-webchat": "4.9.0",
111-
"botframework-webchat-core": "4.9.0",
110+
"botframework-webchat": "4.10.0",
111+
"botframework-webchat-core": "4.10.0",
112112
"eslint-plugin-react": "^7.12.3",
113113
"markdown-it": "^8.4.2",
114114
"react": "16.8.6",

packages/app/client/src/ui/editor/emulator/parts/chat/chat.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
//
3333

3434
import { ValueTypes, RestartConversationStatus } from '@bfemulator/app-shared';
35-
import { User } from '@bfemulator/sdk-shared';
3635
import { Activity, ActivityTypes } from 'botframework-schema';
3736
import ReactWebChat, { createStyleSet } from 'botframework-webchat';
3837
import * as React from 'react';
@@ -139,6 +138,11 @@ export class Chat extends PureComponent<ChatProps, ChatState> {
139138
}
140139

141140
private activityWrapper(next, card, children): ReactNode {
141+
let childrenContents = null;
142+
const middlewareResult = next(card);
143+
if (middlewareResult) {
144+
childrenContents = middlewareResult(children);
145+
}
142146
return (
143147
<OuterActivityWrapperContainer
144148
card={card}
@@ -147,7 +151,7 @@ export class Chat extends PureComponent<ChatProps, ChatState> {
147151
onItemRendererClick={this.onItemRendererClick}
148152
onItemRendererKeyDown={this.onItemRendererKeyDown}
149153
>
150-
{next(card)(children)}
154+
{childrenContents}
151155
</OuterActivityWrapperContainer>
152156
);
153157
}

packages/app/main/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@bfemulator/main",
33
"packagename": "BotFramework-Emulator",
4-
"version": "4.9.0",
4+
"version": "4.10.0",
55
"private": true,
66
"description": "Development tool for the Microsoft Bot Framework. Allows developers to test and debug bots on localhost.",
77
"main": "./app/server/main.js",
@@ -79,7 +79,7 @@
7979
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
8080
"@babel/plugin-transform-react-jsx": "^7.0.0",
8181
"@babel/plugin-transform-runtime": "^7.4.4",
82-
"@babel/preset-env": "^7.1.0",
82+
"@babel/preset-env": "^7.11.0",
8383
"@babel/preset-typescript": "^7.1.0",
8484
"@types/async": "^2.0.47",
8585
"@types/chokidar": "^1.7.5",

packages/app/main/src/server/routes/channel/conversations/handlers/replyToActivity.spec.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,17 @@ jest.mock('../../../../utils/oauthLinkEncoder', () => ({
4242
}),
4343
}));
4444

45-
jest.mock('../../../../webSocketServer', () => ({
46-
WebSocketServer: {
47-
getSocketByConversationId: () => ({
48-
send: jest.fn(),
49-
}),
50-
},
51-
}));
45+
const mockSocket = {
46+
send: jest.fn(),
47+
};
48+
49+
jest.mock('../../../../webSocketServer', () => {
50+
return {
51+
WebSocketServer: {
52+
sendToSubscribers: (...args) => mockSocket.send(...args),
53+
},
54+
};
55+
});
5256

5357
describe('replyToActivity route middleware', () => {
5458
const mockReq: any = {

packages/app/main/src/server/routes/channel/conversations/handlers/replyToActivity.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ export function createReplyToActivityHandler(emulatorServer: EmulatorRestServer)
5858

5959
// post activity
6060
activity = conversation.prepActivityToBeSentToUser(conversation.user.id, activity);
61-
const payload = { activities: [activity] };
62-
const socket = WebSocketServer.getSocketByConversationId(conversationId);
63-
socket && socket.send(JSON.stringify(payload));
64-
61+
WebSocketServer.sendToSubscribers(conversation.conversationId, activity);
6562
res.send(HttpStatus.OK, { id: activity.id });
6663
res.end();
6764
};

packages/app/main/src/server/routes/channel/conversations/handlers/sendActivityToConversation.spec.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,17 @@ import * as HttpStatus from 'http-status-codes';
3535

3636
import { sendActivityToConversation } from './sendActivityToConversation';
3737

38-
jest.mock('../../../../webSocketServer', () => ({
39-
WebSocketServer: {
40-
getSocketByConversationId: () => ({
41-
send: jest.fn(),
42-
}),
43-
},
44-
}));
38+
const mockSocket = {
39+
send: jest.fn(),
40+
};
41+
42+
jest.mock('../../../../webSocketServer', () => {
43+
return {
44+
WebSocketServer: {
45+
sendToSubscribers: (...args) => mockSocket.send(...args),
46+
},
47+
};
48+
});
4549

4650
const mockSendErrorResponse = jest.fn();
4751
jest.mock('../../../../utils/sendErrorResponse', () => ({

packages/app/main/src/server/routes/channel/conversations/handlers/sendActivityToConversation.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ export function sendActivityToConversation(req: Request, res: Response, next: Ne
4848

4949
// post activity
5050
activity = conversation.prepActivityToBeSentToUser(conversation.user.id, activity);
51-
const payload = { activities: [activity] };
52-
const socket = WebSocketServer.getSocketByConversationId(conversation.conversationId);
53-
socket && socket.send(JSON.stringify(payload));
54-
51+
WebSocketServer.sendToSubscribers(conversation.conversationId, activity);
5552
res.send(HttpStatus.OK, { id: activity.id });
5653
res.end();
5754
} catch (err) {

0 commit comments

Comments
 (0)