@tap-payments/auth-jsconnect 2.8.98-development → 2.9.0
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/README.md +2 -2
- package/build/@types/app.d.ts +13 -4
- package/build/@types/app.js +8 -0
- package/build/@types/config.d.ts +4 -0
- package/build/@types/form.d.ts +7 -0
- package/build/api/account.d.ts +3 -1
- package/build/api/account.js +7 -0
- package/build/api/auth.d.ts +20 -1
- package/build/api/index.d.ts +8 -4
- package/build/api/lead.d.ts +2 -0
- package/build/api/lead.js +16 -0
- package/build/api/user.d.ts +7 -0
- package/build/api/user.js +9 -1
- package/build/app/rootReducer.d.ts +1 -0
- package/build/app/rootReducer.js +3 -1
- package/build/app/settings.d.ts +1 -0
- package/build/app/settings.js +14 -8
- package/build/app/store.d.ts +2 -0
- package/build/assets/currencies/AEDSymbol.d.ts +7 -0
- package/build/assets/currencies/AEDSymbol.js +28 -0
- package/build/assets/currencies/SARSymbol.d.ts +7 -0
- package/build/assets/currencies/SARSymbol.js +28 -0
- package/build/assets/currencies/index.d.ts +2 -0
- package/build/assets/currencies/index.js +2 -0
- package/build/assets/currencies/utils.d.ts +4 -0
- package/build/assets/currencies/utils.js +6 -0
- package/build/assets/locales/ar.json +40 -12
- package/build/assets/locales/en.json +63 -9
- package/build/components/AnimationFlow/BottomSheet.js +16 -12
- package/build/components/AnimationFlow/Dialog.js +3 -1
- package/build/components/Input/Input.js +1 -1
- package/build/components/TextWithCurrency/TextWithCurrency.d.ts +7 -0
- package/build/components/TextWithCurrency/TextWithCurrency.js +14 -0
- package/build/components/TextWithCurrency/index.d.ts +2 -0
- package/build/components/TextWithCurrency/index.js +2 -0
- package/build/components/Tooltip/Tooltip.js +1 -1
- package/build/constants/api.d.ts +2 -0
- package/build/constants/api.js +4 -0
- package/build/constants/app.d.ts +27 -0
- package/build/constants/app.js +151 -17
- package/build/constants/assets.d.ts +12 -3
- package/build/constants/assets.js +123 -105
- package/build/constants/dummy.js +27 -20
- package/build/constants/flows.d.ts +26 -0
- package/build/constants/flows.js +27 -0
- package/build/constants/index.d.ts +1 -0
- package/build/constants/index.js +1 -0
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/auth/authStore.d.ts +24 -5
- package/build/features/app/auth/authStore.js +197 -95
- package/build/features/app/board/boardStore.d.ts +5 -1
- package/build/features/app/board/boardStore.js +40 -35
- package/build/features/app/business/businessStore.d.ts +10 -1
- package/build/features/app/business/businessStore.js +164 -35
- package/build/features/app/connect/connectStore.d.ts +8 -1
- package/build/features/app/connect/connectStore.js +181 -68
- package/build/features/app/connectExpress/connectExpressStore.d.ts +21 -3
- package/build/features/app/connectExpress/connectExpressStore.js +448 -117
- package/build/features/app/individual/individualStore.d.ts +1 -1
- package/build/features/app/individual/individualStore.js +40 -33
- package/build/features/app/kyc/kycStore.d.ts +67 -0
- package/build/features/app/kyc/kycStore.js +432 -0
- package/build/features/app/signIn/signInStore.js +19 -15
- package/build/features/auth/Auth.d.ts +1 -1
- package/build/features/auth/screens/Mobile/MobileNumber.js +5 -7
- package/build/features/auth/screens/Mobile/validation.js +5 -2
- package/build/features/auth/screens/OTP/OTP.d.ts +13 -2
- package/build/features/auth/screens/OTP/OTP.js +15 -3
- package/build/features/auth/screens/OTP/index.d.ts +1 -2
- package/build/features/auth/screens/Passcode/Passcode.d.ts +16 -0
- package/build/features/auth/screens/Passcode/Passcode.js +82 -0
- package/build/features/auth/screens/Passcode/PasscodeInput.d.ts +6 -0
- package/build/features/auth/screens/Passcode/PasscodeInput.js +42 -0
- package/build/features/auth/screens/Passcode/index.d.ts +2 -0
- package/build/features/auth/screens/Passcode/index.js +2 -0
- package/build/features/auth/screens/Passcode/validation.d.ts +8 -0
- package/build/features/auth/screens/Passcode/validation.js +4 -0
- package/build/features/bank/Bank.d.ts +5 -1
- package/build/features/bank/Bank.js +15 -7
- package/build/features/board/Board.js +1 -1
- package/build/features/brand/Brand.d.ts +5 -1
- package/build/features/brand/Brand.js +15 -7
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +3 -8
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -8
- package/build/features/business/screens/MobileOwnership/CollectMobileOwnership.d.ts +3 -0
- package/build/features/business/screens/MobileOwnership/CollectMobileOwnership.js +103 -0
- package/build/features/business/screens/MobileOwnership/MobileNumber.d.ts +3 -0
- package/build/features/business/screens/MobileOwnership/MobileNumber.js +72 -0
- package/build/features/business/screens/MobileOwnership/index.d.ts +2 -0
- package/build/features/business/screens/MobileOwnership/index.js +2 -0
- package/build/features/business/screens/MobileOwnership/validation.d.ts +8 -0
- package/build/features/business/screens/MobileOwnership/validation.js +38 -0
- package/build/features/connect/Connect.js +1 -1
- package/build/features/connect/screens/Individual/MobileNumber.js +5 -7
- package/build/features/connect/screens/Individual/validation.js +5 -2
- package/build/features/connect/screens/Mobile/MobileNumber.js +5 -7
- package/build/features/connect/screens/Mobile/validation.js +5 -2
- package/build/features/connect/screens/MobileOwnership/CollectMobileOwnership.d.ts +3 -0
- package/build/features/connect/screens/MobileOwnership/CollectMobileOwnership.js +104 -0
- package/build/features/connect/screens/MobileOwnership/MobileNumber.d.ts +3 -0
- package/build/features/connect/screens/MobileOwnership/MobileNumber.js +72 -0
- package/build/features/connect/screens/MobileOwnership/index.d.ts +2 -0
- package/build/features/connect/screens/MobileOwnership/index.js +2 -0
- package/build/features/connect/screens/MobileOwnership/validation.d.ts +8 -0
- package/build/features/connect/screens/MobileOwnership/validation.js +38 -0
- package/build/features/connectExpress/ConnectExpress.js +1 -1
- package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.js +5 -7
- package/build/features/connectExpress/screens/CollectIndividualInfo/validation.js +5 -2
- package/build/features/connectExpress/screens/GenericPrepareDataLoading/GenericPrepareDataLoading.d.ts +3 -0
- package/build/features/connectExpress/screens/GenericPrepareDataLoading/GenericPrepareDataLoading.js +9 -0
- package/build/features/connectExpress/screens/GenericPrepareDataLoading/index.d.ts +2 -0
- package/build/features/connectExpress/screens/GenericPrepareDataLoading/index.js +2 -0
- package/build/features/connectExpress/screens/Mobile/MobileNumber.js +5 -7
- package/build/features/connectExpress/screens/Mobile/validation.js +9 -4
- package/build/features/connectExpress/screens/MobileOwnership/CollectMobileOwnership.d.ts +3 -0
- package/build/features/connectExpress/screens/MobileOwnership/CollectMobileOwnership.js +106 -0
- package/build/features/connectExpress/screens/MobileOwnership/MobileNumber.d.ts +3 -0
- package/build/features/connectExpress/screens/MobileOwnership/MobileNumber.js +72 -0
- package/build/features/connectExpress/screens/MobileOwnership/index.d.ts +2 -0
- package/build/features/connectExpress/screens/MobileOwnership/index.js +2 -0
- package/build/features/connectExpress/screens/MobileOwnership/validation.d.ts +8 -0
- package/build/features/connectExpress/screens/MobileOwnership/validation.js +38 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/OTPInput.d.ts +5 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/OTPInput.js +49 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/VerifyMobileAuthOTP.d.ts +5 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/VerifyMobileAuthOTP.js +88 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/index.d.ts +3 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/index.js +2 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/validation.d.ts +8 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/validation.js +4 -0
- package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.js +9 -3
- package/build/features/entity/Entity.d.ts +4 -1
- package/build/features/entity/Entity.js +15 -7
- package/build/features/entity/screens/EntityCapital/CapitalPaid.js +3 -7
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +3 -7
- package/build/features/featuresScreens.d.ts +1 -0
- package/build/features/featuresScreens.js +73 -0
- package/build/features/individual/Individual.d.ts +4 -1
- package/build/features/individual/Individual.js +15 -7
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +3 -8
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +3 -8
- package/build/features/individual/screens/IndividualList/MobileNumber.js +5 -10
- package/build/features/individual/screens/IndividualList/validation.js +5 -3
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +3 -5
- package/build/features/individual/screens/IndividualPersonalInfo/validation.js +5 -2
- package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.js +5 -10
- package/build/features/individual/screens/IndividualPhoneInfo/validation.js +5 -2
- package/build/features/kyc/KYC.d.ts +11 -0
- package/build/features/kyc/KYC.js +99 -0
- package/build/features/kyc/index.d.ts +1 -0
- package/build/features/kyc/index.js +1 -0
- package/build/features/kyc/screens/AlreadySubmitted/AlreadySubmitted.d.ts +5 -0
- package/build/features/kyc/screens/AlreadySubmitted/AlreadySubmitted.js +19 -0
- package/build/features/kyc/screens/AlreadySubmitted/index.d.ts +2 -0
- package/build/features/kyc/screens/AlreadySubmitted/index.js +2 -0
- package/build/features/kyc/screens/Loading/Loading.d.ts +4 -0
- package/build/features/kyc/screens/Loading/Loading.js +10 -0
- package/build/features/kyc/screens/Loading/index.d.ts +2 -0
- package/build/features/kyc/screens/Loading/index.js +2 -0
- package/build/features/kyc/screens/OperatorError/OperatorError.d.ts +5 -0
- package/build/features/kyc/screens/OperatorError/OperatorError.js +9 -0
- package/build/features/kyc/screens/OperatorError/index.d.ts +2 -0
- package/build/features/kyc/screens/OperatorError/index.js +2 -0
- package/build/features/kyc/screens/Success/Success.d.ts +5 -0
- package/build/features/kyc/screens/Success/Success.js +32 -0
- package/build/features/kyc/screens/Success/index.d.ts +2 -0
- package/build/features/kyc/screens/Success/index.js +2 -0
- package/build/features/kyc/screens/Terms/Header.d.ts +6 -0
- package/build/features/kyc/screens/Terms/Header.js +36 -0
- package/build/features/kyc/screens/Terms/Terms.d.ts +4 -0
- package/build/features/kyc/screens/Terms/Terms.js +87 -0
- package/build/features/kyc/screens/Terms/index.d.ts +2 -0
- package/build/features/kyc/screens/Terms/index.js +2 -0
- package/build/features/kyc/screens/TokenError/TokenError.d.ts +5 -0
- package/build/features/kyc/screens/TokenError/TokenError.js +9 -0
- package/build/features/kyc/screens/TokenError/index.d.ts +2 -0
- package/build/features/kyc/screens/TokenError/index.js +2 -0
- package/build/features/kyc/screens/Users/Users.d.ts +3 -0
- package/build/features/kyc/screens/Users/Users.js +76 -0
- package/build/features/kyc/screens/Users/index.d.ts +2 -0
- package/build/features/kyc/screens/Users/index.js +2 -0
- package/build/features/kyc/screens/VerifyNafath/VerifyNafath.d.ts +5 -0
- package/build/features/kyc/screens/VerifyNafath/VerifyNafath.js +45 -0
- package/build/features/kyc/screens/VerifyNafath/index.d.ts +3 -0
- package/build/features/kyc/screens/VerifyNafath/index.js +2 -0
- package/build/features/kyc/screens/VerifyPaci/VerifyPACI.d.ts +5 -0
- package/build/features/kyc/screens/VerifyPaci/VerifyPACI.js +44 -0
- package/build/features/kyc/screens/VerifyPaci/index.d.ts +3 -0
- package/build/features/kyc/screens/VerifyPaci/index.js +2 -0
- package/build/features/password/Password.d.ts +4 -1
- package/build/features/password/Password.js +13 -6
- package/build/features/shared/Background/LogoBackground.js +5 -17
- package/build/features/shared/Button/Button.js +1 -2
- package/build/features/shared/Button/FlowsButtons.js +5 -2
- package/build/features/shared/Containers/FeatureContainer.d.ts +2 -1
- package/build/features/shared/Containers/FeatureContainer.js +5 -3
- package/build/features/shared/Dialog/DialogContainer.js +5 -4
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/features/shared/SuccessScreen/SuccessScreen.js +1 -1
- package/build/features/signIn/screens/Mobile/MobileNumber.js +5 -7
- package/build/features/signIn/screens/Mobile/validation.js +5 -2
- package/build/features/tax/Tax.d.ts +4 -1
- package/build/features/tax/Tax.js +15 -7
- package/build/hooks/useAppConfig.js +1 -1
- package/build/hooks/useAppDispatch.d.ts +1 -0
- package/build/hooks/useSanitizedTranslation.d.ts +2 -1
- package/build/hooks/useSanitizedTranslation.js +2 -2
- package/build/index.d.ts +3 -2
- package/build/index.js +4 -2
- package/build/theme/shadows.js +1 -1
- package/build/utils/common.d.ts +1 -1
- package/build/utils/common.js +6 -5
- package/build/utils/error.d.ts +1 -0
- package/build/utils/error.js +3 -0
- package/build/utils/string.d.ts +5 -2
- package/build/utils/string.js +16 -2
- package/package.json +3 -4
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getMobileNumberLen } from '../../../../utils';
|
|
2
|
+
import * as yup from 'yup';
|
|
3
|
+
export var PhoneValidationSchema = function () {
|
|
4
|
+
return yup.object().shape({
|
|
5
|
+
mobile: yup
|
|
6
|
+
.string()
|
|
7
|
+
.test({
|
|
8
|
+
test: function (value) {
|
|
9
|
+
var countryCode = this.parent.countryCode;
|
|
10
|
+
var isSA = countryCode.iso2 === 'SA';
|
|
11
|
+
var maxDigits = countryCode.max_digits;
|
|
12
|
+
var minDigits = countryCode.min_digits;
|
|
13
|
+
var mobileValue = value || '';
|
|
14
|
+
var valueLen = mobileValue.length;
|
|
15
|
+
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
16
|
+
if (!isNumber)
|
|
17
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
18
|
+
var isStartWithZero = mobileValue.startsWith('05');
|
|
19
|
+
var isStartWith5 = mobileValue.startsWith('5');
|
|
20
|
+
var isSaudiNumber = isStartWith5 || isStartWithZero;
|
|
21
|
+
if (isSA) {
|
|
22
|
+
if (!isSaudiNumber)
|
|
23
|
+
return this.createError({ message: 'start_with_number' });
|
|
24
|
+
var requiredLen = isStartWithZero ? maxDigits + 1 : maxDigits;
|
|
25
|
+
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
26
|
+
}
|
|
27
|
+
var requiredMaxLen = getMobileNumberLen(maxDigits, mobileValue);
|
|
28
|
+
var requiredMinLen = getMobileNumberLen(minDigits, mobileValue);
|
|
29
|
+
if (valueLen >= requiredMinLen && valueLen <= requiredMaxLen)
|
|
30
|
+
return true;
|
|
31
|
+
if (minDigits === maxDigits)
|
|
32
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
33
|
+
return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
.required('mobile_number_error')
|
|
37
|
+
});
|
|
38
|
+
};
|
|
@@ -141,7 +141,7 @@ var Connect = memo(function (props) {
|
|
|
141
141
|
(_a = props.unmount) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
142
142
|
}, 1100);
|
|
143
143
|
};
|
|
144
|
-
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', onConfirm: handleDialogClose, animationDirection: animationDirection, onClose: ((_c = appConfig.features) === null || _c === void 0 ? void 0 : _c.closeButton) ? handleDialogClose : undefined, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: false, dialogEdgeFormat: data.appConfig.dialogEdgeFormat, features: __assign({ tapTextLogo: ((_d = appConfig.features) === null || _d === void 0 ? void 0 : _d.tapTextLogo) && activeScreen.name !== 'CONNECT_BUSINESS_COUNTRY_STEP', poweredBy: false }, appConfig.features) }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: false }, { children: connectFeatureScreens.map(function (_a, index) {
|
|
144
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading || data.isMaturityExpress }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', onConfirm: handleDialogClose, animationDirection: animationDirection, onClose: ((_c = appConfig.features) === null || _c === void 0 ? void 0 : _c.closeButton) ? handleDialogClose : undefined, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: false, dialogEdgeFormat: data.appConfig.dialogEdgeFormat, features: __assign({ tapTextLogo: ((_d = appConfig.features) === null || _d === void 0 ? void 0 : _d.tapTextLogo) && activeScreen.name !== 'CONNECT_BUSINESS_COUNTRY_STEP', poweredBy: false }, appConfig.features) }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: false }, { children: connectFeatureScreens.map(function (_a, index) {
|
|
145
145
|
var Element = _a.element, name = _a.name;
|
|
146
146
|
var isActive = activeScreen.name === name;
|
|
147
147
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -34,7 +34,7 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
|
34
34
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
35
35
|
import Input from '../../../shared/Input';
|
|
36
36
|
import SimpleList from '../../../../components/SimpleList';
|
|
37
|
-
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
37
|
+
import { getMobileNumberLen, removeAllCharsFromNumber } from '../../../../utils';
|
|
38
38
|
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
39
39
|
import Search from '../../../shared/Search';
|
|
40
40
|
import { connectSelector } from '../../../app/connect/connectStore';
|
|
@@ -97,10 +97,8 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
97
97
|
var isSA = countryCodeValue.iso2 === 'SA';
|
|
98
98
|
var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
|
|
99
99
|
var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
|
|
100
|
-
var
|
|
101
|
-
var
|
|
102
|
-
var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
|
|
103
|
-
var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
|
|
100
|
+
var requiredMaxLen = getMobileNumberLen(mobileMaxLen, mobileValue);
|
|
101
|
+
var requiredMinLen = getMobileNumberLen(mobileMinLen, mobileValue);
|
|
104
102
|
var _k = ((_f = (_e = data.otpData.responseBody) === null || _e === void 0 ? void 0 : _e.contact) === null || _f === void 0 ? void 0 : _f.phone) || {}, number = _k.number, country_code = _k.country_code;
|
|
105
103
|
var readOnly = number && country_code && !error;
|
|
106
104
|
React.useEffect(function () {
|
|
@@ -144,8 +142,8 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
144
142
|
var filteredCountries = countries.filter(function (country) {
|
|
145
143
|
return country.idd_prefix.toString().toLowerCase().startsWith(value.replace('+', '').toLowerCase()) ||
|
|
146
144
|
country.capital.toLowerCase().startsWith(value.toLowerCase()) ||
|
|
147
|
-
country.name.arabic.toLowerCase().
|
|
148
|
-
country.name.english.toLowerCase().
|
|
145
|
+
country.name.arabic.toLowerCase().includes(value.toLowerCase()) ||
|
|
146
|
+
country.name.english.toLowerCase().includes(value.toLowerCase());
|
|
149
147
|
});
|
|
150
148
|
setCountries(filteredCountries);
|
|
151
149
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { REGEX_FULL_NAME } from '../../../../constants';
|
|
2
|
+
import { getMobileNumberLen } from '../../../../utils';
|
|
2
3
|
import * as yup from 'yup';
|
|
3
4
|
export var IndividualValidation = yup.object().shape({
|
|
4
5
|
name: yup.string().matches(REGEX_FULL_NAME, 'please write your first and last name').required('please write your first and last name'),
|
|
@@ -26,10 +27,12 @@ export var IndividualMobileValidation = yup.object().shape({
|
|
|
26
27
|
if (isSA) {
|
|
27
28
|
if (!isSaudiNumber)
|
|
28
29
|
return this.createError({ message: 'start_with_number' });
|
|
29
|
-
var requiredLen =
|
|
30
|
+
var requiredLen = isStartWithZero ? maxDigits + 1 : maxDigits;
|
|
30
31
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
+
var requiredMaxLen = getMobileNumberLen(maxDigits, mobileValue);
|
|
34
|
+
var requiredMinLen = getMobileNumberLen(minDigits, mobileValue);
|
|
35
|
+
if (valueLen >= requiredMinLen && valueLen <= requiredMaxLen)
|
|
33
36
|
return true;
|
|
34
37
|
if (minDigits === maxDigits)
|
|
35
38
|
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
@@ -36,7 +36,7 @@ import { connectSelector } from '../../../app/connect/connectStore';
|
|
|
36
36
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
37
37
|
import Input from '../../../shared/Input';
|
|
38
38
|
import SimpleList from '../../../../components/SimpleList';
|
|
39
|
-
import { isOtherThanKWOrSA, removeAllCharsFromNumber, sendCustomEventToGTM } from '../../../../utils';
|
|
39
|
+
import { getMobileNumberLen, isOtherThanKWOrSA, removeAllCharsFromNumber, sendCustomEventToGTM } from '../../../../utils';
|
|
40
40
|
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
41
41
|
import Search from '../../../shared/Search';
|
|
42
42
|
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
@@ -99,10 +99,8 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
99
99
|
var isSA = countryCodeValue.iso2 === 'SA';
|
|
100
100
|
var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
|
|
101
101
|
var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
|
|
102
|
-
var
|
|
103
|
-
var
|
|
104
|
-
var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
|
|
105
|
-
var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
|
|
102
|
+
var requiredMaxLen = getMobileNumberLen(mobileMaxLen, mobileValue);
|
|
103
|
+
var requiredMinLen = getMobileNumberLen(mobileMinLen, mobileValue);
|
|
106
104
|
var isOtherThanKWOrSACountry = React.useMemo(function () { var _a; return isOtherThanKWOrSA((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_e = settingsStore.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2]);
|
|
107
105
|
React.useEffect(function () {
|
|
108
106
|
if (mobileValue)
|
|
@@ -152,8 +150,8 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
152
150
|
var filteredCountries = countries.filter(function (country) {
|
|
153
151
|
return country.idd_prefix.toString().toLowerCase().startsWith(value.replace('+', '').toLowerCase()) ||
|
|
154
152
|
country.capital.toLowerCase().startsWith(value.toLowerCase()) ||
|
|
155
|
-
country.name.arabic.toLowerCase().
|
|
156
|
-
country.name.english.toLowerCase().
|
|
153
|
+
country.name.arabic.toLowerCase().includes(value.toLowerCase()) ||
|
|
154
|
+
country.name.english.toLowerCase().includes(value.toLowerCase());
|
|
157
155
|
});
|
|
158
156
|
setCountries(filteredCountries);
|
|
159
157
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getMobileNumberLen } from '../../../../utils';
|
|
1
2
|
import * as yup from 'yup';
|
|
2
3
|
export var PhoneValidationSchema = yup.object().shape({
|
|
3
4
|
mobile: yup
|
|
@@ -19,10 +20,12 @@ export var PhoneValidationSchema = yup.object().shape({
|
|
|
19
20
|
if (isSA) {
|
|
20
21
|
if (!isSaudiNumber)
|
|
21
22
|
return this.createError({ message: 'start_with_number' });
|
|
22
|
-
var requiredLen =
|
|
23
|
+
var requiredLen = isStartWithZero ? maxDigits + 1 : maxDigits;
|
|
23
24
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
var requiredMaxLen = getMobileNumberLen(maxDigits, mobileValue);
|
|
27
|
+
var requiredMinLen = getMobileNumberLen(minDigits, mobileValue);
|
|
28
|
+
if (valueLen >= requiredMinLen && valueLen <= requiredMaxLen)
|
|
26
29
|
return true;
|
|
27
30
|
if (minDigits === maxDigits)
|
|
28
31
|
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
@@ -0,0 +1,104 @@
|
|
|
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 { FormProvider, useForm } from 'react-hook-form';
|
|
14
|
+
import { ScreenContainer } from '../../../../features/shared/Containers';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import Form from '../../../../components/Form';
|
|
17
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
+
import { PhoneValidationSchema } from './validation';
|
|
19
|
+
import { Box, alpha } from '@mui/material';
|
|
20
|
+
import { useTranslation } from 'react-i18next';
|
|
21
|
+
import Text from '../../../../components/Text';
|
|
22
|
+
import { Button as SharedButton } from '../../../shared/Button';
|
|
23
|
+
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
24
|
+
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
25
|
+
import { connectSelector, skipUpdateLeadMobile, updateLeadMobile } from '../../../../features/app/connect/connectStore';
|
|
26
|
+
import MobileNumber from './MobileNumber';
|
|
27
|
+
import { deepCopy } from '../../../../utils';
|
|
28
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexDirection: 'column',
|
|
31
|
+
justifyContent: 'flex-start'
|
|
32
|
+
}); });
|
|
33
|
+
var TitleContainerStyled = styled(Box)(function (_a) {
|
|
34
|
+
var theme = _a.theme;
|
|
35
|
+
return ({
|
|
36
|
+
background: theme.palette.common.white,
|
|
37
|
+
borderTop: '1px solid rgba(227, 232, 238, 0.8)',
|
|
38
|
+
borderBottom: '1px solid rgba(227, 232, 238, 0.8)',
|
|
39
|
+
borderRadius: theme.spacing(0, 0, 1.25, 1.25)
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
var TitleStyled = styled(Text)(function (_a) {
|
|
43
|
+
var theme = _a.theme;
|
|
44
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightLight, margin: theme.spacing(1.75, 2.5), lineHeight: 1.2 }));
|
|
45
|
+
});
|
|
46
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
47
|
+
var theme = _a.theme;
|
|
48
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightRegular }, theme.typography.caption), { lineHeight: 1.2 }));
|
|
49
|
+
});
|
|
50
|
+
var CurrentMobileContainerStyled = styled(Box)(function (_a) {
|
|
51
|
+
var theme = _a.theme;
|
|
52
|
+
return ({
|
|
53
|
+
display: 'flex',
|
|
54
|
+
flexDirection: 'column',
|
|
55
|
+
rowGap: theme.spacing(1.6),
|
|
56
|
+
height: theme.spacing(9.375),
|
|
57
|
+
marginTop: theme.spacing(2.85),
|
|
58
|
+
marginInlineStart: theme.spacing(2.375)
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var MobileNumberContainer = styled(Box)(function (_a) {
|
|
62
|
+
var theme = _a.theme;
|
|
63
|
+
return (__assign({ display: 'flex', columnGap: theme.spacing(0.9), direction: 'ltr' }, (theme.direction === 'rtl' && {
|
|
64
|
+
marginLeft: 'auto'
|
|
65
|
+
})));
|
|
66
|
+
});
|
|
67
|
+
var CountryCodeStyled = styled(Text)(function (_a) {
|
|
68
|
+
var theme = _a.theme;
|
|
69
|
+
return (__assign(__assign({}, theme.typography.body2), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium, lineHeight: 1.2 }));
|
|
70
|
+
});
|
|
71
|
+
var MobileNumberStyled = styled(Text)(function (_a) {
|
|
72
|
+
var theme = _a.theme;
|
|
73
|
+
return (__assign(__assign({}, theme.typography.body2), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightRegular, lineHeight: 1.2 }));
|
|
74
|
+
});
|
|
75
|
+
var UpdateLaterContainerStyled = styled(Box)(function (_a) {
|
|
76
|
+
var theme = _a.theme;
|
|
77
|
+
return ({
|
|
78
|
+
marginLeft: theme.spacing(2.5),
|
|
79
|
+
marginRight: theme.spacing(2.5)
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
var CollectMobileOwnership = function () {
|
|
83
|
+
var dispatch = useAppDispatch();
|
|
84
|
+
var t = useTranslation().t;
|
|
85
|
+
var isAr = useLanguage().isAr;
|
|
86
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
87
|
+
var _a = useAppSelector(connectSelector), data = _a.data, loading = _a.loading, error = _a.error;
|
|
88
|
+
var methods = useForm({
|
|
89
|
+
resolver: yupResolver(PhoneValidationSchema()),
|
|
90
|
+
defaultValues: { mobile: '', countryCode: settingsData.businessCountry },
|
|
91
|
+
mode: 'onChange'
|
|
92
|
+
});
|
|
93
|
+
var onSubmit = function (data) {
|
|
94
|
+
dispatch(updateLeadMobile(deepCopy(data)));
|
|
95
|
+
};
|
|
96
|
+
var onBack = function () {
|
|
97
|
+
dispatch(handlePrevScreenStep());
|
|
98
|
+
};
|
|
99
|
+
var onUpdateLater = function () {
|
|
100
|
+
dispatch(skipUpdateLeadMobile());
|
|
101
|
+
};
|
|
102
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(TitleContainerStyled, { children: _jsx(TitleStyled, { children: t('mobile_ownership_title') }) }), _jsxs(CurrentMobileContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('current_mobile_number') }), _jsxs(MobileNumberContainer, { children: [_jsxs(CountryCodeStyled, { children: ["+", data.individualData.countryCode.idd_prefix] }), _jsx(MobileNumberStyled, { children: data.individualData.mobile })] })] }), _jsx(MobileNumber, {}), _jsx(SharedButton, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('update_mobile_number') }))] })) })) }));
|
|
103
|
+
};
|
|
104
|
+
export default CollectMobileOwnership;
|
|
@@ -0,0 +1,72 @@
|
|
|
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, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
18
|
+
import { getMobileNumberLen, removeAllCharsFromNumber } from '../../../../utils';
|
|
19
|
+
import { useAppSelector } from '../../../../hooks';
|
|
20
|
+
import Text from '../../../../components/Text';
|
|
21
|
+
import ClearIcon from '../../../shared/ClearIcon';
|
|
22
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
23
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
24
|
+
import Input from '../../../shared/Input';
|
|
25
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
26
|
+
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
27
|
+
var theme = _a.theme;
|
|
28
|
+
return ({
|
|
29
|
+
display: 'flex',
|
|
30
|
+
justifyContent: 'space-between',
|
|
31
|
+
padding: theme.spacing(0, 2.5, 1.25, 2.5)
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
35
|
+
var theme = _a.theme;
|
|
36
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
37
|
+
});
|
|
38
|
+
var InputStyled = styled(Input)(function () { return ({
|
|
39
|
+
direction: 'ltr',
|
|
40
|
+
'& .MuiInputBase-input': {
|
|
41
|
+
cursor: 'auto'
|
|
42
|
+
}
|
|
43
|
+
}); });
|
|
44
|
+
var MobileNumber = function () {
|
|
45
|
+
var _a;
|
|
46
|
+
var t = useTranslation().t;
|
|
47
|
+
var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
|
|
48
|
+
var data = useAppSelector(settingsSelector).data;
|
|
49
|
+
var phoneControl = useController({ name: 'mobile', control: control });
|
|
50
|
+
var countryCodeValue = data.businessCountry;
|
|
51
|
+
var mobileValue = phoneControl.field.value || '';
|
|
52
|
+
var error = !!mobileValue ? (_a = phoneControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message : '';
|
|
53
|
+
var isSA = countryCodeValue.iso2 === 'SA';
|
|
54
|
+
var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
|
|
55
|
+
var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
|
|
56
|
+
var requiredMaxLen = getMobileNumberLen(mobileMaxLen, mobileValue);
|
|
57
|
+
var requiredMinLen = getMobileNumberLen(mobileMinLen, mobileValue);
|
|
58
|
+
React.useEffect(function () {
|
|
59
|
+
if (mobileValue)
|
|
60
|
+
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
61
|
+
}, []);
|
|
62
|
+
var onPhoneNumberChange = function (_a) {
|
|
63
|
+
var target = _a.target;
|
|
64
|
+
var value = removeAllCharsFromNumber(target.value);
|
|
65
|
+
phoneControl.field.onChange(value);
|
|
66
|
+
};
|
|
67
|
+
var clearMobileNumber = function () {
|
|
68
|
+
phoneControl.field.onChange('');
|
|
69
|
+
};
|
|
70
|
+
return (_jsx(_Fragment, { children: _jsxs(ScreenContainer, __assign({ sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('new_mobile_number') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredMaxLen }, type: 'tel', onChange: onPhoneNumberChange, value: mobileValue, startAdornment: "+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), endAdornment: !error && mobileValue ? _jsx(CheckIcon, {}) : mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber }), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { minLength: requiredMinLen, length: requiredMaxLen, number: '05|5' }) })] })) }));
|
|
71
|
+
};
|
|
72
|
+
export default React.memo(MobileNumber);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const PhoneValidationSchema: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
5
|
+
mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
|
+
mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getMobileNumberLen } from '../../../../utils';
|
|
2
|
+
import * as yup from 'yup';
|
|
3
|
+
export var PhoneValidationSchema = function () {
|
|
4
|
+
return yup.object().shape({
|
|
5
|
+
mobile: yup
|
|
6
|
+
.string()
|
|
7
|
+
.test({
|
|
8
|
+
test: function (value) {
|
|
9
|
+
var countryCode = this.parent.countryCode;
|
|
10
|
+
var isSA = countryCode.iso2 === 'SA';
|
|
11
|
+
var maxDigits = countryCode.max_digits;
|
|
12
|
+
var minDigits = countryCode.min_digits;
|
|
13
|
+
var mobileValue = value || '';
|
|
14
|
+
var valueLen = mobileValue.length;
|
|
15
|
+
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
16
|
+
if (!isNumber)
|
|
17
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
18
|
+
var isStartWithZero = mobileValue.startsWith('05');
|
|
19
|
+
var isStartWith5 = mobileValue.startsWith('5');
|
|
20
|
+
var isSaudiNumber = isStartWith5 || isStartWithZero;
|
|
21
|
+
if (isSA) {
|
|
22
|
+
if (!isSaudiNumber)
|
|
23
|
+
return this.createError({ message: 'start_with_number' });
|
|
24
|
+
var requiredLen = isStartWithZero ? maxDigits + 1 : maxDigits;
|
|
25
|
+
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
26
|
+
}
|
|
27
|
+
var requiredMaxLen = getMobileNumberLen(maxDigits, mobileValue);
|
|
28
|
+
var requiredMinLen = getMobileNumberLen(minDigits, mobileValue);
|
|
29
|
+
if (valueLen >= requiredMinLen && valueLen <= requiredMaxLen)
|
|
30
|
+
return true;
|
|
31
|
+
if (minDigits === maxDigits)
|
|
32
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
33
|
+
return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
.required('mobile_number_error')
|
|
37
|
+
});
|
|
38
|
+
};
|
|
@@ -156,7 +156,7 @@ var ConnectExpress = memo(function (_a) {
|
|
|
156
156
|
(_a = props.unmount) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
157
157
|
}, 1100);
|
|
158
158
|
};
|
|
159
|
-
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', isTapOrigin: isTapOrigin, animationDirection: animationDirection, onClose: ((_d = appConfig.features) === null || _d === void 0 ? void 0 : _d.closeButton) ? handleDialogClose : undefined, loading: settingLoading || customLoading, error: error, open: open, screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: !isTapOrigin, dialogEdgeFormat: appConfig.dialogEdgeFormat, features: __assign({ tapTextLogo: false, poweredBy: !isTapOrigin }, appConfig.features) }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: true }, { children: connectExpressFeatureScreens.map(function (_a, index) {
|
|
159
|
+
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', isTapOrigin: isTapOrigin, animationDirection: animationDirection, onClose: ((_d = appConfig.features) === null || _d === void 0 ? void 0 : _d.closeButton) ? handleDialogClose : undefined, loading: settingLoading || customLoading, error: error, open: open, screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: !isTapOrigin, dialogEdgeFormat: appConfig.dialogEdgeFormat, features: __assign({ tapTextLogo: false, poweredBy: !isTapOrigin }, appConfig.features) }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: true, isTapOrigin: isTapOrigin }, { children: connectExpressFeatureScreens.map(function (_a, index) {
|
|
160
160
|
var Element = _a.element, name = _a.name;
|
|
161
161
|
var isActive = activeScreen.name === name;
|
|
162
162
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -26,7 +26,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
26
26
|
import { useController, useFormContext } from 'react-hook-form';
|
|
27
27
|
import Box from '@mui/material/Box';
|
|
28
28
|
import { styled, alpha } from '@mui/material/styles';
|
|
29
|
-
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
29
|
+
import { getMobileNumberLen, removeAllCharsFromNumber } from '../../../../utils';
|
|
30
30
|
import { useLanguage } from '../../../../hooks';
|
|
31
31
|
import Text from '../../../../components/Text';
|
|
32
32
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -95,10 +95,8 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
95
95
|
var isSA = countryCodeValue.iso2 === 'SA';
|
|
96
96
|
var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
|
|
97
97
|
var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
|
|
98
|
-
var
|
|
99
|
-
var
|
|
100
|
-
var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
|
|
101
|
-
var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
|
|
98
|
+
var requiredMaxLen = getMobileNumberLen(mobileMaxLen, mobileValue);
|
|
99
|
+
var requiredMinLen = getMobileNumberLen(mobileMinLen, mobileValue);
|
|
102
100
|
React.useEffect(function () {
|
|
103
101
|
if (mobileValue)
|
|
104
102
|
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
@@ -140,8 +138,8 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
140
138
|
var filteredCountries = countries.filter(function (country) {
|
|
141
139
|
return country.idd_prefix.toString().toLowerCase().startsWith(value.replace('+', '').toLowerCase()) ||
|
|
142
140
|
country.capital.toLowerCase().startsWith(value.toLowerCase()) ||
|
|
143
|
-
country.name.arabic.toLowerCase().
|
|
144
|
-
country.name.english.toLowerCase().
|
|
141
|
+
country.name.arabic.toLowerCase().includes(value.toLowerCase()) ||
|
|
142
|
+
country.name.english.toLowerCase().includes(value.toLowerCase());
|
|
145
143
|
});
|
|
146
144
|
setCountries(filteredCountries);
|
|
147
145
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { REGEX_FULL_NAME } from '../../../../constants';
|
|
2
|
+
import { getMobileNumberLen } from '../../../../utils';
|
|
2
3
|
import * as yup from 'yup';
|
|
3
4
|
export var CollectIndividualInfoValidation = yup.object().shape({
|
|
4
5
|
name: yup.string().matches(REGEX_FULL_NAME, 'please write your first and last name').required('please write your first and last name'),
|
|
@@ -22,10 +23,12 @@ export var CollectIndividualInfoValidation = yup.object().shape({
|
|
|
22
23
|
if (isSA) {
|
|
23
24
|
if (!isSaudiNumber)
|
|
24
25
|
return this.createError({ message: 'start_with_number' });
|
|
25
|
-
var requiredLen =
|
|
26
|
+
var requiredLen = isStartWithZero ? maxDigits + 1 : maxDigits;
|
|
26
27
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
var requiredMaxLen = getMobileNumberLen(maxDigits, mobileValue);
|
|
30
|
+
var requiredMinLen = getMobileNumberLen(minDigits, mobileValue);
|
|
31
|
+
if (valueLen >= requiredMinLen && valueLen <= requiredMaxLen)
|
|
29
32
|
return true;
|
|
30
33
|
if (minDigits === maxDigits)
|
|
31
34
|
return this.createError({ message: 'enter_valid_mobile_number' });
|
package/build/features/connectExpress/screens/GenericPrepareDataLoading/GenericPrepareDataLoading.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useAppSelector } from '../../../../hooks';
|
|
3
|
+
import DataLoading from '../../../shared/DataLoading';
|
|
4
|
+
import { connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
|
|
5
|
+
var GenericPrepareDataLoading = function () {
|
|
6
|
+
var error = useAppSelector(connectExpressSelector).error;
|
|
7
|
+
return _jsx(DataLoading, { error: error });
|
|
8
|
+
};
|
|
9
|
+
export default GenericPrepareDataLoading;
|
|
@@ -36,7 +36,7 @@ import { connectExpressSelector } from '../../../app/connectExpress/connectExpre
|
|
|
36
36
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
37
37
|
import Input from '../../../shared/Input';
|
|
38
38
|
import SimpleList from '../../../../components/SimpleList';
|
|
39
|
-
import { isOtherThanKWOrSA, removeAllCharsFromNumber } from '../../../../utils';
|
|
39
|
+
import { getMobileNumberLen, isOtherThanKWOrSA, removeAllCharsFromNumber } from '../../../../utils';
|
|
40
40
|
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
41
41
|
import Search from '../../../shared/Search';
|
|
42
42
|
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
@@ -99,10 +99,8 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
99
99
|
var isSA = countryCodeValue.iso2 === 'SA';
|
|
100
100
|
var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
|
|
101
101
|
var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
|
|
102
|
-
var
|
|
103
|
-
var
|
|
104
|
-
var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
|
|
105
|
-
var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
|
|
102
|
+
var requiredMaxLen = getMobileNumberLen(mobileMaxLen, mobileValue);
|
|
103
|
+
var requiredMinLen = getMobileNumberLen(mobileMinLen, mobileValue);
|
|
106
104
|
var isOtherThanKWOrSACountry = React.useMemo(function () { var _a; return isOtherThanKWOrSA((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_e = settingsStore.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2]);
|
|
107
105
|
React.useEffect(function () {
|
|
108
106
|
if (mobileValue)
|
|
@@ -145,8 +143,8 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
145
143
|
var filteredCountries = countries.filter(function (country) {
|
|
146
144
|
return country.idd_prefix.toString().toLowerCase().startsWith(value.replace('+', '').toLowerCase()) ||
|
|
147
145
|
country.capital.toLowerCase().startsWith(value.toLowerCase()) ||
|
|
148
|
-
country.name.arabic.toLowerCase().
|
|
149
|
-
country.name.english.toLowerCase().
|
|
146
|
+
country.name.arabic.toLowerCase().includes(value.toLowerCase()) ||
|
|
147
|
+
country.name.english.toLowerCase().includes(value.toLowerCase());
|
|
150
148
|
});
|
|
151
149
|
setCountries(filteredCountries);
|
|
152
150
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getMobileNumberLen } from '../../../../utils';
|
|
1
2
|
import * as yup from 'yup';
|
|
2
3
|
export var PhoneValidationSchema = function (isLeadIdPassed) {
|
|
3
4
|
if (isLeadIdPassed) {
|
|
@@ -22,10 +23,12 @@ export var PhoneValidationSchema = function (isLeadIdPassed) {
|
|
|
22
23
|
if (isSA) {
|
|
23
24
|
if (!isSaudiNumber)
|
|
24
25
|
return this.createError({ message: 'start_with_number' });
|
|
25
|
-
var requiredLen =
|
|
26
|
+
var requiredLen = isStartWithZero ? maxDigits + 1 : maxDigits;
|
|
26
27
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
var requiredMaxLen = getMobileNumberLen(maxDigits, mobileValue);
|
|
30
|
+
var requiredMinLen = getMobileNumberLen(minDigits, mobileValue);
|
|
31
|
+
if (valueLen >= requiredMinLen && valueLen <= requiredMaxLen)
|
|
29
32
|
return true;
|
|
30
33
|
if (minDigits === maxDigits)
|
|
31
34
|
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
@@ -55,10 +58,12 @@ export var PhoneValidationSchema = function (isLeadIdPassed) {
|
|
|
55
58
|
if (isSA) {
|
|
56
59
|
if (!isSaudiNumber)
|
|
57
60
|
return this.createError({ message: 'start_with_number' });
|
|
58
|
-
var requiredLen =
|
|
61
|
+
var requiredLen = isStartWithZero ? maxDigits + 1 : maxDigits;
|
|
59
62
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
60
63
|
}
|
|
61
|
-
|
|
64
|
+
var requiredMaxLen = getMobileNumberLen(maxDigits, mobileValue);
|
|
65
|
+
var requiredMinLen = getMobileNumberLen(minDigits, mobileValue);
|
|
66
|
+
if (valueLen >= requiredMinLen && valueLen <= requiredMaxLen)
|
|
62
67
|
return true;
|
|
63
68
|
if (minDigits === maxDigits)
|
|
64
69
|
return this.createError({ message: 'enter_valid_mobile_number' });
|