@zeniai/client-epic-state 4.12.40 → 4.12.42

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.
Files changed (59) hide show
  1. package/lib/__testHelpers__/apiFailure.json +6 -0
  2. package/lib/entity/account/accountPayload.d.ts +1 -0
  3. package/lib/entity/account/accountPayload.js +7 -2
  4. package/lib/entity/account/accountSelector.d.ts +6 -6
  5. package/lib/entity/account/accountState.d.ts +2 -2
  6. package/lib/entity/account/accountState.js +4 -0
  7. package/lib/entity/account/pickAndMergeForecastAccountReport.d.ts +2 -2
  8. package/lib/entity/accountGroup/accountGroupSelector.d.ts +44 -44
  9. package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
  10. package/lib/entity/tenant/clearAllEpic.js +2 -0
  11. package/lib/entity/vendor/__mocks__/vendorStateMocks.d.ts +6 -0
  12. package/lib/entity/vendor/__mocks__/vendorStateMocks.js +308 -0
  13. package/lib/entity/vendor/vendorPayload.d.ts +8 -0
  14. package/lib/entity/vendor/vendorPayload.js +10 -2
  15. package/lib/entity/vendor/vendorState.d.ts +6 -0
  16. package/lib/entity/vendor/vendorType.d.ts +8 -0
  17. package/lib/entity/vendor/vendorType.js +10 -0
  18. package/lib/epic.d.ts +2 -1
  19. package/lib/epic.js +2 -1
  20. package/lib/index.d.ts +5 -2
  21. package/lib/index.js +19 -13
  22. package/lib/reducer.d.ts +3 -0
  23. package/lib/reducer.js +3 -0
  24. package/lib/view/accountList/accountListReducer.d.ts +2 -2
  25. package/lib/view/accountList/accountListReducer.js +2 -0
  26. package/lib/view/accountMappingView/accountMappingPayload.d.ts +5 -0
  27. package/lib/view/accountMappingView/accountMappingPayload.js +19 -1
  28. package/lib/view/accountMappingView/accountMappingReducer.js +31 -9
  29. package/lib/view/accountMappingView/accountMappingState.d.ts +8 -0
  30. package/lib/view/accountMappingView/accountMappingViewSelector.d.ts +4 -0
  31. package/lib/view/accountMappingView/accountMappingViewSelector.js +18 -0
  32. package/lib/view/accountMappingView/saveAccountMappingViewEpic.js +2 -1
  33. package/lib/view/cardBalance/cardBalanceSelector.d.ts +2 -2
  34. package/lib/view/cashBalance/cashBalanceSelector.d.ts +2 -2
  35. package/lib/view/settingsView/settingsViewHelpers.js +3 -1
  36. package/lib/view/topEx/topExSelector.d.ts +1 -1
  37. package/lib/view/transactionList/transactionListReducer.d.ts +12 -12
  38. package/lib/view/vendorFiling1099List/__mock__/json/vendorFiling1099ListSuccess.json +90 -0
  39. package/lib/view/vendorFiling1099List/__mock__/vendorFiling1099ListMock.d.ts +11 -0
  40. package/lib/view/vendorFiling1099List/__mock__/vendorFiling1099ListMock.js +101 -0
  41. package/lib/view/vendorFiling1099List/__mock__/vendorFiling1099ListSelectorMock.d.ts +2 -0
  42. package/lib/view/vendorFiling1099List/__mock__/vendorFiling1099ListSelectorMock.js +21 -0
  43. package/lib/view/vendorFiling1099List/fetchVendorsFiling1099ListEpic.d.ts +9 -0
  44. package/lib/view/vendorFiling1099List/fetchVendorsFiling1099ListEpic.js +40 -0
  45. package/lib/view/vendorFiling1099List/vendorFiling1099ListPayload.d.ts +13 -0
  46. package/lib/view/vendorFiling1099List/vendorFiling1099ListPayload.js +2 -0
  47. package/lib/view/vendorFiling1099List/vendorFiling1099ListReducer.d.ts +19 -0
  48. package/lib/view/vendorFiling1099List/vendorFiling1099ListReducer.js +71 -0
  49. package/lib/view/vendorFiling1099List/vendorFiling1099ListSelector.d.ts +15 -0
  50. package/lib/view/vendorFiling1099List/vendorFiling1099ListSelector.js +49 -0
  51. package/lib/view/vendorFiling1099List/vendorFiling1099ListState.d.ts +23 -0
  52. package/lib/view/vendorFiling1099List/vendorFiling1099ListState.js +11 -0
  53. package/lib/view/vendorList/vendorListSelector.d.ts +2 -2
  54. package/lib/view/vendorList/vendorListSelector.js +4 -0
  55. package/lib/view/vendorTabView/fetchVendorTabViewEpic.d.ts +2 -1
  56. package/lib/view/vendorTabView/fetchVendorTabViewEpic.js +9 -1
  57. package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +2 -0
  58. package/lib/view/vendorTabView/vendorTabViewReducer.js +2 -1
  59. package/package.json +1 -1
@@ -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
- export declare type ActionType = ReturnType<typeof fetchVendorTabView> | ReturnType<typeof fetchOpExByVendor> | ReturnType<typeof fetchVendorsList> | ReturnType<typeof fetchAccruedScheduleList> | ReturnType<typeof fetchScheduleList>;
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.40",
3
+ "version": "4.12.42",
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",