@trackunit/react-core-hooks 1.17.30-alpha-27ad777c16e.0 → 1.17.32
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 +24 -0
- package/index.esm.js +24 -1
- package/package.json +4 -4
- package/src/user/useCurrentUserPreference.d.ts +15 -0
package/index.cjs.js
CHANGED
|
@@ -1065,6 +1065,29 @@ const useCurrentUserSystemOfMeasurement = () => {
|
|
|
1065
1065
|
};
|
|
1066
1066
|
}, [context.systemOfMeasurement, context.setSystemOfMeasurement]);
|
|
1067
1067
|
};
|
|
1068
|
+
/**
|
|
1069
|
+
* This is a hook providing the Current User Time Format preference.
|
|
1070
|
+
*
|
|
1071
|
+
* @example
|
|
1072
|
+
* import { useCurrentUserTimeFormat } from "@trackunit/react-core-hooks";
|
|
1073
|
+
* const { timeFormat, setTimeFormat } = useCurrentUserTimeFormat();
|
|
1074
|
+
*
|
|
1075
|
+
* timeFormat: Gets the time format preference of the current user. "LANGUAGE_DEFAULT" | "TWELVE_HOUR" | "TWENTY_FOUR_HOUR"
|
|
1076
|
+
* setTimeFormat: Sets the time format preference of the current user.
|
|
1077
|
+
* @see { CurrentUserPreferenceState}
|
|
1078
|
+
*/
|
|
1079
|
+
const useCurrentUserTimeFormat = () => {
|
|
1080
|
+
const context = react.useContext(reactCoreContextsApi.CurrentUserPreferenceContext);
|
|
1081
|
+
if (!context) {
|
|
1082
|
+
throw new Error("useCurrentUserTimeFormat must be used within the CurrentUserPreferenceProvider");
|
|
1083
|
+
}
|
|
1084
|
+
return react.useMemo(() => {
|
|
1085
|
+
return {
|
|
1086
|
+
timeFormat: context.timeFormat || null,
|
|
1087
|
+
setTimeFormat: context.setTimeFormat,
|
|
1088
|
+
};
|
|
1089
|
+
}, [context.timeFormat, context.setTimeFormat]);
|
|
1090
|
+
};
|
|
1068
1091
|
/**
|
|
1069
1092
|
* This is a hook providing the Current User Favorite Insights.
|
|
1070
1093
|
*
|
|
@@ -1392,6 +1415,7 @@ exports.useCurrentUserFavoriteAdvancedSensors = useCurrentUserFavoriteAdvancedSe
|
|
|
1392
1415
|
exports.useCurrentUserFavoriteInsights = useCurrentUserFavoriteInsights;
|
|
1393
1416
|
exports.useCurrentUserLanguage = useCurrentUserLanguage;
|
|
1394
1417
|
exports.useCurrentUserSystemOfMeasurement = useCurrentUserSystemOfMeasurement;
|
|
1418
|
+
exports.useCurrentUserTimeFormat = useCurrentUserTimeFormat;
|
|
1395
1419
|
exports.useCurrentUserTimeZonePreference = useCurrentUserTimeZonePreference;
|
|
1396
1420
|
exports.useCustomerRuntime = useCustomerRuntime;
|
|
1397
1421
|
exports.useEnvironment = useEnvironment;
|
package/index.esm.js
CHANGED
|
@@ -1063,6 +1063,29 @@ const useCurrentUserSystemOfMeasurement = () => {
|
|
|
1063
1063
|
};
|
|
1064
1064
|
}, [context.systemOfMeasurement, context.setSystemOfMeasurement]);
|
|
1065
1065
|
};
|
|
1066
|
+
/**
|
|
1067
|
+
* This is a hook providing the Current User Time Format preference.
|
|
1068
|
+
*
|
|
1069
|
+
* @example
|
|
1070
|
+
* import { useCurrentUserTimeFormat } from "@trackunit/react-core-hooks";
|
|
1071
|
+
* const { timeFormat, setTimeFormat } = useCurrentUserTimeFormat();
|
|
1072
|
+
*
|
|
1073
|
+
* timeFormat: Gets the time format preference of the current user. "LANGUAGE_DEFAULT" | "TWELVE_HOUR" | "TWENTY_FOUR_HOUR"
|
|
1074
|
+
* setTimeFormat: Sets the time format preference of the current user.
|
|
1075
|
+
* @see { CurrentUserPreferenceState}
|
|
1076
|
+
*/
|
|
1077
|
+
const useCurrentUserTimeFormat = () => {
|
|
1078
|
+
const context = useContext(CurrentUserPreferenceContext);
|
|
1079
|
+
if (!context) {
|
|
1080
|
+
throw new Error("useCurrentUserTimeFormat must be used within the CurrentUserPreferenceProvider");
|
|
1081
|
+
}
|
|
1082
|
+
return useMemo(() => {
|
|
1083
|
+
return {
|
|
1084
|
+
timeFormat: context.timeFormat || null,
|
|
1085
|
+
setTimeFormat: context.setTimeFormat,
|
|
1086
|
+
};
|
|
1087
|
+
}, [context.timeFormat, context.setTimeFormat]);
|
|
1088
|
+
};
|
|
1066
1089
|
/**
|
|
1067
1090
|
* This is a hook providing the Current User Favorite Insights.
|
|
1068
1091
|
*
|
|
@@ -1380,4 +1403,4 @@ const useWidgetConfig = () => {
|
|
|
1380
1403
|
return result;
|
|
1381
1404
|
};
|
|
1382
1405
|
|
|
1383
|
-
export { fetchAssetBlobUrl, useAnalytics, useAssetRuntime, useAssetSorting, useConfirmationDialog, useCurrentUser, useCurrentUserFavoriteAdvancedSensors, useCurrentUserFavoriteInsights, useCurrentUserLanguage, useCurrentUserSystemOfMeasurement, useCurrentUserTimeZonePreference, useCustomerRuntime, useEnvironment, useErrorHandler, useErrorHandlerOrNull, useEventRuntime, useExportDataContext, useFeatureBranchQueryString, useFeatureFlags, useFilterBarContext, useGeolocation, useHasAccessTo, useImageUploader, useIrisAppId, useIrisAppImage, useIrisAppName, useModalDialogContext, useNavigateInHost, useOemBrandingContext, useSettingsUtils, useSiteRuntime, useTimeRange, useToast, useToken, useUserPermission, useUserSubscription, useWidgetConfig, useWidgetConfigAsync };
|
|
1406
|
+
export { fetchAssetBlobUrl, useAnalytics, useAssetRuntime, useAssetSorting, useConfirmationDialog, useCurrentUser, useCurrentUserFavoriteAdvancedSensors, useCurrentUserFavoriteInsights, useCurrentUserLanguage, useCurrentUserSystemOfMeasurement, useCurrentUserTimeFormat, useCurrentUserTimeZonePreference, useCustomerRuntime, useEnvironment, useErrorHandler, useErrorHandlerOrNull, useEventRuntime, useExportDataContext, useFeatureBranchQueryString, useFeatureFlags, useFilterBarContext, useGeolocation, useHasAccessTo, useImageUploader, useIrisAppId, useIrisAppImage, useIrisAppName, useModalDialogContext, useNavigateInHost, useOemBrandingContext, useSettingsUtils, useSiteRuntime, useTimeRange, useToast, useToken, useUserPermission, useUserSubscription, useWidgetConfig, useWidgetConfigAsync };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-hooks",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.32",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"es-toolkit": "^1.39.10",
|
|
11
|
-
"@trackunit/iris-app-runtime-core": "1.17.
|
|
12
|
-
"@trackunit/iris-app-runtime-core-api": "1.16.
|
|
13
|
-
"@trackunit/react-core-contexts-api": "1.17.
|
|
11
|
+
"@trackunit/iris-app-runtime-core": "1.17.28",
|
|
12
|
+
"@trackunit/iris-app-runtime-core-api": "1.16.28",
|
|
13
|
+
"@trackunit/react-core-contexts-api": "1.17.28",
|
|
14
14
|
"zod": "^3.25.76"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
@@ -44,6 +44,21 @@ export declare const useCurrentUserSystemOfMeasurement: () => {
|
|
|
44
44
|
systemOfMeasurement: import("@trackunit/iris-app-runtime-core-api").SystemOfMeasurementType | null;
|
|
45
45
|
setSystemOfMeasurement: ((systemOfMeasurement: import("@trackunit/iris-app-runtime-core-api").SystemOfMeasurementType) => void) | undefined;
|
|
46
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* This is a hook providing the Current User Time Format preference.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* import { useCurrentUserTimeFormat } from "@trackunit/react-core-hooks";
|
|
52
|
+
* const { timeFormat, setTimeFormat } = useCurrentUserTimeFormat();
|
|
53
|
+
*
|
|
54
|
+
* timeFormat: Gets the time format preference of the current user. "LANGUAGE_DEFAULT" | "TWELVE_HOUR" | "TWENTY_FOUR_HOUR"
|
|
55
|
+
* setTimeFormat: Sets the time format preference of the current user.
|
|
56
|
+
* @see { CurrentUserPreferenceState}
|
|
57
|
+
*/
|
|
58
|
+
export declare const useCurrentUserTimeFormat: () => {
|
|
59
|
+
timeFormat: import("@trackunit/iris-app-runtime-core-api").TimeFormatType | null;
|
|
60
|
+
setTimeFormat: ((timeFormat: import("@trackunit/iris-app-runtime-core-api").TimeFormatType) => void) | undefined;
|
|
61
|
+
};
|
|
47
62
|
/**
|
|
48
63
|
* This is a hook providing the Current User Favorite Insights.
|
|
49
64
|
*
|