@zeniai/client-epic-state 4.8.85 → 4.8.87

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 (78) hide show
  1. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  2. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  3. package/lib/entity/account/accountSelector.d.ts +6 -6
  4. package/lib/entity/account/accountState.d.ts +3 -3
  5. package/lib/entity/account/accountState.js +1 -0
  6. package/lib/entity/account/pickAndMergeForecastAccountReport.d.ts +2 -2
  7. package/lib/entity/accountGroup/accountGroupSelector.d.ts +44 -44
  8. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  9. package/lib/entity/class/classReducer.d.ts +4 -4
  10. package/lib/entity/class/classState.d.ts +1 -1
  11. package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
  12. package/lib/entity/forecast/forecastState.d.ts +1 -1
  13. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +6 -1
  14. package/lib/entity/jeSchedules/jeSchedulesPayload.js +11 -1
  15. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -1
  16. package/lib/entity/jeSchedules/jeSchedulesSelector.js +2 -1
  17. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +5 -1
  18. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +4 -4
  19. package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -1
  20. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  21. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  22. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  23. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +1 -0
  24. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
  25. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +1 -0
  26. package/lib/index.d.ts +4 -4
  27. package/lib/index.js +5 -4
  28. package/lib/view/accountList/accountListReducer.d.ts +2 -2
  29. package/lib/view/accountList/accountListReducer.js +2 -1
  30. package/lib/view/accountList/accountListState.d.ts +1 -1
  31. package/lib/view/accountMappingView/accountTypeRecommendation/accountTypeRecommendationPayload.d.ts +1 -1
  32. package/lib/view/auditReportView/auditReportViewState.d.ts +2 -2
  33. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  34. package/lib/view/cardBalance/cardBalanceSelector.d.ts +3 -3
  35. package/lib/view/cashBalance/cashBalanceSelector.d.ts +3 -3
  36. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  37. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  38. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  39. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  40. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  41. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  42. package/lib/view/scheduleView/scheduleDetailView/epics/createNewSchedulesEpic.js +9 -2
  43. package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsEpic.js +6 -6
  44. package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsPageEpic.d.ts +3 -2
  45. package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsPageEpic.js +13 -5
  46. package/lib/view/scheduleView/scheduleDetailView/epics/initializeScheduleDetailLocalDataEpic.js +11 -8
  47. package/lib/view/scheduleView/scheduleDetailView/epics/saveScheduleDetailsEpic.js +4 -4
  48. package/lib/view/scheduleView/scheduleDetailView/epics/updateAmountsInScheduleDetailEpic.js +8 -6
  49. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper.d.ts +7 -5
  50. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper.js +37 -6
  51. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailPayload.d.ts +8 -4
  52. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailPayload.js +53 -4
  53. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.d.ts +21 -11
  54. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.js +66 -35
  55. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailSelector.d.ts +12 -3
  56. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailSelector.js +31 -14
  57. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailState.d.ts +19 -5
  58. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailState.js +0 -3
  59. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +4 -3
  60. package/lib/view/scheduleView/scheduleListView/epics/fetchScheduleListEpic.d.ts +0 -10
  61. package/lib/view/scheduleView/scheduleListView/epics/fetchScheduleListEpic.js +7 -24
  62. package/lib/view/scheduleView/scheduleListView/epics/fetchSchedulesAccountEpic.js +2 -5
  63. package/lib/view/scheduleView/scheduleListView/scheduleListHelper.d.ts +7 -5
  64. package/lib/view/scheduleView/scheduleListView/scheduleListHelper.js +37 -28
  65. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +27 -18
  66. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +109 -76
  67. package/lib/view/scheduleView/scheduleListView/scheduleListSelector.d.ts +4 -8
  68. package/lib/view/scheduleView/scheduleListView/scheduleListSelector.js +42 -40
  69. package/lib/view/scheduleView/scheduleListView/scheduleListState.d.ts +16 -13
  70. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +5 -5
  71. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.js +3 -1
  72. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  73. package/lib/view/topEx/topExSelector.d.ts +2 -2
  74. package/lib/view/transactionList/transactionListReducer.d.ts +12 -12
  75. package/lib/view/vendorList/vendorListSelector.d.ts +2 -2
  76. package/lib/view/vendorList/vendorListSelector.js +1 -0
  77. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +1 -1
  78. package/package.json +1 -1
@@ -1,11 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
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.getAccountLabelForSchedulesTab = exports.getAccountListKeyForSchedules = exports.getCalculatedScheduleTotals = exports.scheduleTypesAccountLabels = 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");
7
7
  const zeniDayJS_1 = require("../../../zeniDayJS");
8
- const scheduleDetailLocalDataHelper_1 = require("../scheduleDetailView/scheduleDetailLocalDataHelper");
8
+ exports.scheduleTypesAccountLabels = {
9
+ prepaid_expenses: 'other_current_assets',
10
+ fixed_assets: 'fixed_assets',
11
+ accrued_expenses: 'other_expense',
12
+ deferred_revenue: 'other_income',
13
+ };
9
14
  /**
10
15
  * This helper function calculates Total Amount and Total Running balances
11
16
  * for all the JE transactions which can be used to display the totals on the Schedule List page.
@@ -32,17 +37,21 @@ const getCalculatedScheduleTotals = (jeTransactions) => {
32
37
  };
33
38
  };
34
39
  exports.getCalculatedScheduleTotals = getCalculatedScheduleTotals;
35
- const getAccountListKeyForSchedulesTab = (scheduleTab) => {
36
- switch (scheduleTab) {
40
+ const getAccountListKeyForSchedules = () => {
41
+ return 'schedulesAccountList';
42
+ };
43
+ exports.getAccountListKeyForSchedules = getAccountListKeyForSchedules;
44
+ const getAccountLabelForSchedulesTab = (tab) => {
45
+ switch (tab) {
37
46
  case 'prepaid_expenses':
38
- return 'prepaidExpenseAccountList';
39
- case 'accured_expenses':
40
- case 'deferred_revenue':
41
47
  case 'fixed_assets':
42
- return 'accountList';
48
+ return tab;
49
+ case 'accrued_expenses':
50
+ case 'deferred_revenue':
51
+ return 'uncategorized_expense';
43
52
  }
44
53
  };
45
- exports.getAccountListKeyForSchedulesTab = getAccountListKeyForSchedulesTab;
54
+ exports.getAccountLabelForSchedulesTab = getAccountLabelForSchedulesTab;
46
55
  const getAllAccountBase = () => ({
47
56
  accountDescription: 'All',
48
57
  accountId: 'all',
@@ -214,9 +223,14 @@ const getAccountsTypesForScheduleList = (scheduleType) => {
214
223
  switch (scheduleType) {
215
224
  case 'prepaid_expenses':
216
225
  return {
217
- accountListKey: 'prepaidExpenseAccountList',
226
+ accountListKey: 'schedulesAccountList',
218
227
  allowedAccountList: ['other_current_assets'],
219
228
  };
229
+ case 'fixed_assets':
230
+ return {
231
+ accountListKey: 'schedulesAccountList',
232
+ allowedAccountList: ['fixed_assets'],
233
+ };
220
234
  default:
221
235
  return {
222
236
  accountListKey: 'accountList',
@@ -228,7 +242,8 @@ exports.getAccountsTypesForScheduleList = getAccountsTypesForScheduleList;
228
242
  const getAccountLabelForScheduleType = (scheduleType) => {
229
243
  switch (scheduleType) {
230
244
  case 'prepaid_expenses':
231
- return 'prepaid_expenses';
245
+ case 'fixed_assets':
246
+ return scheduleType;
232
247
  default:
233
248
  return undefined;
234
249
  }
@@ -239,22 +254,16 @@ exports.getAccountLabelForScheduleType = getAccountLabelForScheduleType;
239
254
  * @param scheduleType
240
255
  * @returns
241
256
  */
242
- const getAccountsTypesForScheduleEpics = (scheduleType) => {
243
- const allowedAccountTypes = [
244
- ...(0, exports.getAccountsTypesForScheduleList)(scheduleType).allowedAccountList,
245
- ...(0, scheduleDetailLocalDataHelper_1.getAccountsTypesForScheduleDetails)(scheduleType),
246
- ];
247
- switch (scheduleType) {
248
- case 'prepaid_expenses':
249
- return {
250
- accountListKey: 'prepaidExpenseAccountList',
251
- allowedAccountList: [...new Set(allowedAccountTypes)],
252
- };
253
- default:
254
- return {
255
- accountListKey: 'accountList',
256
- allowedAccountList: [],
257
- };
258
- }
257
+ const getAccountsTypesForScheduleEpics = () => {
258
+ return {
259
+ accountListKey: 'schedulesAccountList',
260
+ allowedAccountList: [
261
+ 'other_current_assets',
262
+ 'fixed_assets',
263
+ 'cogs',
264
+ 'expenses',
265
+ 'other_expense',
266
+ ],
267
+ };
259
268
  };
260
269
  exports.getAccountsTypesForScheduleEpics = getAccountsTypesForScheduleEpics;
@@ -1,11 +1,16 @@
1
- import { ScheduleListLocalData, ScheduleListViewState, ScheduleWithListStatus, ScheduleListUIState } from './scheduleListState';
1
+ import { ScheduleListLocalData, ScheduleListViewState, ScheduleListForTypeState, JESchedulesForTypeState, ScheduleListUIState } from './scheduleListState';
2
+ import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
2
3
  import { FetchState, ID } from '../../../commonStateTypes/common';
3
4
  import { TimeframeTick } from '../../../commonStateTypes/timeframeTick';
4
5
  import { ZeniAPIStatus } from '../../../responsePayload';
6
+ import { ScheduleListSortKey } from './scheduleListTypes';
5
7
  import { JEScheduledTransactionPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
8
+ import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
9
+ export declare const initialUIState: ScheduleListUIState;
10
+ export declare const initialJESchedulesForTypeState: JESchedulesForTypeState;
11
+ export declare const initialScheduleListStateByType: ScheduleListForTypeState;
6
12
  export declare const initialState: ScheduleListViewState;
7
- export declare const scheduleListInitialState: ScheduleWithListStatus;
8
- export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tab: "prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue", timeframeAndCategory: {
13
+ export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tab: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory: {
9
14
  selectedTimeframe: TimeframeTick;
10
15
  selectedCategoryId: ID;
11
16
  }, downloadCategories: string[], cacheOverride?: any], {
@@ -13,10 +18,10 @@ export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCr
13
18
  selectedTimeframe: TimeframeTick;
14
19
  selectedCategoryId: ID;
15
20
  };
16
- tab: "prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue";
21
+ tab: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
17
22
  cacheOverride: any;
18
23
  downloadCategories: string[];
19
- }, string, never, never>, fetchScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tab: "prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue", timeframeAndCategory?: {
24
+ }, string, never, never>, fetchScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tab: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
20
25
  selectedTimeframe: TimeframeTick;
21
26
  selectedCategoryId: ID;
22
27
  } | undefined, cacheOverride?: any], {
@@ -24,32 +29,36 @@ export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCr
24
29
  selectedTimeframe: TimeframeTick;
25
30
  selectedCategoryId: ID;
26
31
  } | undefined;
27
- tab: "prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue";
32
+ tab: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
28
33
  cacheOverride: any;
29
- }, string, never, never>, fetchSchedulesAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tab: "prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue"], {
30
- tab: "prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue";
31
- }, string, never, never>, updateScheduleListSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tab: "prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue", selectedTimeframe: TimeframeTick, selectedCategoryId: string, scheduleList: JEScheduledTransactionPayload[]], {
32
- tab: "prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue";
34
+ }, string, never, never>, fetchSchedulesAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tab: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue"], {
35
+ tab: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
36
+ }, string, never, never>, updateScheduleListSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tab: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", selectedTimeframe: TimeframeTick, selectedCategoryId: string, scheduleList: JEScheduledTransactionPayload[]], {
37
+ tab: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
33
38
  selectedTimeframe: TimeframeTick;
34
39
  selectedCategoryId: string;
35
40
  scheduleList: JEScheduledTransactionPayload[];
36
- }, string, never, never>, updateScheduleListFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tab: "prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue", selectedTimeframe: TimeframeTick, selectedCategoryId: string, error: ZeniAPIStatus<Record<string, unknown>>], {
41
+ }, string, never, never>, updateScheduleListFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tab: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", selectedTimeframe: TimeframeTick, selectedCategoryId: string, error: ZeniAPIStatus<Record<string, unknown>>], {
37
42
  selectedCategoryId: string;
38
43
  selectedTimeframe: TimeframeTick;
39
- tab: "prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue";
44
+ tab: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
40
45
  error: ZeniAPIStatus<Record<string, unknown>>;
41
- }, string, never, never>, updateDownloadScheduleFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tab: "prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue", selectedTimeframe: TimeframeTick, selectedCategoryId: string, error: ZeniAPIStatus<Record<string, unknown>>], {
46
+ }, string, never, never>, updateDownloadScheduleFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tab: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", selectedTimeframe: TimeframeTick, selectedCategoryId: string, error: ZeniAPIStatus<Record<string, unknown>>], {
42
47
  selectedCategoryId: string;
43
48
  selectedTimeframe: TimeframeTick;
44
- tab: "prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue";
49
+ tab: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
45
50
  error: ZeniAPIStatus<Record<string, unknown>>;
46
- }, string, never, never>, updateDownloadScheduleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tab: "prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue", selectedTimeframe: TimeframeTick, selectedCategoryId: string, scheduleList: JEScheduledTransactionPayload[]], {
47
- tab: "prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue";
51
+ }, string, never, never>, updateDownloadScheduleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tab: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", selectedTimeframe: TimeframeTick, selectedCategoryId: string, scheduleList: JEScheduledTransactionPayload[]], {
52
+ tab: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
48
53
  selectedTimeframe: TimeframeTick;
49
54
  selectedCategoryId: string;
50
55
  scheduleList: JEScheduledTransactionPayload[];
51
- }, string, never, never>, updateScheduleListTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"prepaid_expenses" | "fixed_assets" | "accured_expenses" | "deferred_revenue", string>, updateScheduleListSubTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"all" | "new" | "completed" | "ongoing", string>, updateScheduleListUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
52
- uiState: Partial<ScheduleListUIState>;
56
+ }, string, never, never>, updateScheduleListTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", string>, updateScheduleListSubTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"all" | "new" | "completed" | "ongoing", string>, updateScheduleListScrollState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
57
+ scrollYOffset: number;
58
+ }, string>, updateScheduleListSortState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
59
+ sortKey: ScheduleListSortKey;
60
+ sortOrder: SortOrder;
53
61
  }, string>, updateScheduleListLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<ScheduleListLocalData, string>, updateScheduleListSearchText: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, updateScheduleListDownloadState: import("@reduxjs/toolkit").ActionCreatorWithPayload<FetchState, string>, clearScheduleList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
54
62
  declare const _default: import("@reduxjs/toolkit").Reducer<ScheduleListViewState, import("@reduxjs/toolkit").AnyAction>;
55
63
  export default _default;
64
+ export declare function getState(state: ScheduleListViewState, tab: ScheduleTypes): ScheduleListForTypeState;
@@ -1,19 +1,36 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearScheduleList = exports.updateScheduleListDownloadState = exports.updateScheduleListSearchText = exports.updateScheduleListLocalData = exports.updateScheduleListUIState = exports.updateScheduleListSubTab = exports.updateScheduleListTab = exports.updateDownloadScheduleSuccess = exports.updateDownloadScheduleFailure = exports.updateScheduleListFailure = exports.updateScheduleListSuccess = exports.fetchSchedulesAccount = exports.fetchScheduleList = exports.fetchDownloadSchedules = exports.scheduleListInitialState = exports.initialState = void 0;
4
+ exports.getState = exports.clearScheduleList = exports.updateScheduleListDownloadState = exports.updateScheduleListSearchText = exports.updateScheduleListLocalData = exports.updateScheduleListSortState = exports.updateScheduleListScrollState = exports.updateScheduleListSubTab = exports.updateScheduleListTab = exports.updateDownloadScheduleSuccess = exports.updateDownloadScheduleFailure = exports.updateScheduleListFailure = exports.updateScheduleListSuccess = exports.fetchSchedulesAccount = exports.fetchScheduleList = exports.fetchDownloadSchedules = exports.initialState = exports.initialScheduleListStateByType = exports.initialJESchedulesForTypeState = exports.initialUIState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const zeniDayJS_1 = require("../../../zeniDayJS");
7
7
  const transactionIDPayload_1 = require("../../../entity/transaction/payloadTypes/transactionIDPayload");
8
8
  const scheduleListTypes_1 = require("./scheduleListTypes");
9
9
  const transactionDetailState_1 = require("../../transactionDetail/transactionDetailState");
10
- exports.initialState = {
11
- byScheduleListKey: {},
12
- currentTab: 'prepaid_expenses',
10
+ exports.initialUIState = {
11
+ sortKey: 'transactionDate',
12
+ sortOrder: 'descending',
13
+ scrollYOffset: {
14
+ all: 0,
15
+ new: 0,
16
+ ongoing: 0,
17
+ completed: 0,
18
+ },
13
19
  currentSubTab: 'all',
14
20
  searchText: '',
21
+ };
22
+ exports.initialJESchedulesForTypeState = {
23
+ hasValidState() {
24
+ return this.fetchState === 'Completed';
25
+ },
26
+ fetchState: 'Not-Started',
27
+ error: undefined,
28
+ jeScheduleTransactionKeys: [],
29
+ };
30
+ exports.initialScheduleListStateByType = {
31
+ jeScheduleKeysByListKey: {},
15
32
  scheduleListLocalData: {
16
- selectedCategoryID: 'all',
33
+ selectedCategoryId: 'all',
17
34
  selectedTimeframe: {
18
35
  startDate: (0, zeniDayJS_1.dateNow)().subtract(1, 'year'),
19
36
  endDate: (0, zeniDayJS_1.dateNow)(),
@@ -28,19 +45,16 @@ exports.initialState = {
28
45
  fetchState: 'Not-Started',
29
46
  error: undefined,
30
47
  },
48
+ uiState: exports.initialUIState,
31
49
  };
32
- exports.scheduleListInitialState = {
33
- fetchState: 'Not-Started',
34
- error: undefined,
35
- jeScheduleTransactionKeys: [],
36
- uiState: {
37
- sortKey: 'transactionDate',
38
- sortOrder: 'descending',
39
- scrollYOffset: 0,
40
- },
41
- hasValidState() {
42
- return this.fetchState === 'Completed';
50
+ exports.initialState = {
51
+ listByScheduleType: {
52
+ prepaid_expenses: exports.initialScheduleListStateByType,
53
+ fixed_assets: exports.initialScheduleListStateByType,
54
+ deferred_revenue: exports.initialScheduleListStateByType,
55
+ accrued_expenses: exports.initialScheduleListStateByType,
43
56
  },
57
+ currentTab: 'prepaid_expenses',
44
58
  };
45
59
  const scheduleListView = (0, toolkit_1.createSlice)({
46
60
  name: 'scheduleListView',
@@ -48,25 +62,25 @@ const scheduleListView = (0, toolkit_1.createSlice)({
48
62
  reducers: {
49
63
  fetchDownloadSchedules: {
50
64
  reducer(draft, action) {
65
+ const state = getState(draft, action.payload.tab);
51
66
  const selectedTimeframe = action.payload.timeframeAndCategory.selectedTimeframe;
52
- const selectedCategoryID = action.payload.timeframeAndCategory.selectedCategoryId;
53
- draft.scheduleListLocalData = {
67
+ const selectedCategoryId = action.payload.timeframeAndCategory.selectedCategoryId;
68
+ state.scheduleListLocalData = {
54
69
  selectedTimeframe,
55
- selectedCategoryID: selectedCategoryID,
70
+ selectedCategoryId: selectedCategoryId,
71
+ };
72
+ const key = (0, scheduleListTypes_1.getScheduleListKey)(selectedCategoryId, selectedTimeframe);
73
+ const record = state.jeScheduleKeysByListKey[key];
74
+ state.selectedCategoryId = selectedCategoryId;
75
+ state.selectedTimeframe = selectedTimeframe;
76
+ state.downloadState = {
77
+ fetchState: 'In-Progress',
78
+ error: undefined,
56
79
  };
57
- const key = (0, scheduleListTypes_1.getScheduleListKey)(action.payload.tab, selectedCategoryID, selectedTimeframe);
58
- const record = draft.byScheduleListKey[key];
59
80
  if (record == null) {
60
- draft.byScheduleListKey[key] = Object.assign({}, exports.scheduleListInitialState);
61
- draft.downloadState = {
62
- fetchState: 'In-Progress',
63
- error: undefined,
64
- };
65
- }
66
- else {
67
- draft.selectedCategoryId = selectedCategoryID;
68
- draft.selectedTimeframe = selectedTimeframe;
81
+ state.jeScheduleKeysByListKey[key] = Object.assign({}, exports.initialJESchedulesForTypeState);
69
82
  }
83
+ updateState(draft, action.payload.tab, state);
70
84
  },
71
85
  prepare(tab, timeframeAndCategory, downloadCategories, cacheOverride = false) {
72
86
  return {
@@ -91,23 +105,25 @@ const scheduleListView = (0, toolkit_1.createSlice)({
91
105
  },
92
106
  fetchScheduleList: {
93
107
  reducer(draft, action) {
108
+ const state = getState(draft, action.payload.tab);
94
109
  const selectedTimeframe = action.payload.timeframeAndCategory != null
95
110
  ? action.payload.timeframeAndCategory.selectedTimeframe
96
- : draft.scheduleListLocalData.selectedTimeframe;
97
- const selectedCategoryID = action.payload.timeframeAndCategory != null
111
+ : state.selectedTimeframe;
112
+ const selectedCategoryId = action.payload.timeframeAndCategory != null
98
113
  ? action.payload.timeframeAndCategory.selectedCategoryId
99
- : draft.scheduleListLocalData.selectedCategoryID;
100
- const key = (0, scheduleListTypes_1.getScheduleListKey)(action.payload.tab, selectedCategoryID, selectedTimeframe);
101
- const record = draft.byScheduleListKey[key];
102
- draft.scheduleListLocalData = {
114
+ : state.selectedCategoryId;
115
+ const key = (0, scheduleListTypes_1.getScheduleListKey)(selectedCategoryId, selectedTimeframe);
116
+ const record = state.jeScheduleKeysByListKey[key];
117
+ state.scheduleListLocalData = {
103
118
  selectedTimeframe,
104
- selectedCategoryID,
119
+ selectedCategoryId,
105
120
  };
106
- draft.selectedCategoryId = selectedCategoryID;
107
- draft.selectedTimeframe = selectedTimeframe;
121
+ state.selectedCategoryId = selectedCategoryId;
122
+ state.selectedTimeframe = selectedTimeframe;
108
123
  if (record == null) {
109
- draft.byScheduleListKey[key] = Object.assign(Object.assign({}, exports.scheduleListInitialState), { fetchState: 'In-Progress' });
124
+ state.jeScheduleKeysByListKey[key] = Object.assign(Object.assign({}, exports.initialJESchedulesForTypeState), { fetchState: 'In-Progress' });
110
125
  }
126
+ updateState(draft, action.payload.tab, state);
111
127
  },
112
128
  prepare(tab, timeframeAndCategory, cacheOverride = false) {
113
129
  return {
@@ -131,10 +147,12 @@ const scheduleListView = (0, toolkit_1.createSlice)({
131
147
  },
132
148
  updateScheduleListFailure: {
133
149
  reducer(draft, action) {
134
- const key = (0, scheduleListTypes_1.getScheduleListKey)(action.payload.tab, action.payload.selectedCategoryId, action.payload.selectedTimeframe);
135
- draft.byScheduleListKey[key] = Object.assign(Object.assign({}, exports.scheduleListInitialState), { fetchState: 'Error', error: action.payload.error });
136
- draft.selectedCategoryId = action.payload.selectedCategoryId;
137
- draft.selectedTimeframe = action.payload.selectedTimeframe;
150
+ const state = getState(draft, action.payload.tab);
151
+ const key = (0, scheduleListTypes_1.getScheduleListKey)(action.payload.selectedCategoryId, action.payload.selectedTimeframe);
152
+ state.jeScheduleKeysByListKey[key] = Object.assign(Object.assign({}, exports.initialJESchedulesForTypeState), { fetchState: 'Error', error: action.payload.error });
153
+ state.selectedCategoryId = action.payload.selectedCategoryId;
154
+ state.selectedTimeframe = action.payload.selectedTimeframe;
155
+ updateState(draft, action.payload.tab, state);
138
156
  },
139
157
  prepare(tab, selectedTimeframe, selectedCategoryId, error) {
140
158
  return { payload: { selectedCategoryId, selectedTimeframe, tab, error } };
@@ -152,14 +170,16 @@ const scheduleListView = (0, toolkit_1.createSlice)({
152
170
  },
153
171
  updateDownloadScheduleFailure: {
154
172
  reducer(draft, action) {
155
- const key = (0, scheduleListTypes_1.getScheduleListKey)(action.payload.tab, action.payload.selectedCategoryId, action.payload.selectedTimeframe);
156
- draft.byScheduleListKey[key] = Object.assign(Object.assign({}, exports.scheduleListInitialState), { error: action.payload.error });
157
- draft.selectedCategoryId = action.payload.selectedCategoryId;
158
- draft.selectedTimeframe = action.payload.selectedTimeframe;
159
- draft.downloadState = {
173
+ const state = getState(draft, action.payload.tab);
174
+ const key = (0, scheduleListTypes_1.getScheduleListKey)(action.payload.selectedCategoryId, action.payload.selectedTimeframe);
175
+ state.jeScheduleKeysByListKey[key] = Object.assign(Object.assign({}, exports.initialJESchedulesForTypeState), { error: action.payload.error });
176
+ state.selectedCategoryId = action.payload.selectedCategoryId;
177
+ state.selectedTimeframe = action.payload.selectedTimeframe;
178
+ state.downloadState = {
160
179
  fetchState: 'Error',
161
180
  error: action.payload.error,
162
181
  };
182
+ updateState(draft, action.payload.tab, state);
163
183
  },
164
184
  prepare(tab, selectedTimeframe, selectedCategoryId, error) {
165
185
  return { payload: { selectedCategoryId, selectedTimeframe, tab, error } };
@@ -169,57 +189,70 @@ const scheduleListView = (0, toolkit_1.createSlice)({
169
189
  draft.currentTab = action.payload;
170
190
  },
171
191
  updateScheduleListSearchText(draft, action) {
172
- draft.searchText = action.payload;
192
+ const state = getState(draft, draft.currentTab);
193
+ state.uiState.searchText = action.payload;
194
+ updateState(draft, draft.currentTab, state);
173
195
  },
174
196
  updateScheduleListSubTab(draft, action) {
175
- draft.currentSubTab = action.payload;
197
+ const state = getState(draft, draft.currentTab);
198
+ state.uiState.currentSubTab = action.payload;
199
+ updateState(draft, draft.currentTab, state);
176
200
  },
177
- updateScheduleListUIState(draft, action) {
201
+ updateScheduleListSortState(draft, action) {
178
202
  const tab = draft.currentTab;
179
- const key = (0, scheduleListTypes_1.getScheduleListKey)(tab, draft.selectedCategoryId, draft.selectedTimeframe);
180
- if (draft.byScheduleListKey[key] != null) {
181
- if (action.payload.uiState.sortKey != null) {
182
- draft.byScheduleListKey[key].uiState.sortKey =
183
- action.payload.uiState.sortKey;
184
- }
185
- if (action.payload.uiState.sortOrder != null) {
186
- draft.byScheduleListKey[key].uiState.sortOrder =
187
- action.payload.uiState.sortOrder;
188
- }
189
- if (action.payload.uiState.scrollYOffset != null) {
190
- draft.byScheduleListKey[key].uiState.scrollYOffset =
191
- action.payload.uiState.scrollYOffset;
192
- }
193
- }
203
+ const state = getState(draft, tab);
204
+ state.uiState.sortKey = action.payload.sortKey;
205
+ state.uiState.sortOrder = action.payload.sortOrder;
206
+ updateState(draft, tab, state);
207
+ },
208
+ updateScheduleListScrollState(draft, action) {
209
+ const tab = draft.currentTab;
210
+ const state = getState(draft, tab);
211
+ state.uiState.scrollYOffset[state.uiState.currentSubTab] =
212
+ action.payload.scrollYOffset;
213
+ updateState(draft, tab, state);
194
214
  },
195
215
  updateScheduleListLocalData(draft, action) {
196
- draft.scheduleListLocalData = action.payload;
216
+ const state = getState(draft, draft.currentTab);
217
+ state.scheduleListLocalData = action.payload;
218
+ updateState(draft, draft.currentTab, state);
197
219
  },
198
220
  updateScheduleListDownloadState(draft, action) {
199
- draft.downloadState = { fetchState: action.payload, error: undefined };
221
+ const state = getState(draft, draft.currentTab);
222
+ state.downloadState = { fetchState: action.payload, error: undefined };
223
+ updateState(draft, draft.currentTab, state);
200
224
  },
201
225
  clearScheduleList(draft) {
202
226
  Object.assign(draft, exports.initialState);
203
227
  },
204
228
  },
205
229
  });
206
- _a = scheduleListView.actions, exports.fetchDownloadSchedules = _a.fetchDownloadSchedules, exports.fetchScheduleList = _a.fetchScheduleList, exports.fetchSchedulesAccount = _a.fetchSchedulesAccount, exports.updateScheduleListSuccess = _a.updateScheduleListSuccess, exports.updateScheduleListFailure = _a.updateScheduleListFailure, exports.updateDownloadScheduleFailure = _a.updateDownloadScheduleFailure, exports.updateDownloadScheduleSuccess = _a.updateDownloadScheduleSuccess, exports.updateScheduleListTab = _a.updateScheduleListTab, exports.updateScheduleListSubTab = _a.updateScheduleListSubTab, exports.updateScheduleListUIState = _a.updateScheduleListUIState, exports.updateScheduleListLocalData = _a.updateScheduleListLocalData, exports.updateScheduleListSearchText = _a.updateScheduleListSearchText, exports.updateScheduleListDownloadState = _a.updateScheduleListDownloadState, exports.clearScheduleList = _a.clearScheduleList;
230
+ _a = scheduleListView.actions, exports.fetchDownloadSchedules = _a.fetchDownloadSchedules, exports.fetchScheduleList = _a.fetchScheduleList, exports.fetchSchedulesAccount = _a.fetchSchedulesAccount, exports.updateScheduleListSuccess = _a.updateScheduleListSuccess, exports.updateScheduleListFailure = _a.updateScheduleListFailure, exports.updateDownloadScheduleFailure = _a.updateDownloadScheduleFailure, exports.updateDownloadScheduleSuccess = _a.updateDownloadScheduleSuccess, exports.updateScheduleListTab = _a.updateScheduleListTab, exports.updateScheduleListSubTab = _a.updateScheduleListSubTab, exports.updateScheduleListScrollState = _a.updateScheduleListScrollState, exports.updateScheduleListSortState = _a.updateScheduleListSortState, exports.updateScheduleListLocalData = _a.updateScheduleListLocalData, exports.updateScheduleListSearchText = _a.updateScheduleListSearchText, exports.updateScheduleListDownloadState = _a.updateScheduleListDownloadState, exports.clearScheduleList = _a.clearScheduleList;
207
231
  exports.default = scheduleListView.reducer;
208
232
  /**
209
233
  * Helper functions
210
234
  */
211
235
  function doUpdateScheduleList(draft, payload, tab, selectedTimeframe, selectedCategoryId) {
236
+ const state = getState(draft, tab);
212
237
  const jeScheduleTransactionKeys = payload.map((schedules) => {
213
238
  const transactionID = (0, transactionIDPayload_1.toTransactionID)(schedules.base_transaction);
214
239
  return (0, transactionDetailState_1.getZeniTransactionDetailKey)(transactionID);
215
240
  });
216
- draft.selectedCategoryId = selectedCategoryId;
217
- draft.selectedTimeframe = selectedTimeframe;
218
- const key = (0, scheduleListTypes_1.getScheduleListKey)(tab, selectedCategoryId, selectedTimeframe);
219
- const record = draft.byScheduleListKey[key];
220
- draft.byScheduleListKey[key] = Object.assign(Object.assign({}, record), { fetchState: 'Completed', error: undefined, jeScheduleTransactionKeys });
221
- draft.downloadState = {
241
+ state.selectedCategoryId = selectedCategoryId;
242
+ state.selectedTimeframe = selectedTimeframe;
243
+ const key = (0, scheduleListTypes_1.getScheduleListKey)(selectedCategoryId, selectedTimeframe);
244
+ const record = state.jeScheduleKeysByListKey[key];
245
+ state.jeScheduleKeysByListKey[key] = Object.assign(Object.assign({}, record), { fetchState: 'Completed', error: undefined, jeScheduleTransactionKeys });
246
+ state.downloadState = {
222
247
  fetchState: 'Completed',
223
248
  error: undefined,
224
249
  };
225
250
  }
251
+ function updateState(state, tab, updates) {
252
+ const listState = state.listByScheduleType[tab];
253
+ state.listByScheduleType[tab] = Object.assign(Object.assign({}, listState), updates);
254
+ }
255
+ function getState(state, tab) {
256
+ return state.listByScheduleType[tab];
257
+ }
258
+ exports.getState = getState;
@@ -7,8 +7,7 @@ import { NestedAccountHeirarchyForReport } from '../../../commonStateTypes/accou
7
7
  import { TimeframeTick, TimeframeTickWithMetaData } from '../../../commonStateTypes/timeframeTick';
8
8
  import { AccountBase } from '../../../entity/account/accountState';
9
9
  import { JEScheduledTransaction } from '../../../entity/jeSchedules/jeSchedulesSelector';
10
- import { SchedulesTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
11
- import { ScheduleSubTabType } from './scheduleListTypes';
10
+ import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
12
11
  import { Amount } from '../../../commonStateTypes/amount';
13
12
  import { COABalanceGroupedByPeriod } from '../../../commonStateTypes/coaBalance/coaBalance';
14
13
  export interface JEScheduledTransactionWithBalance extends JEScheduledTransaction {
@@ -16,17 +15,14 @@ export interface JEScheduledTransactionWithBalance extends JEScheduledTransactio
16
15
  durationOfMonths: number;
17
16
  }
18
17
  export interface ScheduleListReport extends SelectorView {
19
- allSubTabs: ScheduleSubTabType[];
20
- currentTab: SchedulesTypes;
21
- currentSubTab: ScheduleSubTabType;
18
+ currentTab: ScheduleTypes;
22
19
  downloadUIState: FetchStateAndError;
23
20
  jeScheduleOrder: EntityOrder;
24
21
  jeScheduledTransactions: JEScheduledTransactionWithBalance[];
25
- searchText: string;
26
22
  scheduleListAccounts: AccountBase[];
27
23
  scheduleListNestedAccountHierarchy: NestedAccountHeirarchyForReport[];
28
24
  uiState: ScheduleListUIState;
29
- selectedCategoryID: ID;
25
+ selectedCategoryId: ID;
30
26
  selectedTimeframe: TimeframeTick;
31
27
  scheduleListLocalData: ScheduleListLocalData;
32
28
  allTimeframeTicks: TimeframeTickWithMetaData[];
@@ -36,4 +32,4 @@ export interface ScheduleListReport extends SelectorView {
36
32
  selectedScheduledId?: ID;
37
33
  }
38
34
  export declare const getScheduleListReport: (state: RootState) => ScheduleListReport;
39
- export declare const getFetchStateForScheduleAccountList: (state: RootState, scheduleTab: SchedulesTypes) => FetchState;
35
+ export declare const getFetchStateForScheduleAccountList: (state: RootState) => FetchState;