Skip to content

Commit

Permalink
Deprecation notes cleanup (#2918)
Browse files Browse the repository at this point in the history
* Fix #2845 - remove sendTyping prop and dep. notes

* Clean up deprecation notes

* Linting cleanup

* Update CHANGELOG.md
  • Loading branch information
corinagum authored Feb 19, 2020
1 parent 598c8cb commit 2ef4c64
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 88 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `core-js@3.5.0`
- Resolves [#2748](https://github.com/microsoft/BotFramework-WebChat/issues/2748), updated build scripts and CI pipeline, by [@compulim](https://github.com/compulim), in PR [#2767](https://github.com/microsoft/BotFramework-WebChat/pull/2767)
- `component`: Bumps [`react-film@2.0.2`](https://npmjs.com/package/react-film/), by [@tdurnford](https://github.com/tdurnford) in PR [#2801](https://github.com/microsoft/BotFramework-WebChat/pull/2801)
- Removes `sendTyping` and deprecation notes in PR [#2845](https://github.com/microsoft/BotFramework-WebChat/pull/2845), by [@corinagum](https://github.com/corinagum), in PR [#2918](https://github.com/microsoft/BotFramework-WebChat/pull/2918)

### Samples

Expand Down
18 changes: 0 additions & 18 deletions __tests__/sendTypingIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,6 @@ test('Send typing indicator', async () => {
await driver.wait(typingActivityReceived(), timeouts.directLine);
});

// TODO: [P3] Take this deprecation code out when releasing on or after January 13 2020
test('Send typing indicator using deprecated props', async () => {
const { driver, pageObjects } = await setupWebDriver({
props: { sendTyping: true }
});

await driver.wait(uiConnected(), timeouts.directLine);

await pageObjects.sendMessageViaSendBox('echo-typing', { waitForSend: true });

const input = await driver.findElement(By.css('input[type="text"]'));

await input.sendKeys('ABC');

// Typing indicator takes longer to come back
await driver.wait(typingActivityReceived(), timeouts.directLine);
});

test('typing indicator should display in SendBox', async () => {
const { driver, pageObjects } = await setupWebDriver({ props: { styleOptions: { typingAnimationBackgroundImage } } });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function createCognitiveServicesSpeechServicesPonyfillFactory({
}) {
if (!credentials && (authorizationToken || region || subscriptionKey)) {
console.warn(
'botframework-webchat: "authorizationToken", "region", and "subscriptionKey" are being deprecated and will be removed on or after 2020-12-17. Please use "credentials" instead.'
'botframework-webchat: "authorizationToken", "region", and "subscriptionKey" are deprecated and will be removed on or after 2020-12-17. Please use "credentials" instead.'
);

credentials = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test('upgrading string-based authorizationToken to credentials', async () => {
});

expect(consoleWarns[0]).toMatchInlineSnapshot(
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are being deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
);
});

Expand All @@ -65,7 +65,7 @@ test('upgrading Promise-based authorizationToken to credentials', async () => {
});

expect(consoleWarns[0]).toMatchInlineSnapshot(
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are being deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
);
});

Expand All @@ -85,7 +85,7 @@ test('upgrading function-based authorizationToken to credentials', async () => {
});

expect(consoleWarns[0]).toMatchInlineSnapshot(
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are being deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
);
});

Expand All @@ -105,7 +105,7 @@ test('upgrading Promise function-based authorizationToken to credentials', async
});

expect(consoleWarns[0]).toMatchInlineSnapshot(
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are being deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
);
});

Expand All @@ -125,7 +125,7 @@ test('upgrading string-based subscriptionKey to credentials', async () => {
});

expect(consoleWarns[0]).toMatchInlineSnapshot(
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are being deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
);
});

Expand All @@ -145,7 +145,7 @@ test('upgrading string-based subscriptionKey to credentials', async () => {
});

expect(consoleWarns[0]).toMatchInlineSnapshot(
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are being deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
);
});

Expand All @@ -165,7 +165,7 @@ test('upgrading function-based subscriptionKey to credentials', async () => {
});

expect(consoleWarns[0]).toMatchInlineSnapshot(
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are being deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
);
});

Expand All @@ -185,7 +185,7 @@ test('upgrading Promise function-based subscriptionKey to credentials', async ()
});

expect(consoleWarns[0]).toMatchInlineSnapshot(
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are being deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
`"botframework-webchat: \\"authorizationToken\\", \\"region\\", and \\"subscriptionKey\\" are deprecated and will be removed on or after 2020-12-17. Please use \\"credentials\\" instead."`
);
});

