@tap-payments/auth-jsconnect 1.0.35 → 1.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/build/components/AnimationFlow/BottomSheet.js +26 -2
  2. package/build/components/OTPTimer/OTPTimer.js +4 -2
  3. package/build/constants/app.js +1 -1
  4. package/build/constants/validation.d.ts +1 -0
  5. package/build/constants/validation.js +1 -0
  6. package/build/features/app/business/businessStore.d.ts +1 -1
  7. package/build/features/app/business/businessStore.js +32 -23
  8. package/build/features/app/connect/connectStore.d.ts +1 -1
  9. package/build/features/app/connect/connectStore.js +17 -11
  10. package/build/features/business/screens/BusinessType/BusinessType.js +16 -23
  11. package/build/features/business/screens/BusinessType/CompanyLicense.js +23 -9
  12. package/build/features/business/screens/BusinessType/FreelanceLicense.js +23 -9
  13. package/build/features/business/screens/Confirm/Confirm.js +4 -3
  14. package/build/features/business/screens/OTP/OTPInput.js +1 -2
  15. package/build/features/business/screens/Verify/OTPInput.js +1 -2
  16. package/build/features/business/screens/Verify/Verify.js +3 -3
  17. package/build/features/connect/screens/Individual/Email.js +10 -1
  18. package/build/features/connect/screens/Individual/Individual.js +8 -10
  19. package/build/features/connect/screens/Individual/MobileNumber.js +3 -16
  20. package/build/features/connect/screens/Merchant/Merchant.js +11 -11
  21. package/build/features/connect/screens/Merchant/SocialMedia.js +2 -1
  22. package/build/features/connect/screens/Merchant/TAC.js +1 -1
  23. package/build/features/connect/screens/Merchant/validation.js +3 -2
  24. package/build/features/connect/screens/Mobile/BusinessCountry.js +1 -1
  25. package/build/features/connect/screens/Mobile/Mobile.js +1 -9
  26. package/build/features/connect/screens/Mobile/MobileNumber.js +3 -16
  27. package/build/features/connect/screens/NID/IDNumber.d.ts +0 -1
  28. package/build/features/connect/screens/NID/IDNumber.js +2 -2
  29. package/build/features/connect/screens/NID/NID.js +1 -6
  30. package/build/features/connect/screens/OTP/OTP.js +2 -4
  31. package/build/features/connect/screens/Password/Password.js +1 -6
  32. package/build/features/shared/Button/Button.js +16 -11
  33. package/build/features/shared/SuccessScreen/SuccessScreen.js +10 -5
  34. package/build/hooks/index.d.ts +1 -0
  35. package/build/hooks/index.js +1 -0
  36. package/build/hooks/useWindowSize.d.ts +6 -0
  37. package/build/hooks/useWindowSize.js +19 -0
  38. package/package.json +126 -126
  39. package/build/features/app/business/midStore.d.ts +0 -10
  40. package/build/features/app/business/midStore.js +0 -18
  41. package/build/features/app/connect/midStore.d.ts +0 -10
  42. package/build/features/app/connect/midStore.js +0 -18
  43. package/build/features/business/screens/VerifyNumber/OTPInput.d.ts +0 -5
  44. package/build/features/business/screens/VerifyNumber/OTPInput.js +0 -39
  45. package/build/features/business/screens/VerifyNumber/VerifyNumber.d.ts +0 -13
  46. package/build/features/business/screens/VerifyNumber/VerifyNumber.js +0 -76
  47. package/build/features/business/screens/VerifyNumber/index.d.ts +0 -3
  48. package/build/features/business/screens/VerifyNumber/index.js +0 -2
  49. package/build/features/business/screens/VerifyNumber/validation.d.ts +0 -8
  50. package/build/features/business/screens/VerifyNumber/validation.js +0 -4
  51. package/build/features/connect/screens/MID/BusinessCountry.d.ts +0 -11
  52. package/build/features/connect/screens/MID/BusinessCountry.js +0 -92
  53. package/build/features/connect/screens/MID/DOB.d.ts +0 -6
  54. package/build/features/connect/screens/MID/DOB.js +0 -38
  55. package/build/features/connect/screens/MID/IDNumber.d.ts +0 -7
  56. package/build/features/connect/screens/MID/IDNumber.js +0 -70
  57. package/build/features/connect/screens/MID/MID.d.ts +0 -5
  58. package/build/features/connect/screens/MID/MID.js +0 -87
  59. package/build/features/connect/screens/MID/MIDTitle.d.ts +0 -8
  60. package/build/features/connect/screens/MID/MIDTitle.js +0 -29
  61. package/build/features/connect/screens/MID/MobileNumber.d.ts +0 -12
  62. package/build/features/connect/screens/MID/MobileNumber.js +0 -148
  63. package/build/features/connect/screens/MID/index.d.ts +0 -3
  64. package/build/features/connect/screens/MID/index.js +0 -2
  65. package/build/features/connect/screens/MID/validation.d.ts +0 -18
  66. package/build/features/connect/screens/MID/validation.js +0 -15
  67. package/build/features/owner/Owner.d.ts +0 -6
  68. package/build/features/owner/Owner.js +0 -50
  69. package/build/features/owner/index.d.ts +0 -1
  70. package/build/features/owner/index.js +0 -1
  71. package/build/features/owner/screens/AdditionalOwnerInfo/AdditionalOwnerInfo.d.ts +0 -8
  72. package/build/features/owner/screens/AdditionalOwnerInfo/AdditionalOwnerInfo.js +0 -77
  73. package/build/features/owner/screens/AdditionalOwnerInfo/EmployerLocation.d.ts +0 -10
  74. package/build/features/owner/screens/AdditionalOwnerInfo/EmployerLocation.js +0 -80
  75. package/build/features/owner/screens/AdditionalOwnerInfo/EmployerName.d.ts +0 -6
  76. package/build/features/owner/screens/AdditionalOwnerInfo/EmployerName.js +0 -40
  77. package/build/features/owner/screens/AdditionalOwnerInfo/InfluencerSwitch.d.ts +0 -6
  78. package/build/features/owner/screens/AdditionalOwnerInfo/InfluencerSwitch.js +0 -45
  79. package/build/features/owner/screens/AdditionalOwnerInfo/MonthlyIncome.d.ts +0 -6
  80. package/build/features/owner/screens/AdditionalOwnerInfo/MonthlyIncome.js +0 -35
  81. package/build/features/owner/screens/AdditionalOwnerInfo/PEPSwitch.d.ts +0 -6
  82. package/build/features/owner/screens/AdditionalOwnerInfo/PEPSwitch.js +0 -45
  83. package/build/features/owner/screens/AdditionalOwnerInfo/SourceOfIncome.d.ts +0 -9
  84. package/build/features/owner/screens/AdditionalOwnerInfo/SourceOfIncome.js +0 -85
  85. package/build/features/owner/screens/AdditionalOwnerInfo/index.d.ts +0 -3
  86. package/build/features/owner/screens/AdditionalOwnerInfo/index.js +0 -2
  87. package/build/features/owner/screens/AdditionalOwnerInfo/validation.d.ts +0 -25
  88. package/build/features/owner/screens/AdditionalOwnerInfo/validation.js +0 -35
  89. package/build/features/owner/screens/ShowOwnerInfo/ShowOwnerInfo.d.ts +0 -19
  90. package/build/features/owner/screens/ShowOwnerInfo/ShowOwnerInfo.js +0 -52
  91. package/build/features/owner/screens/ShowOwnerInfo/index.d.ts +0 -3
  92. package/build/features/owner/screens/ShowOwnerInfo/index.js +0 -2
  93. package/build/features/owner/screens/ShowOwnerInfo/info.d.ts +0 -7
  94. package/build/features/owner/screens/ShowOwnerInfo/info.js +0 -28
  95. package/build/features/owner/screens/Success/Success.d.ts +0 -5
  96. package/build/features/owner/screens/Success/Success.js +0 -14
  97. package/build/features/owner/screens/Success/index.d.ts +0 -3
  98. package/build/features/owner/screens/Success/index.js +0 -2
  99. package/build/features/shared/ExpandIcon/ExpandIcon.d.ts +0 -7
  100. package/build/features/shared/ExpandIcon/ExpandIcon.js +0 -24
  101. package/build/features/shared/ExpandIcon/index.d.ts +0 -2
  102. package/build/features/shared/ExpandIcon/index.js +0 -2
