@zeniai/client-epic-state 4.9.8 → 4.9.9
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/fiscalYearHelpers/formatZeniDateFY.d.ts +1 -0
- package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +2 -1
- package/lib/entity/company/companyHelper.d.ts +5 -0
- package/lib/entity/company/companyHelper.js +24 -0
- package/lib/entity/company/companySelector.d.ts +7 -0
- package/lib/entity/company/companySelector.js +17 -1
- package/lib/epic.d.ts +8 -6
- package/lib/epic.js +8 -6
- package/lib/index.d.ts +11 -11
- package/lib/index.js +21 -14
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewPayload.d.ts +16 -0
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +21 -1
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +77 -3
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewSelector.d.ts +9 -1
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewSelector.js +42 -1
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.d.ts +15 -3
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.js +18 -1
- package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportHistoricDataEpic.d.ts +8 -0
- package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportHistoricDataEpic.js +66 -0
- package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportHistoricDatesEpic.d.ts +7 -0
- package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportHistoricDatesEpic.js +54 -0
- package/lib/view/companyMonthEndReportView/{fetchCompanyMonthEndReportViewEpic.d.ts → epics/fetchCompanyMonthEndReportViewEpic.d.ts} +4 -4
- package/lib/view/companyMonthEndReportView/{fetchCompanyMonthEndReportViewEpic.js → epics/fetchCompanyMonthEndReportViewEpic.js} +4 -2
- package/lib/view/companyMonthEndReportView/{improveUsingZeniGPTEpic.d.ts → epics/improveUsingZeniGPTEpic.d.ts} +3 -3
- package/lib/view/companyMonthEndReportView/{improveUsingZeniGPTEpic.js → epics/improveUsingZeniGPTEpic.js} +2 -2
- package/lib/view/companyMonthEndReportView/{saveCompanyMonthEndReportEpic.d.ts → epics/saveCompanyMonthEndReportEpic.d.ts} +5 -5
- package/lib/view/companyMonthEndReportView/{saveCompanyMonthEndReportEpic.js → epics/saveCompanyMonthEndReportEpic.js} +9 -7
- package/lib/view/companyMonthEndReportView/{sendCompanyMonthEndReportEpic.d.ts → epics/sendCompanyMonthEndReportEpic.d.ts} +5 -5
- package/lib/view/companyMonthEndReportView/{sendCompanyMonthEndReportEpic.js → epics/sendCompanyMonthEndReportEpic.js} +9 -7
- package/lib/view/recommendation/fetchEntityRecommendationsByTransactionIdEpic.d.ts +10 -0
- package/lib/view/recommendation/{fetchRecommendationByEntityQboIdEpic.js → fetchEntityRecommendationsByTransactionIdEpic.js} +13 -6
- package/lib/view/recommendation/fetchRecommendationByEntityIdEpic.js +2 -2
- package/lib/view/recommendation/recommendationHelper.d.ts +3 -0
- package/lib/view/recommendation/recommendationHelper.js +37 -21
- package/lib/view/recommendation/recommendationReducer.d.ts +1 -1
- package/lib/view/recommendation/recommendationReducer.js +3 -3
- 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/lib/view/transactionDetail/transactionDetailLocalDataHelper.d.ts +2 -1
- package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +3 -2
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +3 -3
- package/lib/view/transactionDetail/transactionDetailReducer.js +4 -4
- package/lib/view/transactionDetail/transactionDetailState.d.ts +7 -0
- package/lib/view/transactionDetail/transactionDetailState.js +4 -3
- package/package.json +1 -1
- package/lib/view/recommendation/fetchRecommendationByEntityQboIdEpic.d.ts +0 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toEntityTypeURL = exports.
|
|
3
|
+
exports.toEntityTypeURL = exports.fetchEntityRecommendationsByTransactionIdEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const responsePayload_1 = require("../../responsePayload");
|
|
@@ -8,23 +8,30 @@ const recommendationReducer_1 = require("./recommendationReducer");
|
|
|
8
8
|
const transactionDetailReducer_1 = require("../transactionDetail/transactionDetailReducer");
|
|
9
9
|
const recommendationHelper_1 = require("./recommendationHelper");
|
|
10
10
|
const accountListSelector_1 = require("../accountList/accountListSelector");
|
|
11
|
-
const
|
|
11
|
+
const transactionDetailState_1 = require("../transactionDetail/transactionDetailState");
|
|
12
|
+
const fetchEntityRecommendationsByTransactionIdEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(recommendationReducer_1.fetchEntityRecommendationsByTransactionId.match), (0, operators_1.switchMap)((action) => {
|
|
12
13
|
const { entity, amount, transactionDetails } = action.payload;
|
|
14
|
+
const query = {
|
|
15
|
+
amount,
|
|
16
|
+
transaction_id: (0, transactionDetailState_1.getActualTransactionID)(transactionDetails.transactionId.id),
|
|
17
|
+
transaction_type: transactionDetails.transaction.type,
|
|
18
|
+
};
|
|
13
19
|
return zeniAPI
|
|
14
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/${(0, exports.toEntityTypeURL)(entity.type)}/${entity.qboId}/recommendations?query=${encodeURIComponent(
|
|
20
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/${(0, exports.toEntityTypeURL)(entity.type)}/${entity.qboId}/recommendations?query=${encodeURIComponent(JSON.stringify(query))}`)
|
|
15
21
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
22
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
17
23
|
const actions = [];
|
|
18
24
|
const { transactionId, transaction, lineIds } = transactionDetails;
|
|
25
|
+
const recommendationByLineId = (0, recommendationHelper_1.getRecommendationByLineIdFromRecommendationPayload)(response.data.recommendations, lineIds);
|
|
19
26
|
const recommendations = (0, recommendationHelper_1.getRecommendationFromRecommendationPayload)(response.data.recommendations);
|
|
20
27
|
actions.push((0, recommendationReducer_1.updateRecommendationForEntity)({
|
|
21
28
|
entityId: entity.id,
|
|
22
29
|
entityType: entity.type,
|
|
23
30
|
recommendations,
|
|
24
31
|
}));
|
|
25
|
-
if (
|
|
32
|
+
if (recommendationByLineId != null) {
|
|
26
33
|
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(state$.value.accountState, state$.value.accountListState, 'accountList');
|
|
27
|
-
actions.push((0, transactionDetailReducer_1.setEntityRecommendationForLineIdsForTransactionDetail)(transactionId, transaction, lineIds, entity, amount,
|
|
34
|
+
actions.push((0, transactionDetailReducer_1.setEntityRecommendationForLineIdsForTransactionDetail)(transactionId, transaction, lineIds, entity, amount, recommendationByLineId, uncategorizedIncomeExpense));
|
|
28
35
|
}
|
|
29
36
|
return (0, rxjs_1.from)(actions);
|
|
30
37
|
}
|
|
@@ -42,7 +49,7 @@ const fetchRecommendationByEntityQboIdEpic = (actions$, state$, zeniAPI) => acti
|
|
|
42
49
|
JSON.stringify(error)),
|
|
43
50
|
}))));
|
|
44
51
|
}));
|
|
45
|
-
exports.
|
|
52
|
+
exports.fetchEntityRecommendationsByTransactionIdEpic = fetchEntityRecommendationsByTransactionIdEpic;
|
|
46
53
|
const toEntityTypeURL = (entityType) => {
|
|
47
54
|
return `${entityType}s`;
|
|
48
55
|
};
|
|
@@ -6,11 +6,11 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const responsePayload_1 = require("../../responsePayload");
|
|
7
7
|
const recommendationReducer_1 = require("./recommendationReducer");
|
|
8
8
|
const recommendationHelper_1 = require("./recommendationHelper");
|
|
9
|
-
const
|
|
9
|
+
const fetchEntityRecommendationsByTransactionIdEpic_1 = require("./fetchEntityRecommendationsByTransactionIdEpic");
|
|
10
10
|
const fetchRecommendationByEntityIdEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(recommendationReducer_1.fetchRecommendationByEntityId.match), (0, operators_1.mergeMap)((action) => {
|
|
11
11
|
const { entityId, entityType } = action.payload;
|
|
12
12
|
return zeniAPI
|
|
13
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/${(0,
|
|
13
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/${(0, fetchEntityRecommendationsByTransactionIdEpic_1.toEntityTypeURL)(entityType)}/${entityId}/recommendations`)
|
|
14
14
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
15
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
16
16
|
const actions = [];
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { RecommendationPayload } from '../../commonPayloadTypes/recommendationPayload';
|
|
2
|
+
import { ID } from '../../commonStateTypes/common';
|
|
2
3
|
import { Recommendation } from '../../commonStateTypes/recommendationBase';
|
|
4
|
+
import { RecommendationByLineId } from '../../entity/transaction/stateTypes/transaction';
|
|
3
5
|
export declare const getRecommendationFromRecommendationPayload: (payload: RecommendationPayload[]) => Recommendation[] | undefined;
|
|
6
|
+
export declare const getRecommendationByLineIdFromRecommendationPayload: (recommendationPayload: RecommendationPayload[], lineIds: ID[]) => RecommendationByLineId | undefined;
|
|
@@ -1,35 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRecommendationFromRecommendationPayload = void 0;
|
|
3
|
+
exports.getRecommendationByLineIdFromRecommendationPayload = exports.getRecommendationFromRecommendationPayload = void 0;
|
|
4
4
|
const accountPayload_1 = require("../../entity/account/accountPayload");
|
|
5
5
|
const classPayload_1 = require("../../entity/class/classPayload");
|
|
6
|
+
const transactionPayload_1 = require("../../entity/transaction/payloadTypes/transactionPayload");
|
|
6
7
|
const getRecommendationFromRecommendationPayload = (payload) => {
|
|
7
|
-
var _a, _b;
|
|
8
8
|
if (payload == null || payload.length === 0) {
|
|
9
9
|
return undefined;
|
|
10
10
|
}
|
|
11
|
-
const recommendation = payload[0]; // In this case, there will be only one recommendation item since this is an entity recommendation.
|
|
12
|
-
const accounts = recommendation.accounts;
|
|
13
|
-
const classObjs = recommendation.accounting_classes;
|
|
14
11
|
const recommendations = [];
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
payload.map((recommendationPayload) => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const accounts = recommendationPayload.accounts;
|
|
15
|
+
const classObjs = recommendationPayload.accounting_classes;
|
|
16
|
+
const mappedAccounts = accounts === null || accounts === void 0 ? void 0 : accounts.map((acc) => (0, accountPayload_1.mapRecommendedAccountBasePayloadToRecommendedAccountBase)(acc));
|
|
17
|
+
const mappedClasses = classObjs === null || classObjs === void 0 ? void 0 : classObjs.map((cls) => (0, classPayload_1.mapRecommendedClassBasePayloadToRecommendedClassBase)(cls));
|
|
18
|
+
if (mappedAccounts != null &&
|
|
19
|
+
mappedAccounts.length >= ((_a = mappedClasses === null || mappedClasses === void 0 ? void 0 : mappedClasses.length) !== null && _a !== void 0 ? _a : 0)) {
|
|
20
|
+
mappedAccounts.forEach((account, index) => {
|
|
21
|
+
recommendations.push({
|
|
22
|
+
account,
|
|
23
|
+
class: mappedClasses === null || mappedClasses === void 0 ? void 0 : mappedClasses[index],
|
|
24
|
+
});
|
|
22
25
|
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
}
|
|
27
|
+
else if (mappedClasses != null &&
|
|
28
|
+
mappedClasses.length >= ((_b = mappedAccounts === null || mappedAccounts === void 0 ? void 0 : mappedAccounts.length) !== null && _b !== void 0 ? _b : 0)) {
|
|
29
|
+
mappedClasses.forEach((cls, index) => {
|
|
30
|
+
recommendations.push({
|
|
31
|
+
account: mappedAccounts === null || mappedAccounts === void 0 ? void 0 : mappedAccounts[index],
|
|
32
|
+
class: cls,
|
|
33
|
+
});
|
|
30
34
|
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
33
37
|
return recommendations;
|
|
34
38
|
};
|
|
35
39
|
exports.getRecommendationFromRecommendationPayload = getRecommendationFromRecommendationPayload;
|
|
40
|
+
const getRecommendationByLineIdFromRecommendationPayload = (recommendationPayload, lineIds) => {
|
|
41
|
+
if (recommendationPayload.length === 0) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const recommendationsWithLine = {};
|
|
45
|
+
recommendationPayload.forEach((lineRecommendations, index) => {
|
|
46
|
+
recommendationsWithLine[lineIds[index]] =
|
|
47
|
+
(0, transactionPayload_1.transformRecommendation)(lineRecommendations);
|
|
48
|
+
});
|
|
49
|
+
return recommendationsWithLine;
|
|
50
|
+
};
|
|
51
|
+
exports.getRecommendationByLineIdFromRecommendationPayload = getRecommendationByLineIdFromRecommendationPayload;
|
|
@@ -6,7 +6,7 @@ import { SupportedTransaction } from '../../entity/transaction/transactionState'
|
|
|
6
6
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
7
7
|
import { EntityRecommendationState } from './recommendationState';
|
|
8
8
|
export declare const initialState: EntityRecommendationState;
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const fetchEntityRecommendationsByTransactionId: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entity: Entity, amount: number, transactionDetails: {
|
|
10
10
|
transactionId: TransactionID;
|
|
11
11
|
transaction: SupportedTransaction;
|
|
12
12
|
lineIds: ID[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearRecommendation = exports.indicateReadyToInitializeRecommendation = exports.updateRecommendationForEntityFailure = exports.updateRecommendationForEntity = exports.fetchRecommendationByEntityId = exports.fetchRecommendationByEntityName = exports.
|
|
4
|
+
exports.clearRecommendation = exports.indicateReadyToInitializeRecommendation = exports.updateRecommendationForEntityFailure = exports.updateRecommendationForEntity = exports.fetchRecommendationByEntityId = exports.fetchRecommendationByEntityName = exports.fetchEntityRecommendationsByTransactionId = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const recommendationState_1 = require("./recommendationState");
|
|
7
7
|
exports.initialState = {
|
|
@@ -11,7 +11,7 @@ const recommendation = (0, toolkit_1.createSlice)({
|
|
|
11
11
|
name: 'recommendation',
|
|
12
12
|
initialState: exports.initialState,
|
|
13
13
|
reducers: {
|
|
14
|
-
|
|
14
|
+
fetchEntityRecommendationsByTransactionId: {
|
|
15
15
|
reducer(draft,
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17
17
|
action) {
|
|
@@ -101,7 +101,7 @@ const recommendation = (0, toolkit_1.createSlice)({
|
|
|
101
101
|
},
|
|
102
102
|
},
|
|
103
103
|
});
|
|
104
|
-
_a = recommendation.actions, exports.
|
|
104
|
+
_a = recommendation.actions, exports.fetchEntityRecommendationsByTransactionId = _a.fetchEntityRecommendationsByTransactionId, exports.fetchRecommendationByEntityName = _a.fetchRecommendationByEntityName, exports.fetchRecommendationByEntityId = _a.fetchRecommendationByEntityId, exports.updateRecommendationForEntity = _a.updateRecommendationForEntity, exports.updateRecommendationForEntityFailure = _a.updateRecommendationForEntityFailure, exports.indicateReadyToInitializeRecommendation = _a.indicateReadyToInitializeRecommendation, exports.clearRecommendation = _a.clearRecommendation;
|
|
105
105
|
exports.default = recommendation.reducer;
|
|
106
106
|
const doUpdateRecommendationForEntity = (draft, entityId, entityType, payload) => {
|
|
107
107
|
const key = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId);
|
|
@@ -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,
|
|
@@ -3,6 +3,7 @@ import { Recommendation } from '../../commonStateTypes/recommendationBase';
|
|
|
3
3
|
import { AccountBase } from '../../entity/account/accountState';
|
|
4
4
|
import { ClassBase } from '../../entity/class/classState';
|
|
5
5
|
import { Entity } from '../../entity/genericEntity/entity';
|
|
6
|
+
import { RecommendationByLineId } from '../../entity/transaction/stateTypes/transaction';
|
|
6
7
|
import { SupportedTransaction } from '../../entity/transaction/transactionState';
|
|
7
8
|
import { UncategorizedAccounts } from '../accountList/accountListSelector';
|
|
8
9
|
import { TransactionDetailLocalData } from './transactionDetailTypes';
|
|
@@ -16,6 +17,6 @@ export declare const toSetAllLineItemsToCategoryClass: (transaction: SupportedTr
|
|
|
16
17
|
updateOrRetain: 'update' | 'retain';
|
|
17
18
|
} | undefined, recommendations?: Recommendation[] | undefined) => TransactionDetailLocalData;
|
|
18
19
|
export declare const toSetAllLineItemsLocalDataIsUpdateAllChecked: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionDetailLocalData, isUpdateAll: boolean, entity?: Entity | undefined) => TransactionDetailLocalData;
|
|
19
|
-
export declare const setEntityRecommendationForLineIdInLocalData: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionDetailLocalData, entity: Entity, recommendationLineIds: ID[],
|
|
20
|
+
export declare const setEntityRecommendationForLineIdInLocalData: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionDetailLocalData, entity: Entity, recommendationLineIds: ID[], recommendationByLineId?: RecommendationByLineId | undefined, uncategorizedIncomeExpense?: UncategorizedAccounts | undefined) => TransactionDetailLocalData;
|
|
20
21
|
export declare const removeEntityRecommendationForLineIdInLocalData: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionDetailLocalData, recommendationLineIds: ID[]) => TransactionDetailLocalData;
|
|
21
22
|
export declare const getChangedLineItemCountFromLocalData: (transaction: SupportedTransaction, transactionLocalData: TransactionDetailLocalData) => number;
|
|
@@ -428,7 +428,7 @@ const toSetAllLineItemsLocalDataIsUpdateAllChecked = (transaction, transactionDe
|
|
|
428
428
|
return newLocalData;
|
|
429
429
|
};
|
|
430
430
|
exports.toSetAllLineItemsLocalDataIsUpdateAllChecked = toSetAllLineItemsLocalDataIsUpdateAllChecked;
|
|
431
|
-
const setEntityRecommendationForLineIdInLocalData = (transaction, transactionDetailLocalData, entity, recommendationLineIds,
|
|
431
|
+
const setEntityRecommendationForLineIdInLocalData = (transaction, transactionDetailLocalData, entity, recommendationLineIds, recommendationByLineId, uncategorizedIncomeExpense) => {
|
|
432
432
|
const newLineItems = {};
|
|
433
433
|
let matchingEntityLineId = undefined;
|
|
434
434
|
const checkIfNotJEAndDeposit = (0, vendorTransaction_1.isVendorTransaction)(transaction) === true ||
|
|
@@ -440,11 +440,12 @@ const setEntityRecommendationForLineIdInLocalData = (transaction, transactionDet
|
|
|
440
440
|
const lineId = line.id;
|
|
441
441
|
const oldRecord = transactionDetailLocalData.lineItemById[lineId];
|
|
442
442
|
// check if any line already has this entity
|
|
443
|
-
if (recommendationLineIds.includes(
|
|
443
|
+
if (recommendationLineIds.includes(lineId)) {
|
|
444
444
|
if (line.type === 'transaction_with_account_and_class_line' ||
|
|
445
445
|
line.type === 'transaction_with_product_or_service_line' ||
|
|
446
446
|
line.type === 'journal_entry_transaction_line') {
|
|
447
447
|
const record = Object.assign({}, oldRecord);
|
|
448
|
+
const recommendations = recommendationByLineId === null || recommendationByLineId === void 0 ? void 0 : recommendationByLineId[lineId];
|
|
448
449
|
const accountLine = line;
|
|
449
450
|
record.account = accountLine.account;
|
|
450
451
|
record.class = accountLine.class;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
2
|
-
import { TransactionID } from '../../entity/transaction/stateTypes/transaction';
|
|
2
|
+
import { RecommendationByLineId, TransactionID } from '../../entity/transaction/stateTypes/transaction';
|
|
3
3
|
import { TransactionDetailState, TransactionSaveUpdates } from './transactionDetailState';
|
|
4
4
|
import { FetchState, UpdateType } from '../../commonStateTypes/common';
|
|
5
5
|
import { SupportedTransaction, SupportedTransactionPayload } from '../../entity/transaction/transactionState';
|
|
@@ -84,13 +84,13 @@ export declare const fetchTransactionDetail: import("@reduxjs/toolkit").ActionCr
|
|
|
84
84
|
transaction: SupportedTransaction;
|
|
85
85
|
isUpdateAll: boolean;
|
|
86
86
|
entity: Entity | undefined;
|
|
87
|
-
}, string, never, never>, setEntityRecommendationForLineIdsForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, lineIds: string[], entity: Entity, amount: number,
|
|
87
|
+
}, string, never, never>, setEntityRecommendationForLineIdsForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, lineIds: string[], entity: Entity, amount: number, recommendationByLineId: RecommendationByLineId, uncategorizedIncomeExpense?: UncategorizedAccounts | undefined], {
|
|
88
88
|
transactionId: TransactionID;
|
|
89
89
|
transaction: SupportedTransaction;
|
|
90
90
|
lineIds: string[];
|
|
91
91
|
entity: Entity;
|
|
92
92
|
amount: number;
|
|
93
|
-
|
|
93
|
+
recommendationByLineId: RecommendationByLineId;
|
|
94
94
|
uncategorizedIncomeExpense: UncategorizedAccounts | undefined;
|
|
95
95
|
}, string, never, never>, removeEntityRecommendationForLineIdForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, lineId: string], {
|
|
96
96
|
transactionId: TransactionID;
|
|
@@ -270,15 +270,15 @@ const transactionDetail = (0, toolkit_1.createSlice)({
|
|
|
270
270
|
},
|
|
271
271
|
setEntityRecommendationForLineIdsForTransactionDetail: {
|
|
272
272
|
reducer(draft, action) {
|
|
273
|
-
const { transaction, lineIds,
|
|
273
|
+
const { transaction, lineIds, recommendationByLineId, uncategorizedIncomeExpense, } = action.payload;
|
|
274
274
|
const key = (0, transactionDetailState_1.getTransactionDetailKey)(action.payload.transactionId);
|
|
275
275
|
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
276
276
|
if (detail != null) {
|
|
277
|
-
const newLocalData = (0, transactionDetailLocalDataHelper_1.setEntityRecommendationForLineIdInLocalData)(transaction, detail.transactionDetailLocalData, action.payload.entity, lineIds,
|
|
277
|
+
const newLocalData = (0, transactionDetailLocalDataHelper_1.setEntityRecommendationForLineIdInLocalData)(transaction, detail.transactionDetailLocalData, action.payload.entity, lineIds, recommendationByLineId, uncategorizedIncomeExpense);
|
|
278
278
|
draft.transactionDetailById[key] = Object.assign(Object.assign({}, detail), { transactionDetailLocalData: newLocalData });
|
|
279
279
|
}
|
|
280
280
|
},
|
|
281
|
-
prepare(transactionId, transaction, lineIds, entity, amount,
|
|
281
|
+
prepare(transactionId, transaction, lineIds, entity, amount, recommendationByLineId, uncategorizedIncomeExpense) {
|
|
282
282
|
return {
|
|
283
283
|
payload: {
|
|
284
284
|
transactionId,
|
|
@@ -286,7 +286,7 @@ const transactionDetail = (0, toolkit_1.createSlice)({
|
|
|
286
286
|
lineIds,
|
|
287
287
|
entity,
|
|
288
288
|
amount,
|
|
289
|
-
|
|
289
|
+
recommendationByLineId,
|
|
290
290
|
uncategorizedIncomeExpense,
|
|
291
291
|
},
|
|
292
292
|
};
|
|
@@ -13,6 +13,13 @@ export declare type TransactionDetailKey = ReturnType<typeof getTransactionDetai
|
|
|
13
13
|
export declare const getZeniTransactionDetailKey: (transactionId: TransactionID) => `${string}_expense` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
|
|
14
14
|
export declare type ZeniTransactionDetailKey = ReturnType<typeof getTransactionDetailKey>;
|
|
15
15
|
export declare const getThirdPartyIdFromTransactionId: (transactionId: TransactionID) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Returns actual QBO transaction ID.
|
|
18
|
+
* @param zeniGeneratedId zeni transaciton Id in the form of tran_<uuid>:<qbo_id>
|
|
19
|
+
* @returns retruns the actual QBO transaction Id.
|
|
20
|
+
* @note in case if the given transaction id itself is QBO id, the it just passes it back.
|
|
21
|
+
*/
|
|
22
|
+
export declare const getActualTransactionID: (zeniGeneratedId: string) => string;
|
|
16
23
|
export declare function getAllLinkedTransactions(transaction: Transaction): TransactionID[];
|
|
17
24
|
export interface SupportedTransactionDetail extends FetchedState {
|
|
18
25
|
transactionId?: TransactionID;
|