@zeniai/client-epic-state 4.9.8 → 4.9.11
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/entity/userRole/userRoleType.d.ts +8 -1
- package/lib/entity/userRole/userRoleType.js +73 -2
- package/lib/epic.d.ts +8 -6
- package/lib/epic.js +8 -6
- package/lib/index.d.ts +17 -17
- package/lib/index.js +41 -21
- 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 +11 -1
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewSelector.js +44 -1
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.d.ts +15 -3
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.js +23 -1
- package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportHistoricDataEpic.d.ts +8 -0
- package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportHistoricDataEpic.js +67 -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/settingsView/settingsViewHelpers.d.ts +10 -0
- package/lib/view/settingsView/settingsViewHelpers.js +111 -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/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,116 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNotificationsTabVisible = void 0;
|
|
3
|
+
exports.isNotificationsTabVisible = exports.isMyBankConnectionsTabVisible = exports.isSettingsVisible = exports.isIntegrationsTabVisible = exports.isCompanyDetailsTabVisible = exports.isBankConnectionsTabVisible = exports.isBusinessVerificationTabVisible = exports.isApprovalRulesTabVisible = exports.isAccountingTabVisible = void 0;
|
|
4
|
+
const userRoleType_1 = require("../../entity/userRole/userRoleType");
|
|
5
|
+
const isAccountingTabVisible = (userRole, currentTenant) => {
|
|
6
|
+
if ((0, exports.isSettingsVisible)(currentTenant)) {
|
|
7
|
+
return (0, userRoleType_1.hasFullOrAdminLevelAccess)(userRole);
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
exports.isAccountingTabVisible = isAccountingTabVisible;
|
|
14
|
+
const isApprovalRulesTabVisible = (userRole, currentTenant, userRoleMap) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
if (currentTenant == null || userRoleMap == null) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if ((0, exports.isSettingsVisible)(currentTenant)) {
|
|
20
|
+
const isBillPayTOSAccepted = Boolean((_a = currentTenant.company) === null || _a === void 0 ? void 0 : _a.companyBillPayInfo.isBillPayTOSAccepted);
|
|
21
|
+
const isReimbursementTOSAccepted = Boolean((_b = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.company) === null || _b === void 0 ? void 0 : _b.companyReimbursementInfo.isReimbursementTOSAccepted);
|
|
22
|
+
return ((0, userRoleType_1.hasBillPayAccessible)(currentTenant, userRoleMap) ||
|
|
23
|
+
(0, userRoleType_1.hasReimbursementAccessible)(currentTenant, userRoleMap) ||
|
|
24
|
+
((isBillPayTOSAccepted || isReimbursementTOSAccepted) &&
|
|
25
|
+
(0, userRoleType_1.hasFullOrAdminLevelAccess)(userRole)));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.isApprovalRulesTabVisible = isApprovalRulesTabVisible;
|
|
32
|
+
const isBusinessVerificationTabVisible = (userRole, currentTenant, userRoleMap) => {
|
|
33
|
+
if (currentTenant == null || userRoleMap == null) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
if ((0, exports.isSettingsVisible)(currentTenant)) {
|
|
37
|
+
return ((0, userRoleType_1.hasBillPayAccessible)(currentTenant, userRoleMap) ||
|
|
38
|
+
(0, userRoleType_1.hasReimbursementAccessible)(currentTenant, userRoleMap) ||
|
|
39
|
+
(0, userRoleType_1.hasZeniAccountsAccessible)(currentTenant, userRoleMap) ||
|
|
40
|
+
(0, userRoleType_1.hasChargeCardAccessible)(currentTenant, userRoleMap) ||
|
|
41
|
+
((0, userRoleType_1.hasAnySpendManagementTOSAccepted)(currentTenant) &&
|
|
42
|
+
(0, userRoleType_1.hasFullOrAdminLevelAccess)(userRole)));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.isBusinessVerificationTabVisible = isBusinessVerificationTabVisible;
|
|
49
|
+
const isBankConnectionsTabVisible = (currentTenant, userRoleMap) => {
|
|
50
|
+
if (currentTenant == null || userRoleMap == null) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if ((0, exports.isSettingsVisible)(currentTenant)) {
|
|
54
|
+
return ((0, userRoleType_1.hasBillPayAccessible)(currentTenant, userRoleMap) ||
|
|
55
|
+
(0, userRoleType_1.hasReimbursementAccessible)(currentTenant, userRoleMap) ||
|
|
56
|
+
(0, userRoleType_1.hasZeniAccountsAccessible)(currentTenant, userRoleMap) ||
|
|
57
|
+
(0, userRoleType_1.hasChargeCardAccessible)(currentTenant, userRoleMap));
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.isBankConnectionsTabVisible = isBankConnectionsTabVisible;
|
|
64
|
+
const isCompanyDetailsTabVisible = (userRole, currentTenant, userRoleMap) => {
|
|
65
|
+
if (currentTenant == null || userRoleMap == null) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
if ((0, exports.isSettingsVisible)(currentTenant)) {
|
|
69
|
+
return ((0, userRoleType_1.hasAnyAdminLevelAccess)(userRoleMap) ||
|
|
70
|
+
(0, userRoleType_1.hasLiteLevelAccess)(userRole) ||
|
|
71
|
+
(0, userRoleType_1.hasInvestorBankerLevelAccess)(userRole));
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
exports.isCompanyDetailsTabVisible = isCompanyDetailsTabVisible;
|
|
78
|
+
const isIntegrationsTabVisible = (userRole, currentTenant) => {
|
|
79
|
+
if ((0, exports.isSettingsVisible)(currentTenant)) {
|
|
80
|
+
return (0, userRoleType_1.hasFullOrAdminLevelAccess)(userRole);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.isIntegrationsTabVisible = isIntegrationsTabVisible;
|
|
87
|
+
const isSettingsVisible = (currentTenant) => {
|
|
88
|
+
var _a, _b;
|
|
89
|
+
if (currentTenant == null) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
return ((_b = (_a = currentTenant.company) === null || _a === void 0 ? void 0 : _a.companyOnboardingInfo.isOnboardingCompleted) !== null && _b !== void 0 ? _b : false);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
exports.isSettingsVisible = isSettingsVisible;
|
|
97
|
+
const isMyBankConnectionsTabVisible = (userRole, currentTenant) => {
|
|
98
|
+
var _a;
|
|
99
|
+
if (currentTenant == null) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if ((0, exports.isSettingsVisible)(currentTenant)) {
|
|
103
|
+
const isReimbursementTOSAccepted = Boolean((_a = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.company) === null || _a === void 0 ? void 0 : _a.companyReimbursementInfo.isReimbursementTOSAccepted);
|
|
104
|
+
return (isReimbursementTOSAccepted &&
|
|
105
|
+
((0, userRoleType_1.hasFullOrAdminLevelAccess)(userRole) ||
|
|
106
|
+
(0, userRoleType_1.hasLiteLevelAccess)(userRole) ||
|
|
107
|
+
(0, userRoleType_1.hasEmployeeLevelAccess)(currentTenant)));
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
exports.isMyBankConnectionsTabVisible = isMyBankConnectionsTabVisible;
|
|
4
114
|
const isNotificationsTabVisible = (notificationSettingsView) => {
|
|
5
115
|
const { notificationSettings } = notificationSettingsView;
|
|
6
116
|
return (notificationSettings.missingReceiptNotification != null ||
|
|
@@ -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;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initialSupportedTransactionDetail = exports.getAllLinkedTransactions = exports.getThirdPartyIdFromTransactionId = exports.getZeniTransactionDetailKey = exports.getTransactionDetailKey = void 0;
|
|
3
|
+
exports.initialSupportedTransactionDetail = exports.getAllLinkedTransactions = exports.getActualTransactionID = exports.getThirdPartyIdFromTransactionId = exports.getZeniTransactionDetailKey = exports.getTransactionDetailKey = void 0;
|
|
4
4
|
// This transaction key only extracts the third party ID and uses that
|
|
5
5
|
// for the ID
|
|
6
|
-
const getTransactionDetailKey = (transactionId) => `${getActualTransactionID(transactionId.id)}_${transactionId.type}`;
|
|
6
|
+
const getTransactionDetailKey = (transactionId) => `${(0, exports.getActualTransactionID)(transactionId.id)}_${transactionId.type}`;
|
|
7
7
|
exports.getTransactionDetailKey = getTransactionDetailKey;
|
|
8
8
|
const getZeniTransactionDetailKey = (transactionId) => `${transactionId.id}_${transactionId.type}`;
|
|
9
9
|
exports.getZeniTransactionDetailKey = getZeniTransactionDetailKey;
|
|
10
10
|
const getThirdPartyIdFromTransactionId = (transactionId) => {
|
|
11
11
|
const zeniGeneratedId = transactionId.id;
|
|
12
|
-
return getActualTransactionID(zeniGeneratedId);
|
|
12
|
+
return (0, exports.getActualTransactionID)(zeniGeneratedId);
|
|
13
13
|
};
|
|
14
14
|
exports.getThirdPartyIdFromTransactionId = getThirdPartyIdFromTransactionId;
|
|
15
15
|
/**
|
|
@@ -27,6 +27,7 @@ const getActualTransactionID = (zeniGeneratedId) => {
|
|
|
27
27
|
return splittedIds[1];
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
+
exports.getActualTransactionID = getActualTransactionID;
|
|
30
31
|
function getAllLinkedTransactions(transaction) {
|
|
31
32
|
var _a, _b;
|
|
32
33
|
const result = [];
|
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.11",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../reducer';
|
|
4
|
-
import { ZeniAPI } from '../../zeniAPI';
|
|
5
|
-
import { EntityType } from '../../entity/genericEntity/entity';
|
|
6
|
-
import { fetchRecommendationByEntityQboId, updateRecommendationForEntity, updateRecommendationForEntityFailure } from './recommendationReducer';
|
|
7
|
-
import { setEntityRecommendationForLineIdsForTransactionDetail } from '../transactionDetail/transactionDetailReducer';
|
|
8
|
-
export declare type ActionType = ReturnType<typeof updateRecommendationForEntity> | ReturnType<typeof fetchRecommendationByEntityQboId> | ReturnType<typeof updateRecommendationForEntityFailure> | ReturnType<typeof setEntityRecommendationForLineIdsForTransactionDetail>;
|
|
9
|
-
export declare const fetchRecommendationByEntityQboIdEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
10
|
-
export declare const toEntityTypeURL: (entityType: EntityType) => string;
|