@zeniai/client-epic-state 4.12.65 → 4.12.67

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 (91) hide show
  1. package/lib/entity/paymentAccount/paymentAccountPayload.d.ts +1 -1
  2. package/lib/entity/paymentAccount/paymentAccountPayload.js +7 -7
  3. package/lib/entity/tenant/clearAllEpic.d.ts +1 -1
  4. package/lib/entity/tenant/clearAllEpic.js +1 -1
  5. package/lib/entity/vendor/__mocks__/vendorMock.d.ts +7 -0
  6. package/lib/entity/vendor/__mocks__/vendorMock.js +339 -0
  7. package/lib/entity/vendor/__mocks__/vendorStateMocks.js +6 -1
  8. package/lib/entity/vendor/vendorPayload.d.ts +2 -1
  9. package/lib/entity/vendor/vendorPayload.js +6 -4
  10. package/lib/entity/vendor/vendorState.d.ts +1 -0
  11. package/lib/entity/vendor/vendorType.d.ts +2 -1
  12. package/lib/epic.d.ts +5 -2
  13. package/lib/epic.js +5 -2
  14. package/lib/index.d.ts +15 -8
  15. package/lib/index.js +31 -16
  16. package/lib/reducer.d.ts +4 -1
  17. package/lib/reducer.js +4 -1
  18. package/lib/view/addressView/__mocks__/addressViewMocks.d.ts +34 -0
  19. package/lib/view/addressView/__mocks__/addressViewMocks.js +223 -0
  20. package/lib/view/addressView/__mocks__/json/createAddressResponse.json +23 -0
  21. package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +218 -0
  22. package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +345 -0
  23. package/lib/view/addressView/__mocks__/json/fetchAddressResponse.json +24 -0
  24. package/lib/view/addressView/__mocks__/json/updateAddressResponse.json +24 -0
  25. package/lib/view/commonVendorView/vendorView/epics/fetchVendorDetailsEpic.js +2 -2
  26. package/lib/view/commonVendorView/vendorView/vendorViewPayload.d.ts +6 -0
  27. package/lib/view/commonVendorView/vendorsTabVendorView/epics/fetchVendorsTabVendorDetailPageViewEpic.d.ts +2 -1
  28. package/lib/view/commonVendorView/vendorsTabVendorView/epics/fetchVendorsTabVendorDetailPageViewEpic.js +6 -1
  29. package/lib/view/commonVendorView/vendorsTabVendorView/epics/fetchVendorsTabVendorEpic.d.ts +3 -2
  30. package/lib/view/commonVendorView/vendorsTabVendorView/epics/fetchVendorsTabVendorEpic.js +4 -2
  31. package/lib/view/commonVendorView/vendorsTabVendorView/epics/resetVendorsTabVendorDetailLocalDataEpic.js +1 -1
  32. package/lib/view/commonVendorView/vendorsTabVendorView/epics/vendorsTabVendorDetailLocalDataHelpers.d.ts +3 -1
  33. package/lib/view/commonVendorView/vendorsTabVendorView/epics/vendorsTabVendorDetailLocalDataHelpers.js +14 -3
  34. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewPayload.d.ts +5 -0
  35. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewPayload.js +35 -1
  36. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +7 -2
  37. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.js +23 -3
  38. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +16 -1
  39. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +24 -7
  40. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewState.d.ts +16 -0
  41. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewState.js +3 -0
  42. package/lib/view/settingsView/settingsViewSelector.js +1 -1
  43. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +2 -2
  44. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +1 -1
  45. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +5 -5
  46. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +11 -4
  47. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +16 -7
  48. package/lib/view/spendManagement/zeniAccounts/paymentAccountList/fetchPaymentAccountBalanceEpic.d.ts +9 -0
  49. package/lib/view/spendManagement/zeniAccounts/paymentAccountList/fetchPaymentAccountBalanceEpic.js +48 -0
  50. package/lib/view/spendManagement/zeniAccounts/paymentAccountList/fetchPaymentAccountListEpic.d.ts +2 -2
  51. package/lib/view/spendManagement/zeniAccounts/paymentAccountList/fetchPaymentAccountListEpic.js +12 -6
  52. package/lib/view/spendManagement/zeniAccounts/paymentAccountList/paymentAccountList.d.ts +1 -0
  53. package/lib/view/spendManagement/zeniAccounts/paymentAccountList/paymentAccountListReducer.d.ts +6 -0
  54. package/lib/view/spendManagement/zeniAccounts/paymentAccountList/paymentAccountListReducer.js +25 -2
  55. package/lib/view/spendManagement/zeniAccounts/paymentAccountList/paymentAccountListSelector.d.ts +1 -0
  56. package/lib/view/spendManagement/zeniAccounts/paymentAccountList/paymentAccountListSelector.js +1 -0
  57. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailReducer.js +8 -0
  58. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.js +1 -1
  59. package/lib/view/twoFactorAuthentication/sendOtpEpic.js +9 -6
  60. package/lib/view/{vendorFiling1099List → vendorFiling1099}/__mock__/json/vendorFiling1099ListSuccess.json +1 -1
  61. package/lib/view/{vendorFiling1099List → vendorFiling1099}/__mock__/vendorFiling1099ListMock.d.ts +3 -3
  62. package/lib/view/{vendorFiling1099List → vendorFiling1099}/__mock__/vendorFiling1099ListMock.js +17 -3
  63. package/lib/view/{vendorFiling1099List → vendorFiling1099}/__mock__/vendorFiling1099ListSelectorMock.d.ts +1 -1
  64. package/lib/view/{vendorFiling1099List → vendorFiling1099}/__mock__/vendorFiling1099ListSelectorMock.js +10 -1
  65. package/lib/view/vendorFiling1099/__mock__/vendorFiling1099UploadDetailsMock.d.ts +132 -0
  66. package/lib/view/vendorFiling1099/__mock__/vendorFiling1099UploadDetailsMock.js +146 -0
  67. package/lib/view/vendorFiling1099/vendorFiling1099List/fetchVendorsFiling1099AllEpic.d.ts +8 -0
  68. package/lib/view/vendorFiling1099/vendorFiling1099List/fetchVendorsFiling1099AllEpic.js +30 -0
  69. package/lib/view/{vendorFiling1099List → vendorFiling1099/vendorFiling1099List}/fetchVendorsFiling1099ListEpic.d.ts +5 -5
  70. package/lib/view/{vendorFiling1099List → vendorFiling1099/vendorFiling1099List}/fetchVendorsFiling1099ListEpic.js +6 -6
  71. package/lib/view/{vendorFiling1099List → vendorFiling1099/vendorFiling1099List}/vendorFiling1099ListPayload.d.ts +3 -3
  72. package/lib/view/{vendorFiling1099List → vendorFiling1099/vendorFiling1099List}/vendorFiling1099ListReducer.d.ts +8 -4
  73. package/lib/view/{vendorFiling1099List → vendorFiling1099/vendorFiling1099List}/vendorFiling1099ListReducer.js +18 -5
  74. package/lib/view/{vendorFiling1099List → vendorFiling1099/vendorFiling1099List}/vendorFiling1099ListSelector.d.ts +6 -6
  75. package/lib/view/{vendorFiling1099List → vendorFiling1099/vendorFiling1099List}/vendorFiling1099ListSelector.js +8 -3
  76. package/lib/view/{vendorFiling1099List → vendorFiling1099/vendorFiling1099List}/vendorFiling1099ListState.d.ts +3 -3
  77. package/lib/view/{vendorFiling1099List → vendorFiling1099/vendorFiling1099List}/vendorFiling1099ListState.js +1 -1
  78. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsPayload.d.ts +20 -0
  79. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsPayload.js +48 -0
  80. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.d.ts +25 -0
  81. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +184 -0
  82. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsSaveEpic.d.ts +11 -0
  83. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsSaveEpic.js +58 -0
  84. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsSelector.d.ts +14 -0
  85. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsSelector.js +17 -0
  86. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsState.d.ts +26 -0
  87. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsState.js +2 -0
  88. package/lib/view/vendorTabView/fetchVendorTabViewEpic.d.ts +1 -1
  89. package/lib/view/vendorTabView/fetchVendorTabViewEpic.js +2 -2
  90. package/package.json +2 -1
  91. /package/lib/view/{vendorFiling1099List → vendorFiling1099/vendorFiling1099List}/vendorFiling1099ListPayload.js +0 -0
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.updateFiling1099SortUiState = exports.updateFiling1099ScrollYOffset = exports.clearVendorsFiling1099List = exports.updateVendorFiling1099ListFailure = exports.updateVendorsFiling1099List = exports.fetchVendorsFiling1099List = exports.initialState = void 0;
4
+ exports.updateFiling1099SearchUIState = exports.updateFiling1099SortUIState = exports.updateFiling1099ScrollYOffset = exports.clearVendorsFiling1099List = exports.updateVendorFiling1099ListFailure = exports.updateVendorsFiling1099List = exports.fetchVendorsFiling1099List = exports.fetchVendorsFiling1099All = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
- const zeniDayJS_1 = require("../../zeniDayJS");
6
+ const zeniDayJS_1 = require("../../../zeniDayJS");
7
7
  exports.initialState = {
8
8
  fetchState: 'Not-Started',
9
9
  error: undefined,
@@ -25,11 +25,21 @@ const vendorFiling1099List = (0, toolkit_1.createSlice)({
25
25
  name: 'vendorFiling1099List',
26
26
  initialState: exports.initialState,
27
27
  reducers: {
28
+ fetchVendorsFiling1099All: {
29
+ prepare(cacheOverride) {
30
+ return {
31
+ payload: { cacheOverride },
32
+ };
33
+ },
34
+ reducer() {
35
+ // Do nothing
36
+ },
37
+ },
28
38
  fetchVendorsFiling1099List: {
29
39
  reducer(draft) {
30
40
  draft.fetchState = 'In-Progress';
31
41
  // Note: Need to reset scroll position whenever a new fetch happens, except when fetching through scroll
32
- draft.uiState.scrollYOffset = 0;
42
+ draft.uiState = exports.initialState.uiState;
33
43
  draft.error = undefined;
34
44
  },
35
45
  prepare() {
@@ -38,9 +48,12 @@ const vendorFiling1099List = (0, toolkit_1.createSlice)({
38
48
  };
39
49
  },
40
50
  },
41
- updateFiling1099SortUiState(draft, action) {
51
+ updateFiling1099SortUIState(draft, action) {
42
52
  draft.uiState = Object.assign(Object.assign({}, draft.uiState), { sortKey: action.payload.sortKey, sortOrder: action.payload.sortOrder });
43
53
  },
54
+ updateFiling1099SearchUIState(draft, action) {
55
+ draft.uiState = Object.assign(Object.assign({}, draft.uiState), { searchString: action.payload.searchString });
56
+ },
44
57
  updateVendorsFiling1099List(draft, action) {
45
58
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
46
59
  const { response } = action.payload;
@@ -67,5 +80,5 @@ const vendorFiling1099List = (0, toolkit_1.createSlice)({
67
80
  },
68
81
  },
69
82
  });
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;
83
+ _a = vendorFiling1099List.actions, exports.fetchVendorsFiling1099All = _a.fetchVendorsFiling1099All, exports.fetchVendorsFiling1099List = _a.fetchVendorsFiling1099List, exports.updateVendorsFiling1099List = _a.updateVendorsFiling1099List, exports.updateVendorFiling1099ListFailure = _a.updateVendorFiling1099ListFailure, exports.clearVendorsFiling1099List = _a.clearVendorsFiling1099List, exports.updateFiling1099ScrollYOffset = _a.updateFiling1099ScrollYOffset, exports.updateFiling1099SortUIState = _a.updateFiling1099SortUIState, exports.updateFiling1099SearchUIState = _a.updateFiling1099SearchUIState;
71
84
  exports.default = vendorFiling1099List.reducer;
@@ -1,10 +1,10 @@
1
- import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
2
- import { Vendor } from '../../entity/vendor/vendorState';
3
- import { RootState } from '../../reducer';
4
- import { ZeniDate } from '../../zeniDayJS';
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
5
  import { VendorFiling1099ListViewSortKey, VendorFiling1099ViewUIState } from './vendorFiling1099ListState';
6
- import { SortOrder } from '../../commonStateTypes/selectorTypes/sortOrderTypes';
7
- import { VendorType } from '../vendorTypeList/vendorTypeListPayload';
6
+ import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
7
+ import { VendorType } from '../../vendorTypeList/vendorTypeListPayload';
8
8
  export interface VendorFiling1099ListSelectorView extends SelectorView {
9
9
  vendors: Vendor[];
10
10
  vendorTypeList: VendorType[];
@@ -4,13 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.sortedVendorFiling1099View = exports.getVendorFiling1099List = void 0;
7
- const vendorSelector_1 = require("../../entity/vendor/vendorSelector");
7
+ const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
8
8
  const orderBy_1 = __importDefault(require("lodash/orderBy"));
9
+ const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
9
10
  const getVendorFiling1099List = (state) => {
10
11
  var _a;
11
12
  const { vendorFiling1099ListState, vendorState, vendorTypeListState } = state;
12
- const vendorTypeList = vendorTypeListState.vendorTypes;
13
13
  const targetIds = vendorFiling1099ListState.vendorIds;
14
+ const fetchStatus = (0, reduceFetchState_1.reduceFetchState)([
15
+ vendorFiling1099ListState,
16
+ vendorTypeListState,
17
+ ]);
18
+ const vendorTypeList = vendorTypeListState.vendorTypes;
14
19
  const loweredSearchText = vendorFiling1099ListState.uiState.searchString
15
20
  .trim()
16
21
  .toLowerCase();
@@ -25,7 +30,7 @@ const getVendorFiling1099List = (state) => {
25
30
  vendorTypeList: vendorTypeList,
26
31
  isVendor1099Populated: (_a = vendorFiling1099ListState.isVendor1099Populated) !== null && _a !== void 0 ? _a : true,
27
32
  uiState: vendorFiling1099ListState.uiState,
28
- fetchState: vendorFiling1099ListState.fetchState,
33
+ fetchState: fetchStatus.fetchState,
29
34
  lastRefreshSuccessTime: vendorFiling1099ListState.lastRefreshSuccessTime,
30
35
  error: vendorFiling1099ListState.error,
31
36
  version: 0,
@@ -1,6 +1,6 @@
1
- import { FetchedState, FetchState, ID } from '../../commonStateTypes/common';
2
- import { SortOrder } from '../../commonStateTypes/selectorTypes/sortOrderTypes';
3
- import { ZeniDate } from '../../zeniDayJS';
1
+ import { FetchedState, FetchState, ID } from '../../../commonStateTypes/common';
2
+ import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
3
+ import { ZeniDate } from '../../../zeniDayJS';
4
4
  export interface VendorFiling1099ViewUIState {
5
5
  sortKey: VendorFiling1099ListViewSortKey;
6
6
  sortOrder: SortOrder;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
3
+ const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
4
4
  const VENDOR_FILING_1099_LIST_VIEW_SORT_KEYS = [
5
5
  'vendor_name',
6
6
  'tax_classification',
@@ -0,0 +1,20 @@
1
+ import { Attachment } from '../../../entity/transaction/stateTypes/attachment';
2
+ import { FilePayload } from '../../../entity/file/filePayload';
3
+ import { VendorsFiling1099UploadDetailsLocalData } from './vendorFiling1099UploadDetailsState';
4
+ import { RootState } from '../../../reducer';
5
+ import { VendorUpdatePayload } from '../../commonVendorView/vendorView/vendorViewPayload';
6
+ import { ID } from '../../../commonStateTypes/common';
7
+ import { AddressUpdatableInfo } from '../../addressView/addressViewState';
8
+ import { Filing1099TinType } from '../../../entity/vendor/vendorType';
9
+ export interface W9Form {
10
+ tin?: Filing1099TinType;
11
+ vendor_name?: string;
12
+ vendor_type?: string;
13
+ }
14
+ export interface W9FormProcessingPayload {
15
+ files: FilePayload[];
16
+ title: string;
17
+ w9_form: W9Form[];
18
+ }
19
+ export declare const mapW9FormFileToAttachment: (file: FilePayload) => Attachment;
20
+ export declare const prepareEditVendor1099DetailsPayload: (state: RootState, localData: VendorsFiling1099UploadDetailsLocalData, vendorId: ID, address?: AddressUpdatableInfo | undefined) => Partial<VendorUpdatePayload>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareEditVendor1099DetailsPayload = exports.mapW9FormFileToAttachment = void 0;
4
+ const attachment_1 = require("../../../entity/transaction/stateTypes/attachment");
5
+ const zeniDayJS_1 = require("../../../zeniDayJS");
6
+ const zeniUrl_1 = require("../../../zeniUrl");
7
+ const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
8
+ const addressViewPayload_1 = require("../../addressView/addressViewPayload");
9
+ const mapW9FormFileToAttachment = (file) => {
10
+ var _a, _b, _c;
11
+ return ({
12
+ id: file.file_id,
13
+ contentType: (0, attachment_1.toContentTypeStrict)(file.content_type),
14
+ createTime: (0, zeniDayJS_1.date)(file.create_time),
15
+ updateTime: (0, zeniDayJS_1.date)((_a = file.update_time) !== null && _a !== void 0 ? _a : ''),
16
+ fileName: file.file_name,
17
+ fileSizeInBytes: file.file_size,
18
+ fileDownloadUrl: (0, zeniUrl_1.toZeniUrl)((_b = file.signed_url) !== null && _b !== void 0 ? _b : ''),
19
+ fileChecksum: (_c = file.checksum) !== null && _c !== void 0 ? _c : undefined,
20
+ fileId: file.file_id,
21
+ });
22
+ };
23
+ exports.mapW9FormFileToAttachment = mapW9FormFileToAttachment;
24
+ const prepareEditVendor1099DetailsPayload = (state, localData, vendorId, address) => {
25
+ var _a, _b, _c, _d, _e;
26
+ const { vendorState } = state;
27
+ const vendor = (0, vendorSelector_1.getVendorByVendorId)(vendorState, vendorId);
28
+ let addressPayload = undefined;
29
+ if (address != null) {
30
+ addressPayload = (0, addressViewPayload_1.toAddressUpdatableInfoPayload)(address);
31
+ }
32
+ const cleanedTinValue = (_b = (_a = localData.tin) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.replace(/\D/g, '');
33
+ return {
34
+ qbo_id: vendor === null || vendor === void 0 ? void 0 : vendor.qboId,
35
+ w9_document_ids: (_c = localData.w9Documents) === null || _c === void 0 ? void 0 : _c.map((doc) => doc.id),
36
+ vendor_name: localData.legalName,
37
+ email: localData.email,
38
+ phone: localData.phone,
39
+ vendor_type: localData.taxClassification,
40
+ tin: {
41
+ type: (_e = (_d = localData.tin) === null || _d === void 0 ? void 0 : _d.type) !== null && _e !== void 0 ? _e : null,
42
+ value: cleanedTinValue !== null && cleanedTinValue !== void 0 ? cleanedTinValue : null,
43
+ },
44
+ address: addressPayload,
45
+ sync_token: vendor === null || vendor === void 0 ? void 0 : vendor.syncToken,
46
+ };
47
+ };
48
+ exports.prepareEditVendor1099DetailsPayload = prepareEditVendor1099DetailsPayload;
@@ -0,0 +1,25 @@
1
+ import { VendorFiling1099UploadDetailsState, VendorsFiling1099UploadDetailsLocalData } from './vendorFiling1099UploadDetailsState';
2
+ import { FetchState, FetchStateAndError, ID } from '../../../commonStateTypes/common';
3
+ import { FilePayload } from '../../../entity/file/filePayload';
4
+ import { W9Form } from './vendorFiling1099UploadDetailsPayload';
5
+ import { ZeniAPIStatus } from '../../../responsePayload';
6
+ import { Vendor } from '../../../entity/vendor/vendorState';
7
+ export declare const initialState: VendorFiling1099UploadDetailsState;
8
+ export declare const updateW9FormUploadFile: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
9
+ w9FormFile: FilePayload;
10
+ }, string>, updateW9FormUploadFetchState: import("@reduxjs/toolkit").ActionCreatorWithPayload<FetchStateAndError, string>, vendorFiling1099UploadDetailsSave: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId: string], {
11
+ vendorId: string;
12
+ }, string, never, never>, vendorFiling1099UploadDetailsResetLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId: string], {
13
+ vendorId: string;
14
+ }, string, never, never>, vendorFiling1099UploadDetailsSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[fetchState: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
15
+ fetchState: FetchState;
16
+ error: ZeniAPIStatus<Record<string, unknown>> | undefined;
17
+ }, string, never, never>, initializeVendorFiling1099UploadDetailsLocalState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId: string, vendor: Vendor], {
18
+ vendorId: string;
19
+ vendor: Vendor;
20
+ }, string, never, never>, updateVendor1099DetailsLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<VendorsFiling1099UploadDetailsLocalData>, string>, updateW9FormOCRDataToLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
21
+ ocrData: W9Form;
22
+ vendorId: ID;
23
+ }, string>;
24
+ declare const _default: import("@reduxjs/toolkit").Reducer<VendorFiling1099UploadDetailsState, import("@reduxjs/toolkit").AnyAction>;
25
+ export default _default;
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.updateW9FormOCRDataToLocalData = exports.updateVendor1099DetailsLocalData = exports.initializeVendorFiling1099UploadDetailsLocalState = exports.vendorFiling1099UploadDetailsSuccessOrFailure = exports.vendorFiling1099UploadDetailsResetLocalData = exports.vendorFiling1099UploadDetailsSave = exports.updateW9FormUploadFetchState = exports.updateW9FormUploadFile = exports.initialState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const vendorFiling1099UploadDetailsPayload_1 = require("./vendorFiling1099UploadDetailsPayload");
7
+ exports.initialState = {
8
+ fetchState: 'Not-Started',
9
+ hasValidState() {
10
+ return this.fetchState == 'Completed';
11
+ },
12
+ error: undefined,
13
+ w9FormUploadStatus: {
14
+ fetchState: 'Not-Started',
15
+ error: undefined,
16
+ },
17
+ vendor1099DetailsLocalData: {
18
+ vendorId: '',
19
+ w9Documents: [],
20
+ email: '',
21
+ legalName: '',
22
+ phone: '',
23
+ taxClassification: '',
24
+ tin: {
25
+ type: null,
26
+ value: null,
27
+ },
28
+ },
29
+ vendor1099DetailsAutoFilledValues: {
30
+ tin: {
31
+ type: false,
32
+ value: false,
33
+ },
34
+ legalName: false,
35
+ taxClassification: false,
36
+ },
37
+ vendor1099DetailsSaveStatus: {
38
+ fetchState: 'Not-Started',
39
+ error: undefined,
40
+ },
41
+ };
42
+ const vendorFiling1099UploadDetails = (0, toolkit_1.createSlice)({
43
+ name: 'vendorFiling1099UploadDetails',
44
+ initialState: exports.initialState,
45
+ reducers: {
46
+ updateW9FormUploadFile(draft, action) {
47
+ if (action.payload.w9FormFile != null) {
48
+ const w9FormFileAttachment = (0, vendorFiling1099UploadDetailsPayload_1.mapW9FormFileToAttachment)(action.payload.w9FormFile);
49
+ draft.vendor1099DetailsLocalData = Object.assign(Object.assign({}, draft.vendor1099DetailsLocalData), { w9Documents: [w9FormFileAttachment] });
50
+ draft.w9FormUploadStatus = {
51
+ fetchState: 'Completed',
52
+ error: undefined,
53
+ };
54
+ }
55
+ },
56
+ updateW9FormUploadFetchState(draft, action) {
57
+ draft.w9FormUploadStatus = {
58
+ fetchState: action.payload.fetchState,
59
+ error: action.payload.error,
60
+ };
61
+ },
62
+ vendorFiling1099UploadDetailsResetLocalData: {
63
+ reducer(draft, action) {
64
+ draft.vendor1099DetailsLocalData = {
65
+ vendorId: action.payload.vendorId,
66
+ w9Documents: [],
67
+ email: '',
68
+ legalName: '',
69
+ phone: '',
70
+ taxClassification: '',
71
+ tin: {
72
+ type: null,
73
+ value: null,
74
+ },
75
+ };
76
+ draft.vendor1099DetailsAutoFilledValues = {
77
+ tin: {
78
+ type: false,
79
+ value: false,
80
+ },
81
+ legalName: false,
82
+ taxClassification: false,
83
+ };
84
+ draft.vendor1099DetailsSaveStatus = {
85
+ fetchState: 'Not-Started',
86
+ error: undefined,
87
+ };
88
+ draft.w9FormUploadStatus = {
89
+ fetchState: 'Not-Started',
90
+ error: undefined,
91
+ };
92
+ },
93
+ prepare(vendorId) {
94
+ return {
95
+ payload: {
96
+ vendorId,
97
+ },
98
+ };
99
+ },
100
+ },
101
+ vendorFiling1099UploadDetailsSave: {
102
+ reducer(draft) {
103
+ draft.vendor1099DetailsSaveStatus = {
104
+ fetchState: 'In-Progress',
105
+ error: undefined,
106
+ };
107
+ },
108
+ prepare(vendorId) {
109
+ return {
110
+ payload: {
111
+ vendorId,
112
+ },
113
+ };
114
+ },
115
+ },
116
+ vendorFiling1099UploadDetailsSuccessOrFailure: {
117
+ reducer(draft, action) {
118
+ draft.vendor1099DetailsSaveStatus.fetchState =
119
+ action.payload.fetchState;
120
+ draft.vendor1099DetailsSaveStatus.error = action.payload.error;
121
+ },
122
+ prepare(fetchState, error) {
123
+ return {
124
+ payload: {
125
+ fetchState,
126
+ error,
127
+ },
128
+ };
129
+ },
130
+ },
131
+ initializeVendorFiling1099UploadDetailsLocalState: {
132
+ reducer(draft, action) {
133
+ var _a, _b, _c, _d, _e, _f;
134
+ const vendor = action.payload.vendor;
135
+ draft.vendor1099DetailsLocalData = {
136
+ vendorId: action.payload.vendorId,
137
+ legalName: vendor.name,
138
+ email: vendor.email,
139
+ w9Documents: (_a = vendor.filing1099W9Files) !== null && _a !== void 0 ? _a : [],
140
+ phone: vendor.phone,
141
+ taxClassification: (_b = vendor.filing1099TaxClassification) !== null && _b !== void 0 ? _b : '',
142
+ tin: {
143
+ type: (_d = (_c = vendor.filing1099Tin) === null || _c === void 0 ? void 0 : _c.type) !== null && _d !== void 0 ? _d : null,
144
+ value: (_f = (_e = vendor.filing1099Tin) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : '',
145
+ },
146
+ };
147
+ },
148
+ prepare(vendorId, vendor) {
149
+ return {
150
+ payload: {
151
+ vendorId,
152
+ vendor,
153
+ },
154
+ };
155
+ },
156
+ },
157
+ updateVendor1099DetailsLocalData(draft, action) {
158
+ draft.vendor1099DetailsLocalData = Object.assign(Object.assign({}, draft.vendor1099DetailsLocalData), action.payload);
159
+ },
160
+ updateW9FormOCRDataToLocalData(draft, action) {
161
+ var _a, _b, _c, _d, _e;
162
+ const tin = (_a = action.payload.ocrData) === null || _a === void 0 ? void 0 : _a.tin;
163
+ const vendorName = (_b = action.payload.ocrData) === null || _b === void 0 ? void 0 : _b.vendor_name;
164
+ const vendorType = (_c = action.payload.ocrData) === null || _c === void 0 ? void 0 : _c.vendor_type;
165
+ const tinType = (_d = tin === null || tin === void 0 ? void 0 : tin.type) !== null && _d !== void 0 ? _d : null;
166
+ const tinValue = (_e = tin === null || tin === void 0 ? void 0 : tin.value) !== null && _e !== void 0 ? _e : null;
167
+ // TODO: Add billing address to the local state
168
+ draft.vendor1099DetailsLocalData = Object.assign(Object.assign({}, draft.vendor1099DetailsLocalData), { tin: {
169
+ type: tinType,
170
+ value: tinValue,
171
+ }, legalName: vendorName !== null && vendorName !== void 0 ? vendorName : '', taxClassification: vendorType !== null && vendorType !== void 0 ? vendorType : '' });
172
+ draft.vendor1099DetailsAutoFilledValues = {
173
+ tin: {
174
+ type: tinType != null,
175
+ value: tinValue != null,
176
+ },
177
+ legalName: vendorName !== '',
178
+ taxClassification: vendorType !== '',
179
+ };
180
+ },
181
+ },
182
+ });
183
+ _a = vendorFiling1099UploadDetails.actions, exports.updateW9FormUploadFile = _a.updateW9FormUploadFile, exports.updateW9FormUploadFetchState = _a.updateW9FormUploadFetchState, exports.vendorFiling1099UploadDetailsSave = _a.vendorFiling1099UploadDetailsSave, exports.vendorFiling1099UploadDetailsResetLocalData = _a.vendorFiling1099UploadDetailsResetLocalData, exports.vendorFiling1099UploadDetailsSuccessOrFailure = _a.vendorFiling1099UploadDetailsSuccessOrFailure, exports.initializeVendorFiling1099UploadDetailsLocalState = _a.initializeVendorFiling1099UploadDetailsLocalState, exports.updateVendor1099DetailsLocalData = _a.updateVendor1099DetailsLocalData, exports.updateW9FormOCRDataToLocalData = _a.updateW9FormOCRDataToLocalData;
184
+ exports.default = vendorFiling1099UploadDetails.reducer;
@@ -0,0 +1,11 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { ZeniAPI } from '../../../zeniAPI';
3
+ import { RootState } from '../../../reducer';
4
+ import { vendorFiling1099UploadDetailsSave, vendorFiling1099UploadDetailsResetLocalData, vendorFiling1099UploadDetailsSuccessOrFailure } from './vendorFiling1099UploadDetailsReducer';
5
+ import { updateVendors } from '../../../entity/vendor/vendorReducer';
6
+ import { updateAddresses } from '../../../entity/address/addressReducer';
7
+ import { updateContacts } from '../../../entity/billPay/contact/contactReducer';
8
+ import { updateBankAccounts } from '../../../entity/bankAccount/bankAccountReducer';
9
+ import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
10
+ export declare type ActionType = ReturnType<typeof vendorFiling1099UploadDetailsSave> | ReturnType<typeof updateVendors> | ReturnType<typeof openSnackbar> | ReturnType<typeof vendorFiling1099UploadDetailsResetLocalData> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateContacts> | ReturnType<typeof updateBankAccounts> | ReturnType<typeof vendorFiling1099UploadDetailsSuccessOrFailure>;
11
+ export declare const vendorFiling1099UploadDetailsSaveEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.vendorFiling1099UploadDetailsSaveEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const vendorFiling1099UploadDetailsPayload_1 = require("../vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsPayload");
8
+ const vendorFiling1099UploadDetailsReducer_1 = require("./vendorFiling1099UploadDetailsReducer");
9
+ const vendorReducer_1 = require("../../../entity/vendor/vendorReducer");
10
+ const addressReducer_1 = require("../../../entity/address/addressReducer");
11
+ const commonVendorViewHelper_1 = require("../../commonVendorView/commonVendorViewHelper");
12
+ const contactReducer_1 = require("../../../entity/billPay/contact/contactReducer");
13
+ const bankAccountReducer_1 = require("../../../entity/bankAccount/bankAccountReducer");
14
+ const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
15
+ const vendorFiling1099UploadDetailsSaveEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(vendorFiling1099UploadDetailsReducer_1.vendorFiling1099UploadDetailsSave.match), (0, operators_1.mergeMap)((action) => {
16
+ var _a;
17
+ const state = state$.value;
18
+ const vendorFiling1099ViewState = state.vendorFiling1099UploadDetailsState;
19
+ const address = (_a = state$.value.addressViewState.newAddressState) === null || _a === void 0 ? void 0 : _a.vendor_address.addressToCreate;
20
+ const vendorId = action.payload.vendorId;
21
+ const payload = (0, vendorFiling1099UploadDetailsPayload_1.prepareEditVendor1099DetailsPayload)(state, vendorFiling1099ViewState.vendor1099DetailsLocalData, vendorId, address);
22
+ const saveVendorApi = zeniAPI.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/vendors/${vendorId}`, payload);
23
+ return saveVendorApi.pipe((0, operators_1.mergeMap)((response) => {
24
+ var _a;
25
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
26
+ const flattenedAddresses = (0, commonVendorViewHelper_1.getFlattenedAddress)(response.data.vendors);
27
+ const flattenedBankAccounts = (0, commonVendorViewHelper_1.getFlattenedBankAccounts)(response.data.vendors);
28
+ const actions = [
29
+ (0, vendorReducer_1.updateVendors)(response.data.vendors),
30
+ (0, contactReducer_1.updateContacts)((_a = response.data.vendors[0].contacts) !== null && _a !== void 0 ? _a : []),
31
+ (0, addressReducer_1.updateAddresses)(flattenedAddresses),
32
+ (0, bankAccountReducer_1.updateBankAccounts)(flattenedBankAccounts),
33
+ ];
34
+ actions.push((0, vendorFiling1099UploadDetailsReducer_1.vendorFiling1099UploadDetailsResetLocalData)(action.payload.vendorId));
35
+ actions.push((0, vendorFiling1099UploadDetailsReducer_1.vendorFiling1099UploadDetailsSuccessOrFailure)('Completed'));
36
+ actions.push((0, snackbarReducer_1.openSnackbar)({
37
+ messageSection: 'update_vendor',
38
+ messageText: 'success',
39
+ type: 'success',
40
+ }));
41
+ return (0, rxjs_1.from)(actions);
42
+ }
43
+ else {
44
+ return (0, rxjs_1.of)((0, vendorFiling1099UploadDetailsReducer_1.vendorFiling1099UploadDetailsSuccessOrFailure)('Error', response.status), (0, snackbarReducer_1.openSnackbar)({
45
+ messageSection: 'update_vendor',
46
+ messageText: 'failed',
47
+ type: 'error',
48
+ variables: [
49
+ {
50
+ variableName: '_api-error_',
51
+ variableValue: response.status.message,
52
+ },
53
+ ],
54
+ }));
55
+ }
56
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, vendorFiling1099UploadDetailsReducer_1.vendorFiling1099UploadDetailsSuccessOrFailure)('Error', (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Vendors Filing 1099 Upload Details save REST API call errored out ${JSON.stringify(error)}`)))));
57
+ }));
58
+ exports.vendorFiling1099UploadDetailsSaveEpic = vendorFiling1099UploadDetailsSaveEpic;
@@ -0,0 +1,14 @@
1
+ import { ID } from '../../../commonStateTypes/common';
2
+ import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
3
+ import { Vendor } from '../../../entity/vendor/vendorState';
4
+ import { RootState } from '../../../reducer';
5
+ import { Attachment } from '../../../entity/transaction/stateTypes/attachment';
6
+ import { VendorType } from '../../vendorTypeList/vendorTypeListPayload';
7
+ import { NewAddressData } from '../../addressView/addressViewState';
8
+ export interface VendorFiling1099UploadDetailsSelectorView extends SelectorView {
9
+ vendor: Vendor;
10
+ vendorTypeList: VendorType[];
11
+ file?: Attachment;
12
+ addressStatus?: NewAddressData;
13
+ }
14
+ export declare const getVendorUploadDetailsByVendorId: (state: RootState, vendorId: ID) => VendorFiling1099UploadDetailsSelectorView;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getVendorUploadDetailsByVendorId = void 0;
4
+ const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
5
+ const getVendorUploadDetailsByVendorId = (state, vendorId) => {
6
+ var _a;
7
+ const vendor = (0, vendorSelector_1.getVendorsByVendorIds)(state.vendorState, [vendorId])[0];
8
+ const { vendorFiling1099UploadDetailsState, vendorTypeListState, addressViewState, } = state;
9
+ const addressStatus = (_a = addressViewState.newAddressState) === null || _a === void 0 ? void 0 : _a.vendor_address;
10
+ return {
11
+ vendor,
12
+ vendorTypeList: vendorTypeListState.vendorTypes,
13
+ fetchState: vendorFiling1099UploadDetailsState.fetchState,
14
+ addressStatus: addressStatus,
15
+ };
16
+ };
17
+ exports.getVendorUploadDetailsByVendorId = getVendorUploadDetailsByVendorId;
@@ -0,0 +1,26 @@
1
+ import { FetchedState, FetchStateAndError, ID } from '../../../commonStateTypes/common';
2
+ import { Attachment } from '../../../entity/transaction/stateTypes/attachment';
3
+ import { Filing1099TinType } from '../../../entity/vendor/vendorType';
4
+ export interface VendorFiling1099UploadDetailsState extends FetchedState {
5
+ w9FormUploadStatus: FetchStateAndError;
6
+ vendor1099DetailsLocalData: VendorsFiling1099UploadDetailsLocalData;
7
+ vendor1099DetailsSaveStatus: FetchStateAndError;
8
+ vendor1099DetailsAutoFilledValues?: Vendor1099DetailsAutoFilledValues;
9
+ }
10
+ export interface VendorsFiling1099UploadDetailsLocalData {
11
+ vendorId: ID;
12
+ legalName: string;
13
+ email: string;
14
+ phone: string;
15
+ taxClassification: string;
16
+ tin: Filing1099TinType;
17
+ w9Documents?: Attachment[];
18
+ }
19
+ export interface Vendor1099DetailsAutoFilledValues {
20
+ tin: {
21
+ type: boolean;
22
+ value: boolean;
23
+ };
24
+ legalName: boolean;
25
+ taxClassification: boolean;
26
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,6 +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
- import { fetchVendorsFiling1099List } from '../vendorFiling1099List/vendorFiling1099ListReducer';
8
+ import { fetchVendorsFiling1099List } from '../vendorFiling1099/vendorFiling1099List/vendorFiling1099ListReducer';
9
9
  export declare type ActionType = ReturnType<typeof fetchVendorTabView> | ReturnType<typeof fetchOpExByVendor> | ReturnType<typeof fetchVendorsList> | ReturnType<typeof fetchAccruedScheduleList> | ReturnType<typeof fetchScheduleList> | ReturnType<typeof fetchVendorsFiling1099List>;
10
10
  export declare const fetchVendorTabViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -7,12 +7,12 @@ 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
+ const vendorFiling1099ListReducer_1 = require("../vendorFiling1099/vendorFiling1099List/vendorFiling1099ListReducer");
11
11
  const scheduleListSelector_1 = require("../scheduleView/scheduleListView/scheduleListSelector");
12
12
  const scheduleListHelper_1 = require("../scheduleView/scheduleListView/scheduleListHelper");
13
13
  const opExByVendorSelector_1 = require("../opExByVendor/opExByVendorSelector");
14
14
  const vendorListSelector_1 = require("../vendorList/vendorListSelector");
15
- const vendorFiling1099ListSelector_1 = require("../vendorFiling1099List/vendorFiling1099ListSelector");
15
+ const vendorFiling1099ListSelector_1 = require("../vendorFiling1099/vendorFiling1099List/vendorFiling1099ListSelector");
16
16
  const fetchVendorTabViewEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(vendorTabViewReducer_1.fetchVendorTabView.match), (0, operators_1.switchMap)((action) => {
17
17
  const { shouldFetchAccruedExpenses, shouldFetchFixedAssets, shouldFetchOpexByVendor, shouldFetchPrepaidExpenses, shouldFetchVendorsList, shouldFetchFiling1099Vendor, } = action.payload;
18
18
  const state = state$.value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.12.65",
3
+ "version": "4.12.67",
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",
@@ -88,6 +88,7 @@
88
88
  "build": "concurrently --kill-others-on-fail \"eslint . --ext .js,.jsx,.ts,.tsx\" \"tsc\" \"jest --config jest.config.json\"",
89
89
  "onlybuild": "concurrently --kill-others-on-fail \"eslint . --ext .js,.jsx,.ts,.tsx\" \"tsc\"",
90
90
  "format": "prettier --write --ignore-unknown \"src/**/*\"",
91
+ "format-watch": "git diff --name-only --diff-filter=d | grep -E '\\.(ts|tsx)$' | xargs prettier --write",
91
92
  "check-version": "ts-node ./scripts/check-version.ts",
92
93
  "version": "git add -A src",
93
94
  "postversion": "git push && git push --tags",