Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-8161] Payment optional trial MVP #10872

Merged
merged 135 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
8380ee9
Initial comment
cyprain-okeke Aug 28, 2024
c7a98dd
Add changes for the create org with payment method
cyprain-okeke Aug 29, 2024
8440265
Add the secrets manager trail flow
cyprain-okeke Aug 29, 2024
cc702cd
Add the banners
cyprain-okeke Aug 31, 2024
a7398b7
Add changes for the Disabled Org
cyprain-okeke Sep 3, 2024
011eeb4
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 3, 2024
fd410d8
Add banner to payment method page
cyprain-okeke Sep 4, 2024
3d464b9
Refactoring changes
cyprain-okeke Sep 4, 2024
1a3a64d
Resolve the bug on tha payment method
cyprain-okeke Sep 4, 2024
8e8899c
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 5, 2024
82e3690
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 5, 2024
bed3a28
Resolve lint error
cyprain-okeke Sep 5, 2024
ec49a4e
Resolve Pr comments
cyprain-okeke Sep 23, 2024
fd25d14
resolve the lint issue
cyprain-okeke Sep 23, 2024
e2c66f5
Resolve the lint wrong file issue
cyprain-okeke Sep 23, 2024
92c58de
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 23, 2024
2acdbb5
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 23, 2024
95e88d6
Rename object properly
cyprain-okeke Sep 23, 2024
b175945
Merge remote-tracking branch 'refs/remotes/origin/pm-8161-payment-opt…
cyprain-okeke Sep 23, 2024
b596179
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 23, 2024
6c6e250
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 23, 2024
252bcd4
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 24, 2024
902f977
Resolve pr comments from sm team
cyprain-okeke Sep 24, 2024
82c75de
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 24, 2024
e557019
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 24, 2024
502960b
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 24, 2024
4aabeb1
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 25, 2024
0576966
Resolve the pr comments from sm team
cyprain-okeke Sep 25, 2024
a802eb2
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 25, 2024
8707d67
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 25, 2024
c289ff8
Fix the failing test
cyprain-okeke Sep 25, 2024
5162634
Merge remote-tracking branch 'refs/remotes/origin/pm-8161-payment-opt…
cyprain-okeke Sep 25, 2024
74726e1
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 25, 2024
1446ee3
Resolve some issue with vault
cyprain-okeke Sep 25, 2024
7a1cf93
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 25, 2024
9a13197
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 26, 2024
ff320fa
Resolve the comments from sm team
cyprain-okeke Sep 26, 2024
2eaa610
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 26, 2024
69a6542
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 27, 2024
3edd2a5
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 27, 2024
7556b08
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 27, 2024
aadbaaa
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 27, 2024
e2afe2c
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 27, 2024
20ab4e0
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 28, 2024
e0001cb
Resolve some pr comments from vault team
cyprain-okeke Sep 29, 2024
ca46b97
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Sep 30, 2024
51e5f20
Resolve pr comments from auth team
cyprain-okeke Oct 1, 2024
fb39def
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 1, 2024
46ab71d
Exported ValidOrgParams enum
cyprain-okeke Oct 1, 2024
d51cb69
Removed unnecessary interpolation
cyprain-okeke Oct 1, 2024
2a717f7
Corrected bit-banner id for trial
cyprain-okeke Oct 1, 2024
118eefb
Resolve pr comments from auth team
cyprain-okeke Oct 1, 2024
9310e0b
Resolve pr comments from auth team
cyprain-okeke Oct 1, 2024
c795aca
Removed unnecessary method
cyprain-okeke Oct 1, 2024
df7de5f
Made OrganizationCreateRequest a subtype of OrganizationNoPaymentMeth…
cyprain-okeke Oct 1, 2024
0a744ae
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 1, 2024
6eeb6cb
Resolve review changes from sm
cyprain-okeke Oct 1, 2024
dcb837d
Merge remote-tracking branch 'refs/remotes/origin/pm-8161-payment-opt…
cyprain-okeke Oct 1, 2024
13f3223
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 1, 2024
67d8f77
Resolve review changes from dm
cyprain-okeke Oct 1, 2024
3a18e81
Merge remote-tracking branch 'refs/remotes/origin/pm-8161-payment-opt…
cyprain-okeke Oct 1, 2024
a57c0fd
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 1, 2024
c5601d9
Resolve the pr comments from billing
cyprain-okeke Oct 1, 2024
ceeb6f2
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 1, 2024
1c946a9
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 2, 2024
0ae0425
move the free-trial to core
cyprain-okeke Oct 2, 2024
cb1a1c3
Merge remote-tracking branch 'refs/remotes/origin/pm-8161-payment-opt…
cyprain-okeke Oct 2, 2024
6c38389
Move free-trial change to right file
cyprain-okeke Oct 2, 2024
c6ba4e0
Revert changes on the free trial page
cyprain-okeke Oct 2, 2024
4b48d35
Resolve the comment on protected trial page
cyprain-okeke Oct 2, 2024
3869955
Resolve the comment on protected trial page
cyprain-okeke Oct 2, 2024
ad05429
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 2, 2024
6fe9c69
Revert the next async change
cyprain-okeke Oct 2, 2024
dc3cb92
Merge remote-tracking branch 'refs/remotes/origin/pm-8161-payment-opt…
cyprain-okeke Oct 2, 2024
13c59ea
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 2, 2024
53b2e12
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 3, 2024
ba7fe4a
Merge remote-tracking branch 'refs/remotes/origin/pm-8161-payment-opt…
cyprain-okeke Oct 3, 2024
f83cb71
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 3, 2024
46b40f7
resolve pr comment fro vault team
cyprain-okeke Oct 3, 2024
e17f823
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 3, 2024
712cf2f
resolve the default message comments
cyprain-okeke Oct 3, 2024
75cd5bf
remove unused method
cyprain-okeke Oct 3, 2024
16a9c20
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 4, 2024
eff8eb2
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 4, 2024
3ab4ab4
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 4, 2024
f912a5b
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 15, 2024
b0d22af
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 17, 2024
a98c279
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 17, 2024
a1f2b9a
resolve email sending issue
cyprain-okeke Oct 17, 2024
f1c5c6d
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 17, 2024
9985efa
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 17, 2024
9331b8f
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 21, 2024
0553a64
Fix the pop issue on payment method
cyprain-okeke Oct 21, 2024
13a7017
Fix some console errors
cyprain-okeke Oct 21, 2024
c6e4647
Fix the pop refresh page
cyprain-okeke Oct 22, 2024
f77c85e
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 22, 2024
30a62b7
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 23, 2024
b08aeef
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 23, 2024
7e1191f
move the trial services to billing folder
cyprain-okeke Oct 23, 2024
8de3aaa
resolve pr comments
cyprain-okeke Oct 23, 2024
7f70cb4
Resolve the import issues
cyprain-okeke Oct 23, 2024
74c788a
Move the observable up
cyprain-okeke Oct 23, 2024
8daf15f
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 29, 2024
0c042dc
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 29, 2024
16d8ede
Resolve blank payment method for trialing org
cyprain-okeke Oct 29, 2024
4487e3d
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 29, 2024
13a75b6
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 29, 2024
0603e60
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 29, 2024
b93da7b
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 30, 2024
4c8ed41
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 30, 2024
890a883
Changes to disable icon is removed onsubmit
cyprain-okeke Oct 30, 2024
eb3913f
Remove unused references
cyprain-okeke Oct 31, 2024
3b70b3b
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 31, 2024
5aac449
add a missing a period at the end of it
cyprain-okeke Oct 31, 2024
8b32f13
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 31, 2024
2f7e225
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 31, 2024
2b1f656
resolve the reload issue
cyprain-okeke Oct 31, 2024
7a35d66
Resolve the disable icon issue
cyprain-okeke Oct 31, 2024
9ed4fca
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Oct 31, 2024
b368203
Fix the admin access bug
cyprain-okeke Nov 1, 2024
dcb9178
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Nov 1, 2024
897a1af
Resolve the lint issue
cyprain-okeke Nov 1, 2024
3554d77
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Nov 1, 2024
bb60be1
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Nov 4, 2024
cce787a
Fix the message incorrect format
cyprain-okeke Nov 4, 2024
69b80b8
Formatting fixed
cyprain-okeke Nov 4, 2024
60504ec
Resolve the access issue of other users role
cyprain-okeke Nov 4, 2024
3264ceb
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Nov 4, 2024
0783cc6
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Nov 4, 2024
e0455f6
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Nov 5, 2024
7cc34ec
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Nov 6, 2024
8d5d750
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Nov 7, 2024
f662aad
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Nov 11, 2024
9d3b9c9
Merge remote-tracking branch 'refs/remotes/origin/pm-8161-payment-opt…
cyprain-okeke Nov 11, 2024
013c882
Merge branch 'main' into pm-8161-payment-optional-trial-mvp
cyprain-okeke Nov 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
mzieniukbw marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
protected formBuilder: UntypedFormBuilder,
protected i18nService: I18nService,
protected organizationBillingService: OrganizationBillingService,
private router: Router,
protected router: Router,

