@zeniai/client-epic-state 5.1.84-beta0ND → 5.1.84-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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { from } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { getCompanyByCompanyId } from '../../../entity/company/companySelector';
|
|
3
4
|
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
4
5
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
5
6
|
import { updateCompanyQboRealmId, updateCompanyQboRealmIdFailure, updateCompanyQboRealmIdSuccess, } from '../companyViewReducer';
|
|
@@ -8,7 +9,11 @@ export const updateCompanyQboRealmIdEpic = (actions$, state$, zeniAPI) => action
|
|
|
8
9
|
// trigger keeps its own request instead of cancelling the previous one.
|
|
9
10
|
mergeMap((action) => {
|
|
10
11
|
const { companyId, qboRealmId } = action.payload;
|
|
11
|
-
|
|
12
|
+
// Cockpit populates companyState (with a companyId->tenantId mapping) but
|
|
13
|
+
// not tenantState, so resolve from company first and fall back to tenant.
|
|
14
|
+
const tenantId = getCompanyByCompanyId(state$.value.companyState, companyId)?.company
|
|
15
|
+
.companyInfo.tenantId ??
|
|
16
|
+
Object.values(state$.value.tenantState.tenantsById).find((tenant) => tenant?.companyId === companyId)?.tenantId;
|
|
12
17
|
if (tenantId == null) {
|
|
13
18
|
return from([
|
|
14
19
|
updateCompanyQboRealmIdFailure(companyId, createZeniAPIStatus('Unexpected error', `No tenant found for companyId: ${companyId}`)),
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateCompanyQboRealmIdEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const companySelector_1 = require("../../../entity/company/companySelector");
|
|
6
7
|
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
7
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
9
|
const companyViewReducer_1 = require("../companyViewReducer");
|
|
@@ -11,7 +12,11 @@ const updateCompanyQboRealmIdEpic = (actions$, state$, zeniAPI) => actions$.pipe
|
|
|
11
12
|
// trigger keeps its own request instead of cancelling the previous one.
|
|
12
13
|
(0, operators_1.mergeMap)((action) => {
|
|
13
14
|
const { companyId, qboRealmId } = action.payload;
|
|
14
|
-
|
|
15
|
+
// Cockpit populates companyState (with a companyId->tenantId mapping) but
|
|
16
|
+
// not tenantState, so resolve from company first and fall back to tenant.
|
|
17
|
+
const tenantId = (0, companySelector_1.getCompanyByCompanyId)(state$.value.companyState, companyId)?.company
|
|
18
|
+
.companyInfo.tenantId ??
|
|
19
|
+
Object.values(state$.value.tenantState.tenantsById).find((tenant) => tenant?.companyId === companyId)?.tenantId;
|
|
15
20
|
if (tenantId == null) {
|
|
16
21
|
return (0, rxjs_1.from)([
|
|
17
22
|
(0, companyViewReducer_1.updateCompanyQboRealmIdFailure)(companyId, (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', `No tenant found for companyId: ${companyId}`)),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.84-
|
|
3
|
+
"version": "5.1.84-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",
|