mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
[PM-13620]Existing user email linking to create-organization (#13030)
* Changes for the existing users * Remove the complicated method * add the column after the patch value * Revert removal of plan query params * Resolve the non blocking issue
This commit is contained in:
@@ -2,5 +2,9 @@
|
||||
|
||||
<bit-container>
|
||||
<p>{{ "newOrganizationDesc" | i18n }}</p>
|
||||
<app-organization-plans></app-organization-plans>
|
||||
<app-organization-plans
|
||||
[enableSecretsManagerByDefault]="secretsManager"
|
||||
[plan]="plan"
|
||||
[productTier]="productTier"
|
||||
></app-organization-plans>
|
||||
</bit-container>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||
import { Component } from "@angular/core";
|
||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { first } from "rxjs/operators";
|
||||
|
||||
import { PlanType, ProductTierType } from "@bitwarden/common/billing/enums";
|
||||
import { PlanType, ProductTierType, ProductType } from "@bitwarden/common/billing/enums";
|
||||
|
||||
import { OrganizationPlansComponent } from "../../billing";
|
||||
import { HeaderModule } from "../../layouts/header/header.module";
|
||||
@@ -15,29 +16,34 @@ import { SharedModule } from "../../shared";
|
||||
standalone: true,
|
||||
imports: [SharedModule, OrganizationPlansComponent, HeaderModule],
|
||||
})
|
||||
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
||||
export class CreateOrganizationComponent implements OnInit {
|
||||
@ViewChild(OrganizationPlansComponent, { static: true })
|
||||
orgPlansComponent: OrganizationPlansComponent;
|
||||
export class CreateOrganizationComponent {
|
||||
protected secretsManager = false;
|
||||
protected plan: PlanType = PlanType.Free;
|
||||
protected productTier: ProductTierType = ProductTierType.Free;
|
||||
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
|
||||
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
|
||||
if (qParams.plan === "families") {
|
||||
this.orgPlansComponent.plan = PlanType.FamiliesAnnually;
|
||||
this.orgPlansComponent.productTier = ProductTierType.Families;
|
||||
} else if (qParams.plan === "teams") {
|
||||
this.orgPlansComponent.plan = PlanType.TeamsAnnually;
|
||||
this.orgPlansComponent.productTier = ProductTierType.Teams;
|
||||
} else if (qParams.plan === "teamsStarter") {
|
||||
this.orgPlansComponent.plan = PlanType.TeamsStarter;
|
||||
this.orgPlansComponent.productTier = ProductTierType.TeamsStarter;
|
||||
} else if (qParams.plan === "enterprise") {
|
||||
this.orgPlansComponent.plan = PlanType.EnterpriseAnnually;
|
||||
this.orgPlansComponent.productTier = ProductTierType.Enterprise;
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.queryParams.pipe(first(), takeUntilDestroyed()).subscribe((qParams) => {
|
||||
if (qParams.plan === "families" || qParams.productTier == ProductTierType.Families) {
|
||||
this.plan = PlanType.FamiliesAnnually;
|
||||
this.productTier = ProductTierType.Families;
|
||||
} else if (qParams.plan === "teams" || qParams.productTier == ProductTierType.Teams) {
|
||||
this.plan = PlanType.TeamsAnnually;
|
||||
this.productTier = ProductTierType.Teams;
|
||||
} else if (
|
||||
qParams.plan === "teamsStarter" ||
|
||||
qParams.productTier == ProductTierType.TeamsStarter
|
||||
) {
|
||||
this.plan = PlanType.TeamsStarter;
|
||||
this.productTier = ProductTierType.TeamsStarter;
|
||||
} else if (
|
||||
qParams.plan === "enterprise" ||
|
||||
qParams.productTier == ProductTierType.Enterprise
|
||||
) {
|
||||
this.plan = PlanType.EnterpriseAnnually;
|
||||
this.productTier = ProductTierType.Enterprise;
|
||||
}
|
||||
|
||||
this.secretsManager = qParams.product == ProductType.SecretsManager;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
|
||||
this._plan = plan;
|
||||
this.formGroup?.controls?.plan?.setValue(plan);
|
||||
}
|
||||
@Input() enableSecretsManagerByDefault: boolean;
|
||||
|
||||
private _plan = PlanType.Free;
|
||||
@Input() providerId?: string;
|
||||
@@ -269,6 +270,14 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
|
||||
.subscribe(() => {
|
||||
this.refreshSalesTax();
|
||||
});
|
||||
|
||||
if (this.enableSecretsManagerByDefault && this.selectedSecretsManagerPlan) {
|
||||
this.secretsManagerSubscription.patchValue({
|
||||
enabled: true,
|
||||
userSeats: 1,
|
||||
additionalServiceAccounts: 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
||||
Reference in New Issue
Block a user