2
0

♻️ Introduce typebot v6 with events (#1013)

Closes #885
This commit is contained in:
Baptiste Arnaud
2023-11-08 15:34:16 +01:00
committed by GitHub
parent 68e4fc71fb
commit 35300eaf34
634 changed files with 58971 additions and 31449 deletions

View File

@@ -1,6 +1,10 @@
import { BotContext, InitialChatReply } from '@/types'
import { guessApiHost } from '@/utils/guessApiHost'
import type { SendMessageInput, StartParams } from '@typebot.io/schemas'
import type {
SendMessageInput,
StartElementId,
StartParams,
} from '@typebot.io/schemas'
import { isNotDefined, isNotEmpty, sendRequest } from '@typebot.io/lib'
import {
getPaymentInProgressInStorage,
@@ -12,13 +16,13 @@ export async function getInitialChatReplyQuery({
isPreview,
apiHost,
prefilledVariables,
startGroupId,
resultId,
stripeRedirectStatus,
...props
}: StartParams & {
stripeRedirectStatus?: string
apiHost?: string
}) {
} & StartElementId) {
if (isNotDefined(typebot))
throw new Error('Typebot ID is required to get initial messages')
@@ -40,9 +44,12 @@ export async function getInitialChatReplyQuery({
isPreview,
typebot,
prefilledVariables,
startGroupId,
resultId,
isStreamEnabled: true,
startGroupId:
'startGroupId' in props ? props.startGroupId : undefined,
startEventId:
'startEventId' in props ? props.startEventId : undefined,
},
sessionId: paymentInProgressState?.sessionId,
message: paymentInProgressState