@zeniai/client-epic-state 4.10.0 → 4.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/view/settingsView/epic/fetchNotificationSettingsViewEpic.d.ts +2 -1
- package/lib/view/settingsView/epic/fetchNotificationSettingsViewEpic.js +8 -6
- package/lib/view/settingsView/settingsViewReducer.d.ts +4 -1
- package/lib/view/settingsView/settingsViewReducer.js +11 -2
- package/lib/view/settingsView/settingsViewSelector.js +18 -7
- package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,5 +2,6 @@ import { ActionsObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { fetchClassList } from '../../classList/classListReducer';
|
|
4
4
|
import { fetchUserListByType } from '../../userListView/userListViewReducer';
|
|
5
|
-
|
|
5
|
+
import { fetchCompanyPassportView } from '../../companyView/companyViewReducer';
|
|
6
|
+
export declare type ActionType = ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchCompanyPassportView> | ReturnType<typeof fetchClassList>;
|
|
6
7
|
export declare const fetchNotificationSettingsViewEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
|
|
@@ -6,11 +6,13 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const settingsViewReducer_1 = require("../settingsViewReducer");
|
|
7
7
|
const classListReducer_1 = require("../../classList/classListReducer");
|
|
8
8
|
const userListViewReducer_1 = require("../../userListView/userListViewReducer");
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const companyViewReducer_1 = require("../../companyView/companyViewReducer");
|
|
10
|
+
const fetchNotificationSettingsViewEpic = (actions$) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchNotificationSettingsView.match), (0, operators_1.switchMap)((action) => {
|
|
11
|
+
const { hasMonthEndAccess, companyId } = action.payload;
|
|
12
|
+
// if the user has access to month end, then we have to fetch users list and class list to show the dropdown. If not we need to fetch passport view to show the controller
|
|
13
|
+
if (hasMonthEndAccess) {
|
|
14
|
+
return (0, rxjs_1.from)([(0, userListViewReducer_1.fetchUserListByType)('manager', true), (0, classListReducer_1.fetchClassList)()]);
|
|
15
|
+
}
|
|
16
|
+
return (0, rxjs_1.from)([(0, companyViewReducer_1.fetchCompanyPassportView)(companyId)]);
|
|
15
17
|
}));
|
|
16
18
|
exports.fetchNotificationSettingsViewEpic = fetchNotificationSettingsViewEpic;
|
|
@@ -5,7 +5,10 @@ import { ID } from '../../commonStateTypes/common';
|
|
|
5
5
|
export declare const initialState: SettingsViewState;
|
|
6
6
|
export declare const fetchMyProfileView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string], {
|
|
7
7
|
companyId: string;
|
|
8
|
-
}, string, never, never>, fetchMyProfile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, fetchNotificationSettingsView: import("@reduxjs/toolkit").
|
|
8
|
+
}, string, never, never>, fetchMyProfile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, fetchNotificationSettingsView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[hasMonthEndAccess: boolean, companyId: string], {
|
|
9
|
+
hasMonthEndAccess: boolean;
|
|
10
|
+
companyId: string;
|
|
11
|
+
}, string, never, never>, updateMyProfileOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userId: string], {
|
|
9
12
|
userId: string;
|
|
10
13
|
}, string, never, never>, updateMyProfileOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchBankConnectionsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateBankConnectionOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
11
14
|
bankAccountIds: ID[];
|
|
@@ -101,8 +101,17 @@ const settings = (0, toolkit_1.createSlice)({
|
|
|
101
101
|
draft.bankConnection.fetchState = 'Error';
|
|
102
102
|
draft.bankConnection.error = action.payload;
|
|
103
103
|
},
|
|
104
|
-
fetchNotificationSettingsView
|
|
105
|
-
|
|
104
|
+
fetchNotificationSettingsView: {
|
|
105
|
+
prepare(hasMonthEndAccess, companyId) {
|
|
106
|
+
return { payload: { hasMonthEndAccess, companyId } };
|
|
107
|
+
},
|
|
108
|
+
reducer(
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
110
|
+
_draft,
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
112
|
+
_action) {
|
|
113
|
+
//do nothing
|
|
114
|
+
},
|
|
106
115
|
},
|
|
107
116
|
fetchNotificationSettings(draft) {
|
|
108
117
|
draft.notification.fetchState = 'In-Progress';
|
|
@@ -124,15 +124,26 @@ exports.getMyProfileView = (0, toolkit_1.createSelector)((state) => state.tenant
|
|
|
124
124
|
exports.getNotificationSettings = (0, toolkit_1.createSelector)((state) => state.settingsViewState, (settingsViewState) => {
|
|
125
125
|
return settingsViewState.notification;
|
|
126
126
|
});
|
|
127
|
-
exports.getNotificationSettingsView = (0, toolkit_1.createSelector)((state) => state.settingsViewState, (state) => state.userState, (state) => state.classState, (state) => state.classListState, (state) => (0, userListViewSelector_1.getUserList)(state, 'manager'), (settingsViewState, userState, classState, classListState, managersListView) => {
|
|
127
|
+
exports.getNotificationSettingsView = (0, toolkit_1.createSelector)((state) => state.settingsViewState, (state) => state.userState, (state) => state.classState, (state) => state.classListState, (state) => (0, userListViewSelector_1.getUserList)(state, 'manager'), (state) => (0, companyPassportViewSelector_1.getCompanyPassportView)(state), (settingsViewState, userState, classState, classListState, managersListView, companyPassportView) => {
|
|
128
|
+
var _a;
|
|
128
129
|
const classList = (0, classSelectorV2_1.getClassesByIds)(classState, {
|
|
129
130
|
classIds: classListState.classIds,
|
|
130
131
|
reportId: 'class_list',
|
|
131
132
|
});
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
const controllersList = ((_a = companyPassportView.companyView) === null || _a === void 0 ? void 0 : _a.controllers) != null
|
|
134
|
+
? companyPassportView.companyView.controllers.map((controller) => controller.user)
|
|
135
|
+
: [];
|
|
136
|
+
const fetchState = settingsViewState.notification.notificationSettings
|
|
137
|
+
.monthEndInsightsNotificationSettings.enabled != null
|
|
138
|
+
? (0, reduceFetchState_1.reduceAnyFetchState)([
|
|
139
|
+
settingsViewState.notification,
|
|
140
|
+
classListState,
|
|
141
|
+
managersListView,
|
|
142
|
+
])
|
|
143
|
+
: (0, reduceFetchState_1.reduceAnyFetchState)([
|
|
144
|
+
settingsViewState.notification,
|
|
145
|
+
companyPassportView,
|
|
146
|
+
]);
|
|
147
|
+
return Object.assign(Object.assign({}, settingsViewState.notification), { allUsers: (0, values_1.default)(userState.userByUserId), classList,
|
|
148
|
+
controllersList, managersList: managersListView.users, fetchState: fetchState.fetchState, error: fetchState.error });
|
|
138
149
|
});
|
|
@@ -34,6 +34,7 @@ export interface NotificationSettingsSelectorView extends NotificationSettings {
|
|
|
34
34
|
allUsers: User[];
|
|
35
35
|
classList: Class[];
|
|
36
36
|
managersList: Person[];
|
|
37
|
+
controllersList: User[];
|
|
37
38
|
}
|
|
38
39
|
export interface IntegrationsView {
|
|
39
40
|
externalConnections: TenantExternalConnections | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.10.
|
|
3
|
+
"version": "4.10.1",
|
|
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",
|