@@ -36,7 +36,6 @@ import Input from '../../../shared/Input';
36
36
  import SimpleList from '../../../../components/SimpleList';
37
37
  import { removeAllCharsFromNumber } from '../../../../utils';
38
38
  import { useLanguage } from '../../../../hooks';
39
- import { SAUDI_NUMBER_LENGTH } from '../../../../constants';
40
39
  var LabelContainerStyled = styled(Box)(function (_a) {
41
40
  var theme = _a.theme;
42
41
  return ({
@@ -87,23 +86,11 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
87
86
  var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
88
87
  var error = (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
89
88
  var isSA = countryCodeValue.iso2 === 'SA';
90
- var isStartingWithZero = mobileValue.startsWith('0');
91
- var mobileLen = isSA
92
- ? isStartingWithZero
93
- ? countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits
94
- : SAUDI_NUMBER_LENGTH
95
- : countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
89
+ var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
96
90
  React.useEffect(function () {
97
- if (mobileValue) {
91
+ if (mobileValue)
98
92
  setValue('mobile', mobileValue, { shouldValidate: true });
99
- }
100
93
  }, []);
101
- React.useEffect(function () {
102
- var _a;
103
- if ((mobileValue === null || mobileValue === void 0 ? void 0 : mobileValue.length) === 1 && isSA) {
104
- (_a = rest.setMobileLength) === null || _a === void 0 ? void 0 : _a.call(rest, mobileLen);
105
- }
106
- }, [mobileValue]);
107
94
  var onPhoneNumberChange = function (_a) {
108
95
  var target = _a.target;
109
96
  var value = removeAllCharsFromNumber(target.value);
@@ -129,7 +116,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
129
116
  countryCodeControl.field.onChange(country);
130
117
  (_a = rest.setMobileLength) === null || _a === void 0 ? void 0 : _a.call(rest, country.digits);
131
118
  };
132
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mb: 3 }, ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: mobileLen }, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: mobileLen }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
119
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mb: 3 }, ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, type: 'tel', inputProps: { maxLength: mobileLen }, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: mobileLen }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
133
120
  return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
134
121
  } }) }))] })) })));
135
122
  });
@@ -20,15 +20,15 @@ import { handlePrevScreenStep } from '../../../../app/settings';
20
20
  import Form from '../../../../components/Form';
21
21
  import { ScreenContainer } from '../../../shared/Containers';
22
22
  import Button from '../../../shared/Button';
23
- import { clearError, connectSelector, resetMerchantScreen, updateLeadBrand } from '../../../app/connect/connectStore';
23
+ import { clearError, connectSelector, updateLeadBrand } from '../../../app/connect/connectStore';
24
24
  import { useLanguage } from '../../../../hooks';
25
25
  import { MerchantValidationSchema } from './validation';
26
26
  import BrandName from './BrandName';
27
27
  import SocialMedia from './SocialMedia';
28
28
  import TAC from './TAC';
29
29
  var Merchant = function (_a) {
30
- var _b, _c, _d;
31
- var _e = useSelector(connectSelector), data = _e.data, loading = _e.loading, error = _e.error, searchActive = _e.searchActive;
30
+ var _b, _c, _d, _e;
31
+ var _f = useSelector(connectSelector), data = _f.data, loading = _f.loading, error = _f.error, searchActive = _f.searchActive;
32
32
  var methods = useForm({
33
33
  resolver: yupResolver(MerchantValidationSchema),
34
34
  defaultValues: data.brandData,
@@ -37,28 +37,28 @@ var Merchant = function (_a) {
37
37
  var t = useTranslation().t;
38
38
  var isAr = useLanguage().isAr;
39
39
  var dispatch = useAppDispatch();
40
+ var isNewUser = (_b = data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.new_user;
40
41
  var onSubmit = function (formData) {
41
42
  dispatch(updateLeadBrand(formData));
42
43
  };
43
44
  var onBack = function () {
44
- dispatch(handlePrevScreenStep());
45
+ if (isNewUser) {
46
+ dispatch(handlePrevScreenStep('CONNECT_INDIVIDUAL_STEP'));
47
+ return;
48
+ }
49
+ dispatch(handlePrevScreenStep('CONNECT_PASSWORD_STEP'));
45
50
  };
46
51
  React.useEffect(function () {
47
52
  if (error)
48
53
  dispatch(clearError());
49
54
  }, [methods.formState.isValid]);
50
- React.useEffect(function () {
51
- return function () {
52
- dispatch(resetMerchantScreen());
53
- };
54
- }, []);
55
55
  React.useEffect(function () {
56
56
  var _a, _b;
57
57
  if (((_b = (_a = data.brandData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.response_code) === '5')
58
58
  methods.setError('brandName', { message: 'Profile Name already exists' });
59
- }, [(_b = data.brandData) === null || _b === void 0 ? void 0 : _b.responseBody]);
59
+ }, [(_c = data.brandData) === null || _c === void 0 ? void 0 : _c.responseBody]);
60
60
  var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
61
- var disabled = brandErrChecks || searchActive || ((_d = (_c = data.brandData) === null || _c === void 0 ? void 0 : _c.responseBody) === null || _d === void 0 ? void 0 : _d.response_code) === '5';
61
+ var disabled = brandErrChecks || searchActive || ((_e = (_d = data.brandData) === null || _d === void 0 ? void 0 : _d.responseBody) === null || _e === void 0 ? void 0 : _e.response_code) === '5';
62
62
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, {}), _jsx(SocialMedia, {}), _jsx(TAC, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] })) })) }));
63
63
  };
64
64
  export default React.memo(Merchant);
@@ -35,7 +35,8 @@ var InputStyled = styled(Input)(function (_a) {
35
35
  padding: theme.spacing(0, 2, 0, 0),
36
36
  paddingInlineEnd: theme.spacing(2),
37
37
  input: {
38
- paddingInlineStart: theme.spacing(0)
38
+ paddingInlineStart: theme.spacing(0),
39
+ textTransform: 'lowercase'
39
40
  }
40
41
  });
41
42
  });
@@ -34,7 +34,7 @@ var TACContainerStyled = styled(Box)(function (_a) {
34
34
  });
35
35
  var TextStyled = styled(Text)(function (_a) {
36
36
  var theme = _a.theme;
37
- return (__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre', height: 'fit-content' }, theme.typography.body2));
37
+ return (__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre-line', height: 'fit-content' }, theme.typography.body2));
38
38
  });
39
39
  var LinkStyled = styled(Link)(function (_a) {
40
40
  var theme = _a.theme;
@@ -1,3 +1,4 @@
1
+ import { REGEX_WEBSITE } from '../../../../constants';
1
2
  import * as yup from 'yup';
2
3
  export var MerchantValidationSchema = yup.object().shape({
3
4
  brandName: yup
@@ -11,7 +12,7 @@ export var MerchantValidationSchema = yup.object().shape({
11
12
  if (!instagram && !twitter) {
12
13
  return yup
13
14
  .string()
14
- .matches(/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}(:[0-9]{1,5})?(\/.*)?$/, 'ide_not_valid_url')
15
+ .matches(REGEX_WEBSITE, 'ide_not_valid_url')
15
16
  .transform(function (value) { return (!!value ? value : null); })
16
17
  .nullable()
17
18
  .required('enter_at_least_one');
@@ -19,7 +20,7 @@ export var MerchantValidationSchema = yup.object().shape({
19
20
  else {
20
21
  return yup
21
22
  .string()
22
- .matches(/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/, 'ide_not_valid_url')
23
+ .matches(REGEX_WEBSITE, 'ide_not_valid_url')
23
24
  .transform(function (value) { return (!!value ? value : null); })
24
25
  .nullable()
25
26
  .optional();
@@ -35,6 +35,6 @@ var BusinessCountry = React.forwardRef(function (_a, ref) {
35
35
  var country = _a.country, show = _a.show;
36
36
  var t = useTranslation().t;
37
37
  var isAr = useLanguage().isAr;
38
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ ref: ref, sx: { marginBottom: '25px' } }, { children: _jsx(Input, { sx: { cursor: 'auto' }, label: t('signup_select_country'), readOnly: true, startAdornment: _jsx(CountrySpanStyled, { children: _jsx(CountryIconStyled, { src: (country === null || country === void 0 ? void 0 : country.logo) || '' }) }), placeholder: t('ide_mobile_placeholder'), value: (isAr ? (_b = country === null || country === void 0 ? void 0 : country.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = country === null || country === void 0 ? void 0 : country.name) === null || _c === void 0 ? void 0 : _c.english) || '' }) })) })));
38
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ ref: ref, sx: { marginBottom: '25px' } }, { children: _jsx(Input, { sx: { cursor: 'auto' }, label: t('signup_select_country'), readOnly: true, disabled: true, startAdornment: _jsx(CountrySpanStyled, { children: _jsx(CountryIconStyled, { src: (country === null || country === void 0 ? void 0 : country.logo) || '' }) }), placeholder: t('ide_mobile_placeholder'), value: (isAr ? (_b = country === null || country === void 0 ? void 0 : country.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = country === null || country === void 0 ? void 0 : country.name) === null || _c === void 0 ? void 0 : _c.english) || '' }) })) })));
39
39
  });
