@zeniai/client-epic-state 5.0.34-betaRD1 → 5.0.34-betaRR1

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,5 @@
1
1
  import { from, of } from 'rxjs';
2
- import { catchError, concatMap, exhaustMap, filter, mergeMap, } from 'rxjs/operators';
2
+ import { catchError, concatMap, filter, mergeMap, switchMap, } from 'rxjs/operators';
3
3
  import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
4
4
  import { createZeniAPIStatus } from '../../../responsePayload';
5
5
  import { approveOAuthConsent, approveOAuthConsentFailure, approveOAuthConsentSuccess, } from '../zeniOAuthReducer';
@@ -9,11 +9,10 @@ const failureSnackbar = (reason) => openSnackbar({
9
9
  type: 'error',
10
10
  variables: [{ variableName: '__reason__', variableValue: reason }],
11
11
  });
12
- export const approveOAuthConsentEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(approveOAuthConsent.match),
13
- // `approveOAuthConsent` reducer sets fetchState to In-Progress before epics
14
- // run, so a guard on In-Progress would block every legitimate request.
15
- // exhaustMap drops duplicate approve clicks while the HTTP call is in flight.
16
- exhaustMap((action) => {
12
+ export const approveOAuthConsentEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(approveOAuthConsent.match), switchMap((action) => {
13
+ if (state$.value.zeniOAuthViewState.fetchState === 'In-Progress') {
14
+ return from([]);
15
+ }
17
16
  const { userId, zeniSessionId, tenantId, clientId, redirectUri, codeChallenge, codeChallengeMethod, state, responseType, } = action.payload;
18
17
  const authHeaders = {
19
18
  'zeni-user-id': userId,
@@ -4,7 +4,7 @@ import { RootState } from '../../../reducer';
4
4
  import { ZeniAPI } from '../../../zeniAPI';
5
5
  import { approveOAuthConsent, approveOAuthConsentFailure, approveOAuthConsentSuccess } from '../zeniOAuthReducer';
6
6
  export type ActionType = ReturnType<typeof approveOAuthConsent> | ReturnType<typeof approveOAuthConsentSuccess> | ReturnType<typeof approveOAuthConsentFailure> | ReturnType<typeof openSnackbar>;
7
- export declare const approveOAuthConsentEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
+ export declare const approveOAuthConsentEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
8
8
  payload: {
9
9
  messageSection: import("../../..").SnackbarMessageSections;
10
10
  messageText: import("../../..").SnackbarMessageSectionTexts;
@@ -12,11 +12,10 @@ const failureSnackbar = (reason) => (0, snackbarReducer_1.openSnackbar)({
12
12
  type: 'error',
13
13
  variables: [{ variableName: '__reason__', variableValue: reason }],
14
14
  });
15
- const approveOAuthConsentEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(zeniOAuthReducer_1.approveOAuthConsent.match),
16
- // `approveOAuthConsent` reducer sets fetchState to In-Progress before epics
17
- // run, so a guard on In-Progress would block every legitimate request.
18
- // exhaustMap drops duplicate approve clicks while the HTTP call is in flight.
19
- (0, operators_1.exhaustMap)((action) => {
15
+ const approveOAuthConsentEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(zeniOAuthReducer_1.approveOAuthConsent.match), (0, operators_1.switchMap)((action) => {
16
+ if (state$.value.zeniOAuthViewState.fetchState === 'In-Progress') {
17
+ return (0, rxjs_1.from)([]);
18
+ }
20
19
  const { userId, zeniSessionId, tenantId, clientId, redirectUri, codeChallenge, codeChallengeMethod, state, responseType, } = action.payload;
21
20
  const authHeaders = {
22
21
  'zeni-user-id': userId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.34-betaRD1",
3
+ "version": "5.0.34-betaRR1",
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",