@zeniai/client-epic-state 4.9.4 → 4.9.6
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/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportViewEpic.js +2 -0
- package/lib/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +3 -1
- package/lib/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +3 -1
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +17 -13
- package/lib/view/spendManagement/reimbursement/reimbursementConfig/reimbursementConfigState.d.ts +1 -0
- package/lib/view/spendManagement/reimbursement/reimbursementConfig/reimbursementConfigState.js +2 -1
- package/lib/view/spendManagement/reimbursement/remiDetailView/epics/fetchRemiDetailEpic.d.ts +2 -1
- package/lib/view/spendManagement/reimbursement/remiDetailView/epics/fetchRemiDetailEpic.js +8 -2
- package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.d.ts +2 -1
- package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.js +23 -14
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const responsePayload_1 = require("../../../responsePayload");
|
|
7
7
|
const companyMonthEndReportViewReducer_1 = require("../companyMonthEndReportViewReducer");
|
|
8
|
+
const fileReducer_1 = require("../../../entity/file/fileReducer");
|
|
8
9
|
const fetchCompanyMonthEndReportViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.fetchCompanyMonthEndReportView.match), (0, operators_1.switchMap)((action) => {
|
|
9
10
|
const { cacheOverride, companyId } = action.payload;
|
|
10
11
|
const state = state$.value;
|
|
@@ -20,6 +21,7 @@ const fetchCompanyMonthEndReportViewEpic = (actions$, state$, zeniAPI) => action
|
|
|
20
21
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
21
22
|
const actions = [
|
|
22
23
|
(0, companyMonthEndReportViewReducer_1.updateCompanyMonthEndReportViewOnSuccess)(companyId, response.data),
|
|
24
|
+
(0, fileReducer_1.updateAttachmentFiles)({ files: response.data.files }),
|
|
23
25
|
];
|
|
24
26
|
return (0, rxjs_1.from)(actions);
|
|
25
27
|
}
|
|
@@ -9,6 +9,7 @@ const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
|
9
9
|
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
10
10
|
const companyReducer_1 = require("../../../entity/company/companyReducer");
|
|
11
11
|
const fileSelector_1 = require("../../../entity/file/fileSelector");
|
|
12
|
+
const formatZeniDateFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
|
|
12
13
|
const saveCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.saveCompanyMonthEndReport.match), (0, operators_1.mergeMap)((action) => {
|
|
13
14
|
const { companyId, recipientEmailList, subject, isPreview, fileId, zeniRequestsHtml, } = action.payload;
|
|
14
15
|
const state = state$.value;
|
|
@@ -33,8 +34,9 @@ const saveCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
33
34
|
recipient_email_list: recipientEmailList,
|
|
34
35
|
tenant_receiver_email_list: state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.tenantReceiverEmailList,
|
|
35
36
|
last_report_sent_business_day: lastReportSentBusinessDay,
|
|
36
|
-
last_report_sent_date: lastReportSentDate.format(
|
|
37
|
+
last_report_sent_date: lastReportSentDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT),
|
|
37
38
|
zeni_requests_html: zeniRequestsHtml,
|
|
39
|
+
files: filePayload,
|
|
38
40
|
};
|
|
39
41
|
const query = { is_preview: isPreview };
|
|
40
42
|
return zeniAPI
|
|
@@ -9,6 +9,7 @@ const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
|
9
9
|
const companyReducer_1 = require("../../../entity/company/companyReducer");
|
|
10
10
|
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
11
11
|
const fileSelector_1 = require("../../../entity/file/fileSelector");
|
|
12
|
+
const formatZeniDateFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
|
|
12
13
|
const sendCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.sendCompanyMonthEndReport.match), (0, operators_1.mergeMap)((action) => {
|
|
13
14
|
const { companyId, fileId } = action.payload;
|
|
14
15
|
const state = state$.value;
|
|
@@ -36,8 +37,9 @@ const sendCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
36
37
|
recipient_email_list: recipientEmailList,
|
|
37
38
|
tenant_receiver_email_list: state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.tenantReceiverEmailList,
|
|
38
39
|
last_report_sent_business_day: lastReportSentBusinessDay,
|
|
39
|
-
last_report_sent_date: lastReportSentDate.format(
|
|
40
|
+
last_report_sent_date: lastReportSentDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT),
|
|
40
41
|
zeni_requests_html: zeniRequestsHtml,
|
|
42
|
+
files: filePayload,
|
|
41
43
|
};
|
|
42
44
|
return zeniAPI
|
|
43
45
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}/emails/month-end`, payload, {
|
|
@@ -23,6 +23,7 @@ import { DuplicateLine } from '../remiDetailView/remiDetailViewState';
|
|
|
23
23
|
export interface EditRemiDetailSelectorView extends BankAccountSelectorView, SelectorView {
|
|
24
24
|
remiId: ID | undefined;
|
|
25
25
|
whatForSection: WhatForSection;
|
|
26
|
+
achSameDayMaxDays: number;
|
|
26
27
|
lineDetailSection: Record<ID, Partial<ReimbursementLineWithAttachmentAndRecommendation>>;
|
|
27
28
|
currencyConversionStatus: Record<ID, FetchStateAndError>;
|
|
28
29
|
paymentTo?: string;
|
|
@@ -20,6 +20,8 @@ const currencySelector_1 = require("../../../../entity/currency/currencySelector
|
|
|
20
20
|
const recommendationSelector_1 = require("../../../recommendation/recommendationSelector");
|
|
21
21
|
const helpers_1 = require("../../helpers");
|
|
22
22
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
23
|
+
const reimbursementConfigSelector_1 = require("../reimbursementConfig/reimbursementConfigSelector");
|
|
24
|
+
const reimbursementConfigState_1 = require("../reimbursementConfig/reimbursementConfigState");
|
|
23
25
|
const mapFileToAttachment = (file) => {
|
|
24
26
|
var _a;
|
|
25
27
|
if (file != null) {
|
|
@@ -40,10 +42,11 @@ const mapFileToAttachment = (file) => {
|
|
|
40
42
|
};
|
|
41
43
|
exports.mapFileToAttachment = mapFileToAttachment;
|
|
42
44
|
const getEditRemiDetail = (state, reimbursementId) => {
|
|
43
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
44
46
|
const { accountListState, accountState, remiDetailViewState, reimbursementState, currencyState, classListState, classState, editRemiDetailViewState, reimbursementConfigState, merchantListState, merchantState, userState, bankAccountState, commonHistoryState, } = state;
|
|
47
|
+
const achSameDayMaxDays = (_b = (_a = (0, reimbursementConfigSelector_1.getReimbursementConfigByKey)(reimbursementConfigState, 'reimbursement_ach_same-day')) === null || _a === void 0 ? void 0 : _a.maxPeriod.value) !== null && _b !== void 0 ? _b : reimbursementConfigState_1.REIMBURSEMENT_PAYMENT_NUMBER_OF_DAYS;
|
|
45
48
|
const sourceRemiDetail = reimbursementId != null
|
|
46
|
-
? (
|
|
49
|
+
? (_c = editRemiDetailViewState.editRemiStateById) === null || _c === void 0 ? void 0 : _c[reimbursementId]
|
|
47
50
|
: editRemiDetailViewState.newRemiState;
|
|
48
51
|
let whatForSection = {};
|
|
49
52
|
let fetchState = 'Not-Started';
|
|
@@ -67,13 +70,13 @@ const getEditRemiDetail = (state, reimbursementId) => {
|
|
|
67
70
|
let reimbursementInfo = undefined;
|
|
68
71
|
if (reimbursementId != null) {
|
|
69
72
|
const reimbursement = (0, get_1.default)(reimbursementState.reimbursementById, reimbursementId, undefined);
|
|
70
|
-
isDeleted = (
|
|
73
|
+
isDeleted = (_d = reimbursement === null || reimbursement === void 0 ? void 0 : reimbursement.isDeleted) !== null && _d !== void 0 ? _d : false;
|
|
71
74
|
reimbursementInfo = reimbursement === null || reimbursement === void 0 ? void 0 : reimbursement.reimbursementInfo;
|
|
72
75
|
const initialWhatForSection = {
|
|
73
76
|
reportTitle: reimbursement === null || reimbursement === void 0 ? void 0 : reimbursement.reportTitle,
|
|
74
77
|
};
|
|
75
78
|
const updatesByLineId = {};
|
|
76
|
-
(
|
|
79
|
+
(_e = reimbursement === null || reimbursement === void 0 ? void 0 : reimbursement.lines) === null || _e === void 0 ? void 0 : _e.forEach((line) => {
|
|
77
80
|
updatesByLineId[line.lineId] = Object.assign({}, line, {
|
|
78
81
|
file: reimbursement.attachments.find((attachment) => attachment.fileId === line.fileId),
|
|
79
82
|
});
|
|
@@ -91,8 +94,8 @@ const getEditRemiDetail = (state, reimbursementId) => {
|
|
|
91
94
|
merchantListState,
|
|
92
95
|
reimbursementConfigState,
|
|
93
96
|
]).fetchState;
|
|
94
|
-
remiStage = (
|
|
95
|
-
createdBy = (0, userSelector_1.getUserByUserId)(userState, (
|
|
97
|
+
remiStage = (_f = reimbursementInfo === null || reimbursementInfo === void 0 ? void 0 : reimbursementInfo.stage.code) !== null && _f !== void 0 ? _f : 'draft';
|
|
98
|
+
createdBy = (0, userSelector_1.getUserByUserId)(userState, (_g = reimbursement === null || reimbursement === void 0 ? void 0 : reimbursement.createdBy) !== null && _g !== void 0 ? _g : '');
|
|
96
99
|
createTime = reimbursement === null || reimbursement === void 0 ? void 0 : reimbursement.createTime;
|
|
97
100
|
remiStatus = reimbursementInfo === null || reimbursementInfo === void 0 ? void 0 : reimbursementInfo.billStatus.code;
|
|
98
101
|
const remiViewState = remiDetailViewState.remiDetailById[reimbursementId];
|
|
@@ -108,14 +111,14 @@ const getEditRemiDetail = (state, reimbursementId) => {
|
|
|
108
111
|
}
|
|
109
112
|
if (sourceRemiDetail != null && fetchState == 'Completed') {
|
|
110
113
|
const updatedRecord = sourceRemiDetail.remiDetailLocalData;
|
|
111
|
-
whatForSection = { reportTitle: (
|
|
114
|
+
whatForSection = { reportTitle: (_h = updatedRecord.whatForSection) === null || _h === void 0 ? void 0 : _h.reportTitle };
|
|
112
115
|
addRemiAutoFieldsByLineId = sourceRemiDetail.addRemiAutoFieldsByLineId;
|
|
113
116
|
tentativeMerchantNameByLineId =
|
|
114
117
|
sourceRemiDetail.tentativeMerchantNameByLineId;
|
|
115
118
|
}
|
|
116
119
|
const lineDetailSection = {};
|
|
117
|
-
const lineDetailSectionUpdatesByLineId = (
|
|
118
|
-
const currencyConversionStatus = (
|
|
120
|
+
const lineDetailSectionUpdatesByLineId = (_k = (_j = sourceRemiDetail === null || sourceRemiDetail === void 0 ? void 0 : sourceRemiDetail.remiDetailLocalData) === null || _j === void 0 ? void 0 : _j.updatesByLineId) !== null && _k !== void 0 ? _k : {};
|
|
121
|
+
const currencyConversionStatus = (_m = (_l = sourceRemiDetail === null || sourceRemiDetail === void 0 ? void 0 : sourceRemiDetail.remiDetailLocalData) === null || _l === void 0 ? void 0 : _l.currencyConversionStateByLineId) !== null && _m !== void 0 ? _m : {};
|
|
119
122
|
Object.keys(lineDetailSectionUpdatesByLineId).forEach((lineId) => {
|
|
120
123
|
var _a, _b, _c;
|
|
121
124
|
lineDetailSection[lineId] = Object.assign({}, lineDetailSectionUpdatesByLineId[lineId], {
|
|
@@ -139,21 +142,22 @@ const getEditRemiDetail = (state, reimbursementId) => {
|
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
});
|
|
142
|
-
const paymentTo = (
|
|
145
|
+
const paymentTo = (_o = sourceRemiDetail === null || sourceRemiDetail === void 0 ? void 0 : sourceRemiDetail.remiDetailLocalData) === null || _o === void 0 ? void 0 : _o.paymentTo;
|
|
143
146
|
const paymentToBankAccountDetail = paymentTo != null
|
|
144
147
|
? (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, paymentTo)
|
|
145
148
|
: undefined;
|
|
146
149
|
const bankAccount = (0, bankAccountViewSelector_1.getBankAccount)(state);
|
|
147
150
|
const accountsHeirarchyList = (0, accountListSelector_1.getNestedAccountListHeirarchy)(accountListState, 'reimbursementAccountList');
|
|
148
151
|
const classHeirarchyList = (0, classListSelector_1.getNestedClassListHeirarchy)(classListState);
|
|
149
|
-
const loggedInUserDepartmentId = (
|
|
152
|
+
const loggedInUserDepartmentId = (_p = (0, tenantSelector_1.getCurrentTenant)(state).accountingClassIDs) === null || _p === void 0 ? void 0 : _p[0];
|
|
150
153
|
const duplicateReimbursementStatus = remiDetailViewState.duplicateReimbursementFetchStatus;
|
|
151
154
|
const duplicateLineByLineId = remiDetailViewState.duplicateLineByLineId;
|
|
152
|
-
return Object.assign(Object.assign({}, bankAccount), {
|
|
155
|
+
return Object.assign(Object.assign({}, bankAccount), { achSameDayMaxDays,
|
|
156
|
+
duplicateReimbursementStatus,
|
|
153
157
|
duplicateLineByLineId, bankAccountCreationState: {
|
|
154
158
|
fetchState: bankAccount.fetchState,
|
|
155
159
|
error: bankAccount.error,
|
|
156
|
-
}, remiId: reimbursementId, fetchState: fetchState, isDeleted, saveStatus: (
|
|
160
|
+
}, remiId: reimbursementId, fetchState: fetchState, isDeleted, saveStatus: (_q = sourceRemiDetail === null || sourceRemiDetail === void 0 ? void 0 : sourceRemiDetail.saveStatus) !== null && _q !== void 0 ? _q : undefined, uploadStatus: (_r = sourceRemiDetail === null || sourceRemiDetail === void 0 ? void 0 : sourceRemiDetail.uploadFetchState) !== null && _r !== void 0 ? _r : 'Not-Started', error: (_t = (_s = sourceRemiDetail === null || sourceRemiDetail === void 0 ? void 0 : sourceRemiDetail.fetchStatus) === null || _s === void 0 ? void 0 : _s.error) !== null && _t !== void 0 ? _t : undefined, version: 0, whatForSection, lineDetailSection: lineDetailSection, paymentTo,
|
|
157
161
|
accountList,
|
|
158
162
|
currencyConversionStatus, classList: (0, classListSelector_1.getClassList)(classState, classListState), merchantList: (0, merchantListSelector_1.getMerchantList)(merchantState, merchantListState), allCurrencies: (0, currencySelector_1.getAllCurrencies)(currencyState), addRemiAutoFieldsByLineId,
|
|
159
163
|
tentativeMerchantNameByLineId,
|
package/lib/view/spendManagement/reimbursement/reimbursementConfig/reimbursementConfigState.d.ts
CHANGED
|
@@ -15,3 +15,4 @@ export declare const REIMBURSEMENT_PAYMENT_METHOD_CODE: readonly ["ach"];
|
|
|
15
15
|
export declare const toReimbursementmentMethodCodeType: (v: string) => "ach";
|
|
16
16
|
export declare type ReimbursementmentConfigCodeType = ReturnType<typeof toReimbursementmentMethodCodeType>;
|
|
17
17
|
export declare type ReimbursementmentSubConfigCodeType = PaymentAchSubConfigCodeType;
|
|
18
|
+
export declare const REIMBURSEMENT_PAYMENT_NUMBER_OF_DAYS = 2;
|
package/lib/view/spendManagement/reimbursement/reimbursementConfig/reimbursementConfigState.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toReimbursementmentMethodCodeType = exports.REIMBURSEMENT_PAYMENT_METHOD_CODE = exports.getReimbursementConfigKey = void 0;
|
|
3
|
+
exports.REIMBURSEMENT_PAYMENT_NUMBER_OF_DAYS = exports.toReimbursementmentMethodCodeType = exports.REIMBURSEMENT_PAYMENT_METHOD_CODE = exports.getReimbursementConfigKey = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../../../commonStateTypes/stringToUnion");
|
|
5
5
|
const getReimbursementConfigKey = (method, subMethod) => `reimbursement_${method}_${subMethod}`;
|
|
6
6
|
exports.getReimbursementConfigKey = getReimbursementConfigKey;
|
|
7
7
|
exports.REIMBURSEMENT_PAYMENT_METHOD_CODE = ['ach'];
|
|
8
8
|
const toReimbursementmentMethodCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.REIMBURSEMENT_PAYMENT_METHOD_CODE);
|
|
9
9
|
exports.toReimbursementmentMethodCodeType = toReimbursementmentMethodCodeType;
|
|
10
|
+
exports.REIMBURSEMENT_PAYMENT_NUMBER_OF_DAYS = 2;
|
package/lib/view/spendManagement/reimbursement/remiDetailView/epics/fetchRemiDetailEpic.d.ts
CHANGED
|
@@ -14,5 +14,6 @@ import { indicateReadyToInitializeRemiLocalStore } from '../../editRemiView/edit
|
|
|
14
14
|
import { updateMerchantListIds } from '../../../merchantList/merchantListReducer';
|
|
15
15
|
import { fetchEntityHistory } from '../../../commonHistoryView/commonHistoryReducer';
|
|
16
16
|
import { updateRecommendationForEntity } from '../../../../recommendation/recommendationReducer';
|
|
17
|
-
|
|
17
|
+
import { fetchReimbursementConfig } from '../../../reimbursement/reimbursementConfig/reimbursementConfigReducer';
|
|
18
|
+
export declare type ActionType = ReturnType<typeof fetchRemiDetail> | ReturnType<typeof updateReimbursement> | ReturnType<typeof updateBankAccounts> | ReturnType<typeof updateRemiDetailFetchState> | ReturnType<typeof removeReimbursement> | ReturnType<typeof removeRemiDetail> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateApprovalRules> | ReturnType<typeof fetchReimbursementConfig> | ReturnType<typeof updateMerchantListIds> | ReturnType<typeof updateEntityApprovalStatus> | ReturnType<typeof updateRecommendationForEntity> | ReturnType<typeof updateMerchants> | ReturnType<typeof fetchDuplicateReimbursement> | ReturnType<typeof indicateReadyToInitializeRemiLocalStore> | ReturnType<typeof updateRemiDetail> | ReturnType<typeof fetchEntityHistory>;
|
|
18
19
|
export declare const fetchRemiDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -20,15 +20,17 @@ const merchantListReducer_1 = require("../../../merchantList/merchantListReducer
|
|
|
20
20
|
const commonHistoryReducer_1 = require("../../../commonHistoryView/commonHistoryReducer");
|
|
21
21
|
const recommendationReducer_1 = require("../../../../recommendation/recommendationReducer");
|
|
22
22
|
const recommendationHelper_1 = require("../../../../recommendation/recommendationHelper");
|
|
23
|
+
const reimbursementConfigReducer_1 = require("../../../reimbursement/reimbursementConfig/reimbursementConfigReducer");
|
|
23
24
|
const fetchRemiDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(remiDetailViewReducer_1.fetchRemiDetail.match), (0, operators_1.mergeMap)((action) => {
|
|
24
25
|
const { reimbursementId, cacheOverride, isShowDeletedReimbursementEnabled, } = action.payload;
|
|
25
26
|
const remiActions = [];
|
|
26
27
|
const state = state$.value;
|
|
28
|
+
const { remiDetailViewState, reimbursementConfigState } = state;
|
|
27
29
|
if (cacheOverride === true) {
|
|
28
|
-
const existingReimbursement = (0, get_1.default)(
|
|
30
|
+
const existingReimbursement = (0, get_1.default)(remiDetailViewState.remiDetailById, reimbursementId, undefined);
|
|
29
31
|
remiActions.push(...removeExistingRemi(reimbursementId, existingReimbursement));
|
|
30
32
|
}
|
|
31
|
-
const remiDetail = (0, get_1.default)(
|
|
33
|
+
const remiDetail = (0, get_1.default)(remiDetailViewState.remiDetailById, reimbursementId, undefined);
|
|
32
34
|
if (cacheOverride == true ||
|
|
33
35
|
remiDetail == null ||
|
|
34
36
|
remiDetail.fetchState !== 'In-Progress') {
|
|
@@ -63,6 +65,10 @@ const fetchRemiDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
63
65
|
(0, bankAccountReducer_1.updateBankAccounts)(reimburseeBankAccount != null ? [reimburseeBankAccount] : []),
|
|
64
66
|
(0, remiDetailViewReducer_1.updateRemiDetailFetchState)(transcationId, 'Completed'),
|
|
65
67
|
];
|
|
68
|
+
if (reimbursementConfigState.fetchState !== 'In-Progress' &&
|
|
69
|
+
reimbursementConfigState.fetchState !== 'Completed') {
|
|
70
|
+
actions.push((0, reimbursementConfigReducer_1.fetchReimbursementConfig)());
|
|
71
|
+
}
|
|
66
72
|
//update the merchants recommendation in recommendation view
|
|
67
73
|
response.data.merchants.forEach((merchant) => {
|
|
68
74
|
var _a;
|
|
@@ -4,11 +4,11 @@ import { Reimbursement } from '../../../../entity/reimbursement/reimbursementSta
|
|
|
4
4
|
import { RootState } from '../../../../reducer';
|
|
5
5
|
import { ReimbursementLineWithAttachment } from '../editRemiView/editRemiViewSelector';
|
|
6
6
|
import { DuplicateLine } from './remiDetailViewState';
|
|
7
|
-
import { AttributeType, Criteria } from '../../../../entity/approvalRule/approvalRuleState';
|
|
8
7
|
import { ZeniDate } from '../../../../zeniDayJS';
|
|
9
8
|
import { ActivityStatus, Actor, EntityType } from '../../../../entity/entityApprovalStatus/entityApprovalStatusState';
|
|
10
9
|
import { StepWithUser } from '../remiSetupApproverView/remiSetupApproverViewSelectorTypes';
|
|
11
10
|
import { User } from '../../../../entity/user/userState';
|
|
11
|
+
import { AttributeType, Criteria } from '../../../../entity/approvalRule/approvalRuleState';
|
|
12
12
|
import { ActivityHistorySelectorView } from '../../commonHistoryView/commonHistorySelector';
|
|
13
13
|
import { LoggedInUser } from '../../../../entity/tenant/tenantState';
|
|
14
14
|
import { ActivityRealTimeApprovalSelectorView } from '../../realTimeApprovalView/realTimeApprovalSelector';
|
|
@@ -20,6 +20,7 @@ export interface RemiDetailViewSelector extends SelectorView {
|
|
|
20
20
|
cancelAndDeleteStatus: FetchStateAndError;
|
|
21
21
|
cancelStatus: FetchStateAndError;
|
|
22
22
|
approvalUpdateStatus: FetchStateAndError;
|
|
23
|
+
achSameDayMaxDays: number;
|
|
23
24
|
duplicateLineByLineId: Record<ID, DuplicateLine>;
|
|
24
25
|
duplicateReimbursementStatus: FetchStateAndError;
|
|
25
26
|
remiActivities: RemiActivity[];
|
|
@@ -15,18 +15,22 @@ const realTimeApprovalSelector_1 = require("../../realTimeApprovalView/realTimeA
|
|
|
15
15
|
const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
|
|
16
16
|
const classSelector_1 = require("../../../../entity/class/classSelector");
|
|
17
17
|
const helpers_1 = require("../../helpers");
|
|
18
|
+
const reimbursementConfigSelector_1 = require("../reimbursementConfig/reimbursementConfigSelector");
|
|
19
|
+
const reimbursementConfigState_1 = require("../reimbursementConfig/reimbursementConfigState");
|
|
20
|
+
const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
|
|
18
21
|
const getRemiDetailView = (state, reimbursementId) => {
|
|
19
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
20
|
-
const { remiDetailViewState, reimbursementState, userState, commonHistoryState, realTimeApprovalState, userRoleState, classListState, classState, entityApprovalStatusState, remiSetupApproverViewState, } = state;
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
23
|
+
const { remiDetailViewState, reimbursementState, userState, commonHistoryState, realTimeApprovalState, userRoleState, classListState, classState, entityApprovalStatusState, remiSetupApproverViewState, reimbursementConfigState, } = state;
|
|
21
24
|
const remiTransactionDetails = (0, get_1.default)(remiDetailViewState.remiDetailById, reimbursementId, undefined);
|
|
25
|
+
const achSameDayMaxDays = (_b = (_a = (0, reimbursementConfigSelector_1.getReimbursementConfigByKey)(reimbursementConfigState, 'reimbursement_ach_same-day')) === null || _a === void 0 ? void 0 : _a.maxPeriod.value) !== null && _b !== void 0 ? _b : reimbursementConfigState_1.REIMBURSEMENT_PAYMENT_NUMBER_OF_DAYS;
|
|
22
26
|
const { approverListState } = remiSetupApproverViewState;
|
|
23
27
|
const reimbursement = reimbursementState.reimbursementById[reimbursementId];
|
|
24
28
|
let remiDetails;
|
|
25
29
|
if (reimbursement != null) {
|
|
26
30
|
remiDetails = Object.assign({}, reimbursement, {
|
|
27
|
-
lines: (
|
|
31
|
+
lines: (_d = (_c = reimbursement.lines) === null || _c === void 0 ? void 0 : _c.map((line) => {
|
|
28
32
|
return Object.assign(Object.assign({}, line), { file: reimbursement.attachments.find((attachment) => attachment.fileId === line.fileId) });
|
|
29
|
-
})) !== null &&
|
|
33
|
+
})) !== null && _d !== void 0 ? _d : [],
|
|
30
34
|
});
|
|
31
35
|
}
|
|
32
36
|
const { approverIds, attributes, attributeSubTypeToUserIdMapping } = approverListState;
|
|
@@ -41,7 +45,7 @@ const getRemiDetailView = (state, reimbursementId) => {
|
|
|
41
45
|
.filter((approver) => approver.user != null);
|
|
42
46
|
const filteredAttributes = (0, cloneDeep_1.default)(attributes);
|
|
43
47
|
const filteredApprovers = (0, cloneDeep_1.default)(allApprovers);
|
|
44
|
-
const entityApprovalStatusByIds = (0, entityApprovalStatusSelector_1.getEntityApprovalStatusByIds)(entityApprovalStatusState, (
|
|
48
|
+
const entityApprovalStatusByIds = (0, entityApprovalStatusSelector_1.getEntityApprovalStatusByIds)(entityApprovalStatusState, (_e = remiTransactionDetails === null || remiTransactionDetails === void 0 ? void 0 : remiTransactionDetails.entityApprovalIds) !== null && _e !== void 0 ? _e : []);
|
|
45
49
|
if (remiActivities != null &&
|
|
46
50
|
(reimbursement === null || reimbursement === void 0 ? void 0 : reimbursement.reimbursementInfo.stage.code) !== 'draft') {
|
|
47
51
|
entityApprovalStatusByIds.forEach((approval) => {
|
|
@@ -61,15 +65,15 @@ const getRemiDetailView = (state, reimbursementId) => {
|
|
|
61
65
|
}
|
|
62
66
|
});
|
|
63
67
|
}
|
|
64
|
-
const createdBy = (0, userSelector_1.getUserByUserId)(userState, (
|
|
65
|
-
const
|
|
66
|
-
fetchState: (
|
|
68
|
+
const createdBy = (0, userSelector_1.getUserByUserId)(userState, (_f = remiDetails === null || remiDetails === void 0 ? void 0 : remiDetails.createdBy) !== null && _f !== void 0 ? _f : '');
|
|
69
|
+
const remiDetailFetchState = {
|
|
70
|
+
fetchState: (_g = remiTransactionDetails === null || remiTransactionDetails === void 0 ? void 0 : remiTransactionDetails.fetchState) !== null && _g !== void 0 ? _g : 'Not-Started',
|
|
67
71
|
error: remiTransactionDetails === null || remiTransactionDetails === void 0 ? void 0 : remiTransactionDetails.error,
|
|
68
72
|
};
|
|
69
|
-
const deleteStatus = (
|
|
70
|
-
const cancelStatus = (
|
|
71
|
-
const cancelAndDeleteStatus = (
|
|
72
|
-
const approvalUpdateStatus = (
|
|
73
|
+
const deleteStatus = (_h = remiTransactionDetails === null || remiTransactionDetails === void 0 ? void 0 : remiTransactionDetails.deleteStatus) !== null && _h !== void 0 ? _h : remiDetailViewState_1.initialRemiDetailView.deleteStatus;
|
|
74
|
+
const cancelStatus = (_j = remiTransactionDetails === null || remiTransactionDetails === void 0 ? void 0 : remiTransactionDetails.cancelStatus) !== null && _j !== void 0 ? _j : remiDetailViewState_1.initialRemiDetailView.cancelStatus;
|
|
75
|
+
const cancelAndDeleteStatus = (_k = remiTransactionDetails === null || remiTransactionDetails === void 0 ? void 0 : remiTransactionDetails.cancelAndDeleteStatus) !== null && _k !== void 0 ? _k : remiDetailViewState_1.initialRemiDetailView.cancelAndDeleteStatus;
|
|
76
|
+
const approvalUpdateStatus = (_l = remiTransactionDetails === null || remiTransactionDetails === void 0 ? void 0 : remiTransactionDetails.approvalUpdateStatus) !== null && _l !== void 0 ? _l : remiDetailViewState_1.initialRemiDetailView.approvalUpdateStatus;
|
|
73
77
|
const duplicateReimbursementStatus = remiDetailViewState.duplicateReimbursementFetchStatus;
|
|
74
78
|
const { classIds } = classListState;
|
|
75
79
|
const duplicateLineByLineId = remiDetailViewState.duplicateLineByLineId;
|
|
@@ -77,9 +81,14 @@ const getRemiDetailView = (state, reimbursementId) => {
|
|
|
77
81
|
classIds: classIds,
|
|
78
82
|
reportId: 'class_list',
|
|
79
83
|
});
|
|
84
|
+
const fetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
85
|
+
remiDetailFetchState,
|
|
86
|
+
reimbursementConfigState,
|
|
87
|
+
]).fetchState;
|
|
80
88
|
return {
|
|
81
|
-
fetchState
|
|
82
|
-
|
|
89
|
+
fetchState,
|
|
90
|
+
achSameDayMaxDays,
|
|
91
|
+
error: remiTransactionDetails === null || remiTransactionDetails === void 0 ? void 0 : remiTransactionDetails.error,
|
|
83
92
|
version: 0,
|
|
84
93
|
remiDetails: remiDetails,
|
|
85
94
|
deleteStatus,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.6",
|
|
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",
|