[PM-8830] Billing Enums Rename (#9612)

* Renamed ProductType to ProductTierType

* Renamed Product properties to ProductTier

* Moved product-tier-type.enum.ts to billing folder

* Added ProductType enum
This commit is contained in:
Conner Turnbull 2024-06-14 15:43:40 -04:00 committed by GitHub
parent e521d702ba
commit f484dd491b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 164 additions and 157 deletions

View File

@ -57,12 +57,12 @@
> >
<div class="vault-select-org-text-container"> <div class="vault-select-org-text-container">
<i <i
*ngIf="organization.planProductType !== 1" *ngIf="organization.productTierType !== 1"
class="bwi bwi-fw bwi-business vault-select-prefix-icon" class="bwi bwi-fw bwi-business vault-select-prefix-icon"
aria-hidden="true" aria-hidden="true"
></i> ></i>
<i <i
*ngIf="organization.planProductType === 1" *ngIf="organization.productTierType === 1"
class="bwi bwi-fw bwi-family vault-select-prefix-icon" class="bwi bwi-fw bwi-family vault-select-prefix-icon"
aria-hidden="true" aria-hidden="true"
></i> ></i>

View File

@ -5,7 +5,7 @@ import { BehaviorSubject } from "rxjs";
import { SearchService } from "@bitwarden/common/abstractions/search.service"; import { SearchService } from "@bitwarden/common/abstractions/search.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { ProductType } from "@bitwarden/common/enums"; import { ProductTierType } from "@bitwarden/common/billing/enums";
import { ObservableTracker } from "@bitwarden/common/spec"; import { ObservableTracker } from "@bitwarden/common/spec";
import { CipherId } from "@bitwarden/common/types/guid"; import { CipherId } from "@bitwarden/common/types/guid";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
@ -78,7 +78,7 @@ describe("VaultPopupItemsService", () => {
mockOrg = { mockOrg = {
id: "org1", id: "org1",
name: "Organization 1", name: "Organization 1",
planProductType: ProductType.Enterprise, productTierType: ProductTierType.Enterprise,
} as Organization; } as Organization;
mockCollections = [ mockCollections = [

View File

@ -6,7 +6,7 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { PolicyType } from "@bitwarden/common/admin-console/enums"; import { PolicyType } from "@bitwarden/common/admin-console/enums";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { ProductType } from "@bitwarden/common/enums"; import { ProductTierType } from "@bitwarden/common/billing/enums";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service"; import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service";
@ -206,7 +206,7 @@ describe("VaultPopupListFiltersService", () => {
name: "family org", name: "family org",
id: "1234-3323-23223", id: "1234-3323-23223",
enabled: true, enabled: true,
planProductType: ProductType.Families, productTierType: ProductTierType.Families,
}, },
] as Organization[]; ] as Organization[];
@ -224,7 +224,7 @@ describe("VaultPopupListFiltersService", () => {
name: "free org", name: "free org",
id: "1234-3323-23223", id: "1234-3323-23223",
enabled: true, enabled: true,
planProductType: ProductType.Free, productTierType: ProductTierType.Free,
}, },
] as Organization[]; ] as Organization[];
@ -242,7 +242,7 @@ describe("VaultPopupListFiltersService", () => {
name: "free org", name: "free org",
id: "1234-3323-23223", id: "1234-3323-23223",
enabled: false, enabled: false,
planProductType: ProductType.Free, productTierType: ProductTierType.Free,
}, },
] as Organization[]; ] as Organization[];

View File

