@zeniai/client-epic-state 4.10.15 → 4.10.16

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.
@@ -45,3 +45,4 @@ export declare const companyHealthMetricDropDownOptions: CompanyHealthMetricDrop
45
45
  export declare const getCompanyHealthMetricView: (state: RootState) => CompanyHealthMetricViewSelector;
46
46
  export declare const hasCompanyHealthMetricFormFieldChanged: (entityData?: CompanyHealthMetric | undefined, formData?: CompanyHealthMetricsLocalData | undefined) => boolean;
47
47
  export declare const isCompanyRunwayInfinite: (runway: CompanyRunway | undefined) => boolean;
48
+ export declare const getRunwayInfinity: (runway: CompanyRunway | undefined) => string | undefined;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isCompanyRunwayInfinite = exports.hasCompanyHealthMetricFormFieldChanged = exports.getCompanyHealthMetricView = exports.companyHealthMetricDropDownOptions = exports.toProductServiceKeyType = exports.ALL_PRODUCT_SERVICE = exports.toFrequencyValueType = exports.ALL_FREQUENCY_VALUE_TYPE = exports.toFrequencyLabelType = exports.ALL_FREQUENCY_LABEL_TYPE = void 0;
6
+ exports.getRunwayInfinity = exports.isCompanyRunwayInfinite = exports.hasCompanyHealthMetricFormFieldChanged = exports.getCompanyHealthMetricView = exports.companyHealthMetricDropDownOptions = exports.toProductServiceKeyType = exports.ALL_PRODUCT_SERVICE = exports.toFrequencyValueType = exports.ALL_FREQUENCY_VALUE_TYPE = exports.toFrequencyLabelType = exports.ALL_FREQUENCY_LABEL_TYPE = void 0;
7
7
  const orderBy_1 = __importDefault(require("lodash/orderBy"));
8
8
  const zeniDayJS_1 = require("../../zeniDayJS");
