1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 22:33:35 +00: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
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 { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { PolicyService } from "@bitwarden/common/abstractions/policy.service"; import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
import { SyncService } from "@bitwarden/common/abstractions/sync.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"; import { OrganizationPlansComponent } from "src/app/settings/organization-plans.component";
@@ -51,10 +52,11 @@ export class BillingComponent extends OrganizationPlansComponent {
} }
async ngOnInit() { async ngOnInit() {
const additionalSeats = this.product == ProductType.Families ? 0 : 1;
this.formGroup.patchValue({ this.formGroup.patchValue({
name: this.orgInfoForm.get("name")?.value, name: this.orgInfoForm.get("name")?.value,
billingEmail: this.orgInfoForm.get("email")?.value, billingEmail: this.orgInfoForm.get("email")?.value,
additionalSeats: 1, additionalSeats: additionalSeats,
plan: this.plan, plan: this.plan,
product: this.product, product: this.product,
}); });

View File

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

View File

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