@zeniai/client-epic-state 4.9.24 → 4.9.25
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/account/accountPayload.d.ts +1 -1
- package/lib/entity/reimbursement/reimbursementPayload.js +1 -1
- package/lib/entity/reimbursement/reimbursementState.d.ts +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.d.ts +1 -0
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.js +1 -0
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigState.d.ts +1 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +7 -7
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewReducer.js +22 -44
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.d.ts +2 -2
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +17 -16
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewState.d.ts +3 -3
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchRemiAndInitializeLocalStoreEpic.js +1 -1
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/parseReceiptsToRemiEpic.js +2 -2
- package/package.json +1 -1
|
@@ -44,7 +44,7 @@ export interface AccountMetadataPayload extends AccountBasePayload {
|
|
|
44
44
|
parent_account_id: string | null;
|
|
45
45
|
is_sub_account: boolean | null;
|
|
46
46
|
}
|
|
47
|
-
export declare const toAccountPayload: (acc
|
|
47
|
+
export declare const toAccountPayload: (acc?: AccountBase | undefined) => AccountBasePayload;
|
|
48
48
|
export declare const toRecommendedAccountBasePayload: (acc: RecommendedAccountBase) => RecommendedAccountBasePayload;
|
|
49
49
|
export declare const toRecommendedAccountBasePayloadForAmountRange: (acc: RecommendedAccountBase | undefined, amountRange: {
|
|
50
50
|
min: number;
|
|
@@ -106,7 +106,7 @@ exports.toReimbursementLineBase = toReimbursementLineBase;
|
|
|
106
106
|
const toReimbursementLineBasePayload = (line) => {
|
|
107
107
|
var _a, _b;
|
|
108
108
|
return ({
|
|
109
|
-
file_id: (_a = line.fileId) !== null && _a !== void 0 ? _a :
|
|
109
|
+
file_id: (_a = line.fileId) !== null && _a !== void 0 ? _a : null,
|
|
110
110
|
home_currency_conversions: {
|
|
111
111
|
amount: line.type === 'mileage'
|
|
112
112
|
? line.amount
|
|
@@ -35,7 +35,7 @@ export interface Reimbursement {
|
|
|
35
35
|
}
|
|
36
36
|
export declare type ReimbursementLine = MilageReimbursementLine | OutofPocketReimbursementLine;
|
|
37
37
|
export interface ReimbursementLineBase extends Amount {
|
|
38
|
-
fileId
|
|
38
|
+
fileId?: ID;
|
|
39
39
|
homeCurrencyConversions: Amount;
|
|
40
40
|
description: string;
|
|
41
41
|
lineDetail: LineDetail;
|
package/lib/index.d.ts
CHANGED
|
@@ -439,8 +439,8 @@ import { deleteRemi, fetchRemiDetail, cancelAndDeleteRemi, approveOrRejectRemi,
|
|
|
439
439
|
export { deleteRemi, fetchRemiDetail, cancelAndDeleteRemi, approveOrRejectRemi, clearRemiDetailView, fetchDuplicateReimbursement, clearDuplicateReimbursementDetail, removeDuplicateReimbursementByLineId, };
|
|
440
440
|
import { ReceiptsProcessingPayload } from './view/spendManagement/reimbursement/editRemiView/editRemiViewPayload';
|
|
441
441
|
export { ReceiptsProcessingPayload };
|
|
442
|
-
import { EditRemiDetailSelectorView, ReimbursementLineWithAttachment, getEditRemiDetail } from './view/spendManagement/reimbursement/editRemiView/editRemiViewSelector';
|
|
443
|
-
export { EditRemiDetailSelectorView, ReimbursementLineWithAttachment, getEditRemiDetail, };
|
|
442
|
+
import { EditRemiDetailSelectorView, ReimbursementLineWithAttachment, getEditRemiDetail, ReimbursementLineWithAttachmentAndRecommendation } from './view/spendManagement/reimbursement/editRemiView/editRemiViewSelector';
|
|
443
|
+
export { EditRemiDetailSelectorView, ReimbursementLineWithAttachment, getEditRemiDetail, ReimbursementLineWithAttachmentAndRecommendation, };
|
|
444
444
|
import { RemiDetailLocalData, AutoFields, OutofPocketReimbursementLineWithRecommendation, ReimbursementLineWithRecommendation } from './view/spendManagement/reimbursement/editRemiView/editRemiViewState';
|
|
445
445
|
export { RemiDetailLocalData, AutoFields, OutofPocketReimbursementLineWithRecommendation, ReimbursementLineWithRecommendation, };
|
|
446
446
|
import { Merchant } from './entity/merchant/merchant';
|
|
@@ -15,6 +15,7 @@ export interface RePaymentInfoPayload {
|
|
|
15
15
|
current_statement_period_end_date: string;
|
|
16
16
|
current_statement_period_start_date: string;
|
|
17
17
|
next_repayment_due_date: string;
|
|
18
|
+
card_limit_reset_date: string;
|
|
18
19
|
}
|
|
19
20
|
export declare type ChargeCardConfigResponse = ZeniAPIResponse<ChargeCardConfigPayload>;
|
|
20
21
|
export declare const toCreditTerm: (payload: CreditTermsPayload) => CreditTerm;
|
|
@@ -14,5 +14,6 @@ const toRePaymentInfo = (payload) => ({
|
|
|
14
14
|
endDate: (0, zeniDayJS_1.date)(payload.current_statement_period_end_date),
|
|
15
15
|
},
|
|
16
16
|
rePaymentDueDate: (0, zeniDayJS_1.date)(payload.next_repayment_due_date),
|
|
17
|
+
cardLimitResetDate: (0, zeniDayJS_1.date)(payload.card_limit_reset_date),
|
|
17
18
|
});
|
|
18
19
|
exports.toRePaymentInfo = toRePaymentInfo;
|
|
@@ -15,9 +15,7 @@ const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector
|
|
|
15
15
|
const userListViewSelector_1 = require("../../../userListView/userListViewSelector");
|
|
16
16
|
const getChargeCardListView = (state, includeCreditAccount) => {
|
|
17
17
|
const { addressState, chargeCardListState, chargeCardState, classState, userState, userRoleState, chargeCardConfigState, classListState, } = state;
|
|
18
|
-
const searchText = chargeCardListState.searchText
|
|
19
|
-
.trim()
|
|
20
|
-
.toLowerCase();
|
|
18
|
+
const searchText = chargeCardListState.searchText.toLowerCase();
|
|
21
19
|
const cards = (0, chargeCardSelector_1.getChargeCardsByIds)(chargeCardState, chargeCardListState.cardIds)
|
|
22
20
|
.map((chargeCard) => {
|
|
23
21
|
const cardHolderUser = (0, userSelector_1.getUserByUserId)(userState, chargeCard.cardHolderUserId);
|
|
@@ -31,11 +29,13 @@ const getChargeCardListView = (state, includeCreditAccount) => {
|
|
|
31
29
|
return Object.assign(Object.assign({}, chargeCard), { cardHolderUser, cardHolderRoles: (0, userRoleSelector_1.getUserRoleByUserId)(userRoleState, chargeCard.cardHolderUserId), department, address: (0, addressSelector_1.getAddressByAddressId)(addressState, chargeCard.addressId) });
|
|
32
30
|
})
|
|
33
31
|
.filter((cardWithUser) => {
|
|
34
|
-
var _a, _b, _c;
|
|
32
|
+
var _a, _b, _c, _d, _e;
|
|
33
|
+
const derivedCardHolderName = `${(_a = cardWithUser.cardHolderUser) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = cardWithUser.cardHolderUser) === null || _b === void 0 ? void 0 : _b.lastName}`;
|
|
35
34
|
return (cardWithUser.cardName.toLowerCase().includes(searchText) === true ||
|
|
36
|
-
((
|
|
37
|
-
|
|
38
|
-
((
|
|
35
|
+
((_c = cardWithUser.cardHolderUser) === null || _c === void 0 ? void 0 : _c.firstName.toLowerCase().includes(searchText)) === true ||
|
|
36
|
+
derivedCardHolderName.includes(searchText) === true ||
|
|
37
|
+
((_d = cardWithUser.cardHolderUser) === null || _d === void 0 ? void 0 : _d.lastName.toLowerCase().includes(searchText)) === true ||
|
|
38
|
+
((_e = cardWithUser.department) === null || _e === void 0 ? void 0 : _e.className.toLowerCase().includes(searchText)) === true);
|
|
39
39
|
});
|
|
40
40
|
const sortKey = chargeCardListState.uiState.sortKey;
|
|
41
41
|
const sortOrder = (0, sortOrderPayload_1.getSortOrder)(chargeCardListState.uiState.sortOrder);
|
|
@@ -69,10 +69,9 @@ const editRemiView = (0, toolkit_1.createSlice)({
|
|
|
69
69
|
},
|
|
70
70
|
fetchRemiAndInitializeLocalStore: {
|
|
71
71
|
reducer(draft, action) {
|
|
72
|
+
var _a;
|
|
72
73
|
const { reimbursementId } = action.payload;
|
|
73
|
-
const oldData = draft.editRemiStateById[reimbursementId]
|
|
74
|
-
? draft.editRemiStateById[reimbursementId]
|
|
75
|
-
: editRemiViewState_1.initialRemiDetail;
|
|
74
|
+
const oldData = (_a = draft.editRemiStateById[reimbursementId]) !== null && _a !== void 0 ? _a : editRemiViewState_1.initialRemiDetail;
|
|
76
75
|
draft.editRemiStateById[reimbursementId] = Object.assign(Object.assign({}, oldData), { fetchStatus: {
|
|
77
76
|
fetchState: 'In-Progress',
|
|
78
77
|
error: undefined,
|
|
@@ -138,13 +137,12 @@ const editRemiView = (0, toolkit_1.createSlice)({
|
|
|
138
137
|
saveRemiUpdatesToLocalStore(draft, action) {
|
|
139
138
|
if (action.payload.reimbursementId != null) {
|
|
140
139
|
const reimbursementId = action.payload.reimbursementId;
|
|
141
|
-
draft.editRemiStateById[reimbursementId].remiDetailLocalData =
|
|
142
|
-
Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData, action.payload.remiDetailLocalData);
|
|
140
|
+
draft.editRemiStateById[reimbursementId].remiDetailLocalData = Object.assign(Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData), action.payload.remiDetailLocalData);
|
|
143
141
|
draft.editRemiStateById[reimbursementId].reimbursementId =
|
|
144
142
|
reimbursementId;
|
|
145
143
|
}
|
|
146
144
|
else {
|
|
147
|
-
draft.newRemiState.remiDetailLocalData = Object.assign({}, draft.newRemiState.remiDetailLocalData, action.payload.remiDetailLocalData);
|
|
145
|
+
draft.newRemiState.remiDetailLocalData = Object.assign(Object.assign({}, draft.newRemiState.remiDetailLocalData), action.payload.remiDetailLocalData);
|
|
148
146
|
}
|
|
149
147
|
},
|
|
150
148
|
updatesPaymentToInLocalStore(draft, action) {
|
|
@@ -153,17 +151,14 @@ const editRemiView = (0, toolkit_1.createSlice)({
|
|
|
153
151
|
if (shouldOverWriteCurrentBankAccountId ||
|
|
154
152
|
draft.editRemiStateById[reimbursementId].remiDetailLocalData
|
|
155
153
|
.paymentTo == null) {
|
|
156
|
-
draft.editRemiStateById[reimbursementId].remiDetailLocalData =
|
|
157
|
-
Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData, { paymentTo: bankAccountId });
|
|
154
|
+
draft.editRemiStateById[reimbursementId].remiDetailLocalData = Object.assign(Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData), { paymentTo: bankAccountId });
|
|
158
155
|
}
|
|
159
156
|
draft.editRemiStateById[reimbursementId].reimbursementId =
|
|
160
157
|
reimbursementId;
|
|
161
158
|
}
|
|
162
|
-
else
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
draft.newRemiState.remiDetailLocalData = Object.assign({}, draft.newRemiState.remiDetailLocalData, { paymentTo: bankAccountId });
|
|
166
|
-
}
|
|
159
|
+
else if (shouldOverWriteCurrentBankAccountId ||
|
|
160
|
+
draft.newRemiState.remiDetailLocalData.paymentTo == null) {
|
|
161
|
+
draft.newRemiState.remiDetailLocalData = Object.assign(Object.assign({}, draft.newRemiState.remiDetailLocalData), { paymentTo: bankAccountId });
|
|
167
162
|
}
|
|
168
163
|
},
|
|
169
164
|
discardRemiUpdatesInLocalStore(draft, action) {
|
|
@@ -284,11 +279,10 @@ const editRemiView = (0, toolkit_1.createSlice)({
|
|
|
284
279
|
updateAddRemiAutoFields(draft, action) {
|
|
285
280
|
const { reimbursementId, addRemiAutoFields } = action.payload;
|
|
286
281
|
if (reimbursementId != null) {
|
|
287
|
-
draft.editRemiStateById[reimbursementId].addRemiAutoFieldsByLineId =
|
|
288
|
-
Object.assign({}, draft.editRemiStateById[reimbursementId].addRemiAutoFieldsByLineId, addRemiAutoFields);
|
|
282
|
+
draft.editRemiStateById[reimbursementId].addRemiAutoFieldsByLineId = Object.assign(Object.assign({}, draft.editRemiStateById[reimbursementId].addRemiAutoFieldsByLineId), addRemiAutoFields);
|
|
289
283
|
}
|
|
290
284
|
else {
|
|
291
|
-
draft.newRemiState.addRemiAutoFieldsByLineId = Object.assign({}, draft.newRemiState.addRemiAutoFieldsByLineId, addRemiAutoFields);
|
|
285
|
+
draft.newRemiState.addRemiAutoFieldsByLineId = Object.assign(Object.assign({}, draft.newRemiState.addRemiAutoFieldsByLineId), addRemiAutoFields);
|
|
292
286
|
}
|
|
293
287
|
},
|
|
294
288
|
updateHomeCurrencyConversion(draft, action) {
|
|
@@ -368,19 +362,12 @@ const doUpdateRecommendationForEntity = (draft, lineId, recommendations, shouldA
|
|
|
368
362
|
const { recommendedAccount } = (0, initializeRemiToLocalStoreEpic_1.getRecommendedCategoryClass)(recommendations, lineAccount, lineClass);
|
|
369
363
|
// autofill the account with recommendedAccount and set isCategoryFirstTimeAutofilled as true
|
|
370
364
|
if (shouldAutofill) {
|
|
371
|
-
draft.editRemiStateById[reimbursementId].remiDetailLocalData.updatesByLineId[lineId] = Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData
|
|
372
|
-
.updatesByLineId[lineId], {
|
|
373
|
-
|
|
374
|
-
recommendedAccount,
|
|
375
|
-
isCategoryUpdateSelected: false,
|
|
376
|
-
isCategoryFirstTimeAutofilled: true,
|
|
377
|
-
});
|
|
365
|
+
draft.editRemiStateById[reimbursementId].remiDetailLocalData.updatesByLineId[lineId] = Object.assign(Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData
|
|
366
|
+
.updatesByLineId[lineId]), { recommendations,
|
|
367
|
+
recommendedAccount, isCategoryUpdateSelected: false, isCategoryFirstTimeAutofilled: true });
|
|
378
368
|
//autofilling account with recommendedAccount
|
|
379
|
-
draft.editRemiStateById[reimbursementId].remiDetailLocalData.updatesByLineId[lineId].lineDetail =
|
|
380
|
-
|
|
381
|
-
.updatesByLineId[lineId].lineDetail, {
|
|
382
|
-
account: recommendedAccount,
|
|
383
|
-
});
|
|
369
|
+
draft.editRemiStateById[reimbursementId].remiDetailLocalData.updatesByLineId[lineId].lineDetail = Object.assign(Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData
|
|
370
|
+
.updatesByLineId[lineId].lineDetail), { account: recommendedAccount });
|
|
384
371
|
//add account to addRemiAutoFieldsByLineId, since account was autofilled
|
|
385
372
|
if (!((_c = draft.editRemiStateById[reimbursementId].addRemiAutoFieldsByLineId[lineId]) === null || _c === void 0 ? void 0 : _c.includes('account')) &&
|
|
386
373
|
(recommendedAccount === null || recommendedAccount === void 0 ? void 0 : recommendedAccount.accountId) != null) {
|
|
@@ -395,11 +382,8 @@ const doUpdateRecommendationForEntity = (draft, lineId, recommendations, shouldA
|
|
|
395
382
|
}
|
|
396
383
|
// show retain checkbox only in pending approval
|
|
397
384
|
if (reimbursementStageCode === 'pending_approval') {
|
|
398
|
-
draft.editRemiStateById[reimbursementId].remiDetailLocalData.updatesByLineId[lineId] = Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData
|
|
399
|
-
.updatesByLineId[lineId], {
|
|
400
|
-
retainedAccount: recommendedAccount != null ? lineAccount : undefined,
|
|
401
|
-
isRetainedCategorySelected: false, //retain checkbox is selected
|
|
402
|
-
});
|
|
385
|
+
draft.editRemiStateById[reimbursementId].remiDetailLocalData.updatesByLineId[lineId] = Object.assign(Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData
|
|
386
|
+
.updatesByLineId[lineId]), { retainedAccount: recommendedAccount != null ? lineAccount : undefined, isRetainedCategorySelected: false });
|
|
403
387
|
}
|
|
404
388
|
}
|
|
405
389
|
}
|
|
@@ -412,17 +396,11 @@ const doUpdateRecommendationForEntity = (draft, lineId, recommendations, shouldA
|
|
|
412
396
|
const { recommendedAccount } = (0, initializeRemiToLocalStoreEpic_1.getRecommendedCategoryClass)(recommendations, lineAccount, lineClass);
|
|
413
397
|
// autofill the account with recommendedAccount and set isCategoryFirstTimeAutofilled as true
|
|
414
398
|
if (shouldAutofill) {
|
|
415
|
-
draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId] =
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
isCategoryFirstTimeAutofilled: true,
|
|
421
|
-
});
|
|
422
|
-
draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId].lineDetail = Object.assign({}, draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId]
|
|
423
|
-
.lineDetail, {
|
|
424
|
-
account: recommendedAccount,
|
|
425
|
-
}); //add account to addRemiAutoFieldsByLineId, since account was autofilled
|
|
399
|
+
draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId] = Object.assign(Object.assign({}, draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId]), { recommendations,
|
|
400
|
+
recommendedAccount, isCategoryUpdateSelected: false, isCategoryFirstTimeAutofilled: true });
|
|
401
|
+
draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId].lineDetail = Object.assign(Object.assign({}, draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId]
|
|
402
|
+
.lineDetail), { account: recommendedAccount });
|
|
403
|
+
//add account to addRemiAutoFieldsByLineId, since account was autofilled
|
|
426
404
|
if (!((_f = draft.newRemiState.addRemiAutoFieldsByLineId[lineId]) === null || _f === void 0 ? void 0 : _f.includes('account')) &&
|
|
427
405
|
(recommendedAccount === null || recommendedAccount === void 0 ? void 0 : recommendedAccount.accountId) != null) {
|
|
428
406
|
if (draft.newRemiState.addRemiAutoFieldsByLineId[lineId] != null) {
|
|
@@ -24,7 +24,7 @@ export interface EditRemiDetailSelectorView extends BankAccountSelectorView, Sel
|
|
|
24
24
|
remiId: ID | undefined;
|
|
25
25
|
whatForSection: WhatForSection;
|
|
26
26
|
achSameDayMaxDays: number;
|
|
27
|
-
lineDetailSection: Record<ID,
|
|
27
|
+
lineDetailSection: Record<ID, ReimbursementLineWithAttachmentAndRecommendation>;
|
|
28
28
|
currencyConversionStatus: Record<ID, FetchStateAndError>;
|
|
29
29
|
paymentTo?: string;
|
|
30
30
|
accountList: AccountListSelectorView;
|
|
@@ -56,7 +56,7 @@ export interface EditRemiDetailSelectorView extends BankAccountSelectorView, Sel
|
|
|
56
56
|
}
|
|
57
57
|
export interface EditRemiInitialDetails {
|
|
58
58
|
whatForSection?: WhatForSection;
|
|
59
|
-
lineDetailSection: Record<ID,
|
|
59
|
+
lineDetailSection: Record<ID, ReimbursementLineWithAttachment>;
|
|
60
60
|
paymentTo?: ID;
|
|
61
61
|
}
|
|
62
62
|
export declare type ReimbursementLineWithAttachment = ReimbursementLine & {
|
|
@@ -77,9 +77,7 @@ const getEditRemiDetail = (state, reimbursementId) => {
|
|
|
77
77
|
};
|
|
78
78
|
const updatesByLineId = {};
|
|
79
79
|
(_e = reimbursement === null || reimbursement === void 0 ? void 0 : reimbursement.lines) === null || _e === void 0 ? void 0 : _e.forEach((line) => {
|
|
80
|
-
updatesByLineId[line.lineId] = Object.assign({}, line, {
|
|
81
|
-
file: reimbursement.attachments.find((attachment) => attachment.fileId === line.fileId),
|
|
82
|
-
});
|
|
80
|
+
updatesByLineId[line.lineId] = Object.assign(Object.assign({}, line), { file: reimbursement.attachments.find((attachment) => attachment.fileId === line.fileId) });
|
|
83
81
|
});
|
|
84
82
|
editRemiInitialDetails = {
|
|
85
83
|
whatForSection: initialWhatForSection,
|
|
@@ -120,27 +118,30 @@ const getEditRemiDetail = (state, reimbursementId) => {
|
|
|
120
118
|
const lineDetailSectionUpdatesByLineId = (_k = (_j = sourceRemiDetail === null || sourceRemiDetail === void 0 ? void 0 : sourceRemiDetail.remiDetailLocalData) === null || _j === void 0 ? void 0 : _j.updatesByLineId) !== null && _k !== void 0 ? _k : {};
|
|
121
119
|
const currencyConversionStatus = (_m = (_l = sourceRemiDetail === null || sourceRemiDetail === void 0 ? void 0 : sourceRemiDetail.remiDetailLocalData) === null || _l === void 0 ? void 0 : _l.currencyConversionStateByLineId) !== null && _m !== void 0 ? _m : {};
|
|
122
120
|
Object.keys(lineDetailSectionUpdatesByLineId).forEach((lineId) => {
|
|
123
|
-
var _a, _b, _c;
|
|
124
|
-
lineDetailSection[lineId] = Object.assign({}, lineDetailSectionUpdatesByLineId[lineId], {
|
|
125
|
-
file: (_a = sourceRemiDetail.remiDetailLocalData.files) === null || _a === void 0 ? void 0 : _a.find((attachment) => attachment.fileId ===
|
|
126
|
-
lineDetailSectionUpdatesByLineId[lineId].fileId),
|
|
127
|
-
});
|
|
121
|
+
var _a, _b, _c, _d, _e, _f;
|
|
128
122
|
if (lineDetailSectionUpdatesByLineId[lineId].type === 'out_of_pocket') {
|
|
129
|
-
const merchantId = (
|
|
130
|
-
const merchantName = (
|
|
123
|
+
const merchantId = (_a = lineDetailSectionUpdatesByLineId[lineId].merchant) === null || _a === void 0 ? void 0 : _a.id;
|
|
124
|
+
const merchantName = (_b = lineDetailSectionUpdatesByLineId[lineId].merchant) === null || _b === void 0 ? void 0 : _b.name;
|
|
131
125
|
if (Boolean(merchantId) === true) {
|
|
132
126
|
const { fetchState } = (0, recommendationSelector_1.getRecommendationsForEntity)(state, merchantId, 'merchant');
|
|
133
|
-
lineDetailSection[lineId] = Object.assign({},
|
|
134
|
-
|
|
135
|
-
});
|
|
127
|
+
lineDetailSection[lineId] = Object.assign(Object.assign({}, lineDetailSectionUpdatesByLineId[lineId]), { file: (_c = sourceRemiDetail.remiDetailLocalData.files) === null || _c === void 0 ? void 0 : _c.find((attachment) => attachment.fileId ===
|
|
128
|
+
lineDetailSectionUpdatesByLineId[lineId].fileId), recommendationFetchState: fetchState });
|
|
136
129
|
}
|
|
137
130
|
else if (Boolean(merchantName) === true) {
|
|
138
131
|
const { fetchState } = (0, recommendationSelector_1.getRecommendationsForEntity)(state, merchantName, 'merchant');
|
|
139
|
-
lineDetailSection[lineId] = Object.assign({},
|
|
140
|
-
|
|
141
|
-
|
|
132
|
+
lineDetailSection[lineId] = Object.assign(Object.assign({}, lineDetailSectionUpdatesByLineId[lineId]), { file: (_d = sourceRemiDetail.remiDetailLocalData.files) === null || _d === void 0 ? void 0 : _d.find((attachment) => attachment.fileId ===
|
|
133
|
+
lineDetailSectionUpdatesByLineId[lineId].fileId), recommendationFetchState: fetchState });
|
|
134
|
+
}
|
|
135
|
+
//merchant is not detected
|
|
136
|
+
else {
|
|
137
|
+
lineDetailSection[lineId] = Object.assign(Object.assign({}, lineDetailSectionUpdatesByLineId[lineId]), { file: (_e = sourceRemiDetail.remiDetailLocalData.files) === null || _e === void 0 ? void 0 : _e.find((attachment) => attachment.fileId ===
|
|
138
|
+
lineDetailSectionUpdatesByLineId[lineId].fileId), recommendationFetchState: 'Not-Started' });
|
|
142
139
|
}
|
|
143
140
|
}
|
|
141
|
+
else {
|
|
142
|
+
lineDetailSection[lineId] = Object.assign(Object.assign({}, lineDetailSectionUpdatesByLineId[lineId]), { file: (_f = sourceRemiDetail.remiDetailLocalData.files) === null || _f === void 0 ? void 0 : _f.find((attachment) => attachment.fileId ===
|
|
143
|
+
lineDetailSectionUpdatesByLineId[lineId].fileId), recommendationFetchState: 'Not-Started' });
|
|
144
|
+
}
|
|
144
145
|
});
|
|
145
146
|
const paymentTo = (_o = sourceRemiDetail === null || sourceRemiDetail === void 0 ? void 0 : sourceRemiDetail.remiDetailLocalData) === null || _o === void 0 ? void 0 : _o.paymentTo;
|
|
146
147
|
const paymentToBankAccountDetail = paymentTo != null
|
|
@@ -14,7 +14,7 @@ export interface EditRemiDetail {
|
|
|
14
14
|
remiDetailLocalData: RemiDetailLocalData;
|
|
15
15
|
}
|
|
16
16
|
export declare const initialRemiDetail: EditRemiDetail;
|
|
17
|
-
export interface OutofPocketReimbursementLineWithRecommendation extends OutofPocketReimbursementLine {
|
|
17
|
+
export interface OutofPocketReimbursementLineWithRecommendation extends Partial<OutofPocketReimbursementLine> {
|
|
18
18
|
recommendations: Recommendation[];
|
|
19
19
|
recommendedAccount?: RecommendedAccountBase;
|
|
20
20
|
isCategoryUpdateSelected: boolean;
|
|
@@ -22,14 +22,14 @@ export interface OutofPocketReimbursementLineWithRecommendation extends OutofPoc
|
|
|
22
22
|
retainedAccount?: AccountBase;
|
|
23
23
|
isRetainedCategorySelected: boolean;
|
|
24
24
|
}
|
|
25
|
-
export declare type ReimbursementLineWithRecommendation = MilageReimbursementLine | OutofPocketReimbursementLineWithRecommendation;
|
|
25
|
+
export declare type ReimbursementLineWithRecommendation = Partial<MilageReimbursementLine> | OutofPocketReimbursementLineWithRecommendation;
|
|
26
26
|
export interface EditRemiDetailViewState {
|
|
27
27
|
newRemiState: EditRemiDetail;
|
|
28
28
|
editRemiStateById: Record<ID, EditRemiDetail>;
|
|
29
29
|
}
|
|
30
30
|
export interface RemiDetailLocalData {
|
|
31
31
|
whatForSection?: WhatForSection;
|
|
32
|
-
updatesByLineId: Record<ID,
|
|
32
|
+
updatesByLineId: Record<ID, ReimbursementLineWithRecommendation>;
|
|
33
33
|
currencyConversionStateByLineId: Record<ID, FetchStateAndError>;
|
|
34
34
|
totalAmount?: Amount;
|
|
35
35
|
files?: Attachment[];
|
|
@@ -15,7 +15,7 @@ state$) => actions$.pipe((0, operators_1.filter)(editRemiViewReducer_1.fetchRemi
|
|
|
15
15
|
const { reimbursementId, cacheOverride, isShowDeletedReimbursementEnabled, } = action.payload;
|
|
16
16
|
const state = state$.value;
|
|
17
17
|
const remiDetailActions = [];
|
|
18
|
-
if (cacheOverride
|
|
18
|
+
if (cacheOverride) {
|
|
19
19
|
remiDetailActions.push((0, remiDetailViewReducer_1.fetchRemiDetail)(reimbursementId, true, isShowDeletedReimbursementEnabled));
|
|
20
20
|
remiDetailActions.push(
|
|
21
21
|
//https://stackoverflow.com/questions/42276419/invoking-epics-from-within-other-epics
|
package/lib/view/spendManagement/reimbursement/editRemiView/epics/parseReceiptsToRemiEpic.js
CHANGED
|
@@ -20,7 +20,7 @@ const parseReceiptsToRemiEpic = (actions$, state$) => actions$.pipe((0, operator
|
|
|
20
20
|
: state.editRemiDetailViewState.newRemiState;
|
|
21
21
|
const loggedInUserDepartmentId = (_a = (0, tenantSelector_1.getCurrentTenant)(state).accountingClassIDs) === null || _a === void 0 ? void 0 : _a[0];
|
|
22
22
|
const newUpdatesByLineId = Object.assign({}, remiState.remiDetailLocalData.updatesByLineId);
|
|
23
|
-
if (shouldOverwrite
|
|
23
|
+
if (shouldOverwrite === false) {
|
|
24
24
|
let currentLineId = lineId;
|
|
25
25
|
receiptsProcessingPayload.receipts.forEach((receipt) => {
|
|
26
26
|
var _a;
|
|
@@ -58,7 +58,7 @@ const parseReceiptsToRemiEpic = (actions$, state$) => actions$.pipe((0, operator
|
|
|
58
58
|
if (parsedMerchantName != null && parsedMerchantName.length > 0) {
|
|
59
59
|
finalMerchant = merchants.filter((merchant) => merchant.name.toLowerCase() === parsedMerchantName.toLowerCase())[0];
|
|
60
60
|
}
|
|
61
|
-
newUpdatesByLineId[currentLineId] = toUpdateLine(state.accountState, state.classState, receipt, currentLineId, finalMerchant, loggedInUserDepartmentId);
|
|
61
|
+
newUpdatesByLineId[currentLineId] = Object.assign(Object.assign({}, toUpdateLine(state.accountState, state.classState, receipt, currentLineId, finalMerchant, loggedInUserDepartmentId)), { recommendations: [], isCategoryUpdateSelected: false, isCategoryFirstTimeAutofilled: false, isRetainedCategorySelected: false });
|
|
62
62
|
if (receipt.currency_code !== 'USD') {
|
|
63
63
|
currencyConversionActions.push((0, editRemiViewReducer_1.fetchCurrencyConversionValue)('USD', currentLineId.toString(), reimbursementId));
|
|
64
64
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.25",
|
|
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",
|