@zeniai/client-epic-state 5.2.22-betaRD0 → 5.2.23
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/aiCfo/aiCfoPayload.d.ts +0 -11
- package/lib/entity/aiCfo/aiCfoReducer.js +1 -32
- package/lib/entity/aiCfo/aiCfoState.d.ts +0 -14
- package/lib/epic.d.ts +1 -3
- package/lib/epic.js +0 -4
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +1 -32
- package/lib/esm/epic.js +0 -4
- package/lib/esm/index.js +4 -4
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +7 -45
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +6 -13
- package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -1
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +7 -31
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +2 -5
- package/lib/esm/view/invoicing/dataImportView/dataImportViewSelector.js +0 -2
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +1 -5
- package/lib/esm/view/recommendation/recommendationReducer.js +1 -13
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +2 -18
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +1 -0
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +3 -0
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +2 -18
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +1 -0
- package/lib/index.d.ts +7 -8
- package/lib/index.js +23 -26
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +1 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +7 -45
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +5 -12
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -54
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +3 -3
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +6 -11
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +9 -33
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +3 -5
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +5 -4
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +2 -5
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +0 -2
- package/lib/view/invoicing/dataImportView/dataImportViewSelector.d.ts +0 -2
- package/lib/view/invoicing/dataImportView/dataImportViewSelector.js +0 -2
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +1 -5
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +0 -4
- package/lib/view/recommendation/recommendationPayload.d.ts +0 -34
- package/lib/view/recommendation/recommendationReducer.d.ts +1 -2
- package/lib/view/recommendation/recommendationReducer.js +2 -14
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.d.ts +1 -2
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +2 -18
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +1 -0
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +1 -0
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +3 -0
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonState.d.ts +1 -0
- package/lib/view/spendManagement/commonHistoryView/commonHistory.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.d.ts +1 -2
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +2 -18
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +1 -0
- package/package.json +1 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +0 -35
- package/lib/esm/view/recommendation/submitRecommendationFeedbackEpic.js +0 -52
- package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.d.ts +0 -12
- package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +0 -39
- package/lib/view/recommendation/submitRecommendationFeedbackEpic.d.ts +0 -7
- package/lib/view/recommendation/submitRecommendationFeedbackEpic.js +0 -56
package/lib/esm/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { EMPTY, of } from 'rxjs';
|
|
2
|
-
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { toMonthYearPeriodId } from '../../../../commonStateTypes/timePeriod';
|
|
4
|
-
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
|
-
import { fetchJeSchedules, fetchJeSchedulesPage, } from '../../reducers/jeSchedulesViewReducer';
|
|
6
|
-
import { ALL_JE_PAGE_TABS, getJESchedulePeriodTabKey, } from '../../types/jeSchedulesViewState';
|
|
7
|
-
/**
|
|
8
|
-
* Warms the tab the user is not looking at, so switching to it renders rows instead of a skeleton.
|
|
9
|
-
*
|
|
10
|
-
* Listens for `fetchJeSchedulesPage` rather than `fetchJeSchedules` on purpose: the prefetch emits
|
|
11
|
-
* `fetchJeSchedules`, so listening for that would make this epic feed itself.
|
|
12
|
-
*/
|
|
13
|
-
export const prefetchOtherJeSchedulesTabEpic = (actions$, state$) => actions$.pipe(filter(fetchJeSchedulesPage.match), mergeMap((action) => {
|
|
14
|
-
const state = state$.value;
|
|
15
|
-
const { period } = action.payload;
|
|
16
|
-
const { selectedPageTab } = state.expenseAutomationJESchedulesViewState.uiState;
|
|
17
|
-
const otherPageTab = ALL_JE_PAGE_TABS.find((pageTab) => pageTab !== selectedPageTab);
|
|
18
|
-
if (otherPageTab == null) {
|
|
19
|
-
return EMPTY;
|
|
20
|
-
}
|
|
21
|
-
const currentTenant = getCurrentTenant(state);
|
|
22
|
-
const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
|
|
23
|
-
if (selectedPeriod == null) {
|
|
24
|
-
return EMPTY;
|
|
25
|
-
}
|
|
26
|
-
// Already warm for this period: without this check every tab switch would refetch the tab
|
|
27
|
-
// just left, since a switch also fires fetchJeSchedulesPage.
|
|
28
|
-
const otherPeriodTabKey = getJESchedulePeriodTabKey(otherPageTab, toMonthYearPeriodId(selectedPeriod));
|
|
29
|
-
const isOtherTabAlreadyLoaded = state.expenseAutomationJESchedulesViewState
|
|
30
|
-
.jeScheduleTransactionKeysByPeriodAndTab[otherPeriodTabKey] != null;
|
|
31
|
-
if (isOtherTabAlreadyLoaded) {
|
|
32
|
-
return EMPTY;
|
|
33
|
-
}
|
|
34
|
-
return of(fetchJeSchedules(period, true, otherPageTab));
|
|
35
|
-
}));
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { EMPTY } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { isSuccessStatus } from '../../responsePayload';
|
|
4
|
-
import { submitRecommendationFeedback } from './recommendationReducer';
|
|
5
|
-
const toRequestBody = (payload) => ({
|
|
6
|
-
line_id: payload.lineId ?? null,
|
|
7
|
-
dimension: payload.dimension,
|
|
8
|
-
recommendation_set_id: payload.recommendationSetId ?? null,
|
|
9
|
-
top_pick_source: payload.topPickSource ?? null,
|
|
10
|
-
shown_recommendations: (payload.shownRecommendations ?? []).map((recommendation) => ({
|
|
11
|
-
source: recommendation.source,
|
|
12
|
-
rank: recommendation.rank,
|
|
13
|
-
value: {
|
|
14
|
-
name: recommendation.value.name,
|
|
15
|
-
id: recommendation.value.id ?? null,
|
|
16
|
-
integration_id: recommendation.value.integrationId ?? null,
|
|
17
|
-
},
|
|
18
|
-
confidence: recommendation.confidence ?? null,
|
|
19
|
-
reasoning: recommendation.reasoning ?? null,
|
|
20
|
-
cot: recommendation.cot ?? [],
|
|
21
|
-
})),
|
|
22
|
-
selected: {
|
|
23
|
-
name: payload.selected.name,
|
|
24
|
-
id: payload.selected.id ?? null,
|
|
25
|
-
integration_id: payload.selected.integrationId ?? null,
|
|
26
|
-
is_new_entity: payload.selected.isNewEntity ?? false,
|
|
27
|
-
},
|
|
28
|
-
matched_source: payload.matchedSource ?? null,
|
|
29
|
-
matched_rank: payload.matchedRank ?? null,
|
|
30
|
-
outcome: payload.outcome,
|
|
31
|
-
reason_text: payload.reasonText ?? null,
|
|
32
|
-
skipped: payload.skipped ?? false,
|
|
33
|
-
retracts_feedback_id: payload.retractsFeedbackId ?? null,
|
|
34
|
-
features: payload.features ?? null,
|
|
35
|
-
});
|
|
36
|
-
// Fire-and-forget: the epic never re-emits an action. Feedback delivery is a
|
|
37
|
-
// side-effect that must not disrupt the categorization UX, so both the
|
|
38
|
-
// success and error paths complete silently (errors are logged for debugging).
|
|
39
|
-
export const submitRecommendationFeedbackEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(submitRecommendationFeedback.match), mergeMap((action) => {
|
|
40
|
-
const { transactionId } = action.payload;
|
|
41
|
-
return zeniAPI
|
|
42
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/${transactionId}/recommendation-feedback`, toRequestBody(action.payload))
|
|
43
|
-
.pipe(mergeMap((response) => {
|
|
44
|
-
if (!isSuccessStatus(response)) {
|
|
45
|
-
console.error('submitRecommendationFeedbackEpic: recommendation feedback was not recorded', response.status);
|
|
46
|
-
}
|
|
47
|
-
return EMPTY;
|
|
48
|
-
}), catchError((error) => {
|
|
49
|
-
console.error('submitRecommendationFeedbackEpic: failed to submit recommendation feedback', error);
|
|
50
|
-
return EMPTY;
|
|
51
|
-
}));
|
|
52
|
-
}));
|
package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../rootStateTypes';
|
|
4
|
-
import { fetchJeSchedules, fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof fetchJeSchedules> | ReturnType<typeof fetchJeSchedulesPage>;
|
|
6
|
-
/**
|
|
7
|
-
* Warms the tab the user is not looking at, so switching to it renders rows instead of a skeleton.
|
|
8
|
-
*
|
|
9
|
-
* Listens for `fetchJeSchedulesPage` rather than `fetchJeSchedules` on purpose: the prefetch emits
|
|
10
|
-
* `fetchJeSchedules`, so listening for that would make this epic feed itself.
|
|
11
|
-
*/
|
|
12
|
-
export declare const prefetchOtherJeSchedulesTabEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.prefetchOtherJeSchedulesTabEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
-
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
|
-
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
9
|
-
const jeSchedulesViewState_1 = require("../../types/jeSchedulesViewState");
|
|
10
|
-
/**
|
|
11
|
-
* Warms the tab the user is not looking at, so switching to it renders rows instead of a skeleton.
|
|
12
|
-
*
|
|
13
|
-
* Listens for `fetchJeSchedulesPage` rather than `fetchJeSchedules` on purpose: the prefetch emits
|
|
14
|
-
* `fetchJeSchedules`, so listening for that would make this epic feed itself.
|
|
15
|
-
*/
|
|
16
|
-
const prefetchOtherJeSchedulesTabEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchJeSchedulesPage.match), (0, operators_1.mergeMap)((action) => {
|
|
17
|
-
const state = state$.value;
|
|
18
|
-
const { period } = action.payload;
|
|
19
|
-
const { selectedPageTab } = state.expenseAutomationJESchedulesViewState.uiState;
|
|
20
|
-
const otherPageTab = jeSchedulesViewState_1.ALL_JE_PAGE_TABS.find((pageTab) => pageTab !== selectedPageTab);
|
|
21
|
-
if (otherPageTab == null) {
|
|
22
|
-
return rxjs_1.EMPTY;
|
|
23
|
-
}
|
|
24
|
-
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
25
|
-
const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
|
|
26
|
-
if (selectedPeriod == null) {
|
|
27
|
-
return rxjs_1.EMPTY;
|
|
28
|
-
}
|
|
29
|
-
// Already warm for this period: without this check every tab switch would refetch the tab
|
|
30
|
-
// just left, since a switch also fires fetchJeSchedulesPage.
|
|
31
|
-
const otherPeriodTabKey = (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(otherPageTab, (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod));
|
|
32
|
-
const isOtherTabAlreadyLoaded = state.expenseAutomationJESchedulesViewState
|
|
33
|
-
.jeScheduleTransactionKeysByPeriodAndTab[otherPeriodTabKey] != null;
|
|
34
|
-
if (isOtherTabAlreadyLoaded) {
|
|
35
|
-
return rxjs_1.EMPTY;
|
|
36
|
-
}
|
|
37
|
-
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.fetchJeSchedules)(period, true, otherPageTab));
|
|
38
|
-
}));
|
|
39
|
-
exports.prefetchOtherJeSchedulesTabEpic = prefetchOtherJeSchedulesTabEpic;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../reducer';
|
|
4
|
-
import { ZeniAPI } from '../../zeniAPI';
|
|
5
|
-
import { submitRecommendationFeedback } from './recommendationReducer';
|
|
6
|
-
export type ActionType = ReturnType<typeof submitRecommendationFeedback>;
|
|
7
|
-
export declare const submitRecommendationFeedbackEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.submitRecommendationFeedbackEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../responsePayload");
|
|
7
|
-
const recommendationReducer_1 = require("./recommendationReducer");
|
|
8
|
-
const toRequestBody = (payload) => ({
|
|
9
|
-
line_id: payload.lineId ?? null,
|
|
10
|
-
dimension: payload.dimension,
|
|
11
|
-
recommendation_set_id: payload.recommendationSetId ?? null,
|
|
12
|
-
top_pick_source: payload.topPickSource ?? null,
|
|
13
|
-
shown_recommendations: (payload.shownRecommendations ?? []).map((recommendation) => ({
|
|
14
|
-
source: recommendation.source,
|
|
15
|
-
rank: recommendation.rank,
|
|
16
|
-
value: {
|
|
17
|
-
name: recommendation.value.name,
|
|
18
|
-
id: recommendation.value.id ?? null,
|
|
19
|
-
integration_id: recommendation.value.integrationId ?? null,
|
|
20
|
-
},
|
|
21
|
-
confidence: recommendation.confidence ?? null,
|
|
22
|
-
reasoning: recommendation.reasoning ?? null,
|
|
23
|
-
cot: recommendation.cot ?? [],
|
|
24
|
-
})),
|
|
25
|
-
selected: {
|
|
26
|
-
name: payload.selected.name,
|
|
27
|
-
id: payload.selected.id ?? null,
|
|
28
|
-
integration_id: payload.selected.integrationId ?? null,
|
|
29
|
-
is_new_entity: payload.selected.isNewEntity ?? false,
|
|
30
|
-
},
|
|
31
|
-
matched_source: payload.matchedSource ?? null,
|
|
32
|
-
matched_rank: payload.matchedRank ?? null,
|
|
33
|
-
outcome: payload.outcome,
|
|
34
|
-
reason_text: payload.reasonText ?? null,
|
|
35
|
-
skipped: payload.skipped ?? false,
|
|
36
|
-
retracts_feedback_id: payload.retractsFeedbackId ?? null,
|
|
37
|
-
features: payload.features ?? null,
|
|
38
|
-
});
|
|
39
|
-
// Fire-and-forget: the epic never re-emits an action. Feedback delivery is a
|
|
40
|
-
// side-effect that must not disrupt the categorization UX, so both the
|
|
41
|
-
// success and error paths complete silently (errors are logged for debugging).
|
|
42
|
-
const submitRecommendationFeedbackEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(recommendationReducer_1.submitRecommendationFeedback.match), (0, operators_1.mergeMap)((action) => {
|
|
43
|
-
const { transactionId } = action.payload;
|
|
44
|
-
return zeniAPI
|
|
45
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/${transactionId}/recommendation-feedback`, toRequestBody(action.payload))
|
|
46
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
47
|
-
if (!(0, responsePayload_1.isSuccessStatus)(response)) {
|
|
48
|
-
console.error('submitRecommendationFeedbackEpic: recommendation feedback was not recorded', response.status);
|
|
49
|
-
}
|
|
50
|
-
return rxjs_1.EMPTY;
|
|
51
|
-
}), (0, operators_1.catchError)((error) => {
|
|
52
|
-
console.error('submitRecommendationFeedbackEpic: failed to submit recommendation feedback', error);
|
|
53
|
-
return rxjs_1.EMPTY;
|
|
54
|
-
}));
|
|
55
|
-
}));
|
|
56
|
-
exports.submitRecommendationFeedbackEpic = submitRecommendationFeedbackEpic;
|