mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 05:13:29 +00:00
[PM-18627] Remove customization settings popover (#14713)
* chore: remove customization popover strings, refs PM-18627 * chore: delete new settings callout ts/html component, refs PM-18627 * chore: remove new customization code from vault-v2 component, refs PM-18627: :q * chore: delete vault-page service, refs PM-18627 * chore: add state migration to remove data, refs PM-18627
This commit is contained in:
@@ -2208,15 +2208,6 @@
|
||||
"vaultTimeoutAction1": {
|
||||
"message": "Timeout action"
|
||||
},
|
||||
"newCustomizationOptionsCalloutTitle": {
|
||||
"message": "New customization options"
|
||||
},
|
||||
"newCustomizationOptionsCalloutContent": {
|
||||
"message": "Customize your vault experience with quick copy actions, compact mode, and more!"
|
||||
},
|
||||
"newCustomizationOptionsCalloutLink": {
|
||||
"message": "View all Appearance settings"
|
||||
},
|
||||
"lock": {
|
||||
"message": "Lock",
|
||||
"description": "Verb form: to make secure or inaccessible by"
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<ng-container *ngIf="showNewCustomizationSettingsCallout">
|
||||
<button
|
||||
type="button"
|
||||
class="tw-absolute tw-bottom-[12px] tw-right-[47px]"
|
||||
[bitPopoverTriggerFor]="newCustomizationOptionsCallout"
|
||||
[position]="'above-end'"
|
||||
[popoverOpen]="true"
|
||||
#triggerRef="popoverTrigger"
|
||||
></button>
|
||||
<bit-popover
|
||||
[title]="'newCustomizationOptionsCalloutTitle' | i18n"
|
||||
#newCustomizationOptionsCallout
|
||||
(closed)="dismissCallout()"
|
||||
>
|
||||
<div bitTypography="body2" (click)="goToAppearance()">
|
||||
{{ "newCustomizationOptionsCalloutContent" | i18n }}
|
||||
<a
|
||||
tabIndex="0"
|
||||
bitLink
|
||||
class="tw-font-bold"
|
||||
linkType="primary"
|
||||
routerLink="/appearance"
|
||||
(keydown.enter)="goToAppearance()"
|
||||
>
|
||||
{{ "newCustomizationOptionsCalloutLink" | i18n }}
|
||||
</a>
|
||||
</div>
|
||||
</bit-popover>
|
||||
</ng-container>
|
||||
@@ -1,81 +0,0 @@
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
import { firstValueFrom } from "rxjs";
|
||||
|
||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||
import { VaultProfileService } from "@bitwarden/angular/vault/services/vault-profile.service";
|
||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { UserId } from "@bitwarden/common/types/guid";
|
||||
import { VaultSettingsService } from "@bitwarden/common/vault/abstractions/vault-settings/vault-settings.service";
|
||||
import { ButtonModule, PopoverModule } from "@bitwarden/components";
|
||||
|
||||
import { VaultPopupCopyButtonsService } from "../../../services/vault-popup-copy-buttons.service";
|
||||
import { VaultPageService } from "../vault-page.service";
|
||||
|
||||
@Component({
|
||||
selector: "new-settings-callout",
|
||||
templateUrl: "new-settings-callout.component.html",
|
||||
standalone: true,
|
||||
imports: [PopoverModule, JslibModule, CommonModule, ButtonModule],
|
||||
providers: [VaultPageService],
|
||||
})
|
||||
export class NewSettingsCalloutComponent implements OnInit, OnDestroy {
|
||||
protected showNewCustomizationSettingsCallout = false;
|
||||
protected activeUserId: UserId | null = null;
|
||||
|
||||
constructor(
|
||||
private accountService: AccountService,
|
||||
private vaultProfileService: VaultProfileService,
|
||||
private vaultPageService: VaultPageService,
|
||||
private router: Router,
|
||||
private logService: LogService,
|
||||
private copyButtonService: VaultPopupCopyButtonsService,
|
||||
private vaultSettingsService: VaultSettingsService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
this.activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
|
||||
|
||||
const showQuickCopyActions = await firstValueFrom(this.copyButtonService.showQuickCopyActions$);
|
||||
const clickItemsToAutofillVaultView = await firstValueFrom(
|
||||
this.vaultSettingsService.clickItemsToAutofillVaultView$,
|
||||
);
|
||||
|
||||
let profileCreatedDate: Date;
|
||||
|
||||
try {
|
||||
profileCreatedDate = await this.vaultProfileService.getProfileCreationDate(this.activeUserId);
|
||||
} catch (e) {
|
||||
this.logService.error("Error getting profile creation date", e);
|
||||
// Default to before the cutoff date to ensure the callout is shown
|
||||
profileCreatedDate = new Date("2024-12-24");
|
||||
}
|
||||
|
||||
const hasCalloutBeenDismissed = await firstValueFrom(
|
||||
this.vaultPageService.isCalloutDismissed(this.activeUserId),
|
||||
);
|
||||
|
||||
this.showNewCustomizationSettingsCallout =
|
||||
!showQuickCopyActions &&
|
||||
!clickItemsToAutofillVaultView &&
|
||||
!hasCalloutBeenDismissed &&
|
||||
profileCreatedDate < new Date("2024-12-25");
|
||||
}
|
||||
|
||||
async goToAppearance() {
|
||||
await this.router.navigate(["/appearance"]);
|
||||
}
|
||||
|
||||
async dismissCallout() {
|
||||
if (this.activeUserId) {
|
||||
await this.vaultPageService.dismissCallout(this.activeUserId);
|
||||
}
|
||||
}
|
||||
|
||||
async ngOnDestroy() {
|
||||
await this.dismissCallout();
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
import { inject, Injectable } from "@angular/core";
|
||||
import { map, Observable } from "rxjs";
|
||||
|
||||
import {
|
||||
BANNERS_DISMISSED_DISK,
|
||||
StateProvider,
|
||||
UserKeyDefinition,
|
||||
} from "@bitwarden/common/platform/state";
|
||||
import { UserId } from "@bitwarden/common/types/guid";
|
||||
|
||||
export const NEW_CUSTOMIZATION_OPTIONS_CALLOUT_DISMISSED_KEY = new UserKeyDefinition<boolean>(
|
||||
BANNERS_DISMISSED_DISK,
|
||||
"newCustomizationOptionsCalloutDismissed",
|
||||
{
|
||||
deserializer: (calloutDismissed) => calloutDismissed,
|
||||
clearOn: [], // Do not clear dismissed callouts
|
||||
},
|
||||
);
|
||||
|
||||
@Injectable()
|
||||
export class VaultPageService {
|
||||
private stateProvider = inject(StateProvider);
|
||||
|
||||
isCalloutDismissed(userId: UserId): Observable<boolean> {
|
||||
return this.stateProvider
|
||||
.getUser(userId, NEW_CUSTOMIZATION_OPTIONS_CALLOUT_DISMISSED_KEY)
|
||||
.state$.pipe(map((dismissed) => !!dismissed));
|
||||
}
|
||||
|
||||
async dismissCallout(userId: UserId): Promise<void> {
|
||||
await this.stateProvider
|
||||
.getUser(userId, NEW_CUSTOMIZATION_OPTIONS_CALLOUT_DISMISSED_KEY)
|
||||
.update(() => true);
|
||||
}
|
||||
}
|
||||
@@ -107,5 +107,4 @@
|
||||
></app-vault-list-items-container>
|
||||
</div>
|
||||
</ng-container>
|
||||
<new-settings-callout></new-settings-callout>
|
||||
</popup-page>
|
||||
|
||||
@@ -56,9 +56,7 @@ import {
|
||||
NewItemDropdownV2Component,
|
||||
NewItemInitialValues,
|
||||
} from "./new-item-dropdown/new-item-dropdown-v2.component";
|
||||
import { NewSettingsCalloutComponent } from "./new-settings-callout/new-settings-callout.component";
|
||||
import { VaultHeaderV2Component } from "./vault-header/vault-header-v2.component";
|
||||
import { VaultPageService } from "./vault-page.service";
|
||||
|
||||
import { AutofillVaultListItemsComponent, VaultListItemsContainerComponent } from ".";
|
||||
|
||||
@@ -90,12 +88,10 @@ enum VaultState {
|
||||
ScrollingModule,
|
||||
VaultHeaderV2Component,
|
||||
AtRiskPasswordCalloutComponent,
|
||||
NewSettingsCalloutComponent,
|
||||
SpotlightComponent,
|
||||
RouterModule,
|
||||
TypographyModule,
|
||||
],
|
||||
providers: [VaultPageService],
|
||||
})
|
||||
export class VaultV2Component implements OnInit, AfterViewInit, OnDestroy {
|
||||
@ViewChild(CdkVirtualScrollableElement) virtualScrollElement?: CdkVirtualScrollableElement;
|
||||
@@ -152,7 +148,6 @@ export class VaultV2Component implements OnInit, AfterViewInit, OnDestroy {
|
||||
protected noResultsIcon = Icons.NoResults;
|
||||
|
||||
protected VaultStateEnum = VaultState;
|
||||
protected showNewCustomizationSettingsCallout = false;
|
||||
|
||||
constructor(
|
||||
private vaultPopupItemsService: VaultPopupItemsService,
|
||||
|
||||
Reference in New Issue
Block a user