import type { ReactNode } from "react" import { useRegional } from "./context" import type { RegionConfig } from "./types" interface FeatureGateProps { /** The feature flag key from RegionConfig.features to check. */ feature: keyof RegionConfig["features"] children: ReactNode /** Optional fallback rendered when the feature is disabled. */ fallback?: ReactNode } /** * Renders children only when the named feature flag is enabled in the * active region's config. Use this instead of inline config.features checks. * * Must be rendered inside a . * * @example * * * * * @example * Not available in your region.

}> * *
*/ export function FeatureGate({ feature, children, fallback = null }: FeatureGateProps): ReactNode { const { config } = useRegional() return config.features[feature] ? children : fallback }