@tap-payments/auth-jsconnect 1.0.36 → 1.0.40
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 +4 -4
- package/build/components/AnimationFlow/BottomSheet.js +26 -2
- package/build/components/OTPTimer/OTPTimer.js +4 -2
- package/build/constants/app.js +2 -2
- package/build/constants/dummy.d.ts +2 -2
- package/build/constants/dummy.js +6 -6
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/business/businessStore.d.ts +4 -6
- package/build/features/app/business/businessStore.js +43 -30
- package/build/features/app/connect/connectStore.d.ts +1 -1
- package/build/features/app/connect/connectStore.js +23 -15
- package/build/features/business/screens/Activities/Activities.js +10 -5
- package/build/features/business/screens/Activities/ActivitiesList.js +1 -1
- package/build/features/business/screens/Activities/OperationStartDate.js +1 -12
- package/build/features/business/screens/Activities/SalesChannels.js +1 -1
- 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/Customers/Customers.js +1 -1
- package/build/features/business/screens/OTP/OTP.js +5 -2
- 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 +7 -4
- 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/BrandName.js +6 -2
- 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/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +1 -1
- package/build/features/shared/Button/Button.js +13 -3
- 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
|
@@ -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);
|
|
@@ -57,7 +57,7 @@ var Customers = function (_a) {
|
|
|
57
57
|
});
|
|
58
58
|
var onSubmit = function (data) {
|
|
59
59
|
console.log('data', data);
|
|
60
|
-
dispatch(updateCustomersInfo(__assign(
|
|
60
|
+
dispatch(updateCustomersInfo(__assign({}, data)));
|
|
61
61
|
};
|
|
62
62
|
var onBack = function () {
|
|
63
63
|
dispatch(handlePrevScreenStep());
|
|
@@ -23,7 +23,7 @@ import { useLanguage } from '../../../../hooks';
|
|
|
23
23
|
import Form from '../../../../components/Form';
|
|
24
24
|
import Text from '../../../../components/Text';
|
|
25
25
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
26
|
-
import { businessSelector, clearError, verifyLeadOTP } from '../../../app/business/businessStore';
|
|
26
|
+
import { businessSelector, clearError, resetOTPScreen, verifyLeadOTP } from '../../../app/business/businessStore';
|
|
27
27
|
import Button from '../../../shared/Button';
|
|
28
28
|
import { maskID } from '../../../../utils';
|
|
29
29
|
import { OTPValidation } from './validation';
|
|
@@ -41,7 +41,7 @@ var OTPTitleContainerStyled = styled(Box)(function (_a) {
|
|
|
41
41
|
});
|
|
42
42
|
var OTPTitleStyled = styled(Text)(function (_a) {
|
|
43
43
|
var theme = _a.theme;
|
|
44
|
-
return (__assign(__assign({}, theme.typography.body1), { fontWeight: theme.typography.fontWeightLight, color: theme.palette.text.primary, marginBlock: theme.spacing(1.75),
|
|
44
|
+
return (__assign(__assign({}, theme.typography.body1), { fontWeight: theme.typography.fontWeightLight, color: theme.palette.text.primary, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
|
|
45
45
|
});
|
|
46
46
|
var FormStyled = styled(Form)(function () { return ({
|
|
47
47
|
display: 'flex',
|
|
@@ -60,6 +60,9 @@ var OTP = function (_a) {
|
|
|
60
60
|
React.useEffect(function () {
|
|
61
61
|
if (error)
|
|
62
62
|
dispatch(clearError());
|
|
63
|
+
return function () {
|
|
64
|
+
dispatch(resetOTPScreen());
|
|
65
|
+
};
|
|
63
66
|
}, [methods.formState.isValid]);
|
|
64
67
|
var onSubmit = function (formData) {
|
|
65
68
|
dispatch(verifyLeadOTP(formData));
|
|
@@ -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) {
|
|
@@ -24,7 +24,7 @@ import { maskPhone } from '../../../../utils';
|
|
|
24
24
|
import Form from '../../../../components/Form';
|
|
25
25
|
import Text from '../../../../components/Text';
|
|
26
26
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
27
|
-
import { businessSelector, clearError, verifyLeadOTP } from '../../../app/business/businessStore';
|
|
27
|
+
import { businessSelector, clearError, resetOTPScreen, verifyLeadOTP } from '../../../app/business/businessStore';
|
|
28
28
|
import Button from '../../../shared/Button';
|
|
29
29
|
import { OTPValidation } from './validation';
|
|
30
30
|
import OTPInput from './OTPInput';
|
|
@@ -61,6 +61,9 @@ var VerifyNumber = function (_a) {
|
|
|
61
61
|
React.useEffect(function () {
|
|
62
62
|
if (error)
|
|
63
63
|
dispatch(clearError());
|
|
64
|
+
return function () {
|
|
65
|
+
dispatch(resetOTPScreen());
|
|
66
|
+
};
|
|
64
67
|
}, [methods.formState.isValid]);
|
|
65
68
|
var onSubmit = function (formData) {
|
|
66
69
|
dispatch(verifyLeadOTP(formData));
|
|
@@ -68,8 +71,8 @@ var VerifyNumber = function (_a) {
|
|
|
68
71
|
var onBack = function () {
|
|
69
72
|
dispatch(handlePrevScreenStep());
|
|
70
73
|
};
|
|
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') }))] })) })) }));
|
|
74
|
+
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;
|
|
75
|
+
var disabled = !methods.formState.isValid || !!error || !phone;
|
|
76
|
+
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
77
|
};
|
|
75
78
|
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);
|
|
@@ -36,7 +36,6 @@ import Input from '../../../shared/Input';
|
|
|
36
36
|
import SimpleList from '../../../../components/SimpleList';
|
|
37
37
|
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
38
38
|
import { useLanguage } from '../../../../hooks';
|
|
39
|
-
import { SAUDI_NUMBER_LENGTH } from '../../../../constants';
|
|
40
39
|
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
41
40
|
var theme = _a.theme;
|
|
42
41
|
return ({
|
|
@@ -87,23 +86,11 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
87
86
|
var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
|
|
88
87
|
var error = (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
|
|
89
88
|
var isSA = countryCodeValue.iso2 === 'SA';
|
|
90
|
-
var
|
|
91
|
-
var mobileLen = isSA
|
|
92
|
-
? isStartingWithZero
|
|
93
|
-
? countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits
|
|
94
|
-
: SAUDI_NUMBER_LENGTH
|
|
95
|
-
: countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
89
|
+
var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
96
90
|
React.useEffect(function () {
|
|
97
|
-
if (mobileValue)
|
|
91
|
+
if (mobileValue)
|
|
98
92
|
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
99
|
-
}
|
|
100
93
|
}, []);
|
|
101
|
-
React.useEffect(function () {
|
|
102
|
-
var _a;
|
|
103
|
-
if ((mobileValue === null || mobileValue === void 0 ? void 0 : mobileValue.length) === 1 && isSA) {
|
|
104
|
-
(_a = rest.setMobileLength) === null || _a === void 0 ? void 0 : _a.call(rest, mobileLen);
|
|
105
|
-
}
|
|
106
|
-
}, [mobileValue]);
|
|
107
94
|
var onPhoneNumberChange = function (_a) {
|
|
108
95
|
var target = _a.target;
|
|
109
96
|
var value = removeAllCharsFromNumber(target.value);
|
|
@@ -129,7 +116,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
129
116
|
countryCodeControl.field.onChange(country);
|
|
130
117
|
(_a = rest.setMobileLength) === null || _a === void 0 ? void 0 : _a.call(rest, country.digits);
|
|
131
118
|
};
|
|
132
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mb: 3 }, ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: mobileLen }, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: mobileLen }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
119
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mb: 3 }, ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, type: 'tel', inputProps: { maxLength: mobileLen }, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: mobileLen }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
133
120
|
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
|
|
134
121
|
} }) }))] })) })));
|
|
135
122
|
});
|
|
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
+
import { useSelector } from 'react-redux';
|
|
14
15
|
import { useTranslation } from 'react-i18next';
|
|
15
16
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
17
|
import Box from '@mui/material/Box';
|
|
@@ -24,7 +25,7 @@ import ClearIcon from '../../../shared/ClearIcon';
|
|
|
24
25
|
import Tooltip from '../../../../components/Tooltip';
|
|
25
26
|
import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
|
|
26
27
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
27
|
-
import { checkBrandNameAvailability } from '../../../app/connect/connectStore';
|
|
28
|
+
import { checkBrandNameAvailability, connectSelector } from '../../../app/connect/connectStore';
|
|
28
29
|
import { useAppDispatch } from '../../../../hooks';
|
|
29
30
|
import { debounce } from 'lodash-es';
|
|
30
31
|
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
@@ -66,6 +67,7 @@ var BrandName = function (_a) {
|
|
|
66
67
|
var brandControl = useController({ control: control, name: 'brandName' });
|
|
67
68
|
var brandNameValue = brandControl.field.value;
|
|
68
69
|
var error = (_b = brandControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
70
|
+
var data = useSelector(connectSelector).data;
|
|
69
71
|
var checkBrand = debounce(function (value) {
|
|
70
72
|
dispatch(checkBrandNameAvailability(value));
|
|
71
73
|
}, 500);
|
|
@@ -75,9 +77,11 @@ var BrandName = function (_a) {
|
|
|
75
77
|
brandControl.field.onChange(value);
|
|
76
78
|
};
|
|
77
79
|
React.useEffect(function () {
|
|
80
|
+
var _a;
|
|
78
81
|
var isValid = brandNameValue && !error && brandNameValue.length > 2;
|
|
82
|
+
var brandName = brandNameValue + ((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2);
|
|
79
83
|
if (isValid)
|
|
80
|
-
checkBrand(
|
|
84
|
+
checkBrand(brandName);
|
|
81
85
|
}, [brandNameValue, error]);
|
|
82
86
|
var clearBrandName = function () {
|
|
83
87
|
brandControl.field.onChange('');
|
|
@@ -20,15 +20,15 @@ import { handlePrevScreenStep } from '../../../../app/settings';
|
|
|
20
20
|
import Form from '../../../../components/Form';
|
|
21
21
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
22
22
|
import Button from '../../../shared/Button';
|
|
23
|
-
import { clearError, connectSelector,
|
|
23
|
+
import { clearError, connectSelector, updateLeadBrand } from '../../../app/connect/connectStore';
|
|
24
24
|
import { useLanguage } from '../../../../hooks';
|
|
25
25
|
import { MerchantValidationSchema } from './validation';
|
|
26
26
|
import BrandName from './BrandName';
|
|
27
27
|
import SocialMedia from './SocialMedia';
|
|
28
28
|
import TAC from './TAC';
|
|
29
29
|
var Merchant = function (_a) {
|
|
30
|
-
var _b, _c, _d;
|
|
31
|
-
var
|
|
30
|
+
var _b, _c, _d, _e;
|
|
31
|
+
var _f = useSelector(connectSelector), data = _f.data, loading = _f.loading, error = _f.error, searchActive = _f.searchActive;
|
|
32
32
|
var methods = useForm({
|
|
33
33
|
resolver: yupResolver(MerchantValidationSchema),
|
|
34
34
|
defaultValues: data.brandData,
|
|
@@ -37,28 +37,28 @@ var Merchant = function (_a) {
|
|
|
37
37
|
var t = useTranslation().t;
|
|
38
38
|
var isAr = useLanguage().isAr;
|
|
39
39
|
var dispatch = useAppDispatch();
|
|
40
|
+
var isNewUser = (_b = data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.new_user;
|
|
40
41
|
var onSubmit = function (formData) {
|
|
41
42
|
dispatch(updateLeadBrand(formData));
|
|
42
43
|
};
|
|
43
44
|
var onBack = function () {
|
|
44
|
-
|
|
45
|
+
if (isNewUser) {
|
|
46
|
+
dispatch(handlePrevScreenStep('CONNECT_INDIVIDUAL_STEP'));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
dispatch(handlePrevScreenStep('CONNECT_PASSWORD_STEP'));
|
|
45
50
|
};
|
|
46
51
|
React.useEffect(function () {
|
|
47
52
|
if (error)
|
|
48
53
|
dispatch(clearError());
|
|
49
54
|
}, [methods.formState.isValid]);
|
|
50
|
-
React.useEffect(function () {
|
|
51
|
-
return function () {
|
|
52
|
-
dispatch(resetMerchantScreen());
|
|
53
|
-
};
|
|
54
|
-
}, []);
|
|
55
55
|
React.useEffect(function () {
|
|
56
56
|
var _a, _b;
|
|
57
57
|
if (((_b = (_a = data.brandData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.response_code) === '5')
|
|
58
58
|
methods.setError('brandName', { message: 'Profile Name already exists' });
|
|
59
|
-
}, [(
|
|
59
|
+
}, [(_c = data.brandData) === null || _c === void 0 ? void 0 : _c.responseBody]);
|
|
60
60
|
var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
|
|
61
|
-
var disabled = brandErrChecks || searchActive || ((
|
|
61
|
+
var disabled = brandErrChecks || searchActive || ((_e = (_d = data.brandData) === null || _d === void 0 ? void 0 : _d.responseBody) === null || _e === void 0 ? void 0 : _e.response_code) === '5';
|
|
62
62
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, {}), _jsx(SocialMedia, {}), _jsx(TAC, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] })) })) }));
|
|
63
63
|
};
|
|
64
64
|
export default React.memo(Merchant);
|
|
@@ -35,7 +35,8 @@ var InputStyled = styled(Input)(function (_a) {
|
|
|
35
35
|
padding: theme.spacing(0, 2, 0, 0),
|
|
36
36
|
paddingInlineEnd: theme.spacing(2),
|
|
37
37
|
input: {
|
|
38
|
-
paddingInlineStart: theme.spacing(0)
|
|
38
|
+
paddingInlineStart: theme.spacing(0),
|
|
39
|
+
textTransform: 'lowercase'
|
|
39
40
|
}
|
|
40
41
|
});
|
|
41
42
|
});
|
|
@@ -34,7 +34,7 @@ var TACContainerStyled = styled(Box)(function (_a) {
|
|
|
34
34
|
});
|
|
35
35
|
var TextStyled = styled(Text)(function (_a) {
|
|
36
36
|
var theme = _a.theme;
|
|
37
|
-
return (__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre', height: 'fit-content' }, theme.typography.body2));
|
|
37
|
+
return (__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre-line', height: 'fit-content' }, theme.typography.body2));
|
|
38
38
|
});
|
|
39
39
|
var LinkStyled = styled(Link)(function (_a) {
|
|
40
40
|
var theme = _a.theme;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { REGEX_WEBSITE } from '../../../../constants';
|
|
1
2
|
import * as yup from 'yup';
|
|
2
3
|
export var MerchantValidationSchema = yup.object().shape({
|
|
3
4
|
brandName: yup
|
|
@@ -11,7 +12,7 @@ export var MerchantValidationSchema = yup.object().shape({
|
|
|
11
12
|
if (!instagram && !twitter) {
|
|
12
13
|
return yup
|
|
13
14
|
.string()
|
|
14
|
-
.matches(
|
|
15
|
+
.matches(REGEX_WEBSITE, 'ide_not_valid_url')
|
|
15
16
|
.transform(function (value) { return (!!value ? value : null); })
|
|
16
17
|
.nullable()
|
|
17
18
|
.required('enter_at_least_one');
|
|
@@ -19,7 +20,7 @@ export var MerchantValidationSchema = yup.object().shape({
|
|
|
19
20
|
else {
|
|
20
21
|
return yup
|
|
21
22
|
.string()
|
|
22
|
-
.matches(
|
|
23
|
+
.matches(REGEX_WEBSITE, 'ide_not_valid_url')
|
|
23
24
|
.transform(function (value) { return (!!value ? value : null); })
|
|
24
25
|
.nullable()
|
|
25
26
|
.optional();
|
|
@@ -35,6 +35,6 @@ var BusinessCountry = React.forwardRef(function (_a, ref) {
|
|
|
35
35
|
var country = _a.country, show = _a.show;
|
|
36
36
|
var t = useTranslation().t;
|
|
37
37
|
var isAr = useLanguage().isAr;
|
|
38
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ ref: ref, sx: { marginBottom: '25px' } }, { children: _jsx(Input, { sx: { cursor: 'auto' }, label: t('signup_select_country'), readOnly: true, startAdornment: _jsx(CountrySpanStyled, { children: _jsx(CountryIconStyled, { src: (country === null || country === void 0 ? void 0 : country.logo) || '' }) }), placeholder: t('ide_mobile_placeholder'), value: (isAr ? (_b = country === null || country === void 0 ? void 0 : country.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = country === null || country === void 0 ? void 0 : country.name) === null || _c === void 0 ? void 0 : _c.english) || '' }) })) })));
|
|
38
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ ref: ref, sx: { marginBottom: '25px' } }, { children: _jsx(Input, { sx: { cursor: 'auto' }, label: t('signup_select_country'), readOnly: true, disabled: true, startAdornment: _jsx(CountrySpanStyled, { children: _jsx(CountryIconStyled, { src: (country === null || country === void 0 ? void 0 : country.logo) || '' }) }), placeholder: t('ide_mobile_placeholder'), value: (isAr ? (_b = country === null || country === void 0 ? void 0 : country.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = country === null || country === void 0 ? void 0 : country.name) === null || _c === void 0 ? void 0 : _c.english) || '' }) })) })));
|
|
39
39
|
});
|
|
40
40
|
export default React.memo(BusinessCountry);
|
|
@@ -23,7 +23,7 @@ import Button, { AbsherButton } from '../../../shared/Button';
|
|
|
23
23
|
import { useAppDispatch } from '../../../../hooks';
|
|
24
24
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
25
25
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
26
|
-
import { clearError,
|
|
26
|
+
import { clearError, connectSelector, createMobileAuth } from '../../../app/connect/connectStore';
|
|
27
27
|
import { useLanguage } from '../../../../hooks';
|
|
28
28
|
import Divider from '@mui/material/Divider';
|
|
29
29
|
import Text from '../../../../components/Text';
|
|
@@ -90,9 +90,6 @@ var Mobile = function (_a) {
|
|
|
90
90
|
setListType(flag);
|
|
91
91
|
};
|
|
92
92
|
React.useEffect(function () {
|
|
93
|
-
if (data.mobileData.countryCode.digits) {
|
|
94
|
-
setMobileLength(data.mobileData.countryCode.digits);
|
|
95
|
-
}
|
|
96
93
|
if (data.mobileData.countryCode) {
|
|
97
94
|
methods.setValue('countryCode', data.mobileData.countryCode);
|
|
98
95
|
}
|
|
@@ -101,11 +98,6 @@ var Mobile = function (_a) {
|
|
|
101
98
|
if (error)
|
|
102
99
|
dispatch(clearError());
|
|
103
100
|
}, [methods.formState.isValid]);
|
|
104
|
-
React.useEffect(function () {
|
|
105
|
-
return function () {
|
|
106
|
-
dispatch(resetMobileScreen());
|
|
107
|
-
};
|
|
108
|
-
}, []);
|
|
109
101
|
var onSubmit = function (formData) {
|
|
110
102
|
dispatch(createMobileAuth(__assign(__assign({}, formData), { isResend: false })));
|
|
111
103
|
};
|
|
@@ -36,7 +36,6 @@ import Input from '../../../shared/Input';
|
|
|
36
36
|
import SimpleList from '../../../../components/SimpleList';
|
|
37
37
|
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
38
38
|
import { useLanguage } from '../../../../hooks';
|
|
39
|
-
import { SAUDI_NUMBER_LENGTH } from '../../../../constants';
|
|
40
39
|
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
41
40
|
var theme = _a.theme;
|
|
42
41
|
return ({
|
|
@@ -87,23 +86,11 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
87
86
|
var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
|
|
88
87
|
var error = (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
|
|
89
88
|
var isSA = countryCodeValue.iso2 === 'SA';
|
|
90
|
-
var
|
|
91
|
-
var mobileLen = isSA
|
|
92
|
-
? isStartingWithZero
|
|
93
|
-
? countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits
|
|
94
|
-
: SAUDI_NUMBER_LENGTH
|
|
95
|
-
: countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
89
|
+
var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
96
90
|
React.useEffect(function () {
|
|
97
|
-
if (mobileValue)
|
|
91
|
+
if (mobileValue)
|
|
98
92
|
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
99
|
-
}
|
|
100
93
|
}, []);
|
|
101
|
-
React.useEffect(function () {
|
|
102
|
-
var _a;
|
|
103
|
-
if (mobileValue.length === 1 && isSA) {
|
|
104
|
-
(_a = rest.setMobileLength) === null || _a === void 0 ? void 0 : _a.call(rest, mobileLen);
|
|
105
|
-
}
|
|
106
|
-
}, [mobileValue]);
|
|
107
94
|
var onPhoneNumberChange = function (_a) {
|
|
108
95
|
var target = _a.target;
|
|
109
96
|
var value = removeAllCharsFromNumber(target.value);
|
|
@@ -129,7 +116,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
129
116
|
countryCodeControl.field.onChange(country);
|
|
130
117
|
(_a = rest.setMobileLength) === null || _a === void 0 ? void 0 : _a.call(rest, country.digits);
|
|
131
118
|
};
|
|
132
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: mobileLen }, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: mobileLen }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
119
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: mobileLen }, type: 'tel', onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: mobileLen }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
133
120
|
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
|
|
134
121
|
} }) }))] })) })));
|
|
135
122
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface IDNumberProps {
|
|
3
3
|
show: boolean;
|
|
4
|
-
onSwitchToMobileNumber?: () => void;
|
|
5
4
|
}
|
|
6
5
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IDNumberProps & React.RefAttributes<unknown>>>;
|
|
7
6
|
export default _default;
|
|
@@ -37,7 +37,7 @@ var InputLabelStyled = styled(Text)(function (_a) {
|
|
|
37
37
|
});
|
|
38
38
|
var IDNumber = React.forwardRef(function (_a, ref) {
|
|
39
39
|
var _b;
|
|
40
|
-
var
|
|
40
|
+
var show = _a.show;
|
|
41
41
|
var t = useTranslation().t;
|
|
42
42
|
var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
|
|
43
43
|
var nidControl = useController({ control: control, name: 'nid' });
|
|
@@ -55,6 +55,6 @@ var IDNumber = React.forwardRef(function (_a, ref) {
|
|
|
55
55
|
};
|
|
56
56
|
var nidValue = nidControl.field.value;
|
|
57
57
|
var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
58
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: '0000000000', warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
|
|
58
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: '0000000000', warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
|
|
59
59
|
});
|
|
60
60
|
export default React.memo(IDNumber);
|