2
0

feat(engine): Link typebot step

This commit is contained in:
Baptiste Arnaud
2022-03-09 15:12:00 +01:00
parent 1bcc8aee10
commit 7e61ab19eb
61 changed files with 1272 additions and 245 deletions

View File

@ -3,11 +3,19 @@ import { PublicTypebot as PublicTypebotFromPrisma } from 'db'
export type PublicTypebot = Omit<
PublicTypebotFromPrisma,
'blocks' | 'theme' | 'settings' | 'variables' | 'edges'
| 'blocks'
| 'theme'
| 'settings'
| 'variables'
| 'edges'
| 'createdAt'
| 'updatedAt'
> & {
blocks: Block[]
variables: Variable[]
edges: Edge[]
theme: Theme
settings: Settings
createdAt: string
updatedAt: string
}

View File

@ -6,17 +6,20 @@ export type LogicStep =
| ConditionStep
| RedirectStep
| CodeStep
| TypebotLinkStep
export type LogicStepOptions =
| SetVariableOptions
| RedirectOptions
| CodeOptions
| TypebotLinkOptions
export enum LogicStepType {
SET_VARIABLE = 'Set variable',
CONDITION = 'Condition',
REDIRECT = 'Redirect',
CODE = 'Code',
TYPEBOT_LINK = 'Typebot link',
}
export type SetVariableStep = StepBase & {
@ -44,6 +47,11 @@ export type CodeStep = StepBase & {
options: CodeOptions
}
export type TypebotLinkStep = StepBase & {
type: LogicStepType.TYPEBOT_LINK
options: TypebotLinkOptions
}
export enum LogicalOperator {
OR = 'OR',
AND = 'AND',
@ -85,6 +93,11 @@ export type CodeOptions = {
content?: string
}
export type TypebotLinkOptions = {
typebotId?: string
blockId?: string
}
export const defaultSetVariablesOptions: SetVariableOptions = {}
export const defaultConditionContent: ConditionContent = {
@ -95,3 +108,5 @@ export const defaultConditionContent: ConditionContent = {
export const defaultRedirectOptions: RedirectOptions = { isNewTab: false }
export const defaultCodeOptions: CodeOptions = { name: 'Code snippet' }
export const defaultTypebotLinkOptions: TypebotLinkOptions = {}

View File

@ -6,13 +6,21 @@ import { Variable } from './variable'
export type Typebot = Omit<
TypebotFromPrisma,
'blocks' | 'theme' | 'settings' | 'variables' | 'edges'
| 'blocks'
| 'theme'
| 'settings'
| 'variables'
| 'edges'
| 'createdAt'
| 'updatedAt'
> & {
blocks: Block[]
variables: Variable[]
edges: Edge[]
theme: Theme
settings: Settings
createdAt: string
updatedAt: string
}
export type Block = {