diff --git a/src/angular/components/add-edit.component.ts b/src/angular/components/add-edit.component.ts index dbfd6b3b39..451abce825 100644 --- a/src/angular/components/add-edit.component.ts +++ b/src/angular/components/add-edit.component.ts @@ -10,6 +10,7 @@ import { } from '@angular/core'; import { CipherType } from '../../enums/cipherType'; +import { EventType } from '../../enums/eventType'; import { FieldType } from '../../enums/fieldType'; import { OrganizationUserStatusType } from '../../enums/organizationUserStatusType'; import { SecureNoteType } from '../../enums/secureNoteType'; @@ -18,6 +19,7 @@ import { UriMatchType } from '../../enums/uriMatchType'; import { AuditService } from '../../abstractions/audit.service'; import { CipherService } from '../../abstractions/cipher.service'; import { CollectionService } from '../../abstractions/collection.service'; +import { EventService } from '../../abstractions/event.service'; import { FolderService } from '../../abstractions/folder.service'; import { I18nService } from '../../abstractions/i18n.service'; import { MessagingService } from '../../abstractions/messaging.service'; @@ -75,12 +77,13 @@ export class AddEditComponent implements OnInit { ownershipOptions: any[] = []; protected writeableCollections: CollectionView[]; + private previousCipherId: string; constructor(protected cipherService: CipherService, protected folderService: FolderService, protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService, protected auditService: AuditService, protected stateService: StateService, protected userService: UserService, protected collectionService: CollectionService, - protected messagingService: MessagingService) { + protected messagingService: MessagingService, protected eventService: EventService) { this.typeOptions = [ { name: i18nService.t('typeLogin'), value: CipherType.Login }, { name: i18nService.t('typeCard'), value: CipherType.Card }, @@ -199,6 +202,11 @@ export class AddEditComponent implements OnInit { } this.folders = await this.folderService.getAllDecrypted(); + + if (this.editMode && this.previousCipherId !== this.cipherId) { + this.eventService.collect(EventType.Cipher_ClientViewed, this.cipherId); + } + this.previousCipherId = this.cipherId; } async submit(): Promise { @@ -333,17 +341,26 @@ export class AddEditComponent implements OnInit { this.platformUtilsService.eventTrack('Toggled Password on Edit'); this.showPassword = !this.showPassword; document.getElementById('loginPassword').focus(); + if (this.editMode && this.showPassword) { + this.eventService.collect(EventType.Cipher_ClientToggledPasswordVisible, this.cipherId); + } } toggleCardCode() { this.platformUtilsService.eventTrack('Toggled CardCode on Edit'); this.showCardCode = !this.showCardCode; document.getElementById('cardCode').focus(); + if (this.editMode && this.showCardCode) { + this.eventService.collect(EventType.Cipher_ClientToggledCardCodeVisible, this.cipherId); + } } toggleFieldValue(field: FieldView) { const f = (field as any); f.showValue = !f.showValue; + if (this.editMode && f.showValue) { + this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, this.cipherId); + } } toggleUriOptions(uri: LoginUriView) {