@ -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)
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
export * from './utils'
|
@ -1 +0,0 @@
|
||||
export * from './executeCode'
|
@ -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))
|
@ -1,7 +1,7 @@
|
||||
import { executeChatwoot } from '@/features/blocks/integrations/chatwoot'
|
||||
import { executeGoogleAnalyticsBlock } from '@/features/blocks/integrations/googleAnalytics/utils/executeGoogleAnalytics'
|
||||
import { executeCode } from '@/features/blocks/logic/code'
|
||||
import { executeRedirect } from '@/features/blocks/logic/redirect'
|
||||
import { executeScript } from '@/features/blocks/logic/script/executeScript'
|
||||
import { executeWait } from '@/features/blocks/logic/wait/utils/executeWait'
|
||||
import type { ChatReply } from 'models'
|
||||
|
||||
@ -14,8 +14,8 @@ export const executeClientSideAction = async (
|
||||
if ('googleAnalytics' in clientSideAction) {
|
||||
executeGoogleAnalyticsBlock(clientSideAction.googleAnalytics)
|
||||
}
|
||||
if ('codeToExecute' in clientSideAction) {
|
||||
await executeCode(clientSideAction.codeToExecute)
|
||||
if ('scriptToExecute' in clientSideAction) {
|
||||
await executeScript(clientSideAction.scriptToExecute)
|
||||
}
|
||||
if ('redirect' in clientSideAction) {
|
||||
executeRedirect(clientSideAction.redirect)
|
||||
|
Reference in New Issue
Block a user