diff --git a/components/Hello/RenderHelloInteractiveMessage.tsx b/components/Hello/RenderHelloInteractiveMessage.tsx index 3590be60..082d0a9d 100644 --- a/components/Hello/RenderHelloInteractiveMessage.tsx +++ b/components/Hello/RenderHelloInteractiveMessage.tsx @@ -35,7 +35,8 @@ function RenderHelloInteractiveMessage({ message }: { message: any }) { }; const renderInteractiveContent = () => { - switch (messageJson.type) { + const type = messageJson.type || message.message_type; + switch (type) { case 'button': return (
@@ -149,7 +150,7 @@ function RenderHelloInteractiveMessage({ message }: { message: any }) { onClick={() => sendMessageToHello?.(row?.title)} >
-
{row?.title}
+
{row?.title}
{row?.description && (
@@ -173,6 +174,17 @@ function RenderHelloInteractiveMessage({ message }: { message: any }) {
); + case 'carousel': + return ( + + ); + default: return
Unsupported Message Type
; } @@ -185,4 +197,73 @@ function RenderHelloInteractiveMessage({ message }: { message: any }) { ); } +function CarouselMessage({ messageJson, backgroundColor, textColor, sendMessageToHello, renderHeader }: any) { + return ( +
+ {messageJson.body?.text && ( +
+
+
+ )} + +
+ {messageJson.action?.cards?.map((card: any, index: number) => { + return ( +
+ {card.header && renderHeader(card.header)} + +
+ {card.body?.text && ( +
+
+
+ )} + +
+ {card.action?.name === 'cta_url' && card.action?.parameters?.url && ( + e.stopPropagation()} + > + + {card.action?.parameters?.display_text || "View"} + + )} + + {card.action?.buttons && card.action.buttons.map((button: any, bIndex: number) => ( + + ))} +
+
+
+ ); + })} +
+ + {messageJson.footer?.text && ( +
+
+
+ )} +
+ ); +} + export default RenderHelloInteractiveMessage; \ No newline at end of file diff --git a/components/Interface-Chatbot/Messages/ImageWithFallback.tsx b/components/Interface-Chatbot/Messages/ImageWithFallback.tsx index b67e2eb3..599b81a6 100644 --- a/components/Interface-Chatbot/Messages/ImageWithFallback.tsx +++ b/components/Interface-Chatbot/Messages/ImageWithFallback.tsx @@ -26,8 +26,8 @@ const FALLBACK_ICON = "https://cdn1.iconfinder.com/data/icons/leto-files/64/leto const getFileType = (url: string): string => { if (!url) return "other"; // e.g. null, undefined, empty string const extension = url?.split(".")?.pop()?.toLowerCase()?.split("?")[0] || ""; - if (["jpg", "jpeg", "png", "gif", "webp", "bmp"].includes(extension)) return "image"; - if (["mp4", "webm", "ogg"].includes(extension)) return "video"; + if (["jpg", "jpeg", "png", "gif", "webp", "bmp", "svg"].includes(extension)) return "image"; + if (["mp4", "webm", "ogg", "mov"].includes(extension)) return "video"; if (["mp3", "wav", "aac", "flac"].includes(extension)) return "audio"; if (["pdf"].includes(extension)) return "pdf"; return "other"; // e.g. xlsx, csv, html, zip, etc. @@ -45,7 +45,7 @@ const PlayIcon = () => ( strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" - className="text-white" + className="text-white mt-1" > @@ -53,21 +53,21 @@ const PlayIcon = () => ( // Memoized error component const ErrorDisplay = () => ( -
- - Failed to load +
+
+ +
+ Failed to load media
); // Memoized download button const DownloadButton = ({ onClick }: { onClick: () => void }) => ( ); @@ -112,7 +112,7 @@ const ImageWithFallback = ({ // Memoized container classes const containerClasses = useMemo(() => - `flex relative group ${isSmallScreen ? 'max-w-[80%]' : 'max-w-[40%]'} h-auto rounded-md cursor-pointer hover:opacity-90 transition-opacity`, + `flex relative group ${isSmallScreen ? 'max-w-[80%]' : 'max-w-[40%]'} h-auto rounded-2xl cursor-pointer transition-all duration-300`, [isSmallScreen] ); @@ -128,6 +128,7 @@ const ImageWithFallback = ({ onError={handleError} onClick={handleClick} style={style} + className="rounded-2xl shadow-sm group-hover:shadow-md transition-all duration-300" /> ); @@ -144,8 +145,8 @@ const ImageWithFallback = ({ > -
-
+
+
@@ -157,7 +158,7 @@ const ImageWithFallback = ({ onError={handleError} style={style} > - + Your browser does not support the video tag. ); diff --git a/components/Interface-Chatbot/Messages/UserMessage.tsx b/components/Interface-Chatbot/Messages/UserMessage.tsx index 4a313281..e5ccdcef 100644 --- a/components/Interface-Chatbot/Messages/UserMessage.tsx +++ b/components/Interface-Chatbot/Messages/UserMessage.tsx @@ -55,7 +55,7 @@ const UserMessageCard = React.memo(({ message, backgroundColor, textColor, chatS