@zeniai/client-epic-state 5.2.14 → 5.2.16

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 (132) hide show
  1. package/lib/entity/accountRecon/accountReconReducer.d.ts +2 -1
  2. package/lib/entity/accountRecon/accountReconReducer.js +22 -10
  3. package/lib/entity/accountRecon/accountReconSelector.d.ts +1 -0
  4. package/lib/entity/accountRecon/accountReconSelector.js +1 -0
  5. package/lib/entity/approvalRule/approvalRuleConflict.d.ts +13 -0
  6. package/lib/entity/approvalRule/approvalRuleConflict.js +16 -1
  7. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +1 -0
  8. package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
  9. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +78 -1
  10. package/lib/entity/jeSchedules/jeSchedulesPayload.js +183 -4
  11. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
  12. package/lib/entity/jeSchedules/jeSchedulesReducer.js +30 -2
  13. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +11 -2
  14. package/lib/entity/jeSchedules/jeSchedulesSelector.js +38 -3
  15. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +123 -1
  16. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +24 -1
  17. package/lib/entity/jeSchedules/jeSchedulesTypes.js +96 -1
  18. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  19. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  20. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
  21. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  22. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
  23. package/lib/epic.d.ts +10 -1
  24. package/lib/epic.js +18 -0
  25. package/lib/esm/entity/accountRecon/accountReconReducer.js +22 -10
  26. package/lib/esm/entity/accountRecon/accountReconSelector.js +1 -0
  27. package/lib/esm/entity/approvalRule/approvalRuleConflict.js +16 -1
  28. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
  29. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +183 -5
  30. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +30 -2
  31. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +36 -2
  32. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +86 -0
  33. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  34. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  35. package/lib/esm/epic.js +18 -0
  36. package/lib/esm/index.js +16 -10
  37. package/lib/esm/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.js +2 -2
  38. package/lib/esm/view/expenseAutomationView/epics/accountRecon/deleteCombinedStatementEpic.js +54 -0
  39. package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +1 -1
  40. package/lib/esm/view/expenseAutomationView/epics/accountRecon/updateCombinedStatementInfoEpic.js +3 -6
  41. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  42. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  43. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +41 -5
  44. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +45 -0
  45. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  46. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +104 -0
  47. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  48. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +138 -0
  49. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +79 -0
  50. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +180 -0
  51. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +111 -0
  52. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +28 -0
  53. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
  54. package/lib/esm/view/expenseAutomationView/helpers/reconciliationHelpers.js +12 -0
  55. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
  56. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +319 -29
  57. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +20 -2
  58. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
  59. package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  60. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +106 -0
  61. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +327 -22
  62. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -6
  63. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  64. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  65. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  66. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +20 -1
  67. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +20 -1
  68. package/lib/index.d.ts +18 -13
  69. package/lib/index.js +92 -47
  70. package/lib/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.d.ts +10 -2
  71. package/lib/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.js +1 -1
  72. package/lib/view/expenseAutomationView/epics/accountRecon/deleteCombinedStatementEpic.d.ts +9 -0
  73. package/lib/view/expenseAutomationView/epics/accountRecon/deleteCombinedStatementEpic.js +58 -0
  74. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +1 -1
  75. package/lib/view/expenseAutomationView/epics/accountRecon/updateCombinedStatementInfoEpic.js +3 -6
  76. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  77. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  78. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +3 -2
  79. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +39 -3
  80. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +21 -0
  81. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +49 -0
  82. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  83. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +9 -0
  84. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +108 -0
  85. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  86. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +29 -0
  87. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +9 -0
  88. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +142 -0
  89. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  90. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +83 -0
  91. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +13 -0
  92. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +187 -0
  93. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +65 -0
  94. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +115 -0
  95. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
  96. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +32 -0
  97. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
  98. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
  99. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.d.ts +6 -0
  100. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.js +13 -0
  101. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  102. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +86 -3
  103. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
  104. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +4 -0
  105. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +93 -12
  106. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +321 -29
  107. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  108. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +6 -1
  109. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +22 -4
  110. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  111. package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +1 -0
  112. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +42 -0
  113. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
  114. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +41 -7
  115. package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  116. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +21 -0
  117. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +112 -0
  118. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +34 -0
  119. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +335 -21
  120. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  121. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +83 -8
  122. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  123. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  124. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  125. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  126. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +4 -2
  127. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  128. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +20 -1
  129. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelectorTypes.d.ts +3 -0
  130. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +20 -1
  131. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelectorTypes.d.ts +3 -0
  132. package/package.json +1 -1
