2
0

fix(engine): 🐛 Webhook call on linked typebot

This commit is contained in:
Baptiste Arnaud
2022-03-31 10:33:35 +02:00
parent 7f5d2f4173
commit 86117d6d3c
3 changed files with 13 additions and 2 deletions

View File

@ -28,6 +28,7 @@ type LogicContext = {
apiHost: string
typebot: PublicTypebot
linkedTypebots: LinkedTypebot[]
setCurrentTypebotId: (id: string) => void
updateVariableValue: (variableId: string, value: string) => void
updateVariables: (variables: VariableWithValue[]) => void
injectLinkedTypebot: (typebot: Typebot | PublicTypebot) => LinkedTypebot
@ -142,7 +143,8 @@ const executeTypebotLink = async (
nextEdgeId?: EdgeId
linkedTypebot?: PublicTypebot | LinkedTypebot
}> => {
const { typebot, linkedTypebots, onNewLog, createEdge } = context
const { typebot, linkedTypebots, onNewLog, createEdge, setCurrentTypebotId } =
context
const linkedTypebot =
step.options.typebotId === 'current'
? typebot
@ -156,6 +158,7 @@ const executeTypebotLink = async (
})
return { nextEdgeId: step.outgoingEdgeId }
}
setCurrentTypebotId(linkedTypebot.id)
const nextBlockId =
step.options.blockId ??
linkedTypebot.blocks.find((b) => b.steps.some((s) => s.type === 'start'))