@zeniai/client-epic-state 4.11.6 → 4.11.7

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.
@@ -339,6 +339,7 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, companies, userS
339
339
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
340
340
  let primarySortValue;
341
341
  let secondarySortValue;
342
+ let isSecondarySortApplicable;
342
343
  const managegmentInfo = company.company.company.managegmentInfo;
343
344
  switch (sortKey) {
344
345
  case 'companyName':
@@ -390,25 +391,27 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, companies, userS
390
391
  primarySortValue = (_m = managegmentInfo.note) === null || _m === void 0 ? void 0 : _m.length;
391
392
  break;
392
393
  case 'satisfaction':
393
- primarySortValue =
394
- (((_o = managegmentInfo.customerSatisfaction) === null || _o === void 0 ? void 0 : _o.teamRating) != null
394
+ isSecondarySortApplicable = true;
395
+ primarySortValue = (((_o = managegmentInfo.customerSatisfaction) === null || _o === void 0 ? void 0 : _o.customerRating) != null
396
+ ? customerSatisfactionState_1.customerRatingValues[managegmentInfo.customerSatisfaction.customerRating]
397
+ : 0);
398
+ secondarySortValue =
399
+ (((_p = managegmentInfo.customerSatisfaction) === null || _p === void 0 ? void 0 : _p.teamRating) != null
395
400
  ? customerSatisfactionState_1.teamRatingValues[managegmentInfo.customerSatisfaction.teamRating]
396
- : 0) +
397
- (((_p = managegmentInfo.customerSatisfaction) === null || _p === void 0 ? void 0 : _p.customerRating) != null
398
- ? customerSatisfactionState_1.customerRatingValues[managegmentInfo.customerSatisfaction.customerRating]
399
- : 0);
401
+ : 0);
400
402
  break;
401
403
  case 'bookCloseDate':
402
404
  primarySortValue = ((_q = company.company.company.companyInfo.bookCloseDate) !== null && _q !== void 0 ? _q : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z')).valueOf();
403
405
  break;
404
406
  case 'status':
405
407
  default:
408
+ isSecondarySortApplicable = true;
406
409
  primarySortValue = cockpitTypes_1.MANAGEMENT_STATUS_CODES.indexOf((_r = managegmentInfo.statusCode) === null || _r === void 0 ? void 0 : _r.toLowerCase());
407
410
  secondarySortValue = (_s = managegmentInfo.companyGroupId) === null || _s === void 0 ? void 0 : _s.toLowerCase();
408
411
  }
409
- return [primarySortValue, secondarySortValue];
412
+ return isSecondarySortApplicable ? [primarySortValue, secondarySortValue] : primarySortValue;
410
413
  },
411
- ], sortOrder === 'ascending' ? ['asc', 'asc'] : ['desc', 'asc']);
414
+ ], sortOrder === 'ascending' ? ['asc', 'asc'] : ['desc', 'desc']);
412
415
  return [...sortedCompaniesWithSortKeyValue, ...companiesWithNoSortKeyValue];
413
416
  };
