Line data Source code
1 : import { computed } from 'vue'
2 :
3 : import { useBillingContext } from '@/platform/billing/composables/useBillingContext'
4 :
5 13 : export function useTeamPlan() {
6 13 : const {
7 : canAccessSubscriptionFeatures,
8 : isInitialized,
9 : isTeamPlan,
10 : maxSeats,
11 : subscription
12 : } = useBillingContext()
13 :
14 13 : const isCancelled = computed(() => subscription.value?.isCancelled ?? false)
15 : const isOnTeamPlan = computed(
16 : () =>
17 : isTeamPlan.value &&
18 : canAccessSubscriptionFeatures.value &&
19 : !isCancelled.value
20 : )
21 : const hasMemberSeats = computed(
22 : () => maxSeats.value === 0 || (maxSeats.value ?? 0) > 1
23 : )
24 : const isPlanLoading = computed(() => !isInitialized.value)
25 :
26 13 : return {
27 : maxSeats,
28 : hasTeamPlan: isTeamPlan,
29 : isOnTeamPlan,
30 : isCancelled,
31 : hasMemberSeats,
32 : isPlanLoading
33 : }
34 : }
|