@zeniai/client-epic-state 4.13.68 → 4.13.70

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.
@@ -31,11 +31,24 @@ const referralReducer_1 = require("../referralView/referralReducer");
31
31
  const monthEndCloseChecksViewReducer_1 = require("../monthEndCloseChecksView/monthEndCloseChecksViewReducer");
32
32
  const timePeriod_1 = require("../../commonStateTypes/timePeriod");
33
33
  const fetchAllTenantsEpic_1 = require("../../entity/tenant/epic/fetchAllTenantsEpic");
34
+ const zeniDayJS_1 = require("../../zeniDayJS");
35
+ const getDefaultSelectedMonthAndYearForTenant = (currentTenant) => {
36
+ const { zeniBookCloseMonthAndYear } = currentTenant;
37
+ if (zeniBookCloseMonthAndYear != null) {
38
+ const currentDate = (0, zeniDayJS_1.date)(`${zeniBookCloseMonthAndYear.year}-${zeniBookCloseMonthAndYear.month}-01`);
39
+ const nextMonthDate = currentDate.add(1, 'month');
40
+ const nextMonthPeriod = {
41
+ month: (0, timePeriod_1.toMonth)(nextMonthDate.month() + 1),
42
+ year: nextMonthDate.year(),
43
+ };
44
+ return nextMonthPeriod;
45
+ }
46
+ return fetchAllTenantsEpic_1.defaultMonthYearPeriod;
47
+ };
34
48
  const fetchDashboardEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(dashboardReducer_1.fetchDashboard.match), (0, operators_1.switchMap)((action) => {
35
49
  var _a, _b, _c, _d, _e, _f, _g, _h;
36
50
  const { userId, companyId, fetchFullReport, cacheOverride, excludeResources, tenantId, } = action.payload;
37
51
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state$.value);
38
- const zeniBookCloseMonthAndYear = currentTenant.zeniBookCloseMonthAndYear;
39
52
  const isReimbursementFeatureEnabled = (_a = currentTenant.company) === null || _a === void 0 ? void 0 : _a.featuresActivationInfo.isReimbursementFeatureEnabled;
40
53
  const isAdmin = Boolean(currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.userRole) === true
41
54
  ? (0, userRoleType_1.hasAdminLevelAccess)(currentTenant.userRole)
@@ -43,7 +56,7 @@ const fetchDashboardEpic = (actions$, state$) => actions$.pipe((0, operators_1.f
43
56
  const isInvestorBanker = (0, userRoleType_1.hasInvestorBankerLevelAccess)(currentTenant.userRole);
44
57
  const arAgingDate = state$.value.arAgingState.uiState.selectedDate;
45
58
  const apAgingDate = state$.value.apAgingState.uiState.selectedDate;
46
- const monthEndChecksPeriod = zeniBookCloseMonthAndYear !== null && zeniBookCloseMonthAndYear !== void 0 ? zeniBookCloseMonthAndYear : fetchAllTenantsEpic_1.defaultMonthYearPeriod;
59
+ const monthEndChecksPeriod = getDefaultSelectedMonthAndYearForTenant(currentTenant);
47
60
  if (cacheOverride === true) {
48
61
  const actions = [
49
62
  (0, tenantReducer_1.fetchAllTenants)(userId),
@@ -234,8 +234,9 @@ const checkIfAllLineItemsAreCategoryClassFilled = (transaction, transactionDetai
234
234
  !(((_a = lineItem.account) === null || _a === void 0 ? void 0 : _a.qboId) != null &&
235
235
  [exports.EXPENSE_QBOID, exports.INCOME_QBOID].includes(lineItem.account.qboId)) &&
236
236
  (isVendorTransactionAvailable
237
- ? ((_b = transactionDetailLocalData.vendor) === null || _b === void 0 ? void 0 : _b.id) != null
238
- : ((_c = lineItem.vendor) === null || _c === void 0 ? void 0 : _c.id) != null);
237
+ ? ((_b = transactionDetailLocalData.vendor) === null || _b === void 0 ? void 0 : _b.id) != null &&
238
+ Boolean(transactionDetailLocalData.vendor.id) === true
239
+ : ((_c = lineItem.vendor) === null || _c === void 0 ? void 0 : _c.id) != null && Boolean(lineItem.vendor.id) === true);
239
240
  });
240
241
  };
241
242
  exports.checkIfAllLineItemsAreCategoryClassFilled = checkIfAllLineItemsAreCategoryClassFilled;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.13.68",
3
+ "version": "4.13.70",
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",