[PM-43274] feat: Add the Privileged Controls purchase to the organization subscription page (#24164)

* [PM-43274] feat: Add Privileged Controls plan pricing and billing flag

* [PM-43274] feat: Add Privileged Controls purchase call to the organization billing client

* [PM-43274] feat: Add the Privileged Controls purchase component

* [PM-43274] feat: Show the Privileged Controls purchase on the subscription page

* [PM-43274] fix: Skip the Privileged Controls purchase when seats are empty

* [PM-43274] fix: Validate the Privileged Controls purchase form before submitting

* [PM-43274] feat: Add the Privileged Controls product logo

The Privileged Controls purchase block needs header art matching the Secrets Manager purchase block. This mirrors SecretsManagerAlt with the product name outlined in DM Sans, the brand font used by the Secrets Manager artwork.

* [PM-43274] feat: Polish the Privileged Controls purchase block

- Show the logo and feature copy in place of the placeholders
- Show the More from Bitwarden heading once when the Secrets Manager purchase is also on the page
- Show the max potential seat cost under the seat limit, as Password Manager does
- Require the seat limit to be a whole number above the seat count so it is a limit the organization can autoscale up to

* [PM-43274] fix: Reject decimal Privileged Controls seat counts

Seats are bought in whole units, but the seat count field accepted values like 10.5.

* [PM-43274] feat: Cap Privileged Controls seats at Password Manager seats

Privileged Controls no longer has a seat minimum. An organization can buy from 1 seat up to its Password Manager seat count, and its Privileged Controls seat limit can't exceed its Password Manager seat limit, or its Password Manager seat count when it has no limit.

- Remove the seat minimum validation, its hint, and the unused defaultSeatMinimum plan field
- Default seats to 1

* [PM-43274] fix: Hide the Privileged Controls purchase when the server reports it

The purchase block checked usePam on the locally synced organization, which stays stale until the client syncs. An organization that got Privileged Controls in another session still saw the purchase offer. Read usePam from the subscription response instead, which the page fetches fresh on load.

* [PM-43274] refactor: Simplify the Privileged Controls purchase form

Keeps every seat check on the field that displays it, so errors show under
the right input without a parent lookup, and drops the enable/disable
toggling that the template's @if already covers. Also hides the purchase for
provider organizations, matching the Secrets Manager subscribe gate.

* [PM-43274] feat: Update Secrets Manager and Privileged Controls purchase copy

Match the updated design copy for the More from Bitwarden cards. Secrets
Manager gets new keys because its existing strings are already translated.

* [PM-43274] fix: Add a space between the slash and interval in purchase prices

* [PM-43274] feat: Hide the Privileged Controls seat limit behind a limit checkbox

Match the Password Manager seat limit pattern so the seat limit is opt-in.
Unchecking the limit clears it so no hidden value is submitted.

* [PM-43274] feat: Apply final Secrets Manager and Privileged Controls copy

Design finalized the More from Bitwarden copy. Privileged Controls gets the
new description and feature list. Secrets Manager gets a new description key,
since the old string is already translated.

* [PM-43274] fix: Use semantic color tokens in the purchase blocks for dark mode

The legacy muted text and secondary border tokens don't match the design in
dark mode. Use fg-body, fg-heading, and border-base, as the design specifies.

* [PM-43274] feat: Drop "included" from the Secrets Manager machine accounts bullet

Match the final design copy. Reuse the existing includedMachineAccountsV2 key,
which already reads "$COUNT$ machine accounts", and remove the now-unused
machineAccountsIncluded key.

* [PM-43274] feat: Show the Secrets Manager and Privileged Controls purchase blocks as accordions

Design asked for each purchase block's header to be an accordion header.
Use the design system accordion's default variant as is, open by default.
The accordion title replaces the header art and in-block title, so remove
the now-unused plan name title code and its strings.

The Secrets Manager block is shared, so the organization plans page and
the legacy subscription page also show the accordion.

* [PM-43274] chore: Remove the unused Secrets Manager and Privileged Controls header art

The purchase blocks now use accordion headers, so nothing references these
SVGs anymore.

* [PM-43274] feat: Update the Privileged Controls seat limit hint copy

Design asked for the hint to say members can't be given access to
Privileged Controls once the limit is reached.

* [PM-43274] fix: Add spacing between the purchase block feature bullets

Design flagged the bullet list as too tight. Add 8px between items, as
the design specifies.

* [PM-43274] chore: Remove the unused subscribeToSecretsManager string

The Secrets Manager purchase checkbox now reads addSecretsManager, so nothing reads this key.

* [PM-43274] test: Fold the Privileged Controls plan parsing assertions into one test

The new test duplicated "parses PrivilegedControls when present", so its seat plan ID and base seats assertions move there.
This commit is contained in:
Kyle Denney
2026-11-11 10:09:38 -06:00
committed by GitHub
parent 45e4aaae30
commit 656638995a
15 changed files with 1112 additions and 91 deletions

View File

@@ -159,6 +159,31 @@ describe("OrganizationBillingClient", () => {
});
});
describe("purchasePrivilegedControls", () => {
it("calls the purchase route with the request body", async () => {
mockApiService.send.mockResolvedValue(undefined);
await sut.purchasePrivilegedControls(orgId, { seats: 10, maxAutoscaleSeats: 20 });
expect(mockApiService.send).toHaveBeenCalledWith(
"POST",
`/organizations/${orgId}/billing/subscription/privileged-controls/purchase`,
{ seats: 10, maxAutoscaleSeats: 20 },
true,
false,
);
});
it("propagates errors from the API", async () => {
const serverError = new ErrorResponse(null, 400);
mockApiService.send.mockRejectedValue(serverError);
await expect(
sut.purchasePrivilegedControls(orgId, { seats: 10, maxAutoscaleSeats: null }),
).rejects.toBe(serverError);
});
});
describe("updatePrivilegedControlsSubscription", () => {
it("sends the seat adjustment and limit to the correct route", async () => {
mockApiService.send.mockResolvedValue(undefined);

View File

@@ -7,6 +7,11 @@ import { OrganizationWarningsResponse } from "@bitwarden/web-vault/app/billing/o
type ChurnMitigationOfferDuration = "once" | "repeating";
export type PurchasePrivilegedControlsRequest = {
seats: number;
maxAutoscaleSeats: number | null;
};
export type UpdatePrivilegedControlsSubscriptionRequest = {
seatAdjustment: number;
maxAutoscaleSeats: number | null;
@@ -106,6 +111,19 @@ export class OrganizationBillingClient {
);
};
purchasePrivilegedControls = async (
organizationId: OrganizationId,
request: PurchasePrivilegedControlsRequest,
): Promise<void> => {
await this.apiService.send(
"POST",
`/organizations/${organizationId}/billing/subscription/privileged-controls/purchase`,
request,
true,
false,
);
};
updatePrivilegedControlsSubscription = async (
organizationId: OrganizationId,
request: UpdatePrivilegedControlsSubscriptionRequest,

View File

@@ -89,6 +89,22 @@
</div>
}
@if (showPrivilegedControlsPurchase() && orgSub && org) {
<div class="tw-mt-7">
@if (!showSecretsManagerSubscribe()) {
<h3 bitTypography="h3">{{ "moreFromBitwarden" | i18n }}</h3>
}
<billing-privileged-controls-purchase
[plan]="orgSub.plan"
[organizationId]="org.id"
[customerDiscount]="customerDiscount()"
[passwordManagerSeats]="orgSub.seats"
[passwordManagerMaxAutoscaleSeats]="orgSub.maxAutoscaleSeats"
(purchased)="subscriptionAdjusted()"
/>
</div>
}
@if (showPrivilegedControlsContactSalesToAdd()) {
<div class="tw-mt-7" id="privileged-controls-contact-sales-to-add">
<h2 bitTypography="h2">{{ "privilegedControls" | i18n }}</h2>

View File

@@ -1,6 +1,7 @@
import { DatePipe } from "@angular/common";
import { ChangeDetectionStrategy, Component, input, output } from "@angular/core";
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { By } from "@angular/platform-browser";
import { ActivatedRoute, convertToParamMap, ParamMap, Router } from "@angular/router";
import { mock } from "jest-mock-extended";
import { BehaviorSubject, Observable, of, Subject, throwError } from "rxjs";
@@ -34,6 +35,7 @@ import {
import { OrganizationSubscriptionCloudComponent } from "./organization-subscription-cloud.component";
import { OrganizationSubscriptionDataService } from "./organization-subscription-data.service";
import { PrivilegedControlsAdjustSubscriptionComponent } from "./privileged-controls-adjust-subscription.component";
import { PrivilegedControlsPurchaseComponent } from "./privileged-controls-purchase.component";
import * as restartSubscriptionDialog from "./restart-subscription-dialog.component";
import { RestartSubscriptionDialogResultType } from "./restart-subscription-dialog.component";
import { SecretsManagerAdjustSubscriptionComponent } from "./sm-adjust-subscription.component";
@@ -79,6 +81,20 @@ class MockSmSubscribeStandaloneComponent {
readonly onSubscribe = output<void>();
}
@Component({
selector: "billing-privileged-controls-purchase",
template: "",
changeDetection: ChangeDetectionStrategy.OnPush,
})
class MockPrivilegedControlsPurchaseComponent {
readonly plan = input<unknown>();
readonly organizationId = input<unknown>();
readonly customerDiscount = input<unknown>();
readonly passwordManagerSeats = input<unknown>();
readonly passwordManagerMaxAutoscaleSeats = input<unknown>();
readonly purchased = output<void>();
}
@Component({
selector: "app-sm-adjust-subscription",
template: "",
@@ -287,6 +303,7 @@ describe("OrganizationSubscriptionCloudComponent", () => {
SecretsManagerAdjustSubscriptionComponent,
PrivilegedControlsAdjustSubscriptionComponent,
OrganizationScheduledPriceIncreaseWarningComponent,
PrivilegedControlsPurchaseComponent,
],
},
add: {
@@ -297,6 +314,7 @@ describe("OrganizationSubscriptionCloudComponent", () => {
MockSmAdjustSubscriptionComponent,
MockPrivilegedControlsAdjustSubscriptionComponent,
MockScheduledPriceIncreaseWarningComponent,
MockPrivilegedControlsPurchaseComponent,
],
},
});
@@ -1047,6 +1065,166 @@ describe("OrganizationSubscriptionCloudComponent", () => {
});
});
describe("privileged controls purchase gating", () => {
const buildEligibleOrganization = (overrides: Partial<Organization> = {}) =>
buildOrganization({
canEditSubscription: true,
usePam: false,
productTierType: ProductTierType.Enterprise,
...overrides,
});
const buildEnterpriseSubscription = (
planOverrides: Record<string, unknown> = {},
overrides: Partial<OrganizationSubscriptionResponse> = {},
) => {
const base = buildSubscriptionResponse();
return buildSubscriptionResponse({
planType: PlanType.EnterpriseAnnually,
plan: {
...base.plan,
productTier: ProductTierType.Enterprise,
PrivilegedControls: { seatPrice: 120 },
...planOverrides,
} as OrganizationSubscriptionResponse["plan"],
...overrides,
});
};
const mockFlags = (billing: boolean, pam: boolean) =>
configService.getFeatureFlag$.mockImplementation(
(flag) =>
of(
(flag === FeatureFlag.PamBillingSupport && billing) ||
(flag === FeatureFlag.Pam && pam),
) as any,
);
beforeEach(() => mockFlags(true, true));
/** Renders and waits for the subscription resource so each gate is evaluated on loaded data. */
const render = async (options: {
organization: Organization;
subscription: OrganizationSubscriptionResponse;
}) => {
createComponent({ ...options, detectChanges: true });
await fixture.whenStable();
expect(component.organizationSubscription()).not.toBeNull();
};
it("shows the purchase block for an eligible Enterprise organization", async () => {
await render({
organization: buildEligibleOrganization(),
subscription: buildEnterpriseSubscription(),
});
expect(component.showPrivilegedControlsPurchase()).toBe(true);
});
it("hides it when the billing flag is off", async () => {
mockFlags(false, true);
await render({
organization: buildEligibleOrganization(),
subscription: buildEnterpriseSubscription(),
});
expect(component.showPrivilegedControlsPurchase()).toBe(false);
});
it("hides it when the PAM product flag is off", async () => {
mockFlags(true, false);
await render({
organization: buildEligibleOrganization(),
subscription: buildEnterpriseSubscription(),
});
expect(component.showPrivilegedControlsPurchase()).toBe(false);
});
it("hides it when the organization already has Privileged Controls", async () => {
await render({
organization: buildEligibleOrganization({ usePam: true }),
subscription: buildEnterpriseSubscription({}, { usePam: true }),
});
expect(component.showPrivilegedControlsPurchase()).toBe(false);
});
it("hides it when the server reports Privileged Controls before the local organization syncs", async () => {
await render({
organization: buildEligibleOrganization({ usePam: false }),
subscription: buildEnterpriseSubscription({}, { usePam: true }),
});
expect(component.showPrivilegedControlsPurchase()).toBe(false);
});
it("hides it for a non-Enterprise plan", async () => {
await render({
organization: buildEligibleOrganization(),
subscription: buildEnterpriseSubscription({ productTier: ProductTierType.Teams }),
});
expect(component.showPrivilegedControlsPurchase()).toBe(false);
});
it("hides it when the plan has no Privileged Controls pricing", async () => {
await render({
organization: buildEligibleOrganization(),
subscription: buildEnterpriseSubscription({ PrivilegedControls: null }),
});
expect(component.showPrivilegedControlsPurchase()).toBe(false);
});
it("hides it when the subscription is cancelled", async () => {
await render({
organization: buildEligibleOrganization(),
subscription: buildEnterpriseSubscription({}, { subscription: { cancelled: true } as any }),
});
expect(component.showPrivilegedControlsPurchase()).toBe(false);
});
it("hides it when the organization has a provider", async () => {
await render({
organization: buildEligibleOrganization({ hasProvider: true }),
subscription: buildEnterpriseSubscription(),
});
expect(component.showPrivilegedControlsPurchase()).toBe(false);
});
it("passes the Password Manager seats and seat limit to the purchase block", async () => {
await render({
organization: buildEligibleOrganization(),
subscription: buildEnterpriseSubscription({}, { seats: 25, maxAutoscaleSeats: 40 }),
});
fixture.detectChanges();
const block: MockPrivilegedControlsPurchaseComponent = fixture.debugElement.query(
By.directive(MockPrivilegedControlsPurchaseComponent),
).componentInstance;
expect(block.passwordManagerSeats()).toBe(25);
expect(block.passwordManagerMaxAutoscaleSeats()).toBe(40);
});
const moreFromBitwardenHeadings = (): HTMLElement[] =>
Array.from<HTMLElement>(fixture.nativeElement.querySelectorAll("h3")).filter(
(heading) => heading.textContent?.trim() === "moreFromBitwarden",
);
it("shows its own More from Bitwarden heading when Secrets Manager subscribe is hidden", async () => {
await render({
organization: buildEligibleOrganization({ useSecretsManager: true }),
subscription: buildEnterpriseSubscription(),
});
fixture.detectChanges();
expect(moreFromBitwardenHeadings().length).toBe(1);
});
it("leaves the More from Bitwarden heading to Secrets Manager subscribe when it is shown", async () => {
await render({
organization: buildEligibleOrganization({ useSecretsManager: false }),
subscription: buildEnterpriseSubscription(),
});
fixture.detectChanges();
expect(component.showSecretsManagerSubscribe()).toBe(true);
expect(moreFromBitwardenHeadings().length).toBe(0);
});
});
describe("privileged controls adjust gating", () => {
const enablePamBillingSupport = () =>
configService.getFeatureFlag$.mockImplementation(

View File

@@ -61,6 +61,7 @@ import {
PrivilegedControlsAdjustSubscriptionComponent,
PrivilegedControlsSubscriptionOptions,
} from "./privileged-controls-adjust-subscription.component";
import { PrivilegedControlsPurchaseComponent } from "./privileged-controls-purchase.component";
import { resolveOrgSubscriptionAccess } from "./resolve-org-subscription-access";
import {
openRestartSubscriptionDialog,
@@ -116,6 +117,7 @@ const SubscriptionStatusLabels: Record<string, string> = {
AdjustSubscription,
SecretsManagerSubscribeStandaloneComponent,
SecretsManagerAdjustSubscriptionComponent,
PrivilegedControlsPurchaseComponent,
PrivilegedControlsAdjustSubscriptionComponent,
ErrorCardComponent,
CalloutComponent,
@@ -329,6 +331,38 @@ export class OrganizationSubscriptionCloudComponent {
);
});
private readonly pamBillingSupportEnabled = toSignal(
this.configService.getFeatureFlag$(FeatureFlag.PamBillingSupport),
{ initialValue: false },
);
/** Privileged Controls itself; without it the product is reachable nowhere, so no Contact sales call to action. */
private readonly pamEnabled = toSignal(this.configService.getFeatureFlag$(FeatureFlag.Pam), {
initialValue: false,
});
/**
* Determines if the "Privileged Controls purchase" section should be shown.
* @returns True if the section should be displayed, false otherwise.
*/
readonly showPrivilegedControlsPurchase = computed(() => {
const org = this.organization();
const subscription = this.organizationSubscription();
const plan = subscription?.plan;
if (org == null || subscription == null || plan == null) {
return false;
}
return (
!org.hasProvider &&
this.pamBillingSupportEnabled() &&
this.pamEnabled() &&
!subscription.usePam &&
plan.productTier === ProductTierType.Enterprise &&
plan.PrivilegedControls != null &&
!this.isSubscriptionCanceledOrPendingCancellation()
);
});
/**
* Determines if the "Adjust Secrets Manager" section should be shown.
* @returns True if the section should be displayed, false otherwise.
@@ -348,16 +382,6 @@ export class OrganizationSubscriptionCloudComponent {
);
});
private readonly pamBillingSupportEnabled = toSignal(
this.configService.getFeatureFlag$(FeatureFlag.PamBillingSupport),
{ initialValue: false },
);
/** Privileged Controls itself; without it the product is reachable nowhere, so no Contact sales call to action. */
private readonly pamEnabled = toSignal(this.configService.getFeatureFlag$(FeatureFlag.Pam), {
initialValue: false,
});
/** Self-serve Privileged Controls: seat and limit adjustment, shown only while PAM billing support is on. */
readonly showAdjustPrivilegedControls = computed(() => {
const org = this.organization();

View File

@@ -0,0 +1,92 @@
<form [formGroup]="formGroup" [bitSubmit]="submit">
<bit-accordion
[title]="'privilegedControls' | i18n"
startIcon="bwi-bitwarden-shield"
height="auto"
[open]="true"
>
<div class="tw-text-fg-body">
{{ "privilegedControlsPurchaseDesc" | i18n }}
<p class="tw-mb-0 tw-mt-3 tw-font-medium tw-text-fg-heading">{{ "whatsIncluded" | i18n }}</p>
<ul class="tw-space-y-2">
<li>{{ "privilegedControlsFeatureCredentialLeasing" | i18n }}</li>
<li>{{ "privilegedControlsFeatureAccessRules" | i18n }}</li>
<li>{{ "privilegedControlsFeatureRotation" | i18n }}</li>
<li>{{ "privilegedControlsFeatureAuditLog" | i18n }}</li>
<li>{{ "privilegedControlsFeatureGovernanceDashboard" | i18n }}</li>
</ul>
</div>
<div class="tw-mb-5 tw-text-fg-body">
{{ "pricePerMember" | i18n: (monthlyCostPerSeat() | currency: "$") }} / {{ "month" | i18n }}
</div>
<bit-form-control>
<input
id="privileged-controls-purchase_input_enabled"
type="checkbox"
bitCheckbox
[formControl]="enabledControl"
/>
<bit-label>{{ "addPrivilegedControls" | i18n }}</bit-label>
</bit-form-control>
@if (enabled()) {
<div class="tw-w-1/2">
<bit-form-field>
<bit-label>{{ "seats" | i18n }}</bit-label>
<input
id="privileged-controls-purchase_input_seats"
bitInput
formControlName="seats"
type="number"
min="1"
[max]="passwordManagerSeats()"
step="1"
/>
</bit-form-field>
</div>
<bit-form-control>
<input
id="privileged-controls-purchase_input_limit-subscription"
type="checkbox"
bitCheckbox
[formControl]="limitSubscriptionControl"
/>
<bit-label>{{ "limitSubscription" | i18n }}</bit-label>
<bit-hint>{{ "privilegedControlsSeatLimitDesc" | i18n }}</bit-hint>
</bit-form-control>
@if (limitSubscription()) {
<div class="tw-w-1/2">
<bit-form-field>
<bit-label>{{ "seatLimit" | i18n }}</bit-label>
<input
id="privileged-controls-purchase_input_seat-limit"
bitInput
formControlName="maxAutoscaleSeats"
type="number"
[min]="(seats() ?? 0) + 1"
[max]="maxAutoscaleSeatsCap()"
step="1"
/>
<bit-hint>
<strong>{{ "maxSeatCost" | i18n }}:</strong>
{{ maxAutoscaleSeats() || 0 }} &times; {{ seatPrice() | currency: "$" }} =
{{ maxSeatTotal() | currency: "$" }} / {{ interval() | i18n }}
</bit-hint>
</bit-form-field>
</div>
}
<button
id="privileged-controls-purchase_button_save"
type="submit"
bitButton
buttonType="primary"
bitFormButton
>
{{ "save" | i18n }}
</button>
}
</bit-accordion>
</form>

View File

@@ -0,0 +1,426 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { mock } from "jest-mock-extended";
import { BillingCustomerDiscount } from "@bitwarden/common/billing/models/response/organization-subscription.response";
import { PlanResponse } from "@bitwarden/common/billing/models/response/plan.response";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { OrganizationId } from "@bitwarden/common/types/guid";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { ToastService } from "@bitwarden/components";
import { OrganizationBillingClient } from "../clients/organization-billing.client";
import { PrivilegedControlsPurchaseComponent } from "./privileged-controls-purchase.component";
describe("PrivilegedControlsPurchaseComponent", () => {
let fixture: ComponentFixture<PrivilegedControlsPurchaseComponent>;
let component: PrivilegedControlsPurchaseComponent;
let billingClient: jest.Mocked<OrganizationBillingClient>;
let syncService: jest.Mocked<SyncService>;
let toastService: jest.Mocked<ToastService>;
const organizationId = "org-id" as OrganizationId;
const buildPlan = (overrides: { isAnnual?: boolean; seatPrice?: number } = {}): PlanResponse =>
({
isAnnual: overrides.isAnnual ?? true,
PrivilegedControls: { seatPrice: overrides.seatPrice ?? 120 },
}) as PlanResponse;
const createComponent = (options?: {
plan?: PlanResponse;
customerDiscount?: BillingCustomerDiscount | null;
passwordManagerSeats?: number;
passwordManagerMaxAutoscaleSeats?: number | null;
}) => {
fixture = TestBed.createComponent(PrivilegedControlsPurchaseComponent);
component = fixture.componentInstance;
fixture.componentRef.setInput("plan", options?.plan ?? buildPlan());
fixture.componentRef.setInput("organizationId", organizationId);
fixture.componentRef.setInput("customerDiscount", options?.customerDiscount ?? null);
fixture.componentRef.setInput("passwordManagerSeats", options?.passwordManagerSeats ?? 50);
fixture.componentRef.setInput(
"passwordManagerMaxAutoscaleSeats",
options?.passwordManagerMaxAutoscaleSeats ?? null,
);
fixture.detectChanges();
};
const form = () => component["formGroup"];
const enableAndFill = (seats: number, maxAutoscaleSeats: number | null) => {
component["enabledControl"].setValue(true);
form().controls.seats.setValue(seats);
form().controls.maxAutoscaleSeats.setValue(maxAutoscaleSeats);
};
beforeEach(async () => {
billingClient = mock<OrganizationBillingClient>();
syncService = mock<SyncService>();
toastService = mock<ToastService>();
const i18nService = mock<I18nService>();
i18nService.t.mockImplementation((key: string) => key);
await TestBed.configureTestingModule({
imports: [PrivilegedControlsPurchaseComponent],
providers: [
{ provide: OrganizationBillingClient, useValue: billingClient },
{ provide: SyncService, useValue: syncService },
{ provide: ToastService, useValue: toastService },
{ provide: I18nService, useValue: i18nService },
],
}).compileComponents();
});
describe("price", () => {
it("shows the monthly price for an annual plan", () => {
createComponent();
expect(component["monthlyCostPerSeat"]()).toBe(10);
});
it("shows the plan price for a monthly plan", () => {
createComponent({ plan: buildPlan({ isAnnual: false, seatPrice: 11 }) });
expect(component["monthlyCostPerSeat"]()).toBe(11);
});
it("applies an active percentage discount", () => {
createComponent({
customerDiscount: { active: true, percentOff: 20 } as BillingCustomerDiscount,
});
expect(component["monthlyCostPerSeat"]()).toBe(8);
});
it("ignores an inactive discount", () => {
createComponent({
customerDiscount: { active: false, percentOff: 20 } as BillingCustomerDiscount,
});
expect(component["monthlyCostPerSeat"]()).toBe(10);
});
});
describe("form", () => {
it("defaults seats to 1", () => {
createComponent();
expect(form().controls.seats.value).toBe(1);
});
it("accepts 1 seat", () => {
createComponent();
enableAndFill(1, null);
expect(form().controls.seats.valid).toBe(true);
});
it("rejects zero seats", () => {
createComponent();
enableAndFill(0, null);
expect(form().controls.seats.hasError("min")).toBe(true);
});
it("accepts seats equal to the Password Manager seat count", () => {
createComponent({ passwordManagerSeats: 50 });
enableAndFill(50, null);
expect(form().controls.seats.valid).toBe(true);
});
it("rejects seats above the Password Manager seat count", () => {
createComponent({ passwordManagerSeats: 50 });
enableAndFill(51, null);
expect(form().controls.seats.getError("seatsAbovePasswordManagerSeats")).toEqual({
message: "privilegedControlsSeatsAbovePasswordManagerSeats",
});
});
it("rejects seats above 100,000", () => {
createComponent();
enableAndFill(100001, null);
expect(form().controls.seats.hasError("max")).toBe(true);
});
it("rejects decimal seats", () => {
createComponent();
enableAndFill(10.5, null);
expect(form().controls.seats.hasError("wholeNumber")).toBe(true);
});
it("requires seats", () => {
createComponent();
enableAndFill(null, null);
expect(form().controls.seats.hasError("required")).toBe(true);
});
it("accepts a seat limit above seats", () => {
createComponent();
enableAndFill(12, 13);
expect(form().controls.maxAutoscaleSeats.hasError("maxAutoscaleSeatsNotAboveSeats")).toBe(
false,
);
});
it("rejects a seat limit equal to seats", () => {
createComponent();
enableAndFill(12, 12);
expect(form().controls.maxAutoscaleSeats.getError("maxAutoscaleSeatsNotAboveSeats")).toEqual({
message: "privilegedControlsSeatLimitNotAboveSeats",
});
});
it("rejects a negative seat limit", () => {
createComponent();
enableAndFill(12, -5);
expect(form().controls.maxAutoscaleSeats.hasError("maxAutoscaleSeatsNotAboveSeats")).toBe(
true,
);
});
it("rejects a decimal seat limit", () => {
createComponent();
enableAndFill(12, 20.5);
expect(form().controls.maxAutoscaleSeats.hasError("wholeNumber")).toBe(true);
});
it("caps the seat limit at the Password Manager seat limit when one is set", () => {
createComponent({ passwordManagerSeats: 50, passwordManagerMaxAutoscaleSeats: 30 });
enableAndFill(12, 30);
expect(form().controls.maxAutoscaleSeats.valid).toBe(true);
form().controls.maxAutoscaleSeats.setValue(31);
expect(
form().controls.maxAutoscaleSeats.getError("maxAutoscaleSeatsAbovePasswordManager"),
).toEqual({
message: "privilegedControlsSeatLimitAbovePasswordManagerSeatLimit",
});
});
it("caps the seat limit at the Password Manager seat count when there is no Password Manager seat limit", () => {
createComponent({ passwordManagerSeats: 50, passwordManagerMaxAutoscaleSeats: null });
enableAndFill(12, 50);
expect(form().controls.maxAutoscaleSeats.valid).toBe(true);
form().controls.maxAutoscaleSeats.setValue(51);
expect(
form().controls.maxAutoscaleSeats.getError("maxAutoscaleSeatsAbovePasswordManager"),
).toEqual({
message: "privilegedControlsSeatLimitAbovePasswordManagerSeats",
});
});
it("flags the seat limit when seats are raised to it", () => {
createComponent();
enableAndFill(12, 13);
form().controls.seats.setValue(13);
expect(form().controls.maxAutoscaleSeats.hasError("maxAutoscaleSeatsNotAboveSeats")).toBe(
true,
);
});
it("clears the seat limit error when seats are lowered below it", () => {
createComponent();
enableAndFill(12, 12);
form().controls.seats.setValue(11);
expect(form().controls.maxAutoscaleSeats.valid).toBe(true);
});
it("keeps the seat limit's own errors when the seats comparison passes", () => {
createComponent({ passwordManagerSeats: 50 });
enableAndFill(12, 51);
form().controls.seats.setValue(10);
expect(
form().controls.maxAutoscaleSeats.hasError("maxAutoscaleSeatsAbovePasswordManager"),
).toBe(true);
});
it("hides the seat fields until Privileged Controls is checked", () => {
createComponent();
expect(
fixture.nativeElement.querySelector("#privileged-controls-purchase_input_seats"),
).toBeNull();
fixture.nativeElement.querySelector("#privileged-controls-purchase_input_enabled").click();
fixture.detectChanges();
expect(
fixture.nativeElement.querySelector("#privileged-controls-purchase_input_seats"),
).not.toBeNull();
});
it("hides the seat limit field until the subscription limit is checked", () => {
createComponent();
fixture.nativeElement.querySelector("#privileged-controls-purchase_input_enabled").click();
fixture.detectChanges();
expect(
fixture.nativeElement.querySelector("#privileged-controls-purchase_input_seat-limit"),
).toBeNull();
fixture.nativeElement
.querySelector("#privileged-controls-purchase_input_limit-subscription")
.click();
fixture.detectChanges();
expect(
fixture.nativeElement.querySelector("#privileged-controls-purchase_input_seat-limit"),
).not.toBeNull();
});
it("shows the seat limit description under the subscription limit checkbox", () => {
createComponent();
fixture.nativeElement.querySelector("#privileged-controls-purchase_input_enabled").click();
fixture.detectChanges();
const limitSubscriptionInput: HTMLElement = fixture.nativeElement.querySelector(
"#privileged-controls-purchase_input_limit-subscription",
);
expect(limitSubscriptionInput.closest("bit-form-control")?.textContent).toContain(
"privilegedControlsSeatLimitDesc",
);
});
it("clears the seat limit when the subscription limit is unchecked", () => {
createComponent();
component["limitSubscriptionControl"].setValue(true);
enableAndFill(12, 20);
component["limitSubscriptionControl"].setValue(false);
expect(form().controls.maxAutoscaleSeats.value).toBeNull();
});
});
describe("max seat cost", () => {
it("multiplies the seat limit by the plan seat price", () => {
createComponent();
enableAndFill(12, 20);
expect(component["maxSeatTotal"]()).toBe(2400);
});
it("applies an active percentage discount", () => {
createComponent({
customerDiscount: { active: true, percentOff: 20 } as BillingCustomerDiscount,
});
enableAndFill(12, 20);
expect(component["maxSeatTotal"]()).toBe(1920);
});
it("is zero when the seat limit is empty", () => {
createComponent();
enableAndFill(12, null);
expect(component["maxSeatTotal"]()).toBe(0);
});
it("uses the plan billing interval", () => {
createComponent({ plan: buildPlan({ isAnnual: false, seatPrice: 11 }) });
expect(component["interval"]()).toBe("month");
});
});
describe("submit", () => {
it("sends the seats and seat limit on submit", async () => {
createComponent();
enableAndFill(15, 20);
await component["submit"]();
expect(billingClient.purchasePrivilegedControls).toHaveBeenCalledWith(organizationId, {
seats: 15,
maxAutoscaleSeats: 20,
});
});
it("sends a null seat limit when the subscription limit is unchecked", async () => {
createComponent();
component["limitSubscriptionControl"].setValue(true);
enableAndFill(15, 20);
component["limitSubscriptionControl"].setValue(false);
await component["submit"]();
expect(billingClient.purchasePrivilegedControls).toHaveBeenCalledWith(organizationId, {
seats: 15,
maxAutoscaleSeats: null,
});
});
it("sends a null seat limit when the field is cleared", async () => {
createComponent();
enableAndFill(15, 20);
form().controls.maxAutoscaleSeats.setValue(null);
await component["submit"]();
expect(billingClient.purchasePrivilegedControls).toHaveBeenCalledWith(organizationId, {
seats: 15,
maxAutoscaleSeats: null,
});
});
it("does not purchase when seats are above the Password Manager seat count", async () => {
createComponent({ passwordManagerSeats: 50 });
enableAndFill(51, null);
await component["submit"]();
expect(billingClient.purchasePrivilegedControls).not.toHaveBeenCalled();
});
it("does not purchase when the seat limit is not above seats", async () => {
createComponent();
enableAndFill(12, 12);
await component["submit"]();
expect(billingClient.purchasePrivilegedControls).not.toHaveBeenCalled();
});
it("does not purchase when seats are a decimal", async () => {
createComponent();
enableAndFill(10.5, null);
await component["submit"]();
expect(billingClient.purchasePrivilegedControls).not.toHaveBeenCalled();
});
it("does not purchase when seats are empty", async () => {
createComponent();
enableAndFill(null, null);
await component["submit"]();
expect(billingClient.purchasePrivilegedControls).not.toHaveBeenCalled();
});
it("shows a toast, syncs, and emits after a successful purchase", async () => {
createComponent();
const emitted = jest.fn();
component.purchased.subscribe(emitted);
enableAndFill(15, null);
await component["submit"]();
expect(toastService.showToast).toHaveBeenCalledWith(
expect.objectContaining({ variant: "success", message: "privilegedControlsPurchased" }),
);
expect(syncService.fullSync).toHaveBeenCalledWith(true);
expect(emitted).toHaveBeenCalledTimes(1);
});
it("does not toast, sync, or emit when the purchase fails", async () => {
createComponent();
const emitted = jest.fn();
component.purchased.subscribe(emitted);
const error = new Error("Your card was declined.");
billingClient.purchasePrivilegedControls.mockRejectedValue(error);
enableAndFill(15, null);
await expect(component["submit"]()).rejects.toBe(error);
expect(toastService.showToast).not.toHaveBeenCalled();
expect(syncService.fullSync).not.toHaveBeenCalled();
expect(emitted).not.toHaveBeenCalled();
});
});
});

View File

@@ -0,0 +1,208 @@
import {
ChangeDetectionStrategy,
Component,
computed,
inject,
input,
OnInit,
output,
} from "@angular/core";
import { takeUntilDestroyed, toSignal } from "@angular/core/rxjs-interop";
import {
AbstractControl,
FormControl,
FormGroup,
ValidationErrors,
Validators,
} from "@angular/forms";
import { BillingCustomerDiscount } from "@bitwarden/common/billing/models/response/organization-subscription.response";
import { PlanResponse } from "@bitwarden/common/billing/models/response/plan.response";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { OrganizationId } from "@bitwarden/common/types/guid";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { AccordionComponent, ToastService } from "@bitwarden/components";
import { SharedModule } from "../../shared";
import { OrganizationBillingClient } from "../clients/organization-billing.client";
const MAX_PURCHASABLE_QUANTITY = 100000;
@Component({
selector: "billing-privileged-controls-purchase",
templateUrl: "privileged-controls-purchase.component.html",
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [SharedModule, AccordionComponent],
})
export class PrivilegedControlsPurchaseComponent implements OnInit {
private readonly organizationBillingClient = inject(OrganizationBillingClient);
private readonly syncService = inject(SyncService);
private readonly toastService = inject(ToastService);
private readonly i18nService = inject(I18nService);
readonly plan = input.required<PlanResponse>();
readonly organizationId = input.required<OrganizationId>();
readonly customerDiscount = input<BillingCustomerDiscount | null>(null);
readonly passwordManagerSeats = input.required<number>();
readonly passwordManagerMaxAutoscaleSeats = input<number | null>(null);
readonly purchased = output<void>();
protected readonly enabledControl = new FormControl(false, { nonNullable: true });
protected readonly enabled = toSignal(this.enabledControl.valueChanges, {
initialValue: this.enabledControl.value,
});
protected readonly limitSubscriptionControl = new FormControl(false, { nonNullable: true });
protected readonly limitSubscription = toSignal(this.limitSubscriptionControl.valueChanges, {
initialValue: this.limitSubscriptionControl.value,
});
protected readonly maxAutoscaleSeatsCap = computed(
() => this.passwordManagerMaxAutoscaleSeats() ?? this.passwordManagerSeats(),
);
protected readonly seatPrice = computed(() =>
this.discountPrice(this.plan().PrivilegedControls.seatPrice),
);
protected readonly monthlyCostPerSeat = computed(() =>
this.plan().isAnnual ? this.seatPrice() / 12 : this.seatPrice(),
);
protected readonly interval = computed(() => (this.plan().isAnnual ? "year" : "month"));
private readonly seatsControl = new FormControl<number | null>(null, [
Validators.required,
Validators.min(1),
Validators.max(MAX_PURCHASABLE_QUANTITY),
(control: AbstractControl) => this.validateWholeNumber(control),
(control: AbstractControl) => this.validateSeatsWithinPasswordManagerSeats(control),
]);
private readonly maxAutoscaleSeatsControl = new FormControl<number | null>(null, [
Validators.max(MAX_PURCHASABLE_QUANTITY),
(control: AbstractControl) => this.validateWholeNumber(control),
(control: AbstractControl) => this.validateMaxAutoscaleSeatsAboveSeats(control),
(control: AbstractControl) => this.validateMaxAutoscaleSeatsWithinCap(control),
]);
protected readonly formGroup = new FormGroup({
seats: this.seatsControl,
maxAutoscaleSeats: this.maxAutoscaleSeatsControl,
});
protected readonly seats = toSignal(this.seatsControl.valueChanges, {
initialValue: this.seatsControl.value,
});
protected readonly maxAutoscaleSeats = toSignal(this.maxAutoscaleSeatsControl.valueChanges, {
initialValue: this.maxAutoscaleSeatsControl.value,
});
protected readonly maxSeatTotal = computed(
() => (this.maxAutoscaleSeats() ?? 0) * this.seatPrice(),
);
constructor() {
this.seatsControl.valueChanges
.pipe(takeUntilDestroyed())
.subscribe(() => this.maxAutoscaleSeatsControl.updateValueAndValidity());
this.limitSubscriptionControl.valueChanges
.pipe(takeUntilDestroyed())
.subscribe((limitSubscription) => {
if (!limitSubscription) {
this.maxAutoscaleSeatsControl.setValue(null);
}
});
}
ngOnInit() {
// Set after inputs are bound, since the seats validators read the required passwordManagerSeats input.
this.seatsControl.setValue(1);
}
protected readonly submit = async () => {
this.formGroup.markAllAsTouched();
const { seats, maxAutoscaleSeats } = this.formGroup.getRawValue();
if (this.formGroup.invalid || seats == null) {
return;
}
await this.organizationBillingClient.purchasePrivilegedControls(this.organizationId(), {
seats,
maxAutoscaleSeats: maxAutoscaleSeats ?? null,
});
this.toastService.showToast({
variant: "success",
message: this.i18nService.t("privilegedControlsPurchased"),
});
await this.syncService.fullSync(true);
this.purchased.emit();
};
private discountPrice(price: number): number {
const discount = this.customerDiscount();
return discount?.active ? price - price * ((discount.percentOff ?? 0) / 100) : price;
}
private validateWholeNumber(control: AbstractControl): ValidationErrors | null {
if (control.value == null || Number.isInteger(control.value)) {
return null;
}
return { wholeNumber: { message: this.i18nService.t("integerInputError") } };
}
private validateSeatsWithinPasswordManagerSeats(
control: AbstractControl,
): ValidationErrors | null {
if (control.value == null) {
return null;
}
const passwordManagerSeats = this.passwordManagerSeats();
return control.value > passwordManagerSeats
? {
seatsAbovePasswordManagerSeats: {
message: this.i18nService.t(
"privilegedControlsSeatsAbovePasswordManagerSeats",
passwordManagerSeats,
),
},
}
: null;
}
private validateMaxAutoscaleSeatsAboveSeats(control: AbstractControl): ValidationErrors | null {
if (control.value == null || control.value > (this.seatsControl.value ?? 0)) {
return null;
}
return {
maxAutoscaleSeatsNotAboveSeats: {
message: this.i18nService.t("privilegedControlsSeatLimitNotAboveSeats"),
},
};
}
private validateMaxAutoscaleSeatsWithinCap(control: AbstractControl): ValidationErrors | null {
if (control.value == null) {
return null;
}
const cap = this.maxAutoscaleSeatsCap();
if (control.value <= cap) {
return null;
}
const messageKey =
this.passwordManagerMaxAutoscaleSeats() == null
? "privilegedControlsSeatLimitAbovePasswordManagerSeats"
: "privilegedControlsSeatLimitAbovePasswordManagerSeatLimit";
return {
maxAutoscaleSeatsAbovePasswordManager: { message: this.i18nService.t(messageKey, cap) },
};
}
}

View File

@@ -1,6 +1,11 @@
import { NgModule } from "@angular/core";
import { BannerModule, FileUploadComponent, SpinnerComponent } from "@bitwarden/components";
import {
AccordionComponent,
BannerModule,
FileUploadComponent,
SpinnerComponent,
} from "@bitwarden/components";
import { CartSummaryComponent, DiscountBadgeComponent } from "@bitwarden/pricing";
import { Vfo1I18nPipe } from "@bitwarden/vault";
import {
@@ -24,6 +29,7 @@ import { UpdateLicenseComponent } from "./update-license.component";
@NgModule({
imports: [
AccordionComponent,
BannerModule,
CartSummaryComponent,
DiscountBadgeComponent,

View File

@@ -1,17 +1,15 @@
<div *ngIf="formGroup && selectedPlan != null" [formGroup]="formGroup">
<h3 bitTypography="h3">{{ "moreFromBitwarden" | i18n }}</h3>
<div class="tw-rounded-t tw-bg-background-alt3 tw-p-5">
<div class="tw-w-72">
<bit-svg [content]="logo"></bit-svg>
</div>
</div>
<div
class="tw-rounded-b tw-border-x tw-border-b tw-border-t-0 tw-border-solid tw-border-secondary-300 tw-p-5"
<bit-accordion
[title]="'secretsManager' | i18n"
startIcon="bwi-bitwarden-shield"
height="auto"
[open]="true"
>
<h4 bitTypography="h4">{{ "secretsManagerForPlan" | i18n: planName }}</h4>
<div class="tw-text-muted">
{{ "secretsManagerForPlanDesc" | i18n }}
<ul>
<div class="tw-text-fg-body">
{{ "secretsManagerPurchaseDesc" | i18n }}
<p class="tw-mb-0 tw-mt-3 tw-font-medium tw-text-fg-heading">{{ "whatsIncluded" | i18n }}</p>
<ul class="tw-space-y-2">
<li *ngIf="product == productTypes.Free">{{ "limitedUsers" | i18n: maxUsers }}</li>
<li>{{ "unlimitedSecrets" | i18n }}</li>
<li *ngIf="product == productTypes.Free; else unlimitedProjects">
@@ -20,7 +18,7 @@
<ng-template #unlimitedProjects>
<li>{{ "unlimitedProjects" | i18n }}</li>
</ng-template>
<li>{{ "machineAccountsIncluded" | i18n: serviceAccountsIncluded }}</li>
<li>{{ "includedMachineAccountsV2" | i18n: serviceAccountsIncluded }}</li>
<li *ngIf="product != productTypes.Free">
{{
"additionalMachineAccountCost" | i18n: (monthlyCostPerServiceAccount | currency: "$")
@@ -29,9 +27,9 @@
</ul>
</div>
<div class="tw-mb-5">
<div class="tw-mb-5 tw-text-fg-body">
<span *ngIf="product != productTypes.Free; else freeForever">
{{ "costPerUser" | i18n: (monthlyCostPerUser | currency: "$") }} /{{ "month" | i18n }}
{{ "pricePerMember" | i18n: (monthlyCostPerUser | currency: "$") }} / {{ "month" | i18n }}
</span>
<ng-template #freeForever>
<span>{{ "freeForever" | i18n }}</span>
@@ -40,7 +38,7 @@
<bit-form-control>
<input type="checkbox" bitCheckbox formControlName="enabled" />
<bit-label>{{ "subscribeToSecretsManager" | i18n }}</bit-label>
<bit-label>{{ "addSecretsManager" | i18n }}</bit-label>
<bit-hint *ngIf="upgradeOrganization">{{ "addSecretsManagerUpgradeDesc" | i18n }}</bit-hint>
</bit-form-control>
@@ -69,5 +67,5 @@
{{ "save" | i18n }}
</button>
</ng-container>
</div>
</bit-accordion>
</div>

View File

@@ -1,17 +1,13 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { Component, Input, OnDestroy, OnInit, inject } from "@angular/core";
import { toSignal } from "@angular/core/rxjs-interop";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { Subject, startWith, takeUntil } from "rxjs";
import { ControlsOf } from "@bitwarden/angular/types/controls-of";
import { SecretsManagerAlt } from "@bitwarden/assets/svg";
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 { 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";
export interface SecretsManagerSubscription {
@@ -41,7 +37,6 @@ export const secretsManagerSubscribeFormFactory = (
})
export class SecretsManagerSubscribeComponent implements OnInit, OnDestroy {
private i18nService = inject(I18nService);
private configService = inject(ConfigService);
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@@ -59,16 +54,10 @@ export class SecretsManagerSubscribeComponent implements OnInit, OnDestroy {
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input() customerDiscount: BillingCustomerDiscount;
logo = SecretsManagerAlt;
productTypes = ProductTierType;
private destroy$ = new Subject<void>();
protected readonly vfo1Enabled = toSignal(
this.configService.getFeatureFlag$(FeatureFlag.VFO1Foundation),
{ initialValue: false },
);
ngOnInit() {
this.formGroup.controls.enabled.valueChanges
.pipe(startWith(this.formGroup.value.enabled), takeUntil(this.destroy$))
@@ -101,20 +90,6 @@ export class SecretsManagerSubscribeComponent implements OnInit, OnDestroy {
return this.selectedPlan.productTier;
}
get planName() {
switch (this.product) {
case ProductTierType.Free:
return this.vfo1Enabled()
? this.i18nService.t("freePlanWithSharedVault")
: this.i18nService.t("free2PersonOrganization");
case ProductTierType.Teams:
case ProductTierType.TeamsStarter:
return this.i18nService.t("planNameTeams");
case ProductTierType.Enterprise:
return this.i18nService.t("planNameEnterprise");
}
}
get serviceAccountsIncluded() {
return this.selectedPlan.SecretsManager.baseServiceAccount;
}

View File

@@ -13029,6 +13029,86 @@
"message": "Privileged Controls",
"description": "'Privileged Controls' is a product name and should not be translated."
},
"privilegedControlsPurchaseDesc": {
"message": "Quickly and easily protect your privileged and business-critical accounts with this add-on for Bitwarden Password Manager.",
"description": "'Bitwarden Password Manager' is a product name and should not be translated."
},
"privilegedControlsFeatureCredentialLeasing": {
"message": "Credential leasing"
},
"privilegedControlsFeatureAccessRules": {
"message": "Advanced access rules"
},
"privilegedControlsFeatureRotation": {
"message": "Automated password rotation"
},
"privilegedControlsFeatureAuditLog": {
"message": "Compliance-ready audit logs"
},
"privilegedControlsFeatureGovernanceDashboard": {
"message": "Governance dashboard"
},
"addPrivilegedControls": {
"message": "Add Privileged Controls",
"description": "'Privileged Controls' is a product name and should not be translated."
},
"seatLimit": {
"message": "Seat limit",
"description": "Upper limit of seats to allow through autoscaling"
},
"whatsIncluded": {
"message": "What's included"
},
"pricePerMember": {
"message": "$COST$ per member",
"placeholders": {
"cost": {
"content": "$1",
"example": "$10.00"
}
}
},
"privilegedControlsSeatsAbovePasswordManagerSeats": {
"message": "Seats can't be more than your Password Manager seats ($COUNT$).",
"description": "'Password Manager' is a product name and should not be translated.",
"placeholders": {
"count": {
"content": "$1",
"example": "50"
}
}
},
"privilegedControlsSeatLimitAbovePasswordManagerSeats": {
"message": "Seat limit can't be more than your Password Manager seats ($COUNT$).",
"description": "'Password Manager' is a product name and should not be translated.",
"placeholders": {
"count": {
"content": "$1",
"example": "50"
}
}
},
"privilegedControlsSeatLimitAbovePasswordManagerSeatLimit": {
"message": "Seat limit can't be more than your Password Manager seat limit ($COUNT$).",
"description": "'Password Manager' is a product name and should not be translated.",
"placeholders": {
"count": {
"content": "$1",
"example": "75"
}
}
},
"privilegedControlsSeatLimitDesc": {
"message": "Set a seat limit for your Privileged Controls subscription. Once this limit is reached, you won't be able to give more members access to Privileged Controls.",
"description": "'Privileged Controls' is a product name and should not be translated."
},
"privilegedControlsSeatLimitNotAboveSeats": {
"message": "Seat limit must be greater than the number of seats."
},
"privilegedControlsPurchased": {
"message": "Subscription updated. You now have Privileged Controls.",
"description": "'Privileged Controls' is a product name and should not be translated."
},
"privilegedControlsAccessDescription": {
"message": "Activate user access to Privileged Controls.",
"description": "'Privileged Controls' is a product name and should not be translated."
@@ -13780,23 +13860,8 @@
"inviteUsers": {
"message": "Invite Users"
},
"secretsManagerForPlan": {
"message": "Secrets Manager for $PLAN$",
"placeholders": {
"plan": {
"content": "$1",
"example": "Teams"
}
}
},
"secretsManagerForPlanDesc": {
"message": "For engineering and DevOps teams to manage secrets throughout the software development lifecycle."
},
"free2PersonOrganization": {
"message": "Free 2-person Organizations"
},
"freePlanWithSharedVault": {
"message": "Free plan with shared vault"
"secretsManagerPurchaseDesc": {
"message": "Enable your engineering and DevOps teams to centrally store, manage, and deploy secrets throughout the software development lifecycle."
},
"unlimitedSecrets": {
"message": "Unlimited secrets"
@@ -13831,8 +13896,9 @@
}
}
},
"subscribeToSecretsManager": {
"message": "Subscribe to Secrets Manager"
"addSecretsManager": {
"message": "Add Secrets Manager",
"description": "'Secrets Manager' is a product name and should not be translated."
},
"addSecretsManagerUpgradeDesc": {
"message": "Add Secrets Manager to your upgraded plan to maintain access to any secrets created with your previous plan."
@@ -14728,15 +14794,6 @@
"smAccessRemovalWarningMaMessage": {
"message": "This action will remove your access to the machine account."
},
"machineAccountsIncluded": {
"message": "$COUNT$ machine accounts included",
"placeholders": {
"count": {
"content": "$1",
"example": "3"
}
}
},
"additionalMachineAccountCost": {
"message": "$COST$ per month for additional machine accounts",
"placeholders": {

View File

@@ -94,7 +94,6 @@ export * from "./report-breach.icon";
export * from "./report-exposed-passwords.icon";
export * from "./report-unsecured-websites.icon";
export * from "./restricted-view";
export * from "./secrets-manager-alt";
export { default as SecretsManagerLogo } from "./secrets-manager";
export * from "./search-folder";
export * from "./security";

File diff suppressed because one or more lines are too long

View File

@@ -3,11 +3,19 @@ import { PlanResponse, PrivilegedControlsPlanFeaturesResponse } from "./plan.res
describe("PlanResponse", () => {
it("parses PrivilegedControls when present", () => {
const response = new PlanResponse({
PrivilegedControls: { SeatPrice: 5 },
PrivilegedControls: {
StripeSeatPlanId: "privileged-controls-enterprise-seat-annually",
SeatPrice: 5,
BaseSeats: 0,
},
});
expect(response.PrivilegedControls).toBeInstanceOf(PrivilegedControlsPlanFeaturesResponse);
expect(response.PrivilegedControls!.seatPrice).toBe(5);
expect(response.PrivilegedControls!.baseSeats).toBe(0);
expect(response.PrivilegedControls!.stripeSeatPlanId).toBe(
"privileged-controls-enterprise-seat-annually",
);
});
it("leaves PrivilegedControls null when absent", () => {