@tap-payments/auth-jsconnect 2.8.24-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.
Files changed (27) hide show
  1. package/build/@types/app.d.ts +2 -0
  2. package/build/constants/dummy.d.ts +6 -0
  3. package/build/constants/dummy.js +36 -12
  4. package/build/features/app/bank/bankStore.js +31 -25
  5. package/build/features/app/brand/brandStore.js +34 -28
  6. package/build/features/app/entity/entityStore.js +27 -25
  7. package/build/features/app/individual/individualStore.js +85 -75
  8. package/build/features/app/tax/taxStore.js +28 -22
  9. package/build/features/auth/screens/Mobile/MobileNumber.js +7 -4
  10. package/build/features/auth/screens/Mobile/validation.js +8 -3
  11. package/build/features/connect/screens/Individual/MobileNumber.js +6 -3
  12. package/build/features/connect/screens/Individual/validation.js +8 -3
  13. package/build/features/connect/screens/Mobile/MobileNumber.js +6 -3
  14. package/build/features/connect/screens/Mobile/validation.js +8 -3
  15. package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.js +7 -4
  16. package/build/features/connectExpress/screens/CollectIndividualInfo/validation.js +8 -3
  17. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +7 -4
  18. package/build/features/connectExpress/screens/Mobile/validation.js +16 -6
  19. package/build/features/individual/screens/IndividualList/MobileNumber.js +6 -3
  20. package/build/features/individual/screens/IndividualList/validation.js +8 -3
  21. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +6 -3
  22. package/build/features/individual/screens/IndividualPersonalInfo/validation.js +8 -3
  23. package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.js +7 -4
  24. package/build/features/individual/screens/IndividualPhoneInfo/validation.js +8 -3
  25. package/build/features/signIn/screens/Mobile/MobileNumber.js +6 -3
  26. package/build/features/signIn/screens/Mobile/validation.js +8 -3
  27. package/package.json +1 -1
@@ -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 mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
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 requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
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: requiredLen }, type: 'tel', disabled: !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () {
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: requiredLen, 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) {
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 digits = countryCode.digits;
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 ? digits - 1 : digits;
25
+ var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
25
26
  return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
26
27
  }
27
- return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
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 mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
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 requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
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: requiredLen }, 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 () {
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: requiredLen, 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) {
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 digits = countryCode.digits;
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 ? digits - 1 : digits;
25
+ var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
25
26
  return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
26
27
  }
27
- return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
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 digits = countryCode.digits;
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 ? digits - 1 : digits;
58
+ var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
53
59
  return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
54
60
  }
55
- return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
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 mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
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 requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
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: requiredLen }, 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, { length: requiredLen, 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) {
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 digits = countryCode.digits;
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 ? digits - 1 : digits;
30
+ var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
30
31
  return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
31
32
  }
32
- return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
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 mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
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 requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
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: requiredLen }, 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, { length: requiredLen, 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) {
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 digits = countryCode.digits;
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 ? digits - 1 : digits;
38
+ var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
38
39
  return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
39
40
  }
40
- return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
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 mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
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 requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
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: requiredLen }, type: 'tel', disabled: !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () {
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: requiredLen, 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) {
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 digits = countryCode.digits;
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 ? digits - 1 : digits;
23
+ var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
23
24
  return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
24
25
  }
25
- return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
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 mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
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 requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
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: requiredLen }, 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, { length: requiredLen, 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) {
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 digits = countryCode.digits;
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 ? digits - 1 : digits;
22
+ var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
22
23
  return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
23
24
  }
24
- return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
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')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.8.24-test",
3
+ "version": "2.8.26-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",