diff --git a/THIRD-PARTY-NOTICES b/THIRD-PARTY-NOTICES index b46b1d2..79490d4 100644 --- a/THIRD-PARTY-NOTICES +++ b/THIRD-PARTY-NOTICES @@ -65,7 +65,7 @@ SOFTWARE. The following npm packages may be included in this product: - @types/hast@2.3.4 - - @types/mdast@3.0.11 + - @types/mdast@3.0.12 - @types/parse5@5.0.3 - @types/prop-types@15.7.5 - @types/react-dom@18.2.4 diff --git a/docs/chat-ui-react.chatpanelprops.footer.md b/docs/chat-ui-react.chatpanelprops.footer.md new file mode 100644 index 0000000..4778530 --- /dev/null +++ b/docs/chat-ui-react.chatpanelprops.footer.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-ui-react](./chat-ui-react.md) > [ChatPanelProps](./chat-ui-react.chatpanelprops.md) > [footer](./chat-ui-react.chatpanelprops.footer.md) + +## ChatPanelProps.footer property + +A footer component to render at the bottom of the panel + +**Signature:** + +```typescript +footer?: React.ReactNode; +``` diff --git a/docs/chat-ui-react.chatpanelprops.header.md b/docs/chat-ui-react.chatpanelprops.header.md index dd3ac55..00d1d60 100644 --- a/docs/chat-ui-react.chatpanelprops.header.md +++ b/docs/chat-ui-react.chatpanelprops.header.md @@ -9,5 +9,5 @@ A header to render at the top of the panel. **Signature:** ```typescript -header?: JSX.Element; +header?: React.ReactNode; ``` diff --git a/docs/chat-ui-react.chatpanelprops.md b/docs/chat-ui-react.chatpanelprops.md index d866aff..76a677c 100644 --- a/docs/chat-ui-react.chatpanelprops.md +++ b/docs/chat-ui-react.chatpanelprops.md @@ -18,5 +18,6 @@ export interface ChatPanelProps extends Omit, Omit +export interface ChatPopUpProps extends Omit, Omit ``` -**Extends:** Omit<[ChatHeaderProps](./chat-ui-react.chatheaderprops.md), "showCloseButton" \| "customCssClasses">, Omit<[ChatPanelProps](./chat-ui-react.chatpanelprops.md), "header" \| "customCssClasses"> +**Extends:** Omit<[ChatHeaderProps](./chat-ui-react.chatheaderprops.md), "showCloseButton" \| "customCssClasses">, Omit<[ChatPanelProps](./chat-ui-react.chatpanelprops.md), "customCssClasses"> ## Properties diff --git a/etc/chat-ui-react.api.md b/etc/chat-ui-react.api.md index 6c21a5f..33306af 100644 --- a/etc/chat-ui-react.api.md +++ b/etc/chat-ui-react.api.md @@ -82,7 +82,8 @@ export interface ChatPanelCssClasses { // @public export interface ChatPanelProps extends Omit, Omit { customCssClasses?: ChatPanelCssClasses; - header?: JSX.Element; + footer?: React_2.ReactNode; + header?: React_2.ReactNode; } // @public @@ -113,7 +114,7 @@ export interface ChatPopUpCssClasses { } // @public -export interface ChatPopUpProps extends Omit, Omit { +export interface ChatPopUpProps extends Omit, Omit { customCssClasses?: ChatPopUpCssClasses; openPanelButtonIcon?: JSX.Element; } diff --git a/package-lock.json b/package-lock.json index 785b3f9..441e727 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/chat-ui-react", - "version": "0.7.1", + "version": "0.7.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@yext/chat-ui-react", - "version": "0.7.1", + "version": "0.7.2", "license": "BSD-3-Clause", "dependencies": { "react-markdown": "^6.0.3", @@ -9135,11 +9135,11 @@ "dev": true }, "node_modules/@types/mdast": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.11.tgz", - "integrity": "sha512-Y/uImid8aAwrEA24/1tcRZwpxX3pIFTSilcNDKSPn+Y2iDywSEachzRuvgAYYLR3wpGXAsMbv5lvKLDZLeYPAw==", + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.12.tgz", + "integrity": "sha512-DT+iNIRNX884cx0/Q1ja7NyUPpZuv0KPyL5rGNxm1WC1OtHstl7n4Jb7nk+xacNShQMbczJjt8uFzznpp6kYBg==", "dependencies": { - "@types/unist": "*" + "@types/unist": "^2" } }, "node_modules/@types/mdx": { diff --git a/src/components/ChatPanel.tsx b/src/components/ChatPanel.tsx index 2afc422..baf648c 100644 --- a/src/components/ChatPanel.tsx +++ b/src/components/ChatPanel.tsx @@ -48,7 +48,11 @@ export interface ChatPanelProps extends Omit, Omit { /** A header to render at the top of the panel. */ - header?: JSX.Element; + header?: React.ReactNode; + /** + * A footer component to render at the bottom of the panel + */ + footer?: React.ReactNode; /** * CSS classes for customizing the component styling. */ @@ -65,7 +69,7 @@ export interface ChatPanelProps * @param props - {@link ChatPanelProps} */ export function ChatPanel(props: ChatPanelProps) { - const { header, customCssClasses } = props; + const { header, customCssClasses, footer } = props; const chat = useChatActions(); const messages = useChatState((state) => state.conversation.messages); const loading = useChatState((state) => state.conversation.isLoading); @@ -125,10 +129,7 @@ export function ChatPanel(props: ChatPanelProps) {
{header}
-
+
{messages.map((message, index) => (
+ {footer}
); diff --git a/src/components/ChatPopUp.tsx b/src/components/ChatPopUp.tsx index 3f69afb..54caf2b 100644 --- a/src/components/ChatPopUp.tsx +++ b/src/components/ChatPopUp.tsx @@ -64,7 +64,7 @@ const builtInCssClasses: ChatPopUpCssClasses = withStylelessCssClasses( */ export interface ChatPopUpProps extends Omit, - Omit { + Omit { /** Custom icon for the popup button to open the panel. */ openPanelButtonIcon?: JSX.Element; /** @@ -88,6 +88,8 @@ export function ChatPopUp(props: ChatPopUpProps) { showRestartButton = true, onClose: customOnClose, title, + footer, + header, } = props; const reportAnalyticsEvent = useReportAnalyticsEvent(); @@ -125,14 +127,19 @@ export function ChatPopUp(props: ChatPopUpProps) { {...props} customCssClasses={cssClasses.panelCssClasses} header={ - + header ? ( + header + ) : ( + + ) } + footer={footer} />