@zeniai/client-epic-state 5.2.12 → 5.2.13-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.
Files changed (37) hide show
  1. package/lib/esm/index.js +5 -4
  2. package/lib/esm/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.js +23 -7
  3. package/lib/esm/view/expenseAutomationView/epics/accountRecon/updateCombinedStatementInfoEpic.js +1 -1
  4. package/lib/esm/view/expenseAutomationView/payload/reconciliationPayload.js +1 -1
  5. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +5 -0
  6. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +33 -2
  7. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +24 -7
  8. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +1 -1
  9. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +6 -8
  10. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogSubFamilyEpics.js +8 -2
  11. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +15 -10
  12. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +0 -1
  13. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +15 -36
  14. package/lib/index.d.ts +7 -5
  15. package/lib/index.js +49 -46
  16. package/lib/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.js +23 -7
  17. package/lib/view/expenseAutomationView/epics/accountRecon/updateCombinedStatementInfoEpic.js +1 -1
  18. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +8 -3
  19. package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +1 -1
  20. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +5 -0
  21. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.d.ts +3 -1
  22. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +34 -2
  23. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +6 -0
  24. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +11 -2
  25. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +24 -7
  26. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +7 -0
  27. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +4 -3
  28. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.d.ts +19 -4
  29. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +5 -4
  30. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +5 -7
  31. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogSubFamilyEpics.d.ts +1 -1
  32. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogSubFamilyEpics.js +8 -2
  33. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +14 -9
  34. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +0 -1
  35. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +12 -13
  36. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +16 -38
  37. package/package.json +1 -1
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.getInvoicingQboView = exports.invoicingAccountsForQboAccountTypes = exports.getInvoicingCatalogAccountingLookup = exports.invoicingQboClassByQboId = exports.invoicingQboAccountByQboId = exports.getInvoicingQboConnectionFetchState = exports.isInvoicingAccountingPickerDataLoading = exports.isInvoicingQboConnected = exports.INVOICING_ACCOUNT_LIST_KEY = void 0;
4
+ const toolkit_1 = require("@reduxjs/toolkit");
4
5
  const accountListSelector_1 = require("../../accountList/accountListSelector");
5
6
  const classListSelector_1 = require("../../classList/classListSelector");
6
7
  // 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.
8
+ // whichever screen loads first satisfies the rest. Invoicing renders the same
9
+ // accounts they do, so it does not need its own copy.
9
10
  exports.INVOICING_ACCOUNT_LIST_KEY = 'accountList';
10
11
  /** Whether QBO is connected, without building the option lists to find out. */
11
12
  const isInvoicingQboConnected = (state) => state.invoicingQboViewState.connection?.connected === true;
@@ -35,14 +36,6 @@ exports.isInvoicingAccountingPickerDataLoading = isInvoicingAccountingPickerData
35
36
  /** The QBO connection fetch on its own, without building the bundled view. */
36
37
  const getInvoicingQboConnectionFetchState = (state) => state.invoicingQboViewState.connectionFetchState;
37
38
  exports.getInvoicingQboConnectionFetchState = getInvoicingQboConnectionFetchState;
38
- /**
39
- * Account types that can back invoicing revenue. Named here so screens ask for
40
- * "income accounts" rather than repeating the accounting service's vocabulary.
41
- */
42
- exports.INVOICING_INCOME_ACCOUNT_TYPES = [
43
- 'income',
44
- 'other_income',
45
- ];
46
39
  /**
47
40
  * The account behind a picker value. The pickers submit the QuickBooks id, so
48
41
  * that is what callers hold; the payload builders need the whole entity to send
@@ -85,6 +78,17 @@ const invoicingQboClassByQboId = (state, qboId) => {
85
78
  }
86
79
  };
87
80
  exports.invoicingQboClassByQboId = invoicingQboClassByQboId;
81
+ /**
82
+ * The resolver every catalog and settings payload builder needs: a picked
83
+ * QuickBooks id turned back into the account or class record the request body
84
+ * carries. Memoized so callers get one stable object rather than a fresh pair of
85
+ * closures per store change, which in `mapStateToProps` would re-render on every
86
+ * unrelated action.
87
+ */
88
+ exports.getInvoicingCatalogAccountingLookup = (0, toolkit_1.createSelector)((state) => state, (state) => ({
89
+ accountByQboId: (qboId) => (0, exports.invoicingQboAccountByQboId)(state, qboId),
90
+ classByQboId: (qboId) => (0, exports.invoicingQboClassByQboId)(state, qboId),
91
+ }));
88
92
  /**
89
93
  * Accounts and classes as the invoicing pickers need them. Both come from the
90
94
  * shared accounting-service lists, so whatever another screen already loaded
@@ -92,17 +96,12 @@ exports.invoicingQboClassByQboId = invoicingQboClassByQboId;
92
96
  * API stores; an account without one cannot be posted, so it is dropped rather
93
97
  * than offered.
94
98
  */
95
- const invoicingAccountingOptions = (state, accountTypes) => {
99
+ const invoicingAccountingOptions = (state) => {
96
100
  const { accounts } = (0, accountListSelector_1.getAccountList)(state.accountState, state.accountListState, exports.INVOICING_ACCOUNT_LIST_KEY);
97
101
  return accounts.flatMap((account) => {
98
102
  if (account.qboId == null || account.isDeleted === true) {
99
103
  return [];
100
104
  }
101
- if (accountTypes != null &&
102
- (account.accountType == null ||
103
- !accountTypes.includes(account.accountType))) {
104
- return [];
105
- }
106
105
  return [
107
106
  {
108
107
  id: String(account.qboId),
@@ -160,27 +159,6 @@ const invoicingAccountingClassOptions = (state) => {
160
159
  },
161
160
  ]);
162
161
  };
163
- /**
164
- * The account tree narrowed to the given account types. The tree itself carries
165
- * no account type, so the flat account list supplies that and the matching
166
- * `qboId`s are kept — which is why callers that only need "income accounts, as a
167
- * tree" do not have to hold a second flat list to filter with.
168
- */
169
- const invoicingAccountHierarchyForTypes = (state, accountTypes) => {
170
- const allowedQboIds = new Set(invoicingAccountingOptions(state, accountTypes).map((account) => account.id));
171
- const keepMatching = (nodes) => nodes.flatMap((node) => {
172
- const children = keepMatching(node.children);
173
- const isMatch = node.qboId != null && allowedQboIds.has(String(node.qboId));
174
- // A parent that is not itself a match is still kept when it holds one, so
175
- // the tree's shape survives the filter.
176
- if (!isMatch && children.length === 0) {
177
- return [];
178
- }
179
- return [{ ...node, children }];
180
- });
181
- return keepMatching((0, accountListSelector_1.getNestedAccountListHierarchy)(state.accountListState, exports.INVOICING_ACCOUNT_LIST_KEY));
182
- };
183
- exports.invoicingAccountHierarchyForTypes = invoicingAccountHierarchyForTypes;
184
162
  /**
185
163
  * Single bundled view for the QBO integration settings screen — the
186
164
  * connection, the account and class options, sync health, and the fetch/action
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.12",
3
+ "version": "5.2.13-betaAK0",
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",