@zeniai/client-epic-state 4.11.77 → 4.11.79

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.
@@ -67,7 +67,7 @@ const tenant = (0, toolkit_1.createSlice)({
67
67
  (newTenant != null && action.payload.tenantUpdated)) {
68
68
  // Note: If tenant data already exists, save it if the new data is the latest one.
69
69
  // we dont want to overwrite the user related data since that has not come in the output
70
- draft.tenantsById[tenantPayload.tenant_id] = Object.assign(Object.assign({}, newTenant), { rewardsLastViewedTime: tenantInStore === null || tenantInStore === void 0 ? void 0 : tenantInStore.rewardsLastViewedTime });
70
+ draft.onboardingTenantsById[tenantPayload.tenant_id] = newTenant;
71
71
  }
72
72
  });
73
73
  },
@@ -6,6 +6,8 @@ import { Company } from '../../entity/company/companyStateTypes';
6
6
  import { CompanyHealthMetric, CompanyRunway } from '../../entity/companyHealthMetric/companyHealthMetricState';
7
7
  import { CompanyHealthMetricsLocalData, CompanyHealthViewUIState, EditCompanyHealthMetrics } from './companyHealthMetricView';
8
8
  import { ZeniAPIStatus } from '../../responsePayload';
9
+ import { Amount } from '../../commonStateTypes/amount';
10
+ import { AllowedValueWithID } from '../../commonStateTypes/allowedValue';
9
11
  export declare const ALL_FREQUENCY_LABEL_TYPE: readonly ["Low", "Very Low", "Mid", "High", "Very High"];
10
12
  export declare const toFrequencyLabelType: (v: string) => "High" | "Low" | "Very Low" | "Mid" | "Very High";
11
13
  export declare type FrequencyLabelType = ReturnType<typeof toFrequencyLabelType>;
