@zeniai/client-epic-state 4.12.14 → 4.12.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigPayload.d.ts +4 -0
- package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigReducer.js +9 -0
- package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.d.ts +4 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +10 -4
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +82 -29
- package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +2 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +1 -1
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewReducer.js +4 -2
- package/lib/view/taskManager/taskListView/taskListReducer.js +6 -6
- package/package.json +1 -1
|
@@ -21,6 +21,10 @@ export interface BillPayConfigPayload {
|
|
|
21
21
|
supported_countries: CountryPayload[];
|
|
22
22
|
local_currency_supported_countries: CountryPayload[];
|
|
23
23
|
};
|
|
24
|
+
last_selected_from_account: {
|
|
25
|
+
account_id: string | null;
|
|
26
|
+
account_type: string | null;
|
|
27
|
+
};
|
|
24
28
|
}
|
|
25
29
|
interface SupportedCurrencyPayload {
|
|
26
30
|
ach: Record<PaymentAchSubConfigCodeType, CurrencyPayload[]>;
|
|
@@ -20,6 +20,7 @@ exports.initialState = {
|
|
|
20
20
|
return this.fetchState == 'Completed';
|
|
21
21
|
},
|
|
22
22
|
billBulkSubmissionLimit: 10,
|
|
23
|
+
lastSelectedFromAccount: undefined,
|
|
23
24
|
};
|
|
24
25
|
const billPayConfig = (0, toolkit_1.createSlice)({
|
|
25
26
|
name: 'billPayConfig',
|
|
@@ -98,6 +99,14 @@ const billPayConfig = (0, toolkit_1.createSlice)({
|
|
|
98
99
|
draft.vendor.currencyListByCountryId[countryCode] =
|
|
99
100
|
currencyPayload.currencies.map((currency) => (0, billPayConfigPayload_1.toVendorCurrency)(currency));
|
|
100
101
|
});
|
|
102
|
+
draft.lastSelectedFromAccount =
|
|
103
|
+
payload.last_selected_from_account.account_id != null &&
|
|
104
|
+
payload.last_selected_from_account.account_type != null
|
|
105
|
+
? {
|
|
106
|
+
accountId: payload.last_selected_from_account.account_id,
|
|
107
|
+
accountType: (0, billPayConfigPayload_1.getAccountTypeSubConfigCodeKey)((0, billPayConfigState_1.toAccType)(payload.last_selected_from_account.account_type)),
|
|
108
|
+
}
|
|
109
|
+
: undefined;
|
|
101
110
|
},
|
|
102
111
|
updateBillPayConfigFailure(draft, action) {
|
|
103
112
|
draft.fetchState = 'Error';
|
|
@@ -18,6 +18,10 @@ export interface BillPayConfigState extends FetchedState {
|
|
|
18
18
|
};
|
|
19
19
|
billPayBotEmail: string;
|
|
20
20
|
billBulkSubmissionLimit: number;
|
|
21
|
+
lastSelectedFromAccount?: {
|
|
22
|
+
accountId: ID;
|
|
23
|
+
accountType: AccountTypeSubConfigCodeKeyType;
|
|
24
|
+
};
|
|
21
25
|
}
|
|
22
26
|
export interface VendorCurrency extends Currency {
|
|
23
27
|
currencyName: string;
|
|
@@ -3,7 +3,6 @@ import { RootState } from '../../../../reducer';
|
|
|
3
3
|
import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
4
|
import { Amount } from '../../../../commonStateTypes/amount';
|
|
5
5
|
import { BillPayInfo, BillPaymentMethod, BillStageCodeType, BillTransaction, InternationalTransferFeeBearerPaymentMethod } from '../../../../entity/billPay/billTransaction/billTransactionState';
|
|
6
|
-
import { PaymentAccountState } from '../../../../entity/paymentAccount/paymentAccountState';
|
|
7
6
|
import { Attachment } from '../../../../entity/transaction/stateTypes/attachment';
|
|
8
7
|
import { TransactionWithAccountAndClassLine } from '../../../../entity/transaction/stateTypes/transactionLine';
|
|
9
8
|
import { Vendor } from '../../../../entity/vendor/vendorState';
|
|
@@ -26,7 +25,6 @@ import { VendorDetailLocalData } from '../../../commonVendorView/vendorView/vend
|
|
|
26
25
|
import { AccountBase, RecommendedAccountBase } from '../../../../entity/account/accountState';
|
|
27
26
|
import { ClassBase, RecommendedClassBase } from '../../../../entity/class/classState';
|
|
28
27
|
import { RecurringBillState } from '../../../../entity/billPay/recurringBills/recurringBillsState';
|
|
29
|
-
import { DepositAccountState } from '../../../../entity/depositAccount/depositAccount';
|
|
30
28
|
import { FundingAccount } from '../../commonSetup/setupViewSelector';
|
|
31
29
|
export declare type PaymentToOption = {
|
|
32
30
|
id: ID;
|
|
@@ -121,7 +119,7 @@ export declare const getEditBillDetail: (state: RootState, isVendorRecommendatio
|
|
|
121
119
|
export declare const getBillPayConfigList: (billPayConfigState: BillPayConfigState) => BillPayConfig[];
|
|
122
120
|
export declare const getPaymentMethodType: (billPayConfigState: BillPayConfigState, accType: AccountTypeSubConfigCodeKeyType, paymentMethod?: BillPaymentMethod | undefined, internationalTransferFeeBearerPaymentMethod?: "swift_our" | "swift_sha" | undefined) => BillPayConfig | undefined;
|
|
123
121
|
export declare function getWhatForSection(updatedWhatForSection: WhatForSection | undefined): WhatForSection;
|
|
124
|
-
export declare function getPaymentSection(state: RootState, withdrawFromList: FundingAccount[], updatedPaymentSection: PaymentDetailsSection): PaymentDetailsSectionView;
|
|
122
|
+
export declare function getPaymentSection(state: RootState, withdrawFromList: FundingAccount[], updatedPaymentSection: PaymentDetailsSection, companyId?: string, billPayInfo?: BillPayInfo): PaymentDetailsSectionView;
|
|
125
123
|
export declare function toPaymentToOption(paymentMode: PaymentMode): PaymentToOption;
|
|
126
124
|
export interface PaymentDetailsSectionView {
|
|
127
125
|
paymentType?: BillPayConfig;
|
|
@@ -131,6 +129,7 @@ export interface PaymentDetailsSectionView {
|
|
|
131
129
|
paymentTo?: PaymentToOption;
|
|
132
130
|
internationalTransferFeeBearerPaymentMethod?: InternationalTransferFeeBearerPaymentMethod;
|
|
133
131
|
conversionRate?: number;
|
|
132
|
+
defaultSelectedAccount?: FundingAccount;
|
|
134
133
|
}
|
|
135
134
|
export declare const getRecurringBillLocalData: (recurringBillState: RecurringBillState, transaction: BillTransaction) => {
|
|
136
135
|
recurringBillInstancesLocalData: RecurringBillInstance[];
|
|
@@ -138,4 +137,11 @@ export declare const getRecurringBillLocalData: (recurringBillState: RecurringBi
|
|
|
138
137
|
};
|
|
139
138
|
export declare const getInvoiceDate: (billStageCode: BillStageCodeType, invoiceDate: ZeniDate, bookCloseDate?: import("dayjs").Dayjs | undefined) => import("dayjs").Dayjs;
|
|
140
139
|
export declare const getDueDate: (billStageCode: BillStageCodeType, dueDate: ZeniDate, invoiceDate?: import("dayjs").Dayjs | undefined, bookCloseDate?: import("dayjs").Dayjs | undefined) => import("dayjs").Dayjs;
|
|
141
|
-
export declare const getWithdrawFrom: (
|
|
140
|
+
export declare const getWithdrawFrom: (state: RootState, fromAccountId?: string | undefined, fromAccountType?: string | undefined, companyId?: string | undefined, lastSelectedFromAccount?: {
|
|
141
|
+
accountId: ID;
|
|
142
|
+
accountType: AccountTypeSubConfigCodeKeyType;
|
|
143
|
+
} | undefined) => FundingAccount | undefined;
|
|
144
|
+
export declare const getDefaultWithdrawFromAccount: (state: RootState, depositAccounts: ID[], companyId: ID, lastSelectedFromAccount?: {
|
|
145
|
+
accountId: ID;
|
|
146
|
+
accountType: AccountTypeSubConfigCodeKeyType;
|
|
147
|
+
} | undefined) => FundingAccount | undefined;
|
|
@@ -3,7 +3,7 @@ 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.getDueDate = exports.getInvoiceDate = exports.getRecurringBillLocalData = exports.toPaymentToOption = exports.getPaymentSection = exports.getWhatForSection = exports.getPaymentMethodType = exports.getBillPayConfigList = exports.getEditBillDetail = void 0;
|
|
6
|
+
exports.getDefaultWithdrawFromAccount = exports.getWithdrawFrom = exports.getDueDate = exports.getInvoiceDate = exports.getRecurringBillLocalData = exports.toPaymentToOption = 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");
|
|
@@ -30,8 +30,9 @@ const billPayConfigPayload_1 = require("../billPayConfig/billPayConfigPayload");
|
|
|
30
30
|
const depositAccountListSelector_1 = require("../../zeniAccounts/depositAccountList/depositAccountListSelector");
|
|
31
31
|
const depositAccountSelector_1 = require("../../../../entity/depositAccount/depositAccountSelector");
|
|
32
32
|
const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
|
|
33
|
+
const getCompanyView_1 = require("../../../companyView/selectorHelpers/getCompanyView");
|
|
33
34
|
const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAccountsEnabled, billId) => {
|
|
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
|
|
35
|
+
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;
|
|
35
36
|
const { accountListState, accountState, bankAccountState, billDetailViewState, paymentAccountListState, billTransactionState, billPayConfigState, classListState, classState, editBillDetailViewState, paymentAccountState, vendorState, tenantState, companyState, userState, commonHistoryState, contactState, paymentInstrumentState, recurringBillState, depositAccountListState, depositAccountState, } = state;
|
|
36
37
|
const transaction = (0, get_1.default)(billTransactionState.transactionById, billId !== null && billId !== void 0 ? billId : '', undefined);
|
|
37
38
|
let recommendations = {};
|
|
@@ -112,7 +113,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
112
113
|
let editBillInitialDetails = {
|
|
113
114
|
lineDetailSection: {},
|
|
114
115
|
whatForSection: getWhatForSection(undefined),
|
|
115
|
-
paymentDetailsSection: getPaymentSection(state, withdrawFromList, {}),
|
|
116
|
+
paymentDetailsSection: getPaymentSection(state, withdrawFromList, {}, companyId, transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo),
|
|
116
117
|
totalAmount: sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData.totalAmount,
|
|
117
118
|
recipientTotalAmount: sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData.recipientTotalAmount,
|
|
118
119
|
};
|
|
@@ -154,14 +155,14 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
154
155
|
const initialPaymentDetailsSection = {
|
|
155
156
|
paymentType: (0, exports.getPaymentMethodType)(billPayConfigState, (_q = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountType) !== null && _q !== void 0 ? _q : 'depositAccount', billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.billPaymentMethodType, billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.internationalTransferFeeBearerPaymentMethod),
|
|
156
157
|
paymentDate: billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.paymentDate,
|
|
157
|
-
withdrawFrom: (0, exports.getWithdrawFrom)(
|
|
158
|
-
paymentTo: ((
|
|
158
|
+
withdrawFrom: (0, exports.getWithdrawFrom)(state, billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountId, billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountType, companyId !== null && companyId !== void 0 ? companyId : '', billPayConfigState.lastSelectedFromAccount),
|
|
159
|
+
paymentTo: ((_r = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.toAccount.billAccountId) === null || _r === void 0 ? void 0 : _r.length) != null &&
|
|
159
160
|
(billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.toAccount.billAccountId.length) > 0
|
|
160
161
|
? billPayInfo.toAccount.billAccountId
|
|
161
162
|
: undefined,
|
|
162
163
|
internationalTransferFeeBearerPaymentMethod: billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.internationalTransferFeeBearerPaymentMethod,
|
|
163
164
|
};
|
|
164
|
-
const initialPaymentDetailsSectionView = getPaymentSection(state, withdrawFromList, initialPaymentDetailsSection);
|
|
165
|
+
const initialPaymentDetailsSectionView = getPaymentSection(state, withdrawFromList, initialPaymentDetailsSection, companyId, billPayInfo);
|
|
165
166
|
editBillInitialDetails = {
|
|
166
167
|
vendor: initialVendor,
|
|
167
168
|
whatForSection: initialWhatForSection,
|
|
@@ -173,7 +174,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
173
174
|
if (sourceBillDetail != null) {
|
|
174
175
|
const billViewState = billDetailViewState.billDetailById[key];
|
|
175
176
|
isCancelled = sourceBillDetail.billDetailLocalData.isCancelled;
|
|
176
|
-
billStage = (
|
|
177
|
+
billStage = (_s = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.stage.code) !== null && _s !== void 0 ? _s : 'draft';
|
|
177
178
|
if (billViewState != null) {
|
|
178
179
|
fetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
179
180
|
sourceBillDetail.fetchStatus,
|
|
@@ -185,7 +186,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
//recurringBill Details
|
|
188
|
-
isRecurring = (
|
|
189
|
+
isRecurring = (_t = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _t !== void 0 ? _t : false;
|
|
189
190
|
if (isRecurring && transaction != null) {
|
|
190
191
|
const { recurringConfigLocalData, recurringBillInstancesLocalData } = (0, exports.getRecurringBillLocalData)(recurringBillState, transaction);
|
|
191
192
|
recurringConfig = recurringConfigLocalData;
|
|
@@ -208,16 +209,16 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
208
209
|
lastRecommendedVendorName = updatedRecord.lastRecommendedVendorName;
|
|
209
210
|
paymentDetailsSection =
|
|
210
211
|
updatedRecord.paymentDetailsSection != null
|
|
211
|
-
? getPaymentSection(state, withdrawFromList, updatedRecord.paymentDetailsSection)
|
|
212
|
+
? getPaymentSection(state, withdrawFromList, updatedRecord.paymentDetailsSection, companyId, billPayInfo)
|
|
212
213
|
: undefined;
|
|
213
214
|
vendorDetails =
|
|
214
215
|
updatedRecord.vendor != null
|
|
215
216
|
? (0, vendorSelector_1.getVendorByVendorId)(vendorState, updatedRecord.vendor.id)
|
|
216
217
|
: undefined;
|
|
217
218
|
file = updatedRecord.file;
|
|
218
|
-
const bankAccInBill = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (
|
|
219
|
-
const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (
|
|
220
|
-
const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (
|
|
219
|
+
const bankAccInBill = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (_v = (_u = updatedRecord.paymentDetailsSection) === null || _u === void 0 ? void 0 : _u.paymentTo) !== null && _v !== void 0 ? _v : '');
|
|
220
|
+
const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (_w = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.bankAccountIds) !== null && _w !== void 0 ? _w : []);
|
|
221
|
+
const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (_x = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.paymentInstrumentIds) !== null && _x !== void 0 ? _x : []);
|
|
221
222
|
const isBankAccInBillExistInVendor = bankAccInBill != null
|
|
222
223
|
? vendorBankAccounts
|
|
223
224
|
.map((bankAc) => bankAc.bankAccountId)
|
|
@@ -270,7 +271,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
270
271
|
whatForSection.recipientCurrencyCode =
|
|
271
272
|
recommendedVendor.vendorCurrencyCode;
|
|
272
273
|
}
|
|
273
|
-
isRecurring = (
|
|
274
|
+
isRecurring = (_y = sourceBillDetail.billDetailLocalData.isRecurring) !== null && _y !== void 0 ? _y : false;
|
|
274
275
|
recurringConfig = sourceBillDetail.billDetailLocalData.recurringConfig;
|
|
275
276
|
recurringBillInstances =
|
|
276
277
|
sourceBillDetail.billDetailLocalData.recurringBillInstances;
|
|
@@ -290,7 +291,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
290
291
|
}
|
|
291
292
|
const vendorContactSaveStatus = editBillDetailViewState.updateVendorContactState;
|
|
292
293
|
const lineDetailSection = {};
|
|
293
|
-
const lineDetailSectionUpdatesByLineId = (
|
|
294
|
+
const lineDetailSectionUpdatesByLineId = (_0 = (_z = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData) === null || _z === void 0 ? void 0 : _z.updatesByLineId) !== null && _0 !== void 0 ? _0 : {};
|
|
294
295
|
const classList = (0, classListSelector_1.getClassList)(classState, classListState);
|
|
295
296
|
if (accountList.fetchState === 'Completed') {
|
|
296
297
|
Object.keys(lineDetailSectionUpdatesByLineId).forEach((lineId) => {
|
|
@@ -311,16 +312,16 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
311
312
|
const accountsHierarchyList = (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, 'billPayAccountList');
|
|
312
313
|
const classHierarchyList = (0, classListSelector_1.getNestedClassListHierarchy)(classListState);
|
|
313
314
|
const duplicateBills = (0, billPayReviewSelector_1.getDuplicateBills)(state, billId);
|
|
314
|
-
const isProcessing = (0, helpers_1.isBillProcessing)((
|
|
315
|
+
const isProcessing = (0, helpers_1.isBillProcessing)((_1 = transaction === null || transaction === void 0 ? void 0 : transaction.bulkProcessingDetail) === null || _1 === void 0 ? void 0 : _1.type);
|
|
315
316
|
return {
|
|
316
317
|
showVendorGptRecommendationText,
|
|
317
318
|
recommendedVendor,
|
|
318
319
|
lastRecommendedVendorName,
|
|
319
320
|
duplicateBills,
|
|
320
321
|
fetchState: fetchState,
|
|
321
|
-
saveStatus: (
|
|
322
|
-
error: (
|
|
323
|
-
uploadStatus: (
|
|
322
|
+
saveStatus: (_2 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.saveStatus) !== null && _2 !== void 0 ? _2 : undefined,
|
|
323
|
+
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,
|
|
324
|
+
uploadStatus: (_5 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.uploadFetchState) !== null && _5 !== void 0 ? _5 : undefined,
|
|
324
325
|
version: 0,
|
|
325
326
|
createdBy,
|
|
326
327
|
createTime,
|
|
@@ -439,13 +440,13 @@ function getWhatForSection(updatedWhatForSection) {
|
|
|
439
440
|
};
|
|
440
441
|
}
|
|
441
442
|
exports.getWhatForSection = getWhatForSection;
|
|
442
|
-
function getPaymentSection(state, withdrawFromList, updatedPaymentSection) {
|
|
443
|
+
function getPaymentSection(state, withdrawFromList, updatedPaymentSection, companyId, billPayInfo) {
|
|
443
444
|
var _a, _b;
|
|
444
445
|
const withdrawFrom = (updatedPaymentSection === null || updatedPaymentSection === void 0 ? void 0 : updatedPaymentSection.withdrawFrom) != null
|
|
445
446
|
? updatedPaymentSection === null || updatedPaymentSection === void 0 ? void 0 : updatedPaymentSection.withdrawFrom
|
|
446
447
|
: withdrawFromList.length === 1
|
|
447
448
|
? withdrawFromList[0]
|
|
448
|
-
:
|
|
449
|
+
: (0, exports.getWithdrawFrom)(state, billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountId, billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountType, companyId !== null && companyId !== void 0 ? companyId : '', state.billPayConfigState.lastSelectedFromAccount);
|
|
449
450
|
const withdrawFromAccountingName = undefined;
|
|
450
451
|
const availablePaymentOptions = state.billPayConfigState.fetchState === 'Completed'
|
|
451
452
|
? (0, exports.getBillPayConfigList)(state.billPayConfigState).filter((option) => { var _a; return option.method.includes((_a = withdrawFrom === null || withdrawFrom === void 0 ? void 0 : withdrawFrom.accType) !== null && _a !== void 0 ? _a : ''); })
|
|
@@ -591,17 +592,69 @@ const getDueDate = (billStageCode, dueDate, invoiceDate, bookCloseDate) => {
|
|
|
591
592
|
}
|
|
592
593
|
};
|
|
593
594
|
exports.getDueDate = getDueDate;
|
|
594
|
-
const getWithdrawFrom = (
|
|
595
|
-
const
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
595
|
+
const getWithdrawFrom = (state, fromAccountId, fromAccountType, companyId, lastSelectedFromAccount) => {
|
|
596
|
+
const { paymentAccountState, depositAccountState, depositAccountListState } = state;
|
|
597
|
+
if (fromAccountId != null) {
|
|
598
|
+
const withdrawFromAsDepositAcc = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, fromAccountId);
|
|
599
|
+
const withdrawFromAsPaymentAcc = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, fromAccountId);
|
|
600
|
+
if (fromAccountType === 'depositAccount' &&
|
|
601
|
+
withdrawFromAsDepositAcc != null) {
|
|
602
|
+
return (0, setupViewSelector_1.mapDepositAccToFundingAccount)(withdrawFromAsDepositAcc);
|
|
603
|
+
}
|
|
604
|
+
if (fromAccountType === 'paymentAccount' &&
|
|
605
|
+
withdrawFromAsPaymentAcc != null) {
|
|
606
|
+
return (0, setupViewSelector_1.mapPaymentAccToFundingAccount)(withdrawFromAsPaymentAcc);
|
|
607
|
+
}
|
|
600
608
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
return (0, setupViewSelector_1.mapPaymentAccToFundingAccount)(withdrawFromAsPaymentAcc);
|
|
609
|
+
else {
|
|
610
|
+
return (0, exports.getDefaultWithdrawFromAccount)(state, depositAccountListState.accountIds, companyId !== null && companyId !== void 0 ? companyId : '', lastSelectedFromAccount);
|
|
604
611
|
}
|
|
605
612
|
return undefined;
|
|
606
613
|
};
|
|
607
614
|
exports.getWithdrawFrom = getWithdrawFrom;
|
|
615
|
+
const getDefaultWithdrawFromAccount = (state, depositAccounts, companyId, lastSelectedFromAccount) => {
|
|
616
|
+
const { depositAccountState, paymentAccountState } = state;
|
|
617
|
+
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
618
|
+
const primaryAccount = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyBillPayInfo.primaryFundingAccount;
|
|
619
|
+
let defaultAccount = undefined;
|
|
620
|
+
// User paying bill for first time or previously paid with external account
|
|
621
|
+
if (lastSelectedFromAccount == null ||
|
|
622
|
+
(lastSelectedFromAccount === null || lastSelectedFromAccount === void 0 ? void 0 : lastSelectedFromAccount.accountType) === 'paymentAccount') {
|
|
623
|
+
if (depositAccounts.length === 0) {
|
|
624
|
+
defaultAccount = primaryAccount;
|
|
625
|
+
}
|
|
626
|
+
else {
|
|
627
|
+
if ((primaryAccount === null || primaryAccount === void 0 ? void 0 : primaryAccount.accountType) === 'depositAccount') {
|
|
628
|
+
defaultAccount = primaryAccount;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
else {
|
|
633
|
+
// User paid with Zeni account previously
|
|
634
|
+
if (depositAccounts.length === 1) {
|
|
635
|
+
defaultAccount = primaryAccount;
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
if ((primaryAccount === null || primaryAccount === void 0 ? void 0 : primaryAccount.accountType) === 'depositAccount') {
|
|
639
|
+
defaultAccount = primaryAccount;
|
|
640
|
+
}
|
|
641
|
+
else {
|
|
642
|
+
defaultAccount = lastSelectedFromAccount;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
if (defaultAccount != null) {
|
|
647
|
+
const defaultAccAsDepositAcc = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, defaultAccount === null || defaultAccount === void 0 ? void 0 : defaultAccount.accountId);
|
|
648
|
+
const defaultAccAsPaymentAcc = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, defaultAccount === null || defaultAccount === void 0 ? void 0 : defaultAccount.accountId);
|
|
649
|
+
if (defaultAccount.accountType === 'depositAccount' &&
|
|
650
|
+
defaultAccAsDepositAcc != null) {
|
|
651
|
+
return (0, setupViewSelector_1.mapDepositAccToFundingAccount)(defaultAccAsDepositAcc);
|
|
652
|
+
}
|
|
653
|
+
if (defaultAccount.accountType === 'paymentAccount' &&
|
|
654
|
+
defaultAccAsPaymentAcc != null) {
|
|
655
|
+
return (0, setupViewSelector_1.mapPaymentAccToFundingAccount)(defaultAccAsPaymentAcc);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
return undefined;
|
|
659
|
+
};
|
|
660
|
+
exports.getDefaultWithdrawFromAccount = getDefaultWithdrawFromAccount;
|
package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js
CHANGED
|
@@ -97,7 +97,7 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
|
|
|
97
97
|
const editBillState = (0, get_1.default)(state.editBillDetailViewState.editBillStateById, detailKey, undefined);
|
|
98
98
|
const billDetail = (0, get_1.default)(state.billDetailViewState.billDetailById, detailKey, undefined);
|
|
99
99
|
const transaction = (0, get_1.default)(state.billTransactionState.transactionById, billId, undefined);
|
|
100
|
-
const { accountListState, accountState, classListState, classState, recurringBillState,
|
|
100
|
+
const { accountListState, accountState, classListState, classState, recurringBillState, } = state;
|
|
101
101
|
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'billPayAccountList');
|
|
102
102
|
const classList = (0, classListSelector_1.getClassList)(classState, classListState);
|
|
103
103
|
const recommendations = transaction === null || transaction === void 0 ? void 0 : transaction.recommendations;
|
|
@@ -161,7 +161,7 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
|
|
|
161
161
|
const paymentDetailsSection = {
|
|
162
162
|
paymentType: (0, editBillViewSelector_1.getPaymentMethodType)(state.billPayConfigState, (_h = transaction.billPayInfo.fromAccount.billAccountType) !== null && _h !== void 0 ? _h : 'depositAccount', transaction.billPayInfo.billPaymentMethodType, transaction.billPayInfo.internationalTransferFeeBearerPaymentMethod),
|
|
163
163
|
paymentDate: (_j = transaction.billPayInfo.paymentDate) !== null && _j !== void 0 ? _j : (0, zeniDayJS_1.date)((0, workingDayHelper_1.getNextNthWorkingDay)((0, zeniDayJS_1.dateNow)().toDate(), [0, 6], isPayNowEnabled ? 0 : 1).toISOString()),
|
|
164
|
-
withdrawFrom: (0, editBillViewSelector_1.getWithdrawFrom)(
|
|
164
|
+
withdrawFrom: (0, editBillViewSelector_1.getWithdrawFrom)(state, (_k = transaction.billPayInfo.fromAccount.billAccountId) !== null && _k !== void 0 ? _k : '', (_l = transaction.billPayInfo.fromAccount.billAccountType) !== null && _l !== void 0 ? _l : '', companyId),
|
|
165
165
|
paymentTo: transaction.billPayInfo.toAccount.billAccountId != null &&
|
|
166
166
|
transaction.billPayInfo.toAccount.billAccountId.length > 0
|
|
167
167
|
? transaction.billPayInfo.toAccount.billAccountId
|
|
@@ -248,7 +248,7 @@ const toBillDetailLocalData = (state, showVendorGptRecommendationText, billPaylo
|
|
|
248
248
|
paymentDate: ((_o = billPayload.bill_pay_info) === null || _o === void 0 ? void 0 : _o.payment_date) != null
|
|
249
249
|
? (0, zeniDayJS_1.date)((_p = billPayload.bill_pay_info) === null || _p === void 0 ? void 0 : _p.payment_date)
|
|
250
250
|
: (0, zeniDayJS_1.date)((0, workingDayHelper_1.getNextNthWorkingDay)((0, zeniDayJS_1.dateNow)().toDate(), [0, 6], isPayNowEnabled ? 0 : 1).toISOString()),
|
|
251
|
-
withdrawFrom: (0, editBillViewSelector_1.getWithdrawFrom)(state
|
|
251
|
+
withdrawFrom: (0, editBillViewSelector_1.getWithdrawFrom)(state, (_r = (_q = billPayload.bill_pay_info) === null || _q === void 0 ? void 0 : _q.from_account.account_id) !== null && _r !== void 0 ? _r : '', (_t = (_s = billPayload.bill_pay_info) === null || _s === void 0 ? void 0 : _s.from_account.account_type) !== null && _t !== void 0 ? _t : ''),
|
|
252
252
|
internationalTransferFeeBearerPaymentMethod: ((_u = billPayload.bill_pay_info) === null || _u === void 0 ? void 0 : _u.international_transfer_fee_bearer_payment_method) != null
|
|
253
253
|
? (0, billTransactionState_1.toInternationalTransferFeeBearerPaymentMethod)((_v = billPayload.bill_pay_info) === null || _v === void 0 ? void 0 : _v.international_transfer_fee_bearer_payment_method)
|
|
254
254
|
: undefined,
|
|
@@ -401,8 +401,10 @@ const doUpdateRecommendationForEntity = (draft, lineId, recommendations, shouldA
|
|
|
401
401
|
draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId].outOfPocket = Object.assign(Object.assign({}, draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId]
|
|
402
402
|
.outOfPocket), { recommendations,
|
|
403
403
|
recommendedAccount, isCategoryUpdateSelected: false, isCategoryFirstTimeAutofilled: true });
|
|
404
|
-
|
|
405
|
-
.outOfPocket.lineDetail
|
|
404
|
+
if (recommendedAccount != null) {
|
|
405
|
+
draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId].outOfPocket.lineDetail = Object.assign(Object.assign({}, draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId]
|
|
406
|
+
.outOfPocket.lineDetail), { account: recommendedAccount });
|
|
407
|
+
}
|
|
406
408
|
//add account to addRemiAutoFieldsByLineId, since account was autofilled
|
|
407
409
|
if (!((_f = draft.newRemiState.addRemiAutoFieldsByLineId[lineId]) === null || _f === void 0 ? void 0 : _f.includes('account')) &&
|
|
408
410
|
(recommendedAccount === null || recommendedAccount === void 0 ? void 0 : recommendedAccount.accountId) != null) {
|
|
@@ -293,12 +293,12 @@ const taskList = (0, toolkit_1.createSlice)({
|
|
|
293
293
|
const dueDateKey = currentTaskState.dueDate != null
|
|
294
294
|
? getDueDateGroupKey(currentTaskState.dueDate.toString())
|
|
295
295
|
: 'upcoming';
|
|
296
|
-
draft.taskIdsByPriority[priorityKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
297
|
-
draft.taskIdsByStatus[statusKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
298
|
-
draft.taskIdsByAssignees[assigneeKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
299
|
-
draft.taskIdsByTags[tagsKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
300
|
-
draft.taskIdsByDueDate[dueDateKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
301
|
-
draft.taskIdsByGroupsIds[taskGroupId].filter((taskId) => taskId !== currentTaskState.id);
|
|
296
|
+
draft.taskIdsByPriority[priorityKey] = draft.taskIdsByPriority[priorityKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
297
|
+
draft.taskIdsByStatus[statusKey] = draft.taskIdsByStatus[statusKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
298
|
+
draft.taskIdsByAssignees[assigneeKey] = draft.taskIdsByAssignees[assigneeKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
299
|
+
draft.taskIdsByTags[tagsKey] = draft.taskIdsByTags[tagsKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
300
|
+
draft.taskIdsByDueDate[dueDateKey] = draft.taskIdsByDueDate[dueDateKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
301
|
+
draft.taskIdsByGroupsIds[taskGroupId] = draft.taskIdsByGroupsIds[taskGroupId].filter((taskId) => taskId !== currentTaskState.id);
|
|
302
302
|
}
|
|
303
303
|
const priorityKey = (0, taskState_1.toPriorityCodeType)(task.priority.code);
|
|
304
304
|
const statusKey = (0, taskState_1.toTaskStatusCodeType)(task.status.code);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.16",
|
|
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",
|