40
40
  export default React.memo(BusinessCountry);
@@ -23,7 +23,7 @@ import Button, { AbsherButton } from '../../../shared/Button';
23
23
  import { useAppDispatch } from '../../../../hooks';
24
24
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
25
25
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
26
- import { clearError, resetMobileScreen, connectSelector, createMobileAuth } from '../../../app/connect/connectStore';
26
+ import { clearError, connectSelector, createMobileAuth } from '../../../app/connect/connectStore';
27
27
  import { useLanguage } from '../../../../hooks';
28
28
  import Divider from '@mui/material/Divider';
29
29
  import Text from '../../../../components/Text';
@@ -90,9 +90,6 @@ var Mobile = function (_a) {
90
90
  setListType(flag);
91
91
  };
92
92
  React.useEffect(function () {
93
- if (data.mobileData.countryCode.digits) {
94
- setMobileLength(data.mobileData.countryCode.digits);
95
- }
96
93
  if (data.mobileData.countryCode) {
97
94
  methods.setValue('countryCode', data.mobileData.countryCode);
98
95
  }
@@ -101,11 +98,6 @@ var Mobile = function (_a) {
101
98
  if (error)
102
99
  dispatch(clearError());
103
100
  }, [methods.formState.isValid]);
104
- React.useEffect(function () {
105
- return function () {
106
- dispatch(resetMobileScreen());
107
- };
108
- }, []);
109
101
  var onSubmit = function (formData) {
110
102
  dispatch(createMobileAuth(__assign(__assign({}, formData), { isResend: false })));
111
103
  };
@@ -36,7 +36,6 @@ import Input from '../../../shared/Input';
36
36
  import SimpleList from '../../../../components/SimpleList';
37
37
  import { removeAllCharsFromNumber } from '../../../../utils';
38
38
  import { useLanguage } from '../../../../hooks';
39
- import { SAUDI_NUMBER_LENGTH } from '../../../../constants';
40
39
  var LabelContainerStyled = styled(Box)(function (_a) {
41
40
  var theme = _a.theme;
42
41
  return ({
@@ -87,23 +86,11 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
87
86
  var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
88
87
  var error = (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
89
88
  var isSA = countryCodeValue.iso2 === 'SA';
90
- var isStartingWithZero = mobileValue.startsWith('0');
91
- var mobileLen = isSA
92
- ? isStartingWithZero
93
- ? countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits
94
- : SAUDI_NUMBER_LENGTH
95
- : countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
89
+ var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
96
90
  React.useEffect(function () {
97
- if (mobileValue) {
91
+ if (mobileValue)
98
92
  setValue('mobile', mobileValue, { shouldValidate: true });
99
- }
100
93
  }, []);
101
- React.useEffect(function () {
102
- var _a;
103
- if (mobileValue.length === 1 && isSA) {
104
- (_a = rest.setMobileLength) === null || _a === void 0 ? void 0 : _a.call(rest, mobileLen);
105
- }
106
- }, [mobileValue]);
107
94
  var onPhoneNumberChange = function (_a) {
108
95
  var target = _a.target;
109
96
  var value = removeAllCharsFromNumber(target.value);
@@ -129,7 +116,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
129
116
  countryCodeControl.field.onChange(country);
130
117
  (_a = rest.setMobileLength) === null || _a === void 0 ? void 0 : _a.call(rest, country.digits);
131
118
  };
132
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: mobileLen }, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: mobileLen }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
119
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: mobileLen }, type: 'tel', onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: mobileLen }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
133
120
  return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
134
121
  } }) }))] })) })));
