@equinor/subsurface-app-management 2.2.3 → 2.3.0
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.
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
export interface UseFeatureTogglingOptions {
|
|
2
2
|
featureUuid: string;
|
|
3
|
-
showIfKeyIsMissing?: boolean;
|
|
4
3
|
showIfIsLoading?: boolean;
|
|
5
4
|
}
|
|
6
5
|
/**
|
|
7
6
|
* @param featureUuid - The uuid of the feature-toggle
|
|
8
|
-
* @param
|
|
9
|
-
* @param ShowIfIsLoading - Show/hide if the feature toggles are still loading. Defaults to false
|
|
7
|
+
* @param showIfIsLoading - Show/hide if the feature toggles are still loading. Defaults to false
|
|
10
8
|
*/
|
|
11
9
|
export declare function useFeatureToggling(params: UseFeatureTogglingOptions | string): {
|
|
12
10
|
showContent: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useMemo as
|
|
1
|
+
import{useMemo as r}from"react";import{useFeatureToggleContext as e}from"../providers/FeatureToggleProvider.js";function t(t){const{featureUuid:o,showIfIsLoading:i=!1}="string"==typeof t?{featureUuid:t}:t,{features:n,isError:u,isLoading:s}=e();return{showContent:r((()=>{if(!i&&s||u)return!1;const r=n?.find((r=>r.uuid===o));return!r||r.active}),[i,s,u,n,o])}}export{t as useFeatureToggling};
|