@zeniai/client-epic-state 5.2.7-betaRD2 → 5.2.8-betaAK0
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/invoicing/invoicingCommonPayload.d.ts +36 -2
- package/lib/entity/invoicing/invoicingCommonPayload.js +89 -11
- package/lib/entity/invoicing/product/productPayload.d.ts +10 -0
- package/lib/entity/invoicing/product/productPayload.js +14 -2
- 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/invoicing/invoicingCommonPayload.js +86 -10
- package/lib/esm/entity/invoicing/product/productPayload.js +14 -2
- 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/accountList/accountListReducer.js +0 -1
- 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/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +24 -9
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +2 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +2 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +10 -5
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +47 -3
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +17 -2
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +7 -3
- 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 +12 -17
- package/lib/index.js +47 -91
- package/lib/view/accountList/accountListReducer.js +0 -1
- package/lib/view/accountList/accountListState.d.ts +1 -1
- 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/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +12 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +24 -9
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +5 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +1 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +1 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +2 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +10 -5
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +19 -2
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +52 -4
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +1 -1
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +17 -2
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +11 -4
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +7 -3
- 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,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>;
|
|
@@ -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;
|
package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts
DELETED
|
@@ -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>;
|
package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js
DELETED
|
@@ -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;
|