From ec7c3878c9ccd2798c1c14b00fafacf22c8eaa98 Mon Sep 17 00:00:00 2001 From: Tom <144813356+ttalty@users.noreply.github.com> Date: Mon, 22 Jan 2024 11:05:31 -0500 Subject: [PATCH] Tools/pm 4440 replace lastpass sso dialog (#7608) * Initial implementation of simple dialog * Updating buttons and dialog type * Set the cancel text normally * Removing the lastpass sso dialog component --- .../src/components/lastpass/dialog/index.ts | 1 - .../lastpass-await-sso-dialog.component.html | 14 -------------- .../dialog/lastpass-await-sso-dialog.component.ts | 15 --------------- .../lastpass/lastpass-direct-import.service.ts | 12 ++++++++++-- 4 files changed, 10 insertions(+), 32 deletions(-) delete mode 100644 libs/importer/src/components/lastpass/dialog/lastpass-await-sso-dialog.component.html delete mode 100644 libs/importer/src/components/lastpass/dialog/lastpass-await-sso-dialog.component.ts diff --git a/libs/importer/src/components/lastpass/dialog/index.ts b/libs/importer/src/components/lastpass/dialog/index.ts index 1313b979ab..de0694a990 100644 --- a/libs/importer/src/components/lastpass/dialog/index.ts +++ b/libs/importer/src/components/lastpass/dialog/index.ts @@ -1,3 +1,2 @@ -export { LastPassAwaitSSODialogComponent } from "./lastpass-await-sso-dialog.component"; export { LastPassMultifactorPromptComponent } from "./lastpass-multifactor-prompt.component"; export { LastPassPasswordPromptComponent } from "./lastpass-password-prompt.component"; diff --git a/libs/importer/src/components/lastpass/dialog/lastpass-await-sso-dialog.component.html b/libs/importer/src/components/lastpass/dialog/lastpass-await-sso-dialog.component.html deleted file mode 100644 index a1a5b28ba9..0000000000 --- a/libs/importer/src/components/lastpass/dialog/lastpass-await-sso-dialog.component.html +++ /dev/null @@ -1,14 +0,0 @@ - -
- -
- {{ "awaitingSSO" | i18n }} - - {{ "awaitingSSODesc" | i18n }} - - - - -
diff --git a/libs/importer/src/components/lastpass/dialog/lastpass-await-sso-dialog.component.ts b/libs/importer/src/components/lastpass/dialog/lastpass-await-sso-dialog.component.ts deleted file mode 100644 index bceed5e6ff..0000000000 --- a/libs/importer/src/components/lastpass/dialog/lastpass-await-sso-dialog.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component } from "@angular/core"; - -import { JslibModule } from "@bitwarden/angular/jslib.module"; -import { ButtonModule, DialogModule, DialogService } from "@bitwarden/components"; - -@Component({ - templateUrl: "lastpass-await-sso-dialog.component.html", - standalone: true, - imports: [JslibModule, ButtonModule, DialogModule], -}) -export class LastPassAwaitSSODialogComponent { - static open(dialogService: DialogService) { - return dialogService.open(LastPassAwaitSSODialogComponent); - } -} diff --git a/libs/importer/src/components/lastpass/lastpass-direct-import.service.ts b/libs/importer/src/components/lastpass/lastpass-direct-import.service.ts index 9c40530d38..a2dd5383a9 100644 --- a/libs/importer/src/components/lastpass/lastpass-direct-import.service.ts +++ b/libs/importer/src/components/lastpass/lastpass-direct-import.service.ts @@ -8,6 +8,7 @@ import { AppIdService } from "@bitwarden/common/platform/abstractions/app-id.ser import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service"; import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; 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 { Utils } from "@bitwarden/common/platform/misc/utils"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; @@ -16,7 +17,6 @@ import { DialogService } from "../../../../components/src/dialog"; import { ClientInfo, Vault } from "../../importers/lastpass/access"; import { FederatedUserContext } from "../../importers/lastpass/access/models"; -import { LastPassAwaitSSODialogComponent } from "./dialog/lastpass-await-sso-dialog.component"; import { LastPassPasswordPromptComponent } from "./dialog/lastpass-password-prompt.component"; import { LastPassDirectImportUIService } from "./lastpass-direct-import-ui.service"; @@ -42,6 +42,7 @@ export class LastPassDirectImportService { private broadcasterService: BroadcasterService, private ngZone: NgZone, private dialogService: DialogService, + private i18nService: I18nService, ) { this.vault = new Vault(this.cryptoFunctionService, this.tokenService); @@ -96,7 +97,14 @@ export class LastPassDirectImportService { const request = await this.createOidcSigninRequest(email); this.platformUtilsService.launchUri(request.url); - const cancelDialogRef = LastPassAwaitSSODialogComponent.open(this.dialogService); + const cancelDialogRef = this.dialogService.openSimpleDialogRef({ + title: this.i18nService.t("awaitingSSO"), + content: this.i18nService.t("awaitingSSODesc"), + type: "warning", + icon: "bwi-key", + acceptButtonText: this.i18nService.t("cancel"), + cancelButtonText: null, + }); const cancelled = firstValueFrom(cancelDialogRef.closed).then((_didCancel) => { throw Error("SSO auth cancelled"); });