@trackunit/react-core-hooks 1.3.167 → 1.3.169
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.js +15 -0
- package/index.esm.js +15 -1
- package/package.json +5 -5
- package/src/errorHandling/ErrorHandlingProvider.d.ts +12 -0
package/index.cjs.js
CHANGED
|
@@ -160,6 +160,20 @@ const useErrorHandler = () => {
|
|
|
160
160
|
}
|
|
161
161
|
return context;
|
|
162
162
|
};
|
|
163
|
+
/**
|
|
164
|
+
* Hook to get the error handling context or null if not available.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* import { useErrorHandlerOrNull } from "@trackunit/react-core-hooks";
|
|
168
|
+
* const { logError } = useErrorHandlerOrNull();
|
|
169
|
+
*
|
|
170
|
+
* if (logError) {
|
|
171
|
+
* logError(new Error("Something went wrong"));
|
|
172
|
+
* }
|
|
173
|
+
*/
|
|
174
|
+
const useErrorHandlerOrNull = () => {
|
|
175
|
+
return react.useContext(ErrorHandlingContext) || null;
|
|
176
|
+
};
|
|
163
177
|
|
|
164
178
|
/**
|
|
165
179
|
* Fetch any url as a blob and return a blob url.
|
|
@@ -1173,6 +1187,7 @@ exports.useCurrentUserTimeZonePreference = useCurrentUserTimeZonePreference;
|
|
|
1173
1187
|
exports.useCustomerRuntime = useCustomerRuntime;
|
|
1174
1188
|
exports.useEnvironment = useEnvironment;
|
|
1175
1189
|
exports.useErrorHandler = useErrorHandler;
|
|
1190
|
+
exports.useErrorHandlerOrNull = useErrorHandlerOrNull;
|
|
1176
1191
|
exports.useEventRuntime = useEventRuntime;
|
|
1177
1192
|
exports.useFeatureBranchQueryString = useFeatureBranchQueryString;
|
|
1178
1193
|
exports.useFilterBarContext = useFilterBarContext;
|
package/index.esm.js
CHANGED
|
@@ -158,6 +158,20 @@ const useErrorHandler = () => {
|
|
|
158
158
|
}
|
|
159
159
|
return context;
|
|
160
160
|
};
|
|
161
|
+
/**
|
|
162
|
+
* Hook to get the error handling context or null if not available.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* import { useErrorHandlerOrNull } from "@trackunit/react-core-hooks";
|
|
166
|
+
* const { logError } = useErrorHandlerOrNull();
|
|
167
|
+
*
|
|
168
|
+
* if (logError) {
|
|
169
|
+
* logError(new Error("Something went wrong"));
|
|
170
|
+
* }
|
|
171
|
+
*/
|
|
172
|
+
const useErrorHandlerOrNull = () => {
|
|
173
|
+
return useContext(ErrorHandlingContext) || null;
|
|
174
|
+
};
|
|
161
175
|
|
|
162
176
|
/**
|
|
163
177
|
* Fetch any url as a blob and return a blob url.
|
|
@@ -1141,4 +1155,4 @@ const useWidgetConfig = () => {
|
|
|
1141
1155
|
return result;
|
|
1142
1156
|
};
|
|
1143
1157
|
|
|
1144
|
-
export { AnalyticsContext, AnalyticsContextProvider, AssetSortingProvider, ConfirmationDialogProvider, CurrentUserPreferenceProvider, CurrentUserProvider, EnvironmentContextProvider, ErrorHandlingContext, ErrorHandlingContextProvider, FilterBarProvider, ModalDialogContextProvider, NavigationContextProvider, OemBrandingContextProvider, TimeRangeProvider, ToastProvider, TokenProvider, UserSubscriptionProvider, WidgetConfigProvider, fetchAssetBlobUrl, useAnalytics, useAssetRuntime, useAssetSorting, useConfirmationDialog, useCurrentUser, useCurrentUserLanguage, useCurrentUserSystemOfMeasurement, useCurrentUserTimeZonePreference, useCustomerRuntime, useEnvironment, useErrorHandler, useEventRuntime, useFeatureBranchQueryString, useFilterBarContext, useHasAccessTo, useImageUploader, useIrisAppId, useIrisAppImage, useIrisAppName, useLocalStorage, useLocalStorageReducer, useModalDialogContext, useNavigateInHost, useOemBrandingContext, usePrevious, useSiteRuntime, useTextSearch, useTimeRange, useToast, useToken, useUserSubscription, useWidgetConfig, useWidgetConfigAsync };
|
|
1158
|
+
export { AnalyticsContext, AnalyticsContextProvider, AssetSortingProvider, ConfirmationDialogProvider, CurrentUserPreferenceProvider, CurrentUserProvider, EnvironmentContextProvider, ErrorHandlingContext, ErrorHandlingContextProvider, FilterBarProvider, ModalDialogContextProvider, NavigationContextProvider, OemBrandingContextProvider, TimeRangeProvider, ToastProvider, TokenProvider, UserSubscriptionProvider, WidgetConfigProvider, fetchAssetBlobUrl, useAnalytics, useAssetRuntime, useAssetSorting, useConfirmationDialog, useCurrentUser, useCurrentUserLanguage, useCurrentUserSystemOfMeasurement, useCurrentUserTimeZonePreference, useCustomerRuntime, useEnvironment, useErrorHandler, useErrorHandlerOrNull, useEventRuntime, useFeatureBranchQueryString, useFilterBarContext, useHasAccessTo, useImageUploader, useIrisAppId, useIrisAppImage, useIrisAppName, useLocalStorage, useLocalStorageReducer, useModalDialogContext, useNavigateInHost, useOemBrandingContext, usePrevious, useSiteRuntime, useTextSearch, useTimeRange, useToast, useToken, useUserSubscription, useWidgetConfig, useWidgetConfigAsync };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-hooks",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.169",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"react": "19.0.0",
|
|
11
11
|
"jest-fetch-mock": "^3.0.3",
|
|
12
12
|
"zod": "3.23.4",
|
|
13
|
-
"@trackunit/react-core-contexts-api": "1.4.
|
|
14
|
-
"@trackunit/iris-app-runtime-core": "1.4.
|
|
15
|
-
"@trackunit/shared-utils": "1.5.
|
|
13
|
+
"@trackunit/react-core-contexts-api": "1.4.162",
|
|
14
|
+
"@trackunit/iris-app-runtime-core": "1.4.165",
|
|
15
|
+
"@trackunit/shared-utils": "1.5.154",
|
|
16
16
|
"@tanstack/react-router": "1.114.29",
|
|
17
|
-
"@trackunit/react-test-setup": "1.0.
|
|
17
|
+
"@trackunit/react-test-setup": "1.0.44"
|
|
18
18
|
},
|
|
19
19
|
"module": "./index.esm.js",
|
|
20
20
|
"main": "./index.cjs.js",
|
|
@@ -15,3 +15,15 @@ export declare const ErrorHandlingContextProvider: import("react").Provider<Erro
|
|
|
15
15
|
* @see {@link ErrorHandlingContext}
|
|
16
16
|
*/
|
|
17
17
|
export declare const useErrorHandler: () => ErrorHandlingContextValue;
|
|
18
|
+
/**
|
|
19
|
+
* Hook to get the error handling context or null if not available.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* import { useErrorHandlerOrNull } from "@trackunit/react-core-hooks";
|
|
23
|
+
* const { logError } = useErrorHandlerOrNull();
|
|
24
|
+
*
|
|
25
|
+
* if (logError) {
|
|
26
|
+
* logError(new Error("Something went wrong"));
|
|
27
|
+
* }
|
|
28
|
+
*/
|
|
29
|
+
export declare const useErrorHandlerOrNull: () => ErrorHandlingContextValue | null;
|