@zeniai/client-epic-state 4.13.66 → 4.13.68
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/entity/tenant/epic/fetchAllTenantsEpic.d.ts +1 -0
- package/lib/entity/tenant/epic/fetchAllTenantsEpic.js +4 -4
- package/lib/view/dashboard/dashboardEpic.js +2 -2
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewSelector.js +11 -0
- package/lib/view/spendManagement/zeniAccounts/paymentAccountList/paymentAccountListReducer.js +4 -3
- package/package.json +1 -1
|
@@ -10,5 +10,6 @@ import { MonthYearPeriod } from '../../../commonStateTypes/timePeriod';
|
|
|
10
10
|
import { ID } from '../../../commonStateTypes/common';
|
|
11
11
|
export declare type ActionType = ReturnType<typeof fetchAllTenants> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateTenantsSuccess> | ReturnType<typeof initializeSelectedPeriodForTenants> | ReturnType<typeof updateTenantsFailure>;
|
|
12
12
|
export declare const fetchAllTenantsEpic: (actions$: ActionsObservable<ActionType>, state: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
13
|
+
export declare const defaultMonthYearPeriod: MonthYearPeriod;
|
|
13
14
|
export declare const getDefaultSelectedPeriodsForTenants: (tenantsData: TenantsData) => Record<ID, MonthYearPeriod>;
|
|
14
15
|
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.getDefaultSelectedPeriodsForTenants = exports.fetchAllTenantsEpic = void 0;
|
|
3
|
+
exports.getMonthYearPeriodFromBookCloseDate = exports.getDefaultSelectedPeriodsForTenants = exports.defaultMonthYearPeriod = 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");
|
|
@@ -52,7 +52,7 @@ const fetchAllTenantsEpic = (actions$, state, zeniAPI) => actions$.pipe((0, oper
|
|
|
52
52
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, tenantReducer_1.updateTenantsFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Fetch All Tenants REST API call errored out' +
|
|
53
53
|
JSON.stringify(error))))))));
|
|
54
54
|
exports.fetchAllTenantsEpic = fetchAllTenantsEpic;
|
|
55
|
-
|
|
55
|
+
exports.defaultMonthYearPeriod = {
|
|
56
56
|
month: (0, timePeriod_1.toMonth)((0, zeniDayJS_1.dateNow)().get('month') + 1),
|
|
57
57
|
year: (0, zeniDayJS_1.dateNow)().get('year'),
|
|
58
58
|
};
|
|
@@ -70,7 +70,7 @@ const getDefaultSelectedPeriodsForTenants = (tenantsData) => {
|
|
|
70
70
|
};
|
|
71
71
|
return Object.assign(Object.assign({}, prev), { [currentTenant.tenant_id]: nextMonthPeriod });
|
|
72
72
|
}
|
|
73
|
-
return Object.assign(Object.assign({}, prev), { [currentTenant.tenant_id]: defaultMonthYearPeriod });
|
|
73
|
+
return Object.assign(Object.assign({}, prev), { [currentTenant.tenant_id]: exports.defaultMonthYearPeriod });
|
|
74
74
|
}, {});
|
|
75
75
|
return defaultSelectedPeriodsForTenants;
|
|
76
76
|
};
|
|
@@ -81,6 +81,6 @@ const getMonthYearPeriodFromBookCloseDate = (zeniBookCloseDate) => {
|
|
|
81
81
|
month: (0, timePeriod_1.toMonth)(zeniBookCloseDate.add(1, 'month').get('month') + 1),
|
|
82
82
|
year: zeniBookCloseDate.add(1, 'month').get('year'),
|
|
83
83
|
}
|
|
84
|
-
: defaultMonthYearPeriod;
|
|
84
|
+
: exports.defaultMonthYearPeriod;
|
|
85
85
|
};
|
|
86
86
|
exports.getMonthYearPeriodFromBookCloseDate = getMonthYearPeriodFromBookCloseDate;
|
|
@@ -35,7 +35,7 @@ const fetchDashboardEpic = (actions$, state$) => actions$.pipe((0, operators_1.f
|
|
|
35
35
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
36
36
|
const { userId, companyId, fetchFullReport, cacheOverride, excludeResources, tenantId, } = action.payload;
|
|
37
37
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state$.value);
|
|
38
|
-
const
|
|
38
|
+
const zeniBookCloseMonthAndYear = currentTenant.zeniBookCloseMonthAndYear;
|
|
39
39
|
const isReimbursementFeatureEnabled = (_a = currentTenant.company) === null || _a === void 0 ? void 0 : _a.featuresActivationInfo.isReimbursementFeatureEnabled;
|
|
40
40
|
const isAdmin = Boolean(currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.userRole) === true
|
|
41
41
|
? (0, userRoleType_1.hasAdminLevelAccess)(currentTenant.userRole)
|
|
@@ -43,7 +43,7 @@ const fetchDashboardEpic = (actions$, state$) => actions$.pipe((0, operators_1.f
|
|
|
43
43
|
const isInvestorBanker = (0, userRoleType_1.hasInvestorBankerLevelAccess)(currentTenant.userRole);
|
|
44
44
|
const arAgingDate = state$.value.arAgingState.uiState.selectedDate;
|
|
45
45
|
const apAgingDate = state$.value.apAgingState.uiState.selectedDate;
|
|
46
|
-
const monthEndChecksPeriod =
|
|
46
|
+
const monthEndChecksPeriod = zeniBookCloseMonthAndYear !== null && zeniBookCloseMonthAndYear !== void 0 ? zeniBookCloseMonthAndYear : fetchAllTenantsEpic_1.defaultMonthYearPeriod;
|
|
47
47
|
if (cacheOverride === true) {
|
|
48
48
|
const actions = [
|
|
49
49
|
(0, tenantReducer_1.fetchAllTenants)(userId),
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.getMonthEndCloseChecksViewByTenantId = exports.isMonthEndInsightDisabled = void 0;
|
|
4
7
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
8
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
5
9
|
const monthEndCloseChecksSelector_1 = require("../../entity/monthEndCloseChecks/monthEndCloseChecksSelector");
|
|
6
10
|
const timePeriod_1 = require("../../commonStateTypes/timePeriod");
|
|
7
11
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
@@ -13,6 +17,13 @@ const isMonthEndInsightDisabled = (currentTenant, selectedPeriod, userAllowedToA
|
|
|
13
17
|
userAllowedToAccessMonthEndInsights === false) {
|
|
14
18
|
return true;
|
|
15
19
|
}
|
|
20
|
+
const previousMonthPeriod = {
|
|
21
|
+
month: (0, timePeriod_1.toMonth)((0, zeniDayJS_1.dateNow)().subtract(1, 'month').month() + 1),
|
|
22
|
+
year: (0, zeniDayJS_1.dateNow)().subtract(1, 'month').year(),
|
|
23
|
+
};
|
|
24
|
+
if (!(0, isEqual_1.default)(previousMonthPeriod, selectedPeriod)) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
16
27
|
// if the selected period is November 2024, then book close date should not be null and book close date should be 30th November 2024
|
|
17
28
|
const { bookCloseDate } = currentTenant;
|
|
18
29
|
const selectedPeriodFirstDay = (0, zeniDayJS_1.date)(`${selectedPeriod.year}-${selectedPeriod.month}-01`);
|
package/lib/view/spendManagement/zeniAccounts/paymentAccountList/paymentAccountListReducer.js
CHANGED
|
@@ -83,9 +83,10 @@ const paymentAccountList = (0, toolkit_1.createSlice)({
|
|
|
83
83
|
},
|
|
84
84
|
updatePaymentAccountBalanceStatus(draft, action) {
|
|
85
85
|
const { paymentAccountId, fetchState, error } = action.payload;
|
|
86
|
-
draft.paymentAccountBalanceFetchStatus[paymentAccountId]
|
|
87
|
-
fetchState
|
|
88
|
-
|
|
86
|
+
draft.paymentAccountBalanceFetchStatus[paymentAccountId] = {
|
|
87
|
+
fetchState,
|
|
88
|
+
error,
|
|
89
|
+
};
|
|
89
90
|
},
|
|
90
91
|
clearPaymentAccountList(draft) {
|
|
91
92
|
Object.assign(draft, exports.initialState);
|
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.68",
|
|
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",
|