@zeniai/client-epic-state 5.1.55-beta1ND → 5.1.55-beta2ND
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/tenant/tenantReducer.js +1 -1
- package/lib/esm/entity/tenant/tenantReducer.js +1 -1
- package/lib/esm/view/companyView/epic/companyPassport/updateCompanyProductServicesEpic.js +36 -36
- package/lib/esm/view/companyView/selector/companyManagementViewSelector.js +5 -0
- package/lib/index.d.ts +2 -2
- package/lib/view/companyView/epic/companyPassport/updateCompanyProductServicesEpic.js +36 -36
- package/lib/view/companyView/selector/companyManagementViewSelector.js +5 -0
- package/package.json +1 -1
|
@@ -188,7 +188,7 @@ const tenant = (0, toolkit_1.createSlice)({
|
|
|
188
188
|
updateTenantProductSettings(draft, action) {
|
|
189
189
|
const { tenantId, isBookkeepingEnabled, isSpendManagementEnabled } = action.payload;
|
|
190
190
|
const tenant = draft.tenantsById[tenantId];
|
|
191
|
-
if (tenant == null) {
|
|
191
|
+
if (tenant == null || tenant.productSettings == null) {
|
|
192
192
|
return;
|
|
193
193
|
}
|
|
194
194
|
if (isBookkeepingEnabled != null) {
|
|
@@ -176,7 +176,7 @@ const tenant = createSlice({
|
|
|
176
176
|
updateTenantProductSettings(draft, action) {
|
|
177
177
|
const { tenantId, isBookkeepingEnabled, isSpendManagementEnabled } = action.payload;
|
|
178
178
|
const tenant = draft.tenantsById[tenantId];
|
|
179
|
-
if (tenant == null) {
|
|
179
|
+
if (tenant == null || tenant.productSettings == null) {
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
182
|
if (isBookkeepingEnabled != null) {
|
|
@@ -8,7 +8,7 @@ import { updateCompanyProductServices, updateCompanyProductServicesFailure, upda
|
|
|
8
8
|
export const updateCompanyProductServicesEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(updateCompanyProductServices.match), switchMap((action) => {
|
|
9
9
|
const { companyId, services } = action.payload;
|
|
10
10
|
const { isBookkeepingEnabled, isBillPayEnabled, isReimbursementEnabled } = services;
|
|
11
|
-
const tenantId = Object.values(state$.value.tenantState.tenantsById).find((tenant) => tenant
|
|
11
|
+
const tenantId = Object.values(state$.value.tenantState.tenantsById).find((tenant) => tenant?.companyId === companyId)?.tenantId;
|
|
12
12
|
// Send only the service-enable fields so the backend routes this through
|
|
13
13
|
// its isolated "enable services" path. Bookkeeping is a Tenant product
|
|
14
14
|
// flag and implies spend management; bill pay / reimbursement are Company
|
|
@@ -27,44 +27,44 @@ export const updateCompanyProductServicesEpic = (actions$, state$, zeniAPI) => a
|
|
|
27
27
|
return zeniAPI
|
|
28
28
|
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, requestBody)
|
|
29
29
|
.pipe(mergeMap((response) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
if (isSuccessResponse(response)) {
|
|
31
|
+
const companies = response.data?.companies ?? [];
|
|
32
|
+
if (companies.length > 0) {
|
|
33
|
+
const actions = [
|
|
34
|
+
updateCompanies({
|
|
35
|
+
payload: companies,
|
|
36
|
+
schema: {},
|
|
37
|
+
}),
|
|
38
|
+
];
|
|
39
|
+
// The company response carries the company feature flags; the
|
|
40
|
+
// tenant product flags are not part of it, so merge them from
|
|
41
|
+
// the (now-succeeded) request values.
|
|
42
|
+
if (isBookkeepingEnabled != null && tenantId != null) {
|
|
43
|
+
actions.push(updateTenantProductSettings({
|
|
44
|
+
tenantId,
|
|
45
|
+
isBookkeepingEnabled,
|
|
46
|
+
isSpendManagementEnabled: isBookkeepingEnabled,
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
actions.push(updateCompanyProductServicesSuccess());
|
|
50
|
+
actions.push(openSnackbar({
|
|
51
|
+
messageSection: 'product_services_update',
|
|
52
|
+
messageText: 'success',
|
|
53
|
+
type: 'success',
|
|
46
54
|
}));
|
|
55
|
+
return from(actions);
|
|
47
56
|
}
|
|
48
|
-
actions.push(updateCompanyProductServicesSuccess());
|
|
49
|
-
actions.push(openSnackbar({
|
|
50
|
-
messageSection: 'product_services_update',
|
|
51
|
-
messageText: 'success',
|
|
52
|
-
type: 'success',
|
|
53
|
-
}));
|
|
54
|
-
return from(actions);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
return from([
|
|
58
|
-
updateCompanyProductServicesFailure({
|
|
59
|
-
status: response.status,
|
|
60
|
-
}),
|
|
61
|
-
openSnackbar({
|
|
62
|
-
messageSection: 'product_services_update',
|
|
63
|
-
messageText: 'failed',
|
|
64
|
-
type: 'error',
|
|
65
|
-
}),
|
|
66
|
-
]);
|
|
67
57
|
}
|
|
58
|
+
return from([
|
|
59
|
+
updateCompanyProductServicesFailure({
|
|
60
|
+
status: response.status,
|
|
61
|
+
}),
|
|
62
|
+
openSnackbar({
|
|
63
|
+
messageSection: 'product_services_update',
|
|
64
|
+
messageText: 'failed',
|
|
65
|
+
type: 'error',
|
|
66
|
+
}),
|
|
67
|
+
]);
|
|
68
68
|
}), catchError((error) => from([
|
|
69
69
|
updateCompanyProductServicesFailure({
|
|
70
70
|
status: createZeniAPIStatus('Unexpected error', 'Update Company Product Services errored out' +
|
|
@@ -428,6 +428,11 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, companies, userS
|
|
|
428
428
|
primarySortValue = (company.company.company.companyInfo.bookCloseDate ??
|
|
429
429
|
zeniDate('1970-01-01T00:00:00.000Z')).valueOf();
|
|
430
430
|
break;
|
|
431
|
+
case 'productVerticals':
|
|
432
|
+
// Not a meaningful sort axis (bookkeeping is tenant-level and not
|
|
433
|
+
// in this view); keep stable order rather than falling through to
|
|
434
|
+
// the status/group default sort.
|
|
435
|
+
break;
|
|
431
436
|
case 'status':
|
|
432
437
|
default: {
|
|
433
438
|
isMultiSortApplicable = true;
|
package/lib/index.d.ts
CHANGED
|
@@ -248,7 +248,7 @@ import { AuditSummaryData, CompanyMonthEndReportData, CompanyMonthReportTemplate
|
|
|
248
248
|
import { fetchCockpitContext, fetchCompanyTaskManagerView, fetchTaskManagerMetrics, updateCompanyTaskManagerViewFilters } from './view/companyTaskManagerView/companyTaskManagerViewReducer';
|
|
249
249
|
import { CompanyTaskManagerSelectorView, TaskWithCompanyDetail, getCompanyTaskManagerView } from './view/companyTaskManagerView/companyTaskManagerViewSelector';
|
|
250
250
|
import { CompanyTaskManagerViewUIState, TaskManagerMetrics } from './view/companyTaskManagerView/companyTaskManagerViewState';
|
|
251
|
-
import { clearCompanyView, companyManagementSaveUpdates, companyPassportClearDataInLocalStore, companyPassportSaveDataInLocalStore, deleteCompanyOfficerInLocalStore, dismissCapitalizationOnboarding, fetchAllCockpitViews, fetchCompanyManagementView, fetchCompanyPassportView, fetchCompanyPortfolioView, fetchManagementView, fetchOnboardingView, fetchParentSubsidiaryManagementView, fetchPortfolioView, fetchSubscriptionView, fetchZeniUsers, saveCompanyPassportDetails, saveIndustryAndIncDateInCompanyPassportLocalStore, updateAccountingClassesEnabled, updateCapitalizationAccountThreshold, updateCompanyDownloadState, updateCompanyManagementUIState, updateCompanyPassportLocalStoreData, updateCompanyPortfolioUIState, updateCompanyProductServices } from './view/companyView/companyViewReducer';
|
|
251
|
+
import { CompanyProductServicesInput, clearCompanyView, companyManagementSaveUpdates, companyPassportClearDataInLocalStore, companyPassportSaveDataInLocalStore, deleteCompanyOfficerInLocalStore, dismissCapitalizationOnboarding, fetchAllCockpitViews, fetchCompanyManagementView, fetchCompanyPassportView, fetchCompanyPortfolioView, fetchManagementView, fetchOnboardingView, fetchParentSubsidiaryManagementView, fetchPortfolioView, fetchSubscriptionView, fetchZeniUsers, saveCompanyPassportDetails, saveIndustryAndIncDateInCompanyPassportLocalStore, updateAccountingClassesEnabled, updateCapitalizationAccountThreshold, updateCompanyDownloadState, updateCompanyManagementUIState, updateCompanyPassportLocalStoreData, updateCompanyPortfolioUIState, updateCompanyProductServices } from './view/companyView/companyViewReducer';
|
|
252
252
|
import { FilterCategoryValueType, canSendMonthEndEmailReport, shouldEnableCalendarPickerForLastReportSent } from './view/companyView/helpers/cockpitHelpers';
|
|
253
253
|
import { getParentSubsidiaryManagementView } from './view/companyView/parentSubsidiaryView/parentSubsidiaryViewSelector';
|
|
254
254
|
import { CompanyManagementView, CompanyWithUpdateStatusView, getAddonListZeniSku, getCompanyManagementView, getPlanListZeniSku } from './view/companyView/selector/companyManagementViewSelector';
|
|
@@ -788,7 +788,7 @@ export { CockpitFilterCategory, CockpitFilters, DownloadCockpitTabOptions, Filte
|
|
|
788
788
|
export { CockpitDownloadTabsID, CockpitTabsFileType, CockpitTabsID, ALL_COCKPIT_TABS_FILE_TYPES, ALL_COCKPIT_TABS_IDS, toCockpitTabsIDStrict, toCockpitTabsFileTypeStrict, };
|
|
789
789
|
export { AllowedValueWithCode, AllowedValue, AllowedValueWithID, isAllowedValueWithCode, isAllowedValueWithID, };
|
|
790
790
|
export { ManagementUIState, PortfolioUIState };
|
|
791
|
-
export { fetchCompanyPassportView, CompanyPassportView, getCompanyPassportView, getCompanyPassportLocalStoreData, isCompanyPassportDataToBeSaved, companyPassportSaveDataInLocalStore, saveIndustryAndIncDateInCompanyPassportLocalStore, deleteCompanyOfficerInLocalStore, companyPassportClearDataInLocalStore, updateCompanyPassportLocalStoreData, saveCompanyPassportDetails, updateAccountingClassesEnabled, updateCompanyProductServices, updateCapitalizationAccountThreshold, dismissCapitalizationOnboarding, clearCompanyView, UpdateActionType, CompanyPassportLocalStoreDataView, };
|
|
791
|
+
export { fetchCompanyPassportView, CompanyPassportView, getCompanyPassportView, getCompanyPassportLocalStoreData, isCompanyPassportDataToBeSaved, companyPassportSaveDataInLocalStore, saveIndustryAndIncDateInCompanyPassportLocalStore, deleteCompanyOfficerInLocalStore, companyPassportClearDataInLocalStore, updateCompanyPassportLocalStoreData, saveCompanyPassportDetails, updateAccountingClassesEnabled, updateCompanyProductServices, CompanyProductServicesInput, updateCapitalizationAccountThreshold, dismissCapitalizationOnboarding, clearCompanyView, UpdateActionType, CompanyPassportLocalStoreDataView, };
|
|
792
792
|
export { CompanyInfoLocalData, IncInfoLocalData, TaxDetailsLocalData, CompanyDetailsLocalData, PrimaryContactLocalData, CompanyOfficerLocalData, CompanyOfficerType, CompanyPassportLocalData, toCompanyPassportLocalData, };
|
|
793
793
|
export type { CompanyOnboardingIndustryTypeCode, CompanyOnboardingSubIndustryTypeCode, CompanyPurposeOfAccountCode, CompanySourceOfFundsCode, CompanyTransactionVolumeCode, CompanyUsNexusTypeCode, };
|
|
794
794
|
export { COMPANY_ONBOARDING_INDUSTRY_TYPE_CODES, COMPANY_ONBOARDING_SUB_INDUSTRY_CODES_BY_INDUSTRY, COMPANY_PURPOSE_OF_ACCOUNT_CODES, COMPANY_SOURCE_OF_FUNDS_CODES, COMPANY_TRANSACTION_VOLUME_CODES, COMPANY_US_NEXUS_TYPE_CODES, getCompanyOnboardingSubIndustryCodesForIndustry, };
|
|
@@ -11,7 +11,7 @@ const companyViewReducer_1 = require("../../companyViewReducer");
|
|
|
11
11
|
const updateCompanyProductServicesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyViewReducer_1.updateCompanyProductServices.match), (0, operators_1.switchMap)((action) => {
|
|
12
12
|
const { companyId, services } = action.payload;
|
|
13
13
|
const { isBookkeepingEnabled, isBillPayEnabled, isReimbursementEnabled } = services;
|
|
14
|
-
const tenantId = Object.values(state$.value.tenantState.tenantsById).find((tenant) => tenant
|
|
14
|
+
const tenantId = Object.values(state$.value.tenantState.tenantsById).find((tenant) => tenant?.companyId === companyId)?.tenantId;
|
|
15
15
|
// Send only the service-enable fields so the backend routes this through
|
|
16
16
|
// its isolated "enable services" path. Bookkeeping is a Tenant product
|
|
17
17
|
// flag and implies spend management; bill pay / reimbursement are Company
|
|
@@ -30,44 +30,44 @@ const updateCompanyProductServicesEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
30
30
|
return zeniAPI
|
|
31
31
|
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, requestBody)
|
|
32
32
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
34
|
+
const companies = response.data?.companies ?? [];
|
|
35
|
+
if (companies.length > 0) {
|
|
36
|
+
const actions = [
|
|
37
|
+
(0, companyReducer_1.updateCompanies)({
|
|
38
|
+
payload: companies,
|
|
39
|
+
schema: {},
|
|
40
|
+
}),
|
|
41
|
+
];
|
|
42
|
+
// The company response carries the company feature flags; the
|
|
43
|
+
// tenant product flags are not part of it, so merge them from
|
|
44
|
+
// the (now-succeeded) request values.
|
|
45
|
+
if (isBookkeepingEnabled != null && tenantId != null) {
|
|
46
|
+
actions.push((0, tenantReducer_1.updateTenantProductSettings)({
|
|
47
|
+
tenantId,
|
|
48
|
+
isBookkeepingEnabled,
|
|
49
|
+
isSpendManagementEnabled: isBookkeepingEnabled,
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
actions.push((0, companyViewReducer_1.updateCompanyProductServicesSuccess)());
|
|
53
|
+
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
54
|
+
messageSection: 'product_services_update',
|
|
55
|
+
messageText: 'success',
|
|
56
|
+
type: 'success',
|
|
49
57
|
}));
|
|
58
|
+
return (0, rxjs_1.from)(actions);
|
|
50
59
|
}
|
|
51
|
-
actions.push((0, companyViewReducer_1.updateCompanyProductServicesSuccess)());
|
|
52
|
-
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
53
|
-
messageSection: 'product_services_update',
|
|
54
|
-
messageText: 'success',
|
|
55
|
-
type: 'success',
|
|
56
|
-
}));
|
|
57
|
-
return (0, rxjs_1.from)(actions);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
return (0, rxjs_1.from)([
|
|
61
|
-
(0, companyViewReducer_1.updateCompanyProductServicesFailure)({
|
|
62
|
-
status: response.status,
|
|
63
|
-
}),
|
|
64
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
65
|
-
messageSection: 'product_services_update',
|
|
66
|
-
messageText: 'failed',
|
|
67
|
-
type: 'error',
|
|
68
|
-
}),
|
|
69
|
-
]);
|
|
70
60
|
}
|
|
61
|
+
return (0, rxjs_1.from)([
|
|
62
|
+
(0, companyViewReducer_1.updateCompanyProductServicesFailure)({
|
|
63
|
+
status: response.status,
|
|
64
|
+
}),
|
|
65
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
66
|
+
messageSection: 'product_services_update',
|
|
67
|
+
messageText: 'failed',
|
|
68
|
+
type: 'error',
|
|
69
|
+
}),
|
|
70
|
+
]);
|
|
71
71
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
72
72
|
(0, companyViewReducer_1.updateCompanyProductServicesFailure)({
|
|
73
73
|
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Update Company Product Services errored out' +
|
|
@@ -437,6 +437,11 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, companies, userS
|
|
|
437
437
|
primarySortValue = (company.company.company.companyInfo.bookCloseDate ??
|
|
438
438
|
(0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z')).valueOf();
|
|
439
439
|
break;
|
|
440
|
+
case 'productVerticals':
|
|
441
|
+
// Not a meaningful sort axis (bookkeeping is tenant-level and not
|
|
442
|
+
// in this view); keep stable order rather than falling through to
|
|
443
|
+
// the status/group default sort.
|
|
444
|
+
break;
|
|
440
445
|
case 'status':
|
|
441
446
|
default: {
|
|
442
447
|
isMultiSortApplicable = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.55-
|
|
3
|
+
"version": "5.1.55-beta2ND",
|
|
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
|
"module": "lib/esm/index.js",
|