mirror of
https://github.com/bitwarden/clients.git
synced 2026-07-01 21:10:49 +08:00
* [deps] SM: Update typescript-eslint monorepo to v8 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Hinton <hinton@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import {
|
|
flagEnabled as baseFlagEnabled,
|
|
devFlagEnabled as baseDevFlagEnabled,
|
|
devFlagValue as baseDevFlagValue,
|
|
SharedFlags,
|
|
SharedDevFlags,
|
|
} from "@bitwarden/common/platform/misc/flags";
|
|
|
|
import { GroupPolicyEnvironment } from "../admin-console/types/group-policy-environment";
|
|
|
|
import { BrowserApi } from "./browser/browser-api";
|
|
|
|
// required to avoid linting errors when there are no flags
|
|
export type Flags = {
|
|
accountSwitching?: boolean;
|
|
} & SharedFlags;
|
|
|
|
// required to avoid linting errors when there are no flags
|
|
export type DevFlags = {
|
|
managedEnvironment?: GroupPolicyEnvironment;
|
|
} & SharedDevFlags;
|
|
|
|
export function flagEnabled(flag: keyof Flags): boolean {
|
|
return baseFlagEnabled<Flags>(flag);
|
|
}
|
|
|
|
export function devFlagEnabled(flag: keyof DevFlags) {
|
|
return baseDevFlagEnabled<DevFlags>(flag);
|
|
}
|
|
|
|
export function devFlagValue(flag: keyof DevFlags) {
|
|
return baseDevFlagValue(flag);
|
|
}
|
|
|
|
/** Helper method to sync flag specifically for account switching, which as platform-based values.
|
|
* If this pattern needs to be repeated, it's better handled by increasing complexity of webpack configurations
|
|
* Not by expanding these flag getters.
|
|
*/
|
|
export function enableAccountSwitching(): boolean {
|
|
if (BrowserApi.isSafariApi) {
|
|
return false;
|
|
}
|
|
return flagEnabled("accountSwitching");
|
|
}
|