mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
[SM-1065] SmOnboarding state provider (#8037)
* Create state definition * Create SmOnboardingTaskService * Replace usage of stateService value with state new state provider * Migrate old state values to state provider * Fix injection of SmOnboardingTasksService * Remove smOnboardingTasks from state * Fix state provider imports * Fix migration after merge from main * Move null handling to SMOnboardingTasksService
This commit is contained in:
@@ -424,13 +424,6 @@ export abstract class StateService<T extends Account = Account> {
|
||||
|
||||
getAvatarColor: (options?: StorageOptions) => Promise<string | null | undefined>;
|
||||
setAvatarColor: (value: string, options?: StorageOptions) => Promise<void>;
|
||||
getSMOnboardingTasks: (
|
||||
options?: StorageOptions,
|
||||
) => Promise<Record<string, Record<string, boolean>>>;
|
||||
setSMOnboardingTasks: (
|
||||
value: Record<string, Record<string, boolean>>,
|
||||
options?: StorageOptions,
|
||||
) => Promise<void>;
|
||||
/**
|
||||
* fetches string value of URL user tried to navigate to while unauthenticated.
|
||||
* @param options Defines the storage options for the URL; Defaults to session Storage.
|
||||
|
||||
@@ -223,7 +223,6 @@ export class AccountSettings {
|
||||
serverConfig?: ServerConfigData;
|
||||
approveLoginRequests?: boolean;
|
||||
avatarColor?: string;
|
||||
smOnboardingTasks?: Record<string, Record<string, boolean>>;
|
||||
trustDeviceChoiceForDecryption?: boolean;
|
||||
|
||||
/** @deprecated July 2023, left for migration purposes*/
|
||||
|
||||
@@ -2154,28 +2154,6 @@ export class StateService<
|
||||
);
|
||||
}
|
||||
|
||||
async getSMOnboardingTasks(
|
||||
options?: StorageOptions,
|
||||
): Promise<Record<string, Record<string, boolean>>> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()))
|
||||
)?.settings?.smOnboardingTasks;
|
||||
}
|
||||
|
||||
async setSMOnboardingTasks(
|
||||
value: Record<string, Record<string, boolean>>,
|
||||
options?: StorageOptions,
|
||||
): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()),
|
||||
);
|
||||
account.settings.smOnboardingTasks = value;
|
||||
return await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
async getDeepLinkRedirectUrl(options?: StorageOptions): Promise<string> {
|
||||
return (
|
||||
await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
|
||||
|
||||
@@ -66,3 +66,8 @@ export const VAULT_FILTER_DISK = new StateDefinition("vaultFilter", "disk", {
|
||||
export const NEW_WEB_LAYOUT_BANNER_DISK = new StateDefinition("newWebLayoutBanner", "disk", {
|
||||
web: "disk-local",
|
||||
});
|
||||
|
||||
// Secrets Manager
|
||||
export const SM_ONBOARDING_DISK = new StateDefinition("smOnboarding", "disk", {
|
||||
web: "disk-local",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user