asab_webui_shell 25.2.8 → 26.1.1

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.
Files changed (40) hide show
  1. package/dist/actions.js +1 -2
  2. package/dist/components/branding/BrandImage.js +2 -2
  3. package/dist/config/ConfigService.js +10 -5
  4. package/dist/containers/Alerts/index.js +14 -9
  5. package/dist/containers/Application.js +45 -50
  6. package/dist/containers/Header/ApplicationScreenTitle/ApplicationScreenTitle.js +3 -3
  7. package/dist/containers/Header/ApplicationScreenTitle/index.js +3 -3
  8. package/dist/containers/Header/Help/HelpButton.js +5 -3
  9. package/dist/containers/Header/index.js +3 -3
  10. package/dist/containers/Header/reducer.js +0 -5
  11. package/dist/containers/Navigation/index.js +7 -4
  12. package/dist/containers/Router/ApplicationRouter.js +6 -4
  13. package/dist/containers/Router/index.js +7 -4
  14. package/dist/containers/Sidebar/NavbarBrand.js +4 -4
  15. package/dist/containers/Sidebar/SidebarBottomItem.js +8 -3
  16. package/dist/containers/Sidebar/SidebarItem.js +5 -5
  17. package/dist/containers/Sidebar/index.js +7 -5
  18. package/dist/containers/Toast/ToastContainer.js +2 -2
  19. package/dist/containers/Toast/ToastContainer.jsx +2 -2
  20. package/dist/modules/about/AboutScreen.js +6 -6
  21. package/dist/modules/auth/components/SessionExpirationAlert.js +1 -2
  22. package/dist/modules/auth/header.js +7 -11
  23. package/dist/modules/auth/index.js +37 -31
  24. package/dist/modules/auth/screens/AccessControlScreen.js +5 -6
  25. package/dist/modules/auth/screens/InvitationScreen.js +1 -2
  26. package/dist/modules/i18n/dropdown.js +4 -2
  27. package/dist/modules/tenant/TenantDropdown.js +14 -17
  28. package/dist/modules/tenant/service.js +6 -4
  29. package/dist/screens/SuspenseScreen.js +1 -2
  30. package/dist/screens/UnauthorizedAccessScreen.js +2 -2
  31. package/dist/services/AttentionRequiredService.js +3 -2
  32. package/dist/services/HeaderService.js +4 -2
  33. package/dist/services/ReduxService.js +3 -8
  34. package/dist/services/TitleService.js +3 -3
  35. package/dist/theme/ThemeButton.js +8 -14
  36. package/dist/theme/ThemeReducer.js +2 -2
  37. package/dist/theme/ThemeService.js +4 -3
  38. package/package.json +5 -7
  39. package/dist/containers/Header/Preview/PreviewFlag.js +0 -35
  40. package/dist/containers/Header/Preview/PreviewService.js +0 -23
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = Sidebar;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _reactRedux = require("react-redux");
9
+ var _asab_webui_components = require("asab_webui_components");
10
10
  var _reactstrap = require("reactstrap");
11
11
  var _SidebarBottomItem = _interopRequireDefault(require("./SidebarBottomItem"));
12
12
  var _actions = require("../../actions");
