@zeniai/client-epic-state 4.19.12 → 4.19.13-beta0AD
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/epic.d.ts +2 -1
- package/lib/epic.js +2 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +5 -2
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/accountList/accountListReducer.d.ts +1 -2
- package/lib/view/accountList/accountListReducer.js +6 -3
- package/lib/view/accountList/fetchAccountListEpic.js +7 -2
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +8 -1
- package/lib/view/aiCfoView/aiCfoViewReducer.js +36 -2
- package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +1 -0
- package/lib/view/aiCfoView/aiCfoViewSelector.js +2 -1
- package/lib/view/aiCfoView/aiCfoViewState.d.ts +1 -0
- package/lib/view/aiCfoView/epics/deleteChatSessionEpic.d.ts +21 -0
- package/lib/view/aiCfoView/epics/deleteChatSessionEpic.js +33 -0
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +8 -6
- package/lib/zeniAPI.d.ts +1 -0
- package/lib/zeniAPI.js +6 -0
- package/package.json +1 -1
|
@@ -3,8 +3,7 @@ import { AccountListResponse } from './accountListPayload';
|
|
|
3
3
|
import { AccountList, AccountListKeyType, AccountListState } from './accountListState';
|
|
4
4
|
export declare const initialAccountList: AccountList;
|
|
5
5
|
export declare const initialState: AccountListState;
|
|
6
|
-
export declare const fetchAccountList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountListKey: AccountListKeyType, fetchFullResponse?: any, excludeAccountPayableAccounts?: any, excludeAccountReceivableAccounts?: any, isLimitedCategoryEnabled?: any, filterAccountTypes?: ("cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets")[] | undefined
|
|
7
|
-
isIncludeDeleted?: true | undefined;
|
|
6
|
+
export declare const fetchAccountList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountListKey: AccountListKeyType, fetchFullResponse?: any, excludeAccountPayableAccounts?: any, excludeAccountReceivableAccounts?: any, isLimitedCategoryEnabled?: any, filterAccountTypes?: ("cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets")[] | undefined], {
|
|
8
7
|
accountListKey: AccountListKeyType;
|
|
9
8
|
fetchFullResponse: any;
|
|
10
9
|
excludeAccountPayableAccounts: any;
|
|
@@ -45,13 +45,16 @@ const accountList = (0, toolkit_1.createSlice)({
|
|
|
45
45
|
const existingData = draft.byReportId[action.payload.accountListKey];
|
|
46
46
|
draft.byReportId[action.payload.accountListKey] = Object.assign(Object.assign({}, existingData), { fetchState: 'In-Progress', error: undefined });
|
|
47
47
|
},
|
|
48
|
-
prepare(accountListKey, fetchFullResponse = false, excludeAccountPayableAccounts = false, excludeAccountReceivableAccounts = false, isLimitedCategoryEnabled = false, filterAccountTypes
|
|
48
|
+
prepare(accountListKey, fetchFullResponse = false, excludeAccountPayableAccounts = false, excludeAccountReceivableAccounts = false, isLimitedCategoryEnabled = false, filterAccountTypes) {
|
|
49
49
|
return {
|
|
50
|
-
payload:
|
|
50
|
+
payload: {
|
|
51
|
+
accountListKey,
|
|
51
52
|
fetchFullResponse,
|
|
52
53
|
excludeAccountPayableAccounts,
|
|
53
54
|
excludeAccountReceivableAccounts,
|
|
54
|
-
isLimitedCategoryEnabled,
|
|
55
|
+
isLimitedCategoryEnabled,
|
|
56
|
+
filterAccountTypes: filterAccountTypes !== null && filterAccountTypes !== void 0 ? filterAccountTypes : [],
|
|
57
|
+
},
|
|
55
58
|
};
|
|
56
59
|
},
|
|
57
60
|
},
|
|
@@ -16,9 +16,14 @@ const getAccountTypes = (isLimitedCategoryEnabled, filterAccountTypes) => {
|
|
|
16
16
|
return [];
|
|
17
17
|
};
|
|
18
18
|
const fetchAccountListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(accountListReducer_1.fetchAccountList.match), (0, operators_1.mergeMap)((action) => {
|
|
19
|
-
const { accountListKey, fetchFullResponse, excludeAccountPayableAccounts, excludeAccountReceivableAccounts, isLimitedCategoryEnabled, filterAccountTypes,
|
|
19
|
+
const { accountListKey, fetchFullResponse, excludeAccountPayableAccounts, excludeAccountReceivableAccounts, isLimitedCategoryEnabled, filterAccountTypes, } = action.payload;
|
|
20
20
|
const accountTypes = getAccountTypes(isLimitedCategoryEnabled, filterAccountTypes);
|
|
21
|
-
const queryValue =
|
|
21
|
+
const queryValue = {
|
|
22
|
+
is_bookkeeping_admin: fetchFullResponse,
|
|
23
|
+
is_exclude_account_payable_accounts: excludeAccountPayableAccounts,
|
|
24
|
+
is_exclude_account_receivable_accounts: excludeAccountReceivableAccounts,
|
|
25
|
+
account_types: accountTypes,
|
|
26
|
+
};
|
|
22
27
|
return zeniAPI
|
|
23
28
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accounts?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
|
|
24
29
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
@@ -70,7 +70,14 @@ export declare const submitQuestion: import("@reduxjs/toolkit").ActionCreatorWit
|
|
|
70
70
|
error: ZeniAPIStatus;
|
|
71
71
|
}, "aiCfoView/stopSubmitQuestionFailure">, acceptMasterTOS: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userRoleId: string], {
|
|
72
72
|
userRoleId: string;
|
|
73
|
-
}, "aiCfoView/acceptMasterTOS", never, never>, acceptMasterTOSSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfoView/acceptMasterTOSSuccess">, acceptMasterTOSFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "aiCfoView/acceptMasterTOSFailure">,
|
|
73
|
+
}, "aiCfoView/acceptMasterTOS", never, never>, acceptMasterTOSSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfoView/acceptMasterTOSSuccess">, acceptMasterTOSFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "aiCfoView/acceptMasterTOSFailure">, deleteChatSession: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[chatSessionId: string], {
|
|
74
|
+
chatSessionId: string;
|
|
75
|
+
}, "aiCfoView/deleteChatSession", never, never>, deleteChatSessionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
76
|
+
chatSessionId: ID;
|
|
77
|
+
}, "aiCfoView/deleteChatSessionSuccess">, deleteChatSessionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
78
|
+
chatSessionId: ID;
|
|
79
|
+
error: ZeniAPIStatus;
|
|
80
|
+
}, "aiCfoView/deleteChatSessionFailure">, clearAiCfoView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfoView/clearAiCfoView">, updateCotCollapsedState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
74
81
|
isCollapsed: boolean;
|
|
75
82
|
questionAnswerId: ID;
|
|
76
83
|
}, "aiCfoView/updateCotCollapsedState">;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateCotCollapsedState = exports.clearAiCfoView = exports.acceptMasterTOSFailure = exports.acceptMasterTOSSuccess = exports.acceptMasterTOS = exports.stopSubmitQuestionFailure = exports.stopSubmitQuestionSuccess = exports.stopSubmitQuestion = exports.stopSubmitFailure = exports.stopSubmitSuccess = exports.stopSubmit = exports.clearCurrentSessionId = exports.fetchChatHistoryFailure = exports.fetchChatHistorySuccess = exports.fetchChatHistory = exports.fetchChatSessionsForUserFailure = exports.fetchChatSessionsForUserSuccess = exports.fetchChatSessionsForUser = exports.createSessionAndSubmitFailure = exports.createSessionAndSubmitSuccess = exports.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.updateCotCollapsedState = exports.clearAiCfoView = 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.clearCurrentSessionId = exports.fetchChatHistoryFailure = exports.fetchChatHistorySuccess = exports.fetchChatHistory = exports.fetchChatSessionsForUserFailure = exports.fetchChatSessionsForUserSuccess = exports.fetchChatSessionsForUser = exports.createSessionAndSubmitFailure = exports.createSessionAndSubmitSuccess = exports.initializeNewSessionState = exports.createSessionAndSubmit = exports.createSessionFailure = exports.createSessionSuccess = exports.createSession = exports.setSession = exports.clearInput = exports.updateCurrentInput = exports.updateAiCfoViewScrollPosition = exports.updateResponseState = exports.submitQuestionFailure = exports.submitQuestionSuccess = exports.submitQuestion = exports.initialAiCfoViewState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
exports.initialAiCfoViewState = {
|
|
7
7
|
fetchState: 'Not-Started',
|
|
@@ -29,6 +29,7 @@ exports.initialAiCfoViewState = {
|
|
|
29
29
|
fetchState: 'Not-Started',
|
|
30
30
|
error: undefined,
|
|
31
31
|
},
|
|
32
|
+
deleteChatSessionStateByChatSessionId: {},
|
|
32
33
|
fetchChatSessionHistoryByChatSessionId: {},
|
|
33
34
|
responseStateByChatSessionId: {},
|
|
34
35
|
stopSubmitStateByChatSessionId: {},
|
|
@@ -310,6 +311,39 @@ const aiCfoView = (0, toolkit_1.createSlice)({
|
|
|
310
311
|
draft.masterTOSAcceptanceState.fetchState = 'Error';
|
|
311
312
|
draft.masterTOSAcceptanceState.error = action.payload;
|
|
312
313
|
},
|
|
314
|
+
deleteChatSession: {
|
|
315
|
+
reducer(draft, action) {
|
|
316
|
+
const { chatSessionId } = action.payload;
|
|
317
|
+
draft.deleteChatSessionStateByChatSessionId[chatSessionId] = {
|
|
318
|
+
fetchState: 'In-Progress',
|
|
319
|
+
error: undefined,
|
|
320
|
+
};
|
|
321
|
+
},
|
|
322
|
+
prepare(chatSessionId) {
|
|
323
|
+
return { payload: { chatSessionId } };
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
deleteChatSessionSuccess(draft, action) {
|
|
327
|
+
const { chatSessionId } = action.payload;
|
|
328
|
+
delete draft.deleteChatSessionStateByChatSessionId[chatSessionId];
|
|
329
|
+
draft.allChatSessionIds = draft.allChatSessionIds.filter((id) => id !== chatSessionId);
|
|
330
|
+
if (draft.uiState.currentChatSessionId === chatSessionId) {
|
|
331
|
+
draft.uiState.currentChatSessionId = undefined;
|
|
332
|
+
draft.uiState.agentId = undefined;
|
|
333
|
+
}
|
|
334
|
+
delete draft.uiState.chatHistoryNextPageToken[chatSessionId];
|
|
335
|
+
delete draft.uiState.scrollPositionByChatSessionId[chatSessionId];
|
|
336
|
+
delete draft.fetchChatSessionHistoryByChatSessionId[chatSessionId];
|
|
337
|
+
delete draft.responseStateByChatSessionId[chatSessionId];
|
|
338
|
+
delete draft.stopSubmitStateByChatSessionId[chatSessionId];
|
|
339
|
+
},
|
|
340
|
+
deleteChatSessionFailure(draft, action) {
|
|
341
|
+
const { chatSessionId, error } = action.payload;
|
|
342
|
+
draft.deleteChatSessionStateByChatSessionId[chatSessionId] = {
|
|
343
|
+
fetchState: 'Error',
|
|
344
|
+
error,
|
|
345
|
+
};
|
|
346
|
+
},
|
|
313
347
|
clearInput(draft) {
|
|
314
348
|
draft.uiState.currentInput = '';
|
|
315
349
|
},
|
|
@@ -326,5 +360,5 @@ const aiCfoView = (0, toolkit_1.createSlice)({
|
|
|
326
360
|
},
|
|
327
361
|
},
|
|
328
362
|
});
|
|
329
|
-
_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.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.clearAiCfoView = _a.clearAiCfoView, exports.updateCotCollapsedState = _a.updateCotCollapsedState;
|
|
363
|
+
_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.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.clearAiCfoView = _a.clearAiCfoView, exports.updateCotCollapsedState = _a.updateCotCollapsedState;
|
|
330
364
|
exports.default = aiCfoView.reducer;
|
|
@@ -7,6 +7,7 @@ import { AiCfoViewUIState } from './aiCfoViewState';
|
|
|
7
7
|
export interface AiCfoViewSelector extends SelectorView, AiCfoSelectorView {
|
|
8
8
|
createSessionAndSubmitState: FetchStateAndError;
|
|
9
9
|
createSessionState: FetchStateAndError;
|
|
10
|
+
deleteChatSessionStateByChatSessionId: Record<ID, FetchStateAndError>;
|
|
10
11
|
fetchChatSessionHistoryByChatSessionId: Record<ID, FetchStateAndError>;
|
|
11
12
|
masterTOSAcceptanceState: FetchStateAndError;
|
|
12
13
|
responseStateByChatSessionId: Record<ID, {
|
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getAiCfoView = void 0;
|
|
4
4
|
const aiCfoSelector_1 = require("../../entity/aiCfo/aiCfoSelector");
|
|
5
5
|
const getAiCfoView = (state) => {
|
|
6
|
-
const { fetchState, error, uiState, createSessionState, createSessionAndSubmitState, stopSubmitStateByChatSessionId, responseStateByChatSessionId, fetchChatSessionHistoryByChatSessionId, masterTOSAcceptanceState, } = state.aiCfoViewState;
|
|
6
|
+
const { fetchState, error, uiState, createSessionState, createSessionAndSubmitState, deleteChatSessionStateByChatSessionId, stopSubmitStateByChatSessionId, responseStateByChatSessionId, fetchChatSessionHistoryByChatSessionId, masterTOSAcceptanceState, } = state.aiCfoViewState;
|
|
7
7
|
return Object.assign(Object.assign({ fetchState,
|
|
8
8
|
error,
|
|
9
9
|
createSessionState,
|
|
10
10
|
createSessionAndSubmitState,
|
|
11
|
+
deleteChatSessionStateByChatSessionId,
|
|
11
12
|
stopSubmitStateByChatSessionId,
|
|
12
13
|
responseStateByChatSessionId,
|
|
13
14
|
uiState,
|
|
@@ -26,6 +26,7 @@ export interface AiCfoViewState extends FetchStateAndError {
|
|
|
26
26
|
allChatSessionIds: ID[];
|
|
27
27
|
createSessionAndSubmitState: FetchStateAndError;
|
|
28
28
|
createSessionState: FetchStateAndError;
|
|
29
|
+
deleteChatSessionStateByChatSessionId: Record<ID, FetchStateAndError>;
|
|
29
30
|
fetchChatSessionHistoryByChatSessionId: Record<ID, FetchStateAndError>;
|
|
30
31
|
masterTOSAcceptanceState: FetchStateAndError;
|
|
31
32
|
responseStateByChatSessionId: Record<ID, {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { clearSession } from '../../../entity/aiCfo/aiCfoReducer';
|
|
3
|
+
import { RootState } from '../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
|
+
import { deleteChatSession, deleteChatSessionFailure, deleteChatSessionSuccess } from '../aiCfoViewReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof deleteChatSession> | ReturnType<typeof clearSession> | ReturnType<typeof deleteChatSessionSuccess> | ReturnType<typeof deleteChatSessionFailure>;
|
|
7
|
+
export declare const deleteChatSessionEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
8
|
+
payload: string;
|
|
9
|
+
type: "aiCfo/clearSession";
|
|
10
|
+
} | {
|
|
11
|
+
payload: {
|
|
12
|
+
chatSessionId: import("../../..").ID;
|
|
13
|
+
};
|
|
14
|
+
type: "aiCfoView/deleteChatSessionSuccess";
|
|
15
|
+
} | {
|
|
16
|
+
payload: {
|
|
17
|
+
chatSessionId: import("../../..").ID;
|
|
18
|
+
error: import("../../../responsePayload").ZeniAPIStatus;
|
|
19
|
+
};
|
|
20
|
+
type: "aiCfoView/deleteChatSessionFailure";
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteChatSessionEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const aiCfoReducer_1 = require("../../../entity/aiCfo/aiCfoReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
+
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
9
|
+
const deleteChatSessionEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.deleteChatSession.match), (0, operators_1.mergeMap)((action) => {
|
|
10
|
+
const { chatSessionId } = action.payload;
|
|
11
|
+
// No request body; chat_session_id is in the path. API returns 204 No Content on success.
|
|
12
|
+
return zeniAPI
|
|
13
|
+
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/sessions/${chatSessionId}`)
|
|
14
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
|
+
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
16
|
+
return (0, rxjs_1.from)([
|
|
17
|
+
(0, aiCfoViewReducer_1.deleteChatSessionSuccess)({ chatSessionId }),
|
|
18
|
+
(0, aiCfoReducer_1.clearSession)(chatSessionId)
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.deleteChatSessionFailure)({
|
|
23
|
+
chatSessionId,
|
|
24
|
+
error: response.status,
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.deleteChatSessionFailure)({
|
|
28
|
+
chatSessionId,
|
|
29
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Delete chat session REST API call errored out ' +
|
|
30
|
+
JSON.stringify(error)),
|
|
31
|
+
}))));
|
|
32
|
+
}));
|
|
33
|
+
exports.deleteChatSessionEpic = deleteChatSessionEpic;
|
package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js
CHANGED
|
@@ -18,8 +18,8 @@ const fetchEditRemiDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
18
18
|
const state = state$.value;
|
|
19
19
|
const userId = (_b = (_a = state.tenantState.loggedInUser) === null || _a === void 0 ? void 0 : _a.userId) !== null && _b !== void 0 ? _b : '';
|
|
20
20
|
if (cacheOverride) {
|
|
21
|
-
remiDetailActions.push((0, accountListReducer_1.fetchAccountList)('reimbursementAccountList', true, true, true, isLimitedCategoryEnabled
|
|
22
|
-
remiDetailActions.push((0, classListReducer_1.fetchClassList)(
|
|
21
|
+
remiDetailActions.push((0, accountListReducer_1.fetchAccountList)('reimbursementAccountList', true, true, true, isLimitedCategoryEnabled));
|
|
22
|
+
remiDetailActions.push((0, classListReducer_1.fetchClassList)());
|
|
23
23
|
remiDetailActions.push((0, merchantListReducer_1.fetchMerchantList)());
|
|
24
24
|
remiDetailActions.push((0, reimbursementConfigReducer_1.fetchReimbursementConfig)());
|
|
25
25
|
remiDetailActions.push((0, userFinancialAccountReducer_1.fetchUserFinancialAccount)(userId, reimbursementId));
|
|
@@ -29,12 +29,14 @@ const fetchEditRemiDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
const accountList = state.accountListState.byReportId.reimbursementAccountList;
|
|
32
|
-
if (accountList.
|
|
33
|
-
|
|
32
|
+
if (accountList.hasValidState() === false &&
|
|
33
|
+
accountList.fetchState !== 'In-Progress') {
|
|
34
|
+
remiDetailActions.push((0, accountListReducer_1.fetchAccountList)('reimbursementAccountList', true, true, true, isLimitedCategoryEnabled));
|
|
34
35
|
}
|
|
35
36
|
const classList = state.classListState;
|
|
36
|
-
if (classList.
|
|
37
|
-
|
|
37
|
+
if (classList.hasValidState() === false &&
|
|
38
|
+
classList.fetchState !== 'In-Progress') {
|
|
39
|
+
remiDetailActions.push((0, classListReducer_1.fetchClassList)());
|
|
38
40
|
}
|
|
39
41
|
const merchantList = state.merchantListState;
|
|
40
42
|
if (merchantList.hasValidState() === false &&
|
package/lib/zeniAPI.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export declare class ZeniAPIClient implements ZeniAPI {
|
|
|
53
53
|
private checkSessionValidity;
|
|
54
54
|
/**
|
|
55
55
|
* Parse JSON response and check for session validity.
|
|
56
|
+
* For 204 No Content, the response body is empty so we return a minimal status object.
|
|
56
57
|
*/
|
|
57
58
|
private processJsonResponse;
|
|
58
59
|
getJSON<T>(restEndPoint: string, headers?: Record<string, unknown>, signal?: AbortSignal): Observable<T>;
|
package/lib/zeniAPI.js
CHANGED
|
@@ -36,8 +36,14 @@ class ZeniAPIClient {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Parse JSON response and check for session validity.
|
|
39
|
+
* For 204 No Content, the response body is empty so we return a minimal status object.
|
|
39
40
|
*/
|
|
40
41
|
processJsonResponse(response) {
|
|
42
|
+
if (response.status === 204) {
|
|
43
|
+
const json = { status: { code: 204, message: 'No Content' } };
|
|
44
|
+
this.checkSessionValidity(json);
|
|
45
|
+
return Promise.resolve(json);
|
|
46
|
+
}
|
|
41
47
|
return response.json().then((json) => {
|
|
42
48
|
this.checkSessionValidity(json);
|
|
43
49
|
return json;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.19.
|
|
3
|
+
"version": "4.19.13-beta0AD",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|