opnform/resources/js/components/service/Crisp.vue

34 lines
670 B
Vue
Raw Normal View History

2022-09-20 19:59:52 +00:00
<template />
<script>
export default {
name: 'Crisp',
computed: {
isIframe () {
return window.location !== window.parent.location || window.frameElement
}
},
watch: {},
mounted () {
this.loadCrisp()
},
methods: {
loadCrisp () {
if (this.isIframe || !window.config.crisp_website_id) return
2022-09-20 19:59:52 +00:00
window.CRISP_WEBSITE_ID = window.config.crisp_website_id
2022-09-20 19:59:52 +00:00
const script = document.createElement('script')
script.setAttribute('src', 'https://client.crisp.chat/l.js')
script.setAttribute('id', 'crisp-widget')
script.setAttribute('async', 1)
document.head.appendChild(script)
}
}
}
</script>