[AC-2319] remove the owned by business checkbox business name (#8674)

* Removed business name from organization create/upgrade flows, and org info page

* Prefilling the logged in user's email to the billing email when creating an organization
This commit is contained in:
Conner Turnbull 2024-04-12 10:17:38 -04:00 committed by GitHub
parent a12c7242d6
commit b914260705
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 35 deletions

View File

@ -20,19 +20,4 @@
<input bitInput type="email" formControlName="clientOwnerEmail" />
</bit-form-field>
</div>
<div *ngIf="!isProvider && !acceptingSponsorship">
<input
type="checkbox"
name="businessOwned"
formControlName="businessOwned"
(change)="changedBusinessOwned.emit()"
/>
<bit-label for="businessOwned" class="tw-mb-3">{{ "accountOwnedBusiness" | i18n }}</bit-label>
<div class="tw-mt-4" *ngIf="formGroup.controls['businessOwned'].value">
<bit-form-field class="tw-w-1/2">
<bit-label>{{ "businessName" | i18n }}</bit-label>
<input bitInput type="text" formControlName="businessName" />
</bit-form-field>
</div>
</div>
</form>

View File

@ -1,15 +1,32 @@
import { Component, EventEmitter, Input, Output } from "@angular/core";
import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core";
import { UntypedFormGroup } from "@angular/forms";
import { firstValueFrom } from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
@Component({
selector: "app-org-info",
templateUrl: "organization-information.component.html",
})
export class OrganizationInformationComponent {
export class OrganizationInformationComponent implements OnInit {
@Input() nameOnly = false;
@Input() createOrganization = true;
@Input() isProvider = false;
@Input() acceptingSponsorship = false;
@Input() formGroup: UntypedFormGroup;
@Output() changedBusinessOwned = new EventEmitter<void>();
constructor(private accountService: AccountService) {}
async ngOnInit(): Promise<void> {
if (this.formGroup.controls.billingEmail.value) {
return;
}
const activeAccount = await firstValueFrom(this.accountService.activeAccount$);
if (activeAccount?.email) {
this.formGroup.controls.billingEmail.setValue(activeAccount.email);
}
}
}

View File

@ -20,10 +20,6 @@
<bit-label>{{ "billingEmail" | i18n }}</bit-label>
<input bitInput id="billingEmail" formControlName="billingEmail" type="email" />
</bit-form-field>
<bit-form-field>
<bit-label>{{ "businessName" | i18n }}</bit-label>
<input bitInput id="businessName" formControlName="businessName" type="text" />
</bit-form-field>
</div>
<div>
<bit-avatar [text]="org.name" [id]="org.id" size="large"></bit-avatar>

View File

@ -65,10 +65,6 @@ export class AccountComponent {
{ value: "", disabled: true },
{ validators: [Validators.required, Validators.email, Validators.maxLength(256)] },
),
businessName: this.formBuilder.control(
{ value: "", disabled: true },
{ validators: [Validators.maxLength(50)] },
),
});
protected collectionManagementFormGroup = this.formBuilder.group({
@ -124,7 +120,6 @@ export class AccountComponent {
// Update disabled states - reactive forms prefers not using disabled attribute
if (!this.selfHosted) {
this.formGroup.get("orgName").enable();
this.formGroup.get("businessName").enable();
this.collectionManagementFormGroup.get("limitCollectionCreationDeletion").enable();
this.collectionManagementFormGroup.get("allowAdminAccessToAllCollectionItems").enable();
}
@ -143,7 +138,6 @@ export class AccountComponent {
this.formGroup.patchValue({
orgName: this.org.name,
billingEmail: this.org.billingEmail,
businessName: this.org.businessName,
});
this.collectionManagementFormGroup.patchValue({
limitCollectionCreationDeletion: this.org.limitCollectionCreationDeletion,
@ -168,7 +162,6 @@ export class AccountComponent {
const request = new OrganizationUpdateRequest();
request.name = this.formGroup.value.orgName;
request.businessName = this.formGroup.value.businessName;
request.billingEmail = this.formGroup.value.billingEmail;
// Backfill pub/priv key if necessary

View File

@ -120,7 +120,6 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
additionalStorage: [0, [Validators.min(0), Validators.max(99)]],
additionalSeats: [0, [Validators.min(0), Validators.max(100000)]],
clientOwnerEmail: ["", [Validators.email]],
businessName: [""],
plan: [this.plan],
product: [this.product],
secretsManager: this.secretsManagerSubscription,
@ -596,9 +595,6 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
private async updateOrganization(orgId: string) {
const request = new OrganizationUpgradeRequest();
request.businessName = this.formGroup.controls.businessOwned.value
? this.formGroup.controls.businessName.value
: null;
request.additionalSeats = this.formGroup.controls.additionalSeats.value;
request.additionalStorageGb = this.formGroup.controls.additionalStorage.value;
request.premiumAccessAddon =
@ -656,9 +652,6 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
request.paymentToken = tokenResult[0];
request.paymentMethodType = tokenResult[1];
request.businessName = this.formGroup.controls.businessOwned.value
? this.formGroup.controls.businessName.value
: null;
request.additionalSeats = this.formGroup.controls.additionalSeats.value;
request.additionalStorageGb = this.formGroup.controls.additionalStorage.value;
request.premiumAccessAddon =