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

@ -1,6 +1,8 @@
import { executeCode } from '@/features/blocks/logic/code'
import type { CodeToExecute } from 'models'
import { executeScript } from '@/features/blocks/logic/script/executeScript'
import type { ScriptToExecute } from 'models'
export const executeChatwoot = (chatwoot: { codeToExecute: CodeToExecute }) => {
executeCode(chatwoot.codeToExecute)
export const executeChatwoot = (chatwoot: {
scriptToExecute: ScriptToExecute
}) => {
executeScript(chatwoot.scriptToExecute)
}

View File

@ -1 +0,0 @@
export * from './utils'

View File

@ -1 +0,0 @@
export * from './executeCode'

View File

@ -1,6 +1,6 @@
import type { CodeToExecute } from 'models'
import type { ScriptToExecute } from 'models'
export const executeCode = async ({ content, args }: CodeToExecute) => {
export const executeScript = async ({ content, args }: ScriptToExecute) => {
const func = Function(...args.map((arg) => arg.id), content)
try {
await func(...args.map((arg) => arg.value))