@zeniai/client-epic-state 4.16.79 → 4.16.80

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.
@@ -3,7 +3,7 @@ export interface TimeSeriesRange {
3
3
  fromMonth: PerformanceReportKey;
4
4
  toMonth: PerformanceReportKey;
5
5
  }
6
- export declare const TIME_SERIES_DURATIONS: readonly ["YTD", "Last Month", "Last 3 Months", "Last 6 Months", "Last 12 Months", "Last Year"];
7
- export declare const toTimeSeriesDuration: (v: string) => "YTD" | "Last Month" | "Last 3 Months" | "Last 6 Months" | "Last 12 Months" | "Last Year";
6
+ export declare const TIME_SERIES_DURATIONS: readonly ["Last Month", "Last 3 Months"];
7
+ export declare const toTimeSeriesDuration: (v: string) => "Last Month" | "Last 3 Months";
8
8
  export type TimeSeriesDuration = ReturnType<typeof toTimeSeriesDuration>;
9
9
  export declare const convertToTimeSeriesSelectionRange: (selected: TimeSeriesDuration) => TimeSeriesRange;
@@ -3,14 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertToTimeSeriesSelectionRange = exports.toTimeSeriesDuration = exports.TIME_SERIES_DURATIONS = void 0;
4
4
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
5
5
  const performanceReportViewState_1 = require("./performanceReportViewState");
6
- exports.TIME_SERIES_DURATIONS = [
7
- 'YTD',
8
- 'Last Month',
9
- 'Last 3 Months',
10
- 'Last 6 Months',
11
- 'Last 12 Months',
12
- 'Last Year',
13
- ];
6
+ exports.TIME_SERIES_DURATIONS = ['Last Month', 'Last 3 Months'];
14
7
  const toTimeSeriesDuration = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.TIME_SERIES_DURATIONS);
15
8
  exports.toTimeSeriesDuration = toTimeSeriesDuration;
16
9
  const convertToTimeSeriesSelectionRange = (selected) => {
@@ -27,25 +20,13 @@ const convertToTimeSeriesSelectionRange = (selected) => {
27
20
  let from;
28
21
  let to = new Date(year, currentMonth); // default to current month
29
22
  switch (selected) {
30
- case 'YTD':
31
- from = new Date(year, 0); // Jan of current year
32
- break;
33
23
  case 'Last Month':
34
24
  from = new Date(year, currentMonth - 1);
35
25
  to = new Date(year, currentMonth - 1);
36
26
  break;
37
27
  case 'Last 3 Months':
38
- from = new Date(year, currentMonth - 2);
39
- break;
40
- case 'Last 6 Months':
41
- from = new Date(year, currentMonth - 5);
42
- break;
43
- case 'Last 12 Months':
44
- from = new Date(year, currentMonth - 11);
45
- break;
46
- case 'Last Year':
47
- from = new Date(year - 1, 0); // Jan last year
48
- to = new Date(year - 1, 11); // Dec last year
28
+ from = new Date(year, currentMonth - 3);
29
+ to = new Date(year, currentMonth - 1);
49
30
  break;
50
31
  default:
51
32
  from = new Date(year, currentMonth - 2); // fallback to Last 3 Months as default (product requirement)
@@ -6,6 +6,7 @@ exports.generateTimeSeriesKey = generateTimeSeriesKey;
6
6
  const toolkit_1 = require("@reduxjs/toolkit");
7
7
  const statusPayload_1 = require("../../commonPayloadTypes/statusPayload");
8
8
  const viewAndReportPayloadv2_1 = require("../../commonPayloadTypes/v2/viewAndReportPayloadv2");
9
+ const performanceReportViewState_1 = require("./performanceReportViewState");
9
10
  exports.initialState = {
10
11
  performanceReport: {
11
12
  '1000-01': {
@@ -199,7 +200,7 @@ function getPersonas(personas) {
199
200
  function getMonths(months) {
200
201
  return months.map((month) => {
201
202
  return {
202
- month: month.month,
203
+ month: (0, performanceReportViewState_1.toPerformanceReportKey)(month.month),
203
204
  costSaved: month.cost_saved,
204
205
  timeSavedInMinutes: month.time_saved_in_minutes,
205
206
  timeSavedInHours: convertMinutesToHours(month.time_saved_in_minutes),
@@ -39,7 +39,7 @@ export interface SavingEventType {
39
39
  timeSavedInHours: number;
40
40
  }
41
41
  export interface MonthSavingsType {
42
- month: string;
42
+ month: PerformanceReportKey;
43
43
  costSaved: number;
44
44
  timeSavedInMinutes: number;
45
45
  timeSavedInHours: number;
@@ -57,6 +57,7 @@ export interface TimeSeriesReportType extends FetchedState {
57
57
  export declare const toPerformanceReportMonthStrict: (v: string) => "10" | "11" | "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" | "12" | undefined;
58
58
  export type PerformanceReportMonth = ReturnType<typeof toPerformanceReportMonthStrict>;
59
59
  export type PerformanceReportKey = `${number}-${PerformanceReportMonth}`;
60
+ export declare function toPerformanceReportKey(value: string): PerformanceReportKey;
60
61
  export type TimeSeriesKey = `from_month_${PerformanceReportKey}_to_month_${PerformanceReportKey}`;
61
62
  export interface PerformanceReportViewState {
62
63
  performanceReport: Record<PerformanceReportKey, PerformanceReportType>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toPerformanceReportMonthStrict = void 0;
4
+ exports.toPerformanceReportKey = toPerformanceReportKey;
4
5
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
5
6
  const ALL_PERFORMANCE_REPORT_MONTHS = [
6
7
  '01',
@@ -18,3 +19,7 @@ const ALL_PERFORMANCE_REPORT_MONTHS = [
18
19
  ];
19
20
  const toPerformanceReportMonthStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, ALL_PERFORMANCE_REPORT_MONTHS);
20
21
  exports.toPerformanceReportMonthStrict = toPerformanceReportMonthStrict;
22
+ function toPerformanceReportKey(value) {
23
+ const [year, month] = value.split('-');
24
+ return `${year}-${(0, exports.toPerformanceReportMonthStrict)(month)}`;
25
+ }
@@ -1,5 +1,6 @@
1
1
  import { CurrencyPayload } from '../../commonPayloadTypes/v2/viewAndReportPayloadv2';
2
2
  import { ZeniAPIResponse } from '../../responsePayload';
3
+ import { PerformanceReportKey } from './performanceReportViewState';
3
4
  export interface SavingEventData {
4
5
  event_type: string;
5
6
  cost_saved: number;
@@ -10,7 +11,7 @@ export interface TotalsPayload {
10
11
  time_saved_in_minutes: number;
11
12
  }
12
13
  export interface TimeseriesMonthsData {
13
- month: string;
14
+ month: PerformanceReportKey;
14
15
  cost_saved: number;
15
16
  time_saved_in_minutes: number;
16
17
  event_types: SavingEventData[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.16.79",
3
+ "version": "4.16.80",
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",