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

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 (145) hide show
  1. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -1
  2. package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
  3. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -66
  4. package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -135
  5. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
  6. package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  7. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -11
  8. package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -38
  9. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -79
  10. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -24
  11. package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -88
  12. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  13. package/lib/entity/snackbar/snackbarTypes.js +0 -3
  14. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
  15. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  16. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
  17. package/lib/epic.d.ts +1 -9
  18. package/lib/epic.js +0 -16
  19. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
  20. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -135
  21. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  22. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -36
  23. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -78
  24. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
  25. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  26. package/lib/esm/epic.js +0 -16
  27. package/lib/esm/index.js +8 -14
  28. package/lib/esm/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +6 -2
  29. package/lib/esm/view/companyMonthEndReportView/companyMonthEndReportViewState.js +4 -0
  30. package/lib/esm/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +10 -6
  31. package/lib/esm/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +9 -5
  32. package/lib/esm/view/companyMonthEndReportView/monthEndTemplateData.js +32 -0
  33. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  34. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +5 -41
  35. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  36. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +0 -55
  37. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -306
  38. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -294
  39. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
  40. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  41. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  42. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  43. package/lib/index.d.ts +14 -18
  44. package/lib/index.js +47 -91
  45. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewPayload.d.ts +8 -0
  46. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +6 -2
  47. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +6 -2
  48. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.d.ts +2 -0
  49. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.js +4 -0
  50. package/lib/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +10 -6
  51. package/lib/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +9 -5
  52. package/lib/view/companyMonthEndReportView/monthEndTemplateData.d.ts +16 -0
  53. package/lib/view/companyMonthEndReportView/monthEndTemplateData.js +36 -0
  54. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  55. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -3
  56. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -39
  57. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  58. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  59. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +3 -72
  60. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -58
  61. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +12 -91
  62. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -308
  63. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  64. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  65. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -36
  66. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +0 -34
  67. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -302
  68. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  69. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -82
  70. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  71. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  72. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  73. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  74. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +2 -4
  75. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  76. package/package.json +1 -1
  77. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
  78. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  79. package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
  80. package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
  81. package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  82. package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
  83. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -45
  84. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -99
  85. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
  86. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
  87. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -79
  88. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -139
  89. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -106
  90. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
  91. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
  92. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -1
  93. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -106
  94. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -25
  95. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -15
  96. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
  97. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
  98. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -18
  99. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -16
  100. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -1
  101. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -60
  102. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -12
  103. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -1
  104. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +0 -20
  105. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -49
  106. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +0 -8
  107. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -103
  108. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
  109. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -29
  110. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
  111. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
  112. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
  113. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -83
  114. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +0 -12
  115. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -146
  116. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +0 -64
  117. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -110
  118. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
  119. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
  120. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
  121. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
  122. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -42
  123. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -2
  124. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -21
  125. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -112
  126. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +0 -6
  127. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -29
  128. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +0 -6
  129. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -19
  130. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
  131. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
  132. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
  133. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
  134. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
  135. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
  136. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +0 -13
  137. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -20
  138. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +0 -11
  139. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -2
  140. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +0 -7
  141. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -64
  142. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +0 -12
  143. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -15
  144. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +0 -9
  145. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -2
