@zeniai/client-epic-state 4.16.1 → 4.16.2
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/commonStateTypes/animations.d.ts +1 -1
- package/lib/commonStateTypes/animations.js +1 -1
- package/lib/entity/chargeCard/chargeCard.d.ts +26 -8
- package/lib/entity/chargeCard/chargeCard.js +25 -6
- package/lib/entity/chargeCard/chargeCardPayload.d.ts +41 -5
- package/lib/entity/chargeCard/chargeCardPayload.js +20 -8
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.js +5 -1
- package/lib/entity/company/companyPayload.d.ts +12 -1
- package/lib/entity/company/companyPayload.js +14 -0
- package/lib/entity/company/companyStateTypes.d.ts +11 -0
- package/lib/entity/connectedAccount/connectedAccount.d.ts +19 -0
- package/lib/entity/connectedAccount/connectedAccount.js +10 -0
- package/lib/entity/connectedAccount/connectedAccountPayload.d.ts +11 -0
- package/lib/entity/connectedAccount/connectedAccountPayload.js +15 -0
- package/lib/entity/connectedAccount/connectedAccountReducer.d.ts +6 -0
- package/lib/entity/connectedAccount/connectedAccountReducer.js +27 -0
- package/lib/entity/connectedAccount/connectedAccountSelector.d.ts +4 -0
- package/lib/entity/connectedAccount/connectedAccountSelector.js +17 -0
- package/lib/entity/depositAccount/depositAccount.d.ts +20 -2
- package/lib/entity/depositAccount/depositAccountPayload.d.ts +22 -1
- package/lib/entity/depositAccount/depositAccountPayload.js +39 -1
- package/lib/entity/depositAccount/depositAccountReducer.d.ts +2 -2
- package/lib/entity/depositAccount/depositAccountReducer.js +8 -2
- package/lib/entity/depositAccount/depositAccountSelector.d.ts +3 -1
- package/lib/entity/depositAccount/depositAccountSelector.js +10 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
- package/lib/entity/tenant/clearAllEpic.js +2 -0
- package/lib/entity/tenant/tenantSelector.d.ts +6 -2
- package/lib/entity/tenant/tenantSelector.js +10 -2
- package/lib/epic.d.ts +5 -1
- package/lib/epic.js +5 -1
- package/lib/index.d.ts +18 -18
- package/lib/index.js +26 -17
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +8 -0
- package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +16 -0
- package/lib/view/addressView/addressViewState.d.ts +1 -1
- package/lib/view/dashboard/dashboardSelector.js +7 -6
- package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.js +5 -4
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +1 -2
- package/lib/view/expenseAutomationView/epics/fluxAnalysis/fetchFluxAnalysisViewEpic.js +18 -6
- package/lib/view/expenseAutomationView/epics/fluxAnalysis/reviewFluxAnalysisEpic.js +1 -4
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +7 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/initializeTransactionCategorizationLocalDataEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscatgorizedEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscatgorizedEpic.js +3 -3
- package/lib/view/expenseAutomationView/helpers/helpers.js +4 -4
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +2 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +27 -24
- package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.d.ts +22 -9
- package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.js +2 -2
- package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.d.ts +13 -5
- package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.js +245 -115
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +4 -3
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +14 -19
- package/lib/view/expenseAutomationView/selectorTypes/fluxAnalysisViewSelectorTypes.d.ts +29 -9
- package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +108 -40
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +9 -1
- package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.d.ts +40 -15
- package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.js +1 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.js +1 -0
- package/lib/view/onboardingView/cockpitView/epic/initializeOnboardingCustomerViewUpdateDataEpic.js +4 -4
- package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.d.ts +2 -1
- package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.js +2 -2
- package/lib/view/settingsView/settingsViewHelpers.d.ts +4 -4
- package/lib/view/settingsView/settingsViewHelpers.js +9 -8
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +1 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +6 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +20 -2
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +5 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +9 -2
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +1 -0
- package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingSelector.js +4 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.d.ts +5 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.js +4 -2
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +8 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigState.d.ts +4 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +12 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +26 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailPayload.d.ts +2 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +43 -4
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +104 -9
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +70 -16
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +12 -3
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionListEpic.js +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchDepositAccountLimitEpic.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchDepositAccountLimitEpic.js +41 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardLimitEpic.js +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateDebitCardPinAttemptEpic.d.ts +11 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateDebitCardPinAttemptEpic.js +42 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +11 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +20 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +16 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +6 -4
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +30 -4
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +5 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +26 -14
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +20 -5
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchDebitCardSummaryEpic.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchDebitCardSummaryEpic.js +23 -0
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewReducer.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewReducer.js +4 -2
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.js +2 -0
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/acceptChargeCardTermsEpic.js +19 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/depositAccountWithLimitPayload.d.ts +6 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/depositAccountWithLimitPayload.js +2 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchDepositAccountListForCardsEpic.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchDepositAccountListForCardsEpic.js +31 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.js +15 -3
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +65 -25
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +11 -3
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +45 -11
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +6 -3
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +33 -18
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +41 -8
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.js +0 -21
- package/lib/view/spendManagement/commonSetup/epic/setup/enableSetupEpic.js +9 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +8 -3
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +4 -4
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -1
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +3 -1
- package/lib/view/spendManagement/commonSetup/setupViewState.js +13 -1
- package/lib/view/spendManagement/helpers.d.ts +3 -0
- package/lib/view/spendManagement/helpers.js +13 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/getPaymentAccountsEpic.js +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountEpic.js +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountLoginStatusEpic.js +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountStatusEpic.js +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.d.ts +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +6 -1
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +10 -10
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +1 -0
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
- package/lib/view/spendManagement/zeniAccounts/checkDeposit/checkDepositSelector.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/depositAccountList/depositAccountListSelector.d.ts +1 -1
- package/lib/view/spendManagement/zeniAccounts/depositAccountList/depositAccountListSelector.js +3 -3
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountList/zeniAccountListSelector.js +1 -1
- package/lib/view/transactionDetail/epics/markTransactionAsNotMiscategorizedEpic.d.ts +4 -3
- package/lib/view/transactionDetail/epics/markTransactionAsNotMiscategorizedEpic.js +25 -1
- package/lib/view/transactionDetail/epics/saveTransactionDetailEpic.js +1 -1
- package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +1 -1
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +4 -2
- package/lib/view/transactionDetail/transactionDetailReducer.js +4 -2
- package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +3 -2
- package/lib/view/twoFactorAuthentication/resendOtpEpic.js +44 -19
- package/lib/view/twoFactorAuthentication/sendOtpEpic.d.ts +2 -1
- package/lib/view/twoFactorAuthentication/sendOtpEpic.js +45 -18
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.d.ts +17 -5
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.js +33 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.d.ts +7 -7
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.js +6 -6
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.d.ts +22 -6
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.js +176 -60
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.d.ts +5 -3
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.js +13 -2
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.d.ts +5 -2
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.js +46 -5
- package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +2 -2
- package/lib/view/userListView/fetchUserListByTypeEpic.js +4 -3
- package/lib/view/userListView/userListViewPayload.d.ts +11 -0
- package/package.json +5 -4
|
@@ -1,39 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateFluxAnalysisViewPageMetaData = exports.updateFluxAnalysisViewUIState = exports.reviewFluxAnalysisViewFailure = exports.reviewFluxAnalysisViewSuccess = exports.reviewFluxAnalysisView = exports.updateOperatingExpensesIdsForReview = exports.clearExpenseAutomationFluxAnalysisView = exports.fetchFluxAnalysisViewFailure = exports.fetchFluxAnalysisViewSuccess = exports.fetchFluxAnalysisView = exports.initialState = void 0;
|
|
4
|
+
exports.updateSelectedSectionIdsForReview = exports.updateFluxAnalysisViewPageMetaData = exports.updateFluxAnalysisViewUIState = exports.reviewFluxAnalysisViewFailure = exports.reviewFluxAnalysisViewSuccess = exports.reviewFluxAnalysisView = exports.updateOperatingExpensesIdsForReview = exports.clearExpenseAutomationFluxAnalysisView = exports.fetchFluxAnalysisViewFailure = exports.fetchFluxAnalysisViewSuccess = exports.fetchFluxAnalysisView = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
|
+
const vendorState_1 = require("../../../entity/vendor/vendorState");
|
|
7
8
|
const helpers_1 = require("../helpers/helpers");
|
|
8
9
|
exports.initialState = {
|
|
9
|
-
reviewStatusById: {},
|
|
10
|
-
operatingExpenseIdsBySelectedPeriod: {},
|
|
11
10
|
fluxAnalysisEntities: { operatingExpenses: [] },
|
|
12
11
|
uiState: {
|
|
13
12
|
scrollPosition: { scrollTop: 0, scrollLeft: undefined },
|
|
14
|
-
pageToken: null,
|
|
15
|
-
hasMore: true,
|
|
16
|
-
totalCount: 0,
|
|
17
|
-
limit: 10,
|
|
18
13
|
sortKey: 'vendor',
|
|
19
14
|
searchString: '',
|
|
20
15
|
sortOrder: 'ascending',
|
|
16
|
+
paginationInfoByGroup: {
|
|
17
|
+
generalExpense: {
|
|
18
|
+
pageToken: null,
|
|
19
|
+
hasMore: true,
|
|
20
|
+
totalCount: 0,
|
|
21
|
+
limit: 10,
|
|
22
|
+
},
|
|
23
|
+
reimbursement: {
|
|
24
|
+
pageToken: null,
|
|
25
|
+
hasMore: true,
|
|
26
|
+
totalCount: 0,
|
|
27
|
+
limit: 10,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
collapsableStatus: {
|
|
31
|
+
generalExpense: true,
|
|
32
|
+
reimbursement: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
fetchState: 'Not-Started',
|
|
36
|
+
error: undefined,
|
|
37
|
+
currency: vendorState_1.defaultVendorCurrency,
|
|
38
|
+
totalBalancesAndVariance: undefined,
|
|
39
|
+
hasValidState() {
|
|
40
|
+
return this.fetchState == 'Completed';
|
|
21
41
|
},
|
|
22
42
|
refreshStatus: {
|
|
23
43
|
fetchState: 'Not-Started',
|
|
24
44
|
error: undefined,
|
|
25
45
|
},
|
|
26
|
-
fetchState: 'Not-Started',
|
|
27
46
|
bulkReviewStatus: {
|
|
28
47
|
fetchState: 'Not-Started',
|
|
29
48
|
error: undefined,
|
|
30
49
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
hasValidState() {
|
|
35
|
-
return this.fetchState == 'Completed';
|
|
36
|
-
},
|
|
50
|
+
groupsBySelectedPeriod: {},
|
|
51
|
+
reviewOperatingExpenseIdsByPeriod: {},
|
|
52
|
+
selectedSectionIdsByPeriod: {},
|
|
37
53
|
};
|
|
38
54
|
const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
|
|
39
55
|
name: 'expenseAutomationFluxAnalysisView',
|
|
@@ -41,27 +57,45 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
|
|
|
41
57
|
reducers: {
|
|
42
58
|
fetchFluxAnalysisView: {
|
|
43
59
|
reducer(draft, action) {
|
|
44
|
-
const { refreshViewInBackground, monthAndYear, resetListItems } = action.payload;
|
|
60
|
+
const { refreshViewInBackground, monthAndYear, resetListItems, fetchReimbursement, } = action.payload;
|
|
61
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(monthAndYear);
|
|
45
62
|
if (refreshViewInBackground) {
|
|
46
63
|
draft.refreshStatus = { fetchState: 'In-Progress', error: undefined };
|
|
47
64
|
}
|
|
48
65
|
else {
|
|
49
66
|
draft.fetchState = 'In-Progress';
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
67
|
+
const group = draft.groupsBySelectedPeriod[periodId];
|
|
68
|
+
// Initialize group structure if it's the first fetch
|
|
69
|
+
if (group == null) {
|
|
70
|
+
draft.groupsBySelectedPeriod[periodId] = getInProgressGroup();
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
// Update fetch status based on fetchReimbursement
|
|
74
|
+
const statusField = fetchReimbursement
|
|
75
|
+
? 'reimbursement'
|
|
76
|
+
: 'generalExpense';
|
|
77
|
+
group[statusField].fetchStatus = {
|
|
78
|
+
fetchState: 'In-Progress',
|
|
79
|
+
error: undefined,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
// Reset list if necessary
|
|
83
|
+
if (resetListItems === true) {
|
|
84
|
+
const statusField = fetchReimbursement
|
|
85
|
+
? 'reimbursement'
|
|
86
|
+
: 'generalExpense';
|
|
87
|
+
draft.groupsBySelectedPeriod[periodId][statusField].operatingExpenseIds = [];
|
|
88
|
+
}
|
|
56
89
|
}
|
|
57
90
|
},
|
|
58
|
-
prepare(monthAndYear, cacheOverride, refreshViewInBackground, pageToken, keepExistingListItems, resetListItems) {
|
|
91
|
+
prepare(monthAndYear, cacheOverride, refreshViewInBackground, pageToken, fetchReimbursement = false, keepExistingListItems, resetListItems) {
|
|
59
92
|
return {
|
|
60
93
|
payload: {
|
|
61
94
|
monthAndYear,
|
|
62
95
|
refreshViewInBackground,
|
|
63
96
|
cacheOverride,
|
|
64
97
|
pageToken,
|
|
98
|
+
fetchReimbursement,
|
|
65
99
|
keepExistingListItems,
|
|
66
100
|
resetListItems,
|
|
67
101
|
},
|
|
@@ -69,72 +103,79 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
|
|
|
69
103
|
},
|
|
70
104
|
},
|
|
71
105
|
fetchFluxAnalysisViewSuccess(draft, action) {
|
|
72
|
-
const { expensesPayload, selectedPeriod, keepExistingListItems, currency } = action.payload;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
draft.refreshStatus = { fetchState: 'Completed', error: undefined };
|
|
79
|
-
}
|
|
80
|
-
draft.reviewStatusById = Object.assign(Object.assign({}, draft.reviewStatusById), toReviewStatusById(expensesPayload));
|
|
106
|
+
const { expensesPayload, selectedPeriod, keepExistingListItems, fetchReimbursement, currency, totalsPayload, } = action.payload;
|
|
107
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
108
|
+
const group = draft.groupsBySelectedPeriod[periodId];
|
|
109
|
+
const groupToBeFetched = fetchReimbursement
|
|
110
|
+
? group.reimbursement
|
|
111
|
+
: group.generalExpense;
|
|
81
112
|
const fluxOpExEntityIds = expensesPayload.map((expense) => expense.flux_analysis_entity_id);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
];
|
|
93
|
-
draft.fluxAnalysisEntities = allFluxAnalysisEntities;
|
|
94
|
-
draft.operatingExpenseIdsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = allOperatingExpenseIdsBySelectedPeriod;
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
draft.operatingExpenseIdsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = fluxOpExEntityIds;
|
|
98
|
-
draft.fluxAnalysisEntities = {
|
|
99
|
-
operatingExpenses: [
|
|
100
|
-
...toFluxAnalysisOperatingExpenses(expensesPayload, currency),
|
|
101
|
-
...draft.fluxAnalysisEntities.operatingExpenses,
|
|
102
|
-
],
|
|
103
|
-
};
|
|
113
|
+
// Handle fetch completion
|
|
114
|
+
handleFetchCompletion(draft, selectedPeriod, fetchReimbursement, groupToBeFetched);
|
|
115
|
+
draft.fetchState = 'Completed';
|
|
116
|
+
// Update flux analysis entities
|
|
117
|
+
const allFluxAnalysisEntities = updateFluxAnalysisEntities(draft.fluxAnalysisEntities, expensesPayload, currency);
|
|
118
|
+
// Update operating expense ids based on the "keepExistingListItems" flag
|
|
119
|
+
updateOperatingExpenseIds(draft, selectedPeriod, groupToBeFetched, fluxOpExEntityIds, fetchReimbursement, keepExistingListItems);
|
|
120
|
+
// Update total balances and variance if available
|
|
121
|
+
if (totalsPayload != null) {
|
|
122
|
+
updateTotals(draft, selectedPeriod, totalsPayload, currency);
|
|
104
123
|
}
|
|
124
|
+
// Set currency
|
|
125
|
+
draft.currency = {
|
|
126
|
+
currencyCode: currency.currency_code,
|
|
127
|
+
currencySymbol: currency.currency_symbol,
|
|
128
|
+
};
|
|
129
|
+
// Reset review operating expenses ids for the period
|
|
130
|
+
draft.reviewOperatingExpenseIdsByPeriod[periodId] = [];
|
|
131
|
+
// Final update of flux analysis entities
|
|
132
|
+
draft.fluxAnalysisEntities = allFluxAnalysisEntities;
|
|
105
133
|
},
|
|
106
134
|
updateFluxAnalysisViewPageMetaData(draft, action) {
|
|
107
|
-
var _a, _b, _c, _d;
|
|
108
|
-
draft.uiState = Object.assign(Object.assign({}, draft.uiState), {
|
|
135
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
136
|
+
draft.uiState = Object.assign(Object.assign({}, draft.uiState), { paginationInfoByGroup: {
|
|
137
|
+
generalExpense: action.payload.fetchReimbursement === true
|
|
138
|
+
? draft.uiState.paginationInfoByGroup.generalExpense
|
|
139
|
+
: Object.assign(Object.assign({}, draft.uiState.paginationInfoByGroup.generalExpense), { pageToken: (_b = (_a = action.payload.pageMetaData) === null || _a === void 0 ? void 0 : _a.next_page_token) !== null && _b !== void 0 ? _b : null, hasMore: (_d = (_c = action.payload.pageMetaData) === null || _c === void 0 ? void 0 : _c.is_more_data_to_load) !== null && _d !== void 0 ? _d : true }),
|
|
140
|
+
reimbursement: action.payload.fetchReimbursement === false
|
|
141
|
+
? draft.uiState.paginationInfoByGroup.reimbursement
|
|
142
|
+
: Object.assign(Object.assign({}, draft.uiState.paginationInfoByGroup.reimbursement), { pageToken: (_f = (_e = action.payload.pageMetaData) === null || _e === void 0 ? void 0 : _e.next_page_token) !== null && _f !== void 0 ? _f : null, hasMore: (_h = (_g = action.payload.pageMetaData) === null || _g === void 0 ? void 0 : _g.is_more_data_to_load) !== null && _h !== void 0 ? _h : true }),
|
|
143
|
+
} });
|
|
109
144
|
},
|
|
110
145
|
fetchFluxAnalysisViewFailure(draft, action) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
draft
|
|
146
|
+
var _a, _b;
|
|
147
|
+
const { status, fetchReimbursement, selectedPeriod } = action.payload;
|
|
148
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
149
|
+
if (fetchReimbursement) {
|
|
150
|
+
updateFetchFailureStatus(draft, selectedPeriod, 'reimbursement', status);
|
|
116
151
|
}
|
|
117
152
|
else {
|
|
118
|
-
draft.
|
|
153
|
+
const generalExpenseStatus = (_b = (_a = draft.groupsBySelectedPeriod[periodId]) === null || _a === void 0 ? void 0 : _a.generalExpense) === null || _b === void 0 ? void 0 : _b.fetchStatus.fetchState;
|
|
154
|
+
if (generalExpenseStatus === 'In-Progress') {
|
|
155
|
+
updateFetchFailureStatus(draft, selectedPeriod, 'generalExpense', status);
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
draft.refreshStatus = { fetchState: 'Error', error: status };
|
|
159
|
+
}
|
|
119
160
|
}
|
|
161
|
+
draft.fetchState = 'Error';
|
|
162
|
+
draft.error = status;
|
|
163
|
+
},
|
|
164
|
+
// This action updates the sections ids whenever a section is bulk selected
|
|
165
|
+
updateSelectedSectionIdsForReview(draft, action) {
|
|
166
|
+
const { sectionId, selectedPeriod } = action.payload;
|
|
167
|
+
draft.selectedSectionIdsByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] =
|
|
168
|
+
sectionId;
|
|
120
169
|
},
|
|
121
170
|
updateOperatingExpensesIdsForReview(draft, action) {
|
|
122
|
-
const { operatingExpenseIds } = action.payload;
|
|
123
|
-
draft.
|
|
171
|
+
const { operatingExpenseIds, selectedPeriod } = action.payload;
|
|
172
|
+
draft.reviewOperatingExpenseIdsByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = operatingExpenseIds;
|
|
124
173
|
},
|
|
125
174
|
reviewFluxAnalysisView: {
|
|
126
|
-
reducer(draft
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
fetchState: 'In-Progress',
|
|
131
|
-
};
|
|
132
|
-
});
|
|
133
|
-
if (isBulk === true) {
|
|
134
|
-
draft.bulkReviewStatus = {
|
|
135
|
-
fetchState: 'In-Progress',
|
|
136
|
-
};
|
|
137
|
-
}
|
|
175
|
+
reducer(draft) {
|
|
176
|
+
draft.bulkReviewStatus = {
|
|
177
|
+
fetchState: 'In-Progress',
|
|
178
|
+
};
|
|
138
179
|
},
|
|
139
180
|
prepare(actionType, operatingExpenseIds, selectedPeriod, isBulk) {
|
|
140
181
|
return {
|
|
@@ -143,41 +184,32 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
|
|
|
143
184
|
},
|
|
144
185
|
},
|
|
145
186
|
reviewFluxAnalysisViewSuccess(draft, action) {
|
|
146
|
-
const { expensesPayload, currency,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
});
|
|
187
|
+
const { expensesPayload, currency, selectedPeriod } = action.payload;
|
|
188
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
189
|
+
// Create a map of flux entity IDs to be removed for efficiency
|
|
190
|
+
const fluxEntitiesToRemove = new Set(expensesPayload.map((opExPayload) => opExPayload.flux_analysis_entity_id));
|
|
191
|
+
// Generate updated flux entities
|
|
192
|
+
const updatedFluxEntities = [
|
|
193
|
+
...draft.fluxAnalysisEntities.operatingExpenses.filter((fluxEntity) => !fluxEntitiesToRemove.has(fluxEntity.fluxAnalysisEntityId)),
|
|
194
|
+
...expensesPayload.map((opExPayload) => toFluxAnalysisOperatingExpense(opExPayload, currency)),
|
|
195
|
+
];
|
|
196
|
+
// Update the draft with the new list of operating expenses
|
|
157
197
|
draft.fluxAnalysisEntities = {
|
|
158
198
|
operatingExpenses: updatedFluxEntities,
|
|
159
199
|
};
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
200
|
+
// Reset the review state
|
|
201
|
+
draft.reviewOperatingExpenseIdsByPeriod[periodId] = [];
|
|
202
|
+
draft.selectedSectionIdsByPeriod[periodId] = [];
|
|
203
|
+
draft.bulkReviewStatus = {
|
|
204
|
+
fetchState: 'Completed',
|
|
205
|
+
};
|
|
166
206
|
},
|
|
167
207
|
reviewFluxAnalysisViewFailure(draft, action) {
|
|
168
|
-
const {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
if (isBulk === true) {
|
|
176
|
-
draft.bulkReviewStatus = {
|
|
177
|
-
fetchState: 'Error',
|
|
178
|
-
error: status,
|
|
179
|
-
};
|
|
180
|
-
}
|
|
208
|
+
const { status } = action.payload;
|
|
209
|
+
draft.bulkReviewStatus = {
|
|
210
|
+
fetchState: 'Error',
|
|
211
|
+
error: status,
|
|
212
|
+
};
|
|
181
213
|
},
|
|
182
214
|
updateFluxAnalysisViewUIState(draft, action) {
|
|
183
215
|
if (action.payload.sortKey != null) {
|
|
@@ -192,6 +224,9 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
|
|
|
192
224
|
if (action.payload.scrollPosition != null) {
|
|
193
225
|
draft.uiState.scrollPosition = action.payload.scrollPosition;
|
|
194
226
|
}
|
|
227
|
+
if (action.payload.collapsableStatus != null) {
|
|
228
|
+
draft.uiState.collapsableStatus = action.payload.collapsableStatus;
|
|
229
|
+
}
|
|
195
230
|
},
|
|
196
231
|
clearExpenseAutomationFluxAnalysisView(draft) {
|
|
197
232
|
Object.assign(draft, exports.initialState);
|
|
@@ -208,10 +243,9 @@ const toFluxAnalysisOperatingExpenses = (operatingExpensesPayload, currency) =>
|
|
|
208
243
|
const toFluxAnalysisOperatingExpense = (operatingExpensePayload, currency) => {
|
|
209
244
|
var _a;
|
|
210
245
|
return {
|
|
211
|
-
|
|
246
|
+
fluxAnalysisEntityId: operatingExpensePayload.flux_analysis_entity_id,
|
|
212
247
|
vendorId: operatingExpensePayload.vendor_id,
|
|
213
|
-
|
|
214
|
-
classId: operatingExpensePayload.accounting_class_id,
|
|
248
|
+
vendorAccountsAndClasses: toVendorAccountsAndClasses(operatingExpensePayload.category_and_class_json, currency),
|
|
215
249
|
userId: (_a = operatingExpensePayload.reviewed_by_user_id) !== null && _a !== void 0 ? _a : undefined,
|
|
216
250
|
varianceAmount: operatingExpensePayload.variance_amount,
|
|
217
251
|
variancePercentage: operatingExpensePayload.variance_percentage,
|
|
@@ -224,15 +258,111 @@ const toFluxAnalysisOperatingExpense = (operatingExpensePayload, currency) => {
|
|
|
224
258
|
balancesByMonth: (0, helpers_1.toBalancesByMonthFromPayload)(operatingExpensePayload.month_1, operatingExpensePayload.month_2, currency),
|
|
225
259
|
};
|
|
226
260
|
};
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
261
|
+
const toVendorAccountsAndClasses = (accountAndClassJSON, currency) => {
|
|
262
|
+
return accountAndClassJSON.map((accountAndClass) => {
|
|
263
|
+
return {
|
|
264
|
+
varianceAmount: accountAndClass.variance_amount,
|
|
265
|
+
variancePercentage: accountAndClass.variance_percentage,
|
|
266
|
+
accountId: accountAndClass.account_id,
|
|
267
|
+
classId: accountAndClass.accounting_class_id,
|
|
268
|
+
balancesByMonth: (0, helpers_1.toBalancesByMonthFromPayload)(accountAndClass.month_1, accountAndClass.month_2, currency),
|
|
269
|
+
};
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
const getInProgressGroup = () => {
|
|
273
|
+
return {
|
|
274
|
+
generalExpense: {
|
|
275
|
+
fetchStatus: {
|
|
276
|
+
fetchState: 'In-Progress',
|
|
277
|
+
error: undefined,
|
|
278
|
+
},
|
|
279
|
+
operatingExpenseIds: [],
|
|
280
|
+
total: undefined,
|
|
281
|
+
},
|
|
282
|
+
reimbursement: {
|
|
283
|
+
fetchStatus: { fetchState: 'Not-Started', error: undefined },
|
|
284
|
+
operatingExpenseIds: [],
|
|
285
|
+
total: undefined,
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
// Helper function to handle the fetch completion
|
|
290
|
+
const handleFetchCompletion = (draft, selectedPeriod, fetchReimbursement, groupToBeFetched) => {
|
|
291
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
292
|
+
if (fetchReimbursement) {
|
|
293
|
+
draft.groupsBySelectedPeriod[periodId].reimbursement.fetchStatus = {
|
|
294
|
+
fetchState: 'Completed',
|
|
295
|
+
error: undefined,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
else if (groupToBeFetched.fetchStatus.fetchState === 'In-Progress') {
|
|
299
|
+
draft.groupsBySelectedPeriod[periodId].generalExpense.fetchStatus = {
|
|
300
|
+
fetchState: 'Completed',
|
|
232
301
|
error: undefined,
|
|
233
302
|
};
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
draft.refreshStatus = { fetchState: 'Completed', error: undefined };
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
// Helper function to update flux analysis entities
|
|
309
|
+
const updateFluxAnalysisEntities = (existingEntities, expensesPayload, currency) => {
|
|
310
|
+
const incomingExpenses = toFluxAnalysisOperatingExpenses(expensesPayload, currency);
|
|
311
|
+
// Combine existing and incoming expenses, prioritizing incoming
|
|
312
|
+
const allExpenses = [
|
|
313
|
+
...existingEntities.operatingExpenses,
|
|
314
|
+
...incomingExpenses,
|
|
315
|
+
];
|
|
316
|
+
// Use a Map to deduplicate by fluxAnalysisEntityId, keeping the latest (incoming) entry
|
|
317
|
+
const expensesMap = new Map();
|
|
318
|
+
allExpenses.forEach((expense) => {
|
|
319
|
+
expensesMap.set(expense.fluxAnalysisEntityId, expense);
|
|
234
320
|
});
|
|
235
|
-
return
|
|
321
|
+
return { operatingExpenses: Array.from(expensesMap.values()) };
|
|
322
|
+
};
|
|
323
|
+
// Helper function to update operating expense ids
|
|
324
|
+
const updateOperatingExpenseIds = (draft, selectedPeriod, groupToBeFetched, fluxOpExEntityIds, fetchReimbursement, keepExistingListItems) => {
|
|
325
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
326
|
+
const updatedOperatingExpenseIds = keepExistingListItems === true
|
|
327
|
+
? Array.from(new Set([
|
|
328
|
+
...groupToBeFetched.operatingExpenseIds,
|
|
329
|
+
...fluxOpExEntityIds,
|
|
330
|
+
]))
|
|
331
|
+
: fluxOpExEntityIds;
|
|
332
|
+
if (fetchReimbursement) {
|
|
333
|
+
draft.groupsBySelectedPeriod[periodId].reimbursement.operatingExpenseIds =
|
|
334
|
+
updatedOperatingExpenseIds;
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
draft.groupsBySelectedPeriod[periodId].generalExpense.operatingExpenseIds =
|
|
338
|
+
updatedOperatingExpenseIds;
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
// Helper function to update totals
|
|
342
|
+
const updateTotals = (draft, selectedPeriod, totalsPayload, currency) => {
|
|
343
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
344
|
+
draft.totalBalancesAndVariance = {
|
|
345
|
+
balancesByMonth: (0, helpers_1.toBalancesByMonthFromPayload)(totalsPayload.total.month_1, totalsPayload.total.month_2, currency),
|
|
346
|
+
varianceAmount: totalsPayload.total.variance_amount,
|
|
347
|
+
variancePercentage: totalsPayload.total.variance_percentage,
|
|
348
|
+
};
|
|
349
|
+
draft.groupsBySelectedPeriod[periodId].generalExpense.total = {
|
|
350
|
+
balancesByMonth: (0, helpers_1.toBalancesByMonthFromPayload)(totalsPayload.general_expenses.month_1, totalsPayload.general_expenses.month_2, currency),
|
|
351
|
+
varianceAmount: totalsPayload.general_expenses.variance_amount,
|
|
352
|
+
variancePercentage: totalsPayload.general_expenses.variance_percentage,
|
|
353
|
+
};
|
|
354
|
+
draft.groupsBySelectedPeriod[periodId].reimbursement.total = {
|
|
355
|
+
balancesByMonth: (0, helpers_1.toBalancesByMonthFromPayload)(totalsPayload.reimbursement.month_1, totalsPayload.reimbursement.month_2, currency),
|
|
356
|
+
varianceAmount: totalsPayload.reimbursement.variance_amount,
|
|
357
|
+
variancePercentage: totalsPayload.reimbursement.variance_percentage,
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
// Helper function to update the fetch failure status for a group
|
|
361
|
+
const updateFetchFailureStatus = (draft, selectedPeriod, groupType, status) => {
|
|
362
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
363
|
+
const group = draft.groupsBySelectedPeriod[periodId][groupType];
|
|
364
|
+
group.operatingExpenseIds = [];
|
|
365
|
+
group.fetchStatus = { fetchState: 'Error', error: status };
|
|
236
366
|
};
|
|
237
|
-
_a = expenseAutomationFluxAnalysisView.actions, exports.fetchFluxAnalysisView = _a.fetchFluxAnalysisView, exports.fetchFluxAnalysisViewSuccess = _a.fetchFluxAnalysisViewSuccess, exports.fetchFluxAnalysisViewFailure = _a.fetchFluxAnalysisViewFailure, exports.clearExpenseAutomationFluxAnalysisView = _a.clearExpenseAutomationFluxAnalysisView, exports.updateOperatingExpensesIdsForReview = _a.updateOperatingExpensesIdsForReview, exports.reviewFluxAnalysisView = _a.reviewFluxAnalysisView, exports.reviewFluxAnalysisViewSuccess = _a.reviewFluxAnalysisViewSuccess, exports.reviewFluxAnalysisViewFailure = _a.reviewFluxAnalysisViewFailure, exports.updateFluxAnalysisViewUIState = _a.updateFluxAnalysisViewUIState, exports.updateFluxAnalysisViewPageMetaData = _a.updateFluxAnalysisViewPageMetaData;
|
|
367
|
+
_a = expenseAutomationFluxAnalysisView.actions, exports.fetchFluxAnalysisView = _a.fetchFluxAnalysisView, exports.fetchFluxAnalysisViewSuccess = _a.fetchFluxAnalysisViewSuccess, exports.fetchFluxAnalysisViewFailure = _a.fetchFluxAnalysisViewFailure, exports.clearExpenseAutomationFluxAnalysisView = _a.clearExpenseAutomationFluxAnalysisView, exports.updateOperatingExpensesIdsForReview = _a.updateOperatingExpensesIdsForReview, exports.reviewFluxAnalysisView = _a.reviewFluxAnalysisView, exports.reviewFluxAnalysisViewSuccess = _a.reviewFluxAnalysisViewSuccess, exports.reviewFluxAnalysisViewFailure = _a.reviewFluxAnalysisViewFailure, exports.updateFluxAnalysisViewUIState = _a.updateFluxAnalysisViewUIState, exports.updateFluxAnalysisViewPageMetaData = _a.updateFluxAnalysisViewPageMetaData, exports.updateSelectedSectionIdsForReview = _a.updateSelectedSectionIdsForReview;
|
|
238
368
|
exports.default = expenseAutomationFluxAnalysisView.reducer;
|
|
@@ -27,7 +27,7 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
27
27
|
}, "expenseAutomationTransactionsView/fetchTransactionCategorization", never, never>, updateTransactionCategorizationUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
28
28
|
selectedTab: TransactionsTab;
|
|
29
29
|
uiState: Partial<TransactionsViewUIState>;
|
|
30
|
-
}, "expenseAutomationTransactionsView/updateTransactionCategorizationUIState">, initializeTransactionCategorizationViewLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionIds: string[], selectedPeriod: MonthYearPeriod, keepExistingListItems: any, pageToken: PageToken, totalCount: number, refreshViewInBackground
|
|
30
|
+
}, "expenseAutomationTransactionsView/updateTransactionCategorizationUIState">, initializeTransactionCategorizationViewLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionIds: string[], selectedPeriod: MonthYearPeriod, keepExistingListItems: any, pageToken: PageToken, totalCount: number, refreshViewInBackground: any, lineItemsByTransactionIds: Record<string, string[]>], {
|
|
31
31
|
selectedTab: "review" | "autoCategorized";
|
|
32
32
|
transactionIds: string[];
|
|
33
33
|
selectedPeriod: MonthYearPeriod;
|
|
@@ -35,6 +35,7 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
35
35
|
pageToken: PageToken;
|
|
36
36
|
totalCount: number;
|
|
37
37
|
refreshViewInBackground: any;
|
|
38
|
+
lineItemsByTransactionIds: Record<string, string[]>;
|
|
38
39
|
}, "expenseAutomationTransactionsView/initializeTransactionCategorizationViewLocalData", never, never>, saveTransactionCategorizationLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
39
40
|
selectedTab: TransactionsTab;
|
|
40
41
|
transactionIds: ID[];
|
|
@@ -64,13 +65,13 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
64
65
|
}, "expenseAutomationTransactionsView/updateTransactionCategorizationSaveStatus", never, never>, markTransactionAsNotMiscategorized: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionsInReview: UpdateTransactionCategorizationResponsePayload], {
|
|
65
66
|
selectedTab: "review" | "autoCategorized";
|
|
66
67
|
transactionsInReview: UpdateTransactionCategorizationResponsePayload;
|
|
67
|
-
}, "expenseAutomationTransactionsView/markTransactionAsNotMiscategorized", never, never>,
|
|
68
|
+
}, "expenseAutomationTransactionsView/markTransactionAsNotMiscategorized", never, never>, updateStatusForTransactionNotMiscategorizedUpdateForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionIds: string[], selectedPeriod: MonthYearPeriod, fetchState: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
|
|
68
69
|
selectedPeriod: MonthYearPeriod;
|
|
69
70
|
transactionIds: string[];
|
|
70
71
|
selectedTab: "review" | "autoCategorized";
|
|
71
72
|
fetchState: FetchState;
|
|
72
73
|
error: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
73
|
-
}, "expenseAutomationTransactionsView/
|
|
74
|
+
}, "expenseAutomationTransactionsView/updateStatusForTransactionNotMiscategorizedUpdateForCategorization", never, never>, updateSelectedVendorForTransaction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
74
75
|
selectedTab: TransactionsTab;
|
|
75
76
|
transactionId: ID;
|
|
76
77
|
lineId: ID;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.updateSelectedTransactionId = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.fetchTransactionCategorizationSuccess = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.
|
|
7
|
+
exports.updateSelectedTransactionId = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.fetchTransactionCategorizationSuccess = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = exports.markTransactionAsNotMiscategorized = exports.updateTransactionCategorizationSaveStatus = exports.updateCurrentSelectedTransactionCategorizationTab = exports.updateTransactionCategorization = exports.saveTransactionCategorization = exports.fetchTransactionCategorizationFailure = exports.saveTransactionCategorizationLocalData = exports.initializeTransactionCategorizationViewLocalData = exports.updateTransactionCategorizationUIState = exports.fetchTransactionCategorization = exports.initialState = exports.initialTransactionTabViewState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
10
|
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
@@ -90,14 +90,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
90
90
|
'In-Progress';
|
|
91
91
|
draft.transactionCategorizationView[selectedTab].error = undefined;
|
|
92
92
|
}
|
|
93
|
-
// Note: Need to reset scroll position whenever a new fetch happens, except when fetching through scroll
|
|
94
|
-
if (pageToken == null) {
|
|
95
|
-
// Page Token is null in each fetch except when fetching through scroll
|
|
96
|
-
draft.transactionCategorizationView[selectedTab].uiState.scrollPosition = {
|
|
97
|
-
scrollTop: 0,
|
|
98
|
-
scrollLeft: undefined,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
93
|
draft.transactionCategorizationView[selectedTab].uiState.pageToken =
|
|
102
94
|
pageToken !== null && pageToken !== void 0 ? pageToken : null;
|
|
103
95
|
draft.transactionCategorizationView[selectedTab].uiState.searchString =
|
|
@@ -141,7 +133,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
141
133
|
},
|
|
142
134
|
},
|
|
143
135
|
initializeTransactionCategorizationViewLocalData: {
|
|
144
|
-
prepare(selectedTab, transactionIds, selectedPeriod, keepExistingListItems = false, pageToken, totalCount, refreshViewInBackground = false) {
|
|
136
|
+
prepare(selectedTab, transactionIds, selectedPeriod, keepExistingListItems = false, pageToken, totalCount, refreshViewInBackground = false, lineItemsByTransactionIds) {
|
|
145
137
|
return {
|
|
146
138
|
payload: {
|
|
147
139
|
selectedTab,
|
|
@@ -151,6 +143,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
151
143
|
pageToken,
|
|
152
144
|
totalCount,
|
|
153
145
|
refreshViewInBackground,
|
|
146
|
+
lineItemsByTransactionIds,
|
|
154
147
|
},
|
|
155
148
|
};
|
|
156
149
|
},
|
|
@@ -346,18 +339,20 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
346
339
|
},
|
|
347
340
|
},
|
|
348
341
|
fetchTransactionCategorizationSuccess(draft, action) {
|
|
349
|
-
const { selectedTab } = action.payload;
|
|
350
|
-
if (
|
|
342
|
+
const { selectedTab, refreshViewInBackground } = action.payload;
|
|
343
|
+
if (draft.transactionCategorizationView[selectedTab].fetchState ===
|
|
344
|
+
'In-Progress' ||
|
|
345
|
+
refreshViewInBackground !== true) {
|
|
346
|
+
draft.transactionCategorizationView[selectedTab].fetchState =
|
|
347
|
+
'Completed';
|
|
348
|
+
draft.transactionCategorizationView[selectedTab].error = undefined;
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
351
|
draft.transactionCategorizationView[selectedTab].refreshStatus = {
|
|
352
352
|
fetchState: 'Completed',
|
|
353
353
|
error: undefined,
|
|
354
354
|
};
|
|
355
355
|
}
|
|
356
|
-
else {
|
|
357
|
-
draft.transactionCategorizationView[selectedTab].fetchState =
|
|
358
|
-
'Completed';
|
|
359
|
-
draft.transactionCategorizationView[selectedTab].error = undefined;
|
|
360
|
-
}
|
|
361
356
|
},
|
|
362
357
|
fetchTransactionCategorizationFailure(draft, action) {
|
|
363
358
|
const { selectedTab, selectedPeriod } = action.payload;
|
|
@@ -512,7 +507,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
512
507
|
};
|
|
513
508
|
},
|
|
514
509
|
},
|
|
515
|
-
|
|
510
|
+
updateStatusForTransactionNotMiscategorizedUpdateForCategorization: {
|
|
516
511
|
reducer(draft, action) {
|
|
517
512
|
const { selectedTab, selectedPeriod, transactionIds } = action.payload;
|
|
518
513
|
if (action.payload.fetchState === 'Completed') {
|
|
@@ -561,5 +556,5 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
561
556
|
},
|
|
562
557
|
},
|
|
563
558
|
});
|
|
564
|
-
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.
|
|
559
|
+
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = _a.updateStatusForTransactionNotMiscategorizedUpdateForCategorization, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId;
|
|
565
560
|
exports.default = expenseAutomationTransactionsView.reducer;
|