@dexteel/mesf-core 7.14.0 → 7.15.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,3 +1,3 @@
1
1
  {
2
- ".": "7.14.0"
2
+ ".": "7.15.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [7.15.0](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v7.14.0...@dexteel/mesf-core-v7.15.0) (2026-03-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * **version-check:** add frontend polling hook for update notifications ([feaf9ff](https://github.com/dexteel/mesf-core-frontend/commit/feaf9ff9cec2e0d167f9b256cbc8789d5b6c8dc5))
9
+
3
10
  ## [7.14.0](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v7.13.3...@dexteel/mesf-core-v7.14.0) (2026-02-26)
4
11
 
5
12
 
@@ -0,0 +1,17 @@
1
+ type FrontendVersionResponse = {
2
+ hash: string;
3
+ lastModifiedUtc?: string;
4
+ };
5
+ type UseFrontendVersionCheckOptions = {
6
+ endpoint?: string;
7
+ intervalMs?: number;
8
+ enabled?: boolean;
9
+ onUpdate?: (response: FrontendVersionResponse) => void;
10
+ };
11
+ type UseFrontendVersionCheckResult = {
12
+ isUpdateAvailable: boolean;
13
+ currentHash: string | null;
14
+ error: Error | null;
15
+ };
16
+ export declare const useFrontendVersionCheck: ({ endpoint, intervalMs, enabled, onUpdate, }?: UseFrontendVersionCheckOptions) => UseFrontendVersionCheckResult;
17
+ export {};
package/dist/index.d.ts CHANGED
@@ -23,6 +23,7 @@ export * from "./controls";
23
23
  export * from "./css/themeMESF";
24
24
  export { HelmetDexteel } from "./helmet/HelmetDexteel";
25
25
  export * from "./hooks/useMesfRealtime";
26
+ export * from "./hooks/useFrontendVersionCheck";
26
27
  export * from "./MESFMain";
27
28
  export { logbookNavbar, logbookRoutesMESF } from "./pages/logbook";
28
29
  export { sectionLogbookNavbar, sectionLogbookRoutesMESF, } from "./pages/section-logbook";
package/dist/index.esm.js CHANGED
@@ -9591,6 +9591,77 @@ const UTLSettingsProvider = ({ children }) => {
9591
9591
  return (React__default.createElement(UTLSettingsContext.Provider, { value: { state, actions, isLoading } }, children));
9592
9592
  };
9593
9593
 
9594
+ const useFrontendVersionCheck = ({ endpoint = "/frontend/version", intervalMs = 60000, enabled = true, onUpdate, } = {}) => {
9595
+ const [isUpdateAvailable, setIsUpdateAvailable] = useState(false);
9596
+ const [currentHash, setCurrentHash] = useState(null);
9597
+ const [error, setError] = useState(null);
9598
+ const initialHashRef = useRef(null);
9599
+ useEffect(() => {
9600
+ if (!enabled || isUpdateAvailable) {
9601
+ return;
9602
+ }
9603
+ let isDisposed = false;
9604
+ let intervalId = null;
9605
+ const loadVersion = () => __awaiter(void 0, void 0, void 0, function* () {
9606
+ try {
9607
+ const separator = endpoint.includes("?") ? "&" : "?";
9608
+ const response = yield fetch(`${endpoint}${separator}_t=${Date.now()}`, {
9609
+ cache: "no-store",
9610
+ });
9611
+ if (!response.ok) {
9612
+ throw new Error(`Version check failed with status ${response.status}`);
9613
+ }
9614
+ const payload = (yield response.json());
9615
+ if (!(payload === null || payload === void 0 ? void 0 : payload.hash)) {
9616
+ throw new Error("Version check response does not include a hash");
9617
+ }
9618
+ if (isDisposed) {
9619
+ return;
9620
+ }
9621
+ setError(null);
9622
+ setCurrentHash(payload.hash);
9623
+ if (!initialHashRef.current) {
9624
+ initialHashRef.current = payload.hash;
9625
+ return;
9626
+ }
9627
+ if (initialHashRef.current !== payload.hash) {
9628
+ setIsUpdateAvailable(true);
9629
+ onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(payload);
9630
+ if (intervalId !== null) {
9631
+ window.clearInterval(intervalId);
9632
+ }
9633
+ }
9634
+ }
9635
+ catch (requestError) {
9636
+ if (isDisposed) {
9637
+ return;
9638
+ }
9639
+ if (requestError instanceof Error) {
9640
+ setError(requestError);
9641
+ }
9642
+ else {
9643
+ setError(new Error("Unexpected error while checking frontend version"));
9644
+ }
9645
+ }
9646
+ });
9647
+ void loadVersion();
9648
+ intervalId = window.setInterval(() => {
9649
+ void loadVersion();
9650
+ }, intervalMs);
9651
+ return () => {
9652
+ isDisposed = true;
9653
+ if (intervalId !== null) {
9654
+ window.clearInterval(intervalId);
9655
+ }
9656
+ };
9657
+ }, [enabled, endpoint, intervalMs, isUpdateAvailable, onUpdate]);
9658
+ return {
9659
+ isUpdateAvailable,
9660
+ currentHash,
9661
+ error,
9662
+ };
9663
+ };
9664
+
9594
9665
  const RouterContext = createContext(() => React__default.createElement(React__default.Fragment, null));
9595
9666
  const ConfigurationContext = createContext([
9596
9667
  [],
@@ -20169,5 +20240,5 @@ var areaSelector = /*#__PURE__*/Object.freeze({
20169
20240
  AreaSelector: AreaSelector
20170
20241
  });
20171
20242
 
20172
- export { Account, AssetProvider, AssetTreePicker, AuthContext, AuthProvider, ButtonWithLoading, ChangePassword, CheckBoxControl, Configuration$1 as Configuration, ContextMenu$1 as ContextMenu, ContextMenuMESFProvider, CreateNewAssetDialog, CurrencyFormatter, DataGridControl, DateFormatter, DateTimeFormatter, ENTRY_INITIAL_VALUES$1 as ENTRY_INITIAL_VALUES, EditAssetDialog, ErrorModal, ExcelIcon, FetchError, FilterPanel, GenericPanel, GenericTable, GetCrewColor, GetShiftColor, HelmetDexteel, IntegerFormatter, LogbookSettingsInitialState, LogbookSettingsProvider, Login, Logout, LongFilterPanel, MESApiService, MESFLogbookEntry$1 as MESFLogbookEntry, MESFLogbookReport$1 as MESFLogbookReport, MESFMain, MESSAGE_API, MESSAGE_ERRORS, MasterDetailPanel, MesfModal, ModalTreeFilterControl, MultipleSelectorControl, NumberFormatter, RemoveAssetDialog, SPExecutorPage, ShiftDayNavigatorControl, ShiftNavigatorProvider, ShiftPeriodNavigatorControl, SimplePasswordControl, SimpleSelectorControl, TimeAndUserMenu, TimeFormatter, TimeService, TreePickerControl, TreePickerControlV2, USER_LABELS, UTLSettingsProvider, UserProvider, axiosInstance, deleteUser, dxtServerTimeZone, dxtToLocalServerTime, dxtToUTC, formatNumber, getAuthTypes, getCrewStyle, getDataUser, getEntries$1 as getEntries, getError, getMomentTz, getShiftByParameters, getShiftStyle, getShiftsRangeByParameters, getTokenFromLS, getUserPermissionsFromAPI, getUsers, logbookNavbar, logbookRoutesMESF, renewToken, routeLogbookEntry$1 as routeLogbookEntry, routeLogbookReport, useSearchAssets as searchAssets, sectionLogbookNavbar, sectionLogbookRoutesMESF, setPassword, setProfilesToUser, themeDXT, themeMESF, upsertUser, useAssetContext, useContextMenuMESF, useEntries$1 as useEntries, useHasPermission, useHasProfile, useLogbookSettings, useMesfRealtime, useShiftNavigator, useShiftNavigatorManager, useToken, useUTLSettingsContext, useUserContext };
20243
+ export { Account, AssetProvider, AssetTreePicker, AuthContext, AuthProvider, ButtonWithLoading, ChangePassword, CheckBoxControl, Configuration$1 as Configuration, ContextMenu$1 as ContextMenu, ContextMenuMESFProvider, CreateNewAssetDialog, CurrencyFormatter, DataGridControl, DateFormatter, DateTimeFormatter, ENTRY_INITIAL_VALUES$1 as ENTRY_INITIAL_VALUES, EditAssetDialog, ErrorModal, ExcelIcon, FetchError, FilterPanel, GenericPanel, GenericTable, GetCrewColor, GetShiftColor, HelmetDexteel, IntegerFormatter, LogbookSettingsInitialState, LogbookSettingsProvider, Login, Logout, LongFilterPanel, MESApiService, MESFLogbookEntry$1 as MESFLogbookEntry, MESFLogbookReport$1 as MESFLogbookReport, MESFMain, MESSAGE_API, MESSAGE_ERRORS, MasterDetailPanel, MesfModal, ModalTreeFilterControl, MultipleSelectorControl, NumberFormatter, RemoveAssetDialog, SPExecutorPage, ShiftDayNavigatorControl, ShiftNavigatorProvider, ShiftPeriodNavigatorControl, SimplePasswordControl, SimpleSelectorControl, TimeAndUserMenu, TimeFormatter, TimeService, TreePickerControl, TreePickerControlV2, USER_LABELS, UTLSettingsProvider, UserProvider, axiosInstance, deleteUser, dxtServerTimeZone, dxtToLocalServerTime, dxtToUTC, formatNumber, getAuthTypes, getCrewStyle, getDataUser, getEntries$1 as getEntries, getError, getMomentTz, getShiftByParameters, getShiftStyle, getShiftsRangeByParameters, getTokenFromLS, getUserPermissionsFromAPI, getUsers, logbookNavbar, logbookRoutesMESF, renewToken, routeLogbookEntry$1 as routeLogbookEntry, routeLogbookReport, useSearchAssets as searchAssets, sectionLogbookNavbar, sectionLogbookRoutesMESF, setPassword, setProfilesToUser, themeDXT, themeMESF, upsertUser, useAssetContext, useContextMenuMESF, useEntries$1 as useEntries, useFrontendVersionCheck, useHasPermission, useHasProfile, useLogbookSettings, useMesfRealtime, useShiftNavigator, useShiftNavigatorManager, useToken, useUTLSettingsContext, useUserContext };
20173
20244
  //# sourceMappingURL=index.esm.js.map