@zeniai/client-epic-state 4.7.81 → 4.7.83
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.
- package/lib/entity/companyHealthMetric/companyHealthMetricPayload.d.ts +34 -0
- package/lib/entity/companyHealthMetric/companyHealthMetricPayload.js +60 -0
- package/lib/entity/companyHealthMetric/companyHealthMetricReducer.d.ts +10 -0
- package/lib/entity/companyHealthMetric/companyHealthMetricReducer.js +33 -0
- package/lib/entity/companyHealthMetric/companyHealthMetricSelector.d.ts +4 -0
- package/lib/entity/companyHealthMetric/companyHealthMetricSelector.js +18 -0
- package/lib/entity/companyHealthMetric/companyHealthMetricState.d.ts +31 -0
- package/lib/entity/companyHealthMetric/companyHealthMetricState.js +2 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +3 -1
- package/lib/entity/tenant/clearAllEpic.js +4 -0
- package/lib/epic.d.ts +4 -1
- package/lib/epic.js +4 -1
- package/lib/index.d.ts +11 -3
- package/lib/index.js +23 -5
- package/lib/reducer.d.ts +6 -0
- package/lib/reducer.js +8 -2
- package/lib/view/companyHealthMetricView/companyHealthMetricView.d.ts +23 -0
- package/lib/view/companyHealthMetricView/companyHealthMetricView.js +2 -0
- package/lib/view/companyHealthMetricView/companyHealthMetricViewPayload.d.ts +8 -0
- package/lib/view/companyHealthMetricView/companyHealthMetricViewPayload.js +2 -0
- package/lib/view/companyHealthMetricView/companyHealthMetricViewReducer.d.ts +23 -0
- package/lib/view/companyHealthMetricView/companyHealthMetricViewReducer.js +91 -0
- package/lib/view/companyHealthMetricView/companyHealthMetricViewSelector.d.ts +41 -0
- package/lib/view/companyHealthMetricView/companyHealthMetricViewSelector.js +237 -0
- package/lib/view/companyHealthMetricView/epic/fetchCompanyHealthMetricViewEpic.d.ts +9 -0
- package/lib/view/companyHealthMetricView/epic/fetchCompanyHealthMetricViewEpic.js +41 -0
- package/lib/view/companyHealthMetricView/epic/initializeCompanyHealthMetricViewLocalData.d.ts +6 -0
- package/lib/view/companyHealthMetricView/epic/initializeCompanyHealthMetricViewLocalData.js +27 -0
- package/lib/view/companyHealthMetricView/epic/saveCompanyHealthMetricByIdEpic.d.ts +9 -0
- package/lib/view/companyHealthMetricView/epic/saveCompanyHealthMetricByIdEpic.js +49 -0
- package/lib/view/companyView/epic/fetchAllCockpitViewsEpic.d.ts +1 -1
- package/lib/view/companyView/epic/fetchAllCockpitViewsEpic.js +6 -0
- package/lib/view/companyView/types/cockpitTypes.d.ts +3 -0
- package/lib/view/companyView/types/cockpitTypes.js +15 -1
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.js +1 -0
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +2 -0
- package/package.json +3 -2
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
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;
|
|
7
|
+
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
8
|
+
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
9
|
+
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
10
|
+
const sortOrderPayload_1 = require("../../commonPayloadTypes/sortOrderPayload");
|
|
11
|
+
const companySelector_1 = require("../../entity/company/companySelector");
|
|
12
|
+
const companyHealthMetricSelector_1 = require("../../entity/companyHealthMetric/companyHealthMetricSelector");
|
|
13
|
+
const userSelector_1 = require("../../entity/user/userSelector");
|
|
14
|
+
exports.ALL_FREQUENCY_LABEL_TYPE = [
|
|
15
|
+
'Low',
|
|
16
|
+
'Very Low',
|
|
17
|
+
'Mid',
|
|
18
|
+
'High',
|
|
19
|
+
'Very High',
|
|
20
|
+
];
|
|
21
|
+
const toFrequencyLabelType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_FREQUENCY_LABEL_TYPE);
|
|
22
|
+
exports.toFrequencyLabelType = toFrequencyLabelType;
|
|
23
|
+
exports.ALL_FREQUENCY_VALUE_TYPE = [
|
|
24
|
+
'very_low',
|
|
25
|
+
'low',
|
|
26
|
+
'mid',
|
|
27
|
+
'high',
|
|
28
|
+
'very_high',
|
|
29
|
+
];
|
|
30
|
+
const toFrequencyValueType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_FREQUENCY_VALUE_TYPE);
|
|
31
|
+
exports.toFrequencyValueType = toFrequencyValueType;
|
|
32
|
+
exports.ALL_PRODUCT_SERVICE = [
|
|
33
|
+
'reimbursement',
|
|
34
|
+
'billpay',
|
|
35
|
+
'cards',
|
|
36
|
+
'accounts',
|
|
37
|
+
'zeni_tax_plan',
|
|
38
|
+
'cfo_plan',
|
|
39
|
+
'payroll_manager_service_plan',
|
|
40
|
+
];
|
|
41
|
+
const toProductServiceKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_PRODUCT_SERVICE);
|
|
42
|
+
exports.toProductServiceKeyType = toProductServiceKeyType;
|
|
43
|
+
exports.companyHealthMetricDropDownOptions = [
|
|
44
|
+
{ label: 'Very Low', value: 'very_low' },
|
|
45
|
+
{ label: 'Low', value: 'low' },
|
|
46
|
+
{ label: 'Mid', value: 'mid' },
|
|
47
|
+
{ label: 'High', value: 'high' },
|
|
48
|
+
{ label: 'Very High', value: 'very_high' },
|
|
49
|
+
];
|
|
50
|
+
const getCompanyHealthMetricView = (state) => {
|
|
51
|
+
const { companyHealthMetricViewState, companyHealthMetricState, companyState, userState, } = state;
|
|
52
|
+
const { companyIds, companyHealthMetricUpdateStatusById, uiState, selectedCompanyId, } = companyHealthMetricViewState;
|
|
53
|
+
const { sortKey, sortOrder, filterText } = uiState;
|
|
54
|
+
const companies = (0, companySelector_1.getCompanyByCompanyIds)(companyState, companyIds).map((company) => company.company);
|
|
55
|
+
let selectedCompanyDetail = undefined;
|
|
56
|
+
const companiesHealthMetrics = (0, companyHealthMetricSelector_1.getCompanyHealthMetricByCompanyIds)(companyHealthMetricState, companyIds);
|
|
57
|
+
let companyDetailWithHealthMetric = combineCompanyDetails(companies, companiesHealthMetrics, userState);
|
|
58
|
+
if (selectedCompanyId != null) {
|
|
59
|
+
selectedCompanyDetail = companyDetailWithHealthMetric.find((company) => company.companyInfo.companyId === selectedCompanyId);
|
|
60
|
+
}
|
|
61
|
+
companyDetailWithHealthMetric = sortAndFilterCompanies(sortKey, sortOrder, filterText, companyDetailWithHealthMetric);
|
|
62
|
+
return {
|
|
63
|
+
uiState: uiState,
|
|
64
|
+
version: '1.0',
|
|
65
|
+
selectedCompanyId: companyHealthMetricViewState.selectedCompanyId,
|
|
66
|
+
fetchState: companyHealthMetricViewState.fetchState,
|
|
67
|
+
error: companyHealthMetricViewState.error,
|
|
68
|
+
companies: companyDetailWithHealthMetric,
|
|
69
|
+
companyHealthMetricDropDownOptions: exports.companyHealthMetricDropDownOptions,
|
|
70
|
+
localFormDataAndStatusByCompanyId: selectedCompanyId != null
|
|
71
|
+
? companyHealthMetricUpdateStatusById[selectedCompanyId]
|
|
72
|
+
: undefined,
|
|
73
|
+
selectedCompanyDetail,
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
exports.getCompanyHealthMetricView = getCompanyHealthMetricView;
|
|
77
|
+
const combineCompanyDetails = (companies, companiesHeathMetrics, userState) => {
|
|
78
|
+
const map = new Map();
|
|
79
|
+
companies.forEach((company) => {
|
|
80
|
+
const controllers = (0, userSelector_1.getUsersByUserIds)(userState, company.managegmentInfo.controllerUserIds);
|
|
81
|
+
map.set(company.companyInfo.companyId, Object.assign(Object.assign({}, company), { controllers: controllers }));
|
|
82
|
+
});
|
|
83
|
+
companiesHeathMetrics.forEach((companyHealthMetric) => {
|
|
84
|
+
let noOfProductVerticalsEnabled = 0;
|
|
85
|
+
companyHealthMetric.verticalProductServices.forEach((product) => {
|
|
86
|
+
if (product.isEnabled) {
|
|
87
|
+
noOfProductVerticalsEnabled++;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
if (map.has(companyHealthMetric.companyId)) {
|
|
91
|
+
const company = map.get(companyHealthMetric.companyId);
|
|
92
|
+
map.set(companyHealthMetric.companyId, Object.assign(Object.assign({}, company), { companyHealthMetric,
|
|
93
|
+
noOfProductVerticalsEnabled }));
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
map.set(companyHealthMetric.companyId, Object.assign(Object.assign({}, companyHealthMetric), { noOfProductVerticalsEnabled }));
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
const companyWithCompanyHealthMetrics = Array.from(map.values());
|
|
100
|
+
return companyWithCompanyHealthMetrics;
|
|
101
|
+
};
|
|
102
|
+
const hasCompanyHealthMetricFormFieldChanged = (entityData, formData) => {
|
|
103
|
+
var _a, _b;
|
|
104
|
+
if (entityData == null || formData == null) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
if (entityData.finOpsEngagementFrequency == null ||
|
|
108
|
+
entityData.externalProductServiceExposure == null ||
|
|
109
|
+
entityData.netPromoterScore == null ||
|
|
110
|
+
((_a = entityData.finOpsEngagementFrequency) === null || _a === void 0 ? void 0 : _a.code) !==
|
|
111
|
+
formData.finOpsEngagementFrequency ||
|
|
112
|
+
((_b = entityData.externalProductServiceExposure) === null || _b === void 0 ? void 0 : _b.code) !==
|
|
113
|
+
formData.externalProductServiceExposure ||
|
|
114
|
+
entityData.netPromoterScore !== formData.netPromoterScore) {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
exports.hasCompanyHealthMetricFormFieldChanged = hasCompanyHealthMetricFormFieldChanged;
|
|
122
|
+
const sortAndFilterCompanies = (sortKey, sortOrder, filterText, companies) => {
|
|
123
|
+
const sortOrderKey = (0, sortOrderPayload_1.getSortOrder)(sortOrder);
|
|
124
|
+
let updatedCompanies = [];
|
|
125
|
+
const trimmedFilterText = filterText.trim();
|
|
126
|
+
if (trimmedFilterText) {
|
|
127
|
+
updatedCompanies = companies.filter((company) => {
|
|
128
|
+
const companyName = company.companyInfo.name.toLowerCase();
|
|
129
|
+
const companyEmailDomain = company.companyInfo.primaryEmailDomain.toLowerCase();
|
|
130
|
+
return (companyName.includes(trimmedFilterText.toLowerCase()) ||
|
|
131
|
+
companyEmailDomain.includes(trimmedFilterText.toLowerCase()));
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
updatedCompanies = [...companies];
|
|
136
|
+
}
|
|
137
|
+
const companiesWithSortKeyValues = [];
|
|
138
|
+
const companiesWithNoSortKeyValues = [];
|
|
139
|
+
updatedCompanies.forEach((company) => {
|
|
140
|
+
var _a;
|
|
141
|
+
switch (sortKey) {
|
|
142
|
+
case 'productVerticals':
|
|
143
|
+
companiesWithSortKeyValues.push(company);
|
|
144
|
+
break;
|
|
145
|
+
case 'churnProbability':
|
|
146
|
+
if (company.companyHealthMetric.churnProbabilityPercentage != null) {
|
|
147
|
+
companiesWithSortKeyValues.push(company);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
companiesWithNoSortKeyValues.push(company);
|
|
151
|
+
}
|
|
152
|
+
break;
|
|
153
|
+
case 'runway':
|
|
154
|
+
if ((0, exports.isCompanyRunwayInfinite)(company.companyHealthMetric.runway) ||
|
|
155
|
+
((_a = company.companyHealthMetric.runway) === null || _a === void 0 ? void 0 : _a.runwayMonths) !== null) {
|
|
156
|
+
companiesWithSortKeyValues.push(company);
|
|
157
|
+
}
|
|
158
|
+
else
|
|
159
|
+
companiesWithNoSortKeyValues.push(company);
|
|
160
|
+
break;
|
|
161
|
+
case 'lastReportSent':
|
|
162
|
+
if (company.managegmentInfo.lastReportSentDate != null) {
|
|
163
|
+
companiesWithSortKeyValues.push(company);
|
|
164
|
+
}
|
|
165
|
+
else
|
|
166
|
+
companiesWithNoSortKeyValues.push(company);
|
|
167
|
+
break;
|
|
168
|
+
case 'renewalDate':
|
|
169
|
+
if (company.companyHealthMetric.subscriptionRenewalDate != null) {
|
|
170
|
+
companiesWithSortKeyValues.push(company);
|
|
171
|
+
}
|
|
172
|
+
else
|
|
173
|
+
companiesWithNoSortKeyValues.push(company);
|
|
174
|
+
break;
|
|
175
|
+
case 'subscriptionDate':
|
|
176
|
+
if (company.companyHealthMetric.subscriptionStartDate != null) {
|
|
177
|
+
companiesWithSortKeyValues.push(company);
|
|
178
|
+
}
|
|
179
|
+
else
|
|
180
|
+
companiesWithNoSortKeyValues.push(company);
|
|
181
|
+
break;
|
|
182
|
+
case 'netPromoterScore':
|
|
183
|
+
if (company.companyHealthMetric.netPromoterScore != null) {
|
|
184
|
+
companiesWithSortKeyValues.push(company);
|
|
185
|
+
}
|
|
186
|
+
else
|
|
187
|
+
companiesWithNoSortKeyValues.push(company);
|
|
188
|
+
break;
|
|
189
|
+
case 'controller':
|
|
190
|
+
companiesWithSortKeyValues.push(company);
|
|
191
|
+
break;
|
|
192
|
+
case 'companyName':
|
|
193
|
+
companiesWithSortKeyValues.push(company);
|
|
194
|
+
break;
|
|
195
|
+
case 'issues':
|
|
196
|
+
companiesWithSortKeyValues.push(company);
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
const sortedCompaniesWithSortKeyValue = (0, orderBy_1.default)(companiesWithSortKeyValues, (company) => {
|
|
201
|
+
var _a, _b, _c, _d, _e;
|
|
202
|
+
switch (sortKey) {
|
|
203
|
+
case 'productVerticals':
|
|
204
|
+
return company.noOfProductVerticalsEnabled;
|
|
205
|
+
case 'issues':
|
|
206
|
+
return company.companyHealthMetric.issueCount;
|
|
207
|
+
case 'churnProbability':
|
|
208
|
+
return company.companyHealthMetric.churnProbabilityPercentage;
|
|
209
|
+
case 'runway':
|
|
210
|
+
return (0, exports.isCompanyRunwayInfinite)(company.companyHealthMetric.runway) ===
|
|
211
|
+
true
|
|
212
|
+
? Infinity
|
|
213
|
+
: (_a = company.companyHealthMetric.runway) !== null && _a !== void 0 ? _a : 0;
|
|
214
|
+
case 'lastReportSent':
|
|
215
|
+
return ((_b = company.managegmentInfo.lastReportSentDate) !== null && _b !== void 0 ? _b : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z'));
|
|
216
|
+
case 'renewalDate':
|
|
217
|
+
return ((_c = company.companyHealthMetric.subscriptionRenewalDate) !== null && _c !== void 0 ? _c : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z'));
|
|
218
|
+
case 'subscriptionDate':
|
|
219
|
+
return ((_d = company.companyHealthMetric.subscriptionStartDate) !== null && _d !== void 0 ? _d : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z'));
|
|
220
|
+
case 'netPromoterScore':
|
|
221
|
+
return (_e = company.companyHealthMetric.netPromoterScore) !== null && _e !== void 0 ? _e : 0;
|
|
222
|
+
case 'controller':
|
|
223
|
+
return company.managegmentInfo.controllerUserIds.length;
|
|
224
|
+
default:
|
|
225
|
+
case 'companyName':
|
|
226
|
+
return company.companyInfo.name;
|
|
227
|
+
}
|
|
228
|
+
}, sortOrderKey);
|
|
229
|
+
return [...sortedCompaniesWithSortKeyValue, ...companiesWithNoSortKeyValues];
|
|
230
|
+
};
|
|
231
|
+
const isCompanyRunwayInfinite = (runway) => {
|
|
232
|
+
if ((runway === null || runway === void 0 ? void 0 : runway.runwayMonths) === undefined) {
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
return false;
|
|
236
|
+
};
|
|
237
|
+
exports.isCompanyRunwayInfinite = isCompanyRunwayInfinite;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
3
|
+
import { RootState } from '../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
|
+
import { updateCompanies } from '../../../entity/company/companyReducer';
|
|
6
|
+
import { updateCompaniesHealth } from '../../../entity/companyHealthMetric/companyHealthMetricReducer';
|
|
7
|
+
import { fetchCompanyHealthMetricView, updateCompanyHealthMetricViewSuccessStatus, updateCompanyHealthMetricViewErrorStatus } from '../companyHealthMetricViewReducer';
|
|
8
|
+
export declare type ActionType = ReturnType<typeof fetchCompanyHealthMetricView> | ReturnType<typeof updateCompaniesHealth> | ReturnType<typeof updateCompanyHealthMetricViewSuccessStatus> | ReturnType<typeof updateCompanyHealthMetricViewErrorStatus> | ReturnType<typeof updateCompanies>;
|
|
9
|
+
export declare const fetchCompanyHealthMetricViewEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchCompanyHealthMetricViewEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const companyReducer_1 = require("../../../entity/company/companyReducer");
|
|
8
|
+
const companyHealthMetricReducer_1 = require("../../../entity/companyHealthMetric/companyHealthMetricReducer");
|
|
9
|
+
const companyHealthMetricViewReducer_1 = require("../companyHealthMetricViewReducer");
|
|
10
|
+
const fetchCompanyHealthMetricViewEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyHealthMetricViewReducer_1.fetchCompanyHealthMetricView.match), (0, operators_1.switchMap)(() => {
|
|
11
|
+
return zeniAPI
|
|
12
|
+
.getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels/health-monitor`)
|
|
13
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
14
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
15
|
+
const actions = [];
|
|
16
|
+
const companyIds = response.data.companies.map((company) => company.company_id);
|
|
17
|
+
actions.push((0, companyReducer_1.updateCompanies)({
|
|
18
|
+
payload: response.data.companies,
|
|
19
|
+
schema: {},
|
|
20
|
+
}));
|
|
21
|
+
actions.push((0, companyHealthMetricReducer_1.updateCompaniesHealth)({
|
|
22
|
+
payload: response.data.company_health_metrics,
|
|
23
|
+
}));
|
|
24
|
+
actions.push((0, companyHealthMetricViewReducer_1.updateCompanyHealthMetricViewSuccessStatus)({
|
|
25
|
+
companyIds: companyIds,
|
|
26
|
+
}));
|
|
27
|
+
return (0, rxjs_1.from)(actions);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return (0, rxjs_1.of)((0, companyHealthMetricViewReducer_1.updateCompanyHealthMetricViewErrorStatus)({
|
|
31
|
+
error: response.status,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
}), (0, operators_1.catchError)((error) => {
|
|
35
|
+
return (0, rxjs_1.of)((0, companyHealthMetricViewReducer_1.updateCompanyHealthMetricViewErrorStatus)({
|
|
36
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Company Health Metric View REST API call errored out' +
|
|
37
|
+
JSON.stringify(error)),
|
|
38
|
+
}));
|
|
39
|
+
}));
|
|
40
|
+
}));
|
|
41
|
+
exports.fetchCompanyHealthMetricViewEpic = fetchCompanyHealthMetricViewEpic;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
3
|
+
import { RootState } from '../../../reducer';
|
|
4
|
+
import { initializeCompanyHealthMetricViewLocalData, updateLocalStore } from '../companyHealthMetricViewReducer';
|
|
5
|
+
export declare type ActionType = ReturnType<typeof initializeCompanyHealthMetricViewLocalData> | ReturnType<typeof updateLocalStore>;
|
|
6
|
+
export declare const initializeCompanyHealthMetricViewLocalDataEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initializeCompanyHealthMetricViewLocalDataEpic = void 0;
|
|
4
|
+
const operators_1 = require("rxjs/operators");
|
|
5
|
+
const rxjs_1 = require("rxjs");
|
|
6
|
+
const companyHealthMetricViewReducer_1 = require("../companyHealthMetricViewReducer");
|
|
7
|
+
const companyHealthMetricSelector_1 = require("../../../entity/companyHealthMetric/companyHealthMetricSelector");
|
|
8
|
+
const initializeCompanyHealthMetricViewLocalDataEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(companyHealthMetricViewReducer_1.initializeCompanyHealthMetricViewLocalData.match), (0, operators_1.mergeMap)((action) => {
|
|
9
|
+
const companyHealthMetricActions = [];
|
|
10
|
+
const { companyId } = action.payload;
|
|
11
|
+
const state = state$.value;
|
|
12
|
+
const { companyHealthMetricState } = state;
|
|
13
|
+
const companyHealthMetric = (0, companyHealthMetricSelector_1.getCompanyHealthMetricByCompanyId)(companyHealthMetricState, companyId);
|
|
14
|
+
if (companyHealthMetric != null) {
|
|
15
|
+
const { netPromoterScore, finOpsEngagementFrequency, externalProductServiceExposure, } = companyHealthMetric;
|
|
16
|
+
companyHealthMetricActions.push((0, companyHealthMetricViewReducer_1.updateLocalStore)({
|
|
17
|
+
companyId,
|
|
18
|
+
updatedLocalData: {
|
|
19
|
+
netPromoterScore: netPromoterScore,
|
|
20
|
+
finOpsEngagementFrequency: finOpsEngagementFrequency === null || finOpsEngagementFrequency === void 0 ? void 0 : finOpsEngagementFrequency.code,
|
|
21
|
+
externalProductServiceExposure: externalProductServiceExposure === null || externalProductServiceExposure === void 0 ? void 0 : externalProductServiceExposure.code,
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
return (0, rxjs_1.concat)((0, rxjs_1.from)(companyHealthMetricActions));
|
|
26
|
+
}));
|
|
27
|
+
exports.initializeCompanyHealthMetricViewLocalDataEpic = initializeCompanyHealthMetricViewLocalDataEpic;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
3
|
+
import { RootState } from '../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
|
+
import { saveCompanyHealthMetricById, updateCompanyHealthMetricViewSuccessStatus, saveCompanyHealthMetricByIdFailure, initializeCompanyHealthMetricViewLocalData } from '../companyHealthMetricViewReducer';
|
|
6
|
+
import { updateCompanies } from '../../../entity/company/companyReducer';
|
|
7
|
+
import { updateCompaniesHealth } from '../../../entity/companyHealthMetric/companyHealthMetricReducer';
|
|
8
|
+
export declare type ActionType = ReturnType<typeof saveCompanyHealthMetricById> | ReturnType<typeof updateCompaniesHealth> | ReturnType<typeof updateCompanyHealthMetricViewSuccessStatus> | ReturnType<typeof saveCompanyHealthMetricByIdFailure> | ReturnType<typeof initializeCompanyHealthMetricViewLocalData> | ReturnType<typeof updateCompanies>;
|
|
9
|
+
export declare const saveCompanyHealthMetricByIdEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveCompanyHealthMetricByIdEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const companyHealthMetricViewReducer_1 = require("../companyHealthMetricViewReducer");
|
|
8
|
+
const companyReducer_1 = require("../../../entity/company/companyReducer");
|
|
9
|
+
const companyHealthMetricReducer_1 = require("../../../entity/companyHealthMetric/companyHealthMetricReducer");
|
|
10
|
+
const saveCompanyHealthMetricByIdEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyHealthMetricViewReducer_1.saveCompanyHealthMetricById.match), (0, operators_1.switchMap)((action) => {
|
|
11
|
+
const companyId = action.payload;
|
|
12
|
+
const { companyHealthMetricViewState } = _state$.value;
|
|
13
|
+
const companyHealthMetricData = companyHealthMetricViewState.companyHealthMetricUpdateStatusById[companyId];
|
|
14
|
+
const { netPromoterScore, externalProductServiceExposure, finOpsEngagementFrequency, } = companyHealthMetricData.companyHealthMetricLocalData;
|
|
15
|
+
return zeniAPI
|
|
16
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/company-health-metrics/${companyId}`, {
|
|
17
|
+
net_promoter_score: netPromoterScore,
|
|
18
|
+
external_product_service_exposure: externalProductServiceExposure,
|
|
19
|
+
finops_engagement_frequency: finOpsEngagementFrequency,
|
|
20
|
+
})
|
|
21
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
22
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
23
|
+
const actions = [];
|
|
24
|
+
actions.push((0, companyReducer_1.updateCompanies)({
|
|
25
|
+
payload: response.data.companies,
|
|
26
|
+
schema: {},
|
|
27
|
+
}));
|
|
28
|
+
actions.push((0, companyHealthMetricReducer_1.updateCompaniesHealth)({
|
|
29
|
+
payload: response.data.company_health_metrics,
|
|
30
|
+
}));
|
|
31
|
+
actions.push((0, companyHealthMetricViewReducer_1.initializeCompanyHealthMetricViewLocalData)(companyId));
|
|
32
|
+
actions.push((0, companyHealthMetricViewReducer_1.saveCompanyHealthMetricByIdSuccess)({ companyId: companyId }));
|
|
33
|
+
return (0, rxjs_1.from)(actions);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return (0, rxjs_1.of)((0, companyHealthMetricViewReducer_1.saveCompanyHealthMetricByIdFailure)({
|
|
37
|
+
companyId,
|
|
38
|
+
error: response.status,
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
}), (0, operators_1.catchError)((error) => {
|
|
42
|
+
return (0, rxjs_1.of)((0, companyHealthMetricViewReducer_1.saveCompanyHealthMetricByIdFailure)({
|
|
43
|
+
companyId,
|
|
44
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save Company Health Metric By Id REST API call errored out' +
|
|
45
|
+
JSON.stringify(error)),
|
|
46
|
+
}));
|
|
47
|
+
}));
|
|
48
|
+
}));
|
|
49
|
+
exports.saveCompanyHealthMetricByIdEpic = saveCompanyHealthMetricByIdEpic;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../reducer';
|
|
3
4
|
import { fetchCompanyManagementView, fetchZeniUsers, fetchCompanyPortfolioView } from '../companyViewReducer';
|
|
4
5
|
import { fetchSubscriptionList } from '../../subscriptionView/subscriptionViewReducer';
|
|
5
|
-
import { RootState } from '../../../reducer';
|
|
6
6
|
import { fetchCompanyOnboardingView } from '../../onboardingView/cockpitView/onboardingCockpitViewReducer';
|
|
7
7
|
import { fetchReviewCompanyView } from '../../reviewCompanyView/reviewCompanyViewReducer';
|
|
8
8
|
export declare type ActionType = ReturnType<typeof fetchZeniUsers> | ReturnType<typeof fetchCompanyManagementView> | ReturnType<typeof fetchSubscriptionList> | ReturnType<typeof fetchCompanyPortfolioView> | ReturnType<typeof fetchCompanyOnboardingView> | ReturnType<typeof fetchReviewCompanyView>;
|
|
@@ -5,6 +5,7 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const companyViewReducer_1 = require("../companyViewReducer");
|
|
7
7
|
const subscriptionViewReducer_1 = require("../../subscriptionView/subscriptionViewReducer");
|
|
8
|
+
const companyHealthMetricViewReducer_1 = require("../../companyHealthMetricView/companyHealthMetricViewReducer");
|
|
8
9
|
const onboardingCockpitViewReducer_1 = require("../../onboardingView/cockpitView/onboardingCockpitViewReducer");
|
|
9
10
|
const reviewCompanyViewReducer_1 = require("../../reviewCompanyView/reviewCompanyViewReducer");
|
|
10
11
|
const fetchAllCockpitViewsEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(companyViewReducer_1.fetchAllCockpitViews.match), (0, operators_1.switchMap)((action) => {
|
|
@@ -18,6 +19,7 @@ const fetchAllCockpitViewsEpic = (actions$, state$) => actions$.pipe((0, operato
|
|
|
18
19
|
(0, onboardingCockpitViewReducer_1.fetchCompanyOnboardingView)(),
|
|
19
20
|
(0, onboardingCockpitViewReducer_1.fetchOnboardingCompletedCompanies)(),
|
|
20
21
|
(0, reviewCompanyViewReducer_1.fetchReviewCompanyView)(),
|
|
22
|
+
(0, companyHealthMetricViewReducer_1.fetchCompanyHealthMetricView)(),
|
|
21
23
|
]);
|
|
22
24
|
}
|
|
23
25
|
else {
|
|
@@ -53,6 +55,10 @@ const fetchAllCockpitViewsEpic = (actions$, state$) => actions$.pipe((0, operato
|
|
|
53
55
|
state.reviewCompanyViewState.hasValidState() === false) {
|
|
54
56
|
fetchActions.push((0, reviewCompanyViewReducer_1.fetchReviewCompanyView)());
|
|
55
57
|
}
|
|
58
|
+
if (state.companyHealthMetricViewState.fetchState !== 'In-Progress' &&
|
|
59
|
+
state.companyHealthMetricViewState.hasValidState() === false) {
|
|
60
|
+
fetchActions.push((0, companyHealthMetricViewReducer_1.fetchCompanyHealthMetricView)());
|
|
61
|
+
}
|
|
56
62
|
return (0, rxjs_1.from)(fetchActions);
|
|
57
63
|
}
|
|
58
64
|
}));
|
|
@@ -4,12 +4,15 @@ import { CockpitDownloadTabsID, CockpitTabsFileType } from './cockpitTabsID';
|
|
|
4
4
|
export declare const ALL_PORTFOLIO_SORT_KEYS: readonly ["companyName", "cashBalance", "runway", "expenses", "revenues", "netIncome"];
|
|
5
5
|
export declare const ALL_MANAGEMENT_SORT_KEYS: readonly ["companyName", "status", "group", "plans", "controller", "reviewer", "preparer", "apAnalyst", "reportSent", "taxStatus", "taxLead", "monthlyRecurringRevenue", "annualRecurringRevenue", "notes", "satisfaction"];
|
|
6
6
|
export declare const ALL_ONBOARDING_SORT_KEYS: readonly ["companyName", "bankAccountLinked", "qboLinked", "identityVerified", "businessVerified", "groupCreated", "customerCreated", "enroller", "notes", "invite"];
|
|
7
|
+
export declare const ALL_HEALTH_SORT_KEYS: readonly ["companyName", "issues", "productVerticals", "runway", "churnProbability", "netPromoterScore", "controller", "lastReportSent", "subscriptionDate", "renewalDate"];
|
|
7
8
|
export declare const toPortfolioSortKeyType: (v: string) => "expenses" | "runway" | "cashBalance" | "netIncome" | "companyName" | "revenues";
|
|
8
9
|
export declare const toManagementSortKeyType: (v: string) => "status" | "group" | "controller" | "preparer" | "reviewer" | "companyName" | "monthlyRecurringRevenue" | "annualRecurringRevenue" | "taxStatus" | "plans" | "notes" | "apAnalyst" | "reportSent" | "taxLead" | "satisfaction";
|
|
9
10
|
export declare const toOnboardingSortKeyType: (v: string) => "companyName" | "identityVerified" | "businessVerified" | "bankAccountLinked" | "qboLinked" | "groupCreated" | "customerCreated" | "notes" | "enroller" | "invite";
|
|
11
|
+
export declare const toHealthSortKeyType: (v: string) => "runway" | "controller" | "companyName" | "issues" | "productVerticals" | "churnProbability" | "netPromoterScore" | "lastReportSent" | "subscriptionDate" | "renewalDate";
|
|
10
12
|
export declare type PortfolioViewSortKey = ReturnType<typeof toPortfolioSortKeyType>;
|
|
11
13
|
export declare type ManagementViewSortKey = ReturnType<typeof toManagementSortKeyType>;
|
|
12
14
|
export declare type OnboardingViewSortKey = ReturnType<typeof toOnboardingSortKeyType>;
|
|
15
|
+
export declare type HealthViewSortKey = ReturnType<typeof toHealthSortKeyType>;
|
|
13
16
|
export declare type ManagementViewFilterCategoryField = 'controllerUserIds' | 'preparerUserIds' | 'reviewerUserIds' | 'apAnalystUserIds' | 'taxLeadUserIds' | 'companyGroupId' | 'taxStatusCode' | 'statusCode' | 'plans' | 'annualRecurringRevenue' | 'monthlyRecurringRevenue' | 'customerSatisfaction' | 'zeniSatisfaction';
|
|
14
17
|
export declare type SubscriptionViewFilterCategoryField = 'controllerUserIds' | 'statusCode' | 'recommendedActionCode' | 'subscriptionPlans' | 'subscriptionAddOns' | 'avg2MonthExpenses' | 'slabLowerLimit' | 'slabUpperLimit' | 'monthlyRecurringRevenue';
|
|
15
18
|
export declare type PortfolioViewFilterCategoryField = 'netBurnOrIncome' | 'cashPosition' | 'income' | 'expenses' | 'runway';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toManagementStatusCodeType = exports.MANAGEMENT_STATUS_CODES = exports.toOnboardingSortKeyType = exports.toManagementSortKeyType = exports.toPortfolioSortKeyType = exports.ALL_ONBOARDING_SORT_KEYS = exports.ALL_MANAGEMENT_SORT_KEYS = exports.ALL_PORTFOLIO_SORT_KEYS = void 0;
|
|
3
|
+
exports.toManagementStatusCodeType = exports.MANAGEMENT_STATUS_CODES = exports.toHealthSortKeyType = exports.toOnboardingSortKeyType = exports.toManagementSortKeyType = exports.toPortfolioSortKeyType = exports.ALL_HEALTH_SORT_KEYS = exports.ALL_ONBOARDING_SORT_KEYS = exports.ALL_MANAGEMENT_SORT_KEYS = exports.ALL_PORTFOLIO_SORT_KEYS = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
5
|
exports.ALL_PORTFOLIO_SORT_KEYS = [
|
|
6
6
|
'companyName',
|
|
@@ -39,12 +39,26 @@ exports.ALL_ONBOARDING_SORT_KEYS = [
|
|
|
39
39
|
'notes',
|
|
40
40
|
'invite',
|
|
41
41
|
];
|
|
42
|
+
exports.ALL_HEALTH_SORT_KEYS = [
|
|
43
|
+
'companyName',
|
|
44
|
+
'issues',
|
|
45
|
+
'productVerticals',
|
|
46
|
+
'runway',
|
|
47
|
+
'churnProbability',
|
|
48
|
+
'netPromoterScore',
|
|
49
|
+
'controller',
|
|
50
|
+
'lastReportSent',
|
|
51
|
+
'subscriptionDate',
|
|
52
|
+
'renewalDate',
|
|
53
|
+
];
|
|
42
54
|
const toPortfolioSortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_PORTFOLIO_SORT_KEYS);
|
|
43
55
|
exports.toPortfolioSortKeyType = toPortfolioSortKeyType;
|
|
44
56
|
const toManagementSortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_MANAGEMENT_SORT_KEYS);
|
|
45
57
|
exports.toManagementSortKeyType = toManagementSortKeyType;
|
|
46
58
|
const toOnboardingSortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_ONBOARDING_SORT_KEYS);
|
|
47
59
|
exports.toOnboardingSortKeyType = toOnboardingSortKeyType;
|
|
60
|
+
const toHealthSortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_HEALTH_SORT_KEYS);
|
|
61
|
+
exports.toHealthSortKeyType = toHealthSortKeyType;
|
|
48
62
|
exports.MANAGEMENT_STATUS_CODES = [
|
|
49
63
|
'live',
|
|
50
64
|
'onboarding',
|
|
@@ -50,5 +50,5 @@ export interface BillPayFilterCategory {
|
|
|
50
50
|
values: (string | ZeniDate)[];
|
|
51
51
|
valuesCombinationOperator: 'ANY';
|
|
52
52
|
}
|
|
53
|
-
export declare type BillListViewFilterCategoryField = 'vendorName' | 'status' | 'invoiceDate' | 'dueDate' | 'paymentDate' | 'creationDate' | 'amount' | 'paymentMethod';
|
|
53
|
+
export declare type BillListViewFilterCategoryField = 'vendorName' | 'status' | 'invoiceDate' | 'dueDate' | 'paymentDate' | 'creationDate' | 'amount' | 'paymentMethod' | 'paymentType';
|
|
54
54
|
export declare const BILL_PAY_FILTER_CATEGORIES: BillPayFilterCategoryDropdownOption[];
|
|
@@ -57,6 +57,7 @@ exports.BILL_PAY_FILTER_CATEGORIES = [
|
|
|
57
57
|
},
|
|
58
58
|
{ value: 'paymentMethod', multiple: true, type: 'dropdown' },
|
|
59
59
|
{ value: 'status', multiple: true, type: 'dropdown' },
|
|
60
|
+
{ value: 'paymentType', type: 'dropdown' },
|
|
60
61
|
{ value: 'amount', type: 'numberRange' },
|
|
61
62
|
{ value: 'invoiceDate', type: 'dateRange', multiple: true },
|
|
62
63
|
{ value: 'dueDate', type: 'dateRange', multiple: true },
|
|
@@ -168,6 +168,8 @@ const getCategoryValueForBill = (key, bill) => {
|
|
|
168
168
|
return bill.date;
|
|
169
169
|
case 'paymentDate':
|
|
170
170
|
return bill.billPayInfo.paymentDate;
|
|
171
|
+
case 'paymentType':
|
|
172
|
+
return bill.isRecurring ? 'recurring' : 'one-time';
|
|
171
173
|
default:
|
|
172
174
|
return undefined;
|
|
173
175
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.83",
|
|
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",
|
|
@@ -79,7 +79,8 @@
|
|
|
79
79
|
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
|
80
80
|
"find-dead-code": "ts-prune | grep -v '(used in module)'",
|
|
81
81
|
"find-unused-exports": "ts-unused-exports ./tsconfig.json",
|
|
82
|
-
"build": "concurrently --kill-others-on-fail \"eslint . --ext .js,.jsx,.ts,.tsx\" \"tsc\"
|
|
82
|
+
"build": "concurrently --kill-others-on-fail \"eslint . --ext .js,.jsx,.ts,.tsx\" \"tsc\"",
|
|
83
|
+
"oldbuild": "concurrently --kill-others-on-fail \"eslint . --ext .js,.jsx,.ts,.tsx\" \"tsc\" \"jest --config jest.config.json\"",
|
|
83
84
|
"onlybuild": "concurrently --kill-others-on-fail \"eslint . --ext .js,.jsx,.ts,.tsx\" \"tsc\"",
|
|
84
85
|
"format": "prettier --write --ignore-unknown \"src/**/*\"",
|
|
85
86
|
"version": "git add -A src",
|