Permalink
Browse files

Merge production Web Chat (#623)

* Remove store
* Hardcode channel account ID
* Hide background tabs
* Remove custom packages
  • Loading branch information...
compulim committed May 31, 2018
1 parent 1c10e32 commit f78d474596f2362a388a8b4697a2b266bdc6d6b5
Showing with 439 additions and 91,016 deletions.
  1. +0 −2 lerna.json
  2. +1 −1 packages/app/client/gulpfile.js
  3. +1 −1 packages/app/client/package.json
  4. +14 −2 packages/app/client/src/commands.ts
  5. +0 −2 packages/app/client/src/data/action/chatActions.ts
  6. +0 −1 packages/app/client/src/shared.ts
  7. +21 −11 packages/app/client/src/ui/editor/emulator/emulator.tsx
  8. +105 −91 packages/app/client/src/ui/editor/emulator/parts/chat.tsx
  9. +9 −12 packages/app/client/src/ui/helpers/activeBotHelper.ts
  10. +16 −0 packages/app/client/src/ui/helpers/memoize.ts
  11. +10 −7 packages/app/client/src/ui/shell/multiTabs/multiTabs.tsx
  12. +7 −2 packages/app/client/src/ui/shell/multiTabs/tabbedDocument/contentWrapper.tsx
  13. +6 −1 packages/app/client/src/ui/shell/multiTabs/tabbedDocument/tabbedDocument.tsx
  14. +14 −0 packages/app/main/package.json
  15. +37 −34 packages/app/main/src/commands.ts
  16. +0 −10 packages/app/main/src/emulator.ts
  17. +91 −0 packages/app/main/src/utils/__snapshots__/conversation.spec.ts.snap
  18. +50 −0 packages/app/main/src/utils/conversation.spec.ts
  19. +53 −0 packages/app/main/src/utils/conversation.ts
  20. +4 −1 packages/app/main/tsconfig.json
  21. +0 −8 packages/custom-botframework-directlinejs/.gitattributes
  22. +0 −8 packages/custom-botframework-directlinejs/.gitignore
  23. +0 −10 packages/custom-botframework-directlinejs/.npmignore
  24. +0 −22 packages/custom-botframework-directlinejs/LICENSE
  25. +0 −207 packages/custom-botframework-directlinejs/README.md
  26. +0 −9,183 packages/custom-botframework-directlinejs/package-lock.json
  27. +0 −41 packages/custom-botframework-directlinejs/package.json
  28. +0 −708 packages/custom-botframework-directlinejs/src/directLine.ts
  29. +0 −18 packages/custom-botframework-directlinejs/tsconfig.json
  30. +0 −25 packages/custom-botframework-directlinejs/webpack.config.js
  31. +0 −8 packages/custom-botframework-webchat/.gitattributes
  32. +0 −20 packages/custom-botframework-webchat/.gitignore
  33. +0 −4 packages/custom-botframework-webchat/.travis.yml
  34. +0 −101 packages/custom-botframework-webchat/AdaptiveCards.md
  35. +0 −5,076 packages/custom-botframework-webchat/CognitiveServices.js
  36. +0 −1 packages/custom-botframework-webchat/CognitiveServices.js.map
  37. +0 −22 packages/custom-botframework-webchat/LICENSE
  38. +0 −298 packages/custom-botframework-webchat/README.md
  39. +0 −121 packages/custom-botframework-webchat/adaptivecards-hostconfig.json
  40. +0 −13 packages/custom-botframework-webchat/botchat-fullwindow.css
  41. +0 −569 packages/custom-botframework-webchat/botchat.css
  42. +0 −49,140 packages/custom-botframework-webchat/botchat.js
  43. +0 −1 packages/custom-botframework-webchat/botchat.js.map
  44. +0 −17 packages/custom-botframework-webchat/built/ActivityView.d.ts
  45. +0 −44 packages/custom-botframework-webchat/built/ActivityView.js
  46. +0 −1 packages/custom-botframework-webchat/built/ActivityView.js.map
  47. +0 −23 packages/custom-botframework-webchat/built/AdaptiveCardContainer.d.ts
  48. +0 −156 packages/custom-botframework-webchat/built/AdaptiveCardContainer.js
  49. +0 −1 packages/custom-botframework-webchat/built/AdaptiveCardContainer.js.map
  50. +0 −3 packages/custom-botframework-webchat/built/App.d.ts
  51. +0 −13 packages/custom-botframework-webchat/built/App.js
  52. +0 −1 packages/custom-botframework-webchat/built/App.js.map
  53. +0 −14 packages/custom-botframework-webchat/built/Attachment.d.ts
  54. +0 −216 packages/custom-botframework-webchat/built/Attachment.js
  55. +0 −1 packages/custom-botframework-webchat/built/Attachment.js.map
  56. +0 −11 packages/custom-botframework-webchat/built/BotChat.d.ts
  57. +0 −21 packages/custom-botframework-webchat/built/BotChat.js
  58. +0 −1 packages/custom-botframework-webchat/built/BotChat.js.map
  59. +0 −23 packages/custom-botframework-webchat/built/CardBuilder.d.ts
  60. +0 −104 packages/custom-botframework-webchat/built/CardBuilder.js
  61. +0 −1 packages/custom-botframework-webchat/built/CardBuilder.js.map
  62. +0 −27 packages/custom-botframework-webchat/built/Carousel.d.ts
  63. +0 −46 packages/custom-botframework-webchat/built/Carousel.js
  64. +0 −1 packages/custom-botframework-webchat/built/Carousel.js.map
  65. +0 −57 packages/custom-botframework-webchat/built/Chat.d.ts
  66. +0 −258 packages/custom-botframework-webchat/built/Chat.js
  67. +0 −1 packages/custom-botframework-webchat/built/Chat.js.map
  68. +0 −25 packages/custom-botframework-webchat/built/CognitiveServices/SpeechRecognition.d.ts
  69. +0 −127 packages/custom-botframework-webchat/built/CognitiveServices/SpeechRecognition.js
  70. +0 −1 packages/custom-botframework-webchat/built/CognitiveServices/SpeechRecognition.js.map
  71. +0 −25 packages/custom-botframework-webchat/built/CognitiveServices/SpeechSynthesis.d.ts
  72. +0 −346 packages/custom-botframework-webchat/built/CognitiveServices/SpeechSynthesis.js
  73. +0 −1 packages/custom-botframework-webchat/built/CognitiveServices/SpeechSynthesis.js.map
  74. +0 −2 packages/custom-botframework-webchat/built/CognitiveServices/lib.d.ts
  75. +0 −8 packages/custom-botframework-webchat/built/CognitiveServices/lib.js
  76. +0 −1 packages/custom-botframework-webchat/built/CognitiveServices/lib.js.map
  77. +0 −7 packages/custom-botframework-webchat/built/FormattedText.d.ts
  78. +0 −58 packages/custom-botframework-webchat/built/FormattedText.js
  79. +0 −1 packages/custom-botframework-webchat/built/FormattedText.js.map
  80. +0 −29 packages/custom-botframework-webchat/built/HScroll.d.ts
  81. +0 −113 packages/custom-botframework-webchat/built/HScroll.js
  82. +0 −1 packages/custom-botframework-webchat/built/HScroll.js.map
  83. +0 −47 packages/custom-botframework-webchat/built/History.d.ts
  84. +0 −185 packages/custom-botframework-webchat/built/History.js
  85. +0 −1 packages/custom-botframework-webchat/built/History.js.map
  86. +0 −1 packages/custom-botframework-webchat/built/Konsole.d.ts
  87. +0 −7 packages/custom-botframework-webchat/built/Konsole.js
  88. +0 −1 packages/custom-botframework-webchat/built/Konsole.js.map
  89. +0 −8 packages/custom-botframework-webchat/built/MessagePane.d.ts
  90. +0 −22 packages/custom-botframework-webchat/built/MessagePane.js
  91. +0 −1 packages/custom-botframework-webchat/built/MessagePane.js.map
  92. +0 −6 packages/custom-botframework-webchat/built/Shell.d.ts
  93. +0 −117 packages/custom-botframework-webchat/built/Shell.js
  94. +0 −1 packages/custom-botframework-webchat/built/Shell.js.map
  95. +0 −60 packages/custom-botframework-webchat/built/SpeechModule.d.ts
  96. +0 −306 packages/custom-botframework-webchat/built/SpeechModule.js
  97. +0 −1 packages/custom-botframework-webchat/built/SpeechModule.js.map
  98. +0 −5 packages/custom-botframework-webchat/built/SpeechOptions.d.ts
  99. +0 −6 packages/custom-botframework-webchat/built/SpeechOptions.js
  100. +0 −1 packages/custom-botframework-webchat/built/SpeechOptions.js.map
  101. +0 −152 packages/custom-botframework-webchat/built/Store.d.ts
  102. +0 −348 packages/custom-botframework-webchat/built/Store.js
  103. +0 −1 packages/custom-botframework-webchat/built/Store.js.map
  104. +0 −19 packages/custom-botframework-webchat/built/Strings.d.ts
  105. +0 −475 packages/custom-botframework-webchat/built/Strings.js
  106. +0 −1 packages/custom-botframework-webchat/built/Strings.js.map
  107. +0 −10 packages/custom-botframework-webchat/built/SuggestedActions.d.ts
  108. +0 −59 packages/custom-botframework-webchat/built/SuggestedActions.js
  109. +0 −1 packages/custom-botframework-webchat/built/SuggestedActions.js.map
  110. +0 −8 packages/custom-botframework-webchat/built/Types.d.ts
  111. +0 −3 packages/custom-botframework-webchat/built/Types.js
  112. +0 −1 packages/custom-botframework-webchat/built/Types.js.map
  113. +0 −1 packages/custom-botframework-webchat/built/getTabIndex.d.ts
  114. +0 −24 packages/custom-botframework-webchat/built/getTabIndex.js
  115. +0 −1 packages/custom-botframework-webchat/built/getTabIndex.js.map
  116. +0 −1 packages/custom-botframework-webchat/dist/CognitiveServices.js
  117. +0 −1 packages/custom-botframework-webchat/dist/CognitiveServices.js.map
  118. +0 −37 packages/custom-botframework-webchat/dist/botchat.js
  119. +0 −15,489 packages/custom-botframework-webchat/package-lock.json
  120. +0 −69 packages/custom-botframework-webchat/package.json
  121. +0 −117 packages/custom-botframework-webchat/samples/backchannel/index.html
  122. +0 −69 packages/custom-botframework-webchat/samples/fullwindow/index.html
  123. +0 −70 packages/custom-botframework-webchat/samples/react/index.html
  124. +0 −115 packages/custom-botframework-webchat/samples/sidebar/index.html
  125. +0 −155 packages/custom-botframework-webchat/samples/speech/index.html
  126. +0 −89 packages/custom-botframework-webchat/src/ActivityView.tsx
  127. +0 −225 packages/custom-botframework-webchat/src/AdaptiveCardContainer.tsx
  128. +0 −16 packages/custom-botframework-webchat/src/App.tsx
  129. +0 −348 packages/custom-botframework-webchat/src/Attachment.tsx
  130. +0 −12 packages/custom-botframework-webchat/src/BotChat.ts
  131. +0 −133 packages/custom-botframework-webchat/src/CardBuilder.tsx
  132. +0 −88 packages/custom-botframework-webchat/src/Carousel.tsx
  133. +0 −379 packages/custom-botframework-webchat/src/Chat.tsx
  134. +0 −167 packages/custom-botframework-webchat/src/CognitiveServices/SpeechRecognition.ts
  135. +0 −393 packages/custom-botframework-webchat/src/CognitiveServices/SpeechSynthesis.ts
  136. +0 −2 packages/custom-botframework-webchat/src/CognitiveServices/lib.ts
  137. +0 −76 packages/custom-botframework-webchat/src/FormattedText.tsx
  138. +0 −164 packages/custom-botframework-webchat/src/HScroll.tsx
  139. +0 −298 packages/custom-botframework-webchat/src/History.tsx
  140. +0 −4 packages/custom-botframework-webchat/src/Konsole.ts
  141. +0 −35 packages/custom-botframework-webchat/src/MessagePane.tsx
  142. +0 −216 packages/custom-botframework-webchat/src/Shell.tsx
  143. +0 −378 packages/custom-botframework-webchat/src/SpeechModule.ts
  144. +0 −6 packages/custom-botframework-webchat/src/SpeechOptions.ts
  145. +0 −710 packages/custom-botframework-webchat/src/Store.ts
  146. +0 −479 packages/custom-botframework-webchat/src/Strings.ts
  147. +0 −85 packages/custom-botframework-webchat/src/SuggestedActions.tsx
  148. +0 −57 packages/custom-botframework-webchat/src/Timestamp.tsx
  149. +0 −10 packages/custom-botframework-webchat/src/Types.ts
  150. +0 −5 packages/custom-botframework-webchat/src/adaptivecards-hostconfig.d.ts
  151. +0 −24 packages/custom-botframework-webchat/src/getTabIndex.ts
  152. +0 −14 packages/custom-botframework-webchat/src/scss/botchat-fullwindow.scss
  153. +0 −771 packages/custom-botframework-webchat/src/scss/botchat.scss
  154. +0 −124 packages/custom-botframework-webchat/src/scss/includes/adaptive-card-config.scss
  155. +0 −13 packages/custom-botframework-webchat/src/scss/includes/card-size.scss
  156. +0 −25 packages/custom-botframework-webchat/src/scss/includes/colors.scss
  157. +0 −24 packages/custom-botframework-webchat/src/scss/includes/settings.scss
  158. +0 −25 packages/custom-botframework-webchat/tsconfig.json
  159. +0 −50 packages/custom-botframework-webchat/webpack.config.js
@@ -4,8 +4,6 @@
"packages/app/client",
"packages/app/main",
"packages/app/shared",
"packages/custom-botframework-webchat",
"packages/custom-botframework-directlinejs",
"packages/emulator/cli",
"packages/emulator/core",
"packages/sdk/client",
@@ -36,7 +36,7 @@ var gulp = require('gulp');
// TODO: We should expose CSS programmatically in Web Chat
gulp.task('copy:webchat:css', function () {
return gulp
.src(require.resolve('@bfemulator/custom-botframework-webchat/botchat.css'))
.src(require.resolve('botframework-webchat/botchat.css'))
.pipe(gulp.dest('./public/external/css'));
});
@@ -76,7 +76,6 @@
},
"dependencies": {
"@bfemulator/app-shared": "^1.0.0",
"@bfemulator/custom-botframework-webchat": "^0.11.5-c0",
"@bfemulator/sdk-client": "^1.0.0",
"@bfemulator/sdk-shared": "^1.0.0",
"@bfemulator/ui-react": "^1.0.0",
@@ -87,6 +86,7 @@
"@uifabric/styling": "^5.20.0",
"@uifabric/utilities": "^5.19.0",
"base64url": "^2.0.0",
"botframework-webchat": "^0.13.1",
"classnames": "^2.2.5",
"glamor": "^2.20.40",
"jsonpath": "^1.0.0",
@@ -165,7 +165,11 @@ export function registerCommands() {
store.dispatch(ChatActions.newDocument(
documentId,
'livechat',
{ endpointId: endpoint.id }
{
botId: 'bot',
endpointId: endpoint.id,
userId: 'default-user'
}
));
store.dispatch(EditorActions.open(
@@ -180,7 +184,15 @@ export function registerCommands() {
CommandRegistry.registerCommand('transcript:open', (filename: string, additionalData?: object) => {
const tabGroup = getTabGroupForDocument(filename);
if (!tabGroup) {
store.dispatch(ChatActions.newDocument(filename, 'transcript', additionalData));
store.dispatch(ChatActions.newDocument(
filename,
'transcript',
{
...additionalData,
botId: 'bot',
userId: 'default-user'
}
));
}
store.dispatch(EditorActions.open(
Constants.CONTENT_TYPE_TRANSCRIPT,
@@ -32,7 +32,6 @@
//
import { LogEntry } from '@bfemulator/app-shared';
import { createStore as createWebChatStore } from '@bfemulator/custom-botframework-webchat';
export const NEW_CHAT_DOCUMENT = 'CHAT/DOCUMENT/NEW';
export const OPEN_CHAT_DOCUMENT = 'CHAT/DOCUMENT/OPEN';
@@ -148,7 +147,6 @@ export function newDocument(documentId: string, mode: ChatMode, additionalData?:
mode,
documentId,
conversationId: null,
webChatStore: createWebChatStore(),
directLine: null,
log: {
entries: []
@@ -1,5 +1,4 @@
import '@bfemulator/app-shared';
import '@bfemulator/custom-botframework-webchat';
import '@bfemulator/ui-react';
import '@bfemulator/sdk-shared';
import '@bfemulator/sdk-client';
@@ -31,7 +31,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
import * as BotChat from '@bfemulator/custom-botframework-webchat';
import * as BotChat from 'botframework-webchat';
import { uniqueId } from '@bfemulator/sdk-shared';
import { Colors, Splitter } from '@bfemulator/ui-react';
@@ -138,20 +138,20 @@ const PRESENTATION_CSS = css({
export type EmulatorMode = 'transcript' | 'livechat';
interface EmulatorProps {
clearLog?: (documentId: string) => void;
conversationId?: string;
dirty?: boolean;
document?: any;
documentId?: string;
enablePresentationMode?: (enabled: boolean) => void;
endpointId?: string;
endpointService?: IEndpointService;
mode?: EmulatorMode;
newConversation?: (documentId: string, options: any) => void;
pingDocument?: (documentId: string) => void;
pingId?: number;
presentationModeEnabled?: boolean;
pingDocument?: (documentId: string) => void;
enablePresentationMode?: (enabled: boolean) => void;
setInspectorObjects?: (documentId: string, objects: any) => void;
clearLog?: (documentId: string) => void;
newConversation?: (documentId: string, options: any) => void;
updateDocument?: (documentId: string, updatedValues: any) => void;
}
@@ -234,16 +234,27 @@ class EmulatorComponent extends React.Component<EmulatorProps, {}> {
try {
// transcript was deep linked via protocol,
// and should just be fed its own activities attached to the document
await CommandServiceImpl
.remoteCall('emulator:feed-transcript:deep-link', conversation.conversationId, props.document.activities);
await CommandServiceImpl.remoteCall(
'emulator:feed-transcript:deep-link',
conversation.conversationId,
props.document.botId,
props.document.userId,
props.document.activities
);
} catch (err) {
throw new Error(`Error while feeding deep-linked transcript to conversation: ${err}`);
}
} else {
try {
// the transcript is on disk, so its activities need to be read on the main side and fed in
const fileInfo: { fileName: string, filePath: string } = await CommandServiceImpl
.remoteCall('emulator:feed-transcript:disk', conversation.conversationId, props.document.documentId);
const fileInfo: { fileName: string, filePath: string } = await CommandServiceImpl.remoteCall(
'emulator:feed-transcript:disk',
conversation.conversationId,
props.document.botId,
props.document.userId,
props.document.documentId
);
this.props.updateDocument(this.props.documentId, { fileName: fileInfo.fileName });
} catch (err) {
throw new Error(`Error while feeding transcript on disk to conversation: ${err}`);
@@ -257,7 +268,6 @@ class EmulatorComponent extends React.Component<EmulatorProps, {}> {
}
initConversation(props: any, options: any, selectedActivity$: any, subscription: any) {
const webChatStore = BotChat.createStore();
const encodedOptions = encode(JSON.stringify(options));
// TODO: We need to use encoded token because we need to pass both endpoint ID and conversation ID
@@ -270,7 +280,7 @@ class EmulatorComponent extends React.Component<EmulatorProps, {}> {
this.props.newConversation(props.documentId, {
conversationId: options.conversationId,
webChatStore,
// webChatStore,
directLine,
selectedActivity$,
subscription
Oops, something went wrong.

0 comments on commit f78d474

Please sign in to comment.