@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
|
@@ -2,7 +2,8 @@ import { CompletionStatusType, FetchStateAndError, ID } from '../../../commonSta
|
|
|
2
2
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
3
3
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
4
|
import { SupportedTransaction } from '../../../entity/transaction/transactionState';
|
|
5
|
-
import type {
|
|
5
|
+
import type { CompletedSubTab } from '../types/completedSubTab';
|
|
6
|
+
import type { BatchFileStatus, BatchListItem, BatchStatus, BulkUploadPhase, BulkUploadResultsTab, BulkUploadSortKey, ManualSearchState, MatchSource, MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
6
7
|
export interface CompletedTransactionsSelectorData {
|
|
7
8
|
fetchState: FetchStateAndError;
|
|
8
9
|
nextPageToken: string | null;
|
|
@@ -7,6 +7,7 @@ import { ClassBase } from '../../../entity/class/classState';
|
|
|
7
7
|
import { SupportedTransactionWithCOT } from '../../../entity/transaction/transactionState';
|
|
8
8
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
9
9
|
import { ProjectListSelectorView } from '../../projectList/projectListSelector';
|
|
10
|
+
import { CompletedSubTab } from '../types/completedSubTab';
|
|
10
11
|
import { TransactionReviewLocalData, TransactionsTab, TransactionsViewUIState } from '../types/transactionsViewState';
|
|
11
12
|
export interface TransactionReviewLocalDataSelectorView {
|
|
12
13
|
transactionId: ID;
|
|
@@ -21,10 +22,23 @@ export interface ExpenseAutomationTransactionViewSelector extends SelectorView {
|
|
|
21
22
|
fetchStateByTransactionTabs: Record<TransactionsTab, FetchStateAndError>;
|
|
22
23
|
isAccountingProjectsEnabled: boolean;
|
|
23
24
|
markAsNotMiscategorizedStatus: FetchStateAndError;
|
|
25
|
+
/**
|
|
26
|
+
* Parent tab badge counts, sourced from the listing response's
|
|
27
|
+
* `parent_tab_total_count`. Used exclusively to drive the navbar / tab
|
|
28
|
+
* strip badge labels — every other count consumer (pagination, in-list
|
|
29
|
+
* "showing X of Y", save flows) keeps reading {@link totalCountByTab}.
|
|
30
|
+
*/
|
|
31
|
+
parentTabTotalCountByTab: Record<TransactionsTab, number>;
|
|
24
32
|
projectList: ProjectListSelectorView;
|
|
25
33
|
refreshStatus: FetchStateAndError;
|
|
26
34
|
saveStatus: FetchStateAndError;
|
|
27
35
|
selectedCheckBoxTransactionIds: ID[];
|
|
36
|
+
selectedTransactionCategorizationCompletedSubTab: CompletedSubTab;
|
|
37
|
+
/**
|
|
38
|
+
* Per-(sub-)tab counts mirroring `total_count` from the listing response.
|
|
39
|
+
* Powers pagination via `InfiniteLoader.itemCount`, in-list count copy,
|
|
40
|
+
* and the `resetTransactionCategorizationLocalData` round-trip.
|
|
41
|
+
*/
|
|
28
42
|
totalCountByTab: Record<TransactionsTab, number>;
|
|
29
43
|
transactionIdsWithUnsavedData: ID[];
|
|
30
44
|
transactionLocalData: TransactionReviewLocalDataSelectorView[];
|
|
@@ -16,7 +16,7 @@ const projectListSelector_1 = require("../../projectList/projectListSelector");
|
|
|
16
16
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
17
17
|
function getExpenseAutomationTransactionView(state) {
|
|
18
18
|
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
19
|
-
const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
|
|
19
|
+
const { selectedTransactionCategorizationCompletedSubTab, selectedTransactionCategorizationTab, } = expenseAutomationTransactionsViewState;
|
|
20
20
|
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
21
21
|
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(accountState, accountListState, 'accountList');
|
|
22
22
|
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
|
|
@@ -69,10 +69,27 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
69
69
|
.uiState.totalCount;
|
|
70
70
|
const totalCountByAutoCat = expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
71
71
|
.autoCategorized.uiState.totalCount;
|
|
72
|
+
// Per-(sub-)tab counts powering pagination, in-list "showing X of Y", and
|
|
73
|
+
// any save/refresh round-trips. Sourced from `uiState.totalCount` which
|
|
74
|
+
// mirrors the response's `total_count` for whatever tab/sub-tab the user is
|
|
75
|
+
// viewing (e.g. only the Manual sub-tab rows for Completed → Manual).
|
|
72
76
|
const totalCountByTab = {
|
|
73
77
|
review: monthYearPeriodId != null ? totalCountByReview[monthYearPeriodId] : 0,
|
|
74
78
|
autoCategorized: monthYearPeriodId != null ? totalCountByAutoCat[monthYearPeriodId] : 0,
|
|
75
79
|
};
|
|
80
|
+
// Parent-tab badge counts. Sourced from `parent_tab_total_count` in the
|
|
81
|
+
// listing response and used exclusively by the navbar / tab strip badges.
|
|
82
|
+
// Independent of which Completed sub-tab is active so the badge stays
|
|
83
|
+
// stable across sub-tab switches.
|
|
84
|
+
const parentTotalCountByTab = expenseAutomationTransactionsViewState.parentTotalCountByTab;
|
|
85
|
+
const parentTabTotalCountByTab = {
|
|
86
|
+
review: monthYearPeriodId != null
|
|
87
|
+
? (parentTotalCountByTab.review[monthYearPeriodId] ?? 0)
|
|
88
|
+
: 0,
|
|
89
|
+
autoCategorized: monthYearPeriodId != null
|
|
90
|
+
? (parentTotalCountByTab.autoCategorized[monthYearPeriodId] ?? 0)
|
|
91
|
+
: 0,
|
|
92
|
+
};
|
|
76
93
|
const fetchStateByTab = {
|
|
77
94
|
review: {
|
|
78
95
|
fetchState: expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
@@ -114,9 +131,11 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
114
131
|
markAsNotMiscategorizedStatus,
|
|
115
132
|
completionStatus,
|
|
116
133
|
totalCountByTab,
|
|
134
|
+
parentTabTotalCountByTab,
|
|
117
135
|
fetchStateByTransactionTabs: fetchStateByTab,
|
|
118
136
|
uploadReceiptStatusById,
|
|
119
137
|
selectedTransactionId,
|
|
120
138
|
selectedTransactionLineId,
|
|
139
|
+
selectedTransactionCategorizationCompletedSubTab,
|
|
121
140
|
};
|
|
122
141
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const toCompletedSubTab: (v: string) => "all" | "manual" | "ai_accountant";
|
|
2
|
+
export type CompletedSubTab = ReturnType<typeof toCompletedSubTab>;
|
|
3
|
+
/**
|
|
4
|
+
* "No sub-tab filter" sentinel — single source of truth for the default
|
|
5
|
+
* value of {@link CompletedSubTab}. Use this constant in initial slice
|
|
6
|
+
* state and at any call site that needs to fall back to the parent-tab
|
|
7
|
+
* listing semantics (review tab requests, manual-search overrides, etc.)
|
|
8
|
+
* so a future rename of the union doesn't require chasing literals.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_COMPLETED_SUB_TAB: CompletedSubTab;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_COMPLETED_SUB_TAB = exports.toCompletedSubTab = void 0;
|
|
4
|
+
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
|
+
/**
|
|
6
|
+
* Sub-tabs that can appear under any "Completed" tab in the Expense Automation
|
|
7
|
+
* surface (Transaction Categorization Completed and Missing Receipts Completed
|
|
8
|
+
* both use this exact union). Forwarded verbatim to listing APIs as `sub_tab`
|
|
9
|
+
* / `match_type`. `'all'` preserves parent-tab semantics on the backend.
|
|
10
|
+
*/
|
|
11
|
+
const COMPLETED_SUB_TABS = ['all', 'ai_accountant', 'manual'];
|
|
12
|
+
const toCompletedSubTab = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), COMPLETED_SUB_TABS);
|
|
13
|
+
exports.toCompletedSubTab = toCompletedSubTab;
|
|
14
|
+
/**
|
|
15
|
+
* "No sub-tab filter" sentinel — single source of truth for the default
|
|
16
|
+
* value of {@link CompletedSubTab}. Use this constant in initial slice
|
|
17
|
+
* state and at any call site that needs to fall back to the parent-tab
|
|
18
|
+
* listing semantics (review tab requests, manual-search overrides, etc.)
|
|
19
|
+
* so a future rename of the union doesn't require chasing literals.
|
|
20
|
+
*/
|
|
21
|
+
exports.DEFAULT_COMPLETED_SUB_TAB = 'all';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
3
3
|
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
4
|
+
import { CompletedSubTab } from './completedSubTab';
|
|
4
5
|
export declare const toMissingReceiptsSortKey: (v: string) => "date" | "amount" | "vendor" | "category" | "class";
|
|
5
6
|
export type MissingReceiptsSortKey = ReturnType<typeof toMissingReceiptsSortKey>;
|
|
6
7
|
export interface MissingReceiptsViewUIState {
|
|
@@ -31,8 +32,6 @@ export declare const toBulkUploadResultsTab: (v: string) => "completed" | "unmat
|
|
|
31
32
|
export type BulkUploadResultsTab = ReturnType<typeof toBulkUploadResultsTab>;
|
|
32
33
|
export declare const toMissingReceiptsTab: (v: string) => "completed" | "unmatched" | "missing";
|
|
33
34
|
export type MissingReceiptsTab = ReturnType<typeof toMissingReceiptsTab>;
|
|
34
|
-
export declare const toCompletedSubTab: (v: string) => "all" | "manual" | "ai_accountant";
|
|
35
|
-
export type CompletedSubTab = ReturnType<typeof toCompletedSubTab>;
|
|
36
35
|
export declare const toMatchSource: (v: string) => "manual" | "ai";
|
|
37
36
|
export type MatchSource = ReturnType<typeof toMatchSource>;
|
|
38
37
|
export declare const toBulkUploadSortKey: (v: string) => "date" | "amount" | "vendor" | "category" | "class";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toBulkUploadSortKey = exports.toMatchSource = exports.
|
|
3
|
+
exports.toBulkUploadSortKey = exports.toMatchSource = exports.toMissingReceiptsTab = exports.toBulkUploadResultsTab = exports.toBulkUploadPhase = exports.toBatchFileStatus = exports.BATCH_FILE_STATUSES = exports.toBatchStatusValue = exports.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH = exports.toMissingReceiptsSortKey = void 0;
|
|
4
4
|
exports.isUnmatchedTabFileStatus = isUnmatchedTabFileStatus;
|
|
5
5
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
6
6
|
const MISSING_RECEIPTS_SORT_KEYS = [
|
|
@@ -49,9 +49,6 @@ exports.toBulkUploadResultsTab = toBulkUploadResultsTab;
|
|
|
49
49
|
const MISSING_RECEIPTS_TABS = ['missing', 'completed', 'unmatched'];
|
|
50
50
|
const toMissingReceiptsTab = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), MISSING_RECEIPTS_TABS);
|
|
51
51
|
exports.toMissingReceiptsTab = toMissingReceiptsTab;
|
|
52
|
-
const COMPLETED_SUB_TABS = ['all', 'ai_accountant', 'manual'];
|
|
53
|
-
const toCompletedSubTab = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), COMPLETED_SUB_TABS);
|
|
54
|
-
exports.toCompletedSubTab = toCompletedSubTab;
|
|
55
52
|
const MATCH_SOURCES = ['ai', 'manual'];
|
|
56
53
|
const toMatchSource = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), MATCH_SOURCES);
|
|
57
54
|
exports.toMatchSource = toMatchSource;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
|
-
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
2
|
+
import { FetchState, FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
3
3
|
import { Recommendation, RecommendationWithCOT } from '../../../commonStateTypes/recommendationBase';
|
|
4
4
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
5
5
|
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
@@ -7,15 +7,17 @@ import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport
|
|
|
7
7
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
8
8
|
import { ClassBase } from '../../../entity/class/classState';
|
|
9
9
|
import { CustomerBase } from '../../../entity/customer/customerState';
|
|
10
|
-
import { ProjectBase } from '../../../entity/project/projectState';
|
|
11
10
|
import { Entity, EntityType } from '../../../entity/genericEntity/entity';
|
|
11
|
+
import { ProjectBase } from '../../../entity/project/projectState';
|
|
12
12
|
import { TransactionID } from '../../../entity/transaction/stateTypes/transaction';
|
|
13
13
|
import { BillableStatus, CategorizationStatusType, PlatformLineDetailType, ProductOrService, TransactionLineBase } from '../../../entity/transaction/stateTypes/transactionLine';
|
|
14
14
|
import { TransactionCategory, TransactionType } from '../../../entity/transaction/stateTypes/transactionType';
|
|
15
15
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
16
|
+
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
16
17
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
17
18
|
import { EntityRecommendationKey } from '../../recommendation/recommendationState';
|
|
18
19
|
import { TransactionDetailKey } from '../../transactionDetail/transactionDetailState';
|
|
20
|
+
import { CompletedSubTab } from './completedSubTab';
|
|
19
21
|
export declare const toTransactionsSortKey: (v: string) => "date" | "amount" | "vendor" | "project" | "category" | "class" | "payment_account" | "transaction_type" | "memo_and_receipt";
|
|
20
22
|
export type TransactionsSortKey = ReturnType<typeof toTransactionsSortKey>;
|
|
21
23
|
export declare const TRANSACTIONS_TABS: readonly ["review", "autoCategorized"];
|
|
@@ -103,7 +105,44 @@ export interface TransactionsTabViewState extends FetchedState {
|
|
|
103
105
|
selectedTransactionId?: ID;
|
|
104
106
|
selectedTransactionLineId?: ID;
|
|
105
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Snapshot of the autoCategorized tab's paginated dataset for a single
|
|
110
|
+
* Completed sub-tab. Stored in {@link TransactionsViewState.autoCategorizedSubTabCache}
|
|
111
|
+
* so revisiting an already-loaded sub-tab can short-circuit the fetch epic
|
|
112
|
+
* (mirrors parent-tab caching). The snapshot is period-spanning — both the
|
|
113
|
+
* `totalCount` map and `transactionIdsBySelectedPeriod` map preserve every
|
|
114
|
+
* period the user has paged through under that sub-tab.
|
|
115
|
+
*
|
|
116
|
+
* `scrollPosition` is captured per sub-tab so revisiting a sub-tab restores
|
|
117
|
+
* the user's last scroll offset; switching to a fresh / never-visited sub-tab
|
|
118
|
+
* starts at the top instead of inheriting the previous sub-tab's offset.
|
|
119
|
+
*/
|
|
120
|
+
export interface AutoCategorizedSubTabSnapshot {
|
|
121
|
+
error: ZeniAPIStatus | undefined;
|
|
122
|
+
fetchState: FetchState;
|
|
123
|
+
pageToken: PageToken;
|
|
124
|
+
scrollPosition: TransactionsViewUIState['scrollPosition'];
|
|
125
|
+
totalCount: Record<MonthYearPeriodId, number>;
|
|
126
|
+
transactionIdsBySelectedPeriod: Record<MonthYearPeriodId, ID[]>;
|
|
127
|
+
}
|
|
106
128
|
export type TransactionsViewState = {
|
|
129
|
+
/**
|
|
130
|
+
* Per-sub-tab snapshot cache for the Completed (autoCategorized) tab. Keyed
|
|
131
|
+
* by {@link CompletedSubTab}. Populated as the user navigates between
|
|
132
|
+
* sub-tabs and consulted on every switch — the active autoCategorized slot
|
|
133
|
+
* is restored from here when a snapshot exists, otherwise it is reset and
|
|
134
|
+
* the fetch epic loads page 1 fresh.
|
|
135
|
+
*/
|
|
136
|
+
autoCategorizedSubTabCache: Partial<Record<CompletedSubTab, AutoCategorizedSubTabSnapshot>>;
|
|
137
|
+
/**
|
|
138
|
+
* Period-keyed parent tab counts, scoped per {@link TransactionsTab}.
|
|
139
|
+
* Sourced from the listing response's `parent_tab_total_count` and used
|
|
140
|
+
* exclusively to drive the parent tab badges on the UI — every other
|
|
141
|
+
* count consumer (pagination, sub-tab chips, in-tab "showing X of Y")
|
|
142
|
+
* keeps reading from {@link TransactionsViewUIState.totalCount}.
|
|
143
|
+
*/
|
|
144
|
+
parentTotalCountByTab: Record<TransactionsTab, Record<MonthYearPeriodId, number>>;
|
|
145
|
+
selectedTransactionCategorizationCompletedSubTab: CompletedSubTab;
|
|
107
146
|
selectedTransactionCategorizationTab: TransactionsTab;
|
|
108
147
|
transactionCategorizationView: Record<TransactionsTab, TransactionsTabViewState>;
|
|
109
148
|
};
|
|
@@ -5,6 +5,7 @@ const toolkit_1 = require("@reduxjs/toolkit");
|
|
|
5
5
|
const coaBalanceType_1 = require("../../commonStateTypes/coaBalance/coaBalanceType");
|
|
6
6
|
const coaBalancesFilter_1 = require("../../commonStateTypes/coaBalance/coaBalancesFilter");
|
|
7
7
|
const coaBalancesFilterClassesView_1 = require("../../commonStateTypes/coaBalance/coaBalancesFilterClassesView");
|
|
8
|
+
const coaBalancesFilterProjectView_1 = require("../../commonStateTypes/coaBalance/coaBalancesFilterProjectView");
|
|
8
9
|
const dataAvailable_1 = require("../../commonStateTypes/dataAvailable");
|
|
9
10
|
const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
|
|
10
11
|
const timeframeTick_1 = require("../../commonStateTypes/timeframeTick");
|
|
@@ -12,7 +13,6 @@ const thisPeriodHelpers_1 = require("../../commonStateTypes/viewAndReport/thisPe
|
|
|
12
13
|
const balanceSheetSelector_1 = require("../balanceSheet/balanceSheetSelector");
|
|
13
14
|
const cashFlowSelector_1 = require("../cashFlow/cashFlowSelector");
|
|
14
15
|
const profitAndLossSelector_1 = require("../profitAndLoss/profitAndLossSelector");
|
|
15
|
-
const coaBalancesFilterProjectView_1 = require("../../commonStateTypes/coaBalance/coaBalancesFilterProjectView");
|
|
16
16
|
const profitAndLossClassesByClassHorizontalSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector");
|
|
17
17
|
const profitAndLossClassesViewSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesViewSelector");
|
|
18
18
|
const profitAndLossProjectViewSelector_1 = require("../profitAndLossProjectView/profitAndLossProjectViewSelector");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SectionProjectViewReport } from '../../entity/sectionProjectView/sectionProjectViewSelectorTypes';
|
|
2
1
|
import { COABalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
|
|
3
2
|
import { ID } from '../../commonStateTypes/common';
|
|
4
3
|
import { DataAvailable } from '../../commonStateTypes/dataAvailable';
|
|
5
4
|
import { CalculatedSection } from '../../commonStateTypes/selectorTypes/selectorTypes';
|
|
6
5
|
import { SelectorReport } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
7
6
|
import { Project } from '../../entity/project/projectState';
|
|
7
|
+
import { SectionProjectViewReport } from '../../entity/sectionProjectView/sectionProjectViewSelectorTypes';
|
|
8
8
|
import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID } from '../profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
|
|
9
9
|
import { ProfitAndLossProjectViewUIState } from './profitAndLossProjectViewState';
|
|
10
10
|
export interface ProfitAndLossProjectViewReport extends SelectorReport {
|
|
@@ -2,7 +2,9 @@ import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
|
2
2
|
import { ChargeCardCashbackPayload } from './cashbackDetailPayload';
|
|
3
3
|
import { CashbackDetailState, CashbackDetailUIState } from './cashbackDetailState';
|
|
4
4
|
export declare const initialState: CashbackDetailState;
|
|
5
|
-
export declare const fetchCashbackDetail: import("@reduxjs/toolkit").
|
|
5
|
+
export declare const fetchCashbackDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: boolean | undefined], {
|
|
6
|
+
cacheOverride: boolean;
|
|
7
|
+
}, "cashbackDetail/fetchCashbackDetail", never, never>, updateCashbackDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChargeCardCashbackPayload, "cashbackDetail/updateCashbackDetail">, updateCashbackDetailFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "cashbackDetail/updateCashbackDetailFailure">, updateCashbackDetailUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
6
8
|
uiState: Partial<CashbackDetailUIState>;
|
|
7
9
|
}, "cashbackDetail/updateCashbackDetailUIState">, clearCashbackDetail: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cashbackDetail/clearCashbackDetail">;
|
|
8
10
|
declare const _default: import("redux").Reducer<CashbackDetailState>;
|
|
@@ -5,6 +5,7 @@ exports.clearCashbackDetail = exports.updateCashbackDetailUIState = exports.upda
|
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const viewAndReportPayloadv2_1 = require("../../../../commonPayloadTypes/v2/viewAndReportPayloadv2");
|
|
7
7
|
const amount_1 = require("../../../../commonStateTypes/amount");
|
|
8
|
+
const cacheOverrideFetchReducer_1 = require("../../../../commonStateTypes/cacheOverrideFetchReducer");
|
|
8
9
|
const cashbackDetailState_1 = require("./cashbackDetailState");
|
|
9
10
|
exports.initialState = {
|
|
10
11
|
fetchState: 'Not-Started',
|
|
@@ -31,10 +32,10 @@ const cashbackDetail = (0, toolkit_1.createSlice)({
|
|
|
31
32
|
name: 'cashbackDetail',
|
|
32
33
|
initialState: exports.initialState,
|
|
33
34
|
reducers: {
|
|
34
|
-
fetchCashbackDetail(draft) {
|
|
35
|
+
fetchCashbackDetail: (0, cacheOverrideFetchReducer_1.createCacheOverrideFetchReducer)((draft) => {
|
|
35
36
|
draft.fetchState = 'In-Progress';
|
|
36
37
|
draft.error = undefined;
|
|
37
|
-
},
|
|
38
|
+
}),
|
|
38
39
|
updateCashbackDetail(draft, action) {
|
|
39
40
|
draft.cashbackByPeriod = toCashbackByPeriod(action.payload);
|
|
40
41
|
draft.cashbackSummary = toCashbackSummary(action.payload);
|
|
@@ -2,6 +2,8 @@ import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
|
2
2
|
import { ChargeCardConfigPayload } from './chargeCardConfigPayload';
|
|
3
3
|
import { ChargeCardConfigState } from './chargeCardConfigState';
|
|
4
4
|
export declare const initialState: ChargeCardConfigState;
|
|
5
|
-
export declare const fetchChargeCardConfig: import("@reduxjs/toolkit").
|
|
5
|
+
export declare const fetchChargeCardConfig: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: boolean | undefined], {
|
|
6
|
+
cacheOverride: boolean;
|
|
7
|
+
}, "chargeCardConfig/fetchChargeCardConfig", never, never>, updateChargeCardConfig: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChargeCardConfigPayload, "chargeCardConfig/updateChargeCardConfig">, updateChargeCardConfigFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "chargeCardConfig/updateChargeCardConfigFailure">, clearChargeCardConfig: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardConfig/clearChargeCardConfig">;
|
|
6
8
|
declare const _default: import("redux").Reducer<ChargeCardConfigState>;
|
|
7
9
|
export default _default;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.clearChargeCardConfig = exports.updateChargeCardConfigFailure = exports.updateChargeCardConfig = exports.fetchChargeCardConfig = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const amount_1 = require("../../../../commonStateTypes/amount");
|
|
7
|
+
const cacheOverrideFetchReducer_1 = require("../../../../commonStateTypes/cacheOverrideFetchReducer");
|
|
7
8
|
const chargeCard_1 = require("../../../../entity/chargeCard/chargeCard");
|
|
8
9
|
const chargeCardConfigPayload_1 = require("./chargeCardConfigPayload");
|
|
9
10
|
exports.initialState = {
|
|
@@ -34,10 +35,10 @@ const chargeCardConfig = (0, toolkit_1.createSlice)({
|
|
|
34
35
|
name: 'chargeCardConfig',
|
|
35
36
|
initialState: exports.initialState,
|
|
36
37
|
reducers: {
|
|
37
|
-
fetchChargeCardConfig(draft) {
|
|
38
|
+
fetchChargeCardConfig: (0, cacheOverrideFetchReducer_1.createCacheOverrideFetchReducer)((draft) => {
|
|
38
39
|
draft.fetchState = 'In-Progress';
|
|
39
40
|
draft.error = undefined;
|
|
40
|
-
},
|
|
41
|
+
}),
|
|
41
42
|
updateChargeCardConfig(draft, action) {
|
|
42
43
|
const { payload } = action;
|
|
43
44
|
draft.creditLimitFrequency =
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.clearChargeCardDetail = exports.verifyOtpCardHolderFailure = exports.verifyOtpCardHolderSuccess = exports.verifyOtpCardHolder = exports.sendOtpCardHolderFailure = exports.sendOtpCardHolderSuccess = exports.resendOtpCardHolder = exports.sendOtpCardHolder = exports.updateChargeCardsRecurringExpensesFetchState = exports.updateChargeCardsRecurringExpenses = exports.fetchChargeCardsRecurringExpenses = exports.updateChargeCardTransactionStatisticsFetchState = exports.updateChargeCardTransactionStatistics = exports.fetchChargeCardTransactionStatistics = exports.updateDepositAccountLimitFetchStatus = exports.fetchDepositAccountLimit = exports.closeChargeCardSuccessOrFailure = exports.closeChargeCard = exports.unlockChargeCardSuccessOrFailure = exports.unlockChargeCard = exports.lockChargeCardSuccessOrFailure = exports.lockChargeCard = exports.updateChargeCardNameSuccessOrFailure = exports.updateChargeCardName = exports.updateChargeCardSpendLimitSuccessOrFailure = exports.updateChargeCardSpendLimit = exports.updateChargeCardDetailUpdateStatus = exports.completeDebitCardSetPinWait = exports.startDebitCardSetPinWait = exports.completeCVVActivationWait = exports.startCVVActivationWait = exports.updateChargeCardDetail = exports.updateChargeCardTransactionListFailure = exports.updateChargeCardTransactionAttachmentsInCardDetail = exports.updateChargeCardTransactionReceiptsShowTickFetchStatus = exports.updateDebitCardPinAttemptSuccessOrFailure = exports.updateDebitCardPinAttempt = exports.updatePhysicalChargeCardAttempt = exports.updatePhysicalChargeCardAttemptSuccessOrFailure = exports.updateChargeCardTransactionAttachmentsFailure = exports.updateChargeCardTransactionIsViewReceiptClicked = exports.fetchChargeCardTransactionAttachments = exports.updateChargeCardTransactionUploadReceiptsFetchStatus = exports.updateChargeCardTransactionList = exports.updateChargeCardDetailUIState = exports.fetchChargeCardTransactionList = exports.updateChargeCardDetailFetchState = exports.fetchChargeCardDetail = exports.fetchChargeCardDetailPage = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const sortOrderPayload_1 = require("../../../../commonPayloadTypes/sortOrderPayload");
|
|
7
|
+
const pusherActions_1 = require("../../../../commonStateTypes/pusherActions");
|
|
7
8
|
const attachmentPayload_1 = require("../../../../entity/transaction/payloadTypes/attachmentPayload");
|
|
8
9
|
const chargeCardDetail_1 = require("./chargeCardDetail");
|
|
9
10
|
exports.initialState = {
|
|
@@ -68,19 +69,30 @@ const chargeCardDetail = (0, toolkit_1.createSlice)({
|
|
|
68
69
|
},
|
|
69
70
|
fetchChargeCardTransactionList: {
|
|
70
71
|
reducer(draft, action) {
|
|
71
|
-
const { chargeCardId, pageToken, pageTokenType } = action.payload;
|
|
72
|
+
const { chargeCardId, pageToken, pageTokenType, cacheOverride } = action.payload;
|
|
72
73
|
const existingCardDetail = draft.detailById[chargeCardId] ?? chargeCardDetail_1.emptyChargeCardDetail;
|
|
74
|
+
const existingUi = existingCardDetail.transactionList.uiState;
|
|
75
|
+
// cacheOverride=true (Pusher): preserve fetchState, error, and scroll
|
|
76
|
+
// to avoid skeleton flash. Normal fetches reset as before.
|
|
73
77
|
draft.detailById[chargeCardId] = {
|
|
74
78
|
...existingCardDetail,
|
|
75
79
|
transactionList: {
|
|
76
80
|
...existingCardDetail.transactionList,
|
|
77
|
-
fetchState:
|
|
78
|
-
|
|
81
|
+
fetchState: cacheOverride
|
|
82
|
+
? existingCardDetail.transactionList.fetchState
|
|
83
|
+
: 'In-Progress',
|
|
84
|
+
error: cacheOverride
|
|
85
|
+
? existingCardDetail.transactionList.error
|
|
86
|
+
: undefined,
|
|
79
87
|
uiState: {
|
|
80
|
-
...
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
...existingUi,
|
|
89
|
+
// Preserve scroll on silent refresh so users aren't snapped
|
|
90
|
+
// away from their reading position.
|
|
91
|
+
scrollYOffset: cacheOverride
|
|
92
|
+
? existingUi.scrollYOffset
|
|
93
|
+
: existingUi.pageToken === null
|
|
94
|
+
? 0
|
|
95
|
+
: existingUi.scrollYOffset,
|
|
84
96
|
pageToken: pageToken,
|
|
85
97
|
pageTokenType: pageTokenType,
|
|
86
98
|
},
|
|
@@ -97,18 +109,24 @@ const chargeCardDetail = (0, toolkit_1.createSlice)({
|
|
|
97
109
|
const { chargeCardId, data, cacheOverride } = action.payload;
|
|
98
110
|
const existingCardDetail = draft.detailById[chargeCardId] ?? chargeCardDetail_1.emptyChargeCardDetail;
|
|
99
111
|
const newTransactionIds = data.transactions.map((tran) => tran.transaction_id);
|
|
112
|
+
const existingIds = existingCardDetail.transactionList.transactionIds;
|
|
113
|
+
// cacheOverride (Pusher): refresh page 1 but keep page 2+ IDs.
|
|
114
|
+
// Normal pagination: append new page, deduped.
|
|
115
|
+
const newIdSet = new Set(newTransactionIds);
|
|
116
|
+
const mergedTransactionIds = cacheOverride
|
|
117
|
+
? [
|
|
118
|
+
...newTransactionIds,
|
|
119
|
+
...existingIds.filter((id) => !newIdSet.has(id)),
|
|
120
|
+
]
|
|
121
|
+
: [
|
|
122
|
+
...existingIds,
|
|
123
|
+
...newTransactionIds.filter((id) => !existingIds.includes(id)),
|
|
124
|
+
];
|
|
100
125
|
draft.detailById[chargeCardId] = {
|
|
101
126
|
...existingCardDetail,
|
|
102
127
|
transactionList: {
|
|
103
128
|
...existingCardDetail.transactionList,
|
|
104
|
-
transactionIds:
|
|
105
|
-
...new Set([
|
|
106
|
-
...(cacheOverride
|
|
107
|
-
? []
|
|
108
|
-
: existingCardDetail.transactionList.transactionIds),
|
|
109
|
-
...newTransactionIds,
|
|
110
|
-
]),
|
|
111
|
-
],
|
|
129
|
+
transactionIds: mergedTransactionIds,
|
|
112
130
|
fetchState: 'Completed',
|
|
113
131
|
error: undefined,
|
|
114
132
|
uiState: {
|
|
@@ -120,9 +138,12 @@ const chargeCardDetail = (0, toolkit_1.createSlice)({
|
|
|
120
138
|
limit: data.query.limit,
|
|
121
139
|
pageToken: data.query.page_token,
|
|
122
140
|
pageTokenType: data.query.page_token_type,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
141
|
+
// Preserve scroll on silent refresh; reset on user-triggered first page.
|
|
142
|
+
scrollYOffset: cacheOverride
|
|
143
|
+
? existingCardDetail.transactionList.uiState.scrollYOffset
|
|
144
|
+
: existingCardDetail.transactionList.uiState.pageToken === null
|
|
145
|
+
? 0
|
|
146
|
+
: existingCardDetail.transactionList.uiState.scrollYOffset,
|
|
126
147
|
},
|
|
127
148
|
},
|
|
128
149
|
};
|
|
@@ -636,6 +657,22 @@ const chargeCardDetail = (0, toolkit_1.createSlice)({
|
|
|
636
657
|
Object.assign(draft, exports.initialState);
|
|
637
658
|
},
|
|
638
659
|
},
|
|
660
|
+
extraReducers: (builder) => {
|
|
661
|
+
const prependTransaction = (draft, cardId, txId) => {
|
|
662
|
+
const detail = draft.detailById[cardId];
|
|
663
|
+
if (detail != null &&
|
|
664
|
+
!detail.transactionList.transactionIds.includes(txId)) {
|
|
665
|
+
detail.transactionList.transactionIds.unshift(txId);
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
builder
|
|
669
|
+
.addCase(pusherActions_1.addChargeCardTransactionFromPusher, (draft, action) => {
|
|
670
|
+
prependTransaction(draft, action.payload.cardId, action.payload.transaction.transaction_id);
|
|
671
|
+
})
|
|
672
|
+
.addCase(pusherActions_1.addDeclinedChargeCardTransactionFromPusher, (draft, action) => {
|
|
673
|
+
prependTransaction(draft, action.payload.cardId, action.payload.transaction.transaction_id);
|
|
674
|
+
});
|
|
675
|
+
},
|
|
639
676
|
});
|
|
640
677
|
_a = chargeCardDetail.actions, exports.fetchChargeCardDetailPage = _a.fetchChargeCardDetailPage, exports.fetchChargeCardDetail = _a.fetchChargeCardDetail, exports.updateChargeCardDetailFetchState = _a.updateChargeCardDetailFetchState, exports.fetchChargeCardTransactionList = _a.fetchChargeCardTransactionList, exports.updateChargeCardDetailUIState = _a.updateChargeCardDetailUIState, exports.updateChargeCardTransactionList = _a.updateChargeCardTransactionList, exports.updateChargeCardTransactionUploadReceiptsFetchStatus = _a.updateChargeCardTransactionUploadReceiptsFetchStatus, exports.fetchChargeCardTransactionAttachments = _a.fetchChargeCardTransactionAttachments, exports.updateChargeCardTransactionIsViewReceiptClicked = _a.updateChargeCardTransactionIsViewReceiptClicked, exports.updateChargeCardTransactionAttachmentsFailure = _a.updateChargeCardTransactionAttachmentsFailure, exports.updatePhysicalChargeCardAttemptSuccessOrFailure = _a.updatePhysicalChargeCardAttemptSuccessOrFailure, exports.updatePhysicalChargeCardAttempt = _a.updatePhysicalChargeCardAttempt, exports.updateDebitCardPinAttempt = _a.updateDebitCardPinAttempt, exports.updateDebitCardPinAttemptSuccessOrFailure = _a.updateDebitCardPinAttemptSuccessOrFailure, exports.updateChargeCardTransactionReceiptsShowTickFetchStatus = _a.updateChargeCardTransactionReceiptsShowTickFetchStatus, exports.updateChargeCardTransactionAttachmentsInCardDetail = _a.updateChargeCardTransactionAttachmentsInCardDetail, exports.updateChargeCardTransactionListFailure = _a.updateChargeCardTransactionListFailure, exports.updateChargeCardDetail = _a.updateChargeCardDetail, exports.startCVVActivationWait = _a.startCVVActivationWait, exports.completeCVVActivationWait = _a.completeCVVActivationWait, exports.startDebitCardSetPinWait = _a.startDebitCardSetPinWait, exports.completeDebitCardSetPinWait = _a.completeDebitCardSetPinWait, exports.updateChargeCardDetailUpdateStatus = _a.updateChargeCardDetailUpdateStatus, exports.updateChargeCardSpendLimit = _a.updateChargeCardSpendLimit, exports.updateChargeCardSpendLimitSuccessOrFailure = _a.updateChargeCardSpendLimitSuccessOrFailure, exports.updateChargeCardName = _a.updateChargeCardName, exports.updateChargeCardNameSuccessOrFailure = _a.updateChargeCardNameSuccessOrFailure, exports.lockChargeCard = _a.lockChargeCard, exports.lockChargeCardSuccessOrFailure = _a.lockChargeCardSuccessOrFailure, exports.unlockChargeCard = _a.unlockChargeCard, exports.unlockChargeCardSuccessOrFailure = _a.unlockChargeCardSuccessOrFailure, exports.closeChargeCard = _a.closeChargeCard, exports.closeChargeCardSuccessOrFailure = _a.closeChargeCardSuccessOrFailure, exports.fetchDepositAccountLimit = _a.fetchDepositAccountLimit, exports.updateDepositAccountLimitFetchStatus = _a.updateDepositAccountLimitFetchStatus, exports.fetchChargeCardTransactionStatistics = _a.fetchChargeCardTransactionStatistics, exports.updateChargeCardTransactionStatistics = _a.updateChargeCardTransactionStatistics, exports.updateChargeCardTransactionStatisticsFetchState = _a.updateChargeCardTransactionStatisticsFetchState, exports.fetchChargeCardsRecurringExpenses = _a.fetchChargeCardsRecurringExpenses, exports.updateChargeCardsRecurringExpenses = _a.updateChargeCardsRecurringExpenses, exports.updateChargeCardsRecurringExpensesFetchState = _a.updateChargeCardsRecurringExpensesFetchState, exports.sendOtpCardHolder = _a.sendOtpCardHolder, exports.resendOtpCardHolder = _a.resendOtpCardHolder, exports.sendOtpCardHolderSuccess = _a.sendOtpCardHolderSuccess, exports.sendOtpCardHolderFailure = _a.sendOtpCardHolderFailure, exports.verifyOtpCardHolder = _a.verifyOtpCardHolder, exports.verifyOtpCardHolderSuccess = _a.verifyOtpCardHolderSuccess, exports.verifyOtpCardHolderFailure = _a.verifyOtpCardHolderFailure, exports.clearChargeCardDetail = _a.clearChargeCardDetail;
|
|
641
678
|
exports.default = chargeCardDetail.reducer;
|
|
@@ -19,13 +19,24 @@ const fetchChargeCardDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
19
19
|
const chargeCardAction = [];
|
|
20
20
|
const state = state$.value;
|
|
21
21
|
const chargeCardDetail = (0, get_1.default)(state.chargeCardDetailState.detailById, chargeCardId, undefined);
|
|
22
|
+
// Skip if a user-triggered fetch is already in-flight (not applicable
|
|
23
|
+
// to cacheOverride/Pusher refreshes, which always proceed).
|
|
22
24
|
if (cacheOverride === true ||
|
|
23
25
|
chargeCardDetail == null ||
|
|
24
26
|
chargeCardDetail.fetchState !== 'In-Progress') {
|
|
27
|
+
// Silent refresh: preserve fetchState to avoid skeleton flash.
|
|
28
|
+
// Discriminate via fetchState (not null-check) because the reducer
|
|
29
|
+
// always creates an entry before the epic runs.
|
|
30
|
+
const isSilentRefresh = cacheOverride === true &&
|
|
31
|
+
chargeCardDetail != null &&
|
|
32
|
+
chargeCardDetail.fetchState !== 'Not-Started';
|
|
25
33
|
chargeCardAction.push((0, chargeCardDetailReducer_1.updateChargeCardDetailFetchState)({
|
|
26
34
|
chargeCardId,
|
|
27
|
-
isRefreshingViewInBackground:
|
|
28
|
-
fetchState:
|
|
35
|
+
isRefreshingViewInBackground: isSilentRefresh,
|
|
36
|
+
fetchState: isSilentRefresh
|
|
37
|
+
? chargeCardDetail.fetchState
|
|
38
|
+
: 'In-Progress',
|
|
39
|
+
error: isSilentRefresh ? chargeCardDetail.error : undefined,
|
|
29
40
|
}));
|
|
30
41
|
const query = {
|
|
31
42
|
is_include_card_activation_events: true,
|
|
@@ -43,6 +54,8 @@ const fetchChargeCardDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
43
54
|
}));
|
|
44
55
|
}
|
|
45
56
|
else {
|
|
57
|
+
// Surface errors even on silent refresh so the user
|
|
58
|
+
// knows data is stale (follow-up: consider toast instead).
|
|
46
59
|
return (0, rxjs_1.of)((0, chargeCardDetailReducer_1.updateChargeCardDetailFetchState)({
|
|
47
60
|
chargeCardId,
|
|
48
61
|
fetchState: 'Error',
|
|
@@ -51,6 +64,7 @@ const fetchChargeCardDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
51
64
|
}));
|
|
52
65
|
}
|
|
53
66
|
}), (0, operators_1.catchError)((error) => {
|
|
67
|
+
// Surface network failures even on silent refresh.
|
|
54
68
|
return (0, rxjs_1.of)((0, chargeCardDetailReducer_1.updateChargeCardDetailFetchState)({
|
|
55
69
|
chargeCardId,
|
|
56
70
|
fetchState: 'Error',
|
package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js
CHANGED
|
@@ -18,15 +18,16 @@ const fetchChargeCardDetailPageEpic = (actions$, state$) => actions$.pipe((0, op
|
|
|
18
18
|
? exsitingChargeCardDetail.transactionList.uiState.pageTokenType
|
|
19
19
|
: null;
|
|
20
20
|
if (cacheOverride === true) {
|
|
21
|
+
// Forward cacheOverride to all sub-fetches to prevent skeleton flash.
|
|
21
22
|
chargeCardTransactionListAction.push((0, chargeCardDetailReducer_1.fetchChargeCardDetail)(chargeCardId, cacheOverride));
|
|
22
23
|
//latest transactions need to be fetched hence removing pageToken and pageTokenType
|
|
23
|
-
chargeCardTransactionListAction.push((0, chargeCardDetailReducer_1.fetchChargeCardTransactionList)(chargeCardId, null, null));
|
|
24
|
-
chargeCardTransactionListAction.push((0, chargeCardConfigReducer_1.fetchChargeCardConfig)());
|
|
24
|
+
chargeCardTransactionListAction.push((0, chargeCardDetailReducer_1.fetchChargeCardTransactionList)(chargeCardId, null, null, true));
|
|
25
|
+
chargeCardTransactionListAction.push((0, chargeCardConfigReducer_1.fetchChargeCardConfig)(true));
|
|
25
26
|
if (doFetchCreditAccounts && isCreditCardEnabled) {
|
|
26
|
-
chargeCardTransactionListAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
|
|
27
|
+
chargeCardTransactionListAction.push((0, chargeCardListReducer_1.fetchCreditAccount)(true));
|
|
27
28
|
}
|
|
28
29
|
if (doFetchCreditAccounts && isCreditCardEnabled) {
|
|
29
|
-
chargeCardTransactionListAction.push((0, chargeCardListReducer_1.fetchCreditAccountRepayment)());
|
|
30
|
+
chargeCardTransactionListAction.push((0, chargeCardListReducer_1.fetchCreditAccountRepayment)(true));
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
else {
|
|
@@ -10,15 +10,30 @@ export declare const fetchChargeCardListPage: import("@reduxjs/toolkit").ActionC
|
|
|
10
10
|
isDebitCardEnabled: boolean;
|
|
11
11
|
isCreditCardEnabled: boolean;
|
|
12
12
|
cacheOverride: any;
|
|
13
|
-
}, "chargeCardList/fetchChargeCardListPage", never, never>, fetchCreditAccountRepayment: import("@reduxjs/toolkit").
|
|
13
|
+
}, "chargeCardList/fetchChargeCardListPage", never, never>, fetchCreditAccountRepayment: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: boolean | undefined], {
|
|
14
|
+
cacheOverride: boolean;
|
|
15
|
+
}, "chargeCardList/fetchCreditAccountRepayment", never, never>, updateCreditAccountRepayment: import("@reduxjs/toolkit").ActionCreatorWithPayload<CreditAccountRepaymentPayload, "chargeCardList/updateCreditAccountRepayment">, updateCreditAccountRepaymentFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "chargeCardList/updateCreditAccountRepaymentFailure">, updateCreditAccountRepaymentAmountAndDate: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
14
16
|
amount: Amount;
|
|
15
17
|
date: ZeniDate;
|
|
16
|
-
}, "chargeCardList/updateCreditAccountRepaymentAmountAndDate">, updateRowActionCardId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "chargeCardList/updateRowActionCardId">, fetchCreditAccount: import("@reduxjs/toolkit").
|
|
18
|
+
}, "chargeCardList/updateCreditAccountRepaymentAmountAndDate">, updateRowActionCardId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "chargeCardList/updateRowActionCardId">, fetchCreditAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: boolean | undefined], {
|
|
19
|
+
cacheOverride: boolean;
|
|
20
|
+
}, "chargeCardList/fetchCreditAccount", never, never>, updateCreditAccount: import("@reduxjs/toolkit").ActionCreatorWithPayload<CreditAccountPayload[], "chargeCardList/updateCreditAccount">, updateCreditAccountFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "chargeCardList/updateCreditAccountFailure">, fetchDebitCardSummary: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: boolean | undefined], {
|
|
21
|
+
cacheOverride: boolean;
|
|
22
|
+
}, "chargeCardList/fetchDebitCardSummary", never, never>, updateDebitCardSummary: import("@reduxjs/toolkit").ActionCreatorWithPayload<DebitCardSummariesPayload, "chargeCardList/updateDebitCardSummary">, updateDebitCardSummaryFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "chargeCardList/updateDebitCardSummaryFailure">, fetchChargeCardList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: boolean | undefined], {
|
|
23
|
+
cacheOverride: boolean;
|
|
24
|
+
}, "chargeCardList/fetchChargeCardList", never, never>, updateChargeCardList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
17
25
|
chargeCardListPayload: ChargeCardListPayload;
|
|
18
26
|
keepExistingListItems?: boolean;
|
|
19
27
|
}, "chargeCardList/updateChargeCardList">, updateChargeCardListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "chargeCardList/updateChargeCardListFailure">, updateSearchText: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "chargeCardList/updateSearchText">, updateBulkActionCardIds: import("@reduxjs/toolkit").ActionCreatorWithPayload<string[], "chargeCardList/updateBulkActionCardIds">, updateChargeCardListUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
20
28
|
uiState: Partial<ChargeCardListUIState>;
|
|
21
|
-
}, "chargeCardList/updateChargeCardListUIState">,
|
|
29
|
+
}, "chargeCardList/updateChargeCardListUIState">, updateCreditAccountBalanceFromPusher: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
30
|
+
currencyCode: string;
|
|
31
|
+
currencySymbol: string;
|
|
32
|
+
available?: number;
|
|
33
|
+
balance?: number;
|
|
34
|
+
cashback?: number;
|
|
35
|
+
hold?: number;
|
|
36
|
+
}, "chargeCardList/updateCreditAccountBalanceFromPusher">, clearChargeCardList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardList/clearChargeCardList">, resendCardInvite: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cardId: string], {
|
|
22
37
|
cardId: string;
|
|
23
38
|
}, "chargeCardList/resendCardInvite", never, never>, resendCardInviteSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
24
39
|
cardId: ID;
|