Skip to content

Commit fb01153

Browse files
Pivot trial initiation copy based on trial length (#14635)
1 parent 360e731 commit fb01153

9 files changed

+64
-8
lines changed

apps/web/src/app/billing/accounts/trial-initiation/trial-billing-step.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ <h2 class="tw-mb-3 tw-text-base tw-font-semibold">{{ "paymentType" | i18n }}</h2
5656
</div>
5757
<div class="tw-flex tw-space-x-2">
5858
<button type="submit" buttonType="primary" bitButton [loading]="form.loading">
59-
{{ "startTrial" | i18n }}
59+
{{ (trialLength > 0 ? "startTrial" : "submit") | i18n }}
6060
</button>
6161
<button bitButton type="button" buttonType="secondary" (click)="stepBack()">Back</button>
6262
</div>

apps/web/src/app/billing/accounts/trial-initiation/trial-billing-step.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export class TrialBillingStepComponent implements OnInit {
5555
@ViewChild(ManageTaxInformationComponent) taxInfoComponent: ManageTaxInformationComponent;
5656
@Input() organizationInfo: OrganizationInfo;
5757
@Input() subscriptionProduct: SubscriptionProduct = SubscriptionProduct.PasswordManager;
58+
@Input() trialLength: number;
5859
@Output() steppedBack = new EventEmitter();
5960
@Output() organizationCreated = new EventEmitter<OrganizationCreatedEvent>();
6061

apps/web/src/app/billing/trial-initiation/complete-trial-initiation/complete-trial-initiation.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
? SubscriptionProduct.SecretsManager
4949
: SubscriptionProduct.PasswordManager
5050
"
51+
[trialLength]="trialLength"
5152
(steppedBack)="previousStep()"
5253
(organizationCreated)="createdOrganization($event)"
5354
>
@@ -58,6 +59,7 @@
5859
[email]="email"
5960
[orgLabel]="orgLabel"
6061
[product]="this.product"
62+
[trialLength]="trialLength"
6163
></app-trial-confirmation-details>
6264
<div class="tw-mb-3 tw-flex">
6365
<a

apps/web/src/app/billing/trial-initiation/complete-trial-initiation/complete-trial-initiation.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ export class CompleteTrialInitiationComponent implements OnInit, OnDestroy {
8686
loading = false;
8787
productTierValue: number;
8888

89+
trialLength: number;
90+
8991
orgInfoFormGroup = this.formBuilder.group({
9092
name: ["", { validators: [Validators.required, Validators.maxLength(50)], updateOn: "change" }],
9193
billingEmail: [""],
@@ -160,6 +162,8 @@ export class CompleteTrialInitiationComponent implements OnInit, OnDestroy {
160162
this.useTrialStepper = true;
161163
}
162164

165+
this.trialLength = qParams.trialLength ? parseInt(qParams.trialLength) : 7;
166+
163167
// Are they coming from an email for sponsoring a families organization
164168
// After logging in redirect them to setup the families sponsorship
165169
this.setupFamilySponsorship(qParams.sponsorshipToken);

apps/web/src/app/billing/trial-initiation/complete-trial-initiation/resolver/free-trial-text.resolver.spec.ts

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,58 @@ const route = {
1111
const routerStateSnapshot = {} as RouterStateSnapshot;
1212

1313
describe("freeTrialTextResolver", () => {
14-
it("shows password manager text", () => {
14+
beforeEach(() => {
15+
route.queryParams = {};
16+
});
17+
18+
it("shows password manager free trial text", () => {
1519
route.queryParams.product = `${ProductType.PasswordManager}`;
1620

1721
expect(freeTrialTextResolver(route, routerStateSnapshot)).toEqual({
1822
key: "continueSettingUpFreeTrialPasswordManager",
1923
});
2024
});
2125

22-
it("shows secret manager text", () => {
26+
it("shows password manager text", () => {
27+
route.queryParams.product = `${ProductType.PasswordManager}`;
28+
route.queryParams.trialLength = "0";
29+
30+
expect(freeTrialTextResolver(route, routerStateSnapshot)).toEqual({
31+
key: "continueSettingUpPasswordManager",
32+
});
33+
});
34+
35+
it("shows secret manager free trial text", () => {
2336
route.queryParams.product = `${ProductType.SecretsManager}`;
2437

2538
expect(freeTrialTextResolver(route, routerStateSnapshot)).toEqual({
2639
key: "continueSettingUpFreeTrialSecretsManager",
2740
});
2841
});
2942

30-
it("shows default text", () => {
43+
it("shows secret manager text", () => {
44+
route.queryParams.product = `${ProductType.SecretsManager}`;
45+
route.queryParams.trialLength = "0";
46+
47+
expect(freeTrialTextResolver(route, routerStateSnapshot)).toEqual({
48+
key: "continueSettingUpSecretsManager",
49+
});
50+
});
51+
52+
it("shows default free trial text", () => {
3153
route.queryParams.product = `${ProductType.PasswordManager},${ProductType.SecretsManager}`;
3254

3355
expect(freeTrialTextResolver(route, routerStateSnapshot)).toEqual({
3456
key: "continueSettingUpFreeTrial",
3557
});
3658
});
59+
60+
it("shows default text", () => {
61+
route.queryParams.product = `${ProductType.PasswordManager},${ProductType.SecretsManager}`;
62+
route.queryParams.trialLength = "0";
63+
64+
expect(freeTrialTextResolver(route, routerStateSnapshot)).toEqual({
65+
key: "continueSettingUp",
66+
});
67+
});
3768
});

apps/web/src/app/billing/trial-initiation/complete-trial-initiation/resolver/free-trial-text.resolver.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,29 @@ export const freeTrialTextResolver: ResolveFn<Translation | null> = (
99
const { product } = route.queryParams;
1010
const products: ProductType[] = (product ?? "").split(",").map((p: string) => parseInt(p));
1111

12+
const trialLength = route.queryParams.trialLength ? parseInt(route.queryParams.trialLength) : 7;
13+
1214
const onlyPasswordManager = products.length === 1 && products[0] === ProductType.PasswordManager;
1315
const onlySecretsManager = products.length === 1 && products[0] === ProductType.SecretsManager;
1416

1517
switch (true) {
1618
case onlyPasswordManager:
1719
return {
18-
key: "continueSettingUpFreeTrialPasswordManager",
20+
key:
21+
trialLength > 0
22+
? "continueSettingUpFreeTrialPasswordManager"
23+
: "continueSettingUpPasswordManager",
1924
};
2025
case onlySecretsManager:
2126
return {
22-
key: "continueSettingUpFreeTrialSecretsManager",
27+
key:
28+
trialLength > 0
29+
? "continueSettingUpFreeTrialSecretsManager"
30+
: "continueSettingUpSecretsManager",
2331
};
2432
default:
2533
return {
26-
key: "continueSettingUpFreeTrial",
34+
key: trialLength > 0 ? "continueSettingUpFreeTrial" : "continueSettingUp",
2735
};
2836
}
2937
};

apps/web/src/app/billing/trial-initiation/confirmation-details.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
>.
1414
</p>
1515
</li>
16-
<li>
16+
<li *ngIf="trialLength > 0">
1717
<p>
1818
{{ "trialPaidInfoMessage" | i18n: orgLabel }}
1919
</p>

apps/web/src/app/billing/trial-initiation/confirmation-details.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export class ConfirmationDetailsComponent {
1212
@Input() email: string;
1313
@Input() orgLabel: string;
1414
@Input() product?: ProductType = ProductType.PasswordManager;
15+
@Input() trialLength: number;
1516

1617
protected readonly Product = ProductType;
1718
}

apps/web/src/locales/en/messages.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9414,12 +9414,21 @@
94149414
"manageBillingFromProviderPortalMessage": {
94159415
"message": "Manage billing from the Provider Portal"
94169416
},
9417+
"continueSettingUp": {
9418+
"message": "Continue setting up Bitwarden"
9419+
},
94179420
"continueSettingUpFreeTrial": {
94189421
"message": "Continue setting up your free trial of Bitwarden"
94199422
},
9423+
"continueSettingUpPasswordManager": {
9424+
"message": "Continue setting up Bitwarden Password Manager"
9425+
},
94209426
"continueSettingUpFreeTrialPasswordManager": {
94219427
"message": "Continue setting up your free trial of Bitwarden Password Manager"
94229428
},
9429+
"continueSettingUpSecretsManager": {
9430+
"message": "Continue setting up Bitwarden Secrets Manager"
9431+
},
94239432
"continueSettingUpFreeTrialSecretsManager": {
94249433
"message": "Continue setting up your free trial of Bitwarden Secrets Manager"
94259434
},

0 commit comments

Comments
 (0)