@zeniai/client-epic-state 4.13.21 → 4.13.22

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
@@ -641,7 +641,7 @@ export { CompanyHealthMetric, CompanyRunway, updateCompaniesHealth, updateCompan
641
641
  export { clearCompanyHealthMetricView, fetchCompanyHealthMetricView, initializeCompanyHealthMetricViewLocalData, removeSelectedCompanyId, saveCompanyHealthMetricById, updateCompanyHealthMetricLocalStore, updateCompanyHealthMetricViewErrorStatus, updateCompanyHealthMetricViewSuccessStatus, updateCompanyHealthViewUIState, };
642
642
  import { ChargeCardViewSortKey, ChargeCardListUIState, toChargeCardSortKeyType } from './view/spendManagement/chargeCards/chargeCardList/chargeCardList';
643
643
  import { ChargeCardListSelectorView, ChargeCardWithUser, ChargeCardWithUserAndShippingAddress, getChargeCardListView, getMyChargeCardListWithShippingAddress, getCreditAccount, anyCardOnHold, ChargeCardListWithShippingAddressSelectorView } from './view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector';
644
- import { IssueChargeCardLocalData, IssueChargeCardState, PhysicalCardData, VirtualCardData } from './view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState';
644
+ import { IssueChargeCardLocalData, IssueChargeCardState, PhysicalCardData, VirtualCardData, ActiveChargeCardCount } from './view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState';
645
645
  import { fetchChargeCardConfig } from './view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer';
646
646
  import { IssueChargeCardSelectorView, getIssueChargeCardView } from './view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector';
647
647
  import { ChargeCard, CreditLimitFrequency, CreditLimitFrequencyCodeType, toCreditLimitFrequencyCodeType, CardCodeType, toCardType, CardAddressType, toCardAddressType, ShippingAddressType, toShippingAddressType, CardStatusCodeType, CardActivationEventCodeType } from './entity/chargeCard/chargeCard';
@@ -663,7 +663,7 @@ import { CardUserOnboardingLocalData } from './view/spendManagement/chargeCards/
663
663
  import { initializeCardUserOnboardingLocalData, updateCardUserOnboardingLocalData, saveCardOnboardingUserDetails, startActivationWait, completeActivationWait, setFirstViewAfterActivation, setFirstViewCompleteAfterActivation, setCurrentDisplayedCardId } from './view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingReducer';
664
664
  import { getCardUserOnboardingView, CardUserOnboardingView } from './view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingSelector';
665
665
  import { issueChargeCards, resetIssueChargeCardForm, updateChargeCardsLocalStore, updateCustomAddressId, fetchIssueCardPage } from './view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer';
666
- export { CardStatusCodeType, updateChargeCardTransactionAttachments, TransactionReceiptsPayload, ProductServices, ProductServiceKey, isCompanyRunwayInfinite, getCompanyHealthMetricView, hasCompanyHealthMetricFormFieldChanged, companyHealthMetricDropDownOptions, CompanyHealthMetricViewSelector, CompanyHealthMetricDropDownOption, CompanyDetailWithHealthMetric, ChargeCardBusinessVerificationDetails, getChargeCardBusinessVerificationDetails, fetchChargeCardList, fetchChargeCardListPage, fetchChargeCardConfig, fetchCreditAccount, getChargeCardListView, getMyChargeCardListWithShippingAddress, getCreditAccount, ChargeCardStatementsSelectorView, fetchChargeCardDetailPage, getChargeCardDetailView, ChargeCardTransactionAttachmentView, getChargeCardTransactionAttachmentView, fetchChargeCardTransactionList, fetchCashbackDetail, ChargeCard, ChargeCardWithUser, ChargeCardWithUserAndShippingAddress, ChargeCardViewSortKey, toChargeCardSortKeyType, CashbackPeriod, CashbackDetailUIState, CashbackViewSortKey, getCashbackDetail, CashbackDetailSelectorView, toCreditLimitFrequencyCodeType, ChargeCardListSelectorView, ChargeCardListWithShippingAddressSelectorView, ChargeCardDetailSelectorView, IssueChargeCardSelectorView, IssueChargeCardState, getIssueChargeCardView, ChargeCardConfigState, ChargeCardListUIState, ChargeCardTransaction, ChargeCardTransactionStatusCode, ChargeCardTransactionTypeCode, ChargeCardTransactionStatus, ChargeCardDetailUiState, ChargeCardTransactionSortKey, getChargeCardSetupViewDetails, ChargeCardSetupView, fetchChargeCardStatementList, ChargeCardStatement, getChargeCardStatements, fetchChargeCardSetupView, acceptChargeCardTerms, IssueChargeCardLocalData, PhysicalCardData, VirtualCardData, CreditLimitFrequencyCodeType, CardAddressType, toCardAddressType, ShippingAddressType, toShippingAddressType, CardActivationEventCodeType, CreditLimitFrequency, CardCodeType, toCardType, issueChargeCards, fetchIssueCardPage, updateCustomAddressId, updateChargeCardsLocalStore, resetIssueChargeCardForm, updateChargeCardListSearchText, updateChargeCardListUIState, updateCashbackDetailUIState, updateChargeCardDetail, updatePhysicalChargeCardAttempt, CardUserOnboardingLocalData, getCardUserOnboardingView, initializeCardUserOnboardingLocalData, updateCardUserOnboardingLocalData, CardUserOnboardingView, saveCardOnboardingUserDetails, updateChargeCardTransactionUploadReceiptsFetchStatus, updateChargeCardTransactionReceiptsShowTickFetchStatus, updateChargeCardTransactionIsViewReceiptClicked, fetchChargeCardTransactionAttachments, resendCardInvite, revokeCardInvite, startActivationWait, completeActivationWait, setFirstViewAfterActivation, setFirstViewCompleteAfterActivation, setCurrentDisplayedCardId, anyCardOnHold, };
666
+ export { CardStatusCodeType, updateChargeCardTransactionAttachments, TransactionReceiptsPayload, ProductServices, ProductServiceKey, isCompanyRunwayInfinite, getCompanyHealthMetricView, hasCompanyHealthMetricFormFieldChanged, companyHealthMetricDropDownOptions, CompanyHealthMetricViewSelector, CompanyHealthMetricDropDownOption, CompanyDetailWithHealthMetric, ChargeCardBusinessVerificationDetails, getChargeCardBusinessVerificationDetails, fetchChargeCardList, fetchChargeCardListPage, fetchChargeCardConfig, fetchCreditAccount, getChargeCardListView, getMyChargeCardListWithShippingAddress, getCreditAccount, ChargeCardStatementsSelectorView, fetchChargeCardDetailPage, getChargeCardDetailView, ChargeCardTransactionAttachmentView, getChargeCardTransactionAttachmentView, fetchChargeCardTransactionList, fetchCashbackDetail, ChargeCard, ChargeCardWithUser, ChargeCardWithUserAndShippingAddress, ChargeCardViewSortKey, toChargeCardSortKeyType, CashbackPeriod, CashbackDetailUIState, CashbackViewSortKey, getCashbackDetail, CashbackDetailSelectorView, toCreditLimitFrequencyCodeType, ChargeCardListSelectorView, ChargeCardListWithShippingAddressSelectorView, ChargeCardDetailSelectorView, IssueChargeCardSelectorView, ActiveChargeCardCount, IssueChargeCardState, getIssueChargeCardView, ChargeCardConfigState, ChargeCardListUIState, ChargeCardTransaction, ChargeCardTransactionStatusCode, ChargeCardTransactionTypeCode, ChargeCardTransactionStatus, ChargeCardDetailUiState, ChargeCardTransactionSortKey, getChargeCardSetupViewDetails, ChargeCardSetupView, fetchChargeCardStatementList, ChargeCardStatement, getChargeCardStatements, fetchChargeCardSetupView, acceptChargeCardTerms, IssueChargeCardLocalData, PhysicalCardData, VirtualCardData, CreditLimitFrequencyCodeType, CardAddressType, toCardAddressType, ShippingAddressType, toShippingAddressType, CardActivationEventCodeType, CreditLimitFrequency, CardCodeType, toCardType, issueChargeCards, fetchIssueCardPage, updateCustomAddressId, updateChargeCardsLocalStore, resetIssueChargeCardForm, updateChargeCardListSearchText, updateChargeCardListUIState, updateCashbackDetailUIState, updateChargeCardDetail, updatePhysicalChargeCardAttempt, CardUserOnboardingLocalData, getCardUserOnboardingView, initializeCardUserOnboardingLocalData, updateCardUserOnboardingLocalData, CardUserOnboardingView, saveCardOnboardingUserDetails, updateChargeCardTransactionUploadReceiptsFetchStatus, updateChargeCardTransactionReceiptsShowTickFetchStatus, updateChargeCardTransactionIsViewReceiptClicked, fetchChargeCardTransactionAttachments, resendCardInvite, revokeCardInvite, startActivationWait, completeActivationWait, setFirstViewAfterActivation, setFirstViewCompleteAfterActivation, setCurrentDisplayedCardId, anyCardOnHold, };
667
667
  import { AgingBalance, AgingPeriod } from './commonStateTypes/agingBalance/agingBalance';
668
668
  import { fetchApAging, updateApAgingUIState } from './view/apAgingView/apAgingReport/apAgingReducer';
669
669
  import { ApAgingReport, getApAgingReport, AgingBalancesByVendor } from './view/apAgingView/apAgingReport/apAgingSelector';
@@ -2,8 +2,9 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { Observable } from 'rxjs';
3
3
  import { RootState } from '../../../../reducer';
4
4
  import { fetchUserListByType } from '../../../userListView/userListViewReducer';
5
+ import { fetchClassList } from '../../../classList/classListReducer';
5
6
  import { fetchChargeCardConfig } from '../chargeCardConfig/chargeCardConfigReducer';
6
7
  import { fetchIssueCardPage } from './issueChargeCardReducer';
7
- import { fetchCreditAccount } from '../chargeCardList/chargeCardListReducer';
8
- export declare type ActionType = ReturnType<typeof fetchIssueCardPage> | ReturnType<typeof fetchChargeCardConfig> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchCreditAccount>;
8
+ import { fetchChargeCardList, fetchCreditAccount } from '../chargeCardList/chargeCardListReducer';
9
+ export declare type ActionType = ReturnType<typeof fetchIssueCardPage> | ReturnType<typeof fetchChargeCardConfig> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchChargeCardList> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchCreditAccount>;
9
10
  export declare const fetchIssueCardPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -16,7 +16,6 @@ const fetchIssueCardPageEpic = (actions$, state$) => actions$.pipe((0, operators
16
16
  issueCardPageAction.push((0, chargeCardConfigReducer_1.fetchChargeCardConfig)());
17
17
  issueCardPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
18
18
  issueCardPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardHolderCandidate', true));
19
- issueCardPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardAdmin', true));
20
19
  issueCardPageAction.push((0, classListReducer_1.fetchClassList)());
21
20
  issueCardPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
22
21
  }
@@ -31,25 +30,19 @@ const fetchIssueCardPageEpic = (actions$, state$) => actions$.pipe((0, operators
31
30
  chargeCardList.creditAccount.fetchState !== 'In-Progress') {
32
31
  issueCardPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
33
32
  }
34
- if (chargeCardList.fetchState !== 'Completed' &&
35
- chargeCardList.fetchState !== 'In-Progress') {
36
- issueCardPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
37
- }
38
33
  const userList = state.userListViewState.userListByType.cardHolderCandidate;
39
34
  if (userList.fetchState !== 'In-Progress' &&
40
35
  userList.hasValidState() === false) {
41
36
  issueCardPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardHolderCandidate', false));
42
37
  }
43
- const userAdminList = state.userListViewState.userListByType.cardAdmin;
44
- if (userAdminList.fetchState !== 'In-Progress' &&
45
- userAdminList.hasValidState() === false) {
46
- issueCardPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardAdmin', false));
47
- }
48
- const classList = state.classListState;
49
- if (classList.fetchState !== 'In-Progress' &&
50
- classList.hasValidState() === false) {
38
+ if (state.classListState.hasValidState() === false &&
39
+ state.classListState.fetchState !== 'In-Progress') {
51
40
  issueCardPageAction.push((0, classListReducer_1.fetchClassList)());
52
41
  }
42
+ if (chargeCardList.fetchState !== 'Completed' &&
43
+ chargeCardList.fetchState !== 'In-Progress') {
44
+ issueCardPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
45
+ }
53
46
  }
54
47
  return (0, rxjs_1.concat)((0, rxjs_1.from)(issueCardPageAction));
55
48
  }));
