mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
Remove last remnants of old analytics code (#345)
This commit is contained in:
@@ -12,7 +12,6 @@ export abstract class PlatformUtilsService {
|
|||||||
isSafari: () => boolean;
|
isSafari: () => boolean;
|
||||||
isIE: () => boolean;
|
isIE: () => boolean;
|
||||||
isMacAppStore: () => boolean;
|
isMacAppStore: () => boolean;
|
||||||
analyticsId: () => string;
|
|
||||||
isViewOpen: () => Promise<boolean>;
|
isViewOpen: () => Promise<boolean>;
|
||||||
/**
|
/**
|
||||||
* @deprecated This only ever returns null. Pull from your platform's storage using ConstantsService.vaultTimeoutKey
|
* @deprecated This only ever returns null. Pull from your platform's storage using ConstantsService.vaultTimeoutKey
|
||||||
@@ -27,7 +26,6 @@ export abstract class PlatformUtilsService {
|
|||||||
options?: any) => void;
|
options?: any) => void;
|
||||||
showDialog: (body: string, title?: string, confirmText?: string, cancelText?: string,
|
showDialog: (body: string, title?: string, confirmText?: string, cancelText?: string,
|
||||||
type?: string, bodyIsHtml?: boolean) => Promise<boolean>;
|
type?: string, bodyIsHtml?: boolean) => Promise<boolean>;
|
||||||
eventTrack: (action: string, label?: string, options?: any) => void;
|
|
||||||
isDev: () => boolean;
|
isDev: () => boolean;
|
||||||
isSelfHost: () => boolean;
|
isSelfHost: () => boolean;
|
||||||
copyToClipboard: (text: string, options?: any) => void;
|
copyToClipboard: (text: string, options?: any) => void;
|
||||||
|
|||||||
@@ -286,7 +286,6 @@ export class AddEditComponent implements OnInit {
|
|||||||
this.formPromise = this.saveCipher(cipher);
|
this.formPromise = this.saveCipher(cipher);
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.cipher.id = cipher.id;
|
this.cipher.id = cipher.id;
|
||||||
this.platformUtilsService.eventTrack(this.editMode && !this.cloneMode ? 'Edited Cipher' : 'Added Cipher');
|
|
||||||
this.platformUtilsService.showToast('success', null,
|
this.platformUtilsService.showToast('success', null,
|
||||||
this.i18nService.t(this.editMode && !this.cloneMode ? 'editedItem' : 'addedItem'));
|
this.i18nService.t(this.editMode && !this.cloneMode ? 'editedItem' : 'addedItem'));
|
||||||
this.onSavedCipher.emit(this.cipher);
|
this.onSavedCipher.emit(this.cipher);
|
||||||
@@ -369,7 +368,6 @@ export class AddEditComponent implements OnInit {
|
|||||||
try {
|
try {
|
||||||
this.deletePromise = this.deleteCipher();
|
this.deletePromise = this.deleteCipher();
|
||||||
await this.deletePromise;
|
await this.deletePromise;
|
||||||
this.platformUtilsService.eventTrack((this.cipher.isDeleted ? 'Permanently ' : '') + 'Deleted Cipher');
|
|
||||||
this.platformUtilsService.showToast('success', null,
|
this.platformUtilsService.showToast('success', null,
|
||||||
this.i18nService.t(this.cipher.isDeleted ? 'permanentlyDeletedItem' : 'deletedItem'));
|
this.i18nService.t(this.cipher.isDeleted ? 'permanentlyDeletedItem' : 'deletedItem'));
|
||||||
this.onDeletedCipher.emit(this.cipher);
|
this.onDeletedCipher.emit(this.cipher);
|
||||||
@@ -394,7 +392,6 @@ export class AddEditComponent implements OnInit {
|
|||||||
try {
|
try {
|
||||||
this.restorePromise = this.restoreCipher();
|
this.restorePromise = this.restoreCipher();
|
||||||
await this.restorePromise;
|
await this.restorePromise;
|
||||||
this.platformUtilsService.eventTrack('Restored Cipher');
|
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('restoredItem'));
|
this.platformUtilsService.showToast('success', null, this.i18nService.t('restoredItem'));
|
||||||
this.onRestoredCipher.emit(this.cipher);
|
this.onRestoredCipher.emit(this.cipher);
|
||||||
this.messagingService.send('restoredCipher');
|
this.messagingService.send('restoredCipher');
|
||||||
@@ -418,7 +415,6 @@ export class AddEditComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
togglePassword() {
|
togglePassword() {
|
||||||
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) {
|
if (this.editMode && this.showPassword) {
|
||||||
@@ -427,7 +423,6 @@ export class AddEditComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toggleCardCode() {
|
toggleCardCode() {
|
||||||
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) {
|
if (this.editMode && this.showCardCode) {
|
||||||
@@ -481,7 +476,6 @@ export class AddEditComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.platformUtilsService.eventTrack('Check Password');
|
|
||||||
this.checkPasswordPromise = this.auditService.passwordLeaked(this.cipher.login.password);
|
this.checkPasswordPromise = this.auditService.passwordLeaked(this.cipher.login.password);
|
||||||
const matches = await this.checkPasswordPromise;
|
const matches = await this.checkPasswordPromise;
|
||||||
this.checkPasswordPromise = null;
|
this.checkPasswordPromise = null;
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ export class AttachmentsComponent implements OnInit {
|
|||||||
this.formPromise = this.saveCipherAttachment(files[0]);
|
this.formPromise = this.saveCipherAttachment(files[0]);
|
||||||
this.cipherDomain = await this.formPromise;
|
this.cipherDomain = await this.formPromise;
|
||||||
this.cipher = await this.cipherDomain.decrypt();
|
this.cipher = await this.cipherDomain.decrypt();
|
||||||
this.platformUtilsService.eventTrack('Added Attachment');
|
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('attachmentSaved'));
|
this.platformUtilsService.showToast('success', null, this.i18nService.t('attachmentSaved'));
|
||||||
this.onUploadedAttachment.emit();
|
this.onUploadedAttachment.emit();
|
||||||
} catch { }
|
} catch { }
|
||||||
@@ -96,7 +95,6 @@ export class AttachmentsComponent implements OnInit {
|
|||||||
try {
|
try {
|
||||||
this.deletePromises[attachment.id] = this.deleteCipherAttachment(attachment.id);
|
this.deletePromises[attachment.id] = this.deleteCipherAttachment(attachment.id);
|
||||||
await this.deletePromises[attachment.id];
|
await this.deletePromises[attachment.id];
|
||||||
this.platformUtilsService.eventTrack('Deleted Attachment');
|
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('deletedAttachment'));
|
this.platformUtilsService.showToast('success', null, this.i18nService.t('deletedAttachment'));
|
||||||
const i = this.cipher.attachments.indexOf(attachment);
|
const i = this.cipher.attachments.indexOf(attachment);
|
||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
@@ -219,7 +217,6 @@ export class AttachmentsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.platformUtilsService.eventTrack('Reuploaded Attachment');
|
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('attachmentSaved'));
|
this.platformUtilsService.showToast('success', null, this.i18nService.t('attachmentSaved'));
|
||||||
this.onReuploadedAttachment.emit();
|
this.onReuploadedAttachment.emit();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ export class CollectionsComponent implements OnInit {
|
|||||||
this.formPromise = this.saveCollections();
|
this.formPromise = this.saveCollections();
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.onSavedCollections.emit();
|
this.onSavedCollections.emit();
|
||||||
this.platformUtilsService.eventTrack('Edited Cipher Collections');
|
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('editedItem'));
|
this.platformUtilsService.showToast('success', null, this.i18nService.t('editedItem'));
|
||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ export class EnvironmentComponent {
|
|||||||
this.notificationsUrl = resUrls.notifications;
|
this.notificationsUrl = resUrls.notifications;
|
||||||
this.enterpriseUrl = resUrls.enterprise;
|
this.enterpriseUrl = resUrls.enterprise;
|
||||||
|
|
||||||
this.platformUtilsService.eventTrack('Set Environment URLs');
|
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('environmentSaved'));
|
this.platformUtilsService.showToast('success', null, this.i18nService.t('environmentSaved'));
|
||||||
this.saved();
|
this.saved();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ export class ExportComponent {
|
|||||||
try {
|
try {
|
||||||
this.formPromise = this.getExportData();
|
this.formPromise = this.getExportData();
|
||||||
const data = await this.formPromise;
|
const data = await this.formPromise;
|
||||||
this.platformUtilsService.eventTrack('Exported Data');
|
|
||||||
this.downloadFile(data);
|
this.downloadFile(data);
|
||||||
this.saved();
|
this.saved();
|
||||||
await this.collectEvent();
|
await this.collectEvent();
|
||||||
@@ -74,7 +73,6 @@ export class ExportComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
togglePassword() {
|
togglePassword() {
|
||||||
this.platformUtilsService.eventTrack('Toggled Master Password on Export');
|
|
||||||
this.showPassword = !this.showPassword;
|
this.showPassword = !this.showPassword;
|
||||||
document.getElementById('masterPassword').focus();
|
document.getElementById('masterPassword').focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ export class FolderAddEditComponent implements OnInit {
|
|||||||
const folder = await this.folderService.encrypt(this.folder);
|
const folder = await this.folderService.encrypt(this.folder);
|
||||||
this.formPromise = this.folderService.saveWithServer(folder);
|
this.formPromise = this.folderService.saveWithServer(folder);
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.platformUtilsService.eventTrack(this.editMode ? 'Edited Folder' : 'Added Folder');
|
|
||||||
this.platformUtilsService.showToast('success', null,
|
this.platformUtilsService.showToast('success', null,
|
||||||
this.i18nService.t(this.editMode ? 'editedFolder' : 'addedFolder'));
|
this.i18nService.t(this.editMode ? 'editedFolder' : 'addedFolder'));
|
||||||
this.onSavedFolder.emit(this.folder);
|
this.onSavedFolder.emit(this.folder);
|
||||||
@@ -63,7 +62,6 @@ export class FolderAddEditComponent implements OnInit {
|
|||||||
try {
|
try {
|
||||||
this.deletePromise = this.folderService.deleteWithServer(this.folder.id);
|
this.deletePromise = this.folderService.deleteWithServer(this.folder.id);
|
||||||
await this.deletePromise;
|
await this.deletePromise;
|
||||||
this.platformUtilsService.eventTrack('Deleted Folder');
|
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('deletedFolder'));
|
this.platformUtilsService.showToast('success', null, this.i18nService.t('deletedFolder'));
|
||||||
this.onDeletedFolder.emit(this.folder);
|
this.onDeletedFolder.emit(this.folder);
|
||||||
} catch { }
|
} catch { }
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ export class HintComponent {
|
|||||||
try {
|
try {
|
||||||
this.formPromise = this.apiService.postPasswordHint(new PasswordHintRequest(this.email));
|
this.formPromise = this.apiService.postPasswordHint(new PasswordHintRequest(this.email));
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.platformUtilsService.eventTrack('Requested Hint');
|
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('masterPassSent'));
|
this.platformUtilsService.showToast('success', null, this.i18nService.t('masterPassSent'));
|
||||||
if (this.onSuccessfulSubmit != null) {
|
if (this.onSuccessfulSubmit != null) {
|
||||||
this.onSuccessfulSubmit();
|
this.onSuccessfulSubmit();
|
||||||
|
|||||||
@@ -164,7 +164,6 @@ export class LockComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
togglePassword() {
|
togglePassword() {
|
||||||
this.platformUtilsService.eventTrack('Toggled Master Password on Unlock');
|
|
||||||
this.showPassword = !this.showPassword;
|
this.showPassword = !this.showPassword;
|
||||||
document.getElementById(this.pinLock ? 'pin' : 'masterPassword').focus();
|
document.getElementById(this.pinLock ? 'pin' : 'masterPassword').focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ export class LoginComponent implements OnInit {
|
|||||||
await this.storageService.remove(Keys.rememberedEmail);
|
await this.storageService.remove(Keys.rememberedEmail);
|
||||||
}
|
}
|
||||||
if (response.twoFactor) {
|
if (response.twoFactor) {
|
||||||
this.platformUtilsService.eventTrack('Logged In To Two-step');
|
|
||||||
if (this.onSuccessfulLoginTwoFactorNavigate != null) {
|
if (this.onSuccessfulLoginTwoFactorNavigate != null) {
|
||||||
this.onSuccessfulLoginTwoFactorNavigate();
|
this.onSuccessfulLoginTwoFactorNavigate();
|
||||||
} else {
|
} else {
|
||||||
@@ -102,7 +101,6 @@ export class LoginComponent implements OnInit {
|
|||||||
if (this.onSuccessfulLogin != null) {
|
if (this.onSuccessfulLogin != null) {
|
||||||
this.onSuccessfulLogin();
|
this.onSuccessfulLogin();
|
||||||
}
|
}
|
||||||
this.platformUtilsService.eventTrack('Logged In');
|
|
||||||
if (this.onSuccessfulLoginNavigate != null) {
|
if (this.onSuccessfulLoginNavigate != null) {
|
||||||
this.onSuccessfulLoginNavigate();
|
this.onSuccessfulLoginNavigate();
|
||||||
} else {
|
} else {
|
||||||
@@ -113,7 +111,6 @@ export class LoginComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
togglePassword() {
|
togglePassword() {
|
||||||
this.platformUtilsService.eventTrack('Toggled Master Password on Login');
|
|
||||||
this.showPassword = !this.showPassword;
|
this.showPassword = !this.showPassword;
|
||||||
document.getElementById('masterPassword').focus();
|
document.getElementById('masterPassword').focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ export class PasswordGeneratorHistoryComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
copy(password: string) {
|
copy(password: string) {
|
||||||
this.platformUtilsService.eventTrack('Copied Historical Password');
|
|
||||||
const copyOptions = this.win != null ? { window: this.win } : null;
|
const copyOptions = this.win != null ? { window: this.win } : null;
|
||||||
this.platformUtilsService.copyToClipboard(password, copyOptions);
|
this.platformUtilsService.copyToClipboard(password, copyOptions);
|
||||||
this.platformUtilsService.showToast('info', null,
|
this.platformUtilsService.showToast('info', null,
|
||||||
|
|||||||
@@ -34,14 +34,12 @@ export class PasswordGeneratorComponent implements OnInit {
|
|||||||
this.avoidAmbiguous = !this.options.ambiguous;
|
this.avoidAmbiguous = !this.options.ambiguous;
|
||||||
this.options.type = this.options.type === 'passphrase' ? 'passphrase' : 'password';
|
this.options.type = this.options.type === 'passphrase' ? 'passphrase' : 'password';
|
||||||
this.password = await this.passwordGenerationService.generatePassword(this.options);
|
this.password = await this.passwordGenerationService.generatePassword(this.options);
|
||||||
this.platformUtilsService.eventTrack('Generated Password');
|
|
||||||
await this.passwordGenerationService.addHistory(this.password);
|
await this.passwordGenerationService.addHistory(this.password);
|
||||||
}
|
}
|
||||||
|
|
||||||
async sliderChanged() {
|
async sliderChanged() {
|
||||||
this.saveOptions(false);
|
this.saveOptions(false);
|
||||||
await this.passwordGenerationService.addHistory(this.password);
|
await this.passwordGenerationService.addHistory(this.password);
|
||||||
this.platformUtilsService.eventTrack('Regenerated Password');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async sliderInput() {
|
async sliderInput() {
|
||||||
@@ -61,11 +59,9 @@ export class PasswordGeneratorComponent implements OnInit {
|
|||||||
async regenerate() {
|
async regenerate() {
|
||||||
this.password = await this.passwordGenerationService.generatePassword(this.options);
|
this.password = await this.passwordGenerationService.generatePassword(this.options);
|
||||||
await this.passwordGenerationService.addHistory(this.password);
|
await this.passwordGenerationService.addHistory(this.password);
|
||||||
this.platformUtilsService.eventTrack('Regenerated Password');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
copy() {
|
copy() {
|
||||||
this.platformUtilsService.eventTrack('Copied Generated Password');
|
|
||||||
const copyOptions = this.win != null ? { window: this.win } : null;
|
const copyOptions = this.win != null ? { window: this.win } : null;
|
||||||
this.platformUtilsService.copyToClipboard(this.password, copyOptions);
|
this.platformUtilsService.copyToClipboard(this.password, copyOptions);
|
||||||
this.platformUtilsService.showToast('info', null,
|
this.platformUtilsService.showToast('info', null,
|
||||||
@@ -73,7 +69,6 @@ export class PasswordGeneratorComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
select() {
|
select() {
|
||||||
this.platformUtilsService.eventTrack('Selected Generated Password');
|
|
||||||
this.onSelected.emit(this.password);
|
this.onSelected.emit(this.password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ export class PasswordHistoryComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
copy(password: string) {
|
copy(password: string) {
|
||||||
this.platformUtilsService.eventTrack('Copied Password History');
|
|
||||||
const copyOptions = this.win != null ? { window: this.win } : null;
|
const copyOptions = this.win != null ? { window: this.win } : null;
|
||||||
this.platformUtilsService.copyToClipboard(password, copyOptions);
|
this.platformUtilsService.copyToClipboard(password, copyOptions);
|
||||||
this.platformUtilsService.showToast('info', null,
|
this.platformUtilsService.showToast('info', null,
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ export class PremiumComponent implements OnInit {
|
|||||||
const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('premiumPurchaseAlert'),
|
const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('premiumPurchaseAlert'),
|
||||||
this.i18nService.t('premiumPurchase'), this.i18nService.t('yes'), this.i18nService.t('cancel'));
|
this.i18nService.t('premiumPurchase'), this.i18nService.t('yes'), this.i18nService.t('cancel'));
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
this.platformUtilsService.eventTrack('Clicked Purchase Premium');
|
|
||||||
this.platformUtilsService.launchUri('https://vault.bitwarden.com/#/?premium=purchase');
|
this.platformUtilsService.launchUri('https://vault.bitwarden.com/#/?premium=purchase');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,7 +39,6 @@ export class PremiumComponent implements OnInit {
|
|||||||
const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('premiumManageAlert'),
|
const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('premiumManageAlert'),
|
||||||
this.i18nService.t('premiumManage'), this.i18nService.t('yes'), this.i18nService.t('cancel'));
|
this.i18nService.t('premiumManage'), this.i18nService.t('yes'), this.i18nService.t('cancel'));
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
this.platformUtilsService.eventTrack('Clicked Manage Membership');
|
|
||||||
this.platformUtilsService.launchUri('https://vault.bitwarden.com/#/?premium=manage');
|
this.platformUtilsService.launchUri('https://vault.bitwarden.com/#/?premium=manage');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,14 +138,12 @@ export class RegisterComponent {
|
|||||||
try {
|
try {
|
||||||
this.formPromise = this.apiService.postRegister(request);
|
this.formPromise = this.apiService.postRegister(request);
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.platformUtilsService.eventTrack('Registered');
|
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('newAccountCreated'));
|
this.platformUtilsService.showToast('success', null, this.i18nService.t('newAccountCreated'));
|
||||||
this.router.navigate([this.successRoute], { queryParams: { email: this.email } });
|
this.router.navigate([this.successRoute], { queryParams: { email: this.email } });
|
||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
togglePassword(confirmField: boolean) {
|
togglePassword(confirmField: boolean) {
|
||||||
this.platformUtilsService.eventTrack('Toggled Master Password on Register');
|
|
||||||
this.showPassword = !this.showPassword;
|
this.showPassword = !this.showPassword;
|
||||||
document.getElementById(confirmField ? 'masterPasswordRetype' : 'masterPassword').focus();
|
document.getElementById(confirmField ? 'masterPasswordRetype' : 'masterPassword').focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
togglePassword(confirmField: boolean) {
|
togglePassword(confirmField: boolean) {
|
||||||
this.platformUtilsService.eventTrack('Toggled Master Password on Set Password');
|
|
||||||
this.showPassword = !this.showPassword;
|
this.showPassword = !this.showPassword;
|
||||||
document.getElementById(confirmField ? 'masterPasswordRetype' : 'masterPassword').focus();
|
document.getElementById(confirmField ? 'masterPasswordRetype' : 'masterPassword').focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ export class ShareComponent implements OnInit {
|
|||||||
this.formPromise = this.cipherService.shareWithServer(cipherView, this.organizationId,
|
this.formPromise = this.cipherService.shareWithServer(cipherView, this.organizationId,
|
||||||
selectedCollectionIds).then(async () => {
|
selectedCollectionIds).then(async () => {
|
||||||
this.onSharedCipher.emit();
|
this.onSharedCipher.emit();
|
||||||
this.platformUtilsService.eventTrack('Shared Cipher');
|
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('sharedItem'));
|
this.platformUtilsService.showToast('success', null, this.i18nService.t('sharedItem'));
|
||||||
});
|
});
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
|
|||||||
@@ -138,7 +138,6 @@ export class SsoComponent {
|
|||||||
this.formPromise = this.authService.logInSso(code, codeVerifier, this.redirectUri);
|
this.formPromise = this.authService.logInSso(code, codeVerifier, this.redirectUri);
|
||||||
const response = await this.formPromise;
|
const response = await this.formPromise;
|
||||||
if (response.twoFactor) {
|
if (response.twoFactor) {
|
||||||
this.platformUtilsService.eventTrack('SSO Logged In To Two-step');
|
|
||||||
if (this.onSuccessfulLoginTwoFactorNavigate != null) {
|
if (this.onSuccessfulLoginTwoFactorNavigate != null) {
|
||||||
this.onSuccessfulLoginTwoFactorNavigate();
|
this.onSuccessfulLoginTwoFactorNavigate();
|
||||||
} else {
|
} else {
|
||||||
@@ -150,7 +149,6 @@ export class SsoComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (response.resetMasterPassword) {
|
} else if (response.resetMasterPassword) {
|
||||||
this.platformUtilsService.eventTrack('SSO - routing to complete registration');
|
|
||||||
if (this.onSuccessfulLoginChangePasswordNavigate != null) {
|
if (this.onSuccessfulLoginChangePasswordNavigate != null) {
|
||||||
this.onSuccessfulLoginChangePasswordNavigate();
|
this.onSuccessfulLoginChangePasswordNavigate();
|
||||||
} else {
|
} else {
|
||||||
@@ -166,7 +164,6 @@ export class SsoComponent {
|
|||||||
if (this.onSuccessfulLogin != null) {
|
if (this.onSuccessfulLogin != null) {
|
||||||
this.onSuccessfulLogin();
|
this.onSuccessfulLogin();
|
||||||
}
|
}
|
||||||
this.platformUtilsService.eventTrack('SSO Logged In');
|
|
||||||
if (this.onSuccessfulLoginNavigate != null) {
|
if (this.onSuccessfulLoginNavigate != null) {
|
||||||
this.onSuccessfulLoginNavigate();
|
this.onSuccessfulLoginNavigate();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ export class TwoFactorOptionsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
recover() {
|
recover() {
|
||||||
this.platformUtilsService.eventTrack('Selected Recover');
|
|
||||||
this.platformUtilsService.launchUri('https://help.bitwarden.com/article/lost-two-step-device/');
|
this.platformUtilsService.launchUri('https://help.bitwarden.com/article/lost-two-step-device/');
|
||||||
this.onRecoverSelected.emit();
|
this.onRecoverSelected.emit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,7 +187,6 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
|
|||||||
if (this.onSuccessfulLogin != null) {
|
if (this.onSuccessfulLogin != null) {
|
||||||
this.onSuccessfulLogin();
|
this.onSuccessfulLogin();
|
||||||
}
|
}
|
||||||
this.platformUtilsService.eventTrack('Logged In From Two-step');
|
|
||||||
if (response.resetMasterPassword) {
|
if (response.resetMasterPassword) {
|
||||||
this.successRoute = 'set-password';
|
this.successRoute = 'set-password';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await this.deleteCipher();
|
await this.deleteCipher();
|
||||||
this.platformUtilsService.eventTrack((this.cipher.isDeleted ? 'Permanently ' : '') + 'Deleted Cipher');
|
|
||||||
this.platformUtilsService.showToast('success', null,
|
this.platformUtilsService.showToast('success', null,
|
||||||
this.i18nService.t(this.cipher.isDeleted ? 'permanentlyDeletedItem' : 'deletedItem'));
|
this.i18nService.t(this.cipher.isDeleted ? 'permanentlyDeletedItem' : 'deletedItem'));
|
||||||
this.onDeletedCipher.emit(this.cipher);
|
this.onDeletedCipher.emit(this.cipher);
|
||||||
@@ -152,7 +151,6 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await this.restoreCipher();
|
await this.restoreCipher();
|
||||||
this.platformUtilsService.eventTrack('Restored Cipher');
|
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('restoredItem'));
|
this.platformUtilsService.showToast('success', null, this.i18nService.t('restoredItem'));
|
||||||
this.onRestoredCipher.emit(this.cipher);
|
this.onRestoredCipher.emit(this.cipher);
|
||||||
} catch { }
|
} catch { }
|
||||||
@@ -161,7 +159,6 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
togglePassword() {
|
togglePassword() {
|
||||||
this.platformUtilsService.eventTrack('Toggled Password');
|
|
||||||
this.showPassword = !this.showPassword;
|
this.showPassword = !this.showPassword;
|
||||||
if (this.showPassword) {
|
if (this.showPassword) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledPasswordVisible, this.cipherId);
|
this.eventService.collect(EventType.Cipher_ClientToggledPasswordVisible, this.cipherId);
|
||||||
@@ -169,7 +166,6 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toggleCardCode() {
|
toggleCardCode() {
|
||||||
this.platformUtilsService.eventTrack('Toggled Card Code');
|
|
||||||
this.showCardCode = !this.showCardCode;
|
this.showCardCode = !this.showCardCode;
|
||||||
if (this.showCardCode) {
|
if (this.showCardCode) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledCardCodeVisible, this.cipherId);
|
this.eventService.collect(EventType.Cipher_ClientToggledCardCodeVisible, this.cipherId);
|
||||||
@@ -181,7 +177,6 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.platformUtilsService.eventTrack('Check Password');
|
|
||||||
this.checkPasswordPromise = this.auditService.passwordLeaked(this.cipher.login.password);
|
this.checkPasswordPromise = this.auditService.passwordLeaked(this.cipher.login.password);
|
||||||
const matches = await this.checkPasswordPromise;
|
const matches = await this.checkPasswordPromise;
|
||||||
|
|
||||||
@@ -210,7 +205,6 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
this.cipherService.updateLastLaunchedDate(cipherId);
|
this.cipherService.updateLastLaunchedDate(cipherId);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.platformUtilsService.eventTrack('Launched Login URI');
|
|
||||||
this.platformUtilsService.launchUri(uri.launchUri);
|
this.platformUtilsService.launchUri(uri.launchUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +213,6 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.platformUtilsService.eventTrack('Copied ' + aType);
|
|
||||||
const copyOptions = this.win != null ? { window: this.win } : null;
|
const copyOptions = this.win != null ? { window: this.win } : null;
|
||||||
this.platformUtilsService.copyToClipboard(value, copyOptions);
|
this.platformUtilsService.copyToClipboard(value, copyOptions);
|
||||||
this.platformUtilsService.showToast('info', null,
|
this.platformUtilsService.showToast('info', null,
|
||||||
|
|||||||
@@ -72,10 +72,6 @@ export class CliPlatformUtilsService implements PlatformUtilsService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
analyticsId() {
|
|
||||||
return null as string;
|
|
||||||
}
|
|
||||||
|
|
||||||
isViewOpen() {
|
isViewOpen() {
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
@@ -118,10 +114,6 @@ export class CliPlatformUtilsService implements PlatformUtilsService {
|
|||||||
throw new Error('Not implemented.');
|
throw new Error('Not implemented.');
|
||||||
}
|
}
|
||||||
|
|
||||||
eventTrack(action: string, label?: string, options?: any) {
|
|
||||||
throw new Error('Not implemented.');
|
|
||||||
}
|
|
||||||
|
|
||||||
isDev(): boolean {
|
isDev(): boolean {
|
||||||
return process.env.BWCLI_ENV === 'development';
|
return process.env.BWCLI_ENV === 'development';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,14 +16,12 @@ import { MessagingService } from '../../abstractions/messaging.service';
|
|||||||
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
|
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
|
||||||
import { StorageService } from '../../abstractions/storage.service';
|
import { StorageService } from '../../abstractions/storage.service';
|
||||||
|
|
||||||
import { AnalyticsIds } from '../../misc/analytics';
|
|
||||||
import { ElectronConstants } from '../electronConstants';
|
import { ElectronConstants } from '../electronConstants';
|
||||||
|
|
||||||
export class ElectronPlatformUtilsService implements PlatformUtilsService {
|
export class ElectronPlatformUtilsService implements PlatformUtilsService {
|
||||||
identityClientId: string;
|
identityClientId: string;
|
||||||
|
|
||||||
private deviceCache: DeviceType = null;
|
private deviceCache: DeviceType = null;
|
||||||
private analyticsIdCache: string = null;
|
|
||||||
|
|
||||||
constructor(private i18nService: I18nService, private messagingService: MessagingService,
|
constructor(private i18nService: I18nService, private messagingService: MessagingService,
|
||||||
private isDesktopApp: boolean, private storageService: StorageService) {
|
private isDesktopApp: boolean, private storageService: StorageService) {
|
||||||
@@ -86,19 +84,6 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
|
|||||||
return isMacAppStore();
|
return isMacAppStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
analyticsId(): string {
|
|
||||||
if (!this.isDesktopApp) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.analyticsIdCache) {
|
|
||||||
return this.analyticsIdCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.analyticsIdCache = (AnalyticsIds as any)[this.getDevice()];
|
|
||||||
return this.analyticsIdCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
isViewOpen(): Promise<boolean> {
|
isViewOpen(): Promise<boolean> {
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
@@ -163,14 +148,6 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
|
|||||||
return Promise.resolve(result.response === 0);
|
return Promise.resolve(result.response === 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
eventTrack(action: string, label?: string, options?: any) {
|
|
||||||
this.messagingService.send('analyticsEventTrack', {
|
|
||||||
action: action,
|
|
||||||
label: label,
|
|
||||||
options: options,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
isDev(): boolean {
|
isDev(): boolean {
|
||||||
return isDev();
|
return isDev();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import * as Abstractions from './abstractions';
|
import * as Abstractions from './abstractions';
|
||||||
import * as Enums from './enums';
|
import * as Enums from './enums';
|
||||||
import * as Misc from './misc';
|
|
||||||
import * as Data from './models/data';
|
import * as Data from './models/data';
|
||||||
import * as Domain from './models/domain';
|
import * as Domain from './models/domain';
|
||||||
import * as Request from './models/request';
|
import * as Request from './models/request';
|
||||||
@@ -8,4 +7,4 @@ import * as Response from './models/response';
|
|||||||
import * as View from './models/view';
|
import * as View from './models/view';
|
||||||
import * as Services from './services';
|
import * as Services from './services';
|
||||||
|
|
||||||
export { Abstractions, Enums, Data, Domain, Misc, Request, Response, Services, View };
|
export { Abstractions, Enums, Data, Domain, Request, Response, Services, View };
|
||||||
|
|||||||
@@ -1,121 +0,0 @@
|
|||||||
import { AppIdService } from '../abstractions/appId.service';
|
|
||||||
import { PlatformUtilsService } from '../abstractions/platformUtils.service';
|
|
||||||
import { StorageService } from '../abstractions/storage.service';
|
|
||||||
|
|
||||||
import { ConstantsService } from '../services/constants.service';
|
|
||||||
|
|
||||||
import { DeviceType } from '../enums/deviceType';
|
|
||||||
|
|
||||||
const GaObj = 'ga';
|
|
||||||
|
|
||||||
export const AnalyticsIds = {
|
|
||||||
[DeviceType.ChromeExtension]: 'UA-81915606-6',
|
|
||||||
[DeviceType.FirefoxExtension]: 'UA-81915606-7',
|
|
||||||
[DeviceType.OperaExtension]: 'UA-81915606-8',
|
|
||||||
[DeviceType.EdgeExtension]: 'UA-81915606-9',
|
|
||||||
[DeviceType.VivaldiExtension]: 'UA-81915606-15',
|
|
||||||
[DeviceType.SafariExtension]: 'UA-81915606-16',
|
|
||||||
[DeviceType.WindowsDesktop]: 'UA-81915606-17',
|
|
||||||
[DeviceType.LinuxDesktop]: 'UA-81915606-19',
|
|
||||||
[DeviceType.MacOsDesktop]: 'UA-81915606-18',
|
|
||||||
};
|
|
||||||
|
|
||||||
export class Analytics {
|
|
||||||
private gaTrackingId: string = null;
|
|
||||||
private defaultDisabled = false;
|
|
||||||
private appVersion: string;
|
|
||||||
|
|
||||||
constructor(win: Window, private gaFilter?: () => boolean,
|
|
||||||
private platformUtilsService?: PlatformUtilsService, private storageService?: StorageService,
|
|
||||||
private appIdService?: AppIdService, private dependencyResolver?: () => any) {
|
|
||||||
if (dependencyResolver != null) {
|
|
||||||
const deps = dependencyResolver();
|
|
||||||
if (platformUtilsService == null && deps.platformUtilsService) {
|
|
||||||
this.platformUtilsService = deps.platformUtilsService as PlatformUtilsService;
|
|
||||||
}
|
|
||||||
if (storageService == null && deps.storageService) {
|
|
||||||
this.storageService = deps.storageService as StorageService;
|
|
||||||
}
|
|
||||||
if (appIdService == null && deps.appIdService) {
|
|
||||||
this.appIdService = deps.appIdService as AppIdService;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.platformUtilsService.getApplicationVersion().then(v => this.appVersion = v);
|
|
||||||
this.defaultDisabled = this.platformUtilsService.getDevice() === DeviceType.FirefoxExtension ||
|
|
||||||
this.platformUtilsService.isMacAppStore();
|
|
||||||
this.gaTrackingId = this.platformUtilsService.analyticsId();
|
|
||||||
|
|
||||||
(win as any).GoogleAnalyticsObject = GaObj;
|
|
||||||
(win as any)[GaObj] = async (action: string, param1: any, param2?: any) => {
|
|
||||||
await this.ga(action, param1, param2);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async ga(action: string, param1: any, param2?: any) {
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (this.gaFilter != null && this.gaFilter()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const disabled = await this.storageService.get<boolean>(ConstantsService.disableGaKey);
|
|
||||||
if ((this.defaultDisabled && disabled == null) || disabled != null && disabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action !== 'send' || !param1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const gaAnonAppId = await this.appIdService.getAnonymousAppId();
|
|
||||||
const version = encodeURIComponent(this.appVersion);
|
|
||||||
let message = 'v=1&tid=' + this.gaTrackingId + '&cid=' + gaAnonAppId + '&cd1=' + version;
|
|
||||||
|
|
||||||
if (param1 === 'pageview' && param2) {
|
|
||||||
message += this.gaTrackPageView(param2);
|
|
||||||
} else if (typeof param1 === 'object' && param1.hitType === 'pageview') {
|
|
||||||
message += this.gaTrackPageView(param1.page);
|
|
||||||
} else if (param1 === 'event' && param2) {
|
|
||||||
message += this.gaTrackEvent(param2);
|
|
||||||
} else if (typeof param1 === 'object' && param1.hitType === 'event') {
|
|
||||||
message += this.gaTrackEvent(param1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const request = new XMLHttpRequest();
|
|
||||||
request.open('POST', 'https://www.google-analytics.com/collect', true);
|
|
||||||
request.send(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
private gaTrackEvent(options: any) {
|
|
||||||
return '&t=event&ec=' + (options.eventCategory ? encodeURIComponent(options.eventCategory) : 'Event') +
|
|
||||||
'&ea=' + encodeURIComponent(options.eventAction) +
|
|
||||||
(options.eventLabel ? '&el=' + encodeURIComponent(options.eventLabel) : '') +
|
|
||||||
(options.eventValue ? '&ev=' + encodeURIComponent(options.eventValue) : '') +
|
|
||||||
(options.page ? '&dp=' + this.cleanPagePath(options.page) : '');
|
|
||||||
}
|
|
||||||
|
|
||||||
private gaTrackPageView(pagePath: string) {
|
|
||||||
return '&t=pageview&dp=' + this.cleanPagePath(pagePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
private cleanPagePath(pagePath: string) {
|
|
||||||
const paramIndex = pagePath.indexOf('?');
|
|
||||||
if (paramIndex > -1) {
|
|
||||||
pagePath = pagePath.substring(0, paramIndex);
|
|
||||||
}
|
|
||||||
if (pagePath.indexOf('!/') === 0 || pagePath.indexOf('#/') === 0) {
|
|
||||||
pagePath = pagePath.substring(1);
|
|
||||||
}
|
|
||||||
const pathParts = pagePath.split('/');
|
|
||||||
const newPathParts: string[] = [];
|
|
||||||
pathParts.forEach(p => {
|
|
||||||
if (p.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i)) {
|
|
||||||
newPathParts.push('__guid__');
|
|
||||||
} else {
|
|
||||||
newPathParts.push(p);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return encodeURIComponent(newPathParts.join('/'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { Analytics } from './analytics';
|
|
||||||
Reference in New Issue
Block a user