@zeniai/client-epic-state 4.20.2 → 4.20.3-beta10ND
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/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +19 -0
- package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +2 -0
- package/lib/commonStateTypes/animations.d.ts +1 -1
- package/lib/commonStateTypes/animations.js +3 -0
- package/lib/entity/aiCfo/aiCfoSelector.d.ts +1 -2
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +38 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +78 -0
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -1
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +5 -1
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +37 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +5 -0
- package/lib/entity/tenant/tenantPayload.d.ts +1 -0
- package/lib/entity/tenant/tenantReducer.js +1 -0
- package/lib/entity/tenant/tenantSelector.d.ts +1 -0
- package/lib/entity/tenant/tenantSelector.js +9 -1
- package/lib/entity/tenant/tenantState.d.ts +1 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +4 -1
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
- package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +3 -0
- package/lib/entity/transaction/payloadTypes/transactionPayload.js +17 -1
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +1 -0
- package/lib/entity/transaction/stateTypes/transaction.d.ts +5 -0
- package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
- package/lib/epic.d.ts +8 -1
- package/lib/epic.js +8 -1
- package/lib/esm/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +1 -0
- package/lib/esm/commonStateTypes/animations.js +3 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +78 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +5 -1
- package/lib/esm/entity/snackbar/snackbarTypes.js +5 -0
- package/lib/esm/entity/tenant/tenantReducer.js +1 -0
- package/lib/esm/entity/tenant/tenantSelector.js +7 -0
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
- package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +17 -1
- package/lib/esm/epic.js +8 -1
- package/lib/esm/index.js +10 -7
- package/lib/esm/reducer.js +3 -0
- package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +82 -1
- package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +8 -2
- package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +29 -0
- package/lib/esm/view/classList/fetchClassListEpic.js +9 -2
- package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
- package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -3
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
- package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +17 -1
- package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +12 -4
- package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +22 -9
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +12 -6
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +18 -1
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +18 -1
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +17 -14
- package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesPayload.js +26 -0
- package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesReducer.js +199 -0
- package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +52 -0
- package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesState.js +1 -0
- package/lib/esm/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.js +99 -0
- package/lib/esm/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.js +48 -0
- package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.js +36 -0
- package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.js +45 -0
- package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.js +50 -0
- package/lib/esm/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.js +69 -0
- package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +10 -0
- package/lib/esm/view/spendManagement/billPay/billList/billListState.js +1 -0
- package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
- package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +7 -4
- package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
- package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
- package/lib/esm/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryDetailEpic.js +2 -2
- package/lib/esm/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.js +2 -1
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
- package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
- package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +9 -2
- package/lib/index.d.ts +19 -12
- package/lib/index.js +54 -32
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +7 -0
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +15 -1
- package/lib/view/aiCfoView/aiCfoViewReducer.js +83 -2
- package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +4 -1
- package/lib/view/aiCfoView/aiCfoViewSelector.js +9 -2
- package/lib/view/aiCfoView/aiCfoViewState.d.ts +15 -1
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -0
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +33 -0
- package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
- package/lib/view/classList/fetchClassListEpic.d.ts +1 -1
- package/lib/view/classList/fetchClassListEpic.js +8 -1
- package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +1 -0
- package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +1 -0
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +1 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -3
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
- package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +18 -2
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +2 -0
- package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +12 -4
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +22 -9
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +11 -5
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +5 -0
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +20 -0
- package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +1 -1
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +2 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +19 -2
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +17 -14
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesPayload.d.ts +75 -0
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesPayload.js +30 -0
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesReducer.d.ts +50 -0
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesReducer.js +206 -0
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.d.ts +24 -0
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +61 -0
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.d.ts +38 -0
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.js +2 -0
- package/lib/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.d.ts +12 -0
- package/lib/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.js +105 -0
- package/lib/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.d.ts +8 -0
- package/lib/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.js +52 -0
- package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.d.ts +7 -0
- package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.js +40 -0
- package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.d.ts +7 -0
- package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.js +52 -0
- package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.d.ts +10 -0
- package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.js +54 -0
- package/lib/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.d.ts +8 -0
- package/lib/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.js +73 -0
- package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -0
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.js +1 -0
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +6 -3
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -0
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
- package/lib/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryDetailEpic.js +2 -2
- package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.d.ts +2 -1
- package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.js +2 -1
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
- package/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
- package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +1 -0
- package/lib/view/transactionDetail/transactionDetailSelector.js +9 -2
- package/package.json +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.accountTypeSubConfigCodeToAccType = exports.createAutoTransferRuleEpic = void 0;
|
|
4
|
+
exports.mapAutoTransferRuleLocalDataToPayload = mapAutoTransferRuleLocalDataToPayload;
|
|
5
|
+
const rxjs_1 = require("rxjs");
|
|
6
|
+
const operators_1 = require("rxjs/operators");
|
|
7
|
+
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
8
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
|
+
const autoTransferRulesPayload_1 = require("../autoTransferRulesPayload");
|
|
10
|
+
const autoTransferRulesReducer_1 = require("../autoTransferRulesReducer");
|
|
11
|
+
const createAutoTransferRuleEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoTransferRulesReducer_1.createAutoTransferRule.match), (0, operators_1.switchMap)(() => {
|
|
12
|
+
const requestBody = mapAutoTransferRuleLocalDataToPayload(state$.value.autotransferRulesState.ruleUpdateLocalData);
|
|
13
|
+
return zeniAPI
|
|
14
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto`, requestBody)
|
|
15
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
17
|
+
const rule = (0, autoTransferRulesPayload_1.mapPayloadToAutoTransferRule)(response.data.auto_transfer_rule);
|
|
18
|
+
const actions = [
|
|
19
|
+
(0, autoTransferRulesReducer_1.createAutoTransferRuleSuccess)({ rule }),
|
|
20
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
21
|
+
messageSection: 'auto_transfer_rule_create',
|
|
22
|
+
messageText: 'success',
|
|
23
|
+
type: 'success',
|
|
24
|
+
}),
|
|
25
|
+
];
|
|
26
|
+
return (0, rxjs_1.from)(actions);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return (0, rxjs_1.from)([
|
|
30
|
+
(0, autoTransferRulesReducer_1.createAutoTransferRuleFailure)({
|
|
31
|
+
fetchState: 'Error',
|
|
32
|
+
error: response.status,
|
|
33
|
+
}),
|
|
34
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
35
|
+
messageSection: 'auto_transfer_rule_create',
|
|
36
|
+
messageText: 'failed',
|
|
37
|
+
type: 'error',
|
|
38
|
+
variables: [
|
|
39
|
+
{
|
|
40
|
+
variableName: '_api-error_',
|
|
41
|
+
variableValue: response.status.message,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
}),
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoTransferRulesReducer_1.createAutoTransferRuleFailure)({
|
|
48
|
+
fetchState: 'Error',
|
|
49
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create auto transfer rule REST API call errored out ' +
|
|
50
|
+
JSON.stringify(error)),
|
|
51
|
+
}))));
|
|
52
|
+
}));
|
|
53
|
+
exports.createAutoTransferRuleEpic = createAutoTransferRuleEpic;
|
|
54
|
+
function mapAutoTransferRuleLocalDataToPayload(localData, pauseRule, resumeRule) {
|
|
55
|
+
if (pauseRule === true) {
|
|
56
|
+
return {
|
|
57
|
+
is_active: false,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (resumeRule === true) {
|
|
61
|
+
return {
|
|
62
|
+
is_active: true,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const payload = {
|
|
66
|
+
...(localData.amount != null && {
|
|
67
|
+
amount: localData.amount.amount,
|
|
68
|
+
currency_code: localData.amount.currencyCode,
|
|
69
|
+
}),
|
|
70
|
+
...(localData.destinationAccount != null && {
|
|
71
|
+
destination_bank_account_id: localData.destinationAccount.id,
|
|
72
|
+
destination_bank_account_type: (0, exports.accountTypeSubConfigCodeToAccType)(localData.destinationAccount.accType),
|
|
73
|
+
}),
|
|
74
|
+
...(localData.destinationAccountWithPercentAllocation != null && {
|
|
75
|
+
destination_bank_account_metadata: localData.destinationAccountWithPercentAllocation.map((allocation) => ({
|
|
76
|
+
account_id: allocation.account.id,
|
|
77
|
+
account_type: (0, exports.accountTypeSubConfigCodeToAccType)(allocation.account.accType),
|
|
78
|
+
percentage: allocation.percentage,
|
|
79
|
+
})),
|
|
80
|
+
}),
|
|
81
|
+
frequency: localData.frequency,
|
|
82
|
+
rule_type: localData.ruleType,
|
|
83
|
+
...(localData.sourceAccount != null && {
|
|
84
|
+
source_bank_account_id: localData.sourceAccount.id,
|
|
85
|
+
source_bank_account_type: (0, exports.accountTypeSubConfigCodeToAccType)(localData.sourceAccount.accType),
|
|
86
|
+
}),
|
|
87
|
+
...(localData.firstTransferDate != null && {
|
|
88
|
+
first_transfer_date: localData.firstTransferDate.format('YYYY-MM-DD'),
|
|
89
|
+
}),
|
|
90
|
+
};
|
|
91
|
+
return payload;
|
|
92
|
+
}
|
|
93
|
+
const accountTypeSubConfigCodeToAccType = (code) => {
|
|
94
|
+
switch (code) {
|
|
95
|
+
case 'depositAccount':
|
|
96
|
+
return 'deposit_account';
|
|
97
|
+
case 'paymentAccount':
|
|
98
|
+
return 'payment_account';
|
|
99
|
+
case 'treasuryAccount':
|
|
100
|
+
return 'treasury_account';
|
|
101
|
+
default:
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
exports.accountTypeSubConfigCodeToAccType = accountTypeSubConfigCodeToAccType;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
+
import { RootState } from '../../../../reducer';
|
|
5
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
+
import { deleteAutoTransferRule, deleteAutoTransferRuleFailure, deleteAutoTransferRuleSuccess } from '../autoTransferRulesReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof deleteAutoTransferRule> | ReturnType<typeof deleteAutoTransferRuleSuccess> | ReturnType<typeof deleteAutoTransferRuleFailure> | ReturnType<typeof openSnackbar>;
|
|
8
|
+
export declare const deleteAutoTransferRuleEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteAutoTransferRuleEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
|
+
const autoTransferRulesReducer_1 = require("../autoTransferRulesReducer");
|
|
9
|
+
const deleteAutoTransferRuleEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoTransferRulesReducer_1.deleteAutoTransferRule.match), (0, operators_1.switchMap)((action) => {
|
|
10
|
+
const { ruleId } = action.payload;
|
|
11
|
+
return zeniAPI
|
|
12
|
+
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto/${ruleId}`)
|
|
13
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
14
|
+
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
15
|
+
const actions = [
|
|
16
|
+
(0, autoTransferRulesReducer_1.deleteAutoTransferRuleSuccess)({ ruleId }),
|
|
17
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
18
|
+
messageSection: 'auto_transfer_rule_delete',
|
|
19
|
+
messageText: 'success',
|
|
20
|
+
type: 'success',
|
|
21
|
+
}),
|
|
22
|
+
];
|
|
23
|
+
return (0, rxjs_1.from)(actions);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return (0, rxjs_1.from)([
|
|
27
|
+
(0, autoTransferRulesReducer_1.deleteAutoTransferRuleFailure)({
|
|
28
|
+
ruleId,
|
|
29
|
+
fetchState: 'Error',
|
|
30
|
+
error: response.status,
|
|
31
|
+
}),
|
|
32
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
33
|
+
messageSection: 'auto_transfer_rule_delete',
|
|
34
|
+
messageText: 'failed',
|
|
35
|
+
type: 'error',
|
|
36
|
+
variables: [
|
|
37
|
+
{
|
|
38
|
+
variableName: '_api-error_',
|
|
39
|
+
variableValue: response.status.message,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
}),
|
|
43
|
+
]);
|
|
44
|
+
}
|
|
45
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoTransferRulesReducer_1.deleteAutoTransferRuleFailure)({
|
|
46
|
+
ruleId,
|
|
47
|
+
fetchState: 'Error',
|
|
48
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Delete auto transfer rule REST API call errored out ' +
|
|
49
|
+
JSON.stringify(error)),
|
|
50
|
+
}))));
|
|
51
|
+
}));
|
|
52
|
+
exports.deleteAutoTransferRuleEpic = deleteAutoTransferRuleEpic;
|
package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
+
import { fetchAutoTransferReviewDetail, updateAutoTransferReviewDetail, updateAutoTransferReviewDetailFailure } from '../autoTransferRulesReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof fetchAutoTransferReviewDetail> | ReturnType<typeof updateAutoTransferReviewDetail> | ReturnType<typeof updateAutoTransferReviewDetailFailure>;
|
|
7
|
+
export declare const fetchAutoTransferReviewDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchAutoTransferReviewDetailEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
+
const autoTransferRulesReducer_1 = require("../autoTransferRulesReducer");
|
|
8
|
+
const createAutoTransferRuleEpic_1 = require("./createAutoTransferRuleEpic");
|
|
9
|
+
const fetchAutoTransferReviewDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoTransferRulesReducer_1.fetchAutoTransferReviewDetail.match), (0, operators_1.switchMap)(() => {
|
|
10
|
+
const localData = state$.value.autotransferRulesState.ruleUpdateLocalData;
|
|
11
|
+
const payload = {
|
|
12
|
+
...(localData.sourceAccount != null && {
|
|
13
|
+
from_account: {
|
|
14
|
+
account_id: localData.sourceAccount.id,
|
|
15
|
+
account_type: (0, createAutoTransferRuleEpic_1.accountTypeSubConfigCodeToAccType)(localData.sourceAccount.accType) ?? '',
|
|
16
|
+
},
|
|
17
|
+
}),
|
|
18
|
+
...(localData.destinationAccount != null && {
|
|
19
|
+
to_account: {
|
|
20
|
+
account_id: localData.destinationAccount.id,
|
|
21
|
+
account_type: (0, createAutoTransferRuleEpic_1.accountTypeSubConfigCodeToAccType)(localData.destinationAccount.accType) ?? '',
|
|
22
|
+
},
|
|
23
|
+
}),
|
|
24
|
+
...(localData.amount != null && {
|
|
25
|
+
amount: localData.amount.amount,
|
|
26
|
+
currency_code: localData.amount.currencyCode,
|
|
27
|
+
currency_symbol: localData.amount.currencySymbol,
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
return zeniAPI
|
|
31
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto/review`, payload)
|
|
32
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
33
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
34
|
+
return (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferReviewDetail)(response.data));
|
|
35
|
+
}
|
|
36
|
+
return (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferReviewDetailFailure)(response.status));
|
|
37
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferReviewDetailFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch auto transfer review detail REST API call errored out ' +
|
|
38
|
+
JSON.stringify(error))))));
|
|
39
|
+
}));
|
|
40
|
+
exports.fetchAutoTransferReviewDetailEpic = fetchAutoTransferReviewDetailEpic;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
+
import { fetchAutoTransferRuleHistory, updateAutoTransferRuleHistory, updateAutoTransferRuleHistoryFetchStatus } from '../autoTransferRulesReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof fetchAutoTransferRuleHistory> | ReturnType<typeof updateAutoTransferRuleHistory> | ReturnType<typeof updateAutoTransferRuleHistoryFetchStatus>;
|
|
7
|
+
export declare const fetchAutoTransferRuleHistoryEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fetchAutoTransferRuleHistoryEpic = void 0;
|
|
7
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
8
|
+
const rxjs_1 = require("rxjs");
|
|
9
|
+
const operators_1 = require("rxjs/operators");
|
|
10
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
11
|
+
const autoTransferRulesReducer_1 = require("../autoTransferRulesReducer");
|
|
12
|
+
const fetchAutoTransferRuleHistoryEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoTransferRulesReducer_1.fetchAutoTransferRuleHistory.match), (0, operators_1.mergeMap)((action) => {
|
|
13
|
+
const { ruleId, cacheOverride } = action.payload;
|
|
14
|
+
const historyActions = [];
|
|
15
|
+
const state = state$.value;
|
|
16
|
+
const historyDetail = (0, get_1.default)(state.autotransferRulesState.historyByRuleId, ruleId, undefined);
|
|
17
|
+
if (cacheOverride === true ||
|
|
18
|
+
historyDetail == null ||
|
|
19
|
+
historyDetail.fetchState !== 'In-Progress') {
|
|
20
|
+
historyActions.push((0, autoTransferRulesReducer_1.updateAutoTransferRuleHistoryFetchStatus)({
|
|
21
|
+
ruleId,
|
|
22
|
+
fetchState: 'In-Progress',
|
|
23
|
+
}));
|
|
24
|
+
const getHistoryDetail$ = zeniAPI
|
|
25
|
+
.getJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto/${ruleId}/history`)
|
|
26
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
27
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
28
|
+
return (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferRuleHistory)({
|
|
29
|
+
ruleId,
|
|
30
|
+
historicEventsPayload: response.data.activities,
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferRuleHistoryFetchStatus)({
|
|
35
|
+
ruleId,
|
|
36
|
+
fetchState: 'Error',
|
|
37
|
+
error: response.status,
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferRuleHistoryFetchStatus)({
|
|
41
|
+
ruleId,
|
|
42
|
+
fetchState: 'Error',
|
|
43
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch auto transfer rule history REST API call errored out ' +
|
|
44
|
+
JSON.stringify(error)),
|
|
45
|
+
}))));
|
|
46
|
+
return (0, rxjs_1.concat)((0, rxjs_1.from)(historyActions), getHistoryDetail$);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return (0, rxjs_1.from)(historyActions);
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
exports.fetchAutoTransferRuleHistoryEpic = fetchAutoTransferRuleHistoryEpic;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
+
import { fetchTreasuryOverviewDetail } from '../../treasury/treasuryList/treasuryDetailReducer';
|
|
6
|
+
import { fetchDepositAccountList } from '../../zeniAccounts/depositAccountList/depositAccountListReducer';
|
|
7
|
+
import { fetchPaymentAccountList } from '../../zeniAccounts/paymentAccountList/paymentAccountListReducer';
|
|
8
|
+
import { fetchAutoTransferRules, updateAutoTransferRules, updateAutoTransferRulesFailure } from '../autoTransferRulesReducer';
|
|
9
|
+
export type ActionType = ReturnType<typeof fetchAutoTransferRules> | ReturnType<typeof updateAutoTransferRules> | ReturnType<typeof updateAutoTransferRulesFailure> | ReturnType<typeof fetchDepositAccountList> | ReturnType<typeof fetchPaymentAccountList> | ReturnType<typeof fetchTreasuryOverviewDetail>;
|
|
10
|
+
export declare const fetchAutoTransferRulesEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchAutoTransferRulesEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
+
const treasuryDetailReducer_1 = require("../../treasury/treasuryList/treasuryDetailReducer");
|
|
8
|
+
const depositAccountListReducer_1 = require("../../zeniAccounts/depositAccountList/depositAccountListReducer");
|
|
9
|
+
const paymentAccountListReducer_1 = require("../../zeniAccounts/paymentAccountList/paymentAccountListReducer");
|
|
10
|
+
const autoTransferRulesPayload_1 = require("../autoTransferRulesPayload");
|
|
11
|
+
const autoTransferRulesReducer_1 = require("../autoTransferRulesReducer");
|
|
12
|
+
const fetchAutoTransferRulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoTransferRulesReducer_1.fetchAutoTransferRules.match), (0, operators_1.switchMap)((action) => {
|
|
13
|
+
const state = state$.value;
|
|
14
|
+
const { cacheOverride } = action.payload;
|
|
15
|
+
const { autotransferRulesState, depositAccountListState, paymentAccountListState, } = state;
|
|
16
|
+
if (cacheOverride === true ||
|
|
17
|
+
(autotransferRulesState.hasValidState() === false &&
|
|
18
|
+
autotransferRulesState.fetchState !== 'In-Progress')) {
|
|
19
|
+
return zeniAPI
|
|
20
|
+
.getJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto/list`)
|
|
21
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
22
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
23
|
+
const rules = response.data.auto_transfer_rules.map(autoTransferRulesPayload_1.mapPayloadToAutoTransferRule);
|
|
24
|
+
const actions = [
|
|
25
|
+
(0, autoTransferRulesReducer_1.updateAutoTransferRules)({ rules }),
|
|
26
|
+
];
|
|
27
|
+
if (depositAccountListState.fetchState !== 'In-Progress' &&
|
|
28
|
+
depositAccountListState.fetchState !== 'Completed') {
|
|
29
|
+
actions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
|
|
30
|
+
}
|
|
31
|
+
if (paymentAccountListState.fetchState !== 'In-Progress' &&
|
|
32
|
+
paymentAccountListState.fetchState !== 'Completed') {
|
|
33
|
+
actions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
|
|
34
|
+
}
|
|
35
|
+
actions.push((0, treasuryDetailReducer_1.fetchTreasuryOverviewDetail)(false, true));
|
|
36
|
+
return (0, rxjs_1.from)(actions);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferRulesFailure)({
|
|
40
|
+
fetchState: 'Error',
|
|
41
|
+
error: response.status,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferRulesFailure)({
|
|
45
|
+
fetchState: 'Error',
|
|
46
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch auto transfer rules REST API call errored out ' +
|
|
47
|
+
JSON.stringify(error)),
|
|
48
|
+
}))));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return (0, rxjs_1.from)([]);
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
exports.fetchAutoTransferRulesEpic = fetchAutoTransferRulesEpic;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
+
import { RootState } from '../../../../reducer';
|
|
5
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
+
import { updateAutoTransferRule, updateAutoTransferRuleFailure, updateAutoTransferRuleSuccess } from '../autoTransferRulesReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof updateAutoTransferRule> | ReturnType<typeof updateAutoTransferRuleSuccess> | ReturnType<typeof updateAutoTransferRuleFailure> | ReturnType<typeof openSnackbar>;
|
|
8
|
+
export declare const updateAutoTransferRuleEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateAutoTransferRuleEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
|
+
const autoTransferRulesPayload_1 = require("../autoTransferRulesPayload");
|
|
9
|
+
const autoTransferRulesReducer_1 = require("../autoTransferRulesReducer");
|
|
10
|
+
const createAutoTransferRuleEpic_1 = require("./createAutoTransferRuleEpic");
|
|
11
|
+
const updateAutoTransferRuleEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoTransferRulesReducer_1.updateAutoTransferRule.match), (0, operators_1.switchMap)((action) => {
|
|
12
|
+
const { ruleId, pauseRule, resumeRule } = action.payload;
|
|
13
|
+
const requestBody = (0, createAutoTransferRuleEpic_1.mapAutoTransferRuleLocalDataToPayload)(state$.value.autotransferRulesState.ruleUpdateLocalData, pauseRule, resumeRule);
|
|
14
|
+
return zeniAPI
|
|
15
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto/${ruleId}`, requestBody)
|
|
16
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
|
+
const rule = (0, autoTransferRulesPayload_1.mapPayloadToAutoTransferRule)(response.data.auto_transfer_rule);
|
|
19
|
+
const isPauseOrResumeOnly = Object.keys(requestBody).length === 1 &&
|
|
20
|
+
'is_active' in requestBody;
|
|
21
|
+
const messageSection = isPauseOrResumeOnly
|
|
22
|
+
? requestBody.is_active === false
|
|
23
|
+
? 'auto_transfer_rule_pause'
|
|
24
|
+
: 'auto_transfer_rule_resume'
|
|
25
|
+
: 'auto_transfer_rule_update';
|
|
26
|
+
const actions = [
|
|
27
|
+
(0, autoTransferRulesReducer_1.updateAutoTransferRuleSuccess)({ rule }),
|
|
28
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
29
|
+
messageSection,
|
|
30
|
+
messageText: 'success',
|
|
31
|
+
type: 'success',
|
|
32
|
+
variables: [
|
|
33
|
+
{
|
|
34
|
+
variableName: '__ruleName__',
|
|
35
|
+
variableValue: rule.ruleType === 'minimum_balance'
|
|
36
|
+
? 'Maintain a Minimum Balance'
|
|
37
|
+
: rule.ruleType === 'recurring'
|
|
38
|
+
? 'Make a Recurring Transfer'
|
|
39
|
+
: 'Distribute Balance by Percentage',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
}),
|
|
43
|
+
];
|
|
44
|
+
return (0, rxjs_1.from)(actions);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return (0, rxjs_1.from)([
|
|
48
|
+
(0, autoTransferRulesReducer_1.updateAutoTransferRuleFailure)({
|
|
49
|
+
ruleId,
|
|
50
|
+
fetchState: 'Error',
|
|
51
|
+
error: response.status,
|
|
52
|
+
}),
|
|
53
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
54
|
+
messageSection: 'auto_transfer_rule_update',
|
|
55
|
+
messageText: 'failed',
|
|
56
|
+
type: 'error',
|
|
57
|
+
variables: [
|
|
58
|
+
{
|
|
59
|
+
variableName: '_api-error_',
|
|
60
|
+
variableValue: response.status.message,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
}),
|
|
64
|
+
]);
|
|
65
|
+
}
|
|
66
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferRuleFailure)({
|
|
67
|
+
ruleId,
|
|
68
|
+
fetchState: 'Error',
|
|
69
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Update auto transfer rule REST API call errored out ' +
|
|
70
|
+
JSON.stringify(error)),
|
|
71
|
+
}))));
|
|
72
|
+
}));
|
|
73
|
+
exports.updateAutoTransferRuleEpic = updateAutoTransferRuleEpic;
|
|
@@ -424,6 +424,14 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
|
|
|
424
424
|
transactionsWithNoSortKeyValue.push(transaction);
|
|
425
425
|
}
|
|
426
426
|
break;
|
|
427
|
+
case 'invoiceNumber':
|
|
428
|
+
if (transaction.documentId != null) {
|
|
429
|
+
transactionsWithSortKeyValue.push(transaction);
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
transactionsWithNoSortKeyValue.push(transaction);
|
|
433
|
+
}
|
|
434
|
+
break;
|
|
427
435
|
case 'dueDate':
|
|
428
436
|
if (currentTab === 'draft') {
|
|
429
437
|
if (Boolean(transaction.dueDate) === true) {
|
|
@@ -526,6 +534,8 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
|
|
|
526
534
|
return transaction.totalAmountInUSD?.amount ?? 0;
|
|
527
535
|
case 'paymentMethod':
|
|
528
536
|
return transaction.billPayInfo.billPaymentMethodType.name;
|
|
537
|
+
case 'invoiceNumber':
|
|
538
|
+
return transaction.documentId;
|
|
529
539
|
}
|
|
530
540
|
}, getColumnWiseSortOrder(sortOrder));
|
|
531
541
|
return [
|
|
@@ -37,7 +37,7 @@ declare const toBillTabType: (v: string) => "paid" | "pending_approval" | "sched
|
|
|
37
37
|
export type BillTab = ReturnType<typeof toBillTabType>;
|
|
38
38
|
declare const toBillsSubTabType: (v: string) => "rejected" | "failed" | "ach" | "wire" | "cancelled" | "deleted" | "overdue" | "all" | "awaiting_approval" | "awaiting_my_approval" | "offline";
|
|
39
39
|
export type BillsSubTabType = ReturnType<typeof toBillsSubTabType>;
|
|
40
|
-
declare const toBillPaySortKeyType: (v: string) => "amount" | "status" | "name" | "dueDate" | "paymentMethod" | "invoiceDate";
|
|
40
|
+
declare const toBillPaySortKeyType: (v: string) => "amount" | "status" | "name" | "dueDate" | "paymentMethod" | "invoiceNumber" | "invoiceDate";
|
|
41
41
|
export declare type BillPayViewSortKey = ReturnType<typeof toBillPaySortKeyType>;
|
|
42
42
|
export interface BillPayFilters {
|
|
43
43
|
categories: BillPayFilterCategory[];
|
|
@@ -47,6 +47,7 @@ const ALL_BILL_PAY_SORT_KEYS = [
|
|
|
47
47
|
'invoiceDate',
|
|
48
48
|
'name',
|
|
49
49
|
'paymentMethod',
|
|
50
|
+
'invoiceNumber',
|
|
50
51
|
];
|
|
51
52
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
52
53
|
const toBillPaySortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_BILL_PAY_SORT_KEYS);
|
|
@@ -8,6 +8,7 @@ const get_1 = __importDefault(require("lodash/get"));
|
|
|
8
8
|
const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
|
|
9
9
|
const contactSelector_1 = require("../../../../entity/billPay/contact/contactSelector");
|
|
10
10
|
const paymentAccountSelector_1 = require("../../../../entity/paymentAccount/paymentAccountSelector");
|
|
11
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
11
12
|
const vendorSelector_1 = require("../../../../entity/vendor/vendorSelector");
|
|
12
13
|
const accountListSelector_1 = require("../../../accountList/accountListSelector");
|
|
13
14
|
const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
|
|
@@ -80,11 +81,14 @@ const getReviewPageBillDetail = (state, billId) => {
|
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
if (sourceBillDetail != null) {
|
|
83
|
-
|
|
84
|
+
const fetchStateList = [
|
|
84
85
|
sourceBillDetail.fetchStatus,
|
|
85
86
|
accountListState.byReportId['billPayAccountList'],
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
];
|
|
88
|
+
if ((0, tenantSelector_1.getIsAccountingClassesEnabled)(state)) {
|
|
89
|
+
fetchStateList.push(classListState);
|
|
90
|
+
}
|
|
91
|
+
sourceBillDetailFetchState = (0, reduceFetchState_1.reduceFetchState)(fetchStateList).fetchState;
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
else {
|
|
@@ -9,6 +9,7 @@ const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
|
9
9
|
const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
|
|
10
10
|
const approvalRuleSelector_1 = require("../../../../entity/approvalRule/approvalRuleSelector");
|
|
11
11
|
const classSelector_1 = require("../../../../entity/class/classSelector");
|
|
12
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
12
13
|
const userSelector_1 = require("../../../../entity/user/userSelector");
|
|
13
14
|
const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
|
|
14
15
|
exports.getBillPaySetupApproverView = (0, toolkit_1.createSelector)((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (billPaySetupApproverViewState, approvalRuleState, userState) => {
|
|
@@ -50,7 +51,7 @@ exports.getBillPaySetupApproverView = (0, toolkit_1.createSelector)((state) => s
|
|
|
50
51
|
newApprovalRuleId,
|
|
51
52
|
};
|
|
52
53
|
});
|
|
53
|
-
exports.getBillPaySetupApproverUpdateDataView = (0, toolkit_1.createSelector)((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (state) => state.classState, (state) => state.classListState, (state) => state.userRoleState, (billPaySetupApproverViewState, approvalRuleState, userState, classState, classListState, userRoleState) => {
|
|
54
|
+
exports.getBillPaySetupApproverUpdateDataView = (0, toolkit_1.createSelector)((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (state) => state.classState, (state) => state.classListState, (state) => state.userRoleState, (state) => (0, tenantSelector_1.getIsAccountingClassesEnabled)(state), (billPaySetupApproverViewState, approvalRuleState, userState, classState, classListState, userRoleState, isAccountingClassesEnabled) => {
|
|
54
55
|
const { affectedEntityIds, approvalRuleIds, approverListState, billPaySetupApproverViewUpdateData, fetchState, error, listeningToPusherEvent, } = billPaySetupApproverViewState;
|
|
55
56
|
const { approverIds, attributes } = approverListState;
|
|
56
57
|
const allApprovalRules = (0, approvalRuleSelector_1.getApprovalRulesByIds)(approvalRuleState, approvalRuleIds);
|
|
@@ -98,10 +99,9 @@ exports.getBillPaySetupApproverUpdateDataView = (0, toolkit_1.createSelector)((s
|
|
|
98
99
|
allAttributes,
|
|
99
100
|
filteredAttributes,
|
|
100
101
|
billPaySetupApproverViewUpdateData,
|
|
101
|
-
approverListFetchStatus:
|
|
102
|
-
approverListState.fetchStatus,
|
|
103
|
-
|
|
104
|
-
]),
|
|
102
|
+
approverListFetchStatus: isAccountingClassesEnabled
|
|
103
|
+
? (0, reduceFetchState_1.reduceAllFetchState)([approverListState.fetchStatus, classListState])
|
|
104
|
+
: approverListState.fetchStatus,
|
|
105
105
|
fetchState,
|
|
106
106
|
allAccountingClasses,
|
|
107
107
|
error,
|
|
@@ -3,23 +3,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fetchBillPayApproversDetailsEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const tenantSelector_1 = require("../../../../../entity/tenant/tenantSelector");
|
|
6
7
|
const classListReducer_1 = require("../../../../classList/classListReducer");
|
|
7
8
|
const billPaySetupApproverViewReducer_1 = require("../billPaySetupApproverViewReducer");
|
|
8
9
|
const fetchBillPayApproversDetailsEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(billPaySetupApproverViewReducer_1.fetchBillPayApproversDetails.match), (0, operators_1.mergeMap)((action) => {
|
|
9
10
|
const { cacheOverride, includeUserRoles } = action.payload;
|
|
10
11
|
const { billPaySetupApproverViewState, classListState } = state$.value;
|
|
11
12
|
const { approverListState } = billPaySetupApproverViewState;
|
|
13
|
+
const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state$.value);
|
|
12
14
|
const actions = [];
|
|
13
15
|
if (cacheOverride === true) {
|
|
14
16
|
actions.push((0, billPaySetupApproverViewReducer_1.fetchBillPayApproversList)(cacheOverride, includeUserRoles));
|
|
15
|
-
|
|
17
|
+
if (isAccountingClassesEnabled) {
|
|
18
|
+
actions.push((0, classListReducer_1.fetchClassList)());
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
else {
|
|
18
22
|
if (billPaySetupApproverViewState.hasValidState() === false &&
|
|
19
23
|
approverListState.fetchStatus.fetchState !== 'In-Progress') {
|
|
20
24
|
actions.push((0, billPaySetupApproverViewReducer_1.fetchBillPayApproversList)(true, includeUserRoles));
|
|
21
25
|
}
|
|
22
|
-
if (
|
|
26
|
+
if (isAccountingClassesEnabled &&
|
|
27
|
+
classListState.hasValidState() === false &&
|
|
23
28
|
classListState.fetchState !== 'In-Progress') {
|
|
24
29
|
actions.push((0, classListReducer_1.fetchClassList)());
|
|
25
30
|
}
|
|
@@ -16,6 +16,7 @@ const companySelector_1 = require("../../../../entity/company/companySelector");
|
|
|
16
16
|
const depositAccountSelector_1 = require("../../../../entity/depositAccount/depositAccountSelector");
|
|
17
17
|
const paymentAccountSelector_1 = require("../../../../entity/paymentAccount/paymentAccountSelector");
|
|
18
18
|
const paymentInstrumentSelector_1 = require("../../../../entity/paymentInstrument/paymentInstrumentSelector");
|
|
19
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
19
20
|
const userSelector_1 = require("../../../../entity/user/userSelector");
|
|
20
21
|
const vendorSelector_1 = require("../../../../entity/vendor/vendorSelector");
|
|
21
22
|
const zeniDayJS_1 = require("../../../../zeniDayJS");
|
|
@@ -181,12 +182,15 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
181
182
|
isCancelled = sourceBillDetail.billDetailLocalData.isCancelled;
|
|
182
183
|
billStage = billPayInfo?.stage.code ?? 'draft';
|
|
183
184
|
if (billViewState != null) {
|
|
184
|
-
|
|
185
|
+
const fetchStateList = [
|
|
185
186
|
sourceBillDetail.fetchStatus,
|
|
186
187
|
accountListState.byReportId.billPayAccountList,
|
|
187
|
-
classListState,
|
|
188
188
|
billPaySetupApproverViewState,
|
|
189
|
-
]
|
|
189
|
+
];
|
|
190
|
+
if ((0, tenantSelector_1.getIsAccountingClassesEnabled)(state)) {
|
|
191
|
+
fetchStateList.push(classListState);
|
|
192
|
+
}
|
|
193
|
+
fetchState = (0, reduceFetchState_1.reduceFetchState)(fetchStateList).fetchState;
|
|
190
194
|
deleteStatus = billViewState.deleteStatus;
|
|
191
195
|
billActivities = (0, billDetailViewSelector_1.getBillActivities)(state, billId, billPayInfo?.stage.code);
|
|
192
196
|
}
|
|
@@ -200,11 +204,14 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
200
204
|
}
|
|
201
205
|
}
|
|
202
206
|
else {
|
|
203
|
-
|
|
207
|
+
const newBillFetchStateList = [
|
|
204
208
|
accountListState.byReportId.billPayAccountList,
|
|
205
|
-
classListState,
|
|
206
209
|
billPaySetupApproverViewState,
|
|
207
|
-
]
|
|
210
|
+
];
|
|
211
|
+
if ((0, tenantSelector_1.getIsAccountingClassesEnabled)(state)) {
|
|
212
|
+
newBillFetchStateList.push(classListState);
|
|
213
|
+
}
|
|
214
|
+
fetchState = (0, reduceFetchState_1.reduceFetchState)(newBillFetchStateList).fetchState;
|
|
208
215
|
}
|
|
209
216
|
if (sourceBillDetail != null && fetchState == 'Completed') {
|
|
210
217
|
const updatedRecord = sourceBillDetail.billDetailLocalData;
|
|
@@ -42,7 +42,7 @@ interface TwoFAState {
|
|
|
42
42
|
otpChallenge?: string;
|
|
43
43
|
phone?: string;
|
|
44
44
|
}
|
|
45
|
-
export declare const toChargeCardTransactionSortKeyType: (v: string) => "amount" | "type" | "
|
|
45
|
+
export declare const toChargeCardTransactionSortKeyType: (v: string) => "amount" | "type" | "receipts" | "merchant" | "paymentDate";
|
|
46
46
|
export declare type ChargeCardTransactionSortKey = ReturnType<typeof toChargeCardTransactionSortKeyType>;
|
|
47
47
|
export interface ChargeCardDetailTransactionList extends FetchStateAndError {
|
|
48
48
|
isViewReceiptClickedImmediatelyAfterUploadTransactionId: Record<ID, boolean>;
|
|
@@ -61,7 +61,7 @@ export declare const initialCreditAcc: CreditAccount;
|
|
|
61
61
|
export declare const initialDebitCardSummaries: DebitCardSummaries;
|
|
62
62
|
export declare const initialResendRevokeCardInvite: ResendRevokeCardInvite;
|
|
63
63
|
export declare const initialCreditAccountRepayment: CreditAccountRepayment;
|
|
64
|
-
export declare const toChargeCardSortKeyType: (v: string) => "status" | "owner" | "cardName" | "limit" | "department" | "cardType" | "utilisation";
|
|
64
|
+
export declare const toChargeCardSortKeyType: (v: string) => "status" | "accountType" | "owner" | "cardName" | "limit" | "department" | "cardType" | "utilisation";
|
|
65
65
|
export declare type ChargeCardViewSortKey = ReturnType<typeof toChargeCardSortKeyType>;
|
|
66
66
|
export declare const ALL_CASHBACK_SORT_KEYS: readonly ["month", "cashback"];
|
|
67
67
|
export declare const toCashbackSortKeyType: (v: string) => "month" | "cashback";
|