(embed) Add new command setInputValue

This commit is contained in:
Baptiste Arnaud
2023-07-15 17:38:12 +02:00
parent 521cb50782
commit be7be7bf7a
14 changed files with 93 additions and 13 deletions

View File

@@ -8,6 +8,7 @@ export type CommandData = {
}
| ShowMessageCommandData
| SetPrefilledVariablesCommandData
| SetInputValueCommandData
)
export type ShowMessageCommandData = {
@@ -19,3 +20,8 @@ export type SetPrefilledVariablesCommandData = {
command: 'setPrefilledVariables'
variables: Record<string, string | number | boolean>
}
export type SetInputValueCommandData = {
command: 'setInputValue'
value: string
}

View File

@@ -4,3 +4,4 @@ export * from './open'
export * from './setPrefilledVariables'
export * from './showPreviewMessage'
export * from './toggle'
export * from './setInputValue'

View File

@@ -0,0 +1,10 @@
import { CommandData } from '../types'
export const setInputValue = (value: string) => {
const message: CommandData = {
isFromTypebot: true,
command: 'setInputValue',
value,
}
window.postMessage(message)
}