fix(logic): ️ Make linked bot edge id work

This commit is contained in:
Baptiste Arnaud
2022-04-14 16:17:28 -07:00
parent 1a59ce20d2
commit e50ce645eb
5 changed files with 42 additions and 5 deletions

View File

@@ -28,6 +28,7 @@ type LogicContext = {
apiHost: string
typebot: PublicTypebot
linkedTypebots: LinkedTypebot[]
pushEdgeIdInLinkedTypebotQueue: (edgeId: EdgeId) => void
setCurrentTypebotId: (id: string) => void
updateVariableValue: (variableId: string, value: string) => void
updateVariables: (variables: VariableWithValue[]) => void
@@ -149,8 +150,14 @@ const executeTypebotLink = async (
nextEdgeId?: EdgeId
linkedTypebot?: PublicTypebot | LinkedTypebot
}> => {
const { typebot, linkedTypebots, onNewLog, createEdge, setCurrentTypebotId } =
context
const {
typebot,
linkedTypebots,
onNewLog,
createEdge,
setCurrentTypebotId,
pushEdgeIdInLinkedTypebotQueue,
} = context
const linkedTypebot = (
step.options.typebotId === 'current'
? typebot
@@ -165,6 +172,7 @@ const executeTypebotLink = async (
})
return { nextEdgeId: step.outgoingEdgeId }
}
if (step.outgoingEdgeId) pushEdgeIdInLinkedTypebotQueue(step.outgoingEdgeId)
setCurrentTypebotId(
'typebotId' in linkedTypebot ? linkedTypebot.typebotId : linkedTypebot.id
)