1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-01 04:37:40 +02:00

[SG-485] and [SG-486] Trial Initiation routing and bug fixes

This commit is contained in:
Robyn MacCallum 2022-07-25 14:44:51 -04:00 committed by GitHub
parent 296fb6deb9
commit 1f599b499e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 6 deletions

View File

@ -11,6 +11,7 @@ import { OrganizationService } from "@bitwarden/common/abstractions/organization
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
import { ProductType } from "@bitwarden/common/enums/productType";
import { OrganizationPlansComponent } from "src/app/settings/organization-plans.component";
@ -51,10 +52,11 @@ export class BillingComponent extends OrganizationPlansComponent {
}
async ngOnInit() {
const additionalSeats = this.product == ProductType.Families ? 0 : 1;
this.formGroup.patchValue({
name: this.orgInfoForm.get("name")?.value,
billingEmail: this.orgInfoForm.get("email")?.value,
additionalSeats: 1,
additionalSeats: additionalSeats,
plan: this.plan,
product: this.product,
});

View File

@ -34,6 +34,7 @@ export class TrialInitiationComponent implements OnInit {
accountCreateOnly = true;
policies: Policy[];
enforcedPolicyOptions: MasterPasswordPolicyOptions;
validOrgs: string[] = ["teams", "enterprise", "families"];
@ViewChild("stepper", { static: false }) verticalStepper: VerticalStepperComponent;
orgInfoFormGroup = this.formBuilder.group({
@ -63,17 +64,22 @@ export class TrialInitiationComponent implements OnInit {
return;
}
this.org = qParams.org;
if (this.validOrgs.includes(qParams.org)) {
this.org = qParams.org;
} else {
this.org = "families";
}
this.orgLabel = this.titleCasePipe.transform(this.org);
this.accountCreateOnly = false;
if (qParams.org === "families") {
if (this.org === "families") {
this.plan = PlanType.FamiliesAnnually;
this.product = ProductType.Families;
} else if (qParams.org === "teams") {
} else if (this.org === "teams") {
this.plan = PlanType.TeamsAnnually;
this.product = ProductType.Teams;
} else if (qParams.org === "enterprise") {
} else if (this.org === "enterprise") {
this.plan = PlanType.EnterpriseAnnually;
this.product = ProductType.Enterprise;
}

View File

@ -63,10 +63,16 @@ const routes: Routes = [
{ path: "2fa", component: TwoFactorComponent, canActivate: [UnauthGuard] },
{
path: "register",
component: flagEnabled("showTrial") ? TrialInitiationComponent : RegisterComponent,
component: RegisterComponent,
canActivate: [UnauthGuard],
data: { titleId: "createAccount" },
},
buildFlaggedRoute("showTrial", {
path: "trial",
component: TrialInitiationComponent,
canActivate: [UnauthGuard],
data: { titleId: "startTrial" },
}),
{
path: "sso",
component: SsoComponent,