@zeniai/client-epic-state 5.2.7 → 5.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/entity/invoicing/invoicingCommonPayload.d.ts +22 -0
- package/lib/entity/invoicing/invoicingCommonPayload.js +51 -10
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +51 -10
- package/lib/esm/index.js +3 -2
- package/lib/esm/view/accountList/accountListReducer.js +0 -1
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +1 -0
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -0
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +56 -11
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
- package/lib/esm/view/expenseAutomationView/types/transactionGroup.js +21 -0
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +2 -1
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +2 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +10 -5
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +27 -3
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +7 -3
- package/lib/index.d.ts +3 -2
- package/lib/index.js +52 -47
- package/lib/view/accountList/accountListReducer.js +0 -1
- package/lib/view/accountList/accountListState.d.ts +1 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +1 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -0
- package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +11 -0
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +4 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +57 -12
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +2 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
- package/lib/view/expenseAutomationView/types/transactionGroup.d.ts +21 -0
- package/lib/view/expenseAutomationView/types/transactionGroup.js +25 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +11 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +5 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +1 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +1 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +2 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +10 -5
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +9 -1
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +30 -4
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +11 -4
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +7 -3
- package/package.json +1 -1
|
@@ -35,7 +35,6 @@ exports.initialState = {
|
|
|
35
35
|
reimbursementAccountList: exports.initialAccountList,
|
|
36
36
|
schedulesAccountList: exports.initialAccountList,
|
|
37
37
|
billPayAccountList: exports.initialAccountList,
|
|
38
|
-
invoicingAccountList: exports.initialAccountList,
|
|
39
38
|
},
|
|
40
39
|
};
|
|
41
40
|
const accountList = (0, toolkit_1.createSlice)({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NestedAccountHierarchyForReport } from '../../commonStateTypes/accountView/nestedAccountID';
|
|
2
2
|
import { FetchedState, ID } from '../../commonStateTypes/common';
|
|
3
3
|
import { AccountLabel } from '../../entity/account/accountState';
|
|
4
|
-
export type AccountListKeyType = 'accountList' | 'reimbursementAccountList' | 'schedulesAccountList' | 'billPayAccountList'
|
|
4
|
+
export type AccountListKeyType = 'accountList' | 'reimbursementAccountList' | 'schedulesAccountList' | 'billPayAccountList';
|
|
5
5
|
export interface AccountList extends FetchedState {
|
|
6
6
|
accountIds: ID[];
|
|
7
7
|
accountIdsByLabel: Record<AccountLabel, ID[]>;
|
|
@@ -30,6 +30,7 @@ const backgroundRefetchReviewTabEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
30
30
|
page_token: pageToken,
|
|
31
31
|
page_size: PAGE_SIZE,
|
|
32
32
|
search_text: reviewUiState.searchString,
|
|
33
|
+
transaction_group: state.expenseAutomationTransactionsViewState.selectedTransactionGroup,
|
|
33
34
|
};
|
|
34
35
|
return zeniAPI.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`);
|
|
35
36
|
};
|
|
@@ -39,6 +39,7 @@ const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) => action
|
|
|
39
39
|
sub_tab: selectedTab === 'autoCategorized'
|
|
40
40
|
? expenseAutomationTransactionsViewState.selectedTransactionCategorizationCompletedSubTab
|
|
41
41
|
: completedSubTab_1.DEFAULT_COMPLETED_SUB_TAB,
|
|
42
|
+
transaction_group: expenseAutomationTransactionsViewState.selectedTransactionGroup,
|
|
42
43
|
};
|
|
43
44
|
return zeniAPI
|
|
44
45
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
@@ -3,6 +3,7 @@ import { TransactionPayload } from '../../../entity/transaction/payloadTypes/tra
|
|
|
3
3
|
import { SupportedTransactionPayload } from '../../../entity/transaction/transactionState';
|
|
4
4
|
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
5
5
|
import { CompletedSubTab } from '../types/completedSubTab';
|
|
6
|
+
import { TransactionGroup } from '../types/transactionGroup';
|
|
6
7
|
export interface TransactionCategorizationQueryPayload {
|
|
7
8
|
auto_categorized: boolean;
|
|
8
9
|
end_date: string | null;
|
|
@@ -26,6 +27,16 @@ export interface TransactionCategorizationQueryPayload {
|
|
|
26
27
|
* that the Receipts manual-match flow relies on.
|
|
27
28
|
*/
|
|
28
29
|
search_all_statuses?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Statement-level scope (`'expense' | 'income' | 'all'`). Always sent by the
|
|
32
|
+
* list epics. The backend `is_revenue_automation_enabled` gate is
|
|
33
|
+
* authoritative: when it is off the backend ignores this and returns the
|
|
34
|
+
* legacy expense scope regardless of the value, so there is no need to gate
|
|
35
|
+
* the send on the client (the gate isn't available to the redux epics anyway
|
|
36
|
+
* — it's a Statsig/React-side flag, not a tenant field). Optional only for
|
|
37
|
+
* wire/back-compat tolerance.
|
|
38
|
+
*/
|
|
39
|
+
transaction_group?: TransactionGroup;
|
|
29
40
|
}
|
|
30
41
|
export interface TransactionCategorizationPayload {
|
|
31
42
|
next_page_token: string | null;
|
|
@@ -17,6 +17,7 @@ import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
|
17
17
|
import { UpdateTransactionCategorizationResponsePayload } from '../payload/transactionCategorizationPayload';
|
|
18
18
|
import { TransactionFilters } from '../transactionFilterTypes';
|
|
19
19
|
import { SupportedTransactionCategorization, TransactionSaveUpdates, TransactionsTab, TransactionsTabViewState, TransactionsViewState, TransactionsViewUIState } from '../types/transactionsViewState';
|
|
20
|
+
export declare const initialUIState: TransactionsViewUIState;
|
|
20
21
|
export declare const initialTransactionTabViewState: TransactionsTabViewState;
|
|
21
22
|
export declare const initialState: TransactionsViewState;
|
|
22
23
|
export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", period: TimePeriod, cacheOverride?: any, keepExistingListItems?: any, searchString?: string | undefined, pageToken?: PageToken | undefined, refreshViewInBackground?: any, resetListItems?: boolean | undefined], {
|
|
@@ -69,7 +70,9 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
69
70
|
newSelectedTab: "review" | "autoCategorized";
|
|
70
71
|
}, "expenseAutomationTransactionsView/updateCurrentSelectedTransactionCategorizationTab", never, never>, updateTransactionCategorizationCompletedSubTab: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newSubTab: "all" | "ai_accountant" | "manual"], {
|
|
71
72
|
newSubTab: "all" | "ai_accountant" | "manual";
|
|
72
|
-
}, "expenseAutomationTransactionsView/updateTransactionCategorizationCompletedSubTab", never, never>,
|
|
73
|
+
}, "expenseAutomationTransactionsView/updateTransactionCategorizationCompletedSubTab", never, never>, updateTransactionGroup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newGroup: "income" | "expense" | "all"], {
|
|
74
|
+
newGroup: "income" | "expense" | "all";
|
|
75
|
+
}, "expenseAutomationTransactionsView/updateTransactionGroup", never, never>, updateTransactionCategorizationSaveStatus: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", fetchState: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
|
|
73
76
|
selectedTab: "review" | "autoCategorized";
|
|
74
77
|
fetchState: FetchState;
|
|
75
78
|
error: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.uploadTransactionCategorizationReceiptSuccess = exports.updateTransactionCategorizationUploadReceiptState = exports.removeTransactionFromAllTabs = exports.backgroundRefetchReviewTab = exports.syncTransactionCategorizationFromDetailSave = exports.updateSelectedTransactionId = exports.markCategoryClassRecommendationsFailureForCategorization = exports.markCategoryClassRecommendationsCompletedForCategorization = exports.markCategoryClassRecommendationsInProgressForCategorization = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.resetOtherTabsFetchState = exports.fetchTransactionCategorizationSuccess = exports.updateParentTotalCountForTab = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = exports.markTransactionAsNotMiscategorized = exports.updateTransactionCategorizationSaveStatus = exports.updateTransactionCategorizationCompletedSubTab = exports.updateCurrentSelectedTransactionCategorizationTab = exports.updateTransactionCategorization = exports.saveTransactionCategorization = exports.fetchTransactionCategorizationFailure = exports.saveTransactionCategorizationLocalData = exports.initializeTransactionCategorizationViewLocalData = exports.updateTransactionFilters = exports.updateTransactionCategorizationUIState = exports.fetchTransactionCategorization = exports.initialState = exports.initialTransactionTabViewState = void 0;
|
|
7
|
+
exports.uploadTransactionCategorizationReceiptSuccess = exports.updateTransactionCategorizationUploadReceiptState = exports.removeTransactionFromAllTabs = exports.backgroundRefetchReviewTab = exports.syncTransactionCategorizationFromDetailSave = exports.updateSelectedTransactionId = exports.markCategoryClassRecommendationsFailureForCategorization = exports.markCategoryClassRecommendationsCompletedForCategorization = exports.markCategoryClassRecommendationsInProgressForCategorization = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.resetOtherTabsFetchState = exports.fetchTransactionCategorizationSuccess = exports.updateParentTotalCountForTab = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = exports.markTransactionAsNotMiscategorized = exports.updateTransactionCategorizationSaveStatus = exports.updateTransactionGroup = exports.updateTransactionCategorizationCompletedSubTab = exports.updateCurrentSelectedTransactionCategorizationTab = exports.updateTransactionCategorization = exports.saveTransactionCategorization = exports.fetchTransactionCategorizationFailure = exports.saveTransactionCategorizationLocalData = exports.initializeTransactionCategorizationViewLocalData = exports.updateTransactionFilters = exports.updateTransactionCategorizationUIState = exports.fetchTransactionCategorization = exports.initialState = exports.initialTransactionTabViewState = exports.initialUIState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
10
|
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
@@ -13,7 +13,18 @@ const vendorTransaction_1 = require("../../../entity/transaction/stateTypes/vend
|
|
|
13
13
|
const rootActions_1 = require("../../../rootActions");
|
|
14
14
|
const transactionCategorizationLocalDataHelper_1 = require("../helpers/transactionCategorizationLocalDataHelper");
|
|
15
15
|
const completedSubTab_1 = require("../types/completedSubTab");
|
|
16
|
+
const transactionGroup_1 = require("../types/transactionGroup");
|
|
16
17
|
const transactionsViewState_1 = require("../types/transactionsViewState");
|
|
18
|
+
exports.initialUIState = {
|
|
19
|
+
sortKey: 'date',
|
|
20
|
+
sortOrder: 'descending',
|
|
21
|
+
searchString: '',
|
|
22
|
+
nodeCollapseState: {},
|
|
23
|
+
scrollPosition: { scrollTop: 0, scrollLeft: undefined },
|
|
24
|
+
pageToken: null,
|
|
25
|
+
totalCount: {},
|
|
26
|
+
limit: 10,
|
|
27
|
+
};
|
|
17
28
|
exports.initialTransactionTabViewState = {
|
|
18
29
|
saveStatus: {
|
|
19
30
|
fetchState: 'Not-Started',
|
|
@@ -27,16 +38,7 @@ exports.initialTransactionTabViewState = {
|
|
|
27
38
|
fetchState: 'Not-Started',
|
|
28
39
|
error: undefined,
|
|
29
40
|
},
|
|
30
|
-
uiState: {
|
|
31
|
-
sortKey: 'date',
|
|
32
|
-
sortOrder: 'descending',
|
|
33
|
-
searchString: '',
|
|
34
|
-
nodeCollapseState: {},
|
|
35
|
-
scrollPosition: { scrollTop: 0, scrollLeft: undefined },
|
|
36
|
-
pageToken: null,
|
|
37
|
-
totalCount: {},
|
|
38
|
-
limit: 10,
|
|
39
|
-
},
|
|
41
|
+
uiState: { ...exports.initialUIState },
|
|
40
42
|
filters: {
|
|
41
43
|
categoryCombinationOperator: 'AND',
|
|
42
44
|
categories: [],
|
|
@@ -62,6 +64,7 @@ exports.initialState = {
|
|
|
62
64
|
},
|
|
63
65
|
selectedTransactionCategorizationTab: 'review',
|
|
64
66
|
selectedTransactionCategorizationCompletedSubTab: completedSubTab_1.DEFAULT_COMPLETED_SUB_TAB,
|
|
67
|
+
selectedTransactionGroup: transactionGroup_1.DEFAULT_TRANSACTION_GROUP,
|
|
65
68
|
transactionCategorizationView: {
|
|
66
69
|
review: { ...exports.initialTransactionTabViewState },
|
|
67
70
|
autoCategorized: { ...exports.initialTransactionTabViewState },
|
|
@@ -407,6 +410,48 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
407
410
|
return { payload: { newSubTab } };
|
|
408
411
|
},
|
|
409
412
|
},
|
|
413
|
+
updateTransactionGroup: {
|
|
414
|
+
reducer(draft, action) {
|
|
415
|
+
const { newGroup } = action.payload;
|
|
416
|
+
if (draft.selectedTransactionGroup === newGroup) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
draft.selectedTransactionGroup = newGroup;
|
|
420
|
+
// A group change re-scopes the entire dataset on the backend (by
|
|
421
|
+
// account_type), so every parent tab, sub-tab snapshot and count is now
|
|
422
|
+
// stale. Drop the sub-tab cache and parent counts, and reset each tab's
|
|
423
|
+
// paginated data slots so the view epic's cache check falls through to a
|
|
424
|
+
// fresh page-1 fetch. User preferences (search, sort, limit, collapse
|
|
425
|
+
// state) are intentionally preserved, mirroring the sub-tab switch.
|
|
426
|
+
draft.autoCategorizedSubTabCache = {};
|
|
427
|
+
draft.parentTotalCountByTab = { review: {}, autoCategorized: {} };
|
|
428
|
+
transactionsViewState_1.TRANSACTIONS_TABS.forEach((tab) => {
|
|
429
|
+
const view = draft.transactionCategorizationView[tab];
|
|
430
|
+
// Reset uiState to its initial values but keep the user prefs (search,
|
|
431
|
+
// sort, limit, collapse) in place -- mirroring the sub-tab switch. Then
|
|
432
|
+
// drop the loaded rows and any stale selection pointing at a now-absent
|
|
433
|
+
// row to avoid transient invalid state.
|
|
434
|
+
const { searchString, sortKey, sortOrder, nodeCollapseState, limit } = view.uiState;
|
|
435
|
+
view.uiState = {
|
|
436
|
+
...exports.initialUIState,
|
|
437
|
+
searchString,
|
|
438
|
+
sortKey,
|
|
439
|
+
sortOrder,
|
|
440
|
+
nodeCollapseState,
|
|
441
|
+
limit,
|
|
442
|
+
};
|
|
443
|
+
view.transactionIdsBySelectedPeriod = {};
|
|
444
|
+
view.fetchState = 'Not-Started';
|
|
445
|
+
view.error = undefined;
|
|
446
|
+
view.selectedTransactionId = undefined;
|
|
447
|
+
view.selectedTransactionLineId = undefined;
|
|
448
|
+
view.selectedCheckBoxTransactionIds = [];
|
|
449
|
+
});
|
|
450
|
+
},
|
|
451
|
+
prepare(newGroup) {
|
|
452
|
+
return { payload: { newGroup } };
|
|
453
|
+
},
|
|
454
|
+
},
|
|
410
455
|
updateTransactionCategorization: {
|
|
411
456
|
reducer(draft, action) {
|
|
412
457
|
const selectedTab = action.payload.selectedTab;
|
|
@@ -1082,5 +1127,5 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
1082
1127
|
});
|
|
1083
1128
|
},
|
|
1084
1129
|
});
|
|
1085
|
-
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.updateTransactionFilters = _a.updateTransactionFilters, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationCompletedSubTab = _a.updateTransactionCategorizationCompletedSubTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = _a.updateStatusForTransactionNotMiscategorizedUpdateForCategorization, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.updateParentTotalCountForTab = _a.updateParentTotalCountForTab, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.resetOtherTabsFetchState = _a.resetOtherTabsFetchState, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.markCategoryClassRecommendationsInProgressForCategorization = _a.markCategoryClassRecommendationsInProgressForCategorization, exports.markCategoryClassRecommendationsCompletedForCategorization = _a.markCategoryClassRecommendationsCompletedForCategorization, exports.markCategoryClassRecommendationsFailureForCategorization = _a.markCategoryClassRecommendationsFailureForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId, exports.syncTransactionCategorizationFromDetailSave = _a.syncTransactionCategorizationFromDetailSave, exports.backgroundRefetchReviewTab = _a.backgroundRefetchReviewTab, exports.removeTransactionFromAllTabs = _a.removeTransactionFromAllTabs, exports.updateTransactionCategorizationUploadReceiptState = _a.updateTransactionCategorizationUploadReceiptState, exports.uploadTransactionCategorizationReceiptSuccess = _a.uploadTransactionCategorizationReceiptSuccess;
|
|
1130
|
+
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.updateTransactionFilters = _a.updateTransactionFilters, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationCompletedSubTab = _a.updateTransactionCategorizationCompletedSubTab, exports.updateTransactionGroup = _a.updateTransactionGroup, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = _a.updateStatusForTransactionNotMiscategorizedUpdateForCategorization, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.updateParentTotalCountForTab = _a.updateParentTotalCountForTab, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.resetOtherTabsFetchState = _a.resetOtherTabsFetchState, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.markCategoryClassRecommendationsInProgressForCategorization = _a.markCategoryClassRecommendationsInProgressForCategorization, exports.markCategoryClassRecommendationsCompletedForCategorization = _a.markCategoryClassRecommendationsCompletedForCategorization, exports.markCategoryClassRecommendationsFailureForCategorization = _a.markCategoryClassRecommendationsFailureForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId, exports.syncTransactionCategorizationFromDetailSave = _a.syncTransactionCategorizationFromDetailSave, exports.backgroundRefetchReviewTab = _a.backgroundRefetchReviewTab, exports.removeTransactionFromAllTabs = _a.removeTransactionFromAllTabs, exports.updateTransactionCategorizationUploadReceiptState = _a.updateTransactionCategorizationUploadReceiptState, exports.uploadTransactionCategorizationReceiptSuccess = _a.uploadTransactionCategorizationReceiptSuccess;
|
|
1086
1131
|
exports.default = expenseAutomationTransactionsView.reducer;
|
|
@@ -8,6 +8,7 @@ import { SupportedTransactionWithCOT } from '../../../entity/transaction/transac
|
|
|
8
8
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
9
9
|
import { ProjectListSelectorView } from '../../projectList/projectListSelector';
|
|
10
10
|
import { CompletedSubTab } from '../types/completedSubTab';
|
|
11
|
+
import { TransactionGroup } from '../types/transactionGroup';
|
|
11
12
|
import { TransactionReviewLocalData, TransactionsTab, TransactionsViewUIState } from '../types/transactionsViewState';
|
|
12
13
|
export interface TransactionReviewLocalDataSelectorView {
|
|
13
14
|
transactionId: ID;
|
|
@@ -38,6 +39,7 @@ export interface ExpenseAutomationTransactionViewSelector extends SelectorView {
|
|
|
38
39
|
saveStatus: FetchStateAndError;
|
|
39
40
|
selectedCheckBoxTransactionIds: ID[];
|
|
40
41
|
selectedTransactionCategorizationCompletedSubTab: CompletedSubTab;
|
|
42
|
+
selectedTransactionGroup: TransactionGroup;
|
|
41
43
|
/**
|
|
42
44
|
* Per-(sub-)tab counts mirroring `total_count` from the listing response.
|
|
43
45
|
* Powers pagination via `InfiniteLoader.itemCount`, in-list count copy,
|
|
@@ -96,7 +96,7 @@ var createTransferEntrySelector_2 = require("../../createTransferEntry/createTra
|
|
|
96
96
|
Object.defineProperty(exports, "getLastTransferEntryReplacement", { enumerable: true, get: function () { return createTransferEntrySelector_2.getLastTransferEntryReplacement; } });
|
|
97
97
|
function getExpenseAutomationTransactionView(state) {
|
|
98
98
|
const { accountState, classState, classListState, accountListState, createTransferEntryState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, } = state;
|
|
99
|
-
const { selectedTransactionCategorizationCompletedSubTab, selectedTransactionCategorizationTab, } = expenseAutomationTransactionsViewState;
|
|
99
|
+
const { selectedTransactionCategorizationCompletedSubTab, selectedTransactionCategorizationTab, selectedTransactionGroup, } = expenseAutomationTransactionsViewState;
|
|
100
100
|
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, filters, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
101
101
|
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(accountState, accountListState, 'accountList');
|
|
102
102
|
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
|
|
@@ -250,5 +250,6 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
250
250
|
creditCardTransferAccountsList,
|
|
251
251
|
transferAccounts: transferAccountsList,
|
|
252
252
|
selectedTransactionCategorizationCompletedSubTab,
|
|
253
|
+
selectedTransactionGroup,
|
|
253
254
|
};
|
|
254
255
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Statement-level grouping for the Transaction Categorization listing, forwarded
|
|
3
|
+
* verbatim to the listing API as `transaction_group`. When revenue automation is
|
|
4
|
+
* enabled for the tenant the backend scopes the whole view by the line
|
|
5
|
+
* account_type: `'expense'` -> expense accounts, `'income'` -> income accounts,
|
|
6
|
+
* `'all'` -> both. When off, every value falls back to the legacy expense scope
|
|
7
|
+
* on the backend, so the group is only sent when the gate is on.
|
|
8
|
+
*
|
|
9
|
+
* The wire value for expenses is the singular `'expense'` (matches the backend
|
|
10
|
+
* `TransactionGroup` enum) even though the picker labels it "Expenses".
|
|
11
|
+
* Balance-sheet groups (assets, liability) are reserved for later and are not
|
|
12
|
+
* part of this union yet.
|
|
13
|
+
*/
|
|
14
|
+
export declare const TRANSACTION_GROUPS: readonly ["all", "income", "expense"];
|
|
15
|
+
export declare const toTransactionGroup: (v: string | null | undefined) => "income" | "expense" | "all";
|
|
16
|
+
export type TransactionGroup = ReturnType<typeof toTransactionGroup>;
|
|
17
|
+
/**
|
|
18
|
+
* Default group for the listing — matches the picker's default selection ("All").
|
|
19
|
+
* Single source of truth for initial slice state and any fall-back call site.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DEFAULT_TRANSACTION_GROUP: TransactionGroup;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_TRANSACTION_GROUP = exports.toTransactionGroup = exports.TRANSACTION_GROUPS = void 0;
|
|
4
|
+
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
|
+
/**
|
|
6
|
+
* Statement-level grouping for the Transaction Categorization listing, forwarded
|
|
7
|
+
* verbatim to the listing API as `transaction_group`. When revenue automation is
|
|
8
|
+
* enabled for the tenant the backend scopes the whole view by the line
|
|
9
|
+
* account_type: `'expense'` -> expense accounts, `'income'` -> income accounts,
|
|
10
|
+
* `'all'` -> both. When off, every value falls back to the legacy expense scope
|
|
11
|
+
* on the backend, so the group is only sent when the gate is on.
|
|
12
|
+
*
|
|
13
|
+
* The wire value for expenses is the singular `'expense'` (matches the backend
|
|
14
|
+
* `TransactionGroup` enum) even though the picker labels it "Expenses".
|
|
15
|
+
* Balance-sheet groups (assets, liability) are reserved for later and are not
|
|
16
|
+
* part of this union yet.
|
|
17
|
+
*/
|
|
18
|
+
exports.TRANSACTION_GROUPS = ['all', 'income', 'expense'];
|
|
19
|
+
const toTransactionGroup = (v) => (0, stringToUnion_1.stringToUnion)(v != null ? v.trim().toLowerCase() : '', exports.TRANSACTION_GROUPS);
|
|
20
|
+
exports.toTransactionGroup = toTransactionGroup;
|
|
21
|
+
/**
|
|
22
|
+
* Default group for the listing — matches the picker's default selection ("All").
|
|
23
|
+
* Single source of truth for initial slice state and any fall-back call site.
|
|
24
|
+
*/
|
|
25
|
+
exports.DEFAULT_TRANSACTION_GROUP = 'all';
|
|
@@ -19,6 +19,7 @@ import { EntityRecommendationKey } from '../../recommendation/recommendationStat
|
|
|
19
19
|
import { TransactionDetailKey } from '../../transactionDetail/transactionDetailState';
|
|
20
20
|
import { TransactionFilters } from '../transactionFilterTypes';
|
|
21
21
|
import { CompletedSubTab } from './completedSubTab';
|
|
22
|
+
import { TransactionGroup } from './transactionGroup';
|
|
22
23
|
export declare const toTransactionsSortKey: (v: string) => "project" | "date" | "vendor" | "category" | "class" | "amount" | "payment_account" | "transaction_type" | "memo_and_receipt";
|
|
23
24
|
export type TransactionsSortKey = ReturnType<typeof toTransactionsSortKey>;
|
|
24
25
|
export declare const TRANSACTIONS_TABS: readonly ["review", "autoCategorized"];
|
|
@@ -147,6 +148,16 @@ export type TransactionsViewState = {
|
|
|
147
148
|
parentTotalCountByTab: Record<TransactionsTab, Record<MonthYearPeriodId, number>>;
|
|
148
149
|
selectedTransactionCategorizationCompletedSubTab: CompletedSubTab;
|
|
149
150
|
selectedTransactionCategorizationTab: TransactionsTab;
|
|
151
|
+
/**
|
|
152
|
+
* Statement-level scope (`'expense' | 'income' | 'all'`) forwarded to the
|
|
153
|
+
* listing API as `transaction_group`. Unlike the in-memory {@link
|
|
154
|
+
* TransactionsTabViewState.filters}, a change here invalidates every tab /
|
|
155
|
+
* sub-tab / count and drives a server refetch (the backend re-scopes the
|
|
156
|
+
* whole dataset by account_type). Only surfaced in the UI when the
|
|
157
|
+
* `is_revenue_automation_enabled` gate is on; the backend gate is
|
|
158
|
+
* authoritative regardless of what is sent.
|
|
159
|
+
*/
|
|
160
|
+
selectedTransactionGroup: TransactionGroup;
|
|
150
161
|
transactionCategorizationView: Record<TransactionsTab, TransactionsTabViewState>;
|
|
151
162
|
};
|
|
152
163
|
export interface TransactionLineUpdates {
|
|
@@ -37,6 +37,11 @@ export interface InvoicingCatalogItemFormView extends SelectorView {
|
|
|
37
37
|
* Folded in here so the screen never reaches for the config view itself.
|
|
38
38
|
*/
|
|
39
39
|
fieldHelp: InvoicingFieldHelpByCode;
|
|
40
|
+
/**
|
|
41
|
+
* True while the accounting lists are still loading, so the form can wait
|
|
42
|
+
* instead of mounting pickers whose options are not there yet.
|
|
43
|
+
*/
|
|
44
|
+
isQboPickerDataLoading: boolean;
|
|
40
45
|
localData: InvoicingCatalogItemFormLocalData;
|
|
41
46
|
mode: 'create' | 'edit';
|
|
42
47
|
periodUnitOptions: InvoicingNamedOption[];
|
|
@@ -59,6 +59,7 @@ const getInvoicingCatalogItemFormView = (state, id) => {
|
|
|
59
59
|
const { billingPeriodUnitOptions, catalogItemTypeOptions, catalogTierTypeOptionsByPricingModel, catalogTrialEndActionOptions, catalogTrialUnitOptions, } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
60
60
|
return {
|
|
61
61
|
fieldHelp: (0, invoicingConfigViewSelector_1.invoicingFieldHelpForGroup)(state, 'catalog'),
|
|
62
|
+
isQboPickerDataLoading: (0, invoicingQboViewSelector_1.isInvoicingAccountingPickerDataLoading)(state),
|
|
62
63
|
qboClassHierarchy: isQboConnected
|
|
63
64
|
? (0, invoicingQboViewSelector_1.getInvoicingQboView)(state).nestedClassHierarchy
|
|
64
65
|
: [],
|
|
@@ -32,6 +32,7 @@ export interface InvoicingOnboardingGateView {
|
|
|
32
32
|
acceptTermsState: FetchStateAndError;
|
|
33
33
|
enableState: FetchStateAndError;
|
|
34
34
|
fetchState: FetchState;
|
|
35
|
+
isQboConnected: boolean;
|
|
35
36
|
status?: InvoicingOnboardingStatus;
|
|
36
37
|
}
|
|
37
38
|
export declare const getInvoicingOnboardingGateView: (state: RootState) => InvoicingOnboardingGateView;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.invoicingFieldHelpForGroup = exports.getInvoicingOnboardingGateView = exports.getInvoicingConfigView = void 0;
|
|
4
|
+
const invoicingQboViewSelector_1 = require("../invoicingQboView/invoicingQboViewSelector");
|
|
4
5
|
const invoicingConfigViewPayload_1 = require("./invoicingConfigViewPayload");
|
|
5
6
|
const getInvoicingConfigView = (state) => {
|
|
6
7
|
const { acceptTermsFetchState, enableFetchState, ...configState } = state.invoicingConfigViewState;
|
|
@@ -18,6 +19,7 @@ const getInvoicingOnboardingGateView = (state) => {
|
|
|
18
19
|
acceptTermsState: acceptTermsFetchState,
|
|
19
20
|
enableState: enableFetchState,
|
|
20
21
|
fetchState,
|
|
22
|
+
isQboConnected: (0, invoicingQboViewSelector_1.isInvoicingQboConnected)(state),
|
|
21
23
|
status: (0, invoicingConfigViewPayload_1.deriveInvoicingOnboardingStatus)(state.invoicingConfigViewState.isInvoicingTosAccepted, state.invoicingConfigViewState.isInvoicingEnabled),
|
|
22
24
|
};
|
|
23
25
|
};
|
|
@@ -12,12 +12,17 @@ const invoicingQboViewSelector_1 = require("../invoicingQboViewSelector");
|
|
|
12
12
|
const fetchInvoicingAccountingPickersEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.fetchInvoicingAccountingPickers.match), (0, operators_1.withLatestFrom)(state$), (0, operators_1.mergeMap)(([, state]) => {
|
|
13
13
|
const actions = [];
|
|
14
14
|
const accountList = state.accountListState.byReportId[invoicingQboViewSelector_1.INVOICING_ACCOUNT_LIST_KEY];
|
|
15
|
-
|
|
15
|
+
// `hasValidState` only reports that a fetch finished, not that it
|
|
16
|
+
// returned anything usable. The shared bucket can be Completed and empty
|
|
17
|
+
// because a screen that needs fewer accounts filled it first, which would
|
|
18
|
+
// leave the invoicing pickers empty with no request in flight to fix it.
|
|
19
|
+
const isAccountListUsable = accountList.hasValidState() && accountList.accountIds.length > 0;
|
|
20
|
+
if (isAccountListUsable === false &&
|
|
16
21
|
accountList.fetchState !== 'In-Progress') {
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
actions.push((0, accountListReducer_1.fetchAccountList)(invoicingQboViewSelector_1.INVOICING_ACCOUNT_LIST_KEY, true
|
|
22
|
+
// Same arguments the vendor and categorization screens pass, so this
|
|
23
|
+
// shares their cached list rather than replacing it with a narrower one.
|
|
24
|
+
// Invoicing narrows to income accounts when it builds its options.
|
|
25
|
+
actions.push((0, accountListReducer_1.fetchAccountList)(invoicingQboViewSelector_1.INVOICING_ACCOUNT_LIST_KEY, true));
|
|
21
26
|
}
|
|
22
27
|
const classList = state.classListState;
|
|
23
28
|
if (classList.hasValidState() === false &&
|
|
@@ -4,9 +4,17 @@ import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
|
4
4
|
import { AccountType } from '../../../entity/account/accountState';
|
|
5
5
|
import { RootState } from '../../../rootStateTypes';
|
|
6
6
|
import { InvoicingQboConnection, InvoicingQboSyncHealth } from './invoicingQboViewPayload';
|
|
7
|
-
export declare const INVOICING_ACCOUNT_LIST_KEY: "
|
|
7
|
+
export declare const INVOICING_ACCOUNT_LIST_KEY: "accountList";
|
|
8
8
|
/** Whether QBO is connected, without building the option lists to find out. */
|
|
9
9
|
export declare const isInvoicingQboConnected: (state: RootState) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the accounting pickers are still waiting on their data. Only true when
|
|
12
|
+
* QBO is connected: a tenant without it has no pickers to populate, so the form
|
|
13
|
+
* must not sit behind a skeleton waiting for lists it will never show.
|
|
14
|
+
*/
|
|
15
|
+
export declare const isInvoicingAccountingPickerDataLoading: (state: RootState) => boolean;
|
|
16
|
+
/** The QBO connection fetch on its own, without building the bundled view. */
|
|
17
|
+
export declare const getInvoicingQboConnectionFetchState: (state: RootState) => FetchStateAndError;
|
|
10
18
|
/**
|
|
11
19
|
* Account types that can back invoicing revenue. Named here so screens ask for
|
|
12
20
|
* "income accounts" rather than repeating the accounting service's vocabulary.
|
|
@@ -1,14 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInvoicingQboView = exports.invoicingAccountHierarchyForTypes = exports.invoicingAccountsForQboAccountTypes = exports.INVOICING_INCOME_ACCOUNT_TYPES = exports.isInvoicingQboConnected = exports.INVOICING_ACCOUNT_LIST_KEY = void 0;
|
|
3
|
+
exports.getInvoicingQboView = exports.invoicingAccountHierarchyForTypes = exports.invoicingAccountsForQboAccountTypes = exports.INVOICING_INCOME_ACCOUNT_TYPES = exports.getInvoicingQboConnectionFetchState = exports.isInvoicingAccountingPickerDataLoading = exports.isInvoicingQboConnected = exports.INVOICING_ACCOUNT_LIST_KEY = void 0;
|
|
4
4
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
5
5
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
6
|
+
// The shared bucket, fetched with the same arguments as the other consumers so
|
|
7
|
+
// whichever screen loads first satisfies the rest. Invoicing narrows to income
|
|
8
|
+
// accounts when it builds its options, so it does not need its own copy.
|
|
9
|
+
exports.INVOICING_ACCOUNT_LIST_KEY = 'accountList';
|
|
9
10
|
/** Whether QBO is connected, without building the option lists to find out. */
|
|
10
11
|
const isInvoicingQboConnected = (state) => state.invoicingQboViewState.connection?.connected === true;
|
|
11
12
|
exports.isInvoicingQboConnected = isInvoicingQboConnected;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the accounting pickers are still waiting on their data. Only true when
|
|
15
|
+
* QBO is connected: a tenant without it has no pickers to populate, so the form
|
|
16
|
+
* must not sit behind a skeleton waiting for lists it will never show.
|
|
17
|
+
*/
|
|
18
|
+
const isInvoicingAccountingPickerDataLoading = (state) => {
|
|
19
|
+
const isPending = (fetchState) => fetchState === 'Not-Started' || fetchState === 'In-Progress';
|
|
20
|
+
// The connection settles first and decides whether the lists are fetched at
|
|
21
|
+
// all, so it counts as loading too. Reporting "not loading" while it is in
|
|
22
|
+
// flight renders the form, then takes it away again the moment the tenant
|
|
23
|
+
// turns out to be connected.
|
|
24
|
+
if (isPending((0, exports.getInvoicingQboConnectionFetchState)(state).fetchState)) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
if (!(0, exports.isInvoicingQboConnected)(state)) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
const accountList = state.accountListState.byReportId[exports.INVOICING_ACCOUNT_LIST_KEY];
|
|
31
|
+
return (isPending(accountList.fetchState) ||
|
|
32
|
+
isPending(state.classListState.fetchState));
|
|
33
|
+
};
|
|
34
|
+
exports.isInvoicingAccountingPickerDataLoading = isInvoicingAccountingPickerDataLoading;
|
|
35
|
+
/** The QBO connection fetch on its own, without building the bundled view. */
|
|
36
|
+
const getInvoicingQboConnectionFetchState = (state) => state.invoicingQboViewState.connectionFetchState;
|
|
37
|
+
exports.getInvoicingQboConnectionFetchState = getInvoicingQboConnectionFetchState;
|
|
12
38
|
/**
|
|
13
39
|
* Account types that can back invoicing revenue. Named here so screens ask for
|
|
14
40
|
* "income accounts" rather than repeating the accounting service's vocabulary.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
2
|
import { InvoicingDunningActionOption, InvoicingNamedOption, InvoicingQboAccountMappingKindOption, InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
3
|
-
import { RootState } from '../../../rootStateTypes';
|
|
4
3
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
4
|
+
import { RootState } from '../../../rootStateTypes';
|
|
5
5
|
import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
|
|
6
6
|
/**
|
|
7
7
|
* Shared primitive: the raw invoicing settings. Consumed internally by other
|
|
@@ -53,6 +53,12 @@ export interface InvoicingSettingsHubView {
|
|
|
53
53
|
configFetchState: FetchState;
|
|
54
54
|
dunningScheduleActionOptions: InvoicingDunningActionOption[];
|
|
55
55
|
isEnablingInvoicing: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the tenant has already enabled invoicing. The enable footer is for
|
|
58
|
+
* tenants that have not, so this — not `canEnableInvoicing` — decides whether
|
|
59
|
+
* it renders at all.
|
|
60
|
+
*/
|
|
61
|
+
isInvoicingEnabled: boolean;
|
|
56
62
|
isQboConfigured: boolean;
|
|
57
63
|
isStripeConnected: boolean;
|
|
58
64
|
qboAccountMappingKindOptions: InvoicingQboAccountMappingKindOption[];
|
|
@@ -67,9 +73,10 @@ export interface InvoicingSettingsHubView {
|
|
|
67
73
|
* two integration prerequisites kept separate so the hub can name the step still
|
|
68
74
|
* outstanding instead of showing a dead button.
|
|
69
75
|
*
|
|
70
|
-
* `
|
|
71
|
-
*
|
|
72
|
-
*
|
|
76
|
+
* `isInvoicingEnabled` decides whether the footer renders; `canEnableInvoicing`
|
|
77
|
+
* whether its button is live, and it still requires the onboarding step so the
|
|
78
|
+
* terms cannot be skipped. A tenant partway through therefore sees the footer,
|
|
79
|
+
* disabled and naming what is left, rather than nothing at all.
|
|
73
80
|
*
|
|
74
81
|
* Deliberately not folded into `getInvoicingConfigView`: that selector gates
|
|
75
82
|
* every invoicing route and stays a pure read of the config slice. The settings
|
|
@@ -70,9 +70,10 @@ function deriveInvoicingEnablePrerequisites(settings, isQboConnected, qboAccount
|
|
|
70
70
|
* two integration prerequisites kept separate so the hub can name the step still
|
|
71
71
|
* outstanding instead of showing a dead button.
|
|
72
72
|
*
|
|
73
|
-
* `
|
|
74
|
-
*
|
|
75
|
-
*
|
|
73
|
+
* `isInvoicingEnabled` decides whether the footer renders; `canEnableInvoicing`
|
|
74
|
+
* whether its button is live, and it still requires the onboarding step so the
|
|
75
|
+
* terms cannot be skipped. A tenant partway through therefore sees the footer,
|
|
76
|
+
* disabled and naming what is left, rather than nothing at all.
|
|
76
77
|
*
|
|
77
78
|
* Deliberately not folded into `getInvoicingConfigView`: that selector gates
|
|
78
79
|
* every invoicing route and stays a pure read of the config slice. The settings
|
|
@@ -82,7 +83,10 @@ const getInvoicingSettingsHubView = (state) => {
|
|
|
82
83
|
const { dunningScheduleActionOptions, enableState, error: configError, fetchState: configFetchState, qboAccountMappingKindOptions, qboCustomerMatchingOptions, qboSyncStatusOptions, status, } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
83
84
|
const { canEnable, isQboConfigured, isStripeConnected } = deriveInvoicingEnablePrerequisites(state.invoicingSettingsViewState.settings, state.invoicingQboViewState.connection?.connected === true, qboAccountMappingKindOptions);
|
|
84
85
|
return {
|
|
86
|
+
// Keeps the onboarding step in the gate: a tenant that has not accepted the
|
|
87
|
+
// terms cannot enable invoicing, whatever the integrations say.
|
|
85
88
|
canEnableInvoicing: status === 'settings' && canEnable,
|
|
89
|
+
isInvoicingEnabled: state.invoicingConfigViewState.isInvoicingEnabled === true,
|
|
86
90
|
configError,
|
|
87
91
|
configFetchState,
|
|
88
92
|
dunningScheduleActionOptions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.8",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|