@zeniai/client-epic-state 4.13.5 → 4.13.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/entity/account/accountPayload.d.ts +1 -1
- package/lib/entity/chargeCard/chargeCard.d.ts +16 -2
- package/lib/entity/chargeCard/chargeCard.js +18 -1
- package/lib/entity/chargeCard/chargeCardPayload.d.ts +14 -5
- package/lib/entity/chargeCard/chargeCardPayload.js +24 -7
- package/lib/entity/tenant/clearAllEpic.d.ts +4 -1
- package/lib/entity/tenant/clearAllEpic.js +6 -0
- package/lib/entity/vendor/__mocks__/vendorMock.js +0 -2
- package/lib/entity/vendor/__mocks__/vendorStateMocks.d.ts +1 -0
- package/lib/entity/vendor/__mocks__/vendorStateMocks.js +73 -4
- package/lib/entity/vendor/vendorPayload.d.ts +6 -1
- package/lib/entity/vendor/vendorPayload.js +3 -3
- package/lib/entity/vendor/vendorState.d.ts +8 -1
- package/lib/entity/vendor/vendorType.d.ts +2 -0
- package/lib/entity/vendor/vendorType.js +4 -1
- package/lib/epic.d.ts +5 -2
- package/lib/epic.js +5 -2
- package/lib/index.d.ts +15 -10
- package/lib/index.js +36 -20
- package/lib/reducer.d.ts +6 -0
- package/lib/reducer.js +6 -0
- package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.d.ts +11 -0
- package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.js +4607 -0
- package/lib/view/accountMappingView/accountMappingPayload.js +75 -32
- package/lib/view/accountMappingView/accountMappingReducer.js +36 -10
- package/lib/view/accountMappingView/accountMappingState.d.ts +1 -1
- package/lib/view/accountMappingView/accountMappingViewSelector.d.ts +5 -0
- package/lib/view/accountMappingView/accountMappingViewSelector.js +11 -1
- package/lib/view/accountMappingView/initializeAccountMappingViewEpic.d.ts +2 -1
- package/lib/view/accountMappingView/initializeAccountMappingViewEpic.js +2 -0
- package/lib/view/accountMappingView/saveAccountMappingViewEpic.js +6 -1
- package/lib/view/addressView/addressViewState.d.ts +1 -1
- package/lib/view/addressView/toAddressViewLocalData.d.ts +2 -0
- package/lib/view/addressView/toAddressViewLocalData.js +5 -4
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +1 -1
- package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +1 -2
- package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.js +2 -5
- package/lib/view/settingsView/epic/updateMyProfileEpic.js +6 -4
- package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingReducer.js +6 -2
- package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingSelector.d.ts +2 -3
- package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingSelector.js +3 -3
- package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingState.d.ts +1 -3
- package/lib/view/spendManagement/chargeCards/cardUserOnboarding/epics/initializeCardUserOnboardingLocalDataEpic.d.ts +1 -2
- package/lib/view/spendManagement/chargeCards/cardUserOnboarding/epics/initializeCardUserOnboardingLocalDataEpic.js +1 -21
- package/lib/view/spendManagement/chargeCards/cardUserOnboarding/epics/saveCardOnboardingUserDetailsEpic.js +1 -3
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +4 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +8 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +25 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +1 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +8 -4
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updatePhysicalChargeCardAttemptEpic.d.ts +11 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updatePhysicalChargeCardAttemptEpic.js +42 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -14
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +2 -13
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +3 -6
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +2 -17
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +8 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +55 -15
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.d.ts +9 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.js +44 -0
- package/lib/view/spendManagement/chargeCards/{chargeCardList → issueChargeCard}/issueChargeCardEpic.d.ts +3 -2
- package/lib/view/spendManagement/chargeCards/{chargeCardList → issueChargeCard}/issueChargeCardEpic.js +35 -18
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +65 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +22 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +76 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +28 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.js +23 -0
- package/lib/view/userListView/fetchUserListByTypeEpic.js +4 -1
- package/lib/view/vendor1099TypeList/vendor1099TypeListEpic.d.ts +7 -0
- package/lib/view/vendor1099TypeList/vendor1099TypeListEpic.js +23 -0
- package/lib/view/vendor1099TypeList/vendor1099TypeListPayload.d.ts +15 -0
- package/lib/view/vendor1099TypeList/vendor1099TypeListPayload.js +2 -0
- package/lib/view/vendor1099TypeList/vendor1099TypeListReducer.d.ts +7 -0
- package/lib/view/vendor1099TypeList/vendor1099TypeListReducer.js +52 -0
- package/lib/view/vendor1099TypeList/vendor1099TypeListState.d.ts +9 -0
- package/lib/view/vendor1099TypeList/vendor1099TypeListState.js +2 -0
- package/lib/view/vendorFiling1099/__mock__/json/vendorFiling1099ListSuccess.json +4 -1
- package/lib/view/vendorFiling1099/__mock__/vendorFiling1099ListMock.js +12 -3
- package/lib/view/vendorFiling1099/__mock__/vendorFiling1099ListSelectorMock.js +2 -4
- package/lib/view/vendorFiling1099/__mock__/vendorFiling1099UploadDetailsMock.d.ts +4 -1
- package/lib/view/vendorFiling1099/vendorFiling1099List/fetchVendorsFiling1099AllEpic.d.ts +2 -2
- package/lib/view/vendorFiling1099/vendorFiling1099List/fetchVendorsFiling1099AllEpic.js +7 -7
- package/lib/view/vendorFiling1099/vendorFiling1099List/vendorFiling1099ListSelector.js +21 -10
- package/lib/view/vendorFiling1099/vendorFiling1099List/vendorFiling1099ListState.d.ts +1 -1
- package/lib/view/vendorFiling1099/vendorFiling1099List/vendorFiling1099ListState.js +1 -0
- package/package.json +1 -1
|
@@ -8,22 +8,39 @@ const chargeCardReducer_1 = require("../../../../entity/chargeCard/chargeCardRed
|
|
|
8
8
|
const userReducer_1 = require("../../../../entity/user/userReducer");
|
|
9
9
|
const userRoleReducer_1 = require("../../../../entity/userRole/userRoleReducer");
|
|
10
10
|
const addressReducer_1 = require("../../../../entity/address/addressReducer");
|
|
11
|
-
const chargeCardListReducer_1 = require("./chargeCardListReducer");
|
|
12
11
|
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
13
|
-
const
|
|
14
|
-
|
|
12
|
+
const issueChargeCardReducer_1 = require("./issueChargeCardReducer");
|
|
13
|
+
const chargeCardListReducer_1 = require("../chargeCardList/chargeCardListReducer");
|
|
14
|
+
const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(issueChargeCardReducer_1.issueChargeCards.match), (0, operators_1.switchMap)(() => {
|
|
15
15
|
const state = state$.value;
|
|
16
|
-
const localData = state.
|
|
17
|
-
const payload =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
const localData = state.issueChargeCardState.localData;
|
|
17
|
+
const payload = localData.map((data) => {
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19
|
+
if (data.cardType === 'business_physical_credit_card') {
|
|
20
|
+
return {
|
|
21
|
+
card_holder_user_ids: data.physicalCard.userIds != null
|
|
22
|
+
? [data.physicalCard.userIds]
|
|
23
|
+
: [],
|
|
24
|
+
card_name: data.physicalCard.cardName,
|
|
25
|
+
credit_limit: (_b = (_a = data.physicalCard.amount) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0,
|
|
26
|
+
currency_code: (_d = (_c = data.physicalCard.amount) === null || _c === void 0 ? void 0 : _c.currencyCode) !== null && _d !== void 0 ? _d : 'USD',
|
|
27
|
+
credit_limit_frequency: { code: data.physicalCard.frequency },
|
|
28
|
+
card_type: data.cardType,
|
|
29
|
+
shipping_address_type: data.physicalCard.addressType,
|
|
30
|
+
shipping_address_id: data.physicalCard.addressId,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return {
|
|
35
|
+
card_holder_user_ids: data.virtualCard.userIds,
|
|
36
|
+
card_name: data.virtualCard.cardName,
|
|
37
|
+
credit_limit: (_f = (_e = data.virtualCard.amount) === null || _e === void 0 ? void 0 : _e.amount) !== null && _f !== void 0 ? _f : 0,
|
|
38
|
+
currency_code: (_h = (_g = data.virtualCard.amount) === null || _g === void 0 ? void 0 : _g.currencyCode) !== null && _h !== void 0 ? _h : 'USD',
|
|
39
|
+
credit_limit_frequency: { code: data.virtualCard.frequency },
|
|
40
|
+
card_type: data.cardType,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
27
44
|
return zeniAPI
|
|
28
45
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards`, { cards: payload })
|
|
29
46
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
@@ -32,7 +49,7 @@ const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
32
49
|
actions.push((0, chargeCardReducer_1.updateChargeCards)(response.data.cards), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, chargeCardListReducer_1.updateChargeCardList)({
|
|
33
50
|
chargeCardListPayload: response.data,
|
|
34
51
|
keepExistingListItems: true,
|
|
35
|
-
}), (0, addressReducer_1.updateAddresses)(response.data.addresses), (0,
|
|
52
|
+
}), (0, addressReducer_1.updateAddresses)(response.data.addresses), (0, issueChargeCardReducer_1.issueChargeCardSuccessOrFailure)({ fetchState: 'Completed' }));
|
|
36
53
|
const cardHolderIds = response.data.cards.map((card) => card.holder_user_id);
|
|
37
54
|
const names = response.data.users
|
|
38
55
|
.filter((user) => cardHolderIds.includes(user.user_id))
|
|
@@ -45,20 +62,20 @@ const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
45
62
|
variables: [
|
|
46
63
|
{
|
|
47
64
|
variableName: '_user-name_',
|
|
48
|
-
variableValue: names
|
|
65
|
+
variableValue: names,
|
|
49
66
|
},
|
|
50
67
|
],
|
|
51
68
|
}));
|
|
52
69
|
return (0, rxjs_1.from)(actions);
|
|
53
70
|
}
|
|
54
71
|
else {
|
|
55
|
-
return (0, rxjs_1.of)((0,
|
|
72
|
+
return (0, rxjs_1.of)((0, issueChargeCardReducer_1.issueChargeCardSuccessOrFailure)({
|
|
56
73
|
fetchState: 'Error',
|
|
57
74
|
error: response.status,
|
|
58
75
|
}));
|
|
59
76
|
}
|
|
60
77
|
}), (0, operators_1.catchError)((error) => {
|
|
61
|
-
return (0, rxjs_1.of)((0,
|
|
78
|
+
return (0, rxjs_1.of)((0, issueChargeCardReducer_1.issueChargeCardSuccessOrFailure)({
|
|
62
79
|
fetchState: 'Error',
|
|
63
80
|
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Issue Charge Card REST API call errored out' +
|
|
64
81
|
JSON.stringify(error)),
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
2
|
+
import { FetchState, ID } from '../../../../commonStateTypes/common';
|
|
3
|
+
import { IssueChargeCardState, IssueChargeCardLocalData } from './issueChargeCardState';
|
|
4
|
+
export declare const initialState: IssueChargeCardState;
|
|
5
|
+
export declare const issueChargeCards: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[], {}, string, never, never>, updateChargeCardsLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPayload<IssueChargeCardLocalData[], string>, issueChargeCardSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
6
|
+
fetchState: FetchState;
|
|
7
|
+
error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
8
|
+
}, string>, resetIssueChargeCardForm: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateCustomAddressId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
9
|
+
addressId: ID;
|
|
10
|
+
cardLineId: ID;
|
|
11
|
+
}, string>, fetchIssueCardPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any], {
|
|
12
|
+
cacheOverride: any;
|
|
13
|
+
}, string, never, never>, clearIssueChargeCard: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
14
|
+
declare const _default: import("@reduxjs/toolkit").Reducer<IssueChargeCardState, import("@reduxjs/toolkit").AnyAction>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.clearIssueChargeCard = exports.fetchIssueCardPage = exports.updateCustomAddressId = exports.resetIssueChargeCardForm = exports.issueChargeCardSuccessOrFailure = exports.updateChargeCardsLocalStore = exports.issueChargeCards = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const issueChargeCardState_1 = require("./issueChargeCardState");
|
|
7
|
+
exports.initialState = {
|
|
8
|
+
localData: issueChargeCardState_1.initialIssueChargeCardLocalData,
|
|
9
|
+
fetchState: 'Not-Started',
|
|
10
|
+
error: undefined,
|
|
11
|
+
saveStatus: {
|
|
12
|
+
fetchState: 'Not-Started',
|
|
13
|
+
error: undefined,
|
|
14
|
+
},
|
|
15
|
+
hasValidState() {
|
|
16
|
+
return this.fetchState == 'Completed';
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const issueChargeCard = (0, toolkit_1.createSlice)({
|
|
20
|
+
name: 'issueChargeCard',
|
|
21
|
+
initialState: exports.initialState,
|
|
22
|
+
reducers: {
|
|
23
|
+
fetchIssueCardPage: {
|
|
24
|
+
reducer() {
|
|
25
|
+
//do nothing
|
|
26
|
+
},
|
|
27
|
+
prepare(cacheOverride = false) {
|
|
28
|
+
return {
|
|
29
|
+
payload: { cacheOverride },
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
issueChargeCards: {
|
|
34
|
+
prepare() {
|
|
35
|
+
return { payload: {} };
|
|
36
|
+
},
|
|
37
|
+
reducer(draft) {
|
|
38
|
+
draft.saveStatus.fetchState = 'In-Progress';
|
|
39
|
+
draft.saveStatus.error = undefined;
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
updateChargeCardsLocalStore(draft, action) {
|
|
43
|
+
draft.localData = action.payload;
|
|
44
|
+
},
|
|
45
|
+
resetIssueChargeCardForm(draft) {
|
|
46
|
+
draft.localData = [...exports.initialState.localData];
|
|
47
|
+
},
|
|
48
|
+
issueChargeCardSuccessOrFailure(draft, action) {
|
|
49
|
+
draft.saveStatus.fetchState = action.payload.fetchState;
|
|
50
|
+
draft.saveStatus.error = action.payload.error;
|
|
51
|
+
},
|
|
52
|
+
updateCustomAddressId(draft, action) {
|
|
53
|
+
const { addressId, cardLineId } = action.payload;
|
|
54
|
+
const targetIndex = draft.localData.findIndex((lineItem) => lineItem.lineId === cardLineId);
|
|
55
|
+
if (targetIndex > -1) {
|
|
56
|
+
draft.localData[targetIndex] = Object.assign(Object.assign({}, draft.localData[targetIndex]), { physicalCard: Object.assign(Object.assign({}, draft.localData[targetIndex].physicalCard), { addressId: addressId }) });
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
clearIssueChargeCard(draft) {
|
|
60
|
+
Object.assign(draft, exports.initialState);
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
_a = issueChargeCard.actions, exports.issueChargeCards = _a.issueChargeCards, exports.updateChargeCardsLocalStore = _a.updateChargeCardsLocalStore, exports.issueChargeCardSuccessOrFailure = _a.issueChargeCardSuccessOrFailure, exports.resetIssueChargeCardForm = _a.resetIssueChargeCardForm, exports.updateCustomAddressId = _a.updateCustomAddressId, exports.fetchIssueCardPage = _a.fetchIssueCardPage, exports.clearIssueChargeCard = _a.clearIssueChargeCard;
|
|
65
|
+
exports.default = issueChargeCard.reducer;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RootState } from '../../../../reducer';
|
|
2
|
+
import { FetchStateAndError, ID } from '../../../../commonStateTypes/common';
|
|
3
|
+
import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
|
+
import { Address } from '../../../../entity/address/addressState';
|
|
5
|
+
import { Person } from '../../../people/peopleSelectorTypes';
|
|
6
|
+
import { Class } from '../../../../entity/class/classState';
|
|
7
|
+
import { IssueChargeCardLocalData } from './issueChargeCardState';
|
|
8
|
+
import { ChargeCardConfigState } from '../chargeCardConfig/chargeCardConfigState';
|
|
9
|
+
import { CreditAccount } from '../chargeCardList/chargeCardList';
|
|
10
|
+
export interface IssueChargeCardSelectorView extends SelectorView {
|
|
11
|
+
localData: IssueChargeCardLocalData[];
|
|
12
|
+
issueCardStatus: FetchStateAndError;
|
|
13
|
+
userList: Person[];
|
|
14
|
+
allAccountingClasses: Class[];
|
|
15
|
+
chargeCardConfig: ChargeCardConfigState;
|
|
16
|
+
creditAccount: CreditAccount;
|
|
17
|
+
customAddress: Record<ID, Address>;
|
|
18
|
+
customAddressStatus: Record<ID, FetchStateAndError>;
|
|
19
|
+
userAddress: Record<ID, Address>;
|
|
20
|
+
companyAddress?: Address;
|
|
21
|
+
}
|
|
22
|
+
export declare const getIssueChargeCardView: (state: RootState) => IssueChargeCardSelectorView;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getIssueChargeCardView = void 0;
|
|
4
|
+
const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
|
|
5
|
+
const addressSelector_1 = require("../../../../entity/address/addressSelector");
|
|
6
|
+
const addressViewSelector_1 = require("../../../addressView/addressViewSelector");
|
|
7
|
+
const getCompanyView_1 = require("../../../companyView/selectorHelpers/getCompanyView");
|
|
8
|
+
const classSelector_1 = require("../../../../entity/class/classSelector");
|
|
9
|
+
const userListViewSelector_1 = require("../../../userListView/userListViewSelector");
|
|
10
|
+
const getIssueChargeCardView = (state) => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const { issueChargeCardState, userState, userRoleState, userListViewState, chargeCardConfigState, chargeCardListState, tenantState, addressState, classState, classListState, } = state;
|
|
13
|
+
const userListSelectorView = (0, userListViewSelector_1.getUserList)(userState, userRoleState, userListViewState, 'cardHolderCandidate');
|
|
14
|
+
const userList = userListSelectorView.users;
|
|
15
|
+
let selectedUserAddress = {};
|
|
16
|
+
userList.forEach((user) => {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
const userAddress = (0, addressSelector_1.getAddressByAddressId)(addressState, (_b = (_a = user.user) === null || _a === void 0 ? void 0 : _a.addressId) !== null && _b !== void 0 ? _b : '');
|
|
19
|
+
if (userAddress != null) {
|
|
20
|
+
selectedUserAddress = Object.assign(Object.assign({}, selectedUserAddress), { [user.userId]: userAddress });
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const { currentTenantId } = tenantState;
|
|
24
|
+
const companyId = currentTenantId != null
|
|
25
|
+
? (_b = (_a = tenantState.tenantsById) === null || _a === void 0 ? void 0 : _a[currentTenantId]) === null || _b === void 0 ? void 0 : _b.companyId
|
|
26
|
+
: '';
|
|
27
|
+
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
28
|
+
const companyAddress = companyView === null || companyView === void 0 ? void 0 : companyView.companyAddress;
|
|
29
|
+
let customAddressStatus = {};
|
|
30
|
+
let customAddress = {};
|
|
31
|
+
const defaultFetchState = {
|
|
32
|
+
fetchState: 'Not-Started',
|
|
33
|
+
error: undefined,
|
|
34
|
+
};
|
|
35
|
+
issueChargeCardState.localData.forEach((lineItem) => {
|
|
36
|
+
var _a;
|
|
37
|
+
if (lineItem.cardType === 'business_physical_credit_card') {
|
|
38
|
+
const targetLineId = lineItem.lineId;
|
|
39
|
+
const newlyAddedAddress = (0, addressViewSelector_1.getNewAddress)(`custom_shipping_${targetLineId}_address`, state);
|
|
40
|
+
customAddressStatus = Object.assign(Object.assign({}, customAddressStatus), { [targetLineId]: (_a = newlyAddedAddress === null || newlyAddedAddress === void 0 ? void 0 : newlyAddedAddress.status) !== null && _a !== void 0 ? _a : defaultFetchState });
|
|
41
|
+
if (newlyAddedAddress != null &&
|
|
42
|
+
newlyAddedAddress.status.fetchState === 'Completed' &&
|
|
43
|
+
newlyAddedAddress.newAddressId != null) {
|
|
44
|
+
const addressFromEntity = (0, addressSelector_1.getAddressByAddressId)(addressState, newlyAddedAddress.newAddressId);
|
|
45
|
+
if (addressFromEntity != null) {
|
|
46
|
+
customAddress = Object.assign(Object.assign({}, customAddress), { [targetLineId]: addressFromEntity });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const issueCardPageFetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
52
|
+
chargeCardConfigState,
|
|
53
|
+
userListSelectorView,
|
|
54
|
+
chargeCardListState.creditAccount,
|
|
55
|
+
]);
|
|
56
|
+
const { classIds } = classListState;
|
|
57
|
+
const allAccountingClasses = (0, classSelector_1.getClassesByIds)(classState, {
|
|
58
|
+
classIds: classIds,
|
|
59
|
+
reportId: 'class_list',
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
fetchState: issueCardPageFetchState.fetchState,
|
|
63
|
+
error: issueCardPageFetchState.error,
|
|
64
|
+
issueCardStatus: issueChargeCardState.saveStatus,
|
|
65
|
+
localData: issueChargeCardState.localData,
|
|
66
|
+
userList,
|
|
67
|
+
chargeCardConfig: chargeCardConfigState,
|
|
68
|
+
creditAccount: chargeCardListState.creditAccount,
|
|
69
|
+
companyAddress: companyAddress,
|
|
70
|
+
customAddress,
|
|
71
|
+
customAddressStatus,
|
|
72
|
+
userAddress: selectedUserAddress,
|
|
73
|
+
allAccountingClasses,
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
exports.getIssueChargeCardView = getIssueChargeCardView;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Amount } from '../../../../commonStateTypes/amount';
|
|
2
|
+
import { FetchedState, FetchStateAndError, ID } from '../../../../commonStateTypes/common';
|
|
3
|
+
import { CreditLimitFrequencyCodeType, CardCodeType, ShippingAddressType } from '../../../../entity/chargeCard/chargeCard';
|
|
4
|
+
export interface IssueChargeCardState extends FetchedState {
|
|
5
|
+
localData: IssueChargeCardLocalData[];
|
|
6
|
+
saveStatus: FetchStateAndError;
|
|
7
|
+
}
|
|
8
|
+
export interface PhysicalCardData {
|
|
9
|
+
addressType: ShippingAddressType;
|
|
10
|
+
cardName: string;
|
|
11
|
+
frequency: CreditLimitFrequencyCodeType;
|
|
12
|
+
addressId?: ID;
|
|
13
|
+
amount?: Amount;
|
|
14
|
+
userIds?: ID;
|
|
15
|
+
}
|
|
16
|
+
export interface VirtualCardData {
|
|
17
|
+
userIds: ID[];
|
|
18
|
+
cardName: string;
|
|
19
|
+
frequency: CreditLimitFrequencyCodeType;
|
|
20
|
+
amount?: Amount;
|
|
21
|
+
}
|
|
22
|
+
export interface IssueChargeCardLocalData {
|
|
23
|
+
lineId: ID;
|
|
24
|
+
cardType: CardCodeType;
|
|
25
|
+
physicalCard: PhysicalCardData;
|
|
26
|
+
virtualCard: VirtualCardData;
|
|
27
|
+
}
|
|
28
|
+
export declare const initialIssueChargeCardLocalData: IssueChargeCardLocalData[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initialIssueChargeCardLocalData = void 0;
|
|
4
|
+
exports.initialIssueChargeCardLocalData = [
|
|
5
|
+
{
|
|
6
|
+
lineId: '1',
|
|
7
|
+
cardType: 'business_virtual_credit_card',
|
|
8
|
+
physicalCard: {
|
|
9
|
+
addressType: 'company_address',
|
|
10
|
+
cardName: '',
|
|
11
|
+
frequency: 'monthly',
|
|
12
|
+
addressId: undefined,
|
|
13
|
+
amount: undefined,
|
|
14
|
+
userIds: undefined,
|
|
15
|
+
},
|
|
16
|
+
virtualCard: {
|
|
17
|
+
userIds: [],
|
|
18
|
+
cardName: '',
|
|
19
|
+
frequency: 'monthly',
|
|
20
|
+
amount: undefined,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
];
|
|
@@ -46,7 +46,10 @@ const getQueryParam = (userType, isZeniTenant) => {
|
|
|
46
46
|
case 'manager':
|
|
47
47
|
return { is_manager_candidate: true };
|
|
48
48
|
case 'cardHolderCandidate':
|
|
49
|
-
return {
|
|
49
|
+
return {
|
|
50
|
+
is_card_holder_candidate: true,
|
|
51
|
+
is_include_active_cards_count: true,
|
|
52
|
+
};
|
|
50
53
|
case 'taskManagerCandidate':
|
|
51
54
|
return { is_task_manager_candidate: true };
|
|
52
55
|
case 'cardAdmin':
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ZeniAPI } from '../../zeniAPI';
|
|
4
|
+
import { RootState } from '../../reducer';
|
|
5
|
+
import { fetchVendor1099TypeList, updateVendor1099TypeList, updateVendor1099TypeListFailure } from './vendor1099TypeListReducer';
|
|
6
|
+
export declare type ActionType = ReturnType<typeof fetchVendor1099TypeList> | ReturnType<typeof updateVendor1099TypeList> | ReturnType<typeof updateVendor1099TypeListFailure>;
|
|
7
|
+
export declare const fetchVendor1099TypeListEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchVendor1099TypeListEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../responsePayload");
|
|
7
|
+
const vendor1099TypeListReducer_1 = require("./vendor1099TypeListReducer");
|
|
8
|
+
const fetchVendor1099TypeListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(vendor1099TypeListReducer_1.fetchVendor1099TypeList.match), (0, operators_1.switchMap)(() => {
|
|
9
|
+
return zeniAPI
|
|
10
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/1099-config`)
|
|
11
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
12
|
+
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
13
|
+
return (0, rxjs_1.of)((0, vendor1099TypeListReducer_1.updateVendor1099TypeList)(response));
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return (0, rxjs_1.of)((0, vendor1099TypeListReducer_1.updateVendor1099TypeListFailure)(response.status));
|
|
17
|
+
}
|
|
18
|
+
}), (0, operators_1.catchError)((error) => {
|
|
19
|
+
return (0, rxjs_1.of)((0, vendor1099TypeListReducer_1.updateVendor1099TypeListFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch vendor 1099 types REST API call errored out' +
|
|
20
|
+
JSON.stringify(error))));
|
|
21
|
+
}));
|
|
22
|
+
}));
|
|
23
|
+
exports.fetchVendor1099TypeListEpic = fetchVendor1099TypeListEpic;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ZeniAPIResponse } from '../../responsePayload';
|
|
2
|
+
import { VendorType } from '../vendorTypeList/vendorTypeListPayload';
|
|
3
|
+
export interface Expense1099Type {
|
|
4
|
+
int: VendorType[];
|
|
5
|
+
misc: VendorType[];
|
|
6
|
+
nec: VendorType[];
|
|
7
|
+
}
|
|
8
|
+
interface Vendor1099TypePayload {
|
|
9
|
+
vendor_types: VendorType[];
|
|
10
|
+
expense_types: VendorType[];
|
|
11
|
+
expense_1099_types: VendorType[];
|
|
12
|
+
expense_1099_box_type: Expense1099Type;
|
|
13
|
+
}
|
|
14
|
+
export declare type Vendor1099TypeListResponse = ZeniAPIResponse<Vendor1099TypePayload>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ZeniAPIStatus } from '../../responsePayload';
|
|
2
|
+
import { Vendor1099TypeListResponse } from './vendor1099TypeListPayload';
|
|
3
|
+
import { Vendor1099TypeListState } from './vendor1099TypeListState';
|
|
4
|
+
export declare const initialState: Vendor1099TypeListState;
|
|
5
|
+
export declare const fetchVendor1099TypeList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateVendor1099TypeList: import("@reduxjs/toolkit").ActionCreatorWithPayload<Vendor1099TypeListResponse, string>, updateVendor1099TypeListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, clearVendor1099TypeList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
6
|
+
declare const _default: import("@reduxjs/toolkit").Reducer<Vendor1099TypeListState, import("@reduxjs/toolkit").AnyAction>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.clearVendor1099TypeList = exports.updateVendor1099TypeListFailure = exports.updateVendor1099TypeList = exports.fetchVendor1099TypeList = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
exports.initialState = {
|
|
7
|
+
fetchState: 'Not-Started',
|
|
8
|
+
error: undefined,
|
|
9
|
+
vendorTypes: [],
|
|
10
|
+
expenseTypes: [],
|
|
11
|
+
expense1099Types: [],
|
|
12
|
+
boxTypes: {
|
|
13
|
+
int: [],
|
|
14
|
+
misc: [],
|
|
15
|
+
nec: [],
|
|
16
|
+
},
|
|
17
|
+
hasValidState() {
|
|
18
|
+
return this.fetchState == 'Completed';
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
const vendor1099TypeList = (0, toolkit_1.createSlice)({
|
|
22
|
+
name: 'vendor1099TypeList',
|
|
23
|
+
initialState: exports.initialState,
|
|
24
|
+
reducers: {
|
|
25
|
+
fetchVendor1099TypeList(draft) {
|
|
26
|
+
draft.fetchState = 'In-Progress';
|
|
27
|
+
draft.error = undefined;
|
|
28
|
+
},
|
|
29
|
+
updateVendor1099TypeList(draft, action) {
|
|
30
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
31
|
+
draft.fetchState = 'Completed';
|
|
32
|
+
draft.error = undefined;
|
|
33
|
+
draft.vendorTypes = (_b = (_a = action.payload.data) === null || _a === void 0 ? void 0 : _a.vendor_types) !== null && _b !== void 0 ? _b : [];
|
|
34
|
+
draft.expenseTypes = (_d = (_c = action.payload.data) === null || _c === void 0 ? void 0 : _c.expense_types) !== null && _d !== void 0 ? _d : [];
|
|
35
|
+
draft.expense1099Types = (_f = (_e = action.payload.data) === null || _e === void 0 ? void 0 : _e.expense_1099_types) !== null && _f !== void 0 ? _f : [];
|
|
36
|
+
draft.boxTypes = (_h = (_g = action.payload.data) === null || _g === void 0 ? void 0 : _g.expense_1099_box_type) !== null && _h !== void 0 ? _h : {
|
|
37
|
+
int: [],
|
|
38
|
+
misc: [],
|
|
39
|
+
nec: [],
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
updateVendor1099TypeListFailure(draft, action) {
|
|
43
|
+
draft.fetchState = 'Error';
|
|
44
|
+
draft.error = action.payload;
|
|
45
|
+
},
|
|
46
|
+
clearVendor1099TypeList(draft) {
|
|
47
|
+
Object.assign(draft, exports.initialState);
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
_a = vendor1099TypeList.actions, exports.fetchVendor1099TypeList = _a.fetchVendor1099TypeList, exports.updateVendor1099TypeList = _a.updateVendor1099TypeList, exports.updateVendor1099TypeListFailure = _a.updateVendor1099TypeListFailure, exports.clearVendor1099TypeList = _a.clearVendor1099TypeList;
|
|
52
|
+
exports.default = vendor1099TypeList.reducer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FetchedState } from '../../commonStateTypes/common';
|
|
2
|
+
import { VendorType } from '../vendorTypeList/vendorTypeListPayload';
|
|
3
|
+
import { Expense1099Type } from './vendor1099TypeListPayload';
|
|
4
|
+
export interface Vendor1099TypeListState extends FetchedState {
|
|
5
|
+
vendorTypes: VendorType[];
|
|
6
|
+
expenseTypes: VendorType[];
|
|
7
|
+
expense1099Types: VendorType[];
|
|
8
|
+
boxTypes: Expense1099Type;
|
|
9
|
+
}
|
|
@@ -77,7 +77,10 @@
|
|
|
77
77
|
"value": "550258131"
|
|
78
78
|
},
|
|
79
79
|
"vendor_1099_status": "incomplete",
|
|
80
|
-
"
|
|
80
|
+
"is_type_int": true,
|
|
81
|
+
"is_type_misc": false,
|
|
82
|
+
"is_type_nec": false,
|
|
83
|
+
"vendor_1099_ytd_total_nec": -2287.0,
|
|
81
84
|
"w9_documents": []
|
|
82
85
|
}
|
|
83
86
|
],
|
|
@@ -4,12 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.rootStateWithVendorFiling1099List = exports.vendorFiling1099ListFailureState = exports.vendorFiling1099ListSuccessState = exports.vendorFiling1099ListInProgressInitialState = exports.vendorFiling1099ListInProgressState = exports.vendorFiling1099ListFailureResponse = exports.vendorFiling1099ListSuccessResponse = exports.vendorFiling1099ListSelectorMock = void 0;
|
|
7
|
+
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
7
8
|
const vendorFiling1099ListSuccess_json_1 = __importDefault(require("./json/vendorFiling1099ListSuccess.json"));
|
|
8
9
|
const apiFailure_json_1 = __importDefault(require("../../../__testHelpers__/apiFailure.json"));
|
|
9
10
|
const vendorFiling1099ListReducer_1 = require("../vendorFiling1099List/vendorFiling1099ListReducer");
|
|
10
11
|
const vendorStateMocks_1 = require("../../../entity/vendor/__mocks__/vendorStateMocks");
|
|
11
12
|
const reducer_1 = require("../../../reducer");
|
|
12
|
-
const
|
|
13
|
+
const accountMappingSelectorMock_1 = require("../../accountMappingView/__mocks__/accountMappingSelectorMock");
|
|
13
14
|
var vendorFiling1099ListSelectorMock_1 = require("./vendorFiling1099ListSelectorMock");
|
|
14
15
|
Object.defineProperty(exports, "vendorFiling1099ListSelectorMock", { enumerable: true, get: function () { return vendorFiling1099ListSelectorMock_1.vendorFiling1099ListSelectorMock; } });
|
|
15
16
|
exports.vendorFiling1099ListSuccessResponse = vendorFiling1099ListSuccess_json_1.default;
|
|
@@ -148,7 +149,7 @@ exports.vendorFiling1099ListFailureState = {
|
|
|
148
149
|
exports.rootStateWithVendorFiling1099List = Object.assign({}, reducer_1.initialRootState, {
|
|
149
150
|
vendorState: {
|
|
150
151
|
vendorByID: {
|
|
151
|
-
'vendor_j12jh1g2g12jg3jh12:12': vendorStateMocks_1.
|
|
152
|
+
'vendor_j12jh1g2g12jg3jh12:12': vendorStateMocks_1.vendorStateMock8,
|
|
152
153
|
},
|
|
153
154
|
},
|
|
154
155
|
vendorFiling1099ListState: {
|
|
@@ -183,7 +184,7 @@ exports.rootStateWithVendorFiling1099List = Object.assign({}, reducer_1.initialR
|
|
|
183
184
|
},
|
|
184
185
|
},
|
|
185
186
|
},
|
|
186
|
-
|
|
187
|
+
vendor1099TypeListState: {
|
|
187
188
|
fetchState: 'Completed',
|
|
188
189
|
error: undefined,
|
|
189
190
|
vendorTypes: [
|
|
@@ -196,5 +197,13 @@ exports.rootStateWithVendorFiling1099List = Object.assign({}, reducer_1.initialR
|
|
|
196
197
|
name: 'Individual / Sole-Proprietor or Single-Member LLC',
|
|
197
198
|
},
|
|
198
199
|
],
|
|
200
|
+
expenseTypes: [],
|
|
201
|
+
expense1099Types: [],
|
|
202
|
+
boxTypes: {
|
|
203
|
+
int: [],
|
|
204
|
+
misc: [],
|
|
205
|
+
nec: [],
|
|
206
|
+
},
|
|
199
207
|
},
|
|
208
|
+
accountMappingState: accountMappingSelectorMock_1.accountMappingState,
|
|
200
209
|
});
|
|
@@ -3,12 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.vendorFiling1099ListSelectorMock = void 0;
|
|
4
4
|
const vendorStateMocks_1 = require("../../../entity/vendor/__mocks__/vendorStateMocks");
|
|
5
5
|
exports.vendorFiling1099ListSelectorMock = {
|
|
6
|
-
fetchState: '
|
|
6
|
+
fetchState: 'Completed',
|
|
7
7
|
error: undefined,
|
|
8
8
|
version: 0,
|
|
9
|
-
vendors: [
|
|
10
|
-
Object.assign({}, vendorStateMocks_1.vendorStateMock1),
|
|
11
|
-
],
|
|
9
|
+
vendors: [Object.assign({}, vendorStateMocks_1.vendorStateMock8)],
|
|
12
10
|
lastRefreshSuccessTime: undefined,
|
|
13
11
|
uiState: {
|
|
14
12
|
sortKey: 'total',
|
|
@@ -78,7 +78,10 @@ export declare const vendorFiling1099UploadDetailsSuccessResponse: {
|
|
|
78
78
|
value: string;
|
|
79
79
|
};
|
|
80
80
|
vendor_1099_status: string;
|
|
81
|
-
|
|
81
|
+
is_type_int: boolean;
|
|
82
|
+
is_type_misc: boolean;
|
|
83
|
+
is_type_nec: boolean;
|
|
84
|
+
vendor_1099_ytd_total_nec: number;
|
|
82
85
|
w9_documents: never[];
|
|
83
86
|
}[];
|
|
84
87
|
version: string;
|
|
@@ -2,7 +2,7 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../../reducer';
|
|
4
4
|
import { fetchVendorsFiling1099List } from './vendorFiling1099ListReducer';
|
|
5
|
-
import {
|
|
5
|
+
import { fetchVendor1099TypeList } from '../../vendor1099TypeList/vendor1099TypeListReducer';
|
|
6
6
|
import { initializeAccountMappingView } from '../../accountMappingView/accountMappingReducer';
|
|
7
|
-
export declare type ActionType = ReturnType<typeof fetchVendorsFiling1099List> | ReturnType<typeof
|
|
7
|
+
export declare type ActionType = ReturnType<typeof fetchVendorsFiling1099List> | ReturnType<typeof fetchVendor1099TypeList> | ReturnType<typeof initializeAccountMappingView>;
|
|
8
8
|
export declare const fetchVendorsFiling1099AllEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -4,23 +4,23 @@ exports.fetchVendorsFiling1099AllEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const vendorFiling1099ListReducer_1 = require("./vendorFiling1099ListReducer");
|
|
7
|
-
const
|
|
7
|
+
const vendor1099TypeListReducer_1 = require("../../vendor1099TypeList/vendor1099TypeListReducer");
|
|
8
8
|
const accountMappingReducer_1 = require("../../accountMappingView/accountMappingReducer");
|
|
9
9
|
const fetchVendorsFiling1099AllEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(vendorFiling1099ListReducer_1.fetchVendorsFiling1099All.match), (0, operators_1.switchMap)((action) => {
|
|
10
10
|
const state = state$.value;
|
|
11
11
|
const vendorActions = [];
|
|
12
12
|
if (action.payload.cacheOverride === true) {
|
|
13
|
-
if (state.
|
|
14
|
-
state.
|
|
15
|
-
vendorActions.push((0,
|
|
13
|
+
if (state.vendor1099TypeListState.hasValidState() === false &&
|
|
14
|
+
state.vendor1099TypeListState.fetchState !== 'In-Progress') {
|
|
15
|
+
vendorActions.push((0, vendor1099TypeListReducer_1.fetchVendor1099TypeList)());
|
|
16
16
|
}
|
|
17
17
|
vendorActions.push((0, accountMappingReducer_1.initializeAccountMappingView)());
|
|
18
18
|
vendorActions.push((0, vendorFiling1099ListReducer_1.fetchVendorsFiling1099List)());
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
|
-
if (state.
|
|
22
|
-
state.
|
|
23
|
-
vendorActions.push((0,
|
|
21
|
+
if (state.vendor1099TypeListState.hasValidState() === false &&
|
|
22
|
+
state.vendor1099TypeListState.fetchState !== 'In-Progress') {
|
|
23
|
+
vendorActions.push((0, vendor1099TypeListReducer_1.fetchVendor1099TypeList)());
|
|
24
24
|
}
|
|
25
25
|
vendorActions.push((0, accountMappingReducer_1.initializeAccountMappingView)());
|
|
26
26
|
vendorActions.push((0, vendorFiling1099ListReducer_1.fetchVendorsFiling1099List)());
|