@zeniai/client-epic-state 4.12.62 → 4.12.63

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 (38) hide show
  1. package/lib/entity/tenant/clearAllEpic.d.ts +1 -1
  2. package/lib/entity/tenant/clearAllEpic.js +1 -1
  3. package/lib/entity/vendor/__mocks__/vendorMock.d.ts +7 -0
  4. package/lib/entity/vendor/__mocks__/vendorMock.js +339 -0
  5. package/lib/entity/vendor/__mocks__/vendorStateMocks.js +6 -1
  6. package/lib/entity/vendor/vendorPayload.d.ts +2 -1
  7. package/lib/entity/vendor/vendorPayload.js +6 -4
  8. package/lib/entity/vendor/vendorState.d.ts +1 -0
  9. package/lib/epic.d.ts +2 -1
  10. package/lib/epic.js +2 -1
  11. package/lib/index.d.ts +5 -0
  12. package/lib/index.js +23 -13
  13. package/lib/reducer.d.ts +3 -0
  14. package/lib/reducer.js +3 -0
  15. package/lib/view/addressView/__mocks__/addressViewMocks.d.ts +34 -0
  16. package/lib/view/addressView/__mocks__/addressViewMocks.js +223 -0
  17. package/lib/view/addressView/__mocks__/json/createAddressResponse.json +23 -0
  18. package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +218 -0
  19. package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +345 -0
  20. package/lib/view/addressView/__mocks__/json/fetchAddressResponse.json +24 -0
  21. package/lib/view/addressView/__mocks__/json/updateAddressResponse.json +24 -0
  22. package/lib/view/commonVendorView/vendorView/epics/fetchVendorDetailsEpic.js +2 -2
  23. package/lib/view/commonVendorView/vendorView/vendorViewPayload.d.ts +6 -0
  24. package/lib/view/twoFactorAuthentication/sendOtpEpic.js +9 -6
  25. package/lib/view/vendorFiling1099/__mock__/json/vendorFiling1099ListSuccess.json +1 -1
  26. package/lib/view/vendorFiling1099/__mock__/vendorFiling1099UploadDetailsMock.d.ts +132 -0
  27. package/lib/view/vendorFiling1099/__mock__/vendorFiling1099UploadDetailsMock.js +146 -0
  28. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsPayload.d.ts +20 -0
  29. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsPayload.js +48 -0
  30. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.d.ts +25 -0
  31. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +180 -0
  32. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsSaveEpic.d.ts +11 -0
  33. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsSaveEpic.js +58 -0
  34. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsSelector.d.ts +14 -0
  35. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsSelector.js +17 -0
  36. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsState.d.ts +26 -0
  37. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsState.js +2 -0
  38. package/package.json +2 -1
@@ -7,6 +7,7 @@ import { ZeniAPIResponse } from '../../../responsePayload';
7
7
  import { VendorDetailLocalData } from './vendorViewState';
8
8
  import { AddressUpdatableInfoPayload } from '../../addressView/addressViewPayload';
9
9
  import { FetchAllVendorsPayload } from '../../vendorList/vendorListPayload';
10
+ import { Filing1099TinType } from '../../../entity/vendor/vendorType';
10
11
  export declare type VendorCreationResponse = ZeniAPIResponse<FetchAllVendorsPayload>;
