1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-19 10:54:00 +00:00

[PM-26901] Add notification handler for auto confirm (#18886)

* add notification handler for auto confirm

* add missing state check

* fix test

* isolate angular specific code from shared lib code

* clean up

* use autoconfirm method

* fix test
This commit is contained in:
Brandon Treston
2026-02-13 14:36:11 -05:00
committed by GitHub
parent 10a20a43a3
commit 2912bf05e1
25 changed files with 257 additions and 52 deletions

View File

@@ -0,0 +1,78 @@
import { DialogRef } from "@angular/cdk/dialog";
import { CommonModule } from "@angular/common";
import { ChangeDetectionStrategy, Component } from "@angular/core";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import {
BadgeComponent,
ButtonModule,
CenterPositionStrategy,
DialogModule,
DialogService,
} from "@bitwarden/components";
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<bit-simple-dialog dialogSize="small" hideIcon>
<div class="tw-flex tw-flex-col tw-justify-start" bitDialogTitle>
<div class="tw-flex tw-justify-start tw-pb-2">
<span bitBadge variant="info"> {{ "availableNow" | i18n }}</span>
</div>
<div class="tw-flex tw-flex-col">
<h3 class="tw-text-start">
<strong>
{{ "autoConfirmSetup" | i18n }}
</strong>
</h3>
<span class="tw-overflow-y-auto tw-text-start tw-break-words tw-hyphens-auto tw-text-sm">
{{ "autoConfirmSetupDesc" | i18n }}
</span>
</div>
</div>
<ng-container bitDialogFooter>
<div class="tw-flex tw-flex-col tw-justify-center">
<button
class="tw-mb-2"
type="button"
bitButton
buttonType="primary"
(click)="dialogRef.close(true)"
>
{{ "turnOn" | i18n }}
</button>
<button
class="tw-mb-4"
type="button"
bitButton
buttonType="secondary"
(click)="dialogRef.close(false)"
>
{{ "close" | i18n }}
</button>
<a
class="tw-text-sm tw-text-center"
bitLink
href="https://bitwarden.com/help/automatic-confirmation/"
target="_blank"
>
<strong class="tw-pr-1">
{{ "autoConfirmSetupHint" | i18n }}
</strong>
<i class="bwi bwi-external-link bwi-fw"></i>
</a>
</div>
</ng-container>
</bit-simple-dialog>
`,
imports: [ButtonModule, DialogModule, CommonModule, JslibModule, BadgeComponent],
})
export class AutoConfirmExtensionSetupDialogComponent {
constructor(public dialogRef: DialogRef<boolean>) {}
static open(dialogService: DialogService) {
return dialogService.open<boolean>(AutoConfirmExtensionSetupDialogComponent, {
positionStrategy: new CenterPositionStrategy(),
});
}
}

View File

@@ -0,0 +1,25 @@
<bit-simple-dialog dialogSize="small">
<span bitDialogTitle>
<strong>{{ "warningCapitalized" | i18n }}</strong>
</span>
<span bitDialogContent>
{{ "autoConfirmWarning" | i18n }}
<a
bitLink
href="https://bitwarden.com/help/automatic-confirmation/"
target="_blank"
rel="noopener noreferrer"
>
{{ "autoConfirmWarningLink" | i18n }}
<i class="bwi bwi-external-link bwi-fw"></i>
</a>
</span>
<ng-container bitDialogFooter>
<button type="button" bitButton buttonType="primary" (click)="dialogRef.close(true)">
{{ "turnOn" | i18n }}
</button>
<button type="button" bitButton buttonType="secondary" (click)="dialogRef.close(false)">
{{ "close" | i18n }}
</button>
</ng-container>
</bit-simple-dialog>

View File

@@ -0,0 +1,26 @@
import { DialogRef } from "@angular/cdk/dialog";
import { CommonModule } from "@angular/common";
import { ChangeDetectionStrategy, Component } from "@angular/core";
import {
ButtonModule,
CenterPositionStrategy,
DialogModule,
DialogService,
} from "@bitwarden/components";
import { I18nPipe } from "@bitwarden/ui-common";
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: "./auto-confirm-warning-dialog.component.html",
imports: [ButtonModule, DialogModule, CommonModule, I18nPipe],
})
export class AutoConfirmWarningDialogComponent {
constructor(public dialogRef: DialogRef<boolean>) {}
static open(dialogService: DialogService) {
return dialogService.open<boolean>(AutoConfirmWarningDialogComponent, {
positionStrategy: new CenterPositionStrategy(),
});
}
}

View File

@@ -0,0 +1,2 @@
export * from "./auto-confirm-extension-dialog.component";
export * from "./auto-confirm-warning-dialog.component";