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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +27 -29
  2. package/lib/entity/invoicing/invoicingCommonPayload.js +37 -75
  3. package/lib/entity/invoicing/product/productPayload.d.ts +10 -0
  4. package/lib/entity/invoicing/product/productPayload.js +14 -2
  5. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -1
  6. package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
  7. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -66
  8. package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -135
  9. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
  10. package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  11. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -11
  12. package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -38
  13. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -79
  14. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -24
  15. package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -88
  16. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  17. package/lib/entity/snackbar/snackbarTypes.js +0 -3
  18. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
  19. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  20. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
  21. package/lib/epic.d.ts +2 -10
  22. package/lib/epic.js +10 -21
  23. package/lib/esm/entity/invoicing/invoicingCommonPayload.js +33 -73
  24. package/lib/esm/entity/invoicing/product/productPayload.js +14 -2
  25. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
  26. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -135
  27. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  28. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -36
  29. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -78
  30. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
  31. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  32. package/lib/esm/epic.js +6 -17
  33. package/lib/esm/index.js +13 -18
  34. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  35. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +5 -41
  36. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  37. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +0 -55
  38. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -306
  39. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -294
  40. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
  41. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +25 -9
  42. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
  43. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +40 -0
  44. package/lib/esm/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +27 -0
  45. package/lib/esm/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +19 -0
  46. package/lib/esm/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +19 -0
  47. package/lib/esm/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +39 -0
  48. package/lib/esm/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +25 -0
  49. package/lib/esm/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +48 -0
  50. package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +25 -1
  51. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +41 -0
  52. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  53. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  54. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  55. package/lib/index.d.ts +19 -22
  56. package/lib/index.js +59 -96
  57. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  58. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -3
  59. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -39
  60. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  61. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  62. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +3 -72
  63. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -58
  64. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +12 -91
  65. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -308
  66. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  67. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  68. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -36
  69. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +0 -34
  70. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -302
  71. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  72. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -82
  73. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  74. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +2 -2
  75. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +12 -1
  76. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +25 -9
  77. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
  78. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +10 -1
  79. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +43 -1
  80. package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.d.ts +6 -0
  81. package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +31 -0
  82. package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.d.ts +6 -0
  83. package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +23 -0
  84. package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.d.ts +6 -0
  85. package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +23 -0
  86. package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.d.ts +6 -0
  87. package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +43 -0
  88. package/lib/view/invoicing/settingsView/epics/settingsViewActionType.d.ts +5 -0
  89. package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.d.ts +11 -0
  90. package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +29 -0
  91. package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.d.ts +34 -0
  92. package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +53 -0
  93. package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +4 -1
  94. package/lib/view/invoicing/settingsView/settingsViewReducer.js +26 -2
  95. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +35 -0
  96. package/lib/view/invoicing/settingsView/settingsViewSelector.js +43 -1
  97. package/lib/view/invoicing/settingsView/settingsViewState.d.ts +8 -0
  98. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  99. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  100. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +2 -4
  101. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  102. package/package.json +1 -1
  103. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
  104. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  105. package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
  106. package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
  107. package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  108. package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
  109. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -45
  110. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -99
  111. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
  112. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
  113. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -79
  114. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -139
  115. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -106
  116. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
  117. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
  118. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -106
  119. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -25
  120. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -15
  121. package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +0 -92
  122. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
  123. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
  124. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -18
  125. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -16
  126. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -1
  127. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -60
  128. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -12
  129. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -1
  130. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +0 -20
  131. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -49
  132. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +0 -8
  133. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -103
  134. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
  135. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -29
  136. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
  137. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
  138. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
  139. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -83
  140. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +0 -12
  141. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -146
  142. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +0 -64
  143. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -110
  144. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
  145. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
  146. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
  147. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
  148. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -42
  149. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -21
  150. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -112
  151. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +0 -6
  152. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -29
  153. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +0 -6
  154. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -19
  155. package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +0 -12
  156. package/lib/view/invoicing/settingsView/settingsViewEpics.js +0 -99
  157. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
  158. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
  159. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
  160. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
  161. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
  162. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
  163. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +0 -13
  164. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -20
  165. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +0 -11
  166. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -2
  167. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +0 -7
  168. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -64
  169. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +0 -12
  170. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -15
  171. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +0 -9
  172. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -2
  173. /package/lib/esm/view/{expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js → invoicing/settingsView/epics/settingsViewActionType.js} +0 -0
  174. /package/lib/view/{expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js → invoicing/settingsView/epics/settingsViewActionType.js} +0 -0
