@zeniai/client-epic-state 4.13.20 → 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 +2 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.d.ts +3 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.js +10 -5
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +2 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +12 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +15 -15
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +6 -1
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.js +1 -1
- package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +3 -24
- package/lib/view/userListView/fetchUserListByTypeEpic.js +14 -5
- package/lib/view/userListView/userListViewPayload.d.ts +6 -0
- package/package.json +1 -1
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>;
|
|
@@ -4,6 +4,7 @@ exports.fetchIssueCardPageEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const userListViewReducer_1 = require("../../../userListView/userListViewReducer");
|
|
7
|
+
const classListReducer_1 = require("../../../classList/classListReducer");
|
|
7
8
|
const chargeCardConfigReducer_1 = require("../chargeCardConfig/chargeCardConfigReducer");
|
|
8
9
|
const issueChargeCardReducer_1 = require("./issueChargeCardReducer");
|
|
9
10
|
const chargeCardListReducer_1 = require("../chargeCardList/chargeCardListReducer");
|
|
@@ -15,7 +16,8 @@ const fetchIssueCardPageEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
15
16
|
issueCardPageAction.push((0, chargeCardConfigReducer_1.fetchChargeCardConfig)());
|
|
16
17
|
issueCardPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
|
|
17
18
|
issueCardPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardHolderCandidate', true));
|
|
18
|
-
issueCardPageAction.push((0,
|
|
19
|
+
issueCardPageAction.push((0, classListReducer_1.fetchClassList)());
|
|
20
|
+
issueCardPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
|
|
19
21
|
}
|
|
20
22
|
else {
|
|
21
23
|
const chargeCardConfig = state.chargeCardConfigState;
|
|
@@ -33,10 +35,13 @@ const fetchIssueCardPageEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
33
35
|
userList.hasValidState() === false) {
|
|
34
36
|
issueCardPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardHolderCandidate', false));
|
|
35
37
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
if (state.classListState.hasValidState() === false &&
|
|
39
|
+
state.classListState.fetchState !== 'In-Progress') {
|
|
40
|
+
issueCardPageAction.push((0, classListReducer_1.fetchClassList)());
|
|
41
|
+
}
|
|
42
|
+
if (chargeCardList.fetchState !== 'Completed' &&
|
|
43
|
+
chargeCardList.fetchState !== 'In-Progress') {
|
|
44
|
+
issueCardPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
47
|
return (0, rxjs_1.concat)((0, rxjs_1.from)(issueCardPageAction));
|
|
@@ -18,8 +18,8 @@ const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
18
18
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19
19
|
if (data.cardType === 'business_physical_credit_card') {
|
|
20
20
|
return {
|
|
21
|
-
card_holder_user_ids: data.physicalCard.
|
|
22
|
-
? [data.physicalCard.
|
|
21
|
+
card_holder_user_ids: data.physicalCard.userId != null
|
|
22
|
+
? [data.physicalCard.userId]
|
|
23
23
|
: [],
|
|
24
24
|
card_name: data.physicalCard.cardName,
|
|
25
25
|
credit_limit: (_b = (_a = data.physicalCard.amount) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0,
|
|
@@ -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;
|
|
@@ -4,12 +4,12 @@ exports.getIssueChargeCardView = void 0;
|
|
|
4
4
|
const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
|
|
5
5
|
const addressSelector_1 = require("../../../../entity/address/addressSelector");
|
|
6
6
|
const addressViewSelector_1 = require("../../../addressView/addressViewSelector");
|
|
7
|
-
const
|
|
7
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
8
|
const classSelector_1 = require("../../../../entity/class/classSelector");
|
|
9
9
|
const userListViewSelector_1 = require("../../../userListView/userListViewSelector");
|
|
10
10
|
const getIssueChargeCardView = (state) => {
|
|
11
|
-
var _a
|
|
12
|
-
const { issueChargeCardState, userState, userRoleState, userListViewState, chargeCardConfigState, chargeCardListState,
|
|
11
|
+
var _a;
|
|
12
|
+
const { issueChargeCardState, userState, userRoleState, userListViewState, chargeCardConfigState, chargeCardListState, addressState, classState, classListState, } = state;
|
|
13
13
|
const userListSelectorView = (0, userListViewSelector_1.getUserList)(userState, userRoleState, userListViewState, 'cardHolderCandidate');
|
|
14
14
|
const userList = userListSelectorView.users;
|
|
15
15
|
let selectedUserAddress = {};
|
|
@@ -20,12 +20,9 @@ const getIssueChargeCardView = (state) => {
|
|
|
20
20
|
selectedUserAddress = Object.assign(Object.assign({}, selectedUserAddress), { [user.userId]: userAddress });
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
: '';
|
|
27
|
-
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
28
|
-
const companyAddress = companyView === null || companyView === void 0 ? void 0 : companyView.companyAddress;
|
|
23
|
+
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
24
|
+
const companyAddressId = (_a = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.company) === null || _a === void 0 ? void 0 : _a.managegmentInfo.companyAddressId;
|
|
25
|
+
const companyAddress = (0, addressSelector_1.getAddressByAddressId)(addressState, companyAddressId !== null && companyAddressId !== void 0 ? companyAddressId : '');
|
|
29
26
|
let customAddressStatus = {};
|
|
30
27
|
let customAddress = {};
|
|
31
28
|
const defaultFetchState = {
|
|
@@ -48,17 +45,19 @@ const getIssueChargeCardView = (state) => {
|
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
47
|
});
|
|
51
|
-
const issueCardPageFetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
52
|
-
chargeCardConfigState,
|
|
53
|
-
userListSelectorView,
|
|
54
|
-
chargeCardListState.creditAccount,
|
|
55
|
-
tenantState,
|
|
56
|
-
]);
|
|
57
48
|
const { classIds } = classListState;
|
|
58
49
|
const allAccountingClasses = (0, classSelector_1.getClassesByIds)(classState, {
|
|
59
50
|
classIds: classIds,
|
|
60
51
|
reportId: 'class_list',
|
|
61
52
|
});
|
|
53
|
+
const issueCardPageFetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
54
|
+
chargeCardConfigState,
|
|
55
|
+
userListViewState.userListByType.cardHolderCandidate,
|
|
56
|
+
userListSelectorView,
|
|
57
|
+
chargeCardListState.creditAccount,
|
|
58
|
+
classListState,
|
|
59
|
+
chargeCardListState,
|
|
60
|
+
]);
|
|
62
61
|
return {
|
|
63
62
|
fetchState: issueCardPageFetchState.fetchState,
|
|
64
63
|
error: issueCardPageFetchState.error,
|
|
@@ -72,6 +71,7 @@ const getIssueChargeCardView = (state) => {
|
|
|
72
71
|
customAddressStatus,
|
|
73
72
|
userAddress: selectedUserAddress,
|
|
74
73
|
allAccountingClasses,
|
|
74
|
+
activeCardCountByUser: issueChargeCardState.activeCardCount,
|
|
75
75
|
};
|
|
76
76
|
};
|
|
77
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;
|
|
@@ -11,7 +16,7 @@ export interface PhysicalCardData {
|
|
|
11
16
|
frequency: CreditLimitFrequencyCodeType;
|
|
12
17
|
addressId?: ID;
|
|
13
18
|
amount?: Amount;
|
|
14
|
-
|
|
19
|
+
userId?: ID;
|
|
15
20
|
}
|
|
16
21
|
export interface VirtualCardData {
|
|
17
22
|
userIds: ID[];
|
|
@@ -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 {
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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.
|
|
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",
|