From fe2564acd37faa37dc5d517d6d502b1aea9480c6 Mon Sep 17 00:00:00 2001 From: Jonas Hendrickx Date: Wed, 20 Nov 2024 11:42:55 +0100 Subject: [PATCH] useless code --- .../adjust-payment-dialog-v2.component.ts | 2 +- .../adjust-payment-dialog.component.ts | 2 +- .../app/billing/shared/tax-info.component.ts | 31 ------------------- 3 files changed, 2 insertions(+), 33 deletions(-) diff --git a/apps/web/src/app/billing/shared/adjust-payment-dialog/adjust-payment-dialog-v2.component.ts b/apps/web/src/app/billing/shared/adjust-payment-dialog/adjust-payment-dialog-v2.component.ts index ccf71dc7f88..5eb45603a44 100644 --- a/apps/web/src/app/billing/shared/adjust-payment-dialog/adjust-payment-dialog-v2.component.ts +++ b/apps/web/src/app/billing/shared/adjust-payment-dialog/adjust-payment-dialog-v2.component.ts @@ -51,7 +51,7 @@ export class AdjustPaymentDialogV2Component { } onCountryChanged = () => { - if (this.taxInfoComponent.taxInfo.country === "US") { + if (this.taxInfoComponent.country === "US") { this.paymentComponent.showBankAccount = !!this.organizationId; } else { this.paymentComponent.showBankAccount = false; diff --git a/apps/web/src/app/billing/shared/adjust-payment-dialog/adjust-payment-dialog.component.ts b/apps/web/src/app/billing/shared/adjust-payment-dialog/adjust-payment-dialog.component.ts index 0c8e93531ee..ee6a36dbf54 100644 --- a/apps/web/src/app/billing/shared/adjust-payment-dialog/adjust-payment-dialog.component.ts +++ b/apps/web/src/app/billing/shared/adjust-payment-dialog/adjust-payment-dialog.component.ts @@ -84,7 +84,7 @@ export class AdjustPaymentDialogComponent { }; changeCountry() { - if (this.taxInfoComponent.taxInfo.country === "US") { + if (this.taxInfoComponent.country === "US") { this.paymentComponent.hideBank = !this.organizationId; } else { this.paymentComponent.hideBank = true; diff --git a/apps/web/src/app/billing/shared/tax-info.component.ts b/apps/web/src/app/billing/shared/tax-info.component.ts index e9c42f1983c..0f23d308a0e 100644 --- a/apps/web/src/app/billing/shared/tax-info.component.ts +++ b/apps/web/src/app/billing/shared/tax-info.component.ts @@ -10,17 +10,11 @@ import { TaxServiceAbstraction } from "@bitwarden/common/billing/abstractions/ta import { CountryListItem } from "@bitwarden/common/billing/models/domain"; import { ExpandedTaxInfoUpdateRequest } from "@bitwarden/common/billing/models/request/expanded-tax-info-update.request"; import { TaxInfoUpdateRequest } from "@bitwarden/common/billing/models/request/tax-info-update.request"; -import { TaxInfoResponse } from "@bitwarden/common/billing/models/response/tax-info.response"; import { TaxRateResponse } from "@bitwarden/common/billing/models/response/tax-rate.response"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { SharedModule } from "../../shared"; -type TaxInfoView = Omit & { - includeTaxId: boolean; - [key: string]: unknown; -}; - @Component({ selector: "app-tax-info", templateUrl: "tax-info.component.html", @@ -49,16 +43,6 @@ export class TaxInfoComponent implements OnInit, OnDestroy { loading = true; organizationId: string; providerId: string; - taxInfo: TaxInfoView = { - taxId: null, - line1: null, - line2: null, - city: null, - state: null, - postalCode: null, - country: "US", - includeTaxId: false, - }; countryList: CountryListItem[] = this.taxService.getCountries(); taxRates: TaxRateResponse[]; private taxSupportedCountryCodes: string[] = this.taxService.getSupportedCountries(); @@ -132,7 +116,6 @@ export class TaxInfoComponent implements OnInit, OnDestroy { !!taxInfo.city || !!taxInfo.state), ); - this.setTaxInfoObject(); } } catch (e) { this.logService.error(e); @@ -144,7 +127,6 @@ export class TaxInfoComponent implements OnInit, OnDestroy { this.taxFormGroup.controls.postalCode.setValue(taxInfo.postalCode); this.taxFormGroup.controls.country.setValue(taxInfo.country || "US"); } - this.setTaxInfoObject(); } catch (e) { this.logService.error(e); } @@ -169,7 +151,6 @@ export class TaxInfoComponent implements OnInit, OnDestroy { this.taxFormGroup.get("postalCode").clearValidators(); } this.taxFormGroup.get("postalCode").updateValueAndValidity(); - this.setTaxInfoObject(); this.changeCountry(); this.onTaxInformationChanged.emit(); }); @@ -218,17 +199,6 @@ export class TaxInfoComponent implements OnInit, OnDestroy { } } - setTaxInfoObject() { - this.taxInfo.country = this.country; - this.taxInfo.postalCode = this.postalCode; - this.taxInfo.includeTaxId = this.includeTaxId; - this.taxInfo.taxId = this.taxId; - this.taxInfo.line1 = this.line1; - this.taxInfo.line2 = this.line2; - this.taxInfo.city = this.city; - this.taxInfo.state = this.state; - } - get showTaxIdFields(): boolean { return this.includeTaxId && this.countrySupportsTax(this.country); } @@ -261,7 +231,6 @@ export class TaxInfoComponent implements OnInit, OnDestroy { if (!this.countrySupportsTax(this.country)) { this.taxFormGroup.controls.includeTaxId.setValue(false); this.clearTaxInformationFields(); - this.setTaxInfoObject(); } this.onCountryChanged.emit();