mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +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>
|
<bit-container>
|
||||||
<p>{{ "newOrganizationDesc" | i18n }}</p>
|
<p>{{ "newOrganizationDesc" | i18n }}</p>
|
||||||
<app-organization-plans></app-organization-plans>
|
<app-organization-plans
|
||||||
|
[enableSecretsManagerByDefault]="secretsManager"
|
||||||
|
[plan]="plan"
|
||||||
|
[productTier]="productTier"
|
||||||
|
></app-organization-plans>
|
||||||
</bit-container>
|
</bit-container>
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
// FIXME: Update this file to be type safe and remove this and next line
|
||||||
// @ts-strict-ignore
|
// @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 { ActivatedRoute } from "@angular/router";
|
||||||
import { first } from "rxjs/operators";
|
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 { OrganizationPlansComponent } from "../../billing";
|
||||||
import { HeaderModule } from "../../layouts/header/header.module";
|
import { HeaderModule } from "../../layouts/header/header.module";
|
||||||
@@ -15,29 +16,34 @@ import { SharedModule } from "../../shared";
|
|||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [SharedModule, OrganizationPlansComponent, HeaderModule],
|
imports: [SharedModule, OrganizationPlansComponent, HeaderModule],
|
||||||
})
|
})
|
||||||
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
export class CreateOrganizationComponent {
|
||||||
export class CreateOrganizationComponent implements OnInit {
|
protected secretsManager = false;
|
||||||
@ViewChild(OrganizationPlansComponent, { static: true })
|
protected plan: PlanType = PlanType.Free;
|
||||||
orgPlansComponent: OrganizationPlansComponent;
|
protected productTier: ProductTierType = ProductTierType.Free;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute) {}
|
constructor(private route: ActivatedRoute) {
|
||||||
|
this.route.queryParams.pipe(first(), takeUntilDestroyed()).subscribe((qParams) => {
|
||||||
ngOnInit() {
|
if (qParams.plan === "families" || qParams.productTier == ProductTierType.Families) {
|
||||||
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
|
this.plan = PlanType.FamiliesAnnually;
|
||||||
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
|
this.productTier = ProductTierType.Families;
|
||||||
if (qParams.plan === "families") {
|
} else if (qParams.plan === "teams" || qParams.productTier == ProductTierType.Teams) {
|
||||||
this.orgPlansComponent.plan = PlanType.FamiliesAnnually;
|
this.plan = PlanType.TeamsAnnually;
|
||||||
this.orgPlansComponent.productTier = ProductTierType.Families;
|
this.productTier = ProductTierType.Teams;
|
||||||
} else if (qParams.plan === "teams") {
|
} else if (
|
||||||
this.orgPlansComponent.plan = PlanType.TeamsAnnually;
|
qParams.plan === "teamsStarter" ||
|
||||||
this.orgPlansComponent.productTier = ProductTierType.Teams;
|
qParams.productTier == ProductTierType.TeamsStarter
|
||||||
} else if (qParams.plan === "teamsStarter") {
|
) {
|
||||||
this.orgPlansComponent.plan = PlanType.TeamsStarter;
|
this.plan = PlanType.TeamsStarter;
|
||||||
this.orgPlansComponent.productTier = ProductTierType.TeamsStarter;
|
this.productTier = ProductTierType.TeamsStarter;
|
||||||
} else if (qParams.plan === "enterprise") {
|
} else if (
|
||||||
this.orgPlansComponent.plan = PlanType.EnterpriseAnnually;
|
qParams.plan === "enterprise" ||
|
||||||
this.orgPlansComponent.productTier = ProductTierType.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._plan = plan;
|
||||||
this.formGroup?.controls?.plan?.setValue(plan);
|
this.formGroup?.controls?.plan?.setValue(plan);
|
||||||
}
|
}
|
||||||
|
@Input() enableSecretsManagerByDefault: boolean;
|
||||||
|
|
||||||
private _plan = PlanType.Free;
|
private _plan = PlanType.Free;
|
||||||
@Input() providerId?: string;
|
@Input() providerId?: string;
|
||||||
@@ -269,6 +270,14 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
|
|||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.refreshSalesTax();
|
this.refreshSalesTax();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.enableSecretsManagerByDefault && this.selectedSecretsManagerPlan) {
|
||||||
|
this.secretsManagerSubscription.patchValue({
|
||||||
|
enabled: true,
|
||||||
|
userSeats: 1,
|
||||||
|
additionalServiceAccounts: 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
|||||||
Reference in New Issue
Block a user