@zeniai/client-epic-state 5.2.94-betaNB1 → 5.2.95-beta0KB

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.
@@ -28,6 +28,8 @@ export const initialState = {
28
28
  reimbursementAccountList: initialAccountList,
29
29
  schedulesAccountList: initialAccountList,
30
30
  billPayAccountList: initialAccountList,
31
+ createTransactionLineAccountList: initialAccountList,
32
+ createTransactionPaymentAccountList: initialAccountList,
31
33
  },
32
34
  };
33
35
  const accountList = createSlice({
@@ -116,15 +116,13 @@ export const getInvoicingQboAccountOptions = createSelector([
116
116
  * Normalises an account-type name for comparison. The config's mapping kinds
117
117
  * name QuickBooks types the way QuickBooks displays them ("Other Current
118
118
  * Asset", "Expense"), while the accounting service uses snake_case and
119
- * sometimes pluralises ("other_current_assets", "expenses"). Comparing the
120
- * normalised, de-pluralised forms keeps a picker from silently emptying because
121
- * of a trailing "s".
119
+ * sometimes pluralises ("other_current_assets", "expenses"), and QuickBooks
120
+ * itself sends PascalCase sub types ("SalesTaxPayable"). Comparing the
121
+ * separator-free, de-pluralised forms keeps a picker from silently emptying
122
+ * because of a trailing "s", and an exclusion from missing on casing.
122
123
  */
123
124
  const normalizeAccountTypeName = (value) => {
124
- const normalized = value
125
- .trim()
126
- .toLowerCase()
127
- .replace(/[^a-z0-9]+/g, '_');
125
+ const normalized = value.toLowerCase().replace(/[^a-z0-9]+/g, '');
128
126
  // Singularise so "Other Current Liability" meets `other_current_liabilities`
129
127
  // and "Expense" meets `expenses`. `-ies` needs its own case: stripping the
130
128
  // trailing "s" alone would leave "liabilitie", matching nothing.
@@ -1,5 +1,5 @@
1
1
  import { createSelector } from '@reduxjs/toolkit';
2
- import { getNestedAccountListHierarchy } from '../../accountList/accountListSelector';
2
+ import { getAccountListFetchState, getNestedAccountListHierarchy, } from '../../accountList/accountListSelector';
3
3
  import { getNestedClassListHierarchy } from '../../classList/classListSelector';
4
4
  import { getResolvedTransferAccounts } from '../../createTransferEntry/createTransferEntrySelector';
5
5
  import { getRecommendationsForEntity } from '../../recommendation/recommendationSelector';
@@ -39,7 +39,11 @@ export const getCreateTransactionView = createSelector([
39
39
  createStatus: createTransactionsState.createStatus,
40
40
  createdTransactionId: createTransactionsState.createdTransactionId,
41
41
  vendorList: Object.values(vendorByID),
42
- accountListNestedAccountHierarchy: getNestedAccountListHierarchy(accountListState, 'accountList'),
42
+ accountListFetchState: getAccountListFetchState(accountListState, 'accountList'),
43
+ lineAccountListFetchState: getAccountListFetchState(accountListState, 'createTransactionLineAccountList'),
44
+ paymentAccountListFetchState: getAccountListFetchState(accountListState, 'createTransactionPaymentAccountList'),
45
+ accountListNestedAccountHierarchy: getNestedAccountListHierarchy(accountListState, 'createTransactionLineAccountList'),
46
+ paymentAccountListNestedAccountHierarchy: getNestedAccountListHierarchy(accountListState, 'createTransactionPaymentAccountList'),
43
47
  classListNestedAccountHierarchy: getNestedClassListHierarchy(classListState),
44
48
  transferAccountsList: transactionType === 'transfer' ? transferAccountsList : [],
45
49
  fetchState: createTransactionsState.createStatus.fetchState,
@@ -35,6 +35,8 @@ exports.initialState = {
35
35
  reimbursementAccountList: exports.initialAccountList,
36
36
  schedulesAccountList: exports.initialAccountList,
37
37
  billPayAccountList: exports.initialAccountList,
38
+ createTransactionLineAccountList: exports.initialAccountList,
39
+ createTransactionPaymentAccountList: exports.initialAccountList,
38
40
  },
39
41
  };
40
42
  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' | 'createTransactionLineAccountList' | 'createTransactionPaymentAccountList';
5
5
  export interface AccountList extends FetchedState {
6
6
  accountIds: ID[];
7
7
  accountIdsByLabel: Record<AccountLabel, ID[]>;
@@ -125,15 +125,13 @@ exports.getInvoicingQboAccountOptions = (0, toolkit_1.createSelector)([
125
125
  * Normalises an account-type name for comparison. The config's mapping kinds
126
126
  * name QuickBooks types the way QuickBooks displays them ("Other Current
127
127
  * Asset", "Expense"), while the accounting service uses snake_case and
128
- * sometimes pluralises ("other_current_assets", "expenses"). Comparing the
129
- * normalised, de-pluralised forms keeps a picker from silently emptying because
130
- * of a trailing "s".
128
+ * sometimes pluralises ("other_current_assets", "expenses"), and QuickBooks
129
+ * itself sends PascalCase sub types ("SalesTaxPayable"). Comparing the
130
+ * separator-free, de-pluralised forms keeps a picker from silently emptying
131
+ * because of a trailing "s", and an exclusion from missing on casing.
131
132
  */
132
133
  const normalizeAccountTypeName = (value) => {
133
- const normalized = value
134
- .trim()
135
- .toLowerCase()
136
- .replace(/[^a-z0-9]+/g, '_');
134
+ const normalized = value.toLowerCase().replace(/[^a-z0-9]+/g, '');
137
135
  // Singularise so "Other Current Liability" meets `other_current_liabilities`
138
136
  // and "Expense" meets `expenses`. `-ies` needs its own case: stripping the
139
137
  // trailing "s" alone would leave "liabilitie", matching nothing.
@@ -9,15 +9,21 @@ import { Vendor } from '../../../entity/vendor/vendorState';
9
9
  import { RootState } from '../../../rootStateTypes';
10
10
  import { CreatableTransactionType, CreateTransactionLocalData } from './createTransactionState';
11
11
  export interface CreateTransactionView extends SelectorView {
12
+ /** The shared COA; on this page it only backs the transfer From/To fallback. */
13
+ accountListFetchState: FetchState;
12
14
  /**
13
- * COA and class trees for the header account and the line dropdowns. The hierarchies rather
14
- * than flat lists, because the create page builds its grouped "Recommended" / "All" options
15
- * with the same helpers the detail page uses.
15
+ * COA and class trees for the line dropdowns. The hierarchies rather than flat lists, because
16
+ * the create page builds its grouped "Recommended" / "All" options with the same helpers the
17
+ * detail page uses.
16
18
  */
17
19
  accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
18
20
  classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
19
21
  createStatus: FetchStateAndError;
22
+ lineAccountListFetchState: FetchState;
20
23
  localData: CreateTransactionLocalData;
24
+ paymentAccountListFetchState: FetchState;
25
+ /** Bank, credit card and other current asset accounts for the header payment account. */
26
+ paymentAccountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
21
27
  transactionType: CreatableTransactionType;
22
28
  /** Populated for transfer only; the COA would offer ineligible accounts. */
23
29
  transferAccountsList: AccountBase[];
@@ -45,7 +45,11 @@ exports.getCreateTransactionView = (0, toolkit_1.createSelector)([
45
45
  createStatus: createTransactionsState.createStatus,
46
46
  createdTransactionId: createTransactionsState.createdTransactionId,
47
47
  vendorList: Object.values(vendorByID),
48
- accountListNestedAccountHierarchy: (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, 'accountList'),
48
+ accountListFetchState: (0, accountListSelector_1.getAccountListFetchState)(accountListState, 'accountList'),
49
+ lineAccountListFetchState: (0, accountListSelector_1.getAccountListFetchState)(accountListState, 'createTransactionLineAccountList'),
50
+ paymentAccountListFetchState: (0, accountListSelector_1.getAccountListFetchState)(accountListState, 'createTransactionPaymentAccountList'),
51
+ accountListNestedAccountHierarchy: (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, 'createTransactionLineAccountList'),
52
+ paymentAccountListNestedAccountHierarchy: (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, 'createTransactionPaymentAccountList'),
49
53
  classListNestedAccountHierarchy: (0, classListSelector_1.getNestedClassListHierarchy)(classListState),
50
54
  transferAccountsList: transactionType === 'transfer' ? transferAccountsList : [],
51
55
  fetchState: createTransactionsState.createStatus.fetchState,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.94-betaNB1",
3
+ "version": "5.2.95-beta0KB",
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",