mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
client events for edit page
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { CipherType } from '../../enums/cipherType';
|
import { CipherType } from '../../enums/cipherType';
|
||||||
|
import { EventType } from '../../enums/eventType';
|
||||||
import { FieldType } from '../../enums/fieldType';
|
import { FieldType } from '../../enums/fieldType';
|
||||||
import { OrganizationUserStatusType } from '../../enums/organizationUserStatusType';
|
import { OrganizationUserStatusType } from '../../enums/organizationUserStatusType';
|
||||||
import { SecureNoteType } from '../../enums/secureNoteType';
|
import { SecureNoteType } from '../../enums/secureNoteType';
|
||||||
@@ -18,6 +19,7 @@ import { UriMatchType } from '../../enums/uriMatchType';
|
|||||||
import { AuditService } from '../../abstractions/audit.service';
|
import { AuditService } from '../../abstractions/audit.service';
|
||||||
import { CipherService } from '../../abstractions/cipher.service';
|
import { CipherService } from '../../abstractions/cipher.service';
|
||||||
import { CollectionService } from '../../abstractions/collection.service';
|
import { CollectionService } from '../../abstractions/collection.service';
|
||||||
|
import { EventService } from '../../abstractions/event.service';
|
||||||
import { FolderService } from '../../abstractions/folder.service';
|
import { FolderService } from '../../abstractions/folder.service';
|
||||||
import { I18nService } from '../../abstractions/i18n.service';
|
import { I18nService } from '../../abstractions/i18n.service';
|
||||||
import { MessagingService } from '../../abstractions/messaging.service';
|
import { MessagingService } from '../../abstractions/messaging.service';
|
||||||
@@ -75,12 +77,13 @@ export class AddEditComponent implements OnInit {
|
|||||||
ownershipOptions: any[] = [];
|
ownershipOptions: any[] = [];
|
||||||
|
|
||||||
protected writeableCollections: CollectionView[];
|
protected writeableCollections: CollectionView[];
|
||||||
|
private previousCipherId: string;
|
||||||
|
|
||||||
constructor(protected cipherService: CipherService, protected folderService: FolderService,
|
constructor(protected cipherService: CipherService, protected folderService: FolderService,
|
||||||
protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService,
|
protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService,
|
||||||
protected auditService: AuditService, protected stateService: StateService,
|
protected auditService: AuditService, protected stateService: StateService,
|
||||||
protected userService: UserService, protected collectionService: CollectionService,
|
protected userService: UserService, protected collectionService: CollectionService,
|
||||||
protected messagingService: MessagingService) {
|
protected messagingService: MessagingService, protected eventService: EventService) {
|
||||||
this.typeOptions = [
|
this.typeOptions = [
|
||||||
{ name: i18nService.t('typeLogin'), value: CipherType.Login },
|
{ name: i18nService.t('typeLogin'), value: CipherType.Login },
|
||||||
{ name: i18nService.t('typeCard'), value: CipherType.Card },
|
{ name: i18nService.t('typeCard'), value: CipherType.Card },
|
||||||
@@ -199,6 +202,11 @@ export class AddEditComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.folders = await this.folderService.getAllDecrypted();
|
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> {
|
async submit(): Promise<boolean> {
|
||||||
@@ -333,17 +341,26 @@ export class AddEditComponent implements OnInit {
|
|||||||
this.platformUtilsService.eventTrack('Toggled Password on Edit');
|
this.platformUtilsService.eventTrack('Toggled Password on Edit');
|
||||||
this.showPassword = !this.showPassword;
|
this.showPassword = !this.showPassword;
|
||||||
document.getElementById('loginPassword').focus();
|
document.getElementById('loginPassword').focus();
|
||||||
|
if (this.editMode && this.showPassword) {
|
||||||
|
this.eventService.collect(EventType.Cipher_ClientToggledPasswordVisible, this.cipherId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleCardCode() {
|
toggleCardCode() {
|
||||||
this.platformUtilsService.eventTrack('Toggled CardCode on Edit');
|
this.platformUtilsService.eventTrack('Toggled CardCode on Edit');
|
||||||
this.showCardCode = !this.showCardCode;
|
this.showCardCode = !this.showCardCode;
|
||||||
document.getElementById('cardCode').focus();
|
document.getElementById('cardCode').focus();
|
||||||
|
if (this.editMode && this.showCardCode) {
|
||||||
|
this.eventService.collect(EventType.Cipher_ClientToggledCardCodeVisible, this.cipherId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleFieldValue(field: FieldView) {
|
toggleFieldValue(field: FieldView) {
|
||||||
const f = (field as any);
|
const f = (field as any);
|
||||||
f.showValue = !f.showValue;
|
f.showValue = !f.showValue;
|
||||||
|
if (this.editMode && f.showValue) {
|
||||||
|
this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, this.cipherId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleUriOptions(uri: LoginUriView) {
|
toggleUriOptions(uri: LoginUriView) {
|
||||||
|
|||||||
Reference in New Issue
Block a user