mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 17:38:10 +00:00
we need a specific deploy context instead of relying on the reserved one. Co-authored-by: wil <wil@storyteller.ai>
15 lines
477 B
TypeScript
15 lines
477 B
TypeScript
import { useFeatureFlagEnabled } from "posthog-js/react";
|
|
import { FeatureFlags } from "~/enums/FeatureFlags";
|
|
import environmentVariables from "~/Classes/EnvironmentVariables";
|
|
|
|
export const usePosthogFeatureFlag = (flag: FeatureFlags): boolean => {
|
|
const enabled = useFeatureFlagEnabled(flag) ?? false;
|
|
if (
|
|
environmentVariables.values.DEPLOY_CONTEXT &&
|
|
environmentVariables.values.DEPLOY_CONTEXT === "DEVELOPMENT"
|
|
) {
|
|
return true;
|
|
}
|
|
return enabled;
|
|
};
|