@zeniai/client-epic-state 4.7.74 → 4.7.76
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/workingDayHelper.d.ts +9 -5
- package/lib/commonStateTypes/workingDayHelper.js +36 -12
- package/lib/entity/account/accountPayload.d.ts +1 -1
- package/lib/entity/billPay/billTransaction/billTransactionPayload.d.ts +3 -0
- package/lib/entity/billPay/billTransaction/billTransactionPayload.js +2 -2
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +3 -0
- package/lib/entity/billPay/recurringBills/recurringBillsPayload.d.ts +34 -0
- package/lib/entity/billPay/recurringBills/recurringBillsPayload.js +44 -0
- package/lib/entity/billPay/recurringBills/recurringBillsReducer.d.ts +6 -0
- package/lib/entity/billPay/recurringBills/recurringBillsReducer.js +40 -0
- package/lib/entity/billPay/recurringBills/recurringBillsState.d.ts +33 -0
- package/lib/entity/billPay/recurringBills/recurringBillsState.js +14 -0
- package/lib/entity/chargeCard/chargeCard.d.ts +3 -2
- package/lib/entity/chargeCard/chargeCardPayload.d.ts +4 -14
- package/lib/entity/chargeCard/chargeCardPayload.js +1 -0
- package/lib/entity/depositAccount/depositAccountPayload.d.ts +2 -5
- package/lib/entity/entityApprovalStatus/entityApprovalStatusPayload.d.ts +1 -0
- package/lib/entity/entityApprovalStatus/entityApprovalStatusPayload.js +1 -0
- package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +1 -0
- package/lib/entity/paymentAccount/paymentAccountPayload.d.ts +1 -0
- package/lib/entity/paymentAccount/paymentAccountPayload.js +2 -1
- package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +2 -0
- package/lib/entity/paymentAccount/paymentAccountSelector.js +14 -1
- package/lib/entity/paymentAccount/paymentAccountState.d.ts +1 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +5 -2
- package/lib/entity/tenant/clearAllEpic.js +6 -0
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.d.ts +2 -2
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +2 -2
- package/lib/entity/transaction/stateTypes/attachment.js +5 -5
- package/lib/epic.d.ts +9 -10
- package/lib/epic.js +9 -10
- package/lib/index.d.ts +26 -14
- package/lib/index.js +37 -22
- package/lib/reducer.d.ts +9 -0
- package/lib/reducer.js +9 -0
- package/lib/view/accountList/accountListReducer.js +2 -1
- package/lib/view/accountList/accountListState.d.ts +1 -1
- package/lib/view/accountList/fetchAccountListEpic.js +16 -7
- package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +1 -0
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/verifyUserEpic.d.ts +2 -2
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/verifyUserEpic.js +2 -2
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.d.ts +4 -9
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.js +41 -70
- package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +2 -2
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +2 -9
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +70 -102
- package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
- package/lib/view/people/deletePersonEpic.d.ts +1 -1
- package/lib/view/people/invitePeopleEpic.d.ts +1 -1
- package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
- package/lib/view/people/resendInviteEpic.d.ts +1 -1
- package/lib/view/settingsView/epic/fetchBankAccountsListEpic.d.ts +22 -0
- package/lib/view/settingsView/epic/fetchBankAccountsListEpic.js +30 -0
- package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.d.ts +6 -0
- package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.js +14 -0
- package/lib/view/settingsView/epic/fetchMyProfileEpic.d.ts +43 -0
- package/lib/view/settingsView/epic/fetchMyProfileEpic.js +50 -0
- package/lib/view/settingsView/epic/fetchMyProfileViewEpic.d.ts +7 -0
- package/lib/view/settingsView/epic/fetchMyProfileViewEpic.js +17 -0
- package/lib/view/settingsView/settingsViewPayload.d.ts +8 -0
- package/lib/view/settingsView/settingsViewReducer.d.ts +13 -0
- package/lib/view/settingsView/settingsViewReducer.js +71 -0
- package/lib/view/settingsView/settingsViewSelector.d.ts +14 -0
- package/lib/view/settingsView/settingsViewSelector.js +119 -0
- package/lib/view/settingsView/settingsViewState.d.ts +12 -0
- package/lib/view/settingsView/settingsViewState.js +2 -0
- package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +29 -0
- package/lib/view/settingsView/types/settingsViewSelectorTypes.js +2 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewPayload.d.ts +3 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +5 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +13 -2
- package/lib/view/spendManagement/billPay/billDetailView/epics/cancelAndDeleteBillEpic.d.ts +2 -1
- package/lib/view/spendManagement/billPay/billDetailView/epics/cancelAndDeleteBillEpic.js +19 -8
- package/lib/view/spendManagement/billPay/billDetailView/epics/deleteBillEpic.d.ts +2 -1
- package/lib/view/spendManagement/billPay/billDetailView/epics/deleteBillEpic.js +14 -4
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.d.ts +2 -1
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +5 -2
- package/lib/view/spendManagement/billPay/billList/billListPayload.d.ts +2 -0
- package/lib/view/spendManagement/billPay/billList/billListSelector.d.ts +3 -0
- package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -2
- package/lib/view/spendManagement/billPay/billList/fetchBillListPerTabEpic.d.ts +2 -1
- package/lib/view/spendManagement/billPay/billList/fetchBillListPerTabEpic.js +3 -1
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +4 -0
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +31 -9
- package/lib/view/spendManagement/billPay/editBillView/editBillViewPayload.d.ts +4 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +17 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +10 -2
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +59 -14
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +28 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.js +1 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +3 -3
- package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +13 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +3 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.d.ts +11 -24
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.js +100 -14
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +4 -1
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigState.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +4 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +25 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +3 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +6 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardDetailEpic.d.ts +11 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardDetailEpic.js +60 -0
- package/lib/view/spendManagement/commonHistoryView/commonHistory.d.ts +1 -0
- package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.d.ts +1 -0
- package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.js +9 -5
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +2 -9
- package/lib/view/spendManagement/commonSetup/setupViewReducer.js +72 -104
- package/lib/view/spendManagement/helpers.d.ts +11 -1
- package/lib/view/spendManagement/helpers.js +134 -1
- package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.d.ts +1 -0
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.js +1 -0
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigReducer.js +3 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.d.ts +1 -0
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.js +2 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigState.d.ts +1 -0
- package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +10 -0
- package/lib/view/twoFactorAuthentication/resendOtpEpic.js +90 -0
- package/lib/view/twoFactorAuthentication/sendOtpEpic.d.ts +10 -0
- package/lib/view/twoFactorAuthentication/sendOtpEpic.js +93 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.d.ts +16 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.js +2 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.d.ts +19 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.js +11 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.d.ts +21 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.js +101 -0
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.d.ts +10 -0
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.js +90 -0
- package/package.json +5 -4
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewResendOtpEpic.d.ts +0 -7
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewResendOtpEpic.js +0 -24
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewSendOtpEpic.d.ts +0 -7
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewSendOtpEpic.js +0 -26
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewVerifyOtpEpic.d.ts +0 -7
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewVerifyOtpEpic.js +0 -28
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/resendOnboardingOfficerOtpEpic.d.ts +0 -7
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/resendOnboardingOfficerOtpEpic.js +0 -24
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/sendOnboardingOfficerOtpEpic.d.ts +0 -7
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/sendOnboardingOfficerOtpEpic.js +0 -27
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/verifyOnboardingOfficerOtpEpic.d.ts +0 -7
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/verifyOnboardingOfficerOtpEpic.js +0 -30
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/resendOtpEpic.d.ts +0 -7
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/resendOtpEpic.js +0 -23
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/sendOtpEpic.d.ts +0 -7
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/sendOtpEpic.js +0 -26
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/verifyOtpEpic.d.ts +0 -7
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/verifyOtpEpic.js +0 -27
- package/lib/view/spendManagement/commonSetup/types/twoFactorAuthentication.d.ts +0 -10
- /package/lib/view/{spendManagement/commonSetup/types/twoFactorAuthentication.js → settingsView/settingsViewPayload.js} +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendOtpEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../responsePayload");
|
|
7
|
+
const twoFactorAuthenticationReducer_1 = require("./twoFactorAuthenticationReducer");
|
|
8
|
+
const setupViewReducer_1 = require("../spendManagement/commonSetup/setupViewReducer");
|
|
9
|
+
const vendorViewReducer_1 = require("../commonVendorView/vendorView/vendorViewReducer");
|
|
10
|
+
const onboardingCustomerViewReducer_1 = require("../onboardingView/customerView/onboardingCustomerViewReducer");
|
|
11
|
+
const sendOtpEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(twoFactorAuthenticationReducer_1.sendOtp.match), (0, operators_1.mergeMap)((action) => {
|
|
12
|
+
const sendOtpActions = [];
|
|
13
|
+
const { phoneNumber, twoFASource } = action.payload;
|
|
14
|
+
const queryPayload = {
|
|
15
|
+
channel_type: 'phone',
|
|
16
|
+
channel_info: {
|
|
17
|
+
phone_number: phoneNumber,
|
|
18
|
+
},
|
|
19
|
+
is_for_charge_cards: twoFASource === 'ChargeCard',
|
|
20
|
+
};
|
|
21
|
+
switch (twoFASource) {
|
|
22
|
+
case 'SpendManagementSetup':
|
|
23
|
+
sendOtpActions.push((0, setupViewReducer_1.sendOtpSpendManagementSetUp)());
|
|
24
|
+
break;
|
|
25
|
+
case 'BillPayVendor':
|
|
26
|
+
sendOtpActions.push((0, vendorViewReducer_1.sendOtpVendorView)({ phoneNumber }));
|
|
27
|
+
break;
|
|
28
|
+
case 'CustomerOnboarding':
|
|
29
|
+
sendOtpActions.push((0, onboardingCustomerViewReducer_1.sendOnboardingOfficerOtp)());
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
const setOtp$ = zeniAPI
|
|
33
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/otp/send`, queryPayload)
|
|
34
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
35
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
36
|
+
const updateActions = [
|
|
37
|
+
(0, twoFactorAuthenticationReducer_1.sendOtpSuccess)({ otpChallenge: response.data.otp_challenge }),
|
|
38
|
+
];
|
|
39
|
+
switch (twoFASource) {
|
|
40
|
+
case 'SpendManagementSetup':
|
|
41
|
+
updateActions.push((0, setupViewReducer_1.sendOtpSuccessSpendManagementSetUp)({
|
|
42
|
+
otpChallenge: response.data.otp_challenge,
|
|
43
|
+
}));
|
|
44
|
+
break;
|
|
45
|
+
case 'BillPayVendor':
|
|
46
|
+
updateActions.push((0, vendorViewReducer_1.sendOtpVendorViewSuccess)({
|
|
47
|
+
otpChallenge: response.data.otp_challenge,
|
|
48
|
+
}));
|
|
49
|
+
break;
|
|
50
|
+
case 'CustomerOnboarding':
|
|
51
|
+
updateActions.push((0, onboardingCustomerViewReducer_1.sendOnboardingOfficerOtpSuccess)({
|
|
52
|
+
otpChallenge: response.data.otp_challenge,
|
|
53
|
+
}));
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
return (0, rxjs_1.from)(updateActions);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const updateActions = [
|
|
60
|
+
(0, twoFactorAuthenticationReducer_1.sendOtpFailure)(response.status),
|
|
61
|
+
];
|
|
62
|
+
switch (twoFASource) {
|
|
63
|
+
case 'SpendManagementSetup':
|
|
64
|
+
updateActions.push((0, setupViewReducer_1.sendOtpFailureSpendManagementSetUp)(response.status));
|
|
65
|
+
break;
|
|
66
|
+
case 'BillPayVendor':
|
|
67
|
+
updateActions.push((0, vendorViewReducer_1.sendOtpVendorViewFailure)(response.status));
|
|
68
|
+
break;
|
|
69
|
+
case 'CustomerOnboarding':
|
|
70
|
+
updateActions.push((0, onboardingCustomerViewReducer_1.sendOnboardingOfficerOtpFailure)(response.status));
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
return (0, rxjs_1.from)(updateActions);
|
|
74
|
+
}
|
|
75
|
+
}), (0, operators_1.catchError)((error) => {
|
|
76
|
+
const zeniAPIStatus = (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Send otp api errored out' + JSON.stringify(error));
|
|
77
|
+
const updateActions = [(0, twoFactorAuthenticationReducer_1.sendOtpFailure)(zeniAPIStatus)];
|
|
78
|
+
switch (twoFASource) {
|
|
79
|
+
case 'SpendManagementSetup':
|
|
80
|
+
updateActions.push((0, setupViewReducer_1.sendOtpFailureSpendManagementSetUp)(zeniAPIStatus));
|
|
81
|
+
break;
|
|
82
|
+
case 'BillPayVendor':
|
|
83
|
+
updateActions.push((0, vendorViewReducer_1.sendOtpVendorViewFailure)(zeniAPIStatus));
|
|
84
|
+
break;
|
|
85
|
+
case 'CustomerOnboarding':
|
|
86
|
+
updateActions.push((0, onboardingCustomerViewReducer_1.sendOnboardingOfficerOtpFailure)(zeniAPIStatus));
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
return (0, rxjs_1.from)(updateActions);
|
|
90
|
+
}));
|
|
91
|
+
return (0, rxjs_1.concat)((0, rxjs_1.from)(sendOtpActions), setOtp$);
|
|
92
|
+
}));
|
|
93
|
+
exports.sendOtpEpic = sendOtpEpic;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
2
|
+
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
+
export interface TwoFactorAuthenticationState {
|
|
4
|
+
sendOtpStatus: FetchStateAndError;
|
|
5
|
+
otpVerificationStatus: FetchStateAndError;
|
|
6
|
+
customerToken?: CustomerToken;
|
|
7
|
+
phone?: string;
|
|
8
|
+
otpChallenge?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare type TwoFASourceView = 'BillPayVendor' | 'ChargeCard' | 'SpendManagementSetup' | 'CustomerOnboarding';
|
|
11
|
+
export interface CustomerToken {
|
|
12
|
+
provider: string;
|
|
13
|
+
token: string;
|
|
14
|
+
expiry: ZeniDate;
|
|
15
|
+
message: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ZeniAPIResponse } from '../../responsePayload';
|
|
2
|
+
import { CustomerToken } from './twoFactorAuthentication';
|
|
3
|
+
export interface SendOtpPayload {
|
|
4
|
+
otp_challenge: string;
|
|
5
|
+
}
|
|
6
|
+
export declare type SendOtpResponse = ZeniAPIResponse<SendOtpPayload>;
|
|
7
|
+
export interface VerifyOtpPayload {
|
|
8
|
+
is_verified: boolean;
|
|
9
|
+
message: string;
|
|
10
|
+
customer_token_info?: CustomerTokenPayload;
|
|
11
|
+
}
|
|
12
|
+
export interface CustomerTokenPayload {
|
|
13
|
+
customer_token_provider: string;
|
|
14
|
+
customer_token: string;
|
|
15
|
+
customer_token_expiration_time: string;
|
|
16
|
+
message: string;
|
|
17
|
+
}
|
|
18
|
+
export declare type VerifyOtpResponse = ZeniAPIResponse<VerifyOtpPayload>;
|
|
19
|
+
export declare const toCustomerToken: (payload: CustomerTokenPayload) => CustomerToken;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toCustomerToken = void 0;
|
|
4
|
+
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
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
|
+
message: payload.message,
|
|
10
|
+
});
|
|
11
|
+
exports.toCustomerToken = toCustomerToken;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TwoFactorAuthenticationState, TwoFASourceView } from './twoFactorAuthentication';
|
|
2
|
+
import { ZeniAPIStatus } from '../../responsePayload';
|
|
3
|
+
import { CustomerTokenPayload } from './twoFactorAuthenticationPayload';
|
|
4
|
+
export declare const initialState: TwoFactorAuthenticationState;
|
|
5
|
+
export declare const sendOtp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[phoneNumber: string, twoFASource: TwoFASourceView], {
|
|
6
|
+
phoneNumber: string;
|
|
7
|
+
twoFASource: TwoFASourceView;
|
|
8
|
+
}, string, never, never>, resendOtp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[otpChallenge: string, twoFASource: TwoFASourceView], {
|
|
9
|
+
otpChallenge: string;
|
|
10
|
+
twoFASource: TwoFASourceView;
|
|
11
|
+
}, string, never, never>, sendOtpSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
12
|
+
otpChallenge: string;
|
|
13
|
+
}, string>, sendOtpFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, verifyOtp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[otpCode: string, otpChallenge: string, twoFASource: TwoFASourceView], {
|
|
14
|
+
otpCode: string;
|
|
15
|
+
otpChallenge: string;
|
|
16
|
+
twoFASource: TwoFASourceView;
|
|
17
|
+
}, string, never, never>, verifyOtpSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
18
|
+
customerTokenPayload: CustomerTokenPayload | undefined;
|
|
19
|
+
}, string>, verifyOtpFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, clearTwoFactorAuthentication: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
20
|
+
declare const _default: import("@reduxjs/toolkit").Reducer<TwoFactorAuthenticationState, import("@reduxjs/toolkit").AnyAction>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.clearTwoFactorAuthentication = exports.verifyOtpFailure = exports.verifyOtpSuccess = exports.verifyOtp = exports.sendOtpFailure = exports.sendOtpSuccess = exports.resendOtp = exports.sendOtp = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const twoFactorAuthenticationPayload_1 = require("./twoFactorAuthenticationPayload");
|
|
7
|
+
exports.initialState = {
|
|
8
|
+
sendOtpStatus: {
|
|
9
|
+
fetchState: 'Not-Started',
|
|
10
|
+
error: undefined,
|
|
11
|
+
},
|
|
12
|
+
otpVerificationStatus: {
|
|
13
|
+
fetchState: 'Not-Started',
|
|
14
|
+
error: undefined,
|
|
15
|
+
},
|
|
16
|
+
customerToken: undefined,
|
|
17
|
+
phone: undefined,
|
|
18
|
+
otpChallenge: undefined,
|
|
19
|
+
};
|
|
20
|
+
const twoFactorAuthentication = (0, toolkit_1.createSlice)({
|
|
21
|
+
name: 'twoFactorAuthentication',
|
|
22
|
+
initialState: exports.initialState,
|
|
23
|
+
reducers: {
|
|
24
|
+
sendOtp: {
|
|
25
|
+
reducer(draft, action) {
|
|
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
|
+
};
|
|
35
|
+
},
|
|
36
|
+
prepare(phoneNumber, twoFASource) {
|
|
37
|
+
return { payload: { phoneNumber, twoFASource } };
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
resendOtp: {
|
|
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
|
+
};
|
|
50
|
+
},
|
|
51
|
+
prepare(otpChallenge, twoFASource) {
|
|
52
|
+
return { payload: { otpChallenge, twoFASource } };
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
sendOtpSuccess(draft, action) {
|
|
56
|
+
draft.otpChallenge = action.payload.otpChallenge;
|
|
57
|
+
draft.sendOtpStatus = {
|
|
58
|
+
fetchState: 'Completed',
|
|
59
|
+
error: undefined,
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
sendOtpFailure(draft, action) {
|
|
63
|
+
draft.sendOtpStatus = {
|
|
64
|
+
fetchState: 'Error',
|
|
65
|
+
error: action.payload,
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
verifyOtp: {
|
|
69
|
+
reducer(draft) {
|
|
70
|
+
draft.otpVerificationStatus = {
|
|
71
|
+
fetchState: 'In-Progress',
|
|
72
|
+
error: undefined,
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
prepare(otpCode, otpChallenge, twoFASource) {
|
|
76
|
+
return { payload: { otpCode, otpChallenge, twoFASource } };
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
verifyOtpSuccess(draft, action) {
|
|
80
|
+
const { customerTokenPayload } = action.payload;
|
|
81
|
+
if (customerTokenPayload != null) {
|
|
82
|
+
draft.customerToken = (0, twoFactorAuthenticationPayload_1.toCustomerToken)(customerTokenPayload);
|
|
83
|
+
}
|
|
84
|
+
draft.otpVerificationStatus = {
|
|
85
|
+
fetchState: 'Completed',
|
|
86
|
+
error: undefined,
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
verifyOtpFailure(draft, action) {
|
|
90
|
+
draft.otpVerificationStatus = {
|
|
91
|
+
fetchState: 'Error',
|
|
92
|
+
error: action.payload,
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
clearTwoFactorAuthentication(draft) {
|
|
96
|
+
Object.assign(draft, exports.initialState);
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
_a = twoFactorAuthentication.actions, exports.sendOtp = _a.sendOtp, exports.resendOtp = _a.resendOtp, exports.sendOtpSuccess = _a.sendOtpSuccess, exports.sendOtpFailure = _a.sendOtpFailure, exports.verifyOtp = _a.verifyOtp, exports.verifyOtpSuccess = _a.verifyOtpSuccess, exports.verifyOtpFailure = _a.verifyOtpFailure, exports.clearTwoFactorAuthentication = _a.clearTwoFactorAuthentication;
|
|
101
|
+
exports.default = twoFactorAuthentication.reducer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../zeniAPI';
|
|
5
|
+
import { verifyOtp, verifyOtpSuccess, verifyOtpFailure } from './twoFactorAuthenticationReducer';
|
|
6
|
+
import { verifyOtpFailureSpendManagementSetUp, verifyOtpSpendManagementSetUp, verifyOtpSuccessSpendManagementSetUp } from '../spendManagement/commonSetup/setupViewReducer';
|
|
7
|
+
import { verifyOtpVendorView, verifyOtpVendorViewFailure, verifyOtpVendorViewSuccess } from '../commonVendorView/vendorView/vendorViewReducer';
|
|
8
|
+
import { verifyOnboardingOfficerOtp, verifyOnboardingOfficerOtpSuccess, verifyOnboardingOfficerOtpFailure } from '../onboardingView/customerView/onboardingCustomerViewReducer';
|
|
9
|
+
export declare 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>;
|
|
10
|
+
export declare const verifyOtpEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyOtpEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../responsePayload");
|
|
7
|
+
const twoFactorAuthenticationReducer_1 = require("./twoFactorAuthenticationReducer");
|
|
8
|
+
const setupViewReducer_1 = require("../spendManagement/commonSetup/setupViewReducer");
|
|
9
|
+
const vendorViewReducer_1 = require("../commonVendorView/vendorView/vendorViewReducer");
|
|
10
|
+
const onboardingCustomerViewReducer_1 = require("../onboardingView/customerView/onboardingCustomerViewReducer");
|
|
11
|
+
const verifyOtpEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(twoFactorAuthenticationReducer_1.verifyOtp.match), (0, operators_1.mergeMap)((action) => {
|
|
12
|
+
const verifyOtpActions = [];
|
|
13
|
+
const { otpCode, otpChallenge, twoFASource } = action.payload;
|
|
14
|
+
const payload = {
|
|
15
|
+
otp_code: otpCode,
|
|
16
|
+
otp_challenge: otpChallenge,
|
|
17
|
+
};
|
|
18
|
+
switch (twoFASource) {
|
|
19
|
+
case 'SpendManagementSetup':
|
|
20
|
+
verifyOtpActions.push((0, setupViewReducer_1.verifyOtpSpendManagementSetUp)());
|
|
21
|
+
break;
|
|
22
|
+
case 'BillPayVendor':
|
|
23
|
+
verifyOtpActions.push((0, vendorViewReducer_1.verifyOtpVendorView)());
|
|
24
|
+
break;
|
|
25
|
+
case 'CustomerOnboarding':
|
|
26
|
+
verifyOtpActions.push((0, onboardingCustomerViewReducer_1.verifyOnboardingOfficerOtp)());
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
const verifyOtp$ = zeniAPI
|
|
30
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/otp/verify`, payload)
|
|
31
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
32
|
+
if ((0, responsePayload_1.isSuccessStatus)(response) &&
|
|
33
|
+
response.data != null &&
|
|
34
|
+
response.data.is_verified === true) {
|
|
35
|
+
const updateActions = [
|
|
36
|
+
(0, twoFactorAuthenticationReducer_1.verifyOtpSuccess)({
|
|
37
|
+
customerTokenPayload: response.data.customer_token_info,
|
|
38
|
+
}),
|
|
39
|
+
];
|
|
40
|
+
switch (twoFASource) {
|
|
41
|
+
case 'SpendManagementSetup':
|
|
42
|
+
updateActions.push((0, setupViewReducer_1.verifyOtpSuccessSpendManagementSetUp)());
|
|
43
|
+
break;
|
|
44
|
+
case 'BillPayVendor':
|
|
45
|
+
updateActions.push((0, vendorViewReducer_1.verifyOtpVendorViewSuccess)());
|
|
46
|
+
break;
|
|
47
|
+
case 'CustomerOnboarding':
|
|
48
|
+
updateActions.push((0, onboardingCustomerViewReducer_1.verifyOnboardingOfficerOtpSuccess)());
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
return (0, rxjs_1.from)(updateActions);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const updateActions = [
|
|
55
|
+
(0, twoFactorAuthenticationReducer_1.verifyOtpFailure)(response.status),
|
|
56
|
+
];
|
|
57
|
+
switch (twoFASource) {
|
|
58
|
+
case 'SpendManagementSetup':
|
|
59
|
+
updateActions.push((0, setupViewReducer_1.verifyOtpFailureSpendManagementSetUp)(response.status));
|
|
60
|
+
break;
|
|
61
|
+
case 'BillPayVendor':
|
|
62
|
+
updateActions.push((0, vendorViewReducer_1.verifyOtpVendorViewFailure)(response.status));
|
|
63
|
+
break;
|
|
64
|
+
case 'CustomerOnboarding':
|
|
65
|
+
updateActions.push((0, onboardingCustomerViewReducer_1.verifyOnboardingOfficerOtpFailure)(response.status));
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
return (0, rxjs_1.from)(updateActions);
|
|
69
|
+
}
|
|
70
|
+
}), (0, operators_1.catchError)((error) => {
|
|
71
|
+
const zeniAPIStatus = (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Verify otp api errored out' + JSON.stringify(error));
|
|
72
|
+
const updateActions = [
|
|
73
|
+
(0, twoFactorAuthenticationReducer_1.verifyOtpFailure)(zeniAPIStatus),
|
|
74
|
+
];
|
|
75
|
+
switch (twoFASource) {
|
|
76
|
+
case 'SpendManagementSetup':
|
|
77
|
+
updateActions.push((0, setupViewReducer_1.verifyOtpFailureSpendManagementSetUp)(zeniAPIStatus));
|
|
78
|
+
break;
|
|
79
|
+
case 'BillPayVendor':
|
|
80
|
+
updateActions.push((0, vendorViewReducer_1.verifyOtpVendorViewFailure)(zeniAPIStatus));
|
|
81
|
+
break;
|
|
82
|
+
case 'CustomerOnboarding':
|
|
83
|
+
updateActions.push((0, onboardingCustomerViewReducer_1.verifyOnboardingOfficerOtpFailure)(zeniAPIStatus));
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
return (0, rxjs_1.from)(updateActions);
|
|
87
|
+
}));
|
|
88
|
+
return (0, rxjs_1.concat)((0, rxjs_1.from)(verifyOtpActions), verifyOtp$);
|
|
89
|
+
}));
|
|
90
|
+
exports.verifyOtpEpic = verifyOtpEpic;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.76",
|
|
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",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"homepage": "https://github.com/zeni-ai/client-epic-state#readme",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/chai": "^4.2.11",
|
|
29
|
-
"@types/jest": "^
|
|
29
|
+
"@types/jest": "^29.4.0",
|
|
30
30
|
"@types/lodash": "^4.14.178",
|
|
31
31
|
"@types/node": "^17.0.34",
|
|
32
32
|
"@types/url-parse": "^1.4.8",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"concurrently": "^6.3.0",
|
|
38
38
|
"eslint": "^7.9.0",
|
|
39
39
|
"eslint-config-prettier": "^8.3.0",
|
|
40
|
-
"jest": "^
|
|
40
|
+
"jest": "^29.4.3",
|
|
41
41
|
"prettier": "^2.3.2",
|
|
42
42
|
"rimraf": "^3.0.2",
|
|
43
|
-
"ts-jest": "^
|
|
43
|
+
"ts-jest": "^29.0.5",
|
|
44
44
|
"ts-prune": "^0.10.3",
|
|
45
45
|
"ts-unused-exports": "^10.0.1",
|
|
46
46
|
"typescript": "^4.6.2"
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@reduxjs/toolkit": "^1.6.2",
|
|
50
50
|
"cross-fetch": "^3.1.2",
|
|
51
|
+
"date-holidays": "^3.23.8",
|
|
51
52
|
"dayjs": "^1.10.7",
|
|
52
53
|
"dayjs-business-time": "^1.0.4",
|
|
53
54
|
"js-base64": "^3.6.0",
|
package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewResendOtpEpic.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../../reducer';
|
|
4
|
-
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
5
|
-
import { resendOtp, sendOtpSuccess, sendOtpFailure } from '../../vendorViewReducer';
|
|
6
|
-
export declare type ActionType = ReturnType<typeof resendOtp> | ReturnType<typeof sendOtpSuccess> | ReturnType<typeof sendOtpFailure>;
|
|
7
|
-
export declare const vendorViewResendOtpEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.vendorViewResendOtpEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../../../responsePayload");
|
|
7
|
-
const vendorViewReducer_1 = require("../../vendorViewReducer");
|
|
8
|
-
const vendorViewResendOtpEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(vendorViewReducer_1.resendOtp.match), (0, operators_1.mergeMap)((action) => {
|
|
9
|
-
const payload = {
|
|
10
|
-
otp_challenge: action.payload.otpChallenge,
|
|
11
|
-
};
|
|
12
|
-
return zeniAPI
|
|
13
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/otp/resend`, payload)
|
|
14
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
16
|
-
return (0, rxjs_1.of)((0, vendorViewReducer_1.sendOtpSuccess)(response.data.otp_challenge));
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
return (0, rxjs_1.of)((0, vendorViewReducer_1.sendOtpFailure)(response.status));
|
|
20
|
-
}
|
|
21
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, vendorViewReducer_1.sendOtpFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Vendor view resend otp api errored out' +
|
|
22
|
-
JSON.stringify(error))))));
|
|
23
|
-
}));
|
|
24
|
-
exports.vendorViewResendOtpEpic = vendorViewResendOtpEpic;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../../reducer';
|
|
4
|
-
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
5
|
-
import { sendOtp, sendOtpSuccess, sendOtpFailure } from '../../vendorViewReducer';
|
|
6
|
-
export declare type ActionType = ReturnType<typeof sendOtp> | ReturnType<typeof sendOtpSuccess> | ReturnType<typeof sendOtpFailure>;
|
|
7
|
-
export declare const vendorViewSendOtpEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.vendorViewSendOtpEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../../../responsePayload");
|
|
7
|
-
const vendorViewReducer_1 = require("../../vendorViewReducer");
|
|
8
|
-
const vendorViewSendOtpEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(vendorViewReducer_1.sendOtp.match), (0, operators_1.mergeMap)((action) => {
|
|
9
|
-
const payload = {
|
|
10
|
-
channel_type: 'phone',
|
|
11
|
-
channel_info: {
|
|
12
|
-
phone_number: action.payload.phoneNumber,
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
return zeniAPI
|
|
16
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/otp/send`, payload)
|
|
17
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
18
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
19
|
-
return (0, rxjs_1.of)((0, vendorViewReducer_1.sendOtpSuccess)(response.data.otp_challenge));
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return (0, rxjs_1.of)((0, vendorViewReducer_1.sendOtpFailure)(response.status));
|
|
23
|
-
}
|
|
24
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, vendorViewReducer_1.sendOtpFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Vendor view send otp api errored out' + JSON.stringify(error))))));
|
|
25
|
-
}));
|
|
26
|
-
exports.vendorViewSendOtpEpic = vendorViewSendOtpEpic;
|
package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewVerifyOtpEpic.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../../reducer';
|
|
4
|
-
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
5
|
-
import { verifyOtp, verifyOtpSuccess, verifyOtpFailure } from '../../vendorViewReducer';
|
|
6
|
-
export declare type ActionType = ReturnType<typeof verifyOtp> | ReturnType<typeof verifyOtpSuccess> | ReturnType<typeof verifyOtpFailure>;
|
|
7
|
-
export declare const vendorViewVerifyOtpEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.vendorViewVerifyOtpEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../../../responsePayload");
|
|
7
|
-
const vendorViewReducer_1 = require("../../vendorViewReducer");
|
|
8
|
-
const vendorViewVerifyOtpEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(vendorViewReducer_1.verifyOtp.match), (0, operators_1.mergeMap)((action) => {
|
|
9
|
-
const payload = {
|
|
10
|
-
otp_code: action.payload.otpCode,
|
|
11
|
-
otp_challenge: action.payload.otpChallenge,
|
|
12
|
-
};
|
|
13
|
-
return zeniAPI
|
|
14
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/otp/verify`, payload)
|
|
15
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) &&
|
|
17
|
-
response.data != null &&
|
|
18
|
-
response.data.is_verified === true) {
|
|
19
|
-
const actions = [(0, vendorViewReducer_1.verifyOtpSuccess)()];
|
|
20
|
-
return (0, rxjs_1.from)(actions);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
return (0, rxjs_1.of)((0, vendorViewReducer_1.verifyOtpFailure)(response.status));
|
|
24
|
-
}
|
|
25
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, vendorViewReducer_1.verifyOtpFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Vendor view verify otp api errored out' +
|
|
26
|
-
JSON.stringify(error))))));
|
|
27
|
-
}));
|
|
28
|
-
exports.vendorViewVerifyOtpEpic = vendorViewVerifyOtpEpic;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../../reducer';
|
|
4
|
-
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
5
|
-
import { resendOnboardingOfficerOtp, sendOnboardingOfficerOtpSuccess, sendOnboardingOfficerOtpFailure } from '../../onboardingCustomerViewReducer';
|
|
6
|
-
export declare type ActionType = ReturnType<typeof resendOnboardingOfficerOtp> | ReturnType<typeof sendOnboardingOfficerOtpSuccess> | ReturnType<typeof sendOnboardingOfficerOtpFailure>;
|
|
7
|
-
export declare const resendOnboardingOfficerOtpEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resendOnboardingOfficerOtpEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../../../responsePayload");
|
|
7
|
-
const onboardingCustomerViewReducer_1 = require("../../onboardingCustomerViewReducer");
|
|
8
|
-
const resendOnboardingOfficerOtpEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(onboardingCustomerViewReducer_1.resendOnboardingOfficerOtp.match), (0, operators_1.mergeMap)((action) => {
|
|
9
|
-
const payload = {
|
|
10
|
-
otp_challenge: action.payload.otpChallenge,
|
|
11
|
-
};
|
|
12
|
-
return zeniAPI
|
|
13
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/otp/resend`, payload)
|
|
14
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
16
|
-
return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.sendOnboardingOfficerOtpSuccess)(response.data.otp_challenge));
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.sendOnboardingOfficerOtpFailure)(response.status));
|
|
20
|
-
}
|
|
21
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.sendOnboardingOfficerOtpFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Resend onboarding officer otp api errored out' +
|
|
22
|
-
JSON.stringify(error))))));
|
|
23
|
-
}));
|
|
24
|
-
exports.resendOnboardingOfficerOtpEpic = resendOnboardingOfficerOtpEpic;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../../reducer';
|
|
4
|
-
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
5
|
-
import { sendOnboardingOfficerOtp, sendOnboardingOfficerOtpSuccess, sendOnboardingOfficerOtpFailure } from '../../onboardingCustomerViewReducer';
|
|
6
|
-
export declare type ActionType = ReturnType<typeof sendOnboardingOfficerOtp> | ReturnType<typeof sendOnboardingOfficerOtpSuccess> | ReturnType<typeof sendOnboardingOfficerOtpFailure>;
|
|
7
|
-
export declare const sendOnboardingOfficerOtpEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendOnboardingOfficerOtpEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../../../responsePayload");
|
|
7
|
-
const onboardingCustomerViewReducer_1 = require("../../onboardingCustomerViewReducer");
|
|
8
|
-
const sendOnboardingOfficerOtpEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(onboardingCustomerViewReducer_1.sendOnboardingOfficerOtp.match), (0, operators_1.mergeMap)((action) => {
|
|
9
|
-
const payload = {
|
|
10
|
-
channel_type: 'phone',
|
|
11
|
-
channel_info: {
|
|
12
|
-
phone_number: action.payload.phoneNumber,
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
return zeniAPI
|
|
16
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/otp/send`, payload)
|
|
17
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
18
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
19
|
-
return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.sendOnboardingOfficerOtpSuccess)(response.data.otp_challenge));
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.sendOnboardingOfficerOtpFailure)(response.status));
|
|
23
|
-
}
|
|
24
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.sendOnboardingOfficerOtpFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Send onboarding officer otp api errored out' +
|
|
25
|
-
JSON.stringify(error))))));
|
|
26
|
-
}));
|
|
27
|
-
exports.sendOnboardingOfficerOtpEpic = sendOnboardingOfficerOtpEpic;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../../reducer';
|
|
4
|
-
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
5
|
-
import { verifyOnboardingOfficerOtp, verifyOnboardingOfficerOtpSuccess, verifyOnboardingOfficerOtpFailure } from '../../onboardingCustomerViewReducer';
|
|
6
|
-
export declare type ActionType = ReturnType<typeof verifyOnboardingOfficerOtp> | ReturnType<typeof verifyOnboardingOfficerOtpSuccess> | ReturnType<typeof verifyOnboardingOfficerOtpFailure>;
|
|
7
|
-
export declare const verifyOnboardingOfficerOtpEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verifyOnboardingOfficerOtpEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../../../responsePayload");
|
|
7
|
-
const onboardingCustomerViewReducer_1 = require("../../onboardingCustomerViewReducer");
|
|
8
|
-
const verifyOnboardingOfficerOtpEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(onboardingCustomerViewReducer_1.verifyOnboardingOfficerOtp.match), (0, operators_1.mergeMap)((action) => {
|
|
9
|
-
const payload = {
|
|
10
|
-
otp_code: action.payload.otpCode,
|
|
11
|
-
otp_challenge: action.payload.otpChallenge,
|
|
12
|
-
};
|
|
13
|
-
return zeniAPI
|
|
14
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/otp/verify`, payload)
|
|
15
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) &&
|
|
17
|
-
response.data != null &&
|
|
18
|
-
response.data.is_verified === true) {
|
|
19
|
-
const actions = [
|
|
20
|
-
(0, onboardingCustomerViewReducer_1.verifyOnboardingOfficerOtpSuccess)(),
|
|
21
|
-
];
|
|
22
|
-
return (0, rxjs_1.from)(actions);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.verifyOnboardingOfficerOtpFailure)(response.status));
|
|
26
|
-
}
|
|
27
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.verifyOnboardingOfficerOtpFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Verify onboarding officer otp api errored out' +
|
|
28
|
-
JSON.stringify(error))))));
|
|
29
|
-
}));
|
|
30
|
-
exports.verifyOnboardingOfficerOtpEpic = verifyOnboardingOfficerOtpEpic;
|