11
12
  export interface VendorUpdatePayload {
12
13
  qbo_id: string;
@@ -24,7 +25,12 @@ export interface VendorUpdatePayload {
24
25
  address?: AddressUpdatableInfoPayload;
25
26
  is_vendor_1099?: boolean;
26
27
  document_ids?: ID[];
28
+ w9_document_ids?: ID[];
27
29
  owner_id: ID | null;
28
30
  is_two_factor_verification_required?: boolean;
31
+ email?: string;
32
+ phone?: string;
33
+ filing1099TaxClassification?: string;
34
+ tin?: Filing1099TinType;
29
35
  }
30
36
  export declare const prepareEditVendorPayload: (state: RootState, vendorDetailLocalData: VendorDetailLocalData, vendorId: ID | undefined) => Partial<VendorUpdatePayload>;
@@ -11,23 +11,26 @@ const onboardingCustomerViewReducer_1 = require("../onboardingView/customerView/
11
11
  const settingsViewReducer_1 = require("../settingsView/settingsViewReducer");
12
12
  const cardUserOnboardingReducer_1 = require("../spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingReducer");
13
13
  const sendOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(twoFactorAuthenticationReducer_1.sendOtp.match), (0, operators_1.mergeMap)((action) => {
14
- var _a, _b;
14
+ var _a;
15
15
  const sendOtpActions = [];
16
16
  const { phoneNumber, twoFASource } = action.payload;
17
17
  const tenantState = state$.value.tenantState;
18
18
  const { currentTenantId } = tenantState;
19
19
  const productSettings = currentTenantId != null
20
- ? (_b = (_a = tenantState.tenantsById) === null || _a === void 0 ? void 0 : _a[currentTenantId]) === null || _b === void 0 ? void 0 : _b.productSettings
20
+ ? (_a = tenantState.tenantsById[currentTenantId]) === null || _a === void 0 ? void 0 : _a.productSettings
21
21
  : undefined;
22
- const isCardsEnabled = productSettings != null ? productSettings.isBookkeepingEnabled || productSettings.isCardsEnabled : false;
22
+ const isCardsEnabled = productSettings != null
23
+ ? productSettings.isBookkeepingEnabled ||
24
+ productSettings.isCardsEnabled
25
+ : false;
23
26
  const queryPayload = {
24
27
  channel_type: 'phone',
25
28
  channel_info: {
26
29
  phone_number: phoneNumber,
27
30
  },
28
- is_for_charge_cards: (twoFASource === 'ChargeCard'
29
- || twoFASource === "CardUserOnboarding"
30
- || (twoFASource === "MyProfile" && isCardsEnabled)),
31
+ is_for_charge_cards: twoFASource === 'ChargeCard' ||
32
+ twoFASource === 'CardUserOnboarding' ||
33
+ (twoFASource === 'MyProfile' && isCardsEnabled),
31
34
  };
32
35
  switch (twoFASource) {
33
36
  case 'SpendManagementSetup':
@@ -77,7 +77,7 @@
77
77
  },
78
78
  "vendor_1099_status": "incomplete",
79
79
  "vendor_1099_ytd_total": -2287.0,
80
- "w9_document": []
80
+ "w9_documents": []
81
81
  }
82
82
  ],
83
83
  "version": "2.0"
@@ -0,0 +1,132 @@
1
+ import { RootState } from '../../../reducer';
2
+ import { VendorFiling1099UploadDetailsState } from '../vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsState';
3
+ export declare const vendorFiling1099UploadDetailsSuccessResponse: {
4
+ data: {
5
+ filter: null;
6
+ query: {
7
+ end_date: string;
8
+ group_by: string;
9
+ sort_order: string;
10
+ source_account_type: string;
11
+ start_date: string;
12
+ };
13
+ query_definitions: {};
14
+ report: {
15
+ currency: {
16
+ currency_code: null;
17
+ currency_symbol: null;
18
+ };
19
+ is_vendor_1099_populated: boolean;
20
+ report_id: string;
21
+ report_title: string;
22
+ status: {
23
+ code: number;
24
+ description: string;
25
+ is_filtered_report: boolean;
26
+ last_refresh_attempt_time: string;
27
+ last_refresh_success_time: string;
28
+ message: string;
29
+ };
30
+ vendors: {
31
+ vendor_id: string;
32
+ qbo_id: string;
33
+ vendor_name: string;
34
+ title: string;
35
+ suffix: string;
36
+ first_name: string;
37
+ middle_name: string;
38
+ last_name: string;
39
+ vendor_type: string;
40
+ logo: {
41
+ url: string;
42
+ base64: string;
43
+ };
44
+ owner: null;
45
+ balance: number;
46
+ is_deleted: boolean;
47
+ qbo_create_time: string;
48
+ qbo_update_time: string;
49
+ create_time: string;
50
+ update_time: string;
51
+ email: string;
52
+ phone: string;
53
+ website_url: string;
54
+ currency_code: string;
55
+ currency_symbol: string;
56
+ country_code: string;
57
+ billing_address_id: string;
58
+ billing_address: {
59
+ address_id: string;
60
+ city: string;
61
+ country: string;
62
+ country_code: null;
63
+ create_time: string;
64
+ hash_value: string;
65
+ latitude: null;
66
+ longitude: null;
67
+ postal_code: string;
68
+ state: string;
69
+ street: string[];
70
+ update_time: string;
71
+ };
72
+ documents: never[];
73
+ vendor_currency_code: string;
74
+ vendor_currency_symbol: string;
75
+ tin: {
76
+ type: string;
77
+ value: string;
78
+ };
79
+ vendor_1099_status: string;
80
+ vendor_1099_ytd_total: number;
81
+ w9_documents: never[];
82
+ }[];
83
+ version: string;
84
+ };
85
+ };
86
+ status: {
87
+ code: number;
88
+ message: string;
89
+ };
90
+ };
91
+ export declare const vendorFiling1099UploadDetailsFailureResponse: {
92
+ status: {
93
+ message: string;
94
+ code: number;
95
+ };
96
+ };
97
+ export declare const vendorFiling1099UploadDetailsInProgressState: VendorFiling1099UploadDetailsState;
98
+ export declare const vendorFiling1099UploadDetailsInProgressInitialState: VendorFiling1099UploadDetailsState;
99
+ export declare const vendorFiling1099UploadDetailsSuccessState: VendorFiling1099UploadDetailsState;
100
+ export declare const w9FormFile: {
101
+ checksum: string;
102
+ company_id: string;
103
+ content_type: string;
104
+ create_time: string;
105
+ create_userid: string;
106
+ document_side: string;
107
+ document_type: string;
108
+ extension: string;
109
+ file_id: string;
110
+ file_location: string;
111
+ file_name: string;
112
+ file_size: number;
113
+ file_size_unit: string;
114
+ image_file_ids: string[];
115
+ image_files: {
116
+ create_time: string;
117
+ file_location: string;
118
+ height: number;
119
+ image_format: string;
120
+ image_size_type: string;
121
+ signed_url: string;
122
+ update_time: string;
123
+ width: number;
124
+ }[];
125
+ index: string;
126
+ purpose_id: string;
127
+ signed_url: string;
128
+ update_time: string;
129
+ update_userid: string;
130
+ user_id: string;
131
+ };
132
+ export declare const rootStateWithVendorFiling1099UploadDetails: RootState;
@@ -0,0 +1,146 @@
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.rootStateWithVendorFiling1099UploadDetails = exports.w9FormFile = exports.vendorFiling1099UploadDetailsSuccessState = exports.vendorFiling1099UploadDetailsInProgressInitialState = exports.vendorFiling1099UploadDetailsInProgressState = exports.vendorFiling1099UploadDetailsFailureResponse = exports.vendorFiling1099UploadDetailsSuccessResponse = void 0;
7
+ const reducer_1 = require("../../../reducer");
8
+ const vendorMock_1 = require("../../../entity/vendor/__mocks__/vendorMock");
9
+ const addressViewMocks_1 = require("../../addressView/__mocks__/addressViewMocks");
10
+ const vendorFiling1099ListSuccess_json_1 = __importDefault(require("./json/vendorFiling1099ListSuccess.json"));
11
+ const apiFailure_json_1 = __importDefault(require("../../../__testHelpers__/apiFailure.json"));
12
+ exports.vendorFiling1099UploadDetailsSuccessResponse = vendorFiling1099ListSuccess_json_1.default;
13
+ exports.vendorFiling1099UploadDetailsFailureResponse = apiFailure_json_1.default;
14
+ exports.vendorFiling1099UploadDetailsInProgressState = {
15
+ fetchState: 'In-Progress',
16
+ hasValidState() {
17
+ return this.fetchState == 'Completed';
18
+ },
19
+ error: undefined,
20
+ w9FormUploadStatus: {
21
+ fetchState: 'Not-Started',
22
+ error: undefined,
23
+ },
24
+ vendor1099DetailsLocalData: {
25
+ vendorId: '123',
26
+ w9Documents: [],
27
+ legalName: '',
28
+ email: '',
29
+ phone: '',
30
+ taxClassification: '',
31
+ tin: {
32
+ type: null,
33
+ value: '',
34
+ },
35
+ },
36
+ vendor1099DetailsSaveStatus: {
37
+ fetchState: 'Not-Started',
38
+ error: undefined,
39
+ },
40
+ };
41
+ exports.vendorFiling1099UploadDetailsInProgressInitialState = {
42
+ fetchState: 'Not-Started',
43
+ hasValidState() {
44
+ return this.fetchState == 'Completed';
45
+ },
46
+ error: undefined,
47
+ w9FormUploadStatus: {
48
+ fetchState: 'Not-Started',
49
+ error: undefined,
50
+ },
51
+ vendor1099DetailsLocalData: {
52
+ vendorId: '123',
53
+ w9Documents: [],
54
+ legalName: '',
55
+ email: '',
56
+ phone: '',
57
+ taxClassification: '',
58
+ tin: {
59
+ type: null,
60
+ value: '',
61
+ },
62
+ },
63
+ vendor1099DetailsSaveStatus: {
64
+ fetchState: 'Not-Started',
65
+ error: undefined,
66
+ },
67
+ };
68
+ exports.vendorFiling1099UploadDetailsSuccessState = {
69
+ fetchState: 'Completed',
70
+ hasValidState() {
71
+ return this.fetchState == 'Completed';
72
+ },
73
+ error: undefined,
74
+ w9FormUploadStatus: {
75
+ fetchState: 'Completed',
76
+ error: undefined,
77
+ },
78
+ vendor1099DetailsLocalData: {
79
+ vendorId: '123',
80
+ w9Documents: [],
81
+ legalName: '',
82
+ email: '',
83
+ phone: '',
84
+ taxClassification: '',
85
+ tin: {
86
+ type: null,
87
+ value: '',
88
+ },
89
+ },
90
+ vendor1099DetailsSaveStatus: {
91
+ fetchState: 'Not-Started',
92
+ error: undefined,
93
+ },
94
+ };
95
+ exports.w9FormFile = {
96
+ checksum: 'd41d8cd98f00b204e9800998ecf8427e',
97
+ company_id: 'c_c98ead41-e255-4f55-bde5-98725b21cadd',
98
+ content_type: 'application/pdf',
99
+ create_time: '2024-11-29T09:00:55.219692',
100
+ create_userid: 'u_f65e9b38-94fb-4a94-a2ab-27469df90bce',
101
+ document_side: 'front',
102
+ document_type: 'w9',
103
+ extension: '.pdf',
104
+ file_id: 'file_a1c42d17-e638-485a-adbc-489522132157',
105
+ file_location: '/duolingo3-dot-ai-b452e138-af1d-4da0-8eb5-eb6bd233cfcc/files/2024-11-29/file_a1c42d17-e638-485a-adbc-489522132157/file_a1c42d17-e638-485a-adbc-489522132157.pdf',
106
+ file_name: 'w9_embarc_advisors_llc__2_ (1).pdf',
107
+ file_size: 81400,
108
+ file_size_unit: 'bytes',
109
+ image_file_ids: ['image_file_c07dbdb6-1ae8-41ee-a5ad-7b0525f3165f'],
110
+ image_files: [
111
+ {
112
+ create_time: '2024-11-29T09:01:01.356171',
113
+ file_location: '/duolingo3-dot-ai-b452e138-af1d-4da0-8eb5-eb6bd233cfcc/files/2024-11-29/file_a1c42d17-e638-485a-adbc-489522132157/image_file_c07dbdb6-1ae8-41ee-a5ad-7b0525f3165f.jpg',
114
+ height: 0,
115
+ image_format: 'jpg',
116
+ image_size_type: 'thumbnail',
117
+ signed_url: 'https://storage.googleapis.com/duolingo3-dot-ai-b452e138-af1d-4da0-8eb5-eb6bd233cfcc/files/2024-11-29/file_a1c42d17-e638-485a-adbc-489522132157/image_file_c07dbdb6-1ae8-41ee-a5ad-7b0525f3165f.jpg?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=zeni-apis-dev%40appspot.gserviceaccount.com%2F20241129%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20241129T090101Z&X-Goog-Expires=86400&X-Goog-SignedHeaders=host&X-Goog-Signature=450342aac90b181c8e306fe938829e3f4f994fdea94dbf65689aaab497aa8b172227fdf94a411fbb77df2d2ec9d53e32d970000c719a63c05b654bf1a32f91f5a184579c1c8f85f96fad9eae4bd229db4bf788e5d118a2549a253e61050e1c20b4af5225ee7ada3b20d9dadaf283793c1482e4706adc52ef5cfedb4bf55cb649e881da2ebbd5011bf22a203ada1e5f9c859072693f393c412f738a2c179f0c10fe30dcb7d792b4b9de2753fbeb6c1eaceb05e9835d3aefb5719a9568cbc5705ff77324049349196aa36394e8a9f7aa661c50fdc34e4943900f63b9e8f42bbec1bf94a19b6dfd76182633ca03c64aadecca7fc10bf7186cb930fea78b17a210ec',
118
+ update_time: '2024-11-29T09:01:01.356179',
119
+ width: 0,
120
+ },
121
+ ],
122
+ index: '0',
123
+ purpose_id: 'w9_form',
124
+ signed_url: 'https://storage.googleapis.com/duolingo3-dot-ai-b452e138-af1d-4da0-8eb5-eb6bd233cfcc/files/2024-11-29/file_a1c42d17-e638-485a-adbc-489522132157/file_a1c42d17-e638-485a-adbc-489522132157.pdf?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=zeni-apis-dev%40appspot.gserviceaccount.com%2F20241129%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20241129T090101Z&X-Goog-Expires=86400&X-Goog-SignedHeaders=host&X-Goog-Signature=2995e9bd18daec10482324370b012a724cf769960355f4fe48b358d8198c6256d25d47c9de6b8f9056a23d872a540c41b105979f8d9b5c3182d647c392e33f16b327983ccc3771a34e6b3923414db8f86b97f65b5ec970daa65d0686281194bd0e5bbcceb3daac4bcb14a571ee821b5886582c6b8920eb83955eee115c3ab073fd781bde9bc346c8f2d5be10dbc5ea09b5a666f3477772bbbeb2413f1374188ceb4862b2aba7ea2088df8a2d1f0830fdb0ee88fd028f8b3475403222d5fa81ebdc756f66e981369463b2b03fdc281aa5a8f5ff09a93cdb3c28651de630d41b3b42801510a601721a74ac5eecec9f4f8d5ecee2d842a7f209b199734233cc4232',
125
+ update_time: '2024-11-29T09:01:01.438348',
126
+ update_userid: 'u_f65e9b38-94fb-4a94-a2ab-27469df90bce',
127
+ user_id: 'u_f65e9b38-94fb-4a94-a2ab-27469df90bce',
128
+ };
129
+ exports.rootStateWithVendorFiling1099UploadDetails = Object.assign({}, reducer_1.initialRootState, {
130
+ vendorState: vendorMock_1.vendorStateWithVendors,
131
+ vendorFiling1099UploadDetailsState: exports.vendorFiling1099UploadDetailsSuccessState,
132
+ vendorTypeListState: {
133
+ vendorTypes: [],
134
+ },
135
+ addressViewState: {
136
+ newAddressState: {
137
+ vendor_address: {
138
+ addressToCreate: addressViewMocks_1.createAddressData,
139
+ addressType: 'vendor_address',
140
+ parentEntityId: undefined,
141
+ status: { fetchState: 'Not-Started', error: undefined },
142
+ newAddressId: undefined,
143
+ },
144
+ },
145
+ },
146
+ });
@@ -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,180 @@
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.w9FormUploadStatus = {
85
+ fetchState: 'Not-Started',
86
+ error: undefined,
87
+ };
88
+ },
89
+ prepare(vendorId) {
90
+ return {
91
+ payload: {
92
+ vendorId,
93
+ },
94
+ };
95
+ },
96
+ },
97
+ vendorFiling1099UploadDetailsSave: {
98
+ reducer(draft) {
99
+ draft.vendor1099DetailsSaveStatus = {
100
+ fetchState: 'In-Progress',
101
+ error: undefined,
102
+ };
103
+ },
104
+ prepare(vendorId) {
105
+ return {
106
+ payload: {
107
+ vendorId,
108
+ },
109
+ };
110
+ },
111
+ },
112
+ vendorFiling1099UploadDetailsSuccessOrFailure: {
113
+ reducer(draft, action) {
114
+ draft.vendor1099DetailsSaveStatus.fetchState =
115
+ action.payload.fetchState;
116
+ draft.vendor1099DetailsSaveStatus.error = action.payload.error;
117
+ },
118
+ prepare(fetchState, error) {
119
+ return {
120
+ payload: {
121
+ fetchState,
122
+ error,
123
+ },
124
+ };
125
+ },
126
+ },
127
+ initializeVendorFiling1099UploadDetailsLocalState: {
128
+ reducer(draft, action) {
129
+ var _a, _b, _c, _d, _e, _f;
130
+ const vendor = action.payload.vendor;
131
+ draft.vendor1099DetailsLocalData = {
132
+ vendorId: action.payload.vendorId,
133
+ legalName: vendor.name,
134
+ email: vendor.email,
135
+ w9Documents: (_a = vendor.filing1099W9Files) !== null && _a !== void 0 ? _a : [],
136
+ phone: vendor.phone,
137
+ taxClassification: (_b = vendor.filing1099TaxClassification) !== null && _b !== void 0 ? _b : '',
138
+ tin: {
139
+ type: (_d = (_c = vendor.filing1099Tin) === null || _c === void 0 ? void 0 : _c.type) !== null && _d !== void 0 ? _d : null,
140
+ value: (_f = (_e = vendor.filing1099Tin) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : '',
141
+ },
142
+ };
143
+ },
144
+ prepare(vendorId, vendor) {
145
+ return {
146
+ payload: {
147
+ vendorId,
148
+ vendor,
149
+ },
150
+ };
151
+ },
152
+ },
153
+ updateVendor1099DetailsLocalData(draft, action) {
154
+ draft.vendor1099DetailsLocalData = Object.assign(Object.assign({}, draft.vendor1099DetailsLocalData), action.payload);
155
+ },
156
+ updateW9FormOCRDataToLocalData(draft, action) {
157
+ var _a, _b, _c, _d, _e;
158
+ const tin = (_a = action.payload.ocrData) === null || _a === void 0 ? void 0 : _a.tin;
159
+ const vendorName = (_b = action.payload.ocrData) === null || _b === void 0 ? void 0 : _b.vendor_name;
160
+ const vendorType = (_c = action.payload.ocrData) === null || _c === void 0 ? void 0 : _c.vendor_type;
161
+ const tinType = (_d = tin === null || tin === void 0 ? void 0 : tin.type) !== null && _d !== void 0 ? _d : null;
162
+ const tinValue = (_e = tin === null || tin === void 0 ? void 0 : tin.value) !== null && _e !== void 0 ? _e : null;
163
+ // TODO: Add billing address to the local state
164
+ draft.vendor1099DetailsLocalData = Object.assign(Object.assign({}, draft.vendor1099DetailsLocalData), { tin: {
165
+ type: tinType,
166
+ value: tinValue,
167
+ }, legalName: vendorName !== null && vendorName !== void 0 ? vendorName : '', taxClassification: vendorType !== null && vendorType !== void 0 ? vendorType : '' });
168
+ draft.vendor1099DetailsAutoFilledValues = {
169
+ tin: {
170
+ type: tinType != null,
171
+ value: tinValue != null,
172
+ },
173
+ legalName: vendorName !== '',
174
+ taxClassification: vendorType !== '',
175
+ };
176
+ },
177
+ },
178
+ });
179
+ _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;
180
+ 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>;