@zeniai/client-epic-state 4.12.65 → 4.12.66

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 +180 -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,7 +1,7 @@
1
1
  import { FetchState, ID } from '../../../commonStateTypes/common';
2
2
  import { Entity } from '../../../entity/genericEntity/entity';
3
3
  import { ZeniAPIStatus } from '../../../responsePayload';
4
- import { VendorsTabVendorDetailLocalData, VendorsTabVendorViewState } from './vendorsTabVendorViewState';
4
+ import { CollapsableStatusKey, VendorsTabVendorDetailLocalData, VendorsTabVendorViewState } from './vendorsTabVendorViewState';
5
5
  import { TimePeriod } from '../../../commonStateTypes/timePeriod';
6
6
  export declare const initialVendorDetailLocalData: VendorsTabVendorDetailLocalData;
7
7
  export declare const initialState: VendorsTabVendorViewState;
@@ -38,6 +38,11 @@ export declare const fetchVendorsTabVendorDetails: import("@reduxjs/toolkit").Ac
38
38
  numberOfQuartersFetched: number;
39
39
  }, string>, resetSelectedTabType: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateSelectedTabType: import("@reduxjs/toolkit").ActionCreatorWithPayload<"spend_transactions" | "all_transactions", string>, updateVendorSpendTrendFilterTabValue: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorSpendTrendfilterTabValue: "last_month" | "last_30_days" | "last_90_days" | "YTD_spend" | "last_3_months" | "last_6_months" | "last_12_months" | "last_year"], {
40
40
  vendorSpendTrendfilterTabValue: "last_month" | "last_30_days" | "last_90_days" | "YTD_spend" | "last_3_months" | "last_6_months" | "last_12_months" | "last_year";
41
- }, string, never, never>, resetVendorsTabVendorAllTransactionsTabData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, clearVendorsTabVendorView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
41
+ }, string, never, never>, resetVendorsTabVendorAllTransactionsTabData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateContactsInVendorTabDetailLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
42
+ vendorId: ID;
43
+ localData?: Partial<VendorsTabVendorDetailLocalData> | undefined;
44
+ }, string>, updateVendorTabDetailUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
45
+ collapsableStatus: CollapsableStatusKey;
46
+ }, string>, clearVendorsTabVendorView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
42
47
  declare const _default: import("@reduxjs/toolkit").Reducer<VendorsTabVendorViewState, import("@reduxjs/toolkit").AnyAction>;