135
122
  });
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
2
  interface IDNumberProps {
3
3
  show: boolean;
4
- onSwitchToMobileNumber?: () => void;
5
4
  }
6
5
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IDNumberProps & React.RefAttributes<unknown>>>;
7
6
  export default _default;
@@ -37,7 +37,7 @@ var InputLabelStyled = styled(Text)(function (_a) {
37
37
  });
38
38
  var IDNumber = React.forwardRef(function (_a, ref) {
39
39
  var _b;
40
- var onSwitchToMobileNumber = _a.onSwitchToMobileNumber, show = _a.show;
40
+ var show = _a.show;
41
41
  var t = useTranslation().t;
42
42
  var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
43
43
  var nidControl = useController({ control: control, name: 'nid' });
@@ -55,6 +55,6 @@ var IDNumber = React.forwardRef(function (_a, ref) {
55
55
  };
56
56
  var nidValue = nidControl.field.value;
57
57
  var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
58
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: '0000000000', warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
58
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: '0000000000', warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
59
59
  });
60
60
  export default React.memo(IDNumber);
@@ -19,7 +19,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
19
19
  import { NIDValidationSchema } from './validation';
20
20
  import { useAppDispatch, useLanguage } from '../../../../hooks';
21
21
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
22
- import { clearError, resetNIDScreen, connectSelector, createNIDAuth } from '../../../app/connect/connectStore';
22
+ import { clearError, connectSelector, createNIDAuth } from '../../../app/connect/connectStore';
23
23
  import Form from '../../../../components/Form';
24
24
  import Button, { AbsherButton } from '../../../shared/Button';
25
25
  import { ScreenContainer } from '../../../shared/Containers';
@@ -73,11 +73,6 @@ var NID = function (_a) {
73
73
  React.useEffect(function () {
74
74
  handleClearError();
75
75
  }, [methods.formState.isValid]);
76
- React.useEffect(function () {
77
- return function () {
78
- dispatch(resetNIDScreen());
79
- };
80
- }, []);
81
76
  var onSubmit = function (data) {
82
77
  dispatch(createNIDAuth(__assign(__assign({}, data), { isResend: false })));
83
78
  };
@@ -41,7 +41,7 @@ var OTPTitleContainerStyled = styled(Box)(function (_a) {
41
41
  });
42
42
  var OTPTitleStyled = styled(Text)(function (_a) {
43
43
  var theme = _a.theme;
44
- return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightLight, marginBlock: theme.spacing(1.75), marginInlineStart: theme.spacing(2.5), lineHeight: 1.75 }));
44
+ return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightLight, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
45
45
  });