@@ -1,92 +0,0 @@
1
- import { from, of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { updateAddresses } from '../../../entity/address/addressReducer';
4
- import { apiErrorSnackbarVariables } from '../../../entity/snackbar/snackbarApiError';
5
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
6
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
7
- import { connectInvoicingStripe, disconnectInvoicingStripe, fetchInvoicingSettings, invoicingStripeConnectionFailure, saveInvoicingSettings, saveInvoicingSettingsFailure, saveInvoicingSettingsSuccess, updateInvoicingSettings, updateInvoicingSettingsFailure, updateInvoicingStripeConnection, } from './settingsViewReducer';
8
- export const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingSettings.match), switchMap(() => {
9
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
10
- return zeniAPI.getJSON(apiUrl).pipe(switchMap((response) => {
11
- if (isSuccessResponse(response) && response.data != null) {
12
- const address = response.data.address;
13
- return [
14
- ...(address != null ? [updateAddresses([address])] : []),
15
- updateInvoicingSettings(response.data),
16
- ];
17
- }
18
- return of(updateInvoicingSettingsFailure(response.status));
19
- }), catchError((error) => of(updateInvoicingSettingsFailure(createZeniAPIStatus('Unexpected Error', 'Fetch settings REST API call errored out ' +
20
- JSON.stringify(error))))));
21
- }));
22
- export const connectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(connectInvoicingStripe.match), mergeMap((action) => {
23
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings/stripe-connect/setup`;
24
- const { api_key, publishable_key, webhook_secret } = action.payload;
25
- const body = {
26
- api_key,
27
- publishable_key,
28
- ...(webhook_secret != null && webhook_secret !== ''
29
- ? { webhook_secret }
30
- : {}),
31
- };
32
- return zeniAPI
33
- .postAndGetJSON(apiUrl, body)
34
- .pipe(switchMap((response) => {
35
- if (isSuccessResponse(response) && response.data != null) {
36
- return of(updateInvoicingStripeConnection({
37
- stripe_connected: response.data.stripe_connected,
38
- publishable_key: response.data.publishable_key,
39
- }), fetchInvoicingSettings());
40
- }
41
- return of(invoicingStripeConnectionFailure(response.status));
42
- }), catchError((error) => of(invoicingStripeConnectionFailure(createZeniAPIStatus('Unexpected Error', 'Stripe connect setup REST API call errored out ' +
43
- JSON.stringify(error))))));
44
- }));
45
- export const disconnectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(disconnectInvoicingStripe.match), mergeMap(() => {
46
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings/stripe-connect/callback`;
47
- return zeniAPI
48
- .deleteAndGetJSON(apiUrl)
49
- .pipe(switchMap((response) => {
50
- if (isSuccessResponse(response)) {
51
- return of(updateInvoicingStripeConnection({
52
- stripe_connected: false,
53
- publishable_key: '',
54
- }), fetchInvoicingSettings());
55
- }
56
- return of(invoicingStripeConnectionFailure(response.status));
57
- }), catchError((error) => of(invoicingStripeConnectionFailure(createZeniAPIStatus('Unexpected Error', 'Stripe disconnect REST API call errored out ' +
58
- JSON.stringify(error))))));
59
- }));
60
- export const saveInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(saveInvoicingSettings.match), mergeMap((action) => {
61
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
62
- const { settings, snackbarSection } = action.payload;
63
- /** `status` surfaces the platform's error text; omit it to keep the generic copy. */
64
- const snackbar = (messageText, status) => snackbarSection == null
65
- ? []
66
- : [
67
- openSnackbar({
68
- messageSection: snackbarSection,
69
- messageText,
70
- type: messageText === 'success' ? 'success' : 'error',
71
- variables: apiErrorSnackbarVariables(status),
72
- }),
73
- ];
74
- return zeniAPI
75
- .putAndGetJSON(apiUrl, { ...settings })
76
- .pipe(switchMap((response) => {
77
- if (isSuccessResponse(response) && response.data != null) {
78
- return from([
79
- saveInvoicingSettingsSuccess(response.data),
80
- ...snackbar('success'),
81
- ]);
82
- }
83
- return from([
84
- saveInvoicingSettingsFailure(response.status),
85
- ...snackbar('failed', response.status),
86
- ]);
87
- }), catchError((error) => from([
88
- saveInvoicingSettingsFailure(createZeniAPIStatus('Unexpected Error', 'Save settings REST API call errored out ' +
89
- JSON.stringify(error))),
90
- ...snackbar('failed'),
91
- ])));
92
- }));
@@ -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,103 +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
- /*
17
- * Idempotency for the create. agent-je dedupes on this: the same key again returns the
18
- * existing accrual rather than posting a second JE to QBO.
19
- *
20
- * Body `request_id` rather than the `Idempotency-Key` header the API doc prefers, on Mohit's
21
- * call (2026-08-24). The header cannot reach the service from a browser -- common's
22
- * Access-Control-Allow-Headers does not list it, so cross-origin preflight rejects the
23
- * request. Same meaning either way; the header simply wins when both are sent.
24
- *
25
- * Minted here, per create action, and deliberately not held in local data or the form: a new
26
- * Save must produce a new key, and only a retry of *this* request may reuse one. Nothing
27
- * retries today -- if a retry operator is ever added below, it has to sit inside this
28
- * mergeMap so the key is not re-minted, or the guarantee is silently lost.
29
- */
30
- const requestId = crypto.randomUUID();
31
- const payload = {
32
- ...(0, jeSchedulesPayload_1.prepareCreateOneTimeAccrualPayload)(state, localData),
33
- request_id: requestId,
34
- };
35
- // convertToPeriod destructures, so an unset period would throw here and take the epic
36
- // subscription down for the whole session — a missed refresh is the cheaper failure.
37
- const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[(0, tenantSelector_1.getCurrentTenant)(state).tenantId];
38
- const selectedPeriod = selectedMonthYear != null
39
- ? (0, timePeriod_1.convertToPeriod)(selectedMonthYear)
40
- : undefined;
41
- const periodStart = selectedPeriod != null
42
- ? (0, timePeriod_1.toAbsoluteDay)(selectedPeriod.start)
43
- : undefined;
44
- const periodEnd = selectedPeriod != null ? (0, timePeriod_1.toAbsoluteDay)(selectedPeriod.end) : undefined;
45
- return zeniAPI
46
- .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals`, payload)
47
- .pipe((0, operators_1.mergeMap)((response) => {
48
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
49
- const successActions = [
50
- (0, jeSchedulesReducer_1.updateJEOneTimeAccruals)([response.data.accrual]),
51
- (0, jeSchedulesViewReducer_1.createOneTimeAccrualSuccess)(),
52
- (0, snackbarReducer_1.openSnackbar)({
53
- messageSection: 'create_schedule',
54
- messageText: 'success',
55
- type: 'success',
56
- variables: [
57
- {
58
- variableName: '_vendor_name_',
59
- variableValue: localData.vendorName,
60
- },
61
- ],
62
- }),
63
- ];
64
- // The tab buckets (jeScheduleOneTimeAccrualKeysByPeriodAndTab) are rebuilt wholesale
65
- // per fetch, and the backend decides whether a freshly posted accrual belongs to
66
- // Review or Existing — so refetch rather than guess which bucket to insert into.
67
- if (periodStart != null && periodEnd != null) {
68
- successActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedules)({ start: periodStart, end: periodEnd }, true));
69
- }
70
- return (0, rxjs_1.from)(successActions);
71
- }
72
- return (0, rxjs_1.from)([
73
- (0, jeSchedulesViewReducer_1.createOneTimeAccrualFailure)({ status: response.status }),
74
- (0, snackbarReducer_1.openSnackbar)({
75
- messageSection: 'create_schedule',
76
- messageText: 'failed',
77
- type: 'error',
78
- variables: [
79
- {
80
- variableName: '_api-error_',
81
- variableValue: response.status.message,
82
- },
83
- ],
84
- }),
85
- ]);
86
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
87
- (0, snackbarReducer_1.openSnackbar)({
88
- messageSection: 'create_schedule',
89
- messageText: 'failed',
90
- type: 'error',
91
- variables: [
92
- {
93
- variableName: '_api-error_',
94
- variableValue: JSON.stringify(error),
95
- },
96
- ],
97
- }),
98
- (0, jeSchedulesViewReducer_1.createOneTimeAccrualFailure)({
99
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Create One Time Accrual REST API call errored out ${JSON.stringify(error)}`),
100
- }),
101
- ])));
102
- }));
103
- 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;