@tap-payments/auth-jsconnect 2.0.32-test → 2.0.32
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 +57 -20
- package/build/@types/app.js +14 -1
- package/build/@types/form.d.ts +17 -10
- package/build/api/auth.d.ts +24 -2
- 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 +28 -5
- package/build/api/entity.js +23 -9
- package/build/api/firebase.d.ts +1 -1
- package/build/api/firebase.js +3 -1
- package/build/api/index.d.ts +41 -14
- package/build/api/individual.d.ts +76 -19
- package/build/api/individual.js +29 -2
- package/build/api/lead.d.ts +8 -6
- package/build/app/rootReducer.d.ts +1 -1
- package/build/app/rootReducer.js +2 -2
- package/build/app/settings.d.ts +8 -2
- package/build/app/settings.js +29 -12
- package/build/app/store.d.ts +3 -3
- package/build/assets/locales/ar.json +256 -179
- package/build/assets/locales/en.json +188 -104
- package/build/components/AnimationFlow/AnimationFlow.d.ts +5 -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 +5 -1
- package/build/components/AnimationFlow/Dialog.js +11 -5
- 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/FileInput/DragAndDrop.d.ts +10 -1
- package/build/components/FileInput/DragAndDrop.js +107 -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 +1 -4
- package/build/components/SocialMediaGroup/SocialMediaGroup.js +3 -55
- package/build/constants/api.d.ts +6 -0
- package/build/constants/api.js +14 -1
- package/build/constants/app.d.ts +7 -5
- package/build/constants/app.js +55 -22
- package/build/constants/assets.d.ts +20 -1
- package/build/constants/assets.js +27 -8
- package/build/constants/dummy.d.ts +1 -1
- package/build/constants/dummy.js +2 -2
- package/build/constants/validation.d.ts +8 -0
- package/build/constants/validation.js +9 -1
- package/build/features/app/auth/authStore.d.ts +47 -0
- package/build/features/app/auth/authStore.js +265 -0
- package/build/features/app/bank/bankStore.d.ts +16 -0
- package/build/features/app/bank/bankStore.js +81 -37
- package/build/features/app/business/businessStore.d.ts +22 -3
- package/build/features/app/business/businessStore.js +430 -290
- package/build/features/app/connect/connectStore.d.ts +33 -30
- package/build/features/app/connect/connectStore.js +398 -258
- package/build/features/app/entity/entityStore.d.ts +5 -0
- package/build/features/app/entity/entityStore.js +153 -14
- package/build/features/app/individual/individualStore.d.ts +17 -0
- package/build/features/app/individual/individualStore.js +167 -83
- package/build/features/app/password/passwordStore.js +1 -1
- package/build/features/app/tax/taxStore.js +3 -2
- package/build/features/auth/Auth.d.ts +10 -0
- package/build/features/auth/Auth.js +87 -0
- package/build/features/auth/index.d.ts +1 -0
- package/build/features/auth/index.js +1 -0
- 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 +67 -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.d.ts +5 -0
- package/build/features/auth/screens/OTP/OTP.js +76 -0
- package/build/features/{otp/screens/OTPVerify/Verify.d.ts → auth/screens/OTP/OTPInput.d.ts} +0 -0
- package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/OTPInput.js +11 -7
- package/build/features/auth/screens/OTP/index.d.ts +3 -0
- package/build/features/auth/screens/OTP/index.js +2 -0
- package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/validation.d.ts +0 -0
- package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/validation.js +0 -0
- package/build/features/bank/Bank.js +12 -6
- package/build/features/bank/screens/BankDetails/BankDetails.js +2 -2
- 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/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -8
- package/build/features/business/Business.d.ts +1 -1
- package/build/features/business/Business.js +14 -7
- package/build/features/business/screens/Activities/Activities.js +1 -6
- 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 +24 -7
- package/build/features/business/screens/BusinessType/LicenseNumber.js +14 -8
- package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
- package/build/features/business/screens/BusinessType/LicenseType.js +67 -0
- package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
- package/build/features/business/screens/BusinessType/validation.js +50 -1
- package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
- package/build/features/business/screens/CivilID/CivilID.js +84 -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/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/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -7
- 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 +157 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +5 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +22 -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 +2 -1
- package/build/features/connect/Connect.js +47 -12
- package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
- package/build/features/connect/screens/CivilID/CivilID.js +98 -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 +27 -14
- 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 +47 -50
- package/build/features/connect/screens/Merchant/SalesChannels.d.ts +7 -0
- package/build/features/connect/screens/Merchant/SalesChannels.js +113 -0
- package/build/features/connect/screens/Merchant/SocialMedia.d.ts +1 -4
- package/build/features/connect/screens/Merchant/SocialMedia.js +131 -66
- package/build/features/connect/screens/Merchant/TAC.js +8 -2
- package/build/features/connect/screens/Merchant/validation.d.ts +22 -45
- package/build/features/connect/screens/Merchant/validation.js +117 -116
- package/build/features/connect/screens/Mobile/Mobile.js +31 -10
- package/build/features/connect/screens/NID/NID.js +2 -1
- package/build/features/connect/screens/OTP/OTP.js +5 -4
- 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 +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +22 -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.d.ts +1 -1
- package/build/features/entity/Entity.js +16 -9
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +54 -0
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +140 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +52 -2
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +17 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +28 -0
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +6 -0
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +38 -0
- package/build/features/{business/screens/Activities → entity/screens/EntityInfoConfirm}/SalesChannels.d.ts +0 -0
- package/build/features/{business/screens/Activities → entity/screens/EntityInfoConfirm}/SalesChannels.js +8 -5
- package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +107 -0
- package/build/features/entity/screens/EntityInfoConfirm/validation.js +17 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -5
- package/build/features/featuresScreens.d.ts +1 -1
- package/build/features/featuresScreens.js +31 -6
- package/build/features/individual/Individual.d.ts +1 -1
- package/build/features/individual/Individual.js +14 -7
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -1
- 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/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -8
- package/build/features/individual/screens/Verify/Verify.js +4 -4
- package/build/features/password/Password.d.ts +1 -1
- package/build/features/password/Password.js +14 -7
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -9
- package/build/features/shared/Background/Background.d.ts +6 -5
- package/build/features/shared/Background/Background.js +16 -5
- 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 +1 -1
- package/build/features/shared/UploadFile/UploadFile.d.ts +9 -3
- package/build/features/shared/UploadFile/UploadFile.js +23 -8
- package/build/features/signIn/SignIn.d.ts +1 -1
- package/build/features/signIn/SignIn.js +14 -6
- package/build/features/tax/Tax.d.ts +1 -1
- package/build/features/tax/Tax.js +16 -8
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +11 -7
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useAppConfig.d.ts +3 -1
- package/build/hooks/useAppConfig.js +4 -2
- package/build/hooks/useAppDispatch.d.ts +1 -1
- package/build/hooks/useErrorListener.js +0 -5
- package/build/hooks/useScreen.d.ts +3 -0
- package/build/hooks/useScreen.js +14 -0
- package/build/index.d.ts +3 -3
- package/build/index.js +5 -5
- package/build/utils/array.d.ts +13 -1
- package/build/utils/array.js +26 -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/html.d.ts +1 -0
- package/build/utils/html.js +6 -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/rsa.d.ts +2 -2
- package/build/utils/rsa.js +1 -1
- package/build/utils/string.d.ts +33 -20
- 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 +129 -128
- package/build/features/app/otp/otpStore.d.ts +0 -28
- package/build/features/app/otp/otpStore.js +0 -153
- package/build/features/otp/OTP.d.ts +0 -7
- package/build/features/otp/OTP.js +0 -55
- 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/Verify.js +0 -50
- package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
- package/build/features/otp/screens/OTPVerify/index.js +0 -2
|
@@ -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 {
|
|
52
|
+
import { handleNextScreenStep } from '../../../app/settings';
|
|
53
53
|
import { BUSINESS_FLOW_SUCCESS, INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
54
54
|
export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
-
var payload, settings, data, boardData, countryCode, boardInfoData, countries, board_id, board_info_id,
|
|
56
|
-
var
|
|
57
|
-
return __generator(this, function (
|
|
58
|
-
switch (
|
|
55
|
+
var payload, settings, data, boardData, individualData, countryCode, boardInfoData, countries, board_id, board_info_id, notification, _a, id, type, info, hasIndividualCompleted;
|
|
56
|
+
var _b, _c, _d, _e;
|
|
57
|
+
return __generator(this, function (_f) {
|
|
58
|
+
switch (_f.label) {
|
|
59
59
|
case 0:
|
|
60
60
|
payload = {
|
|
61
61
|
service_name: 'tap_email',
|
|
@@ -64,49 +64,59 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
|
|
|
64
64
|
settings = thunkApi.getState().settings;
|
|
65
65
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
66
66
|
case 1:
|
|
67
|
-
data = (
|
|
67
|
+
data = (_f.sent()).data;
|
|
68
68
|
boardInfoData = undefined;
|
|
69
69
|
countries = settings.data.countries;
|
|
70
|
-
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3,
|
|
70
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 10];
|
|
71
|
+
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 10];
|
|
71
72
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
72
73
|
board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
|
|
73
|
-
if (!(
|
|
74
|
+
if (!(board_id && board_info_id)) return [3, 4];
|
|
74
75
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
75
76
|
case 2:
|
|
76
|
-
boardInfoData =
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
boardInfoData = _f.sent();
|
|
78
|
+
notification = (boardInfoData || {}).notification;
|
|
79
|
+
_a = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _a.id, type = _a.type;
|
|
80
|
+
if (!(id && type)) return [3, 4];
|
|
81
|
+
return [4, API.individualService.retrieveIndividual(id, type)];
|
|
82
|
+
case 3:
|
|
83
|
+
individualData = _f.sent();
|
|
84
|
+
_f.label = 4;
|
|
79
85
|
case 4:
|
|
80
|
-
|
|
81
|
-
entity = ((boardData === null || boardData === void 0 ? void 0 : boardData.business) || {}).entity;
|
|
82
|
-
countryCode = entity === null || entity === void 0 ? void 0 : entity.country;
|
|
86
|
+
countryCode = (_b = individualData === null || individualData === void 0 ? void 0 : individualData.user) === null || _b === void 0 ? void 0 : _b.nationality;
|
|
83
87
|
info = boardInfoData.info;
|
|
84
|
-
hasIndividualCompleted = ((
|
|
85
|
-
return [
|
|
88
|
+
hasIndividualCompleted = ((_c = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _c === void 0 ? void 0 : _c.status) === 'completed';
|
|
89
|
+
if (!hasIndividualCompleted) return [3, 7];
|
|
90
|
+
if (!board_id) return [3, 6];
|
|
91
|
+
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
86
92
|
case 5:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
case
|
|
93
|
+
boardData = _f.sent();
|
|
94
|
+
_f.label = 6;
|
|
95
|
+
case 6:
|
|
96
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
97
|
+
return [3, 10];
|
|
98
|
+
case 7:
|
|
99
|
+
if (!countryCode) return [3, 9];
|
|
100
|
+
return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
|
|
101
|
+
case 8:
|
|
102
|
+
_f.sent();
|
|
103
|
+
_f.label = 9;
|
|
104
|
+
case 9:
|
|
105
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
|
|
106
|
+
_f.label = 10;
|
|
107
|
+
case 10: return [2, {
|
|
99
108
|
data: data,
|
|
100
109
|
boardResponse: {
|
|
101
|
-
user:
|
|
110
|
+
user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
|
|
102
111
|
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
103
112
|
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
104
113
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
105
114
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
106
|
-
name: (
|
|
107
|
-
contact: (
|
|
115
|
+
name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names,
|
|
116
|
+
contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact,
|
|
108
117
|
countries: countries,
|
|
109
118
|
countryCode: countryCode,
|
|
119
|
+
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
|
|
110
120
|
flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
|
|
111
121
|
},
|
|
112
122
|
token: token
|
|
@@ -132,16 +142,24 @@ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params,
|
|
|
132
142
|
});
|
|
133
143
|
}); });
|
|
134
144
|
export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', function (countryCode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
135
|
-
var _a, sourceIncome, monthlyIncome, occupation;
|
|
145
|
+
var monthlyIncomeBody, dataBody, _a, sourceIncome, monthlyIncome, occupation;
|
|
136
146
|
return __generator(this, function (_b) {
|
|
137
147
|
switch (_b.label) {
|
|
138
|
-
case 0:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
148
|
+
case 0:
|
|
149
|
+
monthlyIncomeBody = {
|
|
150
|
+
page: 0,
|
|
151
|
+
country_code: [countryCode]
|
|
152
|
+
};
|
|
153
|
+
dataBody = {
|
|
154
|
+
page: 0
|
|
155
|
+
};
|
|
156
|
+
return [4, Promise.all([
|
|
157
|
+
API.dataService.getSourceOfIncome(dataBody),
|
|
158
|
+
API.dataService.getMonthlyIncome(monthlyIncomeBody),
|
|
159
|
+
API.dataService.getOccupation(dataBody)
|
|
160
|
+
])];
|
|
143
161
|
case 1:
|
|
144
|
-
_a = _b.sent(), sourceIncome = _a[0]
|
|
162
|
+
_a = _b.sent(), sourceIncome = _a[0], monthlyIncome = _a[1], occupation = _a[2];
|
|
145
163
|
return [2, {
|
|
146
164
|
sourceIncome: sourceIncome,
|
|
147
165
|
monthlyIncome: monthlyIncome,
|
|
@@ -159,70 +177,113 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
|
|
|
159
177
|
case 1:
|
|
160
178
|
data = _c.sent();
|
|
161
179
|
return [2, {
|
|
162
|
-
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.
|
|
180
|
+
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, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
|
|
163
181
|
}];
|
|
164
182
|
}
|
|
165
183
|
});
|
|
166
184
|
}); });
|
|
167
185
|
export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
168
|
-
var _a, individual, settings, responseBody, payload, data,
|
|
169
|
-
var
|
|
170
|
-
return __generator(this, function (
|
|
171
|
-
switch (
|
|
186
|
+
var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, notification, _c, id, type, info, hasIndividualCompleted;
|
|
187
|
+
var _d, _e, _f, _g, _h, _j, _k;
|
|
188
|
+
return __generator(this, function (_l) {
|
|
189
|
+
switch (_l.label) {
|
|
172
190
|
case 0:
|
|
173
191
|
_a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
|
|
174
192
|
responseBody = individual.data.verify.responseBody;
|
|
193
|
+
_b = responseBody || {}, board_id = _b.board_id, board_info_id = _b.board_info_id;
|
|
194
|
+
countries = settings.data.countries;
|
|
175
195
|
payload = {
|
|
176
196
|
data: params.otp,
|
|
177
|
-
service_name: (
|
|
197
|
+
service_name: (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _d === void 0 ? void 0 : _d.service_name,
|
|
178
198
|
verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
|
|
179
199
|
step_name: INDIVIDUAl_STEP_NAMES.PHONE_AUTH,
|
|
180
200
|
encryption_contract: ['data']
|
|
181
201
|
};
|
|
182
202
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
183
203
|
case 1:
|
|
184
|
-
data = (
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
204
|
+
data = (_l.sent()).data;
|
|
205
|
+
countryCode = undefined;
|
|
206
|
+
if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 10];
|
|
207
|
+
if (!(board_id && board_info_id)) return [3, 4];
|
|
208
|
+
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
209
|
+
case 2:
|
|
210
|
+
boardInfoData = _l.sent();
|
|
211
|
+
notification = (boardInfoData || {}).notification;
|
|
212
|
+
_c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
|
|
213
|
+
if (!(id && type)) return [3, 4];
|
|
214
|
+
return [4, API.individualService.retrieveIndividual(id, type)];
|
|
215
|
+
case 3:
|
|
216
|
+
individualData = _l.sent();
|
|
217
|
+
_l.label = 4;
|
|
218
|
+
case 4:
|
|
219
|
+
countryCode = (_e = individualData === null || individualData === void 0 ? void 0 : individualData.user) === null || _e === void 0 ? void 0 : _e.nationality;
|
|
220
|
+
info = boardInfoData.info;
|
|
221
|
+
hasIndividualCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
|
|
222
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
|
|
223
|
+
if (!hasIndividualCompleted) return [3, 7];
|
|
224
|
+
if (!board_id) return [3, 6];
|
|
225
|
+
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
226
|
+
case 5:
|
|
227
|
+
boardData = _l.sent();
|
|
228
|
+
_l.label = 6;
|
|
229
|
+
case 6:
|
|
230
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
231
|
+
return [3, 10];
|
|
232
|
+
case 7:
|
|
233
|
+
if (!countryCode) return [3, 9];
|
|
234
|
+
return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
|
|
235
|
+
case 8:
|
|
236
|
+
_l.sent();
|
|
237
|
+
_l.label = 9;
|
|
238
|
+
case 9:
|
|
239
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
|
|
240
|
+
_l.label = 10;
|
|
241
|
+
case 10: return [2, {
|
|
242
|
+
data: data,
|
|
243
|
+
boardResponse: {
|
|
244
|
+
user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
|
|
245
|
+
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
246
|
+
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
247
|
+
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
248
|
+
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
249
|
+
name: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.names,
|
|
250
|
+
contact: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.contact,
|
|
251
|
+
countries: countries,
|
|
252
|
+
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
|
|
253
|
+
flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
|
|
254
|
+
},
|
|
255
|
+
formData: __assign({}, params)
|
|
256
|
+
}];
|
|
197
257
|
}
|
|
198
258
|
});
|
|
199
259
|
}); });
|
|
200
260
|
export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
201
|
-
var _a, settings, individual, requestBody, data;
|
|
202
|
-
var
|
|
203
|
-
return __generator(this, function (
|
|
204
|
-
switch (
|
|
261
|
+
var _a, settings, individual, _b, id, type, requestBody, data;
|
|
262
|
+
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
263
|
+
return __generator(this, function (_l) {
|
|
264
|
+
switch (_l.label) {
|
|
205
265
|
case 0:
|
|
206
266
|
_a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
|
|
267
|
+
_b = ((_d = (_c = individual.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.notification) === null || _d === void 0 ? void 0 : _d.recipient) || {}, id = _b.id, type = _b.type;
|
|
207
268
|
requestBody = {
|
|
208
|
-
id:
|
|
209
|
-
|
|
210
|
-
occupation: (
|
|
269
|
+
id: id,
|
|
270
|
+
type: type,
|
|
271
|
+
occupation: { id: (_e = params.occupation) === null || _e === void 0 ? void 0 : _e.id },
|
|
211
272
|
employer_name: params.employerName,
|
|
212
|
-
employer_country: (
|
|
213
|
-
source_income: [(
|
|
214
|
-
|
|
273
|
+
employer_country: (_f = params.employerLocation) === null || _f === void 0 ? void 0 : _f.iso2,
|
|
274
|
+
source_income: [{ id: (_g = params.sourceIncome) === null || _g === void 0 ? void 0 : _g.id }],
|
|
275
|
+
monthly_income: { id: (_h = params.monthlyIncome) === null || _h === void 0 ? void 0 : _h.id },
|
|
215
276
|
is_relative_PEP: params.isPEP,
|
|
216
277
|
is_influencer: params.isInfluencer,
|
|
217
|
-
encryption_contract: ['employer_name', '
|
|
278
|
+
encryption_contract: ['employer_name', 'employer_country'],
|
|
218
279
|
step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
|
|
219
280
|
};
|
|
220
|
-
return [4, API.
|
|
281
|
+
return [4, API.individualService.updateIndividual(requestBody)];
|
|
221
282
|
case 1:
|
|
222
|
-
data = (
|
|
283
|
+
data = (_l.sent()).data;
|
|
223
284
|
if (!(data === null || data === void 0 ? void 0 : data.errors)) {
|
|
224
285
|
thunkApi.dispatch(handleNextScreenStep());
|
|
225
|
-
(
|
|
286
|
+
(_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
|
|
226
287
|
}
|
|
227
288
|
return [2, { data: data, formData: params }];
|
|
228
289
|
}
|
|
@@ -308,23 +369,25 @@ export var individualSlice = createSlice({
|
|
|
308
369
|
state.error = description;
|
|
309
370
|
return;
|
|
310
371
|
}
|
|
311
|
-
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data),
|
|
372
|
+
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
|
|
312
373
|
state.data.verify.token = token;
|
|
313
|
-
var _c = boardResponse || {}, countries = _c.countries,
|
|
314
|
-
var _d =
|
|
374
|
+
var _c = boardResponse || {}, countries = _c.countries, user = _c.user;
|
|
375
|
+
var _d = user || {}, source_income = _d.source_income, monthly_income = _d.monthly_income, occupation = _d.occupation, is_relative_PEP = _d.is_relative_PEP, is_influencer = _d.is_influencer;
|
|
315
376
|
var _e = state.data.individualData.responseBody || {}, sourceIncomeList = _e.sourceIncomeList, monthlyIncomeList = _e.monthlyIncomeList, occupationList = _e.occupationList;
|
|
316
|
-
var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a
|
|
377
|
+
var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) ||
|
|
378
|
+
(sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
|
|
317
379
|
if (!!selectedSourceIncome)
|
|
318
380
|
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
319
|
-
var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
|
|
381
|
+
var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { return (income === null || income === void 0 ? void 0 : income.id) === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id); })) ||
|
|
382
|
+
(monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
|
|
320
383
|
if (!!selectedMonthlyIncome)
|
|
321
384
|
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
322
|
-
var code =
|
|
385
|
+
var code = user === null || user === void 0 ? void 0 : user.employer_country;
|
|
323
386
|
if (!!code) {
|
|
324
387
|
var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
|
|
325
388
|
state.data.individualData.employerLocation = employerLocation;
|
|
326
389
|
}
|
|
327
|
-
var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (o) {
|
|
390
|
+
var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (o) { return (o === null || o === void 0 ? void 0 : o.id) === (occupation === null || occupation === void 0 ? void 0 : occupation.id); })) || (occupationList === null || occupationList === void 0 ? void 0 : occupationList[0]);
|
|
328
391
|
if (!!selectedOccupation)
|
|
329
392
|
state.data.individualData.occupation = selectedOccupation;
|
|
330
393
|
state.data.individualData.isPEP = is_relative_PEP;
|
|
@@ -359,7 +422,7 @@ export var individualSlice = createSlice({
|
|
|
359
422
|
var _a;
|
|
360
423
|
state.loading = false;
|
|
361
424
|
state.error = null;
|
|
362
|
-
var _b = action.payload, data = _b.data, formData = _b.formData;
|
|
425
|
+
var _b = action.payload, data = _b.data, formData = _b.formData, boardResponse = _b.boardResponse;
|
|
363
426
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
364
427
|
if (description) {
|
|
365
428
|
state.error = description;
|
|
@@ -367,7 +430,28 @@ export var individualSlice = createSlice({
|
|
|
367
430
|
}
|
|
368
431
|
state.data.otpData = formData;
|
|
369
432
|
state.data.otpData.responseBody = data;
|
|
370
|
-
state.data.
|
|
433
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
|
|
434
|
+
var _c = boardResponse || {}, countries = _c.countries, user = _c.user;
|
|
435
|
+
var _d = user || {}, source_income = _d.source_income, monthly_income = _d.monthly_income, occupation = _d.occupation, is_relative_PEP = _d.is_relative_PEP, is_influencer = _d.is_influencer;
|
|
436
|
+
var _e = state.data.individualData.responseBody || {}, sourceIncomeList = _e.sourceIncomeList, monthlyIncomeList = _e.monthlyIncomeList, occupationList = _e.occupationList;
|
|
437
|
+
var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) ||
|
|
438
|
+
(sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
|
|
439
|
+
if (!!selectedSourceIncome)
|
|
440
|
+
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
441
|
+
var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { return (income === null || income === void 0 ? void 0 : income.id) === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id); })) ||
|
|
442
|
+
(monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
|
|
443
|
+
if (!!selectedMonthlyIncome)
|
|
444
|
+
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
445
|
+
var code = user === null || user === void 0 ? void 0 : user.employer_country;
|
|
446
|
+
if (!!code) {
|
|
447
|
+
var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
|
|
448
|
+
state.data.individualData.employerLocation = employerLocation;
|
|
449
|
+
}
|
|
450
|
+
var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (o) { return (o === null || o === void 0 ? void 0 : o.id) === (occupation === null || occupation === void 0 ? void 0 : occupation.id); })) || (occupationList === null || occupationList === void 0 ? void 0 : occupationList[0]);
|
|
451
|
+
if (!!selectedOccupation)
|
|
452
|
+
state.data.individualData.occupation = selectedOccupation;
|
|
453
|
+
state.data.individualData.isPEP = is_relative_PEP;
|
|
454
|
+
state.data.individualData.isInfluencer = is_influencer;
|
|
371
455
|
})
|
|
372
456
|
.addCase(verifyLeadOTP.rejected, function (state, action) {
|
|
373
457
|
state.loading = false;
|
|
@@ -382,7 +466,7 @@ export var individualSlice = createSlice({
|
|
|
382
466
|
state.error = null;
|
|
383
467
|
var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, occupation = _a.occupation;
|
|
384
468
|
var data = state.data.individualData.responseBody;
|
|
385
|
-
state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [], occupationList: occupation || [] });
|
|
469
|
+
state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: (sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.list) || [], monthlyIncomeList: (monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.list) || [], occupationList: (occupation === null || occupation === void 0 ? void 0 : occupation.list) || [] });
|
|
386
470
|
})
|
|
387
471
|
.addCase(retrieveDataList.rejected, function (state, action) {
|
|
388
472
|
state.loading = false;
|
|
@@ -417,8 +501,8 @@ export var individualSlice = createSlice({
|
|
|
417
501
|
state.error = null;
|
|
418
502
|
state.loading = false;
|
|
419
503
|
var data = (action.payload || {}).data;
|
|
420
|
-
var
|
|
421
|
-
state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), data), { entity: entity
|
|
504
|
+
var entity = (data || {}).entity;
|
|
505
|
+
state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), data), { entity: entity });
|
|
422
506
|
})
|
|
423
507
|
.addCase(retrieveBoardDetails.rejected, function (state, action) {
|
|
424
508
|
state.error = action.error.message;
|
|
@@ -118,7 +118,7 @@ export var retrieveBoardDetails = createAsyncThunk('retrievePasswordBoardDetails
|
|
|
118
118
|
case 1:
|
|
119
119
|
data = _c.sent();
|
|
120
120
|
return [2, {
|
|
121
|
-
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.
|
|
121
|
+
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, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
|
|
122
122
|
}];
|
|
123
123
|
}
|
|
124
124
|
});
|
|
@@ -257,8 +257,9 @@ export var taxSlice = createSlice({
|
|
|
257
257
|
state.error = description;
|
|
258
258
|
return;
|
|
259
259
|
}
|
|
260
|
-
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id, name: user.
|
|
260
|
+
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id, name: user === null || user === void 0 ? void 0 : user.names, bank_account: bank_account, vatID: vatID, merchant: merchant });
|
|
261
261
|
state.data.verify.token = token;
|
|
262
|
+
state.data.taxData.vatId = vatID;
|
|
262
263
|
})
|
|
263
264
|
.addCase(verifyLeadToken.pending, function (state) {
|
|
264
265
|
state.error = null;
|
|
@@ -358,7 +359,7 @@ export var taxSlice = createSlice({
|
|
|
358
359
|
return;
|
|
359
360
|
}
|
|
360
361
|
var flows = response.flows, steps = response.steps, user = response.user, bank_account = response.bank_account, vatID = response.vatID, merchant = response.merchant;
|
|
361
|
-
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps, bank_account: bank_account, name: user.
|
|
362
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps, bank_account: bank_account, name: user === null || user === void 0 ? void 0 : user.names, vatID: vatID, merchant: merchant });
|
|
362
363
|
})
|
|
363
364
|
.addCase(updateLeadSuccess.pending, function (state) {
|
|
364
365
|
state.loading = true;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LibConfig } from '../../@types';
|
|
3
|
+
export interface AuthLibProps extends LibConfig {
|
|
4
|
+
postURL: string;
|
|
5
|
+
leadId: string;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function AuthLib(props: AuthLibProps): JSX.Element;
|
|
9
|
+
export declare function renderAuthLib(config: AuthLibProps, elementId: string): void;
|
|
10
|
+
export declare function unmountAuthLib(elementId: string, unmountTimeout?: number): void;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
|
+
import { memo, useEffect } from 'react';
|
|
25
|
+
import { FeatureContainer } from '../shared/Containers';
|
|
26
|
+
import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useAppDispatch } from '../../hooks';
|
|
27
|
+
import { settingsSelector, handleOpen } from '../../app/settings';
|
|
28
|
+
import AnimationFlow from '../../components/AnimationFlow';
|
|
29
|
+
import { store } from '../../app/store';
|
|
30
|
+
import { authSelector, retrieveLead, storeLeadId, storePostUrl } from '../app/auth/authStore';
|
|
31
|
+
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
32
|
+
import Collapse from '../../components/Collapse';
|
|
33
|
+
import { reactElement, removeElement } from '../../utils';
|
|
34
|
+
import { AUTH_SCREENS_NAVIGATION, DIALOG_ID } from '../../constants';
|
|
35
|
+
import { authFeatureScreens } from '../featuresScreens';
|
|
36
|
+
import Background from '../shared/Background';
|
|
37
|
+
var Auth = memo(function (_a) {
|
|
38
|
+
var onClose = _a.onClose, props = __rest(_a, ["onClose"]);
|
|
39
|
+
var theme = useAppTheme().theme;
|
|
40
|
+
var dispatch = useAppDispatch();
|
|
41
|
+
var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
|
|
42
|
+
var _c = useAppSelector(authSelector), authError = _c.error, customLoading = _c.customLoading, loading = _c.loading;
|
|
43
|
+
useAppConfig(__assign({ navigation: AUTH_SCREENS_NAVIGATION, disableCountries: true, disableLocale: true }, props));
|
|
44
|
+
useErrorListener(authError || error);
|
|
45
|
+
useStepStartedListener();
|
|
46
|
+
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
if (!props.leadId)
|
|
49
|
+
throw new Error('leadId is required');
|
|
50
|
+
var _a = props || {}, leadId = _a.leadId, postURL = _a.postURL;
|
|
51
|
+
var data = {
|
|
52
|
+
postUrl: postURL
|
|
53
|
+
};
|
|
54
|
+
if (!props.open)
|
|
55
|
+
return;
|
|
56
|
+
dispatch(storePostUrl(data));
|
|
57
|
+
dispatch(storeLeadId({ leadId: leadId }));
|
|
58
|
+
}, []);
|
|
59
|
+
useEffect(function () {
|
|
60
|
+
if (data.isValidOperator && props.open)
|
|
61
|
+
dispatch(retrieveLead(props.leadId));
|
|
62
|
+
}, [data.isValidOperator]);
|
|
63
|
+
var handleDialogClose = function () {
|
|
64
|
+
dispatch(handleOpen(false));
|
|
65
|
+
};
|
|
66
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', onClose: onClose, onConfirm: handleDialogClose, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, footer: _jsx(_Fragment, {}), screenId: activeScreen.name, animationType: 'collapse' }, { children: _jsx(FeatureContainer, { children: authFeatureScreens.map(function (_a, index) {
|
|
67
|
+
var Element = _a.element, name = _a.name;
|
|
68
|
+
var isActive = activeScreen.name === name;
|
|
69
|
+
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
70
|
+
}) }) })) })) })));
|
|
71
|
+
});
|
|
72
|
+
export function AuthLib(props) {
|
|
73
|
+
return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Auth, __assign({}, props)) })));
|
|
74
|
+
}
|
|
75
|
+
export function renderAuthLib(config, elementId) {
|
|
76
|
+
reactElement(elementId).render(_jsx(AuthLib, __assign({}, config)));
|
|
77
|
+
}
|
|
78
|
+
export function unmountAuthLib(elementId, unmountTimeout) {
|
|
79
|
+
if (unmountTimeout === void 0) { unmountTimeout = 1000; }
|
|
80
|
+
var element = document.getElementById(elementId);
|
|
81
|
+
setTimeout(function () {
|
|
82
|
+
var _a;
|
|
83
|
+
((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
|
|
84
|
+
removeElement(DIALOG_ID);
|
|
85
|
+
elementId && reactElement(elementId).unmount();
|
|
86
|
+
}, unmountTimeout);
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Auth';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Auth';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
16
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
17
|
+
import DatePicker from '../../../../components/DatePicker';
|
|
18
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
19
|
+
import { clearError, authSelector } from '../../../app/auth/authStore';
|
|
20
|
+
import Text from '../../../../components/Text';
|
|
21
|
+
import Collapse from '../../../../components/Collapse';
|
|
22
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
23
|
+
var theme = _a.theme;
|
|
24
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
25
|
+
});
|
|
26
|
+
var DOB = function (_a) {
|
|
27
|
+
var show = _a.show, onDateClicked = _a.onDateClicked;
|
|
28
|
+
var t = useTranslation().t;
|
|
29
|
+
var control = useFormContext().control;
|
|
30
|
+
var dispatch = useAppDispatch();
|
|
31
|
+
var dobControl = useController({ control: control, name: 'dob' });
|
|
32
|
+
var error = useAppSelector(authSelector).error;
|
|
33
|
+
var handleBirthDateChange = function (data) {
|
|
34
|
+
dobControl.field.onChange(data);
|
|
35
|
+
handleClearError();
|
|
36
|
+
};
|
|
37
|
+
var handleClearError = function () {
|
|
38
|
+
if (error)
|
|
39
|
+
dispatch(clearError());
|
|
40
|
+
};
|
|
41
|
+
var dateValue = dobControl.field.value;
|
|
42
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
43
|
+
var spacing = _a.spacing;
|
|
44
|
+
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
45
|
+
} } }, { children: t('enter_birth_date') })), _jsx(DatePicker, { defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onDateChange: handleBirthDateChange, onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); } })] }) })));
|
|
46
|
+
};
|
|
47
|
+
export default DOB;
|