feat(editor): ✨ Code step
This commit is contained in:
@ -1,16 +1,24 @@
|
||||
import { ItemType, StepBase } from '.'
|
||||
import { ItemBase } from './item'
|
||||
|
||||
export type LogicStep = SetVariableStep | ConditionStep | RedirectStep
|
||||
export type LogicStep =
|
||||
| SetVariableStep
|
||||
| ConditionStep
|
||||
| RedirectStep
|
||||
| CodeStep
|
||||
|
||||
export type LogicStepOptions =
|
||||
| SetVariableOptions
|
||||
| RedirectOptions
|
||||
| CodeOptions
|
||||
|
||||
export enum LogicStepType {
|
||||
SET_VARIABLE = 'Set variable',
|
||||
CONDITION = 'Condition',
|
||||
REDIRECT = 'Redirect',
|
||||
CODE = 'Code',
|
||||
}
|
||||
|
||||
export type LogicStepOptions = SetVariableOptions | RedirectOptions
|
||||
|
||||
export type SetVariableStep = StepBase & {
|
||||
type: LogicStepType.SET_VARIABLE
|
||||
options: SetVariableOptions
|
||||
@ -31,6 +39,11 @@ export type RedirectStep = StepBase & {
|
||||
options: RedirectOptions
|
||||
}
|
||||
|
||||
export type CodeStep = StepBase & {
|
||||
type: LogicStepType.CODE
|
||||
options: CodeOptions
|
||||
}
|
||||
|
||||
export enum LogicalOperator {
|
||||
OR = 'OR',
|
||||
AND = 'AND',
|
||||
@ -67,6 +80,11 @@ export type RedirectOptions = {
|
||||
isNewTab: boolean
|
||||
}
|
||||
|
||||
export type CodeOptions = {
|
||||
name: string
|
||||
content?: string
|
||||
}
|
||||
|
||||
export const defaultSetVariablesOptions: SetVariableOptions = {}
|
||||
|
||||
export const defaultConditionContent: ConditionContent = {
|
||||
@ -75,3 +93,5 @@ export const defaultConditionContent: ConditionContent = {
|
||||
}
|
||||
|
||||
export const defaultRedirectOptions: RedirectOptions = { isNewTab: false }
|
||||
|
||||
export const defaultCodeOptions: CodeOptions = { name: 'Code snippet' }
|
||||
|
@ -4,13 +4,11 @@ import {
|
||||
IntegrationStepType,
|
||||
Item,
|
||||
LogicStepOptions,
|
||||
RedirectStep,
|
||||
SetVariableStep,
|
||||
} from '.'
|
||||
import { BubbleStep, BubbleStepType } from './bubble'
|
||||
import { InputStep, InputStepType } from './inputs'
|
||||
import { IntegrationStep } from './integration'
|
||||
import { LogicStep, LogicStepType } from './logic'
|
||||
import { ConditionStep, LogicStep, LogicStepType } from './logic'
|
||||
|
||||
export type Step =
|
||||
| StartStep
|
||||
@ -36,14 +34,12 @@ export type DraggableStepType =
|
||||
|
||||
export type StepWithOptions =
|
||||
| InputStep
|
||||
| SetVariableStep
|
||||
| RedirectStep
|
||||
| Exclude<LogicStep, ConditionStep>
|
||||
| IntegrationStep
|
||||
|
||||
export type StepWithOptionsType =
|
||||
| InputStepType
|
||||
| LogicStepType.REDIRECT
|
||||
| LogicStepType.SET_VARIABLE
|
||||
| Exclude<LogicStepType, LogicStepType.CONDITION>
|
||||
| IntegrationStepType
|
||||
|
||||
export type StepOptions =
|
||||
|
Reference in New Issue
Block a user