@zeniai/client-epic-state 4.11.46 → 4.11.47

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.
package/lib/index.d.ts CHANGED
@@ -171,11 +171,11 @@ import { getPeople, getPeopleLocalData } from './view/people/peopleSelector';
171
171
  import { PeopleState, PersonUpdateType, PeoplePageMode, PeopleUIState, PeopleLocalData } from './view/people/peopleState';
172
172
  export { fetchAllPeopleRequiredViews, fetchPeoplePage, fetchPeople, deletePerson, resendInvite, changeZeniPersonRoles, invitePeople, inviteZeniPeople, updatePeopleUIState, peopleSaveUpdates, resetUpdateErrorMessage, peopleSaveDataInLocalStore, peopleClearDataInLocalStore, PeopleSelectorView, PeopleLocalDataView, Person, getPeople, getPeopleLocalData, PeopleState, PersonUpdateType, PeoplePageMode, ZeniPersonUserRoleType, PeopleUIState, PeopleLocalData, initializeEditPerson, };
173
173
  import { clearSettingsView, fetchMyProfileView, fetchMyProfile, fetchBankConnectionsView, fetchBillingAccountsView, fetchNotificationSettings, fetchNotificationSettingsView, refreshQBOData, resetNotificationSettingsLocalData, resetNotificationSettingsUpdateStatus, saveNotificationSettings, updateNotificationSettingsLocalData, updateSettingsViewUIState } from './view/settingsView/settingsViewReducer';
174
- import { MyProfileSelectorView, MyProfile, BankConnectionsSetupView, MyBankConnectionsView, NotificationSettingsSelectorView, IntegrationsView, BillingView } from './view/settingsView/types/settingsViewSelectorTypes';
174
+ import { MyProfileSelectorView, MyProfile, BankConnectionsSetupView, MyBankConnectionsView, NotificationSettingsSelectorView, IntegrationsView, ProductWisePrimaryAccount, BillingView } from './view/settingsView/types/settingsViewSelectorTypes';
175
175
  import { getMyProfileView, getApprovalRuleViewDetails, getBankConnectionsSetupViewDetails, getMyBankConnectionsDetails, getIntegrationsView, getNotificationSettingsView, getNotificationSettings } from './view/settingsView/settingsViewSelector';
176
176
  import { SettingsViewState, ReminderNotificationSettingsLocalData, NotificationSettingsLocalData, NotificationSettings, REMINDER_NOTIFICATION_TYPES, ReminderNotificationSettingsData, MonthEndInsightsNotificationSettingsData, MonthEndInsightsNotificationSettingsLocalData, ReminderTypeKey, NotificationModeKey, FrequencyTypeKey, NOTIFICATION_MODES, RemindersLocalData, IntegrationsSettings, SettingsViewUIState } from './view/settingsView/settingsViewState';
177
177
  import { isAccountingTabVisible, isApprovalRulesTabVisible, isBankConnectionsTabVisible, isBusinessVerificationTabVisible, isCompanyDetailsTabVisible, isIntegrationsTabVisible, isSettingsVisible, isMyBankConnectionsTabVisible, isNotificationsTabVisible, isMonthEndNotificationsSectionVisibleOnSettingsPage, isRemindersSectionVisibleOnSettingsPage } from './view/settingsView/settingsViewHelpers';
