From fcd24a4d607d75412c771d0674cd8d911c0d0ef0 Mon Sep 17 00:00:00 2001 From: SmithThe4th Date: Mon, 16 Jun 2025 15:07:29 -0400 Subject: [PATCH] [PM-20644] [Vault] [Browser Extension] Front End Changes to Enforce "Remove card item type policy" (#15147) * Added service to get restricted cipher and used that to hide in autofill settings * Referenced files from the work done on web * Fixed restrictedCardType$ observable * Created resuseable cipher menu items type (cherry picked from commit 34be7f7ffef135aea2449e11e45e638ebaf34ee8) * Updated new item dropdown to filter out restricted type and also render the menu items dynamically (cherry picked from commit 566099ba9f3dbd7f18077dbc5b8ed44f51a94bfc) * Updated service to have cipher types as an observable (cherry picked from commit 6848e5f75803eb45e2262c617c9805359861ad14) * Refactored service to have use CIPHER MENU ITEMS type and filter restricted rypes and return an observable (cherry picked from commit e25c4eb18af895deac762b9e2d7ae69cc235f224) * Fixed type enum * Referenced files from the work done on web * Referenced change from the work done on web * Remove comment * Remove cipher type from autofill suggestion list when enabled * revert autofillcipher$ change * Fixed test * Added sharereplay to restrictedCardType$ observable * Added startwith operator * Add organization exemptions to restricted filter --- .../popup/settings/autofill.component.html | 7 +- .../popup/settings/autofill.component.ts | 10 +- .../new-item-dropdown-v2.component.html | 34 +---- .../new-item-dropdown-v2.component.spec.ts | 7 + .../new-item-dropdown-v2.component.ts | 21 ++- .../vault-list-filters.component.html | 2 +- .../vault-list-filters.component.ts | 2 +- .../vault-popup-list-filters.service.spec.ts | 54 ++++++-- .../vault-popup-list-filters.service.ts | 123 ++++++++++-------- .../src/vault/types/cipher-menu-items.ts | 24 ++++ 10 files changed, 184 insertions(+), 100 deletions(-) create mode 100644 libs/common/src/vault/types/cipher-menu-items.ts diff --git a/apps/browser/src/autofill/popup/settings/autofill.component.html b/apps/browser/src/autofill/popup/settings/autofill.component.html index 264b04b039b..aa9c8648885 100644 --- a/apps/browser/src/autofill/popup/settings/autofill.component.html +++ b/apps/browser/src/autofill/popup/settings/autofill.component.html @@ -65,7 +65,10 @@ {{ "showInlineMenuIdentitiesLabel" | i18n }} - + - + = + this.restrictedItemTypesService.restricted$.pipe( + map((restrictedTypes) => restrictedTypes.some((type) => type.cipherType === CipherType.Card)), + shareReplay({ bufferSize: 1, refCount: true }), + ); protected autofillOnPageLoadForm = new FormGroup({ autofillOnPageLoad: new FormControl(), @@ -156,6 +163,7 @@ export class AutofillComponent implements OnInit { private nudgesService: NudgesService, private accountService: AccountService, private autofillBrowserSettingsService: AutofillBrowserSettingsService, + private restrictedItemTypesService: RestrictedItemTypesService, ) { this.autofillOnPageLoadOptions = [ { name: this.i18nService.t("autoFillOnPageLoadYes"), value: true }, diff --git a/apps/browser/src/vault/popup/components/vault-v2/new-item-dropdown/new-item-dropdown-v2.component.html b/apps/browser/src/vault/popup/components/vault-v2/new-item-dropdown/new-item-dropdown-v2.component.html index 6b6e8728f19..7dd0a5a3bc7 100644 --- a/apps/browser/src/vault/popup/components/vault-v2/new-item-dropdown/new-item-dropdown-v2.component.html +++ b/apps/browser/src/vault/popup/components/vault-v2/new-item-dropdown/new-item-dropdown-v2.component.html @@ -3,34 +3,12 @@ {{ "new" | i18n }} - - - {{ "typeLogin" | i18n }} - - - - {{ "typeCard" | i18n }} - - - - {{ "typeIdentity" | i18n }} - - - - {{ "note" | i18n }} - - - - {{ "typeSshKey" | i18n }} - + @for (menuItem of cipherMenuItems$ | async; track menuItem.type) { + + + {{ menuItem.labelKey | i18n }} + + }