@zeniai/client-epic-state 4.13.44 → 4.13.45

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.
@@ -27,6 +27,7 @@ export interface MonthYearPeriod {
27
27
  }
28
28
  export declare type MonthYearPeriodId = `${Month}_${number}`;
29
29
  export declare type MonthYearPeriodQuery = `${Month}-${number}`;
30
+ export declare const toMonthYearPeriod: (periodPayload: string) => MonthYearPeriod;
30
31
  export declare const toMonthYearPeriodQuery: (selectedPeriod: MonthYearPeriod) => MonthYearPeriodQuery;
31
32
  export declare const toMonthYearPeriodId: (selectedPeriod: MonthYearPeriod) => MonthYearPeriodId;
32
33
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toString = exports.toAbsoluteDay = exports.convertToPeriod = exports.toMonthYearPeriodId = exports.toMonthYearPeriodQuery = exports.toQuarterStrict = exports.toQuarter = exports.getMonthFromMonthName = exports.toMonthStrict = exports.toMonth = exports.LAST_SCHEDULE_DAY_OF_MONTH = exports.MAX_SCHEDULE_DAY_OF_MONTH = exports.MIN_SCHEDULE_DAY_OF_MONTH = exports.toScheduleDaysOfMonth = exports.SCHEDULE_DAYS_OF_MONTH = void 0;
3
+ exports.toString = exports.toAbsoluteDay = exports.convertToPeriod = exports.toMonthYearPeriodId = exports.toMonthYearPeriodQuery = exports.toMonthYearPeriod = exports.toQuarterStrict = exports.toQuarter = exports.getMonthFromMonthName = exports.toMonthStrict = exports.toMonth = exports.LAST_SCHEDULE_DAY_OF_MONTH = exports.MAX_SCHEDULE_DAY_OF_MONTH = exports.MIN_SCHEDULE_DAY_OF_MONTH = exports.toScheduleDaysOfMonth = exports.SCHEDULE_DAYS_OF_MONTH = void 0;
4
4
  const zeniDayJS_1 = require("../zeniDayJS");
5
5
  const formatZeniDateFY_1 = require("./fiscalYearHelpers/formatZeniDateFY");
6
6
  const numberToUnion_1 = require("./numberToUnion");
@@ -38,6 +38,13 @@ const toQuarter = (n) => (0, numberToUnion_1.numberToUnion)(n, allQuarters);
38
38
  exports.toQuarter = toQuarter;
39
39
  const toQuarterStrict = (n) => (0, numberToUnion_1.numberToUnionStrict)(n, allQuarters);
40
40
  exports.toQuarterStrict = toQuarterStrict;
41
+ const toMonthYearPeriod = (periodPayload) => {
42
+ return {
43
+ month: (0, exports.toMonth)(Number(periodPayload.split('-')[0])),
44
+ year: Number(periodPayload.split('-')[1]),
45
+ };
46
+ };
47
+ exports.toMonthYearPeriod = toMonthYearPeriod;
41
48
  const toMonthYearPeriodQuery = (selectedPeriod) => {
42
49
  const { month, year } = selectedPeriod;
43
50
  return `${month}-${year}`;
@@ -58,8 +58,8 @@ const defaultMonthYearPeriod = {
58
58
  };
59
59
  const getDefaultSelectedPeriodsForTenants = (tenantsData) => {
60
60
  const defaultSelectedPeriodsForTenants = tenantsData.tenants.reduce((prev, currentTenant) => {
61
- const monthYearPeriod = currentTenant.zeni_book_close_date != null
62
- ? (0, exports.getMonthYearPeriodFromBookCloseDate)((0, zeniDayJS_1.date)(currentTenant.zeni_book_close_date))
61
+ const monthYearPeriod = currentTenant.zeni_book_close_month_and_year != null
62
+ ? (0, timePeriod_1.toMonthYearPeriod)(currentTenant.zeni_book_close_month_and_year)
63
63
  : defaultMonthYearPeriod;
64
64
  return Object.assign(Object.assign({}, prev), { [currentTenant.tenant_id]: monthYearPeriod });
65
65
  }, {});
@@ -76,6 +76,7 @@ interface TenantPayload {
76
76
  accounting_class_ids: string[];
77
77
  reimbursement_info?: UserReimbursementInfoDataPayload;
78
78
  zeni_book_close_date?: string;
79
+ zeni_book_close_month_and_year?: string;
79
80
  }
80
81
  interface LoggedInUserPayload {
81
82
  user_id: ID;
@@ -9,6 +9,7 @@ const toolkit_1 = require("@reduxjs/toolkit");
9
9
  const assignWith_1 = __importDefault(require("lodash/assignWith"));
10
10
  const js_base64_1 = require("js-base64");
11
11
  const zeniDayJS_1 = require("../../zeniDayJS");
12
+ const timePeriod_1 = require("../../commonStateTypes/timePeriod");
12
13
  const urlPayload_1 = require("../../commonPayloadTypes/urlPayload");
13
14
  const userRolePayload_1 = require("../userRole/userRolePayload");
14
15
  const subscriptionSummaryReducer_1 = require("../subscription/subscriptionSummary/subscriptionSummaryReducer");
@@ -403,6 +404,9 @@ function mapTenantPayloadToTenant(payload, userTenantPayload) {
403
404
  zeniBookCloseDate: payload.zeni_book_close_date != null
404
405
  ? (0, zeniDayJS_1.date)(payload.zeni_book_close_date)
405
406
  : undefined,
407
+ zeniBookCloseMonthAndYear: payload.zeni_book_close_month_and_year != null
408
+ ? (0, timePeriod_1.toMonthYearPeriod)(payload.zeni_book_close_month_and_year)
409
+ : undefined,
406
410
  };
407
411
  return tenant;
408
412
  }
@@ -2,6 +2,7 @@ import { ID, FetchedState, FetchState, FetchStateAndError } from '../../commonSt
2
2
  import { AccountingMethod } from '../../view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardSelectorTypes';
3
3
  import { AverageMonthsCount, TimeSpanIdForAverage } from '../../view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardState';
4
4
  import { ZeniDate } from '../../zeniDayJS';
5
+ import { MonthYearPeriod } from '../../commonStateTypes/timePeriod';
5
6
  import ZeniUrl from '../../zeniUrl';
6
7
  import { UserReimbursementInfo } from '../company/companyStateTypes';
7
8
  import { SubscriptionSummary } from '../subscription/subscriptionSummary/subscriptionSummaryState';
@@ -71,6 +72,7 @@ export interface Tenant {
71
72
  userReimbursementInfo?: UserReimbursementInfo;
72
73
  rewardsLastViewedTime?: ZeniDate;
73
74
  zeniBookCloseDate?: ZeniDate;
75
+ zeniBookCloseMonthAndYear?: MonthYearPeriod;
74
76
  }
75
77
  export interface LoggedInUser {
76
78
  userId: ID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.13.44",
3
+ "version": "4.13.45",
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",