2
0

Add "turn into" option in block context menu

Closes #1302
This commit is contained in:
Baptiste Arnaud
2024-03-05 15:46:28 +01:00
parent 84d6c594af
commit 2fb379b102
16 changed files with 244 additions and 13 deletions

View File

@ -11,6 +11,7 @@
},
"devDependencies": {
"@typebot.io/tsconfig": "workspace:*",
"@types/react": "18.2.15"
"@types/react": "18.2.15",
"@typebot.io/forge-repository": "workspace:*"
}
}

View File

@ -1,6 +1,7 @@
import { SVGProps } from 'react'
import { z } from './zod'
import { ZodRawShape } from 'zod'
import { enabledBlocks } from '@typebot.io/forge-repository'
export type VariableStore = {
get: (variableId: string) => string | (string | null)[] | null | undefined
@ -32,6 +33,14 @@ export type FunctionToExecute = {
export type ReadOnlyVariableStore = Omit<VariableStore, 'set'>
export type TurnableIntoParam<T = {}> = {
blockType: (typeof enabledBlocks)[number]
/**
* If defined will be used to convert the existing block options into the new block options.
*/
customMapping?: (options: T) => any
}
export type ActionDefinition<
A extends AuthDefinition,
BaseOptions extends z.ZodObject<ZodRawShape> = z.ZodObject<{}>,
@ -40,6 +49,7 @@ export type ActionDefinition<
name: string
fetchers?: FetcherDefinition<A, z.infer<BaseOptions> & z.infer<Options>>[]
options?: Options
turnableInto?: TurnableIntoParam<z.infer<Options>>[]
getSetVariableIds?: (options: z.infer<Options>) => string[]
run?: {
server?: (params: {