@zeniai/client-epic-state 4.10.20 → 4.10.21

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.
@@ -2,8 +2,12 @@ import { RootState } from '../../reducer';
2
2
  import { ReviewCompany, ReviewCompanyListUIState } from './reviewCompanyViewState';
3
3
  import { User } from '../../entity/user/userState';
4
4
  import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
5
+ import { UserAndRole } from '../companyView/types/userAndRole';
6
+ import { AllowedValue } from '../../commonStateTypes/allowedValue';
5
7
  export interface ReviewCompanyView extends ReviewCompany {
6
8
  noteLastUpdatedBy?: User;
9
+ controllers: UserAndRole[];
10
+ customerGroups: AllowedValue[];
7
11
  }
8
12
  export interface ReviewCompanySelectorView extends SelectorView {
9
13
  companies: ReviewCompanyView[];
@@ -8,6 +8,8 @@ const toolkit_1 = require("@reduxjs/toolkit");
8
8
  const orderBy_1 = __importDefault(require("lodash/orderBy"));
9
9
  const values_1 = __importDefault(require("lodash/values"));
10
10
  const userSelector_1 = require("../../entity/user/userSelector");
11
+ const companySelector_1 = require("../../entity/company/companySelector");
12
+ const userAndRole_1 = require("../companyView/types/userAndRole");
11
13
  exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) => state, (rootState) => {
12
14
  const { filterText, sortKey, sortOrder } = rootState.reviewCompanyViewState.uiState;
13
15
  const companies = (0, values_1.default)(rootState.reviewCompanyViewState.reviewCompanyById)
@@ -16,7 +18,14 @@ exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) =>
16
18
  .toLowerCase()
17
19
  .includes(filterText.toLowerCase()))
18
20
  .map((company) => {
19
- const reviewViewCompany = Object.assign({}, company);
21
+ var _a, _b;
22
+ const companyWithSchema = (0, companySelector_1.getCompanyByCompanyId)(rootState.companyState, company.companyId);
23
+ const controllerUserIds = (_a = companyWithSchema === null || companyWithSchema === void 0 ? void 0 : companyWithSchema.company.managegmentInfo.controllerUserIds) !== null && _a !== void 0 ? _a : [];
24
+ const controllers = controllerUserIds
25
+ .map((userId) => (0, userAndRole_1.getUserAndUserRole)(rootState.userState, rootState.userRoleState, rootState.addressState, userId))
26
+ .filter((value) => value != null);
27
+ const groups = (_b = companyWithSchema === null || companyWithSchema === void 0 ? void 0 : companyWithSchema.schema.companyGroup) !== null && _b !== void 0 ? _b : [];
28
+ const reviewViewCompany = Object.assign(Object.assign({}, company), { controllers, customerGroups: groups });
20
29
  if (company.noteLastUpdatedUserId != null) {
21
30
  reviewViewCompany.noteLastUpdatedBy = (0, userSelector_1.getUserByUserId)(rootState.userState, company.noteLastUpdatedUserId);
22
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.10.20",
3
+ "version": "4.10.21",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",