@zeniai/client-epic-state 4.11.30 → 4.11.32
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/chargeCard/chargeCard.d.ts +9 -1
- package/lib/entity/chargeCard/chargeCard.js +12 -1
- package/lib/entity/chargeCard/chargeCardPayload.d.ts +5 -1
- package/lib/entity/chargeCard/chargeCardPayload.js +1 -1
- package/lib/entity/user/userSelector.js +2 -7
- package/lib/view/companyView/selector/companyManagementViewSelector.js +27 -47
- package/lib/view/people/peopleSelector.js +2 -2
- package/lib/view/spendManagement/billPay/billList/billListSelector.d.ts +1 -2
- package/lib/view/spendManagement/billPay/billList/billListSelector.js +67 -126
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountList/fetchZeniAccountListPageEpic.js +2 -4
- package/package.json +2 -2
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Amount } from '../../commonStateTypes/amount';
|
|
2
2
|
import { ID } from '../../commonStateTypes/common';
|
|
3
3
|
import { ZeniDate } from '../../zeniDayJS';
|
|
4
|
+
import { CardTypePayload } from './chargeCardPayload';
|
|
4
5
|
export interface ChargeCard {
|
|
5
6
|
id: ID;
|
|
6
|
-
type:
|
|
7
|
+
type: CardType;
|
|
7
8
|
cardName: string;
|
|
8
9
|
limit: Amount;
|
|
9
10
|
balance: Amount;
|
|
@@ -43,3 +44,10 @@ export interface ValidThru {
|
|
|
43
44
|
month: number;
|
|
44
45
|
year: number;
|
|
45
46
|
}
|
|
47
|
+
export declare const toCardCodeType: (v: string) => "business_physical_credit_card" | "business_virtual_credit_card";
|
|
48
|
+
export declare type CardCodeType = ReturnType<typeof toCardCodeType>;
|
|
49
|
+
export interface CardType {
|
|
50
|
+
code: CardCodeType;
|
|
51
|
+
name: string;
|
|
52
|
+
}
|
|
53
|
+
export declare const toCardType: (payload: CardTypePayload) => CardType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toCardStatusCodeTypeStrict = exports.toCardStatusCodeType = exports.toCreditLimitFrequencyCodeTypeStrict = exports.toCreditLimitFrequencyCodeType = void 0;
|
|
3
|
+
exports.toCardType = exports.toCardCodeType = exports.toCardStatusCodeTypeStrict = exports.toCardStatusCodeType = exports.toCreditLimitFrequencyCodeTypeStrict = exports.toCreditLimitFrequencyCodeType = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
5
|
const ALL_CREDIT_LIMIT_FREQUENCY_TYPE_CODE = [
|
|
6
6
|
'monthly',
|
|
@@ -26,3 +26,14 @@ const toCardStatusCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_CA
|
|
|
26
26
|
exports.toCardStatusCodeType = toCardStatusCodeType;
|
|
27
27
|
const toCardStatusCodeTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v !== null && v !== void 0 ? v : '', ALL_CARD_STATUS_CODE);
|
|
28
28
|
exports.toCardStatusCodeTypeStrict = toCardStatusCodeTypeStrict;
|
|
29
|
+
const CARD_TYPE_CODE = [
|
|
30
|
+
'business_physical_credit_card',
|
|
31
|
+
'business_virtual_credit_card',
|
|
32
|
+
];
|
|
33
|
+
const toCardCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, CARD_TYPE_CODE);
|
|
34
|
+
exports.toCardCodeType = toCardCodeType;
|
|
35
|
+
const toCardType = (payload) => ({
|
|
36
|
+
code: (0, exports.toCardCodeType)(payload.code),
|
|
37
|
+
name: payload.name,
|
|
38
|
+
});
|
|
39
|
+
exports.toCardType = toCardType;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { AllowedValueWithCode } from '../../commonStateTypes/allowedValue';
|
|
2
2
|
import { AddressPayload } from '../address/addressPayload';
|
|
3
3
|
import { ChargeCard } from './chargeCard';
|
|
4
|
+
export interface CardTypePayload {
|
|
5
|
+
code: string;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
4
8
|
export interface ChargeCardPayload {
|
|
5
|
-
card_type:
|
|
9
|
+
card_type: CardTypePayload;
|
|
6
10
|
card_id: string;
|
|
7
11
|
card_name: string;
|
|
8
12
|
credit_limit: number;
|
|
@@ -7,7 +7,7 @@ const zeniDayJS_1 = require("../../zeniDayJS");
|
|
|
7
7
|
const chargeCard_1 = require("./chargeCard");
|
|
8
8
|
const mapChargeCardPayloadToChargeCard = (payload) => ({
|
|
9
9
|
id: payload.card_id,
|
|
10
|
-
type: payload.card_type,
|
|
10
|
+
type: (0, chargeCard_1.toCardType)(payload.card_type),
|
|
11
11
|
cardName: payload.card_name,
|
|
12
12
|
limit: (0, amount_1.toAmount)(payload.credit_limit, payload.currency_code, payload.currency_symbol),
|
|
13
13
|
balance: (0, amount_1.toAmount)(payload.balance_amount, payload.currency_code, payload.currency_symbol),
|
|
@@ -31,13 +31,8 @@ const getAllZeniUsersFromState = (state) => {
|
|
|
31
31
|
exports.getAllZeniUsersFromState = getAllZeniUsersFromState;
|
|
32
32
|
const getUserName = (user) => {
|
|
33
33
|
if (user != null) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (Boolean(firstName) && Boolean(lastName)) {
|
|
37
|
-
return `${firstName} ${lastName}`;
|
|
38
|
-
}
|
|
39
|
-
else if (Boolean(firstName) || Boolean(lastName)) {
|
|
40
|
-
return firstName || lastName;
|
|
34
|
+
if (user.firstName || user.lastName) {
|
|
35
|
+
return `${user.firstName} ${user.lastName}`;
|
|
41
36
|
}
|
|
42
37
|
else {
|
|
43
38
|
return user.email;
|
|
@@ -14,7 +14,6 @@ const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
|
14
14
|
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
15
15
|
const customerSatisfactionState_1 = require("../../../entity/customerSatisfaction/customerSatisfactionState");
|
|
16
16
|
const cockpitHelpers_1 = require("../helpers/cockpitHelpers");
|
|
17
|
-
const sortOrderPayload_1 = require("../../../commonPayloadTypes/sortOrderPayload");
|
|
18
17
|
const getManagementViewFromCompanyIds = (rootState, companyIds, fetchState) => {
|
|
19
18
|
const uiState = rootState.companyViewState.managementView.uiState;
|
|
20
19
|
const { sortKey, sortOrder, filterText, filters } = uiState;
|
|
@@ -335,27 +334,12 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, companies, userS
|
|
|
335
334
|
break;
|
|
336
335
|
}
|
|
337
336
|
});
|
|
338
|
-
const sortOrderKey = (0, sortOrderPayload_1.getSortOrder)(sortOrder);
|
|
339
|
-
const sortOrderKeys = [];
|
|
340
|
-
if (sortKey === 'plans') {
|
|
341
|
-
let maxPlansCount = 0;
|
|
342
|
-
companiesWithSortKeyValue.forEach((company) => {
|
|
343
|
-
var _a;
|
|
344
|
-
maxPlansCount = Math.max(maxPlansCount, (_a = (0, exports.getPlanList)(company)) === null || _a === void 0 ? void 0 : _a.length);
|
|
345
|
-
});
|
|
346
|
-
for (let i = 0; i < maxPlansCount; i++) {
|
|
347
|
-
sortOrderKeys.push(sortOrderKey);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
if (sortOrderKeys.length === 0) {
|
|
351
|
-
sortOrderKeys.push(sortOrderKey, sortOrderKey);
|
|
352
|
-
}
|
|
353
337
|
const sortedCompaniesWithSortKeyValue = (0, orderBy_1.default)(companiesWithSortKeyValue, [
|
|
354
338
|
(company) => {
|
|
355
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
339
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
356
340
|
let primarySortValue;
|
|
357
|
-
let
|
|
358
|
-
let
|
|
341
|
+
let secondarySortValue;
|
|
342
|
+
let isSecondarySortApplicable;
|
|
359
343
|
const managegmentInfo = company.company.company.managegmentInfo;
|
|
360
344
|
switch (sortKey) {
|
|
361
345
|
case 'companyName':
|
|
@@ -366,11 +350,10 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, companies, userS
|
|
|
366
350
|
primarySortValue = (_a = managegmentInfo.companyGroupId) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
367
351
|
break;
|
|
368
352
|
case 'plans':
|
|
369
|
-
|
|
370
|
-
multiSortValues = (0, exports.getPlanList)(company).map((plan) => plan === null || plan === void 0 ? void 0 : plan.zeniSku);
|
|
353
|
+
primarySortValue = (_b = (0, exports.getPlanList)(company)[0]) === null || _b === void 0 ? void 0 : _b.label;
|
|
371
354
|
break;
|
|
372
355
|
case 'task':
|
|
373
|
-
primarySortValue = (
|
|
356
|
+
primarySortValue = (_c = company.taskSummary) === null || _c === void 0 ? void 0 : _c.count;
|
|
374
357
|
break;
|
|
375
358
|
case 'controller':
|
|
376
359
|
primarySortValue = (0, userSelector_1.getUserNameById)(userState, managegmentInfo.controllerUserIds[0]).toLowerCase();
|
|
@@ -388,53 +371,50 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, companies, userS
|
|
|
388
371
|
primarySortValue = (0, userSelector_1.getUserNameById)(userState, managegmentInfo.apAnalystUserIds[0]).toLowerCase();
|
|
389
372
|
break;
|
|
390
373
|
case 'reportSent':
|
|
391
|
-
primarySortValue = ((
|
|
374
|
+
primarySortValue = ((_d = managegmentInfo.lastReportSentDate) !== null && _d !== void 0 ? _d : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z')).valueOf();
|
|
392
375
|
break;
|
|
393
376
|
case 'taxStatus':
|
|
394
|
-
primarySortValue = (
|
|
377
|
+
primarySortValue = (_e = managegmentInfo.taxStatusCode) === null || _e === void 0 ? void 0 : _e.toLowerCase();
|
|
395
378
|
break;
|
|
396
379
|
case 'taxLead':
|
|
397
380
|
primarySortValue = (0, userSelector_1.getUserNameById)(userState, managegmentInfo.taxLeadUserIds[0]).toLowerCase();
|
|
398
381
|
break;
|
|
399
382
|
case 'monthlyRecurringRevenue':
|
|
400
383
|
primarySortValue =
|
|
401
|
-
(
|
|
384
|
+
(_h = (_g = (_f = company.primarySubscription) === null || _f === void 0 ? void 0 : _f.summary) === null || _g === void 0 ? void 0 : _g.summary.monthlyRecurringRevenue.amount) !== null && _h !== void 0 ? _h : 0;
|
|
402
385
|
break;
|
|
403
386
|
case 'annualRecurringRevenue':
|
|
404
387
|
primarySortValue =
|
|
405
|
-
(
|
|
388
|
+
(_l = (_k = (_j = company.primarySubscription) === null || _j === void 0 ? void 0 : _j.summary) === null || _k === void 0 ? void 0 : _k.summary.annualRecurringRevenue.amount) !== null && _l !== void 0 ? _l : 0;
|
|
406
389
|
break;
|
|
407
390
|
case 'notes':
|
|
408
|
-
primarySortValue = (
|
|
391
|
+
primarySortValue = (_m = managegmentInfo.note) === null || _m === void 0 ? void 0 : _m.length;
|
|
409
392
|
break;
|
|
410
393
|
case 'satisfaction':
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
:
|
|
394
|
+
isSecondarySortApplicable = true;
|
|
395
|
+
primarySortValue =
|
|
396
|
+
((_o = managegmentInfo.customerSatisfaction) === null || _o === void 0 ? void 0 : _o.customerRating) != null
|
|
397
|
+
? customerSatisfactionState_1.customerRatingValues[managegmentInfo.customerSatisfaction.customerRating]
|
|
398
|
+
: 0;
|
|
399
|
+
secondarySortValue =
|
|
400
|
+
((_p = managegmentInfo.customerSatisfaction) === null || _p === void 0 ? void 0 : _p.teamRating) != null
|
|
401
|
+
? customerSatisfactionState_1.teamRatingValues[managegmentInfo.customerSatisfaction.teamRating]
|
|
402
|
+
: 0;
|
|
418
403
|
break;
|
|
419
404
|
case 'bookCloseDate':
|
|
420
|
-
primarySortValue = ((
|
|
405
|
+
primarySortValue = ((_q = company.company.company.companyInfo.bookCloseDate) !== null && _q !== void 0 ? _q : (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z')).valueOf();
|
|
421
406
|
break;
|
|
422
407
|
case 'status':
|
|
423
|
-
default:
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
statusCode = (0, cockpitTypes_1.toManagementStatusCodeType)(managegmentInfo.statusCode.toLowerCase());
|
|
428
|
-
}
|
|
429
|
-
multiSortValues.push(cockpitTypes_1.MANAGEMENT_STATUS_CODES.indexOf(statusCode));
|
|
430
|
-
multiSortValues.push((_q = managegmentInfo.companyGroupId) === null || _q === void 0 ? void 0 : _q.toLowerCase());
|
|
431
|
-
}
|
|
408
|
+
default:
|
|
409
|
+
isSecondarySortApplicable = true;
|
|
410
|
+
primarySortValue = cockpitTypes_1.MANAGEMENT_STATUS_CODES.indexOf((_r = managegmentInfo.statusCode) === null || _r === void 0 ? void 0 : _r.toLowerCase());
|
|
411
|
+
secondarySortValue = (_s = managegmentInfo.companyGroupId) === null || _s === void 0 ? void 0 : _s.toLowerCase();
|
|
432
412
|
}
|
|
433
|
-
return
|
|
434
|
-
?
|
|
413
|
+
return isSecondarySortApplicable === true
|
|
414
|
+
? [primarySortValue, secondarySortValue]
|
|
435
415
|
: primarySortValue;
|
|
436
416
|
},
|
|
437
|
-
],
|
|
417
|
+
], sortOrder === 'ascending' ? ['asc', 'asc'] : ['desc', 'desc']);
|
|
438
418
|
return [...sortedCompaniesWithSortKeyValue, ...companiesWithNoSortKeyValue];
|
|
439
419
|
};
|
|
440
420
|
const getTotalRecurringRevenue = (companies) => companies.reduce((prev, curr) => {
|
|
@@ -142,8 +142,8 @@ const sortPeopleBySortKey = (person, sortKey, userState, classState) => {
|
|
|
142
142
|
default:
|
|
143
143
|
return person.user != null
|
|
144
144
|
? person.user.firstName
|
|
145
|
-
? (_b = person.user) === null || _b === void 0 ? void 0 : _b.firstName.toLowerCase()
|
|
146
|
-
: (_c = person.user) === null || _c === void 0 ? void 0 : _c.email.toLowerCase()
|
|
145
|
+
? (_b = person.user) === null || _b === void 0 ? void 0 : _b.firstName.toLowerCase()
|
|
146
|
+
: (_c = person.user) === null || _c === void 0 ? void 0 : _c.email.toLowerCase()
|
|
147
147
|
: undefined;
|
|
148
148
|
}
|
|
149
149
|
};
|
|
@@ -13,7 +13,6 @@ import { RecurringBillConfig } from '../../../../entity/billPay/recurringBills/r
|
|
|
13
13
|
import { BulkOperationType, BulkSelectExceptionInfoType } from '../billsBulkActionView/billsBulkActionViewState';
|
|
14
14
|
export interface BillBulkSelectInfo {
|
|
15
15
|
isSelectableForBulkAction: boolean;
|
|
16
|
-
isSelectableForBulkActionSelectAll: boolean;
|
|
17
16
|
bulkSelectExceptionInfo?: BulkSelectExceptionInfoType;
|
|
18
17
|
}
|
|
19
18
|
export interface BillListBulkActionInfo {
|
|
@@ -50,4 +49,4 @@ export declare const getBillList: (state: RootState, currentTimePeriod: TimePeri
|
|
|
50
49
|
export declare const getApproversOrRejectors: (billTransaction: BillTransaction, entityApprovalStatusState: EntityApprovalStatusState, userState: UserState) => Approvers;
|
|
51
50
|
export declare const getBillListOnSort: (sortKey: BillPayViewSortKey, sortOrder: SortOrder, currentTab: BillTab, transactions: BillTransactionView[]) => BillTransactionView[];
|
|
52
51
|
export declare const checkIfBulkActionAllowed: (selectedTab: BillTab, selectedSubTab: BillsSubTabType) => boolean;
|
|
53
|
-
export declare const getAllowedBulkActions: (selectedTab: BillTab, selectedSubTab: BillsSubTabType, isAllAwaitingMyApproval: boolean, isFirstBillProcessing: boolean
|
|
52
|
+
export declare const getAllowedBulkActions: (selectedTab: BillTab, selectedSubTab: BillsSubTabType, isAllAwaitingMyApproval: boolean, isFirstBillProcessing: boolean) => BulkOperationType[];
|
|
@@ -100,7 +100,21 @@ const getBillList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
|
|
|
100
100
|
}
|
|
101
101
|
break;
|
|
102
102
|
}
|
|
103
|
+
const bulkSubmissionFetchState = billsBulkActionViewState.bulkSubmissionFetchState.fetchState;
|
|
104
|
+
let isRecurringBillInBulkActionList = false;
|
|
105
|
+
let billListBulkActionInfo = {
|
|
106
|
+
isBulkActionAllowed: false,
|
|
107
|
+
billsSelectedForBulkAction: [],
|
|
108
|
+
allowedBulkActions: [],
|
|
109
|
+
bulkSubmissionFetchState,
|
|
110
|
+
isRecurringBillInBulkActionList,
|
|
111
|
+
};
|
|
112
|
+
let firstBillInBulkList = undefined;
|
|
113
|
+
const isBulkActionAllowed = isBulkActionFeatureEnabled
|
|
114
|
+
? (0, exports.checkIfBulkActionAllowed)(billListState.currentTab, billListState.currentSubTab)
|
|
115
|
+
: false;
|
|
103
116
|
let transactionsView = transactions.map((transaction) => {
|
|
117
|
+
var _a, _b;
|
|
104
118
|
let approvers = {
|
|
105
119
|
users: [],
|
|
106
120
|
attributes: [],
|
|
@@ -114,10 +128,51 @@ const getBillList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
|
|
|
114
128
|
recurringBillDetail = (0, get_1.default)(recurringBillState.recurringBillDetailByConfigId, transaction.recurringBillConfigId, undefined);
|
|
115
129
|
}
|
|
116
130
|
const recurringBillConfig = recurringBillDetail === null || recurringBillDetail === void 0 ? void 0 : recurringBillDetail.recurringBillConfig;
|
|
131
|
+
let billBulkSelectInfo;
|
|
132
|
+
if (isBulkActionAllowed) {
|
|
133
|
+
const isProcessing = (0, helpers_1.isBillProcessing)((_a = transaction.bulkProcessingDetail) === null || _a === void 0 ? void 0 : _a.type);
|
|
134
|
+
const isError = ((_b = transaction.bulkProcessingDetail) === null || _b === void 0 ? void 0 : _b.type) === 'error';
|
|
135
|
+
const isBookClosedForBill = transaction.bookCloseDate != null &&
|
|
136
|
+
transaction.date.isBefore(transaction.bookCloseDate);
|
|
137
|
+
const { isSelectableForBulkAction, bulkSelectExceptionInfo } = isProcessing || isError
|
|
138
|
+
? {
|
|
139
|
+
isSelectableForBulkAction: false,
|
|
140
|
+
bulkSelectExceptionInfo: undefined,
|
|
141
|
+
}
|
|
142
|
+
: isBillSelectableForBulkAction(transaction, billListState.currentTab, isBookClosedForBill, firstBillInBulkList);
|
|
143
|
+
if (isBulkActionAllowed &&
|
|
144
|
+
billsBulkActionViewState.billsSelectedForBulkAction.includes(transaction.id)) {
|
|
145
|
+
if (isRecurring) {
|
|
146
|
+
isRecurringBillInBulkActionList = true;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
billBulkSelectInfo = {
|
|
150
|
+
isSelectableForBulkAction,
|
|
151
|
+
bulkSelectExceptionInfo,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
117
154
|
return Object.assign(Object.assign({}, transaction), { approvers,
|
|
118
155
|
isRecurring,
|
|
156
|
+
billBulkSelectInfo,
|
|
119
157
|
recurringBillConfig });
|
|
120
158
|
});
|
|
159
|
+
if (isBulkActionAllowed) {
|
|
160
|
+
const billsSelectedForBulkAction = billsBulkActionViewState.billsSelectedForBulkAction;
|
|
161
|
+
firstBillInBulkList = (0, get_1.default)(billTransactionState.transactionById, billsSelectedForBulkAction[0], undefined);
|
|
162
|
+
const allBulkBillsAwaitingMyApproval = (0, difference_1.default)(billsSelectedForBulkAction, pendingApprovalTransactionIDs)
|
|
163
|
+
.length === 0;
|
|
164
|
+
const allowedBulkActions = isBulkActionAllowed
|
|
165
|
+
? (0, exports.getAllowedBulkActions)(billListState.currentTab, billListState.currentSubTab, allBulkBillsAwaitingMyApproval, (firstBillInBulkList === null || firstBillInBulkList === void 0 ? void 0 : firstBillInBulkList.billPayInfo.billPaymentStatus.code) ===
|
|
166
|
+
'processing')
|
|
167
|
+
: [];
|
|
168
|
+
billListBulkActionInfo = {
|
|
169
|
+
isBulkActionAllowed,
|
|
170
|
+
billsSelectedForBulkAction,
|
|
171
|
+
allowedBulkActions,
|
|
172
|
+
bulkSubmissionFetchState,
|
|
173
|
+
isRecurringBillInBulkActionList,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
121
176
|
transactionsView = (0, spendManagementFilterHelpers_1.applyAdvancedFiltersOnList)('bill_pay', transactionsView, billListState.filters);
|
|
122
177
|
const TransactionsPendingForMyApprovalLength = pendingApprovalTransactionIDs.length;
|
|
123
178
|
const fetchState = (_f = (_e = billListState.byBillListKey[key]) === null || _e === void 0 ? void 0 : _e.fetchState) !== null && _f !== void 0 ? _f : 'Not-Started';
|
|
@@ -140,73 +195,6 @@ const getBillList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
|
|
|
140
195
|
((_c = transaction.documentId) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes(loweredSearchText)) ===
|
|
141
196
|
true);
|
|
142
197
|
}));
|
|
143
|
-
//BulkActions
|
|
144
|
-
const bulkSubmissionFetchState = billsBulkActionViewState.bulkSubmissionFetchState.fetchState;
|
|
145
|
-
let isRecurringBillInBulkActionList = false;
|
|
146
|
-
let isBookClosedForAnySelectedBill = false;
|
|
147
|
-
let billListBulkActionInfo = {
|
|
148
|
-
isBulkActionAllowed: false,
|
|
149
|
-
billsSelectedForBulkAction: [],
|
|
150
|
-
allowedBulkActions: [],
|
|
151
|
-
bulkSubmissionFetchState,
|
|
152
|
-
isRecurringBillInBulkActionList,
|
|
153
|
-
};
|
|
154
|
-
const billsSelectedForBulkAction = billsBulkActionViewState.billsSelectedForBulkAction;
|
|
155
|
-
const firstBillInBulkList = (0, get_1.default)(billTransactionState.transactionById, billsSelectedForBulkAction[0], undefined);
|
|
156
|
-
const isBulkActionAllowed = isBulkActionFeatureEnabled
|
|
157
|
-
? (0, exports.checkIfBulkActionAllowed)(billListState.currentTab, billListState.currentSubTab)
|
|
158
|
-
: false;
|
|
159
|
-
let firstSelectableBill = undefined;
|
|
160
|
-
if (isBulkActionAllowed) {
|
|
161
|
-
transactionsView = transactionsView.map((transaction) => {
|
|
162
|
-
var _a, _b;
|
|
163
|
-
let billBulkSelectInfo;
|
|
164
|
-
if (isBulkActionAllowed) {
|
|
165
|
-
const isProcessing = (0, helpers_1.isBillProcessing)((_a = transaction.bulkProcessingDetail) === null || _a === void 0 ? void 0 : _a.type);
|
|
166
|
-
const isError = ((_b = transaction.bulkProcessingDetail) === null || _b === void 0 ? void 0 : _b.type) === 'error';
|
|
167
|
-
const isBookClosedForBill = transaction.bookCloseDate != null &&
|
|
168
|
-
transaction.date.isBefore(transaction.bookCloseDate);
|
|
169
|
-
const { isSelectableForBulkAction, isSelectableForBulkActionSelectAll, bulkSelectExceptionInfo, } = isProcessing || isError
|
|
170
|
-
? {
|
|
171
|
-
isSelectableForBulkAction: false,
|
|
172
|
-
isSelectableForBulkActionSelectAll: false,
|
|
173
|
-
bulkSelectExceptionInfo: undefined,
|
|
174
|
-
}
|
|
175
|
-
: isBillSelectableForBulkAction(transaction, billListState.currentTab, isBookClosedForBill, pendingApprovalTransactionIDs.includes(transaction.id), firstSelectableBill, firstBillInBulkList);
|
|
176
|
-
if (isBulkActionAllowed &&
|
|
177
|
-
billsBulkActionViewState.billsSelectedForBulkAction.includes(transaction.id)) {
|
|
178
|
-
if (transaction.isRecurring) {
|
|
179
|
-
isRecurringBillInBulkActionList = true;
|
|
180
|
-
}
|
|
181
|
-
if (isBookClosedForBill) {
|
|
182
|
-
isBookClosedForAnySelectedBill = true;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
if (firstSelectableBill == null && isSelectableForBulkAction) {
|
|
186
|
-
firstSelectableBill = transaction;
|
|
187
|
-
}
|
|
188
|
-
billBulkSelectInfo = {
|
|
189
|
-
isSelectableForBulkAction,
|
|
190
|
-
isSelectableForBulkActionSelectAll,
|
|
191
|
-
bulkSelectExceptionInfo,
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
return Object.assign(Object.assign({}, transaction), { billBulkSelectInfo });
|
|
195
|
-
});
|
|
196
|
-
const allBulkBillsAwaitingMyApproval = (0, difference_1.default)(billsSelectedForBulkAction, pendingApprovalTransactionIDs)
|
|
197
|
-
.length === 0;
|
|
198
|
-
const allowedBulkActions = isBulkActionAllowed
|
|
199
|
-
? (0, exports.getAllowedBulkActions)(billListState.currentTab, billListState.currentSubTab, allBulkBillsAwaitingMyApproval, (firstBillInBulkList === null || firstBillInBulkList === void 0 ? void 0 : firstBillInBulkList.billPayInfo.billPaymentStatus.code) ===
|
|
200
|
-
'processing', isBookClosedForAnySelectedBill, isRecurringBillInBulkActionList)
|
|
201
|
-
: [];
|
|
202
|
-
billListBulkActionInfo = {
|
|
203
|
-
isBulkActionAllowed,
|
|
204
|
-
billsSelectedForBulkAction,
|
|
205
|
-
allowedBulkActions,
|
|
206
|
-
bulkSubmissionFetchState,
|
|
207
|
-
isRecurringBillInBulkActionList,
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
198
|
const isDownloadEnabled = (0, spendManagementFilterHelpers_1.isBillListDownloadable)(state, currentTimePeriod);
|
|
211
199
|
const billBulkSubmissionLimit = billPayConfigState.billBulkSubmissionLimit;
|
|
212
200
|
return {
|
|
@@ -518,66 +506,28 @@ const checkIfBulkActionAllowed = (selectedTab, selectedSubTab) => {
|
|
|
518
506
|
return true;
|
|
519
507
|
};
|
|
520
508
|
exports.checkIfBulkActionAllowed = checkIfBulkActionAllowed;
|
|
521
|
-
const isBillSelectableForBulkAction = (bill, selectedTab, isBookClosedForBill,
|
|
509
|
+
const isBillSelectableForBulkAction = (bill, selectedTab, isBookClosedForBill, firstBillSelected) => {
|
|
522
510
|
const result = {
|
|
523
511
|
isSelectableForBulkAction: true,
|
|
524
|
-
isSelectableForBulkActionSelectAll: true,
|
|
525
512
|
bulkSelectExceptionInfo: undefined,
|
|
526
513
|
};
|
|
527
|
-
if (isBookClosedForBill) {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
isSelectableForBulkActionSelectAll: false,
|
|
533
|
-
bulkSelectExceptionInfo: 'bookCloseDateProcessing',
|
|
534
|
-
};
|
|
535
|
-
}
|
|
514
|
+
if (isBookClosedForBill && selectedTab !== 'draft') {
|
|
515
|
+
return {
|
|
516
|
+
isSelectableForBulkAction: false,
|
|
517
|
+
bulkSelectExceptionInfo: 'bookCloseDateProcessing',
|
|
518
|
+
};
|
|
536
519
|
}
|
|
537
520
|
if (selectedTab === 'scheduled') {
|
|
538
|
-
//for cases where user attempts select all on scheduled tab
|
|
539
|
-
if (firstBillSelected == null && firstSelectableBill != null) {
|
|
540
|
-
if (firstSelectableBill.billPayInfo.billPaymentStatus.code === 'processing') {
|
|
541
|
-
if (bill.isRecurring &&
|
|
542
|
-
Boolean(firstSelectableBill.isRecurring) === false) {
|
|
543
|
-
return {
|
|
544
|
-
isSelectableForBulkAction: true,
|
|
545
|
-
isSelectableForBulkActionSelectAll: false,
|
|
546
|
-
bulkSelectExceptionInfo: undefined,
|
|
547
|
-
};
|
|
548
|
-
}
|
|
549
|
-
if (bill.billPayInfo.billPaymentStatus.code !== 'processing') {
|
|
550
|
-
return {
|
|
551
|
-
isSelectableForBulkAction: true,
|
|
552
|
-
isSelectableForBulkActionSelectAll: false,
|
|
553
|
-
bulkSelectExceptionInfo: undefined,
|
|
554
|
-
};
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
if (bill.billPayInfo.billPaymentStatus.code === 'processing') {
|
|
558
|
-
if (firstSelectableBill.billPayInfo.billPaymentStatus.code !==
|
|
559
|
-
'processing') {
|
|
560
|
-
return {
|
|
561
|
-
isSelectableForBulkAction: true,
|
|
562
|
-
isSelectableForBulkActionSelectAll: false,
|
|
563
|
-
bulkSelectExceptionInfo: undefined,
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
521
|
if ((firstBillSelected === null || firstBillSelected === void 0 ? void 0 : firstBillSelected.billPayInfo.billPaymentStatus.code) === 'processing') {
|
|
569
|
-
if (bill.isRecurring
|
|
570
|
-
Boolean(firstBillSelected === null || firstBillSelected === void 0 ? void 0 : firstBillSelected.isRecurring) === false) {
|
|
522
|
+
if (bill.isRecurring) {
|
|
571
523
|
return {
|
|
572
524
|
isSelectableForBulkAction: false,
|
|
573
|
-
isSelectableForBulkActionSelectAll: true,
|
|
574
525
|
bulkSelectExceptionInfo: 'cancelRecurring',
|
|
575
526
|
};
|
|
576
527
|
}
|
|
577
528
|
if (bill.billPayInfo.billPaymentStatus.code !== 'processing') {
|
|
578
529
|
return {
|
|
579
530
|
isSelectableForBulkAction: false,
|
|
580
|
-
isSelectableForBulkActionSelectAll: true,
|
|
581
531
|
bulkSelectExceptionInfo: 'processingSelectTogether',
|
|
582
532
|
};
|
|
583
533
|
}
|
|
@@ -587,7 +537,6 @@ const isBillSelectableForBulkAction = (bill, selectedTab, isBookClosedForBill, i
|
|
|
587
537
|
if (firstBillSelected.billPayInfo.billPaymentStatus.code !== 'processing') {
|
|
588
538
|
return {
|
|
589
539
|
isSelectableForBulkAction: false,
|
|
590
|
-
isSelectableForBulkActionSelectAll: true,
|
|
591
540
|
bulkSelectExceptionInfo: 'processingWithOthers',
|
|
592
541
|
};
|
|
593
542
|
}
|
|
@@ -595,7 +544,7 @@ const isBillSelectableForBulkAction = (bill, selectedTab, isBookClosedForBill, i
|
|
|
595
544
|
}
|
|
596
545
|
return result;
|
|
597
546
|
};
|
|
598
|
-
const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyApproval, isFirstBillProcessing
|
|
547
|
+
const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyApproval, isFirstBillProcessing) => {
|
|
599
548
|
switch (selectedTab) {
|
|
600
549
|
case 'draft':
|
|
601
550
|
return ['send_for_approval', 'delete'];
|
|
@@ -604,16 +553,11 @@ const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyAppro
|
|
|
604
553
|
case 'all':
|
|
605
554
|
case 'awaiting_approval':
|
|
606
555
|
case 'overdue':
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
: ['approve', 'reject', 'delete'];
|
|
611
|
-
}
|
|
612
|
-
return isBookClosedForAnySelectedBill ? [] : ['delete'];
|
|
556
|
+
return isAllAwaitingMyApproval
|
|
557
|
+
? ['approve', 'reject', 'delete']
|
|
558
|
+
: ['delete'];
|
|
613
559
|
case 'awaiting_my_approval':
|
|
614
|
-
return
|
|
615
|
-
? ['approve', 'reject']
|
|
616
|
-
: ['approve', 'reject', 'delete'];
|
|
560
|
+
return ['approve', 'reject', 'delete'];
|
|
617
561
|
case 'rejected':
|
|
618
562
|
return ['delete'];
|
|
619
563
|
default:
|
|
@@ -623,9 +567,6 @@ const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyAppro
|
|
|
623
567
|
case 'scheduled': {
|
|
624
568
|
switch (selectedSubTab) {
|
|
625
569
|
case 'all':
|
|
626
|
-
if (isRecurringBillInBulkActionList) {
|
|
627
|
-
return ['delete'];
|
|
628
|
-
}
|
|
629
570
|
return isFirstBillProcessing ? ['cancel'] : ['delete'];
|
|
630
571
|
case 'failed':
|
|
631
572
|
case 'cancelled':
|
|
@@ -43,7 +43,7 @@ const getChargeCardListView = (state, includeCreditAccountAndCashbackInfo) => {
|
|
|
43
43
|
var _a, _b, _c, _d, _e;
|
|
44
44
|
switch (sortKey) {
|
|
45
45
|
case 'owner':
|
|
46
|
-
return ((_c = `${(_a = card.cardHolderUser) === null || _a === void 0 ? void 0 : _a.firstName.toLowerCase()
|
|
46
|
+
return ((_c = `${(_a = card.cardHolderUser) === null || _a === void 0 ? void 0 : _a.firstName.toLowerCase()} ${(_b = card.cardHolderUser) === null || _b === void 0 ? void 0 : _b.lastName.toLowerCase()}`) !== null && _c !== void 0 ? _c : '');
|
|
47
47
|
case 'cardName':
|
|
48
48
|
return card.cardName.toLowerCase();
|
|
49
49
|
case 'department':
|
package/lib/view/spendManagement/zeniAccounts/zeniAccountList/fetchZeniAccountListPageEpic.js
CHANGED
|
@@ -18,10 +18,8 @@ const fetchZeniAccountListEpic = (actions$, state$) => actions$.pipe((0, operato
|
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
20
|
const depositAccountList = state.depositAccountListState;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
depositAccountList.fetchState !== 'In-Progress') ||
|
|
24
|
-
zeniAccountList.summary.zeniAccounts == null) {
|
|
21
|
+
if (depositAccountList.hasValidState() === false &&
|
|
22
|
+
depositAccountList.fetchState !== 'In-Progress') {
|
|
25
23
|
zeniAccountActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
|
|
26
24
|
}
|
|
27
25
|
const paymentAccountList = state.paymentAccountListState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.32",
|
|
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",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@reduxjs/toolkit": "^1.6.2",
|
|
51
|
-
"@stripe/stripe-js": "
|
|
51
|
+
"@stripe/stripe-js": "4.2.0",
|
|
52
52
|
"cross-fetch": "^3.1.2",
|
|
53
53
|
"date-holidays": "^3.23.8",
|
|
54
54
|
"dayjs": "^1.10.7",
|