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