@tap-payments/auth-jsconnect 2.6.12-test → 2.6.16-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 (53) hide show
  1. package/build/@types/app.d.ts +2 -1
  2. package/build/@types/app.js +1 -0
  3. package/build/app/settings.js +2 -5
  4. package/build/constants/app.js +11 -5
  5. package/build/constants/dummy.d.ts +45 -0
  6. package/build/constants/dummy.js +330 -0
  7. package/build/features/app/brand/brandStore.js +2 -2
  8. package/build/features/app/business/businessStore.d.ts +9 -2
  9. package/build/features/app/business/businessStore.js +42 -23
  10. package/build/features/app/connectExpress/connectExpressStore.d.ts +2 -1
  11. package/build/features/app/connectExpress/connectExpressStore.js +38 -14
  12. package/build/features/app/individual/individualStore.js +5 -5
  13. package/build/features/business/screens/BusinessType/BusinessType.js +13 -5
  14. package/build/features/business/screens/BusinessType/EntityName.js +3 -3
  15. package/build/features/business/screens/BusinessType/LicenseList.js +3 -3
  16. package/build/features/business/screens/BusinessType/LicenseNumber.js +9 -8
  17. package/build/features/business/screens/BusinessType/validation.d.ts +10 -0
  18. package/build/features/business/screens/BusinessType/validation.js +16 -0
  19. package/build/features/business/screens/IDBOD/ID.js +6 -2
  20. package/build/features/business/screens/IDBOD/IDBOD.js +8 -17
  21. package/build/features/business/screens/IDBOD/validation.d.ts +10 -0
  22. package/build/features/business/screens/IDBOD/validation.js +4 -0
  23. package/build/features/connect/Connect.js +14 -18
  24. package/build/features/connect/screens/Mobile/Mobile.js +7 -6
  25. package/build/features/connect/screens/Mobile/MobileNumber.js +9 -6
  26. package/build/features/connectExpress/ConnectExpress.js +10 -4
  27. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +12 -4
  28. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +6 -6
  29. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +8 -7
  30. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +13 -0
  31. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +67 -0
  32. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +4 -0
  33. package/build/features/connectExpress/screens/IdentityOTP/OTP.js +1 -1
  34. package/build/features/connectExpress/screens/IdentityOTP/OTPInput.js +1 -1
  35. package/build/features/connectExpress/screens/Mobile/Mobile.js +2 -2
  36. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +9 -6
  37. package/build/features/connectExpress/screens/NIDMissed/IDNumber.js +6 -2
  38. package/build/features/connectExpress/screens/NIDMissed/NID.js +6 -4
  39. package/build/features/connectExpress/screens/NIDMissed/validation.d.ts +10 -0
  40. package/build/features/connectExpress/screens/NIDMissed/validation.js +4 -0
  41. package/build/features/entity/screens/EntityName/EntityName.js +11 -4
  42. package/build/features/entity/screens/EntityName/LicenseNumber.js +5 -4
  43. package/build/features/entity/screens/EntityName/validation.d.ts +28 -0
  44. package/build/features/entity/screens/EntityName/validation.js +38 -0
  45. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +4 -4
  46. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +1 -1
  47. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -2
  48. package/build/features/shared/SuccessScreen/SuccessScreen.js +1 -1
  49. package/build/hooks/useCountry.d.ts +1 -0
  50. package/build/hooks/useCountry.js +4 -3
  51. package/build/utils/string.d.ts +1 -0
  52. package/build/utils/string.js +3 -0
  53. package/package.json +1 -1
@@ -27,6 +27,7 @@ import { useTranslation } from 'react-i18next';
27
27
  import { useController, useFormContext } from 'react-hook-form';
28
28
  import { styled, alpha } from '@mui/material/styles';
29
29
  import Text from '../../../../components/Text';
30
+ import { settingsSelector } from '../../../../app/settings';
30
31
  import Collapse from '../../../../components/Collapse';
31
32
  import ClearIcon from '../../../shared/ClearIcon';
32
33
  import CheckIcon from '../../../shared/CheckIcon';
@@ -35,7 +36,7 @@ import { connectSelector } from '../../../app/connect/connectStore';
35
36
  import ExpandIcon from '../../../../components/ExpandIcon';
