2
0

(embed) Option to add a wait event for the embed bubble

Closes #1590
This commit is contained in:
Baptiste Arnaud
2024-06-19 15:27:45 +02:00
parent 4ab1803d39
commit 918836d6cf
20 changed files with 200 additions and 46 deletions

View File

@@ -11,6 +11,7 @@ import { restartSession } from '@typebot.io/bot-engine/queries/restartSession'
import { continueBotFlow } from '@typebot.io/bot-engine/continueBotFlow'
import { parseDynamicTheme } from '@typebot.io/bot-engine/parseDynamicTheme'
import { isDefined } from '@typebot.io/lib/utils'
import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/constants'
export const sendMessageV1 = publicProcedure
.meta({
@@ -136,8 +137,11 @@ export const sendMessageV1 = publicProcedure
logs: allLogs,
clientSideActions,
visitedEdges,
hasCustomEmbedBubble: messages.some(
(message) => message.type === 'custom-embed'
hasEmbedBubbleWithWaitEvent: messages.some(
(message) =>
message.type === 'custom-embed' ||
(message.type === BubbleBlockType.EMBED &&
message.content.waitForEvent?.isEnabled)
),
setVariableHistory,
})
@@ -199,8 +203,11 @@ export const sendMessageV1 = publicProcedure
logs: allLogs,
clientSideActions,
visitedEdges,
hasCustomEmbedBubble: messages.some(
(message) => message.type === 'custom-embed'
hasEmbedBubbleWithWaitEvent: messages.some(
(message) =>
message.type === 'custom-embed' ||
(message.type === BubbleBlockType.EMBED &&
message.content.waitForEvent?.isEnabled)
),
setVariableHistory,
})

View File

@@ -11,6 +11,7 @@ import {
chatReplySchema,
sendMessageInputSchema,
} from '@typebot.io/schemas/features/chat/legacy/schema'
import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/constants'
export const sendMessageV2 = publicProcedure
.meta({
@@ -136,8 +137,11 @@ export const sendMessageV2 = publicProcedure
logs: allLogs,
clientSideActions,
visitedEdges,
hasCustomEmbedBubble: messages.some(
(message) => message.type === 'custom-embed'
hasEmbedBubbleWithWaitEvent: messages.some(
(message) =>
message.type === 'custom-embed' ||
(message.type === BubbleBlockType.EMBED &&
message.content.waitForEvent?.isEnabled)
),
setVariableHistory,
})
@@ -198,8 +202,11 @@ export const sendMessageV2 = publicProcedure
logs: allLogs,
clientSideActions,
visitedEdges,
hasCustomEmbedBubble: messages.some(
(message) => message.type === 'custom-embed'
hasEmbedBubbleWithWaitEvent: messages.some(
(message) =>
message.type === 'custom-embed' ||
(message.type === BubbleBlockType.EMBED &&
message.content.waitForEvent?.isEnabled)
),
setVariableHistory,
})