Expand Down
23 changes: 4 additions & 19 deletions packages/component/src/Composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ const Composer = ({
selectVoice,
sendBoxRef,
sendTimeout,
sendTyping,
sendTypingIndicator,
styleOptions,
styleSet,
Expand All @@ -159,18 +158,6 @@ const Composer = ({

const patchedDir = useMemo(() => (dir === 'ltr' || dir === 'rtl' ? dir : 'auto'), [dir]);
const patchedGrammars = useMemo(() => grammars || [], [grammars]);
const patchedSendTypingIndicator = useMemo(() => {
if (typeof sendTyping === 'undefined') {
return sendTypingIndicator;
}

// TODO: [P3] Take this deprecation code out when releasing on or after January 13 2020
console.warn(
'Web Chat: "sendTyping" has been renamed to "sendTypingIndicator". Please use "sendTypingIndicator" instead. This deprecation migration will be removed on or after January 13 2020.'
);

return sendTyping;
}, [sendTyping, sendTypingIndicator]);

const patchedStyleOptions = useMemo(() => {
const patchedStyleOptions = { ...styleOptions };
Expand Down Expand Up @@ -209,8 +196,8 @@ const Composer = ({
}, [dispatch, sendTimeout]);

useEffect(() => {
dispatch(setSendTypingIndicator(!!patchedSendTypingIndicator));
}, [dispatch, patchedSendTypingIndicator]);
dispatch(setSendTypingIndicator(!!sendTypingIndicator));
}, [dispatch, sendTypingIndicator]);

useEffect(() => {
dispatch(
Expand Down Expand Up @@ -308,7 +295,7 @@ const Composer = ({
scrollToEnd,
selectVoice: patchedSelectVoice,
sendBoxRef,
sendTypingIndicator: patchedSendTypingIndicator,
sendTypingIndicator,
setDictateAbortable,
styleOptions,
styleSet: patchedStyleSet,
Expand All @@ -332,7 +319,7 @@ const Composer = ({
internalRenderMarkdownInline,
patchedGrammars,
patchedSelectVoice,
patchedSendTypingIndicator,
sendTypingIndicator,
patchedStyleSet,
renderMarkdown,
scrollToEnd,
Expand Down Expand Up @@ -402,7 +389,6 @@ Composer.defaultProps = {
selectVoice: undefined,
sendBoxRef: undefined,
sendTimeout: undefined,
sendTyping: undefined,
sendTypingIndicator: false,
styleOptions: {},
styleSet: undefined,
Expand Down Expand Up @@ -444,7 +430,6 @@ Composer.propTypes = {
current: PropTypes.any
}),
sendTimeout: PropTypes.number,
sendTyping: PropTypes.bool,
sendTypingIndicator: PropTypes.bool,
styleOptions: PropTypes.any,
styleSet: PropTypes.any,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Timestamp = ({ activity: { timestamp }, 'aria-hidden': ariaHidden, classNa

timestampStyleSet &&
console.warn(
'Web Chat: styleSet.timestamp is being deprecated. Please use styleSet.sendStatus. This deprecation migration will be removed on or after December 31, 2021.'
'Web Chat: styleSet.timestamp is deprecated. Please use styleSet.sendStatus. This deprecation migration will be removed on or after December 31, 2021.'
);

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/component/src/Styles/StyleSet/SpinnerAnimation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packages/component/src/Styles/createStyleSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default function createStyleSet(options) {

if (bubbleBorder) {
console.warn(
'Web Chat: styleSet.bubbleBorder is being deprecated. Please use bubbleBorderColor, bubbleBorderStyle, and, bubbleBorderWidth.'
'Web Chat: styleSet.bubbleBorder is deprecated. Please use bubbleBorderColor, bubbleBorderStyle, and, bubbleBorderWidth.'
);

const { color, style, width } = parseBorder(bubbleBorder);
Expand All @@ -99,7 +99,7 @@ export default function createStyleSet(options) {

if (bubbleFromUserBorder) {
console.warn(
'Web Chat: styleSet.bubbleFromUserBorder is being deprecated. Please use bubbleFromUserBorderColor, bubbleFromUserBorderStyle, and, bubbleFromUserBorderWidth.'
'Web Chat: styleSet.bubbleFromUserBorder is deprecated. Please use bubbleFromUserBorderColor, bubbleFromUserBorderStyle, and, bubbleFromUserBorderWidth.'
);

const { color, style, width } = parseBorder(bubbleFromUserBorder);
Expand All @@ -119,7 +119,7 @@ export default function createStyleSet(options) {

if (suggestedActionBorder) {
console.warn(
'Web Chat: styleSet.suggestedActionBorder is being deprecated. Please use suggestedActionBorderColor, suggestedActionBorderStyle, and, suggestedActionBorderWidth.'
'Web Chat: styleSet.suggestedActionBorder is deprecated. Please use suggestedActionBorderColor, suggestedActionBorderStyle, and, suggestedActionBorderWidth.'
);

const { color, style, width } = parseBorder(suggestedActionBorder);
Expand All @@ -139,7 +139,7 @@ export default function createStyleSet(options) {

if (suggestedActionDisabledBorder) {
console.warn(
'Web Chat: styleSet.suggestedActionDisabledBorder is being deprecated. Please use suggestedActionDisabledBorderColor, suggestedActionDisabledBorderStyle, and, suggestedActionDisabledBorderWidth.'
'Web Chat: styleSet.suggestedActionDisabledBorder is deprecated. Please use suggestedActionDisabledBorderColor, suggestedActionDisabledBorderStyle, and, suggestedActionDisabledBorderWidth.'
);

const { color, style, width } = parseBorder(suggestedActionDisabledBorder);
Expand Down
12 changes: 0 additions & 12 deletions packages/core/src/actions/setSendTyping.js

This file was deleted.

5 changes: 1 addition & 4 deletions packages/core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import setLanguage from './actions/setLanguage';
import setNotification from './actions/setNotification';
import setSendBox from './actions/setSendBox';
import setSendTimeout from './actions/setSendTimeout';
import setSendTyping from './actions/setSendTyping';
import setSendTypingIndicator from './actions/setSendTypingIndicator';
import startDictate from './actions/startDictate';
import startSpeakingActivity from './actions/startSpeakingActivity';
Expand Down Expand Up @@ -60,7 +59,5 @@ export {
stopDictate,
stopSpeakingActivity,
submitSendBox,
version,
// TODO: [P3] Take this deprecation code out when releasing on or after January 13 2020
setSendTyping
version
};
5 changes: 1 addition & 4 deletions packages/core/src/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,5 @@ export default combineReducers({
sendTimeout,
sendTypingIndicator,
shouldSpeakIncomingActivity,
suggestedActions,

// TODO: [P3] Take this deprecation code out when releasing on or after January 13 2020
sendTyping: sendTypingIndicator
suggestedActions
});
9 changes: 0 additions & 9 deletions packages/core/src/reducers/sendTypingIndicator.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
import { SET_SEND_TYPING } from '../actions/setSendTyping';
import { SET_SEND_TYPING_INDICATOR } from '../actions/setSendTypingIndicator';

const DEFAULT_STATE = false;

export default function sendTypingIndicator(state = DEFAULT_STATE, { payload, type }) {
switch (type) {
// TODO: [P3] Take this deprecation code out when releasing on or after 2020 January 13
case SET_SEND_TYPING:
console.warn(
'Web Chat: "sendTyping" has been renamed to "sendTypingIndicator". Please use "sendTypingIndicator" instead. This deprecation migration will be removed on or after January 13 2020.'
);
state = payload.sendTyping;
break;

case SET_SEND_TYPING_INDICATOR:
state = payload.sendTypingIndicator;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import { call, cancel, put, select, take, takeLatest } from 'redux-saga/effects';

import { SET_SEND_BOX } from '../actions/setSendBox';
import { SET_SEND_TYPING } from '../actions/setSendTyping';
import { SET_SEND_TYPING_INDICATOR } from '../actions/setSendTypingIndicator';
import { POST_ACTIVITY } from '../actions/postActivity';
import emitTypingIndicator from '../actions/emitTypingIndicator';
Expand All @@ -15,12 +14,7 @@ import whileConnected from './effects/whileConnected';
const SEND_INTERVAL = 3000;

function takeSendTypingIndicator(value) {
return take(
({ payload, type }) =>
(type === SET_SEND_TYPING_INDICATOR && !payload.sendTypingIndicator === !value) ||
// TODO: [P3] Take this deprecation code out when releasing on or after January 13 2020
(type === SET_SEND_TYPING && !payload.sendTyping === !value)
);
return take(({ payload, type }) => type === SET_SEND_TYPING_INDICATOR && !payload.sendTypingIndicator === !value);
}

function* sendTypingIndicatorOnSetSendBox() {
Expand Down

0 comments on commit 2ef4c64

Please sign in to comment.