@zeniai/client-epic-state 5.0.65-betaRR2 → 5.0.65-betaRR4
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/cardPolicy/cardPolicyPayload.d.ts +9 -4
- package/lib/entity/cardPolicy/cardPolicyState.d.ts +12 -2
- package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +15 -3
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +13 -3
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +11 -3
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +7 -0
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -1
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +13 -1
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +11 -1
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +9 -1
- package/package.json +1 -1
|
@@ -49,7 +49,7 @@ interface CardPolicyTemplateEntityListPayload {
|
|
|
49
49
|
merchant_names: string[];
|
|
50
50
|
}
|
|
51
51
|
interface CardPolicyTemplateSpendLimitsPayload {
|
|
52
|
-
transaction: number;
|
|
52
|
+
transaction: number | null;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Request body for `POST /cards/1.0/policy-templates`. Consumers pass the
|
|
@@ -63,7 +63,12 @@ export interface CreateCardPolicyTemplateRequest {
|
|
|
63
63
|
description: string;
|
|
64
64
|
mode: CardPolicyTemplateMode;
|
|
65
65
|
name: string;
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* `null` indicates the require-receipt toggle is off (no threshold
|
|
68
|
+
* configured). The BE accepts `null` and treats it as "no requirement";
|
|
69
|
+
* `0` means the user explicitly entered zero with the toggle on.
|
|
70
|
+
*/
|
|
71
|
+
requiredReceiptThreshold: number | null;
|
|
67
72
|
spendLimits: CardPolicyTemplateSpendLimits;
|
|
68
73
|
}
|
|
69
74
|
export interface CreateCardPolicyTemplateRequestBody {
|
|
@@ -73,7 +78,7 @@ export interface CreateCardPolicyTemplateRequestBody {
|
|
|
73
78
|
description: string;
|
|
74
79
|
mode: string;
|
|
75
80
|
name: string;
|
|
76
|
-
required_receipt_threshold: number;
|
|
81
|
+
required_receipt_threshold: number | null;
|
|
77
82
|
spend_limits: CardPolicyTemplateSpendLimitsPayload;
|
|
78
83
|
}
|
|
79
84
|
export interface CardPolicyTemplatePayload {
|
|
@@ -87,7 +92,7 @@ export interface CardPolicyTemplatePayload {
|
|
|
87
92
|
description: string;
|
|
88
93
|
mode: string;
|
|
89
94
|
name: string;
|
|
90
|
-
required_receipt_threshold: number;
|
|
95
|
+
required_receipt_threshold: number | null;
|
|
91
96
|
spend_limits: CardPolicyTemplateSpendLimitsPayload;
|
|
92
97
|
status: string;
|
|
93
98
|
template_id: ID;
|
|
@@ -30,9 +30,14 @@ export interface CardPolicyTemplateEntityList {
|
|
|
30
30
|
* Spend-limit caps configured per template. Only `transaction` is modeled
|
|
31
31
|
* today; additional cadences (e.g. daily, monthly) will be added if/when
|
|
32
32
|
* the backend exposes them.
|
|
33
|
+
*
|
|
34
|
+
* `transaction` is `number | null`: `null` means the row's toggle is off
|
|
35
|
+
* (no limit configured), `0` means the user explicitly entered zero with
|
|
36
|
+
* the toggle on, and any positive value is the configured per-transaction
|
|
37
|
+
* cap.
|
|
33
38
|
*/
|
|
34
39
|
export interface CardPolicyTemplateSpendLimits {
|
|
35
|
-
transaction: number;
|
|
40
|
+
transaction: number | null;
|
|
36
41
|
}
|
|
37
42
|
/**
|
|
38
43
|
* Mapped (camelCase) representation of a card-policy template returned by
|
|
@@ -51,7 +56,12 @@ export interface CardPolicyTemplate {
|
|
|
51
56
|
description: string;
|
|
52
57
|
mode: CardPolicyTemplateMode;
|
|
53
58
|
name: string;
|
|
54
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Receipt-required threshold in dollars. `null` means the toggle is off
|
|
61
|
+
* (no receipt requirement); `0` means the user explicitly entered zero
|
|
62
|
+
* with the toggle on; any positive value is the configured threshold.
|
|
63
|
+
*/
|
|
64
|
+
requiredReceiptThreshold: number | null;
|
|
55
65
|
spendLimits: CardPolicyTemplateSpendLimits;
|
|
56
66
|
status: CardPolicyTemplateStatus;
|
|
57
67
|
templateId: ID;
|
|
@@ -2,13 +2,23 @@ import { of } from 'rxjs';
|
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
4
4
|
import { fetchSuggestedQuestions, fetchSuggestedQuestionsFailure, fetchSuggestedQuestionsSuccess, } from '../aiCfoViewReducer';
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* GET {aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?page_context=...
|
|
7
|
+
*
|
|
8
|
+
* Appends `&no_card_created=true` when the action payload sets
|
|
9
|
+
* `noCardCreated: true` (AI Card Creation flow on the cards list — the tenant
|
|
10
|
+
* has not yet created any card). Any other value omits the flag entirely so
|
|
11
|
+
* the existing call sites continue to issue the unchanged request.
|
|
12
|
+
*/
|
|
6
13
|
export const fetchSuggestedQuestionsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchSuggestedQuestions.match),
|
|
7
14
|
// mergeMap (not switchMap): each page_context is keyed separately in Redux; switchMap
|
|
8
15
|
// would cancel in-flight HTTP for context A when B is requested, leaving A stuck In-Progress.
|
|
9
16
|
mergeMap((action) => {
|
|
10
|
-
const { pageContext } = action.payload;
|
|
17
|
+
const { pageContext, noCardCreated } = action.payload;
|
|
11
18
|
const query = new URLSearchParams({ page_context: pageContext });
|
|
19
|
+
if (noCardCreated === true) {
|
|
20
|
+
query.set('no_card_created', 'true');
|
|
21
|
+
}
|
|
12
22
|
const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?${query.toString()}`;
|
|
13
23
|
return zeniAPI.getJSON(url).pipe(mergeMap((response) => {
|
|
14
24
|
if (isSuccessResponse(response) && response.data != null) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { from, of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
2
|
+
import { catchError, exhaustMap, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { toCardPolicyEditFormDraft, toCardPolicyTemplate, } from '../../../../../entity/cardPolicy/cardPolicyPayload';
|
|
4
4
|
import { updateCreatedCardPolicyTemplate } from '../../../../../entity/cardPolicy/cardPolicyReducer';
|
|
5
|
-
import { createZeniAPIStatus, isSuccessStatus } from '../../../../../responsePayload';
|
|
5
|
+
import { createZeniAPIStatus, isSuccessStatus, } from '../../../../../responsePayload';
|
|
6
6
|
import { fetchCardPolicyDetail, updateCardPolicyDetailFetchStatus, updateCardPolicyFormDraft, } from './cardPolicyDetailReducer';
|
|
7
7
|
/**
|
|
8
8
|
* `GET /cards/1.0/policy-templates/{id}`. Response is the same
|
|
@@ -15,7 +15,19 @@ import { fetchCardPolicyDetail, updateCardPolicyDetailFetchStatus, updateCardPol
|
|
|
15
15
|
* the page can render with the existing values pre-populated.
|
|
16
16
|
* 3. Flip the view lifecycle to `Completed` / `Error`.
|
|
17
17
|
*/
|
|
18
|
-
export const fetchCardPolicyDetailEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCardPolicyDetail.match),
|
|
18
|
+
export const fetchCardPolicyDetailEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCardPolicyDetail.match),
|
|
19
|
+
// `exhaustMap` (rather than `mergeMap`) so a duplicate
|
|
20
|
+
// `fetchCardPolicyDetail` dispatched while the previous one is
|
|
21
|
+
// still in flight is dropped instead of producing a second HTTP
|
|
22
|
+
// request. The edit screen dispatches this on mount, and React 18
|
|
23
|
+
// StrictMode invokes its mount effect twice with a stale
|
|
24
|
+
// `detailFetchState` closure — without `exhaustMap` that yields
|
|
25
|
+
// two `/policy-templates/{id}` calls. (The screen also dedupes
|
|
26
|
+
// list→edit navigations via the entity-cached template, so the
|
|
27
|
+
// detail GET is only emitted on direct landings — there's no
|
|
28
|
+
// realistic cross-templateId scenario that needs cancel-and-retry
|
|
29
|
+
// semantics here.)
|
|
30
|
+
exhaustMap((action) => {
|
|
19
31
|
const templateId = action.payload;
|
|
20
32
|
return zeniAPI
|
|
21
33
|
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-templates/${templateId}`)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { from, of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
2
|
+
import { catchError, exhaustMap, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { toCardPolicyStats, toCardPolicyTemplateList, } from '../../../../../entity/cardPolicy/cardPolicyPayload';
|
|
4
4
|
import { updateCardPolicyStats, updateCardPolicyTemplates, } from '../../../../../entity/cardPolicy/cardPolicyReducer';
|
|
5
|
-
import { createZeniAPIStatus, isSuccessStatus } from '../../../../../responsePayload';
|
|
5
|
+
import { createZeniAPIStatus, isSuccessStatus, } from '../../../../../responsePayload';
|
|
6
6
|
import { fetchCardPolicyList, updateCardPolicyListFetchStatus, } from './cardPolicyListReducer';
|
|
7
7
|
/**
|
|
8
8
|
* `GET /cards/1.0/policy-templates`. On success the response carries
|
|
@@ -15,7 +15,17 @@ import { fetchCardPolicyList, updateCardPolicyListFetchStatus, } from './cardPol
|
|
|
15
15
|
* 2. `updateCardPolicyStats` — entity-level cached stats.
|
|
16
16
|
* 3. `updateCardPolicyListFetchStatus` — view lifecycle + ordered IDs.
|
|
17
17
|
*/
|
|
18
|
-
export const fetchCardPolicyListEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCardPolicyList.match),
|
|
18
|
+
export const fetchCardPolicyListEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCardPolicyList.match),
|
|
19
|
+
// `exhaustMap` (rather than `mergeMap`) so a duplicate
|
|
20
|
+
// `fetchCardPolicyList` dispatched while the previous one is still
|
|
21
|
+
// in flight is dropped instead of producing a second HTTP request.
|
|
22
|
+
// This guards against React 18 StrictMode, which mount-cleanup-
|
|
23
|
+
// remounts the screen's mount effect with a stale closure of
|
|
24
|
+
// `listFetchState`, causing the same effect to dispatch this
|
|
25
|
+
// action twice synchronously. Retry-after-error still works
|
|
26
|
+
// because the previous inner observable has completed by the time
|
|
27
|
+
// the user retries.
|
|
28
|
+
exhaustMap(() => {
|
|
19
29
|
return zeniAPI
|
|
20
30
|
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-templates`)
|
|
21
31
|
.pipe(mergeMap((response) => {
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { from, of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
2
|
+
import { catchError, exhaustMap, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { fetchCardPolicyMccCategories, updateCardPolicyMccCategories, updateCardPolicyMccCategoriesFailure, } from '../../../../../entity/cardPolicy/cardPolicyReducer';
|
|
4
|
-
import { createZeniAPIStatus, isSuccessStatus } from '../../../../../responsePayload';
|
|
5
|
-
export const fetchCardPolicyMccCategoriesEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCardPolicyMccCategories.match),
|
|
4
|
+
import { createZeniAPIStatus, isSuccessStatus, } from '../../../../../responsePayload';
|
|
5
|
+
export const fetchCardPolicyMccCategoriesEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCardPolicyMccCategories.match),
|
|
6
|
+
// `exhaustMap` (rather than `mergeMap`) so a duplicate
|
|
7
|
+
// `fetchCardPolicyMccCategories` dispatched while the previous one
|
|
8
|
+
// is still in flight is dropped instead of producing a second HTTP
|
|
9
|
+
// request. Both the Create and Edit policy screens dispatch this
|
|
10
|
+
// on mount, and React 18 StrictMode invokes their mount effect
|
|
11
|
+
// twice with a stale `mccCategoriesFetchState` closure — without
|
|
12
|
+
// `exhaustMap` that yields two `/cards/mcc-codes` calls.
|
|
13
|
+
exhaustMap(() => {
|
|
6
14
|
return zeniAPI
|
|
7
15
|
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/mcc-codes`)
|
|
8
16
|
.pipe(mergeMap((response) => {
|
|
@@ -92,6 +92,13 @@ export declare const submitQuestion: import("@reduxjs/toolkit").ActionCreatorWit
|
|
|
92
92
|
questionAnswerId: ID;
|
|
93
93
|
}, "aiCfoView/updateCotCollapsedState">, fetchSuggestedQuestions: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
94
94
|
pageContext: AiCfoSuggestedQuestionsPageContext;
|
|
95
|
+
/**
|
|
96
|
+
* AI Card Creation flow: when true, the epic appends `&no_card_created=true`
|
|
97
|
+
* so the backend tailors prompts for a tenant that has not yet created a
|
|
98
|
+
* card. The bucket key is unchanged (`pageContext`); see
|
|
99
|
+
* `useFetchSuggestedQuestionsWhenReady` for the refetch-on-flag-flip rule.
|
|
100
|
+
*/
|
|
101
|
+
noCardCreated?: boolean;
|
|
95
102
|
}, "aiCfoView/fetchSuggestedQuestions">, fetchSuggestedQuestionsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
96
103
|
generatedAt: string;
|
|
97
104
|
pageContext: AiCfoSuggestedQuestionsPageContext;
|
|
@@ -4,5 +4,12 @@ import { RootState } from '../../../reducer';
|
|
|
4
4
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
5
|
import { fetchSuggestedQuestions, fetchSuggestedQuestionsFailure, fetchSuggestedQuestionsSuccess } from '../aiCfoViewReducer';
|
|
6
6
|
export type ActionType = ReturnType<typeof fetchSuggestedQuestions> | ReturnType<typeof fetchSuggestedQuestionsSuccess> | ReturnType<typeof fetchSuggestedQuestionsFailure>;
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* GET {aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?page_context=...
|
|
9
|
+
*
|
|
10
|
+
* Appends `&no_card_created=true` when the action payload sets
|
|
11
|
+
* `noCardCreated: true` (AI Card Creation flow on the cards list — the tenant
|
|
12
|
+
* has not yet created any card). Any other value omits the flag entirely so
|
|
13
|
+
* the existing call sites continue to issue the unchanged request.
|
|
14
|
+
*/
|
|
8
15
|
export declare const fetchSuggestedQuestionsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -5,13 +5,23 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const responsePayload_1 = require("../../../responsePayload");
|
|
7
7
|
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* GET {aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?page_context=...
|
|
10
|
+
*
|
|
11
|
+
* Appends `&no_card_created=true` when the action payload sets
|
|
12
|
+
* `noCardCreated: true` (AI Card Creation flow on the cards list — the tenant
|
|
13
|
+
* has not yet created any card). Any other value omits the flag entirely so
|
|
14
|
+
* the existing call sites continue to issue the unchanged request.
|
|
15
|
+
*/
|
|
9
16
|
const fetchSuggestedQuestionsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.fetchSuggestedQuestions.match),
|
|
10
17
|
// mergeMap (not switchMap): each page_context is keyed separately in Redux; switchMap
|
|
11
18
|
// would cancel in-flight HTTP for context A when B is requested, leaving A stuck In-Progress.
|
|
12
19
|
(0, operators_1.mergeMap)((action) => {
|
|
13
|
-
const { pageContext } = action.payload;
|
|
20
|
+
const { pageContext, noCardCreated } = action.payload;
|
|
14
21
|
const query = new URLSearchParams({ page_context: pageContext });
|
|
22
|
+
if (noCardCreated === true) {
|
|
23
|
+
query.set('no_card_created', 'true');
|
|
24
|
+
}
|
|
15
25
|
const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?${query.toString()}`;
|
|
16
26
|
return zeniAPI.getJSON(url).pipe((0, operators_1.mergeMap)((response) => {
|
|
17
27
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
@@ -18,7 +18,19 @@ const cardPolicyDetailReducer_1 = require("./cardPolicyDetailReducer");
|
|
|
18
18
|
* the page can render with the existing values pre-populated.
|
|
19
19
|
* 3. Flip the view lifecycle to `Completed` / `Error`.
|
|
20
20
|
*/
|
|
21
|
-
const fetchCardPolicyDetailEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPolicyDetailReducer_1.fetchCardPolicyDetail.match),
|
|
21
|
+
const fetchCardPolicyDetailEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPolicyDetailReducer_1.fetchCardPolicyDetail.match),
|
|
22
|
+
// `exhaustMap` (rather than `mergeMap`) so a duplicate
|
|
23
|
+
// `fetchCardPolicyDetail` dispatched while the previous one is
|
|
24
|
+
// still in flight is dropped instead of producing a second HTTP
|
|
25
|
+
// request. The edit screen dispatches this on mount, and React 18
|
|
26
|
+
// StrictMode invokes its mount effect twice with a stale
|
|
27
|
+
// `detailFetchState` closure — without `exhaustMap` that yields
|
|
28
|
+
// two `/policy-templates/{id}` calls. (The screen also dedupes
|
|
29
|
+
// list→edit navigations via the entity-cached template, so the
|
|
30
|
+
// detail GET is only emitted on direct landings — there's no
|
|
31
|
+
// realistic cross-templateId scenario that needs cancel-and-retry
|
|
32
|
+
// semantics here.)
|
|
33
|
+
(0, operators_1.exhaustMap)((action) => {
|
|
22
34
|
const templateId = action.payload;
|
|
23
35
|
return zeniAPI
|
|
24
36
|
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-templates/${templateId}`)
|
package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js
CHANGED
|
@@ -18,7 +18,17 @@ const cardPolicyListReducer_1 = require("./cardPolicyListReducer");
|
|
|
18
18
|
* 2. `updateCardPolicyStats` — entity-level cached stats.
|
|
19
19
|
* 3. `updateCardPolicyListFetchStatus` — view lifecycle + ordered IDs.
|
|
20
20
|
*/
|
|
21
|
-
const fetchCardPolicyListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPolicyListReducer_1.fetchCardPolicyList.match),
|
|
21
|
+
const fetchCardPolicyListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPolicyListReducer_1.fetchCardPolicyList.match),
|
|
22
|
+
// `exhaustMap` (rather than `mergeMap`) so a duplicate
|
|
23
|
+
// `fetchCardPolicyList` dispatched while the previous one is still
|
|
24
|
+
// in flight is dropped instead of producing a second HTTP request.
|
|
25
|
+
// This guards against React 18 StrictMode, which mount-cleanup-
|
|
26
|
+
// remounts the screen's mount effect with a stale closure of
|
|
27
|
+
// `listFetchState`, causing the same effect to dispatch this
|
|
28
|
+
// action twice synchronously. Retry-after-error still works
|
|
29
|
+
// because the previous inner observable has completed by the time
|
|
30
|
+
// the user retries.
|
|
31
|
+
(0, operators_1.exhaustMap)(() => {
|
|
22
32
|
return zeniAPI
|
|
23
33
|
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-templates`)
|
|
24
34
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
@@ -5,7 +5,15 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const cardPolicyReducer_1 = require("../../../../../entity/cardPolicy/cardPolicyReducer");
|
|
7
7
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
8
|
-
const fetchCardPolicyMccCategoriesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPolicyReducer_1.fetchCardPolicyMccCategories.match),
|
|
8
|
+
const fetchCardPolicyMccCategoriesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPolicyReducer_1.fetchCardPolicyMccCategories.match),
|
|
9
|
+
// `exhaustMap` (rather than `mergeMap`) so a duplicate
|
|
10
|
+
// `fetchCardPolicyMccCategories` dispatched while the previous one
|
|
11
|
+
// is still in flight is dropped instead of producing a second HTTP
|
|
12
|
+
// request. Both the Create and Edit policy screens dispatch this
|
|
13
|
+
// on mount, and React 18 StrictMode invokes their mount effect
|
|
14
|
+
// twice with a stale `mccCategoriesFetchState` closure — without
|
|
15
|
+
// `exhaustMap` that yields two `/cards/mcc-codes` calls.
|
|
16
|
+
(0, operators_1.exhaustMap)(() => {
|
|
9
17
|
return zeniAPI
|
|
10
18
|
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/mcc-codes`)
|
|
11
19
|
.pipe((0, operators_1.mergeMap)((response) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.65-
|
|
3
|
+
"version": "5.0.65-betaRR4",
|
|
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",
|