Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
web/satellite: disable some UI features for trial expired users
Added new composable to reuse handling of trial expired status. Restricted create/join project, create AG, create/open/share bucket, add team member, setup application. Issue: storj/storj-private#604 Change-Id: Ifc8250e8f86a038080c71870164ca12d48de85e0
- Loading branch information
1 parent
f58448e
commit d6d38d1
Showing
18 changed files
with
264 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (C) 2024 Storj Labs, Inc. | ||
// See LICENSE for copying information. | ||
|
||
import { computed } from 'vue'; | ||
|
||
import { useUsersStore } from '@/store/modules/usersStore'; | ||
import { useAppStore } from '@/store/modules/appStore'; | ||
import { useConfigStore } from '@/store/modules/configStore'; | ||
import { User } from '@/types/users'; | ||
|
||
export function useTrialCheck() { | ||
const userStore = useUsersStore(); | ||
const appStore = useAppStore(); | ||
const configStore = useConfigStore(); | ||
|
||
const user = computed<User>(() => userStore.state.user); | ||
|
||
const isTrialExpirationBanner = computed<boolean>(() => { | ||
if (user.value.paidTier) return false; | ||
|
||
const expirationInfo = user.value.getExpirationInfo(configStore.state.config.daysBeforeTrialEndNotification); | ||
|
||
return user.value.freezeStatus.trialExpiredFrozen || expirationInfo.isCloseToExpiredTrial; | ||
}); | ||
|
||
const isExpired = computed<boolean>(() => user.value.freezeStatus.trialExpiredFrozen); | ||
|
||
function withTrialCheck(callback: () => void | Promise<void>): void { | ||
const user = userStore.state.user; | ||
if (!user.paidTier && user.freezeStatus.trialExpiredFrozen) { | ||
appStore.toggleExpirationDialog(true); | ||
return; | ||
} | ||
|
||
callback(); | ||
} | ||
|
||
return { | ||
isTrialExpirationBanner, | ||
isExpired, | ||
withTrialCheck, | ||
}; | ||
} |
Oops, something went wrong.