diff --git a/apps/browser/src/_locales/en/messages.json b/apps/browser/src/_locales/en/messages.json index a5c204ffc99..2d229092787 100644 --- a/apps/browser/src/_locales/en/messages.json +++ b/apps/browser/src/_locales/en/messages.json @@ -5937,5 +5937,53 @@ }, "upgrade": { "message": "Upgrade" + }, + "leaveConfirmationDialogTitle": { + "message": "Are you sure you want to leave?" + }, + "leaveConfirmationDialogContentOne": { + "message": "By declining, your personal items will stay in your account, but you'll lose access to shared items and organization features." + }, + "leaveConfirmationDialogContentTwo": { + "message": "Contact your admin to regain access." + }, + "leaveConfirmationDialogConfirmButton": { + "message": "Leave $ORGANIZATION$", + "placeholders": { + "organization": { + "content": "$1", + "example": "My Org Name" + } + } + }, + "howToManageMyVault": { + "message": "How do I manage my vault?" + }, + "transferItemsToOrganizationTitle": { + "message": "Transfer items to $ORGANIZATION$", + "placeholders": { + "organization": { + "content": "$1", + "example": "My Org Name" + } + } + }, + "transferItemsToOrganizationContent": { + "message": "$ORGANIZATION$ is requiring all items to be owned by the organization for security and compliance. Click accept to transfer ownership of your items.", + "placeholders": { + "organization": { + "content": "$1", + "example": "My Org Name" + } + } + }, + "acceptTransfer": { + "message": "Accept transfer" + }, + "declineAndLeave": { + "message": "Decline and leave" + }, + "whyAmISeeingThis": { + "message": "Why am I seeing this?" } } diff --git a/apps/desktop/src/locales/en/messages.json b/apps/desktop/src/locales/en/messages.json index 4c3833e28c3..f6a679d9c7c 100644 --- a/apps/desktop/src/locales/en/messages.json +++ b/apps/desktop/src/locales/en/messages.json @@ -4383,5 +4383,53 @@ }, "upgrade": { "message": "Upgrade" + }, + "leaveConfirmationDialogTitle": { + "message": "Are you sure you want to leave?" + }, + "leaveConfirmationDialogContentOne": { + "message": "By declining, your personal items will stay in your account, but you'll lose access to shared items and organization features." + }, + "leaveConfirmationDialogContentTwo": { + "message": "Contact your admin to regain access." + }, + "leaveConfirmationDialogConfirmButton": { + "message": "Leave $ORGANIZATION$", + "placeholders": { + "organization": { + "content": "$1", + "example": "My Org Name" + } + } + }, + "howToManageMyVault": { + "message": "How do I manage my vault?" + }, + "transferItemsToOrganizationTitle": { + "message": "Transfer items to $ORGANIZATION$", + "placeholders": { + "organization": { + "content": "$1", + "example": "My Org Name" + } + } + }, + "transferItemsToOrganizationContent": { + "message": "$ORGANIZATION$ is requiring all items to be owned by the organization for security and compliance. Click accept to transfer ownership of your items.", + "placeholders": { + "organization": { + "content": "$1", + "example": "My Org Name" + } + } + }, + "acceptTransfer": { + "message": "Accept transfer" + }, + "declineAndLeave": { + "message": "Decline and leave" + }, + "whyAmISeeingThis": { + "message": "Why am I seeing this?" } } diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index 4be70b102d1..bbbf548b8e1 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -12287,5 +12287,53 @@ }, "sessionTimeoutSettingsSetUnlockMethodToChangeTimeoutAction": { "message": "Set an unlock method to change your timeout action" + }, + "leaveConfirmationDialogTitle": { + "message": "Are you sure you want to leave?" + }, + "leaveConfirmationDialogContentOne": { + "message": "By declining, your personal items will stay in your account, but you'll lose access to shared items and organization features." + }, + "leaveConfirmationDialogContentTwo": { + "message": "Contact your admin to regain access." + }, + "leaveConfirmationDialogConfirmButton": { + "message": "Leave $ORGANIZATION$", + "placeholders": { + "organization": { + "content": "$1", + "example": "My Org Name" + } + } + }, + "howToManageMyVault": { + "message": "How do I manage my vault?" + }, + "transferItemsToOrganizationTitle": { + "message": "Transfer items to $ORGANIZATION$", + "placeholders": { + "organization": { + "content": "$1", + "example": "My Org Name" + } + } + }, + "transferItemsToOrganizationContent": { + "message": "$ORGANIZATION$ is requiring all items to be owned by the organization for security and compliance. Click accept to transfer ownership of your items.", + "placeholders": { + "organization": { + "content": "$1", + "example": "My Org Name" + } + } + }, + "acceptTransfer": { + "message": "Accept transfer" + }, + "declineAndLeave": { + "message": "Decline and leave" + }, + "whyAmISeeingThis": { + "message": "Why am I seeing this?" } } diff --git a/libs/vault/src/components/vault-items-transfer/index.ts b/libs/vault/src/components/vault-items-transfer/index.ts new file mode 100644 index 00000000000..f2ffb9f9c22 --- /dev/null +++ b/libs/vault/src/components/vault-items-transfer/index.ts @@ -0,0 +1,13 @@ +export { + TransferItemsDialogComponent, + TransferItemsDialogParams, + TransferItemsDialogResult, + TransferItemsDialogResultType, +} from "./transfer-items-dialog.component"; + +export { + LeaveConfirmationDialogComponent, + LeaveConfirmationDialogParams, + LeaveConfirmationDialogResult, + LeaveConfirmationDialogResultType, +} from "./leave-confirmation-dialog.component"; diff --git a/libs/vault/src/components/vault-items-transfer/leave-confirmation-dialog.component.html b/libs/vault/src/components/vault-items-transfer/leave-confirmation-dialog.component.html new file mode 100644 index 00000000000..f0d644fecff --- /dev/null +++ b/libs/vault/src/components/vault-items-transfer/leave-confirmation-dialog.component.html @@ -0,0 +1,33 @@ + + + + {{ "leaveConfirmationDialogTitle" | i18n }} + + + + {{ "leaveConfirmationDialogContentOne" | i18n }} + + + {{ "leaveConfirmationDialogContentTwo" | i18n }} + + + + + + {{ "leaveConfirmationDialogConfirmButton" | i18n: organizationName }} + + + + {{ "goBack" | i18n }} + + + + {{ "howToManageMyVault" | i18n }} + + + + diff --git a/libs/vault/src/components/vault-items-transfer/leave-confirmation-dialog.component.ts b/libs/vault/src/components/vault-items-transfer/leave-confirmation-dialog.component.ts new file mode 100644 index 00000000000..bd32a1ea6dd --- /dev/null +++ b/libs/vault/src/components/vault-items-transfer/leave-confirmation-dialog.component.ts @@ -0,0 +1,64 @@ +import { ChangeDetectionStrategy, Component, inject } from "@angular/core"; + +import { JslibModule } from "@bitwarden/angular/jslib.module"; +import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { UnionOfValues } from "@bitwarden/common/vault/types/union-of-values"; +import { + DIALOG_DATA, + DialogConfig, + DialogRef, + DialogService, + ButtonModule, + DialogModule, + LinkModule, + TypographyModule, +} from "@bitwarden/components"; + +export interface LeaveConfirmationDialogParams { + organizationName: string; +} + +export const LeaveConfirmationDialogResult = Object.freeze({ + /** + * User confirmed they want to leave the organization. + */ + Confirmed: "confirmed", + /** + * User chose to go back instead of leaving the organization. + */ + Back: "back", +} as const); + +export type LeaveConfirmationDialogResultType = UnionOfValues; + +@Component({ + templateUrl: "./leave-confirmation-dialog.component.html", + changeDetection: ChangeDetectionStrategy.OnPush, + imports: [ButtonModule, DialogModule, LinkModule, TypographyModule, JslibModule], +}) +export class LeaveConfirmationDialogComponent { + private readonly params = inject(DIALOG_DATA); + private readonly dialogRef = inject(DialogRef); + private readonly platformUtilsService = inject(PlatformUtilsService); + + protected readonly organizationName = this.params.organizationName; + + protected confirmLeave() { + this.dialogRef.close(LeaveConfirmationDialogResult.Confirmed); + } + + protected goBack() { + this.dialogRef.close(LeaveConfirmationDialogResult.Back); + } + + protected openLearnMore(e: Event) { + e.preventDefault(); + this.platformUtilsService.launchUri("https://bitwarden.com/help/transfer-ownership/"); + } + + static open(dialogService: DialogService, config: DialogConfig) { + return dialogService.open(LeaveConfirmationDialogComponent, { + ...config, + }); + } +} diff --git a/libs/vault/src/components/vault-items-transfer/transfer-items-dialog.component.html b/libs/vault/src/components/vault-items-transfer/transfer-items-dialog.component.html new file mode 100644 index 00000000000..0b77d4ba7d8 --- /dev/null +++ b/libs/vault/src/components/vault-items-transfer/transfer-items-dialog.component.html @@ -0,0 +1,22 @@ + + {{ "transferItemsToOrganizationTitle" | i18n: organizationName }} + + + {{ "transferItemsToOrganizationContent" | i18n: organizationName }} + + + + + {{ "acceptTransfer" | i18n }} + + + + {{ "declineAndLeave" | i18n }} + + + + {{ "whyAmISeeingThis" | i18n }} + + + + diff --git a/libs/vault/src/components/vault-items-transfer/transfer-items-dialog.component.ts b/libs/vault/src/components/vault-items-transfer/transfer-items-dialog.component.ts new file mode 100644 index 00000000000..f28ad2ab3ec --- /dev/null +++ b/libs/vault/src/components/vault-items-transfer/transfer-items-dialog.component.ts @@ -0,0 +1,64 @@ +import { ChangeDetectionStrategy, Component, inject } from "@angular/core"; + +import { JslibModule } from "@bitwarden/angular/jslib.module"; +import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { UnionOfValues } from "@bitwarden/common/vault/types/union-of-values"; +import { + DIALOG_DATA, + DialogConfig, + DialogRef, + DialogService, + ButtonModule, + DialogModule, + LinkModule, + TypographyModule, +} from "@bitwarden/components"; + +export interface TransferItemsDialogParams { + organizationName: string; +} + +export const TransferItemsDialogResult = Object.freeze({ + /** + * User accepted the transfer of items. + */ + Accepted: "accepted", + /** + * User declined the transfer of items. + */ + Declined: "declined", +} as const); + +export type TransferItemsDialogResultType = UnionOfValues; + +@Component({ + templateUrl: "./transfer-items-dialog.component.html", + changeDetection: ChangeDetectionStrategy.OnPush, + imports: [ButtonModule, DialogModule, LinkModule, TypographyModule, JslibModule], +}) +export class TransferItemsDialogComponent { + private readonly params = inject(DIALOG_DATA); + private readonly dialogRef = inject(DialogRef); + private readonly platformUtilsService = inject(PlatformUtilsService); + + protected readonly organizationName = this.params.organizationName; + + protected acceptTransfer() { + this.dialogRef.close(TransferItemsDialogResult.Accepted); + } + + protected decline() { + this.dialogRef.close(TransferItemsDialogResult.Declined); + } + + protected openLearnMore(e: Event) { + e.preventDefault(); + this.platformUtilsService.launchUri("https://bitwarden.com/help/transfer-ownership/"); + } + + static open(dialogService: DialogService, config: DialogConfig) { + return dialogService.open(TransferItemsDialogComponent, { + ...config, + }); + } +} diff --git a/libs/vault/src/index.ts b/libs/vault/src/index.ts index 93a72ba14e0..be0daad3637 100644 --- a/libs/vault/src/index.ts +++ b/libs/vault/src/index.ts @@ -29,6 +29,7 @@ export * from "./components/add-edit-folder-dialog/add-edit-folder-dialog.compon export * from "./components/carousel"; export * from "./components/new-cipher-menu/new-cipher-menu.component"; export * from "./components/permit-cipher-details-popover/permit-cipher-details-popover.component"; +export * from "./components/vault-items-transfer"; export { DefaultSshImportPromptService } from "./services/default-ssh-import-prompt.service"; export { SshImportPromptService } from "./services/ssh-import-prompt.service";
+ {{ "leaveConfirmationDialogContentOne" | i18n }} +
+ {{ "leaveConfirmationDialogContentTwo" | i18n }} +