@dexteel/mesf-core 4.24.0 → 4.25.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
- ".": "4.24.0"
2
+ ".": "4.25.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ # Changelog
2
+
3
+ ## [4.25.0](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v4.24.1...@dexteel/mesf-core-v4.25.0) (2025-02-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * **Realtime:** add useMesfRealtime hook ([974b52b](https://github.com/dexteel/mesf-core-frontend/commit/974b52b7f0e73784ab5bb3a18a623f893359ad8b))
9
+ * **ShiftNavigator:** Listen now datetime to show next shifts ([b279ff7](https://github.com/dexteel/mesf-core-frontend/commit/b279ff7d01aa5f8e3e69d973e60602940b69f7ec))
10
+
11
+ ## [4.24.1] - 2025-02-04
12
+
13
+
14
+
15
+ # Changelog
16
+
17
+ ## [4.24.1](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v4.24.0...@dexteel/mesf-core-v4.24.1) (2025-02-04)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **RealTime:** expose signalR from mesf-core ([584f37c](https://github.com/dexteel/mesf-core-frontend/commit/584f37ce60c649241c2e4ed0a00c35cc19ffbe6b))
23
+
24
+ ## [4.24.0] - 2025-02-04
25
+
26
+
27
+
1
28
  # Changelog
2
29
 
3
30
  ## [4.24.0](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v4.23.1...@dexteel/mesf-core-v4.24.0) (2025-02-04)
@@ -0,0 +1,5 @@
1
+ type Props = {
2
+ onReceiveMessage: (author: string, message: string) => void;
3
+ };
4
+ export declare const useMesfRealtime: ({ onReceiveMessage }: Props) => void;
5
+ export {};
package/dist/index.d.ts CHANGED
@@ -15,3 +15,5 @@ export * from "./utils";
15
15
  export * from "./components/shared/buttons/button-with-loading";
16
16
  export * from "./configuration/pages/users/models/User";
17
17
  export * from "./configuration/pages/users/repositories/UsersRepository";
18
+ export * from "@microsoft/signalr";
19
+ export * from "./hooks/useMesfRealtime";
package/dist/index.esm.js CHANGED
@@ -23,6 +23,7 @@ import EditIcon from '@material-ui/icons/Edit';
23
23
  import PlaylistAddIcon from '@material-ui/icons/PlaylistAdd';
24
24
  import { isNil, get } from 'lodash';
25
25
  import { HubConnectionBuilder, LogLevel as LogLevel$1 } from '@microsoft/signalr';
26
+ export * from '@microsoft/signalr';
26
27
  import { Alert as Alert$3, Autocomplete } from '@material-ui/lab';
27
28
  import { useForm, Controller } from 'react-hook-form';
28
29
  import 'ag-grid-community/styles/ag-theme-material.min.css';
@@ -8149,6 +8150,8 @@ var moment$2 = getMomentTz();
8149
8150
  var ShiftDayNavigatorControl = function (props) {
8150
8151
  var _a;
8151
8152
  var _b = useShiftNavigator(), shiftInfo = _b.shiftInfo, initShiftNavigator = _b.initShiftNavigator, moveShift = _b.moveShift, getShiftDataFromAPI = _b.getShiftDataFromAPI;
8153
+ var _c = useState(shiftInfo), shiftInfoCopy = _c[0], setShiftInfoCopy = _c[1];
8154
+ var _d = useState(""); _d[0]; var setError = _d[1];
8152
8155
  var shiftId = useParams().shiftId;
8153
8156
  var firstRender = useRef(true);
8154
8157
  var updateHistory = function (shiftId) {
@@ -8160,6 +8163,45 @@ var ShiftDayNavigatorControl = function (props) {
8160
8163
  updateHistory((_a = shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId) === null || _a === void 0 ? void 0 : _a.toString());
8161
8164
  }
8162
8165
  }
8166
+ useEffect(function () {
8167
+ if ((shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentEnd) && shiftInfo.CurrentEnd < new Date()) {
8168
+ var fn = function () { return __awaiter(void 0, void 0, void 0, function () {
8169
+ var resp, shift, e_1;
8170
+ return __generator(this, function (_a) {
8171
+ switch (_a.label) {
8172
+ case 0:
8173
+ _a.trys.push([0, 2, , 3]);
8174
+ return [4 /*yield*/, getShiftByParameters({
8175
+ productionDate: null,
8176
+ shiftId: shiftInfo.CurrentShiftId
8177
+ })];
8178
+ case 1:
8179
+ resp = _a.sent();
8180
+ if (resp.ok) {
8181
+ shift = __assign(__assign({}, resp.data), { CurrentProductionDate: moment$2
8182
+ .utc(resp.data.CurrentProductionDate)
8183
+ .toDate(), CurrentStart: moment$2.utc(resp.data.CurrentStart).toDate(), CurrentEnd: moment$2.utc(resp.data.CurrentEnd).toDate(), PreviousProductionDate: moment$2
8184
+ .utc(resp.data.PreviousProductionDate)
8185
+ .toDate(), PreviousStart: moment$2.utc(resp.data.PreviousStart).toDate(), PreviousEnd: moment$2.utc(resp.data.PreviousEnd).toDate(), LastProductionDate: moment$2
8186
+ .utc(resp.data.LastProductionDate)
8187
+ .toDate(), LastStart: moment$2.utc(resp.data.LastStart).toDate(), LastEnd: moment$2.utc(resp.data.LastEnd).toDate() });
8188
+ setShiftInfoCopy(shift);
8189
+ }
8190
+ return [3 /*break*/, 3];
8191
+ case 2:
8192
+ e_1 = _a.sent();
8193
+ setError(getError(e_1));
8194
+ return [3 /*break*/, 3];
8195
+ case 3: return [2 /*return*/];
8196
+ }
8197
+ });
8198
+ }); };
8199
+ fn();
8200
+ }
8201
+ }, [shiftInfo]);
8202
+ useEffect(function () {
8203
+ setShiftInfoCopy(shiftInfo);
8204
+ }, [shiftInfo]);
8163
8205
  useEffect(function () {
8164
8206
  if (firstRender.current) {
8165
8207
  firstRender.current = false;
@@ -8209,13 +8251,13 @@ var ShiftDayNavigatorControl = function (props) {
8209
8251
  React__default.createElement(TextField, { label: "Shift - Crew", value: "".concat((shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShift) || "", " - ").concat((shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentCrew) || ""), placeholder: "Shift", "aria-readonly": true, variant: "outlined", size: "small" })),
8210
8252
  React__default.createElement(Grid, { item: true },
8211
8253
  React__default.createElement(Tooltip, { title: "Next Shift" },
8212
- React__default.createElement(IconButton$1, { "aria-label": "next", color: "primary", disabled: !(shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.NextShiftId), onClick: function () {
8254
+ React__default.createElement(IconButton$1, { "aria-label": "next", color: "primary", disabled: !(shiftInfoCopy === null || shiftInfoCopy === void 0 ? void 0 : shiftInfoCopy.NextShiftId), onClick: function () {
8213
8255
  moveShift("Next").then(function () { });
8214
8256
  }, size: "small" },
8215
8257
  React__default.createElement(ArrowForwardRounded, null)))),
8216
8258
  React__default.createElement(Grid, { item: true },
8217
8259
  React__default.createElement(Tooltip, { title: "Last Shift" },
8218
- React__default.createElement(IconButton$1, { "aria-label": "delete", color: "primary", disabled: !(shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.LastShiftId) || !(shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.NextShiftId), onClick: function () {
8260
+ React__default.createElement(IconButton$1, { "aria-label": "delete", color: "primary", disabled: !(shiftInfoCopy === null || shiftInfoCopy === void 0 ? void 0 : shiftInfoCopy.LastShiftId) || !(shiftInfoCopy === null || shiftInfoCopy === void 0 ? void 0 : shiftInfoCopy.NextShiftId), onClick: function () {
8219
8261
  moveShift("Last").then(function () { });
8220
8262
  }, size: "small" },
8221
8263
  React__default.createElement(SkipNext, null)))))));
@@ -13630,6 +13672,36 @@ function MESFMain(_a) {
13630
13672
  React__default.createElement(Navigation, { showAreaSelector: showAreaSelector, showTrendingsIcon: showTrendingsIcon, navbarTitle: navbarTitle })))))))))))));