@@ -16,7 +16,7 @@ export declare const initialState: ScheduleListViewState;
16
16
  export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory: {
17
17
  selectedCategoryId: ID;
18
18
  selectedTimeframe: TimeframeTick;
19
- }, downloadCategories: string[], cacheOverride?: any], {
19
+ }, downloadCategories: string[], statusFilter?: "completed" | "new" | "ongoing" | "all" | undefined, cacheOverride?: any], {
20
20
  timeframeAndCategory: {
21
21
  selectedCategoryId: ID;
22
22
  selectedTimeframe: TimeframeTick;
@@ -24,16 +24,18 @@ export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCr
24
24
  scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
25
25
  cacheOverride: any;
26
26
  downloadCategories: string[];
27
+ statusFilter: "completed" | "new" | "ongoing" | "all";
27
28
  }, "scheduleListView/fetchDownloadSchedules", never, never>, fetchAccruedScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
28
29
  selectedCategoryId: ID;
29
30
  selectedTimeframe: TimeframeTick;
30
- } | undefined, cacheOverride?: any], {
31
+ } | undefined, cacheOverride?: any, statusFilter?: "completed" | "new" | "ongoing" | "all" | undefined], {
31
32
  timeframeAndCategory: {
32
33
  selectedCategoryId: ID;
33
34
  selectedTimeframe: TimeframeTick;
34
35
  } | undefined;
35
36
  scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
36
37
  cacheOverride: any;
38
+ statusFilter: "completed" | "new" | "ongoing" | "all";
37
39
  }, "scheduleListView/fetchAccruedScheduleList", never, never>, fetchScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
38
40
  selectedCategoryId: ID;
39
41
  selectedTimeframe: TimeframeTick;
