@zeniai/client-epic-state 4.10.96 → 4.10.97

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.
@@ -10,11 +10,13 @@ const paymentAccountSelector_1 = require("../../../entity/paymentAccount/payment
10
10
  const depositAccountSelector_1 = require("../../../entity/depositAccount/depositAccountSelector");
11
11
  const depositAccountPayload_1 = require("../../../entity/depositAccount/depositAccountPayload");
12
12
  function getCommonSetupViewDetails(state, companyId, setupViewType, plaidAccountKeyType) {
13
- var _a, _b, _c;
14
- const { accountState, setupViewState, paymentAccountState, depositAccountState, plaidAccountViewState, } = state;
13
+ var _a, _b, _c, _d;
14
+ const { accountState, setupViewState, paymentAccountState, paymentAccountListState, depositAccountState, depositAccountListState, plaidAccountViewState, } = state;
15
15
  const { updateStatus } = setupViewState;
16
16
  const { accountDetails, plaidConnectionDetails } = (0, plaidAccountViewSelector_1.getPlaidAccountDetails)(plaidAccountViewState, plaidAccountKeyType);
17
- const { allBankAccountIds, paymentAccountIds, depositAccountIds, primaryFundingAccount, } = accountDetails;
17
+ const { allBankAccountIds, primaryFundingAccount } = accountDetails;
18
+ const { paymentAccountIds } = paymentAccountListState;
19
+ const { accountIds: depositAccountIds } = depositAccountListState;
18
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 : [];
19
21
  const paymentAccounts = (_b = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, paymentAccountIds).filter((account) => account != null)) !== null && _b !== void 0 ? _b : [];
20
22
  const depositAccounts = (_c = (0, depositAccountSelector_1.getDepositAccountsByDepositAccountIds)(depositAccountState, depositAccountIds).filter((account) => account != null)) !== null && _c !== void 0 ? _c : [];
@@ -23,8 +25,9 @@ function getCommonSetupViewDetails(state, companyId, setupViewType, plaidAccount
23
25
  const companyBillPayInfo = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyBillPayInfo;
24
26
  let paymentAccount;
25
27
  let primaryAccount = undefined;
26
- if ((paymentAccountIds === null || paymentAccountIds === void 0 ? void 0 : paymentAccountIds.length) > 0) {
27
- const paymentAccountId = paymentAccountIds[0];
28
+ if (((_d = accountDetails.paymentAccountIds) === null || _d === void 0 ? void 0 : _d.length) > 0) {
29
+ // paymentAccount is used for products other than reimbursement
30
+ const paymentAccountId = accountDetails.paymentAccountIds[0];
28
31
  paymentAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, paymentAccountId);
29
32
  }
30
33
  // For reimbursement setup, use primaryFundingAccount as the payment account.
@@ -14,5 +14,7 @@ import { updateSetupViewLocalStoreData } from '../../../../commonSetup/setupView
14
14
  import { fetchRemiSetupView, fetchRemiSetupViewSuccess, fetchRemiSetupViewFailure, updateRemiSetupViewLocalStoreData } from '../../remiSetupViewReducer';
15
15
  import { updatePlaidAccountViewAccountDetails } from '../../../../plaidAccount/plaidAccountViewReducer';
16
16
  import { updateDepositAccounts } from '../../../../../../entity/depositAccount/depositAccountReducer';
17
- export declare type ActionType = ReturnType<typeof fetchRemiSetupView> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updateDepositAccounts> | ReturnType<typeof updatePlaidAccountViewAccountDetails> | ReturnType<typeof updateSetupViewLocalStoreData> | ReturnType<typeof updateRemiSetupViewLocalStoreData> | ReturnType<typeof openSnackbar> | ReturnType<typeof fetchRemiSetupViewSuccess> | ReturnType<typeof fetchRemiSetupViewFailure>;
17
+ import { updatePaymentAccountList } from '../../../../zeniAccounts/paymentAccountList/paymentAccountListReducer';
18
+ import { updateDepositAccountList } from '../../../../zeniAccounts/depositAccountList/depositAccountListReducer';
19
+ export declare type ActionType = ReturnType<typeof fetchRemiSetupView> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updateDepositAccounts> | ReturnType<typeof updatePlaidAccountViewAccountDetails> | ReturnType<typeof updateSetupViewLocalStoreData> | ReturnType<typeof updateRemiSetupViewLocalStoreData> | ReturnType<typeof openSnackbar> | ReturnType<typeof fetchRemiSetupViewSuccess> | ReturnType<typeof fetchRemiSetupViewFailure> | ReturnType<typeof updatePaymentAccountList> | ReturnType<typeof updateDepositAccountList>;
18
20
  export declare const fetchRemiSetupViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -19,6 +19,8 @@ const plaidAccountViewReducer_1 = require("../../../../plaidAccount/plaidAccount
19
19
  const billPayConfigPayload_1 = require("../../../../billPay/billPayConfig/billPayConfigPayload");
20
20
  const billPayConfigState_1 = require("../../../../billPay/billPayConfig/billPayConfigState");
21
21
  const depositAccountReducer_1 = require("../../../../../../entity/depositAccount/depositAccountReducer");
22
+ const paymentAccountListReducer_1 = require("../../../../zeniAccounts/paymentAccountList/paymentAccountListReducer");
23
+ const depositAccountListReducer_1 = require("../../../../zeniAccounts/depositAccountList/depositAccountListReducer");
22
24
  const fetchRemiSetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(remiSetupViewReducer_1.fetchRemiSetupView.match), (0, operators_1.switchMap)((action) => {
23
25
  var _a;
24
26
  const { companyId, cacheOverride, refreshViewInBackground } = action.payload;
@@ -32,7 +34,7 @@ const fetchRemiSetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
32
34
  return zeniAPI
33
35
  .getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}?query={"view":"reimbursement_setup"}`)
34
36
  .pipe((0, operators_1.mergeMap)((response) => {
35
- var _a, _b;
37
+ var _a, _b, _c, _d;
36
38
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
37
39
  const allBankAccountIds = response.data.accounts.map((account) => account.account_id);
38
40
  const paymentAccountIds = response.data.payment_accounts.map((paymentAccount) => paymentAccount.payment_account_id);
@@ -57,7 +59,15 @@ const fetchRemiSetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
57
59
  (0, fileReducer_1.updateFiles)({ files: response.data.files }),
58
60
  (0, accountReducer_1.updateAccounts)(response.data.accounts, 'reimbursement'),
59
61
  (0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
62
+ (0, paymentAccountListReducer_1.updatePaymentAccountList)({
63
+ data: response.data.payment_accounts,
64
+ updateType: 'replace',
65
+ }),
60
66
  (0, depositAccountReducer_1.updateDepositAccounts)((_b = response.data.deposit_accounts) !== null && _b !== void 0 ? _b : []),
67
+ (0, depositAccountListReducer_1.updateDepositAccountList)({
68
+ data: (_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.deposit_accounts) !== null && _d !== void 0 ? _d : [],
69
+ updateType: 'replace',
70
+ }),
61
71
  (0, setupViewReducer_1.updateSetupViewLocalStoreData)({
62
72
  companyId: response.data.companies[0].company_id,
63
73
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.10.96",
3
+ "version": "4.10.97",
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",