414
417
  const getTotalRecurringRevenue = (companies) => companies.reduce((prev, curr) => {
@@ -157,12 +157,7 @@ const getCompanyPortfolioOnSortAndFitler = (sortKey, sortOrder, filterText, filt
157
157
  updatedCompanies = [...companies];
158
158
  }
159
159
  updatedCompanies = applyAdvancedFiltersOnCompaniesList(updatedCompanies, filters);
160
- if (sortOrder === 'ascending') {
161
- portfolioSortOrder = sortKey === 'runway' ? 'desc' : 'asc';
162
- }
163
- else {
164
- portfolioSortOrder = sortKey === 'runway' ? 'asc' : 'desc';
165
- }
160
+ portfolioSortOrder = sortOrder === 'ascending' ? 'asc' : 'desc';
166
161
  const companiesWithSortKeyValue = [];
167
162
  const companiesWithNoSortKeyValue = [];
168
163
  updatedCompanies.forEach((company) => {
@@ -39,25 +39,38 @@ exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) =>
39
39
  const sortedCompanies = (0, orderBy_1.default)(companies, (company) => {
40
40
  var _a;
41
41
  const warningCount = (0, exports.getAuditWarningsCount)(company);
42
+ let primarySortValue;
43
+ let secondarySortValue;
44
+ let isSecondarySortApplicable;
42
45
  switch (sortKey) {
43
46
  case 'notes':
44
- return (_a = company.note) === null || _a === void 0 ? void 0 : _a.toLowerCase();
47
+ primarySortValue = (_a = company.note) === null || _a === void 0 ? void 0 : _a.toLowerCase();
48
+ break;
45
49
  case 'uncategorized':
46
- return ((company.uncategorizedTransactions.income ? 1 : 0) +
50
+ primarySortValue = ((company.uncategorizedTransactions.income ? 1 : 0) +
47
51
  (company.uncategorizedTransactions.expense ? 1 : 0));
52
+ break;
48
53
  case 'miscategorized':
49
- return ((company.miscategorizedTransactions.income ? 1 : 0) +
54
+ primarySortValue = ((company.miscategorizedTransactions.income ? 1 : 0) +
50
55
  (company.miscategorizedTransactions.expense ? 1 : 0));
56
+ break;
51
57
  case 'warnings':
52
- return warningCount;
58
+ primarySortValue = warningCount;
59
+ break;
53
60
  case 'auditScore':
54
- return company.auditSummary.fixesRequired;
61
+ isSecondarySortApplicable = true;
62
+ primarySortValue = company.auditSummary.auditScorePercentage;
63
+ secondarySortValue = company.auditSummary.fixesRequired;
64
+ break;
55
65
  case 'reviewVendor':
56
- return company.isVendorReviewReqiured;
66
+ primarySortValue = company.isVendorReviewReqiured;
67
+ break;
57
68
  case 'companyName':
58
69
  default:
59
- return company.name.toLowerCase();
70
+ primarySortValue = company.name.toLowerCase();
71
+ break;
60
72
  }
73
+ return isSecondarySortApplicable ? [primarySortValue, secondarySortValue] : primarySortValue;
61
74
  }, sortOrder === 'ascending' ? 'asc' : 'desc');
62
75
  return {
63
76
  companies: sortedCompanies,
@@ -370,6 +370,7 @@ const getSubscriptionListOnSortAndFitler = (sortKey, sortOrder, filterText, filt
370
370
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
371
371
  let primarySortValue;
372
372
  let secondarySortValue;
373
+ let isSecondarySortApplicable;
373
374
  const subscription = (_a = company.primarySubscription) === null || _a === void 0 ? void 0 : _a.subscription;
374
375
  const summary = (_b = company.primarySubscription) === null || _b === void 0 ? void 0 : _b.summary;
375
376
  switch (sortKey) {
@@ -418,11 +419,12 @@ const getSubscriptionListOnSortAndFitler = (sortKey, sortOrder, filterText, filt
418
419
  break;
419
420
  case 'status':
420
421
  default:
422
+ isSecondarySortApplicable = true;
421
423
  primarySortValue = subscriptionTypes_1.SUBSCRIPTION_STATUS_CODES.indexOf((_u = (_t = subscription === null || subscription === void 0 ? void 0 : subscription.subscription) === null || _t === void 0 ? void 0 : _t.subscription.status.code) === null || _u === void 0 ? void 0 : _u.toLowerCase());
422
424
  secondarySortValue =
423
425
  (_v = summary === null || summary === void 0 ? void 0 : summary.summary.recommendedActionCode.toLowerCase()) !== null && _v !== void 0 ? _v : '';
424
426
  }
425
- return [primarySortValue, secondarySortValue];
427
+ return isSecondarySortApplicable ? [primarySortValue, secondarySortValue] : primarySortValue;
426
428
  },
427
429
  ], subscriptionSortOrder === 'asc' ? ['asc', 'asc'] : ['desc', 'asc']);
428
430
  return [...sortedCompaniesWithSortKeyValue, ...companiesWithNoSortKeyValue];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.11.6",
3
+ "version": "4.11.7",
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",