2
0

feat(results): ️ Improve logs details

This commit is contained in:
Baptiste Arnaud
2022-04-19 14:10:22 -07:00
parent 9fbe1cc34c
commit 54a757b21b
17 changed files with 370 additions and 255 deletions

View File

@@ -54,7 +54,7 @@ export const ChatBlock = ({
setCurrentTypebotId,
pushEdgeIdInLinkedTypebotQueue,
} = useTypebot()
const { resultValues, updateVariables } = useAnswers()
const { resultValues, updateVariables, resultId } = useAnswers()
const [processedSteps, setProcessedSteps] = useState<Step[]>([])
const [displayedChunks, setDisplayedChunks] = useState<ChatDisplayChunk[]>([])
@@ -134,6 +134,7 @@ export const ChatBlock = ({
resultValues,
blocks: typebot.blocks,
onNewLog,
resultId,
},
})
nextEdgeId ? onBlockEnd(nextEdgeId) : displayNextStep()

View File

@@ -28,6 +28,7 @@ export type TypebotViewerProps = {
apiHost?: string
style?: CSSProperties
predefinedVariables?: { [key: string]: string | undefined }
resultId?: string
onNewBlockVisible?: (edge: Edge) => void
onNewAnswer?: (answer: Answer) => void
onNewLog?: (log: Omit<Log, 'id' | 'createdAt' | 'resultId'>) => void
@@ -40,6 +41,7 @@ export const TypebotViewer = ({
apiHost = process.env.NEXT_PUBLIC_VIEWER_URL?.split(',')[0],
isPreview = false,
style,
resultId,
predefinedVariables,
onNewLog,
onNewBlockVisible,
@@ -95,6 +97,7 @@ export const TypebotViewer = ({
onNewLog={handleNewLog}
>
<AnswersContext
resultId={resultId}
onNewAnswer={handleNewAnswer}
onVariablesUpdated={onVariablesUpdated}
>