[core/api/plugins] added featureFlags.registerFeatureFlag
This commit is contained in:
@@ -15,7 +15,12 @@
|
||||
*/
|
||||
|
||||
import { ComponentType } from 'react';
|
||||
import { PluginOutput, RoutePath, RouteOptions } from './types';
|
||||
import {
|
||||
PluginOutput,
|
||||
RoutePath,
|
||||
RouteOptions,
|
||||
FeatureFlagName,
|
||||
} from './types';
|
||||
import { Widget } from '../widgetView/types';
|
||||
|
||||
export type PluginConfig = {
|
||||
@@ -26,6 +31,7 @@ export type PluginConfig = {
|
||||
export type PluginHooks = {
|
||||
router: RouterHooks;
|
||||
widgets: WidgetHooks;
|
||||
featureFlags: FeatureFlagsHooks;
|
||||
};
|
||||
|
||||
export type RouterHooks = {
|
||||
@@ -46,6 +52,10 @@ export type WidgetHooks = {
|
||||
add(widget: Widget): void;
|
||||
};
|
||||
|
||||
export type FeatureFlagsHooks = {
|
||||
registerFeatureFlag(name: FeatureFlagName): void;
|
||||
};
|
||||
|
||||
export const registerSymbol = Symbol('plugin-register');
|
||||
export const outputSymbol = Symbol('plugin-output');
|
||||
|
||||
@@ -78,6 +88,11 @@ export default class Plugin {
|
||||
outputs.push({ type: 'widget', widget });
|
||||
},
|
||||
},
|
||||
featureFlags: {
|
||||
registerFeatureFlag(name) {
|
||||
outputs.push({ type: 'feature-flag', name });
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
this.storedOutput = outputs;
|
||||
|
||||
@@ -43,4 +43,15 @@ export type WidgetOutput = {
|
||||
widget: Widget;
|
||||
};
|
||||
|
||||
export type PluginOutput = RouteOutput | RedirectRouteOutput | WidgetOutput;
|
||||
export type FeatureFlagName = string;
|
||||
|
||||
export type FeatureFlagOutput = {
|
||||
type: 'feature-flag';
|
||||
name: FeatureFlagName;
|
||||
};
|
||||
|
||||
export type PluginOutput =
|
||||
| RouteOutput
|
||||
| RedirectRouteOutput
|
||||
| WidgetOutput
|
||||
| FeatureFlagOutput;
|
||||
|
||||
Reference in New Issue
Block a user