@tap-payments/auth-jsconnect 2.0.48 → 2.0.49

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 (172) hide show
  1. package/build/@types/app.d.ts +8 -6
  2. package/build/@types/form.d.ts +23 -22
  3. package/build/@types/theme.d.ts +1 -1
  4. package/build/api/account.d.ts +2 -2
  5. package/build/api/auth.d.ts +11 -11
  6. package/build/api/availabilityServices.d.ts +3 -3
  7. package/build/api/axios.js +1 -1
  8. package/build/api/board.d.ts +3 -3
  9. package/build/api/country.d.ts +1 -1
  10. package/build/api/data.d.ts +10 -10
  11. package/build/api/document.d.ts +25 -0
  12. package/build/api/document.js +38 -0
  13. package/build/api/entity.d.ts +10 -20
  14. package/build/api/entity.js +6 -5
  15. package/build/api/file.d.ts +2 -1
  16. package/build/api/file.js +14 -1
  17. package/build/api/index.d.ts +10 -3
  18. package/build/api/index.js +3 -1
  19. package/build/api/individual.d.ts +8 -8
  20. package/build/api/lead.d.ts +10 -10
  21. package/build/api/operator.d.ts +1 -1
  22. package/build/api/operator.js +1 -1
  23. package/build/api/user.d.ts +2 -2
  24. package/build/app/settings.d.ts +11 -2
  25. package/build/app/settings.js +1 -1
  26. package/build/app/store.d.ts +4 -4
  27. package/build/assets/locales/ar.json +3 -1
  28. package/build/assets/locales/en.json +3 -1
  29. package/build/components/Lottie/Lottie.d.ts +1 -2
  30. package/build/components/Lottie/Lottie.js +1 -1
  31. package/build/components/Lottie/index.d.ts +2 -2
  32. package/build/components/Lottie/index.js +2 -2
  33. package/build/components/Slide/Slide.d.ts +1 -1
  34. package/build/constants/app.d.ts +31 -0
  35. package/build/constants/app.js +43 -1
  36. package/build/features/app/bank/bankStore.d.ts +73 -10
  37. package/build/features/app/bank/bankStore.js +29 -15
  38. package/build/features/app/brand/brandStore.d.ts +104 -12
  39. package/build/features/app/brand/brandStore.js +65 -66
  40. package/build/features/app/business/businessStore.d.ts +163 -19
  41. package/build/features/app/business/businessStore.js +3 -3
  42. package/build/features/app/connect/connectStore.d.ts +121 -13
  43. package/build/features/app/connect/connectStore.js +1 -1
  44. package/build/features/app/connectExpress/connectExpressStore.d.ts +181 -19
  45. package/build/features/app/connectExpress/connectExpressStore.js +1 -1
  46. package/build/features/app/entity/entityStore.d.ts +76 -20
  47. package/build/features/app/entity/entityStore.js +67 -93
  48. package/build/features/app/individual/individualStore.d.ts +182 -20
  49. package/build/features/app/individual/individualStore.js +278 -135
  50. package/build/features/app/password/passwordStore.d.ts +102 -12
  51. package/build/features/app/password/passwordStore.js +1 -1
  52. package/build/features/app/signIn/signInStore.d.ts +61 -7
  53. package/build/features/app/signIn/signInStore.js +1 -1
  54. package/build/features/app/tax/taxStore.d.ts +62 -8
  55. package/build/features/app/tax/taxStore.js +25 -12
  56. package/build/features/bank/screens/BankDetails/BankStatement.d.ts +1 -1
  57. package/build/features/bank/screens/BankDetails/BankStatement.js +4 -3
  58. package/build/features/bank/screens/BankDetails/IBAN.js +1 -1
  59. package/build/features/bank/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +1 -1
  60. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +13 -13
  61. package/build/features/brand/screens/BrandActivities/ActivitiesList.js +6 -7
  62. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +11 -11
  63. package/build/features/brand/screens/BrandActivities/CustomerBase.js +5 -7
  64. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +5 -7
  65. package/build/features/brand/screens/BrandActivities/OperationStartDate.d.ts +2 -2
  66. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +5 -5
  67. package/build/features/brand/screens/BrandInfo/BrandName.js +1 -1
  68. package/build/features/brand/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +1 -1
  69. package/build/features/business/screens/Activities/ActivitiesList.d.ts +13 -13
  70. package/build/features/business/screens/Activities/OperationStartDate.d.ts +2 -2
  71. package/build/features/business/screens/BusinessType/Article.d.ts +1 -1
  72. package/build/features/business/screens/BusinessType/Article.js +1 -1
  73. package/build/features/business/screens/BusinessType/LicenseCertificate.js +2 -1
  74. package/build/features/business/screens/BusinessType/LicenseType.d.ts +5 -5
  75. package/build/features/business/screens/Customers/CustomerLocations.d.ts +11 -11
  76. package/build/features/business/screens/Customers/RefundPolicy.d.ts +5 -5
  77. package/build/features/business/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +1 -1
  78. package/build/features/connect/screens/Individual/Email.js +1 -1
  79. package/build/features/connect/screens/Merchant/BrandName.js +1 -1
  80. package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.js +1 -1
  81. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +5 -5
  82. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +1 -1
  83. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +13 -13
  84. package/build/features/entity/screens/EntityCapital/ActivityList.js +7 -7
  85. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +3 -4
  86. package/build/features/entity/screens/EntityCapital/CapitalShareCount.js +3 -4
  87. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +3 -4
  88. package/build/features/entity/screens/EntityName/Article.d.ts +1 -1
  89. package/build/features/entity/screens/EntityName/Article.js +16 -53
  90. package/build/features/entity/screens/EntityName/EntityName.js +2 -3
  91. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +13 -13
  92. package/build/features/entity/screens/EntityName/EntityTypeList.js +4 -6
  93. package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +2 -2
  94. package/build/features/entity/screens/EntityName/ExpiryDate.js +6 -6
  95. package/build/features/entity/screens/EntityName/IssuingDate.d.ts +2 -2
  96. package/build/features/entity/screens/EntityName/IssuingDate.js +4 -5
  97. package/build/features/entity/screens/EntityName/LegalName.js +2 -4
  98. package/build/features/entity/screens/EntityName/LicenseCertificate.js +4 -3
  99. package/build/features/entity/screens/EntityName/LicenseNumber.js +4 -4
  100. package/build/features/entity/screens/EntityName/UnifiedNumber.js +3 -4
  101. package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +1 -1
  102. package/build/features/featuresScreens.js +5 -0
  103. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +2 -2
  104. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +4 -3
  105. package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +2 -4
  106. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +5 -6
  107. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +5 -6
  108. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +4 -4
  109. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +2 -4
  110. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +4 -3
  111. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +5 -6
  112. package/build/features/individual/screens/IndividualList/CollectPhoneEmail.d.ts +2 -0
  113. package/build/features/individual/screens/IndividualList/CollectPhoneEmail.js +3 -2
  114. package/build/features/individual/screens/IndividualList/Email.d.ts +5 -1
  115. package/build/features/individual/screens/IndividualList/Email.js +73 -8
  116. package/build/features/individual/screens/IndividualList/IndividualList.d.ts +4 -4
  117. package/build/features/individual/screens/IndividualList/UserList.js +36 -19
  118. package/build/features/individual/screens/IndividualList/validation.js +2 -1
  119. package/build/features/individual/screens/IndividualPersonalInfo/Email.js +2 -3
  120. package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +3 -4
  121. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +5 -5
  122. package/build/features/individual/screens/IndividualPersonalInfo/ID.js +2 -3
  123. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +2 -2
  124. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +6 -7
  125. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +5 -6
  126. package/build/features/individual/screens/IndividualPersonalInfo/Name.js +2 -3
  127. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +6 -7
  128. package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.d.ts +12 -0
  129. package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.js +143 -0
  130. package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.d.ts +5 -0
  131. package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +60 -0
  132. package/build/features/individual/screens/IndividualPhoneInfo/index.d.ts +3 -0
  133. package/build/features/individual/screens/IndividualPhoneInfo/index.js +2 -0
  134. package/build/features/individual/screens/IndividualPhoneInfo/validation.d.ts +8 -0
  135. package/build/features/individual/screens/IndividualPhoneInfo/validation.js +31 -0
  136. package/build/features/individual/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +1 -1
  137. package/build/features/password/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +1 -1
  138. package/build/features/shared/Address/CountryList.d.ts +9 -9
  139. package/build/features/shared/Address/InputSelect.d.ts +9 -9
  140. package/build/features/shared/Address/InputSelect.js +1 -1
  141. package/build/features/shared/Button/Button.js +1 -1
  142. package/build/features/shared/Button/EmailProvidersButtons.d.ts +1 -1
  143. package/build/features/shared/Button/FlowsButtons.d.ts +1 -1
  144. package/build/features/shared/Button/FlowsButtons.js +1 -1
  145. package/build/features/shared/Button/{ListButton.d.ts → IndividualActionButtons.d.ts} +5 -4
  146. package/build/features/shared/Button/IndividualActionButtons.js +132 -0
  147. package/build/features/shared/Button/index.d.ts +1 -1
  148. package/build/features/shared/Button/index.js +1 -1
  149. package/build/features/shared/Containers/FeatureContainer.d.ts +1 -1
  150. package/build/features/shared/Containers/ScreenContainer.d.ts +1 -1
  151. package/build/features/shared/Input/Input.d.ts +3 -3
  152. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +11 -1
  153. package/build/features/shared/UploadFile/FileUpload.d.ts +29 -0
  154. package/build/features/shared/UploadFile/FileUpload.js +263 -0
  155. package/build/features/shared/UploadFile/UploadFile.d.ts +2 -2
  156. package/build/features/shared/UploadFile/UploadWrapper.d.ts +33 -0
  157. package/build/features/shared/UploadFile/UploadWrapper.js +114 -0
  158. package/build/features/shared/UploadFile/index.d.ts +2 -1
  159. package/build/features/shared/UploadFile/index.js +2 -1
  160. package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +9 -20
  161. package/build/features/shared/UploadMultipleFile/UploadFile.js +109 -24
  162. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +6 -4
  163. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +26 -19
  164. package/build/features/tax/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +1 -1
  165. package/build/features/tax/screens/TaxDetails/TaxDocument.js +4 -3
  166. package/build/features/tax/screens/TaxDetails/VATId.js +3 -4
  167. package/build/index.d.ts +2 -2
  168. package/build/index.js +4 -3
  169. package/build/utils/array.d.ts +3 -1
  170. package/build/utils/array.js +35 -6
  171. package/package.json +1 -1
  172. package/build/features/shared/Button/ListButton.js +0 -125
