From c711f6694cfe6d868cf745eb64e223acf01a5c16 Mon Sep 17 00:00:00 2001 From: Manuel Hoffmann Date: Sun, 7 Jan 2024 23:27:34 +0100 Subject: [PATCH] add payload to props and pass to custom chatbotmessage component --- src/components/Chat/Chat.tsx | 1 + src/components/ChatbotMessage/ChatbotMessage.tsx | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/components/Chat/Chat.tsx b/src/components/Chat/Chat.tsx index a96bebe..5f27532 100644 --- a/src/components/Chat/Chat.tsx +++ b/src/components/Chat/Chat.tsx @@ -177,6 +177,7 @@ const Chat = ({ const chatbotMessageProps = { ...messageObject, + payload: messageObject.payload, setState, state, customComponents, diff --git a/src/components/ChatbotMessage/ChatbotMessage.tsx b/src/components/ChatbotMessage/ChatbotMessage.tsx index e971ab7..72a318a 100644 --- a/src/components/ChatbotMessage/ChatbotMessage.tsx +++ b/src/components/ChatbotMessage/ChatbotMessage.tsx @@ -10,6 +10,7 @@ import { ICustomComponents, ICustomStyles } from '../../interfaces/IConfig'; interface IChatbotMessageProps { message: string; + payload?: any; withAvatar?: boolean; loading?: boolean; messages: any[]; @@ -21,6 +22,7 @@ interface IChatbotMessageProps { } const ChatbotMessage = ({ message, + payload, withAvatar = true, loading, messages, @@ -96,6 +98,7 @@ const ChatbotMessage = ({ condition={!!customComponents?.botChatMessage} show={callIfExists(customComponents?.botChatMessage, { message, + payload, loader: , })} elseShow={