webapp: harden mapbox/chatwoot runtime config
Some checks failed
Build Docker Image / build (push) Failing after 13m29s
Some checks failed
Build Docker Image / build (push) Failing after 13m29s
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
export default defineNuxtPlugin(() => {
|
||||
const config = useRuntimeConfig()
|
||||
const baseUrl = String(config.public.chatwootBaseUrl || '').trim()
|
||||
const websiteToken = String(config.public.chatwootWebsiteToken || '').trim()
|
||||
|
||||
if (!baseUrl || !websiteToken) {
|
||||
return
|
||||
}
|
||||
|
||||
const loadChatwoot = () => {
|
||||
if (document.getElementById('chatwoot-sdk')) return
|
||||
|
||||
const baseUrl = 'https://chatwoot.optovia.ru'
|
||||
const script = document.createElement('script')
|
||||
script.id = 'chatwoot-sdk'
|
||||
script.src = `${baseUrl}/packs/js/sdk.js`
|
||||
@@ -10,7 +17,7 @@ export default defineNuxtPlugin(() => {
|
||||
script.defer = true
|
||||
script.onload = () => {
|
||||
window.chatwootSDK?.run({
|
||||
websiteToken: 'bc668ge3hM5ZpPeUgGEV1ZU9',
|
||||
websiteToken,
|
||||
baseUrl
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user