export vault event

This commit is contained in:
Kyle Spearrin 2019-07-12 17:11:36 -04:00
parent 803dec26e7
commit 84aab0cb24
2 changed files with 9 additions and 1 deletions

View File

@ -4,9 +4,11 @@ import {
} from '@angular/core';
import { CryptoService } from '../../abstractions/crypto.service';
import { EventService } from '../../abstractions/event.service';
import { ExportService } from '../../abstractions/export.service';
import { I18nService } from '../../abstractions/i18n.service';
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
import { EventType } from '../../enums/eventType';
export class ExportComponent {
@Output() onSaved = new EventEmitter();
@ -18,7 +20,7 @@ export class ExportComponent {
constructor(protected cryptoService: CryptoService, protected i18nService: I18nService,
protected platformUtilsService: PlatformUtilsService, protected exportService: ExportService,
protected win: Window) { }
protected eventService: EventService, protected win: Window) { }
async submit() {
if (this.masterPassword == null || this.masterPassword === '') {
@ -36,6 +38,7 @@ export class ExportComponent {
this.platformUtilsService.eventTrack('Exported Data');
this.downloadFile(data);
this.saved();
await this.collectEvent();
} catch { }
} else {
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
@ -61,6 +64,10 @@ export class ExportComponent {
return this.exportService.getFileName(prefix, this.format);
}
protected async collectEvent(): Promise<any> {
await this.eventService.collect(EventType.User_ClientExportedVault);
}
private downloadFile(csv: string): void {
const fileName = this.getFileName();
this.platformUtilsService.saveFile(this.win, csv, { type: 'text/plain' }, fileName);

View File

@ -40,4 +40,5 @@ export enum EventType {
Organization_Updated = 1600,
Organization_PurgedVault = 1601,
Organization_ClientExportedVault = 1602,
}