@@ -16,7 +18,7 @@ export declare const ALL_PRODUCT_SERVICE: readonly ["reimbursement", "billpay",
16
18
  export declare const toProductServiceKeyType: (v: string) => "reimbursement" | "accounts" | "cards" | "billpay" | "zeni_tax_plan" | "cfo_plan" | "payroll_manager_service_plan";
17
19
  export declare type ProductServiceKey = ReturnType<typeof toProductServiceKeyType>;
18
20
  export declare const ALL_HEALTH_METRIC_KEYS: readonly ["finOpsEngagementFrequency", "externalProductServiceExposure", "netPromoterScore", "customerSatisfactionScore"];
19
- export declare const toHealthMetricKeyType: (v: string) => "netPromoterScore" | "customerSatisfactionScore" | "finOpsEngagementFrequency" | "externalProductServiceExposure";
21
+ export declare const toHealthMetricKeyType: (v: string) => "netPromoterScore" | "customerSatisfactionScore" | "externalProductServiceExposure" | "finOpsEngagementFrequency";
20
22
  export declare type CompanyHealthMetricsDataKey = ReturnType<typeof toHealthMetricKeyType>;
21
23
  export declare type CompanyHealthMetricDropDownOption = {
22
24
  label: FrequencyLabelType;
@@ -39,6 +41,8 @@ export interface CompanyDetailWithHealthMetric extends Company {
39
41
  companyHealthMetric: CompanyHealthMetric;
40
42
  controllers: User[];
41
43
  noOfProductVerticalsEnabled: number;
44
+ companyGroup?: AllowedValueWithID[];
45
+ monthlyRecurringRevenue?: Amount;
42
46
  }
43
47
  export interface ProductServices {
44
48
  productServiceKey: ProductServiceKey;
@@ -13,6 +13,9 @@ const companyHealthMetricSelector_1 = require("../../entity/companyHealthMetric/
13
13
  const userSelector_1 = require("../../entity/user/userSelector");
14
14
  const cockpitHelpers_1 = require("../companyView/helpers/cockpitHelpers");
15
15
  const companyHelper_1 = require("../../entity/company/companyHelper");
16
+ const companyManagementViewSelector_1 = require("../companyView/selector/companyManagementViewSelector");
17
+ const MAX_FREQUENCY_VALUE = 5;
18
+ const DEFAULT_DATE = (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z');
16
19
  exports.ALL_FREQUENCY_LABEL_TYPE = [
17
20
  'Low',
18
21
  'Very Low',
@@ -68,12 +71,13 @@ exports.companyHealthMetricDropDownOptions = [
68
71
  ];
69
72
  const getCompanyHealthMetricView = (state) => {
70
73
  const { companyViewState, companyHealthMetricViewState, companyHealthMetricState, companyState, userState, } = state;
74
+ const managementView = (0, companyManagementViewSelector_1.getCompanyManagementView)(state);
71
75
  const { companyIds, companyHealthMetricUpdateStatusById, uiState, selectedCompanyId, } = companyHealthMetricViewState;
72
76
  const { sortKey, sortOrder, filterText, filters } = uiState;
73
77
  const companies = (0, companySelector_1.getCompanyByCompanyIds)(companyState, companyIds).map((company) => company.company);
74
78
  let selectedCompanyDetail = undefined;
75
79
  const companiesHealthMetrics = (0, companyHealthMetricSelector_1.getCompanyHealthMetricByCompanyIds)(companyHealthMetricState, companyIds);
76
- let companyDetailWithHealthMetric = combineCompanyDetails(companies, companiesHealthMetrics, userState);
80
+ let companyDetailWithHealthMetric = combineCompanyDetails(companies, companiesHealthMetrics, userState, managementView);
77
81
  if (selectedCompanyId != null) {
78
82
  selectedCompanyDetail = companyDetailWithHealthMetric.find((company) => company.companyInfo.companyId === selectedCompanyId);
79
83
  }
@@ -102,11 +106,18 @@ const getCompanyHealthMetricView = (state) => {
102
106
  };
103
107
  };
104
108
  exports.getCompanyHealthMetricView = getCompanyHealthMetricView;
105
- const combineCompanyDetails = (companies, companiesHeathMetrics, userState) => {
106
- const map = new Map();
109
+ const combineCompanyDetails = (companies, companiesHeathMetrics, userState, managementView) => {
110
+ const companiesMap = new Map();
107
111
  companies.forEach((company) => {
112
+ var _a, _b;
108
113
  const controllers = (0, userSelector_1.getUsersByUserIds)(userState, company.managegmentInfo.controllerUserIds);
109
- map.set(company.companyInfo.companyId, Object.assign(Object.assign({}, company), { controllers: controllers }));
114
+ const companyDetail = managementView.companies.find((companyDetail) => companyDetail.company.company.companyInfo.companyId ===
115
+ company.companyInfo.companyId);
116
+ companiesMap.set(company.companyInfo.companyId, Object.assign(Object.assign({}, company), { controllers }));
117
+ if (companyDetail != null) {
118
+ const companyInfo = companiesMap.get(company.companyInfo.companyId);
119
+ companiesMap.set(company.companyInfo.companyId, Object.assign(Object.assign({}, companyInfo), { monthlyRecurringRevenue: (_a = companyDetail.primarySubscription) === null || _a === void 0 ? void 0 : _a.summary.summary.monthlyRecurringRevenue, companyGroup: (_b = companyDetail.company.schema.companyGroup) !== null && _b !== void 0 ? _b : [] }));
120
+ }
110
121
  });
111
122
  companiesHeathMetrics.forEach((companyHealthMetric) => {
112
123
  let noOfProductVerticalsEnabled = 0;
@@ -115,16 +126,16 @@ const combineCompanyDetails = (companies, companiesHeathMetrics, userState) => {
115
126
  noOfProductVerticalsEnabled++;
116
127
  }
117
128
  });
118
- if (map.has(companyHealthMetric.companyId)) {
119
- const company = map.get(companyHealthMetric.companyId);
120
- map.set(companyHealthMetric.companyId, Object.assign(Object.assign({}, company), { companyHealthMetric,
129
+ if (companiesMap.has(companyHealthMetric.companyId)) {
130
+ const company = companiesMap.get(companyHealthMetric.companyId);
131
+ companiesMap.set(companyHealthMetric.companyId, Object.assign(Object.assign({}, company), { companyHealthMetric,
121
132
  noOfProductVerticalsEnabled }));
122
133
  }
123
134
  else {
124
- map.set(companyHealthMetric.companyId, Object.assign(Object.assign({}, companyHealthMetric), { noOfProductVerticalsEnabled }));
135
+ companiesMap.set(companyHealthMetric.companyId, Object.assign(Object.assign({}, companyHealthMetric), { noOfProductVerticalsEnabled }));
125
136
  }
126
137
  });
127
- const companyWithCompanyHealthMetrics = Array.from(map.values());
138
+ const companyWithCompanyHealthMetrics = Array.from(companiesMap.values());
128
139
  return companyWithCompanyHealthMetrics;
129
140
  };
130
141
  const hasCompanyHealthMetricFormFieldChanged = (entityData, formData) => {
@@ -192,7 +203,7 @@ const removeDuplicatesFromCompaniesArray = (companies) => {
192
203
  });
193
204
  };
194
205
  const getCategoryValueForCompany = (key, company) => {
195
- var _a, _b, _c;
206
+ var _a, _b, _c, _d;
196
207
  const firstControllerId = (0, companyHelper_1.getFirstControllerIdFromControllers)(company.controllers);
197
208
  const customerSuccessManagerIds = (0, companyHelper_1.getFirstControllerId)(company.managegmentInfo.customerSuccessManagerUserIds);
198
209
  const runway = (0, exports.getRunwayInfinity)(company.companyHealthMetric.runway);
@@ -221,6 +232,24 @@ const getCategoryValueForCompany = (key, company) => {
221
232
  return company.companyHealthMetric.customerSatisfactionScore != null
222
233
  ? company.companyHealthMetric.customerSatisfactionScore.toString()
223
234
  : undefined;
235
+ case 'externalProductServiceExposure':
236
+ return company.companyHealthMetric.externalProductServiceExposure != null
237
+ ? company.companyHealthMetric.externalProductServiceExposure.code
238
+ : undefined;
239
+ case 'finOpsEngagementFrequency':
240
+ return company.companyHealthMetric.finOpsEngagementFrequency != null
241
+ ? company.companyHealthMetric.finOpsEngagementFrequency.code
242
+ : undefined;
243
+ case 'companyEngagementMetricsUpdatedAt':
244
+ return ((_d = company.companyHealthMetric.companyEngagementMetricsUpdatedAt) !== null && _d !== void 0 ? _d : undefined);
245
+ case 'companyGroupId':
246
+ return company.managegmentInfo.companyGroupId != null
247
+ ? company.managegmentInfo.companyGroupId.toString()
248
+ : undefined;
249
+ case 'monthlyRecurringRevenue':
250
+ return company.monthlyRecurringRevenue != null
251
+ ? company.monthlyRecurringRevenue.amount.toString()
252
+ : undefined;
224
253
  case 'churnProbabilityPercentage':
225
254
  default:
226
255
  return company.companyHealthMetric.churnProbabilityPercentage != null
@@ -268,6 +297,8 @@ const applyAdvancedFiltersOnCompaniesList = (allCompanies, filters, filteredComp
268
297
  'subscriptionStartDate',
269
298
  'subscriptionRenewalDate',
270
299
  'lastReportSent',
300
+ 'companyEngagementMetricsUpdatedAt',
301
+ 'monthlyRecurringRevenue',
271
302
  ]);
272
303
  }
273
304
  return (0, cockpitHelpers_1.filterCompanyOnCategoriesWithMultipleValues)(categoryValue, currentFilter);
@@ -390,10 +421,51 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, filters, compani
390
421
  case 'issues':
391
422
  companiesWithSortKeyValues.push(company);
392
423
  break;
424
+ case 'externalProductServiceExposure':
425
+ if (company.companyHealthMetric.externalProductServiceExposure != null) {
426
+ companiesWithSortKeyValues.push(company);
427
+ }
428
+ else {
429
+ companiesWithNoSortKeyValues.push(company);
430
+ }
431
+ break;
432
+ case 'finOpsEngagementFrequency':
433
+ if (company.companyHealthMetric.finOpsEngagementFrequency != null) {
434
+ companiesWithSortKeyValues.push(company);
435
+ }
436
+ else {
437
+ companiesWithNoSortKeyValues.push(company);
438
+ }
439
+ break;
440
+ case 'companyEngagementMetricsUpdatedAt':
441
+ if (company.companyHealthMetric.companyEngagementMetricsUpdatedAt != null) {
442
+ companiesWithSortKeyValues.push(company);
443
+ }
444
+ else {
445
+ companiesWithNoSortKeyValues.push(company);
446
+ }
447
+ break;
448
+ case 'monthlyRecurringRevenue':
449
+ if (company.monthlyRecurringRevenue != null) {
450
+ companiesWithSortKeyValues.push(company);
451
+ }
452
+ else {
453
+ companiesWithNoSortKeyValues.push(company);
454
+ }
455
+ break;
456
+ case 'group':
457
+ default:
458
+ if (company.managegmentInfo.companyGroupId != null) {
459
+ companiesWithSortKeyValues.push(company);
460
+ }
461
+ else {
462
+ companiesWithNoSortKeyValues.push(company);
463
+ }
464
+ break;
393
465
  }
394
466
  });
395
467
  const sortedCompaniesWithSortKeyValue = (0, orderBy_1.default)(companiesWithSortKeyValues, (company) => {
396
- var _a, _b, _c, _d, _e, _f, _g;
468
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
397
469
  switch (sortKey) {
398
470
  case 'productVerticals':
399
471
  return company.noOfProductVerticalsEnabled;
@@ -405,11 +477,11 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, filters, compani
405
477
  ? Infinity
406
478
  : (_b = (_a = company.companyHealthMetric.runway) === null || _a === void 0 ? void 0 : _a.runwayMonths) !== null && _b !== void 0 ? _b : 0;
407
479
  case 'lastReportSent':
408
- return ((_c = company.managegmentInfo.lastReportSentDate) !== null && _c !== void 0 ? _c : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z'));
480
+ return ((_c = company.managegmentInfo.lastReportSentDate) !== null && _c !== void 0 ? _c : DEFAULT_DATE);
409
481
  case 'renewalDate':
410
- return ((_d = company.companyHealthMetric.subscriptionRenewalDate) !== null && _d !== void 0 ? _d : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z'));
482
+ return ((_d = company.companyHealthMetric.subscriptionRenewalDate) !== null && _d !== void 0 ? _d : DEFAULT_DATE);
411
483
  case 'subscriptionDate':
412
- return ((_e = company.companyHealthMetric.subscriptionStartDate) !== null && _e !== void 0 ? _e : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z'));
484
+ return ((_e = company.companyHealthMetric.subscriptionStartDate) !== null && _e !== void 0 ? _e : DEFAULT_DATE);
413
485
  case 'netPromoterScore':
414
486
  return (_f = company.companyHealthMetric.netPromoterScore) !== null && _f !== void 0 ? _f : 0;
415
487
  case 'customerSatisfactionScore':
@@ -418,6 +490,23 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, filters, compani
418
490
  return (0, userSelector_1.getUserNameById)(userState, company.managegmentInfo.controllerUserIds[0]).toLowerCase();
419
491
  case 'customerSuccessManager':
420
492
  return (0, userSelector_1.getUserNameById)(userState, company.managegmentInfo.customerSuccessManagerUserIds[0]).toLowerCase();
493
+ case 'externalProductServiceExposure':
494
+ return company.companyHealthMetric.externalProductServiceExposure !=
495
+ null
496
+ ? getSortOrderForFrequency(company.companyHealthMetric.externalProductServiceExposure.code.toLowerCase())
497
+ : MAX_FREQUENCY_VALUE;
498
+ case 'finOpsEngagementFrequency':
499
+ return company.companyHealthMetric.finOpsEngagementFrequency != null
500
+ ? getSortOrderForFrequency(company.companyHealthMetric.finOpsEngagementFrequency.code.toLowerCase())
501
+ : MAX_FREQUENCY_VALUE;
502
+ case 'companyEngagementMetricsUpdatedAt':
503
+ return ((_h = company.companyHealthMetric.companyEngagementMetricsUpdatedAt) !== null && _h !== void 0 ? _h : DEFAULT_DATE);
504
+ case 'monthlyRecurringRevenue':
505
+ return company.monthlyRecurringRevenue != null
506
+ ? company.monthlyRecurringRevenue.amount
507
+ : 0;
508
+ case 'group':
509
+ return (_j = company.managegmentInfo.companyGroupId) === null || _j === void 0 ? void 0 : _j.toLowerCase();
421
510
  case 'companyName':
422
511
  default:
423
512
  return company.companyInfo.name;
@@ -447,3 +536,18 @@ const getRunwayInfinity = (runway) => {
447
536
  : undefined;
448
537
  };
449
538
  exports.getRunwayInfinity = getRunwayInfinity;
539
+ const getSortOrderForFrequency = (value) => {
540
+ switch (value) {
541
+ case 'low':
542
+ return 1;
543
+ case 'mid':
544
+ return 2;
545
+ case 'high':
546
+ return 3;
547
+ case 'very_high':
548
+ return 4;
549
+ case 'very_low':
550
+ default:
551
+ return 0;
552
+ }
553
+ };
@@ -6,12 +6,12 @@ import { CockpitDownloadTabsID, CockpitTabsFileType } from './cockpitTabsID';
6
6
  export declare const ALL_PORTFOLIO_SORT_KEYS: readonly ["companyName", "cashBalance", "runway", "expenses", "revenues", "netIncome"];
7
7
  export declare const ALL_MANAGEMENT_SORT_KEYS: readonly ["companyName", "task", "status", "group", "plans", "controller", "customerSuccessManager", "reviewer", "preparer", "apAnalyst", "reportSent", "taxStatus", "taxLead", "monthlyRecurringRevenue", "annualRecurringRevenue", "notes", "satisfaction", "bookCloseDate"];
8
8
  export declare const ALL_ONBOARDING_SORT_KEYS: readonly ["companyName", "bankAccountLinked", "qboLinked", "identityVerified", "businessVerified", "groupCreated", "customerCreated", "enroller", "notes", "invite"];
9
- export declare const ALL_HEALTH_SORT_KEYS: readonly ["companyName", "issues", "productVerticals", "runway", "churnProbability", "netPromoterScore", "customerSatisfactionScore", "controller", "customerSuccessManager", "lastReportSent", "subscriptionDate", "renewalDate"];
9
+ export declare const ALL_HEALTH_SORT_KEYS: readonly ["companyName", "issues", "group", "externalProductServiceExposure", "finOpsEngagementFrequency", "companyEngagementMetricsUpdatedAt", "monthlyRecurringRevenue", "productVerticals", "runway", "churnProbability", "netPromoterScore", "customerSatisfactionScore", "controller", "customerSuccessManager", "lastReportSent", "subscriptionDate", "renewalDate"];
10
10
  export declare const ALL_TASK_MANAGER_SORT_KEYS: readonly ["name", "taskName", "status", "priority", "dueDate", "assignee", "tags", "createdBy"];
11
11
  export declare const toPortfolioSortKeyType: (v: string) => "expenses" | "runway" | "cashBalance" | "netIncome" | "companyName" | "revenues";
12
12
  export declare const toManagementSortKeyType: (v: string) => "status" | "group" | "bookCloseDate" | "controller" | "preparer" | "reviewer" | "companyName" | "monthlyRecurringRevenue" | "annualRecurringRevenue" | "taxStatus" | "plans" | "notes" | "task" | "customerSuccessManager" | "apAnalyst" | "reportSent" | "taxLead" | "satisfaction";
13
13
  export declare const toOnboardingSortKeyType: (v: string) => "companyName" | "notes" | "bankAccountLinked" | "qboLinked" | "identityVerified" | "businessVerified" | "groupCreated" | "customerCreated" | "enroller" | "invite";
14
- export declare const toHealthSortKeyType: (v: string) => "runway" | "controller" | "companyName" | "customerSuccessManager" | "netPromoterScore" | "customerSatisfactionScore" | "lastReportSent" | "issues" | "productVerticals" | "churnProbability" | "subscriptionDate" | "renewalDate";
14
+ export declare const toHealthSortKeyType: (v: string) => "group" | "runway" | "controller" | "companyName" | "monthlyRecurringRevenue" | "customerSuccessManager" | "netPromoterScore" | "customerSatisfactionScore" | "lastReportSent" | "externalProductServiceExposure" | "finOpsEngagementFrequency" | "companyEngagementMetricsUpdatedAt" | "issues" | "productVerticals" | "churnProbability" | "subscriptionDate" | "renewalDate";
15
15
  export declare const toTaskManagerSortKeyType: (v: string) => "priority" | "name" | "status" | "dueDate" | "taskName" | "assignee" | "tags" | "createdBy";
16
16
  export declare type PortfolioViewSortKey = ReturnType<typeof toPortfolioSortKeyType>;
17
17
  export declare type ManagementViewSortKey = ReturnType<typeof toManagementSortKeyType>;
@@ -21,7 +21,7 @@ export declare type TaskManagerViewSortKey = ReturnType<typeof toTaskManagerSort
21
21
  export declare type ManagementViewFilterCategoryField = 'controllerUserIds' | 'customerSuccessManagerUserIds' | 'preparerUserIds' | 'reviewerUserIds' | 'apAnalystUserIds' | 'taxLeadUserIds' | 'companyGroupId' | 'taxStatusCode' | 'statusCode' | 'plans' | 'annualRecurringRevenue' | 'monthlyRecurringRevenue' | 'customerSatisfaction' | 'zeniSatisfaction';
22
22
  export declare type SubscriptionViewFilterCategoryField = 'controllerUserIds' | 'statusCode' | 'recommendedActionCode' | 'subscriptionPlans' | 'subscriptionAddOns' | 'avg2MonthExpenses' | 'slabLowerLimit' | 'slabUpperLimit' | 'monthlyRecurringRevenue';
23
23
  export declare type PortfolioViewFilterCategoryField = 'netBurnOrIncome' | 'cashPosition' | 'income' | 'expenses' | 'runway';
24
- export declare type HealthMonitorViewFilterCategoryField = 'verticalProductServices' | 'runway' | 'netPromoterScore' | 'customerSatisfactionScore' | 'churnProbabilityPercentage' | 'controller' | 'customerSuccessManager' | 'lastReportSent' | 'subscriptionStartDate' | 'subscriptionRenewalDate';
24
+ export declare type HealthMonitorViewFilterCategoryField = 'verticalProductServices' | 'runway' | 'netPromoterScore' | 'customerSatisfactionScore' | 'churnProbabilityPercentage' | 'controller' | 'customerSuccessManager' | 'lastReportSent' | 'subscriptionStartDate' | 'subscriptionRenewalDate' | 'externalProductServiceExposure' | 'finOpsEngagementFrequency' | 'companyEngagementMetricsUpdatedAt' | 'companyGroupId' | 'monthlyRecurringRevenue';
25
25
  export interface CockpitFilterCategory {
26
26
  field?: ManagementViewFilterCategoryField | SubscriptionViewFilterCategoryField | PortfolioViewFilterCategoryField | HealthMonitorViewFilterCategoryField;
27
27
  matchingOperator: 'equal' | 'not-equal';
@@ -45,6 +45,11 @@ exports.ALL_ONBOARDING_SORT_KEYS = [
45
45
  exports.ALL_HEALTH_SORT_KEYS = [
46
46
  'companyName',
47
47
  'issues',
48
+ 'group',
49
+ 'externalProductServiceExposure',
50
+ 'finOpsEngagementFrequency',
51
+ 'companyEngagementMetricsUpdatedAt',
52
+ 'monthlyRecurringRevenue',
48
53
  'productVerticals',
49
54
  'runway',
50
55
  'churnProbability',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.11.77",
3
+ "version": "4.11.79",
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",