-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Updates to trial expired state (#3762)
- Loading branch information
Showing
6 changed files
with
114 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,8 +186,13 @@ const isMonthlyToAnnual = computed(() => { | |
const isSelectable = computed(() => { | ||
if (!props.isAdmin) return false | ||
// Always enable buttons during trial | ||
if (statusIsTrial.value) return true | ||
// Always enable buttons during trial, expired or canceled state | ||
if ( | ||
statusIsTrial.value || | ||
props.currentPlan?.status === WorkspacePlanStatuses.Expired || | ||
props.currentPlan?.status === WorkspacePlanStatuses.Canceled | ||
) | ||
return true | ||
// Allow selection if switching from monthly to yearly for the same plan | ||
if (isMonthlyToAnnual.value && props.currentPlan?.name === props.plan.name) | ||
|
@@ -213,15 +218,22 @@ const isSelectable = computed(() => { | |
}) | ||
const buttonColor = computed(() => { | ||
if (statusIsTrial.value) { | ||
if ( | ||
statusIsTrial.value || | ||
props.currentPlan?.status === WorkspacePlanStatuses.Expired | ||
) { | ||
return props.plan.name === WorkspacePlans.Starter ? 'primary' : 'outline' | ||
} | ||
return 'outline' | ||
}) | ||
const buttonText = computed(() => { | ||
// Trial plan case | ||
if (statusIsTrial.value) { | ||
// Allow selection during trial, expired or canceled state | ||
if ( | ||
statusIsTrial.value || | ||
props.currentPlan?.status === WorkspacePlanStatuses.Expired || | ||
props.currentPlan?.status === WorkspacePlanStatuses.Canceled | ||
) { | ||
return `Subscribe to ${startCase(props.plan.name)}` | ||
} | ||
// Current plan case | ||
|
@@ -248,7 +260,13 @@ const buttonTooltip = computed(() => { | |
return 'You must be a workspace admin.' | ||
} | ||
if (statusIsTrial.value || isCurrentPlan.value) return | ||
if ( | ||
statusIsTrial.value || | ||
isCurrentPlan.value || | ||
props.currentPlan?.status === WorkspacePlanStatuses.Expired || | ||
props.currentPlan?.status === WorkspacePlanStatuses.Canceled | ||
) | ||
return undefined | ||
if (isDowngrade.value) { | ||
return 'Downgrading is not supported at the moment. Please contact [email protected].' | ||
|
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