forked from microsoft/BotFramework-WebChat
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathReactWebChat.tsx
More file actions
48 lines (38 loc) · 1.4 KB
/
Copy pathReactWebChat.tsx
File metadata and controls
48 lines (38 loc) · 1.4 KB
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
48
import PropTypes from 'prop-types';
import React from 'react';
import BasicWebChat from './BasicWebChat';
import Composer, { ComposerProps } from './Composer';
// Please keep this file as simple as possible. This is for setting up the surface (a.k.a. <Composer>) and <BasicWebChat> only.
// Web developers may choose to put things before/after <BasicWebChat> while still inside the surface.
// For example,
// - They can hide our default send box and built their own using hooks
// - They can run hooks outside of activity/attachment middleware
// - They will put <Composer> as very top of their page, and allow buttons on their existing page to send message to bot
type ReactWebChatProps = Readonly<
Omit<ComposerProps, 'children'> & {
className?: string | undefined;
role?: string | undefined;
}
>;
const ReactWebChat = ({ className, role, ...composerProps }: ReactWebChatProps) => (
<Composer {...composerProps}>
<BasicWebChat className={className} role={role} />
</Composer>
);
ReactWebChat.defaultProps = {
className: undefined,
role: undefined,
...Composer.defaultProps
};
const {
// Excluding "children" from ComposerProps.
children: _,
...composerPropTypesWithoutChildren
} = Composer.propTypes;
ReactWebChat.propTypes = {
className: PropTypes.string,
role: PropTypes.string,
...composerPropTypesWithoutChildren
};
export default ReactWebChat;
export type { ReactWebChatProps };