@zeniai/client-epic-state 4.19.90-beta0AD → 4.19.90-beta1AD
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/esm/index.js +1 -1
- package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +17 -18
- package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +5 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +3 -3
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +3 -3
- package/lib/view/aiCfoView/aiCfoViewReducer.js +18 -19
- package/lib/view/aiCfoView/aiCfoViewState.d.ts +5 -6
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +4 -1
- package/package.json +1 -1
|
@@ -99,10 +99,10 @@ export declare const submitQuestion: import("@reduxjs/toolkit").ActionCreatorWit
|
|
|
99
99
|
}, "aiCfoView/fetchSuggestedQuestionsSuccess">, fetchSuggestedQuestionsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
100
100
|
error: ZeniAPIStatus;
|
|
101
101
|
pageContext: AiCfoSuggestedQuestionsPageContext;
|
|
102
|
-
}, "aiCfoView/fetchSuggestedQuestionsFailure">,
|
|
103
|
-
|
|
102
|
+
}, "aiCfoView/fetchSuggestedQuestionsFailure">, applyAiCfoSidePanelHostPageTransition: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
103
|
+
newAiCfoSidePanelHostPageKey: string;
|
|
104
104
|
/** When omitted or null, clears the active session (empty / suggested questions). */
|
|
105
105
|
nextCurrentChatSessionId?: ID | null;
|
|
106
|
-
}, "aiCfoView/
|
|
106
|
+
}, "aiCfoView/applyAiCfoSidePanelHostPageTransition">, clearAiCfoSidePanelHostPageContext: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfoView/clearAiCfoSidePanelHostPageContext">;
|
|
107
107
|
declare const _default: import("redux").Reducer<AiCfoViewState>;
|
|
108
108
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.clearAiCfoSidePanelHostPageContext = exports.applyAiCfoSidePanelHostPageTransition = exports.fetchSuggestedQuestionsFailure = exports.fetchSuggestedQuestionsSuccess = exports.fetchSuggestedQuestions = exports.updateCotCollapsedState = exports.clearAiCfoView = exports.clearDeleteChatSessionStatus = exports.deleteChatSessionFailure = exports.deleteChatSessionSuccess = exports.deleteChatSession = exports.acceptMasterTOSFailure = exports.acceptMasterTOSSuccess = exports.acceptMasterTOS = exports.stopSubmitQuestionFailure = exports.stopSubmitQuestionSuccess = exports.stopSubmitQuestion = exports.stopSubmitFailure = exports.stopSubmitSuccess = exports.stopSubmit = exports.clearLastContextMessage = exports.clearCurrentSessionId = exports.fetchChatHistoryFailure = exports.fetchChatHistorySuccess = exports.fetchChatHistory = exports.fetchChatSessionsForUserFailure = exports.fetchChatSessionsForUserSuccess = exports.fetchChatSessionsForUser = exports.createSessionAndSubmitFailure = exports.createSessionAndSubmitSuccess = exports.initializeNewSessionState = 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
6
|
function removeSessionIdFromPageKeyMap(draft, sessionId) {
|
|
7
7
|
const map = draft.uiState.chatSessionIdByPageKey;
|
|
@@ -12,7 +12,7 @@ function removeSessionIdFromPageKeyMap(draft, sessionId) {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
function mirrorCurrentSessionToPageKeyMapIfActive(draft) {
|
|
15
|
-
const key = draft.uiState.
|
|
15
|
+
const key = draft.uiState.aiCfoSidePanelHostPageKey;
|
|
16
16
|
const sessionId = draft.uiState.currentChatSessionId;
|
|
17
17
|
if (key != null && sessionId != null) {
|
|
18
18
|
draft.uiState.chatSessionIdByPageKey[key] = sessionId;
|
|
@@ -25,7 +25,7 @@ exports.initialAiCfoViewState = {
|
|
|
25
25
|
currentInput: '',
|
|
26
26
|
scrollPositionByChatSessionId: {},
|
|
27
27
|
currentChatSessionId: undefined,
|
|
28
|
-
|
|
28
|
+
aiCfoSidePanelHostPageKey: undefined,
|
|
29
29
|
chatSessionIdByPageKey: {},
|
|
30
30
|
agentId: undefined,
|
|
31
31
|
chatHistoryNextPageToken: {},
|
|
@@ -386,34 +386,33 @@ const aiCfoView = (0, toolkit_1.createSlice)({
|
|
|
386
386
|
},
|
|
387
387
|
clearCurrentSessionId(draft) {
|
|
388
388
|
draft.uiState.currentChatSessionId = undefined;
|
|
389
|
-
const key = draft.uiState.
|
|
389
|
+
const key = draft.uiState.aiCfoSidePanelHostPageKey;
|
|
390
390
|
if (key != null) {
|
|
391
391
|
delete draft.uiState.chatSessionIdByPageKey[key];
|
|
392
392
|
}
|
|
393
393
|
},
|
|
394
|
-
|
|
395
|
-
const {
|
|
396
|
-
const prevKey = draft.uiState.
|
|
394
|
+
applyAiCfoSidePanelHostPageTransition(draft, action) {
|
|
395
|
+
const { newAiCfoSidePanelHostPageKey, nextCurrentChatSessionId } = action.payload;
|
|
396
|
+
const prevKey = draft.uiState.aiCfoSidePanelHostPageKey;
|
|
397
397
|
const curId = draft.uiState.currentChatSessionId;
|
|
398
|
-
if (prevKey != null &&
|
|
398
|
+
if (prevKey != null &&
|
|
399
|
+
prevKey !== newAiCfoSidePanelHostPageKey &&
|
|
400
|
+
curId != null) {
|
|
399
401
|
draft.uiState.chatSessionIdByPageKey[prevKey] = curId;
|
|
400
402
|
}
|
|
401
|
-
draft.uiState.
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
}
|
|
405
|
-
else {
|
|
406
|
-
draft.uiState.currentChatSessionId = nextCurrentChatSessionId;
|
|
407
|
-
}
|
|
403
|
+
draft.uiState.aiCfoSidePanelHostPageKey = newAiCfoSidePanelHostPageKey;
|
|
404
|
+
draft.uiState.currentChatSessionId =
|
|
405
|
+
nextCurrentChatSessionId != null ? nextCurrentChatSessionId : undefined;
|
|
408
406
|
draft.uiState.currentInput = '';
|
|
407
|
+
mirrorCurrentSessionToPageKeyMapIfActive(draft);
|
|
409
408
|
},
|
|
410
|
-
|
|
411
|
-
const key = draft.uiState.
|
|
409
|
+
clearAiCfoSidePanelHostPageContext(draft) {
|
|
410
|
+
const key = draft.uiState.aiCfoSidePanelHostPageKey;
|
|
412
411
|
const curId = draft.uiState.currentChatSessionId;
|
|
413
412
|
if (key != null && curId != null) {
|
|
414
413
|
draft.uiState.chatSessionIdByPageKey[key] = curId;
|
|
415
414
|
}
|
|
416
|
-
draft.uiState.
|
|
415
|
+
draft.uiState.aiCfoSidePanelHostPageKey = undefined;
|
|
417
416
|
},
|
|
418
417
|
fetchSuggestedQuestions(draft, action) {
|
|
419
418
|
const { pageContext } = action.payload;
|
|
@@ -457,5 +456,5 @@ const aiCfoView = (0, toolkit_1.createSlice)({
|
|
|
457
456
|
},
|
|
458
457
|
},
|
|
459
458
|
});
|
|
460
|
-
_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.initializeNewSessionState = _a.initializeNewSessionState, 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.clearLastContextMessage = _a.clearLastContextMessage, 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.acceptMasterTOS = _a.acceptMasterTOS, exports.acceptMasterTOSSuccess = _a.acceptMasterTOSSuccess, exports.acceptMasterTOSFailure = _a.acceptMasterTOSFailure, exports.deleteChatSession = _a.deleteChatSession, exports.deleteChatSessionSuccess = _a.deleteChatSessionSuccess, exports.deleteChatSessionFailure = _a.deleteChatSessionFailure, exports.clearDeleteChatSessionStatus = _a.clearDeleteChatSessionStatus, exports.clearAiCfoView = _a.clearAiCfoView, exports.updateCotCollapsedState = _a.updateCotCollapsedState, exports.fetchSuggestedQuestions = _a.fetchSuggestedQuestions, exports.fetchSuggestedQuestionsSuccess = _a.fetchSuggestedQuestionsSuccess, exports.fetchSuggestedQuestionsFailure = _a.fetchSuggestedQuestionsFailure, exports.
|
|
459
|
+
_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.initializeNewSessionState = _a.initializeNewSessionState, 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.clearLastContextMessage = _a.clearLastContextMessage, 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.acceptMasterTOS = _a.acceptMasterTOS, exports.acceptMasterTOSSuccess = _a.acceptMasterTOSSuccess, exports.acceptMasterTOSFailure = _a.acceptMasterTOSFailure, exports.deleteChatSession = _a.deleteChatSession, exports.deleteChatSessionSuccess = _a.deleteChatSessionSuccess, exports.deleteChatSessionFailure = _a.deleteChatSessionFailure, exports.clearDeleteChatSessionStatus = _a.clearDeleteChatSessionStatus, exports.clearAiCfoView = _a.clearAiCfoView, exports.updateCotCollapsedState = _a.updateCotCollapsedState, exports.fetchSuggestedQuestions = _a.fetchSuggestedQuestions, exports.fetchSuggestedQuestionsSuccess = _a.fetchSuggestedQuestionsSuccess, exports.fetchSuggestedQuestionsFailure = _a.fetchSuggestedQuestionsFailure, exports.applyAiCfoSidePanelHostPageTransition = _a.applyAiCfoSidePanelHostPageTransition, exports.clearAiCfoSidePanelHostPageContext = _a.clearAiCfoSidePanelHostPageContext;
|
|
461
460
|
exports.default = aiCfoView.reducer;
|
|
@@ -9,7 +9,7 @@ export interface AiCfoViewUIState {
|
|
|
9
9
|
chatHistoryNextPageToken: {
|
|
10
10
|
[chatSessionId: ID]: PageTokenState;
|
|
11
11
|
};
|
|
12
|
-
/** Last focused chat session id per
|
|
12
|
+
/** Last focused chat session id per side-panel host page key (e.g. `dashboard`, `reports:profit_loss`). */
|
|
13
13
|
chatSessionIdByPageKey: Partial<Record<string, ID>>;
|
|
14
14
|
chatSessionsFirstPageFetched: boolean;
|
|
15
15
|
chatSessionsNextPageToken: PageTokenState;
|
|
@@ -22,13 +22,12 @@ export interface AiCfoViewUIState {
|
|
|
22
22
|
scrollTop: number;
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
|
-
agentId?: ID;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* When set, the embedded panel (e.g. dashboard/reports) is scoped to this **page key**;
|
|
25
|
+
agentId?: ID; /**
|
|
26
|
+
* When set, the side panel on host routes (e.g. dashboard/reports) is scoped to this **page key**;
|
|
29
27
|
* session ids are mirrored into {@link chatSessionIdByPageKey}. Full `/ai-cfo/...` should clear this.
|
|
30
28
|
*/
|
|
31
|
-
|
|
29
|
+
aiCfoSidePanelHostPageKey?: string;
|
|
30
|
+
currentChatSessionId?: ID;
|
|
32
31
|
lastContextMessage?: string;
|
|
33
32
|
lastContextStatus?: ContextStatus;
|
|
34
33
|
}
|
|
@@ -6,7 +6,10 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const responsePayload_1 = require("../../../responsePayload");
|
|
7
7
|
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
8
8
|
/** GET {aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?page_context=... */
|
|
9
|
-
const fetchSuggestedQuestionsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.fetchSuggestedQuestions.match),
|
|
9
|
+
const fetchSuggestedQuestionsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.fetchSuggestedQuestions.match),
|
|
10
|
+
// mergeMap (not switchMap): each page_context is keyed separately in Redux; switchMap
|
|
11
|
+
// would cancel in-flight HTTP for context A when B is requested, leaving A stuck In-Progress.
|
|
12
|
+
(0, operators_1.mergeMap)((action) => {
|
|
10
13
|
const { pageContext } = action.payload;
|
|
11
14
|
const query = new URLSearchParams({ page_context: pageContext });
|
|
12
15
|
const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?${query.toString()}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.19.90-
|
|
3
|
+
"version": "4.19.90-beta1AD",
|
|
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",
|