@@ -28,7 +28,6 @@ import { useController, useFormContext } from 'react-hook-form';
28
28
  import { styled } from '@mui/material/styles';
29
29
  import CheckIcon from '@mui/icons-material/Check';
30
30
  import { useLanguage, useAppSelector } from '../../../../hooks';
31
- import { FieldType } from '../../../../@types';
32
31
  import Collapse from '../../../../components/Collapse';
33
32
  import ExpandIcon from '../../../../components/ExpandIcon';
34
33
  import Text from '../../../../components/Text';
@@ -52,10 +51,10 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
52
51
  });
53
52
  });
54
53
  var IssuedCountry = React.forwardRef(function (_a, ref) {
55
- var _b, _c, _d, _e, _f;
54
+ var _b, _c, _d;
56
55
  var countries = _a.countries, rest = __rest(_a, ["countries"]);
57
- var _g = React.useState(countries), locationCountries = _g[0], setCountries = _g[1];
58
- var _h = React.useState(null), anchorEl = _h[0], setAnchorEl = _h[1];
56
+ var _e = React.useState(countries), locationCountries = _e[0], setCountries = _e[1];
57
+ var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
59
58
  var t = useTranslation().t;
60
59
  var isAr = useLanguage().isAr;
61
60
  var control = useFormContext().control;
@@ -63,7 +62,7 @@ var IssuedCountry = React.forwardRef(function (_a, ref) {
63
62
  var verify = data.verify;
64
63
  var user = (verify.responseBody || {}).user;
65
64
  var issuedCountryControl = useController({ control: control, name: 'issuedCountry' });
66
- var disabled = ((_c = (_b = user === null || user === void 0 ? void 0 : user.data_status) === null || _b === void 0 ? void 0 : _b.identification) === null || _c === void 0 ? void 0 : _c.issuer_country) === FieldType.NON_EDITABLE;
65
+ var disabled = false;
67
66
  var onOpenCountrySelect = function (event) {
68
67
  var _a;
69
68
  setAnchorEl(event.currentTarget);
@@ -80,8 +79,8 @@ var IssuedCountry = React.forwardRef(function (_a, ref) {
80
79
  issuedCountryControl.field.onChange(country);
81
80
  };
82
81
  var location = issuedCountryControl.field.value;
83
- var error = (_d = issuedCountryControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
84
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('issued_country_label'), readOnly: true, disabled: disabled, onClick: disabled ? undefined : !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: disabled ? _jsx(_Fragment, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_issued_country'), value: (isAr ? (_e = location === null || location === void 0 ? void 0 : location.name) === null || _e === void 0 ? void 0 : _e.arabic : (_f = location === null || location === void 0 ? void 0 : location.name) === null || _f === void 0 ? void 0 : _f.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
82
+ var error = (_b = issuedCountryControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
83
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('issued_country_label'), readOnly: true, disabled: disabled, onClick: disabled ? undefined : !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: disabled ? _jsx(_Fragment, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_issued_country'), value: (isAr ? (_c = location === null || location === void 0 ? void 0 : location.name) === null || _c === void 0 ? void 0 : _c.arabic : (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
85
84
  return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (location === null || location === void 0 ? void 0 : location.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english })) }), item.idd_prefix === (location === null || location === void 0 ? void 0 : location.idd_prefix) && _jsx(CheckIconStyled, {})] }));
86
85
  } }) }))] })) })));
