mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-11 10:10:25 +01:00
Added option to through queryParams pre select the desired upgrade option on the subscription page (#10145)
This commit is contained in:
parent
57b8c30664
commit
2ea2045686
@ -56,7 +56,7 @@ export class IsEnterpriseOrgGuard implements CanActivate {
|
||||
});
|
||||
if (upgradeConfirmed) {
|
||||
await this.router.navigate(["organizations", org.id, "billing", "subscription"], {
|
||||
queryParams: { upgrade: true },
|
||||
queryParams: { upgrade: true, productTierType: ProductTierType.Enterprise },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
[showCancel]="true"
|
||||
[organizationId]="organizationId"
|
||||
[currentPlan]="currentPlan"
|
||||
[preSelectedProductTier]="preSelectedProductTier"
|
||||
(onCanceled)="cancel()"
|
||||
>
|
||||
</app-organization-plans>
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
||||
|
||||
import { ProductTierType } from "@bitwarden/common/billing/enums";
|
||||
import { PlanResponse } from "@bitwarden/common/billing/models/response/plan.response";
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
|
||||
@ -10,6 +11,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
|
||||
export class ChangePlanComponent {
|
||||
@Input() organizationId: string;
|
||||
@Input() currentPlan: PlanResponse;
|
||||
@Input() preSelectedProductTier: ProductTierType;
|
||||
@Output() onChanged = new EventEmitter();
|
||||
@Output() onCanceled = new EventEmitter();
|
||||
|
||||
|
@ -95,6 +95,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
|
||||
|
||||
private _plan = PlanType.Free;
|
||||
@Input() providerId?: string;
|
||||
@Input() preSelectedProductTier?: ProductTierType;
|
||||
@Output() onSuccess = new EventEmitter<OnSuccessArgs>();
|
||||
@Output() onCanceled = new EventEmitter<void>();
|
||||
@Output() onTrialBillingSuccess = new EventEmitter();
|
||||
@ -209,6 +210,9 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
|
||||
this.singleOrgPolicyAppliesToActiveUser = policyAppliesToActiveUser;
|
||||
});
|
||||
|
||||
if (this.preSelectedProductTier != null && this.productTier < this.preSelectedProductTier) {
|
||||
this.productTier = this.preSelectedProductTier;
|
||||
}
|
||||
if (!this.selfHosted) {
|
||||
this.changedProduct();
|
||||
}
|
||||
|
@ -122,6 +122,7 @@
|
||||
<app-change-plan
|
||||
[organizationId]="organizationId"
|
||||
[currentPlan]="sub.plan"
|
||||
[preSelectedProductTier]="preSelectedProductTier"
|
||||
(onChanged)="closeChangePlan()"
|
||||
(onCanceled)="closeChangePlan()"
|
||||
*ngIf="showChangePlan"
|
||||
|
@ -52,6 +52,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
|
||||
manageBillingFromProviderPortal = ManageBilling;
|
||||
isProviderManaged = false;
|
||||
enableTimeThreshold: boolean;
|
||||
preSelectedProductTier: ProductTierType = ProductTierType.Free;
|
||||
|
||||
protected readonly teamsStarter = ProductTierType.TeamsStarter;
|
||||
|
||||
@ -83,6 +84,13 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
|
||||
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
this.changePlan();
|
||||
const productTierTypeStr = this.route.snapshot.queryParamMap.get("productTierType");
|
||||
if (productTierTypeStr != null) {
|
||||
const productTier = Number(productTierTypeStr);
|
||||
if (Object.values(ProductTierType).includes(productTier as ProductTierType)) {
|
||||
this.preSelectedProductTier = productTier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.route.params
|
||||
|
Loading…
Reference in New Issue
Block a user