From 8f437dc77316dca31f16b2458916b2595ecc179d Mon Sep 17 00:00:00 2001 From: Nick Krantz <125900171+nick-livefront@users.noreply.github.com> Date: Tue, 30 Jul 2024 07:11:40 -0500 Subject: [PATCH] [PM-1655] Trial Registration Layout (#9091) * add messaging for finish sign up component * Add product enum for finish sign up components * Allow confirmation details component to display secret manager confirmation * add FinishSignUp component - Started as exact copy of trial initiation component - Consolidated with secrets manager trial components * Integration finish sign up component into routing - Use anon layout component - Add resolver to pass the accurate title to the layout * migrate to product tier type * use existing ProductType enum * migrate to accept org service * fix query param parsing for free trial text * migrate finish sign up to complete trial naming * migrate fully to productTier * fix import of free trial resolver * increase max width of anon layout * add auth-input component * refactor component makeup * export the users password if needed to auto login the user * handle login situations where a stepper isn't used * fix type check * allow max width of anon layout to be configurable * remove account created toast * update productTier query param in text resolver * set maxWidth for secrets manager trial route * parse product query param as an int * properly show registration error * update routes to be from the root rather than relative * install updated prettier and apply fixes * fix missing password in test --------- Co-authored-by: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com> --- .../web-registration-finish.service.spec.ts | 1 + .../complete-trial-initiation.component.html | 80 +++++ .../complete-trial-initiation.component.ts | 318 ++++++++++++++++++ .../resolver/free-trial-text.resolver.spec.ts | 58 ++++ .../resolver/free-trial-text.resolver.ts | 43 +++ .../confirmation-details.component.html | 7 +- .../confirmation-details.component.ts | 5 + .../trial-initiation.module.ts | 6 +- apps/web/src/app/oss-routing.module.ts | 24 ++ apps/web/src/locales/en/messages.json | 45 +++ .../anon-layout-wrapper.component.html | 1 + .../anon-layout-wrapper.component.ts | 3 + .../anon-layout/anon-layout.component.html | 1 + .../anon-layout/anon-layout.component.ts | 7 + .../input-password.component.ts | 1 + .../input-password/password-input-result.ts | 1 + ...efault-registration-finish.service.spec.ts | 1 + .../default-set-password-jit.service.spec.ts | 1 + libs/common/src/billing/enums/index.ts | 1 + 19 files changed, 602 insertions(+), 2 deletions(-) create mode 100644 apps/web/src/app/auth/trial-initiation/complete-trial-initiation/complete-trial-initiation.component.html create mode 100644 apps/web/src/app/auth/trial-initiation/complete-trial-initiation/complete-trial-initiation.component.ts create mode 100644 apps/web/src/app/auth/trial-initiation/complete-trial-initiation/resolver/free-trial-text.resolver.spec.ts create mode 100644 apps/web/src/app/auth/trial-initiation/complete-trial-initiation/resolver/free-trial-text.resolver.ts diff --git a/apps/web/src/app/auth/core/services/registration/web-registration-finish.service.spec.ts b/apps/web/src/app/auth/core/services/registration/web-registration-finish.service.spec.ts index 007165a1bc..2faf3f85d1 100644 --- a/apps/web/src/app/auth/core/services/registration/web-registration-finish.service.spec.ts +++ b/apps/web/src/app/auth/core/services/registration/web-registration-finish.service.spec.ts @@ -148,6 +148,7 @@ describe("DefaultRegistrationFinishService", () => { localMasterKeyHash: "localMasterKeyHash", kdfConfig: DEFAULT_KDF_CONFIG, hint: "hint", + password: "password", }; userKey = new SymmetricCryptoKey(new Uint8Array(64).buffer as CsprngArray) as UserKey; diff --git a/apps/web/src/app/auth/trial-initiation/complete-trial-initiation/complete-trial-initiation.component.html b/apps/web/src/app/auth/trial-initiation/complete-trial-initiation/complete-trial-initiation.component.html new file mode 100644 index 0000000000..9400e512c3 --- /dev/null +++ b/apps/web/src/app/auth/trial-initiation/complete-trial-initiation/complete-trial-initiation.component.html @@ -0,0 +1,80 @@ +
{{ "trialThankYou" | i18n: orgLabel }}
++ {{ "trialThankYou" | i18n: orgLabel }} +
++ {{ "smFreeTrialThankYou" | i18n }} +
diff --git a/apps/web/src/app/auth/trial-initiation/confirmation-details.component.ts b/apps/web/src/app/auth/trial-initiation/confirmation-details.component.ts
index 95976fe727..69d08e627a 100644
--- a/apps/web/src/app/auth/trial-initiation/confirmation-details.component.ts
+++ b/apps/web/src/app/auth/trial-initiation/confirmation-details.component.ts
@@ -1,5 +1,7 @@
import { Component, Input } from "@angular/core";
+import { ProductType } from "@bitwarden/common/billing/enums";
+
@Component({
selector: "app-trial-confirmation-details",
templateUrl: "confirmation-details.component.html",
@@ -7,4 +9,7 @@ import { Component, Input } from "@angular/core";
export class ConfirmationDetailsComponent {
@Input() email: string;
@Input() orgLabel: string;
+ @Input() product?: ProductType = ProductType.PasswordManager;
+
+ protected readonly Product = ProductType;
}
diff --git a/apps/web/src/app/auth/trial-initiation/trial-initiation.module.ts b/apps/web/src/app/auth/trial-initiation/trial-initiation.module.ts
index 57d982fd00..9a7ed7e429 100644
--- a/apps/web/src/app/auth/trial-initiation/trial-initiation.module.ts
+++ b/apps/web/src/app/auth/trial-initiation/trial-initiation.module.ts
@@ -2,6 +2,7 @@ import { CdkStepperModule } from "@angular/cdk/stepper";
import { TitleCasePipe } from "@angular/common";
import { NgModule } from "@angular/core";
+import { InputPasswordComponent } from "@bitwarden/auth/angular";
import { FormFieldModule } from "@bitwarden/components";
import { OrganizationCreateModule } from "../../admin-console/organizations/create/organization-create.module";
@@ -14,6 +15,7 @@ import { TrialBillingStepComponent } from "../../billing/accounts/trial-initiati
import { EnvironmentSelectorModule } from "../../components/environment-selector/environment-selector.module";
import { SharedModule } from "../../shared";
+import { CompleteTrialInitiationComponent } from "./complete-trial-initiation/complete-trial-initiation.component";
import { ConfirmationDetailsComponent } from "./confirmation-details.component";
import { AbmEnterpriseContentComponent } from "./content/abm-enterprise-content.component";
import { AbmTeamsContentComponent } from "./content/abm-teams-content.component";
@@ -51,9 +53,11 @@ import { VerticalStepperModule } from "./vertical-stepper/vertical-stepper.modul
PaymentComponent,
TaxInfoComponent,
TrialBillingStepComponent,
+ InputPasswordComponent,
],
declarations: [
TrialInitiationComponent,
+ CompleteTrialInitiationComponent,
EnterpriseContentComponent,
TeamsContentComponent,
ConfirmationDetailsComponent,
@@ -82,7 +86,7 @@ import { VerticalStepperModule } from "./vertical-stepper/vertical-stepper.modul
SecretsManagerTrialFreeStepperComponent,
SecretsManagerTrialPaidStepperComponent,
],
- exports: [TrialInitiationComponent],
+ exports: [TrialInitiationComponent, CompleteTrialInitiationComponent],
providers: [TitleCasePipe],
})
export class TrialInitiationModule {}
diff --git a/apps/web/src/app/oss-routing.module.ts b/apps/web/src/app/oss-routing.module.ts
index 65414317cb..32dcb695a8 100644
--- a/apps/web/src/app/oss-routing.module.ts
+++ b/apps/web/src/app/oss-routing.module.ts
@@ -47,6 +47,8 @@ import { EmergencyAccessComponent } from "./auth/settings/emergency-access/emerg
import { EmergencyAccessViewComponent } from "./auth/settings/emergency-access/view/emergency-access-view.component";
import { SecurityRoutingModule } from "./auth/settings/security/security-routing.module";
import { SsoComponent } from "./auth/sso.component";
+import { CompleteTrialInitiationComponent } from "./auth/trial-initiation/complete-trial-initiation/complete-trial-initiation.component";
+import { freeTrialTextResolver } from "./auth/trial-initiation/complete-trial-initiation/resolver/free-trial-text.resolver";
import { TrialInitiationComponent } from "./auth/trial-initiation/trial-initiation.component";
import { TwoFactorAuthComponent } from "./auth/two-factor-auth.component";
import { TwoFactorComponent } from "./auth/two-factor.component";
@@ -400,6 +402,28 @@ const routes: Routes = [
titleId: "removeMasterPassword",
} satisfies DataProperties & AnonLayoutWrapperData,
},
+ {
+ path: "trial-initiation",
+ canActivate: [canAccessFeature(FeatureFlag.EmailVerification), unauthGuardFn()],
+ component: CompleteTrialInitiationComponent,
+ resolve: {
+ pageTitle: freeTrialTextResolver,
+ },
+ data: {
+ maxWidth: "3xl",
+ } satisfies AnonLayoutWrapperData,
+ },
+ {
+ path: "secrets-manager-trial-initiation",
+ canActivate: [canAccessFeature(FeatureFlag.EmailVerification), unauthGuardFn()],
+ component: CompleteTrialInitiationComponent,
+ resolve: {
+ pageTitle: freeTrialTextResolver,
+ },
+ data: {
+ maxWidth: "3xl",
+ } satisfies AnonLayoutWrapperData,
+ },
],
},
{
diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json
index 2aed43787e..2be00bb889 100644
--- a/apps/web/src/locales/en/messages.json
+++ b/apps/web/src/locales/en/messages.json
@@ -8414,6 +8414,51 @@
"manageBillingFromProviderPortalMessage": {
"message": "Manage billing from the Provider Portal"
},
+ "startYour7DayFreeTrialOfBitwarden": {
+ "message": "Start your 7-Day free trial of Bitwarden"
+ },
+ "startYour7DayFreeTrialOfBitwardenForTeams": {
+ "message": "Start your 7-Day free trial of Bitwarden for Teams"
+ },
+ "startYour7DayFreeTrialOfBitwardenForFamilies": {
+ "message": "Start your 7-Day free trial of Bitwarden for Families"
+ },
+ "startYour7DayFreeTrialOfBitwardenForEnterprise": {
+ "message": "Start your 7-Day free trial of Bitwarden for Enterprise"
+ },
+ "startYour7DayFreeTrialOfBitwardenSecretsManager": {
+ "message": "Start your 7-Day free trial of Bitwarden Secrets Manager"
+ },
+ "startYour7DayFreeTrialOfBitwardenSecretsManagerForTeams": {
+ "message": "Start your 7-Day free trial of Bitwarden Secrets Manager for Teams"
+ },
+ "startYour7DayFreeTrialOfBitwardenSecretsManagerForFamilies": {
+ "message": "Start your 7-Day free trial of Bitwarden Secrets Manager for Families"
+ },
+ "startYour7DayFreeTrialOfBitwardenSecretsManagerForEnterprise": {
+ "message": "Start your 7-Day free trial of Bitwarden Secrets Manager for Enterprise"
+ },
+ "startYour7DayFreeTrialOfBitwardenPasswordManager": {
+ "message": "Start your 7-Day free trial of Bitwarden Password Manager"
+ },
+ "startYour7DayFreeTrialOfBitwardenPasswordManagerForTeams": {
+ "message": "Start your 7-Day free trial of Bitwarden Password Manager for Teams"
+ },
+ "startYour7DayFreeTrialOfBitwardenPasswordManagerForFamilies": {
+ "message": "Start your 7-Day free trial of Bitwarden Password Manager for Families"
+ },
+ "startYour7DayFreeTrialOfBitwardenPasswordManagerForEnterprise": {
+ "message": "Start your 7-Day free trial of Bitwarden Password Manager for Enterprise"
+ },
+ "enterTeamsOrgInfo": {
+ "message": "Enter your Teams organization information"
+ },
+ "enterFamiliesOrgInfo": {
+ "message": "Enter your Families organization information"
+ },
+ "enterEnterpriseOrgInfo": {
+ "message": "Enter your Enterprise organization information"
+ },
"viewItemsIn": {
"message": "View items in $NAME$",
"description": "Button to view the contents of a folder or collection",
diff --git a/libs/auth/src/angular/anon-layout/anon-layout-wrapper.component.html b/libs/auth/src/angular/anon-layout/anon-layout-wrapper.component.html
index 6d5fc9b8da..cfd436d93a 100644
--- a/libs/auth/src/angular/anon-layout/anon-layout-wrapper.component.html
+++ b/libs/auth/src/angular/anon-layout/anon-layout-wrapper.component.html
@@ -3,6 +3,7 @@
[subtitle]="pageSubtitle"
[icon]="pageIcon"
[showReadonlyHostname]="showReadonlyHostname"
+ [maxWidth]="maxWidth"
>