2
0

♻️ Rename Code block to Script block

Closes #245
This commit is contained in:
Baptiste Arnaud
2023-01-27 15:58:05 +01:00
parent 068f9bbd17
commit a842f57297
35 changed files with 113 additions and 103 deletions

View File

@ -61,7 +61,7 @@ export const executeChatwootBlock = (
{
lastBubbleBlockId,
chatwoot: {
codeToExecute: {
scriptToExecute: {
content: parseVariables(variables, { fieldToParse: 'id' })(
chatwootCode
),

View File

@ -1 +0,0 @@
export { executeCode } from './utils/executeCode'

View File

@ -4,11 +4,11 @@ import {
parseCorrectValueType,
extractVariablesFromText,
} from '@/features/variables'
import { CodeBlock, SessionState } from 'models'
import { ScriptBlock, SessionState } from 'models'
export const executeCode = (
export const executeScript = (
{ typebot: { variables } }: SessionState,
block: CodeBlock,
block: ScriptBlock,
lastBubbleBlockId?: string
): ExecuteLogicResponse => {
if (!block.options.content) return { outgoingEdgeId: block.outgoingEdgeId }
@ -27,7 +27,7 @@ export const executeCode = (
outgoingEdgeId: block.outgoingEdgeId,
clientSideActions: [
{
codeToExecute: {
scriptToExecute: {
content,
args,
},

View File

@ -1,4 +1,3 @@
import { executeCode } from '@/features/blocks/logic/code/api'
import { executeCondition } from '@/features/blocks/logic/condition/api'
import { executeRedirect } from '@/features/blocks/logic/redirect/api'
import { executeSetVariable } from '@/features/blocks/logic/setVariable/api'
@ -6,6 +5,7 @@ import { executeTypebotLink } from '@/features/blocks/logic/typebotLink/api'
import { executeWait } from '@/features/blocks/logic/wait/api/utils/executeWait'
import { LogicBlock, LogicBlockType, SessionState } from 'models'
import { ExecuteLogicResponse } from '../../types'
import { executeScript } from '@/features/blocks/logic/script/executeScript'
export const executeLogic =
(state: SessionState, lastBubbleBlockId?: string) =>
@ -17,8 +17,8 @@ export const executeLogic =
return executeCondition(state, block)
case LogicBlockType.REDIRECT:
return executeRedirect(state, block, lastBubbleBlockId)
case LogicBlockType.CODE:
return executeCode(state, block, lastBubbleBlockId)
case LogicBlockType.SCRIPT:
return executeScript(state, block, lastBubbleBlockId)
case LogicBlockType.TYPEBOT_LINK:
return executeTypebotLink(state, block)
case LogicBlockType.WAIT: