@tap-payments/auth-jsconnect 2.6.10-test → 2.6.13-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 (58) hide show
  1. package/build/@types/app.d.ts +2 -1
  2. package/build/@types/app.js +1 -0
  3. package/build/api/country.d.ts +1 -0
  4. package/build/api/country.js +8 -1
  5. package/build/api/index.d.ts +1 -0
  6. package/build/app/settings.js +2 -5
  7. package/build/constants/api.d.ts +1 -0
  8. package/build/constants/api.js +3 -1
  9. package/build/constants/app.js +11 -5
  10. package/build/constants/dummy.d.ts +45 -0
  11. package/build/constants/dummy.js +330 -0
  12. package/build/features/app/brand/brandStore.d.ts +2 -0
  13. package/build/features/app/brand/brandStore.js +19 -12
  14. package/build/features/app/business/businessStore.d.ts +5 -0
  15. package/build/features/app/business/businessStore.js +107 -72
  16. package/build/features/app/connectExpress/connectExpressStore.js +27 -13
  17. package/build/features/app/entity/entityStore.d.ts +2 -0
  18. package/build/features/app/entity/entityStore.js +23 -16
  19. package/build/features/app/individual/individualStore.d.ts +2 -0
  20. package/build/features/app/individual/individualStore.js +19 -12
  21. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +3 -3
  22. package/build/features/business/screens/BusinessType/BusinessType.js +13 -5
  23. package/build/features/business/screens/BusinessType/EntityName.js +3 -3
  24. package/build/features/business/screens/BusinessType/LicenseList.js +3 -3
  25. package/build/features/business/screens/BusinessType/LicenseNumber.js +9 -8
  26. package/build/features/business/screens/BusinessType/validation.d.ts +10 -0
  27. package/build/features/business/screens/BusinessType/validation.js +16 -0
  28. package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -3
  29. package/build/features/connect/Connect.js +3 -3
  30. package/build/features/connect/screens/Mobile/Mobile.js +7 -6
  31. package/build/features/connect/screens/Mobile/MobileNumber.js +9 -6
  32. package/build/features/connectExpress/ConnectExpress.js +3 -3
  33. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +12 -4
  34. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +6 -6
  35. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +8 -7
  36. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +13 -0
  37. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +67 -0
  38. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +4 -0
  39. package/build/features/connectExpress/screens/IdentityOTP/OTP.js +1 -1
  40. package/build/features/connectExpress/screens/IdentityOTP/OTPInput.js +1 -1
  41. package/build/features/connectExpress/screens/Mobile/Mobile.js +2 -2
  42. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +9 -6
  43. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +4 -6
  44. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +4 -6
  45. package/build/features/entity/screens/EntityName/EntityName.js +11 -4
  46. package/build/features/entity/screens/EntityName/LicenseNumber.js +5 -4
  47. package/build/features/entity/screens/EntityName/validation.d.ts +28 -0
  48. package/build/features/entity/screens/EntityName/validation.js +38 -0
  49. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +4 -4
  50. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +2 -2
  51. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +3 -5
  52. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +1 -1
  53. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -2
  54. package/build/hooks/useCountry.d.ts +1 -0
  55. package/build/hooks/useCountry.js +4 -3
  56. package/build/utils/string.d.ts +1 -0
  57. package/build/utils/string.js +3 -0
  58. package/package.json +1 -1
@@ -15,14 +15,14 @@ import { useForm, FormProvider } from 'react-hook-form';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { yupResolver } from '@hookform/resolvers/yup';
17
17
  import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
18
- import { deepCopy, isSA } from '../../../../utils';
18
+ import { deepCopy, isKW, isSA } from '../../../../utils';
19
19
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
20
20
  import Form from '../../../../components/Form';
21
21
  import Collapse from '../../../../components/Collapse';
22
22
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
23
23
  import { connectExpressSelector, clearError, updateLeadBusinessDataAsync } from '../../../app/connectExpress/connectExpressStore';
24
24
  import Button from '../../../shared/Button';
25
- import { KWBusinessDataSchema, BusinessDataSchema } from './validation';
25
+ import { KWBusinessDataSchema, BusinessDataSchema, OtherThanKWOrSABusinessDataSchema } from './validation';
26
26
  import LicenseList from './LicenseList';
27
27
  import BrandName from './BrandName';
28
28
  import TAC from './TAC';
@@ -37,9 +37,17 @@ var CollectBusinessInfo = function (_a) {
37
37
  var dispatch = useAppDispatch();
38
38
  var _c = React.useState(false), listActive = _c[0], setListActive = _c[1];
39
39
  var _d = React.useState(false), brandNameChecking = _d[0], setBrandNameChecking = _d[1];
40
+ var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
40
41
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
42
+ var getSchema = React.useMemo(function () {
43
+ if (isKWCountry)
44
+ return KWBusinessDataSchema(isLeadIdPassed);
45
+ if (isSACountry)
46
+ return BusinessDataSchema(isLeadIdPassed);
47
+ return OtherThanKWOrSABusinessDataSchema(isLeadIdPassed);
48
+ }, [isLeadIdPassed]);
41
49
  var methods = useForm({
42
- resolver: yupResolver(!isSACountry ? KWBusinessDataSchema(isLeadIdPassed) : BusinessDataSchema(isLeadIdPassed)),
50
+ resolver: yupResolver(getSchema),
43
51
  defaultValues: {
44
52
  brandName: brandName,
45
53
  selectedLicense: selectedLicense,
@@ -78,6 +86,6 @@ var CollectBusinessInfo = function (_a) {
78
86
  setListActive(true);
79
87
  }, onListClose: function () {
80
88
  setListActive(false);
81
- } }), _jsx(TAC, { show: !isLeadIdPassed, readOnly: readOnly['termAndConditionChecked'] }), _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') })) }))] })) })) }));
89
+ } }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(TAC, { show: !isLeadIdPassed, readOnly: readOnly['termAndConditionChecked'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') }))] }))] })) })) }));
82
90
  };
83
91
  export default React.memo(CollectBusinessInfo);
@@ -28,7 +28,7 @@ import Box from '@mui/material/Box';
28
28
  import { styled } from '@mui/material/styles';
29
29
  import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
30
30
  import { BusinessType } from '../../../../@types';
31
- import { isOtherLicense, isSA } from '../../../../utils';
31
+ import { isKW, isOtherLicense, isSA } from '../../../../utils';
32
32
  import { settingsSelector } from '../../../../app/settings';
33
33
  import { OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../../constants';
34
34
  import SimpleList from '../../../../components/SimpleList';
@@ -81,6 +81,7 @@ var LicenseList = function (_a) {
81
81
  (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
82
82
  };
83
83
  var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
84
+ var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
84
85
  React.useEffect(function () {
85
86
  if ((licenseList || []).length > 0)
86
87
  setValue('licenseList', licenseList);
@@ -95,8 +96,7 @@ var LicenseList = function (_a) {
95
96
  }, [licenseList, selectedLicense]);
96
97
  React.useEffect(function () {
97
98
  if (!!country_code) {
98
- var isNonSA = !isSA(country_code);
99
- if (isNonSA) {
99
+ if (isKWCountry) {
100
100
  var license = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR ? OTHER_CR_LICENSE : OTHER_FL_LICENSE;
101
101
  setValue('selectedLicense', license, { shouldValidate: true });
102
102
  }
@@ -132,8 +132,8 @@ var LicenseList = function (_a) {
132
132
  var licenseReadonly = !isOtherLicense(selected);
133
133
  var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
134
134
  var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
135
- return (_jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: isSACountry }, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: readOnly, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
136
- return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
137
- } }) }))] })), _jsx(LicenseType, { show: show && !isSACountry, readOnly: readOnly }), _jsx(LicenseNumber, { show: !isSACountry ? isCR : show, readOnly: licenseReadonly })] }));
135
+ return (_jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: readOnly, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
136
+ return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
137
+ } }) })), _jsx(LicenseType, { show: show && isKWCountry, readOnly: readOnly }), _jsx(LicenseNumber, { show: isKWCountry ? isCR : show, readOnly: licenseReadonly })] }));
138
138
  };
139
139
  export default React.memo(LicenseList);
