2022-07-20 03:00:25 +02:00
|
|
|
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
2022-07-26 14:48:11 +02:00
|
|
|
import { UntypedFormBuilder, FormGroup } from "@angular/forms";
|
2022-07-20 03:00:25 +02:00
|
|
|
import { Router } from "@angular/router";
|
|
|
|
|
|
|
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
|
|
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
|
|
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|
|
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|
|
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
|
|
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
|
|
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
2022-08-08 11:04:36 +02:00
|
|
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
2022-07-20 03:00:25 +02:00
|
|
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
2022-07-25 20:44:51 +02:00
|
|
|
import { ProductType } from "@bitwarden/common/enums/productType";
|
2022-07-20 03:00:25 +02:00
|
|
|
|
2022-08-03 21:40:04 +02:00
|
|
|
import { OrganizationPlansComponent } from "../../settings/organization-plans.component";
|
2022-07-20 03:00:25 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: "app-billing",
|
|
|
|
templateUrl: "./billing.component.html",
|
|
|
|
})
|
|
|
|
export class BillingComponent extends OrganizationPlansComponent {
|
|
|
|
@Input() orgInfoForm: FormGroup;
|
|
|
|
@Output() previousStep = new EventEmitter();
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
apiService: ApiService,
|
|
|
|
i18nService: I18nService,
|
|
|
|
platformUtilsService: PlatformUtilsService,
|
|
|
|
cryptoService: CryptoService,
|
|
|
|
router: Router,
|
|
|
|
syncService: SyncService,
|
|
|
|
policyService: PolicyService,
|
|
|
|
organizationService: OrganizationService,
|
|
|
|
logService: LogService,
|
|
|
|
messagingService: MessagingService,
|
2022-07-26 14:48:11 +02:00
|
|
|
formBuilder: UntypedFormBuilder
|
2022-07-20 03:00:25 +02:00
|
|
|
) {
|
|
|
|
super(
|
|
|
|
apiService,
|
|
|
|
i18nService,
|
|
|
|
platformUtilsService,
|
|
|
|
cryptoService,
|
|
|
|
router,
|
|
|
|
syncService,
|
|
|
|
policyService,
|
|
|
|
organizationService,
|
|
|
|
logService,
|
|
|
|
messagingService,
|
|
|
|
formBuilder
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
async ngOnInit() {
|
2022-07-25 20:44:51 +02:00
|
|
|
const additionalSeats = this.product == ProductType.Families ? 0 : 1;
|
2022-07-20 03:00:25 +02:00
|
|
|
this.formGroup.patchValue({
|
|
|
|
name: this.orgInfoForm.get("name")?.value,
|
|
|
|
billingEmail: this.orgInfoForm.get("email")?.value,
|
2022-07-25 20:44:51 +02:00
|
|
|
additionalSeats: additionalSeats,
|
2022-07-20 03:00:25 +02:00
|
|
|
plan: this.plan,
|
|
|
|
product: this.product,
|
|
|
|
});
|
|
|
|
this.isInTrialFlow = true;
|
|
|
|
await super.ngOnInit();
|
|
|
|
}
|
|
|
|
|
|
|
|
stepBack() {
|
|
|
|
this.previousStep.emit();
|
|
|
|
}
|
|
|
|
}
|