UNPKG

@ledgerhq/live-common

Version:
40 lines 1.51 kB
import type { FeatureId, Feature } from "@ledgerhq/types-live"; export type FeatureFlagsContextValue = { /** * * @param featureId featureId identifying a potential feature flag * @returns true if and only if the parameter matches a feature that is configured. */ isFeature: (featureId: string) => boolean; /** * * @param featureId featureId identifying a feature flag * @returns the value of the feature flag if it is defined (remotely or through a default value), otherwise returns null */ getFeature: (featureId: FeatureId) => Feature | null; /** * function that allows to override the value of a feature flag * * @param featureId featureId identifying a feature flag * @param newValue new value of the feature flag * @returns undefined */ overrideFeature: (featureId: FeatureId, newValue: Feature) => void; /** * resets the overridden feature flag value for a given featureId * @param featureId featureId identifying a feature flag * @returns undefined */ resetFeature: (featureId: FeatureId) => void; /** * resets all the overridden feature flags * @returns undefined */ resetFeatures: () => void; }; export declare const FeatureFlagsProvider: import("react").Provider<FeatureFlagsContextValue>; /** * Hook to consume a FeatureFlagsContext */ export declare function useFeatureFlags(): FeatureFlagsContextValue; //# sourceMappingURL=FeatureFlagsContext.d.ts.map