@zeniai/client-epic-state 4.16.1 → 4.16.2
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 +26 -8
- package/lib/entity/chargeCard/chargeCard.js +25 -6
- package/lib/entity/chargeCard/chargeCardPayload.d.ts +41 -5
- package/lib/entity/chargeCard/chargeCardPayload.js +20 -8
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.js +5 -1
- package/lib/entity/company/companyPayload.d.ts +12 -1
- package/lib/entity/company/companyPayload.js +14 -0
- package/lib/entity/company/companyStateTypes.d.ts +11 -0
- package/lib/entity/connectedAccount/connectedAccount.d.ts +19 -0
- package/lib/entity/connectedAccount/connectedAccount.js +10 -0
- package/lib/entity/connectedAccount/connectedAccountPayload.d.ts +11 -0
- package/lib/entity/connectedAccount/connectedAccountPayload.js +15 -0
- package/lib/entity/connectedAccount/connectedAccountReducer.d.ts +6 -0
- package/lib/entity/connectedAccount/connectedAccountReducer.js +27 -0
- package/lib/entity/connectedAccount/connectedAccountSelector.d.ts +4 -0
- package/lib/entity/connectedAccount/connectedAccountSelector.js +17 -0
- package/lib/entity/depositAccount/depositAccount.d.ts +20 -2
- package/lib/entity/depositAccount/depositAccountPayload.d.ts +22 -1
- package/lib/entity/depositAccount/depositAccountPayload.js +39 -1
- package/lib/entity/depositAccount/depositAccountReducer.d.ts +2 -2
- package/lib/entity/depositAccount/depositAccountReducer.js +8 -2
- package/lib/entity/depositAccount/depositAccountSelector.d.ts +3 -1
- package/lib/entity/depositAccount/depositAccountSelector.js +10 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
- package/lib/entity/tenant/clearAllEpic.js +2 -0
- package/lib/entity/tenant/tenantSelector.d.ts +6 -2
- package/lib/entity/tenant/tenantSelector.js +10 -2
- package/lib/epic.d.ts +5 -1
- package/lib/epic.js +5 -1
- package/lib/index.d.ts +18 -18
- package/lib/index.js +26 -17
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +8 -0
- package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +16 -0
- package/lib/view/addressView/addressViewState.d.ts +1 -1
- package/lib/view/dashboard/dashboardSelector.js +7 -6
- package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.js +5 -4
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +1 -2
- package/lib/view/expenseAutomationView/epics/fluxAnalysis/fetchFluxAnalysisViewEpic.js +18 -6
- package/lib/view/expenseAutomationView/epics/fluxAnalysis/reviewFluxAnalysisEpic.js +1 -4
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +7 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/initializeTransactionCategorizationLocalDataEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscatgorizedEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscatgorizedEpic.js +3 -3
- package/lib/view/expenseAutomationView/helpers/helpers.js +4 -4
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +2 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +27 -24
- package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.d.ts +22 -9
- package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.js +2 -2
- package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.d.ts +13 -5
- package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.js +245 -115
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +4 -3
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +14 -19
- package/lib/view/expenseAutomationView/selectorTypes/fluxAnalysisViewSelectorTypes.d.ts +29 -9
- package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +108 -40
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +9 -1
- package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.d.ts +40 -15
- package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.js +1 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.js +1 -0
- package/lib/view/onboardingView/cockpitView/epic/initializeOnboardingCustomerViewUpdateDataEpic.js +4 -4
- package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.d.ts +2 -1
- package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.js +2 -2
- package/lib/view/settingsView/settingsViewHelpers.d.ts +4 -4
- package/lib/view/settingsView/settingsViewHelpers.js +9 -8
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +1 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +6 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +20 -2
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +5 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +9 -2
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +1 -0
- package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingSelector.js +4 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.d.ts +5 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.js +4 -2
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +8 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigState.d.ts +4 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +12 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +26 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailPayload.d.ts +2 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +43 -4
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +104 -9
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +70 -16
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +12 -3
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionListEpic.js +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchDepositAccountLimitEpic.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchDepositAccountLimitEpic.js +41 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardLimitEpic.js +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateDebitCardPinAttemptEpic.d.ts +11 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateDebitCardPinAttemptEpic.js +42 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +11 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +20 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +16 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +6 -4
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +30 -4
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +5 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +26 -14
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +20 -5
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchDebitCardSummaryEpic.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchDebitCardSummaryEpic.js +23 -0
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewReducer.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewReducer.js +4 -2
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.js +2 -0
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/acceptChargeCardTermsEpic.js +19 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/depositAccountWithLimitPayload.d.ts +6 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/depositAccountWithLimitPayload.js +2 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchDepositAccountListForCardsEpic.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchDepositAccountListForCardsEpic.js +31 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.js +15 -3
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +65 -25
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +11 -3
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +45 -11
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +6 -3
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +33 -18
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +41 -8
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.js +0 -21
- package/lib/view/spendManagement/commonSetup/epic/setup/enableSetupEpic.js +9 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +8 -3
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +4 -4
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -1
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +3 -1
- package/lib/view/spendManagement/commonSetup/setupViewState.js +13 -1
- package/lib/view/spendManagement/helpers.d.ts +3 -0
- package/lib/view/spendManagement/helpers.js +13 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/getPaymentAccountsEpic.js +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountEpic.js +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountLoginStatusEpic.js +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountStatusEpic.js +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.d.ts +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +6 -1
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +10 -10
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +1 -0
- 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/transactionDetail/epics/markTransactionAsNotMiscategorizedEpic.d.ts +4 -3
- package/lib/view/transactionDetail/epics/markTransactionAsNotMiscategorizedEpic.js +25 -1
- package/lib/view/transactionDetail/epics/saveTransactionDetailEpic.js +1 -1
- package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +1 -1
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +4 -2
- package/lib/view/transactionDetail/transactionDetailReducer.js +4 -2
- package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +3 -2
- package/lib/view/twoFactorAuthentication/resendOtpEpic.js +44 -19
- package/lib/view/twoFactorAuthentication/sendOtpEpic.d.ts +2 -1
- package/lib/view/twoFactorAuthentication/sendOtpEpic.js +45 -18
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.d.ts +17 -5
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.js +33 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.d.ts +7 -7
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.js +6 -6
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.d.ts +22 -6
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.js +176 -60
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.d.ts +5 -3
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.js +13 -2
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.d.ts +5 -2
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.js +46 -5
- package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +2 -2
- package/lib/view/userListView/fetchUserListByTypeEpic.js +4 -3
- package/lib/view/userListView/userListViewPayload.d.ts +11 -0
- package/package.json +5 -4
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearIssueChargeCard = exports.fetchIssueCardPage = exports.
|
|
4
|
+
exports.clearIssueChargeCard = exports.updateDepositAccountListForCardsFetchStatus = exports.fetchDepositAccountListForCards = exports.updateDepositAccountsInCards = exports.fetchIssueCardPage = exports.updateDebitCardCount = exports.updateChargeCardCount = exports.updateCustomAddressId = exports.resetIssueChargeCardForm = exports.issueChargeCardSuccessOrFailure = exports.updateChargeCardsLocalStore = exports.issueChargeCards = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const issueChargeCardState_1 = require("./issueChargeCardState");
|
|
7
6
|
exports.initialState = {
|
|
8
|
-
|
|
7
|
+
depositAccountIds: [],
|
|
8
|
+
depositAccountsFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
9
|
+
localData: [],
|
|
9
10
|
fetchState: 'Not-Started',
|
|
10
11
|
error: undefined,
|
|
11
12
|
saveStatus: {
|
|
@@ -15,7 +16,8 @@ exports.initialState = {
|
|
|
15
16
|
hasValidState() {
|
|
16
17
|
return this.fetchState == 'Completed';
|
|
17
18
|
},
|
|
18
|
-
|
|
19
|
+
activeChargeCardCount: {},
|
|
20
|
+
activeDebitCardCountByDepositAccountId: {},
|
|
19
21
|
};
|
|
20
22
|
const issueChargeCard = (0, toolkit_1.createSlice)({
|
|
21
23
|
name: 'issueChargeCard',
|
|
@@ -25,9 +27,13 @@ const issueChargeCard = (0, toolkit_1.createSlice)({
|
|
|
25
27
|
reducer() {
|
|
26
28
|
//do nothing
|
|
27
29
|
},
|
|
28
|
-
prepare(cacheOverride = false) {
|
|
30
|
+
prepare(isDebitCardFlagEnabled, isCreditCardFlagEnabled, cacheOverride = false) {
|
|
29
31
|
return {
|
|
30
|
-
payload: {
|
|
32
|
+
payload: {
|
|
33
|
+
isDebitCardFlagEnabled,
|
|
34
|
+
isCreditCardFlagEnabled,
|
|
35
|
+
cacheOverride,
|
|
36
|
+
},
|
|
31
37
|
};
|
|
32
38
|
},
|
|
33
39
|
},
|
|
@@ -52,24 +58,52 @@ const issueChargeCard = (0, toolkit_1.createSlice)({
|
|
|
52
58
|
draft.saveStatus.error = action.payload.error;
|
|
53
59
|
},
|
|
54
60
|
updateCustomAddressId(draft, action) {
|
|
55
|
-
const { addressId, cardLineId } = action.payload;
|
|
61
|
+
const { addressId, cardLineId, cardType } = action.payload;
|
|
56
62
|
const targetIndex = draft.localData.findIndex((lineItem) => lineItem.lineId === cardLineId);
|
|
57
63
|
if (targetIndex > -1) {
|
|
58
|
-
|
|
64
|
+
if (cardType === 'business_physical_credit_card') {
|
|
65
|
+
draft.localData[targetIndex] = Object.assign(Object.assign({}, draft.localData[targetIndex]), { creditCard: Object.assign(Object.assign({}, draft.localData[targetIndex].creditCard), { physicalCard: Object.assign(Object.assign({}, draft.localData[targetIndex].creditCard.physicalCard), { addressId: addressId }) }) });
|
|
66
|
+
}
|
|
67
|
+
else if (cardType === 'business_physical_debit_card') {
|
|
68
|
+
draft.localData[targetIndex] = Object.assign(Object.assign({}, draft.localData[targetIndex]), { debitCard: Object.assign(Object.assign({}, draft.localData[targetIndex].debitCard), { physicalCard: Object.assign(Object.assign({}, draft.localData[targetIndex].debitCard.physicalCard), { addressId: addressId }) }) });
|
|
69
|
+
}
|
|
59
70
|
}
|
|
60
71
|
},
|
|
61
|
-
|
|
72
|
+
updateChargeCardCount(draft, action) {
|
|
62
73
|
action.payload.forEach((activeChargeCardCountPayload) => {
|
|
63
|
-
draft.
|
|
74
|
+
draft.activeChargeCardCount[activeChargeCardCountPayload.user_id] = {
|
|
64
75
|
physicalCardCount: activeChargeCardCountPayload.business_physical_credit_card_count,
|
|
65
76
|
virtualCardCount: activeChargeCardCountPayload.business_virtual_credit_card_count,
|
|
66
77
|
};
|
|
67
78
|
});
|
|
68
79
|
},
|
|
80
|
+
updateDebitCardCount(draft, action) {
|
|
81
|
+
Object.entries(action.payload).forEach(([depositAccountId, activeDebitCardCountByUserIdPayload]) => {
|
|
82
|
+
Object.entries(activeDebitCardCountByUserIdPayload).forEach(([userId, activeDebitCardCount]) => {
|
|
83
|
+
draft.activeDebitCardCountByDepositAccountId = Object.assign(Object.assign({}, draft.activeDebitCardCountByDepositAccountId), { [depositAccountId]: Object.assign(Object.assign({}, draft.activeDebitCardCountByDepositAccountId[depositAccountId]), { [userId]: {
|
|
84
|
+
physicalCardCount: activeDebitCardCount.business_physical_debit_card_count,
|
|
85
|
+
virtualCardCount: activeDebitCardCount.business_virtual_debit_card_count,
|
|
86
|
+
} }) });
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
fetchDepositAccountListForCards(draft) {
|
|
91
|
+
draft.depositAccountsFetchState.error = undefined;
|
|
92
|
+
draft.depositAccountsFetchState.fetchState = 'In-Progress';
|
|
93
|
+
},
|
|
94
|
+
updateDepositAccountsInCards(draft, action) {
|
|
95
|
+
draft.depositAccountIds = action.payload.map((depositAccountWithLimitPayload) => depositAccountWithLimitPayload.deposit_account_id);
|
|
96
|
+
draft.depositAccountsFetchState.fetchState = 'Completed';
|
|
97
|
+
draft.depositAccountsFetchState.error = undefined;
|
|
98
|
+
},
|
|
99
|
+
updateDepositAccountListForCardsFetchStatus(draft, action) {
|
|
100
|
+
draft.depositAccountsFetchState.fetchState = action.payload.fetchState;
|
|
101
|
+
draft.depositAccountsFetchState.error = action.payload.error;
|
|
102
|
+
},
|
|
69
103
|
clearIssueChargeCard(draft) {
|
|
70
104
|
Object.assign(draft, exports.initialState);
|
|
71
105
|
},
|
|
72
106
|
},
|
|
73
107
|
});
|
|
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.
|
|
108
|
+
_a = issueChargeCard.actions, exports.issueChargeCards = _a.issueChargeCards, exports.updateChargeCardsLocalStore = _a.updateChargeCardsLocalStore, exports.issueChargeCardSuccessOrFailure = _a.issueChargeCardSuccessOrFailure, exports.resetIssueChargeCardForm = _a.resetIssueChargeCardForm, exports.updateCustomAddressId = _a.updateCustomAddressId, exports.updateChargeCardCount = _a.updateChargeCardCount, exports.updateDebitCardCount = _a.updateDebitCardCount, exports.fetchIssueCardPage = _a.fetchIssueCardPage, exports.updateDepositAccountsInCards = _a.updateDepositAccountsInCards, exports.fetchDepositAccountListForCards = _a.fetchDepositAccountListForCards, exports.updateDepositAccountListForCardsFetchStatus = _a.updateDepositAccountListForCardsFetchStatus, exports.clearIssueChargeCard = _a.clearIssueChargeCard;
|
|
75
109
|
exports.default = issueChargeCard.reducer;
|
|
@@ -2,22 +2,25 @@ import { FetchStateAndError, ID } from '../../../../commonStateTypes/common';
|
|
|
2
2
|
import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
3
|
import { Address } from '../../../../entity/address/addressState';
|
|
4
4
|
import { Class } from '../../../../entity/class/classState';
|
|
5
|
+
import { DepositAccountWithLimit } from '../../../../entity/depositAccount/depositAccount';
|
|
5
6
|
import { RootState } from '../../../../reducer';
|
|
6
7
|
import { Person } from '../../../people/peopleSelectorTypes';
|
|
7
8
|
import { ChargeCardConfigState } from '../chargeCardConfig/chargeCardConfigState';
|
|
8
9
|
import { CreditAccount } from '../chargeCardList/chargeCardList';
|
|
9
|
-
import { ActiveChargeCardCount, IssueChargeCardLocalData } from './issueChargeCardState';
|
|
10
|
+
import { ActiveChargeCardCount, ActiveDebitCardCountByUserId, IssueChargeCardLocalData } from './issueChargeCardState';
|
|
10
11
|
export interface IssueChargeCardSelectorView extends SelectorView {
|
|
11
12
|
localData: IssueChargeCardLocalData[];
|
|
12
13
|
issueCardStatus: FetchStateAndError;
|
|
13
14
|
userList: Person[];
|
|
15
|
+
depositAccounts: DepositAccountWithLimit[];
|
|
14
16
|
allAccountingClasses: Class[];
|
|
15
17
|
chargeCardConfig: ChargeCardConfigState;
|
|
16
18
|
creditAccount: CreditAccount;
|
|
17
19
|
customAddress: Record<ID, Address>;
|
|
18
20
|
customAddressStatus: Record<ID, FetchStateAndError>;
|
|
19
21
|
userAddress: Record<ID, Address>;
|
|
20
|
-
|
|
22
|
+
activeChargeCardCount: Record<ID, ActiveChargeCardCount>;
|
|
23
|
+
activeDebitCardCountByDepositAccountId: Record<ID, ActiveDebitCardCountByUserId>;
|
|
21
24
|
companyAddress?: Address;
|
|
22
25
|
}
|
|
23
|
-
export declare const getIssueChargeCardView: (state: RootState) => IssueChargeCardSelectorView;
|
|
26
|
+
export declare const getIssueChargeCardView: (state: RootState, isCreditCardEnabled: boolean, isDebitCardEnabled: boolean) => IssueChargeCardSelectorView;
|
|
@@ -4,14 +4,16 @@ exports.getIssueChargeCardView = void 0;
|
|
|
4
4
|
const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
|
|
5
5
|
const addressSelector_1 = require("../../../../entity/address/addressSelector");
|
|
6
6
|
const classSelector_1 = require("../../../../entity/class/classSelector");
|
|
7
|
+
const depositAccountSelector_1 = require("../../../../entity/depositAccount/depositAccountSelector");
|
|
7
8
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
9
|
const addressViewSelector_1 = require("../../../addressView/addressViewSelector");
|
|
9
10
|
const userListViewSelector_1 = require("../../../userListView/userListViewSelector");
|
|
10
|
-
const getIssueChargeCardView = (state) => {
|
|
11
|
+
const getIssueChargeCardView = (state, isCreditCardEnabled, isDebitCardEnabled) => {
|
|
11
12
|
var _a;
|
|
12
|
-
const { issueChargeCardState, userState, userRoleState, userListViewState, chargeCardConfigState, chargeCardListState, addressState, classState, classListState, } = state;
|
|
13
|
+
const { issueChargeCardState, userState, userRoleState, userListViewState, chargeCardConfigState, chargeCardListState, addressState, classState, depositAccountState, classListState, } = state;
|
|
13
14
|
const userListSelectorView = (0, userListViewSelector_1.getUserList)(userState, userRoleState, userListViewState, 'cardHolderCandidate');
|
|
14
15
|
const userList = userListSelectorView.users;
|
|
16
|
+
const depositAccounts = (0, depositAccountSelector_1.getDepositAccountLimitsForChargeCardByDepositAccountIds)(depositAccountState, issueChargeCardState.depositAccountIds);
|
|
15
17
|
let selectedUserAddress = {};
|
|
16
18
|
userList.forEach((user) => {
|
|
17
19
|
var _a, _b;
|
|
@@ -31,17 +33,23 @@ const getIssueChargeCardView = (state) => {
|
|
|
31
33
|
};
|
|
32
34
|
issueChargeCardState.localData.forEach((lineItem) => {
|
|
33
35
|
var _a;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
let newlyAddedAddress;
|
|
37
|
+
const targetLineId = lineItem.lineId;
|
|
38
|
+
if (lineItem.chargeCardType === 'credit_card' &&
|
|
39
|
+
lineItem.creditCard.cardType === 'business_physical_credit_card') {
|
|
40
|
+
newlyAddedAddress = (0, addressViewSelector_1.getNewAddress)(`credit_custom_shipping_${targetLineId}_address`, state);
|
|
41
|
+
}
|
|
42
|
+
else if (lineItem.chargeCardType === 'debit_card' &&
|
|
43
|
+
lineItem.debitCard.cardType === 'business_physical_debit_card') {
|
|
44
|
+
newlyAddedAddress = (0, addressViewSelector_1.getNewAddress)(`debit_custom_shipping_${targetLineId}_address`, state);
|
|
45
|
+
}
|
|
46
|
+
customAddressStatus = Object.assign(Object.assign({}, customAddressStatus), { [targetLineId]: (_a = newlyAddedAddress === null || newlyAddedAddress === void 0 ? void 0 : newlyAddedAddress.status) !== null && _a !== void 0 ? _a : defaultFetchState });
|
|
47
|
+
if (newlyAddedAddress != null &&
|
|
48
|
+
newlyAddedAddress.status.fetchState === 'Completed' &&
|
|
49
|
+
newlyAddedAddress.newAddressId != null) {
|
|
50
|
+
const addressFromEntity = (0, addressSelector_1.getAddressByAddressId)(addressState, newlyAddedAddress.newAddressId);
|
|
51
|
+
if (addressFromEntity != null) {
|
|
52
|
+
customAddress = Object.assign(Object.assign({}, customAddress), { [targetLineId]: addressFromEntity });
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
55
|
});
|
|
@@ -50,20 +58,26 @@ const getIssueChargeCardView = (state) => {
|
|
|
50
58
|
classIds: classIds,
|
|
51
59
|
reportId: 'class_list',
|
|
52
60
|
});
|
|
53
|
-
const
|
|
61
|
+
const requiredFetchStates = [
|
|
54
62
|
chargeCardConfigState,
|
|
55
63
|
userListViewState.userListByType.cardHolderCandidate,
|
|
56
64
|
userListSelectorView,
|
|
57
|
-
chargeCardListState.creditAccount,
|
|
58
65
|
classListState,
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
];
|
|
67
|
+
if (isDebitCardEnabled) {
|
|
68
|
+
requiredFetchStates.push(issueChargeCardState.depositAccountsFetchState);
|
|
69
|
+
}
|
|
70
|
+
if (isCreditCardEnabled) {
|
|
71
|
+
requiredFetchStates.push(chargeCardListState.creditAccount);
|
|
72
|
+
}
|
|
73
|
+
const issueCardPageFetchState = (0, reduceFetchState_1.reduceFetchState)(requiredFetchStates);
|
|
61
74
|
return {
|
|
62
75
|
fetchState: issueCardPageFetchState.fetchState,
|
|
63
76
|
error: issueCardPageFetchState.error,
|
|
64
77
|
issueCardStatus: issueChargeCardState.saveStatus,
|
|
65
78
|
localData: issueChargeCardState.localData,
|
|
66
79
|
userList,
|
|
80
|
+
depositAccounts,
|
|
67
81
|
chargeCardConfig: chargeCardConfigState,
|
|
68
82
|
creditAccount: chargeCardListState.creditAccount,
|
|
69
83
|
companyAddress: companyAddress,
|
|
@@ -71,7 +85,8 @@ const getIssueChargeCardView = (state) => {
|
|
|
71
85
|
customAddressStatus,
|
|
72
86
|
userAddress: selectedUserAddress,
|
|
73
87
|
allAccountingClasses,
|
|
74
|
-
|
|
88
|
+
activeChargeCardCount: issueChargeCardState.activeChargeCardCount,
|
|
89
|
+
activeDebitCardCountByDepositAccountId: issueChargeCardState.activeDebitCardCountByDepositAccountId,
|
|
75
90
|
};
|
|
76
91
|
};
|
|
77
92
|
exports.getIssueChargeCardView = getIssueChargeCardView;
|
|
@@ -1,33 +1,66 @@
|
|
|
1
1
|
import { Amount } from '../../../../commonStateTypes/amount';
|
|
2
2
|
import { FetchStateAndError, FetchedState, ID } from '../../../../commonStateTypes/common';
|
|
3
|
-
import {
|
|
3
|
+
import { ChargeCardType, CreditCardCodeType, CreditLimitFrequencyCodeType, DebitCardCodeType, ShippingAddressType } from '../../../../entity/chargeCard/chargeCard';
|
|
4
4
|
export interface IssueChargeCardState extends FetchedState {
|
|
5
5
|
localData: IssueChargeCardLocalData[];
|
|
6
6
|
saveStatus: FetchStateAndError;
|
|
7
|
-
|
|
7
|
+
activeChargeCardCount: Record<ID, ActiveChargeCardCount>;
|
|
8
|
+
activeDebitCardCountByDepositAccountId: Record<ID, ActiveDebitCardCountByUserId>;
|
|
9
|
+
depositAccountIds: ID[];
|
|
10
|
+
depositAccountsFetchState: FetchStateAndError;
|
|
8
11
|
}
|
|
9
12
|
export interface ActiveChargeCardCount {
|
|
10
13
|
physicalCardCount: number;
|
|
11
14
|
virtualCardCount: number;
|
|
12
15
|
}
|
|
13
|
-
export interface
|
|
16
|
+
export interface ActiveDebitCardCountByUserId {
|
|
17
|
+
[userId: ID]: ActiveDebitCardCount;
|
|
18
|
+
}
|
|
19
|
+
export interface ActiveDebitCardCount {
|
|
20
|
+
physicalCardCount: number;
|
|
21
|
+
virtualCardCount: number;
|
|
22
|
+
}
|
|
23
|
+
export interface PhysicalCreditCardData {
|
|
24
|
+
cardName: string;
|
|
25
|
+
frequency: CreditLimitFrequencyCodeType;
|
|
26
|
+
addressType?: ShippingAddressType;
|
|
27
|
+
addressId?: ID;
|
|
28
|
+
amount?: Amount;
|
|
29
|
+
userId?: ID;
|
|
30
|
+
}
|
|
31
|
+
export interface VirtualCreditCardData {
|
|
32
|
+
userIds: ID[];
|
|
33
|
+
cardName: string;
|
|
34
|
+
frequency: CreditLimitFrequencyCodeType;
|
|
35
|
+
amount?: Amount;
|
|
36
|
+
}
|
|
37
|
+
export interface PhysicalDebitCardData {
|
|
14
38
|
cardName: string;
|
|
15
39
|
frequency: CreditLimitFrequencyCodeType;
|
|
16
40
|
addressType?: ShippingAddressType;
|
|
17
41
|
addressId?: ID;
|
|
18
42
|
amount?: Amount;
|
|
19
43
|
userId?: ID;
|
|
44
|
+
connectedAccountId?: ID;
|
|
20
45
|
}
|
|
21
|
-
export interface
|
|
46
|
+
export interface VirtualDebitCardData {
|
|
22
47
|
userIds: ID[];
|
|
23
48
|
cardName: string;
|
|
24
49
|
frequency: CreditLimitFrequencyCodeType;
|
|
25
50
|
amount?: Amount;
|
|
51
|
+
connectedAccountId?: ID;
|
|
26
52
|
}
|
|
27
53
|
export interface IssueChargeCardLocalData {
|
|
28
54
|
lineId: ID;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
55
|
+
chargeCardType: ChargeCardType;
|
|
56
|
+
creditCard: {
|
|
57
|
+
cardType: CreditCardCodeType;
|
|
58
|
+
physicalCard: PhysicalCreditCardData;
|
|
59
|
+
virtualCard: VirtualCreditCardData;
|
|
60
|
+
};
|
|
61
|
+
debitCard: {
|
|
62
|
+
cardType: DebitCardCodeType;
|
|
63
|
+
physicalCard: PhysicalDebitCardData;
|
|
64
|
+
virtualCard: VirtualDebitCardData;
|
|
65
|
+
};
|
|
32
66
|
}
|
|
33
|
-
export declare const initialIssueChargeCardLocalData: IssueChargeCardLocalData[];
|
|
@@ -1,23 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initialIssueChargeCardLocalData = void 0;
|
|
4
|
-
exports.initialIssueChargeCardLocalData = [
|
|
5
|
-
{
|
|
6
|
-
lineId: '1',
|
|
7
|
-
cardType: 'business_virtual_credit_card',
|
|
8
|
-
physicalCard: {
|
|
9
|
-
userId: undefined,
|
|
10
|
-
cardName: '',
|
|
11
|
-
frequency: 'monthly',
|
|
12
|
-
addressType: undefined,
|
|
13
|
-
addressId: undefined,
|
|
14
|
-
amount: undefined,
|
|
15
|
-
},
|
|
16
|
-
virtualCard: {
|
|
17
|
-
userIds: [],
|
|
18
|
-
cardName: '',
|
|
19
|
-
frequency: 'monthly',
|
|
20
|
-
amount: undefined,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
];
|
|
@@ -18,6 +18,15 @@ const enableSetupEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operat
|
|
|
18
18
|
case 'charge_cards':
|
|
19
19
|
payload = { is_charge_cards_enabled: true };
|
|
20
20
|
break;
|
|
21
|
+
case 'debit_cards':
|
|
22
|
+
payload = { is_debit_cards_enabled: true };
|
|
23
|
+
break;
|
|
24
|
+
case 'charge_cards__debit_cards':
|
|
25
|
+
payload = {
|
|
26
|
+
is_charge_cards_enabled: true,
|
|
27
|
+
is_debit_cards_enabled: true,
|
|
28
|
+
};
|
|
29
|
+
break;
|
|
21
30
|
case 'zeni_accounts':
|
|
22
31
|
payload = { is_deposit_accounts_enabled: true };
|
|
23
32
|
break;
|
package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js
CHANGED
|
@@ -19,6 +19,7 @@ const responsePayload_1 = require("../../../../../responsePayload");
|
|
|
19
19
|
const addressViewPayload_1 = require("../../../../addressView/addressViewPayload");
|
|
20
20
|
const addressViewSelector_1 = require("../../../../addressView/addressViewSelector");
|
|
21
21
|
const getCompanyView_1 = require("../../../../companyView/selectorHelpers/getCompanyView");
|
|
22
|
+
const helpers_1 = require("../../../helpers");
|
|
22
23
|
const setupViewReducer_1 = require("../../setupViewReducer");
|
|
23
24
|
const updateBusinessVerificationDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(setupViewReducer_1.updateBusinessVerificationDetails.match), (0, operators_1.mergeMap)((action) => {
|
|
24
25
|
var _a, _b, _c, _d;
|
|
@@ -48,7 +49,7 @@ const updateBusinessVerificationDetailsEpic = (actions$, state$, zeniAPI) => act
|
|
|
48
49
|
Boolean(companyOfficerLocalData.email) === true // Don't save Empty Company Officer details
|
|
49
50
|
? (0, exports.toBusinessVerificationOfficerDataPayload)(companyOfficerLocalData, isSubmittingAdditionalDocuments, companyOfficerAddressToCreate)
|
|
50
51
|
: {};
|
|
51
|
-
const business_verification_submitted_for_feature =
|
|
52
|
+
const business_verification_submitted_for_feature = getBusinessVerificationForFeature(setupViewType);
|
|
52
53
|
let payload = {
|
|
53
54
|
company,
|
|
54
55
|
company_officer,
|
|
@@ -71,7 +72,7 @@ const updateBusinessVerificationDetailsEpic = (actions$, state$, zeniAPI) => act
|
|
|
71
72
|
}),
|
|
72
73
|
(0, addressReducer_1.updateAddresses)(response.data.addresses),
|
|
73
74
|
(0, fileReducer_1.updateFiles)({ files: response.data.files }),
|
|
74
|
-
(0, accountReducer_1.updateAccounts)(response.data.accounts, setupViewType),
|
|
75
|
+
(0, accountReducer_1.updateAccounts)(response.data.accounts, (0, helpers_1.getReportIDPlusForecastIDFromSetupViewType)(setupViewType)),
|
|
75
76
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
76
77
|
(0, setupViewReducer_1.updateSetupViewLocalStoreData)({
|
|
77
78
|
companyId: response.data.companies[0].company_id,
|
|
@@ -238,10 +239,14 @@ const toBusinessVerificationOfficerDataPayload = (companyOfficer, isSubmittingAd
|
|
|
238
239
|
return company_officer;
|
|
239
240
|
};
|
|
240
241
|
exports.toBusinessVerificationOfficerDataPayload = toBusinessVerificationOfficerDataPayload;
|
|
241
|
-
const
|
|
242
|
+
const getBusinessVerificationForFeature = (setupViewType) => {
|
|
242
243
|
switch (setupViewType) {
|
|
243
244
|
case 'charge_cards':
|
|
244
245
|
return 'charge_cards';
|
|
246
|
+
case 'debit_cards':
|
|
247
|
+
return 'debit_cards';
|
|
248
|
+
case 'charge_cards__debit_cards':
|
|
249
|
+
return 'charge_cards__debit_cards';
|
|
245
250
|
case 'reimbursement':
|
|
246
251
|
return 'reimbursements';
|
|
247
252
|
case 'zeni_accounts':
|
|
@@ -4,13 +4,13 @@ import { ZeniDate } from '../../../zeniDayJS';
|
|
|
4
4
|
import { CompanyOfficerType } from '../../companyView/types/companyPassport/companyUsersLocalData';
|
|
5
5
|
import { SetupViewLocalData, SetupViewState } from './setupViewState';
|
|
6
6
|
export declare const initialState: SetupViewState;
|
|
7
|
-
export declare const enableSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing"], {
|
|
7
|
+
export declare const enableSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing" | "debit_cards" | "charge_cards__debit_cards"], {
|
|
8
8
|
companyId: string;
|
|
9
|
-
setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing";
|
|
10
|
-
}, "setupView/enableSetup", never, never>, enableSetupSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/enableSetupSuccess">, enableSetupFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "setupView/enableSetupFailure", never, never>, updateBusinessVerificationDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, officerType: "Officer_1" | "Officer_3" | "Officer_2" | "Officer_4" | "Officer_5" | "Officer_6" | "Officer_7" | "Officer_8" | "Officer_9" | "Officer_10", setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing", sendForVerification?: any, fromBillListScreen?: any, isSubmittingAdditionalDocuments?: any], {
|
|
9
|
+
setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing" | "debit_cards" | "charge_cards__debit_cards";
|
|
10
|
+
}, "setupView/enableSetup", never, never>, enableSetupSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/enableSetupSuccess">, enableSetupFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "setupView/enableSetupFailure", never, never>, updateBusinessVerificationDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, officerType: "Officer_1" | "Officer_3" | "Officer_2" | "Officer_4" | "Officer_5" | "Officer_6" | "Officer_7" | "Officer_8" | "Officer_9" | "Officer_10", setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing" | "debit_cards" | "charge_cards__debit_cards", sendForVerification?: any, fromBillListScreen?: any, isSubmittingAdditionalDocuments?: any], {
|
|
11
11
|
companyId: string;
|
|
12
12
|
officerType: "Officer_1" | "Officer_3" | "Officer_2" | "Officer_4" | "Officer_5" | "Officer_6" | "Officer_7" | "Officer_8" | "Officer_9" | "Officer_10";
|
|
13
|
-
setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing";
|
|
13
|
+
setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing" | "debit_cards" | "charge_cards__debit_cards";
|
|
14
14
|
sendForVerification: any;
|
|
15
15
|
fromBillListScreen: any;
|
|
16
16
|
isSubmittingAdditionalDocuments: any;
|
|
@@ -10,6 +10,7 @@ const fileSelector_1 = require("../../../entity/file/fileSelector");
|
|
|
10
10
|
const paymentAccountSelector_1 = require("../../../entity/paymentAccount/paymentAccountSelector");
|
|
11
11
|
const getCompanyView_1 = require("../../companyView/selectorHelpers/getCompanyView");
|
|
12
12
|
const fileViewSelector_1 = require("../../fileView/fileViewSelector");
|
|
13
|
+
const helpers_1 = require("../helpers");
|
|
13
14
|
const plaidAccountViewSelector_1 = require("../plaidAccount/plaidAccountViewSelector");
|
|
14
15
|
function getCommonSetupViewDetails(state, companyId, setupViewType, plaidAccountKeyType) {
|
|
15
16
|
var _a, _b, _c, _d;
|
|
@@ -19,7 +20,7 @@ function getCommonSetupViewDetails(state, companyId, setupViewType, plaidAccount
|
|
|
19
20
|
const { allBankAccountIds } = accountDetails;
|
|
20
21
|
const { paymentAccountIds, paymentAccountBalanceFetchStatus } = paymentAccountListState;
|
|
21
22
|
const { accountIds: depositAccountIds } = depositAccountListState;
|
|
22
|
-
const allBankAccounts = (_a = allBankAccountIds === null || allBankAccountIds === void 0 ? void 0 : allBankAccountIds.map((accountId) => (0, accountSelector_1.getAccountBase)(accountState, accountId, setupViewType)).filter((account) => account != null)) !== null && _a !== void 0 ? _a : [];
|
|
23
|
+
const allBankAccounts = (_a = allBankAccountIds === null || allBankAccountIds === void 0 ? void 0 : allBankAccountIds.map((accountId) => (0, accountSelector_1.getAccountBase)(accountState, accountId, (0, helpers_1.getReportIDPlusForecastIDFromSetupViewType)(setupViewType))).filter((account) => account != null)) !== null && _a !== void 0 ? _a : [];
|
|
23
24
|
const paymentAccounts = (_b = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, paymentAccountIds).filter((account) => account != null)) !== null && _b !== void 0 ? _b : [];
|
|
24
25
|
const depositAccounts = (_c = (0, depositAccountSelector_1.getDepositAccountsByDepositAccountIds)(depositAccountState, depositAccountIds).filter((account) => account != null)) !== null && _c !== void 0 ? _c : [];
|
|
25
26
|
const allFundingAccounts = (0, exports.getAllFundingAccounts)(setupViewType === 'zeni_accounts' ? [] : depositAccounts, // only external acct can be made primary for accounts setup
|
|
@@ -4,8 +4,10 @@ import { AllowedDocumentType } from '../../../entity/file/fileState';
|
|
|
4
4
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
5
5
|
import ZeniUrl from '../../../zeniUrl';
|
|
6
6
|
import { CompanyOfficerType } from '../../companyView/types/companyPassport/companyUsersLocalData';
|
|
7
|
-
declare const toSetupViewType: (v: string) => "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing";
|
|
7
|
+
declare const toSetupViewType: (v: string) => "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing" | "debit_cards" | "charge_cards__debit_cards";
|
|
8
8
|
export type SetupViewType = ReturnType<typeof toSetupViewType>;
|
|
9
|
+
export declare const toChargeCardSetupViewType: (v: string) => "charge_cards" | "debit_cards" | "charge_cards__debit_cards";
|
|
10
|
+
export type ChargeCardSetupViewType = ReturnType<typeof toChargeCardSetupViewType>;
|
|
9
11
|
/**
|
|
10
12
|
* Setup View Local Data - Interfaces
|
|
11
13
|
*/
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toChargeCardSetupViewType = void 0;
|
|
3
4
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
4
5
|
const entityApprovalStatusState_1 = require("../../../entity/entityApprovalStatus/entityApprovalStatusState");
|
|
5
6
|
const SETUP_VIEW_TYPES = ['billing'];
|
|
6
7
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
7
|
-
const toSetupViewType = (v) => (0, stringToUnion_1.stringToUnion)(v, [
|
|
8
|
+
const toSetupViewType = (v) => (0, stringToUnion_1.stringToUnion)(v, [
|
|
9
|
+
...entityApprovalStatusState_1.ALL_ENTITY_TYPES,
|
|
10
|
+
...SETUP_VIEW_TYPES,
|
|
11
|
+
...CHARGE_CARD_SETUP_VIEW_TYPES,
|
|
12
|
+
]);
|
|
13
|
+
const CHARGE_CARD_SETUP_VIEW_TYPES = [
|
|
14
|
+
'charge_cards',
|
|
15
|
+
'debit_cards',
|
|
16
|
+
'charge_cards__debit_cards',
|
|
17
|
+
];
|
|
18
|
+
const toChargeCardSetupViewType = (v) => (0, stringToUnion_1.stringToUnion)(v, CHARGE_CARD_SETUP_VIEW_TYPES);
|
|
19
|
+
exports.toChargeCardSetupViewType = toChargeCardSetupViewType;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Amount } from '../../commonStateTypes/amount';
|
|
2
|
+
import { ReportIDPlusForecastID } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
2
3
|
import { BillPayInfo, BulkProcessingStateType } from '../../entity/billPay/billTransaction/billTransactionState';
|
|
3
4
|
import { RecurringBillConfig } from '../../entity/billPay/recurringBills/recurringBillsState';
|
|
4
5
|
import { ReimbursementTypeCode } from '../../entity/reimbursement/reimbursementState';
|
|
@@ -10,6 +11,7 @@ import { BillTransactionView } from './billPay/billList/billListSelector';
|
|
|
10
11
|
import { AccType, AccountTypeSubConfigCodeKeyType } from './billPay/billPayConfig/billPayConfigState';
|
|
11
12
|
import { RecurringBillConfigLocalData, RecurringBillInstance } from './billPay/editBillView/editBillViewState';
|
|
12
13
|
import { BusinessVerificationDetails, CompanyOfficersDetails } from './commonSetup/setupViewSelector';
|
|
14
|
+
import { SetupViewType } from './commonSetup/setupViewState';
|
|
13
15
|
import { RemiActivity } from './reimbursement/remiDetailView/remiDetailViewSelector';
|
|
14
16
|
export declare const getLatestApprovalDate: (allActivities: BillActivity[] | RemiActivity[]) => ZeniDate | undefined;
|
|
15
17
|
export declare function getSpendManagementEffectiveListPeriod(): import("../..").TimePeriod;
|
|
@@ -38,4 +40,5 @@ export interface ZeniAccountsPromoConfig {
|
|
|
38
40
|
export declare const toAccountsPromoConfig: (dynamicConfigValue: Record<string, unknown>) => ZeniAccountsPromoConfig;
|
|
39
41
|
export declare const isPaymentMethodOutsideZeni: (code?: string) => boolean;
|
|
40
42
|
export declare const isAwaitingMarkAsPaid: (code?: string) => boolean;
|
|
43
|
+
export declare const getReportIDPlusForecastIDFromSetupViewType: (setupViewType: SetupViewType) => ReportIDPlusForecastID;
|
|
41
44
|
export declare const checkIfLowBalance: (totalAmount: Amount, bankBalance: Amount) => boolean;
|
|
@@ -3,13 +3,14 @@ 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.checkIfLowBalance = exports.isAwaitingMarkAsPaid = exports.isPaymentMethodOutsideZeni = exports.toAccountsPromoConfig = exports.getBulkOperationSuffix = exports.getRemiListUniqueType = exports.getBillListUniqueType = exports.isBulkProcessing = exports.getActualPaymentDate = exports.accountTypeSubConfigCodeToAccType = exports.isRecurringConfigChanged = exports.updateRecurringBillDetails = exports.getPaymentDateFromVendorReceiveDate = exports.getSelectedCompanyOfficer = exports.getLatestApprovalDate = void 0;
|
|
6
|
+
exports.checkIfLowBalance = exports.getReportIDPlusForecastIDFromSetupViewType = exports.isAwaitingMarkAsPaid = exports.isPaymentMethodOutsideZeni = exports.toAccountsPromoConfig = exports.getBulkOperationSuffix = exports.getRemiListUniqueType = exports.getBillListUniqueType = exports.isBulkProcessing = exports.getActualPaymentDate = exports.accountTypeSubConfigCodeToAccType = exports.isRecurringConfigChanged = exports.updateRecurringBillDetails = exports.getPaymentDateFromVendorReceiveDate = exports.getSelectedCompanyOfficer = exports.getLatestApprovalDate = void 0;
|
|
7
7
|
exports.getSpendManagementEffectiveListPeriod = getSpendManagementEffectiveListPeriod;
|
|
8
8
|
exports.showReimbursementPromoPage = showReimbursementPromoPage;
|
|
9
9
|
exports.showBillPayPromoPage = showBillPayPromoPage;
|
|
10
10
|
exports.isVerifiedStatusCode = isVerifiedStatusCode;
|
|
11
11
|
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
12
12
|
const timeframeTick_1 = require("../../commonStateTypes/timeframeTick");
|
|
13
|
+
const viewAndReport_1 = require("../../commonStateTypes/viewAndReport/viewAndReport");
|
|
13
14
|
const workingDayHelper_1 = require("../../commonStateTypes/workingDayHelper");
|
|
14
15
|
const userRoleType_1 = require("../../entity/userRole/userRoleType");
|
|
15
16
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
@@ -339,6 +340,17 @@ const isAwaitingMarkAsPaid = (code) => {
|
|
|
339
340
|
return code != null ? code === 'awaiting_to_be_marked_as_paid' : false;
|
|
340
341
|
};
|
|
341
342
|
exports.isAwaitingMarkAsPaid = isAwaitingMarkAsPaid;
|
|
343
|
+
const getReportIDPlusForecastIDFromSetupViewType = (setupViewType) => {
|
|
344
|
+
if (setupViewType === 'charge_cards__debit_cards' ||
|
|
345
|
+
setupViewType === 'charge_cards' ||
|
|
346
|
+
setupViewType === 'debit_cards') {
|
|
347
|
+
return 'charge_cards';
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
return (0, viewAndReport_1.toReportID)(setupViewType);
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
exports.getReportIDPlusForecastIDFromSetupViewType = getReportIDPlusForecastIDFromSetupViewType;
|
|
342
354
|
const checkIfLowBalance = (totalAmount, bankBalance) => {
|
|
343
355
|
let isLowBalance = false;
|
|
344
356
|
if (totalAmount.currencyCode === bankBalance.currencyCode) {
|
package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/getPaymentAccountsEpic.js
CHANGED
|
@@ -6,6 +6,7 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const accountReducer_1 = require("../../../../../entity/account/accountReducer");
|
|
7
7
|
const paymentAccountReducer_1 = require("../../../../../entity/paymentAccount/paymentAccountReducer");
|
|
8
8
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
9
|
+
const helpers_1 = require("../../../helpers");
|
|
9
10
|
const plaidAccountViewReducer_1 = require("../../plaidAccountViewReducer");
|
|
10
11
|
const getPaymentAccountsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(plaidAccountViewReducer_1.getPaymentAccounts.match), (0, operators_1.switchMap)((action) => {
|
|
11
12
|
const { setupViewType, includeBalances, plaidAccountKeyType } = action.payload;
|
|
@@ -26,7 +27,7 @@ const getPaymentAccountsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0,
|
|
|
26
27
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
27
28
|
const paymentAccountIds = response.data.payment_accounts.map((paymentAccount) => paymentAccount.payment_account_id);
|
|
28
29
|
const actions = [
|
|
29
|
-
(0, accountReducer_1.updateAccounts)(response.data.accounts, setupViewType),
|
|
30
|
+
(0, accountReducer_1.updateAccounts)(response.data.accounts, (0, helpers_1.getReportIDPlusForecastIDFromSetupViewType)(setupViewType)),
|
|
30
31
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
31
32
|
(0, plaidAccountViewReducer_1.getPaymentAccountsSuccess)(paymentAccountIds, plaidAccountKeyType),
|
|
32
33
|
];
|
package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountEpic.js
CHANGED
|
@@ -6,6 +6,7 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const accountReducer_1 = require("../../../../../entity/account/accountReducer");
|
|
7
7
|
const paymentAccountReducer_1 = require("../../../../../entity/paymentAccount/paymentAccountReducer");
|
|
8
8
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
9
|
+
const helpers_1 = require("../../../helpers");
|
|
9
10
|
const plaidAccountViewReducer_1 = require("../../plaidAccountViewReducer");
|
|
10
11
|
const updatePaymentAccountEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(plaidAccountViewReducer_1.updatePaymentAccount.match), (0, operators_1.mergeMap)((action) => {
|
|
11
12
|
const { accountId, paymentAccountId, setupViewType, plaidAccountKeyType } = action.payload;
|
|
@@ -16,7 +17,7 @@ const updatePaymentAccountEpic = (actions$, _state$, zeniAPI) => actions$.pipe((
|
|
|
16
17
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
18
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
19
|
const actions = [
|
|
19
|
-
(0, accountReducer_1.updateAccounts)(response.data.accounts, setupViewType),
|
|
20
|
+
(0, accountReducer_1.updateAccounts)(response.data.accounts, (0, helpers_1.getReportIDPlusForecastIDFromSetupViewType)(setupViewType)),
|
|
20
21
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
21
22
|
(0, plaidAccountViewReducer_1.updatePaymentAccountSuccess)(plaidAccountKeyType),
|
|
22
23
|
];
|
|
@@ -7,6 +7,7 @@ const accountReducer_1 = require("../../../../../entity/account/accountReducer")
|
|
|
7
7
|
const paymentAccountReducer_1 = require("../../../../../entity/paymentAccount/paymentAccountReducer");
|
|
8
8
|
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
9
9
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
10
|
+
const helpers_1 = require("../../../helpers");
|
|
10
11
|
const plaidAccountViewReducer_1 = require("../../plaidAccountViewReducer");
|
|
11
12
|
const updatePaymentAccountLoginStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(plaidAccountViewReducer_1.updatePaymentAccountLoginStatus.match), (0, operators_1.mergeMap)((action) => {
|
|
12
13
|
const { isLoginRequired, paymentAccountId, setupViewType, linkTokenType, plaidAccountKeyType, } = action.payload;
|
|
@@ -18,7 +19,7 @@ const updatePaymentAccountLoginStatusEpic = (actions$, _state$, zeniAPI) => acti
|
|
|
18
19
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
19
20
|
const paymentAccountIds = response.data.payment_accounts.map((paymentAccount) => paymentAccount.payment_account_id);
|
|
20
21
|
const actions = [
|
|
21
|
-
(0, accountReducer_1.updateAccounts)(response.data.accounts, setupViewType),
|
|
22
|
+
(0, accountReducer_1.updateAccounts)(response.data.accounts, (0, helpers_1.getReportIDPlusForecastIDFromSetupViewType)(setupViewType)),
|
|
22
23
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
23
24
|
(0, plaidAccountViewReducer_1.updatePaymentAccountLoginStatusSuccess)(paymentAccountIds, linkTokenType, plaidAccountKeyType),
|
|
24
25
|
];
|
package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountStatusEpic.js
CHANGED
|
@@ -7,6 +7,7 @@ const accountReducer_1 = require("../../../../../entity/account/accountReducer")
|
|
|
7
7
|
const paymentAccountReducer_1 = require("../../../../../entity/paymentAccount/paymentAccountReducer");
|
|
8
8
|
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
9
9
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
10
|
+
const helpers_1 = require("../../../helpers");
|
|
10
11
|
const plaidAccountViewReducer_1 = require("../../plaidAccountViewReducer");
|
|
11
12
|
const updatePaymentAccountStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(plaidAccountViewReducer_1.updatePaymentAccountStatus.match), (0, operators_1.mergeMap)((action) => {
|
|
12
13
|
const { verificationStatusCode, paymentAccountId, setupViewType, linkTokenType, plaidAccountKeyType, } = action.payload;
|
|
@@ -17,7 +18,7 @@ const updatePaymentAccountStatusEpic = (actions$, _state$, zeniAPI) => actions$.
|
|
|
17
18
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
18
19
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
19
20
|
const actions = [
|
|
20
|
-
(0, accountReducer_1.updateAccounts)(response.data.accounts, setupViewType),
|
|
21
|
+
(0, accountReducer_1.updateAccounts)(response.data.accounts, (0, helpers_1.getReportIDPlusForecastIDFromSetupViewType)(setupViewType)),
|
|
21
22
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
22
23
|
(0, plaidAccountViewReducer_1.updatePaymentAccountStatusSuccess)(linkTokenType, plaidAccountKeyType),
|
|
23
24
|
];
|
package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ import { RootState } from '../../../../../reducer';
|
|
|
9
9
|
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
10
10
|
import { fetchBillingAccountsView } from '../../../../settingsView/settingsViewReducer';
|
|
11
11
|
import { updateUserBankAccount } from '../../../../userFinancialAccount/userFinancialAccountReducer';
|
|
12
|
+
import { updateNewAddedBillPaymentAccount } from '../../../billPay/editBillView/editBillViewReducer';
|
|
12
13
|
import { updatePaymentAccountList } from '../../../zeniAccounts/paymentAccountList/paymentAccountListReducer';
|
|
13
14
|
import { establishPlaidConnection, establishPlaidConnectionFailure, establishPlaidConnectionSuccess, getPaymentAccounts } from '../../plaidAccountViewReducer';
|
|
14
|
-
export type ActionType = ReturnType<typeof establishPlaidConnection> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateBankAccounts> | ReturnType<typeof updateUserBankAccount> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof openSnackbar> | ReturnType<typeof updatePaymentAccountList> | ReturnType<typeof getPaymentAccounts> | ReturnType<typeof establishPlaidConnectionSuccess> | ReturnType<typeof establishPlaidConnectionFailure> | ReturnType<typeof fetchBillingAccountsView> | ReturnType<typeof updateCompanyPrimaryAccount>;
|
|
15
|
+
export type ActionType = ReturnType<typeof establishPlaidConnection> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateBankAccounts> | ReturnType<typeof updateUserBankAccount> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof openSnackbar> | ReturnType<typeof updatePaymentAccountList> | ReturnType<typeof getPaymentAccounts> | ReturnType<typeof establishPlaidConnectionSuccess> | ReturnType<typeof establishPlaidConnectionFailure> | ReturnType<typeof fetchBillingAccountsView> | ReturnType<typeof updateCompanyPrimaryAccount> | ReturnType<typeof updateNewAddedBillPaymentAccount>;
|
|
15
16
|
export declare const establishPlaidConnectionEpic: (actions$: ActionsObservable<ActionType>, state: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|