@zeniai/client-epic-state 5.0.64-betaML1 → 5.0.64-betaSS1
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/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +0 -2
- package/lib/entity/account/accountSelector.d.ts +0 -9
- package/lib/entity/account/accountSelector.js +1 -14
- package/lib/entity/account/accountState.d.ts +1 -1
- package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
- package/lib/entity/class/classReducer.d.ts +4 -4
- package/lib/entity/class/classState.d.ts +1 -1
- package/lib/entity/forecast/forecastState.d.ts +1 -1
- package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
- package/lib/entity/sectionProjectView/sectionProjectView.d.ts +1 -1
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +2 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -2
- package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +0 -4
- package/lib/entity/transaction/payloadTypes/transactionPayload.js +0 -10
- package/lib/entity/transaction/stateTypes/transaction.d.ts +0 -3
- package/lib/epic.d.ts +1 -3
- package/lib/epic.js +1 -3
- package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +0 -2
- package/lib/esm/entity/account/accountSelector.js +0 -11
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -2
- package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +0 -10
- package/lib/esm/epic.js +1 -3
- package/lib/esm/index.js +7 -6
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +2 -1
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +6 -0
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +11 -1
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +1 -8
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -1
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +113 -78
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +20 -31
- package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +17 -0
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +0 -2
- package/lib/esm/view/expenseAutomationView/types/transactionsViewState.js +0 -5
- package/lib/esm/view/transactionDetail/epics/transactionDetailEpic.js +0 -10
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +2 -24
- package/lib/index.d.ts +6 -5
- package/lib/index.js +39 -45
- package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
- package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
- package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
- package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +2 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +6 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +10 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +0 -7
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +21 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +2 -1
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +10 -23
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +114 -79
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +2 -1
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +15 -4
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +0 -2
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +20 -32
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +10 -0
- package/lib/view/expenseAutomationView/types/completedSubTab.js +21 -0
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -2
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +1 -4
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +32 -15
- package/lib/view/expenseAutomationView/types/transactionsViewState.js +1 -6
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
- package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/lib/view/transactionDetail/epics/transactionDetailEpic.d.ts +1 -2
- package/lib/view/transactionDetail/epics/transactionDetailEpic.js +0 -10
- package/lib/view/transactionDetail/transactionDetailPayload.d.ts +1 -1
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +1 -6
- package/lib/view/transactionDetail/transactionDetailSelector.js +1 -23
- package/package.json +1 -1
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/createTransferEntryEpic.js +0 -81
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransferAccountsEpic.js +0 -30
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/createTransferEntryEpic.d.ts +0 -9
- package/lib/view/expenseAutomationView/epics/transactionCategorization/createTransferEntryEpic.js +0 -85
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransferAccountsEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransferAccountsEpic.js +0 -34
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { concat, from, timer } from 'rxjs';
|
|
2
|
-
import { catchError, filter, map, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { toTransactionID } from '../../../../entity/transaction/payloadTypes/transactionIDPayload';
|
|
5
|
-
import { toTransactionType } from '../../../../entity/transaction/stateTypes/transactionType';
|
|
6
|
-
import { removeTransaction, updateTransaction, } from '../../../../entity/transaction/transactionReducer';
|
|
7
|
-
import { isSuccessResponse } from '../../../../responsePayload';
|
|
8
|
-
import { initializeTransactionDetailLocalData, removeTransactionDetail, } from '../../../transactionDetail/transactionDetailReducer';
|
|
9
|
-
import { getTransactionDetailKey } from '../../../transactionDetail/transactionDetailState';
|
|
10
|
-
import { acknowledgeTransferEntryRouteReplacement, createTransferEntry, createTransferEntryFailure, createTransferEntryReplacedTransaction, createTransferEntrySuccess, removeTransactionFromAllTabs, resetCreateTransferEntryStatus, } from '../../reducers/transactionsViewReducer';
|
|
11
|
-
function transactionIdsAreEqual(a, b) {
|
|
12
|
-
return a.id === b.id && a.type === b.type;
|
|
13
|
-
}
|
|
14
|
-
export const createTransferEntryEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(createTransferEntry.match), mergeMap((action) => {
|
|
15
|
-
const { transactionId, creditAccountIntegrationId, debitAccountIntegrationId, memo, transactionType, sourceTransactionType, } = action.payload;
|
|
16
|
-
const url = `https://dev.api.zeni.ai/version/accounting/komal/1.0/transactions/transaction-type-update`;
|
|
17
|
-
return zeniAPI
|
|
18
|
-
.postAndGetJSON(url, {
|
|
19
|
-
transaction_type: transactionType,
|
|
20
|
-
transaction_id: transactionId,
|
|
21
|
-
to_account_integration_id: creditAccountIntegrationId,
|
|
22
|
-
from_account_integration_id: debitAccountIntegrationId,
|
|
23
|
-
memo,
|
|
24
|
-
})
|
|
25
|
-
.pipe(mergeMap((response) => {
|
|
26
|
-
if (isSuccessResponse(response)) {
|
|
27
|
-
const immediate = [];
|
|
28
|
-
const previousTransactionId = {
|
|
29
|
-
id: transactionId,
|
|
30
|
-
type: toTransactionType(sourceTransactionType),
|
|
31
|
-
};
|
|
32
|
-
if (response.data?.transaction != null) {
|
|
33
|
-
const newTransactionId = toTransactionID(response.data.transaction);
|
|
34
|
-
const replaced = !transactionIdsAreEqual(previousTransactionId, newTransactionId);
|
|
35
|
-
const newDetailKey = getTransactionDetailKey(newTransactionId);
|
|
36
|
-
immediate.push(updateTransaction(newDetailKey, response.data.transaction));
|
|
37
|
-
immediate.push(initializeTransactionDetailLocalData({
|
|
38
|
-
transactionId: newTransactionId,
|
|
39
|
-
vendorId: response.data.vendors?.[0]?.vendor_id,
|
|
40
|
-
}));
|
|
41
|
-
immediate.push(createTransferEntrySuccess(), removeTransactionFromAllTabs(transactionId), openSnackbar({
|
|
42
|
-
messageSection: 'create_transfer_entry',
|
|
43
|
-
messageText: 'success',
|
|
44
|
-
type: 'success',
|
|
45
|
-
}));
|
|
46
|
-
if (replaced) {
|
|
47
|
-
immediate.push(createTransferEntryReplacedTransaction(previousTransactionId, newTransactionId));
|
|
48
|
-
}
|
|
49
|
-
return concat(from(immediate), timer(0).pipe(map(() => resetCreateTransferEntryStatus()), mergeMap((resetAction) => replaced
|
|
50
|
-
? from([
|
|
51
|
-
resetAction,
|
|
52
|
-
removeTransaction(getTransactionDetailKey(previousTransactionId)),
|
|
53
|
-
removeTransactionDetail(previousTransactionId),
|
|
54
|
-
acknowledgeTransferEntryRouteReplacement(),
|
|
55
|
-
])
|
|
56
|
-
: from([resetAction]))));
|
|
57
|
-
}
|
|
58
|
-
immediate.push(createTransferEntrySuccess(), removeTransactionFromAllTabs(transactionId), openSnackbar({
|
|
59
|
-
messageSection: 'create_transfer_entry',
|
|
60
|
-
messageText: 'success',
|
|
61
|
-
type: 'success',
|
|
62
|
-
}));
|
|
63
|
-
return concat(from(immediate), timer(0).pipe(map(() => resetCreateTransferEntryStatus())));
|
|
64
|
-
}
|
|
65
|
-
return from([
|
|
66
|
-
createTransferEntryFailure(),
|
|
67
|
-
openSnackbar({
|
|
68
|
-
messageSection: 'create_transfer_entry',
|
|
69
|
-
messageText: 'failed',
|
|
70
|
-
type: 'error',
|
|
71
|
-
}),
|
|
72
|
-
]);
|
|
73
|
-
}), catchError(() => from([
|
|
74
|
-
createTransferEntryFailure(),
|
|
75
|
-
openSnackbar({
|
|
76
|
-
messageSection: 'create_transfer_entry',
|
|
77
|
-
messageText: 'failed',
|
|
78
|
-
type: 'error',
|
|
79
|
-
}),
|
|
80
|
-
])));
|
|
81
|
-
}));
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { updateAccounts } from '../../../../entity/account/accountReducer';
|
|
4
|
-
import { isSuccessResponse } from '../../../../responsePayload';
|
|
5
|
-
import { fetchAccountsForTransferFlow, updateAccountsForTransferFlow, updateAccountsForTransferFlowFailure, } from '../../reducers/transactionsViewReducer';
|
|
6
|
-
const REPORT_ID_BY_KIND = {
|
|
7
|
-
transfer_eligible: 'transfer_accounts',
|
|
8
|
-
credit_card_only: 'credit_card_transfer_accounts',
|
|
9
|
-
};
|
|
10
|
-
const QUERY_BY_KIND = {
|
|
11
|
-
transfer_eligible: { is_only_include_transfer_accounts: true },
|
|
12
|
-
credit_card_only: { is_include_only_credit_card_accounts: true },
|
|
13
|
-
};
|
|
14
|
-
export const fetchTransferAccountsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchAccountsForTransferFlow.match), switchMap((action) => {
|
|
15
|
-
const { kind } = action.payload;
|
|
16
|
-
const queryValue = QUERY_BY_KIND[kind];
|
|
17
|
-
const reportId = REPORT_ID_BY_KIND[kind];
|
|
18
|
-
const url = `https://dev.api.zeni.ai/version/accounting/komal/1.0/accounts?query=${encodeURIComponent(JSON.stringify(queryValue))}`;
|
|
19
|
-
return zeniAPI.getJSON(url).pipe(mergeMap((response) => {
|
|
20
|
-
if (isSuccessResponse(response) && response.data != null) {
|
|
21
|
-
const accountIds = response.data.accounts.map((account) => account.account_id);
|
|
22
|
-
const actions = [
|
|
23
|
-
updateAccounts(response.data.accounts, reportId),
|
|
24
|
-
updateAccountsForTransferFlow({ accountIds, kind }),
|
|
25
|
-
];
|
|
26
|
-
return of(...actions);
|
|
27
|
-
}
|
|
28
|
-
return of(updateAccountsForTransferFlowFailure({ kind }));
|
|
29
|
-
}), catchError(() => of(updateAccountsForTransferFlowFailure({ kind }))));
|
|
30
|
-
}));
|