@zeniai/client-epic-state 4.18.20 → 4.18.21
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/commonStateTypes/accountView/getNestedAccountIDHierarchyForReport.js +0 -2
- package/lib/commonStateTypes/accountView/nestedAccountID.d.ts +0 -1
- package/lib/entity/account/accountPayload.d.ts +0 -1
- package/lib/entity/account/accountPayload.js +1 -2
- package/lib/entity/account/accountSelector.d.ts +0 -3
- package/lib/entity/account/accountSelector.js +0 -2
- package/lib/entity/account/accountState.d.ts +0 -1
- package/lib/entity/account/pickAndMergeForecastAccountReport.d.ts +0 -1
- package/lib/entity/accountGroup/accountGroupSelector.d.ts +0 -22
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/epic.d.ts +1 -2
- package/lib/epic.js +1 -2
- package/lib/index.d.ts +1 -4
- package/lib/index.js +23 -30
- package/lib/init.d.ts +0 -2
- package/lib/init.js +2 -2
- package/lib/reducer.d.ts +0 -3
- package/lib/reducer.js +0 -3
- package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.js +0 -29
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +2 -2
- package/lib/view/aiCfoView/aiCfoViewReducer.js +6 -10
- package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.d.ts +3 -3
- package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +18 -113
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +0 -1
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +0 -1
- package/lib/view/netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewReducer.js +0 -1
- package/lib/view/opExClassesView/opExClassesViewReducer.js +0 -1
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +0 -1
- package/lib/view/revenueClassesView/revenueClassesViewReducer.js +0 -1
- package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +0 -8
- package/package.json +1 -1
- package/lib/view/reportsResync/reportsResyncEpic.d.ts +0 -8
- package/lib/view/reportsResync/reportsResyncEpic.js +0 -40
- package/lib/view/reportsResync/reportsResyncReducer.d.ts +0 -12
- package/lib/view/reportsResync/reportsResyncReducer.js +0 -45
- package/lib/view/reportsResync/reportsResyncSelector.d.ts +0 -7
- package/lib/view/reportsResync/reportsResyncSelector.js +0 -10
- package/lib/view/reportsResync/reportsResyncState.d.ts +0 -5
- package/lib/view/reportsResync/reportsResyncState.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
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.
|
|
4
|
+
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.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',
|
|
@@ -208,21 +208,17 @@ const aiCfoView = (0, toolkit_1.createSlice)({
|
|
|
208
208
|
};
|
|
209
209
|
},
|
|
210
210
|
},
|
|
211
|
-
|
|
211
|
+
createSessionAndSubmitSuccess(draft, action) {
|
|
212
212
|
const { agentId, sessionId } = action.payload;
|
|
213
|
-
draft.uiState.currentChatSessionId = sessionId;
|
|
214
213
|
draft.uiState.agentId = agentId;
|
|
214
|
+
draft.createSessionAndSubmitState.fetchState = 'Completed';
|
|
215
|
+
draft.createSessionAndSubmitState.error = undefined;
|
|
216
|
+
draft.uiState.currentChatSessionId = sessionId;
|
|
215
217
|
draft.uiState.chatHistoryNextPageToken[sessionId] = {
|
|
216
218
|
nextPageToken: null,
|
|
217
219
|
hasMore: false,
|
|
218
220
|
};
|
|
219
221
|
},
|
|
220
|
-
createSessionAndSubmitSuccess(draft) {
|
|
221
|
-
// Note: currentChatSessionId, agentId, and chatHistoryNextPageToken are set by initializeNewSessionState
|
|
222
|
-
// This action only marks the createSessionAndSubmit operation as completed
|
|
223
|
-
draft.createSessionAndSubmitState.fetchState = 'Completed';
|
|
224
|
-
draft.createSessionAndSubmitState.error = undefined;
|
|
225
|
-
},
|
|
226
222
|
createSessionAndSubmitFailure(draft, action) {
|
|
227
223
|
draft.createSessionAndSubmitState.fetchState = 'Error';
|
|
228
224
|
draft.createSessionAndSubmitState.error = action.payload;
|
|
@@ -320,5 +316,5 @@ const aiCfoView = (0, toolkit_1.createSlice)({
|
|
|
320
316
|
},
|
|
321
317
|
},
|
|
322
318
|
});
|
|
323
|
-
_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.
|
|
319
|
+
_a = aiCfoView.actions, exports.submitQuestion = _a.submitQuestion, exports.submitQuestionSuccess = _a.submitQuestionSuccess, exports.submitQuestionFailure = _a.submitQuestionFailure, exports.updateResponseState = _a.updateResponseState, exports.updateAiCfoViewScrollPosition = _a.updateAiCfoViewScrollPosition, exports.updateCurrentInput = _a.updateCurrentInput, exports.clearInput = _a.clearInput, exports.setSession = _a.setSession, exports.createSession = _a.createSession, exports.createSessionSuccess = _a.createSessionSuccess, exports.createSessionFailure = _a.createSessionFailure, exports.createSessionAndSubmit = _a.createSessionAndSubmit, exports.createSessionAndSubmitSuccess = _a.createSessionAndSubmitSuccess, exports.createSessionAndSubmitFailure = _a.createSessionAndSubmitFailure, exports.fetchChatSessionsForUser = _a.fetchChatSessionsForUser, exports.fetchChatSessionsForUserSuccess = _a.fetchChatSessionsForUserSuccess, exports.fetchChatSessionsForUserFailure = _a.fetchChatSessionsForUserFailure, exports.fetchChatHistory = _a.fetchChatHistory, exports.fetchChatHistorySuccess = _a.fetchChatHistorySuccess, exports.fetchChatHistoryFailure = _a.fetchChatHistoryFailure, exports.clearCurrentSessionId = _a.clearCurrentSessionId, exports.stopSubmit = _a.stopSubmit, exports.stopSubmitSuccess = _a.stopSubmitSuccess, exports.stopSubmitFailure = _a.stopSubmitFailure, exports.stopSubmitQuestion = _a.stopSubmitQuestion, exports.stopSubmitQuestionSuccess = _a.stopSubmitQuestionSuccess, exports.stopSubmitQuestionFailure = _a.stopSubmitQuestionFailure, exports.acceptMasterTOS = _a.acceptMasterTOS, exports.acceptMasterTOSSuccess = _a.acceptMasterTOSSuccess, exports.acceptMasterTOSFailure = _a.acceptMasterTOSFailure, exports.clearAiCfoView = _a.clearAiCfoView;
|
|
324
320
|
exports.default = aiCfoView.reducer;
|
|
@@ -4,6 +4,6 @@ import { addQuestionPayload, setNewSession } from '../../../entity/aiCfo/aiCfoRe
|
|
|
4
4
|
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
5
|
import { RootState } from '../../../reducer';
|
|
6
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
|
-
import { createSessionAndSubmit, createSessionAndSubmitFailure, createSessionAndSubmitSuccess,
|
|
8
|
-
export type ActionType = ReturnType<typeof createSessionAndSubmit> | ReturnType<typeof setNewSession> | ReturnType<typeof submitQuestion> | ReturnType<typeof
|
|
9
|
-
export declare const createSessionAndSubmitEpic: (actions$: ActionsObservable<ActionType>,
|
|
7
|
+
import { createSessionAndSubmit, createSessionAndSubmitFailure, createSessionAndSubmitSuccess, submitQuestion } from '../aiCfoViewReducer';
|
|
8
|
+
export type ActionType = ReturnType<typeof createSessionAndSubmit> | ReturnType<typeof setNewSession> | ReturnType<typeof submitQuestion> | ReturnType<typeof createSessionAndSubmitSuccess> | ReturnType<typeof createSessionAndSubmitFailure> | ReturnType<typeof openSnackbar> | ReturnType<typeof addQuestionPayload>;
|
|
9
|
+
export declare const createSessionAndSubmitEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -5,128 +5,33 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const aiCfoReducer_1 = require("../../../entity/aiCfo/aiCfoReducer");
|
|
7
7
|
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
8
|
-
const init_1 = require("../../../init");
|
|
9
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
10
9
|
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
11
10
|
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
12
|
-
|
|
13
|
-
* Subscribe to a Pusher channel and wait for subscription to complete
|
|
14
|
-
* This ensures the channel is ready before proceeding with question submission
|
|
15
|
-
* Returns an object indicating success/failure so the caller can handle errors appropriately
|
|
16
|
-
*/
|
|
17
|
-
function waitForChannelSubscription(pusherInstance, channelName, timeoutMs = 5000) {
|
|
18
|
-
return new rxjs_1.Observable((subscriber) => {
|
|
19
|
-
if (pusherInstance == null) {
|
|
20
|
-
console.warn(`[createSessionAndSubmitEpic] ⚠️ Pusher not initialized, proceeding without waiting`);
|
|
21
|
-
subscriber.next({ success: false, error: 'Pusher not initialized' });
|
|
22
|
-
subscriber.complete();
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const fullChannelName = `private-${channelName}`;
|
|
26
|
-
const existingChannel = pusherInstance.channel(fullChannelName);
|
|
27
|
-
// If already subscribed, resolve immediately
|
|
28
|
-
if ((existingChannel === null || existingChannel === void 0 ? void 0 : existingChannel.subscribed) === true) {
|
|
29
|
-
subscriber.next({ success: true });
|
|
30
|
-
subscriber.complete();
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
// Subscribe to the channel (single line subscription)
|
|
34
|
-
const channel = existingChannel != null
|
|
35
|
-
? existingChannel
|
|
36
|
-
: pusherInstance.subscribe(fullChannelName);
|
|
37
|
-
// Set up subscription success handler
|
|
38
|
-
const subscriptionSuccessHandler = () => {
|
|
39
|
-
channel.unbind('pusher:subscription_succeeded', subscriptionSuccessHandler);
|
|
40
|
-
channel.unbind('pusher:subscription_error', subscriptionErrorHandler);
|
|
41
|
-
subscriber.next({ success: true });
|
|
42
|
-
subscriber.complete();
|
|
43
|
-
};
|
|
44
|
-
// Set up subscription error handler
|
|
45
|
-
const subscriptionErrorHandler = () => {
|
|
46
|
-
channel.unbind('pusher:subscription_succeeded', subscriptionSuccessHandler);
|
|
47
|
-
channel.unbind('pusher:subscription_error', subscriptionErrorHandler);
|
|
48
|
-
subscriber.error(new Error(`Failed to subscribe to channel ${fullChannelName}`));
|
|
49
|
-
};
|
|
50
|
-
// Bind handlers
|
|
51
|
-
channel.bind('pusher:subscription_succeeded', subscriptionSuccessHandler);
|
|
52
|
-
channel.bind('pusher:subscription_error', subscriptionErrorHandler);
|
|
53
|
-
// Check if subscription completed synchronously
|
|
54
|
-
if (channel.subscribed === true) {
|
|
55
|
-
subscriptionSuccessHandler();
|
|
56
|
-
}
|
|
57
|
-
// Cleanup function
|
|
58
|
-
return () => {
|
|
59
|
-
channel.unbind('pusher:subscription_succeeded', subscriptionSuccessHandler);
|
|
60
|
-
channel.unbind('pusher:subscription_error', subscriptionErrorHandler);
|
|
61
|
-
};
|
|
62
|
-
}).pipe((0, operators_1.timeout)(timeoutMs), (0, operators_1.first)(), (0, operators_1.catchError)((error) => {
|
|
63
|
-
// Return failure result to allow caller to handle appropriately
|
|
64
|
-
// This could be a timeout or subscription error
|
|
65
|
-
const errorMessage = error instanceof Error
|
|
66
|
-
? error.message
|
|
67
|
-
: 'Subscription timeout or error';
|
|
68
|
-
return (0, rxjs_1.of)({ success: false, error: errorMessage });
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
-
const createSessionAndSubmitEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.createSessionAndSubmit.match), (0, operators_1.switchMap)((action) => {
|
|
11
|
+
const createSessionAndSubmitEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.createSessionAndSubmit.match), (0, operators_1.switchMap)((action) => {
|
|
72
12
|
const { agentId, userId, questionAnswerId, questionId, createdAt, question, } = action.payload;
|
|
73
13
|
const payload = { agent_id: agentId };
|
|
74
14
|
return zeniAPI
|
|
75
15
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/sessions`, payload)
|
|
76
16
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
77
17
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
// First, set currentChatSessionId early so React can start re-rendering
|
|
96
|
-
// This triggers React components to begin the re-render process
|
|
97
|
-
return (0, rxjs_1.concat)((0, rxjs_1.of)(...actions, (0, aiCfoReducer_1.setNewSession)({
|
|
98
|
-
chatSessionId: sessionId,
|
|
99
|
-
userId,
|
|
100
|
-
createdAt: (0, zeniDayJS_1.date)(responseData.created_at),
|
|
101
|
-
}),
|
|
102
|
-
// Initialize session state (currentChatSessionId, agentId, chatHistoryNextPageToken) before delay
|
|
103
|
-
// This allows React to start re-rendering, but keeps createSessionAndSubmitState
|
|
104
|
-
// as "In-Progress" to prevent fetchChatHistory from running too early
|
|
105
|
-
(0, aiCfoViewReducer_1.initializeNewSessionState)({
|
|
106
|
-
agentId,
|
|
107
|
-
sessionId,
|
|
108
|
-
})),
|
|
109
|
-
// Add a delay to allow React to complete re-render and bind event handlers
|
|
110
|
-
// before submitting the question (which triggers AI response)
|
|
111
|
-
(0, rxjs_1.timer)(100).pipe((0, operators_1.take)(1), (0, operators_1.ignoreElements)()),
|
|
112
|
-
// Dispatch createSessionAndSubmitSuccess to mark operation as completed
|
|
113
|
-
// This allows fetchChatHistory to run after the question is submitted
|
|
114
|
-
(0, rxjs_1.of)((0, aiCfoViewReducer_1.createSessionAndSubmitSuccess)(),
|
|
115
|
-
// Submit the question after handlers are bound
|
|
116
|
-
(0, aiCfoViewReducer_1.submitQuestion)(sessionId, questionAnswerId, userId, questionId, createdAt, question),
|
|
117
|
-
// Add question payload optimistically after submitQuestion (matches original order)
|
|
118
|
-
// This is idempotent - won't create duplicates if called multiple times
|
|
119
|
-
// submitQuestionEpic will find the question already exists and only update the response
|
|
120
|
-
(0, aiCfoReducer_1.addQuestionPayload)({
|
|
121
|
-
chatSessionId: sessionId,
|
|
122
|
-
questionAnswerId: questionAnswerId,
|
|
123
|
-
question: {
|
|
124
|
-
questionId: questionId,
|
|
125
|
-
text: question,
|
|
126
|
-
createdAt,
|
|
127
|
-
},
|
|
128
|
-
userId,
|
|
129
|
-
})));
|
|
18
|
+
const sessionId = response.data.chat_session_id;
|
|
19
|
+
return (0, rxjs_1.of)((0, aiCfoReducer_1.setNewSession)({
|
|
20
|
+
chatSessionId: sessionId,
|
|
21
|
+
userId,
|
|
22
|
+
createdAt: (0, zeniDayJS_1.date)(response.data.created_at),
|
|
23
|
+
}), (0, aiCfoViewReducer_1.createSessionAndSubmitSuccess)({
|
|
24
|
+
agentId,
|
|
25
|
+
sessionId,
|
|
26
|
+
}), (0, aiCfoViewReducer_1.submitQuestion)(sessionId, questionAnswerId, userId, questionId, createdAt, question), (0, aiCfoReducer_1.addQuestionPayload)({
|
|
27
|
+
chatSessionId: sessionId,
|
|
28
|
+
questionAnswerId: questionAnswerId,
|
|
29
|
+
question: {
|
|
30
|
+
questionId: questionId,
|
|
31
|
+
text: question,
|
|
32
|
+
createdAt,
|
|
33
|
+
},
|
|
34
|
+
userId,
|
|
130
35
|
}));
|
|
131
36
|
}
|
|
132
37
|
else {
|
|
@@ -21,7 +21,6 @@ export declare const getCardBalance: (state: RootState) => {
|
|
|
21
21
|
classesViewParentId: import("../../commonStateTypes/classesView/nestedClassID").ClassesViewParentID | undefined;
|
|
22
22
|
accountsViewParentId: import("../../commonStateTypes/accountView/nestedAccountID").AccountsViewParentID | undefined;
|
|
23
23
|
labels: ("prepaid_expenses" | "fixed_assets" | "uncategorized_income" | "uncategorized_expense" | "bank_charges_and_fees" | "travel_transportation" | "accrued_expenses")[];
|
|
24
|
-
isDeleted: boolean;
|
|
25
24
|
}[];
|
|
26
25
|
balance: import("../..").Balance | undefined;
|
|
27
26
|
firstMonthOfFY: 1 | 3 | 12 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
|
|
@@ -21,7 +21,6 @@ export declare const getCashBalance: (state: RootState) => {
|
|
|
21
21
|
classesViewParentId: import("../../commonStateTypes/classesView/nestedClassID").ClassesViewParentID | undefined;
|
|
22
22
|
accountsViewParentId: import("../../commonStateTypes/accountView/nestedAccountID").AccountsViewParentID | undefined;
|
|
23
23
|
labels: ("prepaid_expenses" | "fixed_assets" | "uncategorized_income" | "uncategorized_expense" | "bank_charges_and_fees" | "travel_transportation" | "accrued_expenses")[];
|
|
24
|
-
isDeleted: boolean;
|
|
25
24
|
}[];
|
|
26
25
|
balance: import("../..").Balance | undefined;
|
|
27
26
|
firstMonthOfFY: 1 | 3 | 12 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
|
|
@@ -108,7 +108,6 @@ const doUpdatedNetBurnOrIncomeClassesView = (draft, timeframe, netBurnReport) =>
|
|
|
108
108
|
const report = (0, viewAndReportPayloadv2_1.mapReportPayloadV2ToReportV2)(netBurnReport.report);
|
|
109
109
|
draft.dataAvailable = report.dataAvailable;
|
|
110
110
|
draft.firstMonthOfFY = report.firstMonthOfFY;
|
|
111
|
-
draft.status = report.status;
|
|
112
111
|
draft.fetchState[timeframe].fetchState = 'Completed';
|
|
113
112
|
const classMetadata = netBurnReport.report.classes.map((eachClass) => (0, classPayload_1.toClassMetadata)(eachClass));
|
|
114
113
|
if (draft.classHierarchy.length <= 0) {
|
|
@@ -109,7 +109,6 @@ const doUpdatedOpExClassesView = (draft, timeframe, opExReport) => {
|
|
|
109
109
|
draft.dataAvailable = report.dataAvailable;
|
|
110
110
|
draft.firstMonthOfFY = report.firstMonthOfFY;
|
|
111
111
|
draft.bookCloseDate = report.bookCloseDate;
|
|
112
|
-
draft.status = report.status;
|
|
113
112
|
draft.fetchState[timeframe].fetchState = 'Completed';
|
|
114
113
|
const classMetadata = opExReport.report.classes.map((eachClass) => (0, classPayload_1.toClassMetadata)(eachClass));
|
|
115
114
|
if (draft.classHierarchy.length <= 0) {
|
|
@@ -113,7 +113,6 @@ const doUpdatedProfitAndLossClassesView = (draft, timeframe, pandLReport) => {
|
|
|
113
113
|
draft.dataAvailable = report.dataAvailable;
|
|
114
114
|
draft.firstMonthOfFY = report.firstMonthOfFY;
|
|
115
115
|
draft.bookCloseDate = report.bookCloseDate;
|
|
116
|
-
draft.status = report.status;
|
|
117
116
|
draft.fetchState[timeframe].fetchState = 'Completed';
|
|
118
117
|
const classMetadata = pandLReport.report.classes.map((eachClass) => (0, classPayload_1.toClassMetadata)(eachClass));
|
|
119
118
|
if (draft.classHierarchy.length <= 0) {
|
|
@@ -109,7 +109,6 @@ const doUpdatedRevenueClassesView = (draft, timeframe, revenueReport) => {
|
|
|
109
109
|
draft.dataAvailable = report.dataAvailable;
|
|
110
110
|
draft.firstMonthOfFY = report.firstMonthOfFY;
|
|
111
111
|
draft.bookCloseDate = report.bookCloseDate;
|
|
112
|
-
draft.status = report.status;
|
|
113
112
|
draft.fetchState[timeframe].fetchState = 'Completed';
|
|
114
113
|
const classMetadata = revenueReport.report.classes.map((eachClass) => (0, classPayload_1.toClassMetadata)(eachClass));
|
|
115
114
|
if (draft.classHierarchy.length <= 0) {
|
package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js
CHANGED
|
@@ -92,14 +92,6 @@ const updateBusinessVerificationDetailsEpic = (actions$, state$, zeniAPI) => act
|
|
|
92
92
|
type: 'success',
|
|
93
93
|
}));
|
|
94
94
|
}
|
|
95
|
-
if (setupViewType === 'zeni_treasury' &&
|
|
96
|
-
sendForVerification === false) {
|
|
97
|
-
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
98
|
-
messageSection: 'business_verification_save',
|
|
99
|
-
messageText: 'success',
|
|
100
|
-
type: 'success',
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
95
|
actions.push((0, setupViewReducer_1.updateBusinessVerificationDetailsSuccess)());
|
|
104
96
|
return (0, rxjs_1.from)(actions);
|
|
105
97
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.21",
|
|
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",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { openSnackbar } from '../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { RootState } from '../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../zeniAPI';
|
|
6
|
-
import { initiateReportsResync, reportsResyncFailure, reportsResyncSuccess } from './reportsResyncReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof initiateReportsResync> | ReturnType<typeof reportsResyncSuccess> | ReturnType<typeof reportsResyncFailure> | ReturnType<typeof openSnackbar>;
|
|
8
|
-
export declare const reportsResyncEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reportsResyncEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const snackbarReducer_1 = require("../../entity/snackbar/snackbarReducer");
|
|
7
|
-
const responsePayload_1 = require("../../responsePayload");
|
|
8
|
-
const reportsResyncReducer_1 = require("./reportsResyncReducer");
|
|
9
|
-
const reportsResyncEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(reportsResyncReducer_1.initiateReportsResync.match), (0, operators_1.mergeMap)((action) => {
|
|
10
|
-
const { isHardRefresh } = action.payload;
|
|
11
|
-
const payload = {
|
|
12
|
-
is_hard_refresh: isHardRefresh,
|
|
13
|
-
};
|
|
14
|
-
return zeniAPI
|
|
15
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/2.0/tasks/generate-group-by-class-reports`, payload)
|
|
16
|
-
.pipe((0, operators_1.switchMap)((response) => {
|
|
17
|
-
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
18
|
-
// 200 means new data is available, 204 means no new data
|
|
19
|
-
const actions = [
|
|
20
|
-
(0, reportsResyncReducer_1.reportsResyncSuccess)({
|
|
21
|
-
hasNewData: response.status.code === 200,
|
|
22
|
-
}),
|
|
23
|
-
];
|
|
24
|
-
return (0, rxjs_1.from)(actions);
|
|
25
|
-
}
|
|
26
|
-
return (0, rxjs_1.from)([
|
|
27
|
-
(0, reportsResyncReducer_1.reportsResyncFailure)({
|
|
28
|
-
error: response.status,
|
|
29
|
-
}),
|
|
30
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
31
|
-
messageSection: 'reports_resync',
|
|
32
|
-
messageText: 'failed',
|
|
33
|
-
type: 'error',
|
|
34
|
-
}),
|
|
35
|
-
]);
|
|
36
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, reportsResyncReducer_1.reportsResyncFailure)({
|
|
37
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Resync API call errored out: ' + JSON.stringify(error)),
|
|
38
|
-
}))));
|
|
39
|
-
}));
|
|
40
|
-
exports.reportsResyncEpic = reportsResyncEpic;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ZeniAPIStatus } from '../../responsePayload';
|
|
2
|
-
import { ReportsResyncState } from './reportsResyncState';
|
|
3
|
-
export declare const initialReportsResyncState: ReportsResyncState;
|
|
4
|
-
export declare const initiateReportsResync: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[isHardRefresh?: boolean | undefined], {
|
|
5
|
-
isHardRefresh: boolean;
|
|
6
|
-
}, "initiateReportsResync/initiateReportsResync", never, never>, reportsResyncSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
7
|
-
hasNewData: boolean;
|
|
8
|
-
}, "initiateReportsResync/reportsResyncSuccess">, reportsResyncFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
9
|
-
error: ZeniAPIStatus;
|
|
10
|
-
}, "initiateReportsResync/reportsResyncFailure">, clearReportsResync: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"initiateReportsResync/clearReportsResync">;
|
|
11
|
-
declare const _default: import("redux").Reducer<ReportsResyncState>;
|
|
12
|
-
export default _default;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearReportsResync = exports.reportsResyncFailure = exports.reportsResyncSuccess = exports.initiateReportsResync = exports.initialReportsResyncState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
exports.initialReportsResyncState = {
|
|
7
|
-
hasNewData: false,
|
|
8
|
-
reportsResyncFetchState: {
|
|
9
|
-
fetchState: 'Not-Started',
|
|
10
|
-
error: undefined,
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
const reportsResync = (0, toolkit_1.createSlice)({
|
|
14
|
-
name: 'initiateReportsResync',
|
|
15
|
-
initialState: exports.initialReportsResyncState,
|
|
16
|
-
reducers: {
|
|
17
|
-
initiateReportsResync: {
|
|
18
|
-
reducer(draft) {
|
|
19
|
-
draft.reportsResyncFetchState.fetchState = 'In-Progress';
|
|
20
|
-
draft.reportsResyncFetchState.error = undefined;
|
|
21
|
-
draft.hasNewData = false;
|
|
22
|
-
},
|
|
23
|
-
prepare(isHardRefresh = true) {
|
|
24
|
-
return {
|
|
25
|
-
payload: { isHardRefresh },
|
|
26
|
-
};
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
reportsResyncSuccess(draft, action) {
|
|
30
|
-
draft.reportsResyncFetchState.fetchState = 'Completed';
|
|
31
|
-
draft.reportsResyncFetchState.error = undefined;
|
|
32
|
-
draft.hasNewData = action.payload.hasNewData;
|
|
33
|
-
},
|
|
34
|
-
reportsResyncFailure(draft, action) {
|
|
35
|
-
draft.reportsResyncFetchState.fetchState = 'Error';
|
|
36
|
-
draft.reportsResyncFetchState.error = action.payload.error;
|
|
37
|
-
draft.hasNewData = false;
|
|
38
|
-
},
|
|
39
|
-
clearReportsResync(draft) {
|
|
40
|
-
Object.assign(draft, exports.initialReportsResyncState);
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
_a = reportsResync.actions, exports.initiateReportsResync = _a.initiateReportsResync, exports.reportsResyncSuccess = _a.reportsResyncSuccess, exports.reportsResyncFailure = _a.reportsResyncFailure, exports.clearReportsResync = _a.clearReportsResync;
|
|
45
|
-
exports.default = reportsResync.reducer;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
2
|
-
import { RootState } from '../../reducer';
|
|
3
|
-
export declare const getReportsResyncView: (state: RootState) => ReportsResyncView;
|
|
4
|
-
export type ReportsResyncView = {
|
|
5
|
-
hasNewData: boolean;
|
|
6
|
-
reportsResyncFetchState: FetchStateAndError;
|
|
7
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getReportsResyncView = void 0;
|
|
4
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
-
const getReportsResyncSelector = (0, toolkit_1.createSelector)((state) => state.reportsResyncState, (reportsResyncState) => ({
|
|
6
|
-
hasNewData: reportsResyncState.hasNewData,
|
|
7
|
-
reportsResyncFetchState: reportsResyncState.reportsResyncFetchState,
|
|
8
|
-
}));
|
|
9
|
-
const getReportsResyncView = (state) => getReportsResyncSelector(state);
|
|
10
|
-
exports.getReportsResyncView = getReportsResyncView;
|