From f484dd491b2dc2998e4cfb7616c93c4cabf463f2 Mon Sep 17 00:00:00 2001 From: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:43:40 -0400 Subject: [PATCH] [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 --- .../vault/vault-select.component.html | 4 +- .../vault-popup-items.service.spec.ts | 4 +- .../vault-popup-list-filters.service.spec.ts | 8 +-- .../vault-popup-list-filters.service.ts | 6 +- .../vault/popup/views/popup-cipher.view.ts | 14 ++--- .../member-dialog.component.html | 3 +- .../member-dialog/member-dialog.component.ts | 7 ++- .../org-seat-limit-reached.validator.spec.ts | 10 ++-- .../org-seat-limit-reached.validator.ts | 8 +-- .../organizations/members/people.component.ts | 24 ++++---- ...families-for-enterprise-setup.component.ts | 7 +-- .../settings/create-organization.component.ts | 11 ++-- .../settings/two-factor-setup.component.ts | 4 +- ...ts-manager-trial-paid-stepper.component.ts | 14 ++--- .../trial-initiation.component.ts | 19 +++--- .../trial-billing-step.component.ts | 21 ++++--- .../organization-plans.component.html | 28 +++++---- .../organization-plans.component.ts | 60 ++++++++++--------- ...ganization-subscription-cloud.component.ts | 11 ++-- .../billing/shared/sm-subscribe.component.ts | 14 ++--- .../individual-vault/add-edit.component.ts | 5 +- .../vault-header/vault-header.component.ts | 4 +- .../models/data/organization.data.spec.ts | 4 +- .../models/data/organization.data.ts | 6 +- .../models/domain/organization.ts | 6 +- .../response/profile-organization.response.ts | 4 +- libs/common/src/billing/enums/index.ts | 1 + .../enums/product-tier-type.enum.ts} | 2 +- .../src/billing/enums/product-type.enum.ts | 4 ++ .../billing/models/response/plan.response.ts | 7 +-- libs/common/src/enums/index.ts | 1 - 31 files changed, 164 insertions(+), 157 deletions(-) rename libs/common/src/{enums/product-type.enum.ts => billing/enums/product-tier-type.enum.ts} (72%) create mode 100644 libs/common/src/billing/enums/product-type.enum.ts diff --git a/apps/browser/src/vault/popup/components/vault/vault-select.component.html b/apps/browser/src/vault/popup/components/vault/vault-select.component.html index 84c5f48a4e..4f6ce3a11e 100644 --- a/apps/browser/src/vault/popup/components/vault/vault-select.component.html +++ b/apps/browser/src/vault/popup/components/vault/vault-select.component.html @@ -57,12 +57,12 @@ >
diff --git a/apps/browser/src/vault/popup/services/vault-popup-items.service.spec.ts b/apps/browser/src/vault/popup/services/vault-popup-items.service.spec.ts index f08f4e836e..0b40b136ab 100644 --- a/apps/browser/src/vault/popup/services/vault-popup-items.service.spec.ts +++ b/apps/browser/src/vault/popup/services/vault-popup-items.service.spec.ts @@ -5,7 +5,7 @@ import { BehaviorSubject } from "rxjs"; import { SearchService } from "@bitwarden/common/abstractions/search.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; 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 { CipherId } from "@bitwarden/common/types/guid"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; @@ -78,7 +78,7 @@ describe("VaultPopupItemsService", () => { mockOrg = { id: "org1", name: "Organization 1", - planProductType: ProductType.Enterprise, + productTierType: ProductTierType.Enterprise, } as Organization; mockCollections = [ diff --git a/apps/browser/src/vault/popup/services/vault-popup-list-filters.service.spec.ts b/apps/browser/src/vault/popup/services/vault-popup-list-filters.service.spec.ts index b89de79a20..f6573de1c8 100644 --- a/apps/browser/src/vault/popup/services/vault-popup-list-filters.service.spec.ts +++ b/apps/browser/src/vault/popup/services/vault-popup-list-filters.service.spec.ts @@ -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 { PolicyType } from "@bitwarden/common/admin-console/enums"; 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 { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service"; @@ -206,7 +206,7 @@ describe("VaultPopupListFiltersService", () => { name: "family org", id: "1234-3323-23223", enabled: true, - planProductType: ProductType.Families, + productTierType: ProductTierType.Families, }, ] as Organization[]; @@ -224,7 +224,7 @@ describe("VaultPopupListFiltersService", () => { name: "free org", id: "1234-3323-23223", enabled: true, - planProductType: ProductType.Free, + productTierType: ProductTierType.Free, }, ] as Organization[]; @@ -242,7 +242,7 @@ describe("VaultPopupListFiltersService", () => { name: "free org", id: "1234-3323-23223", enabled: false, - planProductType: ProductType.Free, + productTierType: ProductTierType.Free, }, ] as Organization[]; diff --git a/apps/browser/src/vault/popup/services/vault-popup-list-filters.service.ts b/apps/browser/src/vault/popup/services/vault-popup-list-filters.service.ts index 8242637d5d..67213163a6 100644 --- a/apps/browser/src/vault/popup/services/vault-popup-list-filters.service.ts +++ b/apps/browser/src/vault/popup/services/vault-popup-list-filters.service.ts @@ -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 { PolicyType } from "@bitwarden/common/admin-console/enums"; 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 { Utils } from "@bitwarden/common/platform/misc/utils"; 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 icon = "bwi-exclamation-triangle tw-text-danger"; } else if ( - org.planProductType === ProductType.Families || - org.planProductType === ProductType.Free + org.productTierType === ProductTierType.Families || + org.productTierType === ProductTierType.Free ) { // Show a family icon if the organization is a family or free org icon = "bwi-family"; diff --git a/apps/browser/src/vault/popup/views/popup-cipher.view.ts b/apps/browser/src/vault/popup/views/popup-cipher.view.ts index 4707eb9eb0..5bb1905c59 100644 --- a/apps/browser/src/vault/popup/views/popup-cipher.view.ts +++ b/apps/browser/src/vault/popup/views/popup-cipher.view.ts @@ -1,5 +1,5 @@ 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 { 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 orgIcon(): "bwi-family" | "bwi-business" | null { - switch (this.organization?.planProductType) { - case ProductType.Free: - case ProductType.Families: + switch (this.organization?.productTierType) { + case ProductTierType.Free: + case ProductTierType.Families: return "bwi-family"; - case ProductType.Teams: - case ProductType.Enterprise: - case ProductType.TeamsStarter: + case ProductTierType.Teams: + case ProductTierType.Enterprise: + case ProductTierType.TeamsStarter: return "bwi-business"; default: return null; diff --git a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.html b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.html index 9c8d224e6e..11c1ab2d2e 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.html +++ b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.html @@ -28,7 +28,8 @@ {{ "inviteMultipleEmailDesc" - | i18n: (organization.planProductType === ProductType.TeamsStarter ? "10" : "20") + | i18n + : (organization.productTierType === ProductTierType.TeamsStarter ? "10" : "20") }} diff --git a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts index d16435e4d5..81830d1213 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts +++ b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts @@ -22,7 +22,7 @@ import { import { PermissionsApi } from "@bitwarden/common/admin-console/models/api/permissions.api"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; 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 { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; @@ -463,7 +463,8 @@ export class MemberDialogComponent implements OnDestroy { await this.userService.save(userView); } else { 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*/))]; if (emails.length > maxEmailsCount) { this.formGroup.controls.emails.setErrors({ @@ -614,7 +615,7 @@ export class MemberDialogComponent implements OnDestroy { }); } - protected readonly ProductType = ProductType; + protected readonly ProductTierType = ProductTierType; } function mapCollectionToAccessItemView( diff --git a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/validators/org-seat-limit-reached.validator.spec.ts b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/validators/org-seat-limit-reached.validator.spec.ts index c26b51e249..6c693ee8f8 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/validators/org-seat-limit-reached.validator.spec.ts +++ b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/validators/org-seat-limit-reached.validator.spec.ts @@ -2,7 +2,7 @@ import { AbstractControl, FormControl, ValidationErrors } from "@angular/forms"; import { OrganizationUserType } from "@bitwarden/common/admin-console/enums"; 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"; @@ -54,7 +54,7 @@ describe("orgSeatLimitReachedValidator", () => { it("should return null when max seats are not exceeded on free plan", () => { organization = orgFactory({ - planProductType: ProductType.Free, + productTierType: ProductTierType.Free, seats: 2, }); validatorFn = orgSeatLimitReachedValidator( @@ -71,7 +71,7 @@ describe("orgSeatLimitReachedValidator", () => { it("should return null when max seats are not exceeded on teams starter plan", () => { organization = orgFactory({ - planProductType: ProductType.TeamsStarter, + productTierType: ProductTierType.TeamsStarter, seats: 10, }); validatorFn = orgSeatLimitReachedValidator( @@ -98,7 +98,7 @@ describe("orgSeatLimitReachedValidator", () => { it("should return validation error when max seats are exceeded on free plan", () => { organization = orgFactory({ - planProductType: ProductType.Free, + productTierType: ProductTierType.Free, seats: 2, }); 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", () => { const control = new FormControl("user2@example.com,user3@example.com"); organization = orgFactory({ - planProductType: ProductType.Enterprise, + productTierType: ProductTierType.Enterprise, seats: 100, }); validatorFn = orgSeatLimitReachedValidator( diff --git a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/validators/org-seat-limit-reached.validator.ts b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/validators/org-seat-limit-reached.validator.ts index 8b521e2c17..bcd8474391 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/validators/org-seat-limit-reached.validator.ts +++ b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/validators/org-seat-limit-reached.validator.ts @@ -1,7 +1,7 @@ import { AbstractControl, ValidationErrors, ValidatorFn } from "@angular/forms"; 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 @@ -37,9 +37,9 @@ export function orgSeatLimitReachedValidator( ); const productHasAdditionalSeatsOption = - organization.planProductType !== ProductType.Free && - organization.planProductType !== ProductType.Families && - organization.planProductType !== ProductType.TeamsStarter; + organization.productTierType !== ProductTierType.Free && + organization.productTierType !== ProductTierType.Families && + organization.productTierType !== ProductTierType.TeamsStarter; return !productHasAdditionalSeatsOption && allOrganizationUserEmails.length + newEmailsToAdd.length > organization.seats diff --git a/apps/web/src/app/admin-console/organizations/members/people.component.ts b/apps/web/src/app/admin-console/organizations/members/people.component.ts index a47e0acd0c..2349d98995 100644 --- a/apps/web/src/app/admin-console/organizations/members/people.component.ts +++ b/apps/web/src/app/admin-console/organizations/members/people.component.ts @@ -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 { OrganizationKeysRequest } from "@bitwarden/common/admin-console/models/request/organization-keys.request"; 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 { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; @@ -335,13 +335,13 @@ export class PeopleComponent extends NewBasePeopleComponent orgs.filter((o) => o.planProductType === ProductType.Families)), + map((orgs) => orgs.filter((o) => o.productTierType === ProductTierType.Families)), ); this.existingFamilyOrganizations$.pipe(takeUntil(this._destroy)).subscribe((orgs) => { diff --git a/apps/web/src/app/admin-console/settings/create-organization.component.ts b/apps/web/src/app/admin-console/settings/create-organization.component.ts index 2a060d6d56..d2bcb9e69c 100644 --- a/apps/web/src/app/admin-console/settings/create-organization.component.ts +++ b/apps/web/src/app/admin-console/settings/create-organization.component.ts @@ -2,8 +2,7 @@ import { Component, OnInit, ViewChild } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { first } from "rxjs/operators"; -import { PlanType } from "@bitwarden/common/billing/enums"; -import { ProductType } from "@bitwarden/common/enums"; +import { PlanType, ProductTierType } from "@bitwarden/common/billing/enums"; import { OrganizationPlansComponent } from "../../billing"; import { HeaderModule } from "../../layouts/header/header.module"; @@ -26,16 +25,16 @@ export class CreateOrganizationComponent implements OnInit { this.route.queryParams.pipe(first()).subscribe(async (qParams) => { if (qParams.plan === "families") { this.orgPlansComponent.plan = PlanType.FamiliesAnnually; - this.orgPlansComponent.product = ProductType.Families; + this.orgPlansComponent.productTier = ProductTierType.Families; } else if (qParams.plan === "teams") { this.orgPlansComponent.plan = PlanType.TeamsAnnually; - this.orgPlansComponent.product = ProductType.Teams; + this.orgPlansComponent.productTier = ProductTierType.Teams; } else if (qParams.plan === "teamsStarter") { this.orgPlansComponent.plan = PlanType.TeamsStarter; - this.orgPlansComponent.product = ProductType.TeamsStarter; + this.orgPlansComponent.productTier = ProductTierType.TeamsStarter; } else if (qParams.plan === "enterprise") { this.orgPlansComponent.plan = PlanType.EnterpriseAnnually; - this.orgPlansComponent.product = ProductType.Enterprise; + this.orgPlansComponent.productTier = ProductTierType.Enterprise; } }); } diff --git a/apps/web/src/app/auth/settings/two-factor-setup.component.ts b/apps/web/src/app/auth/settings/two-factor-setup.component.ts index 34a7e32089..b1592dc72a 100644 --- a/apps/web/src/app/auth/settings/two-factor-setup.component.ts +++ b/apps/web/src/app/auth/settings/two-factor-setup.component.ts @@ -17,7 +17,7 @@ import { TwoFactorYubiKeyResponse } from "@bitwarden/common/auth/models/response import { TwoFactorProviders } from "@bitwarden/common/auth/services/two-factor.service"; import { AuthResponse } from "@bitwarden/common/auth/types/auth-response"; 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 { DialogService } from "@bitwarden/components"; @@ -258,6 +258,6 @@ export class TwoFactorSetupComponent implements OnInit, OnDestroy { } get isEnterpriseOrg() { - return this.organization?.planProductType === ProductType.Enterprise; + return this.organization?.productTierType === ProductTierType.Enterprise; } } diff --git a/apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts b/apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts index 0f4fd5110b..e61b7fc777 100644 --- a/apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts +++ b/apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts @@ -1,6 +1,6 @@ import { Component, Input, ViewChild } from "@angular/core"; -import { ProductType } from "@bitwarden/common/enums"; +import { ProductTierType } from "@bitwarden/common/billing/enums"; import { OrganizationCreatedEvent, @@ -33,22 +33,22 @@ export class SecretsManagerTrialPaidStepperComponent extends SecretsManagerTrial get createAccountLabel() { const organizationType = - this.productType === ProductType.TeamsStarter + this.productType === ProductTierType.TeamsStarter ? "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.`; } get productType(): TrialOrganizationType { switch (this.organizationTypeQueryParameter) { case "enterprise": - return ProductType.Enterprise; + return ProductTierType.Enterprise; case "families": - return ProductType.Families; + return ProductTierType.Families; case "teams": - return ProductType.Teams; + return ProductTierType.Teams; case "teamsStarter": - return ProductType.TeamsStarter; + return ProductTierType.TeamsStarter; } } diff --git a/apps/web/src/app/auth/trial-initiation/trial-initiation.component.ts b/apps/web/src/app/auth/trial-initiation/trial-initiation.component.ts index d02b2c9e2e..f8718b0a42 100644 --- a/apps/web/src/app/auth/trial-initiation/trial-initiation.component.ts +++ b/apps/web/src/app/auth/trial-initiation/trial-initiation.component.ts @@ -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 { MasterPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/master-password-policy-options"; import { Policy } from "@bitwarden/common/admin-console/models/domain/policy"; -import { PlanType } from "@bitwarden/common/billing/enums"; -import { ProductType } from "@bitwarden/common/enums"; +import { PlanType, ProductTierType } from "@bitwarden/common/billing/enums"; import { ReferenceEventRequest } from "@bitwarden/common/models/request/reference-event.request"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; @@ -67,7 +66,7 @@ export class TrialInitiationComponent implements OnInit, OnDestroy { billingSubLabel = ""; layout = "default"; plan: PlanType; - product: ProductType; + productTier: ProductTierType; accountCreateOnly = true; useTrialStepper = false; policies: Policy[]; @@ -153,16 +152,16 @@ export class TrialInitiationComponent implements OnInit, OnDestroy { if (this.org === ValidOrgParams.families) { this.plan = PlanType.FamiliesAnnually; - this.product = ProductType.Families; + this.productTier = ProductTierType.Families; } else if (this.org === ValidOrgParams.teamsStarter) { this.plan = PlanType.TeamsStarter; - this.product = ProductType.TeamsStarter; + this.productTier = ProductTierType.TeamsStarter; } else if (this.org === ValidOrgParams.teams) { this.plan = PlanType.TeamsAnnually; - this.product = ProductType.Teams; + this.productTier = ProductTierType.Teams; } else if (this.org === ValidOrgParams.enterprise) { this.plan = PlanType.EnterpriseAnnually; - this.product = ProductType.Enterprise; + this.productTier = ProductTierType.Enterprise; } } else if (this.routeFlowOrgs.includes(qParams.org)) { this.referenceData.flow = qParams.org; @@ -268,11 +267,11 @@ export class TrialInitiationComponent implements OnInit, OnDestroy { } get trialOrganizationType(): TrialOrganizationType { - switch (this.product) { - case ProductType.Free: + switch (this.productTier) { + case ProductTierType.Free: return null; default: - return this.product; + return this.productTier; } } diff --git a/apps/web/src/app/billing/accounts/trial-initiation/trial-billing-step.component.ts b/apps/web/src/app/billing/accounts/trial-initiation/trial-billing-step.component.ts index bd138cad29..0be4f614d0 100644 --- a/apps/web/src/app/billing/accounts/trial-initiation/trial-billing-step.component.ts +++ b/apps/web/src/app/billing/accounts/trial-initiation/trial-billing-step.component.ts @@ -9,16 +9,15 @@ import { PaymentInformation, PlanInformation, } 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 { ProductType } from "@bitwarden/common/enums"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { BillingSharedModule, PaymentComponent, TaxInfoComponent } from "../../shared"; -export type TrialOrganizationType = Exclude; +export type TrialOrganizationType = Exclude; export interface OrganizationInfo { name: string; @@ -176,19 +175,19 @@ export class TrialBillingStepComponent implements OnInit { [cadence in SubscriptionCadence]?: PlanType; }; } = { - [ProductType.Enterprise]: { + [ProductTierType.Enterprise]: { [SubscriptionCadence.Annual]: PlanType.EnterpriseAnnually, [SubscriptionCadence.Monthly]: PlanType.EnterpriseMonthly, }, - [ProductType.Families]: { + [ProductTierType.Families]: { [SubscriptionCadence.Annual]: PlanType.FamiliesAnnually, // No monthly option for Families plan }, - [ProductType.Teams]: { + [ProductTierType.Teams]: { [SubscriptionCadence.Annual]: PlanType.TeamsAnnually, [SubscriptionCadence.Monthly]: PlanType.TeamsMonthly, }, - [ProductType.TeamsStarter]: { + [ProductTierType.TeamsStarter]: { // No annual option for Teams Starter plan [SubscriptionCadence.Monthly]: PlanType.TeamsStarter, }, @@ -233,10 +232,10 @@ export class TrialBillingStepComponent implements OnInit { private isApplicable(plan: PlanResponse): boolean { const hasCorrectProductType = - plan.product === ProductType.Enterprise || - plan.product === ProductType.Families || - plan.product === ProductType.Teams || - plan.product === ProductType.TeamsStarter; + plan.productTier === ProductTierType.Enterprise || + plan.productTier === ProductTierType.Families || + plan.productTier === ProductTierType.Teams || + plan.productTier === ProductTierType.TeamsStarter; const notDisabledOrLegacy = !plan.disabled && !plan.legacyYear; return hasCorrectProductType && notDisabledOrLegacy; } diff --git a/apps/web/src/app/billing/organizations/organization-plans.component.html b/apps/web/src/app/billing/organizations/organization-plans.component.html index 1bd6b99dd1..227552119a 100644 --- a/apps/web/src/app/billing/organizations/organization-plans.component.html +++ b/apps/web/src/app/billing/organizations/organization-plans.component.html @@ -51,14 +51,17 @@

{{ "chooseYourPlan" | i18n }}

- +
- + {{ selectableProduct.nameLocalizationKey | i18n }} {{ selectableProduct.descriptionLocalizationKey | i18n: "1" }}
  • {{ "includeAllTeamsFeatures" | i18n }}
  • @@ -75,7 +78,8 @@ @@ -90,13 +94,13 @@
      -
    • +
    • {{ "limitedUsers" | i18n: selectableProduct.PasswordManager.maxSeats }}
    • @@ -136,7 +140,7 @@ {{ "onPremHostingOptional" | i18n }}
    • {{ "usersGetPremium" | i18n }}
    • -
    • +
    • {{ "priorityCustomerSupport" | i18n }}
    • @@ -147,7 +151,7 @@ - + @@ -189,13 +193,13 @@ }} /{{ "month" | i18n }} - {{ + {{ "freeForever" | i18n }}
- + +

{{ (createOrganization ? "paymentInformation" : "billingInformation") | i18n }}

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 2228ad9f3a..05e2232332 100644 --- a/apps/web/src/app/billing/organizations/organization-plans.component.ts +++ b/apps/web/src/app/billing/organizations/organization-plans.component.ts @@ -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 { 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 { 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 { BillingResponse } from "@bitwarden/common/billing/models/response/billing.response"; import { OrganizationSubscriptionResponse } from "@bitwarden/common/billing/models/response/organization-subscription.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 { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; @@ -73,16 +72,16 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { selectedFile: File; @Input() - get product(): ProductType { - return this._product; + get productTier(): ProductTierType { + return this._productTier; } - set product(product: ProductType) { - this._product = product; - this.formGroup?.controls?.product?.setValue(product); + set productTier(product: ProductTierType) { + this._productTier = product; + this.formGroup?.controls?.productTier?.setValue(product); } - private _product = ProductType.Free; + private _productTier = ProductTierType.Free; @Input() get plan(): PlanType { @@ -102,7 +101,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { loading = true; selfHosted = false; - productTypes = ProductType; + productTypes = ProductTierType; formPromise: Promise; singleOrgPolicyAppliesToActiveUser = false; isInTrialFlow = false; @@ -123,7 +122,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { additionalSeats: [0, [Validators.min(0), Validators.max(100000)]], clientOwnerEmail: ["", [Validators.email]], plan: [this.plan], - product: [this.product], + productTier: [this.productTier], secretsManager: this.secretsManagerSubscription, }); @@ -166,20 +165,23 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { this.passwordManagerPlans = plans.data.filter((plan) => !!plan.PasswordManager); 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); } } - if (this.currentPlan && this.currentPlan.product !== ProductType.Enterprise) { + if (this.currentPlan && this.currentPlan.productTier !== ProductTierType.Enterprise) { const upgradedPlan = this.passwordManagerPlans.find((plan) => - this.currentPlan.product === ProductType.Free + this.currentPlan.productTier === ProductTierType.Free ? plan.type === PlanType.FamiliesAnnually : plan.upgradeSortOrder == this.currentPlan.upgradeSortOrder + 1, ); this.plan = upgradedPlan.type; - this.product = upgradedPlan.product; + this.productTier = upgradedPlan.productTier; } if (this.hasProvider) { @@ -190,7 +192,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { (plan) => plan.type === PlanType.TeamsAnnually, ); this.plan = providerDefaultPlan.type; - this.product = providerDefaultPlan.product; + this.productTier = providerDefaultPlan.productTier; } if (!this.createOrganization) { @@ -229,7 +231,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { get upgradeRequiresPaymentMethod() { return ( - this.organization?.planProductType === ProductType.Free && + this.organization?.productTierType === ProductTierType.Free && !this.showFree && !this.billing?.paymentSource ); @@ -277,12 +279,12 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { (plan) => plan.type !== PlanType.Custom && (!businessOwnedIsChecked || plan.canBeUsedByBusiness) && - (this.showFree || plan.product !== ProductType.Free) && + (this.showFree || plan.productTier !== ProductTierType.Free) && (plan.isAnnual || - plan.product === ProductType.Free || - plan.product === ProductType.TeamsStarter) && + plan.productTier === ProductTierType.Free || + plan.productTier === ProductTierType.TeamsStarter) && (!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() && Allowed2020PlansForLegacyProviders.includes(plan.type))), @@ -294,11 +296,11 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { } get selectablePlans() { - const selectedProductType = this.formGroup.controls.product.value; + const selectedProductTierType = this.formGroup.controls.productTier.value; const result = this.passwordManagerPlans?.filter( (plan) => - plan.product === selectedProductType && + plan.productTier === selectedProductTierType && ((!this.isProviderQualifiedFor2020Plan() && this.planIsEnabled(plan)) || (this.isProviderQualifiedFor2020Plan() && Allowed2020PlansForLegacyProviders.includes(plan.type))), @@ -516,10 +518,10 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { return; } if (this.teamsStarterPlanIsAvailable) { - this.formGroup.controls.product.setValue(ProductType.TeamsStarter); + this.formGroup.controls.productTier.setValue(ProductTierType.TeamsStarter); this.formGroup.controls.plan.setValue(PlanType.TeamsStarter); } else { - this.formGroup.controls.product.setValue(ProductType.Teams); + this.formGroup.controls.productTier.setValue(ProductTierType.Teams); this.formGroup.controls.plan.setValue(PlanType.TeamsAnnually); } this.changedProduct(); @@ -766,19 +768,19 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { private upgradeFlowPrefillForm() { if (this.acceptingSponsorship) { - this.formGroup.controls.product.setValue(ProductType.Families); + this.formGroup.controls.productTier.setValue(ProductTierType.Families); this.changedProduct(); return; } - if (this.currentPlan && this.currentPlan.product !== ProductType.Enterprise) { + if (this.currentPlan && this.currentPlan.productTier !== ProductTierType.Enterprise) { const upgradedPlan = this.passwordManagerPlans.find((plan) => { - if (this.currentPlan.product === ProductType.Free) { + if (this.currentPlan.productTier === ProductTierType.Free) { return plan.type === PlanType.FamiliesAnnually; } if ( - this.currentPlan.product === ProductType.Families && + this.currentPlan.productTier === ProductTierType.Families && !this.teamsStarterPlanIsAvailable ) { return plan.type === PlanType.TeamsAnnually; @@ -788,7 +790,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { }); this.plan = upgradedPlan.type; - this.product = upgradedPlan.product; + this.productTier = upgradedPlan.productTier; this.changedProduct(); } } diff --git a/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts b/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts index b6282f1e7b..d8568d15b5 100644 --- a/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts +++ b/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts @@ -8,10 +8,9 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction import { ProviderService } from "@bitwarden/common/admin-console/abstractions/provider.service"; import { OrganizationApiKeyType, ProviderStatusType } from "@bitwarden/common/admin-console/enums"; 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 { 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 { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; @@ -53,7 +52,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy manageBillingFromProviderPortal = ManageBilling; isProviderManaged = false; - protected readonly teamsStarter = ProductType.TeamsStarter; + protected readonly teamsStarter = ProductTierType.TeamsStarter; private destroy$ = new Subject(); @@ -286,7 +285,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy } } else if (this.sub.maxAutoscaleSeats === this.sub.seats && this.sub.seats != null) { 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); } else if (this.sub.maxAutoscaleSeats == null) { return this.i18nService.t("subscriptionUserSeatsUnlimitedAutoscale"); @@ -440,12 +439,12 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy }; 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( a: BillingSubscriptionItemResponse, diff --git a/apps/web/src/app/billing/shared/sm-subscribe.component.ts b/apps/web/src/app/billing/shared/sm-subscribe.component.ts index a849b8dd33..7bb3e3cada 100644 --- a/apps/web/src/app/billing/shared/sm-subscribe.component.ts +++ b/apps/web/src/app/billing/shared/sm-subscribe.component.ts @@ -3,9 +3,9 @@ import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { Subject, startWith, takeUntil } from "rxjs"; 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 { 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 { SecretsManagerLogo } from "../../layouts/secrets-manager-logo"; @@ -40,7 +40,7 @@ export class SecretsManagerSubscribeComponent implements OnInit, OnDestroy { @Input() customerDiscount: BillingCustomerDiscount; logo = SecretsManagerLogo; - productTypes = ProductType; + productTypes = ProductTierType; private destroy$ = new Subject(); @@ -75,17 +75,17 @@ export class SecretsManagerSubscribeComponent implements OnInit, OnDestroy { }; get product() { - return this.selectedPlan.product; + return this.selectedPlan.productTier; } get planName() { switch (this.product) { - case ProductType.Free: + case ProductTierType.Free: return this.i18nService.t("free2PersonOrganization"); - case ProductType.Teams: - case ProductType.TeamsStarter: + case ProductTierType.Teams: + case ProductTierType.TeamsStarter: return this.i18nService.t("planNameTeams"); - case ProductType.Enterprise: + case ProductTierType.Enterprise: return this.i18nService.t("planNameEnterprise"); } } diff --git a/apps/web/src/app/vault/individual-vault/add-edit.component.ts b/apps/web/src/app/vault/individual-vault/add-edit.component.ts index fee728ca99..8b29595063 100644 --- a/apps/web/src/app/vault/individual-vault/add-edit.component.ts +++ b/apps/web/src/app/vault/individual-vault/add-edit.component.ts @@ -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 { AccountService } from "@bitwarden/common/auth/abstractions/account.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 { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; @@ -271,7 +272,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit, On return ( this.cipher.type === CipherType.Login && this.cipher.login.totp && - this.organization?.planProductType != ProductType.Free && + this.organization?.productTierType != ProductTierType.Free && (this.cipher.organizationUseTotp || this.canAccessPremium) ); } diff --git a/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts b/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts index 729e174f76..081d1e503e 100644 --- a/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts +++ b/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts @@ -4,7 +4,7 @@ import { firstValueFrom } from "rxjs"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; 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 { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; @@ -183,7 +183,7 @@ export class VaultHeaderComponent implements OnInit { } async addCollection() { - if (this.organization.planProductType === ProductType.Free) { + if (this.organization.productTierType === ProductTierType.Free) { const collections = await this.collectionAdminService.getAll(this.organization.id); if (collections.length === this.organization.maxCollections) { this.showFreeOrgUpgradeDialog(); diff --git a/libs/common/src/admin-console/models/data/organization.data.spec.ts b/libs/common/src/admin-console/models/data/organization.data.spec.ts index 1868048390..549c759f93 100644 --- a/libs/common/src/admin-console/models/data/organization.data.spec.ts +++ b/libs/common/src/admin-console/models/data/organization.data.spec.ts @@ -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 { ORGANIZATIONS } from "../../services/organization/organization.service"; @@ -47,7 +47,7 @@ describe("ORGANIZATIONS state", () => { isMember: false, familySponsorshipFriendlyName: "fsfn", familySponsorshipAvailable: false, - planProductType: ProductType.Free, + productTierType: ProductTierType.Free, keyConnectorEnabled: false, keyConnectorUrl: "kcu", accessSecretsManager: false, diff --git a/libs/common/src/admin-console/models/data/organization.data.ts b/libs/common/src/admin-console/models/data/organization.data.ts index afc6b40b93..2b27882cb7 100644 --- a/libs/common/src/admin-console/models/data/organization.data.ts +++ b/libs/common/src/admin-console/models/data/organization.data.ts @@ -1,6 +1,6 @@ import { Jsonify } from "type-fest"; -import { ProductType } from "../../../enums"; +import { ProductTierType } from "../../../billing/enums"; import { OrganizationUserStatusType, OrganizationUserType, ProviderType } from "../../enums"; import { PermissionsApi } from "../api/permissions.api"; import { ProfileOrganizationResponse } from "../response/profile-organization.response"; @@ -45,7 +45,7 @@ export class OrganizationData { isMember: boolean; familySponsorshipFriendlyName: string; familySponsorshipAvailable: boolean; - planProductType: ProductType; + productTierType: ProductTierType; keyConnectorEnabled: boolean; keyConnectorUrl: string; familySponsorshipLastSyncDate?: Date; @@ -104,7 +104,7 @@ export class OrganizationData { this.providerType = response.providerType; this.familySponsorshipFriendlyName = response.familySponsorshipFriendlyName; this.familySponsorshipAvailable = response.familySponsorshipAvailable; - this.planProductType = response.planProductType; + this.productTierType = response.planProductType; this.keyConnectorEnabled = response.keyConnectorEnabled; this.keyConnectorUrl = response.keyConnectorUrl; this.familySponsorshipLastSyncDate = response.familySponsorshipLastSyncDate; diff --git a/libs/common/src/admin-console/models/domain/organization.ts b/libs/common/src/admin-console/models/domain/organization.ts index f18167f733..d8e90e41be 100644 --- a/libs/common/src/admin-console/models/domain/organization.ts +++ b/libs/common/src/admin-console/models/domain/organization.ts @@ -1,6 +1,6 @@ import { Jsonify } from "type-fest"; -import { ProductType } from "../../../enums"; +import { ProductTierType } from "../../../billing/enums"; import { OrganizationUserStatusType, OrganizationUserType, ProviderType } from "../../enums"; import { PermissionsApi } from "../api/permissions.api"; import { OrganizationData } from "../data/organization.data"; @@ -58,7 +58,7 @@ export class Organization { isMember: boolean; familySponsorshipFriendlyName: string; familySponsorshipAvailable: boolean; - planProductType: ProductType; + productTierType: ProductTierType; keyConnectorEnabled: boolean; keyConnectorUrl: string; familySponsorshipLastSyncDate?: Date; @@ -123,7 +123,7 @@ export class Organization { this.isMember = obj.isMember; this.familySponsorshipFriendlyName = obj.familySponsorshipFriendlyName; this.familySponsorshipAvailable = obj.familySponsorshipAvailable; - this.planProductType = obj.planProductType; + this.productTierType = obj.productTierType; this.keyConnectorEnabled = obj.keyConnectorEnabled; this.keyConnectorUrl = obj.keyConnectorUrl; this.familySponsorshipLastSyncDate = obj.familySponsorshipLastSyncDate; diff --git a/libs/common/src/admin-console/models/response/profile-organization.response.ts b/libs/common/src/admin-console/models/response/profile-organization.response.ts index 1649bf47ba..6a469005db 100644 --- a/libs/common/src/admin-console/models/response/profile-organization.response.ts +++ b/libs/common/src/admin-console/models/response/profile-organization.response.ts @@ -1,4 +1,4 @@ -import { ProductType } from "../../../enums"; +import { ProductTierType } from "../../../billing/enums"; import { BaseResponse } from "../../../models/response/base.response"; import { OrganizationUserStatusType, OrganizationUserType, ProviderType } from "../../enums"; import { PermissionsApi } from "../api/permissions.api"; @@ -42,7 +42,7 @@ export class ProfileOrganizationResponse extends BaseResponse { providerType?: ProviderType; familySponsorshipFriendlyName: string; familySponsorshipAvailable: boolean; - planProductType: ProductType; + planProductType: ProductTierType; keyConnectorEnabled: boolean; keyConnectorUrl: string; familySponsorshipLastSyncDate?: Date; diff --git a/libs/common/src/billing/enums/index.ts b/libs/common/src/billing/enums/index.ts index 70a3495a8b..e11cd9d829 100644 --- a/libs/common/src/billing/enums/index.ts +++ b/libs/common/src/billing/enums/index.ts @@ -3,3 +3,4 @@ export * from "./plan-sponsorship-type.enum"; export * from "./plan-type.enum"; export * from "./transaction-type.enum"; export * from "./bitwarden-product-type.enum"; +export * from "./product-tier-type.enum"; diff --git a/libs/common/src/enums/product-type.enum.ts b/libs/common/src/billing/enums/product-tier-type.enum.ts similarity index 72% rename from libs/common/src/enums/product-type.enum.ts rename to libs/common/src/billing/enums/product-tier-type.enum.ts index 7ed3a79e98..c40f913ec8 100644 --- a/libs/common/src/enums/product-type.enum.ts +++ b/libs/common/src/billing/enums/product-tier-type.enum.ts @@ -1,4 +1,4 @@ -export enum ProductType { +export enum ProductTierType { Free = 0, Families = 1, Teams = 2, diff --git a/libs/common/src/billing/enums/product-type.enum.ts b/libs/common/src/billing/enums/product-type.enum.ts new file mode 100644 index 0000000000..3072ad0f96 --- /dev/null +++ b/libs/common/src/billing/enums/product-type.enum.ts @@ -0,0 +1,4 @@ +export enum ProductType { + PasswordManager = 0, + SecretsManager = 1, +} diff --git a/libs/common/src/billing/models/response/plan.response.ts b/libs/common/src/billing/models/response/plan.response.ts index 9f603840c3..c03fd76efc 100644 --- a/libs/common/src/billing/models/response/plan.response.ts +++ b/libs/common/src/billing/models/response/plan.response.ts @@ -1,10 +1,9 @@ -import { ProductType } from "../../../enums"; +import { ProductTierType, PlanType } from "../../../billing/enums"; import { BaseResponse } from "../../../models/response/base.response"; -import { PlanType } from "../../enums"; export class PlanResponse extends BaseResponse { type: PlanType; - product: ProductType; + productTier: ProductTierType; name: string; isAnnual: boolean; nameLocalizationKey: string; @@ -32,7 +31,7 @@ export class PlanResponse extends BaseResponse { constructor(response: any) { super(response); this.type = this.getResponseProperty("Type"); - this.product = this.getResponseProperty("Product"); + this.productTier = this.getResponseProperty("ProductTier"); this.name = this.getResponseProperty("Name"); this.isAnnual = this.getResponseProperty("IsAnnual"); this.nameLocalizationKey = this.getResponseProperty("NameLocalizationKey"); diff --git a/libs/common/src/enums/index.ts b/libs/common/src/enums/index.ts index 9ca806899a..cf9dac8018 100644 --- a/libs/common/src/enums/index.ts +++ b/libs/common/src/enums/index.ts @@ -6,4 +6,3 @@ export * from "./http-status-code.enum"; export * from "./integration-type.enum"; export * from "./native-messaging-version.enum"; export * from "./notification-type.enum"; -export * from "./product-type.enum";