@zeniai/client-epic-state 4.14.94 → 4.14.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +1 -1
- package/lib/view/twoFactorAuthentication/resendOtpEpic.js +10 -26
- package/lib/view/twoFactorAuthentication/sendOtpEpic.js +5 -16
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.d.ts +5 -16
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.js +0 -35
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.d.ts +7 -7
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.js +6 -6
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.d.ts +6 -22
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.js +59 -126
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.d.ts +3 -4
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.js +2 -9
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.d.ts +1 -1
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.js +6 -16
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -515,7 +515,7 @@ import { clearTrendData, fetchExpenseTrend, fetchIncomeTrend } from './view/tren
|
|
|
515
515
|
import { TrendView, getTrendForEntity } from './view/trend/trendSelector';
|
|
516
516
|
import { clearTrendWithTransactions, fetchTransactionsForEntity, fetchTrendForEntity, updateSelectedTimeperiod } from './view/trendWithTransactions/trendWithTransactionsReducer';
|
|
517
517
|
import { TrendWithTransactionsView, getEntityDetailUIStateByEntity, getLatestTimeFrameWithTransactionsForEntity, getTrendWithTransactions } from './view/trendWithTransactions/trendWithTransactionsSelector';
|
|
518
|
-
import {
|
|
518
|
+
import { CustomerToken } from './view/twoFactorAuthentication/twoFactorAuthentication';
|
|
519
519
|
import { resendOtp, sendOtp, verifyOtp } from './view/twoFactorAuthentication/twoFactorAuthenticationReducer';
|
|
520
520
|
import { TwoFactorAuthenticationView, getTwoFactorAuthenticationView } from './view/twoFactorAuthentication/twoFactorAuthenticationSelector';
|
|
521
521
|
import { fetchUserFinancialAccount } from './view/userFinancialAccount/userFinancialAccountReducer';
|
|
@@ -707,7 +707,7 @@ export { MilageReimbursementLine, OutofPocketReimbursementLine, ReimbursementLin
|
|
|
707
707
|
export { AccountListSelectorView, ClassListSelectorView, getClassList };
|
|
708
708
|
export { BillTab, BillsSubTabType, SaveBillStageCode, BillPayReviewSelectorView, DuplicateBillsSelectorView, EditBillDetailSelectorView, LineItemRecommendationsLocalData, EditBillInitialDetails, BillableStatus, PaymentDetailsSection, BillListReport, BillListDownloadReport, WhatForSection, fetchBillList, fetchBillListPerTab, updateTab, updateSubTab, updateSelectedBillId, updateBillDetailSaveBillCode, fetchVendorByNameAndParseInvoice, saveBillUpdatesToLocalStore, discardBillUpdatesInLocalStore, saveBillDetail, approveOrRejectBill, updateApprovalStatusOnSuccess, deleteBill, cancelAndDeleteBill, retryOrRefundBill, getBillList, getBillDownloadList, BillDetailViewSelector, ActorActivityWithUser, BillActivity, StepWithStatus, getBillDetailView, checkApproveRejectBtnShowForBill, BillDetailView, getBillTransactionDetailKey, fetchBillDetail, fetchEditBillDetailPage, fetchAndUpdateVendorRecommendations, fetchDuplicateBill, clearBillPayReview, EditBillDetail, EditBillDetailViewState, getEditBillDetail, getReviewPageBillDetail, BillDetailLocalData, PaymentDetailsSectionView, fetchBillAndInitializeLocalStore, updateShowAutofill, saveVendorSuccessOrFailure, BillPaymentStatus, BillPaymentStatusCodeType, BillPaymentRefundStatus, BillPaymentRefundStatusCodeType, BillStatus, BillStatusCodeType, BillApprovalType, updateBillListUIState, BillListUIState, BillPayViewSortKey, BillPayFilters, BillPayFilterCategory, BillListViewFilterCategoryField, BILL_PAY_FILTER_CATEGORIES, updateVendorDetailLocalData, resetVendorDetailLocalData, resetVendorSaveStatus, updateContactsInVendorDetailLocalData, updateVendorTabDetailUIState, updateContactsInVendorTabDetailLocalData, updateBillUploadFetchState, updateBillListSearchResult, fetchUserDetails, verifyUser, updateVendorContact, PaymentToOption, toPaymentToOption, convertAmountToHomeCurrency, RecurringBillInstance, RecurringBillConfigLocalData, EditRecurringBillType, fetchVendorAndUpdateBillLocalData, markBillForRetry, };
|
|
709
709
|
export { SpendManagementFiltersType, SpendManagementFilterEntityType, FilterCategoryType, BillPayFilterCategoryDropdownOption, ReimbursementFilterCategoryDropdownOption, TaskFilterCategoryDropdownOption, SpendManagementFilterCategoryDropdownOption, MatchingOperatorDropdownOption, CategoryCombinationOperator, hideCreatedByFilter, };
|
|
710
|
-
export { BillPaySetupViewState, ZeniAccountSetupViewState, BillPaySetupViewLocalData, ZeniAccountSetupViewLocalData, PlaidAccountState, fetchBillPaySetupView, fetchZeniAccountSetupView, enableSetup, getPaymentAccounts, getPlaidLinkToken, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, updateBusinessVerificationDetails, updatePaymentAccount, updatePaymentAccountLoginStatus, updatePaymentAccountStatus, establishPlaidConnection, updateMappedCashAccount, updatePrimaryFundingAccount, acceptBillPayTerms, acceptZeniAccountTerms, acceptBillPayUpdatedTerms, saveSetupViewDataInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveIndustryAndIncDateInLocalStore, clearSetupViewDataInLocalStore, clearBillPaySetupView, clearZeniAccountSetupView, sendOtp, resendOtp, verifyOtp, CompanyDetails, CompanyOfficersDetails, BillPaySetupView, ZeniAccountSetupView, BillPayBusinessVerificationDetails, ZeniAccountBusinessVerificationDetails, SetupViewState, SetupViewLocalData, SetupView, BusinessVerificationDetails, getBillPaySetupViewDetails, getPlaidAccountDetails, getZeniAccountSetupViewDetails, getBusinessVerificationDetails, getBillPayBusinessVerificationDetails, getZeniAccountBusinessVerificationDetails, getCommonSetupViewDetails, PlaidConnectionDetails, PlaidLinkTokenType, PlaidAccountKeyType,
|
|
710
|
+
export { BillPaySetupViewState, ZeniAccountSetupViewState, BillPaySetupViewLocalData, ZeniAccountSetupViewLocalData, PlaidAccountState, fetchBillPaySetupView, fetchZeniAccountSetupView, enableSetup, getPaymentAccounts, getPlaidLinkToken, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, updateBusinessVerificationDetails, updatePaymentAccount, updatePaymentAccountLoginStatus, updatePaymentAccountStatus, establishPlaidConnection, updateMappedCashAccount, updatePrimaryFundingAccount, acceptBillPayTerms, acceptZeniAccountTerms, acceptBillPayUpdatedTerms, saveSetupViewDataInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveIndustryAndIncDateInLocalStore, clearSetupViewDataInLocalStore, clearBillPaySetupView, clearZeniAccountSetupView, sendOtp, resendOtp, verifyOtp, CompanyDetails, CompanyOfficersDetails, BillPaySetupView, ZeniAccountSetupView, BillPayBusinessVerificationDetails, ZeniAccountBusinessVerificationDetails, SetupViewState, SetupViewLocalData, SetupView, BusinessVerificationDetails, getBillPaySetupViewDetails, getPlaidAccountDetails, getZeniAccountSetupViewDetails, getBusinessVerificationDetails, getBillPayBusinessVerificationDetails, getZeniAccountBusinessVerificationDetails, getCommonSetupViewDetails, PlaidConnectionDetails, PlaidLinkTokenType, PlaidAccountKeyType, CustomerToken, FundingAccount, getTwoFactorAuthenticationView, TwoFactorAuthenticationView, };
|
|
711
711
|
export { BankConnectionsSetupView, IntegrationsView, getApprovalRuleViewDetails, getBankConnectionsSetupViewDetails, getIntegrationsView, };
|
|
712
712
|
export { fetchUserFinancialAccount };
|
|
713
713
|
export { getUserFinancialAccount, UserFinancialAccountSelectorView };
|
|
@@ -16,12 +16,12 @@ export interface ChargeCardDetailSelectorView extends SelectorView {
|
|
|
16
16
|
isViewReceiptClickedImmediatelyAfterUploadTransactionId: Record<ID, boolean>;
|
|
17
17
|
uiState: ChargeCardDetailUiState;
|
|
18
18
|
transactionListFetchState: FetchStateAndError;
|
|
19
|
+
twoFAView: TwoFactorAuthenticationView;
|
|
19
20
|
loggedInUserPhone: string;
|
|
20
21
|
updateFetchState: FetchStateAndError;
|
|
21
22
|
updatePhysicalChargeCardAttemptFetchState: FetchStateAndError;
|
|
22
23
|
creditAccount: CreditAccount;
|
|
23
24
|
updateChargeCardLimitFetchState: FetchStateAndError;
|
|
24
|
-
twoFAView: TwoFactorAuthenticationView;
|
|
25
25
|
chargeCard?: ChargeCardWithUser;
|
|
26
26
|
}
|
|
27
27
|
export declare const getChargeCardDetailView: (state: RootState, chargeCardId: ID, includeCreditAccountInfo: boolean) => ChargeCardDetailSelectorView;
|
|
@@ -17,7 +17,7 @@ const chargeCardDetail_1 = require("./chargeCardDetail");
|
|
|
17
17
|
const getChargeCardDetailView = (state, chargeCardId, includeCreditAccountInfo) => {
|
|
18
18
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
19
19
|
const { tenantState, addressState, chargeCardDetailState, chargeCardState, classState, userState, userRoleState, chargeCardConfigState, chargeCardTransactionState, chargeCardListState, } = state;
|
|
20
|
-
const twoFactorAuthenticationView = (0, twoFactorAuthenticationSelector_1.
|
|
20
|
+
const twoFactorAuthenticationView = (0, twoFactorAuthenticationSelector_1.getTwoFactorAuthenticationView)(state);
|
|
21
21
|
const loggedInUserId = (_b = (_a = tenantState.loggedInUser) === null || _a === void 0 ? void 0 : _a.userId) !== null && _b !== void 0 ? _b : '';
|
|
22
22
|
const loggedInUserPhone = (_e = (_c = twoFactorAuthenticationView.phone) !== null && _c !== void 0 ? _c : (_d = (0, userSelector_1.getUserByUserId)(userState, loggedInUserId)) === null || _d === void 0 ? void 0 : _d.phone) !== null && _e !== void 0 ? _e : '';
|
|
23
23
|
let chargeCardWithUser = undefined;
|
|
@@ -13,7 +13,7 @@ const twoFactorAuthenticationReducer_1 = require("./twoFactorAuthenticationReduc
|
|
|
13
13
|
const resendOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(twoFactorAuthenticationReducer_1.resendOtp.match), (0, operators_1.mergeMap)((action) => {
|
|
14
14
|
var _a;
|
|
15
15
|
const resendOtpActions = [];
|
|
16
|
-
const { otpChallenge, twoFASource
|
|
16
|
+
const { otpChallenge, twoFASource } = action.payload;
|
|
17
17
|
const tenantState = state$.value.tenantState;
|
|
18
18
|
const companyState = state$.value.companyState;
|
|
19
19
|
const { currentTenantId } = tenantState;
|
|
@@ -24,22 +24,12 @@ const resendOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators
|
|
|
24
24
|
? companyState.companiesById[companyId].companyChargeCardInfo
|
|
25
25
|
.isChargeCardEnabled
|
|
26
26
|
: false;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
payload = {
|
|
37
|
-
otp_challenge: otpChallenge,
|
|
38
|
-
is_for_charge_cards: twoFASource === 'ChargeCard' ||
|
|
39
|
-
twoFASource === 'CardUserOnboarding' ||
|
|
40
|
-
(twoFASource === 'MyProfile' && isCardsEnabled),
|
|
41
|
-
};
|
|
42
|
-
}
|
|
27
|
+
const payload = {
|
|
28
|
+
otp_challenge: otpChallenge,
|
|
29
|
+
is_for_charge_cards: twoFASource === 'ChargeCard' ||
|
|
30
|
+
twoFASource === 'CardUserOnboarding' ||
|
|
31
|
+
(twoFASource === 'MyProfile' && isCardsEnabled),
|
|
32
|
+
};
|
|
43
33
|
switch (twoFASource) {
|
|
44
34
|
case 'SpendManagementSetup':
|
|
45
35
|
resendOtpActions.push((0, setupViewReducer_1.resendOtpSpendManagementSetUp)());
|
|
@@ -62,11 +52,7 @@ const resendOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators
|
|
|
62
52
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
63
53
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
64
54
|
const updateActions = [
|
|
65
|
-
(0, twoFactorAuthenticationReducer_1.sendOtpSuccess)({
|
|
66
|
-
otpChallenge: response.data.otp_challenge,
|
|
67
|
-
twoFASource,
|
|
68
|
-
entityId,
|
|
69
|
-
}),
|
|
55
|
+
(0, twoFactorAuthenticationReducer_1.sendOtpSuccess)({ otpChallenge: response.data.otp_challenge }),
|
|
70
56
|
];
|
|
71
57
|
switch (twoFASource) {
|
|
72
58
|
case 'SpendManagementSetup':
|
|
@@ -99,7 +85,7 @@ const resendOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators
|
|
|
99
85
|
}
|
|
100
86
|
else {
|
|
101
87
|
const updateActions = [
|
|
102
|
-
(0, twoFactorAuthenticationReducer_1.sendOtpFailure)(
|
|
88
|
+
(0, twoFactorAuthenticationReducer_1.sendOtpFailure)(response.status),
|
|
103
89
|
];
|
|
104
90
|
switch (twoFASource) {
|
|
105
91
|
case 'SpendManagementSetup':
|
|
@@ -122,9 +108,7 @@ const resendOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators
|
|
|
122
108
|
}
|
|
123
109
|
}), (0, operators_1.catchError)((error) => {
|
|
124
110
|
const zeniAPIStatus = (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Resend otp api errored out' + JSON.stringify(error));
|
|
125
|
-
const updateActions = [
|
|
126
|
-
(0, twoFactorAuthenticationReducer_1.sendOtpFailure)({ error: zeniAPIStatus, twoFASource, entityId }),
|
|
127
|
-
];
|
|
111
|
+
const updateActions = [(0, twoFactorAuthenticationReducer_1.sendOtpFailure)(zeniAPIStatus)];
|
|
128
112
|
switch (twoFASource) {
|
|
129
113
|
case 'SpendManagementSetup':
|
|
130
114
|
updateActions.push((0, setupViewReducer_1.sendOtpFailureSpendManagementSetUp)(zeniAPIStatus));
|
|
@@ -13,7 +13,7 @@ const twoFactorAuthenticationReducer_1 = require("./twoFactorAuthenticationReduc
|
|
|
13
13
|
const sendOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(twoFactorAuthenticationReducer_1.sendOtp.match), (0, operators_1.mergeMap)((action) => {
|
|
14
14
|
var _a;
|
|
15
15
|
const sendOtpActions = [];
|
|
16
|
-
const { phoneNumber, twoFASource
|
|
16
|
+
const { phoneNumber, twoFASource } = action.payload;
|
|
17
17
|
const tenantState = state$.value.tenantState;
|
|
18
18
|
const companyState = state$.value.companyState;
|
|
19
19
|
const { currentTenantId } = tenantState;
|
|
@@ -24,20 +24,15 @@ const sendOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1
|
|
|
24
24
|
? companyState.companiesById[companyId].companyChargeCardInfo
|
|
25
25
|
.isChargeCardEnabled
|
|
26
26
|
: false;
|
|
27
|
-
|
|
27
|
+
const queryPayload = {
|
|
28
28
|
channel_type: 'phone',
|
|
29
29
|
channel_info: {
|
|
30
30
|
phone_number: phoneNumber,
|
|
31
31
|
},
|
|
32
32
|
is_for_charge_cards: twoFASource === 'ChargeCard' ||
|
|
33
33
|
twoFASource === 'CardUserOnboarding' ||
|
|
34
|
-
twoFASource === 'ChargeCardDetail' ||
|
|
35
34
|
(twoFASource === 'MyProfile' && isCardsEnabled),
|
|
36
35
|
};
|
|
37
|
-
if (twoFASource === 'ChargeCardDetail' && entityId != null) {
|
|
38
|
-
const chargeCardProviderId = state$.value.chargeCardState.chargeCardByID[entityId].cardProviderID;
|
|
39
|
-
queryPayload = Object.assign(Object.assign({}, queryPayload), { provider_card_id: chargeCardProviderId });
|
|
40
|
-
}
|
|
41
36
|
switch (twoFASource) {
|
|
42
37
|
case 'SpendManagementSetup':
|
|
43
38
|
sendOtpActions.push((0, setupViewReducer_1.sendOtpSpendManagementSetUp)());
|
|
@@ -60,11 +55,7 @@ const sendOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1
|
|
|
60
55
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
61
56
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
62
57
|
const updateActions = [
|
|
63
|
-
(0, twoFactorAuthenticationReducer_1.sendOtpSuccess)({
|
|
64
|
-
otpChallenge: response.data.otp_challenge,
|
|
65
|
-
twoFASource,
|
|
66
|
-
entityId,
|
|
67
|
-
}),
|
|
58
|
+
(0, twoFactorAuthenticationReducer_1.sendOtpSuccess)({ otpChallenge: response.data.otp_challenge }),
|
|
68
59
|
];
|
|
69
60
|
switch (twoFASource) {
|
|
70
61
|
case 'SpendManagementSetup':
|
|
@@ -97,7 +88,7 @@ const sendOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1
|
|
|
97
88
|
}
|
|
98
89
|
else {
|
|
99
90
|
const updateActions = [
|
|
100
|
-
(0, twoFactorAuthenticationReducer_1.sendOtpFailure)(
|
|
91
|
+
(0, twoFactorAuthenticationReducer_1.sendOtpFailure)(response.status),
|
|
101
92
|
];
|
|
102
93
|
switch (twoFASource) {
|
|
103
94
|
case 'SpendManagementSetup':
|
|
@@ -120,9 +111,7 @@ const sendOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1
|
|
|
120
111
|
}
|
|
121
112
|
}), (0, operators_1.catchError)((error) => {
|
|
122
113
|
const zeniAPIStatus = (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Send otp api errored out' + JSON.stringify(error));
|
|
123
|
-
const updateActions = [
|
|
124
|
-
(0, twoFactorAuthenticationReducer_1.sendOtpFailure)({ error: zeniAPIStatus, twoFASource, entityId }),
|
|
125
|
-
];
|
|
114
|
+
const updateActions = [(0, twoFactorAuthenticationReducer_1.sendOtpFailure)(zeniAPIStatus)];
|
|
126
115
|
switch (twoFASource) {
|
|
127
116
|
case 'SpendManagementSetup':
|
|
128
117
|
updateActions.push((0, setupViewReducer_1.sendOtpFailureSpendManagementSetUp)(zeniAPIStatus));
|
|
@@ -1,27 +1,16 @@
|
|
|
1
|
-
import { FetchStateAndError
|
|
1
|
+
import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
2
2
|
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
-
export interface
|
|
3
|
+
export interface TwoFactorAuthenticationState {
|
|
4
4
|
sendOtpStatus: FetchStateAndError;
|
|
5
5
|
otpVerificationStatus: FetchStateAndError;
|
|
6
|
-
|
|
6
|
+
customerToken?: CustomerToken;
|
|
7
7
|
phone?: string;
|
|
8
8
|
otpChallenge?: string;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
11
|
-
export interface
|
|
12
|
-
twoFactorAuthenticationBySource: {
|
|
13
|
-
common: TwoFactorAuthentication;
|
|
14
|
-
chargeCardDetail: Record<ID, TwoFactorAuthentication>;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export declare const COMMON_TWO_FA_SOURCE: readonly ["BillPayVendor", "ChargeCard", "SpendManagementSetup", "CardUserOnboarding", "MyProfile", "CustomerOnboarding"];
|
|
18
|
-
export declare const toCommonTwoFASource: (v: string) => "CardUserOnboarding" | "MyProfile" | "BillPayVendor" | "ChargeCard" | "SpendManagementSetup" | "CustomerOnboarding";
|
|
19
|
-
export type CommonTwoFASource = ReturnType<typeof toCommonTwoFASource>;
|
|
20
|
-
export type TwoFASourceView = CommonTwoFASource | 'ChargeCardDetail';
|
|
21
|
-
export interface Token {
|
|
10
|
+
export type TwoFASourceView = 'BillPayVendor' | 'ChargeCard' | 'SpendManagementSetup' | 'CardUserOnboarding' | 'MyProfile' | 'CustomerOnboarding';
|
|
11
|
+
export interface CustomerToken {
|
|
22
12
|
provider: string;
|
|
23
13
|
token: string;
|
|
24
14
|
expiry: ZeniDate;
|
|
25
15
|
message: string;
|
|
26
16
|
}
|
|
27
|
-
export declare const initialTwoFactorAuthentication: TwoFactorAuthentication;
|
|
@@ -1,37 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initialTwoFactorAuthentication = 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
|
-
'ChargeCard',
|
|
18
|
-
'SpendManagementSetup',
|
|
19
|
-
'CardUserOnboarding',
|
|
20
|
-
'MyProfile',
|
|
21
|
-
'CustomerOnboarding',
|
|
22
|
-
];
|
|
23
|
-
const toCommonTwoFASource = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.COMMON_TWO_FA_SOURCE);
|
|
24
|
-
exports.toCommonTwoFASource = toCommonTwoFASource;
|
|
25
|
-
exports.initialTwoFactorAuthentication = {
|
|
26
|
-
sendOtpStatus: {
|
|
27
|
-
fetchState: 'Not-Started',
|
|
28
|
-
error: undefined,
|
|
29
|
-
},
|
|
30
|
-
otpVerificationStatus: {
|
|
31
|
-
fetchState: 'Not-Started',
|
|
32
|
-
error: undefined,
|
|
33
|
-
},
|
|
34
|
-
token: undefined,
|
|
35
|
-
phone: undefined,
|
|
36
|
-
otpChallenge: undefined,
|
|
37
|
-
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ZeniAPIResponse } from '../../responsePayload';
|
|
2
|
-
import {
|
|
2
|
+
import { CustomerToken } 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
|
+
customer_token_info?: CustomerTokenPayload;
|
|
11
11
|
}
|
|
12
|
-
export interface
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export interface CustomerTokenPayload {
|
|
13
|
+
customer_token_provider: string;
|
|
14
|
+
customer_token: string;
|
|
15
|
+
customer_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 toCustomerToken: (payload: CustomerTokenPayload) => CustomerToken;
|
|
20
20
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.toCustomerToken = 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 toCustomerToken = (payload) => ({
|
|
6
|
+
provider: payload.customer_token_provider,
|
|
7
|
+
token: payload.customer_token,
|
|
8
|
+
expiry: (0, zeniDayJS_1.date)(payload.customer_token_expiration_time),
|
|
9
9
|
message: payload.message,
|
|
10
10
|
});
|
|
11
|
-
exports.
|
|
11
|
+
exports.toCustomerToken = toCustomerToken;
|
|
@@ -1,37 +1,21 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
1
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
3
2
|
import { TwoFASourceView, TwoFactorAuthenticationState } from './twoFactorAuthentication';
|
|
4
|
-
import {
|
|
3
|
+
import { CustomerTokenPayload } from './twoFactorAuthenticationPayload';
|
|
5
4
|
export declare const initialState: TwoFactorAuthenticationState;
|
|
6
|
-
export declare const sendOtp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[phoneNumber: string, twoFASource: TwoFASourceView
|
|
5
|
+
export declare const sendOtp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[phoneNumber: string, twoFASource: TwoFASourceView], {
|
|
7
6
|
phoneNumber: string;
|
|
8
7
|
twoFASource: TwoFASourceView;
|
|
9
|
-
|
|
10
|
-
}, "twoFactorAuthentication/sendOtp", never, never>, resendOtp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[otpChallenge: string, twoFASource: TwoFASourceView, entityId?: string | undefined], {
|
|
8
|
+
}, "twoFactorAuthentication/sendOtp", never, never>, resendOtp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[otpChallenge: string, twoFASource: TwoFASourceView], {
|
|
11
9
|
otpChallenge: string;
|
|
12
10
|
twoFASource: TwoFASourceView;
|
|
13
|
-
entityId: string | undefined;
|
|
14
11
|
}, "twoFactorAuthentication/resendOtp", never, never>, sendOtpSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
15
12
|
otpChallenge: string;
|
|
16
|
-
|
|
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], {
|
|
13
|
+
}, "twoFactorAuthentication/sendOtpSuccess">, sendOtpFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "twoFactorAuthentication/sendOtpFailure">, verifyOtp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[otpCode: string, otpChallenge: string, twoFASource: TwoFASourceView], {
|
|
23
14
|
otpCode: string;
|
|
24
15
|
otpChallenge: string;
|
|
25
16
|
twoFASource: TwoFASourceView;
|
|
26
|
-
entityId: string | undefined;
|
|
27
17
|
}, "twoFactorAuthentication/verifyOtp", never, never>, verifyOtpSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
tokenPayload: TokenPayload | undefined;
|
|
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">;
|
|
18
|
+
customerTokenPayload: CustomerTokenPayload | undefined;
|
|
19
|
+
}, "twoFactorAuthentication/verifyOtpSuccess">, verifyOtpFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "twoFactorAuthentication/verifyOtpFailure">, clearTwoFactorAuthentication: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"twoFactorAuthentication/clearTwoFactorAuthentication">;
|
|
36
20
|
declare const _default: import("redux").Reducer<TwoFactorAuthenticationState>;
|
|
37
21
|
export default _default;
|
|
@@ -3,13 +3,19 @@ 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");
|
|
7
6
|
const twoFactorAuthenticationPayload_1 = require("./twoFactorAuthenticationPayload");
|
|
8
7
|
exports.initialState = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
sendOtpStatus: {
|
|
9
|
+
fetchState: 'Not-Started',
|
|
10
|
+
error: undefined,
|
|
12
11
|
},
|
|
12
|
+
otpVerificationStatus: {
|
|
13
|
+
fetchState: 'Not-Started',
|
|
14
|
+
error: undefined,
|
|
15
|
+
},
|
|
16
|
+
customerToken: undefined,
|
|
17
|
+
phone: undefined,
|
|
18
|
+
otpChallenge: undefined,
|
|
13
19
|
};
|
|
14
20
|
const twoFactorAuthentication = (0, toolkit_1.createSlice)({
|
|
15
21
|
name: 'twoFactorAuthentication',
|
|
@@ -17,147 +23,74 @@ const twoFactorAuthentication = (0, toolkit_1.createSlice)({
|
|
|
17
23
|
reducers: {
|
|
18
24
|
sendOtp: {
|
|
19
25
|
reducer(draft, action) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
draft.twoFactorAuthenticationBySource.common.phone = phoneNumber;
|
|
32
|
-
draft.twoFactorAuthenticationBySource.common.sendOtpStatus = {
|
|
33
|
-
fetchState: 'In-Progress',
|
|
34
|
-
error: undefined,
|
|
35
|
-
};
|
|
36
|
-
draft.twoFactorAuthenticationBySource.common.otpVerificationStatus = {
|
|
37
|
-
fetchState: 'Not-Started',
|
|
38
|
-
error: undefined,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
26
|
+
draft.phone = action.payload.phoneNumber;
|
|
27
|
+
draft.sendOtpStatus = {
|
|
28
|
+
fetchState: 'In-Progress',
|
|
29
|
+
error: undefined,
|
|
30
|
+
};
|
|
31
|
+
draft.otpVerificationStatus = {
|
|
32
|
+
fetchState: 'Not-Started',
|
|
33
|
+
error: undefined,
|
|
34
|
+
};
|
|
41
35
|
},
|
|
42
|
-
prepare(phoneNumber, twoFASource
|
|
43
|
-
return { payload: { phoneNumber, twoFASource
|
|
36
|
+
prepare(phoneNumber, twoFASource) {
|
|
37
|
+
return { payload: { phoneNumber, twoFASource } };
|
|
44
38
|
},
|
|
45
39
|
},
|
|
46
40
|
resendOtp: {
|
|
47
|
-
reducer(draft
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
} });
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
draft.twoFactorAuthenticationBySource.common.sendOtpStatus = {
|
|
60
|
-
fetchState: 'In-Progress',
|
|
61
|
-
error: undefined,
|
|
62
|
-
};
|
|
63
|
-
draft.twoFactorAuthenticationBySource.common.otpVerificationStatus = {
|
|
64
|
-
fetchState: 'Not-Started',
|
|
65
|
-
error: undefined,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
41
|
+
reducer(draft) {
|
|
42
|
+
draft.sendOtpStatus = {
|
|
43
|
+
fetchState: 'In-Progress',
|
|
44
|
+
error: undefined,
|
|
45
|
+
};
|
|
46
|
+
draft.otpVerificationStatus = {
|
|
47
|
+
fetchState: 'Not-Started',
|
|
48
|
+
error: undefined,
|
|
49
|
+
};
|
|
68
50
|
},
|
|
69
|
-
prepare(otpChallenge, twoFASource
|
|
70
|
-
return { payload: { otpChallenge, twoFASource
|
|
51
|
+
prepare(otpChallenge, twoFASource) {
|
|
52
|
+
return { payload: { otpChallenge, twoFASource } };
|
|
71
53
|
},
|
|
72
54
|
},
|
|
73
55
|
sendOtpSuccess(draft, action) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
} });
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
draft.twoFactorAuthenticationBySource.common.otpChallenge =
|
|
83
|
-
otpChallenge;
|
|
84
|
-
draft.twoFactorAuthenticationBySource.common.sendOtpStatus = {
|
|
85
|
-
fetchState: 'Completed',
|
|
86
|
-
error: undefined,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
56
|
+
draft.otpChallenge = action.payload.otpChallenge;
|
|
57
|
+
draft.sendOtpStatus = {
|
|
58
|
+
fetchState: 'Completed',
|
|
59
|
+
error: undefined,
|
|
60
|
+
};
|
|
89
61
|
},
|
|
90
62
|
sendOtpFailure(draft, action) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
error,
|
|
96
|
-
} });
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
draft.twoFactorAuthenticationBySource.common.sendOtpStatus = {
|
|
100
|
-
fetchState: 'Error',
|
|
101
|
-
error,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
63
|
+
draft.sendOtpStatus = {
|
|
64
|
+
fetchState: 'Error',
|
|
65
|
+
error: action.payload,
|
|
66
|
+
};
|
|
104
67
|
},
|
|
105
68
|
verifyOtp: {
|
|
106
|
-
reducer(draft
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
error: undefined,
|
|
112
|
-
} });
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
draft.twoFactorAuthenticationBySource.common.otpVerificationStatus = {
|
|
116
|
-
fetchState: 'In-Progress',
|
|
117
|
-
error: undefined,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
69
|
+
reducer(draft) {
|
|
70
|
+
draft.otpVerificationStatus = {
|
|
71
|
+
fetchState: 'In-Progress',
|
|
72
|
+
error: undefined,
|
|
73
|
+
};
|
|
120
74
|
},
|
|
121
|
-
prepare(otpCode, otpChallenge, twoFASource
|
|
122
|
-
return { payload: { otpCode, otpChallenge, twoFASource
|
|
75
|
+
prepare(otpCode, otpChallenge, twoFASource) {
|
|
76
|
+
return { payload: { otpCode, otpChallenge, twoFASource } };
|
|
123
77
|
},
|
|
124
78
|
},
|
|
125
79
|
verifyOtpSuccess(draft, action) {
|
|
126
|
-
const {
|
|
127
|
-
if (
|
|
128
|
-
draft.
|
|
129
|
-
fetchState: 'Completed',
|
|
130
|
-
error: undefined,
|
|
131
|
-
} });
|
|
132
|
-
if (tokenPayload != null) {
|
|
133
|
-
draft.twoFactorAuthenticationBySource.chargeCardDetail[entityId].token = (0, twoFactorAuthenticationPayload_1.toToken)(tokenPayload);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
if (tokenPayload != null) {
|
|
138
|
-
draft.twoFactorAuthenticationBySource.common.token =
|
|
139
|
-
(0, twoFactorAuthenticationPayload_1.toToken)(tokenPayload);
|
|
140
|
-
}
|
|
141
|
-
draft.twoFactorAuthenticationBySource.common.otpVerificationStatus = {
|
|
142
|
-
fetchState: 'Completed',
|
|
143
|
-
error: undefined,
|
|
144
|
-
};
|
|
80
|
+
const { customerTokenPayload } = action.payload;
|
|
81
|
+
if (customerTokenPayload != null) {
|
|
82
|
+
draft.customerToken = (0, twoFactorAuthenticationPayload_1.toCustomerToken)(customerTokenPayload);
|
|
145
83
|
}
|
|
84
|
+
draft.otpVerificationStatus = {
|
|
85
|
+
fetchState: 'Completed',
|
|
86
|
+
error: undefined,
|
|
87
|
+
};
|
|
146
88
|
},
|
|
147
89
|
verifyOtpFailure(draft, action) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
error,
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
draft.twoFactorAuthenticationBySource.common.otpVerificationStatus = {
|
|
157
|
-
fetchState: 'Error',
|
|
158
|
-
error,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
90
|
+
draft.otpVerificationStatus = {
|
|
91
|
+
fetchState: 'Error',
|
|
92
|
+
error: action.payload,
|
|
93
|
+
};
|
|
161
94
|
},
|
|
162
95
|
clearTwoFactorAuthentication(draft) {
|
|
163
96
|
Object.assign(draft, exports.initialState);
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { FetchStateAndError
|
|
1
|
+
import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
2
2
|
import { View } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
3
|
import { RootState } from '../../reducer';
|
|
4
|
-
import {
|
|
4
|
+
import { CustomerToken } from './twoFactorAuthentication';
|
|
5
5
|
export interface TwoFactorAuthenticationView extends View {
|
|
6
6
|
sendOtpStatus: FetchStateAndError;
|
|
7
7
|
otpVerificationStatus: FetchStateAndError;
|
|
8
|
-
|
|
8
|
+
customerToken?: CustomerToken;
|
|
9
9
|
phone?: string;
|
|
10
10
|
otpChallenge?: string;
|
|
11
11
|
}
|
|
12
12
|
export declare const getTwoFactorAuthenticationView: (state: RootState) => TwoFactorAuthenticationView;
|
|
13
|
-
export declare const getTwoFactorAuthenticationViewForCardDetail: (state: RootState, cardId: ID) => TwoFactorAuthenticationView;
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getTwoFactorAuthenticationView = void 0;
|
|
4
4
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
-
const twoFactorAuthentication_1 = require("./twoFactorAuthentication");
|
|
6
5
|
exports.getTwoFactorAuthenticationView = (0, toolkit_1.createSelector)((state) => state.twoFactorAuthenticationState, (twoFAState) => {
|
|
7
|
-
return Object.assign({}, twoFAState
|
|
6
|
+
return Object.assign({}, twoFAState);
|
|
8
7
|
});
|
|
9
|
-
const getTwoFactorAuthenticationViewForCardDetail = (state, cardId) => {
|
|
10
|
-
var _a;
|
|
11
|
-
return (_a = state.twoFactorAuthenticationState.twoFactorAuthenticationBySource
|
|
12
|
-
.chargeCardDetail[cardId]) !== null && _a !== void 0 ? _a : twoFactorAuthentication_1.defaultTwoFactorAuthenticationState;
|
|
13
|
-
};
|
|
14
|
-
exports.getTwoFactorAuthenticationViewForCardDetail = getTwoFactorAuthenticationViewForCardDetail;
|
|
@@ -9,4 +9,4 @@ import { verifyOtpCardUserOnboarding, verifyOtpCardUserOnboardingFailure, verify
|
|
|
9
9
|
import { verifyOtpFailureSpendManagementSetUp, verifyOtpSpendManagementSetUp, verifyOtpSuccessSpendManagementSetUp } from '../spendManagement/commonSetup/setupViewReducer';
|
|
10
10
|
import { verifyOtp, verifyOtpFailure, verifyOtpSuccess } from './twoFactorAuthenticationReducer';
|
|
11
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>,
|
|
12
|
+
export declare const verifyOtpEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -10,17 +10,13 @@ const settingsViewReducer_1 = require("../settingsView/settingsViewReducer");
|
|
|
10
10
|
const cardUserOnboardingReducer_1 = require("../spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingReducer");
|
|
11
11
|
const setupViewReducer_1 = require("../spendManagement/commonSetup/setupViewReducer");
|
|
12
12
|
const twoFactorAuthenticationReducer_1 = require("./twoFactorAuthenticationReducer");
|
|
13
|
-
const verifyOtpEpic = (actions$,
|
|
13
|
+
const verifyOtpEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(twoFactorAuthenticationReducer_1.verifyOtp.match), (0, operators_1.mergeMap)((action) => {
|
|
14
14
|
const verifyOtpActions = [];
|
|
15
|
-
const { otpCode, otpChallenge, twoFASource
|
|
16
|
-
|
|
15
|
+
const { otpCode, otpChallenge, twoFASource } = action.payload;
|
|
16
|
+
const payload = {
|
|
17
17
|
otp_code: otpCode,
|
|
18
18
|
otp_challenge: otpChallenge,
|
|
19
19
|
};
|
|
20
|
-
if (twoFASource === 'ChargeCardDetail' && entityId != null) {
|
|
21
|
-
const chargeCardProviderId = state$.value.chargeCardState.chargeCardByID[entityId].cardProviderID;
|
|
22
|
-
payload = Object.assign(Object.assign({}, payload), { provider_card_id: chargeCardProviderId });
|
|
23
|
-
}
|
|
24
20
|
switch (twoFASource) {
|
|
25
21
|
case 'SpendManagementSetup':
|
|
26
22
|
verifyOtpActions.push((0, setupViewReducer_1.verifyOtpSpendManagementSetUp)());
|
|
@@ -46,9 +42,7 @@ const verifyOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators
|
|
|
46
42
|
response.data.is_verified === true) {
|
|
47
43
|
const updateActions = [
|
|
48
44
|
(0, twoFactorAuthenticationReducer_1.verifyOtpSuccess)({
|
|
49
|
-
|
|
50
|
-
twoFASource,
|
|
51
|
-
entityId,
|
|
45
|
+
customerTokenPayload: response.data.customer_token_info,
|
|
52
46
|
}),
|
|
53
47
|
];
|
|
54
48
|
switch (twoFASource) {
|
|
@@ -72,11 +66,7 @@ const verifyOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators
|
|
|
72
66
|
}
|
|
73
67
|
else {
|
|
74
68
|
const updateActions = [
|
|
75
|
-
(0, twoFactorAuthenticationReducer_1.verifyOtpFailure)(
|
|
76
|
-
error: response.status,
|
|
77
|
-
twoFASource,
|
|
78
|
-
entityId,
|
|
79
|
-
}),
|
|
69
|
+
(0, twoFactorAuthenticationReducer_1.verifyOtpFailure)(response.status),
|
|
80
70
|
];
|
|
81
71
|
switch (twoFASource) {
|
|
82
72
|
case 'SpendManagementSetup':
|
|
@@ -100,7 +90,7 @@ const verifyOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators
|
|
|
100
90
|
}), (0, operators_1.catchError)((error) => {
|
|
101
91
|
const zeniAPIStatus = (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Verify otp api errored out' + JSON.stringify(error));
|
|
102
92
|
const updateActions = [
|
|
103
|
-
(0, twoFactorAuthenticationReducer_1.verifyOtpFailure)(
|
|
93
|
+
(0, twoFactorAuthenticationReducer_1.verifyOtpFailure)(zeniAPIStatus),
|
|
104
94
|
];
|
|
105
95
|
switch (twoFASource) {
|
|
106
96
|
case 'SpendManagementSetup':
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.14.
|
|
3
|
+
"version": "4.14.95",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|