@equinor/subsurface-app-management 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,6 +8,6 @@ export interface UseFeatureTogglingOptions {
|
|
|
8
8
|
* @param showIfKeyIsMissing - Show/hide if the key was not found/has been deleted. Defaults to true
|
|
9
9
|
* @param ShowIfIsLoading - Show/hide if the feature toggles are still loading. Defaults to false
|
|
10
10
|
*/
|
|
11
|
-
export declare function useFeatureToggling(
|
|
11
|
+
export declare function useFeatureToggling(params: UseFeatureTogglingOptions | string): {
|
|
12
12
|
showContent: boolean;
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useMemo as e}from"react";import{useFeatureToggleContext as
|
|
1
|
+
import{useMemo as e}from"react";import{useFeatureToggleContext as r}from"../providers/FeatureToggleProvider.js";function o(o){const{featureUuid:t,showIfKeyIsMissing:i=!0,showIfIsLoading:s=!1}="string"==typeof o?{featureUuid:o}:o,{features:n,isError:u,isLoading:a}=r();i||console.warn(`[FeatureToggle] Feature: ${t} will not show when the feature toggle is removed! Was this intentional?`);return{showContent:e((()=>{if(!s&&a||u)return!1;const e=n?.some((e=>e.uuid===t));return!!e||i}),[s,a,u,n,i,t])}}export{o as useFeatureToggling};
|