@zeniai/client-epic-state 5.1.92-betaRD0 → 5.1.92-betaRD2

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.
@@ -30,7 +30,7 @@ export const fetchAccruedScheduleListEpic = (actions$, state$, zeniAPI) => actio
30
30
  je_schedule_type: scheduleType,
31
31
  sort_by: 'transaction_date',
32
32
  sort_order: 'desc',
33
- filter: 'all',
33
+ filter: action.payload.statusFilter,
34
34
  };
35
35
  return zeniAPI
36
36
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -7,9 +7,14 @@ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePay
7
7
  import { fetchDownloadSchedules, getState, updateDownloadScheduleFailure, updateDownloadScheduleSuccess, } from '../scheduleListReducer';
8
8
  import { getScheduleListKey } from '../scheduleListTypes';
9
9
  export const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchDownloadSchedules.match), mergeMap((action) => {
10
- const { scheduleType, downloadCategories } = action.payload;
10
+ const { scheduleType, downloadCategories, statusFilter } = action.payload;
11
11
  const scheduleListState = state$.value.scheduleListState;
12
12
  // if parameters are provided, use those. else go to localdata
13
+ // Accrued is deliberately not served here. Its rows come back in a different shape, this
14
+ // epic writes them through updateJESchedules (the prepaid / fixed mapper), and
15
+ // doUpdateScheduleList never flips downloadState for accrued -- so a request would store the
16
+ // wrong data and then never report completion. Accrued downloads go through
17
+ // fetchAccruedScheduleList, which owns that shape end to end.
13
18
  let scheduleState;
14
19
  if (scheduleType !== 'accrued_expenses') {
15
20
  scheduleState = getState(scheduleListState, scheduleType);
@@ -34,7 +39,7 @@ export const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions
34
39
  base_txn_account_ids: downloadCategories,
35
40
  sort_by: 'transaction_date',
36
41
  sort_order: 'desc',
37
- filter: 'all',
42
+ filter: statusFilter,
38
43
  };
39
44
  return zeniAPI
40
45
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/download?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -84,8 +84,8 @@ const scheduleListView = createSlice({
84
84
  reducers: {
85
85
  fetchDownloadSchedules: {
86
86
  reducer(draft, action) {
87
+ // Accrued is not downloaded through this action -- see fetchDownloadSchedulesEpic for why.
87
88
  if (action.payload.scheduleType !== 'accrued_expenses') {
88
- //if condition added for type narrowing
89
89
  const state = getState(draft, action.payload.scheduleType);
90
90
  const selectedTimeframe = action.payload.timeframeAndCategory.selectedTimeframe;
91
91
  const selectedCategoryId = action.payload.timeframeAndCategory.selectedCategoryId;
@@ -109,13 +109,14 @@ const scheduleListView = createSlice({
109
109
  updateState(draft, action.payload.scheduleType, state);
110
110
  }
111
111
  },
112
- prepare(scheduleType, timeframeAndCategory, downloadCategories, cacheOverride = false) {
112
+ prepare(scheduleType, timeframeAndCategory, downloadCategories, statusFilter = 'all', cacheOverride = false) {
113
113
  return {
114
114
  payload: {
115
115
  timeframeAndCategory,
116
116
  scheduleType,
117
117
  cacheOverride,
118
118
  downloadCategories,
119
+ statusFilter,
119
120
  },
120
121
  };
121
122
  },
@@ -151,12 +152,13 @@ const scheduleListView = createSlice({
151
152
  updateState(draft, action.payload.scheduleType, state);
152
153
  }
153
154
  },
154
- prepare(scheduleType, timeframeAndCategory, cacheOverride = false) {
155
+ prepare(scheduleType, timeframeAndCategory, cacheOverride = false, statusFilter = 'all') {
155
156
  return {
156
157
  payload: {
157
158
  timeframeAndCategory,
158
159
  scheduleType,
159
160
  cacheOverride,
161
+ statusFilter,
160
162
  },
161
163
  };
162
164
  },
@@ -33,7 +33,7 @@ const fetchAccruedScheduleListEpic = (actions$, state$, zeniAPI) => actions$.pip
33
33
  je_schedule_type: scheduleType,
34
34
  sort_by: 'transaction_date',
35
35
  sort_order: 'desc',
36
- filter: 'all',
36
+ filter: action.payload.statusFilter,
37
37
  };
38
38
  return zeniAPI
39
39
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -10,9 +10,14 @@ const responsePayload_1 = require("../../../../responsePayload");
10
10
  const scheduleListReducer_1 = require("../scheduleListReducer");
11
11
  const scheduleListTypes_1 = require("../scheduleListTypes");
12
12
  const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(scheduleListReducer_1.fetchDownloadSchedules.match), (0, operators_1.mergeMap)((action) => {
13
- const { scheduleType, downloadCategories } = action.payload;
13
+ const { scheduleType, downloadCategories, statusFilter } = action.payload;
14
14
  const scheduleListState = state$.value.scheduleListState;
15
15
  // if parameters are provided, use those. else go to localdata
16
+ // Accrued is deliberately not served here. Its rows come back in a different shape, this
17
+ // epic writes them through updateJESchedules (the prepaid / fixed mapper), and
18
+ // doUpdateScheduleList never flips downloadState for accrued -- so a request would store the
19
+ // wrong data and then never report completion. Accrued downloads go through
20
+ // fetchAccruedScheduleList, which owns that shape end to end.
16
21
  let scheduleState;
17
22
  if (scheduleType !== 'accrued_expenses') {
18
23
  scheduleState = (0, scheduleListReducer_1.getState)(scheduleListState, scheduleType);
@@ -37,7 +42,7 @@ const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe(
37
42
  base_txn_account_ids: downloadCategories,
38
43
  sort_by: 'transaction_date',
39
44
  sort_order: 'desc',
40
- filter: 'all',
45
+ filter: statusFilter,
41
46
  };
42
47
  return zeniAPI
43
48
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/download?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -16,7 +16,7 @@ export declare const initialState: ScheduleListViewState;
16
16
  export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory: {
17
17
  selectedCategoryId: ID;
18
18
  selectedTimeframe: TimeframeTick;
19
- }, downloadCategories: string[], cacheOverride?: any], {
19
+ }, downloadCategories: string[], statusFilter?: "completed" | "new" | "ongoing" | "all" | undefined, cacheOverride?: any], {
20
20
  timeframeAndCategory: {
21
21
  selectedCategoryId: ID;
22
22
  selectedTimeframe: TimeframeTick;
@@ -24,16 +24,18 @@ export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCr
24
24
  scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
25
25
  cacheOverride: any;
26
26
  downloadCategories: string[];
27
+ statusFilter: "completed" | "new" | "ongoing" | "all";
27
28
  }, "scheduleListView/fetchDownloadSchedules", never, never>, fetchAccruedScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
28
29
  selectedCategoryId: ID;
29
30
  selectedTimeframe: TimeframeTick;
30
- } | undefined, cacheOverride?: any], {
31
+ } | undefined, cacheOverride?: any, statusFilter?: "completed" | "new" | "ongoing" | "all" | undefined], {
31
32
  timeframeAndCategory: {
32
33
  selectedCategoryId: ID;
33
34
  selectedTimeframe: TimeframeTick;
34
35
  } | undefined;
35
36
  scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
36
37
  cacheOverride: any;
38
+ statusFilter: "completed" | "new" | "ongoing" | "all";
37
39
  }, "scheduleListView/fetchAccruedScheduleList", never, never>, fetchScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
38
40
  selectedCategoryId: ID;
39
41
  selectedTimeframe: TimeframeTick;
@@ -90,8 +90,8 @@ const scheduleListView = (0, toolkit_1.createSlice)({
90
90
  reducers: {
91
91
  fetchDownloadSchedules: {
92
92
  reducer(draft, action) {
93
+ // Accrued is not downloaded through this action -- see fetchDownloadSchedulesEpic for why.
93
94
  if (action.payload.scheduleType !== 'accrued_expenses') {
94
- //if condition added for type narrowing
95
95
  const state = getState(draft, action.payload.scheduleType);
96
96
  const selectedTimeframe = action.payload.timeframeAndCategory.selectedTimeframe;
97
97
  const selectedCategoryId = action.payload.timeframeAndCategory.selectedCategoryId;
@@ -115,13 +115,14 @@ const scheduleListView = (0, toolkit_1.createSlice)({
115
115
  updateState(draft, action.payload.scheduleType, state);
116
116
  }
117
117
  },
118
- prepare(scheduleType, timeframeAndCategory, downloadCategories, cacheOverride = false) {
118
+ prepare(scheduleType, timeframeAndCategory, downloadCategories, statusFilter = 'all', cacheOverride = false) {
119
119
  return {
120
120
  payload: {
121
121
  timeframeAndCategory,
122
122
  scheduleType,
123
123
  cacheOverride,
124
124
  downloadCategories,
125
+ statusFilter,
125
126
  },
126
127
  };
127
128
  },
@@ -157,12 +158,13 @@ const scheduleListView = (0, toolkit_1.createSlice)({
157
158
  updateState(draft, action.payload.scheduleType, state);
158
159
  }
159
160
  },
160
- prepare(scheduleType, timeframeAndCategory, cacheOverride = false) {
161
+ prepare(scheduleType, timeframeAndCategory, cacheOverride = false, statusFilter = 'all') {
161
162
  return {
162
163
  payload: {
163
164
  timeframeAndCategory,
164
165
  scheduleType,
165
166
  cacheOverride,
167
+ statusFilter,
166
168
  },
167
169
  };
168
170
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.92-betaRD0",
3
+ "version": "5.1.92-betaRD2",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",