✨ Introducing The Forge (#1072)
The Forge allows anyone to easily create their own Typebot Block. Closes #380
This commit is contained in:
17
packages/variables/injectVariablesFromExistingResult.ts
Normal file
17
packages/variables/injectVariablesFromExistingResult.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { Result, Variable } from '@typebot.io/schemas'
|
||||
|
||||
export const injectVariablesFromExistingResult = (
|
||||
variables: Variable[],
|
||||
resultVariables: Result['variables']
|
||||
): Variable[] =>
|
||||
variables.map((variable) => {
|
||||
const resultVariable = resultVariables.find(
|
||||
(resultVariable) =>
|
||||
resultVariable.name === variable.name && !variable.value
|
||||
)
|
||||
if (!resultVariable) return variable
|
||||
return {
|
||||
...variable,
|
||||
value: resultVariable.value,
|
||||
}
|
||||
})
|
Reference in New Issue
Block a user