@zeniai/client-epic-state 4.19.90-betaSS4 → 4.19.90-betaSS6
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/aiCfoSelector.d.ts +1 -2
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +35 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +44 -0
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -1
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +2 -1
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +13 -0
- package/lib/entity/reimbursement/reimbursementPayload.d.ts +1 -1
- package/lib/entity/reimbursement/reimbursementPayload.js +1 -1
- package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +3 -0
- package/lib/entity/transaction/payloadTypes/transactionPayload.js +11 -0
- package/lib/entity/transaction/stateTypes/transaction.d.ts +3 -0
- package/lib/epic.d.ts +2 -1
- package/lib/epic.js +2 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +44 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -1
- package/lib/esm/entity/reimbursement/reimbursementPayload.js +1 -1
- package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +11 -0
- package/lib/esm/epic.js +2 -1
- package/lib/esm/index.js +6 -5
- package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +82 -1
- package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +8 -2
- package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +29 -0
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +17 -1
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +50 -3
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +17 -1
- package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +10 -0
- package/lib/esm/view/spendManagement/billPay/billList/billListState.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
- package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
- package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
- package/lib/index.d.ts +11 -8
- package/lib/index.js +41 -32
- package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +7 -0
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +15 -1
- package/lib/view/aiCfoView/aiCfoViewReducer.js +83 -2
- package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +4 -1
- package/lib/view/aiCfoView/aiCfoViewSelector.js +9 -2
- package/lib/view/aiCfoView/aiCfoViewState.d.ts +18 -1
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -0
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +33 -0
- package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +18 -2
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +2 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +50 -3
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +5 -0
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +19 -0
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -0
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.js +1 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -0
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
- package/package.json +2 -2
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
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;
|
|
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
|
+
function removeSessionIdFromPageKeyMap(draft, sessionId) {
|
|
7
|
+
const map = draft.uiState.chatSessionIdByPageKey;
|
|
8
|
+
for (const key of Object.keys(map)) {
|
|
9
|
+
if (map[key] === sessionId) {
|
|
10
|
+
delete map[key];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function mirrorCurrentSessionToPageKeyMapIfActive(draft) {
|
|
15
|
+
const key = draft.uiState.aiCfoSidePanelHostPageKey;
|
|
16
|
+
const sessionId = draft.uiState.currentChatSessionId;
|
|
17
|
+
if (key != null && sessionId != null) {
|
|
18
|
+
draft.uiState.chatSessionIdByPageKey[key] = sessionId;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
6
21
|
exports.initialAiCfoViewState = {
|
|
7
22
|
fetchState: 'Not-Started',
|
|
8
23
|
error: undefined,
|
|
@@ -10,6 +25,8 @@ exports.initialAiCfoViewState = {
|
|
|
10
25
|
currentInput: '',
|
|
11
26
|
scrollPositionByChatSessionId: {},
|
|
12
27
|
currentChatSessionId: undefined,
|
|
28
|
+
aiCfoSidePanelHostPageKey: undefined,
|
|
29
|
+
chatSessionIdByPageKey: {},
|
|
13
30
|
agentId: undefined,
|
|
14
31
|
chatHistoryNextPageToken: {},
|
|
15
32
|
chatSessionsNextPageToken: { nextPageToken: null, hasMore: false },
|
|
@@ -33,6 +50,7 @@ exports.initialAiCfoViewState = {
|
|
|
33
50
|
fetchChatSessionHistoryByChatSessionId: {},
|
|
34
51
|
responseStateByChatSessionId: {},
|
|
35
52
|
stopSubmitStateByChatSessionId: {},
|
|
53
|
+
suggestedQuestionsByPageContext: {},
|
|
36
54
|
};
|
|
37
55
|
const aiCfoView = (0, toolkit_1.createSlice)({
|
|
38
56
|
name: 'aiCfoView',
|
|
@@ -166,6 +184,7 @@ const aiCfoView = (0, toolkit_1.createSlice)({
|
|
|
166
184
|
setSession(draft, action) {
|
|
167
185
|
draft.uiState.currentChatSessionId = action.payload.sessionId;
|
|
168
186
|
draft.uiState.agentId = action.payload.agentId;
|
|
187
|
+
mirrorCurrentSessionToPageKeyMapIfActive(draft);
|
|
169
188
|
},
|
|
170
189
|
createSession: {
|
|
171
190
|
reducer(draft, action) {
|
|
@@ -189,6 +208,7 @@ const aiCfoView = (0, toolkit_1.createSlice)({
|
|
|
189
208
|
nextPageToken: null,
|
|
190
209
|
hasMore: false,
|
|
191
210
|
};
|
|
211
|
+
mirrorCurrentSessionToPageKeyMapIfActive(draft);
|
|
192
212
|
},
|
|
193
213
|
createSessionFailure(draft, action) {
|
|
194
214
|
draft.createSessionState.fetchState = 'Error';
|
|
@@ -226,6 +246,7 @@ const aiCfoView = (0, toolkit_1.createSlice)({
|
|
|
226
246
|
nextPageToken: null,
|
|
227
247
|
hasMore: false,
|
|
228
248
|
};
|
|
249
|
+
mirrorCurrentSessionToPageKeyMapIfActive(draft);
|
|
229
250
|
},
|
|
230
251
|
createSessionAndSubmitSuccess(draft) {
|
|
231
252
|
// Note: currentChatSessionId, agentId, and chatHistoryNextPageToken are set by initializeNewSessionState
|
|
@@ -342,6 +363,7 @@ const aiCfoView = (0, toolkit_1.createSlice)({
|
|
|
342
363
|
draft.uiState.currentChatSessionId = undefined;
|
|
343
364
|
draft.uiState.agentId = undefined;
|
|
344
365
|
}
|
|
366
|
+
removeSessionIdFromPageKeyMap(draft, chatSessionId);
|
|
345
367
|
delete draft.uiState.chatHistoryNextPageToken[chatSessionId];
|
|
346
368
|
delete draft.uiState.scrollPositionByChatSessionId[chatSessionId];
|
|
347
369
|
delete draft.fetchChatSessionHistoryByChatSessionId[chatSessionId];
|
|
@@ -364,6 +386,65 @@ const aiCfoView = (0, toolkit_1.createSlice)({
|
|
|
364
386
|
},
|
|
365
387
|
clearCurrentSessionId(draft) {
|
|
366
388
|
draft.uiState.currentChatSessionId = undefined;
|
|
389
|
+
const key = draft.uiState.aiCfoSidePanelHostPageKey;
|
|
390
|
+
if (key != null) {
|
|
391
|
+
delete draft.uiState.chatSessionIdByPageKey[key];
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
applyAiCfoSidePanelHostPageTransition(draft, action) {
|
|
395
|
+
const { newAiCfoSidePanelHostPageKey, nextCurrentChatSessionId } = action.payload;
|
|
396
|
+
const prevKey = draft.uiState.aiCfoSidePanelHostPageKey;
|
|
397
|
+
const curId = draft.uiState.currentChatSessionId;
|
|
398
|
+
if (prevKey != null &&
|
|
399
|
+
prevKey !== newAiCfoSidePanelHostPageKey &&
|
|
400
|
+
curId != null) {
|
|
401
|
+
draft.uiState.chatSessionIdByPageKey[prevKey] = curId;
|
|
402
|
+
}
|
|
403
|
+
draft.uiState.aiCfoSidePanelHostPageKey = newAiCfoSidePanelHostPageKey;
|
|
404
|
+
draft.uiState.currentChatSessionId =
|
|
405
|
+
nextCurrentChatSessionId != null ? nextCurrentChatSessionId : undefined;
|
|
406
|
+
draft.uiState.currentInput = '';
|
|
407
|
+
mirrorCurrentSessionToPageKeyMapIfActive(draft);
|
|
408
|
+
},
|
|
409
|
+
clearAiCfoSidePanelHostPageContext(draft) {
|
|
410
|
+
const key = draft.uiState.aiCfoSidePanelHostPageKey;
|
|
411
|
+
const curId = draft.uiState.currentChatSessionId;
|
|
412
|
+
if (key != null && curId != null) {
|
|
413
|
+
draft.uiState.chatSessionIdByPageKey[key] = curId;
|
|
414
|
+
}
|
|
415
|
+
draft.uiState.aiCfoSidePanelHostPageKey = undefined;
|
|
416
|
+
},
|
|
417
|
+
fetchSuggestedQuestions(draft, action) {
|
|
418
|
+
const { pageContext } = action.payload;
|
|
419
|
+
const prev = draft.suggestedQuestionsByPageContext[pageContext];
|
|
420
|
+
draft.suggestedQuestionsByPageContext[pageContext] = {
|
|
421
|
+
fetchState: 'In-Progress',
|
|
422
|
+
pageContext,
|
|
423
|
+
suggestedQuestions: prev?.suggestedQuestions ?? [],
|
|
424
|
+
generatedAt: prev?.generatedAt,
|
|
425
|
+
error: undefined,
|
|
426
|
+
};
|
|
427
|
+
},
|
|
428
|
+
fetchSuggestedQuestionsSuccess(draft, action) {
|
|
429
|
+
const { pageContext, generatedAt, suggestedQuestions } = action.payload;
|
|
430
|
+
draft.suggestedQuestionsByPageContext[pageContext] = {
|
|
431
|
+
fetchState: 'Completed',
|
|
432
|
+
pageContext,
|
|
433
|
+
generatedAt,
|
|
434
|
+
suggestedQuestions,
|
|
435
|
+
error: undefined,
|
|
436
|
+
};
|
|
437
|
+
},
|
|
438
|
+
fetchSuggestedQuestionsFailure(draft, action) {
|
|
439
|
+
const { pageContext, error } = action.payload;
|
|
440
|
+
const prev = draft.suggestedQuestionsByPageContext[pageContext];
|
|
441
|
+
draft.suggestedQuestionsByPageContext[pageContext] = {
|
|
442
|
+
fetchState: 'Error',
|
|
443
|
+
pageContext,
|
|
444
|
+
suggestedQuestions: prev?.suggestedQuestions ?? [],
|
|
445
|
+
generatedAt: prev?.generatedAt,
|
|
446
|
+
error,
|
|
447
|
+
};
|
|
367
448
|
},
|
|
368
449
|
clearAiCfoView(draft) {
|
|
369
450
|
Object.assign(draft, exports.initialAiCfoViewState);
|
|
@@ -375,5 +456,5 @@ const aiCfoView = (0, toolkit_1.createSlice)({
|
|
|
375
456
|
},
|
|
376
457
|
},
|
|
377
458
|
});
|
|
378
|
-
_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;
|
|
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;
|
|
379
460
|
exports.default = aiCfoView.reducer;
|
|
@@ -3,7 +3,8 @@ import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
|
3
3
|
import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
4
|
import { AiCfoSelectorView } from '../../entity/aiCfo/aiCfoSelector';
|
|
5
5
|
import { RootState } from '../../reducer';
|
|
6
|
-
import {
|
|
6
|
+
import { AiCfoSuggestedQuestionsPageContext } from './aiCfoViewState';
|
|
7
|
+
import { AiCfoViewUIState, SuggestedQuestionsForPageContext } from './aiCfoViewState';
|
|
7
8
|
export interface AiCfoViewSelector extends SelectorView, AiCfoSelectorView {
|
|
8
9
|
createSessionAndSubmitState: FetchStateAndError;
|
|
9
10
|
createSessionState: FetchStateAndError;
|
|
@@ -17,6 +18,8 @@ export interface AiCfoViewSelector extends SelectorView, AiCfoSelectorView {
|
|
|
17
18
|
thought: FetchStateAndError;
|
|
18
19
|
}>;
|
|
19
20
|
stopSubmitStateByChatSessionId: Record<ID, FetchStateAndError>;
|
|
21
|
+
suggestedQuestionsByPageContext: Partial<Record<AiCfoSuggestedQuestionsPageContext, SuggestedQuestionsForPageContext>>;
|
|
20
22
|
uiState: AiCfoViewUIState;
|
|
21
23
|
}
|
|
22
24
|
export declare const getAiCfoView: (state: RootState) => AiCfoViewSelector;
|
|
25
|
+
export declare function getSuggestedQuestionsForPageContext(state: RootState, pageContext: AiCfoSuggestedQuestionsPageContext): SuggestedQuestionsForPageContext | undefined;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAiCfoView = void 0;
|
|
4
|
+
exports.getSuggestedQuestionsForPageContext = getSuggestedQuestionsForPageContext;
|
|
5
|
+
const aiCfoReducer_1 = require("../../entity/aiCfo/aiCfoReducer");
|
|
4
6
|
const aiCfoSelector_1 = require("../../entity/aiCfo/aiCfoSelector");
|
|
7
|
+
const aiCfoViewReducer_1 = require("./aiCfoViewReducer");
|
|
5
8
|
const getAiCfoView = (state) => {
|
|
6
|
-
const { fetchState, error, uiState, createSessionState, createSessionAndSubmitState, deleteChatSessionStateByChatSessionId, stopSubmitStateByChatSessionId, responseStateByChatSessionId, fetchChatSessionHistoryByChatSessionId, masterTOSAcceptanceState, } = state.aiCfoViewState;
|
|
9
|
+
const { fetchState, error, uiState, createSessionState, createSessionAndSubmitState, deleteChatSessionStateByChatSessionId, stopSubmitStateByChatSessionId, responseStateByChatSessionId, fetchChatSessionHistoryByChatSessionId, masterTOSAcceptanceState, suggestedQuestionsByPageContext, } = state.aiCfoViewState ?? aiCfoViewReducer_1.initialAiCfoViewState;
|
|
7
10
|
return {
|
|
8
11
|
fetchState,
|
|
9
12
|
error,
|
|
@@ -15,8 +18,12 @@ const getAiCfoView = (state) => {
|
|
|
15
18
|
uiState,
|
|
16
19
|
fetchChatSessionHistoryByChatSessionId,
|
|
17
20
|
masterTOSAcceptanceState,
|
|
18
|
-
|
|
21
|
+
suggestedQuestionsByPageContext,
|
|
22
|
+
...(0, aiCfoSelector_1.getAiCfoSelectorView)(state.aiCfoState ?? aiCfoReducer_1.initialAiCfoState),
|
|
19
23
|
version: 1,
|
|
20
24
|
};
|
|
21
25
|
};
|
|
22
26
|
exports.getAiCfoView = getAiCfoView;
|
|
27
|
+
function getSuggestedQuestionsForPageContext(state, pageContext) {
|
|
28
|
+
return state.aiCfoViewState?.suggestedQuestionsByPageContext?.[pageContext];
|
|
29
|
+
}
|
|
@@ -9,6 +9,8 @@ export interface AiCfoViewUIState {
|
|
|
9
9
|
chatHistoryNextPageToken: {
|
|
10
10
|
[chatSessionId: ID]: PageTokenState;
|
|
11
11
|
};
|
|
12
|
+
/** Last focused chat session id per side-panel host page key (e.g. `dashboard`, `reports:profit_loss`). */
|
|
13
|
+
chatSessionIdByPageKey: Partial<Record<string, ID>>;
|
|
12
14
|
chatSessionsFirstPageFetched: boolean;
|
|
13
15
|
chatSessionsNextPageToken: PageTokenState;
|
|
14
16
|
cotCollapsedByQuestionAnswerId: {
|
|
@@ -20,11 +22,24 @@ export interface AiCfoViewUIState {
|
|
|
20
22
|
scrollTop: number;
|
|
21
23
|
};
|
|
22
24
|
};
|
|
23
|
-
agentId?: ID;
|
|
25
|
+
agentId?: ID; /**
|
|
26
|
+
* When set, the side panel on host routes (e.g. dashboard/reports) is scoped to this **page key**;
|
|
27
|
+
* session ids are mirrored into {@link chatSessionIdByPageKey}. Full `/ai-cfo/...` should clear this.
|
|
28
|
+
*/
|
|
29
|
+
aiCfoSidePanelHostPageKey?: string;
|
|
24
30
|
currentChatSessionId?: ID;
|
|
25
31
|
lastContextMessage?: string;
|
|
26
32
|
lastContextStatus?: ContextStatus;
|
|
27
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Supported `page_context` values for GET .../suggested-questions and related UI state.
|
|
36
|
+
*/
|
|
37
|
+
export type AiCfoSuggestedQuestionsPageContext = 'balance_sheet' | 'profit_loss' | 'vendors' | 'transactions' | 'cash_flow' | 'accounts_receivable' | 'accounts_payable' | 'transaction_details';
|
|
38
|
+
export interface SuggestedQuestionsForPageContext extends FetchStateAndError {
|
|
39
|
+
pageContext: AiCfoSuggestedQuestionsPageContext;
|
|
40
|
+
suggestedQuestions: string[];
|
|
41
|
+
generatedAt?: string;
|
|
42
|
+
}
|
|
28
43
|
export interface AiCfoViewState extends FetchStateAndError {
|
|
29
44
|
allChatSessionIds: ID[];
|
|
30
45
|
createSessionAndSubmitState: FetchStateAndError;
|
|
@@ -39,5 +54,7 @@ export interface AiCfoViewState extends FetchStateAndError {
|
|
|
39
54
|
thought: FetchStateAndError;
|
|
40
55
|
}>;
|
|
41
56
|
stopSubmitStateByChatSessionId: Record<ID, FetchStateAndError>;
|
|
57
|
+
/** Keyed by `page_context` query value (e.g. balance_sheet). */
|
|
58
|
+
suggestedQuestionsByPageContext: Partial<Record<AiCfoSuggestedQuestionsPageContext, SuggestedQuestionsForPageContext>>;
|
|
42
59
|
uiState: AiCfoViewUIState;
|
|
43
60
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
|
+
import { fetchSuggestedQuestions, fetchSuggestedQuestionsFailure, fetchSuggestedQuestionsSuccess } from '../aiCfoViewReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof fetchSuggestedQuestions> | ReturnType<typeof fetchSuggestedQuestionsSuccess> | ReturnType<typeof fetchSuggestedQuestionsFailure>;
|
|
7
|
+
/** GET {aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?page_context=... */
|
|
8
|
+
export declare const fetchSuggestedQuestionsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchSuggestedQuestionsEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
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),
|
|
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) => {
|
|
13
|
+
const { pageContext } = action.payload;
|
|
14
|
+
const query = new URLSearchParams({ page_context: pageContext });
|
|
15
|
+
const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?${query.toString()}`;
|
|
16
|
+
return zeniAPI.getJSON(url).pipe((0, operators_1.mergeMap)((response) => {
|
|
17
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.fetchSuggestedQuestionsSuccess)({
|
|
19
|
+
pageContext: response.data.page_context,
|
|
20
|
+
generatedAt: response.data.generated_at,
|
|
21
|
+
suggestedQuestions: response.data.suggested_questions,
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.fetchSuggestedQuestionsFailure)({
|
|
25
|
+
pageContext,
|
|
26
|
+
error: response.status,
|
|
27
|
+
}));
|
|
28
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.fetchSuggestedQuestionsFailure)({
|
|
29
|
+
pageContext,
|
|
30
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch suggested questions REST API call failed', error instanceof Error ? { message: error.message } : undefined),
|
|
31
|
+
}))));
|
|
32
|
+
}));
|
|
33
|
+
exports.fetchSuggestedQuestionsEpic = fetchSuggestedQuestionsEpic;
|
|
@@ -3,7 +3,7 @@ import { Status } from '../../commonStateTypes/status';
|
|
|
3
3
|
import { View } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
4
|
import { ZeniDate } from '../../zeniDayJS';
|
|
5
5
|
import { AuditSummary } from '../reviewCompanyView/reviewCompanyViewState';
|
|
6
|
-
export declare const toAuditRuleEntityType: (v: string) => "dashboard" | "
|
|
6
|
+
export declare const toAuditRuleEntityType: (v: string) => "dashboard" | "transactions" | "reports";
|
|
7
7
|
export type AuditRuleEntityType = ReturnType<typeof toAuditRuleEntityType>;
|
|
8
8
|
declare const toAuditRuleEntityIdType: (v: string) => "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "uncategorized-expense" | "uncategorized-income";
|
|
9
9
|
export type AuditRuleEntityIdType = ReturnType<typeof toAuditRuleEntityIdType>;
|
|
@@ -5,7 +5,7 @@ import { JEScheduledTransactionPayload } from '../../../entity/jeSchedules/jeSch
|
|
|
5
5
|
import { JEScheduleTransactionKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
6
6
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
7
7
|
import { AccountTypeRecommendationPayload } from '../../accountMappingView/accountTypeRecommendation/accountTypeRecommendationPayload';
|
|
8
|
-
import { AccountSettingsLocalData, AccountSettingsState, JEScheduleLocalData, JESchedulesViewState } from '../types/jeSchedulesViewState';
|
|
8
|
+
import { AccountSettingsLocalData, AccountSettingsState, JEScheduleLocalData, JESchedulesViewState, JESchedulesViewUIState } from '../types/jeSchedulesViewState';
|
|
9
9
|
export declare const accountSettingsInitialState: AccountSettingsState;
|
|
10
10
|
export declare const initialState: JESchedulesViewState;
|
|
11
11
|
export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/clearExpenseAutomationJESchedulesView">, clearJeAccountSettingsLocalData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/clearJeAccountSettingsLocalData">, clearJeScheduleLocalData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/clearJeScheduleLocalData">, fetchAccountSettingsListForAccountTypes: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/fetchAccountSettingsListForAccountTypes">, fetchJeSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any], {
|
|
@@ -56,7 +56,7 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
|
|
|
56
56
|
accountPayload: AccountMetadataPayload[];
|
|
57
57
|
}, "expenseAutomationJESchedulesView/updateAccountSettingsListForAccountTypes">, updateAccountSettingsListForAccountTypesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
58
58
|
status: ZeniAPIStatus;
|
|
59
|
-
}, "expenseAutomationJESchedulesView/updateAccountSettingsListForAccountTypesFailure">, updateJeScheduleLocalDataById: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
59
|
+
}, "expenseAutomationJESchedulesView/updateAccountSettingsListForAccountTypesFailure">, updateJESchedulesUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<JESchedulesViewUIState>, "expenseAutomationJESchedulesView/updateJESchedulesUIState">, updateJeScheduleLocalDataById: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
60
60
|
localData: Partial<JEScheduleLocalData>;
|
|
61
61
|
scheduledJournalEntryID: ID;
|
|
62
62
|
}, "expenseAutomationJESchedulesView/updateJeScheduleLocalDataById">, updateJeScheduleTransactionKeys: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleKeys: (`${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`)[], selectedPeriod: MonthYearPeriod], {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateRecommendationForAccountSettingsFailure = exports.updateRecommendationForAccountSettings = exports.updateJeScheduleTransactionKeys = exports.updateJeScheduleLocalDataById = exports.updateAccountSettingsListForAccountTypesFailure = exports.updateAccountSettingsListForAccountTypes = exports.saveAccountSettingsSuccess = exports.saveAccountSettingsLocalData = exports.saveAccountSettingsFailure = exports.saveAccountSettings = exports.retryJeScheduleSuccess = exports.retryJeScheduleFailure = exports.retryJeSchedule = exports.removeJeScheduleTransactionKey = exports.removeJeScheduleLocalDataById = exports.removeFailedJeScheduleTransactionKey = exports.initializeJeScheduleLocalData = exports.initializeAccountSettingsView = exports.ignoreRecommendedJeScheduleSuccess = exports.ignoreRecommendedJeScheduleFailure = exports.ignoreRecommendedJeSchedule = exports.fetchRecommendationForAccountSettings = exports.fetchJeSchedulesSuccess = exports.fetchJeSchedulesPage = exports.fetchJeSchedulesFailure = exports.fetchJeSchedules = exports.fetchAccountSettingsListForAccountTypes = exports.clearJeScheduleLocalData = exports.clearJeAccountSettingsLocalData = exports.clearExpenseAutomationJESchedulesView = exports.initialState = exports.accountSettingsInitialState = void 0;
|
|
4
|
+
exports.updateRecommendationForAccountSettingsFailure = exports.updateRecommendationForAccountSettings = exports.updateJeScheduleTransactionKeys = exports.updateJeScheduleLocalDataById = exports.updateJESchedulesUIState = exports.updateAccountSettingsListForAccountTypesFailure = exports.updateAccountSettingsListForAccountTypes = exports.saveAccountSettingsSuccess = exports.saveAccountSettingsLocalData = exports.saveAccountSettingsFailure = exports.saveAccountSettings = exports.retryJeScheduleSuccess = exports.retryJeScheduleFailure = exports.retryJeSchedule = exports.removeJeScheduleTransactionKey = exports.removeJeScheduleLocalDataById = exports.removeFailedJeScheduleTransactionKey = exports.initializeJeScheduleLocalData = exports.initializeAccountSettingsView = exports.ignoreRecommendedJeScheduleSuccess = exports.ignoreRecommendedJeScheduleFailure = exports.ignoreRecommendedJeSchedule = exports.fetchRecommendationForAccountSettings = exports.fetchJeSchedulesSuccess = exports.fetchJeSchedulesPage = exports.fetchJeSchedulesFailure = exports.fetchJeSchedules = exports.fetchAccountSettingsListForAccountTypes = exports.clearJeScheduleLocalData = exports.clearJeAccountSettingsLocalData = exports.clearExpenseAutomationJESchedulesView = exports.initialState = exports.accountSettingsInitialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const getNestedAccountIDHierarchyForReport_1 = require("../../../commonStateTypes/accountView/getNestedAccountIDHierarchyForReport");
|
|
7
7
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
@@ -48,6 +48,8 @@ exports.initialState = {
|
|
|
48
48
|
uiState: {
|
|
49
49
|
searchString: '',
|
|
50
50
|
scrollPosition: { scrollTop: 0, scrollLeft: undefined },
|
|
51
|
+
sortKey: 'startMonth',
|
|
52
|
+
sortOrder: 'descending',
|
|
51
53
|
totalCount: 0,
|
|
52
54
|
limit: 10,
|
|
53
55
|
},
|
|
@@ -369,12 +371,26 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
|
|
|
369
371
|
clearJeAccountSettingsLocalData(draft) {
|
|
370
372
|
draft.accountSettings.localData = exports.accountSettingsInitialState.localData;
|
|
371
373
|
},
|
|
374
|
+
updateJESchedulesUIState(draft, action) {
|
|
375
|
+
if (action.payload.sortKey != null) {
|
|
376
|
+
draft.uiState.sortKey = action.payload.sortKey;
|
|
377
|
+
}
|
|
378
|
+
if (action.payload.sortOrder != null) {
|
|
379
|
+
draft.uiState.sortOrder = action.payload.sortOrder;
|
|
380
|
+
}
|
|
381
|
+
if (action.payload.searchString != null) {
|
|
382
|
+
draft.uiState.searchString = action.payload.searchString;
|
|
383
|
+
}
|
|
384
|
+
if (action.payload.scrollPosition != null) {
|
|
385
|
+
draft.uiState.scrollPosition = action.payload.scrollPosition;
|
|
386
|
+
}
|
|
387
|
+
},
|
|
372
388
|
clearExpenseAutomationJESchedulesView(draft) {
|
|
373
389
|
Object.assign(draft, exports.initialState);
|
|
374
390
|
},
|
|
375
391
|
},
|
|
376
392
|
});
|
|
377
|
-
_a = expenseAutomationJESchedulesView.actions, exports.clearExpenseAutomationJESchedulesView = _a.clearExpenseAutomationJESchedulesView, exports.clearJeAccountSettingsLocalData = _a.clearJeAccountSettingsLocalData, exports.clearJeScheduleLocalData = _a.clearJeScheduleLocalData, exports.fetchAccountSettingsListForAccountTypes = _a.fetchAccountSettingsListForAccountTypes, exports.fetchJeSchedules = _a.fetchJeSchedules, exports.fetchJeSchedulesFailure = _a.fetchJeSchedulesFailure, exports.fetchJeSchedulesPage = _a.fetchJeSchedulesPage, exports.fetchJeSchedulesSuccess = _a.fetchJeSchedulesSuccess, exports.fetchRecommendationForAccountSettings = _a.fetchRecommendationForAccountSettings, exports.ignoreRecommendedJeSchedule = _a.ignoreRecommendedJeSchedule, exports.ignoreRecommendedJeScheduleFailure = _a.ignoreRecommendedJeScheduleFailure, exports.ignoreRecommendedJeScheduleSuccess = _a.ignoreRecommendedJeScheduleSuccess, exports.initializeAccountSettingsView = _a.initializeAccountSettingsView, exports.initializeJeScheduleLocalData = _a.initializeJeScheduleLocalData, exports.removeFailedJeScheduleTransactionKey = _a.removeFailedJeScheduleTransactionKey, exports.removeJeScheduleLocalDataById = _a.removeJeScheduleLocalDataById, exports.removeJeScheduleTransactionKey = _a.removeJeScheduleTransactionKey, exports.retryJeSchedule = _a.retryJeSchedule, exports.retryJeScheduleFailure = _a.retryJeScheduleFailure, exports.retryJeScheduleSuccess = _a.retryJeScheduleSuccess, exports.saveAccountSettings = _a.saveAccountSettings, exports.saveAccountSettingsFailure = _a.saveAccountSettingsFailure, exports.saveAccountSettingsLocalData = _a.saveAccountSettingsLocalData, exports.saveAccountSettingsSuccess = _a.saveAccountSettingsSuccess, exports.updateAccountSettingsListForAccountTypes = _a.updateAccountSettingsListForAccountTypes, exports.updateAccountSettingsListForAccountTypesFailure = _a.updateAccountSettingsListForAccountTypesFailure, exports.updateJeScheduleLocalDataById = _a.updateJeScheduleLocalDataById, exports.updateJeScheduleTransactionKeys = _a.updateJeScheduleTransactionKeys, exports.updateRecommendationForAccountSettings = _a.updateRecommendationForAccountSettings, exports.updateRecommendationForAccountSettingsFailure = _a.updateRecommendationForAccountSettingsFailure;
|
|
393
|
+
_a = expenseAutomationJESchedulesView.actions, exports.clearExpenseAutomationJESchedulesView = _a.clearExpenseAutomationJESchedulesView, exports.clearJeAccountSettingsLocalData = _a.clearJeAccountSettingsLocalData, exports.clearJeScheduleLocalData = _a.clearJeScheduleLocalData, exports.fetchAccountSettingsListForAccountTypes = _a.fetchAccountSettingsListForAccountTypes, exports.fetchJeSchedules = _a.fetchJeSchedules, exports.fetchJeSchedulesFailure = _a.fetchJeSchedulesFailure, exports.fetchJeSchedulesPage = _a.fetchJeSchedulesPage, exports.fetchJeSchedulesSuccess = _a.fetchJeSchedulesSuccess, exports.fetchRecommendationForAccountSettings = _a.fetchRecommendationForAccountSettings, exports.ignoreRecommendedJeSchedule = _a.ignoreRecommendedJeSchedule, exports.ignoreRecommendedJeScheduleFailure = _a.ignoreRecommendedJeScheduleFailure, exports.ignoreRecommendedJeScheduleSuccess = _a.ignoreRecommendedJeScheduleSuccess, exports.initializeAccountSettingsView = _a.initializeAccountSettingsView, exports.initializeJeScheduleLocalData = _a.initializeJeScheduleLocalData, exports.removeFailedJeScheduleTransactionKey = _a.removeFailedJeScheduleTransactionKey, exports.removeJeScheduleLocalDataById = _a.removeJeScheduleLocalDataById, exports.removeJeScheduleTransactionKey = _a.removeJeScheduleTransactionKey, exports.retryJeSchedule = _a.retryJeSchedule, exports.retryJeScheduleFailure = _a.retryJeScheduleFailure, exports.retryJeScheduleSuccess = _a.retryJeScheduleSuccess, exports.saveAccountSettings = _a.saveAccountSettings, exports.saveAccountSettingsFailure = _a.saveAccountSettingsFailure, exports.saveAccountSettingsLocalData = _a.saveAccountSettingsLocalData, exports.saveAccountSettingsSuccess = _a.saveAccountSettingsSuccess, exports.updateAccountSettingsListForAccountTypes = _a.updateAccountSettingsListForAccountTypes, exports.updateAccountSettingsListForAccountTypesFailure = _a.updateAccountSettingsListForAccountTypesFailure, exports.updateJESchedulesUIState = _a.updateJESchedulesUIState, exports.updateJeScheduleLocalDataById = _a.updateJeScheduleLocalDataById, exports.updateJeScheduleTransactionKeys = _a.updateJeScheduleTransactionKeys, exports.updateRecommendationForAccountSettings = _a.updateRecommendationForAccountSettings, exports.updateRecommendationForAccountSettingsFailure = _a.updateRecommendationForAccountSettingsFailure;
|
|
378
394
|
exports.default = expenseAutomationJESchedulesView.reducer;
|
|
379
395
|
const doUpdateRecommendationForAccountSettings = (draft, payload) => {
|
|
380
396
|
const { prepaidExpensesRecommendations, fixedAssetsRecommendations, accruedExpensesRecommendations, } = (0, accountTypeRecommendationPayload_1.mapAccountTypeRecommendationPayloadToAccountRecommendationByType)(payload);
|
|
@@ -18,10 +18,12 @@ export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
|
|
|
18
18
|
allDepreciationAccountList: AccountBase[];
|
|
19
19
|
allDepreciationAccountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
|
|
20
20
|
classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
|
|
21
|
+
completedSchedules: JEScheduledTransaction[];
|
|
21
22
|
completionStatus: CompletionStatusType;
|
|
22
23
|
draftSchedules: JEScheduledTransaction[];
|
|
23
24
|
ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
|
|
24
25
|
jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
|
|
26
|
+
ongoingSchedules: JEScheduledTransaction[];
|
|
25
27
|
postStatusById: Record<ID, FetchStateAndError>;
|
|
26
28
|
refreshStatus: FetchStateAndError;
|
|
27
29
|
resolveSchedules: JEScheduledTransactionWithFailedEntries[];
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getExpenseAutomationJESchedulesView = getExpenseAutomationJESchedulesView;
|
|
7
7
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
8
|
+
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
8
9
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
9
10
|
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
10
11
|
const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
|
|
@@ -16,6 +17,42 @@ const scheduleDetailSelector_1 = require("../../scheduleView/scheduleDetailView/
|
|
|
16
17
|
const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
|
|
17
18
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
18
19
|
const jeAccountSettingsViewSelector_1 = require("./jeAccountSettingsViewSelector");
|
|
20
|
+
function getJEScheduleSortAccessor(sortKey) {
|
|
21
|
+
switch (sortKey) {
|
|
22
|
+
case 'vendor':
|
|
23
|
+
return (s) => s.vendor.name?.toLowerCase();
|
|
24
|
+
case 'category':
|
|
25
|
+
return (s) => s.jeDebit.account?.accountName?.toLowerCase();
|
|
26
|
+
case 'class':
|
|
27
|
+
return (s) => s.jeDebit.accountingClass?.className?.toLowerCase();
|
|
28
|
+
case 'scheduleCategory':
|
|
29
|
+
return (s) => s.jeScheduleType;
|
|
30
|
+
case 'startMonth':
|
|
31
|
+
return (s) => s.startDate?.valueOf();
|
|
32
|
+
case 'type':
|
|
33
|
+
return (s) => s.baseTransaction.typeOfTransaction;
|
|
34
|
+
case 'amortizationPeriod':
|
|
35
|
+
return (s) => s.period;
|
|
36
|
+
case 'jePostingDate':
|
|
37
|
+
return (s) => s.dayOfPostingDate;
|
|
38
|
+
case 'remainingMonths':
|
|
39
|
+
return (s) => s.period;
|
|
40
|
+
case 'runningBalance':
|
|
41
|
+
return (s) => s.balanceAsOfToday?.amount;
|
|
42
|
+
case 'totalAmount':
|
|
43
|
+
return (s) => s.baseTransaction.amount.amount;
|
|
44
|
+
case 'transactionDate':
|
|
45
|
+
return (s) => s.baseTransaction.date.valueOf();
|
|
46
|
+
case 'memo':
|
|
47
|
+
return (s) => s.baseTransaction.memo?.toLowerCase();
|
|
48
|
+
default:
|
|
49
|
+
return (s) => s.startDate?.valueOf();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function sortJEScheduledTransactions(transactions, sortKey, sortOrder) {
|
|
53
|
+
const accessor = getJEScheduleSortAccessor(sortKey);
|
|
54
|
+
return (0, orderBy_1.default)(transactions, [accessor], [sortOrder === 'ascending' ? 'asc' : 'desc']);
|
|
55
|
+
}
|
|
19
56
|
function getExpenseAutomationJESchedulesView(state) {
|
|
20
57
|
const jeScheduledTransaction = [];
|
|
21
58
|
const failedJeScheduledTransaction = [];
|
|
@@ -65,13 +102,21 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
65
102
|
const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
|
|
66
103
|
failedJeScheduledTransaction.push(jeScheduleDetails);
|
|
67
104
|
});
|
|
68
|
-
const
|
|
69
|
-
const
|
|
105
|
+
const { sortKey, sortOrder } = uiState;
|
|
106
|
+
const draftSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'), sortKey, sortOrder);
|
|
107
|
+
const ongoingSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'ongoing'), sortKey, sortOrder);
|
|
108
|
+
const completedSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'completed' ||
|
|
109
|
+
schedule.status.code === 'marked_as_completed'), sortKey, sortOrder);
|
|
110
|
+
const unsortedResolveSchedules = [];
|
|
70
111
|
failedJeScheduledTransaction.forEach((schedule) => {
|
|
71
112
|
schedule.scheduledJournalEntry.forEach((journalEntry) => {
|
|
72
|
-
|
|
113
|
+
unsortedResolveSchedules.push({
|
|
114
|
+
...schedule,
|
|
115
|
+
scheduledJournalEntry: journalEntry,
|
|
116
|
+
});
|
|
73
117
|
});
|
|
74
118
|
});
|
|
119
|
+
const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
|
|
75
120
|
const allSteps = monthYearPeriodId != null
|
|
76
121
|
? (0, expenseAutomationViewSelectorTypes_1.getAllSteps)(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
|
|
77
122
|
: [];
|
|
@@ -85,7 +130,9 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
85
130
|
allAccountList: filteredAccounts,
|
|
86
131
|
accountListNestedAccountHierarchy,
|
|
87
132
|
allClassList: allClasses,
|
|
133
|
+
completedSchedules,
|
|
88
134
|
draftSchedules,
|
|
135
|
+
ongoingSchedules,
|
|
89
136
|
resolveSchedules: resolveSchedules,
|
|
90
137
|
accountSettingsView,
|
|
91
138
|
postStatusById: postStatusById,
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
|
|
2
2
|
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
3
3
|
import { Recommendation } from '../../../commonStateTypes/recommendationBase';
|
|
4
|
+
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
4
5
|
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
5
6
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
7
|
import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
7
8
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
9
|
+
export declare const toJEScheduleSortKey: (v: string) => "vendor" | "type" | "category" | "class" | "memo" | "transactionDate" | "totalAmount" | "runningBalance" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "jePostingDate" | "remainingMonths";
|
|
10
|
+
export type JEScheduleSortKey = ReturnType<typeof toJEScheduleSortKey>;
|
|
8
11
|
export interface JESchedulesViewUIState {
|
|
9
12
|
scrollPosition: {
|
|
10
13
|
scrollTop: number;
|
|
11
14
|
scrollLeft?: number;
|
|
12
15
|
} | undefined;
|
|
13
16
|
searchString: string;
|
|
17
|
+
sortKey: JEScheduleSortKey;
|
|
18
|
+
sortOrder: SortOrder;
|
|
14
19
|
totalCount: number;
|
|
15
20
|
limit?: number;
|
|
16
21
|
}
|
|
@@ -1,2 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toJEScheduleSortKey = void 0;
|
|
4
|
+
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
|
+
const JE_SCHEDULE_SORT_KEYS = [
|
|
6
|
+
'vendor',
|
|
7
|
+
'category',
|
|
8
|
+
'class',
|
|
9
|
+
'scheduleCategory',
|
|
10
|
+
'startMonth',
|
|
11
|
+
'type',
|
|
12
|
+
'amortizationPeriod',
|
|
13
|
+
'jePostingDate',
|
|
14
|
+
'remainingMonths',
|
|
15
|
+
'runningBalance',
|
|
16
|
+
'totalAmount',
|
|
17
|
+
'transactionDate',
|
|
18
|
+
'memo',
|
|
19
|
+
];
|
|
20
|
+
const toJEScheduleSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_SCHEDULE_SORT_KEYS);
|
|
21
|
+
exports.toJEScheduleSortKey = toJEScheduleSortKey;
|
|
@@ -7,7 +7,7 @@ export declare const getScheduleListKey: (selectedCategory: ID, selectedTimefram
|
|
|
7
7
|
export type ScheduleListKey = ReturnType<typeof getScheduleListKey>;
|
|
8
8
|
export declare const toScheduleSubTabType: (v: string) => "completed" | "new" | "ongoing" | "all";
|
|
9
9
|
export type ScheduleSubTabType = ReturnType<typeof toScheduleSubTabType>;
|
|
10
|
-
declare const toScheduleSortKeyType: (v: string) => "months" | "amount" | "vendor" | "status" | "user" | "createTime" | "class" | "memo" | "balanceAsOfToday" | "transactionDate" | "transactionType" | "assetId" | "
|
|
10
|
+
declare const toScheduleSortKeyType: (v: string) => "months" | "amount" | "vendor" | "status" | "user" | "createTime" | "class" | "memo" | "balanceAsOfToday" | "transactionDate" | "transactionType" | "assetId" | "scheduleCategory" | "startMonth" | "accruedExpenseCategory" | "expenseCategory" | "accumulatedDepreciationCategory" | "endMonth";
|
|
11
11
|
export declare type ScheduleListSortKey = ReturnType<typeof toScheduleSortKeyType>;
|
|
12
12
|
export interface DownloadJEScheduleTabOptions {
|
|
13
13
|
categoryId: ID;
|
|
@@ -424,6 +424,14 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
|
|
|
424
424
|
transactionsWithNoSortKeyValue.push(transaction);
|
|
425
425
|
}
|
|
426
426
|
break;
|
|
427
|
+
case 'invoiceNumber':
|
|
428
|
+
if (transaction.documentId != null) {
|
|
429
|
+
transactionsWithSortKeyValue.push(transaction);
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
transactionsWithNoSortKeyValue.push(transaction);
|
|
433
|
+
}
|
|
434
|
+
break;
|
|
427
435
|
case 'dueDate':
|
|
428
436
|
if (currentTab === 'draft') {
|
|
429
437
|
if (Boolean(transaction.dueDate) === true) {
|
|
@@ -526,6 +534,8 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
|
|
|
526
534
|
return transaction.totalAmountInUSD?.amount ?? 0;
|
|
527
535
|
case 'paymentMethod':
|
|
528
536
|
return transaction.billPayInfo.billPaymentMethodType.name;
|
|
537
|
+
case 'invoiceNumber':
|
|
538
|
+
return transaction.documentId;
|
|
529
539
|
}
|
|
530
540
|
}, getColumnWiseSortOrder(sortOrder));
|
|
531
541
|
return [
|
|
@@ -37,7 +37,7 @@ declare const toBillTabType: (v: string) => "paid" | "pending_approval" | "sched
|
|
|
37
37
|
export type BillTab = ReturnType<typeof toBillTabType>;
|
|
38
38
|
declare const toBillsSubTabType: (v: string) => "rejected" | "failed" | "ach" | "wire" | "cancelled" | "deleted" | "overdue" | "all" | "awaiting_approval" | "awaiting_my_approval" | "offline";
|
|
39
39
|
export type BillsSubTabType = ReturnType<typeof toBillsSubTabType>;
|
|
40
|
-
declare const toBillPaySortKeyType: (v: string) => "amount" | "status" | "name" | "dueDate" | "paymentMethod" | "invoiceDate";
|
|
40
|
+
declare const toBillPaySortKeyType: (v: string) => "amount" | "status" | "name" | "dueDate" | "paymentMethod" | "invoiceNumber" | "invoiceDate";
|
|
41
41
|
export declare type BillPayViewSortKey = ReturnType<typeof toBillPaySortKeyType>;
|
|
42
42
|
export interface BillPayFilters {
|
|
43
43
|
categories: BillPayFilterCategory[];
|
|
@@ -47,6 +47,7 @@ const ALL_BILL_PAY_SORT_KEYS = [
|
|
|
47
47
|
'invoiceDate',
|
|
48
48
|
'name',
|
|
49
49
|
'paymentMethod',
|
|
50
|
+
'invoiceNumber',
|
|
50
51
|
];
|
|
51
52
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
52
53
|
const toBillPaySortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_BILL_PAY_SORT_KEYS);
|
|
@@ -61,7 +61,7 @@ export declare const initialCreditAcc: CreditAccount;
|
|
|
61
61
|
export declare const initialDebitCardSummaries: DebitCardSummaries;
|
|
62
62
|
export declare const initialResendRevokeCardInvite: ResendRevokeCardInvite;
|
|
63
63
|
export declare const initialCreditAccountRepayment: CreditAccountRepayment;
|
|
64
|
-
export declare const toChargeCardSortKeyType: (v: string) => "status" | "owner" | "cardName" | "limit" | "department" | "cardType" | "utilisation";
|
|
64
|
+
export declare const toChargeCardSortKeyType: (v: string) => "status" | "accountType" | "owner" | "cardName" | "limit" | "department" | "cardType" | "utilisation";
|
|
65
65
|
export declare type ChargeCardViewSortKey = ReturnType<typeof toChargeCardSortKeyType>;
|
|
66
66
|
export declare const ALL_CASHBACK_SORT_KEYS: readonly ["month", "cashback"];
|
|
67
67
|
export declare const toCashbackSortKeyType: (v: string) => "month" | "cashback";
|
|
@@ -233,6 +233,8 @@ const getCardsBySortKey = (card, sortKey) => {
|
|
|
233
233
|
return card.cardName.toLowerCase();
|
|
234
234
|
case 'cardType':
|
|
235
235
|
return card.type.code;
|
|
236
|
+
case 'accountType':
|
|
237
|
+
return card.type.code.includes('credit') ? 'credit' : 'debit';
|
|
236
238
|
case 'status':
|
|
237
239
|
return card.status.code;
|
|
238
240
|
case 'utilisation':
|
|
@@ -42,6 +42,7 @@ export interface ReimbursementView extends Reimbursement {
|
|
|
42
42
|
approvers: Approvers;
|
|
43
43
|
submittedBy: User | undefined;
|
|
44
44
|
bulkSelectInfo?: RemiBulkSelectInfo;
|
|
45
|
+
createdByUser?: User;
|
|
45
46
|
}
|
|
46
47
|
export declare const getRemiList: (state: RootState, currentTimePeriod: TimePeriod, isBulkActionFeatureEnabled: boolean) => RemiListReport;
|
|
47
48
|
export declare const getApproversOrRejectors: (reimbursement: Reimbursement, entityApprovalStatusState: EntityApprovalStatusState, userState: UserState) => Approvers;
|