@@ -1,6 +1,7 @@
1
1
  import { ZeniAPIStatus } from '../../../../responsePayload';
2
2
  import { FetchState, ID } from '../../../../commonStateTypes/common';
3
3
  import { IssueChargeCardState, IssueChargeCardLocalData } from './issueChargeCardState';
4
+ import { ActiveChargeCardCountPayload } from '../../../userListView/userListViewPayload';
4
5
  export declare const initialState: IssueChargeCardState;
5
6
  export declare const issueChargeCards: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[], {}, string, never, never>, updateChargeCardsLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPayload<IssueChargeCardLocalData[], string>, issueChargeCardSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
6
7
  fetchState: FetchState;
@@ -8,7 +9,7 @@ export declare const issueChargeCards: import("@reduxjs/toolkit").ActionCreatorW
8
9
  }, string>, resetIssueChargeCardForm: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateCustomAddressId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
9
10
  addressId: ID;
10
11
  cardLineId: ID;
11
- }, string>, fetchIssueCardPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any], {
12
+ }, string>, updateCardCount: import("@reduxjs/toolkit").ActionCreatorWithPayload<ActiveChargeCardCountPayload[], string>, fetchIssueCardPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any], {
12
13
  cacheOverride: any;
13
14
  }, string, never, never>, clearIssueChargeCard: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
