@zeniai/client-epic-state 4.12.97 → 4.12.99

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 (186) hide show
  1. package/lib/commonStateTypes/common.d.ts +2 -0
  2. package/lib/commonStateTypes/common.js +5 -1
  3. package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.d.ts +1 -0
  4. package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +2 -1
  5. package/lib/commonStateTypes/timePeriod.d.ts +16 -0
  6. package/lib/commonStateTypes/timePeriod.js +31 -1
  7. package/lib/commonStateTypes/viewAndReport/reportIDHelper.d.ts +1 -0
  8. package/lib/commonStateTypes/viewAndReport/reportIDHelper.js +3 -1
  9. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  10. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
  11. package/lib/entity/account/accountState.d.ts +1 -1
  12. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  13. package/lib/entity/class/classReducer.d.ts +4 -4
  14. package/lib/entity/class/classState.d.ts +1 -1
  15. package/lib/entity/company/companyStateTypes.d.ts +1 -1
  16. package/lib/entity/forecast/forecastState.d.ts +1 -1
  17. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
  18. package/lib/entity/jeSchedules/jeSchedulesPayload.js +7 -1
  19. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -2
  20. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +3 -1
  21. package/lib/entity/jeSchedules/jeSchedulesSelector.js +2 -1
  22. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +3 -1
  23. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +2 -0
  24. package/lib/entity/jeSchedules/jeSchedulesTypes.js +12 -1
  25. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.d.ts +32 -0
  26. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.js +53 -0
  27. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksReducer.d.ts +12 -0
  28. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksReducer.js +25 -0
  29. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksSelector.d.ts +7 -0
  30. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksSelector.js +36 -0
  31. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +38 -0
  32. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.js +10 -0
  33. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  34. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  35. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  36. package/lib/entity/tenant/clearAllEpic.d.ts +9 -2
  37. package/lib/entity/tenant/clearAllEpic.js +14 -0
  38. package/lib/entity/tenant/epic/fetchAllTenantsEpic.d.ts +4 -1
  39. package/lib/entity/tenant/epic/fetchAllTenantsEpic.js +32 -2
  40. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  41. package/lib/entity/tenant/tenantReducer.js +3 -0
  42. package/lib/entity/tenant/tenantState.d.ts +1 -0
  43. package/lib/entity/transaction/payloadTypes/attachmentPayload.d.ts +1 -1
  44. package/lib/entity/transaction/payloadTypes/attachmentPayload.js +3 -3
  45. package/lib/entity/transaction/stateTypes/transactionType.d.ts +2 -2
  46. package/lib/entity/transaction/transactionSelector.d.ts +1 -0
  47. package/lib/entity/transaction/transactionSelector.js +7 -1
  48. package/lib/entity/vendor/__mocks__/vendorStateMocks.d.ts +1 -0
  49. package/lib/entity/vendor/__mocks__/vendorStateMocks.js +35 -1
  50. package/lib/entity/vendor/vendorPayload.js +3 -2
  51. package/lib/entity/vendor/vendorState.d.ts +3 -3
  52. package/lib/entity/vendor/vendorType.d.ts +0 -2
  53. package/lib/entity/vendor/vendorType.js +1 -4
  54. package/lib/epic.d.ts +10 -1
  55. package/lib/epic.js +10 -1
  56. package/lib/index.d.ts +40 -8
  57. package/lib/index.js +74 -25
  58. package/lib/reducer.d.ts +22 -1
  59. package/lib/reducer.js +22 -1
  60. package/lib/view/auditReportView/auditReportViewState.d.ts +2 -2
  61. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  62. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  63. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  64. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  65. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  66. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +10 -5
  67. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +10 -7
  68. package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportTemplatesEpic.js +4 -4
  69. package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportViewEpic.js +4 -4
  70. package/lib/view/companyMonthEndReportView/epics/improveUsingZeniGPTEpic.js +5 -3
  71. package/lib/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +3 -3
  72. package/lib/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +3 -3
  73. package/lib/view/companyView/types/cockpitTypes.d.ts +2 -2
  74. package/lib/view/dashboard/dashboardEpic.d.ts +2 -1
  75. package/lib/view/dashboard/dashboardEpic.js +22 -2
  76. package/lib/view/dashboard/dashboardReducer.d.ts +3 -2
  77. package/lib/view/dashboard/dashboardReducer.js +2 -1
  78. package/lib/view/dashboard/dashboardSelector.d.ts +2 -0
  79. package/lib/view/dashboard/dashboardSelector.js +10 -2
  80. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +10 -0
  81. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +72 -0
  82. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +11 -0
  83. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +53 -0
  84. package/lib/view/expenseAutomationView/epics/fluxAnalysis/fetchFluxAnalysisViewEpic.d.ts +11 -0
  85. package/lib/view/expenseAutomationView/epics/fluxAnalysis/fetchFluxAnalysisViewEpic.js +66 -0
  86. package/lib/view/expenseAutomationView/epics/fluxAnalysis/reviewFluxAnalysisEpic.d.ts +7 -0
  87. package/lib/view/expenseAutomationView/epics/fluxAnalysis/reviewFluxAnalysisEpic.js +39 -0
  88. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.d.ts +7 -0
  89. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +22 -0
  90. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +8 -0
  91. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +59 -0
  92. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.d.ts +7 -0
  93. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +44 -0
  94. package/lib/view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic.d.ts +6 -0
  95. package/lib/view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic.js +28 -0
  96. package/lib/view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic.d.ts +8 -0
  97. package/lib/view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic.js +44 -0
  98. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMissingReceiptsEpic.d.ts +8 -0
  99. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMissingReceiptsEpic.js +58 -0
  100. package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.d.ts +10 -0
  101. package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +12 -0
  102. package/lib/view/expenseAutomationView/expenseAutomationViewPayload.d.ts +3 -0
  103. package/lib/view/expenseAutomationView/expenseAutomationViewPayload.js +2 -0
  104. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +17 -0
  105. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +66 -0
  106. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.d.ts +3 -0
  107. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +97 -0
  108. package/lib/view/expenseAutomationView/expenseAutomationViewState.d.ts +11 -0
  109. package/lib/view/expenseAutomationView/expenseAutomationViewState.js +14 -0
  110. package/lib/view/expenseAutomationView/helpers/helpers.d.ts +7 -0
  111. package/lib/view/expenseAutomationView/helpers/helpers.js +67 -0
  112. package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.d.ts +76 -0
  113. package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.js +9 -0
  114. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +36 -0
  115. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -0
  116. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +16 -0
  117. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +2 -0
  118. package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.d.ts +34 -0
  119. package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.js +205 -0
  120. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +53 -0
  121. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +245 -0
  122. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +31 -0
  123. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +130 -0
  124. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +5 -0
  125. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +45 -0
  126. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +35 -0
  127. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.js +47 -0
  128. package/lib/view/expenseAutomationView/selectorTypes/fluxAnalysisViewSelectorTypes.d.ts +32 -0
  129. package/lib/view/expenseAutomationView/selectorTypes/fluxAnalysisViewSelectorTypes.js +2 -0
  130. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +28 -0
  131. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.js +2 -0
  132. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +11 -0
  133. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.js +2 -0
  134. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.d.ts +3 -0
  135. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +55 -0
  136. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +7 -0
  137. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +95 -0
  138. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.d.ts +3 -0
  139. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +61 -0
  140. package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.d.ts +53 -0
  141. package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.js +5 -0
  142. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +31 -0
  143. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +2 -0
  144. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +20 -0
  145. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +13 -0
  146. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +28 -0
  147. package/lib/view/expenseAutomationView/types/transactionsViewState.js +15 -0
  148. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  149. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  150. package/lib/view/monthEndCloseChecksView/epics/fetchMonthEndCloseChecksEpic.d.ts +8 -0
  151. package/lib/view/monthEndCloseChecksView/epics/fetchMonthEndCloseChecksEpic.js +58 -0
  152. package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewPayload.d.ts +3 -0
  153. package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewPayload.js +2 -0
  154. package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewReducer.d.ts +16 -0
  155. package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewReducer.js +36 -0
  156. package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewSelector.d.ts +10 -0
  157. package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewSelector.js +27 -0
  158. package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewState.d.ts +5 -0
  159. package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewState.js +2 -0
  160. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  161. package/lib/view/reviewCompanyView/reviewCompanyViewState.d.ts +1 -1
  162. package/lib/view/scheduleView/scheduleAccruedDetailView/LinkBillExpenseView/linkBillExpense.d.ts +1 -1
  163. package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsEpic.js +3 -2
  164. package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsPageEpic.js +1 -1
  165. package/lib/view/scheduleView/scheduleDetailView/epics/saveScheduleDetailsEpic.js +2 -2
  166. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper.js +19 -5
  167. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailPayload.d.ts +8 -3
  168. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailPayload.js +39 -57
  169. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.d.ts +13 -8
  170. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.js +19 -12
  171. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailSelector.d.ts +1 -0
  172. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailSelector.js +4 -3
  173. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailState.d.ts +2 -0
  174. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  175. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +2 -2
  176. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  177. package/lib/view/spendManagement/reimbursement/editRemiView/epics/parseReceiptsToRemiEpic.js +2 -2
  178. package/lib/view/subscriptionView/types/subscriptionTypes.d.ts +1 -1
  179. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  180. package/lib/view/topEx/topExSelector.d.ts +1 -1
  181. package/lib/view/transactionDetail/epics/uploadMissingReceiptSuccessEpic.js +2 -2
  182. package/lib/view/transactionDetail/transactionDetailState.d.ts +2 -2
  183. package/lib/view/vendorReviewView/common/state/commonTypes.d.ts +1 -1
  184. package/lib/view/zeniAccStatementList/zeniAccStatementList.d.ts +2 -5
  185. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +3 -1
  186. package/package.json +1 -1
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.reviewFluxAnalysisViewFailure = exports.reviewFluxAnalysisViewSuccess = exports.reviewFluxAnalysisView = exports.markFullFluxAnalysisViewForReview = exports.updateOperatingExpensesIdsForReview = exports.clearExpenseAutomationFluxAnalysisView = exports.fetchFluxAnalysisViewFailure = exports.fetchFluxAnalysisViewSuccess = exports.fetchFluxAnalysisView = exports.toReviewStatusById = exports.toFluxAnalysisOperatingEexpense = exports.toFluxAnalysisOperatingEexpenses = exports.toFluxAnalysisiOperatingExpensesById = exports.initialState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const helpers_1 = require("../helpers/helpers");
7
+ exports.initialState = {
8
+ reviewStatusById: {},
9
+ operatingExpenseById: {},
10
+ fluxAnalysisEntities: { operatingExpenses: [] },
11
+ uiState: {
12
+ scrollPosition: { scrollTop: 0, scrollLeft: undefined },
13
+ pageToken: null,
14
+ totalCount: 0,
15
+ limit: 10,
16
+ sortKey: 'vendors',
17
+ searchString: '',
18
+ sortOrder: 'ascending',
19
+ },
20
+ refreshStatus: {
21
+ fetchState: 'Not-Started',
22
+ error: undefined,
23
+ },
24
+ fetchState: 'Not-Started',
25
+ bulkReviewStatus: {
26
+ fetchState: 'Not-Started',
27
+ error: undefined,
28
+ },
29
+ error: undefined,
30
+ fluxAnalysisReportGenerated: false,
31
+ reviewOperatingExpensesIds: [],
32
+ isAllRowsSelected: false,
33
+ hasValidState() {
34
+ return this.fetchState == 'Completed';
35
+ },
36
+ };
37
+ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
38
+ name: 'expenseAutomationFluxAnalysisView',
39
+ initialState: exports.initialState,
40
+ reducers: {
41
+ fetchFluxAnalysisView: {
42
+ reducer(draft, action) {
43
+ const { refreshViewInBackground } = action.payload;
44
+ if (refreshViewInBackground) {
45
+ draft.refreshStatus = { fetchState: 'In-Progress', error: undefined };
46
+ }
47
+ else {
48
+ draft.fetchState = 'In-Progress';
49
+ draft.error = undefined;
50
+ }
51
+ },
52
+ prepare(monthAndYear, refreshViewInBackground) {
53
+ return {
54
+ payload: {
55
+ monthAndYear,
56
+ refreshViewInBackground,
57
+ },
58
+ };
59
+ },
60
+ },
61
+ fetchFluxAnalysisViewSuccess(draft, action) {
62
+ const { expensesPayload, currency } = action.payload;
63
+ if (draft.fetchState === 'In-Progress') {
64
+ draft.fetchState = 'Completed';
65
+ draft.error = undefined;
66
+ }
67
+ else {
68
+ draft.refreshStatus = { fetchState: 'Completed', error: undefined };
69
+ }
70
+ draft.reviewStatusById = (0, exports.toReviewStatusById)(expensesPayload);
71
+ draft.operatingExpenseById = (0, exports.toFluxAnalysisiOperatingExpensesById)(expensesPayload, currency);
72
+ draft.fluxAnalysisEntities = {
73
+ operatingExpenses: (0, exports.toFluxAnalysisOperatingEexpenses)(expensesPayload, currency),
74
+ };
75
+ },
76
+ fetchFluxAnalysisViewFailure(draft, action) {
77
+ const { status } = action.payload;
78
+ if (draft.fetchState === 'In-Progress') {
79
+ draft.fetchState = 'Error';
80
+ draft.error = status;
81
+ }
82
+ else {
83
+ draft.refreshStatus = { fetchState: 'Error', error: status };
84
+ }
85
+ },
86
+ updateOperatingExpensesIdsForReview(draft, action) {
87
+ const { operatingExpenseIds } = action.payload;
88
+ if (draft.reviewOperatingExpensesIds.length == 0) {
89
+ draft.reviewOperatingExpensesIds = operatingExpenseIds;
90
+ }
91
+ else {
92
+ draft.reviewOperatingExpensesIds =
93
+ draft.reviewOperatingExpensesIds.concat(operatingExpenseIds);
94
+ }
95
+ },
96
+ markFullFluxAnalysisViewForReview(draft, action) {
97
+ const { isSelected } = action.payload;
98
+ const allRowIds = Object.keys(draft.operatingExpenseById);
99
+ draft.reviewOperatingExpensesIds = allRowIds;
100
+ draft.isAllRowsSelected = isSelected;
101
+ },
102
+ reviewFluxAnalysisView: {
103
+ reducer(draft, action) {
104
+ const { operatingExpenseIds } = action.payload;
105
+ operatingExpenseIds.forEach((id) => {
106
+ draft.reviewStatusById[id] = {
107
+ fetchState: 'In-Progress',
108
+ };
109
+ });
110
+ if (operatingExpenseIds.length > 1) {
111
+ draft.bulkReviewStatus = {
112
+ fetchState: 'In-Progress',
113
+ };
114
+ }
115
+ },
116
+ prepare(actionType, operatingExpenseIds) {
117
+ return {
118
+ payload: { actionType, operatingExpenseIds },
119
+ };
120
+ },
121
+ },
122
+ reviewFluxAnalysisViewSuccess(draft, action) {
123
+ const { operatingExpenseIds } = action.payload;
124
+ operatingExpenseIds.forEach((id) => {
125
+ delete draft.operatingExpenseById[id];
126
+ draft.reviewStatusById[id] = {
127
+ fetchState: 'Completed',
128
+ };
129
+ });
130
+ if (operatingExpenseIds.length > 1) {
131
+ draft.bulkReviewStatus = {
132
+ fetchState: 'Completed',
133
+ };
134
+ }
135
+ },
136
+ reviewFluxAnalysisViewFailure(draft, action) {
137
+ const { operatingExpenseIds, status } = action.payload;
138
+ operatingExpenseIds.forEach((id) => {
139
+ if (draft.reviewStatusById[id].fetchState === 'In-Progress') {
140
+ draft.reviewStatusById[id].fetchState = 'Error';
141
+ draft.reviewStatusById[id].error = status;
142
+ }
143
+ });
144
+ if (operatingExpenseIds.length > 1) {
145
+ draft.bulkReviewStatus = {
146
+ fetchState: 'Error',
147
+ error: status,
148
+ };
149
+ }
150
+ },
151
+ clearExpenseAutomationFluxAnalysisView(draft) {
152
+ Object.assign(draft, exports.initialState);
153
+ },
154
+ },
155
+ });
156
+ const toFluxAnalysisiOperatingExpensesById = (operatingExpenses, currency) => {
157
+ const balancesByVendorKey = {};
158
+ operatingExpenses.forEach((operatingExpense) => {
159
+ const vendorFluxKey = operatingExpense.flux_analysis_entity_id;
160
+ balancesByVendorKey[vendorFluxKey] = (0, exports.toFluxAnalysisOperatingEexpense)(operatingExpense, currency);
161
+ });
162
+ return balancesByVendorKey;
163
+ };
164
+ exports.toFluxAnalysisiOperatingExpensesById = toFluxAnalysisiOperatingExpensesById;
165
+ const toFluxAnalysisOperatingEexpenses = (operatingExpensesPayload, currency) => {
166
+ const operatingExpenses = [];
167
+ operatingExpensesPayload.forEach((operatingExpensePayload) => {
168
+ operatingExpenses.push((0, exports.toFluxAnalysisOperatingEexpense)(operatingExpensePayload, currency));
169
+ });
170
+ return operatingExpenses;
171
+ };
172
+ exports.toFluxAnalysisOperatingEexpenses = toFluxAnalysisOperatingEexpenses;
173
+ const toFluxAnalysisOperatingEexpense = (operatingExpensePayload, currency) => {
174
+ var _a;
175
+ return {
176
+ operatingExpenseId: operatingExpensePayload.flux_analysis_entity_id,
177
+ vendorId: operatingExpensePayload.vendor_id,
178
+ accountId: operatingExpensePayload.account_id,
179
+ classId: operatingExpensePayload.accounting_class_id,
180
+ userId: (_a = operatingExpensePayload.reviewed_by_user_id) !== null && _a !== void 0 ? _a : undefined,
181
+ varianceAmount: operatingExpensePayload.variance_amount,
182
+ variancePercentage: operatingExpensePayload.variance_percentage,
183
+ currency: {
184
+ currencyCode: currency.currency_code,
185
+ currencySymbol: currency.currency_symbol,
186
+ },
187
+ anomalyReason: operatingExpensePayload.anomaly_reason,
188
+ status: (0, helpers_1.toVendorFluxAnalysisStatusFromPayload)(operatingExpensePayload.status),
189
+ balancesByMonth: (0, helpers_1.toBalancesByMonthFromPayload)(operatingExpensePayload.month_1, operatingExpensePayload.month_2, currency),
190
+ };
191
+ };
192
+ exports.toFluxAnalysisOperatingEexpense = toFluxAnalysisOperatingEexpense;
193
+ const toReviewStatusById = (operatingExpenses) => {
194
+ const reviewStatusById = {};
195
+ operatingExpenses.forEach((operatingExpense) => {
196
+ reviewStatusById[operatingExpense.flux_analysis_entity_id] = {
197
+ fetchState: 'Not-Started',
198
+ error: undefined,
199
+ };
200
+ });
201
+ return reviewStatusById;
202
+ };
203
+ exports.toReviewStatusById = toReviewStatusById;
204
+ _a = expenseAutomationFluxAnalysisView.actions, exports.fetchFluxAnalysisView = _a.fetchFluxAnalysisView, exports.fetchFluxAnalysisViewSuccess = _a.fetchFluxAnalysisViewSuccess, exports.fetchFluxAnalysisViewFailure = _a.fetchFluxAnalysisViewFailure, exports.clearExpenseAutomationFluxAnalysisView = _a.clearExpenseAutomationFluxAnalysisView, exports.updateOperatingExpensesIdsForReview = _a.updateOperatingExpensesIdsForReview, exports.markFullFluxAnalysisViewForReview = _a.markFullFluxAnalysisViewForReview, exports.reviewFluxAnalysisView = _a.reviewFluxAnalysisView, exports.reviewFluxAnalysisViewSuccess = _a.reviewFluxAnalysisViewSuccess, exports.reviewFluxAnalysisViewFailure = _a.reviewFluxAnalysisViewFailure;
205
+ exports.default = expenseAutomationFluxAnalysisView.reducer;
@@ -0,0 +1,53 @@
1
+ import { ID } from '../../../commonStateTypes/common';
2
+ import { JEScheduleLocalData, JESchedulesViewState } from '../types/jeSchedulesViewState';
3
+ import { TimePeriod, MonthYearPeriod } from '../../../commonStateTypes/timePeriod';
4
+ import { JEScheduleTransactionKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
5
+ import { ZeniAPIStatus } from '../../../responsePayload';
6
+ import { JEScheduledTransactionPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
7
+ export declare const initialState: JESchedulesViewState;
8
+ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, fetchJeSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any], {
9
+ period: TimePeriod;
10
+ refreshViewInBackground: any;
11
+ }, string, never, never>, fetchJeSchedulesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
12
+ selectedPeriod: MonthYearPeriod;
13
+ status: ZeniAPIStatus;
14
+ }, string>, fetchJeSchedulesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
15
+ jeSchedules: JEScheduledTransactionPayload[];
16
+ failedJeSchedules: JEScheduledTransactionPayload[];
17
+ selectedPeriod: MonthYearPeriod;
18
+ }, string>, fetchJeSchedulesPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any], {
19
+ period: TimePeriod;
20
+ refreshViewInBackground: any;
21
+ }, string, never, never>, ignoreRecommendedJeSchedule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleTransactionKey: `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`, scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue"], {
22
+ jeScheduleTransactionKey: `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
23
+ scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
24
+ }, string, never, never>, ignoreRecommendedJeScheduleFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
25
+ jeScheduleTransactionKey: JEScheduleTransactionKey;
26
+ status: ZeniAPIStatus;
27
+ }, string>, ignoreRecommendedJeScheduleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleTransactionKey: `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`], {
28
+ jeScheduleTransactionKey: `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
29
+ }, string, never, never>, initializeJeScheduleLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeSchedules: JEScheduledTransactionPayload[]], {
30
+ jeScheduleTransactionKeys: (`${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`)[];
31
+ }, string, never, never>, removeJeScheduleTransactionKey: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleKey: `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`, selectedPeriod: MonthYearPeriod], {
32
+ jeScheduleKey: `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
33
+ selectedPeriod: MonthYearPeriod;
34
+ }, string, never, never>, removeFailedJeScheduleTransactionKey: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[failedJeScheduleKey: `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`, selectedPeriod: MonthYearPeriod], {
35
+ failedJeScheduleKey: `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
36
+ selectedPeriod: MonthYearPeriod;
37
+ }, string, never, never>, retryJeSchedule: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
38
+ scheduledJournalEntryID: ID;
39
+ jeScheduleTransactionKey: JEScheduleTransactionKey;
40
+ }, string>, retryJeScheduleFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
41
+ scheduledJournalEntryID: ID;
42
+ status: ZeniAPIStatus;
43
+ }, string>, retryJeScheduleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
44
+ scheduledJournalEntryID: ID;
45
+ }, string>, updateJeScheduleLocalDataById: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
46
+ scheduledJournalEntryID: ID;
47
+ localData: Partial<JEScheduleLocalData>;
48
+ }, string>, updateJeScheduleTransactionKeys: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleKeys: (`${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`)[], selectedPeriod: MonthYearPeriod], {
49
+ jeScheduleKeys: (`${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`)[];
50
+ selectedPeriod: MonthYearPeriod;
51
+ }, string, never, never>;
52
+ declare const _default: import("@reduxjs/toolkit").Reducer<JESchedulesViewState, import("@reduxjs/toolkit").AnyAction>;
53
+ export default _default;
@@ -0,0 +1,245 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.updateJeScheduleTransactionKeys = exports.updateJeScheduleLocalDataById = exports.retryJeScheduleSuccess = exports.retryJeScheduleFailure = exports.retryJeSchedule = exports.removeFailedJeScheduleTransactionKey = exports.removeJeScheduleTransactionKey = exports.initializeJeScheduleLocalData = exports.ignoreRecommendedJeScheduleSuccess = exports.ignoreRecommendedJeScheduleFailure = exports.ignoreRecommendedJeSchedule = exports.fetchJeSchedulesPage = exports.fetchJeSchedulesSuccess = exports.fetchJeSchedulesFailure = exports.fetchJeSchedules = exports.clearExpenseAutomationJESchedulesView = exports.initialState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
7
+ const jeSchedulesPayload_1 = require("../../../entity/jeSchedules/jeSchedulesPayload");
8
+ const transactionIDPayload_1 = require("../../../entity/transaction/payloadTypes/transactionIDPayload");
9
+ const transactionDetailState_1 = require("../../transactionDetail/transactionDetailState");
10
+ exports.initialState = {
11
+ jeScheduleTransactionKeysByPeriod: {},
12
+ failedJeScheduleTransactionKeysByPeriod: {},
13
+ postStatusById: {},
14
+ ignoreStatusById: {},
15
+ jeScheduleLocalDataById: {},
16
+ uiState: {
17
+ searchString: '',
18
+ scrollPosition: { scrollTop: 0, scrollLeft: undefined },
19
+ totalCount: 0,
20
+ limit: 10,
21
+ },
22
+ refreshStatus: {
23
+ fetchState: 'Not-Started',
24
+ error: undefined,
25
+ },
26
+ fetchState: 'Not-Started',
27
+ error: undefined,
28
+ hasValidState() {
29
+ return this.fetchState == 'Completed';
30
+ },
31
+ };
32
+ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
33
+ name: 'expenseAutomationJESchedulesView',
34
+ initialState: exports.initialState,
35
+ reducers: {
36
+ fetchJeSchedulesPage: {
37
+ prepare(period, refreshViewInBackground = false) {
38
+ return {
39
+ payload: {
40
+ period,
41
+ refreshViewInBackground,
42
+ },
43
+ };
44
+ },
45
+ reducer() {
46
+ // Do nothing
47
+ },
48
+ },
49
+ fetchJeSchedules: {
50
+ reducer(draft, action) {
51
+ const { refreshViewInBackground } = action.payload;
52
+ if (refreshViewInBackground) {
53
+ draft.refreshStatus = { fetchState: 'In-Progress', error: undefined };
54
+ }
55
+ else {
56
+ draft.fetchState = 'In-Progress';
57
+ draft.error = undefined;
58
+ }
59
+ },
60
+ prepare(period, refreshViewInBackground = false) {
61
+ return {
62
+ payload: {
63
+ period,
64
+ refreshViewInBackground,
65
+ },
66
+ };
67
+ },
68
+ },
69
+ fetchJeSchedulesSuccess(draft, action) {
70
+ const { jeSchedules, selectedPeriod, failedJeSchedules } = action.payload;
71
+ const jeScheduleTransactionKeys = jeSchedules.map((schedules) => {
72
+ const transactionID = (0, transactionIDPayload_1.toTransactionID)(schedules.base_transaction);
73
+ return (0, transactionDetailState_1.getZeniTransactionDetailKey)(transactionID);
74
+ });
75
+ const failedJeScheduleTransactionKeys = failedJeSchedules.map((schedules) => {
76
+ const transactionID = (0, transactionIDPayload_1.toTransactionID)(schedules.base_transaction);
77
+ return (0, transactionDetailState_1.getZeniTransactionDetailKey)(transactionID);
78
+ });
79
+ if (draft.refreshStatus.fetchState === 'In-Progress') {
80
+ draft.refreshStatus = { fetchState: 'Completed', error: undefined };
81
+ }
82
+ else {
83
+ draft.fetchState = 'Completed';
84
+ draft.error = undefined;
85
+ }
86
+ draft.jeScheduleTransactionKeysByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = jeScheduleTransactionKeys;
87
+ draft.failedJeScheduleTransactionKeysByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = failedJeScheduleTransactionKeys;
88
+ },
89
+ fetchJeSchedulesFailure(draft, action) {
90
+ const { status, selectedPeriod } = action.payload;
91
+ if (draft.refreshStatus.fetchState === 'In-Progress') {
92
+ draft.refreshStatus = { fetchState: 'Error', error: status };
93
+ }
94
+ else {
95
+ draft.fetchState = 'Error';
96
+ draft.error = status;
97
+ }
98
+ draft.jeScheduleTransactionKeysByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = [];
99
+ },
100
+ retryJeSchedule(draft, action) {
101
+ const { scheduledJournalEntryID } = action.payload;
102
+ const prevData = draft.postStatusById;
103
+ draft.postStatusById = Object.assign(Object.assign({}, prevData), { [scheduledJournalEntryID]: {
104
+ fetchState: 'In-Progress',
105
+ error: undefined,
106
+ } });
107
+ },
108
+ retryJeScheduleSuccess(draft, action) {
109
+ const { scheduledJournalEntryID } = action.payload;
110
+ const prevData = draft.postStatusById;
111
+ draft.postStatusById = Object.assign(Object.assign({}, prevData), { [scheduledJournalEntryID]: {
112
+ fetchState: 'Completed',
113
+ error: undefined,
114
+ } });
115
+ },
116
+ retryJeScheduleFailure(draft, action) {
117
+ const { status, scheduledJournalEntryID } = action.payload;
118
+ const prevData = draft.postStatusById;
119
+ draft.postStatusById = Object.assign(Object.assign({}, prevData), { [scheduledJournalEntryID]: {
120
+ fetchState: 'Error',
121
+ error: status,
122
+ } });
123
+ },
124
+ ignoreRecommendedJeSchedule: {
125
+ prepare(jeScheduleTransactionKey, scheduleType) {
126
+ return {
127
+ payload: {
128
+ jeScheduleTransactionKey,
129
+ scheduleType,
130
+ },
131
+ };
132
+ },
133
+ reducer(draft, action) {
134
+ const { jeScheduleTransactionKey } = action.payload;
135
+ const prevData = draft.ignoreStatusById;
136
+ draft.ignoreStatusById = Object.assign(Object.assign({}, prevData), { [jeScheduleTransactionKey]: {
137
+ fetchState: 'In-Progress',
138
+ error: undefined,
139
+ } });
140
+ },
141
+ },
142
+ ignoreRecommendedJeScheduleSuccess: {
143
+ reducer(draft, action) {
144
+ const { jeScheduleTransactionKey } = action.payload;
145
+ const prevData = draft.ignoreStatusById;
146
+ draft.ignoreStatusById = Object.assign(Object.assign({}, prevData), { [jeScheduleTransactionKey]: {
147
+ fetchState: 'Completed',
148
+ error: undefined,
149
+ } });
150
+ },
151
+ prepare(jeScheduleTransactionKey) {
152
+ return {
153
+ payload: {
154
+ jeScheduleTransactionKey,
155
+ },
156
+ };
157
+ },
158
+ },
159
+ ignoreRecommendedJeScheduleFailure(draft, action) {
160
+ const { status, jeScheduleTransactionKey } = action.payload;
161
+ const prevData = draft.ignoreStatusById;
162
+ draft.ignoreStatusById = Object.assign(Object.assign({}, prevData), { [jeScheduleTransactionKey]: {
163
+ fetchState: 'Error',
164
+ error: status,
165
+ } });
166
+ },
167
+ updateJeScheduleTransactionKeys: {
168
+ prepare(jeScheduleKeys, selectedPeriod) {
169
+ return {
170
+ payload: {
171
+ jeScheduleKeys: jeScheduleKeys,
172
+ selectedPeriod: selectedPeriod,
173
+ },
174
+ };
175
+ },
176
+ reducer(draft, action) {
177
+ const { selectedPeriod, jeScheduleKeys } = action.payload;
178
+ draft.jeScheduleTransactionKeysByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = jeScheduleKeys;
179
+ },
180
+ },
181
+ removeJeScheduleTransactionKey: {
182
+ prepare(jeScheduleKey, selectedPeriod) {
183
+ return {
184
+ payload: {
185
+ jeScheduleKey: jeScheduleKey,
186
+ selectedPeriod: selectedPeriod,
187
+ },
188
+ };
189
+ },
190
+ reducer(draft, action) {
191
+ var _a;
192
+ const { selectedPeriod, jeScheduleKey } = action.payload;
193
+ const prevData = [
194
+ ...((_a = draft.jeScheduleTransactionKeysByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]) !== null && _a !== void 0 ? _a : []),
195
+ ];
196
+ const filteredKeys = prevData.filter((jeKey) => jeKey !== jeScheduleKey);
197
+ draft.jeScheduleTransactionKeysByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = filteredKeys;
198
+ },
199
+ },
200
+ removeFailedJeScheduleTransactionKey: {
201
+ prepare(failedJeScheduleKey, selectedPeriod) {
202
+ return {
203
+ payload: {
204
+ failedJeScheduleKey: failedJeScheduleKey,
205
+ selectedPeriod: selectedPeriod,
206
+ },
207
+ };
208
+ },
209
+ reducer(draft, action) {
210
+ var _a;
211
+ const { selectedPeriod, failedJeScheduleKey } = action.payload;
212
+ const prevData = [
213
+ ...((_a = draft.failedJeScheduleTransactionKeysByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]) !== null && _a !== void 0 ? _a : []),
214
+ ];
215
+ const filteredKeys = prevData.filter((jeKey) => jeKey !== failedJeScheduleKey);
216
+ draft.failedJeScheduleTransactionKeysByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = filteredKeys;
217
+ },
218
+ },
219
+ initializeJeScheduleLocalData: {
220
+ reducer() {
221
+ /* DO nothing*/
222
+ },
223
+ prepare(jeSchedules) {
224
+ return {
225
+ payload: {
226
+ jeScheduleTransactionKeys: [
227
+ ...jeSchedules.map((jeSchedule) => (0, jeSchedulesPayload_1.getTransactionDetailKeyPayload)(jeSchedule.base_transaction)),
228
+ ],
229
+ },
230
+ };
231
+ },
232
+ },
233
+ updateJeScheduleLocalDataById(draft, action) {
234
+ const { scheduledJournalEntryID, localData } = action.payload;
235
+ const prevData = draft.jeScheduleLocalDataById;
236
+ const prevLocalDataById = draft.jeScheduleLocalDataById[scheduledJournalEntryID];
237
+ draft.jeScheduleLocalDataById = Object.assign(Object.assign({}, prevData), { [scheduledJournalEntryID]: Object.assign(Object.assign({}, prevLocalDataById), localData) });
238
+ },
239
+ clearExpenseAutomationJESchedulesView(draft) {
240
+ Object.assign(draft, exports.initialState);
241
+ },
242
+ },
243
+ });
244
+ _a = expenseAutomationJESchedulesView.actions, exports.clearExpenseAutomationJESchedulesView = _a.clearExpenseAutomationJESchedulesView, exports.fetchJeSchedules = _a.fetchJeSchedules, exports.fetchJeSchedulesFailure = _a.fetchJeSchedulesFailure, exports.fetchJeSchedulesSuccess = _a.fetchJeSchedulesSuccess, exports.fetchJeSchedulesPage = _a.fetchJeSchedulesPage, exports.ignoreRecommendedJeSchedule = _a.ignoreRecommendedJeSchedule, exports.ignoreRecommendedJeScheduleFailure = _a.ignoreRecommendedJeScheduleFailure, exports.ignoreRecommendedJeScheduleSuccess = _a.ignoreRecommendedJeScheduleSuccess, exports.initializeJeScheduleLocalData = _a.initializeJeScheduleLocalData, exports.removeJeScheduleTransactionKey = _a.removeJeScheduleTransactionKey, exports.removeFailedJeScheduleTransactionKey = _a.removeFailedJeScheduleTransactionKey, exports.retryJeSchedule = _a.retryJeSchedule, exports.retryJeScheduleFailure = _a.retryJeScheduleFailure, exports.retryJeScheduleSuccess = _a.retryJeScheduleSuccess, exports.updateJeScheduleLocalDataById = _a.updateJeScheduleLocalDataById, exports.updateJeScheduleTransactionKeys = _a.updateJeScheduleTransactionKeys;
245
+ exports.default = expenseAutomationJESchedulesView.reducer;
@@ -0,0 +1,31 @@
1
+ import { MissingReceiptsViewState, MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
2
+ import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePeriod';
3
+ import { Amount } from '../../../commonStateTypes/amount';
4
+ import { TransactionPayload } from '../../../entity/transaction/payloadTypes/transactionPayload';
5
+ import { ZeniAPIStatus } from '../../../responsePayload';
6
+ import { SupportedTransactionPayload } from '../../../entity/transaction/transactionState';
7
+ import { FetchStateAndError, UpdateType } from '../../../commonStateTypes/common';
8
+ export declare const initialState: MissingReceiptsViewState;
9
+ export declare const fetchMissingReceipts: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, minimumTransactionAmount: Amount, cacheOverride?: any, refreshViewInBackground?: any], {
10
+ period: TimePeriod;
11
+ minimumTransactionAmount: Amount;
12
+ cacheOverride: any;
13
+ refreshViewInBackground: any;
14
+ }, string, never, never>, fetchMissingReceiptsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
15
+ transactionsPayload: TransactionPayload[];
16
+ selectedPeriod: MonthYearPeriod;
17
+ }, string>, fetchMissingReceiptsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
18
+ selectedPeriod: MonthYearPeriod;
19
+ status: ZeniAPIStatus;
20
+ }, string>, uploadMissingReceiptSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionPayload: SupportedTransactionPayload, updateType?: UpdateType | undefined], {
21
+ transactionPayload: SupportedTransactionPayload;
22
+ updateType: UpdateType;
23
+ }, string, never, never>, updateMissingReceiptUploadState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: string, fetchStatus: FetchStateAndError], {
24
+ transactionId: string;
25
+ fetchStatus: FetchStateAndError;
26
+ }, string, never, never>, updateMissingReceiptsUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<MissingReceiptsViewUIState>, string>, markMissingReceiptAsDone: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionPayload: SupportedTransactionPayload, selectedPeriod: MonthYearPeriod], {
27
+ transactionPayload: SupportedTransactionPayload;
28
+ selectedPeriod: MonthYearPeriod;
29
+ }, string, never, never>, clearExpenseAutomationMissingReceiptsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
30
+ declare const _default: import("@reduxjs/toolkit").Reducer<MissingReceiptsViewState, import("@reduxjs/toolkit").AnyAction>;
31
+ export default _default;