@zeniai/client-epic-state 5.2.11-betaRD1 → 5.2.12

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 (174) hide show
  1. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +27 -29
  2. package/lib/entity/invoicing/invoicingCommonPayload.js +37 -75
  3. package/lib/entity/invoicing/product/productPayload.d.ts +10 -0
  4. package/lib/entity/invoicing/product/productPayload.js +14 -2
  5. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -1
  6. package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
  7. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -66
  8. package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -135
  9. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
  10. package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  11. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -11
  12. package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -38
  13. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -79
  14. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -24
  15. package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -88
  16. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  17. package/lib/entity/snackbar/snackbarTypes.js +0 -3
  18. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
  19. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  20. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
  21. package/lib/epic.d.ts +2 -10
  22. package/lib/epic.js +10 -21
  23. package/lib/esm/entity/invoicing/invoicingCommonPayload.js +33 -73
  24. package/lib/esm/entity/invoicing/product/productPayload.js +14 -2
  25. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
  26. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -135
  27. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  28. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -36
  29. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -78
  30. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
  31. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  32. package/lib/esm/epic.js +6 -17
  33. package/lib/esm/index.js +13 -18
  34. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  35. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +5 -41
  36. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  37. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +0 -55
  38. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -306
  39. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -294
  40. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
  41. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +25 -9
  42. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
  43. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +40 -0
  44. package/lib/esm/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +27 -0
  45. package/lib/esm/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +19 -0
  46. package/lib/esm/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +19 -0
  47. package/lib/esm/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +39 -0
  48. package/lib/esm/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +25 -0
  49. package/lib/esm/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +48 -0
  50. package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +25 -1
  51. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +41 -0
  52. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  53. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  54. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  55. package/lib/index.d.ts +19 -22
  56. package/lib/index.js +59 -96
  57. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  58. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -3
  59. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -39
  60. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  61. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  62. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +3 -72
  63. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -58
  64. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +12 -91
  65. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -308
  66. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  67. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  68. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -36
  69. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +0 -34
  70. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -302
  71. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  72. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -82
  73. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  74. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +2 -2
  75. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +12 -1
  76. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +25 -9
  77. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
  78. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +10 -1
  79. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +43 -1
  80. package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.d.ts +6 -0
  81. package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +31 -0
  82. package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.d.ts +6 -0
  83. package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +23 -0
  84. package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.d.ts +6 -0
  85. package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +23 -0
  86. package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.d.ts +6 -0
  87. package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +43 -0
  88. package/lib/view/invoicing/settingsView/epics/settingsViewActionType.d.ts +5 -0
  89. package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.d.ts +11 -0
  90. package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +29 -0
  91. package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.d.ts +34 -0
  92. package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +53 -0
  93. package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +4 -1
  94. package/lib/view/invoicing/settingsView/settingsViewReducer.js +26 -2
  95. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +35 -0
  96. package/lib/view/invoicing/settingsView/settingsViewSelector.js +43 -1
  97. package/lib/view/invoicing/settingsView/settingsViewState.d.ts +8 -0
  98. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  99. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  100. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +2 -4
  101. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  102. package/package.json +1 -1
  103. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
  104. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  105. package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
  106. package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
  107. package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  108. package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
  109. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -45
  110. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -99
  111. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
  112. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
  113. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -79
  114. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -139
  115. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -106
  116. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
  117. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
  118. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -106
  119. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -25
  120. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -15
  121. package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +0 -92
  122. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
  123. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
  124. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -18
  125. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -16
  126. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -1
  127. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -60
  128. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -12
  129. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -1
  130. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +0 -20
  131. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -49
  132. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +0 -8
  133. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -103
  134. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
  135. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -29
  136. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
  137. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
  138. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
  139. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -83
  140. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +0 -12
  141. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -146
  142. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +0 -64
  143. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -110
  144. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
  145. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
  146. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
  147. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
  148. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -42
  149. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -21
  150. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -112
  151. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +0 -6
  152. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -29
  153. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +0 -6
  154. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -19
  155. package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +0 -12
  156. package/lib/view/invoicing/settingsView/settingsViewEpics.js +0 -99
  157. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
  158. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
  159. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
  160. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
  161. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
  162. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
  163. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +0 -13
  164. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -20
  165. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +0 -11
  166. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -2
  167. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +0 -7
  168. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -64
  169. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +0 -12
  170. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -15
  171. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +0 -9
  172. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -2
  173. /package/lib/esm/view/{expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js → invoicing/settingsView/epics/settingsViewActionType.js} +0 -0
  174. /package/lib/view/{expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js → invoicing/settingsView/epics/settingsViewActionType.js} +0 -0
