@zeniai/client-epic-state 4.14.77 → 4.14.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -0
- package/lib/entity/depositAccountTransaction/depositAccountTransactionPayload.d.ts +1 -0
- package/lib/entity/depositAccountTransaction/depositAccountTransactionPayload.js +1 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
- package/lib/entity/tenant/clearAllEpic.js +2 -0
- package/lib/entity/tenant/tenantPayload.d.ts +1 -0
- package/lib/entity/userRole/userRolePayload.d.ts +1 -0
- package/lib/entity/userRole/userRolePayload.js +3 -0
- package/lib/entity/userRole/userRoleType.d.ts +2 -2
- package/lib/entity/userRole/userRoleType.js +6 -7
- package/lib/epic.d.ts +7 -1
- package/lib/epic.js +7 -1
- package/lib/index.d.ts +19 -15
- package/lib/index.js +40 -29
- package/lib/init.js +1 -1
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/view/accountMappingView/accountMappingTypeHelper.d.ts +17 -0
- package/lib/view/accountMappingView/accountMappingTypeHelper.js +2 -0
- package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +1 -0
- package/lib/view/bankAccountView/bankAccountViewState.d.ts +1 -1
- package/lib/view/bankAccountView/epic/createBankAccountEpic.d.ts +2 -1
- package/lib/view/bankAccountView/epic/createBankAccountEpic.js +18 -4
- package/lib/view/bankAccountView/epic/createInternationalBankAccountEpic.js +4 -2
- package/lib/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.d.ts +2 -1
- package/lib/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js +43 -15
- package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.d.ts +2 -1
- package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +49 -24
- package/lib/view/commonVendorView/vendorView/vendorViewPayload.js +2 -2
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.d.ts +5 -2
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.js +30 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchAccountSettingsListForAccountTypesEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchAccountSettingsListForAccountTypesEpic.js +41 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchRecommendationForAccountSettingsEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchRecommendationForAccountSettingsEpic.js +27 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/initializeAccountSettingsViewEpic.d.ts +4 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/initializeAccountSettingsViewEpic.js +13 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/saveAccountSettingsViewEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/saveAccountSettingsViewEpic.js +50 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +1 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +6 -0
- package/lib/view/expenseAutomationView/helpers/jeAccountSettingHelper.d.ts +3 -0
- package/lib/view/expenseAutomationView/helpers/jeAccountSettingHelper.js +50 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +19 -6
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +153 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +5 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +10 -2
- package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +19 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +2 -0
- package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.d.ts +3 -0
- package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +41 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +3 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +27 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -0
- package/lib/view/people/helpers/updateManagersListOnRoleChange.js +3 -2
- package/lib/view/people/peoplePayload.d.ts +1 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.d.ts +7 -1
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.js +3 -2
- package/lib/view/spendManagement/billPay/internationalWire/epics/createInternationalPaymentInstrumentEpic.js +4 -2
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +6 -3
- package/lib/view/spendManagement/zeniAccounts/depositAccountTransactionList/depositAccountTransactionListSelector.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/expressPay/epics/fetchExpressPayInitialDetailsEpic.d.ts +10 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/epics/fetchExpressPayInitialDetailsEpic.js +46 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/epics/submitExpressPayEpic.d.ts +8 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/epics/submitExpressPayEpic.js +67 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPayReducer.d.ts +15 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPayReducer.js +61 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.d.ts +27 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.js +85 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPayState.d.ts +19 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPayState.js +2 -0
- package/package.json +2 -2
|
@@ -6,18 +6,20 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const bankAccountReducer_1 = require("../../../entity/bankAccount/bankAccountReducer");
|
|
7
7
|
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
8
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
9
|
+
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
9
10
|
const vendorViewReducer_1 = require("../../commonVendorView/vendorView/vendorViewReducer");
|
|
11
|
+
const expressPayReducer_1 = require("../../spendManagement/zeniAccounts/expressPay/expressPayReducer");
|
|
10
12
|
const bankAccountViewPayload_1 = require("../bankAccountViewPayload");
|
|
11
13
|
const bankAccountViewReducer_1 = require("../bankAccountViewReducer");
|
|
12
14
|
const createBankAccountEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(bankAccountViewReducer_1.createBankAccount.match), (0, operators_1.switchMap)((action) => {
|
|
13
|
-
const { bankAccountViewState } = state$.value;
|
|
15
|
+
const { bankAccountViewState, expressPayState } = state$.value;
|
|
14
16
|
const { paymentMethodType, bankAccountContext, vendorId } = action.payload;
|
|
15
17
|
const bankAccountLocalData = bankAccountViewState.createBankAccountDetails.localData;
|
|
16
18
|
if (bankAccountLocalData != null) {
|
|
17
19
|
return zeniAPI
|
|
18
20
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/bank-accounts`, (0, bankAccountViewPayload_1.toBankAccountPayload)(bankAccountLocalData, paymentMethodType))
|
|
19
21
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
20
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
21
23
|
const bankAccountActions = [];
|
|
22
24
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
23
25
|
bankAccountActions.push((0, bankAccountReducer_1.updateBankAccounts)((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.bank_accounts) !== null && _b !== void 0 ? _b : []), (0, bankAccountViewReducer_1.updateStatusForCreateBankAccountFlow)({
|
|
@@ -25,7 +27,8 @@ const createBankAccountEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, o
|
|
|
25
27
|
isInternationalBankAccount: false,
|
|
26
28
|
}));
|
|
27
29
|
if (bankAccountContext === 'vendor' ||
|
|
28
|
-
bankAccountContext === 'billDetail'
|
|
30
|
+
bankAccountContext === 'billDetail' ||
|
|
31
|
+
bankAccountContext === 'express-pay') {
|
|
29
32
|
bankAccountActions.push((0, vendorViewReducer_1.updateBankAccountsInVendorView)({
|
|
30
33
|
bankAccountIds: [
|
|
31
34
|
(_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.bank_accounts[0].bank_account_id) !== null && _d !== void 0 ? _d : '',
|
|
@@ -81,7 +84,8 @@ const createBankAccountEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, o
|
|
|
81
84
|
],
|
|
82
85
|
}));
|
|
83
86
|
if (bankAccountContext === 'vendor' ||
|
|
84
|
-
bankAccountContext === 'billDetail'
|
|
87
|
+
bankAccountContext === 'billDetail' ||
|
|
88
|
+
bankAccountContext === 'express-pay') {
|
|
85
89
|
bankAccountActions.push((0, vendorViewReducer_1.updateBankAccountsInVendorView)({
|
|
86
90
|
bankAccountIds: [
|
|
87
91
|
(_m = (_l = response.data) === null || _l === void 0 ? void 0 : _l.bank_accounts[0].bank_account_id) !== null && _m !== void 0 ? _m : '',
|
|
@@ -92,6 +96,16 @@ const createBankAccountEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, o
|
|
|
92
96
|
// if you are adding bank detail directly from bill page, you have to link it to vendor
|
|
93
97
|
bankAccountActions.push((0, vendorViewReducer_1.saveVendor)(vendorId));
|
|
94
98
|
}
|
|
99
|
+
if (bankAccountContext === 'express-pay') {
|
|
100
|
+
// if bank detail is added from express pay page, it has to be selected by default
|
|
101
|
+
bankAccountActions.push((0, expressPayReducer_1.updateExpressPayFormLocalData)({
|
|
102
|
+
localData: Object.assign(Object.assign({}, expressPayState.formLocalData), { amount: (_p = (_o = expressPayState.formLocalData) === null || _o === void 0 ? void 0 : _o.amount) !== null && _p !== void 0 ? _p : {
|
|
103
|
+
amount: 0,
|
|
104
|
+
currencyCode: 'USD',
|
|
105
|
+
currencySymbol: '$',
|
|
106
|
+
}, paymentDate: (_r = (_q = expressPayState.formLocalData) === null || _q === void 0 ? void 0 : _q.paymentDate) !== null && _r !== void 0 ? _r : (0, zeniDayJS_1.dateNow)(), paymentToAccountId: (_t = (_s = response.data) === null || _s === void 0 ? void 0 : _s.bank_accounts[0].bank_account_id) !== null && _t !== void 0 ? _t : '' }),
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
95
109
|
}
|
|
96
110
|
}
|
|
97
111
|
else {
|
|
@@ -27,7 +27,8 @@ const createInternationalBankAccountEpic = (actions$, state$, zeniAPI) => action
|
|
|
27
27
|
isInternationalBankAccount: true,
|
|
28
28
|
}));
|
|
29
29
|
if (bankAccountContext === 'vendor' ||
|
|
30
|
-
bankAccountContext === 'billDetail'
|
|
30
|
+
bankAccountContext === 'billDetail' ||
|
|
31
|
+
bankAccountContext === 'express-pay') {
|
|
31
32
|
bankAccountActions.push((0, vendorViewReducer_1.updatePaymentInstrumentsInVendorView)({
|
|
32
33
|
paymentInstrumentIds: [
|
|
33
34
|
(_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.payment_instruments[0].zeni_payment_instrument_id) !== null && _d !== void 0 ? _d : '',
|
|
@@ -69,7 +70,8 @@ const createInternationalBankAccountEpic = (actions$, state$, zeniAPI) => action
|
|
|
69
70
|
],
|
|
70
71
|
}));
|
|
71
72
|
if (bankAccountContext === 'vendor' ||
|
|
72
|
-
bankAccountContext === 'billDetail'
|
|
73
|
+
bankAccountContext === 'billDetail' ||
|
|
74
|
+
bankAccountContext === 'express-pay') {
|
|
73
75
|
bankAccountActions.push((0, vendorViewReducer_1.updatePaymentInstrumentsInVendorView)({
|
|
74
76
|
paymentInstrumentIds: [
|
|
75
77
|
(_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.payment_instruments[0].zeni_payment_instrument_id) !== null && _f !== void 0 ? _f : '',
|
package/lib/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
|
3
3
|
import { updateVendors } from '../../../../entity/vendor/vendorReducer';
|
|
4
4
|
import { RootState } from '../../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
+
import { updateSelectedVendorForTransaction } from '../../../expenseAutomationView/reducers/transactionsViewReducer';
|
|
6
7
|
import { saveTransactionDetail, updateSelectedVendor } from '../../../transactionDetail/transactionDetailReducer';
|
|
7
8
|
import { saveTransactionVendor, saveTransactionVendorSuccessOrFailure, updateTransactionVendorLocalData } from '../transactionVendorViewReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof saveTransactionVendor> | ReturnType<typeof saveTransactionDetail> | ReturnType<typeof updateVendors> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveTransactionVendorSuccessOrFailure> | ReturnType<typeof updateTransactionVendorLocalData> | ReturnType<typeof updateSelectedVendor>;
|
|
9
|
+
export type ActionType = ReturnType<typeof saveTransactionVendor> | ReturnType<typeof saveTransactionDetail> | ReturnType<typeof updateVendors> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveTransactionVendorSuccessOrFailure> | ReturnType<typeof updateTransactionVendorLocalData> | ReturnType<typeof updateSelectedVendor> | ReturnType<typeof updateSelectedVendorForTransaction>;
|
|
9
10
|
export declare const saveTransactionVendorEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
@@ -4,14 +4,21 @@ exports.saveTransactionVendorEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
7
|
+
const transactionSelector_1 = require("../../../../entity/transaction/transactionSelector");
|
|
7
8
|
const vendorReducer_1 = require("../../../../entity/vendor/vendorReducer");
|
|
8
9
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
10
|
+
const accountListSelector_1 = require("../../../accountList/accountListSelector");
|
|
11
|
+
const transactionsViewReducer_1 = require("../../../expenseAutomationView/reducers/transactionsViewReducer");
|
|
9
12
|
const transactionDetailReducer_1 = require("../../../transactionDetail/transactionDetailReducer");
|
|
10
13
|
const transactionVendorViewPayload_1 = require("../transactionVendorViewPayload");
|
|
11
14
|
const transactionVendorViewReducer_1 = require("../transactionVendorViewReducer");
|
|
12
15
|
const saveTransactionVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionVendorViewReducer_1.saveTransactionVendor.match), (0, operators_1.mergeMap)((action) => {
|
|
13
16
|
var _a, _b;
|
|
14
17
|
const state = state$.value;
|
|
18
|
+
const { expenseAutomationTransactionsViewState, accountState, accountListState, } = state;
|
|
19
|
+
const { selectedTransactionCategorizationTab, transactionCategorizationView, } = expenseAutomationTransactionsViewState;
|
|
20
|
+
const { selectedTransactionId, selectedTransactionLineId } = transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
21
|
+
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(accountState, accountListState, 'accountList');
|
|
15
22
|
const newlySelectedVendorId = (_b = (_a = state.transactionVendorViewState.newVendorState) === null || _a === void 0 ? void 0 : _a.vendorDetailLocalData) === null || _b === void 0 ? void 0 : _b.vendorId;
|
|
16
23
|
const vendorDetailsUpdated = action.payload.vendorId != null
|
|
17
24
|
? state.transactionVendorViewState.editVendorStateById[action.payload.vendorId].vendorDetailLocalData
|
|
@@ -25,31 +32,52 @@ const saveTransactionVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
25
32
|
? zeniAPI.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/vendors/${effectiveVendorId}`, payload)
|
|
26
33
|
: zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/vendors`, payload);
|
|
27
34
|
return saveVendorApi.pipe((0, operators_1.mergeMap)((response) => {
|
|
28
|
-
var _a
|
|
29
|
-
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
35
|
+
var _a;
|
|
36
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
30
37
|
const actions = [
|
|
31
|
-
(0, vendorReducer_1.updateVendors)((
|
|
38
|
+
(0, vendorReducer_1.updateVendors)((_a = response.data.vendors) !== null && _a !== void 0 ? _a : []),
|
|
32
39
|
];
|
|
33
40
|
actions.push((0, transactionVendorViewReducer_1.updateTransactionVendorLocalData)({
|
|
34
|
-
vendorId:
|
|
41
|
+
vendorId: response.data.vendors[0].vendor_id,
|
|
35
42
|
localData: {
|
|
36
|
-
vendorName:
|
|
37
|
-
vendorId:
|
|
43
|
+
vendorName: response.data.vendors[0].vendor_name,
|
|
44
|
+
vendorId: response.data.vendors[0].vendor_id,
|
|
38
45
|
},
|
|
39
46
|
}));
|
|
40
47
|
if (effectiveVendorId == null &&
|
|
41
48
|
action.payload.transactionId != null &&
|
|
42
49
|
response.data != null) {
|
|
43
50
|
// This is to get created vendor's details on transaction detail page
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
if (action.payload.isExpenseAutomationEnabled === true) {
|
|
52
|
+
if (selectedTransactionId != null &&
|
|
53
|
+
selectedTransactionLineId != null) {
|
|
54
|
+
const selectedTransaction = (0, transactionSelector_1.getSupportedTransactionById)(state.transactionState, selectedTransactionId);
|
|
55
|
+
if (selectedTransaction != null) {
|
|
56
|
+
actions.push((0, transactionsViewReducer_1.updateSelectedVendorForTransaction)({
|
|
57
|
+
selectedTab: selectedTransactionCategorizationTab,
|
|
58
|
+
transactionId: selectedTransactionId,
|
|
59
|
+
lineId: selectedTransactionLineId, // provide appropriate lineId
|
|
60
|
+
selectedTransaction, // provide appropriate selectedTransaction
|
|
61
|
+
uncategorizedAccounts: uncategorizedIncomeExpense, // provide appropriate uncategorizedAccounts
|
|
62
|
+
updatedVendor: {
|
|
63
|
+
name: response.data.vendors[0].vendor_name,
|
|
64
|
+
id: response.data.vendors[0].vendor_id,
|
|
65
|
+
},
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
actions.push((0, transactionDetailReducer_1.updateSelectedVendor)({
|
|
72
|
+
transactionId: action.payload.transactionId,
|
|
73
|
+
vendorUpdates: {
|
|
74
|
+
name: response.data.vendors[0].vendor_name,
|
|
75
|
+
id: response.data.vendors[0].vendor_id,
|
|
76
|
+
qboId: response.data.vendors[0].qbo_id,
|
|
77
|
+
},
|
|
78
|
+
resetRecommendations: true,
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
53
81
|
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
54
82
|
messageSection: 'create_vendor',
|
|
55
83
|
messageText: 'success',
|
|
@@ -9,6 +9,7 @@ import { RootState } from '../../../../reducer';
|
|
|
9
9
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
10
10
|
import { convertAmountToHomeCurrency, saveBillUpdatesToLocalStore, updateAddBillAutoFields, updateRecommendedVendorId } from '../../../spendManagement/billPay/editBillView/editBillViewReducer';
|
|
11
11
|
import { fetchPreviousBills } from '../../../spendManagement/billPay/previousBills/previousBillsReducer';
|
|
12
|
+
import { updateExpressPayFormLocalData } from '../../../spendManagement/zeniAccounts/expressPay/expressPayReducer';
|
|
12
13
|
import { fetchUserDetails, resetVendorDetailLocalData, saveVendor, saveVendorSuccessOrFailure, updateVendorDetailLocalData } from '../vendorViewReducer';
|
|
13
|
-
export type ActionType = ReturnType<typeof saveVendor> | ReturnType<typeof updateVendors> | ReturnType<typeof updateContacts> | ReturnType<typeof updateBankAccounts> | ReturnType<typeof saveBillUpdatesToLocalStore> | ReturnType<typeof fetchPreviousBills> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveVendorSuccessOrFailure> | ReturnType<typeof resetVendorDetailLocalData> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateVendorDetailLocalData> | ReturnType<typeof fetchUserDetails> | ReturnType<typeof updatePaymentInstruments> | ReturnType<typeof convertAmountToHomeCurrency> | ReturnType<typeof updateRecommendedVendorId> | ReturnType<typeof updateAddBillAutoFields>;
|
|
14
|
+
export type ActionType = ReturnType<typeof saveVendor> | ReturnType<typeof updateVendors> | ReturnType<typeof updateContacts> | ReturnType<typeof updateBankAccounts> | ReturnType<typeof saveBillUpdatesToLocalStore> | ReturnType<typeof fetchPreviousBills> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveVendorSuccessOrFailure> | ReturnType<typeof resetVendorDetailLocalData> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateVendorDetailLocalData> | ReturnType<typeof fetchUserDetails> | ReturnType<typeof updatePaymentInstruments> | ReturnType<typeof convertAmountToHomeCurrency> | ReturnType<typeof updateRecommendedVendorId> | ReturnType<typeof updateAddBillAutoFields> | ReturnType<typeof updateExpressPayFormLocalData>;
|
|
14
15
|
export declare const saveVendorEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
@@ -21,9 +21,11 @@ const billDetailViewState_1 = require("../../../spendManagement/billPay/billDeta
|
|
|
21
21
|
const editBillViewReducer_1 = require("../../../spendManagement/billPay/editBillView/editBillViewReducer");
|
|
22
22
|
const editBillViewState_1 = require("../../../spendManagement/billPay/editBillView/editBillViewState");
|
|
23
23
|
const previousBillsReducer_1 = require("../../../spendManagement/billPay/previousBills/previousBillsReducer");
|
|
24
|
+
const expressPayReducer_1 = require("../../../spendManagement/zeniAccounts/expressPay/expressPayReducer");
|
|
24
25
|
const commonVendorViewHelper_1 = require("../../commonVendorViewHelper");
|
|
25
26
|
const vendorViewPayload_1 = require("../vendorViewPayload");
|
|
26
27
|
const vendorViewReducer_1 = require("../vendorViewReducer");
|
|
28
|
+
const vendorDetailLocalDataHelpers_1 = require("./vendorDetailLocalDataHelpers");
|
|
27
29
|
const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(vendorViewReducer_1.saveVendor.match), (0, operators_1.mergeMap)((action) => {
|
|
28
30
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
29
31
|
const state = state$.value;
|
|
@@ -35,7 +37,7 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
35
37
|
const effectiveVendorId = (_c = action.payload.vendorId) !== null && _c !== void 0 ? _c : newlySelectedVendor;
|
|
36
38
|
const payload = (0, vendorViewPayload_1.prepareEditVendorPayload)(state, vendorDetailsUpdated !== null && vendorDetailsUpdated !== void 0 ? vendorDetailsUpdated : vendorViewReducer_1.initialVendorDetailLocalData, effectiveVendorId);
|
|
37
39
|
let billInLocalStore = state.editBillDetailViewState.newBillState;
|
|
38
|
-
const { tenantState, companyState } = state;
|
|
40
|
+
const { tenantState, companyState, expressPayState } = state;
|
|
39
41
|
const { currentTenantId } = tenantState;
|
|
40
42
|
const companyId = currentTenantId != null
|
|
41
43
|
? (_e = (_d = tenantState.tenantsById) === null || _d === void 0 ? void 0 : _d[currentTenantId]) === null || _e === void 0 ? void 0 : _e.companyId
|
|
@@ -45,6 +47,7 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
45
47
|
const isPayNowEnabled = payNowCutOffTime != null
|
|
46
48
|
? (0, zeniDayJS_1.dateNow)().isSameOrBefore(payNowCutOffTime)
|
|
47
49
|
: false;
|
|
50
|
+
const expressPayLocalData = expressPayState.formLocalData;
|
|
48
51
|
if (action.payload.billId != null) {
|
|
49
52
|
const billDetailKey = (0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId);
|
|
50
53
|
billInLocalStore =
|
|
@@ -57,7 +60,7 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
57
60
|
: zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/vendors`, payload);
|
|
58
61
|
const userId = (_g = (_f = state.tenantState.loggedInUser) === null || _f === void 0 ? void 0 : _f.userId) !== null && _g !== void 0 ? _g : '';
|
|
59
62
|
return saveVendorApi.pipe((0, operators_1.mergeMap)((response) => {
|
|
60
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
63
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
61
64
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
62
65
|
const updatedVendor = ((_a = response.data) === null || _a === void 0 ? void 0 : _a.vendors[0]) != null
|
|
63
66
|
? (0, vendorPayload_1.mapVendorPayloadToVendor)((_b = response.data) === null || _b === void 0 ? void 0 : _b.vendors[0])
|
|
@@ -139,29 +142,33 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
139
142
|
actions.push((0, editBillViewReducer_1.updateRecommendedVendorId)(updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.id));
|
|
140
143
|
}
|
|
141
144
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
.paymentDetailsSection) === null ||
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
145
|
+
if (action.payload.isExpressPayPage !== true) {
|
|
146
|
+
actions.push((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({
|
|
147
|
+
billDetailLocalData: {
|
|
148
|
+
showVendorGptRecommendationText,
|
|
149
|
+
vendor: updatedVendor,
|
|
150
|
+
isCancelled: isCancelled,
|
|
151
|
+
updatesByLineId: updatedLines,
|
|
152
|
+
whatForSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData.whatForSection), { currencyCode: updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.vendorCurrencyCode, recipientCurrencyCode: updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.vendorCurrencyCode }),
|
|
153
|
+
paymentDetailsSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData
|
|
154
|
+
.paymentDetailsSection), { paymentTo: undefined, internationalTransferFeeBearerPaymentMethod: updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.preferredInternationalTransferFeeBearerPaymentMethod, paymentDate: (_u = (_t = billInLocalStore.billDetailLocalData
|
|
155
|
+
.paymentDetailsSection) === null || _t === void 0 ? void 0 : _t.paymentDate) !== null && _u !== void 0 ? _u :
|
|
156
|
+
//in case paymentDate is not present in the billDetailLocalData, then today/next working date will be considered.
|
|
157
|
+
//this is done beacuse we are doing similar calcualtion in getDefaultValues of editBillDetailPage.
|
|
158
|
+
(0, zeniDayJS_1.date)((0, workingDayHelper_1.getNextNthWorkingDay)((0, zeniDayJS_1.dateNow)().toDate(), [0, 6], isPayNowEnabled ? 0 : 1).toISOString()) }),
|
|
159
|
+
isCollectToAccountInfoFromVendorContact: false,
|
|
160
|
+
isRecurring: false,
|
|
161
|
+
},
|
|
162
|
+
billId: action.payload.billId,
|
|
163
|
+
}));
|
|
164
|
+
if ((updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.qboId) != null) {
|
|
165
|
+
actions.push((0, previousBillsReducer_1.fetchPreviousBills)(updatedVendor.qboId, false));
|
|
166
|
+
}
|
|
162
167
|
}
|
|
163
168
|
}
|
|
164
|
-
|
|
169
|
+
if (action.payload.isExpressPayPage !== true) {
|
|
170
|
+
actions.push((0, vendorViewReducer_1.resetVendorDetailLocalData)(action.payload.vendorId));
|
|
171
|
+
}
|
|
165
172
|
actions.push((0, vendorViewReducer_1.saveVendorSuccessOrFailure)('Completed', action.payload.vendorId));
|
|
166
173
|
if (action.payload.view === 'vendorsTab') {
|
|
167
174
|
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
@@ -170,10 +177,28 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
170
177
|
type: 'success',
|
|
171
178
|
}));
|
|
172
179
|
}
|
|
180
|
+
// if a new vendor is created from express pay recipient page, we want the same vendor information to be passed to editVendorState
|
|
181
|
+
// so that further updates in the vendor info on the next pages can be done
|
|
182
|
+
if (action.payload.isExpressPayPage === true &&
|
|
183
|
+
action.payload.vendorId == null &&
|
|
184
|
+
updatedVendor != null) {
|
|
185
|
+
actions.push((0, vendorViewReducer_1.updateVendorDetailLocalData)({
|
|
186
|
+
vendorId: updatedVendor.id,
|
|
187
|
+
localData: (0, vendorDetailLocalDataHelpers_1.getInitializedVendorDetailLocalData)(updatedVendor, state$.value, (_v = response.data) === null || _v === void 0 ? void 0 : _v.vendors[0]),
|
|
188
|
+
}));
|
|
189
|
+
actions.push((0, vendorViewReducer_1.saveVendorSuccessOrFailure)('Completed', updatedVendor.id));
|
|
190
|
+
actions.push((0, expressPayReducer_1.updateExpressPayFormLocalData)({
|
|
191
|
+
localData: Object.assign(Object.assign({}, expressPayLocalData), { vendorId: updatedVendor.id, amount: (_w = expressPayLocalData === null || expressPayLocalData === void 0 ? void 0 : expressPayLocalData.amount) !== null && _w !== void 0 ? _w : {
|
|
192
|
+
amount: 0,
|
|
193
|
+
currencyCode: updatedVendor.vendorCurrencyCode,
|
|
194
|
+
currencySymbol: updatedVendor.vendorCurrencySymbol,
|
|
195
|
+
}, paymentDate: (_x = expressPayLocalData === null || expressPayLocalData === void 0 ? void 0 : expressPayLocalData.paymentDate) !== null && _x !== void 0 ? _x : (0, zeniDayJS_1.dateNow)() }),
|
|
196
|
+
}));
|
|
197
|
+
}
|
|
173
198
|
return (0, rxjs_1.from)(actions);
|
|
174
199
|
}
|
|
175
200
|
else {
|
|
176
|
-
if (((
|
|
201
|
+
if (((_y = response.data) === null || _y === void 0 ? void 0 : _y.error_code) === 1001) {
|
|
177
202
|
return (0, rxjs_1.of)((0, vendorViewReducer_1.saveVendorSuccessOrFailure)('Error', action.payload.vendorId, response.status, true), (0, vendorViewReducer_1.fetchUserDetails)({ userId: userId }));
|
|
178
203
|
}
|
|
179
204
|
return (0, rxjs_1.of)((0, vendorViewReducer_1.saveVendorSuccessOrFailure)('Error', action.payload.vendorId, response.status), (0, snackbarReducer_1.openSnackbar)({
|
|
@@ -8,7 +8,7 @@ const classPayload_1 = require("../../../entity/class/classPayload");
|
|
|
8
8
|
const classSelector_1 = require("../../../entity/class/classSelector");
|
|
9
9
|
const addressViewPayload_1 = require("../../addressView/addressViewPayload");
|
|
10
10
|
const prepareEditVendorPayload = (state, vendorDetailLocalData, vendorId) => {
|
|
11
|
-
var _a, _b;
|
|
11
|
+
var _a, _b, _c;
|
|
12
12
|
const { accountState, classState, addressViewState, vendorState } = state;
|
|
13
13
|
const payload = {};
|
|
14
14
|
if (vendorDetailLocalData != null) {
|
|
@@ -71,7 +71,7 @@ const prepareEditVendorPayload = (state, vendorDetailLocalData, vendorId) => {
|
|
|
71
71
|
payload.bank_account_ids = vendorDetailLocalData.bankAccountIds;
|
|
72
72
|
payload.payment_instrument_ids = vendorDetailLocalData.paymentInstrumentIds;
|
|
73
73
|
}
|
|
74
|
-
const vendorAddressToCreate = (_b = addressViewState.newAddressState) === null || _b === void 0 ? void 0 : _b['vendor_address'].addressToCreate;
|
|
74
|
+
const vendorAddressToCreate = (_c = (_b = addressViewState.newAddressState) === null || _b === void 0 ? void 0 : _b['vendor_address']) === null || _c === void 0 ? void 0 : _c.addressToCreate;
|
|
75
75
|
const vendorAddressPayload = vendorAddressToCreate != null
|
|
76
76
|
? (0, addressViewPayload_1.toAddressUpdatableInfoPayload)(vendorAddressToCreate)
|
|
77
77
|
: undefined;
|
|
@@ -37,10 +37,11 @@ export declare const fetchVendorDetails: import("@reduxjs/toolkit").ActionCreato
|
|
|
37
37
|
countryCode?: string;
|
|
38
38
|
currencyCode?: string;
|
|
39
39
|
vendorId?: ID;
|
|
40
|
-
}, "vendorView/updateCountryCurrencyInVendorView">, saveVendor: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId?: string | undefined, billId?: string | undefined, view?: "vendorsTab" | undefined], {
|
|
40
|
+
}, "vendorView/updateCountryCurrencyInVendorView">, saveVendor: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId?: string | undefined, billId?: string | undefined, view?: "vendorsTab" | undefined, isExpressPayPage?: boolean | undefined], {
|
|
41
41
|
vendorId: string | undefined;
|
|
42
42
|
billId: string | undefined;
|
|
43
43
|
view: "vendorsTab" | undefined;
|
|
44
|
+
isExpressPayPage: boolean | undefined;
|
|
44
45
|
}, "vendorView/saveVendor", never, never>, saveVendorSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[fetchState: FetchState, vendorId?: string | undefined, error?: ZeniAPIStatus<Record<string, unknown>> | undefined, userVerificationFailed?: boolean | undefined], {
|
|
45
46
|
fetchState: FetchState;
|
|
46
47
|
vendorId: string | undefined;
|
|
@@ -54,7 +55,9 @@ export declare const fetchVendorDetails: import("@reduxjs/toolkit").ActionCreato
|
|
|
54
55
|
isCreatable?: boolean;
|
|
55
56
|
}, "vendorView/updateVendorDetailLocalData">, resetVendorDetailLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId?: string | undefined], {
|
|
56
57
|
vendorId: string | undefined;
|
|
57
|
-
}, "vendorView/resetVendorDetailLocalData", never, never>,
|
|
58
|
+
}, "vendorView/resetVendorDetailLocalData", never, never>, resetVendorSaveStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
59
|
+
vendorId?: ID;
|
|
60
|
+
}, "vendorView/resetVendorSaveStatus">, updateContactsInVendorDetailLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
58
61
|
vendorId?: ID;
|
|
59
62
|
contacts: VendorContactInfo[];
|
|
60
63
|
}, "vendorView/updateContactsInVendorDetailLocalData">, fetchVendorDetailPageView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId: string, entity: Entity, cacheOverride?: boolean | undefined], {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.indicateReadyToInitializeBillLocalStore = exports.waitForVendorRecommendationAndUpdatedRecommendationByLineId = exports.updateRecommendationsInVendorDetailLocalData = exports.fetchAndUpdateVendorRecommendations = exports.clearVendorView = exports.verifyUserFailure = exports.verifyUserSuccess = exports.verifyUser = exports.verifyOtpVendorViewFailure = exports.verifyOtpVendorViewSuccess = exports.verifyOtpVendorView = exports.resendOtpVendorView = exports.sendOtpVendorViewFailure = exports.sendOtpVendorViewSuccess = exports.sendOtpVendorView = exports.fetchUserDetailsFailure = exports.fetchUserDetailsSuccess = exports.fetchUserDetails = exports.fetchVendorDetailPageView = exports.updateContactsInVendorDetailLocalData = exports.resetVendorDetailLocalData = exports.updateVendorDetailLocalData = exports.initializeVendorAddress = exports.updateSelectedVendorForCreateFlow = exports.saveVendorSuccessOrFailure = exports.saveVendor = exports.updateCountryCurrencyInVendorView = exports.removePaymentInstrumentsInVendorView = exports.updatePaymentInstrumentsInVendorView = exports.removeBankAccountsInVendorView = exports.updateBankAccountsInVendorView = exports.updateVendorSaveStatus = exports.updateVendorFetchStatus = exports.fetchVendor = exports.fetchVendorDetails = exports.initialState = exports.initialVendorDetailLocalData = void 0;
|
|
4
|
+
exports.indicateReadyToInitializeBillLocalStore = exports.waitForVendorRecommendationAndUpdatedRecommendationByLineId = exports.updateRecommendationsInVendorDetailLocalData = exports.fetchAndUpdateVendorRecommendations = exports.clearVendorView = exports.verifyUserFailure = exports.verifyUserSuccess = exports.verifyUser = exports.verifyOtpVendorViewFailure = exports.verifyOtpVendorViewSuccess = exports.verifyOtpVendorView = exports.resendOtpVendorView = exports.sendOtpVendorViewFailure = exports.sendOtpVendorViewSuccess = exports.sendOtpVendorView = exports.fetchUserDetailsFailure = exports.fetchUserDetailsSuccess = exports.fetchUserDetails = exports.fetchVendorDetailPageView = exports.updateContactsInVendorDetailLocalData = exports.resetVendorSaveStatus = exports.resetVendorDetailLocalData = exports.updateVendorDetailLocalData = exports.initializeVendorAddress = exports.updateSelectedVendorForCreateFlow = exports.saveVendorSuccessOrFailure = exports.saveVendor = exports.updateCountryCurrencyInVendorView = exports.removePaymentInstrumentsInVendorView = exports.updatePaymentInstrumentsInVendorView = exports.removeBankAccountsInVendorView = exports.updateBankAccountsInVendorView = exports.updateVendorSaveStatus = exports.updateVendorFetchStatus = exports.fetchVendor = exports.fetchVendorDetails = exports.initialState = exports.initialVendorDetailLocalData = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
exports.initialVendorDetailLocalData = {
|
|
7
7
|
contacts: [],
|
|
@@ -267,12 +267,13 @@ const vendorView = (0, toolkit_1.createSlice)({
|
|
|
267
267
|
draft.newVendorState.saveStatus.error = undefined;
|
|
268
268
|
}
|
|
269
269
|
},
|
|
270
|
-
prepare(vendorId, billId, view) {
|
|
270
|
+
prepare(vendorId, billId, view, isExpressPayPage) {
|
|
271
271
|
return {
|
|
272
272
|
payload: {
|
|
273
273
|
vendorId,
|
|
274
274
|
billId,
|
|
275
275
|
view,
|
|
276
|
+
isExpressPayPage,
|
|
276
277
|
},
|
|
277
278
|
};
|
|
278
279
|
},
|
|
@@ -348,6 +349,17 @@ const vendorView = (0, toolkit_1.createSlice)({
|
|
|
348
349
|
if (draft.editVendorStateById[vendorId] != null) {
|
|
349
350
|
draft.editVendorStateById[vendorId].vendorDetailLocalData = Object.assign(Object.assign(Object.assign({}, exports.initialVendorDetailLocalData), localData), { contacts: contacts.map((contact) => (Object.assign({}, contact))) });
|
|
350
351
|
}
|
|
352
|
+
else {
|
|
353
|
+
draft.editVendorStateById[vendorId] = {
|
|
354
|
+
vendorDetailLocalData: Object.assign(Object.assign({}, exports.initialVendorDetailLocalData), localData),
|
|
355
|
+
fetchStatus: {
|
|
356
|
+
fetchState: 'Not-Started',
|
|
357
|
+
},
|
|
358
|
+
saveStatus: {
|
|
359
|
+
fetchState: 'Not-Started',
|
|
360
|
+
},
|
|
361
|
+
};
|
|
362
|
+
}
|
|
351
363
|
}
|
|
352
364
|
}
|
|
353
365
|
},
|
|
@@ -373,6 +385,21 @@ const vendorView = (0, toolkit_1.createSlice)({
|
|
|
373
385
|
};
|
|
374
386
|
},
|
|
375
387
|
},
|
|
388
|
+
resetVendorSaveStatus(draft, action) {
|
|
389
|
+
const { vendorId } = action.payload;
|
|
390
|
+
if (vendorId != null && draft.editVendorStateById[vendorId] != null) {
|
|
391
|
+
draft.editVendorStateById[vendorId].saveStatus = {
|
|
392
|
+
fetchState: 'Not-Started',
|
|
393
|
+
error: undefined,
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
draft.newVendorState.saveStatus = {
|
|
398
|
+
fetchState: 'Not-Started',
|
|
399
|
+
error: undefined,
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
},
|
|
376
403
|
fetchVendorDetailPageView: {
|
|
377
404
|
reducer(
|
|
378
405
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -493,5 +520,5 @@ const vendorView = (0, toolkit_1.createSlice)({
|
|
|
493
520
|
},
|
|
494
521
|
},
|
|
495
522
|
});
|
|
496
|
-
_a = vendorView.actions, exports.fetchVendorDetails = _a.fetchVendorDetails, exports.fetchVendor = _a.fetchVendor, exports.updateVendorFetchStatus = _a.updateVendorFetchStatus, exports.updateVendorSaveStatus = _a.updateVendorSaveStatus, exports.updateBankAccountsInVendorView = _a.updateBankAccountsInVendorView, exports.removeBankAccountsInVendorView = _a.removeBankAccountsInVendorView, exports.updatePaymentInstrumentsInVendorView = _a.updatePaymentInstrumentsInVendorView, exports.removePaymentInstrumentsInVendorView = _a.removePaymentInstrumentsInVendorView, exports.updateCountryCurrencyInVendorView = _a.updateCountryCurrencyInVendorView, exports.saveVendor = _a.saveVendor, exports.saveVendorSuccessOrFailure = _a.saveVendorSuccessOrFailure, exports.updateSelectedVendorForCreateFlow = _a.updateSelectedVendorForCreateFlow, exports.initializeVendorAddress = _a.initializeVendorAddress, exports.updateVendorDetailLocalData = _a.updateVendorDetailLocalData, exports.resetVendorDetailLocalData = _a.resetVendorDetailLocalData, exports.updateContactsInVendorDetailLocalData = _a.updateContactsInVendorDetailLocalData, exports.fetchVendorDetailPageView = _a.fetchVendorDetailPageView, exports.fetchUserDetails = _a.fetchUserDetails, exports.fetchUserDetailsSuccess = _a.fetchUserDetailsSuccess, exports.fetchUserDetailsFailure = _a.fetchUserDetailsFailure, exports.sendOtpVendorView = _a.sendOtpVendorView, exports.sendOtpVendorViewSuccess = _a.sendOtpVendorViewSuccess, exports.sendOtpVendorViewFailure = _a.sendOtpVendorViewFailure, exports.resendOtpVendorView = _a.resendOtpVendorView, exports.verifyOtpVendorView = _a.verifyOtpVendorView, exports.verifyOtpVendorViewSuccess = _a.verifyOtpVendorViewSuccess, exports.verifyOtpVendorViewFailure = _a.verifyOtpVendorViewFailure, exports.verifyUser = _a.verifyUser, exports.verifyUserSuccess = _a.verifyUserSuccess, exports.verifyUserFailure = _a.verifyUserFailure, exports.clearVendorView = _a.clearVendorView, exports.fetchAndUpdateVendorRecommendations = _a.fetchAndUpdateVendorRecommendations, exports.updateRecommendationsInVendorDetailLocalData = _a.updateRecommendationsInVendorDetailLocalData, exports.waitForVendorRecommendationAndUpdatedRecommendationByLineId = _a.waitForVendorRecommendationAndUpdatedRecommendationByLineId, exports.indicateReadyToInitializeBillLocalStore = _a.indicateReadyToInitializeBillLocalStore;
|
|
523
|
+
_a = vendorView.actions, exports.fetchVendorDetails = _a.fetchVendorDetails, exports.fetchVendor = _a.fetchVendor, exports.updateVendorFetchStatus = _a.updateVendorFetchStatus, exports.updateVendorSaveStatus = _a.updateVendorSaveStatus, exports.updateBankAccountsInVendorView = _a.updateBankAccountsInVendorView, exports.removeBankAccountsInVendorView = _a.removeBankAccountsInVendorView, exports.updatePaymentInstrumentsInVendorView = _a.updatePaymentInstrumentsInVendorView, exports.removePaymentInstrumentsInVendorView = _a.removePaymentInstrumentsInVendorView, exports.updateCountryCurrencyInVendorView = _a.updateCountryCurrencyInVendorView, exports.saveVendor = _a.saveVendor, exports.saveVendorSuccessOrFailure = _a.saveVendorSuccessOrFailure, exports.updateSelectedVendorForCreateFlow = _a.updateSelectedVendorForCreateFlow, exports.initializeVendorAddress = _a.initializeVendorAddress, exports.updateVendorDetailLocalData = _a.updateVendorDetailLocalData, exports.resetVendorDetailLocalData = _a.resetVendorDetailLocalData, exports.resetVendorSaveStatus = _a.resetVendorSaveStatus, exports.updateContactsInVendorDetailLocalData = _a.updateContactsInVendorDetailLocalData, exports.fetchVendorDetailPageView = _a.fetchVendorDetailPageView, exports.fetchUserDetails = _a.fetchUserDetails, exports.fetchUserDetailsSuccess = _a.fetchUserDetailsSuccess, exports.fetchUserDetailsFailure = _a.fetchUserDetailsFailure, exports.sendOtpVendorView = _a.sendOtpVendorView, exports.sendOtpVendorViewSuccess = _a.sendOtpVendorViewSuccess, exports.sendOtpVendorViewFailure = _a.sendOtpVendorViewFailure, exports.resendOtpVendorView = _a.resendOtpVendorView, exports.verifyOtpVendorView = _a.verifyOtpVendorView, exports.verifyOtpVendorViewSuccess = _a.verifyOtpVendorViewSuccess, exports.verifyOtpVendorViewFailure = _a.verifyOtpVendorViewFailure, exports.verifyUser = _a.verifyUser, exports.verifyUserSuccess = _a.verifyUserSuccess, exports.verifyUserFailure = _a.verifyUserFailure, exports.clearVendorView = _a.clearVendorView, exports.fetchAndUpdateVendorRecommendations = _a.fetchAndUpdateVendorRecommendations, exports.updateRecommendationsInVendorDetailLocalData = _a.updateRecommendationsInVendorDetailLocalData, exports.waitForVendorRecommendationAndUpdatedRecommendationByLineId = _a.waitForVendorRecommendationAndUpdatedRecommendationByLineId, exports.indicateReadyToInitializeBillLocalStore = _a.indicateReadyToInitializeBillLocalStore;
|
|
497
524
|
exports.default = vendorView.reducer;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateAccounts } from '../../../../../entity/account/accountReducer';
|
|
4
|
+
import { RootState } from '../../../../../reducer';
|
|
5
|
+
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
6
|
+
import { fetchAccountSettingsListForAccountTypes, updateAccountSettingsListForAccountTypes, updateAccountSettingsListForAccountTypesFailure } from '../../../reducers/jeSchedulesViewReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof fetchAccountSettingsListForAccountTypes> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAccountSettingsListForAccountTypes> | ReturnType<typeof updateAccountSettingsListForAccountTypesFailure>;
|
|
8
|
+
export declare const fetchAccountSettingsListForAccountTypesEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchAccountSettingsListForAccountTypesEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const accountReducer_1 = require("../../../../../entity/account/accountReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../../../responsePayload");
|
|
8
|
+
const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
|
|
9
|
+
const fetchAccountSettingsListForAccountTypesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchAccountSettingsListForAccountTypes.match), (0, operators_1.switchMap)(() => {
|
|
10
|
+
const queryParam = {
|
|
11
|
+
is_bookkeeping_admin: false,
|
|
12
|
+
is_include_tax_1099_config: false,
|
|
13
|
+
};
|
|
14
|
+
return zeniAPI
|
|
15
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accounts?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
16
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
|
+
const actions = [];
|
|
19
|
+
const accountListPayload = [];
|
|
20
|
+
response.data.accounts.forEach((account) => {
|
|
21
|
+
accountListPayload.push(account);
|
|
22
|
+
});
|
|
23
|
+
actions.push((0, accountReducer_1.updateAccounts)([...accountListPayload], 'account_list_by_type'));
|
|
24
|
+
actions.push((0, jeSchedulesViewReducer_1.updateAccountSettingsListForAccountTypes)({
|
|
25
|
+
accountPayload: accountListPayload,
|
|
26
|
+
}));
|
|
27
|
+
return (0, rxjs_1.from)(actions);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.updateAccountSettingsListForAccountTypesFailure)({
|
|
31
|
+
status: response.status,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
}), (0, operators_1.catchError)((error) => {
|
|
35
|
+
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.updateAccountSettingsListForAccountTypesFailure)({
|
|
36
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Accounts For Account Type REST API call errored out' +
|
|
37
|
+
JSON.stringify(error)),
|
|
38
|
+
}));
|
|
39
|
+
}));
|
|
40
|
+
}));
|
|
41
|
+
exports.fetchAccountSettingsListForAccountTypesEpic = fetchAccountSettingsListForAccountTypesEpic;
|
|
@@ -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 { fetchRecommendationForAccountSettings, updateRecommendationForAccountSettings, updateRecommendationForAccountSettingsFailure } from '../../../reducers/jeSchedulesViewReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof updateRecommendationForAccountSettings> | ReturnType<typeof fetchRecommendationForAccountSettings> | ReturnType<typeof updateRecommendationForAccountSettingsFailure>;
|
|
7
|
+
export declare const fetchRecommendationForAccountSettingsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchRecommendationForAccountSettingsEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../../responsePayload");
|
|
7
|
+
const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
|
|
8
|
+
const fetchRecommendationForAccountSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchRecommendationForAccountSettings.match), (0, operators_1.switchMap)(() => {
|
|
9
|
+
return zeniAPI
|
|
10
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/account-recommendations`)
|
|
11
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
12
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
13
|
+
const actions = [];
|
|
14
|
+
actions.push((0, jeSchedulesViewReducer_1.updateRecommendationForAccountSettings)(response.data));
|
|
15
|
+
return (0, rxjs_1.from)(actions);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.updateRecommendationForAccountSettingsFailure)({
|
|
19
|
+
status: response.status,
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.updateRecommendationForAccountSettingsFailure)({
|
|
23
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch account recommendations REST API call errored out' +
|
|
24
|
+
JSON.stringify(error)),
|
|
25
|
+
}))));
|
|
26
|
+
}));
|
|
27
|
+
exports.fetchRecommendationForAccountSettingsEpic = fetchRecommendationForAccountSettingsEpic;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ActionsObservable } from 'redux-observable';
|
|
2
|
+
import { fetchAccountSettingsListForAccountTypes, fetchRecommendationForAccountSettings, initializeAccountSettingsView } from '../../../reducers/jeSchedulesViewReducer';
|
|
3
|
+
export type ActionType = ReturnType<typeof fetchAccountSettingsListForAccountTypes> | ReturnType<typeof fetchRecommendationForAccountSettings> | ReturnType<typeof initializeAccountSettingsView>;
|
|
4
|
+
export declare const initializeAccountSettingsViewEpic: (actions$: ActionsObservable<ActionType>) => import("rxjs").Observable<ActionType>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initializeAccountSettingsViewEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
|
|
7
|
+
const initializeAccountSettingsViewEpic = (actions$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.initializeAccountSettingsView.match), (0, operators_1.mergeMap)(() => {
|
|
8
|
+
const fetchActions = [];
|
|
9
|
+
fetchActions.push((0, jeSchedulesViewReducer_1.fetchAccountSettingsListForAccountTypes)());
|
|
10
|
+
fetchActions.push((0, jeSchedulesViewReducer_1.fetchRecommendationForAccountSettings)());
|
|
11
|
+
return (0, rxjs_1.from)(fetchActions);
|
|
12
|
+
}));
|
|
13
|
+
exports.initializeAccountSettingsViewEpic = initializeAccountSettingsViewEpic;
|
|
@@ -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 { saveAccountSettings, saveAccountSettingsFailure, saveAccountSettingsSuccess } from '../../../reducers/jeSchedulesViewReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof saveAccountSettings> | ReturnType<typeof saveAccountSettingsFailure> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveAccountSettingsSuccess>;
|
|
8
|
+
export declare const saveAccountSettingsViewEpic: (actions$: ActionsObservable<ActionType>, state: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|