@zeniai/client-epic-state 4.8.55 → 4.8.56
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/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/entity/tenant/tenantPayload.d.ts +5 -0
- package/lib/entity/userRole/userRolePayload.d.ts +5 -0
- package/lib/entity/userRole/userRolePayload.js +15 -0
- package/lib/entity/userRole/userRoleType.d.ts +16 -3
- package/lib/entity/userRole/userRoleType.js +198 -6
- package/lib/epic.d.ts +3 -1
- package/lib/epic.js +3 -1
- package/lib/index.d.ts +14 -12
- package/lib/index.js +50 -18
- package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +31 -4
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +5 -1
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.js +18 -2
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +14 -0
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +36 -4
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewState.d.ts +7 -0
- package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
- package/lib/view/people/deletePersonEpic.d.ts +1 -1
- package/lib/view/people/invitePeopleEpic.d.ts +1 -1
- package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
- package/lib/view/people/resendInviteEpic.d.ts +1 -1
- package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.d.ts +17 -0
- package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +23 -0
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +31 -0
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.js +70 -0
- package/lib/view/settingsView/settingsViewHelpers.d.ts +2 -0
- package/lib/view/settingsView/settingsViewHelpers.js +11 -0
- package/lib/view/settingsView/settingsViewPayload.d.ts +7 -0
- package/lib/view/settingsView/settingsViewReducer.d.ts +7 -2
- package/lib/view/settingsView/settingsViewReducer.js +115 -2
- package/lib/view/settingsView/settingsViewSelector.d.ts +2 -0
- package/lib/view/settingsView/settingsViewSelector.js +4 -1
- package/lib/view/settingsView/settingsViewState.d.ts +18 -0
- package/lib/view/settingsView/settingsViewState.js +15 -0
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +1 -0
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +2 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +3 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +49 -24
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +2 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.js +2 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +16 -9
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.d.ts +1 -1
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +21 -9
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +6 -3
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +9 -6
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +6 -3
- package/lib/view/spendManagement/helpers.js +11 -4
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +5 -1
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +1 -0
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +8 -6
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +2 -0
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +7 -1
- package/lib/view/taskManager/taskListView/taskListSelector.js +1 -1
- package/lib/view/transactionList/fetchTransactionListByEntityEpic.js +3 -0
- package/lib/view/transactionList/transactionListByEntitySelector.d.ts +4 -0
- package/lib/view/transactionList/transactionListByEntitySelector.js +62 -1
- package/lib/view/transactionList/transactionListReducer.d.ts +2 -1
- package/lib/view/transactionList/transactionListReducer.js +2 -2
- package/lib/view/vendorReviewView/vendorFirstReviewView/epics/saveVendorFirstReviewViewEpic.js +9 -6
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewPayload.d.ts +1 -0
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.d.ts +2 -2
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.js +2 -2
- package/lib/zeniAPI.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,2 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
4
|
+
const REMINDER_NOTIFICATION_TYPES = [
|
|
5
|
+
'missingReceiptNotification',
|
|
6
|
+
'uncategorizedTransactionNotification',
|
|
7
|
+
'pendingBillApprovalNotification',
|
|
8
|
+
'pendingReimbursementApprovalNotification',
|
|
9
|
+
];
|
|
10
|
+
const REMINDER_NOTIFICATION_FLAG_TYPES = [
|
|
11
|
+
'isMissingReceiptNotificationActive',
|
|
12
|
+
'isUncategorizedTransactionNotificationActive',
|
|
13
|
+
'isPendingBillApprovalNotificationActive',
|
|
14
|
+
'isPendingReimbursementApprovalNotificationActive',
|
|
15
|
+
];
|
|
16
|
+
const toReminderTypeKey = (v) => (0, stringToUnion_1.stringToUnion)(v, REMINDER_NOTIFICATION_TYPES);
|
|
17
|
+
const toReminderFlagTypeKey = (v) => (0, stringToUnion_1.stringToUnion)(v, REMINDER_NOTIFICATION_FLAG_TYPES);
|
|
@@ -22,6 +22,7 @@ export interface BillPayReviewSelectorView extends SelectorView {
|
|
|
22
22
|
isCollectToAccountInfoFromVendorContact: boolean;
|
|
23
23
|
billPayConfigList: BillPayConfig[];
|
|
24
24
|
isRecurring: boolean;
|
|
25
|
+
isInvoiceDateAutoUpdated: boolean;
|
|
25
26
|
recurringBillInstance?: number;
|
|
26
27
|
recurringConfig?: RecurringBillConfigLocalData;
|
|
27
28
|
}
|
|
@@ -36,7 +36,7 @@ const getDuplicateBills = (state, billId) => {
|
|
|
36
36
|
};
|
|
37
37
|
exports.getDuplicateBills = getDuplicateBills;
|
|
38
38
|
const getReviewPageBillDetail = (state, billId) => {
|
|
39
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
39
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
40
40
|
const { accountListState, accountState, setupViewState, billTransactionState, classListState, editBillDetailViewState, paymentAccountState, vendorState, contactState, billPayConfigState, recurringBillState, depositAccountState, depositAccountListState, } = state;
|
|
41
41
|
const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId !== null && billId !== void 0 ? billId : '');
|
|
42
42
|
const sourceBillDetail = billId != null
|
|
@@ -163,6 +163,7 @@ const getReviewPageBillDetail = (state, billId) => {
|
|
|
163
163
|
isRecurring,
|
|
164
164
|
recurringBillInstance,
|
|
165
165
|
recurringConfig,
|
|
166
|
+
isInvoiceDateAutoUpdated: (_s = whatForSection.isInvoiceDateAutoUpdated) !== null && _s !== void 0 ? _s : false,
|
|
166
167
|
};
|
|
167
168
|
};
|
|
168
169
|
exports.getReviewPageBillDetail = getReviewPageBillDetail;
|
|
@@ -74,6 +74,7 @@ export interface EditBillDetailSelectorView extends SelectorView {
|
|
|
74
74
|
billPayConfigList: BillPayConfig[];
|
|
75
75
|
file: Attachment | undefined;
|
|
76
76
|
previousBills: PreviousBillsSelectorView;
|
|
77
|
+
showVendorGptRecommendationText: boolean;
|
|
77
78
|
isCancelled: boolean;
|
|
78
79
|
isDeleted: boolean;
|
|
79
80
|
showAutofill: boolean;
|
|
@@ -135,4 +136,6 @@ export declare const getRecurringBillLocalData: (recurringBillState: RecurringBi
|
|
|
135
136
|
recurringBillInstancesLocalData: RecurringBillInstance[];
|
|
136
137
|
recurringConfigLocalData?: RecurringBillConfigLocalData | undefined;
|
|
137
138
|
};
|
|
139
|
+
export declare const getInvoiceDate: (invoiceDate: ZeniDate, bookCloseDate?: import("dayjs").Dayjs | undefined) => import("dayjs").Dayjs;
|
|
140
|
+
export declare const getDueDate: (dueDate: ZeniDate, invoiceDate?: import("dayjs").Dayjs | undefined, bookCloseDate?: import("dayjs").Dayjs | undefined) => import("dayjs").Dayjs;
|
|
138
141
|
export declare const getWithdrawFrom: (paymentAccountState: PaymentAccountState, depositAccountState: DepositAccountState, fromAccountId: ID, fromAccountType: string) => TransferMoneyParty | undefined;
|
|
@@ -3,13 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getWithdrawFrom = exports.getRecurringBillLocalData = exports.getCurrentPaymentToOption = exports.toPaymentToOption = exports.getActualPaymentTypeBasedOnAccType = exports.getPaymentSection = exports.getWhatForSection = exports.getPaymentMethodType = exports.getBillPayConfigList = exports.getEditBillDetail = void 0;
|
|
6
|
+
exports.getWithdrawFrom = exports.getDueDate = exports.getInvoiceDate = exports.getRecurringBillLocalData = exports.getCurrentPaymentToOption = exports.toPaymentToOption = exports.getActualPaymentTypeBasedOnAccType = exports.getPaymentSection = exports.getWhatForSection = exports.getPaymentMethodType = exports.getBillPayConfigList = exports.getEditBillDetail = void 0;
|
|
7
7
|
const get_1 = __importDefault(require("lodash/get"));
|
|
8
8
|
const has_1 = __importDefault(require("lodash/has"));
|
|
9
9
|
const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
|
|
10
10
|
const bankAccountSelector_1 = require("../../../../entity/bankAccount/bankAccountSelector");
|
|
11
11
|
const paymentAccountSelector_1 = require("../../../../entity/paymentAccount/paymentAccountSelector");
|
|
12
12
|
const vendorSelector_1 = require("../../../../entity/vendor/vendorSelector");
|
|
13
|
+
const zeniDayJS_1 = require("../../../../zeniDayJS");
|
|
13
14
|
const accountListSelector_1 = require("../../../accountList/accountListSelector");
|
|
14
15
|
const classListSelector_1 = require("../../../classList/classListSelector");
|
|
15
16
|
const billDetailViewState_1 = require("../billDetailView/billDetailViewState");
|
|
@@ -30,7 +31,7 @@ const transferDetailSelector_1 = require("../../zeniAccounts/transferDetail/tran
|
|
|
30
31
|
const depositAccountListSelector_1 = require("../../zeniAccounts/depositAccountList/depositAccountListSelector");
|
|
31
32
|
const depositAccountSelector_1 = require("../../../../entity/depositAccount/depositAccountSelector");
|
|
32
33
|
const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAccountsEnabled, billId) => {
|
|
33
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
|
34
35
|
const { accountListState, accountState, bankAccountState, billDetailViewState, setupViewState, billTransactionState, billPayConfigState, classListState, classState, editBillDetailViewState, paymentAccountState, vendorState, tenantState, companyState, userState, commonHistoryState, contactState, paymentInstrumentState, recurringBillState, depositAccountListState, depositAccountState, } = state;
|
|
35
36
|
const transaction = (0, get_1.default)(billTransactionState.transactionById, billId !== null && billId !== void 0 ? billId : '', undefined);
|
|
36
37
|
let recommendations = {};
|
|
@@ -41,6 +42,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
41
42
|
const sourceBillDetail = billId != null
|
|
42
43
|
? (_a = editBillDetailViewState.editBillStateById) === null || _a === void 0 ? void 0 : _a[key]
|
|
43
44
|
: editBillDetailViewState.newBillState;
|
|
45
|
+
const showVendorGptRecommendationText = (_b = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData.showVendorGptRecommendationText) !== null && _b !== void 0 ? _b : false;
|
|
44
46
|
let vendorDetails;
|
|
45
47
|
let recommendedVendor;
|
|
46
48
|
let lastRecommendedVendorName;
|
|
@@ -91,10 +93,10 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
91
93
|
let qboId;
|
|
92
94
|
const { currentTenantId } = tenantState;
|
|
93
95
|
const bookCloseDate = currentTenantId != null
|
|
94
|
-
? (
|
|
96
|
+
? (_d = (_c = tenantState.tenantsById) === null || _c === void 0 ? void 0 : _c[currentTenantId]) === null || _d === void 0 ? void 0 : _d.bookCloseDate
|
|
95
97
|
: undefined;
|
|
96
98
|
const companyId = currentTenantId != null
|
|
97
|
-
? (
|
|
99
|
+
? (_f = (_e = tenantState.tenantsById) === null || _e === void 0 ? void 0 : _e[currentTenantId]) === null || _f === void 0 ? void 0 : _f.companyId
|
|
98
100
|
: undefined;
|
|
99
101
|
const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
|
|
100
102
|
const payNowCutOffTime = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyBillPayInfo.payNowCutOffTimeByMethod.ach;
|
|
@@ -116,24 +118,25 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
116
118
|
let recurringConfig;
|
|
117
119
|
let recurringBillInstances;
|
|
118
120
|
if (billId != null) {
|
|
119
|
-
isDeleted = (
|
|
120
|
-
createdBy = (0, userSelector_1.getUserByUserId)(userState, (
|
|
121
|
+
isDeleted = (_g = transaction === null || transaction === void 0 ? void 0 : transaction.isDeleted) !== null && _g !== void 0 ? _g : false;
|
|
122
|
+
createdBy = (0, userSelector_1.getUserByUserId)(userState, (_h = transaction === null || transaction === void 0 ? void 0 : transaction.createdBy) !== null && _h !== void 0 ? _h : '');
|
|
121
123
|
createTime = transaction === null || transaction === void 0 ? void 0 : transaction.createTime;
|
|
122
|
-
qboId = (
|
|
124
|
+
qboId = (_j = transaction === null || transaction === void 0 ? void 0 : transaction.account) === null || _j === void 0 ? void 0 : _j.qboId;
|
|
123
125
|
billPayInfo = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo;
|
|
124
126
|
toAccountVendorEmail = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.toAccountVendorEmail;
|
|
125
127
|
isCollectToAccountInfoFromVendorContact =
|
|
126
|
-
(
|
|
127
|
-
const initialVendor = (0, vendorSelector_1.getVendorByQboId)(vendorState, (
|
|
128
|
+
(_k = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.isCollectToAccountInfoFromVendorContact) !== null && _k !== void 0 ? _k : false;
|
|
129
|
+
const initialVendor = (0, vendorSelector_1.getVendorByQboId)(vendorState, (_m = (_l = transaction === null || transaction === void 0 ? void 0 : transaction.vendor) === null || _l === void 0 ? void 0 : _l.id) !== null && _m !== void 0 ? _m : '');
|
|
128
130
|
const initialWhatForSection = {
|
|
129
131
|
invoiceNumber: transaction === null || transaction === void 0 ? void 0 : transaction.documentId,
|
|
130
132
|
invoiceDate: transaction === null || transaction === void 0 ? void 0 : transaction.date,
|
|
131
133
|
billDueDate: transaction === null || transaction === void 0 ? void 0 : transaction.dueDate,
|
|
132
134
|
memo: transaction === null || transaction === void 0 ? void 0 : transaction.memo,
|
|
135
|
+
isInvoiceDateAutoUpdated: false,
|
|
133
136
|
};
|
|
134
137
|
const updatesByLineId = {};
|
|
135
138
|
if (accountList.fetchState === 'Completed') {
|
|
136
|
-
(
|
|
139
|
+
(_o = transaction === null || transaction === void 0 ? void 0 : transaction.lines) === null || _o === void 0 ? void 0 : _o.forEach((line) => {
|
|
137
140
|
var _a;
|
|
138
141
|
updatesByLineId[line.id] = Object.assign(Object.assign({}, line), { account: (_a = accountList.accounts.find((account) => {
|
|
139
142
|
var _a;
|
|
@@ -143,10 +146,10 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
143
146
|
});
|
|
144
147
|
}
|
|
145
148
|
const initialPaymentDetailsSection = {
|
|
146
|
-
paymentType: (0, exports.getPaymentMethodType)(billPayConfigState, (
|
|
149
|
+
paymentType: (0, exports.getPaymentMethodType)(billPayConfigState, (_p = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountType) !== null && _p !== void 0 ? _p : 'depositAccount', billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.billPaymentMethodType, billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.internationalTransferFeeBearerPaymentMethod),
|
|
147
150
|
paymentDate: billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.paymentDate,
|
|
148
|
-
withdrawFrom: (0, exports.getWithdrawFrom)(paymentAccountState, depositAccountState, (
|
|
149
|
-
paymentTo: ((
|
|
151
|
+
withdrawFrom: (0, exports.getWithdrawFrom)(paymentAccountState, depositAccountState, (_q = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountId) !== null && _q !== void 0 ? _q : '', (_r = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountType) !== null && _r !== void 0 ? _r : ''),
|
|
152
|
+
paymentTo: ((_s = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.toAccount.billAccountId) === null || _s === void 0 ? void 0 : _s.length) != null &&
|
|
150
153
|
(billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.toAccount.billAccountId.length) > 0
|
|
151
154
|
? billPayInfo.toAccount.billAccountId
|
|
152
155
|
: undefined,
|
|
@@ -163,7 +166,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
163
166
|
if (sourceBillDetail != null) {
|
|
164
167
|
const billViewState = billDetailViewState.billDetailById[key];
|
|
165
168
|
isCancelled = sourceBillDetail.billDetailLocalData.isCancelled;
|
|
166
|
-
billStage = (
|
|
169
|
+
billStage = (_t = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.stage.code) !== null && _t !== void 0 ? _t : 'draft';
|
|
167
170
|
if (billViewState != null) {
|
|
168
171
|
fetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
169
172
|
sourceBillDetail.fetchStatus,
|
|
@@ -175,7 +178,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
175
178
|
}
|
|
176
179
|
}
|
|
177
180
|
//recurringBill Details
|
|
178
|
-
isRecurring = (
|
|
181
|
+
isRecurring = (_u = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _u !== void 0 ? _u : false;
|
|
179
182
|
if (isRecurring && transaction != null) {
|
|
180
183
|
const { recurringConfigLocalData, recurringBillInstancesLocalData } = (0, exports.getRecurringBillLocalData)(recurringBillState, transaction);
|
|
181
184
|
recurringConfig = recurringConfigLocalData;
|
|
@@ -205,9 +208,9 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
205
208
|
? (0, vendorSelector_1.getVendorByVendorId)(vendorState, updatedRecord.vendor.id)
|
|
206
209
|
: undefined;
|
|
207
210
|
file = updatedRecord.file;
|
|
208
|
-
const bankAccInBill = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (
|
|
209
|
-
const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (
|
|
210
|
-
const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (
|
|
211
|
+
const bankAccInBill = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (_w = (_v = updatedRecord.paymentDetailsSection) === null || _v === void 0 ? void 0 : _v.paymentTo) !== null && _w !== void 0 ? _w : '');
|
|
212
|
+
const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (_x = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.bankAccountIds) !== null && _x !== void 0 ? _x : []);
|
|
213
|
+
const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (_y = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.paymentInstrumentIds) !== null && _y !== void 0 ? _y : []);
|
|
211
214
|
const isBankAccInBillExistInVendor = bankAccInBill != null
|
|
212
215
|
? vendorBankAccounts
|
|
213
216
|
.map((bankAc) => bankAc.bankAccountId)
|
|
@@ -257,7 +260,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
257
260
|
(recommendedVendor === null || recommendedVendor === void 0 ? void 0 : recommendedVendor.vendorCurrencyCode) != null) {
|
|
258
261
|
whatForSection.currencyCode = recommendedVendor.vendorCurrencyCode;
|
|
259
262
|
}
|
|
260
|
-
isRecurring = (
|
|
263
|
+
isRecurring = (_z = sourceBillDetail.billDetailLocalData.isRecurring) !== null && _z !== void 0 ? _z : false;
|
|
261
264
|
recurringConfig = sourceBillDetail.billDetailLocalData.recurringConfig;
|
|
262
265
|
recurringBillInstances =
|
|
263
266
|
sourceBillDetail.billDetailLocalData.recurringBillInstances;
|
|
@@ -277,7 +280,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
277
280
|
}
|
|
278
281
|
const vendorContactSaveStatus = editBillDetailViewState.updateVendorContactState;
|
|
279
282
|
const lineDetailSection = {};
|
|
280
|
-
const lineDetailSectionUpdatesByLineId = (
|
|
283
|
+
const lineDetailSectionUpdatesByLineId = (_1 = (_0 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData) === null || _0 === void 0 ? void 0 : _0.updatesByLineId) !== null && _1 !== void 0 ? _1 : {};
|
|
281
284
|
const classList = (0, classListSelector_1.getClassList)(classState, classListState);
|
|
282
285
|
if (accountList.fetchState === 'Completed') {
|
|
283
286
|
Object.keys(lineDetailSectionUpdatesByLineId).forEach((lineId) => {
|
|
@@ -299,13 +302,14 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
299
302
|
const classHeirarchyList = (0, classListSelector_1.getNestedClassListHeirarchy)(classListState);
|
|
300
303
|
const duplicateBills = (0, billPayReviewSelector_1.getDuplicateBills)(state, billId);
|
|
301
304
|
return {
|
|
305
|
+
showVendorGptRecommendationText,
|
|
302
306
|
recommendedVendor,
|
|
303
307
|
lastRecommendedVendorName,
|
|
304
308
|
duplicateBills,
|
|
305
309
|
fetchState: fetchState,
|
|
306
|
-
saveStatus: (
|
|
307
|
-
error: (
|
|
308
|
-
uploadStatus: (
|
|
310
|
+
saveStatus: (_2 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.saveStatus) !== null && _2 !== void 0 ? _2 : undefined,
|
|
311
|
+
error: (_4 = (_3 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.fetchStatus) === null || _3 === void 0 ? void 0 : _3.error) !== null && _4 !== void 0 ? _4 : undefined,
|
|
312
|
+
uploadStatus: (_5 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.uploadFetchState) !== null && _5 !== void 0 ? _5 : undefined,
|
|
309
313
|
version: 0,
|
|
310
314
|
createdBy,
|
|
311
315
|
createTime,
|
|
@@ -406,7 +410,7 @@ const getPaymentMethodType = (billPayConfigState, accType, paymentMethod, intern
|
|
|
406
410
|
};
|
|
407
411
|
exports.getPaymentMethodType = getPaymentMethodType;
|
|
408
412
|
function getWhatForSection(updatedWhatForSection) {
|
|
409
|
-
var _a, _b, _c, _d, _e;
|
|
413
|
+
var _a, _b, _c, _d, _e, _f;
|
|
410
414
|
return {
|
|
411
415
|
invoiceNumber: (updatedWhatForSection === null || updatedWhatForSection === void 0 ? void 0 : updatedWhatForSection.invoiceNumber) != null &&
|
|
412
416
|
((_a = updatedWhatForSection.invoiceNumber) === null || _a === void 0 ? void 0 : _a.length) > 0
|
|
@@ -419,6 +423,7 @@ function getWhatForSection(updatedWhatForSection) {
|
|
|
419
423
|
? updatedWhatForSection.memo
|
|
420
424
|
: '',
|
|
421
425
|
currencyCode: (_e = updatedWhatForSection === null || updatedWhatForSection === void 0 ? void 0 : updatedWhatForSection.currencyCode) !== null && _e !== void 0 ? _e : 'USD',
|
|
426
|
+
isInvoiceDateAutoUpdated: (_f = updatedWhatForSection === null || updatedWhatForSection === void 0 ? void 0 : updatedWhatForSection.isInvoiceDateAutoUpdated) !== null && _f !== void 0 ? _f : false,
|
|
422
427
|
};
|
|
423
428
|
}
|
|
424
429
|
exports.getWhatForSection = getWhatForSection;
|
|
@@ -552,6 +557,26 @@ const getRecurringBillLocalData = (recurringBillState, transaction) => {
|
|
|
552
557
|
return { recurringConfigLocalData, recurringBillInstancesLocalData };
|
|
553
558
|
};
|
|
554
559
|
exports.getRecurringBillLocalData = getRecurringBillLocalData;
|
|
560
|
+
const getInvoiceDate = (invoiceDate, bookCloseDate) => {
|
|
561
|
+
if (bookCloseDate != null && invoiceDate.isBefore(bookCloseDate)) {
|
|
562
|
+
return (0, zeniDayJS_1.dateNow)().startOf('month');
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
return invoiceDate;
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
exports.getInvoiceDate = getInvoiceDate;
|
|
569
|
+
const getDueDate = (dueDate, invoiceDate, bookCloseDate) => {
|
|
570
|
+
if (bookCloseDate != null &&
|
|
571
|
+
invoiceDate != null &&
|
|
572
|
+
invoiceDate.isBefore(bookCloseDate)) {
|
|
573
|
+
return (0, zeniDayJS_1.dateNow)().startOf('month');
|
|
574
|
+
}
|
|
575
|
+
else {
|
|
576
|
+
return dueDate;
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
exports.getDueDate = getDueDate;
|
|
555
580
|
const getWithdrawFrom = (paymentAccountState, depositAccountState, fromAccountId, fromAccountType) => {
|
|
556
581
|
const withdrawFromAsDepositAcc = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, fromAccountId);
|
|
557
582
|
const withdrawFromAsPaymentAcc = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, fromAccountId);
|
|
@@ -45,6 +45,7 @@ export interface RecurringBillInstance {
|
|
|
45
45
|
billPaymentStatus?: RecurringBillPaymentStatus;
|
|
46
46
|
}
|
|
47
47
|
export interface BillDetailLocalData {
|
|
48
|
+
showVendorGptRecommendationText: boolean;
|
|
48
49
|
vendor?: Vendor;
|
|
49
50
|
candidateVendorname?: string;
|
|
50
51
|
whatForSection?: WhatForSection;
|
|
@@ -69,6 +70,7 @@ export interface WhatForSection {
|
|
|
69
70
|
billDueDate?: ZeniDate;
|
|
70
71
|
memo?: string;
|
|
71
72
|
currencyCode?: string;
|
|
73
|
+
isInvoiceDateAutoUpdated?: boolean;
|
|
72
74
|
}
|
|
73
75
|
export interface PaymentDetailsSection {
|
|
74
76
|
internationalTransferFeeBearerPaymentMethod?: InternationalTransferFeeBearerPaymentMethod;
|
|
@@ -16,12 +16,14 @@ exports.initialBillDetail = {
|
|
|
16
16
|
error: undefined,
|
|
17
17
|
},
|
|
18
18
|
billDetailLocalData: {
|
|
19
|
+
showVendorGptRecommendationText: false,
|
|
19
20
|
vendor: undefined,
|
|
20
21
|
whatForSection: {
|
|
21
22
|
invoiceNumber: '',
|
|
22
23
|
invoiceDate: undefined,
|
|
23
24
|
billDueDate: undefined,
|
|
24
25
|
memo: '',
|
|
26
|
+
isInvoiceDateAutoUpdated: false,
|
|
25
27
|
},
|
|
26
28
|
updatesByLineId: {},
|
|
27
29
|
paymentDetailsSection: {
|
package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js
CHANGED
|
@@ -128,23 +128,29 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
+
const { tenantState, companyState } = state;
|
|
132
|
+
const { currentTenantId } = tenantState;
|
|
133
|
+
const companyId = currentTenantId != null
|
|
134
|
+
? (_f = (_e = tenantState.tenantsById) === null || _e === void 0 ? void 0 : _e[currentTenantId]) === null || _f === void 0 ? void 0 : _f.companyId
|
|
135
|
+
: undefined;
|
|
136
|
+
const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
|
|
137
|
+
const bookCloseDate = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyInfo.bookCloseDate;
|
|
131
138
|
const whatForSection = {
|
|
132
139
|
invoiceNumber: transaction.documentId,
|
|
133
|
-
|
|
134
|
-
|
|
140
|
+
billDueDate: transaction.dueDate != null && transaction.date != null
|
|
141
|
+
? (0, editBillViewSelector_1.getDueDate)(transaction.dueDate, transaction.date, bookCloseDate)
|
|
142
|
+
: transaction.dueDate,
|
|
143
|
+
invoiceDate: (0, editBillViewSelector_1.getInvoiceDate)(transaction.date, bookCloseDate),
|
|
135
144
|
memo: transaction.memo,
|
|
136
145
|
currencyCode: transaction.amount.currencyCode,
|
|
146
|
+
isInvoiceDateAutoUpdated: transaction.date != null
|
|
147
|
+
? transaction.date.isBefore(bookCloseDate)
|
|
148
|
+
: false,
|
|
137
149
|
};
|
|
138
150
|
const updatesByLineId = {};
|
|
139
|
-
(
|
|
151
|
+
(_g = transaction.lines) === null || _g === void 0 ? void 0 : _g.forEach((line) => {
|
|
140
152
|
updatesByLineId[line.id] = Object.assign(Object.assign({}, line), (0, exports.getLineRecommendationsLocalData)(line.id, line, recommendations, accountList, classList, vendor));
|
|
141
153
|
});
|
|
142
|
-
const { tenantState, companyState } = state;
|
|
143
|
-
const { currentTenantId } = tenantState;
|
|
144
|
-
const companyId = currentTenantId != null
|
|
145
|
-
? (_g = (_f = tenantState.tenantsById) === null || _f === void 0 ? void 0 : _f[currentTenantId]) === null || _g === void 0 ? void 0 : _g.companyId
|
|
146
|
-
: undefined;
|
|
147
|
-
const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
|
|
148
154
|
const payNowCutOffTime = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyBillPayInfo.payNowCutOffTimeByMethod.ach;
|
|
149
155
|
const isPayNowEnabled = payNowCutOffTime != null
|
|
150
156
|
? (0, zeniDayJS_1.dateNow)().isSameOrBefore(payNowCutOffTime)
|
|
@@ -174,6 +180,7 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
|
|
|
174
180
|
recurringBillInstances = recurringBillInstancesLocalData;
|
|
175
181
|
}
|
|
176
182
|
const billDetailLocalData = {
|
|
183
|
+
showVendorGptRecommendationText: false,
|
|
177
184
|
vendor,
|
|
178
185
|
whatForSection,
|
|
179
186
|
updatesByLineId,
|
|
@@ -10,5 +10,5 @@ import { fetchPreviousBills } from '../../previousBills/previousBillsReducer';
|
|
|
10
10
|
import { fetchDuplicateBill } from '../../billPayReview/billPayReviewReducer';
|
|
11
11
|
export declare type ActionType = ReturnType<typeof parseInvoiceToBill> | ReturnType<typeof saveBillUpdatesToLocalStore> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchPreviousBills> | ReturnType<typeof fetchDuplicateBill> | ReturnType<typeof updateShowAutofill> | ReturnType<typeof updateAddBillAutoFields> | ReturnType<typeof updateBillUploadFetchState>;
|
|
12
12
|
export declare const parseInvoiceToBillEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
13
|
-
export declare const toBillDetailLocalData: (state: RootState, billPayload: Partial<BillTransactionPayload>, vendor: Vendor | undefined, recommendedVendorId?: string | undefined) => BillDetailLocalData;
|
|
13
|
+
export declare const toBillDetailLocalData: (state: RootState, showVendorGptRecommendationText: boolean, billPayload: Partial<BillTransactionPayload>, vendor: Vendor | undefined, recommendedVendorId?: string | undefined) => BillDetailLocalData;
|
|
14
14
|
export declare const getAutoFieldsData: (finalBill: BillDetailLocalData, isVendorWithNewCurrency: boolean, tentativeVendorName?: string | undefined, currencyInInvoice?: string | undefined, vendorCurrency?: string | undefined) => AddBillAutoFields;
|
|
@@ -54,6 +54,7 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
54
54
|
let vendorCurrency = '';
|
|
55
55
|
const vendors = (0, vendorListSelector_1.getVendorList)(state).vendors;
|
|
56
56
|
let recommendedVendorId;
|
|
57
|
+
let showVendorGptRecommendationText = false;
|
|
57
58
|
let suggestedVendor;
|
|
58
59
|
if (vendorNameFromInvoice != null && vendorNameFromInvoice.length > 0) {
|
|
59
60
|
finalVendor = vendors.filter((vendor) => vendor.name.toLowerCase() === vendorNameFromInvoice.toLowerCase())[0];
|
|
@@ -71,6 +72,7 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
71
72
|
if (matchScore > 85) {
|
|
72
73
|
if (vendorCurrency === currencyInInvoice) {
|
|
73
74
|
finalVendor = suggestedVendor;
|
|
75
|
+
showVendorGptRecommendationText = true;
|
|
74
76
|
}
|
|
75
77
|
else {
|
|
76
78
|
isVendorWithNewCurrency = true;
|
|
@@ -81,6 +83,7 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
81
83
|
vendorNameFromInvoice.toLowerCase()) {
|
|
82
84
|
if (vendorCurrency === currencyInInvoice) {
|
|
83
85
|
finalVendor = suggestedVendor;
|
|
86
|
+
showVendorGptRecommendationText = true;
|
|
84
87
|
}
|
|
85
88
|
else {
|
|
86
89
|
isVendorWithNewCurrency = true;
|
|
@@ -89,12 +92,13 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
89
92
|
else {
|
|
90
93
|
recommendedVendorId = suggestedVendor === null || suggestedVendor === void 0 ? void 0 : suggestedVendor.id;
|
|
91
94
|
finalVendor = suggestedVendor;
|
|
95
|
+
showVendorGptRecommendationText = true;
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
100
|
const file = (0, attachmentPayload_1.mapFiletoAttachment)(invoiceProcessingPayload.files[0]);
|
|
97
|
-
const finalBill = Object.assign(Object.assign({}, (0, exports.toBillDetailLocalData)(state, invoiceProcessingPayload.bills[0], finalVendor, recommendedVendorId)), { file: file });
|
|
101
|
+
const finalBill = Object.assign(Object.assign({}, (0, exports.toBillDetailLocalData)(state, showVendorGptRecommendationText, invoiceProcessingPayload.bills[0], finalVendor, recommendedVendorId)), { file: file });
|
|
98
102
|
const addBillAutoFields = (0, exports.getAutoFieldsData)(finalBill, isVendorWithNewCurrency, vendorNameFromInvoice, currencyInInvoice, vendorCurrency);
|
|
99
103
|
if (finalVendor != null) {
|
|
100
104
|
return (0, rxjs_1.of)((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({ billDetailLocalData: finalBill }), (0, previousBillsReducer_1.fetchPreviousBills)(finalVendor.qboId, false), (0, billPayReviewReducer_1.fetchDuplicateBill)(finalVendor.name, finalVendor.id, (_e = (_d = finalBill.totalAmount) === null || _d === void 0 ? void 0 : _d.amount) !== null && _e !== void 0 ? _e : 0, (_f = finalBill.whatForSection) === null || _f === void 0 ? void 0 : _f.invoiceNumber), (0, editBillViewReducer_1.updateShowAutofill)(false), (0, editBillViewReducer_1.updateAddBillAutoFields)(addBillAutoFields), (0, editBillViewReducer_1.updateBillUploadFetchState)({
|
|
@@ -120,7 +124,7 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
120
124
|
}
|
|
121
125
|
}));
|
|
122
126
|
exports.parseInvoiceToBillEpic = parseInvoiceToBillEpic;
|
|
123
|
-
const toBillDetailLocalData = (state, billPayload, vendor, recommendedVendorId) => {
|
|
127
|
+
const toBillDetailLocalData = (state, showVendorGptRecommendationText, billPayload, vendor, recommendedVendorId) => {
|
|
124
128
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
125
129
|
const currency = {
|
|
126
130
|
currencyCode: (_a = billPayload.currency_code) !== null && _a !== void 0 ? _a : '',
|
|
@@ -184,20 +188,28 @@ const toBillDetailLocalData = (state, billPayload, vendor, recommendedVendorId)
|
|
|
184
188
|
? (0, zeniDayJS_1.dateNow)().isSameOrBefore(payNowCutOffTime)
|
|
185
189
|
: false;
|
|
186
190
|
const fromAccountType = (0, billPayConfigPayload_1.getAccountTypeSubConfigCodeKey)((0, billPayConfigState_1.toAccType)((_m = (_l = billPayload.bill_pay_info) === null || _l === void 0 ? void 0 : _l.from_account.account_type) !== null && _m !== void 0 ? _m : ''));
|
|
191
|
+
const bookCloseDate = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyInfo.bookCloseDate;
|
|
192
|
+
const invoiceDate = Boolean(billPayload.transaction_date) === true
|
|
193
|
+
? (0, editBillViewSelector_1.getInvoiceDate)((0, zeniDayJS_1.date)(billPayload.transaction_date), bookCloseDate)
|
|
194
|
+
: undefined;
|
|
195
|
+
const dueDate = Boolean(billPayload.due_date) === true
|
|
196
|
+
? Boolean(billPayload.transaction_date) === true
|
|
197
|
+
? (0, editBillViewSelector_1.getDueDate)((0, zeniDayJS_1.date)(billPayload.due_date), (0, zeniDayJS_1.date)(billPayload.transaction_date), bookCloseDate)
|
|
198
|
+
: (0, zeniDayJS_1.date)(billPayload.due_date)
|
|
199
|
+
: undefined;
|
|
187
200
|
return {
|
|
188
201
|
recommendedVendorId,
|
|
202
|
+
showVendorGptRecommendationText,
|
|
189
203
|
lastRecommendedVendorName: recommendedVendorId != null ? vendor === null || vendor === void 0 ? void 0 : vendor.name : undefined,
|
|
190
204
|
vendor: vendor,
|
|
191
205
|
whatForSection: {
|
|
192
206
|
invoiceNumber: billPayload.invoice_number,
|
|
193
|
-
billDueDate:
|
|
194
|
-
? (0, zeniDayJS_1.date)(billPayload.due_date)
|
|
195
|
-
: undefined,
|
|
207
|
+
billDueDate: dueDate,
|
|
196
208
|
memo: billPayload.transaction_memo,
|
|
197
|
-
invoiceDate:
|
|
198
|
-
|
|
199
|
-
? (0, zeniDayJS_1.date)(billPayload.transaction_date)
|
|
200
|
-
:
|
|
209
|
+
invoiceDate: invoiceDate,
|
|
210
|
+
isInvoiceDateAutoUpdated: Boolean(billPayload.transaction_date) === true
|
|
211
|
+
? (0, zeniDayJS_1.date)(billPayload.transaction_date).isBefore(bookCloseDate)
|
|
212
|
+
: false,
|
|
201
213
|
currencyCode: billPayload.currency_code,
|
|
202
214
|
},
|
|
203
215
|
updatesByLineId: linesById,
|
|
@@ -5,7 +5,7 @@ import { UserRolePayload } from '../../../../entity/userRole/userRolePayload';
|
|
|
5
5
|
import { ZeniAPIResponse } from '../../../../responsePayload';
|
|
6
6
|
export interface ChargeCardListPayload {
|
|
7
7
|
cards: ChargeCardPayload[];
|
|
8
|
-
unassigned_credit
|
|
8
|
+
unassigned_credit?: AmountPayload;
|
|
9
9
|
users: UserPayload[];
|
|
10
10
|
user_roles: UserRolePayload[];
|
|
11
11
|
}
|
|
@@ -3,7 +3,8 @@ import { ChargeCardListPayload, CreditAccountPayload } from './chargeCardListPay
|
|
|
3
3
|
import { ChargeCardListState, ChargeCardListUIState, ChargeCardLocalData, CreditAccount } from './chargeCardList';
|
|
4
4
|
import { FetchState } from '../../../../commonStateTypes/common';
|
|
5
5
|
export declare const initialState: ChargeCardListState;
|
|
6
|
-
export declare const fetchChargeCardListPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any], {
|
|
6
|
+
export declare const fetchChargeCardListPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[doFetchCreditAccounts: boolean, cacheOverride?: any], {
|
|
7
|
+
doFetchCreditAccounts: boolean;
|
|
7
8
|
cacheOverride: any;
|
|
8
9
|
}, string, never, never>, fetchCreditAccount: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateCreditAccount: import("@reduxjs/toolkit").ActionCreatorWithPayload<CreditAccountPayload[], string>, updateCreditAccountFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchChargeCardList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateChargeCardList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
9
10
|
chargeCardListPayload: ChargeCardListPayload;
|
|
@@ -29,9 +29,9 @@ const chargeCardList = (0, toolkit_1.createSlice)({
|
|
|
29
29
|
reducer() {
|
|
30
30
|
//do nothing
|
|
31
31
|
},
|
|
32
|
-
prepare(cacheOverride = false) {
|
|
32
|
+
prepare(doFetchCreditAccounts, cacheOverride = false) {
|
|
33
33
|
return {
|
|
34
|
-
payload: { cacheOverride },
|
|
34
|
+
payload: { doFetchCreditAccounts, cacheOverride },
|
|
35
35
|
};
|
|
36
36
|
},
|
|
37
37
|
},
|
|
@@ -58,7 +58,10 @@ const chargeCardList = (0, toolkit_1.createSlice)({
|
|
|
58
58
|
action.payload.keepExistingListItems === true
|
|
59
59
|
? [...new Set([...draft.cardIds, ...newCard])]
|
|
60
60
|
: newCard;
|
|
61
|
-
draft.unAssignedCredits =
|
|
61
|
+
draft.unAssignedCredits =
|
|
62
|
+
unassigned_credit != null
|
|
63
|
+
? (0, amount_1.toAmount)(unassigned_credit.amount, unassigned_credit.currency_code, unassigned_credit.currency_symbol)
|
|
64
|
+
: undefined;
|
|
62
65
|
draft.fetchState = 'Completed';
|
|
63
66
|
draft.error = undefined;
|
|
64
67
|
},
|
|
@@ -28,4 +28,4 @@ export interface ChargeCardListSelectorView extends SelectorView {
|
|
|
28
28
|
searchText: string;
|
|
29
29
|
unAssignedCredits?: Amount;
|
|
30
30
|
}
|
|
31
|
-
export declare const getChargeCardListView: (state: RootState) => ChargeCardListSelectorView;
|
|
31
|
+
export declare const getChargeCardListView: (state: RootState, includeCreditAccount: boolean) => ChargeCardListSelectorView;
|
|
@@ -13,7 +13,7 @@ const classSelector_1 = require("../../../../entity/class/classSelector");
|
|
|
13
13
|
const userSelector_1 = require("../../../../entity/user/userSelector");
|
|
14
14
|
const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
|
|
15
15
|
const userListViewSelector_1 = require("../../../userListView/userListViewSelector");
|
|
16
|
-
const getChargeCardListView = (state) => {
|
|
16
|
+
const getChargeCardListView = (state, includeCreditAccount) => {
|
|
17
17
|
const { addressState, chargeCardListState, chargeCardState, classState, userState, userRoleState, chargeCardConfigState, classListState, } = state;
|
|
18
18
|
const searchText = chargeCardListState.searchText
|
|
19
19
|
.trim()
|
|
@@ -56,11 +56,14 @@ const getChargeCardListView = (state) => {
|
|
|
56
56
|
}, sortOrder);
|
|
57
57
|
const userListSelectorView = (0, userListViewSelector_1.getUserList)(state, 'cardHolderCandidate');
|
|
58
58
|
const userList = userListSelectorView.users;
|
|
59
|
-
const fetchState =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
const fetchState = includeCreditAccount === true
|
|
60
|
+
? (0, reduceFetchState_1.reduceFetchState)([
|
|
61
|
+
chargeCardListState,
|
|
62
|
+
chargeCardListState.creditAccount,
|
|
63
|
+
chargeCardConfigState,
|
|
64
|
+
]).fetchState
|
|
65
|
+
: (0, reduceFetchState_1.reduceFetchState)([chargeCardListState, chargeCardConfigState])
|
|
66
|
+
.fetchState;
|
|
64
67
|
const issueCardPageFetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
65
68
|
chargeCardConfigState,
|
|
66
69
|
userListSelectorView,
|
|
@@ -8,11 +8,13 @@ const chargeCardListReducer_1 = require("./chargeCardListReducer");
|
|
|
8
8
|
const userListViewReducer_1 = require("../../../userListView/userListViewReducer");
|
|
9
9
|
const classListReducer_1 = require("../../../classList/classListReducer");
|
|
10
10
|
const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.fetchChargeCardListPage.match), (0, operators_1.mergeMap)((action) => {
|
|
11
|
-
const { cacheOverride } = action.payload;
|
|
11
|
+
const { doFetchCreditAccounts, cacheOverride } = action.payload;
|
|
12
12
|
const chargeCardListPageAction = [];
|
|
13
13
|
const state = state$.value;
|
|
14
14
|
if (cacheOverride === true) {
|
|
15
|
-
|
|
15
|
+
if (doFetchCreditAccounts === true) {
|
|
16
|
+
chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
|
|
17
|
+
}
|
|
16
18
|
chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
|
|
17
19
|
chargeCardListPageAction.push((0, chargeCardConfigReducer_1.fetchChargeCardConfig)());
|
|
18
20
|
chargeCardListPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardHolderCandidate', true));
|
|
@@ -20,7 +22,8 @@ const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
20
22
|
}
|
|
21
23
|
else {
|
|
22
24
|
const chargeCardList = state.chargeCardListState;
|
|
23
|
-
if (
|
|
25
|
+
if (doFetchCreditAccounts === true &&
|
|
26
|
+
chargeCardList.creditAccount.fetchState !== 'Completed' &&
|
|
24
27
|
chargeCardList.creditAccount.fetchState !== 'In-Progress') {
|
|
25
28
|
chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
|
|
26
29
|
}
|
|
@@ -128,7 +128,9 @@ const getTotalPayments = (startDate, endDate, frequency, currentInstance) => {
|
|
|
128
128
|
switch (frequency) {
|
|
129
129
|
case 'weekly':
|
|
130
130
|
case 'biweekly':
|
|
131
|
-
totalPayments =
|
|
131
|
+
totalPayments =
|
|
132
|
+
endDate.diff(currentStartDate, 'day') /
|
|
133
|
+
getRecurringFrequencyInDays(frequency);
|
|
132
134
|
break;
|
|
133
135
|
case 'monthly':
|
|
134
136
|
totalPayments = endDate.diff(currentStartDate, 'month');
|
|
@@ -168,9 +170,15 @@ function getRecurringBillInstances(startDate, frequency, totalPayments, currentI
|
|
|
168
170
|
const getRecurringFrequencyWithOffset = (frequency) => {
|
|
169
171
|
switch (frequency) {
|
|
170
172
|
case 'weekly':
|
|
171
|
-
return {
|
|
173
|
+
return {
|
|
174
|
+
offSetValue: getRecurringFrequencyInDays(frequency),
|
|
175
|
+
offSetUnit: 'day',
|
|
176
|
+
};
|
|
172
177
|
case 'biweekly':
|
|
173
|
-
return {
|
|
178
|
+
return {
|
|
179
|
+
offSetValue: getRecurringFrequencyInDays(frequency),
|
|
180
|
+
offSetUnit: 'day',
|
|
181
|
+
};
|
|
174
182
|
case 'monthly':
|
|
175
183
|
return { offSetValue: 1, offSetUnit: 'month' };
|
|
176
184
|
case 'quarterly':
|
|
@@ -181,7 +189,6 @@ function getRecurringBillInstances(startDate, frequency, totalPayments, currentI
|
|
|
181
189
|
for (let i = 0; i < totalPayments; i++) {
|
|
182
190
|
updatedInstances.push(Object.assign({ instance: currentInstance + i, isDeleted: false, amount: billAmount }, checkIfHolidayAndGetNextDate(startDate.add(i * offSetValue, offSetUnit))));
|
|
183
191
|
}
|
|
184
|
-
;
|
|
185
192
|
return updatedInstances;
|
|
186
193
|
}
|
|
187
194
|
function getRecurringFrequencyInDays(frequency) {
|
|
@@ -16,11 +16,15 @@ const saveTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
16
16
|
? zeniAPI.putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}`, payload)
|
|
17
17
|
: zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload);
|
|
18
18
|
return saveTaskApi.pipe((0, operators_1.mergeMap)((response) => {
|
|
19
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) &&
|
|
19
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) &&
|
|
20
|
+
response.data != null &&
|
|
21
|
+
response.data.tasks.length > 0) {
|
|
22
|
+
const newTaskId = response.data.tasks[0].task_id;
|
|
20
23
|
const fetchActions = [
|
|
21
24
|
(0, taskReducer_1.updateTasks)(response.data.tasks),
|
|
22
25
|
(0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
|
|
23
26
|
fetchState: 'Completed',
|
|
27
|
+
newTaskId,
|
|
24
28
|
taskId,
|
|
25
29
|
}),
|
|
26
30
|
];
|
|
@@ -25,6 +25,7 @@ export declare const fetchTaskDetailPage: import("@reduxjs/toolkit").ActionCreat
|
|
|
25
25
|
taskId: string | undefined;
|
|
26
26
|
}, string, never, never>, saveTaskSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
27
27
|
fetchState: FetchState;
|
|
28
|
+
newTaskId?: string | undefined;
|
|
28
29
|
taskId?: string | undefined;
|
|
29
30
|
error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
30
31
|
}, string>, deleteTask: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[taskId?: string | undefined], {
|