mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
[AC-1359] Setting plan and product to Teams if adding an org from a provider (#7269)
* wip * Running prettier after npm ci * Defects AC-1929 AC-1955 AC-1956 * Setting plan and product to Teams if adding an org from a provider * Updated logic to correctly set seat count depending on how you approach the upgrade flow * Moved logic setting seat count to changedProduct * Setting sm seats when upgrading to the current count * Setting max storage if the organization's current plan has it set above the base * Refactored logic in changedProduct to be a bit more concise. Added logic for handling sm service accounts and storage increases * Decomposed the logic in changedProduct * Resolved defects introduced in the merge conflict * Changes after executing `npm run prettier` --------- Co-authored-by: Alex Morask <amorask@bitwarden.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
@@ -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) {
|
if (this.hasProvider) {
|
||||||
this.formGroup.controls.businessOwned.setValue(true);
|
this.formGroup.controls.businessOwned.setValue(true);
|
||||||
this.changedOwnedBusiness();
|
this.changedOwnedBusiness();
|
||||||
this.provider = await this.apiService.getProvider(this.providerId);
|
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) {
|
if (!this.createOrganization) {
|
||||||
@@ -187,6 +203,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
|
|||||||
this.singleOrgPolicyAppliesToActiveUser = policyAppliesToActiveUser;
|
this.singleOrgPolicyAppliesToActiveUser = policyAppliesToActiveUser;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.changedProduct();
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,12 +465,17 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.currentPlan?.PasswordManager?.hasAdditionalSeatsOption) {
|
if (this.currentPlan && !this.currentPlan.PasswordManager.hasAdditionalSeatsOption) {
|
||||||
this.formGroup.controls.additionalSeats.setValue(this.currentPlan.PasswordManager.baseSeats);
|
this.formGroup.controls.additionalSeats.setValue(this.currentPlan.PasswordManager.baseSeats);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.organization) {
|
||||||
this.formGroup.controls.additionalSeats.setValue(this.organization.seats);
|
this.formGroup.controls.additionalSeats.setValue(this.organization.seats);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.formGroup.controls.additionalSeats.setValue(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSecretsManagerForm() {
|
handleSecretsManagerForm() {
|
||||||
@@ -461,7 +483,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
|
|||||||
this.secretsManagerForm.enable();
|
this.secretsManagerForm.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.organization.useSecretsManager) {
|
if (this.organization?.useSecretsManager) {
|
||||||
this.secretsManagerForm.controls.enabled.setValue(true);
|
this.secretsManagerForm.controls.enabled.setValue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user