@zeniai/client-epic-state 5.3.18 → 5.3.20
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/coaBalance/coaBalance.d.ts +9 -0
- package/lib/commonStateTypes/coaBalance/coaBalance.js +11 -0
- package/lib/entity/tenant/epic/fetchAllTenantsEpic.d.ts +2 -4
- package/lib/entity/tenant/epic/fetchAllTenantsEpic.js +50 -42
- package/lib/entity/tenant/tenantPayload.d.ts +17 -1
- package/lib/entity/tenant/tenantReducer.d.ts +7 -2
- package/lib/entity/tenant/tenantReducer.js +48 -19
- package/lib/entity/tenant/tenantSelector.d.ts +26 -6
- package/lib/entity/tenant/tenantSelector.js +116 -93
- package/lib/entity/tenant/tenantState.d.ts +10 -0
- package/lib/epic.d.ts +2 -1
- package/lib/epic.js +3 -0
- package/lib/esm/commonStateTypes/coaBalance/coaBalance.js +10 -0
- package/lib/esm/entity/tenant/epic/fetchAllTenantsEpic.js +53 -45
- package/lib/esm/entity/tenant/tenantReducer.js +46 -17
- package/lib/esm/entity/tenant/tenantSelector.js +112 -92
- package/lib/esm/epic.js +4 -1
- package/lib/esm/index.js +7 -7
- package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +65 -3
- package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +25 -0
- package/lib/esm/view/aiCfoView/epics/transcribeAudioEpic.js +60 -0
- package/lib/esm/view/balanceSheet/balanceSheetForTimeframeEpic.js +9 -4
- package/lib/esm/view/balanceSheet/balanceSheetReducer.js +2 -0
- package/lib/esm/view/cashFlow/cashFlowForTimeframeEpic.js +11 -5
- package/lib/esm/view/cashFlow/cashFlowReducer.js +2 -0
- package/lib/esm/view/dashboard/dashboardEpic.js +0 -4
- package/lib/esm/view/dashboard/dashboardSelector.js +2 -3
- package/lib/esm/view/financeStatement/financeStatementEpic.js +1 -5
- package/lib/esm/view/financeStatement/financeStatementSelector.js +18 -0
- package/lib/esm/view/people/peoplePageEpic.js +0 -4
- package/lib/esm/view/profitAndLoss/profitAndLossForTimeframeEpic.js +9 -4
- package/lib/esm/view/profitAndLoss/profitAndLossReducer.js +5 -1
- package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewReducer.js +23 -3
- package/lib/esm/view/spendManagement/reimbursement/editRemiView/epics/fetchRemiAndInitializeLocalStoreEpic.js +17 -4
- package/lib/esm/view/spendManagement/reimbursement/remiDetailView/epics/fetchRemiDetailEpic.js +1 -1
- package/lib/esm/view/transactionList/filterTransactionsByTimePeriod.js +18 -0
- package/lib/esm/view/transactionList/transactionListByAccountSelector.js +2 -1
- package/lib/esm/view/transactionList/transactionListByCategoryTypeSelector.js +2 -1
- package/lib/esm/view/transactionList/transactionListByClassSelector.js +2 -1
- package/lib/esm/view/transactionList/transactionListByProjectSelector.js +2 -1
- package/lib/index.d.ts +8 -8
- package/lib/index.js +56 -46
- package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +20 -0
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +2 -2
- package/lib/view/aiCfoView/aiCfoViewReducer.js +66 -4
- package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +8 -1
- package/lib/view/aiCfoView/aiCfoViewSelector.js +27 -0
- package/lib/view/aiCfoView/aiCfoViewState.d.ts +9 -0
- package/lib/view/aiCfoView/epics/transcribeAudioEpic.d.ts +19 -0
- package/lib/view/aiCfoView/epics/transcribeAudioEpic.js +64 -0
- package/lib/view/balanceSheet/balanceSheetForTimeframeEpic.js +8 -3
- package/lib/view/balanceSheet/balanceSheetReducer.js +2 -0
- package/lib/view/balanceSheet/balanceSheetState.d.ts +2 -0
- package/lib/view/cashFlow/cashFlowForTimeframeEpic.js +10 -4
- package/lib/view/cashFlow/cashFlowReducer.js +2 -0
- package/lib/view/cashFlow/cashFlowState.d.ts +2 -0
- package/lib/view/dashboard/dashboardEpic.js +0 -4
- package/lib/view/dashboard/dashboardSelector.d.ts +0 -2
- package/lib/view/dashboard/dashboardSelector.js +1 -2
- package/lib/view/financeStatement/financeStatementEpic.js +1 -5
- package/lib/view/financeStatement/financeStatementSelector.d.ts +8 -0
- package/lib/view/financeStatement/financeStatementSelector.js +18 -0
- package/lib/view/people/peoplePageEpic.js +0 -4
- package/lib/view/profitAndLoss/profitAndLossForTimeframeEpic.js +8 -3
- package/lib/view/profitAndLoss/profitAndLossReducer.js +5 -1
- package/lib/view/profitAndLoss/profitAndLossState.d.ts +2 -1
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewReducer.d.ts +7 -2
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewReducer.js +24 -4
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchRemiAndInitializeLocalStoreEpic.d.ts +7 -4
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchRemiAndInitializeLocalStoreEpic.js +15 -1
- package/lib/view/spendManagement/reimbursement/remiDetailView/epics/fetchRemiDetailEpic.js +1 -1
- package/lib/view/transactionList/filterTransactionsByTimePeriod.d.ts +15 -0
- package/lib/view/transactionList/filterTransactionsByTimePeriod.js +22 -0
- package/lib/view/transactionList/transactionListByAccountSelector.js +2 -1
- package/lib/view/transactionList/transactionListByCategoryTypeSelector.js +2 -1
- package/lib/view/transactionList/transactionListByClassSelector.js +2 -1
- package/lib/view/transactionList/transactionListByProjectSelector.js +2 -1
- package/package.json +1 -1
|
@@ -10,7 +10,11 @@ const reportIdUniqueKey = (forecastId) => forecastId != null
|
|
|
10
10
|
? `profit_and_loss+${forecastId}`
|
|
11
11
|
: 'profit_and_loss';
|
|
12
12
|
exports.reportIdUniqueKey = reportIdUniqueKey;
|
|
13
|
-
const fetchProfitAndLossForTimeframeEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(profitAndLossReducer_1.fetchProfitAndLossForTimeframe.match),
|
|
13
|
+
const fetchProfitAndLossForTimeframeEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(profitAndLossReducer_1.fetchProfitAndLossForTimeframe.match),
|
|
14
|
+
// One stream per timeframe: a newer request for the same timeframe (e.g. a
|
|
15
|
+
// custom-date-range change, or a dated fetch right after a default one)
|
|
16
|
+
// cancels the older in-flight request so a stale response can't land last.
|
|
17
|
+
(0, operators_1.groupBy)((action) => `${action.payload.forecastId ?? ''}_${action.payload.timeframe}`), (0, operators_1.mergeMap)((group$) => group$.pipe((0, operators_1.switchMap)((action) => {
|
|
14
18
|
const getTimeSeriesGroup = (timeframe) => {
|
|
15
19
|
switch (timeframe) {
|
|
16
20
|
case 'month':
|
|
@@ -29,7 +33,8 @@ const fetchProfitAndLossForTimeframeEpic = (actions$, _, zeniAPI) => actions$.pi
|
|
|
29
33
|
queryValue.forecast_id = action.payload.forecastId;
|
|
30
34
|
queryValue.is_forecast_vs_actual = true;
|
|
31
35
|
}
|
|
32
|
-
if (action.payload.startDate != null &&
|
|
36
|
+
if (action.payload.startDate != null &&
|
|
37
|
+
action.payload.endDate != null) {
|
|
33
38
|
queryValue.custom_start_date = action.payload.startDate;
|
|
34
39
|
queryValue.custom_end_date = action.payload.endDate;
|
|
35
40
|
}
|
|
@@ -59,5 +64,5 @@ const fetchProfitAndLossForTimeframeEpic = (actions$, _, zeniAPI) => actions$.pi
|
|
|
59
64
|
return (0, rxjs_1.of)((0, profitAndLossReducer_1.updateProfitAndLossForTimeframeFailure)(response.status, action.payload.forecastId, action.payload.timeframe));
|
|
60
65
|
}
|
|
61
66
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, profitAndLossReducer_1.updateProfitAndLossForTimeframeFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'P&L REST API call errored out' + JSON.stringify(error)), action.payload.forecastId, action.payload.timeframe))));
|
|
62
|
-
}));
|
|
67
|
+
}))));
|
|
63
68
|
exports.fetchProfitAndLossForTimeframeEpic = fetchProfitAndLossForTimeframeEpic;
|
|
@@ -5,6 +5,7 @@ exports.resetProfitAndLossNodeCollapseState = exports.updateProfitAndLossUIState
|
|
|
5
5
|
exports.getState = getState;
|
|
6
6
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
7
7
|
const viewAndReportPayloadv2_1 = require("../../commonPayloadTypes/v2/viewAndReportPayloadv2");
|
|
8
|
+
const coaBalance_1 = require("../../commonStateTypes/coaBalance/coaBalance");
|
|
8
9
|
const rootActions_1 = require("../../rootActions");
|
|
9
10
|
exports.initialPandLState = {
|
|
10
11
|
bookCloseDate: undefined,
|
|
@@ -76,7 +77,10 @@ const profitAndLoss = (0, toolkit_1.createSlice)({
|
|
|
76
77
|
fetchState: 'In-Progress',
|
|
77
78
|
error: undefined,
|
|
78
79
|
};
|
|
79
|
-
updateState(draft, action.payload.forecastId, {
|
|
80
|
+
updateState(draft, action.payload.forecastId, {
|
|
81
|
+
fetchState,
|
|
82
|
+
customDateRangeByTimeframe: (0, coaBalance_1.withFetchedCustomDateRange)(pAndLState.customDateRangeByTimeframe, timeframe, action.payload.startDate, action.payload.endDate),
|
|
83
|
+
});
|
|
80
84
|
},
|
|
81
85
|
},
|
|
82
86
|
updateProfitAndLossForTimeframe(draft, action) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FetchStateByTimeframe } from '../../commonStateTypes/coaBalance/coaBalance';
|
|
1
|
+
import { CustomDateRangeByTimeframe, FetchStateByTimeframe } from '../../commonStateTypes/coaBalance/coaBalance';
|
|
2
2
|
import { ID } from '../../commonStateTypes/common';
|
|
3
3
|
import { Report } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
4
|
export interface ProfitAndLossUIState {
|
|
@@ -11,6 +11,7 @@ export interface ProfitAndLossUIState {
|
|
|
11
11
|
export interface ProfitAndLossState extends Report {
|
|
12
12
|
fetchState: FetchStateByTimeframe;
|
|
13
13
|
uiState: ProfitAndLossUIState;
|
|
14
|
+
customDateRangeByTimeframe?: CustomDateRangeByTimeframe;
|
|
14
15
|
forecastId?: ID;
|
|
15
16
|
}
|
|
16
17
|
export interface ProfitAndLossWithForecastState {
|
|
@@ -69,7 +69,10 @@ export declare const fetchEditRemiDetailPage: import("@reduxjs/toolkit").ActionC
|
|
|
69
69
|
reimbursementId?: ID;
|
|
70
70
|
}, "editRemiView/currencyConversionValueSuccessOrFailure">, waitForRemiDetailThenInitializeLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[reimbursementId: string], {
|
|
71
71
|
reimbursementId: string;
|
|
72
|
-
}, "editRemiView/waitForRemiDetailThenInitializeLocalStore", never, never>,
|
|
72
|
+
}, "editRemiView/waitForRemiDetailThenInitializeLocalStore", never, never>, initializeRemiToLocalStoreFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[reimbursementId: string, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
|
|
73
|
+
reimbursementId: string;
|
|
74
|
+
error: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
75
|
+
}, "editRemiView/initializeRemiToLocalStoreFailure", never, never>, waitForMerchantRecommendationFetchThenUpdateRecommendationInMerchant: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[lineId: string, reimbursementId?: string | undefined, merchantId?: string | undefined, merchantName?: string | undefined], {
|
|
73
76
|
lineId: string;
|
|
74
77
|
reimbursementId: string | undefined;
|
|
75
78
|
merchantId: string | undefined;
|
|
@@ -77,7 +80,9 @@ export declare const fetchEditRemiDetailPage: import("@reduxjs/toolkit").ActionC
|
|
|
77
80
|
}, "editRemiView/waitForMerchantRecommendationFetchThenUpdateRecommendationInMerchant", never, never>, updateAddRemiAutoFields: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
78
81
|
addRemiAutoFields: Record<ID, AutoFields>;
|
|
79
82
|
reimbursementId?: ID;
|
|
80
|
-
}, "editRemiView/updateAddRemiAutoFields">, indicateReadyToInitializeRemiLocalStore: import("@reduxjs/toolkit").
|
|
83
|
+
}, "editRemiView/updateAddRemiAutoFields">, indicateReadyToInitializeRemiLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[reimbursementId: string], {
|
|
84
|
+
reimbursementId: string;
|
|
85
|
+
}, "editRemiView/indicateReadyToInitializeRemiLocalStore", never, never>, updateUploadFetchState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
81
86
|
fetchState: FetchState;
|
|
82
87
|
reimbursementId?: ID;
|
|
83
88
|
}, "editRemiView/updateUploadFetchState">, updateRecommendationInMerchant: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearAddRemiAutoFields = exports.clearTentativeMerchantName = exports.updateTentativeMerchantNames = exports.updateRecommendationInMerchant = exports.updateUploadFetchState = exports.indicateReadyToInitializeRemiLocalStore = exports.updateAddRemiAutoFields = exports.waitForMerchantRecommendationFetchThenUpdateRecommendationInMerchant = exports.waitForRemiDetailThenInitializeLocalStore = exports.currencyConversionValueSuccessOrFailure = exports.updateHomeCurrencyConversion = exports.updateReimbursementType = exports.fetchCurrencyConversionValue = exports.parseReceiptsToRemi = exports.saveRemiSuccessOrFailure = exports.saveRemiDetail = exports.removeFileFromRemiUpdatesInLocalStore = exports.discardRemiUpdatesInLocalStore = exports.updatesPaymentToInLocalStore = exports.saveRemiUpdatesToLocalStore = exports.fetchRecommendationsAndUpdateMerchantRecommendations = exports.initializeRemiToLocalStore = exports.fetchRemiAndInitializeLocalStore = exports.fetchEditRemiDetailPage = exports.initialState = void 0;
|
|
4
|
+
exports.clearAddRemiAutoFields = exports.clearTentativeMerchantName = exports.updateTentativeMerchantNames = exports.updateRecommendationInMerchant = exports.updateUploadFetchState = exports.indicateReadyToInitializeRemiLocalStore = exports.updateAddRemiAutoFields = exports.waitForMerchantRecommendationFetchThenUpdateRecommendationInMerchant = exports.initializeRemiToLocalStoreFailure = exports.waitForRemiDetailThenInitializeLocalStore = exports.currencyConversionValueSuccessOrFailure = exports.updateHomeCurrencyConversion = exports.updateReimbursementType = exports.fetchCurrencyConversionValue = exports.parseReceiptsToRemi = exports.saveRemiSuccessOrFailure = exports.saveRemiDetail = exports.removeFileFromRemiUpdatesInLocalStore = exports.discardRemiUpdatesInLocalStore = exports.updatesPaymentToInLocalStore = exports.saveRemiUpdatesToLocalStore = exports.fetchRecommendationsAndUpdateMerchantRecommendations = exports.initializeRemiToLocalStore = exports.fetchRemiAndInitializeLocalStore = exports.fetchEditRemiDetailPage = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const amount_1 = require("../../../../commonStateTypes/amount");
|
|
7
7
|
const rootActions_1 = require("../../../../rootActions");
|
|
@@ -34,8 +34,13 @@ const editRemiView = (0, toolkit_1.createSlice)({
|
|
|
34
34
|
};
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
|
-
indicateReadyToInitializeRemiLocalStore
|
|
38
|
-
|
|
37
|
+
indicateReadyToInitializeRemiLocalStore: {
|
|
38
|
+
reducer() {
|
|
39
|
+
// do nothing
|
|
40
|
+
},
|
|
41
|
+
prepare(reimbursementId) {
|
|
42
|
+
return { payload: { reimbursementId } };
|
|
43
|
+
},
|
|
39
44
|
},
|
|
40
45
|
fetchRecommendationsAndUpdateMerchantRecommendations: {
|
|
41
46
|
reducer() {
|
|
@@ -141,6 +146,21 @@ const editRemiView = (0, toolkit_1.createSlice)({
|
|
|
141
146
|
return { payload: { reimbursementId } };
|
|
142
147
|
},
|
|
143
148
|
},
|
|
149
|
+
initializeRemiToLocalStoreFailure: {
|
|
150
|
+
reducer(draft, action) {
|
|
151
|
+
const { reimbursementId, error } = action.payload;
|
|
152
|
+
draft.editRemiStateById[reimbursementId] = {
|
|
153
|
+
...draft.editRemiStateById[reimbursementId],
|
|
154
|
+
fetchStatus: {
|
|
155
|
+
fetchState: 'Error',
|
|
156
|
+
error,
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
prepare(reimbursementId, error) {
|
|
161
|
+
return { payload: { reimbursementId, error } };
|
|
162
|
+
},
|
|
163
|
+
},
|
|
144
164
|
saveRemiUpdatesToLocalStore(draft, action) {
|
|
145
165
|
if (action.payload.reimbursementId != null) {
|
|
146
166
|
const reimbursementId = action.payload.reimbursementId;
|
|
@@ -391,7 +411,7 @@ const editRemiView = (0, toolkit_1.createSlice)({
|
|
|
391
411
|
});
|
|
392
412
|
},
|
|
393
413
|
});
|
|
394
|
-
_a = editRemiView.actions, exports.fetchEditRemiDetailPage = _a.fetchEditRemiDetailPage, exports.fetchRemiAndInitializeLocalStore = _a.fetchRemiAndInitializeLocalStore, exports.initializeRemiToLocalStore = _a.initializeRemiToLocalStore, exports.fetchRecommendationsAndUpdateMerchantRecommendations = _a.fetchRecommendationsAndUpdateMerchantRecommendations, exports.saveRemiUpdatesToLocalStore = _a.saveRemiUpdatesToLocalStore, exports.updatesPaymentToInLocalStore = _a.updatesPaymentToInLocalStore, exports.discardRemiUpdatesInLocalStore = _a.discardRemiUpdatesInLocalStore, exports.removeFileFromRemiUpdatesInLocalStore = _a.removeFileFromRemiUpdatesInLocalStore, exports.saveRemiDetail = _a.saveRemiDetail, exports.saveRemiSuccessOrFailure = _a.saveRemiSuccessOrFailure, exports.parseReceiptsToRemi = _a.parseReceiptsToRemi, exports.fetchCurrencyConversionValue = _a.fetchCurrencyConversionValue, exports.updateReimbursementType = _a.updateReimbursementType, exports.updateHomeCurrencyConversion = _a.updateHomeCurrencyConversion, exports.currencyConversionValueSuccessOrFailure = _a.currencyConversionValueSuccessOrFailure, exports.waitForRemiDetailThenInitializeLocalStore = _a.waitForRemiDetailThenInitializeLocalStore, exports.waitForMerchantRecommendationFetchThenUpdateRecommendationInMerchant = _a.waitForMerchantRecommendationFetchThenUpdateRecommendationInMerchant, exports.updateAddRemiAutoFields = _a.updateAddRemiAutoFields, exports.indicateReadyToInitializeRemiLocalStore = _a.indicateReadyToInitializeRemiLocalStore, exports.updateUploadFetchState = _a.updateUploadFetchState, exports.updateRecommendationInMerchant = _a.updateRecommendationInMerchant, exports.updateTentativeMerchantNames = _a.updateTentativeMerchantNames, exports.clearTentativeMerchantName = _a.clearTentativeMerchantName, exports.clearAddRemiAutoFields = _a.clearAddRemiAutoFields;
|
|
414
|
+
_a = editRemiView.actions, exports.fetchEditRemiDetailPage = _a.fetchEditRemiDetailPage, exports.fetchRemiAndInitializeLocalStore = _a.fetchRemiAndInitializeLocalStore, exports.initializeRemiToLocalStore = _a.initializeRemiToLocalStore, exports.fetchRecommendationsAndUpdateMerchantRecommendations = _a.fetchRecommendationsAndUpdateMerchantRecommendations, exports.saveRemiUpdatesToLocalStore = _a.saveRemiUpdatesToLocalStore, exports.updatesPaymentToInLocalStore = _a.updatesPaymentToInLocalStore, exports.discardRemiUpdatesInLocalStore = _a.discardRemiUpdatesInLocalStore, exports.removeFileFromRemiUpdatesInLocalStore = _a.removeFileFromRemiUpdatesInLocalStore, exports.saveRemiDetail = _a.saveRemiDetail, exports.saveRemiSuccessOrFailure = _a.saveRemiSuccessOrFailure, exports.parseReceiptsToRemi = _a.parseReceiptsToRemi, exports.fetchCurrencyConversionValue = _a.fetchCurrencyConversionValue, exports.updateReimbursementType = _a.updateReimbursementType, exports.updateHomeCurrencyConversion = _a.updateHomeCurrencyConversion, exports.currencyConversionValueSuccessOrFailure = _a.currencyConversionValueSuccessOrFailure, exports.waitForRemiDetailThenInitializeLocalStore = _a.waitForRemiDetailThenInitializeLocalStore, exports.initializeRemiToLocalStoreFailure = _a.initializeRemiToLocalStoreFailure, exports.waitForMerchantRecommendationFetchThenUpdateRecommendationInMerchant = _a.waitForMerchantRecommendationFetchThenUpdateRecommendationInMerchant, exports.updateAddRemiAutoFields = _a.updateAddRemiAutoFields, exports.indicateReadyToInitializeRemiLocalStore = _a.indicateReadyToInitializeRemiLocalStore, exports.updateUploadFetchState = _a.updateUploadFetchState, exports.updateRecommendationInMerchant = _a.updateRecommendationInMerchant, exports.updateTentativeMerchantNames = _a.updateTentativeMerchantNames, exports.clearTentativeMerchantName = _a.clearTentativeMerchantName, exports.clearAddRemiAutoFields = _a.clearAddRemiAutoFields;
|
|
395
415
|
exports.default = editRemiView.reducer;
|
|
396
416
|
const doUpdateRecommendationForEntity = (draft, lineId, recommendations, shouldAutofill, reimbursementId, reimbursementStageCode) => {
|
|
397
417
|
if (reimbursementId != null) {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { clearAll } from '../../../../../rootActions';
|
|
2
4
|
import { RootState } from '../../../../../rootStateTypes';
|
|
3
|
-
import { fetchRemiDetail, updateRemiDetail } from '../../remiDetailView/remiDetailViewReducer';
|
|
4
|
-
import { fetchRemiAndInitializeLocalStore, initializeRemiToLocalStore, waitForRemiDetailThenInitializeLocalStore } from '../editRemiViewReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof waitForRemiDetailThenInitializeLocalStore> | ReturnType<typeof fetchRemiDetail> | ReturnType<typeof updateRemiDetail> | ReturnType<typeof initializeRemiToLocalStore> | ReturnType<typeof fetchRemiAndInitializeLocalStore>;
|
|
6
|
-
export declare const fetchRemiAndInitializeLocalStoreEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) =>
|
|
5
|
+
import { fetchRemiDetail, updateRemiDetail, updateRemiDetailFetchState } from '../../remiDetailView/remiDetailViewReducer';
|
|
6
|
+
import { fetchRemiAndInitializeLocalStore, indicateReadyToInitializeRemiLocalStore, initializeRemiToLocalStore, initializeRemiToLocalStoreFailure, waitForRemiDetailThenInitializeLocalStore } from '../editRemiViewReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof waitForRemiDetailThenInitializeLocalStore> | ReturnType<typeof fetchRemiDetail> | ReturnType<typeof updateRemiDetail> | ReturnType<typeof updateRemiDetailFetchState> | ReturnType<typeof initializeRemiToLocalStore> | ReturnType<typeof fetchRemiAndInitializeLocalStore> | ReturnType<typeof indicateReadyToInitializeRemiLocalStore> | ReturnType<typeof initializeRemiToLocalStoreFailure> | ReturnType<typeof clearAll>;
|
|
8
|
+
export declare const fetchRemiAndInitializeLocalStoreEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
9
|
+
export declare const waitForRemiDetailThenInitializeLocalStoreEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
|
|
@@ -3,10 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchRemiAndInitializeLocalStoreEpic = void 0;
|
|
6
|
+
exports.waitForRemiDetailThenInitializeLocalStoreEpic = exports.fetchRemiAndInitializeLocalStoreEpic = void 0;
|
|
7
7
|
const get_1 = __importDefault(require("lodash/get"));
|
|
8
8
|
const rxjs_1 = require("rxjs");
|
|
9
9
|
const operators_1 = require("rxjs/operators");
|
|
10
|
+
const rootActions_1 = require("../../../../../rootActions");
|
|
10
11
|
const remiDetailViewReducer_1 = require("../../remiDetailView/remiDetailViewReducer");
|
|
11
12
|
const editRemiViewReducer_1 = require("../editRemiViewReducer");
|
|
12
13
|
const fetchRemiAndInitializeLocalStoreEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editRemiViewReducer_1.fetchRemiAndInitializeLocalStore.match), (0, operators_1.mergeMap)((action) => {
|
|
@@ -42,3 +43,16 @@ const fetchRemiAndInitializeLocalStoreEpic = (actions$, state$) => actions$.pipe
|
|
|
42
43
|
return (0, rxjs_1.from)(remiDetailActions);
|
|
43
44
|
}));
|
|
44
45
|
exports.fetchRemiAndInitializeLocalStoreEpic = fetchRemiAndInitializeLocalStoreEpic;
|
|
46
|
+
const waitForRemiDetailThenInitializeLocalStoreEpic = (actions$) => actions$.pipe((0, operators_1.filter)(editRemiViewReducer_1.waitForRemiDetailThenInitializeLocalStore.match), (0, operators_1.mergeMap)((action) => {
|
|
47
|
+
const { reimbursementId } = action.payload;
|
|
48
|
+
const ready$ = actions$.pipe((0, operators_1.filter)(editRemiViewReducer_1.indicateReadyToInitializeRemiLocalStore.match), (0, operators_1.filter)((readyAction) => readyAction.payload.reimbursementId === reimbursementId), (0, operators_1.take)(1), (0, operators_1.map)(() => (0, editRemiViewReducer_1.initializeRemiToLocalStore)(reimbursementId)));
|
|
49
|
+
const failed$ = actions$.pipe((0, operators_1.filter)(remiDetailViewReducer_1.updateRemiDetailFetchState.match), (0, operators_1.filter)((fetchStateAction) => fetchStateAction.payload.reimbursementId === reimbursementId &&
|
|
50
|
+
fetchStateAction.payload.fetchState === 'Error'), (0, operators_1.map)((fetchStateAction) => (0, editRemiViewReducer_1.initializeRemiToLocalStoreFailure)(reimbursementId, fetchStateAction.payload.error)));
|
|
51
|
+
const supersededOrCleared$ = actions$.pipe((0, operators_1.filter)((nextAction) => rootActions_1.clearAll.match(nextAction) ||
|
|
52
|
+
(editRemiViewReducer_1.waitForRemiDetailThenInitializeLocalStore.match(nextAction) &&
|
|
53
|
+
nextAction.payload.reimbursementId === reimbursementId)));
|
|
54
|
+
// An Error does not end the wait: a newer request for the same id may still succeed.
|
|
55
|
+
// After an Error, supersededOrCleared$ is what ends it.
|
|
56
|
+
return (0, rxjs_1.merge)(ready$, failed$).pipe((0, operators_1.takeWhile)((resultAction) => !editRemiViewReducer_1.initializeRemiToLocalStore.match(resultAction), true), (0, operators_1.takeUntil)(supersededOrCleared$));
|
|
57
|
+
}));
|
|
58
|
+
exports.waitForRemiDetailThenInitializeLocalStoreEpic = waitForRemiDetailThenInitializeLocalStoreEpic;
|
|
@@ -81,7 +81,7 @@ const fetchRemiDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
81
81
|
}));
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
actions.push((0, editRemiViewReducer_1.indicateReadyToInitializeRemiLocalStore)());
|
|
84
|
+
actions.push((0, editRemiViewReducer_1.indicateReadyToInitializeRemiLocalStore)(reimbursementId));
|
|
85
85
|
if (response.data.transaction?.lines != null &&
|
|
86
86
|
response.data.transaction.lines.length > 0) {
|
|
87
87
|
actions.push((0, remiDetailViewReducer_1.fetchDuplicateReimbursement)(response.data.transaction.created_by_user_id, false, response.data.transaction.transaction_id));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TimePeriod } from '../../commonStateTypes/timePeriod';
|
|
2
|
+
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
+
/**
|
|
4
|
+
* Transaction lists are fetched and cached in month buckets: `splitPeriod`
|
|
5
|
+
* snaps the first bucket back to the 1st of the month, while the last bucket
|
|
6
|
+
* is fetched with the real end date. So a period that starts mid-month (e.g. a
|
|
7
|
+
* drill-down from the custom-date-range column "Jun 17-30 2026") pulls in the
|
|
8
|
+
* days before its start. Drop those so the list reconciles to the clicked
|
|
9
|
+
* figure. Periods starting on the 1st (every pre-existing caller) are returned
|
|
10
|
+
* untouched. Compares calendar days as `YYYY-MM-DD` strings so the viewer's
|
|
11
|
+
* timezone can't shift the boundary.
|
|
12
|
+
*/
|
|
13
|
+
export declare const filterTransactionsByTimePeriod: <T extends {
|
|
14
|
+
date: ZeniDate;
|
|
15
|
+
}>(transactions: T[], period: TimePeriod) => T[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterTransactionsByTimePeriod = void 0;
|
|
4
|
+
const timePeriod_1 = require("../../commonStateTypes/timePeriod");
|
|
5
|
+
/**
|
|
6
|
+
* Transaction lists are fetched and cached in month buckets: `splitPeriod`
|
|
7
|
+
* snaps the first bucket back to the 1st of the month, while the last bucket
|
|
8
|
+
* is fetched with the real end date. So a period that starts mid-month (e.g. a
|
|
9
|
+
* drill-down from the custom-date-range column "Jun 17-30 2026") pulls in the
|
|
10
|
+
* days before its start. Drop those so the list reconciles to the clicked
|
|
11
|
+
* figure. Periods starting on the 1st (every pre-existing caller) are returned
|
|
12
|
+
* untouched. Compares calendar days as `YYYY-MM-DD` strings so the viewer's
|
|
13
|
+
* timezone can't shift the boundary.
|
|
14
|
+
*/
|
|
15
|
+
const filterTransactionsByTimePeriod = (transactions, period) => {
|
|
16
|
+
if (period.start.day === 1) {
|
|
17
|
+
return transactions;
|
|
18
|
+
}
|
|
19
|
+
const start = (0, timePeriod_1.toString)(period.start);
|
|
20
|
+
return transactions.filter((transaction) => transaction.date.format(timePeriod_1.DEFAULT_DATE_FORMAT) >= start);
|
|
21
|
+
};
|
|
22
|
+
exports.filterTransactionsByTimePeriod = filterTransactionsByTimePeriod;
|
|
@@ -8,6 +8,7 @@ const flatMap_1 = __importDefault(require("lodash/flatMap"));
|
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
9
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
10
10
|
const transactionSelector_1 = require("../../entity/transaction/transactionSelector");
|
|
11
|
+
const filterTransactionsByTimePeriod_1 = require("./filterTransactionsByTimePeriod");
|
|
11
12
|
const parallelFetchAccountTransactionListEpic_1 = require("./parallelFetchAccountTransactionListEpic");
|
|
12
13
|
const reduceTransactionListFetchState_1 = require("./reduceTransactionListFetchState");
|
|
13
14
|
const transactionListState_1 = require("./transactionListState");
|
|
@@ -35,7 +36,7 @@ const getTransactionListByAccount = (transactionState, transactionListState, acc
|
|
|
35
36
|
}
|
|
36
37
|
return value != null;
|
|
37
38
|
});
|
|
38
|
-
transactions = (0, orderBy_1.default)(transactionsUnsorted, (value) => value.date.valueOf(), 'desc');
|
|
39
|
+
transactions = (0, orderBy_1.default)((0, filterTransactionsByTimePeriod_1.filterTransactionsByTimePeriod)(transactionsUnsorted, filterByTimePeriod), (value) => value.date.valueOf(), 'desc');
|
|
39
40
|
}
|
|
40
41
|
const key = (0, transactionListState_1.getAcKey)(accountId, accountType);
|
|
41
42
|
const uiState = (0, get_1.default)(transactionListState.byAccount.transactionListUIStateByAccountKey, key, {});
|
|
@@ -8,6 +8,7 @@ const flatMap_1 = __importDefault(require("lodash/flatMap"));
|
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
9
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
10
10
|
const transactionSelector_1 = require("../../entity/transaction/transactionSelector");
|
|
11
|
+
const filterTransactionsByTimePeriod_1 = require("./filterTransactionsByTimePeriod");
|
|
11
12
|
const parallelFetchAccountTransactionListEpic_1 = require("./parallelFetchAccountTransactionListEpic");
|
|
12
13
|
const reduceTransactionListFetchState_1 = require("./reduceTransactionListFetchState");
|
|
13
14
|
const transactionListState_1 = require("./transactionListState");
|
|
@@ -32,7 +33,7 @@ const getTransactionsListByCategoryType = (transactionState, transactionListStat
|
|
|
32
33
|
}
|
|
33
34
|
return value != null;
|
|
34
35
|
});
|
|
35
|
-
transactions = (0, orderBy_1.default)(transactionsUnsorted, (value) => value.date.valueOf(), 'desc');
|
|
36
|
+
transactions = (0, orderBy_1.default)((0, filterTransactionsByTimePeriod_1.filterTransactionsByTimePeriod)(transactionsUnsorted, filterByTimePeriod), (value) => value.date.valueOf(), 'desc');
|
|
36
37
|
}
|
|
37
38
|
const uiState = transactionListState.byType[transactionCategoryType].transactionListUIState;
|
|
38
39
|
return {
|
|
@@ -8,6 +8,7 @@ const flatMap_1 = __importDefault(require("lodash/flatMap"));
|
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
9
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
10
10
|
const transactionSelector_1 = require("../../entity/transaction/transactionSelector");
|
|
11
|
+
const filterTransactionsByTimePeriod_1 = require("./filterTransactionsByTimePeriod");
|
|
11
12
|
const parallelFetchAccountTransactionListEpic_1 = require("./parallelFetchAccountTransactionListEpic");
|
|
12
13
|
const reduceTransactionListFetchState_1 = require("./reduceTransactionListFetchState");
|
|
13
14
|
const transactionListState_1 = require("./transactionListState");
|
|
@@ -35,7 +36,7 @@ const getTransactionListByClass = (transactionState, transactionListState, accou
|
|
|
35
36
|
}
|
|
36
37
|
return value != null;
|
|
37
38
|
});
|
|
38
|
-
transactions = (0, orderBy_1.default)(transactionsUnsorted, (value) => value.date.valueOf(), 'desc');
|
|
39
|
+
transactions = (0, orderBy_1.default)((0, filterTransactionsByTimePeriod_1.filterTransactionsByTimePeriod)(transactionsUnsorted, filterByTimePeriod), (value) => value.date.valueOf(), 'desc');
|
|
39
40
|
}
|
|
40
41
|
const key = (0, transactionListState_1.getClassAcKey)(accountId, accountType, classId);
|
|
41
42
|
const uiState = (0, get_1.default)(transactionListState.byClass.transactionListUIStateByClassKey, key, {});
|
|
@@ -8,6 +8,7 @@ const flatMap_1 = __importDefault(require("lodash/flatMap"));
|
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
9
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
10
10
|
const transactionSelector_1 = require("../../entity/transaction/transactionSelector");
|
|
11
|
+
const filterTransactionsByTimePeriod_1 = require("./filterTransactionsByTimePeriod");
|
|
11
12
|
const parallelFetchAccountTransactionListEpic_1 = require("./parallelFetchAccountTransactionListEpic");
|
|
12
13
|
const reduceTransactionListFetchState_1 = require("./reduceTransactionListFetchState");
|
|
13
14
|
const transactionListState_1 = require("./transactionListState");
|
|
@@ -35,7 +36,7 @@ const getTransactionListByProject = (transactionState, transactionListState, acc
|
|
|
35
36
|
}
|
|
36
37
|
return value != null;
|
|
37
38
|
});
|
|
38
|
-
transactions = (0, orderBy_1.default)(transactionsUnsorted, (value) => value.date.valueOf(), 'desc');
|
|
39
|
+
transactions = (0, orderBy_1.default)((0, filterTransactionsByTimePeriod_1.filterTransactionsByTimePeriod)(transactionsUnsorted, filterByTimePeriod), (value) => value.date.valueOf(), 'desc');
|
|
39
40
|
}
|
|
40
41
|
const key = (0, transactionListState_1.getProjectAcKey)(accountId, accountType, projectId);
|
|
41
42
|
const uiState = (0, get_1.default)(transactionListState.byProject.transactionListUIStateByProjectKey, key, {});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.20",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|