@ -1 +0,0 @@
|
||||
export { executeCode } from './utils/executeCode'
|
@ -2,10 +2,10 @@ import { parseVariables, parseCorrectValueType } from '@/features/variables'
|
||||
import { LogicState } from '@/types'
|
||||
import { sendEventToParent } from '@/utils/chat'
|
||||
import { isEmbedded } from '@/utils/helpers'
|
||||
import { CodeBlock } from 'models'
|
||||
import { ScriptBlock } from 'models'
|
||||
|
||||
export const executeCode = async (
|
||||
block: CodeBlock,
|
||||
export const executeScript = async (
|
||||
block: ScriptBlock,
|
||||
{ typebot: { variables } }: LogicState
|
||||
) => {
|
||||
if (!block.options.content) return
|
@ -1,5 +1,4 @@
|
||||
import { TypebotViewerProps } from '@/components/TypebotViewer'
|
||||
import { executeCode } from '@/features/blocks/logic/code'
|
||||
import { executeCondition } from '@/features/blocks/logic/condition'
|
||||
import { executeRedirect } from '@/features/blocks/logic/redirect'
|
||||
import { executeSetVariable } from '@/features/blocks/logic/setVariable'
|
||||
@ -8,6 +7,7 @@ import { executeWait } from '@/features/blocks/logic/wait'
|
||||
import { LinkedTypebot } from '@/providers/TypebotProvider'
|
||||
import { EdgeId, LogicState } from '@/types'
|
||||
import { LogicBlock, LogicBlockType } from 'models'
|
||||
import { executeScript } from '@/features/blocks/logic/script/executeScript'
|
||||
|
||||
export const executeLogic = async (
|
||||
block: LogicBlock,
|
||||
@ -23,8 +23,8 @@ export const executeLogic = async (
|
||||
return { nextEdgeId: executeCondition(block, context) }
|
||||
case LogicBlockType.REDIRECT:
|
||||
return { nextEdgeId: executeRedirect(block, context) }
|
||||
case LogicBlockType.CODE:
|
||||
return { nextEdgeId: await executeCode(block, context) }
|
||||
case LogicBlockType.SCRIPT:
|
||||
return { nextEdgeId: await executeScript(block, context) }
|
||||
case LogicBlockType.TYPEBOT_LINK:
|
||||
return executeTypebotLink(block, context)
|
||||
case LogicBlockType.WAIT:
|
||||
|
Reference in New Issue
Block a user