🐛 (typebotLink) Fix nested typebot link pop
This commit is contained in:
@ -7,6 +7,7 @@ export const startBotFlow = async (
|
||||
state: SessionState,
|
||||
startGroupId?: string
|
||||
): Promise<ChatReply & { newSessionState: SessionState }> => {
|
||||
let newSessionState = state
|
||||
if (startGroupId) {
|
||||
const group = state.typebotsQueue[0].typebot.groups.find(
|
||||
(group) => group.id === startGroupId
|
||||
@ -16,12 +17,13 @@ export const startBotFlow = async (
|
||||
code: 'BAD_REQUEST',
|
||||
message: "startGroupId doesn't exist",
|
||||
})
|
||||
return executeGroup(state)(group)
|
||||
return executeGroup(newSessionState)(group)
|
||||
}
|
||||
const firstEdgeId =
|
||||
state.typebotsQueue[0].typebot.groups[0].blocks[0].outgoingEdgeId
|
||||
if (!firstEdgeId) return { messages: [], newSessionState: state }
|
||||
const nextGroup = await getNextGroup(state)(firstEdgeId)
|
||||
if (!nextGroup.group) return { messages: [], newSessionState: state }
|
||||
return executeGroup(state)(nextGroup.group)
|
||||
newSessionState.typebotsQueue[0].typebot.groups[0].blocks[0].outgoingEdgeId
|
||||
if (!firstEdgeId) return { messages: [], newSessionState }
|
||||
const nextGroup = await getNextGroup(newSessionState)(firstEdgeId)
|
||||
newSessionState = nextGroup.newSessionState
|
||||
if (!nextGroup.group) return { messages: [], newSessionState }
|
||||
return executeGroup(newSessionState)(nextGroup.group)
|
||||
}
|
||||
|
Reference in New Issue
Block a user