@zeniai/client-epic-state 4.17.19 → 4.17.20
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/accountRecon/accountReconPayload.d.ts +2 -0
- package/lib/entity/accountRecon/accountReconPayload.js +6 -1
- package/lib/entity/accountRecon/accountReconState.d.ts +2 -0
- package/lib/entity/{aiController/aiControllerPayload.d.ts → aiCfo/aiCfoPayload.d.ts} +10 -3
- package/lib/entity/aiCfo/aiCfoReducer.d.ts +45 -0
- package/lib/entity/{aiController/aiControllerReducer.js → aiCfo/aiCfoReducer.js} +53 -45
- package/lib/entity/aiCfo/aiCfoSelector.d.ts +14 -0
- package/lib/entity/{aiController/aiControllerSelector.js → aiCfo/aiCfoSelector.js} +6 -6
- package/lib/entity/aiCfo/aiCfoState.d.ts +107 -0
- package/lib/entity/aiCfo/aiCfoState.js +81 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +4 -4
- package/lib/entity/tenant/clearAllEpic.js +4 -4
- package/lib/epic.d.ts +10 -8
- package/lib/epic.js +10 -8
- package/lib/index.d.ts +15 -13
- package/lib/index.js +83 -74
- package/lib/reducer.d.ts +6 -6
- package/lib/reducer.js +6 -6
- package/lib/view/{aiControllerView/aiControllerViewPayload.d.ts → aiCfoView/aiCfoViewPayload.d.ts} +2 -2
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +73 -0
- package/lib/view/{aiControllerView/aiControllerViewReducer.js → aiCfoView/aiCfoViewReducer.js} +10 -10
- package/lib/view/{aiControllerView/aiControllerViewSelector.d.ts → aiCfoView/aiCfoViewSelector.d.ts} +5 -5
- package/lib/view/{aiControllerView/aiControllerViewSelector.js → aiCfoView/aiCfoViewSelector.js} +6 -6
- package/lib/view/{aiControllerView/aiControllerViewState.d.ts → aiCfoView/aiCfoViewState.d.ts} +3 -3
- package/lib/view/{aiControllerView → aiCfoView}/epics/createSessionAndSubmitEpic.d.ts +2 -2
- package/lib/view/{aiControllerView → aiCfoView}/epics/createSessionAndSubmitEpic.js +9 -9
- package/lib/view/{aiControllerView → aiCfoView}/epics/createSessionEpic.d.ts +2 -2
- package/lib/view/{aiControllerView → aiCfoView}/epics/createSessionEpic.js +8 -8
- package/lib/view/{aiControllerView → aiCfoView}/epics/fetchChatHistoryEpic.d.ts +2 -2
- package/lib/view/{aiControllerView → aiCfoView}/epics/fetchChatHistoryEpic.js +9 -9
- package/lib/view/{aiControllerView → aiCfoView}/epics/fetchChatSessionsForUserEpic.d.ts +2 -2
- package/lib/view/{aiControllerView → aiCfoView}/epics/fetchChatSessionsForUserEpic.js +8 -9
- package/lib/view/{aiControllerView → aiCfoView}/epics/stopSubmitEpic.d.ts +2 -2
- package/lib/view/{aiControllerView → aiCfoView}/epics/stopSubmitEpic.js +11 -11
- package/lib/view/{aiControllerView → aiCfoView}/epics/stopSubmitQuestionEpic.d.ts +2 -2
- package/lib/view/{aiControllerView → aiCfoView}/epics/stopSubmitQuestionEpic.js +8 -8
- package/lib/view/{aiControllerView → aiCfoView}/epics/submitQuestionEpic.d.ts +2 -2
- package/lib/view/{aiControllerView → aiCfoView}/epics/submitQuestionEpic.js +10 -10
- package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +2 -0
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailPayload.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +11 -0
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailSelector.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailSelector.js +1 -0
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailState.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailState.js +7 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +19 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +33 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailPayload.d.ts +13 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +11 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +18 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionStatisticsEpic.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionStatisticsEpic.js +39 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +13 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +14 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +14 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +26 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +17 -3
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +34 -4
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchCreditAccountRepaymentEpic.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchCreditAccountRepaymentEpic.js +23 -0
- package/lib/zeniAPI.d.ts +1 -1
- package/package.json +1 -1
- package/lib/entity/aiController/aiControllerReducer.d.ts +0 -46
- package/lib/entity/aiController/aiControllerSelector.d.ts +0 -14
- package/lib/entity/aiController/aiControllerState.d.ts +0 -88
- package/lib/entity/aiController/aiControllerState.js +0 -49
- package/lib/view/aiControllerView/aiControllerViewReducer.d.ts +0 -73
- /package/lib/entity/{aiController/aiControllerPayload.js → aiCfo/aiCfoPayload.js} +0 -0
- /package/lib/view/{aiControllerView/aiControllerViewPayload.js → aiCfoView/aiCfoViewPayload.js} +0 -0
- /package/lib/view/{aiControllerView/aiControllerViewState.js → aiCfoView/aiCfoViewState.js} +0 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { PageToken } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
|
+
import { ChatSessionPayload } from '../../entity/aiCfo/aiCfoPayload';
|
|
4
|
+
import { AiCfoAnswerResponseType } from '../../entity/aiCfo/aiCfoState';
|
|
5
|
+
import { ZeniAPIStatus } from '../../responsePayload';
|
|
6
|
+
import { AiCfoViewState } from './aiCfoViewState';
|
|
7
|
+
export declare const initialAiCfoViewState: AiCfoViewState;
|
|
8
|
+
export declare const submitQuestion: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[sessionId: string, questionAnswerId: string, userId: string, questionId: string, createdAt: import("dayjs").Dayjs, question: string], {
|
|
9
|
+
sessionId: string;
|
|
10
|
+
questionAnswerId: string;
|
|
11
|
+
userId: string;
|
|
12
|
+
questionId: string;
|
|
13
|
+
createdAt: import("dayjs").Dayjs;
|
|
14
|
+
question: string;
|
|
15
|
+
}, "aiCfoView/submitQuestion", never, never>, submitQuestionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "aiCfoView/submitQuestionSuccess">, submitQuestionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
16
|
+
sessionId: ID;
|
|
17
|
+
error: ZeniAPIStatus;
|
|
18
|
+
}, "aiCfoView/submitQuestionFailure">, updateResponseState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
19
|
+
chatSessionId: ID;
|
|
20
|
+
responseType: AiCfoAnswerResponseType;
|
|
21
|
+
fetchState: FetchStateAndError;
|
|
22
|
+
}, "aiCfoView/updateResponseState">, updateAiCfoViewScrollPosition: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "aiCfoView/updateAiCfoViewScrollPosition">, updateCurrentInput: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "aiCfoView/updateCurrentInput">, clearInput: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfoView/clearInput">, setSession: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
23
|
+
sessionId: string;
|
|
24
|
+
agentId: string;
|
|
25
|
+
}, "aiCfoView/setSession">, createSession: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[agentId: string, userId: string], {
|
|
26
|
+
agentId: string;
|
|
27
|
+
userId: string;
|
|
28
|
+
}, "aiCfoView/createSession", never, never>, createSessionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
29
|
+
agentId: string;
|
|
30
|
+
sessionId: ID;
|
|
31
|
+
}, "aiCfoView/createSessionSuccess">, createSessionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "aiCfoView/createSessionFailure">, createSessionAndSubmit: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[agentId: string, userId: string, questionAnswerId: string, questionId: string, createdAt: import("dayjs").Dayjs, question: string], {
|
|
32
|
+
agentId: string;
|
|
33
|
+
userId: string;
|
|
34
|
+
questionAnswerId: string;
|
|
35
|
+
questionId: string;
|
|
36
|
+
createdAt: import("dayjs").Dayjs;
|
|
37
|
+
question: string;
|
|
38
|
+
}, "aiCfoView/createSessionAndSubmit", never, never>, createSessionAndSubmitSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
39
|
+
agentId: string;
|
|
40
|
+
sessionId: ID;
|
|
41
|
+
}, "aiCfoView/createSessionAndSubmitSuccess">, createSessionAndSubmitFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "aiCfoView/createSessionAndSubmitFailure">, fetchChatSessionsForUser: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfoView/fetchChatSessionsForUser">, fetchChatSessionsForUserSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
42
|
+
nextPageToken: PageToken;
|
|
43
|
+
sessions: ChatSessionPayload[];
|
|
44
|
+
}, "aiCfoView/fetchChatSessionsForUserSuccess">, fetchChatSessionsForUserFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "aiCfoView/fetchChatSessionsForUserFailure">, fetchChatHistory: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[chatSessionId: string, userId: string], {
|
|
45
|
+
chatSessionId: string;
|
|
46
|
+
userId: string;
|
|
47
|
+
}, "aiCfoView/fetchChatHistory", never, never>, fetchChatHistorySuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
48
|
+
chatSessionId: ID;
|
|
49
|
+
nextPageToken: PageToken;
|
|
50
|
+
}, "aiCfoView/fetchChatHistorySuccess">, fetchChatHistoryFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
51
|
+
chatSessionId: ID;
|
|
52
|
+
error: ZeniAPIStatus;
|
|
53
|
+
}, "aiCfoView/fetchChatHistoryFailure">, clearCurrentSessionId: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfoView/clearCurrentSessionId">, stopSubmit: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[chatSessionId: string], {
|
|
54
|
+
chatSessionId: string;
|
|
55
|
+
}, "aiCfoView/stopSubmit", never, never>, stopSubmitSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
56
|
+
chatSessionId: ID;
|
|
57
|
+
question: string;
|
|
58
|
+
isOnlyQuestionInSession: boolean;
|
|
59
|
+
}, "aiCfoView/stopSubmitSuccess">, stopSubmitFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
60
|
+
chatSessionId: ID;
|
|
61
|
+
error: ZeniAPIStatus;
|
|
62
|
+
}, "aiCfoView/stopSubmitFailure">, stopSubmitQuestion: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[chatSessionId: string], {
|
|
63
|
+
chatSessionId: string;
|
|
64
|
+
}, "aiCfoView/stopSubmitQuestion", never, never>, stopSubmitQuestionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
65
|
+
chatSessionId: ID;
|
|
66
|
+
question: string;
|
|
67
|
+
isOnlyQuestionInSession: boolean;
|
|
68
|
+
}, "aiCfoView/stopSubmitQuestionSuccess">, stopSubmitQuestionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
69
|
+
chatSessionId: ID;
|
|
70
|
+
error: ZeniAPIStatus;
|
|
71
|
+
}, "aiCfoView/stopSubmitQuestionFailure">, clearAiCfoView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfoView/clearAiCfoView">;
|
|
72
|
+
declare const _default: import("redux").Reducer<AiCfoViewState>;
|
|
73
|
+
export default _default;
|
package/lib/view/{aiControllerView/aiControllerViewReducer.js → aiCfoView/aiCfoViewReducer.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.clearAiCfoView = exports.stopSubmitQuestionFailure = exports.stopSubmitQuestionSuccess = exports.stopSubmitQuestion = exports.stopSubmitFailure = exports.stopSubmitSuccess = exports.stopSubmit = exports.clearCurrentSessionId = exports.fetchChatHistoryFailure = exports.fetchChatHistorySuccess = exports.fetchChatHistory = exports.fetchChatSessionsForUserFailure = exports.fetchChatSessionsForUserSuccess = exports.fetchChatSessionsForUser = exports.createSessionAndSubmitFailure = exports.createSessionAndSubmitSuccess = exports.createSessionAndSubmit = exports.createSessionFailure = exports.createSessionSuccess = exports.createSession = exports.setSession = exports.clearInput = exports.updateCurrentInput = exports.updateAiCfoViewScrollPosition = exports.updateResponseState = exports.submitQuestionFailure = exports.submitQuestionSuccess = exports.submitQuestion = exports.initialAiCfoViewState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
exports.
|
|
6
|
+
exports.initialAiCfoViewState = {
|
|
7
7
|
fetchState: 'Not-Started',
|
|
8
8
|
error: undefined,
|
|
9
9
|
uiState: {
|
|
@@ -28,9 +28,9 @@ exports.initialAIControllerViewState = {
|
|
|
28
28
|
responseStateByChatSessionId: {},
|
|
29
29
|
stopSubmitStateByChatSessionId: {},
|
|
30
30
|
};
|
|
31
|
-
const
|
|
32
|
-
name: '
|
|
33
|
-
initialState: exports.
|
|
31
|
+
const aiCfoView = (0, toolkit_1.createSlice)({
|
|
32
|
+
name: 'aiCfoView',
|
|
33
|
+
initialState: exports.initialAiCfoViewState,
|
|
34
34
|
reducers: {
|
|
35
35
|
submitQuestion: {
|
|
36
36
|
reducer(draft, action) {
|
|
@@ -88,7 +88,7 @@ const aiControllerView = (0, toolkit_1.createSlice)({
|
|
|
88
88
|
draft.responseStateByChatSessionId[chatSessionId][responseType] =
|
|
89
89
|
fetchState;
|
|
90
90
|
},
|
|
91
|
-
|
|
91
|
+
updateAiCfoViewScrollPosition(draft, action) {
|
|
92
92
|
if (draft.uiState.currentChatSessionId != null) {
|
|
93
93
|
draft.uiState.scrollPositionByChatSessionId[draft.uiState.currentChatSessionId] = {
|
|
94
94
|
scrollTop: action.payload,
|
|
@@ -290,10 +290,10 @@ const aiControllerView = (0, toolkit_1.createSlice)({
|
|
|
290
290
|
clearCurrentSessionId(draft) {
|
|
291
291
|
draft.uiState.currentChatSessionId = undefined;
|
|
292
292
|
},
|
|
293
|
-
|
|
294
|
-
Object.assign(draft, exports.
|
|
293
|
+
clearAiCfoView(draft) {
|
|
294
|
+
Object.assign(draft, exports.initialAiCfoViewState);
|
|
295
295
|
},
|
|
296
296
|
},
|
|
297
297
|
});
|
|
298
|
-
_a =
|
|
299
|
-
exports.default =
|
|
298
|
+
_a = aiCfoView.actions, exports.submitQuestion = _a.submitQuestion, exports.submitQuestionSuccess = _a.submitQuestionSuccess, exports.submitQuestionFailure = _a.submitQuestionFailure, exports.updateResponseState = _a.updateResponseState, exports.updateAiCfoViewScrollPosition = _a.updateAiCfoViewScrollPosition, exports.updateCurrentInput = _a.updateCurrentInput, exports.clearInput = _a.clearInput, exports.setSession = _a.setSession, exports.createSession = _a.createSession, exports.createSessionSuccess = _a.createSessionSuccess, exports.createSessionFailure = _a.createSessionFailure, exports.createSessionAndSubmit = _a.createSessionAndSubmit, exports.createSessionAndSubmitSuccess = _a.createSessionAndSubmitSuccess, exports.createSessionAndSubmitFailure = _a.createSessionAndSubmitFailure, exports.fetchChatSessionsForUser = _a.fetchChatSessionsForUser, exports.fetchChatSessionsForUserSuccess = _a.fetchChatSessionsForUserSuccess, exports.fetchChatSessionsForUserFailure = _a.fetchChatSessionsForUserFailure, exports.fetchChatHistory = _a.fetchChatHistory, exports.fetchChatHistorySuccess = _a.fetchChatHistorySuccess, exports.fetchChatHistoryFailure = _a.fetchChatHistoryFailure, exports.clearCurrentSessionId = _a.clearCurrentSessionId, exports.stopSubmit = _a.stopSubmit, exports.stopSubmitSuccess = _a.stopSubmitSuccess, exports.stopSubmitFailure = _a.stopSubmitFailure, exports.stopSubmitQuestion = _a.stopSubmitQuestion, exports.stopSubmitQuestionSuccess = _a.stopSubmitQuestionSuccess, exports.stopSubmitQuestionFailure = _a.stopSubmitQuestionFailure, exports.clearAiCfoView = _a.clearAiCfoView;
|
|
299
|
+
exports.default = aiCfoView.reducer;
|
package/lib/view/{aiControllerView/aiControllerViewSelector.d.ts → aiCfoView/aiCfoViewSelector.d.ts}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ID } from '../../commonStateTypes/common';
|
|
2
2
|
import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
3
3
|
import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
|
-
import {
|
|
4
|
+
import { AiCfoSelectorView } from '../../entity/aiCfo/aiCfoSelector';
|
|
5
5
|
import { RootState } from '../../reducer';
|
|
6
|
-
import {
|
|
7
|
-
export interface
|
|
6
|
+
import { AiCfoViewUIState } from './aiCfoViewState';
|
|
7
|
+
export interface AiCfoViewSelector extends SelectorView, AiCfoSelectorView {
|
|
8
8
|
createSessionState: FetchStateAndError;
|
|
9
9
|
createSessionAndSubmitState: FetchStateAndError;
|
|
10
10
|
stopSubmitStateByChatSessionId: Record<ID, FetchStateAndError>;
|
|
@@ -15,6 +15,6 @@ export interface AIControllerViewSelector extends SelectorView, AIControllerSele
|
|
|
15
15
|
reasoning: FetchStateAndError;
|
|
16
16
|
answer: FetchStateAndError;
|
|
17
17
|
}>;
|
|
18
|
-
uiState:
|
|
18
|
+
uiState: AiCfoViewUIState;
|
|
19
19
|
}
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const getAiCfoView: (state: RootState) => AiCfoViewSelector;
|
package/lib/view/{aiControllerView/aiControllerViewSelector.js → aiCfoView/aiCfoViewSelector.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const { fetchState, error, uiState, createSessionState, createSessionAndSubmitState, stopSubmitStateByChatSessionId, responseStateByChatSessionId, fetchChatSessionHistoryByChatSessionId, } = state.
|
|
3
|
+
exports.getAiCfoView = void 0;
|
|
4
|
+
const aiCfoSelector_1 = require("../../entity/aiCfo/aiCfoSelector");
|
|
5
|
+
const getAiCfoView = (state) => {
|
|
6
|
+
const { fetchState, error, uiState, createSessionState, createSessionAndSubmitState, stopSubmitStateByChatSessionId, responseStateByChatSessionId, fetchChatSessionHistoryByChatSessionId, } = state.aiCfoViewState;
|
|
7
7
|
return Object.assign(Object.assign({ fetchState,
|
|
8
8
|
error,
|
|
9
9
|
createSessionState,
|
|
@@ -11,6 +11,6 @@ const getAIControllerView = (state) => {
|
|
|
11
11
|
stopSubmitStateByChatSessionId,
|
|
12
12
|
responseStateByChatSessionId,
|
|
13
13
|
uiState,
|
|
14
|
-
fetchChatSessionHistoryByChatSessionId }, (0,
|
|
14
|
+
fetchChatSessionHistoryByChatSessionId }, (0, aiCfoSelector_1.getAiCfoSelectorView)(state.aiCfoState)), { version: 1 });
|
|
15
15
|
};
|
|
16
|
-
exports.
|
|
16
|
+
exports.getAiCfoView = getAiCfoView;
|
package/lib/view/{aiControllerView/aiControllerViewState.d.ts → aiCfoView/aiCfoViewState.d.ts}
RENAMED
|
@@ -4,7 +4,7 @@ export interface PageTokenState {
|
|
|
4
4
|
nextPageToken: PageToken;
|
|
5
5
|
hasMore: boolean;
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface AiCfoViewUIState {
|
|
8
8
|
currentInput: string;
|
|
9
9
|
scrollPositionByChatSessionId: {
|
|
10
10
|
[chatSessionId: ID]: {
|
|
@@ -19,8 +19,8 @@ export interface AIControllerViewUIState {
|
|
|
19
19
|
currentChatSessionId?: ID;
|
|
20
20
|
agentId?: ID;
|
|
21
21
|
}
|
|
22
|
-
export interface
|
|
23
|
-
uiState:
|
|
22
|
+
export interface AiCfoViewState extends FetchStateAndError {
|
|
23
|
+
uiState: AiCfoViewUIState;
|
|
24
24
|
allChatSessionIds: ID[];
|
|
25
25
|
createSessionState: FetchStateAndError;
|
|
26
26
|
createSessionAndSubmitState: FetchStateAndError;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { addQuestionPayload, setNewSession } from '../../../entity/
|
|
3
|
+
import { addQuestionPayload, setNewSession } from '../../../entity/aiCfo/aiCfoReducer';
|
|
4
4
|
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
5
|
import { RootState } from '../../../reducer';
|
|
6
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
|
-
import { createSessionAndSubmit, createSessionAndSubmitFailure, createSessionAndSubmitSuccess, submitQuestion } from '../
|
|
7
|
+
import { createSessionAndSubmit, createSessionAndSubmitFailure, createSessionAndSubmitSuccess, submitQuestion } from '../aiCfoViewReducer';
|
|
8
8
|
export type ActionType = ReturnType<typeof createSessionAndSubmit> | ReturnType<typeof setNewSession> | ReturnType<typeof submitQuestion> | ReturnType<typeof createSessionAndSubmitSuccess> | ReturnType<typeof createSessionAndSubmitFailure> | ReturnType<typeof openSnackbar> | ReturnType<typeof addQuestionPayload>;
|
|
9
9
|
export declare const createSessionAndSubmitEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,27 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createSessionAndSubmitEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
6
|
+
const aiCfoReducer_1 = require("../../../entity/aiCfo/aiCfoReducer");
|
|
7
7
|
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
8
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
9
9
|
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
10
|
-
const
|
|
11
|
-
const createSessionAndSubmitEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(
|
|
10
|
+
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
11
|
+
const createSessionAndSubmitEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.createSessionAndSubmit.match), (0, operators_1.switchMap)((action) => {
|
|
12
12
|
const { agentId, userId, questionAnswerId, questionId, createdAt, question, } = action.payload;
|
|
13
13
|
const payload = { agent_id: agentId };
|
|
14
14
|
return zeniAPI
|
|
15
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.
|
|
15
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/sessions`, payload)
|
|
16
16
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
17
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
18
|
const sessionId = response.data.chat_session_id;
|
|
19
|
-
return (0, rxjs_1.of)((0,
|
|
19
|
+
return (0, rxjs_1.of)((0, aiCfoReducer_1.setNewSession)({
|
|
20
20
|
chatSessionId: sessionId,
|
|
21
21
|
userId,
|
|
22
22
|
createdAt: (0, zeniDayJS_1.date)(response.data.created_at),
|
|
23
|
-
}), (0,
|
|
23
|
+
}), (0, aiCfoViewReducer_1.createSessionAndSubmitSuccess)({
|
|
24
24
|
agentId,
|
|
25
25
|
sessionId,
|
|
26
|
-
}), (0,
|
|
26
|
+
}), (0, aiCfoViewReducer_1.submitQuestion)(sessionId, questionAnswerId, userId, questionId, createdAt, question), (0, aiCfoReducer_1.addQuestionPayload)({
|
|
27
27
|
chatSessionId: sessionId,
|
|
28
28
|
questionAnswerId: questionAnswerId,
|
|
29
29
|
question: {
|
|
@@ -39,8 +39,8 @@ const createSessionAndSubmitEpic = (actions$, _, zeniAPI) => actions$.pipe((0, o
|
|
|
39
39
|
messageSection: 'ai_cfo_create_session_and_submit',
|
|
40
40
|
messageText: 'failed',
|
|
41
41
|
type: 'error',
|
|
42
|
-
}), (0,
|
|
42
|
+
}), (0, aiCfoViewReducer_1.createSessionAndSubmitFailure)(response.status));
|
|
43
43
|
}
|
|
44
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0,
|
|
44
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.createSessionAndSubmitFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Create and Submit Session REST API call errored out: ${JSON.stringify(error)}`)))));
|
|
45
45
|
}));
|
|
46
46
|
exports.createSessionAndSubmitEpic = createSessionAndSubmitEpic;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { setNewSession } from '../../../entity/
|
|
3
|
+
import { setNewSession } from '../../../entity/aiCfo/aiCfoReducer';
|
|
4
4
|
import { RootState } from '../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
|
-
import { createSession, createSessionFailure, createSessionSuccess } from '../
|
|
6
|
+
import { createSession, createSessionFailure, createSessionSuccess } from '../aiCfoViewReducer';
|
|
7
7
|
export type ActionType = ReturnType<typeof createSession> | ReturnType<typeof setNewSession> | ReturnType<typeof createSessionSuccess> | ReturnType<typeof createSessionFailure>;
|
|
8
8
|
export declare const createSessionEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,29 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createSessionEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
6
|
+
const aiCfoReducer_1 = require("../../../entity/aiCfo/aiCfoReducer");
|
|
7
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
8
|
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
9
|
-
const
|
|
10
|
-
const createSessionEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(
|
|
9
|
+
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
10
|
+
const createSessionEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.createSession.match), (0, operators_1.switchMap)((action) => {
|
|
11
11
|
const { agentId, userId } = action.payload;
|
|
12
12
|
const payload = { agent_id: agentId };
|
|
13
13
|
return zeniAPI
|
|
14
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.
|
|
14
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/sessions`, payload)
|
|
15
15
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
16
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
17
|
-
return (0, rxjs_1.of)((0,
|
|
17
|
+
return (0, rxjs_1.of)((0, aiCfoReducer_1.setNewSession)({
|
|
18
18
|
chatSessionId: response.data.chat_session_id,
|
|
19
19
|
userId,
|
|
20
20
|
createdAt: (0, zeniDayJS_1.date)(response.data.created_at),
|
|
21
|
-
}), (0,
|
|
21
|
+
}), (0, aiCfoViewReducer_1.createSessionSuccess)({
|
|
22
22
|
agentId,
|
|
23
23
|
sessionId: response.data.chat_session_id,
|
|
24
24
|
}));
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
return (0, rxjs_1.of)((0,
|
|
27
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.createSessionFailure)(response.status));
|
|
28
28
|
}
|
|
29
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0,
|
|
29
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.createSessionFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Create Session REST API call errored out: ${JSON.stringify(error)}`)))));
|
|
30
30
|
}));
|
|
31
31
|
exports.createSessionEpic = createSessionEpic;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { setChatHistory } from '../../../entity/
|
|
3
|
+
import { setChatHistory } from '../../../entity/aiCfo/aiCfoReducer';
|
|
4
4
|
import { RootState } from '../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
|
-
import { fetchChatHistory, fetchChatHistoryFailure, fetchChatHistorySuccess } from '../
|
|
6
|
+
import { fetchChatHistory, fetchChatHistoryFailure, fetchChatHistorySuccess } from '../aiCfoViewReducer';
|
|
7
7
|
export type ActionType = ReturnType<typeof fetchChatHistory> | ReturnType<typeof setChatHistory> | ReturnType<typeof fetchChatHistorySuccess> | ReturnType<typeof fetchChatHistoryFailure>;
|
|
8
8
|
export declare const fetchChatHistoryEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fetchChatHistoryEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
6
|
+
const aiCfoReducer_1 = require("../../../entity/aiCfo/aiCfoReducer");
|
|
7
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
-
const
|
|
9
|
-
const fetchChatHistoryEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(
|
|
8
|
+
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
9
|
+
const fetchChatHistoryEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.fetchChatHistory.match), (0, operators_1.mergeMap)((action) => {
|
|
10
10
|
var _a, _b;
|
|
11
11
|
const { chatSessionId, userId } = action.payload;
|
|
12
12
|
const state = state$.value;
|
|
13
|
-
const pageToken = (_b = (_a = state.
|
|
13
|
+
const pageToken = (_b = (_a = state.aiCfoViewState.uiState.chatHistoryNextPageToken[chatSessionId]) === null || _a === void 0 ? void 0 : _a.nextPageToken) !== null && _b !== void 0 ? _b : null;
|
|
14
14
|
const queryParams = new URLSearchParams();
|
|
15
15
|
queryParams.append('page_size', '20');
|
|
16
16
|
queryParams.append('chat_session_id', chatSessionId);
|
|
@@ -19,26 +19,26 @@ const fetchChatHistoryEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, op
|
|
|
19
19
|
queryParams.append('page_token', pageToken);
|
|
20
20
|
}
|
|
21
21
|
return zeniAPI
|
|
22
|
-
.getJSON(`${zeniAPI.apiEndPoints.
|
|
22
|
+
.getJSON(`${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/history?${queryParams.toString()}`)
|
|
23
23
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
24
24
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
25
25
|
const isPaginationComplete = response.data.next_page_token == null;
|
|
26
|
-
return (0, rxjs_1.of)((0,
|
|
26
|
+
return (0, rxjs_1.of)((0, aiCfoReducer_1.setChatHistory)({
|
|
27
27
|
chatSessionId,
|
|
28
28
|
history: response.data.messages,
|
|
29
29
|
isPaginationComplete,
|
|
30
|
-
}), (0,
|
|
30
|
+
}), (0, aiCfoViewReducer_1.fetchChatHistorySuccess)({
|
|
31
31
|
chatSessionId,
|
|
32
32
|
nextPageToken: response.data.next_page_token,
|
|
33
33
|
}));
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
|
-
return (0, rxjs_1.of)((0,
|
|
36
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.fetchChatHistoryFailure)({
|
|
37
37
|
chatSessionId,
|
|
38
38
|
error: response.status,
|
|
39
39
|
}));
|
|
40
40
|
}
|
|
41
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0,
|
|
41
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.fetchChatHistoryFailure)({
|
|
42
42
|
chatSessionId,
|
|
43
43
|
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Chat History REST API call errored out' +
|
|
44
44
|
JSON.stringify(error)),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { setSessions } from '../../../entity/
|
|
3
|
+
import { setSessions } from '../../../entity/aiCfo/aiCfoReducer';
|
|
4
4
|
import { RootState } from '../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
|
-
import { fetchChatSessionsForUser, fetchChatSessionsForUserFailure, fetchChatSessionsForUserSuccess } from '../
|
|
6
|
+
import { fetchChatSessionsForUser, fetchChatSessionsForUserFailure, fetchChatSessionsForUserSuccess } from '../aiCfoViewReducer';
|
|
7
7
|
export type ActionType = ReturnType<typeof fetchChatSessionsForUser> | ReturnType<typeof setSessions> | ReturnType<typeof fetchChatSessionsForUserSuccess> | ReturnType<typeof fetchChatSessionsForUserFailure>;
|
|
8
8
|
export declare const fetchChatSessionsForUserEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,34 +3,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fetchChatSessionsForUserEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
6
|
+
const aiCfoReducer_1 = require("../../../entity/aiCfo/aiCfoReducer");
|
|
7
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
-
const
|
|
9
|
-
const fetchChatSessionsForUserEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(
|
|
8
|
+
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
9
|
+
const fetchChatSessionsForUserEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.fetchChatSessionsForUser.match), (0, operators_1.switchMap)(() => {
|
|
10
10
|
var _a;
|
|
11
11
|
const state = state$.value;
|
|
12
|
-
const pageToken = (_a = state.
|
|
13
|
-
.nextPageToken) !== null && _a !== void 0 ? _a : null;
|
|
12
|
+
const pageToken = (_a = state.aiCfoViewState.uiState.chatSessionsNextPageToken.nextPageToken) !== null && _a !== void 0 ? _a : null;
|
|
14
13
|
const queryParams = new URLSearchParams();
|
|
15
14
|
queryParams.append('page_size', '50');
|
|
16
15
|
if (pageToken != null) {
|
|
17
16
|
queryParams.append('page_token', pageToken);
|
|
18
17
|
}
|
|
19
18
|
return zeniAPI
|
|
20
|
-
.getJSON(`${zeniAPI.apiEndPoints.
|
|
19
|
+
.getJSON(`${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/sessions?${queryParams.toString()}`)
|
|
21
20
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
22
21
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
23
22
|
// Filter out empty sessions that don't have a summary
|
|
24
23
|
const sessions = response.data.sessions.filter((session) => Boolean(session.chat_session_summary) === true);
|
|
25
|
-
return (0, rxjs_1.of)((0,
|
|
24
|
+
return (0, rxjs_1.of)((0, aiCfoReducer_1.setSessions)(sessions), (0, aiCfoViewReducer_1.fetchChatSessionsForUserSuccess)({
|
|
26
25
|
sessions,
|
|
27
26
|
nextPageToken: response.data.next_page_token,
|
|
28
27
|
}));
|
|
29
28
|
}
|
|
30
29
|
else {
|
|
31
|
-
return (0, rxjs_1.of)((0,
|
|
30
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.fetchChatSessionsForUserFailure)(response.status));
|
|
32
31
|
}
|
|
33
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0,
|
|
32
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.fetchChatSessionsForUserFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Chat Sessions for User REST API call errored out' +
|
|
34
33
|
JSON.stringify(error))))));
|
|
35
34
|
}));
|
|
36
35
|
exports.fetchChatSessionsForUserEpic = fetchChatSessionsForUserEpic;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { deleteQuestion } from '../../../entity/
|
|
3
|
+
import { deleteQuestion } from '../../../entity/aiCfo/aiCfoReducer';
|
|
4
4
|
import { RootState } from '../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
|
-
import { stopSubmit, stopSubmitFailure, stopSubmitSuccess } from '../
|
|
6
|
+
import { stopSubmit, stopSubmitFailure, stopSubmitSuccess } from '../aiCfoViewReducer';
|
|
7
7
|
export type ActionType = ReturnType<typeof stopSubmit> | ReturnType<typeof deleteQuestion> | ReturnType<typeof stopSubmitSuccess> | ReturnType<typeof stopSubmitFailure>;
|
|
8
8
|
export declare const stopSubmitEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.stopSubmitEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
6
|
+
const aiCfoReducer_1 = require("../../../entity/aiCfo/aiCfoReducer");
|
|
7
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
-
const
|
|
9
|
-
const stopSubmitEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(
|
|
8
|
+
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
9
|
+
const stopSubmitEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.stopSubmit.match), (0, operators_1.switchMap)((action) => {
|
|
10
10
|
const { chatSessionId } = action.payload;
|
|
11
11
|
// Find the questionId: last Q/A with no responses
|
|
12
12
|
const state = state$.value;
|
|
13
|
-
const session = state.
|
|
13
|
+
const session = state.aiCfoState.aiCfoByChatSessionId[chatSessionId];
|
|
14
14
|
if (session == null) {
|
|
15
|
-
return (0, rxjs_1.of)((0,
|
|
15
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.stopSubmitFailure)({
|
|
16
16
|
chatSessionId,
|
|
17
17
|
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Session not found'),
|
|
18
18
|
}));
|
|
@@ -24,29 +24,29 @@ const stopSubmitEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
24
24
|
questionAnswer.responses.answer == null);
|
|
25
25
|
const isOnlyQuestionInSession = session.questionAnswers.length <= 1;
|
|
26
26
|
if (!qa) {
|
|
27
|
-
return (0, rxjs_1.of)((0,
|
|
27
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.stopSubmitFailure)({
|
|
28
28
|
chatSessionId,
|
|
29
29
|
error: { code: 404, message: 'No pending question found' },
|
|
30
30
|
}));
|
|
31
31
|
}
|
|
32
32
|
const questionId = qa.question.messageId;
|
|
33
33
|
return zeniAPI
|
|
34
|
-
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.
|
|
34
|
+
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/messages/${questionId}`)
|
|
35
35
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
36
36
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
37
|
-
return (0, rxjs_1.of)((0,
|
|
37
|
+
return (0, rxjs_1.of)((0, aiCfoReducer_1.deleteQuestion)({
|
|
38
38
|
chatSessionId,
|
|
39
39
|
questionAnswerId: qa.questionAnswerId,
|
|
40
|
-
}), (0,
|
|
40
|
+
}), (0, aiCfoViewReducer_1.stopSubmitSuccess)({
|
|
41
41
|
chatSessionId,
|
|
42
42
|
question: qa.question.questionText,
|
|
43
43
|
isOnlyQuestionInSession,
|
|
44
44
|
}));
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
return (0, rxjs_1.of)((0,
|
|
47
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.stopSubmitFailure)({ chatSessionId, error: response.status }));
|
|
48
48
|
}
|
|
49
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0,
|
|
49
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.stopSubmitFailure)({
|
|
50
50
|
chatSessionId,
|
|
51
51
|
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Stop submit REST API call errored out' +
|
|
52
52
|
JSON.stringify(error)),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { deleteQuestion } from '../../../entity/
|
|
3
|
+
import { deleteQuestion } from '../../../entity/aiCfo/aiCfoReducer';
|
|
4
4
|
import { RootState } from '../../../reducer';
|
|
5
|
-
import { stopSubmitQuestion, stopSubmitQuestionFailure, stopSubmitQuestionSuccess } from '../
|
|
5
|
+
import { stopSubmitQuestion, stopSubmitQuestionFailure, stopSubmitQuestionSuccess } from '../aiCfoViewReducer';
|
|
6
6
|
export type ActionType = ReturnType<typeof stopSubmitQuestion> | ReturnType<typeof deleteQuestion> | ReturnType<typeof stopSubmitQuestionSuccess> | ReturnType<typeof stopSubmitQuestionFailure>;
|
|
7
7
|
export declare const stopSubmitQuestionEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.stopSubmitQuestionEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
6
|
+
const aiCfoReducer_1 = require("../../../entity/aiCfo/aiCfoReducer");
|
|
7
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
-
const
|
|
9
|
-
const stopSubmitQuestionEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(
|
|
8
|
+
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
9
|
+
const stopSubmitQuestionEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.stopSubmitQuestion.match), (0, operators_1.delay)(500), (0, operators_1.switchMap)((action) => {
|
|
10
10
|
const { chatSessionId } = action.payload;
|
|
11
11
|
// Find the questionId: last Q/A with no responses
|
|
12
12
|
const state = state$.value;
|
|
13
|
-
const session = state.
|
|
13
|
+
const session = state.aiCfoState.aiCfoByChatSessionId[chatSessionId];
|
|
14
14
|
if (session == null) {
|
|
15
|
-
return (0, rxjs_1.of)((0,
|
|
15
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.stopSubmitQuestionFailure)({
|
|
16
16
|
chatSessionId,
|
|
17
17
|
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Session not found'),
|
|
18
18
|
}));
|
|
@@ -24,15 +24,15 @@ const stopSubmitQuestionEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
24
24
|
questionAnswer.responses.answer == null);
|
|
25
25
|
const isOnlyQuestionInSession = session.questionAnswers.length <= 1;
|
|
26
26
|
if (!qa) {
|
|
27
|
-
return (0, rxjs_1.of)((0,
|
|
27
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.stopSubmitQuestionFailure)({
|
|
28
28
|
chatSessionId,
|
|
29
29
|
error: { code: 404, message: 'No pending question found' },
|
|
30
30
|
}));
|
|
31
31
|
}
|
|
32
|
-
return (0, rxjs_1.of)((0,
|
|
32
|
+
return (0, rxjs_1.of)((0, aiCfoReducer_1.deleteQuestion)({
|
|
33
33
|
chatSessionId,
|
|
34
34
|
questionAnswerId: qa.questionAnswerId,
|
|
35
|
-
}), (0,
|
|
35
|
+
}), (0, aiCfoViewReducer_1.stopSubmitQuestionSuccess)({
|
|
36
36
|
chatSessionId,
|
|
37
37
|
question: qa.question.questionText,
|
|
38
38
|
isOnlyQuestionInSession,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { upsertOrAddQuestionAnswerPayload } from '../../../entity/
|
|
3
|
+
import { upsertOrAddQuestionAnswerPayload } from '../../../entity/aiCfo/aiCfoReducer';
|
|
4
4
|
import { RootState } from '../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
|
-
import { submitQuestion, submitQuestionFailure, submitQuestionSuccess } from '../
|
|
6
|
+
import { submitQuestion, submitQuestionFailure, submitQuestionSuccess } from '../aiCfoViewReducer';
|
|
7
7
|
export type ActionType = ReturnType<typeof submitQuestion> | ReturnType<typeof submitQuestionSuccess> | ReturnType<typeof submitQuestionFailure> | ReturnType<typeof upsertOrAddQuestionAnswerPayload>;
|
|
8
8
|
export declare const submitQuestionEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|