@zeniai/client-epic-state 5.0.72 → 5.0.74
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/filterPrimitives.d.ts +23 -0
- package/lib/commonStateTypes/filterPrimitives.js +21 -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 +27 -1
- package/lib/entity/account/accountSelector.js +47 -1
- package/lib/entity/account/accountState.d.ts +6 -1
- package/lib/entity/account/accountState.js +11 -4
- 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/class/classSelector.d.ts +35 -0
- package/lib/entity/class/classSelector.js +50 -0
- 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/filterPrimitives.js +20 -0
- package/lib/esm/commonStateTypes/pusherActions.js +3 -0
- package/lib/esm/coreEpics.js +1 -1
- package/lib/esm/entity/account/accountSelector.js +46 -1
- package/lib/esm/entity/account/accountState.js +7 -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/class/classSelector.js +48 -0
- 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 +26 -16
- 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/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
- package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
- package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -1
- package/lib/esm/view/companyView/helpers/cockpitHelpers.js +1 -1
- package/lib/esm/view/companyView/selector/companyManagementViewSelector.js +1 -1
- package/lib/esm/view/companyView/selector/companyPortfolioViewSelector.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 +137 -1
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +89 -13
- package/lib/esm/view/expenseAutomationView/transactionFilterHelpers.js +258 -0
- 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/spendManagement/spendManagementFilterHelpers.js +4 -2
- package/lib/esm/view/subscriptionView/subscriptionViewSelector.js +1 -1
- 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/taskManager/taskListView/taskListReducer.js +1 -1
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +7 -1
- package/lib/index.d.ts +25 -19
- package/lib/index.js +81 -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/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
- package/lib/view/companyView/helpers/cockpitHelpers.js +1 -1
- package/lib/view/companyView/selector/companyManagementViewSelector.js +1 -1
- package/lib/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
- package/lib/view/companyView/types/cockpitTypes.d.ts +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 +14 -4
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +138 -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.d.ts +4 -1
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +91 -13
- package/lib/view/expenseAutomationView/transactionFilterHelpers.d.ts +66 -0
- package/lib/view/expenseAutomationView/transactionFilterHelpers.js +262 -0
- 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 +43 -2
- package/lib/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.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/chargeCardPaymentHistory.d.ts +1 -1
- 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/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
- package/lib/view/spendManagement/spendManagementFilterHelpers.d.ts +12 -3
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +4 -2
- package/lib/view/subscriptionView/subscriptionViewSelector.js +1 -1
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskListReducer.js +1 -1
- 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
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyTransactionFilters = exports.TRANSACTION_FILTER_CATEGORIES = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Narrowing type-guard for "has a non-empty string here". Used in place of
|
|
6
|
+
* raw `if (foo)` truthiness checks on `string | null | undefined` values so
|
|
7
|
+
* the `@typescript-eslint/strict-boolean-expressions` lint stays clean —
|
|
8
|
+
* empty strings should explicitly fall through to the next candidate
|
|
9
|
+
* (vendorName → customerName → localData.vendor.name → ...) rather than
|
|
10
|
+
* being implicitly coerced to falsy.
|
|
11
|
+
*/
|
|
12
|
+
const isNonEmptyString = (s) => s != null && s !== '';
|
|
13
|
+
/**
|
|
14
|
+
* First line item in UI order. `lineItemById` is a Record whose iteration
|
|
15
|
+
* order is not guaranteed to match what the user sees; `sortedLineItems`
|
|
16
|
+
* is the canonical ordering used by the categorization list/detail views.
|
|
17
|
+
*/
|
|
18
|
+
const getFirstLineItemFromReviewLocalData = (localData) => {
|
|
19
|
+
const { sortedLineItems, lineItemById } = localData;
|
|
20
|
+
if (sortedLineItems.length > 0) {
|
|
21
|
+
return lineItemById[sortedLineItems[0]];
|
|
22
|
+
}
|
|
23
|
+
const lineItems = Object.values(lineItemById);
|
|
24
|
+
return lineItems.length > 0 ? lineItems[0] : undefined;
|
|
25
|
+
};
|
|
26
|
+
exports.TRANSACTION_FILTER_CATEGORIES = [
|
|
27
|
+
{ value: 'payment_account_name', type: 'dropdown' },
|
|
28
|
+
{ value: 'payment_account_type', type: 'dropdown' },
|
|
29
|
+
{ value: 'payee', type: 'searchAutocomplete' },
|
|
30
|
+
{ value: 'category', type: 'dropdown' },
|
|
31
|
+
{ value: 'class', type: 'dropdown' },
|
|
32
|
+
{ value: 'amount', type: 'numberRange' },
|
|
33
|
+
];
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the comparable value for a transaction against a given filter field.
|
|
36
|
+
* Returns undefined when the transaction doesn't carry the field — callers
|
|
37
|
+
* decide whether absence counts as a match (for 'not_equal' it does).
|
|
38
|
+
*/
|
|
39
|
+
const getCategoryValueForTransaction = (key, transaction) => {
|
|
40
|
+
switch (key) {
|
|
41
|
+
case 'amount': {
|
|
42
|
+
// Prefer transactionLocalData line items (sum). Fall back to lines on
|
|
43
|
+
// the transaction itself. Final fallback: transaction-level amount.
|
|
44
|
+
const localDataForAmount = transaction.transactionLocalData?.transactionReviewLocalData;
|
|
45
|
+
if (localDataForAmount?.lineItemById) {
|
|
46
|
+
const lineItems = Object.values(localDataForAmount.lineItemById);
|
|
47
|
+
if (lineItems.length > 0) {
|
|
48
|
+
return lineItems.reduce((sum, lineItem) => sum + (lineItem.amount?.amount ?? 0), 0);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (transaction.transaction.lines &&
|
|
52
|
+
transaction.transaction.lines.length > 0) {
|
|
53
|
+
return transaction.transaction.lines.reduce((sum, line) => sum + (line.amount?.amount ?? 0), 0);
|
|
54
|
+
}
|
|
55
|
+
return transaction.amount.amount;
|
|
56
|
+
}
|
|
57
|
+
case 'payee': {
|
|
58
|
+
if (isNonEmptyString(transaction.vendorName)) {
|
|
59
|
+
return transaction.vendorName;
|
|
60
|
+
}
|
|
61
|
+
if (isNonEmptyString(transaction.customerName)) {
|
|
62
|
+
return transaction.customerName;
|
|
63
|
+
}
|
|
64
|
+
const localData = transaction.transactionLocalData?.transactionReviewLocalData;
|
|
65
|
+
const vendorName = localData?.vendor?.name;
|
|
66
|
+
if (isNonEmptyString(vendorName)) {
|
|
67
|
+
return vendorName;
|
|
68
|
+
}
|
|
69
|
+
const customerName = localData?.customer?.name;
|
|
70
|
+
if (isNonEmptyString(customerName)) {
|
|
71
|
+
return customerName;
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
case 'payment_account_name': {
|
|
76
|
+
// Match what TransactionCategorizationListRow renders for the cell.
|
|
77
|
+
return transaction.transaction.account?.accountName;
|
|
78
|
+
}
|
|
79
|
+
case 'payment_account_type': {
|
|
80
|
+
// Raw `paymentType` enum ("credit_card" / "check" / "cash"). Dropdown
|
|
81
|
+
// option values use the same enum; row uses `paymentTypeName` for the
|
|
82
|
+
// human label.
|
|
83
|
+
return transaction.transaction.paymentType;
|
|
84
|
+
}
|
|
85
|
+
case 'category': {
|
|
86
|
+
const localDataForCategory = transaction.transactionLocalData?.transactionReviewLocalData;
|
|
87
|
+
if (localDataForCategory != null) {
|
|
88
|
+
const firstLineItem = getFirstLineItemFromReviewLocalData(localDataForCategory);
|
|
89
|
+
const accountId = firstLineItem?.account?.accountId;
|
|
90
|
+
if (isNonEmptyString(accountId)) {
|
|
91
|
+
return accountId;
|
|
92
|
+
}
|
|
93
|
+
const qboId = firstLineItem?.account?.qboId;
|
|
94
|
+
if (isNonEmptyString(qboId)) {
|
|
95
|
+
return qboId;
|
|
96
|
+
}
|
|
97
|
+
const accountName = firstLineItem?.account?.accountName;
|
|
98
|
+
if (isNonEmptyString(accountName)) {
|
|
99
|
+
return accountName;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const firstLineForCategory = transaction.transaction.lines?.[0];
|
|
103
|
+
if (firstLineForCategory?.type ===
|
|
104
|
+
'transaction_with_account_and_class_line' ||
|
|
105
|
+
firstLineForCategory?.type ===
|
|
106
|
+
'transaction_with_product_or_service_line' ||
|
|
107
|
+
firstLineForCategory?.type === 'journal_entry_transaction_line') {
|
|
108
|
+
const account = firstLineForCategory.account;
|
|
109
|
+
return account?.accountId ?? account?.qboId ?? account?.accountName;
|
|
110
|
+
}
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
case 'class': {
|
|
114
|
+
const localDataForClass = transaction.transactionLocalData?.transactionReviewLocalData;
|
|
115
|
+
if (localDataForClass != null) {
|
|
116
|
+
const firstLineItemForClass = getFirstLineItemFromReviewLocalData(localDataForClass);
|
|
117
|
+
const classId = firstLineItemForClass?.class?.classId;
|
|
118
|
+
if (isNonEmptyString(classId)) {
|
|
119
|
+
return classId;
|
|
120
|
+
}
|
|
121
|
+
const qboId = firstLineItemForClass?.class?.qboId;
|
|
122
|
+
if (isNonEmptyString(qboId)) {
|
|
123
|
+
return qboId;
|
|
124
|
+
}
|
|
125
|
+
const className = firstLineItemForClass?.class?.className;
|
|
126
|
+
if (isNonEmptyString(className)) {
|
|
127
|
+
return className;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const firstLineForClass = transaction.transaction.lines?.[0];
|
|
131
|
+
if (firstLineForClass?.type === 'transaction_with_account_and_class_line' ||
|
|
132
|
+
firstLineForClass?.type ===
|
|
133
|
+
'transaction_with_product_or_service_line' ||
|
|
134
|
+
firstLineForClass?.type === 'journal_entry_transaction_line') {
|
|
135
|
+
const classData = firstLineForClass.class;
|
|
136
|
+
return classData?.classId ?? classData?.qboId ?? classData?.className;
|
|
137
|
+
}
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
default:
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* TC-only amount matcher. Supports all five operators TC defines, including
|
|
146
|
+
* the legacy "1000<->5000" range-string form (kept for backward compatibility
|
|
147
|
+
* with persisted filter state that may still contain that encoding).
|
|
148
|
+
*
|
|
149
|
+
* The `'equal' | 'not_equal'` branch matches if `amount` equals ANY of the
|
|
150
|
+
* configured values (consistent with how non-amount filters interpret a
|
|
151
|
+
* multi-value `values` array). `.some()` over the values array also makes
|
|
152
|
+
* the empty-values case behave correctly — empty array → `matched = false`
|
|
153
|
+
* — though in practice `applyTransactionFilters` strips empty-values
|
|
154
|
+
* categories before they reach this matcher. The trailing
|
|
155
|
+
* `op === 'not_equal' ? !matched : matched` line inverts for `not_equal`.
|
|
156
|
+
*/
|
|
157
|
+
const matchAmount = (amount, category) => {
|
|
158
|
+
const op = category.matchingOperator;
|
|
159
|
+
const values = category.values;
|
|
160
|
+
let matched = false;
|
|
161
|
+
if (op === 'in_between') {
|
|
162
|
+
if (values.length >= 2) {
|
|
163
|
+
const min = Number(values[0]);
|
|
164
|
+
const max = Number(values[1]);
|
|
165
|
+
matched = amount >= min && amount <= max;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else if (op === 'less_than') {
|
|
169
|
+
if (values.length >= 1) {
|
|
170
|
+
matched = amount < Number(values[0]);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
else if (op === 'greater_than') {
|
|
174
|
+
if (values.length >= 1) {
|
|
175
|
+
matched = amount > Number(values[0]);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
else if (op === 'equal' || op === 'not_equal') {
|
|
179
|
+
matched = values.some((v) => {
|
|
180
|
+
const s = String(v);
|
|
181
|
+
// Backward compatibility: legacy "low<->high" range-string form
|
|
182
|
+
// persisted under `matchingOperator: 'equal'`.
|
|
183
|
+
if (s.includes('<->')) {
|
|
184
|
+
const parts = s.split('<->');
|
|
185
|
+
return (amount >= Number(parts[0] ?? '') && amount <= Number(parts[1] ?? ''));
|
|
186
|
+
}
|
|
187
|
+
return amount === Number(v);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
return op === 'not_equal' ? !matched : matched;
|
|
191
|
+
};
|
|
192
|
+
const transactionMatchesCategory = (transaction, category) => {
|
|
193
|
+
const value = getCategoryValueForTransaction(category.field, transaction);
|
|
194
|
+
if (value == null) {
|
|
195
|
+
// Absent-value semantics — pinning these down explicitly so the
|
|
196
|
+
// asymmetry isn't surprising:
|
|
197
|
+
//
|
|
198
|
+
// not_equal: a missing value IS NOT EQUAL to any candidate, so the
|
|
199
|
+
// transaction matches the filter (passes through).
|
|
200
|
+
// equal: a missing value is not equal to any candidate, so the
|
|
201
|
+
// transaction does NOT match (filtered out).
|
|
202
|
+
// less_than / greater_than: SQL-style three-valued logic — comparing
|
|
203
|
+
// against a missing value is "unknown", which we treat as
|
|
204
|
+
// "does not match" (filtered out). A user setting
|
|
205
|
+
// "amount < $1000" probably wants transactions with a
|
|
206
|
+
// concrete amount that satisfies the bound, not rows
|
|
207
|
+
// where the amount can't be determined.
|
|
208
|
+
// in_between: same as the single-sided comparators — missing values
|
|
209
|
+
// are filtered out.
|
|
210
|
+
//
|
|
211
|
+
// Only the `not_equal` branch returns `true` here; everything else
|
|
212
|
+
// falls through to the `false` below.
|
|
213
|
+
return category.matchingOperator === 'not_equal';
|
|
214
|
+
}
|
|
215
|
+
if (category.field === 'amount') {
|
|
216
|
+
return matchAmount(Number(value), category);
|
|
217
|
+
}
|
|
218
|
+
const valueStr = value.toString();
|
|
219
|
+
const valueInList = category.values.some((v) => v.toString() === valueStr);
|
|
220
|
+
return category.matchingOperator === 'not_equal' ? !valueInList : valueInList;
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* TC-only equivalent of `applyAdvancedFiltersOnList`. Filters a list of
|
|
224
|
+
* `TransactionView` items against a `TransactionFilters` object using the
|
|
225
|
+
* AND/OR combination semantics from `categoryCombinationOperator`.
|
|
226
|
+
*
|
|
227
|
+
* Independent of `view/spendManagement` — keeps the TC filter pipeline cleanly
|
|
228
|
+
* inside the Expense Automation feature group.
|
|
229
|
+
*/
|
|
230
|
+
const applyTransactionFilters = (transactions, filters) => {
|
|
231
|
+
if (filters?.categories == null || filters.categories.length === 0) {
|
|
232
|
+
return transactions;
|
|
233
|
+
}
|
|
234
|
+
// Mirrors the predicate used by `getTransactionAppliedFiltersCount` on the
|
|
235
|
+
// webc side. A half-filled category — e.g. `in_between` with only the
|
|
236
|
+
// `min` typed — would otherwise survive the filter pass and produce zero
|
|
237
|
+
// matches because `Number("")` collapses to `0`, artificially emptying
|
|
238
|
+
// the list while editing. Skipping such categories keeps the filtered
|
|
239
|
+
// view stable while the user finishes typing.
|
|
240
|
+
const activeCategories = filters.categories.filter((c) => {
|
|
241
|
+
if (c.field == null || c.values.length === 0) {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
if (c.field === 'amount' && c.matchingOperator === 'in_between') {
|
|
245
|
+
return (c.values.length >= 2 &&
|
|
246
|
+
String(c.values[0] ?? '').trim() !== '' &&
|
|
247
|
+
String(c.values[1] ?? '').trim() !== '');
|
|
248
|
+
}
|
|
249
|
+
return String(c.values[0] ?? '').trim() !== '';
|
|
250
|
+
});
|
|
251
|
+
if (activeCategories.length === 0) {
|
|
252
|
+
return transactions;
|
|
253
|
+
}
|
|
254
|
+
const op = filters.categoryCombinationOperator;
|
|
255
|
+
return transactions.filter((txn) => {
|
|
256
|
+
if (op === 'AND') {
|
|
257
|
+
return activeCategories.every((cat) => transactionMatchesCategory(txn, cat));
|
|
258
|
+
}
|
|
259
|
+
return activeCategories.some((cat) => transactionMatchesCategory(txn, cat));
|
|
260
|
+
});
|
|
261
|
+
};
|
|
262
|
+
exports.applyTransactionFilters = applyTransactionFilters;
|
|
@@ -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,18 @@ 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';
|
|
19
|
+
import { TransactionFilters } from '../transactionFilterHelpers';
|
|
18
20
|
import { TransactionDetailKey } from '../../transactionDetail/transactionDetailState';
|
|
21
|
+
import { CompletedSubTab } from './completedSubTab';
|
|
19
22
|
export declare const toTransactionsSortKey: (v: string) => "date" | "amount" | "vendor" | "project" | "category" | "class" | "payment_account" | "transaction_type" | "memo_and_receipt";
|
|
20
23
|
export type TransactionsSortKey = ReturnType<typeof toTransactionsSortKey>;
|
|
21
24
|
export declare const TRANSACTIONS_TABS: readonly ["review", "autoCategorized"];
|
|
@@ -91,6 +94,7 @@ export interface SupportedTransactionCategorization {
|
|
|
91
94
|
}
|
|
92
95
|
export declare const initialSupportedTransactionCategorization: SupportedTransactionCategorization;
|
|
93
96
|
export interface TransactionsTabViewState extends FetchedState {
|
|
97
|
+
filters: TransactionFilters;
|
|
94
98
|
markAsNotMiscategorizedStatus: FetchStateAndError;
|
|
95
99
|
refreshStatus: FetchStateAndError;
|
|
96
100
|
saveStatus: FetchStateAndError;
|
|
@@ -103,7 +107,44 @@ export interface TransactionsTabViewState extends FetchedState {
|
|
|
103
107
|
selectedTransactionId?: ID;
|
|
104
108
|
selectedTransactionLineId?: ID;
|
|
105
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Snapshot of the autoCategorized tab's paginated dataset for a single
|
|
112
|
+
* Completed sub-tab. Stored in {@link TransactionsViewState.autoCategorizedSubTabCache}
|
|
113
|
+
* so revisiting an already-loaded sub-tab can short-circuit the fetch epic
|
|
114
|
+
* (mirrors parent-tab caching). The snapshot is period-spanning — both the
|
|
115
|
+
* `totalCount` map and `transactionIdsBySelectedPeriod` map preserve every
|
|
116
|
+
* period the user has paged through under that sub-tab.
|
|
117
|
+
*
|
|
118
|
+
* `scrollPosition` is captured per sub-tab so revisiting a sub-tab restores
|
|
119
|
+
* the user's last scroll offset; switching to a fresh / never-visited sub-tab
|
|
120
|
+
* starts at the top instead of inheriting the previous sub-tab's offset.
|
|
121
|
+
*/
|
|
122
|
+
export interface AutoCategorizedSubTabSnapshot {
|
|
123
|
+
error: ZeniAPIStatus | undefined;
|
|
124
|
+
fetchState: FetchState;
|
|
125
|
+
pageToken: PageToken;
|
|
126
|
+
scrollPosition: TransactionsViewUIState['scrollPosition'];
|
|
127
|
+
totalCount: Record<MonthYearPeriodId, number>;
|
|
128
|
+
transactionIdsBySelectedPeriod: Record<MonthYearPeriodId, ID[]>;
|
|
129
|
+
}
|
|
106
130
|
export type TransactionsViewState = {
|
|
131
|
+
/**
|
|
132
|
+
* Per-sub-tab snapshot cache for the Completed (autoCategorized) tab. Keyed
|
|
133
|
+
* by {@link CompletedSubTab}. Populated as the user navigates between
|
|
134
|
+
* sub-tabs and consulted on every switch — the active autoCategorized slot
|
|
135
|
+
* is restored from here when a snapshot exists, otherwise it is reset and
|
|
136
|
+
* the fetch epic loads page 1 fresh.
|
|
137
|
+
*/
|
|
138
|
+
autoCategorizedSubTabCache: Partial<Record<CompletedSubTab, AutoCategorizedSubTabSnapshot>>;
|
|
139
|
+
/**
|
|
140
|
+
* Period-keyed parent tab counts, scoped per {@link TransactionsTab}.
|
|
141
|
+
* Sourced from the listing response's `parent_tab_total_count` and used
|
|
142
|
+
* exclusively to drive the parent tab badges on the UI — every other
|
|
143
|
+
* count consumer (pagination, sub-tab chips, in-tab "showing X of Y")
|
|
144
|
+
* keeps reading from {@link TransactionsViewUIState.totalCount}.
|
|
145
|
+
*/
|
|
146
|
+
parentTotalCountByTab: Record<TransactionsTab, Record<MonthYearPeriodId, number>>;
|
|
147
|
+
selectedTransactionCategorizationCompletedSubTab: CompletedSubTab;
|
|
107
148
|
selectedTransactionCategorizationTab: TransactionsTab;
|
|
108
149
|
transactionCategorizationView: Record<TransactionsTab, TransactionsTabViewState>;
|
|
109
150
|
};
|
|
@@ -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 {
|
|
@@ -45,7 +45,7 @@ export interface BillPayFilters {
|
|
|
45
45
|
}
|
|
46
46
|
export interface BillPayFilterCategory {
|
|
47
47
|
field: BillListViewFilterCategoryField;
|
|
48
|
-
matchingOperator: 'equal' | '
|
|
48
|
+
matchingOperator: 'equal' | 'not_equal';
|
|
49
49
|
values: (string | ZeniDate)[];
|
|
50
50
|
valuesCombinationOperator: 'ANY';
|
|
51
51
|
}
|
|
@@ -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 =
|