diff --git a/apps/browser/src/autofill/background/service_factories/autofill-service.factory.ts b/apps/browser/src/autofill/background/service_factories/autofill-service.factory.ts index d62e485722..c948f7aa94 100644 --- a/apps/browser/src/autofill/background/service_factories/autofill-service.factory.ts +++ b/apps/browser/src/autofill/background/service_factories/autofill-service.factory.ts @@ -16,10 +16,6 @@ import { logServiceFactory, LogServiceInitOptions, } from "../../../platform/background/service-factories/log-service.factory"; -import { - stateServiceFactory, - StateServiceInitOptions, -} from "../../../platform/background/service-factories/state-service.factory"; import { cipherServiceFactory, CipherServiceInitOptions, @@ -44,7 +40,6 @@ type AutoFillServiceOptions = FactoryOptions; export type AutoFillServiceInitOptions = AutoFillServiceOptions & CipherServiceInitOptions & - StateServiceInitOptions & AutofillSettingsServiceInitOptions & TotpServiceInitOptions & EventCollectionServiceInitOptions & @@ -63,7 +58,6 @@ export function autofillServiceFactory( async () => new AutofillService( await cipherServiceFactory(cache, opts), - await stateServiceFactory(cache, opts), await autofillSettingsServiceFactory(cache, opts), await totpServiceFactory(cache, opts), await eventCollectionServiceFactory(cache, opts), diff --git a/apps/browser/src/autofill/services/autofill.service.spec.ts b/apps/browser/src/autofill/services/autofill.service.spec.ts index f6c1fa9067..4db64f417d 100644 --- a/apps/browser/src/autofill/services/autofill.service.spec.ts +++ b/apps/browser/src/autofill/services/autofill.service.spec.ts @@ -32,7 +32,6 @@ import { CipherService } from "@bitwarden/common/vault/services/cipher.service"; import { TotpService } from "@bitwarden/common/vault/services/totp.service"; import { BrowserApi } from "../../platform/browser/browser-api"; -import { BrowserStateService } from "../../platform/services/browser-state.service"; import { AutofillPort } from "../enums/autofill-port.enums"; import AutofillField from "../models/autofill-field"; import AutofillPageDetails from "../models/autofill-page-details"; @@ -63,7 +62,6 @@ const mockEquivalentDomains = [ describe("AutofillService", () => { let autofillService: AutofillService; const cipherService = mock(); - const stateService = mock(); const autofillSettingsService = mock(); const mockUserId = Utils.newGuid() as UserId; const accountService: FakeAccountService = mockAccountServiceWith(mockUserId); @@ -78,7 +76,6 @@ describe("AutofillService", () => { beforeEach(() => { autofillService = new AutofillService( cipherService, - stateService, autofillSettingsService, totpService, eventCollectionService, diff --git a/apps/browser/src/autofill/services/autofill.service.ts b/apps/browser/src/autofill/services/autofill.service.ts index dae29e61e4..8b33d03419 100644 --- a/apps/browser/src/autofill/services/autofill.service.ts +++ b/apps/browser/src/autofill/services/autofill.service.ts @@ -20,7 +20,6 @@ import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { FieldView } from "@bitwarden/common/vault/models/view/field.view"; import { BrowserApi } from "../../platform/browser/browser-api"; -import { BrowserStateService } from "../../platform/services/abstractions/browser-state.service"; import { openVaultItemPasswordRepromptPopout } from "../../vault/popup/utils/vault-popout-window"; import { AutofillPort } from "../enums/autofill-port.enums"; import AutofillField from "../models/autofill-field"; @@ -49,7 +48,6 @@ export default class AutofillService implements AutofillServiceInterface { constructor( private cipherService: CipherService, - private stateService: BrowserStateService, private autofillSettingsService: AutofillSettingsServiceAbstraction, private totpService: TotpService, private eventCollectionService: EventCollectionService, diff --git a/apps/browser/src/background/main.background.ts b/apps/browser/src/background/main.background.ts index ea43aecff9..255538de52 100644 --- a/apps/browser/src/background/main.background.ts +++ b/apps/browser/src/background/main.background.ts @@ -767,7 +767,6 @@ export default class MainBackground { this.autofillService = new AutofillService( this.cipherService, - this.stateService, this.autofillSettingsService, this.totpService, this.eventCollectionService, diff --git a/apps/browser/src/popup/services/services.module.ts b/apps/browser/src/popup/services/services.module.ts index 6d0f73f206..e68873e31c 100644 --- a/apps/browser/src/popup/services/services.module.ts +++ b/apps/browser/src/popup/services/services.module.ts @@ -19,6 +19,7 @@ import { AuthRequestServiceAbstraction, LoginStrategyServiceAbstraction, } from "@bitwarden/auth/common"; +import { EventCollectionService as EventCollectionServiceAbstraction } from "@bitwarden/common/abstractions/event/event-collection.service"; import { NotificationsService } from "@bitwarden/common/abstractions/notifications.service"; import { SearchService as SearchServiceAbstraction } from "@bitwarden/common/abstractions/search.service"; import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout-settings.service"; @@ -47,6 +48,7 @@ import { UserNotificationSettingsService, UserNotificationSettingsServiceAbstraction, } from "@bitwarden/common/autofill/services/user-notification-settings.service"; +import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service"; import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service"; @@ -85,7 +87,8 @@ import { DialogService } from "@bitwarden/components"; import { VaultExportServiceAbstraction } from "@bitwarden/vault-export-core"; import { UnauthGuardService } from "../../auth/popup/services"; -import { AutofillService } from "../../autofill/services/abstractions/autofill.service"; +import { AutofillService as AutofillServiceAbstraction } from "../../autofill/services/abstractions/autofill.service"; +import AutofillService from "../../autofill/services/autofill.service"; import MainBackground from "../../background/main.background"; import { Account } from "../../models/account"; import { BrowserApi } from "../../platform/browser/browser-api"; @@ -312,10 +315,22 @@ const safeProviders: SafeProvider[] = [ useClass: BrowserLocalStorageService, deps: [], }), + safeProvider({ + provide: AutofillServiceAbstraction, + useExisting: AutofillService, + }), safeProvider({ provide: AutofillService, - useFactory: getBgService("autofillService"), - deps: [], + deps: [ + CipherService, + AutofillSettingsServiceAbstraction, + TotpService, + EventCollectionServiceAbstraction, + LogService, + DomainSettingsService, + UserVerificationService, + BillingAccountProfileStateService, + ], }), safeProvider({ provide: VaultExportServiceAbstraction,