87
86
  });
@@ -28,7 +28,6 @@ import Box from '@mui/material/Box';
28
28
  import { styled, alpha } from '@mui/material/styles';
29
29
  import { removeAllCharsFromNumber } from '../../../../utils';
30
30
  import { useLanguage, useAppSelector } from '../../../../hooks';
31
- import { FieldType } from '../../../../@types';
32
31
  import Text from '../../../../components/Text';
33
32
  import Collapse from '../../../../components/Collapse';
34
33
  import ExpandIcon from '../../../../components/ExpandIcon';
@@ -80,13 +79,13 @@ var InputStyled = styled(Input)(function () { return ({
80
79
  }
81
80
  }); });
82
81
  var MobileNumber = React.forwardRef(function (_a, ref) {
83
- var _b, _c, _d, _e, _f, _g;
82
+ var _b, _c, _d;
84
83
  var countries = _a.countries, rest = __rest(_a, ["countries"]);
85
- var _h = React.useState(countries || []), countriesCode = _h[0], setCountries = _h[1];
86
- var _j = React.useState(null), anchorEl = _j[0], setAnchorEl = _j[1];
84
+ var _e = React.useState(countries || []), countriesCode = _e[0], setCountries = _e[1];
85
+ var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
87
86
  var t = useTranslation().t;
88
87
  var isAr = useLanguage().isAr;
89
- var _k = useFormContext(), control = _k.control, setValue = _k.setValue;
88
+ var _g = useFormContext(), control = _g.control, setValue = _g.setValue;
90
89
  var data = useAppSelector(individualSelector).data;
91
90
  var phoneControl = useController({ name: 'mobile', control: control });
92
91
  var countryCodeControl = useController({ name: 'countryCode', control: control });
@@ -100,7 +99,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
100
99
  var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
101
100
  var verify = data.verify;
102
101
  var user = (verify.responseBody || {}).user;
103
- var disabled = ((_g = (_f = (_e = user === null || user === void 0 ? void 0 : user.data_status) === null || _e === void 0 ? void 0 : _e.contact) === null || _f === void 0 ? void 0 : _f.phone) === null || _g === void 0 ? void 0 : _g.number) === FieldType.NON_EDITABLE;
102
+ var disabled = false;
104
103
  React.useEffect(function () {
105
104
  if (mobileValue)
106
105
  setValue('mobile', mobileValue, { shouldValidate: true });
@@ -16,7 +16,6 @@ import { useTranslation } from 'react-i18next';
16
16
  import { styled } from '@mui/material/styles';
17
17
  import { removeAllOtherThanAlphabetAndSpace } from '../../../../utils';
18
18
  import { useAppSelector } from '../../../../hooks';
19
- import { FieldType } from '../../../../@types';
20
19
  import Collapse from '../../../../components/Collapse';
21
20
  import { ScreenContainer } from '../../../shared/Containers';
22
21
  import Input from '../../../shared/Input';
@@ -29,7 +28,7 @@ var InputStyled = styled(Input)(function () { return ({
29
28
  }
30
29
  }); });
31
30
  var Name = function (_a) {
32
- var _b, _c;
31
+ var _b;
33
32
  var show = _a.show;
34
33
  var t = useTranslation().t;
35
34
  var control = useFormContext().control;
@@ -43,7 +42,7 @@ var Name = function (_a) {
43
42
  };
44
43
  var nameValue = nameControl.field.value;
45
44
  var error = (_b = nameControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
46
- var disabled = ((_c = user === null || user === void 0 ? void 0 : user.data_status) === null || _c === void 0 ? void 0 : _c.name) === FieldType.NON_EDITABLE;
45
+ var disabled = false;
47
46
  var clearNumber = function () {
48
47
  nameControl.field.onChange('');
49
48
  };
@@ -28,7 +28,6 @@ import { useController, useFormContext } from 'react-hook-form';
28
28
  import { styled } from '@mui/material/styles';
29
29
  import CheckIcon from '@mui/icons-material/Check';
30
30
  import { useLanguage, useAppSelector } from '../../../../hooks';
31
- import { FieldType } from '../../../../@types';
32
31
  import Collapse from '../../../../components/Collapse';
33
32
  import ExpandIcon from '../../../../components/ExpandIcon';
34
33
  import Text from '../../../../components/Text';
@@ -52,10 +51,10 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
52
51
  });
53
52
  });
54
53
  var Nationality = React.forwardRef(function (_a, ref) {
55
- var _b, _c, _d, _e;
54
+ var _b, _c, _d;
56
55
  var countries = _a.countries, rest = __rest(_a, ["countries"]);
57
- var _f = React.useState(countries), locationCountries = _f[0], setCountries = _f[1];
58
- var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
56
+ var _e = React.useState(countries), locationCountries = _e[0], setCountries = _e[1];
57
+ var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
59
58
  var t = useTranslation().t;
60
59
  var isAr = useLanguage().isAr;
61
60
  var control = useFormContext().control;
@@ -63,7 +62,7 @@ var Nationality = React.forwardRef(function (_a, ref) {
63
62
  var verify = data.verify;
64
63
  var user = (verify.responseBody || {}).user;
65
64
  var nationalityControl = useController({ control: control, name: 'nationality' });
66
- var disabled = ((_b = user === null || user === void 0 ? void 0 : user.data_status) === null || _b === void 0 ? void 0 : _b.nationality) === FieldType.NON_EDITABLE;
65
+ var disabled = false;
67
66
  var onOpenCountrySelect = function (event) {
68
67
  var _a;
69
68
  setAnchorEl(event.currentTarget);
@@ -80,8 +79,8 @@ var Nationality = React.forwardRef(function (_a, ref) {
80
79
  nationalityControl.field.onChange(country);
81
80
  };
82
81
  var location = nationalityControl.field.value;
83
- var error = (_c = nationalityControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
84
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('nationality_label'), readOnly: true, disabled: disabled, onClick: disabled ? undefined : !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: disabled ? _jsx(_Fragment, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_nationality'), value: (isAr ? (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.arabic : (_e = location === null || location === void 0 ? void 0 : location.name) === null || _e === void 0 ? void 0 : _e.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
82
+ var error = (_b = nationalityControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
83
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('nationality_label'), readOnly: true, disabled: disabled, onClick: disabled ? undefined : !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: disabled ? _jsx(_Fragment, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_nationality'), value: (isAr ? (_c = location === null || location === void 0 ? void 0 : location.name) === null || _c === void 0 ? void 0 : _c.arabic : (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
85
84
  return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (location === null || location === void 0 ? void 0 : location.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english })) }), item.idd_prefix === (location === null || location === void 0 ? void 0 : location.idd_prefix) && _jsx(CheckIconStyled, {})] }));
86
85
  } }) }))] })) })));
