@zeniai/client-epic-state 4.13.10 → 4.13.11
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.
|
@@ -4,5 +4,6 @@ import { updateTenantFailure, updateTenantSuccess, fetchActiveTenant } from '../
|
|
|
4
4
|
import { updateCompanies } from '../../company/companyReducer';
|
|
5
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
6
|
import { RootState } from '../../../reducer';
|
|
7
|
-
|
|
7
|
+
import { initializeSelectedPeriodForTenants } from '../../../view/expenseAutomationView/expenseAutomationViewReducer';
|
|
8
|
+
export declare type ActionType = ReturnType<typeof fetchActiveTenant> | ReturnType<typeof updateTenantSuccess> | ReturnType<typeof updateCompanies> | ReturnType<typeof initializeSelectedPeriodForTenants> | ReturnType<typeof updateTenantFailure>;
|
|
8
9
|
export declare const fetchActiveTenantEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -6,6 +6,8 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const tenantReducer_1 = require("../tenantReducer");
|
|
7
7
|
const companyReducer_1 = require("../../company/companyReducer");
|
|
8
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
9
|
+
const fetchAllTenantsEpic_1 = require("./fetchAllTenantsEpic");
|
|
10
|
+
const expenseAutomationViewReducer_1 = require("../../../view/expenseAutomationView/expenseAutomationViewReducer");
|
|
9
11
|
const fetchActiveTenantEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.fetchActiveTenant.match), (0, operators_1.switchMap)((action) => {
|
|
10
12
|
const { userId, tenantId, zeniSessionId } = action.payload;
|
|
11
13
|
const headers = {
|
|
@@ -19,7 +21,13 @@ const fetchActiveTenantEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operat
|
|
|
19
21
|
.getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/users/${action.payload.userId}/tenants`, headers)
|
|
20
22
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
21
23
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
22
|
-
|
|
24
|
+
const defaultSelectedPeriodsForTenants = (0, fetchAllTenantsEpic_1.getDefaultSelectedPeriodsForTenants)(response.data);
|
|
25
|
+
let actions = [
|
|
26
|
+
(0, tenantReducer_1.updateTenantSuccess)(response.data),
|
|
27
|
+
(0, expenseAutomationViewReducer_1.initializeSelectedPeriodForTenants)({
|
|
28
|
+
selectedPeriodByTenantId: defaultSelectedPeriodsForTenants,
|
|
29
|
+
}),
|
|
30
|
+
];
|
|
23
31
|
if (response.data.companies != null) {
|
|
24
32
|
actions = [
|
|
25
33
|
(0, companyReducer_1.updateCompanies)({
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
3
3
|
import { fetchAllTenants, updateTenantsSuccess, updateTenantsFailure } from '../tenantReducer';
|
|
4
|
+
import { TenantsData } from '../tenantPayload';
|
|
4
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
6
|
import { RootState } from '../../../reducer';
|
|
6
7
|
import { updateCompanies } from '../../company/companyReducer';
|
|
7
8
|
import { initializeSelectedPeriodForTenants } from '../../../view/expenseAutomationView/expenseAutomationViewReducer';
|
|
8
9
|
import { MonthYearPeriod } from '../../../commonStateTypes/timePeriod';
|
|
10
|
+
import { ID } from '../../../commonStateTypes/common';
|
|
9
11
|
export declare type ActionType = ReturnType<typeof fetchAllTenants> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateTenantsSuccess> | ReturnType<typeof initializeSelectedPeriodForTenants> | ReturnType<typeof updateTenantsFailure>;
|
|
10
12
|
export declare const fetchAllTenantsEpic: (actions$: ActionsObservable<ActionType>, state: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
13
|
+
export declare const getDefaultSelectedPeriodsForTenants: (tenantsData: TenantsData) => Record<ID, MonthYearPeriod>;
|
|
11
14
|
export declare const getMonthYearPeriodFromBookCloseDate: (zeniBookCloseDate?: import("dayjs").Dayjs | undefined) => MonthYearPeriod;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMonthYearPeriodFromBookCloseDate = exports.fetchAllTenantsEpic = void 0;
|
|
3
|
+
exports.getMonthYearPeriodFromBookCloseDate = exports.getDefaultSelectedPeriodsForTenants = exports.fetchAllTenantsEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const tenantReducer_1 = require("../tenantReducer");
|
|
@@ -16,7 +16,7 @@ const fetchAllTenantsEpic = (actions$, state, zeniAPI) => actions$.pipe((0, oper
|
|
|
16
16
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
17
|
const currentTenantId = state.value.tenantState.currentTenantId;
|
|
18
18
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
19
|
-
const defaultSelectedPeriodsForTenants = getDefaultSelectedPeriodsForTenants(response.data);
|
|
19
|
+
const defaultSelectedPeriodsForTenants = (0, exports.getDefaultSelectedPeriodsForTenants)(response.data);
|
|
20
20
|
let actions = [
|
|
21
21
|
(0, tenantReducer_1.updateTenantsSuccess)(response.data),
|
|
22
22
|
(0, expenseAutomationViewReducer_1.initializeSelectedPeriodForTenants)({
|
|
@@ -65,6 +65,7 @@ const getDefaultSelectedPeriodsForTenants = (tenantsData) => {
|
|
|
65
65
|
}, {});
|
|
66
66
|
return defaultSelectedPeriodsForTenants;
|
|
67
67
|
};
|
|
68
|
+
exports.getDefaultSelectedPeriodsForTenants = getDefaultSelectedPeriodsForTenants;
|
|
68
69
|
const getMonthYearPeriodFromBookCloseDate = (zeniBookCloseDate) => {
|
|
69
70
|
return zeniBookCloseDate != null
|
|
70
71
|
? {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.11",
|
|
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",
|