@zeniai/client-epic-state 5.2.7-betaRD1 → 5.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +22 -0
  2. package/lib/entity/invoicing/invoicingCommonPayload.js +51 -10
  3. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -1
  4. package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
  5. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -66
  6. package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -135
  7. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
  8. package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  9. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -11
  10. package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -38
  11. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -79
  12. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -24
  13. package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -88
  14. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  15. package/lib/entity/snackbar/snackbarTypes.js +0 -3
  16. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
  17. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  18. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
  19. package/lib/epic.d.ts +1 -9
  20. package/lib/epic.js +0 -16
  21. package/lib/esm/entity/invoicing/invoicingCommonPayload.js +51 -10
  22. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
  23. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -135
  24. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  25. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -36
  26. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -78
  27. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
  28. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  29. package/lib/esm/epic.js +0 -16
  30. package/lib/esm/index.js +8 -14
  31. package/lib/esm/view/accountList/accountListReducer.js +0 -1
  32. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  33. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +5 -41
  34. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  35. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +0 -55
  36. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -306
  37. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -294
  38. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
  39. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +2 -1
  40. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +2 -0
  41. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +10 -5
  42. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +27 -3
  43. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +7 -3
  44. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  45. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  46. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  47. package/lib/index.d.ts +12 -17
  48. package/lib/index.js +47 -91
  49. package/lib/view/accountList/accountListReducer.js +0 -1
  50. package/lib/view/accountList/accountListState.d.ts +1 -1
  51. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  52. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -3
  53. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -39
  54. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  55. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  56. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +3 -72
  57. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -58
  58. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +12 -91
  59. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -308
  60. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  61. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  62. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -36
  63. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +0 -34
  64. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -302
  65. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  66. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -82
  67. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  68. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  69. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +5 -0
  70. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +1 -0
  71. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +1 -0
  72. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +2 -0
  73. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +10 -5
  74. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +9 -1
  75. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +30 -4
  76. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +11 -4
  77. package/lib/view/invoicing/settingsView/settingsViewSelector.js +7 -3
  78. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  79. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  80. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +2 -4
  81. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  82. package/package.json +1 -1
  83. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
  84. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  85. package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
  86. package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
  87. package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  88. package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
  89. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -45
  90. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -81
  91. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
  92. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
  93. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -79
  94. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -139
  95. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -106
  96. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
  97. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
  98. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -1
  99. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -106
  100. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -25
  101. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -15
  102. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
  103. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
  104. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -18
  105. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -16
  106. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -1
  107. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -60
  108. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -12
  109. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -1
  110. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +0 -20
  111. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -49
  112. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +0 -8
  113. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -85
  114. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
  115. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -29
  116. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
  117. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
  118. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
  119. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -83
  120. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +0 -12
  121. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -146
  122. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +0 -64
  123. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -110
  124. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
  125. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
  126. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
  127. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
  128. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -42
  129. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -2
  130. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -21
  131. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -112
  132. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +0 -6
  133. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -29
  134. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +0 -6
  135. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -19
  136. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
  137. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
  138. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
  139. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
  140. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
  141. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
  142. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +0 -13
  143. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -20
  144. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +0 -11
  145. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -2
  146. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +0 -7
  147. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -64
  148. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +0 -12
  149. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -15
  150. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +0 -9
  151. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -2
