@zeniai/client-epic-state 4.13.40 → 4.13.42

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.
@@ -82,6 +82,7 @@ const fetchDashboardEpic = (actions$, state$) => actions$.pipe((0, operators_1.f
82
82
  actions.push((0, monthEndCloseChecksViewReducer_1.fetchMonthEndCloseChecks)({
83
83
  tenantId,
84
84
  period: monthEndChecksPeriod,
85
+ refreshViewInBackground: false,
85
86
  }));
86
87
  }
87
88
  return (0, rxjs_1.from)(actions);
@@ -188,6 +189,7 @@ const fetchDashboardEpic = (actions$, state$) => actions$.pipe((0, operators_1.f
188
189
  fetchActions.push((0, monthEndCloseChecksViewReducer_1.fetchMonthEndCloseChecks)({
189
190
  tenantId,
190
191
  period: monthEndChecksPeriod,
192
+ refreshViewInBackground: false,
191
193
  }));
192
194
  }
193
195
  return (0, rxjs_1.from)(fetchActions);
@@ -46,13 +46,10 @@ function getExpenseAutomationView(state) {
46
46
  let auditSummary = undefined;
47
47
  const currentCompany = companyState.companiesById[currentTenant.companyId];
48
48
  const managementInfo = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.managementInfo;
49
- const controllerUserIds = managementInfo != null ? managementInfo.controllerUserIds : [];
50
- const reviewerUserIds = managementInfo != null ? managementInfo.reviewerUserIds : [];
49
+ const preparerUserIds = managementInfo != null ? managementInfo.preparerUserIds : [];
51
50
  const isZeniUser = Boolean((_a = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.userEmail) === null || _a === void 0 ? void 0 : _a.includes('zeni.ai'));
52
- const isControllerOrReviewer = loggedInUser != null &&
53
- (controllerUserIds.includes(loggedInUser.userId) ||
54
- reviewerUserIds.includes(loggedInUser.userId));
55
- const userAllowedToAccessMonthEndInsights = isZeniUser === false || isControllerOrReviewer;
51
+ const isPreparer = loggedInUser != null && preparerUserIds.includes(loggedInUser.userId);
52
+ const userAllowedToAccessMonthEndInsights = isZeniUser === false || isPreparer === false;
56
53
  if (selectedPeriod != null) {
57
54
  const monthYearPeriodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
58
55
  if (currentTenantId != null) {
@@ -69,7 +69,7 @@ const toTransactionUpdatesFromTransactionCategorizationLocalData = (transactionC
69
69
  : (_k = accountLine.vendor) === null || _k === void 0 ? void 0 : _k.id
70
70
  : undefined;
71
71
  if (entityDetails != null &&
72
- (updatedEntityId != null || updatedLineEntityId != null)) {
72
+ (hasCategoryChanged === true || hasClassChanged === true)) {
73
73
  lastUpdatedCategory =
74
74
  hasCategoryChanged === true ? recommendedAccountBase : undefined;
75
75
  lastUpdatedClass =
@@ -94,9 +94,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
94
94
  scrollLeft: undefined,
95
95
  };
96
96
  }
97
- if (action.payload.keepExistingListItems === false) {
98
- draft[selectedTab].selectedCheckBoxTransactionIds = [];
99
- }
100
97
  draft[selectedTab].uiState.pageToken = (_a = action.payload.pageToken) !== null && _a !== void 0 ? _a : null;
101
98
  draft[selectedTab].uiState.searchString =
102
99
  (_b = action.payload.searchString) !== null && _b !== void 0 ? _b : '';
@@ -7,7 +7,7 @@ const responsePayload_1 = require("../../../responsePayload");
7
7
  const monthEndCloseChecksViewReducer_1 = require("../monthEndCloseChecksViewReducer");
8
8
  const monthEndCloseChecksReducer_1 = require("../../../entity/monthEndCloseChecks/monthEndCloseChecksReducer");
9
9
  const fetchMonthEndCloseChecksEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(monthEndCloseChecksViewReducer_1.fetchMonthEndCloseChecks.match), (0, operators_1.switchMap)((action) => {
10
- const { period, tenantId } = action.payload;
10
+ const { period, tenantId, refreshViewInBackground } = action.payload;
11
11
  const month = period.month < 10 ? `0${period.month}` : period.month;
12
12
  const queryParam = {
13
13
  month_and_year: `${month}-${period.year}`,
@@ -27,6 +27,7 @@ const fetchMonthEndCloseChecksEpic = (actions$, _state$, zeniAPI) => actions$.pi
27
27
  tenantId,
28
28
  period,
29
29
  fetchState: 'Completed',
30
+ refreshViewInBackground,
30
31
  }),
31
32
  ];
32
33
  return (0, rxjs_1.from)(actions);
@@ -38,6 +39,7 @@ const fetchMonthEndCloseChecksEpic = (actions$, _state$, zeniAPI) => actions$.pi
38
39
  period,
39
40
  fetchState: 'Error',
40
41
  error: response.status,
42
+ refreshViewInBackground,
41
43
  }),
42
44
  ];
43
45
  return (0, rxjs_1.from)(actions);
@@ -48,6 +50,7 @@ const fetchMonthEndCloseChecksEpic = (actions$, _state$, zeniAPI) => actions$.pi
48
50
  tenantId,
49
51
  period,
50
52
  fetchState: 'Error',
53
+ refreshViewInBackground,
51
54
  error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Fetch Month end close checks REST API call errored out' +
52
55
  JSON.stringify(error)),
53
56
  }),
