2
0

feat(engine): Add {{state}} to body to get form state

This commit is contained in:
Baptiste Arnaud
2022-02-22 06:55:15 +01:00
parent 1b900b3f5d
commit d0994e6577
8 changed files with 89 additions and 19 deletions

View File

@ -16,6 +16,7 @@ import { executeLogic } from 'services/logic'
import { executeIntegration } from 'services/integration'
import { parseRetryStep, stepCanBeRetried } from 'services/inputs'
import { parseVariables } from 'index'
import { useAnswers } from 'contexts/AnswersContext'
type ChatBlockProps = {
steps: PublicStep[]
@ -32,6 +33,7 @@ export const ChatBlock = ({
}: ChatBlockProps) => {
const { typebot, updateVariableValue, createEdge, apiHost, isPreview } =
useTypebot()
const { resultValues } = useAnswers()
const [displayedSteps, setDisplayedSteps] = useState<PublicStep[]>([])
useEffect(() => {
@ -68,6 +70,8 @@ export const ChatBlock = ({
variables: typebot.variables,
isPreview,
updateVariableValue,
resultValues,
blocks: typebot.blocks,
},
})
nextEdgeId ? onBlockEnd(nextEdgeId) : displayNextStep()