14
packages/js/src/utils/executeIntegrations.ts
Normal file
14
packages/js/src/utils/executeIntegrations.ts
Normal 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)
|
||||
}
|
||||
}
|
12
packages/js/src/utils/executeLogic.ts
Normal file
12
packages/js/src/utils/executeLogic.ts
Normal 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)
|
||||
}
|
||||
}
|
3
packages/js/src/utils/injectHeadCode.ts
Normal file
3
packages/js/src/utils/injectHeadCode.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export const injectHeadCode = (headCode: string) => {
|
||||
document.head.innerHTML = document.head.innerHTML + headCode
|
||||
}
|
3
packages/js/src/utils/isMobileSignal.ts
Normal file
3
packages/js/src/utils/isMobileSignal.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import { createSignal } from 'solid-js'
|
||||
|
||||
export const [isMobile, setIsMobile] = createSignal<boolean>()
|
Reference in New Issue
Block a user