@zeniai/client-epic-state 5.2.7 → 5.2.8-betaAK0
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 +36 -2
- package/lib/entity/invoicing/invoicingCommonPayload.js +89 -11
- package/lib/entity/invoicing/product/productPayload.d.ts +10 -0
- package/lib/entity/invoicing/product/productPayload.js +14 -2
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +86 -10
- package/lib/esm/entity/invoicing/product/productPayload.js +14 -2
- 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/editInvoicingCatalogItemDetailViewPayload.js +24 -9
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +2 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -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 +47 -3
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +17 -2
- 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/editInvoicingCatalogItemDetailViewPayload.d.ts +12 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +24 -9
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +5 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +1 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
- 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 +19 -2
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +52 -4
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +1 -1
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +17 -2
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +11 -4
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +7 -3
- package/package.json +1 -1
|
@@ -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 {
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
import { AccountBase } from '../../../entity/account/accountState';
|
|
2
|
+
import { ClassBase } from '../../../entity/class/classState';
|
|
1
3
|
import { InvoicingPlanPayload } from '../../../entity/invoicing/plan/planPayload';
|
|
2
4
|
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
3
5
|
import { InvoicingCatalogItemFormLocalData } from './editInvoicingCatalogItemDetailViewState';
|
|
4
6
|
export type SaveInvoicingCatalogItemResponse = ZeniAPIResponse<InvoicingPlanPayload>;
|
|
7
|
+
/**
|
|
8
|
+
* Resolves the QuickBooks ids the pickers submit back to the entities they name.
|
|
9
|
+
* The payload carries the whole account and class, so the ids alone are not
|
|
10
|
+
* enough; `saveInvoicingCatalogItemEpic` builds this from the shared lists.
|
|
11
|
+
*/
|
|
12
|
+
export interface InvoicingCatalogAccountingLookup {
|
|
13
|
+
accountByQboId: (qboId: string) => AccountBase | undefined;
|
|
14
|
+
classByQboId: (qboId: string) => ClassBase | undefined;
|
|
15
|
+
}
|
|
5
16
|
/**
|
|
6
17
|
* Build the parent catalog-item request body from the form draft. Creates omit
|
|
7
18
|
* both parent and sub-family IDs; edits retain returned sub-family IDs.
|
|
8
19
|
*/
|
|
9
|
-
export declare const localDataToSaveInvoicingCatalogItemPayload: (localData: InvoicingCatalogItemFormLocalData, isCreate: boolean) => Record<string, unknown>;
|
|
20
|
+
export declare const localDataToSaveInvoicingCatalogItemPayload: (localData: InvoicingCatalogItemFormLocalData, isCreate: boolean, lookup: InvoicingCatalogAccountingLookup) => Record<string, unknown>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.localDataToSaveInvoicingCatalogItemPayload = void 0;
|
|
4
|
+
const accountPayload_1 = require("../../../entity/account/accountPayload");
|
|
5
|
+
const classPayload_1 = require("../../../entity/class/classPayload");
|
|
4
6
|
const invoicingCatalogItemFormConfig_1 = require("./invoicingCatalogItemFormConfig");
|
|
5
7
|
const CURRENCY_CODE = 'USD';
|
|
6
8
|
const trimOrUndefined = (value) => value.trim() !== '' ? value.trim() : undefined;
|
|
@@ -10,20 +12,26 @@ const toProductCode = (value) => value
|
|
|
10
12
|
.toLowerCase()
|
|
11
13
|
.replace(/[^a-z0-9]+/g, '-')
|
|
12
14
|
.replace(/^-|-$/g, '');
|
|
13
|
-
const buildAccountingDetail = (subFamily) => {
|
|
15
|
+
const buildAccountingDetail = (subFamily, lookup) => {
|
|
14
16
|
const detail = {};
|
|
15
17
|
if (subFamily.sku.trim() !== '') {
|
|
16
18
|
detail.sku = subFamily.sku.trim();
|
|
17
19
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
// The account and class travel as whole objects rather than bare codes, built
|
|
21
|
+
// by the same helpers the transaction and vendor payloads use. An id that no
|
|
22
|
+
// longer resolves is dropped: sending a code the service cannot expand is how
|
|
23
|
+
// a mapping silently lands on the wrong account.
|
|
24
|
+
const account = lookup.accountByQboId(subFamily.accountingCode.trim());
|
|
25
|
+
if (account != null) {
|
|
26
|
+
detail.account = (0, accountPayload_1.toAccountPayload)(account);
|
|
20
27
|
}
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
const accountingClass = lookup.classByQboId(subFamily.accountingCategory.trim());
|
|
29
|
+
if (accountingClass != null) {
|
|
30
|
+
detail.accounting_class = (0, classPayload_1.toClassBasePayload)(accountingClass);
|
|
23
31
|
}
|
|
24
32
|
return Object.keys(detail).length > 0 ? detail : undefined;
|
|
25
33
|
};
|
|
26
|
-
const buildSubFamilyPayload = (localData, subFamily, clearEmptyValues) => {
|
|
34
|
+
const buildSubFamilyPayload = (localData, subFamily, clearEmptyValues, lookup) => {
|
|
27
35
|
const isAddon = localData.catalogType === 'addon';
|
|
28
36
|
const tiered = (0, invoicingCatalogItemFormConfig_1.isTieredCatalogPricingModel)(subFamily.pricingModel);
|
|
29
37
|
const name = subFamily.name.trim();
|
|
@@ -77,7 +85,7 @@ const buildSubFamilyPayload = (localData, subFamily, clearEmptyValues) => {
|
|
|
77
85
|
starting_unit: Number(tier.startingUnit) || 1,
|
|
78
86
|
}));
|
|
79
87
|
}
|
|
80
|
-
const accountingDetail = buildAccountingDetail(subFamily);
|
|
88
|
+
const accountingDetail = buildAccountingDetail(subFamily, lookup);
|
|
81
89
|
if (accountingDetail != null) {
|
|
82
90
|
payload.accounting_detail = accountingDetail;
|
|
83
91
|
}
|
|
@@ -89,7 +97,7 @@ const DEFAULT_CATALOG_ITEM_UNIT = 'USD';
|
|
|
89
97
|
* Build the parent catalog-item request body from the form draft. Creates omit
|
|
90
98
|
* both parent and sub-family IDs; edits retain returned sub-family IDs.
|
|
91
99
|
*/
|
|
92
|
-
const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate) => {
|
|
100
|
+
const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate, lookup) => {
|
|
93
101
|
const description = trimOrUndefined(localData.description);
|
|
94
102
|
const productCode = trimOrUndefined(localData.productCode) ?? toProductCode(localData.name);
|
|
95
103
|
const itemPayload = {
|
|
@@ -117,7 +125,7 @@ const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate) => {
|
|
|
117
125
|
? localData.subFamilies
|
|
118
126
|
: [(0, invoicingCatalogItemFormConfig_1.blankInvoicingCatalogSubFamily)()];
|
|
119
127
|
itemPayload.sub_family_details = isCreate
|
|
120
|
-
? subFamilies.map((subFamily) => buildSubFamilyPayload(localData, subFamily, false))
|
|
128
|
+
? subFamilies.map((subFamily) => buildSubFamilyPayload(localData, subFamily, false, lookup))
|
|
121
129
|
: subFamilies.map((subFamily) => {
|
|
122
130
|
const priceCode = trimOrUndefined(subFamily.priceCode) ?? toProductCode(subFamily.name);
|
|
123
131
|
const detail = {
|
|
@@ -127,6 +135,13 @@ const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate) => {
|
|
|
127
135
|
price_code: priceCode,
|
|
128
136
|
show_description_in_invoices: subFamily.showDescriptionInInvoices,
|
|
129
137
|
};
|
|
138
|
+
// Edits send a narrower body than creates, but the accounting mapping
|
|
139
|
+
// is editable on this form, so leaving it out dropped the account and
|
|
140
|
+
// class the user had just picked.
|
|
141
|
+
const accountingDetail = buildAccountingDetail(subFamily, lookup);
|
|
142
|
+
if (accountingDetail != null) {
|
|
143
|
+
detail.accounting_detail = accountingDetail;
|
|
144
|
+
}
|
|
130
145
|
const id = trimOrUndefined(subFamily.id);
|
|
131
146
|
return id != null ? { ...detail, id } : detail;
|
|
132
147
|
});
|
|
@@ -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
|
: [],
|
package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js
CHANGED
|
@@ -9,6 +9,7 @@ const snackbarApiError_1 = require("../../../entity/snackbar/snackbarApiError");
|
|
|
9
9
|
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
10
10
|
const responsePayload_1 = require("../../../responsePayload");
|
|
11
11
|
const invoicingCatalogListViewReducer_1 = require("../invoicingCatalogListView/invoicingCatalogListViewReducer");
|
|
12
|
+
const invoicingQboViewSelector_1 = require("../invoicingQboView/invoicingQboViewSelector");
|
|
12
13
|
const editInvoicingCatalogItemDetailViewPayload_1 = require("./editInvoicingCatalogItemDetailViewPayload");
|
|
13
14
|
const editInvoicingCatalogItemDetailViewReducer_1 = require("./editInvoicingCatalogItemDetailViewReducer");
|
|
14
15
|
const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)((action) => editInvoicingCatalogItemDetailViewReducer_1.submitInvoicingCatalogItemForm.match(action) ||
|
|
@@ -23,7 +24,11 @@ const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
23
24
|
const viewState = state$.value.editInvoicingCatalogItemDetailViewState;
|
|
24
25
|
const localData = (id != null ? viewState.editDraftById[id] : viewState.newItemDraft) ??
|
|
25
26
|
viewState.newItemDraft;
|
|
26
|
-
|
|
27
|
+
const state = state$.value;
|
|
28
|
+
data = (0, editInvoicingCatalogItemDetailViewPayload_1.localDataToSaveInvoicingCatalogItemPayload)(localData, id == null, {
|
|
29
|
+
accountByQboId: (qboId) => (0, invoicingQboViewSelector_1.invoicingQboAccountByQboId)(state, qboId),
|
|
30
|
+
classByQboId: (qboId) => (0, invoicingQboViewSelector_1.invoicingQboClassByQboId)(state, qboId),
|
|
31
|
+
});
|
|
27
32
|
}
|
|
28
33
|
const baseUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0`;
|
|
29
34
|
const path = id != null
|
|
@@ -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 &&
|
|
@@ -1,17 +1,34 @@
|
|
|
1
1
|
import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
|
|
2
2
|
import { NestedClassHierarchyForReport } from '../../../commonStateTypes/classesView/nestedClassID';
|
|
3
3
|
import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
4
|
-
import { AccountType } from '../../../entity/account/accountState';
|
|
4
|
+
import { AccountBase, AccountType } from '../../../entity/account/accountState';
|
|
5
|
+
import { ClassBase } from '../../../entity/class/classState';
|
|
5
6
|
import { RootState } from '../../../rootStateTypes';
|
|
6
7
|
import { InvoicingQboConnection, InvoicingQboSyncHealth } from './invoicingQboViewPayload';
|
|
7
|
-
export declare const INVOICING_ACCOUNT_LIST_KEY: "
|
|
8
|
+
export declare const INVOICING_ACCOUNT_LIST_KEY: "accountList";
|
|
8
9
|
/** Whether QBO is connected, without building the option lists to find out. */
|
|
9
10
|
export declare const isInvoicingQboConnected: (state: RootState) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the accounting pickers are still waiting on their data. Only true when
|
|
13
|
+
* QBO is connected: a tenant without it has no pickers to populate, so the form
|
|
14
|
+
* must not sit behind a skeleton waiting for lists it will never show.
|
|
15
|
+
*/
|
|
16
|
+
export declare const isInvoicingAccountingPickerDataLoading: (state: RootState) => boolean;
|
|
17
|
+
/** The QBO connection fetch on its own, without building the bundled view. */
|
|
18
|
+
export declare const getInvoicingQboConnectionFetchState: (state: RootState) => FetchStateAndError;
|
|
10
19
|
/**
|
|
11
20
|
* Account types that can back invoicing revenue. Named here so screens ask for
|
|
12
21
|
* "income accounts" rather than repeating the accounting service's vocabulary.
|
|
13
22
|
*/
|
|
14
23
|
export declare const INVOICING_INCOME_ACCOUNT_TYPES: readonly AccountType[];
|
|
24
|
+
/**
|
|
25
|
+
* The account behind a picker value. The pickers submit the QuickBooks id, so
|
|
26
|
+
* that is what callers hold; the payload builders need the whole entity to send
|
|
27
|
+
* `toAccountPayload`, which is why the lookup lives here next to the options.
|
|
28
|
+
*/
|
|
29
|
+
export declare const invoicingQboAccountByQboId: (state: RootState, qboId: string | undefined) => AccountBase | undefined;
|
|
30
|
+
/** The class behind a picker value, for the same reason as the account above. */
|
|
31
|
+
export declare const invoicingQboClassByQboId: (state: RootState, qboId: string | undefined) => ClassBase | undefined;
|
|
15
32
|
/** An account or class as the invoicing pickers render and submit it. */
|
|
16
33
|
export interface InvoicingAccountingOption {
|
|
17
34
|
id: string;
|
|
@@ -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.invoicingQboClassByQboId = exports.invoicingQboAccountByQboId = 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.
|
|
@@ -17,6 +43,28 @@ exports.INVOICING_INCOME_ACCOUNT_TYPES = [
|
|
|
17
43
|
'income',
|
|
18
44
|
'other_income',
|
|
19
45
|
];
|
|
46
|
+
/**
|
|
47
|
+
* The account behind a picker value. The pickers submit the QuickBooks id, so
|
|
48
|
+
* that is what callers hold; the payload builders need the whole entity to send
|
|
49
|
+
* `toAccountPayload`, which is why the lookup lives here next to the options.
|
|
50
|
+
*/
|
|
51
|
+
const invoicingQboAccountByQboId = (state, qboId) => {
|
|
52
|
+
if (qboId == null || qboId === '') {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
const { accounts } = (0, accountListSelector_1.getAccountList)(state.accountState, state.accountListState, exports.INVOICING_ACCOUNT_LIST_KEY);
|
|
56
|
+
return accounts.find((account) => String(account.qboId) === qboId);
|
|
57
|
+
};
|
|
58
|
+
exports.invoicingQboAccountByQboId = invoicingQboAccountByQboId;
|
|
59
|
+
/** The class behind a picker value, for the same reason as the account above. */
|
|
60
|
+
const invoicingQboClassByQboId = (state, qboId) => {
|
|
61
|
+
if (qboId == null || qboId === '') {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
const { classes } = (0, classListSelector_1.getClassList)(state.classState, state.classListState);
|
|
65
|
+
return classes.find((accountingClass) => String(accountingClass.qboId) === qboId);
|
|
66
|
+
};
|
|
67
|
+
exports.invoicingQboClassByQboId = invoicingQboClassByQboId;
|
|
20
68
|
/**
|
|
21
69
|
* Accounts and classes as the invoicing pickers need them. Both come from the
|
|
22
70
|
* shared accounting-service lists, so whatever another screen already loaded
|
|
@@ -9,4 +9,4 @@ export type ActionType = ReturnType<typeof fetchInvoicingSettings> | ReturnType<
|
|
|
9
9
|
export declare const fetchInvoicingSettingsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
10
10
|
export declare const connectInvoicingStripeEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
11
11
|
export declare const disconnectInvoicingStripeEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
12
|
-
export declare const saveInvoicingSettingsEpic: (actions$: ActionsObservable<ActionType>,
|
|
12
|
+
export declare const saveInvoicingSettingsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|