@zeniai/client-epic-state 4.7.87 → 4.7.88

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.
@@ -12,9 +12,9 @@ export interface CompanyRunwayPayload {
12
12
  export interface CompanyHealthMetricPayload {
13
13
  company_id: string;
14
14
  runway: CompanyRunwayPayload;
15
- customer_last_dashboard_visit_time: string;
16
15
  vertical_product_services: VerticalProductServicesPayload[];
17
16
  churn_probability_reasons: ChurnProbabilityReasonPayload[];
17
+ customer_last_dashboard_visit_time?: string | null;
18
18
  subscription_start_date?: string | null;
19
19
  subscription_renewal_date?: string | null;
20
20
  company_engagement_metrics_update_time?: string | null;
@@ -8,7 +8,9 @@ const toCompanyHealthMetrics = (payload) => {
8
8
  return {
9
9
  companyId: payload.company_id,
10
10
  runway: toCompanyRunway(payload.runway),
11
- customerLastDashboardVisit: (0, zeniDayJS_1.date)(payload.customer_last_dashboard_visit_time),
11
+ customerLastDashboardVisit: payload.customer_last_dashboard_visit_time != null
12
+ ? (0, zeniDayJS_1.date)(payload.customer_last_dashboard_visit_time)
13
+ : undefined,
12
14
  subscriptionRenewalDate: payload.subscription_renewal_date != null
13
15
  ? (0, zeniDayJS_1.date)(payload.subscription_renewal_date)
14
16
  : undefined,
@@ -19,7 +21,7 @@ const toCompanyHealthMetrics = (payload) => {
19
21
  churnProbabilityReason: (0, exports.toChurnProbabilityReason)(payload.churn_probability_reasons),
20
22
  issueCount: 0,
21
23
  companyEngagementMetricsUpdatedAt: payload.company_engagement_metrics_update_time != null
22
- ? (0, zeniDayJS_1.date)(payload.company_engagement_metrics_update_time)
24
+ ? (0, zeniDayJS_1.dateInUTC)(payload.company_engagement_metrics_update_time)
23
25
  : undefined,
24
26
  churnProbabilityPercentage: (_a = payload.churn_probability_percentage) !== null && _a !== void 0 ? _a : undefined,
25
27
  netPromoterScore: (_b = payload.net_promoter_score) !== null && _b !== void 0 ? _b : undefined,
@@ -13,10 +13,10 @@ export interface CompanyRunway {
13
13
  }
14
14
  export interface CompanyHealthMetric {
15
15
  companyId: ID;
16
- customerLastDashboardVisit: ZeniDate;
17
16
  verticalProductServices: VerticalProductServices[];
18
17
  churnProbabilityReason: ChurnProbabilityReason[];
19
18
  issueCount: number;
19
+ customerLastDashboardVisit?: ZeniDate;
20
20
  runway?: CompanyRunway;
21
21
  subscriptionRenewalDate?: ZeniDate;
22
22
  subscriptionStartDate?: ZeniDate;
@@ -10,8 +10,8 @@ exports.initialState = {
10
10
  fetchState: 'Not-Started',
11
11
  error: undefined,
12
12
  uiState: {
13
- sortKey: 'companyName',
14
- sortOrder: 'ascending',
13
+ sortKey: 'churnProbability',
14
+ sortOrder: 'descending',
15
15
  filterText: '',
16
16
  },
17
17
  hasValidState() {
@@ -152,7 +152,7 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, companies) => {
152
152
  break;
153
153
  case 'runway':
154
154
  if ((0, exports.isCompanyRunwayInfinite)(company.companyHealthMetric.runway) ||
155
- ((_a = company.companyHealthMetric.runway) === null || _a === void 0 ? void 0 : _a.runwayMonths) !== null) {
155
+ ((_a = company.companyHealthMetric.runway) === null || _a === void 0 ? void 0 : _a.runwayMonths) != null) {
156
156
  companiesWithSortKeyValues.push(company);
157
157
  }
158
158
  else
@@ -198,7 +198,7 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, companies) => {
198
198
  }
199
199
  });
200
200
  const sortedCompaniesWithSortKeyValue = (0, orderBy_1.default)(companiesWithSortKeyValues, (company) => {
201
- var _a, _b, _c, _d, _e;
201
+ var _a, _b, _c, _d, _e, _f;
202
202
  switch (sortKey) {
203
203
  case 'productVerticals':
204
204
  return company.noOfProductVerticalsEnabled;
@@ -210,15 +210,15 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, companies) => {
210
210
  return (0, exports.isCompanyRunwayInfinite)(company.companyHealthMetric.runway) ===
211
211
  true
212
212
  ? Infinity
213
- : (_a = company.companyHealthMetric.runway) !== null && _a !== void 0 ? _a : 0;
213
+ : (_b = (_a = company.companyHealthMetric.runway) === null || _a === void 0 ? void 0 : _a.runwayMonths) !== null && _b !== void 0 ? _b : 0;
214
214
  case 'lastReportSent':
215
- return ((_b = company.managegmentInfo.lastReportSentDate) !== null && _b !== void 0 ? _b : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z'));
215
+ return ((_c = company.managegmentInfo.lastReportSentDate) !== null && _c !== void 0 ? _c : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z'));
216
216
  case 'renewalDate':
217
- return ((_c = company.companyHealthMetric.subscriptionRenewalDate) !== null && _c !== void 0 ? _c : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z'));
217
+ return ((_d = company.companyHealthMetric.subscriptionRenewalDate) !== null && _d !== void 0 ? _d : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z'));
218
218
  case 'subscriptionDate':
219
- return ((_d = company.companyHealthMetric.subscriptionStartDate) !== null && _d !== void 0 ? _d : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z'));
219
+ return ((_e = company.companyHealthMetric.subscriptionStartDate) !== null && _e !== void 0 ? _e : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z'));
220
220
  case 'netPromoterScore':
221
- return (_e = company.companyHealthMetric.netPromoterScore) !== null && _e !== void 0 ? _e : 0;
221
+ return (_f = company.companyHealthMetric.netPromoterScore) !== null && _f !== void 0 ? _f : 0;
222
222
  case 'controller':
223
223
  return company.managegmentInfo.controllerUserIds.length;
224
224
  default:
@@ -229,7 +229,10 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, companies) => {
229
229
  return [...sortedCompaniesWithSortKeyValue, ...companiesWithNoSortKeyValues];
230
230
  };
231
231
  const isCompanyRunwayInfinite = (runway) => {
232
- if ((runway === null || runway === void 0 ? void 0 : runway.runwayMonths) === undefined) {
232
+ if (runway === undefined) {
233
+ return false;
234
+ }
235
+ if (runway.runwayMonths === undefined) {
233
236
  return true;
234
237
  }
235
238
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.7.87",
3
+ "version": "4.7.88",
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",