mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 01:03:35 +00:00
add back events for browser refresh extension (#11085)
- something went sideways in a merge
This commit is contained in:
@@ -2,10 +2,12 @@ import { CommonModule } from "@angular/common";
|
||||
import { Component, Input, OnInit } from "@angular/core";
|
||||
|
||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||
import { EventType } from "@bitwarden/common/enums";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { CipherType, FieldType, LinkedIdType } from "@bitwarden/common/vault/enums";
|
||||
import { CardView } from "@bitwarden/common/vault/models/view/card.view";
|
||||
import { FieldView } from "@bitwarden/common/vault/models/view/field.view";
|
||||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||
import { IdentityView } from "@bitwarden/common/vault/models/view/identity.view";
|
||||
import { LoginView } from "@bitwarden/common/vault/models/view/login.view";
|
||||
import {
|
||||
@@ -37,12 +39,14 @@ import {
|
||||
],
|
||||
})
|
||||
export class CustomFieldV2Component implements OnInit {
|
||||
@Input() fields: FieldView[];
|
||||
@Input() cipherType: CipherType;
|
||||
@Input() cipher: CipherView;
|
||||
fieldType = FieldType;
|
||||
fieldOptions: any;
|
||||
|
||||
constructor(private i18nService: I18nService) {}
|
||||
constructor(
|
||||
private i18nService: I18nService,
|
||||
private eventCollectionService: EventCollectionService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.fieldOptions = this.getLinkedFieldsOptionsForCipher();
|
||||
@@ -53,8 +57,28 @@ export class CustomFieldV2Component implements OnInit {
|
||||
return this.i18nService.t(linkedType.i18nKey);
|
||||
}
|
||||
|
||||
async logHiddenEvent(hiddenFieldVisible: boolean) {
|
||||
if (hiddenFieldVisible) {
|
||||
await this.eventCollectionService.collect(
|
||||
EventType.Cipher_ClientToggledHiddenFieldVisible,
|
||||
this.cipher.id,
|
||||
false,
|
||||
this.cipher.organizationId,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async logCopyEvent() {
|
||||
await this.eventCollectionService.collect(
|
||||
EventType.Cipher_ClientCopiedHiddenField,
|
||||
this.cipher.id,
|
||||
false,
|
||||
this.cipher.organizationId,
|
||||
);
|
||||
}
|
||||
|
||||
private getLinkedFieldsOptionsForCipher() {
|
||||
switch (this.cipherType) {
|
||||
switch (this.cipher.type) {
|
||||
case CipherType.Login:
|
||||
return LoginView.prototype.linkedFieldOptions;
|
||||
case CipherType.Card:
|
||||
|
||||
Reference in New Issue
Block a user