178
- export { REMINDER_NOTIFICATION_TYPES, NOTIFICATION_MODES, clearSettingsView, fetchMyProfileView, fetchMyProfile, fetchBankConnectionsView, fetchBillingAccountsView, fetchNotificationSettings, saveNotificationSettings, updateNotificationSettingsLocalData, fetchNotificationSettingsView, resetNotificationSettingsLocalData, resetNotificationSettingsUpdateStatus, refreshQBOData, updateSettingsViewUIState, isMonthEndNotificationsSectionVisibleOnSettingsPage, getNotificationSettingsView, getNotificationSettings, getMyProfileView, getMyBankConnectionsDetails, isAccountingTabVisible, isApprovalRulesTabVisible, isBankConnectionsTabVisible, isBusinessVerificationTabVisible, isCompanyDetailsTabVisible, isIntegrationsTabVisible, isSettingsVisible, isMyBankConnectionsTabVisible, isNotificationsTabVisible, isRemindersSectionVisibleOnSettingsPage, MyProfileSelectorView, MyBankConnectionsView, BillingView, MyProfile, SettingsViewState, SettingsViewUIState, NotificationSettings, NotificationSettingsLocalData, ReminderNotificationSettingsLocalData, NotificationSettingsSelectorView, ReminderNotificationSettingsData, MonthEndInsightsNotificationSettingsData, MonthEndInsightsNotificationSettingsLocalData, ReminderTypeKey, NotificationModeKey, FrequencyTypeKey, RemindersLocalData, IntegrationsSettings, };
178
+ export { REMINDER_NOTIFICATION_TYPES, NOTIFICATION_MODES, clearSettingsView, fetchMyProfileView, fetchMyProfile, fetchBankConnectionsView, fetchBillingAccountsView, fetchNotificationSettings, saveNotificationSettings, updateNotificationSettingsLocalData, fetchNotificationSettingsView, resetNotificationSettingsLocalData, resetNotificationSettingsUpdateStatus, refreshQBOData, updateSettingsViewUIState, isMonthEndNotificationsSectionVisibleOnSettingsPage, getNotificationSettingsView, getNotificationSettings, getMyProfileView, getMyBankConnectionsDetails, isAccountingTabVisible, isApprovalRulesTabVisible, isBankConnectionsTabVisible, isBusinessVerificationTabVisible, isCompanyDetailsTabVisible, isIntegrationsTabVisible, isSettingsVisible, isMyBankConnectionsTabVisible, isNotificationsTabVisible, isRemindersSectionVisibleOnSettingsPage, MyProfileSelectorView, MyBankConnectionsView, BillingView, MyProfile, SettingsViewState, SettingsViewUIState, NotificationSettings, NotificationSettingsLocalData, ReminderNotificationSettingsLocalData, NotificationSettingsSelectorView, ReminderNotificationSettingsData, MonthEndInsightsNotificationSettingsData, MonthEndInsightsNotificationSettingsLocalData, ReminderTypeKey, NotificationModeKey, FrequencyTypeKey, RemindersLocalData, IntegrationsSettings, ProductWisePrimaryAccount, };
179
179
  import { PeopleViewSortKey } from './view/people/peopleTypes';
180
180
  export { PeopleViewSortKey };
181
181
  import { fetchBalanceSheet, resetBalanceSheetNodeCollapseState, updateBalanceSheetUIState } from './view/balanceSheet/balanceSheetReducer';
@@ -407,12 +407,12 @@ import { SetupViewState, SetupViewLocalData } from './view/spendManagement/commo
407
407
  import { enableSetup, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, updateBusinessVerificationDetails, saveSetupViewDataInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveCompnayOfficerAdditionalDocumentsInLocalStore, clearSetupViewDataInLocalStore, saveIndustryAndIncDateInLocalStore } from './view/spendManagement/commonSetup/setupViewReducer';
408
408
  import { BillPaySetupView, BillPayBusinessVerificationDetails, getBillPaySetupViewDetails, getBillPayBusinessVerificationDetails } from './view/spendManagement/billPay/billPaySetupView/billPaySetupViewSelector';
409
409
  import { getPlaidAccountDetails } from './view/spendManagement/plaidAccount/plaidAccountViewSelector';
410
- import { PlaidAccountState, PlaidConnectionDetails, PlaidLinkTokenType } from './view/spendManagement/plaidAccount/plaidAccountViewState';
410
+ import { PlaidAccountState, PlaidConnectionDetails, PlaidLinkTokenType, PlaidAccountKeyType } from './view/spendManagement/plaidAccount/plaidAccountViewState';
411
411
  import { ZeniAccountSetupView, ZeniAccountBusinessVerificationDetails, getZeniAccountSetupViewDetails, getZeniAccountBusinessVerificationDetails } from './view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewSelector';
412
412
  import { SetupView, BusinessVerificationDetails, CompanyDetails, CompanyOfficersDetails, getCommonSetupViewDetails, getBusinessVerificationDetails, FundingAccount } from './view/spendManagement/commonSetup/setupViewSelector';
413
413
  import { sendOtp, resendOtp, verifyOtp } from './view/twoFactorAuthentication/twoFactorAuthenticationReducer';
414
414
  import { CustomerToken } from './view/twoFactorAuthentication/twoFactorAuthentication';
415
- export { BillPaySetupViewState, ZeniAccountSetupViewState, BillPaySetupViewLocalData, ZeniAccountSetupViewLocalData, PlaidAccountState, fetchBillPaySetupView, fetchZeniAccountSetupView, enableSetup, getPaymentAccounts, getPlaidLinkToken, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, updateBusinessVerificationDetails, updatePaymentAccount, updatePaymentAccountLoginStatus, updatePaymentAccountStatus, establishPlaidConnection, updateMappedCashAccount, updatePrimaryFundingAccount, acceptBillPayTerms, acceptZeniAccountTerms, acceptBillPayUpdatedTerms, saveSetupViewDataInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveIndustryAndIncDateInLocalStore, clearSetupViewDataInLocalStore, clearBillPaySetupView, clearZeniAccountSetupView, sendOtp, resendOtp, verifyOtp, CompanyDetails, CompanyOfficersDetails, BillPaySetupView, ZeniAccountSetupView, BillPayBusinessVerificationDetails, ZeniAccountBusinessVerificationDetails, SetupViewState, SetupViewLocalData, SetupView, BusinessVerificationDetails, getBillPaySetupViewDetails, getPlaidAccountDetails, getZeniAccountSetupViewDetails, getBusinessVerificationDetails, getBillPayBusinessVerificationDetails, getZeniAccountBusinessVerificationDetails, getCommonSetupViewDetails, PlaidConnectionDetails, PlaidLinkTokenType, CustomerToken, FundingAccount, };
415
+ export { BillPaySetupViewState, ZeniAccountSetupViewState, BillPaySetupViewLocalData, ZeniAccountSetupViewLocalData, PlaidAccountState, fetchBillPaySetupView, fetchZeniAccountSetupView, enableSetup, getPaymentAccounts, getPlaidLinkToken, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, updateBusinessVerificationDetails, updatePaymentAccount, updatePaymentAccountLoginStatus, updatePaymentAccountStatus, establishPlaidConnection, updateMappedCashAccount, updatePrimaryFundingAccount, acceptBillPayTerms, acceptZeniAccountTerms, acceptBillPayUpdatedTerms, saveSetupViewDataInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveIndustryAndIncDateInLocalStore, clearSetupViewDataInLocalStore, clearBillPaySetupView, clearZeniAccountSetupView, sendOtp, resendOtp, verifyOtp, CompanyDetails, CompanyOfficersDetails, BillPaySetupView, ZeniAccountSetupView, BillPayBusinessVerificationDetails, ZeniAccountBusinessVerificationDetails, SetupViewState, SetupViewLocalData, SetupView, BusinessVerificationDetails, getBillPaySetupViewDetails, getPlaidAccountDetails, getZeniAccountSetupViewDetails, getBusinessVerificationDetails, getBillPayBusinessVerificationDetails, getZeniAccountBusinessVerificationDetails, getCommonSetupViewDetails, PlaidConnectionDetails, PlaidLinkTokenType, PlaidAccountKeyType, CustomerToken, FundingAccount, };
416
416
  export { BankConnectionsSetupView, IntegrationsView, getApprovalRuleViewDetails, getBankConnectionsSetupViewDetails, getIntegrationsView, };
417
417
  import { fetchUserFinancialAccount } from './view/userFinancialAccount/userFinancialAccountReducer';
418
418
  export { fetchUserFinancialAccount };
@@ -493,9 +493,9 @@ import { getSpendManagementEffectiveListPeriod, getSelectedCompanyOfficer, showB
493
493
  export { getSpendManagementEffectiveListPeriod, getSelectedCompanyOfficer, showBillPayPromoPage, showReimbursementPromoPage, getActualPaymentDate, isVerifiedStatusCode, isBillProcessing, getBillListUniqueType, };
494
494
  import { FilterCategoryValueType, canSendMonthEndEmailReport, shouldEnableCalendarPickerForLastReportSent } from './view/companyView/helpers/cockpitHelpers';
495
495
  export { FilterCategoryValueType, canSendMonthEndEmailReport, shouldEnableCalendarPickerForLastReportSent, };
496
- import { BillPayConfig, BillPaymentConfigCodeType, BillPaymentSubConfigCodeType, Country, VendorCurrency, InternationalSubConfigCodeType, BILL_NEW_PAYMENT_METHODS, NEW_INTERNATIONAL_METHOD_SUBTEXT, SWIFT_OUR_INTERNATIONAL_METHOD_SUBTEXT, LOCAL_CURRENCY_INTERNATIONAL_METHOD_SUBTEXT } from './view/spendManagement/billPay/billPayConfig/billPayConfigState';
496
+ import { BillPayConfig, BillPaymentConfigCodeType, BillPaymentSubConfigCodeType, Country, VendorCurrency, InternationalSubConfigCodeType, BILL_NEW_PAYMENT_METHODS, NEW_INTERNATIONAL_METHOD_SUBTEXT, SWIFT_OUR_INTERNATIONAL_METHOD_SUBTEXT, LOCAL_CURRENCY_INTERNATIONAL_METHOD_SUBTEXT, AccountTypeSubConfigCodeKeyType } from './view/spendManagement/billPay/billPayConfig/billPayConfigState';
497
497
  import { getInternationalSubConfigCodeKey } from './view/spendManagement/billPay/billPayConfig/billPayConfigPayload';
498
- export { Country, BillPayConfig, BillPaymentConfigCodeType, BillPaymentSubConfigCodeType, getInternationalSubConfigCodeKey, InternationalSubConfigCodeType, BILL_NEW_PAYMENT_METHODS, NEW_INTERNATIONAL_METHOD_SUBTEXT, SWIFT_OUR_INTERNATIONAL_METHOD_SUBTEXT, LOCAL_CURRENCY_INTERNATIONAL_METHOD_SUBTEXT, };
498
+ export { Country, BillPayConfig, BillPaymentConfigCodeType, BillPaymentSubConfigCodeType, getInternationalSubConfigCodeKey, InternationalSubConfigCodeType, BILL_NEW_PAYMENT_METHODS, NEW_INTERNATIONAL_METHOD_SUBTEXT, SWIFT_OUR_INTERNATIONAL_METHOD_SUBTEXT, LOCAL_CURRENCY_INTERNATIONAL_METHOD_SUBTEXT, AccountTypeSubConfigCodeKeyType, };
499
499
  import { BillPayCardReport } from './view/billPayCard/billPayCardSelector';
500
500
  import { ReimbursementCardReport } from './view/reimbursementCard/reimbursementCardSelector';
501
501
  import { Recommendation } from './commonStateTypes/recommendationBase';
@@ -69,47 +69,51 @@ exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) =>
69
69
  }
70
70
  });
71
71
  const sortOrderValue = (0, sortOrderPayload_1.getSortOrder)(sortOrder);
72
- const sortedCompaniesWithSortKeyValue = (0, orderBy_1.default)(companiesWithSortKeyValues, (sortKey === 'auditScore') ? ['auditSummary.auditScorePercentage', 'auditSummary.fixesRequired'] : (company) => {
73
- var _a;
74
- const warningCount = (0, exports.getAuditWarningsCount)(company);
75
- let primarySortValue;
76
- let secondarySortValue;
77
- let isSecondarySortApplicable;
78
- switch (sortKey) {
79
- case 'notes':
80
- primarySortValue = (_a = company.note) === null || _a === void 0 ? void 0 : _a.toLowerCase();
81
- break;
82
- case 'uncategorized':
83
- isSecondarySortApplicable = true;
84
- primarySortValue = company.uncategorizedTransactions.income ? 1 : 0;
85
- secondarySortValue = company.uncategorizedTransactions.expense
86
- ? 1
87
- : 0;
88
- break;
89
- case 'miscategorized':
90
- isSecondarySortApplicable = true;
91
- primarySortValue = company.miscategorizedTransactions.income
92
- ? 1
93
- : 0;
94
- secondarySortValue = company.miscategorizedTransactions.expense
95
- ? 1
96
- : 0;
97
- break;
98
- case 'warnings':
99
- primarySortValue = warningCount;
100
- break;
101
- case 'reviewVendor':
102
- primarySortValue = company.isVendorReviewReqiured;
103
- break;
104
- case 'companyName':
105
- default:
106
- primarySortValue = company.name.toLowerCase();
107
- break;
108
- }
109
- return isSecondarySortApplicable === true
110
- ? [primarySortValue, secondarySortValue]
111
- : primarySortValue;
112
- }, [sortOrderValue, sortOrderValue]);
72
+ const sortedCompaniesWithSortKeyValue = (0, orderBy_1.default)(companiesWithSortKeyValues, sortKey === 'auditScore'
73
+ ? ['auditSummary.auditScorePercentage', 'auditSummary.fixesRequired']
74
+ : (company) => {
75
+ var _a;
76
+ const warningCount = (0, exports.getAuditWarningsCount)(company);
77
+ let primarySortValue;
78
+ let secondarySortValue;
79
+ let isSecondarySortApplicable;
80
+ switch (sortKey) {
81
+ case 'notes':
82
+ primarySortValue = (_a = company.note) === null || _a === void 0 ? void 0 : _a.toLowerCase();
83
+ break;
84
+ case 'uncategorized':
85
+ isSecondarySortApplicable = true;
86
+ primarySortValue = company.uncategorizedTransactions.income
87
+ ? 1
88
+ : 0;
89
+ secondarySortValue = company.uncategorizedTransactions.expense
90
+ ? 1
91
+ : 0;
92
+ break;
93
+ case 'miscategorized':
94
+ isSecondarySortApplicable = true;
95
+ primarySortValue = company.miscategorizedTransactions.income
96
+ ? 1
97
+ : 0;
98
+ secondarySortValue = company.miscategorizedTransactions.expense
99
+ ? 1
100
+ : 0;
101
+ break;
102
+ case 'warnings':
103
+ primarySortValue = warningCount;
104
+ break;
105
+ case 'reviewVendor':
106
+ primarySortValue = company.isVendorReviewReqiured;
107
+ break;
108
+ case 'companyName':
109
+ default:
110
+ primarySortValue = company.name.toLowerCase();
111
+ break;
112
+ }
113
+ return isSecondarySortApplicable === true
114
+ ? [primarySortValue, secondarySortValue]
115
+ : primarySortValue;
116
+ }, [sortOrderValue, sortOrderValue]);
113
117
  return {
114
118
  companies: [
115
119
  ...sortedCompaniesWithSortKeyValue,
@@ -1,6 +1,8 @@
1
- import { ActionsObservable } from 'redux-observable';
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../reducer';
3
4
  import { fetchBankConnectionsView, fetchBankAccountsList } from '../settingsViewReducer';
4
- import { getPaymentAccounts } from '../../spendManagement/plaidAccount/plaidAccountViewReducer';
5
- export declare type ActionType = ReturnType<typeof fetchBankConnectionsView> | ReturnType<typeof fetchBankAccountsList> | ReturnType<typeof getPaymentAccounts>;
6
- export declare const fetchBankConnectionsViewEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
5
+ import { fetchPaymentAccountList } from '../../spendManagement/zeniAccounts/paymentAccountList/paymentAccountListReducer';
6
+ import { fetchDepositAccountList } from '../../spendManagement/zeniAccounts/depositAccountList/depositAccountListReducer';
7
+ export declare type ActionType = ReturnType<typeof fetchBankConnectionsView> | ReturnType<typeof fetchBankAccountsList> | ReturnType<typeof fetchPaymentAccountList> | ReturnType<typeof fetchDepositAccountList>;
8
+ export declare const fetchBankConnectionsViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -4,11 +4,34 @@ exports.fetchBankConnectionsViewEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const settingsViewReducer_1 = require("../settingsViewReducer");
7
- const plaidAccountViewReducer_1 = require("../../spendManagement/plaidAccount/plaidAccountViewReducer");
8
- const fetchBankConnectionsViewEpic = (actions$) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchBankConnectionsView.match), (0, operators_1.switchMap)(() => {
9
- return (0, rxjs_1.from)([
10
- (0, settingsViewReducer_1.fetchBankAccountsList)(),
11
- (0, plaidAccountViewReducer_1.getPaymentAccounts)('bill_pay', 'spend_management_setup', false),
12
- ]);
7
+ const paymentAccountListReducer_1 = require("../../spendManagement/zeniAccounts/paymentAccountList/paymentAccountListReducer");
8
+ const depositAccountListReducer_1 = require("../../spendManagement/zeniAccounts/depositAccountList/depositAccountListReducer");
9
+ const fetchBankConnectionsViewEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchBankConnectionsView.match), (0, operators_1.mergeMap)((action) => {
10
+ const { cacheOverride } = action.payload;
11
+ const bankConnectionActions = [];
12
+ const state = state$.value;
13
+ if (cacheOverride === true) {
14
+ bankConnectionActions.push((0, settingsViewReducer_1.fetchBankAccountsList)());
15
+ bankConnectionActions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
16
+ bankConnectionActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
17
+ }
18
+ else {
19
+ const bankAccountsList = state.settingsViewState.bankConnection;
20
+ if (bankAccountsList.fetchState !== 'Completed' &&
21
+ bankAccountsList.fetchState !== 'In-Progress') {
22
+ bankConnectionActions.push((0, settingsViewReducer_1.fetchBankAccountsList)());
23
+ }
24
+ const paymentAccountList = state.paymentAccountListState;
25
+ if (paymentAccountList.hasValidState() === false &&
26
+ paymentAccountList.fetchState !== 'In-Progress') {
27
+ bankConnectionActions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
28
+ }
29
+ const depositAccountList = state.depositAccountListState;
30
+ if (depositAccountList.hasValidState() === false &&
31
+ depositAccountList.fetchState !== 'In-Progress') {
32
+ bankConnectionActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
33
+ }
34
+ }
35
+ return (0, rxjs_1.concat)((0, rxjs_1.from)(bankConnectionActions));
13
36
  }));
14
37
  exports.fetchBankConnectionsViewEpic = fetchBankConnectionsViewEpic;
@@ -11,7 +11,9 @@ export declare const fetchMyProfileView: import("@reduxjs/toolkit").ActionCreato
11
11
  companyId: string;
12
12
  }, string, never, never>, updateMyProfileOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userId: string], {
13
13
  userId: string;
14
- }, string, never, never>, updateMyProfileOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchBankConnectionsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, fetchBillingAccountsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateBankConnectionOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
14
+ }, string, never, never>, updateMyProfileOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchBankConnectionsView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride: any], {
15
+ cacheOverride: any;
16
+ }, string, never, never>, fetchBillingAccountsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateBankConnectionOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
15
17
  bankAccountIds: ID[];