@@ -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;
@@ -1,145 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.prepareNewSchedulePayload = exports.computeNewScheduleJeDetails = void 0;
4
- const amount_1 = require("../../../commonStateTypes/amount");
5
- const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
6
- const formatZeniDateFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
7
- const timePeriod_2 = require("../../../commonStateTypes/timePeriod");
8
- const scheduleDetailLocalDataHelper_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper");
9
- const scheduleDetailPayload_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailPayload");
10
- const getNewScheduleMemo = (vendorName, schedulePostingDate, currentPeriod, totalPeriod, assetId) => {
11
- const addAsset = assetId != null && assetId !== '' ? ` - ${assetId}` : '';
12
- return `${vendorName} - ${schedulePostingDate.format(formatZeniDateFY_1.MONTH_YEAR_FORMAT)} (${currentPeriod} of ${totalPeriod})${addAsset}`;
13
- };
14
- /**
15
- * Computes the month-by-month JE schedule breakdown for a brand-new schedule
16
- * (no linked transaction yet) — replicates createNewSchedulesHelper's math
17
- * (scheduleDetailLocalDataHelper.ts) exactly: lump-sum total split evenly
18
- * across months with the rounding remainder absorbed by the last month, and a
19
- * running balance that decrements each month and is forced to exactly 0 on
20
- * the last row.
21
- */
22
- const computeNewScheduleJeDetails = (localData, totalAmount, vendorName) => {
23
- const period = localData.selectedMonths;
24
- const startingMonth = localData.selectedDate;
25
- if (startingMonth == null || period == null) {
26
- return [];
27
- }
28
- const assetId = 'assetId' in localData ? localData.assetId : undefined;
29
- const averageAmount = Math.abs(Math.round((totalAmount.amount / period) * 100) / 100);
30
- const lastMonthAmount = Math.abs(Math.round((Math.abs(totalAmount.amount) - averageAmount * (period - 1)) * 100) / 100);
31
- let runningBalance = Math.abs(totalAmount.amount);
32
- const negativeNumbers = totalAmount.amount < 0 || runningBalance < 0;
33
- const newJeDetails = [];
34
- for (let index = 0; index < period; index++) {
35
- if (runningBalance > averageAmount) {
36
- runningBalance = Math.round((runningBalance - averageAmount) * 100) / 100;
37
- }
38
- else {
39
- runningBalance = 0;
40
- }
41
- const amount = index === period - 1 ? lastMonthAmount : averageAmount;
42
- runningBalance = index === period - 1 ? 0 : runningBalance;
43
- const schedulePostingDate = startingMonth.add(index, 'month');
44
- const { postingDate, postingStatus } = (0, scheduleDetailLocalDataHelper_1.getPostingDateAndStatusForIndex)(schedulePostingDate.month(), schedulePostingDate.year(), localData.lastDayOfMonth === true
45
- ? undefined
46
- : localData.selectedDayOfMonth);
47
- newJeDetails.push({
48
- postingDate,
49
- amount: (0, amount_1.toAmount)(negativeNumbers ? -amount : amount, totalAmount.currencyCode, totalAmount.currencySymbol),
50
- runningBalance: (0, amount_1.toAmount)(negativeNumbers ? -runningBalance : runningBalance, totalAmount.currencyCode, totalAmount.currencySymbol),
51
- postingStatus,
52
- memo: getNewScheduleMemo(vendorName, schedulePostingDate, index + 1, period, assetId),
53
- jeLink: { type: 'unknown' },
54
- });
55
- }
56
- return newJeDetails;
57
- };
58
- exports.computeNewScheduleJeDetails = computeNewScheduleJeDetails;
59
- const mapNewJeDetailsToScheduledJournalEntryPayload = (jeScheduleDetails) => jeScheduleDetails.map((journalEntry) => ({
60
- status: {
61
- code: journalEntry.postingStatus,
62
- label: journalEntry.postingStatus,
63
- },
64
- transaction_memo: journalEntry.memo,
65
- third_party_id: journalEntry.jeLink.thirdPartyTransactionId ?? null,
66
- expected_post_date: journalEntry.postingDate.format(timePeriod_1.DEFAULT_DATE_FORMAT),
67
- amount: journalEntry.amount.amount,
68
- balance: journalEntry.runningBalance.amount,
69
- // Brand-new schedule — there is no prior scheduled-journal-entry history
70
- // to cross-reference (unlike the legacy edit flow's equivalent mapper).
71
- scheduled_journal_entry_id: null,
72
- actual_post_date: null,
73
- is_platform_generated: null,
74
- je_schedule_id: null,
75
- update_time: null,
76
- create_time: null,
77
- }));
78
- /**
79
- * Builds a savable schedule payload directly from a Base Transaction search
80
- * result and the New Schedule form's local data — bypassing the legacy
81
- * getJEScheduledTransactionByJEScheduleTransactionKey selector entirely,
82
- * since that selector throws unless the entity has already round-tripped
83
- * through a real GET /1.0/schedules/:id. A brand-new schedule has no such
84
- * history, so this reads only from data already in hand (the selected
85
- * transaction/line plus what the user filled into the form).
86
- */
87
- const prepareNewSchedulePayload = (transaction, localData, scheduleType) => {
88
- if (transaction.thirdPartyTransactionId == null ||
89
- transaction.thirdPartyTransactionId === '') {
90
- return { ok: false, reason: 'missing_third_party_id' };
91
- }
92
- const scheduleTransaction = transaction;
93
- const vendorId = localData.selectedVendor?.id ?? transaction.vendorId ?? '';
94
- const vendorName = localData.selectedVendor?.name ?? transaction.vendorName ?? '';
95
- if (vendorId === '' || vendorName === '') {
96
- return { ok: false, reason: 'missing_vendor' };
97
- }
98
- const vendor = {
99
- vendor_id: vendorId,
100
- vendor_name: vendorName,
101
- };
102
- const jeScheduleDetails = (0, exports.computeNewScheduleJeDetails)(localData, scheduleTransaction.amount, vendorName);
103
- const postingDate = localData.selectedDayOfMonth ??
104
- (localData.lastDayOfMonth === true ? timePeriod_2.LAST_SCHEDULE_DAY_OF_MONTH : null);
105
- const firstJEScheduleDate = jeScheduleDetails.length > 0
106
- ? jeScheduleDetails[0].postingDate.format(timePeriod_1.DEFAULT_DATE_FORMAT)
107
- : null;
108
- const lastJEScheduleDate = jeScheduleDetails.length > 0
109
- ? jeScheduleDetails[jeScheduleDetails.length - 1].postingDate.format(timePeriod_1.DEFAULT_DATE_FORMAT)
110
- : null;
111
- const isFixedAssets = scheduleType === 'fixed_assets';
112
- const assetId = 'assetId' in localData ? localData.assetId : undefined;
113
- const selectedAccumulatedDepreciationCategory = 'selectedAccumulatedDepreciationCategory' in localData
114
- ? localData.selectedAccumulatedDepreciationCategory
115
- : undefined;
116
- const status = { code: 'new', label: 'New' };
117
- const jeSchedulePayload = {
118
- status,
119
- vendor,
120
- currency_code: scheduleTransaction.currency.currencyCode,
121
- currency_symbol: scheduleTransaction.currency.currencySymbol,
122
- period: localData.selectedMonths ?? null,
123
- je_schedule_type: scheduleType,
124
- posting_date: postingDate,
125
- balance: scheduleTransaction.amount.amount,
126
- start_date: firstJEScheduleDate,
127
- end_date: lastJEScheduleDate,
128
- je_credit_accounting_class_id: scheduleTransaction.classBase?.classId ?? null,
129
- je_credit_account_id: isFixedAssets
130
- ? (selectedAccumulatedDepreciationCategory ?? null)
131
- : scheduleTransaction.account.accountId,
132
- je_debit_account_id: localData.selectedAccount ?? null,
133
- je_debit_accounting_class_id: localData.selectedClass ?? null,
134
- other_attributes: assetId != null ? { asset_id: assetId } : {},
135
- base_transaction: (0, scheduleDetailPayload_1.mapScheduleTransactionToBaseScheduleTransactionPayload)(scheduleTransaction),
136
- };
137
- return {
138
- ok: true,
139
- payload: {
140
- je_schedules: [jeSchedulePayload],
141
- scheduled_journal_entries: mapNewJeDetailsToScheduledJournalEntryPayload(jeScheduleDetails),
142
- },
143
- };
144
- };
145
- exports.prepareNewSchedulePayload = prepareNewSchedulePayload;
@@ -1,42 +0,0 @@
1
- import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
2
- import { NestedClassHierarchyForReport } from '../../../commonStateTypes/classesView/nestedClassID';
3
- import { FetchStateAndError } from '../../../commonStateTypes/common';
4
- import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
5
- import { AccountBase } from '../../../entity/account/accountState';
6
- import { ClassBase } from '../../../entity/class/classState';
7
- import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
8
- import { ScheduleTransaction } from '../../../entity/transaction/stateTypes/scheduleTransaction';
9
- import { NewScheduleLocalData, NewScheduleLocalDataFixedAssets } from '../types/jeSchedulesViewState';
10
- export interface NewScheduleSearchTransactionsView {
11
- searchTransactionsFetchState: FetchStateAndError;
12
- searchTransactionsResults: ScheduleTransaction[];
13
- searchTransactionsString?: string;
14
- }
15
- /**
16
- * Accounts and request status for both accrual creation forms — the one-time accrual and the
17
- * recurring accrued schedule. Deliberately not NewScheduleView: neither has a base transaction to
18
- * search, and both need a second account hierarchy (the accrued liability) that no schedule type
19
- * has. A one-time accrual additionally has no local-data slot in newScheduleState, since it is not
20
- * a schedule type at all.
21
- */
22
- export interface NewAccrualAccountsView {
23
- accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
24
- accruedAccountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
25
- accruedScheduleSaveStatus: FetchStateAndError;
26
- allAccountList: AccountBase[];
27
- allAccruedExpenseList: AccountBase[];
28
- allClassList: ClassBase[];
29
- classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
30
- createStatus: FetchStateAndError;
31
- }
32
- export interface NewScheduleView extends SelectorView, NewScheduleSearchTransactionsView {
33
- accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
34
- allAccountList: AccountBase[];
35
- allClassList: ClassBase[];
36
- classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
37
- newScheduleLocalData: NewScheduleLocalData | NewScheduleLocalDataFixedAssets;
38
- saveStatus: FetchStateAndError;
39
- scheduleType: ScheduleTypes;
40
- allDepreciationAccountList?: AccountBase[];
41
- allDepreciationAccountListNestedAccountHierarchy?: NestedAccountHierarchyForReport[];
42
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,21 +0,0 @@
1
- import { RootState } from '../../../reducer';
2
- import { NewAccrualAccountsView, NewScheduleSearchTransactionsView, NewScheduleView } from '../selectorTypes/jeNewScheduleViewSelectorTypes';
3
- /**
4
- * The Base Transaction search is shared across schedule types (one search
5
- * box, not one per prepaid_expenses/fixed_assets) — split out from
6
- * getNewScheduleView so a consumer can read it without supplying an
7
- * otherwise-irrelevant scheduleType.
8
- */
9
- export declare const getNewScheduleSearchTransactionsView: (state: RootState) => NewScheduleSearchTransactionsView;
10
- /**
11
- * Account + class options and request status shared by both accrual creation forms — the one-time
12
- * accrual and the recurring accrued schedule.
13
- *
14
- * getAccountsTypesForScheduleDetails('accrued_expenses') deliberately includes
15
- * other_current_liabilities, because the accrued liability accounts live there —
16
- * so the debit list has to subtract them back out, and the credit list keeps only
17
- * them. Mirrors getScheduleAccruedDetailView, which is the form this one is
18
- * modelled on.
19
- */
20
- export declare const getNewAccrualAccountsView: (state: RootState) => NewAccrualAccountsView;
21
- export declare const getNewScheduleView: (state: RootState, scheduleType: "fixed_assets" | "prepaid_expenses") => NewScheduleView;
@@ -1,112 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNewScheduleView = exports.getNewAccrualAccountsView = exports.getNewScheduleSearchTransactionsView = void 0;
4
- const accountSelector_1 = require("../../../entity/account/accountSelector");
5
- const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
6
- const accountListSelector_1 = require("../../accountList/accountListSelector");
7
- const classListSelector_1 = require("../../classList/classListSelector");
8
- const scheduleDetailLocalDataHelper_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper");
9
- const scheduleDetailSelector_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailSelector");
10
- const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
11
- /**
12
- * The Base Transaction search is shared across schedule types (one search
13
- * box, not one per prepaid_expenses/fixed_assets) — split out from
14
- * getNewScheduleView so a consumer can read it without supplying an
15
- * otherwise-irrelevant scheduleType.
16
- */
17
- const getNewScheduleSearchTransactionsView = (state) => {
18
- const { searchTransactions } = state.expenseAutomationJESchedulesViewState.newSchedule;
19
- const searchTransactionsResults = searchTransactions.searchResults
20
- .map((key) => (0, transactionSelector_1.getScheduleTransactionById)(state.transactionState, key))
21
- .filter((transaction) => transaction != null);
22
- return {
23
- searchTransactionsResults,
24
- searchTransactionsFetchState: {
25
- fetchState: searchTransactions.fetchState,
26
- error: searchTransactions.error,
27
- },
28
- searchTransactionsString: searchTransactions.searchString,
29
- };
30
- };
31
- exports.getNewScheduleSearchTransactionsView = getNewScheduleSearchTransactionsView;
32
- const ACCRUED_EXPENSE_ACCOUNT_LABELS = ['accrued_expenses'];
33
- /**
34
- * Account + class options and request status shared by both accrual creation forms — the one-time
35
- * accrual and the recurring accrued schedule.
36
- *
37
- * getAccountsTypesForScheduleDetails('accrued_expenses') deliberately includes
38
- * other_current_liabilities, because the accrued liability accounts live there —
39
- * so the debit list has to subtract them back out, and the credit list keeps only
40
- * them. Mirrors getScheduleAccruedDetailView, which is the form this one is
41
- * modelled on.
42
- */
43
- const getNewAccrualAccountsView = (state) => {
44
- const { accountState, accountListState, classState, classListState } = state;
45
- const { newSchedule } = state.expenseAutomationJESchedulesViewState;
46
- const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)();
47
- const accrualAccountIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, (0, scheduleDetailLocalDataHelper_1.getAccountsTypesForScheduleDetails)('accrued_expenses'));
48
- const accruedCategoryIds = (0, accountSelector_1.getAccountIdsForLabels)(accountState, ACCRUED_EXPENSE_ACCOUNT_LABELS);
49
- const allAccountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, accountType.accountListKey);
50
- const nestedAccountHierarchy = (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, accountType.accountListKey);
51
- const debitAccounts = allAccountList.accounts.filter((account) => accrualAccountIds.includes(account.accountId) &&
52
- !accruedCategoryIds.includes(account.accountId));
53
- const creditAccounts = allAccountList.accounts.filter((account) => accruedCategoryIds.includes(account.accountId));
54
- const allClassList = (0, classListSelector_1.getClassList)(classState, classListState);
55
- return {
56
- accountListNestedAccountHierarchy: (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)(nestedAccountHierarchy, debitAccounts.map((account) => account.accountId)),
57
- accruedAccountListNestedAccountHierarchy: (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)(nestedAccountHierarchy, creditAccounts.map((account) => account.accountId)),
58
- allAccountList: debitAccounts,
59
- allAccruedExpenseList: creditAccounts,
60
- allClassList: allClassList.classes,
61
- classListNestedAccountHierarchy: (0, classListSelector_1.getNestedClassListHierarchy)(classListState),
62
- createStatus: newSchedule.createOneTimeAccrualStatus,
63
- // The recurring accrued schedule saves through the accrued detail epics that the Vendor tab
64
- // already uses, so its status is that slice's updateStatus rather than anything new here.
65
- accruedScheduleSaveStatus: state.scheduleAccruedDetailState.updateStatus,
66
- };
67
- };
68
- exports.getNewAccrualAccountsView = getNewAccrualAccountsView;
69
- const getNewScheduleView = (state, scheduleType) => {
70
- const { accountState, accountListState, classState, classListState } = state;
71
- const { newSchedule } = state.expenseAutomationJESchedulesViewState;
72
- const searchTransactionsView = (0, exports.getNewScheduleSearchTransactionsView)(state);
73
- const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)();
74
- const newScheduleAccountTypes = (0, scheduleDetailLocalDataHelper_1.getAccountsTypesForScheduleDetails)(scheduleType);
75
- const newScheduleAccountIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, newScheduleAccountTypes);
76
- const allAccountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, accountType.accountListKey);
77
- const filteredAccounts = allAccountList.accounts.filter((account) => newScheduleAccountIds.includes(account.accountId));
78
- const accountListNestedAccountHierarchy = (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)((0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, accountType.accountListKey), filteredAccounts.map((account) => account.accountId));
79
- const allClassList = (0, classListSelector_1.getClassList)(classState, classListState);
80
- const classListNestedAccountHierarchy = (0, classListSelector_1.getNestedClassListHierarchy)(classListState);
81
- let allDepreciationAccountList;
82
- let allDepreciationAccountListNestedAccountHierarchy;
83
- if (scheduleType === 'fixed_assets') {
84
- const depreciationCategoryIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, [
85
- 'fixed_assets',
86
- 'other_assets',
87
- ]);
88
- const accountLabel = (0, scheduleListHelper_1.getAccountLabelForScheduleType)('fixed_assets');
89
- const fixedAssetLabelAccountIds = accountLabel != null
90
- ? (0, accountListSelector_1.getAccountIdsForLabel)(accountListState, accountType.accountListKey, accountLabel)
91
- : [];
92
- allDepreciationAccountList = allAccountList.accounts.filter((account) => depreciationCategoryIds.includes(account.accountId) &&
93
- !fixedAssetLabelAccountIds.includes(account.accountId));
94
- allDepreciationAccountListNestedAccountHierarchy =
95
- (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)((0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, accountType.accountListKey), allDepreciationAccountList.map((account) => account.accountId));
96
- }
97
- return {
98
- scheduleType,
99
- accountListNestedAccountHierarchy,
100
- allAccountList: filteredAccounts,
101
- allClassList: allClassList.classes,
102
- allDepreciationAccountList,
103
- allDepreciationAccountListNestedAccountHierarchy,
104
- classListNestedAccountHierarchy,
105
- newScheduleLocalData: newSchedule.newScheduleState[scheduleType],
106
- saveStatus: newSchedule.saveStatus,
107
- ...searchTransactionsView,
108
- fetchState: newSchedule.fetchState,
109
- error: newSchedule.error,
110
- };
111
- };
112
- exports.getNewScheduleView = getNewScheduleView;
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../reducer';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { InvoicingQboViewActionType } from './invoicingQboViewActionType';
6
- export declare const fetchInvoicingQboAccountsEpic: (actions$: ActionsObservable<InvoicingQboViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingQboViewActionType>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchInvoicingQboAccountsEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../responsePayload");
7
- const invoicingQboViewPayload_1 = require("../invoicingQboViewPayload");
8
- const invoicingQboViewReducer_1 = require("../invoicingQboViewReducer");
9
- const fetchInvoicingQboAccountsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.fetchInvoicingQboAccounts.match), (0, operators_1.mergeMap)((action) => {
10
- const { accountTypes } = action.payload;
11
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/accounts?account_types=${encodeURIComponent(accountTypes)}`;
12
- return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.map)((response) => {
13
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
14
- return (0, invoicingQboViewReducer_1.updateInvoicingQboAccounts)({
15
- accountTypes,
16
- accounts: (0, invoicingQboViewPayload_1.mapInvoicingQboAccountOptions)(response.data?.accounts ?? []),
17
- });
18
- }
19
- return (0, invoicingQboViewReducer_1.updateInvoicingQboAccountsFailure)({
20
- accountTypes,
21
- status: response.status,
22
- });
23
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, invoicingQboViewReducer_1.updateInvoicingQboAccountsFailure)({
24
- accountTypes,
25
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch QBO accounts REST API call errored out ' +
26
- JSON.stringify(error)),
27
- }))));
28
- }));
29
- exports.fetchInvoicingQboAccountsEpic = fetchInvoicingQboAccountsEpic;
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../reducer';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { InvoicingQboViewActionType } from './invoicingQboViewActionType';
6
- export declare const fetchInvoicingQboClassesEpic: (actions$: ActionsObservable<InvoicingQboViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingQboViewActionType>;