@@ -18,16 +18,18 @@ function Sidebar(props) {
18
18
  var [isSmallResolution, setIsSmallResolution] = (0, _react.useState)(false);
19
19
  var [sidebarBottomBranding, setSidebarBottomBranding] = (0, _react.useState)({});
20
20
  var [windowWidth, setWindowWidth] = (0, _react.useState)(window.innerWidth);
21
- var sidebarItems = (0, _reactRedux.useSelector)(state => {
21
+ var sidebarItems = (0, _asab_webui_components.useAppSelector)(state => {
22
22
  var _state$navigation;
23
23
  return (_state$navigation = state.navigation) === null || _state$navigation === void 0 ? void 0 : _state$navigation.navItems;
24
24
  });
25
- var sessionExpired = (0, _reactRedux.useSelector)(state => {
25
+ var sessionExpired = (0, _asab_webui_components.useAppSelector)(state => {
26
26
  var _state$auth;
27
27
  return (_state$auth = state.auth) === null || _state$auth === void 0 ? void 0 : _state$auth.sessionExpired;
28
28
  });
29
- var theme = (0, _reactRedux.useSelector)(state => state.theme);
30
- var dispatch = (0, _reactRedux.useDispatch)();
29
+ var theme = (0, _asab_webui_components.useAppSelector)(state => state.theme);
30
+ var {
31
+ dispatch
32
+ } = (0, _asab_webui_components.useAppStore)();
31
33
  (0, _react.useEffect)(() => {
32
34
  // Collapse sidebar if innerWidth is smaller or equal to 944px on page initialization
33
35
  if (window.innerWidth <= 944) {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = ToastContainer;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- var _reactRedux = require("react-redux");
8
+ var _asab_webui_components = require("asab_webui_components");
9
9
  var _actions = require("../../actions");
10
10
  var _ToastComponent = require("./ToastComponent.js");
11
11
  var _reducer = require("./reducer.js");
@@ -14,7 +14,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
14
14
  function ToastContainer(props) {
15
15
  var _attentionRequired$be;
16
16
  // Get the toast data from Redux (assuming it comes from `attentionrequired.beacon`)
17
- var attentionRequired = (0, _reactRedux.useSelector)(state => {
17
+ var attentionRequired = (0, _asab_webui_components.useAppSelector)(state => {
18
18
  var _state$attentionrequi;
19
19
  return (_state$attentionrequi = state.attentionrequired) === null || _state$attentionrequi === void 0 ? void 0 : _state$attentionrequi.beacon;
20
20
  });
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useReducer } from 'react';
2
- import { useSelector } from 'react-redux';
2
+ import { useAppSelector } from 'asab_webui_components';
3
3
  import { DEL_TOAST, ADD_TOAST } from '../../actions';
4
4
 
5
5
  import { ToastComponent } from './ToastComponent.jsx';
@@ -8,7 +8,7 @@ import { toastReducer } from './reducer.jsx';
8
8
  // Toast container
9
9
  export default function ToastContainer(props) {
10
10
  // Get the toast data from Redux (assuming it comes from `attentionrequired.beacon`)
11
- const attentionRequired = useSelector((state) => state.attentionrequired?.beacon);
11
+ const attentionRequired = useAppSelector((state) => state.attentionrequired?.beacon);
12
12
  const toastData = attentionRequired?.['beacon.toast']?.data || [];
13
13
 
14
14
  // useReducer to manage the local state of toasts
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactI18next = require("react-i18next");
9
- var _reactRedux = require("react-redux");
9
+ var _asab_webui_components = require("asab_webui_components");
10
10
  var _BrandImage = require("../../components/branding/BrandImage");
11
11
  var _reactstrap = require("reactstrap");
12
12
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
13
13
  function AboutScreen(props) {
14
14
  var [brandImage, setBrandImage] = (0, _react.useState)(undefined);
15
- var theme = (0, _reactRedux.useSelector)(state => state.theme);
15
+ var theme = (0, _asab_webui_components.useAppSelector)(state => state.theme);
16
16
  (0, _react.useEffect)(() => {
17
17
  setBrandImage((0, _BrandImage.getBrandImage)(props, theme));
18
18
  }, [theme]);
@@ -52,19 +52,19 @@ function AboutCard(props) {
52
52
  var {
53
53
  t
54
54
  } = (0, _reactI18next.useTranslation)();
55
- var title = (0, _reactRedux.useSelector)(state => {
55
+ var title = (0, _asab_webui_components.useAppSelector)(state => {
56
56
  var _state$config;
57
57
  return (_state$config = state.config) === null || _state$config === void 0 ? void 0 : _state$config.title;
58
58
  });
59
- var vendor = (0, _reactRedux.useSelector)(state => {
59
+ var vendor = (0, _asab_webui_components.useAppSelector)(state => {
60
60
  var _state$config2;
61
61
  return (_state$config2 = state.config) === null || _state$config2 === void 0 ? void 0 : _state$config2.vendor;
62
62
  });
63
- var website = (0, _reactRedux.useSelector)(state => {
63
+ var website = (0, _asab_webui_components.useAppSelector)(state => {
64
64
  var _state$config3;
65
65
  return (_state$config3 = state.config) === null || _state$config3 === void 0 ? void 0 : _state$config3.website;
66
66
  });
67
- var email = (0, _reactRedux.useSelector)(state => {
67
+ var email = (0, _asab_webui_components.useAppSelector)(state => {
68
68
  var _state$config4;
69
69
  return (_state$config4 = state.config) === null || _state$config4 === void 0 ? void 0 : _state$config4.email;
70
70
  });
@@ -11,8 +11,7 @@ var _reactstrap = require("reactstrap");
11
11
  // Session expiration custom Alert component
12
12
  function SessionExpirationAlert(_ref) {
13
13
  var {
14
- alert,
15
- store
14
+ alert
16
15
  } = _ref;
17
16
  var {
18
17
  t
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.AuthHeaderDropdown = AuthHeaderDropdown;
8
8
  exports.AuthHeaderInvitation = AuthHeaderInvitation;
9
9
  var _react = _interopRequireDefault(require("react"));
10
- var _reactRedux = require("react-redux");
11
10
  var _reactRouterDom = require("react-router-dom");
12
11
  var _reactI18next = require("react-i18next");
12
+ var _asab_webui_components = require("asab_webui_components");
13
13
  var _seacatAuth = require("asab_webui_components/seacat-auth");
14
14
  var _reactstrap = require("reactstrap");
15
15
  require("./header.scss");
@@ -34,11 +34,7 @@ require("./header.scss");
34
34
  */
35
35
 
36
36
  function AuthHeaderInvitation(props) {
37
- var resources = (0, _reactRedux.useSelector)(state => {
38
- var _state$auth;
39
- return (_state$auth = state.auth) === null || _state$auth === void 0 ? void 0 : _state$auth.resources;
40
- });
41
- var tenant = (0, _reactRedux.useSelector)(state => {
37
+ var tenant = (0, _asab_webui_components.useAppSelector)(state => {
42
38
  var _state$tenant;
43
39
  return (_state$tenant = state.tenant) === null || _state$tenant === void 0 ? void 0 : _state$tenant.current;
44
40
  });
@@ -46,7 +42,7 @@ function AuthHeaderInvitation(props) {
46
42
  var {
47
43
  t
48
44
  } = (0, _reactI18next.useTranslation)();
49
- if (!tenant || !(0, _seacatAuth.isAuthorized)(['seacat:tenant:assign'])) {
45
+ if (!tenant || !(0, _seacatAuth.isAuthorized)(['seacat:tenant:assign'], props.app)) {
50
46
  return null;
51
47
  }
52
48
  ;
@@ -66,11 +62,11 @@ function AuthHeaderDropdown(props) {
66
62
  var {
67
63
  t
68
64
  } = (0, _reactI18next.useTranslation)();
69
- var userinfo = (0, _reactRedux.useSelector)(state => {
70
- var _state$auth2;
71
- return (_state$auth2 = state.auth) === null || _state$auth2 === void 0 ? void 0 : _state$auth2.userinfo;
65
+ var userinfo = (0, _asab_webui_components.useAppSelector)(state => {
66
+ var _state$auth;
67
+ return (_state$auth = state.auth) === null || _state$auth === void 0 ? void 0 : _state$auth.userinfo;
72
68
  });
73
- var isSuperuser = (0, _seacatAuth.isAuthorized)(['authz:superuser']);
69
+ var isSuperuser = (0, _seacatAuth.isAuthorized)(['authz:superuser'], props.app);
74
70
  var logout = () => {
75
71
  props.AuthModule.logout();
76
72
  };
@@ -150,7 +150,8 @@ class AuthModule extends _asab_webui_components.Module {
150
150
  }
151
151
 
152
152
  // Validate resources of items and children in navigation (resource validation depends on tenant)
153
- if (_this.App.Store && _this.App.Services.TenantService && _this.UserInfo !== null) {
153
+ if (_this.App.AppStore && _this.App.Services.TenantService && _this.UserInfo !== null) {
154
+ var _this$App, _this$App$dispatch;
154
155
  var currentTenant = _this.App.Services.TenantService.getCurrentTenant();
155
156
  var resources = _this.UserInfo.resources ? _this.UserInfo.resources[currentTenant] : [];
156
157
  /*
@@ -164,13 +165,13 @@ class AuthModule extends _asab_webui_components.Module {
164
165
  yield _this.Api.login(_this.RedirectURL, _force_login_prompt2);
165
166
  return;
166
167
  }
167
- if (_this.App.Store != null) {
168
- _this.App.Store.dispatch({
169
- type: _actions.types.AUTH_RESOURCES,
170
- resources: resources
171
- });
172
- }
173
- yield _this.validateNavigation();
168
+ (_this$App = _this.App) === null || _this$App === void 0 || (_this$App = _this$App.AppStore) === null || _this$App === void 0 || (_this$App$dispatch = _this$App.dispatch) === null || _this$App$dispatch === void 0 || _this$App$dispatch.call(_this$App, {
169
+ type: _actions.types.AUTH_RESOURCES,
170
+ resources: resources
171
+ });
172
+ yield _this.validateNavigation({
173
+ resources
174
+ });
174
175
  }
175
176
  if (_this.UserInfo != null) {
176
177
  yield _this._startSessionExpirationValidation(); // Start session validation
@@ -228,12 +229,13 @@ class AuthModule extends _asab_webui_components.Module {
228
229
  if (mockParams.tenants) {
229
230
  mockParams["tenants"] = Object.values(mockParams.tenants);
230
231
  }
231
- if (_this2.App.Store != null) {
232
- _this2.App.Store.dispatch({
232
+ if (_this2.App.AppStore) {
233
+ var _this2$App$AppStore$d, _this2$App$AppStore, _this2$App$AppStore$d2, _this2$App$AppStore2;
234
+ (_this2$App$AppStore$d = (_this2$App$AppStore = _this2.App.AppStore).dispatch) === null || _this2$App$AppStore$d === void 0 || _this2$App$AppStore$d.call(_this2$App$AppStore, {
233
235
  type: _actions.types.AUTH_USERINFO,
234
236
  payload: mockParams
235
237
  });
236
- _this2.App.Store.dispatch({
238
+ (_this2$App$AppStore$d2 = (_this2$App$AppStore2 = _this2.App.AppStore).dispatch) === null || _this2$App$AppStore$d2 === void 0 || _this2$App$AppStore$d2.call(_this2$App$AppStore2, {
237
239
  type: _actions.types.AUTH_RESOURCES,
238
240
  resources: mockParams["resources"]
239
241
  });
@@ -263,16 +265,18 @@ class AuthModule extends _asab_webui_components.Module {
263
265
  }
264
266
 
265
267
  // TODO: reconsider removing async/await with promise
266
- validateNavigation() {
268
+ validateNavigation(_ref) {
267
269
  var _this3 = this;
268
270
  return (0, _asyncToGenerator2.default)(function* () {
269
- var _state$navigation, _state$auth;
270
- var state = _this3.App.Store.getState();
271
+ var _state$navigation, _this3$App$AppStore$d, _this3$App$AppStore;
272
+ var {
273
+ resources
274
+ } = _ref;
275
+ var state = _this3.App.AppStore.state;
271
276
  var navItems = (_state$navigation = state.navigation) === null || _state$navigation === void 0 ? void 0 : _state$navigation.navItems;
272
- var resources = (_state$auth = state.auth) === null || _state$auth === void 0 ? void 0 : _state$auth.resources;
273
277
  var authorizedNavItems = [];
274
278
  navItems && (yield Promise.all(navItems.map(/*#__PURE__*/function () {
275
- var _ref = (0, _asyncToGenerator2.default)(function* (itm, idx) {
279
+ var _ref2 = (0, _asyncToGenerator2.default)(function* (itm, idx) {
276
280
  if (resources.indexOf('authz:superuser') !== -1) {
277
281
  // If user is superuser, validate every navigation item
278
282
  authorizedNavItems.push(itm);
@@ -297,10 +301,10 @@ class AuthModule extends _asab_webui_components.Module {
297
301
  }
298
302
  });
299
303
  return function (_x, _x2) {
300
- return _ref.apply(this, arguments);
304
+ return _ref2.apply(this, arguments);
301
305
  };
302
306
  }())));
303
- _this3.App.Store.dispatch({
307
+ (_this3$App$AppStore$d = (_this3$App$AppStore = _this3.App.AppStore).dispatch) === null || _this3$App$AppStore$d === void 0 || _this3$App$AppStore$d.call(_this3$App$AppStore, {
304
308
  type: _actions2.SET_NAVIGATION_ITEMS,
305
309
  navItems: authorizedNavItems
306
310
  });
@@ -314,7 +318,7 @@ class AuthModule extends _asab_webui_components.Module {
314
318
  // Item's children validation
315
319
  var authorizedNavChildren = [];
316
320
  yield Promise.all(itm.children.map(/*#__PURE__*/function () {
317
- var _ref2 = (0, _asyncToGenerator2.default)(function* (child, id) {
321
+ var _ref3 = (0, _asyncToGenerator2.default)(function* (child, id) {
318
322
  if (child.resource) {
319
323
  var access_auth = _this4._validateItemNav(child.resource, resources);
320
324
  if (access_auth == true) {
@@ -323,7 +327,7 @@ class AuthModule extends _asab_webui_components.Module {
323
327
  }
324
328
  });
325
329
  return function (_x3, _x4) {
326
- return _ref2.apply(this, arguments);
330
+ return _ref3.apply(this, arguments);
327
331
  };
328
332
  }()));
329
333
  return authorizedNavChildren;
@@ -366,8 +370,9 @@ class AuthModule extends _asab_webui_components.Module {
366
370
  } catch (err) {
367
371
  console.error("Failed to update user info", err);
368
372
  _this5.UserInfo = null;
369
- if (_this5.App.Store != null) {
370
- _this5.App.Store.dispatch({
373
+ if (_this5.App.AppStore) {
374
+ var _this5$App$AppStore$d, _this5$App$AppStore;
375
+ (_this5$App$AppStore$d = (_this5$App$AppStore = _this5.App.AppStore).dispatch) === null || _this5$App$AppStore$d === void 0 || _this5$App$AppStore$d.call(_this5$App$AppStore, {
371
376
  type: _actions.types.AUTH_USERINFO,
372
377
  payload: _this5.UserInfo
373
378
  });
@@ -376,8 +381,9 @@ class AuthModule extends _asab_webui_components.Module {
376
381
  }
377
382
  _this5.UserInfo = response.data;
378
383
  _this5.SessionExpiration = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.exp;
379
- if (_this5.App.Store != null) {
380
- _this5.App.Store.dispatch({
384
+ if (_this5.App.AppStore) {
385
+ var _this5$App$AppStore$d2, _this5$App$AppStore2;
386
+ (_this5$App$AppStore$d2 = (_this5$App$AppStore2 = _this5.App.AppStore).dispatch) === null || _this5$App$AppStore$d2 === void 0 || _this5$App$AppStore$d2.call(_this5$App$AppStore2, {
381
387
  type: _actions.types.AUTH_USERINFO,
382
388
  payload: _this5.UserInfo
383
389
  });
@@ -470,7 +476,7 @@ class AuthModule extends _asab_webui_components.Module {
470
476
  var warningDisplayed = false; // Tracks if the "about to expire" warning has been shown
471
477
 
472
478
  var _validateSession = /*#__PURE__*/function () {
473
- var _ref3 = (0, _asyncToGenerator2.default)(function* () {
479
+ var _ref4 = (0, _asyncToGenerator2.default)(function* () {
474
480
  var currentTime = Date.now() / 1000; // Convert milliseconds to seconds
475
481
  var timeRemaining = _this8.SessionExpiration - currentTime; // Time difference for triggering "about to expire" warning
476
482
  // Prevent glitches on very large time remaining values
@@ -522,13 +528,13 @@ class AuthModule extends _asab_webui_components.Module {
522
528
  // Stop further checks
523
529
  clearTimeout(_this8.sessionValidationInterval);
524
530
  _this8.sessionValidationInterval = null;
525
- _this8.App.addAlert("info", "ASABAuthModule|Your session has expired.", 3600 * 1000, true, (alert, store) => /*#__PURE__*/_react.default.createElement(_SessionExpirationAlert.SessionExpirationAlert, {
526
- alert: alert,
527
- store: store
531
+ _this8.App.addAlert("info", "ASABAuthModule|Your session has expired.", 3600 * 1000, true, alert => /*#__PURE__*/_react.default.createElement(_SessionExpirationAlert.SessionExpirationAlert, {
532
+ alert: alert
528
533
  }));
529
534
  // Disable UI elements
530
- if (_this8.App.Store) {
531
- _this8.App.Store.dispatch({
535
+ if (_this8.App.AppStore) {
536
+ var _this8$App$AppStore$d, _this8$App$AppStore;
537
+ (_this8$App$AppStore$d = (_this8$App$AppStore = _this8.App.AppStore).dispatch) === null || _this8$App$AppStore$d === void 0 || _this8$App$AppStore$d.call(_this8$App$AppStore, {
532
538
  type: _actions.types.AUTH_SESSION_EXPIRATION,
533
539
  sessionExpired: true
534
540
  });
@@ -552,7 +558,7 @@ class AuthModule extends _asab_webui_components.Module {
552
558
  _this8.sessionValidationInterval = setTimeout(_validateSession, 10000);
553
559
  });
554
560
  return function validateSession() {
555
- return _ref3.apply(this, arguments);
561
+ return _ref4.apply(this, arguments);
556
562
  };
557
563
  }();
558
564
 
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _reactI18next = require("react-i18next");
10
- var _reactRedux = require("react-redux");
10
+ var _asab_webui_components = require("asab_webui_components");
11
11
  var _reactstrap = require("reactstrap");
12
12
  /*
13
13
 
@@ -36,23 +36,22 @@ function AccessControlScreen(props) {
36
36
  }
37
37
  var _default = exports.default = AccessControlScreen;
38
38
  function AccessControlCard(props) {
39
- var _useSelector;
40
39
  var {
41
40
  t,
42
41
  i18n
43
42
  } = (0, _reactI18next.useTranslation)();
44
- var tenant = (0, _reactRedux.useSelector)(state => {
43
+ var tenant = (0, _asab_webui_components.useAppSelector)(state => {
45
44
  var _state$tenant;
46
45
  return (_state$tenant = state.tenant) === null || _state$tenant === void 0 ? void 0 : _state$tenant.current;
47
46
  });
48
- var userinfo = (0, _reactRedux.useSelector)(state => {
47
+ var userinfo = (0, _asab_webui_components.useAppSelector)(state => {
49
48
  var _state$auth;
50
49
  return (_state$auth = state.auth) === null || _state$auth === void 0 ? void 0 : _state$auth.userinfo;
51
50
  });
52
- var resources = ((_useSelector = (0, _reactRedux.useSelector)(state => {
51
+ var resources = ((0, _asab_webui_components.useAppSelector)(state => {
53
52
  var _state$auth2;
54
53
  return (_state$auth2 = state.auth) === null || _state$auth2 === void 0 ? void 0 : _state$auth2.resources;
55
- })) === null || _useSelector === void 0 ? void 0 : _useSelector.sort()) || [];
54
+ }) || []).slice().sort();
56
55
  return /*#__PURE__*/_react.default.createElement(_reactstrap.Card, null, /*#__PURE__*/_react.default.createElement(_reactstrap.CardHeader, {
57
56
  className: "card-header-flex"
58
57
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -8,7 +8,6 @@ exports.default = InvitationScreen;
8
8
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _reactI18next = require("react-i18next");
11
- var _reactRedux = require("react-redux");
12
11
  var _asab_webui_components = require("asab_webui_components");
13
12
  var _reactRouterDom = require("react-router-dom");
14
13
  var _reactstrap = require("reactstrap");
@@ -19,7 +18,7 @@ function InvitationScreen(props) {
19
18
  var [isInvitationSuccessful, setIsInvitationSuccessful] = (0, _react.useState)(undefined);
20
19
  var [registrationUrl, setRegistrationUrl] = (0, _react.useState)(undefined);
21
20
  var [urlCopied, setUrlCopied] = (0, _react.useState)(undefined);
22
- var tenant = (0, _reactRedux.useSelector)(state => {
21
+ var tenant = (0, _asab_webui_components.useAppSelector)(state => {
23
22
  var _state$tenant;
24
23
  return (_state$tenant = state.tenant) === null || _state$tenant === void 0 ? void 0 : _state$tenant.current;
25
24
  });
@@ -7,7 +7,7 @@ exports.default = LanguageDropdown;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactI18next = require("react-i18next");
9
9
  var _actions = require("./actions");
10
- var _reactRedux = require("react-redux");
10
+ var _asab_webui_components = require("asab_webui_components");
11
11
  var _reactstrap = require("reactstrap");
12
12
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
13
13
  function LanguageDropdown(props) {
@@ -20,7 +20,9 @@ function LanguageDropdown(props) {
20
20
  // if the hard refresh is needed: window.location.reload(false);
21
21
  });
22
22
  };
23
- var dispatch = (0, _reactRedux.useDispatch)();
23
+ var {
24
+ dispatch
25
+ } = (0, _asab_webui_components.useAppStore)();
24
26
  (0, _react.useEffect)(() => {
25
27
  var _i18n$language;
26
28
  dispatch({
@@ -3,20 +3,24 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = TenantDropdown;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- var _reactRedux = require("react-redux");
8
+ var _asab_webui_components = require("asab_webui_components");
9
9
  var _reactI18next = require("react-i18next");
10
10
  var _reactstrap = require("reactstrap");
11
11
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
12
- function TenantDropdown(_ref) {
13
- var {
14
- tenants,
15
- current
16
- } = _ref;
12
+ function TenantDropdown() {
17
13
  var {
18
14
  t
19
15
  } = (0, _reactI18next.useTranslation)();
16
+ var current = (0, _asab_webui_components.useAppSelector)(state => {
17
+ var _state$tenant;
18
+ return state === null || state === void 0 || (_state$tenant = state.tenant) === null || _state$tenant === void 0 ? void 0 : _state$tenant.current;
19
+ });
20
+ var tenants = (0, _asab_webui_components.useAppSelector)(state => {
21
+ var _state$tenant2;
22
+ return state === null || state === void 0 || (_state$tenant2 = state.tenant) === null || _state$tenant2 === void 0 ? void 0 : _state$tenant2.tenants;
23
+ });
20
24
  return /*#__PURE__*/_react.default.createElement(_reactstrap.UncontrolledDropdown, {
21
25
  direction: "down",
22
26
  title: t('tenant|Tenant')
@@ -39,16 +43,9 @@ function TenantDropdown(_ref) {
39
43
  tenant: tenant
40
44
  })))) : null);
41
45
  }
42
- function TenantLabel(_ref2) {
46
+ function TenantLabel(_ref) {
43
47
  var {
44
48
  tenant
45
- } = _ref2;
49
+ } = _ref;
46
50
  return /*#__PURE__*/_react.default.createElement("span", null, tenant);
47
- }
48
- var mapStateToProps = state => {
49
- return {
50
- current: state.tenant.current,
51
- tenants: state.tenant.tenants
52
- };
53
- };
54
- var _default = exports.default = (0, _reactRedux.connect)(mapStateToProps, null)(TenantDropdown);
51
+ }
@@ -40,6 +40,7 @@ class TenantService extends _asab_webui_components.Service {
40
40
  var _arguments = arguments,
41
41
  _this2 = this;
42
42
  return (0, _asyncToGenerator2.default)(function* () {
43
+ var _this2$App, _this2$App$dispatch;
43
44
  var authorizedTenant = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : undefined;
44
45
  // Extract the current tenant from URL params
45
46
  var tenantFromUrl = _this2._extractTenantFromUrl();
@@ -84,7 +85,7 @@ class TenantService extends _asab_webui_components.Service {
84
85
  }
85
86
 
86
87
  // Dispatch tenants obtained from userinfo
87
- _this2.App.Store.dispatch({
88
+ (_this2$App = _this2.App) === null || _this2$App === void 0 || (_this2$App = _this2$App.AppStore) === null || _this2$App === void 0 || (_this2$App$dispatch = _this2$App.dispatch) === null || _this2$App$dispatch === void 0 || _this2$App$dispatch.call(_this2$App, {
88
89
  type: _actions.types.TENANTS_CHANGED,
89
90
  tenants_list: availableTenants,
90
91
  current: currentTenant
@@ -124,9 +125,10 @@ class TenantService extends _asab_webui_components.Service {
124
125
 
125
126
  // getCurrentTenant() method is used for obtaining current tenant
126
127
  getCurrentTenant() {
127
- var state = this.App.Store.getState();
128
- var currentTenant = state.tenant.current;
129
- // If current tenant is not in redux store yet, get it from the URL params
128
+ var _this$App, _state$tenant;
129
+ var state = (_this$App = this.App) === null || _this$App === void 0 || (_this$App = _this$App.AppStore) === null || _this$App === void 0 ? void 0 : _this$App.state;
130
+ var currentTenant = state === null || state === void 0 || (_state$tenant = state.tenant) === null || _state$tenant === void 0 ? void 0 : _state$tenant.current;
131
+ // If current tenant is not in Application store yet, get it from the URL params
130
132
  if (!currentTenant) {
131
133
  currentTenant = this._extractTenantFromUrl();
132
134
  }
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = SuspenseScreen;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- var _reactRedux = require("react-redux");
9
8
  var _asab_webui_components = require("asab_webui_components");
10
9
  var _reactstrap = require("reactstrap");
11
10
  var _BrandImage = require("../components/branding/BrandImage");
@@ -13,7 +12,7 @@ require("./SuspenseScreen.scss");
13
12
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
14
13
  function SuspenseScreen(props) {
15
14
  var [brandImage, setBrandImage] = (0, _react.useState)(undefined);
16
- var theme = (0, _reactRedux.useSelector)(state => state.theme);
15
+ var theme = (0, _asab_webui_components.useAppSelector)(state => state.theme);
17
16
  (0, _react.useEffect)(() => {
18
17
  setBrandImage((0, _BrandImage.getBrandImage)(props, theme));
19
18
  }, [theme]);
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = UnauthorizedAccessScreen;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactI18next = require("react-i18next");
9
- var _reactRedux = require("react-redux");
9
+ var _asab_webui_components = require("asab_webui_components");
10
10
  var _reactstrap = require("reactstrap");
11
11
  require("./UnauthorizedAccessScreen.scss");
12
12
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
@@ -23,7 +23,7 @@ function UnauthorizedAccessScreen(props) {
23
23
  var {
24
24
  t
25
25
  } = (0, _reactI18next.useTranslation)();
26
- var resources = (0, _reactRedux.useSelector)(state => {
26
+ var resources = (0, _asab_webui_components.useAppSelector)(state => {
27
27
  var _state$auth;
28
28
  return (_state$auth = state.auth) !== null && _state$auth !== void 0 && _state$auth.resources ? state.auth.resources : [];
29
29
  });
@@ -97,10 +97,11 @@ class AttentionRequiredService extends _asab_webui_components.Service {
97
97
  }
98
98
  }
99
99
 
100
- // Method for distributing the data into redux store
100
+ // Method for distributing the data into Application store
101
101
  distributeData(data) {
102
+ var _this$App2, _this$App2$dispatch;
102
103
  var transformedData = this.transformData(data);
103
- this.App.Store.dispatch({
104
+ (_this$App2 = this.App) === null || _this$App2 === void 0 || (_this$App2 = _this$App2.AppStore) === null || _this$App2 === void 0 || (_this$App2$dispatch = _this$App2.dispatch) === null || _this$App2$dispatch === void 0 || _this$App2$dispatch.call(_this$App2, {
104
105
  type: _actions.SET_ATTENTION_REQUIRED_BEACON,
105
106
  beacon: transformedData
106
107
  });
@@ -40,13 +40,14 @@ class HeaderService extends _asab_webui_components.Service {
40
40
  */
41
41
 
42
42
  addComponent(component) {
43
+ var _this$App, _this$App$dispatch;
43
44
  this.Items.push({
44
45
  'component': component.component,
45
46
  'componentProps': component.componentProps,
46
47
  'order': component.order,
47
48
  'fullscreenVisible': component.fullscreenVisible
48
49
  });
49
- this.App.Store.dispatch({
50
+ (_this$App = this.App) === null || _this$App === void 0 || (_this$App = _this$App.AppStore) === null || _this$App === void 0 || (_this$App$dispatch = _this$App.dispatch) === null || _this$App$dispatch === void 0 || _this$App$dispatch.call(_this$App, {
50
51
  type: _actions.SET_HEADER_NAVIGATION_ITEMS,
51
52
  headerNavItems: this.Items
52
53
  });
@@ -54,9 +55,10 @@ class HeaderService extends _asab_webui_components.Service {
54
55
 
55
56
  // This function removes a component from the Header
56
57
  removeComponent(component) {
58
+ var _this$App$AppStore, _this$App$AppStore$di;
57
59
  var filteredItems = this.Items.filter(item => item.component !== component);
58
60
  this.Items = filteredItems;
59
- this.App.Store.dispatch({
61
+ (_this$App$AppStore = this.App.AppStore) === null || _this$App$AppStore === void 0 || (_this$App$AppStore$di = _this$App$AppStore.dispatch) === null || _this$App$AppStore$di === void 0 || _this$App$AppStore$di.call(_this$App$AppStore, {
60
62
  type: _actions.SET_HEADER_NAVIGATION_ITEMS,
61
63
  headerNavItems: this.Items
62
64
  });
@@ -4,16 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ var _asab_webui_components = require("asab_webui_components");
7
8
  class ReduxService {
8
- constructor() {
9
- this.Reducers = {};
10
- }
9
+ // Register reducer
11
10
  addReducer(name, reducer) {
12
- if (name in this.Reducers) {
13
- console.warn("Reducer with name ".concat(name, " already exists."));
14
- return;
15
- }
16
- this.Reducers[name] = reducer;
11
+ (0, _asab_webui_components.registerReducer)(name, reducer);
17
12
  }
18
13
  }
19
14
  exports.default = ReduxService;
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _react = _interopRequireDefault(require("react"));
10
9
  var _asab_webui_components = require("asab_webui_components");
11
10
  var _actions = require("../actions");
12
11
  class TitleService extends _asab_webui_components.Service {
@@ -21,9 +20,10 @@ class TitleService extends _asab_webui_components.Service {
21
20
  (0, _defineProperty2.default)(this, "clearSubtitle", () => {
22
21
  this._updateSubtitle(undefined);
23
22
  });
24
- // Method for dispatching subtitle update to Redux store
23
+ // Method for dispatching subtitle update to Application store
25
24
  (0, _defineProperty2.default)(this, "_updateSubtitle", subtitle => {
26
- this.App.Store.dispatch({
25
+ var _this$App, _this$App$dispatch;
26
+ (_this$App = this.App) === null || _this$App === void 0 || (_this$App = _this$App.AppStore) === null || _this$App === void 0 || (_this$App$dispatch = _this$App.dispatch) === null || _this$App$dispatch === void 0 || _this$App$dispatch.call(_this$App, {
27
27
  type: _actions.SET_SUBTITLE,
28
28
  subtitle: subtitle
29
29
  });