diff --git a/apps/web/src/app/billing/organizations/organization-plans.component.ts b/apps/web/src/app/billing/organizations/organization-plans.component.ts index 6f01d42174b..dd246b5f75b 100644 --- a/apps/web/src/app/billing/organizations/organization-plans.component.ts +++ b/apps/web/src/app/billing/organizations/organization-plans.component.ts @@ -167,10 +167,26 @@ 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, + ); + + this.plan = upgradedPlan.type; + this.product = upgradedPlan.product; + } + if (this.hasProvider) { this.formGroup.controls.businessOwned.setValue(true); this.changedOwnedBusiness(); this.provider = await this.apiService.getProvider(this.providerId); + const providerDefaultPlan = this.passwordManagerPlans.find( + (plan) => plan.type === PlanType.TeamsAnnually, + ); + this.plan = providerDefaultPlan.type; + this.product = providerDefaultPlan.product; } if (!this.createOrganization) { @@ -187,6 +203,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { this.singleOrgPolicyAppliesToActiveUser = policyAppliesToActiveUser; }); + this.changedProduct(); this.loading = false; } @@ -448,12 +465,17 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { return; } - if (!this.currentPlan?.PasswordManager?.hasAdditionalSeatsOption) { + if (this.currentPlan && !this.currentPlan.PasswordManager.hasAdditionalSeatsOption) { this.formGroup.controls.additionalSeats.setValue(this.currentPlan.PasswordManager.baseSeats); return; } - this.formGroup.controls.additionalSeats.setValue(this.organization.seats); + if (this.organization) { + this.formGroup.controls.additionalSeats.setValue(this.organization.seats); + return; + } + + this.formGroup.controls.additionalSeats.setValue(1); } handleSecretsManagerForm() { @@ -461,7 +483,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { this.secretsManagerForm.enable(); } - if (this.organization.useSecretsManager) { + if (this.organization?.useSecretsManager) { this.secretsManagerForm.controls.enabled.setValue(true); }