Check warning on line 49 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-free-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-free-stepper.component.ts#L49

Added line #L49 was not covered by tests
) {}

ngOnInit(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,29 @@
bitButton
buttonType="primary"
[disabled]="formGroup.get('name').invalid"
[loading]="createOrganizationLoading"
(click)="createOrganizationOnTrial()"
*ngIf="enableTrialPayment$ | async"
>
{{ "startTrial" | i18n }}
</button>
<button
type="button"
bitButton
buttonType="primary"
[disabled]="formGroup.get('name').invalid"
[loading]="createOrganizationLoading"
cdkStepperNext
*ngIf="!(enableTrialPayment$ | async)"
>
{{ "next" | i18n }}
</button>
</app-vertical-step>
<app-vertical-step label="{{ 'billing' | i18n | titlecase }}" [subLabel]="billingSubLabel">
<app-vertical-step
label="{{ 'billing' | i18n | titlecase }}"
[subLabel]="billingSubLabel"
*ngIf="!(enableTrialPayment$ | async)"
>
<app-trial-billing-step
*ngIf="stepper.selectedIndex === 2"
[organizationInfo]="{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { Component, Input, ViewChild } from "@angular/core";
import { Component, Input, OnInit, ViewChild } from "@angular/core";
import { UntypedFormBuilder } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router";
import { Subject, takeUntil } from "rxjs";

Check warning on line 4 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L1-L4

Added lines #L1 - L4 were not covered by tests

import { ProductTierType } from "@bitwarden/common/billing/enums";
import { OrganizationBillingServiceAbstraction as OrganizationBillingService } from "@bitwarden/common/billing/abstractions/organization-billing.service";
import { PlanType, ProductTierType } from "@bitwarden/common/billing/enums";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ReferenceEventRequest } from "@bitwarden/common/models/request/reference-event.request";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";

