Skip to content

Commit c3857bf

Browse files
authored
* Bump [email protected] * Update PR number * Fix mock module name * Fix unit test
1 parent 3d90e54 commit c3857bf

7 files changed

+57
-104
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
9393
- Switched math block syntax from `$$` to Tex-style `\[ \]` and `\( \)` delimiters with improved rendering and error handling, in PR [#5353](https://github.com/microsoft/BotFramework-WebChat/pull/5353), by [@OEvgeny](https://github.com/OEvgeny)
9494
- Improved avatar display and grouping behavior by fixing rendering issues and activity sender identification, in PR [#5346](https://github.com/microsoft/BotFramework-WebChat/pull/5346), by [@OEvgeny](https://github.com/OEvgeny)
9595
- Activity "copy" button will use `outerHTML` and `textContent` for clipboard content, in PR [#5378](https://github.com/microsoft/BotFramework-WebChat/pull/5378), by [@compulim](https://github.com/compulim)
96+
- Bumped dependencies to the latest versions, by [@compulim](https://github.com/compulim) in PR [#5385](https://github.com/microsoft/BotFramework-WebChat/pull/5385)
97+
- Production dependencies
98+
- [`[email protected]`](https://npmjs.com/package/web-speech-cognitive-services)
9699

97100
### Fixed
98101

@@ -106,10 +109,11 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
106109
- Fixes [#5319](https://github.com/microsoft/BotFramework-WebChat/issues/5319). Some Markdown text are not rendered after HTML tags, in PR [#5320](https://github.com/microsoft/BotFramework-WebChat/pull/5320), by [@compulim](https://github.com/compulim)
107110
- Fixes [#5323](https://github.com/microsoft/BotFramework-WebChat/issues/5323). Removed unused CSS class from carousel component, eliminating unintended styling, in PR [#5325](https://github.com/microsoft/BotFramework-WebChat/pull/5325), by [@OEvgeny](https://github.com/OEvgeny)
108111
- Resolved CSS class name conflicts between component and fluent packages to prevent styling issues, in PR [#5326](https://github.com/microsoft/BotFramework-WebChat/pull/5326), in PR [#5327](https://github.com/microsoft/BotFramework-WebChat/pull/5327), by [@OEvgeny](https://github.com/OEvgeny)
109-
- Fixed [#5350](https://github.com/microsoft/BotFramework-WebChat/issues/pull/5350). Bundled `shiki` in component package, in PR [#5349](https://github.com/microsoft/BotFramework-WebChat/pull5349), by [@compulim](https://github.com/compulim)
112+
- Fixed [#5350](https://github.com/microsoft/BotFramework-WebChat/issues/5350). Bundled `shiki` in component package, in PR [#5349](https://github.com/microsoft/BotFramework-WebChat/pull/5349), by [@compulim](https://github.com/compulim)
110113
- Fixed modal dialog rendering to prevent visual flicker and improve UX when opening code views, in PR [#5374](https://github.com/microsoft/BotFramework-WebChat/pull/5374), by [@OEvgeny](https://github.com/OEvgeny)
111114
- Fixed math parsing that could cause Web Chat to hang when processing certain LaTeX expressions, in PR [#5377](https://github.com/microsoft/BotFramework-WebChat/pull/5377), by [@OEvgeny](https://github.com/OEvgeny)
112115
- Fixed long math formula should be scrollable, in PR [#5380](https://github.com/microsoft/BotFramework-WebChat/pull/5380), by [@compulim](https://github.com/compulim)
116+
- Fixed [#4948](https://github.com/microsoft/BotFramework-WebChat/issues/4948). Microphone should stop after initial silence, in PR [#5385](https://github.com/microsoft/BotFramework-WebChat/pull/5385)
113117

114118
# Removed
115119

package-lock.json

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

packages/bundle/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
"swiper": "8.4.7",
142142
"url-search-params-polyfill": "8.2.5",
143143
"uuid": "8.3.2",
144-
"web-speech-cognitive-services": "7.1.3",
144+
"web-speech-cognitive-services": "^8.0.0",
145145
"whatwg-fetch": "3.6.20"
146146
},
147147
"devDependencies": {

packages/bundle/src/createCognitiveServicesSpeechServicesPonyfillFactory.spec.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
/* eslint-disable no-global-assign */
1010
let consoleWarns;
1111
let createCognitiveServicesSpeechServicesPonyfillFactory;
12-
let createPonyfill;
12+
let createSpeechServicesPonyfill;
1313
let originalConsole;
1414

1515
beforeEach(() => {
16-
jest.mock('web-speech-cognitive-services/lib/SpeechServices', () => jest.fn(() => ({})));
16+
jest.mock('web-speech-cognitive-services', () => ({
17+
createSpeechServicesPonyfill: jest.fn(() => ({}))
18+
}));
1719
jest.mock('microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/Exports', () => ({
1820
...jest.requireActual('microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/Exports'),
1921
PcmRecorder: class MockPcmRecorder {
@@ -34,7 +36,7 @@ beforeEach(() => {
3436
warn: text => consoleWarns.push(text)
3537
};
3638

37-
createPonyfill = require('web-speech-cognitive-services/lib/SpeechServices');
39+
createSpeechServicesPonyfill = require('web-speech-cognitive-services').createSpeechServicesPonyfill;
3840
createCognitiveServicesSpeechServicesPonyfillFactory =
3941
require('./createCognitiveServicesSpeechServicesPonyfillFactory').default;
4042

@@ -75,7 +77,7 @@ test('providing reference grammar ID', () => {
7577

7678
ponyfillFactory({ referenceGrammarID: 'a1b2c3d' });
7779

78-
const { referenceGrammars } = createPonyfill.mock.calls[0][0];
80+
const { referenceGrammars } = createSpeechServicesPonyfill.mock.calls[0][0];
7981

8082
expect(referenceGrammars).toEqual(['luis/a1b2c3d-PRODUCTION']);
8183
});
@@ -90,7 +92,7 @@ test('not providing reference grammar ID', () => {
9092

9193
ponyfillFactory({});
9294

93-
const { referenceGrammars } = createPonyfill.mock.calls[0][0];
95+
const { referenceGrammars } = createSpeechServicesPonyfill.mock.calls[0][0];
9496

9597
expect(referenceGrammars).toEqual([]);
9698
});
@@ -109,7 +111,7 @@ test('supplying audioInputDeviceId', async () => {
109111
ponyfillFactory({});
110112

111113
// WHEN: Audio source is attached and audio device is opened.
112-
await createPonyfill.mock.calls[0][0].audioConfig.privSource.attach();
114+
await createSpeechServicesPonyfill.mock.calls[0][0].audioConfig.privSource.attach();
113115

114116
// THEN: It should call getUserMedia() with "audio" constraints of { deviceId: 'audio-input-device-1' }.
115117
expect(window.navigator.mediaDevices.getUserMedia.mock.calls[0][0]).toHaveProperty(
@@ -138,7 +140,7 @@ test('supplying both audioConfig and audioInputDeviceId', () => {
138140
`"botframework-webchat: \\"audioConfig\\" and \\"audioInputDeviceId\\" cannot be set at the same time; ignoring \\"audioInputDeviceId\\"."`
139141
);
140142

141-
expect(createPonyfill.mock.calls[0][0].audioConfig).toBe(audioConfig);
143+
expect(createSpeechServicesPonyfill.mock.calls[0][0].audioConfig).toBe(audioConfig);
142144
});
143145

144146
test('unsupported environment', () => {
@@ -176,5 +178,5 @@ test('unsupported environment with audioConfig', () => {
176178
ponyfillFactory({});
177179

178180
expect(consoleWarns).toHaveProperty('length', 0);
179-
expect(createPonyfill.mock.calls[0][0].audioConfig).toBe(audioConfig);
181+
expect(createSpeechServicesPonyfill.mock.calls[0][0].audioConfig).toBe(audioConfig);
180182
});

packages/bundle/src/createCognitiveServicesSpeechServicesPonyfillFactory.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { AudioConfig } from 'microsoft-cognitiveservices-speech-sdk';
21
import { WebSpeechPonyfillFactory } from 'botframework-webchat-api';
3-
import createPonyfill from 'web-speech-cognitive-services/lib/SpeechServices';
2+
import { AudioConfig } from 'microsoft-cognitiveservices-speech-sdk';
3+
import { createSpeechServicesPonyfill } from 'web-speech-cognitive-services';
44

5+
import createMicrophoneAudioConfigAndAudioContext from './speech/createMicrophoneAudioConfigAndAudioContext';
56
import CognitiveServicesAudioOutputFormat from './types/CognitiveServicesAudioOutputFormat';
67
import CognitiveServicesCredentials from './types/CognitiveServicesCredentials';
78
import CognitiveServicesTextNormalization from './types/CognitiveServicesTextNormalization';
8-
import createMicrophoneAudioConfigAndAudioContext from './speech/createMicrophoneAudioConfigAndAudioContext';
99

1010
export default function createCognitiveServicesSpeechServicesPonyfillFactory({
1111
audioConfig,
@@ -55,17 +55,18 @@ export default function createCognitiveServicesSpeechServicesPonyfillFactory({
5555
}
5656

5757
return ({ referenceGrammarID } = {}) => {
58-
const { SpeechGrammarList, SpeechRecognition, speechSynthesis, SpeechSynthesisUtterance } = createPonyfill({
59-
audioConfig,
60-
audioContext,
61-
credentials,
62-
enableTelemetry,
63-
referenceGrammars: referenceGrammarID ? [`luis/${referenceGrammarID}-PRODUCTION`] : [],
64-
speechRecognitionEndpointId,
65-
speechSynthesisDeploymentId,
66-
speechSynthesisOutputFormat,
67-
textNormalization
68-
});
58+
const { SpeechGrammarList, SpeechRecognition, speechSynthesis, SpeechSynthesisUtterance } =
59+
createSpeechServicesPonyfill({
60+
audioConfig,
61+
audioContext,
62+
credentials,
63+
enableTelemetry,
64+
referenceGrammars: referenceGrammarID ? [`luis/${referenceGrammarID}-PRODUCTION`] : [],
65+
speechRecognitionEndpointId,
66+
speechSynthesisDeploymentId,
67+
speechSynthesisOutputFormat,
68+
textNormalization
69+
});
6970

7071
return {
7172
resumeAudioContext: () => audioContext && audioContext.state === 'suspended' && audioContext.resume(),

packages/directlinespeech/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
"event-target-shim": "6.0.2",
121121
"math-random": "2.0.1",
122122
"microsoft-cognitiveservices-speech-sdk": "1.17.0",
123-
"web-speech-cognitive-services": "7.1.3"
123+
"web-speech-cognitive-services": "^8.0.0"
124124
},
125125
"engines": {
126126
"node": ">= 10.14.2"

packages/directlinespeech/src/createWebSpeechPonyfillFactory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint class-methods-use-this: ["error", { "exceptMethods": ["cancel", "getVoices", "speak"] }] */
22

33
import { AbortController } from 'abort-controller-es5';
4-
import { createSpeechRecognitionPonyfillFromRecognizer } from 'web-speech-cognitive-services/lib/SpeechServices/SpeechToText.js';
4+
import { createSpeechRecognitionPonyfillFromRecognizer } from 'web-speech-cognitive-services';
55

66
import createTaskQueue from './createTaskQueue';
77
import EventTarget, { Event, getEventAttributeValue, setEventAttributeValue } from 'event-target-shim';

0 commit comments

Comments
 (0)