diff --git a/apps/web/src/app/accounts/trial-initiation/trial-initiation.component.spec.ts b/apps/web/src/app/accounts/trial-initiation/trial-initiation.component.spec.ts
index 9cfe933380..3dfabfe9f2 100644
--- a/apps/web/src/app/accounts/trial-initiation/trial-initiation.component.spec.ts
+++ b/apps/web/src/app/accounts/trial-initiation/trial-initiation.component.spec.ts
@@ -168,8 +168,9 @@ describe("TrialInitiationComponent", () => {
it("should set org variable to be enterprise and plan to EnterpriseAnnually if org param is enterprise", fakeAsync(() => {
mockQueryParams.next({ org: "enterprise" });
tick(); // wait for resolution
+ fixture = TestBed.createComponent(TrialInitiationComponent);
+ component = fixture.componentInstance;
fixture.detectChanges();
- component.ngOnInit();
expect(component.org).toBe("enterprise");
expect(component.plan).toBe(PlanType.EnterpriseAnnually);
}));
@@ -182,13 +183,33 @@ describe("TrialInitiationComponent", () => {
expect(component.org).toBe("");
expect(component.accountCreateOnly).toBe(true);
}));
- it("should set the org to be families and plan to FamiliesAnnually if org param is invalid ", fakeAsync(async () => {
+ it("should not set the org if org param is invalid ", fakeAsync(async () => {
mockQueryParams.next({ org: "hahahaha" });
tick(); // wait for resolution
+ fixture = TestBed.createComponent(TrialInitiationComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ expect(component.org).toBe("");
+ expect(component.accountCreateOnly).toBe(true);
+ }));
+ it("should set the layout variable if layout param is valid ", fakeAsync(async () => {
+ mockQueryParams.next({ layout: "teams1" });
+ tick(); // wait for resolution
+ fixture = TestBed.createComponent(TrialInitiationComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ expect(component.layout).toBe("teams1");
+ expect(component.accountCreateOnly).toBe(false);
+ }));
+ it("should not set the layout variable and leave as 'default' if layout param is invalid ", fakeAsync(async () => {
+ mockQueryParams.next({ layout: "asdfasdf" });
+ tick(); // wait for resolution
+ fixture = TestBed.createComponent(TrialInitiationComponent);
+ component = fixture.componentInstance;
fixture.detectChanges();
component.ngOnInit();
- expect(component.org).toBe("families");
- expect(component.plan).toBe(PlanType.FamiliesAnnually);
+ expect(component.layout).toBe("default");
+ expect(component.accountCreateOnly).toBe(true);
}));
});
diff --git a/apps/web/src/app/accounts/trial-initiation/trial-initiation.component.ts b/apps/web/src/app/accounts/trial-initiation/trial-initiation.component.ts
index f675fa6816..2f3f75a4a1 100644
--- a/apps/web/src/app/accounts/trial-initiation/trial-initiation.component.ts
+++ b/apps/web/src/app/accounts/trial-initiation/trial-initiation.component.ts
@@ -20,6 +20,30 @@ import { ReferenceEventRequest } from "@bitwarden/common/models/request/referenc
import { RouterService } from "./../../core/router.service";
import { VerticalStepperComponent } from "./vertical-stepper/vertical-stepper.component";
+enum ValidOrgParams {
+ families = "families",
+ enterprise = "enterprise",
+ teams = "teams",
+ individual = "individual",
+ premium = "premium",
+ free = "free",
+}
+
+enum ValidLayoutParams {
+ default = "default",
+ teams = "teams",
+ teams1 = "teams1",
+ teams2 = "teams2",
+ enterprise = "enterprise",
+ enterprise1 = "enterprise1",
+ enterprise2 = "enterprise2",
+ cnetcmpgnent = "cnetcmpgnent",
+ cnetcmpgnind = "cnetcmpgnind",
+ cnetcmpgnteams = "cnetcmpgnteams",
+ abmenterprise = "abmenterprise",
+ abmteams = "abmteams",
+}
+
@Component({
selector: "app-trial",
templateUrl: "trial-initiation.component.html",
@@ -35,9 +59,20 @@ export class TrialInitiationComponent implements OnInit, OnDestroy {
plan: PlanType;
product: ProductType;
accountCreateOnly = true;
+ useTrialStepper = false;
policies: Policy[];
enforcedPolicyOptions: MasterPasswordPolicyOptions;
- validOrgs: string[] = ["teams", "enterprise", "families"];
+ trialFlowOrgs: string[] = [
+ ValidOrgParams.teams,
+ ValidOrgParams.enterprise,
+ ValidOrgParams.families,
+ ];
+ routeFlowOrgs: string[] = [
+ ValidOrgParams.free,
+ ValidOrgParams.premium,
+ ValidOrgParams.individual,
+ ];
+ layouts = ValidLayoutParams;
referenceData: ReferenceEventRequest;
@ViewChild("stepper", { static: false }) verticalStepper: VerticalStepperComponent;
@@ -87,39 +122,38 @@ export class TrialInitiationComponent implements OnInit, OnDestroy {
this.referenceDataId = qParams.reference;
- if (!qParams.org) {
- return;
- }
-
- if (qParams.layout) {
+ if (Object.values(ValidLayoutParams).includes(qParams.layout)) {
this.layout = qParams.layout;
+ this.accountCreateOnly = false;
}
- if (this.validOrgs.includes(qParams.org)) {
+ if (this.trialFlowOrgs.includes(qParams.org)) {
this.org = qParams.org;
- } else {
- this.org = "families";
- }
+ this.orgLabel = this.titleCasePipe.transform(this.org);
+ this.useTrialStepper = true;
+ this.referenceData.flow = qParams.org;
- this.referenceData.flow = qParams.org;
+ if (this.org === ValidOrgParams.families) {
+ this.plan = PlanType.FamiliesAnnually;
+ this.product = ProductType.Families;
+ } else if (this.org === ValidOrgParams.teams) {
+ this.plan = PlanType.TeamsAnnually;
+ this.product = ProductType.Teams;
+ } else if (this.org === ValidOrgParams.enterprise) {
+ this.plan = PlanType.EnterpriseAnnually;
+ this.product = ProductType.Enterprise;
+ }
+ } else if (this.routeFlowOrgs.includes(qParams.org)) {
+ this.referenceData.flow = qParams.org;
+ const route = this.router.createUrlTree(["create-organization"], {
+ queryParams: { plan: qParams.org },
+ });
+ this.routerService.setPreviousUrl(route.toString());
+ }
// Are they coming from an email for sponsoring a families organization
// After logging in redirect them to setup the families sponsorship
this.setupFamilySponsorship(qParams.sponsorshipToken);
-
- this.orgLabel = this.titleCasePipe.transform(this.org);
- this.accountCreateOnly = false;
-
- if (this.org === "families") {
- this.plan = PlanType.FamiliesAnnually;
- this.product = ProductType.Families;
- } else if (this.org === "teams") {
- this.plan = PlanType.TeamsAnnually;
- this.product = ProductType.Teams;
- } else if (this.org === "enterprise") {
- this.plan = PlanType.EnterpriseAnnually;
- this.product = ProductType.Enterprise;
- }
});
const invite = await this.stateService.getOrganizationInvitation();
diff --git a/apps/web/src/app/oss-routing.module.ts b/apps/web/src/app/oss-routing.module.ts
index f77043a777..76b81f27ea 100644
--- a/apps/web/src/app/oss-routing.module.ts
+++ b/apps/web/src/app/oss-routing.module.ts
@@ -15,7 +15,6 @@ import { LoginWithDeviceComponent } from "./accounts/login/login-with-device.com
import { LoginComponent } from "./accounts/login/login.component";
import { RecoverDeleteComponent } from "./accounts/recover-delete.component";
import { RecoverTwoFactorComponent } from "./accounts/recover-two-factor.component";
-import { RegisterComponent } from "./accounts/register.component";
import { RemovePasswordComponent } from "./accounts/remove-password.component";
import { SetPasswordComponent } from "./accounts/set-password.component";
import { SsoComponent } from "./accounts/sso.component";
@@ -69,16 +68,15 @@ const routes: Routes = [
{ path: "2fa", component: TwoFactorComponent, canActivate: [UnauthGuard] },
{
path: "register",
- component: RegisterComponent,
+ component: TrialInitiationComponent,
canActivate: [UnauthGuard],
data: { titleId: "createAccount" },
},
- buildFlaggedRoute("showTrial", {
+ {
path: "trial",
- component: TrialInitiationComponent,
- canActivate: [UnauthGuard],
- data: { titleId: "startTrial" },
- }),
+ redirectTo: "register",
+ pathMatch: "full",
+ },
{
path: "sso",
component: SsoComponent,
diff --git a/apps/web/src/app/shared/loose-components.module.ts b/apps/web/src/app/shared/loose-components.module.ts
index cd9992bd79..9f57185e0d 100644
--- a/apps/web/src/app/shared/loose-components.module.ts
+++ b/apps/web/src/app/shared/loose-components.module.ts
@@ -7,7 +7,6 @@ import { LockComponent } from "../accounts/lock.component";
import { RecoverDeleteComponent } from "../accounts/recover-delete.component";
import { RecoverTwoFactorComponent } from "../accounts/recover-two-factor.component";
import { RegisterFormModule } from "../accounts/register-form/register-form.module";
-import { RegisterComponent } from "../accounts/register.component";
import { RemovePasswordComponent } from "../accounts/remove-password.component";
import { SetPasswordComponent } from "../accounts/set-password.component";
import { SsoComponent } from "../accounts/sso.component";
@@ -218,7 +217,6 @@ import { SharedModule } from ".";
PurgeVaultComponent,
RecoverDeleteComponent,
RecoverTwoFactorComponent,
- RegisterComponent,
RemovePasswordComponent,
SecurityComponent,
SecurityKeysComponent,
@@ -341,7 +339,6 @@ import { SharedModule } from ".";
PurgeVaultComponent,
RecoverDeleteComponent,
RecoverTwoFactorComponent,
- RegisterComponent,
RemovePasswordComponent,
SecurityComponent,
SecurityKeysComponent,
diff --git a/apps/web/src/utils/flags.ts b/apps/web/src/utils/flags.ts
index 03e4b2a9c9..601734ea5b 100644
--- a/apps/web/src/utils/flags.ts
+++ b/apps/web/src/utils/flags.ts
@@ -9,7 +9,6 @@ import {
// required to avoid linting errors when there are no flags
/* eslint-disable-next-line @typescript-eslint/ban-types */
export type Flags = {
- showTrial?: boolean;
secretsManager?: boolean;
showPasswordless?: boolean;
} & SharedFlags;