@zeniai/client-epic-state 4.20.1 → 4.20.2-beta0ND
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/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +19 -0
- package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +2 -0
- package/lib/commonStateTypes/animations.d.ts +1 -1
- package/lib/entity/aiCfo/aiCfoSelector.d.ts +1 -2
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +38 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +78 -0
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -1
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +5 -1
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +37 -0
- package/lib/entity/tenant/tenantPayload.d.ts +1 -0
- package/lib/entity/tenant/tenantReducer.js +1 -0
- package/lib/entity/tenant/tenantSelector.d.ts +1 -0
- package/lib/entity/tenant/tenantSelector.js +9 -1
- package/lib/entity/tenant/tenantState.d.ts +1 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +4 -1
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
- package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +3 -0
- package/lib/entity/transaction/payloadTypes/transactionPayload.js +17 -1
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +1 -0
- package/lib/entity/transaction/stateTypes/transaction.d.ts +5 -0
- package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
- package/lib/epic.d.ts +2 -1
- package/lib/epic.js +2 -1
- package/lib/esm/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +1 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +78 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +5 -1
- package/lib/esm/entity/tenant/tenantReducer.js +1 -0
- package/lib/esm/entity/tenant/tenantSelector.js +7 -0
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
- package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +17 -1
- package/lib/esm/epic.js +2 -1
- package/lib/esm/index.js +10 -8
- 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/classList/fetchClassListEpic.js +9 -2
- package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
- package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -3
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
- package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +17 -1
- package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +12 -4
- package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +22 -9
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +12 -6
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +18 -1
- package/lib/esm/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +17 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +20 -29
- 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/billPay/billPayReview/billPayReviewSelector.js +7 -3
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
- 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/editRemiView/editRemiViewSelector.js +7 -4
- 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/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
- package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
- package/lib/index.d.ts +15 -11
- package/lib/index.js +44 -32
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- 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 +15 -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/classList/fetchClassListEpic.d.ts +1 -1
- package/lib/view/classList/fetchClassListEpic.js +8 -1
- package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +1 -0
- package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +1 -0
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +1 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -3
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
- package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.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/fluxAnalysisViewSelector.js +10 -2
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +12 -4
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +22 -9
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +11 -5
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +5 -0
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +20 -0
- package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.d.ts +9 -0
- package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +20 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -0
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +20 -29
- 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/billPay/billPayReview/billPayReviewSelector.js +7 -3
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
- 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/editRemiView/editRemiViewSelector.js +6 -3
- 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/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
- package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AiCfoAnswerPayload, ChatSessionPayload } from '../../entity/aiCfo/aiCfoPayload';
|
|
2
2
|
import { UserRolePayload } from '../../entity/userRole/userRolePayload';
|
|
3
3
|
import { ZeniAPIResponse } from '../../responsePayload';
|
|
4
|
+
import type { AiCfoSuggestedQuestionsPageContext } from '../../common/aiCfo/aiCfoSuggestedQuestionsPageContext';
|
|
4
5
|
export type ContextStatus = 'NONE' | 'NOT_FOUND' | 'PERMISSION_DENIED' | 'SUCCESS';
|
|
5
6
|
export interface CreateSessionResponseData {
|
|
6
7
|
chat_session_id: string;
|
|
@@ -23,4 +24,10 @@ interface AcceptMasterTOSPayload {
|
|
|
23
24
|
user_roles: UserRolePayload[];
|
|
24
25
|
}
|
|
25
26
|
export type AcceptMasterTOSResponse = ZeniAPIResponse<AcceptMasterTOSPayload>;
|
|
27
|
+
export interface SuggestedQuestionsDataPayload {
|
|
28
|
+
generated_at: string;
|
|
29
|
+
page_context: AiCfoSuggestedQuestionsPageContext;
|
|
30
|
+
suggested_questions: string[];
|
|
31
|
+
}
|
|
32
|
+
export type FetchSuggestedQuestionsResponse = ZeniAPIResponse<SuggestedQuestionsDataPayload>;
|
|
26
33
|
export {};
|
|
@@ -4,6 +4,7 @@ import { ChatSessionPayload } from '../../entity/aiCfo/aiCfoPayload';
|
|
|
4
4
|
import { AiCfoAnswerResponseType } from '../../entity/aiCfo/aiCfoState';
|
|
5
5
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
6
6
|
import { ContextStatus } from './aiCfoViewPayload';
|
|
7
|
+
import type { AiCfoSuggestedQuestionsPageContext } from '../../common/aiCfo/aiCfoSuggestedQuestionsPageContext';
|
|
7
8
|
import { AiCfoViewState } from './aiCfoViewState';
|
|
8
9
|
export declare const initialAiCfoViewState: AiCfoViewState;
|
|
9
10
|
export declare const submitQuestion: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[sessionId: string, questionAnswerId: string, userId: string, questionId: string, createdAt: import("dayjs").Dayjs, question: string, files?: File[] | undefined], {
|
|
@@ -89,6 +90,19 @@ export declare const submitQuestion: import("@reduxjs/toolkit").ActionCreatorWit
|
|
|
89
90
|
}, "aiCfoView/clearDeleteChatSessionStatus">, clearAiCfoView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfoView/clearAiCfoView">, updateCotCollapsedState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
90
91
|
isCollapsed: boolean;
|
|
91
92
|
questionAnswerId: ID;
|
|
92
|
-
}, "aiCfoView/updateCotCollapsedState"
|
|
93
|
+
}, "aiCfoView/updateCotCollapsedState">, fetchSuggestedQuestions: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
94
|
+
pageContext: AiCfoSuggestedQuestionsPageContext;
|
|
95
|
+
}, "aiCfoView/fetchSuggestedQuestions">, fetchSuggestedQuestionsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
96
|
+
generatedAt: string;
|
|
97
|
+
pageContext: AiCfoSuggestedQuestionsPageContext;
|
|
98
|
+
suggestedQuestions: string[];
|
|
99
|
+
}, "aiCfoView/fetchSuggestedQuestionsSuccess">, fetchSuggestedQuestionsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
100
|
+
error: ZeniAPIStatus;
|
|
101
|
+
pageContext: AiCfoSuggestedQuestionsPageContext;
|
|
102
|
+
}, "aiCfoView/fetchSuggestedQuestionsFailure">, applyAiCfoSidePanelHostPageTransition: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
103
|
+
newAiCfoSidePanelHostPageKey: string;
|
|
104
|
+
/** When omitted or null, clears the active session (empty / suggested questions). */
|
|
105
|
+
nextCurrentChatSessionId?: ID | null;
|
|
106
|
+
}, "aiCfoView/applyAiCfoSidePanelHostPageTransition">, clearAiCfoSidePanelHostPageContext: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfoView/clearAiCfoSidePanelHostPageContext">;
|
|
93
107
|
declare const _default: import("redux").Reducer<AiCfoViewState>;
|
|
94
108
|
export default _default;
|
|
@@ -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 type { AiCfoSuggestedQuestionsPageContext } from '../../common/aiCfo/aiCfoSuggestedQuestionsPageContext';
|
|
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
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AiCfoSuggestedQuestionsPageContext } from '../../common/aiCfo/aiCfoSuggestedQuestionsPageContext';
|
|
1
2
|
import { FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
2
3
|
import { PageToken } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
4
|
import { ContextStatus } from './aiCfoViewPayload';
|
|
@@ -9,6 +10,8 @@ export interface AiCfoViewUIState {
|
|
|
9
10
|
chatHistoryNextPageToken: {
|
|
10
11
|
[chatSessionId: ID]: PageTokenState;
|
|
11
12
|
};
|
|
13
|
+
/** Last focused chat session id per side-panel host page key (e.g. `dashboard`, `reports:profit_loss`). */
|
|
14
|
+
chatSessionIdByPageKey: Partial<Record<string, ID>>;
|
|
12
15
|
chatSessionsFirstPageFetched: boolean;
|
|
13
16
|
chatSessionsNextPageToken: PageTokenState;
|
|
14
17
|
cotCollapsedByQuestionAnswerId: {
|
|
@@ -20,11 +23,20 @@ export interface AiCfoViewUIState {
|
|
|
20
23
|
scrollTop: number;
|
|
21
24
|
};
|
|
22
25
|
};
|
|
23
|
-
agentId?: ID;
|
|
26
|
+
agentId?: ID; /**
|
|
27
|
+
* When set, the side panel on host routes (e.g. dashboard/reports) is scoped to this **page key**;
|
|
28
|
+
* session ids are mirrored into {@link chatSessionIdByPageKey}. Full `/ai-cfo/...` should clear this.
|
|
29
|
+
*/
|
|
30
|
+
aiCfoSidePanelHostPageKey?: string;
|
|
24
31
|
currentChatSessionId?: ID;
|
|
25
32
|
lastContextMessage?: string;
|
|
26
33
|
lastContextStatus?: ContextStatus;
|
|
27
34
|
}
|
|
35
|
+
export interface SuggestedQuestionsForPageContext extends FetchStateAndError {
|
|
36
|
+
pageContext: AiCfoSuggestedQuestionsPageContext;
|
|
37
|
+
suggestedQuestions: string[];
|
|
38
|
+
generatedAt?: string;
|
|
39
|
+
}
|
|
28
40
|
export interface AiCfoViewState extends FetchStateAndError {
|
|
29
41
|
allChatSessionIds: ID[];
|
|
30
42
|
createSessionAndSubmitState: FetchStateAndError;
|
|
@@ -39,5 +51,7 @@ export interface AiCfoViewState extends FetchStateAndError {
|
|
|
39
51
|
thought: FetchStateAndError;
|
|
40
52
|
}>;
|
|
41
53
|
stopSubmitStateByChatSessionId: Record<ID, FetchStateAndError>;
|
|
54
|
+
/** Keyed by `page_context` query value (e.g. balance_sheet). */
|
|
55
|
+
suggestedQuestionsByPageContext: Partial<Record<AiCfoSuggestedQuestionsPageContext, SuggestedQuestionsForPageContext>>;
|
|
42
56
|
uiState: AiCfoViewUIState;
|
|
43
57
|
}
|
|
@@ -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,4 +5,4 @@ import { RootState } from '../../reducer';
|
|
|
5
5
|
import { ZeniAPI } from '../../zeniAPI';
|
|
6
6
|
import { fetchClassList, updateClassList, updateClassListFailure } from './classListReducer';
|
|
7
7
|
export type ActionType = ReturnType<typeof fetchClassList> | ReturnType<typeof updateClasses> | ReturnType<typeof updateClassList> | ReturnType<typeof updateClassListFailure>;
|
|
8
|
-
export declare const fetchClassListEpic: (actions$: ActionsObservable<ActionType>,
|
|
8
|
+
export declare const fetchClassListEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,9 +4,16 @@ exports.fetchClassListEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const classReducer_1 = require("../../entity/class/classReducer");
|
|
7
|
+
const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
|
|
7
8
|
const responsePayload_1 = require("../../responsePayload");
|
|
8
9
|
const classListReducer_1 = require("./classListReducer");
|
|
9
|
-
const fetchClassListEpic = (actions$,
|
|
10
|
+
const fetchClassListEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(classListReducer_1.fetchClassList.match), (0, operators_1.withLatestFrom)(state$), (0, operators_1.switchMap)(([action, state]) => {
|
|
11
|
+
if (!(0, tenantSelector_1.getIsAccountingClassesEnabled)(state)) {
|
|
12
|
+
return (0, rxjs_1.of)((0, classListReducer_1.updateClassList)({
|
|
13
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Success', ''),
|
|
14
|
+
data: { accounting_classes: [] },
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
10
17
|
const { isIncludeDeleted } = action.payload;
|
|
11
18
|
const queryParams = isIncludeDeleted === true
|
|
12
19
|
? `?query=${encodeURIComponent(JSON.stringify({ is_include_deleted: true }))}`
|
|
@@ -57,6 +57,7 @@ export interface VendorViewSelectorView extends BankAccountSelectorView, Selecto
|
|
|
57
57
|
deleteFileStatusById: Record<ID, FetchStateAndError | undefined>;
|
|
58
58
|
hasInternationalWireTransfer: boolean;
|
|
59
59
|
hasWireTransfer: boolean;
|
|
60
|
+
isAccountingClassesEnabled: boolean;
|
|
60
61
|
loggedInUserVerification: UserVerificationState;
|
|
61
62
|
ownerList: User[];
|
|
62
63
|
updateFileStatusById: Record<ID, FetchStateAndError | undefined>;
|
|
@@ -9,6 +9,7 @@ const contactSelector_1 = require("../../../entity/billPay/contact/contactSelect
|
|
|
9
9
|
const classSelector_1 = require("../../../entity/class/classSelector");
|
|
10
10
|
const fileSelector_1 = require("../../../entity/file/fileSelector");
|
|
11
11
|
const paymentInstrumentSelector_1 = require("../../../entity/paymentInstrument/paymentInstrumentSelector");
|
|
12
|
+
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
12
13
|
const userSelector_1 = require("../../../entity/user/userSelector");
|
|
13
14
|
const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
|
|
14
15
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
@@ -63,13 +64,17 @@ const getVendorView = (state, vendorIdFromUrl) => {
|
|
|
63
64
|
?.vendorDetailLocalData,
|
|
64
65
|
supportedCountries: billPayConfigState.vendor.supportedCountries,
|
|
65
66
|
};
|
|
66
|
-
|
|
67
|
+
const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state);
|
|
68
|
+
const editFetchStateList = [
|
|
67
69
|
accountList,
|
|
68
|
-
classList,
|
|
69
70
|
vendorTypeListState,
|
|
70
71
|
vendorViewState.editVendorStateById[vendorIdFromUrl]?.fetchStatus ??
|
|
71
72
|
vendorViewReducer_1.initialState.newVendorState.fetchStatus,
|
|
72
|
-
]
|
|
73
|
+
];
|
|
74
|
+
if (isAccountingClassesEnabled) {
|
|
75
|
+
editFetchStateList.push(classList);
|
|
76
|
+
}
|
|
77
|
+
fetchState = (0, reduceFetchState_1.reduceFetchState)(editFetchStateList);
|
|
73
78
|
}
|
|
74
79
|
else {
|
|
75
80
|
const basicVendorDetails = getBasicVendorDetailsForNewVendor(state, vendorViewState.newVendorState);
|
|
@@ -98,11 +103,17 @@ const getVendorView = (state, vendorIdFromUrl) => {
|
|
|
98
103
|
if (tentativeName != null) {
|
|
99
104
|
entityRecommendations = (0, recommendationSelector_1.getRecommendationsForEntity)(state, tentativeName, 'vendor');
|
|
100
105
|
}
|
|
106
|
+
const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state);
|
|
101
107
|
const fetchStateList = [
|
|
102
108
|
{ fetchState: accountList.fetchState, error: accountList.error },
|
|
103
|
-
{ fetchState: classList.fetchState, error: classList.error },
|
|
104
109
|
vendorTypeListState,
|
|
105
110
|
];
|
|
111
|
+
if (isAccountingClassesEnabled) {
|
|
112
|
+
fetchStateList.push({
|
|
113
|
+
fetchState: classList.fetchState,
|
|
114
|
+
error: classList.error,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
106
117
|
if (entityRecommendations != null &&
|
|
107
118
|
entityRecommendations.recommendations != null &&
|
|
108
119
|
entityRecommendations.recommendations.length > 0) {
|
|
@@ -147,6 +158,7 @@ const getVendorView = (state, vendorIdFromUrl) => {
|
|
|
147
158
|
fetchState: fetchState.fetchState,
|
|
148
159
|
hasWireTransfer,
|
|
149
160
|
hasInternationalWireTransfer,
|
|
161
|
+
isAccountingClassesEnabled: (0, tenantSelector_1.getIsAccountingClassesEnabled)(state),
|
|
150
162
|
deleteFileStatusById,
|
|
151
163
|
updateFileStatusById,
|
|
152
164
|
loggedInUserVerification,
|
|
@@ -223,9 +235,10 @@ const getBasicVendorDetailsForNewVendor = (state, newVendor) => {
|
|
|
223
235
|
};
|
|
224
236
|
const getVendorDetailPageView = (state, vendorId, entity) => {
|
|
225
237
|
const trendWithTransactions = (0, trendWithTransactionsSelector_1.getTrendWithTransactions)(state, entity, 'EntityDetail');
|
|
238
|
+
const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state);
|
|
226
239
|
const reducedFetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
|
|
227
240
|
state.accountListState.byReportId.accountList,
|
|
228
|
-
state.classListState,
|
|
241
|
+
...(isAccountingClassesEnabled ? [state.classListState] : []),
|
|
229
242
|
state.vendorTypeListState,
|
|
230
243
|
state.ownerListState,
|
|
231
244
|
state.vendorViewState.editVendorStateById[vendorId]?.fetchStatus ?? {
|
|
@@ -50,6 +50,7 @@ export interface VendorsTabVendorViewSelectorView extends SelectorView {
|
|
|
50
50
|
accountsHierarchyList: NestedAccountHierarchyForReport[];
|
|
51
51
|
classHierarchyList: NestedClassHierarchyForReport[];
|
|
52
52
|
classList: ClassListSelectorView;
|
|
53
|
+
isAccountingClassesEnabled: boolean;
|
|
53
54
|
ownerList: User[];
|
|
54
55
|
vendorTypeList: VendorType[];
|
|
55
56
|
vendorView?: VendorsTabVendorDetails;
|
|
@@ -9,6 +9,7 @@ const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
|
9
9
|
const addressSelector_1 = require("../../../entity/address/addressSelector");
|
|
10
10
|
const contactSelector_1 = require("../../../entity/billPay/contact/contactSelector");
|
|
11
11
|
const classSelector_1 = require("../../../entity/class/classSelector");
|
|
12
|
+
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
12
13
|
const userSelector_1 = require("../../../entity/user/userSelector");
|
|
13
14
|
const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
|
|
14
15
|
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
@@ -24,6 +25,7 @@ const toVendorDetailTabsType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_
|
|
|
24
25
|
exports.toVendorDetailTabsType = toVendorDetailTabsType;
|
|
25
26
|
const getVendorsTabVendorView = (state, vendorIdFromUrl) => {
|
|
26
27
|
const { accountListState, accountState, classListState, classState, vendorState, userState, vendorsTabVendorViewState, vendorTypeListState, addressState, addressViewState, contactState, } = state;
|
|
28
|
+
const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state);
|
|
27
29
|
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
|
|
28
30
|
const classList = (0, classListSelector_1.getClassList)(classState, classListState);
|
|
29
31
|
const ownerList = (0, userSelector_1.getUsersByUserIds)(state.userState, state.ownerListState.ownerIds);
|
|
@@ -55,7 +57,7 @@ const getVendorsTabVendorView = (state, vendorIdFromUrl) => {
|
|
|
55
57
|
}
|
|
56
58
|
fetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
57
59
|
accountList,
|
|
58
|
-
classList,
|
|
60
|
+
...(isAccountingClassesEnabled ? [classList] : []),
|
|
59
61
|
vendorTypeListState,
|
|
60
62
|
vendorsTabVendorViewState.vendorStateById[vendorIdFromUrl]?.fetchStatus ?? {
|
|
61
63
|
fetchState: 'Not-Started',
|
|
@@ -66,6 +68,7 @@ const getVendorsTabVendorView = (state, vendorIdFromUrl) => {
|
|
|
66
68
|
return {
|
|
67
69
|
accountList: accountList,
|
|
68
70
|
classList: classList,
|
|
71
|
+
isAccountingClassesEnabled,
|
|
69
72
|
vendorTypeList: vendorTypeList,
|
|
70
73
|
accountsHierarchyList,
|
|
71
74
|
classHierarchyList,
|
|
@@ -107,9 +110,10 @@ const getVendorsTabDetailPageView = (state, vendorId, entity) => {
|
|
|
107
110
|
? (0, transactionListByEntitySelector_1.getTransactionListByEntityForSinglePeriod)(state, entity, state.vendorsTabVendorViewState.allTransactionsTabData
|
|
108
111
|
.numberOfQuartersFetched)
|
|
109
112
|
: undefined;
|
|
113
|
+
const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state);
|
|
110
114
|
const reducedFetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
|
|
111
115
|
state.accountListState.byReportId.accountList,
|
|
112
|
-
state.classListState,
|
|
116
|
+
...(isAccountingClassesEnabled ? [state.classListState] : []),
|
|
113
117
|
state.ownerListState,
|
|
114
118
|
state.vendorTypeListState,
|
|
115
119
|
state.vendorsTabVendorViewState.vendorStateById[vendorId]?.fetchStatus ?? {
|
|
@@ -24,13 +24,13 @@ const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, op
|
|
|
24
24
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
25
25
|
const updateActions = [];
|
|
26
26
|
updateActions.push((0, jeSchedulesReducer_1.updateJESchedules)([
|
|
27
|
-
...response.data.
|
|
27
|
+
...response.data.je_schedules,
|
|
28
28
|
...response.data.failed_je_postings.je_schedules,
|
|
29
29
|
]), (0, jeSchedulesReducer_1.updateJESchedulesDetails)([...response.data.failed_je_postings.je_schedules], response.data.failed_je_postings.scheduled_journal_entries), (0, jeSchedulesViewReducer_1.initializeJeScheduleLocalData)([
|
|
30
30
|
...response.data.failed_je_postings.je_schedules,
|
|
31
31
|
]));
|
|
32
32
|
updateActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesSuccess)({
|
|
33
|
-
jeSchedules: [...response.data.
|
|
33
|
+
jeSchedules: [...response.data.je_schedules],
|
|
34
34
|
failedJeSchedules: [
|
|
35
35
|
...response.data.failed_je_postings.je_schedules,
|
|
36
36
|
],
|
|
@@ -6,7 +6,7 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
7
|
const bulkUploadTiming_1 = require("../../bulkUploadTiming");
|
|
8
8
|
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
9
|
-
const bulkUploadReceiptsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadReceipts.match), (0, operators_1.
|
|
9
|
+
const bulkUploadReceiptsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadReceipts.match), (0, operators_1.switchMap)((action) => {
|
|
10
10
|
const { files } = action.payload;
|
|
11
11
|
const formData = new FormData();
|
|
12
12
|
for (const file of files) {
|
package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js
CHANGED
|
@@ -29,7 +29,7 @@ exports.pusherBatchStatusCompletionEpic = pusherBatchStatusCompletionEpic;
|
|
|
29
29
|
* force `phase` to `completed` (dismiss automatching banner) and refresh the batch list.
|
|
30
30
|
* Cancels when the batch completes normally, bulk state is cleared, or another upload supersedes.
|
|
31
31
|
*/
|
|
32
|
-
const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadReceiptsSuccess.match), (0, operators_1.
|
|
32
|
+
const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadReceiptsSuccess.match), (0, operators_1.switchMap)((action) => {
|
|
33
33
|
const { batchId } = action.payload;
|
|
34
34
|
return (0, rxjs_1.timer)(bulkUploadTiming_1.BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS).pipe((0, operators_1.mergeMap)(() => {
|
|
35
35
|
const bulk = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
|
|
@@ -49,10 +49,11 @@ exports.bulkUploadAutomatchingTimeoutEpic = bulkUploadAutomatchingTimeoutEpic;
|
|
|
49
49
|
* error snackbar per upload session (first failure only) so the user is not spammed every
|
|
50
50
|
* interval; Pusher or a later successful poll still completes the flow.
|
|
51
51
|
*/
|
|
52
|
-
const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadReceiptsSuccess.match), (0, operators_1.
|
|
52
|
+
const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadReceiptsSuccess.match), (0, operators_1.switchMap)((action) => {
|
|
53
53
|
const { batchId } = action.payload;
|
|
54
54
|
let pollErrorNotified = false;
|
|
55
|
-
return (0, rxjs_1.timer)(FALLBACK_FIRST_DELAY_MS, FALLBACK_POLL_INTERVAL_MS).pipe((0, operators_1.takeUntil)((0, rxjs_1.merge)(actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.clearBulkUpload.match)), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.pusherBatchStatusUpdate.match), (0, operators_1.filter)((action) => action.payload.batchId === batchId
|
|
55
|
+
return (0, rxjs_1.timer)(FALLBACK_FIRST_DELAY_MS, FALLBACK_POLL_INTERVAL_MS).pipe((0, operators_1.takeUntil)((0, rxjs_1.merge)(actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.clearBulkUpload.match)), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.pusherBatchStatusUpdate.match), (0, operators_1.filter)((action) => action.payload.batchId === batchId &&
|
|
56
|
+
action.payload.status === 'completed')), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsSuccess.match), (0, operators_1.filter)((action) => action.payload.batchId === batchId)), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadAutomatchingTimedOut.match), (0, operators_1.filter)((action) => action.payload.batchId === batchId)))), (0, operators_1.switchMap)(() => zeniAPI
|
|
56
57
|
.getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${batchId}`)
|
|
57
58
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
58
59
|
/** Same batch-details URL; polls until `status` is completed (Pusher may win first). */
|
|
@@ -94,7 +94,6 @@ function getExpenseAutomationView(state) {
|
|
|
94
94
|
const fetchStateVariables = [
|
|
95
95
|
expenseAutomationMissingReceiptsViewState,
|
|
96
96
|
expenseAutomationJESchedulesViewState,
|
|
97
|
-
monthEndCloseChecksView,
|
|
98
97
|
expenseAutomationTransactionsView,
|
|
99
98
|
expenseAutomationReconciliationViewState,
|
|
100
99
|
];
|
|
@@ -67,8 +67,8 @@ const toTransactionUpdatesFromTransactionCategorizationLocalData = (transactionC
|
|
|
67
67
|
lineItem.account?.qboId !== accountLine.account.qboId &&
|
|
68
68
|
Boolean(lineItem.account?.qboId);
|
|
69
69
|
hasClassChanged =
|
|
70
|
-
|
|
71
|
-
lineItem.class?.qboId !== accountLine.class
|
|
70
|
+
(lineItem.class?.qboId != null || accountLine.class?.qboId != null) &&
|
|
71
|
+
lineItem.class?.qboId !== accountLine.class?.qboId;
|
|
72
72
|
const recommendedAccountBase = (0, saveTransactionHelper_1.toRecommendedAccountBase)(lineItem.amount.amount, lineItem.account);
|
|
73
73
|
const recommendedClassBase = (0, saveTransactionHelper_1.toRecommendedClassBase)(lineItem.amount.amount, lineItem.class);
|
|
74
74
|
if (entityDetails != null &&
|
|
@@ -241,7 +241,7 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
|
|
|
241
241
|
isPreFilled: true,
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
|
-
if (accountLine.class
|
|
244
|
+
if (Boolean(accountLine.class?.classId) === false &&
|
|
245
245
|
higherPreferenceRecommendation?.class != null) {
|
|
246
246
|
record.class = {
|
|
247
247
|
...higherPreferenceRecommendation.class,
|
|
@@ -472,7 +472,7 @@ const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transac
|
|
|
472
472
|
}
|
|
473
473
|
: accountLine.account;
|
|
474
474
|
record.class =
|
|
475
|
-
accountLine.class
|
|
475
|
+
Boolean(accountLine.class?.classId) !== false
|
|
476
476
|
? accountLine.class
|
|
477
477
|
: recommendations?.[0]?.class
|
|
478
478
|
? {
|
|
@@ -10,11 +10,11 @@ export interface ExpenseAutomationJESchedulesQueryPayload {
|
|
|
10
10
|
start_date: string;
|
|
11
11
|
}
|
|
12
12
|
interface ExpenseAutomationJESchedulesPayload {
|
|
13
|
-
draft_je_schedules: JEScheduledTransactionPayload[];
|
|
14
13
|
failed_je_postings: {
|
|
15
14
|
je_schedules: JEScheduledTransactionPayload[];
|
|
16
15
|
scheduled_journal_entries: ScheduledJournalEntryPayload[];
|
|
17
16
|
};
|
|
17
|
+
je_schedules: JEScheduledTransactionPayload[];
|
|
18
18
|
}
|
|
19
19
|
export type ExpenseAutomationJESchedulesResponse = ZeniAPIResponse<ExpenseAutomationJESchedulesPayload>;
|
|
20
20
|
export interface IgnoreDraftJESchedulePayload {
|