Crisp fix (#42)

This commit is contained in:
Chirag 2022-12-22 16:24:01 +05:30 committed by GitHub
parent 07f44ec048
commit 66a5d4f3a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 18 deletions

23
resources/js/base.js vendored
View File

@ -4,7 +4,11 @@
import debounce from 'debounce'
export default {
computed: {},
computed: {
$crisp () {
return window.$crisp
}
},
metaInfo () {
const info = {
@ -39,49 +43,50 @@ export default {
/**
* Show an error message.
*/
alertError (message, autoClose=10000) {
alertError (message, autoClose = 10000) {
this.$notify(
{
title: 'Error',
text: message,
type: 'error',
type: 'error'
}, autoClose)
},
/**
* Show a success message.
*/
alertSuccess (message, autoClose=10000) {
alertSuccess (message, autoClose = 10000) {
this.$notify(
{
title: 'Success',
text: message,
type: 'success',
type: 'success'
}, autoClose)
},
/**
* Show a warning message.
*/
alertWarning (message, autoClose=10000) {
alertWarning (message, autoClose = 10000) {
this.$notify(
{
title: 'Warning',
text: message,
type: 'warning',
type: 'warning'
}, autoClose)
},
/**
* Show confirmation message.
*/
alertConfirm (message, success, failure, autoClose= 10000) {
alertConfirm (message, success, failure = ()=>{}, autoClose = 10000) {
this.$notify(
{
title: 'Confirm',
text: message,
type: 'confirm',
success, failure
success,
failure
}, autoClose)
},

View File

@ -7,7 +7,7 @@ export function initCrisp (user) {
window.$crisp.push(['set', 'user:email', user.email])
window.$crisp.push(['set', 'user:nickname', user.name])
window.$crisp.push(['set', 'session:data', [[
['pro-subscription', user.is_subscribed],
['pro-subscription', user?.is_subscribed ?? false],
['id', user.id]
]]])
window.clearInterval(intervalId)

View File

@ -111,9 +111,9 @@ export default {
// Track event
this.$logEvent('register', { source: this.form.hear_about_us })
initCrisp(data).then(() => {
this.$getCrisp().push(['set', 'session:event', [[['register', {}, 'blue']]]])
})
initCrisp(data)
this.$crisp.push(['set', 'session:event', [[['register', {}, 'blue']]]])
// Redirect
if(this.isQuick){

View File

@ -1,12 +1,7 @@
import Vue from 'vue'
import PortalVue from 'portal-vue'
import Notifications from "vt-notifications"
Vue.use(PortalVue)
Vue.use(Notifications)
Vue.prototype.$getCrisp = () => {
return window.$crisp
}