36
37
  import Input from '../../../shared/Input';
37
38
  import SimpleList from '../../../../components/SimpleList';
38
- import { removeAllCharsFromNumber } from '../../../../utils';
39
+ import { isOtherThanKWOrSA, removeAllCharsFromNumber } from '../../../../utils';
39
40
  import { useLanguage, useAppSelector } from '../../../../hooks';
40
41
  import Search from '../../../shared/Search';
41
42
  var LabelContainerStyled = styled(Box)(function (_a) {
@@ -80,14 +81,15 @@ var InputStyled = styled(Input)(function () { return ({
80
81
  }
81
82
  }); });
82
83
  var MobileNumber = React.forwardRef(function (_a, ref) {
83
- var _b, _c, _d;
84
+ var _b, _c, _d, _e;
84
85
  var countries = _a.countries, readOnly = _a.readOnly, rest = __rest(_a, ["countries", "readOnly"]);
85
- var _e = React.useState(countries || []), countriesCode = _e[0], setCountries = _e[1];
86
- var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
86
+ var _f = React.useState(countries || []), countriesCode = _f[0], setCountries = _f[1];
87
+ var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
87
88
  var t = useTranslation().t;
88
89
  var isAr = useLanguage().isAr;
89
- var _g = useFormContext(), control = _g.control, setValue = _g.setValue;
90
+ var _h = useFormContext(), control = _h.control, setValue = _h.setValue;
90
91
  var loading = useAppSelector(connectSelector).loading;
92
+ var settingsStore = useAppSelector(settingsSelector);
91
93
  var phoneControl = useController({ name: 'mobile', control: control });
92
94
  var countryCodeControl = useController({ name: 'countryCode', control: control });
93
95
  var countryCodeValue = countryCodeControl.field.value;
@@ -98,6 +100,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
98
100
  var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
99
101
  var isStartsWith5 = mobileValue.startsWith('5');
100
102
  var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
103
+ 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]);
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 (_jsx(Collapse, __assign({ in: rest.show }, { children: _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 || readOnly, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () {
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 () {
148
151
  if (readOnly)
149
152
  return;
150
153
  toggleCountryList();
@@ -14,12 +14,14 @@ import * as React from 'react';
14
14
  import Box from '@mui/material/Box';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { useController, useFormContext } from 'react-hook-form';
17
+ import { useAppSelector } from '../../../../hooks';
18
+ import { settingsSelector } from '../../../../app/settings';
17
19
  import { styled, alpha } from '@mui/material/styles';
18
20
  import Text from '../../../../components/Text';
19
21
  import Input from '../../../shared/Input';
20
22
  import Collapse from '../../../../components/Collapse';
21
23
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
22
- import { removeAllCharsFromNumber } from '../../../../utils';
24
+ import { isOtherThanKWOrSA, removeAllCharsFromNumber } from '../../../../utils';
23
25
  import { ID_NUMBER_LENGTH } from '../../../../constants';
24
26
  import { EndAdornment } from '../../../shared/EndAdornment';
25
27
  var LabelContainerStyled = styled(Box)(function (_a) {
@@ -39,7 +41,9 @@ var IDNumber = React.forwardRef(function (_a, ref) {
39
41
  var show = _a.show;
40
42
  var t = useTranslation().t;
41
43
  var control = useFormContext().control;
44
+ var settingsData = useAppSelector(settingsSelector).data;
42
45
  var nidControl = useController({ control: control, name: 'nid' });
46
+ var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
43
47
  var handleIdChange = function (_a) {
44
48
  var target = _a.target;
45
49
  var value = removeAllCharsFromNumber(target.value);
@@ -50,6 +54,6 @@ var IDNumber = React.forwardRef(function (_a, ref) {
50
54
  };
51
55
  var nidValue = nidControl.field.value;
52
56
  var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
53
- 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: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
57
+ 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: isOtherCountry ? {} : { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
54
58
  });
55
59
  export default React.memo(IDNumber);
@@ -15,9 +15,9 @@ import { useTranslation } from 'react-i18next';
15
15
  import { styled } from '@mui/material/styles';
16
16
  import { useForm, FormProvider } from 'react-hook-form';
17
17
  import { yupResolver } from '@hookform/resolvers/yup';
18
- import { NIDValidationSchema } from './validation';
18
+ import { NIDOtherCountryValidationSchema, NIDValidationSchema } from './validation';
19
19
  import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
20
- import { handlePrevScreenStep } from '../../../../app/settings';
20
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
21
21
  import { clearError, connectExpressSelector, createNIDAuthIdentityAsync } from '../../../app/connectExpress/connectExpressStore';
22
22
  import Form from '../../../../components/Form';
23
23
  import Button from '../../../shared/Button';
@@ -25,7 +25,7 @@ import { ScreenContainer } from '../../../shared/Containers';
25
25
  import Collapse from '../../../../components/Collapse';
26
26
  import IDNumber from './IDNumber';
27
27
  import DOB from './DOB';
28
- import { deepCopy } from '../../../../utils';
28
+ import { deepCopy, isOtherThanKWOrSA } from '../../../../utils';
29
29
  var FormStyled = styled(Form)(function () { return ({
30
30
  display: 'flex',
31
31
  flexDirection: 'column'
@@ -35,9 +35,11 @@ var NID = function (_a) {
35
35
  var isAr = useLanguage().isAr;
36
36
  var dispatch = useAppDispatch();
37
37
  var t = useTranslation().t;
38
+ var settingsData = useAppSelector(settingsSelector).data;
38
39
  var _c = useAppSelector(connectExpressSelector), data = _c.data, loading = _c.loading, error = _c.error;
40
+ var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
39
41
  var methods = useForm({
40
- resolver: yupResolver(NIDValidationSchema),
42
+ resolver: yupResolver(isOtherCountry ? NIDOtherCountryValidationSchema : NIDValidationSchema),
41
43
  defaultValues: data.nidData,
42
44
  mode: 'onChange'
43
45
  });
@@ -9,3 +9,13 @@ export declare const NIDValidationSchema: yup.ObjectSchema<import("yup/lib/objec
9
9
  dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
10
10
  nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
11
  }>>>;
12
+ export declare const NIDOtherCountryValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
13
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
15
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
16
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
17
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
18
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
19
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
20
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
21
+ }>>>;
@@ -7,3 +7,7 @@ export var NIDValidationSchema = yup.object().shape({
7
7
  .min(10, 'signup_invalid_national_id')
8
8
  .required('signup_invalid_national_id')
9
9
  });
10
+ export var NIDOtherCountryValidationSchema = yup.object().shape({
11
+ dob: yup.string().min(5).required('enter_valid_birth_date'),
12
+ nid: yup.string().min(3, 'signup_invalid_national_id').required('signup_invalid_national_id')
13
+ });
@@ -24,7 +24,7 @@ import Collapse from '../../../../components/Collapse';
24
24
  import { clearError, entitySelector, retrieveBoardStatus, updateEntityName } from '../../../app/entity/entityStore';
25
25
  import { ScreenContainer } from '../../../shared/Containers';
26
26
  import Button from '../../../shared/Button';
27
- import { EntityNameValidationSchema, EntityNameKWValidationSchema } from './validation';
27
+ import { EntityNameValidationSchema, EntityNameKWValidationSchema, EntityNameOtherCountryValidationSchema } from './validation';
28
28
  import LegalName from './LegalName';
29
29
  import LicenseNumber from './LicenseNumber';
30
30
  import IssuingDate from './IssuingDate';
@@ -54,8 +54,15 @@ var EntityName = function (_a) {
54
54
  var isCR = licenseType === BusinessType.CR;
55
55
  var _h = data.verify.responseBody || {}, entity = _h.entity, flows = _h.flows;
56
56
  var _j = entity || {}, AOA_file = _j.AOA_file, id = _j.id, documents = _j.documents, data_status = _j.data_status, data_verification = _j.data_verification, legal_name = _j.legal_name, type = _j.type, license = _j.license;
57
+ var getSchema = function () {
58
+ if (isSACountry)
59
+ return EntityNameValidationSchema();
60
+ if (isKWCountry)
61
+ return EntityNameKWValidationSchema();
62
+ return EntityNameOtherCountryValidationSchema();
63
+ };
57
64
  var methods = useForm({
58
- resolver: yupResolver(isSACountry ? EntityNameValidationSchema() : EntityNameKWValidationSchema()),
65
+ resolver: yupResolver(getSchema()),
59
66
  defaultValues: {
60
67
  legalName: legalName,
61
68
  licenseNumber: licenseNumber,
@@ -130,8 +137,8 @@ var EntityName = function (_a) {
130
137
  dispatch(clearError());
131
138
  }, [methods.formState.isValid]);
132
139
  var disabled = !methods.formState.isValid || !!error || uploading || uploadingArticle;
133
- var showLicenseNumber = !isSACountry ? isCR : true;
140
+ var showLicenseNumber = isKWCountry ? isCR : true;
134
141
  var showUnifiedNumber = isSACountry ? isCR : false;
135
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']), isVerified: isLegalNameVerified }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); }, isVerified: isEntityTypeVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseNumber, { show: showLicenseNumber, readOnly: readOnly['licenseNumber'] || noneEditable['license.number'], isVerified: isLicenseNumberVerified }), _jsx(UnifiedNumber, { show: showUnifiedNumber, readOnly: readOnly['unifiedNumber'] || noneEditable['license.additional_info'], isVerified: isUnifiedNumberVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose, readOnly: readOnly['issuingDate'] || noneEditable['license.issuing_date'], isVerified: isIssuingDateVerified }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose, readOnly: readOnly['expiryDate'] || noneEditable['license.expiry_date'], isVerified: isExpiryDateVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseCertificate, { defaultFiles: defaultCertificateFiles, show: !(isKWCountry && !isCR), readOnly: readOnly['certificateId'] || noneEditable['documents'] }), _jsx(Article, { defaultFile: defaultArticleFile, show: true, readOnly: readOnly['articleId'] || noneEditable['AOA_file_id'], isVerified: isArticleIdVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
142
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']), isVerified: isLegalNameVerified }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); }, isVerified: isEntityTypeVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseNumber, { show: showLicenseNumber, readOnly: readOnly['licenseNumber'] || noneEditable['license.number'], isVerified: isLicenseNumberVerified }), _jsx(UnifiedNumber, { show: showUnifiedNumber, readOnly: readOnly['unifiedNumber'] || noneEditable['license.additional_info'], isVerified: isUnifiedNumberVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose, readOnly: readOnly['issuingDate'] || noneEditable['license.issuing_date'], isVerified: isIssuingDateVerified }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose, readOnly: readOnly['expiryDate'] || noneEditable['license.expiry_date'], isVerified: isExpiryDateVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseCertificate, { defaultFiles: defaultCertificateFiles, show: isSACountry && isCR, readOnly: readOnly['certificateId'] || noneEditable['documents'] }), _jsx(Article, { defaultFile: defaultArticleFile, show: true, readOnly: readOnly['articleId'] || noneEditable['AOA_file_id'], isVerified: isArticleIdVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
136
143
  };
137
144
  export default EntityName;
@@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
17
17
  import { BusinessType } from '../../../../@types';
18
- import { isSA, removeAllOtherThanCharsAndNumber } from '../../../../utils';
18
+ import { isKW, isOtherThanKWOrSA, removeAllOtherThanCharsAndNumber } from '../../../../utils';
19
19
  import { settingsSelector } from '../../../../app/settings';
20
20
  import { CR_MIN_LICENSE_LENGTH, CR_NUMBER_MAX_LENGTH, FL_MIN_LICENSE_LENGTH, FL_NUMBER_ENTITY_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
21
21
  import Collapse from '../../../../components/Collapse';
@@ -34,7 +34,8 @@ var LicenseNumber = function (_a) {
34
34
  var entity = (data.verify.responseBody || {}).entity;
35
35
  var type = data.entityNameData.licenseType;
36
36
  var number = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
37
- var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
37
+ var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
38
+ var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
38
39
  var handleChange = function (_a) {
39
40
  var target = _a.target;
40
41
  if (bckError)
@@ -46,8 +47,8 @@ var LicenseNumber = function (_a) {
46
47
  var licenseNumberValue = licenseNumberControl.field.value;
47
48
  var error = (_c = licenseNumberControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
48
49
  var isCR = type === BusinessType.CR;
49
- var length = !isSACountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_MAX_LENGTH : FL_NUMBER_ENTITY_LENGTH;
50
- var minLength = !isSACountry ? KW_MIN_LICENSE_LENGTH : isCR ? CR_MIN_LICENSE_LENGTH : FL_MIN_LICENSE_LENGTH;
50
+ var length = isKWCountry || isOtherCountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_MAX_LENGTH : FL_NUMBER_ENTITY_LENGTH;
51
+ var minLength = isKWCountry || isOtherCountry ? KW_MIN_LICENSE_LENGTH : isCR ? CR_MIN_LICENSE_LENGTH : FL_MIN_LICENSE_LENGTH;
51
52
  return (_jsx(Collapse, __assign({ in: show && !!number }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('license_number_label'), onChange: handleChange, inputProps: { maxLength: length }, value: licenseNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }), endAdornment: _jsx(EndAdornment, { value: licenseNumberValue, isVerified: isVerified }) }) })) })));
52
53
  };
53
54
  export default React.memo(LicenseNumber);
@@ -58,3 +58,31 @@ export declare const EntityNameKWValidationSchema: () => yup.ObjectSchema<import
58
58
  certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
59
59
  articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
60
60
  }>>>;
61
+ export declare const EntityNameOtherCountryValidationSchema: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
62
+ legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
63
+ licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
64
+ entityType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
65
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
66
+ issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
67
+ expiryDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
68
+ certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
69
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
70
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
71
+ legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
72
+ licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
73
+ entityType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
74
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
75
+ issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
76
+ expiryDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
77
+ certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
78
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
79
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
80
+ legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
81
+ licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
82
+ entityType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
83
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
84
+ issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
85
+ expiryDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
86
+ certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
87
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
88
+ }>>>;
@@ -89,3 +89,41 @@ export var EntityNameKWValidationSchema = function () {
89
89
  articleId: yup.string().optional()
90
90
  });
91
91
  };
92
+ export var EntityNameOtherCountryValidationSchema = function () {
93
+ return yup.object().shape({
94
+ legalName: yup
95
+ .string()
96
+ .required('')
97
+ .test({
98
+ test: function (value) {
99
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
100
+ if (length === 0)
101
+ return true;
102
+ return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
103
+ }
104
+ }),
105
+ licenseType: yup.string().optional(),
106
+ entityType: yup.string().required('entity_type_required'),
107
+ licenseNumber: yup
108
+ .string()
109
+ .when('licenseType', function (licenseType) {
110
+ var isCR = licenseType === BusinessType.CR;
111
+ return yup
112
+ .string()
113
+ .required('')
114
+ .test({
115
+ test: function (value) {
116
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
117
+ if (length === 0)
118
+ return true;
119
+ return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: isCR ? 'cr_kw_max_length' : 'fl_max_length' });
120
+ }
121
+ });
122
+ })
123
+ .required(''),
124
+ issuingDate: yup.string().required('choose_any_issuing_date'),
125
+ expiryDate: yup.string().required('choose_any_expiry_date'),
126
+ certificateId: yup.array().optional(),
127
+ articleId: yup.string().optional()
128
+ });
129
+ };
@@ -19,7 +19,7 @@ import Box from '@mui/material/Box';
19
19
  import { alpha, styled } from '@mui/material/styles';
20
20
  import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
21
21
  import { DocumentPurpose, IndividualType } from '../../../../@types';
22
- import { deepCopy, getIndividualType, isSA } from '../../../../utils';
22
+ import { deepCopy, getIndividualType, isKW } from '../../../../utils';
23
23
  import Form from '../../../../components/Form';
24
24
  import Collapse from '../../../../components/Collapse';
25
25
  import Text from '../../../../components/Text';
@@ -62,9 +62,9 @@ var AdditionalIndividualInfo = function (_a) {
62
62
  var user = (verify.responseBody || {}).user;
63
63
  var _d = data.individualData, occupation = _d.occupation, sourceIncome = _d.sourceIncome, monthlyIncome = _d.monthlyIncome, employerName = _d.employerName, isPEP = _d.isPEP, isInfluencer = _d.isInfluencer, civilID = _d.civilID, signatureFileId = _d.signatureFileId, civilIDUploading = _d.civilIDUploading, signatureFileUploading = _d.signatureFileUploading, shareCount = _d.shareCount, shareValue = _d.shareValue;
64
64
  var _e = user || {}, documents = _e.documents, is_authorized = _e.is_authorized, data_status = _e.data_status, data_verification = _e.data_verification, names = _e.names, role = _e.role, occupationRes = _e.occupation, is_relative_PEP = _e.is_relative_PEP, is_influencer = _e.is_influencer, objects = _e.objects;
65
- var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
65
+ var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
66
66
  var methods = useForm({
67
- resolver: yupResolver(IndividualInfoValidationSchema(objects, isSACountry)),
67
+ resolver: yupResolver(IndividualInfoValidationSchema(objects, isKWCountry)),
68
68
  defaultValues: {
69
69
  occupation: occupation,
70
70
  sourceIncome: sourceIncome,
@@ -144,7 +144,7 @@ var AdditionalIndividualInfo = function (_a) {
144
144
  var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
145
145
  var isOccupationListActive = listActive === ListType.OccupationList;
146
146
  var disabled = !methods.formState.isValid || civilIDUploading || signatureFileUploading;
147
- return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!is_authorized, timeout: 500 }, { children: _jsx(TextBoxStyled, { children: getUserName() || '' }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { isVerified: isOccupationVerified, readOnly: readOnly['occupation'] || noneEditable['occupation'], onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: showOccupationFile && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { readOnly: readOnly['sourceIncome'] || noneEditable['source_of_income'], onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: showSourceOfIncome && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { readOnly: readOnly['monthlyIncome'] || noneEditable['monthly_income'], show: showSourceOfIncome && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ShareCount, { show: !listActive && showShares, readOnly: readOnly['shareCount'] }), _jsx(ShareValue, { show: !listActive && showShares, readOnly: readOnly['shareValue'] }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, { show: !isSACountry, readOnly: readOnly['civilID'], defaultFiles: defaultCivilIdFiles }), _jsx(SignatureFile, { show: is_authorized && showSignatureFile, readOnly: readOnly['signatureFileId'], defaultFiles: defaultSignatureFiles })] })), _jsx(PEPSwitch, { show: showIsPEP && !listActive, readOnly: readOnly['isPEP'] || noneEditable['is_relative_PEP'], isVerified: isPEPSwitchVerified }), _jsx(InfluencerSwitch, { show: showIsInfluencer && !isSACountry && !listActive, readOnly: readOnly['isInfluencer'] || noneEditable['is_influencer'], isVerified: isInfluencerSwitchVerified })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
147
+ return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!is_authorized, timeout: 500 }, { children: _jsx(TextBoxStyled, { children: getUserName() || '' }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { isVerified: isOccupationVerified, readOnly: readOnly['occupation'] || noneEditable['occupation'], onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: showOccupationFile && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { readOnly: readOnly['sourceIncome'] || noneEditable['source_of_income'], onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: showSourceOfIncome && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { readOnly: readOnly['monthlyIncome'] || noneEditable['monthly_income'], show: showSourceOfIncome && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ShareCount, { show: !listActive && showShares, readOnly: readOnly['shareCount'] }), _jsx(ShareValue, { show: !listActive && showShares, readOnly: readOnly['shareValue'] }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, { show: isKWCountry, readOnly: readOnly['civilID'], defaultFiles: defaultCivilIdFiles }), _jsx(SignatureFile, { show: is_authorized && showSignatureFile, readOnly: readOnly['signatureFileId'], defaultFiles: defaultSignatureFiles })] })), _jsx(PEPSwitch, { show: showIsPEP && !listActive, readOnly: readOnly['isPEP'] || noneEditable['is_relative_PEP'], isVerified: isPEPSwitchVerified }), _jsx(InfluencerSwitch, { show: showIsInfluencer && isKWCountry && !listActive, readOnly: readOnly['isInfluencer'] || noneEditable['is_influencer'], isVerified: isInfluencerSwitchVerified })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
148
148
  };
149
149
  export default React.memo(AdditionalIndividualInfo);
150
150
  AdditionalIndividualInfo.defaultProps = {};
@@ -1,6 +1,6 @@
1
1
  import * as yup from 'yup';
2
2
  import { IndividualType } from '../../../../@types';
3
- export declare const IndividualInfoValidationSchema: (objects: Array<IndividualType>, isSACountry: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ export declare const IndividualInfoValidationSchema: (objects: Array<IndividualType>, isKWCountry: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
4
4
  occupation: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
5
5
  sourceIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
6
6
  monthlyIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
@@ -1,6 +1,6 @@
1
1
  import * as yup from 'yup';
2
2
  import { getIndividualType } from '../../../../utils';
3
- export var IndividualInfoValidationSchema = function (objects, isSACountry) {
3
+ export var IndividualInfoValidationSchema = function (objects, isKWCountry) {
4
4
  var isUserType = getIndividualType(objects).isUser;
5
5
  return yup.object().shape({
6
6
  occupation: isUserType ? yup.object().required('alert_choose_occupation') : yup.object().optional(),
@@ -9,7 +9,7 @@ export var IndividualInfoValidationSchema = function (objects, isSACountry) {
9
9
  civilID: yup.array().optional(),
10
10
  signatureFileId: yup.array().optional(),
11
11
  isPEP: isUserType ? yup.boolean().required('please_choose_relative_pep') : yup.boolean().optional().nullable(),
12
- isInfluencer: isUserType && !isSACountry ? yup.boolean().required('please_choose_are_you_influncer') : yup.boolean().optional().nullable(),
12
+ isInfluencer: isUserType && isKWCountry ? yup.boolean().required('please_choose_are_you_influncer') : yup.boolean().optional().nullable(),
13
13
  shareCount: yup.string().optional(),
14
14
  shareValue: yup.string().optional()
15
15
  });
@@ -26,7 +26,7 @@ var MailBoxStyled = styled(Box)(function () { return ({
26
26
  }); });
27
27
  var TitleStyled = styled(Text)(function (_a) {
28
28
  var theme = _a.theme;
29
- return (__assign(__assign({}, theme.typography.body1), { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, marginBlockEnd: theme.spacing(2.375), lineHeight: 1.75, padding: '0px 20px' }));
29
+ return (__assign(__assign({}, theme.typography.body1), { textAlign: 'center', fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, marginBlockEnd: theme.spacing(2.375), lineHeight: 1.75, padding: '0px 20px' }));
30
30
  });
31
31
  var DescriptionStyled = styled(Text)(function (_a) {
32
32
  var theme = _a.theme;
@@ -1,4 +1,5 @@
1
1
  export declare const useCountry: (code: string) => {
2
2
  isKuwait: boolean;
3
3
  isSaudi: boolean;
4
+ isOther: boolean;
4
5
  };
@@ -1,7 +1,8 @@
1
- import { isKW } from '../utils';
1
+ import { isKW, isSA } from '../utils';
2
2
  import { useMemo } from 'react';
3
3
  export var useCountry = function (code) {
4
4
  var isKuwait = useMemo(function () { return isKW(code); }, [code]);
5
- var isSaudi = useMemo(function () { return isKW(code); }, [code]);
6
- return { isKuwait: isKuwait, isSaudi: isSaudi };
5
+ var isSaudi = useMemo(function () { return isSA(code); }, [code]);
6
+ var isOther = useMemo(function () { return !isKW(code) && !isSA(code); }, [code]);
7
+ return { isKuwait: isKuwait, isSaudi: isSaudi, isOther: isOther };
7
8
  };
@@ -46,6 +46,7 @@ export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?:
46
46
  export declare const getEighteenYearsAgo: () => string;
47
47
  export declare const isKW: (flag: string) => boolean;
48
48
  export declare const isSA: (flag: string) => boolean;
49
+ export declare const isOtherThanKWOrSA: (flag: string) => boolean;
49
50
  export declare const isLinkedIn: (flag: string) => boolean;
50
51
  export declare const isTwitter: (flag: string) => boolean;
51
52
  export declare const isWebsite: (flag: string) => boolean;
@@ -206,6 +206,9 @@ export var isKW = function (flag) {
206
206
  export var isSA = function (flag) {
207
207
  return ['sa', 'sau'].includes(flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
208
208
  };
209
+ export var isOtherThanKWOrSA = function (flag) {
210
+ return !isKW(flag) && !isSA(flag);
211
+ };
209
212
  export var isLinkedIn = function (flag) {
210
213
  return 'linkedin' === (flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
211
214
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.6.12-test",
3
+ "version": "2.6.16-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",