Skip to content

Beautiful Open-Source Form Builder

Crisp fix (#42)

Chirag66a5d4f3a441
diff --git a/resources/js/base.js b/resources/js/base.js
index 89aad1884..19f5aec41 100644
--- a/resources/js/base.js
+++ b/resources/js/base.js
@@ -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)
},
diff --git a/resources/js/middleware/check-auth.js b/resources/js/middleware/check-auth.js
index 4574063bd..396ebde0c 100644
--- a/resources/js/middleware/check-auth.js
+++ b/resources/js/middleware/check-auth.js
@@ -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)
diff --git a/resources/js/pages/auth/components/RegisterForm.vue b/resources/js/pages/auth/components/RegisterForm.vue
index 8abe17104..82933dace 100644
--- a/resources/js/pages/auth/components/RegisterForm.vue
+++ b/resources/js/pages/auth/components/RegisterForm.vue
@@ -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){
diff --git a/resources/js/plugins/vue-plugins.js b/resources/js/plugins/vue-plugins.js
index bcec051e4..a6e019433 100644
--- a/resources/js/plugins/vue-plugins.js
+++ b/resources/js/plugins/vue-plugins.js
@@ -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
-}