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

View File

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

View File

@ -111,9 +111,9 @@ export default {
// Track event // Track event
this.$logEvent('register', { source: this.form.hear_about_us }) 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 // Redirect
if(this.isQuick){ if(this.isQuick){

View File

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