diff --git a/packages/embeds/js/package.json b/packages/embeds/js/package.json
index f7c99075c..3f55b2f14 100644
--- a/packages/embeds/js/package.json
+++ b/packages/embeds/js/package.json
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/js",
- "version": "0.2.32",
+ "version": "0.2.33",
"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 1a89c79d7..ca8b7f96c 100644
--- a/packages/embeds/js/src/components/ConversationContainer/ConversationContainer.tsx
+++ b/packages/embeds/js/src/components/ConversationContainer/ConversationContainer.tsx
@@ -86,31 +86,30 @@ export const ConversationContainer = (props: Props) => {
onMount(() => {
;(async () => {
const initialChunk = chatChunks()[0]
- if (initialChunk.clientSideActions) {
- const actionsBeforeFirstBubble = initialChunk.clientSideActions.filter(
- (action) => isNotDefined(action.lastBubbleBlockId)
+ if (!initialChunk.clientSideActions) return
+ const actionsBeforeFirstBubble = initialChunk.clientSideActions.filter(
+ (action) => isNotDefined(action.lastBubbleBlockId)
+ )
+ for (const action of actionsBeforeFirstBubble) {
+ if (
+ 'streamOpenAiChatCompletion' in action ||
+ 'webhookToExecute' in action
)
- for (const action of actionsBeforeFirstBubble) {
- if (
- 'streamOpenAiChatCompletion' in action ||
- 'webhookToExecute' in action
- )
- setIsSending(true)
- const response = await executeClientSideAction({
- clientSideAction: action,
- context: {
- apiHost: props.context.apiHost,
- sessionId: props.initialChatReply.sessionId,
- },
- onMessageStream: streamMessage,
- })
- if (response && 'replyToSend' in response) {
- sendMessage(response.replyToSend, response.logs)
- return
- }
- if (response && 'blockedPopupUrl' in response)
- setBlockedPopupUrl(response.blockedPopupUrl)
+ setIsSending(true)
+ const response = await executeClientSideAction({
+ clientSideAction: action,
+ context: {
+ apiHost: props.context.apiHost,
+ sessionId: props.initialChatReply.sessionId,
+ },
+ onMessageStream: streamMessage,
+ })
+ if (response && 'replyToSend' in response) {
+ sendMessage(response.replyToSend, response.logs)
+ return
}
+ if (response && 'blockedPopupUrl' in response)
+ setBlockedPopupUrl(response.blockedPopupUrl)
}
})()
})
diff --git a/packages/embeds/js/src/components/avatars/Avatar.tsx b/packages/embeds/js/src/components/avatars/Avatar.tsx
index 89e8841db..8e4b16b40 100644
--- a/packages/embeds/js/src/components/avatars/Avatar.tsx
+++ b/packages/embeds/js/src/components/avatars/Avatar.tsx
@@ -8,7 +8,7 @@ export const Avatar = (props: { initialAvatarSrc?: string }) => {
createEffect(() => {
if (
- avatarSrc()?.startsWith('{{') &&
+ (avatarSrc()?.startsWith('{{') || !avatarSrc()) &&
props.initialAvatarSrc?.startsWith('http')
)
setAvatarSrc(props.initialAvatarSrc)
diff --git a/packages/embeds/js/src/features/bubble/components/BubbleButton.tsx b/packages/embeds/js/src/features/bubble/components/BubbleButton.tsx
index a77239f14..5dbfaf84d 100644
--- a/packages/embeds/js/src/features/bubble/components/BubbleButton.tsx
+++ b/packages/embeds/js/src/features/bubble/components/BubbleButton.tsx
@@ -34,6 +34,8 @@ export const BubbleButton = (props: Props) => (
>
(