[PS-1906] Extract uploadEvents from EventService into new service (#4108)
* Move event.service to it's own folder Move abstractions/event.service to abstractions/event/event.service Move services/event.service to services/event/event.service Fix all the imports * Extract event-upload from event.service Move `uploadEvents` from `EventService` to `EventUploadService` Create event-upload-service-factory Fix wiring up all the dependencies * Remove clearEvents from EventService clearEvents is only related to uploading events and can be moved into EventUploadService Change the logout-method to only call EventUploadService.uploadEvents as that also calls clearEvents internally * Rename EventService to EventCollectionService Rename libs\common\abstraction\event\event.service.ts to libs\common\abstractions\event\event-collection.service.ts Rename libs\common\services\event\event.service.ts to libs\common\services\event\event-collection.service.ts Fix all the imports Fix up service regristration/instantiation Reanme \browser\src\background\service_factories\event-service.factory.ts to \browser\src\background\service_factories\event-collection-service.factory.ts * Move interval to upload events to EventUploadSvc Move the `init()` from event-collection.service to event-upload.service Change call-site in web, desktop, browser
This commit is contained in:
parent
1dca425dc4
commit
200dd0a1fb
|
@ -1,6 +1,6 @@
|
||||||
import { AuthService } from "@bitwarden/common/abstractions/auth.service";
|
import { AuthService } from "@bitwarden/common/abstractions/auth.service";
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { TotpService } from "@bitwarden/common/abstractions/totp.service";
|
import { TotpService } from "@bitwarden/common/abstractions/totp.service";
|
||||||
|
@ -24,7 +24,7 @@ export default class ContextMenusBackground {
|
||||||
private passwordGenerationService: PasswordGenerationService,
|
private passwordGenerationService: PasswordGenerationService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private eventService: EventService,
|
private eventCollectionService: EventCollectionService,
|
||||||
private totpService: TotpService
|
private totpService: TotpService
|
||||||
) {
|
) {
|
||||||
this.contextMenus = chrome.contextMenus;
|
this.contextMenus = chrome.contextMenus;
|
||||||
|
@ -124,7 +124,7 @@ export default class ContextMenusBackground {
|
||||||
this.platformUtilsService.copyToClipboard(cipher.login.username, { window: window });
|
this.platformUtilsService.copyToClipboard(cipher.login.username, { window: window });
|
||||||
} else if (info.parentMenuItemId === "copy-password") {
|
} else if (info.parentMenuItemId === "copy-password") {
|
||||||
this.platformUtilsService.copyToClipboard(cipher.login.password, { window: window });
|
this.platformUtilsService.copyToClipboard(cipher.login.password, { window: window });
|
||||||
this.eventService.collect(EventType.Cipher_ClientCopiedPassword, cipher.id);
|
this.eventCollectionService.collect(EventType.Cipher_ClientCopiedPassword, cipher.id);
|
||||||
} else if (info.parentMenuItemId === "copy-totp") {
|
} else if (info.parentMenuItemId === "copy-totp") {
|
||||||
const totpValue = await this.totpService.getCode(cipher.login.totp);
|
const totpValue = await this.totpService.getCode(cipher.login.totp);
|
||||||
this.platformUtilsService.copyToClipboard(totpValue, { window: window });
|
this.platformUtilsService.copyToClipboard(totpValue, { window: window });
|
||||||
|
|
|
@ -7,7 +7,8 @@ import { CollectionService as CollectionServiceAbstraction } from "@bitwarden/co
|
||||||
import { CryptoService as CryptoServiceAbstraction } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService as CryptoServiceAbstraction } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/abstractions/cryptoFunction.service";
|
import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/abstractions/cryptoFunction.service";
|
||||||
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
||||||
import { EventService as EventServiceAbstraction } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService as EventCollectionServiceAbstraction } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
|
import { EventUploadService as EventUploadServiceAbstraction } from "@bitwarden/common/abstractions/event/event-upload.service";
|
||||||
import { ExportService as ExportServiceAbstraction } from "@bitwarden/common/abstractions/export.service";
|
import { ExportService as ExportServiceAbstraction } from "@bitwarden/common/abstractions/export.service";
|
||||||
import { FileUploadService as FileUploadServiceAbstraction } from "@bitwarden/common/abstractions/fileUpload.service";
|
import { FileUploadService as FileUploadServiceAbstraction } from "@bitwarden/common/abstractions/fileUpload.service";
|
||||||
import { FolderApiServiceAbstraction } from "@bitwarden/common/abstractions/folder/folder-api.service.abstraction";
|
import { FolderApiServiceAbstraction } from "@bitwarden/common/abstractions/folder/folder-api.service.abstraction";
|
||||||
|
@ -54,7 +55,8 @@ import { ConsoleLogService } from "@bitwarden/common/services/consoleLog.service
|
||||||
import { ContainerService } from "@bitwarden/common/services/container.service";
|
import { ContainerService } from "@bitwarden/common/services/container.service";
|
||||||
import { EncryptServiceImplementation } from "@bitwarden/common/services/cryptography/encrypt.service.implementation";
|
import { EncryptServiceImplementation } from "@bitwarden/common/services/cryptography/encrypt.service.implementation";
|
||||||
import { MultithreadEncryptServiceImplementation } from "@bitwarden/common/services/cryptography/multithread-encrypt.service.implementation";
|
import { MultithreadEncryptServiceImplementation } from "@bitwarden/common/services/cryptography/multithread-encrypt.service.implementation";
|
||||||
import { EventService } from "@bitwarden/common/services/event.service";
|
import { EventCollectionService } from "@bitwarden/common/services/event/event-collection.service";
|
||||||
|
import { EventUploadService } from "@bitwarden/common/services/event/event-upload.service";
|
||||||
import { ExportService } from "@bitwarden/common/services/export.service";
|
import { ExportService } from "@bitwarden/common/services/export.service";
|
||||||
import { FileUploadService } from "@bitwarden/common/services/fileUpload.service";
|
import { FileUploadService } from "@bitwarden/common/services/fileUpload.service";
|
||||||
import { FolderApiService } from "@bitwarden/common/services/folder/folder-api.service";
|
import { FolderApiService } from "@bitwarden/common/services/folder/folder-api.service";
|
||||||
|
@ -148,7 +150,8 @@ export default class MainBackground {
|
||||||
stateService: StateServiceAbstraction;
|
stateService: StateServiceAbstraction;
|
||||||
stateMigrationService: StateMigrationService;
|
stateMigrationService: StateMigrationService;
|
||||||
systemService: SystemServiceAbstraction;
|
systemService: SystemServiceAbstraction;
|
||||||
eventService: EventServiceAbstraction;
|
eventCollectionService: EventCollectionServiceAbstraction;
|
||||||
|
eventUploadService: EventUploadServiceAbstraction;
|
||||||
policyService: InternalPolicyServiceAbstraction;
|
policyService: InternalPolicyServiceAbstraction;
|
||||||
popupUtilsService: PopupUtilsService;
|
popupUtilsService: PopupUtilsService;
|
||||||
sendService: SendServiceAbstraction;
|
sendService: SendServiceAbstraction;
|
||||||
|
@ -412,12 +415,16 @@ export default class MainBackground {
|
||||||
this.organizationService,
|
this.organizationService,
|
||||||
logoutCallback
|
logoutCallback
|
||||||
);
|
);
|
||||||
this.eventService = new EventService(
|
this.eventUploadService = new EventUploadService(
|
||||||
this.apiService,
|
this.apiService,
|
||||||
|
this.stateService,
|
||||||
|
this.logService
|
||||||
|
);
|
||||||
|
this.eventCollectionService = new EventCollectionService(
|
||||||
this.cipherService,
|
this.cipherService,
|
||||||
this.stateService,
|
this.stateService,
|
||||||
this.logService,
|
this.organizationService,
|
||||||
this.organizationService
|
this.eventUploadService
|
||||||
);
|
);
|
||||||
this.passwordGenerationService = new PasswordGenerationService(
|
this.passwordGenerationService = new PasswordGenerationService(
|
||||||
this.cryptoService,
|
this.cryptoService,
|
||||||
|
@ -429,7 +436,7 @@ export default class MainBackground {
|
||||||
this.cipherService,
|
this.cipherService,
|
||||||
this.stateService,
|
this.stateService,
|
||||||
this.totpService,
|
this.totpService,
|
||||||
this.eventService,
|
this.eventCollectionService,
|
||||||
this.logService
|
this.logService
|
||||||
);
|
);
|
||||||
this.containerService = new ContainerService(this.cryptoService, this.encryptService);
|
this.containerService = new ContainerService(this.cryptoService, this.encryptService);
|
||||||
|
@ -532,7 +539,7 @@ export default class MainBackground {
|
||||||
this.passwordGenerationService,
|
this.passwordGenerationService,
|
||||||
this.platformUtilsService,
|
this.platformUtilsService,
|
||||||
this.authService,
|
this.authService,
|
||||||
this.eventService,
|
this.eventCollectionService,
|
||||||
this.totpService
|
this.totpService
|
||||||
);
|
);
|
||||||
this.idleBackground = new IdleBackground(
|
this.idleBackground = new IdleBackground(
|
||||||
|
@ -560,7 +567,7 @@ export default class MainBackground {
|
||||||
|
|
||||||
await (this.vaultTimeoutService as VaultTimeoutService).init(true);
|
await (this.vaultTimeoutService as VaultTimeoutService).init(true);
|
||||||
await (this.i18nService as I18nService).init();
|
await (this.i18nService as I18nService).init();
|
||||||
await (this.eventService as EventService).init(true);
|
await (this.eventUploadService as EventUploadService).init(true);
|
||||||
await this.runtimeBackground.init();
|
await this.runtimeBackground.init();
|
||||||
await this.notificationBackground.init();
|
await this.notificationBackground.init();
|
||||||
await this.commandsBackground.init();
|
await this.commandsBackground.init();
|
||||||
|
@ -626,10 +633,9 @@ export default class MainBackground {
|
||||||
}
|
}
|
||||||
|
|
||||||
async logout(expired: boolean, userId?: string) {
|
async logout(expired: boolean, userId?: string) {
|
||||||
await this.eventService.uploadEvents(userId);
|
await this.eventUploadService.uploadEvents(userId);
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.eventService.clearEvents(userId),
|
|
||||||
this.syncService.setLastSync(new Date(0), userId),
|
this.syncService.setLastSync(new Date(0), userId),
|
||||||
this.cryptoService.clearKeys(userId),
|
this.cryptoService.clearKeys(userId),
|
||||||
this.settingsService.clear(userId),
|
this.settingsService.clear(userId),
|
||||||
|
|
|
@ -2,7 +2,10 @@ import { AutofillService as AbstractAutoFillService } from "../../services/abstr
|
||||||
import AutofillService from "../../services/autofill.service";
|
import AutofillService from "../../services/autofill.service";
|
||||||
|
|
||||||
import { cipherServiceFactory, CipherServiceInitOptions } from "./cipher-service.factory";
|
import { cipherServiceFactory, CipherServiceInitOptions } from "./cipher-service.factory";
|
||||||
import { EventServiceInitOptions, eventServiceFactory } from "./event-service.factory";
|
import {
|
||||||
|
EventCollectionServiceInitOptions,
|
||||||
|
eventCollectionServiceFactory,
|
||||||
|
} from "./event-collection-service.factory";
|
||||||
import { CachedServices, factory, FactoryOptions } from "./factory-options";
|
import { CachedServices, factory, FactoryOptions } from "./factory-options";
|
||||||
import { logServiceFactory, LogServiceInitOptions } from "./log-service.factory";
|
import { logServiceFactory, LogServiceInitOptions } from "./log-service.factory";
|
||||||
import { stateServiceFactory, StateServiceInitOptions } from "./state-service.factory";
|
import { stateServiceFactory, StateServiceInitOptions } from "./state-service.factory";
|
||||||
|
@ -14,7 +17,7 @@ export type AutoFillServiceInitOptions = AutoFillServiceOptions &
|
||||||
CipherServiceInitOptions &
|
CipherServiceInitOptions &
|
||||||
StateServiceInitOptions &
|
StateServiceInitOptions &
|
||||||
TotpServiceInitOptions &
|
TotpServiceInitOptions &
|
||||||
EventServiceInitOptions &
|
EventCollectionServiceInitOptions &
|
||||||
LogServiceInitOptions;
|
LogServiceInitOptions;
|
||||||
|
|
||||||
export function autofillServiceFactory(
|
export function autofillServiceFactory(
|
||||||
|
@ -30,7 +33,7 @@ export function autofillServiceFactory(
|
||||||
await cipherServiceFactory(cache, opts),
|
await cipherServiceFactory(cache, opts),
|
||||||
await stateServiceFactory(cache, opts),
|
await stateServiceFactory(cache, opts),
|
||||||
await totpServiceFactory(cache, opts),
|
await totpServiceFactory(cache, opts),
|
||||||
await eventServiceFactory(cache, opts),
|
await eventCollectionServiceFactory(cache, opts),
|
||||||
await logServiceFactory(cache, opts)
|
await logServiceFactory(cache, opts)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
import { EventCollectionService as AbstractEventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
|
import { EventCollectionService } from "@bitwarden/common/services/event/event-collection.service";
|
||||||
|
|
||||||
|
import { cipherServiceFactory, CipherServiceInitOptions } from "./cipher-service.factory";
|
||||||
|
import {
|
||||||
|
eventUploadServiceFactory,
|
||||||
|
EventUploadServiceInitOptions,
|
||||||
|
} from "./event-upload-service.factory";
|
||||||
|
import { FactoryOptions, CachedServices, factory } from "./factory-options";
|
||||||
|
import {
|
||||||
|
organizationServiceFactory,
|
||||||
|
OrganizationServiceInitOptions,
|
||||||
|
} from "./organization-service.factory";
|
||||||
|
import { stateServiceFactory, StateServiceInitOptions } from "./state-service.factory";
|
||||||
|
|
||||||
|
type EventCollectionServiceOptions = FactoryOptions;
|
||||||
|
|
||||||
|
export type EventCollectionServiceInitOptions = EventCollectionServiceOptions &
|
||||||
|
CipherServiceInitOptions &
|
||||||
|
StateServiceInitOptions &
|
||||||
|
OrganizationServiceInitOptions &
|
||||||
|
EventUploadServiceInitOptions;
|
||||||
|
|
||||||
|
export function eventCollectionServiceFactory(
|
||||||
|
cache: { eventCollectionService?: AbstractEventCollectionService } & CachedServices,
|
||||||
|
opts: EventCollectionServiceInitOptions
|
||||||
|
): Promise<AbstractEventCollectionService> {
|
||||||
|
return factory(
|
||||||
|
cache,
|
||||||
|
"eventCollectionService",
|
||||||
|
opts,
|
||||||
|
async () =>
|
||||||
|
new EventCollectionService(
|
||||||
|
await cipherServiceFactory(cache, opts),
|
||||||
|
await stateServiceFactory(cache, opts),
|
||||||
|
await organizationServiceFactory(cache, opts),
|
||||||
|
await eventUploadServiceFactory(cache, opts)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,40 +0,0 @@
|
||||||
import { EventService as AbstractEventService } from "@bitwarden/common/abstractions/event.service";
|
|
||||||
import { EventService } from "@bitwarden/common/services/event.service";
|
|
||||||
|
|
||||||
import { apiServiceFactory, ApiServiceInitOptions } from "./api-service.factory";
|
|
||||||
import { cipherServiceFactory, CipherServiceInitOptions } from "./cipher-service.factory";
|
|
||||||
import { FactoryOptions, CachedServices, factory } from "./factory-options";
|
|
||||||
import { logServiceFactory, LogServiceInitOptions } from "./log-service.factory";
|
|
||||||
import {
|
|
||||||
organizationServiceFactory,
|
|
||||||
OrganizationServiceInitOptions,
|
|
||||||
} from "./organization-service.factory";
|
|
||||||
import { stateServiceFactory, StateServiceInitOptions } from "./state-service.factory";
|
|
||||||
|
|
||||||
type EventServiceOptions = FactoryOptions;
|
|
||||||
|
|
||||||
export type EventServiceInitOptions = EventServiceOptions &
|
|
||||||
ApiServiceInitOptions &
|
|
||||||
CipherServiceInitOptions &
|
|
||||||
StateServiceInitOptions &
|
|
||||||
LogServiceInitOptions &
|
|
||||||
OrganizationServiceInitOptions;
|
|
||||||
|
|
||||||
export function eventServiceFactory(
|
|
||||||
cache: { eventService?: AbstractEventService } & CachedServices,
|
|
||||||
opts: EventServiceInitOptions
|
|
||||||
): Promise<AbstractEventService> {
|
|
||||||
return factory(
|
|
||||||
cache,
|
|
||||||
"eventService",
|
|
||||||
opts,
|
|
||||||
async () =>
|
|
||||||
new EventService(
|
|
||||||
await apiServiceFactory(cache, opts),
|
|
||||||
await cipherServiceFactory(cache, opts),
|
|
||||||
await stateServiceFactory(cache, opts),
|
|
||||||
await logServiceFactory(cache, opts),
|
|
||||||
await organizationServiceFactory(cache, opts)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
import { EventUploadService as AbstractEventUploadService } from "@bitwarden/common/abstractions/event/event-upload.service";
|
||||||
|
import { EventUploadService } from "@bitwarden/common/services/event/event-upload.service";
|
||||||
|
|
||||||
|
import { apiServiceFactory, ApiServiceInitOptions } from "./api-service.factory";
|
||||||
|
import { FactoryOptions, CachedServices, factory } from "./factory-options";
|
||||||
|
import { logServiceFactory, LogServiceInitOptions } from "./log-service.factory";
|
||||||
|
import { stateServiceFactory, StateServiceInitOptions } from "./state-service.factory";
|
||||||
|
|
||||||
|
type EventUploadServiceOptions = FactoryOptions;
|
||||||
|
|
||||||
|
export type EventUploadServiceInitOptions = EventUploadServiceOptions &
|
||||||
|
ApiServiceInitOptions &
|
||||||
|
StateServiceInitOptions &
|
||||||
|
LogServiceInitOptions;
|
||||||
|
|
||||||
|
export function eventUploadServiceFactory(
|
||||||
|
cache: { eventUploadService?: AbstractEventUploadService } & CachedServices,
|
||||||
|
opts: EventUploadServiceInitOptions
|
||||||
|
): Promise<AbstractEventUploadService> {
|
||||||
|
return factory(
|
||||||
|
cache,
|
||||||
|
"eventUploadService",
|
||||||
|
opts,
|
||||||
|
async () =>
|
||||||
|
new EventUploadService(
|
||||||
|
await apiServiceFactory(cache, opts),
|
||||||
|
await stateServiceFactory(cache, opts),
|
||||||
|
await logServiceFactory(cache, opts)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
||||||
|
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
|
@ -27,7 +27,7 @@ export class ActionButtonsComponent {
|
||||||
constructor(
|
constructor(
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private eventService: EventService,
|
private eventCollectionService: EventCollectionService,
|
||||||
private totpService: TotpService,
|
private totpService: TotpService,
|
||||||
private stateService: StateService,
|
private stateService: StateService,
|
||||||
private passwordRepromptService: PasswordRepromptService
|
private passwordRepromptService: PasswordRepromptService
|
||||||
|
@ -68,9 +68,12 @@ export class ActionButtonsComponent {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (typeI18nKey === "password" || typeI18nKey === "verificationCodeTotp") {
|
if (typeI18nKey === "password" || typeI18nKey === "verificationCodeTotp") {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, cipher.id);
|
this.eventCollectionService.collect(
|
||||||
|
EventType.Cipher_ClientToggledHiddenFieldVisible,
|
||||||
|
cipher.id
|
||||||
|
);
|
||||||
} else if (typeI18nKey === "securityCode") {
|
} else if (typeI18nKey === "securityCode") {
|
||||||
this.eventService.collect(EventType.Cipher_ClientCopiedCardCode, cipher.id);
|
this.eventCollectionService.collect(EventType.Cipher_ClientCopiedCardCode, cipher.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@ import { CollectionService } from "@bitwarden/common/abstractions/collection.ser
|
||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { CryptoFunctionService } from "@bitwarden/common/abstractions/cryptoFunction.service";
|
import { CryptoFunctionService } from "@bitwarden/common/abstractions/cryptoFunction.service";
|
||||||
import { EnvironmentService } from "@bitwarden/common/abstractions/environment.service";
|
import { EnvironmentService } from "@bitwarden/common/abstractions/environment.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
|
import { EventUploadService } from "@bitwarden/common/abstractions/event/event-upload.service";
|
||||||
import { ExportService } from "@bitwarden/common/abstractions/export.service";
|
import { ExportService } from "@bitwarden/common/abstractions/export.service";
|
||||||
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
||||||
import { FileUploadService } from "@bitwarden/common/abstractions/fileUpload.service";
|
import { FileUploadService } from "@bitwarden/common/abstractions/fileUpload.service";
|
||||||
|
@ -195,7 +196,16 @@ function getBgService<T>(service: keyof MainBackground) {
|
||||||
{ provide: TokenService, useFactory: getBgService<TokenService>("tokenService"), deps: [] },
|
{ provide: TokenService, useFactory: getBgService<TokenService>("tokenService"), deps: [] },
|
||||||
{ provide: I18nService, useFactory: getBgService<I18nService>("i18nService"), deps: [] },
|
{ provide: I18nService, useFactory: getBgService<I18nService>("i18nService"), deps: [] },
|
||||||
{ provide: CryptoService, useFactory: getBgService<CryptoService>("cryptoService"), deps: [] },
|
{ provide: CryptoService, useFactory: getBgService<CryptoService>("cryptoService"), deps: [] },
|
||||||
{ provide: EventService, useFactory: getBgService<EventService>("eventService"), deps: [] },
|
{
|
||||||
|
provide: EventUploadService,
|
||||||
|
useFactory: getBgService<EventUploadService>("eventUploadService"),
|
||||||
|
deps: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: EventCollectionService,
|
||||||
|
useFactory: getBgService<EventCollectionService>("eventCollectionService"),
|
||||||
|
deps: [],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
provide: PolicyService,
|
provide: PolicyService,
|
||||||
useFactory: (
|
useFactory: (
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Router } from "@angular/router";
|
||||||
|
|
||||||
import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/components/export.component";
|
import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/components/export.component";
|
||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { ExportService } from "@bitwarden/common/abstractions/export.service";
|
import { ExportService } from "@bitwarden/common/abstractions/export.service";
|
||||||
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
|
@ -23,7 +23,7 @@ export class ExportComponent extends BaseExportComponent {
|
||||||
i18nService: I18nService,
|
i18nService: I18nService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
exportService: ExportService,
|
exportService: ExportService,
|
||||||
eventService: EventService,
|
eventCollectionService: EventCollectionService,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
|
@ -36,7 +36,7 @@ export class ExportComponent extends BaseExportComponent {
|
||||||
i18nService,
|
i18nService,
|
||||||
platformUtilsService,
|
platformUtilsService,
|
||||||
exportService,
|
exportService,
|
||||||
eventService,
|
eventCollectionService,
|
||||||
policyService,
|
policyService,
|
||||||
window,
|
window,
|
||||||
logService,
|
logService,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Component } from "@angular/core";
|
import { Component } from "@angular/core";
|
||||||
|
|
||||||
import { AddEditCustomFieldsComponent as BaseAddEditCustomFieldsComponent } from "@bitwarden/angular/components/add-edit-custom-fields.component";
|
import { AddEditCustomFieldsComponent as BaseAddEditCustomFieldsComponent } from "@bitwarden/angular/components/add-edit-custom-fields.component";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -9,7 +9,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
templateUrl: "add-edit-custom-fields.component.html",
|
templateUrl: "add-edit-custom-fields.component.html",
|
||||||
})
|
})
|
||||||
export class AddEditCustomFieldsComponent extends BaseAddEditCustomFieldsComponent {
|
export class AddEditCustomFieldsComponent extends BaseAddEditCustomFieldsComponent {
|
||||||
constructor(i18nService: I18nService, eventService: EventService) {
|
constructor(i18nService: I18nService, eventCollectionService: EventCollectionService) {
|
||||||
super(i18nService, eventService);
|
super(i18nService, eventCollectionService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { AddEditComponent as BaseAddEditComponent } from "@bitwarden/angular/com
|
||||||
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
|
@ -46,7 +46,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private location: Location,
|
private location: Location,
|
||||||
eventService: EventService,
|
eventCollectionService: EventCollectionService,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
private popupUtilsService: PopupUtilsService,
|
private popupUtilsService: PopupUtilsService,
|
||||||
organizationService: OrganizationService,
|
organizationService: OrganizationService,
|
||||||
|
@ -62,7 +62,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||||
stateService,
|
stateService,
|
||||||
collectionService,
|
collectionService,
|
||||||
messagingService,
|
messagingService,
|
||||||
eventService,
|
eventCollectionService,
|
||||||
policyService,
|
policyService,
|
||||||
logService,
|
logService,
|
||||||
passwordRepromptService,
|
passwordRepromptService,
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { Component } from "@angular/core";
|
import { Component } from "@angular/core";
|
||||||
|
|
||||||
import { ViewCustomFieldsComponent as BaseViewCustomFieldsComponent } from "@bitwarden/angular/components/view-custom-fields.component";
|
import { ViewCustomFieldsComponent as BaseViewCustomFieldsComponent } from "@bitwarden/angular/components/view-custom-fields.component";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-vault-view-custom-fields",
|
selector: "app-vault-view-custom-fields",
|
||||||
templateUrl: "view-custom-fields.component.html",
|
templateUrl: "view-custom-fields.component.html",
|
||||||
})
|
})
|
||||||
export class ViewCustomFieldsComponent extends BaseViewCustomFieldsComponent {
|
export class ViewCustomFieldsComponent extends BaseViewCustomFieldsComponent {
|
||||||
constructor(eventService: EventService) {
|
constructor(eventCollectionService: EventCollectionService) {
|
||||||
super(eventService);
|
super(eventCollectionService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||||
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
|
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
||||||
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
|
@ -58,7 +58,7 @@ export class ViewComponent extends BaseViewComponent {
|
||||||
ngZone: NgZone,
|
ngZone: NgZone,
|
||||||
changeDetectorRef: ChangeDetectorRef,
|
changeDetectorRef: ChangeDetectorRef,
|
||||||
stateService: StateService,
|
stateService: StateService,
|
||||||
eventService: EventService,
|
eventCollectionService: EventCollectionService,
|
||||||
private autofillService: AutofillService,
|
private autofillService: AutofillService,
|
||||||
private messagingService: MessagingService,
|
private messagingService: MessagingService,
|
||||||
private popupUtilsService: PopupUtilsService,
|
private popupUtilsService: PopupUtilsService,
|
||||||
|
@ -80,7 +80,7 @@ export class ViewComponent extends BaseViewComponent {
|
||||||
broadcasterService,
|
broadcasterService,
|
||||||
ngZone,
|
ngZone,
|
||||||
changeDetectorRef,
|
changeDetectorRef,
|
||||||
eventService,
|
eventCollectionService,
|
||||||
apiService,
|
apiService,
|
||||||
passwordRepromptService,
|
passwordRepromptService,
|
||||||
logService,
|
logService,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { TotpService } from "@bitwarden/common/abstractions/totp.service";
|
import { TotpService } from "@bitwarden/common/abstractions/totp.service";
|
||||||
import { CipherRepromptType } from "@bitwarden/common/enums/cipherRepromptType";
|
import { CipherRepromptType } from "@bitwarden/common/enums/cipherRepromptType";
|
||||||
|
@ -41,7 +41,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||||
private cipherService: CipherService,
|
private cipherService: CipherService,
|
||||||
private stateService: BrowserStateService,
|
private stateService: BrowserStateService,
|
||||||
private totpService: TotpService,
|
private totpService: TotpService,
|
||||||
private eventService: EventService,
|
private eventCollectionService: EventCollectionService,
|
||||||
private logService: LogService
|
private logService: LogService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (didAutofill) {
|
if (didAutofill) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientAutofilled, options.cipher.id);
|
this.eventCollectionService.collect(EventType.Cipher_ClientAutofilled, options.cipher.id);
|
||||||
if (totpPromise != null) {
|
if (totpPromise != null) {
|
||||||
return await totpPromise;
|
return await totpPromise;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -20,7 +20,7 @@ import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.s
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventUploadService } from "@bitwarden/common/abstractions/event/event-upload.service";
|
||||||
import { InternalFolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { InternalFolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { KeyConnectorService } from "@bitwarden/common/abstractions/keyConnector.service";
|
import { KeyConnectorService } from "@bitwarden/common/abstractions/keyConnector.service";
|
||||||
|
@ -125,7 +125,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private systemService: SystemService,
|
private systemService: SystemService,
|
||||||
private stateService: StateService,
|
private stateService: StateService,
|
||||||
private eventService: EventService,
|
private eventUploadService: EventUploadService,
|
||||||
private policyService: InternalPolicyService,
|
private policyService: InternalPolicyService,
|
||||||
private modalService: ModalService,
|
private modalService: ModalService,
|
||||||
private keyConnectorService: KeyConnectorService
|
private keyConnectorService: KeyConnectorService
|
||||||
|
@ -465,7 +465,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
private async logOut(expired: boolean, userId?: string) {
|
private async logOut(expired: boolean, userId?: string) {
|
||||||
const userBeingLoggedOut = await this.stateService.getUserId({ userId: userId });
|
const userBeingLoggedOut = await this.stateService.getUserId({ userId: userId });
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.eventService.uploadEvents(userBeingLoggedOut),
|
this.eventUploadService.uploadEvents(userBeingLoggedOut),
|
||||||
this.syncService.setLastSync(new Date(0), userBeingLoggedOut),
|
this.syncService.setLastSync(new Date(0), userBeingLoggedOut),
|
||||||
this.cryptoService.clearKeys(userBeingLoggedOut),
|
this.cryptoService.clearKeys(userBeingLoggedOut),
|
||||||
this.settingsService.clear(userBeingLoggedOut),
|
this.settingsService.clear(userBeingLoggedOut),
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { AbstractThemingService } from "@bitwarden/angular/services/theming/them
|
||||||
import { CryptoService as CryptoServiceAbstraction } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService as CryptoServiceAbstraction } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
||||||
import { EnvironmentService as EnvironmentServiceAbstraction } from "@bitwarden/common/abstractions/environment.service";
|
import { EnvironmentService as EnvironmentServiceAbstraction } from "@bitwarden/common/abstractions/environment.service";
|
||||||
import { EventService as EventServiceAbstraction } from "@bitwarden/common/abstractions/event.service";
|
import { EventUploadService as EventUploadServiceAbstraction } from "@bitwarden/common/abstractions/event/event-upload.service";
|
||||||
import { I18nService as I18nServiceAbstraction } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService as I18nServiceAbstraction } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { NotificationsService as NotificationsServiceAbstraction } from "@bitwarden/common/abstractions/notifications.service";
|
import { NotificationsService as NotificationsServiceAbstraction } from "@bitwarden/common/abstractions/notifications.service";
|
||||||
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
|
@ -14,7 +14,7 @@ import { SyncService as SyncServiceAbstraction } from "@bitwarden/common/abstrac
|
||||||
import { TwoFactorService as TwoFactorServiceAbstraction } from "@bitwarden/common/abstractions/twoFactor.service";
|
import { TwoFactorService as TwoFactorServiceAbstraction } from "@bitwarden/common/abstractions/twoFactor.service";
|
||||||
import { VaultTimeoutService as VaultTimeoutServiceAbstraction } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeout.service";
|
import { VaultTimeoutService as VaultTimeoutServiceAbstraction } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeout.service";
|
||||||
import { ContainerService } from "@bitwarden/common/services/container.service";
|
import { ContainerService } from "@bitwarden/common/services/container.service";
|
||||||
import { EventService } from "@bitwarden/common/services/event.service";
|
import { EventUploadService } from "@bitwarden/common/services/event/event-upload.service";
|
||||||
import { VaultTimeoutService } from "@bitwarden/common/services/vaultTimeout/vaultTimeout.service";
|
import { VaultTimeoutService } from "@bitwarden/common/services/vaultTimeout/vaultTimeout.service";
|
||||||
|
|
||||||
import { I18nService } from "../../services/i18n.service";
|
import { I18nService } from "../../services/i18n.service";
|
||||||
|
@ -28,7 +28,7 @@ export class InitService {
|
||||||
private syncService: SyncServiceAbstraction,
|
private syncService: SyncServiceAbstraction,
|
||||||
private vaultTimeoutService: VaultTimeoutServiceAbstraction,
|
private vaultTimeoutService: VaultTimeoutServiceAbstraction,
|
||||||
private i18nService: I18nServiceAbstraction,
|
private i18nService: I18nServiceAbstraction,
|
||||||
private eventService: EventServiceAbstraction,
|
private eventUploadService: EventUploadServiceAbstraction,
|
||||||
private twoFactorService: TwoFactorServiceAbstraction,
|
private twoFactorService: TwoFactorServiceAbstraction,
|
||||||
private notificationsService: NotificationsServiceAbstraction,
|
private notificationsService: NotificationsServiceAbstraction,
|
||||||
private platformUtilsService: PlatformUtilsServiceAbstraction,
|
private platformUtilsService: PlatformUtilsServiceAbstraction,
|
||||||
|
@ -48,7 +48,7 @@ export class InitService {
|
||||||
(this.vaultTimeoutService as VaultTimeoutService).init(true);
|
(this.vaultTimeoutService as VaultTimeoutService).init(true);
|
||||||
const locale = await this.stateService.getLocale();
|
const locale = await this.stateService.getLocale();
|
||||||
await (this.i18nService as I18nService).init(locale);
|
await (this.i18nService as I18nService).init(locale);
|
||||||
(this.eventService as EventService).init(true);
|
(this.eventUploadService as EventUploadService).init(true);
|
||||||
this.twoFactorService.init();
|
this.twoFactorService.init();
|
||||||
setTimeout(() => this.notificationsService.init(), 3000);
|
setTimeout(() => this.notificationsService.init(), 3000);
|
||||||
const htmlEl = this.win.document.documentElement;
|
const htmlEl = this.win.document.documentElement;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Component } from "@angular/core";
|
import { Component } from "@angular/core";
|
||||||
|
|
||||||
import { AddEditCustomFieldsComponent as BaseAddEditCustomFieldsComponent } from "@bitwarden/angular/components/add-edit-custom-fields.component";
|
import { AddEditCustomFieldsComponent as BaseAddEditCustomFieldsComponent } from "@bitwarden/angular/components/add-edit-custom-fields.component";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -9,7 +9,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
templateUrl: "add-edit-custom-fields.component.html",
|
templateUrl: "add-edit-custom-fields.component.html",
|
||||||
})
|
})
|
||||||
export class AddEditCustomFieldsComponent extends BaseAddEditCustomFieldsComponent {
|
export class AddEditCustomFieldsComponent extends BaseAddEditCustomFieldsComponent {
|
||||||
constructor(i18nService: I18nService, eventService: EventService) {
|
constructor(i18nService: I18nService, eventCollectionService: EventCollectionService) {
|
||||||
super(i18nService, eventService);
|
super(i18nService, eventCollectionService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||||
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
|
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
|
@ -35,7 +35,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnChanges,
|
||||||
stateService: StateService,
|
stateService: StateService,
|
||||||
collectionService: CollectionService,
|
collectionService: CollectionService,
|
||||||
messagingService: MessagingService,
|
messagingService: MessagingService,
|
||||||
eventService: EventService,
|
eventCollectionService: EventCollectionService,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
passwordRepromptService: PasswordRepromptService,
|
passwordRepromptService: PasswordRepromptService,
|
||||||
private broadcasterService: BroadcasterService,
|
private broadcasterService: BroadcasterService,
|
||||||
|
@ -52,7 +52,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnChanges,
|
||||||
stateService,
|
stateService,
|
||||||
collectionService,
|
collectionService,
|
||||||
messagingService,
|
messagingService,
|
||||||
eventService,
|
eventCollectionService,
|
||||||
policyService,
|
policyService,
|
||||||
logService,
|
logService,
|
||||||
passwordRepromptService,
|
passwordRepromptService,
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { UntypedFormBuilder } from "@angular/forms";
|
||||||
import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/components/export.component";
|
import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/components/export.component";
|
||||||
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
|
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
|
||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { ExportService } from "@bitwarden/common/abstractions/export.service";
|
import { ExportService } from "@bitwarden/common/abstractions/export.service";
|
||||||
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
|
@ -27,7 +27,7 @@ export class ExportComponent extends BaseExportComponent implements OnInit {
|
||||||
i18nService: I18nService,
|
i18nService: I18nService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
exportService: ExportService,
|
exportService: ExportService,
|
||||||
eventService: EventService,
|
eventCollectionService: EventCollectionService,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
userVerificationService: UserVerificationService,
|
userVerificationService: UserVerificationService,
|
||||||
formBuilder: UntypedFormBuilder,
|
formBuilder: UntypedFormBuilder,
|
||||||
|
@ -40,7 +40,7 @@ export class ExportComponent extends BaseExportComponent implements OnInit {
|
||||||
i18nService,
|
i18nService,
|
||||||
platformUtilsService,
|
platformUtilsService,
|
||||||
exportService,
|
exportService,
|
||||||
eventService,
|
eventCollectionService,
|
||||||
policyService,
|
policyService,
|
||||||
window,
|
window,
|
||||||
logService,
|
logService,
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { ModalRef } from "@bitwarden/angular/components/modal/modal.ref";
|
||||||
import { ModalService } from "@bitwarden/angular/services/modal.service";
|
import { ModalService } from "@bitwarden/angular/services/modal.service";
|
||||||
import { VaultFilter } from "@bitwarden/angular/vault/vault-filter/models/vault-filter.model";
|
import { VaultFilter } from "@bitwarden/angular/vault/vault-filter/models/vault-filter.model";
|
||||||
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
|
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
||||||
|
@ -94,7 +94,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||||
private syncService: SyncService,
|
private syncService: SyncService,
|
||||||
private messagingService: MessagingService,
|
private messagingService: MessagingService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private eventService: EventService,
|
private eventCollectionService: EventCollectionService,
|
||||||
private totpService: TotpService,
|
private totpService: TotpService,
|
||||||
private passwordRepromptService: PasswordRepromptService,
|
private passwordRepromptService: PasswordRepromptService,
|
||||||
private stateService: StateService,
|
private stateService: StateService,
|
||||||
|
@ -309,7 +309,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||||
label: this.i18nService.t("copyPassword"),
|
label: this.i18nService.t("copyPassword"),
|
||||||
click: () => {
|
click: () => {
|
||||||
this.copyValue(cipher, cipher.login.password, "password", "Password");
|
this.copyValue(cipher, cipher.login.password, "password", "Password");
|
||||||
this.eventService.collect(EventType.Cipher_ClientCopiedPassword, cipher.id);
|
this.eventCollectionService.collect(EventType.Cipher_ClientCopiedPassword, cipher.id);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||||
label: this.i18nService.t("copySecurityCode"),
|
label: this.i18nService.t("copySecurityCode"),
|
||||||
click: () => {
|
click: () => {
|
||||||
this.copyValue(cipher, cipher.card.code, "securityCode", "Security Code");
|
this.copyValue(cipher, cipher.card.code, "securityCode", "Security Code");
|
||||||
this.eventService.collect(EventType.Cipher_ClientCopiedCardCode, cipher.id);
|
this.eventCollectionService.collect(EventType.Cipher_ClientCopiedCardCode, cipher.id);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { Component } from "@angular/core";
|
import { Component } from "@angular/core";
|
||||||
|
|
||||||
import { ViewCustomFieldsComponent as BaseViewCustomFieldsComponent } from "@bitwarden/angular/components/view-custom-fields.component";
|
import { ViewCustomFieldsComponent as BaseViewCustomFieldsComponent } from "@bitwarden/angular/components/view-custom-fields.component";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-vault-view-custom-fields",
|
selector: "app-vault-view-custom-fields",
|
||||||
templateUrl: "view-custom-fields.component.html",
|
templateUrl: "view-custom-fields.component.html",
|
||||||
})
|
})
|
||||||
export class ViewCustomFieldsComponent extends BaseViewCustomFieldsComponent {
|
export class ViewCustomFieldsComponent extends BaseViewCustomFieldsComponent {
|
||||||
constructor(eventService: EventService) {
|
constructor(eventCollectionService: EventCollectionService) {
|
||||||
super(eventService);
|
super(eventCollectionService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||||
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
|
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
||||||
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
|
@ -47,7 +47,7 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
|
||||||
broadcasterService: BroadcasterService,
|
broadcasterService: BroadcasterService,
|
||||||
ngZone: NgZone,
|
ngZone: NgZone,
|
||||||
changeDetectorRef: ChangeDetectorRef,
|
changeDetectorRef: ChangeDetectorRef,
|
||||||
eventService: EventService,
|
eventCollectionService: EventCollectionService,
|
||||||
apiService: ApiService,
|
apiService: ApiService,
|
||||||
private messagingService: MessagingService,
|
private messagingService: MessagingService,
|
||||||
passwordRepromptService: PasswordRepromptService,
|
passwordRepromptService: PasswordRepromptService,
|
||||||
|
@ -68,7 +68,7 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
|
||||||
broadcasterService,
|
broadcasterService,
|
||||||
ngZone,
|
ngZone,
|
||||||
changeDetectorRef,
|
changeDetectorRef,
|
||||||
eventService,
|
eventCollectionService,
|
||||||
apiService,
|
apiService,
|
||||||
passwordRepromptService,
|
passwordRepromptService,
|
||||||
logService,
|
logService,
|
||||||
|
|
|
@ -12,7 +12,7 @@ import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.s
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventUploadService } from "@bitwarden/common/abstractions/event/event-upload.service";
|
||||||
import { InternalFolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { InternalFolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { KeyConnectorService } from "@bitwarden/common/abstractions/keyConnector.service";
|
import { KeyConnectorService } from "@bitwarden/common/abstractions/keyConnector.service";
|
||||||
|
@ -74,7 +74,7 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
private routerService: RouterService,
|
private routerService: RouterService,
|
||||||
private stateService: StateService,
|
private stateService: StateService,
|
||||||
private eventService: EventService,
|
private eventUploadService: EventUploadService,
|
||||||
private policyService: InternalPolicyService,
|
private policyService: InternalPolicyService,
|
||||||
protected policyListService: PolicyListService,
|
protected policyListService: PolicyListService,
|
||||||
private keyConnectorService: KeyConnectorService
|
private keyConnectorService: KeyConnectorService
|
||||||
|
@ -221,10 +221,9 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async logOut(expired: boolean) {
|
private async logOut(expired: boolean) {
|
||||||
await this.eventService.uploadEvents();
|
await this.eventUploadService.uploadEvents();
|
||||||
const userId = await this.stateService.getUserId();
|
const userId = await this.stateService.getUserId();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.eventService.clearEvents(),
|
|
||||||
this.syncService.setLastSync(new Date(0)),
|
this.syncService.setLastSync(new Date(0)),
|
||||||
this.cryptoService.clearKeys(),
|
this.cryptoService.clearKeys(),
|
||||||
this.settingsService.clear(userId),
|
this.settingsService.clear(userId),
|
||||||
|
|
|
@ -8,14 +8,14 @@ import {
|
||||||
EnvironmentService as EnvironmentServiceAbstraction,
|
EnvironmentService as EnvironmentServiceAbstraction,
|
||||||
Urls,
|
Urls,
|
||||||
} from "@bitwarden/common/abstractions/environment.service";
|
} from "@bitwarden/common/abstractions/environment.service";
|
||||||
import { EventService as EventLoggingServiceAbstraction } from "@bitwarden/common/abstractions/event.service";
|
import { EventUploadService as EventUploadServiceAbstraction } from "@bitwarden/common/abstractions/event/event-upload.service";
|
||||||
import { I18nService as I18nServiceAbstraction } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService as I18nServiceAbstraction } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { NotificationsService as NotificationsServiceAbstraction } from "@bitwarden/common/abstractions/notifications.service";
|
import { NotificationsService as NotificationsServiceAbstraction } from "@bitwarden/common/abstractions/notifications.service";
|
||||||
import { StateService as StateServiceAbstraction } from "@bitwarden/common/abstractions/state.service";
|
import { StateService as StateServiceAbstraction } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { TwoFactorService as TwoFactorServiceAbstraction } from "@bitwarden/common/abstractions/twoFactor.service";
|
import { TwoFactorService as TwoFactorServiceAbstraction } from "@bitwarden/common/abstractions/twoFactor.service";
|
||||||
import { VaultTimeoutService as VaultTimeoutServiceAbstraction } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeout.service";
|
import { VaultTimeoutService as VaultTimeoutServiceAbstraction } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeout.service";
|
||||||
import { ContainerService } from "@bitwarden/common/services/container.service";
|
import { ContainerService } from "@bitwarden/common/services/container.service";
|
||||||
import { EventService as EventLoggingService } from "@bitwarden/common/services/event.service";
|
import { EventUploadService } from "@bitwarden/common/services/event/event-upload.service";
|
||||||
import { VaultTimeoutService as VaultTimeoutService } from "@bitwarden/common/services/vaultTimeout/vaultTimeout.service";
|
import { VaultTimeoutService as VaultTimeoutService } from "@bitwarden/common/services/vaultTimeout/vaultTimeout.service";
|
||||||
|
|
||||||
import { I18nService } from "./i18n.service";
|
import { I18nService } from "./i18n.service";
|
||||||
|
@ -28,7 +28,7 @@ export class InitService {
|
||||||
private notificationsService: NotificationsServiceAbstraction,
|
private notificationsService: NotificationsServiceAbstraction,
|
||||||
private vaultTimeoutService: VaultTimeoutServiceAbstraction,
|
private vaultTimeoutService: VaultTimeoutServiceAbstraction,
|
||||||
private i18nService: I18nServiceAbstraction,
|
private i18nService: I18nServiceAbstraction,
|
||||||
private eventLoggingService: EventLoggingServiceAbstraction,
|
private eventUploadService: EventUploadServiceAbstraction,
|
||||||
private twoFactorService: TwoFactorServiceAbstraction,
|
private twoFactorService: TwoFactorServiceAbstraction,
|
||||||
private stateService: StateServiceAbstraction,
|
private stateService: StateServiceAbstraction,
|
||||||
private cryptoService: CryptoServiceAbstraction,
|
private cryptoService: CryptoServiceAbstraction,
|
||||||
|
@ -48,7 +48,7 @@ export class InitService {
|
||||||
(this.vaultTimeoutService as VaultTimeoutService).init(true);
|
(this.vaultTimeoutService as VaultTimeoutService).init(true);
|
||||||
const locale = await this.stateService.getLocale();
|
const locale = await this.stateService.getLocale();
|
||||||
await (this.i18nService as I18nService).init(locale);
|
await (this.i18nService as I18nService).init(locale);
|
||||||
(this.eventLoggingService as EventLoggingService).init(true);
|
(this.eventUploadService as EventUploadService).init(true);
|
||||||
this.twoFactorService.init();
|
this.twoFactorService.init();
|
||||||
const htmlEl = this.win.document.documentElement;
|
const htmlEl = this.win.document.documentElement;
|
||||||
htmlEl.classList.add("locale_" + this.i18nService.translationLocale);
|
htmlEl.classList.add("locale_" + this.i18nService.translationLocale);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { ActivatedRoute } from "@angular/router";
|
||||||
|
|
||||||
import { ModalService } from "@bitwarden/angular/services/modal.service";
|
import { ModalService } from "@bitwarden/angular/services/modal.service";
|
||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { ExportService } from "@bitwarden/common/abstractions/export.service";
|
import { ExportService } from "@bitwarden/common/abstractions/export.service";
|
||||||
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
|
@ -27,7 +27,7 @@ export class OrganizationExportComponent extends ExportComponent {
|
||||||
i18nService: I18nService,
|
i18nService: I18nService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
exportService: ExportService,
|
exportService: ExportService,
|
||||||
eventService: EventService,
|
eventCollectionService: EventCollectionService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
|
@ -41,7 +41,7 @@ export class OrganizationExportComponent extends ExportComponent {
|
||||||
i18nService,
|
i18nService,
|
||||||
platformUtilsService,
|
platformUtilsService,
|
||||||
exportService,
|
exportService,
|
||||||
eventService,
|
eventCollectionService,
|
||||||
policyService,
|
policyService,
|
||||||
logService,
|
logService,
|
||||||
userVerificationService,
|
userVerificationService,
|
||||||
|
@ -76,7 +76,7 @@ export class OrganizationExportComponent extends ExportComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
async collectEvent(): Promise<void> {
|
async collectEvent(): Promise<void> {
|
||||||
await this.eventService.collect(
|
await this.eventCollectionService.collect(
|
||||||
EventType.Organization_ClientExportedVault,
|
EventType.Organization_ClientExportedVault,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
|
@ -42,7 +42,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||||
passwordGenerationService: PasswordGenerationService,
|
passwordGenerationService: PasswordGenerationService,
|
||||||
private apiService: ApiService,
|
private apiService: ApiService,
|
||||||
messagingService: MessagingService,
|
messagingService: MessagingService,
|
||||||
eventService: EventService,
|
eventCollectionService: EventCollectionService,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
passwordRepromptService: PasswordRepromptService,
|
passwordRepromptService: PasswordRepromptService,
|
||||||
|
@ -59,7 +59,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||||
totpService,
|
totpService,
|
||||||
passwordGenerationService,
|
passwordGenerationService,
|
||||||
messagingService,
|
messagingService,
|
||||||
eventService,
|
eventCollectionService,
|
||||||
policyService,
|
policyService,
|
||||||
organizationService,
|
organizationService,
|
||||||
logService,
|
logService,
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Component, EventEmitter, Output } from "@angular/core";
|
||||||
|
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
||||||
|
@ -30,7 +30,7 @@ export class VaultItemsComponent extends BaseVaultItemsComponent {
|
||||||
i18nService: I18nService,
|
i18nService: I18nService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
cipherService: CipherService,
|
cipherService: CipherService,
|
||||||
eventService: EventService,
|
eventCollectionService: EventCollectionService,
|
||||||
totpService: TotpService,
|
totpService: TotpService,
|
||||||
passwordRepromptService: PasswordRepromptService,
|
passwordRepromptService: PasswordRepromptService,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
|
@ -44,7 +44,7 @@ export class VaultItemsComponent extends BaseVaultItemsComponent {
|
||||||
i18nService,
|
i18nService,
|
||||||
platformUtilsService,
|
platformUtilsService,
|
||||||
cipherService,
|
cipherService,
|
||||||
eventService,
|
eventCollectionService,
|
||||||
totpService,
|
totpService,
|
||||||
stateService,
|
stateService,
|
||||||
passwordRepromptService,
|
passwordRepromptService,
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { Component } from "@angular/core";
|
||||||
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
|
@ -38,7 +38,7 @@ export class EmergencyAddEditComponent extends BaseAddEditComponent {
|
||||||
totpService: TotpService,
|
totpService: TotpService,
|
||||||
passwordGenerationService: PasswordGenerationService,
|
passwordGenerationService: PasswordGenerationService,
|
||||||
messagingService: MessagingService,
|
messagingService: MessagingService,
|
||||||
eventService: EventService,
|
eventCollectionService: EventCollectionService,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
passwordRepromptService: PasswordRepromptService,
|
passwordRepromptService: PasswordRepromptService,
|
||||||
organizationService: OrganizationService,
|
organizationService: OrganizationService,
|
||||||
|
@ -55,7 +55,7 @@ export class EmergencyAddEditComponent extends BaseAddEditComponent {
|
||||||
totpService,
|
totpService,
|
||||||
passwordGenerationService,
|
passwordGenerationService,
|
||||||
messagingService,
|
messagingService,
|
||||||
eventService,
|
eventCollectionService,
|
||||||
policyService,
|
policyService,
|
||||||
organizationService,
|
organizationService,
|
||||||
logService,
|
logService,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { UntypedFormBuilder } from "@angular/forms";
|
||||||
import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/components/export.component";
|
import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/components/export.component";
|
||||||
import { ModalService } from "@bitwarden/angular/services/modal.service";
|
import { ModalService } from "@bitwarden/angular/services/modal.service";
|
||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { ExportService } from "@bitwarden/common/abstractions/export.service";
|
import { ExportService } from "@bitwarden/common/abstractions/export.service";
|
||||||
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
|
@ -29,7 +29,7 @@ export class ExportComponent extends BaseExportComponent {
|
||||||
i18nService: I18nService,
|
i18nService: I18nService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
exportService: ExportService,
|
exportService: ExportService,
|
||||||
eventService: EventService,
|
eventCollectionService: EventCollectionService,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
userVerificationService: UserVerificationService,
|
userVerificationService: UserVerificationService,
|
||||||
|
@ -42,7 +42,7 @@ export class ExportComponent extends BaseExportComponent {
|
||||||
i18nService,
|
i18nService,
|
||||||
platformUtilsService,
|
platformUtilsService,
|
||||||
exportService,
|
exportService,
|
||||||
eventService,
|
eventCollectionService,
|
||||||
policyService,
|
policyService,
|
||||||
window,
|
window,
|
||||||
logService,
|
logService,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Component, Input } from "@angular/core";
|
import { Component, Input } from "@angular/core";
|
||||||
|
|
||||||
import { AddEditCustomFieldsComponent as BaseAddEditCustomFieldsComponent } from "@bitwarden/angular/components/add-edit-custom-fields.component";
|
import { AddEditCustomFieldsComponent as BaseAddEditCustomFieldsComponent } from "@bitwarden/angular/components/add-edit-custom-fields.component";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -12,7 +12,7 @@ export class AddEditCustomFieldsComponent extends BaseAddEditCustomFieldsCompone
|
||||||
@Input() viewOnly: boolean;
|
@Input() viewOnly: boolean;
|
||||||
@Input() copy: (value: string, typeI18nKey: string, aType: string) => void;
|
@Input() copy: (value: string, typeI18nKey: string, aType: string) => void;
|
||||||
|
|
||||||
constructor(i18nService: I18nService, eventService: EventService) {
|
constructor(i18nService: I18nService, eventCollectionService: EventCollectionService) {
|
||||||
super(i18nService, eventService);
|
super(i18nService, eventCollectionService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { AddEditComponent as BaseAddEditComponent } from "@bitwarden/angular/com
|
||||||
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
|
@ -49,7 +49,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit, On
|
||||||
protected totpService: TotpService,
|
protected totpService: TotpService,
|
||||||
protected passwordGenerationService: PasswordGenerationService,
|
protected passwordGenerationService: PasswordGenerationService,
|
||||||
protected messagingService: MessagingService,
|
protected messagingService: MessagingService,
|
||||||
eventService: EventService,
|
eventCollectionService: EventCollectionService,
|
||||||
protected policyService: PolicyService,
|
protected policyService: PolicyService,
|
||||||
organizationService: OrganizationService,
|
organizationService: OrganizationService,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
|
@ -64,7 +64,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit, On
|
||||||
stateService,
|
stateService,
|
||||||
collectionService,
|
collectionService,
|
||||||
messagingService,
|
messagingService,
|
||||||
eventService,
|
eventCollectionService,
|
||||||
policyService,
|
policyService,
|
||||||
logService,
|
logService,
|
||||||
passwordRepromptService,
|
passwordRepromptService,
|
||||||
|
@ -125,11 +125,17 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit, On
|
||||||
|
|
||||||
if (this.editMode) {
|
if (this.editMode) {
|
||||||
if (typeI18nKey === "password") {
|
if (typeI18nKey === "password") {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, this.cipherId);
|
this.eventCollectionService.collect(
|
||||||
|
EventType.Cipher_ClientToggledHiddenFieldVisible,
|
||||||
|
this.cipherId
|
||||||
|
);
|
||||||
} else if (typeI18nKey === "securityCode") {
|
} else if (typeI18nKey === "securityCode") {
|
||||||
this.eventService.collect(EventType.Cipher_ClientCopiedCardCode, this.cipherId);
|
this.eventCollectionService.collect(EventType.Cipher_ClientCopiedCardCode, this.cipherId);
|
||||||
} else if (aType === "H_Field") {
|
} else if (aType === "H_Field") {
|
||||||
this.eventService.collect(EventType.Cipher_ClientCopiedHiddenField, this.cipherId);
|
this.eventCollectionService.collect(
|
||||||
|
EventType.Cipher_ClientCopiedHiddenField,
|
||||||
|
this.cipherId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, OnDestroy, Output } from "@angular/core
|
||||||
|
|
||||||
import { VaultItemsComponent as BaseVaultItemsComponent } from "@bitwarden/angular/components/vault-items.component";
|
import { VaultItemsComponent as BaseVaultItemsComponent } from "@bitwarden/angular/components/vault-items.component";
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
||||||
|
@ -51,7 +51,7 @@ export class VaultItemsComponent extends BaseVaultItemsComponent implements OnDe
|
||||||
protected i18nService: I18nService,
|
protected i18nService: I18nService,
|
||||||
protected platformUtilsService: PlatformUtilsService,
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
protected cipherService: CipherService,
|
protected cipherService: CipherService,
|
||||||
protected eventService: EventService,
|
protected eventCollectionService: EventCollectionService,
|
||||||
protected totpService: TotpService,
|
protected totpService: TotpService,
|
||||||
protected stateService: StateService,
|
protected stateService: StateService,
|
||||||
protected passwordRepromptService: PasswordRepromptService,
|
protected passwordRepromptService: PasswordRepromptService,
|
||||||
|
@ -241,9 +241,12 @@ export class VaultItemsComponent extends BaseVaultItemsComponent implements OnDe
|
||||||
);
|
);
|
||||||
|
|
||||||
if (typeI18nKey === "password" || typeI18nKey === "verificationCodeTotp") {
|
if (typeI18nKey === "password" || typeI18nKey === "verificationCodeTotp") {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, cipher.id);
|
this.eventCollectionService.collect(
|
||||||
|
EventType.Cipher_ClientToggledHiddenFieldVisible,
|
||||||
|
cipher.id
|
||||||
|
);
|
||||||
} else if (typeI18nKey === "securityCode") {
|
} else if (typeI18nKey === "securityCode") {
|
||||||
this.eventService.collect(EventType.Cipher_ClientCopiedCardCode, cipher.id);
|
this.eventCollectionService.collect(EventType.Cipher_ClientCopiedCardCode, cipher.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { CdkDragDrop, moveItemInArray } from "@angular/cdk/drag-drop";
|
import { CdkDragDrop, moveItemInArray } from "@angular/cdk/drag-drop";
|
||||||
import { Directive, Input, OnChanges, SimpleChanges } from "@angular/core";
|
import { Directive, Input, OnChanges, SimpleChanges } from "@angular/core";
|
||||||
|
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
||||||
import { EventType } from "@bitwarden/common/enums/eventType";
|
import { EventType } from "@bitwarden/common/enums/eventType";
|
||||||
|
@ -25,7 +25,10 @@ export class AddEditCustomFieldsComponent implements OnChanges {
|
||||||
fieldType = FieldType;
|
fieldType = FieldType;
|
||||||
eventType = EventType;
|
eventType = EventType;
|
||||||
|
|
||||||
constructor(private i18nService: I18nService, private eventService: EventService) {
|
constructor(
|
||||||
|
private i18nService: I18nService,
|
||||||
|
private eventCollectionService: EventCollectionService
|
||||||
|
) {
|
||||||
this.addFieldTypeOptions = [
|
this.addFieldTypeOptions = [
|
||||||
{ name: i18nService.t("cfTypeText"), value: FieldType.Text },
|
{ name: i18nService.t("cfTypeText"), value: FieldType.Text },
|
||||||
{ name: i18nService.t("cfTypeHidden"), value: FieldType.Hidden },
|
{ name: i18nService.t("cfTypeHidden"), value: FieldType.Hidden },
|
||||||
|
@ -74,7 +77,10 @@ export class AddEditCustomFieldsComponent implements OnChanges {
|
||||||
const f = field as any;
|
const f = field as any;
|
||||||
f.showValue = !f.showValue;
|
f.showValue = !f.showValue;
|
||||||
if (this.editMode && f.showValue) {
|
if (this.editMode && f.showValue) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, this.cipher.id);
|
this.eventCollectionService.collect(
|
||||||
|
EventType.Cipher_ClientToggledHiddenFieldVisible,
|
||||||
|
this.cipher.id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Observable, Subject, takeUntil, concatMap } from "rxjs";
|
||||||
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
|
@ -91,7 +91,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||||
protected stateService: StateService,
|
protected stateService: StateService,
|
||||||
protected collectionService: CollectionService,
|
protected collectionService: CollectionService,
|
||||||
protected messagingService: MessagingService,
|
protected messagingService: MessagingService,
|
||||||
protected eventService: EventService,
|
protected eventCollectionService: EventCollectionService,
|
||||||
protected policyService: PolicyService,
|
protected policyService: PolicyService,
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
protected passwordRepromptService: PasswordRepromptService,
|
protected passwordRepromptService: PasswordRepromptService,
|
||||||
|
@ -266,7 +266,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||||
this.folders$ = this.folderService.folderViews$;
|
this.folders$ = this.folderService.folderViews$;
|
||||||
|
|
||||||
if (this.editMode && this.previousCipherId !== this.cipherId) {
|
if (this.editMode && this.previousCipherId !== this.cipherId) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientViewed, this.cipherId);
|
this.eventCollectionService.collect(EventType.Cipher_ClientViewed, this.cipherId);
|
||||||
}
|
}
|
||||||
this.previousCipherId = this.cipherId;
|
this.previousCipherId = this.cipherId;
|
||||||
this.reprompt = this.cipher.reprompt !== CipherRepromptType.None;
|
this.reprompt = this.cipher.reprompt !== CipherRepromptType.None;
|
||||||
|
@ -489,14 +489,20 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||||
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) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledPasswordVisible, this.cipherId);
|
this.eventCollectionService.collect(
|
||||||
|
EventType.Cipher_ClientToggledPasswordVisible,
|
||||||
|
this.cipherId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async toggleCardNumber() {
|
async toggleCardNumber() {
|
||||||
this.showCardNumber = !this.showCardNumber;
|
this.showCardNumber = !this.showCardNumber;
|
||||||
if (this.showCardNumber) {
|
if (this.showCardNumber) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledCardNumberVisible, this.cipherId);
|
this.eventCollectionService.collect(
|
||||||
|
EventType.Cipher_ClientToggledCardNumberVisible,
|
||||||
|
this.cipherId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +510,10 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
||||||
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) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledCardCodeVisible, this.cipherId);
|
this.eventCollectionService.collect(
|
||||||
|
EventType.Cipher_ClientToggledCardCodeVisible,
|
||||||
|
this.cipherId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { UntypedFormBuilder, Validators } from "@angular/forms";
|
||||||
import { merge, takeUntil, Subject, startWith } from "rxjs";
|
import { merge, takeUntil, Subject, startWith } from "rxjs";
|
||||||
|
|
||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { ExportService } from "@bitwarden/common/abstractions/export.service";
|
import { ExportService } from "@bitwarden/common/abstractions/export.service";
|
||||||
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
|
@ -45,7 +45,7 @@ export class ExportComponent implements OnInit, OnDestroy {
|
||||||
protected i18nService: I18nService,
|
protected i18nService: I18nService,
|
||||||
protected platformUtilsService: PlatformUtilsService,
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
protected exportService: ExportService,
|
protected exportService: ExportService,
|
||||||
protected eventService: EventService,
|
protected eventCollectionService: EventCollectionService,
|
||||||
private policyService: PolicyService,
|
private policyService: PolicyService,
|
||||||
protected win: Window,
|
protected win: Window,
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
|
@ -180,7 +180,7 @@ export class ExportComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async collectEvent(): Promise<void> {
|
protected async collectEvent(): Promise<void> {
|
||||||
await this.eventService.collect(EventType.User_ClientExportedVault);
|
await this.eventCollectionService.collect(EventType.User_ClientExportedVault);
|
||||||
}
|
}
|
||||||
|
|
||||||
get format() {
|
get format() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Directive, Input } from "@angular/core";
|
import { Directive, Input } from "@angular/core";
|
||||||
|
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { EventType } from "@bitwarden/common/enums/eventType";
|
import { EventType } from "@bitwarden/common/enums/eventType";
|
||||||
import { FieldType } from "@bitwarden/common/enums/fieldType";
|
import { FieldType } from "@bitwarden/common/enums/fieldType";
|
||||||
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
||||||
|
@ -14,7 +14,7 @@ export class ViewCustomFieldsComponent {
|
||||||
|
|
||||||
fieldType = FieldType;
|
fieldType = FieldType;
|
||||||
|
|
||||||
constructor(private eventService: EventService) {}
|
constructor(private eventCollectionService: EventCollectionService) {}
|
||||||
|
|
||||||
async toggleFieldValue(field: FieldView) {
|
async toggleFieldValue(field: FieldView) {
|
||||||
if (!(await this.promptPassword())) {
|
if (!(await this.promptPassword())) {
|
||||||
|
@ -25,7 +25,10 @@ export class ViewCustomFieldsComponent {
|
||||||
f.showValue = !f.showValue;
|
f.showValue = !f.showValue;
|
||||||
f.showCount = false;
|
f.showCount = false;
|
||||||
if (f.showValue) {
|
if (f.showValue) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, this.cipher.id);
|
this.eventCollectionService.collect(
|
||||||
|
EventType.Cipher_ClientToggledHiddenFieldVisible,
|
||||||
|
this.cipher.id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||||
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
|
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
||||||
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
|
@ -80,7 +80,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||||
protected broadcasterService: BroadcasterService,
|
protected broadcasterService: BroadcasterService,
|
||||||
protected ngZone: NgZone,
|
protected ngZone: NgZone,
|
||||||
protected changeDetectorRef: ChangeDetectorRef,
|
protected changeDetectorRef: ChangeDetectorRef,
|
||||||
protected eventService: EventService,
|
protected eventCollectionService: EventCollectionService,
|
||||||
protected apiService: ApiService,
|
protected apiService: ApiService,
|
||||||
protected passwordRepromptService: PasswordRepromptService,
|
protected passwordRepromptService: PasswordRepromptService,
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
|
@ -138,7 +138,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.previousCipherId !== this.cipherId) {
|
if (this.previousCipherId !== this.cipherId) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientViewed, this.cipherId);
|
this.eventCollectionService.collect(EventType.Cipher_ClientViewed, this.cipherId);
|
||||||
}
|
}
|
||||||
this.previousCipherId = this.cipherId;
|
this.previousCipherId = this.cipherId;
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,10 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||||
this.showPassword = !this.showPassword;
|
this.showPassword = !this.showPassword;
|
||||||
this.showPasswordCount = false;
|
this.showPasswordCount = false;
|
||||||
if (this.showPassword) {
|
if (this.showPassword) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledPasswordVisible, this.cipherId);
|
this.eventCollectionService.collect(
|
||||||
|
EventType.Cipher_ClientToggledPasswordVisible,
|
||||||
|
this.cipherId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +260,10 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
this.showCardNumber = !this.showCardNumber;
|
this.showCardNumber = !this.showCardNumber;
|
||||||
if (this.showCardNumber) {
|
if (this.showCardNumber) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledCardNumberVisible, this.cipherId);
|
this.eventCollectionService.collect(
|
||||||
|
EventType.Cipher_ClientToggledCardNumberVisible,
|
||||||
|
this.cipherId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +274,10 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
this.showCardCode = !this.showCardCode;
|
this.showCardCode = !this.showCardCode;
|
||||||
if (this.showCardCode) {
|
if (this.showCardCode) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledCardCodeVisible, this.cipherId);
|
this.eventCollectionService.collect(
|
||||||
|
EventType.Cipher_ClientToggledCardCodeVisible,
|
||||||
|
this.cipherId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,11 +337,14 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (typeI18nKey === "password") {
|
if (typeI18nKey === "password") {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, this.cipherId);
|
this.eventCollectionService.collect(
|
||||||
|
EventType.Cipher_ClientToggledHiddenFieldVisible,
|
||||||
|
this.cipherId
|
||||||
|
);
|
||||||
} else if (typeI18nKey === "securityCode") {
|
} else if (typeI18nKey === "securityCode") {
|
||||||
this.eventService.collect(EventType.Cipher_ClientCopiedCardCode, this.cipherId);
|
this.eventCollectionService.collect(EventType.Cipher_ClientCopiedCardCode, this.cipherId);
|
||||||
} else if (aType === "H_Field") {
|
} else if (aType === "H_Field") {
|
||||||
this.eventService.collect(EventType.Cipher_ClientCopiedHiddenField, this.cipherId);
|
this.eventCollectionService.collect(EventType.Cipher_ClientCopiedHiddenField, this.cipherId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@ import { CryptoService as CryptoServiceAbstraction } from "@bitwarden/common/abs
|
||||||
import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/abstractions/cryptoFunction.service";
|
import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/abstractions/cryptoFunction.service";
|
||||||
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
||||||
import { EnvironmentService as EnvironmentServiceAbstraction } from "@bitwarden/common/abstractions/environment.service";
|
import { EnvironmentService as EnvironmentServiceAbstraction } from "@bitwarden/common/abstractions/environment.service";
|
||||||
import { EventService as EventServiceAbstraction } from "@bitwarden/common/abstractions/event.service";
|
import { EventCollectionService as EventCollectionServiceAbstraction } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
|
import { EventUploadService as EventUploadServiceAbstraction } from "@bitwarden/common/abstractions/event/event-upload.service";
|
||||||
import { ExportService as ExportServiceAbstraction } from "@bitwarden/common/abstractions/export.service";
|
import { ExportService as ExportServiceAbstraction } from "@bitwarden/common/abstractions/export.service";
|
||||||
import { FileUploadService as FileUploadServiceAbstraction } from "@bitwarden/common/abstractions/fileUpload.service";
|
import { FileUploadService as FileUploadServiceAbstraction } from "@bitwarden/common/abstractions/fileUpload.service";
|
||||||
import { FolderApiServiceAbstraction } from "@bitwarden/common/abstractions/folder/folder-api.service.abstraction";
|
import { FolderApiServiceAbstraction } from "@bitwarden/common/abstractions/folder/folder-api.service.abstraction";
|
||||||
|
@ -85,7 +86,8 @@ import { CryptoService } from "@bitwarden/common/services/crypto.service";
|
||||||
import { EncryptServiceImplementation } from "@bitwarden/common/services/cryptography/encrypt.service.implementation";
|
import { EncryptServiceImplementation } from "@bitwarden/common/services/cryptography/encrypt.service.implementation";
|
||||||
import { MultithreadEncryptServiceImplementation } from "@bitwarden/common/services/cryptography/multithread-encrypt.service.implementation";
|
import { MultithreadEncryptServiceImplementation } from "@bitwarden/common/services/cryptography/multithread-encrypt.service.implementation";
|
||||||
import { EnvironmentService } from "@bitwarden/common/services/environment.service";
|
import { EnvironmentService } from "@bitwarden/common/services/environment.service";
|
||||||
import { EventService } from "@bitwarden/common/services/event.service";
|
import { EventCollectionService } from "@bitwarden/common/services/event/event-collection.service";
|
||||||
|
import { EventUploadService } from "@bitwarden/common/services/event/event-upload.service";
|
||||||
import { ExportService } from "@bitwarden/common/services/export.service";
|
import { ExportService } from "@bitwarden/common/services/export.service";
|
||||||
import { FileUploadService } from "@bitwarden/common/services/fileUpload.service";
|
import { FileUploadService } from "@bitwarden/common/services/fileUpload.service";
|
||||||
import { FolderApiService } from "@bitwarden/common/services/folder/folder-api.service";
|
import { FolderApiService } from "@bitwarden/common/services/folder/folder-api.service";
|
||||||
|
@ -457,14 +459,18 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
|
||||||
deps: [CryptoFunctionServiceAbstraction, LogService, LOG_MAC_FAILURES],
|
deps: [CryptoFunctionServiceAbstraction, LogService, LOG_MAC_FAILURES],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
provide: EventServiceAbstraction,
|
provide: EventUploadServiceAbstraction,
|
||||||
useClass: EventService,
|
useClass: EventUploadService,
|
||||||
|
deps: [ApiServiceAbstraction, StateServiceAbstraction, LogService],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: EventCollectionServiceAbstraction,
|
||||||
|
useClass: EventCollectionService,
|
||||||
deps: [
|
deps: [
|
||||||
ApiServiceAbstraction,
|
|
||||||
CipherServiceAbstraction,
|
CipherServiceAbstraction,
|
||||||
StateServiceAbstraction,
|
StateServiceAbstraction,
|
||||||
LogService,
|
|
||||||
OrganizationServiceAbstraction,
|
OrganizationServiceAbstraction,
|
||||||
|
EventUploadServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
import { EventType } from "../enums/eventType";
|
|
||||||
|
|
||||||
export abstract class EventService {
|
|
||||||
collect: (
|
|
||||||
eventType: EventType,
|
|
||||||
cipherId?: string,
|
|
||||||
uploadImmediately?: boolean,
|
|
||||||
organizationId?: string
|
|
||||||
) => Promise<any>;
|
|
||||||
uploadEvents: (userId?: string) => Promise<any>;
|
|
||||||
clearEvents: (userId?: string) => Promise<any>;
|
|
||||||
}
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
import { EventType } from "../../enums/eventType";
|
||||||
|
|
||||||
|
export abstract class EventCollectionService {
|
||||||
|
collect: (
|
||||||
|
eventType: EventType,
|
||||||
|
cipherId?: string,
|
||||||
|
uploadImmediately?: boolean,
|
||||||
|
organizationId?: string
|
||||||
|
) => Promise<any>;
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
export abstract class EventUploadService {
|
||||||
|
uploadEvents: (userId?: string) => Promise<void>;
|
||||||
|
}
|
|
@ -1,107 +0,0 @@
|
||||||
import { ApiService } from "../abstractions/api.service";
|
|
||||||
import { CipherService } from "../abstractions/cipher.service";
|
|
||||||
import { EventService as EventServiceAbstraction } from "../abstractions/event.service";
|
|
||||||
import { LogService } from "../abstractions/log.service";
|
|
||||||
import { OrganizationService } from "../abstractions/organization/organization.service.abstraction";
|
|
||||||
import { StateService } from "../abstractions/state.service";
|
|
||||||
import { EventType } from "../enums/eventType";
|
|
||||||
import { EventData } from "../models/data/event.data";
|
|
||||||
import { EventRequest } from "../models/request/event.request";
|
|
||||||
|
|
||||||
export class EventService implements EventServiceAbstraction {
|
|
||||||
private inited = false;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private apiService: ApiService,
|
|
||||||
private cipherService: CipherService,
|
|
||||||
private stateService: StateService,
|
|
||||||
private logService: LogService,
|
|
||||||
private organizationService: OrganizationService
|
|
||||||
) {}
|
|
||||||
|
|
||||||
init(checkOnInterval: boolean) {
|
|
||||||
if (this.inited) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.inited = true;
|
|
||||||
if (checkOnInterval) {
|
|
||||||
this.uploadEvents();
|
|
||||||
setInterval(() => this.uploadEvents(), 60 * 1000); // check every 60 seconds
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async collect(
|
|
||||||
eventType: EventType,
|
|
||||||
cipherId: string = null,
|
|
||||||
uploadImmediately = false,
|
|
||||||
organizationId: string = null
|
|
||||||
): Promise<any> {
|
|
||||||
const authed = await this.stateService.getIsAuthenticated();
|
|
||||||
if (!authed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const organizations = await this.organizationService.getAll();
|
|
||||||
if (organizations == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const orgIds = new Set<string>(organizations.filter((o) => o.useEvents).map((o) => o.id));
|
|
||||||
if (orgIds.size === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (cipherId != null) {
|
|
||||||
const cipher = await this.cipherService.get(cipherId);
|
|
||||||
if (cipher == null || cipher.organizationId == null || !orgIds.has(cipher.organizationId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (organizationId != null) {
|
|
||||||
if (!orgIds.has(organizationId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let eventCollection = await this.stateService.getEventCollection();
|
|
||||||
if (eventCollection == null) {
|
|
||||||
eventCollection = [];
|
|
||||||
}
|
|
||||||
const event = new EventData();
|
|
||||||
event.type = eventType;
|
|
||||||
event.cipherId = cipherId;
|
|
||||||
event.date = new Date().toISOString();
|
|
||||||
event.organizationId = organizationId;
|
|
||||||
eventCollection.push(event);
|
|
||||||
await this.stateService.setEventCollection(eventCollection);
|
|
||||||
if (uploadImmediately) {
|
|
||||||
await this.uploadEvents();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async uploadEvents(userId?: string): Promise<any> {
|
|
||||||
const authed = await this.stateService.getIsAuthenticated({ userId: userId });
|
|
||||||
if (!authed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const eventCollection = await this.stateService.getEventCollection({ userId: userId });
|
|
||||||
if (eventCollection == null || eventCollection.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const request = eventCollection.map((e) => {
|
|
||||||
const req = new EventRequest();
|
|
||||||
req.type = e.type;
|
|
||||||
req.cipherId = e.cipherId;
|
|
||||||
req.date = e.date;
|
|
||||||
req.organizationId = e.organizationId;
|
|
||||||
return req;
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
await this.apiService.postEventsCollect(request);
|
|
||||||
this.clearEvents(userId);
|
|
||||||
} catch (e) {
|
|
||||||
this.logService.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async clearEvents(userId?: string): Promise<any> {
|
|
||||||
await this.stateService.setEventCollection(null, { userId: userId });
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
import { CipherService } from "../../abstractions/cipher.service";
|
||||||
|
import { EventCollectionService as EventCollectionServiceAbstraction } from "../../abstractions/event/event-collection.service";
|
||||||
|
import { EventUploadService } from "../../abstractions/event/event-upload.service";
|
||||||
|
import { OrganizationService } from "../../abstractions/organization/organization.service.abstraction";
|
||||||
|
import { StateService } from "../../abstractions/state.service";
|
||||||
|
import { EventType } from "../../enums/eventType";
|
||||||
|
import { EventData } from "../../models/data/event.data";
|
||||||
|
|
||||||
|
export class EventCollectionService implements EventCollectionServiceAbstraction {
|
||||||
|
constructor(
|
||||||
|
private cipherService: CipherService,
|
||||||
|
private stateService: StateService,
|
||||||
|
private organizationService: OrganizationService,
|
||||||
|
private eventUploadService: EventUploadService
|
||||||
|
) {}
|
||||||
|
|
||||||
|
async collect(
|
||||||
|
eventType: EventType,
|
||||||
|
cipherId: string = null,
|
||||||
|
uploadImmediately = false,
|
||||||
|
organizationId: string = null
|
||||||
|
): Promise<any> {
|
||||||
|
const authed = await this.stateService.getIsAuthenticated();
|
||||||
|
if (!authed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const organizations = await this.organizationService.getAll();
|
||||||
|
if (organizations == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const orgIds = new Set<string>(organizations.filter((o) => o.useEvents).map((o) => o.id));
|
||||||
|
if (orgIds.size === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cipherId != null) {
|
||||||
|
const cipher = await this.cipherService.get(cipherId);
|
||||||
|
if (cipher == null || cipher.organizationId == null || !orgIds.has(cipher.organizationId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (organizationId != null) {
|
||||||
|
if (!orgIds.has(organizationId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let eventCollection = await this.stateService.getEventCollection();
|
||||||
|
if (eventCollection == null) {
|
||||||
|
eventCollection = [];
|
||||||
|
}
|
||||||
|
const event = new EventData();
|
||||||
|
event.type = eventType;
|
||||||
|
event.cipherId = cipherId;
|
||||||
|
event.date = new Date().toISOString();
|
||||||
|
event.organizationId = organizationId;
|
||||||
|
eventCollection.push(event);
|
||||||
|
await this.stateService.setEventCollection(eventCollection);
|
||||||
|
if (uploadImmediately) {
|
||||||
|
await this.eventUploadService.uploadEvents();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
import { ApiService } from "../../abstractions/api.service";
|
||||||
|
import { EventUploadService as EventUploadServiceAbstraction } from "../../abstractions/event/event-upload.service";
|
||||||
|
import { LogService } from "../../abstractions/log.service";
|
||||||
|
import { StateService } from "../../abstractions/state.service";
|
||||||
|
import { EventRequest } from "../../models/request/event.request";
|
||||||
|
|
||||||
|
export class EventUploadService implements EventUploadServiceAbstraction {
|
||||||
|
private inited = false;
|
||||||
|
constructor(
|
||||||
|
private apiService: ApiService,
|
||||||
|
private stateService: StateService,
|
||||||
|
private logService: LogService
|
||||||
|
) {}
|
||||||
|
|
||||||
|
init(checkOnInterval: boolean) {
|
||||||
|
if (this.inited) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.inited = true;
|
||||||
|
if (checkOnInterval) {
|
||||||
|
this.uploadEvents();
|
||||||
|
setInterval(() => this.uploadEvents(), 60 * 1000); // check every 60 seconds
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async uploadEvents(userId?: string): Promise<void> {
|
||||||
|
const authed = await this.stateService.getIsAuthenticated({ userId: userId });
|
||||||
|
if (!authed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const eventCollection = await this.stateService.getEventCollection({ userId: userId });
|
||||||
|
if (eventCollection == null || eventCollection.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const request = eventCollection.map((e) => {
|
||||||
|
const req = new EventRequest();
|
||||||
|
req.type = e.type;
|
||||||
|
req.cipherId = e.cipherId;
|
||||||
|
req.date = e.date;
|
||||||
|
req.organizationId = e.organizationId;
|
||||||
|
return req;
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
await this.apiService.postEventsCollect(request);
|
||||||
|
this.clearEvents(userId);
|
||||||
|
} catch (e) {
|
||||||
|
this.logService.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async clearEvents(userId?: string): Promise<any> {
|
||||||
|
await this.stateService.setEventCollection(null, { userId: userId });
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue