@zeniai/client-epic-state 4.12.23 → 4.12.24

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 (115) hide show
  1. package/lib/commonStateTypes/selectorTypes/selectorTypes.d.ts +3 -1
  2. package/lib/entity/account/accountSelector.d.ts +1 -0
  3. package/lib/entity/account/accountSelector.js +13 -1
  4. package/lib/entity/class/classPayload.d.ts +1 -0
  5. package/lib/entity/class/classPayload.js +13 -29
  6. package/lib/entity/class/classState.d.ts +1 -0
  7. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +2 -0
  8. package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
  9. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +22 -5
  10. package/lib/entity/jeSchedules/jeSchedulesPayload.js +104 -29
  11. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +14 -4
  12. package/lib/entity/jeSchedules/jeSchedulesReducer.js +86 -6
  13. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +15 -3
  14. package/lib/entity/jeSchedules/jeSchedulesSelector.js +68 -5
  15. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +14 -2
  16. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +4 -2
  17. package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -0
  18. package/lib/entity/jeSchedules/updateAccruedJESchedulesEpic.d.ts +9 -0
  19. package/lib/entity/jeSchedules/updateAccruedJESchedulesEpic.js +41 -0
  20. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  21. package/lib/entity/snackbar/snackbarTypes.js +2 -0
  22. package/lib/entity/tenant/clearAllEpic.d.ts +4 -3
  23. package/lib/entity/tenant/clearAllEpic.js +3 -0
  24. package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +1 -1
  25. package/lib/entity/transaction/payloadTypes/otherTransactionPayload.d.ts +0 -2
  26. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +1 -1
  27. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +3 -0
  28. package/lib/entity/transaction/payloadTypes/transactionPayload.js +7 -3
  29. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.d.ts +1 -1
  30. package/lib/entity/transaction/stateTypes/transaction.d.ts +3 -0
  31. package/lib/epic.d.ts +12 -1
  32. package/lib/epic.js +12 -1
  33. package/lib/index.d.ts +11 -5
  34. package/lib/index.js +27 -5
  35. package/lib/reducer.d.ts +3 -0
  36. package/lib/reducer.js +3 -0
  37. package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.d.ts +1 -1
  38. package/lib/view/cardPayment/epic/confirmCardSetupIntentEpic.d.ts +1 -1
  39. package/lib/view/cardPayment/epic/createCardSetupIntentEpic.d.ts +1 -1
  40. package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.d.ts +1 -1
  41. package/lib/view/commonVendorView/vendorView/epics/fetchVendorEpic.js +0 -1
  42. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  43. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  44. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  45. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  46. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  47. package/lib/view/scheduleView/scheduleAccruedDetailView/LinkBillExpenseView/linkBillExpense.d.ts +3 -0
  48. package/lib/view/scheduleView/scheduleAccruedDetailView/LinkBillExpenseView/linkBillExpense.js +12 -0
  49. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/cancelScheduleAccruedJournalEntryEpic.d.ts +8 -0
  50. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/cancelScheduleAccruedJournalEntryEpic.js +81 -0
  51. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/createNewSchedulesAccruedEpic.d.ts +6 -0
  52. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/createNewSchedulesAccruedEpic.js +35 -0
  53. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/deleteScheduleAccruedDetailEpic.d.ts +8 -0
  54. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/deleteScheduleAccruedDetailEpic.js +79 -0
  55. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/fetchRecommendedTransactionRowIndexEpic.d.ts +7 -0
  56. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/fetchRecommendedTransactionRowIndexEpic.js +73 -0
  57. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/fetchScheduleAccruedDetailsEpic.d.ts +8 -0
  58. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/fetchScheduleAccruedDetailsEpic.js +53 -0
  59. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/fetchScheduleAccruedDetailsPageEpic.d.ts +8 -0
  60. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/fetchScheduleAccruedDetailsPageEpic.js +28 -0
  61. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/initializeScheduleAccruedDetailLocalDataEpic.d.ts +6 -0
  62. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/initializeScheduleAccruedDetailLocalDataEpic.js +37 -0
  63. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/saveScheduleAccruedDetailsEpic.d.ts +12 -0
  64. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/saveScheduleAccruedDetailsEpic.js +126 -0
  65. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/updateAmountsInScheduleAccruedDetailEpic.d.ts +6 -0
  66. package/lib/view/scheduleView/scheduleAccruedDetailView/epics/updateAmountsInScheduleAccruedDetailEpic.js +30 -0
  67. package/lib/view/scheduleView/scheduleAccruedDetailView/scheduleAccruedDetailLocalDataHelper.d.ts +16 -0
  68. package/lib/view/scheduleView/scheduleAccruedDetailView/scheduleAccruedDetailLocalDataHelper.js +121 -0
  69. package/lib/view/scheduleView/scheduleAccruedDetailView/scheduleAccruedDetailPayload.d.ts +60 -0
  70. package/lib/view/scheduleView/scheduleAccruedDetailView/scheduleAccruedDetailPayload.js +288 -0
  71. package/lib/view/scheduleView/scheduleAccruedDetailView/scheduleAccruedDetailReducer.d.ts +83 -0
  72. package/lib/view/scheduleView/scheduleAccruedDetailView/scheduleAccruedDetailReducer.js +363 -0
  73. package/lib/view/scheduleView/scheduleAccruedDetailView/scheduleAccruedDetailSelector.d.ts +36 -0
  74. package/lib/view/scheduleView/scheduleAccruedDetailView/scheduleAccruedDetailSelector.js +127 -0
  75. package/lib/view/scheduleView/scheduleAccruedDetailView/scheduleAccruedDetailState.d.ts +45 -0
  76. package/lib/view/scheduleView/scheduleAccruedDetailView/scheduleAccruedDetailState.js +2 -0
  77. package/lib/view/scheduleView/scheduleDetailView/epics/createNewSchedulesEpic.js +1 -1
  78. package/lib/view/scheduleView/scheduleDetailView/epics/deleteScheduleDetailEpic.js +1 -1
  79. package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsPageEpic.js +3 -1
  80. package/lib/view/scheduleView/scheduleDetailView/epics/initializeScheduleDetailLocalDataEpic.js +1 -1
  81. package/lib/view/scheduleView/scheduleDetailView/epics/markAsCompleteScheduleDetailEpic.js +1 -1
  82. package/lib/view/scheduleView/scheduleDetailView/epics/saveScheduleDetailsEpic.d.ts +2 -2
  83. package/lib/view/scheduleView/scheduleDetailView/epics/saveScheduleDetailsEpic.js +1 -1
  84. package/lib/view/scheduleView/scheduleDetailView/epics/updateAmountsInScheduleDetailEpic.js +1 -1
  85. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper.js +2 -0
  86. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailPayload.d.ts +11 -5
  87. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailPayload.js +66 -2
  88. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.d.ts +2 -5
  89. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.js +2 -17
  90. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailSelector.js +7 -3
  91. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailState.d.ts +3 -2
  92. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.d.ts +8 -0
  93. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +52 -0
  94. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -1
  95. package/lib/view/scheduleView/scheduleListView/epics/fetchScheduleListEpic.js +7 -1
  96. package/lib/view/scheduleView/scheduleListView/scheduleListHelper.d.ts +33 -2
  97. package/lib/view/scheduleView/scheduleListView/scheduleListHelper.js +117 -1
  98. package/lib/view/scheduleView/scheduleListView/scheduleListPayload.d.ts +6 -1
  99. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +32 -4
  100. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +207 -69
  101. package/lib/view/scheduleView/scheduleListView/scheduleListSelector.d.ts +23 -1
  102. package/lib/view/scheduleView/scheduleListView/scheduleListSelector.js +176 -5
  103. package/lib/view/scheduleView/scheduleListView/scheduleListState.d.ts +15 -3
  104. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  105. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.js +2 -0
  106. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
  107. package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
  108. package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
  109. package/lib/view/vendorList/vendorListSelector.d.ts +1 -1
  110. package/lib/view/vendorList/vendorListSelector.js +1 -0
  111. package/lib/view/vendorTabView/fetchVendorTabViewEpic.d.ts +2 -2
  112. package/lib/view/vendorTabView/fetchVendorTabViewEpic.js +11 -1
  113. package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +2 -0
  114. package/lib/view/vendorTabView/vendorTabViewReducer.js +2 -1
  115. package/package.json +1 -1
@@ -1,8 +1,13 @@
1
- import { JEScheduledTransactionPayload, ScheduledJournalEntryPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
1
+ import { JEAccruedScheduledTransactionPayload, JEScheduledTransactionPayload, ScheduledJournalEntryPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
2
2
  import { ZeniAPIResponse } from '../../../responsePayload';
3
3
  interface ScheduleListPayload {
4
4
  je_schedules: JEScheduledTransactionPayload[];
5
5
  scheduled_journal_entries?: ScheduledJournalEntryPayload[];
6
6
  }
7
7
  export declare type FetchScheduleListResponse = ZeniAPIResponse<ScheduleListPayload>;
8
+ export interface AccruedScheduleListPayload {
9
+ je_schedules: JEAccruedScheduledTransactionPayload[];
10
+ scheduled_journal_entries?: ScheduledJournalEntryPayload[];
11
+ }
12
+ export declare type FetchAccruedScheduleListResponse = ZeniAPIResponse<AccruedScheduleListPayload>;
8
13
  export {};
@@ -1,15 +1,17 @@
1
- import { ScheduleListLocalData, ScheduleListViewState, ScheduleListForTypeState, JESchedulesForTypeState, ScheduleListUIState } from './scheduleListState';
1
+ import { ScheduleListLocalData, ScheduleListViewState, ScheduleListForTypeState, JESchedulesForTypeState, ScheduleListUIState, ScheduleAccruedListForTypeState, JEAccruedSchedulesForTypeState } from './scheduleListState';
2
2
  import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
3
3
  import { FetchState, ID } from '../../../commonStateTypes/common';
4
4
  import { TimeframeTick } from '../../../commonStateTypes/timeframeTick';
5
5
  import { ZeniAPIStatus } from '../../../responsePayload';
6
6
  import { ScheduleListSortKey, ScheduleSubTabType } from './scheduleListTypes';
7
- import { JEScheduledTransactionPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
8
- import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
7
+ import { JEAccruedScheduledTransactionPayload, JEScheduledTransactionPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
8
+ import { JEScheduleKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
9
9
  export declare const initialUIState: ScheduleListUIState;
10
10
  export declare const initialJESchedulesForTypeState: JESchedulesForTypeState;
11
+ export declare const initialJEAccruedSchedulesForTypeState: JEAccruedSchedulesForTypeState;
11
12
  export declare const initialScheduleListStateByType: ScheduleListForTypeState;
12
13
  export declare const initialFixedAssetsScheduleListStateByType: ScheduleListForTypeState;
14
+ export declare const initialAccruedExpensesScheduleListStateByType: ScheduleAccruedListForTypeState;
13
15
  export declare const initialState: ScheduleListViewState;
14
16
  export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory: {
15
17
  selectedTimeframe: TimeframeTick;
@@ -22,6 +24,16 @@ export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCr
22
24
  scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
23
25
  cacheOverride: any;
24
26
  downloadCategories: string[];
27
+ }, string, never, never>, fetchAccruedScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
28
+ selectedTimeframe: TimeframeTick;
29
+ selectedCategoryId: ID;
30
+ } | undefined, cacheOverride?: any], {
31
+ timeframeAndCategory: {
32
+ selectedTimeframe: TimeframeTick;
33
+ selectedCategoryId: ID;
34
+ } | undefined;
35
+ scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
36
+ cacheOverride: any;
25
37
  }, string, never, never>, fetchScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
26
38
  selectedTimeframe: TimeframeTick;
27
39
  selectedCategoryId: ID;
@@ -37,11 +49,21 @@ export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCr
37
49
  selectedTimeframe: TimeframeTick;
38
50
  selectedCategoryId: string;
39
51
  scheduleList: JEScheduledTransactionPayload[];
52
+ }, string, never, never>, updateAccruedScheduleListSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", selectedTimeframe: TimeframeTick, selectedCategoryId: string, scheduleList: JEAccruedScheduledTransactionPayload[]], {
53
+ scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
54
+ selectedTimeframe: TimeframeTick;
55
+ selectedCategoryId: string;
56
+ scheduleList: JEAccruedScheduledTransactionPayload[];
40
57
  }, string, never, never>, updateScheduleListFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", selectedTimeframe: TimeframeTick, selectedCategoryId: string, error: ZeniAPIStatus<Record<string, unknown>>], {
41
58
  selectedCategoryId: string;
42
59
  selectedTimeframe: TimeframeTick;
43
60
  scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
44
61
  error: ZeniAPIStatus<Record<string, unknown>>;
62
+ }, string, never, never>, updateAccruedScheduleListFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", selectedTimeframe: TimeframeTick, selectedCategoryId: string, error: ZeniAPIStatus<Record<string, unknown>>], {
63
+ selectedCategoryId: string;
64
+ selectedTimeframe: TimeframeTick;
65
+ scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
66
+ error: ZeniAPIStatus<Record<string, unknown>>;
45
67
  }, string, never, never>, updateDownloadScheduleFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", selectedTimeframe: TimeframeTick, selectedCategoryId: string, error: ZeniAPIStatus<Record<string, unknown>>], {
46
68
  selectedCategoryId: string;
47
69
  selectedTimeframe: TimeframeTick;
@@ -71,7 +93,13 @@ export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCr
71
93
  }, string>, updateScheduleListDownloadState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
72
94
  scheduleType: ScheduleTypes;
73
95
  fetchState: FetchState;
96
+ }, string>, updateAccruedJEScheduleAccruedByListKey: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
97
+ scheduleType: ScheduleTypes;
98
+ jeScheduleAccruedKey: JEScheduleKey;
99
+ key: string;
74
100
  }, string>, clearScheduleList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
75
101
  declare const _default: import("@reduxjs/toolkit").Reducer<ScheduleListViewState, import("@reduxjs/toolkit").AnyAction>;
76
102
  export default _default;
77
- export declare function getState(state: ScheduleListViewState, scheduleType: ScheduleTypes): ScheduleListForTypeState;
103
+ declare type ScheduleStateType<T extends ScheduleTypes> = T extends 'prepaid_expenses' | 'fixed_assets' ? ScheduleListForTypeState : T extends 'accrued_expenses' ? ScheduleAccruedListForTypeState : never;
104
+ export declare function updateState<T extends ScheduleTypes>(state: ScheduleListViewState, scheduleType: T, updates: Partial<ScheduleStateType<T>>): void;
105
+ export declare function getState<T extends ScheduleTypes>(state: ScheduleListViewState, scheduleType: T): ScheduleStateType<T>;
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getState = exports.clearScheduleList = exports.updateScheduleListDownloadState = exports.updateScheduleListSearchText = exports.updateScheduleListLocalData = exports.updateScheduleListSortState = exports.updateScheduleListScrollState = exports.updateScheduleListSubTab = exports.updateDownloadScheduleSuccess = exports.updateDownloadScheduleFailure = exports.updateScheduleListFailure = exports.updateScheduleListSuccess = exports.fetchSchedulesAccount = exports.fetchScheduleList = exports.fetchDownloadSchedules = exports.initialState = exports.initialFixedAssetsScheduleListStateByType = exports.initialScheduleListStateByType = exports.initialJESchedulesForTypeState = exports.initialUIState = void 0;
4
+ exports.getState = exports.updateState = exports.clearScheduleList = exports.updateAccruedJEScheduleAccruedByListKey = exports.updateScheduleListDownloadState = exports.updateScheduleListSearchText = exports.updateScheduleListLocalData = exports.updateScheduleListSortState = exports.updateScheduleListScrollState = exports.updateScheduleListSubTab = exports.updateDownloadScheduleSuccess = exports.updateDownloadScheduleFailure = exports.updateAccruedScheduleListFailure = exports.updateScheduleListFailure = exports.updateAccruedScheduleListSuccess = exports.updateScheduleListSuccess = exports.fetchSchedulesAccount = exports.fetchScheduleList = exports.fetchAccruedScheduleList = exports.fetchDownloadSchedules = exports.initialState = exports.initialAccruedExpensesScheduleListStateByType = exports.initialFixedAssetsScheduleListStateByType = exports.initialScheduleListStateByType = exports.initialJEAccruedSchedulesForTypeState = exports.initialJESchedulesForTypeState = exports.initialUIState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const transactionIDPayload_1 = require("../../../entity/transaction/payloadTypes/transactionIDPayload");
7
7
  const scheduleListTypes_1 = require("./scheduleListTypes");
8
8
  const transactionDetailState_1 = require("../../transactionDetail/transactionDetailState");
9
+ const jeSchedulesPayload_1 = require("../../../entity/jeSchedules/jeSchedulesPayload");
9
10
  const scheduleListHelper_1 = require("./scheduleListHelper");
10
11
  exports.initialUIState = {
11
12
  sortKey: 'transactionDate',
@@ -27,6 +28,14 @@ exports.initialJESchedulesForTypeState = {
27
28
  error: undefined,
28
29
  jeScheduleTransactionKeys: [],
29
30
  };
31
+ exports.initialJEAccruedSchedulesForTypeState = {
32
+ hasValidState() {
33
+ return this.fetchState === 'Completed';
34
+ },
35
+ fetchState: 'Not-Started',
36
+ error: undefined,
37
+ jeScheduleAccruedKeys: [],
38
+ };
30
39
  exports.initialScheduleListStateByType = {
31
40
  jeScheduleKeysByListKey: {},
32
41
  scheduleListLocalData: {
@@ -45,12 +54,26 @@ exports.initialFixedAssetsScheduleListStateByType = Object.assign(Object.assign(
45
54
  selectedCategoryId: 'all',
46
55
  selectedTimeframe: (0, scheduleListHelper_1.getDefaultSelectedTimeframeForScheduleType)('fixed_assets'),
47
56
  }, selectedTimeframe: (0, scheduleListHelper_1.getDefaultSelectedTimeframeForScheduleType)('fixed_assets') });
57
+ exports.initialAccruedExpensesScheduleListStateByType = {
58
+ jeScheduleAccruedByListKey: {},
59
+ selectedCategoryId: 'all',
60
+ scheduleListLocalData: {
61
+ selectedCategoryId: 'all',
62
+ selectedTimeframe: (0, scheduleListHelper_1.getDefaultSelectedTimeframeForScheduleType)('accrued_expenses'),
63
+ },
64
+ selectedTimeframe: (0, scheduleListHelper_1.getDefaultSelectedTimeframeForScheduleType)('accrued_expenses'),
65
+ downloadState: {
66
+ fetchState: 'Not-Started',
67
+ error: undefined,
68
+ },
69
+ uiState: Object.assign(Object.assign({}, exports.initialUIState), { sortKey: 'createTime' }),
70
+ };
48
71
  exports.initialState = {
49
72
  listByScheduleType: {
50
73
  prepaid_expenses: exports.initialScheduleListStateByType,
51
74
  fixed_assets: exports.initialFixedAssetsScheduleListStateByType,
52
75
  deferred_revenue: exports.initialScheduleListStateByType,
53
- accrued_expenses: exports.initialScheduleListStateByType,
76
+ accrued_expenses: exports.initialAccruedExpensesScheduleListStateByType,
54
77
  },
55
78
  };
56
79
  const scheduleListView = (0, toolkit_1.createSlice)({
@@ -59,25 +82,28 @@ const scheduleListView = (0, toolkit_1.createSlice)({
59
82
  reducers: {
60
83
  fetchDownloadSchedules: {
61
84
  reducer(draft, action) {
62
- const state = getState(draft, action.payload.scheduleType);
63
- const selectedTimeframe = action.payload.timeframeAndCategory.selectedTimeframe;
64
- const selectedCategoryId = action.payload.timeframeAndCategory.selectedCategoryId;
65
- state.scheduleListLocalData = {
66
- selectedTimeframe,
67
- selectedCategoryId: selectedCategoryId,
68
- };
69
- const key = (0, scheduleListTypes_1.getScheduleListKey)(selectedCategoryId, selectedTimeframe);
70
- const record = state.jeScheduleKeysByListKey[key];
71
- state.selectedCategoryId = selectedCategoryId;
72
- state.selectedTimeframe = selectedTimeframe;
73
- state.downloadState = {
74
- fetchState: 'In-Progress',
75
- error: undefined,
76
- };
77
- if (record == null) {
78
- state.jeScheduleKeysByListKey[key] = Object.assign({}, exports.initialJESchedulesForTypeState);
85
+ if (action.payload.scheduleType !== 'accrued_expenses') {
86
+ //if condition added for type narrowing
87
+ const state = getState(draft, action.payload.scheduleType);
88
+ const selectedTimeframe = action.payload.timeframeAndCategory.selectedTimeframe;
89
+ const selectedCategoryId = action.payload.timeframeAndCategory.selectedCategoryId;
90
+ state.scheduleListLocalData = {
91
+ selectedTimeframe,
92
+ selectedCategoryId: selectedCategoryId,
93
+ };
94
+ const key = (0, scheduleListTypes_1.getScheduleListKey)(selectedCategoryId, selectedTimeframe);
95
+ const record = state.jeScheduleKeysByListKey[key];
96
+ state.selectedCategoryId = selectedCategoryId;
97
+ state.selectedTimeframe = selectedTimeframe;
98
+ state.downloadState = {
99
+ fetchState: 'In-Progress',
100
+ error: undefined,
101
+ };
102
+ if (record == null) {
103
+ state.jeScheduleKeysByListKey[key] = Object.assign({}, exports.initialJESchedulesForTypeState);
104
+ }
105
+ updateState(draft, action.payload.scheduleType, state);
79
106
  }
80
- updateState(draft, action.payload.scheduleType, state);
81
107
  },
82
108
  prepare(scheduleType, timeframeAndCategory, downloadCategories, cacheOverride = false) {
83
109
  return {
@@ -93,27 +119,65 @@ const scheduleListView = (0, toolkit_1.createSlice)({
93
119
  fetchSchedulesAccount: () => {
94
120
  // do nothing
95
121
  },
96
- fetchScheduleList: {
122
+ fetchAccruedScheduleList: {
97
123
  reducer(draft, action) {
98
- const state = getState(draft, action.payload.scheduleType);
99
- const selectedTimeframe = action.payload.timeframeAndCategory != null
100
- ? action.payload.timeframeAndCategory.selectedTimeframe
101
- : state.selectedTimeframe;
102
- const selectedCategoryId = action.payload.timeframeAndCategory != null
103
- ? action.payload.timeframeAndCategory.selectedCategoryId
104
- : state.selectedCategoryId;
105
- const key = (0, scheduleListTypes_1.getScheduleListKey)(selectedCategoryId, selectedTimeframe);
106
- const record = state.jeScheduleKeysByListKey[key];
107
- state.scheduleListLocalData = {
108
- selectedTimeframe,
109
- selectedCategoryId,
124
+ if (action.payload.scheduleType === 'accrued_expenses') {
125
+ //if condition added for type narrowing
126
+ const state = getState(draft, action.payload.scheduleType);
127
+ const selectedTimeframe = action.payload.timeframeAndCategory != null
128
+ ? action.payload.timeframeAndCategory.selectedTimeframe
129
+ : state.selectedTimeframe;
130
+ const selectedCategoryId = action.payload.timeframeAndCategory != null
131
+ ? action.payload.timeframeAndCategory.selectedCategoryId
132
+ : state.selectedCategoryId;
133
+ const key = (0, scheduleListTypes_1.getScheduleListKey)(selectedCategoryId, selectedTimeframe);
134
+ const record = state.jeScheduleAccruedByListKey[key];
135
+ state.scheduleListLocalData = {
136
+ selectedTimeframe,
137
+ selectedCategoryId,
138
+ };
139
+ state.selectedCategoryId = selectedCategoryId;
140
+ state.selectedTimeframe = selectedTimeframe;
141
+ if (record == null) {
142
+ state.jeScheduleAccruedByListKey[key] = Object.assign(Object.assign({}, exports.initialJEAccruedSchedulesForTypeState), { fetchState: 'In-Progress' });
143
+ }
144
+ updateState(draft, action.payload.scheduleType, state);
145
+ }
146
+ },
147
+ prepare(scheduleType, timeframeAndCategory, cacheOverride = false) {
148
+ return {
149
+ payload: {
150
+ timeframeAndCategory,
151
+ scheduleType,
152
+ cacheOverride,
153
+ },
110
154
  };
111
- state.selectedCategoryId = selectedCategoryId;
112
- state.selectedTimeframe = selectedTimeframe;
113
- if (record == null) {
114
- state.jeScheduleKeysByListKey[key] = Object.assign(Object.assign({}, exports.initialJESchedulesForTypeState), { fetchState: 'In-Progress' });
155
+ },
156
+ },
157
+ fetchScheduleList: {
158
+ reducer(draft, action) {
159
+ if (action.payload.scheduleType !== 'accrued_expenses') {
160
+ //if condition added for type narrowing
161
+ const state = getState(draft, action.payload.scheduleType);
162
+ const selectedTimeframe = action.payload.timeframeAndCategory != null
163
+ ? action.payload.timeframeAndCategory.selectedTimeframe
164
+ : state.selectedTimeframe;
165
+ const selectedCategoryId = action.payload.timeframeAndCategory != null
166
+ ? action.payload.timeframeAndCategory.selectedCategoryId
167
+ : state.selectedCategoryId;
168
+ const key = (0, scheduleListTypes_1.getScheduleListKey)(selectedCategoryId, selectedTimeframe);
169
+ const record = state.jeScheduleKeysByListKey[key];
170
+ state.scheduleListLocalData = {
171
+ selectedTimeframe,
172
+ selectedCategoryId,
173
+ };
174
+ state.selectedCategoryId = selectedCategoryId;
175
+ state.selectedTimeframe = selectedTimeframe;
176
+ if (record == null) {
177
+ state.jeScheduleKeysByListKey[key] = Object.assign(Object.assign({}, exports.initialJESchedulesForTypeState), { fetchState: 'In-Progress' });
178
+ }
179
+ updateState(draft, action.payload.scheduleType, state);
115
180
  }
116
- updateState(draft, action.payload.scheduleType, state);
117
181
  },
118
182
  prepare(scheduleType, timeframeAndCategory, cacheOverride = false) {
119
183
  return {
@@ -140,14 +204,50 @@ const scheduleListView = (0, toolkit_1.createSlice)({
140
204
  };
141
205
  },
142
206
  },
207
+ updateAccruedScheduleListSuccess: {
208
+ reducer(draft, action) {
209
+ doUpdateAccruedScheduleList(draft, action.payload.scheduleList, action.payload.scheduleType, action.payload.selectedTimeframe, action.payload.selectedCategoryId);
210
+ },
211
+ prepare(scheduleType, selectedTimeframe, selectedCategoryId, scheduleList) {
212
+ return {
213
+ payload: {
214
+ scheduleType,
215
+ selectedTimeframe,
216
+ selectedCategoryId,
217
+ scheduleList,
218
+ },
219
+ };
220
+ },
221
+ },
222
+ updateAccruedScheduleListFailure: {
223
+ reducer(draft, action) {
224
+ //if condition added for type narrowing
225
+ if (action.payload.scheduleType === 'accrued_expenses') {
226
+ const state = getState(draft, action.payload.scheduleType);
227
+ const key = (0, scheduleListTypes_1.getScheduleListKey)(action.payload.selectedCategoryId, action.payload.selectedTimeframe);
228
+ state.jeScheduleAccruedByListKey[key] = Object.assign(Object.assign({}, exports.initialJEAccruedSchedulesForTypeState), { fetchState: 'Error', error: action.payload.error });
229
+ state.selectedCategoryId = action.payload.selectedCategoryId;
230
+ state.selectedTimeframe = action.payload.selectedTimeframe;
231
+ updateState(draft, action.payload.scheduleType, state);
232
+ }
233
+ },
234
+ prepare(scheduleType, selectedTimeframe, selectedCategoryId, error) {
235
+ return {
236
+ payload: { selectedCategoryId, selectedTimeframe, scheduleType, error },
237
+ };
238
+ },
239
+ },
143
240
  updateScheduleListFailure: {
144
241
  reducer(draft, action) {
145
- const state = getState(draft, action.payload.scheduleType);
146
- const key = (0, scheduleListTypes_1.getScheduleListKey)(action.payload.selectedCategoryId, action.payload.selectedTimeframe);
147
- state.jeScheduleKeysByListKey[key] = Object.assign(Object.assign({}, exports.initialJESchedulesForTypeState), { fetchState: 'Error', error: action.payload.error });
148
- state.selectedCategoryId = action.payload.selectedCategoryId;
149
- state.selectedTimeframe = action.payload.selectedTimeframe;
150
- updateState(draft, action.payload.scheduleType, state);
242
+ if (action.payload.scheduleType !== 'accrued_expenses') {
243
+ //if condition added for type narrowing
244
+ const state = getState(draft, action.payload.scheduleType);
245
+ const key = (0, scheduleListTypes_1.getScheduleListKey)(action.payload.selectedCategoryId, action.payload.selectedTimeframe);
246
+ state.jeScheduleKeysByListKey[key] = Object.assign(Object.assign({}, exports.initialJESchedulesForTypeState), { fetchState: 'Error', error: action.payload.error });
247
+ state.selectedCategoryId = action.payload.selectedCategoryId;
248
+ state.selectedTimeframe = action.payload.selectedTimeframe;
249
+ updateState(draft, action.payload.scheduleType, state);
250
+ }
151
251
  },
152
252
  prepare(scheduleType, selectedTimeframe, selectedCategoryId, error) {
153
253
  return {
@@ -172,16 +272,19 @@ const scheduleListView = (0, toolkit_1.createSlice)({
172
272
  },
173
273
  updateDownloadScheduleFailure: {
174
274
  reducer(draft, action) {
175
- const state = getState(draft, action.payload.scheduleType);
176
- const key = (0, scheduleListTypes_1.getScheduleListKey)(action.payload.selectedCategoryId, action.payload.selectedTimeframe);
177
- state.jeScheduleKeysByListKey[key] = Object.assign(Object.assign({}, exports.initialJESchedulesForTypeState), { error: action.payload.error });
178
- state.selectedCategoryId = action.payload.selectedCategoryId;
179
- state.selectedTimeframe = action.payload.selectedTimeframe;
180
- state.downloadState = {
181
- fetchState: 'Error',
182
- error: action.payload.error,
183
- };
184
- updateState(draft, action.payload.scheduleType, state);
275
+ if (action.payload.scheduleType !== 'accrued_expenses') {
276
+ //if condition added for type narrowing
277
+ const state = getState(draft, action.payload.scheduleType);
278
+ const key = (0, scheduleListTypes_1.getScheduleListKey)(action.payload.selectedCategoryId, action.payload.selectedTimeframe);
279
+ state.jeScheduleKeysByListKey[key] = Object.assign(Object.assign({}, exports.initialJESchedulesForTypeState), { error: action.payload.error });
280
+ state.selectedCategoryId = action.payload.selectedCategoryId;
281
+ state.selectedTimeframe = action.payload.selectedTimeframe;
282
+ state.downloadState = {
283
+ fetchState: 'Error',
284
+ error: action.payload.error,
285
+ };
286
+ updateState(draft, action.payload.scheduleType, state);
287
+ }
185
288
  },
186
289
  prepare(scheduleType, selectedTimeframe, selectedCategoryId, error) {
187
290
  return {
@@ -226,37 +329,72 @@ const scheduleListView = (0, toolkit_1.createSlice)({
226
329
  };
227
330
  updateState(draft, action.payload.scheduleType, state);
228
331
  },
332
+ updateAccruedJEScheduleAccruedByListKey(draft, action) {
333
+ const { key, jeScheduleAccruedKey, scheduleType } = action.payload;
334
+ if (scheduleType === 'accrued_expenses') {
335
+ const state = getState(draft, scheduleType);
336
+ const records = state.jeScheduleAccruedByListKey[key];
337
+ if (records != null) {
338
+ const prev = state.jeScheduleAccruedByListKey[key].jeScheduleAccruedKeys;
339
+ state.jeScheduleAccruedByListKey[key].jeScheduleAccruedKeys = [
340
+ ...prev,
341
+ jeScheduleAccruedKey,
342
+ ];
343
+ }
344
+ updateState(draft, scheduleType, state);
345
+ }
346
+ },
229
347
  clearScheduleList(draft) {
230
348
  Object.assign(draft, exports.initialState);
231
349
  },
232
350
  },
233
351
  });
234
- _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.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;
352
+ _a = scheduleListView.actions, exports.fetchDownloadSchedules = _a.fetchDownloadSchedules, exports.fetchAccruedScheduleList = _a.fetchAccruedScheduleList, exports.fetchScheduleList = _a.fetchScheduleList, exports.fetchSchedulesAccount = _a.fetchSchedulesAccount, exports.updateScheduleListSuccess = _a.updateScheduleListSuccess, exports.updateAccruedScheduleListSuccess = _a.updateAccruedScheduleListSuccess, exports.updateScheduleListFailure = _a.updateScheduleListFailure, exports.updateAccruedScheduleListFailure = _a.updateAccruedScheduleListFailure, exports.updateDownloadScheduleFailure = _a.updateDownloadScheduleFailure, exports.updateDownloadScheduleSuccess = _a.updateDownloadScheduleSuccess, 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.updateAccruedJEScheduleAccruedByListKey = _a.updateAccruedJEScheduleAccruedByListKey, exports.clearScheduleList = _a.clearScheduleList;
235
353
  exports.default = scheduleListView.reducer;
236
354
  /**
237
355
  * Helper functions
238
356
  */
239
357
  function doUpdateScheduleList(draft, payload, scheduleType, selectedTimeframe, selectedCategoryId) {
240
- const state = getState(draft, scheduleType);
241
- const jeScheduleTransactionKeys = payload.map((schedules) => {
242
- const transactionID = (0, transactionIDPayload_1.toTransactionID)(schedules.base_transaction);
243
- return (0, transactionDetailState_1.getZeniTransactionDetailKey)(transactionID);
244
- });
245
- state.selectedCategoryId = selectedCategoryId;
246
- state.selectedTimeframe = selectedTimeframe;
247
- const key = (0, scheduleListTypes_1.getScheduleListKey)(selectedCategoryId, selectedTimeframe);
248
- const record = state.jeScheduleKeysByListKey[key];
249
- state.jeScheduleKeysByListKey[key] = Object.assign(Object.assign({}, record), { fetchState: 'Completed', error: undefined, jeScheduleTransactionKeys });
250
- state.downloadState = {
251
- fetchState: 'Completed',
252
- error: undefined,
253
- };
358
+ if (scheduleType !== 'accrued_expenses') {
359
+ const state = getState(draft, scheduleType);
360
+ const jeScheduleTransactionKeys = payload.map((schedules) => {
361
+ const transactionID = (0, transactionIDPayload_1.toTransactionID)(schedules.base_transaction);
362
+ return (0, transactionDetailState_1.getZeniTransactionDetailKey)(transactionID);
363
+ });
364
+ state.selectedCategoryId = selectedCategoryId;
365
+ state.selectedTimeframe = selectedTimeframe;
366
+ const key = (0, scheduleListTypes_1.getScheduleListKey)(selectedCategoryId, selectedTimeframe);
367
+ const record = state.jeScheduleKeysByListKey[key];
368
+ state.jeScheduleKeysByListKey[key] = Object.assign(Object.assign({}, record), { fetchState: 'Completed', error: undefined, jeScheduleTransactionKeys });
369
+ state.downloadState = {
370
+ fetchState: 'Completed',
371
+ error: undefined,
372
+ };
373
+ }
374
+ }
375
+ function doUpdateAccruedScheduleList(draft, payload, scheduleType, selectedTimeframe, selectedCategoryId) {
376
+ if (scheduleType === 'accrued_expenses') {
377
+ const state = getState(draft, scheduleType);
378
+ const jeScheduleAccruedKeys = payload.map((schedule) => (0, jeSchedulesPayload_1.getJEScheduleKey)(schedule));
379
+ state.selectedCategoryId = selectedCategoryId;
380
+ state.selectedTimeframe = selectedTimeframe;
381
+ const key = (0, scheduleListTypes_1.getScheduleListKey)(selectedCategoryId, selectedTimeframe);
382
+ const record = state.jeScheduleAccruedByListKey[key];
383
+ state.jeScheduleAccruedByListKey[key] = Object.assign(Object.assign({}, record), { fetchState: 'Completed', error: undefined, jeScheduleAccruedKeys });
384
+ state.downloadState = {
385
+ fetchState: 'Completed',
386
+ error: undefined,
387
+ };
388
+ }
254
389
  }
255
390
  function updateState(state, scheduleType, updates) {
391
+ // TODO: Find a better to handle multiple type
256
392
  const listState = state.listByScheduleType[scheduleType];
257
393
  state.listByScheduleType[scheduleType] = Object.assign(Object.assign({}, listState), updates);
258
394
  }
395
+ exports.updateState = updateState;
259
396
  function getState(state, scheduleType) {
397
+ // TODO: Find a better to handle multiple type
260
398
  return state.listByScheduleType[scheduleType];
261
399
  }
262
400
  exports.getState = getState;
@@ -6,7 +6,7 @@ import { ScheduleListLocalData, ScheduleListUIState } from './scheduleListState'
6
6
  import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
7
7
  import { TimeframeTick, TimeframeTickWithMetaData } from '../../../commonStateTypes/timeframeTick';
8
8
  import { AccountBase } from '../../../entity/account/accountState';
9
- import { JEScheduledTransaction } from '../../../entity/jeSchedules/jeSchedulesSelector';
9
+ import { JEScheduledTransaction, JEAccruedSchedule } from '../../../entity/jeSchedules/jeSchedulesSelector';
10
10
  import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
11
11
  import { Amount } from '../../../commonStateTypes/amount';
12
12
  import { COABalanceGroupedByPeriod } from '../../../commonStateTypes/coaBalance/coaBalance';
@@ -14,6 +14,10 @@ export interface JEScheduledTransactionWithBalance extends JEScheduledTransactio
14
14
  coaBalanceByPeriod: COABalanceGroupedByPeriod;
15
15
  durationOfMonths: number;
16
16
  }
17
+ export interface JEScheduleWithBalance extends JEAccruedSchedule {
18
+ coaBalanceByPeriod: COABalanceGroupedByPeriod;
19
+ durationOfMonths: number;
20
+ }
17
21
  export interface ScheduleListReport extends SelectorView {
18
22
  scheduleType: ScheduleTypes;
19
23
  downloadUIState: FetchStateAndError;
@@ -31,6 +35,24 @@ export interface ScheduleListReport extends SelectorView {
31
35
  totalRunningBalances: Amount;
32
36
  selectedScheduledId?: ID;
33
37
  }
38
+ export interface ScheduleAccruedListReport extends SelectorView {
39
+ scheduleType: ScheduleTypes;
40
+ downloadUIState: FetchStateAndError;
41
+ jeScheduleOrder: EntityOrder;
42
+ jeAccruedSchedules: JEScheduleWithBalance[];
43
+ scheduleListAccounts: AccountBase[];
44
+ scheduleListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
45
+ uiState: ScheduleListUIState;
46
+ selectedCategoryId: ID;
47
+ selectedTimeframe: TimeframeTick;
48
+ scheduleListLocalData: ScheduleListLocalData;
49
+ allTimeframeTicks: TimeframeTickWithMetaData[];
50
+ totalBalanceTimeframeTicks: COABalanceGroupedByPeriod;
51
+ totalAmount: Amount;
52
+ totalRunningBalances: Amount;
53
+ selectedAccruedScheduleId?: ID;
54
+ }
34
55
  export declare const getScheduleListReport: (state: RootState, scheduleType: ScheduleTypes) => ScheduleListReport;
56
+ export declare const getAccruedScheduleListReport: (state: RootState, scheduleType: ScheduleTypes) => ScheduleAccruedListReport;
35
57
  export declare const getFetchStateForScheduleAccountList: (state: RootState) => FetchState;
36
58
  export declare const getFetchStateForScheduleListByType: (state: RootState, scheduleType: ScheduleTypes) => FetchState;