@trackunit/react-core-hooks 0.2.24-alpha-307439490d.0 → 0.2.26
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.js +41 -25
- package/package.json +3 -3
- package/src/index.d.ts +1 -0
- package/src/runtimes/navigation/useNavigationRuntime.d.ts +9 -0
- package/src/runtimes/navigation/useURLSynchronization.d.ts +1 -2
- package/src/runtimes/useAssetRuntime.d.ts +3 -2
- package/src/runtimes/useCustomFieldRuntime.d.ts +1 -2
package/index.js
CHANGED
|
@@ -63,8 +63,7 @@ const useGlobalSelection = () => {
|
|
|
63
63
|
const GlobalSelectionProvider = (props) => jsx(GlobalSelectionContext.Provider, Object.assign({}, props));
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
* A react hook for notifying host about location
|
|
67
|
-
*
|
|
66
|
+
* A react hook for notifying host about location changes
|
|
68
67
|
*/
|
|
69
68
|
const useURLSynchronization = () => {
|
|
70
69
|
const location = useLocation();
|
|
@@ -80,30 +79,12 @@ const useURLSynchronization = () => {
|
|
|
80
79
|
};
|
|
81
80
|
|
|
82
81
|
/**
|
|
83
|
-
* A hook to expose
|
|
84
|
-
*
|
|
85
|
-
* @returns {UseAssetRuntime} assetRuntime
|
|
86
|
-
*/
|
|
87
|
-
const useAssetRuntime = () => {
|
|
88
|
-
return AssetRuntime;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* A hook to expose custom field runtime methods
|
|
93
|
-
*
|
|
94
|
-
* @returns {UseCustomFieldRuntime} CustomFieldRuntime
|
|
95
|
-
*/
|
|
96
|
-
const useCustomFieldRuntime = () => {
|
|
97
|
-
return CustomFieldRuntime;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* A hook to expose rest runtime to be used in React components
|
|
82
|
+
* A hook to expose navigation runtime for React components
|
|
102
83
|
*
|
|
103
|
-
* @returns {
|
|
84
|
+
* @returns {UseNavigationRuntime} navigationRuntime
|
|
104
85
|
*/
|
|
105
|
-
const
|
|
106
|
-
return
|
|
86
|
+
const useNavigationRuntime = () => {
|
|
87
|
+
return NavigationRuntime;
|
|
107
88
|
};
|
|
108
89
|
|
|
109
90
|
/******************************************************************************
|
|
@@ -131,6 +112,41 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
131
112
|
});
|
|
132
113
|
}
|
|
133
114
|
|
|
115
|
+
/**
|
|
116
|
+
* A hook to expose asset runtime for React components
|
|
117
|
+
*
|
|
118
|
+
* @returns {UseAssetRuntime} assetRuntime
|
|
119
|
+
*/
|
|
120
|
+
const useAssetRuntime = () => {
|
|
121
|
+
const [assetInfo, setAssetInfo] = useState();
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
const getAssetInfo = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
124
|
+
const updatedAssetInfo = yield AssetRuntime.getAssetInfo();
|
|
125
|
+
setAssetInfo(updatedAssetInfo);
|
|
126
|
+
});
|
|
127
|
+
getAssetInfo();
|
|
128
|
+
}, []);
|
|
129
|
+
return { assetInfo };
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A hook to expose custom field runtime methods
|
|
134
|
+
*
|
|
135
|
+
* @returns {UseCustomFieldRuntime} CustomFieldRuntime
|
|
136
|
+
*/
|
|
137
|
+
const useCustomFieldRuntime = () => {
|
|
138
|
+
return CustomFieldRuntime;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* A hook to expose rest runtime to be used in React components
|
|
143
|
+
*
|
|
144
|
+
* @returns {UseRestRuntime} a RestRuntime
|
|
145
|
+
*/
|
|
146
|
+
const useRestRuntime = () => {
|
|
147
|
+
return RestRuntime;
|
|
148
|
+
};
|
|
149
|
+
|
|
134
150
|
/**
|
|
135
151
|
* A hook to expose site runtime for React components
|
|
136
152
|
*
|
|
@@ -194,4 +210,4 @@ const useCurrentUser = () => {
|
|
|
194
210
|
return context;
|
|
195
211
|
};
|
|
196
212
|
|
|
197
|
-
export { AssetSortingProvider, CurrentUserProvider, DeveloperSettingsContext, DeveloperSettingsProvider, EnvironmentContextProvider, GlobalSelectionProvider, ToastProvider, TokenProvider, UserSubscriptionProvider, useAssetRuntime, useAssetSorting, useCurrentUser, useCustomFieldRuntime, useDeveloperSettings, useEnvironment, useGlobalSelection, useRestRuntime, useSiteRuntime, useToast, useToken, useURLSynchronization, useUserSubscription };
|
|
213
|
+
export { AssetSortingProvider, CurrentUserProvider, DeveloperSettingsContext, DeveloperSettingsProvider, EnvironmentContextProvider, GlobalSelectionProvider, ToastProvider, TokenProvider, UserSubscriptionProvider, useAssetRuntime, useAssetSorting, useCurrentUser, useCustomFieldRuntime, useDeveloperSettings, 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.26",
|
|
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/react-core-contexts-api": "0.2.14
|
|
11
|
+
"@trackunit/react-core-contexts-api": "0.2.14",
|
|
12
12
|
"react": "18.2.0",
|
|
13
|
-
"@trackunit/iris-app-runtime-core": "0.3.
|
|
13
|
+
"@trackunit/iris-app-runtime-core": "0.3.16",
|
|
14
14
|
"react-router-dom": "6.4.5"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {}
|
package/src/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./developerSettings/DeveloperSettingsProvider";
|
|
|
3
3
|
export * from "./environment/EnvironmentContextProvider";
|
|
4
4
|
export * from "./global-selection/GlobalSelectionProvider";
|
|
5
5
|
export * from "./runtimes/navigation";
|
|
6
|
+
export * from "./runtimes/navigation/useNavigationRuntime";
|
|
6
7
|
export * from "./runtimes/useAssetRuntime";
|
|
7
8
|
export * from "./runtimes/useCustomFieldRuntime";
|
|
8
9
|
export * from "./runtimes/useRestRuntime";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { INavigationRuntime } from "@trackunit/iris-app-runtime-core";
|
|
2
|
+
export interface UseNavigationRuntime extends INavigationRuntime {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* A hook to expose navigation runtime for React components
|
|
6
|
+
*
|
|
7
|
+
* @returns {UseNavigationRuntime} navigationRuntime
|
|
8
|
+
*/
|
|
9
|
+
export declare const useNavigationRuntime: () => UseNavigationRuntime;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface UseAssetRuntime
|
|
1
|
+
import { AssetInfo } from "@trackunit/iris-app-runtime-core";
|
|
2
|
+
export interface UseAssetRuntime {
|
|
3
|
+
assetInfo: AssetInfo | undefined;
|
|
3
4
|
}
|
|
4
5
|
/**
|
|
5
6
|
* A hook to expose asset runtime for React components
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ICustomFieldRuntime } from "@trackunit/iris-app-runtime-core";
|
|
2
|
-
interface UseCustomFieldRuntime extends ICustomFieldRuntime {
|
|
2
|
+
export interface UseCustomFieldRuntime extends ICustomFieldRuntime {
|
|
3
3
|
}
|
|
4
4
|
/**
|
|
5
5
|
* A hook to expose custom field runtime methods
|
|
@@ -7,4 +7,3 @@ interface UseCustomFieldRuntime extends ICustomFieldRuntime {
|
|
|
7
7
|
* @returns {UseCustomFieldRuntime} CustomFieldRuntime
|
|
8
8
|
*/
|
|
9
9
|
export declare const useCustomFieldRuntime: () => UseCustomFieldRuntime;
|
|
10
|
-
export {};
|