@tap-payments/auth-jsconnect 1.0.35 → 1.0.38
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/components/AnimationFlow/BottomSheet.js +26 -2
- package/build/components/OTPTimer/OTPTimer.js +4 -2
- package/build/constants/app.js +1 -1
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/business/businessStore.d.ts +1 -1
- package/build/features/app/business/businessStore.js +32 -23
- package/build/features/app/connect/connectStore.d.ts +1 -1
- package/build/features/app/connect/connectStore.js +17 -11
- package/build/features/business/screens/BusinessType/BusinessType.js +16 -23
- package/build/features/business/screens/BusinessType/CompanyLicense.js +23 -9
- package/build/features/business/screens/BusinessType/FreelanceLicense.js +23 -9
- package/build/features/business/screens/Confirm/Confirm.js +4 -3
- package/build/features/business/screens/OTP/OTPInput.js +1 -2
- package/build/features/business/screens/Verify/OTPInput.js +1 -2
- package/build/features/business/screens/Verify/Verify.js +3 -3
- package/build/features/connect/screens/Individual/Email.js +10 -1
- package/build/features/connect/screens/Individual/Individual.js +8 -10
- package/build/features/connect/screens/Individual/MobileNumber.js +3 -16
- package/build/features/connect/screens/Merchant/Merchant.js +11 -11
- package/build/features/connect/screens/Merchant/SocialMedia.js +2 -1
- package/build/features/connect/screens/Merchant/TAC.js +1 -1
- package/build/features/connect/screens/Merchant/validation.js +3 -2
- package/build/features/connect/screens/Mobile/BusinessCountry.js +1 -1
- package/build/features/connect/screens/Mobile/Mobile.js +1 -9
- package/build/features/connect/screens/Mobile/MobileNumber.js +3 -16
- package/build/features/connect/screens/NID/IDNumber.d.ts +0 -1
- package/build/features/connect/screens/NID/IDNumber.js +2 -2
- package/build/features/connect/screens/NID/NID.js +1 -6
- package/build/features/connect/screens/OTP/OTP.js +2 -4
- package/build/features/connect/screens/Password/Password.js +1 -6
- package/build/features/shared/Button/Button.js +16 -11
- package/build/features/shared/SuccessScreen/SuccessScreen.js +10 -5
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useWindowSize.d.ts +6 -0
- package/build/hooks/useWindowSize.js +19 -0
- package/package.json +126 -126
- package/build/features/app/business/midStore.d.ts +0 -10
- package/build/features/app/business/midStore.js +0 -18
- package/build/features/app/connect/midStore.d.ts +0 -10
- package/build/features/app/connect/midStore.js +0 -18
- package/build/features/business/screens/VerifyNumber/OTPInput.d.ts +0 -5
- package/build/features/business/screens/VerifyNumber/OTPInput.js +0 -39
- package/build/features/business/screens/VerifyNumber/VerifyNumber.d.ts +0 -13
- package/build/features/business/screens/VerifyNumber/VerifyNumber.js +0 -76
- package/build/features/business/screens/VerifyNumber/index.d.ts +0 -3
- package/build/features/business/screens/VerifyNumber/index.js +0 -2
- package/build/features/business/screens/VerifyNumber/validation.d.ts +0 -8
- package/build/features/business/screens/VerifyNumber/validation.js +0 -4
- package/build/features/connect/screens/MID/BusinessCountry.d.ts +0 -11
- package/build/features/connect/screens/MID/BusinessCountry.js +0 -92
- package/build/features/connect/screens/MID/DOB.d.ts +0 -6
- package/build/features/connect/screens/MID/DOB.js +0 -38
- package/build/features/connect/screens/MID/IDNumber.d.ts +0 -7
- package/build/features/connect/screens/MID/IDNumber.js +0 -70
- package/build/features/connect/screens/MID/MID.d.ts +0 -5
- package/build/features/connect/screens/MID/MID.js +0 -87
- package/build/features/connect/screens/MID/MIDTitle.d.ts +0 -8
- package/build/features/connect/screens/MID/MIDTitle.js +0 -29
- package/build/features/connect/screens/MID/MobileNumber.d.ts +0 -12
- package/build/features/connect/screens/MID/MobileNumber.js +0 -148
- package/build/features/connect/screens/MID/index.d.ts +0 -3
- package/build/features/connect/screens/MID/index.js +0 -2
- package/build/features/connect/screens/MID/validation.d.ts +0 -18
- package/build/features/connect/screens/MID/validation.js +0 -15
- package/build/features/owner/Owner.d.ts +0 -6
- package/build/features/owner/Owner.js +0 -50
- package/build/features/owner/index.d.ts +0 -1
- package/build/features/owner/index.js +0 -1
- package/build/features/owner/screens/AdditionalOwnerInfo/AdditionalOwnerInfo.d.ts +0 -8
- package/build/features/owner/screens/AdditionalOwnerInfo/AdditionalOwnerInfo.js +0 -77
- package/build/features/owner/screens/AdditionalOwnerInfo/EmployerLocation.d.ts +0 -10
- package/build/features/owner/screens/AdditionalOwnerInfo/EmployerLocation.js +0 -80
- package/build/features/owner/screens/AdditionalOwnerInfo/EmployerName.d.ts +0 -6
- package/build/features/owner/screens/AdditionalOwnerInfo/EmployerName.js +0 -40
- package/build/features/owner/screens/AdditionalOwnerInfo/InfluencerSwitch.d.ts +0 -6
- package/build/features/owner/screens/AdditionalOwnerInfo/InfluencerSwitch.js +0 -45
- package/build/features/owner/screens/AdditionalOwnerInfo/MonthlyIncome.d.ts +0 -6
- package/build/features/owner/screens/AdditionalOwnerInfo/MonthlyIncome.js +0 -35
- package/build/features/owner/screens/AdditionalOwnerInfo/PEPSwitch.d.ts +0 -6
- package/build/features/owner/screens/AdditionalOwnerInfo/PEPSwitch.js +0 -45
- package/build/features/owner/screens/AdditionalOwnerInfo/SourceOfIncome.d.ts +0 -9
- package/build/features/owner/screens/AdditionalOwnerInfo/SourceOfIncome.js +0 -85
- package/build/features/owner/screens/AdditionalOwnerInfo/index.d.ts +0 -3
- package/build/features/owner/screens/AdditionalOwnerInfo/index.js +0 -2
- package/build/features/owner/screens/AdditionalOwnerInfo/validation.d.ts +0 -25
- package/build/features/owner/screens/AdditionalOwnerInfo/validation.js +0 -35
- package/build/features/owner/screens/ShowOwnerInfo/ShowOwnerInfo.d.ts +0 -19
- package/build/features/owner/screens/ShowOwnerInfo/ShowOwnerInfo.js +0 -52
- package/build/features/owner/screens/ShowOwnerInfo/index.d.ts +0 -3
- package/build/features/owner/screens/ShowOwnerInfo/index.js +0 -2
- package/build/features/owner/screens/ShowOwnerInfo/info.d.ts +0 -7
- package/build/features/owner/screens/ShowOwnerInfo/info.js +0 -28
- package/build/features/owner/screens/Success/Success.d.ts +0 -5
- package/build/features/owner/screens/Success/Success.js +0 -14
- package/build/features/owner/screens/Success/index.d.ts +0 -3
- package/build/features/owner/screens/Success/index.js +0 -2
- package/build/features/shared/ExpandIcon/ExpandIcon.d.ts +0 -7
- package/build/features/shared/ExpandIcon/ExpandIcon.js +0 -24
- package/build/features/shared/ExpandIcon/index.d.ts +0 -2
- package/build/features/shared/ExpandIcon/index.js +0 -2
|
@@ -24,12 +24,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
24
24
|
import * as React from 'react';
|
|
25
25
|
import { BottomSheet } from 'react-spring-bottom-sheet';
|
|
26
26
|
import { styled } from '@mui/material/styles';
|
|
27
|
+
import { useWindowSize } from '../../hooks';
|
|
27
28
|
import 'react-spring-bottom-sheet/dist/style.css';
|
|
28
29
|
var BottomSheetStyled = styled(BottomSheet)(function (_a) {
|
|
29
30
|
var theme = _a.theme;
|
|
30
31
|
return ({
|
|
31
32
|
'[data-rsbs-header]:before': {
|
|
32
|
-
width: '
|
|
33
|
+
width: '75px',
|
|
34
|
+
height: '5px'
|
|
33
35
|
},
|
|
34
36
|
'[data-rsbs-overlay]': {
|
|
35
37
|
backgroundColor: theme.palette.background.paper
|
|
@@ -51,9 +53,31 @@ var BottomSheetStyled = styled(BottomSheet)(function (_a) {
|
|
|
51
53
|
});
|
|
52
54
|
var BottomSheetComponent = function (_a) {
|
|
53
55
|
var open = _a.open, children = _a.children, rest = __rest(_a, ["open", "children"]);
|
|
56
|
+
var height = useWindowSize().height;
|
|
57
|
+
var getMinHeight = function (maxHeight) {
|
|
58
|
+
if (height < 500)
|
|
59
|
+
return maxHeight * 0.95;
|
|
60
|
+
if (height >= 500 && height < 550)
|
|
61
|
+
return maxHeight * 0.93;
|
|
62
|
+
if (height >= 550 && height < 600)
|
|
63
|
+
return maxHeight * 0.87;
|
|
64
|
+
if (height >= 600 && height < 650)
|
|
65
|
+
return maxHeight * 0.8;
|
|
66
|
+
if (height >= 650 && height < 700)
|
|
67
|
+
return maxHeight * 0.75;
|
|
68
|
+
if (height >= 700 && height < 750)
|
|
69
|
+
return maxHeight * 0.7;
|
|
70
|
+
if (height >= 750 && height < 800)
|
|
71
|
+
return maxHeight * 0.65;
|
|
72
|
+
if (height >= 800 && height < 850)
|
|
73
|
+
return maxHeight * 0.6;
|
|
74
|
+
if (height >= 850 && height < 900)
|
|
75
|
+
return maxHeight * 0.57;
|
|
76
|
+
return maxHeight * 0.5;
|
|
77
|
+
};
|
|
54
78
|
return (_jsx(BottomSheetStyled, __assign({ open: open, snapPoints: function (_a) {
|
|
55
79
|
var maxHeight = _a.maxHeight;
|
|
56
|
-
return [maxHeight * 0.
|
|
80
|
+
return [getMinHeight(maxHeight), maxHeight * 0.95];
|
|
57
81
|
} }, rest, { children: children })));
|
|
58
82
|
};
|
|
59
83
|
export default React.memo(BottomSheetComponent);
|
|
@@ -30,7 +30,9 @@ var OTPTimerStyled = styled(Box)(function (_a) {
|
|
|
30
30
|
return ({
|
|
31
31
|
display: 'flex',
|
|
32
32
|
paddingInline: theme.spacing(2.5),
|
|
33
|
-
justifyContent: 'flex-end'
|
|
33
|
+
justifyContent: 'flex-end',
|
|
34
|
+
maxWidth: 'fit-content',
|
|
35
|
+
marginLeft: 'auto'
|
|
34
36
|
});
|
|
35
37
|
});
|
|
36
38
|
var OTPTimerTextStyled = styled(Text)(function (_a) {
|
|
@@ -53,7 +55,7 @@ var OTPTimerComponent = function (_a) {
|
|
|
53
55
|
return function () { return clearInterval(interval); };
|
|
54
56
|
}, [timeValue]);
|
|
55
57
|
var resetTimer = function () {
|
|
56
|
-
if (onResetClick) {
|
|
58
|
+
if (onResetClick && timeValue == 0) {
|
|
57
59
|
onResetClick();
|
|
58
60
|
seTimeValue(timeInSeconds || 60);
|
|
59
61
|
}
|
package/build/constants/app.js
CHANGED
|
@@ -6,3 +6,4 @@ export var FL_NUMBER_LENGTH = 8;
|
|
|
6
6
|
export var CR_NUMBER_LENGTH = 10;
|
|
7
7
|
export var SAUDI_NUMBER_LENGTH = 9;
|
|
8
8
|
export var REGEX_FULL_NAME = /^([a-zA-Z]{2,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,})$/g;
|
|
9
|
+
export var REGEX_WEBSITE = /^[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,63}(:[0-9]{1,5})?(\/.*)?$/;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
2
|
import { ActivitiesFormValues, BusinessInfoFormValues, CustomersFormValues, BusinessTypeFormValues, CountryCode, CRLicense, FLLicense, NIDFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
3
3
|
export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
|
-
businessCountry:
|
|
4
|
+
businessCountry: undefined;
|
|
5
5
|
countries: any;
|
|
6
6
|
}, void, {}>;
|
|
7
7
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
@@ -55,7 +55,7 @@ import i18n from '../../../i18n';
|
|
|
55
55
|
import { convertNumbers2English, removeRequestHeaders } from '../../../utils';
|
|
56
56
|
import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
|
|
57
57
|
export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
-
var settings, countriesBody,
|
|
58
|
+
var settings, countriesBody, businessCountry, list;
|
|
59
59
|
return __generator(this, function (_a) {
|
|
60
60
|
switch (_a.label) {
|
|
61
61
|
case 0:
|
|
@@ -63,11 +63,17 @@ export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi
|
|
|
63
63
|
return [4, API.countryService.getAllCountries()];
|
|
64
64
|
case 1:
|
|
65
65
|
countriesBody = (_a.sent()).data;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
businessCountry = undefined;
|
|
67
|
+
list = (countriesBody.list || []).map(function (country) {
|
|
68
|
+
if ([country.iso2, country.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase())) {
|
|
69
|
+
businessCountry = country;
|
|
70
|
+
}
|
|
71
|
+
if (country.iso2 === 'SA') {
|
|
72
|
+
country.digits = 9;
|
|
73
|
+
}
|
|
74
|
+
return country;
|
|
69
75
|
});
|
|
70
|
-
return [2, { businessCountry: businessCountry, countries: list
|
|
76
|
+
return [2, { businessCountry: businessCountry, countries: list }];
|
|
71
77
|
}
|
|
72
78
|
});
|
|
73
79
|
}); });
|
|
@@ -121,8 +127,6 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
121
127
|
if (!data.errors) {
|
|
122
128
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
|
|
123
129
|
if (isNID) {
|
|
124
|
-
thunkApi.dispatch(retrieveFLInfos());
|
|
125
|
-
thunkApi.dispatch(retrieveCRInfos());
|
|
126
130
|
thunkApi.dispatch(handleNextScreenStep());
|
|
127
131
|
}
|
|
128
132
|
else {
|
|
@@ -147,7 +151,7 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
|
|
|
147
151
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
148
152
|
identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
|
|
149
153
|
headers = {
|
|
150
|
-
lead_id: ((_b = business.data.
|
|
154
|
+
lead_id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
|
|
151
155
|
device_identifier: (_d = (_c = settings.data.deviceInfo) === null || _c === void 0 ? void 0 : _c.browser) === null || _d === void 0 ? void 0 : _d.browser_id
|
|
152
156
|
};
|
|
153
157
|
requestBody = {
|
|
@@ -169,32 +173,32 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
|
|
|
169
173
|
}
|
|
170
174
|
});
|
|
171
175
|
}); });
|
|
172
|
-
export var retrieveCRInfos = createAsyncThunk('retrieveCRInfos', function (
|
|
176
|
+
export var retrieveCRInfos = createAsyncThunk('retrieveCRInfos', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
173
177
|
var business, leadId, data;
|
|
174
|
-
var
|
|
175
|
-
return __generator(this, function (
|
|
176
|
-
switch (
|
|
178
|
+
var _a;
|
|
179
|
+
return __generator(this, function (_b) {
|
|
180
|
+
switch (_b.label) {
|
|
177
181
|
case 0:
|
|
178
182
|
business = thunkApi.getState().business;
|
|
179
|
-
leadId = (
|
|
183
|
+
leadId = (_a = business.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.id;
|
|
180
184
|
return [4, API.leadService.retrieveCRInfos(leadId)];
|
|
181
185
|
case 1:
|
|
182
|
-
data = (
|
|
186
|
+
data = (_b.sent()).data;
|
|
183
187
|
return [2, { data: data }];
|
|
184
188
|
}
|
|
185
189
|
});
|
|
186
190
|
}); });
|
|
187
|
-
export var retrieveFLInfos = createAsyncThunk('retrieveFLInfos', function (
|
|
191
|
+
export var retrieveFLInfos = createAsyncThunk('retrieveFLInfos', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
188
192
|
var business, leadId, data;
|
|
189
|
-
var
|
|
190
|
-
return __generator(this, function (
|
|
191
|
-
switch (
|
|
193
|
+
var _a;
|
|
194
|
+
return __generator(this, function (_b) {
|
|
195
|
+
switch (_b.label) {
|
|
192
196
|
case 0:
|
|
193
197
|
business = thunkApi.getState().business;
|
|
194
|
-
leadId = (
|
|
198
|
+
leadId = (_a = business.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.id;
|
|
195
199
|
return [4, API.leadService.retrieveFLInfos(leadId)];
|
|
196
200
|
case 1:
|
|
197
|
-
data = (
|
|
201
|
+
data = (_b.sent()).data;
|
|
198
202
|
return [2, { data: data }];
|
|
199
203
|
}
|
|
200
204
|
});
|
|
@@ -479,8 +483,10 @@ export var businessSlice = createSlice({
|
|
|
479
483
|
var data = action.payload.data;
|
|
480
484
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
481
485
|
if (!description) {
|
|
482
|
-
|
|
483
|
-
|
|
486
|
+
if (Array.isArray(data)) {
|
|
487
|
+
state.data.crInfos = data;
|
|
488
|
+
state.data.businessTypeData.businessType = BusinessType.CR;
|
|
489
|
+
}
|
|
484
490
|
}
|
|
485
491
|
})
|
|
486
492
|
.addCase(retrieveCRInfos.rejected, function (state, action) {
|
|
@@ -522,8 +528,9 @@ export var businessSlice = createSlice({
|
|
|
522
528
|
}
|
|
523
529
|
state.data.businessTypeData = formData;
|
|
524
530
|
state.data.businessInfo.brandName = i18n.dir() === 'rtl' ? (_c = (_b = data === null || data === void 0 ? void 0 : data.brand) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.ar : (_e = (_d = data === null || data === void 0 ? void 0 : data.brand) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.en;
|
|
525
|
-
state.data.businessInfo.licenseNumber =
|
|
531
|
+
state.data.businessInfo.licenseNumber = data === null || data === void 0 ? void 0 : data.freelancer_number;
|
|
526
532
|
if (formData.businessType === BusinessType.CR) {
|
|
533
|
+
state.data.businessInfo.licenseNumber = data === null || data === void 0 ? void 0 : data.cr_number;
|
|
527
534
|
state.data.businessInfo.legalName = (_f = data === null || data === void 0 ? void 0 : data.license) === null || _f === void 0 ? void 0 : _f.crName;
|
|
528
535
|
state.data.activitiesData.operationStartDate = convertNumbers2English(moment((_g = data === null || data === void 0 ? void 0 : data.license) === null || _g === void 0 ? void 0 : _g.issueDate, 'iYYYY/iMM/iDD').format('YYYY-MM-DD'));
|
|
529
536
|
var activities = (_j = (_h = data === null || data === void 0 ? void 0 : data.license) === null || _h === void 0 ? void 0 : _h.activities) === null || _j === void 0 ? void 0 : _j.isic;
|
|
@@ -548,6 +555,7 @@ export var businessSlice = createSlice({
|
|
|
548
555
|
})
|
|
549
556
|
.addCase(createAccount.fulfilled, function (state, action) {
|
|
550
557
|
var _a, _b;
|
|
558
|
+
state.loading = false;
|
|
551
559
|
state.error = null;
|
|
552
560
|
var _c = action.payload, data = _c.data, channelsData = _c.channelsData;
|
|
553
561
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = channelsData === null || channelsData === void 0 ? void 0 : channelsData.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).description;
|
|
@@ -574,6 +582,7 @@ export var businessSlice = createSlice({
|
|
|
574
582
|
})
|
|
575
583
|
.addCase(updateActivitiesInfo.fulfilled, function (state, action) {
|
|
576
584
|
var _a;
|
|
585
|
+
state.loading = false;
|
|
577
586
|
state.error = null;
|
|
578
587
|
var _b = action.payload, data = _b.data, formData = _b.formData;
|
|
579
588
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
2
|
import { ResponseData, CountryCode, MobileFormValues, NIDFormValues, OTPFormValues, IndividualFormValues, SharedState, BrandFormValues, PasswordFormValues } from '../../../@types';
|
|
3
3
|
export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
|
-
businessCountry:
|
|
4
|
+
businessCountry: undefined;
|
|
5
5
|
countries: any;
|
|
6
6
|
}, void, {}>;
|
|
7
7
|
export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
@@ -53,7 +53,7 @@ import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE } from '../../../constants';
|
|
|
53
53
|
import { defaultCountry } from '../../../constants';
|
|
54
54
|
import { getIndividualName, getClientEmailUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '../../../utils';
|
|
55
55
|
export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
-
var settings, countriesBody,
|
|
56
|
+
var settings, countriesBody, businessCountry, list;
|
|
57
57
|
return __generator(this, function (_a) {
|
|
58
58
|
switch (_a.label) {
|
|
59
59
|
case 0:
|
|
@@ -61,11 +61,17 @@ export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi
|
|
|
61
61
|
return [4, API.countryService.getAllCountries()];
|
|
62
62
|
case 1:
|
|
63
63
|
countriesBody = (_a.sent()).data;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
businessCountry = undefined;
|
|
65
|
+
list = (countriesBody.list || []).map(function (country) {
|
|
66
|
+
if ([country.iso2, country.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase())) {
|
|
67
|
+
businessCountry = country;
|
|
68
|
+
}
|
|
69
|
+
if (country.iso2 === 'SA') {
|
|
70
|
+
country.digits = 9;
|
|
71
|
+
}
|
|
72
|
+
return country;
|
|
67
73
|
});
|
|
68
|
-
return [2, { businessCountry: businessCountry, countries: list
|
|
74
|
+
return [2, { businessCountry: businessCountry, countries: list }];
|
|
69
75
|
}
|
|
70
76
|
});
|
|
71
77
|
}); });
|
|
@@ -437,22 +443,18 @@ export var connectSlice = createSlice({
|
|
|
437
443
|
state.loading = false;
|
|
438
444
|
},
|
|
439
445
|
resetMobileScreen: function (state) {
|
|
440
|
-
state.data.mobileData = __assign(__assign({}, state.data.mobileData), initialState.data.mobileData);
|
|
441
446
|
},
|
|
442
447
|
resetNIDScreen: function (state) {
|
|
443
|
-
state.data.nidData = __assign(__assign({}, state.data.nidData), initialState.data.nidData);
|
|
444
448
|
},
|
|
445
449
|
resetOTPScreen: function (state) {
|
|
446
|
-
state.data.otpData =
|
|
450
|
+
state.data.otpData.otp = '';
|
|
447
451
|
},
|
|
448
452
|
resetPasswordScreen: function (state) {
|
|
449
|
-
state.data.passwordData = initialState.data.passwordData;
|
|
450
453
|
},
|
|
451
454
|
resetIndividualScreen: function (state) {
|
|
452
455
|
state.data.individualData = initialState.data.individualData;
|
|
453
456
|
},
|
|
454
457
|
resetMerchantScreen: function (state) {
|
|
455
|
-
state.data.brandData = initialState.data.brandData;
|
|
456
458
|
}
|
|
457
459
|
},
|
|
458
460
|
extraReducers: function (builder) {
|
|
@@ -528,8 +530,12 @@ export var connectSlice = createSlice({
|
|
|
528
530
|
if (!!leadResponse && !leadError) {
|
|
529
531
|
var name_1 = leadResponse.name, contact = leadResponse.contact;
|
|
530
532
|
var email = (contact || {}).email;
|
|
533
|
+
var firstName = (name_1 === null || name_1 === void 0 ? void 0 : name_1.first) + ' ';
|
|
534
|
+
var middleName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.middle) ? (name_1 === null || name_1 === void 0 ? void 0 : name_1.middle) + ' ' : '';
|
|
535
|
+
var thirdName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.third) ? (name_1 === null || name_1 === void 0 ? void 0 : name_1.third) + ' ' : '';
|
|
536
|
+
var lastName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.last) ? name_1 === null || name_1 === void 0 ? void 0 : name_1.middle : '';
|
|
531
537
|
if (!!name_1) {
|
|
532
|
-
var capitalizedName = capitalizeTheFirstLetterOfEachWord(
|
|
538
|
+
var capitalizedName = capitalizeTheFirstLetterOfEachWord(firstName + middleName + thirdName + lastName);
|
|
533
539
|
state.data.individualData.name = capitalizedName;
|
|
534
540
|
}
|
|
535
541
|
if (!!email)
|
|
@@ -15,32 +15,19 @@ import { useSelector } from 'react-redux';
|
|
|
15
15
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
16
16
|
import { useTranslation } from 'react-i18next';
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
-
import Box from '@mui/material/Box';
|
|
19
|
-
import { styled } from '@mui/material/styles';
|
|
20
18
|
import { useAppDispatch } from '../../../../hooks';
|
|
21
19
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
22
20
|
import Form from '../../../../components/Form';
|
|
23
21
|
import Collapse from '../../../../components/Collapse';
|
|
24
22
|
import { useLanguage } from '../../../../hooks';
|
|
25
23
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
26
|
-
import { businessSelector, clearError, updateLeadBusinessType } from '../../../app/business/businessStore';
|
|
24
|
+
import { businessSelector, clearError, retrieveCRInfos, retrieveFLInfos, updateLeadBusinessType } from '../../../app/business/businessStore';
|
|
27
25
|
import { BusinessType as BusinessTypeEnum } from '../../../../@types';
|
|
28
26
|
import Button from '../../../shared/Button';
|
|
29
27
|
import { CRValidationSchema, FLValidationSchema } from './validation';
|
|
30
28
|
import SelectType from './SelectType';
|
|
31
29
|
import FreelanceLicense from './FreelanceLicense';
|
|
32
30
|
import CompanyLicense from './CompanyLicense';
|
|
33
|
-
var InputsContainerStyled = styled(Box)(function (_a) {
|
|
34
|
-
var _b;
|
|
35
|
-
var theme = _a.theme, listActive = _a.listActive;
|
|
36
|
-
return (_b = {
|
|
37
|
-
paddingBottom: theme.spacing(listActive ? 0 : 5)
|
|
38
|
-
},
|
|
39
|
-
_b[theme.transitions.create(['padding-bottom'])] = {
|
|
40
|
-
duration: theme.transitions.duration.standard
|
|
41
|
-
},
|
|
42
|
-
_b);
|
|
43
|
-
});
|
|
44
31
|
var BusinessType = function (_a) {
|
|
45
32
|
var _b = React.useState(false), isCR = _b[0], setIsCR = _b[1];
|
|
46
33
|
var _c = useSelector(businessSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
@@ -54,8 +41,13 @@ var BusinessType = function (_a) {
|
|
|
54
41
|
defaultValues: data.businessTypeData,
|
|
55
42
|
mode: 'onChange'
|
|
56
43
|
});
|
|
44
|
+
React.useEffect(function () {
|
|
45
|
+
dispatch(retrieveFLInfos());
|
|
46
|
+
dispatch(retrieveCRInfos());
|
|
47
|
+
}, []);
|
|
57
48
|
React.useEffect(function () {
|
|
58
49
|
var businessType = businessTypeData.businessType;
|
|
50
|
+
methods.setValue('businessType', businessType);
|
|
59
51
|
if (businessType === BusinessTypeEnum.CR)
|
|
60
52
|
setIsCR(true);
|
|
61
53
|
}, [businessTypeData.businessType]);
|
|
@@ -73,14 +65,15 @@ var BusinessType = function (_a) {
|
|
|
73
65
|
dispatch(handlePrevScreenStep());
|
|
74
66
|
};
|
|
75
67
|
var disabled = !methods.formState.isValid || !!error;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
68
|
+
var disableBack = !data.otpData.isNID;
|
|
69
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(SelectType, { show: !listActive, onSwitchToCR: function () { return setIsCR(true); }, onSwitchToFL: function () { return setIsCR(false); } }), _jsx(CompanyLicense, { show: isCR, list: data.crInfos, onListOpen: function () {
|
|
70
|
+
setListActive(true);
|
|
71
|
+
}, onListClose: function () {
|
|
72
|
+
setListActive(false);
|
|
73
|
+
} }), _jsx(FreelanceLicense, { show: !isCR, list: data.flInfos, onListOpen: function () {
|
|
74
|
+
setListActive(true);
|
|
75
|
+
}, onListClose: function () {
|
|
76
|
+
setListActive(false);
|
|
77
|
+
} }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ disableBack: disableBack, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
85
78
|
};
|
|
86
79
|
export default React.memo(BusinessType);
|
|
@@ -20,6 +20,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
24
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
25
|
+
if (ar || !(i in from)) {
|
|
26
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27
|
+
ar[i] = from[i];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
|
+
};
|
|
23
32
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
33
|
import * as React from 'react';
|
|
25
34
|
import { useTranslation } from 'react-i18next';
|
|
@@ -54,9 +63,9 @@ var LicenseNameText = styled(Text, { shouldForwardProp: function (prop) { return
|
|
|
54
63
|
});
|
|
55
64
|
var CompanyLicense = function (_a) {
|
|
56
65
|
var show = _a.show, list = _a.list, rest = __rest(_a, ["show", "list"]);
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
var
|
|
66
|
+
var _b = React.useState(list), licenseList = _b[0], setLicenseList = _b[1];
|
|
67
|
+
var _c = React.useState(), selectedLicense = _c[0], setSelectedLicense = _c[1];
|
|
68
|
+
var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
|
|
60
69
|
var t = useTranslation().t;
|
|
61
70
|
var isAr = useLanguage().isAr;
|
|
62
71
|
var setValue = useFormContext().setValue;
|
|
@@ -71,12 +80,17 @@ var CompanyLicense = function (_a) {
|
|
|
71
80
|
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
72
81
|
};
|
|
73
82
|
React.useEffect(function () {
|
|
74
|
-
var
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
|
|
83
|
+
var array = list;
|
|
84
|
+
if ((array === null || array === void 0 ? void 0 : array.length) > 0) {
|
|
85
|
+
var hasOther = array === null || array === void 0 ? void 0 : array.find(function (item) { return isOtherLicense(item); });
|
|
86
|
+
var first = array[0];
|
|
87
|
+
if (first) {
|
|
88
|
+
setSelectedLicense(first);
|
|
89
|
+
setValue('crNumber', getLicenseNumber(first), { shouldValidate: true });
|
|
90
|
+
if (!hasOther)
|
|
91
|
+
array = __spreadArray(__spreadArray([], array, true), [OTHER_CR_LICENSE], false);
|
|
92
|
+
setLicenseList(array);
|
|
93
|
+
}
|
|
80
94
|
}
|
|
81
95
|
}, [show, list]);
|
|
82
96
|
var getLicenseNumber = function (item) {
|
|
@@ -20,6 +20,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
24
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
25
|
+
if (ar || !(i in from)) {
|
|
26
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27
|
+
ar[i] = from[i];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
|
+
};
|
|
23
32
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
33
|
import * as React from 'react';
|
|
25
34
|
import { useTranslation } from 'react-i18next';
|
|
@@ -54,9 +63,9 @@ var LicenseNameText = styled(Text, { shouldForwardProp: function (prop) { return
|
|
|
54
63
|
});
|
|
55
64
|
var FreelanceLicense = function (_a) {
|
|
56
65
|
var show = _a.show, list = _a.list, rest = __rest(_a, ["show", "list"]);
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
var
|
|
66
|
+
var _b = React.useState(list), licenseList = _b[0], setLicenseList = _b[1];
|
|
67
|
+
var _c = React.useState(), selectedLicense = _c[0], setSelectedLicense = _c[1];
|
|
68
|
+
var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
|
|
60
69
|
var t = useTranslation().t;
|
|
61
70
|
var isAr = useLanguage().isAr;
|
|
62
71
|
var setValue = useFormContext().setValue;
|
|
@@ -71,12 +80,17 @@ var FreelanceLicense = function (_a) {
|
|
|
71
80
|
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
72
81
|
};
|
|
73
82
|
React.useEffect(function () {
|
|
74
|
-
var
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
|
|
83
|
+
var array = list;
|
|
84
|
+
if ((array === null || array === void 0 ? void 0 : array.length) > 0) {
|
|
85
|
+
var hasOther = array === null || array === void 0 ? void 0 : array.find(function (item) { return isOtherLicense(item); });
|
|
86
|
+
var first = array[0];
|
|
87
|
+
if (!!first) {
|
|
88
|
+
setSelectedLicense(first);
|
|
89
|
+
setValue('flNumber', getLicenseNumber(first), { shouldValidate: true });
|
|
90
|
+
if (!hasOther)
|
|
91
|
+
array = __spreadArray(__spreadArray([], array, true), [OTHER_FL_LICENSE], false);
|
|
92
|
+
setLicenseList(array);
|
|
93
|
+
}
|
|
80
94
|
}
|
|
81
95
|
}, [show, list]);
|
|
82
96
|
var getLicenseNumber = function (item) {
|
|
@@ -37,8 +37,8 @@ var Confirm = function () {
|
|
|
37
37
|
var dispatch = useAppDispatch();
|
|
38
38
|
var t = useTranslation().t;
|
|
39
39
|
var isAr = useLanguage().isAr;
|
|
40
|
-
var
|
|
41
|
-
var
|
|
40
|
+
var _a = useSelector(businessSelector), data = _a.data, loading = _a.loading, error = _a.error;
|
|
41
|
+
var _b = data.businessInfo, licenseNumber = _b.licenseNumber, brandName = _b.brandName, legalName = _b.legalName;
|
|
42
42
|
var isCR = data.businessTypeData.businessType === BusinessTypeEnum.CR;
|
|
43
43
|
var onSubmit = function () {
|
|
44
44
|
dispatch(createAccount());
|
|
@@ -50,6 +50,7 @@ var Confirm = function () {
|
|
|
50
50
|
var onBack = function () {
|
|
51
51
|
dispatch(handlePrevScreenStep());
|
|
52
52
|
};
|
|
53
|
-
|
|
53
|
+
var disabled = !methods.formState.isValid || !!error;
|
|
54
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputStyled, { label: t(isCR ? 'signup_business_cr_info_title' : 'signup_business_fl_info_title'), value: licenseNumber, disabled: true }), _jsx(InputStyled, { label: t('signup_brand_name_label'), value: brandName, disabled: true }), _jsx(InputStyled, { sx: { marginBlockEnd: 0 }, label: t('signup_legal_name_label'), value: legalName, disabled: true }), _jsx(Button, __assign({ disabled: disabled, loading: loading, error: t(error || ''), onBackClicked: function () { return onBack(); }, isAr: isAr }, { children: t('confirm') }))] })) })) }));
|
|
54
55
|
};
|
|
55
56
|
export default React.memo(Confirm);
|
|
@@ -25,8 +25,7 @@ var BoxStyled = styled(Box)(function (_a) {
|
|
|
25
25
|
return ({
|
|
26
26
|
display: 'flex',
|
|
27
27
|
flexDirection: 'column',
|
|
28
|
-
fontFamily: theme.typography.fontFamily
|
|
29
|
-
marginBottom: theme.spacing(5)
|
|
28
|
+
fontFamily: theme.typography.fontFamily
|
|
30
29
|
});
|
|
31
30
|
});
|
|
32
31
|
var OTPInput = function (_a) {
|
|
@@ -22,8 +22,7 @@ var BoxStyled = styled(Box)(function (_a) {
|
|
|
22
22
|
return ({
|
|
23
23
|
display: 'flex',
|
|
24
24
|
flexDirection: 'column',
|
|
25
|
-
fontFamily: theme.typography.fontFamily
|
|
26
|
-
marginBottom: theme.spacing(5)
|
|
25
|
+
fontFamily: theme.typography.fontFamily
|
|
27
26
|
});
|
|
28
27
|
});
|
|
29
28
|
var OTPInput = function (_a) {
|
|
@@ -68,8 +68,8 @@ var VerifyNumber = function (_a) {
|
|
|
68
68
|
var onBack = function () {
|
|
69
69
|
dispatch(handlePrevScreenStep());
|
|
70
70
|
};
|
|
71
|
-
var
|
|
72
|
-
var
|
|
73
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone)) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, type: 'submit', isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
71
|
+
var phone = (_d = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.phone) === null || _d === void 0 ? void 0 : _d.number;
|
|
72
|
+
var disabled = !methods.formState.isValid || !!error || !phone;
|
|
73
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, type: 'submit', isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
74
74
|
};
|
|
75
75
|
export default React.memo(VerifyNumber);
|
|
@@ -21,6 +21,15 @@ import { checkEmailAvailability } from '../../../app/connect/connectStore';
|
|
|
21
21
|
import { useAppDispatch } from '../../../../hooks';
|
|
22
22
|
import { debounce } from 'lodash-es';
|
|
23
23
|
import Collapse from '../../../../components/Collapse';
|
|
24
|
+
import { styled } from '@mui/material/styles';
|
|
25
|
+
var InputStyled = styled(Input)(function (_a) {
|
|
26
|
+
var theme = _a.theme;
|
|
27
|
+
return ({
|
|
28
|
+
input: {
|
|
29
|
+
textTransform: 'lowercase'
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
24
33
|
var Email = function (_a) {
|
|
25
34
|
var _b;
|
|
26
35
|
var show = _a.show;
|
|
@@ -45,6 +54,6 @@ var Email = function (_a) {
|
|
|
45
54
|
var clearNumber = function () {
|
|
46
55
|
emailControl.field.onChange('');
|
|
47
56
|
};
|
|
48
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(
|
|
57
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('signup_email_lable'), value: emailValue, onChange: handleEmailChange, type: 'email', placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && emailValue ? _jsx(CheckIcon, {}) : emailValue && _jsx(ClearIcon, { onClick: clearNumber }) }) }) })));
|
|
49
58
|
};
|
|
50
59
|
export default React.memo(Email);
|
|
@@ -34,14 +34,14 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
34
34
|
flexDirection: 'column'
|
|
35
35
|
}); });
|
|
36
36
|
var Individual = function (_a) {
|
|
37
|
-
var _b, _c, _d
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
37
|
+
var _b, _c, _d;
|
|
38
|
+
var _e = React.useState(false), listActive = _e[0], setListActive = _e[1];
|
|
39
|
+
var _f = useSelector(connectSelector), data = _f.data, loading = _f.loading, error = _f.error, searchActive = _f.searchActive;
|
|
40
|
+
var _g = React.useState(data.individualData.countryCode.digits), mobileLength = _g[0], setMobileLength = _g[1];
|
|
41
41
|
var dispatch = useAppDispatch();
|
|
42
42
|
var t = useTranslation().t;
|
|
43
43
|
var isAr = useLanguage().isAr;
|
|
44
|
-
var isAbsher = (
|
|
44
|
+
var isAbsher = (_b = data.otpData) === null || _b === void 0 ? void 0 : _b.isAbsher;
|
|
45
45
|
var individualData = data.individualData;
|
|
46
46
|
var methods = useForm({
|
|
47
47
|
resolver: yupResolver(isAbsher ? IndividualMobileValidation(mobileLength) : IndividualValidation()),
|
|
@@ -57,12 +57,10 @@ var Individual = function (_a) {
|
|
|
57
57
|
React.useEffect(function () {
|
|
58
58
|
if (error)
|
|
59
59
|
dispatch(clearError());
|
|
60
|
-
}, [methods.formState.isValid]);
|
|
61
|
-
React.useEffect(function () {
|
|
62
60
|
return function () {
|
|
63
61
|
dispatch(resetIndividualScreen());
|
|
64
62
|
};
|
|
65
|
-
}, []);
|
|
63
|
+
}, [methods.formState.isValid]);
|
|
66
64
|
React.useEffect(function () {
|
|
67
65
|
var name = individualData.name, email = individualData.email, mobile = individualData.mobile, countryCode = individualData.countryCode;
|
|
68
66
|
if (!!name)
|
|
@@ -81,9 +79,9 @@ var Individual = function (_a) {
|
|
|
81
79
|
var _a, _b;
|
|
82
80
|
if (((_b = (_a = data.individualData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.is_available) === false)
|
|
83
81
|
methods.setError('email', { message: 'tap_js_email_already_exist' });
|
|
84
|
-
}, [(
|
|
82
|
+
}, [(_c = data.individualData) === null || _c === void 0 ? void 0 : _c.responseBody]);
|
|
85
83
|
var emailErrChecks = !methods.formState.isValid || !!methods.formState.errors.email || !!error;
|
|
86
|
-
var disabled = emailErrChecks || searchActive || !((
|
|
84
|
+
var disabled = emailErrChecks || searchActive || !((_d = data.individualData.responseBody) === null || _d === void 0 ? void 0 : _d.is_available);
|
|
87
85
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Name, { show: !listActive }), _jsx(MobileNumber, { setMobileLength: setMobileLength, show: isAbsher, onListOpen: function () { return handleMenuListClick(); }, onListClose: function () { return handleMenuListClick(); }, countries: countriesCode }), _jsx(Email, { show: !listActive }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
88
86
|
};
|
|
89
87
|
export default React.memo(Individual);
|