@zeniai/client-epic-state 4.8.53 → 4.8.54
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/view/accountList/accountListSelector.d.ts +2 -1
- package/lib/view/accountList/accountListSelector.js +8 -1
- package/lib/view/scheduleView/scheduleDetailView/epics/updateAmountsInScheduleDetailEpic.js +10 -5
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.d.ts +2 -2
- package/lib/view/scheduleView/scheduleListView/epics/fetchScheduleListEpic.js +7 -4
- package/lib/view/scheduleView/scheduleListView/scheduleListHelper.d.ts +2 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListHelper.js +10 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListSelector.js +7 -5
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NestedAccountHeirarchyForReport } from '../../commonStateTypes/accountView/nestedAccountID';
|
|
2
|
-
import { FetchState } from '../../commonStateTypes/common';
|
|
2
|
+
import { FetchState, ID } from '../../commonStateTypes/common';
|
|
3
3
|
import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
4
|
import { AccountBase, AccountLabel, AccountState } from '../../entity/account/accountState';
|
|
5
5
|
import { AccountListState, AccountListKeyType } from './accountListState';
|
|
@@ -27,3 +27,4 @@ export declare const getFilteredNestedAndAccountListsForLabel: (accountState: Ac
|
|
|
27
27
|
accountList: AccountBase[];
|
|
28
28
|
nestedAccountList: NestedAccountHeirarchyForReport[];
|
|
29
29
|
};
|
|
30
|
+
export declare const getAccountIdsForLabel: (accountListState: AccountListState, accountListKey: AccountListKeyType, accountLabel: AccountLabel) => ID[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFilteredNestedAndAccountListsForLabel = exports.getNestedAccountListHeirarchy = exports.getUncategorizedAccounts = exports.getAccountListFetchState = exports.getAccountList = void 0;
|
|
3
|
+
exports.getAccountIdsForLabel = exports.getFilteredNestedAndAccountListsForLabel = exports.getNestedAccountListHeirarchy = exports.getUncategorizedAccounts = exports.getAccountListFetchState = exports.getAccountList = void 0;
|
|
4
4
|
const accountSelector_1 = require("../../entity/account/accountSelector");
|
|
5
5
|
const getAccountList = (accountState, accountListState, accountListKey) => {
|
|
6
6
|
const accListState = accountListState.byReportId[accountListKey];
|
|
@@ -74,3 +74,10 @@ const getFilteredNestedAndAccountListsForLabel = (accountState, accountListState
|
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
76
|
exports.getFilteredNestedAndAccountListsForLabel = getFilteredNestedAndAccountListsForLabel;
|
|
77
|
+
const getAccountIdsForLabel = (accountListState, accountListKey, accountLabel) => {
|
|
78
|
+
if (accountListState.byReportId[accountListKey].fetchState === 'Completed') {
|
|
79
|
+
return accountListState.byReportId[accountListKey].accountIdsByLabel[accountLabel];
|
|
80
|
+
}
|
|
81
|
+
return [];
|
|
82
|
+
};
|
|
83
|
+
exports.getAccountIdsForLabel = getAccountIdsForLabel;
|
|
@@ -7,7 +7,7 @@ const scheduleDetailReducer_1 = require("../scheduleDetailReducer");
|
|
|
7
7
|
const jeSchedulesSelector_1 = require("../../../../entity/jeSchedules/jeSchedulesSelector");
|
|
8
8
|
const scheduleDetailLocalDataHelper_1 = require("../scheduleDetailLocalDataHelper");
|
|
9
9
|
const updateAmountsInScheduleDetailEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(scheduleDetailReducer_1.updateAmountsInScheduleDetail.match), (0, operators_1.mergeMap)((action) => {
|
|
10
|
-
var _a;
|
|
10
|
+
var _a, _b;
|
|
11
11
|
const actions = [];
|
|
12
12
|
const state = state$.value;
|
|
13
13
|
const { scheduleDetailState } = state;
|
|
@@ -16,12 +16,17 @@ const updateAmountsInScheduleDetailEpic = (actions$, state$) => actions$.pipe((0
|
|
|
16
16
|
const jeScheduleTransactionState = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleKey)(selectedJEScheduleKey, state);
|
|
17
17
|
const jeScheduleDetailId = action.payload.jeScheduleDetailId;
|
|
18
18
|
const totalAmount = jeScheduleTransactionState.baseTransaction.amount.amount;
|
|
19
|
-
const jeScheduleLocalDataUpdated =
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const jeScheduleLocalDataUpdated = jeScheduleDetailId != null
|
|
20
|
+
? (0, scheduleDetailLocalDataHelper_1.updateAmountsInScheduleDetails)(scheduleDetailState.editScheduleStateById[jeScheduleDetailId]
|
|
21
|
+
.jeScheduleDetails, (_a = scheduleDetailState.editScheduleStateById[jeScheduleDetailId]
|
|
22
|
+
.selectedMonths) !== null && _a !== void 0 ? _a : 0, action.payload.rowId, totalAmount)
|
|
23
|
+
: (0, scheduleDetailLocalDataHelper_1.updateAmountsInScheduleDetails)(scheduleDetailState.newScheduleState.jeScheduleDetails, (_b = scheduleDetailState.newScheduleState.selectedMonths) !== null && _b !== void 0 ? _b : 0, action.payload.rowId, totalAmount);
|
|
24
|
+
const originalLocalData = jeScheduleDetailId != null
|
|
25
|
+
? scheduleDetailState.editScheduleStateById[jeScheduleDetailId]
|
|
26
|
+
: scheduleDetailState.newScheduleState;
|
|
22
27
|
actions.push((0, scheduleDetailReducer_1.updateScheduleDetailsLocalData)({
|
|
23
28
|
selectedJeScheduleDetailId: jeScheduleDetailId,
|
|
24
|
-
localData: Object.assign(Object.assign({},
|
|
29
|
+
localData: Object.assign(Object.assign({}, originalLocalData), { jeScheduleDetails: jeScheduleLocalDataUpdated }),
|
|
25
30
|
}));
|
|
26
31
|
}
|
|
27
32
|
return (0, rxjs_1.from)(actions);
|
|
@@ -29,9 +29,9 @@ export declare const createNewSchedules: import("@reduxjs/toolkit").ActionCreato
|
|
|
29
29
|
jeScheduleDetailId: ID;
|
|
30
30
|
rowId: number;
|
|
31
31
|
jeLink: ZeniUrl;
|
|
32
|
-
}, string>, updateAmountsInScheduleDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[rowId: number, jeScheduleDetailId
|
|
32
|
+
}, string>, updateAmountsInScheduleDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[rowId: number, jeScheduleDetailId?: string | undefined], {
|
|
33
33
|
rowId: number;
|
|
34
|
-
jeScheduleDetailId: string;
|
|
34
|
+
jeScheduleDetailId: string | undefined;
|
|
35
35
|
}, string, never, never>, updateScheduleDetailNewStateLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedJeScheduleDetailId: string], {
|
|
36
36
|
selectedJeScheduleDetailId: string;
|
|
37
37
|
}, string, never, never>, updateSelectedJEScheduleKey: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -10,10 +10,10 @@ const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
|
10
10
|
const timeframeTick_1 = require("../../../../commonStateTypes/timeframeTick");
|
|
11
11
|
const scheduleListHelper_1 = require("../scheduleListHelper");
|
|
12
12
|
const scheduleListTypes_1 = require("../scheduleListTypes");
|
|
13
|
-
const
|
|
13
|
+
const accountListSelector_1 = require("../../../accountList/accountListSelector");
|
|
14
14
|
const fetchScheduleListEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(scheduleListReducer_1.fetchScheduleList.match), (0, operators_1.mergeMap)((action) => {
|
|
15
15
|
const { tab } = action.payload;
|
|
16
|
-
const { scheduleListState,
|
|
16
|
+
const { scheduleListState, accountListState } = state$.value;
|
|
17
17
|
// if parameters are provided, use those. else go to localdata
|
|
18
18
|
const timeframe = action.payload.timeframeAndCategory != null
|
|
19
19
|
? action.payload.timeframeAndCategory.selectedTimeframe
|
|
@@ -29,8 +29,11 @@ const fetchScheduleListEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, o
|
|
|
29
29
|
action.payload.cacheOverride === false) {
|
|
30
30
|
return (0, rxjs_1.from)([]);
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
const
|
|
32
|
+
const accountTypes = (0, scheduleListHelper_1.getAccountsTypesForScheduleList)(scheduleListState.currentTab);
|
|
33
|
+
const accountLabel = (0, scheduleListHelper_1.getAccountLabelForScheduleType)(scheduleListState.currentTab);
|
|
34
|
+
const scheduleListCurrentTabAccountIds = accountLabel != null
|
|
35
|
+
? (0, accountListSelector_1.getAccountIdsForLabel)(accountListState, accountTypes.accountListKey, accountLabel)
|
|
36
|
+
: [];
|
|
34
37
|
let categoryIds = [categoryId];
|
|
35
38
|
if (categoryId === 'all') {
|
|
36
39
|
categoryIds = (0, exports.getAllAccountIdsForTab)(scheduleListState.currentTab, accountListState, scheduleListCurrentTabAccountIds);
|
|
@@ -2,7 +2,7 @@ import { NestedAccountHeirarchyForReport } from '../../../commonStateTypes/accou
|
|
|
2
2
|
import { Amount } from '../../../commonStateTypes/amount';
|
|
3
3
|
import { COABalance, COABalanceGroupedByPeriod } from '../../../commonStateTypes/coaBalance/coaBalance';
|
|
4
4
|
import { TimeframeTickWithMetaData } from '../../../commonStateTypes/timeframeTick';
|
|
5
|
-
import { AccountBase, AccountType } from '../../../entity/account/accountState';
|
|
5
|
+
import { AccountBase, AccountLabel, AccountType } from '../../../entity/account/accountState';
|
|
6
6
|
import { JEScheduledTransaction, ScheduledJournalEntry } from '../../../entity/jeSchedules/jeSchedulesSelector';
|
|
7
7
|
import { SchedulesTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
8
8
|
import { AccountListKeyType } from '../../accountList/accountListState';
|
|
@@ -85,6 +85,7 @@ declare type AccountListTypesPayload = {
|
|
|
85
85
|
* @returns
|
|
86
86
|
*/
|
|
87
87
|
export declare const getAccountsTypesForScheduleList: (scheduleType: SchedulesTypes) => AccountListTypesPayload;
|
|
88
|
+
export declare const getAccountLabelForScheduleType: (scheduleType: SchedulesTypes) => AccountLabel | undefined;
|
|
88
89
|
/**
|
|
89
90
|
* Function to get accountListKey and allowedAccountList for a given tab
|
|
90
91
|
* @param scheduleType
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAccountsTypesForScheduleEpics = exports.getAccountsTypesForScheduleList = exports.getDurationOfMonthOutTotalMonth = exports.calculateCOABalanceGroupedByPeriod = exports.mapScheduleJournalToCOABalance = exports.calculateTotalBalanceTimeframeTick = exports.setDefaultTotalBalanceTimeframeTicks = exports.mapTotalBalanceTimeframeTickToCOAGroupedBalance = exports.getAllTimeframeTicks = exports.getAllAccountNested = exports.getAllAccountBase = exports.getAccountListKeyForSchedulesTab = exports.getCalculatedScheduleTotals = void 0;
|
|
3
|
+
exports.getAccountsTypesForScheduleEpics = exports.getAccountLabelForScheduleType = exports.getAccountsTypesForScheduleList = exports.getDurationOfMonthOutTotalMonth = exports.calculateCOABalanceGroupedByPeriod = exports.mapScheduleJournalToCOABalance = exports.calculateTotalBalanceTimeframeTick = exports.setDefaultTotalBalanceTimeframeTicks = exports.mapTotalBalanceTimeframeTickToCOAGroupedBalance = exports.getAllTimeframeTicks = exports.getAllAccountNested = exports.getAllAccountBase = exports.getAccountListKeyForSchedulesTab = exports.getCalculatedScheduleTotals = void 0;
|
|
4
4
|
const amount_1 = require("../../../commonStateTypes/amount");
|
|
5
5
|
const formatZeniDateFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
|
|
6
6
|
const getFYMonths_1 = require("../../../commonStateTypes/fiscalYearHelpers/getFYMonths");
|
|
@@ -225,6 +225,15 @@ const getAccountsTypesForScheduleList = (scheduleType) => {
|
|
|
225
225
|
}
|
|
226
226
|
};
|
|
227
227
|
exports.getAccountsTypesForScheduleList = getAccountsTypesForScheduleList;
|
|
228
|
+
const getAccountLabelForScheduleType = (scheduleType) => {
|
|
229
|
+
switch (scheduleType) {
|
|
230
|
+
case 'prepaid_expenses':
|
|
231
|
+
return 'prepaid_expenses';
|
|
232
|
+
default:
|
|
233
|
+
return undefined;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
exports.getAccountLabelForScheduleType = getAccountLabelForScheduleType;
|
|
228
237
|
/**
|
|
229
238
|
* Function to get accountListKey and allowedAccountList for a given tab
|
|
230
239
|
* @param scheduleType
|
|
@@ -12,7 +12,6 @@ const scheduleListReducer_1 = require("./scheduleListReducer");
|
|
|
12
12
|
const scheduleListTypes_1 = require("./scheduleListTypes");
|
|
13
13
|
const amount_1 = require("../../../commonStateTypes/amount");
|
|
14
14
|
const scheduleListHelper_1 = require("./scheduleListHelper");
|
|
15
|
-
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
16
15
|
const sortedJETransactionsView = (jeTransactions, sortKey, sortOrder) => {
|
|
17
16
|
return (0, orderBy_1.default)(jeTransactions, (jeTransaction) => {
|
|
18
17
|
var _a;
|
|
@@ -70,10 +69,13 @@ const getScheduleListReport = (state) => {
|
|
|
70
69
|
const allScheduleAccounts = (0, accountListSelector_1.getAccountList)(accountState, accountListState, (0, scheduleListHelper_1.getAccountListKeyForSchedulesTab)(scheduleListState.currentTab));
|
|
71
70
|
let allNestedAccounts = (0, accountListSelector_1.getNestedAccountListHeirarchy)(accountListState, (0, scheduleListHelper_1.getAccountListKeyForSchedulesTab)(scheduleListState.currentTab));
|
|
72
71
|
let allAccounts = allScheduleAccounts.accounts;
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
const accountTypes = (0, scheduleListHelper_1.getAccountsTypesForScheduleList)(scheduleListState.currentTab);
|
|
73
|
+
const accountLabel = (0, scheduleListHelper_1.getAccountLabelForScheduleType)(scheduleListState.currentTab);
|
|
74
|
+
const scheduleListCurrentTabAccountIds = accountLabel != null
|
|
75
|
+
? (0, accountListSelector_1.getAccountIdsForLabel)(accountListState, accountTypes.accountListKey, accountLabel)
|
|
76
|
+
: [];
|
|
77
|
+
if (accountLabel != null) {
|
|
78
|
+
const filteredList = (0, accountListSelector_1.getFilteredNestedAndAccountListsForLabel)(accountState, accountListState, (0, scheduleListHelper_1.getAccountListKeyForSchedulesTab)(scheduleListState.currentTab), accountLabel);
|
|
77
79
|
// Use this list only if there is some account in it.
|
|
78
80
|
if (filteredList.accountList.length > 0) {
|
|
79
81
|
allAccounts = filteredList.accountList.filter((account) => scheduleListCurrentTabAccountIds.includes(account.accountId));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.54",
|
|
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
|
"types": "lib/index.d.ts",
|