diff --git a/libs/importer/src/components/import.component.ts b/libs/importer/src/components/import.component.ts index 13a09304f4..a140624870 100644 --- a/libs/importer/src/components/import.component.ts +++ b/libs/importer/src/components/import.component.ts @@ -16,6 +16,8 @@ import { concat, Observable, Subject, lastValueFrom, combineLatest, firstValueFr import { filter, map, takeUntil } from "rxjs/operators"; import { JslibModule } from "@bitwarden/angular/jslib.module"; +import { safeProvider, SafeProvider } from "@bitwarden/angular/platform/utils/safe-provider"; +import { PinServiceAbstraction } from "@bitwarden/auth/common"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { canAccessImport, @@ -64,6 +66,27 @@ import { } from "./dialog"; import { ImportLastPassComponent } from "./lastpass"; +const safeProviders: SafeProvider[] = [ + safeProvider({ + provide: ImportApiServiceAbstraction, + useClass: ImportApiService, + deps: [ApiService], + }), + safeProvider({ + provide: ImportServiceAbstraction, + useClass: ImportService, + deps: [ + CipherService, + FolderService, + ImportApiServiceAbstraction, + I18nService, + CollectionService, + CryptoService, + PinServiceAbstraction, + ], + }), +]; + @Component({ selector: "tools-import", templateUrl: "import.component.html", @@ -81,25 +104,7 @@ import { ImportLastPassComponent } from "./lastpass"; ImportLastPassComponent, RadioButtonModule, ], - providers: [ - { - provide: ImportApiServiceAbstraction, - useClass: ImportApiService, - deps: [ApiService], - }, - { - provide: ImportServiceAbstraction, - useClass: ImportService, - deps: [ - CipherService, - FolderService, - ImportApiServiceAbstraction, - I18nService, - CollectionService, - CryptoService, - ], - }, - ], + providers: safeProviders, }) export class ImportComponent implements OnInit, OnDestroy { featuredImportOptions: ImportOption[];