mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 09:43:23 +00:00
[EC-475] Auto-save password prompt enhancements (#4808)
* [EC-1062] Convert bar.js to TS and refactor (#4623) * [EC-476 / EC-478] Add notificationBar edit flow (#4626) * [EC-477] Enable auto-save for users without individual vault (#4760) * [EC-1057] Add data loss warning to notificationBar edit flow (#4761) * [AC-1173] Fix state bugs in auto-save edit flow (#4936) --------- Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
This commit is contained in:
@@ -26,6 +26,7 @@ import { CipherData } from "../vault/models/data/cipher.data";
|
||||
import { FolderData } from "../vault/models/data/folder.data";
|
||||
import { LocalData } from "../vault/models/data/local.data";
|
||||
import { CipherView } from "../vault/models/view/cipher.view";
|
||||
import { AddEditCipherInfo } from "../vault/types/add-edit-cipher-info";
|
||||
|
||||
export abstract class StateService<T extends Account = Account> {
|
||||
accounts$: Observable<{ [userId: string]: T }>;
|
||||
@@ -39,8 +40,8 @@ export abstract class StateService<T extends Account = Account> {
|
||||
|
||||
getAccessToken: (options?: StorageOptions) => Promise<string>;
|
||||
setAccessToken: (value: string, options?: StorageOptions) => Promise<void>;
|
||||
getAddEditCipherInfo: (options?: StorageOptions) => Promise<any>;
|
||||
setAddEditCipherInfo: (value: any, options?: StorageOptions) => Promise<void>;
|
||||
getAddEditCipherInfo: (options?: StorageOptions) => Promise<AddEditCipherInfo>;
|
||||
setAddEditCipherInfo: (value: AddEditCipherInfo, options?: StorageOptions) => Promise<void>;
|
||||
getAlwaysShowDock: (options?: StorageOptions) => Promise<boolean>;
|
||||
setAlwaysShowDock: (value: boolean, options?: StorageOptions) => Promise<void>;
|
||||
getApiKeyClientId: (options?: StorageOptions) => Promise<string>;
|
||||
|
||||
@@ -45,6 +45,7 @@ import { CipherData } from "../vault/models/data/cipher.data";
|
||||
import { FolderData } from "../vault/models/data/folder.data";
|
||||
import { LocalData } from "../vault/models/data/local.data";
|
||||
import { CipherView } from "../vault/models/view/cipher.view";
|
||||
import { AddEditCipherInfo } from "../vault/types/add-edit-cipher-info";
|
||||
|
||||
const keys = {
|
||||
state: "state",
|
||||
@@ -222,13 +223,13 @@ export class StateService<
|
||||
await this.saveAccount(account, options);
|
||||
}
|
||||
|
||||
async getAddEditCipherInfo(options?: StorageOptions): Promise<any> {
|
||||
async getAddEditCipherInfo(options?: StorageOptions): Promise<AddEditCipherInfo> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultInMemoryOptions()))
|
||||
)?.data?.addEditCipherInfo;
|
||||
}
|
||||
|
||||
async setAddEditCipherInfo(value: any, options?: StorageOptions): Promise<void> {
|
||||
async setAddEditCipherInfo(value: AddEditCipherInfo, options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultInMemoryOptions())
|
||||
);
|
||||
|
||||
12
libs/common/src/vault/types/add-edit-cipher-info.ts
Normal file
12
libs/common/src/vault/types/add-edit-cipher-info.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { CipherView } from "../models/view/cipher.view";
|
||||
|
||||
/**
|
||||
* Used to temporarily save the state of the AddEditComponent, e.g. when the user navigates away to the Generator page.
|
||||
* @property cipher The unsaved item being added or edited
|
||||
* @property collectionIds The collections that are selected for the item (currently these are not mapped back to
|
||||
* cipher.collectionIds until the item is saved)
|
||||
*/
|
||||
export type AddEditCipherInfo = {
|
||||
cipher: CipherView;
|
||||
collectionIds?: string[];
|
||||
};
|
||||
Reference in New Issue
Block a user