43
48
  export default _default;
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearVendorsTabVendorView = exports.resetVendorsTabVendorAllTransactionsTabData = exports.updateVendorSpendTrendFilterTabValue = exports.updateSelectedTabType = exports.resetSelectedTabType = exports.updateVendorsTabVendorAllTransactionsTabData = exports.fetchVendorsTabVendorDetailPageView = exports.vendorsTabResetVendorDetailLocalData = exports.vendorsTabUpdateVendorDetailLocalData = exports.vendorsTabSaveVendorSuccessOrFailure = exports.vendorsTabSaveVendor = exports.updateVendorsTabVendorSaveStatus = exports.updateVendorsTabVendorFetchStatus = exports.fetchVendorsTabVendor = exports.fetchVendorsTabVendorDetails = exports.initialState = exports.initialVendorDetailLocalData = void 0;
4
+ exports.clearVendorsTabVendorView = exports.updateVendorTabDetailUIState = exports.updateContactsInVendorTabDetailLocalData = exports.resetVendorsTabVendorAllTransactionsTabData = exports.updateVendorSpendTrendFilterTabValue = exports.updateSelectedTabType = exports.resetSelectedTabType = exports.updateVendorsTabVendorAllTransactionsTabData = exports.fetchVendorsTabVendorDetailPageView = exports.vendorsTabResetVendorDetailLocalData = exports.vendorsTabUpdateVendorDetailLocalData = exports.vendorsTabSaveVendorSuccessOrFailure = exports.vendorsTabSaveVendor = exports.updateVendorsTabVendorSaveStatus = exports.updateVendorsTabVendorFetchStatus = exports.fetchVendorsTabVendor = exports.fetchVendorsTabVendorDetails = exports.initialState = exports.initialVendorDetailLocalData = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  exports.initialVendorDetailLocalData = {
7
+ contacts: [],
7
8
  vendorId: undefined,
8
9
  isCategoryUpdateSelected: false,
9
10
  isClassUpdateSelected: false,
@@ -14,6 +15,9 @@ exports.initialState = {
14
15
  vendorStateById: {},
15
16
  selectedTabType: 'spend_transactions',
16
17
  vendorSpendTrendFilterTabValue: 'YTD_spend',
18
+ uiState: {
19
+ collapsableStatus: 'expand',
20
+ },
17
21
  };
18
22
  const vendorsTabVendorView = (0, toolkit_1.createSlice)({
19
23
  name: 'vendorsTabVendorView',
@@ -115,12 +119,14 @@ const vendorsTabVendorView = (0, toolkit_1.createSlice)({
115
119
  },
116
120
  },
117
121
  vendorsTabUpdateVendorDetailLocalData(draft, action) {
122
+ var _a;
118
123
  const { vendorId, localData } = action.payload;
119
124
  if (localData == null) {
120
125
  delete draft.vendorStateById[vendorId].vendorDetailLocalData;
121
126
  }
122
127
  else if (draft.vendorStateById[vendorId] != null) {
123
- draft.vendorStateById[vendorId].vendorDetailLocalData = Object.assign(Object.assign({}, exports.initialVendorDetailLocalData), localData);
128
+ const contacts = (_a = localData.contacts) !== null && _a !== void 0 ? _a : [];
129
+ draft.vendorStateById[vendorId].vendorDetailLocalData = Object.assign(Object.assign(Object.assign({}, exports.initialVendorDetailLocalData), localData), { contacts: contacts.map((contact) => (Object.assign({}, contact))) });
124
130
  }
125
131
  },
126
132
  vendorsTabResetVendorDetailLocalData: {
@@ -185,10 +191,24 @@ const vendorsTabVendorView = (0, toolkit_1.createSlice)({
185
191
  resetSelectedTabType(draft) {
186
192
  draft.selectedTabType = 'spend_transactions';
187
193
  },
194
+ updateContactsInVendorTabDetailLocalData(draft, action) {
195
+ var _a;
196
+ const { vendorId, localData } = action.payload;
197
+ if (localData === null || localData === void 0 ? void 0 : localData.contacts) {
198
+ const contacts = localData.contacts;
199
+ if (vendorId != null) {
200
+ draft.vendorStateById[vendorId] = Object.assign(Object.assign({}, draft.vendorStateById[vendorId]), { vendorDetailLocalData: Object.assign(Object.assign(Object.assign({}, exports.initialVendorDetailLocalData), (_a = draft.vendorStateById[vendorId]) === null || _a === void 0 ? void 0 : _a.vendorDetailLocalData), { contacts: contacts.map((contact) => (Object.assign({}, contact))) }) });
201
+ }
202
+ }
203
+ },
204
+ updateVendorTabDetailUIState(draft, action) {
205
+ const { collapsableStatus } = action.payload;
206
+ draft.uiState.collapsableStatus = collapsableStatus;
207
+ },
188
208
  clearVendorsTabVendorView(draft) {
189
209
  Object.assign(draft, exports.initialState);
190
210
  },
191
211
  },
192
212
  });
193
- _a = vendorsTabVendorView.actions, exports.fetchVendorsTabVendorDetails = _a.fetchVendorsTabVendorDetails, exports.fetchVendorsTabVendor = _a.fetchVendorsTabVendor, exports.updateVendorsTabVendorFetchStatus = _a.updateVendorsTabVendorFetchStatus, exports.updateVendorsTabVendorSaveStatus = _a.updateVendorsTabVendorSaveStatus, exports.vendorsTabSaveVendor = _a.vendorsTabSaveVendor, exports.vendorsTabSaveVendorSuccessOrFailure = _a.vendorsTabSaveVendorSuccessOrFailure, exports.vendorsTabUpdateVendorDetailLocalData = _a.vendorsTabUpdateVendorDetailLocalData, exports.vendorsTabResetVendorDetailLocalData = _a.vendorsTabResetVendorDetailLocalData, exports.fetchVendorsTabVendorDetailPageView = _a.fetchVendorsTabVendorDetailPageView, exports.updateVendorsTabVendorAllTransactionsTabData = _a.updateVendorsTabVendorAllTransactionsTabData, exports.resetSelectedTabType = _a.resetSelectedTabType, exports.updateSelectedTabType = _a.updateSelectedTabType, exports.updateVendorSpendTrendFilterTabValue = _a.updateVendorSpendTrendFilterTabValue, exports.resetVendorsTabVendorAllTransactionsTabData = _a.resetVendorsTabVendorAllTransactionsTabData, exports.clearVendorsTabVendorView = _a.clearVendorsTabVendorView;
213
+ _a = vendorsTabVendorView.actions, exports.fetchVendorsTabVendorDetails = _a.fetchVendorsTabVendorDetails, exports.fetchVendorsTabVendor = _a.fetchVendorsTabVendor, exports.updateVendorsTabVendorFetchStatus = _a.updateVendorsTabVendorFetchStatus, exports.updateVendorsTabVendorSaveStatus = _a.updateVendorsTabVendorSaveStatus, exports.vendorsTabSaveVendor = _a.vendorsTabSaveVendor, exports.vendorsTabSaveVendorSuccessOrFailure = _a.vendorsTabSaveVendorSuccessOrFailure, exports.vendorsTabUpdateVendorDetailLocalData = _a.vendorsTabUpdateVendorDetailLocalData, exports.vendorsTabResetVendorDetailLocalData = _a.vendorsTabResetVendorDetailLocalData, exports.fetchVendorsTabVendorDetailPageView = _a.fetchVendorsTabVendorDetailPageView, exports.updateVendorsTabVendorAllTransactionsTabData = _a.updateVendorsTabVendorAllTransactionsTabData, exports.resetSelectedTabType = _a.resetSelectedTabType, exports.updateSelectedTabType = _a.updateSelectedTabType, exports.updateVendorSpendTrendFilterTabValue = _a.updateVendorSpendTrendFilterTabValue, exports.resetVendorsTabVendorAllTransactionsTabData = _a.resetVendorsTabVendorAllTransactionsTabData, exports.updateContactsInVendorTabDetailLocalData = _a.updateContactsInVendorTabDetailLocalData, exports.updateVendorTabDetailUIState = _a.updateVendorTabDetailUIState, exports.clearVendorsTabVendorView = _a.clearVendorsTabVendorView;
194
214
  exports.default = vendorsTabVendorView.reducer;
@@ -1,7 +1,7 @@
1
1
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
2
2
  import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
3
3
  import { RootState } from '../../../reducer';
4
- import { VendorsTabVendorDetailLocalData } from './vendorsTabVendorViewState';
4
+ import { VendorsTabVendorDetailLocalData, VendorsTabVendorViewUIState } from './vendorsTabVendorViewState';
5
5
  import { AccountListSelectorView } from '../../accountList/accountListSelector';
6
6
  import { ClassListSelectorView } from '../../classList/classListSelector';
7
7
  import { AccountBase } from '../../../entity/account/accountState';
@@ -17,23 +17,37 @@ import { TransactionListByEntityView } from '../../transactionList/transactionLi
17
17
  import { TimePeriod } from '../../../commonStateTypes/timePeriod';
18
18
  import { Month } from '../../../commonStateTypes/timePeriod';
19
19
  import { TimeframeTick } from '../../../commonStateTypes/timeframeTick';
20
+ import { Address } from '../../../entity/address/addressState';
21
+ import { Contact } from '../../../entity/billPay/contact/contact';
22
+ import { VendorType } from '../../vendorTypeList/vendorTypeListPayload';
23
+ import { Filing1099TinType } from '../../../entity/vendor/vendorType';
24
+ import { NewAddressData } from '../../addressView/addressViewState';
20
25
  export declare const toVendorDetailTabsType: (v: string) => "spend_transactions" | "all_transactions";
21
26
  export declare type VendorDetailTabsType = ReturnType<typeof toVendorDetailTabsType>;
22
27
  export interface VendorsTabVendorDetails {
23
28
  vendorBasic: VendorsTabVendorBasic;
29
+ vendorNewAddressStatus?: NewAddressData;
30
+ vendorAddress?: Address;
24
31
  saveStatus: FetchStateAndError;
25
32
  vendorDetailLocalData?: VendorsTabVendorDetailLocalData;
26
33
  }
27
34
  export interface VendorsTabVendorBasic {
28
35
  id: ID;
29
36
  name: string;
37
+ email?: string;
38
+ phone?: string;
30
39
  account?: AccountBase;
31
40
  class?: ClassBase;
32
41
  owner?: User;
42
+ vendorType?: VendorType;
43
+ vendorTin?: Filing1099TinType;
44
+ contacts?: Contact[];
45
+ vendorDocuments?: File[];
33
46
  }
34
47
  export interface VendorsTabVendorViewSelectorView extends SelectorView {
35
48
  accountList: AccountListSelectorView;
36
49
  classList: ClassListSelectorView;
50
+ vendorTypeList: VendorType[];
37
51
  accountsHierarchyList: NestedAccountHierarchyForReport[];
38
52
  classHierarchyList: NestedClassHierarchyForReport[];
39
53
  ownerList: User[];
@@ -41,6 +55,7 @@ export interface VendorsTabVendorViewSelectorView extends SelectorView {
41
55
  }
42
56
  export interface VendorsTabVendorDetailPageView extends SelectorView {
43
57
  vendorViewDetails: VendorsTabVendorViewSelectorView;
58
+ uiState: VendorsTabVendorViewUIState;
44
59
  vendorSpendTrendFilterTabValue: VendorSpendTrendFilterTabType;
45
60
  trendWithTransactions: TrendWithTransactionsView;
46
61
  vendorSpend: VendorSpend;
@@ -14,6 +14,8 @@ const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
14
14
  const addSubtractPeriod_1 = require("../../../commonStateTypes/fiscalYearHelpers/addSubtractPeriod");
15
15
  const getStartOfAndEndOfTimeframeFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/getStartOfAndEndOfTimeframeFY");
16
16
  const zeniDayJS_1 = require("../../../zeniDayJS");
17
+ const addressSelector_1 = require("../../../entity/address/addressSelector");
18
+ const contactSelector_1 = require("../../../entity/billPay/contact/contactSelector");
17
19
  const ALL_VENDOR_DETAIL_TABS_TYPES = [
18
20
  'spend_transactions',
19
21
  'all_transactions',
@@ -21,11 +23,12 @@ const ALL_VENDOR_DETAIL_TABS_TYPES = [
21
23
  const toVendorDetailTabsType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_VENDOR_DETAIL_TABS_TYPES);
22
24
  exports.toVendorDetailTabsType = toVendorDetailTabsType;
23
25
  const getVendorsTabVendorView = (state, vendorIdFromUrl) => {
24
- var _a, _b, _c, _d, _e;
25
- const { accountListState, accountState, classListState, classState, vendorState, userState, vendorsTabVendorViewState, } = state;
26
+ var _a, _b, _c, _d, _e, _f;
27
+ const { accountListState, accountState, classListState, classState, vendorState, userState, vendorsTabVendorViewState, vendorTypeListState, addressState, addressViewState, contactState, } = state;
26
28
  const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
27
29
  const classList = (0, classListSelector_1.getClassList)(classState, classListState);
28
30
  const ownerList = (0, userSelector_1.getUsersByUserIds)(state.userState, state.ownerListState.ownerIds);
31
+ const vendorTypeList = vendorTypeListState.vendorTypes;
29
32
  let vendorDetailState;
30
33
  let fetchState = {
31
34
  fetchState: 'Not-Started',
@@ -33,22 +36,27 @@ const getVendorsTabVendorView = (state, vendorIdFromUrl) => {
33
36
  };
34
37
  const selectedVendor = (0, vendorSelector_1.getVendorByVendorId)(vendorState, vendorIdFromUrl);
35
38
  const basicVendorDetails = selectedVendor != null
36
- ? getBasicVendorDetails(accountState, classState, userState, selectedVendor)
39
+ ? getBasicVendorDetails(accountState, classState, userState, selectedVendor, vendorTypeListState, contactState)
37
40
  : undefined;
38
- if (basicVendorDetails) {
41
+ if (basicVendorDetails != null) {
39
42
  vendorDetailState = {
40
43
  vendorBasic: basicVendorDetails,
41
44
  saveStatus: (_b = (_a = vendorsTabVendorViewState.vendorStateById[vendorIdFromUrl]) === null || _a === void 0 ? void 0 : _a.saveStatus) !== null && _b !== void 0 ? _b : {
42
45
  fetchState: 'Not-Started',
43
46
  error: undefined,
44
47
  },
45
- vendorDetailLocalData: (_c = vendorsTabVendorViewState.vendorStateById[vendorIdFromUrl]) === null || _c === void 0 ? void 0 : _c.vendorDetailLocalData,
48
+ vendorNewAddressStatus: (_c = addressViewState.newAddressState) === null || _c === void 0 ? void 0 : _c.vendor_address,
49
+ vendorAddress: (selectedVendor === null || selectedVendor === void 0 ? void 0 : selectedVendor.addressId) != null
50
+ ? (0, addressSelector_1.getAddressByAddressId)(addressState, selectedVendor === null || selectedVendor === void 0 ? void 0 : selectedVendor.addressId)
51
+ : undefined,
52
+ vendorDetailLocalData: (_d = vendorsTabVendorViewState.vendorStateById[vendorIdFromUrl]) === null || _d === void 0 ? void 0 : _d.vendorDetailLocalData,
46
53
  };
47
54
  }
48
55
  fetchState = (0, reduceFetchState_1.reduceFetchState)([
49
56
  accountList,
50
57
  classList,
51
- (_e = (_d = vendorsTabVendorViewState.vendorStateById[vendorIdFromUrl]) === null || _d === void 0 ? void 0 : _d.fetchStatus) !== null && _e !== void 0 ? _e : {
58
+ vendorTypeListState,
59
+ (_f = (_e = vendorsTabVendorViewState.vendorStateById[vendorIdFromUrl]) === null || _e === void 0 ? void 0 : _e.fetchStatus) !== null && _f !== void 0 ? _f : {
52
60
  fetchState: 'Not-Started',
53
61
  },
54
62
  ]);
@@ -57,6 +65,7 @@ const getVendorsTabVendorView = (state, vendorIdFromUrl) => {
57
65
  return {
58
66
  accountList: accountList,
59
67
  classList: classList,
68
+ vendorTypeList: vendorTypeList,
60
69
  accountsHierarchyList,
61
70
  classHierarchyList,
62
71
  ownerList: ownerList,
@@ -67,8 +76,10 @@ const getVendorsTabVendorView = (state, vendorIdFromUrl) => {
67
76
  };
68
77
  };
69
78
  exports.getVendorsTabVendorView = getVendorsTabVendorView;
70
- const getBasicVendorDetails = (accountState, classState, userState, selectedVendor) => ({
79
+ const getBasicVendorDetails = (accountState, classState, userState, selectedVendor, vendorTypeListState, contactState) => ({
71
80
  name: selectedVendor.name,
81
+ email: selectedVendor.email,
82
+ phone: selectedVendor.phone,
72
83
  account: selectedVendor.accountId != null
73
84
  ? (0, accountSelector_1.getAccountBase)(accountState, selectedVendor.accountId, 'account_list')
74
85
  : undefined,
@@ -81,11 +92,15 @@ const getBasicVendorDetails = (accountState, classState, userState, selectedVend
81
92
  owner: selectedVendor.ownerId != null
82
93
  ? (0, userSelector_1.getUserByUserId)(userState, selectedVendor.ownerId)
83
94
  : undefined,
95
+ vendorType: vendorTypeListState.vendorTypes.filter((type) => type.code === selectedVendor.vendorType)[0],
96
+ vendorTin: selectedVendor.filing1099Tin,
97
+ contacts: (0, contactSelector_1.getContactsByIds)(contactState, selectedVendor.contactIds),
84
98
  id: selectedVendor.id,
85
99
  });
86
100
  const getVendorsTabDetailPageView = (state, vendorId, entity) => {
87
101
  var _a, _b, _c;
88
102
  const trendWithTransactions = (0, trendWithTransactionsSelector_1.getTrendWithTransactions)(state, entity, 'EntityDetail');
103
+ const uiState = state.vendorsTabVendorViewState.uiState;
89
104
  const vendorViewDetails = (0, exports.getVendorsTabVendorView)(state, vendorId);
90
105
  const allVendorTransactions = ((_a = state.vendorsTabVendorViewState.allTransactionsTabData) === null || _a === void 0 ? void 0 : _a.timePeriod) != null
91
106
  ? (0, transactionListByEntitySelector_1.getTransactionListByEntityForSinglePeriod)(state, entity, state.vendorsTabVendorViewState.allTransactionsTabData
@@ -95,6 +110,7 @@ const getVendorsTabDetailPageView = (state, vendorId, entity) => {
95
110
  state.accountListState.byReportId.accountList,
96
111
  state.classListState,
97
112
  state.ownerListState,
113
+ state.vendorTypeListState,
98
114
  (_c = (_b = state.vendorsTabVendorViewState.vendorStateById[vendorId]) === null || _b === void 0 ? void 0 : _b.fetchStatus) !== null && _c !== void 0 ? _c : {
99
115
  fetchState: 'Not-Started',
100
116
  },
@@ -102,6 +118,7 @@ const getVendorsTabDetailPageView = (state, vendorId, entity) => {
102
118
  ]);
103
119
  return {
104
120
  vendorViewDetails,
121
+ uiState,
105
122
  trendWithTransactions,
106
123
  allVendorTransactionsView: allVendorTransactions,
107
124
  allTransactionsTabData: state.vendorsTabVendorViewState.allTransactionsTabData,
@@ -3,10 +3,14 @@ import { Recommendation } from '../../../commonStateTypes/recommendationBase';
3
3
  import { TimePeriod } from '../../../commonStateTypes/timePeriod';
4
4
  import { RecommendedAccountBase } from '../../../entity/account/accountState';
5
5
  import { RecommendedClassBase } from '../../../entity/class/classState';
6
+ import { Filing1099TinType } from '../../../entity/vendor/vendorType';
6
7
  import { VendorSpendTrendFilterTabType } from '../../../entity/vendorExpense/vendorExpenseSelector';
8
+ import { AddressUpdatableInfo } from '../../addressView/addressViewState';
9
+ import { VendorContactInfo } from '../vendorView/vendorViewState';
7
10
  import { VendorDetailTabsType } from './vendorsTabVendorViewSelector';
8
11
  export interface VendorsTabVendorViewState {
9
12
  vendorStateById: Record<ID, VendorsTabVendorDetailState>;
13
+ uiState: VendorsTabVendorViewUIState;
10
14
  selectedTabType: VendorDetailTabsType;
11
15
  vendorSpendTrendFilterTabValue: VendorSpendTrendFilterTabType;
12
16
  allTransactionsTabData?: {
@@ -16,6 +20,12 @@ export interface VendorsTabVendorViewState {
16
20
  }
17
21
  export interface VendorsTabVendorDetailLocalData {
18
22
  vendorName?: string;
23
+ vendorEmail?: string;
24
+ vendorPhone?: string;
25
+ vendorType?: string;
26
+ tin?: Filing1099TinType;
27
+ address?: AddressUpdatableInfo;
28
+ contacts: VendorContactInfo[];
19
29
  vendorCategory?: string;
20
30
  vendorClass?: string;
21
31
  vendorId?: ID;
@@ -31,3 +41,9 @@ export interface VendorsTabVendorDetailState {
31
41
  saveStatus: FetchStateAndError;
32
42
  vendorDetailLocalData?: VendorsTabVendorDetailLocalData;
33
43
  }
44
+ declare const toCollapsableStatusKey: (v: string) => "expand" | "collapse";
45
+ export declare type CollapsableStatusKey = ReturnType<typeof toCollapsableStatusKey>;
46
+ export interface VendorsTabVendorViewUIState {
47
+ collapsableStatus: CollapsableStatusKey;
48
+ }
49
+ export {};
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
4
+ const COLLAPSABLESTATUS = ['expand', 'collapse'];
5
+ const toCollapsableStatusKey = (v) => (0, stringToUnion_1.stringToUnion)(v, COLLAPSABLESTATUS);
@@ -65,7 +65,7 @@ function getBankConnectionsSetupViewDetails(state, companyId, isBillPayEnabled,
65
65
  paymentAccountListState,
66
66
  ]);
67
67
  const allFundingAccounts = fetchState.fetchState === 'Completed'
68
- ? (0, setupViewSelector_1.getAllFundingAccounts)(depositAccounts, paymentAccounts, false)
68
+ ? (0, setupViewSelector_1.getAllFundingAccounts)(depositAccounts, paymentAccounts, paymentAccountListState.paymentAccountBalanceFetchStatus, false)
69
69
  : [];
70
70
  const primaryAccountsProductWise = [];
71
71
  if (isBillPayEnabled) {
@@ -85,7 +85,7 @@ const getBillActivities = (state, billId, billStageCode) => {
85
85
  exports.getBillActivities = getBillActivities;
86
86
  const getBillDetailView = (state, billId) => {
87
87
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
88
- const { bankAccountState, paymentInstrumentState, billDetailViewState, billTransactionState, paymentAccountState, userState, billPayConfigState, userRoleState, classListState, classState, commonHistoryState, realTimeApprovalState, entityApprovalStatusState, billPaySetupApproverViewState, vendorState, recurringBillState, depositAccountState, } = state;
88
+ const { bankAccountState, paymentInstrumentState, billDetailViewState, billTransactionState, paymentAccountState, userState, billPayConfigState, userRoleState, classListState, classState, commonHistoryState, realTimeApprovalState, entityApprovalStatusState, billPaySetupApproverViewState, vendorState, recurringBillState, depositAccountState, paymentAccountListState, } = state;
89
89
  const { approverListState } = billPaySetupApproverViewState;
90
90
  const detailKey = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId !== null && billId !== void 0 ? billId : '');
91
91
  const billTransactionDetails = (0, get_1.default)(billDetailViewState.billDetailById, detailKey, undefined);
@@ -98,7 +98,7 @@ const getBillDetailView = (state, billId) => {
98
98
  const paymentInstrument = (0, paymentInstrumentSelector_1.getPaymentInstrumentById)(paymentInstrumentState, (_c = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.toAccount.billAccountId) !== null && _c !== void 0 ? _c : '');
99
99
  const paymentAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, (_d = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId) !== null && _d !== void 0 ? _d : '');
100
100
  const depositAccount = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, (_e = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId) !== null && _e !== void 0 ? _e : '');
101
- const withdrawFrom = (0, setupViewSelector_1.getAllFundingAccounts)((_f = (depositAccount && [depositAccount])) !== null && _f !== void 0 ? _f : [], (_g = (paymentAccount && [paymentAccount])) !== null && _g !== void 0 ? _g : [])[0];
101
+ const withdrawFrom = (0, setupViewSelector_1.getAllFundingAccounts)((_f = (depositAccount && [depositAccount])) !== null && _f !== void 0 ? _f : [], (_g = (paymentAccount && [paymentAccount])) !== null && _g !== void 0 ? _g : [], paymentAccountListState.paymentAccountBalanceFetchStatus)[0];
102
102
  let previousBills = {
103
103
  bills: [],
104
104
  fetchState: 'Not-Started',
@@ -49,7 +49,7 @@ const getReviewPageBillDetail = (state, billId) => {
49
49
  let contactDetails = [];
50
50
  const primaryPaymentAccount = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, paymentAccountListState.paymentAccountIds);
51
51
  const allDepositAccounts = (0, depositAccountListSelector_1.getAllDepostAccounts)(depositAccountState, depositAccountListState).depositAccounts;
52
- const withdrawFromList = (0, setupViewSelector_1.getAllFundingAccounts)(allDepositAccounts, primaryPaymentAccount);
52
+ const withdrawFromList = (0, setupViewSelector_1.getAllFundingAccounts)(allDepositAccounts, primaryPaymentAccount, paymentAccountListState.paymentAccountBalanceFetchStatus);
53
53
  let fetchState = 'Not-Started';
54
54
  let sourceBillDetailFetchState = 'Not-Started';
55
55
  const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'billPayAccountList');
@@ -88,7 +88,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
88
88
  if (allDepositAccounts.length === 0 && fromDepositAccount != null) {
89
89
  allDepositAccounts.push(fromDepositAccount);
90
90
  }
91
- const withdrawFromList = (0, setupViewSelector_1.getAllFundingAccounts)(allDepositAccounts, primaryPaymentAccount);
91
+ const withdrawFromList = (0, setupViewSelector_1.getAllFundingAccounts)(allDepositAccounts, primaryPaymentAccount, paymentAccountListState.paymentAccountBalanceFetchStatus);
92
92
  let previousBills = {
93
93
  bills: [],
94
94
  fetchState: 'Not-Started',
@@ -596,7 +596,7 @@ const getDueDate = (billStageCode, dueDate, invoiceDate, bookCloseDate) => {
596
596
  };
597
597
  exports.getDueDate = getDueDate;
598
598
  const getWithdrawFrom = (state, fromAccountId, fromAccountType, companyId, lastSelectedFromAccount) => {
599
- const { paymentAccountState, depositAccountState, depositAccountListState } = state;
599
+ const { paymentAccountState, depositAccountState, depositAccountListState, paymentAccountListState, } = state;
600
600
  if (fromAccountId != null) {
601
601
  const withdrawFromAsDepositAcc = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, fromAccountId);
602
602
  const withdrawFromAsPaymentAcc = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, fromAccountId);
@@ -606,7 +606,7 @@ const getWithdrawFrom = (state, fromAccountId, fromAccountType, companyId, lastS
606
606
  }
607
607
  if (fromAccountType === 'paymentAccount' &&
608
608
  withdrawFromAsPaymentAcc != null) {
609
- return (0, setupViewSelector_1.mapPaymentAccToFundingAccount)(withdrawFromAsPaymentAcc);
609
+ return (0, setupViewSelector_1.mapPaymentAccToFundingAccount)(withdrawFromAsPaymentAcc, paymentAccountListState.paymentAccountBalanceFetchStatus);
610
610
  }
611
611
  }
612
612
  else {
@@ -616,7 +616,7 @@ const getWithdrawFrom = (state, fromAccountId, fromAccountType, companyId, lastS
616
616
  };
617
617
  exports.getWithdrawFrom = getWithdrawFrom;
618
618
  const getDefaultWithdrawFromAccount = (state, depositAccounts, companyId, lastSelectedFromAccount) => {
619
- const { depositAccountState, paymentAccountState } = state;
619
+ const { depositAccountState, paymentAccountState, paymentAccountListState } = state;
620
620
  const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
621
621
  const primaryAccount = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyBillPayInfo.primaryFundingAccount;
622
622
  let defaultAccount = undefined;
@@ -655,7 +655,7 @@ const getDefaultWithdrawFromAccount = (state, depositAccounts, companyId, lastSe
655
655
  }
656
656
  if (defaultAccount.accountType === 'paymentAccount' &&
657
657
  defaultAccAsPaymentAcc != null) {
658
- return (0, setupViewSelector_1.mapPaymentAccToFundingAccount)(defaultAccAsPaymentAcc);
658
+ return (0, setupViewSelector_1.mapPaymentAccToFundingAccount)(defaultAccAsPaymentAcc, paymentAccountListState.paymentAccountBalanceFetchStatus);
659
659
  }
660
660
  }
661
661
  return undefined;
@@ -12,9 +12,10 @@ import { NewAddressData } from '../../addressView/addressViewState';
12
12
  import { CompanyAndIdentityDetails, CompanyOfficerLocalData, PrimaryContactLocalData, SetupViewType } from './setupViewState';
13
13
  import { PlaidAccountKeyType, PlaidConnectionDetails } from '../plaidAccount/plaidAccountViewState';
14
14
  import { AccountTypeSubConfigCodeKeyType } from '../billPay/billPayConfig/billPayConfigState';
15
- import { Balance } from '../../../commonStateTypes/balance';
16
15
  import { DepositAccount } from '../../../entity/depositAccount/depositAccount';
17
16
  import { AllowedValueWithCode } from '../../../commonStateTypes/allowedValue';
17
+ import { Amount } from '../../../commonStateTypes/amount';
18
+ import { BalanceChange } from '../../../commonStateTypes/balance';
18
19
  export interface SetupView {
19
20
  allFundingAccounts: FundingAccount[];
20
21
  allBankAccounts: AccountBase[];
@@ -31,8 +32,14 @@ export interface FundingAccount {
31
32
  accType: AccountTypeSubConfigCodeKeyType;
32
33
  label: string;
33
34
  maskedAccountNumber: string;
35
+ balanceFetchStatus: FetchStateAndError;
34
36
  zeniAccountId?: ID;
35
- accountBalance?: Balance;
37
+ accountBalance?: {
38
+ available?: Amount;
39
+ current?: Amount;
40
+ lastRefreshTime?: ZeniDate;
41
+ change?: BalanceChange;
42
+ };
36
43
  logo?: Logo;
37
44
  providerAccountId?: ID;
38
45
  institutionDetails?: InstitutionDetails;
@@ -79,7 +86,7 @@ export interface BusinessVerificationDetails extends CompanyAndOfficerLocalData
79
86
  export declare function getCommonSetupViewDetails(state: RootState, companyId: ID, setupViewType: SetupViewType, plaidAccountKeyType: PlaidAccountKeyType): SetupView;
80
87
  export declare function getBusinessVerificationDetails(state: RootState, companyId: ID): BusinessVerificationDetails;
81
88
  export declare const getCompanyAndIdentityDetails: (state: RootState, companyId: ID, companyAndIdentityDetails: CompanyAndIdentityDetails) => CompanyAndOfficerLocalData;
82
- export declare const getAllFundingAccounts: (depositAccounts: DepositAccount[], paymentAccounts: PaymentAccount[], includeOnlyVerifiedAccounts?: boolean) => FundingAccount[];
89
+ export declare const getAllFundingAccounts: (depositAccounts: DepositAccount[], paymentAccounts: PaymentAccount[], paymentAccountBalanceFetchStatus: Record<ID, FetchStateAndError>, includeOnlyVerifiedAccounts?: boolean) => FundingAccount[];
83
90
  export declare const mapDepositAccToFundingAccount: (depositAcc: DepositAccount) => FundingAccount;
84
- export declare const mapPaymentAccToFundingAccount: (paymentAcc: PaymentAccount) => FundingAccount;
91
+ export declare const mapPaymentAccToFundingAccount: (paymentAcc: PaymentAccount, paymentAccountBalanceFetchStatus: Record<ID, FetchStateAndError>) => FundingAccount;
85
92
  export {};
@@ -15,13 +15,13 @@ function getCommonSetupViewDetails(state, companyId, setupViewType, plaidAccount
15
15
  const { updateStatus } = setupViewState;
16
16
  const { accountDetails, plaidConnectionDetails } = (0, plaidAccountViewSelector_1.getPlaidAccountDetails)(plaidAccountViewState, plaidAccountKeyType);
17
17
  const { allBankAccountIds } = accountDetails;
18
- const { paymentAccountIds } = paymentAccountListState;
18
+ const { paymentAccountIds, paymentAccountBalanceFetchStatus } = paymentAccountListState;
19
19
  const { accountIds: depositAccountIds } = depositAccountListState;
20
20
  const allBankAccounts = (_a = allBankAccountIds === null || allBankAccountIds === void 0 ? void 0 : allBankAccountIds.map((accountId) => (0, accountSelector_1.getAccountBase)(accountState, accountId, setupViewType)).filter((account) => account != null)) !== null && _a !== void 0 ? _a : [];
21
21
  const paymentAccounts = (_b = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, paymentAccountIds).filter((account) => account != null)) !== null && _b !== void 0 ? _b : [];
22
22
  const depositAccounts = (_c = (0, depositAccountSelector_1.getDepositAccountsByDepositAccountIds)(depositAccountState, depositAccountIds).filter((account) => account != null)) !== null && _c !== void 0 ? _c : [];
23
23
  const allFundingAccounts = (0, exports.getAllFundingAccounts)(setupViewType === 'zeni_accounts' ? [] : depositAccounts, // only external acct can be made primary for accounts setup
24
- paymentAccounts, false);
24
+ paymentAccounts, paymentAccountBalanceFetchStatus, false);
25
25
  const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
26
26
  const companyBillPayInfo = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyBillPayInfo;
27
27
  const primaryAccount = getPrimaryAccountForTheProduct(state, companyId, setupViewType);
@@ -35,7 +35,7 @@ function getCommonSetupViewDetails(state, companyId, setupViewType, plaidAccount
35
35
  else if ((primaryAccount === null || primaryAccount === void 0 ? void 0 : primaryAccount.accountType) === 'paymentAccount') {
36
36
  const paymentAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, primaryAccount.accountId);
37
37
  if (paymentAccount != null) {
38
- primaryFundingAccount = (0, exports.mapPaymentAccToFundingAccount)(paymentAccount);
38
+ primaryFundingAccount = (0, exports.mapPaymentAccToFundingAccount)(paymentAccount, paymentAccountBalanceFetchStatus);
39
39
  }
40
40
  }
41
41
  let paymentAccountForBilling;
@@ -184,7 +184,7 @@ exports.getCompanyAndIdentityDetails = getCompanyAndIdentityDetails;
184
184
  /* This helper function takes deposit accounts and payment accounts
185
185
  and give back FundingAccount type array
186
186
  to support single dropdown with both lists */
187
- const getAllFundingAccounts = (depositAccounts, paymentAccounts, includeOnlyVerifiedAccounts = true) => {
187
+ const getAllFundingAccounts = (depositAccounts, paymentAccounts, paymentAccountBalanceFetchStatus, includeOnlyVerifiedAccounts = true) => {
188
188
  return [
189
189
  ...depositAccounts.map((depositAcc) => (0, exports.mapDepositAccToFundingAccount)(depositAcc)),
190
190
  ...(includeOnlyVerifiedAccounts
@@ -196,7 +196,7 @@ const getAllFundingAccounts = (depositAccounts, paymentAccounts, includeOnlyVeri
196
196
  ((_c = paymentAccount.providerVerificationStatus) === null || _c === void 0 ? void 0 : _c.code) ===
197
197
  'automatically_verified';
198
198
  })
199
- : paymentAccounts).map((paymentAcc) => (0, exports.mapPaymentAccToFundingAccount)(paymentAcc)),
199
+ : paymentAccounts).map((paymentAcc) => (0, exports.mapPaymentAccToFundingAccount)(paymentAcc, paymentAccountBalanceFetchStatus)),
200
200
  ];
201
201
  };
202
202
  exports.getAllFundingAccounts = getAllFundingAccounts;
@@ -208,10 +208,14 @@ const mapDepositAccToFundingAccount = (depositAcc) => ({
208
208
  accountBalance: depositAcc.accountBalance,
209
209
  logo: undefined,
210
210
  zeniAccountId: depositAcc.zeniAccountId,
211
+ balanceFetchStatus: {
212
+ fetchState: 'Completed',
213
+ error: undefined,
214
+ },
211
215
  });
212
216
  exports.mapDepositAccToFundingAccount = mapDepositAccToFundingAccount;
213
- const mapPaymentAccToFundingAccount = (paymentAcc) => {
214
- var _a;
217
+ const mapPaymentAccToFundingAccount = (paymentAcc, paymentAccountBalanceFetchStatus) => {
218
+ var _a, _b;
215
219
  return ({
216
220
  id: paymentAcc.paymentAccountId,
217
221
  accType: 'paymentAccount',
@@ -222,10 +226,15 @@ const mapPaymentAccToFundingAccount = (paymentAcc) => {
222
226
  isLoginRequired: paymentAcc.isLoginRequired,
223
227
  providerAccountId: paymentAcc.providerAccountId,
224
228
  providerVerificationStatus: paymentAcc.providerVerificationStatus,
229
+ accountBalance: paymentAcc.balances,
225
230
  label: Boolean(paymentAcc.institutionDetails.institutionName) === true
226
231
  ? paymentAcc.institutionDetails.institutionName
227
232
  : (0, depositAccountPayload_1.getZeniAccountFallbackName)(paymentAcc.maskedAccountNumber, (_a = paymentAcc.accountSubType) === null || _a === void 0 ? void 0 : _a.name),
228
233
  logo: paymentAcc.institutionDetails.logo,
234
+ balanceFetchStatus: (_b = paymentAccountBalanceFetchStatus[paymentAcc.paymentAccountId]) !== null && _b !== void 0 ? _b : {
235
+ fetchState: 'Not-Started',
236
+ error: undefined,
237
+ },
229
238
  });
230
239
  };
231
240
  exports.mapPaymentAccToFundingAccount = mapPaymentAccToFundingAccount;
@@ -0,0 +1,9 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../../reducer';
4
+ import { ZeniAPI } from '../../../../zeniAPI';
5
+ import { fetchPaymentAccountBalance, updatePaymentAccountList, updatePaymentAccountBalanceStatus } from './paymentAccountListReducer';
6
+ import { updateAccounts } from '../../../../entity/account/accountReducer';
7
+ import { updatePaymentAccounts } from '../../../../entity/paymentAccount/paymentAccountReducer';
8
+ export declare type ActionType = ReturnType<typeof fetchPaymentAccountBalance> | ReturnType<typeof updatePaymentAccountList> | ReturnType<typeof updatePaymentAccountBalanceStatus> | ReturnType<typeof updateAccounts> | ReturnType<typeof updatePaymentAccounts>;
9
+ export declare const fetchPaymentAccountBalanceEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchPaymentAccountBalanceEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../../responsePayload");
7
+ const paymentAccountListReducer_1 = require("./paymentAccountListReducer");
8
+ const accountReducer_1 = require("../../../../entity/account/accountReducer");
9
+ const paymentAccountReducer_1 = require("../../../../entity/paymentAccount/paymentAccountReducer");
10
+ const paymentAccountSelector_1 = require("../../../../entity/paymentAccount/paymentAccountSelector");
11
+ const fetchPaymentAccountBalanceEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(paymentAccountListReducer_1.fetchPaymentAccountBalance.match), (0, operators_1.mergeMap)((action) => {
12
+ var _a;
13
+ const { paymentAccountId } = action.payload;
14
+ const paymentAccountState = state$.value.paymentAccountState;
15
+ const payemntAcc = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, paymentAccountId);
16
+ if (((_a = payemntAcc === null || payemntAcc === void 0 ? void 0 : payemntAcc.providerVerificationStatus) === null || _a === void 0 ? void 0 : _a.code) !== 'manually_verified') {
17
+ return zeniAPI
18
+ .getJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/payment-accounts/${paymentAccountId}?query=${encodeURIComponent(`{"is_include_realtime_balance":true}`)}`)
19
+ .pipe((0, operators_1.mergeMap)((response) => {
20
+ var _a, _b, _c, _d;
21
+ if ((0, responsePayload_1.isSuccessResponse)(response)) {
22
+ return (0, rxjs_1.of)((0, accountReducer_1.updateAccounts)((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.accounts) !== null && _b !== void 0 ? _b : [], 'zeni_accounts'), (0, paymentAccountReducer_1.updatePaymentAccounts)((_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.payment_accounts) !== null && _d !== void 0 ? _d : []), (0, paymentAccountListReducer_1.updatePaymentAccountBalanceStatus)({
23
+ paymentAccountId,
24
+ fetchState: 'Completed',
25
+ error: undefined,
26
+ }));
27
+ }
28
+ else {
29
+ return (0, rxjs_1.of)((0, paymentAccountListReducer_1.updatePaymentAccountBalanceStatus)({
30
+ paymentAccountId,
31
+ fetchState: 'Error',
32
+ error: response.status,
33
+ }));
34
+ }
35
+ }), (0, operators_1.catchError)((error) => {
36
+ return (0, rxjs_1.of)((0, paymentAccountListReducer_1.updatePaymentAccountBalanceStatus)({
37
+ paymentAccountId,
38
+ fetchState: 'Error',
39
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch payment Accounts Balance REST API call errored out' +
40
+ JSON.stringify(error)),
41
+ }));
42
+ }));
43
+ }
44
+ else {
45
+ return [];
46
+ }
47
+ }));
48
+ exports.fetchPaymentAccountBalanceEpic = fetchPaymentAccountBalanceEpic;
@@ -2,8 +2,8 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { Observable } from 'rxjs';
3
3
  import { RootState } from '../../../../reducer';
4
4
  import { ZeniAPI } from '../../../../zeniAPI';
5
- import { fetchPaymentAccountList, updatePaymentAccountList, updatePaymentAccountListFetchStatus } from './paymentAccountListReducer';
5
+ import { fetchPaymentAccountList, updatePaymentAccountList, updatePaymentAccountListFetchStatus, fetchPaymentAccountBalance } from './paymentAccountListReducer';
6
6
  import { updateAccounts } from '../../../../entity/account/accountReducer';
7
7
  import { updatePaymentAccounts } from '../../../../entity/paymentAccount/paymentAccountReducer';
8
- export declare type ActionType = ReturnType<typeof fetchPaymentAccountList> | ReturnType<typeof updatePaymentAccountList> | ReturnType<typeof updatePaymentAccountListFetchStatus> | ReturnType<typeof updateAccounts> | ReturnType<typeof updatePaymentAccounts>;
8
+ export declare type ActionType = ReturnType<typeof fetchPaymentAccountList> | ReturnType<typeof updatePaymentAccountList> | ReturnType<typeof updatePaymentAccountListFetchStatus> | ReturnType<typeof fetchPaymentAccountBalance> | ReturnType<typeof updateAccounts> | ReturnType<typeof updatePaymentAccounts>;
9
9
  export declare const fetchPaymentAccountListEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -11,12 +11,18 @@ const fetchPaymentAccountListEpic = (actions$, _state$, zeniAPI) => actions$.pip
11
11
  return zeniAPI
12
12
  .getJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/payment-accounts`)
13
13
  .pipe((0, operators_1.mergeMap)((response) => {
14
- var _a, _b, _c, _d, _e, _f;
15
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
16
- return (0, rxjs_1.of)((0, accountReducer_1.updateAccounts)((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.accounts) !== null && _b !== void 0 ? _b : [], 'zeni_accounts'), (0, paymentAccountReducer_1.updatePaymentAccounts)((_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.payment_accounts) !== null && _d !== void 0 ? _d : []), (0, paymentAccountListReducer_1.updatePaymentAccountList)({
17
- data: (_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.payment_accounts) !== null && _f !== void 0 ? _f : [],
18
- updateType: 'replace',
19
- }));
14
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
15
+ const { payment_accounts, accounts } = response.data;
16
+ let paymentAccountListAction = [
17
+ (0, accountReducer_1.updateAccounts)(accounts, 'zeni_accounts'),
18
+ (0, paymentAccountReducer_1.updatePaymentAccounts)(payment_accounts),
19
+ (0, paymentAccountListReducer_1.updatePaymentAccountList)({
20
+ data: payment_accounts,
21
+ updateType: 'replace',
22
+ }),
23
+ ];
24
+ paymentAccountListAction = paymentAccountListAction.concat(payment_accounts.map((paymentAcc) => (0, paymentAccountListReducer_1.fetchPaymentAccountBalance)(paymentAcc.payment_account_id)));
25
+ return (0, rxjs_1.concat)((0, rxjs_1.from)(paymentAccountListAction));
20
26
  }
21
27
  else {
22
28
  return (0, rxjs_1.of)((0, paymentAccountListReducer_1.updatePaymentAccountListFetchStatus)({
@@ -2,4 +2,5 @@ import { FetchedState, FetchStateAndError, ID } from '../../../../commonStateTyp
2
2
  export interface PaymentAccountListState extends FetchedState {
3
3
  paymentAccountIds: ID[];
4
4
  unlinkingAccountStatus: Record<ID, FetchStateAndError>;
5
+ paymentAccountBalanceFetchStatus: Record<ID, FetchStateAndError>;
5
6
  }
@@ -17,6 +17,12 @@ export declare const fetchPaymentAccountList: import("@reduxjs/toolkit").ActionC
17
17
  accountId: ID;
18
18
  fetchState: FetchState;
19
19
  error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
20
+ }, string>, fetchPaymentAccountBalance: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[paymentAccountId: string], {
21
+ paymentAccountId: string;
22
+ }, string, never, never>, updatePaymentAccountBalanceStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
23
+ paymentAccountId: ID;
24
+ fetchState: FetchState;
25
+ error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
20
26
  }, string>;
21
27
  declare const _default: import("@reduxjs/toolkit").Reducer<PaymentAccountListState, import("@reduxjs/toolkit").AnyAction>;
22
28
  export default _default;