@@ -1,8 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { updateScheduleTransactions } from '../../../../../entity/transaction/transactionReducer';
4
- import { RootState } from '../../../../../reducer';
5
- import { ZeniAPI } from '../../../../../zeniAPI';
6
- import { searchTransactionsForNewSchedule, searchTransactionsForNewScheduleFailure, searchTransactionsForNewScheduleSuccess } from '../../../reducers/jeSchedulesViewReducer';
7
- export type ActionType = ReturnType<typeof searchTransactionsForNewSchedule> | ReturnType<typeof searchTransactionsForNewScheduleSuccess> | ReturnType<typeof searchTransactionsForNewScheduleFailure> | ReturnType<typeof updateScheduleTransactions>;
8
- export declare const searchTransactionsForNewScheduleEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,83 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.searchTransactionsForNewScheduleEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const jeSchedulesTypes_1 = require("../../../../../entity/jeSchedules/jeSchedulesTypes");
7
- const transactionType_1 = require("../../../../../entity/transaction/stateTypes/transactionType");
8
- const transactionReducer_1 = require("../../../../../entity/transaction/transactionReducer");
9
- const responsePayload_1 = require("../../../../../responsePayload");
10
- const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
11
- const jeSchedulesViewState_1 = require("../../../types/jeSchedulesViewState");
12
- /**
13
- * Dropdown-sized result set. The endpoint is paginated — it takes a `page_token` $skip offset and
14
- * returns `next_page_token` — but nothing here reads or sends those, so this is the whole result
15
- * set the form ever sees. 20 rather than the backend's default of 10 because a text search for one
16
- * known transaction was running out of room; the cap server-side is 100 if this needs raising again
17
- * before infinite scroll is wired up.
18
- */
19
- const NEW_SCHEDULE_SEARCH_PAGE_SIZE = 20;
20
- /** Fallback when the backend sends a null currency for a search result. */
21
- const DEFAULT_CURRENCY_CODE = 'USD';
22
- const DEFAULT_CURRENCY_SYMBOL = '$';
23
- const searchTransactionsForNewScheduleEpic = (actions$, _state$, zeniAPI) => {
24
- const searchActions$ = actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.searchTransactionsForNewSchedule.match));
25
- /** No API for empty or 1-char queries; immediate merge so switchMap cancels any in-flight HTTP. */
26
- const newSearchTooShortOrClear$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.query.trim().length < jeSchedulesViewState_1.MIN_NEW_SCHEDULE_SEARCH_LENGTH));
27
- const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.query.trim().length >= jeSchedulesViewState_1.MIN_NEW_SCHEDULE_SEARCH_LENGTH), (0, operators_1.debounceTime)(300));
28
- return (0, rxjs_1.merge)(newSearchTooShortOrClear$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
29
- const query = action.payload.query.trim();
30
- if (query.length < jeSchedulesViewState_1.MIN_NEW_SCHEDULE_SEARCH_LENGTH) {
31
- return rxjs_1.EMPTY;
32
- }
33
- const queryParam = {
34
- page_size: NEW_SCHEDULE_SEARCH_PAGE_SIZE,
35
- search_text: query,
36
- je_schedule_type: action.payload.scheduleType,
37
- };
38
- return zeniAPI
39
- .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/base_transaction_search?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
40
- .pipe((0, operators_1.mergeMap)((response) => {
41
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
42
- const { transactions } = response.data;
43
- const transactionsPerCurrency = {};
44
- transactions.forEach((transaction) => {
45
- const { currency_code, currency_symbol } = transaction;
46
- const currencyCode = currency_code ?? DEFAULT_CURRENCY_CODE;
47
- const existing = transactionsPerCurrency[currencyCode];
48
- transactionsPerCurrency[currencyCode] =
49
- existing != null
50
- ? {
51
- currencySymbol: existing.currencySymbol,
52
- transactions: [...existing.transactions, transaction],
53
- }
54
- : {
55
- currencySymbol: currency_code == null
56
- ? DEFAULT_CURRENCY_SYMBOL
57
- : currency_symbol,
58
- transactions: [transaction],
59
- };
60
- });
61
- const actionsOut = Object.keys(transactionsPerCurrency).map((currencyCode) => {
62
- const perCurrency = transactionsPerCurrency[currencyCode];
63
- return (0, transactionReducer_1.updateScheduleTransactions)(perCurrency.transactions, currencyCode, perCurrency.currencySymbol, 'merge');
64
- });
65
- actionsOut.push((0, jeSchedulesViewReducer_1.searchTransactionsForNewScheduleSuccess)({
66
- searchResults: transactions.map((transaction) => (0, jeSchedulesTypes_1.getJEScheduleTransactionKey)({
67
- id: transaction.transaction_id,
68
- type: (0, transactionType_1.toTransactionType)(transaction.transaction_type),
69
- lineId: transaction.line_id,
70
- })),
71
- }));
72
- return (0, rxjs_1.from)(actionsOut);
73
- }
74
- return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.searchTransactionsForNewScheduleFailure)({
75
- status: response.status,
76
- }));
77
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.searchTransactionsForNewScheduleFailure)({
78
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Search transactions for new schedule errored: ' +
79
- JSON.stringify(error)),
80
- }))));
81
- }));
82
- };
83
- exports.searchTransactionsForNewScheduleEpic = searchTransactionsForNewScheduleEpic;
@@ -1,12 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { updateJEOneTimeAccruals } from '../../../../entity/jeSchedules/jeSchedulesReducer';
4
- import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
5
- import { RootState } from '../../../../reducer';
6
- import { ZeniAPI } from '../../../../zeniAPI';
7
- import { fetchJeSchedules, ignoreOneTimeAccrual, oneTimeAccrualActionFailure, oneTimeAccrualActionSuccess, promoteOneTimeAccrual, revertOneTimeAccrual } from '../../reducers/jeSchedulesViewReducer';
8
- export type ActionType = ReturnType<typeof promoteOneTimeAccrual> | ReturnType<typeof revertOneTimeAccrual> | ReturnType<typeof ignoreOneTimeAccrual> | ReturnType<typeof oneTimeAccrualActionSuccess> | ReturnType<typeof oneTimeAccrualActionFailure> | ReturnType<typeof updateJEOneTimeAccruals> | ReturnType<typeof fetchJeSchedules> | ReturnType<typeof openSnackbar>;
9
- export declare const promoteOneTimeAccrualEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
10
- export declare const ignoreOneTimeAccrualEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
11
- export declare const revertOneTimeAccrualEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
12
- export declare const oneTimeAccrualActionsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,146 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oneTimeAccrualActionsEpic = exports.revertOneTimeAccrualEpic = exports.ignoreOneTimeAccrualEpic = exports.promoteOneTimeAccrualEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
7
- const jeScheduleHelper_1 = require("../../../../entity/jeSchedules/jeScheduleHelper");
8
- const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
9
- const jeSchedulesSelector_1 = require("../../../../entity/jeSchedules/jeSchedulesSelector");
10
- const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
11
- const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
12
- const responsePayload_1 = require("../../../../responsePayload");
13
- const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
14
- /**
15
- * The page the accrual came from, so a promoted or ignored row lands in the right bucket. Guarded
16
- * because convertToPeriod destructures: an unset period would throw and take the epic subscription
17
- * down for the session, and a missed refresh is the cheaper failure.
18
- */
19
- function refreshCurrentPage(state) {
20
- const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[(0, tenantSelector_1.getCurrentTenant)(state).tenantId];
21
- if (selectedMonthYear == null) {
22
- return [];
23
- }
24
- const period = (0, timePeriod_1.convertToPeriod)(selectedMonthYear);
25
- const start = (0, timePeriod_1.toAbsoluteDay)(period.start);
26
- const end = (0, timePeriod_1.toAbsoluteDay)(period.end);
27
- if (start == null || end == null) {
28
- return [];
29
- }
30
- return [(0, jeSchedulesViewReducer_1.fetchJeSchedules)({ start, end }, true)];
31
- }
32
- function failureActions(accrualId, message, status) {
33
- return [
34
- (0, jeSchedulesViewReducer_1.oneTimeAccrualActionFailure)({
35
- accrualId,
36
- status: status ?? (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', message),
37
- }),
38
- (0, snackbarReducer_1.openSnackbar)({
39
- messageSection: 'save_schedule',
40
- messageText: 'failed',
41
- type: 'error',
42
- variables: [{ variableName: '_api-error_', variableValue: message }],
43
- }),
44
- ];
45
- }
46
- const promoteOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.promoteOneTimeAccrual.match), (0, operators_1.mergeMap)((action) => {
47
- const state = state$.value;
48
- const { accrualId, amount } = action.payload;
49
- const accrual = (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)((0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(accrualId), state.jeSchedulesState);
50
- if (accrual?.jeDebitAccountId == null ||
51
- accrual.jeCreditAccountId == null) {
52
- // Promote posts a journal entry, so it cannot proceed without both sides of it.
53
- return (0, rxjs_1.from)(failureActions(accrualId, 'This accrual is missing an expense or liability account.'));
54
- }
55
- // vendor_id, vendor_name and service_month are deliberately absent: promote takes them from
56
- // the stored draft and ignores them in the body, so sending them would imply a reassignment
57
- // that never happens.
58
- const payload = {
59
- amount,
60
- memo: accrual.memo,
61
- je_debit_account_id: accrual.jeDebitAccountId,
62
- je_credit_account_id: accrual.jeCreditAccountId,
63
- };
64
- return zeniAPI
65
- .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/${accrualId}`, { ...payload })
66
- .pipe((0, operators_1.mergeMap)((response) => {
67
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
68
- return (0, rxjs_1.from)([
69
- (0, jeSchedulesReducer_1.updateJEOneTimeAccruals)([response.data.accrual]),
70
- (0, jeSchedulesViewReducer_1.oneTimeAccrualActionSuccess)({ accrualId }),
71
- (0, snackbarReducer_1.openSnackbar)({
72
- messageSection: 'save_schedule',
73
- messageText: 'success',
74
- type: 'success',
75
- variables: [
76
- {
77
- variableName: '_vendor_name_',
78
- variableValue: accrual.vendorName,
79
- },
80
- ],
81
- }),
82
- ...refreshCurrentPage(state),
83
- ]);
84
- }
85
- return (0, rxjs_1.from)(failureActions(accrualId, response.status.message, response.status));
86
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)(failureActions(accrualId, `Promote accrual REST API call errored out ${JSON.stringify(error)}`))));
87
- }));
88
- exports.promoteOneTimeAccrualEpic = promoteOneTimeAccrualEpic;
89
- const ignoreOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.ignoreOneTimeAccrual.match), (0, operators_1.mergeMap)((action) => {
90
- const state = state$.value;
91
- const { accrualId, reason, note } = action.payload;
92
- // `scope` is deliberately never sent: the API returns 400 on it, which is why the design's
93
- // "Apply to" selector cannot be built yet.
94
- const payload = {
95
- reason,
96
- ...(note != null && note !== '' ? { note } : {}),
97
- };
98
- return zeniAPI
99
- .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/${accrualId}/ignore`, { ...payload })
100
- .pipe((0, operators_1.mergeMap)((response) => {
101
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
102
- return (0, rxjs_1.from)([
103
- (0, jeSchedulesReducer_1.updateJEOneTimeAccruals)([response.data.accrual]),
104
- (0, jeSchedulesViewReducer_1.oneTimeAccrualActionSuccess)({ accrualId }),
105
- (0, snackbarReducer_1.openSnackbar)({
106
- messageSection: 'ignore_accrual',
107
- messageText: 'success',
108
- type: 'success',
109
- }),
110
- ...refreshCurrentPage(state),
111
- ]);
112
- }
113
- return (0, rxjs_1.from)(failureActions(accrualId, response.status.message, response.status));
114
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)(failureActions(accrualId, `Ignore accrual REST API call errored out ${JSON.stringify(error)}`))));
115
- }));
116
- exports.ignoreOneTimeAccrualEpic = ignoreOneTimeAccrualEpic;
117
- const revertOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.revertOneTimeAccrual.match), (0, operators_1.mergeMap)((action) => {
118
- const state = state$.value;
119
- const { accrualId, reason, note } = action.payload;
120
- // Deletes the accrual's journal entry in QBO and soft-deletes the row. `scope` is never sent:
121
- // the endpoint 400s on it, exactly as ignore does.
122
- const payload = {
123
- reason,
124
- ...(note != null && note !== '' ? { note } : {}),
125
- };
126
- return zeniAPI
127
- .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/${accrualId}/revert`, { ...payload })
128
- .pipe((0, operators_1.mergeMap)((response) => {
129
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
130
- return (0, rxjs_1.from)([
131
- (0, jeSchedulesReducer_1.updateJEOneTimeAccruals)([response.data.accrual]),
132
- (0, jeSchedulesViewReducer_1.oneTimeAccrualActionSuccess)({ accrualId }),
133
- (0, snackbarReducer_1.openSnackbar)({
134
- messageSection: 'revert_accrual',
135
- messageText: 'success',
136
- type: 'success',
137
- }),
138
- ...refreshCurrentPage(state),
139
- ]);
140
- }
141
- return (0, rxjs_1.from)(failureActions(accrualId, response.status.message, response.status));
142
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)(failureActions(accrualId, `Revert accrual REST API call errored out ${JSON.stringify(error)}`))));
143
- }));
144
- exports.revertOneTimeAccrualEpic = revertOneTimeAccrualEpic;
145
- const oneTimeAccrualActionsEpic = (actions$, state$, zeniAPI) => (0, rxjs_1.merge)((0, exports.promoteOneTimeAccrualEpic)(actions$, state$, zeniAPI), (0, exports.ignoreOneTimeAccrualEpic)(actions$, state$, zeniAPI), (0, exports.revertOneTimeAccrualEpic)(actions$, state$, zeniAPI));
146
- exports.oneTimeAccrualActionsEpic = oneTimeAccrualActionsEpic;
@@ -1,64 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { updateJESchedules, updateJESchedulesDetails } from '../../../../entity/jeSchedules/jeSchedulesReducer';
3
- import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
- import { JEScheduleKey, JEScheduleTransactionKey } from '../../../../entity/jeSchedules/jeSchedulesTypes';
5
- import { RootState } from '../../../../reducer';
6
- import { ZeniAPI } from '../../../../zeniAPI';
7
- import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
8
- import { removeJeAccruedScheduleKey, removeJeScheduleTransactionKey, revertJeSchedule, revertJeScheduleFailure, revertJeScheduleSuccess } from '../../reducers/jeSchedulesViewReducer';
9
- export type ActionType = ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof openSnackbar> | ReturnType<typeof removeJeAccruedScheduleKey> | ReturnType<typeof removeJeScheduleTransactionKey> | ReturnType<typeof revertJeSchedule> | ReturnType<typeof revertJeScheduleFailure> | ReturnType<typeof revertJeScheduleSuccess> | ReturnType<typeof updateJESchedules> | ReturnType<typeof updateJESchedulesDetails>;
10
- /**
11
- * Undo a posted prepaid / fixed-asset / accrued schedule: deletes its posted QBO journal entry, then
12
- * soft-deletes the scheduled entries and the schedule itself.
13
- *
14
- * Two or more posted journal entries answer 409 and leave the schedule intact, so the failure is
15
- * surfaced rather than swallowed. Accrued has one extra rejection of its own — the endpoint refuses
16
- * once a bill has been linked, because the reversal is already on the books — and that arrives the
17
- * same way, as an error on the row.
18
- *
19
- * A one-time accrual is not this action: it is a Mongo row behind the accruals gateway, and goes
20
- * through revertOneTimeAccrual instead. So `accrued_expenses` here always means an accrued
21
- * *schedule*, which is what makes it a safe discriminator for the removal below.
22
- */
23
- export declare const revertJeScheduleEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
24
- payload: {
25
- messageSection: import("../../../..").SnackbarMessageSections;
26
- messageText: import("../../../..").SnackbarMessageSectionTexts;
27
- type: import("../../../..").SnackbarMessageType;
28
- showStatusIcon?: boolean;
29
- variables?: {
30
- variableName: string;
31
- variableValue: string;
32
- }[];
33
- };
34
- type: "snackbar/openSnackbar";
35
- } | {
36
- payload: {
37
- period: import("../../../..").MonthYearPeriod;
38
- refreshViewInBackground: boolean;
39
- tenantId: import("../../../..").ID;
40
- };
41
- type: "monthEndCloseChecksView/fetchMonthEndCloseChecks";
42
- } | {
43
- payload: {
44
- jeScheduleKey: `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_refund_${string}` | `${string}_bill_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`;
45
- selectedPeriod: import("../../../..").MonthYearPeriod;
46
- };
47
- type: "expenseAutomationJESchedulesView/removeJeScheduleTransactionKey";
48
- } | {
49
- payload: {
50
- jeAccruedScheduleKey: `${string}_${string}`;
51
- };
52
- type: "expenseAutomationJESchedulesView/removeJeAccruedScheduleKey";
53
- } | {
54
- payload: {
55
- jeScheduleTransactionKey: JEScheduleKey | JEScheduleTransactionKey;
56
- status: import("../../../../zeniAPIStatus").ZeniAPIStatus;
57
- };
58
- type: "expenseAutomationJESchedulesView/revertJeScheduleFailure";
59
- } | {
60
- payload: {
61
- jeScheduleTransactionKey: JEScheduleKey | JEScheduleTransactionKey;
62
- };
63
- type: "expenseAutomationJESchedulesView/revertJeScheduleSuccess";
64
- }>;
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.revertJeScheduleEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
7
- const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
- const responsePayload_1 = require("../../../../responsePayload");
9
- const monthEndCloseChecksViewReducer_1 = require("../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer");
10
- const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
11
- /**
12
- * Undo a posted prepaid / fixed-asset / accrued schedule: deletes its posted QBO journal entry, then
13
- * soft-deletes the scheduled entries and the schedule itself.
14
- *
15
- * Two or more posted journal entries answer 409 and leave the schedule intact, so the failure is
16
- * surfaced rather than swallowed. Accrued has one extra rejection of its own — the endpoint refuses
17
- * once a bill has been linked, because the reversal is already on the books — and that arrives the
18
- * same way, as an error on the row.
19
- *
20
- * A one-time accrual is not this action: it is a Mongo row behind the accruals gateway, and goes
21
- * through revertOneTimeAccrual instead. So `accrued_expenses` here always means an accrued
22
- * *schedule*, which is what makes it a safe discriminator for the removal below.
23
- */
24
- const revertJeScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.revertJeSchedule.match), (0, operators_1.mergeMap)((action) => {
25
- const state = state$.value;
26
- const { expenseAutomationViewState: { selectedPeriodByTenantId }, } = state;
27
- const { jeScheduleId, jeScheduleTransactionKey, reason, note, scheduleType } = action.payload;
28
- const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
29
- const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
30
- // Feedback nested under je_schedules[0], the same shape ignore takes -- the two endpoints were
31
- // made symmetric server-side. A flat {reason, note} body, which this epic used to send while
32
- // revert validated the whole body as feedback, now answers 400 "Request body must contain at
33
- // least one of je_schedules".
34
- //
35
- // Only the id and the feedback: the rest of the fat blob is read from Datastore, not the
36
- // request. The id is optional server-side but sent anyway, because it is validated against the
37
- // URL and so turns a mismatch into a 400 rather than a revert of the wrong schedule.
38
- // `action` is stamped server-side.
39
- const payload = {
40
- je_schedules: [
41
- {
42
- je_schedule_id: jeScheduleId,
43
- feedback: {
44
- reason,
45
- ...(note != null && note !== '' ? { note } : {}),
46
- },
47
- },
48
- ],
49
- };
50
- return zeniAPI
51
- .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/${jeScheduleId}/revert`, payload)
52
- .pipe((0, operators_1.mergeMap)((response) => {
53
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
54
- // Deliberately not written to the entity store. A reverted schedule is soft-deleted,
55
- // so the endpoint returns its flat entity json -- `vendor_id` as a bare field, no
56
- // nested `vendor` or `base_transaction` -- rather than the list DTO those mappers
57
- // expect. Feeding it to updateJESchedules threw inside doUpdateVendors on
58
- // `payload.vendor.vendor_id`, and because that happens mid-dispatch it killed the
59
- // rest of this array: the row kept spinning and no snackbar appeared. The row is
60
- // removed from the list below regardless, so there is nothing worth storing.
61
- return (0, rxjs_1.from)([
62
- (0, jeSchedulesViewReducer_1.revertJeScheduleSuccess)({ jeScheduleTransactionKey }),
63
- // Accrued keys live in their own per-tab map, so the transaction-key removal cannot
64
- // reach them -- a reverted accrued schedule would sit on the list until the next
65
- // fetch. The key carried here is a JEScheduleKey for that type.
66
- scheduleType === 'accrued_expenses'
67
- ? (0, jeSchedulesViewReducer_1.removeJeAccruedScheduleKey)(jeScheduleTransactionKey)
68
- : (0, jeSchedulesViewReducer_1.removeJeScheduleTransactionKey)(jeScheduleTransactionKey, selectedPeriod),
69
- (0, monthEndCloseChecksViewReducer_1.fetchMonthEndCloseChecks)({
70
- tenantId: currentTenant.tenantId,
71
- period: selectedPeriod,
72
- refreshViewInBackground: true,
73
- }),
74
- (0, snackbarReducer_1.openSnackbar)({
75
- messageSection: 'revert_schedule',
76
- messageText: 'success',
77
- type: 'success',
78
- }),
79
- ]);
80
- }
81
- return (0, rxjs_1.from)([
82
- (0, jeSchedulesViewReducer_1.revertJeScheduleFailure)({
83
- jeScheduleTransactionKey,
84
- status: response.status,
85
- }),
86
- (0, snackbarReducer_1.openSnackbar)({
87
- messageSection: 'revert_schedule',
88
- messageText: 'failed',
89
- type: 'error',
90
- variables: [
91
- {
92
- variableName: '_api-error_',
93
- variableValue: response.status.message,
94
- },
95
- ],
96
- }),
97
- ]);
98
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
99
- (0, jeSchedulesViewReducer_1.revertJeScheduleFailure)({
100
- jeScheduleTransactionKey,
101
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Revert schedule REST API call errored out ${JSON.stringify(error)}`),
102
- }),
103
- (0, snackbarReducer_1.openSnackbar)({
104
- messageSection: 'revert_schedule',
105
- messageText: 'failed',
106
- type: 'error',
107
- }),
108
- ])));
109
- }));
110
- exports.revertJeScheduleEpic = revertJeScheduleEpic;
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../reducer';
4
- import { fetchJeSchedulesPage, updateJESchedulesUIState } from '../../reducers/jeSchedulesViewReducer';
5
- export type ActionType = ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof updateJESchedulesUIState>;
6
- export declare const switchJESchedulesTabEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.switchJESchedulesTabEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
7
- const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
- const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
9
- const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.updateJESchedulesUIState.match), (0, operators_1.filter)((action) => action.payload.selectedPageTab != null), (0, operators_1.mergeMap)(() => {
10
- const state = state$.value;
11
- const { fetchState, refreshStatus } = state.expenseAutomationJESchedulesViewState;
12
- if (fetchState === 'In-Progress' ||
13
- refreshStatus.fetchState === 'In-Progress') {
14
- return rxjs_1.EMPTY;
15
- }
16
- const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
17
- const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
18
- const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod);
19
- const timePeriodStart = (0, timePeriod_1.toAbsoluteDay)(period.start);
20
- const timePeriodEnd = (0, timePeriod_1.toAbsoluteDay)(period.end);
21
- if (timePeriodStart == null || timePeriodEnd == null) {
22
- return rxjs_1.EMPTY;
23
- }
24
- return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, true));
25
- }));
26
- exports.switchJESchedulesTabEpic = switchJESchedulesTabEpic;
@@ -1,36 +0,0 @@
1
- import { Amount } from '../../../commonStateTypes/amount';
2
- import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
3
- import { ScheduleTransaction } from '../../../entity/transaction/stateTypes/scheduleTransaction';
4
- import { JESchedulePayload, SaveJESchedulePayload } from '../../scheduleView/scheduleDetailView/scheduleDetailPayload';
5
- import { NewJeDetailLocalData, NewScheduleLocalData, NewScheduleLocalDataFixedAssets } from '../types/jeSchedulesViewState';
6
- /**
7
- * Computes the month-by-month JE schedule breakdown for a brand-new schedule
8
- * (no linked transaction yet) — replicates createNewSchedulesHelper's math
9
- * (scheduleDetailLocalDataHelper.ts) exactly: lump-sum total split evenly
10
- * across months with the rounding remainder absorbed by the last month, and a
11
- * running balance that decrements each month and is forced to exactly 0 on
12
- * the last row.
13
- */
14
- export declare const computeNewScheduleJeDetails: (localData: NewScheduleLocalData | NewScheduleLocalDataFixedAssets, totalAmount: Amount, vendorName: string) => NewJeDetailLocalData[];
15
- export interface NewSchedulePayload {
16
- je_schedules: JESchedulePayload[];
17
- scheduled_journal_entries: SaveJESchedulePayload[];
18
- }
19
- export type PrepareNewSchedulePayloadFailureReason = 'missing_third_party_id' | 'missing_vendor';
20
- export type PrepareNewSchedulePayloadResult = {
21
- ok: true;
22
- payload: NewSchedulePayload;
23
- } | {
24
- ok: false;
25
- reason: PrepareNewSchedulePayloadFailureReason;
26
- };
27
- /**
28
- * Builds a savable schedule payload directly from a Base Transaction search
29
- * result and the New Schedule form's local data — bypassing the legacy
30
- * getJEScheduledTransactionByJEScheduleTransactionKey selector entirely,
31
- * since that selector throws unless the entity has already round-tripped
32
- * through a real GET /1.0/schedules/:id. A brand-new schedule has no such
33
- * history, so this reads only from data already in hand (the selected
34
- * transaction/line plus what the user filled into the form).
35
- */
36
- export declare const prepareNewSchedulePayload: (transaction: ScheduleTransaction, localData: NewScheduleLocalData | NewScheduleLocalDataFixedAssets, scheduleType: ScheduleTypes) => PrepareNewSchedulePayloadResult;