From 7c16410c8626a034c7c7d4909334aa13ed15f08f Mon Sep 17 00:00:00 2001 From: Alex Morask <144709477+amorask-bitwarden@users.noreply.github.com> Date: Wed, 12 Jun 2024 17:10:20 -0400 Subject: [PATCH] Don't invoke ManageTaxInformationComponent when CB is disabled (#9614) --- .../providers/setup/setup.component.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/setup/setup.component.ts b/bitwarden_license/bit-web/src/app/admin-console/providers/setup/setup.component.ts index 845f2834b33..e0c011f9bc6 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/setup/setup.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/setup/setup.component.ts @@ -119,9 +119,15 @@ export class SetupComponent implements OnInit, OnDestroy { submit = async () => { try { + const consolidatedBillingEnabled = await firstValueFrom(this.enableConsolidatedBilling$); + this.formGroup.markAllAsTouched(); - const taxInformationValid = this.manageTaxInformationComponent.touch(); - if (this.formGroup.invalid || !taxInformationValid) { + + const formIsValid = consolidatedBillingEnabled + ? this.formGroup.valid && this.manageTaxInformationComponent.touch() + : this.formGroup.valid; + + if (!formIsValid) { return; } @@ -134,9 +140,7 @@ export class SetupComponent implements OnInit, OnDestroy { request.token = this.token; request.key = key; - const enableConsolidatedBilling = await firstValueFrom(this.enableConsolidatedBilling$); - - if (enableConsolidatedBilling) { + if (consolidatedBillingEnabled) { request.taxInfo = new ExpandedTaxInfoUpdateRequest(); const taxInformation = this.manageTaxInformationComponent.getTaxInformation();