46
46
  var FormStyled = styled(Form)(function () { return ({
47
47
  display: 'flex',
@@ -62,12 +62,10 @@ var OTP = function () {
62
62
  React.useEffect(function () {
63
63
  if (error)
64
64
  dispatch(clearError());
65
- }, [methods.formState.isValid]);
66
- React.useEffect(function () {
67
65
  return function () {
68
66
  dispatch(resetOTPScreen());
69
67
  };
70
- }, []);
68
+ }, [methods.formState.isValid]);
71
69
  var onSubmit = function (formData) {
72
70
  dispatch(verifyAuth(formData));
73
71
  };
@@ -18,7 +18,7 @@ import { useTranslation } from 'react-i18next';
18
18
  import { yupResolver } from '@hookform/resolvers/yup';
19
19
  import { styled } from '@mui/material/styles';
20
20
  import { handlePrevScreenStep } from '../../../../app/settings';
21
- import { clearError, connectSelector, createVerifyAuthPassword, resetPasswordScreen } from '../../../app/connect/connectStore';
21
+ import { clearError, connectSelector, createVerifyAuthPassword } from '../../../app/connect/connectStore';
22
22
  import Form from '../../../../components/Form';
23
23
  import Button from '../../../shared/Button';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
@@ -46,11 +46,6 @@ var Password = function (_a) {
46
46
  if (error)
47
47
  dispatch(clearError());
48
48
  }, [methods.formState.isValid]);
49
- React.useEffect(function () {
50
- return function () {
51
- dispatch(resetPasswordScreen());
52
- };
53
- }, []);
54
49
  var onSubmit = function (formData) {
55
50
  dispatch(createVerifyAuthPassword(formData));
56
51
  };
@@ -54,15 +54,23 @@ var ButtonBoxStyled = styled(Box)(function (_a) {
54
54
  return ({
55
55
  margin: theme.spacing(0, 2.5, 2.5, 2.5),
56
56
  marginBlockStart: theme.spacing(5),
57
- display: 'flex'
57
+ display: 'flex',
58
+ alignItems: 'center',
59
+ justifyContent: 'center'
58
60
  });
59
61
  });
60
- var ButtonStyled = styled(Button, { shouldForwardProp: function (prop) { return prop !== 'isBack'; } })(function (_a) {
61
- var theme = _a.theme, isBack = _a.isBack;
62
- return ({
63
- paddingInlineStart: theme.spacing(2.5),
64
- marginInlineStart: isBack ? theme.spacing(-5) : theme.spacing(0)
65
- });
62
+ var ButtonStyled = styled(Button, {
63
+ shouldForwardProp: function (prop) { return prop !== 'isBack' && prop !== 'isLoading'; }
64
+ })(function (_a) {
65
+ var theme = _a.theme, isBack = _a.isBack, isLoading = _a.isLoading;
66
+ return (__assign({ paddingInlineStart: theme.spacing(2.5), marginInlineStart: isBack ? theme.spacing(-5) : theme.spacing(0), paddingLeft: isLoading ? 8 : 'auto', paddingRight: isLoading ? 8 : 'auto', transition: theme.transitions.create(['width', 'padding'], {
67
+ easing: theme.transitions.easing.easeInOut,
68
+ duration: theme.transitions.duration.complex * 2
69
+ }) }, (isLoading && {
70
+ minWidth: 0,
71
+ width: theme.spacing(6),
72
+ borderRadius: 30
73
+ })));
66
74
  });
67
75
  var BackButtonStyled = styled(Button, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
68
76
  var theme = _a.theme, isAr = _a.isAr;
@@ -77,8 +85,5 @@ var BackButtonStyled = styled(Button, { shouldForwardProp: function (prop) { ret
77
85
  export default function CustomButton(_a) {
78
86
  var children = _a.children, disabled = _a.disabled, isAr = _a.isAr, loading = _a.loading, disableBack = _a.disableBack, onBackClicked = _a.onBackClicked, error = _a.error, props = __rest(_a, ["children", "disabled", "isAr", "loading", "disableBack", "onBackClicked", "error"]);
79
87
  var isBackEnabled = !disableBack && !loading;
80
- return (_jsxs(Fragment, { children: [_jsx(Collapse, __assign({ in: !!error }, { children: _jsx(Warning, __assign({ sx: { mb: 1 }, warningType: 'error' }, { children: error })) })), _jsxs(ButtonBoxStyled, { children: [isBackEnabled && (_jsx(BackButtonStyled, __assign({ onClick: function () { return onBackClicked === null || onBackClicked === void 0 ? void 0 : onBackClicked(); }, isAr: isAr, type: 'reset', startIcon: _jsx(BackIconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, props))), _jsx(ButtonStyled, __assign({ disabled: disabled || loading, type: 'submit', isBack: isBackEnabled, endIcon: _jsx(IconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }), startIcon: _jsx(Loader, { style: {
81
- visibility: disableBack && !loading ? 'hidden' : loading ? 'visible' : 'hidden',
82
- display: !disableBack && !loading ? 'none' : 'block'
83
- }, innerColor: 'white', outerColor: 'white', size: 30, toggleAnimation: !!loading }) }, props, { children: _jsxs(Text, __assign({ sx: { marginInlineEnd: isBackEnabled ? '-24px' : '20px' } }, { children: [" ", children] })) }))] })] }));
88
+ return (_jsxs(Fragment, { children: [_jsx(Collapse, __assign({ in: !!error }, { children: _jsx(Warning, __assign({ sx: { mb: 1 }, warningType: 'error' }, { children: error })) })), _jsxs(ButtonBoxStyled, { children: [isBackEnabled && (_jsx(BackButtonStyled, __assign({ onClick: function () { return onBackClicked === null || onBackClicked === void 0 ? void 0 : onBackClicked(); }, isAr: isAr, type: 'reset', startIcon: _jsx(BackIconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, props))), _jsx(ButtonStyled, __assign({ disabled: disabled, isLoading: loading, type: !loading ? 'submit' : 'button', isBack: isBackEnabled, endIcon: !loading && _jsx(IconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, props, { children: !loading ? (_jsxs(Text, __assign({ sx: { marginInlineEnd: isBackEnabled ? '-24px' : '-15px' } }, { children: [" ", children] }))) : (_jsx(Loader, { innerColor: 'white', outerColor: 'white', size: 25, toggleAnimation: !!loading })) }))] })] }));
84
89
  }
@@ -51,12 +51,17 @@ var ContainerStyled = styled(Container)(function (_a) {
51
51
  });
52
52
  });
53
53
  var IconStyled = styled(Icon)(function (_a) {
54
+ var _b;
54
55
  var theme = _a.theme;
55
- return ({
56
- width: theme.spacing(10),
57
- height: theme.spacing(10),
58
- marginBlockEnd: theme.spacing(7.5)
59
- });
56
+ return (_b = {
57
+ width: theme.spacing(10),
58
+ height: theme.spacing(10),
59
+ marginBlockEnd: theme.spacing(7.5)
60
+ },
61
+ _b[theme.breakpoints.down('sm')] = {
62
+ marginBlock: theme.spacing(7.5)
63
+ },
64
+ _b);
60
65
  });
61
66
  var ThankYou = function (_a) {
62
67
  var onSuccess = _a.onSuccess, title = _a.title;
@@ -8,3 +8,4 @@ export * from './useLanguage';
8
8
  export * from './useContainerDimensions';
9
9
  export * from './useAppConfig';
10
10
  export * from './useErrorListener';
11
+ export * from './useWindowSize';
@@ -8,3 +8,4 @@ export * from './useLanguage';
8
8
  export * from './useContainerDimensions';
9
9
  export * from './useAppConfig';
10
10
  export * from './useErrorListener';
11
+ export * from './useWindowSize';
@@ -0,0 +1,6 @@
1
+ interface WindowSize {
2
+ width: number;
3
+ height: number;
4
+ }
5
+ export declare const useWindowSize: () => WindowSize;
6
+ export {};
@@ -0,0 +1,19 @@
1
+ import { useEffect, useState } from 'react';
2
+ export var useWindowSize = function () {
3
+ var _a = useState({
4
+ width: 0,
5
+ height: 0
6
+ }), windowSize = _a[0], setWindowSize = _a[1];
7
+ var handleSize = function () {
8
+ setWindowSize({
9
+ width: window.innerWidth,
10
+ height: window.innerHeight
11
+ });
12
+ };
13
+ useEffect(function () {
14
+ window.addEventListener('resize', handleSize);
15
+ handleSize();
16
+ return function () { return window.removeEventListener('resize', handleSize); };
17
+ }, []);
18
+ return windowSize;
19
+ };