-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
FullReactWebChat.js
47 lines (39 loc) · 1.51 KB
/
FullReactWebChat.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import BasicWebChat from 'botframework-webchat-component';
import PropTypes from 'prop-types';
import React, { useEffect } from 'react';
import AdaptiveCardsComposer from './adaptiveCards/AdaptiveCardsComposer';
import useComposerProps from './useComposerProps';
// Add additional props to <WebChat>, so it support additional features
const FullReactWebChat = props => {
const { adaptiveCardHostConfig, adaptiveCardsHostConfig, adaptiveCardsPackage, ...otherProps } = props;
useEffect(() => {
adaptiveCardHostConfig &&
console.warn(
'Web Chat: "adaptiveCardHostConfig" is deprecated. Please use "adaptiveCardsHostConfig" instead. "adaptiveCardHostConfig" will be removed on or after 2022-01-01.'
);
}, [adaptiveCardHostConfig]);
const composerProps = useComposerProps(props);
return (
<AdaptiveCardsComposer
adaptiveCardsHostConfig={adaptiveCardHostConfig || adaptiveCardsHostConfig}
adaptiveCardsPackage={adaptiveCardsPackage}
>
<BasicWebChat {...otherProps} {...composerProps} />
</AdaptiveCardsComposer>
);
};
FullReactWebChat.defaultProps = {
...BasicWebChat.defaultProps,
adaptiveCardHostConfig: undefined,
adaptiveCardsHostConfig: undefined,
adaptiveCardsPackage: undefined,
renderMarkdown: undefined
};
FullReactWebChat.propTypes = {
...BasicWebChat.propTypes,
adaptiveCardHostConfig: PropTypes.any,
adaptiveCardsHostConfig: PropTypes.any,
adaptiveCardsPackage: PropTypes.any,
renderMarkdown: PropTypes.func
};
export default FullReactWebChat;