87
86
  });
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { Theme, SxProps } from '@mui/material/styles';
3
+ import { CountryCode } from '../../../../@types';
4
+ interface MobileNumberProps {
5
+ countries: Array<CountryCode>;
6
+ show: boolean;
7
+ onListOpen?: () => void;
8
+ onListClose?: () => void;
9
+ sx?: SxProps<Theme>;
10
+ }
11
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MobileNumberProps & React.RefAttributes<unknown>>>;
12
+ export default _default;
@@ -0,0 +1,143 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
24
+ import * as React from 'react';
25
+ import { useTranslation } from 'react-i18next';
26
+ import { useController, useFormContext } from 'react-hook-form';
27
+ import Box from '@mui/material/Box';
28
+ import { styled, alpha } from '@mui/material/styles';
29
+ import { removeAllCharsFromNumber } from '../../../../utils';
30
+ import { useLanguage, useAppSelector } from '../../../../hooks';
31
+ import Text from '../../../../components/Text';
32
+ import Collapse from '../../../../components/Collapse';
33
+ import ExpandIcon from '../../../../components/ExpandIcon';
34
+ import SimpleList from '../../../../components/SimpleList';
35
+ import ClearIcon from '../../../shared/ClearIcon';
36
+ import CheckIcon from '../../../shared/CheckIcon';
37
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
38
+ import Input from '../../../shared/Input';
39
+ import { individualSelector } from '../../../app/individual/individualStore';
40
+ var LabelContainerStyled = styled(Box)(function (_a) {
41
+ var theme = _a.theme;
42
+ return ({
43
+ display: 'flex',
44
+ justifyContent: 'space-between',
45
+ padding: theme.spacing(0, 2.5, 1.25, 2.5)
46
+ });
47
+ });
48
+ var CountryItemContainer = styled(Box)(function () { return ({
49
+ display: 'flex'
50
+ }); });
51
+ var CountryCodeText = styled(Text, {
52
+ shouldForwardProp: function (prop) { return prop !== 'isSelected'; }
53
+ })(function (_a) {
54
+ var theme = _a.theme, isSelected = _a.isSelected;
55
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { width: theme.spacing(10), textAlign: 'start', fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
56
+ });
57
+ var CountryNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
58
+ var theme = _a.theme, isSelected = _a.isSelected;
59
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
60
+ });
61
+ var CountryCodeStyled = styled(Text)(function (_a) {
62
+ var theme = _a.theme;
63
+ return (__assign(__assign({ cursor: 'pointer' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightRegular, display: 'flex', alignItems: 'center', minWidth: theme.spacing(8.75) }));
64
+ });
65
+ var InputLabelStyled = styled(Text)(function (_a) {
66
+ var theme = _a.theme;
67
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
68
+ });
69
+ var ExpandIconStyled = styled(ExpandIcon)(function (_a) {
70
+ var theme = _a.theme;
71
+ return ({
72
+ marginInlineStart: theme.spacing(1)
73
+ });
74
+ });
75
+ var InputStyled = styled(Input)(function () { return ({
76
+ direction: 'ltr',
77
+ '& .MuiInputBase-input': {
78
+ cursor: 'auto'
79
+ }
80
+ }); });
81
+ var MobileNumber = React.forwardRef(function (_a, ref) {
82
+ var _b, _c, _d;
83
+ var countries = _a.countries, sx = _a.sx, rest = __rest(_a, ["countries", "sx"]);
84
+ var _e = React.useState(countries || []), countriesCode = _e[0], setCountries = _e[1];
85
+ var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
86
+ var t = useTranslation().t;
87
+ var isAr = useLanguage().isAr;
88
+ var _g = useFormContext(), control = _g.control, setValue = _g.setValue;
89
+ var data = useAppSelector(individualSelector).data;
90
+ var phoneControl = useController({ name: 'mobile', control: control });
91
+ var countryCodeControl = useController({ name: 'countryCode', control: control });
92
+ var countryCodeValue = countryCodeControl.field.value;
93
+ var mobileValue = phoneControl.field.value;
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
+ var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
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;
98
+ var isStartsWith5 = mobileValue.startsWith('5');
99
+ var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
100
+ var verify = data.verify;
101
+ var user = (verify.responseBody || {}).user;
102
+ React.useEffect(function () {
103
+ if (mobileValue)
104
+ setValue('mobile', mobileValue, { shouldValidate: true });
105
+ }, []);
106
+ var onPhoneNumberChange = function (_a) {
107
+ var target = _a.target;
108
+ var value = removeAllCharsFromNumber(target.value);
109
+ phoneControl.field.onChange(value);
110
+ };
111
+ var clearMobileNumber = function () {
112
+ phoneControl.field.onChange('');
113
+ };
114
+ var onCloseCountryList = function () {
115
+ var _a;
116
+ if (anchorEl) {
117
+ setAnchorEl(null);
118
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
119
+ }
120
+ setCountries(countries);
121
+ };
122
+ var toggleCountryList = function () {
123
+ var _a, _b;
124
+ if (anchorEl) {
125
+ setAnchorEl(null);
126
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
127
+ setCountries(countries);
128
+ }
129
+ else {
130
+ (_b = rest.onListOpen) === null || _b === void 0 ? void 0 : _b.call(rest);
131
+ setAnchorEl(true);
132
+ }
133
+ };
134
+ var onSelectItem = function (country) {
135
+ onCloseCountryList();
136
+ setValue('mobile', '');
137
+ countryCodeControl.field.onChange(country);
138
+ };
139
+ 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) {
140
+ 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, {})] }));
141
+ } }) }))] })) })));
142
+ });
143
+ export default React.memo(MobileNumber);
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface PhoneInfoProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: PhoneInfoProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,60 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { useForm, FormProvider } from 'react-hook-form';
16
+ import { yupResolver } from '@hookform/resolvers/yup';
17
+ import { styled } from '@mui/material/styles';
18
+ import { settingsSelector } from '../../../../app/settings';
19
+ import { useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
20
+ import { useLanguage, useAppSelector } from '../../../../hooks';
21
+ import Form from '../../../../components/Form';
22
+ import Collapse from '../../../../components/Collapse';
23
+ import { ScreenContainer } from '../../../shared/Containers';
24
+ import { individualSelector, clearError, updatePhoneInfo } from '../../../app/individual/individualStore';
25
+ import Button from '../../../shared/Button';
26
+ import { IndividualPhoneInfoValidationSchema } from './validation';
27
+ import MobileNumber from './MobileNumber';
28
+ var FormStyled = styled(Form)(function () { return ({
29
+ display: 'flex',
30
+ flexDirection: 'column'
31
+ }); });
32
+ var PhoneInfo = function (_a) {
33
+ var dispatch = useAppDispatch();
34
+ var settingsData = useAppSelector(settingsSelector).data;
35
+ var countries = settingsData.countries;
36
+ var _b = useAppSelector(individualSelector), data = _b.data, loading = _b.loading, error = _b.error;
37
+ var _c = data.individualPhoneInfo, mobile = _c.mobile, countryCode = _c.countryCode;
38
+ var methods = useForm({
39
+ resolver: yupResolver(IndividualPhoneInfoValidationSchema),
40
+ defaultValues: {
41
+ mobile: mobile,
42
+ countryCode: countryCode
43
+ },
44
+ mode: 'onChange'
45
+ });
46
+ useSetFromDefaultValues(methods, data.individualPhoneInfo);
47
+ var t = useTranslation().t;
48
+ var isAr = useLanguage().isAr;
49
+ var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
50
+ var onSubmit = function (formData) {
51
+ dispatch(updatePhoneInfo(formData));
52
+ };
53
+ React.useEffect(function () {
54
+ if (error && methods.formState.isValid)
55
+ dispatch(clearError());
56
+ }, [methods.formState.isValid]);
57
+ var disabled = !methods.formState.isValid || !!error;
58
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(MobileNumber, { show: true, sx: { mb: 7.5 }, countries: countries, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
59
+ };
60
+ export default React.memo(PhoneInfo);
@@ -0,0 +1,3 @@
1
+ import PhoneInfo, { PhoneInfoProps } from './PhoneInfo';
2
+ export type { PhoneInfoProps };
3
+ export default PhoneInfo;
@@ -0,0 +1,2 @@
1
+ import PhoneInfo from './PhoneInfo';
2
+ export default PhoneInfo;
@@ -0,0 +1,8 @@
1
+ import * as yup from 'yup';
2
+ export declare const IndividualPhoneInfoValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
5
+ mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
+ mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ }>>>;
@@ -0,0 +1,31 @@
1
+ import * as yup from 'yup';
2
+ export var IndividualPhoneInfoValidationSchema = yup.object().shape({
3
+ mobile: yup
4
+ .string()
5
+ .test({
6
+ test: function (value) {
7
+ if (((value === null || value === void 0 ? void 0 : value.length) || 0) > 0) {
8
+ var countryCode = this.parent.countryCode;
9
+ var isSA = countryCode.iso2 === 'SA';
10
+ var digits = countryCode.digits;
11
+ var mobileValue = value || '';
12
+ var valueLen = mobileValue.length;
13
+ var isNumber = mobileValue.match(/^[0-9]/g);
14
+ if (!isNumber)
15
+ return this.createError({ message: 'enter_valid_mobile_number' });
16
+ var isStartWithZero = mobileValue.startsWith('05');
17
+ var isStartWith5 = mobileValue.startsWith('5');
18
+ var isSaudiNumber = isStartWith5 || isStartWithZero;
19
+ if (isSA) {
20
+ if (!isSaudiNumber)
21
+ return this.createError({ message: 'start_with_number' });
22
+ var requiredLen = isStartWith5 ? digits - 1 : digits;
23
+ return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
24
+ }
25
+ return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
26
+ }
27
+ return true;
28
+ }
29
+ })
30
+ .required()
31
+ });
@@ -9,7 +9,7 @@ var ResetPasswordSuccess = function (_a) {
9
9
  var _b, _c;
10
10
  var t = useTranslation().t;
11
11
  var data = useAppSelector(individualSelector).data;
12
- var email = ((_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.primary_contact).email;
12
+ var email = (((_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.primary_contact) || {}).email;
13
13
  var maskedEmail = maskEmail(email);
14
14
  return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: _jsx(Trans, { i18nKey: 'reset_password_success_description_dev', values: { email: maskedEmail } }), showEmailProviders: true }));
15
15
  };
@@ -9,7 +9,7 @@ var ResetPasswordSuccess = function (_a) {
9
9
  var _b, _c;
10
10
  var t = useTranslation().t;
11
11
  var data = useAppSelector(passwordSelector).data;
12
- var email = ((_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.primary_contact).email;
12
+ var email = (((_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.primary_contact) || {}).email;
13
13
  var maskedEmail = maskEmail(email);
14
14
  return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: _jsx(Trans, { i18nKey: 'reset_password_success_description_dev', values: { email: maskedEmail } }), showEmailProviders: true }));
15
15
  };