@@ -14,7 +14,7 @@ import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import { CR_MIN_LICENSE_LENGTH, CR_NUMBER_MAX_LENGTH, FL_MIN_LICENSE_LENGTH, FL_NUMBER_MAX_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
17
- import { removeAllOtherThanCharsAndNumber, isSA } from '../../../../utils';
17
+ import { removeAllOtherThanCharsAndNumber, isKW, isOtherThanKWOrSA } from '../../../../utils';
18
18
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
19
19
  import ClearIcon from '../../../shared/ClearIcon';
20
20
  import CheckIcon from '../../../shared/CheckIcon';
@@ -30,8 +30,9 @@ var LicenseNumber = function (_a) {
30
30
  var _c = useFormContext(), control = _c.control, watch = _c.watch, getValues = _c.getValues;
31
31
  var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
32
32
  var settingsData = useAppSelector(settingsSelector).data;
33
- var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
34
- var selectedLicense = !isSACountry ? watch('selectedLicense') : getValues('selectedLicense');
33
+ var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
34
+ var isOtherThanKWOrSACountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
35
+ var selectedLicense = isKWCountry ? watch('selectedLicense') : getValues('selectedLicense');
35
36
  var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
36
37
  var handleFLNumberChange = function (_a) {
37
38
  var target = _a.target;
@@ -43,10 +44,10 @@ var LicenseNumber = function (_a) {
43
44
  };
44
45
  var licenseNumberValue = licenseNumberControl.field.value;
45
46
  var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
46
- var length = !isSACountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_MAX_LENGTH : FL_NUMBER_MAX_LENGTH;
47
- var minLength = !isSACountry ? KW_MIN_LICENSE_LENGTH : isCR ? CR_MIN_LICENSE_LENGTH : FL_MIN_LICENSE_LENGTH;
47
+ var length = isKWCountry || isOtherThanKWOrSACountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_MAX_LENGTH : FL_NUMBER_MAX_LENGTH;
48
+ var minLength = isKWCountry || isOtherThanKWOrSACountry ? KW_MIN_LICENSE_LENGTH : isCR ? CR_MIN_LICENSE_LENGTH : FL_MIN_LICENSE_LENGTH;
48
49
  var label = isCR ? 'cr_number' : 'fl_number';
49
- var showCheckIcon = !isSACountry ? (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) >= minLength : (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length;
50
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required: !isSACountry, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: showCheckIcon || (readOnly && licenseNumberValue) ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) }) })));
50
+ var showCheckIcon = isKWCountry || isOtherThanKWOrSACountry ? (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) >= minLength : (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length;
51
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required: isKWCountry, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: showCheckIcon || (readOnly && licenseNumberValue) ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) }) })));
51
52
  };
52
53
  export default React.memo(LicenseNumber);
@@ -1,4 +1,17 @@
1
1
  import * as yup from 'yup';
2
+ export declare const OtherThanKWOrSABusinessDataSchema: (isLeadIdPassed: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ selectedLicense: any;
5
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
+ brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ selectedLicense: any;
9
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
10
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
11
+ brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
12
+ selectedLicense: any;
13
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
+ }>>>;
2
15
  export declare const BusinessDataSchema: (isLeadIdPassed: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
16
  brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
17
  selectedLicense: any;
@@ -11,6 +11,73 @@ var objectElements = {
11
11
  }),
12
12
  type: yup.string()
13
13
  };
