From a4fcd62c997e486603352319099e3dbd16004067 Mon Sep 17 00:00:00 2001 From: Will Martin Date: Wed, 16 Aug 2023 08:26:56 -0400 Subject: [PATCH] [CL-106] use CL's DialogService in Desktop & Browser (#5875) * remove libs/angular dialog service; move simple dialog types to CL * update DialogServiceAbstraction imports to CL * update imports in libs/angular to use CL * colocate simple dialog types * move SimpleConfigurableDialog files under SimpleDialog * remove CL import alias from CL src * update imports * run prettier * convert SimpleDialog enums to types * replace DialogServiceAbstraction with DialogService * restrict libs/angular imports in CL * add deprecation note to ModalService * Delete BrowserDialogService * Remove ElectronDialogService * update browser and desktop services.module * remove os.EOL in simple dialog * change SimpleDialogCloseType to boolean * remove close type --- .eslintrc.json | 5 +- apps/browser/src/auth/popup/lock.component.ts | 4 +- .../src/auth/popup/register.component.ts | 4 +- .../src/auth/popup/set-password.component.ts | 4 +- .../src/auth/popup/two-factor.component.ts | 6 +- apps/browser/src/popup/app.component.ts | 4 +- .../popup/services/browser-dialog.service.ts | 79 ------------------- .../src/popup/services/services.module.ts | 8 +- .../src/popup/settings/premium.component.ts | 4 +- .../src/popup/settings/settings.component.ts | 22 +++--- .../popup/send/send-add-edit.component.ts | 4 +- .../popup/send/send-groupings.component.ts | 4 +- .../tools/popup/send/send-type.component.ts | 4 +- .../tools/popup/settings/export.component.ts | 4 +- .../components/vault/add-edit.component.ts | 4 +- .../components/vault/attachments.component.ts | 4 +- .../popup/components/vault/view.component.ts | 4 +- .../settings/folder-add-edit.component.ts | 4 +- .../src/app/accounts/settings.component.ts | 16 ++-- apps/desktop/src/app/app.component.ts | 10 +-- .../src/app/services/services.module.ts | 8 +- .../src/app/tools/export/export.component.ts | 28 +------ .../src/app/tools/send/add-edit.component.ts | 4 +- .../src/app/tools/send/send.component.ts | 4 +- apps/desktop/src/auth/lock.component.ts | 6 +- apps/desktop/src/auth/register.component.ts | 4 +- .../src/auth/set-password.component.ts | 4 +- .../src/services/electron-dialog.service.ts | 62 --------------- .../vault/app/accounts/premium.component.ts | 4 +- .../src/vault/app/vault/add-edit.component.ts | 4 +- .../vault/app/vault/attachments.component.ts | 4 +- .../app/vault/folder-add-edit.component.ts | 4 +- .../src/vault/app/vault/vault.component.ts | 6 +- .../src/vault/app/vault/view.component.ts | 4 +- .../organizations/guards/is-paid-org.guard.ts | 6 +- .../manage/entity-events.component.ts | 5 +- .../manage/group-add-edit.component.ts | 8 +- .../organizations/manage/groups.component.ts | 8 +- .../bulk/bulk-enable-sm-dialog.component.ts | 5 +- .../member-dialog/member-dialog.component.ts | 12 +-- .../components/reset-password.component.ts | 6 +- .../organizations/members/people.component.ts | 21 ++--- .../settings/account.component.ts | 4 +- .../delete-organization-dialog.component.ts | 4 +- ...families-for-enterprise-setup.component.ts | 4 +- .../import-export/org-export.component.ts | 4 +- .../import-export/org-import.component.ts | 6 +- .../settings/sponsoring-org-row.component.ts | 6 +- apps/web/src/app/app.component.ts | 10 +-- apps/web/src/app/auth/lock.component.ts | 4 +- .../register-form/register-form.component.ts | 4 +- .../src/app/auth/set-password.component.ts | 4 +- .../emergency-access-attachments.component.ts | 4 +- .../emergency-access-takeover.component.ts | 4 +- .../emergency-access.component.ts | 10 +-- .../emergency-add-edit.component.ts | 4 +- .../two-factor-authenticator.component.ts | 4 +- .../settings/two-factor-base.component.ts | 6 +- .../auth/settings/two-factor-duo.component.ts | 4 +- .../settings/two-factor-email.component.ts | 4 +- .../settings/two-factor-webauthn.component.ts | 6 +- .../settings/two-factor-yubikey.component.ts | 4 +- .../user-verification-prompt.component.ts | 4 +- .../src/app/auth/update-password.component.ts | 4 +- ...ganization-subscription-cloud.component.ts | 10 +-- .../settings/payment-method.component.ts | 8 +- .../settings/user-subscription.component.ts | 14 ++-- .../src/app/common/base.people.component.ts | 8 +- .../change-kdf/change-kdf.component.ts | 4 +- .../app/settings/change-password.component.ts | 8 +- .../src/app/settings/preferences.component.ts | 6 +- apps/web/src/app/tools/generator.component.ts | 4 +- .../tools/import-export/export.component.ts | 4 +- .../tools/import-export/import.component.ts | 4 +- .../src/app/tools/send/add-edit.component.ts | 4 +- apps/web/src/app/tools/send/send.component.ts | 5 +- .../collection-dialog.component.ts | 9 +-- .../individual-vault/add-edit.component.ts | 4 +- .../individual-vault/attachments.component.ts | 4 +- .../bulk-delete-dialog.component.ts | 4 +- .../bulk-move-dialog.component.ts | 4 +- .../bulk-share-dialog.component.ts | 4 +- .../folder-add-edit.component.ts | 8 +- .../organization-options.component.ts | 8 +- .../vault/individual-vault/vault.component.ts | 7 +- .../app/vault/org-vault/add-edit.component.ts | 4 +- .../vault/org-vault/attachments.component.ts | 4 +- .../vault-header/vault-header.component.ts | 15 ++-- .../app/vault/org-vault/vault.component.ts | 9 +-- .../domain-add-edit-dialog.component.ts | 6 +- .../domain-verification.component.ts | 6 +- .../organizations/manage/scim.component.ts | 6 +- .../clients/add-organization.component.ts | 6 +- .../providers/clients/clients.component.ts | 6 +- .../providers/manage/people.component.ts | 4 +- .../manage/user-add-edit.component.ts | 6 +- .../overview/overview.component.ts | 4 +- .../dialog/project-delete-dialog.component.ts | 4 +- .../project/project-people.component.ts | 5 +- .../project/project-secrets.component.ts | 4 +- .../projects/project/project.component.ts | 4 +- .../projects/projects/projects.component.ts | 4 +- .../secrets/dialog/secret-delete.component.ts | 4 +- .../secrets/dialog/secret-dialog.component.ts | 5 +- .../secrets/secrets.component.ts | 4 +- .../access/access-tokens.component.ts | 4 +- .../access-token-create-dialog.component.ts | 7 +- ...service-account-delete-dialog.component.ts | 4 +- .../service-account-people.component.ts | 10 +-- .../service-account.component.ts | 4 +- .../service-accounts.component.ts | 4 +- .../settings/porting/sm-export.component.ts | 4 +- .../settings/porting/sm-import.component.ts | 4 +- .../shared/new-menu.component.ts | 4 +- .../secrets-manager/trash/trash.component.ts | 4 +- .../components/change-password.component.ts | 12 +-- .../src/auth/components/lock.component.ts | 7 +- .../components/remove-password.component.ts | 7 +- .../components/update-password.component.ts | 5 +- .../update-temp-password.component.ts | 5 +- .../src/components/register.component.ts | 10 +-- .../src/components/set-password.component.ts | 4 +- .../dialog/dialog.service.abstraction.ts | 26 ------ .../src/services/dialog/dialog.service.ts | 65 --------------- libs/angular/src/services/dialog/index.ts | 6 -- .../dialog/simple-dialog-close-type.enum.ts | 4 - .../dialog/simple-dialog-type.enum.ts | 7 -- .../src/services/dialog/translation.ts | 4 - libs/angular/src/services/modal.service.ts | 5 +- .../export/components/export.component.ts | 9 +-- .../src/tools/send/add-edit.component.ts | 9 +-- libs/angular/src/tools/send/send.component.ts | 9 +-- .../vault/components/add-edit.component.ts | 11 ++- .../vault/components/attachments.component.ts | 11 ++- .../components/folder-add-edit.component.ts | 7 +- .../src/vault/components/premium.component.ts | 9 +-- .../src/vault/components/view.component.ts | 7 +- libs/components/src/dialog/dialog.module.ts | 11 +-- libs/components/src/dialog/dialog.service.ts | 39 ++++++--- libs/components/src/dialog/index.ts | 2 + .../simple-configurable-dialog.component.html | 2 +- .../simple-configurable-dialog.component.ts | 33 +++----- ...ple-configurable-dialog.service.stories.ts | 38 ++++----- .../simple-dialog.service.stories.ts | 16 ++-- .../src/dialog/simple-dialog/types.ts} | 8 +- libs/components/src/search/search.stories.ts | 4 +- libs/shared/tsconfig.libs.json | 1 + 147 files changed, 448 insertions(+), 758 deletions(-) delete mode 100644 apps/browser/src/popup/services/browser-dialog.service.ts delete mode 100644 apps/desktop/src/services/electron-dialog.service.ts delete mode 100644 libs/angular/src/services/dialog/dialog.service.abstraction.ts delete mode 100644 libs/angular/src/services/dialog/dialog.service.ts delete mode 100644 libs/angular/src/services/dialog/index.ts delete mode 100644 libs/angular/src/services/dialog/simple-dialog-close-type.enum.ts delete mode 100644 libs/angular/src/services/dialog/simple-dialog-type.enum.ts delete mode 100644 libs/angular/src/services/dialog/translation.ts rename libs/components/src/dialog/{ => simple-dialog}/simple-configurable-dialog/simple-configurable-dialog.component.html (91%) rename libs/components/src/dialog/{ => simple-dialog}/simple-configurable-dialog/simple-configurable-dialog.component.ts (72%) rename libs/components/src/dialog/{ => simple-dialog}/simple-configurable-dialog/simple-configurable-dialog.service.stories.ts (84%) rename libs/components/src/dialog/{ => simple-dialog}/simple-dialog.service.stories.ts (80%) rename libs/{angular/src/services/dialog/simple-dialog-options.ts => components/src/dialog/simple-dialog/types.ts} (89%) diff --git a/.eslintrc.json b/.eslintrc.json index f3115898ff..08e73e5031 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -156,7 +156,10 @@ { "files": ["libs/components/src/**/*.ts"], "rules": { - "no-restricted-imports": ["error", { "patterns": ["@bitwarden/components/*", "src/**/*"] }] + "no-restricted-imports": [ + "error", + { "patterns": ["@bitwarden/components/*", "src/**/*", "@bitwarden/angular/*"] } + ] } }, { diff --git a/apps/browser/src/auth/popup/lock.component.ts b/apps/browser/src/auth/popup/lock.component.ts index d13609f61d..8a86526458 100644 --- a/apps/browser/src/auth/popup/lock.component.ts +++ b/apps/browser/src/auth/popup/lock.component.ts @@ -2,7 +2,6 @@ import { Component, NgZone } from "@angular/core"; import { Router } from "@angular/router"; import { LockComponent as BaseLockComponent } from "@bitwarden/angular/auth/components/lock.component"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { VaultTimeoutService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeout.service"; import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeoutSettings.service"; @@ -19,6 +18,7 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength"; +import { DialogService } from "@bitwarden/components"; import { BiometricErrors, BiometricErrorTypes } from "../../models/biometricErrors"; @@ -50,7 +50,7 @@ export class LockComponent extends BaseLockComponent { policyService: InternalPolicyService, passwordStrengthService: PasswordStrengthServiceAbstraction, private authService: AuthService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( router, diff --git a/apps/browser/src/auth/popup/register.component.ts b/apps/browser/src/auth/popup/register.component.ts index ad7a9e1cc6..1599af2216 100644 --- a/apps/browser/src/auth/popup/register.component.ts +++ b/apps/browser/src/auth/popup/register.component.ts @@ -4,7 +4,6 @@ import { Router } from "@angular/router"; import { RegisterComponent as BaseRegisterComponent } from "@bitwarden/angular/components/register.component"; import { FormValidationErrorsService } from "@bitwarden/angular/platform/abstractions/form-validation-errors.service"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { AuditService } from "@bitwarden/common/abstractions/audit.service"; import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service"; @@ -15,6 +14,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service" import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-register", @@ -38,7 +38,7 @@ export class RegisterComponent extends BaseRegisterComponent { environmentService: EnvironmentService, logService: LogService, auditService: AuditService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( formValidationErrorService, diff --git a/apps/browser/src/auth/popup/set-password.component.ts b/apps/browser/src/auth/popup/set-password.component.ts index 83ec357273..73b092f32e 100644 --- a/apps/browser/src/auth/popup/set-password.component.ts +++ b/apps/browser/src/auth/popup/set-password.component.ts @@ -2,7 +2,6 @@ import { Component } from "@angular/core"; import { ActivatedRoute, Router } from "@angular/router"; import { SetPasswordComponent as BaseSetPasswordComponent } from "@bitwarden/angular/components/set-password.component"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationUserService } from "@bitwarden/common/abstractions/organization-user/organization-user.service"; import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction"; @@ -15,6 +14,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-set-password", @@ -36,7 +36,7 @@ export class SetPasswordComponent extends BaseSetPasswordComponent { route: ActivatedRoute, organizationApiService: OrganizationApiServiceAbstraction, organizationUserService: OrganizationUserService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( i18nService, diff --git a/apps/browser/src/auth/popup/two-factor.component.ts b/apps/browser/src/auth/popup/two-factor.component.ts index 21a2bd42f8..03821bb22f 100644 --- a/apps/browser/src/auth/popup/two-factor.component.ts +++ b/apps/browser/src/auth/popup/two-factor.component.ts @@ -3,7 +3,6 @@ import { ActivatedRoute, Router } from "@angular/router"; import { first } from "rxjs/operators"; import { TwoFactorComponent as BaseTwoFactorComponent } from "@bitwarden/angular/auth/components/two-factor.component"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service"; import { LoginService } from "@bitwarden/common/auth/abstractions/login.service"; @@ -18,6 +17,7 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; +import { DialogService } from "@bitwarden/components"; import { BrowserApi } from "../../platform/browser/browser-api"; import { PopupUtilsService } from "../../popup/services/popup-utils.service"; @@ -48,7 +48,7 @@ export class TwoFactorComponent extends BaseTwoFactorComponent { twoFactorService: TwoFactorService, appIdService: AppIdService, loginService: LoginService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) { super( authService, @@ -107,7 +107,7 @@ export class TwoFactorComponent extends BaseTwoFactorComponent { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "warning" }, content: { key: "popup2faCloseMessage" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (confirmed) { this.popupUtilsService.popOut(window); diff --git a/apps/browser/src/popup/app.component.ts b/apps/browser/src/popup/app.component.ts index 485b283407..815109c549 100644 --- a/apps/browser/src/popup/app.component.ts +++ b/apps/browser/src/popup/app.component.ts @@ -12,12 +12,12 @@ import { IndividualConfig, ToastrService } from "ngx-toastr"; import { filter, concatMap, Subject, takeUntil } from "rxjs"; import Swal from "sweetalert2"; -import { DialogServiceAbstraction, SimpleDialogOptions } from "@bitwarden/angular/services/dialog"; import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service"; import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService, SimpleDialogOptions } from "@bitwarden/components"; import { BrowserApi } from "../platform/browser/browser-api"; import { BrowserStateService } from "../platform/services/abstractions/browser-state.service"; @@ -50,7 +50,7 @@ export class AppComponent implements OnInit, OnDestroy { private ngZone: NgZone, private sanitizer: DomSanitizer, private platformUtilsService: PlatformUtilsService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { diff --git a/apps/browser/src/popup/services/browser-dialog.service.ts b/apps/browser/src/popup/services/browser-dialog.service.ts deleted file mode 100644 index 4402869519..0000000000 --- a/apps/browser/src/popup/services/browser-dialog.service.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { Injectable } from "@angular/core"; -import Swal, { SweetAlertIcon } from "sweetalert2"; - -import { - DialogService, - SimpleDialogOptions, - SimpleDialogType, -} from "@bitwarden/angular/services/dialog"; - -@Injectable() -export class BrowserDialogService extends DialogService { - async openSimpleDialog(options: SimpleDialogOptions) { - const defaultCancel = - options.cancelButtonText === undefined - ? options.acceptButtonText == null - ? "no" - : "cancel" - : null; - - return this.legacyShowDialog( - this.translate(options.content), - this.translate(options.title), - this.translate(options.acceptButtonText, "yes"), - this.translate(options.cancelButtonText, defaultCancel), - options.type - ); - } - - private async legacyShowDialog( - body: string, - title?: string, - confirmText?: string, - cancelText?: string, - type?: SimpleDialogType - ) { - let iconClasses: string = null; - let icon: SweetAlertIcon = null; - if (type != null) { - // If you add custom types to this part, the type to SweetAlertIcon cast below needs to be changed. - switch (type) { - case "success": - iconClasses = "bwi-check text-success"; - icon = "success"; - break; - case "warning": - iconClasses = "bwi-exclamation-triangle text-warning"; - icon = "warning"; - break; - case "danger": - iconClasses = "bwi-error text-danger"; - icon = "error"; - break; - case "info": - iconClasses = "bwi-info-circle text-info"; - icon = "info"; - break; - default: - break; - } - } - - const confirmed = await Swal.fire({ - heightAuto: false, - buttonsStyling: false, - icon: icon, - iconHtml: - iconClasses != null ? `` : undefined, - text: body, - titleText: title, - showCancelButton: cancelText != null, - cancelButtonText: cancelText, - showConfirmButton: true, - confirmButtonText: confirmText == null ? this.i18nService.t("ok") : confirmText, - timer: 300000, - }); - - return confirmed.value; - } -} diff --git a/apps/browser/src/popup/services/services.module.ts b/apps/browser/src/popup/services/services.module.ts index 7b26980098..13a6bdf502 100644 --- a/apps/browser/src/popup/services/services.module.ts +++ b/apps/browser/src/popup/services/services.module.ts @@ -2,7 +2,6 @@ import { APP_INITIALIZER, LOCALE_ID, NgModule } from "@angular/core"; import { LockGuard as BaseLockGuardService } from "@bitwarden/angular/auth/guards/lock.guard"; import { UnauthGuard as BaseUnauthGuardService } from "@bitwarden/angular/auth/guards/unauth.guard"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { MEMORY_STORAGE, SECURE_STORAGE } from "@bitwarden/angular/services/injection-tokens"; import { JslibServicesModule } from "@bitwarden/angular/services/jslib-services.module"; import { ThemingService } from "@bitwarden/angular/services/theming/theming.service"; @@ -80,6 +79,7 @@ import { import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { FolderApiService } from "@bitwarden/common/vault/services/folder/folder-api.service"; +import { DialogService } from "@bitwarden/components"; import { VaultExportServiceAbstraction } from "@bitwarden/exporter/vault-export"; import { BrowserOrganizationService } from "../../admin-console/services/browser-organization.service"; @@ -103,7 +103,6 @@ import { PasswordRepromptService } from "../../vault/popup/services/password-rep import { BrowserFolderService } from "../../vault/services/browser-folder.service"; import { VaultFilterService } from "../../vault/services/vault-filter.service"; -import { BrowserDialogService } from "./browser-dialog.service"; import { DebounceNavigationService } from "./debounceNavigationService"; import { InitService } from "./init.service"; import { PopupSearchService } from "./popup-search.service"; @@ -133,6 +132,7 @@ function getBgService(service: keyof MainBackground) { providers: [ InitService, DebounceNavigationService, + DialogService, { provide: LOCALE_ID, useFactory: () => getBgService("i18nService")().translationLocale, @@ -502,10 +502,6 @@ function getBgService(service: keyof MainBackground) { EnvironmentService, ], }, - { - provide: DialogServiceAbstraction, - useClass: BrowserDialogService, - }, ], }) export class ServicesModule {} diff --git a/apps/browser/src/popup/settings/premium.component.ts b/apps/browser/src/popup/settings/premium.component.ts index 459cd2a6cb..e57d53f3c4 100644 --- a/apps/browser/src/popup/settings/premium.component.ts +++ b/apps/browser/src/popup/settings/premium.component.ts @@ -1,7 +1,6 @@ import { CurrencyPipe, Location } from "@angular/common"; import { Component } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { PremiumComponent as BasePremiumComponent } from "@bitwarden/angular/vault/components/premium.component"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; @@ -9,6 +8,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-premium", @@ -25,7 +25,7 @@ export class PremiumComponent extends BasePremiumComponent { logService: LogService, private location: Location, private currencyPipe: CurrencyPipe, - dialogService: DialogServiceAbstraction, + dialogService: DialogService, environmentService: EnvironmentService ) { super( diff --git a/apps/browser/src/popup/settings/settings.component.ts b/apps/browser/src/popup/settings/settings.component.ts index 562cf55f2d..38f7a15819 100644 --- a/apps/browser/src/popup/settings/settings.component.ts +++ b/apps/browser/src/popup/settings/settings.component.ts @@ -4,7 +4,6 @@ import { Router } from "@angular/router"; import { concatMap, debounceTime, filter, map, Observable, Subject, takeUntil, tap } from "rxjs"; import Swal from "sweetalert2"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { VaultTimeoutService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeout.service"; import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeoutSettings.service"; @@ -19,6 +18,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; +import { DialogService } from "@bitwarden/components"; import { BiometricErrors, BiometricErrorTypes } from "../../models/biometricErrors"; import { BrowserApi } from "../../platform/browser/browser-api"; @@ -84,7 +84,7 @@ export class SettingsComponent implements OnInit { private popupUtilsService: PopupUtilsService, private modalService: ModalService, private keyConnectorService: KeyConnectorService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { @@ -190,7 +190,7 @@ export class SettingsComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "warning" }, content: { key: "neverLockWarning" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -226,7 +226,7 @@ export class SettingsComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "vaultTimeoutLogOutConfirmationTitle" }, content: { key: "vaultTimeoutLogOutConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -289,7 +289,7 @@ export class SettingsComponent implements OnInit { content: { key: "nativeMessaginPermissionSidebarDesc" }, acceptButtonText: { key: "ok" }, cancelButtonText: null, - type: SimpleDialogType.INFO, + type: "info", }); this.form.controls.biometric.setValue(false); @@ -303,7 +303,7 @@ export class SettingsComponent implements OnInit { content: { key: "nativeMessaginPermissionErrorDesc" }, acceptButtonText: { key: "ok" }, cancelButtonText: null, - type: SimpleDialogType.DANGER, + type: "danger", }); this.form.controls.biometric.setValue(false); @@ -358,7 +358,7 @@ export class SettingsComponent implements OnInit { content: { key: error.description }, acceptButtonText: { key: "ok" }, cancelButtonText: null, - type: SimpleDialogType.DANGER, + type: "danger", }); }), ]); @@ -382,7 +382,7 @@ export class SettingsComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "logOut" }, content: { key: "logOutConfirmation" }, - type: SimpleDialogType.INFO, + type: "info", }); if (confirmed) { @@ -394,7 +394,7 @@ export class SettingsComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "changeMasterPassword" }, content: { key: "changeMasterPasswordConfirmation" }, - type: SimpleDialogType.INFO, + type: "info", }); if (confirmed) { BrowserApi.createNewTab( @@ -407,7 +407,7 @@ export class SettingsComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "twoStepLogin" }, content: { key: "twoStepLoginConfirmation" }, - type: SimpleDialogType.INFO, + type: "info", }); if (confirmed) { BrowserApi.createNewTab("https://bitwarden.com/help/setup-two-step-login/"); @@ -418,7 +418,7 @@ export class SettingsComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "learnOrg" }, content: { key: "learnOrgConfirmation" }, - type: SimpleDialogType.INFO, + type: "info", }); if (confirmed) { BrowserApi.createNewTab("https://bitwarden.com/help/about-organizations/"); diff --git a/apps/browser/src/tools/popup/send/send-add-edit.component.ts b/apps/browser/src/tools/popup/send/send-add-edit.component.ts index aaf951e036..1efd950c50 100644 --- a/apps/browser/src/tools/popup/send/send-add-edit.component.ts +++ b/apps/browser/src/tools/popup/send/send-add-edit.component.ts @@ -3,7 +3,6 @@ import { Component } from "@angular/core"; import { ActivatedRoute, Router } from "@angular/router"; import { first } from "rxjs/operators"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { AddEditComponent as BaseAddEditComponent } from "@bitwarden/angular/tools/send/add-edit.component"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; @@ -13,6 +12,7 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction"; import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction"; +import { DialogService } from "@bitwarden/components"; import { BrowserStateService } from "../../../platform/services/abstractions/browser-state.service"; import { PopupUtilsService } from "../../../popup/services/popup-utils.service"; @@ -47,7 +47,7 @@ export class SendAddEditComponent extends BaseAddEditComponent { private popupUtilsService: PopupUtilsService, logService: LogService, sendApiService: SendApiService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( i18nService, diff --git a/apps/browser/src/tools/popup/send/send-groupings.component.ts b/apps/browser/src/tools/popup/send/send-groupings.component.ts index 596d6e5ed3..e93064fe80 100644 --- a/apps/browser/src/tools/popup/send/send-groupings.component.ts +++ b/apps/browser/src/tools/popup/send/send-groupings.component.ts @@ -1,7 +1,6 @@ import { ChangeDetectorRef, Component, NgZone } from "@angular/core"; import { Router } from "@angular/router"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { SendComponent as BaseSendComponent } from "@bitwarden/angular/tools/send/send.component"; import { SearchService } from "@bitwarden/common/abstractions/search.service"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; @@ -15,6 +14,7 @@ import { SendView } from "@bitwarden/common/tools/send/models/view/send.view"; import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction"; import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; +import { DialogService } from "@bitwarden/components"; import { BrowserSendComponentState } from "../../../models/browserSendComponentState"; import { BrowserStateService } from "../../../platform/services/abstractions/browser-state.service"; @@ -51,7 +51,7 @@ export class SendGroupingsComponent extends BaseSendComponent { private broadcasterService: BroadcasterService, logService: LogService, sendApiService: SendApiService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( sendService, diff --git a/apps/browser/src/tools/popup/send/send-type.component.ts b/apps/browser/src/tools/popup/send/send-type.component.ts index c76561586d..4a2794fdda 100644 --- a/apps/browser/src/tools/popup/send/send-type.component.ts +++ b/apps/browser/src/tools/popup/send/send-type.component.ts @@ -3,7 +3,6 @@ import { ChangeDetectorRef, Component, NgZone } from "@angular/core"; import { ActivatedRoute, Router } from "@angular/router"; import { first } from "rxjs/operators"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { SendComponent as BaseSendComponent } from "@bitwarden/angular/tools/send/send.component"; import { SearchService } from "@bitwarden/common/abstractions/search.service"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; @@ -16,6 +15,7 @@ import { SendType } from "@bitwarden/common/tools/send/enums/send-type"; import { SendView } from "@bitwarden/common/tools/send/models/view/send.view"; import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction"; import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction"; +import { DialogService } from "@bitwarden/components"; import { BrowserComponentState } from "../../../models/browserComponentState"; import { BrowserStateService } from "../../../platform/services/abstractions/browser-state.service"; @@ -51,7 +51,7 @@ export class SendTypeComponent extends BaseSendComponent { private router: Router, logService: LogService, sendApiService: SendApiService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( sendService, diff --git a/apps/browser/src/tools/popup/settings/export.component.ts b/apps/browser/src/tools/popup/settings/export.component.ts index e21f3b9bd4..d34b86a9e4 100644 --- a/apps/browser/src/tools/popup/settings/export.component.ts +++ b/apps/browser/src/tools/popup/settings/export.component.ts @@ -2,7 +2,6 @@ import { Component } from "@angular/core"; import { UntypedFormBuilder } from "@angular/forms"; import { Router } from "@angular/router"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/tools/export/components/export.component"; import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; @@ -12,6 +11,7 @@ import { FileDownloadService } from "@bitwarden/common/platform/abstractions/fil import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { VaultExportServiceAbstraction } from "@bitwarden/exporter/vault-export"; @Component({ @@ -31,7 +31,7 @@ export class ExportComponent extends BaseExportComponent { userVerificationService: UserVerificationService, formBuilder: UntypedFormBuilder, fileDownloadService: FileDownloadService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cryptoService, diff --git a/apps/browser/src/vault/popup/components/vault/add-edit.component.ts b/apps/browser/src/vault/popup/components/vault/add-edit.component.ts index 68a63fb062..6148e31dd6 100644 --- a/apps/browser/src/vault/popup/components/vault/add-edit.component.ts +++ b/apps/browser/src/vault/popup/components/vault/add-edit.component.ts @@ -3,7 +3,6 @@ import { Component } from "@angular/core"; import { ActivatedRoute, Router } from "@angular/router"; import { first } from "rxjs/operators"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { AddEditComponent as BaseAddEditComponent } from "@bitwarden/angular/vault/components/add-edit.component"; import { AuditService } from "@bitwarden/common/abstractions/audit.service"; import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service"; @@ -21,6 +20,7 @@ import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folde import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { LoginUriView } from "@bitwarden/common/vault/models/view/login-uri.view"; +import { DialogService } from "@bitwarden/components"; import { BrowserApi } from "../../../../platform/browser/browser-api"; import { PopupUtilsService } from "../../../../popup/services/popup-utils.service"; @@ -55,7 +55,7 @@ export class AddEditComponent extends BaseAddEditComponent { passwordRepromptService: PasswordRepromptService, logService: LogService, sendApiService: SendApiService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cipherService, diff --git a/apps/browser/src/vault/popup/components/vault/attachments.component.ts b/apps/browser/src/vault/popup/components/vault/attachments.component.ts index 7c1107caa4..5047c9bfd1 100644 --- a/apps/browser/src/vault/popup/components/vault/attachments.component.ts +++ b/apps/browser/src/vault/popup/components/vault/attachments.component.ts @@ -3,7 +3,6 @@ import { Component } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { first } from "rxjs/operators"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { AttachmentsComponent as BaseAttachmentsComponent } from "@bitwarden/angular/vault/components/attachments.component"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; @@ -13,6 +12,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service" import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-vault-attachments", @@ -33,7 +33,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent { stateService: StateService, logService: LogService, fileDownloadService: FileDownloadService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cipherService, diff --git a/apps/browser/src/vault/popup/components/vault/view.component.ts b/apps/browser/src/vault/popup/components/vault/view.component.ts index 34f2cacde1..a70a11475c 100644 --- a/apps/browser/src/vault/popup/components/vault/view.component.ts +++ b/apps/browser/src/vault/popup/components/vault/view.component.ts @@ -4,7 +4,6 @@ import { ActivatedRoute, Router } from "@angular/router"; import { Subject, takeUntil } from "rxjs"; import { first } from "rxjs/operators"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ViewComponent as BaseViewComponent } from "@bitwarden/angular/vault/components/view.component"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { AuditService } from "@bitwarden/common/abstractions/audit.service"; @@ -25,6 +24,7 @@ import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/pa import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; import { LoginUriView } from "@bitwarden/common/vault/models/view/login-uri.view"; +import { DialogService } from "@bitwarden/components"; import { AutofillService } from "../../../../autofill/services/abstractions/autofill.service"; import { BrowserApi } from "../../../../platform/browser/browser-api"; @@ -84,7 +84,7 @@ export class ViewComponent extends BaseViewComponent { passwordRepromptService: PasswordRepromptService, logService: LogService, fileDownloadService: FileDownloadService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cipherService, diff --git a/apps/browser/src/vault/popup/settings/folder-add-edit.component.ts b/apps/browser/src/vault/popup/settings/folder-add-edit.component.ts index 9acd0a7b4f..8266cc883a 100644 --- a/apps/browser/src/vault/popup/settings/folder-add-edit.component.ts +++ b/apps/browser/src/vault/popup/settings/folder-add-edit.component.ts @@ -3,13 +3,13 @@ import { FormBuilder } from "@angular/forms"; import { ActivatedRoute, Router } from "@angular/router"; import { first } from "rxjs/operators"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { FolderAddEditComponent as BaseFolderAddEditComponent } from "@bitwarden/angular/vault/components/folder-add-edit.component"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { FolderApiServiceAbstraction } from "@bitwarden/common/vault/abstractions/folder/folder-api.service.abstraction"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-folder-add-edit", @@ -25,7 +25,7 @@ export class FolderAddEditComponent extends BaseFolderAddEditComponent { private router: Router, private route: ActivatedRoute, logService: LogService, - dialogService: DialogServiceAbstraction, + dialogService: DialogService, formBuilder: FormBuilder ) { super( diff --git a/apps/desktop/src/app/accounts/settings.component.ts b/apps/desktop/src/app/accounts/settings.component.ts index 162cb338bc..6eefc2ec52 100644 --- a/apps/desktop/src/app/accounts/settings.component.ts +++ b/apps/desktop/src/app/accounts/settings.component.ts @@ -3,7 +3,6 @@ import { FormBuilder } from "@angular/forms"; import { Observable, Subject } from "rxjs"; import { concatMap, debounceTime, filter, map, takeUntil, tap } from "rxjs/operators"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { AbstractThemingService } from "@bitwarden/angular/services/theming/theming.service.abstraction"; import { SettingsService } from "@bitwarden/common/abstractions/settings.service"; @@ -17,6 +16,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; +import { DialogService } from "@bitwarden/components"; import { flagEnabled } from "../../platform/flags"; import { ElectronStateService } from "../../platform/services/electron-state.service.abstraction"; @@ -111,7 +111,7 @@ export class SettingsComponent implements OnInit { private modalService: ModalService, private themingService: AbstractThemingService, private settingsService: SettingsService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) { const isMac = this.platformUtilsService.getDevice() === DeviceType.MacOsDesktop; @@ -300,7 +300,7 @@ export class SettingsComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "warning" }, content: { key: "neverLockWarning" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -336,7 +336,7 @@ export class SettingsComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "vaultTimeoutLogOutConfirmationTitle" }, content: { key: "vaultTimeoutLogOutConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -465,7 +465,7 @@ export class SettingsComponent implements OnInit { const confirm = await this.dialogService.openSimpleDialog({ title: { key: "confirmTrayTitle" }, content: { key: "confirmTrayDesc" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (confirm) { @@ -527,7 +527,7 @@ export class SettingsComponent implements OnInit { content: { key: "browserIntegrationMasOnlyDesc" }, acceptButtonText: { key: "ok" }, cancelButtonText: null, - type: SimpleDialogType.WARNING, + type: "warning", }); this.form.controls.enableBrowserIntegration.setValue(false); @@ -538,7 +538,7 @@ export class SettingsComponent implements OnInit { content: { key: "browserIntegrationWindowsStoreDesc" }, acceptButtonText: { key: "ok" }, cancelButtonText: null, - type: SimpleDialogType.WARNING, + type: "warning", }); this.form.controls.enableBrowserIntegration.setValue(false); @@ -549,7 +549,7 @@ export class SettingsComponent implements OnInit { content: { key: "browserIntegrationLinuxDesc" }, acceptButtonText: { key: "ok" }, cancelButtonText: null, - type: SimpleDialogType.WARNING, + type: "warning", }); this.form.controls.enableBrowserIntegration.setValue(false); diff --git a/apps/desktop/src/app/app.component.ts b/apps/desktop/src/app/app.component.ts index 320c93a05e..cb44a7e5a9 100644 --- a/apps/desktop/src/app/app.component.ts +++ b/apps/desktop/src/app/app.component.ts @@ -15,7 +15,6 @@ import { IndividualConfig, ToastrService } from "ngx-toastr"; import { firstValueFrom, Subject, takeUntil } from "rxjs"; import { ModalRef } from "@bitwarden/angular/components/modal/modal.ref"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { EventUploadService } from "@bitwarden/common/abstractions/event/event-upload.service"; import { NotificationsService } from "@bitwarden/common/abstractions/notifications.service"; @@ -43,6 +42,7 @@ import { CollectionService } from "@bitwarden/common/vault/abstractions/collecti import { InternalFolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; +import { DialogService } from "@bitwarden/components"; import { DeleteAccountComponent } from "../auth/delete-account.component"; import { LoginApprovalComponent } from "../auth/login/login-approval.component"; @@ -138,7 +138,7 @@ export class AppComponent implements OnInit, OnDestroy { private modalService: ModalService, private keyConnectorService: KeyConnectorService, private configService: ConfigServiceAbstraction, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} ngOnInit() { @@ -246,7 +246,7 @@ export class AppComponent implements OnInit, OnDestroy { this.i18nService.t("yourAccountsFingerprint") + ":\n" + fingerprint.join("-"), acceptButtonText: { key: "learnMore" }, cancelButtonText: { key: "close" }, - type: SimpleDialogType.INFO, + type: "info", }); if (result) { @@ -281,7 +281,7 @@ export class AppComponent implements OnInit, OnDestroy { title: { key: "premiumRequired" }, content: { key: "premiumRequiredDesc" }, acceptButtonText: { key: "learnMore" }, - type: SimpleDialogType.SUCCESS, + type: "success", }); if (premiumConfirmed) { await this.openModal(PremiumComponent, this.premiumRef); @@ -293,7 +293,7 @@ export class AppComponent implements OnInit, OnDestroy { title: { key: "emailVerificationRequired" }, content: { key: "emailVerificationRequiredDesc" }, acceptButtonText: { key: "learnMore" }, - type: SimpleDialogType.INFO, + type: "info", }); if (emailVerificationConfirmed) { this.platformUtilsService.launchUri( diff --git a/apps/desktop/src/app/services/services.module.ts b/apps/desktop/src/app/services/services.module.ts index bee3ae4c7e..ded0366dc1 100644 --- a/apps/desktop/src/app/services/services.module.ts +++ b/apps/desktop/src/app/services/services.module.ts @@ -1,6 +1,5 @@ import { APP_INITIALIZER, InjectionToken, NgModule } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { SECURE_STORAGE, STATE_FACTORY, @@ -40,6 +39,7 @@ import { SystemService } from "@bitwarden/common/platform/services/system.servic import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; import { CipherService as CipherServiceAbstraction } from "@bitwarden/common/vault/abstractions/cipher.service"; import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; +import { DialogService } from "@bitwarden/components"; import { LoginGuard } from "../../auth/guards/login.guard"; import { Account } from "../../models/account"; @@ -52,7 +52,6 @@ import { ElectronRendererStorageService } from "../../platform/services/electron import { ElectronStateService } from "../../platform/services/electron-state.service"; import { ElectronStateService as ElectronStateServiceAbstraction } from "../../platform/services/electron-state.service.abstraction"; import { I18nService } from "../../platform/services/i18n.service"; -import { ElectronDialogService } from "../../services/electron-dialog.service"; import { EncryptedMessageHandlerService } from "../../services/encrypted-message-handler.service"; import { NativeMessageHandlerService } from "../../services/native-message-handler.service"; import { NativeMessagingService } from "../../services/native-messaging.service"; @@ -73,6 +72,7 @@ const RELOAD_CALLBACK = new InjectionToken<() => any>("RELOAD_CALLBACK"); NativeMessagingService, SearchBarService, LoginGuard, + DialogService, { provide: APP_INITIALIZER, useFactory: (initService: InitService) => initService.init(), @@ -178,10 +178,6 @@ const RELOAD_CALLBACK = new InjectionToken<() => any>("RELOAD_CALLBACK"); useClass: LoginService, deps: [StateServiceAbstraction], }, - { - provide: DialogServiceAbstraction, - useClass: ElectronDialogService, - }, { provide: CryptoServiceAbstraction, useClass: ElectronCryptoService, diff --git a/apps/desktop/src/app/tools/export/export.component.ts b/apps/desktop/src/app/tools/export/export.component.ts index 770c3bf5f5..94121afc8d 100644 --- a/apps/desktop/src/app/tools/export/export.component.ts +++ b/apps/desktop/src/app/tools/export/export.component.ts @@ -1,9 +1,6 @@ -import * as os from "os"; - import { Component, OnInit } from "@angular/core"; import { UntypedFormBuilder } from "@angular/forms"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/tools/export/components/export.component"; import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; @@ -14,6 +11,7 @@ import { FileDownloadService } from "@bitwarden/common/platform/abstractions/fil import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { VaultExportServiceAbstraction } from "@bitwarden/exporter/vault-export"; const BroadcasterSubscriptionId = "ExportComponent"; @@ -35,7 +33,7 @@ export class ExportComponent extends BaseExportComponent implements OnInit { private broadcasterService: BroadcasterService, logService: LogService, fileDownloadService: FileDownloadService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cryptoService, @@ -56,26 +54,4 @@ export class ExportComponent extends BaseExportComponent implements OnInit { ngOnDestroy() { this.broadcasterService.unsubscribe(BroadcasterSubscriptionId); } - - async warningDialog() { - if (this.encryptedFormat) { - return await this.dialogService.openSimpleDialog({ - title: { key: "confirmVaultExport" }, - content: - this.i18nService.t("encExportKeyWarningDesc") + - os.EOL + - os.EOL + - this.i18nService.t("encExportAccountWarningDesc"), - acceptButtonText: { key: "exportVault" }, - type: SimpleDialogType.WARNING, - }); - } else { - return await this.dialogService.openSimpleDialog({ - title: { key: "confirmVaultExport" }, - content: { key: "exportWarningDesc" }, - acceptButtonText: { key: "exportVault" }, - type: SimpleDialogType.WARNING, - }); - } - } } diff --git a/apps/desktop/src/app/tools/send/add-edit.component.ts b/apps/desktop/src/app/tools/send/add-edit.component.ts index adfdb0fa64..de5d2a601a 100644 --- a/apps/desktop/src/app/tools/send/add-edit.component.ts +++ b/apps/desktop/src/app/tools/send/add-edit.component.ts @@ -1,7 +1,6 @@ import { DatePipe } from "@angular/common"; import { Component } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { AddEditComponent as BaseAddEditComponent } from "@bitwarden/angular/tools/send/add-edit.component"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; @@ -12,6 +11,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction"; import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-send-add-edit", @@ -29,7 +29,7 @@ export class AddEditComponent extends BaseAddEditComponent { policyService: PolicyService, logService: LogService, sendApiService: SendApiService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( i18nService, diff --git a/apps/desktop/src/app/tools/send/send.component.ts b/apps/desktop/src/app/tools/send/send.component.ts index 8cdc90d995..7ad98ceda1 100644 --- a/apps/desktop/src/app/tools/send/send.component.ts +++ b/apps/desktop/src/app/tools/send/send.component.ts @@ -1,6 +1,5 @@ import { Component, NgZone, OnDestroy, OnInit, ViewChild } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { SendComponent as BaseSendComponent } from "@bitwarden/angular/tools/send/send.component"; import { SearchService } from "@bitwarden/common/abstractions/search.service"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; @@ -12,6 +11,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { SendView } from "@bitwarden/common/tools/send/models/view/send.view"; import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction"; import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction"; +import { DialogService } from "@bitwarden/components"; import { invokeMenu, RendererMenuItem } from "../../../utils"; import { SearchBarService } from "../../layout/search/search-bar.service"; @@ -48,7 +48,7 @@ export class SendComponent extends BaseSendComponent implements OnInit, OnDestro private searchBarService: SearchBarService, logService: LogService, sendApiService: SendApiService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( sendService, diff --git a/apps/desktop/src/auth/lock.component.ts b/apps/desktop/src/auth/lock.component.ts index 61f7b4bfe3..f19ca4476f 100644 --- a/apps/desktop/src/auth/lock.component.ts +++ b/apps/desktop/src/auth/lock.component.ts @@ -3,7 +3,6 @@ import { ActivatedRoute, Router } from "@angular/router"; import { ipcRenderer } from "electron"; import { LockComponent as BaseLockComponent } from "@bitwarden/angular/auth/components/lock.component"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { VaultTimeoutService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeout.service"; import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeoutSettings.service"; @@ -19,6 +18,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service" import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength"; +import { DialogService } from "@bitwarden/components"; import { ElectronStateService } from "../platform/services/electron-state.service.abstraction"; import { BiometricStorageAction, BiometricMessage } from "../types/biometric-message"; @@ -52,7 +52,7 @@ export class LockComponent extends BaseLockComponent { passwordStrengthService: PasswordStrengthServiceAbstraction, logService: LogService, keyConnectorService: KeyConnectorService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( router, @@ -155,7 +155,7 @@ export class LockComponent extends BaseLockComponent { const response = await this.dialogService.openSimpleDialog({ title: { key: "windowsBiometricUpdateWarningTitle" }, content: { key: "windowsBiometricUpdateWarning" }, - type: SimpleDialogType.WARNING, + type: "warning", }); await this.stateService.setBiometricRequirePasswordOnStart(response); diff --git a/apps/desktop/src/auth/register.component.ts b/apps/desktop/src/auth/register.component.ts index f4324f1237..db38fd4721 100644 --- a/apps/desktop/src/auth/register.component.ts +++ b/apps/desktop/src/auth/register.component.ts @@ -4,7 +4,6 @@ import { Router } from "@angular/router"; import { RegisterComponent as BaseRegisterComponent } from "@bitwarden/angular/components/register.component"; import { FormValidationErrorsService } from "@bitwarden/angular/platform/abstractions/form-validation-errors.service"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { AuditService } from "@bitwarden/common/abstractions/audit.service"; import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service"; @@ -16,6 +15,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service" import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; +import { DialogService } from "@bitwarden/components"; const BroadcasterSubscriptionId = "RegisterComponent"; @@ -40,7 +40,7 @@ export class RegisterComponent extends BaseRegisterComponent implements OnInit, private ngZone: NgZone, logService: LogService, auditService: AuditService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( formValidationErrorService, diff --git a/apps/desktop/src/auth/set-password.component.ts b/apps/desktop/src/auth/set-password.component.ts index b710e96b7e..fedd70b313 100644 --- a/apps/desktop/src/auth/set-password.component.ts +++ b/apps/desktop/src/auth/set-password.component.ts @@ -2,7 +2,6 @@ import { Component, NgZone, OnDestroy } from "@angular/core"; import { ActivatedRoute, Router } from "@angular/router"; import { SetPasswordComponent as BaseSetPasswordComponent } from "@bitwarden/angular/components/set-password.component"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationUserService } from "@bitwarden/common/abstractions/organization-user/organization-user.service"; import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction"; @@ -16,6 +15,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; +import { DialogService } from "@bitwarden/components"; const BroadcasterSubscriptionId = "SetPasswordComponent"; @@ -41,7 +41,7 @@ export class SetPasswordComponent extends BaseSetPasswordComponent implements On stateService: StateService, organizationApiService: OrganizationApiServiceAbstraction, organizationUserService: OrganizationUserService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( i18nService, diff --git a/apps/desktop/src/services/electron-dialog.service.ts b/apps/desktop/src/services/electron-dialog.service.ts deleted file mode 100644 index e49e39e811..0000000000 --- a/apps/desktop/src/services/electron-dialog.service.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { ipcRenderer } from "electron"; - -import { - DialogService, - SimpleDialogOptions, - SimpleDialogType, -} from "@bitwarden/angular/services/dialog"; - -// Electron supports a limited set of dialog types -// https://www.electronjs.org/docs/latest/api/dialog#dialogshowmessageboxbrowserwindow-options -const electronTypeMap: Record = { - [SimpleDialogType.PRIMARY]: "info", - [SimpleDialogType.SUCCESS]: "info", - [SimpleDialogType.INFO]: "info", - [SimpleDialogType.WARNING]: "warning", - [SimpleDialogType.DANGER]: "error", -}; - -export class ElectronDialogService extends DialogService { - async openSimpleDialog(options: SimpleDialogOptions) { - const defaultCancel = - options.cancelButtonText === undefined - ? options.acceptButtonText == null - ? "no" - : "cancel" - : null; - - return this.legacyShowDialog( - this.translate(options.content), - this.translate(options.title), - this.translate(options.acceptButtonText, "yes"), - this.translate(options.cancelButtonText, defaultCancel), - options.type - ); - } - - private async legacyShowDialog( - body: string, - title?: string, - confirmText?: string, - cancelText?: string, - type?: SimpleDialogType - ) { - const buttons = [confirmText == null ? this.i18nService.t("ok") : confirmText]; - if (cancelText != null) { - buttons.push(cancelText); - } - - const result = await ipcRenderer.invoke("showMessageBox", { - type: electronTypeMap[type] ?? "none", - title: title, - message: title, - detail: body, - buttons: buttons, - cancelId: buttons.length === 2 ? 1 : null, - defaultId: 0, - noLink: true, - }); - - return Promise.resolve(result.response === 0); - } -} diff --git a/apps/desktop/src/vault/app/accounts/premium.component.ts b/apps/desktop/src/vault/app/accounts/premium.component.ts index fd275d6ed7..b4dff821cc 100644 --- a/apps/desktop/src/vault/app/accounts/premium.component.ts +++ b/apps/desktop/src/vault/app/accounts/premium.component.ts @@ -1,6 +1,5 @@ import { Component } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { PremiumComponent as BasePremiumComponent } from "@bitwarden/angular/vault/components/premium.component"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; @@ -8,6 +7,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-premium", @@ -20,7 +20,7 @@ export class PremiumComponent extends BasePremiumComponent { apiService: ApiService, logService: LogService, stateService: StateService, - dialogService: DialogServiceAbstraction, + dialogService: DialogService, environmentService: EnvironmentService ) { super( diff --git a/apps/desktop/src/vault/app/vault/add-edit.component.ts b/apps/desktop/src/vault/app/vault/add-edit.component.ts index aa7eba3283..8a90d6a7e1 100644 --- a/apps/desktop/src/vault/app/vault/add-edit.component.ts +++ b/apps/desktop/src/vault/app/vault/add-edit.component.ts @@ -1,7 +1,6 @@ import { Component, NgZone, OnChanges, OnDestroy, ViewChild } from "@angular/core"; import { NgForm } from "@angular/forms"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { AddEditComponent as BaseAddEditComponent } from "@bitwarden/angular/vault/components/add-edit.component"; import { AuditService } from "@bitwarden/common/abstractions/audit.service"; import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service"; @@ -18,6 +17,7 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; +import { DialogService } from "@bitwarden/components"; const BroadcasterSubscriptionId = "AddEditComponent"; @@ -45,7 +45,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnChanges, logService: LogService, organizationService: OrganizationService, sendApiService: SendApiService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cipherService, diff --git a/apps/desktop/src/vault/app/vault/attachments.component.ts b/apps/desktop/src/vault/app/vault/attachments.component.ts index edee15fc4e..bcb1704c0d 100644 --- a/apps/desktop/src/vault/app/vault/attachments.component.ts +++ b/apps/desktop/src/vault/app/vault/attachments.component.ts @@ -1,6 +1,5 @@ import { Component } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { AttachmentsComponent as BaseAttachmentsComponent } from "@bitwarden/angular/vault/components/attachments.component"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; @@ -10,6 +9,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service" import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-vault-attachments", @@ -25,7 +25,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent { logService: LogService, stateService: StateService, fileDownloadService: FileDownloadService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cipherService, diff --git a/apps/desktop/src/vault/app/vault/folder-add-edit.component.ts b/apps/desktop/src/vault/app/vault/folder-add-edit.component.ts index d9035ad741..a405544159 100644 --- a/apps/desktop/src/vault/app/vault/folder-add-edit.component.ts +++ b/apps/desktop/src/vault/app/vault/folder-add-edit.component.ts @@ -1,13 +1,13 @@ import { Component } from "@angular/core"; import { FormBuilder } from "@angular/forms"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { FolderAddEditComponent as BaseFolderAddEditComponent } from "@bitwarden/angular/vault/components/folder-add-edit.component"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { FolderApiServiceAbstraction } from "@bitwarden/common/vault/abstractions/folder/folder-api.service.abstraction"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-folder-add-edit", @@ -20,7 +20,7 @@ export class FolderAddEditComponent extends BaseFolderAddEditComponent { i18nService: I18nService, platformUtilsService: PlatformUtilsService, logService: LogService, - dialogService: DialogServiceAbstraction, + dialogService: DialogService, formBuilder: FormBuilder ) { super( diff --git a/apps/desktop/src/vault/app/vault/vault.component.ts b/apps/desktop/src/vault/app/vault/vault.component.ts index 5405a913a7..a058f08054 100644 --- a/apps/desktop/src/vault/app/vault/vault.component.ts +++ b/apps/desktop/src/vault/app/vault/vault.component.ts @@ -11,7 +11,6 @@ import { ActivatedRoute, Router } from "@angular/router"; import { first } from "rxjs/operators"; import { ModalRef } from "@bitwarden/angular/components/modal/modal.ref"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { VaultFilter } from "@bitwarden/angular/vault/vault-filter/models/vault-filter.model"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; @@ -29,6 +28,7 @@ import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-repromp import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { FolderView } from "@bitwarden/common/vault/models/view/folder.view"; +import { DialogService } from "@bitwarden/components"; import { SearchBarService } from "../../../app/layout/search/search-bar.service"; import { GeneratorComponent } from "../../../app/tools/generator.component"; @@ -102,7 +102,7 @@ export class VaultComponent implements OnInit, OnDestroy { private stateService: StateService, private searchBarService: SearchBarService, private apiService: ApiService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { @@ -684,7 +684,7 @@ export class VaultComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "unsavedChangesTitle" }, content: { key: "unsavedChangesConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); return !confirmed; } diff --git a/apps/desktop/src/vault/app/vault/view.component.ts b/apps/desktop/src/vault/app/vault/view.component.ts index 07fd92e032..b6bf63d6e6 100644 --- a/apps/desktop/src/vault/app/vault/view.component.ts +++ b/apps/desktop/src/vault/app/vault/view.component.ts @@ -7,7 +7,6 @@ import { Output, } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ViewComponent as BaseViewComponent } from "@bitwarden/angular/vault/components/view.component"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { AuditService } from "@bitwarden/common/abstractions/audit.service"; @@ -26,6 +25,7 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; +import { DialogService } from "@bitwarden/components"; const BroadcasterSubscriptionId = "ViewComponent"; @@ -55,7 +55,7 @@ export class ViewComponent extends BaseViewComponent implements OnChanges { logService: LogService, stateService: StateService, fileDownloadService: FileDownloadService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cipherService, diff --git a/apps/web/src/app/admin-console/organizations/guards/is-paid-org.guard.ts b/apps/web/src/app/admin-console/organizations/guards/is-paid-org.guard.ts index 10d39d110e..2d18ff56cf 100644 --- a/apps/web/src/app/admin-console/organizations/guards/is-paid-org.guard.ts +++ b/apps/web/src/app/admin-console/organizations/guards/is-paid-org.guard.ts @@ -1,9 +1,9 @@ import { Injectable } from "@angular/core"; import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from "@angular/router"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; +import { DialogService } from "@bitwarden/components"; @Injectable({ providedIn: "root", @@ -13,7 +13,7 @@ export class IsPaidOrgGuard implements CanActivate { private router: Router, private organizationService: OrganizationService, private messagingService: MessagingService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { @@ -31,7 +31,7 @@ export class IsPaidOrgGuard implements CanActivate { content: { key: "notAvailableForFreeOrganization" }, acceptButtonText: { key: "ok" }, cancelButtonText: null, - type: SimpleDialogType.INFO, + type: "info", }); return false; } else { diff --git a/apps/web/src/app/admin-console/organizations/manage/entity-events.component.ts b/apps/web/src/app/admin-console/organizations/manage/entity-events.component.ts index e27efc43db..afcb315e5a 100644 --- a/apps/web/src/app/admin-console/organizations/manage/entity-events.component.ts +++ b/apps/web/src/app/admin-console/organizations/manage/entity-events.component.ts @@ -3,7 +3,6 @@ import { Component, Inject, OnInit } from "@angular/core"; import { FormBuilder } from "@angular/forms"; import { UserNamePipe } from "@bitwarden/angular/pipes/user-name.pipe"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationUserService } from "@bitwarden/common/abstractions/organization-user/organization-user.service"; import { EventResponse } from "@bitwarden/common/models/response/event.response"; @@ -13,7 +12,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; -import { TableDataSource } from "@bitwarden/components"; +import { DialogService, TableDataSource } from "@bitwarden/components"; import { EventService } from "../../../core"; import { SharedModule } from "../../../shared"; @@ -186,7 +185,7 @@ export class EntityEventsComponent implements OnInit { * @param config Configuration for the dialog */ export const openEntityEventsDialog = ( - dialogService: DialogServiceAbstraction, + dialogService: DialogService, config: DialogConfig ) => { return dialogService.open(EntityEventsComponent, config); diff --git a/apps/web/src/app/admin-console/organizations/manage/group-add-edit.component.ts b/apps/web/src/app/admin-console/organizations/manage/group-add-edit.component.ts index 11b32f430b..d2f4fb1d20 100644 --- a/apps/web/src/app/admin-console/organizations/manage/group-add-edit.component.ts +++ b/apps/web/src/app/admin-console/organizations/manage/group-add-edit.component.ts @@ -3,7 +3,6 @@ import { ChangeDetectorRef, Component, Inject, OnDestroy, OnInit } from "@angula import { FormBuilder, Validators } from "@angular/forms"; import { catchError, combineLatest, from, map, of, Subject, switchMap, takeUntil } from "rxjs"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationUserService } from "@bitwarden/common/abstractions/organization-user/organization-user.service"; import { ErrorResponse } from "@bitwarden/common/models/response/error.response"; @@ -14,6 +13,7 @@ import { CollectionService } from "@bitwarden/common/vault/abstractions/collecti import { CollectionData } from "@bitwarden/common/vault/models/data/collection.data"; import { Collection } from "@bitwarden/common/vault/models/domain/collection"; import { CollectionDetailsResponse } from "@bitwarden/common/vault/models/response/collection.response"; +import { DialogService } from "@bitwarden/components"; import { InternalGroupService as GroupService, GroupView } from "../core"; import { @@ -64,7 +64,7 @@ export enum GroupAddEditDialogResultType { * @param config Configuration for the dialog */ export const openGroupAddEditDialog = ( - dialogService: DialogServiceAbstraction, + dialogService: DialogService, config: DialogConfig ) => { return dialogService.open( @@ -181,7 +181,7 @@ export class GroupAddEditComponent implements OnInit, OnDestroy { private logService: LogService, private formBuilder: FormBuilder, private changeDetectorRef: ChangeDetectorRef, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) { this.tabIndex = params.initialTab ?? GroupAddEditTabType.Info; } @@ -273,7 +273,7 @@ export class GroupAddEditComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: this.group.name, content: { key: "deleteGroupConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { return false; diff --git a/apps/web/src/app/admin-console/organizations/manage/groups.component.ts b/apps/web/src/app/admin-console/organizations/manage/groups.component.ts index 82e5acba21..f2167c0e5f 100644 --- a/apps/web/src/app/admin-console/organizations/manage/groups.component.ts +++ b/apps/web/src/app/admin-console/organizations/manage/groups.component.ts @@ -15,7 +15,6 @@ import { import { first } from "rxjs/operators"; import { SearchPipe } from "@bitwarden/angular/pipes/search.pipe"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { SearchService } from "@bitwarden/common/abstractions/search.service"; @@ -32,6 +31,7 @@ import { CollectionResponse, } from "@bitwarden/common/vault/models/response/collection.response"; import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view"; +import { DialogService } from "@bitwarden/components"; import { InternalGroupService as GroupService, GroupView } from "../core"; @@ -127,7 +127,7 @@ export class GroupsComponent implements OnInit, OnDestroy { private route: ActivatedRoute, private i18nService: I18nService, private modalService: ModalService, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private platformUtilsService: PlatformUtilsService, private searchService: SearchService, private logService: LogService, @@ -236,7 +236,7 @@ export class GroupsComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: groupRow.details.name, content: { key: "deleteGroupConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { return false; @@ -269,7 +269,7 @@ export class GroupsComponent implements OnInit, OnDestroy { placeholders: [groupsToDelete.length.toString()], }, content: deleteMessage, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { return false; diff --git a/apps/web/src/app/admin-console/organizations/members/components/bulk/bulk-enable-sm-dialog.component.ts b/apps/web/src/app/admin-console/organizations/members/components/bulk/bulk-enable-sm-dialog.component.ts index 9bb8fcbb10..b76b640513 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/bulk/bulk-enable-sm-dialog.component.ts +++ b/apps/web/src/app/admin-console/organizations/members/components/bulk/bulk-enable-sm-dialog.component.ts @@ -1,11 +1,10 @@ import { DialogRef, DIALOG_DATA } from "@angular/cdk/dialog"; import { Component, Inject, OnInit } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { OrganizationUserService } from "@bitwarden/common/abstractions/organization-user/organization-user.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; -import { TableDataSource } from "@bitwarden/components"; +import { DialogService, TableDataSource } from "@bitwarden/components"; import { OrganizationUserView } from "../../../core"; @@ -44,7 +43,7 @@ export class BulkEnableSecretsManagerDialogComponent implements OnInit { this.dialogRef.close(); }; - static open(dialogService: DialogServiceAbstraction, data: BulkEnableSecretsManagerDialogData) { + static open(dialogService: DialogService, data: BulkEnableSecretsManagerDialogData) { return dialogService.open( BulkEnableSecretsManagerDialogComponent, { data } diff --git a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts index d6c0f9ffc6..1d1a156269 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts +++ b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts @@ -3,7 +3,6 @@ import { Component, Inject, OnDestroy, OnInit } from "@angular/core"; import { FormBuilder, Validators } from "@angular/forms"; import { combineLatest, of, shareReplay, Subject, switchMap, takeUntil } from "rxjs"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { OrganizationUserService } from "@bitwarden/common/abstractions/organization-user/organization-user.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { @@ -15,6 +14,7 @@ import { Organization } from "@bitwarden/common/admin-console/models/domain/orga import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view"; +import { DialogService } from "@bitwarden/components"; import { flagEnabled } from "../../../../../../utils/flags"; import { CollectionAdminService } from "../../../../../vault/core/collection-admin.service"; @@ -134,7 +134,7 @@ export class MemberDialogComponent implements OnInit, OnDestroy { private groupService: GroupService, private userService: UserAdminService, private organizationUserService: OrganizationUserService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { @@ -389,7 +389,7 @@ export class MemberDialogComponent implements OnInit, OnDestroy { let confirmed = await this.dialogService.openSimpleDialog({ title: { key: "removeUserIdAccess", placeholders: [this.params.name] }, content: { key: message }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -426,7 +426,7 @@ export class MemberDialogComponent implements OnInit, OnDestroy { title: { key: "revokeUserId", placeholders: [this.params.name] }, content: { key: "revokeUserConfirmation" }, acceptButtonText: { key: "revokeAccess" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -496,7 +496,7 @@ export class MemberDialogComponent implements OnInit, OnDestroy { key: "removeOrgUserNoMasterPasswordDesc", placeholders: [this.params.name], }, - type: SimpleDialogType.WARNING, + type: "warning", }); } } @@ -557,7 +557,7 @@ function mapToGroupAccessSelections(groups: string[]): AccessItemValue[] { * @param config Configuration for the dialog */ export function openUserAddEditDialog( - dialogService: DialogServiceAbstraction, + dialogService: DialogService, config: DialogConfig ) { return dialogService.open(MemberDialogComponent, config); diff --git a/apps/web/src/app/admin-console/organizations/members/components/reset-password.component.ts b/apps/web/src/app/admin-console/organizations/members/components/reset-password.component.ts index 55f935c575..5d2a5f54ba 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/reset-password.component.ts +++ b/apps/web/src/app/admin-console/organizations/members/components/reset-password.component.ts @@ -10,7 +10,6 @@ import { import { Subject, takeUntil } from "rxjs"; import zxcvbn from "zxcvbn"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { PasswordStrengthComponent } from "@bitwarden/angular/shared/components/password-strength/password-strength.component"; import { OrganizationUserService } from "@bitwarden/common/abstractions/organization-user/organization-user.service"; import { OrganizationUserResetPasswordRequest } from "@bitwarden/common/abstractions/organization-user/requests"; @@ -25,6 +24,7 @@ import { Utils } from "@bitwarden/common/platform/misc/utils"; import { EncString } from "@bitwarden/common/platform/models/domain/enc-string"; import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-reset-password", @@ -54,7 +54,7 @@ export class ResetPasswordComponent implements OnInit, OnDestroy { private cryptoService: CryptoService, private logService: LogService, private organizationUserService: OrganizationUserService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { @@ -140,7 +140,7 @@ export class ResetPasswordComponent implements OnInit, OnDestroy { const result = await this.dialogService.openSimpleDialog({ title: { key: "weakMasterPassword" }, content: { key: "weakMasterPasswordDesc" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!result) { diff --git a/apps/web/src/app/admin-console/organizations/members/people.component.ts b/apps/web/src/app/admin-console/organizations/members/people.component.ts index 8c4d565c85..e696609d17 100644 --- a/apps/web/src/app/admin-console/organizations/members/people.component.ts +++ b/apps/web/src/app/admin-console/organizations/members/people.component.ts @@ -16,12 +16,6 @@ import { import { SearchPipe } from "@bitwarden/angular/pipes/search.pipe"; import { UserNamePipe } from "@bitwarden/angular/pipes/user-name.pipe"; -import { - DialogServiceAbstraction, - SimpleDialogCloseType, - SimpleDialogOptions, - SimpleDialogType, -} from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationUserService } from "@bitwarden/common/abstractions/organization-user/organization-user.service"; @@ -55,6 +49,7 @@ import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.serv import { CollectionData } from "@bitwarden/common/vault/models/data/collection.data"; import { Collection } from "@bitwarden/common/vault/models/domain/collection"; import { CollectionDetailsResponse } from "@bitwarden/common/vault/models/response/collection.response"; +import { DialogService, SimpleDialogOptions } from "@bitwarden/components"; import { flagEnabled } from "../../../../utils/flags"; import { openEntityEventsDialog } from "../../../admin-console/organizations/manage/entity-events.component"; @@ -125,7 +120,7 @@ export class PeopleComponent private organizationService: OrganizationService, private organizationApiService: OrganizationApiServiceAbstraction, private organizationUserService: OrganizationUserService, - dialogService: DialogServiceAbstraction, + dialogService: DialogService, private router: Router, private groupService: GroupService, private collectionService: CollectionService @@ -359,7 +354,7 @@ export class PeopleComponent : "freeOrgInvLimitReachedNoManageBilling", this.organization.seats ), - type: SimpleDialogType.PRIMARY, + type: "primary", }; if (this.organization.canEditSubscription) { @@ -371,12 +366,12 @@ export class PeopleComponent const simpleDialog = this.dialogService.openSimpleDialogRef(orgUpgradeSimpleDialogOpts); - firstValueFrom(simpleDialog.closed).then((result: SimpleDialogCloseType | undefined) => { + firstValueFrom(simpleDialog.closed).then((result: boolean | undefined) => { if (!result) { return; } - if (result == SimpleDialogCloseType.ACCEPT && this.organization.canEditSubscription) { + if (result && this.organization.canEditSubscription) { this.router.navigate(["/organizations", this.organization.id, "billing", "subscription"], { queryParams: { upgrade: true }, }); @@ -581,7 +576,7 @@ export class PeopleComponent placeholders: [this.userNamePipe.transform(user)], }, content: { key: content }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -600,7 +595,7 @@ export class PeopleComponent title: { key: "revokeAccess", placeholders: [this.userNamePipe.transform(user)] }, content: this.revokeWarningMessage(), acceptButtonText: { key: "revokeAccess" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -676,7 +671,7 @@ export class PeopleComponent key: "removeOrgUserNoMasterPasswordDesc", placeholders: [this.userNamePipe.transform(user)], }, - type: SimpleDialogType.WARNING, + type: "warning", }); } } diff --git a/apps/web/src/app/admin-console/organizations/settings/account.component.ts b/apps/web/src/app/admin-console/organizations/settings/account.component.ts index f8628ed1f7..8900e626a3 100644 --- a/apps/web/src/app/admin-console/organizations/settings/account.component.ts +++ b/apps/web/src/app/admin-console/organizations/settings/account.component.ts @@ -3,7 +3,6 @@ import { FormBuilder, Validators } from "@angular/forms"; import { ActivatedRoute, Router } from "@angular/router"; import { combineLatest, lastValueFrom, Subject, switchMap, takeUntil, from } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; @@ -15,6 +14,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; +import { DialogService } from "@bitwarden/components"; import { ApiKeyComponent } from "../../../settings/api-key.component"; import { PurgeVaultComponent } from "../../../settings/purge-vault.component"; @@ -75,7 +75,7 @@ export class AccountComponent { private router: Router, private organizationService: OrganizationService, private organizationApiService: OrganizationApiServiceAbstraction, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private formBuilder: FormBuilder ) {} diff --git a/apps/web/src/app/admin-console/organizations/settings/components/delete-organization-dialog.component.ts b/apps/web/src/app/admin-console/organizations/settings/components/delete-organization-dialog.component.ts index f52115c268..389514d35f 100644 --- a/apps/web/src/app/admin-console/organizations/settings/components/delete-organization-dialog.component.ts +++ b/apps/web/src/app/admin-console/organizations/settings/components/delete-organization-dialog.component.ts @@ -3,7 +3,6 @@ import { Component, Inject, OnDestroy, OnInit } from "@angular/core"; import { FormBuilder, FormControl, Validators } from "@angular/forms"; import { combineLatest, Subject, takeUntil } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; @@ -15,6 +14,7 @@ import { Verification } from "@bitwarden/common/types/verification"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; +import { DialogService } from "@bitwarden/components"; import { UserVerificationModule } from "../../../../auth/shared/components/user-verification"; import { SharedModule } from "../../../../shared/shared.module"; @@ -168,7 +168,7 @@ export class DeleteOrganizationDialogComponent implements OnInit, OnDestroy { * @param config Configuration for the dialog */ export function openDeleteOrganizationDialog( - dialogService: DialogServiceAbstraction, + dialogService: DialogService, config: DialogConfig ) { return dialogService.open( diff --git a/apps/web/src/app/admin-console/organizations/sponsorships/families-for-enterprise-setup.component.ts b/apps/web/src/app/admin-console/organizations/sponsorships/families-for-enterprise-setup.component.ts index e7e81431cb..c3a687a7f9 100644 --- a/apps/web/src/app/admin-console/organizations/sponsorships/families-for-enterprise-setup.component.ts +++ b/apps/web/src/app/admin-console/organizations/sponsorships/families-for-enterprise-setup.component.ts @@ -3,7 +3,6 @@ import { ActivatedRoute, Router } from "@angular/router"; import { lastValueFrom, Observable, Subject } from "rxjs"; import { first, map, takeUntil } from "rxjs/operators"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; @@ -14,6 +13,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; +import { DialogService } from "@bitwarden/components"; import { OrganizationPlansComponent } from "../../../billing/settings/organization-plans.component"; import { @@ -62,7 +62,7 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit, OnDestroy { private syncService: SyncService, private validationService: ValidationService, private organizationService: OrganizationService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { diff --git a/apps/web/src/app/admin-console/organizations/tools/import-export/org-export.component.ts b/apps/web/src/app/admin-console/organizations/tools/import-export/org-export.component.ts index 35d445cb41..9ea1442fd1 100644 --- a/apps/web/src/app/admin-console/organizations/tools/import-export/org-export.component.ts +++ b/apps/web/src/app/admin-console/organizations/tools/import-export/org-export.component.ts @@ -2,7 +2,6 @@ import { Component } from "@angular/core"; import { UntypedFormBuilder } from "@angular/forms"; import { ActivatedRoute } from "@angular/router"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; @@ -12,6 +11,7 @@ import { FileDownloadService } from "@bitwarden/common/platform/abstractions/fil import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { VaultExportServiceAbstraction } from "@bitwarden/exporter/vault-export"; import { ExportComponent } from "../../../../tools/import-export/export.component"; @@ -34,7 +34,7 @@ export class OrganizationExportComponent extends ExportComponent { userVerificationService: UserVerificationService, formBuilder: UntypedFormBuilder, fileDownloadService: FileDownloadService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cryptoService, diff --git a/apps/web/src/app/admin-console/organizations/tools/import-export/org-import.component.ts b/apps/web/src/app/admin-console/organizations/tools/import-export/org-import.component.ts index 3e1067a1da..3c9b5858e0 100644 --- a/apps/web/src/app/admin-console/organizations/tools/import-export/org-import.component.ts +++ b/apps/web/src/app/admin-console/organizations/tools/import-export/org-import.component.ts @@ -3,7 +3,6 @@ import { FormBuilder } from "@angular/forms"; import { ActivatedRoute, Router } from "@angular/router"; import { switchMap, takeUntil } from "rxjs/operators"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { canAccessVaultTab, @@ -17,6 +16,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; +import { DialogService } from "@bitwarden/components"; import { ImportServiceAbstraction } from "@bitwarden/importer"; import { ImportComponent } from "../../../../tools/import-export/import.component"; @@ -44,7 +44,7 @@ export class OrganizationImportComponent extends ImportComponent { logService: LogService, modalService: ModalService, syncService: SyncService, - dialogService: DialogServiceAbstraction, + dialogService: DialogService, folderService: FolderService, collectionService: CollectionService, formBuilder: FormBuilder @@ -91,7 +91,7 @@ export class OrganizationImportComponent extends ImportComponent { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "warning" }, content: { key: "importWarning", placeholders: [this.organization.name] }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/apps/web/src/app/admin-console/settings/sponsoring-org-row.component.ts b/apps/web/src/app/admin-console/settings/sponsoring-org-row.component.ts index aa1bcf0b4f..715fc6eba0 100644 --- a/apps/web/src/app/admin-console/settings/sponsoring-org-row.component.ts +++ b/apps/web/src/app/admin-console/settings/sponsoring-org-row.component.ts @@ -2,12 +2,12 @@ import { formatDate } from "@angular/common"; import { Component, EventEmitter, Input, Output, OnInit } from "@angular/core"; import { firstValueFrom } from "rxjs"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "[sponsoring-org-row]", @@ -32,7 +32,7 @@ export class SponsoringOrgRowComponent implements OnInit { private i18nService: I18nService, private logService: LogService, private platformUtilsService: PlatformUtilsService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { @@ -73,7 +73,7 @@ export class SponsoringOrgRowComponent implements OnInit { title: `${this.i18nService.t("remove")} ${this.sponsoringOrg.familySponsorshipFriendlyName}?`, content: { key: "revokeSponsorshipConfirmation" }, acceptButtonText: { key: "remove" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/apps/web/src/app/app.component.ts b/apps/web/src/app/app.component.ts index 9a22ea20b4..8ce51df9e6 100644 --- a/apps/web/src/app/app.component.ts +++ b/apps/web/src/app/app.component.ts @@ -7,7 +7,6 @@ import { IndividualConfig, ToastrService } from "ngx-toastr"; import { Subject, takeUntil } from "rxjs"; import Swal from "sweetalert2"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { EventUploadService } from "@bitwarden/common/abstractions/event/event-upload.service"; import { NotificationsService } from "@bitwarden/common/abstractions/notifications.service"; import { SearchService } from "@bitwarden/common/abstractions/search.service"; @@ -27,6 +26,7 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service"; import { InternalFolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; +import { DialogService } from "@bitwarden/components"; import { PolicyListService } from "./admin-console/core/policy-list.service"; import { @@ -82,7 +82,7 @@ export class AppComponent implements OnDestroy, OnInit { protected policyListService: PolicyListService, private keyConnectorService: KeyConnectorService, private configService: ConfigServiceAbstraction, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} ngOnInit() { @@ -145,7 +145,7 @@ export class AppComponent implements OnDestroy, OnInit { title: { key: "upgradeOrganization" }, content: { key: "upgradeOrganizationDesc" }, acceptButtonText: { key: "upgradeOrganization" }, - type: SimpleDialogType.INFO, + type: "info", }); if (upgradeConfirmed) { this.router.navigate([ @@ -162,7 +162,7 @@ export class AppComponent implements OnDestroy, OnInit { title: { key: "premiumRequired" }, content: { key: "premiumRequiredDesc" }, acceptButtonText: { key: "upgrade" }, - type: SimpleDialogType.SUCCESS, + type: "success", }); if (premiumConfirmed) { this.router.navigate(["settings/subscription/premium"]); @@ -174,7 +174,7 @@ export class AppComponent implements OnDestroy, OnInit { title: { key: "emailVerificationRequired" }, content: { key: "emailVerificationRequiredDesc" }, acceptButtonText: { key: "learnMore" }, - type: SimpleDialogType.INFO, + type: "info", }); if (emailVerificationConfirmed) { this.platformUtilsService.launchUri( diff --git a/apps/web/src/app/auth/lock.component.ts b/apps/web/src/app/auth/lock.component.ts index 789ebc1695..185ce241d4 100644 --- a/apps/web/src/app/auth/lock.component.ts +++ b/apps/web/src/app/auth/lock.component.ts @@ -2,7 +2,6 @@ import { Component, NgZone } from "@angular/core"; import { Router } from "@angular/router"; import { LockComponent as BaseLockComponent } from "@bitwarden/angular/auth/components/lock.component"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { VaultTimeoutService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeout.service"; import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeoutSettings.service"; @@ -17,6 +16,7 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength"; +import { DialogService } from "@bitwarden/components"; import { RouterService } from "../core"; @@ -43,7 +43,7 @@ export class LockComponent extends BaseLockComponent { policyApiService: PolicyApiServiceAbstraction, policyService: InternalPolicyService, passwordStrengthService: PasswordStrengthServiceAbstraction, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( router, diff --git a/apps/web/src/app/auth/register-form/register-form.component.ts b/apps/web/src/app/auth/register-form/register-form.component.ts index 887f556248..0a494ec333 100644 --- a/apps/web/src/app/auth/register-form/register-form.component.ts +++ b/apps/web/src/app/auth/register-form/register-form.component.ts @@ -4,7 +4,6 @@ import { Router } from "@angular/router"; import { RegisterComponent as BaseRegisterComponent } from "@bitwarden/angular/components/register.component"; import { FormValidationErrorsService } from "@bitwarden/angular/platform/abstractions/form-validation-errors.service"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { AuditService } from "@bitwarden/common/abstractions/audit.service"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; @@ -18,6 +17,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service" import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-register-form", @@ -46,7 +46,7 @@ export class RegisterFormComponent extends BaseRegisterComponent { environmentService: EnvironmentService, logService: LogService, auditService: AuditService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( formValidationErrorService, diff --git a/apps/web/src/app/auth/set-password.component.ts b/apps/web/src/app/auth/set-password.component.ts index fcce84a9c2..49320ced5d 100644 --- a/apps/web/src/app/auth/set-password.component.ts +++ b/apps/web/src/app/auth/set-password.component.ts @@ -2,7 +2,6 @@ import { Component } from "@angular/core"; import { ActivatedRoute, Router } from "@angular/router"; import { SetPasswordComponent as BaseSetPasswordComponent } from "@bitwarden/angular/components/set-password.component"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationUserService } from "@bitwarden/common/abstractions/organization-user/organization-user.service"; import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction"; @@ -15,6 +14,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-set-password", @@ -36,7 +36,7 @@ export class SetPasswordComponent extends BaseSetPasswordComponent { stateService: StateService, organizationApiService: OrganizationApiServiceAbstraction, organizationUserService: OrganizationUserService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( i18nService, diff --git a/apps/web/src/app/auth/settings/emergency-access/emergency-access-attachments.component.ts b/apps/web/src/app/auth/settings/emergency-access/emergency-access-attachments.component.ts index a62f56bbc6..77ed083e57 100644 --- a/apps/web/src/app/auth/settings/emergency-access/emergency-access-attachments.component.ts +++ b/apps/web/src/app/auth/settings/emergency-access/emergency-access-attachments.component.ts @@ -1,6 +1,5 @@ import { Component } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { AttachmentsComponent as BaseAttachmentsComponent } from "@bitwarden/angular/vault/components/attachments.component"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; @@ -11,6 +10,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "emergency-access-attachments", @@ -29,7 +29,7 @@ export class EmergencyAccessAttachmentsComponent extends BaseAttachmentsComponen apiService: ApiService, logService: LogService, fileDownloadService: FileDownloadService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cipherService, diff --git a/apps/web/src/app/auth/settings/emergency-access/emergency-access-takeover.component.ts b/apps/web/src/app/auth/settings/emergency-access/emergency-access-takeover.component.ts index 026529dc11..fec3488e31 100644 --- a/apps/web/src/app/auth/settings/emergency-access/emergency-access-takeover.component.ts +++ b/apps/web/src/app/auth/settings/emergency-access/emergency-access-takeover.component.ts @@ -2,7 +2,6 @@ import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from "@angu import { takeUntil } from "rxjs"; import { ChangePasswordComponent } from "@bitwarden/angular/auth/components/change-password.component"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { PolicyData } from "@bitwarden/common/admin-console/models/data/policy.data"; @@ -19,6 +18,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "emergency-access-takeover", @@ -48,7 +48,7 @@ export class EmergencyAccessTakeoverComponent policyService: PolicyService, private apiService: ApiService, private logService: LogService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( i18nService, diff --git a/apps/web/src/app/auth/settings/emergency-access/emergency-access.component.ts b/apps/web/src/app/auth/settings/emergency-access/emergency-access.component.ts index fd1158ed47..6e0e9b0502 100644 --- a/apps/web/src/app/auth/settings/emergency-access/emergency-access.component.ts +++ b/apps/web/src/app/auth/settings/emergency-access/emergency-access.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit, ViewChild, ViewContainerRef } from "@angular/core"; import { UserNamePipe } from "@bitwarden/angular/pipes/user-name.pipe"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; @@ -19,6 +18,7 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; +import { DialogService } from "@bitwarden/components"; import { EmergencyAccessAddEditComponent } from "./emergency-access-add-edit.component"; import { EmergencyAccessConfirmComponent } from "./emergency-access-confirm.component"; @@ -56,7 +56,7 @@ export class EmergencyAccessComponent implements OnInit { private logService: LogService, private stateService: StateService, private organizationService: OrganizationService, - protected dialogService: DialogServiceAbstraction + protected dialogService: DialogService ) {} async ngOnInit() { @@ -174,7 +174,7 @@ export class EmergencyAccessComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: this.userNamePipe.transform(details), content: { key: "removeUserConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -207,7 +207,7 @@ export class EmergencyAccessComponent implements OnInit { placeholders: [details.waitTimeDays.toString()], }, acceptButtonText: { key: "requestAccess" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -236,7 +236,7 @@ export class EmergencyAccessComponent implements OnInit { placeholders: [this.userNamePipe.transform(details), type], }, acceptButtonText: { key: "approve" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/apps/web/src/app/auth/settings/emergency-access/emergency-add-edit.component.ts b/apps/web/src/app/auth/settings/emergency-access/emergency-add-edit.component.ts index 8c3269fbdb..925ebbf3ea 100644 --- a/apps/web/src/app/auth/settings/emergency-access/emergency-add-edit.component.ts +++ b/apps/web/src/app/auth/settings/emergency-access/emergency-add-edit.component.ts @@ -1,6 +1,5 @@ import { Component } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { AuditService } from "@bitwarden/common/abstractions/audit.service"; import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service"; import { TotpService } from "@bitwarden/common/abstractions/totp.service"; @@ -18,6 +17,7 @@ import { CollectionService } from "@bitwarden/common/vault/abstractions/collecti import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; +import { DialogService } from "@bitwarden/components"; import { AddEditComponent as BaseAddEditComponent } from "../../../vault/individual-vault/add-edit.component"; @@ -47,7 +47,7 @@ export class EmergencyAddEditComponent extends BaseAddEditComponent { organizationService: OrganizationService, logService: LogService, sendApiService: SendApiService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cipherService, diff --git a/apps/web/src/app/auth/settings/two-factor-authenticator.component.ts b/apps/web/src/app/auth/settings/two-factor-authenticator.component.ts index 29cc6df156..1687f366ff 100644 --- a/apps/web/src/app/auth/settings/two-factor-authenticator.component.ts +++ b/apps/web/src/app/auth/settings/two-factor-authenticator.component.ts @@ -1,6 +1,5 @@ import { Component, OnDestroy, OnInit } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type"; @@ -12,6 +11,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service" import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; +import { DialogService } from "@bitwarden/components"; import { TwoFactorBaseComponent } from "./two-factor-base.component"; @@ -52,7 +52,7 @@ export class TwoFactorAuthenticatorComponent platformUtilsService: PlatformUtilsService, logService: LogService, private stateService: StateService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( apiService, diff --git a/apps/web/src/app/auth/settings/two-factor-base.component.ts b/apps/web/src/app/auth/settings/two-factor-base.component.ts index d60da177a5..24178a676c 100644 --- a/apps/web/src/app/auth/settings/two-factor-base.component.ts +++ b/apps/web/src/app/auth/settings/two-factor-base.component.ts @@ -1,6 +1,5 @@ import { Directive, EventEmitter, Output } from "@angular/core"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type"; @@ -11,6 +10,7 @@ import { AuthResponseBase } from "@bitwarden/common/auth/types/auth-response"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; @Directive() export abstract class TwoFactorBaseComponent { @@ -32,7 +32,7 @@ export abstract class TwoFactorBaseComponent { protected platformUtilsService: PlatformUtilsService, protected logService: LogService, protected userVerificationService: UserVerificationService, - protected dialogService: DialogServiceAbstraction + protected dialogService: DialogService ) {} protected auth(authResponse: AuthResponseBase) { @@ -54,7 +54,7 @@ export abstract class TwoFactorBaseComponent { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "disable" }, content: { key: "twoStepDisableDesc" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/apps/web/src/app/auth/settings/two-factor-duo.component.ts b/apps/web/src/app/auth/settings/two-factor-duo.component.ts index 354f58f7f2..45ec065e08 100644 --- a/apps/web/src/app/auth/settings/two-factor-duo.component.ts +++ b/apps/web/src/app/auth/settings/two-factor-duo.component.ts @@ -1,6 +1,5 @@ import { Component } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type"; @@ -10,6 +9,7 @@ import { AuthResponse } from "@bitwarden/common/auth/types/auth-response"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { TwoFactorBaseComponent } from "./two-factor-base.component"; @@ -32,7 +32,7 @@ export class TwoFactorDuoComponent extends TwoFactorBaseComponent { platformUtilsService: PlatformUtilsService, logService: LogService, userVerificationService: UserVerificationService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( apiService, diff --git a/apps/web/src/app/auth/settings/two-factor-email.component.ts b/apps/web/src/app/auth/settings/two-factor-email.component.ts index 8a7976a19e..1ca6d31b46 100644 --- a/apps/web/src/app/auth/settings/two-factor-email.component.ts +++ b/apps/web/src/app/auth/settings/two-factor-email.component.ts @@ -1,6 +1,5 @@ import { Component } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type"; @@ -12,6 +11,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; +import { DialogService } from "@bitwarden/components"; import { TwoFactorBaseComponent } from "./two-factor-base.component"; @@ -36,7 +36,7 @@ export class TwoFactorEmailComponent extends TwoFactorBaseComponent { logService: LogService, userVerificationService: UserVerificationService, private stateService: StateService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( apiService, diff --git a/apps/web/src/app/auth/settings/two-factor-webauthn.component.ts b/apps/web/src/app/auth/settings/two-factor-webauthn.component.ts index d528e81a8c..4a9f7ceba3 100644 --- a/apps/web/src/app/auth/settings/two-factor-webauthn.component.ts +++ b/apps/web/src/app/auth/settings/two-factor-webauthn.component.ts @@ -1,6 +1,5 @@ import { Component, NgZone } from "@angular/core"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type"; @@ -15,6 +14,7 @@ import { AuthResponse } from "@bitwarden/common/auth/types/auth-response"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { TwoFactorBaseComponent } from "./two-factor-base.component"; @@ -51,7 +51,7 @@ export class TwoFactorWebAuthnComponent extends TwoFactorBaseComponent { private ngZone: NgZone, logService: LogService, userVerificationService: UserVerificationService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( apiService, @@ -98,7 +98,7 @@ export class TwoFactorWebAuthnComponent extends TwoFactorBaseComponent { const confirmed = await this.dialogService.openSimpleDialog({ title: name, content: { key: "removeU2fConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/apps/web/src/app/auth/settings/two-factor-yubikey.component.ts b/apps/web/src/app/auth/settings/two-factor-yubikey.component.ts index b9d2bd69f8..32e9da7c95 100644 --- a/apps/web/src/app/auth/settings/two-factor-yubikey.component.ts +++ b/apps/web/src/app/auth/settings/two-factor-yubikey.component.ts @@ -1,6 +1,5 @@ import { Component } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type"; @@ -10,6 +9,7 @@ import { AuthResponse } from "@bitwarden/common/auth/types/auth-response"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { TwoFactorBaseComponent } from "./two-factor-base.component"; @@ -38,7 +38,7 @@ export class TwoFactorYubiKeyComponent extends TwoFactorBaseComponent { platformUtilsService: PlatformUtilsService, logService: LogService, userVerificationService: UserVerificationService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( apiService, diff --git a/apps/web/src/app/auth/shared/components/user-verification/user-verification-prompt.component.ts b/apps/web/src/app/auth/shared/components/user-verification/user-verification-prompt.component.ts index 2abacd3e8a..1766741617 100644 --- a/apps/web/src/app/auth/shared/components/user-verification/user-verification-prompt.component.ts +++ b/apps/web/src/app/auth/shared/components/user-verification/user-verification-prompt.component.ts @@ -3,11 +3,11 @@ import { Component, Inject } from "@angular/core"; import { FormBuilder } from "@angular/forms"; import { UserVerificationPromptComponent as BaseUserVerificationPrompt } from "@bitwarden/angular/auth/components/user-verification-prompt.component"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ModalConfig } from "@bitwarden/angular/services/modal.service"; import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; export interface UserVerificationPromptParams { confirmDescription: string; @@ -50,7 +50,7 @@ export class UserVerificationPromptComponent extends BaseUserVerificationPrompt * @param config Configuration for the dialog */ export const openUserVerificationPrompt = ( - dialogService: DialogServiceAbstraction, + dialogService: DialogService, config: DialogConfig ) => { return dialogService.open( diff --git a/apps/web/src/app/auth/update-password.component.ts b/apps/web/src/app/auth/update-password.component.ts index 6c8e81fb4b..d4e1e360e9 100644 --- a/apps/web/src/app/auth/update-password.component.ts +++ b/apps/web/src/app/auth/update-password.component.ts @@ -2,7 +2,6 @@ import { Component } from "@angular/core"; import { Router } from "@angular/router"; import { UpdatePasswordComponent as BaseUpdatePasswordComponent } from "@bitwarden/angular/auth/components/update-password.component"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; @@ -13,6 +12,7 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-update-password", @@ -31,7 +31,7 @@ export class UpdatePasswordComponent extends BaseUpdatePasswordComponent { logService: LogService, stateService: StateService, userVerificationService: UserVerificationService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( router, diff --git a/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts b/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts index f03fb72faf..82da9bda1f 100644 --- a/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts +++ b/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts @@ -3,7 +3,6 @@ import { Component, OnDestroy, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { concatMap, Subject, takeUntil } from "rxjs"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ModalConfig, ModalService } from "@bitwarden/angular/services/modal.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction"; @@ -19,6 +18,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; +import { DialogService } from "@bitwarden/components"; import { BillingSyncApiKeyComponent, @@ -61,7 +61,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy private organizationService: OrganizationService, private organizationApiService: OrganizationApiServiceAbstraction, private route: ActivatedRoute, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private configService: ConfigServiceAbstraction, private datePipe: DatePipe ) {} @@ -279,7 +279,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "cancelSubscription" }, content: { key: "cancelConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -307,7 +307,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "reinstateSubscription" }, content: { key: "reinstateConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -379,7 +379,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy title: { key: "removeSponsorship" }, content: { key: "removeSponsorshipConfirmation" }, acceptButtonText: { key: "remove" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/apps/web/src/app/billing/settings/payment-method.component.ts b/apps/web/src/app/billing/settings/payment-method.component.ts index 4792e0fb71..a550926262 100644 --- a/apps/web/src/app/billing/settings/payment-method.component.ts +++ b/apps/web/src/app/billing/settings/payment-method.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit, ViewChild } from "@angular/core"; import { FormBuilder, FormControl, Validators } from "@angular/forms"; import { ActivatedRoute, Router } from "@angular/router"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction"; import { OrganizationResponse } from "@bitwarden/common/admin-console/models/response/organization.response"; @@ -12,6 +11,7 @@ import { VerifyBankRequest } from "@bitwarden/common/models/request/verify-bank. import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { TaxInfoComponent } from "./tax-info.component"; @@ -57,7 +57,7 @@ export class PaymentMethodComponent implements OnInit { private logService: LogService, private route: ActivatedRoute, private formBuilder: FormBuilder, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { @@ -100,7 +100,7 @@ export class PaymentMethodComponent implements OnInit { content: { key: "cannotPerformInAppPurchase" }, acceptButtonText: { key: "ok" }, cancelButtonText: null, - type: SimpleDialogType.WARNING, + type: "warning", }); return; @@ -122,7 +122,7 @@ export class PaymentMethodComponent implements OnInit { content: { key: "cannotPerformInAppPurchase" }, acceptButtonText: { key: "ok" }, cancelButtonText: null, - type: SimpleDialogType.WARNING, + type: "warning", }); return; diff --git a/apps/web/src/app/billing/settings/user-subscription.component.ts b/apps/web/src/app/billing/settings/user-subscription.component.ts index 278c39d22f..d058f7f105 100644 --- a/apps/web/src/app/billing/settings/user-subscription.component.ts +++ b/apps/web/src/app/billing/settings/user-subscription.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from "@angular/core"; import { Router } from "@angular/router"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { SubscriptionResponse } from "@bitwarden/common/billing/models/response/subscription.response"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; @@ -10,6 +9,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-user-subscription", @@ -36,7 +36,7 @@ export class UserSubscriptionComponent implements OnInit { private router: Router, private logService: LogService, private fileDownloadService: FileDownloadService, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private environmentService: EnvironmentService ) { this.selfHosted = platformUtilsService.isSelfHost(); @@ -75,7 +75,7 @@ export class UserSubscriptionComponent implements OnInit { content: { key: "manageSubscriptionFromStore" }, acceptButtonText: { key: "ok" }, cancelButtonText: null, - type: SimpleDialogType.WARNING, + type: "warning", }); return; @@ -84,7 +84,7 @@ export class UserSubscriptionComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "reinstateSubscription" }, content: { key: "reinstateConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -112,7 +112,7 @@ export class UserSubscriptionComponent implements OnInit { content: { key: "manageSubscriptionFromStore" }, acceptButtonText: { key: "ok" }, cancelButtonText: null, - type: SimpleDialogType.WARNING, + type: "warning", }); return; @@ -121,7 +121,7 @@ export class UserSubscriptionComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "cancelSubscription" }, content: { key: "cancelConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -175,7 +175,7 @@ export class UserSubscriptionComponent implements OnInit { content: { key: "cannotPerformInAppPurchase" }, acceptButtonText: { key: "ok" }, cancelButtonText: null, - type: SimpleDialogType.WARNING, + type: "warning", }); return; diff --git a/apps/web/src/app/common/base.people.component.ts b/apps/web/src/app/common/base.people.component.ts index e14706c2e9..d4093ad28b 100644 --- a/apps/web/src/app/common/base.people.component.ts +++ b/apps/web/src/app/common/base.people.component.ts @@ -2,7 +2,6 @@ import { Directive, ViewChild, ViewContainerRef } from "@angular/core"; import { SearchPipe } from "@bitwarden/angular/pipes/search.pipe"; import { UserNamePipe } from "@bitwarden/angular/pipes/user-name.pipe"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { SearchService } from "@bitwarden/common/abstractions/search.service"; @@ -21,6 +20,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; +import { DialogService } from "@bitwarden/components"; import { OrganizationUserView } from "../admin-console/organizations/core/views/organization-user.view"; import { UserConfirmComponent } from "../admin-console/organizations/manage/user-confirm.component"; @@ -110,7 +110,7 @@ export abstract class BasePeopleComponent< private searchPipe: SearchPipe, protected userNamePipe: UserNamePipe, protected stateService: StateService, - protected dialogService: DialogServiceAbstraction + protected dialogService: DialogService ) {} abstract edit(user: UserType): void; @@ -222,7 +222,7 @@ export abstract class BasePeopleComponent< return this.dialogService.openSimpleDialog({ title: this.userNamePipe.transform(user), content: { key: "removeUserConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); } @@ -252,7 +252,7 @@ export abstract class BasePeopleComponent< title: { key: "revokeAccess", placeholders: [this.userNamePipe.transform(user)] }, content: this.revokeWarningMessage(), acceptButtonText: { key: "revokeAccess" }, - type: SimpleDialogType.WARNING, + type: "warning", }); } diff --git a/apps/web/src/app/settings/change-kdf/change-kdf.component.ts b/apps/web/src/app/settings/change-kdf/change-kdf.component.ts index d0acf2c1d5..3da4c5ea1d 100644 --- a/apps/web/src/app/settings/change-kdf/change-kdf.component.ts +++ b/apps/web/src/app/settings/change-kdf/change-kdf.component.ts @@ -1,6 +1,5 @@ import { Component, OnInit } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { KdfConfig } from "@bitwarden/common/auth/models/domain/kdf-config"; import { DEFAULT_KDF_CONFIG, @@ -11,6 +10,7 @@ import { KdfType, } from "@bitwarden/common/enums"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; +import { DialogService } from "@bitwarden/components"; import { ChangeKdfConfirmationComponent } from "./change-kdf-confirmation.component"; @@ -25,7 +25,7 @@ export class ChangeKdfComponent implements OnInit { kdfOptions: any[] = []; recommendedPbkdf2Iterations = DEFAULT_PBKDF2_ITERATIONS; - constructor(private stateService: StateService, private dialogService: DialogServiceAbstraction) { + constructor(private stateService: StateService, private dialogService: DialogService) { this.kdfOptions = [ { name: "PBKDF2 SHA-256", value: KdfType.PBKDF2_SHA256 }, { name: "Argon2id", value: KdfType.Argon2id }, diff --git a/apps/web/src/app/settings/change-password.component.ts b/apps/web/src/app/settings/change-password.component.ts index 4b6d5d5af4..83a13cbfff 100644 --- a/apps/web/src/app/settings/change-password.component.ts +++ b/apps/web/src/app/settings/change-password.component.ts @@ -3,7 +3,6 @@ import { Router } from "@angular/router"; import { firstValueFrom } from "rxjs"; import { ChangePasswordComponent as BaseChangePasswordComponent } from "@bitwarden/angular/auth/components/change-password.component"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { AuditService } from "@bitwarden/common/abstractions/audit.service"; import { OrganizationUserService } from "@bitwarden/common/abstractions/organization-user/organization-user.service"; @@ -32,6 +31,7 @@ import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folde import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherWithIdRequest } from "@bitwarden/common/vault/models/request/cipher-with-id.request"; import { FolderWithIdRequest } from "@bitwarden/common/vault/models/request/folder-with-id.request"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-change-password", @@ -63,7 +63,7 @@ export class ChangePasswordComponent extends BaseChangePasswordComponent { private router: Router, private organizationApiService: OrganizationApiServiceAbstraction, private organizationUserService: OrganizationUserService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( i18nService, @@ -107,7 +107,7 @@ export class ChangePasswordComponent extends BaseChangePasswordComponent { content: { key: "oldAttachmentsNeedFixDesc" }, acceptButtonText: { key: "learnMore" }, cancelButtonText: { key: "close" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (learnMore) { @@ -127,7 +127,7 @@ export class ChangePasswordComponent extends BaseChangePasswordComponent { this.i18nService.t("updateEncryptionKeyExportWarning") + " " + this.i18nService.t("rotateEncKeyConfirmation"), - type: SimpleDialogType.WARNING, + type: "warning", }); if (!result) { diff --git a/apps/web/src/app/settings/preferences.component.ts b/apps/web/src/app/settings/preferences.component.ts index 7a9b3c9a1c..973aed0f5f 100644 --- a/apps/web/src/app/settings/preferences.component.ts +++ b/apps/web/src/app/settings/preferences.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from "@angular/core"; import { FormBuilder } from "@angular/forms"; import { concatMap, filter, map, Observable, Subject, takeUntil, tap } from "rxjs"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { AbstractThemingService } from "@bitwarden/angular/services/theming/theming.service.abstraction"; import { SettingsService } from "@bitwarden/common/abstractions/settings.service"; import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeoutSettings.service"; @@ -15,6 +14,7 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-preferences", @@ -55,7 +55,7 @@ export class PreferencesComponent implements OnInit { private messagingService: MessagingService, private themingService: AbstractThemingService, private settingsService: SettingsService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) { this.vaultTimeoutOptions = [ { name: i18nService.t("oneMinute"), value: 1 }, @@ -117,7 +117,7 @@ export class PreferencesComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "vaultTimeoutLogOutConfirmationTitle" }, content: { key: "vaultTimeoutLogOutConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/apps/web/src/app/tools/generator.component.ts b/apps/web/src/app/tools/generator.component.ts index 425f5cca2f..05c56141dc 100644 --- a/apps/web/src/app/tools/generator.component.ts +++ b/apps/web/src/app/tools/generator.component.ts @@ -1,7 +1,6 @@ import { Component } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { GeneratorComponent as BaseGeneratorComponent } from "@bitwarden/angular/tools/generator/components/generator.component"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; @@ -9,6 +8,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username"; +import { DialogService } from "@bitwarden/components"; import { PasswordGeneratorHistoryComponent } from "./password-generator-history.component"; @@ -25,7 +25,7 @@ export class GeneratorComponent extends BaseGeneratorComponent { i18nService: I18nService, logService: LogService, route: ActivatedRoute, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) { super( passwordGenerationService, diff --git a/apps/web/src/app/tools/import-export/export.component.ts b/apps/web/src/app/tools/import-export/export.component.ts index 9d57f83f2a..b4c2038421 100644 --- a/apps/web/src/app/tools/import-export/export.component.ts +++ b/apps/web/src/app/tools/import-export/export.component.ts @@ -2,7 +2,6 @@ import { Component } from "@angular/core"; import { UntypedFormBuilder } from "@angular/forms"; import { firstValueFrom } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/tools/export/components/export.component"; import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; @@ -13,6 +12,7 @@ import { FileDownloadService } from "@bitwarden/common/platform/abstractions/fil import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { VaultExportServiceAbstraction } from "@bitwarden/exporter/vault-export"; import { openUserVerificationPrompt } from "../../auth/shared/components/user-verification"; @@ -37,7 +37,7 @@ export class ExportComponent extends BaseExportComponent { userVerificationService: UserVerificationService, formBuilder: UntypedFormBuilder, fileDownloadService: FileDownloadService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cryptoService, diff --git a/apps/web/src/app/tools/import-export/import.component.ts b/apps/web/src/app/tools/import-export/import.component.ts index cba1afdba6..58f30b4ee4 100644 --- a/apps/web/src/app/tools/import-export/import.component.ts +++ b/apps/web/src/app/tools/import-export/import.component.ts @@ -6,7 +6,6 @@ import { concat, Observable, Subject, lastValueFrom, combineLatest } from "rxjs" import { map, takeUntil } from "rxjs/operators"; import Swal, { SweetAlertIcon } from "sweetalert2"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { canAccessImportExport, @@ -24,6 +23,7 @@ import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folde import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view"; import { FolderView } from "@bitwarden/common/vault/models/view/folder.view"; +import { DialogService } from "@bitwarden/components"; import { ImportOption, ImportResult, @@ -75,7 +75,7 @@ export class ImportComponent implements OnInit, OnDestroy { private logService: LogService, protected modalService: ModalService, protected syncService: SyncService, - protected dialogService: DialogServiceAbstraction, + protected dialogService: DialogService, protected folderService: FolderService, protected collectionService: CollectionService, protected organizationService: OrganizationService, diff --git a/apps/web/src/app/tools/send/add-edit.component.ts b/apps/web/src/app/tools/send/add-edit.component.ts index c7ab4542bc..cb3e2543e2 100644 --- a/apps/web/src/app/tools/send/add-edit.component.ts +++ b/apps/web/src/app/tools/send/add-edit.component.ts @@ -1,7 +1,6 @@ import { DatePipe } from "@angular/common"; import { Component } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { AddEditComponent as BaseAddEditComponent } from "@bitwarden/angular/tools/send/add-edit.component"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; @@ -12,6 +11,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction"; import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-send-add-edit", @@ -31,7 +31,7 @@ export class AddEditComponent extends BaseAddEditComponent { policyService: PolicyService, logService: LogService, sendApiService: SendApiService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( i18nService, diff --git a/apps/web/src/app/tools/send/send.component.ts b/apps/web/src/app/tools/send/send.component.ts index 157b64da59..c5ac37e531 100644 --- a/apps/web/src/app/tools/send/send.component.ts +++ b/apps/web/src/app/tools/send/send.component.ts @@ -1,6 +1,5 @@ import { Component, NgZone, ViewChild, ViewContainerRef } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { SendComponent as BaseSendComponent } from "@bitwarden/angular/tools/send/send.component"; import { SearchService } from "@bitwarden/common/abstractions/search.service"; @@ -13,7 +12,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { SendView } from "@bitwarden/common/tools/send/models/view/send.view"; import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction"; import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction"; -import { NoItemsModule, SearchModule, TableDataSource } from "@bitwarden/components"; +import { DialogService, NoItemsModule, SearchModule, TableDataSource } from "@bitwarden/components"; import { SharedModule } from "../../shared"; @@ -56,7 +55,7 @@ export class SendComponent extends BaseSendComponent { private broadcasterService: BroadcasterService, logService: LogService, sendApiService: SendApiService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( sendService, diff --git a/apps/web/src/app/vault/components/collection-dialog/collection-dialog.component.ts b/apps/web/src/app/vault/components/collection-dialog/collection-dialog.component.ts index 1a1d0e645b..34829f58b6 100644 --- a/apps/web/src/app/vault/components/collection-dialog/collection-dialog.component.ts +++ b/apps/web/src/app/vault/components/collection-dialog/collection-dialog.component.ts @@ -12,7 +12,6 @@ import { takeUntil, } from "rxjs"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { OrganizationUserService } from "@bitwarden/common/abstractions/organization-user/organization-user.service"; import { OrganizationUserUserDetailsResponse } from "@bitwarden/common/abstractions/organization-user/responses"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; @@ -22,7 +21,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { Utils } from "@bitwarden/common/platform/misc/utils"; import { CollectionResponse } from "@bitwarden/common/vault/models/response/collection.response"; import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view"; -import { BitValidators } from "@bitwarden/components"; +import { DialogService, BitValidators } from "@bitwarden/components"; import { GroupService, GroupView } from "../../../admin-console/organizations/core"; import { PermissionMode } from "../../../admin-console/organizations/shared/components/access-selector/access-selector.component"; @@ -95,7 +94,7 @@ export class CollectionDialogComponent implements OnInit, OnDestroy { private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, private organizationUserService: OrganizationUserService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) { this.tabIndex = params.initialTab ?? CollectionDialogTabType.Info; } @@ -249,7 +248,7 @@ export class CollectionDialogComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: this.collection?.name, content: { key: "deleteCollectionConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed && this.params.collectionId) { @@ -335,7 +334,7 @@ function mapToAccessSelections(collectionDetails: CollectionAdminView): AccessIt * @param config Configuration for the dialog */ export function openCollectionDialog( - dialogService: DialogServiceAbstraction, + dialogService: DialogService, config: DialogConfig ) { return dialogService.open( diff --git a/apps/web/src/app/vault/individual-vault/add-edit.component.ts b/apps/web/src/app/vault/individual-vault/add-edit.component.ts index 460942c304..61dd6124b4 100644 --- a/apps/web/src/app/vault/individual-vault/add-edit.component.ts +++ b/apps/web/src/app/vault/individual-vault/add-edit.component.ts @@ -1,6 +1,5 @@ import { Component, OnDestroy, OnInit } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { AddEditComponent as BaseAddEditComponent } from "@bitwarden/angular/vault/components/add-edit.component"; import { AuditService } from "@bitwarden/common/abstractions/audit.service"; import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service"; @@ -21,6 +20,7 @@ import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folde import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { LoginUriView } from "@bitwarden/common/vault/models/view/login-uri.view"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-vault-add-edit", @@ -59,7 +59,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit, On logService: LogService, passwordRepromptService: PasswordRepromptService, sendApiService: SendApiService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cipherService, diff --git a/apps/web/src/app/vault/individual-vault/attachments.component.ts b/apps/web/src/app/vault/individual-vault/attachments.component.ts index 697cb81966..28eeca3406 100644 --- a/apps/web/src/app/vault/individual-vault/attachments.component.ts +++ b/apps/web/src/app/vault/individual-vault/attachments.component.ts @@ -1,6 +1,5 @@ import { Component } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { AttachmentsComponent as BaseAttachmentsComponent } from "@bitwarden/angular/vault/components/attachments.component"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; @@ -11,6 +10,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-vault-attachments", @@ -29,7 +29,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent { apiService: ApiService, logService: LogService, fileDownloadService: FileDownloadService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cipherService, diff --git a/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-delete-dialog/bulk-delete-dialog.component.ts b/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-delete-dialog/bulk-delete-dialog.component.ts index 239d7a3d4e..23761f2be8 100644 --- a/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-delete-dialog/bulk-delete-dialog.component.ts +++ b/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-delete-dialog/bulk-delete-dialog.component.ts @@ -1,7 +1,6 @@ import { DialogConfig, DialogRef, DIALOG_DATA } from "@angular/cdk/dialog"; import { Component, Inject } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { CollectionBulkDeleteRequest } from "@bitwarden/common/models/request/collection-bulk-delete.request"; @@ -9,6 +8,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CipherBulkDeleteRequest } from "@bitwarden/common/vault/models/request/cipher-bulk-delete.request"; +import { DialogService } from "@bitwarden/components"; export interface BulkDeleteDialogParams { cipherIds?: string[]; @@ -28,7 +28,7 @@ export enum BulkDeleteDialogResult { * @param config Configuration for the dialog */ export const openBulkDeleteDialog = ( - dialogService: DialogServiceAbstraction, + dialogService: DialogService, config: DialogConfig ) => { return dialogService.open( diff --git a/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-move-dialog/bulk-move-dialog.component.ts b/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-move-dialog/bulk-move-dialog.component.ts index 4be422cf29..5530ca69b3 100644 --- a/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-move-dialog/bulk-move-dialog.component.ts +++ b/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-move-dialog/bulk-move-dialog.component.ts @@ -3,12 +3,12 @@ import { Component, Inject, OnInit } from "@angular/core"; import { FormBuilder, Validators } from "@angular/forms"; import { firstValueFrom, Observable } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; import { FolderView } from "@bitwarden/common/vault/models/view/folder.view"; +import { DialogService } from "@bitwarden/components"; export interface BulkMoveDialogParams { cipherIds?: string[]; @@ -25,7 +25,7 @@ export enum BulkMoveDialogResult { * @param config Configuration for the dialog */ export const openBulkMoveDialog = ( - dialogService: DialogServiceAbstraction, + dialogService: DialogService, config: DialogConfig ) => { return dialogService.open( diff --git a/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-share-dialog/bulk-share-dialog.component.ts b/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-share-dialog/bulk-share-dialog.component.ts index 057ef71b33..f54b261944 100644 --- a/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-share-dialog/bulk-share-dialog.component.ts +++ b/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-share-dialog/bulk-share-dialog.component.ts @@ -1,7 +1,6 @@ import { DialogConfig, DialogRef, DIALOG_DATA } from "@angular/cdk/dialog"; import { Component, Inject, OnInit } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; @@ -12,6 +11,7 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view"; +import { DialogService } from "@bitwarden/components"; export interface BulkShareDialogParams { ciphers: CipherView[]; @@ -29,7 +29,7 @@ export enum BulkShareDialogResult { * @param config Configuration for the dialog */ export const openBulkShareDialog = ( - dialogService: DialogServiceAbstraction, + dialogService: DialogService, config: DialogConfig ) => { return dialogService.open( diff --git a/apps/web/src/app/vault/individual-vault/folder-add-edit.component.ts b/apps/web/src/app/vault/individual-vault/folder-add-edit.component.ts index 707926c0ea..3dfd6b246c 100644 --- a/apps/web/src/app/vault/individual-vault/folder-add-edit.component.ts +++ b/apps/web/src/app/vault/individual-vault/folder-add-edit.component.ts @@ -2,13 +2,13 @@ import { DIALOG_DATA, DialogConfig, DialogRef } from "@angular/cdk/dialog"; import { Component, Inject } from "@angular/core"; import { FormBuilder } from "@angular/forms"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { FolderAddEditComponent as BaseFolderAddEditComponent } from "@bitwarden/angular/vault/components/folder-add-edit.component"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { FolderApiServiceAbstraction } from "@bitwarden/common/vault/abstractions/folder/folder-api.service.abstraction"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-folder-add-edit", @@ -22,7 +22,7 @@ export class FolderAddEditComponent extends BaseFolderAddEditComponent { i18nService: I18nService, platformUtilsService: PlatformUtilsService, logService: LogService, - dialogService: DialogServiceAbstraction, + dialogService: DialogService, formBuilder: FormBuilder, protected dialogRef: DialogRef, @Inject(DIALOG_DATA) params: FolderAddEditDialogParams @@ -43,7 +43,7 @@ export class FolderAddEditComponent extends BaseFolderAddEditComponent { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "deleteFolder" }, content: { key: "deleteFolderConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -103,7 +103,7 @@ export enum FolderAddEditDialogResult { * @param config Optional configuration for the dialog */ export function openFolderAddEditDialog( - dialogService: DialogServiceAbstraction, + dialogService: DialogService, config?: DialogConfig ) { return dialogService.open( diff --git a/apps/web/src/app/vault/individual-vault/vault-filter/components/organization-options.component.ts b/apps/web/src/app/vault/individual-vault/vault-filter/components/organization-options.component.ts index 4c3b94246d..37d7798743 100644 --- a/apps/web/src/app/vault/individual-vault/vault-filter/components/organization-options.component.ts +++ b/apps/web/src/app/vault/individual-vault/vault-filter/components/organization-options.component.ts @@ -1,7 +1,6 @@ import { Component, Inject, OnDestroy, OnInit } from "@angular/core"; import { map, Subject, takeUntil } from "rxjs"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationUserService } from "@bitwarden/common/abstractions/organization-user/organization-user.service"; @@ -15,6 +14,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; +import { DialogService } from "@bitwarden/components"; import { EnrollMasterPasswordReset } from "../../../../admin-console/organizations/users/enroll-master-password-reset.component"; import { OptionsInput } from "../shared/components/vault-filter-section.component"; @@ -42,7 +42,7 @@ export class OrganizationOptionsComponent implements OnInit, OnDestroy { private logService: LogService, private organizationApiService: OrganizationApiServiceAbstraction, private organizationUserService: OrganizationUserService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { @@ -85,7 +85,7 @@ export class OrganizationOptionsComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: org.name, content: { key: "unlinkSsoConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -107,7 +107,7 @@ export class OrganizationOptionsComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: org.name, content: { key: "leaveOrganizationConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/apps/web/src/app/vault/individual-vault/vault.component.ts b/apps/web/src/app/vault/individual-vault/vault.component.ts index b0cd2eb958..83f7da5168 100644 --- a/apps/web/src/app/vault/individual-vault/vault.component.ts +++ b/apps/web/src/app/vault/individual-vault/vault.component.ts @@ -29,7 +29,6 @@ import { } from "rxjs/operators"; import { SearchPipe } from "@bitwarden/angular/pipes/search.pipe"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service"; import { SearchService } from "@bitwarden/common/abstractions/search.service"; @@ -58,7 +57,7 @@ import { CollectionData } from "@bitwarden/common/vault/models/data/collection.d import { CollectionDetailsResponse } from "@bitwarden/common/vault/models/response/collection.response"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view"; -import { Icons } from "@bitwarden/components"; +import { DialogService, Icons } from "@bitwarden/components"; import { UpdateKeyComponent } from "../../settings/update-key.component"; import { CollectionDialogAction, openCollectionDialog } from "../components/collection-dialog"; @@ -153,7 +152,7 @@ export class VaultComponent implements OnInit, OnDestroy { private changeDetectorRef: ChangeDetectorRef, private i18nService: I18nService, private modalService: ModalService, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private tokenService: TokenService, private cryptoService: CryptoService, private messagingService: MessagingService, @@ -718,7 +717,7 @@ export class VaultComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: permanent ? "permanentlyDeleteItem" : "deleteItem" }, content: { key: permanent ? "permanentlyDeleteItemConfirmation" : "deleteItemConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/apps/web/src/app/vault/org-vault/add-edit.component.ts b/apps/web/src/app/vault/org-vault/add-edit.component.ts index 5dd37c42ef..46d8440d48 100644 --- a/apps/web/src/app/vault/org-vault/add-edit.component.ts +++ b/apps/web/src/app/vault/org-vault/add-edit.component.ts @@ -1,6 +1,5 @@ import { Component } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { AuditService } from "@bitwarden/common/abstractions/audit.service"; import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service"; @@ -20,6 +19,7 @@ import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folde import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherData } from "@bitwarden/common/vault/models/data/cipher.data"; import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; +import { DialogService } from "@bitwarden/components"; import { AddEditComponent as BaseAddEditComponent } from "../individual-vault/add-edit.component"; @@ -49,7 +49,7 @@ export class AddEditComponent extends BaseAddEditComponent { passwordRepromptService: PasswordRepromptService, organizationService: OrganizationService, sendApiService: SendApiService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cipherService, diff --git a/apps/web/src/app/vault/org-vault/attachments.component.ts b/apps/web/src/app/vault/org-vault/attachments.component.ts index 4dc0df74c0..725d4e7ba8 100644 --- a/apps/web/src/app/vault/org-vault/attachments.component.ts +++ b/apps/web/src/app/vault/org-vault/attachments.component.ts @@ -1,6 +1,5 @@ import { Component } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; @@ -13,6 +12,7 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi import { CipherData } from "@bitwarden/common/vault/models/data/cipher.data"; import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view"; +import { DialogService } from "@bitwarden/components"; import { AttachmentsComponent as BaseAttachmentsComponent } from "../individual-vault/attachments.component"; @@ -33,7 +33,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent { apiService: ApiService, logService: LogService, fileDownloadService: FileDownloadService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( cipherService, diff --git a/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts b/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts index 49055e487d..9282e237af 100644 --- a/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts +++ b/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts @@ -2,17 +2,12 @@ import { Component, EventEmitter, Input, Output } from "@angular/core"; import { Router } from "@angular/router"; import { firstValueFrom } from "rxjs"; -import { - SimpleDialogType, - DialogServiceAbstraction, - SimpleDialogCloseType, - SimpleDialogOptions, -} from "@bitwarden/angular/services/dialog"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { ProductType } from "@bitwarden/common/enums"; import { TreeNode } from "@bitwarden/common/models/domain/tree-node"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; +import { DialogService, SimpleDialogOptions } from "@bitwarden/components"; import { CollectionAdminView } from "../../../vault/core/views/collection-admin.view"; import { CollectionDialogTabType } from "../../components/collection-dialog"; @@ -64,7 +59,7 @@ export class VaultHeaderComponent { constructor( private organizationService: OrganizationService, private i18nService: I18nService, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private collectionAdminService: CollectionAdminService, private router: Router ) {} @@ -114,7 +109,7 @@ export class VaultHeaderComponent { : "freeOrgMaxCollectionReachedNoManageBilling", this.organization.maxCollections ), - type: SimpleDialogType.PRIMARY, + type: "primary", }; if (this.organization.canEditSubscription) { @@ -126,12 +121,12 @@ export class VaultHeaderComponent { const simpleDialog = this.dialogService.openSimpleDialogRef(orgUpgradeSimpleDialogOpts); - firstValueFrom(simpleDialog.closed).then((result: SimpleDialogCloseType | undefined) => { + firstValueFrom(simpleDialog.closed).then((result: boolean | undefined) => { if (!result) { return; } - if (result == SimpleDialogCloseType.ACCEPT && this.organization.canEditSubscription) { + if (result && this.organization.canEditSubscription) { this.router.navigate(["/organizations", this.organization.id, "billing", "subscription"], { queryParams: { upgrade: true }, }); diff --git a/apps/web/src/app/vault/org-vault/vault.component.ts b/apps/web/src/app/vault/org-vault/vault.component.ts index dc12eeba49..1cb57e188a 100644 --- a/apps/web/src/app/vault/org-vault/vault.component.ts +++ b/apps/web/src/app/vault/org-vault/vault.component.ts @@ -30,7 +30,6 @@ import { } from "rxjs/operators"; import { SearchPipe } from "@bitwarden/angular/pipes/search.pipe"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service"; @@ -53,7 +52,7 @@ import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.serv import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view"; -import { Icons } from "@bitwarden/components"; +import { DialogService, Icons } from "@bitwarden/components"; import { GroupService, GroupView } from "../../admin-console/organizations/core"; import { openEntityEventsDialog } from "../../admin-console/organizations/manage/entity-events.component"; @@ -139,7 +138,7 @@ export class VaultComponent implements OnInit, OnDestroy { private syncService: SyncService, private i18nService: I18nService, private modalService: ModalService, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private messagingService: MessagingService, private broadcasterService: BroadcasterService, private ngZone: NgZone, @@ -705,7 +704,7 @@ export class VaultComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: permanent ? "permanentlyDeleteItem" : "deleteItem" }, content: { key: permanent ? "permanentlyDeleteItemConfirmation" : "deleteItemConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -740,7 +739,7 @@ export class VaultComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: collection.name, content: { key: "deleteCollectionConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-add-edit-dialog/domain-add-edit-dialog.component.ts b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-add-edit-dialog/domain-add-edit-dialog.component.ts index f858b8e091..68df7e5183 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-add-edit-dialog/domain-add-edit-dialog.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-add-edit-dialog/domain-add-edit-dialog.component.ts @@ -3,7 +3,6 @@ import { Component, Inject, OnDestroy, OnInit } from "@angular/core"; import { FormBuilder, FormControl, FormGroup, ValidatorFn, Validators } from "@angular/forms"; import { Subject, takeUntil } from "rxjs"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { OrgDomainApiServiceAbstraction } from "@bitwarden/common/abstractions/organization-domain/org-domain-api.service.abstraction"; import { OrgDomainServiceAbstraction } from "@bitwarden/common/abstractions/organization-domain/org-domain.service.abstraction"; import { OrganizationDomainResponse } from "@bitwarden/common/abstractions/organization-domain/responses/organization-domain.response"; @@ -15,6 +14,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { OrganizationDomainRequest } from "@bitwarden/common/services/organization-domain/requests/organization-domain.request"; +import { DialogService } from "@bitwarden/components"; import { domainNameValidator } from "./validators/domain-name.validator"; import { uniqueInArrayValidator } from "./validators/unique-in-array.validator"; @@ -66,7 +66,7 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy { private orgDomainApiService: OrgDomainApiServiceAbstraction, private orgDomainService: OrgDomainServiceAbstraction, private validationService: ValidationService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} // Angular Method Implementations @@ -253,7 +253,7 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "removeDomain" }, content: { key: "removeDomainWarning" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-verification.component.ts b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-verification.component.ts index ddeada522d..aa7316f96b 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-verification.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-verification.component.ts @@ -2,7 +2,6 @@ import { Component, OnDestroy, OnInit } from "@angular/core"; import { ActivatedRoute, Params } from "@angular/router"; import { concatMap, Observable, Subject, take, takeUntil } from "rxjs"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { OrgDomainApiServiceAbstraction } from "@bitwarden/common/abstractions/organization-domain/org-domain-api.service.abstraction"; import { OrgDomainServiceAbstraction } from "@bitwarden/common/abstractions/organization-domain/org-domain.service.abstraction"; import { OrganizationDomainResponse } from "@bitwarden/common/abstractions/organization-domain/responses/organization-domain.response"; @@ -11,6 +10,7 @@ import { ErrorResponse } from "@bitwarden/common/models/response/error.response" import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; +import { DialogService } from "@bitwarden/components"; import { DomainAddEditDialogComponent, @@ -35,7 +35,7 @@ export class DomainVerificationComponent implements OnInit, OnDestroy { private i18nService: I18nService, private orgDomainApiService: OrgDomainApiServiceAbstraction, private orgDomainService: OrgDomainServiceAbstraction, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private validationService: ValidationService ) {} @@ -157,7 +157,7 @@ export class DomainVerificationComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "removeDomain" }, content: { key: "removeDomainWarning" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/scim.component.ts b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/scim.component.ts index 618c9bcd10..678c62e070 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/scim.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/scim.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from "@angular/core"; import { UntypedFormBuilder, FormControl } from "@angular/forms"; import { ActivatedRoute } from "@angular/router"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction"; import { @@ -18,6 +17,7 @@ import { ApiKeyResponse } from "@bitwarden/common/auth/models/response/api-key.r import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "app-org-manage-scim", @@ -47,7 +47,7 @@ export class ScimComponent implements OnInit { private i18nService: I18nService, private environmentService: EnvironmentService, private organizationApiService: OrganizationApiServiceAbstraction, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { @@ -90,7 +90,7 @@ export class ScimComponent implements OnInit { title: { key: "rotateScimKey" }, content: { key: "rotateScimKeyWarning" }, acceptButtonText: { key: "rotateKey" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/clients/add-organization.component.ts b/bitwarden_license/bit-web/src/app/admin-console/providers/clients/add-organization.component.ts index b0eb5e9e94..2f0d307674 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/clients/add-organization.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/clients/add-organization.component.ts @@ -1,12 +1,12 @@ import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ProviderService } from "@bitwarden/common/admin-console/abstractions/provider.service"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { Provider } from "@bitwarden/common/models/domain/provider"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; +import { DialogService } from "@bitwarden/components"; import { WebProviderService } from "../services/web-provider.service"; @@ -29,7 +29,7 @@ export class AddOrganizationComponent implements OnInit { private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, private validationService: ValidationService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { @@ -57,7 +57,7 @@ export class AddOrganizationComponent implements OnInit { key: "addOrganizationConfirmation", placeholders: [organization.name, this.provider.name], }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/clients/clients.component.ts b/bitwarden_license/bit-web/src/app/admin-console/providers/clients/clients.component.ts index f4fd237499..329bf5189e 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/clients/clients.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/clients/clients.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit, ViewChild, ViewContainerRef } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { first } from "rxjs/operators"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { SearchService } from "@bitwarden/common/abstractions/search.service"; @@ -17,6 +16,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; +import { DialogService } from "@bitwarden/components"; import { WebProviderService } from "../services/web-provider.service"; @@ -63,7 +63,7 @@ export class ClientsComponent implements OnInit { private modalService: ModalService, private organizationService: OrganizationService, private organizationApiService: OrganizationApiServiceAbstraction, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { @@ -158,7 +158,7 @@ export class ClientsComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: organization.organizationName, content: { key: "detachOrganizationConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.ts b/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.ts index 48cad98f1d..3f36527116 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.ts @@ -4,7 +4,6 @@ import { first } from "rxjs/operators"; import { SearchPipe } from "@bitwarden/angular/pipes/search.pipe"; import { UserNamePipe } from "@bitwarden/angular/pipes/user-name.pipe"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { SearchService } from "@bitwarden/common/abstractions/search.service"; @@ -21,6 +20,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service" import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; +import { DialogService } from "@bitwarden/components"; import { openEntityEventsDialog } from "@bitwarden/web-vault/app/admin-console/organizations/manage/entity-events.component"; import { BulkStatusComponent } from "@bitwarden/web-vault/app/admin-console/organizations/members/components/bulk/bulk-status.component"; import { BasePeopleComponent } from "@bitwarden/web-vault/app/common/base.people.component"; @@ -68,7 +68,7 @@ export class PeopleComponent userNamePipe: UserNamePipe, stateService: StateService, private providerService: ProviderService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( apiService, diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/manage/user-add-edit.component.ts b/bitwarden_license/bit-web/src/app/admin-console/providers/manage/user-add-edit.component.ts index 8f13da92b6..328ca9500e 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/manage/user-add-edit.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/manage/user-add-edit.component.ts @@ -1,6 +1,5 @@ import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core"; -import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { ProviderUserType } from "@bitwarden/common/admin-console/enums"; import { PermissionsApi } from "@bitwarden/common/admin-console/models/api/permissions.api"; @@ -9,6 +8,7 @@ import { ProviderUserUpdateRequest } from "@bitwarden/common/admin-console/model import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; @Component({ selector: "provider-user-add-edit", @@ -38,7 +38,7 @@ export class UserAddEditComponent implements OnInit { private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, private logService: LogService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { @@ -96,7 +96,7 @@ export class UserAddEditComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: this.name, content: { key: "removeUserConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.ts index 729ba694d9..86fab25608 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.ts @@ -13,11 +13,11 @@ import { share, } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; +import { DialogService } from "@bitwarden/components"; import { ProjectListView } from "../models/view/project-list.view"; import { SecretListView } from "../models/view/secret-list.view"; @@ -84,7 +84,7 @@ export class OverviewComponent implements OnInit, OnDestroy { private projectService: ProjectService, private secretService: SecretService, private serviceAccountService: ServiceAccountService, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private organizationService: OrganizationService, private stateService: StateService, private platformUtilsService: PlatformUtilsService, diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/projects/dialog/project-delete-dialog.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/projects/dialog/project-delete-dialog.component.ts index 1375677d2d..c37cf3d664 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/projects/dialog/project-delete-dialog.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/projects/dialog/project-delete-dialog.component.ts @@ -8,9 +8,9 @@ import { AbstractControl, } from "@angular/forms"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { ProjectListView } from "../../models/view/project-list.view"; import { @@ -38,7 +38,7 @@ export class ProjectDeleteDialogComponent implements OnInit { private projectService: ProjectService, private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} ngOnInit(): void { diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-people.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-people.component.ts index eee1236880..03b2625f00 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-people.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-people.component.ts @@ -2,9 +2,8 @@ import { Component, OnDestroy, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { map, Observable, share, startWith, Subject, switchMap, takeUntil } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; -import { SelectItemView } from "@bitwarden/components"; +import { DialogService, SelectItemView } from "@bitwarden/components"; import { GroupProjectAccessPolicyView, @@ -144,7 +143,7 @@ export class ProjectPeopleComponent implements OnInit, OnDestroy { constructor( private route: ActivatedRoute, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private validationService: ValidationService, private accessPolicyService: AccessPolicyService ) {} diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-secrets.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-secrets.component.ts index 759fb104b1..2d1690ef0e 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-secrets.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-secrets.component.ts @@ -2,9 +2,9 @@ import { Component } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { combineLatest, combineLatestWith, filter, Observable, startWith, switchMap } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { ProjectView } from "../../models/view/project.view"; import { SecretListView } from "../../models/view/secret-list.view"; @@ -36,7 +36,7 @@ export class ProjectSecretsComponent { private route: ActivatedRoute, private projectService: ProjectService, private secretService: SecretService, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private platformUtilsService: PlatformUtilsService, private i18nService: I18nService ) {} diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project.component.ts index d60b3209b1..c87d238d6a 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project.component.ts @@ -12,9 +12,9 @@ import { takeUntil, } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { ProjectView } from "../../models/view/project.view"; import { @@ -40,7 +40,7 @@ export class ProjectComponent implements OnInit, OnDestroy { private route: ActivatedRoute, private projectService: ProjectService, private router: Router, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private platformUtilsService: PlatformUtilsService, private i18nService: I18nService ) {} diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/projects/projects/projects.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/projects/projects/projects.component.ts index fe202b3122..7128e26a3d 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/projects/projects/projects.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/projects/projects/projects.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { combineLatest, lastValueFrom, Observable, startWith, switchMap } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; +import { DialogService } from "@bitwarden/components"; import { ProjectListView } from "../../models/view/project-list.view"; import { AccessPolicyService } from "../../shared/access-policies/access-policy.service"; @@ -37,7 +37,7 @@ export class ProjectsComponent implements OnInit { private route: ActivatedRoute, private projectService: ProjectService, private accessPolicyService: AccessPolicyService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} ngOnInit() { diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/secrets/dialog/secret-delete.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/dialog/secret-delete.component.ts index 8ee0d192e4..4158746131 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/secrets/dialog/secret-delete.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/dialog/secret-delete.component.ts @@ -1,9 +1,9 @@ import { DialogRef, DIALOG_DATA } from "@angular/cdk/dialog"; import { Component, Inject } from "@angular/core"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { SecretListView } from "../../models/view/secret-list.view"; import { @@ -27,7 +27,7 @@ export class SecretDeleteDialogComponent { private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, @Inject(DIALOG_DATA) private data: SecretDeleteOperation, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} showSoftDeleteSecretWarning = this.data.secrets.length === 1; diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/secrets/dialog/secret-dialog.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/dialog/secret-dialog.component.ts index 1c37673997..c6a807f739 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/secrets/dialog/secret-dialog.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/dialog/secret-dialog.component.ts @@ -3,12 +3,11 @@ import { Component, Inject, OnInit } from "@angular/core"; import { FormControl, FormGroup, Validators } from "@angular/forms"; import { lastValueFrom, Subject, takeUntil } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; -import { BitValidators } from "@bitwarden/components"; +import { DialogService, BitValidators } from "@bitwarden/components"; import { ProjectListView } from "../../models/view/project-list.view"; import { ProjectView } from "../../models/view/project.view"; @@ -66,7 +65,7 @@ export class SecretDialogComponent implements OnInit { private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, private projectService: ProjectService, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private organizationService: OrganizationService ) {} diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.component.ts index 02bd6d3cf1..7c05f169a3 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.component.ts @@ -2,9 +2,9 @@ import { Component, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { combineLatestWith, Observable, startWith, switchMap } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { SecretListView } from "../models/view/secret-list.view"; import { SecretsListComponent } from "../shared/secrets-list.component"; @@ -33,7 +33,7 @@ export class SecretsComponent implements OnInit { constructor( private route: ActivatedRoute, private secretService: SecretService, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private platformUtilsService: PlatformUtilsService, private i18nService: I18nService ) {} diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-tokens.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-tokens.component.ts index 2568a39836..24080d3e7d 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-tokens.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-tokens.component.ts @@ -10,10 +10,10 @@ import { takeUntil, } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { openUserVerificationPrompt } from "@bitwarden/web-vault/app/auth/shared/components/user-verification"; import { ServiceAccountView } from "../../models/view/service-account.view"; @@ -36,7 +36,7 @@ export class AccessTokenComponent implements OnInit, OnDestroy { constructor( private route: ActivatedRoute, private accessService: AccessService, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private modalService: ModalService, private platformUtilsService: PlatformUtilsService, private i18nService: I18nService, diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/dialogs/access-token-create-dialog.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/dialogs/access-token-create-dialog.component.ts index 8004166f62..4b9201e680 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/dialogs/access-token-create-dialog.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/dialogs/access-token-create-dialog.component.ts @@ -2,8 +2,7 @@ import { DialogRef, DIALOG_DATA } from "@angular/cdk/dialog"; import { Component, Inject, OnInit } from "@angular/core"; import { FormControl, FormGroup, Validators } from "@angular/forms"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; -import { BitValidators } from "@bitwarden/components"; +import { DialogService, BitValidators } from "@bitwarden/components"; import { ServiceAccountView } from "../../../models/view/service-account.view"; import { AccessTokenView } from "../../models/view/access-token.view"; @@ -33,7 +32,7 @@ export class AccessTokenCreateDialogComponent implements OnInit { constructor( public dialogRef: DialogRef, @Inject(DIALOG_DATA) public data: AccessTokenOperation, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private accessService: AccessService ) {} @@ -83,7 +82,7 @@ export class AccessTokenCreateDialogComponent implements OnInit { } static openNewAccessTokenDialog( - dialogService: DialogServiceAbstraction, + dialogService: DialogService, serviceAccountView: ServiceAccountView ) { return dialogService.open(AccessTokenCreateDialogComponent, { diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/dialog/service-account-delete-dialog.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/dialog/service-account-delete-dialog.component.ts index 69ad03e912..ccc99bd6b8 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/dialog/service-account-delete-dialog.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/dialog/service-account-delete-dialog.component.ts @@ -8,9 +8,9 @@ import { AbstractControl, } from "@angular/forms"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { ServiceAccountView } from "../../models/view/service-account.view"; import { @@ -38,7 +38,7 @@ export class ServiceAccountDeleteDialogComponent { private serviceAccountService: ServiceAccountService, private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} get title() { diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/people/service-account-people.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/people/service-account-people.component.ts index ba4b59abcf..296ef1c132 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/people/service-account-people.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/people/service-account-people.component.ts @@ -11,13 +11,9 @@ import { takeUntil, } from "rxjs"; -import { - SimpleDialogType, - DialogServiceAbstraction, - SimpleDialogOptions, -} from "@bitwarden/angular/services/dialog"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; +import { DialogService, SimpleDialogOptions } from "@bitwarden/components"; import { SelectItemView } from "@bitwarden/components/src/multi-select/models/select-item-view"; import { @@ -134,7 +130,7 @@ export class ServiceAccountPeopleComponent { const simpleDialogOpts: SimpleDialogOptions = { title: this.i18nService.t("saPeopleWarningTitle"), content: this.i18nService.t("saPeopleWarningMessage"), - type: SimpleDialogType.WARNING, + type: "warning", acceptButtonText: { key: "close" }, cancelButtonText: null, }; @@ -146,7 +142,7 @@ export class ServiceAccountPeopleComponent { constructor( private route: ActivatedRoute, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private i18nService: I18nService, private validationService: ValidationService, private accessPolicyService: AccessPolicyService diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-account.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-account.component.ts index 2e6084e06e..06b91f71f7 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-account.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-account.component.ts @@ -11,9 +11,9 @@ import { takeUntil, } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { ServiceAccountView } from "../models/view/service-account.view"; @@ -57,7 +57,7 @@ export class ServiceAccountComponent implements OnInit, OnDestroy { constructor( private route: ActivatedRoute, private serviceAccountService: ServiceAccountService, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private router: Router, private platformUtilsService: PlatformUtilsService, private i18nService: I18nService diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-accounts.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-accounts.component.ts index 973447b441..808073ba81 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-accounts.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-accounts.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { combineLatest, Observable, startWith, switchMap } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; +import { DialogService } from "@bitwarden/components"; import { ServiceAccountSecretsDetailsView, @@ -33,7 +33,7 @@ export class ServiceAccountsComponent implements OnInit { constructor( private route: ActivatedRoute, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private accessPolicyService: AccessPolicyService, private serviceAccountService: ServiceAccountService ) {} diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/settings/porting/sm-export.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/settings/porting/sm-export.component.ts index c3ba6bc2ef..201abb84ab 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/settings/porting/sm-export.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/settings/porting/sm-export.component.ts @@ -3,12 +3,12 @@ import { FormControl, FormGroup, Validators } from "@angular/forms"; import { ActivatedRoute } from "@angular/router"; import { firstValueFrom, Subject, switchMap, takeUntil } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { openUserVerificationPrompt } from "@bitwarden/web-vault/app/auth/shared/components/user-verification"; import { SecretsManagerPortingApiService } from "../services/sm-porting-api.service"; @@ -42,7 +42,7 @@ export class SecretsManagerExportComponent implements OnInit, OnDestroy { private smPortingService: SecretsManagerPortingService, private fileDownloadService: FileDownloadService, private logService: LogService, - private dialogService: DialogServiceAbstraction, + private dialogService: DialogService, private secretsManagerApiService: SecretsManagerPortingApiService ) {} diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/settings/porting/sm-import.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/settings/porting/sm-import.component.ts index ffa1024c8e..3542ee7b8e 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/settings/porting/sm-import.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/settings/porting/sm-import.component.ts @@ -3,12 +3,12 @@ import { FormControl, FormGroup } from "@angular/forms"; import { ActivatedRoute } from "@angular/router"; import { Subject, takeUntil } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { SecretsManagerImportErrorDialogComponent, @@ -37,7 +37,7 @@ export class SecretsManagerImportComponent implements OnInit, OnDestroy { protected fileDownloadService: FileDownloadService, private logService: LogService, private secretsManagerPortingApiService: SecretsManagerPortingApiService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/shared/new-menu.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/shared/new-menu.component.ts index ac0345c40e..7ecc2f917a 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/shared/new-menu.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/shared/new-menu.component.ts @@ -2,7 +2,7 @@ import { Component, OnDestroy, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { Subject, takeUntil } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; +import { DialogService } from "@bitwarden/components"; import { ProjectDialogComponent, @@ -26,7 +26,7 @@ export class NewMenuComponent implements OnInit, OnDestroy { private organizationId: string; private destroy$: Subject = new Subject(); - constructor(private route: ActivatedRoute, private dialogService: DialogServiceAbstraction) {} + constructor(private route: ActivatedRoute, private dialogService: DialogService) {} ngOnInit() { this.route.params.pipe(takeUntil(this.destroy$)).subscribe((params: any) => { diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/trash/trash.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/trash/trash.component.ts index 8835049f82..83f510ed56 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/trash/trash.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/trash/trash.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { combineLatestWith, Observable, startWith, switchMap } from "rxjs"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; +import { DialogService } from "@bitwarden/components"; import { SecretListView } from "../models/view/secret-list.view"; import { SecretService } from "../secrets/secret.service"; @@ -28,7 +28,7 @@ export class TrashComponent implements OnInit { constructor( private route: ActivatedRoute, private secretService: SecretService, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} ngOnInit() { diff --git a/libs/angular/src/auth/components/change-password.component.ts b/libs/angular/src/auth/components/change-password.component.ts index 2e440b984d..f30987119a 100644 --- a/libs/angular/src/auth/components/change-password.component.ts +++ b/libs/angular/src/auth/components/change-password.component.ts @@ -14,8 +14,8 @@ import { Utils } from "@bitwarden/common/platform/misc/utils"; import { EncString } from "@bitwarden/common/platform/models/domain/enc-string"; import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; +import { DialogService } from "@bitwarden/components"; -import { DialogServiceAbstraction, SimpleDialogType } from "../../services/dialog"; import { PasswordColorText } from "../../shared/components/password-strength/password-strength.component"; @Directive() @@ -44,7 +44,7 @@ export class ChangePasswordComponent implements OnInit, OnDestroy { protected platformUtilsService: PlatformUtilsService, protected policyService: PolicyService, protected stateService: StateService, - protected dialogService: DialogServiceAbstraction + protected dialogService: DialogService ) {} async ngOnInit() { @@ -162,7 +162,7 @@ export class ChangePasswordComponent implements OnInit, OnDestroy { const result = await this.dialogService.openSimpleDialog({ title: { key: "weakAndExposedMasterPassword" }, content: { key: "weakAndBreachedMasterPasswordDesc" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!result) { @@ -173,7 +173,7 @@ export class ChangePasswordComponent implements OnInit, OnDestroy { const result = await this.dialogService.openSimpleDialog({ title: { key: "weakMasterPassword" }, content: { key: "weakMasterPasswordDesc" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!result) { @@ -184,7 +184,7 @@ export class ChangePasswordComponent implements OnInit, OnDestroy { const result = await this.dialogService.openSimpleDialog({ title: { key: "exposedMasterPassword" }, content: { key: "exposedMasterPasswordDesc" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!result) { @@ -201,7 +201,7 @@ export class ChangePasswordComponent implements OnInit, OnDestroy { title: { key: "logOut" }, content: { key: "logOutConfirmation" }, acceptButtonText: { key: "logOut" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (confirmed) { diff --git a/libs/angular/src/auth/components/lock.component.ts b/libs/angular/src/auth/components/lock.component.ts index 01c083ee5a..68cc7dafe0 100644 --- a/libs/angular/src/auth/components/lock.component.ts +++ b/libs/angular/src/auth/components/lock.component.ts @@ -25,8 +25,7 @@ import { Utils } from "@bitwarden/common/platform/misc/utils"; import { EncString } from "@bitwarden/common/platform/models/domain/enc-string"; import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength"; - -import { DialogServiceAbstraction, SimpleDialogType } from "../../services/dialog"; +import { DialogService } from "@bitwarden/components"; @Directive() export class LockComponent implements OnInit, OnDestroy { @@ -70,7 +69,7 @@ export class LockComponent implements OnInit, OnDestroy { protected policyApiService: PolicyApiServiceAbstraction, protected policyService: InternalPolicyService, protected passwordStrengthService: PasswordStrengthServiceAbstraction, - protected dialogService: DialogServiceAbstraction + protected dialogService: DialogService ) {} async ngOnInit() { @@ -102,7 +101,7 @@ export class LockComponent implements OnInit, OnDestroy { title: { key: "logOut" }, content: { key: "logOutConfirmation" }, acceptButtonText: { key: "logOut" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (confirmed) { diff --git a/libs/angular/src/auth/components/remove-password.component.ts b/libs/angular/src/auth/components/remove-password.component.ts index 444973f2d5..8fc14eb373 100644 --- a/libs/angular/src/auth/components/remove-password.component.ts +++ b/libs/angular/src/auth/components/remove-password.component.ts @@ -8,8 +8,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; - -import { DialogServiceAbstraction, SimpleDialogType } from "../../services/dialog"; +import { DialogService } from "@bitwarden/components"; @Directive() export class RemovePasswordComponent implements OnInit { @@ -29,7 +28,7 @@ export class RemovePasswordComponent implements OnInit { private i18nService: I18nService, private keyConnectorService: KeyConnectorService, private organizationApiService: OrganizationApiServiceAbstraction, - private dialogService: DialogServiceAbstraction + private dialogService: DialogService ) {} async ngOnInit() { @@ -61,7 +60,7 @@ export class RemovePasswordComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: this.organization.name, content: { key: "leaveOrganizationConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/libs/angular/src/auth/components/update-password.component.ts b/libs/angular/src/auth/components/update-password.component.ts index c9d3c3a8ec..06b7f48b57 100644 --- a/libs/angular/src/auth/components/update-password.component.ts +++ b/libs/angular/src/auth/components/update-password.component.ts @@ -17,8 +17,7 @@ import { EncString } from "@bitwarden/common/platform/models/domain/enc-string"; import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; import { Verification } from "@bitwarden/common/types/verification"; - -import { DialogServiceAbstraction } from "../../services/dialog"; +import { DialogService } from "@bitwarden/components"; import { ChangePasswordComponent as BaseChangePasswordComponent } from "./change-password.component"; @@ -44,7 +43,7 @@ export class UpdatePasswordComponent extends BaseChangePasswordComponent { stateService: StateService, private userVerificationService: UserVerificationService, private logService: LogService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( i18nService, diff --git a/libs/angular/src/auth/components/update-temp-password.component.ts b/libs/angular/src/auth/components/update-temp-password.component.ts index 01128c4ba6..57256a579f 100644 --- a/libs/angular/src/auth/components/update-temp-password.component.ts +++ b/libs/angular/src/auth/components/update-temp-password.component.ts @@ -20,8 +20,7 @@ import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/sym import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; import { Verification } from "@bitwarden/common/types/verification"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; - -import { DialogServiceAbstraction } from "../../services/dialog"; +import { DialogService } from "@bitwarden/components"; import { ChangePasswordComponent as BaseChangePasswordComponent } from "./change-password.component"; @@ -56,7 +55,7 @@ export class UpdateTempPasswordComponent extends BaseChangePasswordComponent { private logService: LogService, private userVerificationService: UserVerificationService, private router: Router, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( i18nService, diff --git a/libs/angular/src/components/register.component.ts b/libs/angular/src/components/register.component.ts index 510da6160a..e096f2a098 100644 --- a/libs/angular/src/components/register.component.ts +++ b/libs/angular/src/components/register.component.ts @@ -19,13 +19,13 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; +import { DialogService } from "@bitwarden/components"; import { CaptchaProtectedComponent } from "../auth/components/captcha-protected.component"; import { AllValidationErrors, FormValidationErrorsService, } from "../platform/abstractions/form-validation-errors.service"; -import { DialogServiceAbstraction, SimpleDialogType } from "../services/dialog"; import { PasswordColorText } from "../shared/components/password-strength/password-strength.component"; import { InputsFieldMatch } from "../validators/inputsFieldMatch.validator"; @@ -92,7 +92,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn environmentService: EnvironmentService, protected logService: LogService, protected auditService: AuditService, - protected dialogService: DialogServiceAbstraction + protected dialogService: DialogService ) { super(environmentService, i18nService, platformUtilsService); this.showTerms = !platformUtilsService.isSelfHost(); @@ -232,7 +232,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn const result = await this.dialogService.openSimpleDialog({ title: { key: "weakAndExposedMasterPassword" }, content: { key: "weakAndBreachedMasterPasswordDesc" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!result) { @@ -242,7 +242,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn const result = await this.dialogService.openSimpleDialog({ title: { key: "weakMasterPassword" }, content: { key: "weakMasterPasswordDesc" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!result) { @@ -252,7 +252,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn const result = await this.dialogService.openSimpleDialog({ title: { key: "exposedMasterPassword" }, content: { key: "exposedMasterPasswordDesc" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!result) { diff --git a/libs/angular/src/components/set-password.component.ts b/libs/angular/src/components/set-password.component.ts index 3f0d6eab5e..b432ae55ac 100644 --- a/libs/angular/src/components/set-password.component.ts +++ b/libs/angular/src/components/set-password.component.ts @@ -21,9 +21,9 @@ import { EncString } from "@bitwarden/common/platform/models/domain/enc-string"; import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; +import { DialogService } from "@bitwarden/components"; import { ChangePasswordComponent as BaseChangePasswordComponent } from "../auth/components/change-password.component"; -import { DialogServiceAbstraction } from "../services/dialog"; @Directive() export class SetPasswordComponent extends BaseChangePasswordComponent { @@ -52,7 +52,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent { stateService: StateService, private organizationApiService: OrganizationApiServiceAbstraction, private organizationUserService: OrganizationUserService, - dialogService: DialogServiceAbstraction + dialogService: DialogService ) { super( i18nService, diff --git a/libs/angular/src/services/dialog/dialog.service.abstraction.ts b/libs/angular/src/services/dialog/dialog.service.abstraction.ts deleted file mode 100644 index f940dd1fa5..0000000000 --- a/libs/angular/src/services/dialog/dialog.service.abstraction.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Dialog, DialogRef } from "@angular/cdk/dialog"; - -import { SimpleDialogOptions } from "./simple-dialog-options"; - -export abstract class DialogServiceAbstraction extends Dialog { - /** - * Opens a simple dialog, returns true if the user accepted the dialog. - * - * @param {SimpleDialogOptions} simpleDialogOptions - An object containing options for the dialog. - * @returns `boolean` - True if the user accepted the dialog, false otherwise. - */ - openSimpleDialog: (simpleDialogOptions: SimpleDialogOptions) => Promise; - - /** - * Opens a simple dialog. - * - * @deprecated Use `openSimpleDialogAcceptedPromise` instead. If you find a use case for the `dialogRef` - * please let #wg-component-library know and we can un-deprecate this method. - * - * @param {SimpleDialogOptions} simpleDialogOptions - An object containing options for the dialog. - * @returns `DialogRef` - The reference to the opened dialog. - * Contains a closed observable which can be subscribed to for determining which button - * a user pressed (see `SimpleDialogCloseType`) - */ - openSimpleDialogRef: (simpleDialogOptions: SimpleDialogOptions) => DialogRef; -} diff --git a/libs/angular/src/services/dialog/dialog.service.ts b/libs/angular/src/services/dialog/dialog.service.ts deleted file mode 100644 index ffd7a09b2c..0000000000 --- a/libs/angular/src/services/dialog/dialog.service.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { - DialogRef, - DialogConfig, - Dialog, - DEFAULT_DIALOG_CONFIG, - DIALOG_SCROLL_STRATEGY, -} from "@angular/cdk/dialog"; -import { Overlay, OverlayContainer } from "@angular/cdk/overlay"; -import { ComponentType } from "@angular/cdk/portal"; -import { Inject, Injectable, Injector, Optional, SkipSelf, TemplateRef } from "@angular/core"; - -import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; - -import { DialogServiceAbstraction } from "./dialog.service.abstraction"; -import { SimpleDialogOptions } from "./simple-dialog-options"; -import { Translation } from "./translation"; - -// This is a temporary base class for Dialogs. It is intended to be removed once the Component Library is adopted by each app. -@Injectable() -export abstract class DialogService extends Dialog implements DialogServiceAbstraction { - constructor( - /** Parent class constructor */ - _overlay: Overlay, - _injector: Injector, - @Optional() @Inject(DEFAULT_DIALOG_CONFIG) _defaultOptions: DialogConfig, - @Optional() @SkipSelf() _parentDialog: Dialog, - _overlayContainer: OverlayContainer, - @Inject(DIALOG_SCROLL_STRATEGY) scrollStrategy: any, - protected i18nService: I18nService - ) { - super(_overlay, _injector, _defaultOptions, _parentDialog, _overlayContainer, scrollStrategy); - } - - async openSimpleDialog(options: SimpleDialogOptions): Promise { - throw new Error("Method not implemented."); - } - - openSimpleDialogRef(simpleDialogOptions: SimpleDialogOptions): DialogRef { - throw new Error("Method not implemented."); - } - - override open( - componentOrTemplateRef: ComponentType | TemplateRef, - config?: DialogConfig> - ): DialogRef { - throw new Error("Method not implemented."); - } - - protected translate(translation: string | Translation, defaultKey?: string): string { - if (translation == null && defaultKey == null) { - return null; - } - - if (translation == null) { - return this.i18nService.t(defaultKey); - } - - // Translation interface use implies we must localize. - if (typeof translation === "object") { - return this.i18nService.t(translation.key, ...(translation.placeholders ?? [])); - } - - return translation; - } -} diff --git a/libs/angular/src/services/dialog/index.ts b/libs/angular/src/services/dialog/index.ts deleted file mode 100644 index b664d179e0..0000000000 --- a/libs/angular/src/services/dialog/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from "./dialog.service.abstraction"; -export * from "./simple-dialog-options"; -export * from "./simple-dialog-type.enum"; -export * from "./simple-dialog-close-type.enum"; -export * from "./dialog.service"; -export * from "./translation"; diff --git a/libs/angular/src/services/dialog/simple-dialog-close-type.enum.ts b/libs/angular/src/services/dialog/simple-dialog-close-type.enum.ts deleted file mode 100644 index d6eff80cdd..0000000000 --- a/libs/angular/src/services/dialog/simple-dialog-close-type.enum.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum SimpleDialogCloseType { - ACCEPT = "accept", - CANCEL = "cancel", -} diff --git a/libs/angular/src/services/dialog/simple-dialog-type.enum.ts b/libs/angular/src/services/dialog/simple-dialog-type.enum.ts deleted file mode 100644 index e7fa460aac..0000000000 --- a/libs/angular/src/services/dialog/simple-dialog-type.enum.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum SimpleDialogType { - PRIMARY = "primary", - SUCCESS = "success", - INFO = "info", - WARNING = "warning", - DANGER = "danger", -} diff --git a/libs/angular/src/services/dialog/translation.ts b/libs/angular/src/services/dialog/translation.ts deleted file mode 100644 index d8dca21b3f..0000000000 --- a/libs/angular/src/services/dialog/translation.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface Translation { - key: string; - placeholders?: Array; -} diff --git a/libs/angular/src/services/modal.service.ts b/libs/angular/src/services/modal.service.ts index 18afcbbea8..ba461764ba 100644 --- a/libs/angular/src/services/modal.service.ts +++ b/libs/angular/src/services/modal.service.ts @@ -21,6 +21,9 @@ export class ModalConfig { replaceTopModal?: boolean; } +/** + * @deprecated Use the Component Library's `DialogService` instead. + */ @Injectable() export class ModalService { protected modalList: ComponentRef[] = []; @@ -50,7 +53,7 @@ export class ModalService { } /** - * @deprecated Use `dialogService.open` (in web) or `modalService.open` (in desktop/browser) instead. + * @deprecated Use `dialogService.open` instead. * If replacing an existing call to this method, also remove any `@ViewChild` and `` associated with the * existing usage. */ diff --git a/libs/angular/src/tools/export/components/export.component.ts b/libs/angular/src/tools/export/components/export.component.ts index 595a6ebdfd..9d782d2822 100644 --- a/libs/angular/src/tools/export/components/export.component.ts +++ b/libs/angular/src/tools/export/components/export.component.ts @@ -12,10 +12,9 @@ import { FileDownloadService } from "@bitwarden/common/platform/abstractions/fil import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { DialogService } from "@bitwarden/components"; import { VaultExportServiceAbstraction } from "@bitwarden/exporter/vault-export"; -import { DialogServiceAbstraction, SimpleDialogType } from "../../../services/dialog"; - @Directive() export class ExportComponent implements OnInit, OnDestroy { @Output() onSaved = new EventEmitter(); @@ -55,7 +54,7 @@ export class ExportComponent implements OnInit, OnDestroy { private userVerificationService: UserVerificationService, private formBuilder: UntypedFormBuilder, protected fileDownloadService: FileDownloadService, - protected dialogService: DialogServiceAbstraction + protected dialogService: DialogService ) {} async ngOnInit() { @@ -135,14 +134,14 @@ export class ExportComponent implements OnInit, OnDestroy { " " + this.i18nService.t("encExportAccountWarningDesc"), acceptButtonText: { key: "exportVault" }, - type: SimpleDialogType.WARNING, + type: "warning", }); } else { return await this.dialogService.openSimpleDialog({ title: { key: "confirmVaultExport" }, content: { key: "exportWarningDesc" }, acceptButtonText: { key: "exportVault" }, - type: SimpleDialogType.WARNING, + type: "warning", }); } } diff --git a/libs/angular/src/tools/send/add-edit.component.ts b/libs/angular/src/tools/send/add-edit.component.ts index 8551a2067c..bcb7318567 100644 --- a/libs/angular/src/tools/send/add-edit.component.ts +++ b/libs/angular/src/tools/send/add-edit.component.ts @@ -18,8 +18,7 @@ import { SendTextView } from "@bitwarden/common/tools/send/models/view/send-text import { SendView } from "@bitwarden/common/tools/send/models/view/send.view"; import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction"; import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction"; - -import { DialogServiceAbstraction, SimpleDialogType } from "../../services/dialog"; +import { DialogService } from "@bitwarden/components"; @Directive() export class AddEditComponent implements OnInit, OnDestroy { @@ -63,7 +62,7 @@ export class AddEditComponent implements OnInit, OnDestroy { private logService: LogService, protected stateService: StateService, protected sendApiService: SendApiService, - protected dialogService: DialogServiceAbstraction + protected dialogService: DialogService ) { this.typeOptions = [ { name: i18nService.t("sendTypeFile"), value: SendType.File }, @@ -236,7 +235,7 @@ export class AddEditComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "deleteSend" }, content: { key: "deleteSendConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -314,7 +313,7 @@ export class AddEditComponent implements OnInit, OnDestroy { content: { key: this.editMode ? "editedSend" : "createdSend" }, acceptButtonText: { key: "ok" }, cancelButtonText: null, - type: SimpleDialogType.SUCCESS, + type: "success", }); await this.copyLinkToClipboard(this.link); diff --git a/libs/angular/src/tools/send/send.component.ts b/libs/angular/src/tools/send/send.component.ts index 6064c09ad2..4669f5ccf4 100644 --- a/libs/angular/src/tools/send/send.component.ts +++ b/libs/angular/src/tools/send/send.component.ts @@ -12,8 +12,7 @@ import { SendType } from "@bitwarden/common/tools/send/enums/send-type"; import { SendView } from "@bitwarden/common/tools/send/models/view/send.view"; import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction"; import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction"; - -import { DialogServiceAbstraction, SimpleDialogType } from "../../services/dialog"; +import { DialogService } from "@bitwarden/components"; @Directive() export class SendComponent implements OnInit, OnDestroy { @@ -59,7 +58,7 @@ export class SendComponent implements OnInit, OnDestroy { protected policyService: PolicyService, private logService: LogService, protected sendApiService: SendApiService, - protected dialogService: DialogServiceAbstraction + protected dialogService: DialogService ) {} async ngOnInit() { @@ -139,7 +138,7 @@ export class SendComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "removePassword" }, content: { key: "removePasswordConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -170,7 +169,7 @@ export class SendComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "deleteSend" }, content: { key: "deleteSendConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/libs/angular/src/vault/components/add-edit.component.ts b/libs/angular/src/vault/components/add-edit.component.ts index 44da000a7b..6bcd72082b 100644 --- a/libs/angular/src/vault/components/add-edit.component.ts +++ b/libs/angular/src/vault/components/add-edit.component.ts @@ -33,8 +33,7 @@ import { IdentityView } from "@bitwarden/common/vault/models/view/identity.view" import { LoginUriView } from "@bitwarden/common/vault/models/view/login-uri.view"; import { LoginView } from "@bitwarden/common/vault/models/view/login.view"; import { SecureNoteView } from "@bitwarden/common/vault/models/view/secure-note.view"; - -import { DialogServiceAbstraction, SimpleDialogType } from "../../services/dialog"; +import { DialogService } from "@bitwarden/components"; @Directive() export class AddEditComponent implements OnInit, OnDestroy { @@ -101,7 +100,7 @@ export class AddEditComponent implements OnInit, OnDestroy { protected passwordRepromptService: PasswordRepromptService, private organizationService: OrganizationService, protected sendApiService: SendApiService, - protected dialogService: DialogServiceAbstraction + protected dialogService: DialogService ) { this.typeOptions = [ { name: i18nService.t("typeLogin"), value: CipherType.Login }, @@ -402,7 +401,7 @@ export class AddEditComponent implements OnInit, OnDestroy { content: { key: this.cipher.isDeleted ? "permanentlyDeleteItemConfirmation" : "deleteItemConfirmation", }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -451,7 +450,7 @@ export class AddEditComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "overwriteUsername" }, content: { key: "overwriteUsernameConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -468,7 +467,7 @@ export class AddEditComponent implements OnInit, OnDestroy { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "overwritePassword" }, content: { key: "overwritePasswordConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/libs/angular/src/vault/components/attachments.component.ts b/libs/angular/src/vault/components/attachments.component.ts index e4daf6e37f..3b3eaa1d86 100644 --- a/libs/angular/src/vault/components/attachments.component.ts +++ b/libs/angular/src/vault/components/attachments.component.ts @@ -13,8 +13,7 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; - -import { DialogServiceAbstraction, SimpleDialogType } from "../../services/dialog"; +import { DialogService } from "@bitwarden/components"; @Directive() export class AttachmentsComponent implements OnInit { @@ -43,7 +42,7 @@ export class AttachmentsComponent implements OnInit { protected logService: LogService, protected stateService: StateService, protected fileDownloadService: FileDownloadService, - protected dialogService: DialogServiceAbstraction + protected dialogService: DialogService ) {} async ngOnInit() { @@ -106,7 +105,7 @@ export class AttachmentsComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "deleteAttachment" }, content: { key: "deleteAttachmentConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { @@ -201,7 +200,7 @@ export class AttachmentsComponent implements OnInit { title: { key: "premiumRequired" }, content: { key: "premiumRequiredDesc" }, acceptButtonText: { key: "learnMore" }, - type: SimpleDialogType.SUCCESS, + type: "success", }); if (confirmed) { @@ -212,7 +211,7 @@ export class AttachmentsComponent implements OnInit { title: { key: "featureUnavailable" }, content: { key: "updateKey" }, acceptButtonText: { key: "learnMore" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (confirmed) { diff --git a/libs/angular/src/vault/components/folder-add-edit.component.ts b/libs/angular/src/vault/components/folder-add-edit.component.ts index 5e2f956d76..194d927ad1 100644 --- a/libs/angular/src/vault/components/folder-add-edit.component.ts +++ b/libs/angular/src/vault/components/folder-add-edit.component.ts @@ -7,8 +7,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { FolderApiServiceAbstraction } from "@bitwarden/common/vault/abstractions/folder/folder-api.service.abstraction"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; import { FolderView } from "@bitwarden/common/vault/models/view/folder.view"; - -import { DialogServiceAbstraction, SimpleDialogType } from "../../services/dialog"; +import { DialogService } from "@bitwarden/components"; @Directive() export class FolderAddEditComponent implements OnInit { @@ -33,7 +32,7 @@ export class FolderAddEditComponent implements OnInit { protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService, protected logService: LogService, - protected dialogService: DialogServiceAbstraction, + protected dialogService: DialogService, protected formBuilder: FormBuilder ) {} @@ -74,7 +73,7 @@ export class FolderAddEditComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "deleteFolder" }, content: { key: "deleteFolderConfirmation" }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/libs/angular/src/vault/components/premium.component.ts b/libs/angular/src/vault/components/premium.component.ts index b13cfa428d..7e5deaf2cf 100644 --- a/libs/angular/src/vault/components/premium.component.ts +++ b/libs/angular/src/vault/components/premium.component.ts @@ -6,8 +6,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; - -import { DialogServiceAbstraction, SimpleDialogType } from "../../services/dialog"; +import { DialogService } from "@bitwarden/components"; @Directive() export class PremiumComponent implements OnInit { @@ -22,7 +21,7 @@ export class PremiumComponent implements OnInit { protected apiService: ApiService, private logService: LogService, protected stateService: StateService, - protected dialogService: DialogServiceAbstraction, + protected dialogService: DialogService, private environmentService: EnvironmentService ) { this.cloudWebVaultUrl = this.environmentService.getCloudWebVaultUrl(); @@ -47,7 +46,7 @@ export class PremiumComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "premiumPurchase" }, content: { key: "premiumPurchaseAlert" }, - type: SimpleDialogType.INFO, + type: "info", }); if (confirmed) { @@ -59,7 +58,7 @@ export class PremiumComponent implements OnInit { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "premiumManage" }, content: { key: "premiumManageAlert" }, - type: SimpleDialogType.INFO, + type: "info", }); if (confirmed) { diff --git a/libs/angular/src/vault/components/view.component.ts b/libs/angular/src/vault/components/view.component.ts index 7ba14b97f8..18ea5474fd 100644 --- a/libs/angular/src/vault/components/view.component.ts +++ b/libs/angular/src/vault/components/view.component.ts @@ -34,8 +34,7 @@ import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.v import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { FolderView } from "@bitwarden/common/vault/models/view/folder.view"; import { LoginUriView } from "@bitwarden/common/vault/models/view/login-uri.view"; - -import { DialogServiceAbstraction, SimpleDialogType } from "../../services/dialog"; +import { DialogService } from "@bitwarden/components"; const BroadcasterSubscriptionId = "ViewComponent"; @@ -87,7 +86,7 @@ export class ViewComponent implements OnDestroy, OnInit { private logService: LogService, protected stateService: StateService, protected fileDownloadService: FileDownloadService, - protected dialogService: DialogServiceAbstraction + protected dialogService: DialogService ) {} ngOnInit() { @@ -182,7 +181,7 @@ export class ViewComponent implements OnDestroy, OnInit { content: { key: this.cipher.isDeleted ? "permanentlyDeleteItemConfirmation" : "deleteItemConfirmation", }, - type: SimpleDialogType.WARNING, + type: "warning", }); if (!confirmed) { diff --git a/libs/components/src/dialog/dialog.module.ts b/libs/components/src/dialog/dialog.module.ts index f7e0c1e957..a4e119bcc2 100644 --- a/libs/components/src/dialog/dialog.module.ts +++ b/libs/components/src/dialog/dialog.module.ts @@ -2,8 +2,6 @@ import { DialogModule as CdkDialogModule } from "@angular/cdk/dialog"; import { NgModule } from "@angular/core"; import { ReactiveFormsModule } from "@angular/forms"; -import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog"; - import { AsyncActionsModule } from "../async-actions"; import { ButtonModule } from "../button"; import { IconButtonModule } from "../icon-button"; @@ -13,7 +11,7 @@ import { DialogComponent } from "./dialog/dialog.component"; import { DialogService } from "./dialog.service"; import { DialogCloseDirective } from "./directives/dialog-close.directive"; import { DialogTitleContainerDirective } from "./directives/dialog-title-container.directive"; -import { SimpleConfigurableDialogComponent } from "./simple-configurable-dialog/simple-configurable-dialog.component"; +import { SimpleConfigurableDialogComponent } from "./simple-dialog/simple-configurable-dialog/simple-configurable-dialog.component"; import { IconDirective, SimpleDialogComponent } from "./simple-dialog/simple-dialog.component"; @NgModule({ @@ -40,11 +38,6 @@ import { IconDirective, SimpleDialogComponent } from "./simple-dialog/simple-dia DialogCloseDirective, IconDirective, ], - providers: [ - { - provide: DialogServiceAbstraction, - useClass: DialogService, - }, - ], + providers: [DialogService], }) export class DialogModule {} diff --git a/libs/components/src/dialog/dialog.service.ts b/libs/components/src/dialog/dialog.service.ts index 0f58c1c847..27930189bf 100644 --- a/libs/components/src/dialog/dialog.service.ts +++ b/libs/components/src/dialog/dialog.service.ts @@ -18,19 +18,15 @@ import { import { NavigationEnd, Router } from "@angular/router"; import { filter, firstValueFrom, Subject, switchMap, takeUntil } from "rxjs"; -import { - DialogServiceAbstraction, - SimpleDialogCloseType, -} from "@bitwarden/angular/services/dialog"; import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service"; import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status"; +import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { SimpleDialogOptions } from "../../../angular/src/services/dialog/simple-dialog-options"; - -import { SimpleConfigurableDialogComponent } from "./simple-configurable-dialog/simple-configurable-dialog.component"; +import { SimpleConfigurableDialogComponent } from "./simple-dialog/simple-configurable-dialog/simple-configurable-dialog.component"; +import { SimpleDialogOptions, Translation } from "./simple-dialog/types"; @Injectable() -export class DialogService extends Dialog implements OnDestroy, DialogServiceAbstraction { +export class DialogService extends Dialog implements OnDestroy { private _destroy$ = new Subject(); private backDropClasses = ["tw-fixed", "tw-bg-black", "tw-bg-opacity-30", "tw-inset-0"]; @@ -46,7 +42,9 @@ export class DialogService extends Dialog implements OnDestroy, DialogServiceAbs /** Not in parent class */ @Optional() router: Router, - @Optional() authService: AuthService + @Optional() authService: AuthService, + + protected i18nService: I18nService ) { super(_overlay, _injector, _defaultOptions, _parentDialog, _overlayContainer, scrollStrategy); @@ -88,12 +86,12 @@ export class DialogService extends Dialog implements OnDestroy, DialogServiceAbs * @returns `boolean` - True if the user accepted the dialog, false otherwise. */ async openSimpleDialog(simpleDialogOptions: SimpleDialogOptions): Promise { - const dialogRef = this.open(SimpleConfigurableDialogComponent, { + const dialogRef = this.open(SimpleConfigurableDialogComponent, { data: simpleDialogOptions, disableClose: simpleDialogOptions.disableClose, }); - return (await firstValueFrom(dialogRef.closed)) == SimpleDialogCloseType.ACCEPT; + return firstValueFrom(dialogRef.closed); } /** @@ -105,7 +103,7 @@ export class DialogService extends Dialog implements OnDestroy, DialogServiceAbs * @param {SimpleDialogOptions} simpleDialogOptions - An object containing options for the dialog. * @returns `DialogRef` - The reference to the opened dialog. * Contains a closed observable which can be subscribed to for determining which button - * a user pressed (see `SimpleDialogCloseType`) + * a user pressed */ openSimpleDialogRef(simpleDialogOptions: SimpleDialogOptions): DialogRef { return this.open(SimpleConfigurableDialogComponent, { @@ -113,4 +111,21 @@ export class DialogService extends Dialog implements OnDestroy, DialogServiceAbs disableClose: simpleDialogOptions.disableClose, }); } + + protected translate(translation: string | Translation, defaultKey?: string): string { + if (translation == null && defaultKey == null) { + return null; + } + + if (translation == null) { + return this.i18nService.t(defaultKey); + } + + // Translation interface use implies we must localize. + if (typeof translation === "object") { + return this.i18nService.t(translation.key, ...(translation.placeholders ?? [])); + } + + return translation; + } } diff --git a/libs/components/src/dialog/index.ts b/libs/components/src/dialog/index.ts index fa6585a341..d63fa39b7b 100644 --- a/libs/components/src/dialog/index.ts +++ b/libs/components/src/dialog/index.ts @@ -1 +1,3 @@ export * from "./dialog.module"; +export * from "./simple-dialog/types"; +export * from "./dialog.service"; diff --git a/libs/components/src/dialog/simple-configurable-dialog/simple-configurable-dialog.component.html b/libs/components/src/dialog/simple-dialog/simple-configurable-dialog/simple-configurable-dialog.component.html similarity index 91% rename from libs/components/src/dialog/simple-configurable-dialog/simple-configurable-dialog.component.html rename to libs/components/src/dialog/simple-dialog/simple-configurable-dialog/simple-configurable-dialog.component.html index fd8b2e9017..cb916d8dba 100644 --- a/libs/components/src/dialog/simple-configurable-dialog/simple-configurable-dialog.component.html +++ b/libs/components/src/dialog/simple-dialog/simple-configurable-dialog/simple-configurable-dialog.component.html @@ -17,7 +17,7 @@ bitButton bitFormButton buttonType="secondary" - (click)="dialogRef.close(SimpleDialogCloseType.CANCEL)" + (click)="dialogRef.close(false)" > {{ cancelButtonText }} diff --git a/libs/components/src/dialog/simple-configurable-dialog/simple-configurable-dialog.component.ts b/libs/components/src/dialog/simple-dialog/simple-configurable-dialog/simple-configurable-dialog.component.ts similarity index 72% rename from libs/components/src/dialog/simple-configurable-dialog/simple-configurable-dialog.component.ts rename to libs/components/src/dialog/simple-dialog/simple-configurable-dialog/simple-configurable-dialog.component.ts index d8824cd7dd..f9acdbe8c6 100644 --- a/libs/components/src/dialog/simple-configurable-dialog/simple-configurable-dialog.component.ts +++ b/libs/components/src/dialog/simple-dialog/simple-configurable-dialog/simple-configurable-dialog.component.ts @@ -2,37 +2,30 @@ import { DialogRef, DIALOG_DATA } from "@angular/cdk/dialog"; import { Component, Inject } from "@angular/core"; import { FormGroup } from "@angular/forms"; -import { - SimpleDialogType, - SimpleDialogCloseType, - Translation, -} from "@bitwarden/angular/services/dialog"; -import { SimpleDialogOptions } from "@bitwarden/angular/services/dialog/simple-dialog-options"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; +import { SimpleDialogOptions, SimpleDialogType, Translation } from "../.."; + const DEFAULT_ICON: Record = { - [SimpleDialogType.PRIMARY]: "bwi-business", - [SimpleDialogType.SUCCESS]: "bwi-star", - [SimpleDialogType.INFO]: "bwi-info-circle", - [SimpleDialogType.WARNING]: "bwi-exclamation-triangle", - [SimpleDialogType.DANGER]: "bwi-error", + primary: "bwi-business", + success: "bwi-star", + info: "bwi-info-circle", + warning: "bwi-exclamation-triangle", + danger: "bwi-error", }; const DEFAULT_COLOR: Record = { - [SimpleDialogType.PRIMARY]: "tw-text-primary-500", - [SimpleDialogType.SUCCESS]: "tw-text-success", - [SimpleDialogType.INFO]: "tw-text-info", - [SimpleDialogType.WARNING]: "tw-text-warning", - [SimpleDialogType.DANGER]: "tw-text-danger", + primary: "tw-text-primary-500", + success: "tw-text-success", + info: "tw-text-info", + warning: "tw-text-warning", + danger: "tw-text-danger", }; @Component({ templateUrl: "./simple-configurable-dialog.component.html", }) export class SimpleConfigurableDialogComponent { - protected SimpleDialogType = SimpleDialogType; - protected SimpleDialogCloseType = SimpleDialogCloseType; - get iconClasses() { return [ this.simpleDialogOpts.icon ?? DEFAULT_ICON[this.simpleDialogOpts.type], @@ -61,7 +54,7 @@ export class SimpleConfigurableDialogComponent { await this.simpleDialogOpts.acceptAction(); } - this.dialogRef.close(SimpleDialogCloseType.ACCEPT); + this.dialogRef.close(true); }; private localizeText() { diff --git a/libs/components/src/dialog/simple-configurable-dialog/simple-configurable-dialog.service.stories.ts b/libs/components/src/dialog/simple-dialog/simple-configurable-dialog/simple-configurable-dialog.service.stories.ts similarity index 84% rename from libs/components/src/dialog/simple-configurable-dialog/simple-configurable-dialog.service.stories.ts rename to libs/components/src/dialog/simple-dialog/simple-configurable-dialog/simple-configurable-dialog.service.stories.ts index 0982db1ca7..81400537be 100644 --- a/libs/components/src/dialog/simple-configurable-dialog/simple-configurable-dialog.service.stories.ts +++ b/libs/components/src/dialog/simple-dialog/simple-configurable-dialog/simple-configurable-dialog.service.stories.ts @@ -1,17 +1,13 @@ import { Component } from "@angular/core"; import { Meta, StoryObj, applicationConfig, moduleMetadata } from "@storybook/angular"; -import { - SimpleDialogType, - SimpleDialogOptions, - DialogServiceAbstraction, -} from "@bitwarden/angular/services/dialog"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { ButtonModule } from "../../button"; -import { CalloutModule } from "../../callout"; -import { I18nMockService } from "../../utils/i18n-mock.service"; -import { DialogModule } from "../dialog.module"; +import { SimpleDialogOptions, DialogService } from "../.."; +import { ButtonModule } from "../../../button"; +import { CalloutModule } from "../../../callout"; +import { I18nMockService } from "../../../utils/i18n-mock.service"; +import { DialogModule } from "../../dialog.module"; @Component({ template: ` @@ -41,27 +37,27 @@ class StoryDialogComponent { { title: this.i18nService.t("primaryTypeSimpleDialog"), content: this.i18nService.t("dialogContent"), - type: SimpleDialogType.PRIMARY, + type: "primary", }, { title: this.i18nService.t("successTypeSimpleDialog"), content: this.i18nService.t("dialogContent"), - type: SimpleDialogType.SUCCESS, + type: "success", }, { title: this.i18nService.t("infoTypeSimpleDialog"), content: this.i18nService.t("dialogContent"), - type: SimpleDialogType.INFO, + type: "info", }, { title: this.i18nService.t("warningTypeSimpleDialog"), content: this.i18nService.t("dialogContent"), - type: SimpleDialogType.WARNING, + type: "warning", }, { title: this.i18nService.t("dangerTypeSimpleDialog"), content: this.i18nService.t("dialogContent"), - type: SimpleDialogType.DANGER, + type: "danger", }, ], }, @@ -71,21 +67,21 @@ class StoryDialogComponent { { title: this.i18nService.t("primaryTypeSimpleDialog"), content: this.i18nService.t("dialogContent"), - type: SimpleDialogType.PRIMARY, + type: "primary", acceptButtonText: "Ok", cancelButtonText: null, }, { title: this.i18nService.t("primaryTypeSimpleDialog"), content: this.i18nService.t("dialogContent"), - type: SimpleDialogType.PRIMARY, + type: "primary", acceptButtonText: this.i18nService.t("accept"), cancelButtonText: this.i18nService.t("decline"), }, { title: this.i18nService.t("primaryTypeSimpleDialog"), content: this.i18nService.t("dialogContent"), - type: SimpleDialogType.PRIMARY, + type: "primary", acceptButtonText: "Ok", }, ], @@ -96,7 +92,7 @@ class StoryDialogComponent { { title: this.i18nService.t("primaryTypeSimpleDialog"), content: this.i18nService.t("dialogContent"), - type: SimpleDialogType.PRIMARY, + type: "primary", icon: "bwi-family", }, ], @@ -107,7 +103,7 @@ class StoryDialogComponent { { title: this.i18nService.t("primaryTypeSimpleDialog"), content: this.i18nService.t("dialogContent"), - type: SimpleDialogType.PRIMARY, + type: "primary", disableClose: true, }, { @@ -116,7 +112,7 @@ class StoryDialogComponent { acceptAction: () => { return new Promise((resolve) => setTimeout(resolve, 10000)); }, - type: SimpleDialogType.PRIMARY, + type: "primary", }, ], }, @@ -126,7 +122,7 @@ class StoryDialogComponent { calloutType = "info"; dialogCloseResult: boolean; - constructor(public dialogService: DialogServiceAbstraction, private i18nService: I18nService) {} + constructor(public dialogService: DialogService, private i18nService: I18nService) {} async openSimpleConfigurableDialog(opts: SimpleDialogOptions) { this.dialogCloseResult = await this.dialogService.openSimpleDialog(opts); diff --git a/libs/components/src/dialog/simple-dialog.service.stories.ts b/libs/components/src/dialog/simple-dialog/simple-dialog.service.stories.ts similarity index 80% rename from libs/components/src/dialog/simple-dialog.service.stories.ts rename to libs/components/src/dialog/simple-dialog/simple-dialog.service.stories.ts index 5050af35b6..b6615184ec 100644 --- a/libs/components/src/dialog/simple-dialog.service.stories.ts +++ b/libs/components/src/dialog/simple-dialog/simple-dialog.service.stories.ts @@ -4,15 +4,15 @@ import { Meta, StoryObj, moduleMetadata } from "@storybook/angular"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { ButtonModule } from "../button"; -import { IconButtonModule } from "../icon-button"; -import { SharedModule } from "../shared/shared.module"; -import { I18nMockService } from "../utils/i18n-mock.service"; +import { ButtonModule } from "../../button"; +import { IconButtonModule } from "../../icon-button"; +import { SharedModule } from "../../shared/shared.module"; +import { I18nMockService } from "../../utils/i18n-mock.service"; +import { DialogService } from "../dialog.service"; +import { DialogCloseDirective } from "../directives/dialog-close.directive"; +import { DialogTitleContainerDirective } from "../directives/dialog-title-container.directive"; -import { DialogService } from "./dialog.service"; -import { DialogCloseDirective } from "./directives/dialog-close.directive"; -import { DialogTitleContainerDirective } from "./directives/dialog-title-container.directive"; -import { SimpleDialogComponent } from "./simple-dialog/simple-dialog.component"; +import { SimpleDialogComponent } from "./simple-dialog.component"; interface Animal { animal: string; diff --git a/libs/angular/src/services/dialog/simple-dialog-options.ts b/libs/components/src/dialog/simple-dialog/types.ts similarity index 89% rename from libs/angular/src/services/dialog/simple-dialog-options.ts rename to libs/components/src/dialog/simple-dialog/types.ts index aec6f00e32..4032b499cb 100644 --- a/libs/angular/src/services/dialog/simple-dialog-options.ts +++ b/libs/components/src/dialog/simple-dialog/types.ts @@ -1,5 +1,7 @@ -import { SimpleDialogType } from "./simple-dialog-type.enum"; -import { Translation } from "./translation"; +export interface Translation { + key: string; + placeholders?: Array; +} // Using type lets devs skip optional params w/out having to pass undefined. /** @@ -55,3 +57,5 @@ export type SimpleDialogOptions = { */ acceptAction?: () => Promise; }; + +export type SimpleDialogType = "primary" | "success" | "info" | "warning" | "danger"; diff --git a/libs/components/src/search/search.stories.ts b/libs/components/src/search/search.stories.ts index c68d611280..d4af6e676a 100644 --- a/libs/components/src/search/search.stories.ts +++ b/libs/components/src/search/search.stories.ts @@ -1,10 +1,10 @@ import { FormsModule, ReactiveFormsModule } from "@angular/forms"; import { Meta, StoryObj, moduleMetadata } from "@storybook/angular"; -import { JslibModule } from "@bitwarden/angular/jslib.module"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { InputModule } from "../input/input.module"; +import { SharedModule } from "../shared"; import { I18nMockService } from "../utils/i18n-mock.service"; import { SearchComponent } from "./search.component"; @@ -14,7 +14,7 @@ export default { component: SearchComponent, decorators: [ moduleMetadata({ - imports: [InputModule, FormsModule, ReactiveFormsModule, JslibModule], + imports: [SharedModule, InputModule, FormsModule, ReactiveFormsModule], providers: [ { provide: I18nService, diff --git a/libs/shared/tsconfig.libs.json b/libs/shared/tsconfig.libs.json index 28a1ccdfa4..18b7b1712a 100644 --- a/libs/shared/tsconfig.libs.json +++ b/libs/shared/tsconfig.libs.json @@ -5,6 +5,7 @@ "@bitwarden/angular/*": ["../angular/src/*"], "@bitwarden/auth": ["../auth/src/*"], "@bitwarden/common/*": ["../common/src/*"], + "@bitwarden/components": ["../components/src"], "@bitwarden/exporter/*": ["../exporter/src/*"], "@bitwarden/importer": ["../importer/src"], "@bitwarden/node/*": ["../node/src/*"]