mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
[AC-1418] Add secrets manager manage subscription component (#5661)
* [AC-1423] Add minWidth input to bit-progress component * [AC-1423] Add ProgressModule to shared.module.ts * [AC-1423] Update cloud subscription page styles - Remove bootstrap styles - Use CL components where applicable - Use CL typography directives - Update heading levels to prepare for new SM sections * [AC-1423] Add usePasswordManager boolean to organization domain * [AC-1423] Introduce BitwardenProductType enum * [AC-1423] Update Organization subscription line items - Add product type prefix - Indent addon services like additional storage and service accounts - Show line items for free plans * [AC-1423] Simply sort function * [AC-1423] Remove header border * [AC-1423] Remove redundant condition * [AC-1423] Remove ineffective div * [AC-1423] Make "Password Manager" the default fallback for product name * Revert "[AC-1423] Add minWidth input to bit-progress component" This reverts commit95b2223a30. * [AC-1423] Remove minWidth attribute * [AC-1423] Switch to AddonProductType enum instead of boolean * Revert "[AC-1423] Switch to AddonProductType enum instead of boolean" This reverts commit204f64b4e7. * [AC-1423] Tweak sorting comment * [AC-1418] Add initial SecretsManagerAdjustSubscription component * [AC-1418] Add initial SM adjustment form * [AC-1418] Adjust organization-subscription-update.request.ts to support both PM and SM * [AC-1418] Rename service account fields in the options interface * [AC-1418] Add api service call to update SM subscription * [AC-1418] Cleanup form html * [AC-1418] Add missing SM plan properties * [AC-1418] Add SM subscription adjust form and logic to hide it * [AC-1418] Add better docs to options interface * [AC-1418] Fix conflicting required/optional labels for auto-scaling limits * [AC-1418] Adjust labels and appearance to better match design * [AC-1418] Use the SM plan for billing interval * [AC-1418] Hide SM billing adjustment component behind feature flag * [AC-1418] Update request model to match server * [AC-1418] Cleanup BitwardenProductType after merge Add to barrel file and update applicable imports. * [AC-1418] Revert change to update PM subscription request model * [AC-1418] Add new update SM subscription request model * [AC-1418] Add new service method to update SM subscription * [AC-1418] Use new model and service method * [AC-1418] Cleanup SM subscription UI flags * [AC-1418] Move SM adjust subscription component into SM billing module * [AC-1418] Update SM seat count minimum to 1 * [AC-1418] Add missing currency codes * [AC-1418] Simplify monthly price calculation * [AC-1418] Increase PM adjust subscription form input width * [AC-1418] Add check for null subscription --------- Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import { OrganizationSsoRequest } from "../../../auth/models/request/organizatio
|
||||
import { SecretVerificationRequest } from "../../../auth/models/request/secret-verification.request";
|
||||
import { ApiKeyResponse } from "../../../auth/models/response/api-key.response";
|
||||
import { OrganizationSsoResponse } from "../../../auth/models/response/organization-sso.response";
|
||||
import { OrganizationSmSubscriptionUpdateRequest } from "../../../billing/models/request/organization-sm-subscription-update.request";
|
||||
import { OrganizationSubscriptionUpdateRequest } from "../../../billing/models/request/organization-subscription-update.request";
|
||||
import { OrganizationTaxInfoUpdateRequest } from "../../../billing/models/request/organization-tax-info-update.request";
|
||||
import { PaymentRequest } from "../../../billing/models/request/payment.request";
|
||||
@@ -41,6 +42,10 @@ export class OrganizationApiServiceAbstraction {
|
||||
id: string,
|
||||
request: OrganizationSubscriptionUpdateRequest
|
||||
) => Promise<void>;
|
||||
updateSecretsManagerSubscription: (
|
||||
id: string,
|
||||
request: OrganizationSmSubscriptionUpdateRequest
|
||||
) => Promise<void>;
|
||||
updateSeats: (id: string, request: SeatRequest) => Promise<PaymentResponse>;
|
||||
updateStorage: (id: string, request: StorageRequest) => Promise<PaymentResponse>;
|
||||
verifyBank: (id: string, request: VerifyBankRequest) => Promise<void>;
|
||||
|
||||
@@ -28,6 +28,11 @@ export class OrganizationResponse extends BaseResponse {
|
||||
useResetPassword: boolean;
|
||||
useSecretsManager: boolean;
|
||||
hasPublicAndPrivateKeys: boolean;
|
||||
usePasswordManager: boolean;
|
||||
smSeats?: number;
|
||||
smServiceAccounts?: number;
|
||||
maxAutoscaleSmSeats?: number;
|
||||
maxAutoscaleSmServiceAccounts?: number;
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
@@ -62,5 +67,10 @@ export class OrganizationResponse extends BaseResponse {
|
||||
this.useResetPassword = this.getResponseProperty("UseResetPassword");
|
||||
this.useSecretsManager = this.getResponseProperty("UseSecretsManager");
|
||||
this.hasPublicAndPrivateKeys = this.getResponseProperty("HasPublicAndPrivateKeys");
|
||||
this.usePasswordManager = this.getResponseProperty("UsePasswordManager");
|
||||
this.smSeats = this.getResponseProperty("SmSeats");
|
||||
this.smServiceAccounts = this.getResponseProperty("SmServiceAccounts");
|
||||
this.maxAutoscaleSmSeats = this.getResponseProperty("MaxAutoscaleSmSeats");
|
||||
this.maxAutoscaleSmServiceAccounts = this.getResponseProperty("MaxAutoscaleSmServiceAccounts");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { OrganizationSsoRequest } from "../../../auth/models/request/organizatio
|
||||
import { SecretVerificationRequest } from "../../../auth/models/request/secret-verification.request";
|
||||
import { ApiKeyResponse } from "../../../auth/models/response/api-key.response";
|
||||
import { OrganizationSsoResponse } from "../../../auth/models/response/organization-sso.response";
|
||||
import { OrganizationSmSubscriptionUpdateRequest } from "../../../billing/models/request/organization-sm-subscription-update.request";
|
||||
import { OrganizationSubscriptionUpdateRequest } from "../../../billing/models/request/organization-subscription-update.request";
|
||||
import { OrganizationTaxInfoUpdateRequest } from "../../../billing/models/request/organization-tax-info-update.request";
|
||||
import { PaymentRequest } from "../../../billing/models/request/payment.request";
|
||||
@@ -133,6 +134,19 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
);
|
||||
}
|
||||
|
||||
async updateSecretsManagerSubscription(
|
||||
id: string,
|
||||
request: OrganizationSmSubscriptionUpdateRequest
|
||||
): Promise<void> {
|
||||
return this.apiService.send(
|
||||
"POST",
|
||||
"/organizations/" + id + "/sm-subscription",
|
||||
request,
|
||||
true,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
async updateSeats(id: string, request: SeatRequest): Promise<PaymentResponse> {
|
||||
const r = await this.apiService.send(
|
||||
"POST",
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
export enum BitwardenProductType {
|
||||
PasswordManager = 0,
|
||||
SecretsManager = 1,
|
||||
}
|
||||
@@ -2,3 +2,4 @@ export * from "./payment-method-type.enum";
|
||||
export * from "./plan-sponsorship-type.enum";
|
||||
export * from "./plan-type.enum";
|
||||
export * from "./transaction-type.enum";
|
||||
export * from "./bitwarden-product-type.enum";
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
export class OrganizationSmSubscriptionUpdateRequest {
|
||||
/**
|
||||
* The number of seats to add or remove from the subscription.
|
||||
*/
|
||||
seatAdjustment: number;
|
||||
|
||||
/**
|
||||
* The maximum number of seats that can be auto-scaled for the subscription.
|
||||
*/
|
||||
maxAutoscaleSeats?: number;
|
||||
|
||||
/**
|
||||
* The number of additional service accounts to add or remove from the subscription.
|
||||
*/
|
||||
serviceAccountAdjustment: number;
|
||||
|
||||
/**
|
||||
* The maximum number of additional service accounts that can be auto-scaled for the subscription.
|
||||
*/
|
||||
maxAutoscaleServiceAccounts?: number;
|
||||
|
||||
/**
|
||||
* Build a subscription update request for the Secrets Manager product type.
|
||||
* @param seatAdjustment - The number of seats to add or remove from the subscription.
|
||||
* @param serviceAccountAdjustment - The number of additional service accounts to add or remove from the subscription.
|
||||
* @param maxAutoscaleSeats - The maximum number of seats that can be auto-scaled for the subscription.
|
||||
* @param maxAutoscaleServiceAccounts - The maximum number of additional service accounts that can be auto-scaled for the subscription.
|
||||
*/
|
||||
constructor(
|
||||
seatAdjustment: number,
|
||||
serviceAccountAdjustment: number,
|
||||
maxAutoscaleSeats?: number,
|
||||
maxAutoscaleServiceAccounts?: number
|
||||
) {
|
||||
this.seatAdjustment = seatAdjustment;
|
||||
this.serviceAccountAdjustment = serviceAccountAdjustment;
|
||||
this.maxAutoscaleSeats = maxAutoscaleSeats;
|
||||
this.maxAutoscaleServiceAccounts = maxAutoscaleServiceAccounts;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,23 @@
|
||||
export class OrganizationSubscriptionUpdateRequest {
|
||||
constructor(public seatAdjustment: number, public maxAutoscaleSeats?: number) {}
|
||||
/**
|
||||
* The number of seats to add or remove from the subscription.
|
||||
* Applies to both PM and SM request types.
|
||||
*/
|
||||
seatAdjustment: number;
|
||||
|
||||
/**
|
||||
* The maximum number of seats that can be auto-scaled for the subscription.
|
||||
* Applies to both PM and SM request types.
|
||||
*/
|
||||
maxAutoscaleSeats?: number;
|
||||
|
||||
/**
|
||||
* Build a subscription update request for the Password Manager product type.
|
||||
* @param seatAdjustment - The number of seats to add or remove from the subscription.
|
||||
* @param maxAutoscaleSeats - The maximum number of seats that can be auto-scaled for the subscription.
|
||||
*/
|
||||
constructor(seatAdjustment: number, maxAutoscaleSeats?: number) {
|
||||
this.seatAdjustment = seatAdjustment;
|
||||
this.maxAutoscaleSeats = maxAutoscaleSeats;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { ProductType } from "../../../enums";
|
||||
import { BaseResponse } from "../../../models/response/base.response";
|
||||
import { PlanType } from "../../enums";
|
||||
import { BitwardenProductType } from "../../enums/bitwarden-product-type";
|
||||
import { BitwardenProductType, PlanType } from "../../enums";
|
||||
|
||||
export class PlanResponse extends BaseResponse {
|
||||
type: PlanType;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { BaseResponse } from "../../../models/response/base.response";
|
||||
import { BitwardenProductType } from "../../enums/bitwarden-product-type.enum";
|
||||
import { BitwardenProductType } from "../../enums";
|
||||
|
||||
export class SubscriptionResponse extends BaseResponse {
|
||||
storageName: string;
|
||||
|
||||
Reference in New Issue
Block a user