16
18
  }, string>, updateBankConnectionOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchBankAccountsList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, fetchNotificationSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateNotificationSettingsOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[data: NotificationSettingsPayload, loggedInUserEmail: string], {
17
19
  data: NotificationSettingsPayload;
@@ -94,8 +94,17 @@ const settings = (0, toolkit_1.createSlice)({
94
94
  draft.profile.fetchState = 'Error';
95
95
  draft.profile.error = action.payload;
96
96
  },
97
- fetchBankConnectionsView() {
98
- // Do nothing.
97
+ fetchBankConnectionsView: {
98
+ reducer() {
99
+ // do nothing
100
+ },
101
+ prepare(cacheOverride) {
102
+ return {
103
+ payload: {
104
+ cacheOverride,
105
+ },
106
+ };
107
+ },
99
108
  },
100
109
  fetchBillingAccountsView() {
101
110
  // Do nothing.
@@ -3,7 +3,7 @@ import { FetchStateAndError, ID } from '../../commonStateTypes/common';
3
3
  import { MyBankConnectionsView, BankConnectionsSetupView, MyProfileSelectorView, NotificationSettingsSelectorView, IntegrationsView, BillingView } from './types/settingsViewSelectorTypes';
4
4
  import { NotificationSettings } from './settingsViewState';
5
5
  export declare function getApprovalRuleViewDetails(state: RootState): FetchStateAndError;
6
- export declare function getBankConnectionsSetupViewDetails(state: RootState, companyId: ID): BankConnectionsSetupView;
6
+ export declare function getBankConnectionsSetupViewDetails(state: RootState, companyId: ID, isAccountEnabled: boolean, isCardEnabled: boolean): BankConnectionsSetupView;
7
7
  export declare function getBillingAccountsViewDetails(state: RootState, companyId: ID): BillingView;
8
8
  export declare function getMyBankConnectionsDetails(state: RootState, userId: ID): MyBankConnectionsView;
9
9
  export declare function getIntegrationsView(state: RootState, companyId: ID): IntegrationsView;
@@ -19,6 +19,8 @@ const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
19
19
  const companyPassportViewSelector_1 = require("../companyView/selector/companyPassportViewSelector");
20
20
  const userFinancialAccountSelector_1 = require("../userFinancialAccount/userFinancialAccountSelector");
21
21
  const setupViewSelector_1 = require("../../view/spendManagement/commonSetup/setupViewSelector");
22
+ const depositAccountSelector_1 = require("../../entity/depositAccount/depositAccountSelector");
23
+ const getCompanyView_1 = require("../companyView/selectorHelpers/getCompanyView");
22
24
  const cardPaymentViewSelector_1 = require("../cardPayment/cardPaymentViewSelector");
23
25
  function getApprovalRuleViewDetails(state) {
24
26
  const { billPaySetupApproverViewState, remiSetupApproverViewState } = state;
@@ -31,18 +33,65 @@ function getApprovalRuleViewDetails(state) {
31
33
  };
32
34
  }
33
35
  exports.getApprovalRuleViewDetails = getApprovalRuleViewDetails;
34
- function getBankConnectionsSetupViewDetails(state, companyId) {
35
- const { accountState, plaidAccountViewState, settingsViewState } = state;
36
+ function getBankConnectionsSetupViewDetails(state, companyId, isAccountEnabled, isCardEnabled) {
37
+ var _a, _b, _c, _d, _e, _f;
38
+ const { accountState, settingsViewState, paymentAccountState, depositAccountState, depositAccountListState, paymentAccountListState, } = state;
36
39
  const { bankConnection } = settingsViewState;
37
- const allBankAccounts = bankConnection.bankAccountIds
38
- .map((accountId) => (0, accountSelector_1.getAccountBase)(accountState, accountId, 'bill_pay'))
39
- .filter((account) => account != null);
40
+ const { paymentAccountIds } = paymentAccountListState;
41
+ const { accountIds: depositAccountIds } = depositAccountListState;
42
+ const allBankAccounts = bankConnection.fetchState === 'Completed'
43
+ ? bankConnection.bankAccountIds
44
+ .map((accountId) => (0, accountSelector_1.getAccountBase)(accountState, accountId, 'bill_pay'))
45
+ .filter((account) => account != null)
46
+ : [];
47
+ const paymentAccounts = paymentAccountListState.hasValidState()
48
+ ? (_a = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, paymentAccountIds).filter((account) => account != null)) !== null && _a !== void 0 ? _a : []
49
+ : [];
50
+ const depositAccounts = depositAccountListState.hasValidState()
51
+ ? (_b = (0, depositAccountSelector_1.getDepositAccountsByDepositAccountIds)(depositAccountState, depositAccountIds).filter((account) => account != null)) !== null && _b !== void 0 ? _b : []
52
+ : [];
40
53
  const fetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
41
54
  settingsViewState.bankConnection,
42
- plaidAccountViewState['spend_management_setup'].accountDetails.fetchStatus,
55
+ paymentAccountListState,
56
+ depositAccountListState,
43
57
  ]);
58
+ const allFundingAccounts = fetchState.fetchState === 'Completed'
59
+ ? (0, setupViewSelector_1.getAllFundingAccounts)(depositAccounts, paymentAccounts, false)
60
+ : [];
61
+ const primaryAccountsProductWise = [
62
+ Object.assign({ productType: 'bill_pay' }, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'bill_pay', 'bill_pay_setup')),
63
+ Object.assign({ productType: 'reimbursement' }, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'reimbursement', 'reimbursement_setup')),
64
+ ];
65
+ if (isAccountEnabled) {
66
+ primaryAccountsProductWise.push(Object.assign({ productType: 'zeni_accounts' }, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'zeni_accounts', 'account_setup')));
67
+ }
68
+ if (isCardEnabled) {
69
+ primaryAccountsProductWise.push(Object.assign({ productType: 'charge_cards' }, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'charge_cards', 'charge_card_setup')));
70
+ }
71
+ const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
72
+ const billPayPrimaryAccount = (_c = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyBillPayInfo.primaryFundingAccount) === null || _c === void 0 ? void 0 : _c.accountId; //companyBillPayInfo
73
+ const remiPrimaryAccount = (_d = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyReimbursementInfo.primaryFundingAccount) === null || _d === void 0 ? void 0 : _d.accountId;
74
+ const accountsPrimaryAccount = (_e = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyZeniAccountInfo.primaryFundingAccount) === null || _e === void 0 ? void 0 : _e.accountId; //companyZeniAccountInfo
75
+ const chargeCardsPrimaryAccount = (_f = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyChargeCardInfo.primaryFundingAccount) === null || _f === void 0 ? void 0 : _f.accountId; //companyChargeCardInfo
76
+ const primaryAccounts = [];
77
+ if (billPayPrimaryAccount) {
78
+ primaryAccounts.push(billPayPrimaryAccount);
79
+ }
80
+ if (remiPrimaryAccount) {
81
+ primaryAccounts.push(remiPrimaryAccount);
82
+ }
83
+ if (accountsPrimaryAccount) {
84
+ primaryAccounts.push(accountsPrimaryAccount);
85
+ }
86
+ if (chargeCardsPrimaryAccount) {
87
+ primaryAccounts.push(chargeCardsPrimaryAccount);
88
+ }
89
+ const nonPrimaryPaymentAccounts = paymentAccounts.filter((paymentAcc) => !primaryAccounts.includes(paymentAcc.paymentAccountId));
44
90
  return {
45
- setupView: Object.assign(Object.assign({}, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'bill_pay', 'spend_management_setup')), { allBankAccounts }),
91
+ primaryConnection: primaryAccountsProductWise,
92
+ otherPaymentAccounts: nonPrimaryPaymentAccounts,
93
+ allFundingAccounts,
94
+ allBankAccounts,
46
95
  fetchState: fetchState.fetchState,
