@zeniai/client-epic-state 4.12.40 → 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.
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
@@ -54,6 +54,20 @@ exports.getAccountMappingView = (0, toolkit_1.createSelector)((state) => state.a
54
54
  accruedExpensesAccountList.push(account);
55
55
  }
56
56
  });
57
+ const bankAccounts1099FilingAccountList = [];
58
+ accountMappingState.bankAccounts1099FilingAccountIdList.forEach((accountId) => {
59
+ const account = (0, accountSelector_1.getAccountBase)(accountState, accountId, 'account_list_by_type');
60
+ if (account != null) {
61
+ bankAccounts1099FilingAccountList.push(account);
62
+ }
63
+ });
64
+ const glAccounts1099FilingAccountList = [];
65
+ accountMappingState.glAccounts1099FilingAccountIdList.forEach((accountId) => {
66
+ const account = (0, accountSelector_1.getAccountBase)(accountState, accountId, 'account_list_by_type');
67
+ if (account != null) {
68
+ glAccounts1099FilingAccountList.push(account);
69
+ }
70
+ });
57
71
  const fetchState = (0, reduceFetchState_1.reduceAllFetchState)([
58
72
  accountMappingState.accountListFetchState,
59
73
  accountMappingState.recommendationFetchState,
@@ -67,6 +81,8 @@ exports.getAccountMappingView = (0, toolkit_1.createSelector)((state) => state.a
67
81
  prepaidExpensesAccountList,
68
82
  fixedAssetsAccountList,
69
83
  accruedExpensesAccountList,
84
+ bankAccounts1099FilingAccountList,
85
+ glAccounts1099FilingAccountList,
70
86
  incomeRecommendation: accountMappingState.incomeRecommendations.length > 0
71
87
  ? accountMappingState.incomeRecommendations[0]
72
88
  : undefined,
@@ -90,6 +106,8 @@ exports.getAccountMappingView = (0, toolkit_1.createSelector)((state) => state.a
90
106
  prepaidExpensesAccountHierarchy: accountMappingState.prepaidExpensesNestedAccountListHierarchy,
91
107
  fixedAssetsAccountHierarchy: accountMappingState.fixedAssetsNestedAccountListHierarchy,
92
108
  accruedExpensesAccountHierarchy: accountMappingState.accruedExpensesNestedAccountListHierarchy,
109
+ bankAccounts1099FilingAccountHierarchy: accountMappingState.bankAccounts1099FilingNestedAccountListHierarchy,
110
+ glAccounts1099FilingAccountHierarchy: accountMappingState.glAccounts1099FilingNestedAccountListHierarchy,
93
111
  fetchState: fetchState.fetchState,
94
112
  saveState,
95
113
  };
@@ -11,12 +11,13 @@ const snackbarReducer_1 = require("../../entity/snackbar/snackbarReducer");
11
11
  const saveAccountMappingViewEpic = (actions$, state, zeniAPI) => actions$.pipe((0, operators_1.filter)(accountMappingReducer_1.saveAccountMapping.match), (0, operators_1.mergeMap)(() => {
12
12
  const accountMappingState = state.value.accountMappingState;
13
13
  const payload = (0, accountMappingPayload_1.toSaveAccountMappingPayload)(accountMappingState.data);
14
+ const payloadFiling1099 = (0, accountMappingPayload_1.toSaveFiling1099Payload)(accountMappingState.data);
14
15
  if (payload.length === 0) {
15
16
  return (0, rxjs_1.from)([]);
16
17
  }
17
18
  else {
18
19
  return zeniAPI
19
- .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accounts`, { accounts: payload })
20
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accounts`, { accounts: payload, gl_accounts: payloadFiling1099 })
20
21
  .pipe((0, operators_1.mergeMap)((response) => {
21
22
  if ((0, responsePayload_1.isSuccessStatus)(response)) {
22
23
  const actionsSuccess = [
@@ -9,7 +9,7 @@ export declare const getCardBalance: (state: RootState) => {
9
9
  accountsInOrder: {
10
10
  accountId: string;
11
11
  accountName: string;
12
- accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | undefined;
12
+ accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts" | undefined;
13
13
  accountSubType: string | undefined;
14
14
  accountDescription: string;
15
15
  last4Digits: string | undefined;
@@ -21,7 +21,7 @@ export declare const getCardBalance: (state: RootState) => {
21
21
  coaId: string | undefined;
22
22
  classesViewParentId: import("../../commonStateTypes/classesView/nestedClassID").ClassesViewParentID | undefined;
23
23
  accountsViewParentId: import("../../commonStateTypes/accountView/nestedAccountID").AccountsViewParentID | undefined;
24
- labels: ("prepaid_expenses" | "fixed_assets" | "uncategorized_income" | "uncategorized_expense" | "bank_charges_and_fees" | "travel_transportation" | "accrued_expenses")[];
24
+ labels: ("prepaid_expenses" | "fixed_assets" | "accounts_1099" | "gl_accounts" | "uncategorized_income" | "uncategorized_expense" | "bank_charges_and_fees" | "travel_transportation" | "accrued_expenses")[];
25
25
  }[];
26
26
  balance: import("../..").Balance | undefined;
27
27
  firstMonthOfFY: 2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
@@ -9,7 +9,7 @@ export declare const getCashBalance: (state: RootState) => {
9
9
  accountsInOrder: {
10
10
  accountId: string;
11
11
  accountName: string;
12
- accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | undefined;
12
+ accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts" | undefined;
13
13
  accountSubType: string | undefined;
14
14
  accountDescription: string;
15
15
  last4Digits: string | undefined;
@@ -21,7 +21,7 @@ export declare const getCashBalance: (state: RootState) => {
21
21
  coaId: string | undefined;
22
22
  classesViewParentId: import("../../commonStateTypes/classesView/nestedClassID").ClassesViewParentID | undefined;
23
23
  accountsViewParentId: import("../../commonStateTypes/accountView/nestedAccountID").AccountsViewParentID | undefined;
24
- labels: ("prepaid_expenses" | "fixed_assets" | "uncategorized_income" | "uncategorized_expense" | "bank_charges_and_fees" | "travel_transportation" | "accrued_expenses")[];
24
+ labels: ("prepaid_expenses" | "fixed_assets" | "accounts_1099" | "gl_accounts" | "uncategorized_income" | "uncategorized_expense" | "bank_charges_and_fees" | "travel_transportation" | "accrued_expenses")[];
25
25
  }[];
26
26
  balance: import("../..").Balance | undefined;
27
27
  firstMonthOfFY: 2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
@@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isNotificationsTabVisible = exports.isMonthEndNotificationsSectionVisibleOnSettingsPage = exports.isRemindersSectionVisibleOnSettingsPage = exports.isMyBankConnectionsTabVisible = exports.isSettingsVisible = exports.isIntegrationsTabVisible = exports.isCompanyDetailsTabVisible = exports.isBusinessVerificationTabVisible = exports.isBankConnectionsTabVisible = exports.isApprovalRulesTabVisible = exports.isAccountingTabVisible = void 0;
4
4
  const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
5
5
  const userRoleType_1 = require("../../entity/userRole/userRoleType");
6
+ const vendorListSelector_1 = require("../vendorList/vendorListSelector");
6
7
  const isAccountingTabVisible = (userRole, currentTenant, userRoleMap) => {
7
8
  if (currentTenant == null) {
8
9
  return false;
9
10
  }
10
11
  if ((0, exports.isSettingsVisible)(currentTenant)) {
11
- return (((0, userRoleType_1.hasBillPayAccessible)(currentTenant, userRoleMap) ||
12
+ return (((0, vendorListSelector_1.isVendorsTabVisible)(userRoleMap) ||
13
+ (0, userRoleType_1.hasBillPayAccessible)(currentTenant, userRoleMap) ||
12
14
  (0, userRoleType_1.hasReimbursementAccessible)(currentTenant, userRoleMap) ||
13
15
  (0, userRoleType_1.hasFullOrAdminLevelAccess)(userRole)) &&
14
16
  (0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false &&
@@ -22,7 +22,7 @@ export declare const getTopExpenses: (accountState: AccountState, topExState: To
22
22
  accountsOrdered: {
23
23
  accountId: string;
24
24
  accountName: string;
25
- accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | undefined;
25
+ accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts" | undefined;
26
26
  accountSubType: string | undefined;
27
27
  accountDescription: string;
28
28
  logo: import("url-parse")<string> | import("url-parse")<Record<string, string | undefined>> | undefined;
@@ -9,23 +9,23 @@ import { ZeniAPIStatus } from '../../responsePayload';
9
9
  import { TransactionListByAccountPayload, TransactionListByClassPayload, TransactionListByEntityPayload } from './transactionListPayload';
10
10
  import { TransactionListState, TransactionListUIState, TransactionCategoryType } from './transactionListState';
11
11
  export declare const initialState: TransactionListState;
12
- export declare const parallelFetchAccountTransactionList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets", period: TimePeriod, accountName?: string | undefined, cacheOverride?: any, includeSubAccountTransactions?: any], {
12
+ export declare const parallelFetchAccountTransactionList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts", period: TimePeriod, accountName?: string | undefined, cacheOverride?: any, includeSubAccountTransactions?: any], {
13
13
  accountId: string;
14
- accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets";
14
+ accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts";
15
15
  period: TimePeriod;
16
16
  accountName: string | undefined;
17
17
  cacheOverride: any;
18
18
  includeSubAccountTransactions: any;
19
- }, string, never, never>, fetchAccountTransactionList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets", period: TimePeriod, includeSubAccountTransactions: boolean, accountName?: string | undefined, cacheOverride?: any], {
19
+ }, string, never, never>, fetchAccountTransactionList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts", period: TimePeriod, includeSubAccountTransactions: boolean, accountName?: string | undefined, cacheOverride?: any], {
20
20
  accountId: string;
21
- accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets";
21
+ accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts";
22
22
  period: TimePeriod;
23
23
  accountName: string | undefined;
24
24
  includeSubAccountTransactions: boolean;
25
25
  cacheOverride: any;
26
- }, string, never, never>, updateTransactionListByAccount: import("@reduxjs/toolkit").ActionCreatorWithPayload<TransactionListByAccountPayload, string>, updateTransactionListByAccountFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets", period: TimePeriod, error: ZeniAPIStatus<Record<string, unknown>>], {
26
+ }, string, never, never>, updateTransactionListByAccount: import("@reduxjs/toolkit").ActionCreatorWithPayload<TransactionListByAccountPayload, string>, updateTransactionListByAccountFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts", period: TimePeriod, error: ZeniAPIStatus<Record<string, unknown>>], {
27
27
  accountId: string;
28
- accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets";
28
+ accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts";
29
29
  period: TimePeriod;
30
30
  error: ZeniAPIStatus<Record<string, unknown>>;
31
31
  }, string, never, never>, parallelFetchEntityTransactionList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entity: Entity, period: TimePeriod, cacheOverride?: any], {
@@ -45,15 +45,15 @@ export declare const parallelFetchAccountTransactionList: import("@reduxjs/toolk
45
45
  accountId: ID;
46
46
  accountType: AccountType;
47
47
  uiState: TransactionListUIState;
48
- }, string>, parallelFetchClassTransactionList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets", classId: string, period: TimePeriod, cacheOverride?: any], {
48
+ }, string>, parallelFetchClassTransactionList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts", classId: string, period: TimePeriod, cacheOverride?: any], {
49
49
  accountId: string;
50
- accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets";
50
+ accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts";
51
51
  classId: string;
52
52
  period: TimePeriod;
53
53
  cacheOverride: any;
54
- }, string, never, never>, fetchClassTransactionList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets", classId: string, period: TimePeriod, cacheOverride?: any], {
54
+ }, string, never, never>, fetchClassTransactionList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts", classId: string, period: TimePeriod, cacheOverride?: any], {
55
55
  accountId: string;
56
- accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets";
56
+ accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts";
57
57
  classId: string;
58
58
  period: TimePeriod;
59
59
  cacheOverride: any;
@@ -62,9 +62,9 @@ export declare const parallelFetchAccountTransactionList: import("@reduxjs/toolk
62
62
  accountType: AccountType;
63
63
  classId: ID;
64
64
  uiState: TransactionListUIState;
65
- }, string>, updateTransactionListByClassFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets", classId: string, period: TimePeriod, error: ZeniAPIStatus<Record<string, unknown>>], {
65
+ }, string>, updateTransactionListByClassFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts", classId: string, period: TimePeriod, error: ZeniAPIStatus<Record<string, unknown>>], {
66
66
  accountId: string;
67
- accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets";
67
+ accountType: "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets" | "accounts_1099" | "gl_accounts";
68
68
  classId: string;
69
69
  period: TimePeriod;
70
70
  error: ZeniAPIStatus<Record<string, unknown>>;
@@ -0,0 +1,90 @@
1
+ {
2
+ "data": {
3
+ "filter": null,
4
+ "query": {
5
+ "end_date": "2024-12-31",
6
+ "group_by": "vendor",
7
+ "sort_order": "desc",
8
+ "source_account_type": "bank",
9
+ "start_date": "2024-01-01"
10
+ },
11
+ "query_definitions": {},
12
+ "report": {
13
+ "currency": {
14
+ "currency_code": null,
15
+ "currency_symbol": null
16
+ },
17
+ "is_vendor_1099_populated": true,
18
+ "report_id": "vendor_1099",
19
+ "report_title": "Vendor 1099",
20
+ "status": {
21
+ "code": 200,
22
+ "description": "All accounts refreshed successfully",
23
+ "is_filtered_report": false,
24
+ "last_refresh_attempt_time": "2024-09-26T13:14:02.150830",
25
+ "last_refresh_success_time": "2024-09-26T13:14:02.150818",
26
+ "message": "success"
27
+ },
28
+ "vendors": [
29
+ {
30
+ "vendor_id": "vendor_j12jh1g2g12jg3jh12:12",
31
+ "qbo_id": "12",
32
+ "vendor_name": "Sample Vendor 1",
33
+ "title": "",
34
+ "suffix": "",
35
+ "first_name": "Sample",
36
+ "middle_name": "",
37
+ "last_name": "Vendor",
38
+ "vendor_type": "Individual",
39
+ "logo": {
40
+ "url": "",
41
+ "base64": ""
42
+ },
43
+ "owner": null,
44
+ "balance": 0,
45
+ "is_deleted": false,
46
+ "qbo_create_time": "2022-01-24T05:59:37.057383",
47
+ "qbo_update_time": "2022-01-24T05:59:37.057383",
48
+ "create_time": "2022-01-24T05:59:37.057383",
49
+ "update_time": "2022-01-24T05:59:37.057383",
50
+ "email": "",
51
+ "phone": "",
52
+ "website_url": "",
53
+ "currency_code": "",
54
+ "currency_symbol": "",
55
+ "country_code": "US",
56
+ "billing_address_id": "a_e3e99a8b-d400-42ac-ae09-e655bff1af97",
57
+ "billing_address": {
58
+ "address_id": "a_e3e99a8b-d400-42ac-ae09-e655bff1af97",
59
+ "city": "Bangalore",
60
+ "country": "India",
61
+ "country_code": null,
62
+ "create_time": "2022-02-01T15:47:44.681429",
63
+ "hash_value": "2be1de50bedd7a2dfb8094846698b2b8bc86869bf903c27b69b74ae3e2651983",
64
+ "latitude": null,
65
+ "longitude": null,
66
+ "postal_code": "560001",
67
+ "state": "Karnataka",
68
+ "street": ["2nd lane", "Opp Peter England showroom", "Mg Road"],
69
+ "update_time": "2022-02-01T15:47:44.681439"
70
+ },
71
+ "documents": [],
72
+ "vendor_currency_code": "USD",
73
+ "vendor_currency_symbol": "$",
74
+ "tin": {
75
+ "type": "ein",
76
+ "value": "550258131"
77
+ },
78
+ "vendor_1099_status": "incomplete",
79
+ "vendor_1099_ytd_total": -2287.0,
80
+ "w9_document": []
81
+ }
82
+ ],
83
+ "version": "2.0"
84
+ }
85
+ },
86
+ "status": {
87
+ "code": 200,
88
+ "message": "Successful"
89
+ }
90
+ }
@@ -0,0 +1,11 @@
1
+ import { VendorFiling1099ListResponse } from '../vendorFiling1099ListPayload';
2
+ import { VendorFiling1099ListState } from '../vendorFiling1099ListState';
3
+ import { RootState } from '../../../reducer';
4
+ export { vendorFiling1099ListSelectorMock } from './vendorFiling1099ListSelectorMock';
5
+ export declare const vendorFiling1099ListSuccessResponse: VendorFiling1099ListResponse;
6
+ export declare const vendorFiling1099ListFailureResponse: VendorFiling1099ListResponse;
7
+ export declare const vendorFiling1099ListInProgressState: VendorFiling1099ListState;
8
+ export declare const vendorFiling1099ListInProgressInitialState: VendorFiling1099ListState;
9
+ export declare const vendorFiling1099ListSuccessState: VendorFiling1099ListState;
10
+ export declare const vendorFiling1099ListFailureState: VendorFiling1099ListState;
11
+ export declare const rootStateWithVendorList: RootState;
@@ -0,0 +1,101 @@
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.rootStateWithVendorList = exports.vendorFiling1099ListFailureState = exports.vendorFiling1099ListSuccessState = exports.vendorFiling1099ListInProgressInitialState = exports.vendorFiling1099ListInProgressState = exports.vendorFiling1099ListFailureResponse = exports.vendorFiling1099ListSuccessResponse = exports.vendorFiling1099ListSelectorMock = void 0;
7
+ const vendorFiling1099ListSuccess_json_1 = __importDefault(require("./json/vendorFiling1099ListSuccess.json"));
8
+ const apiFailure_json_1 = __importDefault(require("../../../__testHelpers__/apiFailure.json"));
9
+ const vendorFiling1099ListReducer_1 = require("../vendorFiling1099ListReducer");
10
+ const vendorStateMocks_1 = require("../../../entity/vendor/__mocks__/vendorStateMocks");
11
+ const reducer_1 = require("../../../reducer");
12
+ const zeniDayJS_1 = require("../../../zeniDayJS");
13
+ var vendorFiling1099ListSelectorMock_1 = require("./vendorFiling1099ListSelectorMock");
14
+ Object.defineProperty(exports, "vendorFiling1099ListSelectorMock", { enumerable: true, get: function () { return vendorFiling1099ListSelectorMock_1.vendorFiling1099ListSelectorMock; } });
15
+ exports.vendorFiling1099ListSuccessResponse = vendorFiling1099ListSuccess_json_1.default;
16
+ exports.vendorFiling1099ListFailureResponse = apiFailure_json_1.default;
17
+ exports.vendorFiling1099ListInProgressState = {
18
+ vendorIds: [],
19
+ uiState: {
20
+ sortKey: 'total',
21
+ sortOrder: 'descending',
22
+ scrollYOffset: 0,
23
+ downloadState: 'Not-Started',
24
+ searchString: '',
25
+ },
26
+ fetchState: 'In-Progress',
27
+ error: undefined,
28
+ hasValidState: vendorFiling1099ListReducer_1.initialState.hasValidState,
29
+ lastRefreshSuccessTime: undefined,
30
+ isVendor1099Populated: true,
31
+ };
32
+ exports.vendorFiling1099ListInProgressInitialState = {
33
+ vendorIds: [],
34
+ uiState: {
35
+ sortKey: 'total',
36
+ sortOrder: 'descending',
37
+ scrollYOffset: 0,
38
+ downloadState: 'Not-Started',
39
+ searchString: '',
40
+ },
41
+ fetchState: 'In-Progress',
42
+ error: undefined,
43
+ hasValidState: vendorFiling1099ListReducer_1.initialState.hasValidState,
44
+ lastRefreshSuccessTime: undefined,
45
+ isVendor1099Populated: false,
46
+ };
47
+ exports.vendorFiling1099ListSuccessState = {
48
+ vendorIds: ['vendor_j12jh1g2g12jg3jh12:12'],
49
+ uiState: {
50
+ sortKey: 'total',
51
+ sortOrder: 'descending',
52
+ scrollYOffset: 0,
53
+ downloadState: 'Not-Started',
54
+ searchString: '',
55
+ },
56
+ fetchState: 'Completed',
57
+ error: undefined,
58
+ hasValidState: vendorFiling1099ListReducer_1.initialState.hasValidState,
59
+ lastRefreshSuccessTime: (0, zeniDayJS_1.date)('2024-09-26T07:44:02.150Z'),
60
+ isVendor1099Populated: true,
61
+ };
62
+ exports.vendorFiling1099ListFailureState = {
63
+ vendorIds: [],
64
+ uiState: {
65
+ sortKey: 'total',
66
+ sortOrder: 'descending',
67
+ scrollYOffset: 0,
68
+ downloadState: 'Not-Started',
69
+ searchString: '',
70
+ },
71
+ lastRefreshSuccessTime: undefined,
72
+ fetchState: 'Error',
73
+ error: {
74
+ code: 500,
75
+ message: 'Internal server error',
76
+ },
77
+ hasValidState: vendorFiling1099ListReducer_1.initialState.hasValidState,
78
+ isVendor1099Populated: false,
79
+ };
80
+ exports.rootStateWithVendorList = Object.assign({}, reducer_1.initialRootState, {
81
+ vendorState: {
82
+ vendorByID: {
83
+ 'vendor_j12jh1g2g12jg3jh12:12': vendorStateMocks_1.vendorStateMock1,
84
+ },
85
+ },
86
+ vendorFiling1099ListState: {
87
+ vendorIds: ['vendor_j12jh1g2g12jg3jh12:12'],
88
+ fetchState: 'Completed',
89
+ error: undefined,
90
+ uiState: {
91
+ sortKey: 'total',
92
+ sortOrder: 'descending',
93
+ scrollYOffset: 0,
94
+ downloadState: 'Not-Started',
95
+ searchString: '',
96
+ },
97
+ lastRefreshSuccessTime: undefined,
98
+ hasValidState: vendorFiling1099ListReducer_1.initialState.hasValidState,
99
+ isVendor1099Populated: true,
100
+ },
101
+ });
@@ -0,0 +1,2 @@
1
+ import { VendorFiling1099ListSelectorView } from '../vendorFiling1099ListSelector';
2
+ export declare const vendorFiling1099ListSelectorMock: VendorFiling1099ListSelectorView;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.vendorFiling1099ListSelectorMock = void 0;
4
+ const vendorStateMocks_1 = require("../../../entity/vendor/__mocks__/vendorStateMocks");
5
+ exports.vendorFiling1099ListSelectorMock = {
6
+ fetchState: 'Completed',
7
+ error: undefined,
8
+ version: 0,
9
+ vendors: [
10
+ Object.assign({}, vendorStateMocks_1.vendorStateMock1),
11
+ ],
12
+ lastRefreshSuccessTime: undefined,
13
+ uiState: {
14
+ sortKey: 'total',
15
+ sortOrder: 'descending',
16
+ scrollYOffset: 0,
17
+ downloadState: 'Not-Started',
18
+ searchString: '',
19
+ },
20
+ isVendor1099Populated: true,
21
+ };
@@ -0,0 +1,9 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { ZeniAPI } from '../../zeniAPI';
4
+ import { RootState } from '../../reducer';
5
+ import { updateVendorsFiling1099List, updateVendorFiling1099ListFailure, fetchVendorsFiling1099List } from './vendorFiling1099ListReducer';
6
+ import { updateVendors } from '../../entity/vendor/vendorReducer';
7
+ import { updateAddresses } from '../../entity/address/addressReducer';
8
+ export declare type ActionType = ReturnType<typeof fetchVendorsFiling1099List> | ReturnType<typeof updateVendorFiling1099ListFailure> | ReturnType<typeof updateVendors> | ReturnType<typeof updateVendorsFiling1099List> | ReturnType<typeof updateAddresses>;
9
+ export declare const fetchVendorsFiling1099ListEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchVendorsFiling1099ListEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../responsePayload");
7
+ const vendorFiling1099ListReducer_1 = require("./vendorFiling1099ListReducer");
8
+ const vendorReducer_1 = require("../../entity/vendor/vendorReducer");
9
+ const addressReducer_1 = require("../../entity/address/addressReducer");
10
+ const commonVendorViewHelper_1 = require("../commonVendorView/commonVendorViewHelper");
11
+ const fetchVendorsFiling1099ListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(vendorFiling1099ListReducer_1.fetchVendorsFiling1099List.match), (0, operators_1.switchMap)(() => {
12
+ const apiUrl = `${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/2.0/reports/vendor_1099`;
13
+ return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.switchMap)((response) => {
14
+ var _a;
15
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
16
+ const actions = [];
17
+ actions.push(...updateAllVendorRelatedEntities((_a = response.data) === null || _a === void 0 ? void 0 : _a.report.vendors), (0, vendorFiling1099ListReducer_1.updateVendorsFiling1099List)({
18
+ response,
19
+ }));
20
+ return actions;
21
+ }
22
+ else {
23
+ return (0, rxjs_1.of)((0, vendorFiling1099ListReducer_1.updateVendorFiling1099ListFailure)({
24
+ status: response.status,
25
+ }));
26
+ }
27
+ }), (0, operators_1.catchError)((error) => {
28
+ return (0, rxjs_1.of)((0, vendorFiling1099ListReducer_1.updateVendorFiling1099ListFailure)({
29
+ status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch vendors 1099 list REST API call errored out' +
30
+ JSON.stringify(error)),
31
+ }));
32
+ }));
33
+ }));
34
+ exports.fetchVendorsFiling1099ListEpic = fetchVendorsFiling1099ListEpic;
35
+ function updateAllVendorRelatedEntities(vendorPayload) {
36
+ const vendorRelatedEntitiesActions = [];
37
+ const flattenedAddresses = (0, commonVendorViewHelper_1.getFlattenedAddress)(vendorPayload);
38
+ vendorRelatedEntitiesActions.push((0, vendorReducer_1.updateVendors)(vendorPayload, 'merge'), (0, addressReducer_1.updateAddresses)(flattenedAddresses));
39
+ return vendorRelatedEntitiesActions;
40
+ }
@@ -0,0 +1,13 @@
1
+ import { ReportPayload } from '../../commonPayloadTypes/viewAndReportPayload';
2
+ import { VendorPayload } from '../../entity/vendor/vendorPayload';
3
+ import { ZeniAPIResponse } from '../../responsePayload';
4
+ export interface FetchVendorFiling1099Payload {
5
+ report: ReportVendorFiling1099Payload;
6
+ query: Record<string, unknown>;
7
+ query_definitions: Record<string, unknown>;
8
+ }
9
+ export interface ReportVendorFiling1099Payload extends ReportPayload {
10
+ vendors: VendorPayload[];
11
+ is_vendor_1099_populated: boolean;
12
+ }
13
+ export declare type VendorFiling1099ListResponse = ZeniAPIResponse<FetchVendorFiling1099Payload>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ import { SortOrder } from '../../commonStateTypes/selectorTypes/sortOrderTypes';
2
+ import { ZeniAPIStatus } from '../../responsePayload';
3
+ import { VendorFiling1099ListResponse } from './vendorFiling1099ListPayload';
4
+ import { VendorFiling1099ListState, VendorFiling1099ListViewSortKey } from './vendorFiling1099ListState';
5
+ export declare const initialState: VendorFiling1099ListState;
6
+ export declare const fetchVendorsFiling1099List: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[], {
7
+ view: undefined;
8
+ }, string, never, never>, updateVendorsFiling1099List: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
9
+ response: VendorFiling1099ListResponse;
10
+ }, string>, updateVendorFiling1099ListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
11
+ status: ZeniAPIStatus;
12
+ }, string>, clearVendorsFiling1099List: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateFiling1099ScrollYOffset: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
13
+ scrollYOffset: number;
14
+ }, string>, updateFiling1099SortUiState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
15
+ sortOrder: SortOrder;
16
+ sortKey: VendorFiling1099ListViewSortKey;
17
+ }, string>;
18
+ declare const _default: import("@reduxjs/toolkit").Reducer<VendorFiling1099ListState, import("@reduxjs/toolkit").AnyAction>;
19
+ export default _default;
@@ -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[];