Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the Web Chat Version and Bundle to User Agent #2101

Merged
merged 11 commits into from
Jul 1, 2019
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added

- `*`: Added [`eslint`](https://npmjs.com/package/eslint/) to static code analysis, by [@compulim](https://github.com/compulim), in PR [#1970](https://github.com/microsoft/BotFramework-WebChat/pull/1970)
- Added pt-PT language, by [@bodyzatva](https://github.com/bodyzatva) in PR [#2005](https://github.com/microsoft/BotFramework-WebChat/pull/2005) and PR [#2020](https://github.com/Microsoft/BotFramework-WebChat/pull/2020)
- Added documentation for using Web Chat dev build, by [@corinagum](https://github.com/corinagum), in PR [#2074](https://github.com/Microsoft/BotFramework-WebChat/pull/2074)
- Added pt-PT language, by [@bodyzatva](https://github.com/bodyzatva) in PR [#2005](https://github.com/microsoft/BotFramework-WebChat/pull/2005) and PR [#2020](https://github.com/Microsoft/BotFramework-WebChat/pull/2020)
corinagum marked this conversation as resolved.
Show resolved Hide resolved
- Added documentation for using Web Chat dev build, by [@corinagum](https://github.com/corinagum), in PR [#2074](https://github.com/Microsoft/BotFramework-WebChat/pull/2074)
- Added the Web Chat version to DirectLine's botAgent option, by [@tdurnford](https://github.com/tdurnford), in PR [#2101](https://github.com/Microsoft/BotFramework-WebChat/pull/2101)

### Changed

Expand Down Expand Up @@ -59,9 +60,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fix [#1627](https://github.com/Microsoft/BotFramework-WebChat/issues/1627). Fixed timestamps randomly stopped from updating, by [@compulim](https://github.com/compulim) in PR [#2090](https://github.com/Microsoft/BotFramework-WebChat/pull/2090)
- Fix [#2001](https://github.com/Microsoft/BotFramework-WebChat/issues/2001). Strip Markdown from ARIA labels, so screen readers do not speak Markdown in text, by [@corinagum](https://github.com/corinagum) in PR [#2096](https://github.com/Microsoft/BotFramework-WebChat/pull/2096)
- Fix [#1926](https://github.com/microsoft/BotFramework-WebChat/issues/1926). Fixed scroll stickiness issue when submitting an Adaptive Card form with suggested actions opened, by [@compulim](https://github.com/compulim) in PR [#2107](https://github.com/microsoft/BotFramework-WebChat/pull/2107)
- Fix [#2106](https://github.com/Microsoft/BotFramework-WebChat/issues/2016). Fix AdaptiveCardHostConfig warning associated with the CommonCard component, by [@tdurnford](https://github.com/tdurnford) in PR [#2108](https://github.com/Microsoft/BotFramework-WebChat/pull/2108)
- Fix [#2110](https://github.com/Microsoft/BotFramework-WebChat/issues/2110). Fixed sendBox input/textarea background color issue, by [@tdurnford](https://github.com/johndoe) in PR [#2111](https://github.com/Microsoft/BotFramework-WebChat/pull/2111)
- Fix [#2104](https://github.com/Microsoft/BotFramework-WebChat/issues/2104). Remove deprecated `/master/webchat**.js links from samples, by [@corinagum](https://github.com/corinagum) in PR [#2105](https://github.com/Microsoft/BotFramework-WebChat/pull/2105)
- Fix [#2106](https://github.com/Microsoft/BotFramework-WebChat/issues/2016). Fix AdaptiveCardHostConfig warning associated with the CommonCard component, by [@tdurnford](https://github.com/tdurnford) in PR [#2108](https://github.com/Microsoft/BotFramework-WebChat/pull/2108)
tdurnford marked this conversation as resolved.
Show resolved Hide resolved

### Samples

Expand Down
3 changes: 2 additions & 1 deletion packages/bundle/src/createDirectLine.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DirectLine } from 'botframework-directlinejs';

export default function createDirectLine({
botAgent,
conversationId,
domain,
fetch,
Expand All @@ -12,6 +13,7 @@ export default function createDirectLine({
webSocket
}) {
return new DirectLine({
botAgent,
conversationId,
domain,
fetch,
Expand All @@ -21,7 +23,6 @@ export default function createDirectLine({
token,
watermark,
webSocket,
botAgent: 'webchat',
createFormData: attachments => {
const formData = new FormData();

Expand Down
20 changes: 19 additions & 1 deletion packages/bundle/src/index-es5.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/* eslint dot-notation: ["error", { "allowPattern": "^WebChat$" }] */
// window['WebChat'] is required for TypeScript

// Polyfills for IE11 and other ES5 browsers
// To maintain quality, we prefer polyfills without additives
// For example, we prefer Promise implementation from "core-js" than "bluebird"

import 'core-js/modules/es6.array.find-index';
import 'core-js/modules/es6.array.find';
import 'core-js/modules/es6.array.iterator';
Expand All @@ -13,8 +17,22 @@ import 'core-js/modules/es6.symbol';
import 'core-js/modules/es7.array.includes';
import 'url-search-params-polyfill';
import 'whatwg-fetch';
tdurnford marked this conversation as resolved.
Show resolved Hide resolved

import { version } from './index-minimal';
import addVersion from './addVersion';
import defaultCreateDirectLine from './createDirectLine';

const createDirectLine = options => {
options.botAgent &&
console.warn(
'Web Chat: Developers are not currently allowed to set botAgent in the createDirectLine function. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
);
return defaultCreateDirectLine({ ...options, botAgent: `webchat/${version} (ES5)` });
tdurnford marked this conversation as resolved.
Show resolved Hide resolved
};

window['WebChat'] = {
...window['WebChat'],
createDirectLine
};

export * from './index';

Expand Down
15 changes: 12 additions & 3 deletions packages/bundle/src/index-minimal.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint dot-notation: ["error", { "allowPattern": "^WebChat$" }] */
// window['WebChat'] is required for TypeScript

import { Constants, createStore } from 'botframework-webchat-core';
import { Constants, createStore, version } from 'botframework-webchat-core';

import ReactWebChat, {
Components,
Expand All @@ -13,10 +13,18 @@ import ReactWebChat, {
import addVersion from './addVersion';
import coreRenderWebChat from './renderWebChat';
import createBrowserWebSpeechPonyfillFactory from './createBrowserWebSpeechPonyfillFactory';
import createDirectLine from './createDirectLine';
import defaultCreateDirectLine from './createDirectLine';

const renderWebChat = coreRenderWebChat.bind(null, ReactWebChat);

const createDirectLine = options => {
options.botAgent &&
console.warn(
'Web Chat: Developers are not currently allowed to set botAgent in the createDirectLine function. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
);
return defaultCreateDirectLine({ ...options, botAgent: `webchat/${version} (Minimal)` });
tdurnford marked this conversation as resolved.
Show resolved Hide resolved
};

export default ReactWebChat;

export {
Expand All @@ -28,7 +36,8 @@ export {
createDirectLine,
createStore,
createStyleSet,
renderWebChat
renderWebChat,
version
};

window['WebChat'] = {
Expand Down
12 changes: 12 additions & 0 deletions packages/bundle/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,32 @@

export * from './index-minimal';

import { version } from './index-minimal';
tdurnford marked this conversation as resolved.
Show resolved Hide resolved
import addVersion from './addVersion';
import coreRenderWebChat from './renderWebChat';
import createCognitiveServicesBingSpeechPonyfillFactory from './createCognitiveServicesBingSpeechPonyfillFactory';
import createCognitiveServicesSpeechServicesPonyfillFactory from './createCognitiveServicesSpeechServicesPonyfillFactory';
import createStyleSet from './adaptiveCards/Styles/createStyleSetWithAdaptiveCards';
import defaultCreateDirectLine from './createDirectLine';
import ReactWebChat from './FullReactWebChat';
import renderMarkdown from './renderMarkdown';

const renderWebChat = coreRenderWebChat.bind(null, ReactWebChat);

const createDirectLine = options => {
options.botAgent &&
console.warn(
'Web Chat: Developers are not currently allowed to set botAgent. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
);
return defaultCreateDirectLine({ ...options, botAgent: `webchat/${version} (Full)` });
tdurnford marked this conversation as resolved.
Show resolved Hide resolved
};

export default ReactWebChat;

export {
createCognitiveServicesBingSpeechPonyfillFactory,
createCognitiveServicesSpeechServicesPonyfillFactory,
createDirectLine,
createStyleSet,
renderMarkdown,
renderWebChat
Expand All @@ -27,6 +38,7 @@ window['WebChat'] = {
...window['WebChat'],
createCognitiveServicesBingSpeechPonyfillFactory,
createCognitiveServicesSpeechServicesPonyfillFactory,
createDirectLine,
createStyleSet,
ReactWebChat,
renderMarkdown,
Expand Down