mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 22:03:36 +00:00
This reverts commit 5a1940f3f4.
This commit is contained in:
@@ -92,7 +92,6 @@ import { BrowserStateService as StateServiceAbstraction } from "../services/abst
|
|||||||
import AutofillService from "../services/autofill.service";
|
import AutofillService from "../services/autofill.service";
|
||||||
import { BrowserEnvironmentService } from "../services/browser-environment.service";
|
import { BrowserEnvironmentService } from "../services/browser-environment.service";
|
||||||
import { BrowserFolderService } from "../services/browser-folder.service";
|
import { BrowserFolderService } from "../services/browser-folder.service";
|
||||||
import BrowserI18nServiceImplementation from "../services/browser-i18n.service.implementation";
|
|
||||||
import { BrowserOrganizationService } from "../services/browser-organization.service";
|
import { BrowserOrganizationService } from "../services/browser-organization.service";
|
||||||
import { BrowserPolicyService } from "../services/browser-policy.service";
|
import { BrowserPolicyService } from "../services/browser-policy.service";
|
||||||
import { BrowserSettingsService } from "../services/browser-settings.service";
|
import { BrowserSettingsService } from "../services/browser-settings.service";
|
||||||
@@ -102,6 +101,7 @@ import BrowserLocalStorageService from "../services/browserLocalStorage.service"
|
|||||||
import BrowserMessagingService from "../services/browserMessaging.service";
|
import BrowserMessagingService from "../services/browserMessaging.service";
|
||||||
import BrowserMessagingPrivateModeBackgroundService from "../services/browserMessagingPrivateModeBackground.service";
|
import BrowserMessagingPrivateModeBackgroundService from "../services/browserMessagingPrivateModeBackground.service";
|
||||||
import BrowserPlatformUtilsService from "../services/browserPlatformUtils.service";
|
import BrowserPlatformUtilsService from "../services/browserPlatformUtils.service";
|
||||||
|
import I18nService from "../services/i18n.service";
|
||||||
import { KeyGenerationService } from "../services/keyGeneration.service";
|
import { KeyGenerationService } from "../services/keyGeneration.service";
|
||||||
import { LocalBackedSessionStorageService } from "../services/localBackedSessionStorage.service";
|
import { LocalBackedSessionStorageService } from "../services/localBackedSessionStorage.service";
|
||||||
import { VaultFilterService } from "../services/vaultFilter.service";
|
import { VaultFilterService } from "../services/vaultFilter.service";
|
||||||
@@ -260,7 +260,7 @@ export default class MainBackground {
|
|||||||
},
|
},
|
||||||
window
|
window
|
||||||
);
|
);
|
||||||
this.i18nService = new BrowserI18nServiceImplementation(BrowserApi.getUILanguage(window));
|
this.i18nService = new I18nService(BrowserApi.getUILanguage(window));
|
||||||
this.encryptService = flagEnabled("multithreadDecryption")
|
this.encryptService = flagEnabled("multithreadDecryption")
|
||||||
? new MultithreadEncryptServiceImplementation(
|
? new MultithreadEncryptServiceImplementation(
|
||||||
this.cryptoFunctionService,
|
this.cryptoFunctionService,
|
||||||
@@ -566,7 +566,7 @@ export default class MainBackground {
|
|||||||
await this.stateService.init();
|
await this.stateService.init();
|
||||||
|
|
||||||
await (this.vaultTimeoutService as VaultTimeoutService).init(true);
|
await (this.vaultTimeoutService as VaultTimeoutService).init(true);
|
||||||
await (this.i18nService as BrowserI18nServiceImplementation).init();
|
await (this.i18nService as I18nService).init();
|
||||||
await (this.eventUploadService as EventUploadService).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();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService as AbstractI18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { I18nServiceImplementation } from "@bitwarden/common/services/i18n.service.implementation";
|
import { I18nService as BaseI18nService } from "@bitwarden/common/services/i18n.service";
|
||||||
|
|
||||||
import BrowserI18nServiceImplementation from "../../services/browser-i18n.service.implementation";
|
import I18nService from "../../services/i18n.service";
|
||||||
|
|
||||||
import { FactoryOptions, CachedServices, factory } from "./factory-options";
|
import { FactoryOptions, CachedServices, factory } from "./factory-options";
|
||||||
|
|
||||||
@@ -14,17 +14,17 @@ type I18nServiceFactoryOptions = FactoryOptions & {
|
|||||||
export type I18nServiceInitOptions = I18nServiceFactoryOptions;
|
export type I18nServiceInitOptions = I18nServiceFactoryOptions;
|
||||||
|
|
||||||
export async function i18nServiceFactory(
|
export async function i18nServiceFactory(
|
||||||
cache: { i18nService?: I18nService } & CachedServices,
|
cache: { i18nService?: AbstractI18nService } & CachedServices,
|
||||||
opts: I18nServiceInitOptions
|
opts: I18nServiceInitOptions
|
||||||
): Promise<I18nService> {
|
): Promise<AbstractI18nService> {
|
||||||
const service = await factory(
|
const service = await factory(
|
||||||
cache,
|
cache,
|
||||||
"i18nService",
|
"i18nService",
|
||||||
opts,
|
opts,
|
||||||
() => new BrowserI18nServiceImplementation(opts.i18nServiceOptions.systemLanguage)
|
() => new I18nService(opts.i18nServiceOptions.systemLanguage)
|
||||||
);
|
);
|
||||||
if (!(service as I18nServiceImplementation as any).inited) {
|
if (!(service as BaseI18nService as any).inited) {
|
||||||
await (service as I18nServiceImplementation).init();
|
await (service as BaseI18nService).init();
|
||||||
}
|
}
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { I18nServiceImplementation } from "@bitwarden/common/services/i18n.service.implementation";
|
import { I18nService as BaseI18nService } from "@bitwarden/common/services/i18n.service";
|
||||||
|
|
||||||
export default class BrowserI18nServiceImplementation extends I18nServiceImplementation {
|
export default class I18nService extends BaseI18nService {
|
||||||
constructor(systemLanguage: string) {
|
constructor(systemLanguage: string) {
|
||||||
super(systemLanguage, null, async (formattedLocale: string) => {
|
super(systemLanguage, null, async (formattedLocale: string) => {
|
||||||
// Deprecated
|
// Deprecated
|
||||||
@@ -55,9 +55,9 @@ import { NodeCryptoFunctionService } from "@bitwarden/node/services/node-crypto-
|
|||||||
|
|
||||||
import { Program } from "./program";
|
import { Program } from "./program";
|
||||||
import { SendProgram } from "./send.program";
|
import { SendProgram } from "./send.program";
|
||||||
import { CliI18nServiceImplementation } from "./services/cli-i18n.service.implementation";
|
|
||||||
import { CliPlatformUtilsService } from "./services/cli-platform-utils.service";
|
import { CliPlatformUtilsService } from "./services/cli-platform-utils.service";
|
||||||
import { ConsoleLogService } from "./services/console-log.service";
|
import { ConsoleLogService } from "./services/console-log.service";
|
||||||
|
import { I18nService } from "./services/i18n.service";
|
||||||
import { LowdbStorageService } from "./services/lowdb-storage.service";
|
import { LowdbStorageService } from "./services/lowdb-storage.service";
|
||||||
import { NodeApiService } from "./services/node-api.service";
|
import { NodeApiService } from "./services/node-api.service";
|
||||||
import { NodeEnvSecureStorageService } from "./services/node-env-secure-storage.service";
|
import { NodeEnvSecureStorageService } from "./services/node-env-secure-storage.service";
|
||||||
@@ -74,7 +74,7 @@ export class Main {
|
|||||||
storageService: LowdbStorageService;
|
storageService: LowdbStorageService;
|
||||||
secureStorageService: NodeEnvSecureStorageService;
|
secureStorageService: NodeEnvSecureStorageService;
|
||||||
memoryStorageService: MemoryStorageService;
|
memoryStorageService: MemoryStorageService;
|
||||||
i18nService: CliI18nServiceImplementation;
|
i18nService: I18nService;
|
||||||
platformUtilsService: CliPlatformUtilsService;
|
platformUtilsService: CliPlatformUtilsService;
|
||||||
cryptoService: CryptoService;
|
cryptoService: CryptoService;
|
||||||
tokenService: TokenService;
|
tokenService: TokenService;
|
||||||
@@ -136,7 +136,7 @@ export class Main {
|
|||||||
p = path.join(process.env.HOME, ".config/Bitwarden CLI");
|
p = path.join(process.env.HOME, ".config/Bitwarden CLI");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.i18nService = new CliI18nServiceImplementation("en", "./locales");
|
this.i18nService = new I18nService("en", "./locales");
|
||||||
this.platformUtilsService = new CliPlatformUtilsService(ClientType.Cli, packageJson);
|
this.platformUtilsService = new CliPlatformUtilsService(ClientType.Cli, packageJson);
|
||||||
this.logService = new ConsoleLogService(
|
this.logService = new ConsoleLogService(
|
||||||
this.platformUtilsService.isDev(),
|
this.platformUtilsService.isDev(),
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
||||||
import { I18nServiceImplementation } from "@bitwarden/common/services/i18n.service.implementation";
|
import { I18nService as BaseI18nService } from "@bitwarden/common/services/i18n.service";
|
||||||
|
|
||||||
export class CliI18nServiceImplementation extends I18nServiceImplementation {
|
export class I18nService extends BaseI18nService {
|
||||||
constructor(systemLanguage: string, localesDirectory: string) {
|
constructor(systemLanguage: string, localesDirectory: string) {
|
||||||
super(systemLanguage, localesDirectory, (formattedLocale: string) => {
|
super(systemLanguage, localesDirectory, (formattedLocale: string) => {
|
||||||
const filePath = path.join(
|
const filePath = path.join(
|
||||||
@@ -17,7 +17,7 @@ import { ContainerService } from "@bitwarden/common/services/container.service";
|
|||||||
import { EventUploadService } from "@bitwarden/common/services/event/event-upload.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 { DesktopI18nServiceImplementation } from "../../services/desktop-i18n.service.implementation";
|
import { I18nService } from "../../services/i18n.service";
|
||||||
import { NativeMessagingService } from "../../services/native-messaging.service";
|
import { NativeMessagingService } from "../../services/native-messaging.service";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@@ -47,7 +47,7 @@ export class InitService {
|
|||||||
this.syncService.fullSync(true);
|
this.syncService.fullSync(true);
|
||||||
(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 DesktopI18nServiceImplementation).init(locale);
|
await (this.i18nService as I18nService).init(locale);
|
||||||
(this.eventUploadService as EventUploadService).init(true);
|
(this.eventUploadService as EventUploadService).init(true);
|
||||||
this.twoFactorService.init();
|
this.twoFactorService.init();
|
||||||
setTimeout(() => this.notificationsService.init(), 3000);
|
setTimeout(() => this.notificationsService.init(), 3000);
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import { MemoryStorageService } from "@bitwarden/common/services/memoryStorage.s
|
|||||||
import { SystemService } from "@bitwarden/common/services/system.service";
|
import { SystemService } from "@bitwarden/common/services/system.service";
|
||||||
|
|
||||||
import { Account } from "../../models/account";
|
import { Account } from "../../models/account";
|
||||||
import { DesktopI18nServiceImplementation } from "../../services/desktop-i18n.service.implementation";
|
|
||||||
import { ElectronCryptoService } from "../../services/electron-crypto.service";
|
import { ElectronCryptoService } from "../../services/electron-crypto.service";
|
||||||
import { ElectronLogService } from "../../services/electron-log.service";
|
import { ElectronLogService } from "../../services/electron-log.service";
|
||||||
import { ElectronPlatformUtilsService } from "../../services/electron-platform-utils.service";
|
import { ElectronPlatformUtilsService } from "../../services/electron-platform-utils.service";
|
||||||
@@ -49,6 +48,7 @@ import { ElectronRendererMessagingService } from "../../services/electron-render
|
|||||||
import { ElectronRendererSecureStorageService } from "../../services/electron-renderer-secure-storage.service";
|
import { ElectronRendererSecureStorageService } from "../../services/electron-renderer-secure-storage.service";
|
||||||
import { ElectronRendererStorageService } from "../../services/electron-renderer-storage.service";
|
import { ElectronRendererStorageService } from "../../services/electron-renderer-storage.service";
|
||||||
import { EncryptedMessageHandlerService } from "../../services/encrypted-message-handler.service";
|
import { EncryptedMessageHandlerService } from "../../services/encrypted-message-handler.service";
|
||||||
|
import { I18nService } from "../../services/i18n.service";
|
||||||
import { NativeMessageHandlerService } from "../../services/native-message-handler.service";
|
import { NativeMessageHandlerService } from "../../services/native-message-handler.service";
|
||||||
import { NativeMessagingService } from "../../services/native-messaging.service";
|
import { NativeMessagingService } from "../../services/native-messaging.service";
|
||||||
import { PasswordRepromptService } from "../../services/password-reprompt.service";
|
import { PasswordRepromptService } from "../../services/password-reprompt.service";
|
||||||
@@ -101,7 +101,7 @@ const RELOAD_CALLBACK = new InjectionToken<() => any>("RELOAD_CALLBACK");
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
provide: I18nServiceAbstraction,
|
provide: I18nServiceAbstraction,
|
||||||
useClass: DesktopI18nServiceImplementation,
|
useClass: I18nService,
|
||||||
deps: [SYSTEM_LANGUAGE, LOCALES_DIRECTORY],
|
deps: [SYSTEM_LANGUAGE, LOCALES_DIRECTORY],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ import { TrayMain } from "./main/tray.main";
|
|||||||
import { UpdaterMain } from "./main/updater.main";
|
import { UpdaterMain } from "./main/updater.main";
|
||||||
import { WindowMain } from "./main/window.main";
|
import { WindowMain } from "./main/window.main";
|
||||||
import { Account } from "./models/account";
|
import { Account } from "./models/account";
|
||||||
import { DesktopI18nServiceImplementation } from "./services/desktop-i18n.service.implementation";
|
|
||||||
import { ElectronLogService } from "./services/electron-log.service";
|
import { ElectronLogService } from "./services/electron-log.service";
|
||||||
import { ElectronMainMessagingService } from "./services/electron-main-messaging.service";
|
import { ElectronMainMessagingService } from "./services/electron-main-messaging.service";
|
||||||
import { ElectronStorageService } from "./services/electron-storage.service";
|
import { ElectronStorageService } from "./services/electron-storage.service";
|
||||||
|
import { I18nService } from "./services/i18n.service";
|
||||||
|
|
||||||
export class Main {
|
export class Main {
|
||||||
logService: ElectronLogService;
|
logService: ElectronLogService;
|
||||||
i18nService: DesktopI18nServiceImplementation;
|
i18nService: I18nService;
|
||||||
storageService: ElectronStorageService;
|
storageService: ElectronStorageService;
|
||||||
memoryStorageService: MemoryStorageService;
|
memoryStorageService: MemoryStorageService;
|
||||||
messagingService: ElectronMainMessagingService;
|
messagingService: ElectronMainMessagingService;
|
||||||
@@ -73,7 +73,7 @@ export class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.logService = new ElectronLogService(null, app.getPath("userData"));
|
this.logService = new ElectronLogService(null, app.getPath("userData"));
|
||||||
this.i18nService = new DesktopI18nServiceImplementation("en", "./locales/");
|
this.i18nService = new I18nService("en", "./locales/");
|
||||||
|
|
||||||
const storageDefaults: any = {};
|
const storageDefaults: any = {};
|
||||||
// Default vault timeout to "on restart", and action to "lock"
|
// Default vault timeout to "on restart", and action to "lock"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
||||||
import { I18nServiceImplementation } from "@bitwarden/common/services/i18n.service.implementation";
|
import { I18nService as BaseI18nService } from "@bitwarden/common/services/i18n.service";
|
||||||
|
|
||||||
export class DesktopI18nServiceImplementation extends I18nServiceImplementation {
|
export class I18nService extends BaseI18nService {
|
||||||
constructor(systemLanguage: string, localesDirectory: string) {
|
constructor(systemLanguage: string, localesDirectory: string) {
|
||||||
super(systemLanguage, localesDirectory, (formattedLocale: string) => {
|
super(systemLanguage, localesDirectory, (formattedLocale: string) => {
|
||||||
const filePath = path.join(
|
const filePath = path.join(
|
||||||
@@ -2,15 +2,13 @@ import { Component, EventEmitter, Input, Output } from "@angular/core";
|
|||||||
|
|
||||||
import { Utils } from "@bitwarden/common/misc/utils";
|
import { Utils } from "@bitwarden/common/misc/utils";
|
||||||
|
|
||||||
import { WebI18nKey } from "../core/web-i18n.service.implementation";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-nested-checkbox",
|
selector: "app-nested-checkbox",
|
||||||
templateUrl: "nested-checkbox.component.html",
|
templateUrl: "nested-checkbox.component.html",
|
||||||
})
|
})
|
||||||
export class NestedCheckboxComponent {
|
export class NestedCheckboxComponent {
|
||||||
@Input() parentId: WebI18nKey;
|
@Input() parentId: string;
|
||||||
@Input() checkboxes: { id: WebI18nKey; get: () => boolean; set: (v: boolean) => void }[];
|
@Input() checkboxes: { id: string; get: () => boolean; set: (v: boolean) => void }[];
|
||||||
@Output() onSavedUser = new EventEmitter();
|
@Output() onSavedUser = new EventEmitter();
|
||||||
@Output() onDeletedUser = new EventEmitter();
|
@Output() onDeletedUser = new EventEmitter();
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
import { JslibServicesModule } from "@bitwarden/angular/services/jslib-services.module";
|
import { JslibServicesModule } from "@bitwarden/angular/services/jslib-services.module";
|
||||||
import { ModalService as ModalServiceAbstraction } from "@bitwarden/angular/services/modal.service";
|
import { ModalService as ModalServiceAbstraction } from "@bitwarden/angular/services/modal.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 as I18nServiceAbstraction } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LoginService as LoginServiceAbstraction } from "@bitwarden/common/abstractions/login.service";
|
import { LoginService as LoginServiceAbstraction } from "@bitwarden/common/abstractions/login.service";
|
||||||
import { MessagingService as MessagingServiceAbstraction } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService as MessagingServiceAbstraction } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
||||||
@@ -27,6 +27,7 @@ import { MemoryStorageService } from "@bitwarden/common/services/memoryStorage.s
|
|||||||
import { BroadcasterMessagingService } from "./broadcaster-messaging.service";
|
import { BroadcasterMessagingService } from "./broadcaster-messaging.service";
|
||||||
import { EventService } from "./event.service";
|
import { EventService } from "./event.service";
|
||||||
import { HtmlStorageService } from "./html-storage.service";
|
import { HtmlStorageService } from "./html-storage.service";
|
||||||
|
import { I18nService } from "./i18n.service";
|
||||||
import { InitService } from "./init.service";
|
import { InitService } from "./init.service";
|
||||||
import { ModalService } from "./modal.service";
|
import { ModalService } from "./modal.service";
|
||||||
import { PasswordRepromptService } from "./password-reprompt.service";
|
import { PasswordRepromptService } from "./password-reprompt.service";
|
||||||
@@ -35,7 +36,6 @@ import { RouterService } from "./router.service";
|
|||||||
import { Account, GlobalState, StateService } from "./state";
|
import { Account, GlobalState, StateService } from "./state";
|
||||||
import { StateMigrationService } from "./state-migration.service";
|
import { StateMigrationService } from "./state-migration.service";
|
||||||
import { WebFileDownloadService } from "./web-file-download.service";
|
import { WebFileDownloadService } from "./web-file-download.service";
|
||||||
import { WebI18nServiceImplementation } from "./web-i18n.service.implementation";
|
|
||||||
import { WebPlatformUtilsService } from "./web-platform-utils.service";
|
import { WebPlatformUtilsService } from "./web-platform-utils.service";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -46,7 +46,6 @@ import { WebPlatformUtilsService } from "./web-platform-utils.service";
|
|||||||
RouterService,
|
RouterService,
|
||||||
EventService,
|
EventService,
|
||||||
PolicyListService,
|
PolicyListService,
|
||||||
WebI18nServiceImplementation,
|
|
||||||
{
|
{
|
||||||
provide: APP_INITIALIZER,
|
provide: APP_INITIALIZER,
|
||||||
useFactory: (initService: InitService) => initService.init(),
|
useFactory: (initService: InitService) => initService.init(),
|
||||||
@@ -62,8 +61,8 @@ import { WebPlatformUtilsService } from "./web-platform-utils.service";
|
|||||||
useValue: false,
|
useValue: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
provide: I18nService,
|
provide: I18nServiceAbstraction,
|
||||||
useClass: WebI18nServiceImplementation,
|
useClass: I18nService,
|
||||||
deps: [SYSTEM_LANGUAGE, LOCALES_DIRECTORY],
|
deps: [SYSTEM_LANGUAGE, LOCALES_DIRECTORY],
|
||||||
},
|
},
|
||||||
{ provide: AbstractStorageService, useClass: HtmlStorageService },
|
{ provide: AbstractStorageService, useClass: HtmlStorageService },
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
import { Injectable } from "@angular/core";
|
import { I18nService as BaseI18nService } from "@bitwarden/common/services/i18n.service";
|
||||||
|
|
||||||
import { I18nServiceImplementation } from "@bitwarden/common/services/i18n.service.implementation";
|
export class I18nService extends BaseI18nService {
|
||||||
|
|
||||||
import type eng from "../../locales/en/messages.json";
|
|
||||||
|
|
||||||
export type WebI18nKey = keyof typeof eng;
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class WebI18nServiceImplementation extends I18nServiceImplementation<WebI18nKey> {
|
|
||||||
constructor(systemLanguage: string, localesDirectory: string) {
|
constructor(systemLanguage: string, localesDirectory: string) {
|
||||||
super(systemLanguage || "en-US", localesDirectory, async (formattedLocale: string) => {
|
super(systemLanguage || "en-US", localesDirectory, async (formattedLocale: string) => {
|
||||||
const filePath =
|
const filePath =
|
||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
Urls,
|
Urls,
|
||||||
} from "@bitwarden/common/abstractions/environment.service";
|
} from "@bitwarden/common/abstractions/environment.service";
|
||||||
import { EventUploadService as EventUploadServiceAbstraction } from "@bitwarden/common/abstractions/event/event-upload.service";
|
import { EventUploadService as EventUploadServiceAbstraction } from "@bitwarden/common/abstractions/event/event-upload.service";
|
||||||
import { I18nService } 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";
|
||||||
@@ -18,7 +18,7 @@ import { ContainerService } from "@bitwarden/common/services/container.service";
|
|||||||
import { EventUploadService } from "@bitwarden/common/services/event/event-upload.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 { WebI18nServiceImplementation } from "./web-i18n.service.implementation";
|
import { I18nService } from "./i18n.service";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class InitService {
|
export class InitService {
|
||||||
@@ -27,7 +27,7 @@ export class InitService {
|
|||||||
private environmentService: EnvironmentServiceAbstraction,
|
private environmentService: EnvironmentServiceAbstraction,
|
||||||
private notificationsService: NotificationsServiceAbstraction,
|
private notificationsService: NotificationsServiceAbstraction,
|
||||||
private vaultTimeoutService: VaultTimeoutServiceAbstraction,
|
private vaultTimeoutService: VaultTimeoutServiceAbstraction,
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nServiceAbstraction,
|
||||||
private eventUploadService: EventUploadServiceAbstraction,
|
private eventUploadService: EventUploadServiceAbstraction,
|
||||||
private twoFactorService: TwoFactorServiceAbstraction,
|
private twoFactorService: TwoFactorServiceAbstraction,
|
||||||
private stateService: StateServiceAbstraction,
|
private stateService: StateServiceAbstraction,
|
||||||
@@ -47,7 +47,7 @@ export class InitService {
|
|||||||
setTimeout(() => this.notificationsService.init(), 3000);
|
setTimeout(() => this.notificationsService.init(), 3000);
|
||||||
(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 WebI18nServiceImplementation).init(locale);
|
await (this.i18nService as I18nService).init(locale);
|
||||||
(this.eventUploadService as EventUploadService).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;
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
import { Pipe } from "@angular/core";
|
|
||||||
|
|
||||||
import { I18nPipe } from "@bitwarden/angular/pipes/i18n.pipe";
|
|
||||||
|
|
||||||
import { WebI18nKey } from "./web-i18n.service.implementation";
|
|
||||||
|
|
||||||
@Pipe({
|
|
||||||
name: "i18n",
|
|
||||||
})
|
|
||||||
export class WebI18nPipe extends I18nPipe<WebI18nKey> {}
|
|
||||||
@@ -15,7 +15,7 @@ export class AdjustSubscription {
|
|||||||
@Input() maxAutoscaleSeats: number;
|
@Input() maxAutoscaleSeats: number;
|
||||||
@Input() currentSeatCount: number;
|
@Input() currentSeatCount: number;
|
||||||
@Input() seatPrice = 0;
|
@Input() seatPrice = 0;
|
||||||
@Input() interval: "month" | "year" = "year";
|
@Input() interval = "year";
|
||||||
@Output() onAdjusted = new EventEmitter();
|
@Output() onAdjusted = new EventEmitter();
|
||||||
|
|
||||||
formPromise: Promise<void>;
|
formPromise: Promise<void>;
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import { FormSelectionList } from "@bitwarden/angular/utils/form-selection-list"
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { SelectItemView } from "@bitwarden/components/src/multi-select/models/select-item-view";
|
import { SelectItemView } from "@bitwarden/components/src/multi-select/models/select-item-view";
|
||||||
|
|
||||||
import { WebI18nKey } from "../../../core/web-i18n.service.implementation";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AccessItemType,
|
AccessItemType,
|
||||||
AccessItemValue,
|
AccessItemValue,
|
||||||
@@ -85,7 +83,7 @@ export class AccessSelectorComponent implements ControlValueAccessor, OnInit, On
|
|||||||
});
|
});
|
||||||
|
|
||||||
protected itemType = AccessItemType;
|
protected itemType = AccessItemType;
|
||||||
protected permissionList: { perm: CollectionPermission; labelId: WebI18nKey }[] = [
|
protected permissionList = [
|
||||||
{ perm: CollectionPermission.View, labelId: "canView" },
|
{ perm: CollectionPermission.View, labelId: "canView" },
|
||||||
{ perm: CollectionPermission.ViewExceptPass, labelId: "canViewExceptPass" },
|
{ perm: CollectionPermission.ViewExceptPass, labelId: "canViewExceptPass" },
|
||||||
{ perm: CollectionPermission.Edit, labelId: "canEdit" },
|
{ perm: CollectionPermission.Edit, labelId: "canEdit" },
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ import {
|
|||||||
} from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
} from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
||||||
import { Organization } from "@bitwarden/common/models/domain/organization";
|
import { Organization } from "@bitwarden/common/models/domain/organization";
|
||||||
|
|
||||||
import { WebI18nKey } from "../../core/web-i18n.service.implementation";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-organization-layout",
|
selector: "app-organization-layout",
|
||||||
templateUrl: "organization-layout.component.html",
|
templateUrl: "organization-layout.component.html",
|
||||||
@@ -71,7 +69,7 @@ export class OrganizationLayoutComponent implements OnInit, OnDestroy {
|
|||||||
return canAccessBillingTab(organization);
|
return canAccessBillingTab(organization);
|
||||||
}
|
}
|
||||||
|
|
||||||
getReportTabLabel(organization: Organization): WebI18nKey {
|
getReportTabLabel(organization: Organization): string {
|
||||||
return organization.useEvents ? "reporting" : "reports";
|
return organization.useEvents ? "reporting" : "reports";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,6 @@ import { SelectionReadOnlyRequest } from "@bitwarden/common/models/request/selec
|
|||||||
import { CollectionDetailsResponse } from "@bitwarden/common/models/response/collection.response";
|
import { CollectionDetailsResponse } from "@bitwarden/common/models/response/collection.response";
|
||||||
import { CollectionView } from "@bitwarden/common/models/view/collection.view";
|
import { CollectionView } from "@bitwarden/common/models/view/collection.view";
|
||||||
|
|
||||||
import { WebI18nKey } from "../../core/web-i18n.service.implementation";
|
|
||||||
|
|
||||||
type NestedCheckbox = { id: WebI18nKey; get: () => boolean; set: (v: boolean) => boolean };
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-user-add-edit",
|
selector: "app-user-add-edit",
|
||||||
templateUrl: "user-add-edit.component.html",
|
templateUrl: "user-add-edit.component.html",
|
||||||
@@ -53,7 +49,7 @@ export class UserAddEditComponent implements OnInit {
|
|||||||
organizationUserType = OrganizationUserType;
|
organizationUserType = OrganizationUserType;
|
||||||
canUseCustomPermissions: boolean;
|
canUseCustomPermissions: boolean;
|
||||||
|
|
||||||
manageAllCollectionsCheckboxes: NestedCheckbox[] = [
|
manageAllCollectionsCheckboxes = [
|
||||||
{
|
{
|
||||||
id: "createNewCollections",
|
id: "createNewCollections",
|
||||||
get: () => this.permissions.createNewCollections,
|
get: () => this.permissions.createNewCollections,
|
||||||
@@ -71,7 +67,7 @@ export class UserAddEditComponent implements OnInit {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
manageAssignedCollectionsCheckboxes: NestedCheckbox[] = [
|
manageAssignedCollectionsCheckboxes = [
|
||||||
{
|
{
|
||||||
id: "editAssignedCollections",
|
id: "editAssignedCollections",
|
||||||
get: () => this.permissions.editAssignedCollections,
|
get: () => this.permissions.editAssignedCollections,
|
||||||
|
|||||||
@@ -6,11 +6,9 @@ import { Organization } from "@bitwarden/common/models/domain/organization";
|
|||||||
import { PolicyRequest } from "@bitwarden/common/models/request/policy.request";
|
import { PolicyRequest } from "@bitwarden/common/models/request/policy.request";
|
||||||
import { PolicyResponse } from "@bitwarden/common/models/response/policy.response";
|
import { PolicyResponse } from "@bitwarden/common/models/response/policy.response";
|
||||||
|
|
||||||
import { WebI18nKey } from "../../core/web-i18n.service.implementation";
|
|
||||||
|
|
||||||
export abstract class BasePolicy {
|
export abstract class BasePolicy {
|
||||||
abstract name: WebI18nKey;
|
abstract name: string;
|
||||||
abstract description: WebI18nKey;
|
abstract description: string;
|
||||||
abstract type: PolicyType;
|
abstract type: PolicyType;
|
||||||
abstract component: any;
|
abstract component: any;
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import { PolicyType } from "@bitwarden/common/enums/policyType";
|
|||||||
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
||||||
|
|
||||||
export class DisableSendPolicy extends BasePolicy {
|
export class DisableSendPolicy extends BasePolicy {
|
||||||
readonly name = "disableSend";
|
name = "disableSend";
|
||||||
readonly description = "disableSendPolicyDesc";
|
description = "disableSendPolicyDesc";
|
||||||
type = PolicyType.DisableSend;
|
type = PolicyType.DisableSend;
|
||||||
component = DisableSendPolicyComponent;
|
component = DisableSendPolicyComponent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import { PolicyType } from "@bitwarden/common/enums/policyType";
|
|||||||
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
||||||
|
|
||||||
export class MasterPasswordPolicy extends BasePolicy {
|
export class MasterPasswordPolicy extends BasePolicy {
|
||||||
readonly name = "masterPassPolicyTitle";
|
name = "masterPassPolicyTitle";
|
||||||
readonly description = "masterPassPolicyDesc";
|
description = "masterPassPolicyDesc";
|
||||||
type = PolicyType.MasterPassword;
|
type = PolicyType.MasterPassword;
|
||||||
component = MasterPasswordPolicyComponent;
|
component = MasterPasswordPolicyComponent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import { PolicyType } from "@bitwarden/common/enums/policyType";
|
|||||||
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
||||||
|
|
||||||
export class PasswordGeneratorPolicy extends BasePolicy {
|
export class PasswordGeneratorPolicy extends BasePolicy {
|
||||||
readonly name = "passwordGenerator";
|
name = "passwordGenerator";
|
||||||
readonly description = "passwordGeneratorPolicyDesc";
|
description = "passwordGeneratorPolicyDesc";
|
||||||
type = PolicyType.PasswordGenerator;
|
type = PolicyType.PasswordGenerator;
|
||||||
component = PasswordGeneratorPolicyComponent;
|
component = PasswordGeneratorPolicyComponent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import { PolicyType } from "@bitwarden/common/enums/policyType";
|
|||||||
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
||||||
|
|
||||||
export class PersonalOwnershipPolicy extends BasePolicy {
|
export class PersonalOwnershipPolicy extends BasePolicy {
|
||||||
readonly name = "personalOwnership";
|
name = "personalOwnership";
|
||||||
readonly description = "personalOwnershipPolicyDesc";
|
description = "personalOwnershipPolicyDesc";
|
||||||
type = PolicyType.PersonalOwnership;
|
type = PolicyType.PersonalOwnership;
|
||||||
component = PersonalOwnershipPolicyComponent;
|
component = PersonalOwnershipPolicyComponent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import { PolicyRequest } from "@bitwarden/common/models/request/policy.request";
|
|||||||
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
||||||
|
|
||||||
export class RequireSsoPolicy extends BasePolicy {
|
export class RequireSsoPolicy extends BasePolicy {
|
||||||
readonly name = "requireSso";
|
name = "requireSso";
|
||||||
readonly description = "requireSsoPolicyDesc";
|
description = "requireSsoPolicyDesc";
|
||||||
type = PolicyType.RequireSso;
|
type = PolicyType.RequireSso;
|
||||||
component = RequireSsoPolicyComponent;
|
component = RequireSsoPolicyComponent;
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import { Organization } from "@bitwarden/common/models/domain/organization";
|
|||||||
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
||||||
|
|
||||||
export class ResetPasswordPolicy extends BasePolicy {
|
export class ResetPasswordPolicy extends BasePolicy {
|
||||||
readonly name = "resetPasswordPolicy";
|
name = "resetPasswordPolicy";
|
||||||
readonly description = "resetPasswordPolicyDescription";
|
description = "resetPasswordPolicyDescription";
|
||||||
type = PolicyType.ResetPassword;
|
type = PolicyType.ResetPassword;
|
||||||
component = ResetPasswordPolicyComponent;
|
component = ResetPasswordPolicyComponent;
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import { PolicyType } from "@bitwarden/common/enums/policyType";
|
|||||||
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
||||||
|
|
||||||
export class SendOptionsPolicy extends BasePolicy {
|
export class SendOptionsPolicy extends BasePolicy {
|
||||||
readonly name = "sendOptions";
|
name = "sendOptions";
|
||||||
readonly description = "sendOptionsPolicyDesc";
|
description = "sendOptionsPolicyDesc";
|
||||||
type = PolicyType.SendOptions;
|
type = PolicyType.SendOptions;
|
||||||
component = SendOptionsPolicyComponent;
|
component = SendOptionsPolicyComponent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import { PolicyRequest } from "@bitwarden/common/models/request/policy.request";
|
|||||||
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
||||||
|
|
||||||
export class SingleOrgPolicy extends BasePolicy {
|
export class SingleOrgPolicy extends BasePolicy {
|
||||||
readonly name = "singleOrg";
|
name = "singleOrg";
|
||||||
readonly description = "singleOrgDesc";
|
description = "singleOrgDesc";
|
||||||
type = PolicyType.SingleOrg;
|
type = PolicyType.SingleOrg;
|
||||||
component = SingleOrgPolicyComponent;
|
component = SingleOrgPolicyComponent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import { PolicyType } from "@bitwarden/common/enums/policyType";
|
|||||||
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
||||||
|
|
||||||
export class TwoFactorAuthenticationPolicy extends BasePolicy {
|
export class TwoFactorAuthenticationPolicy extends BasePolicy {
|
||||||
readonly name = "twoStepLoginPolicyTitle";
|
name = "twoStepLoginPolicyTitle";
|
||||||
readonly description = "twoStepLoginPolicyDesc";
|
description = "twoStepLoginPolicyDesc";
|
||||||
type = PolicyType.TwoFactorAuthentication;
|
type = PolicyType.TwoFactorAuthentication;
|
||||||
component = TwoFactorAuthenticationPolicyComponent;
|
component = TwoFactorAuthenticationPolicyComponent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,17 +12,15 @@ import { Utils } from "@bitwarden/common/misc/utils";
|
|||||||
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
||||||
import { Verification } from "@bitwarden/common/types/verification";
|
import { Verification } from "@bitwarden/common/types/verification";
|
||||||
|
|
||||||
import { WebI18nKey } from "../../core/web-i18n.service.implementation";
|
|
||||||
|
|
||||||
class CountBasedLocalizationKey {
|
class CountBasedLocalizationKey {
|
||||||
singular: WebI18nKey;
|
singular: string;
|
||||||
plural: WebI18nKey;
|
plural: string;
|
||||||
|
|
||||||
getKey(count: number) {
|
getKey(count: number) {
|
||||||
return count == 1 ? this.singular : this.plural;
|
return count == 1 ? this.singular : this.plural;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(singular: WebI18nKey, plural: WebI18nKey) {
|
constructor(singular: string, plural: string) {
|
||||||
this.singular = singular;
|
this.singular = singular;
|
||||||
this.plural = plural;
|
this.plural = plural;
|
||||||
}
|
}
|
||||||
@@ -30,7 +28,7 @@ class CountBasedLocalizationKey {
|
|||||||
|
|
||||||
class OrganizationContentSummaryItem {
|
class OrganizationContentSummaryItem {
|
||||||
count: number;
|
count: number;
|
||||||
get localizationKey() {
|
get localizationKey(): string {
|
||||||
return this.localizationKeyOptions.getKey(this.count);
|
return this.localizationKeyOptions.getKey(this.count);
|
||||||
}
|
}
|
||||||
private localizationKeyOptions: CountBasedLocalizationKey;
|
private localizationKeyOptions: CountBasedLocalizationKey;
|
||||||
@@ -128,9 +126,6 @@ export class DeleteOrganizationComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getOrganizationItemLocalizationKeysByType(type: string): CountBasedLocalizationKey {
|
private getOrganizationItemLocalizationKeysByType(type: string): CountBasedLocalizationKey {
|
||||||
return new CountBasedLocalizationKey(
|
return new CountBasedLocalizationKey(`type${type}`, `type${type}Plural`);
|
||||||
`type${type}` as WebI18nKey,
|
|
||||||
`type${type}Plural` as WebI18nKey
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import { CipherType } from "@bitwarden/common/enums/cipherType";
|
|||||||
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
||||||
import { BadgeTypes } from "@bitwarden/components";
|
import { BadgeTypes } from "@bitwarden/components";
|
||||||
|
|
||||||
import { WebI18nKey } from "../../core/web-i18n.service.implementation";
|
|
||||||
|
|
||||||
import { CipherReportComponent } from "./cipher-report.component";
|
import { CipherReportComponent } from "./cipher-report.component";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -19,7 +17,7 @@ import { CipherReportComponent } from "./cipher-report.component";
|
|||||||
templateUrl: "weak-passwords-report.component.html",
|
templateUrl: "weak-passwords-report.component.html",
|
||||||
})
|
})
|
||||||
export class WeakPasswordsReportComponent extends CipherReportComponent implements OnInit {
|
export class WeakPasswordsReportComponent extends CipherReportComponent implements OnInit {
|
||||||
passwordStrengthMap = new Map<string, [WebI18nKey, BadgeTypes]>();
|
passwordStrengthMap = new Map<string, [string, BadgeTypes]>();
|
||||||
|
|
||||||
private passwordStrengthCache = new Map<string, number>();
|
private passwordStrengthCache = new Map<string, number>();
|
||||||
|
|
||||||
@@ -113,7 +111,7 @@ export class WeakPasswordsReportComponent extends CipherReportComponent implemen
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private scoreKey(score: number): [WebI18nKey, BadgeTypes] {
|
private scoreKey(score: number): [string, BadgeTypes] {
|
||||||
switch (score) {
|
switch (score) {
|
||||||
case 4:
|
case 4:
|
||||||
return ["strong", "success"];
|
return ["strong", "success"];
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
import { Icon } from "@bitwarden/components";
|
import { Icon } from "@bitwarden/components";
|
||||||
|
|
||||||
import { WebI18nKey } from "../../../core/web-i18n.service.implementation";
|
|
||||||
|
|
||||||
import { ReportVariant } from "./report-variant";
|
import { ReportVariant } from "./report-variant";
|
||||||
|
|
||||||
export type ReportEntry = {
|
export type ReportEntry = {
|
||||||
title: WebI18nKey;
|
title: string;
|
||||||
description: WebI18nKey;
|
description: string;
|
||||||
route: string;
|
route: string;
|
||||||
icon: Icon;
|
icon: Icon;
|
||||||
variant: ReportVariant;
|
variant: ReportVariant;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export class AdjustStorageComponent {
|
|||||||
@Input() storageGbPrice = 0;
|
@Input() storageGbPrice = 0;
|
||||||
@Input() add = true;
|
@Input() add = true;
|
||||||
@Input() organizationId: string;
|
@Input() organizationId: string;
|
||||||
@Input() interval: "month" | "year" = "year";
|
@Input() interval = "year";
|
||||||
@Output() onAdjusted = new EventEmitter<number>();
|
@Output() onAdjusted = new EventEmitter<number>();
|
||||||
@Output() onCanceled = new EventEmitter();
|
@Output() onCanceled = new EventEmitter();
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import { SecretVerificationRequest } from "@bitwarden/common/models/request/secr
|
|||||||
import { ApiKeyResponse } from "@bitwarden/common/models/response/api-key.response";
|
import { ApiKeyResponse } from "@bitwarden/common/models/response/api-key.response";
|
||||||
import { Verification } from "@bitwarden/common/types/verification";
|
import { Verification } from "@bitwarden/common/types/verification";
|
||||||
|
|
||||||
import { WebI18nKey } from "../core/web-i18n.service.implementation";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-api-key",
|
selector: "app-api-key",
|
||||||
templateUrl: "api-key.component.html",
|
templateUrl: "api-key.component.html",
|
||||||
@@ -19,9 +17,9 @@ export class ApiKeyComponent {
|
|||||||
entityId: string;
|
entityId: string;
|
||||||
scope: string;
|
scope: string;
|
||||||
grantType: string;
|
grantType: string;
|
||||||
apiKeyTitle: WebI18nKey;
|
apiKeyTitle: string;
|
||||||
apiKeyWarning: WebI18nKey;
|
apiKeyWarning: string;
|
||||||
apiKeyDescription: WebI18nKey;
|
apiKeyDescription: string;
|
||||||
|
|
||||||
masterPassword: Verification;
|
masterPassword: Verification;
|
||||||
formPromise: Promise<ApiKeyResponse>;
|
formPromise: Promise<ApiKeyResponse>;
|
||||||
|
|||||||
@@ -53,7 +53,10 @@
|
|||||||
></i>
|
></i>
|
||||||
{{ t.details }}
|
{{ t.details }}
|
||||||
</td>
|
</td>
|
||||||
<td [ngClass]="{ 'text-strike': t.refunded }" [title]="t.refunded ? ('refunded' | i18n) : ''">
|
<td
|
||||||
|
[ngClass]="{ 'text-strike': t.refunded }"
|
||||||
|
title="{{ (t.refunded ? 'refunded' : '') | i18n }}"
|
||||||
|
>
|
||||||
{{ t.amount | currency: "$" }}
|
{{ t.amount | currency: "$" }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import {
|
|||||||
|
|
||||||
// Register the locales for the application
|
// Register the locales for the application
|
||||||
import "./locales";
|
import "./locales";
|
||||||
import { WebI18nPipe } from "../core/web-i18n.pipe";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This NgModule should contain the most basic shared directives, pipes, and components. They
|
* This NgModule should contain the most basic shared directives, pipes, and components. They
|
||||||
@@ -67,7 +66,6 @@ import { WebI18nPipe } from "../core/web-i18n.pipe";
|
|||||||
|
|
||||||
// Web specific
|
// Web specific
|
||||||
],
|
],
|
||||||
declarations: [WebI18nPipe],
|
|
||||||
exports: [
|
exports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
DragDropModule,
|
DragDropModule,
|
||||||
@@ -97,7 +95,6 @@ import { WebI18nPipe } from "../core/web-i18n.pipe";
|
|||||||
ColorPasswordModule,
|
ColorPasswordModule,
|
||||||
|
|
||||||
// Web specific
|
// Web specific
|
||||||
WebI18nPipe,
|
|
||||||
],
|
],
|
||||||
providers: [DatePipe],
|
providers: [DatePipe],
|
||||||
bootstrap: [],
|
bootstrap: [],
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { APP_INITIALIZER, NgModule } from "@angular/core";
|
import { APP_INITIALIZER, NgModule } from "@angular/core";
|
||||||
|
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { I18nServiceImplementation } from "@bitwarden/common/services/i18n.service.implementation";
|
import { I18nService as BaseI18nService } from "@bitwarden/common/services/i18n.service";
|
||||||
|
|
||||||
import eng from "../../locales/en/messages.json";
|
import eng from "../../locales/en/messages.json";
|
||||||
|
|
||||||
class PreloadedEnglishI18nService extends I18nServiceImplementation {
|
class PreloadedEnglishI18nService extends BaseI18nService {
|
||||||
constructor() {
|
constructor() {
|
||||||
super("en", "", () => {
|
super("en", "", () => {
|
||||||
return Promise.resolve(eng);
|
return Promise.resolve(eng);
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
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 { WebI18nKey } from "../../core/web-i18n.service.implementation";
|
|
||||||
|
|
||||||
export class VaultService {
|
export class VaultService {
|
||||||
calculateSearchBarLocalizationString(vaultFilter: VaultFilter): WebI18nKey {
|
calculateSearchBarLocalizationString(vaultFilter: VaultFilter): string {
|
||||||
if (vaultFilter.status === "favorites") {
|
if (vaultFilter.status === "favorites") {
|
||||||
return "searchFavorites";
|
return "searchFavorites";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import { Component, EventEmitter, Output } from "@angular/core";
|
|||||||
|
|
||||||
import { VaultFilterComponent as BaseVaultFilterComponent } from "@bitwarden/angular/vault/vault-filter/components/vault-filter.component";
|
import { VaultFilterComponent as BaseVaultFilterComponent } from "@bitwarden/angular/vault/vault-filter/components/vault-filter.component";
|
||||||
|
|
||||||
import { WebI18nKey } from "../../core/web-i18n.service.implementation";
|
|
||||||
|
|
||||||
import { VaultFilterService } from "./shared/vault-filter.service";
|
import { VaultFilterService } from "./shared/vault-filter.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -14,7 +12,7 @@ import { VaultFilterService } from "./shared/vault-filter.service";
|
|||||||
export class VaultFilterComponent extends BaseVaultFilterComponent {
|
export class VaultFilterComponent extends BaseVaultFilterComponent {
|
||||||
@Output() onSearchTextChanged = new EventEmitter<string>();
|
@Output() onSearchTextChanged = new EventEmitter<string>();
|
||||||
|
|
||||||
searchPlaceholder: WebI18nKey;
|
searchPlaceholder: string;
|
||||||
searchText = "";
|
searchText = "";
|
||||||
|
|
||||||
constructor(protected vaultFilterService: VaultFilterService) {
|
constructor(protected vaultFilterService: VaultFilterService) {
|
||||||
|
|||||||
@@ -5789,18 +5789,6 @@
|
|||||||
"switchProducts": {
|
"switchProducts": {
|
||||||
"message": "Switch Products"
|
"message": "Switch Products"
|
||||||
},
|
},
|
||||||
"searchMyVault": {
|
|
||||||
"message": "Search My Vault"
|
|
||||||
},
|
|
||||||
"searchOrganization": {
|
|
||||||
"message": "Search organization"
|
|
||||||
},
|
|
||||||
"noClientsInList": {
|
|
||||||
"message": "No clients in list"
|
|
||||||
},
|
|
||||||
"copy": {
|
|
||||||
"messages": "Copy"
|
|
||||||
},
|
|
||||||
"freeOrgInvLimitReachedManageBilling": {
|
"freeOrgInvLimitReachedManageBilling": {
|
||||||
"message": "Free organizations may have up to $SEATCOUNT$ members. Upgrade to a paid plan to invite more members.",
|
"message": "Free organizations may have up to $SEATCOUNT$ members. Upgrade to a paid plan to invite more members.",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import {
|
|||||||
} from "@bitwarden/web-vault/app/organizations/policies/base-policy.component";
|
} from "@bitwarden/web-vault/app/organizations/policies/base-policy.component";
|
||||||
|
|
||||||
export class DisablePersonalVaultExportPolicy extends BasePolicy {
|
export class DisablePersonalVaultExportPolicy extends BasePolicy {
|
||||||
readonly name = "disablePersonalVaultExport";
|
name = "disablePersonalVaultExport";
|
||||||
readonly description = "disablePersonalVaultExportDesc";
|
description = "disablePersonalVaultExportDesc";
|
||||||
type = PolicyType.DisablePersonalVaultExport;
|
type = PolicyType.DisablePersonalVaultExport;
|
||||||
component = DisablePersonalVaultExportPolicyComponent;
|
component = DisablePersonalVaultExportPolicyComponent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import {
|
|||||||
} from "@bitwarden/web-vault/app/organizations/policies/base-policy.component";
|
} from "@bitwarden/web-vault/app/organizations/policies/base-policy.component";
|
||||||
|
|
||||||
export class MaximumVaultTimeoutPolicy extends BasePolicy {
|
export class MaximumVaultTimeoutPolicy extends BasePolicy {
|
||||||
readonly name = "maximumVaultTimeout";
|
name = "maximumVaultTimeout";
|
||||||
readonly description = "maximumVaultTimeoutDesc";
|
description = "maximumVaultTimeoutDesc";
|
||||||
type = PolicyType.MaximumVaultTimeout;
|
type = PolicyType.MaximumVaultTimeout;
|
||||||
component = MaximumVaultTimeoutPolicyComponent;
|
component = MaximumVaultTimeoutPolicyComponent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
import { DialogRef, DIALOG_DATA } from "@angular/cdk/dialog";
|
import { DialogRef, DIALOG_DATA } from "@angular/cdk/dialog";
|
||||||
import { Component, Inject, OnInit } from "@angular/core";
|
import { Component, Inject, OnInit } from "@angular/core";
|
||||||
|
|
||||||
import { WebI18nKey } from "@bitwarden/web-vault/app/core/web-i18n.service.implementation";
|
|
||||||
|
|
||||||
export interface BulkStatusDetails {
|
export interface BulkStatusDetails {
|
||||||
title: WebI18nKey;
|
title: string;
|
||||||
subTitle: WebI18nKey;
|
subTitle: string;
|
||||||
columnTitle: WebI18nKey;
|
columnTitle: string;
|
||||||
message: WebI18nKey;
|
message: string;
|
||||||
details: BulkOperationStatus[];
|
details: BulkOperationStatus[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { combineLatest, map, Observable } from "rxjs";
|
|||||||
|
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { AccountProfile } from "@bitwarden/common/models/domain/account";
|
import { AccountProfile } from "@bitwarden/common/models/domain/account";
|
||||||
import { WebI18nKey } from "@bitwarden/web-vault/app/core/web-i18n.service.implementation";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "sm-header",
|
selector: "sm-header",
|
||||||
@@ -14,7 +13,7 @@ export class HeaderComponent {
|
|||||||
@Input() title: string;
|
@Input() title: string;
|
||||||
@Input() searchTitle: string;
|
@Input() searchTitle: string;
|
||||||
|
|
||||||
protected routeData$: Observable<{ title: WebI18nKey; searchTitle: WebI18nKey }>;
|
protected routeData$: Observable<{ title: string; searchTitle: string }>;
|
||||||
protected account$: Observable<AccountProfile>;
|
protected account$: Observable<AccountProfile>;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private stateService: StateService) {
|
constructor(private route: ActivatedRoute, private stateService: StateService) {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { SelectionModel } from "@angular/cdk/collections";
|
import { SelectionModel } from "@angular/cdk/collections";
|
||||||
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
||||||
|
|
||||||
import { WebI18nKey } from "@bitwarden/web-vault/app/core/web-i18n.service.implementation";
|
|
||||||
|
|
||||||
import { AccessTokenView } from "../models/view/access-token.view";
|
import { AccessTokenView } from "../models/view/access-token.view";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -36,7 +34,7 @@ export class AccessListComponent {
|
|||||||
: this.selection.select(...this.tokens.map((s) => s.id));
|
: this.selection.select(...this.tokens.map((s) => s.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected permission(token: AccessTokenView): WebI18nKey {
|
protected permission(token: AccessTokenView) {
|
||||||
return "canRead";
|
return "canRead";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
@Pipe({
|
@Pipe({
|
||||||
name: "i18n",
|
name: "i18n",
|
||||||
})
|
})
|
||||||
export class I18nPipe<TKey = string> implements PipeTransform {
|
export class I18nPipe implements PipeTransform {
|
||||||
constructor(private i18nService: I18nService<TKey>) {}
|
constructor(private i18nService: I18nService) {}
|
||||||
|
|
||||||
transform(id: TKey, p1?: string | number, p2?: string | number, p3?: string | number): string {
|
transform(id: string, p1?: string | number, p2?: string | number, p3?: string | number): string {
|
||||||
return this.i18nService.t(id, p1, p2, p3);
|
return this.i18nService.t(id, p1, p2, p3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { ITreeNodeObject } from "@bitwarden/common/models/domain/tree-node";
|
import { ITreeNodeObject } from "@bitwarden/common/models/domain/tree-node";
|
||||||
|
|
||||||
export type TopLevelTreeNodeId = "vaults" | "types" | "collections" | "folders";
|
export type TopLevelTreeNodeId = "vaults" | "types" | "collections" | "folders";
|
||||||
export type TopLevelTreeNodeName = "allVaults" | "types" | "collections" | "folders";
|
|
||||||
export class TopLevelTreeNode implements ITreeNodeObject {
|
export class TopLevelTreeNode implements ITreeNodeObject {
|
||||||
id: TopLevelTreeNodeId;
|
id: TopLevelTreeNodeId;
|
||||||
name: TopLevelTreeNodeName; // localizationString
|
name: string; // localizationString
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
export abstract class I18nService<TKey = string> {
|
export abstract class I18nService {
|
||||||
locale$: Observable<string>;
|
locale$: Observable<string>;
|
||||||
supportedTranslationLocales: string[];
|
supportedTranslationLocales: string[];
|
||||||
translationLocale: string;
|
translationLocale: string;
|
||||||
collator: Intl.Collator;
|
collator: Intl.Collator;
|
||||||
localeNames: Map<string, string>;
|
localeNames: Map<string, string>;
|
||||||
t: (id: TKey, p1?: string | number, p2?: string | number, p3?: string | number) => string;
|
t: (id: string, p1?: string | number, p2?: string | number, p3?: string | number) => string;
|
||||||
translate: (id: TKey, p1?: string, p2?: string, p3?: string) => string;
|
translate: (id: string, p1?: string, p2?: string, p3?: string) => string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,8 @@ export class PlanResponse extends BaseResponse {
|
|||||||
product: ProductType;
|
product: ProductType;
|
||||||
name: string;
|
name: string;
|
||||||
isAnnual: boolean;
|
isAnnual: boolean;
|
||||||
nameLocalizationKey: "planNameFree" | "planNameFamilies" | "planNameTeams" | "planNameEnterprise";
|
nameLocalizationKey: string;
|
||||||
descriptionLocalizationKey:
|
descriptionLocalizationKey: string;
|
||||||
| "planDescFree"
|
|
||||||
| "planDescFamilies"
|
|
||||||
| "planDescTeams"
|
|
||||||
| "planDescEnterprise";
|
|
||||||
canBeUsedByBusiness: boolean;
|
canBeUsedByBusiness: boolean;
|
||||||
baseSeats: number;
|
baseSeats: number;
|
||||||
baseStorageGb: number;
|
baseStorageGb: number;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export class BillingSubscriptionItemResponse extends BaseResponse {
|
|||||||
name: string;
|
name: string;
|
||||||
amount: number;
|
amount: number;
|
||||||
quantity: number;
|
quantity: number;
|
||||||
interval: "month" | "year";
|
interval: string;
|
||||||
sponsoredSubscriptionItem: boolean;
|
sponsoredSubscriptionItem: boolean;
|
||||||
|
|
||||||
constructor(response: any) {
|
constructor(response: any) {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Observable, ReplaySubject } from "rxjs";
|
import { Observable, ReplaySubject } from "rxjs";
|
||||||
|
|
||||||
import { I18nService } from "../abstractions/i18n.service";
|
import { I18nService as I18nServiceAbstraction } from "../abstractions/i18n.service";
|
||||||
|
|
||||||
export class I18nServiceImplementation<TKey = string> implements I18nService<TKey> {
|
export class I18nService implements I18nServiceAbstraction {
|
||||||
private _locale = new ReplaySubject<string>(1);
|
private _locale = new ReplaySubject<string>(1);
|
||||||
locale$: Observable<string> = this._locale.asObservable();
|
locale$: Observable<string> = this._locale.asObservable();
|
||||||
// First locale is the default (English)
|
// First locale is the default (English)
|
||||||
@@ -118,11 +118,11 @@ export class I18nServiceImplementation<TKey = string> implements I18nService<TKe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t(id: TKey, p1?: string, p2?: string, p3?: string): string {
|
t(id: string, p1?: string, p2?: string, p3?: string): string {
|
||||||
return this.translate(id, p1, p2, p3);
|
return this.translate(id, p1, p2, p3);
|
||||||
}
|
}
|
||||||
|
|
||||||
translate(id: TKey, p1?: string | number, p2?: string | number, p3?: string | number): string {
|
translate(id: string, p1?: string | number, p2?: string | number, p3?: string | number): string {
|
||||||
let result: string;
|
let result: string;
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
if (this.localeMessages.hasOwnProperty(id) && this.localeMessages[id]) {
|
if (this.localeMessages.hasOwnProperty(id) && this.localeMessages[id]) {
|
||||||
Reference in New Issue
Block a user