@@ -1,12 +1,15 @@
|
||||
import { executeCondition } from '@typebot.io/logic/executeCondition'
|
||||
import { ChoiceInputBlock, Variable } from '@typebot.io/schemas'
|
||||
import { executeCondition } from '../../logic/condition/executeCondition'
|
||||
|
||||
export const filterChoiceItems =
|
||||
(variables: Variable[]) =>
|
||||
(block: ChoiceInputBlock): ChoiceInputBlock => {
|
||||
const filteredItems = block.items.filter((item) => {
|
||||
if (item.displayCondition?.isEnabled && item.displayCondition?.condition)
|
||||
return executeCondition(variables)(item.displayCondition.condition)
|
||||
return executeCondition({
|
||||
variables,
|
||||
condition: item.displayCondition.condition,
|
||||
})
|
||||
|
||||
return true
|
||||
})
|
||||
|
||||
@@ -41,7 +41,6 @@ const getVariableValue =
|
||||
const [transformedVariable] = transformVariablesToList(variables)([
|
||||
variable.id,
|
||||
])
|
||||
updateVariablesInSession(state)([transformedVariable])
|
||||
return transformedVariable.value as string[]
|
||||
}
|
||||
return variable.value
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import { executeCondition } from '@typebot.io/logic/executeCondition'
|
||||
import { PictureChoiceBlock, Variable } from '@typebot.io/schemas'
|
||||
import { executeCondition } from '../../logic/condition/executeCondition'
|
||||
|
||||
export const filterPictureChoiceItems =
|
||||
(variables: Variable[]) =>
|
||||
(block: PictureChoiceBlock): PictureChoiceBlock => {
|
||||
const filteredItems = block.items.filter((item) => {
|
||||
if (item.displayCondition?.isEnabled && item.displayCondition?.condition)
|
||||
return executeCondition(variables)(item.displayCondition.condition)
|
||||
return executeCondition({
|
||||
variables,
|
||||
condition: item.displayCondition.condition,
|
||||
})
|
||||
|
||||
return true
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user