Check warning on line 11 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L6-L11

Added lines #L6 - L11 were not covered by tests

import {
OrganizationCreatedEvent,
Expand All @@ -9,18 +17,64 @@
} from "../../../billing/accounts/trial-initiation/trial-billing-step.component";
import { VerticalStepperComponent } from "../../trial-initiation/vertical-stepper/vertical-stepper.component";
import { SecretsManagerTrialFreeStepperComponent } from "../secrets-manager/secrets-manager-trial-free-stepper.component";
import { ValidOrgParams } from "../trial-initiation.component";

Check warning on line 20 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L20

Added line #L20 was not covered by tests

const trialFlowOrgs = [

Check warning on line 22 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L22

Added line #L22 was not covered by tests
ValidOrgParams.teams,
ValidOrgParams.teamsStarter,
ValidOrgParams.enterprise,
ValidOrgParams.families,
];

@Component({
selector: "app-secrets-manager-trial-paid-stepper",
templateUrl: "secrets-manager-trial-paid-stepper.component.html",
})
export class SecretsManagerTrialPaidStepperComponent extends SecretsManagerTrialFreeStepperComponent {
export class SecretsManagerTrialPaidStepperComponent

Check warning on line 33 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L33

Added line #L33 was not covered by tests
extends SecretsManagerTrialFreeStepperComponent
implements OnInit
{
@ViewChild("stepper", { static: false }) verticalStepper: VerticalStepperComponent;
@Input() organizationTypeQueryParameter: string;

plan: PlanType;
createOrganizationLoading = false;

Check warning on line 41 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L41

Added line #L41 was not covered by tests
billingSubLabel = this.i18nService.t("billingTrialSubLabel");
organizationId: string;

private destroy$ = new Subject<void>();
protected enableTrialPayment$ = this.configService.getFeatureFlag$(

Check warning on line 46 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L45-L46

Added lines #L45 - L46 were not covered by tests
FeatureFlag.TrialPaymentOptional,
);

constructor(
private route: ActivatedRoute,
private configService: ConfigService,
protected formBuilder: UntypedFormBuilder,
protected i18nService: I18nService,
protected organizationBillingService: OrganizationBillingService,
protected router: Router,

Check warning on line 56 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L56

Added line #L56 was not covered by tests
) {
super(formBuilder, i18nService, organizationBillingService, router);

Check warning on line 58 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L58

Added line #L58 was not covered by tests
}

async ngOnInit(): Promise<void> {
this.referenceEventRequest = new ReferenceEventRequest();
this.referenceEventRequest.initiationPath = "Secrets Manager trial from marketing website";

Check warning on line 63 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L62-L63

Added lines #L62 - L63 were not covered by tests

this.route.queryParams.pipe(takeUntil(this.destroy$)).subscribe((qParams) => {

Check warning on line 65 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L65

Added line #L65 was not covered by tests
if (trialFlowOrgs.includes(qParams.org)) {
if (qParams.org === ValidOrgParams.teamsStarter) {
this.plan = PlanType.TeamsStarter;

Check warning on line 68 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L68

Added line #L68 was not covered by tests
} else if (qParams.org === ValidOrgParams.teams) {
this.plan = PlanType.TeamsAnnually;

Check warning on line 70 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L70

Added line #L70 was not covered by tests
} else if (qParams.org === ValidOrgParams.enterprise) {
this.plan = PlanType.EnterpriseAnnually;

Check warning on line 72 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L72

Added line #L72 was not covered by tests
}
}
});
}

organizationCreated(event: OrganizationCreatedEvent) {
this.organizationId = event.organizationId;
this.billingSubLabel = event.planDescription;
Expand All @@ -31,6 +85,29 @@
this.verticalStepper.previous();
}

async createOrganizationOnTrial(): Promise<void> {
this.createOrganizationLoading = true;
const response = await this.organizationBillingService.purchaseSubscriptionNoPaymentMethod({

Check warning on line 90 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L89-L90

Added lines #L89 - L90 were not covered by tests
organization: {
name: this.formGroup.get("name").value,
billingEmail: this.formGroup.get("email").value,
initiationPath: "Secrets Manager trial from marketing website",
},
plan: {
type: this.plan,
subscribeToSecretsManager: true,
isFromSecretsManagerTrial: true,
passwordManagerSeats: 1,
secretsManagerSeats: 1,
},
});

this.organizationId = response?.id;
this.subLabels.organizationInfo = response?.name;
this.createOrganizationLoading = false;
this.verticalStepper.next();

Check warning on line 108 in apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.ts#L107-L108

Added lines #L107 - L108 were not covered by tests
}

get createAccountLabel() {
const organizationType =
this.productType === ProductTierType.TeamsStarter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,17 @@ <h2 class="tw-pb-4 tw-pl-4 tw-pt-5 tw-text-base tw-font-bold tw-uppercase">
bitButton
buttonType="primary"
[disabled]="orgInfoFormGroup.get('name').invalid"
cdkStepperNext
[loading]="loading"
(click)="createOrganizationOnTrial()"
>
{{ "next" | i18n }}
{{ (enableTrialPayment$ | async) ? ("startTrial" | i18n) : ("next" | i18n) }}
</button>
</app-vertical-step>
<app-vertical-step label="Billing" [subLabel]="billingSubLabel">
<app-vertical-step
label="Billing"
[subLabel]="billingSubLabel"
*ngIf="!(enableTrialPayment$ | async)"
>
<app-trial-billing-step
*ngIf="stepper.selectedIndex === 2"
[organizationInfo]="{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import { PolicyApiServiceAbstraction } from "@bitwarden/common/admin-console/abs
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { MasterPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/master-password-policy-options";
import { Policy } from "@bitwarden/common/admin-console/models/domain/policy";
import { OrganizationBillingServiceAbstraction as OrganizationBillingService } from "@bitwarden/common/billing/abstractions/organization-billing.service";
import { PlanType } from "@bitwarden/common/billing/enums";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
Expand All @@ -39,6 +41,8 @@ describe("TrialInitiationComponent", () => {
let policyServiceMock: MockProxy<PolicyService>;
let routerServiceMock: MockProxy<RouterService>;
let acceptOrgInviteServiceMock: MockProxy<AcceptOrganizationInviteService>;
let organizationBillingServiceMock: MockProxy<OrganizationBillingService>;
let configServiceMock: MockProxy<ConfigService>;

beforeEach(() => {
// only define services directly that we want to mock return values in this component
Expand All @@ -47,6 +51,8 @@ describe("TrialInitiationComponent", () => {
policyServiceMock = mock<PolicyService>();
routerServiceMock = mock<RouterService>();
acceptOrgInviteServiceMock = mock<AcceptOrganizationInviteService>();
organizationBillingServiceMock = mock<OrganizationBillingService>();
configServiceMock = mock<ConfigService>();

// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Expand Down Expand Up @@ -92,6 +98,14 @@ describe("TrialInitiationComponent", () => {
provide: AcceptOrganizationInviteService,
useValue: acceptOrgInviteServiceMock,
},
{
provide: OrganizationBillingService,
useValue: organizationBillingServiceMock,
},
{
provide: ConfigService,
useValue: configServiceMock,
},
],
schemas: [NO_ERRORS_SCHEMA], // Allows child components to be ignored (such as register component)
}).compileComponents();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { MasterPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/master-password-policy-options";
import { Policy } from "@bitwarden/common/admin-console/models/domain/policy";
import {
OrganizationInformation,
PlanInformation,
OrganizationBillingServiceAbstraction as OrganizationBillingService,
} from "@bitwarden/common/billing/abstractions/organization-billing.service";
import { PlanType, ProductTierType } from "@bitwarden/common/billing/enums";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ReferenceEventRequest } from "@bitwarden/common/models/request/reference-event.request";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";

Expand All @@ -25,7 +32,7 @@
import { RouterService } from "./../../core/router.service";
import { VerticalStepperComponent } from "./vertical-stepper/vertical-stepper.component";

enum ValidOrgParams {
export enum ValidOrgParams {
families = "families",
enterprise = "enterprise",
teams = "teams",
Expand Down Expand Up @@ -69,6 +76,7 @@
productTier: ProductTierType;
accountCreateOnly = true;
useTrialStepper = false;
loading = false;
policies: Policy[];
enforcedPolicyOptions: MasterPasswordPolicyOptions;
trialFlowOrgs: string[] = [
Expand Down Expand Up @@ -115,6 +123,9 @@
}

private destroy$ = new Subject<void>();
protected enableTrialPayment$ = this.configService.getFeatureFlag$(
FeatureFlag.TrialPaymentOptional,
);

constructor(
private route: ActivatedRoute,
Expand All @@ -127,6 +138,8 @@
private i18nService: I18nService,
private routerService: RouterService,
private acceptOrgInviteService: AcceptOrganizationInviteService,
private organizationBillingService: OrganizationBillingService,
private configService: ConfigService,
) {}

async ngOnInit(): Promise<void> {
Expand Down Expand Up @@ -215,6 +228,30 @@
}
}

async createOrganizationOnTrial() {
this.loading = true;
const organization: OrganizationInformation = {

Check warning on line 233 in apps/web/src/app/auth/trial-initiation/trial-initiation.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/trial-initiation.component.ts#L232-L233

Added lines #L232 - L233 were not covered by tests
name: this.orgInfoFormGroup.get("name").value,
billingEmail: this.orgInfoFormGroup.get("email").value,
initiationPath: "Password Manager trial from marketing website",
};

const plan: PlanInformation = {

Check warning on line 239 in apps/web/src/app/auth/trial-initiation/trial-initiation.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/trial-initiation.component.ts#L239

Added line #L239 was not covered by tests
type: this.plan,
passwordManagerSeats: 1,
};

const response = await this.organizationBillingService.purchaseSubscriptionNoPaymentMethod({

Check warning on line 244 in apps/web/src/app/auth/trial-initiation/trial-initiation.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/trial-initiation.component.ts#L244

Added line #L244 was not covered by tests
organization,
plan,
});

this.orgId = response?.id;
this.billingSubLabel = `${this.i18nService.t("annual")} ($0/${this.i18nService.t("yr")})`;
this.loading = false;
this.verticalStepper.next();

Check warning on line 252 in apps/web/src/app/auth/trial-initiation/trial-initiation.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/trial-initiation.component.ts#L250-L252

Added lines #L250 - L252 were not covered by tests
}

createdAccount(email: string) {
this.email = email;
this.orgInfoFormGroup.get("email")?.setValue(email);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,16 +345,22 @@ <h2 bitTypography="h4">{{ "paymentMethod" | i18n }}</h2>
<a></a>
</p>
<app-payment
*ngIf="(upgradeRequiresPaymentMethod || showPayment) && !deprecateStripeSourcesAPI"
*ngIf="
(upgradeRequiresPaymentMethod || showPayment || isPaymentSourceEmpty()) &&
!deprecateStripeSourcesAPI
"
[hideCredit]="true"
></app-payment>
<app-payment-v2
*ngIf="(upgradeRequiresPaymentMethod || showPayment) && deprecateStripeSourcesAPI"
*ngIf="
(upgradeRequiresPaymentMethod || showPayment || isPaymentSourceEmpty()) &&
deprecateStripeSourcesAPI
"
[showAccountCredit]="false"
>
</app-payment-v2>
<app-tax-info
*ngIf="showPayment || upgradeRequiresPaymentMethod"
*ngIf="showPayment || upgradeRequiresPaymentMethod || isPaymentSourceEmpty()"
(onCountryChanged)="changedCountry()"
></app-tax-info>
<div id="price" class="tw-mt-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
: this.discountPercentageFromSub + this.discountPercentage;
}

isPaymentSourceEmpty() {
return this.deprecateStripeSourcesAPI
? this.paymentSource === null || this.paymentSource === undefined
: this.billing?.paymentSource === null || this.billing?.paymentSource === undefined;
}

isSecretsManagerTrial(): boolean {
return (
this.sub?.subscription?.items?.some((item) =>
Expand Down Expand Up @@ -723,7 +729,7 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
// Secrets Manager
this.buildSecretsManagerRequest(request);

if (this.upgradeRequiresPaymentMethod || this.showPayment) {
if (this.upgradeRequiresPaymentMethod || this.showPayment || this.isPaymentSourceEmpty()) {
if (this.deprecateStripeSourcesAPI) {
const tokenizedPaymentSource = await this.paymentV2Component.tokenize();
const updatePaymentMethodRequest = new UpdatePaymentMethodRequest();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { NgModule } from "@angular/core";

import { BannerModule } from "../../../../../../libs/components/src/banner/banner.module";

Check warning on line 3 in apps/web/src/app/billing/organizations/organization-billing.module.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/billing/organizations/organization-billing.module.ts#L3

Added line #L3 was not covered by tests
import { UserVerificationModule } from "../../auth/shared/components/user-verification";
import { LooseComponentsModule } from "../../shared";
import { BillingSharedModule } from "../shared";
Expand Down Expand Up @@ -28,6 +29,7 @@
BillingSharedModule,
OrganizationPlansComponent,
LooseComponentsModule,
BannerModule,
],
declarations: [
AdjustSubscription,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
<bit-banner
id="free-trial-banner"
class="-tw-m-6 tw-flex tw-flex-col tw-pb-6"
bannerType="premium"
icon="bwi-billing"
[showClose]="false"
*ngIf="freeTrialData?.shownBanner"
>
{{ freeTrialData.message }}
<a
bitLink
linkType="contrast"
(click)="changePayment()"
class="tw-cursor-pointer"
rel="noreferrer noopener"
>
{{ "routeToPaymentMethodTrigger" | i18n }}
</a>
</bit-banner>
<app-header></app-header>
<bit-container>
<ng-container *ngIf="loading">
Expand Down
Loading
Loading