2023-12-09 15:47:03 +01:00
< template >
< div class = "flex flex-col min-h-screen" >
2024-04-15 19:39:03 +02:00
< 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"
>
2023-12-09 15:47:03 +01:00
< 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 11:56:21 +01:00
< Loader class = "h-6 w-6 text-nt-blue mx-auto mt-20" / >
2023-12-09 15:47:03 +01:00
< / div >
< / div >
< open -form -footer / >
< / div >
< / template >
< script >
2024-06-06 18:03:41 +02:00
import { computed } from "vue"
import { useAuthStore } from "../../stores/auth"
2023-12-09 15:47:03 +01:00
export default {
2024-04-15 19:39:03 +02:00
layout : "default" ,
middleware : "auth" ,
2023-12-09 15:47:03 +01:00
2024-04-15 19:39:03 +02:00
setup ( ) {
2024-01-04 18:38:50 +01:00
useOpnSeoMeta ( {
2024-04-15 19:39:03 +02:00
title : "Subscription Success" ,
2024-01-04 18:38:50 +01:00
} )
2023-12-09 15:47:03 +01:00
const authStore = useAuthStore ( )
return {
authStore ,
2024-04-15 19:39:03 +02:00
authenticated : computed ( ( ) => authStore . check ) ,
user : computed ( ( ) => authStore . user ) ,
crisp : useCrisp ( ) ,
2023-12-09 15:47:03 +01:00
}
} ,
data : ( ) => ( {
2024-04-15 19:39:03 +02:00
interval : null ,
2023-12-09 15:47:03 +01:00
} ) ,
2024-04-15 19:39:03 +02:00
computed : { } ,
mounted ( ) {
2023-12-09 15:47:03 +01:00
this . redirectIfSubscribed ( )
this . interval = setInterval ( ( ) => this . checkSubscription ( ) , 5000 )
} ,
2024-04-15 19:39:03 +02:00
beforeUnmount ( ) {
2023-12-09 15:47:03 +01:00
clearInterval ( this . interval )
} ,
methods : {
2024-04-15 19:39:03 +02:00
async checkSubscription ( ) {
2023-12-09 15:47:03 +01:00
// Fetch the user.
await this . authStore . fetchUser ( )
this . redirectIfSubscribed ( )
} ,
2024-04-15 19:39:03 +02:00
redirectIfSubscribed ( ) {
2023-12-09 15:47:03 +01:00
if ( this . user . is _subscribed ) {
2024-04-15 19:39:03 +02:00
useAmplitude ( ) . logEvent ( "subscribed" , {
2024-06-06 18:03:41 +02:00
plan : "pro" ,
2024-04-15 19:39:03 +02:00
} )
this . crisp . pushEvent ( "subscribed" , {
2024-06-06 18:03:41 +02:00
plan : "pro" ,
2024-04-15 19:39:03 +02:00
} )
2024-06-06 18:03:41 +02:00
try {
useGtm ( ) . trackEvent ( { event : 'subscribed' } )
} catch ( error ) {
console . error ( error )
}
this . $router . push ( { name : "home" } )
2023-12-09 15:47:03 +01:00
if ( this . user . has _enterprise _subscription ) {
2024-04-15 19:39:03 +02:00
useAlert ( ) . success (
"Awesome! Your subscription to OpnForm is now confirmed! You now have access to all Enterprise " +
2024-06-06 18:03:41 +02: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 🙌" ,
2024-04-15 19:39:03 +02:00
)
2023-12-09 15:47:03 +01:00
} else {
2024-04-15 19:39:03 +02:00
useAlert ( ) . success (
"Awesome! Your subscription to OpnForm is now confirmed! You now have access to all Pro " +
2024-06-06 18:03:41 +02:00
"features. Feel free to contact us if you have any question 🙌" ,
2024-04-15 19:39:03 +02:00
)
2023-12-09 15:47:03 +01:00
}
}
2024-04-15 19:39:03 +02:00
} ,
2023-12-09 15:47:03 +01:00
} ,
}
< / script >