13631
13673
  }
13632
13674
 
13675
+ var useMesfRealtime = function (_a) {
13676
+ var onReceiveMessage = _a.onReceiveMessage;
13677
+ useEffect(function () {
13678
+ var connection = new HubConnectionBuilder()
13679
+ .withUrl("/ws")
13680
+ .withAutomaticReconnect()
13681
+ .configureLogging(LogLevel$1.Information)
13682
+ .build();
13683
+ connection
13684
+ .start()
13685
+ .then(function () {
13686
+ console.log("Connection started");
13687
+ })["catch"](function (err) {
13688
+ console.log("Error while starting connection: " + err);
13689
+ });
13690
+ connection.on("ReceiveMessage", function (author, message) {
13691
+ onReceiveMessage(author, message);
13692
+ });
13693
+ return function () {
13694
+ connection
13695
+ .stop()
13696
+ .then(function () {
13697
+ console.log("Connection stopped");
13698
+ })["catch"](function (err) {
13699
+ console.log("Error while stopping connection: " + err);
13700
+ });
13701
+ };
13702
+ }, []);
13703
+ };
13704
+
13633
13705
  var useDefaultAreaId = function (setError) {
13634
13706
  var _a = useUserContext(), userId = _a.state.userId, setDefaultAreaId = _a.actions.setDefaultAreaId;
13635
13707
  return function () {
@@ -13769,5 +13841,5 @@ var areaSelector = /*#__PURE__*/Object.freeze({
13769
13841
  AreaSelector: AreaSelector
13770
13842
  });
13771
13843
 
13772
- export { Account, AssetProvider, AuthContext, AuthProvider, BarChartControl, ButtonWithLoading, ChangePassword, CheckBoxControl, Configuration$1 as Configuration, ContextMenu$1 as ContextMenu, ContextMenuMESFProvider, CurrencyFormatter, DataGridControl, DateFormatter, DateTimeFormatter, ErrorModal, FetchError, FilterPanel, GenericPanel, GenericTable, GetCrewColor, GetShiftColor, HorizontalTextControl, IntegerFormatter, Login, Logout, LongFilterPanel, MESApiService, MESFMain, MESSAGE_API, MESSAGE_ERRORS, MasterDetailPanel, MesfModal, ModalTreeFilterControl, MultipleSelectorControl, NumberFormatter, NumericTextControl, ShiftDayNavigatorControl, ShiftNavigatorProvider, ShiftPeriodNavigatorControl, SimplePasswordControl, SimpleSelectorControl, SimpleTextAreaControl, SimpleTextControl, TimeFormatter, TimeService, TreePickerControl, TreePickerControlV2, TrendingsPage, USER_LABELS, UTLSettingsProvider, UploadFileControl, UserProvider, axiosInstance, deleteUser, dxtServerTimeZone, dxtToLocalServerTime, dxtToUTC, formatNumber, getAuthTypes, getCrewStyle, getDataUser, getError, getMomentTz, getProfiles, getShiftByParameters, getShiftStyle, getShiftsRangeByParameters, getTokenFromLS, getUsers, renewToken, setPassword, setProfilesToUser, upsertUser, useAssetContext, useContextMenuMESF, useShiftNavigator, useShiftNavigatorManager, useStyles$6 as useStyles, useToken, useUTLSettingsContext, useUserContext };
13844
+ export { Account, AssetProvider, AuthContext, AuthProvider, BarChartControl, ButtonWithLoading, ChangePassword, CheckBoxControl, Configuration$1 as Configuration, ContextMenu$1 as ContextMenu, ContextMenuMESFProvider, CurrencyFormatter, DataGridControl, DateFormatter, DateTimeFormatter, ErrorModal, FetchError, FilterPanel, GenericPanel, GenericTable, GetCrewColor, GetShiftColor, HorizontalTextControl, IntegerFormatter, Login, Logout, LongFilterPanel, MESApiService, MESFMain, MESSAGE_API, MESSAGE_ERRORS, MasterDetailPanel, MesfModal, ModalTreeFilterControl, MultipleSelectorControl, NumberFormatter, NumericTextControl, ShiftDayNavigatorControl, ShiftNavigatorProvider, ShiftPeriodNavigatorControl, SimplePasswordControl, SimpleSelectorControl, SimpleTextAreaControl, SimpleTextControl, TimeFormatter, TimeService, TreePickerControl, TreePickerControlV2, TrendingsPage, USER_LABELS, UTLSettingsProvider, UploadFileControl, UserProvider, axiosInstance, deleteUser, dxtServerTimeZone, dxtToLocalServerTime, dxtToUTC, formatNumber, getAuthTypes, getCrewStyle, getDataUser, getError, getMomentTz, getProfiles, getShiftByParameters, getShiftStyle, getShiftsRangeByParameters, getTokenFromLS, getUsers, renewToken, setPassword, setProfilesToUser, upsertUser, useAssetContext, useContextMenuMESF, useMesfRealtime, useShiftNavigator, useShiftNavigatorManager, useStyles$6 as useStyles, useToken, useUTLSettingsContext, useUserContext };
13773
13845
  //# sourceMappingURL=index.esm.js.map