From 4dec06fc7502037282e654eb58c4bb93fc0e75c6 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Fri, 26 May 2023 12:00:16 +0200 Subject: [PATCH] :bug: (webhook) Add loading bubble when executing webhook on client --- packages/embeds/js/package.json | 2 +- .../ConversationContainer.tsx | 18 +++++++++++++++--- packages/embeds/react/package.json | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/packages/embeds/js/package.json b/packages/embeds/js/package.json index 79756bc33..f4cf58ed5 100644 --- a/packages/embeds/js/package.json +++ b/packages/embeds/js/package.json @@ -1,6 +1,6 @@ { "name": "@typebot.io/js", - "version": "0.0.56", + "version": "0.0.57", "description": "Javascript library to display typebots on your website", "type": "module", "main": "dist/index.js", diff --git a/packages/embeds/js/src/components/ConversationContainer/ConversationContainer.tsx b/packages/embeds/js/src/components/ConversationContainer/ConversationContainer.tsx index ce3215cd1..398c707af 100644 --- a/packages/embeds/js/src/components/ConversationContainer/ConversationContainer.tsx +++ b/packages/embeds/js/src/components/ConversationContainer/ConversationContainer.tsx @@ -69,7 +69,11 @@ export const ConversationContainer = (props: Props) => { (action) => isNotDefined(action.lastBubbleBlockId) ) for (const action of actionsBeforeFirstBubble) { - if ('streamOpenAiChatCompletion' in action) setIsSending(true) + if ( + 'streamOpenAiChatCompletion' in action || + 'webhookToExecute' in action + ) + setIsSending(true) const response = await executeClientSideAction(action, { apiHost: props.context.apiHost, sessionId: props.initialChatReply.sessionId, @@ -137,7 +141,11 @@ export const ConversationContainer = (props: Props) => { isNotDefined(action.lastBubbleBlockId) ) for (const action of actionsBeforeFirstBubble) { - if ('streamOpenAiChatCompletion' in action) setIsSending(true) + if ( + 'streamOpenAiChatCompletion' in action || + 'webhookToExecute' in action + ) + setIsSending(true) const response = await executeClientSideAction(action, { apiHost: props.context.apiHost, sessionId: props.initialChatReply.sessionId, @@ -182,7 +190,11 @@ export const ConversationContainer = (props: Props) => { (action) => action.lastBubbleBlockId === blockId ) for (const action of actionsToExecute) { - if ('streamOpenAiChatCompletion' in action) setIsSending(true) + if ( + 'streamOpenAiChatCompletion' in action || + 'webhookToExecute' in action + ) + setIsSending(true) const response = await executeClientSideAction(action, { apiHost: props.context.apiHost, sessionId: props.initialChatReply.sessionId, diff --git a/packages/embeds/react/package.json b/packages/embeds/react/package.json index 702bd1ef0..dc5f0c38f 100644 --- a/packages/embeds/react/package.json +++ b/packages/embeds/react/package.json @@ -1,6 +1,6 @@ { "name": "@typebot.io/react", - "version": "0.0.56", + "version": "0.0.57", "description": "React library to display typebots on your website", "main": "dist/index.js", "types": "dist/index.d.ts",