@trackunit/react-core-hooks 0.2.48 → 0.2.50
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.
- package/index.cjs +0 -35
- package/index.js +1 -33
- package/package.json +4 -4
- package/src/index.d.ts +0 -1
- package/src/developerSettings/DeveloperSettingsProvider.d.ts +0 -16
package/index.cjs
CHANGED
|
@@ -46,38 +46,6 @@ const useAssetSorting = () => {
|
|
|
46
46
|
return context;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
const DeveloperSettingsContext = React__namespace.createContext({
|
|
50
|
-
localFeatureFlagsEnabled: false,
|
|
51
|
-
});
|
|
52
|
-
/**
|
|
53
|
-
* This is a hook to use the DeveloperSettingsContext.
|
|
54
|
-
*/
|
|
55
|
-
const useDeveloperSettings = () => {
|
|
56
|
-
const context = React__namespace.useContext(DeveloperSettingsContext);
|
|
57
|
-
if (!context) {
|
|
58
|
-
throw new Error("useDeveloperSettingsContext must be used within DeveloperSettingsProvider");
|
|
59
|
-
}
|
|
60
|
-
return context;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* This is the provider for Developer Settings
|
|
64
|
-
*/
|
|
65
|
-
const DeveloperSettingsProvider = ({ value, children }) => {
|
|
66
|
-
const [localFeatureFlagsEnabled, setLocalFeatureFlagsEnabled] = React__namespace.useState(false);
|
|
67
|
-
const [localFeatureFlags, setLocalFeatureFlags] = React__namespace.useState();
|
|
68
|
-
React__namespace.useEffect(() => {
|
|
69
|
-
if (!localFeatureFlagsEnabled) {
|
|
70
|
-
setLocalFeatureFlags({});
|
|
71
|
-
}
|
|
72
|
-
}, [localFeatureFlagsEnabled]);
|
|
73
|
-
return (jsxRuntime.jsx(DeveloperSettingsContext.Provider, Object.assign({ value: value !== null && value !== void 0 ? value : {
|
|
74
|
-
localFeatureFlagsEnabled,
|
|
75
|
-
enableLocalFeatureFlags: setLocalFeatureFlagsEnabled,
|
|
76
|
-
localFeatureFlags,
|
|
77
|
-
setFlags: setLocalFeatureFlags,
|
|
78
|
-
} }, { children: children })));
|
|
79
|
-
};
|
|
80
|
-
|
|
81
49
|
const EnvironmentContext = React.createContext(null);
|
|
82
50
|
/**
|
|
83
51
|
* This is a provider for the EnvironmentContext.
|
|
@@ -322,8 +290,6 @@ const useCurrentUser = () => {
|
|
|
322
290
|
|
|
323
291
|
exports.AssetSortingProvider = AssetSortingProvider;
|
|
324
292
|
exports.CurrentUserProvider = CurrentUserProvider;
|
|
325
|
-
exports.DeveloperSettingsContext = DeveloperSettingsContext;
|
|
326
|
-
exports.DeveloperSettingsProvider = DeveloperSettingsProvider;
|
|
327
293
|
exports.EnvironmentContextProvider = EnvironmentContextProvider;
|
|
328
294
|
exports.GlobalSelectionProvider = GlobalSelectionProvider;
|
|
329
295
|
exports.ToastProvider = ToastProvider;
|
|
@@ -334,7 +300,6 @@ exports.useAssetSorting = useAssetSorting;
|
|
|
334
300
|
exports.useCurrentUser = useCurrentUser;
|
|
335
301
|
exports.useCustomFieldRuntime = useCustomFieldRuntime;
|
|
336
302
|
exports.useCustomFieldRuntimeForEntity = useCustomFieldRuntimeForEntity;
|
|
337
|
-
exports.useDeveloperSettings = useDeveloperSettings;
|
|
338
303
|
exports.useEnvironment = useEnvironment;
|
|
339
304
|
exports.useGlobalSelection = useGlobalSelection;
|
|
340
305
|
exports.useNavigationRuntime = useNavigationRuntime;
|
package/index.js
CHANGED
|
@@ -20,38 +20,6 @@ const useAssetSorting = () => {
|
|
|
20
20
|
return context;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const DeveloperSettingsContext = React.createContext({
|
|
24
|
-
localFeatureFlagsEnabled: false,
|
|
25
|
-
});
|
|
26
|
-
/**
|
|
27
|
-
* This is a hook to use the DeveloperSettingsContext.
|
|
28
|
-
*/
|
|
29
|
-
const useDeveloperSettings = () => {
|
|
30
|
-
const context = React.useContext(DeveloperSettingsContext);
|
|
31
|
-
if (!context) {
|
|
32
|
-
throw new Error("useDeveloperSettingsContext must be used within DeveloperSettingsProvider");
|
|
33
|
-
}
|
|
34
|
-
return context;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* This is the provider for Developer Settings
|
|
38
|
-
*/
|
|
39
|
-
const DeveloperSettingsProvider = ({ value, children }) => {
|
|
40
|
-
const [localFeatureFlagsEnabled, setLocalFeatureFlagsEnabled] = React.useState(false);
|
|
41
|
-
const [localFeatureFlags, setLocalFeatureFlags] = React.useState();
|
|
42
|
-
React.useEffect(() => {
|
|
43
|
-
if (!localFeatureFlagsEnabled) {
|
|
44
|
-
setLocalFeatureFlags({});
|
|
45
|
-
}
|
|
46
|
-
}, [localFeatureFlagsEnabled]);
|
|
47
|
-
return (jsx(DeveloperSettingsContext.Provider, Object.assign({ value: value !== null && value !== void 0 ? value : {
|
|
48
|
-
localFeatureFlagsEnabled,
|
|
49
|
-
enableLocalFeatureFlags: setLocalFeatureFlagsEnabled,
|
|
50
|
-
localFeatureFlags,
|
|
51
|
-
setFlags: setLocalFeatureFlags,
|
|
52
|
-
} }, { children: children })));
|
|
53
|
-
};
|
|
54
|
-
|
|
55
23
|
const EnvironmentContext = createContext(null);
|
|
56
24
|
/**
|
|
57
25
|
* This is a provider for the EnvironmentContext.
|
|
@@ -294,4 +262,4 @@ const useCurrentUser = () => {
|
|
|
294
262
|
return context;
|
|
295
263
|
};
|
|
296
264
|
|
|
297
|
-
export { AssetSortingProvider, CurrentUserProvider,
|
|
265
|
+
export { AssetSortingProvider, CurrentUserProvider, EnvironmentContextProvider, GlobalSelectionProvider, ToastProvider, TokenProvider, UserSubscriptionProvider, useAssetRuntime, useAssetSorting, useCurrentUser, useCustomFieldRuntime, useCustomFieldRuntimeForEntity, useEnvironment, useGlobalSelection, useNavigationRuntime, useRestRuntime, useSiteRuntime, useToast, useToken, useURLSynchronization, useUserSubscription };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-hooks",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.50",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"type": "module",
|
|
9
9
|
"types": "./src/index.d.ts",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@trackunit/iris-app-runtime-core": "0.3.
|
|
12
|
-
"@trackunit/iris-app-runtime-core-api": "0.3.
|
|
13
|
-
"@trackunit/react-core-contexts-api": "0.2.
|
|
11
|
+
"@trackunit/iris-app-runtime-core": "0.3.37",
|
|
12
|
+
"@trackunit/iris-app-runtime-core-api": "0.3.32",
|
|
13
|
+
"@trackunit/react-core-contexts-api": "0.2.29",
|
|
14
14
|
"react": "18.2.0",
|
|
15
15
|
"react-router-dom": "6.4.5"
|
|
16
16
|
},
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from "./assetSorting/AssetSortingProvider";
|
|
2
|
-
export * from "./developerSettings/DeveloperSettingsProvider";
|
|
3
2
|
export * from "./environment/EnvironmentContextProvider";
|
|
4
3
|
export * from "./global-selection/GlobalSelectionProvider";
|
|
5
4
|
export * from "./runtimes/navigation";
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { IDeveloperSettingsContext } from "@trackunit/react-core-contexts-api";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
export declare const DeveloperSettingsContext: React.Context<IDeveloperSettingsContext>;
|
|
4
|
-
/**
|
|
5
|
-
* This is a hook to use the DeveloperSettingsContext.
|
|
6
|
-
*/
|
|
7
|
-
export declare const useDeveloperSettings: () => IDeveloperSettingsContext;
|
|
8
|
-
interface IProps {
|
|
9
|
-
value: IDeveloperSettingsContext;
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* This is the provider for Developer Settings
|
|
14
|
-
*/
|
|
15
|
-
export declare const DeveloperSettingsProvider: ({ value, children }: IProps) => JSX.Element;
|
|
16
|
-
export {};
|