@zeniai/client-epic-state 4.14.76 → 4.14.77
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/epic.d.ts +1 -5
- package/lib/epic.js +1 -5
- package/lib/index.d.ts +13 -14
- package/lib/index.js +29 -32
- package/lib/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.d.ts +1 -2
- package/lib/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js +15 -43
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +0 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.d.ts +1 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +0 -6
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +6 -19
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +2 -153
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +1 -5
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -10
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +0 -2
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -2
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +0 -3
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -3
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +0 -27
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +0 -2
- package/package.json +2 -2
- package/lib/view/accountMappingView/accountMappingTypeHelper.d.ts +0 -17
- package/lib/view/accountMappingView/accountMappingTypeHelper.js +0 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchAccountSettingsListForAccountTypesEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchAccountSettingsListForAccountTypesEpic.js +0 -41
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchRecommendationForAccountSettingsEpic.d.ts +0 -7
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchRecommendationForAccountSettingsEpic.js +0 -27
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/initializeAccountSettingsViewEpic.d.ts +0 -4
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/initializeAccountSettingsViewEpic.js +0 -13
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/saveAccountSettingsViewEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/saveAccountSettingsViewEpic.js +0 -50
- package/lib/view/expenseAutomationView/helpers/jeAccountSettingHelper.d.ts +0 -3
- package/lib/view/expenseAutomationView/helpers/jeAccountSettingHelper.js +0 -50
- package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +0 -19
- package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.js +0 -2
- package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.d.ts +0 -3
- package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +0 -41
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toSaveJeAccountSettingsMappingPayload = void 0;
|
|
4
|
-
const ACCOUNT_LABELS = {
|
|
5
|
-
PREPAID_EXPENSES: 'prepaid_expenses',
|
|
6
|
-
FIXED_ASSETS: 'fixed_assets',
|
|
7
|
-
ACCRUED_EXPENSES: 'accrued_expenses',
|
|
8
|
-
};
|
|
9
|
-
const toSaveJeAccountSettingsMappingPayload = (accountingLocalData) => {
|
|
10
|
-
const accounts = [];
|
|
11
|
-
const findAndUpdateAccount = (accountId, label) => {
|
|
12
|
-
const existingAccount = accounts.find((account) => account.account_id === accountId);
|
|
13
|
-
if (existingAccount) {
|
|
14
|
-
// Add label if not already present
|
|
15
|
-
if (label !== '' &&
|
|
16
|
-
existingAccount.labels &&
|
|
17
|
-
!existingAccount.labels.includes(label)) {
|
|
18
|
-
existingAccount.labels = [...existingAccount.labels, label];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
// Add a new account if it doesn't exist
|
|
23
|
-
if (accountId !== '') {
|
|
24
|
-
accounts.push({
|
|
25
|
-
account_id: accountId,
|
|
26
|
-
labels: label.length === 0 ? [] : [label],
|
|
27
|
-
tax_1099_config: null,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const processAccountType = (selectedAccountIds, previousAccounts, label) => {
|
|
33
|
-
if (selectedAccountIds.length > 0) {
|
|
34
|
-
selectedAccountIds.forEach((accountId) => {
|
|
35
|
-
findAndUpdateAccount(accountId, label);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
else if (previousAccounts.length > 0) {
|
|
39
|
-
// Using empty string to preserve account without adding any new labels
|
|
40
|
-
previousAccounts.forEach((account) => {
|
|
41
|
-
findAndUpdateAccount(account.accountId, '');
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
processAccountType(accountingLocalData.selectedPrepaidExpensesAccountIds, accountingLocalData.previousPrepaidExpensesAccount, ACCOUNT_LABELS.PREPAID_EXPENSES);
|
|
46
|
-
processAccountType(accountingLocalData.selectedFixedAssetsAccountIds, accountingLocalData.previousFixedAssetsAccount, ACCOUNT_LABELS.FIXED_ASSETS);
|
|
47
|
-
processAccountType(accountingLocalData.selectedAccruedExpensesAccountIds, accountingLocalData.previousAccruedExpensesAccount, ACCOUNT_LABELS.ACCRUED_EXPENSES);
|
|
48
|
-
return accounts;
|
|
49
|
-
};
|
|
50
|
-
exports.toSaveJeAccountSettingsMappingPayload = toSaveJeAccountSettingsMappingPayload;
|
package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
|
|
2
|
-
import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
3
|
-
import { Recommendation } from '../../../commonStateTypes/recommendationBase';
|
|
4
|
-
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
5
|
-
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
|
-
import { AccountSettingsLocalData } from '../types/jeSchedulesViewState';
|
|
7
|
-
export interface JEAccountSettingsView extends SelectorView {
|
|
8
|
-
prepaidExpensesAccountList: AccountBase[];
|
|
9
|
-
fixedAssetsAccountList: AccountBase[];
|
|
10
|
-
accruedExpensesAccountList: AccountBase[];
|
|
11
|
-
prepaidExpensesRecommendations: Recommendation[];
|
|
12
|
-
fixedAssetsRecommendations: Recommendation[];
|
|
13
|
-
accruedExpensesRecommendations: Recommendation[];
|
|
14
|
-
prepaidExpensesAccountHierarchy: NestedAccountHierarchyForReport[];
|
|
15
|
-
fixedAssetsAccountHierarchy: NestedAccountHierarchyForReport[];
|
|
16
|
-
accruedExpensesAccountHierarchy: NestedAccountHierarchyForReport[];
|
|
17
|
-
accountSettingsLocalData: AccountSettingsLocalData;
|
|
18
|
-
saveState: FetchStateAndError;
|
|
19
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getJEAccountSettingsView = void 0;
|
|
4
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
-
const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
|
|
6
|
-
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
7
|
-
exports.getJEAccountSettingsView = (0, toolkit_1.createSelector)((state) => state.expenseAutomationJESchedulesViewState.accountSettings, (state) => state.accountState, (jeAccountMappingState, accountState) => {
|
|
8
|
-
const prepaidExpensesAccountList = buildAccountList(jeAccountMappingState.prepaidExpensesAccountIdList, accountState);
|
|
9
|
-
const fixedAssetsAccountList = buildAccountList(jeAccountMappingState.fixedAssetsAccountIdList, accountState);
|
|
10
|
-
const accruedExpensesAccountList = buildAccountList(jeAccountMappingState.accruedExpensesAccountIdList, accountState);
|
|
11
|
-
const fetchState = (0, reduceFetchState_1.reduceAllFetchState)([
|
|
12
|
-
jeAccountMappingState.accountListFetchState,
|
|
13
|
-
jeAccountMappingState.recommendationFetchState,
|
|
14
|
-
]);
|
|
15
|
-
const saveState = jeAccountMappingState.updateFetchState;
|
|
16
|
-
return {
|
|
17
|
-
prepaidExpensesAccountList,
|
|
18
|
-
fixedAssetsAccountList,
|
|
19
|
-
accruedExpensesAccountList,
|
|
20
|
-
prepaidExpensesRecommendations: jeAccountMappingState.prepaidExpensesRecommendations,
|
|
21
|
-
fixedAssetsRecommendations: jeAccountMappingState.fixedAssetsRecommendations,
|
|
22
|
-
accruedExpensesRecommendations: jeAccountMappingState.accruedExpensesRecommendations,
|
|
23
|
-
accountSettingsLocalData: jeAccountMappingState.localData,
|
|
24
|
-
prepaidExpensesAccountHierarchy: jeAccountMappingState.prepaidExpensesNestedAccountListHierarchy,
|
|
25
|
-
fixedAssetsAccountHierarchy: jeAccountMappingState.fixedAssetsNestedAccountListHierarchy,
|
|
26
|
-
accruedExpensesAccountHierarchy: jeAccountMappingState.accruedExpensesNestedAccountListHierarchy,
|
|
27
|
-
fetchState: fetchState.fetchState,
|
|
28
|
-
saveState,
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
// Helper function to build account lists
|
|
32
|
-
const buildAccountList = (accountIdList, accountState) => {
|
|
33
|
-
const accountList = [];
|
|
34
|
-
accountIdList.forEach((accountId) => {
|
|
35
|
-
const account = (0, accountSelector_1.getAccountBase)(accountState, accountId, 'account_list_by_type');
|
|
36
|
-
if (account != null) {
|
|
37
|
-
accountList.push(account);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
return accountList;
|
|
41
|
-
};
|