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-15402] Remove TaxInfoComponent from trial-initiation.module.ts #12996

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ <h2 class="tw-mb-3 tw-text-base tw-font-semibold">{{ "billingPlanLabel" | i18n }
<div class="tw-mb-4">
<h2 class="tw-mb-3 tw-text-base tw-font-semibold">{{ "paymentType" | i18n }}</h2>
<app-payment [showAccountCredit]="false"></app-payment>
<app-tax-info [trialFlow]="true" (countryChanged)="changedCountry()"></app-tax-info>
<app-manage-tax-information
(taxInformationChanged)="changedCountry()"
></app-manage-tax-information>
</div>
<div class="tw-flex tw-space-x-2">
<button type="submit" buttonType="primary" bitButton [loading]="form.loading">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from "@angular/core";
import { FormBuilder, Validators } from "@angular/forms";

import { ManageTaxInformationComponent } from "@bitwarden/angular/billing/components";

Check warning on line 6 in apps/web/src/app/billing/accounts/trial-initiation/trial-billing-step.component.ts

View check run for this annotation

Codecov / codecov/patch

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

Added line #L6 was not covered by tests
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import {
BillingInformation,
Expand All @@ -17,7 +18,7 @@
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
import { ToastService } from "@bitwarden/components";

import { BillingSharedModule, TaxInfoComponent } from "../../shared";
import { BillingSharedModule } from "../../shared";

Check warning on line 21 in apps/web/src/app/billing/accounts/trial-initiation/trial-billing-step.component.ts

View check run for this annotation

Codecov / codecov/patch

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

Added line #L21 was not covered by tests
import { PaymentComponent } from "../../shared/payment/payment.component";

export type TrialOrganizationType = Exclude<ProductTierType, ProductTierType.Free>;
Expand Down Expand Up @@ -51,7 +52,7 @@
})
export class TrialBillingStepComponent implements OnInit {
@ViewChild(PaymentComponent) paymentComponent: PaymentComponent;
@ViewChild(TaxInfoComponent) taxInfoComponent: TaxInfoComponent;
@ViewChild(ManageTaxInformationComponent) taxInfoComponent: ManageTaxInformationComponent;
@Input() organizationInfo: OrganizationInfo;
@Input() subscriptionProduct: SubscriptionProduct = SubscriptionProduct.PasswordManager;
@Output() steppedBack = new EventEmitter();
Expand Down Expand Up @@ -89,8 +90,7 @@
}

async submit(): Promise<void> {
if (!this.taxInfoComponent.taxFormGroup.valid && this.taxInfoComponent?.taxFormGroup.touched) {
this.taxInfoComponent.taxFormGroup.markAllAsTouched();
if (!this.taxInfoComponent.validate()) {
return;
}

Expand All @@ -115,7 +115,8 @@
}

protected changedCountry() {
this.paymentComponent.showBankAccount = this.taxInfoComponent.country === "US";
this.paymentComponent.showBankAccount =

Check warning on line 118 in apps/web/src/app/billing/accounts/trial-initiation/trial-billing-step.component.ts

View check run for this annotation

Codecov / codecov/patch

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

Added line #L118 was not covered by tests
this.taxInfoComponent.getTaxInformation().country === "US";
if (
!this.paymentComponent.showBankAccount &&
this.paymentComponent.selected === PaymentMethodType.BankAccount
Expand Down Expand Up @@ -210,13 +211,13 @@

private getBillingInformationFromTaxInfoComponent(): BillingInformation {
return {
postalCode: this.taxInfoComponent.taxFormGroup?.value.postalCode,
country: this.taxInfoComponent.taxFormGroup?.value.country,
taxId: this.taxInfoComponent.taxFormGroup?.value.taxId,
addressLine1: this.taxInfoComponent.taxFormGroup?.value.line1,
addressLine2: this.taxInfoComponent.taxFormGroup?.value.line2,
city: this.taxInfoComponent.taxFormGroup?.value.city,
state: this.taxInfoComponent.taxFormGroup?.value.state,
postalCode: this.taxInfoComponent.getTaxInformation()?.postalCode,
country: this.taxInfoComponent.getTaxInformation()?.country,
taxId: this.taxInfoComponent.getTaxInformation()?.taxId,
addressLine1: this.taxInfoComponent.getTaxInformation()?.line1,
addressLine2: this.taxInfoComponent.getTaxInformation()?.line2,
city: this.taxInfoComponent.getTaxInformation()?.city,
state: this.taxInfoComponent.getTaxInformation()?.state,
};
}

Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/app/billing/shared/tax-info.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"

import { SharedModule } from "../../shared";

/**
* @deprecated Use `ManageTaxInformationComponent` instead.
*/
@Component({
selector: "app-tax-info",
templateUrl: "tax-info.component.html",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { SearchModule } from "@bitwarden/components";
import { DangerZoneComponent } from "@bitwarden/web-vault/app/auth/settings/account/danger-zone.component";
import { OrganizationPlansComponent, TaxInfoComponent } from "@bitwarden/web-vault/app/billing";
import { OrganizationPlansComponent } from "@bitwarden/web-vault/app/billing";

Check warning on line 9 in bitwarden_license/bit-web/src/app/admin-console/providers/providers.module.ts

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bit-web/src/app/admin-console/providers/providers.module.ts#L9

Added line #L9 was not covered by tests
import { OssModule } from "@bitwarden/web-vault/app/oss.module";

import {
Expand Down Expand Up @@ -47,7 +47,6 @@
OrganizationPlansComponent,
SearchModule,
ProvidersLayoutComponent,
TaxInfoComponent,
DangerZoneComponent,
ScrollingModule,
],
Expand Down
Loading