@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,16 +1,28 @@
|
|
|
1
|
-
import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
1
|
+
import { FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
2
2
|
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
-
export interface
|
|
3
|
+
export interface TwoFactorAuthentication {
|
|
4
4
|
sendOtpStatus: FetchStateAndError;
|
|
5
5
|
otpVerificationStatus: FetchStateAndError;
|
|
6
|
-
|
|
6
|
+
token?: Token;
|
|
7
7
|
phone?: string;
|
|
8
8
|
otpChallenge?: string;
|
|
9
9
|
}
|
|
10
|
-
export type
|
|
11
|
-
export
|
|
10
|
+
export type TwoFactorAuthenticationWithoutToken = Omit<TwoFactorAuthentication, 'token'>;
|
|
11
|
+
export declare const defaultTwoFactorAuthenticationState: TwoFactorAuthentication;
|
|
12
|
+
export interface TwoFactorAuthenticationState {
|
|
13
|
+
common: TwoFactorAuthentication;
|
|
14
|
+
chargeCardHolder: Record<ID, TwoFactorAuthentication>;
|
|
15
|
+
cardUserOnboarding: TwoFactorAuthenticationWithoutToken;
|
|
16
|
+
}
|
|
17
|
+
export declare const COMMON_TWO_FA_SOURCE: readonly ["BillPayVendor", "SpendManagementSetup", "MyProfile", "CustomerOnboarding"];
|
|
18
|
+
export declare const toCommonTwoFASource: (v: string) => "MyProfile" | "BillPayVendor" | "SpendManagementSetup" | "CustomerOnboarding";
|
|
19
|
+
export type CommonTwoFASource = ReturnType<typeof toCommonTwoFASource>;
|
|
20
|
+
export type TwoFASourceView = CommonTwoFASource | 'ChargeCardHolder' | 'CardUserOnboarding';
|
|
21
|
+
export interface Token {
|
|
12
22
|
provider: string;
|
|
13
23
|
token: string;
|
|
14
24
|
expiry: ZeniDate;
|
|
15
25
|
message: string;
|
|
16
26
|
}
|
|
27
|
+
export declare const initialTwoFactorAuthenticationWithoutToken: TwoFactorAuthenticationWithoutToken;
|
|
28
|
+
export declare const initialTwoFactorAuthentication: TwoFactorAuthentication;
|
|
@@ -1,2 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initialTwoFactorAuthentication = exports.initialTwoFactorAuthenticationWithoutToken = exports.toCommonTwoFASource = exports.COMMON_TWO_FA_SOURCE = exports.defaultTwoFactorAuthenticationState = void 0;
|
|
4
|
+
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
|
+
exports.defaultTwoFactorAuthenticationState = {
|
|
6
|
+
sendOtpStatus: {
|
|
7
|
+
fetchState: 'Not-Started',
|
|
8
|
+
error: undefined,
|
|
9
|
+
},
|
|
10
|
+
otpVerificationStatus: {
|
|
11
|
+
fetchState: 'Not-Started',
|
|
12
|
+
error: undefined,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
exports.COMMON_TWO_FA_SOURCE = [
|
|
16
|
+
'BillPayVendor',
|
|
17
|
+
'SpendManagementSetup',
|
|
18
|
+
'MyProfile',
|
|
19
|
+
'CustomerOnboarding',
|
|
20
|
+
];
|
|
21
|
+
const toCommonTwoFASource = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.COMMON_TWO_FA_SOURCE);
|
|
22
|
+
exports.toCommonTwoFASource = toCommonTwoFASource;
|
|
23
|
+
exports.initialTwoFactorAuthenticationWithoutToken = {
|
|
24
|
+
sendOtpStatus: {
|
|
25
|
+
fetchState: 'Not-Started',
|
|
26
|
+
error: undefined,
|
|
27
|
+
},
|
|
28
|
+
otpVerificationStatus: {
|
|
29
|
+
fetchState: 'Not-Started',
|
|
30
|
+
error: undefined,
|
|
31
|
+
},
|
|
32
|
+
phone: undefined,
|
|
33
|
+
otpChallenge: undefined,
|
|
34
|
+
};
|
|
35
|
+
exports.initialTwoFactorAuthentication = Object.assign(Object.assign({}, exports.initialTwoFactorAuthenticationWithoutToken), { token: undefined });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ZeniAPIResponse } from '../../responsePayload';
|
|
2
|
-
import {
|
|
2
|
+
import { Token } from './twoFactorAuthentication';
|
|
3
3
|
interface SendOtpPayload {
|
|
4
4
|
otp_challenge: string;
|
|
5
5
|
}
|
|
@@ -7,14 +7,14 @@ export type SendOtpResponse = ZeniAPIResponse<SendOtpPayload>;
|
|
|
7
7
|
interface VerifyOtpPayload {
|
|
8
8
|
is_verified: boolean;
|
|
9
9
|
message: string;
|
|
10
|
-
|
|
10
|
+
token_info?: TokenPayload;
|
|
11
11
|
}
|
|
12
|
-
export interface
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export interface TokenPayload {
|
|
13
|
+
token_provider: string;
|
|
14
|
+
token: string;
|
|
15
|
+
token_expiration_time: string;
|
|
16
16
|
message: string;
|
|
17
17
|
}
|
|
18
18
|
export type VerifyOtpResponse = ZeniAPIResponse<VerifyOtpPayload>;
|
|
19
|
-
export declare const
|
|
19
|
+
export declare const toToken: (payload: TokenPayload) => Token;
|
|
20
20
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.toToken = void 0;
|
|
4
4
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
5
|
-
const
|
|
6
|
-
provider: payload.
|
|
7
|
-
token: payload.
|
|
8
|
-
expiry: (0, zeniDayJS_1.date)(payload.
|
|
5
|
+
const toToken = (payload) => ({
|
|
6
|
+
provider: payload.token_provider,
|
|
7
|
+
token: payload.token,
|
|
8
|
+
expiry: (0, zeniDayJS_1.date)(payload.token_expiration_time),
|
|
9
9
|
message: payload.message,
|
|
10
10
|
});
|
|
11
|
-
exports.
|
|
11
|
+
exports.toToken = toToken;
|
|
@@ -1,21 +1,37 @@
|
|
|
1
|
+
import { ID } from '../../commonStateTypes/common';
|
|
1
2
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
2
3
|
import { TwoFASourceView, TwoFactorAuthenticationState } from './twoFactorAuthentication';
|
|
3
|
-
import {
|
|
4
|
+
import { TokenPayload } from './twoFactorAuthenticationPayload';
|
|
4
5
|
export declare const initialState: TwoFactorAuthenticationState;
|
|
5
|
-
export declare const sendOtp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[phoneNumber: string, twoFASource: TwoFASourceView], {
|
|
6
|
+
export declare const sendOtp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[phoneNumber: string, twoFASource: TwoFASourceView, entityId?: string | undefined], {
|
|
6
7
|
phoneNumber: string;
|
|
7
8
|
twoFASource: TwoFASourceView;
|
|
8
|
-
|
|
9
|
+
entityId: string | undefined;
|
|
10
|
+
}, "twoFactorAuthentication/sendOtp", never, never>, resendOtp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[otpChallenge: string, twoFASource: TwoFASourceView, entityId?: string | undefined], {
|
|
9
11
|
otpChallenge: string;
|
|
10
12
|
twoFASource: TwoFASourceView;
|
|
13
|
+
entityId: string | undefined;
|
|
11
14
|
}, "twoFactorAuthentication/resendOtp", never, never>, sendOtpSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
12
15
|
otpChallenge: string;
|
|
13
|
-
|
|
16
|
+
twoFASource: TwoFASourceView;
|
|
17
|
+
entityId?: ID;
|
|
18
|
+
}, "twoFactorAuthentication/sendOtpSuccess">, sendOtpFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
19
|
+
error: ZeniAPIStatus;
|
|
20
|
+
twoFASource: TwoFASourceView;
|
|
21
|
+
entityId?: ID;
|
|
22
|
+
}, "twoFactorAuthentication/sendOtpFailure">, verifyOtp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[otpCode: string, otpChallenge: string, twoFASource: TwoFASourceView, entityId?: string | undefined], {
|
|
14
23
|
otpCode: string;
|
|
15
24
|
otpChallenge: string;
|
|
16
25
|
twoFASource: TwoFASourceView;
|
|
26
|
+
entityId: string | undefined;
|
|
17
27
|
}, "twoFactorAuthentication/verifyOtp", never, never>, verifyOtpSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
twoFASource: TwoFASourceView;
|
|
29
|
+
tokenPayload: TokenPayload | undefined;
|
|
30
|
+
entityId?: ID;
|
|
31
|
+
}, "twoFactorAuthentication/verifyOtpSuccess">, verifyOtpFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
32
|
+
error: ZeniAPIStatus;
|
|
33
|
+
twoFASource: TwoFASourceView;
|
|
34
|
+
entityId?: ID;
|
|
35
|
+
}, "twoFactorAuthentication/verifyOtpFailure">, clearTwoFactorAuthentication: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"twoFactorAuthentication/clearTwoFactorAuthentication">;
|
|
20
36
|
declare const _default: import("redux").Reducer<TwoFactorAuthenticationState>;
|
|
21
37
|
export default _default;
|
|
@@ -3,19 +3,12 @@ var _a;
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.clearTwoFactorAuthentication = exports.verifyOtpFailure = exports.verifyOtpSuccess = exports.verifyOtp = exports.sendOtpFailure = exports.sendOtpSuccess = exports.resendOtp = exports.sendOtp = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const twoFactorAuthentication_1 = require("./twoFactorAuthentication");
|
|
6
7
|
const twoFactorAuthenticationPayload_1 = require("./twoFactorAuthenticationPayload");
|
|
7
8
|
exports.initialState = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
otpVerificationStatus: {
|
|
13
|
-
fetchState: 'Not-Started',
|
|
14
|
-
error: undefined,
|
|
15
|
-
},
|
|
16
|
-
customerToken: undefined,
|
|
17
|
-
phone: undefined,
|
|
18
|
-
otpChallenge: undefined,
|
|
9
|
+
common: twoFactorAuthentication_1.initialTwoFactorAuthentication,
|
|
10
|
+
chargeCardHolder: {},
|
|
11
|
+
cardUserOnboarding: twoFactorAuthentication_1.initialTwoFactorAuthenticationWithoutToken,
|
|
19
12
|
};
|
|
20
13
|
const twoFactorAuthentication = (0, toolkit_1.createSlice)({
|
|
21
14
|
name: 'twoFactorAuthentication',
|
|
@@ -23,74 +16,197 @@ const twoFactorAuthentication = (0, toolkit_1.createSlice)({
|
|
|
23
16
|
reducers: {
|
|
24
17
|
sendOtp: {
|
|
25
18
|
reducer(draft, action) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
const { phoneNumber, twoFASource, entityId } = action.payload;
|
|
20
|
+
if (twoFASource === 'CardUserOnboarding') {
|
|
21
|
+
draft.cardUserOnboarding.phone = phoneNumber;
|
|
22
|
+
draft.cardUserOnboarding.sendOtpStatus = {
|
|
23
|
+
fetchState: 'In-Progress',
|
|
24
|
+
error: undefined,
|
|
25
|
+
};
|
|
26
|
+
draft.cardUserOnboarding.otpVerificationStatus = {
|
|
27
|
+
fetchState: 'Not-Started',
|
|
28
|
+
error: undefined,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
else if (twoFASource === 'ChargeCardHolder' && entityId != null) {
|
|
32
|
+
draft.chargeCardHolder[entityId] = Object.assign(Object.assign({}, draft.chargeCardHolder[entityId]), { phone: phoneNumber, sendOtpStatus: {
|
|
33
|
+
fetchState: 'In-Progress',
|
|
34
|
+
error: undefined,
|
|
35
|
+
}, otpVerificationStatus: {
|
|
36
|
+
fetchState: 'Not-Started',
|
|
37
|
+
error: undefined,
|
|
38
|
+
} });
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
draft.common.phone = phoneNumber;
|
|
42
|
+
draft.common.sendOtpStatus = {
|
|
43
|
+
fetchState: 'In-Progress',
|
|
44
|
+
error: undefined,
|
|
45
|
+
};
|
|
46
|
+
draft.common.otpVerificationStatus = {
|
|
47
|
+
fetchState: 'Not-Started',
|
|
48
|
+
error: undefined,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
35
51
|
},
|
|
36
|
-
prepare(phoneNumber, twoFASource) {
|
|
37
|
-
return { payload: { phoneNumber, twoFASource } };
|
|
52
|
+
prepare(phoneNumber, twoFASource, entityId) {
|
|
53
|
+
return { payload: { phoneNumber, twoFASource, entityId } };
|
|
38
54
|
},
|
|
39
55
|
},
|
|
40
56
|
resendOtp: {
|
|
41
|
-
reducer(draft) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
reducer(draft, action) {
|
|
58
|
+
const { twoFASource, entityId } = action.payload;
|
|
59
|
+
if (twoFASource === 'CardUserOnboarding') {
|
|
60
|
+
draft.cardUserOnboarding.sendOtpStatus = {
|
|
61
|
+
fetchState: 'In-Progress',
|
|
62
|
+
error: undefined,
|
|
63
|
+
};
|
|
64
|
+
draft.cardUserOnboarding.otpVerificationStatus = {
|
|
65
|
+
fetchState: 'Not-Started',
|
|
66
|
+
error: undefined,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
else if (twoFASource === 'ChargeCardHolder' && entityId != null) {
|
|
70
|
+
draft.chargeCardHolder[entityId] = Object.assign(Object.assign({}, draft.chargeCardHolder[entityId]), { sendOtpStatus: {
|
|
71
|
+
fetchState: 'In-Progress',
|
|
72
|
+
error: undefined,
|
|
73
|
+
}, otpVerificationStatus: {
|
|
74
|
+
fetchState: 'Not-Started',
|
|
75
|
+
error: undefined,
|
|
76
|
+
} });
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
draft.common.sendOtpStatus = {
|
|
80
|
+
fetchState: 'In-Progress',
|
|
81
|
+
error: undefined,
|
|
82
|
+
};
|
|
83
|
+
draft.common.otpVerificationStatus = {
|
|
84
|
+
fetchState: 'Not-Started',
|
|
85
|
+
error: undefined,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
50
88
|
},
|
|
51
|
-
prepare(otpChallenge, twoFASource) {
|
|
52
|
-
return { payload: { otpChallenge, twoFASource } };
|
|
89
|
+
prepare(otpChallenge, twoFASource, entityId) {
|
|
90
|
+
return { payload: { otpChallenge, twoFASource, entityId } };
|
|
53
91
|
},
|
|
54
92
|
},
|
|
55
93
|
sendOtpSuccess(draft, action) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
94
|
+
const { otpChallenge, twoFASource, entityId } = action.payload;
|
|
95
|
+
if (twoFASource === 'CardUserOnboarding') {
|
|
96
|
+
draft.cardUserOnboarding.otpChallenge = otpChallenge;
|
|
97
|
+
draft.cardUserOnboarding.sendOtpStatus = {
|
|
98
|
+
fetchState: 'Completed',
|
|
99
|
+
error: undefined,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
else if (twoFASource === 'ChargeCardHolder' && entityId != null) {
|
|
103
|
+
draft.chargeCardHolder[entityId] = Object.assign(Object.assign({}, draft.chargeCardHolder[entityId]), { otpChallenge: otpChallenge, sendOtpStatus: {
|
|
104
|
+
fetchState: 'Completed',
|
|
105
|
+
error: undefined,
|
|
106
|
+
} });
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
draft.common.otpChallenge = otpChallenge;
|
|
110
|
+
draft.common.sendOtpStatus = {
|
|
111
|
+
fetchState: 'Completed',
|
|
112
|
+
error: undefined,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
61
115
|
},
|
|
62
116
|
sendOtpFailure(draft, action) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
117
|
+
const { error, twoFASource, entityId } = action.payload;
|
|
118
|
+
if (twoFASource === 'CardUserOnboarding') {
|
|
119
|
+
draft.cardUserOnboarding.sendOtpStatus = {
|
|
120
|
+
fetchState: 'Error',
|
|
121
|
+
error,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
else if (twoFASource === 'ChargeCardHolder' && entityId != null) {
|
|
125
|
+
draft.chargeCardHolder[entityId] = Object.assign(Object.assign({}, draft.chargeCardHolder[entityId]), { sendOtpStatus: {
|
|
126
|
+
fetchState: 'Error',
|
|
127
|
+
error,
|
|
128
|
+
} });
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
draft.common.sendOtpStatus = {
|
|
132
|
+
fetchState: 'Error',
|
|
133
|
+
error,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
67
136
|
},
|
|
68
137
|
verifyOtp: {
|
|
69
|
-
reducer(draft) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
138
|
+
reducer(draft, action) {
|
|
139
|
+
const { twoFASource, entityId } = action.payload;
|
|
140
|
+
if (twoFASource === 'CardUserOnboarding') {
|
|
141
|
+
draft.cardUserOnboarding.otpVerificationStatus = {
|
|
142
|
+
fetchState: 'In-Progress',
|
|
143
|
+
error: undefined,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
else if (twoFASource === 'ChargeCardHolder' && entityId != null) {
|
|
147
|
+
draft.chargeCardHolder[entityId] = Object.assign(Object.assign({}, draft.chargeCardHolder[entityId]), { otpVerificationStatus: {
|
|
148
|
+
fetchState: 'In-Progress',
|
|
149
|
+
error: undefined,
|
|
150
|
+
} });
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
draft.common.otpVerificationStatus = {
|
|
154
|
+
fetchState: 'In-Progress',
|
|
155
|
+
error: undefined,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
74
158
|
},
|
|
75
|
-
prepare(otpCode, otpChallenge, twoFASource) {
|
|
76
|
-
return { payload: { otpCode, otpChallenge, twoFASource } };
|
|
159
|
+
prepare(otpCode, otpChallenge, twoFASource, entityId) {
|
|
160
|
+
return { payload: { otpCode, otpChallenge, twoFASource, entityId } };
|
|
77
161
|
},
|
|
78
162
|
},
|
|
79
163
|
verifyOtpSuccess(draft, action) {
|
|
80
|
-
const {
|
|
81
|
-
if (
|
|
82
|
-
draft.
|
|
164
|
+
const { twoFASource, tokenPayload, entityId } = action.payload;
|
|
165
|
+
if (twoFASource === 'CardUserOnboarding') {
|
|
166
|
+
draft.cardUserOnboarding.otpVerificationStatus = {
|
|
167
|
+
fetchState: 'Completed',
|
|
168
|
+
error: undefined,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
else if (twoFASource === 'ChargeCardHolder' && entityId != null) {
|
|
172
|
+
draft.chargeCardHolder[entityId] = Object.assign(Object.assign({}, draft.chargeCardHolder[entityId]), { otpVerificationStatus: {
|
|
173
|
+
fetchState: 'Completed',
|
|
174
|
+
error: undefined,
|
|
175
|
+
} });
|
|
176
|
+
if (tokenPayload != null) {
|
|
177
|
+
draft.chargeCardHolder[entityId].token = (0, twoFactorAuthenticationPayload_1.toToken)(tokenPayload);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
draft.common.otpVerificationStatus = {
|
|
182
|
+
fetchState: 'Completed',
|
|
183
|
+
error: undefined,
|
|
184
|
+
};
|
|
185
|
+
if (tokenPayload != null) {
|
|
186
|
+
draft.common.token = (0, twoFactorAuthenticationPayload_1.toToken)(tokenPayload);
|
|
187
|
+
}
|
|
83
188
|
}
|
|
84
|
-
draft.otpVerificationStatus = {
|
|
85
|
-
fetchState: 'Completed',
|
|
86
|
-
error: undefined,
|
|
87
|
-
};
|
|
88
189
|
},
|
|
89
190
|
verifyOtpFailure(draft, action) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
191
|
+
const { error, twoFASource, entityId } = action.payload;
|
|
192
|
+
if (twoFASource === 'CardUserOnboarding') {
|
|
193
|
+
draft.cardUserOnboarding.otpVerificationStatus = {
|
|
194
|
+
fetchState: 'Error',
|
|
195
|
+
error,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
else if (twoFASource === 'ChargeCardHolder' && entityId != null) {
|
|
199
|
+
draft.chargeCardHolder[entityId] = Object.assign(Object.assign({}, draft.chargeCardHolder[entityId]), { otpVerificationStatus: {
|
|
200
|
+
fetchState: 'Error',
|
|
201
|
+
error,
|
|
202
|
+
} });
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
draft.common.otpVerificationStatus = {
|
|
206
|
+
fetchState: 'Error',
|
|
207
|
+
error,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
94
210
|
},
|
|
95
211
|
clearTwoFactorAuthentication(draft) {
|
|
96
212
|
Object.assign(draft, exports.initialState);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
1
|
+
import { FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
2
2
|
import { View } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
3
|
import { RootState } from '../../reducer';
|
|
4
|
-
import {
|
|
4
|
+
import { Token, TwoFactorAuthentication, TwoFactorAuthenticationWithoutToken } from './twoFactorAuthentication';
|
|
5
5
|
export interface TwoFactorAuthenticationView extends View {
|
|
6
6
|
sendOtpStatus: FetchStateAndError;
|
|
7
7
|
otpVerificationStatus: FetchStateAndError;
|
|
8
|
-
|
|
8
|
+
token?: Token;
|
|
9
9
|
phone?: string;
|
|
10
10
|
otpChallenge?: string;
|
|
11
11
|
}
|
|
12
12
|
export declare const getTwoFactorAuthenticationView: (state: RootState) => TwoFactorAuthenticationView;
|
|
13
|
+
export declare const getTwoFactorAuthenticationViewForChargeCardHolder: (state: RootState, entityId: ID) => TwoFactorAuthentication;
|
|
14
|
+
export declare const getTwoFactorAuthenticationViewForCardUserOnboarding: (state: RootState) => TwoFactorAuthenticationWithoutToken | undefined;
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTwoFactorAuthenticationView = void 0;
|
|
3
|
+
exports.getTwoFactorAuthenticationViewForCardUserOnboarding = exports.getTwoFactorAuthenticationViewForChargeCardHolder = exports.getTwoFactorAuthenticationView = void 0;
|
|
4
4
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
+
const twoFactorAuthentication_1 = require("./twoFactorAuthentication");
|
|
5
6
|
exports.getTwoFactorAuthenticationView = (0, toolkit_1.createSelector)((state) => state.twoFactorAuthenticationState, (twoFAState) => {
|
|
6
|
-
return Object.assign({}, twoFAState);
|
|
7
|
+
return Object.assign({}, twoFAState.common);
|
|
8
|
+
});
|
|
9
|
+
exports.getTwoFactorAuthenticationViewForChargeCardHolder = (0, toolkit_1.createSelector)((state) => state.twoFactorAuthenticationState, (_state, entityId) => entityId, (twoFAState, entityId) => {
|
|
10
|
+
const twoFA = twoFAState.chargeCardHolder[entityId];
|
|
11
|
+
if (twoFA != null) {
|
|
12
|
+
return twoFA;
|
|
13
|
+
}
|
|
14
|
+
return twoFactorAuthentication_1.initialTwoFactorAuthentication;
|
|
15
|
+
});
|
|
16
|
+
exports.getTwoFactorAuthenticationViewForCardUserOnboarding = (0, toolkit_1.createSelector)((state) => state.twoFactorAuthenticationState, (twoFAState) => {
|
|
17
|
+
return twoFAState.cardUserOnboarding;
|
|
7
18
|
});
|
|
@@ -6,7 +6,10 @@ import { verifyOtpVendorView, verifyOtpVendorViewFailure, verifyOtpVendorViewSuc
|
|
|
6
6
|
import { verifyOnboardingOfficerOtp, verifyOnboardingOfficerOtpFailure, verifyOnboardingOfficerOtpSuccess } from '../onboardingView/customerView/onboardingCustomerViewReducer';
|
|
7
7
|
import { verifyOtpMyProfile, verifyOtpMyProfileFailure, verifyOtpMyProfileSuccess } from '../settingsView/settingsViewReducer';
|
|
8
8
|
import { verifyOtpCardUserOnboarding, verifyOtpCardUserOnboardingFailure, verifyOtpCardUserOnboardingSuccess } from '../spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingReducer';
|
|
9
|
+
import { verifyOtpCardHolderFailure } from '../spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer';
|
|
10
|
+
import { verifyOtpCardHolderSuccess } from '../spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer';
|
|
11
|
+
import { verifyOtpCardHolder } from '../spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer';
|
|
9
12
|
import { verifyOtpFailureSpendManagementSetUp, verifyOtpSpendManagementSetUp, verifyOtpSuccessSpendManagementSetUp } from '../spendManagement/commonSetup/setupViewReducer';
|
|
10
13
|
import { verifyOtp, verifyOtpFailure, verifyOtpSuccess } from './twoFactorAuthenticationReducer';
|
|
11
|
-
export type ActionType = ReturnType<typeof verifyOtp> | ReturnType<typeof verifyOtpSuccess> | ReturnType<typeof verifyOtpFailure> | ReturnType<typeof verifyOtpSpendManagementSetUp> | ReturnType<typeof verifyOtpSuccessSpendManagementSetUp> | ReturnType<typeof verifyOtpFailureSpendManagementSetUp> | ReturnType<typeof verifyOtpVendorView> | ReturnType<typeof verifyOtpVendorViewSuccess> | ReturnType<typeof verifyOtpVendorViewFailure> | ReturnType<typeof verifyOnboardingOfficerOtp> | ReturnType<typeof verifyOnboardingOfficerOtpSuccess> | ReturnType<typeof verifyOnboardingOfficerOtpFailure> | ReturnType<typeof verifyOtpCardUserOnboarding> | ReturnType<typeof verifyOtpCardUserOnboardingSuccess> | ReturnType<typeof verifyOtpCardUserOnboardingFailure> | ReturnType<typeof verifyOtpMyProfile> | ReturnType<typeof verifyOtpMyProfileFailure> | ReturnType<typeof verifyOtpMyProfileSuccess>;
|
|
12
|
-
export declare const verifyOtpEpic: (actions$: ActionsObservable<ActionType>,
|
|
14
|
+
export type ActionType = ReturnType<typeof verifyOtp> | ReturnType<typeof verifyOtpSuccess> | ReturnType<typeof verifyOtpFailure> | ReturnType<typeof verifyOtpSpendManagementSetUp> | ReturnType<typeof verifyOtpSuccessSpendManagementSetUp> | ReturnType<typeof verifyOtpFailureSpendManagementSetUp> | ReturnType<typeof verifyOtpVendorView> | ReturnType<typeof verifyOtpVendorViewSuccess> | ReturnType<typeof verifyOtpVendorViewFailure> | ReturnType<typeof verifyOnboardingOfficerOtp> | ReturnType<typeof verifyOnboardingOfficerOtpSuccess> | ReturnType<typeof verifyOnboardingOfficerOtpFailure> | ReturnType<typeof verifyOtpCardUserOnboarding> | ReturnType<typeof verifyOtpCardUserOnboardingSuccess> | ReturnType<typeof verifyOtpCardUserOnboardingFailure> | ReturnType<typeof verifyOtpMyProfile> | ReturnType<typeof verifyOtpMyProfileFailure> | ReturnType<typeof verifyOtpMyProfileSuccess> | ReturnType<typeof verifyOtpCardHolder> | ReturnType<typeof verifyOtpCardHolderSuccess> | ReturnType<typeof verifyOtpCardHolderFailure>;
|
|
15
|
+
export declare const verifyOtpEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -8,15 +8,22 @@ const vendorViewReducer_1 = require("../commonVendorView/vendorView/vendorViewRe
|
|
|
8
8
|
const onboardingCustomerViewReducer_1 = require("../onboardingView/customerView/onboardingCustomerViewReducer");
|
|
9
9
|
const settingsViewReducer_1 = require("../settingsView/settingsViewReducer");
|
|
10
10
|
const cardUserOnboardingReducer_1 = require("../spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingReducer");
|
|
11
|
+
const chargeCardDetailReducer_1 = require("../spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer");
|
|
12
|
+
const chargeCardDetailReducer_2 = require("../spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer");
|
|
13
|
+
const chargeCardDetailReducer_3 = require("../spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer");
|
|
11
14
|
const setupViewReducer_1 = require("../spendManagement/commonSetup/setupViewReducer");
|
|
12
15
|
const twoFactorAuthenticationReducer_1 = require("./twoFactorAuthenticationReducer");
|
|
13
|
-
const verifyOtpEpic = (actions$,
|
|
16
|
+
const verifyOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(twoFactorAuthenticationReducer_1.verifyOtp.match), (0, operators_1.mergeMap)((action) => {
|
|
14
17
|
const verifyOtpActions = [];
|
|
15
|
-
const { otpCode, otpChallenge, twoFASource } = action.payload;
|
|
18
|
+
const { otpCode, otpChallenge, twoFASource, entityId } = action.payload;
|
|
16
19
|
const payload = {
|
|
17
20
|
otp_code: otpCode,
|
|
18
21
|
otp_challenge: otpChallenge,
|
|
19
22
|
};
|
|
23
|
+
if (twoFASource === 'ChargeCardHolder' && entityId != null) {
|
|
24
|
+
const chargeCardProviderId = state$.value.chargeCardState.chargeCardByID[entityId].cardProviderID;
|
|
25
|
+
payload.provider_card_id = chargeCardProviderId;
|
|
26
|
+
}
|
|
20
27
|
switch (twoFASource) {
|
|
21
28
|
case 'SpendManagementSetup':
|
|
22
29
|
verifyOtpActions.push((0, setupViewReducer_1.verifyOtpSpendManagementSetUp)());
|
|
@@ -33,6 +40,11 @@ const verifyOtpEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
33
40
|
case 'CardUserOnboarding':
|
|
34
41
|
verifyOtpActions.push((0, cardUserOnboardingReducer_1.verifyOtpCardUserOnboarding)());
|
|
35
42
|
break;
|
|
43
|
+
case 'ChargeCardHolder':
|
|
44
|
+
if (entityId != null) {
|
|
45
|
+
verifyOtpActions.push((0, chargeCardDetailReducer_3.verifyOtpCardHolder)({ chargeCardId: entityId }));
|
|
46
|
+
}
|
|
47
|
+
break;
|
|
36
48
|
}
|
|
37
49
|
const verifyOtp$ = zeniAPI
|
|
38
50
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/otp/verify`, payload)
|
|
@@ -42,7 +54,9 @@ const verifyOtpEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
42
54
|
response.data.is_verified === true) {
|
|
43
55
|
const updateActions = [
|
|
44
56
|
(0, twoFactorAuthenticationReducer_1.verifyOtpSuccess)({
|
|
45
|
-
|
|
57
|
+
twoFASource,
|
|
58
|
+
tokenPayload: response.data.token_info,
|
|
59
|
+
entityId,
|
|
46
60
|
}),
|
|
47
61
|
];
|
|
48
62
|
switch (twoFASource) {
|
|
@@ -61,12 +75,23 @@ const verifyOtpEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
61
75
|
case 'CardUserOnboarding':
|
|
62
76
|
updateActions.push((0, cardUserOnboardingReducer_1.verifyOtpCardUserOnboardingSuccess)());
|
|
63
77
|
break;
|
|
78
|
+
case 'ChargeCardHolder':
|
|
79
|
+
if (entityId != null) {
|
|
80
|
+
updateActions.push((0, chargeCardDetailReducer_2.verifyOtpCardHolderSuccess)({
|
|
81
|
+
chargeCardId: entityId,
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
64
85
|
}
|
|
65
86
|
return (0, rxjs_1.from)(updateActions);
|
|
66
87
|
}
|
|
67
88
|
else {
|
|
68
89
|
const updateActions = [
|
|
69
|
-
(0, twoFactorAuthenticationReducer_1.verifyOtpFailure)(
|
|
90
|
+
(0, twoFactorAuthenticationReducer_1.verifyOtpFailure)({
|
|
91
|
+
error: response.status,
|
|
92
|
+
twoFASource,
|
|
93
|
+
entityId,
|
|
94
|
+
}),
|
|
70
95
|
];
|
|
71
96
|
switch (twoFASource) {
|
|
72
97
|
case 'SpendManagementSetup':
|
|
@@ -84,13 +109,21 @@ const verifyOtpEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
84
109
|
case 'CardUserOnboarding':
|
|
85
110
|
updateActions.push((0, cardUserOnboardingReducer_1.verifyOtpCardUserOnboardingFailure)(response.status));
|
|
86
111
|
break;
|
|
112
|
+
case 'ChargeCardHolder':
|
|
113
|
+
if (entityId != null) {
|
|
114
|
+
updateActions.push((0, chargeCardDetailReducer_1.verifyOtpCardHolderFailure)({
|
|
115
|
+
error: response.status,
|
|
116
|
+
chargeCardId: entityId,
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
break;
|
|
87
120
|
}
|
|
88
121
|
return (0, rxjs_1.from)(updateActions);
|
|
89
122
|
}
|
|
90
123
|
}), (0, operators_1.catchError)((error) => {
|
|
91
124
|
const zeniAPIStatus = (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Verify otp api errored out' + JSON.stringify(error));
|
|
92
125
|
const updateActions = [
|
|
93
|
-
(0, twoFactorAuthenticationReducer_1.verifyOtpFailure)(zeniAPIStatus),
|
|
126
|
+
(0, twoFactorAuthenticationReducer_1.verifyOtpFailure)({ error: zeniAPIStatus, twoFASource, entityId }),
|
|
94
127
|
];
|
|
95
128
|
switch (twoFASource) {
|
|
96
129
|
case 'SpendManagementSetup':
|
|
@@ -108,6 +141,14 @@ const verifyOtpEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
108
141
|
case 'CardUserOnboarding':
|
|
109
142
|
updateActions.push((0, cardUserOnboardingReducer_1.verifyOtpCardUserOnboardingFailure)(zeniAPIStatus));
|
|
110
143
|
break;
|
|
144
|
+
case 'ChargeCardHolder':
|
|
145
|
+
if (entityId != null) {
|
|
146
|
+
updateActions.push((0, chargeCardDetailReducer_1.verifyOtpCardHolderFailure)({
|
|
147
|
+
error: zeniAPIStatus,
|
|
148
|
+
chargeCardId: entityId,
|
|
149
|
+
}));
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
111
152
|
}
|
|
112
153
|
return (0, rxjs_1.from)(updateActions);
|
|
113
154
|
}));
|
|
@@ -4,7 +4,7 @@ import { updateAllUsers } from '../../entity/user/userReducer';
|
|
|
4
4
|
import { updateUserRoles } from '../../entity/userRole/userRoleReducer';
|
|
5
5
|
import { RootState } from '../../reducer';
|
|
6
6
|
import { ZeniAPI } from '../../zeniAPI';
|
|
7
|
-
import {
|
|
7
|
+
import { updateChargeCardCount, updateDebitCardCount } from '../spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer';
|
|
8
8
|
import { fetchUserListByType, updateUserIds, updateUserListFetchFailure } from './userListViewReducer';
|
|
9
|
-
export type ActionType = ReturnType<typeof fetchUserListByType> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateUserIds> | ReturnType<typeof
|
|
9
|
+
export type ActionType = ReturnType<typeof fetchUserListByType> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateUserIds> | ReturnType<typeof updateChargeCardCount> | ReturnType<typeof updateDebitCardCount> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateUserListFetchFailure>;
|
|
10
10
|
export declare const fetchUserListByTypeEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
@@ -23,7 +23,7 @@ const fetchUserListByTypeEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
|
|
|
23
23
|
apiUrl =
|
|
24
24
|
apiUrl + `?query=${encodeURIComponent(JSON.stringify(queryParam))}`;
|
|
25
25
|
return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.mergeMap)((response) => {
|
|
26
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
27
27
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
28
28
|
const userListAction = [
|
|
29
29
|
(0, userReducer_1.updateAllUsers)({ users: (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.users) !== null && _b !== void 0 ? _b : [] }),
|
|
@@ -34,8 +34,9 @@ const fetchUserListByTypeEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
|
|
|
34
34
|
}),
|
|
35
35
|
];
|
|
36
36
|
if (userType === 'cardHolderCandidate') {
|
|
37
|
-
userListAction.push((0, issueChargeCardReducer_1.
|
|
38
|
-
userListAction.push((0,
|
|
37
|
+
userListAction.push((0, issueChargeCardReducer_1.updateChargeCardCount)((_h = (_g = response.data) === null || _g === void 0 ? void 0 : _g.cards_count_by_user_id) !== null && _h !== void 0 ? _h : []));
|
|
38
|
+
userListAction.push((0, issueChargeCardReducer_1.updateDebitCardCount)((_k = (_j = response.data) === null || _j === void 0 ? void 0 : _j.debit_cards_count_by_deposit_account_id) !== null && _k !== void 0 ? _k : {}));
|
|
39
|
+
userListAction.push((0, addressReducer_1.updateAddresses)((_m = (_l = response.data) === null || _l === void 0 ? void 0 : _l.addresses) !== null && _m !== void 0 ? _m : []));
|
|
39
40
|
}
|
|
40
41
|
return (0, rxjs_1.concat)((0, rxjs_1.from)(userListAction));
|
|
41
42
|
}
|