9
9
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
@@ -144,6 +144,7 @@ const removeDuplicatesFromCompaniesArray = (companies) => {
144
144
  const getCategoryValueForCompany = (key, company) => {
145
145
  const firstControllerId = (0, companyHelper_1.getFirstControllerIdFromControllers)(company.controllers);
146
146
  const customerSuccessManagerIds = (0, companyHelper_1.getFirstControllerId)(company.managegmentInfo.customerSuccessManagerUserIds);
147
+ const runway = (0, exports.getRunwayInfinity)(company.companyHealthMetric.runway);
147
148
  switch (key) {
148
149
  case 'controller':
149
150
  return firstControllerId;
@@ -162,10 +163,7 @@ const getCategoryValueForCompany = (key, company) => {
162
163
  ? company.companyHealthMetric.subscriptionRenewalDate
163
164
  : undefined;
164
165
  case 'runway':
165
- return company.companyHealthMetric.runway &&
166
- company.companyHealthMetric.runway.runwayMonths != null
167
- ? company.companyHealthMetric.runway.runwayMonths.toString()
168
- : undefined;
166
+ return runway != null ? runway.toString() : undefined;
169
167
  case 'verticalProductServices':
170
168
  return company.companyHealthMetric[key]
171
169
  .filter((product) => product.isEnabled)
@@ -377,3 +375,15 @@ const isCompanyRunwayInfinite = (runway) => {
377
375
  return false;
378
376
  };
379
377
  exports.isCompanyRunwayInfinite = isCompanyRunwayInfinite;
378
+ const getRunwayInfinity = (runway) => {
379
+ if ((0, exports.isCompanyRunwayInfinite)(runway) === true) {
380
+ return cockpitHelpers_1.INFINITY;
381
+ }
382
+ if (runway === undefined) {
383
+ return undefined;
384
+ }
385
+ return runway.runwayMonths != null
386
+ ? runway.runwayMonths.toString()
387
+ : undefined;
388
+ };
389
+ exports.getRunwayInfinity = getRunwayInfinity;
@@ -14,10 +14,12 @@ const saveCompanyHealthMetricByIdEpic = (actions$, _state$, zeniAPI) => actions$
14
14
  const { netPromoterScore, externalProductServiceExposure, finOpsEngagementFrequency, customerSatisfactionScore, } = companyHealthMetricData.companyHealthMetricLocalData;
15
15
  return zeniAPI
16
16
  .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/company-health-metrics/${companyId}`, {
17
- net_promoter_score: netPromoterScore,
17
+ net_promoter_score: Boolean(netPromoterScore) === true ? netPromoterScore : null,
18
18
  external_product_service_exposure: externalProductServiceExposure,
19
19
  finops_engagement_frequency: finOpsEngagementFrequency,
20
- customer_satisfaction_score: customerSatisfactionScore,
20
+ customer_satisfaction_score: Boolean(customerSatisfactionScore) === true
21
+ ? customerSatisfactionScore
22
+ : null,
21
23
  })
22
24
  .pipe((0, operators_1.mergeMap)((response) => {
23
25
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
@@ -7,6 +7,8 @@ import { SubscriptionPlan } from '../../../entity/subscription/subscriptionPlan/
7
7
  import { CompanyWithUpdateStatusView } from '../selector/companyManagementViewSelector';
8
8
  import { CockpitFilterCategory } from '../types/cockpitTypes';
9
9
  import { CompanyView } from '../types/companyView';
10
+ export declare const INFINITY = "Infinity";
11
+ export declare const MAX_RUNWAY = 1000000;
10
12
  export declare type FilterCategoryValueType = string | ZeniDate;
11
13
  export declare const filterCompanyOnCategoriesWithSingleValue: (categoryValue: FilterCategoryValueType, currentFilter: CockpitFilterCategory, rangeTypeFields: string[]) => boolean;
12
14
  export declare const filterCompanyOnCategoriesWithMultipleValues: (categoryValue: string[], currentFilter: CockpitFilterCategory) => boolean;
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractUniqueZeniSKUs = exports.shouldEnableCalendarPickerForLastReportSent = exports.canSendMonthEndEmailReport = exports.getCompanyIdTenantIdMappingFromTenantsList = exports.getCompanyIdTenantIdMapping = exports.removeDuplicatesFromCompaniesArray = exports.filterCompanyOnCategoriesWithMultipleValues = exports.filterCompanyOnCategoriesWithSingleValue = void 0;
3
+ exports.extractUniqueZeniSKUs = exports.shouldEnableCalendarPickerForLastReportSent = exports.canSendMonthEndEmailReport = exports.getCompanyIdTenantIdMappingFromTenantsList = exports.getCompanyIdTenantIdMapping = exports.removeDuplicatesFromCompaniesArray = exports.filterCompanyOnCategoriesWithMultipleValues = exports.filterCompanyOnCategoriesWithSingleValue = exports.MAX_RUNWAY = exports.INFINITY = void 0;
4
4
  const zeniDayJS_1 = require("../../../zeniDayJS");
5
+ exports.INFINITY = 'Infinity';
6
+ exports.MAX_RUNWAY = 1000000;
5
7
  const filterCompanyOnRangeCategoryType = (categoryValue, currentFilter) => {
6
8
  let doesCompanyFallInCategoryRange = false;
7
9
  if (typeof categoryValue === 'string') {
8
10
  for (const filterValue of currentFilter.values) {
9
- const revenue = parseInt(categoryValue);
11
+ const revenue = categoryValue === exports.INFINITY ? exports.MAX_RUNWAY : parseInt(categoryValue);
10
12
  const lowerValue = parseInt(filterValue.toString().split('<->')[0]);
11
13
  const higherValue = parseInt(filterValue.toString().split('<->')[1]);
12
14
  if (revenue >= lowerValue && revenue <= higherValue) {
@@ -158,8 +158,8 @@ const mapJEScheduleTransactionToPayload = (jeScheduleTransactionState, vendorSta
158
158
  };
159
159
  exports.mapJEScheduleTransactionToPayload = mapJEScheduleTransactionToPayload;
160
160
  const mapFixedAssetJEScheduleTransactionToPayload = (jeScheduleTransactionState, vendorState, scheduleDetailsLocalData, isDelete, isMarkAsComplete) => {
161
- var _a, _b, _c, _d, _e, _f;
162
- const { vendor, currencyCode, currencySymbol, baseTransaction, status, startDate, endDate, balanceAsOfToday, jeCredit, } = jeScheduleTransactionState;
161
+ var _a, _b;
162
+ const { vendor, currencyCode, currencySymbol, baseTransaction, status, startDate, endDate, balanceAsOfToday, jeScheduleId, } = jeScheduleTransactionState;
163
163
  const { selectedMonths, selectedAccount, selectedClass, selectedDayOfMonth, lastDayOfMonth, selectedAccumulatedDepreciationCategory, assetId, } = scheduleDetailsLocalData;
164
164
  let updatedStatus = Object.assign({}, status);
165
165
  // if the current status is marked as completed, we need to send the status as new when creating a new schedule.
@@ -193,13 +193,21 @@ const mapFixedAssetJEScheduleTransactionToPayload = (jeScheduleTransactionState,
193
193
  period: selectedMonths !== null && selectedMonths !== void 0 ? selectedMonths : null,
194
194
  je_schedule_type: 'fixed_assets',
195
195
  posting_date: postingDate,
196
- balance: balanceAsOfToday != null
197
- ? balanceAsOfToday.amount
198
- : baseTransaction.amount.amount,
196
+ je_schedule_id: status.code === 'marked_as_completed' ? jeScheduleId : undefined,
197
+ balance: getBalanceAmountAsOfToday({
198
+ isMarkAsComplete,
199
+ balanceAsOfToday,
200
+ baseTransaction,
201
+ }),
199
202
  start_date: (_a = startDate === null || startDate === void 0 ? void 0 : startDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT)) !== null && _a !== void 0 ? _a : firstJEScheduleDate,
200
203
  end_date: (_b = endDate === null || endDate === void 0 ? void 0 : endDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT)) !== null && _b !== void 0 ? _b : lastJEScheduleDate,
201
- je_credit_accounting_class_id: (_f = (_d = (_c = jeCredit.accountingClass) === null || _c === void 0 ? void 0 : _c.classId) !== null && _d !== void 0 ? _d : (_e = baseTransaction.classBase) === null || _e === void 0 ? void 0 : _e.classId) !== null && _f !== void 0 ? _f : null,
202
- je_credit_account_id: selectedAccumulatedDepreciationCategory !== null && selectedAccumulatedDepreciationCategory !== void 0 ? selectedAccumulatedDepreciationCategory : null,
204
+ je_credit_accounting_class_id: getJECreditAccountingClassId({
205
+ isMarkAsComplete,
206
+ jeScheduleTransactionState,
207
+ }),
208
+ je_credit_account_id: isMarkAsComplete === true
209
+ ? null
210
+ : selectedAccumulatedDepreciationCategory !== null && selectedAccumulatedDepreciationCategory !== void 0 ? selectedAccumulatedDepreciationCategory : null,
203
211
  je_debit_account_id: selectedAccount !== null && selectedAccount !== void 0 ? selectedAccount : null,
204
212
  je_debit_accounting_class_id: selectedClass !== null && selectedClass !== void 0 ? selectedClass : null,
205
213
  other_attributes: assetId != null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.10.15",
3
+ "version": "4.10.16",
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",