2
0

⚗️ Implement bot v2 MVP (#194)

Closes #190
This commit is contained in:
Baptiste Arnaud
2022-12-22 17:02:34 +01:00
committed by GitHub
parent e55823e011
commit 1a3869ae6d
202 changed files with 8060 additions and 1152 deletions

View File

@ -0,0 +1,14 @@
import { executeChatwoot } from '@/features/blocks/integrations/chatwoot'
import { executeGoogleAnalyticsBlock } from '@/features/blocks/integrations/googleAnalytics/utils/executeGoogleAnalytics'
import { ChatReply } from 'models'
export const executeIntegrations = async (
integrations: ChatReply['integrations']
) => {
if (integrations?.chatwoot?.codeToExecute) {
executeChatwoot(integrations.chatwoot)
}
if (integrations?.googleAnalytics) {
executeGoogleAnalyticsBlock(integrations.googleAnalytics)
}
}

View File

@ -0,0 +1,12 @@
import { executeCode } from '@/features/blocks/logic/code'
import { executeRedirect } from '@/features/blocks/logic/redirect'
import { ChatReply } from 'models'
export const executeLogic = async (logic: ChatReply['logic']) => {
if (logic?.codeToExecute) {
await executeCode(logic.codeToExecute)
}
if (logic?.redirect) {
executeRedirect(logic.redirect)
}
}

View File

@ -0,0 +1,3 @@
export const injectHeadCode = (headCode: string) => {
document.head.innerHTML = document.head.innerHTML + headCode
}

View File

@ -0,0 +1,3 @@
import { createSignal } from 'solid-js'
export const [isMobile, setIsMobile] = createSignal<boolean>()