Hiding teams starter plan option from org creation and org upgrade (#9017)

This commit is contained in:
Conner Turnbull 2024-05-17 09:35:41 -04:00 committed by GitHub
parent 7819dbdd56
commit 61f2def195
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 8 deletions

View File

@ -74,7 +74,10 @@
</ng-container>
<ng-template #nonEnterprisePlans>
<ng-container
*ngIf="selectableProduct.product === productTypes.Teams; else fullFeatureList"
*ngIf="
selectableProduct.product === productTypes.Teams && teamsStarterPlanIsAvailable;
else fullFeatureList
"
>
<ul class="tw-pl-0 tw-list-inside tw-mb-0">
<li>{{ "includeAllTeamsStarterFeatures" | i18n }}</li>

View File

@ -438,6 +438,10 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
return this.selectedSecretsManagerPlan != null;
}
get teamsStarterPlanIsAvailable() {
return this.selectablePlans.some((plan) => plan.type === PlanType.TeamsStarter);
}
changedProduct() {
const selectedPlan = this.selectablePlans[0];
@ -511,8 +515,13 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
if (!this.formGroup.controls.businessOwned.value || this.selectedPlan.canBeUsedByBusiness) {
return;
}
this.formGroup.controls.product.setValue(ProductType.TeamsStarter);
this.formGroup.controls.plan.setValue(PlanType.TeamsStarter);
if (this.teamsStarterPlanIsAvailable) {
this.formGroup.controls.product.setValue(ProductType.TeamsStarter);
this.formGroup.controls.plan.setValue(PlanType.TeamsStarter);
} else {
this.formGroup.controls.product.setValue(ProductType.Teams);
this.formGroup.controls.plan.setValue(PlanType.TeamsAnnually);
}
this.changedProduct();
}
@ -763,11 +772,20 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
}
if (this.currentPlan && this.currentPlan.product !== ProductType.Enterprise) {
const upgradedPlan = this.passwordManagerPlans.find((plan) =>
this.currentPlan.product === ProductType.Free
? plan.type === PlanType.FamiliesAnnually
: plan.upgradeSortOrder == this.currentPlan.upgradeSortOrder + 1,
);
const upgradedPlan = this.passwordManagerPlans.find((plan) => {
if (this.currentPlan.product === ProductType.Free) {
return plan.type === PlanType.FamiliesAnnually;
}
if (
this.currentPlan.product === ProductType.Families &&
!this.teamsStarterPlanIsAvailable
) {
return plan.type === PlanType.TeamsAnnually;
}
return plan.upgradeSortOrder === this.currentPlan.upgradeSortOrder + 1;
});
this.plan = upgradedPlan.type;
this.product = upgradedPlan.product;