@tap-payments/auth-jsconnect 2.0.42-test → 2.0.42
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/build/@types/app.d.ts +50 -20
- package/build/@types/app.js +9 -3
- package/build/@types/form.d.ts +21 -12
- package/build/api/auth.d.ts +28 -5
- package/build/api/auth.js +36 -1
- package/build/api/axios.js +2 -2
- package/build/api/brand.d.ts +2 -1
- package/build/api/brand.js +10 -1
- package/build/api/country.d.ts +3 -1
- package/build/api/country.js +3 -1
- package/build/api/data.d.ts +38 -7
- package/build/api/data.js +57 -17
- package/build/api/entity.d.ts +51 -5
- package/build/api/entity.js +39 -9
- package/build/api/firebase.d.ts +1 -1
- package/build/api/firebase.js +3 -1
- package/build/api/index.d.ts +44 -14
- package/build/api/individual.d.ts +76 -19
- package/build/api/individual.js +29 -2
- package/build/api/lead.d.ts +9 -6
- package/build/api/lead.js +8 -1
- package/build/app/rootReducer.d.ts +0 -1
- package/build/app/rootReducer.js +0 -2
- package/build/app/settings.d.ts +9 -2
- package/build/app/settings.js +22 -11
- package/build/app/store.d.ts +0 -2
- package/build/assets/locales/ar.json +258 -183
- package/build/assets/locales/en.json +190 -108
- package/build/components/AnimationFlow/AnimationFlow.d.ts +4 -1
- package/build/components/AnimationFlow/AnimationFlow.js +6 -8
- package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
- package/build/components/AnimationFlow/BottomSheet.js +4 -3
- package/build/components/AnimationFlow/Dialog.d.ts +4 -1
- package/build/components/AnimationFlow/Dialog.js +5 -3
- package/build/components/ArabicDatePicker/ArabicDatePicker.d.ts +13 -0
- package/build/components/ArabicDatePicker/ArabicDatePicker.js +94 -0
- package/build/components/ArabicDatePicker/index.d.ts +2 -0
- package/build/components/ArabicDatePicker/index.js +2 -0
- package/build/components/ArabicDatePicker/style.css +24 -0
- package/build/components/DatePicker/customStyle.css +86 -0
- package/build/components/FileInput/DragAndDrop.d.ts +10 -1
- package/build/components/FileInput/DragAndDrop.js +108 -8
- package/build/components/Lottie/Lottie.d.ts +878 -0
- package/build/components/Lottie/Lottie.js +58 -0
- package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
- package/build/components/Lottie/files/success.json +425 -0
- package/build/components/Lottie/index.d.ts +3 -0
- package/build/components/Lottie/index.js +3 -0
- package/build/components/OTPField/OTPField.d.ts +2 -1
- package/build/components/OTPField/OTPField.js +2 -2
- package/build/components/OTPTimer/OTPTimer.js +1 -1
- package/build/components/ProgressBar/CircularProgressBar.d.ts +14 -0
- package/build/components/ProgressBar/CircularProgressBar.js +48 -0
- package/build/components/ProgressBar/index.d.ts +2 -0
- package/build/components/ProgressBar/index.js +2 -0
- package/build/components/RadioLabel/RadioLabel.d.ts +2 -1
- package/build/components/RadioLabel/RadioLabel.js +2 -2
- package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +2 -6
- package/build/components/SocialMediaGroup/SocialMediaGroup.js +4 -49
- package/build/constants/api.d.ts +6 -0
- package/build/constants/api.js +14 -1
- package/build/constants/app.d.ts +5 -5
- package/build/constants/app.js +62 -32
- package/build/constants/assets.d.ts +14 -0
- package/build/constants/assets.js +16 -2
- package/build/constants/dummy.d.ts +1 -1
- package/build/constants/dummy.js +2 -2
- package/build/constants/validation.d.ts +10 -0
- package/build/constants/validation.js +11 -1
- package/build/features/app/auth/authStore.d.ts +30 -4
- package/build/features/app/auth/authStore.js +182 -20
- package/build/features/app/bank/bankStore.d.ts +16 -0
- package/build/features/app/bank/bankStore.js +88 -41
- package/build/features/app/business/businessStore.d.ts +22 -3
- package/build/features/app/business/businessStore.js +445 -296
- package/build/features/app/connect/connectStore.d.ts +34 -31
- package/build/features/app/connect/connectStore.js +427 -300
- package/build/features/app/entity/entityStore.d.ts +40 -8
- package/build/features/app/entity/entityStore.js +389 -149
- package/build/features/app/individual/individualStore.d.ts +18 -0
- package/build/features/app/individual/individualStore.js +178 -85
- package/build/features/app/password/passwordStore.d.ts +1 -7
- package/build/features/app/password/passwordStore.js +31 -20
- package/build/features/app/tax/taxStore.js +23 -16
- package/build/features/auth/Auth.d.ts +2 -1
- package/build/features/auth/Auth.js +37 -9
- package/build/features/auth/screens/NID/DOB.d.ts +7 -0
- package/build/features/auth/screens/NID/DOB.js +47 -0
- package/build/features/auth/screens/NID/IDNumber.d.ts +3 -0
- package/build/features/auth/screens/NID/IDNumber.js +64 -0
- package/build/features/auth/screens/NID/NID.d.ts +5 -0
- package/build/features/auth/screens/NID/NID.js +68 -0
- package/build/features/auth/screens/NID/TAC.d.ts +3 -0
- package/build/features/auth/screens/NID/TAC.js +87 -0
- package/build/features/auth/screens/NID/index.d.ts +3 -0
- package/build/features/auth/screens/NID/index.js +2 -0
- package/build/features/auth/screens/NID/validation.d.ts +27 -0
- package/build/features/auth/screens/NID/validation.js +19 -0
- package/build/features/auth/screens/OTP/OTP.js +8 -4
- package/build/features/auth/screens/OTP/OTPInput.js +9 -2
- package/build/features/bank/Bank.js +4 -4
- package/build/features/bank/screens/BankDetails/BankDetails.js +18 -5
- package/build/features/bank/screens/BankDetails/BankName.js +2 -1
- package/build/features/bank/screens/BankDetails/BankStatement.js +41 -8
- package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -11
- package/build/features/bank/screens/BankDetails/validation.js +2 -2
- package/build/features/bank/screens/Success/Success.js +7 -3
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
- package/build/features/business/Business.js +4 -4
- package/build/features/business/screens/Activities/Activities.js +16 -17
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +37 -1
- package/build/features/business/screens/Activities/ActivitiesList.js +51 -12
- package/build/features/business/screens/Activities/OperationStartDate.d.ts +15 -1
- package/build/features/business/screens/Activities/OperationStartDate.js +21 -2
- package/build/features/business/screens/Activities/validation.d.ts +0 -51
- package/build/features/business/screens/Activities/validation.js +0 -9
- package/build/features/business/screens/BusinessType/BusinessType.js +20 -7
- package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
- package/build/features/business/screens/BusinessType/EntityName.js +56 -0
- package/build/features/business/screens/BusinessType/LicenseCertificate.d.ts +6 -0
- package/build/features/business/screens/BusinessType/LicenseCertificate.js +76 -0
- package/build/features/business/screens/BusinessType/LicenseList.js +26 -7
- package/build/features/business/screens/BusinessType/LicenseNumber.js +12 -6
- package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
- package/build/features/business/screens/BusinessType/LicenseType.js +78 -0
- package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
- package/build/features/business/screens/BusinessType/validation.js +52 -3
- package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
- package/build/features/business/screens/CivilID/CivilID.js +67 -0
- package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
- package/build/features/business/screens/CivilID/IDNumber.js +59 -0
- package/build/features/business/screens/CivilID/index.d.ts +3 -0
- package/build/features/business/screens/CivilID/index.js +2 -0
- package/build/features/business/screens/CivilID/validation.d.ts +8 -0
- package/build/features/business/screens/CivilID/validation.js +4 -0
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +15 -2
- package/build/features/business/screens/Customers/CustomerLocations.js +32 -8
- package/build/features/business/screens/Customers/Customers.js +15 -9
- package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
- package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
- package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
- package/build/features/business/screens/IDBOD/IDBOD.js +15 -2
- package/build/features/business/screens/OTP/OTP.js +15 -2
- package/build/features/business/screens/Success/Success.js +10 -3
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -10
- package/build/features/business/screens/Verify/Verify.js +4 -4
- package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACI.js +159 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +23 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
- package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
- package/build/features/business/screens/VerifyPACI/index.js +2 -0
- package/build/features/connect/Connect.d.ts +1 -0
- package/build/features/connect/Connect.js +38 -10
- package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
- package/build/features/connect/screens/CivilID/CivilID.js +102 -0
- package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
- package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
- package/build/features/connect/screens/CivilID/index.d.ts +3 -0
- package/build/features/connect/screens/CivilID/index.js +2 -0
- package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
- package/build/features/connect/screens/CivilID/validation.js +4 -0
- package/build/features/connect/screens/Individual/Email.js +11 -3
- package/build/features/connect/screens/Individual/Individual.js +44 -28
- package/build/features/connect/screens/Merchant/BrandList.js +15 -7
- package/build/features/connect/screens/Merchant/BrandName.js +7 -4
- package/build/features/connect/screens/Merchant/Merchant.js +41 -64
- package/build/features/connect/screens/Merchant/SalesChannels.d.ts +3 -1
- package/build/features/connect/screens/Merchant/SalesChannels.js +30 -31
- package/build/features/connect/screens/Merchant/SocialMedia.d.ts +1 -4
- package/build/features/connect/screens/Merchant/SocialMedia.js +129 -109
- package/build/features/connect/screens/Merchant/TAC.js +8 -2
- package/build/features/connect/screens/Merchant/validation.d.ts +13 -123
- package/build/features/connect/screens/Merchant/validation.js +108 -173
- package/build/features/connect/screens/Mobile/Mobile.js +33 -12
- package/build/features/connect/screens/NID/NID.js +5 -1
- package/build/features/connect/screens/OTP/OTP.js +20 -6
- package/build/features/connect/screens/OTP/OTPInput.js +3 -2
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +159 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +23 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
- package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
- package/build/features/connect/screens/VerifyPACI/index.js +2 -0
- package/build/features/entity/Entity.js +6 -6
- package/build/features/entity/screens/Customers/CustomerLocations.d.ts +118 -0
- package/build/features/entity/screens/Customers/CustomerLocations.js +171 -0
- package/build/features/entity/screens/Customers/Customers.d.ts +5 -0
- package/build/features/entity/screens/Customers/Customers.js +90 -0
- package/build/features/entity/screens/Customers/ExpectedCustomers.d.ts +8 -0
- package/build/features/entity/screens/Customers/ExpectedCustomers.js +98 -0
- package/build/features/entity/screens/Customers/ExpectedSalesRange.d.ts +8 -0
- package/build/features/entity/screens/Customers/ExpectedSalesRange.js +127 -0
- package/build/features/entity/screens/Customers/RefundPolicy.d.ts +36 -0
- package/build/features/entity/screens/Customers/RefundPolicy.js +84 -0
- package/build/features/entity/screens/Customers/TransactionPolicy.d.ts +3 -0
- package/build/features/entity/screens/Customers/TransactionPolicy.js +44 -0
- package/build/features/entity/screens/Customers/index.d.ts +3 -0
- package/build/features/entity/screens/Customers/index.js +2 -0
- package/build/features/entity/screens/Customers/validation.d.ts +20 -0
- package/build/features/entity/screens/Customers/validation.js +13 -0
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +2 -1
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +25 -15
- package/build/features/entity/screens/EntityInfoConfirm/Article.d.ts +3 -0
- package/build/features/entity/screens/EntityInfoConfirm/Article.js +73 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +38 -10
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +20 -5
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +2 -1
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +34 -5
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +13 -18
- package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +75 -41
- package/build/features/entity/screens/EntityInfoConfirm/validation.js +76 -10
- package/build/features/entity/screens/Success/Success.js +7 -3
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -8
- package/build/features/entity/screens/Verify/Verify.js +18 -5
- package/build/features/featuresScreens.d.ts +0 -1
- package/build/features/featuresScreens.js +30 -7
- package/build/features/individual/Individual.js +4 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -25
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
- package/build/features/individual/screens/Success/Success.js +7 -3
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
- package/build/features/individual/screens/Verify/Verify.js +18 -5
- package/build/features/password/Password.js +4 -4
- package/build/features/password/screens/CreatePassword/CreatePassword.js +16 -3
- package/build/features/password/screens/OTP/OTP.js +15 -2
- package/build/features/password/screens/Success/Success.js +7 -3
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -12
- package/build/features/password/screens/Verify/Verify.js +16 -3
- package/build/features/shared/Background/Background.d.ts +2 -5
- package/build/features/shared/Background/Background.js +7 -3
- package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
- package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
- package/build/features/shared/Button/MobileButton.d.ts +2 -1
- package/build/features/shared/Button/MobileButton.js +2 -2
- package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
- package/build/features/shared/Dialog/CloseDialog.js +71 -0
- package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
- package/build/features/shared/Dialog/DialogContainer.js +56 -0
- package/build/features/shared/Dialog/index.d.ts +4 -0
- package/build/features/shared/Dialog/index.js +4 -0
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/features/shared/Input/Input.js +2 -2
- package/build/features/shared/SuccessScreen/SuccessScreen.js +3 -2
- package/build/features/shared/UploadFile/UploadFile.d.ts +10 -3
- package/build/features/shared/UploadFile/UploadFile.js +24 -9
- package/build/features/signIn/SignIn.js +4 -4
- package/build/features/signIn/screens/Email/Email.js +4 -2
- package/build/features/signIn/screens/Mobile/Mobile.js +5 -1
- package/build/features/signIn/screens/OTP/OTP.js +14 -1
- package/build/features/signIn/screens/Password/Password.js +15 -2
- package/build/features/tax/Tax.js +6 -6
- package/build/features/tax/screens/Success/Success.js +9 -3
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -10
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +16 -3
- package/build/features/tax/screens/Verify/Verify.js +16 -3
- package/build/hooks/index.d.ts +2 -0
- package/build/hooks/index.js +2 -0
- package/build/hooks/useAppConfig.d.ts +3 -1
- package/build/hooks/useAppConfig.js +2 -2
- package/build/hooks/useAppDispatch.d.ts +0 -1
- package/build/hooks/useErrorListener.js +0 -6
- package/build/hooks/useScreen.d.ts +3 -0
- package/build/hooks/useScreen.js +14 -0
- package/build/hooks/useSetFromDefaultValues.d.ts +2 -0
- package/build/hooks/useSetFromDefaultValues.js +24 -0
- package/build/index.css +140 -0
- package/build/index.d.ts +2 -3
- package/build/index.js +1 -4
- package/build/utils/array.d.ts +49 -1
- package/build/utils/array.js +58 -0
- package/build/utils/common.d.ts +1 -0
- package/build/utils/common.js +3 -0
- package/build/utils/device.d.ts +1 -0
- package/build/utils/device.js +13 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/build/utils/locale.js +1 -1
- package/build/utils/object.d.ts +1 -0
- package/build/utils/object.js +12 -0
- package/build/utils/string.d.ts +13 -0
- package/build/utils/string.js +71 -1
- package/build/utils/validation.d.ts +2 -0
- package/build/utils/validation.js +6 -0
- package/package.json +4 -3
- package/build/features/app/otp/otpStore.d.ts +0 -28
- package/build/features/app/otp/otpStore.js +0 -153
- package/build/features/business/screens/Activities/SalesChannels.d.ts +0 -5
- package/build/features/business/screens/Activities/SalesChannels.js +0 -112
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.d.ts +0 -5
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +0 -112
- package/build/features/otp/OTP.d.ts +0 -7
- package/build/features/otp/OTP.js +0 -58
- package/build/features/otp/index.d.ts +0 -0
- package/build/features/otp/index.js +0 -1
- package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +0 -6
- package/build/features/otp/screens/OTPVerify/OTPInput.js +0 -47
- package/build/features/otp/screens/OTPVerify/Verify.d.ts +0 -5
- package/build/features/otp/screens/OTPVerify/Verify.js +0 -49
- package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
- package/build/features/otp/screens/OTPVerify/index.js +0 -2
- package/build/features/otp/screens/OTPVerify/validation.d.ts +0 -8
- package/build/features/otp/screens/OTPVerify/validation.js +0 -4
|
@@ -36,32 +36,139 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
};
|
|
37
37
|
var _a;
|
|
38
38
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
import { handleNextScreenStep, handleOpen } from '../../../app/settings';
|
|
40
|
+
import API from '../../../api';
|
|
41
|
+
import { getEighteenYearsAgo } from '../../../utils';
|
|
42
|
+
import { IDENTIFICATION_TYPE } from '../../../constants';
|
|
43
|
+
export var retrieveLead = createAsyncThunk('retrieveLeadAuthKit', function (leadId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
44
|
+
var data;
|
|
45
|
+
return __generator(this, function (_a) {
|
|
46
|
+
switch (_a.label) {
|
|
47
|
+
case 0: return [4, API.leadService.retrieveLeadIdentity(leadId)];
|
|
48
|
+
case 1:
|
|
49
|
+
data = _a.sent();
|
|
50
|
+
return [2, data];
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}); });
|
|
54
|
+
export var verifyAuthOTP = createAsyncThunk('verifyAuthOTPKit', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
+
var _a, settings, auth, _b, postUrl, verifyToken, device_token, leadId, service_name, payload, data;
|
|
56
|
+
var _c, _d, _e, _f;
|
|
57
|
+
return __generator(this, function (_g) {
|
|
58
|
+
switch (_g.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
_a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
|
|
61
|
+
_b = auth.data, postUrl = _b.postUrl, verifyToken = _b.verifyToken, device_token = _b.device_token, leadId = _b.leadId, service_name = _b.service_name;
|
|
62
|
+
payload = {
|
|
63
|
+
auth_token: verifyToken,
|
|
64
|
+
lead_id: leadId,
|
|
65
|
+
data: params.otp,
|
|
66
|
+
post_url: postUrl,
|
|
67
|
+
auth_type: 2,
|
|
68
|
+
device_token: device_token || '',
|
|
69
|
+
service_name: service_name || 'ABSHER',
|
|
70
|
+
sign_in: false,
|
|
71
|
+
scopes: settings.data.appConfig.scope || [],
|
|
72
|
+
terms: auth.data.termAndConditionChecked ? ['general'] : [],
|
|
73
|
+
encryption_contract: ['data']
|
|
74
|
+
};
|
|
75
|
+
return [4, API.authService.verifyAuthKitOTP(payload)];
|
|
76
|
+
case 1:
|
|
77
|
+
data = _g.sent();
|
|
78
|
+
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
79
|
+
(_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, data);
|
|
80
|
+
thunkApi.dispatch(handleOpen(false));
|
|
81
|
+
return [2, { response: data, formData: params }];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}); });
|
|
85
|
+
export var createAuth = createAsyncThunk('authCreateAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
|
+
var _a, auth, settings, _b, responseBody, leadId, nid, dob, identification_id_type, requestBody, data;
|
|
87
|
+
var _c;
|
|
88
|
+
return __generator(this, function (_d) {
|
|
89
|
+
switch (_d.label) {
|
|
44
90
|
case 0:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
91
|
+
_a = thunkApi.getState(), auth = _a.auth, settings = _a.settings;
|
|
92
|
+
_b = auth.data, responseBody = _b.responseBody, leadId = _b.leadId;
|
|
93
|
+
nid = params.nid, dob = params.dob;
|
|
94
|
+
identification_id_type = ((_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.identification) === null || _c === void 0 ? void 0 : _c.id)
|
|
95
|
+
? undefined
|
|
96
|
+
: params.nid.startsWith('1')
|
|
97
|
+
? IDENTIFICATION_TYPE.NID
|
|
98
|
+
: IDENTIFICATION_TYPE.IQAMA;
|
|
99
|
+
requestBody = {
|
|
100
|
+
lang: settings.data.language,
|
|
101
|
+
lead_id: leadId,
|
|
102
|
+
user_credentail: {
|
|
103
|
+
identification_id: nid,
|
|
104
|
+
identification_id_type: identification_id_type,
|
|
105
|
+
date_of_birth: !(responseBody === null || responseBody === void 0 ? void 0 : responseBody.date_of_birth) ? dob : undefined
|
|
106
|
+
},
|
|
107
|
+
sign_in: false,
|
|
108
|
+
is_lead: false,
|
|
109
|
+
encryption_contract: [
|
|
110
|
+
'user_credentail.identification_id',
|
|
111
|
+
'user_credentail.identification_id_type',
|
|
112
|
+
'user_credentail.date_of_birth'
|
|
113
|
+
]
|
|
114
|
+
};
|
|
115
|
+
return [4, API.authService.createAuthKitNID(requestBody)];
|
|
51
116
|
case 1:
|
|
52
|
-
|
|
53
|
-
(
|
|
54
|
-
|
|
55
|
-
|
|
117
|
+
data = _d.sent();
|
|
118
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
119
|
+
return [2, { data: data, formData: params }];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}); });
|
|
123
|
+
export var resendOTP = createAsyncThunk('authResendOTP', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
124
|
+
var _a, auth, settings, _b, nid, dob, responseBody, leadId, identification_id_type, requestBody, data;
|
|
125
|
+
var _c;
|
|
126
|
+
return __generator(this, function (_d) {
|
|
127
|
+
switch (_d.label) {
|
|
128
|
+
case 0:
|
|
129
|
+
_a = thunkApi.getState(), auth = _a.auth, settings = _a.settings;
|
|
130
|
+
_b = auth.data, nid = _b.nid, dob = _b.dob, responseBody = _b.responseBody, leadId = _b.leadId;
|
|
131
|
+
identification_id_type = ((_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.identification) === null || _c === void 0 ? void 0 : _c.id)
|
|
132
|
+
? undefined
|
|
133
|
+
: nid.startsWith('1')
|
|
134
|
+
? IDENTIFICATION_TYPE.NID
|
|
135
|
+
: IDENTIFICATION_TYPE.IQAMA;
|
|
136
|
+
requestBody = {
|
|
137
|
+
lang: settings.data.language,
|
|
138
|
+
lead_id: leadId,
|
|
139
|
+
user_credentail: {
|
|
140
|
+
identification_id: nid,
|
|
141
|
+
identification_id_type: identification_id_type,
|
|
142
|
+
date_of_birth: !(responseBody === null || responseBody === void 0 ? void 0 : responseBody.date_of_birth) ? dob : undefined
|
|
143
|
+
},
|
|
144
|
+
sign_in: false,
|
|
145
|
+
is_lead: false,
|
|
146
|
+
encryption_contract: [
|
|
147
|
+
'user_credentail.identification_id',
|
|
148
|
+
'user_credentail.identification_id_type',
|
|
149
|
+
'user_credentail.date_of_birth'
|
|
150
|
+
]
|
|
151
|
+
};
|
|
152
|
+
return [4, API.authService.createAuthKitNID(requestBody)];
|
|
153
|
+
case 1:
|
|
154
|
+
data = _d.sent();
|
|
155
|
+
return [2, data];
|
|
56
156
|
}
|
|
57
157
|
});
|
|
58
158
|
}); });
|
|
59
159
|
var initialState = {
|
|
60
160
|
error: null,
|
|
61
161
|
loading: false,
|
|
162
|
+
customLoading: false,
|
|
62
163
|
data: {
|
|
164
|
+
verifyToken: undefined,
|
|
165
|
+
leadId: '',
|
|
166
|
+
postUrl: '',
|
|
63
167
|
otp: '',
|
|
64
|
-
|
|
168
|
+
nid: '',
|
|
169
|
+
termAndConditionChecked: false,
|
|
170
|
+
dob: getEighteenYearsAgo(),
|
|
171
|
+
countryISOCode: ''
|
|
65
172
|
}
|
|
66
173
|
};
|
|
67
174
|
export var authSlice = createSlice({
|
|
@@ -76,24 +183,79 @@ export var authSlice = createSlice({
|
|
|
76
183
|
},
|
|
77
184
|
resetOTPScreen: function (state) {
|
|
78
185
|
state.data.otp = '';
|
|
186
|
+
},
|
|
187
|
+
storeLeadId: function (state, action) {
|
|
188
|
+
var leadId = action.payload.leadId;
|
|
189
|
+
state.data.leadId = leadId;
|
|
190
|
+
},
|
|
191
|
+
storePostUrl: function (state, action) {
|
|
192
|
+
var postUrl = action.payload.postUrl;
|
|
193
|
+
state.data.postUrl = postUrl;
|
|
79
194
|
}
|
|
80
195
|
},
|
|
81
196
|
extraReducers: function (builder) {
|
|
82
197
|
builder
|
|
83
|
-
.addCase(
|
|
198
|
+
.addCase(retrieveLead.pending, function (state) {
|
|
199
|
+
state.customLoading = true;
|
|
200
|
+
state.error = null;
|
|
201
|
+
})
|
|
202
|
+
.addCase(retrieveLead.fulfilled, function (state, action) {
|
|
203
|
+
var _a;
|
|
204
|
+
state.customLoading = false;
|
|
205
|
+
state.error = null;
|
|
206
|
+
var data = action.payload;
|
|
207
|
+
state.data.nid = (_a = data === null || data === void 0 ? void 0 : data.identification) === null || _a === void 0 ? void 0 : _a.id;
|
|
208
|
+
state.data.countryISOCode = data === null || data === void 0 ? void 0 : data.country_code;
|
|
209
|
+
state.data.responseBody = data;
|
|
210
|
+
})
|
|
211
|
+
.addCase(retrieveLead.rejected, function (state, action) {
|
|
212
|
+
state.loading = false;
|
|
213
|
+
state.error = action.error.message;
|
|
214
|
+
})
|
|
215
|
+
.addCase(createAuth.pending, function (state) {
|
|
84
216
|
state.loading = true;
|
|
85
217
|
state.error = null;
|
|
86
218
|
})
|
|
87
|
-
.addCase(
|
|
219
|
+
.addCase(createAuth.fulfilled, function (state, action) {
|
|
220
|
+
state.loading = false;
|
|
221
|
+
state.error = null;
|
|
222
|
+
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
223
|
+
state.data.verifyToken = data === null || data === void 0 ? void 0 : data.auth_token;
|
|
224
|
+
state.data.dob = formData.dob;
|
|
225
|
+
state.data.nid = formData.nid;
|
|
226
|
+
state.data.termAndConditionChecked = formData.termAndConditionChecked;
|
|
227
|
+
state.data.device_token = data === null || data === void 0 ? void 0 : data.device_token;
|
|
228
|
+
state.data.service_name = data === null || data === void 0 ? void 0 : data.service_name;
|
|
229
|
+
})
|
|
230
|
+
.addCase(createAuth.rejected, function (state, action) {
|
|
88
231
|
state.loading = false;
|
|
232
|
+
state.error = action.error.message;
|
|
233
|
+
})
|
|
234
|
+
.addCase(verifyAuthOTP.pending, function (state) {
|
|
235
|
+
state.loading = true;
|
|
89
236
|
state.error = null;
|
|
90
237
|
})
|
|
91
|
-
.addCase(
|
|
238
|
+
.addCase(verifyAuthOTP.fulfilled, function (state) {
|
|
92
239
|
state.loading = false;
|
|
240
|
+
state.error = null;
|
|
241
|
+
})
|
|
242
|
+
.addCase(verifyAuthOTP.rejected, function (state, action) {
|
|
243
|
+
state.loading = false;
|
|
244
|
+
state.error = action.error.message;
|
|
245
|
+
})
|
|
246
|
+
.addCase(resendOTP.pending, function (state) {
|
|
247
|
+
state.error = null;
|
|
248
|
+
})
|
|
249
|
+
.addCase(resendOTP.fulfilled, function (state, action) {
|
|
250
|
+
state.error = null;
|
|
251
|
+
var data = action.payload;
|
|
252
|
+
state.data.verifyToken = data === null || data === void 0 ? void 0 : data.auth_token;
|
|
253
|
+
})
|
|
254
|
+
.addCase(resendOTP.rejected, function (state, action) {
|
|
93
255
|
state.error = action.error.message;
|
|
94
256
|
});
|
|
95
257
|
}
|
|
96
258
|
});
|
|
97
|
-
export var clearError = (_a = authSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
|
|
259
|
+
export var clearError = (_a = authSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, storeLeadId = _a.storeLeadId, storePostUrl = _a.storePostUrl;
|
|
98
260
|
export default authSlice.reducer;
|
|
99
261
|
export var authSelector = function (state) { return state.auth; };
|
|
@@ -4,6 +4,14 @@ import { CancelToken } from 'axios';
|
|
|
4
4
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
5
5
|
data: any;
|
|
6
6
|
boardResponse: {
|
|
7
|
+
user: any;
|
|
8
|
+
brand: any;
|
|
9
|
+
bank_account: any;
|
|
10
|
+
entity: any;
|
|
11
|
+
merchant: any;
|
|
12
|
+
name: any;
|
|
13
|
+
contact: any;
|
|
14
|
+
business: any;
|
|
7
15
|
flows: {
|
|
8
16
|
name: string;
|
|
9
17
|
status: string;
|
|
@@ -33,6 +41,13 @@ export declare const checkIbanBank: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
33
41
|
cancelToken: CancelToken;
|
|
34
42
|
onSuccess?: (() => void) | undefined;
|
|
35
43
|
}, {}>;
|
|
44
|
+
interface UploadBankStatementParams {
|
|
45
|
+
file: File;
|
|
46
|
+
onProgress?: (value: number) => void;
|
|
47
|
+
}
|
|
48
|
+
export declare const uploadBankStatement: import("@reduxjs/toolkit").AsyncThunk<{
|
|
49
|
+
data: any;
|
|
50
|
+
}, UploadBankStatementParams, {}>;
|
|
36
51
|
export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
37
52
|
response: any;
|
|
38
53
|
formData: void;
|
|
@@ -48,6 +63,7 @@ export interface BankData {
|
|
|
48
63
|
}
|
|
49
64
|
export interface BankState extends SharedState<BankData> {
|
|
50
65
|
customLoading?: boolean;
|
|
66
|
+
uploading?: boolean;
|
|
51
67
|
}
|
|
52
68
|
export declare const bankSlice: import("@reduxjs/toolkit").Slice<BankState, {
|
|
53
69
|
clearError: (state: BankState) => void;
|
|
@@ -49,13 +49,13 @@ var _a;
|
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
51
|
import { FlowsTypes } from '../../../@types';
|
|
52
|
-
import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
|
|
52
|
+
import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
53
53
|
import { BANK_STEP_NAMES, BUSINESS_FLOW_SUCCESS } from '../../../constants';
|
|
54
54
|
export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
-
var payload, data, boardInfoData, board_id, board_info_id, info, hasBankCompleted;
|
|
56
|
-
var _a;
|
|
57
|
-
return __generator(this, function (
|
|
58
|
-
switch (
|
|
55
|
+
var payload, data, boardInfoData, boardData, board_id, board_info_id, countryIso2, info, hasBankCompleted;
|
|
56
|
+
var _a, _b, _c, _d;
|
|
57
|
+
return __generator(this, function (_e) {
|
|
58
|
+
switch (_e.label) {
|
|
59
59
|
case 0:
|
|
60
60
|
payload = {
|
|
61
61
|
service_name: 'tap_email',
|
|
@@ -63,21 +63,24 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (t
|
|
|
63
63
|
};
|
|
64
64
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
65
65
|
case 1:
|
|
66
|
-
data = (
|
|
67
|
-
|
|
66
|
+
data = (_e.sent()).data;
|
|
67
|
+
boardData = undefined;
|
|
68
68
|
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
|
|
69
69
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
70
70
|
board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
|
|
71
71
|
if (!(!!board_id && !!board_info_id)) return [3, 3];
|
|
72
72
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
73
73
|
case 2:
|
|
74
|
-
boardInfoData =
|
|
75
|
-
|
|
76
|
-
case 3: return [4,
|
|
74
|
+
boardInfoData = _e.sent();
|
|
75
|
+
_e.label = 3;
|
|
76
|
+
case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
77
77
|
case 4:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
boardData = _e.sent();
|
|
79
|
+
countryIso2 = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.country;
|
|
80
|
+
if (countryIso2)
|
|
81
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
82
|
+
info = (boardInfoData || {}).info;
|
|
83
|
+
hasBankCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'bank'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
|
|
81
84
|
if (data.step_name === BANK_STEP_NAMES.PHONE_AUTH) {
|
|
82
85
|
thunkApi.dispatch(handleCurrentActiveScreen('BANK_VERIFY_STEP'));
|
|
83
86
|
}
|
|
@@ -87,8 +90,22 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (t
|
|
|
87
90
|
else if (data.step_name === BANK_STEP_NAMES.BANK_INFO) {
|
|
88
91
|
thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP'));
|
|
89
92
|
}
|
|
90
|
-
|
|
91
|
-
case 5: return [2, {
|
|
93
|
+
_e.label = 5;
|
|
94
|
+
case 5: return [2, {
|
|
95
|
+
data: data,
|
|
96
|
+
boardResponse: {
|
|
97
|
+
user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
|
|
98
|
+
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
99
|
+
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
100
|
+
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
101
|
+
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
102
|
+
name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
|
|
103
|
+
contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
|
|
104
|
+
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
105
|
+
flows: BUSINESS_FLOW_SUCCESS.concat((boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [])
|
|
106
|
+
},
|
|
107
|
+
token: token
|
|
108
|
+
}];
|
|
92
109
|
}
|
|
93
110
|
});
|
|
94
111
|
}); });
|
|
@@ -151,52 +168,39 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBankEntityInfo', fun
|
|
|
151
168
|
case 1:
|
|
152
169
|
data = _c.sent();
|
|
153
170
|
return [2, {
|
|
154
|
-
data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.
|
|
171
|
+
data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.names, business: data === null || data === void 0 ? void 0 : data.business, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
|
|
155
172
|
}];
|
|
156
173
|
}
|
|
157
174
|
});
|
|
158
175
|
}); });
|
|
159
176
|
export var createBankAccount = createAsyncThunk('createBankAccount', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
160
|
-
var _a, settings, bank, iban, beneficiaryName, bank_name,
|
|
161
|
-
var _b, _c, _d, _e, _f, _g, _h
|
|
162
|
-
return __generator(this, function (
|
|
163
|
-
switch (
|
|
177
|
+
var _a, settings, bank, iban, beneficiaryName, bank_name, requestBody, data;
|
|
178
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
179
|
+
return __generator(this, function (_j) {
|
|
180
|
+
switch (_j.label) {
|
|
164
181
|
case 0:
|
|
165
182
|
_a = thunkApi.getState(), settings = _a.settings, bank = _a.bank;
|
|
166
183
|
iban = params.iban;
|
|
167
184
|
beneficiaryName = params.beneficiaryName;
|
|
168
185
|
bank_name = params.bankName;
|
|
169
|
-
fileResponse = undefined;
|
|
170
|
-
uploadPayload = {
|
|
171
|
-
file_link_create: true,
|
|
172
|
-
title: (_b = params.bankStatementFile) === null || _b === void 0 ? void 0 : _b.name,
|
|
173
|
-
purpose: 'identity_document',
|
|
174
|
-
file: params.bankStatementFile
|
|
175
|
-
};
|
|
176
|
-
if (!params.bankStatementFile) return [3, 2];
|
|
177
|
-
return [4, API.entityService.uploadFileInfo(uploadPayload)];
|
|
178
|
-
case 1:
|
|
179
|
-
fileResponse = _k.sent();
|
|
180
|
-
_k.label = 2;
|
|
181
|
-
case 2:
|
|
182
186
|
requestBody = {
|
|
183
|
-
wallet_id: (
|
|
187
|
+
wallet_id: (_f = (_e = (_d = (_c = (_b = bank.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.entity) === null || _d === void 0 ? void 0 : _d.merchant) === null || _e === void 0 ? void 0 : _e.wallet) === null || _f === void 0 ? void 0 : _f.id,
|
|
184
188
|
bank_account: {
|
|
185
189
|
iban: iban,
|
|
186
190
|
beneficiary_name: beneficiaryName,
|
|
187
191
|
bank_name: bank_name,
|
|
188
|
-
bank_statement_file_id:
|
|
192
|
+
bank_statement_file_id: params.bankStatementFile ? bank.data.bankData.bankStatementId : undefined,
|
|
189
193
|
is_acknowledged: params.confirmPolicy
|
|
190
194
|
},
|
|
191
195
|
step_name: BANK_STEP_NAMES.BANK_INFO,
|
|
192
196
|
encryption_contract: ['bank_account.iban', 'bank_account.beneficiary_name', 'bank_account.bank_name']
|
|
193
197
|
};
|
|
194
198
|
return [4, API.entityService.createBankAccount(requestBody)];
|
|
195
|
-
case
|
|
196
|
-
data = (
|
|
199
|
+
case 1:
|
|
200
|
+
data = (_j.sent()).data;
|
|
197
201
|
if (!data.errors) {
|
|
198
202
|
thunkApi.dispatch(handleNextScreenStep());
|
|
199
|
-
(
|
|
203
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, requestBody);
|
|
200
204
|
}
|
|
201
205
|
return [2, { data: data, formData: params }];
|
|
202
206
|
}
|
|
@@ -222,6 +226,31 @@ export var checkIbanBank = createAsyncThunk('checkIbanBank', function (_a) {
|
|
|
222
226
|
});
|
|
223
227
|
});
|
|
224
228
|
});
|
|
229
|
+
export var uploadBankStatement = createAsyncThunk('uploadBankStatement', function (_a) {
|
|
230
|
+
var file = _a.file, onProgress = _a.onProgress;
|
|
231
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
232
|
+
var uploadPayload, onUploadProgress, data;
|
|
233
|
+
return __generator(this, function (_b) {
|
|
234
|
+
switch (_b.label) {
|
|
235
|
+
case 0:
|
|
236
|
+
uploadPayload = {
|
|
237
|
+
file_link_create: true,
|
|
238
|
+
title: file === null || file === void 0 ? void 0 : file.name,
|
|
239
|
+
purpose: 'identity_document',
|
|
240
|
+
file: file
|
|
241
|
+
};
|
|
242
|
+
onUploadProgress = function (progressEvent) {
|
|
243
|
+
var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
|
|
244
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
|
|
245
|
+
};
|
|
246
|
+
return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
|
|
247
|
+
case 1:
|
|
248
|
+
data = _b.sent();
|
|
249
|
+
return [2, { data: data }];
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
});
|
|
225
254
|
export var updateBoardSuccess = createAsyncThunk('updateBoardBankSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
226
255
|
var _a, settings, bank, _b, id, infoId, payload, data;
|
|
227
256
|
var _c, _d, _e, _f;
|
|
@@ -246,7 +275,7 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardBankSuccess', funct
|
|
|
246
275
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
247
276
|
(_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
|
|
248
277
|
thunkApi.dispatch(handleNextScreenStep());
|
|
249
|
-
return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat(data === null || data === void 0 ? void 0 : data.info) }), formData: params }];
|
|
278
|
+
return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat((data === null || data === void 0 ? void 0 : data.info) || []) }), formData: params }];
|
|
250
279
|
}
|
|
251
280
|
});
|
|
252
281
|
}); });
|
|
@@ -254,6 +283,7 @@ var initialState = {
|
|
|
254
283
|
error: null,
|
|
255
284
|
loading: false,
|
|
256
285
|
customLoading: false,
|
|
286
|
+
uploading: false,
|
|
257
287
|
data: {
|
|
258
288
|
flowName: FlowsTypes.BANK,
|
|
259
289
|
verify: {
|
|
@@ -292,10 +322,10 @@ export var bankSlice = createSlice({
|
|
|
292
322
|
state.customLoading = true;
|
|
293
323
|
})
|
|
294
324
|
.addCase(verifyLeadToken.fulfilled, function (state, action) {
|
|
295
|
-
var _a;
|
|
325
|
+
var _a, _b, _c, _d;
|
|
296
326
|
state.error = null;
|
|
297
327
|
state.customLoading = false;
|
|
298
|
-
var
|
|
328
|
+
var _e = action.payload, data = _e.data, token = _e.token, boardResponse = _e.boardResponse;
|
|
299
329
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
300
330
|
if (description) {
|
|
301
331
|
state.error = description;
|
|
@@ -303,6 +333,9 @@ export var bankSlice = createSlice({
|
|
|
303
333
|
}
|
|
304
334
|
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id });
|
|
305
335
|
state.data.verify.token = token;
|
|
336
|
+
state.data.bankData.bankName = ((_b = boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.bank_account) === null || _b === void 0 ? void 0 : _b.bank_name) || '';
|
|
337
|
+
state.data.bankData.beneficiaryName = ((_c = boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.bank_account) === null || _c === void 0 ? void 0 : _c.beneficiary_name) || '';
|
|
338
|
+
state.data.bankData.iban = ((_d = boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.bank_account) === null || _d === void 0 ? void 0 : _d.iban) || '';
|
|
306
339
|
})
|
|
307
340
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
308
341
|
state.error = action.error.message;
|
|
@@ -414,6 +447,20 @@ export var bankSlice = createSlice({
|
|
|
414
447
|
if (action.error.message === 'Aborted')
|
|
415
448
|
return;
|
|
416
449
|
state.error = action.error.message;
|
|
450
|
+
})
|
|
451
|
+
.addCase(uploadBankStatement.pending, function (state) {
|
|
452
|
+
state.error = null;
|
|
453
|
+
state.uploading = true;
|
|
454
|
+
})
|
|
455
|
+
.addCase(uploadBankStatement.fulfilled, function (state, action) {
|
|
456
|
+
state.error = null;
|
|
457
|
+
state.uploading = false;
|
|
458
|
+
var data = action.payload.data;
|
|
459
|
+
state.data.bankData.bankStatementId = data === null || data === void 0 ? void 0 : data.id;
|
|
460
|
+
})
|
|
461
|
+
.addCase(uploadBankStatement.rejected, function (state) {
|
|
462
|
+
state.uploading = false;
|
|
463
|
+
state.error = 'file_upload_error';
|
|
417
464
|
});
|
|
418
465
|
}
|
|
419
466
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, Activity,
|
|
2
|
+
import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, Activity, CivilFormValues } from '../../../@types';
|
|
3
3
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
4
|
data: any;
|
|
5
5
|
leadData: any;
|
|
@@ -17,7 +17,18 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
17
17
|
otp: string;
|
|
18
18
|
};
|
|
19
19
|
brandInfo: any;
|
|
20
|
+
leadData: any;
|
|
20
21
|
}, OTPFormValues, {}>;
|
|
22
|
+
interface verifyPACIParams {
|
|
23
|
+
onSuccess?: () => void | Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export declare const verifyPACI: import("@reduxjs/toolkit").AsyncThunk<{
|
|
26
|
+
response: any;
|
|
27
|
+
}, verifyPACIParams, {}>;
|
|
28
|
+
export declare const createCivilIdAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
29
|
+
response: any;
|
|
30
|
+
formData: CivilFormValues;
|
|
31
|
+
}, CivilFormValues, {}>;
|
|
21
32
|
export declare const updateLeadIdentity: import("@reduxjs/toolkit").AsyncThunk<{
|
|
22
33
|
data: any;
|
|
23
34
|
formData: {
|
|
@@ -27,7 +38,6 @@ export declare const updateLeadIdentity: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
27
38
|
};
|
|
28
39
|
}, NIDFormValues, {}>;
|
|
29
40
|
export declare const resendOTPLeadIdentity: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
|
|
30
|
-
export declare const retrieveChannels: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
|
|
31
41
|
export declare const retrieveEntityList: import("@reduxjs/toolkit").AsyncThunk<any, {
|
|
32
42
|
leadId: string;
|
|
33
43
|
}, {}>;
|
|
@@ -38,12 +48,19 @@ export declare const updateLeadBusinessType: import("@reduxjs/toolkit").AsyncThu
|
|
|
38
48
|
data: any;
|
|
39
49
|
formData: BusinessTypeFormValues;
|
|
40
50
|
accountData: any;
|
|
51
|
+
documentData: any;
|
|
41
52
|
}, BusinessTypeFormValues, {}>;
|
|
53
|
+
interface UploadLicenseCertificateParams {
|
|
54
|
+
file: File;
|
|
55
|
+
onProgress?: (value: number) => void;
|
|
56
|
+
}
|
|
57
|
+
export declare const uploadLicenseCertificate: import("@reduxjs/toolkit").AsyncThunk<{
|
|
58
|
+
data: any;
|
|
59
|
+
}, UploadLicenseCertificateParams, {}>;
|
|
42
60
|
export declare const updateActivitiesInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
43
61
|
data: any;
|
|
44
62
|
formData: {
|
|
45
63
|
activities: Activity[] | undefined;
|
|
46
|
-
salesChannels: SalesChannel[];
|
|
47
64
|
operationStartDate: string;
|
|
48
65
|
};
|
|
49
66
|
}, ActivitiesFormValues, {}>;
|
|
@@ -74,6 +91,7 @@ export interface BusinessData {
|
|
|
74
91
|
nidData: NIDFormValues & ResponseData & {
|
|
75
92
|
type: string;
|
|
76
93
|
};
|
|
94
|
+
civilIdData: CivilFormValues & ResponseData;
|
|
77
95
|
businessTypeData: BusinessTypeFormValues & ResponseData;
|
|
78
96
|
activitiesData: ActivitiesFormValues & ResponseData;
|
|
79
97
|
customersData: CustomersFormValues & ResponseData;
|
|
@@ -81,6 +99,7 @@ export interface BusinessData {
|
|
|
81
99
|
}
|
|
82
100
|
export interface BusinessState extends SharedState<BusinessData> {
|
|
83
101
|
customLoading?: boolean;
|
|
102
|
+
uploading?: boolean;
|
|
84
103
|
}
|
|
85
104
|
export declare const businessSlice: import("@reduxjs/toolkit").Slice<BusinessState, {
|
|
86
105
|
clearError: (state: BusinessState) => void;
|