@zeniai/client-epic-state 4.20.7 → 4.20.8

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 (178) hide show
  1. package/lib/commonStateTypes/coaBalance/additionalBalances/getSummationBalance.d.ts +1 -1
  2. package/lib/commonStateTypes/coaBalance/coaBalanceType.d.ts +2 -0
  3. package/lib/commonStateTypes/coaBalance/coaBalanceType.js +6 -0
  4. package/lib/commonStateTypes/currencyHelper.d.ts +3 -0
  5. package/lib/commonStateTypes/currencyHelper.js +6 -1
  6. package/lib/commonStateTypes/reduceFetchState.d.ts +9 -0
  7. package/lib/commonStateTypes/reduceFetchState.js +26 -0
  8. package/lib/entity/account/accountPayload.d.ts +2 -0
  9. package/lib/entity/account/accountPayload.js +2 -0
  10. package/lib/entity/account/accountState.d.ts +2 -0
  11. package/lib/entity/customer/customerState.d.ts +0 -2
  12. package/lib/entity/customer/customerState.js +0 -5
  13. package/lib/entity/depositAccount/depositAccount.d.ts +1 -1
  14. package/lib/entity/depositAccount/depositAccount.js +8 -1
  15. package/lib/entity/reimbursement/reimbursementPayload.d.ts +2 -0
  16. package/lib/entity/reimbursement/reimbursementPayload.js +7 -0
  17. package/lib/entity/reimbursement/reimbursementState.d.ts +2 -0
  18. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  19. package/lib/entity/snackbar/snackbarTypes.js +2 -0
  20. package/lib/entity/task/taskPayload.d.ts +1 -0
  21. package/lib/entity/task/taskPayload.js +1 -0
  22. package/lib/entity/task/taskState.d.ts +1 -0
  23. package/lib/entity/userGroups/userGroupsPayload.d.ts +7 -0
  24. package/lib/entity/userGroups/userGroupsPayload.js +10 -0
  25. package/lib/entity/userGroups/userGroupsReducer.d.ts +8 -0
  26. package/lib/entity/userGroups/userGroupsReducer.js +29 -0
  27. package/lib/entity/userGroups/userGroupsSelector.d.ts +4 -0
  28. package/lib/entity/userGroups/userGroupsSelector.js +12 -0
  29. package/lib/entity/userGroups/userGroupsState.d.ts +9 -0
  30. package/lib/entity/userGroups/userGroupsState.js +2 -0
  31. package/lib/epic.d.ts +15 -1
  32. package/lib/epic.js +15 -1
  33. package/lib/esm/commonStateTypes/coaBalance/coaBalanceType.js +5 -0
  34. package/lib/esm/commonStateTypes/currencyHelper.js +5 -0
  35. package/lib/esm/commonStateTypes/reduceFetchState.js +25 -0
  36. package/lib/esm/entity/account/accountPayload.js +2 -0
  37. package/lib/esm/entity/customer/customerState.js +1 -4
  38. package/lib/esm/entity/depositAccount/depositAccount.js +8 -1
  39. package/lib/esm/entity/reimbursement/reimbursementPayload.js +7 -0
  40. package/lib/esm/entity/snackbar/snackbarTypes.js +2 -0
  41. package/lib/esm/entity/task/taskPayload.js +1 -0
  42. package/lib/esm/entity/userGroups/userGroupsPayload.js +7 -0
  43. package/lib/esm/entity/userGroups/userGroupsReducer.js +25 -0
  44. package/lib/esm/entity/userGroups/userGroupsSelector.js +8 -0
  45. package/lib/esm/entity/userGroups/userGroupsState.js +1 -0
  46. package/lib/esm/epic.js +15 -1
  47. package/lib/esm/index.js +19 -10
  48. package/lib/esm/reducer.js +6 -0
  49. package/lib/esm/view/arAgingView/arAgingReport/arAgingReducer.js +1 -1
  50. package/lib/esm/view/arAgingView/arAgingReport/arAgingSelector.js +1 -1
  51. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.js +33 -0
  52. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +29 -0
  53. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +49 -0
  54. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +40 -0
  55. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +49 -0
  56. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +61 -0
  57. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +33 -0
  58. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +56 -0
  59. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.js +12 -0
  60. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +98 -0
  61. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +71 -0
  62. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
  63. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +86 -0
  64. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +24 -0
  65. package/lib/esm/view/expenseAutomationView/helpers/bulkUploadTiming.js +16 -0
  66. package/lib/esm/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.js +13 -0
  67. package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +198 -1
  68. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +456 -2
  69. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +23 -1
  70. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +245 -1
  71. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
  72. package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +44 -0
  73. package/lib/esm/view/expenseAutomationView/types/transactionsViewState.js +2 -1
  74. package/lib/esm/view/financeStatement/financeStatementReducer.js +11 -8
  75. package/lib/esm/view/financeStatement/financeStatementSelector.js +24 -9
  76. package/lib/esm/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +17 -0
  77. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +331 -0
  78. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +9 -0
  79. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +6 -1
  80. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
  81. package/lib/esm/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
  82. package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +262 -0
  83. package/lib/esm/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +9 -7
  84. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
  85. package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
  86. package/lib/esm/view/taskManager/taskListView/taskListSelector.js +3 -1
  87. package/lib/esm/view/userGroupListView/userGroupListViewReducer.js +65 -0
  88. package/lib/esm/view/userGroupListView/userGroupListViewSelector.js +16 -0
  89. package/lib/esm/view/userGroupListView/userGroupListViewState.js +1 -0
  90. package/lib/esm/view/userListView/fetchUserListByTypeEpic.js +11 -0
  91. package/lib/esm/zeniAPI.js +0 -2
  92. package/lib/index.d.ts +20 -12
  93. package/lib/index.js +97 -34
  94. package/lib/reducer.d.ts +6 -0
  95. package/lib/reducer.js +6 -0
  96. package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
  97. package/lib/view/arAgingView/arAgingReport/arAgingReducer.js +2 -2
  98. package/lib/view/arAgingView/arAgingReport/arAgingSelector.js +5 -5
  99. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.d.ts +13 -0
  100. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.js +37 -0
  101. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +18 -0
  102. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +33 -0
  103. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +7 -0
  104. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +53 -0
  105. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.d.ts +8 -0
  106. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +44 -0
  107. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +7 -0
  108. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +53 -0
  109. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.d.ts +8 -0
  110. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +65 -0
  111. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +8 -0
  112. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +37 -0
  113. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +9 -0
  114. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +61 -0
  115. package/lib/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.d.ts +10 -0
  116. package/lib/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.js +16 -0
  117. package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.d.ts +18 -0
  118. package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +102 -0
  119. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +14 -0
  120. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +75 -0
  121. package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
  122. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +25 -0
  123. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +92 -0
  124. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.d.ts +7 -0
  125. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +28 -0
  126. package/lib/view/expenseAutomationView/helpers/bulkUploadTiming.d.ts +16 -0
  127. package/lib/view/expenseAutomationView/helpers/bulkUploadTiming.js +19 -0
  128. package/lib/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.d.ts +7 -0
  129. package/lib/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.js +16 -0
  130. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  131. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +123 -0
  132. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +211 -0
  133. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +86 -3
  134. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +457 -2
  135. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +11 -3
  136. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +24 -2
  137. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +70 -1
  138. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +1 -0
  139. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.d.ts +1 -1
  140. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +244 -0
  141. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
  142. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +146 -0
  143. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +54 -1
  144. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -1
  145. package/lib/view/expenseAutomationView/types/transactionsViewState.js +2 -1
  146. package/lib/view/financeStatement/financeStatementReducer.js +11 -8
  147. package/lib/view/financeStatement/financeStatementSelector.d.ts +2 -0
  148. package/lib/view/financeStatement/financeStatementSelector.js +24 -9
  149. package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.d.ts +9 -0
  150. package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +20 -0
  151. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +15 -0
  152. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +335 -0
  153. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts +111 -0
  154. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +13 -0
  155. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.d.ts +4 -2
  156. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +7 -2
  157. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
  158. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewState.d.ts +4 -0
  159. package/lib/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
  160. package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.d.ts +6 -0
  161. package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +265 -0
  162. package/lib/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +8 -6
  163. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
  164. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +1 -0
  165. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
  166. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +2 -0
  167. package/lib/view/taskManager/taskListView/taskListSelector.js +3 -1
  168. package/lib/view/userGroupListView/userGroupListViewReducer.d.ts +23 -0
  169. package/lib/view/userGroupListView/userGroupListViewReducer.js +69 -0
  170. package/lib/view/userGroupListView/userGroupListViewSelector.d.ts +7 -0
  171. package/lib/view/userGroupListView/userGroupListViewSelector.js +20 -0
  172. package/lib/view/userGroupListView/userGroupListViewState.d.ts +8 -0
  173. package/lib/view/userGroupListView/userGroupListViewState.js +2 -0
  174. package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +3 -1
  175. package/lib/view/userListView/fetchUserListByTypeEpic.js +11 -0
  176. package/lib/view/userListView/userListViewPayload.d.ts +2 -0
  177. package/lib/zeniAPI.js +0 -2
  178. package/package.json +3 -3
