From 56e5a63685376b5cbeafed440455a4d69a41d0da Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 24 Aug 2023 19:23:13 -0300 Subject: [PATCH 01/44] feat(chatWidget): add support for api_key prop in ChatWidget and ChatWindow components to pass API key to sendMessage function fix(controllers): modify sendMessage function to include api_key in the request data if provided feat(index.tsx): add api_key prop to ChatWidget component in custom element definition --- src/chatWidget/chatWindow/index.tsx | 4 +++- src/chatWidget/index.tsx | 3 +++ src/controllers/index.ts | 5 ++++- src/index.tsx | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/chatWidget/chatWindow/index.tsx b/src/chatWidget/chatWindow/index.tsx index cf67472..12f7835 100644 --- a/src/chatWidget/chatWindow/index.tsx +++ b/src/chatWidget/chatWindow/index.tsx @@ -6,6 +6,7 @@ import ChatMessage from "./chatMessage"; import { sendMessage } from "../../controllers"; export default function ChatWindow({ + api_key, flowId, hostUrl, updateLastMessage, @@ -35,6 +36,7 @@ export default function ChatWindow({ height = 650, tweaks, }: { + api_key?: string; chat_inputs: Object; chat_input_field: string; bot_message_style?: React.CSSProperties; @@ -86,7 +88,7 @@ export default function ChatWindow({ addMessage({ message: value, isSend: true }); setSendingMessage(true); setValue(""); - sendMessage(hostUrl, flowId, value, chat_inputs, chat_input_field, tweaks) + sendMessage(hostUrl, flowId, value, chat_inputs, chat_input_field, tweaks,api_key) .then((res) => { if ( res.data && diff --git a/src/chatWidget/index.tsx b/src/chatWidget/index.tsx index 2df27a2..127325d 100644 --- a/src/chatWidget/index.tsx +++ b/src/chatWidget/index.tsx @@ -4,6 +4,7 @@ import ChatWindow from "./chatWindow"; import { ChatMessageType } from "../types/chatWidget"; export default function ChatWidget({ + api_key, chat_input_field, chat_inputs, chat_trigger_style, @@ -29,6 +30,7 @@ export default function ChatWidget({ placeholder_sending, input_container_style, }: { + api_key?: string; chat_inputs: Object; chat_input_field: string; send_icon_style?: React.CSSProperties; @@ -976,6 +978,7 @@ input::-ms-input-placeholder { /* Microsoft Edge */ style={chat_trigger_style} /> Date: Thu, 24 Aug 2023 19:27:27 -0300 Subject: [PATCH 02/44] update build version --- dist/build/static/js/bundle.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/build/static/js/bundle.min.js b/dist/build/static/js/bundle.min.js index edfc3b2..b37b6e8 100644 --- a/dist/build/static/js/bundle.min.js +++ b/dist/build/static/js/bundle.min.js @@ -1 +1 @@ -!function(){var e={};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),function(){"use strict";var n={463:function(e,n,t){var r=t(791),o=t(296);function a(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t