@zeniai/client-epic-state 4.16.3 → 4.16.4
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/commonStateTypes/animations.d.ts +1 -1
- package/lib/commonStateTypes/animations.js +1 -1
- package/lib/entity/chargeCard/chargeCard.d.ts +8 -26
- package/lib/entity/chargeCard/chargeCard.js +6 -25
- package/lib/entity/chargeCard/chargeCardPayload.d.ts +5 -41
- package/lib/entity/chargeCard/chargeCardPayload.js +8 -20
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.js +1 -5
- package/lib/entity/company/companyPayload.d.ts +1 -12
- package/lib/entity/company/companyPayload.js +0 -14
- package/lib/entity/company/companyStateTypes.d.ts +0 -11
- package/lib/entity/depositAccount/depositAccount.d.ts +2 -20
- package/lib/entity/depositAccount/depositAccountPayload.d.ts +1 -22
- package/lib/entity/depositAccount/depositAccountPayload.js +1 -39
- package/lib/entity/depositAccount/depositAccountReducer.d.ts +2 -2
- package/lib/entity/depositAccount/depositAccountReducer.js +2 -8
- package/lib/entity/depositAccount/depositAccountSelector.d.ts +1 -3
- package/lib/entity/depositAccount/depositAccountSelector.js +0 -10
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -2
- package/lib/entity/tenant/clearAllEpic.d.ts +1 -2
- package/lib/entity/tenant/clearAllEpic.js +0 -2
- package/lib/entity/tenant/tenantSelector.d.ts +2 -6
- package/lib/entity/tenant/tenantSelector.js +2 -10
- package/lib/epic.d.ts +1 -5
- package/lib/epic.js +1 -5
- package/lib/index.d.ts +16 -16
- package/lib/index.js +29 -39
- package/lib/reducer.d.ts +0 -3
- package/lib/reducer.js +0 -3
- package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +0 -8
- package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +0 -16
- package/lib/view/addressView/addressViewState.d.ts +1 -1
- package/lib/view/dashboard/dashboardSelector.js +6 -7
- package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.js +4 -5
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +2 -1
- package/lib/view/expenseAutomationView/epics/fluxAnalysis/fetchFluxAnalysisViewEpic.js +6 -18
- package/lib/view/expenseAutomationView/epics/fluxAnalysis/reviewFluxAnalysisEpic.js +4 -1
- package/lib/view/expenseAutomationView/helpers/helpers.js +4 -4
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +23 -25
- package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.d.ts +9 -22
- package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.js +2 -2
- package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.d.ts +5 -13
- package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.js +115 -245
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +15 -9
- package/lib/view/expenseAutomationView/selectorTypes/fluxAnalysisViewSelectorTypes.d.ts +9 -29
- package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +40 -108
- package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.d.ts +15 -40
- package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.js +1 -1
- package/lib/view/onboardingView/cockpitView/epic/initializeOnboardingCustomerViewUpdateDataEpic.js +4 -4
- package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.d.ts +1 -2
- package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.js +2 -2
- package/lib/view/settingsView/settingsViewHelpers.d.ts +4 -4
- package/lib/view/settingsView/settingsViewHelpers.js +8 -9
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +1 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +1 -6
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +2 -20
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +0 -5
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +2 -9
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +0 -1
- package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingSelector.js +3 -4
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.d.ts +3 -5
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.js +2 -4
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -8
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigState.d.ts +2 -4
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +0 -12
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +0 -26
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailPayload.d.ts +0 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +4 -43
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +9 -104
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +0 -15
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +16 -70
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.d.ts +1 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +3 -12
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionListEpic.js +1 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardLimitEpic.js +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -11
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -20
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +1 -16
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +4 -6
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +4 -30
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +2 -5
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +14 -26
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +5 -20
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewReducer.d.ts +1 -2
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewReducer.js +2 -4
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.d.ts +1 -2
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.js +0 -2
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/acceptChargeCardTermsEpic.js +2 -19
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.js +3 -15
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +25 -65
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +3 -11
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +11 -45
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +3 -6
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +18 -33
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +8 -41
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.js +21 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/enableSetupEpic.js +0 -9
- package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +3 -8
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +4 -4
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +1 -2
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +1 -3
- package/lib/view/spendManagement/commonSetup/setupViewState.js +1 -13
- package/lib/view/spendManagement/helpers.d.ts +0 -3
- package/lib/view/spendManagement/helpers.js +1 -13
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/getPaymentAccountsEpic.js +1 -2
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountEpic.js +1 -2
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountLoginStatusEpic.js +1 -2
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountStatusEpic.js +1 -2
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.d.ts +1 -2
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +1 -6
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +10 -10
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +0 -1
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
- package/lib/view/spendManagement/zeniAccounts/checkDeposit/checkDepositSelector.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/depositAccountList/depositAccountListSelector.d.ts +1 -1
- package/lib/view/spendManagement/zeniAccounts/depositAccountList/depositAccountListSelector.js +3 -3
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountList/zeniAccountListSelector.js +1 -1
- package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +2 -3
- package/lib/view/twoFactorAuthentication/resendOtpEpic.js +19 -44
- package/lib/view/twoFactorAuthentication/sendOtpEpic.d.ts +1 -2
- package/lib/view/twoFactorAuthentication/sendOtpEpic.js +18 -45
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.d.ts +5 -17
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.js +0 -33
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.d.ts +7 -7
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.js +6 -6
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.d.ts +6 -22
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.js +60 -176
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.d.ts +3 -5
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.js +2 -13
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.d.ts +2 -5
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.js +5 -46
- package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +2 -2
- package/lib/view/userListView/fetchUserListByTypeEpic.js +3 -4
- package/lib/view/userListView/userListViewPayload.d.ts +0 -11
- package/package.json +4 -5
- package/lib/entity/connectedAccount/connectedAccount.d.ts +0 -19
- package/lib/entity/connectedAccount/connectedAccount.js +0 -10
- package/lib/entity/connectedAccount/connectedAccountPayload.d.ts +0 -11
- package/lib/entity/connectedAccount/connectedAccountPayload.js +0 -15
- package/lib/entity/connectedAccount/connectedAccountReducer.d.ts +0 -6
- package/lib/entity/connectedAccount/connectedAccountReducer.js +0 -27
- package/lib/entity/connectedAccount/connectedAccountSelector.d.ts +0 -4
- package/lib/entity/connectedAccount/connectedAccountSelector.js +0 -17
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchDepositAccountLimitEpic.d.ts +0 -8
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchDepositAccountLimitEpic.js +0 -41
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateDebitCardPinAttemptEpic.d.ts +0 -11
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateDebitCardPinAttemptEpic.js +0 -42
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchDebitCardSummaryEpic.d.ts +0 -7
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchDebitCardSummaryEpic.js +0 -23
- package/lib/view/spendManagement/chargeCards/issueChargeCard/depositAccountWithLimitPayload.d.ts +0 -6
- package/lib/view/spendManagement/chargeCards/issueChargeCard/depositAccountWithLimitPayload.js +0 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchDepositAccountListForCardsEpic.d.ts +0 -8
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchDepositAccountListForCardsEpic.js +0 -31
|
@@ -3,33 +3,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getChargeCardTransactionAttachmentView = exports.getChargeCardCVVActivateView = exports.
|
|
6
|
+
exports.getChargeCardTransactionAttachmentView = exports.getChargeCardCVVActivateView = exports.getChargeCardDetailView = void 0;
|
|
7
7
|
const get_1 = __importDefault(require("lodash/get"));
|
|
8
8
|
const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
|
|
9
9
|
const addressSelector_1 = require("../../../../entity/address/addressSelector");
|
|
10
10
|
const chargeCardSelector_1 = require("../../../../entity/chargeCard/chargeCardSelector");
|
|
11
11
|
const chargeCardTransactionSelector_1 = require("../../../../entity/chargeCardTransaction/chargeCardTransactionSelector");
|
|
12
12
|
const classSelector_1 = require("../../../../entity/class/classSelector");
|
|
13
|
-
const connectedAccountSelector_1 = require("../../../../entity/connectedAccount/connectedAccountSelector");
|
|
14
|
-
const depositAccountSelector_1 = require("../../../../entity/depositAccount/depositAccountSelector");
|
|
15
13
|
const userSelector_1 = require("../../../../entity/user/userSelector");
|
|
16
14
|
const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
|
|
17
|
-
const twoFactorAuthentication_1 = require("../../../twoFactorAuthentication/twoFactorAuthentication");
|
|
18
15
|
const twoFactorAuthenticationSelector_1 = require("../../../twoFactorAuthentication/twoFactorAuthenticationSelector");
|
|
19
16
|
const chargeCardDetail_1 = require("./chargeCardDetail");
|
|
20
17
|
const getChargeCardDetailView = (state, chargeCardId, includeCreditAccountInfo) => {
|
|
21
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l
|
|
22
|
-
const { tenantState, addressState, chargeCardDetailState, chargeCardState, classState, userState, userRoleState, chargeCardConfigState, chargeCardTransactionState, chargeCardListState,
|
|
23
|
-
const twoFactorAuthenticationView = (0, twoFactorAuthenticationSelector_1.
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
19
|
+
const { tenantState, addressState, chargeCardDetailState, chargeCardState, classState, userState, userRoleState, chargeCardConfigState, chargeCardTransactionState, chargeCardListState, } = state;
|
|
20
|
+
const twoFactorAuthenticationView = (0, twoFactorAuthenticationSelector_1.getTwoFactorAuthenticationView)(state);
|
|
24
21
|
const loggedInUserId = (_b = (_a = tenantState.loggedInUser) === null || _a === void 0 ? void 0 : _a.userId) !== null && _b !== void 0 ? _b : '';
|
|
25
22
|
const loggedInUserPhone = (_e = (_c = twoFactorAuthenticationView.phone) !== null && _c !== void 0 ? _c : (_d = (0, userSelector_1.getUserByUserId)(userState, loggedInUserId)) === null || _d === void 0 ? void 0 : _d.phone) !== null && _e !== void 0 ? _e : '';
|
|
26
23
|
let chargeCardWithUser = undefined;
|
|
27
|
-
let connectedAccount = undefined;
|
|
28
|
-
let depositAccountLimitFetchState = {
|
|
29
|
-
fetchState: 'Not-Started',
|
|
30
|
-
error: undefined,
|
|
31
|
-
};
|
|
32
|
-
let depositAccountLimit = undefined;
|
|
33
24
|
const chargeCardDetail = (0, get_1.default)(chargeCardDetailState.detailById, chargeCardId, undefined);
|
|
34
25
|
const chargeCard = (0, chargeCardSelector_1.getChargeCardById)(chargeCardState, chargeCardId);
|
|
35
26
|
let reducedFetchState = {
|
|
@@ -67,7 +58,6 @@ const getChargeCardDetailView = (state, chargeCardId, includeCreditAccountInfo)
|
|
|
67
58
|
? (0, addressSelector_1.getAddressByAddressId)(addressState, chargeCard.mailingAddressId)
|
|
68
59
|
: undefined;
|
|
69
60
|
const billingAddress = (0, addressSelector_1.getAddressByAddressId)(addressState, chargeCard.billingAddressId);
|
|
70
|
-
connectedAccount = (0, connectedAccountSelector_1.getConnectedAccountByConnectedAccountId)(connectedAccountState, chargeCard.connectedAccountId);
|
|
71
61
|
if (cardCreatedByUser == null ||
|
|
72
62
|
cardHolderUser == null ||
|
|
73
63
|
cardHolderUserRole == null ||
|
|
@@ -85,9 +75,6 @@ const getChargeCardDetailView = (state, chargeCardId, includeCreditAccountInfo)
|
|
|
85
75
|
error: chargeCardDetail.transactionList.error,
|
|
86
76
|
};
|
|
87
77
|
uiState = chargeCardDetail.transactionList.uiState;
|
|
88
|
-
depositAccountLimitFetchState =
|
|
89
|
-
chargeCardDetail.depositAccountLimitFetchState;
|
|
90
|
-
depositAccountLimit = (0, depositAccountSelector_1.getDepositAccountLimitForChargeCardByDepositAccountId)(depositAccountState, chargeCard.connectedAccountId);
|
|
91
78
|
}
|
|
92
79
|
return {
|
|
93
80
|
fetchState: reducedFetchState.fetchState,
|
|
@@ -95,76 +82,34 @@ const getChargeCardDetailView = (state, chargeCardId, includeCreditAccountInfo)
|
|
|
95
82
|
fetchState: 'Not-Started',
|
|
96
83
|
error: undefined,
|
|
97
84
|
},
|
|
98
|
-
|
|
99
|
-
updatePhysicalChargeCardAttemptFetchState: (_h = chargeCardDetail === null || chargeCardDetail === void 0 ? void 0 : chargeCardDetail.updatePhysicalChargeCardAttemptFetchState) !== null && _h !== void 0 ? _h : {
|
|
85
|
+
updatePhysicalChargeCardAttemptFetchState: (_g = chargeCardDetail === null || chargeCardDetail === void 0 ? void 0 : chargeCardDetail.updatePhysicalChargeCardAttemptFetchState) !== null && _g !== void 0 ? _g : {
|
|
100
86
|
fetchState: 'Not-Started',
|
|
101
87
|
error: undefined,
|
|
102
88
|
},
|
|
103
|
-
updateChargeCardLimitFetchState: (
|
|
89
|
+
updateChargeCardLimitFetchState: (_h = chargeCardDetail === null || chargeCardDetail === void 0 ? void 0 : chargeCardDetail.updateChargeCardLimitFetchState) !== null && _h !== void 0 ? _h : {
|
|
104
90
|
fetchState: 'Not-Started',
|
|
105
91
|
error: undefined,
|
|
106
92
|
},
|
|
107
93
|
chargeCard: chargeCardWithUser,
|
|
108
|
-
connectedAccount,
|
|
109
94
|
error: reducedFetchState.error,
|
|
110
95
|
chargeCardConfig: chargeCardConfigState,
|
|
111
96
|
transactions,
|
|
112
|
-
uploadReceiptsFetchStateByTransactionId: (
|
|
113
|
-
uploadReceiptsShowTickByTransactionId: (
|
|
114
|
-
isViewReceiptClickedImmediatelyAfterUploadTransactionId: (
|
|
97
|
+
uploadReceiptsFetchStateByTransactionId: (_j = chargeCardDetail === null || chargeCardDetail === void 0 ? void 0 : chargeCardDetail.transactionList.uploadReceiptsFetchStateByTransactionId) !== null && _j !== void 0 ? _j : {},
|
|
98
|
+
uploadReceiptsShowTickByTransactionId: (_k = chargeCardDetail === null || chargeCardDetail === void 0 ? void 0 : chargeCardDetail.transactionList.uploadReceiptsShowTickByTransactionId) !== null && _k !== void 0 ? _k : {},
|
|
99
|
+
isViewReceiptClickedImmediatelyAfterUploadTransactionId: (_l = chargeCardDetail === null || chargeCardDetail === void 0 ? void 0 : chargeCardDetail.transactionList.isViewReceiptClickedImmediatelyAfterUploadTransactionId) !== null && _l !== void 0 ? _l : {},
|
|
115
100
|
uiState,
|
|
116
101
|
transactionListFetchState,
|
|
117
102
|
twoFAView: twoFactorAuthenticationView,
|
|
118
103
|
loggedInUserPhone,
|
|
119
|
-
depositAccountLimitFetchState,
|
|
120
|
-
depositAccountLimit,
|
|
121
104
|
version: '1.0',
|
|
122
105
|
creditAccount: chargeCardListState.creditAccount,
|
|
123
106
|
};
|
|
124
107
|
};
|
|
125
108
|
exports.getChargeCardDetailView = getChargeCardDetailView;
|
|
126
|
-
const getDebitCardSetPinView = (state, chargeCardId) => {
|
|
127
|
-
var _a, _b, _c, _d, _e;
|
|
128
|
-
const { chargeCardDetailState, chargeCardState, chargeCardConfigState } = state;
|
|
129
|
-
const twoFactorAuthenticationView = (_a = (0, twoFactorAuthenticationSelector_1.getTwoFactorAuthenticationViewForChargeCardHolder)(state, chargeCardId)) !== null && _a !== void 0 ? _a : twoFactorAuthentication_1.initialTwoFactorAuthentication;
|
|
130
|
-
const chargeCardDetail = (0, get_1.default)(chargeCardDetailState.detailById, chargeCardId, undefined);
|
|
131
|
-
const chargeCard = (0, chargeCardSelector_1.getChargeCardById)(chargeCardState, chargeCardId);
|
|
132
|
-
let reducedFetchState = {
|
|
133
|
-
fetchState: 'Not-Started',
|
|
134
|
-
error: undefined,
|
|
135
|
-
};
|
|
136
|
-
if (chargeCardDetail) {
|
|
137
|
-
reducedFetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
138
|
-
chargeCardDetail,
|
|
139
|
-
chargeCardConfigState,
|
|
140
|
-
]);
|
|
141
|
-
}
|
|
142
|
-
const debitCardSetPinWaitStatus = (_c = (_b = chargeCardDetailState.detailById[chargeCardId]) === null || _b === void 0 ? void 0 : _b.debitCardSetPinWaitStatus) !== null && _c !== void 0 ? _c : {
|
|
143
|
-
fetchState: 'Not-Started',
|
|
144
|
-
error: undefined,
|
|
145
|
-
};
|
|
146
|
-
const updateStatus = (0, reduceFetchState_1.reduceAllFetchState)([
|
|
147
|
-
twoFactorAuthenticationView.sendOtpStatus,
|
|
148
|
-
debitCardSetPinWaitStatus,
|
|
149
|
-
]);
|
|
150
|
-
return {
|
|
151
|
-
fetchState: reducedFetchState.fetchState,
|
|
152
|
-
updateStatus,
|
|
153
|
-
isRefreshingViewInBackground: (_d = chargeCardDetail === null || chargeCardDetail === void 0 ? void 0 : chargeCardDetail.isRefreshingViewInBackground) !== null && _d !== void 0 ? _d : false,
|
|
154
|
-
updateDebitCardPinAttemptFetchState: (_e = chargeCardDetail === null || chargeCardDetail === void 0 ? void 0 : chargeCardDetail.updateDebitCardPinAttemptFetchState) !== null && _e !== void 0 ? _e : {
|
|
155
|
-
fetchState: 'Not-Started',
|
|
156
|
-
error: undefined,
|
|
157
|
-
},
|
|
158
|
-
chargeCard: chargeCard,
|
|
159
|
-
error: reducedFetchState.error,
|
|
160
|
-
version: '1.0',
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
exports.getDebitCardSetPinView = getDebitCardSetPinView;
|
|
164
109
|
const getChargeCardCVVActivateView = (state, chargeCardId) => {
|
|
165
|
-
var _a, _b, _c
|
|
110
|
+
var _a, _b, _c;
|
|
166
111
|
const { addressState, chargeCardDetailState, chargeCardState, classState, userState, userRoleState, chargeCardConfigState, } = state;
|
|
167
|
-
const twoFactorAuthenticationView = (
|
|
112
|
+
const twoFactorAuthenticationView = (0, twoFactorAuthenticationSelector_1.getTwoFactorAuthenticationView)(state);
|
|
168
113
|
let chargeCardWithUser = undefined;
|
|
169
114
|
const chargeCardDetail = (0, get_1.default)(chargeCardDetailState.detailById, chargeCardId, undefined);
|
|
170
115
|
const chargeCard = (0, chargeCardSelector_1.getChargeCardById)(chargeCardState, chargeCardId);
|
|
@@ -178,7 +123,9 @@ const getChargeCardCVVActivateView = (state, chargeCardId) => {
|
|
|
178
123
|
chargeCardConfigState,
|
|
179
124
|
]);
|
|
180
125
|
}
|
|
181
|
-
if (chargeCardDetail &&
|
|
126
|
+
if (chargeCardDetail &&
|
|
127
|
+
chargeCardDetail.fetchState === 'Completed' &&
|
|
128
|
+
chargeCard != null) {
|
|
182
129
|
const cardCreatedByUser = (0, userSelector_1.getUserByUserId)(userState, chargeCard.cardCreaterUserId);
|
|
183
130
|
const cardHolderUser = (0, userSelector_1.getUserByUserId)(userState, chargeCard.cardHolderUserId);
|
|
184
131
|
const cardHolderUserRole = (0, userRoleSelector_1.getUserRoleByUserId)(userRoleState, chargeCard.cardHolderUserId);
|
|
@@ -203,7 +150,7 @@ const getChargeCardCVVActivateView = (state, chargeCardId) => {
|
|
|
203
150
|
mailingAddress,
|
|
204
151
|
billingAddress });
|
|
205
152
|
}
|
|
206
|
-
const cvvActivationWaitStatus = (
|
|
153
|
+
const cvvActivationWaitStatus = (_b = (_a = chargeCardDetailState.detailById[chargeCardId]) === null || _a === void 0 ? void 0 : _a.cvvActivationWaitStatus) !== null && _b !== void 0 ? _b : {
|
|
207
154
|
fetchState: 'Not-Started',
|
|
208
155
|
error: undefined,
|
|
209
156
|
};
|
|
@@ -214,8 +161,7 @@ const getChargeCardCVVActivateView = (state, chargeCardId) => {
|
|
|
214
161
|
return {
|
|
215
162
|
fetchState: reducedFetchState.fetchState,
|
|
216
163
|
updateStatus,
|
|
217
|
-
|
|
218
|
-
updatePhysicalChargeCardAttemptFetchState: (_e = chargeCardDetail === null || chargeCardDetail === void 0 ? void 0 : chargeCardDetail.updatePhysicalChargeCardAttemptFetchState) !== null && _e !== void 0 ? _e : {
|
|
164
|
+
updatePhysicalChargeCardAttemptFetchState: (_c = chargeCardDetail === null || chargeCardDetail === void 0 ? void 0 : chargeCardDetail.updatePhysicalChargeCardAttemptFetchState) !== null && _c !== void 0 ? _c : {
|
|
219
165
|
fetchState: 'Not-Started',
|
|
220
166
|
error: undefined,
|
|
221
167
|
},
|
package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.d.ts
CHANGED
|
@@ -2,11 +2,10 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateAddress, updateAddresses } from '../../../../entity/address/addressReducer';
|
|
4
4
|
import { updateChargeCard } from '../../../../entity/chargeCard/chargeCardReducer';
|
|
5
|
-
import { updateConnectedAccount } from '../../../../entity/connectedAccount/connectedAccountReducer';
|
|
6
5
|
import { updateAllUsers } from '../../../../entity/user/userReducer';
|
|
7
6
|
import { updateUserRoles } from '../../../../entity/userRole/userRoleReducer';
|
|
8
7
|
import { RootState } from '../../../../reducer';
|
|
9
8
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
10
9
|
import { fetchChargeCardDetail, updateChargeCardDetailFetchState } from './chargeCardDetailReducer';
|
|
11
|
-
export type ActionType = ReturnType<typeof fetchChargeCardDetail> | ReturnType<typeof updateChargeCardDetailFetchState> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateAddress> | ReturnType<typeof
|
|
10
|
+
export type ActionType = ReturnType<typeof fetchChargeCardDetail> | ReturnType<typeof updateChargeCardDetailFetchState> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateAddress> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateChargeCard>;
|
|
12
11
|
export declare const fetchChargeCardDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -9,7 +9,6 @@ const rxjs_1 = require("rxjs");
|
|
|
9
9
|
const operators_1 = require("rxjs/operators");
|
|
10
10
|
const addressReducer_1 = require("../../../../entity/address/addressReducer");
|
|
11
11
|
const chargeCardReducer_1 = require("../../../../entity/chargeCard/chargeCardReducer");
|
|
12
|
-
const connectedAccountReducer_1 = require("../../../../entity/connectedAccount/connectedAccountReducer");
|
|
13
12
|
const userReducer_1 = require("../../../../entity/user/userReducer");
|
|
14
13
|
const userRoleReducer_1 = require("../../../../entity/userRole/userRoleReducer");
|
|
15
14
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
@@ -24,21 +23,15 @@ const fetchChargeCardDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
24
23
|
chargeCardDetail.fetchState !== 'In-Progress') {
|
|
25
24
|
chargeCardAction.push((0, chargeCardDetailReducer_1.updateChargeCardDetailFetchState)({
|
|
26
25
|
chargeCardId,
|
|
27
|
-
isRefreshingViewInBackground: cacheOverride,
|
|
28
26
|
fetchState: 'In-Progress',
|
|
29
27
|
}));
|
|
30
|
-
const query = {
|
|
31
|
-
is_include_card_activation_events: true,
|
|
32
|
-
is_include_connected_account_info: true,
|
|
33
|
-
is_include_card_pin_change_attempt_history: true,
|
|
34
|
-
};
|
|
35
28
|
const getChargeCardDetail$ = zeniAPI
|
|
36
|
-
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/${chargeCardId}?query
|
|
29
|
+
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/${chargeCardId}?query={
|
|
30
|
+
"is_include_card_activation_events":true}`)
|
|
37
31
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
38
32
|
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
39
|
-
return (0, rxjs_1.of)((0, chargeCardReducer_1.updateChargeCard)(response.data.card), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, addressReducer_1.updateAddresses)(response.data.addresses), (0,
|
|
33
|
+
return (0, rxjs_1.of)((0, chargeCardReducer_1.updateChargeCard)(response.data.card), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, addressReducer_1.updateAddresses)(response.data.addresses), (0, chargeCardDetailReducer_1.updateChargeCardDetailFetchState)({
|
|
40
34
|
chargeCardId,
|
|
41
|
-
isRefreshingViewInBackground: false,
|
|
42
35
|
fetchState: 'Completed',
|
|
43
36
|
}));
|
|
44
37
|
}
|
|
@@ -46,7 +39,6 @@ const fetchChargeCardDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
46
39
|
return (0, rxjs_1.of)((0, chargeCardDetailReducer_1.updateChargeCardDetailFetchState)({
|
|
47
40
|
chargeCardId,
|
|
48
41
|
fetchState: 'Error',
|
|
49
|
-
isRefreshingViewInBackground: false,
|
|
50
42
|
error: response.status,
|
|
51
43
|
}));
|
|
52
44
|
}
|
|
@@ -54,7 +46,6 @@ const fetchChargeCardDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
54
46
|
return (0, rxjs_1.of)((0, chargeCardDetailReducer_1.updateChargeCardDetailFetchState)({
|
|
55
47
|
chargeCardId,
|
|
56
48
|
fetchState: 'Error',
|
|
57
|
-
isRefreshingViewInBackground: false,
|
|
58
49
|
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch card detail API call errored out' +
|
|
59
50
|
JSON.stringify(error)),
|
|
60
51
|
}));
|
package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionListEpic.js
CHANGED
|
@@ -10,7 +10,7 @@ const chargeCardDetail_1 = require("./chargeCardDetail");
|
|
|
10
10
|
const chargeCardDetailReducer_1 = require("./chargeCardDetailReducer");
|
|
11
11
|
const fetchChargeCardTransactionListEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardDetailReducer_1.fetchChargeCardTransactionList.match), (0, operators_1.switchMap)((action) => {
|
|
12
12
|
var _a, _b;
|
|
13
|
-
const { chargeCardId, pageToken, pageTokenType
|
|
13
|
+
const { chargeCardId, pageToken, pageTokenType } = action.payload;
|
|
14
14
|
const { uiState } = (_b = (_a = state$.value.chargeCardDetailState.detailById[chargeCardId]) === null || _a === void 0 ? void 0 : _a.transactionList) !== null && _b !== void 0 ? _b : chargeCardDetail_1.emptyChargeCardDetail.transactionList;
|
|
15
15
|
const queryParam = {
|
|
16
16
|
page_token: pageToken,
|
|
@@ -27,7 +27,6 @@ const fetchChargeCardTransactionListEpic = (actions$, state$, zeniAPI) => action
|
|
|
27
27
|
return (0, rxjs_1.of)((0, chargeCardTransactionReducer_1.updateChargeCardTransactions)(response.data.transactions), (0, chargeCardDetailReducer_1.updateChargeCardTransactionList)({
|
|
28
28
|
chargeCardId,
|
|
29
29
|
data: response.data,
|
|
30
|
-
cacheOverride,
|
|
31
30
|
}));
|
|
32
31
|
}
|
|
33
32
|
else {
|
|
@@ -10,9 +10,9 @@ const chargeCardDetailReducer_1 = require("./chargeCardDetailReducer");
|
|
|
10
10
|
const updateChargeCardLimitEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardDetailReducer_1.updateChargeCardSpendLimit.match), (0, operators_1.switchMap)((action) => {
|
|
11
11
|
const { chargeCardId, updatedSpendLimit, frequency, formattedAmount } = action.payload;
|
|
12
12
|
const payload = {
|
|
13
|
-
|
|
13
|
+
credit_limit: updatedSpendLimit.amount,
|
|
14
14
|
currency_code: updatedSpendLimit.currencyCode,
|
|
15
|
-
|
|
15
|
+
credit_limit_frequency: {
|
|
16
16
|
code: frequency,
|
|
17
17
|
},
|
|
18
18
|
};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Amount } from '../../../../commonStateTypes/amount';
|
|
2
2
|
import { FetchStateAndError, FetchedState, ID } from '../../../../commonStateTypes/common';
|
|
3
|
-
import { ZeniDate } from '../../../../zeniDayJS';
|
|
4
3
|
import { SpendManagementUIState } from '../../billPay/billList/billListState';
|
|
5
4
|
export interface ChargeCardListState extends FetchedState {
|
|
6
5
|
cardIds: ID[];
|
|
7
6
|
uiState: ChargeCardListUIState;
|
|
8
7
|
creditAccount: CreditAccount;
|
|
9
|
-
debitCardSummaries: DebitCardSummaries;
|
|
10
8
|
searchText: string;
|
|
11
9
|
unAssignedCredits?: Amount;
|
|
12
10
|
resendCardInvite: ResendRevokeCardInvite;
|
|
@@ -19,13 +17,6 @@ export interface ResendRevokeCardInvite {
|
|
|
19
17
|
export interface ChargeCardListUIState extends SpendManagementUIState {
|
|
20
18
|
sortKey: ChargeCardViewSortKey;
|
|
21
19
|
}
|
|
22
|
-
export interface DebitCardSummaries extends FetchStateAndError {
|
|
23
|
-
currentMonthSpends: Amount;
|
|
24
|
-
lastCompletedMonthSpends: Amount;
|
|
25
|
-
spendsPercentChange: number;
|
|
26
|
-
lastCompletedMonthStartTime: ZeniDate;
|
|
27
|
-
lastCompletedMonthEndTime: ZeniDate;
|
|
28
|
-
}
|
|
29
20
|
export interface CreditAccount extends FetchStateAndError {
|
|
30
21
|
id: ID;
|
|
31
22
|
status: CreditAccountStatusType;
|
|
@@ -36,9 +27,8 @@ export interface CreditAccount extends FetchStateAndError {
|
|
|
36
27
|
cashback?: Amount;
|
|
37
28
|
}
|
|
38
29
|
export declare const initialCreditAcc: CreditAccount;
|
|
39
|
-
export declare const initialDebitCardSummaries: DebitCardSummaries;
|
|
40
30
|
export declare const initialResendRevokeCardInvite: ResendRevokeCardInvite;
|
|
41
|
-
export declare const toChargeCardSortKeyType: (v: string) => "status" | "owner" | "cardName" | "limit" | "department" | "
|
|
31
|
+
export declare const toChargeCardSortKeyType: (v: string) => "status" | "owner" | "cardName" | "limit" | "department" | "utilisation";
|
|
42
32
|
export declare type ChargeCardViewSortKey = ReturnType<typeof toChargeCardSortKeyType>;
|
|
43
33
|
export declare const ALL_CASHBACK_SORT_KEYS: readonly ["month", "cashback"];
|
|
44
34
|
export declare const toCashbackSortKeyType: (v: string) => "month" | "cashback";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toCreditAccountStatusType = exports.toCashbackSortKeyType = exports.ALL_CASHBACK_SORT_KEYS = exports.toChargeCardSortKeyType = exports.initialResendRevokeCardInvite = exports.
|
|
3
|
+
exports.toCreditAccountStatusType = exports.toCashbackSortKeyType = exports.ALL_CASHBACK_SORT_KEYS = exports.toChargeCardSortKeyType = exports.initialResendRevokeCardInvite = exports.initialCreditAcc = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../../../commonStateTypes/stringToUnion");
|
|
5
|
-
const zeniDayJS_1 = require("../../../../zeniDayJS");
|
|
6
5
|
exports.initialCreditAcc = {
|
|
7
6
|
fetchState: 'Not-Started',
|
|
8
7
|
error: undefined,
|
|
@@ -34,23 +33,6 @@ exports.initialCreditAcc = {
|
|
|
34
33
|
currencySymbol: '$',
|
|
35
34
|
},
|
|
36
35
|
};
|
|
37
|
-
exports.initialDebitCardSummaries = {
|
|
38
|
-
fetchState: 'Not-Started',
|
|
39
|
-
error: undefined,
|
|
40
|
-
currentMonthSpends: {
|
|
41
|
-
amount: 0,
|
|
42
|
-
currencyCode: 'USD',
|
|
43
|
-
currencySymbol: '$',
|
|
44
|
-
},
|
|
45
|
-
lastCompletedMonthSpends: {
|
|
46
|
-
amount: 0,
|
|
47
|
-
currencyCode: 'USD',
|
|
48
|
-
currencySymbol: '$',
|
|
49
|
-
},
|
|
50
|
-
spendsPercentChange: 0,
|
|
51
|
-
lastCompletedMonthStartTime: (0, zeniDayJS_1.dateNow)(),
|
|
52
|
-
lastCompletedMonthEndTime: (0, zeniDayJS_1.dateNow)(),
|
|
53
|
-
};
|
|
54
36
|
exports.initialResendRevokeCardInvite = {
|
|
55
37
|
cardId: undefined,
|
|
56
38
|
saveStatus: {
|
|
@@ -62,7 +44,6 @@ const ALL_CHARGE_CARD_SORT_KEYS = [
|
|
|
62
44
|
'owner',
|
|
63
45
|
'cardName',
|
|
64
46
|
'department',
|
|
65
|
-
'cardType',
|
|
66
47
|
'status',
|
|
67
48
|
'utilisation',
|
|
68
49
|
'limit',
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { ID } from '../../../../commonStateTypes/common';
|
|
2
1
|
import { AddressPayload } from '../../../../entity/address/addressPayload';
|
|
3
2
|
import { ChargeCardPayload } from '../../../../entity/chargeCard/chargeCardPayload';
|
|
4
3
|
import { AmountPayload } from '../../../../entity/reimbursement/reimbursementPayload';
|
|
5
4
|
import { UserPayload } from '../../../../entity/user/userPayload';
|
|
6
5
|
import { UserRolePayload } from '../../../../entity/userRole/userRolePayload';
|
|
7
6
|
import { ZeniAPIResponse } from '../../../../responsePayload';
|
|
8
|
-
import { ActiveChargeCardCountPayload
|
|
7
|
+
import { ActiveChargeCardCountPayload } from '../../../../view/userListView/userListViewPayload';
|
|
9
8
|
export interface ChargeCardListPayload {
|
|
10
9
|
cards: ChargeCardPayload[];
|
|
11
10
|
unassigned_credit?: AmountPayload;
|
|
@@ -13,7 +12,6 @@ export interface ChargeCardListPayload {
|
|
|
13
12
|
user_roles: UserRolePayload[];
|
|
14
13
|
addresses: AddressPayload[];
|
|
15
14
|
cards_count_by_user_id?: ActiveChargeCardCountPayload[];
|
|
16
|
-
debit_cards_count_by_deposit_account_id?: Record<ID, ActiveDebitCardCountByUserIdPayload>;
|
|
17
15
|
}
|
|
18
16
|
export type FetchChargeCardListResponse = ZeniAPIResponse<ChargeCardListPayload>;
|
|
19
17
|
export interface CreditAccountPayload {
|
|
@@ -37,18 +35,5 @@ interface CreditAccountListPayload {
|
|
|
37
35
|
credit_accounts: CreditAccountPayload[];
|
|
38
36
|
}
|
|
39
37
|
export type FetchCreditAccountResponse = ZeniAPIResponse<CreditAccountListPayload>;
|
|
40
|
-
export interface DebitCardSummariesPayload {
|
|
41
|
-
current_month_spends: number;
|
|
42
|
-
last_completed_month_spends: number;
|
|
43
|
-
currency_code: string;
|
|
44
|
-
currency_symbol: string;
|
|
45
|
-
spends_percent_change: number;
|
|
46
|
-
last_completed_month_start_time: string;
|
|
47
|
-
last_completed_month_end_time: string;
|
|
48
|
-
}
|
|
49
|
-
interface DebitCardSummaryPayload {
|
|
50
|
-
debit_card_summaries: DebitCardSummariesPayload;
|
|
51
|
-
}
|
|
52
|
-
export type FetchDebitCardSummaryResponse = ZeniAPIResponse<DebitCardSummaryPayload>;
|
|
53
38
|
export type ResendInviteResponse = ZeniAPIResponse<ChargeCardPayload>;
|
|
54
39
|
export {};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { ID } from '../../../../commonStateTypes/common';
|
|
2
2
|
import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
3
3
|
import { ChargeCardListState, ChargeCardListUIState } from './chargeCardList';
|
|
4
|
-
import { ChargeCardListPayload, CreditAccountPayload
|
|
4
|
+
import { ChargeCardListPayload, CreditAccountPayload } from './chargeCardListPayload';
|
|
5
5
|
export declare const initialState: ChargeCardListState;
|
|
6
|
-
export declare const fetchChargeCardListPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[
|
|
7
|
-
|
|
8
|
-
isDebitCardEnabled: boolean;
|
|
9
|
-
isCreditCardEnabled: boolean;
|
|
6
|
+
export declare const fetchChargeCardListPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[doFetchCreditAccountsAndCashback: boolean, cacheOverride?: any], {
|
|
7
|
+
doFetchCreditAccountsAndCashback: boolean;
|
|
10
8
|
cacheOverride: any;
|
|
11
|
-
}, "chargeCardList/fetchChargeCardListPage", never, never>, fetchCreditAccount: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardList/fetchCreditAccount">, updateCreditAccount: import("@reduxjs/toolkit").ActionCreatorWithPayload<CreditAccountPayload[], "chargeCardList/updateCreditAccount">, updateCreditAccountFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "chargeCardList/updateCreditAccountFailure">,
|
|
9
|
+
}, "chargeCardList/fetchChargeCardListPage", never, never>, fetchCreditAccount: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardList/fetchCreditAccount">, updateCreditAccount: import("@reduxjs/toolkit").ActionCreatorWithPayload<CreditAccountPayload[], "chargeCardList/updateCreditAccount">, updateCreditAccountFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "chargeCardList/updateCreditAccountFailure">, fetchChargeCardList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardList/fetchChargeCardList">, updateChargeCardList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
12
10
|
chargeCardListPayload: ChargeCardListPayload;
|
|
13
11
|
keepExistingListItems?: boolean;
|
|
14
12
|
}, "chargeCardList/updateChargeCardList">, updateChargeCardListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "chargeCardList/updateChargeCardListFailure">, updateSearchText: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "chargeCardList/updateSearchText">, updateChargeCardListUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.revokeCardInviteFailure = exports.revokeCardInviteSuccess = exports.revokeCardInvite = exports.resendCardInviteFailure = exports.resendCardInviteSuccess = exports.resendCardInvite = exports.clearChargeCardList = exports.updateChargeCardListUIState = exports.updateSearchText = exports.updateChargeCardListFailure = exports.updateChargeCardList = exports.fetchChargeCardList = exports.
|
|
4
|
+
exports.revokeCardInviteFailure = exports.revokeCardInviteSuccess = exports.revokeCardInvite = exports.resendCardInviteFailure = exports.resendCardInviteSuccess = exports.resendCardInvite = exports.clearChargeCardList = exports.updateChargeCardListUIState = exports.updateSearchText = exports.updateChargeCardListFailure = exports.updateChargeCardList = exports.fetchChargeCardList = exports.updateCreditAccountFailure = exports.updateCreditAccount = exports.fetchCreditAccount = exports.fetchChargeCardListPage = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const amount_1 = require("../../../../commonStateTypes/amount");
|
|
7
|
-
const zeniDayJS_1 = require("../../../../zeniDayJS");
|
|
8
7
|
const chargeCardList_1 = require("./chargeCardList");
|
|
9
8
|
exports.initialState = {
|
|
10
9
|
fetchState: 'Not-Started',
|
|
@@ -13,7 +12,6 @@ exports.initialState = {
|
|
|
13
12
|
searchText: '',
|
|
14
13
|
unAssignedCredits: undefined,
|
|
15
14
|
creditAccount: chargeCardList_1.initialCreditAcc,
|
|
16
|
-
debitCardSummaries: chargeCardList_1.initialDebitCardSummaries,
|
|
17
15
|
hasValidState() {
|
|
18
16
|
return this.fetchState == 'Completed';
|
|
19
17
|
},
|
|
@@ -32,14 +30,9 @@ const chargeCardList = (0, toolkit_1.createSlice)({
|
|
|
32
30
|
reducer() {
|
|
33
31
|
//do nothing
|
|
34
32
|
},
|
|
35
|
-
prepare(
|
|
33
|
+
prepare(doFetchCreditAccountsAndCashback, cacheOverride = false) {
|
|
36
34
|
return {
|
|
37
|
-
payload: {
|
|
38
|
-
doFetchCreditAccountsDebitSummaryAndCashback,
|
|
39
|
-
isDebitCardEnabled,
|
|
40
|
-
isCreditCardEnabled,
|
|
41
|
-
cacheOverride,
|
|
42
|
-
},
|
|
35
|
+
payload: { doFetchCreditAccountsAndCashback, cacheOverride },
|
|
43
36
|
};
|
|
44
37
|
},
|
|
45
38
|
},
|
|
@@ -55,16 +48,6 @@ const chargeCardList = (0, toolkit_1.createSlice)({
|
|
|
55
48
|
updateCreditAccountFailure(draft, action) {
|
|
56
49
|
draft.creditAccount = Object.assign(Object.assign({}, chargeCardList_1.initialCreditAcc), { fetchState: 'Error', error: action.payload });
|
|
57
50
|
},
|
|
58
|
-
fetchDebitCardSummary(draft) {
|
|
59
|
-
draft.debitCardSummaries.fetchState = 'In-Progress';
|
|
60
|
-
draft.debitCardSummaries.error = undefined;
|
|
61
|
-
},
|
|
62
|
-
updateDebitCardSummary(draft, action) {
|
|
63
|
-
draft.debitCardSummaries = toDebitCardSummaries(action.payload);
|
|
64
|
-
},
|
|
65
|
-
updateDebitCardSummaryFailure(draft, action) {
|
|
66
|
-
draft.debitCardSummaries = Object.assign(Object.assign({}, chargeCardList_1.initialDebitCardSummaries), { fetchState: 'Error', error: action.payload });
|
|
67
|
-
},
|
|
68
51
|
fetchChargeCardList(draft) {
|
|
69
52
|
draft.fetchState = 'In-Progress';
|
|
70
53
|
draft.error = undefined;
|
|
@@ -145,7 +128,7 @@ const chargeCardList = (0, toolkit_1.createSlice)({
|
|
|
145
128
|
},
|
|
146
129
|
},
|
|
147
130
|
});
|
|
148
|
-
_a = chargeCardList.actions, exports.fetchChargeCardListPage = _a.fetchChargeCardListPage, exports.fetchCreditAccount = _a.fetchCreditAccount, exports.updateCreditAccount = _a.updateCreditAccount, exports.updateCreditAccountFailure = _a.updateCreditAccountFailure, exports.
|
|
131
|
+
_a = chargeCardList.actions, exports.fetchChargeCardListPage = _a.fetchChargeCardListPage, exports.fetchCreditAccount = _a.fetchCreditAccount, exports.updateCreditAccount = _a.updateCreditAccount, exports.updateCreditAccountFailure = _a.updateCreditAccountFailure, exports.fetchChargeCardList = _a.fetchChargeCardList, exports.updateChargeCardList = _a.updateChargeCardList, exports.updateChargeCardListFailure = _a.updateChargeCardListFailure, exports.updateSearchText = _a.updateSearchText, exports.updateChargeCardListUIState = _a.updateChargeCardListUIState, exports.clearChargeCardList = _a.clearChargeCardList, exports.resendCardInvite = _a.resendCardInvite, exports.resendCardInviteSuccess = _a.resendCardInviteSuccess, exports.resendCardInviteFailure = _a.resendCardInviteFailure, exports.revokeCardInvite = _a.revokeCardInvite, exports.revokeCardInviteSuccess = _a.revokeCardInviteSuccess, exports.revokeCardInviteFailure = _a.revokeCardInviteFailure;
|
|
149
132
|
exports.default = chargeCardList.reducer;
|
|
150
133
|
// helper
|
|
151
134
|
const toCreditAccount = (payload) => ({
|
|
@@ -161,12 +144,3 @@ const toCreditAccount = (payload) => ({
|
|
|
161
144
|
fetchState: 'Completed',
|
|
162
145
|
error: undefined,
|
|
163
146
|
});
|
|
164
|
-
const toDebitCardSummaries = (payload) => ({
|
|
165
|
-
currentMonthSpends: (0, amount_1.toAmount)(payload.current_month_spends, payload.currency_code, payload.currency_symbol),
|
|
166
|
-
lastCompletedMonthSpends: (0, amount_1.toAmount)(payload.last_completed_month_spends, payload.currency_code, payload.currency_symbol),
|
|
167
|
-
spendsPercentChange: payload.spends_percent_change,
|
|
168
|
-
lastCompletedMonthStartTime: (0, zeniDayJS_1.date)(payload.last_completed_month_start_time),
|
|
169
|
-
lastCompletedMonthEndTime: (0, zeniDayJS_1.date)(payload.last_completed_month_end_time),
|
|
170
|
-
fetchState: 'Completed',
|
|
171
|
-
error: undefined,
|
|
172
|
-
});
|
|
@@ -9,7 +9,7 @@ import { UserRole } from '../../../../entity/userRole/userRoleState';
|
|
|
9
9
|
import { RootState } from '../../../../reducer';
|
|
10
10
|
import { Person } from '../../../people/peopleSelectorTypes';
|
|
11
11
|
import { ChargeCardConfigState } from '../chargeCardConfig/chargeCardConfigState';
|
|
12
|
-
import { ChargeCardListUIState, CreditAccount,
|
|
12
|
+
import { ChargeCardListUIState, CreditAccount, ResendRevokeCardInvite } from './chargeCardList';
|
|
13
13
|
export interface ChargeCardWithUser extends ChargeCard {
|
|
14
14
|
cardCreatedByUser: User;
|
|
15
15
|
cardHolderUser: User;
|
|
@@ -33,9 +33,6 @@ export interface ChargeCardListSelectorView extends SelectorView {
|
|
|
33
33
|
searchText: string;
|
|
34
34
|
resendCardInvite: ResendRevokeCardInvite;
|
|
35
35
|
revokeCardInvite: ResendRevokeCardInvite;
|
|
36
|
-
hasCreditCard: boolean;
|
|
37
|
-
hasDebitCard: boolean;
|
|
38
|
-
debitCardSummary?: DebitCardSummaries;
|
|
39
36
|
unAssignedCredits?: Amount;
|
|
40
37
|
}
|
|
41
38
|
export interface MyPendingActivationChargeCardListSelectorView extends SelectorView {
|
|
@@ -45,7 +42,7 @@ export interface MyPendingActivationChargeCardListSelectorView extends SelectorV
|
|
|
45
42
|
export interface ChargeCardListWithShippingAddressSelectorView extends SelectorView {
|
|
46
43
|
cards: ChargeCardWithUserAndShippingAddress[];
|
|
47
44
|
}
|
|
48
|
-
export declare const getChargeCardListView: (state: RootState,
|
|
45
|
+
export declare const getChargeCardListView: (state: RootState, includeCreditAccountAndCashbackInfo: boolean) => ChargeCardListSelectorView;
|
|
49
46
|
export declare const getMyPendingActivationChargeCardListView: (state: RootState) => MyPendingActivationChargeCardListSelectorView;
|
|
50
47
|
export declare const getMyChargeCardListWithShippingAddress: (state: RootState) => ChargeCardListWithShippingAddressSelectorView;
|
|
51
48
|
/**
|
|
@@ -13,7 +13,7 @@ const classSelector_1 = require("../../../../entity/class/classSelector");
|
|
|
13
13
|
const userSelector_1 = require("../../../../entity/user/userSelector");
|
|
14
14
|
const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
|
|
15
15
|
const userListViewSelector_1 = require("../../../userListView/userListViewSelector");
|
|
16
|
-
const getChargeCardListView = (state,
|
|
16
|
+
const getChargeCardListView = (state, includeCreditAccountAndCashbackInfo) => {
|
|
17
17
|
const { chargeCardListState, chargeCardState, classState, userState, userRoleState, chargeCardConfigState, classListState, cashbackDetailState, userListViewState, } = state;
|
|
18
18
|
const searchText = chargeCardListState.searchText.toLowerCase();
|
|
19
19
|
const cards = (0, chargeCardSelector_1.getChargeCardsByIds)(chargeCardState, chargeCardListState.cardIds);
|
|
@@ -37,20 +37,15 @@ const getChargeCardListView = (state, includeCreditAccountDebitSummaryAndCashbac
|
|
|
37
37
|
const cardsInOrder = (0, orderBy_1.default)(chargeCardsWithUserFiltered, (person) => getCardsBySortKey(person, sortKey), sortOrder);
|
|
38
38
|
const userListSelectorView = (0, userListViewSelector_1.getUserList)(userState, userRoleState, userListViewState, 'cardHolderCandidate');
|
|
39
39
|
const userList = userListSelectorView.users;
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
requiredFetchStates.push(chargeCardListState.debitCardSummaries);
|
|
50
|
-
}
|
|
51
|
-
requiredFetchStates.push(cashbackDetailState);
|
|
52
|
-
}
|
|
53
|
-
const fetchState = (0, reduceFetchState_1.reduceFetchState)(requiredFetchStates).fetchState;
|
|
40
|
+
const fetchState = includeCreditAccountAndCashbackInfo === true
|
|
41
|
+
? (0, reduceFetchState_1.reduceFetchState)([
|
|
42
|
+
chargeCardListState,
|
|
43
|
+
chargeCardListState.creditAccount,
|
|
44
|
+
chargeCardConfigState,
|
|
45
|
+
cashbackDetailState,
|
|
46
|
+
]).fetchState
|
|
47
|
+
: (0, reduceFetchState_1.reduceFetchState)([chargeCardListState, chargeCardConfigState])
|
|
48
|
+
.fetchState;
|
|
54
49
|
const issueCardPageFetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
55
50
|
chargeCardConfigState,
|
|
56
51
|
userListSelectorView,
|
|
@@ -60,9 +55,6 @@ const getChargeCardListView = (state, includeCreditAccountDebitSummaryAndCashbac
|
|
|
60
55
|
classIds: classIds,
|
|
61
56
|
reportId: 'class_list',
|
|
62
57
|
});
|
|
63
|
-
// used to determine which card (summary or promo) to show in the UI
|
|
64
|
-
const hasCreditCard = chargeCardsWithUser.some((card) => card.type.code.includes('credit'));
|
|
65
|
-
const hasDebitCard = chargeCardsWithUser.some((card) => card.type.code.includes('debit'));
|
|
66
58
|
return {
|
|
67
59
|
fetchState,
|
|
68
60
|
error: chargeCardListState.error,
|
|
@@ -79,9 +71,6 @@ const getChargeCardListView = (state, includeCreditAccountDebitSummaryAndCashbac
|
|
|
79
71
|
version: '1.0',
|
|
80
72
|
resendCardInvite: chargeCardListState.resendCardInvite,
|
|
81
73
|
revokeCardInvite: chargeCardListState.revokeCardInvite,
|
|
82
|
-
debitCardSummary: chargeCardListState.debitCardSummaries,
|
|
83
|
-
hasCreditCard,
|
|
84
|
-
hasDebitCard,
|
|
85
74
|
};
|
|
86
75
|
};
|
|
87
76
|
exports.getChargeCardListView = getChargeCardListView;
|
|
@@ -91,8 +80,7 @@ const getMyPendingActivationChargeCardListView = (state) => {
|
|
|
91
80
|
const cards = (0, chargeCardSelector_1.getChargeCardsByIds)(chargeCardState, chargeCardListState.cardIds);
|
|
92
81
|
const myUserId = (_a = tenantState.loggedInUser) === null || _a === void 0 ? void 0 : _a.userId;
|
|
93
82
|
const myPendingActivationChargeCardWithUser = getChargeCardsWithUser(cards, state).filter((chargeCard) => chargeCard.cardHolderUserId === myUserId &&
|
|
94
|
-
|
|
95
|
-
chargeCard.type.code === 'business_physical_debit_card') &&
|
|
83
|
+
chargeCard.type.code === 'business_physical_credit_card' &&
|
|
96
84
|
chargeCard.status.code === 'inactive');
|
|
97
85
|
const sortKey = chargeCardListState.uiState.sortKey;
|
|
98
86
|
const sortOrder = (0, sortOrderPayload_1.getSortOrder)(chargeCardListState.uiState.sortOrder);
|
|
@@ -176,7 +164,7 @@ const getChargeCardsWithUser = (cards, { userState, userRoleState, classState, a
|
|
|
176
164
|
return chargeCardsWithUser;
|
|
177
165
|
};
|
|
178
166
|
const getCardsBySortKey = (card, sortKey) => {
|
|
179
|
-
var _a, _b;
|
|
167
|
+
var _a, _b, _c, _d;
|
|
180
168
|
switch (sortKey) {
|
|
181
169
|
case 'owner': {
|
|
182
170
|
const firstName = (_a = card.cardHolderUser) === null || _a === void 0 ? void 0 : _a.firstName.toLowerCase();
|
|
@@ -191,8 +179,8 @@ const getCardsBySortKey = (card, sortKey) => {
|
|
|
191
179
|
}
|
|
192
180
|
case 'cardName':
|
|
193
181
|
return card.cardName.toLowerCase();
|
|
194
|
-
case '
|
|
195
|
-
return card.
|
|
182
|
+
case 'department':
|
|
183
|
+
return (_d = (_c = card.department) === null || _c === void 0 ? void 0 : _c.className.toLowerCase()) !== null && _d !== void 0 ? _d : '';
|
|
196
184
|
case 'status':
|
|
197
185
|
return card.status.code;
|
|
198
186
|
case 'utilisation':
|
package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ import { fetchClassList } from '../../../classList/classListReducer';
|
|
|
5
5
|
import { fetchUserListByType } from '../../../userListView/userListViewReducer';
|
|
6
6
|
import { fetchCashbackDetail } from '../cashbackDetail/cashbackDetailReducer';
|
|
7
7
|
import { fetchChargeCardConfig } from '../chargeCardConfig/chargeCardConfigReducer';
|
|
8
|
-
import { fetchChargeCardList, fetchChargeCardListPage, fetchCreditAccount
|
|
9
|
-
export type ActionType = ReturnType<typeof fetchChargeCardListPage> | ReturnType<typeof fetchCreditAccount> | ReturnType<typeof fetchChargeCardList> | ReturnType<typeof fetchChargeCardConfig> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchCashbackDetail> | ReturnType<typeof fetchClassList
|
|
8
|
+
import { fetchChargeCardList, fetchChargeCardListPage, fetchCreditAccount } from './chargeCardListReducer';
|
|
9
|
+
export type ActionType = ReturnType<typeof fetchChargeCardListPage> | ReturnType<typeof fetchCreditAccount> | ReturnType<typeof fetchChargeCardList> | ReturnType<typeof fetchChargeCardConfig> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchCashbackDetail> | ReturnType<typeof fetchClassList>;
|
|
10
10
|
export declare const fetchChargeCardListPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|