@@ -4,6 +4,7 @@ exports.getProfitAndLossClassesView = exports.profitAndLossIdsInOrder = void 0;
4
4
  const getDifferenceOfBalancesGroupedByPeriod_1 = require("../../commonStateTypes/coaBalance/classBalances/getDifferenceOfBalancesGroupedByPeriod");
5
5
  const getSumOfBalancesGroupedByPeriod_1 = require("../../commonStateTypes/coaBalance/classBalances/getSumOfBalancesGroupedByPeriod");
6
6
  const coaBalance_1 = require("../../commonStateTypes/coaBalance/coaBalance");
7
+ const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
7
8
  const sectionClassesViewSelector_1 = require("../../entity/sectionClassesViewV2/sectionClassesViewSelector");
8
9
  const profitAndLossClassesViewSelectorTypes_1 = require("./profitAndLossClassesViewSelectorTypes");
9
10
  exports.profitAndLossIdsInOrder = [
@@ -18,7 +19,7 @@ exports.profitAndLossIdsInOrder = [
18
19
  'netIncome',
19
20
  ];
20
21
  const getProfitAndLossClassesView = (filter, accountState, classState, sectionsState, profitAndLossClassesViewState) => {
21
- const fetchState = reduceFetchState([
22
+ const fetchState = (0, reduceFetchState_1.reduceFetchStateParallelTimeframes)([
22
23
  profitAndLossClassesViewState.fetchState.month,
23
24
  profitAndLossClassesViewState.fetchState.quarter,
24
25
  profitAndLossClassesViewState.fetchState.year,
@@ -68,31 +69,3 @@ const getProfitAndLossClassesView = (filter, accountState, classState, sectionsS
68
69
  };
69
70
  };
70
71
  exports.getProfitAndLossClassesView = getProfitAndLossClassesView;
71
- function reduceFetchState(fetchStateList) {
72
- const isAnyProgress = fetchStateList.reduce((prevValue, currentValue) => {
73
- return prevValue === true || currentValue.fetchState === 'In-Progress';
74
- }, false);
75
- const isAllCompleted = fetchStateList.reduce((prevValue, currentValue) => {
76
- return prevValue === true && currentValue.fetchState === 'Completed';
77
- }, true);
78
- const isAnyError = fetchStateList.reduce((prevValue, currentValue) => {
79
- return prevValue === true || currentValue.fetchState === 'Error';
80
- }, false);
81
- const error = fetchStateList.reduce((prevValue, currentValue) => {
82
- return prevValue ?? currentValue.error;
83
- }, undefined);
84
- let fetchState = 'Not-Started';
85
- if (isAnyProgress) {
86
- fetchState = 'In-Progress';
87
- }
88
- else if (isAllCompleted) {
89
- fetchState = 'Completed';
90
- }
91
- else if (isAnyError) {
92
- fetchState = 'Error';
93
- }
94
- return {
95
- fetchState,
96
- error,
97
- };
98
- }
@@ -1,9 +1,12 @@
1
+ import { Currency } from '../../commonStateTypes/amount';
1
2
  import { NestedClassHierarchyForReport, NestedClassID } from '../../commonStateTypes/classesView/nestedClassID';
2
3
  import { AccountViewMode, FetchStateAndError, ID } from '../../commonStateTypes/common';
3
4
  import { Report } from '../../commonStateTypes/viewAndReport/viewAndReport';
5
+ export type ClassViewLayout = 'vertical' | 'horizontal';
4
6
  export interface ProfitAndLossClassesViewUIState {
5
7
  accountViewMode: AccountViewMode;
6
8
  classesToFilterOut: NestedClassID[];
9
+ classViewLayout: ClassViewLayout;
7
10
  nodeCollapseState: Record<ID, boolean>;
8
11
  scrollPosition: {
9
12
  scrollTop: number;
@@ -18,4 +21,5 @@ export interface ProfitAndLossClassesViewState extends Report {
18
21
  year: FetchStateAndError;
19
22
  };
20
23
  uiState: ProfitAndLossClassesViewUIState;
24
+ currency?: Currency;
21
25
  }
@@ -27,11 +27,13 @@ const fetchProfitAndLossForTimeframeClassesViewEpic = (actions$, _, zeniAPI) =>
27
27
  .pipe((0, operators_1.mergeMap)((response) => {
28
28
  if (response.data != null && (0, responsePayload_1.isSuccessResponse)(response)) {
29
29
  const actions = [];
30
- actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'cogs', 'profit_and_loss_by_classes', response.data.report.cogs, response.data.report.classes, response.data.report.accounts, response.data.report.currency));
31
- actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'expenses', 'profit_and_loss_by_classes', response.data.report.expenses, response.data.report.classes, response.data.report.accounts, response.data.report.currency));
32
- actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'income', 'profit_and_loss_by_classes', response.data.report.income, response.data.report.classes, response.data.report.accounts, response.data.report.currency));
33
- actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'otherExpenses', 'profit_and_loss_by_classes', response.data.report.other_expenses, response.data.report.classes, response.data.report.accounts, response.data.report.currency));
34
- actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'otherIncome', 'profit_and_loss_by_classes', response.data.report.other_income, response.data.report.classes, response.data.report.accounts, response.data.report.currency));
30
+ const report = response.data.report;
31
+ const currency = report.currency;
32
+ actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'cogs', 'profit_and_loss_by_classes', report.cogs, report.classes, report.accounts, currency));
33
+ actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'expenses', 'profit_and_loss_by_classes', report.expenses, report.classes, report.accounts, currency));
34
+ actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'income', 'profit_and_loss_by_classes', report.income, report.classes, report.accounts, currency));
35
+ actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'otherExpenses', 'profit_and_loss_by_classes', report.other_expenses, report.classes, report.accounts, currency));
36
+ actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'otherIncome', 'profit_and_loss_by_classes', report.other_income, report.classes, report.accounts, currency));
35
37
  actions.push((0, profitAndLossClassesViewReducer_1.updateProfitAndLossForTimeframeClassesView)({
36
38
  timeframe: action.payload.timeframe,
37
39
  report: response.data,
@@ -0,0 +1,6 @@
1
+ import { ProfitAndLossByClassHorizontalReport } from './profitAndLossClassesByClassHorizontalSelectorTypes';
2
+ /**
3
+ * Populates `sectionHeaderBalancesSlice`, and per-account `accountReportData`, so the
4
+ * web layer only maps selector output to tree nodes.
5
+ */
6
+ export declare function enrichProfitAndLossByClassHorizontalReport(report: ProfitAndLossByClassHorizontalReport): void;
@@ -0,0 +1,265 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enrichProfitAndLossByClassHorizontalReport = enrichProfitAndLossByClassHorizontalReport;
4
+ const currencyHelper_1 = require("../../commonStateTypes/currencyHelper");
5
+ const horizontalSectionEmptyBalancesSlice_1 = require("./horizontalSectionEmptyBalancesSlice");
6
+ const profitAndLossClassesByClassHorizontalSelectorTypes_1 = require("./profitAndLossClassesByClassHorizontalSelectorTypes");
7
+ /**
8
+ * Populates `sectionHeaderBalancesSlice`, and per-account `accountReportData`, so the
9
+ * web layer only maps selector output to tree nodes.
10
+ */
11
+ function enrichProfitAndLossByClassHorizontalReport(report) {
12
+ if (report.fetchState !== 'Completed' || report.selectedPeriod == null) {
13
+ return;
14
+ }
15
+ for (const section of Object.values(report.sections)) {
16
+ if (section != null) {
17
+ enrichHorizontalSection(report, section);
18
+ }
19
+ }
20
+ for (const calc of Object.values(report.calculatedSections)) {
21
+ if (calc != null) {
22
+ enrichHorizontalCalculatedSection(report, calc);
23
+ }
24
+ }
25
+ }
26
+ function enrichHorizontalSection(report, section) {
27
+ const classAmounts = report.classColumns.map((col) => {
28
+ const total = section.classTotals.find((ct) => ct.classId === col.classId);
29
+ return total?.balance.amount ?? 0;
30
+ });
31
+ section.sectionHeaderBalancesSlice = buildHorizontalClassColumnBalancesSlice(report, classAmounts, section.sectionTotal.amount);
32
+ const parentIndices = computeHorizontalAccountParentIndices(section.accounts);
33
+ const childrenRowIndicesByParent = buildHorizontalAccountChildIndicesByParent(parentIndices);
34
+ const childrenRecord = {};
35
+ childrenRowIndicesByParent.forEach((childIndices, parentIndex) => {
36
+ childrenRecord[parentIndex] = childIndices;
37
+ });
38
+ section.treeLayout = {
39
+ rootAccountRowIndices: section.accounts
40
+ .map((_, i) => (parentIndices[i] === -1 ? i : -1))
41
+ .filter((i) => i >= 0),
42
+ childrenRowIndicesByParent: childrenRecord,
43
+ };
44
+ const siblingsPerRow = buildSiblingIndicesPerRow(section.accounts, parentIndices);
45
+ const hasChildFlags = computeHorizontalHasChildFlags(parentIndices);
46
+ for (let accountIndex = 0; accountIndex < section.accounts.length; accountIndex++) {
47
+ const row = section.accounts[accountIndex];
48
+ // Same column order as `report.classColumns` (see `pivotSectionToHorizontal`).
49
+ const classRowAmounts = row.classBalances.map((classBalance) => classBalance.balance.amount);
50
+ row.accountReportData = {
51
+ accountId: row.accountId,
52
+ accountName: row.accountName,
53
+ accountType: row.accountType,
54
+ depth: row.depth,
55
+ balancesInTimeframe: buildHorizontalClassColumnBalancesSlice(report, classRowAmounts, row.rowTotal.amount),
56
+ horizontalTreeView: buildHorizontalTreeViewFromPrecomputed(section.accounts, accountIndex, parentIndices, siblingsPerRow, hasChildFlags),
57
+ };
58
+ }
59
+ }
60
+ function enrichHorizontalCalculatedSection(report, calcSection) {
61
+ const classAmounts = report.classColumns.map((col) => {
62
+ const total = calcSection.classTotals.find((ct) => ct.classId === col.classId);
63
+ return total?.balance.amount ?? 0;
64
+ });
65
+ calcSection.sectionHeaderBalancesSlice =
66
+ buildHorizontalClassColumnBalancesSlice(report, classAmounts, calcSection.sectionTotal.amount);
67
+ }
68
+ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmount) {
69
+ const fallback = currencyHelper_1.defaultCustomerCurrency;
70
+ const firstHeader = report.headerBalances[0];
71
+ const currencyCode = firstHeader?.balance.currencyCode ?? fallback.currencyCode;
72
+ const currencySymbol = firstHeader?.balance.currencySymbol ?? fallback.currencySymbol;
73
+ const timeframe = firstHeader?.balanceTimeFrame ?? 'month';
74
+ if (report.selectedPeriod == null) {
75
+ return (0, horizontalSectionEmptyBalancesSlice_1.getEmptyHorizontalSectionBalancesSlice)(report.firstMonthOfFY, timeframe);
76
+ }
77
+ const { startDate, endDate } = report.selectedPeriod;
78
+ const balances = report.classColumns.map((col, columnIndex) => {
79
+ const amount = classAmounts[columnIndex] ?? 0;
80
+ return {
81
+ balance: {
82
+ amount,
83
+ currencyCode,
84
+ currencySymbol,
85
+ },
86
+ balanceTimeFrame: timeframe,
87
+ startDate,
88
+ endDate,
89
+ type: amount === 0 ? 'default_with_null_balance' : 'default',
90
+ id: col.classId,
91
+ label: col.className,
92
+ };
93
+ });
94
+ balances.push({
95
+ balance: {
96
+ amount: totalAmount,
97
+ currencyCode,
98
+ currencySymbol,
99
+ },
100
+ balanceTimeFrame: timeframe,
101
+ startDate,
102
+ endDate,
103
+ type: totalAmount === 0 ? 'default_with_null_balance' : 'default',
104
+ id: profitAndLossClassesByClassHorizontalSelectorTypes_1.HORIZONTAL_CLASS_TOTAL_BALANCE_ID,
105
+ label: 'Total',
106
+ });
107
+ return {
108
+ balances,
109
+ additionalBalances: [],
110
+ filter: {
111
+ firstMonthOfFY: report.firstMonthOfFY,
112
+ timeframe,
113
+ balancesRange: {
114
+ numberOfPeriods: balances.length,
115
+ orderBy: 'ascending_date',
116
+ },
117
+ additionalBalances: [],
118
+ },
119
+ };
120
+ }
121
+ /**
122
+ * Parent index per DFS row — O(n). Matches the scan in the former
123
+ * `findHorizontalAccountParentIndex` (depth &lt;= 2 rows have no parent).
124
+ */
125
+ function computeHorizontalAccountParentIndices(rows) {
126
+ const accountRowCount = rows.length;
127
+ const parentIndex = new Array(accountRowCount).fill(-1);
128
+ const stack = [];
129
+ for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
130
+ const accountRow = rows[rowIndex];
131
+ if (accountRow == null) {
132
+ continue;
133
+ }
134
+ const depth = accountRow.depth;
135
+ while (stack.length > 0) {
136
+ const topRow = rows[stack[stack.length - 1]];
137
+ if (topRow == null) {
138
+ stack.pop();
139
+ continue;
140
+ }
141
+ if (topRow.depth < depth) {
142
+ break;
143
+ }
144
+ stack.pop();
145
+ }
146
+ if (depth > 2 && stack.length > 0) {
147
+ const peek = stack[stack.length - 1];
148
+ const parentRow = rows[peek];
149
+ if (parentRow != null && parentRow.depth === depth - 1) {
150
+ parentIndex[rowIndex] = peek;
151
+ }
152
+ }
153
+ stack.push(rowIndex);
154
+ }
155
+ return parentIndex;
156
+ }
157
+ /** Sibling row indices (same parent + depth), in traversal order — O(n). */
158
+ function buildSiblingIndicesPerRow(rows, parentIndices) {
159
+ const accountRowCount = rows.length;
160
+ const keyToIndices = new Map();
161
+ for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
162
+ const parentRowIndex = parentIndices[rowIndex];
163
+ const accountRow = rows[rowIndex];
164
+ if (parentRowIndex == null || accountRow == null) {
165
+ continue;
166
+ }
167
+ const key = `${parentRowIndex}:${accountRow.depth}`;
168
+ let siblingGroup = keyToIndices.get(key);
169
+ if (siblingGroup == null) {
170
+ siblingGroup = [];
171
+ keyToIndices.set(key, siblingGroup);
172
+ }
173
+ siblingGroup.push(rowIndex);
174
+ }
175
+ const siblingsPerRow = new Array(accountRowCount);
176
+ for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
177
+ const parentRowIndex = parentIndices[rowIndex];
178
+ const accountRow = rows[rowIndex];
179
+ if (parentRowIndex == null || accountRow == null) {
180
+ siblingsPerRow[rowIndex] = [rowIndex];
181
+ continue;
182
+ }
183
+ const key = `${parentRowIndex}:${accountRow.depth}`;
184
+ const group = keyToIndices.get(key);
185
+ siblingsPerRow[rowIndex] = group != null ? group : [rowIndex];
186
+ }
187
+ return siblingsPerRow;
188
+ }
189
+ function computeHorizontalHasChildFlags(parentIndices) {
190
+ const rowCount = parentIndices.length;
191
+ const flags = new Array(rowCount).fill(false);
192
+ for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
193
+ const parentRowIndex = parentIndices[rowIndex];
194
+ if (parentRowIndex != null &&
195
+ parentRowIndex >= 0 &&
196
+ parentRowIndex < rowCount) {
197
+ flags[parentRowIndex] = true;
198
+ }
199
+ }
200
+ return flags;
201
+ }
202
+ function buildHorizontalSubAccountAncestorMetadataFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags) {
203
+ const chain = [];
204
+ let walkRowIndex = currentRowIndex;
205
+ while (walkRowIndex >= 0) {
206
+ chain.unshift(walkRowIndex);
207
+ const parentRowIndex = parentIndices[walkRowIndex];
208
+ if (parentRowIndex == null) {
209
+ break;
210
+ }
211
+ walkRowIndex = parentRowIndex;
212
+ }
213
+ return chain.map((rowIndex) => {
214
+ const accountRow = dfsOrderedAccountRows[rowIndex];
215
+ const siblingIndices = siblingsPerRow[rowIndex];
216
+ const hasChild = hasChildFlags[rowIndex];
217
+ if (accountRow == null || siblingIndices == null) {
218
+ return {
219
+ depth: 0,
220
+ hasSibling: false,
221
+ hasChildren: hasChild === true,
222
+ isLastNode: true,
223
+ name: '',
224
+ };
225
+ }
226
+ return {
227
+ depth: accountRow.depth - 2,
228
+ hasSibling: siblingIndices.length > 1,
229
+ hasChildren: hasChild === true,
230
+ isLastNode: rowIndex === siblingIndices[siblingIndices.length - 1],
231
+ name: accountRow.accountName,
232
+ };
233
+ });
234
+ }
235
+ function buildHorizontalTreeViewFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags) {
236
+ const siblingIndices = siblingsPerRow[currentRowIndex];
237
+ const accountRow = dfsOrderedAccountRows[currentRowIndex];
238
+ const hasChildrenFlag = hasChildFlags[currentRowIndex];
239
+ const treeDepth = accountRow != null ? Math.max(0, accountRow.depth - 2) : 0;
240
+ const hasChildren = hasChildrenFlag === true;
241
+ const siblings = siblingIndices ?? [currentRowIndex];
242
+ return {
243
+ subAccountAncestorMetadata: buildHorizontalSubAccountAncestorMetadataFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags),
244
+ treeDepth,
245
+ hasChildren,
246
+ hasSiblings: siblings.length > 1,
247
+ isLeaf: !hasChildren,
248
+ isLastNode: currentRowIndex === siblings[siblings.length - 1],
249
+ };
250
+ }
251
+ function buildHorizontalAccountChildIndicesByParent(parentIndices) {
252
+ const childIndicesByParentRowIndex = new Map();
253
+ for (let rowIndex = 0; rowIndex < parentIndices.length; rowIndex++) {
254
+ const parentRowIndex = parentIndices[rowIndex];
255
+ if (parentRowIndex != null && parentRowIndex >= 0) {
256
+ let childRowIndices = childIndicesByParentRowIndex.get(parentRowIndex);
257
+ if (childRowIndices == null) {
258
+ childRowIndices = [];
259
+ childIndicesByParentRowIndex.set(parentRowIndex, childRowIndices);
260
+ }
261
+ childRowIndices.push(rowIndex);
262
+ }
263
+ }
264
+ return childIndicesByParentRowIndex;
265
+ }
@@ -11,9 +11,13 @@ const opExReducer_1 = require("../opEx/opExReducer");
11
11
  const revenueReducer_1 = require("../revenue/revenueReducer");
