From fd04be2d9891351dea87c591802ab8a1aced3700 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 12 Jul 2019 14:54:17 -0400 Subject: [PATCH] collection event for autofill --- src/background/main.background.ts | 7 ++++--- src/services/autofill.service.ts | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 496263e0986..8b449e4847b 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -168,9 +168,12 @@ export default class MainBackground { this.syncService = new SyncService(this.userService, this.apiService, this.settingsService, this.folderService, this.cipherService, this.cryptoService, this.collectionService, this.storageService, this.messagingService, async (expired: boolean) => await this.logout(expired)); + this.eventService = new EventService(this.storageService, this.apiService, this.userService, + this.cipherService); this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService); this.totpService = new TotpService(this.storageService, cryptoFunctionService); - this.autofillService = new AutofillService(this.cipherService, this.userService, this.totpService); + this.autofillService = new AutofillService(this.cipherService, this.userService, this.totpService, + this.eventService); this.containerService = new ContainerService(this.cryptoService); this.auditService = new AuditService(cryptoFunctionService, this.apiService); this.exportService = new ExportService(this.folderService, this.cipherService, this.apiService); @@ -180,8 +183,6 @@ export default class MainBackground { this.notificationsService); this.analytics = new Analytics(window, () => BrowserApi.gaFilter(), this.platformUtilsService, this.storageService, this.appIdService); - this.eventService = new EventService(this.storageService, this.apiService, this.userService, - this.cipherService); this.systemService = new SystemService(this.storageService, this.lockService, this.messagingService, this.platformUtilsService, () => { const forceWindowReload = this.platformUtilsService.isSafari() || diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 243d520aa77..35b2700f112 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -17,6 +17,9 @@ import { UserService, } from 'jslib/abstractions'; +import { EventService } from 'jslib/abstractions/event.service'; +import { EventType } from 'jslib/enums/eventType'; + const CardAttributes: string[] = ['autoCompleteType', 'data-stripe', 'htmlName', 'htmlID', 'label-tag', 'placeholder', 'label-left', 'label-top']; @@ -105,7 +108,7 @@ var IsoProvinces: { [id: string]: string; } = { export default class AutofillService implements AutofillServiceInterface { constructor(private cipherService: CipherService, private userService: UserService, - private totpService: TotpService) { } + private totpService: TotpService, private eventService: EventService) { } getFormsWithPasswordFields(pageDetails: AutofillPageDetails): any[] { const formData: any[] = []; @@ -189,6 +192,7 @@ export default class AutofillService implements AutofillServiceInterface { }); if (didAutofill) { + this.eventService.collect(EventType.Cipher_ClientAutofilled, options.cipher.id); if (totpPromise != null) { return await totpPromise; } else {