@tap-payments/auth-jsconnect 2.8.25-test → 2.8.26-test
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 +2 -0
- package/build/constants/dummy.d.ts +6 -0
- package/build/constants/dummy.js +36 -12
- package/build/features/auth/screens/Mobile/MobileNumber.js +7 -4
- package/build/features/auth/screens/Mobile/validation.js +8 -3
- package/build/features/connect/screens/Individual/MobileNumber.js +6 -3
- package/build/features/connect/screens/Individual/validation.js +8 -3
- package/build/features/connect/screens/Mobile/MobileNumber.js +6 -3
- package/build/features/connect/screens/Mobile/validation.js +8 -3
- package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.js +7 -4
- package/build/features/connectExpress/screens/CollectIndividualInfo/validation.js +8 -3
- package/build/features/connectExpress/screens/Mobile/MobileNumber.js +7 -4
- package/build/features/connectExpress/screens/Mobile/validation.js +16 -6
- package/build/features/individual/screens/IndividualList/MobileNumber.js +6 -3
- package/build/features/individual/screens/IndividualList/validation.js +8 -3
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +6 -3
- package/build/features/individual/screens/IndividualPersonalInfo/validation.js +8 -3
- package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.js +7 -4
- package/build/features/individual/screens/IndividualPhoneInfo/validation.js +8 -3
- package/build/features/signIn/screens/Mobile/MobileNumber.js +6 -3
- package/build/features/signIn/screens/Mobile/validation.js +8 -3
- package/package.json +1 -1
package/build/@types/app.d.ts
CHANGED
|
@@ -76,6 +76,8 @@ export declare const defaultCountry: {
|
|
|
76
76
|
logo: string;
|
|
77
77
|
digits: number;
|
|
78
78
|
supported_by_tap: boolean;
|
|
79
|
+
min_digits: number;
|
|
80
|
+
max_digits: number;
|
|
79
81
|
};
|
|
80
82
|
export declare const businessCountries: ({
|
|
81
83
|
created: number;
|
|
@@ -102,6 +104,8 @@ export declare const businessCountries: ({
|
|
|
102
104
|
logo: string;
|
|
103
105
|
digits: number;
|
|
104
106
|
supported_by_tap: boolean;
|
|
107
|
+
min_digits: number;
|
|
108
|
+
max_digits: number;
|
|
105
109
|
} | {
|
|
106
110
|
created: number;
|
|
107
111
|
updated: number;
|
|
@@ -126,6 +130,8 @@ export declare const businessCountries: ({
|
|
|
126
130
|
idd_prefix: number;
|
|
127
131
|
logo: string;
|
|
128
132
|
digits: number;
|
|
133
|
+
min_digits: number;
|
|
134
|
+
max_digits: number;
|
|
129
135
|
supported_by_tap?: undefined;
|
|
130
136
|
})[];
|
|
131
137
|
export declare const countriesCode: ({
|
package/build/constants/dummy.js
CHANGED
|
@@ -360,7 +360,9 @@ export var defaultCountry = {
|
|
|
360
360
|
idd_prefix: 966,
|
|
361
361
|
logo: 'https://back-end.b-cdn.net/country/png/SA.png',
|
|
362
362
|
digits: 10,
|
|
363
|
-
supported_by_tap: true
|
|
363
|
+
supported_by_tap: true,
|
|
364
|
+
min_digits: 10,
|
|
365
|
+
max_digits: 10
|
|
364
366
|
};
|
|
365
367
|
export var businessCountries = [
|
|
366
368
|
{
|
|
@@ -387,7 +389,9 @@ export var businessCountries = [
|
|
|
387
389
|
idd_prefix: 965,
|
|
388
390
|
logo: 'https://back-end.b-cdn.net/country/png/KW.png',
|
|
389
391
|
digits: 8,
|
|
390
|
-
supported_by_tap: true
|
|
392
|
+
supported_by_tap: true,
|
|
393
|
+
min_digits: 8,
|
|
394
|
+
max_digits: 8
|
|
391
395
|
},
|
|
392
396
|
{
|
|
393
397
|
created: 1577690965000,
|
|
@@ -413,7 +417,9 @@ export var businessCountries = [
|
|
|
413
417
|
idd_prefix: 966,
|
|
414
418
|
logo: 'https://back-end.b-cdn.net/country/png/SA.png',
|
|
415
419
|
digits: 10,
|
|
416
|
-
supported_by_tap: true
|
|
420
|
+
supported_by_tap: true,
|
|
421
|
+
min_digits: 10,
|
|
422
|
+
max_digits: 10
|
|
417
423
|
},
|
|
418
424
|
{
|
|
419
425
|
created: 1577690965000,
|
|
@@ -439,7 +445,9 @@ export var businessCountries = [
|
|
|
439
445
|
idd_prefix: 971,
|
|
440
446
|
logo: 'https://back-end.b-cdn.net/country/png/AE.png',
|
|
441
447
|
digits: 9,
|
|
442
|
-
supported_by_tap: true
|
|
448
|
+
supported_by_tap: true,
|
|
449
|
+
min_digits: 9,
|
|
450
|
+
max_digits: 9
|
|
443
451
|
},
|
|
444
452
|
{
|
|
445
453
|
created: 1577690965000,
|
|
@@ -465,7 +473,9 @@ export var businessCountries = [
|
|
|
465
473
|
idd_prefix: 20,
|
|
466
474
|
logo: 'https://back-end.b-cdn.net/country/png/EG.png',
|
|
467
475
|
digits: 10,
|
|
468
|
-
supported_by_tap: true
|
|
476
|
+
supported_by_tap: true,
|
|
477
|
+
min_digits: 10,
|
|
478
|
+
max_digits: 10
|
|
469
479
|
},
|
|
470
480
|
{
|
|
471
481
|
created: 1577690965000,
|
|
@@ -491,7 +501,9 @@ export var businessCountries = [
|
|
|
491
501
|
idd_prefix: 973,
|
|
492
502
|
logo: 'https://back-end.b-cdn.net/country/png/BH.png',
|
|
493
503
|
digits: 8,
|
|
494
|
-
supported_by_tap: true
|
|
504
|
+
supported_by_tap: true,
|
|
505
|
+
min_digits: 8,
|
|
506
|
+
max_digits: 8
|
|
495
507
|
},
|
|
496
508
|
{
|
|
497
509
|
created: 1577690965000,
|
|
@@ -517,7 +529,9 @@ export var businessCountries = [
|
|
|
517
529
|
idd_prefix: 961,
|
|
518
530
|
logo: 'https://back-end.b-cdn.net/country/png/LB.png',
|
|
519
531
|
digits: 8,
|
|
520
|
-
supported_by_tap: true
|
|
532
|
+
supported_by_tap: true,
|
|
533
|
+
min_digits: 7,
|
|
534
|
+
max_digits: 8
|
|
521
535
|
},
|
|
522
536
|
{
|
|
523
537
|
created: 1577690965000,
|
|
@@ -543,7 +557,9 @@ export var businessCountries = [
|
|
|
543
557
|
idd_prefix: 1,
|
|
544
558
|
logo: 'https://back-end.b-cdn.net/country/png/US.png',
|
|
545
559
|
digits: 10,
|
|
546
|
-
supported_by_tap: true
|
|
560
|
+
supported_by_tap: true,
|
|
561
|
+
min_digits: 10,
|
|
562
|
+
max_digits: 10
|
|
547
563
|
},
|
|
548
564
|
{
|
|
549
565
|
created: 1577690965000,
|
|
@@ -568,7 +584,9 @@ export var businessCountries = [
|
|
|
568
584
|
geoNameId: '2635167',
|
|
569
585
|
idd_prefix: 44,
|
|
570
586
|
logo: 'https://back-end.b-cdn.net/country/png/GB.png',
|
|
571
|
-
digits: 10
|
|
587
|
+
digits: 10,
|
|
588
|
+
min_digits: 10,
|
|
589
|
+
max_digits: 10
|
|
572
590
|
},
|
|
573
591
|
{
|
|
574
592
|
created: 1577690965000,
|
|
@@ -594,7 +612,9 @@ export var businessCountries = [
|
|
|
594
612
|
idd_prefix: 974,
|
|
595
613
|
logo: 'https://back-end.b-cdn.net/country/png/QA.png',
|
|
596
614
|
digits: 8,
|
|
597
|
-
supported_by_tap: true
|
|
615
|
+
supported_by_tap: true,
|
|
616
|
+
min_digits: 8,
|
|
617
|
+
max_digits: 8
|
|
598
618
|
},
|
|
599
619
|
{
|
|
600
620
|
created: 1577690965000,
|
|
@@ -620,7 +640,9 @@ export var businessCountries = [
|
|
|
620
640
|
idd_prefix: 968,
|
|
621
641
|
logo: 'https://back-end.b-cdn.net/country/png/OM.png',
|
|
622
642
|
digits: 8,
|
|
623
|
-
supported_by_tap: true
|
|
643
|
+
supported_by_tap: true,
|
|
644
|
+
min_digits: 9,
|
|
645
|
+
max_digits: 9
|
|
624
646
|
},
|
|
625
647
|
{
|
|
626
648
|
created: 1577690965000,
|
|
@@ -645,7 +667,9 @@ export var businessCountries = [
|
|
|
645
667
|
geoNameId: '2963597',
|
|
646
668
|
idd_prefix: 353,
|
|
647
669
|
logo: 'https://back-end.b-cdn.net/country/png/IE.png',
|
|
648
|
-
digits: 10
|
|
670
|
+
digits: 10,
|
|
671
|
+
min_digits: 10,
|
|
672
|
+
max_digits: 10
|
|
649
673
|
}
|
|
650
674
|
];
|
|
651
675
|
export var countriesCode = [
|
|
@@ -95,9 +95,12 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
95
95
|
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) || '';
|
|
96
96
|
var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
|
|
97
97
|
var isSA = countryCodeValue.iso2 === 'SA';
|
|
98
|
-
var
|
|
98
|
+
var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
|
|
99
|
+
var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
|
|
99
100
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
100
|
-
var
|
|
101
|
+
var requiredSALen = isStartsWith5 ? mobileMaxLen - 1 : mobileMaxLen;
|
|
102
|
+
var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
|
|
103
|
+
var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
|
|
101
104
|
React.useEffect(function () {
|
|
102
105
|
if (mobileValue)
|
|
103
106
|
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
@@ -144,11 +147,11 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
144
147
|
});
|
|
145
148
|
setCountries(filteredCountries);
|
|
146
149
|
};
|
|
147
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 5 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength:
|
|
150
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 5 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredMaxLen }, type: 'tel', readOnly: !!anchorEl || readOnly, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () {
|
|
148
151
|
if (readOnly)
|
|
149
152
|
return;
|
|
150
153
|
toggleCountryList();
|
|
151
|
-
} }, { 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: !anchorEl ? error && t(error, { length:
|
|
154
|
+
} }, { 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: !anchorEl ? error && t(error, { minLength: requiredMinLen, length: requiredMaxLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
152
155
|
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, {})] }));
|
|
153
156
|
} })] }))] })) })));
|
|
154
157
|
});
|
|
@@ -7,7 +7,8 @@ export var PhoneValidationSchema = function () {
|
|
|
7
7
|
test: function (value) {
|
|
8
8
|
var countryCode = this.parent.countryCode;
|
|
9
9
|
var isSA = countryCode.iso2 === 'SA';
|
|
10
|
-
var
|
|
10
|
+
var maxDigits = countryCode.max_digits;
|
|
11
|
+
var minDigits = countryCode.min_digits;
|
|
11
12
|
var mobileValue = value || '';
|
|
12
13
|
var valueLen = mobileValue.length;
|
|
13
14
|
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
@@ -19,10 +20,14 @@ export var PhoneValidationSchema = function () {
|
|
|
19
20
|
if (isSA) {
|
|
20
21
|
if (!isSaudiNumber)
|
|
21
22
|
return this.createError({ message: 'start_with_number' });
|
|
22
|
-
var requiredLen = isStartWith5 ?
|
|
23
|
+
var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
|
|
23
24
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
if (valueLen >= minDigits && valueLen <= maxDigits)
|
|
27
|
+
return true;
|
|
28
|
+
if (minDigits === maxDigits)
|
|
29
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
30
|
+
return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
|
|
26
31
|
}
|
|
27
32
|
})
|
|
28
33
|
.required('mobile_number_error')
|
|
@@ -95,9 +95,12 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
95
95
|
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) || '';
|
|
96
96
|
var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
|
|
97
97
|
var isSA = countryCodeValue.iso2 === 'SA';
|
|
98
|
-
var
|
|
98
|
+
var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
|
|
99
|
+
var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
|
|
99
100
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
100
|
-
var
|
|
101
|
+
var requiredSALen = isStartsWith5 ? mobileMaxLen - 1 : mobileMaxLen;
|
|
102
|
+
var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
|
|
103
|
+
var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
|
|
101
104
|
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;
|
|
102
105
|
var readOnly = number && country_code && !error;
|
|
103
106
|
React.useEffect(function () {
|
|
@@ -146,7 +149,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
146
149
|
});
|
|
147
150
|
setCountries(filteredCountries);
|
|
148
151
|
};
|
|
149
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength:
|
|
152
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredMaxLen }, type: 'tel', readOnly: !!anchorEl || readOnly, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: readOnly ? undefined : 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, { minLength: requiredMinLen, length: requiredMaxLen, number: '05|5' }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
150
153
|
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, {})] }));
|
|
151
154
|
} })] }))] })) })));
|
|
152
155
|
});
|
|
@@ -13,7 +13,8 @@ export var IndividualMobileValidation = yup.object().shape({
|
|
|
13
13
|
test: function (value) {
|
|
14
14
|
var countryCode = this.parent.countryCode;
|
|
15
15
|
var isSA = countryCode.iso2 === 'SA';
|
|
16
|
-
var
|
|
16
|
+
var maxDigits = countryCode.max_digits;
|
|
17
|
+
var minDigits = countryCode.min_digits;
|
|
17
18
|
var mobileValue = value || '';
|
|
18
19
|
var valueLen = mobileValue.length;
|
|
19
20
|
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
@@ -25,10 +26,14 @@ export var IndividualMobileValidation = yup.object().shape({
|
|
|
25
26
|
if (isSA) {
|
|
26
27
|
if (!isSaudiNumber)
|
|
27
28
|
return this.createError({ message: 'start_with_number' });
|
|
28
|
-
var requiredLen = isStartWith5 ?
|
|
29
|
+
var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
|
|
29
30
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
+
if (valueLen >= minDigits && valueLen <= maxDigits)
|
|
33
|
+
return true;
|
|
34
|
+
if (minDigits === maxDigits)
|
|
35
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
36
|
+
return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
|
|
32
37
|
}
|
|
33
38
|
})
|
|
34
39
|
.required('mobile_number_error')
|
|
@@ -97,9 +97,12 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
97
97
|
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) || '';
|
|
98
98
|
var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
|
|
99
99
|
var isSA = countryCodeValue.iso2 === 'SA';
|
|
100
|
-
var
|
|
100
|
+
var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
|
|
101
|
+
var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
|
|
101
102
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
102
|
-
var
|
|
103
|
+
var requiredSALen = isStartsWith5 ? mobileMaxLen - 1 : mobileMaxLen;
|
|
104
|
+
var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
|
|
105
|
+
var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
|
|
103
106
|
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]);
|
|
104
107
|
React.useEffect(function () {
|
|
105
108
|
if (mobileValue)
|
|
@@ -154,7 +157,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
154
157
|
});
|
|
155
158
|
setCountries(filteredCountries);
|
|
156
159
|
};
|
|
157
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : isOtherThanKWOrSACountry ? '117px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength:
|
|
160
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : isOtherThanKWOrSACountry ? '117px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredMaxLen }, type: 'tel', readOnly: !!anchorEl, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, 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: !anchorEl ? error && t(error, { minLength: requiredMinLen, length: requiredMaxLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
158
161
|
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, {})] }));
|
|
159
162
|
} })] }))] })) })));
|
|
160
163
|
});
|
|
@@ -6,7 +6,8 @@ export var PhoneValidationSchema = yup.object().shape({
|
|
|
6
6
|
test: function (value) {
|
|
7
7
|
var countryCode = this.parent.countryCode;
|
|
8
8
|
var isSA = countryCode.iso2 === 'SA';
|
|
9
|
-
var
|
|
9
|
+
var maxDigits = countryCode.max_digits;
|
|
10
|
+
var minDigits = countryCode.min_digits;
|
|
10
11
|
var mobileValue = value || '';
|
|
11
12
|
var valueLen = mobileValue.length;
|
|
12
13
|
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
@@ -18,10 +19,14 @@ export var PhoneValidationSchema = yup.object().shape({
|
|
|
18
19
|
if (isSA) {
|
|
19
20
|
if (!isSaudiNumber)
|
|
20
21
|
return this.createError({ message: 'start_with_number' });
|
|
21
|
-
var requiredLen = isStartWith5 ?
|
|
22
|
+
var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
|
|
22
23
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
if (valueLen >= minDigits && valueLen <= maxDigits)
|
|
26
|
+
return true;
|
|
27
|
+
if (minDigits === maxDigits)
|
|
28
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
29
|
+
return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
|
|
25
30
|
}
|
|
26
31
|
})
|
|
27
32
|
.required('mobile_number_error')
|
|
@@ -93,9 +93,12 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
93
93
|
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) || '';
|
|
94
94
|
var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
|
|
95
95
|
var isSA = countryCodeValue.iso2 === 'SA';
|
|
96
|
-
var
|
|
96
|
+
var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
|
|
97
|
+
var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
|
|
97
98
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
98
|
-
var
|
|
99
|
+
var requiredSALen = isStartsWith5 ? mobileMaxLen - 1 : mobileMaxLen;
|
|
100
|
+
var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
|
|
101
|
+
var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
|
|
99
102
|
React.useEffect(function () {
|
|
100
103
|
if (mobileValue)
|
|
101
104
|
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
@@ -142,11 +145,11 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
142
145
|
});
|
|
143
146
|
setCountries(filteredCountries);
|
|
144
147
|
};
|
|
145
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { readOnly: readOnly, inputProps: { maxLength:
|
|
148
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { readOnly: readOnly, inputProps: { maxLength: requiredMaxLen }, type: 'tel', disabled: !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () {
|
|
146
149
|
if (readOnly)
|
|
147
150
|
return;
|
|
148
151
|
toggleCountryList();
|
|
149
|
-
} }, { 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:
|
|
152
|
+
} }, { 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, { minLength: requiredMinLen, length: requiredMaxLen, number: '05|5' }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
150
153
|
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, {})] }));
|
|
151
154
|
} })] }))] })) })));
|
|
152
155
|
});
|
|
@@ -9,7 +9,8 @@ export var CollectIndividualInfoValidation = yup.object().shape({
|
|
|
9
9
|
test: function (value) {
|
|
10
10
|
var countryCode = this.parent.countryCode;
|
|
11
11
|
var isSA = countryCode.iso2 === 'SA';
|
|
12
|
-
var
|
|
12
|
+
var maxDigits = countryCode.max_digits;
|
|
13
|
+
var minDigits = countryCode.min_digits;
|
|
13
14
|
var mobileValue = value || '';
|
|
14
15
|
var valueLen = mobileValue.length;
|
|
15
16
|
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
@@ -21,10 +22,14 @@ export var CollectIndividualInfoValidation = yup.object().shape({
|
|
|
21
22
|
if (isSA) {
|
|
22
23
|
if (!isSaudiNumber)
|
|
23
24
|
return this.createError({ message: 'start_with_number' });
|
|
24
|
-
var requiredLen = isStartWith5 ?
|
|
25
|
+
var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
|
|
25
26
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
if (valueLen >= minDigits && valueLen <= maxDigits)
|
|
29
|
+
return true;
|
|
30
|
+
if (minDigits === maxDigits)
|
|
31
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
32
|
+
return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
|
|
28
33
|
}
|
|
29
34
|
})
|
|
30
35
|
.required('mobile_number_error')
|
|
@@ -97,9 +97,12 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
97
97
|
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) || '';
|
|
98
98
|
var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
|
|
99
99
|
var isSA = countryCodeValue.iso2 === 'SA';
|
|
100
|
-
var
|
|
100
|
+
var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
|
|
101
|
+
var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
|
|
101
102
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
102
|
-
var
|
|
103
|
+
var requiredSALen = isStartsWith5 ? mobileMaxLen - 1 : mobileMaxLen;
|
|
104
|
+
var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
|
|
105
|
+
var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
|
|
103
106
|
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]);
|
|
104
107
|
React.useEffect(function () {
|
|
105
108
|
if (mobileValue)
|
|
@@ -147,11 +150,11 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
147
150
|
});
|
|
148
151
|
setCountries(filteredCountries);
|
|
149
152
|
};
|
|
150
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : isOtherThanKWOrSACountry ? '117px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength:
|
|
153
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : isOtherThanKWOrSACountry ? '117px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredMaxLen }, type: 'tel', readOnly: !!anchorEl || readOnly, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () {
|
|
151
154
|
if (readOnly)
|
|
152
155
|
return;
|
|
153
156
|
toggleCountryList();
|
|
154
|
-
} }, { 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: !anchorEl ? error && t(error, { length:
|
|
157
|
+
} }, { 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: !anchorEl ? error && t(error, { minLength: requiredMinLen, length: requiredMaxLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
155
158
|
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, {})] }));
|
|
156
159
|
} })] }))] })) })));
|
|
157
160
|
});
|
|
@@ -9,7 +9,8 @@ export var PhoneValidationSchema = function (isLeadIdPassed) {
|
|
|
9
9
|
test: function (value) {
|
|
10
10
|
var countryCode = this.parent.countryCode;
|
|
11
11
|
var isSA = countryCode.iso2 === 'SA';
|
|
12
|
-
var
|
|
12
|
+
var maxDigits = countryCode.max_digits;
|
|
13
|
+
var minDigits = countryCode.min_digits;
|
|
13
14
|
var mobileValue = value || '';
|
|
14
15
|
var valueLen = mobileValue.length;
|
|
15
16
|
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
@@ -21,10 +22,14 @@ export var PhoneValidationSchema = function (isLeadIdPassed) {
|
|
|
21
22
|
if (isSA) {
|
|
22
23
|
if (!isSaudiNumber)
|
|
23
24
|
return this.createError({ message: 'start_with_number' });
|
|
24
|
-
var requiredLen = isStartWith5 ?
|
|
25
|
+
var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
|
|
25
26
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
if (valueLen >= minDigits && valueLen <= maxDigits)
|
|
29
|
+
return true;
|
|
30
|
+
if (minDigits === maxDigits)
|
|
31
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
32
|
+
return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
|
|
28
33
|
}
|
|
29
34
|
})
|
|
30
35
|
.required('mobile_number_error')
|
|
@@ -37,7 +42,8 @@ export var PhoneValidationSchema = function (isLeadIdPassed) {
|
|
|
37
42
|
test: function (value) {
|
|
38
43
|
var countryCode = this.parent.countryCode;
|
|
39
44
|
var isSA = countryCode.iso2 === 'SA';
|
|
40
|
-
var
|
|
45
|
+
var maxDigits = countryCode.max_digits;
|
|
46
|
+
var minDigits = countryCode.min_digits;
|
|
41
47
|
var mobileValue = value || '';
|
|
42
48
|
var valueLen = mobileValue.length;
|
|
43
49
|
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
@@ -49,10 +55,14 @@ export var PhoneValidationSchema = function (isLeadIdPassed) {
|
|
|
49
55
|
if (isSA) {
|
|
50
56
|
if (!isSaudiNumber)
|
|
51
57
|
return this.createError({ message: 'start_with_number' });
|
|
52
|
-
var requiredLen = isStartWith5 ?
|
|
58
|
+
var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
|
|
53
59
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
54
60
|
}
|
|
55
|
-
|
|
61
|
+
if (valueLen >= minDigits && valueLen <= maxDigits)
|
|
62
|
+
return true;
|
|
63
|
+
if (minDigits === maxDigits)
|
|
64
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
65
|
+
return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
|
|
56
66
|
}
|
|
57
67
|
})
|
|
58
68
|
.required('mobile_number_error')
|
|
@@ -94,9 +94,12 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
94
94
|
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) || '';
|
|
95
95
|
var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
|
|
96
96
|
var isSA = (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.iso2) === 'SA';
|
|
97
|
-
var
|
|
97
|
+
var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
|
|
98
|
+
var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
|
|
98
99
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
99
|
-
var
|
|
100
|
+
var requiredSALen = isStartsWith5 ? mobileMaxLen - 1 : mobileMaxLen;
|
|
101
|
+
var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
|
|
102
|
+
var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
|
|
100
103
|
var verify = data.verify;
|
|
101
104
|
React.useEffect(function () {
|
|
102
105
|
if (mobileValue)
|
|
@@ -135,7 +138,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
135
138
|
setValue('mobile', '');
|
|
136
139
|
countryCodeControl.field.onChange(country);
|
|
137
140
|
};
|
|
138
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength:
|
|
141
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredMaxLen }, type: 'tel', disabled: !!anchorEl, onClick: onCloseCountryList, 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, { minLength: requiredMinLen, length: requiredMaxLen, number: '05|5' }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
139
142
|
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, {})] }));
|
|
140
143
|
} }) }))] })) })));
|
|
141
144
|
});
|
|
@@ -14,7 +14,8 @@ export var IndividualCollectInfoValidationSchema = function (activeUser) {
|
|
|
14
14
|
if (((value === null || value === void 0 ? void 0 : value.length) || 0) > 0) {
|
|
15
15
|
var countryCode = this.parent.countryCode;
|
|
16
16
|
var isSA = countryCode.iso2 === 'SA';
|
|
17
|
-
var
|
|
17
|
+
var maxDigits = countryCode.max_digits;
|
|
18
|
+
var minDigits = countryCode.min_digits;
|
|
18
19
|
var mobileValue = value || '';
|
|
19
20
|
var valueLen = mobileValue.length;
|
|
20
21
|
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
@@ -26,10 +27,14 @@ export var IndividualCollectInfoValidationSchema = function (activeUser) {
|
|
|
26
27
|
if (isSA) {
|
|
27
28
|
if (!isSaudiNumber)
|
|
28
29
|
return this.createError({ message: 'start_with_number' });
|
|
29
|
-
var requiredLen = isStartWith5 ?
|
|
30
|
+
var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
|
|
30
31
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
+
if (valueLen >= minDigits && valueLen <= maxDigits)
|
|
34
|
+
return true;
|
|
35
|
+
if (minDigits === maxDigits)
|
|
36
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
37
|
+
return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
|
|
33
38
|
}
|
|
34
39
|
return true;
|
|
35
40
|
}
|
|
@@ -95,9 +95,12 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
95
95
|
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) || '';
|
|
96
96
|
var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
|
|
97
97
|
var isSA = (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.iso2) === 'SA';
|
|
98
|
-
var
|
|
98
|
+
var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
|
|
99
|
+
var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
|
|
99
100
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
100
|
-
var
|
|
101
|
+
var requiredSALen = isStartsWith5 ? mobileMaxLen - 1 : mobileMaxLen;
|
|
102
|
+
var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
|
|
103
|
+
var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
|
|
101
104
|
React.useEffect(function () {
|
|
102
105
|
if (mobileValue)
|
|
103
106
|
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
@@ -135,7 +138,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
135
138
|
setValue('mobile', '');
|
|
136
139
|
countryCodeControl.field.onChange(country);
|
|
137
140
|
};
|
|
138
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { readOnly: readOnly, inputProps: { maxLength:
|
|
141
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { readOnly: readOnly, inputProps: { maxLength: requiredMaxLen }, type: 'tel', disabled: !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: readOnly ? undefined : 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 })) : (_jsx(EndAdornment, { value: mobileValue, isVerified: isVerified, onClear: clearMobileNumber, error: error })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { minLength: requiredMinLen, length: requiredMaxLen, number: '05|5' }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
139
142
|
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, { isVerified: isVerified })] }));
|
|
140
143
|
} }) }))] })) })));
|
|
141
144
|
});
|
|
@@ -22,7 +22,8 @@ export var IndividualInfoValidationSchema = function (isOtherCountry) {
|
|
|
22
22
|
if (((value === null || value === void 0 ? void 0 : value.length) || 0) > 0) {
|
|
23
23
|
var countryCode = this.parent.countryCode;
|
|
24
24
|
var isSA = countryCode.iso2 === 'SA';
|
|
25
|
-
var
|
|
25
|
+
var maxDigits = countryCode.max_digits;
|
|
26
|
+
var minDigits = countryCode.min_digits;
|
|
26
27
|
var mobileValue = value || '';
|
|
27
28
|
var valueLen = mobileValue.length;
|
|
28
29
|
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
@@ -34,10 +35,14 @@ export var IndividualInfoValidationSchema = function (isOtherCountry) {
|
|
|
34
35
|
if (isSA) {
|
|
35
36
|
if (!isSaudiNumber)
|
|
36
37
|
return this.createError({ message: 'start_with_number' });
|
|
37
|
-
var requiredLen = isStartWith5 ?
|
|
38
|
+
var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
|
|
38
39
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
if (valueLen >= minDigits && valueLen <= maxDigits)
|
|
42
|
+
return true;
|
|
43
|
+
if (minDigits === maxDigits)
|
|
44
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
45
|
+
return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
|
|
41
46
|
}
|
|
42
47
|
return true;
|
|
43
48
|
}
|
|
@@ -94,9 +94,12 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
94
94
|
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) || '';
|
|
95
95
|
var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
|
|
96
96
|
var isSA = (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.iso2) === 'SA';
|
|
97
|
-
var
|
|
97
|
+
var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
|
|
98
|
+
var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
|
|
98
99
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
99
|
-
var
|
|
100
|
+
var requiredSALen = isStartsWith5 ? mobileMaxLen - 1 : mobileMaxLen;
|
|
101
|
+
var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
|
|
102
|
+
var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
|
|
100
103
|
var verify = data.verify;
|
|
101
104
|
React.useEffect(function () {
|
|
102
105
|
if (mobileValue)
|
|
@@ -135,11 +138,11 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
135
138
|
setValue('mobile', '');
|
|
136
139
|
countryCodeControl.field.onChange(country);
|
|
137
140
|
};
|
|
138
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { readOnly: readOnly, inputProps: { maxLength:
|
|
141
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { readOnly: readOnly, inputProps: { maxLength: requiredMaxLen }, type: 'tel', disabled: !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () {
|
|
139
142
|
if (readOnly)
|
|
140
143
|
return;
|
|
141
144
|
toggleCountryList();
|
|
142
|
-
} }, { 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:
|
|
145
|
+
} }, { 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, { minLength: requiredMinLen, length: requiredMaxLen, number: '05|5' }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
143
146
|
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, {})] }));
|
|
144
147
|
} }) }))] })) })));
|
|
145
148
|
});
|
|
@@ -7,7 +7,8 @@ export var IndividualPhoneInfoValidationSchema = yup.object().shape({
|
|
|
7
7
|
if (((value === null || value === void 0 ? void 0 : value.length) || 0) > 0) {
|
|
8
8
|
var countryCode = this.parent.countryCode;
|
|
9
9
|
var isSA = countryCode.iso2 === 'SA';
|
|
10
|
-
var
|
|
10
|
+
var maxDigits = countryCode.max_digits;
|
|
11
|
+
var minDigits = countryCode.min_digits;
|
|
11
12
|
var mobileValue = value || '';
|
|
12
13
|
var valueLen = mobileValue.length;
|
|
13
14
|
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
@@ -19,10 +20,14 @@ export var IndividualPhoneInfoValidationSchema = yup.object().shape({
|
|
|
19
20
|
if (isSA) {
|
|
20
21
|
if (!isSaudiNumber)
|
|
21
22
|
return this.createError({ message: 'start_with_number' });
|
|
22
|
-
var requiredLen = isStartWith5 ?
|
|
23
|
+
var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
|
|
23
24
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
if (valueLen >= minDigits && valueLen <= maxDigits)
|
|
27
|
+
return true;
|
|
28
|
+
if (minDigits === maxDigits)
|
|
29
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
30
|
+
return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
|
|
26
31
|
}
|
|
27
32
|
return true;
|
|
28
33
|
}
|
|
@@ -95,9 +95,12 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
95
95
|
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) || '';
|
|
96
96
|
var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
|
|
97
97
|
var isSA = countryCodeValue.iso2 === 'SA';
|
|
98
|
-
var
|
|
98
|
+
var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
|
|
99
|
+
var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
|
|
99
100
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
100
|
-
var
|
|
101
|
+
var requiredSALen = isStartsWith5 ? mobileMaxLen - 1 : mobileMaxLen;
|
|
102
|
+
var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
|
|
103
|
+
var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
|
|
101
104
|
React.useEffect(function () {
|
|
102
105
|
if (mobileValue)
|
|
103
106
|
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
@@ -144,7 +147,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
144
147
|
});
|
|
145
148
|
setCountries(filteredCountries);
|
|
146
149
|
};
|
|
147
|
-
return (_jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength:
|
|
150
|
+
return (_jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredMaxLen }, type: 'tel', readOnly: !!anchorEl, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, 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: !anchorEl ? error && t(error, { minLength: requiredMinLen, length: requiredMaxLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
148
151
|
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, {})] }));
|
|
149
152
|
} })] }))] })));
|
|
150
153
|
});
|
|
@@ -6,7 +6,8 @@ export var PhoneValidationSchema = yup.object().shape({
|
|
|
6
6
|
test: function (value) {
|
|
7
7
|
var countryCode = this.parent.countryCode;
|
|
8
8
|
var isSA = countryCode.iso2 === 'SA';
|
|
9
|
-
var
|
|
9
|
+
var maxDigits = countryCode.max_digits;
|
|
10
|
+
var minDigits = countryCode.min_digits;
|
|
10
11
|
var mobileValue = value || '';
|
|
11
12
|
var valueLen = mobileValue.length;
|
|
12
13
|
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
@@ -18,10 +19,14 @@ export var PhoneValidationSchema = yup.object().shape({
|
|
|
18
19
|
if (isSA) {
|
|
19
20
|
if (!isSaudiNumber)
|
|
20
21
|
return this.createError({ message: 'start_with_number' });
|
|
21
|
-
var requiredLen = isStartWith5 ?
|
|
22
|
+
var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
|
|
22
23
|
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
if (valueLen >= minDigits && valueLen <= maxDigits)
|
|
26
|
+
return true;
|
|
27
|
+
if (minDigits === maxDigits)
|
|
28
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
29
|
+
return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
|
|
25
30
|
}
|
|
26
31
|
})
|
|
27
32
|
.required('mobile_number_error')
|