@zeniai/client-epic-state 5.1.59 → 5.1.60
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/esm/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js +0 -1
- package/lib/esm/view/commonVendorView/transactionVendorView/transactionVendorViewReducer.js +1 -2
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -3
- package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +2 -3
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +4 -4
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/initializeTransactionCategorizationLocalDataEpic.js +2 -4
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscategorizedEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/saveTransactionCategorizationEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/triggerReviewTabRefetchEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewReducer.js +3 -4
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +14 -25
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +21 -32
- package/lib/esm/view/recommendation/fetchEntityRecommendationsByTransactionIdEpic.js +2 -2
- package/lib/esm/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +2 -2
- package/lib/esm/view/recommendation/recommendationReducer.js +1 -2
- package/lib/esm/view/transactionDetail/epics/saveTransactionDetailEpic.js +2 -2
- package/lib/esm/view/transactionDetail/epics/updateTransactionDetailEpic.js +2 -2
- package/lib/esm/view/transactionDetail/transactionDetailReducer.js +1 -2
- package/lib/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js +0 -1
- package/lib/view/commonVendorView/transactionVendorView/transactionVendorViewReducer.d.ts +1 -2
- package/lib/view/commonVendorView/transactionVendorView/transactionVendorViewReducer.js +1 -2
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -3
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +2 -3
- package/lib/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +4 -4
- package/lib/view/expenseAutomationView/epics/transactionCategorization/initializeTransactionCategorizationLocalDataEpic.js +2 -4
- package/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscategorizedEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/saveTransactionCategorizationEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/triggerReviewTabRefetchEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +2 -2
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -5
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +3 -4
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +5 -5
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +14 -25
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +10 -23
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +21 -32
- package/lib/view/recommendation/fetchEntityRecommendationsByTransactionIdEpic.js +2 -2
- package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +2 -2
- package/lib/view/recommendation/recommendationReducer.d.ts +1 -3
- package/lib/view/recommendation/recommendationReducer.js +1 -2
- package/lib/view/transactionDetail/epics/saveTransactionDetailEpic.js +2 -2
- package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +2 -2
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +1 -3
- package/lib/view/transactionDetail/transactionDetailReducer.js +1 -2
- package/package.json +1 -1
|
@@ -121,7 +121,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
121
121
|
reducers: {
|
|
122
122
|
fetchTransactionCategorizationView: {
|
|
123
123
|
prepare(selectedTab, period, cacheOverride = false, keepExistingListItems = false, searchString, // when this is defined the output should go to search result IDs
|
|
124
|
-
pageToken, refreshViewInBackground = false, resetListItems = false
|
|
124
|
+
pageToken, refreshViewInBackground = false, resetListItems = false) {
|
|
125
125
|
return {
|
|
126
126
|
payload: {
|
|
127
127
|
selectedTab,
|
|
@@ -132,7 +132,6 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
132
132
|
cacheOverride,
|
|
133
133
|
refreshViewInBackground,
|
|
134
134
|
resetListItems,
|
|
135
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
136
135
|
},
|
|
137
136
|
};
|
|
138
137
|
},
|
|
@@ -200,7 +199,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
200
199
|
}
|
|
201
200
|
},
|
|
202
201
|
prepare(selectedTab, period, cacheOverride = false, keepExistingListItems = false, searchString, // when this is defined the output should go to search result IDs
|
|
203
|
-
pageToken, refreshViewInBackground = false, resetListItems
|
|
202
|
+
pageToken, refreshViewInBackground = false, resetListItems) {
|
|
204
203
|
return {
|
|
205
204
|
payload: {
|
|
206
205
|
selectedTab,
|
|
@@ -211,13 +210,12 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
211
210
|
cacheOverride,
|
|
212
211
|
refreshViewInBackground,
|
|
213
212
|
resetListItems,
|
|
214
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
215
213
|
},
|
|
216
214
|
};
|
|
217
215
|
},
|
|
218
216
|
},
|
|
219
217
|
initializeTransactionCategorizationViewLocalData: {
|
|
220
|
-
prepare(selectedTab, transactionIds, selectedPeriod, keepExistingListItems = false, pageToken, totalCount, lineItemsByTransactionIds, refreshViewInBackground = false
|
|
218
|
+
prepare(selectedTab, transactionIds, selectedPeriod, keepExistingListItems = false, pageToken, totalCount, lineItemsByTransactionIds, refreshViewInBackground = false) {
|
|
221
219
|
return {
|
|
222
220
|
payload: {
|
|
223
221
|
selectedTab,
|
|
@@ -228,7 +226,6 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
228
226
|
totalCount,
|
|
229
227
|
lineItemsByTransactionIds,
|
|
230
228
|
refreshViewInBackground,
|
|
231
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
232
229
|
},
|
|
233
230
|
};
|
|
234
231
|
},
|
|
@@ -332,13 +329,12 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
332
329
|
});
|
|
333
330
|
},
|
|
334
331
|
saveTransactionCategorization: {
|
|
335
|
-
prepare(selectedTab, transactionIds, cotTrackingByTransactionId
|
|
332
|
+
prepare(selectedTab, transactionIds, cotTrackingByTransactionId) {
|
|
336
333
|
return {
|
|
337
334
|
payload: {
|
|
338
335
|
selectedTab,
|
|
339
336
|
transactionIds,
|
|
340
337
|
cotTrackingByTransactionId,
|
|
341
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
342
338
|
},
|
|
343
339
|
};
|
|
344
340
|
},
|
|
@@ -412,21 +408,20 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
412
408
|
fetchState: 'In-Progress',
|
|
413
409
|
};
|
|
414
410
|
},
|
|
415
|
-
prepare(selectedTab, transactionIds, transactionSaveUpdates, cotTrackingByTransactionId
|
|
411
|
+
prepare(selectedTab, transactionIds, transactionSaveUpdates, cotTrackingByTransactionId) {
|
|
416
412
|
return {
|
|
417
413
|
payload: {
|
|
418
414
|
selectedTab,
|
|
419
415
|
transactionIds,
|
|
420
416
|
transactionSaveUpdates,
|
|
421
417
|
cotTrackingByTransactionId,
|
|
422
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
423
418
|
},
|
|
424
419
|
};
|
|
425
420
|
},
|
|
426
421
|
},
|
|
427
422
|
setAllItemsToCategoryClassInLocalDataForCategorization: {
|
|
428
423
|
reducer(draft, action) {
|
|
429
|
-
const { vendorId, customerId, selectedAccount, selectedClassBase, selectedProjectBase, transactions, transactionId, lineId, selectedTab,
|
|
424
|
+
const { vendorId, customerId, selectedAccount, selectedClassBase, selectedProjectBase, transactions, transactionId, lineId, selectedTab, isAccountingClassesEnabled, } = action.payload;
|
|
430
425
|
const transactionLocalData = recordGet(draft.transactionCategorizationView[selectedTab]
|
|
431
426
|
.transactionReviewLocalDataById, transactionId, undefined);
|
|
432
427
|
const existingAccount = transactionLocalData?.transactionReviewLocalData.lineItemById[lineId]
|
|
@@ -452,7 +447,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
452
447
|
const selectedCheckBoxTransactionIds = draft.transactionCategorizationView[selectedTab]
|
|
453
448
|
.selectedCheckBoxTransactionIds;
|
|
454
449
|
if (selectedTransaction != null &&
|
|
455
|
-
shouldAutoSelectAndAdd(selectedTransaction, newTransactionLocalData, selectedCheckBoxTransactionIds,
|
|
450
|
+
shouldAutoSelectAndAdd(selectedTransaction, newTransactionLocalData, selectedCheckBoxTransactionIds, isAccountingClassesEnabled)) {
|
|
456
451
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = [
|
|
457
452
|
...selectedCheckBoxTransactionIds,
|
|
458
453
|
transactionId,
|
|
@@ -475,7 +470,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
475
470
|
: existingProjectId !== selectedProjectBase?.projectId
|
|
476
471
|
? 'project'
|
|
477
472
|
: 'class';
|
|
478
|
-
const { localData, similarTransactionUpdated } = toSetAllLineItemsToCategoryClass(draft.transactionCategorizationView[selectedTab], transaction, transactionId, lineId, transactionLocalData.transactionReviewLocalData, updatedItem,
|
|
473
|
+
const { localData, similarTransactionUpdated } = toSetAllLineItemsToCategoryClass(draft.transactionCategorizationView[selectedTab], transaction, transactionId, lineId, transactionLocalData.transactionReviewLocalData, updatedItem, selectedTab, vendorId, customerId, selectedAccount, selectedClassBase, selectedProjectBase, isAccountingClassesEnabled);
|
|
479
474
|
draft.transactionCategorizationView[selectedTab].transactionReviewLocalDataById[transaction.id] = {
|
|
480
475
|
transactionId: transaction.id,
|
|
481
476
|
transactionReviewLocalData: localData,
|
|
@@ -494,7 +489,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
494
489
|
...dirtyIds,
|
|
495
490
|
]);
|
|
496
491
|
},
|
|
497
|
-
prepare(selectedTab, transactionId, lineId, transactions, uncategorizedAccounts, vendorId, customerId, selectedAccount, selectedClassBase, lineEntity, recommendations,
|
|
492
|
+
prepare(selectedTab, transactionId, lineId, transactions, uncategorizedAccounts, vendorId, customerId, selectedAccount, selectedClassBase, lineEntity, recommendations, isAccountingClassesEnabled, selectedProjectBase) {
|
|
498
493
|
return {
|
|
499
494
|
payload: {
|
|
500
495
|
selectedTab,
|
|
@@ -510,13 +505,12 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
510
505
|
recommendations,
|
|
511
506
|
uncategorizedAccounts,
|
|
512
507
|
isAccountingClassesEnabled,
|
|
513
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
514
508
|
},
|
|
515
509
|
};
|
|
516
510
|
},
|
|
517
511
|
},
|
|
518
512
|
setEntityRecommendationForLineIdsForCategorization: {
|
|
519
|
-
prepare(selectedTab, transactionId, transaction, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedAccounts,
|
|
513
|
+
prepare(selectedTab, transactionId, transaction, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedAccounts, isAccountingClassesEnabled) {
|
|
520
514
|
return {
|
|
521
515
|
payload: {
|
|
522
516
|
selectedTab,
|
|
@@ -528,16 +522,15 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
528
522
|
recommendationWithCOTByLineId,
|
|
529
523
|
uncategorizedAccounts,
|
|
530
524
|
isAccountingClassesEnabled,
|
|
531
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
532
525
|
},
|
|
533
526
|
};
|
|
534
527
|
},
|
|
535
528
|
reducer(draft, action) {
|
|
536
|
-
const { entity, transaction, transactionId, selectedTab, lineIds,
|
|
529
|
+
const { entity, transaction, transactionId, selectedTab, lineIds, isAccountingClassesEnabled, } = action.payload;
|
|
537
530
|
const transactionLocalData = recordGet(draft.transactionCategorizationView[selectedTab]
|
|
538
531
|
.transactionReviewLocalDataById, transactionId.id, undefined);
|
|
539
532
|
if (transactionLocalData != null) {
|
|
540
|
-
const newLocalData = setEntityRecommendationForLineIdInLocalData(draft.transactionCategorizationView[selectedTab], transaction, transactionLocalData.transactionReviewLocalData, entity, lineIds,
|
|
533
|
+
const newLocalData = setEntityRecommendationForLineIdInLocalData(draft.transactionCategorizationView[selectedTab], transaction, transactionLocalData.transactionReviewLocalData, entity, lineIds, action.payload.recommendationWithCOTByLineId, isAccountingClassesEnabled);
|
|
541
534
|
// Release the per-line fetch flag for every line this fetch
|
|
542
535
|
// covered. Done in-place on the freshly returned local data
|
|
543
536
|
// (the helper produces a new mutable object), before we write
|
|
@@ -710,7 +703,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
710
703
|
action.payload.status;
|
|
711
704
|
},
|
|
712
705
|
updateSelectedCustomerForTransaction(draft, action) {
|
|
713
|
-
const { transactionId, lineId, updatedCustomer, selectedTransaction, selectedTab,
|
|
706
|
+
const { transactionId, lineId, updatedCustomer, selectedTransaction, selectedTab, isAccountingClassesEnabled, } = action.payload;
|
|
714
707
|
const transactionLocalData = recordGet(draft.transactionCategorizationView[selectedTab]
|
|
715
708
|
.transactionReviewLocalDataById, transactionId, undefined);
|
|
716
709
|
if (transactionLocalData != null) {
|
|
@@ -763,7 +756,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
763
756
|
.selectedCheckBoxTransactionIds;
|
|
764
757
|
if (newTransactionLocalData.customer != null &&
|
|
765
758
|
newTransactionLocalData.customer.id != null &&
|
|
766
|
-
shouldAutoSelectAndAdd(selectedTransaction, newTransactionLocalData, selectedCheckBoxTransactionIds,
|
|
759
|
+
shouldAutoSelectAndAdd(selectedTransaction, newTransactionLocalData, selectedCheckBoxTransactionIds, isAccountingClassesEnabled)) {
|
|
767
760
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = [
|
|
768
761
|
...selectedCheckBoxTransactionIds,
|
|
769
762
|
transactionId,
|
|
@@ -780,7 +773,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
780
773
|
}
|
|
781
774
|
},
|
|
782
775
|
updateSelectedVendorForTransaction(draft, action) {
|
|
783
|
-
const { transactionId, lineId, updatedVendor, selectedTransaction, selectedTab,
|
|
776
|
+
const { transactionId, lineId, updatedVendor, selectedTransaction, selectedTab, isAccountingClassesEnabled, } = action.payload;
|
|
784
777
|
const transactionLocalData = recordGet(draft.transactionCategorizationView[selectedTab]
|
|
785
778
|
.transactionReviewLocalDataById, transactionId, undefined);
|
|
786
779
|
if (transactionLocalData != null) {
|
|
@@ -837,7 +830,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
837
830
|
.selectedCheckBoxTransactionIds;
|
|
838
831
|
if (newTransactionLocalData.vendor != null &&
|
|
839
832
|
newTransactionLocalData.vendor.id != null &&
|
|
840
|
-
shouldAutoSelectAndAdd(selectedTransaction, newTransactionLocalData, selectedCheckBoxTransactionIds,
|
|
833
|
+
shouldAutoSelectAndAdd(selectedTransaction, newTransactionLocalData, selectedCheckBoxTransactionIds, isAccountingClassesEnabled)) {
|
|
841
834
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = [
|
|
842
835
|
...selectedCheckBoxTransactionIds,
|
|
843
836
|
transactionId,
|
|
@@ -885,12 +878,11 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
885
878
|
error: undefined,
|
|
886
879
|
};
|
|
887
880
|
},
|
|
888
|
-
prepare(selectedTab, transactionsInReview
|
|
881
|
+
prepare(selectedTab, transactionsInReview) {
|
|
889
882
|
return {
|
|
890
883
|
payload: {
|
|
891
884
|
selectedTab,
|
|
892
885
|
transactionsInReview,
|
|
893
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
894
886
|
},
|
|
895
887
|
};
|
|
896
888
|
},
|
|
@@ -1000,19 +992,17 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
1000
992
|
},
|
|
1001
993
|
},
|
|
1002
994
|
syncTransactionCategorizationFromDetailSave: {
|
|
1003
|
-
prepare(transactionId, updatedTransaction, pendingReviewLineIds
|
|
995
|
+
prepare(transactionId, updatedTransaction, pendingReviewLineIds) {
|
|
1004
996
|
return {
|
|
1005
997
|
payload: {
|
|
1006
998
|
transactionId,
|
|
1007
999
|
updatedTransaction,
|
|
1008
1000
|
pendingReviewLineIds,
|
|
1009
|
-
uncategorizedIncomeExpense,
|
|
1010
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
1011
1001
|
},
|
|
1012
1002
|
};
|
|
1013
1003
|
},
|
|
1014
1004
|
reducer(draft, action) {
|
|
1015
|
-
const { transactionId, updatedTransaction, pendingReviewLineIds,
|
|
1005
|
+
const { transactionId, updatedTransaction, pendingReviewLineIds, } = action.payload;
|
|
1016
1006
|
const txnId = transactionId.id;
|
|
1017
1007
|
const reviewTabView = draft.transactionCategorizationView.review;
|
|
1018
1008
|
const autoTabView = draft.transactionCategorizationView.autoCategorized;
|
|
@@ -1034,7 +1024,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
1034
1024
|
}
|
|
1035
1025
|
// Partially reviewed: rebuild review tab local data with pending review lines
|
|
1036
1026
|
if (existsInReview) {
|
|
1037
|
-
const newLocalData = toTransactionDetailLocalData(updatedTransaction, 'review', pendingReviewLineIds
|
|
1027
|
+
const newLocalData = toTransactionDetailLocalData(updatedTransaction, 'review', pendingReviewLineIds);
|
|
1038
1028
|
reviewTabView.transactionReviewLocalDataById[txnId] = {
|
|
1039
1029
|
transactionId: txnId,
|
|
1040
1030
|
transactionReviewLocalData: {
|
|
@@ -1053,11 +1043,10 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
1053
1043
|
},
|
|
1054
1044
|
},
|
|
1055
1045
|
backgroundRefetchReviewTab: {
|
|
1056
|
-
prepare(period
|
|
1046
|
+
prepare(period) {
|
|
1057
1047
|
return {
|
|
1058
1048
|
payload: {
|
|
1059
1049
|
period,
|
|
1060
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
1061
1050
|
},
|
|
1062
1051
|
};
|
|
1063
1052
|
},
|
|
@@ -10,7 +10,7 @@ import { getActualTransactionID } from '../transactionDetail/transactionDetailSt
|
|
|
10
10
|
import { getRecommendationByLineIdWithCOTFromRecommendationPayloadWithCOT, getRecommendationFromRecommendationPayload, } from './recommendationHelper';
|
|
11
11
|
import { fetchEntityRecommendationsByTransactionId, updateRecommendationForEntity, updateRecommendationForEntityFailure, } from './recommendationReducer';
|
|
12
12
|
export const fetchEntityRecommendationsByTransactionIdEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchEntityRecommendationsByTransactionId.match), switchMap((action) => {
|
|
13
|
-
const { entity, amount, transactionDetails, isBulkFetch, isTransactionCategorizationFlow, isFetchCOT,
|
|
13
|
+
const { entity, amount, transactionDetails, isBulkFetch, isTransactionCategorizationFlow, isFetchCOT, } = action.payload;
|
|
14
14
|
const { expenseAutomationTransactionsViewState: { selectedTransactionCategorizationTab, }, } = state$.value;
|
|
15
15
|
const query = {
|
|
16
16
|
amount,
|
|
@@ -52,7 +52,7 @@ export const fetchEntityRecommendationsByTransactionIdEpic = (actions$, state$,
|
|
|
52
52
|
if (recommendationWithCOTByLineId != null) {
|
|
53
53
|
const uncategorizedIncomeExpense = getUncategorizedAccounts(state$.value.accountState, state$.value.accountListState, 'accountList');
|
|
54
54
|
if (isTransactionCategorizationFlow === true) {
|
|
55
|
-
actions.push(setEntityRecommendationForLineIdsForCategorization(selectedTransactionCategorizationTab, transactionId, transactionWithCOT, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedIncomeExpense,
|
|
55
|
+
actions.push(setEntityRecommendationForLineIdsForCategorization(selectedTransactionCategorizationTab, transactionId, transactionWithCOT, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedIncomeExpense, getIsAccountingClassesEnabled(state$.value)));
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
58
|
actions.push(setEntityRecommendationForLineIdsForTransactionDetail(transactionId, transactionWithCOT, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedIncomeExpense));
|
|
@@ -37,7 +37,7 @@ const toGroupKey = (flowType, transactionId, lineIds) => `${flowType}${SEPARATOR
|
|
|
37
37
|
export const fetchEntityRecommendationsForLineUpdateEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchEntityRecommendationsForLineUpdate.match), groupBy((action) => toGroupKey(action.payload.flowType, action.payload.transactionDetails.transactionId.id, action.payload.transactionDetails.lineIds), undefined, (group$) => group$.pipe(debounce(() => timer(GROUP_INACTIVITY_TIMEOUT_MS)))), mergeMap((group$) => group$.pipe(switchMap((action) => {
|
|
38
38
|
const payload = action.payload;
|
|
39
39
|
const { transactionId, transaction, lineIds } = payload.transactionDetails;
|
|
40
|
-
const { entity, amount, isFetchCOT,
|
|
40
|
+
const { entity, amount, isFetchCOT, } = payload;
|
|
41
41
|
// The vendor "Update all lines" popup on the detail page watches
|
|
42
42
|
// its own transaction-level fetch status, separate from the
|
|
43
43
|
// per-line statuses below — surface completion/failure there too
|
|
@@ -84,7 +84,7 @@ export const fetchEntityRecommendationsForLineUpdateEpic = (actions$, state$, ze
|
|
|
84
84
|
: getTransactionWithCOT(transaction);
|
|
85
85
|
const uncategorizedIncomeExpense = getUncategorizedAccounts(state$.value.accountState, state$.value.accountListState, 'accountList');
|
|
86
86
|
if (payload.flowType === 'categorization') {
|
|
87
|
-
return of(setEntityRecommendationForLineIdsForCategorization(payload.selectedTab, transactionId, transactionWithCOT, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedIncomeExpense,
|
|
87
|
+
return of(setEntityRecommendationForLineIdsForCategorization(payload.selectedTab, transactionId, transactionWithCOT, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedIncomeExpense, getIsAccountingClassesEnabled(state$.value)));
|
|
88
88
|
}
|
|
89
89
|
return emitWithBulkStatus(setEntityRecommendationForLineIdsForTransactionDetail(transactionId, transactionWithCOT, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedIncomeExpense), isBulkDetailFetch
|
|
90
90
|
? updateVendorBulkRecommendationsFetchStatus(transactionId, 'Completed')
|
|
@@ -19,7 +19,7 @@ const recommendation = createSlice({
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
-
prepare(entity, amount, transactionDetails, isBulkFetch, isTransactionCategorizationFlow = false, isFetchCOT = false
|
|
22
|
+
prepare(entity, amount, transactionDetails, isBulkFetch, isTransactionCategorizationFlow = false, isFetchCOT = false) {
|
|
23
23
|
return {
|
|
24
24
|
payload: {
|
|
25
25
|
entity,
|
|
@@ -28,7 +28,6 @@ const recommendation = createSlice({
|
|
|
28
28
|
isBulkFetch,
|
|
29
29
|
isTransactionCategorizationFlow,
|
|
30
30
|
isFetchCOT,
|
|
31
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
32
31
|
},
|
|
33
32
|
};
|
|
34
33
|
},
|
|
@@ -7,7 +7,7 @@ import { saveTransactionDetail, updateTransactionDetail, } from '../transactionD
|
|
|
7
7
|
import { getTransactionDetailKey } from '../transactionDetailState';
|
|
8
8
|
import { toTransactionUpdatesFromTransactionDetailLocalData } from './saveTransactionHelper';
|
|
9
9
|
export const saveTransactionDetailEpic = (actions$, state$) => actions$.pipe(filter(saveTransactionDetail.match), mergeMap((action) => {
|
|
10
|
-
const { transactionId, cotTransactionTracking, isExpenseAutomationEnabled,
|
|
10
|
+
const { transactionId, cotTransactionTracking, isExpenseAutomationEnabled, } = action.payload;
|
|
11
11
|
const fetchActions = [];
|
|
12
12
|
const transactionDetailState = state$.value.transactionDetailState;
|
|
13
13
|
const transactionState = state$.value.transactionState;
|
|
@@ -18,7 +18,7 @@ export const saveTransactionDetailEpic = (actions$, state$) => actions$.pipe(fil
|
|
|
18
18
|
if (detail != null && transaction != null) {
|
|
19
19
|
const localData = detail.transactionDetailLocalData;
|
|
20
20
|
const transactionSaveUpdates = toTransactionUpdatesFromTransactionDetailLocalData(localData, transaction, isExpenseAutomationEnabled, isAccountingProjectsEnabled);
|
|
21
|
-
fetchActions.push(updateTransactionDetail(transactionId, transactionSaveUpdates, isExpenseAutomationEnabled, cotTransactionTracking
|
|
21
|
+
fetchActions.push(updateTransactionDetail(transactionId, transactionSaveUpdates, isExpenseAutomationEnabled, cotTransactionTracking));
|
|
22
22
|
return from(fetchActions);
|
|
23
23
|
}
|
|
24
24
|
return from(fetchActions);
|
|
@@ -29,7 +29,7 @@ import { getTransactionDetailKey, } from '../transactionDetailState';
|
|
|
29
29
|
export const updateTransactionDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(updateTransactionDetail.match), mergeMap((action) => {
|
|
30
30
|
const { transactionState, vendorState, transactionDetailState } = state$.value;
|
|
31
31
|
const isAccountingProjectsEnabled = getIsAccountingProjectsEnabled(state$.value);
|
|
32
|
-
const { cotTransactionTracking, transactionId, transactionSaveUpdates,
|
|
32
|
+
const { cotTransactionTracking, transactionId, transactionSaveUpdates, } = action.payload;
|
|
33
33
|
return zeniAPI
|
|
34
34
|
.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/${action.payload.transactionId.id}/categorize`, preparePayload(transactionState, vendorState, transactionDetailState, transactionId, transactionSaveUpdates, cotTransactionTracking, isAccountingProjectsEnabled))
|
|
35
35
|
.pipe(mergeMap((response) => {
|
|
@@ -82,7 +82,7 @@ export const updateTransactionDetailEpic = (actions$, state$, zeniAPI) => action
|
|
|
82
82
|
actions.push(updateTransactions([response.data.transaction], (value) => value.transaction_id, 'merge'));
|
|
83
83
|
const transactionWithCOT = getTransactionWithCOT(transaction);
|
|
84
84
|
const pendingReviewLineIds = getPendingReviewLineIdsFromTransaction(transactionWithCOT);
|
|
85
|
-
actions.push(syncTransactionCategorizationFromDetailSave(transactionIdResp, transactionWithCOT, pendingReviewLineIds
|
|
85
|
+
actions.push(syncTransactionCategorizationFromDetailSave(transactionIdResp, transactionWithCOT, pendingReviewLineIds));
|
|
86
86
|
return from(actions);
|
|
87
87
|
}
|
|
88
88
|
else if (isActionNotAllowed(response)) {
|
|
@@ -105,14 +105,13 @@ const transactionDetail = createSlice({
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
|
-
prepare(transactionId, transactionSaveUpdates, isExpenseAutomationEnabled, cotTransactionTracking
|
|
108
|
+
prepare(transactionId, transactionSaveUpdates, isExpenseAutomationEnabled, cotTransactionTracking) {
|
|
109
109
|
return {
|
|
110
110
|
payload: {
|
|
111
111
|
transactionId,
|
|
112
112
|
transactionSaveUpdates,
|
|
113
113
|
isExpenseAutomationEnabled,
|
|
114
114
|
cotTransactionTracking,
|
|
115
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
116
115
|
},
|
|
117
116
|
};
|
|
118
117
|
},
|
|
@@ -110,7 +110,6 @@ const saveTransactionVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
110
110
|
transactionId: action.payload.transactionId,
|
|
111
111
|
isExpenseAutomationEnabled: action.payload.isExpenseAutomationEnabled,
|
|
112
112
|
cotTransactionTracking: [], // We don't need to pass COT tracking for vendor save
|
|
113
|
-
isUncategorizedExpenseCategoryEnabled: action.payload.isUncategorizedExpenseCategoryEnabled,
|
|
114
113
|
}));
|
|
115
114
|
}
|
|
116
115
|
return (0, rxjs_1.from)(actions);
|
|
@@ -6,12 +6,11 @@ export declare const initialVendorDetailLocalData: TransactionVendorLocalData;
|
|
|
6
6
|
export declare const initialState: TransactionVendorViewState;
|
|
7
7
|
export declare const updateVendorSaveStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
8
8
|
vendorId?: ID;
|
|
9
|
-
}, "transactionVendorView/updateVendorSaveStatus">, saveTransactionVendor: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId?: TransactionID | undefined, vendorId?: string | undefined, saveTransaction?: boolean | undefined, isExpenseAutomationEnabled?: any
|
|
9
|
+
}, "transactionVendorView/updateVendorSaveStatus">, saveTransactionVendor: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId?: TransactionID | undefined, vendorId?: string | undefined, saveTransaction?: boolean | undefined, isExpenseAutomationEnabled?: any], {
|
|
10
10
|
vendorId: string | undefined;
|
|
11
11
|
transactionId: TransactionID | undefined;
|
|
12
12
|
saveTransaction: boolean | undefined;
|
|
13
13
|
isExpenseAutomationEnabled: any;
|
|
14
|
-
isUncategorizedExpenseCategoryEnabled: boolean | undefined;
|
|
15
14
|
}, "transactionVendorView/saveTransactionVendor", never, never>, saveTransactionVendorSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[fetchState: FetchState, vendorId?: string | undefined, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
|
|
16
15
|
fetchState: FetchState;
|
|
17
16
|
vendorId: string | undefined;
|
|
@@ -48,14 +48,13 @@ const transactionVendorView = (0, toolkit_1.createSlice)({
|
|
|
48
48
|
draft.newVendorState.saveStatus.error = undefined;
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
|
-
prepare(transactionId, vendorId, saveTransaction, isExpenseAutomationEnabled = false
|
|
51
|
+
prepare(transactionId, vendorId, saveTransaction, isExpenseAutomationEnabled = false) {
|
|
52
52
|
return {
|
|
53
53
|
payload: {
|
|
54
54
|
vendorId,
|
|
55
55
|
transactionId,
|
|
56
56
|
saveTransaction,
|
|
57
57
|
isExpenseAutomationEnabled,
|
|
58
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
59
58
|
},
|
|
60
59
|
};
|
|
61
60
|
},
|
|
@@ -12,7 +12,7 @@ const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsView
|
|
|
12
12
|
const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
|
|
13
13
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
14
14
|
const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(expenseAutomationViewReducer_1.fetchAllExpenseAutomationTabs.match), (0, operators_1.switchMap)((action) => {
|
|
15
|
-
const { cacheOverride, refreshViewInBackground,
|
|
15
|
+
const { cacheOverride, refreshViewInBackground, } = action.payload;
|
|
16
16
|
const state = state$.value;
|
|
17
17
|
const { monthEndCloseChecksState } = state;
|
|
18
18
|
const { monthEndCloseChecksByTenantId } = monthEndCloseChecksState;
|
|
@@ -33,7 +33,7 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
|
|
|
33
33
|
}
|
|
34
34
|
if (cacheOverride === true) {
|
|
35
35
|
const actions = [];
|
|
36
|
-
actions.push((0, transactionsViewReducer_1.fetchTransactionCategorizationView)(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, cacheOverride, false, undefined, undefined, refreshViewInBackground, false
|
|
36
|
+
actions.push((0, transactionsViewReducer_1.fetchTransactionCategorizationView)(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, cacheOverride, false, undefined, undefined, refreshViewInBackground, false), (0, missingReceiptsViewReducer_1.fetchMissingReceipts)({ start: timePeriodStart, end: timePeriodEnd }, {
|
|
37
37
|
amount: 75.0,
|
|
38
38
|
currencyCode: 'USD',
|
|
39
39
|
currencySymbol: '$',
|
|
@@ -86,7 +86,7 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
|
|
|
86
86
|
(state.expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab].hasValidState() === false ||
|
|
87
87
|
state.expenseAutomationTransactionsViewState
|
|
88
88
|
.transactionCategorizationView[selectedTransactionCategorizationTab].transactionIdsBySelectedPeriod[monthYearPeriodId] == null)) {
|
|
89
|
-
fetchActions.push((0, transactionsViewReducer_1.fetchTransactionCategorizationView)(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, cacheOverride, false, undefined, undefined, refreshViewInBackground, false
|
|
89
|
+
fetchActions.push((0, transactionsViewReducer_1.fetchTransactionCategorizationView)(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, cacheOverride, false, undefined, undefined, refreshViewInBackground, false));
|
|
90
90
|
}
|
|
91
91
|
return (0, rxjs_1.from)(fetchActions);
|
|
92
92
|
}
|
package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js
CHANGED
|
@@ -12,8 +12,7 @@ const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer"
|
|
|
12
12
|
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
13
13
|
const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
|
|
14
14
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
15
|
-
const refreshExpenseAutomationCurrentTabEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(expenseAutomationViewReducer_1.refreshExpenseAutomationCurrentTab.match), (0, operators_1.switchMap)((
|
|
16
|
-
const { isUncategorizedExpenseCategoryEnabled } = action.payload;
|
|
15
|
+
const refreshExpenseAutomationCurrentTabEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(expenseAutomationViewReducer_1.refreshExpenseAutomationCurrentTab.match), (0, operators_1.switchMap)(() => {
|
|
17
16
|
const state = state$.value;
|
|
18
17
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
19
18
|
const companyId = currentTenant.companyId;
|
|
@@ -66,7 +65,7 @@ const refreshExpenseAutomationCurrentTabEpic = (actions$, state$) => actions$.pi
|
|
|
66
65
|
case 'transaction_categorization':
|
|
67
66
|
default:
|
|
68
67
|
return (0, rxjs_1.from)([
|
|
69
|
-
(0, transactionsViewReducer_1.fetchTransactionCategorizationView)(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, true, false, undefined, undefined, true, undefined
|
|
68
|
+
(0, transactionsViewReducer_1.fetchTransactionCategorizationView)(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, true, false, undefined, undefined, true, undefined),
|
|
70
69
|
]);
|
|
71
70
|
}
|
|
72
71
|
}));
|
|
@@ -13,7 +13,7 @@ const transactionsViewState_1 = require("../../types/transactionsViewState");
|
|
|
13
13
|
const SELECTED_TAB = 'review';
|
|
14
14
|
const PAGE_SIZE = 25;
|
|
15
15
|
const backgroundRefetchReviewTabEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.backgroundRefetchReviewTab.match), (0, operators_1.switchMap)((action) => {
|
|
16
|
-
const { period
|
|
16
|
+
const { period } = action.payload;
|
|
17
17
|
const state = state$.value;
|
|
18
18
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
19
19
|
const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
|
|
@@ -83,7 +83,7 @@ const backgroundRefetchReviewTabEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
83
83
|
pageToken: accumulated.finalPageToken,
|
|
84
84
|
},
|
|
85
85
|
}),
|
|
86
|
-
(0, transactionsViewReducer_1.initializeTransactionCategorizationViewLocalData)(SELECTED_TAB, transactionIds, selectedPeriod, false, accumulated.finalPageToken, accumulated.totalCount, lineItemsByTransactionIds, true
|
|
86
|
+
(0, transactionsViewReducer_1.initializeTransactionCategorizationViewLocalData)(SELECTED_TAB, transactionIds, selectedPeriod, false, accumulated.finalPageToken, accumulated.totalCount, lineItemsByTransactionIds, true),
|
|
87
87
|
(0, transactionsViewReducer_1.updateTotalCountForTransactionCategorization)({
|
|
88
88
|
selectedPeriod,
|
|
89
89
|
selectedTab: SELECTED_TAB,
|
|
@@ -76,7 +76,7 @@ const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) => action
|
|
|
76
76
|
pageToken: response.data.next_page_token ?? null,
|
|
77
77
|
},
|
|
78
78
|
}));
|
|
79
|
-
updateActions.push((0, transactionsViewReducer_1.initializeTransactionCategorizationViewLocalData)(selectedTab, transactionIds, selectedPeriod, keepExistingListItems, response.data.next_page_token ?? null, response.data.total_count, lineItemsByTransactionIds, refreshViewInBackground
|
|
79
|
+
updateActions.push((0, transactionsViewReducer_1.initializeTransactionCategorizationViewLocalData)(selectedTab, transactionIds, selectedPeriod, keepExistingListItems, response.data.next_page_token ?? null, response.data.total_count, lineItemsByTransactionIds, refreshViewInBackground));
|
|
80
80
|
updateActions.push((0, transactionsViewReducer_1.updateTotalCountForTransactionCategorization)({
|
|
81
81
|
selectedPeriod,
|
|
82
82
|
selectedTab,
|
|
@@ -12,7 +12,7 @@ const projectListReducer_1 = require("../../../projectList/projectListReducer");
|
|
|
12
12
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
13
13
|
const transactionsViewState_1 = require("../../types/transactionsViewState");
|
|
14
14
|
const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.fetchTransactionCategorizationView.match), (0, operators_1.mergeMap)((action) => {
|
|
15
|
-
const { selectedTab, cacheOverride, keepExistingListItems, pageToken, period, refreshViewInBackground, searchString, resetListItems,
|
|
15
|
+
const { selectedTab, cacheOverride, keepExistingListItems, pageToken, period, refreshViewInBackground, searchString, resetListItems, } = action.payload;
|
|
16
16
|
const updateActions = [];
|
|
17
17
|
const { expenseAutomationTransactionsViewState } = state$.value;
|
|
18
18
|
const { fetchState, transactionIdsBySelectedPeriod, uiState } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTab];
|
|
@@ -48,7 +48,7 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
|
|
|
48
48
|
fetchState === 'Not-Started' ||
|
|
49
49
|
transactionIds.length === 0 ||
|
|
50
50
|
uiState.searchString !== '') {
|
|
51
|
-
updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(selectedTab, period, cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, resetListItems
|
|
51
|
+
updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(selectedTab, period, cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, resetListItems));
|
|
52
52
|
}
|
|
53
53
|
// On the initial load of a tab (searchString undefined = non-search fetch),
|
|
54
54
|
// preload every other tab that hasn't been fetched yet for this period.
|
|
@@ -58,7 +58,7 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
|
|
|
58
58
|
transactionsViewState_1.TRANSACTIONS_TABS.filter((tab) => tab !== selectedTab).forEach((otherTab) => {
|
|
59
59
|
const otherTabFetchState = expenseAutomationTransactionsViewState.transactionCategorizationView[otherTab].fetchState;
|
|
60
60
|
if (otherTabFetchState === 'Not-Started') {
|
|
61
|
-
updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(otherTab, period, false, false, undefined, undefined, true, undefined
|
|
61
|
+
updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(otherTab, period, false, false, undefined, undefined, true, undefined));
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -71,7 +71,7 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
|
|
|
71
71
|
transactionsViewState_1.TRANSACTIONS_TABS.filter((tab) => tab !== selectedTab).forEach((otherTab) => {
|
|
72
72
|
const otherTabSearchString = expenseAutomationTransactionsViewState.transactionCategorizationView[otherTab].uiState.searchString;
|
|
73
73
|
if (searchString !== otherTabSearchString) {
|
|
74
|
-
updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(otherTab, period, true, keepExistingListItems, searchString, undefined, true, true
|
|
74
|
+
updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(otherTab, period, true, keepExistingListItems, searchString, undefined, true, true));
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
}
|
|
@@ -5,12 +5,11 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const transactionHelper_1 = require("../../../../entity/transaction/transactionHelper");
|
|
7
7
|
const transactionSelector_1 = require("../../../../entity/transaction/transactionSelector");
|
|
8
|
-
const accountListSelector_1 = require("../../../accountList/accountListSelector");
|
|
9
8
|
const transactionCategorizationLocalDataHelper_1 = require("../../helpers/transactionCategorizationLocalDataHelper");
|
|
10
9
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
11
10
|
const transactionsViewState_1 = require("../../types/transactionsViewState");
|
|
12
11
|
const initializeTransactionCategorizationViewLocalDataEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.initializeTransactionCategorizationViewLocalData.match), (0, operators_1.mergeMap)((action) => {
|
|
13
|
-
const { transactionIds, selectedPeriod, keepExistingListItems, selectedTab, pageToken, totalCount, lineItemsByTransactionIds, refreshViewInBackground,
|
|
12
|
+
const { transactionIds, selectedPeriod, keepExistingListItems, selectedTab, pageToken, totalCount, lineItemsByTransactionIds, refreshViewInBackground, } = action.payload;
|
|
14
13
|
const fetchActions = [];
|
|
15
14
|
const { transactionState, expenseAutomationTransactionsViewState } = state$.value;
|
|
16
15
|
const { transactionReviewLocalDataById } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTab];
|
|
@@ -18,10 +17,9 @@ const initializeTransactionCategorizationViewLocalDataEpic = (actions$, state$)
|
|
|
18
17
|
? { ...transactionReviewLocalDataById }
|
|
19
18
|
: {};
|
|
20
19
|
const transactions = (0, transactionSelector_1.getSupportedTransactionsByIds)(transactionState, transactionIds);
|
|
21
|
-
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(state$.value.accountState, state$.value.accountListState, 'accountList');
|
|
22
20
|
transactions.forEach((transaction) => {
|
|
23
21
|
const transactionWithCOT = (0, transactionHelper_1.getTransactionWithCOT)(transaction);
|
|
24
|
-
const newTransactionsLocalData = (0, transactionCategorizationLocalDataHelper_1.toTransactionDetailLocalData)(transactionWithCOT, selectedTab, lineItemsByTransactionIds[transaction.id]
|
|
22
|
+
const newTransactionsLocalData = (0, transactionCategorizationLocalDataHelper_1.toTransactionDetailLocalData)(transactionWithCOT, selectedTab, lineItemsByTransactionIds[transaction.id]);
|
|
25
23
|
if (transactionLocalData[transaction.id] == null) {
|
|
26
24
|
transactionLocalData[transaction.id] = {
|
|
27
25
|
...transactionsViewState_1.initialSupportedTransactionCategorization,
|
|
@@ -13,7 +13,7 @@ const transactionCategorizationLocalDataHelper_1 = require("../../helpers/transa
|
|
|
13
13
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
14
14
|
const markTransactionAsNotMiscategorizedEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.markTransactionAsNotMiscategorized.match), (0, operators_1.mergeMap)((action) => {
|
|
15
15
|
const { expenseAutomationViewState, expenseAutomationTransactionsViewState, } = state$.value;
|
|
16
|
-
const { transactionsInReview, selectedTab,
|
|
16
|
+
const { transactionsInReview, selectedTab, } = action.payload;
|
|
17
17
|
const transactionsSuccess = transactionsInReview.transactions_update_success;
|
|
18
18
|
const transactionsFailed = transactionsInReview.transactions_update_failed;
|
|
19
19
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state$.value);
|
|
@@ -110,7 +110,7 @@ const markTransactionAsNotMiscategorizedEpic = (actions$, state$, zeniAPI) => ac
|
|
|
110
110
|
if (timePeriodStart != null && timePeriodEnd != null) {
|
|
111
111
|
actions.push((0, transactionsViewReducer_1.fetchTransactionCategorizationView)('review', { start: timePeriodStart, end: timePeriodEnd }, true, // cacheOverride = true to force refresh
|
|
112
112
|
false, undefined, undefined, true, // refreshViewInBackground
|
|
113
|
-
false
|
|
113
|
+
false));
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
actions.push((0, transactionsViewReducer_1.updateTotalCountForTransactionCategorization)({
|
|
@@ -12,7 +12,7 @@ const accountListSelector_1 = require("../../../accountList/accountListSelector"
|
|
|
12
12
|
const saveTransactionHelper_1 = require("../../helpers/saveTransactionHelper");
|
|
13
13
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
14
14
|
const saveTransactionCategorizationEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.saveTransactionCategorization.match), (0, operators_1.mergeMap)((action) => {
|
|
15
|
-
const { transactionIds, cotTrackingByTransactionId, selectedTab,
|
|
15
|
+
const { transactionIds, cotTrackingByTransactionId, selectedTab, } = action.payload;
|
|
16
16
|
const fetchActions = [];
|
|
17
17
|
const { transactionState, expenseAutomationTransactionsViewState } = state$.value;
|
|
18
18
|
const transactionSaveUpdates = [];
|
|
@@ -25,7 +25,7 @@ const saveTransactionCategorizationEpic = (actions$, state$) => actions$.pipe((0
|
|
|
25
25
|
transactionSaveUpdates.push((0, saveTransactionHelper_1.toTransactionUpdatesFromTransactionCategorizationLocalData)(localData, transaction, uncategorizedIncomeExpense));
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
fetchActions.push((0, transactionsViewReducer_1.updateTransactionCategorization)(selectedTab, transactionIds, transactionSaveUpdates, cotTrackingByTransactionId
|
|
28
|
+
fetchActions.push((0, transactionsViewReducer_1.updateTransactionCategorization)(selectedTab, transactionIds, transactionSaveUpdates, cotTrackingByTransactionId));
|
|
29
29
|
return (0, rxjs_1.from)(fetchActions);
|
|
30
30
|
}));
|
|
31
31
|
exports.saveTransactionCategorizationEpic = saveTransactionCategorizationEpic;
|
|
@@ -7,7 +7,7 @@ const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
|
7
7
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
8
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
9
9
|
const triggerReviewTabRefetchEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.syncTransactionCategorizationFromDetailSave.match), (0, operators_1.mergeMap)((action) => {
|
|
10
|
-
const { pendingReviewLineIds, transactionId,
|
|
10
|
+
const { pendingReviewLineIds, transactionId, } = action.payload;
|
|
11
11
|
if (pendingReviewLineIds.length === 0) {
|
|
12
12
|
return rxjs_1.EMPTY;
|
|
13
13
|
}
|
|
@@ -26,6 +26,6 @@ const triggerReviewTabRefetchEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
26
26
|
if (timePeriodStart == null || timePeriodEnd == null) {
|
|
27
27
|
return rxjs_1.EMPTY;
|
|
28
28
|
}
|
|
29
|
-
return (0, rxjs_1.of)((0, transactionsViewReducer_1.backgroundRefetchReviewTab)({ start: timePeriodStart, end: timePeriodEnd }
|
|
29
|
+
return (0, rxjs_1.of)((0, transactionsViewReducer_1.backgroundRefetchReviewTab)({ start: timePeriodStart, end: timePeriodEnd }));
|
|
30
30
|
}));
|
|
31
31
|
exports.triggerReviewTabRefetchEpic = triggerReviewTabRefetchEpic;
|
|
@@ -21,7 +21,7 @@ const vendorSelector_1 = require("../../../../entity/vendor/vendorSelector");
|
|
|
21
21
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
22
22
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
23
23
|
const updateTransactionCategorizationEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.updateTransactionCategorization.match), (0, operators_1.mergeMap)((action) => {
|
|
24
|
-
const { selectedTab, transactionIds, transactionSaveUpdates, cotTrackingByTransactionId,
|
|
24
|
+
const { selectedTab, transactionIds, transactionSaveUpdates, cotTrackingByTransactionId, } = action.payload;
|
|
25
25
|
const { transactionState, vendorState, expenseAutomationTransactionsViewState, } = state$.value;
|
|
26
26
|
const payloadArray = preparePayload(selectedTab, transactionState, vendorState, expenseAutomationTransactionsViewState, transactionIds, transactionSaveUpdates, cotTrackingByTransactionId).filter((payload) => payload != null);
|
|
27
27
|
return zeniAPI
|
|
@@ -30,7 +30,7 @@ const updateTransactionCategorizationEpic = (actions$, state$, zeniAPI) => actio
|
|
|
30
30
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
31
31
|
const transactionsInReview = response.data;
|
|
32
32
|
const actions = [];
|
|
33
|
-
actions.push((0, transactionsViewReducer_1.markTransactionAsNotMiscategorized)(selectedTab, transactionsInReview
|
|
33
|
+
actions.push((0, transactionsViewReducer_1.markTransactionAsNotMiscategorized)(selectedTab, transactionsInReview), (0, transactionsViewReducer_1.updateTransactionCategorizationSaveStatus)(selectedTab, 'Completed', (0, responsePayload_1.createZeniAPIStatus)('Completed', 'Transaction categorization updated successfully')));
|
|
34
34
|
return (0, rxjs_1.from)(actions);
|
|
35
35
|
}
|
|
36
36
|
else {
|