mirror of
https://github.com/bitwarden/browser.git
synced 2025-03-02 03:41:09 +01:00
remove vault component presentational updates
This commit is contained in:
parent
f408574322
commit
fe40dd8464
@ -3,7 +3,6 @@
|
||||
[ciphers]="ciphers"
|
||||
[title]="'autofillSuggestions' | i18n"
|
||||
[showRefresh]="showRefresh"
|
||||
[sectionIndicators]="sectionIndicators"
|
||||
(onRefresh)="refreshCurrentTab()"
|
||||
[description]="(showEmptyAutofillTip$ | async) ? ('autofillSuggestionsTip' | i18n) : null"
|
||||
showAutofillButton
|
||||
|
@ -1,11 +1,16 @@
|
||||
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 { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||
import { VaultSettingsService } from "@bitwarden/common/vault/abstractions/vault-settings/vault-settings.service";
|
||||
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 { VaultPopupAutofillService } from "../../../services/vault-popup-autofill.service";
|
||||
@ -17,9 +22,11 @@ import { VaultListItemsContainerComponent } from "../vault-list-items-container/
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
SectionComponent,
|
||||
TypographyModule,
|
||||
VaultListItemsContainerComponent,
|
||||
JslibModule,
|
||||
SectionHeaderComponent,
|
||||
IconButtonModule,
|
||||
],
|
||||
selector: "app-autofill-vault-list-items",
|
||||
@ -41,11 +48,6 @@ export class AutofillVaultListItemsComponent implements OnInit {
|
||||
|
||||
clickItemsToAutofillVaultView = false;
|
||||
|
||||
/**
|
||||
* Indicators for the section.
|
||||
*/
|
||||
@Input() sectionIndicators: string[] = [];
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -3,11 +3,6 @@
|
||||
<bit-section-header>
|
||||
<h2 bitTypography="h6">
|
||||
{{ title }}
|
||||
<i
|
||||
*ngIf="showAutofillBlockedIndicator"
|
||||
class="bwi bwi-info-circle"
|
||||
[appA11yTitle]="'autofillBlockedTooltip' | i18n"
|
||||
></i>
|
||||
</h2>
|
||||
<button
|
||||
*ngIf="showRefresh"
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
Output,
|
||||
signal,
|
||||
} from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
import { Router, RouterLink } from "@angular/router";
|
||||
import { map } from "rxjs";
|
||||
|
||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||
@ -50,6 +50,7 @@ import { ItemMoreOptionsComponent } from "../item-more-options/item-more-options
|
||||
TypographyModule,
|
||||
JslibModule,
|
||||
SectionHeaderComponent,
|
||||
RouterLink,
|
||||
ItemCopyActionsComponent,
|
||||
ItemMoreOptionsComponent,
|
||||
OrgIconDirective,
|
||||
@ -80,8 +81,6 @@ export class VaultListItemsContainerComponent implements AfterViewInit {
|
||||
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
|
||||
* @private
|
||||
@ -100,11 +99,6 @@ export class VaultListItemsContainerComponent implements AfterViewInit {
|
||||
@Input()
|
||||
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
|
||||
* no ciphers are available.
|
||||
@ -176,10 +170,6 @@ export class VaultListItemsContainerComponent implements AfterViewInit {
|
||||
|
||||
this.autofillShortcutTooltip.set(`${autofillTitle} ${autofillShortcut}`);
|
||||
}
|
||||
|
||||
this.showAutofillBlockedIndicator = !!this.sectionIndicators?.find(
|
||||
(i) => i === "autofillDisabled",
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,16 +22,6 @@
|
||||
</bit-no-items>
|
||||
</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 -->
|
||||
<ng-container
|
||||
slot="above-scroll-area"
|
||||
@ -71,9 +61,7 @@
|
||||
cdkVirtualScrollingElement
|
||||
class="tw-h-full tw-p-3 bit-compact:tw-p-2 tw-styled-scrollbar"
|
||||
>
|
||||
<app-autofill-vault-list-items
|
||||
[sectionIndicators]="sectionIndicators"
|
||||
></app-autofill-vault-list-items>
|
||||
<app-autofill-vault-list-items></app-autofill-vault-list-items>
|
||||
<app-vault-list-items-container
|
||||
[title]="'favorites' | i18n"
|
||||
[ciphers]="favoriteCiphers$ | async"
|
||||
|
@ -2,20 +2,19 @@ import { ScrollingModule } from "@angular/cdk/scrolling";
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||
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 { DomainSettingsService } from "@bitwarden/common/autofill/services/domain-settings.service";
|
||||
import { CollectionId, OrganizationId } from "@bitwarden/common/types/guid";
|
||||
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 { CurrentAccountComponent } from "../../../../auth/popup/account-switching/current-account.component";
|
||||
import { PopOutComponent } from "../../../../platform/popup/components/pop-out.component";
|
||||
import { PopupHeaderComponent } from "../../../../platform/popup/layout/popup-header.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 { VaultPopupListFiltersService } from "../../services/vault-popup-list-filters.service";
|
||||
import { VaultUiOnboardingService } from "../../services/vault-ui-onboarding.service";
|
||||
@ -48,8 +47,8 @@ enum VaultState {
|
||||
CommonModule,
|
||||
AutofillVaultListItemsComponent,
|
||||
VaultListItemsContainerComponent,
|
||||
BannerModule,
|
||||
ButtonModule,
|
||||
RouterLink,
|
||||
NewItemDropdownV2Component,
|
||||
ScrollingModule,
|
||||
VaultHeaderV2Component,
|
||||
@ -62,10 +61,6 @@ export class VaultV2Component implements OnInit, OnDestroy {
|
||||
protected favoriteCiphers$ = this.vaultPopupItemsService.favoriteCiphers$;
|
||||
protected remainingCiphers$ = this.vaultPopupItemsService.remainingCiphers$;
|
||||
protected loading$ = this.vaultPopupItemsService.loading$;
|
||||
protected scriptInjectionIsBlocked = false;
|
||||
protected showScriptInjectionIsBlockedBanner = false;
|
||||
protected autofillTabHostname: string | null = null;
|
||||
protected sectionIndicators: string[] = [];
|
||||
|
||||
protected newItemItemValues$: Observable<NewItemInitialValues> =
|
||||
this.vaultPopupListFiltersService.filters$.pipe(
|
||||
@ -93,8 +88,6 @@ export class VaultV2Component implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
private vaultPopupItemsService: VaultPopupItemsService,
|
||||
private vaultPopupListFiltersService: VaultPopupListFiltersService,
|
||||
private domainSettingsService: DomainSettingsService,
|
||||
private vaultPopupAutofillService: VaultPopupAutofillService,
|
||||
private vaultUiOnboardingService: VaultUiOnboardingService,
|
||||
) {
|
||||
combineLatest([
|
||||
@ -119,31 +112,6 @@ export class VaultV2Component implements OnInit, OnDestroy {
|
||||
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() {
|
||||
@ -151,26 +119,4 @@ export class VaultV2Component implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
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",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user