@zeniai/client-epic-state 5.0.72 → 5.0.73
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/cacheOverrideFetchReducer.d.ts +17 -0
- package/lib/commonStateTypes/cacheOverrideFetchReducer.js +20 -0
- package/lib/commonStateTypes/pusherActions.d.ts +11 -0
- package/lib/commonStateTypes/pusherActions.js +6 -0
- package/lib/coreEpics.js +1 -1
- package/lib/entity/account/accountSelector.d.ts +1 -1
- package/lib/entity/account/accountState.d.ts +1 -1
- package/lib/entity/account/subAccountSelector.d.ts +1 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +1 -3
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +1 -2
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +1 -1
- package/lib/entity/chargeCard/chargeCardReducer.d.ts +19 -2
- package/lib/entity/chargeCard/chargeCardReducer.js +35 -2
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.d.ts +14 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +36 -2
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.d.ts +2 -0
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.js +2 -0
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +2 -0
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +1 -1
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
- package/lib/entity/tenant/SessionManager.js +6 -3
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -2
- package/lib/entity/tenant/clearAllEpic.js +2 -2
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +6 -2
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +6 -2
- package/lib/entity/tenant/tenantReducer.js +6 -1
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +3 -1
- package/lib/epic.d.ts +9 -9
- package/lib/epic.js +10 -10
- package/lib/esm/commonStateTypes/cacheOverrideFetchReducer.js +16 -0
- package/lib/esm/commonStateTypes/pusherActions.js +3 -0
- package/lib/esm/coreEpics.js +1 -1
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +1 -3
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +1 -2
- package/lib/esm/entity/chargeCard/chargeCardReducer.js +34 -1
- package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionReducer.js +35 -1
- package/lib/esm/entity/monthEndCloseChecks/monthEndCloseChecksPayload.js +2 -0
- package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
- package/lib/esm/entity/tenant/SessionManager.js +4 -1
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -2
- package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +6 -2
- package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +6 -2
- package/lib/esm/entity/tenant/tenantReducer.js +6 -1
- package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +3 -1
- package/lib/esm/epic.js +10 -10
- package/lib/esm/index.js +17 -13
- package/lib/esm/reducer.js +2 -2
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +2 -5
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +2 -5
- package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +4 -1
- package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
- package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +2 -1
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +8 -6
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -1
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +11 -1
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -1
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +127 -1
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +20 -1
- package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +17 -0
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +0 -2
- package/lib/esm/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/esm/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +55 -18
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +16 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +5 -4
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +26 -9
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +9 -6
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +7 -3
- package/lib/esm/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +1 -1
- package/lib/esm/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +1 -1
- package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +1 -1
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +7 -1
- package/lib/index.d.ts +19 -15
- package/lib/index.js +72 -58
- package/lib/reducer.d.ts +2 -2
- package/lib/reducer.js +2 -2
- package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +2 -2
- package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +1 -1
- package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +2 -5
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +2 -5
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +4 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +2 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +8 -6
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +10 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +21 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +2 -1
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +9 -3
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +128 -2
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +2 -1
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +14 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +20 -1
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +10 -0
- package/lib/view/expenseAutomationView/types/completedSubTab.js +21 -0
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -2
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +1 -4
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +41 -2
- package/lib/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +55 -18
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +16 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +5 -4
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +18 -3
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +27 -10
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +9 -6
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +7 -3
- package/lib/view/transactionDetail/transactionDetailSelector.js +7 -1
- package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +1 -1
- package/package.json +9 -4
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
|
@@ -10,7 +10,7 @@ import { getProjectList } from '../../projectList/projectListSelector';
|
|
|
10
10
|
import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
|
|
11
11
|
export function getExpenseAutomationTransactionView(state) {
|
|
12
12
|
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
13
|
-
const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
|
|
13
|
+
const { selectedTransactionCategorizationCompletedSubTab, selectedTransactionCategorizationTab, } = expenseAutomationTransactionsViewState;
|
|
14
14
|
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
15
15
|
const uncategorizedIncomeExpense = getUncategorizedAccounts(accountState, accountListState, 'accountList');
|
|
16
16
|
const accountList = getAccountList(accountState, accountListState, 'accountList');
|
|
@@ -63,10 +63,27 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
63
63
|
.uiState.totalCount;
|
|
64
64
|
const totalCountByAutoCat = expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
65
65
|
.autoCategorized.uiState.totalCount;
|
|
66
|
+
// Per-(sub-)tab counts powering pagination, in-list "showing X of Y", and
|
|
67
|
+
// any save/refresh round-trips. Sourced from `uiState.totalCount` which
|
|
68
|
+
// mirrors the response's `total_count` for whatever tab/sub-tab the user is
|
|
69
|
+
// viewing (e.g. only the Manual sub-tab rows for Completed → Manual).
|
|
66
70
|
const totalCountByTab = {
|
|
67
71
|
review: monthYearPeriodId != null ? totalCountByReview[monthYearPeriodId] : 0,
|
|
68
72
|
autoCategorized: monthYearPeriodId != null ? totalCountByAutoCat[monthYearPeriodId] : 0,
|
|
69
73
|
};
|
|
74
|
+
// Parent-tab badge counts. Sourced from `parent_tab_total_count` in the
|
|
75
|
+
// listing response and used exclusively by the navbar / tab strip badges.
|
|
76
|
+
// Independent of which Completed sub-tab is active so the badge stays
|
|
77
|
+
// stable across sub-tab switches.
|
|
78
|
+
const parentTotalCountByTab = expenseAutomationTransactionsViewState.parentTotalCountByTab;
|
|
79
|
+
const parentTabTotalCountByTab = {
|
|
80
|
+
review: monthYearPeriodId != null
|
|
81
|
+
? (parentTotalCountByTab.review[monthYearPeriodId] ?? 0)
|
|
82
|
+
: 0,
|
|
83
|
+
autoCategorized: monthYearPeriodId != null
|
|
84
|
+
? (parentTotalCountByTab.autoCategorized[monthYearPeriodId] ?? 0)
|
|
85
|
+
: 0,
|
|
86
|
+
};
|
|
70
87
|
const fetchStateByTab = {
|
|
71
88
|
review: {
|
|
72
89
|
fetchState: expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
@@ -108,9 +125,11 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
108
125
|
markAsNotMiscategorizedStatus,
|
|
109
126
|
completionStatus,
|
|
110
127
|
totalCountByTab,
|
|
128
|
+
parentTabTotalCountByTab,
|
|
111
129
|
fetchStateByTransactionTabs: fetchStateByTab,
|
|
112
130
|
uploadReceiptStatusById,
|
|
113
131
|
selectedTransactionId,
|
|
114
132
|
selectedTransactionLineId,
|
|
133
|
+
selectedTransactionCategorizationCompletedSubTab,
|
|
115
134
|
};
|
|
116
135
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { stringToUnion } from '../../../commonStateTypes/stringToUnion';
|
|
2
|
+
/**
|
|
3
|
+
* Sub-tabs that can appear under any "Completed" tab in the Expense Automation
|
|
4
|
+
* surface (Transaction Categorization Completed and Missing Receipts Completed
|
|
5
|
+
* both use this exact union). Forwarded verbatim to listing APIs as `sub_tab`
|
|
6
|
+
* / `match_type`. `'all'` preserves parent-tab semantics on the backend.
|
|
7
|
+
*/
|
|
8
|
+
const COMPLETED_SUB_TABS = ['all', 'ai_accountant', 'manual'];
|
|
9
|
+
export const toCompletedSubTab = (v) => stringToUnion(v.trim().toLowerCase(), COMPLETED_SUB_TABS);
|
|
10
|
+
/**
|
|
11
|
+
* "No sub-tab filter" sentinel — single source of truth for the default
|
|
12
|
+
* value of {@link CompletedSubTab}. Use this constant in initial slice
|
|
13
|
+
* state and at any call site that needs to fall back to the parent-tab
|
|
14
|
+
* listing semantics (review tab requests, manual-search overrides, etc.)
|
|
15
|
+
* so a future rename of the union doesn't require chasing literals.
|
|
16
|
+
*/
|
|
17
|
+
export const DEFAULT_COMPLETED_SUB_TAB = 'all';
|
|
@@ -39,8 +39,6 @@ const BULK_UPLOAD_RESULTS_TABS = ['completed', 'unmatched'];
|
|
|
39
39
|
export const toBulkUploadResultsTab = (v) => stringToUnion(v.trim().toLowerCase(), BULK_UPLOAD_RESULTS_TABS);
|
|
40
40
|
const MISSING_RECEIPTS_TABS = ['missing', 'completed', 'unmatched'];
|
|
41
41
|
export const toMissingReceiptsTab = (v) => stringToUnion(v.trim().toLowerCase(), MISSING_RECEIPTS_TABS);
|
|
42
|
-
const COMPLETED_SUB_TABS = ['all', 'ai_accountant', 'manual'];
|
|
43
|
-
export const toCompletedSubTab = (v) => stringToUnion(v.trim().toLowerCase(), COMPLETED_SUB_TABS);
|
|
44
42
|
const MATCH_SOURCES = ['ai', 'manual'];
|
|
45
43
|
export const toMatchSource = (v) => stringToUnion(v.trim().toLowerCase(), MATCH_SOURCES);
|
|
46
44
|
const BULK_UPLOAD_SORT_KEYS = [
|
|
@@ -2,6 +2,7 @@ import { createSelector } from '@reduxjs/toolkit';
|
|
|
2
2
|
import { stripCompareAdditionalBalanceTypes } from '../../commonStateTypes/coaBalance/coaBalanceType';
|
|
3
3
|
import { newBalancesFilter, newBalancesFilterForDateRange, } from '../../commonStateTypes/coaBalance/coaBalancesFilter';
|
|
4
4
|
import { newBalancesFilterClassesView } from '../../commonStateTypes/coaBalance/coaBalancesFilterClassesView';
|
|
5
|
+
import { newBalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
|
|
5
6
|
import { getNumberOfPeriods, } from '../../commonStateTypes/dataAvailable';
|
|
6
7
|
import { reduceAnyCompletedFetchState } from '../../commonStateTypes/reduceFetchState';
|
|
7
8
|
import { toTimeframeTick, } from '../../commonStateTypes/timeframeTick';
|
|
@@ -9,7 +10,6 @@ import { extractThisPeriod } from '../../commonStateTypes/viewAndReport/thisPeri
|
|
|
9
10
|
import { getBalanceSheet } from '../balanceSheet/balanceSheetSelector';
|
|
10
11
|
import { getCashFlow } from '../cashFlow/cashFlowSelector';
|
|
11
12
|
import { getProfitAndLossReport, } from '../profitAndLoss/profitAndLossSelector';
|
|
12
|
-
import { newBalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
|
|
13
13
|
import { getProfitAndLossClassesHorizontalView } from '../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector';
|
|
14
14
|
import { getProfitAndLossClassesView } from '../profitAndLossClassesView/profitAndLossClassesViewSelector';
|
|
15
15
|
import { getProfitAndLossProjectView } from '../profitAndLossProjectView/profitAndLossProjectViewSelector';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { mapCurrencyPayloadToCurrency } from '../../../../commonPayloadTypes/v2/viewAndReportPayloadv2';
|
|
3
3
|
import { toAmount } from '../../../../commonStateTypes/amount';
|
|
4
|
+
import { createCacheOverrideFetchReducer } from '../../../../commonStateTypes/cacheOverrideFetchReducer';
|
|
4
5
|
import { initialCashbackAnalytics, } from './cashbackDetailState';
|
|
5
6
|
export const initialState = {
|
|
6
7
|
fetchState: 'Not-Started',
|
|
@@ -27,10 +28,10 @@ const cashbackDetail = createSlice({
|
|
|
27
28
|
name: 'cashbackDetail',
|
|
28
29
|
initialState,
|
|
29
30
|
reducers: {
|
|
30
|
-
fetchCashbackDetail(draft) {
|
|
31
|
+
fetchCashbackDetail: createCacheOverrideFetchReducer((draft) => {
|
|
31
32
|
draft.fetchState = 'In-Progress';
|
|
32
33
|
draft.error = undefined;
|
|
33
|
-
},
|
|
34
|
+
}),
|
|
34
35
|
updateCashbackDetail(draft, action) {
|
|
35
36
|
draft.cashbackByPeriod = toCashbackByPeriod(action.payload);
|
|
36
37
|
draft.cashbackSummary = toCashbackSummary(action.payload);
|
package/lib/esm/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { toAmount } from '../../../../commonStateTypes/amount';
|
|
3
|
+
import { createCacheOverrideFetchReducer } from '../../../../commonStateTypes/cacheOverrideFetchReducer';
|
|
3
4
|
import { toCreditLimitFrequencyCodeType } from '../../../../entity/chargeCard/chargeCard';
|
|
4
5
|
import { toCreditTerm, toRePaymentInfo, } from './chargeCardConfigPayload';
|
|
5
6
|
export const initialState = {
|
|
@@ -30,10 +31,10 @@ const chargeCardConfig = createSlice({
|
|
|
30
31
|
name: 'chargeCardConfig',
|
|
31
32
|
initialState,
|
|
32
33
|
reducers: {
|
|
33
|
-
fetchChargeCardConfig(draft) {
|
|
34
|
+
fetchChargeCardConfig: createCacheOverrideFetchReducer((draft) => {
|
|
34
35
|
draft.fetchState = 'In-Progress';
|
|
35
36
|
draft.error = undefined;
|
|
36
|
-
},
|
|
37
|
+
}),
|
|
37
38
|
updateChargeCardConfig(draft, action) {
|
|
38
39
|
const { payload } = action;
|
|
39
40
|
draft.creditLimitFrequency =
|
package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { mapSortOrderPayloadToSortOrder, } from '../../../../commonPayloadTypes/sortOrderPayload';
|
|
3
|
+
import { addChargeCardTransactionFromPusher, addDeclinedChargeCardTransactionFromPusher, } from '../../../../commonStateTypes/pusherActions';
|
|
3
4
|
import { toAttachment, } from '../../../../entity/transaction/payloadTypes/attachmentPayload';
|
|
4
5
|
import { emptyChargeCardDetail, mapChargeCardTransactionStatisticsPayloadToChargeCardTransactionStatistics, toChargeCardTransactionSortKeyType, } from './chargeCardDetail';
|
|
5
6
|
export const initialState = {
|
|
@@ -64,19 +65,30 @@ const chargeCardDetail = createSlice({
|
|
|
64
65
|
},
|
|
65
66
|
fetchChargeCardTransactionList: {
|
|
66
67
|
reducer(draft, action) {
|
|
67
|
-
const { chargeCardId, pageToken, pageTokenType } = action.payload;
|
|
68
|
+
const { chargeCardId, pageToken, pageTokenType, cacheOverride } = action.payload;
|
|
68
69
|
const existingCardDetail = draft.detailById[chargeCardId] ?? emptyChargeCardDetail;
|
|
70
|
+
const existingUi = existingCardDetail.transactionList.uiState;
|
|
71
|
+
// cacheOverride=true (Pusher): preserve fetchState, error, and scroll
|
|
72
|
+
// to avoid skeleton flash. Normal fetches reset as before.
|
|
69
73
|
draft.detailById[chargeCardId] = {
|
|
70
74
|
...existingCardDetail,
|
|
71
75
|
transactionList: {
|
|
72
76
|
...existingCardDetail.transactionList,
|
|
73
|
-
fetchState:
|
|
74
|
-
|
|
77
|
+
fetchState: cacheOverride
|
|
78
|
+
? existingCardDetail.transactionList.fetchState
|
|
79
|
+
: 'In-Progress',
|
|
80
|
+
error: cacheOverride
|
|
81
|
+
? existingCardDetail.transactionList.error
|
|
82
|
+
: undefined,
|
|
75
83
|
uiState: {
|
|
76
|
-
...
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
...existingUi,
|
|
85
|
+
// Preserve scroll on silent refresh so users aren't snapped
|
|
86
|
+
// away from their reading position.
|
|
87
|
+
scrollYOffset: cacheOverride
|
|
88
|
+
? existingUi.scrollYOffset
|
|
89
|
+
: existingUi.pageToken === null
|
|
90
|
+
? 0
|
|
91
|
+
: existingUi.scrollYOffset,
|
|
80
92
|
pageToken: pageToken,
|
|
81
93
|
pageTokenType: pageTokenType,
|
|
82
94
|
},
|
|
@@ -93,18 +105,24 @@ const chargeCardDetail = createSlice({
|
|
|
93
105
|
const { chargeCardId, data, cacheOverride } = action.payload;
|
|
94
106
|
const existingCardDetail = draft.detailById[chargeCardId] ?? emptyChargeCardDetail;
|
|
95
107
|
const newTransactionIds = data.transactions.map((tran) => tran.transaction_id);
|
|
108
|
+
const existingIds = existingCardDetail.transactionList.transactionIds;
|
|
109
|
+
// cacheOverride (Pusher): refresh page 1 but keep page 2+ IDs.
|
|
110
|
+
// Normal pagination: append new page, deduped.
|
|
111
|
+
const newIdSet = new Set(newTransactionIds);
|
|
112
|
+
const mergedTransactionIds = cacheOverride
|
|
113
|
+
? [
|
|
114
|
+
...newTransactionIds,
|
|
115
|
+
...existingIds.filter((id) => !newIdSet.has(id)),
|
|
116
|
+
]
|
|
117
|
+
: [
|
|
118
|
+
...existingIds,
|
|
119
|
+
...newTransactionIds.filter((id) => !existingIds.includes(id)),
|
|
120
|
+
];
|
|
96
121
|
draft.detailById[chargeCardId] = {
|
|
97
122
|
...existingCardDetail,
|
|
98
123
|
transactionList: {
|
|
99
124
|
...existingCardDetail.transactionList,
|
|
100
|
-
transactionIds:
|
|
101
|
-
...new Set([
|
|
102
|
-
...(cacheOverride
|
|
103
|
-
? []
|
|
104
|
-
: existingCardDetail.transactionList.transactionIds),
|
|
105
|
-
...newTransactionIds,
|
|
106
|
-
]),
|
|
107
|
-
],
|
|
125
|
+
transactionIds: mergedTransactionIds,
|
|
108
126
|
fetchState: 'Completed',
|
|
109
127
|
error: undefined,
|
|
110
128
|
uiState: {
|
|
@@ -116,9 +134,12 @@ const chargeCardDetail = createSlice({
|
|
|
116
134
|
limit: data.query.limit,
|
|
117
135
|
pageToken: data.query.page_token,
|
|
118
136
|
pageTokenType: data.query.page_token_type,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
137
|
+
// Preserve scroll on silent refresh; reset on user-triggered first page.
|
|
138
|
+
scrollYOffset: cacheOverride
|
|
139
|
+
? existingCardDetail.transactionList.uiState.scrollYOffset
|
|
140
|
+
: existingCardDetail.transactionList.uiState.pageToken === null
|
|
141
|
+
? 0
|
|
142
|
+
: existingCardDetail.transactionList.uiState.scrollYOffset,
|
|
122
143
|
},
|
|
123
144
|
},
|
|
124
145
|
};
|
|
@@ -632,6 +653,22 @@ const chargeCardDetail = createSlice({
|
|
|
632
653
|
Object.assign(draft, initialState);
|
|
633
654
|
},
|
|
634
655
|
},
|
|
656
|
+
extraReducers: (builder) => {
|
|
657
|
+
const prependTransaction = (draft, cardId, txId) => {
|
|
658
|
+
const detail = draft.detailById[cardId];
|
|
659
|
+
if (detail != null &&
|
|
660
|
+
!detail.transactionList.transactionIds.includes(txId)) {
|
|
661
|
+
detail.transactionList.transactionIds.unshift(txId);
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
builder
|
|
665
|
+
.addCase(addChargeCardTransactionFromPusher, (draft, action) => {
|
|
666
|
+
prependTransaction(draft, action.payload.cardId, action.payload.transaction.transaction_id);
|
|
667
|
+
})
|
|
668
|
+
.addCase(addDeclinedChargeCardTransactionFromPusher, (draft, action) => {
|
|
669
|
+
prependTransaction(draft, action.payload.cardId, action.payload.transaction.transaction_id);
|
|
670
|
+
});
|
|
671
|
+
},
|
|
635
672
|
});
|
|
636
673
|
export const { fetchChargeCardDetailPage, fetchChargeCardDetail, updateChargeCardDetailFetchState, fetchChargeCardTransactionList, updateChargeCardDetailUIState, updateChargeCardTransactionList, updateChargeCardTransactionUploadReceiptsFetchStatus, fetchChargeCardTransactionAttachments, updateChargeCardTransactionIsViewReceiptClicked, updateChargeCardTransactionAttachmentsFailure, updatePhysicalChargeCardAttemptSuccessOrFailure, updatePhysicalChargeCardAttempt, updateDebitCardPinAttempt, updateDebitCardPinAttemptSuccessOrFailure, updateChargeCardTransactionReceiptsShowTickFetchStatus, updateChargeCardTransactionAttachmentsInCardDetail, updateChargeCardTransactionListFailure, updateChargeCardDetail, startCVVActivationWait, completeCVVActivationWait, startDebitCardSetPinWait, completeDebitCardSetPinWait, updateChargeCardDetailUpdateStatus, updateChargeCardSpendLimit, updateChargeCardSpendLimitSuccessOrFailure, updateChargeCardName, updateChargeCardNameSuccessOrFailure, lockChargeCard, lockChargeCardSuccessOrFailure, unlockChargeCard, unlockChargeCardSuccessOrFailure, closeChargeCard, closeChargeCardSuccessOrFailure, fetchDepositAccountLimit, updateDepositAccountLimitFetchStatus, fetchChargeCardTransactionStatistics, updateChargeCardTransactionStatistics, updateChargeCardTransactionStatisticsFetchState, fetchChargeCardsRecurringExpenses, updateChargeCardsRecurringExpenses, updateChargeCardsRecurringExpensesFetchState, sendOtpCardHolder, resendOtpCardHolder, sendOtpCardHolderSuccess, sendOtpCardHolderFailure, verifyOtpCardHolder, verifyOtpCardHolderSuccess, verifyOtpCardHolderFailure, clearChargeCardDetail, } = chargeCardDetail.actions;
|
|
637
674
|
export default chargeCardDetail.reducer;
|
package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js
CHANGED
|
@@ -13,13 +13,24 @@ export const fetchChargeCardDetailEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
13
13
|
const chargeCardAction = [];
|
|
14
14
|
const state = state$.value;
|
|
15
15
|
const chargeCardDetail = recordGet(state.chargeCardDetailState.detailById, chargeCardId, undefined);
|
|
16
|
+
// Skip if a user-triggered fetch is already in-flight (not applicable
|
|
17
|
+
// to cacheOverride/Pusher refreshes, which always proceed).
|
|
16
18
|
if (cacheOverride === true ||
|
|
17
19
|
chargeCardDetail == null ||
|
|
18
20
|
chargeCardDetail.fetchState !== 'In-Progress') {
|
|
21
|
+
// Silent refresh: preserve fetchState to avoid skeleton flash.
|
|
22
|
+
// Discriminate via fetchState (not null-check) because the reducer
|
|
23
|
+
// always creates an entry before the epic runs.
|
|
24
|
+
const isSilentRefresh = cacheOverride === true &&
|
|
25
|
+
chargeCardDetail != null &&
|
|
26
|
+
chargeCardDetail.fetchState !== 'Not-Started';
|
|
19
27
|
chargeCardAction.push(updateChargeCardDetailFetchState({
|
|
20
28
|
chargeCardId,
|
|
21
|
-
isRefreshingViewInBackground:
|
|
22
|
-
fetchState:
|
|
29
|
+
isRefreshingViewInBackground: isSilentRefresh,
|
|
30
|
+
fetchState: isSilentRefresh
|
|
31
|
+
? chargeCardDetail.fetchState
|
|
32
|
+
: 'In-Progress',
|
|
33
|
+
error: isSilentRefresh ? chargeCardDetail.error : undefined,
|
|
23
34
|
}));
|
|
24
35
|
const query = {
|
|
25
36
|
is_include_card_activation_events: true,
|
|
@@ -37,6 +48,8 @@ export const fetchChargeCardDetailEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
37
48
|
}));
|
|
38
49
|
}
|
|
39
50
|
else {
|
|
51
|
+
// Surface errors even on silent refresh so the user
|
|
52
|
+
// knows data is stale (follow-up: consider toast instead).
|
|
40
53
|
return of(updateChargeCardDetailFetchState({
|
|
41
54
|
chargeCardId,
|
|
42
55
|
fetchState: 'Error',
|
|
@@ -45,6 +58,7 @@ export const fetchChargeCardDetailEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
45
58
|
}));
|
|
46
59
|
}
|
|
47
60
|
}), catchError((error) => {
|
|
61
|
+
// Surface network failures even on silent refresh.
|
|
48
62
|
return of(updateChargeCardDetailFetchState({
|
|
49
63
|
chargeCardId,
|
|
50
64
|
fetchState: 'Error',
|
package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js
CHANGED
|
@@ -15,15 +15,16 @@ export const fetchChargeCardDetailPageEpic = (actions$, state$) => actions$.pipe
|
|
|
15
15
|
? exsitingChargeCardDetail.transactionList.uiState.pageTokenType
|
|
16
16
|
: null;
|
|
17
17
|
if (cacheOverride === true) {
|
|
18
|
+
// Forward cacheOverride to all sub-fetches to prevent skeleton flash.
|
|
18
19
|
chargeCardTransactionListAction.push(fetchChargeCardDetail(chargeCardId, cacheOverride));
|
|
19
20
|
//latest transactions need to be fetched hence removing pageToken and pageTokenType
|
|
20
|
-
chargeCardTransactionListAction.push(fetchChargeCardTransactionList(chargeCardId, null, null));
|
|
21
|
-
chargeCardTransactionListAction.push(fetchChargeCardConfig());
|
|
21
|
+
chargeCardTransactionListAction.push(fetchChargeCardTransactionList(chargeCardId, null, null, true));
|
|
22
|
+
chargeCardTransactionListAction.push(fetchChargeCardConfig(true));
|
|
22
23
|
if (doFetchCreditAccounts && isCreditCardEnabled) {
|
|
23
|
-
chargeCardTransactionListAction.push(fetchCreditAccount());
|
|
24
|
+
chargeCardTransactionListAction.push(fetchCreditAccount(true));
|
|
24
25
|
}
|
|
25
26
|
if (doFetchCreditAccounts && isCreditCardEnabled) {
|
|
26
|
-
chargeCardTransactionListAction.push(fetchCreditAccountRepayment());
|
|
27
|
+
chargeCardTransactionListAction.push(fetchCreditAccountRepayment(true));
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
else {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { toAmount } from '../../../../commonStateTypes/amount';
|
|
3
|
+
import { createCacheOverrideFetchReducer } from '../../../../commonStateTypes/cacheOverrideFetchReducer';
|
|
3
4
|
import { date } from '../../../../zeniDayJS';
|
|
4
5
|
import { initialCreditAcc, initialCreditAccountRepayment, initialDebitCardSummaries, initialResendRevokeCardInvite, toCreditAccountStatusType, } from './chargeCardList';
|
|
5
6
|
export const initialState = {
|
|
@@ -43,6 +44,10 @@ export const initialState = {
|
|
|
43
44
|
revokeCardInvite: initialResendRevokeCardInvite,
|
|
44
45
|
creditAccountRepayment: initialCreditAccountRepayment,
|
|
45
46
|
};
|
|
47
|
+
// Silent-Pusher-refresh contract: when cacheOverride=true, fetch reducers
|
|
48
|
+
// leave fetchState and error unchanged so the list page's reduceFetchState
|
|
49
|
+
// selector stays 'Completed' and doesn't flash ChargeCardListLoading.
|
|
50
|
+
// See createCacheOverrideFetchReducer for details.
|
|
46
51
|
const chargeCardList = createSlice({
|
|
47
52
|
name: 'chargeCardList',
|
|
48
53
|
initialState,
|
|
@@ -62,10 +67,10 @@ const chargeCardList = createSlice({
|
|
|
62
67
|
};
|
|
63
68
|
},
|
|
64
69
|
},
|
|
65
|
-
fetchCreditAccountRepayment(draft) {
|
|
70
|
+
fetchCreditAccountRepayment: createCacheOverrideFetchReducer((draft) => {
|
|
66
71
|
draft.creditAccountRepayment.fetchState = 'In-Progress';
|
|
67
72
|
draft.creditAccountRepayment.error = undefined;
|
|
68
|
-
},
|
|
73
|
+
}),
|
|
69
74
|
updateCreditAccountRepaymentAmountAndDate(draft, action) {
|
|
70
75
|
draft.creditAccountRepayment.initiatedRepayments = action.payload.amount;
|
|
71
76
|
draft.creditAccountRepayment.initiatedRepaymentDate = action.payload.date;
|
|
@@ -83,10 +88,10 @@ const chargeCardList = createSlice({
|
|
|
83
88
|
updateRowActionCardId(draft, action) {
|
|
84
89
|
draft.rowActionCardId = action.payload;
|
|
85
90
|
},
|
|
86
|
-
fetchCreditAccount(draft) {
|
|
91
|
+
fetchCreditAccount: createCacheOverrideFetchReducer((draft) => {
|
|
87
92
|
draft.creditAccount.fetchState = 'In-Progress';
|
|
88
93
|
draft.creditAccount.error = undefined;
|
|
89
|
-
},
|
|
94
|
+
}),
|
|
90
95
|
updateCreditAccount(draft, action) {
|
|
91
96
|
if (action.payload.length > 0) {
|
|
92
97
|
draft.creditAccount = toCreditAccount(action.payload[0]);
|
|
@@ -99,10 +104,10 @@ const chargeCardList = createSlice({
|
|
|
99
104
|
error: action.payload,
|
|
100
105
|
};
|
|
101
106
|
},
|
|
102
|
-
fetchDebitCardSummary(draft) {
|
|
107
|
+
fetchDebitCardSummary: createCacheOverrideFetchReducer((draft) => {
|
|
103
108
|
draft.debitCardSummaries.fetchState = 'In-Progress';
|
|
104
109
|
draft.debitCardSummaries.error = undefined;
|
|
105
|
-
},
|
|
110
|
+
}),
|
|
106
111
|
updateDebitCardSummary(draft, action) {
|
|
107
112
|
draft.debitCardSummaries = toDebitCardSummaries(action.payload);
|
|
108
113
|
},
|
|
@@ -113,10 +118,10 @@ const chargeCardList = createSlice({
|
|
|
113
118
|
error: action.payload,
|
|
114
119
|
};
|
|
115
120
|
},
|
|
116
|
-
fetchChargeCardList(draft) {
|
|
121
|
+
fetchChargeCardList: createCacheOverrideFetchReducer((draft) => {
|
|
117
122
|
draft.fetchState = 'In-Progress';
|
|
118
123
|
draft.error = undefined;
|
|
119
|
-
},
|
|
124
|
+
}),
|
|
120
125
|
updateChargeCardList(draft, action) {
|
|
121
126
|
const { cards, unassigned_credit } = action.payload.chargeCardListPayload;
|
|
122
127
|
const newCard = cards.map((card) => card.card_id);
|
|
@@ -152,6 +157,18 @@ const chargeCardList = createSlice({
|
|
|
152
157
|
draft.uiState.scrollYOffset = action.payload.uiState.scrollYOffset;
|
|
153
158
|
}
|
|
154
159
|
},
|
|
160
|
+
updateCreditAccountBalanceFromPusher(draft, action) {
|
|
161
|
+
const { currencyCode, currencySymbol } = action.payload;
|
|
162
|
+
const amt = (v) => v !== undefined ? toAmount(v, currencyCode, currencySymbol) : undefined;
|
|
163
|
+
draft.creditAccount.available =
|
|
164
|
+
amt(action.payload.available) ?? draft.creditAccount.available;
|
|
165
|
+
draft.creditAccount.balance =
|
|
166
|
+
amt(action.payload.balance) ?? draft.creditAccount.balance;
|
|
167
|
+
draft.creditAccount.hold =
|
|
168
|
+
amt(action.payload.hold) ?? draft.creditAccount.hold;
|
|
169
|
+
draft.creditAccount.cashback =
|
|
170
|
+
amt(action.payload.cashback) ?? draft.creditAccount.cashback;
|
|
171
|
+
},
|
|
155
172
|
clearChargeCardList(draft) {
|
|
156
173
|
Object.assign(draft, initialState);
|
|
157
174
|
},
|
|
@@ -307,7 +324,7 @@ const chargeCardList = createSlice({
|
|
|
307
324
|
},
|
|
308
325
|
},
|
|
309
326
|
});
|
|
310
|
-
export const { fetchChargeCardListPage, fetchCreditAccountRepayment, updateCreditAccountRepayment, updateCreditAccountRepaymentFailure, updateCreditAccountRepaymentAmountAndDate, updateRowActionCardId, fetchCreditAccount, updateCreditAccount, updateCreditAccountFailure, fetchDebitCardSummary, updateDebitCardSummary, updateDebitCardSummaryFailure, fetchChargeCardList, updateChargeCardList, updateChargeCardListFailure, updateSearchText, updateBulkActionCardIds, updateChargeCardListUIState, clearChargeCardList, resendCardInvite, resendCardInviteSuccess, resendCardInviteFailure, revokeCardInvite, revokeCardInviteSuccess, revokeCardInviteFailure, updateChargeCardsSpendLimit, updateChargeCardsSpendLimitSuccessOrFailure, lockChargeCards, lockChargeCardsSuccessOrFailure, unlockChargeCards, unlockChargeCardsSuccessOrFailure, closeChargeCards, closeChargeCardsSuccessOrFailure, revokeChargeCardsInvite, revokeChargeCardsInviteSuccessOrFailure, } = chargeCardList.actions;
|
|
327
|
+
export const { fetchChargeCardListPage, fetchCreditAccountRepayment, updateCreditAccountRepayment, updateCreditAccountRepaymentFailure, updateCreditAccountRepaymentAmountAndDate, updateRowActionCardId, fetchCreditAccount, updateCreditAccount, updateCreditAccountFailure, fetchDebitCardSummary, updateDebitCardSummary, updateDebitCardSummaryFailure, fetchChargeCardList, updateChargeCardList, updateChargeCardListFailure, updateSearchText, updateBulkActionCardIds, updateChargeCardListUIState, updateCreditAccountBalanceFromPusher, clearChargeCardList, resendCardInvite, resendCardInviteSuccess, resendCardInviteFailure, revokeCardInvite, revokeCardInviteSuccess, revokeCardInviteFailure, updateChargeCardsSpendLimit, updateChargeCardsSpendLimitSuccessOrFailure, lockChargeCards, lockChargeCardsSuccessOrFailure, unlockChargeCards, unlockChargeCardsSuccessOrFailure, closeChargeCards, closeChargeCardsSuccessOrFailure, revokeChargeCardsInvite, revokeChargeCardsInviteSuccessOrFailure, } = chargeCardList.actions;
|
|
311
328
|
export default chargeCardList.reducer;
|
|
312
329
|
// helper
|
|
313
330
|
const toCreditAccount = (payload) => ({
|
package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js
CHANGED
|
@@ -14,18 +14,21 @@ export const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe(f
|
|
|
14
14
|
const state = state$.value;
|
|
15
15
|
const cashbackDetailState = state.cashbackDetailState;
|
|
16
16
|
if (cacheOverride === true) {
|
|
17
|
+
// Forward cacheOverride to all sub-fetches to prevent skeleton flash.
|
|
17
18
|
if (doFetchCreditAccountsDebitSummaryAndCashback === true) {
|
|
18
19
|
if (isCreditCardEnabled) {
|
|
19
|
-
chargeCardListPageAction.push(fetchCreditAccount());
|
|
20
|
-
chargeCardListPageAction.push(fetchCreditAccountRepayment());
|
|
20
|
+
chargeCardListPageAction.push(fetchCreditAccount(true));
|
|
21
|
+
chargeCardListPageAction.push(fetchCreditAccountRepayment(true));
|
|
21
22
|
}
|
|
22
23
|
if (isDebitCardEnabled) {
|
|
23
|
-
chargeCardListPageAction.push(fetchDebitCardSummary());
|
|
24
|
+
chargeCardListPageAction.push(fetchDebitCardSummary(true));
|
|
24
25
|
}
|
|
25
|
-
chargeCardListPageAction.push(fetchCashbackDetail());
|
|
26
|
+
chargeCardListPageAction.push(fetchCashbackDetail(true));
|
|
26
27
|
}
|
|
27
|
-
chargeCardListPageAction.push(fetchChargeCardList());
|
|
28
|
-
|
|
28
|
+
chargeCardListPageAction.push(fetchChargeCardList(true));
|
|
29
|
+
// Config participates in the list page's reduceFetchState — needs cacheOverride.
|
|
30
|
+
chargeCardListPageAction.push(fetchChargeCardConfig(true));
|
|
31
|
+
// These don't participate in the list page's reduceFetchState.
|
|
29
32
|
chargeCardListPageAction.push(fetchUserListByType('cardHolderCandidate', true));
|
|
30
33
|
chargeCardListPageAction.push(fetchUserListByType('cardAdmin', true));
|
|
31
34
|
chargeCardListPageAction.push(fetchClassList());
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import { createCacheOverrideFetchReducer } from '../../../../commonStateTypes/cacheOverrideFetchReducer';
|
|
2
3
|
import { initialChargeCardPaymentHistoryState, } from './chargeCardPaymentHistory';
|
|
3
4
|
export const initialState = initialChargeCardPaymentHistoryState;
|
|
4
5
|
const chargeCardPaymentHistory = createSlice({
|
|
@@ -17,10 +18,10 @@ const chargeCardPaymentHistory = createSlice({
|
|
|
17
18
|
};
|
|
18
19
|
},
|
|
19
20
|
},
|
|
20
|
-
fetchChargeCardPaymentHistory(draft) {
|
|
21
|
+
fetchChargeCardPaymentHistory: createCacheOverrideFetchReducer((draft) => {
|
|
21
22
|
draft.fetchState = 'In-Progress';
|
|
22
23
|
draft.error = undefined;
|
|
23
|
-
},
|
|
24
|
+
}),
|
|
24
25
|
updateChargeCardPaymentHistory(draft, action) {
|
|
25
26
|
const payload = action.payload;
|
|
26
27
|
draft.creditAccountId = payload.credit_account_id;
|
|
@@ -8,7 +8,7 @@ export const fetchChargeCardPaymentPageEpic = (actions$, state$) => actions$.pip
|
|
|
8
8
|
const state = state$.value;
|
|
9
9
|
const chargeCardPaymentHistoryState = state.chargeCardPaymentHistoryState;
|
|
10
10
|
if (cacheOverride === true) {
|
|
11
|
-
chargeCardPaymentPageActions.push(fetchChargeCardPaymentHistory());
|
|
11
|
+
chargeCardPaymentPageActions.push(fetchChargeCardPaymentHistory(true));
|
|
12
12
|
}
|
|
13
13
|
else {
|
|
14
14
|
if (chargeCardPaymentHistoryState.fetchState !== 'Completed' &&
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import { createCacheOverrideFetchReducer } from '../../../../commonStateTypes/cacheOverrideFetchReducer';
|
|
2
3
|
export const initialState = {
|
|
3
4
|
localData: {
|
|
4
5
|
amount: {
|
|
@@ -17,9 +18,12 @@ const chargeCardRepaymentDetail = createSlice({
|
|
|
17
18
|
name: 'chargeCardRepaymentDetail',
|
|
18
19
|
initialState,
|
|
19
20
|
reducers: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
// No-op reducer — fetchState is managed by the Pay flow reducers.
|
|
22
|
+
// Uses createCacheOverrideFetchReducer for API consistency with the
|
|
23
|
+
// silent-refresh family (cacheOverride flag at dispatch site).
|
|
24
|
+
fetchChargeCardRepaymentDetail: createCacheOverrideFetchReducer(() => {
|
|
25
|
+
// do nothing
|
|
26
|
+
}),
|
|
23
27
|
updateChargeCardRepaymentLocalStore(draft, action) {
|
|
24
28
|
draft.localData = action.payload;
|
|
25
29
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter,
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
3
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
4
|
import { mapCannedResponsePayloadToCannedResponse, } from '../cannedResponsesPayload';
|
|
5
5
|
import { fetchCannedResponses, updateCannedResponses, updateCannedResponsesFetchStatus, } from '../cannedResponsesReducer';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter,
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
3
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
4
|
import { fetchCannedResponses, saveCannedResponse, saveCannedResponseFailure, saveCannedResponseSuccess, } from '../cannedResponsesReducer';
|
|
5
5
|
export const saveCannedResponseEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(saveCannedResponse.match), switchMap((action) => {
|
|
@@ -4,7 +4,7 @@ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
|
4
4
|
import { updateTasks } from '../../../../entity/task/taskReducer';
|
|
5
5
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
6
6
|
import { fetchTaskList, removeTaskFromList, } from '../../taskListView/taskListReducer';
|
|
7
|
-
import { snoozeTaskSuccessOrFailure, unsnoozeTask
|
|
7
|
+
import { snoozeTaskSuccessOrFailure, unsnoozeTask } from '../taskDetailReducer';
|
|
8
8
|
export const unsnoozeTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(unsnoozeTask.match), mergeMap((action) => handleUnsnoozeTask(action.payload.taskId, zeniAPI)));
|
|
9
9
|
const handleUnsnoozeTask = (taskId, zeniAPI) => {
|
|
10
10
|
const unsnoozeTaskApi$ = zeniAPI.deleteAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}/snooze`);
|
|
@@ -56,7 +56,13 @@ export const getTransactionDetail = (state, transactionId, fetchLinkedTransactio
|
|
|
56
56
|
const isAccountingClassesEnabled = getIsAccountingClassesEnabled(state);
|
|
57
57
|
const classList = isAccountingClassesEnabled
|
|
58
58
|
? getClassList(classState, classListState)
|
|
59
|
-
: {
|
|
59
|
+
: {
|
|
60
|
+
classes: [],
|
|
61
|
+
nestedClassHierarchy: [],
|
|
62
|
+
fetchState: 'Completed',
|
|
63
|
+
error: undefined,
|
|
64
|
+
version: 0,
|
|
65
|
+
};
|
|
60
66
|
const isAccountingProjectsEnabled = getIsAccountingProjectsEnabled(state);
|
|
61
67
|
const projectList = isAccountingProjectsEnabled
|
|
62
68
|
? getProjectList(projectState, projectListState)
|