12
12
  const reportUIOptionsReducer_1 = require("./reportUIOptionsReducer");
13
13
  const updateReportUIOptionCOABalancesRangeEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(reportUIOptionsReducer_1.updateReportUIOptionCOABalancesRange.match), (0, operators_1.switchMap)((action) => {
14
- const thisPeriod = action.payload.selectedCOABalancesRange.thisPeriod;
15
- const orderBy = action.payload.selectedCOABalancesRange.orderBy;
16
- const highlightedNoOfPeriods = state$.value.reportUIOptionsState.isCompareModeOn === true ? 4 : 1;
14
+ const selectedRange = action.payload.selectedCOABalancesRange;
15
+ const thisPeriod = selectedRange.thisPeriod;
16
+ const orderBy = selectedRange.orderBy;
17
+ const numberOfPeriodsFromSelection = selectedRange.numberOfPeriods;
18
+ const highlightedNoOfPeriods = state$.value.reportUIOptionsState.isCompareModeOn === true
19
+ ? numberOfPeriodsFromSelection
20
+ : 1;
17
21
  const highlightedCOABalancesRange = action.payload.highlightedCOABalancesRange == null && thisPeriod != null
18
22
  ? {
19
23
  numberOfPeriods: highlightedNoOfPeriods,
@@ -65,9 +69,7 @@ const updateReportUIOptionCOABalancesRangeEpic = (actions$, state$) => actions$.
65
69
  thisPeriod: action.payload.highlightedCOABalancesRange != null
66
70
  ? action.payload.highlightedCOABalancesRange.thisPeriod
67
71
  : thisPeriod,
68
- numberOfPeriods: state$.value.reportUIOptionsState.isCompareModeOn === true
69
- ? 4
70
- : financeStatementReducer_1.initialFinanceStatementState.maxNumOfPeriodsToHighlight,
72
+ numberOfPeriods: numberOfPeriodsFromSelection,
71
73
  orderBy,
72
74
  }));