@@ -6,10 +6,12 @@ export declare const initialState: MonthEndCloseChecksViewState;
6
6
  export declare const fetchMonthEndCloseChecks: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
7
7
  tenantId: ID;
8
8
  period: MonthYearPeriod;
9
+ refreshViewInBackground: boolean;
9
10
  }, string>, updateMonthEndCloseChecksView: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
10
11
  tenantId: ID;
11
12
  period: MonthYearPeriod;
12
13
  fetchState: FetchState;
14
+ refreshViewInBackground: boolean;
13
15
  error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
14
16
  }, string>, clearAllMonthEndCloseChecksView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
15
17
  declare const _default: import("@reduxjs/toolkit").Reducer<MonthEndCloseChecksViewState, import("@reduxjs/toolkit").AnyAction>;
@@ -6,26 +6,39 @@ const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const timePeriod_1 = require("../../commonStateTypes/timePeriod");
7
7
  exports.initialState = {
8
8
  monthEndCloseChecksViewByTenantId: {},
9
+ refreshStatus: {
10
+ fetchState: 'Not-Started',
11
+ },
9
12
  };
10
13
  const monthEndCloseChecksView = (0, toolkit_1.createSlice)({
11
14
  name: 'monthEndCloseChecksView',
12
15
  initialState: exports.initialState,
13
16
  reducers: {
14
17
  fetchMonthEndCloseChecks(draft, action) {
15
- const { tenantId, period } = action.payload;
18
+ const { tenantId, period, refreshViewInBackground } = action.payload;
16
19
  const monthYearId = (0, timePeriod_1.toMonthYearPeriodId)(period);
17
- draft.monthEndCloseChecksViewByTenantId = Object.assign(Object.assign({}, draft.monthEndCloseChecksViewByTenantId), { [tenantId]: Object.assign(Object.assign({}, draft.monthEndCloseChecksViewByTenantId[tenantId]), { [monthYearId]: {
18
- fetchState: 'In-Progress',
19
- error: undefined,
20
- } }) });
20
+ if (refreshViewInBackground === false) {
21
+ draft.monthEndCloseChecksViewByTenantId = Object.assign(Object.assign({}, draft.monthEndCloseChecksViewByTenantId), { [tenantId]: Object.assign(Object.assign({}, draft.monthEndCloseChecksViewByTenantId[tenantId]), { [monthYearId]: {
22
+ fetchState: 'In-Progress',
23
+ error: undefined,
24
+ } }) });
25
+ }
26
+ else {
27
+ draft.refreshStatus.fetchState = 'In-Progress';
28
+ }
21
29
  },
22
30
  updateMonthEndCloseChecksView(draft, action) {
23
- const { tenantId, period, error, fetchState } = action.payload;
31
+ const { tenantId, period, error, fetchState, refreshViewInBackground } = action.payload;
24
32
  const monthYearId = (0, timePeriod_1.toMonthYearPeriodId)(period);
25
- draft.monthEndCloseChecksViewByTenantId = Object.assign(Object.assign({}, draft.monthEndCloseChecksViewByTenantId), { [tenantId]: Object.assign(Object.assign({}, draft.monthEndCloseChecksViewByTenantId[tenantId]), { [monthYearId]: {
26
- fetchState,
27
- error: error,
28
- } }) });
33
+ if (refreshViewInBackground === false) {
34
+ draft.monthEndCloseChecksViewByTenantId = Object.assign(Object.assign({}, draft.monthEndCloseChecksViewByTenantId), { [tenantId]: Object.assign(Object.assign({}, draft.monthEndCloseChecksViewByTenantId[tenantId]), { [monthYearId]: {
35
+ fetchState,
36
+ error: error,
37
+ } }) });
38
+ }
39
+ else {
40
+ draft.refreshStatus.fetchState = 'Completed';
41
+ }
29
42
  },
30
43
  clearAllMonthEndCloseChecksView(draft) {
31
44
  draft.monthEndCloseChecksViewByTenantId = {};
@@ -1,4 +1,4 @@
1
- import { ID } from '../../commonStateTypes/common';
1
+ import { ID, FetchStateAndError } from '../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
3
3
  import { RootState } from '../../reducer';
4
4
  import { MonthEndCloseChecksInfo } from '../../entity/monthEndCloseChecks/monthEndCloseChecksState';
@@ -6,5 +6,6 @@ import { MonthYearPeriod } from '../../commonStateTypes/timePeriod';
6
6
  export interface MonthEndCloseChecksView extends SelectorView {
7
7
  monthEndCloseChecks?: MonthEndCloseChecksInfo;
8
8
  selectedPeriod: MonthYearPeriod;
9
+ refreshStatus: FetchStateAndError;
9
10
  }
10
11
  export declare const getMonthEndCloseChecksViewByTenantId: (state: RootState, tenantId: ID) => MonthEndCloseChecksView;
@@ -6,6 +6,7 @@ const monthEndCloseChecksSelector_1 = require("../../entity/monthEndCloseChecks/
6
6
  const timePeriod_1 = require("../../commonStateTypes/timePeriod");
7
7
  exports.getMonthEndCloseChecksViewByTenantId = (0, toolkit_1.createSelector)((state) => state.monthEndCloseChecksState, (state) => state.monthEndCloseChecksViewState, (state) => state.expenseAutomationViewState, (_state, tenantId) => tenantId, (monthEndCloseChecksState, monthEndCloseChecksViewState, expenseAutomationViewState, tenantId) => {
8
8
  var _a;
9
+ const { refreshStatus } = monthEndCloseChecksViewState;
9
10
  const selectedPeriod = expenseAutomationViewState.selectedPeriodByTenantId[tenantId];
10
11
  const { monthEndCloseChecksViewByTenantId } = monthEndCloseChecksViewState;
11
12
  const monthYearPeriodId = selectedPeriod != null ? (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod) : null;
@@ -19,12 +20,14 @@ exports.getMonthEndCloseChecksViewByTenantId = (0, toolkit_1.createSelector)((st
19
20
  const sortedMonthEndCloseCheckList = [
20
21
  ...monthEndCloseChecks.monthEndCloseCheckList,
21
22
  ].sort((a, b) => b.frequency.localeCompare(a.frequency));
22
- return Object.assign(Object.assign({}, monthEndCloseChecksView), { monthEndCloseChecks: Object.assign(Object.assign({}, monthEndCloseChecks), { monthEndCloseCheckList: sortedMonthEndCloseCheckList }), reportId: 'expense_automation_card', selectedPeriod });
23
+ return Object.assign(Object.assign({}, monthEndCloseChecksView), { monthEndCloseChecks: Object.assign(Object.assign({}, monthEndCloseChecks), { monthEndCloseCheckList: sortedMonthEndCloseCheckList }), reportId: 'expense_automation_card', selectedPeriod,
24
+ refreshStatus });
23
25
  }
24
26
  return {
25
27
  fetchState: 'Not-Started',
26
28
  error: undefined,
27
29
  reportId: 'expense_automation_card',
28
30
  selectedPeriod,
31
+ refreshStatus,
29
32
  };
30
33
  });
@@ -2,4 +2,5 @@ import { FetchStateAndError, ID } from '../../commonStateTypes/common';
2
2
  import { MonthYearPeriodId } from '../../commonStateTypes/timePeriod';
3
3
  export interface MonthEndCloseChecksViewState {
4
4
  monthEndCloseChecksViewByTenantId: Record<ID, Record<MonthYearPeriodId, FetchStateAndError>>;
5
+ refreshStatus: FetchStateAndError;
5
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.13.40",
3
+ "version": "4.13.42",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",