@zeniai/client-epic-state 4.12.39 → 4.12.41
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/__testHelpers__/apiFailure.json +6 -0
- package/lib/entity/account/accountPayload.d.ts +1 -0
- package/lib/entity/account/accountPayload.js +7 -2
- package/lib/entity/account/accountSelector.d.ts +6 -6
- package/lib/entity/account/accountState.d.ts +2 -2
- package/lib/entity/account/accountState.js +4 -0
- package/lib/entity/account/pickAndMergeForecastAccountReport.d.ts +2 -2
- package/lib/entity/accountGroup/accountGroupSelector.d.ts +44 -44
- package/lib/entity/billPay/billTransaction/billTransactionPayload.d.ts +1 -12
- package/lib/entity/billPay/billTransaction/billTransactionPayload.js +1 -23
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +0 -12
- package/lib/entity/billPay/billTransaction/billTransactionState.js +0 -8
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -2
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
- package/lib/entity/tenant/clearAllEpic.js +2 -0
- package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +1 -1
- package/lib/entity/transaction/stateTypes/transactionType.d.ts +2 -2
- package/lib/entity/vendor/__mocks__/vendorStateMocks.d.ts +6 -0
- package/lib/entity/vendor/__mocks__/vendorStateMocks.js +308 -0
- package/lib/entity/vendor/vendorPayload.d.ts +8 -0
- package/lib/entity/vendor/vendorPayload.js +10 -2
- package/lib/entity/vendor/vendorState.d.ts +6 -0
- package/lib/entity/vendor/vendorType.d.ts +8 -0
- package/lib/entity/vendor/vendorType.js +10 -0
- package/lib/epic.d.ts +2 -3
- package/lib/epic.js +2 -3
- package/lib/index.d.ts +9 -6
- package/lib/index.js +19 -15
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/view/accountList/accountListReducer.d.ts +2 -2
- package/lib/view/accountList/accountListReducer.js +2 -0
- package/lib/view/accountMappingView/accountMappingPayload.d.ts +5 -0
- package/lib/view/accountMappingView/accountMappingPayload.js +19 -1
- package/lib/view/accountMappingView/accountMappingReducer.js +31 -9
- package/lib/view/accountMappingView/accountMappingState.d.ts +8 -0
- package/lib/view/accountMappingView/accountMappingViewSelector.d.ts +4 -0
- package/lib/view/accountMappingView/accountMappingViewSelector.js +18 -0
- package/lib/view/accountMappingView/saveAccountMappingViewEpic.js +2 -1
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +2 -2
- package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.d.ts +1 -1
- package/lib/view/cardPayment/epic/confirmCardSetupIntentEpic.d.ts +1 -1
- package/lib/view/cardPayment/epic/createCardSetupIntentEpic.d.ts +1 -1
- package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.d.ts +1 -1
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +2 -2
- package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
- package/lib/view/people/deletePersonEpic.d.ts +1 -1
- package/lib/view/people/invitePeopleEpic.d.ts +1 -1
- package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
- package/lib/view/people/resendInviteEpic.d.ts +1 -1
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.d.ts +4 -4
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
- package/lib/view/settingsView/settingsViewHelpers.js +3 -1
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewPayload.d.ts +0 -5
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewReducer.d.ts +1 -22
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewReducer.js +2 -133
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +1 -2
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +0 -2
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewState.d.ts +0 -9
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewState.js +0 -14
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.d.ts +2 -2
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +1 -10
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +0 -1
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +0 -3
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +1 -3
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +2 -6
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +0 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +0 -3
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +0 -1
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.d.ts +0 -68
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.js +1 -2
- package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
- package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/lib/view/transactionDetail/transactionDetailState.d.ts +2 -2
- package/lib/view/transactionList/transactionListReducer.d.ts +12 -12
- package/lib/view/vendorFiling1099List/__mock__/json/vendorFiling1099ListSuccess.json +90 -0
- package/lib/view/vendorFiling1099List/__mock__/vendorFiling1099ListMock.d.ts +11 -0
- package/lib/view/vendorFiling1099List/__mock__/vendorFiling1099ListMock.js +101 -0
- package/lib/view/vendorFiling1099List/__mock__/vendorFiling1099ListSelectorMock.d.ts +2 -0
- package/lib/view/vendorFiling1099List/__mock__/vendorFiling1099ListSelectorMock.js +21 -0
- package/lib/view/vendorFiling1099List/fetchVendorsFiling1099ListEpic.d.ts +9 -0
- package/lib/view/vendorFiling1099List/fetchVendorsFiling1099ListEpic.js +40 -0
- package/lib/view/vendorFiling1099List/vendorFiling1099ListPayload.d.ts +13 -0
- package/lib/view/vendorFiling1099List/vendorFiling1099ListPayload.js +2 -0
- package/lib/view/vendorFiling1099List/vendorFiling1099ListReducer.d.ts +19 -0
- package/lib/view/vendorFiling1099List/vendorFiling1099ListReducer.js +71 -0
- package/lib/view/vendorFiling1099List/vendorFiling1099ListSelector.d.ts +15 -0
- package/lib/view/vendorFiling1099List/vendorFiling1099ListSelector.js +49 -0
- package/lib/view/vendorFiling1099List/vendorFiling1099ListState.d.ts +23 -0
- package/lib/view/vendorFiling1099List/vendorFiling1099ListState.js +11 -0
- package/lib/view/vendorList/vendorListSelector.d.ts +2 -2
- package/lib/view/vendorList/vendorListSelector.js +4 -0
- package/lib/view/vendorTabView/fetchVendorTabViewEpic.d.ts +2 -1
- package/lib/view/vendorTabView/fetchVendorTabViewEpic.js +9 -1
- package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +2 -0
- package/lib/view/vendorTabView/vendorTabViewReducer.js +2 -1
- package/package.json +1 -1
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchEligibleActionsForBillEpic.d.ts +0 -7
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchEligibleActionsForBillEpic.js +0 -42
- package/lib/view/spendManagement/billPay/billDetailView/epics/retryOrRefundBillEpic.d.ts +0 -9
- package/lib/view/spendManagement/billPay/billDetailView/epics/retryOrRefundBillEpic.js +0 -76
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.updateFiling1099SortUiState = exports.updateFiling1099ScrollYOffset = exports.clearVendorsFiling1099List = exports.updateVendorFiling1099ListFailure = exports.updateVendorsFiling1099List = exports.fetchVendorsFiling1099List = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
7
|
+
exports.initialState = {
|
|
8
|
+
fetchState: 'Not-Started',
|
|
9
|
+
error: undefined,
|
|
10
|
+
vendorIds: [],
|
|
11
|
+
isVendor1099Populated: true,
|
|
12
|
+
hasValidState() {
|
|
13
|
+
return this.fetchState == 'Completed';
|
|
14
|
+
},
|
|
15
|
+
lastRefreshSuccessTime: undefined,
|
|
16
|
+
uiState: {
|
|
17
|
+
sortKey: 'total',
|
|
18
|
+
sortOrder: 'descending',
|
|
19
|
+
scrollYOffset: 0,
|
|
20
|
+
downloadState: 'Not-Started',
|
|
21
|
+
searchString: '',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
const vendorFiling1099List = (0, toolkit_1.createSlice)({
|
|
25
|
+
name: 'vendorFiling1099List',
|
|
26
|
+
initialState: exports.initialState,
|
|
27
|
+
reducers: {
|
|
28
|
+
fetchVendorsFiling1099List: {
|
|
29
|
+
reducer(draft) {
|
|
30
|
+
draft.fetchState = 'In-Progress';
|
|
31
|
+
// Note: Need to reset scroll position whenever a new fetch happens, except when fetching through scroll
|
|
32
|
+
draft.uiState.scrollYOffset = 0;
|
|
33
|
+
draft.error = undefined;
|
|
34
|
+
},
|
|
35
|
+
prepare() {
|
|
36
|
+
return {
|
|
37
|
+
payload: { view: undefined },
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
updateFiling1099SortUiState(draft, action) {
|
|
42
|
+
draft.uiState = Object.assign(Object.assign({}, draft.uiState), { sortKey: action.payload.sortKey, sortOrder: action.payload.sortOrder });
|
|
43
|
+
},
|
|
44
|
+
updateVendorsFiling1099List(draft, action) {
|
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
46
|
+
const { response } = action.payload;
|
|
47
|
+
const newVendorIds = (_c = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.report.vendors) === null || _b === void 0 ? void 0 : _b.map((vendor) => vendor.vendor_id)) !== null && _c !== void 0 ? _c : [];
|
|
48
|
+
draft.vendorIds = [...new Set([...draft.vendorIds, ...newVendorIds])];
|
|
49
|
+
draft.isVendor1099Populated =
|
|
50
|
+
(_e = (_d = response.data) === null || _d === void 0 ? void 0 : _d.report.is_vendor_1099_populated) !== null && _e !== void 0 ? _e : true;
|
|
51
|
+
draft.fetchState = 'Completed';
|
|
52
|
+
draft.error = undefined;
|
|
53
|
+
draft.lastRefreshSuccessTime =
|
|
54
|
+
((_g = (_f = response.data) === null || _f === void 0 ? void 0 : _f.report.status) === null || _g === void 0 ? void 0 : _g.last_refresh_success_time) != null
|
|
55
|
+
? (0, zeniDayJS_1.date)((_j = (_h = response.data) === null || _h === void 0 ? void 0 : _h.report.status) === null || _j === void 0 ? void 0 : _j.last_refresh_success_time)
|
|
56
|
+
: undefined;
|
|
57
|
+
},
|
|
58
|
+
updateFiling1099ScrollYOffset(draft, action) {
|
|
59
|
+
draft.uiState = Object.assign(Object.assign({}, draft.uiState), { scrollYOffset: action.payload.scrollYOffset });
|
|
60
|
+
},
|
|
61
|
+
updateVendorFiling1099ListFailure(draft, action) {
|
|
62
|
+
draft.fetchState = 'Error';
|
|
63
|
+
draft.error = action.payload.status;
|
|
64
|
+
},
|
|
65
|
+
clearVendorsFiling1099List(draft) {
|
|
66
|
+
Object.assign(draft, exports.initialState);
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
_a = vendorFiling1099List.actions, exports.fetchVendorsFiling1099List = _a.fetchVendorsFiling1099List, exports.updateVendorsFiling1099List = _a.updateVendorsFiling1099List, exports.updateVendorFiling1099ListFailure = _a.updateVendorFiling1099ListFailure, exports.clearVendorsFiling1099List = _a.clearVendorsFiling1099List, exports.updateFiling1099ScrollYOffset = _a.updateFiling1099ScrollYOffset, exports.updateFiling1099SortUiState = _a.updateFiling1099SortUiState;
|
|
71
|
+
exports.default = vendorFiling1099List.reducer;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
2
|
+
import { Vendor } from '../../entity/vendor/vendorState';
|
|
3
|
+
import { RootState } from '../../reducer';
|
|
4
|
+
import { ZeniDate } from '../../zeniDayJS';
|
|
5
|
+
import { VendorFiling1099ListViewSortKey, VendorFiling1099ViewUIState } from './vendorFiling1099ListState';
|
|
6
|
+
import { SortOrder } from '../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
7
|
+
export interface VendorFiling1099ListSelectorView extends SelectorView {
|
|
8
|
+
vendors: Vendor[];
|
|
9
|
+
isVendor1099Populated: boolean;
|
|
10
|
+
uiState: VendorFiling1099ViewUIState;
|
|
11
|
+
searchString?: string;
|
|
12
|
+
lastRefreshSuccessTime?: ZeniDate;
|
|
13
|
+
}
|
|
14
|
+
export declare const getVendorFiling1099List: (state: RootState) => VendorFiling1099ListSelectorView;
|
|
15
|
+
export declare const sortedVendorFiling1099View: (vendorFiling1099List: Vendor[], sortKey: VendorFiling1099ListViewSortKey, sortOrder: SortOrder) => Vendor[];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.sortedVendorFiling1099View = exports.getVendorFiling1099List = void 0;
|
|
7
|
+
const vendorSelector_1 = require("../../entity/vendor/vendorSelector");
|
|
8
|
+
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
9
|
+
const getVendorFiling1099List = (state) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const { vendorFiling1099ListState, vendorState } = state;
|
|
12
|
+
const targetIds = vendorFiling1099ListState.vendorIds;
|
|
13
|
+
const loweredSearchText = vendorFiling1099ListState.uiState.searchString
|
|
14
|
+
.trim()
|
|
15
|
+
.toLowerCase();
|
|
16
|
+
let vendors = (0, vendorSelector_1.getVendorsByVendorIds)(vendorState, targetIds);
|
|
17
|
+
vendors = vendors.filter((vendor) => vendor.name.toLowerCase().includes(loweredSearchText));
|
|
18
|
+
vendors = (0, exports.sortedVendorFiling1099View)(vendors, vendorFiling1099ListState.uiState.sortKey, vendorFiling1099ListState.uiState.sortOrder);
|
|
19
|
+
const vendorFiling1099ViewList = vendors.map((vendor) => {
|
|
20
|
+
return Object.assign({}, vendor);
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
vendors: vendorFiling1099ViewList,
|
|
24
|
+
isVendor1099Populated: (_a = vendorFiling1099ListState.isVendor1099Populated) !== null && _a !== void 0 ? _a : true,
|
|
25
|
+
uiState: vendorFiling1099ListState.uiState,
|
|
26
|
+
fetchState: vendorFiling1099ListState.fetchState,
|
|
27
|
+
lastRefreshSuccessTime: vendorFiling1099ListState.lastRefreshSuccessTime,
|
|
28
|
+
error: vendorFiling1099ListState.error,
|
|
29
|
+
version: 0,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.getVendorFiling1099List = getVendorFiling1099List;
|
|
33
|
+
const sortedVendorFiling1099View = (vendorFiling1099List, sortKey, sortOrder) => {
|
|
34
|
+
return (0, orderBy_1.default)(vendorFiling1099List, (vendor) => {
|
|
35
|
+
switch (sortKey) {
|
|
36
|
+
case 'vendor_name':
|
|
37
|
+
return vendor.name;
|
|
38
|
+
case 'tax_classification':
|
|
39
|
+
return vendor.vendorType;
|
|
40
|
+
case 'w9':
|
|
41
|
+
return vendor.filing1099W9Files;
|
|
42
|
+
case 'status':
|
|
43
|
+
return vendor.filing1099Status;
|
|
44
|
+
default:
|
|
45
|
+
return vendor.filing1099Total != null ? vendor.filing1099Total : 0;
|
|
46
|
+
}
|
|
47
|
+
}, sortOrder === 'ascending' ? 'asc' : 'desc');
|
|
48
|
+
};
|
|
49
|
+
exports.sortedVendorFiling1099View = sortedVendorFiling1099View;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FetchedState, FetchState, ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { SortOrder } from '../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
3
|
+
import { ZeniDate } from '../../zeniDayJS';
|
|
4
|
+
export interface VendorFiling1099ViewUIState {
|
|
5
|
+
sortKey: VendorFiling1099ListViewSortKey;
|
|
6
|
+
sortOrder: SortOrder;
|
|
7
|
+
scrollYOffset: number;
|
|
8
|
+
downloadState: FetchState;
|
|
9
|
+
searchString: string;
|
|
10
|
+
}
|
|
11
|
+
export interface VendorFiling1099ListState extends FetchedState {
|
|
12
|
+
vendorIds: ID[];
|
|
13
|
+
uiState: VendorFiling1099ViewUIState;
|
|
14
|
+
isVendor1099Populated: boolean;
|
|
15
|
+
lastRefreshSuccessTime?: ZeniDate;
|
|
16
|
+
}
|
|
17
|
+
export interface VendorFiling1099ListQuery {
|
|
18
|
+
sortOrder: SortOrder;
|
|
19
|
+
sortKey: VendorFiling1099ListViewSortKey;
|
|
20
|
+
}
|
|
21
|
+
declare const toVendorFiling1099ListViewSortKey: (v: string) => "total" | "status" | "w9" | "vendor_name" | "tax_classification";
|
|
22
|
+
export declare type VendorFiling1099ListViewSortKey = ReturnType<typeof toVendorFiling1099ListViewSortKey>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
4
|
+
const VENDOR_FILING_1099_LIST_VIEW_SORT_KEYS = [
|
|
5
|
+
'vendor_name',
|
|
6
|
+
'tax_classification',
|
|
7
|
+
'w9',
|
|
8
|
+
'status',
|
|
9
|
+
'total',
|
|
10
|
+
];
|
|
11
|
+
const toVendorFiling1099ListViewSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, VENDOR_FILING_1099_LIST_VIEW_SORT_KEYS);
|
|
@@ -8,7 +8,7 @@ import { Vendor } from '../../entity/vendor/vendorState';
|
|
|
8
8
|
import { RootState } from '../../reducer';
|
|
9
9
|
import { ZeniDate } from '../../zeniDayJS';
|
|
10
10
|
import { VendorListViewSortKey, VendorListViewYTDSpendSortKey, VendorViewUIState } from './vendorListState';
|
|
11
|
-
export declare const toVendorReportIDType: (v: string) => "operating_expenses_by_vendor" | "vendors_tab" | "prepaid_expenses" | "fixed_assets" | "accrued_expenses";
|
|
11
|
+
export declare const toVendorReportIDType: (v: string) => "operating_expenses_by_vendor" | "vendors_tab" | "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "filing_1099";
|
|
12
12
|
export declare type VendorReportIDType = ReturnType<typeof toVendorReportIDType>;
|
|
13
13
|
export interface VendorListSelectorView extends SelectorView {
|
|
14
14
|
vendors: VendorListView[];
|
|
@@ -25,4 +25,4 @@ export interface VendorListView extends Vendor {
|
|
|
25
25
|
}
|
|
26
26
|
export declare const getVendorList: (state: RootState, view?: "vendorsTab" | undefined) => VendorListSelectorView;
|
|
27
27
|
export declare const isColumnYTDSpend: (headerData: VendorListViewSortKey | VendorListViewYTDSpendSortKey) => boolean;
|
|
28
|
-
export declare const isVendorsTabVisible: (roleMap: RoleMap) => boolean;
|
|
28
|
+
export declare const isVendorsTabVisible: (roleMap: RoleMap | undefined) => boolean;
|
|
@@ -12,6 +12,7 @@ const ALL_VENDOR_REPORT_ID_TYPES = [
|
|
|
12
12
|
'prepaid_expenses',
|
|
13
13
|
'fixed_assets',
|
|
14
14
|
'accrued_expenses',
|
|
15
|
+
'filing_1099',
|
|
15
16
|
];
|
|
16
17
|
const toVendorReportIDType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_VENDOR_REPORT_ID_TYPES);
|
|
17
18
|
exports.toVendorReportIDType = toVendorReportIDType;
|
|
@@ -68,6 +69,9 @@ const isColumnYTDSpend = (headerData) => {
|
|
|
68
69
|
};
|
|
69
70
|
exports.isColumnYTDSpend = isColumnYTDSpend;
|
|
70
71
|
const isVendorsTabVisible = (roleMap) => {
|
|
72
|
+
if (roleMap == null) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
71
75
|
const isVendorsTabVisible = roleMap != null &&
|
|
72
76
|
(roleMap.admin ||
|
|
73
77
|
roleMap.bookkeeping_admin ||
|
|
@@ -5,5 +5,6 @@ import { fetchVendorTabView } from './vendorTabViewReducer';
|
|
|
5
5
|
import { fetchAccruedScheduleList, fetchScheduleList } from '../scheduleView/scheduleListView/scheduleListReducer';
|
|
6
6
|
import { fetchOpExByVendor } from '../opExByVendor/opExByVendorReducer';
|
|
7
7
|
import { fetchVendorsList } from '../vendorList/vendorListReducer';
|
|
8
|
-
|
|
8
|
+
import { fetchVendorsFiling1099List } from '../vendorFiling1099List/vendorFiling1099ListReducer';
|
|
9
|
+
export declare type ActionType = ReturnType<typeof fetchVendorTabView> | ReturnType<typeof fetchOpExByVendor> | ReturnType<typeof fetchVendorsList> | ReturnType<typeof fetchAccruedScheduleList> | ReturnType<typeof fetchScheduleList> | ReturnType<typeof fetchVendorsFiling1099List>;
|
|
9
10
|
export declare const fetchVendorTabViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -7,12 +7,14 @@ const vendorTabViewReducer_1 = require("./vendorTabViewReducer");
|
|
|
7
7
|
const scheduleListReducer_1 = require("../scheduleView/scheduleListView/scheduleListReducer");
|
|
8
8
|
const opExByVendorReducer_1 = require("../opExByVendor/opExByVendorReducer");
|
|
9
9
|
const vendorListReducer_1 = require("../vendorList/vendorListReducer");
|
|
10
|
+
const vendorFiling1099ListReducer_1 = require("../vendorFiling1099List/vendorFiling1099ListReducer");
|
|
10
11
|
const scheduleListSelector_1 = require("../scheduleView/scheduleListView/scheduleListSelector");
|
|
11
12
|
const scheduleListHelper_1 = require("../scheduleView/scheduleListView/scheduleListHelper");
|
|
12
13
|
const opExByVendorSelector_1 = require("../opExByVendor/opExByVendorSelector");
|
|
13
14
|
const vendorListSelector_1 = require("../vendorList/vendorListSelector");
|
|
15
|
+
const vendorFiling1099ListSelector_1 = require("../vendorFiling1099List/vendorFiling1099ListSelector");
|
|
14
16
|
const fetchVendorTabViewEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(vendorTabViewReducer_1.fetchVendorTabView.match), (0, operators_1.switchMap)((action) => {
|
|
15
|
-
const { shouldFetchAccruedExpenses, shouldFetchFixedAssets, shouldFetchOpexByVendor, shouldFetchPrepaidExpenses, shouldFetchVendorsList, } = action.payload;
|
|
17
|
+
const { shouldFetchAccruedExpenses, shouldFetchFixedAssets, shouldFetchOpexByVendor, shouldFetchPrepaidExpenses, shouldFetchVendorsList, shouldFetchFiling1099Vendor, } = action.payload;
|
|
16
18
|
const state = state$.value;
|
|
17
19
|
const fetchActions = [];
|
|
18
20
|
const accountFetchState = (0, scheduleListSelector_1.getFetchStateForScheduleAccountList)(state);
|
|
@@ -30,6 +32,7 @@ const fetchVendorTabViewEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
30
32
|
selectedCategoryId: 'all',
|
|
31
33
|
}));
|
|
32
34
|
}
|
|
35
|
+
const vendorsFiling1099ListFetchState = (0, vendorFiling1099ListSelector_1.getVendorFiling1099List)(state).fetchState;
|
|
33
36
|
if (shouldFetchFixedAssets === true &&
|
|
34
37
|
accountFetchState === 'Completed' &&
|
|
35
38
|
fixedAssetsSchedulesListFetchState !== 'In-Progress' &&
|
|
@@ -58,6 +61,11 @@ const fetchVendorTabViewEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
58
61
|
vendorsListFetchState !== 'Completed') {
|
|
59
62
|
fetchActions.push((0, vendorListReducer_1.fetchVendorsList)('', false, 'vendorsTab'));
|
|
60
63
|
}
|
|
64
|
+
if (shouldFetchFiling1099Vendor &&
|
|
65
|
+
vendorsFiling1099ListFetchState !== 'In-Progress' &&
|
|
66
|
+
vendorsFiling1099ListFetchState !== 'Completed') {
|
|
67
|
+
fetchActions.push((0, vendorFiling1099ListReducer_1.fetchVendorsFiling1099List)());
|
|
68
|
+
}
|
|
61
69
|
return (0, rxjs_1.from)(fetchActions);
|
|
62
70
|
}));
|
|
63
71
|
exports.fetchVendorTabViewEpic = fetchVendorTabViewEpic;
|
|
@@ -6,12 +6,14 @@ export declare const fetchVendorTabView: import("@reduxjs/toolkit").ActionCreato
|
|
|
6
6
|
shouldFetchFixedAssets: boolean;
|
|
7
7
|
shouldFetchVendorsList: boolean;
|
|
8
8
|
shouldFetchOpexByVendor: boolean;
|
|
9
|
+
shouldFetchFiling1099Vendor: boolean;
|
|
9
10
|
}], {
|
|
10
11
|
shouldFetchAccruedExpenses: boolean;
|
|
11
12
|
shouldFetchPrepaidExpenses: boolean;
|
|
12
13
|
shouldFetchFixedAssets: boolean;
|
|
13
14
|
shouldFetchVendorsList: boolean;
|
|
14
15
|
shouldFetchOpexByVendor: boolean;
|
|
16
|
+
shouldFetchFiling1099Vendor: boolean;
|
|
15
17
|
}, string, never, never>;
|
|
16
18
|
declare const _default: import("@reduxjs/toolkit").Reducer<import("../..").FetchedState, import("@reduxjs/toolkit").AnyAction>;
|
|
17
19
|
export default _default;
|
|
@@ -13,7 +13,7 @@ const vendorTabView = (0, toolkit_1.createSlice)({
|
|
|
13
13
|
initialState: exports.initialState,
|
|
14
14
|
reducers: {
|
|
15
15
|
fetchVendorTabView: {
|
|
16
|
-
prepare({ shouldFetchAccruedExpenses, shouldFetchPrepaidExpenses, shouldFetchFixedAssets, shouldFetchVendorsList, shouldFetchOpexByVendor, }) {
|
|
16
|
+
prepare({ shouldFetchAccruedExpenses, shouldFetchPrepaidExpenses, shouldFetchFixedAssets, shouldFetchVendorsList, shouldFetchOpexByVendor, shouldFetchFiling1099Vendor, }) {
|
|
17
17
|
return {
|
|
18
18
|
payload: {
|
|
19
19
|
shouldFetchAccruedExpenses,
|
|
@@ -21,6 +21,7 @@ const vendorTabView = (0, toolkit_1.createSlice)({
|
|
|
21
21
|
shouldFetchFixedAssets,
|
|
22
22
|
shouldFetchVendorsList,
|
|
23
23
|
shouldFetchOpexByVendor,
|
|
24
|
+
shouldFetchFiling1099Vendor,
|
|
24
25
|
},
|
|
25
26
|
};
|
|
26
27
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.41",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
package/lib/view/spendManagement/billPay/billDetailView/epics/fetchEligibleActionsForBillEpic.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { fetchEligibleActionsForBill, updateFetchEligibleActionsFailureState, updateEligibleActionsForBill } from '../billDetailViewReducer';
|
|
4
|
-
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
5
|
-
import { RootState } from '../../../../../reducer';
|
|
6
|
-
export declare type ActionType = ReturnType<typeof fetchEligibleActionsForBill> | ReturnType<typeof updateEligibleActionsForBill> | ReturnType<typeof updateFetchEligibleActionsFailureState>;
|
|
7
|
-
export declare const fetchEligibleActionsForBillEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/spendManagement/billPay/billDetailView/epics/fetchEligibleActionsForBillEpic.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchEligibleActionsForBillEpic = void 0;
|
|
7
|
-
const rxjs_1 = require("rxjs");
|
|
8
|
-
const operators_1 = require("rxjs/operators");
|
|
9
|
-
const billDetailViewReducer_1 = require("../billDetailViewReducer");
|
|
10
|
-
const responsePayload_1 = require("../../../../../responsePayload");
|
|
11
|
-
const get_1 = __importDefault(require("lodash/get"));
|
|
12
|
-
const billDetailViewState_1 = require("../billDetailViewState");
|
|
13
|
-
const fetchEligibleActionsForBillEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billDetailViewReducer_1.fetchEligibleActionsForBill.match), (0, operators_1.mergeMap)((action) => {
|
|
14
|
-
const { billId, cacheOverride } = action.payload;
|
|
15
|
-
const detailKey = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId);
|
|
16
|
-
const state = state$.value;
|
|
17
|
-
const billDetail = (0, get_1.default)(state.billDetailViewState.billDetailById, detailKey, undefined);
|
|
18
|
-
if (cacheOverride == true ||
|
|
19
|
-
billDetail == null ||
|
|
20
|
-
billDetail.zeniAssist.eligibleActionsFetchStatus.fetchState !==
|
|
21
|
-
'In-Progress') {
|
|
22
|
-
return zeniAPI
|
|
23
|
-
.getJSON(`${zeniAPI.apiEndPoints.spendManagementMicroServiceBaseUrl}/1.0/bills/transactions/${billId}/eligible-actions`)
|
|
24
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
25
|
-
var _a, _b;
|
|
26
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
27
|
-
const fetchActions = [
|
|
28
|
-
(0, billDetailViewReducer_1.updateEligibleActionsForBill)(billId, (_a = response.data.is_refund_eligible) !== null && _a !== void 0 ? _a : undefined, (_b = response.data.is_retry_eligible) !== null && _b !== void 0 ? _b : undefined),
|
|
29
|
-
];
|
|
30
|
-
return (0, rxjs_1.from)(fetchActions);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
return (0, rxjs_1.of)((0, billDetailViewReducer_1.updateFetchEligibleActionsFailureState)(action.payload.billId, response.status));
|
|
34
|
-
}
|
|
35
|
-
}), (0, operators_1.catchError)((error) => {
|
|
36
|
-
console.error(`Fetch eligible actions REST API call errored out ${error}`);
|
|
37
|
-
return (0, rxjs_1.of)((0, billDetailViewReducer_1.updateFetchEligibleActionsFailureState)(action.payload.billId, (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Fetch eligible actions REST API call errored out ${error}`)));
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
return (0, rxjs_1.from)([]);
|
|
41
|
-
}));
|
|
42
|
-
exports.fetchEligibleActionsForBillEpic = fetchEligibleActionsForBillEpic;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
4
|
-
import { RootState } from '../../../../../reducer';
|
|
5
|
-
import { retryOrRefundBillSuccess, retryOrRefundBillFailure } from '../billDetailViewReducer';
|
|
6
|
-
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
7
|
-
import { updateBillTransaction } from '../../../../../entity/billPay/billTransaction/billTransactionReducer';
|
|
8
|
-
export declare type ActionType = ReturnType<typeof updateBillTransaction> | ReturnType<typeof openSnackbar> | ReturnType<typeof retryOrRefundBillSuccess> | ReturnType<typeof retryOrRefundBillFailure>;
|
|
9
|
-
export declare const retryOrRefundBillEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.retryOrRefundBillEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../../../responsePayload");
|
|
7
|
-
const billDetailViewReducer_1 = require("../billDetailViewReducer");
|
|
8
|
-
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
9
|
-
const billDetailViewState_1 = require("../billDetailViewState");
|
|
10
|
-
const billTransactionReducer_1 = require("../../../../../entity/billPay/billTransaction/billTransactionReducer");
|
|
11
|
-
const retryOrRefundBillEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billDetailViewReducer_1.retryOrRefundBill.match), (0, operators_1.mergeMap)((action) => {
|
|
12
|
-
var _a, _b, _c, _d, _e, _f;
|
|
13
|
-
const { billId, actionType } = action.payload;
|
|
14
|
-
const { editBillDetailViewState } = state$.value;
|
|
15
|
-
const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId);
|
|
16
|
-
const billDetail = editBillDetailViewState.editBillStateById[key];
|
|
17
|
-
let apiUrl = `${zeniAPI.apiEndPoints.spendManagementMicroServiceBaseUrl}/1.0/bills/transactions/${billId}`;
|
|
18
|
-
let payload;
|
|
19
|
-
if (actionType === 'retry') {
|
|
20
|
-
apiUrl = `${apiUrl}/payment/retry`;
|
|
21
|
-
payload = {
|
|
22
|
-
bill_pay_info: {
|
|
23
|
-
to_account: ((_b = (_a = billDetail.billDetailLocalData.paymentDetailsSection) === null || _a === void 0 ? void 0 : _a.paymentType) === null || _b === void 0 ? void 0 : _b.method.includes('international')) === true
|
|
24
|
-
? {
|
|
25
|
-
payment_instrument_id: Boolean(billDetail.billDetailLocalData
|
|
26
|
-
.isCollectToAccountInfoFromVendorContact) === false
|
|
27
|
-
? (_d = (_c = billDetail.billDetailLocalData.paymentDetailsSection) === null || _c === void 0 ? void 0 : _c.paymentTo) !== null && _d !== void 0 ? _d : null
|
|
28
|
-
: null,
|
|
29
|
-
}
|
|
30
|
-
: {
|
|
31
|
-
account_id: Boolean(billDetail.billDetailLocalData
|
|
32
|
-
.isCollectToAccountInfoFromVendorContact) === false
|
|
33
|
-
? (_f = (_e = billDetail.billDetailLocalData.paymentDetailsSection) === null || _e === void 0 ? void 0 : _e.paymentTo) !== null && _f !== void 0 ? _f : null
|
|
34
|
-
: null,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
apiUrl = `${apiUrl}/payment/refund`;
|
|
41
|
-
}
|
|
42
|
-
return zeniAPI.putAndGetJSON(apiUrl, payload).pipe((0, operators_1.mergeMap)((response) => {
|
|
43
|
-
var _a;
|
|
44
|
-
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
45
|
-
const actions = [];
|
|
46
|
-
if (response.data != null &&
|
|
47
|
-
((_a = response.data.transactions[0]) === null || _a === void 0 ? void 0 : _a.transaction_id) != null) {
|
|
48
|
-
actions.push((0, billTransactionReducer_1.updateBillTransaction)(response.data.transactions[0]));
|
|
49
|
-
}
|
|
50
|
-
actions.push((0, billDetailViewReducer_1.retryOrRefundBillSuccess)(action.payload.billId, action.payload.actionType));
|
|
51
|
-
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
52
|
-
messageSection: action.payload.actionType === 'refund'
|
|
53
|
-
? 'bill_pay_refund'
|
|
54
|
-
: 'bill_pay_retry',
|
|
55
|
-
messageText: 'success',
|
|
56
|
-
type: 'success',
|
|
57
|
-
}));
|
|
58
|
-
return (0, rxjs_1.from)(actions);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
return (0, rxjs_1.of)((0, billDetailViewReducer_1.retryOrRefundBillFailure)(billId, action.payload.actionType, response.status), (0, snackbarReducer_1.openSnackbar)({
|
|
62
|
-
messageSection: 'bill_pay_cancelled_deleted',
|
|
63
|
-
messageText: 'failed',
|
|
64
|
-
type: 'error',
|
|
65
|
-
variables: [
|
|
66
|
-
{
|
|
67
|
-
variableName: '_api-error_',
|
|
68
|
-
variableValue: response.status.message,
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, billDetailViewReducer_1.retryOrRefundBillFailure)(action.payload.billId, action.payload.actionType, (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Retry Refund bill REST API call errored out ` +
|
|
74
|
-
JSON.stringify(error))))));
|
|
75
|
-
}));
|
|
76
|
-
exports.retryOrRefundBillEpic = retryOrRefundBillEpic;
|