47
96
  };
48
97
  }
@@ -5,11 +5,13 @@ import { PaymentAccount } from '../../../entity/paymentAccount/paymentAccountSta
5
5
  import { User } from '../../../entity/user/userState';
6
6
  import { UserRole } from '../../../entity/userRole/userRoleState';
7
7
  import { Person } from '../../people/peopleSelectorTypes';
8
- import { SetupView } from '../../spendManagement/commonSetup/setupViewSelector';
8
+ import { FundingAccount, SetupView } from '../../spendManagement/commonSetup/setupViewSelector';
9
9
  import { UserFinancialAccountSelectorView } from '../../userFinancialAccount/userFinancialAccountSelector';
10
10
  import { IntegrationsSettings, NotificationSettings, SettingsViewUIState } from '../settingsViewState';
11
11
  import { TenantExternalConnections } from '../../../entity/tenant/tenantState';
12
12
  import { Company } from '../../../entity/company/companyStateTypes';
13
+ import { EntityType as SpendManagementEntityType } from '../../../entity/entityApprovalStatus/entityApprovalStatusState';
14
+ import { AccountBase } from '../../../entity/account/accountState';
13
15
  import { CardPaymentSelectorView } from '../../cardPayment/cardPaymentViewSelector';
14
16
  export interface MyProfileSelectorView extends SelectorView {
15
17
  isZeniUser: boolean;
@@ -29,13 +31,19 @@ export interface MyBankConnectionsView extends UserFinancialAccountSelectorView
29
31
  paymentAccounts: PaymentAccount[];
30
32
  }
