@zeniai/client-epic-state 5.1.4-beta4ND → 5.1.4-beta5ND
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.
|
@@ -25,7 +25,12 @@ const defaultNavigate = (url) => {
|
|
|
25
25
|
const initEmailConnectOAuthEpic = (actions$, _state$, zeniAPI,
|
|
26
26
|
// Test seam: callers can override to assert intended URL without actually
|
|
27
27
|
// navigating. Default is full-page redirect via window.location.
|
|
28
|
-
navigate = defaultNavigate) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.initEmailConnectOAuth.match),
|
|
28
|
+
navigate = defaultNavigate) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.initEmailConnectOAuth.match),
|
|
29
|
+
// Per-provider cancellation scope — switchMap at the outer level would
|
|
30
|
+
// cancel an in-flight gmail init when an outlook init fires, stranding
|
|
31
|
+
// the gmail provider's `saveConnectorCredentialsStateBySlug` in
|
|
32
|
+
// `In-Progress` forever. groupBy gives each provider its own stream.
|
|
33
|
+
(0, operators_1.groupBy)((action) => action.payload.provider), (0, operators_1.mergeMap)((perProvider$) => perProvider$.pipe((0, operators_1.switchMap)((action) => zeniAPI
|
|
29
34
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/connectors/email/${action.payload.provider}/init`, { redirect_after_url: action.payload.redirectAfterUrl }, { 'zeni-tenant-id': action.payload.tenantId })
|
|
30
35
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
31
36
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
@@ -50,5 +55,5 @@ navigate = defaultNavigate) => actions$.pipe((0, operators_1.filter)(tenantReduc
|
|
|
50
55
|
return (0, rxjs_1.from)([
|
|
51
56
|
(0, tenantReducer_1.initEmailConnectOAuthFailure)(action.payload.tenantId, action.payload.provider, (0, responsePayload_1.createZeniAPIStatus)(message)),
|
|
52
57
|
]);
|
|
53
|
-
}))));
|
|
58
|
+
}))))));
|
|
54
59
|
exports.initEmailConnectOAuthEpic = initEmailConnectOAuthEpic;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
2
|
+
import { catchError, filter, groupBy, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
3
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
4
4
|
import { initEmailConnectOAuth, initEmailConnectOAuthFailure, initEmailConnectOAuthSuccess, } from '../tenantReducer';
|
|
5
5
|
const defaultNavigate = (url) => {
|
|
@@ -22,7 +22,12 @@ const defaultNavigate = (url) => {
|
|
|
22
22
|
export const initEmailConnectOAuthEpic = (actions$, _state$, zeniAPI,
|
|
23
23
|
// Test seam: callers can override to assert intended URL without actually
|
|
24
24
|
// navigating. Default is full-page redirect via window.location.
|
|
25
|
-
navigate = defaultNavigate) => actions$.pipe(filter(initEmailConnectOAuth.match),
|
|
25
|
+
navigate = defaultNavigate) => actions$.pipe(filter(initEmailConnectOAuth.match),
|
|
26
|
+
// Per-provider cancellation scope — switchMap at the outer level would
|
|
27
|
+
// cancel an in-flight gmail init when an outlook init fires, stranding
|
|
28
|
+
// the gmail provider's `saveConnectorCredentialsStateBySlug` in
|
|
29
|
+
// `In-Progress` forever. groupBy gives each provider its own stream.
|
|
30
|
+
groupBy((action) => action.payload.provider), mergeMap((perProvider$) => perProvider$.pipe(switchMap((action) => zeniAPI
|
|
26
31
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/connectors/email/${action.payload.provider}/init`, { redirect_after_url: action.payload.redirectAfterUrl }, { 'zeni-tenant-id': action.payload.tenantId })
|
|
27
32
|
.pipe(mergeMap((response) => {
|
|
28
33
|
if (isSuccessResponse(response) && response.data != null) {
|
|
@@ -47,4 +52,4 @@ navigate = defaultNavigate) => actions$.pipe(filter(initEmailConnectOAuth.match)
|
|
|
47
52
|
return from([
|
|
48
53
|
initEmailConnectOAuthFailure(action.payload.tenantId, action.payload.provider, createZeniAPIStatus(message)),
|
|
49
54
|
]);
|
|
50
|
-
}))));
|
|
55
|
+
}))))));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.4-
|
|
3
|
+
"version": "5.1.4-beta5ND",
|
|
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",
|