-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Refactor API into new api package
#3543
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
Merged
Merged
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
0e42d55
Add API package
compulim 3dbd54c
Continue refactoring
compulim e8d35d4
Continue refactoring
compulim 7fa38cb
Fix tests
compulim 322c348
Fix DLSpeech
compulim 7c03f55
Fix speech support
compulim 83c0167
Fix tests
compulim 740d68e
Fix ESLint
compulim f5bf5e5
Fix tests
compulim f47d919
Fix ESLint
compulim 20f4409
Fix all TODOs
compulim b9127af
Add back localize
compulim c301e36
Clean up
compulim ab145f9
Add entry
compulim bd57a2f
Apply suggestions from code review
compulim 9948953
Apply PR suggestions
compulim 438de16
Fix tests
compulim 01fbc0e
Fix tests
compulim 4dccb85
Fix tests
compulim d8838f4
Fix tests
compulim 0ecfd60
Remove eslint-disable
compulim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+41.5 KB
...ots__/chrome-docker/adaptive-cards-js-broken-card-of-invalid-version-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+159 KB
__tests__/__image_snapshots__/chrome-docker/upload-js-upload-a-picture-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.09 KB
(120%)
...js-accessibility-requirement-attachments-in-live-region-unknown-card-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.75 KB
...eprecated-localize-js-deprecated-localize-should-localize-text-in-en-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.75 KB
...ze-js-deprecated-localize-should-localize-text-in-navigator-language-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.96 KB
...precated-localize-js-deprecated-localize-should-localize-text-in-yue-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36 KB
...ots__/html/hero-card-actions-js-hero-card-actions-message-back-value-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+78.3 KB
...-render-attachment-js-use-render-attachment-should-render-attachment-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en-US"> | ||
| <head> | ||
| <script crossorigin="anonymous" src="/__dist__/testharness.js"></script> | ||
| <script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script> | ||
| </head> | ||
| <body> | ||
| <div id="webchat"></div> | ||
| <script type="text/babel" data-presets="env,stage-3,react"> | ||
| const { | ||
| WebChat: { | ||
| Components: { Composer, Localize } | ||
| }, | ||
| WebChatTest: { | ||
| conditions, | ||
| createStore, | ||
| expect, | ||
| host, | ||
| pageObjects, | ||
| parseURLParams, | ||
| shareObservable, | ||
| timeouts, | ||
| token: { fetchDirectLineToken }, | ||
| updateIn | ||
| } | ||
| } = window; | ||
|
|
||
| (async function () { | ||
| const token = await fetchDirectLineToken(); | ||
| const { l: locale } = parseURLParams(window.location.hash); | ||
|
|
||
| await new Promise(resolve => | ||
| ReactDOM.render( | ||
| <Composer directLine={window.WebChat.createDirectLine({ token })} locale={locale} store={createStore()}> | ||
| <Localize text="SPEECH_INPUT_LISTENING" /> | ||
| </Composer>, | ||
| document.getElementById('webchat'), | ||
| resolve | ||
| ) | ||
| ); | ||
|
|
||
| await host.snapshot(); | ||
| await host.done(); | ||
| })().catch(async err => { | ||
| console.error(err); | ||
|
|
||
| await host.error(err); | ||
| }); | ||
| </script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @jest-environment ./__tests__/html/__jest__/WebChatEnvironment.js | ||
| */ | ||
|
|
||
| describe('deprecated <Localize>', () => { | ||
| test('should localize text in navigator language', () => runHTMLTest('deprecated.localize.html')); | ||
| test('should localize text in "en"', () => runHTMLTest('deprecated.localize.html#l=en')); | ||
| test('should localize text in "yue"', () => runHTMLTest('deprecated.localize.html#l=yue')); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en-US"> | ||
| <head> | ||
| <script crossorigin="anonymous" src="/__dist__/testharness.js"></script> | ||
| <script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script> | ||
| </head> | ||
| <body> | ||
| <div id="webchat"></div> | ||
| <script type="text/babel" data-presets="env,stage-3,react"> | ||
| const { | ||
| ReactDOM: { render }, | ||
| WebChat: { | ||
| Components: { Composer }, | ||
| hooks: { useActivities, useRenderAttachment } | ||
| }, | ||
| WebChatTest: { conditions, createDirectLineWithTranscript, createStore, host, pageObjects, timeouts, token } | ||
| } = window; | ||
|
|
||
| (async function () { | ||
| const Test = () => { | ||
| const [[activity]] = useActivities(); | ||
| const renderAttachment = useRenderAttachment(); | ||
|
|
||
| if (!activity) { | ||
| return false; | ||
| } | ||
|
|
||
| const attachment = renderAttachment({ activity, attachment: activity.attachments[0] }); | ||
|
|
||
| return ( | ||
| <React.Fragment> | ||
| {attachment} | ||
| {!!attachment && <div className="done" />} | ||
| </React.Fragment> | ||
| ); | ||
| }; | ||
|
|
||
| const directLine = await createDirectLineWithTranscript([ | ||
| { | ||
| attachments: [ | ||
| { | ||
| contentType: 'image/png', | ||
| contentUrl: | ||
| 'https://raw.githubusercontent.com/compulim/BotFramework-MockBot/master/public/assets/surface1.jpg' | ||
| } | ||
| ], | ||
| from: { role: 'bot' }, | ||
| id: '1.0', | ||
| text: 'Nostrud in dolor Lorem nulla esse anim nisi adipisicing do nisi.', | ||
| timestamp: 0, | ||
| type: 'message' | ||
| } | ||
| ]); | ||
|
|
||
| const store = createStore(); | ||
|
|
||
| render( | ||
| <Composer directLine={directLine} store={store}> | ||
| <Test /> | ||
| </Composer>, | ||
| document.getElementById('webchat') | ||
| ); | ||
|
|
||
| await pageObjects.wait(conditions.uiConnected(), timeouts.directLine); | ||
| await pageObjects.wait(() => document.querySelector('.done'), timeouts.ui); | ||
| await pageObjects.wait(conditions.allImagesLoaded(), timeouts.ui); | ||
|
|
||
| await host.snapshot(); | ||
| await host.done(); | ||
| })().catch(async err => { | ||
| console.error(err); | ||
|
|
||
| await host.error(err); | ||
| }); | ||
| </script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| /** | ||
| * @jest-environment ./__tests__/html/__jest__/WebChatEnvironment.js | ||
| */ | ||
|
|
||
| describe('useRenderAttachment', () => { | ||
| test('should render attachment', () => runHTMLTest('hooks.useRenderAttachment.html')); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.