mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
remove vault component presentational updates
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
[ciphers]="ciphers"
|
[ciphers]="ciphers"
|
||||||
[title]="'autofillSuggestions' | i18n"
|
[title]="'autofillSuggestions' | i18n"
|
||||||
[showRefresh]="showRefresh"
|
[showRefresh]="showRefresh"
|
||||||
[sectionIndicators]="sectionIndicators"
|
|
||||||
(onRefresh)="refreshCurrentTab()"
|
(onRefresh)="refreshCurrentTab()"
|
||||||
[description]="(showEmptyAutofillTip$ | async) ? ('autofillSuggestionsTip' | i18n) : null"
|
[description]="(showEmptyAutofillTip$ | async) ? ('autofillSuggestionsTip' | i18n) : null"
|
||||||
showAutofillButton
|
showAutofillButton
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { CommonModule } from "@angular/common";
|
import { CommonModule } from "@angular/common";
|
||||||
import { Component, Input, OnInit } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { combineLatest, firstValueFrom, map, Observable } from "rxjs";
|
import { combineLatest, firstValueFrom, map, Observable } from "rxjs";
|
||||||
|
|
||||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||||
import { VaultSettingsService } from "@bitwarden/common/vault/abstractions/vault-settings/vault-settings.service";
|
import { VaultSettingsService } from "@bitwarden/common/vault/abstractions/vault-settings/vault-settings.service";
|
||||||
import { CipherType } from "@bitwarden/common/vault/enums";
|
import { CipherType } from "@bitwarden/common/vault/enums";
|
||||||
import { IconButtonModule, TypographyModule } from "@bitwarden/components";
|
import {
|
||||||
|
IconButtonModule,
|
||||||
|
SectionComponent,
|
||||||
|
SectionHeaderComponent,
|
||||||
|
TypographyModule,
|
||||||
|
} from "@bitwarden/components";
|
||||||
|
|
||||||
import BrowserPopupUtils from "../../../../../platform/popup/browser-popup-utils";
|
import BrowserPopupUtils from "../../../../../platform/popup/browser-popup-utils";
|
||||||
import { VaultPopupAutofillService } from "../../../services/vault-popup-autofill.service";
|
import { VaultPopupAutofillService } from "../../../services/vault-popup-autofill.service";
|
||||||
@@ -17,9 +22,11 @@ import { VaultListItemsContainerComponent } from "../vault-list-items-container/
|
|||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
|
SectionComponent,
|
||||||
TypographyModule,
|
TypographyModule,
|
||||||
VaultListItemsContainerComponent,
|
VaultListItemsContainerComponent,
|
||||||
JslibModule,
|
JslibModule,
|
||||||
|
SectionHeaderComponent,
|
||||||
IconButtonModule,
|
IconButtonModule,
|
||||||
],
|
],
|
||||||
selector: "app-autofill-vault-list-items",
|
selector: "app-autofill-vault-list-items",
|
||||||
@@ -41,11 +48,6 @@ export class AutofillVaultListItemsComponent implements OnInit {
|
|||||||
|
|
||||||
clickItemsToAutofillVaultView = false;
|
clickItemsToAutofillVaultView = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicators for the section.
|
|
||||||
*/
|
|
||||||
@Input() sectionIndicators: string[] = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Observable that determines whether the empty autofill tip should be shown.
|
* Observable that determines whether the empty autofill tip should be shown.
|
||||||
* The tip is shown when there are no login ciphers to autofill, no filter is applied, and autofill is allowed in
|
* The tip is shown when there are no login ciphers to autofill, no filter is applied, and autofill is allowed in
|
||||||
|
|||||||
@@ -3,11 +3,6 @@
|
|||||||
<bit-section-header>
|
<bit-section-header>
|
||||||
<h2 bitTypography="h6">
|
<h2 bitTypography="h6">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
<i
|
|
||||||
*ngIf="showAutofillBlockedIndicator"
|
|
||||||
class="bwi bwi-info-circle"
|
|
||||||
[appA11yTitle]="'autofillBlockedTooltip' | i18n"
|
|
||||||
></i>
|
|
||||||
</h2>
|
</h2>
|
||||||
<button
|
<button
|
||||||
*ngIf="showRefresh"
|
*ngIf="showRefresh"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
Output,
|
Output,
|
||||||
signal,
|
signal,
|
||||||
} from "@angular/core";
|
} from "@angular/core";
|
||||||
import { Router } from "@angular/router";
|
import { Router, RouterLink } from "@angular/router";
|
||||||
import { map } from "rxjs";
|
import { map } from "rxjs";
|
||||||
|
|
||||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||||
@@ -50,6 +50,7 @@ import { ItemMoreOptionsComponent } from "../item-more-options/item-more-options
|
|||||||
TypographyModule,
|
TypographyModule,
|
||||||
JslibModule,
|
JslibModule,
|
||||||
SectionHeaderComponent,
|
SectionHeaderComponent,
|
||||||
|
RouterLink,
|
||||||
ItemCopyActionsComponent,
|
ItemCopyActionsComponent,
|
||||||
ItemMoreOptionsComponent,
|
ItemMoreOptionsComponent,
|
||||||
OrgIconDirective,
|
OrgIconDirective,
|
||||||
@@ -80,8 +81,6 @@ export class VaultListItemsContainerComponent implements AfterViewInit {
|
|||||||
map((enabled) => (enabled ? 53 : 59)),
|
map((enabled) => (enabled ? 53 : 59)),
|
||||||
);
|
);
|
||||||
|
|
||||||
protected showAutofillBlockedIndicator = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timeout used to add a small delay when selecting a cipher to allow for double click to launch
|
* Timeout used to add a small delay when selecting a cipher to allow for double click to launch
|
||||||
* @private
|
* @private
|
||||||
@@ -100,11 +99,6 @@ export class VaultListItemsContainerComponent implements AfterViewInit {
|
|||||||
@Input()
|
@Input()
|
||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicators for the section.
|
|
||||||
*/
|
|
||||||
@Input() sectionIndicators: string[] = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional description for the vault list item section. Will be shown below the title even when
|
* Optional description for the vault list item section. Will be shown below the title even when
|
||||||
* no ciphers are available.
|
* no ciphers are available.
|
||||||
@@ -176,10 +170,6 @@ export class VaultListItemsContainerComponent implements AfterViewInit {
|
|||||||
|
|
||||||
this.autofillShortcutTooltip.set(`${autofillTitle} ${autofillShortcut}`);
|
this.autofillShortcutTooltip.set(`${autofillTitle} ${autofillShortcut}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.showAutofillBlockedIndicator = !!this.sectionIndicators?.find(
|
|
||||||
(i) => i === "autofillDisabled",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,16 +22,6 @@
|
|||||||
</bit-no-items>
|
</bit-no-items>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<bit-banner
|
|
||||||
*ngIf="vaultState !== VaultStateEnum.Empty && showScriptInjectionIsBlockedBanner"
|
|
||||||
id="domain-script-injection-blocked-banner"
|
|
||||||
bannerType="info"
|
|
||||||
slot="full-width-notice"
|
|
||||||
(onClose)="handleScriptInjectionIsBlockedBannerDismiss()"
|
|
||||||
>
|
|
||||||
{{ "autofillBlockedNotice" | i18n }}
|
|
||||||
</bit-banner>
|
|
||||||
|
|
||||||
<!-- Show search & filters outside of the scroll area of the page -->
|
<!-- Show search & filters outside of the scroll area of the page -->
|
||||||
<ng-container
|
<ng-container
|
||||||
slot="above-scroll-area"
|
slot="above-scroll-area"
|
||||||
@@ -71,9 +61,7 @@
|
|||||||
cdkVirtualScrollingElement
|
cdkVirtualScrollingElement
|
||||||
class="tw-h-full tw-p-3 bit-compact:tw-p-2 tw-styled-scrollbar"
|
class="tw-h-full tw-p-3 bit-compact:tw-p-2 tw-styled-scrollbar"
|
||||||
>
|
>
|
||||||
<app-autofill-vault-list-items
|
<app-autofill-vault-list-items></app-autofill-vault-list-items>
|
||||||
[sectionIndicators]="sectionIndicators"
|
|
||||||
></app-autofill-vault-list-items>
|
|
||||||
<app-vault-list-items-container
|
<app-vault-list-items-container
|
||||||
[title]="'favorites' | i18n"
|
[title]="'favorites' | i18n"
|
||||||
[ciphers]="favoriteCiphers$ | async"
|
[ciphers]="favoriteCiphers$ | async"
|
||||||
|
|||||||
@@ -2,20 +2,19 @@ import { ScrollingModule } from "@angular/cdk/scrolling";
|
|||||||
import { CommonModule } from "@angular/common";
|
import { CommonModule } from "@angular/common";
|
||||||
import { Component, OnDestroy, OnInit } from "@angular/core";
|
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||||
import { combineLatest, firstValueFrom, Observable, shareReplay, switchMap } from "rxjs";
|
import { RouterLink } from "@angular/router";
|
||||||
|
import { combineLatest, Observable, shareReplay, switchMap } from "rxjs";
|
||||||
|
|
||||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||||
import { DomainSettingsService } from "@bitwarden/common/autofill/services/domain-settings.service";
|
|
||||||
import { CollectionId, OrganizationId } from "@bitwarden/common/types/guid";
|
import { CollectionId, OrganizationId } from "@bitwarden/common/types/guid";
|
||||||
import { CipherType } from "@bitwarden/common/vault/enums";
|
import { CipherType } from "@bitwarden/common/vault/enums";
|
||||||
import { BannerModule, ButtonModule, Icons, NoItemsModule } from "@bitwarden/components";
|
import { ButtonModule, Icons, NoItemsModule } from "@bitwarden/components";
|
||||||
import { VaultIcons } from "@bitwarden/vault";
|
import { VaultIcons } from "@bitwarden/vault";
|
||||||
|
|
||||||
import { CurrentAccountComponent } from "../../../../auth/popup/account-switching/current-account.component";
|
import { CurrentAccountComponent } from "../../../../auth/popup/account-switching/current-account.component";
|
||||||
import { PopOutComponent } from "../../../../platform/popup/components/pop-out.component";
|
import { PopOutComponent } from "../../../../platform/popup/components/pop-out.component";
|
||||||
import { PopupHeaderComponent } from "../../../../platform/popup/layout/popup-header.component";
|
import { PopupHeaderComponent } from "../../../../platform/popup/layout/popup-header.component";
|
||||||
import { PopupPageComponent } from "../../../../platform/popup/layout/popup-page.component";
|
import { PopupPageComponent } from "../../../../platform/popup/layout/popup-page.component";
|
||||||
import { VaultPopupAutofillService } from "../../services/vault-popup-autofill.service";
|
|
||||||
import { VaultPopupItemsService } from "../../services/vault-popup-items.service";
|
import { VaultPopupItemsService } from "../../services/vault-popup-items.service";
|
||||||
import { VaultPopupListFiltersService } from "../../services/vault-popup-list-filters.service";
|
import { VaultPopupListFiltersService } from "../../services/vault-popup-list-filters.service";
|
||||||
import { VaultUiOnboardingService } from "../../services/vault-ui-onboarding.service";
|
import { VaultUiOnboardingService } from "../../services/vault-ui-onboarding.service";
|
||||||
@@ -48,8 +47,8 @@ enum VaultState {
|
|||||||
CommonModule,
|
CommonModule,
|
||||||
AutofillVaultListItemsComponent,
|
AutofillVaultListItemsComponent,
|
||||||
VaultListItemsContainerComponent,
|
VaultListItemsContainerComponent,
|
||||||
BannerModule,
|
|
||||||
ButtonModule,
|
ButtonModule,
|
||||||
|
RouterLink,
|
||||||
NewItemDropdownV2Component,
|
NewItemDropdownV2Component,
|
||||||
ScrollingModule,
|
ScrollingModule,
|
||||||
VaultHeaderV2Component,
|
VaultHeaderV2Component,
|
||||||
@@ -62,10 +61,6 @@ export class VaultV2Component implements OnInit, OnDestroy {
|
|||||||
protected favoriteCiphers$ = this.vaultPopupItemsService.favoriteCiphers$;
|
protected favoriteCiphers$ = this.vaultPopupItemsService.favoriteCiphers$;
|
||||||
protected remainingCiphers$ = this.vaultPopupItemsService.remainingCiphers$;
|
protected remainingCiphers$ = this.vaultPopupItemsService.remainingCiphers$;
|
||||||
protected loading$ = this.vaultPopupItemsService.loading$;
|
protected loading$ = this.vaultPopupItemsService.loading$;
|
||||||
protected scriptInjectionIsBlocked = false;
|
|
||||||
protected showScriptInjectionIsBlockedBanner = false;
|
|
||||||
protected autofillTabHostname: string | null = null;
|
|
||||||
protected sectionIndicators: string[] = [];
|
|
||||||
|
|
||||||
protected newItemItemValues$: Observable<NewItemInitialValues> =
|
protected newItemItemValues$: Observable<NewItemInitialValues> =
|
||||||
this.vaultPopupListFiltersService.filters$.pipe(
|
this.vaultPopupListFiltersService.filters$.pipe(
|
||||||
@@ -93,8 +88,6 @@ export class VaultV2Component implements OnInit, OnDestroy {
|
|||||||
constructor(
|
constructor(
|
||||||
private vaultPopupItemsService: VaultPopupItemsService,
|
private vaultPopupItemsService: VaultPopupItemsService,
|
||||||
private vaultPopupListFiltersService: VaultPopupListFiltersService,
|
private vaultPopupListFiltersService: VaultPopupListFiltersService,
|
||||||
private domainSettingsService: DomainSettingsService,
|
|
||||||
private vaultPopupAutofillService: VaultPopupAutofillService,
|
|
||||||
private vaultUiOnboardingService: VaultUiOnboardingService,
|
private vaultUiOnboardingService: VaultUiOnboardingService,
|
||||||
) {
|
) {
|
||||||
combineLatest([
|
combineLatest([
|
||||||
@@ -119,31 +112,6 @@ export class VaultV2Component implements OnInit, OnDestroy {
|
|||||||
this.vaultState = null;
|
this.vaultState = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
combineLatest([
|
|
||||||
this.domainSettingsService.blockedInteractionsUris$,
|
|
||||||
this.vaultPopupAutofillService.currentAutofillTab$,
|
|
||||||
])
|
|
||||||
.pipe(takeUntilDestroyed())
|
|
||||||
.subscribe(([blockedInteractionsUris, currentAutofillTab]) => {
|
|
||||||
if (blockedInteractionsUris && currentAutofillTab?.url?.length) {
|
|
||||||
const autofillTabURL = new URL(currentAutofillTab.url);
|
|
||||||
this.autofillTabHostname = autofillTabURL.hostname;
|
|
||||||
const autofillTabIsBlocked = Object.keys(blockedInteractionsUris).includes(
|
|
||||||
autofillTabURL.hostname,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.scriptInjectionIsBlocked = autofillTabIsBlocked;
|
|
||||||
|
|
||||||
if (autofillTabIsBlocked) {
|
|
||||||
this.sectionIndicators.push("autofillDisabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.showScriptInjectionIsBlockedBanner =
|
|
||||||
autofillTabIsBlocked &&
|
|
||||||
!blockedInteractionsUris[autofillTabURL.hostname]?.bannerIsDismissed;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -151,26 +119,4 @@ export class VaultV2Component implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {}
|
ngOnDestroy(): void {}
|
||||||
|
|
||||||
handleScriptInjectionIsBlockedBannerDismiss() {
|
|
||||||
if (!this.autofillTabHostname) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
void firstValueFrom(this.domainSettingsService.blockedInteractionsUris$).then(
|
|
||||||
(blockedURIs) => {
|
|
||||||
this.showScriptInjectionIsBlockedBanner = false;
|
|
||||||
void this.domainSettingsService.setBlockedInteractionsUris({
|
|
||||||
...blockedURIs,
|
|
||||||
[this.autofillTabHostname as string]: { bannerIsDismissed: true },
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error(
|
|
||||||
"There was a problem dismissing the blocked interaction URI notification banner",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user