@@ -90,8 +90,8 @@ const scheduleListView = (0, toolkit_1.createSlice)({
90
90
  reducers: {
91
91
  fetchDownloadSchedules: {
92
92
  reducer(draft, action) {
93
+ // Accrued is not downloaded through this action -- see fetchDownloadSchedulesEpic for why.
93
94
  if (action.payload.scheduleType !== 'accrued_expenses') {
94
- //if condition added for type narrowing
95
95
  const state = getState(draft, action.payload.scheduleType);
96
96
  const selectedTimeframe = action.payload.timeframeAndCategory.selectedTimeframe;
97
97
  const selectedCategoryId = action.payload.timeframeAndCategory.selectedCategoryId;
@@ -115,13 +115,14 @@ const scheduleListView = (0, toolkit_1.createSlice)({
115
115
  updateState(draft, action.payload.scheduleType, state);
116
116
  }
117
117
  },
118
- prepare(scheduleType, timeframeAndCategory, downloadCategories, cacheOverride = false) {
118
+ prepare(scheduleType, timeframeAndCategory, downloadCategories, statusFilter = 'all', cacheOverride = false) {
119
119
  return {
120
120
  payload: {
121
121
  timeframeAndCategory,
122
122
  scheduleType,
123
123
  cacheOverride,
124
124
  downloadCategories,
125
+ statusFilter,
125
126
  },
126
127
  };
127
128
  },
@@ -157,12 +158,13 @@ const scheduleListView = (0, toolkit_1.createSlice)({
157
158
  updateState(draft, action.payload.scheduleType, state);
158
159
  }
159
160
  },
160
- prepare(scheduleType, timeframeAndCategory, cacheOverride = false) {
161
+ prepare(scheduleType, timeframeAndCategory, cacheOverride = false, statusFilter = 'all') {
161
162
  return {
162
163
  payload: {
163
164
  timeframeAndCategory,
164
165
  scheduleType,
165
166
  cacheOverride,
167
+ statusFilter,
166
168
  },
167
169
  };
168
170
  },
@@ -13,7 +13,7 @@ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
13
13
  const userSelector_1 = require("../../../../entity/user/userSelector");
14
14
  const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
15
15
  exports.getBillPaySetupApproverView = (0, toolkit_1.createSelector)((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (billPaySetupApproverViewState, approvalRuleState, userState) => {
16
- const { approvalRulesDeleteStatusById, approvalRuleIds, fetchState, error, listeningToPusherEvent, newApprovalRuleId, } = billPaySetupApproverViewState;
16
+ const { approvalRulesDeleteStatusById, approvalRuleIds, approverListState, fetchState, error, listeningToPusherEvent, newApprovalRuleId, } = billPaySetupApproverViewState;
17
17
  const deleteStateList = Object.values(approvalRulesDeleteStatusById);
18
18
  const approvalRules = (0, approvalRuleSelector_1.getApprovalRulesByIds)(approvalRuleState, approvalRuleIds);
19
19
  const allApprovalRules = approvalRules.map((approvalRule) => {
@@ -41,10 +41,15 @@ exports.getBillPaySetupApproverView = (0, toolkit_1.createSelector)((state) => s
41
41
  name: 'Require Info',
42
42
  code: 'require_info',
43
43
  };
44
+ const activeApproverIds = new Set(approverListState.approverIds);
45
+ const referencedApproverIds = new Set(allApprovalRules.flatMap((approvalRule) => approvalRule.steps.flatMap((step) => step.actors.map((actor) => actor.userId))));
46
+ const inactiveApproverIds = Array.from(referencedApproverIds).filter((userId) => !activeApproverIds.has(userId));
44
47
  return {
45
48
  allApprovalRules,
46
49
  deleteStatus: (0, reduceFetchState_1.reduceAnyFetchState)(deleteStateList),
47
50
  approvalRulesStatus,
51
+ approverListFetchStatus: approverListState.fetchStatus,
52
+ inactiveApproverIds,
48
53
  fetchState,
49
54
  error,
50
55
  listeningToPusherEvent,
@@ -63,6 +68,19 @@ exports.getBillPaySetupApproverUpdateDataView = (0, toolkit_1.createSelector)((s
63
68
  };
64
69
  })
65
70
  .filter((approver) => approver.user != null);
71
+ const activeApproverIds = new Set(approverIds);
72
+ const currentRuleSteps = billPaySetupApproverViewUpdateData?.data?.steps ?? [];
73
+ const inactiveActorUserIds = new Set(currentRuleSteps
74
+ .flatMap((step) => step.actors.map((actor) => actor.userId))
75
+ .filter((userId) => userId != null && !activeApproverIds.has(userId)));
76
+ const inactiveActorApprovers = Array.from(inactiveActorUserIds)
77
+ .map((userId) => {
78
+ return {
79
+ user: (0, userSelector_1.getUserByUserId)(userState, userId),
80
+ role: (0, userRoleSelector_1.getUserRoleByUserId)(userRoleState, userId),
81
+ };
82
+ })
83
+ .filter((approver) => approver.user != null);
66
84
  const allAttributes = attributes;
67
85
  const filteredApprovers = (0, cloneDeep_1.default)(allApprovers);
68
86
  const filteredAttributes = (0, cloneDeep_1.default)(attributes);
@@ -96,6 +114,7 @@ exports.getBillPaySetupApproverUpdateDataView = (0, toolkit_1.createSelector)((s
96
114
  allApprovalRules,
97
115
  allApprovers,
98
116
  filteredApprovers,
117
+ inactiveActorApprovers,
99
118
  allAttributes,
100
119
  filteredAttributes,
101
120
  billPaySetupApproverViewUpdateData,
@@ -49,7 +49,9 @@ export interface ApprovalRuleWithUser extends Omit<ApprovalRule, 'steps'> {
49
49
  export interface BillPaySetupApproverView extends SelectorView {
50
50
  allApprovalRules: ApprovalRuleWithUser[];
51
51
  approvalRulesStatus: AllowedValueWithCode;
52
+ approverListFetchStatus: FetchStateAndError;
52
53
  deleteStatus: FetchStateAndError;
54
+ inactiveApproverIds: ID[];
53
55
  listeningToPusherEvent?: boolean;
54
56
  newApprovalRuleId?: ID;
55
57
  }
@@ -61,6 +63,7 @@ export interface BillPaySetupApproverUpdateDataView extends SelectorView {
61
63
  approverListFetchStatus: FetchStateAndError;
62
64
  filteredApprovers: UserAndRole[];
63
65
  filteredAttributes: AttributeType[];
66
+ inactiveActorApprovers: UserAndRole[];
64
67
  affectedEntityIds?: ID[];
65
68
  billPaySetupApproverViewUpdateData?: ApproverViewUpdateData;
66
69
  listeningToPusherEvent?: boolean;
@@ -13,7 +13,7 @@ const userSelector_1 = require("../../../../entity/user/userSelector");
13
13
  const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
14
14
  const getRemiSetupApproverView = (state, filterAdmins = true) => {
15
15
  const { remiSetupApproverViewState, approvalRuleState, userState } = state;
16
- const { approvalRulesDeleteStatusById, approvalRuleIds, fetchState, error, listeningToPusherEvent, newApprovalRuleId, } = remiSetupApproverViewState;
16
+ const { approvalRulesDeleteStatusById, approvalRuleIds, approverListState, fetchState, error, listeningToPusherEvent, newApprovalRuleId, } = remiSetupApproverViewState;
17
17
  const deleteStateList = Object.values(approvalRulesDeleteStatusById);
18
18
  const approvalRules = (0, approvalRuleSelector_1.getApprovalRulesByIds)(approvalRuleState, approvalRuleIds);
19
19
  const allApprovalRules = approvalRules.map((approvalRule) => {
@@ -42,10 +42,15 @@ const getRemiSetupApproverView = (state, filterAdmins = true) => {
42
42
  name: 'Require Info',
43
43
  code: 'require_info',
44
44
  };
45
+ const activeApproverIds = new Set(approverListState.approverIds);
46
+ const referencedApproverIds = new Set(allApprovalRules.flatMap((approvalRule) => approvalRule.steps.flatMap((step) => step.actors.map((actor) => actor.userId))));
47
+ const inactiveApproverIds = Array.from(referencedApproverIds).filter((userId) => !activeApproverIds.has(userId));
45
48
  return {
46
49
  allApprovalRules,
47
50
  deleteStatus: (0, reduceFetchState_1.reduceAnyFetchState)(deleteStateList),
48
51
  approvalRulesStatus,
52
+ approverListFetchStatus: approverListState.fetchStatus,
53
+ inactiveApproverIds,
49
54
  fetchState,
50
55
  error,
51
56
  listeningToPusherEvent,
@@ -81,6 +86,19 @@ exports.getRemiSetupApproverUpdateDataView = (0, toolkit_1.createSelector)((stat
81
86
  };
82
87
  })
83
88
  .filter((approver) => approver.user != null);
89
+ const activeApproverIds = new Set(approverIds);
90
+ const currentRuleSteps = remiSetupApproverViewUpdateData?.data?.steps ?? [];
91
+ const inactiveActorUserIds = new Set(currentRuleSteps
92
+ .flatMap((step) => step.actors.map((actor) => actor.userId))
93
+ .filter((userId) => userId != null && !activeApproverIds.has(userId)));
94
+ const inactiveActorApprovers = Array.from(inactiveActorUserIds)
95
+ .map((userId) => {
96
+ return {
97
+ user: (0, userSelector_1.getUserByUserId)(userState, userId),
98
+ role: (0, userRoleSelector_1.getUserRoleByUserId)(userRoleState, userId),
99
+ };
100
+ })
101
+ .filter((approver) => approver.user != null);
84
102
  const allAttributes = attributes;
85
103
  const filteredApprovers = (0, cloneDeep_1.default)(allApprovers);
86
104
  const filteredAttributes = (0, cloneDeep_1.default)(attributes);
@@ -115,6 +133,7 @@ exports.getRemiSetupApproverUpdateDataView = (0, toolkit_1.createSelector)((stat
115
133
  allAttributes,
116
134
  filteredApprovers,
117
135
  filteredAttributes,
136
+ inactiveActorApprovers,
118
137
  allAccountingClasses,
119
138
  remiSetupApproverViewUpdateData,
120
139
  approversDetailsFetchStatus: (0, reduceFetchState_1.reduceAllFetchState)([
@@ -48,7 +48,9 @@ export interface ApprovalRuleWithUser extends Omit<ApprovalRule, 'steps'> {
48
48
  export interface RemiSetupApproverView extends SelectorView {
49
49
  allApprovalRules: ApprovalRuleWithUser[];
50
50
  approvalRulesStatus: AllowedValueWithCode;
51
+ approverListFetchStatus: FetchStateAndError;
51
52
  deleteStatus: FetchStateAndError;
53
+ inactiveApproverIds: ID[];
52
54
  listeningToPusherEvent?: boolean;
53
55
  newApprovalRuleId?: ID;
54
56
  }
@@ -60,6 +62,7 @@ export interface RemiSetupApproverUpdateDataView extends SelectorView {
60
62
  approversDetailsFetchStatus: FetchStateAndError;
61
63
  filteredApprovers: UserAndRole[];
62
64
  filteredAttributes: AttributeType[];
65
+ inactiveActorApprovers: UserAndRole[];
63
66
  affectedEntityIds?: ID[];
64
67
  listeningToPusherEvent?: boolean;
65
68
  remiSetupApproverViewUpdateData?: ApproverViewUpdateData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.14",
3
+ "version": "5.2.16",
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
  "module": "lib/esm/index.js",