@ -16,7 +16,7 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { PolicyType } from "@bitwarden/common/admin-console/enums"; import { PolicyType } from "@bitwarden/common/admin-console/enums";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { ProductType } from "@bitwarden/common/enums"; import { ProductTierType } from "@bitwarden/common/billing/enums";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { Utils } from "@bitwarden/common/platform/misc/utils"; import { Utils } from "@bitwarden/common/platform/misc/utils";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
@ -216,8 +216,8 @@ export class VaultPopupListFiltersService {
// Show a warning icon if the organization is deactivated // Show a warning icon if the organization is deactivated
icon = "bwi-exclamation-triangle tw-text-danger"; icon = "bwi-exclamation-triangle tw-text-danger";
} else if ( } else if (
org.planProductType === ProductType.Families || org.productTierType === ProductTierType.Families ||
org.planProductType === ProductType.Free org.productTierType === ProductTierType.Free
) { ) {
// Show a family icon if the organization is a family or free org // Show a family icon if the organization is a family or free org
icon = "bwi-family"; icon = "bwi-family";

View File

@ -1,5 +1,5 @@
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { ProductType } from "@bitwarden/common/enums"; import { ProductTierType } from "@bitwarden/common/billing/enums";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view"; import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
@ -26,13 +26,13 @@ export class PopupCipherView extends CipherView {
* Get the bwi icon for the cipher according to the organization type. * Get the bwi icon for the cipher according to the organization type.
*/ */
get orgIcon(): "bwi-family" | "bwi-business" | null { get orgIcon(): "bwi-family" | "bwi-business" | null {
switch (this.organization?.planProductType) { switch (this.organization?.productTierType) {
case ProductType.Free: case ProductTierType.Free:
case ProductType.Families: case ProductTierType.Families:
return "bwi-family"; return "bwi-family";
case ProductType.Teams: case ProductTierType.Teams:
case ProductType.Enterprise: case ProductTierType.Enterprise:
case ProductType.TeamsStarter: case ProductTierType.TeamsStarter:
return "bwi-business"; return "bwi-business";
default: default:
return null; return null;

View File

@ -28,7 +28,8 @@
<input id="emails" type="text" appAutoFocus bitInput formControlName="emails" /> <input id="emails" type="text" appAutoFocus bitInput formControlName="emails" />
<bit-hint>{{ <bit-hint>{{
"inviteMultipleEmailDesc" "inviteMultipleEmailDesc"
| i18n: (organization.planProductType === ProductType.TeamsStarter ? "10" : "20") | i18n
: (organization.productTierType === ProductTierType.TeamsStarter ? "10" : "20")
}}</bit-hint> }}</bit-hint>
</bit-form-field> </bit-form-field>
</ng-container> </ng-container>

View File

@ -22,7 +22,7 @@ import {
import { PermissionsApi } from "@bitwarden/common/admin-console/models/api/permissions.api"; import { PermissionsApi } from "@bitwarden/common/admin-console/models/api/permissions.api";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { ProductType } from "@bitwarden/common/enums"; import { ProductTierType } from "@bitwarden/common/billing/enums";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
@ -463,7 +463,8 @@ export class MemberDialogComponent implements OnDestroy {
await this.userService.save(userView); await this.userService.save(userView);
} else { } else {
userView.id = this.params.organizationUserId; userView.id = this.params.organizationUserId;
const maxEmailsCount = organization.planProductType === ProductType.TeamsStarter ? 10 : 20; const maxEmailsCount =
organization.productTierType === ProductTierType.TeamsStarter ? 10 : 20;
const emails = [...new Set(this.formGroup.value.emails.trim().split(/\s*,\s*/))]; const emails = [...new Set(this.formGroup.value.emails.trim().split(/\s*,\s*/))];
if (emails.length > maxEmailsCount) { if (emails.length > maxEmailsCount) {
this.formGroup.controls.emails.setErrors({ this.formGroup.controls.emails.setErrors({
@ -614,7 +615,7 @@ export class MemberDialogComponent implements OnDestroy {
}); });
} }
protected readonly ProductType = ProductType; protected readonly ProductTierType = ProductTierType;
} }
function mapCollectionToAccessItemView( function mapCollectionToAccessItemView(

View File

@ -2,7 +2,7 @@ import { AbstractControl, FormControl, ValidationErrors } from "@angular/forms";
import { OrganizationUserType } from "@bitwarden/common/admin-console/enums"; import { OrganizationUserType } from "@bitwarden/common/admin-console/enums";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { ProductType } from "@bitwarden/common/enums"; import { ProductTierType } from "@bitwarden/common/billing/enums";
import { orgSeatLimitReachedValidator } from "./org-seat-limit-reached.validator"; import { orgSeatLimitReachedValidator } from "./org-seat-limit-reached.validator";
@ -54,7 +54,7 @@ describe("orgSeatLimitReachedValidator", () => {
it("should return null when max seats are not exceeded on free plan", () => { it("should return null when max seats are not exceeded on free plan", () => {
organization = orgFactory({ organization = orgFactory({
planProductType: ProductType.Free, productTierType: ProductTierType.Free,
seats: 2, seats: 2,
}); });
validatorFn = orgSeatLimitReachedValidator( validatorFn = orgSeatLimitReachedValidator(
@ -71,7 +71,7 @@ describe("orgSeatLimitReachedValidator", () => {
it("should return null when max seats are not exceeded on teams starter plan", () => { it("should return null when max seats are not exceeded on teams starter plan", () => {
organization = orgFactory({ organization = orgFactory({
planProductType: ProductType.TeamsStarter, productTierType: ProductTierType.TeamsStarter,
seats: 10, seats: 10,
}); });
validatorFn = orgSeatLimitReachedValidator( validatorFn = orgSeatLimitReachedValidator(
@ -98,7 +98,7 @@ describe("orgSeatLimitReachedValidator", () => {
it("should return validation error when max seats are exceeded on free plan", () => { it("should return validation error when max seats are exceeded on free plan", () => {
organization = orgFactory({ organization = orgFactory({
planProductType: ProductType.Free, productTierType: ProductTierType.Free,
seats: 2, seats: 2,
}); });
const errorMessage = "You cannot invite more than 2 members without upgrading your plan."; const errorMessage = "You cannot invite more than 2 members without upgrading your plan.";
@ -117,7 +117,7 @@ describe("orgSeatLimitReachedValidator", () => {
it("should return null when not on free plan", () => { it("should return null when not on free plan", () => {
const control = new FormControl("user2@example.com,user3@example.com"); const control = new FormControl("user2@example.com,user3@example.com");
organization = orgFactory({ organization = orgFactory({
planProductType: ProductType.Enterprise, productTierType: ProductTierType.Enterprise,
seats: 100, seats: 100,
}); });
validatorFn = orgSeatLimitReachedValidator( validatorFn = orgSeatLimitReachedValidator(

View File

@ -1,7 +1,7 @@
import { AbstractControl, ValidationErrors, ValidatorFn } from "@angular/forms"; import { AbstractControl, ValidationErrors, ValidatorFn } from "@angular/forms";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { ProductType } from "@bitwarden/common/enums"; import { ProductTierType } from "@bitwarden/common/billing/enums";
/** /**
* If the organization doesn't allow additional seat options, this checks if the seat limit has been reached when adding * If the organization doesn't allow additional seat options, this checks if the seat limit has been reached when adding
@ -37,9 +37,9 @@ export function orgSeatLimitReachedValidator(
); );
const productHasAdditionalSeatsOption = const productHasAdditionalSeatsOption =
organization.planProductType !== ProductType.Free && organization.productTierType !== ProductTierType.Free &&
organization.planProductType !== ProductType.Families && organization.productTierType !== ProductTierType.Families &&
organization.planProductType !== ProductType.TeamsStarter; organization.productTierType !== ProductTierType.TeamsStarter;
return !productHasAdditionalSeatsOption && return !productHasAdditionalSeatsOption &&
allOrganizationUserEmails.length + newEmailsToAdd.length > organization.seats allOrganizationUserEmails.length + newEmailsToAdd.length > organization.seats

View File

@ -33,7 +33,7 @@ import { Organization } from "@bitwarden/common/admin-console/models/domain/orga
import { Policy } from "@bitwarden/common/admin-console/models/domain/policy"; import { Policy } from "@bitwarden/common/admin-console/models/domain/policy";
import { OrganizationKeysRequest } from "@bitwarden/common/admin-console/models/request/organization-keys.request"; import { OrganizationKeysRequest } from "@bitwarden/common/admin-console/models/request/organization-keys.request";
import { BillingApiServiceAbstraction } from "@bitwarden/common/billing/abstractions/billilng-api.service.abstraction"; import { BillingApiServiceAbstraction } from "@bitwarden/common/billing/abstractions/billilng-api.service.abstraction";
import { ProductType } from "@bitwarden/common/enums"; import { ProductTierType } from "@bitwarden/common/billing/enums";
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
@ -335,13 +335,13 @@ export class PeopleComponent extends NewBasePeopleComponent<OrganizationUserView
return this.organization.canEditSubscription ? "ManageBilling" : "NoManageBilling"; return this.organization.canEditSubscription ? "ManageBilling" : "NoManageBilling";
} }
private getProductKey(productType: ProductType): string { private getProductKey(productType: ProductTierType): string {
let product = ""; let product = "";
switch (productType) { switch (productType) {
case ProductType.Free: case ProductTierType.Free:
product = "freeOrg"; product = "freeOrg";
break; break;
case ProductType.TeamsStarter: case ProductTierType.TeamsStarter:
product = "teamsStarterPlan"; product = "teamsStarterPlan";
break; break;
default: default:
@ -352,7 +352,7 @@ export class PeopleComponent extends NewBasePeopleComponent<OrganizationUserView
private getDialogContent(): string { private getDialogContent(): string {
return this.i18nService.t( return this.i18nService.t(
this.getProductKey(this.organization.planProductType), this.getProductKey(this.organization.productTierType),
this.organization.seats, this.organization.seats,
); );
} }
@ -362,9 +362,9 @@ export class PeopleComponent extends NewBasePeopleComponent<OrganizationUserView
return this.i18nService.t("ok"); return this.i18nService.t("ok");
} }
const productType = this.organization.planProductType; const productType = this.organization.productTierType;
if (productType !== ProductType.Free && productType !== ProductType.TeamsStarter) { if (productType !== ProductTierType.Free && productType !== ProductTierType.TeamsStarter) {
throw new Error(`Unsupported product type: ${productType}`); throw new Error(`Unsupported product type: ${productType}`);
} }
@ -376,10 +376,10 @@ export class PeopleComponent extends NewBasePeopleComponent<OrganizationUserView
return; return;
} }
const productType = this.organization.planProductType; const productType = this.organization.productTierType;
if (productType !== ProductType.Free && productType !== ProductType.TeamsStarter) { if (productType !== ProductTierType.Free && productType !== ProductTierType.TeamsStarter) {
throw new Error(`Unsupported product type: ${this.organization.planProductType}`); throw new Error(`Unsupported product type: ${this.organization.productTierType}`);
} }
await this.router.navigate( await this.router.navigate(
@ -423,8 +423,8 @@ export class PeopleComponent extends NewBasePeopleComponent<OrganizationUserView
if ( if (
!user && !user &&
this.allUsers.length === this.organization.seats && this.allUsers.length === this.organization.seats &&
(this.organization.planProductType === ProductType.Free || (this.organization.productTierType === ProductTierType.Free ||
this.organization.planProductType === ProductType.TeamsStarter) this.organization.productTierType === ProductTierType.TeamsStarter)
) { ) {
// Show org upgrade modal // Show org upgrade modal
await this.showSeatLimitReachedDialog(); await this.showSeatLimitReachedDialog();

View File

@ -8,8 +8,7 @@ import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { OrganizationSponsorshipRedeemRequest } from "@bitwarden/common/admin-console/models/request/organization/organization-sponsorship-redeem.request"; import { OrganizationSponsorshipRedeemRequest } from "@bitwarden/common/admin-console/models/request/organization/organization-sponsorship-redeem.request";
import { PlanSponsorshipType, PlanType } from "@bitwarden/common/billing/enums"; import { PlanSponsorshipType, PlanType, ProductTierType } from "@bitwarden/common/billing/enums";
import { ProductType } from "@bitwarden/common/enums";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
@ -36,7 +35,7 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit, OnDestroy {
} }
value.plan = PlanType.FamiliesAnnually; value.plan = PlanType.FamiliesAnnually;
value.product = ProductType.Families; value.productTier = ProductTierType.Families;
value.acceptingSponsorship = true; value.acceptingSponsorship = true;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil // eslint-disable-next-line rxjs-angular/prefer-takeuntil
value.onSuccess.subscribe(this.onOrganizationCreateSuccess.bind(this)); value.onSuccess.subscribe(this.onOrganizationCreateSuccess.bind(this));
@ -96,7 +95,7 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit, OnDestroy {
}); });
this.existingFamilyOrganizations$ = this.organizationService.organizations$.pipe( this.existingFamilyOrganizations$ = this.organizationService.organizations$.pipe(
map((orgs) => orgs.filter((o) => o.planProductType === ProductType.Families)), map((orgs) => orgs.filter((o) => o.productTierType === ProductTierType.Families)),
); );
this.existingFamilyOrganizations$.pipe(takeUntil(this._destroy)).subscribe((orgs) => { this.existingFamilyOrganizations$.pipe(takeUntil(this._destroy)).subscribe((orgs) => {

View File

@ -2,8 +2,7 @@ import { Component, OnInit, ViewChild } from "@angular/core";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { first } from "rxjs/operators"; import { first } from "rxjs/operators";
import { PlanType } from "@bitwarden/common/billing/enums"; import { PlanType, ProductTierType } from "@bitwarden/common/billing/enums";
import { ProductType } from "@bitwarden/common/enums";
import { OrganizationPlansComponent } from "../../billing"; import { OrganizationPlansComponent } from "../../billing";
import { HeaderModule } from "../../layouts/header/header.module"; import { HeaderModule } from "../../layouts/header/header.module";
@ -26,16 +25,16 @@ export class CreateOrganizationComponent implements OnInit {
this.route.queryParams.pipe(first()).subscribe(async (qParams) => { this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
if (qParams.plan === "families") { if (qParams.plan === "families") {
this.orgPlansComponent.plan = PlanType.FamiliesAnnually; this.orgPlansComponent.plan = PlanType.FamiliesAnnually;
this.orgPlansComponent.product = ProductType.Families; this.orgPlansComponent.productTier = ProductTierType.Families;
} else if (qParams.plan === "teams") { } else if (qParams.plan === "teams") {
this.orgPlansComponent.plan = PlanType.TeamsAnnually; this.orgPlansComponent.plan = PlanType.TeamsAnnually;
this.orgPlansComponent.product = ProductType.Teams; this.orgPlansComponent.productTier = ProductTierType.Teams;
} else if (qParams.plan === "teamsStarter") { } else if (qParams.plan === "teamsStarter") {
this.orgPlansComponent.plan = PlanType.TeamsStarter; this.orgPlansComponent.plan = PlanType.TeamsStarter;
this.orgPlansComponent.product = ProductType.TeamsStarter; this.orgPlansComponent.productTier = ProductTierType.TeamsStarter;
} else if (qParams.plan === "enterprise") { } else if (qParams.plan === "enterprise") {
this.orgPlansComponent.plan = PlanType.EnterpriseAnnually; this.orgPlansComponent.plan = PlanType.EnterpriseAnnually;
this.orgPlansComponent.product = ProductType.Enterprise; this.orgPlansComponent.productTier = ProductTierType.Enterprise;
} }
}); });
} }

View File

@ -17,7 +17,7 @@ import { TwoFactorYubiKeyResponse } from "@bitwarden/common/auth/models/response
import { TwoFactorProviders } from "@bitwarden/common/auth/services/two-factor.service"; import { TwoFactorProviders } from "@bitwarden/common/auth/services/two-factor.service";
import { AuthResponse } from "@bitwarden/common/auth/types/auth-response"; import { AuthResponse } from "@bitwarden/common/auth/types/auth-response";
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service"; import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
import { ProductType } from "@bitwarden/common/enums"; import { ProductTierType } from "@bitwarden/common/billing/enums";
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
import { DialogService } from "@bitwarden/components"; import { DialogService } from "@bitwarden/components";
@ -258,6 +258,6 @@ export class TwoFactorSetupComponent implements OnInit, OnDestroy {
} }
get isEnterpriseOrg() { get isEnterpriseOrg() {
return this.organization?.planProductType === ProductType.Enterprise; return this.organization?.productTierType === ProductTierType.Enterprise;
} }
} }

View File

@ -1,6 +1,6 @@
import { Component, Input, ViewChild } from "@angular/core"; import { Component, Input, ViewChild } from "@angular/core";
import { ProductType } from "@bitwarden/common/enums"; import { ProductTierType } from "@bitwarden/common/billing/enums";
import { import {
OrganizationCreatedEvent, OrganizationCreatedEvent,
@ -33,22 +33,22 @@ export class SecretsManagerTrialPaidStepperComponent extends SecretsManagerTrial
get createAccountLabel() { get createAccountLabel() {
const organizationType = const organizationType =
this.productType === ProductType.TeamsStarter this.productType === ProductTierType.TeamsStarter
? "Teams Starter" ? "Teams Starter"
: ProductType[this.productType]; : ProductTierType[this.productType];
return `Before creating your ${organizationType} organization, you first need to log in or create a personal account.`; return `Before creating your ${organizationType} organization, you first need to log in or create a personal account.`;
} }
get productType(): TrialOrganizationType { get productType(): TrialOrganizationType {
switch (this.organizationTypeQueryParameter) { switch (this.organizationTypeQueryParameter) {
case "enterprise": case "enterprise":
return ProductType.Enterprise; return ProductTierType.Enterprise;
case "families": case "families":
return ProductType.Families; return ProductTierType.Families;
case "teams": case "teams":
return ProductType.Teams; return ProductTierType.Teams;
case "teamsStarter": case "teamsStarter":
return ProductType.TeamsStarter; return ProductTierType.TeamsStarter;
} }
} }

View File

@ -9,8 +9,7 @@ import { PolicyApiServiceAbstraction } from "@bitwarden/common/admin-console/abs
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { MasterPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/master-password-policy-options"; import { MasterPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/master-password-policy-options";
import { Policy } from "@bitwarden/common/admin-console/models/domain/policy"; import { Policy } from "@bitwarden/common/admin-console/models/domain/policy";
import { PlanType } from "@bitwarden/common/billing/enums"; import { PlanType, ProductTierType } from "@bitwarden/common/billing/enums";
import { ProductType } from "@bitwarden/common/enums";
import { ReferenceEventRequest } from "@bitwarden/common/models/request/reference-event.request"; import { ReferenceEventRequest } from "@bitwarden/common/models/request/reference-event.request";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
@ -67,7 +66,7 @@ export class TrialInitiationComponent implements OnInit, OnDestroy {
billingSubLabel = ""; billingSubLabel = "";
layout = "default"; layout = "default";
plan: PlanType; plan: PlanType;
product: ProductType; productTier: ProductTierType;
accountCreateOnly = true; accountCreateOnly = true;
useTrialStepper = false; useTrialStepper = false;
policies: Policy[]; policies: Policy[];
@ -153,16 +152,16 @@ export class TrialInitiationComponent implements OnInit, OnDestroy {
if (this.org === ValidOrgParams.families) { if (this.org === ValidOrgParams.families) {
this.plan = PlanType.FamiliesAnnually; this.plan = PlanType.FamiliesAnnually;
this.product = ProductType.Families; this.productTier = ProductTierType.Families;
} else if (this.org === ValidOrgParams.teamsStarter) { } else if (this.org === ValidOrgParams.teamsStarter) {
this.plan = PlanType.TeamsStarter; this.plan = PlanType.TeamsStarter;
this.product = ProductType.TeamsStarter; this.productTier = ProductTierType.TeamsStarter;
} else if (this.org === ValidOrgParams.teams) { } else if (this.org === ValidOrgParams.teams) {
this.plan = PlanType.TeamsAnnually; this.plan = PlanType.TeamsAnnually;
this.product = ProductType.Teams; this.productTier = ProductTierType.Teams;
} else if (this.org === ValidOrgParams.enterprise) { } else if (this.org === ValidOrgParams.enterprise) {
this.plan = PlanType.EnterpriseAnnually; this.plan = PlanType.EnterpriseAnnually;
this.product = ProductType.Enterprise; this.productTier = ProductTierType.Enterprise;
} }
} else if (this.routeFlowOrgs.includes(qParams.org)) { } else if (this.routeFlowOrgs.includes(qParams.org)) {
this.referenceData.flow = qParams.org; this.referenceData.flow = qParams.org;
@ -268,11 +267,11 @@ export class TrialInitiationComponent implements OnInit, OnDestroy {
} }
get trialOrganizationType(): TrialOrganizationType { get trialOrganizationType(): TrialOrganizationType {
switch (this.product) { switch (this.productTier) {
case ProductType.Free: case ProductTierType.Free:
return null; return null;
default: default:
return this.product; return this.productTier;
} }
} }

View File

@ -9,16 +9,15 @@ import {
PaymentInformation, PaymentInformation,
PlanInformation, PlanInformation,
} from "@bitwarden/common/billing/abstractions/organization-billing.service"; } from "@bitwarden/common/billing/abstractions/organization-billing.service";
import { PaymentMethodType, PlanType } from "@bitwarden/common/billing/enums"; import { PaymentMethodType, PlanType, ProductTierType } from "@bitwarden/common/billing/enums";
import { PlanResponse } from "@bitwarden/common/billing/models/response/plan.response"; import { PlanResponse } from "@bitwarden/common/billing/models/response/plan.response";
import { ProductType } from "@bitwarden/common/enums";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { BillingSharedModule, PaymentComponent, TaxInfoComponent } from "../../shared"; import { BillingSharedModule, PaymentComponent, TaxInfoComponent } from "../../shared";
export type TrialOrganizationType = Exclude<ProductType, ProductType.Free>; export type TrialOrganizationType = Exclude<ProductTierType, ProductTierType.Free>;
export interface OrganizationInfo { export interface OrganizationInfo {
name: string; name: string;
@ -176,19 +175,19 @@ export class TrialBillingStepComponent implements OnInit {
[cadence in SubscriptionCadence]?: PlanType; [cadence in SubscriptionCadence]?: PlanType;
}; };
} = { } = {
[ProductType.Enterprise]: { [ProductTierType.Enterprise]: {
[SubscriptionCadence.Annual]: PlanType.EnterpriseAnnually, [SubscriptionCadence.Annual]: PlanType.EnterpriseAnnually,
[SubscriptionCadence.Monthly]: PlanType.EnterpriseMonthly, [SubscriptionCadence.Monthly]: PlanType.EnterpriseMonthly,
}, },
[ProductType.Families]: { [ProductTierType.Families]: {
[SubscriptionCadence.Annual]: PlanType.FamiliesAnnually, [SubscriptionCadence.Annual]: PlanType.FamiliesAnnually,
// No monthly option for Families plan // No monthly option for Families plan
}, },
[ProductType.Teams]: { [ProductTierType.Teams]: {
[SubscriptionCadence.Annual]: PlanType.TeamsAnnually, [SubscriptionCadence.Annual]: PlanType.TeamsAnnually,
[SubscriptionCadence.Monthly]: PlanType.TeamsMonthly, [SubscriptionCadence.Monthly]: PlanType.TeamsMonthly,
}, },
[ProductType.TeamsStarter]: { [ProductTierType.TeamsStarter]: {
// No annual option for Teams Starter plan // No annual option for Teams Starter plan
[SubscriptionCadence.Monthly]: PlanType.TeamsStarter, [SubscriptionCadence.Monthly]: PlanType.TeamsStarter,
}, },
@ -233,10 +232,10 @@ export class TrialBillingStepComponent implements OnInit {
private isApplicable(plan: PlanResponse): boolean { private isApplicable(plan: PlanResponse): boolean {
const hasCorrectProductType = const hasCorrectProductType =
plan.product === ProductType.Enterprise || plan.productTier === ProductTierType.Enterprise ||
plan.product === ProductType.Families || plan.productTier === ProductTierType.Families ||
plan.product === ProductType.Teams || plan.productTier === ProductTierType.Teams ||
plan.product === ProductType.TeamsStarter; plan.productTier === ProductTierType.TeamsStarter;
const notDisabledOrLegacy = !plan.disabled && !plan.legacyYear; const notDisabledOrLegacy = !plan.disabled && !plan.legacyYear;
return hasCorrectProductType && notDisabledOrLegacy; return hasCorrectProductType && notDisabledOrLegacy;
} }

View File

@ -51,14 +51,17 @@
</bit-section> </bit-section>
<bit-section> <bit-section>
<h2 bitTypography="h2">{{ "chooseYourPlan" | i18n }}</h2> <h2 bitTypography="h2">{{ "chooseYourPlan" | i18n }}</h2>
<bit-radio-group formControlName="product" [block]="true"> <bit-radio-group formControlName="productTier" [block]="true">
<div *ngFor="let selectableProduct of selectableProducts" class="tw-mb-3"> <div *ngFor="let selectableProduct of selectableProducts" class="tw-mb-3">
<bit-radio-button [value]="selectableProduct.product" (change)="changedProduct()"> <bit-radio-button [value]="selectableProduct.productTier" (change)="changedProduct()">
<bit-label>{{ selectableProduct.nameLocalizationKey | i18n }}</bit-label> <bit-label>{{ selectableProduct.nameLocalizationKey | i18n }}</bit-label>
<bit-hint class="tw-text-sm" <bit-hint class="tw-text-sm"
>{{ selectableProduct.descriptionLocalizationKey | i18n: "1" }} >{{ selectableProduct.descriptionLocalizationKey | i18n: "1" }}
<ng-container <ng-container
*ngIf="selectableProduct.product === productTypes.Enterprise; else nonEnterprisePlans" *ngIf="
selectableProduct.productTier === productTypes.Enterprise;
else nonEnterprisePlans
"
> >
<ul class="tw-pl-0 tw-list-inside tw-mb-0"> <ul class="tw-pl-0 tw-list-inside tw-mb-0">
<li>{{ "includeAllTeamsFeatures" | i18n }}</li> <li>{{ "includeAllTeamsFeatures" | i18n }}</li>
@ -75,7 +78,8 @@
<ng-template #nonEnterprisePlans> <ng-template #nonEnterprisePlans>
<ng-container <ng-container
*ngIf=" *ngIf="
selectableProduct.product === productTypes.Teams && teamsStarterPlanIsAvailable; selectableProduct.productTier === productTypes.Teams &&
teamsStarterPlanIsAvailable;
else fullFeatureList else fullFeatureList
" "
> >
@ -90,13 +94,13 @@
</ng-container> </ng-container>
<ng-template #fullFeatureList> <ng-template #fullFeatureList>
<ul class="tw-pl-0 tw-list-inside tw-mb-0"> <ul class="tw-pl-0 tw-list-inside tw-mb-0">
<li *ngIf="selectableProduct.product == productTypes.Free"> <li *ngIf="selectableProduct.productTier == productTypes.Free">
{{ "limitedUsers" | i18n: selectableProduct.PasswordManager.maxSeats }} {{ "limitedUsers" | i18n: selectableProduct.PasswordManager.maxSeats }}
</li> </li>
<li <li
*ngIf=" *ngIf="
selectableProduct.product != productTypes.Free && selectableProduct.productTier != productTypes.Free &&
selectableProduct.product != productTypes.TeamsStarter && selectableProduct.productTier != productTypes.TeamsStarter &&
selectableProduct.PasswordManager.maxSeats selectableProduct.PasswordManager.maxSeats
" "
> >
@ -136,7 +140,7 @@
{{ "onPremHostingOptional" | i18n }} {{ "onPremHostingOptional" | i18n }}
</li> </li>
<li *ngIf="selectableProduct.usersGetPremium">{{ "usersGetPremium" | i18n }}</li> <li *ngIf="selectableProduct.usersGetPremium">{{ "usersGetPremium" | i18n }}</li>
<li *ngIf="selectableProduct.product != productTypes.Free"> <li *ngIf="selectableProduct.productTier != productTypes.Free">
{{ "priorityCustomerSupport" | i18n }} {{ "priorityCustomerSupport" | i18n }}
</li> </li>
<li *ngIf="selectableProduct.trialPeriodDays && createOrganization"> <li *ngIf="selectableProduct.trialPeriodDays && createOrganization">
@ -147,7 +151,7 @@
</ng-template> </ng-template>
</bit-hint> </bit-hint>
</bit-radio-button> </bit-radio-button>
<span *ngIf="selectableProduct.product != productTypes.Free" class="tw-pl-4"> <span *ngIf="selectableProduct.productTier != productTypes.Free" class="tw-pl-4">
<ng-container <ng-container
*ngIf="selectableProduct.PasswordManager.basePrice && !acceptingSponsorship" *ngIf="selectableProduct.PasswordManager.basePrice && !acceptingSponsorship"
> >
@ -189,13 +193,13 @@
}} }}
/{{ "month" | i18n }} /{{ "month" | i18n }}
</span> </span>
<span *ngIf="selectableProduct.product == productTypes.Free" class="tw-pl-4">{{ <span *ngIf="selectableProduct.productTier == productTypes.Free" class="tw-pl-4">{{
"freeForever" | i18n "freeForever" | i18n
}}</span> }}</span>
</div> </div>
</bit-radio-group> </bit-radio-group>
</bit-section> </bit-section>
<bit-section *ngIf="formGroup.value.product !== productTypes.Free"> <bit-section *ngIf="formGroup.value.productTier !== productTypes.Free">
<bit-section <bit-section
*ngIf=" *ngIf="
selectedPlan.PasswordManager.hasAdditionalSeatsOption && selectedPlan.PasswordManager.hasAdditionalSeatsOption &&
@ -415,7 +419,7 @@
</bit-section> </bit-section>
<!-- Payment info --> <!-- Payment info -->
<bit-section *ngIf="formGroup.value.product !== productTypes.Free"> <bit-section *ngIf="formGroup.value.productTier !== productTypes.Free">
<h2 bitTypography="h2"> <h2 bitTypography="h2">
{{ (createOrganization ? "paymentInformation" : "billingInformation") | i18n }} {{ (createOrganization ? "paymentInformation" : "billingInformation") | i18n }}
</h2> </h2>

View File

@ -23,12 +23,11 @@ import { OrganizationKeysRequest } from "@bitwarden/common/admin-console/models/
import { OrganizationUpgradeRequest } from "@bitwarden/common/admin-console/models/request/organization-upgrade.request"; import { OrganizationUpgradeRequest } from "@bitwarden/common/admin-console/models/request/organization-upgrade.request";
import { ProviderOrganizationCreateRequest } from "@bitwarden/common/admin-console/models/request/provider/provider-organization-create.request"; import { ProviderOrganizationCreateRequest } from "@bitwarden/common/admin-console/models/request/provider/provider-organization-create.request";
import { ProviderResponse } from "@bitwarden/common/admin-console/models/response/provider/provider.response"; import { ProviderResponse } from "@bitwarden/common/admin-console/models/response/provider/provider.response";
import { PaymentMethodType, PlanType } from "@bitwarden/common/billing/enums"; import { PaymentMethodType, PlanType, ProductTierType } from "@bitwarden/common/billing/enums";
import { PaymentRequest } from "@bitwarden/common/billing/models/request/payment.request"; import { PaymentRequest } from "@bitwarden/common/billing/models/request/payment.request";
import { BillingResponse } from "@bitwarden/common/billing/models/response/billing.response"; import { BillingResponse } from "@bitwarden/common/billing/models/response/billing.response";
import { OrganizationSubscriptionResponse } from "@bitwarden/common/billing/models/response/organization-subscription.response"; import { OrganizationSubscriptionResponse } from "@bitwarden/common/billing/models/response/organization-subscription.response";
import { PlanResponse } from "@bitwarden/common/billing/models/response/plan.response"; import { PlanResponse } from "@bitwarden/common/billing/models/response/plan.response";
import { ProductType } from "@bitwarden/common/enums";
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
@ -73,16 +72,16 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
selectedFile: File; selectedFile: File;
@Input() @Input()
get product(): ProductType { get productTier(): ProductTierType {
return this._product; return this._productTier;
} }
set product(product: ProductType) { set productTier(product: ProductTierType) {
this._product = product; this._productTier = product;
this.formGroup?.controls?.product?.setValue(product); this.formGroup?.controls?.productTier?.setValue(product);
} }
private _product = ProductType.Free; private _productTier = ProductTierType.Free;
@Input() @Input()
get plan(): PlanType { get plan(): PlanType {
@ -102,7 +101,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
loading = true; loading = true;
selfHosted = false; selfHosted = false;
productTypes = ProductType; productTypes = ProductTierType;
formPromise: Promise<string>; formPromise: Promise<string>;
singleOrgPolicyAppliesToActiveUser = false; singleOrgPolicyAppliesToActiveUser = false;
isInTrialFlow = false; isInTrialFlow = false;
@ -123,7 +122,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
additionalSeats: [0, [Validators.min(0), Validators.max(100000)]], additionalSeats: [0, [Validators.min(0), Validators.max(100000)]],
clientOwnerEmail: ["", [Validators.email]], clientOwnerEmail: ["", [Validators.email]],
plan: [this.plan], plan: [this.plan],
product: [this.product], productTier: [this.productTier],
secretsManager: this.secretsManagerSubscription, secretsManager: this.secretsManagerSubscription,
}); });
@ -166,20 +165,23 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
this.passwordManagerPlans = plans.data.filter((plan) => !!plan.PasswordManager); this.passwordManagerPlans = plans.data.filter((plan) => !!plan.PasswordManager);
this.secretsManagerPlans = plans.data.filter((plan) => !!plan.SecretsManager); this.secretsManagerPlans = plans.data.filter((plan) => !!plan.SecretsManager);
if (this.product === ProductType.Enterprise || this.product === ProductType.Teams) { if (
this.productTier === ProductTierType.Enterprise ||
this.productTier === ProductTierType.Teams
) {
this.formGroup.controls.businessOwned.setValue(true); this.formGroup.controls.businessOwned.setValue(true);
} }
} }
if (this.currentPlan && this.currentPlan.product !== ProductType.Enterprise) { if (this.currentPlan && this.currentPlan.productTier !== ProductTierType.Enterprise) {
const upgradedPlan = this.passwordManagerPlans.find((plan) => const upgradedPlan = this.passwordManagerPlans.find((plan) =>
this.currentPlan.product === ProductType.Free this.currentPlan.productTier === ProductTierType.Free
? plan.type === PlanType.FamiliesAnnually ? plan.type === PlanType.FamiliesAnnually
: plan.upgradeSortOrder == this.currentPlan.upgradeSortOrder + 1, : plan.upgradeSortOrder == this.currentPlan.upgradeSortOrder + 1,
); );
this.plan = upgradedPlan.type; this.plan = upgradedPlan.type;
this.product = upgradedPlan.product; this.productTier = upgradedPlan.productTier;
} }
if (this.hasProvider) { if (this.hasProvider) {
@ -190,7 +192,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
(plan) => plan.type === PlanType.TeamsAnnually, (plan) => plan.type === PlanType.TeamsAnnually,
); );
this.plan = providerDefaultPlan.type; this.plan = providerDefaultPlan.type;
this.product = providerDefaultPlan.product; this.productTier = providerDefaultPlan.productTier;
} }
if (!this.createOrganization) { if (!this.createOrganization) {
@ -229,7 +231,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
get upgradeRequiresPaymentMethod() { get upgradeRequiresPaymentMethod() {
return ( return (
this.organization?.planProductType === ProductType.Free && this.organization?.productTierType === ProductTierType.Free &&
!this.showFree && !this.showFree &&
!this.billing?.paymentSource !this.billing?.paymentSource
); );
@ -277,12 +279,12 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
(plan) => (plan) =>
plan.type !== PlanType.Custom && plan.type !== PlanType.Custom &&
(!businessOwnedIsChecked || plan.canBeUsedByBusiness) && (!businessOwnedIsChecked || plan.canBeUsedByBusiness) &&
(this.showFree || plan.product !== ProductType.Free) && (this.showFree || plan.productTier !== ProductTierType.Free) &&
(plan.isAnnual || (plan.isAnnual ||
plan.product === ProductType.Free || plan.productTier === ProductTierType.Free ||
plan.product === ProductType.TeamsStarter) && plan.productTier === ProductTierType.TeamsStarter) &&
(!this.currentPlan || this.currentPlan.upgradeSortOrder < plan.upgradeSortOrder) && (!this.currentPlan || this.currentPlan.upgradeSortOrder < plan.upgradeSortOrder) &&
(!this.hasProvider || plan.product !== ProductType.TeamsStarter) && (!this.hasProvider || plan.productTier !== ProductTierType.TeamsStarter) &&
((!this.isProviderQualifiedFor2020Plan() && this.planIsEnabled(plan)) || ((!this.isProviderQualifiedFor2020Plan() && this.planIsEnabled(plan)) ||
(this.isProviderQualifiedFor2020Plan() && (this.isProviderQualifiedFor2020Plan() &&
Allowed2020PlansForLegacyProviders.includes(plan.type))), Allowed2020PlansForLegacyProviders.includes(plan.type))),
@ -294,11 +296,11 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
} }
get selectablePlans() { get selectablePlans() {
const selectedProductType = this.formGroup.controls.product.value; const selectedProductTierType = this.formGroup.controls.productTier.value;
const result = const result =
this.passwordManagerPlans?.filter( this.passwordManagerPlans?.filter(
(plan) => (plan) =>
plan.product === selectedProductType && plan.productTier === selectedProductTierType &&
((!this.isProviderQualifiedFor2020Plan() && this.planIsEnabled(plan)) || ((!this.isProviderQualifiedFor2020Plan() && this.planIsEnabled(plan)) ||
(this.isProviderQualifiedFor2020Plan() && (this.isProviderQualifiedFor2020Plan() &&
Allowed2020PlansForLegacyProviders.includes(plan.type))), Allowed2020PlansForLegacyProviders.includes(plan.type))),
@ -516,10 +518,10 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
return; return;
} }
if (this.teamsStarterPlanIsAvailable) { if (this.teamsStarterPlanIsAvailable) {
this.formGroup.controls.product.setValue(ProductType.TeamsStarter); this.formGroup.controls.productTier.setValue(ProductTierType.TeamsStarter);
this.formGroup.controls.plan.setValue(PlanType.TeamsStarter); this.formGroup.controls.plan.setValue(PlanType.TeamsStarter);
} else { } else {
this.formGroup.controls.product.setValue(ProductType.Teams); this.formGroup.controls.productTier.setValue(ProductTierType.Teams);
this.formGroup.controls.plan.setValue(PlanType.TeamsAnnually); this.formGroup.controls.plan.setValue(PlanType.TeamsAnnually);
} }
this.changedProduct(); this.changedProduct();
@ -766,19 +768,19 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
private upgradeFlowPrefillForm() { private upgradeFlowPrefillForm() {
if (this.acceptingSponsorship) { if (this.acceptingSponsorship) {
this.formGroup.controls.product.setValue(ProductType.Families); this.formGroup.controls.productTier.setValue(ProductTierType.Families);
this.changedProduct(); this.changedProduct();
return; return;
} }
if (this.currentPlan && this.currentPlan.product !== ProductType.Enterprise) { if (this.currentPlan && this.currentPlan.productTier !== ProductTierType.Enterprise) {
const upgradedPlan = this.passwordManagerPlans.find((plan) => { const upgradedPlan = this.passwordManagerPlans.find((plan) => {
if (this.currentPlan.product === ProductType.Free) { if (this.currentPlan.productTier === ProductTierType.Free) {
return plan.type === PlanType.FamiliesAnnually; return plan.type === PlanType.FamiliesAnnually;
} }
if ( if (
this.currentPlan.product === ProductType.Families && this.currentPlan.productTier === ProductTierType.Families &&
!this.teamsStarterPlanIsAvailable !this.teamsStarterPlanIsAvailable
) { ) {
return plan.type === PlanType.TeamsAnnually; return plan.type === PlanType.TeamsAnnually;
@ -788,7 +790,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
}); });
this.plan = upgradedPlan.type; this.plan = upgradedPlan.type;
this.product = upgradedPlan.product; this.productTier = upgradedPlan.productTier;
this.changedProduct(); this.changedProduct();
} }
} }

View File

@ -8,10 +8,9 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction
import { ProviderService } from "@bitwarden/common/admin-console/abstractions/provider.service"; import { ProviderService } from "@bitwarden/common/admin-console/abstractions/provider.service";
import { OrganizationApiKeyType, ProviderStatusType } from "@bitwarden/common/admin-console/enums"; import { OrganizationApiKeyType, ProviderStatusType } from "@bitwarden/common/admin-console/enums";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { PlanType } from "@bitwarden/common/billing/enums"; import { PlanType, ProductTierType } from "@bitwarden/common/billing/enums";
import { OrganizationSubscriptionResponse } from "@bitwarden/common/billing/models/response/organization-subscription.response"; import { OrganizationSubscriptionResponse } from "@bitwarden/common/billing/models/response/organization-subscription.response";
import { BillingSubscriptionItemResponse } from "@bitwarden/common/billing/models/response/subscription.response"; import { BillingSubscriptionItemResponse } from "@bitwarden/common/billing/models/response/subscription.response";
import { ProductType } from "@bitwarden/common/enums";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
@ -53,7 +52,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
manageBillingFromProviderPortal = ManageBilling; manageBillingFromProviderPortal = ManageBilling;
isProviderManaged = false; isProviderManaged = false;
protected readonly teamsStarter = ProductType.TeamsStarter; protected readonly teamsStarter = ProductTierType.TeamsStarter;
private destroy$ = new Subject<void>(); private destroy$ = new Subject<void>();
@ -286,7 +285,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
} }
} else if (this.sub.maxAutoscaleSeats === this.sub.seats && this.sub.seats != null) { } else if (this.sub.maxAutoscaleSeats === this.sub.seats && this.sub.seats != null) {
return this.i18nService.t("subscriptionMaxReached", this.sub.seats.toString()); return this.i18nService.t("subscriptionMaxReached", this.sub.seats.toString());
} else if (this.userOrg.planProductType === ProductType.TeamsStarter) { } else if (this.userOrg.productTierType === ProductTierType.TeamsStarter) {
return this.i18nService.t("subscriptionUserSeatsWithoutAdditionalSeatsOption", 10); return this.i18nService.t("subscriptionUserSeatsWithoutAdditionalSeatsOption", 10);
} else if (this.sub.maxAutoscaleSeats == null) { } else if (this.sub.maxAutoscaleSeats == null) {
return this.i18nService.t("subscriptionUserSeatsUnlimitedAutoscale"); return this.i18nService.t("subscriptionUserSeatsUnlimitedAutoscale");
@ -440,12 +439,12 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
}; };
get showChangePlanButton() { get showChangePlanButton() {
return this.sub.plan.product !== ProductType.Enterprise && !this.showChangePlan; return this.sub.plan.productTier !== ProductTierType.Enterprise && !this.showChangePlan;
} }
} }
/** /**
* Helper to sort subscription items by product type and then by addon status * Helper to sort subscription items by productTier type and then by addon status
*/ */
function sortSubscriptionItems( function sortSubscriptionItems(
a: BillingSubscriptionItemResponse, a: BillingSubscriptionItemResponse,

View File

@ -3,9 +3,9 @@ import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { Subject, startWith, takeUntil } from "rxjs"; import { Subject, startWith, takeUntil } from "rxjs";
import { ControlsOf } from "@bitwarden/angular/types/controls-of"; import { ControlsOf } from "@bitwarden/angular/types/controls-of";
import { ProductTierType } from "@bitwarden/common/billing/enums";
import { BillingCustomerDiscount } from "@bitwarden/common/billing/models/response/organization-subscription.response"; import { BillingCustomerDiscount } from "@bitwarden/common/billing/models/response/organization-subscription.response";
import { PlanResponse } from "@bitwarden/common/billing/models/response/plan.response"; import { PlanResponse } from "@bitwarden/common/billing/models/response/plan.response";
import { ProductType } from "@bitwarden/common/enums";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { SecretsManagerLogo } from "../../layouts/secrets-manager-logo"; import { SecretsManagerLogo } from "../../layouts/secrets-manager-logo";
@ -40,7 +40,7 @@ export class SecretsManagerSubscribeComponent implements OnInit, OnDestroy {
@Input() customerDiscount: BillingCustomerDiscount; @Input() customerDiscount: BillingCustomerDiscount;
logo = SecretsManagerLogo; logo = SecretsManagerLogo;
productTypes = ProductType; productTypes = ProductTierType;
private destroy$ = new Subject<void>(); private destroy$ = new Subject<void>();
@ -75,17 +75,17 @@ export class SecretsManagerSubscribeComponent implements OnInit, OnDestroy {
}; };
get product() { get product() {
return this.selectedPlan.product; return this.selectedPlan.productTier;
} }
get planName() { get planName() {
switch (this.product) { switch (this.product) {
case ProductType.Free: case ProductTierType.Free:
return this.i18nService.t("free2PersonOrganization"); return this.i18nService.t("free2PersonOrganization");
case ProductType.Teams: case ProductTierType.Teams:
case ProductType.TeamsStarter: case ProductTierType.TeamsStarter:
return this.i18nService.t("planNameTeams"); return this.i18nService.t("planNameTeams");
case ProductType.Enterprise: case ProductTierType.Enterprise:
return this.i18nService.t("planNameEnterprise"); return this.i18nService.t("planNameEnterprise");
} }
} }

View File

@ -9,7 +9,8 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service"; import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
import { EventType, ProductType } from "@bitwarden/common/enums"; import { ProductTierType } from "@bitwarden/common/billing/enums";
import { EventType } from "@bitwarden/common/enums";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
@ -271,7 +272,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit, On
return ( return (
this.cipher.type === CipherType.Login && this.cipher.type === CipherType.Login &&
this.cipher.login.totp && this.cipher.login.totp &&
this.organization?.planProductType != ProductType.Free && this.organization?.productTierType != ProductTierType.Free &&
(this.cipher.organizationUseTotp || this.canAccessPremium) (this.cipher.organizationUseTotp || this.canAccessPremium)
); );
} }

View File

@ -4,7 +4,7 @@ import { firstValueFrom } from "rxjs";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { ProductType } from "@bitwarden/common/enums"; import { ProductTierType } from "@bitwarden/common/billing/enums";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
@ -183,7 +183,7 @@ export class VaultHeaderComponent implements OnInit {
} }
async addCollection() { async addCollection() {
if (this.organization.planProductType === ProductType.Free) { if (this.organization.productTierType === ProductTierType.Free) {
const collections = await this.collectionAdminService.getAll(this.organization.id); const collections = await this.collectionAdminService.getAll(this.organization.id);
if (collections.length === this.organization.maxCollections) { if (collections.length === this.organization.maxCollections) {
this.showFreeOrgUpgradeDialog(); this.showFreeOrgUpgradeDialog();

View File

@ -1,4 +1,4 @@
import { ProductType } from "../../../enums/product-type.enum"; import { ProductTierType } from "../../../billing/enums/product-tier-type.enum";
import { OrganizationUserStatusType, OrganizationUserType } from "../../enums"; import { OrganizationUserStatusType, OrganizationUserType } from "../../enums";
import { ORGANIZATIONS } from "../../services/organization/organization.service"; import { ORGANIZATIONS } from "../../services/organization/organization.service";
@ -47,7 +47,7 @@ describe("ORGANIZATIONS state", () => {
isMember: false, isMember: false,
familySponsorshipFriendlyName: "fsfn", familySponsorshipFriendlyName: "fsfn",
familySponsorshipAvailable: false, familySponsorshipAvailable: false,
planProductType: ProductType.Free, productTierType: ProductTierType.Free,
keyConnectorEnabled: false, keyConnectorEnabled: false,
keyConnectorUrl: "kcu", keyConnectorUrl: "kcu",
accessSecretsManager: false, accessSecretsManager: false,

View File

@ -1,6 +1,6 @@
import { Jsonify } from "type-fest"; import { Jsonify } from "type-fest";
import { ProductType } from "../../../enums"; import { ProductTierType } from "../../../billing/enums";
import { OrganizationUserStatusType, OrganizationUserType, ProviderType } from "../../enums"; import { OrganizationUserStatusType, OrganizationUserType, ProviderType } from "../../enums";
import { PermissionsApi } from "../api/permissions.api"; import { PermissionsApi } from "../api/permissions.api";
import { ProfileOrganizationResponse } from "../response/profile-organization.response"; import { ProfileOrganizationResponse } from "../response/profile-organization.response";
@ -45,7 +45,7 @@ export class OrganizationData {
isMember: boolean; isMember: boolean;
familySponsorshipFriendlyName: string; familySponsorshipFriendlyName: string;
familySponsorshipAvailable: boolean; familySponsorshipAvailable: boolean;
planProductType: ProductType; productTierType: ProductTierType;
keyConnectorEnabled: boolean; keyConnectorEnabled: boolean;
keyConnectorUrl: string; keyConnectorUrl: string;
familySponsorshipLastSyncDate?: Date; familySponsorshipLastSyncDate?: Date;
@ -104,7 +104,7 @@ export class OrganizationData {
this.providerType = response.providerType; this.providerType = response.providerType;
this.familySponsorshipFriendlyName = response.familySponsorshipFriendlyName; this.familySponsorshipFriendlyName = response.familySponsorshipFriendlyName;
this.familySponsorshipAvailable = response.familySponsorshipAvailable; this.familySponsorshipAvailable = response.familySponsorshipAvailable;
this.planProductType = response.planProductType; this.productTierType = response.planProductType;
this.keyConnectorEnabled = response.keyConnectorEnabled; this.keyConnectorEnabled = response.keyConnectorEnabled;
this.keyConnectorUrl = response.keyConnectorUrl; this.keyConnectorUrl = response.keyConnectorUrl;
this.familySponsorshipLastSyncDate = response.familySponsorshipLastSyncDate; this.familySponsorshipLastSyncDate = response.familySponsorshipLastSyncDate;

View File

@ -1,6 +1,6 @@
import { Jsonify } from "type-fest"; import { Jsonify } from "type-fest";
import { ProductType } from "../../../enums"; import { ProductTierType } from "../../../billing/enums";
import { OrganizationUserStatusType, OrganizationUserType, ProviderType } from "../../enums"; import { OrganizationUserStatusType, OrganizationUserType, ProviderType } from "../../enums";
import { PermissionsApi } from "../api/permissions.api"; import { PermissionsApi } from "../api/permissions.api";
import { OrganizationData } from "../data/organization.data"; import { OrganizationData } from "../data/organization.data";
@ -58,7 +58,7 @@ export class Organization {
isMember: boolean; isMember: boolean;
familySponsorshipFriendlyName: string; familySponsorshipFriendlyName: string;
familySponsorshipAvailable: boolean; familySponsorshipAvailable: boolean;
planProductType: ProductType; productTierType: ProductTierType;
keyConnectorEnabled: boolean; keyConnectorEnabled: boolean;
keyConnectorUrl: string; keyConnectorUrl: string;
familySponsorshipLastSyncDate?: Date; familySponsorshipLastSyncDate?: Date;
@ -123,7 +123,7 @@ export class Organization {
this.isMember = obj.isMember; this.isMember = obj.isMember;
this.familySponsorshipFriendlyName = obj.familySponsorshipFriendlyName; this.familySponsorshipFriendlyName = obj.familySponsorshipFriendlyName;
this.familySponsorshipAvailable = obj.familySponsorshipAvailable; this.familySponsorshipAvailable = obj.familySponsorshipAvailable;
this.planProductType = obj.planProductType; this.productTierType = obj.productTierType;
this.keyConnectorEnabled = obj.keyConnectorEnabled; this.keyConnectorEnabled = obj.keyConnectorEnabled;
this.keyConnectorUrl = obj.keyConnectorUrl; this.keyConnectorUrl = obj.keyConnectorUrl;
this.familySponsorshipLastSyncDate = obj.familySponsorshipLastSyncDate; this.familySponsorshipLastSyncDate = obj.familySponsorshipLastSyncDate;

View File

@ -1,4 +1,4 @@
import { ProductType } from "../../../enums"; import { ProductTierType } from "../../../billing/enums";
import { BaseResponse } from "../../../models/response/base.response"; import { BaseResponse } from "../../../models/response/base.response";
import { OrganizationUserStatusType, OrganizationUserType, ProviderType } from "../../enums"; import { OrganizationUserStatusType, OrganizationUserType, ProviderType } from "../../enums";
import { PermissionsApi } from "../api/permissions.api"; import { PermissionsApi } from "../api/permissions.api";
@ -42,7 +42,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
providerType?: ProviderType; providerType?: ProviderType;
familySponsorshipFriendlyName: string; familySponsorshipFriendlyName: string;
familySponsorshipAvailable: boolean; familySponsorshipAvailable: boolean;
planProductType: ProductType; planProductType: ProductTierType;
keyConnectorEnabled: boolean; keyConnectorEnabled: boolean;
keyConnectorUrl: string; keyConnectorUrl: string;
familySponsorshipLastSyncDate?: Date; familySponsorshipLastSyncDate?: Date;

View File

@ -3,3 +3,4 @@ export * from "./plan-sponsorship-type.enum";
export * from "./plan-type.enum"; export * from "./plan-type.enum";
export * from "./transaction-type.enum"; export * from "./transaction-type.enum";
export * from "./bitwarden-product-type.enum"; export * from "./bitwarden-product-type.enum";
export * from "./product-tier-type.enum";

View File

@ -1,4 +1,4 @@
export enum ProductType { export enum ProductTierType {
Free = 0, Free = 0,
Families = 1, Families = 1,
Teams = 2, Teams = 2,

View File

@ -0,0 +1,4 @@
export enum ProductType {
PasswordManager = 0,
SecretsManager = 1,
}

View File

@ -1,10 +1,9 @@
import { ProductType } from "../../../enums"; import { ProductTierType, PlanType } from "../../../billing/enums";
import { BaseResponse } from "../../../models/response/base.response"; import { BaseResponse } from "../../../models/response/base.response";
import { PlanType } from "../../enums";
export class PlanResponse extends BaseResponse { export class PlanResponse extends BaseResponse {
type: PlanType; type: PlanType;
product: ProductType; productTier: ProductTierType;
name: string; name: string;
isAnnual: boolean; isAnnual: boolean;
nameLocalizationKey: string; nameLocalizationKey: string;
@ -32,7 +31,7 @@ export class PlanResponse extends BaseResponse {
constructor(response: any) { constructor(response: any) {
super(response); super(response);
this.type = this.getResponseProperty("Type"); this.type = this.getResponseProperty("Type");
this.product = this.getResponseProperty("Product"); this.productTier = this.getResponseProperty("ProductTier");
this.name = this.getResponseProperty("Name"); this.name = this.getResponseProperty("Name");
this.isAnnual = this.getResponseProperty("IsAnnual"); this.isAnnual = this.getResponseProperty("IsAnnual");
this.nameLocalizationKey = this.getResponseProperty("NameLocalizationKey"); this.nameLocalizationKey = this.getResponseProperty("NameLocalizationKey");

View File

@ -6,4 +6,3 @@ export * from "./http-status-code.enum";
export * from "./integration-type.enum"; export * from "./integration-type.enum";
export * from "./native-messaging-version.enum"; export * from "./native-messaging-version.enum";
export * from "./notification-type.enum"; export * from "./notification-type.enum";
export * from "./product-type.enum";