14
+ export var OtherThanKWOrSABusinessDataSchema = function (isLeadIdPassed) {
15
+ if (!isLeadIdPassed) {
16
+ return yup.object().shape({
17
+ brandName: yup
18
+ .string()
19
+ .test({
20
+ test: function (value) {
21
+ if ((value === null || value === void 0 ? void 0 : value.length) === 0)
22
+ return true;
23
+ if (value && value.length >= 3)
24
+ return true;
25
+ return this.createError({ message: 'enter_brand_name_english_chars_numbers_space' });
26
+ }
27
+ })
28
+ .required('enter_brand_name_english_chars_numbers_space'),
29
+ selectedLicense: yup.object().shape(objectElements).required(''),
30
+ licenseNumber: yup
31
+ .string()
32
+ .test({
33
+ test: function (value) {
34
+ var selectedLicense = this.parent.selectedLicense;
35
+ var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
36
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
37
+ if (length === 0)
38
+ return true;
39
+ if (isCR) {
40
+ return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
41
+ }
42
+ return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
43
+ }
44
+ })
45
+ .required(''),
46
+ termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond')
47
+ });
48
+ }
49
+ return yup.object().shape({
50
+ brandName: yup
51
+ .string()
52
+ .test({
53
+ test: function (value) {
54
+ if ((value === null || value === void 0 ? void 0 : value.length) === 0)
55
+ return true;
56
+ if (value && value.length >= 3)
57
+ return true;
58
+ return this.createError({ message: 'enter_brand_name_english_chars_numbers_space' });
59
+ }
60
+ })
61
+ .required('enter_brand_name_english_chars_numbers_space'),
62
+ selectedLicense: yup.object().shape(objectElements).required(''),
63
+ licenseNumber: yup
64
+ .string()
65
+ .test({
66
+ test: function (value) {
67
+ var selectedLicense = this.parent.selectedLicense;
68
+ var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
69
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
70
+ if (length === 0)
71
+ return true;
72
+ if (isCR) {
73
+ return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
74
+ }
75
+ return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
76
+ }
77
+ })
78
+ .required('')
79
+ });
80
+ };
14
81
  export var BusinessDataSchema = function (isLeadIdPassed) {
15
82
  if (!isLeadIdPassed) {
16
83
  return yup.object().shape({
@@ -47,6 +47,7 @@ var CollectIndividualInfo = function (_a) {
47
47
  var isAr = useLanguage().isAr;
48
48
  var individualData = data.individualData, otpData = data.otpData, responseData = data.responseData;
49
49
  var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
50
+ var startWithNIDMissed = otpData.authFor === AuthForType.NATIONAL_ID_MISSED;
50
51
  var contact = ((responseData === null || responseData === void 0 ? void 0 : responseData.leadData) || {}).contact;
51
52
  var countryCode = individualData.countryCode;
52
53
  var isEmailAvailable = (responseData || {}).isEmailAvailable;
@@ -71,6 +72,9 @@ var CollectIndividualInfo = function (_a) {
71
72
  dispatch(resetIndividualScreen());
72
73
  var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
73
74
  var screen = startWithNID ? (isKW(code) ? 'CONNECT_EXPRESS_CIVIL_ID_STEP' : 'CONNECT_EXPRESS_NID_STEP') : 'CONNECT_EXPRESS_MOBILE_STEP';
75
+ if (startWithNIDMissed) {
76
+ screen = isKW(code) ? 'CONNECT_EXPRESS_CIVIL_ID_MISSED_STEP' : 'CONNECT_EXPRESS_NID_MISSED_STEP';
77
+ }
74
78
  dispatch(handlePrevScreenStep(screen));
75
79
  };
76
80
  React.useEffect(function () {
@@ -58,7 +58,7 @@ var OTP = function () {
58
58
  defaultValues: data.otpData,
59
59
  mode: 'onChange'
60
60
  });
61
- var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID;
61
+ var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID_MISSED;
62
62
  React.useEffect(function () {
63
63
  if (error)
64
64
  dispatch(clearError());
@@ -35,7 +35,7 @@ var OTPInput = function (_a) {
35
35
  var otpControl = useController({ name: 'otp', control: control });
36
36
  var _c = useAppSelector(connectExpressSelector), data = _c.data, error = _c.error;
37
37
  var nidData = data.nidData;
38
- var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID;
38
+ var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID_MISSED;
39
39
  var handleOnOTPChange = function (otp) {
40
40
  if (error)
41
41
  dispatch(clearError());
@@ -76,7 +76,7 @@ var Mobile = function (_a) {
76
76
  var t = useTranslation().t;
77
77
  var isAr = useLanguage().isAr;
78
78
  var dispatch = useAppDispatch();
79
- var isKuwait = useCountry(settingData.businessCountry.iso2).isKuwait;
79
+ var _f = useCountry(settingData.businessCountry.iso2), isKuwait = _f.isKuwait, isOther = _f.isOther;
80
80
  var responseData = data.responseData, isLeadIdPassed = data.isLeadIdPassed;
81
81
  var isLeadIdentityIdAvailable = !((_c = (_b = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _b === void 0 ? void 0 : _b.identification) === null || _c === void 0 ? void 0 : _c.id);
82
82
  var methods = useForm({
@@ -107,6 +107,6 @@ var Mobile = function (_a) {
107
107
  var originalReadOnly = useFormReadOnly(methods);
108
108
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
109
109
  var disabled = !methods.formState.isValid || !!error;
110
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { readOnly: readOnly['mobile'], show: true, countries: settingData.countries, onListOpen: handleCountryOpen, onListClose: handleCountryClose }) }), _jsxs(Collapse, __assign({ in: !anchor }, { children: [_jsx(TAC, { show: isLeadIdPassed, readOnly: readOnly['termAndConditionChecked'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: isLeadIdPassed ? !isLeadIdentityIdAvailable : !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKuwait ? (_jsx(MobileButton, __assign({ disabled: loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(AbsherButton, __assign({ disabled: loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') })))] }))] }))] })) })) }));
110
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { readOnly: readOnly['mobile'], show: true, countries: settingData.countries, onListOpen: handleCountryOpen, onListClose: handleCountryClose }) }), _jsxs(Collapse, __assign({ in: !anchor }, { children: [_jsx(TAC, { show: isLeadIdPassed, readOnly: readOnly['termAndConditionChecked'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: (isLeadIdPassed ? !isLeadIdentityIdAvailable : !methods.formState.isValid) && !isOther }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKuwait ? (_jsx(MobileButton, __assign({ disabled: loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(AbsherButton, __assign({ disabled: loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') })))] }))] }))] })) })) }));
111
111
  };
112
112
  export default React.memo(Mobile);
@@ -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,20 +14,18 @@ import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
17
- import { settingsSelector } from '../../../../app/settings';
18
- import { findCurrencyByIso2, formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
17
+ import { formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
19
18
  import { ScreenContainer } from '../../../shared/Containers';
20
19
  import Input from '../../../shared/Input';
21
- import { clearError } from '../../../app/entity/entityStore';
20
+ import { clearError, entitySelector } from '../../../app/entity/entityStore';
22
21
  import { EndAdornment } from '../../../shared/EndAdornment';
23
22
  var CapitalPaid = function (_a) {
24
23
  var _b;
25
24
  var readOnly = _a.readOnly, isVerified = _a.isVerified;
26
25
  var t = useTranslation().t;
27
- var settingsData = useAppSelector(settingsSelector).data;
26
+ var data = useAppSelector(entitySelector).data;
28
27
  var control = useFormContext().control;
29
28
  var dispatch = useAppDispatch();
30
- var countryCode = settingsData.businessCountry.iso2;
31
29
  var handleChange = function (_a) {
32
30
  var target = _a.target;
33
31
  if (error)
@@ -39,7 +37,7 @@ var CapitalPaid = function (_a) {
39
37
  var capitalPaidValue = capitalPaidControl.field.value;
40
38
  var error = (_b = capitalPaidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
41
39
  return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('capital_paid_label', {
42
- currency: t(findCurrencyByIso2(countryCode))
40
+ currency: t(data.currency)
43
41
  }), required: true, onChange: handleChange, value: capitalPaidValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_paid_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: capitalPaidValue, isVerified: isVerified }) }) })));
44
42
  };
45
43
  export default React.memo(CapitalPaid);
@@ -13,21 +13,19 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
- import { findCurrencyByIso2, formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
17
- import { settingsSelector } from '../../../../app/settings';
16
+ import { formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
18
17
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
18
  import { ScreenContainer } from '../../../shared/Containers';
20
19
  import Input from '../../../shared/Input';
21
- import { clearError } from '../../../app/entity/entityStore';
20
+ import { clearError, entitySelector } from '../../../app/entity/entityStore';
22
21
  import { EndAdornment } from '../../../shared/EndAdornment';
23
22
  var CapitalShareValue = function (_a) {
24
23
  var _b;
25
24
  var readOnly = _a.readOnly, isVerified = _a.isVerified;
26
25
  var t = useTranslation().t;
27
- var settingsData = useAppSelector(settingsSelector).data;
26
+ var data = useAppSelector(entitySelector).data;
28
27
  var control = useFormContext().control;
29
28
  var dispatch = useAppDispatch();
30
- var countryCode = settingsData.businessCountry.iso2;
31
29
  var handleChange = function (_a) {
32
30
  var target = _a.target;
33
31
  if (error)
@@ -39,7 +37,7 @@ var CapitalShareValue = function (_a) {
39
37
  var capitalShareValueValue = capitalShareValueControl.field.value;
40
38
  var error = (_b = capitalShareValueControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
41
39
  return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('capital_share_value_label', {
42
- currency: t(findCurrencyByIso2(countryCode))
40
+ currency: t(data.currency)
43
41
  }), required: true, onChange: handleChange, value: capitalShareValueValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_share_value_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: capitalShareValueValue, isVerified: isVerified }) }) })));
44
42
  };
45
43
  export default React.memo(CapitalShareValue);
@@ -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 = {};