14
15
  declare const _default: import("@reduxjs/toolkit").Reducer<IssueChargeCardState, import("@reduxjs/toolkit").AnyAction>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearIssueChargeCard = exports.fetchIssueCardPage = exports.updateCustomAddressId = exports.resetIssueChargeCardForm = exports.issueChargeCardSuccessOrFailure = exports.updateChargeCardsLocalStore = exports.issueChargeCards = exports.initialState = void 0;
4
+ exports.clearIssueChargeCard = exports.fetchIssueCardPage = exports.updateCardCount = exports.updateCustomAddressId = exports.resetIssueChargeCardForm = exports.issueChargeCardSuccessOrFailure = exports.updateChargeCardsLocalStore = exports.issueChargeCards = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const issueChargeCardState_1 = require("./issueChargeCardState");
7
7
  exports.initialState = {
@@ -15,6 +15,7 @@ exports.initialState = {
15
15
  hasValidState() {
16
16
  return this.fetchState == 'Completed';
17
17
  },
18
+ activeCardCount: {},
18
19
  };
19
20
  const issueChargeCard = (0, toolkit_1.createSlice)({
20
21
  name: 'issueChargeCard',
@@ -44,6 +45,7 @@ const issueChargeCard = (0, toolkit_1.createSlice)({
44
45
  },
45
46
  resetIssueChargeCardForm(draft) {
46
47
  draft.localData = [...exports.initialState.localData];
48
+ draft.saveStatus = exports.initialState.saveStatus;
47
49
  },
48
50
  issueChargeCardSuccessOrFailure(draft, action) {
49
51
  draft.saveStatus.fetchState = action.payload.fetchState;
@@ -56,10 +58,18 @@ const issueChargeCard = (0, toolkit_1.createSlice)({
56
58
  draft.localData[targetIndex] = Object.assign(Object.assign({}, draft.localData[targetIndex]), { physicalCard: Object.assign(Object.assign({}, draft.localData[targetIndex].physicalCard), { addressId: addressId }) });
57
59
  }
58
60
  },
61
+ updateCardCount(draft, action) {
62
+ action.payload.forEach((activeChargeCardCountPayload) => {
63
+ draft.activeCardCount[activeChargeCardCountPayload.user_id] = {
64
+ physicalCardCount: activeChargeCardCountPayload.business_physical_credit_card_count,
65
+ virtualCardCount: activeChargeCardCountPayload.business_virtual_credit_card_count,
66
+ };
67
+ });
68
+ },
59
69
  clearIssueChargeCard(draft) {
60
70
  Object.assign(draft, exports.initialState);
61
71
  },
62
72
  },
63
73
  });
64
- _a = issueChargeCard.actions, exports.issueChargeCards = _a.issueChargeCards, exports.updateChargeCardsLocalStore = _a.updateChargeCardsLocalStore, exports.issueChargeCardSuccessOrFailure = _a.issueChargeCardSuccessOrFailure, exports.resetIssueChargeCardForm = _a.resetIssueChargeCardForm, exports.updateCustomAddressId = _a.updateCustomAddressId, exports.fetchIssueCardPage = _a.fetchIssueCardPage, exports.clearIssueChargeCard = _a.clearIssueChargeCard;
74
+ _a = issueChargeCard.actions, exports.issueChargeCards = _a.issueChargeCards, exports.updateChargeCardsLocalStore = _a.updateChargeCardsLocalStore, exports.issueChargeCardSuccessOrFailure = _a.issueChargeCardSuccessOrFailure, exports.resetIssueChargeCardForm = _a.resetIssueChargeCardForm, exports.updateCustomAddressId = _a.updateCustomAddressId, exports.updateCardCount = _a.updateCardCount, exports.fetchIssueCardPage = _a.fetchIssueCardPage, exports.clearIssueChargeCard = _a.clearIssueChargeCard;
65
75
  exports.default = issueChargeCard.reducer;
@@ -4,7 +4,7 @@ import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAnd
4
4
  import { Address } from '../../../../entity/address/addressState';
5
5
  import { Person } from '../../../people/peopleSelectorTypes';
6
6
  import { Class } from '../../../../entity/class/classState';
7
- import { IssueChargeCardLocalData } from './issueChargeCardState';
7
+ import { ActiveChargeCardCount, IssueChargeCardLocalData } from './issueChargeCardState';
8
8
  import { ChargeCardConfigState } from '../chargeCardConfig/chargeCardConfigState';
9
9
  import { CreditAccount } from '../chargeCardList/chargeCardList';
10
10
  export interface IssueChargeCardSelectorView extends SelectorView {
@@ -17,6 +17,7 @@ export interface IssueChargeCardSelectorView extends SelectorView {
17
17
  customAddress: Record<ID, Address>;
18
18
  customAddressStatus: Record<ID, FetchStateAndError>;
19
19
  userAddress: Record<ID, Address>;
20
+ activeCardCountByUser: Record<ID, ActiveChargeCardCount>;
20
21
  companyAddress?: Address;
21
22
  }
22
23
  export declare const getIssueChargeCardView: (state: RootState) => IssueChargeCardSelectorView;
@@ -71,6 +71,7 @@ const getIssueChargeCardView = (state) => {
71
71
  customAddressStatus,
72
72
  userAddress: selectedUserAddress,
73
73
  allAccountingClasses,
74
+ activeCardCountByUser: issueChargeCardState.activeCardCount,
74
75
  };
75
76
  };
76
77
  exports.getIssueChargeCardView = getIssueChargeCardView;
@@ -4,6 +4,11 @@ import { CreditLimitFrequencyCodeType, CardCodeType, ShippingAddressType } from
4
4
  export interface IssueChargeCardState extends FetchedState {
5
5
  localData: IssueChargeCardLocalData[];
6
6
  saveStatus: FetchStateAndError;
7
+ activeCardCount: Record<ID, ActiveChargeCardCount>;
8
+ }
9
+ export interface ActiveChargeCardCount {
10
+ physicalCardCount: number;
11
+ virtualCardCount: number;
7
12
  }
8
13
  export interface PhysicalCardData {
9
14
  addressType: ShippingAddressType;
@@ -4,27 +4,6 @@ import { updateAllUsers } from '../../entity/user/userReducer';
4
4
  import { updateUserRoles } from '../../entity/userRole/userRoleReducer';
5
5
  import { fetchUserListByType, updateUserListFetchFailure, updateUserIds } from './userListViewReducer';
6
6
  import { RootState } from '../../reducer';
7
- import { UserListType } from './userListViewState';
8
- export declare type ActionType = ReturnType<typeof fetchUserListByType> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateUserIds> | ReturnType<typeof updateUserListFetchFailure>;
9
- export declare const fetchUserListByTypeEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
10
- payload: {
11
- users: import("../..").UserPayload[];
12
- updateType?: import("../..").UpdateType | undefined;
13
- };
14
- type: string;
15
- } | {
16
- payload: import("../../entity/userRole/userRolePayload").UserRolePayload[];
17
- type: string;
18
- } | {
19
- payload: {
20
- userType: UserListType;
21
- usersPayload: import("../..").UserPayload[];
22
- };
23
- type: string;
24
- } | {
25
- payload: {
26
- userType: UserListType;
27
- status: import("../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
28
- };
29
- type: string;
30
- }>;
7
+ import { updateCardCount } from '../spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer';
8
+ export declare type ActionType = ReturnType<typeof fetchUserListByType> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateUserIds> | ReturnType<typeof updateCardCount> | ReturnType<typeof updateUserListFetchFailure>;
9
+ export declare const fetchUserListByTypeEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
@@ -8,6 +8,7 @@ const userRoleReducer_1 = require("../../entity/userRole/userRoleReducer");
8
8
  const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
9
9
  const userListViewReducer_1 = require("./userListViewReducer");
10
10
  const responsePayload_1 = require("../../responsePayload");
11
+ const issueChargeCardReducer_1 = require("../spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer");
11
12
  const fetchUserListByTypeEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(userListViewReducer_1.fetchUserListByType.match), (0, operators_1.mergeMap)((action) => {
12
13
  const { userType, cacheOverride } = action.payload;
13
14
  const state = state$.value;
@@ -21,12 +22,20 @@ const fetchUserListByTypeEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
21
22
  apiUrl =
22
23
  apiUrl + `?query=${encodeURIComponent(JSON.stringify(queryParam))}`;
23
24
  return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.mergeMap)((response) => {
24
- var _a, _b, _c, _d, _e, _f;
25
+ var _a, _b, _c, _d, _e, _f, _g, _h;
25
26
  if ((0, responsePayload_1.isSuccessResponse)(response)) {
26
- return (0, rxjs_1.of)((0, userReducer_1.updateAllUsers)({ users: (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.users) !== null && _b !== void 0 ? _b : [] }), (0, userRoleReducer_1.updateUserRoles)((_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.user_roles) !== null && _d !== void 0 ? _d : []), (0, userListViewReducer_1.updateUserIds)({
27
- userType,
28
- usersPayload: (_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.users) !== null && _f !== void 0 ? _f : [],
29
- }));
27
+ const userListAction = [
28
+ (0, userReducer_1.updateAllUsers)({ users: (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.users) !== null && _b !== void 0 ? _b : [] }),
29
+ (0, userRoleReducer_1.updateUserRoles)((_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.user_roles) !== null && _d !== void 0 ? _d : []),
30
+ (0, userListViewReducer_1.updateUserIds)({
31
+ userType,
32
+ usersPayload: (_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.users) !== null && _f !== void 0 ? _f : [],
33
+ }),
34
+ ];
35
+ if (userType === 'cardHolderCandidate') {
36
+ userListAction.push((0, issueChargeCardReducer_1.updateCardCount)((_h = (_g = response.data) === null || _g === void 0 ? void 0 : _g.active_cards_count_by_user_id) !== null && _h !== void 0 ? _h : []));
37
+ }
38
+ return (0, rxjs_1.concat)((0, rxjs_1.from)(userListAction));
30
39
  }
31
40
  else {
32
41
  return (0, rxjs_1.of)((0, userListViewReducer_1.updateUserListFetchFailure)({ userType, status: response.status }));
@@ -4,6 +4,12 @@ import { ZeniAPIResponse } from '../../responsePayload';
4
4
  interface UserListResponsePayload {
5
5
  users: UserPayload[];
6
6
  user_roles: UserRolePayload[];
7
+ active_cards_count_by_user_id?: ActiveChargeCardCountPayload[];
8
+ }
9
+ export interface ActiveChargeCardCountPayload {
10
+ business_physical_credit_card_count: number;
11
+ business_virtual_credit_card_count: number;
12
+ user_id: string;
7
13
  }
8
14
  export declare type UserListResponse = ZeniAPIResponse<UserListResponsePayload>;
9
15
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.13.21",
3
+ "version": "4.13.22",
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",