feat(logic): ✨ Add Redirect step
This commit is contained in:
@ -1,20 +1,36 @@
|
||||
import { StepBase } from '.'
|
||||
import { Table } from '../..'
|
||||
|
||||
export type LogicStep = SetVariableStep | ConditionStep
|
||||
export type LogicStep = SetVariableStep | ConditionStep | RedirectStep
|
||||
|
||||
export enum LogicStepType {
|
||||
SET_VARIABLE = 'Set variable',
|
||||
CONDITION = 'Condition',
|
||||
REDIRECT = 'Redirect',
|
||||
}
|
||||
|
||||
export type LogicStepOptions = SetVariableOptions | ConditionOptions
|
||||
export type LogicStepOptions =
|
||||
| SetVariableOptions
|
||||
| ConditionOptions
|
||||
| RedirectOptions
|
||||
|
||||
export type SetVariableStep = StepBase & {
|
||||
type: LogicStepType.SET_VARIABLE
|
||||
options?: SetVariableOptions
|
||||
}
|
||||
|
||||
export type ConditionStep = StepBase & {
|
||||
type: LogicStepType.CONDITION
|
||||
options: ConditionOptions
|
||||
trueEdgeId?: string
|
||||
falseEdgeId?: string
|
||||
}
|
||||
|
||||
export type RedirectStep = StepBase & {
|
||||
type: LogicStepType.REDIRECT
|
||||
options?: RedirectOptions
|
||||
}
|
||||
|
||||
export enum LogicalOperator {
|
||||
OR = 'OR',
|
||||
AND = 'AND',
|
||||
@ -29,13 +45,6 @@ export enum ComparisonOperators {
|
||||
IS_SET = 'Is set',
|
||||
}
|
||||
|
||||
export type ConditionStep = StepBase & {
|
||||
type: LogicStepType.CONDITION
|
||||
options: ConditionOptions
|
||||
trueEdgeId?: string
|
||||
falseEdgeId?: string
|
||||
}
|
||||
|
||||
export type ConditionOptions = {
|
||||
comparisons: Table<Comparison>
|
||||
logicalOperator?: LogicalOperator
|
||||
@ -52,3 +61,8 @@ export type SetVariableOptions = {
|
||||
variableId?: string
|
||||
expressionToEvaluate?: string
|
||||
}
|
||||
|
||||
export type RedirectOptions = {
|
||||
url?: string
|
||||
isNewTab?: boolean
|
||||
}
|
||||
|
Reference in New Issue
Block a user