From 6263a11463b13625613a525e8bdd12e9b7c0553d Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 12 Jul 2019 15:00:20 -0400 Subject: [PATCH] log event when copying from list --- src/popup/components/action-buttons.component.html | 13 ++++++++----- src/popup/components/action-buttons.component.ts | 12 ++++++++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/popup/components/action-buttons.component.html b/src/popup/components/action-buttons.component.html index 4d4772201f..866c396bbd 100644 --- a/src/popup/components/action-buttons.component.html +++ b/src/popup/components/action-buttons.component.html @@ -7,27 +7,30 @@ + (click)="copy(cipher, cipher.login.username, 'username', 'Username')" + [ngClass]="{disabled: !cipher.login.username}"> + (click)="copy(cipher, cipher.login.password, 'password', 'Password')" + [ngClass]="{disabled: !cipher.login.password}"> + (click)="copy(cipher, cipher.card.number, 'number', 'Card Number')" [ngClass]="{disabled: !cipher.card.number}"> + (click)="copy(cipher, cipher.card.code, 'securityCode', 'Security Code')" + [ngClass]="{disabled: !cipher.card.code}"> + (click)="copy(cipher, cipher.notes, 'note', 'Note')" [ngClass]="{disabled: !cipher.notes}"> diff --git a/src/popup/components/action-buttons.component.ts b/src/popup/components/action-buttons.component.ts index d09260f8d4..0401b41e33 100644 --- a/src/popup/components/action-buttons.component.ts +++ b/src/popup/components/action-buttons.component.ts @@ -11,9 +11,11 @@ import { Angulartics2 } from 'angulartics2'; import { BrowserApi } from '../../browser/browserApi'; import { CipherType } from 'jslib/enums/cipherType'; +import { EventType } from 'jslib/enums/eventType'; import { CipherView } from 'jslib/models/view/cipherView'; +import { EventService } from 'jslib/abstractions/event.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; @@ -32,7 +34,7 @@ export class ActionButtonsComponent { constructor(private analytics: Angulartics2, private toasterService: ToasterService, private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, - private popupUtilsService: PopupUtilsService) { } + private popupUtilsService: PopupUtilsService, private eventService: EventService) { } launch() { if (this.cipher.type !== CipherType.Login || !this.cipher.login.canLaunch) { @@ -46,7 +48,7 @@ export class ActionButtonsComponent { } } - copy(value: string, typeI18nKey: string, aType: string) { + copy(cipher: CipherView, value: string, typeI18nKey: string, aType: string) { if (value == null) { return; } @@ -55,6 +57,12 @@ export class ActionButtonsComponent { this.platformUtilsService.copyToClipboard(value, { window: window }); this.toasterService.popAsync('info', null, this.i18nService.t('valueCopied', this.i18nService.t(typeI18nKey))); + + if (typeI18nKey === 'password') { + this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, cipher.id); + } else if (typeI18nKey === 'securityCode') { + this.eventService.collect(EventType.Cipher_ClientCopiedCardCode, cipher.id); + } } view() {