73
75
  }));
@@ -116,7 +116,7 @@ exports.allTaskPriority = [
116
116
  },
117
117
  {
118
118
  code: 'medium',
119
- name: 'Normal',
119
+ name: 'Medium',
120
120
  },
121
121
  {
122
122
  code: 'low',
@@ -16,6 +16,7 @@ interface UpdateTaskPayload {
16
16
  description: string;
17
17
  due_date: string | null;
18
18
  file_ids: ID[];
19
+ group_assignees: string[];
19
20
  name: string;
20
21
  priority: string;
21
22
  recurring_end_date: string | null;
@@ -79,6 +79,7 @@ const toTaskPayload = (state, task) => {
79
79
  name: task.name,
80
80
  assignees: task.assignees,
81
81
  description: task.description,
82
+ group_assignees: task.groupAssignees,
82
83
  due_date: task.dueDate != null ? task.dueDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT) : null,
83
84
  priority: task.priority.code,
84
85
  status: task.status.code,
@@ -8,6 +8,7 @@ import { UserState } from '../../../entity/user/userState';
8
8
  import { UserRoleState } from '../../../entity/userRole/userRoleState';
9
9
  import { RootState } from '../../../reducer';
10
10
  import { UserAndRole } from '../../companyView/types/userAndRole';
11
+ import { UserGroupListSelectorView } from '../../userGroupListView/userGroupListViewSelector';
11
12
  import { UserListSelectorView } from '../../userListView/userListViewSelector';
12
13
  import { TaskListFilters, TaskListLocalData, TaskListState, TaskListUIState } from './taskList';
13
14
  export interface TaskWithUserDetails extends Task {
@@ -30,6 +31,7 @@ export interface TaskListSelectorView extends SelectorView {
30
31
  taskGroupUpdateStatus: FetchStateAndError;
31
32
  uiState: TaskListUIState;
32
33
  updateTasksFetchState: FetchStateAndError;
34
+ userGroupList: UserGroupListSelectorView;
33
35
  userList: UserListSelectorView;
34
36
  }
35
37
  export declare const getTaskListGroupedByAssignees: ({ taskListState, taskState, userState, userRoleState, addressState, tagState, }: {
@@ -17,6 +17,7 @@ const taskGroupTemplateSelector_1 = require("../../../entity/taskGroupTemplate/t
17
17
  const userSelector_1 = require("../../../entity/user/userSelector");
18
18
  const userAndRole_1 = require("../../companyView/types/userAndRole");
19
19
  const spendManagementFilterHelpers_1 = require("../../spendManagement/spendManagementFilterHelpers");
20
+ const userGroupListViewSelector_1 = require("../../userGroupListView/userGroupListViewSelector");
20
21
  const userListViewSelector_1 = require("../../userListView/userListViewSelector");
21
22
  const taskDetailSelector_1 = require("../taskDetailView/taskDetailSelector");
22
23
  const taskList_1 = require("./taskList");
@@ -316,7 +317,7 @@ const getTaskGroupsWithTaskList = ({ taskListState, taskState, userState, userRo
316
317
  tagState,
317
318
  });
318
319
  };
319
- exports.getAllTasks = (0, toolkit_1.createSelector)((state) => state.taskListState, (state) => state.taskState, (state) => state.userState, (state) => state.userRoleState, (state) => state.userListViewState, (state) => state.addressState, (state) => state.taskGroupState, (state) => state.taskGroupViewState, (state) => state.tagViewState, (state) => state.tagState, (state) => state.taskGroupTemplateState, (state) => state.taskGroupTemplateViewState, (_state, isTaskTemplatesEnabled) => isTaskTemplatesEnabled, (taskListState, taskState, userState, userRoleState, userListViewState, addressState, taskGroupState, taskGroupViewState, tagViewState, tagState, taskGroupTemplateState, taskGroupTemplateViewState, isTaskTemplatesEnabled) => {
320
+ exports.getAllTasks = (0, toolkit_1.createSelector)((state) => state.taskListState, (state) => state.taskState, (state) => state.userState, (state) => state.userRoleState, (state) => state.userListViewState, (state) => state.addressState, (state) => state.taskGroupState, (state) => state.taskGroupViewState, (state) => state.tagViewState, (state) => state.tagState, (state) => state.taskGroupTemplateState, (state) => state.taskGroupTemplateViewState, (state) => state.userGroupsState, (state) => state.userGroupListViewState, (_state, isTaskTemplatesEnabled) => isTaskTemplatesEnabled, (taskListState, taskState, userState, userRoleState, userListViewState, addressState, taskGroupState, taskGroupViewState, tagViewState, tagState, taskGroupTemplateState, taskGroupTemplateViewState, userGroupsState, userGroupListViewState, isTaskTemplatesEnabled) => {
320
321
  const { localData } = taskListState;
321
322
  const taskGroupsWithTasksList = getTaskGroupsWithTaskList({
322
323
  taskListState,
@@ -344,6 +345,7 @@ exports.getAllTasks = (0, toolkit_1.createSelector)((state) => state.taskListSta
344
345
  taskGroupTemplates,
345
346
  fetchState: fetchState,
346
347
  userList: (0, userListViewSelector_1.getUserList)(userState, userRoleState, userListViewState, 'taskManagerCandidate'),
348
+ userGroupList: (0, userGroupListViewSelector_1.getUserGroupList)(userGroupsState, userGroupListViewState, 'taskManagerCandidate'),
347
349
  error: error,
348
350
  version: 0,
349
351
  taskGroupsWithTasksList,
@@ -0,0 +1,23 @@
1
+ import { ID } from '../../commonStateTypes/common';
2
+ import { UserGroupPayload } from '../../entity/userGroups/userGroupsPayload';
3
+ import { ZeniAPIStatus } from '../../responsePayload';
4
+ import { UserGroupListType, UserGroupListViewState } from './userGroupListViewState';
5
+ export declare const initialState: UserGroupListViewState;
6
+ export declare const fetchUserGroupListByType: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userGroupType: "taskManagerCandidate", cacheOverride?: any], {
7
+ userGroupType: "taskManagerCandidate";
8
+ cacheOverride: any;
9
+ }, "userGroupListView/fetchUserGroupListByType", never, never>, updateUserGroupIds: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
10
+ userGroupsPayload: UserGroupPayload[];
11
+ userGroupType: UserGroupListType;
12
+ }, "userGroupListView/updateUserGroupIds">, addUserGroupId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
13
+ id: ID;
14
+ userGroupType: UserGroupListType;
15
+ }, "userGroupListView/addUserGroupId">, removeUserGroupId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
16
+ id: ID;
17
+ userGroupType: UserGroupListType;
18
+ }, "userGroupListView/removeUserGroupId">, updateUserGroupListFetchFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
19
+ status: ZeniAPIStatus;
20
+ userGroupType: UserGroupListType;
21
+ }, "userGroupListView/updateUserGroupListFetchFailure">, clearUserGroupListView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"userGroupListView/clearUserGroupListView">;
22
+ declare const _default: import("redux").Reducer<UserGroupListViewState>;
23
+ export default _default;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.clearUserGroupListView = exports.updateUserGroupListFetchFailure = exports.removeUserGroupId = exports.addUserGroupId = exports.updateUserGroupIds = exports.fetchUserGroupListByType = exports.initialState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const initialUserGroupList = {
7
+ ids: [],
8
+ fetchState: 'Not-Started',
9
+ error: undefined,
10
+ hasValidState() {
11
+ return this.fetchState == 'Completed';
12
+ },
13
+ };
14
+ exports.initialState = {
15
+ userGroupListByType: {
16
+ taskManagerCandidate: initialUserGroupList,
17
+ },
18
+ };
19
+ const userGroupListView = (0, toolkit_1.createSlice)({
20
+ name: 'userGroupListView',
21
+ initialState: exports.initialState,
22
+ reducers: {
23
+ fetchUserGroupListByType: {
24
+ reducer(draft, action) {
25
+ const { userGroupType } = action.payload;
26
+ draft.userGroupListByType[userGroupType].fetchState = 'In-Progress';
27
+ draft.userGroupListByType[userGroupType].error = undefined;
28
+ },
29
+ prepare(userGroupType, cacheOverride = false) {
30
+ return {
31
+ payload: {
32
+ userGroupType,
33
+ cacheOverride,
34
+ },
35
+ };
36
+ },
37
+ },
38
+ updateUserGroupIds(draft, action) {
39
+ const { userGroupType, userGroupsPayload } = action.payload;
40
+ draft.userGroupListByType[userGroupType].fetchState = 'Completed';
41
+ draft.userGroupListByType[userGroupType].error = undefined;
42
+ draft.userGroupListByType[userGroupType].ids = userGroupsPayload.map((userGroup) => userGroup.id);
43
+ },
44
+ addUserGroupId(draft, action) {
45
+ const { userGroupType, id } = action.payload;
46
+ const index = draft.userGroupListByType[userGroupType].ids.indexOf(id);
47
+ if (index < 0) {
48
+ draft.userGroupListByType[userGroupType].ids.push(id);
49
+ }
50
+ },
51
+ removeUserGroupId(draft, action) {
52
+ const { userGroupType, id } = action.payload;
53
+ const index = draft.userGroupListByType[userGroupType].ids.indexOf(id);
54
+ if (index > -1) {
55
+ draft.userGroupListByType[userGroupType].ids.splice(index, 1);
56
+ }
57
+ },
58
+ updateUserGroupListFetchFailure(draft, action) {
59
+ const { userGroupType, status } = action.payload;
60
+ draft.userGroupListByType[userGroupType].fetchState = 'Error';
61
+ draft.userGroupListByType[userGroupType].error = status;
62
+ },
63
+ clearUserGroupListView(draft) {
64
+ Object.assign(draft, exports.initialState);
65
+ },
66
+ },
67
+ });
68
+ _a = userGroupListView.actions, exports.fetchUserGroupListByType = _a.fetchUserGroupListByType, exports.updateUserGroupIds = _a.updateUserGroupIds, exports.addUserGroupId = _a.addUserGroupId, exports.removeUserGroupId = _a.removeUserGroupId, exports.updateUserGroupListFetchFailure = _a.updateUserGroupListFetchFailure, exports.clearUserGroupListView = _a.clearUserGroupListView;
69
+ exports.default = userGroupListView.reducer;
@@ -0,0 +1,7 @@
1
+ import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
2
+ import { UserGroup, UserGroupsState } from '../../entity/userGroups/userGroupsState';
3
+ import { UserGroupListType, UserGroupListViewState } from './userGroupListViewState';
4
+ export interface UserGroupListSelectorView extends SelectorView {
5
+ userGroups: UserGroup[];
6
+ }
7
+ export declare const getUserGroupList: (userGroupsState: UserGroupsState, userGroupListViewState: UserGroupListViewState, userGroupType: UserGroupListType) => UserGroupListSelectorView;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUserGroupList = void 0;
4
+ const userGroupsSelector_1 = require("../../entity/userGroups/userGroupsSelector");
5
+ const getUserGroupList = (userGroupsState, userGroupListViewState, userGroupType) => {
6
+ const listState = userGroupListViewState.userGroupListByType[userGroupType];
7
+ return {
8
+ userGroups: getUserGroupListByIds(userGroupsState, userGroupListViewState, userGroupType),
9
+ fetchState: listState?.fetchState,
10
+ error: listState?.error,
11
+ version: 0,
12
+ };
13
+ };
14
+ exports.getUserGroupList = getUserGroupList;
15
+ function getUserGroupListByIds(userGroupsState, userGroupListViewState, type) {
16
+ const userGroupIds = userGroupListViewState.userGroupListByType[type].ids;
17
+ return userGroupIds
18
+ .map((id) => (0, userGroupsSelector_1.getUserGroupByUserGroupId)(userGroupsState, id))
19
+ .filter((value) => value != null);
20
+ }
@@ -0,0 +1,8 @@
1
+ import { FetchedState, ID } from '../../commonStateTypes/common';
2
+ export type UserGroupListType = 'taskManagerCandidate';
3
+ export interface UserGroupIdsByType extends FetchedState {
4
+ ids: ID[];
5
+ }
6
+ export interface UserGroupListViewState {
7
+ userGroupListByType: Record<UserGroupListType, UserGroupIdsByType>;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +1,12 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { updateAddresses } from '../../entity/address/addressReducer';
3
3
  import { updateAllUsers } from '../../entity/user/userReducer';
4
+ import { updateAllUserGroups } from '../../entity/userGroups/userGroupsReducer';
4
5
  import { updateUserRoles } from '../../entity/userRole/userRoleReducer';
5
6
  import { RootState } from '../../reducer';
6
7
  import { ZeniAPI } from '../../zeniAPI';
7
8
  import { updateChargeCardCount, updateDebitCardCount } from '../spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer';
9
+ import { updateUserGroupIds } from '../userGroupListView/userGroupListViewReducer';
8
10
  import { fetchUserListByType, updateUserIds, updateUserListFetchFailure } from './userListViewReducer';
9
- export type ActionType = ReturnType<typeof fetchUserListByType> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateUserIds> | ReturnType<typeof updateChargeCardCount> | ReturnType<typeof updateDebitCardCount> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateUserListFetchFailure>;
11
+ export type ActionType = ReturnType<typeof fetchUserListByType> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateUserIds> | ReturnType<typeof updateChargeCardCount> | ReturnType<typeof updateDebitCardCount> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateUserListFetchFailure> | ReturnType<typeof updateAllUserGroups> | ReturnType<typeof updateUserGroupIds>;
10
12
  export declare const fetchUserListByTypeEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
@@ -6,9 +6,11 @@ const operators_1 = require("rxjs/operators");
6
6
  const addressReducer_1 = require("../../entity/address/addressReducer");
7
7
  const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
8
8
  const userReducer_1 = require("../../entity/user/userReducer");
9
+ const userGroupsReducer_1 = require("../../entity/userGroups/userGroupsReducer");
9
10
  const userRoleReducer_1 = require("../../entity/userRole/userRoleReducer");
10
11
  const responsePayload_1 = require("../../responsePayload");
11
12
  const issueChargeCardReducer_1 = require("../spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer");
13
+ const userGroupListViewReducer_1 = require("../userGroupListView/userGroupListViewReducer");
12
14
  const userListViewReducer_1 = require("./userListViewReducer");
13
15
  const fetchUserListByTypeEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(userListViewReducer_1.fetchUserListByType.match), (0, operators_1.mergeMap)((action) => {
14
16
  const { userType, cacheOverride } = action.payload;
@@ -32,6 +34,15 @@ const fetchUserListByTypeEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
32
34
  usersPayload: response.data?.users ?? [],
33
35
  }),
34
36
  ];
37
+ if (response.data?.user_groups != null) {
38
+ userListAction.push((0, userGroupsReducer_1.updateAllUserGroups)({ userGroups: response.data.user_groups }));
39
+ if (userType === 'taskManagerCandidate') {
40
+ userListAction.push((0, userGroupListViewReducer_1.updateUserGroupIds)({
41
+ userGroupType: userType,
42
+ userGroupsPayload: response.data.user_groups,
43
+ }));
44
+ }
45
+ }
35
46
  if (userType === 'cardHolderCandidate') {
36
47
  userListAction.push((0, issueChargeCardReducer_1.updateChargeCardCount)(response.data?.cards_count_by_user_id ?? []));
37
48
  userListAction.push((0, issueChargeCardReducer_1.updateDebitCardCount)(response.data?.debit_cards_count_by_deposit_account_id ?? {}));