@zeniai/client-epic-state 5.2.10-betaRD1 → 5.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -1
- package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -66
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -135
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -30
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -11
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -38
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -79
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -24
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -88
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
- package/lib/epic.d.ts +1 -9
- package/lib/epic.js +0 -16
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -135
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -30
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -36
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -78
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/esm/epic.js +0 -16
- package/lib/esm/index.js +8 -14
- package/lib/esm/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +6 -2
- package/lib/esm/view/companyMonthEndReportView/companyMonthEndReportViewState.js +4 -0
- package/lib/esm/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +10 -6
- package/lib/esm/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +9 -5
- package/lib/esm/view/companyMonthEndReportView/monthEndTemplateData.js +32 -0
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +5 -41
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
- package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +0 -55
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -306
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -294
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
- package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
- package/lib/index.d.ts +14 -18
- package/lib/index.js +47 -91
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewPayload.d.ts +8 -0
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +6 -2
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +6 -2
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.d.ts +2 -0
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.js +4 -0
- package/lib/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +10 -6
- package/lib/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +9 -5
- package/lib/view/companyMonthEndReportView/monthEndTemplateData.d.ts +16 -0
- package/lib/view/companyMonthEndReportView/monthEndTemplateData.js +36 -0
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -39
- package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +3 -72
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -58
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +12 -91
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -308
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -36
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +0 -34
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -302
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -82
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +2 -4
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
- package/package.json +1 -1
- package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
- package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
- package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
- package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
- package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
- package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -45
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -99
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -79
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -139
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -106
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -1
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -106
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -25
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -15
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -18
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -16
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -1
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -60
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -12
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +0 -20
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -49
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -103
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -29
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -83
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +0 -12
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -146
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +0 -64
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -110
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -42
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -2
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -21
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -112
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +0 -6
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -29
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +0 -6
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -19
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +0 -13
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -20
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +0 -11
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -2
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +0 -7
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -64
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +0 -12
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -15
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +0 -9
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -2
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
6
|
-
import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
|
|
7
|
-
import { removeJeAccruedScheduleKey, removeJeScheduleTransactionKey, revertJeSchedule, revertJeScheduleFailure, revertJeScheduleSuccess, } from '../../reducers/jeSchedulesViewReducer';
|
|
8
|
-
/**
|
|
9
|
-
* Undo a posted prepaid / fixed-asset / accrued schedule: deletes its posted QBO journal entry, then
|
|
10
|
-
* soft-deletes the scheduled entries and the schedule itself.
|
|
11
|
-
*
|
|
12
|
-
* Two or more posted journal entries answer 409 and leave the schedule intact, so the failure is
|
|
13
|
-
* surfaced rather than swallowed. Accrued has one extra rejection of its own — the endpoint refuses
|
|
14
|
-
* once a bill has been linked, because the reversal is already on the books — and that arrives the
|
|
15
|
-
* same way, as an error on the row.
|
|
16
|
-
*
|
|
17
|
-
* A one-time accrual is not this action: it is a Mongo row behind the accruals gateway, and goes
|
|
18
|
-
* through revertOneTimeAccrual instead. So `accrued_expenses` here always means an accrued
|
|
19
|
-
* *schedule*, which is what makes it a safe discriminator for the removal below.
|
|
20
|
-
*/
|
|
21
|
-
export const revertJeScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(revertJeSchedule.match), mergeMap((action) => {
|
|
22
|
-
const state = state$.value;
|
|
23
|
-
const { expenseAutomationViewState: { selectedPeriodByTenantId }, } = state;
|
|
24
|
-
const { jeScheduleId, jeScheduleTransactionKey, reason, note, scheduleType } = action.payload;
|
|
25
|
-
const currentTenant = getCurrentTenant(state);
|
|
26
|
-
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
27
|
-
// Feedback nested under je_schedules[0], the same shape ignore takes -- the two endpoints were
|
|
28
|
-
// made symmetric server-side. A flat {reason, note} body, which this epic used to send while
|
|
29
|
-
// revert validated the whole body as feedback, now answers 400 "Request body must contain at
|
|
30
|
-
// least one of je_schedules".
|
|
31
|
-
//
|
|
32
|
-
// Only the id and the feedback: the rest of the fat blob is read from Datastore, not the
|
|
33
|
-
// request. The id is optional server-side but sent anyway, because it is validated against the
|
|
34
|
-
// URL and so turns a mismatch into a 400 rather than a revert of the wrong schedule.
|
|
35
|
-
// `action` is stamped server-side.
|
|
36
|
-
const payload = {
|
|
37
|
-
je_schedules: [
|
|
38
|
-
{
|
|
39
|
-
je_schedule_id: jeScheduleId,
|
|
40
|
-
feedback: {
|
|
41
|
-
reason,
|
|
42
|
-
...(note != null && note !== '' ? { note } : {}),
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
};
|
|
47
|
-
return zeniAPI
|
|
48
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/${jeScheduleId}/revert`, payload)
|
|
49
|
-
.pipe(mergeMap((response) => {
|
|
50
|
-
if (isSuccessResponse(response) && response.data != null) {
|
|
51
|
-
// Deliberately not written to the entity store. A reverted schedule is soft-deleted,
|
|
52
|
-
// so the endpoint returns its flat entity json -- `vendor_id` as a bare field, no
|
|
53
|
-
// nested `vendor` or `base_transaction` -- rather than the list DTO those mappers
|
|
54
|
-
// expect. Feeding it to updateJESchedules threw inside doUpdateVendors on
|
|
55
|
-
// `payload.vendor.vendor_id`, and because that happens mid-dispatch it killed the
|
|
56
|
-
// rest of this array: the row kept spinning and no snackbar appeared. The row is
|
|
57
|
-
// removed from the list below regardless, so there is nothing worth storing.
|
|
58
|
-
return from([
|
|
59
|
-
revertJeScheduleSuccess({ jeScheduleTransactionKey }),
|
|
60
|
-
// Accrued keys live in their own per-tab map, so the transaction-key removal cannot
|
|
61
|
-
// reach them -- a reverted accrued schedule would sit on the list until the next
|
|
62
|
-
// fetch. The key carried here is a JEScheduleKey for that type.
|
|
63
|
-
scheduleType === 'accrued_expenses'
|
|
64
|
-
? removeJeAccruedScheduleKey(jeScheduleTransactionKey)
|
|
65
|
-
: removeJeScheduleTransactionKey(jeScheduleTransactionKey, selectedPeriod),
|
|
66
|
-
fetchMonthEndCloseChecks({
|
|
67
|
-
tenantId: currentTenant.tenantId,
|
|
68
|
-
period: selectedPeriod,
|
|
69
|
-
refreshViewInBackground: true,
|
|
70
|
-
}),
|
|
71
|
-
openSnackbar({
|
|
72
|
-
messageSection: 'revert_schedule',
|
|
73
|
-
messageText: 'success',
|
|
74
|
-
type: 'success',
|
|
75
|
-
}),
|
|
76
|
-
]);
|
|
77
|
-
}
|
|
78
|
-
return from([
|
|
79
|
-
revertJeScheduleFailure({
|
|
80
|
-
jeScheduleTransactionKey,
|
|
81
|
-
status: response.status,
|
|
82
|
-
}),
|
|
83
|
-
openSnackbar({
|
|
84
|
-
messageSection: 'revert_schedule',
|
|
85
|
-
messageText: 'failed',
|
|
86
|
-
type: 'error',
|
|
87
|
-
variables: [
|
|
88
|
-
{
|
|
89
|
-
variableName: '_api-error_',
|
|
90
|
-
variableValue: response.status.message,
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
}),
|
|
94
|
-
]);
|
|
95
|
-
}), catchError((error) => from([
|
|
96
|
-
revertJeScheduleFailure({
|
|
97
|
-
jeScheduleTransactionKey,
|
|
98
|
-
status: createZeniAPIStatus('Unexpected Error', `Revert schedule REST API call errored out ${JSON.stringify(error)}`),
|
|
99
|
-
}),
|
|
100
|
-
openSnackbar({
|
|
101
|
-
messageSection: 'revert_schedule',
|
|
102
|
-
messageText: 'failed',
|
|
103
|
-
type: 'error',
|
|
104
|
-
}),
|
|
105
|
-
])));
|
|
106
|
-
}));
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { EMPTY, of } from 'rxjs';
|
|
2
|
-
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { convertToPeriod, toAbsoluteDay, } from '../../../../commonStateTypes/timePeriod';
|
|
4
|
-
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
|
-
import { fetchJeSchedulesPage, updateJESchedulesUIState, } from '../../reducers/jeSchedulesViewReducer';
|
|
6
|
-
export const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe(filter(updateJESchedulesUIState.match), filter((action) => action.payload.selectedPageTab != null), mergeMap(() => {
|
|
7
|
-
const state = state$.value;
|
|
8
|
-
const { fetchState, refreshStatus } = state.expenseAutomationJESchedulesViewState;
|
|
9
|
-
if (fetchState === 'In-Progress' ||
|
|
10
|
-
refreshStatus.fetchState === 'In-Progress') {
|
|
11
|
-
return EMPTY;
|
|
12
|
-
}
|
|
13
|
-
const currentTenant = getCurrentTenant(state);
|
|
14
|
-
const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
|
|
15
|
-
const period = convertToPeriod(selectedPeriod);
|
|
16
|
-
const timePeriodStart = toAbsoluteDay(period.start);
|
|
17
|
-
const timePeriodEnd = toAbsoluteDay(period.end);
|
|
18
|
-
if (timePeriodStart == null || timePeriodEnd == null) {
|
|
19
|
-
return EMPTY;
|
|
20
|
-
}
|
|
21
|
-
return of(fetchJeSchedulesPage({ start: timePeriodStart, end: timePeriodEnd }, true));
|
|
22
|
-
}));
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { toAmount } from '../../../commonStateTypes/amount';
|
|
2
|
-
import { DEFAULT_DATE_FORMAT } from '../../../commonStateTypes/timePeriod';
|
|
3
|
-
import { MONTH_YEAR_FORMAT } from '../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
|
|
4
|
-
import { LAST_SCHEDULE_DAY_OF_MONTH } from '../../../commonStateTypes/timePeriod';
|
|
5
|
-
import { getPostingDateAndStatusForIndex } from '../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper';
|
|
6
|
-
import { mapScheduleTransactionToBaseScheduleTransactionPayload, } from '../../scheduleView/scheduleDetailView/scheduleDetailPayload';
|
|
7
|
-
const getNewScheduleMemo = (vendorName, schedulePostingDate, currentPeriod, totalPeriod, assetId) => {
|
|
8
|
-
const addAsset = assetId != null && assetId !== '' ? ` - ${assetId}` : '';
|
|
9
|
-
return `${vendorName} - ${schedulePostingDate.format(MONTH_YEAR_FORMAT)} (${currentPeriod} of ${totalPeriod})${addAsset}`;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Computes the month-by-month JE schedule breakdown for a brand-new schedule
|
|
13
|
-
* (no linked transaction yet) — replicates createNewSchedulesHelper's math
|
|
14
|
-
* (scheduleDetailLocalDataHelper.ts) exactly: lump-sum total split evenly
|
|
15
|
-
* across months with the rounding remainder absorbed by the last month, and a
|
|
16
|
-
* running balance that decrements each month and is forced to exactly 0 on
|
|
17
|
-
* the last row.
|
|
18
|
-
*/
|
|
19
|
-
export const computeNewScheduleJeDetails = (localData, totalAmount, vendorName) => {
|
|
20
|
-
const period = localData.selectedMonths;
|
|
21
|
-
const startingMonth = localData.selectedDate;
|
|
22
|
-
if (startingMonth == null || period == null) {
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
const assetId = 'assetId' in localData ? localData.assetId : undefined;
|
|
26
|
-
const averageAmount = Math.abs(Math.round((totalAmount.amount / period) * 100) / 100);
|
|
27
|
-
const lastMonthAmount = Math.abs(Math.round((Math.abs(totalAmount.amount) - averageAmount * (period - 1)) * 100) / 100);
|
|
28
|
-
let runningBalance = Math.abs(totalAmount.amount);
|
|
29
|
-
const negativeNumbers = totalAmount.amount < 0 || runningBalance < 0;
|
|
30
|
-
const newJeDetails = [];
|
|
31
|
-
for (let index = 0; index < period; index++) {
|
|
32
|
-
if (runningBalance > averageAmount) {
|
|
33
|
-
runningBalance = Math.round((runningBalance - averageAmount) * 100) / 100;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
runningBalance = 0;
|
|
37
|
-
}
|
|
38
|
-
const amount = index === period - 1 ? lastMonthAmount : averageAmount;
|
|
39
|
-
runningBalance = index === period - 1 ? 0 : runningBalance;
|
|
40
|
-
const schedulePostingDate = startingMonth.add(index, 'month');
|
|
41
|
-
const { postingDate, postingStatus } = getPostingDateAndStatusForIndex(schedulePostingDate.month(), schedulePostingDate.year(), localData.lastDayOfMonth === true
|
|
42
|
-
? undefined
|
|
43
|
-
: localData.selectedDayOfMonth);
|
|
44
|
-
newJeDetails.push({
|
|
45
|
-
postingDate,
|
|
46
|
-
amount: toAmount(negativeNumbers ? -amount : amount, totalAmount.currencyCode, totalAmount.currencySymbol),
|
|
47
|
-
runningBalance: toAmount(negativeNumbers ? -runningBalance : runningBalance, totalAmount.currencyCode, totalAmount.currencySymbol),
|
|
48
|
-
postingStatus,
|
|
49
|
-
memo: getNewScheduleMemo(vendorName, schedulePostingDate, index + 1, period, assetId),
|
|
50
|
-
jeLink: { type: 'unknown' },
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return newJeDetails;
|
|
54
|
-
};
|
|
55
|
-
const mapNewJeDetailsToScheduledJournalEntryPayload = (jeScheduleDetails) => jeScheduleDetails.map((journalEntry) => ({
|
|
56
|
-
status: {
|
|
57
|
-
code: journalEntry.postingStatus,
|
|
58
|
-
label: journalEntry.postingStatus,
|
|
59
|
-
},
|
|
60
|
-
transaction_memo: journalEntry.memo,
|
|
61
|
-
third_party_id: journalEntry.jeLink.thirdPartyTransactionId ?? null,
|
|
62
|
-
expected_post_date: journalEntry.postingDate.format(DEFAULT_DATE_FORMAT),
|
|
63
|
-
amount: journalEntry.amount.amount,
|
|
64
|
-
balance: journalEntry.runningBalance.amount,
|
|
65
|
-
// Brand-new schedule — there is no prior scheduled-journal-entry history
|
|
66
|
-
// to cross-reference (unlike the legacy edit flow's equivalent mapper).
|
|
67
|
-
scheduled_journal_entry_id: null,
|
|
68
|
-
actual_post_date: null,
|
|
69
|
-
is_platform_generated: null,
|
|
70
|
-
je_schedule_id: null,
|
|
71
|
-
update_time: null,
|
|
72
|
-
create_time: null,
|
|
73
|
-
}));
|
|
74
|
-
/**
|
|
75
|
-
* Builds a savable schedule payload directly from a Base Transaction search
|
|
76
|
-
* result and the New Schedule form's local data — bypassing the legacy
|
|
77
|
-
* getJEScheduledTransactionByJEScheduleTransactionKey selector entirely,
|
|
78
|
-
* since that selector throws unless the entity has already round-tripped
|
|
79
|
-
* through a real GET /1.0/schedules/:id. A brand-new schedule has no such
|
|
80
|
-
* history, so this reads only from data already in hand (the selected
|
|
81
|
-
* transaction/line plus what the user filled into the form).
|
|
82
|
-
*/
|
|
83
|
-
export const prepareNewSchedulePayload = (transaction, localData, scheduleType) => {
|
|
84
|
-
if (transaction.thirdPartyTransactionId == null ||
|
|
85
|
-
transaction.thirdPartyTransactionId === '') {
|
|
86
|
-
return { ok: false, reason: 'missing_third_party_id' };
|
|
87
|
-
}
|
|
88
|
-
const scheduleTransaction = transaction;
|
|
89
|
-
const vendorId = localData.selectedVendor?.id ?? transaction.vendorId ?? '';
|
|
90
|
-
const vendorName = localData.selectedVendor?.name ?? transaction.vendorName ?? '';
|
|
91
|
-
if (vendorId === '' || vendorName === '') {
|
|
92
|
-
return { ok: false, reason: 'missing_vendor' };
|
|
93
|
-
}
|
|
94
|
-
const vendor = {
|
|
95
|
-
vendor_id: vendorId,
|
|
96
|
-
vendor_name: vendorName,
|
|
97
|
-
};
|
|
98
|
-
const jeScheduleDetails = computeNewScheduleJeDetails(localData, scheduleTransaction.amount, vendorName);
|
|
99
|
-
const postingDate = localData.selectedDayOfMonth ??
|
|
100
|
-
(localData.lastDayOfMonth === true ? LAST_SCHEDULE_DAY_OF_MONTH : null);
|
|
101
|
-
const firstJEScheduleDate = jeScheduleDetails.length > 0
|
|
102
|
-
? jeScheduleDetails[0].postingDate.format(DEFAULT_DATE_FORMAT)
|
|
103
|
-
: null;
|
|
104
|
-
const lastJEScheduleDate = jeScheduleDetails.length > 0
|
|
105
|
-
? jeScheduleDetails[jeScheduleDetails.length - 1].postingDate.format(DEFAULT_DATE_FORMAT)
|
|
106
|
-
: null;
|
|
107
|
-
const isFixedAssets = scheduleType === 'fixed_assets';
|
|
108
|
-
const assetId = 'assetId' in localData ? localData.assetId : undefined;
|
|
109
|
-
const selectedAccumulatedDepreciationCategory = 'selectedAccumulatedDepreciationCategory' in localData
|
|
110
|
-
? localData.selectedAccumulatedDepreciationCategory
|
|
111
|
-
: undefined;
|
|
112
|
-
const status = { code: 'new', label: 'New' };
|
|
113
|
-
const jeSchedulePayload = {
|
|
114
|
-
status,
|
|
115
|
-
vendor,
|
|
116
|
-
currency_code: scheduleTransaction.currency.currencyCode,
|
|
117
|
-
currency_symbol: scheduleTransaction.currency.currencySymbol,
|
|
118
|
-
period: localData.selectedMonths ?? null,
|
|
119
|
-
je_schedule_type: scheduleType,
|
|
120
|
-
posting_date: postingDate,
|
|
121
|
-
balance: scheduleTransaction.amount.amount,
|
|
122
|
-
start_date: firstJEScheduleDate,
|
|
123
|
-
end_date: lastJEScheduleDate,
|
|
124
|
-
je_credit_accounting_class_id: scheduleTransaction.classBase?.classId ?? null,
|
|
125
|
-
je_credit_account_id: isFixedAssets
|
|
126
|
-
? (selectedAccumulatedDepreciationCategory ?? null)
|
|
127
|
-
: scheduleTransaction.account.accountId,
|
|
128
|
-
je_debit_account_id: localData.selectedAccount ?? null,
|
|
129
|
-
je_debit_accounting_class_id: localData.selectedClass ?? null,
|
|
130
|
-
other_attributes: assetId != null ? { asset_id: assetId } : {},
|
|
131
|
-
base_transaction: mapScheduleTransactionToBaseScheduleTransactionPayload(scheduleTransaction),
|
|
132
|
-
};
|
|
133
|
-
return {
|
|
134
|
-
ok: true,
|
|
135
|
-
payload: {
|
|
136
|
-
je_schedules: [jeSchedulePayload],
|
|
137
|
-
scheduled_journal_entries: mapNewJeDetailsToScheduledJournalEntryPayload(jeScheduleDetails),
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { getAccountIdsForLabels, getAccountIdsForTypes, } from '../../../entity/account/accountSelector';
|
|
2
|
-
import { getScheduleTransactionById } from '../../../entity/transaction/transactionSelector';
|
|
3
|
-
import { getAccountIdsForLabel, getAccountList, getNestedAccountListHierarchy, } from '../../accountList/accountListSelector';
|
|
4
|
-
import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
|
|
5
|
-
import { getAccountsTypesForScheduleDetails } from '../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper';
|
|
6
|
-
import { filterNestedAccountHierarchyById } from '../../scheduleView/scheduleDetailView/scheduleDetailSelector';
|
|
7
|
-
import { getAccountLabelForScheduleType, getAccountsTypesForScheduleEpics, } from '../../scheduleView/scheduleListView/scheduleListHelper';
|
|
8
|
-
/**
|
|
9
|
-
* The Base Transaction search is shared across schedule types (one search
|
|
10
|
-
* box, not one per prepaid_expenses/fixed_assets) — split out from
|
|
11
|
-
* getNewScheduleView so a consumer can read it without supplying an
|
|
12
|
-
* otherwise-irrelevant scheduleType.
|
|
13
|
-
*/
|
|
14
|
-
export const getNewScheduleSearchTransactionsView = (state) => {
|
|
15
|
-
const { searchTransactions } = state.expenseAutomationJESchedulesViewState.newSchedule;
|
|
16
|
-
const searchTransactionsResults = searchTransactions.searchResults
|
|
17
|
-
.map((key) => getScheduleTransactionById(state.transactionState, key))
|
|
18
|
-
.filter((transaction) => transaction != null);
|
|
19
|
-
return {
|
|
20
|
-
searchTransactionsResults,
|
|
21
|
-
searchTransactionsFetchState: {
|
|
22
|
-
fetchState: searchTransactions.fetchState,
|
|
23
|
-
error: searchTransactions.error,
|
|
24
|
-
},
|
|
25
|
-
searchTransactionsString: searchTransactions.searchString,
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
const ACCRUED_EXPENSE_ACCOUNT_LABELS = ['accrued_expenses'];
|
|
29
|
-
/**
|
|
30
|
-
* Account + class options and request status shared by both accrual creation forms — the one-time
|
|
31
|
-
* accrual and the recurring accrued schedule.
|
|
32
|
-
*
|
|
33
|
-
* getAccountsTypesForScheduleDetails('accrued_expenses') deliberately includes
|
|
34
|
-
* other_current_liabilities, because the accrued liability accounts live there —
|
|
35
|
-
* so the debit list has to subtract them back out, and the credit list keeps only
|
|
36
|
-
* them. Mirrors getScheduleAccruedDetailView, which is the form this one is
|
|
37
|
-
* modelled on.
|
|
38
|
-
*/
|
|
39
|
-
export const getNewAccrualAccountsView = (state) => {
|
|
40
|
-
const { accountState, accountListState, classState, classListState } = state;
|
|
41
|
-
const { newSchedule } = state.expenseAutomationJESchedulesViewState;
|
|
42
|
-
const accountType = getAccountsTypesForScheduleEpics();
|
|
43
|
-
const accrualAccountIds = getAccountIdsForTypes(accountState, getAccountsTypesForScheduleDetails('accrued_expenses'));
|
|
44
|
-
const accruedCategoryIds = getAccountIdsForLabels(accountState, ACCRUED_EXPENSE_ACCOUNT_LABELS);
|
|
45
|
-
const allAccountList = getAccountList(accountState, accountListState, accountType.accountListKey);
|
|
46
|
-
const nestedAccountHierarchy = getNestedAccountListHierarchy(accountListState, accountType.accountListKey);
|
|
47
|
-
const debitAccounts = allAccountList.accounts.filter((account) => accrualAccountIds.includes(account.accountId) &&
|
|
48
|
-
!accruedCategoryIds.includes(account.accountId));
|
|
49
|
-
const creditAccounts = allAccountList.accounts.filter((account) => accruedCategoryIds.includes(account.accountId));
|
|
50
|
-
const allClassList = getClassList(classState, classListState);
|
|
51
|
-
return {
|
|
52
|
-
accountListNestedAccountHierarchy: filterNestedAccountHierarchyById(nestedAccountHierarchy, debitAccounts.map((account) => account.accountId)),
|
|
53
|
-
accruedAccountListNestedAccountHierarchy: filterNestedAccountHierarchyById(nestedAccountHierarchy, creditAccounts.map((account) => account.accountId)),
|
|
54
|
-
allAccountList: debitAccounts,
|
|
55
|
-
allAccruedExpenseList: creditAccounts,
|
|
56
|
-
allClassList: allClassList.classes,
|
|
57
|
-
classListNestedAccountHierarchy: getNestedClassListHierarchy(classListState),
|
|
58
|
-
createStatus: newSchedule.createOneTimeAccrualStatus,
|
|
59
|
-
// The recurring accrued schedule saves through the accrued detail epics that the Vendor tab
|
|
60
|
-
// already uses, so its status is that slice's updateStatus rather than anything new here.
|
|
61
|
-
accruedScheduleSaveStatus: state.scheduleAccruedDetailState.updateStatus,
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
export const getNewScheduleView = (state, scheduleType) => {
|
|
65
|
-
const { accountState, accountListState, classState, classListState } = state;
|
|
66
|
-
const { newSchedule } = state.expenseAutomationJESchedulesViewState;
|
|
67
|
-
const searchTransactionsView = getNewScheduleSearchTransactionsView(state);
|
|
68
|
-
const accountType = getAccountsTypesForScheduleEpics();
|
|
69
|
-
const newScheduleAccountTypes = getAccountsTypesForScheduleDetails(scheduleType);
|
|
70
|
-
const newScheduleAccountIds = getAccountIdsForTypes(accountState, newScheduleAccountTypes);
|
|
71
|
-
const allAccountList = getAccountList(accountState, accountListState, accountType.accountListKey);
|
|
72
|
-
const filteredAccounts = allAccountList.accounts.filter((account) => newScheduleAccountIds.includes(account.accountId));
|
|
73
|
-
const accountListNestedAccountHierarchy = filterNestedAccountHierarchyById(getNestedAccountListHierarchy(accountListState, accountType.accountListKey), filteredAccounts.map((account) => account.accountId));
|
|
74
|
-
const allClassList = getClassList(classState, classListState);
|
|
75
|
-
const classListNestedAccountHierarchy = getNestedClassListHierarchy(classListState);
|
|
76
|
-
let allDepreciationAccountList;
|
|
77
|
-
let allDepreciationAccountListNestedAccountHierarchy;
|
|
78
|
-
if (scheduleType === 'fixed_assets') {
|
|
79
|
-
const depreciationCategoryIds = getAccountIdsForTypes(accountState, [
|
|
80
|
-
'fixed_assets',
|
|
81
|
-
'other_assets',
|
|
82
|
-
]);
|
|
83
|
-
const accountLabel = getAccountLabelForScheduleType('fixed_assets');
|
|
84
|
-
const fixedAssetLabelAccountIds = accountLabel != null
|
|
85
|
-
? getAccountIdsForLabel(accountListState, accountType.accountListKey, accountLabel)
|
|
86
|
-
: [];
|
|
87
|
-
allDepreciationAccountList = allAccountList.accounts.filter((account) => depreciationCategoryIds.includes(account.accountId) &&
|
|
88
|
-
!fixedAssetLabelAccountIds.includes(account.accountId));
|
|
89
|
-
allDepreciationAccountListNestedAccountHierarchy =
|
|
90
|
-
filterNestedAccountHierarchyById(getNestedAccountListHierarchy(accountListState, accountType.accountListKey), allDepreciationAccountList.map((account) => account.accountId));
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
scheduleType,
|
|
94
|
-
accountListNestedAccountHierarchy,
|
|
95
|
-
allAccountList: filteredAccounts,
|
|
96
|
-
allClassList: allClassList.classes,
|
|
97
|
-
allDepreciationAccountList,
|
|
98
|
-
allDepreciationAccountListNestedAccountHierarchy,
|
|
99
|
-
classListNestedAccountHierarchy,
|
|
100
|
-
newScheduleLocalData: newSchedule.newScheduleState[scheduleType],
|
|
101
|
-
saveStatus: newSchedule.saveStatus,
|
|
102
|
-
...searchTransactionsView,
|
|
103
|
-
fetchState: newSchedule.fetchState,
|
|
104
|
-
error: newSchedule.error,
|
|
105
|
-
};
|
|
106
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, map, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
|
-
import { mapInvoicingQboAccountOptions, } from '../invoicingQboViewPayload';
|
|
5
|
-
import { fetchInvoicingQboAccounts, updateInvoicingQboAccounts, updateInvoicingQboAccountsFailure, } from '../invoicingQboViewReducer';
|
|
6
|
-
export const fetchInvoicingQboAccountsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingQboAccounts.match), mergeMap((action) => {
|
|
7
|
-
const { accountTypes } = action.payload;
|
|
8
|
-
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/accounts?account_types=${encodeURIComponent(accountTypes)}`;
|
|
9
|
-
return zeniAPI.getJSON(apiUrl).pipe(map((response) => {
|
|
10
|
-
if (isSuccessResponse(response)) {
|
|
11
|
-
return updateInvoicingQboAccounts({
|
|
12
|
-
accountTypes,
|
|
13
|
-
accounts: mapInvoicingQboAccountOptions(response.data?.accounts ?? []),
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return updateInvoicingQboAccountsFailure({
|
|
17
|
-
accountTypes,
|
|
18
|
-
status: response.status,
|
|
19
|
-
});
|
|
20
|
-
}), catchError((error) => of(updateInvoicingQboAccountsFailure({
|
|
21
|
-
accountTypes,
|
|
22
|
-
status: createZeniAPIStatus('Unexpected Error', 'Fetch QBO accounts REST API call errored out ' +
|
|
23
|
-
JSON.stringify(error)),
|
|
24
|
-
}))));
|
|
25
|
-
}));
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, map, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
|
-
import { mapInvoicingQboAccountOptions, } from '../invoicingQboViewPayload';
|
|
5
|
-
import { fetchInvoicingQboClasses, updateInvoicingQboClasses, updateInvoicingQboClassesFailure, } from '../invoicingQboViewReducer';
|
|
6
|
-
export const fetchInvoicingQboClassesEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingQboClasses.match), switchMap(() => {
|
|
7
|
-
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/classes`;
|
|
8
|
-
return zeniAPI.getJSON(apiUrl).pipe(map((response) => {
|
|
9
|
-
if (isSuccessResponse(response)) {
|
|
10
|
-
return updateInvoicingQboClasses(mapInvoicingQboAccountOptions(response.data?.accounts ?? []));
|
|
11
|
-
}
|
|
12
|
-
return updateInvoicingQboClassesFailure(response.status);
|
|
13
|
-
}), catchError((error) => of(updateInvoicingQboClassesFailure(createZeniAPIStatus('Unexpected Error', 'Fetch QBO classes REST API call errored out ' +
|
|
14
|
-
JSON.stringify(error))))));
|
|
15
|
-
}));
|
|
@@ -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
|
-
}));
|
package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js
DELETED
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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>;
|