2023-12-09 14:47:03 +00:00
< template >
< div class = "flex flex-col min-h-screen" >
< div class = "w-full md:max-w-3xl md:mx-auto px-4 mb-10 md:pb-20 md:pt-16 text-center flex-grow" >
< h1 class = "text-4xl font-semibold" >
Thank you !
< / h1 >
< h4 class = "text-xl mt-6" >
We ' re checking the status of your subscription please wait a moment ...
< / h4 >
< div class = "text-center" >
2023-12-11 10:56:21 +00:00
< Loader class = "h-6 w-6 text-nt-blue mx-auto mt-20" / >
2023-12-09 14:47:03 +00:00
< / div >
< / div >
< open -form -footer / >
< / div >
< / template >
< script >
import { computed } from 'vue'
import { useAuthStore } from '../../stores/auth'
export default {
layout : 'default' ,
middleware : 'auth' ,
setup ( ) {
2024-01-04 17:38:50 +00:00
useOpnSeoMeta ( {
title : 'Subscription Success'
} )
2023-12-09 14:47:03 +00:00
const authStore = useAuthStore ( )
return {
authStore ,
authenticated : computed ( ( ) => authStore . check ) ,
2024-01-31 16:48:43 +00:00
user : computed ( ( ) => authStore . user ) ,
crisp : useCrisp ( )
2023-12-09 14:47:03 +00:00
}
} ,
data : ( ) => ( {
interval : null
} ) ,
mounted ( ) {
this . redirectIfSubscribed ( )
this . interval = setInterval ( ( ) => this . checkSubscription ( ) , 5000 )
} ,
beforeUnmount ( ) {
clearInterval ( this . interval )
} ,
methods : {
async checkSubscription ( ) {
// Fetch the user.
await this . authStore . fetchUser ( )
this . redirectIfSubscribed ( )
} ,
redirectIfSubscribed ( ) {
if ( this . user . is _subscribed ) {
2024-01-13 18:57:39 +00:00
useAmplitude ( ) . logEvent ( 'subscribed' , { plan : this . user . has _enterprise _subscription ? 'enterprise' : 'pro' } )
2024-01-31 16:48:43 +00:00
this . crisp . pushEvent ( 'subscribed' , { plan : this . user . has _enterprise _subscription ? 'enterprise' : 'pro' } )
2023-12-09 14:47:03 +00:00
this . $router . push ( { name : 'home' } )
if ( this . user . has _enterprise _subscription ) {
2023-12-31 11:39:01 +00:00
useAlert ( ) . success ( 'Awesome! Your subscription to OpnForm is now confirmed! You now have access to all Enterprise ' +
2023-12-09 14:47:03 +00:00
'features. No need to invite your teammates, just ask them to create a OpnForm account and to connect the same Notion workspace. Feel free to contact us if you have any question 🙌' )
} else {
2023-12-31 11:39:01 +00:00
useAlert ( ) . success ( 'Awesome! Your subscription to OpnForm is now confirmed! You now have access to all Pro ' +
2023-12-09 14:47:03 +00:00
'features. Feel free to contact us if you have any question 🙌' )
}
}
}
} ,
computed : { }
}
< / script >