mirror of
https://github.com/bitwarden/browser
synced 2026-02-21 20:04:02 +00:00
* [PM-27675] Integrate dialogs into VaultItemTransferService * [PM-27675] Update tests for new dialogs * [PM-27675] Center dialogs and prevent closing with escape or pointer events * [PM-27675] Add transferInProgress$ observable to VaultItemsTransferService * [PM-27675] Hook vault item transfer service into browser vault component * [PM-27675] Move defaultUserCollection$ to collection service * [PM-27675] Cleanup dialog styles * [PM-27675] Introduce readySubject to popup vault component to keep prevent flashing content while item transfer is in progress * [PM-27675] Fix vault-v2 tests
68 lines
2.1 KiB
TypeScript
68 lines
2.1 KiB
TypeScript
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,
|
|
CenterPositionStrategy,
|
|
} 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<typeof LeaveConfirmationDialogResult>;
|
|
|
|
@Component({
|
|
templateUrl: "./leave-confirmation-dialog.component.html",
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
imports: [ButtonModule, DialogModule, LinkModule, TypographyModule, JslibModule],
|
|
})
|
|
export class LeaveConfirmationDialogComponent {
|
|
private readonly params = inject<LeaveConfirmationDialogParams>(DIALOG_DATA);
|
|
private readonly dialogRef = inject(DialogRef<LeaveConfirmationDialogResultType>);
|
|
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<LeaveConfirmationDialogParams>) {
|
|
return dialogService.open<LeaveConfirmationDialogResultType>(LeaveConfirmationDialogComponent, {
|
|
positionStrategy: new CenterPositionStrategy(),
|
|
disableClose: true,
|
|
...config,
|
|
});
|
|
}
|
|
}
|