@@ -1,18 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser } from '../../../../../entity/tenant/tenantReducer';
4
- import { createZeniAPIStatus, isSuccessStatus, } from '../../../../../responsePayload';
5
- import { updateTreasuryPromoIntroClosedByOutsideClick, updateTreasuryPromoIntroClosedByOutsideClickFailure, updateTreasuryPromoIntroClosedByOutsideClickSuccess, } from '../treasurySetupViewReducer';
6
- export const updateTreasuryPromoIntroClosedByOutsideClickEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateTreasuryPromoIntroClosedByOutsideClick.match), switchMap(() => {
7
- return zeniAPI
8
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/user/self`, { is_treasury_promo_intro_closed_by_outside_click: true })
9
- .pipe(mergeMap((response) => {
10
- if (isSuccessStatus(response)) {
11
- return of(updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser(), updateTreasuryPromoIntroClosedByOutsideClickSuccess());
12
- }
13
- else {
14
- return of(updateTreasuryPromoIntroClosedByOutsideClickFailure(response.status));
15
- }
16
- }), catchError((error) => of(updateTreasuryPromoIntroClosedByOutsideClickFailure(createZeniAPIStatus('Unexpected error', 'Update treasury promo intro closed by outside click REST API call errored out' +
17
- (error?.message ?? JSON.stringify(error)))))));
18
- }));
@@ -1,18 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { updateTreasuryPromoRemindMeLaterClickedForLoggedInUser } from '../../../../../entity/tenant/tenantReducer';
4
- import { createZeniAPIStatus, isSuccessStatus, } from '../../../../../responsePayload';
5
- import { updateTreasuryPromoRemindMeLaterClicked, updateTreasuryPromoRemindMeLaterClickedFailure, updateTreasuryPromoRemindMeLaterClickedSuccess, } from '../treasurySetupViewReducer';
6
- export const updateTreasuryPromoRemindMeLaterClickedEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateTreasuryPromoRemindMeLaterClicked.match), switchMap(() => {
7
- return zeniAPI
8
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/user/self`, { is_treasury_promo_video_remind_me_later_clicked: true })
9
- .pipe(mergeMap((response) => {
10
- if (isSuccessStatus(response)) {
11
- return of(updateTreasuryPromoRemindMeLaterClickedForLoggedInUser(), updateTreasuryPromoRemindMeLaterClickedSuccess());
12
- }
13
- else {
14
- return of(updateTreasuryPromoRemindMeLaterClickedFailure(response.status));
15
- }
16
- }), catchError((error) => of(updateTreasuryPromoRemindMeLaterClickedFailure(createZeniAPIStatus('Unexpected error', 'Update treasury promo remind me later REST API call errored out' +
17
- (error?.message ?? JSON.stringify(error)))))));
18
- }));
@@ -1,18 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { updateTreasuryVideoViewedForLoggedInUser } from '../../../../../entity/tenant/tenantReducer';
4
- import { createZeniAPIStatus, isSuccessStatus, } from '../../../../../responsePayload';
5
- import { updateTreasuryVideoViewed, updateTreasuryVideoViewedFailure, updateTreasuryVideoViewedSuccess, } from '../treasurySetupViewReducer';
6
- export const updateTreasuryVideoViewedEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateTreasuryVideoViewed.match), switchMap(() => {
7
- return zeniAPI
8
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/user/self`, { is_treasury_promo_video_played: true })
9
- .pipe(mergeMap((response) => {
10
- if (isSuccessStatus(response)) {
11
- return of(updateTreasuryVideoViewedForLoggedInUser(), updateTreasuryVideoViewedSuccess());
12
- }
13
- else {
14
- return of(updateTreasuryVideoViewedFailure(response.status));
15
- }
16
- }), catchError((error) => of(updateTreasuryVideoViewedFailure(createZeniAPIStatus('Unexpected error', 'Update treasury video viewed REST API call errored out' +
17
- (error?.message ?? JSON.stringify(error)))))));
18
- }));
@@ -1,16 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
4
- import { fetchZeniAccountsPromoCard, updateZeniAccountsPromoCard, updateZeniAccountsPromoCardFailure, } from './zeniAccountsPromoCardReducer';
5
- export const fetchZeniAccountsPromoCardEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(fetchZeniAccountsPromoCard.match), switchMap(() => zeniAPI
6
- .getJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/deposit-accounts/promo-card`)
7
- .pipe(mergeMap((response) => {
8
- if (isSuccessResponse(response)) {
9
- return of(updateZeniAccountsPromoCard(response.data) // eslint-disable-line @typescript-eslint/no-non-null-assertion
10
- );
11
- }
12
- else {
13
- return of(updateZeniAccountsPromoCardFailure(response.status));
14
- }
15
- }), catchError((error) => of(updateZeniAccountsPromoCardFailure(createZeniAPIStatus('Unexpected error', 'Zeni Accounts Promo Card REST API call errored out' +
16
- JSON.stringify(error))))))));
@@ -1,60 +0,0 @@
1
- import { createSlice } from '@reduxjs/toolkit';
2
- import { clearAll } from '../../rootActions';
3
- export const initialState = {
4
- fetchState: 'Not-Started',
5
- error: undefined,
6
- depositAccountId: undefined,
7
- maxInsuredAmount: 0,
8
- maxAnnualPercentageYield: 0,
9
- maxPossibleInterest: 0,
10
- maxCashBalanceAvailable: 0,
11
- isShowDepositAccountsPromo: false,
12
- hasValidState() {
13
- return this.fetchState == 'Completed';
14
- },
15
- };
16
- const zeniAccountsPromoCard = createSlice({
17
- name: 'zeniAccountsPromoCard',
18
- initialState,
19
- reducers: {
20
- fetchZeniAccountsPromoCard(draft) {
21
- draft.fetchState = 'In-Progress';
22
- draft.error = undefined;
23
- },
24
- updateZeniAccountsPromoCard(draft, action) {
25
- draft.fetchState = 'Completed';
26
- draft.error = undefined;
27
- const promoPayload = action.payload;
28
- draft.isShowDepositAccountsPromo =
29
- promoPayload.is_show_deposit_accounts_promo_card;
30
- draft.maxAnnualPercentageYield = promoPayload.max_apy;
31
- draft.maxPossibleInterest =
32
- promoPayload.max_possible_interest != null
33
- ? promoPayload.max_possible_interest
34
- : undefined;
35
- draft.maxCashBalanceAvailable =
36
- promoPayload.max_cash_balance_available != null
37
- ? promoPayload.max_cash_balance_available
38
- : undefined;
39
- draft.maxInsuredAmount = promoPayload.max_insured_amount;
40
- draft.depositAccountId =
41
- promoPayload.primary_deposit_account_id != null
42
- ? promoPayload.primary_deposit_account_id
43
- : undefined;
44
- },
45
- updateZeniAccountsPromoCardFailure(draft, action) {
46
- draft.fetchState = 'Error';
47
- draft.error = action.payload;
48
- },
49
- clearZeniAccountsPromoCard(draft) {
50
- Object.assign(draft, initialState);
51
- },
52
- },
53
- extraReducers: (builder) => {
54
- builder.addCase(clearAll, (draft) => {
55
- Object.assign(draft, initialState);
56
- });
57
- },
58
- });
59
- export const { fetchZeniAccountsPromoCard, updateZeniAccountsPromoCard, updateZeniAccountsPromoCardFailure, clearZeniAccountsPromoCard, } = zeniAccountsPromoCard.actions;
60
- export default zeniAccountsPromoCard.reducer;
@@ -1,12 +0,0 @@
1
- import { createSelector } from '@reduxjs/toolkit';
2
- export const getZeniAccountsPromoCard = createSelector((state) => state.zeniAccountsPromoCardState, (zeniAccountsPromoCardState) => ({
3
- isShowDepositAccountsPromo: zeniAccountsPromoCardState.isShowDepositAccountsPromo,
4
- maxAnnualPercentageYield: zeniAccountsPromoCardState.maxAnnualPercentageYield,
5
- maxPossibleInterest: zeniAccountsPromoCardState.maxPossibleInterest,
6
- maxCashBalanceAvailable: zeniAccountsPromoCardState.maxCashBalanceAvailable,
7
- maxInsuredAmount: zeniAccountsPromoCardState.maxInsuredAmount,
8
- depositAccountId: zeniAccountsPromoCardState.depositAccountId,
9
- reportId: 'zeni_accounts_promo_card',
10
- fetchState: zeniAccountsPromoCardState.fetchState,
11
- error: zeniAccountsPromoCardState.error,
12
- }));
@@ -1,20 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { updateJEOneTimeAccruals } from '../../../../entity/jeSchedules/jeSchedulesReducer';
4
- import { RootState } from '../../../../reducer';
5
- import { ZeniAPI } from '../../../../zeniAPI';
6
- import { fetchOneTimeAccrual, fetchOneTimeAccrualFailure, fetchOneTimeAccrualSuccess } from '../../reducers/jeSchedulesViewReducer';
7
- export type ActionType = ReturnType<typeof fetchOneTimeAccrual> | ReturnType<typeof fetchOneTimeAccrualFailure> | ReturnType<typeof fetchOneTimeAccrualSuccess> | ReturnType<typeof updateJEOneTimeAccruals>;
8
- /**
9
- * Read one accrual by id so its detail page can render from a URL alone.
10
- *
11
- * Every other row on this page arrives with the JE Schedules list, and the accrual detail page used
12
- * to render only from what that list had already put in the store -- so opening its URL directly, on
13
- * a refresh or a shared link, had nothing to render and showed not-found. This is the read that
14
- * makes the URL self-sufficient.
15
- *
16
- * The response is the same `{accrual}` envelope promote / ignore / revert return, and it goes through
17
- * the same `updateJEOneTimeAccruals`, so a page loaded cold holds exactly the entity a page reached
18
- * through the list holds.
19
- */
20
- export declare const fetchOneTimeAccrualEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchOneTimeAccrualEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
7
- const responsePayload_1 = require("../../../../responsePayload");
8
- const rootActions_1 = require("../../../../rootActions");
9
- const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
10
- /**
11
- * Read one accrual by id so its detail page can render from a URL alone.
12
- *
13
- * Every other row on this page arrives with the JE Schedules list, and the accrual detail page used
14
- * to render only from what that list had already put in the store -- so opening its URL directly, on
15
- * a refresh or a shared link, had nothing to render and showed not-found. This is the read that
16
- * makes the URL self-sufficient.
17
- *
18
- * The response is the same `{accrual}` envelope promote / ignore / revert return, and it goes through
19
- * the same `updateJEOneTimeAccruals`, so a page loaded cold holds exactly the entity a page reached
20
- * through the list holds.
21
- */
22
- const fetchOneTimeAccrualEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchOneTimeAccrual.match), (0, operators_1.mergeMap)((action) => {
23
- const { accrualId } = action.payload;
24
- return zeniAPI
25
- .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/${accrualId}`)
26
- .pipe((0, operators_1.mergeMap)((response) => {
27
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
28
- return (0, rxjs_1.from)([
29
- (0, jeSchedulesReducer_1.updateJEOneTimeAccruals)([response.data.accrual]),
30
- (0, jeSchedulesViewReducer_1.fetchOneTimeAccrualSuccess)({ accrualId }),
31
- ]);
32
- }
33
- // A deleted or ignored accrual answers 404 here, the same as an id that never existed.
34
- // Both end as an error state the page turns into not-found, rather than a spinner that
35
- // never resolves.
36
- return (0, rxjs_1.from)([
37
- (0, jeSchedulesViewReducer_1.fetchOneTimeAccrualFailure)({ accrualId, status: response.status }),
38
- ]);
39
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
40
- (0, jeSchedulesViewReducer_1.fetchOneTimeAccrualFailure)({
41
- accrualId,
42
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Fetch one-time accrual REST API call errored out ${JSON.stringify(error)}`),
43
- }),
44
- ])),
45
- // A tenant switch clears the store while this request is in flight. Without this the old
46
- // tenant's accrual is written back into the freshly cleared store.
47
- (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
48
- }));
49
- exports.fetchOneTimeAccrualEpic = fetchOneTimeAccrualEpic;
@@ -1,8 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { updateJEOneTimeAccruals } from '../../../../../entity/jeSchedules/jeSchedulesReducer';
3
- import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
4
- import { RootState } from '../../../../../reducer';
5
- import { ZeniAPI } from '../../../../../zeniAPI';
6
- import { createOneTimeAccrual, createOneTimeAccrualFailure, createOneTimeAccrualSuccess, fetchJeSchedules } from '../../../reducers/jeSchedulesViewReducer';
7
- export type ActionType = ReturnType<typeof createOneTimeAccrual> | ReturnType<typeof createOneTimeAccrualSuccess> | ReturnType<typeof createOneTimeAccrualFailure> | ReturnType<typeof updateJEOneTimeAccruals> | ReturnType<typeof fetchJeSchedules> | ReturnType<typeof openSnackbar>;
8
- export declare const createOneTimeAccrualEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
@@ -1,85 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createOneTimeAccrualEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const timePeriod_1 = require("../../../../../commonStateTypes/timePeriod");
7
- const jeSchedulesReducer_1 = require("../../../../../entity/jeSchedules/jeSchedulesReducer");
8
- const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
9
- const tenantSelector_1 = require("../../../../../entity/tenant/tenantSelector");
10
- const responsePayload_1 = require("../../../../../responsePayload");
11
- const jeSchedulesPayload_1 = require("../../../payload/jeSchedulesPayload");
12
- const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
13
- const createOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.createOneTimeAccrual.match), (0, operators_1.mergeMap)((action) => {
14
- const state = state$.value;
15
- const { localData } = action.payload;
16
- const payload = { ...(0, jeSchedulesPayload_1.prepareCreateOneTimeAccrualPayload)(state, localData) };
17
- // convertToPeriod destructures, so an unset period would throw here and take the epic
18
- // subscription down for the whole session — a missed refresh is the cheaper failure.
19
- const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[(0, tenantSelector_1.getCurrentTenant)(state).tenantId];
20
- const selectedPeriod = selectedMonthYear != null
21
- ? (0, timePeriod_1.convertToPeriod)(selectedMonthYear)
22
- : undefined;
23
- const periodStart = selectedPeriod != null
24
- ? (0, timePeriod_1.toAbsoluteDay)(selectedPeriod.start)
25
- : undefined;
26
- const periodEnd = selectedPeriod != null ? (0, timePeriod_1.toAbsoluteDay)(selectedPeriod.end) : undefined;
27
- return zeniAPI
28
- .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals`, payload)
29
- .pipe((0, operators_1.mergeMap)((response) => {
30
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
31
- const successActions = [
32
- (0, jeSchedulesReducer_1.updateJEOneTimeAccruals)([response.data.accrual]),
33
- (0, jeSchedulesViewReducer_1.createOneTimeAccrualSuccess)(),
34
- (0, snackbarReducer_1.openSnackbar)({
35
- messageSection: 'create_schedule',
36
- messageText: 'success',
37
- type: 'success',
38
- variables: [
39
- {
40
- variableName: '_vendor_name_',
41
- variableValue: localData.vendorName,
42
- },
43
- ],
44
- }),
45
- ];
46
- // The tab buckets (jeScheduleOneTimeAccrualKeysByPeriodAndTab) are rebuilt wholesale
47
- // per fetch, and the backend decides whether a freshly posted accrual belongs to
48
- // Review or Existing — so refetch rather than guess which bucket to insert into.
49
- if (periodStart != null && periodEnd != null) {
50
- successActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedules)({ start: periodStart, end: periodEnd }, true));
51
- }
52
- return (0, rxjs_1.from)(successActions);
53
- }
54
- return (0, rxjs_1.from)([
55
- (0, jeSchedulesViewReducer_1.createOneTimeAccrualFailure)({ status: response.status }),
56
- (0, snackbarReducer_1.openSnackbar)({
57
- messageSection: 'create_schedule',
58
- messageText: 'failed',
59
- type: 'error',
60
- variables: [
61
- {
62
- variableName: '_api-error_',
63
- variableValue: response.status.message,
64
- },
65
- ],
66
- }),
67
- ]);
68
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
69
- (0, snackbarReducer_1.openSnackbar)({
70
- messageSection: 'create_schedule',
71
- messageText: 'failed',
72
- type: 'error',
73
- variables: [
74
- {
75
- variableName: '_api-error_',
76
- variableValue: JSON.stringify(error),
77
- },
78
- ],
79
- }),
80
- (0, jeSchedulesViewReducer_1.createOneTimeAccrualFailure)({
81
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Create One Time Accrual REST API call errored out ${JSON.stringify(error)}`),
82
- }),
83
- ])));
84
- }));
85
- exports.createOneTimeAccrualEpic = createOneTimeAccrualEpic;
@@ -1,8 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../../reducer';
4
- import { fetchAccountList } from '../../../../accountList/accountListReducer';
5
- import { fetchClassList } from '../../../../classList/classListReducer';
6
- import { clearSearchTransactionsForNewSchedule, initializeNewSchedule, resetNewScheduleLocalData } from '../../../reducers/jeSchedulesViewReducer';
7
- export type ActionType = ReturnType<typeof clearSearchTransactionsForNewSchedule> | ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchClassList> | ReturnType<typeof initializeNewSchedule> | ReturnType<typeof resetNewScheduleLocalData>;
8
- export declare const initializeNewScheduleEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initializeNewScheduleEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const accountListReducer_1 = require("../../../../accountList/accountListReducer");
7
- const classListReducer_1 = require("../../../../classList/classListReducer");
8
- const scheduleListHelper_1 = require("../../../../scheduleView/scheduleListView/scheduleListHelper");
9
- const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
10
- const initializeNewScheduleEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.initializeNewSchedule.match), (0, operators_1.mergeMap)((action) => {
11
- const newScheduleActions = [];
12
- const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)();
13
- const { accountListState, classListState } = state$.value;
14
- if (accountListState.byReportId[accountType.accountListKey]?.fetchState ===
15
- 'Not-Started') {
16
- newScheduleActions.push((0, accountListReducer_1.fetchAccountList)(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
17
- }
18
- if (classListState.fetchState === 'Not-Started') {
19
- newScheduleActions.push((0, classListReducer_1.fetchClassList)());
20
- }
21
- // The account and class fetches above are idempotent (both guard on 'Not-Started'), so they
22
- // can run on every open. Clearing what the user entered cannot, so it is opt-in.
23
- if (action.payload.shouldResetEnteredData) {
24
- newScheduleActions.push((0, jeSchedulesViewReducer_1.resetNewScheduleLocalData)({ scheduleType: action.payload.scheduleType }));
25
- newScheduleActions.push((0, jeSchedulesViewReducer_1.clearSearchTransactionsForNewSchedule)());
26
- }
27
- return (0, rxjs_1.from)(newScheduleActions);
28
- }));
29
- exports.initializeNewScheduleEpic = initializeNewScheduleEpic;
@@ -1,45 +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 { RootState } from '../../../../../reducer';
5
- import { ZeniAPI } from '../../../../../zeniAPI';
6
- import { resetNewScheduleLocalData, saveNewSchedule, saveNewScheduleFailure, saveNewScheduleSuccess } from '../../../reducers/jeSchedulesViewReducer';
7
- export type ActionType = ReturnType<typeof saveNewSchedule> | ReturnType<typeof saveNewScheduleSuccess> | ReturnType<typeof saveNewScheduleFailure> | ReturnType<typeof updateJESchedules> | ReturnType<typeof updateJESchedulesDetails> | ReturnType<typeof resetNewScheduleLocalData> | ReturnType<typeof openSnackbar>;
8
- export declare const saveNewScheduleEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
9
- payload: {
10
- messageSection: import("../../../../..").SnackbarMessageSections;
11
- messageText: import("../../../../..").SnackbarMessageSectionTexts;
12
- type: import("../../../../..").SnackbarMessageType;
13
- showStatusIcon?: boolean;
14
- variables?: {
15
- variableName: string;
16
- variableValue: string;
17
- }[];
18
- };
19
- type: "snackbar/openSnackbar";
20
- } | {
21
- payload: {
22
- jeSchedulesTransactionsPayload: import("../../../../../entity/jeSchedules/jeSchedulesPayload").JEScheduledTransactionPayload[];
23
- };
24
- type: "jeSchedules/updateJESchedules";
25
- } | {
26
- payload: {
27
- jeSchedulesPayload: import("../../../../../entity/jeSchedules/jeSchedulesPayload").JEScheduledTransactionPayload[];
28
- scheduledJEntriesPayload: import("../../../../../entity/jeSchedules/jeSchedulesPayload").ScheduledJournalEntryPayload[] | undefined;
29
- updateType: import("../../../../..").UpdateType;
30
- };
31
- type: "jeSchedules/updateJESchedulesDetails";
32
- } | {
33
- payload: {
34
- scheduleType: "prepaid_expenses" | "fixed_assets";
35
- };
36
- type: "expenseAutomationJESchedulesView/resetNewScheduleLocalData";
37
- } | {
38
- payload: undefined;
39
- type: "expenseAutomationJESchedulesView/saveNewScheduleSuccess";
40
- } | {
41
- payload: {
42
- status: import("../../../../../zeniAPIStatus").ZeniAPIStatus;
43
- };
44
- type: "expenseAutomationJESchedulesView/saveNewScheduleFailure";
45
- }>;
@@ -1,114 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.saveNewScheduleEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const jeSchedulesReducer_1 = require("../../../../../entity/jeSchedules/jeSchedulesReducer");
7
- const jeSchedulesTypes_1 = require("../../../../../entity/jeSchedules/jeSchedulesTypes");
8
- const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
9
- const transactionSelector_1 = require("../../../../../entity/transaction/transactionSelector");
10
- const responsePayload_1 = require("../../../../../responsePayload");
11
- const newScheduleLocalDataHelper_1 = require("../../../helpers/newScheduleLocalDataHelper");
12
- const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
13
- const FAILURE_REASON_MESSAGES = {
14
- missing_third_party_id: 'This transaction is missing a QuickBooks reference and cannot be scheduled.',
15
- missing_vendor: 'Select a vendor before saving this schedule.',
16
- };
17
- const saveNewScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.saveNewSchedule.match), (0, operators_1.mergeMap)((action) => {
18
- const { scheduleType } = action.payload;
19
- const state = state$.value;
20
- const localData = state.expenseAutomationJESchedulesViewState.newSchedule
21
- .newScheduleState[scheduleType];
22
- const { selectedBaseTransactionId } = localData;
23
- const transaction = selectedBaseTransactionId != null
24
- ? (0, transactionSelector_1.getScheduleTransactionById)(state.transactionState, (0, jeSchedulesTypes_1.getJEScheduleTransactionKey)(selectedBaseTransactionId))
25
- : undefined;
26
- if (transaction == null) {
27
- return (0, rxjs_1.from)([
28
- (0, jeSchedulesViewReducer_1.saveNewScheduleFailure)({
29
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'No base transaction selected for this schedule.'),
30
- }),
31
- (0, snackbarReducer_1.openSnackbar)({
32
- messageSection: 'create_schedule',
33
- messageText: 'failed',
34
- type: 'error',
35
- variables: [
36
- {
37
- variableName: '_api-error_',
38
- variableValue: 'No base transaction selected.',
39
- },
40
- ],
41
- }),
42
- ]);
43
- }
44
- const result = (0, newScheduleLocalDataHelper_1.prepareNewSchedulePayload)(transaction, localData, scheduleType);
45
- if (!result.ok) {
46
- const message = FAILURE_REASON_MESSAGES[result.reason];
47
- return (0, rxjs_1.from)([
48
- (0, jeSchedulesViewReducer_1.saveNewScheduleFailure)({
49
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', message),
50
- }),
51
- (0, snackbarReducer_1.openSnackbar)({
52
- messageSection: 'create_schedule',
53
- messageText: 'failed',
54
- type: 'error',
55
- variables: [{ variableName: '_api-error_', variableValue: message }],
56
- }),
57
- ]);
58
- }
59
- const vendorName = localData.selectedVendor?.name ?? transaction.vendorName ?? '';
60
- const queryParam = {
61
- je_schedule_type: scheduleType,
62
- };
63
- const payload = { ...result.payload };
64
- return zeniAPI
65
- .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`, 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.updateJESchedules)(response.data.je_schedules),
70
- (0, jeSchedulesReducer_1.updateJESchedulesDetails)(response.data.je_schedules, response.data.scheduled_journal_entries),
71
- (0, jeSchedulesViewReducer_1.resetNewScheduleLocalData)({ scheduleType }),
72
- (0, jeSchedulesViewReducer_1.saveNewScheduleSuccess)(),
73
- (0, snackbarReducer_1.openSnackbar)({
74
- messageSection: 'create_schedule',
75
- messageText: 'success',
76
- type: 'success',
77
- variables: [
78
- { variableName: '_vendor_name_', variableValue: vendorName },
79
- ],
80
- }),
81
- ]);
82
- }
83
- return (0, rxjs_1.from)([
84
- (0, jeSchedulesViewReducer_1.saveNewScheduleFailure)({ status: response.status }),
85
- (0, snackbarReducer_1.openSnackbar)({
86
- messageSection: 'create_schedule',
87
- messageText: 'failed',
88
- type: 'error',
89
- variables: [
90
- {
91
- variableName: '_api-error_',
92
- variableValue: response.status.message,
93
- },
94
- ],
95
- }),
96
- ]);
97
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
98
- (0, snackbarReducer_1.openSnackbar)({
99
- messageSection: 'create_schedule',
100
- messageText: 'failed',
101
- type: 'error',
102
- variables: [
103
- {
104
- variableName: '_api-error_',
105
- variableValue: JSON.stringify(error),
106
- },
107
- ],
108
- }),
109
- (0, jeSchedulesViewReducer_1.saveNewScheduleFailure)({
110
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Save New Schedule REST API call errored out ${JSON.stringify(error)}`),
111
- }),
112
- ])));
113
- }));
114
- exports.saveNewScheduleEpic = saveNewScheduleEpic;
@@ -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;