31
33
  export interface BankConnectionsSetupView extends FetchStateAndError {
32
- setupView: SetupView;
34
+ primaryConnection: ProductWisePrimaryAccount[];
35
+ otherPaymentAccounts: PaymentAccount[];
36
+ allFundingAccounts: FundingAccount[];
37
+ allBankAccounts: AccountBase[];
33
38
  }
34
39
  export interface BillingView extends FetchStateAndError {
35
40
  setupView: SetupView;
36
41
  cardPaymentView: CardPaymentSelectorView;
37
42
  uiState: SettingsViewUIState;
38
43
  }
44
+ export interface ProductWisePrimaryAccount extends SetupView {
45
+ productType: SpendManagementEntityType;
46
+ }
39
47
  export interface NotificationSettingsSelectorView extends NotificationSettings {
40
48
  allUsers: User[];
41
49
  classList: Class[];
@@ -3,13 +3,12 @@ import { Observable } from 'rxjs';
3
3
  import { convertAmountToHomeCurrency, initializeBillToLocalStore, saveBillUpdatesToLocalStore, updateEditBillFetchStateCompleted } from '../editBillViewReducer';
4
4
  import { RootState } from '../../../../../reducer';
5
5
  import { fetchClassList } from '../../../../classList/classListReducer';
6
- import { getPaymentAccounts } from '../../../plaidAccount/plaidAccountViewReducer';
7
6
  import { LineItemRecommendationsLocalData } from '../editBillViewSelector';
8
7
  import { RecommendationByLineId } from '../../../../../entity/transaction/stateTypes/transaction';
9
8
  import { Vendor } from '../../../../../entity/vendor/vendorState';
10
9
  import { AccountListSelectorView } from '../../../../accountList/accountListSelector';
11
10
  import { ClassListSelectorView } from '../../../../classList/classListSelector';
12
11
  import Line from '../../../../../entity/transaction/stateTypes/transactionLine';
13
- export declare type ActionType = ReturnType<typeof initializeBillToLocalStore> | ReturnType<typeof saveBillUpdatesToLocalStore> | ReturnType<typeof fetchClassList> | ReturnType<typeof updateEditBillFetchStateCompleted> | ReturnType<typeof getPaymentAccounts> | ReturnType<typeof convertAmountToHomeCurrency>;
12
+ export declare type ActionType = ReturnType<typeof initializeBillToLocalStore> | ReturnType<typeof saveBillUpdatesToLocalStore> | ReturnType<typeof fetchClassList> | ReturnType<typeof updateEditBillFetchStateCompleted> | ReturnType<typeof convertAmountToHomeCurrency>;
14
13
  export declare const getLineRecommendationsLocalData: (lineId: string, line: Line, recommendations: RecommendationByLineId | undefined, accountList: AccountListSelectorView, classList: ClassListSelectorView, vendorDetails?: Vendor | undefined) => LineItemRecommendationsLocalData;
15
14
  export declare const initializeBillToLocalStoreEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -6,7 +6,7 @@ const operators_1 = require("rxjs/operators");
6
6
  const responsePayload_1 = require("../../../../../responsePayload");
7
7
  const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
8
8
  const plaidAccountViewReducer_1 = require("../../plaidAccountViewReducer");
9
- const getPlaidLinkTokenEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(plaidAccountViewReducer_1.getPlaidLinkToken.match), (0, operators_1.switchMap)((action) => {
9
+ const getPlaidLinkTokenEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(plaidAccountViewReducer_1.getPlaidLinkToken.match), (0, operators_1.mergeMap)((action) => {
10
10
  const { linkTokenType, paymentAccountId, plaidAccountKeyType } = action.payload;
11
11
  return zeniAPI
12
12
  .getJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/plaid/link-token?query=${JSON.stringify((0, exports.toLinkTokenPayload)(linkTokenType, paymentAccountId))}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.11.46",
3
+ "version": "4.11.47",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",