Added feature flags system (#803)

* added feature flag system

* Update packages/web/src/core/services/featureFlags.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* remove process.env

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Dan Ditomaso
2025-08-22 13:47:24 -04:00
committed by GitHub
co-authored by Copilot
parent 1de92cd2e9
commit 449fb3ac36
5 changed files with 138 additions and 3 deletions
@@ -0,0 +1,22 @@
import {
type FlagKey,
type Flags,
featureFlags,
} from "@core/services/featureFlags.ts";
import * as React from "react";
export function useFeatureFlags(): Flags {
return React.useSyncExternalStore(
(cb) => featureFlags.subscribe(cb),
() => featureFlags.all(),
() => featureFlags.all(),
);
}
export function useFeatureFlag(key: FlagKey): boolean {
return React.useSyncExternalStore(
(cb) => featureFlags.subscribe(cb),
() => featureFlags.get(key),
() => featureFlags.get(key),
);
}