mirror of
https://github.com/bitwarden/browser
synced 2025-01-12 10:27:20 +01:00
client events for edit page
This commit is contained in:
parent
21e3026f04
commit
803dec26e7
@ -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<boolean> {
|
||||
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user